@tora-editor/tora 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -58
- package/assets/free-audio/arcade-pop/audio/loss.wav +0 -0
- package/assets/free-audio/arcade-pop/audio/reward.wav +0 -0
- package/assets/free-audio/arcade-pop/audio/win.wav +0 -0
- package/assets/free-audio/arcade-pop/source/INFO.txt +11 -11
- package/assets/kenney-food-starter/License.txt +28 -0
- package/assets/kenney-food-starter/burger.glb +0 -0
- package/assets/kenney-food-starter/frying-pan.glb +0 -0
- package/assets/kenney-food-starter/plan.json +61 -0
- package/assets/kenney-food-starter/plate.glb +0 -0
- package/assets/kenney-food-starter/pot.glb +0 -0
- package/assets/kenney-harvest/audio/victory.wav +0 -0
- package/assets/kenney-harvest/source/music-jingles/OGG/jingles_NES/jingles_NES03.ogg +0 -0
- package/assets/kenney-harvest/source/music-jingles/OGG/jingles_PIZZA/jingles_PIZZA03.ogg +0 -0
- package/assets/kenney-harvest/source/music-jingles/license.txt +14 -0
- package/bin/tora.mjs +322 -28
- package/crates/packer/trusted/native-3d-meta.json +4 -3
- package/crates/packer/trusted/native-3d.js +181 -181
- package/crates/packer/trusted/native-meta.json +3 -3
- package/crates/packer/trusted/native.js +5 -5
- package/crates/packer/trusted/release-manifest.json +17 -17
- package/crates/packer/trusted/review-runtime-meta.json +4 -3
- package/crates/packer/trusted/review-runtime.js +182 -182
- package/docs/MIGRATION_0_3.md +39 -0
- package/docs/NATIVE_AGENT_TOOLS.md +12 -363
- package/docs/TORA_AGENT_SETUP.md +24 -95
- package/docs/TORA_CREATION_API.md +63 -348
- package/docs/reference/CORE_AUTHORING.md +10 -3
- package/docs/reference/PLAYABLE_STARTERS.md +20 -0
- package/docs/reference/packs/3d.md +11 -3
- package/network-rules/mintegral-appgrowth-single-html.json +10 -10
- package/package.json +6 -6
- package/packages/creative-project/project-v21.schema.json +372 -9
- package/scripts/lean/editor/entry.js +11 -6
- package/scripts/lean/editor/project-launcher.js +116 -0
- package/scripts/lean/editor/quick-edit-panel.js +479 -0
- package/scripts/lean/editor/review-editor.css +256 -68
- package/scripts/lean/editor/review-editor.js +1834 -1086
- package/scripts/lean/editor-state.mjs +6 -0
- package/scripts/lean/editor.mjs +6 -3
- package/scripts/lean/matrix.mjs +5 -0
- package/scripts/lean/native/agent-tools.mjs +39 -62
- package/scripts/lean/native/api.mjs +161 -136
- package/scripts/lean/native/asset-catalog.mjs +7 -6
- package/scripts/lean/native/asset-lineage.mjs +54 -0
- package/scripts/lean/native/asset-prep.mjs +173 -40
- package/scripts/lean/native/assets.mjs +107 -11
- package/scripts/lean/native/audio-assets.mjs +30 -0
- package/scripts/lean/native/browser-pool.mjs +34 -0
- package/scripts/lean/native/build-cache.mjs +38 -7
- package/scripts/lean/native/cc0-inputs.mjs +24 -0
- package/scripts/lean/native/cc0-staging.mjs +28 -8
- package/scripts/lean/native/compiler.mjs +9 -3
- package/scripts/lean/native/contracts.mjs +16 -11
- package/scripts/lean/native/creative-qa.mjs +365 -128
- package/scripts/lean/native/demos.mjs +53 -18
- package/scripts/lean/native/document.mjs +50 -12
- package/scripts/lean/native/export-budget.mjs +75 -0
- package/scripts/lean/native/local-bundle.mjs +7 -3
- package/scripts/lean/native/mcp-server.mjs +42 -74
- package/scripts/lean/native/media-validate.mjs +124 -0
- package/scripts/lean/native/modules/harvest-restore.mjs +3 -284
- package/scripts/lean/native/modules/sort-puzzle.mjs +51 -0
- package/scripts/lean/native/modules/star-salvage.mjs +3 -368
- package/scripts/lean/native/native-bin.mjs +3 -3
- package/scripts/lean/native/outcome-playthrough.mjs +97 -0
- package/scripts/lean/native/project-bundle.mjs +6 -5
- package/scripts/lean/native/project-index.mjs +0 -2
- package/scripts/lean/native/qa-adapters.mjs +10 -0
- package/scripts/lean/native/quick-edit.mjs +328 -0
- package/scripts/lean/native/remote-cc0-fetcher.mjs +403 -197
- package/scripts/lean/native/review.mjs +205 -571
- package/scripts/lean/native/schema-vocabulary.mjs +10 -0
- package/scripts/lean/native/schema.mjs +7 -5
- package/scripts/lean/native/scope.mjs +45 -0
- package/scripts/lean/native/service.mjs +378 -79
- package/scripts/lean/native/starters.mjs +563 -0
- package/scripts/lean/native/variant-adapters.mjs +8 -0
- package/scripts/lean/native/variants-core.mjs +186 -0
- package/scripts/lean/native/variants.mjs +63 -0
- package/scripts/lean/native/win-cues.mjs +96 -0
- package/skills/tora-playables/SKILL.md +1 -1
- package/scripts/lean/editor/review-intake.js +0 -837
- package/scripts/lean/model-client.mjs +0 -119
- package/scripts/lean/native/author-expansion-proofs.mjs +0 -240
- package/scripts/lean/native/author-games.mjs +0 -160
- package/scripts/lean/native/author-harvest.mjs +0 -74
- package/scripts/lean/native/author-primitive-proofs.mjs +0 -874
- package/scripts/lean/native/author-salvage.mjs +0 -71
- package/scripts/lean/native/chat-compose.mjs +0 -287
- package/scripts/lean/native/check-harvest-outcome-audio.mjs +0 -191
- package/scripts/lean/native/check-salvage.mjs +0 -197
- package/scripts/lean/native/compatibility.mjs +0 -34
- package/scripts/lean/native/concept.mjs +0 -633
- package/scripts/lean/native/draw-stroke.mjs +0 -26
- package/scripts/lean/native/erase-mask.mjs +0 -18
- package/scripts/lean/native/harvest-recipe.mjs +0 -21
- package/scripts/lean/native/instance-steering.mjs +0 -24
- package/scripts/lean/native/intake-creator-agent.mjs +0 -98
- package/scripts/lean/native/intake-creator-tools.mjs +0 -165
- package/scripts/lean/native/interaction-gestures.mjs +0 -45
- package/scripts/lean/native/match-board.mjs +0 -138
- package/scripts/lean/native/modules/index.mjs +0 -54
- package/scripts/lean/native/modules/tap-collect.mjs +0 -54
- package/scripts/lean/native/path-network.mjs +0 -132
- package/scripts/lean/native/physics-2d.mjs +0 -154
- package/scripts/lean/native/physics-3d.mjs +0 -259
- package/scripts/lean/native/prepare-audio-collections.mjs +0 -112
- package/scripts/lean/native/prepare-game-audio.mjs +0 -372
- package/scripts/lean/native/prepare-golf-3d-assets.py +0 -177
- package/scripts/lean/native/prepare-golf-assets.py +0 -211
- package/scripts/lean/native/prepare-harvest-audio.mjs +0 -83
- package/scripts/lean/native/prepare-harvest-images.mjs +0 -31
- package/scripts/lean/native/prepare-primitive-images.py +0 -25
- package/scripts/lean/native/prepare-space-salvage-images.mjs +0 -89
- package/scripts/lean/native/prepare-traffic-assets.py +0 -329
- package/scripts/lean/native/presentation.mjs +0 -335
- package/scripts/lean/native/review-agent-tools.mjs +0 -561
- package/scripts/lean/native/review-connection.mjs +0 -303
- package/scripts/lean/native/review-fields.mjs +0 -24
- package/scripts/lean/native/review-intake.mjs +0 -385
- package/scripts/lean/native/review-intents.mjs +0 -217
- package/scripts/lean/native/review-provider.mjs +0 -580
- package/scripts/lean/native/review-receipts.mjs +0 -76
- package/scripts/lean/native/review-resolver.mjs +0 -429
- package/scripts/lean/native/review-targets.mjs +0 -35
- package/scripts/lean/native/runtime.mjs +0 -1623
- package/scripts/lean/native/salvage-recipe.mjs +0 -20
- package/scripts/lean/native/stage-3d.mjs +0 -818
- package/scripts/lean/native/verify.mjs +0 -4
- package/scripts/lean/scene-document.mjs +0 -48
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var ToraNative=(()=>{var Ba=Object.defineProperty;var hf=Object.getOwnPropertyDescriptor;var yf=Object.getOwnPropertyNames;var pf=Object.prototype.hasOwnProperty;var mf=(e,t)=>{for(var n in t)Ba(e,n,{get:t[n],enumerable:!0})},gf=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of yf(t))!pf.call(e,l)&&l!==n&&Ba(e,l,{get:()=>t[l],enumerable:!(a=hf(t,l))||a.enumerable});return e};var If=e=>gf(Ba({},"__esModule",{value:!0}),e);var qf={};mf(qf,{computeSafeArea:()=>eo,createNetworkBridge:()=>bl,layoutStandardText:()=>wl,mountNative:()=>Jf});var Oo=function(e,t){if(!e)throw Error(t)},tn=function(){return[1,0,0,1,0,0]};function Wa(e){return Oo(Array.isArray(e)&&e.length===6&&e.every(Number.isFinite),"E_SCENE_MATRIX"),e}function ri(e,t){return Wa(e),Wa(t),[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}function Xt(e){Wa(e);var t=e[0]*e[3]-e[1]*e[2];return Oo(Math.abs(t)>1e-12,"E_SCENE_SINGULAR_TRANSFORM"),[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[3]*e[4])/t,(e[1]*e[4]-e[0]*e[5])/t]}var Da=function(){return Da=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},Da.apply(this,arguments)},nn=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},Dn=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},La=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Vo(e){var t=e.rows,n=e.columns,a=e.seed,l=e.slots,i=e.paint,u=e.onEvent,s=l.map(function(X){return X.group}),E=Dn([],nn(new Set(s)),!1),f=Dn([],nn(s),!1),b=a,k="idle",z=0,re,U,Y=[],oe=[],_=0,ee=0,h=0,V,Te,Ce=function(X,ve){return X*n+ve},xe=function(X){return Math.floor(X/n)},Le=function(X){return X%n},Z=function(){return b=Math.imul(b,1664525)+1013904223>>>0,b/4294967296};function ue(X){for(var ve=new Set,Ve=0;Ve<t;Ve++)for(var ce=0;ce<n;ce++){var Se=Ce(Ve,ce),$e=X[Se];if(ce+2<n&&$e===X[Se+1]&&$e===X[Se+2])for(var Xe=0;Xe<3;Xe++)ve.add(Se+Xe);if(Ve+2<t&&$e===X[Se+n]&&$e===X[Se+n*2])for(var Xe=0;Xe<3;Xe++)ve.add(Se+n*Xe)}return Dn([],nn(ve),!1)}function ie(X,ve){var Ve;if(f[X]===f[ve])return!1;var ce=Dn([],nn(f),!1);return Ve=nn([ce[ve],ce[X]],2),ce[X]=Ve[0],ce[ve]=Ve[1],ue(ce).some(function(Se){return Se===X||Se===ve})}function ye(){for(var X=[],ve=0;ve<f.length;ve++)Le(ve)+1<n&&ie(ve,ve+1)&&X.push({from:l[ve].id,to:l[ve+1].id}),xe(ve)+1<t&&ie(ve,ve+n)&&X.push({from:l[ve].id,to:l[ve+n].id});return X}function R(){for(var X=0;X<64;X++){f=[];for(var ve=function(ce){var Se=E.filter(function($e){return!(Le(ce)>=2&&f[ce-1]===$e&&f[ce-2]===$e)&&!(xe(ce)>=2&&f[ce-n]===$e&&f[ce-n*2]===$e)});f.push(Se[Math.floor(Z()*Se.length)])},Ve=0;Ve<l.length;Ve++)ve(Ve);if(ye().length)return}f=l.map(function(ce,Se){return E[(xe(Se)*2+Le(Se))%3]}),f[0]=E[0],f[1]=E[1],f[2]=E[0],f[n+1]=E[0]}function x(){for(var X=0;X<l.length;X++)i(X,f[X],{})}function $(){b=a,f=Dn([],nn(s),!1),k="idle",z=0,re=void 0,U=void 0,Y=[],oe=[],_=0,ee=0,h=0,V=void 0,Te=void 0,(ue(f).length||!ye().length)&&R(),x()}function D(X,ve){if(k!=="idle")return!1;var Ve=l.findIndex(function(Se){return Se.id===X}),ce=l.findIndex(function(Se){return Se.id===ve});return Ve<0||ce<0||Math.abs(xe(Ve)-xe(ce))+Math.abs(Le(Ve)-Le(ce))!==1?!1:(re=void 0,V=void 0,x(),U=[Ve,ce],k="swap",z=0,!0)}function fe(X){if(k==="idle"){if(re===X){re=void 0;return}if(!(re&&D(re,X)))return re=X,re}}function J(){Y=ue(f),h+=Y.length,Te={group:f[Y[0]],from:l[Y[0]].id,count:Y.length},u("matchClear"),k="clear",z=0}function Q(){var X=new Set(Y),ve=Dn([],nn(f),!1);oe=[];for(var Ve=0;Ve<n;Ve++){for(var ce=[],Se=t-1;Se>=0;Se--)X.has(Ce(Se,Ve))||ce.push(Ce(Se,Ve));for(var $e=0,Se=t-1;Se>=0;Se--){var Xe=Ce(Se,Ve),fr=ce[t-1-Se];fr!==void 0?(ve[Xe]=f[fr],oe.push({cell:Xe,from:fr,offsetRows:0})):(ve[Xe]=E[Math.floor(Z()*E.length)],oe.push({cell:Xe,from:Xe,offsetRows:-(Se+1+$e++)}))}}f=ve,k="fall",z=0}function j(){if(ue(f).length&&_<3){_++,J();return}(ue(f).length||!ye().length)&&R(),x(),k="idle",z=0,U=void 0,Y=[],oe=[],ee++,u("validMatch")}function me(X){var ve,Ve,ce,Se,$e,Xe,fr;if(k==="idle"){if(V){V.elapsed+=X;var Pr=1+.065*Math.sin(Math.min(1,V.elapsed/.8)*Math.PI*4),Or=function(Zt){i(l.findIndex(function($t){return $t.id===Zt}),f[l.findIndex(function($t){return $t.id===Zt})],{scale:Pr})};try{for(var Vr=La(V.ids),Tr=Vr.next();!Tr.done;Tr=Vr.next()){var pn=Tr.value;Or(pn)}}catch(Zt){ve={error:Zt}}finally{try{Tr&&!Tr.done&&(Ve=Vr.return)&&Ve.call(Vr)}finally{if(ve)throw ve.error}}V.elapsed>=.8&&(V=void 0,x())}return}if(z+=X,k==="swap"||k==="reverse"){var Ke=Math.min(1,z/.14),bt=Ke*Ke*(3-2*Ke),Ge=nn(U,2),Ut=Ge[0],_r=Ge[1];if(i(Ut,f[Ut],{from:_r,progress:k==="swap"?bt:1-bt}),i(_r,f[_r],{from:Ut,progress:k==="swap"?bt:1-bt}),Ke<1)return;if(k==="reverse"){x(),k="idle",U=void 0,u("invalidMatch");return}if(!ie(Ut,_r)){k="reverse",z=0;return}ce=nn([f[_r],f[Ut]],2),f[Ut]=ce[0],f[_r]=ce[1],x(),J();return}if(k==="clear"){var Pt=Math.min(1,z/.18),Pr=Pt<.22?1+Pt*.45:Math.max(.05,1.1*(1-Pt)/.78);try{for(var mn=La(Y),wt=mn.next();!wt.done;wt=mn.next()){var zt=wt.value;i(zt,f[zt],{scale:Pr,opacity:1-Pt})}}catch($t){Se={error:$t}}finally{try{wt&&!wt.done&&($e=mn.return)&&$e.call(mn)}finally{if(Se)throw Se.error}}Pt===1&&Q();return}var Yt=Math.min(1,z/.25),Gt=1-Math.pow(1-Yt,3);try{for(var vt=La(oe),at=vt.next();!at.done;at=vt.next()){var Lr=at.value;i(Lr.cell,f[Lr.cell],{from:Lr.from,offsetRows:Lr.offsetRows,progress:1-Gt})}}catch(Zt){Xe={error:Zt}}finally{try{at&&!at.done&&(fr=vt.return)&&fr.call(vt)}finally{if(Xe)throw Xe.error}}Yt===1&&j()}function le(){if(k==="idle"){re=void 0;var X=ye()[0];X&&(V={ids:[X.from,X.to],elapsed:0})}}function Ie(){var X;return{phase:k,busy:k!=="idle",selected:re!=null?re:null,moves:ee,cleared:h,groups:Dn([],nn(f),!1),legalMoves:k==="idle"?ye():[],hint:(X=V==null?void 0:V.ids)!==null&&X!==void 0?X:[],lastMatch:Te?Da({},Te):null}}return{reset:$,select:fe,swap:D,tick:me,showHint:le,snapshot:Ie,cancelSelection:function(){re=void 0,V&&(V=void 0,x())}}}var _i=function(){return _i=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},_i.apply(this,arguments)},No=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},xf=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},zo=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Bo(){var e=new Map,t=new Map,n=function(l){var i,u,s=t.get(l);s!==void 0&&((i=e.get(s))===null||i===void 0||i.delete(l),((u=e.get(s))===null||u===void 0?void 0:u.size)===0&&e.delete(s)),t.delete(l)},a=function(l,i){n(l),i!=null&&(e.has(i)||e.set(i,new Set),e.get(i).add(l),t.set(l,i))};return{occupants:e,itemZone:t,release:n,place:a,clear:function(){e.clear(),t.clear()},items:function(l){var i;return xf([],No((i=e.get(l))!==null&&i!==void 0?i:[]),!1).sort()},zoneOf:function(l){return t.get(l)},snapshot:function(){return{itemZone:Object.fromEntries(t)}}}}function ea(e){var t,n,a=e.itemId,l=e.tag,i=l===void 0?"":l,u=e.zones,s=e.occupancy,E=u.filter(function(U){var Y,oe,_;return U.id!==a&&(((oe=(Y=U.acceptTags)===null||Y===void 0?void 0:Y.length)!==null&&oe!==void 0?oe:0)===0||((_=U.acceptTags)===null||_===void 0?void 0:_.includes(i)))});E.sort(function(U,Y){return Number(Y.itemTarget)-Number(U.itemTarget)||Y.paintOrder-U.paintOrder||U.distance-Y.distance||U.id.localeCompare(Y.id)});try{for(var f=zo(E),b=f.next();!b.done;b=f.next()){var k=b.value,z=s.items(k.id).filter(function(U){return U!==a}),re=k.capacity>0&&z.length>=k.capacity;return k.snapMode==="reject"?{kind:"reject",zone:k,occupantId:z[0]}:re?k.onOccupied==="emit"?{kind:"emit",zone:k,occupantId:z[0]}:k.onOccupied==="swap"&&z.length?{kind:"swap",zone:k,occupantId:z[0]}:{kind:"reject",zone:k,occupantId:z[0]}:{kind:"accept",zone:k}}}catch(U){t={error:U}}finally{try{b&&!b.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}return null}function Wo(e,t,n,a,l,i){if(n===void 0&&(n=28),a===void 0&&(a=-1/0),l===void 0&&(l=0),i===void 0&&(i=80),l-a<i)return null;var u=t.x-e.x,s=t.y-e.y;return Math.max(Math.abs(u),Math.abs(s))<n?null:Math.abs(u)>Math.abs(s)?u<0?"left":"right":s<0?"up":"down"}function Lo(e,t){var n=t,a=1;return{tick:function(l){return e.pingPong?(n+=a*e.ratePerSecond*l,n>=e.max?(n=e.max,a=-1):n<=e.min&&(n=e.min,a=1)):n=Math.max(e.min,Math.min(e.max,n+e.ratePerSecond*l)),n}}}function Do(){var e=new Map;return{to:function(t,n,a,l,i){l===void 0&&(l=.18),e.set(t,{from:_i({},n),to:_i({},a),seconds:Math.max(.02,l),elapsed:0,onDone:i})},cancel:function(t){e.delete(t)},clear:function(){e.clear()},tick:function(t,n){var a,l,i;try{for(var u=zo(e),s=u.next();!s.done;s=u.next()){var E=No(s.value,2),f=E[0],b=E[1];b.elapsed+=t;var k=Math.min(1,b.elapsed/b.seconds),z=1-Math.pow(1-k,3);n(f,{x:b.from.x+(b.to.x-b.from.x)*z,y:b.from.y+(b.to.y-b.from.y)*z}),k===1&&(e.delete(f),(i=b.onDone)===null||i===void 0||i.call(b))}}catch(re){a={error:re}}finally{try{s&&!s.done&&(l=u.return)&&l.call(u)}finally{if(a)throw a.error}}}}}function Ha(e,t,n,a){n===void 0&&(n=56),a===void 0&&(a=.12);var l=Math.max(1,n),i=t.x-e.x,u=t.y-e.y,s=Math.hypot(i,u),E=Math.min(s,l),f=E/l,b=s>1e-6?i/s:0,k=s>1e-6?u/s:0,z=e.x+b*E,re=e.y+k*E;if(f<=a)return{nx:0,ny:0,magnitude:0,angle:0,knobX:z,knobY:re};var U=(f-a)/Math.max(1e-6,1-a);return{nx:b*U,ny:k*U,magnitude:U,angle:Math.atan2(k,b)*180/Math.PI,knobX:z,knobY:re}}var Fa=function(){return Fa=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},Fa.apply(this,arguments)},Ho=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Fo(e){var t,n,a=2166136261;try{for(var l=Ho(String(e)),i=l.next();!i.done;i=l.next()){var u=i.value;a^=u.codePointAt(0),a=Math.imul(a,16777619)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return a>>>0||1}function bf(e){var t=e>>>0||1,n=t;return{next:function(){return n=Math.imul(n,1664525)+1013904223>>>0,n/4294967296},between:function(a,l,i){if(i===void 0&&(i=!1),i){var u=Math.ceil(a),s=Math.floor(l);return s<u?u:Math.min(s,u+Math.floor((s-u+1)*this.next()))}return a+(l-a)*this.next()},reset:function(){n=t}}}function Xo(e,t,n,a,l){var i,u;a===void 0&&(a=0);var s=null,E=1/0;try{for(var f=Ho(t),b=f.next();!b.done;b=f.next()){var k=b.value;if(!(k.id===l||k.team!==n)){var z=Math.hypot(k.x-e.x,k.y-e.y);a>0&&z>a||(z<E||z===E&&k.id<(s==null?void 0:s.id))&&(s=k,E=z)}}}catch(re){i={error:re}}finally{try{b&&!b.done&&(u=f.return)&&u.call(f)}finally{if(i)throw i.error}}return s}function Uo(e,t,n){var a=((t-e+Math.PI)%(Math.PI*2)+Math.PI*2)%(Math.PI*2)-Math.PI;return e+Math.max(-n,Math.min(n,a))}function Yo(e){var t=bf(e),n=new Map,a=new Map;return{rng:t,states:n,headings:a,reset:function(){t.reset(),n.clear(),a.clear()},initialize:function(l,i){var u;return n.has(l)||n.set(l,{hp:i.hp,maxHp:i.maxHp,value:i.value,tag:(u=i.tag)!==null&&u!==void 0?u:"",team:i.team}),n.get(l)},remove:function(l){n.delete(l),a.delete(l)},snapshot:function(l){var i=n.get(l);return i?Fa({},i):void 0}}}function Go(e,t){var n,a,l,i,u=t===void 0?{}:t,s=u.width,E=u.height,f=u.onProgress,b=f===void 0?function(){}:f,k=u.onComplete,z=k===void 0?function(){}:k,re=u.canvasFactory,U=u.source,Y=e,oe=Y.gridSize,_=new Uint8Array(oe*oe),ee=0,h=!1,V=-1,Te=!1,Ce=Math.max(1,s),xe=Math.max(1,E),Le=Math.min(1,512/Math.max(Ce,xe)),Z=(n=re==null?void 0:re())!==null&&n!==void 0?n:!((a=globalThis.document)===null||a===void 0)&&a.createElement?globalThis.document.createElement("canvas"):void 0;Z&&(Z.width=Math.max(1,Math.round(Ce*Le)),Z.height=Math.max(1,Math.round(xe*Le)));var ue=(l=Z==null?void 0:Z.getContext)===null||l===void 0?void 0:l.call(Z,"2d"),ie=(i=Y.maskColor)!==null&&i!==void 0?i:"#dceeff",ye=function(){return!!(U&&U.complete&&U.naturalWidth>0)},R=function(){ue&&(ue.globalCompositeOperation="source-over",ue.clearRect(0,0,Z.width,Z.height),Y.mode==="erase"&&(ye()?(ue.drawImage(U,0,0,Z.width,Z.height),Te=!0):(ue.fillStyle=ie,ue.fillRect(0,0,Z.width,Z.height),Te=!1)))};R();var x=function(){if(!h){var D=Math.round(ee/_.length*100),fe=Math.min(100,D);fe!==V&&(V=fe,b(fe)),fe>=Y.targetPercent&&(h=!0,z(fe))}},$=function(D,fe){for(var J=Math.max(0,Math.min(oe-1,Math.floor(D/Ce*oe))),Q=Math.max(0,Math.min(oe-1,Math.floor(fe/xe*oe))),j=Math.max(0,Math.ceil(Y.brushRadiusPx/Ce*oe)),me=Math.max(0,Math.ceil(Y.brushRadiusPx/xe*oe)),le=Math.max(0,Q-me);le<=Math.min(oe-1,Q+me);le++)for(var Ie=Math.max(0,J-j);Ie<=Math.min(oe-1,J+j);Ie++)if(!(Math.hypot((Ie+.5)/oe*Ce-D,(le+.5)/oe*xe-fe)>Y.brushRadiusPx)){var X=le*oe+Ie;_[X]||(_[X]=1,ee++)}ue&&(ue.save(),ue.scale(Le,Le),ue.globalCompositeOperation=Y.mode==="erase"?"destination-out":"source-over",ue.fillStyle=ie,ue.beginPath(),ue.arc(D,fe,Y.brushRadiusPx,0,Math.PI*2),ue.fill(),Y.mode==="reveal"&&U&&(ue.globalCompositeOperation="source-in",ue.drawImage(U,0,0,Ce,xe)),ue.restore()),x()};return{canvas:Z,stampSegment:function(D,fe){for(var J=Math.hypot(fe.x-D.x,fe.y-D.y),Q=Math.max(1,Math.ceil(J/Math.max(1,Y.brushRadiusPx*.45))),j=0;j<=Q;j++)$(D.x+(fe.x-D.x)*j/Q,D.y+(fe.y-D.y)*j/Q)},reset:function(){_.fill(0),ee=0,h=!1,V=-1,R(),x()},get progress(){return Math.round(ee/_.length*100)},render:function(D){Y.mode==="erase"&&ee===0&&!Te&&ye()&&R(),Z?D.drawImage(Z,0,0,Z.width,Z.height,0,0,s,E):Y.mode==="erase"&&this.progress<100&&(D.save(),D.globalAlpha=1-this.progress/100,D.fillStyle=ie,D.fillRect(0,0,s,E),D.restore())}}}var Hn=function(){return Hn=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},Hn.apply(this,arguments)},wf=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Xa(e,t,n,a){var l=function(b,k,z){return(k.x-b.x)*(z.y-b.y)-(k.y-b.y)*(z.x-b.x)},i=l(e,t,n),u=l(e,t,a),s=l(n,a,e),E=l(n,a,t),f=1e-8;return Math.abs(i)<f&&Math.abs(u)<f&&Math.abs(s)<f&&Math.abs(E)<f?Math.max(Math.min(e.x,t.x),Math.min(n.x,a.x))<=Math.min(Math.max(e.x,t.x),Math.max(n.x,a.x))+f&&Math.max(Math.min(e.y,t.y),Math.min(n.y,a.y))<=Math.min(Math.max(e.y,t.y),Math.max(n.y,a.y))+f:i>0!=u>0&&s>0!=E>0}function Zo(e,t){for(var n=!1,a=0,l=t.length-1;a<t.length;l=a++){var i=t[a],u=t[l];i.y>e.y!=u.y>e.y&&e.x<(u.x-i.x)*(e.y-i.y)/(u.y-i.y)+i.x&&(n=!n)}return n}function $o(e,t,n){if(n.length>=3&&(Zo(e,n)||Zo(t,n)))return!0;for(var a=0;a<n.length;a++)if(Xa(e,t,n[a],n[(a+1)%n.length]))return!0;return!1}function Ko(e){var t=e,n=[],a=null,l=0,i=function(u){return Hn(Hn({},u),{points:u.points.map(function(s){return Hn({},s)})})};return{begin:function(u){var s={id:++l,points:[Hn({},u)],age:0,hitIds:new Set};return a=s,n.push(s),n.length>t.maxStrokes&&n.shift(),s},add:function(u){if(!a||a.points.length>=t.maxPoints)return!1;var s=a.points[a.points.length-1];return Math.hypot(u.x-s.x,u.y-s.y)<t.minSegmentPx?!1:(a.points.push(Hn({},u)),!0)},end:function(){var u=a;return a=null,u?i(u):void 0},cancel:function(){a&&(n=n.filter(function(u){return u!==a})),a=null},clear:function(){a=null,n=[]},tick:function(u){var s,E;try{for(var f=wf(n),b=f.next();!b.done;b=f.next()){var k=b.value;k.age+=u}}catch(z){s={error:z}}finally{try{b&&!b.done&&(E=f.return)&&E.call(f)}finally{if(s)throw s.error}}n=n.filter(function(z){return z===a||z.age<.18||t.mode!=="slice-blade"})},get active(){return a},get strokes(){return n}}}function Qo(e,t){for(var n=[],a=1;a<e.points.length;a++){var l=e.points[a-1],i=e.points[a],u=Math.hypot(i.x-l.x,i.y-l.y);u<.001||n.push({id:"stroke-".concat(e.id,"-").concat(a),strokeId:e.id,mode:"static",shape:"box",x:(l.x+i.x)/2,y:(l.y+i.y)/2,width:u,height:Math.max(2,t),angle:Math.atan2(i.y-l.y,i.x-l.x),restitution:.8})}return n}var wi=function(){return wi=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},wi.apply(this,arguments)},rl=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},Pn=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Mf=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},hn=function(e,t){return Math.hypot(e,t)},Jo=function(e,t,n){return Math.max(t,Math.min(n,e))},Fn=function(e){return Math.max(1,Math.min(e.width,e.height)/2)};function qo(e){var t,n,a=Math.cos((t=e.angle)!==null&&t!==void 0?t:0),l=Math.sin((n=e.angle)!==null&&n!==void 0?n:0),i=e.width/2,u=e.height/2;return[[-i,-u],[i,-u],[i,u],[-i,u]].map(function(s){var E=rl(s,2),f=E[0],b=E[1];return{x:e.x+f*a-b*l,y:e.y+f*l+b*a}})}function Sf(e,t){var n,a,l,i,u,s,E,f,b,k,z=qo(e),re=qo(t),U=[(E=e.angle)!==null&&E!==void 0?E:0,((f=e.angle)!==null&&f!==void 0?f:0)+Math.PI/2,(b=t.angle)!==null&&b!==void 0?b:0,((k=t.angle)!==null&&k!==void 0?k:0)+Math.PI/2],Y=1/0,oe=1,_=0;try{for(var ee=Pn(U),h=ee.next();!h.done;h=ee.next()){var V=h.value,Te=Math.cos(V),Ce=Math.sin(V),xe=1/0,Le=-1/0,Z=1/0,ue=-1/0;try{for(var ie=(l=void 0,Pn(z)),ye=ie.next();!ye.done;ye=ie.next()){var R=ye.value,x=R.x*Te+R.y*Ce;x<xe&&(xe=x),x>Le&&(Le=x)}}catch(J){l={error:J}}finally{try{ye&&!ye.done&&(i=ie.return)&&i.call(ie)}finally{if(l)throw l.error}}try{for(var $=(u=void 0,Pn(re)),D=$.next();!D.done;D=$.next()){var R=D.value,x=R.x*Te+R.y*Ce;x<Z&&(Z=x),x>ue&&(ue=x)}}catch(J){u={error:J}}finally{try{D&&!D.done&&(s=$.return)&&s.call($)}finally{if(u)throw u.error}}var fe=Math.min(Le,ue)-Math.max(xe,Z);if(fe<=0)return null;fe<Y&&(Y=fe,oe=Te,_=Ce)}}catch(J){n={error:J}}finally{try{h&&!h.done&&(a=ee.return)&&a.call(ee)}finally{if(n)throw n.error}}return(e.x-t.x)*oe+(e.y-t.y)*_<0&&(oe=-oe,_=-_),{nx:oe,ny:_,penetration:Y}}function jo(e,t){var n,a,l,i=Fn(e),u=-((n=t.angle)!==null&&n!==void 0?n:0),s=Math.cos(u),E=Math.sin(u),f=e.x-t.x,b=e.y-t.y,k=f*s-b*E,z=f*E+b*s,re=t.width/2,U=t.height/2,Y=Jo(k,-re,re),oe=Jo(z,-U,U),_=k-Y,ee=z-oe,h=hn(_,ee),V;if(h>=i)return null;if(h<1e-4){var Te=[{d:re-Math.abs(k),x:k>=0?1:-1,y:0},{d:U-Math.abs(z),x:0,y:z>=0?1:-1}].sort(function(Le,Z){return Le.d-Z.d});_=Te[0].x,ee=Te[0].y,V=i+Te[0].d}else _/=h,ee/=h,V=i-h;var Ce=Math.cos((a=t.angle)!==null&&a!==void 0?a:0),xe=Math.sin((l=t.angle)!==null&&l!==void 0?l:0);return{nx:_*Ce-ee*xe,ny:_*xe+ee*Ce,penetration:V}}function _o(e,t){var n;return!!(e.ignoreGroup&&e.ignoreGroup!=="none"&&(e.ignoreGroup==="all"||e.ignoreGroup===((n=t.collisionGroup)!==null&&n!==void 0?n:"all")))}function el(e,t,n){var a,l,i,u,s,E;if(!(e.captured||t.captured||_o(e,t)||_o(t,e))){var f=e.x-t.x,b=e.y-t.y,k;if(e.shape==="circle"&&t.shape==="circle"){var z=hn(f,b),re=Fn(e)+Fn(t)-z;if(re<=0)return;k=re,z>1e-4?(f/=z,b/=z):(f=1,b=0)}else if(e.shape==="circle"&&t.shape==="box"){var U=jo(e,t);if(!U)return;f=U.nx,b=U.ny,k=U.penetration}else if(e.shape==="box"&&t.shape==="circle"){var U=jo(t,e);if(!U)return;f=-U.nx,b=-U.ny,k=U.penetration}else if(e.shape==="box"&&t.shape==="box"){var U=Sf(e,t);if(!U)return;f=U.nx,b=U.ny,k=U.penetration}else return;var Y=e.mode==="dynamic"?1/((a=e.mass)!==null&&a!==void 0?a:1):0,oe=t.mode==="dynamic"?1/((l=t.mass)!==null&&l!==void 0?l:1):0,_=Y+oe;if(_){e.x+=f*k*Y/_,e.y+=b*k*Y/_,t.mode==="dynamic"&&(t.x-=f*k*oe/_,t.y-=b*k*oe/_);var ee=e.vx-((i=t.vx)!==null&&i!==void 0?i:0),h=e.vy-((u=t.vy)!==null&&u!==void 0?u:0),V=ee*f+h*b;if(!(V>=0)){var Te=Math.max((s=e.restitution)!==null&&s!==void 0?s:0,(E=t.restitution)!==null&&E!==void 0?E:0),Ce=-(1+Te)*V/_;e.vx+=f*Ce*Y,e.vy+=b*Ce*Y,t.mode==="dynamic"&&(t.vx-=f*Ce*oe,t.vy-=b*Ce*oe),e.atRest=!1,e.restElapsed=0,t.mode==="dynamic"&&(t.atRest=!1,t.restElapsed=0),Math.abs(V)>4&&(n("bodyBounce",e,t,{speed:Math.abs(V)}),t.mode==="dynamic"&&n("bodyBounce",t,e,{speed:Math.abs(V)}))}}}}function kf(e,t,n,a){var l,i;if(!(e.mode!=="dynamic"||e.captured))try{for(var u=Pn(t),s=u.next();!s.done;s=u.next()){var E=s.value,f=E.x-e.x,b=E.y-e.y,k=hn(f,b);if(!(k>=E.radius*2.5)){if(k>E.radius&&k>.001&&E.pullStrength>0){var z=E.pullStrength*(1-k/(E.radius*2.5));e.vx+=f/k*z*n,e.vy+=b/k*z*n}if(k<E.radius&&hn(e.vx,e.vy)<=E.maxCaptureSpeed){e.captured=!0,e.atRest=!0,e.vx=E.stopBody?0:e.vx,e.vy=E.stopBody?0:e.vy,E.stopBody&&(e.x=E.x,e.y=E.y),a("zoneCapture",e,E,{});return}}}}catch(re){l={error:re}}finally{try{s&&!s.done&&(i=u.return)&&i.call(u)}finally{if(l)throw l.error}}}function Cf(e,t){var n,a,l,i,u,s,E=function(z){if(z.broken)return"continue";var re=t.find(function(xe){return xe.id===z.bodyId}),U=t.find(function(xe){return xe.id===z.anchorId});if(!re||re.mode!=="dynamic")return"continue";var Y=(i=(l=U==null?void 0:U.x)!==null&&l!==void 0?l:z.x)!==null&&i!==void 0?i:0,oe=(s=(u=U==null?void 0:U.y)!==null&&u!==void 0?u:z.y)!==null&&s!==void 0?s:0,_=re.x-Y,ee=re.y-oe,h=hn(_,ee);if(h<=z.lengthPx||h<1e-4)return"continue";var V=_/h,Te=ee/h;re.x=Y+V*z.lengthPx,re.y=oe+Te*z.lengthPx;var Ce=re.vx*V+re.vy*Te;Ce>0&&(re.vx-=V*Ce,re.vy-=Te*Ce)};try{for(var f=Pn(e),b=f.next();!b.done;b=f.next()){var k=b.value;E(k)}}catch(z){n={error:z}}finally{try{b&&!b.done&&(a=f.return)&&a.call(f)}finally{if(n)throw n.error}}}function Ua(e){for(var t,n,a,l,i,u,s,E,f,b,k,z=e.bodies,re=e.zones,U=re===void 0?[]:re,Y=e.joints,oe=Y===void 0?[]:Y,_=e.bounds,ee=e.dt,h=e.onEvent,V=h===void 0?function(){}:h,Te=z.filter(function(ce){return ce.mode==="dynamic"&&!ce.captured}),Ce=Te.reduce(function(ce,Se){return Math.max(ce,hn(Se.vx,Se.vy))},0),xe=Te.reduce(function(ce,Se){return Math.min(ce,Fn(Se))},24),Le=Math.min(16,Math.max(1,Math.ceil(Ce*ee/(xe*.45)))),Z=ee/Le,ue=0;ue<Le;ue++){try{for(var ie=(t=void 0,Pn(Te)),ye=ie.next();!ye.done;ye=ie.next()){var R=ye.value;R.vy+=((s=R.gravity)!==null&&s!==void 0?s:0)*Z;var x=hn(R.vx,R.vy);if(x>R.maxSpeed){var $=R.maxSpeed/x;R.vx*=$,R.vy*=$,x=R.maxSpeed}R.x+=R.vx*Z,R.y+=R.vy*Z;var D=Math.max(0,x-((E=R.friction)!==null&&E!==void 0?E:0)*Z),fe=Math.exp(-((f=R.linearDamping)!==null&&f!==void 0?f:0)*Z);if(x>1e-4){var J=D/x*fe;R.vx*=J,R.vy*=J}R.spinToRotation&&(R.angle=((b=R.angle)!==null&&b!==void 0?b:0)+hn(R.vx,R.vy)*Z/Fn(R)*(R.vx<0?-1:1))}}catch(ce){t={error:ce}}finally{try{ye&&!ye.done&&(n=ie.return)&&n.call(ie)}finally{if(t)throw t.error}}for(var Q=0;Q<Te.length;Q++){var R=Te[Q];try{for(var j=(a=void 0,Pn(z)),me=j.next();!me.done;me=j.next()){var le=me.value;le.id!==R.id&&le.mode!=="dynamic"&&el(R,le,V)}}catch(Se){a={error:Se}}finally{try{me&&!me.done&&(l=j.return)&&l.call(j)}finally{if(a)throw a.error}}for(var le=Q+1;le<Te.length;le++)el(Te[le],R,V);var Ie=R.shape==="box"?R.width/2:Fn(R),X=R.shape==="box"?R.height/2:Fn(R);R.wallBounce?(R.x-Ie<_.left&&(R.x=_.left+Ie,R.vx<0&&(V("bodyBounce",R,null,{speed:Math.abs(R.vx)}),R.vx=-R.vx*R.restitution)),R.x+Ie>_.right&&(R.x=_.right-Ie,R.vx>0&&(V("bodyBounce",R,null,{speed:Math.abs(R.vx)}),R.vx=-R.vx*R.restitution)),R.y-X<_.top&&(R.y=_.top+X,R.vy<0&&(V("bodyBounce",R,null,{speed:Math.abs(R.vy)}),R.vy=-R.vy*R.restitution)),R.y+X>_.bottom&&(R.y=_.bottom-X,R.vy>0&&(V("bodyBounce",R,null,{speed:Math.abs(R.vy)}),R.vy=-R.vy*R.restitution))):!R.exited&&(R.x+Ie<_.left||R.x-Ie>_.right||R.y+X<_.top||R.y-X>_.bottom)&&(R.exited=!0,V("boundaryExit",R,null,{})),kf(R,U,Z,V)}Cf(oe,z)}try{for(var ve=Pn(Te),Ve=ve.next();!Ve.done;Ve=ve.next()){var R=Ve.value,x=hn(R.vx,R.vy);x<R.restSpeed&&!R.captured?(R.restElapsed=((k=R.restElapsed)!==null&&k!==void 0?k:0)+ee,R.restElapsed>=R.restDelaySeconds&&!R.atRest&&(R.atRest=!0,R.vx=0,R.vy=0,V("bodyRest",R,null,{}))):x>=R.restSpeed&&(R.restElapsed=0,R.atRest=!1)}}catch(ce){i={error:ce}}finally{try{Ve&&!Ve.done&&(u=ve.return)&&u.call(ve)}finally{if(i)throw i.error}}}function tl(e){for(var t=e.body,n=e.bodies,a=e.zones,l=a===void 0?[]:a,i=e.bounds,u=e.dots,s=u===void 0?8:u,E=e.bounces,f=E===void 0?1:E,b=function(h){return wi({},h)},k=b(t),z=n.filter(function(h){return h.id!==t.id}).map(b),re=Mf([k],rl(z),!1),U=[],Y=0,oe=!1,_=function(h,V,Te,Ce){h==="bodyBounce"&&Ce.sourceId===t.id&&Y++,h==="zoneCapture"&&Ce.sourceId===t.id&&(oe=!0)},ee=0;ee<90&&U.length<s&&!oe&&Y<=f;ee++)Ua({bodies:re,zones:l,bounds:i,dt:1/60,onEvent:function(h,V,Te,Ce){return _(h,V,Te,wi(wi({},Ce),{sourceId:V.id}))}}),ee%Math.max(1,Math.floor(90/s))===0&&U.push({x:k.x,y:k.y});return U}var yn=function(){return yn=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},yn.apply(this,arguments)},Vt=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},Nt=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},Mi=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},nl=function(e,t,n){return Math.max(t,Math.min(n,e))},Tn=function(e,t){return Math.hypot(t.x-e.x,t.y-e.y)};function il(e){var t=e.id,n=e.nodes,a=e.edges,l=e.gates,i=l===void 0?[]:l,u=e.onEvent,s=u===void 0?function(){}:u,E=new Map(n.map(function(x){return[x.id,yn({},x)]})),f=new Map(a.map(function(x){return[x.id,yn({speedScale:1,enabled:!0,bidirectional:!1,cost:0},x)]})),b=new Map(i.map(function(x){return[x.id,yn({},x)]})),k=new Map,z=k,re=0,U=0,Y=function(x){return E.get(x)},oe=function(x){return Nt([],Vt(b.values()),!1).find(function($){return $.parameters.nodeId===x})},_=function(x){var $=x.parameters;if($.mode==="open")return!0;if($.mode==="closed")return!1;var D=$.openSeconds+$.closedSeconds,fe=(re+$.phaseOffsetSeconds)%D;return fe<$.openSeconds},ee=function(x){return Nt([],Vt(f.values()),!1).filter(function($){return $.enabled&&($.from===x||$.bidirectional&&$.to===x)}).sort(function($,D){return $.id<D.id?-1:$.id>D.id?1:0})},h=function(x,$){return Nt([],Vt(f.values()),!1).find(function(D){return D.enabled&&(D.from===x&&D.to===$||D.bidirectional&&D.from===$&&D.to===x)})};function V(x,$){var D,fe,J,Q;if(x===$)return[x];for(var j=new Map([[x,0]]),me=new Map,le=new Set([x]);le.size;){var Ie=Nt([],Vt(le),!1).sort(function(Vr,Tr){return j.get(Vr)-j.get(Tr)||(Vr<Tr?-1:Vr>Tr?1:0)})[0];if(le.delete(Ie),Ie===$)break;try{for(var X=(D=void 0,Mi(ee(Ie))),ve=X.next();!ve.done;ve=X.next()){var Ve=ve.value,ce=Ve.from===Ie?Ve.to:Ve.from,Se=oe(ce),$e=Y(ce),Xe=Se?Se.parameters.holdSeconds*90+(_(Se)?0:Se.parameters.closedSeconds*90):0,fr=j.get(Ie)+Tn(Y(Ie),$e)/Ve.speedScale+Ve.cost+((J=$e.cost)!==null&&J!==void 0?J:0)+Xe;fr>=((Q=j.get(ce))!==null&&Q!==void 0?Q:1/0)||(j.set(ce,fr),me.set(ce,Ie),le.add(ce))}}catch(Vr){D={error:Vr}}finally{try{ve&&!ve.done&&(fe=X.return)&&fe.call(X)}finally{if(D)throw D.error}}}if(!j.has($))return[];for(var Pr=[$],Or=$;Or!==x;)Or=me.get(Or),Pr.unshift(Or);return Pr}function Te(x){var $,D=x.route.length>=2&&x.segment<x.route.length-1;if(!D){var fe=($=x.route[Math.min(x.segment,x.route.length-1)])!==null&&$!==void 0?$:x.startNode,J=V(fe,x.target);x.route=J.length?J:[fe],x.segment=0,x.distance=0,x.arrived=!1,x.active=x.route.length>=2;return}var Q=x.route[x.segment],j=x.route[x.segment+1],me=Tn(Y(Q),Y(j));if(x.arrived||x.distance>=me-1e-4){var J=V(j,x.target);x.route=J.length?J:[j],x.segment=0,x.distance=0,x.arrived=!1,x.active=x.route.length>=2;return}var le=V(j,x.target);x.route=le.length?Nt([Q],Vt(le),!1):[Q,j],x.segment=0}function Ce(x){var $,D=V(x.startNode,x.targetNode),fe=Y(x.startNode),J=D.length>=2?Y(D[1]):fe,Q=D.length>=2?Math.atan2(J.y-fe.y,J.x-fe.x):0,j=Math.floor((Q%(Math.PI*2)+Math.PI*2+1e-6)%(Math.PI*2)/(Math.PI/2))%4,me=yn(yn({},x),{loop:($=x.loop)!==null&&$!==void 0?$:"none",originNode:x.startNode,destinationNode:x.targetNode,target:x.targetNode,networkId:t,route:D.length?D:[x.startNode],segment:0,distance:0,x:fe.x,y:fe.y,heading:Q,frame:[0,1,2,3][j],flipX:Math.cos(Q)<0,hold:0,arrived:!1,active:x.active&&D.length>=2,blockedTicks:0,blockedEmitted:!1,speedMultiplier:1});return k.set(me.id,me),me}function xe(x){if(Le("pathArrive",x,x.target),x.loop==="none"){x.active=!1;return}var $=x.target,D=x.loop==="ping-pong"?$===x.destinationNode?x.originNode:x.destinationNode:$===x.originNode?x.destinationNode:x.originNode;x.startNode=$,x.target=D,x.route=V($,D),x.segment=0,x.distance=0,x.arrived=!1,x.route.length<2&&(x.active=!1)}function Le(x,$,D){s(x,{componentId:$.id,nodeId:D})}function Z(x,$){var D,fe,J=x.route[x.segment+1],Q=oe(J);if(Q&&!_(Q)){x.blockedTicks++,x.blockedTicks>=30&&!x.blockedEmitted&&(x.blockedEmitted=!0,Le("pathBlocked",x,J));return}if(!x.arrived){if(x.arrived=!0,x.segment+1===x.route.length-1){J===x.target?xe(x):(x.active=!1,x.blockedEmitted||(x.blockedEmitted=!0,Le("pathBlocked",x,J)));return}x.hold=Math.max((D=Y(J).holdSeconds)!==null&&D!==void 0?D:0,(fe=Q==null?void 0:Q.parameters.holdSeconds)!==null&&fe!==void 0?fe:0)}if(x.hold>0){x.hold=Math.max(0,x.hold-$),x.blockedTicks++,x.blockedTicks>=30&&!x.blockedEmitted&&(x.blockedEmitted=!0,Le("pathBlocked",x,J));return}x.segment++,x.distance=0,x.arrived=!1,x.blockedTicks=0,x.blockedEmitted=!1}function ue(x,$){var D,fe;if(x.spacing<=0)return $;var J=x.route[x.segment],Q=x.route[x.segment+1],j=Tn(Y(J),Y(Q)),me=j-x.distance,le=$;try{for(var Ie=Mi(z.values()),X=Ie.next();!X.done;X=Ie.next()){var ve=X.value;if(!(ve.id===x.id||!ve.active||ve.route.length<2||ve.segment>=ve.route.length-1)){var Ve=ve.route[ve.segment],ce=ve.route[ve.segment+1],Se=1/0;if(Ve===J&&ce===Q&&(ve.distance>x.distance||ve.distance===x.distance&&ve.id<x.id))Se=ve.distance-x.distance;else if(Ve===Q)Se=me+ve.distance;else if(ce===Q&&Ve!==J){var $e=Tn(Y(Ve),Y(ce))-ve.distance;$e<x.spacing&&($e<me||$e===me&&ve.id<x.id)&&(Se=me)}Se<1/0&&(le=Math.min(le,Math.max(0,Se-x.spacing)))}}}catch(Xe){D={error:Xe}}finally{try{X&&!X.done&&(fe=Ie.return)&&fe.call(Ie)}finally{if(D)throw D.error}}return le}function ie(x){var $=Y(x.route[x.segment]),D=Y(x.route[x.segment+1]),fe=Tn($,D),J=nl(x.distance/Math.max(1e-4,fe),0,1),Q=$.x+(D.x-$.x)*J,j=$.y+(D.y-$.y)*J,me=Math.atan2(D.y-$.y,D.x-$.x),le=Math.min(x.cornerRadius,fe/3),Ie=x.route[x.segment+2];if(le>0&&Ie){var X=Y(Ie),ve=Tn(D,X),Ve=Math.min(le,ve/3);if(x.distance>fe-le){var ce={x:D.x-(D.x-$.x)/fe*le,y:D.y-(D.y-$.y)/fe*le},Se={x:D.x+(X.x-D.x)/ve*Ve,y:D.y+(X.y-D.y)/ve*Ve},$e=nl((x.distance-(fe-le))/(le*2),0,.5),Xe=1-$e;Q=Xe*Xe*ce.x+2*Xe*$e*D.x+$e*$e*Se.x,j=Xe*Xe*ce.y+2*Xe*$e*D.y+$e*$e*Se.y;var fr=2*Xe*(D.x-ce.x)+2*$e*(Se.x-D.x),Pr=2*Xe*(D.y-ce.y)+2*$e*(Se.y-D.y);Math.abs(fr)+Math.abs(Pr)>.001&&(me=Math.atan2(Pr,fr))}}return{x:Q,y:j,heading:me}}function ye(x){var $,D,fe,J;re+=x,U++;var Q=Nt([],Vt(k.values()),!1).sort(function(Ke,bt){return Ke.id<bt.id?-1:Ke.id>bt.id?1:0}),j=Q.length?U%Q.length:0,me=Nt(Nt([],Vt(Q.slice(j)),!1),Vt(Q.slice(0,j)),!1);try{for(var le=Mi(me),Ie=le.next();!Ie.done;Ie=le.next()){var X=Ie.value;if(!(!X.active||X.route.length<2||X.segment>=X.route.length-1)){var ve=X.route[X.segment],Ve=X.route[X.segment+1],ce=Tn(Y(ve),Y(Ve));if(!(X.distance>=ce-1e-4&&(Z(X,x),!X.active||X.route.length<2||X.segment>=X.route.length-1))){var Se=X.route[X.segment],$e=X.route[X.segment+1],Xe=Tn(Y(Se),Y($e)),fr=Xe-X.distance,Pr=(J=(fe=h(Se,$e))===null||fe===void 0?void 0:fe.speedScale)!==null&&J!==void 0?J:1,Or=Math.min(fr,X.speed*Pr*Math.max(0,X.speedMultiplier)*x),Vr=ue(X,Or);Vr<=1e-4?(X.blockedTicks++,X.blockedTicks>=30&&!X.blockedEmitted&&(X.blockedEmitted=!0,Le("pathBlocked",X,$e))):(X.distance+=Vr,X.blockedTicks=0,X.blockedEmitted=!1);var Tr=ie(X);X.x=Tr.x,X.y=Tr.y,X.heading=Tr.heading;var pn=Math.floor((X.heading%(Math.PI*2)+Math.PI*2+1e-6)%(Math.PI*2)/(Math.PI/2))%4;X.frame=[0,1,2,3][pn],X.flipX=Math.cos(X.heading)<0}}}}catch(Ke){$={error:Ke}}finally{try{Ie&&!Ie.done&&(D=le.return)&&D.call(le)}finally{if($)throw $.error}}}function R(){return{id:t,nodeCount:E.size,edgeCount:f.size,activeAgents:Nt([],Vt(k.values()),!1).filter(function(x){return x.active}).length,queuedAgents:Nt([],Vt(k.values()),!1).filter(function(x){return x.active&&x.blockedTicks>0}).length,agents:Nt([],Vt(k.values()),!1).map(function(x){var $;return{id:x.id,x:x.x,y:x.y,heading:x.heading,frame:($=x.frame)!==null&&$!==void 0?$:0,flipX:!!x.flipX,active:x.active,targetNode:x.target,route:Nt([],Vt(x.route),!1),segment:x.segment,distance:x.distance,blocked:x.blockedTicks>0}})}}return{addAgent:Ce,removeAgent:function(x){return k.delete(x)},getAgent:function(x){return k.get(x)},setTarget:function(x,$){var D=k.get(x);return!D||!Y($)?!1:(D.target=$,D.destinationNode=$,D.active=!0,Te(D),!0)},setEdge:function(x,$,D){var fe,J,Q=f.get(x);if(!Q)return!1;Q.enabled=$,D!==void 0&&(Q.cost=D);try{for(var j=Mi(k.values()),me=j.next();!me.done;me=j.next()){var le=me.value;Te(le)}}catch(Ie){fe={error:Ie}}finally{try{me&&!me.done&&(J=j.return)&&J.call(j)}finally{if(fe)throw fe.error}}return!0},setGate:function(x,$,D){var fe,J,Q=b.get(x);if(!Q)return!1;Q.parameters=yn(yn({},Q.parameters),{mode:$,holdSeconds:D});try{for(var j=Mi(k.values()),me=j.next();!me.done;me=j.next()){var le=me.value;Te(le)}}catch(Ie){fe={error:Ie}}finally{try{me&&!me.done&&(J=j.return)&&J.call(j)}finally{if(fe)throw fe.error}}return!0},tick:ye,snapshot:R}}var Si=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ra=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},ta=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},na={A:["01110","10001","10001","11111","10001","10001","10001"],B:["11110","10001","10001","11110","10001","10001","11110"],C:["01111","10000","10000","10000","10000","10000","01111"],D:["11110","10001","10001","10001","10001","10001","11110"],E:["11111","10000","10000","11110","10000","10000","11111"],F:["11111","10000","10000","11110","10000","10000","10000"],G:["01111","10000","10000","10111","10001","10001","01111"],H:["10001","10001","10001","11111","10001","10001","10001"],I:["11111","00100","00100","00100","00100","00100","11111"],J:["00111","00010","00010","00010","10010","10010","01100"],K:["10001","10010","10100","11000","10100","10010","10001"],L:["10000","10000","10000","10000","10000","10000","11111"],M:["10001","11011","10101","10101","10001","10001","10001"],N:["10001","11001","10101","10011","10001","10001","10001"],O:["01110","10001","10001","10001","10001","10001","01110"],P:["11110","10001","10001","11110","10000","10000","10000"],Q:["01110","10001","10001","10001","10101","10010","01101"],R:["11110","10001","10001","11110","10100","10010","10001"],S:["01111","10000","10000","01110","00001","00001","11110"],T:["11111","00100","00100","00100","00100","00100","00100"],U:["10001","10001","10001","10001","10001","10001","01110"],V:["10001","10001","10001","10001","10001","01010","00100"],W:["10001","10001","10001","10101","10101","10101","01010"],X:["10001","10001","01010","00100","01010","10001","10001"],Y:["10001","10001","01010","00100","00100","00100","00100"],Z:["11111","00001","00010","00100","01000","10000","11111"],0:["01110","10001","10011","10101","11001","10001","01110"],1:["00100","01100","00100","00100","00100","00100","01110"],2:["01110","10001","00001","00010","00100","01000","11111"],3:["11110","00001","00001","01110","00001","00001","11110"],4:["00010","00110","01010","10010","11111","00010","00010"],5:["11111","10000","10000","11110","00001","00001","11110"],6:["01110","10000","10000","11110","10001","10001","01110"],7:["11111","00001","00010","00100","01000","01000","01000"],8:["01110","10001","10001","01110","10001","10001","01110"],9:["01110","10001","10001","01111","00001","00001","01110"],"!":["00100","00100","00100","00100","00100","00000","00100"],"?":["01110","10001","00001","00010","00100","00000","00100"],".":["00000","00000","00000","00000","00000","00110","00110"],",":["00000","00000","00000","00000","00110","00110","00100"],":":["00000","00110","00110","00000","00110","00110","00000"],"+":["00000","00100","00100","11111","00100","00100","00000"],"-":["00000","00000","00000","11111","00000","00000","00000"],"/":["00001","00010","00010","00100","01000","01000","10000"],"'":["00100","00100","00000","00000","00000","00000","00000"]," ":["000","000","000","000","000","000","000"]},ki=function(e){var t,n,a,l,i=0;try{for(var u=Si(e),s=u.next();!s.done;s=u.next()){var E=s.value;i+=((l=(a=na[E])===null||a===void 0?void 0:a[0].length)!==null&&l!==void 0?l:5)+1}}catch(f){t={error:f}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}return Math.max(0,i-1)},Ef=function(e,t){var n,a,l=[],i="";try{for(var u=Si(e),s=u.next();!s.done;s=u.next()){var E=s.value;i&&ki(i+E)>t&&(l.push(i),i=""),i+=E}}catch(f){n={error:f}}finally{try{s&&!s.done&&(a=u.return)&&a.call(u)}finally{if(n)throw n.error}}return i&&l.push(i),l};function Pf(e,t,n){var a,l,i,u,s;n===void 0&&(n=1);var E=Math.max(1,Math.floor(t/Math.max(1,n))),f=[];try{for(var b=Si(String(e).toUpperCase().split(`
|
|
2
|
-
`)),
|
|
3
|
-
`):
|
|
4
|
-
`&&!na[U]}))),!1),f,b=u;b>=s;b--){var k=Tf(e,t,b,l),z=k.renderedWidth>l,re=k.allLines.length>16||k.renderedHeight>i;if(f={lines:k.lines,scale:b,fontSize:b*8,renderedWidth:k.renderedWidth,renderedHeight:k.renderedHeight,overflowsWidth:z,overflowsHeight:re,unsupportedChars:E},t.autoFit===!1||!z&&!re)break}return f}function ol(e,t,n){var a,l=Ya(t,n),i=l.lines,u=l.scale,s=al(n),E=Math.max(0,n.width-2*s.x),f=Math.max(0,n.height-2*s.y),b=Math.round(l.fontSize*((a=n.lineHeight)!==null&&a!==void 0?a:1.2)),k=s.y+(f-l.renderedHeight)/2;return e.fillStyle=n.color,i.forEach(function(z,re){var U,Y,oe,_=ki(z)*u,ee=n.align==="left"?s.x:n.align==="right"?n.width-_-s.x:s.x+(E-_)/2,h=ee;try{for(var V=Si(z),Te=V.next();!Te.done;Te=V.next()){var Ce=Te.value,xe=(oe=na[Ce])!==null&&oe!==void 0?oe:na["?"];xe.forEach(function(Le,Z){for(var ue=0;ue<Le.length;ue++)Le[ue]==="1"&&e.fillRect(Math.round(h+ue*u),Math.round(k+re*b+Z*u),u,u)}),h+=(xe[0].length+1)*u}}catch(Le){U={error:Le}}finally{try{Te&&!Te.done&&(Y=V.return)&&Y.call(V)}finally{if(U)throw U.error}}}),l}var an=function(){return an=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},an.apply(this,arguments)},Za=Math.PI*2,kr=function(e,t){return((Math.imul(e+1,2654435769)^Math.imul(t,2246822507))>>>0)/4294967296};function $a(e,t,n){var a,l,i=[e.color,e.color2,e.color3].filter(Boolean),u=((a=e.spread)!==null&&a!==void 0?a:360)*Math.PI/180,s=((l=e.direction)!==null&&l!==void 0?l:-90)*Math.PI/180;return Array.from({length:e.count},function(E,f){var b,k,z=s+((f+.2+kr(f,1)*.6)/e.count-.5)*u,re=e.speed*(.42+.65*kr(f,2));return an(an({},t),{clipId:n,shape:"pixel-confetti",age:-.12*kr(f,3),vx:Math.cos(z)*re,vy:Math.sin(z)*re,gravity:(b=e.gravity)!==null&&b!==void 0?b:250,life:((k=e.lifetime)!==null&&k!==void 0?k:.7)*(.6+.4*kr(f,4)),color:i[f%i.length],size:3+Math.floor(3*kr(f,5)),angle:Za*kr(f,6),spin:(kr(f,7)-.5)*12})})}function ll(e){var t=Math.min(12,Math.ceil(Math.sqrt(e.count))),n=Math.ceil(e.count/t),a=e.speed;return $a(e).map(function(l,i){return an(an({},l),{screen:!0,x:(i%t+.15+.7*kr(i,8))/t,y:(Math.floor(i/t)+.15+.7*kr(i,9))/n,vx:a*(kr(i,10)-.5)*.7,vy:a*(.3+.5*kr(i,11)),size:l.size+1})})}var aa=function(e,t){return(e%t+t)%t};function fl(e,t,n){var a=t.x,l=t.y,i=t.vx,u=t.vy,s=t.age,E=t.life,f=t.gravity,b=t.size,k=t.angle,z=t.spin,re=t.color;if(!(s<0)){var U=i*s,Y=u*s+f*s*s/2,oe=Math.round(n?n.x+aa(a*n.width+U,n.width):a+U),_=Math.round(n?n.y+aa(l*n.height+Y,n.height):l+Y),ee=Math.round((k+z*s)/(Math.PI/4))&3;if(e.globalAlpha*=Math.min(1,(E-s)*4),e.fillStyle="#3c293388",ee===0)e.fillRect(oe-b+1,_+1,b*2+1,b+1);else if(ee===2)e.fillRect(oe+1,_-b+1,b+1,b*2+1);else for(var h=-1;h<=1;h++)e.fillRect(oe+h*b+1,_+h*b*(ee===1?1:-1)+1,b+1,b+1);if(e.fillStyle=re,ee===0)e.fillRect(oe-b,_,b*2,b);else if(ee===2)e.fillRect(oe,_-b,b,b*2);else for(var h=-1;h<=1;h++)e.fillRect(oe+h*b,_+h*b*(ee===1?1:-1),b,b)}}function Ka(e,t,n){var a,l,i=[e.color,e.color2,e.color3,"#ff6b6b","#4ecdc4","#fff3b0"].filter(Boolean),u=((a=e.spread)!==null&&a!==void 0?a:360)*Math.PI/180,s=((l=e.direction)!==null&&l!==void 0?l:-90)*Math.PI/180;return Array.from({length:e.count},function(E,f){var b,k,z=s+((f+.2+kr(f,11)*.6)/e.count-.5)*u,re=e.speed*(.45+.65*kr(f,12));return an(an({},t),{clipId:n,shape:"confetti",age:-.15*kr(f,13),vx:Math.cos(z)*re,vy:Math.sin(z)*re,gravity:(b=e.gravity)!==null&&b!==void 0?b:140,life:((k=e.lifetime)!==null&&k!==void 0?k:2.6)*(.75+.35*kr(f,14)),color:i[f%i.length],size:5+Math.floor(5*kr(f,15)),kind:f%5===0?"star":"ribbon",angle:Za*kr(f,16),spin:(kr(f,17)-.5)*5.5,flutter:1.6+2.2*kr(f,18),phase:Za*kr(f,19)})})}function dl(e){var t=Math.min(14,Math.ceil(Math.sqrt(e.count))),n=Math.ceil(e.count/t),a=e.speed;return Ka(e,{x:0,y:0}).map(function(l,i){var u;return an(an({},l),{screen:!0,x:(i%t+.12+.76*kr(i,20))/t,y:(Math.floor(i/t)+.08+.84*kr(i,21))/n,vx:a*(kr(i,22)-.5)*.65,vy:a*(.38+.55*kr(i,23)),gravity:Math.min((u=e.gravity)!==null&&u!==void 0?u:90,90)})})}function ul(e,t,n){var a=t.x,l=t.y,i=t.vx,u=t.vy,s=t.age,E=t.life,f=t.gravity,b=t.size,k=t.angle,z=t.spin,re=t.flutter,U=t.phase,Y=t.color,oe=t.kind;if(!(s<0)){var _=Math.sin(s*re+U)*14,ee=i*s+_,h=u*s+f*s*s/2,V=n?n.x+aa(a*n.width+ee,n.width):a+ee,Te=n?n.y+aa(l*n.height+h,n.height):l+h,Ce=Math.min(1,s*2.8,(E-s)*2.2);if(!(Ce<=0)){e.save(),e.globalAlpha*=Ce,e.translate(V,Te),e.rotate(k+z*s);var xe=Math.cos(s*re*1.4+U);if(e.scale(1,Math.max(.22,Math.abs(xe))),e.fillStyle=Y,oe==="star"){var Le=b*.85;e.beginPath();for(var Z=0;Z<8;Z++){var ue=Z%2===0?Le:Le*.38,ie=Z*Math.PI/4;Z===0?e.moveTo(Math.cos(ie)*ue,Math.sin(ie)*ue):e.lineTo(Math.cos(ie)*ue,Math.sin(ie)*ue)}e.closePath(),e.fill()}else e.fillRect(-b*.7,-b*.34,b*1.4,b*.68),e.fillStyle="#ffffff55",e.fillRect(-b*.7,-b*.34,b*1.4,b*.2);e.restore()}}}function vl(e,t,n,a,l){var i=t.width,u=t.height;if(!(i<=0||u<=0)){var s=Math.min(3,Math.floor(Math.min(i,u)/8));if(!s){e.fillStyle=n,e.fillRect(0,0,i,u);return}var E=a?s*2:0,f=u-(a?s:s*3),b=l>=0?.5+.5*Math.sin(l*4):0;t.enabled&&!a&&l>=0&&(e.save(),e.shadowColor="#ffd05a99",e.shadowBlur=8+b*9,e.fillStyle=n,e.fillRect(s,E+s,i-2*s,u-E-2*s),e.restore()),e.fillStyle=t.stroke,e.fillRect(s,0,i-2*s,u),e.fillRect(0,s,i,u-2*s),e.fillStyle=n,e.fillRect(s,E+s,i-2*s,u-E-2*s),e.fillStyle="#431d1380",e.fillRect(s,f,i-2*s,u-s-f),e.fillStyle=t.enabled?"#fff4be":"#ffffff55",e.fillRect(2*s,E+s,i-4*s,a?s:s*2),e.fillStyle="#ffffff55",e.fillRect(s,E+3*s,s,Math.max(0,f-E-3*s)),e.fillStyle="#521b2444",e.fillRect(i-2*s,E+3*s,s,Math.max(0,f-E-3*s));var k=l>=0?l%1.9:-1,z=(k-.1)/.55;if(t.enabled&&!a&&z>=0&&z<1){e.save(),e.beginPath(),e.rect(2*s,E+3*s,i-4*s,Math.max(0,f-E-3*s)),e.clip();for(var re=Math.floor(((i+14*s)*z-6*s)/s)*s,U=E+3*s,Y=0;U<f;U+=s,Y++){var oe=re-Math.floor(Y/2)*s;e.fillStyle="#fff4be44",e.fillRect(oe-2*s,U,9*s,s),e.fillStyle="#fffef0aa",e.fillRect(oe,U,4*s,s)}e.restore()}if(t.enabled&&!a&&l>=0){var _=Math.max(0,Math.sin(l*4.2)),ee=Math.max(0,Math.sin(l*4.2+2.2)),h=function(V,Te,Ce){if(!(Ce<.25)){e.save(),e.globalAlpha*=Ce*.95,e.fillStyle="#fffef4";var xe=Ce>.65?s*2:s;e.fillRect(Math.round(V-xe),Math.round(Te-s/2),xe*2+s,s),e.fillRect(Math.round(V-s/2),Math.round(Te-xe),s,xe*2+s),e.restore()}};h(5*s,E+4*s,_),h(i-6*s,E+5*s,ee)}}}function ia(e,t,n,a,l,i){var u=Math.max(0,Math.min(i,a/2,l/2));e.beginPath(),typeof e.roundRect=="function"?e.roundRect(t,n,a,l,u):(e.moveTo(t+u,n),e.arcTo(t+a,n,t+a,n+l,u),e.arcTo(t+a,n+l,t,n+l,u),e.arcTo(t,n+l,t,n,u),e.arcTo(t,n,t+a,n,u),e.closePath())}function Ga(e,t,n,a,l){if(!(l<=.02||a<=.5)){e.save(),e.translate(t,n),e.globalAlpha*=l,e.fillStyle="#fffef0",e.beginPath();for(var i=0;i<8;i++){var u=i%2===0?a:a*.24,s=i*Math.PI/4;i===0?e.moveTo(Math.cos(s)*u,Math.sin(s)*u):e.lineTo(Math.cos(s)*u,Math.sin(s)*u)}e.closePath(),e.fill(),e.restore()}}function sl(e,t,n,a,l){var i,u,s,E=t.width,f=t.height;if(!(E<=0||f<=0)){var b=Math.min((i=t.radius)!==null&&i!==void 0?i:16,E/2,f/2),k=a?2:6,z=a?3:0,re=l>=0?.5-.5*Math.cos(l*2.4):0;t.enabled&&!a&&l>=0&&(e.save(),e.shadowColor="#ffd23f99",e.shadowBlur=10+re*12,ia(e,0,z,E,f-z,b),e.fillStyle=n,e.fill(),e.restore()),e.save(),ia(e,0,z+2,E,Math.max(4,f-z-2),b),e.fillStyle="#0e2830",e.fill(),e.restore(),e.save(),ia(e,0,z,E,Math.max(4,f-k),b),e.fillStyle=n,e.fill(),e.clip();var U=(u=e.createLinearGradient)===null||u===void 0?void 0:u.call(e,0,z,0,f-k);if(U!=null&&U.addColorStop&&(U.addColorStop(0,"#ffffffa8"),U.addColorStop(.42,"#ffffff26"),U.addColorStop(.45,"#00000000"),U.addColorStop(1,"#00000024"),e.fillStyle=U,e.fillRect(0,z,E,f-k)),e.fillStyle="#fffef0bb",e.fillRect(b*.55,z+3,Math.max(0,E-b*1.1),3),t.enabled&&!a&&l>=0){var Y=(l%2.4-.15)/.95;if(Y>0&&Y<1){var oe=Y*Y*(3-2*Y),_=Math.sin(Y*Math.PI),ee=-E*.36+E*1.72*oe;e.save(),e.globalAlpha*=_,e.translate(ee,z),e.transform(1,0,-.36,1,0,0);var h=(s=e.createLinearGradient)===null||s===void 0?void 0:s.call(e,-48,0,48,0);h!=null&&h.addColorStop?(h.addColorStop(0,"#ffffff00"),h.addColorStop(.32,"#ffffff48"),h.addColorStop(.5,"#fffef8cc"),h.addColorStop(.68,"#ffffff48"),h.addColorStop(1,"#ffffff00"),e.fillStyle=h,e.fillRect(-48,0,96,f)):(e.fillStyle="#fffef8a8",e.fillRect(-14,0,28,f)),e.restore()}}if(e.restore(),t.strokeWidth&&(e.save(),ia(e,0,z,E,Math.max(4,f-k),b),e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,e.stroke(),e.restore()),t.enabled&&!a&&l>=0){var V=Math.max(0,Math.sin(l*2.4)),Te=V*V,Ce=Math.max(0,Math.sin(l*2.4+2.1)),xe=Ce*Ce,Le=Math.max(0,Math.sin(l*2.4+4.2)),Z=Le*Le;Ga(e,E*.12,z+9,4+Te*6,Te*.92),Ga(e,E*.88,z+10,3.8+xe*5.5,xe*.9),Ga(e,E*.76,Math.max(z+14,f-k-8),3+Z*4.2,Z*.8)}}}function oa(e){if(/\s/.test(e)||e.length>512)return!1;var t=/^https:\/\/play\.google\.com\/store\/apps\/details\?id=[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_]*){1,9}$/,n=/^https:\/\/apps\.apple\.com\/([a-z]{2}\/)?app\/([a-zA-Z0-9-]+\/)?id[1-9][0-9]{5,19}$/;return t.test(e)&&!/id=example\.|[.=]placeholder(\.|$)|id=com\.example(\.|$)/.test(e)||n.test(e)}var Ci=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ei=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},Qa=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))};function cl(e){var t,n,a;e===void 0&&(e={});var l=(t=e.timeoutMs)!==null&&t!==void 0?t:5e3,i=(n=e.pollMs)!==null&&n!==void 0?n:25;if(![l,i].every(function(J){return Number.isFinite(J)&&J>=1&&J<=6e4}))throw Error("Invalid Unity host deadline/poll interval");var u=(a=e.getHost)!==null&&a!==void 0?a:(function(){return window.mraid}),s=new Set,E=new Set,f=[],b={},k=!1,z=!1,re=!1,U=!1,Y=!1,oe=!1,_,ee,h,V,Te,Ce,xe=function(){return re||U};function Le(){var J,Q,j;clearTimeout(Te),clearTimeout(Ce);try{for(var me=Ci(f.splice(0)),le=me.next();!le.done;le=me.next()){var Ie=Ei(le.value,2),X=Ie[0],ve=Ie[1];try{(j=b.mraid)===null||j===void 0||j.removeEventListener(X,ve)}catch{}}}catch(Ve){J={error:Ve}}finally{try{le&&!le.done&&(Q=me.return)&&Q.call(me)}finally{if(J)throw J.error}}}function Z(J){V==null||V(J instanceof Error?J:Error(String(J))),h=void 0,V=void 0}function ue(J){var Q,j;if(!xe()){var me=k;if(re=!0,k=!1,z=!1,Le(),Z(J),me)try{for(var le=Ci(Qa([],Ei(E),!1)),Ie=le.next();!Ie.done;Ie=le.next()){var X=Ie.value;X()}}catch(ve){Q={error:ve}}finally{try{Ie&&!Ie.done&&(j=le.return)&&j.call(le)}finally{if(Q)throw Q.error}}s.clear(),E.clear()}}function ie(J,Q){return f.push([J,Q]),b.mraid.addEventListener(J,Q),ye(J,Q)}function ye(J,Q){if(xe()){try{b.mraid.removeEventListener(J,Q)}catch{}return!1}return!0}function R(J){var Q,j;if(!xe()){if(typeof J!="boolean"){ue(Error("Invalid Unity viewability event"));return}if(!k){_=J;return}if(z!==J){z=J;try{for(var me=Ci(Qa([],Ei(s),!1)),le=me.next();!le.done;le=me.next()){var Ie=le.value;if(xe())break;Ie(z)}}catch(X){Q={error:X}}finally{try{le&&!le.done&&(j=me.return)&&j.call(me)}finally{if(Q)throw Q.error}}}}}var x=function(J){J==="hidden"&&ue(Error("Unity host closed"))},$=function(){var J;k&&!xe()&&((J=e.onResize)===null||J===void 0||J.call(e))};function D(){var J,Q,j,me;if(!(!Y||k||oe||xe())){oe=!0;try{var le=b.mraid.getState();if(xe()||le==="loading")return;if(le==="hidden")throw Error("Unity host closed before ready");if(!["default","expanded","resized"].includes(le))throw Error("Invalid Unity host state");var Ie=b.mraid.getVersion();if(xe())return;if(Ie!=="3.0")throw Error("Unity Ads UA requires MRAID 3.0");try{for(var X=Ci([["viewableChange",R],["stateChange",x],["sizeChange",$]]),ve=X.next();!ve.done;ve=X.next()){var Ve=Ei(ve.value,2),ce=Ve[0],Se=Ve[1];if(!ie(ce,Se))return}}catch(Or){J={error:Or}}finally{try{ve&&!ve.done&&(Q=X.return)&&Q.call(X)}finally{if(J)throw J.error}}var $e=b.mraid.isViewable();if(xe())return;if(typeof $e!="boolean")throw Error("Invalid Unity initial viewability");z=_!=null?_:$e,k=!0,clearTimeout(Te),clearTimeout(Ce),h==null||h(),h=void 0,V=void 0;try{for(var Xe=Ci(Qa([],Ei(s),!1)),fr=Xe.next();!fr.done;fr=Xe.next()){var Pr=fr.value;if(xe())break;Pr(z)}}catch(Or){j={error:Or}}finally{try{fr&&!fr.done&&(me=Xe.return)&&me.call(Xe)}finally{if(j)throw j.error}}}catch(Or){ue(Or)}finally{oe=!1}}}function fe(){if(!xe())try{var J=u();if(xe())return;if(!J){Ce=setTimeout(fe,i);return}if(b.mraid=J,f.push(["ready",D]),b.mraid.addEventListener("ready",D),!ye("ready",D))return;Y=!0,D()}catch(Q){ue(Q)}}return{init:function(){return ee||(ee=new Promise(function(J,Q){h=J,V=Q}),xe()?(Z(Error("Unity bridge destroyed")),ee):(Te=setTimeout(function(){return ue(Error("Unity MRAID readiness timed out"))},l),fe(),ee))},isReady:function(){return k&&!xe()},isVisible:function(){return k&&z&&!xe()},isClosed:xe,onVisibilityChanged:function(J){return xe()||s.add(J),function(){return s.delete(J)}},onClosed:function(J){return xe()||E.add(J),function(){return E.delete(J)}},openStore:function(J){if(!k||!z||xe()||!oa(J))throw Error("Unity store request not permitted");b.mraid.open(J)},destroy:function(){U||(U=!0,k=!1,z=!1,Le(),Z(Error("Unity bridge destroyed")),s.clear(),E.clear())}}}var ti=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ni=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},Ja=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))};function hl(e){var t;e===void 0&&(e={});var n=(t=e.getHost)!==null&&t!==void 0?t:(function(){return window.mraid}),a,l=!1,i=!1,u=!1,s=!1,E=!1,f,b,k,z,re,U=new Set,Y=new Set,oe=[];function _(){var ie,ye;clearTimeout(z),clearTimeout(re);try{for(var R=ti(oe.splice(0)),x=R.next();!x.done;x=R.next()){var $=ni(x.value,2),D=$[0],fe=$[1];try{a==null||a.removeEventListener(D,fe)}catch{}}}catch(J){ie={error:J}}finally{try{x&&!x.done&&(ye=R.return)&&ye.call(R)}finally{if(ie)throw ie.error}}}function ee(ie,ye){if(oe.push([ie,ye]),a.addEventListener(ie,ye),u||s){try{a.removeEventListener(ie,ye)}catch{}return!1}return!0}function h(ie){var ye=ie instanceof Error?ie:Error(String(ie));k==null||k(ye),b=void 0,k=void 0}function V(ie,ye){var R,x;if(!(u||s)&&(u=!0,l=!1,i=!1,_(),h(ie),ye))try{for(var $=ti(Ja([],ni(Y),!1)),D=$.next();!D.done;D=$.next()){var fe=D.value;fe()}}catch(J){R={error:J}}finally{try{D&&!D.done&&(x=$.return)&&x.call($)}finally{if(R)throw R.error}}}function Te(){var ie,ye,R,x;if(!(!E||l||u||s))try{var $=a.getState();if(u||s||$==="loading")return;if($==="hidden"){V(Error("MRAID closed before ready"),!0);return}if(!["default","expanded","resized"].includes($))throw Error("Invalid MRAID state");try{for(var D=ti([["viewableChange",xe],["stateChange",Le],["sizeChange",Z]]),fe=D.next();!fe.done;fe=D.next()){var J=ni(fe.value,2),Q=J[0],j=J[1];if(!ee(Q,j))return}}catch(X){ie={error:X}}finally{try{fe&&!fe.done&&(ye=D.return)&&ye.call(D)}finally{if(ie)throw ie.error}}var me=a.isViewable();if(u||s)return;if(typeof me!="boolean")throw Error("Invalid MRAID viewability");i=me,l=!0,clearTimeout(z),clearTimeout(re),b==null||b(),b=void 0,k=void 0;try{for(var le=ti(Ja([],ni(U),!1)),Ie=le.next();!Ie.done;Ie=le.next()){var j=Ie.value;j(i)}}catch(X){R={error:X}}finally{try{Ie&&!Ie.done&&(x=le.return)&&x.call(le)}finally{if(R)throw R.error}}}catch(X){V(X,l)}}var Ce=function(){return Te()},xe=function(ie){var ye,R;if(!(!l||u||s)){if(typeof ie!="boolean"){V(Error("Invalid MRAID visibility event"),!0);return}i=ie;try{for(var x=ti(Ja([],ni(U),!1)),$=x.next();!$.done;$=x.next()){var D=$.value;D(i)}}catch(fe){ye={error:fe}}finally{try{$&&!$.done&&(R=x.return)&&R.call(x)}finally{if(ye)throw ye.error}}}},Le=function(ie){ie==="hidden"&&V(Error("MRAID closed"),!0)},Z=function(){var ie;l&&!u&&!s&&((ie=e.onResize)===null||ie===void 0||ie.call(e))};function ue(){var ie,ye,R;if(!(u||s))try{if(a=n(),u||s)return;if(!a){re=setTimeout(ue,(R=e.pollMs)!==null&&R!==void 0?R:50);return}if(![a.getState,a.isViewable,a.addEventListener,a.removeEventListener,a.open].every(function(Q){return typeof Q=="function"}))throw Error("Incomplete MRAID 2 interface");try{for(var x=ti([["ready",Ce]]),$=x.next();!$.done;$=x.next()){var D=ni($.value,2),fe=D[0],J=D[1];if(!ee(fe,J))return}}catch(Q){ie={error:Q}}finally{try{$&&!$.done&&(ye=x.return)&&ye.call(x)}finally{if(ie)throw ie.error}}E=!0,Te()}catch(Q){V(Q,!1)}}return{init:function(){var ie;return f||(f=new Promise(function(ye,R){b=ye,k=R}),u||s?(h(Error("MRAID bridge destroyed")),f):(z=setTimeout(function(){return V(Error("MRAID readiness timed out"),!1)},(ie=e.timeoutMs)!==null&&ie!==void 0?ie:5e3),ue(),f))},isReady:function(){return l&&!u&&!s},isVisible:function(){return i&&l&&!u&&!s},isClosed:function(){return u||s},onVisibilityChanged:function(ie){return!u&&!s&&U.add(ie),function(){return U.delete(ie)}},onClosed:function(ie){return!u&&!s&&Y.add(ie),function(){return Y.delete(ie)}},openStore:function(ie){if(!l||!i||u||s||!oa(ie))throw Error("MRAID store request not permitted");a.open(ie)},destroy:function(){s||(s=!0,l=!1,i=!1,_(),h(Error("MRAID bridge destroyed")),U.clear(),Y.clear())}}}var Xn=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Un=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},Pi=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))};function yl(e){e===void 0&&(e={});var t=new Set,n=new Set,a=new Set,l=[],i,u=!1,s=!1,E=!1,f=!1,b,k,z,re,U,Y=function(){return E||f};function oe(){var Z,ue;clearTimeout(re),clearTimeout(U);try{for(var ie=Xn(l.splice(0)),ye=ie.next();!ye.done;ye=ie.next()){var R=Un(ye.value,2),x=R[0],$=R[1];try{i==null||i.removeEventListener(x,$)}catch{}}}catch(D){Z={error:D}}finally{try{ye&&!ye.done&&(ue=ie.return)&&ue.call(ie)}finally{if(Z)throw Z.error}}}function _(Z){var ue,ie;if(!Y()){E=!0,u=!1,s=!1,oe(),z==null||z(Z instanceof Error?Z:Error(String(Z))),k=void 0,z=void 0;try{for(var ye=Xn(Pi([],Un(n),!1)),R=ye.next();!R.done;R=ye.next()){var x=R.value;x()}}catch($){ue={error:$}}finally{try{R&&!R.done&&(ie=ye.return)&&ie.call(ye)}finally{if(ue)throw ue.error}}}}var ee=function(Z){if(!(typeof Z!="number"||!Number.isFinite(Z)||Z<0))return Math.min(1,Z>1?Z/100:Z)},h=function(Z){if(typeof Z=="boolean")return Z;if(Z&&typeof Z=="object"&&typeof Z.isViewable=="boolean")return Z.isViewable},V=function(){var Z,ue,ie,ye,R,x;if(!(u||Y()||!i||((R=i.isReady)===null||R===void 0?void 0:R.call(i))===!1))try{s=i.isViewable();var $=(x=i.getAudioVolume)===null||x===void 0?void 0:x.call(i),D=$===void 0?void 0:ee($);if(typeof s!="boolean"||$!==void 0&&D===void 0)throw Error("Invalid DAPI initial state");if(u=!0,clearTimeout(re),clearTimeout(U),k==null||k(),k=void 0,z=void 0,D!==void 0)try{for(var fe=Xn(Pi([],Un(a),!1)),J=fe.next();!J.done;J=fe.next()){var Q=J.value;Q(D)}}catch(le){Z={error:le}}finally{try{J&&!J.done&&(ue=fe.return)&&ue.call(fe)}finally{if(Z)throw Z.error}}try{for(var j=Xn(Pi([],Un(t),!1)),me=j.next();!me.done;me=j.next()){var Q=me.value;Q(s)}}catch(le){ie={error:le}}finally{try{me&&!me.done&&(ye=j.return)&&ye.call(j)}finally{if(ie)throw ie.error}}}catch(le){_(le)}},Te=function(Z){var ue,ie;if(!Y()){var ye=h(Z);if(ye===void 0){_(Error("Invalid DAPI visibility"));return}s=ye;try{for(var R=Xn(Pi([],Un(t),!1)),x=R.next();!x.done;x=R.next()){var $=x.value;$(ye)}}catch(D){ue={error:D}}finally{try{x&&!x.done&&(ie=R.return)&&ie.call(R)}finally{if(ue)throw ue.error}}}},Ce=function(Z){var ue,ie;if(!Y()){var ye=ee(Z);if(ye===void 0){_(Error("Invalid DAPI volume"));return}try{for(var R=Xn(Pi([],Un(a),!1)),x=R.next();!x.done;x=R.next()){var $=x.value;$(ye)}}catch(D){ue={error:D}}finally{try{x&&!x.done&&(ie=R.return)&&ie.call(R)}finally{if(ue)throw ue.error}}}},xe=function(){var Z;u&&!Y()&&((Z=e.onResize)===null||Z===void 0||Z.call(e))};function Le(){var Z,ue,ie;if(!Y()){if(i=window.dapi,!i){U=setTimeout(Le,(ie=e.pollMs)!==null&&ie!==void 0?ie:25);return}try{try{for(var ye=Xn([["ready",V],["viewableChange",Te],["audioVolumeChange",Ce],["adResized",xe]]),R=ye.next();!R.done;R=ye.next()){var x=Un(R.value,2),$=x[0],D=x[1];l.push([$,D]),i.addEventListener($,D)}}catch(fe){Z={error:fe}}finally{try{R&&!R.done&&(ue=ye.return)&&ue.call(ye)}finally{if(Z)throw Z.error}}V()}catch(fe){_(fe)}}}return{init:function(){var Z;return b||(b=new Promise(function(ue,ie){k=ue,z=ie}),Y()?(z==null||z(Error("DAPI bridge closed")),b):(re=setTimeout(function(){return _(Error("DAPI readiness timed out"))},(Z=e.timeoutMs)!==null&&Z!==void 0?Z:5e3),Le(),b))},isReady:function(){return u&&!Y()},isVisible:function(){return u&&s&&!Y()},isClosed:Y,onVisibilityChanged:function(Z){return Y()||t.add(Z),function(){return t.delete(Z)}},onClosed:function(Z){return Y()||n.add(Z),function(){return n.delete(Z)}},onVolumeChanged:function(Z){return Y()||a.add(Z),function(){return a.delete(Z)}},openStore:function(){if(!u||!s||Y()||typeof(i==null?void 0:i.openStoreUrl)!="function")throw Error("DAPI store host unavailable");i.openStoreUrl()},destroy:function(){f||(f=!0,u=!1,s=!1,oe(),z==null||z(Error("DAPI bridge destroyed")),t.clear(),n.clear(),a.clear())}}}var Af=function(e,t,n,a){function l(i){return i instanceof n?i:new n(function(u){u(i)})}return new(n||(n=Promise))(function(i,u){function s(b){try{f(a.next(b))}catch(k){u(k)}}function E(b){try{f(a.throw(b))}catch(k){u(k)}}function f(b){b.done?i(b.value):l(b.value).then(s,E)}f((a=a.apply(e,t||[])).next())})},Rf=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,l,i,u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=s(0),u.throw=s(1),u.return=s(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(f){return function(b){return E([f,b])}}function E(f){if(a)throw new TypeError("Generator is already executing.");for(;u&&(u=0,f[0]&&(n=0)),n;)try{if(a=1,l&&(i=f[0]&2?l.return:f[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,f[1])).done)return i;switch(l=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,l=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){n.label=f[1];break}if(f[0]===6&&n.label<i[1]){n.label=i[1],i=f;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(f);break}i[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(b){f=[6,b],l=0}finally{a=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},Of=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},Vf=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},Nf=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function pl(){var e=new Set,t=!1,n=!1,a=!1,l=function(){var i,u;if(!a){n=document.visibilityState!=="hidden";try{for(var s=Nf(Vf([],Of(e),!1)),E=s.next();!E.done;E=s.next()){var f=E.value;f(n)}}catch(b){i={error:b}}finally{try{E&&!E.done&&(u=s.return)&&u.call(s)}finally{if(i)throw i.error}}}};return{init:function(){return Af(this,void 0,void 0,function(){return Rf(this,function(i){switch(i.label){case 0:if(a)throw Error("Meta bridge destroyed");return document.readyState!=="loading"?[3,2]:[4,new Promise(function(u){return document.addEventListener("DOMContentLoaded",function(){return u()},{once:!0})})];case 1:i.sent(),i.label=2;case 2:if(a)throw Error("Meta bridge destroyed");return document.addEventListener("visibilitychange",l),n=document.visibilityState!=="hidden",t=!0,l(),[2]}})})},isReady:function(){return t&&!a},isVisible:function(){return t&&n&&!a},isClosed:function(){return a},onVisibilityChanged:function(i){return a||e.add(i),function(){return e.delete(i)}},onClosed:function(){return function(){}},openStore:function(){var i=window.FbPlayableAd;if(!t||!n||a||typeof(i==null?void 0:i.onCTAClick)!="function")throw Error("Meta CTA host unavailable");i.onCTAClick()},destroy:function(){a=!0,t=!1,n=!1,document.removeEventListener("visibilitychange",l),e.clear()}}}var zf=function(e,t,n,a){function l(i){return i instanceof n?i:new n(function(u){u(i)})}return new(n||(n=Promise))(function(i,u){function s(b){try{f(a.next(b))}catch(k){u(k)}}function E(b){try{f(a.throw(b))}catch(k){u(k)}}function f(b){b.done?i(b.value):l(b.value).then(s,E)}f((a=a.apply(e,t||[])).next())})},Bf=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,l,i,u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=s(0),u.throw=s(1),u.return=s(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(f){return function(b){return E([f,b])}}function E(f){if(a)throw new TypeError("Generator is already executing.");for(;u&&(u=0,f[0]&&(n=0)),n;)try{if(a=1,l&&(i=f[0]&2?l.return:f[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,f[1])).done)return i;switch(l=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,l=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){n.label=f[1];break}if(f[0]===6&&n.label<i[1]){n.label=i[1],i=f;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(f);break}i[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(b){f=[6,b],l=0}finally{a=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},Wf=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},Lf=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},Df=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function ml(){var e=new Set,t=!1,n=!1,a=!1,l=function(){var i,u;if(!a){n=document.visibilityState!=="hidden";try{for(var s=Df(Lf([],Wf(e),!1)),E=s.next();!E.done;E=s.next()){var f=E.value;f(n)}}catch(b){i={error:b}}finally{try{E&&!E.done&&(u=s.return)&&u.call(s)}finally{if(i)throw i.error}}}};return{init:function(){return zf(this,void 0,void 0,function(){return Bf(this,function(i){switch(i.label){case 0:if(a)throw Error("Google Ads bridge destroyed");return document.readyState!=="loading"?[3,2]:[4,new Promise(function(u){return document.addEventListener("DOMContentLoaded",function(){return u()},{once:!0})})];case 1:i.sent(),i.label=2;case 2:if(a)throw Error("Google Ads bridge destroyed");return document.addEventListener("visibilitychange",l),n=document.visibilityState!=="hidden",t=!0,l(),[2]}})})},isReady:function(){return t&&!a},isVisible:function(){return t&&n&&!a},isClosed:function(){return a},onVisibilityChanged:function(i){return a||e.add(i),function(){return e.delete(i)}},onClosed:function(){return function(){}},openStore:function(){var i=window.ExitApi;if(!t||!n||a||typeof(i==null?void 0:i.exit)!="function")throw Error("Google ExitApi unavailable");i.exit()},destroy:function(){a=!0,t=!1,n=!1,document.removeEventListener("visibilitychange",l),e.clear()}}}var Hf=function(e,t,n,a){function l(i){return i instanceof n?i:new n(function(u){u(i)})}return new(n||(n=Promise))(function(i,u){function s(b){try{f(a.next(b))}catch(k){u(k)}}function E(b){try{f(a.throw(b))}catch(k){u(k)}}function f(b){b.done?i(b.value):l(b.value).then(s,E)}f((a=a.apply(e,t||[])).next())})},Ff=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,l,i,u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=s(0),u.throw=s(1),u.return=s(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(f){return function(b){return E([f,b])}}function E(f){if(a)throw new TypeError("Generator is already executing.");for(;u&&(u=0,f[0]&&(n=0)),n;)try{if(a=1,l&&(i=f[0]&2?l.return:f[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,f[1])).done)return i;switch(l=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,l=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){n.label=f[1];break}if(f[0]===6&&n.label<i[1]){n.label=i[1],i=f;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(f);break}i[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(b){f=[6,b],l=0}finally{a=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},qa=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},ja=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},_a=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function gl(){var e=window,t=new Set,n=new Set,a=e.gameStart,l=e.gameClose,i=!1,u=!1,s=!1,E=!1,f=function(){var k,z;if(!(s||E)){var re=!u||!i;if(i=!0,u=!0,re)try{for(var U=_a(ja([],qa(t),!1)),Y=U.next();!Y.done;Y=U.next()){var oe=Y.value;oe(!0)}}catch(_){k={error:_}}finally{try{Y&&!Y.done&&(z=U.return)&&z.call(U)}finally{if(k)throw k.error}}}},b=function(){var k,z,re,U;if(!(s||E)){i=!1,u=!1,s=!0;try{for(var Y=_a(ja([],qa(t),!1)),oe=Y.next();!oe.done;oe=Y.next()){var _=oe.value;_(!1)}}catch(V){k={error:V}}finally{try{oe&&!oe.done&&(z=Y.return)&&z.call(Y)}finally{if(k)throw k.error}}try{for(var ee=_a(ja([],qa(n),!1)),h=ee.next();!h.done;h=ee.next()){var _=h.value;_()}}catch(V){re={error:V}}finally{try{h&&!h.done&&(U=ee.return)&&U.call(ee)}finally{if(re)throw re.error}}}};return e.gameStart=f,e.gameClose=b,{init:function(){return Hf(this,void 0,void 0,function(){return Ff(this,function(k){if(s||E)throw Error("Mintegral bridge closed");if(typeof e.gameReady!="function")throw Error("Mintegral gameReady host unavailable");return e.gameReady(),[2]})})},isReady:function(){return i&&!s&&!E},isVisible:function(){return i&&u&&!s&&!E},isClosed:function(){return s||E},onVisibilityChanged:function(k){return!s&&!E&&t.add(k),function(){return t.delete(k)}},onClosed:function(k){return!s&&!E&&n.add(k),function(){return n.delete(k)}},notifyGameEnd:function(){var k;!s&&!E&&((k=e.gameEnd)===null||k===void 0||k.call(e))},notifyGameRetry:function(){var k;!s&&!E&&((k=e.gameRetry)===null||k===void 0||k.call(e))},openStore:function(){if(!i||!u||s||E||typeof e.install!="function")throw Error("Mintegral install host unavailable");e.install()},destroy:function(){E||(E=!0,i=!1,u=!1,e.gameStart===f&&(a?e.gameStart=a:delete e.gameStart),e.gameClose===b&&(l?e.gameClose=l:delete e.gameClose),t.clear(),n.clear())}}}var Xf=function(e,t,n,a){function l(i){return i instanceof n?i:new n(function(u){u(i)})}return new(n||(n=Promise))(function(i,u){function s(b){try{f(a.next(b))}catch(k){u(k)}}function E(b){try{f(a.throw(b))}catch(k){u(k)}}function f(b){b.done?i(b.value):l(b.value).then(s,E)}f((a=a.apply(e,t||[])).next())})},Uf=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,l,i,u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=s(0),u.throw=s(1),u.return=s(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(f){return function(b){return E([f,b])}}function E(f){if(a)throw new TypeError("Generator is already executing.");for(;u&&(u=0,f[0]&&(n=0)),n;)try{if(a=1,l&&(i=f[0]&2?l.return:f[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,f[1])).done)return i;switch(l=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,l=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){n.label=f[1];break}if(f[0]===6&&n.label<i[1]){n.label=i[1],i=f;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(f);break}i[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(b){f=[6,b],l=0}finally{a=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},Yf=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},Gf=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},Zf=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Il(){var e=new Set,t=!1,n=!1,a=!1,l=function(){var i,u;if(!a){n=document.visibilityState!=="hidden";try{for(var s=Zf(Gf([],Yf(e),!1)),E=s.next();!E.done;E=s.next()){var f=E.value;f(n)}}catch(b){i={error:b}}finally{try{E&&!E.done&&(u=s.return)&&u.call(s)}finally{if(i)throw i.error}}}};return{init:function(){return Xf(this,void 0,void 0,function(){return Uf(this,function(i){switch(i.label){case 0:if(a)throw Error("TikTok bridge destroyed");return document.readyState!=="loading"?[3,2]:[4,new Promise(function(u){return document.addEventListener("DOMContentLoaded",function(){return u()},{once:!0})})];case 1:i.sent(),i.label=2;case 2:if(a)throw Error("TikTok bridge destroyed");return document.addEventListener("visibilitychange",l),n=document.visibilityState!=="hidden",t=!0,l(),[2]}})})},isReady:function(){return t&&!a},isVisible:function(){return t&&n&&!a},isClosed:function(){return a},onVisibilityChanged:function(i){return a||e.add(i),function(){return e.delete(i)}},onClosed:function(){return function(){}},openStore:function(){var i,u,s=window,E=typeof s.openAppStore=="function"?s.openAppStore.bind(s):(u=(i=s.playableSDK)===null||i===void 0?void 0:i.openAppStore)===null||u===void 0?void 0:u.bind(s.playableSDK);if(!t||!n||a||!E)throw Error("TikTok store host unavailable");E()},destroy:function(){a=!0,t=!1,n=!1,document.removeEventListener("visibilitychange",l),e.clear()}}}var ge=function(){return ge=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},ge.apply(this,arguments)},$f=function(e,t,n,a){function l(i){return i instanceof n?i:new n(function(u){u(i)})}return new(n||(n=Promise))(function(i,u){function s(b){try{f(a.next(b))}catch(k){u(k)}}function E(b){try{f(a.throw(b))}catch(k){u(k)}}function f(b){b.done?i(b.value):l(b.value).then(s,E)}f((a=a.apply(e,t||[])).next())})},Kf=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,l,i,u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=s(0),u.throw=s(1),u.return=s(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(f){return function(b){return E([f,b])}}function E(f){if(a)throw new TypeError("Generator is already executing.");for(;u&&(u=0,f[0]&&(n=0)),n;)try{if(a=1,l&&(i=f[0]&2?l.return:f[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,f[1])).done)return i;switch(l=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,l=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){n.label=f[1];break}if(f[0]===6&&n.label<i[1]){n.label=i[1],i=f;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(f);break}i[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(b){f=[6,b],l=0}finally{a=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},K=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},ae=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},q=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function bl(e){if(e!=="standalone"){if(e==="unity-ads-ua-playable")return cl();if(e==="applovin-growth-playable")return hl();if(e==="ironsource-levelplay-playable")return yl();if(e==="meta-audience-playable")return pl();if(e==="google-ads-app-playable")return ml();if(e==="mintegral-appgrowth-zip")return gl();if(e==="tiktok-ads-playable")return Il();throw Error("E_NATIVE_TARGET")}}function eo(e){var t=[{id:"sdk-top-left",left:0,top:0,right:Math.min(48,e.width),bottom:Math.min(48,e.height)},{id:"sdk-top-right",left:Math.max(0,e.width-56),top:0,right:e.width,bottom:Math.min(56,e.height)},{id:"sdk-bottom-left",left:0,top:Math.max(0,e.height-28),right:Math.min(48,e.width),bottom:e.height}];return{left:Math.min(48,e.width),top:Math.min(56,e.height),right:Math.max(0,e.width-56),bottom:Math.max(0,e.height-28),zones:t}}function la(e,t){var n,a,l=(a=(n=e.measureText)===null||n===void 0?void 0:n.call(e,t))===null||a===void 0?void 0:a.width,i=/(\d+(?:\.\d+)?)px/.exec(e.font||"");return Number.isFinite(l)?l:ae([],K(t),!1).length*(i?Number(i[1]):16)*.6}function xl(e,t,n,a){var l,i,u,s,E,f,b;e.font=n.fontWeight+" "+a+"px "+n.fontFamily;var k=Math.max(0,n.width-2*((b=n.padding)!==null&&b!==void 0?b:4)),z=[];try{for(var re=q(String(t).split(`
|
|
5
|
-
`)),U=re.next();!U.done;U=re.next()){var Y=U.value;if(n.wrap===!1){z.push(Y);continue}var oe=Y.trim()?Y.trim().split(/\s+/):[""],_=void 0;try{for(var ee=(u=void 0,q(oe)),h=ee.next();!h.done;h=ee.next()){var V=h.value,Te=_?_+" "+V:V;if(la(e,Te)<=k){_=Te;continue}if(_&&z.push(_),la(e,V)<=k){_=V;continue}var Ce="";try{for(var xe=(E=void 0,q(V)),Le=xe.next();!Le.done;Le=xe.next()){var Z=Le.value;Ce&&la(e,Ce+Z)>k?(z.push(Ce),Ce=Z):Ce+=Z}}catch(ue){E={error:ue}}finally{try{Le&&!Le.done&&(f=xe.return)&&f.call(xe)}finally{if(E)throw E.error}}_=Ce}}catch(ue){u={error:ue}}finally{try{h&&!h.done&&(s=ee.return)&&s.call(ee)}finally{if(u)throw u.error}}z.push(_)}}catch(ue){l={error:ue}}finally{try{U&&!U.done&&(i=re.return)&&i.call(re)}finally{if(l)throw l.error}}return z}function wl(e,t,n){var a,l,i=(a=n.padding)!==null&&a!==void 0?a:4,u=Math.max(0,n.width-2*i),s=Math.max(0,n.height-2*i),E=Math.min(n.fontSize,(l=n.minFontSize)!==null&&l!==void 0?l:12),f=n.fontSize,b=xl(e,t,n,f),k,z=function(){var re;e.font=n.fontWeight+" "+f+"px "+n.fontFamily;var U=Math.max.apply(Math,ae([0],K(b.map(function(ee){return la(e,ee)})),!1)),Y=f*((re=n.lineHeight)!==null&&re!==void 0?re:1.2),oe=b.length>16;oe&&(b=b.slice(0,16));var _=b.length*Y;return{lines:b,fontSize:f,scale:f/n.fontSize,renderedWidth:U,renderedHeight:_,availableWidth:u,availableHeight:s,padding:i,lineHeight:Y,overflowsWidth:U>u+.01,overflowsHeight:oe||_>s+.01,unsupportedChars:[]}};if(k=z(),n.autoFit!==!1)for(;(k.overflowsWidth||k.overflowsHeight)&&f>E;)f=Math.max(E,f-1),b=xl(e,t,n,f),k=z();return k}function Qf(e,t,n){var a=wl(e,t,n),l=a.padding;e.fillStyle=n.color,e.font=n.fontWeight+" "+a.fontSize+"px "+n.fontFamily,e.textAlign=n.align,e.textBaseline="middle";var i=n.align==="left"?l:n.align==="right"?n.width-l:n.width/2,u=(n.height-a.renderedHeight)/2;return a.lines.forEach(function(s,E){return e.fillText(s,i,u+(E+.5)*a.lineHeight)}),a}function Jf(e,t,n){var a,l,i,u,s,E,f=n===void 0?{}:n,b=f.edit,k=b===void 0?!1:b,z=f.sceneId,re=z===void 0?e.base.startScene:z,U=f.onSelect,Y=U===void 0?function(){}:U,oe=f.network,_=oe===void 0?"standalone":oe,ee=bl(_),h=t.getContext("2d"),V=new Map(e.components.map(function(r){return[r.id,r]})),Te=new Map(e.assets.map(function(r){return[r.id,r]})),Ce=new Map,xe=new Map(e.events.map(function(r){return[r.id,r]})),Le=new Map(e.gameplay.filter(function(r){return r.kind==="responsive-layout"}).map(function(r){return[r.componentId,r.parameters]})),Z=(i=globalThis.matchMedia)===null||i===void 0?void 0:i.call(globalThis,"(prefers-reduced-motion: reduce)"),ue,ie=new Map,ye=ie;function R(){var r=Le.size>0&&t.clientWidth>t.clientHeight;return{width:r?Math.max(e.base.width,e.base.height):e.base.width,height:r?Math.min(e.base.width,e.base.height):e.base.height,landscape:r}}function x(){ue!==R().landscape&&(Jt(),rt())}try{for(var $=q(e.assets),D=$.next();!D.done;D=$.next()){var fe=D.value;if(fe.mime.startsWith("image/")){var J=new Image;J.src="data:"+fe.mime+";base64,"+fe.data,Ce.set(fe.id,J)}}}catch(r){a={error:r}}finally{try{D&&!D.done&&(l=$.return)&&l.call($)}finally{if(a)throw a.error}}var Q=re,j={},me=[],le=[],Ie=[],X=[],ve=new Set,Ve=new Map,ce=0,Se=0,$e=0,Xe=0,fr=0,Pr=!1,Or=0,Vr=0,Tr=!1,pn=[],Ke,bt,Ge,Ut,_r,Pt,mn,wt,zt,Yt=[],Gt,vt=[],at=[],Lr,Zt=0,$t=!1,ii=0,gn=_==="standalone",ai=_==="standalone",Yn=_==="standalone",An=!1,Ti=!1,Qe=new Map,Rn=new Map,Ir=new Map,oi=new Map,In=new Set,ro=new Map,Gn=new Set,Zn=new Map,Ai=new Map,fa=new Map,da=new Map,xn=new Map,Bt=new Map,li=0,ua=0,Dr,et,va=1,sa,Mt=new Map,to=new Map,Tt=new Map,Kt=new Map,On=new Map,Vn=new Map,Ri=new Map,Ar=Bo(),$n=Do(),Oi=new Map,Vi=new Map,Wt=Yo(Fo(e.projectId)),Kn=new Map,on=new Map,Nn=new Map,Ni=new Set,ln=new Map,Fe,Ml=1,Sl=1,xr,bn,fi={x:0,y:0},Xr,Qt=[],wn=[],ze=function(r){var o;return(o=Ir.get(r))!==null&&o!==void 0?o:V.get(r)},St=function(r,o){return e.gameplay.find(function(y){return y.kind===r&&y.componentId===o})},di=function(){var r,o;li++,Gn.clear(),Zn.clear(),fa.clear(),da.clear();try{for(var y=q(In),d=y.next();!d.done;d=y.next()){var v=d.value;try{v.stop()}catch{}}}catch(p){r={error:p}}finally{try{d&&!d.done&&(o=y.return)&&o.call(y)}finally{if(r)throw r.error}}In.clear(),Ai.clear()},no=function(r){var o,y;if(!Fe||r!==void 0&&Fe.pointerId!==r)return!1;var d=Fe.pointerId;Fe.behavior.parameters.powerVariableId&&(j[Fe.behavior.parameters.powerVariableId]=0),Fe=void 0;try{!((o=t.hasPointerCapture)===null||o===void 0)&&o.call(t,d)&&((y=t.releasePointerCapture)===null||y===void 0||y.call(t,d))}catch{}return!0},ca=function(r){var o=r.behavior.parameters;o.axisXVariableId&&(j[o.axisXVariableId]=r.nx),o.axisYVariableId&&(j[o.axisYVariableId]=r.ny),o.magnitudeVariableId&&(j[o.magnitudeVariableId]=r.magnitude),o.angleVariableId&&r.magnitude>0&&(j[o.angleVariableId]=r.angle)},ha=function(r,o){var y,d,v,p;o===void 0&&(o=!1);try{for(var c=q(ln.values()),w=c.next();!w.done;w=c.next()){var m=w.value;if(!(m.pointerId===null||r!==void 0&&m.pointerId!==r)){var S=m.pointerId;m.pointerId=null,m.nx=0,m.ny=0,m.magnitude=0,m.knobX=m.origin.x,m.knobY=m.origin.y,ca(m);try{!((v=t.hasPointerCapture)===null||v===void 0)&&v.call(t,S)&&((p=t.releasePointerCapture)===null||p===void 0||p.call(t,S))}catch{}o&&er(lt("joystickEnd",m.c))}}}catch(I){y={error:I}}finally{try{w&&!w.done&&(d=c.return)&&d.call(c)}finally{if(y)throw y.error}}},zi=function(r,o){var y,d;if(o===void 0&&(o=!0),!Ge||r!==void 0&&Ge.pointerId!==r)return!1;var v=Ge,p=v.pointerId;if(Ge=void 0,bn=void 0,o){var c=ze(v.targetId);c&&v.b.parameters.snapBack&&(qt(c,v.origin.x,v.origin.y),v.originZone&&Ar.place(c.id,v.originZone))}try{!((y=t.hasPointerCapture)===null||y===void 0)&&y.call(t,p)&&((d=t.releasePointerCapture)===null||d===void 0||d.call(t,p))}catch{}return!0},ya=function(r){var o,y;(Gt==null?void 0:Gt.pointerId)===r.pointerId&&(Gt=void 0);try{for(var d=q(xn.values()),v=d.next();!v.done;v=d.next()){var p=v.value;p.pointerId===r.pointerId&&p.held&&(p.held=!1,p.releasedAt=ce)}}catch(w){o={error:w}}finally{try{v&&!v.done&&(y=d.return)&&y.call(d)}finally{if(o)throw o.error}}var c=zi(r.pointerId);return Pt===r.pointerId?(_r=void 0,Pt=void 0,!0):c},Bi=function(r){var o,y,d,v,p,c,w,m;if(r){Ge&&((w=Ir.get(Ge.targetId))===null||w===void 0?void 0:w.instanceId)===r&&zi(void 0,!1),Fe&&((m=Ir.get(Fe.targetId))===null||m===void 0?void 0:m.instanceId)===r&&no();var S=[];Ar.release(r),$n.cancel(r),Kn.delete(r),Nn.delete(r),Wt.remove(r),me=me.filter(function(F){return F.id!==r});try{for(var I=q(Ir),C=I.next();!C.done;C=I.next()){var M=K(C.value,2),g=M[0],P=M[1];if(P.instanceId===r){S.push(g),Ar.release(g),$n.cancel(g),Ir.delete(g),Qe.delete(g),oi.delete(g),Tt.delete(g),On.delete(g),Vn.delete(g);try{for(var A=(d=void 0,q(Kt.values())),T=A.next();!T.done;T=A.next()){var N=T.value;N.removeAgent(g)}}catch(F){d={error:F}}finally{try{T&&!T.done&&(v=A.return)&&v.call(A)}finally{if(d)throw d.error}}try{for(var W=(p=void 0,q(Rn.keys())),B=W.next();!B.done;B=W.next()){var O=B.value;O.endsWith(":"+g)&&Rn.delete(O)}}catch(F){p={error:F}}finally{try{B&&!B.done&&(c=W.return)&&c.call(W)}finally{if(p)throw p.error}}}}}catch(F){o={error:F}}finally{try{C&&!C.done&&(y=I.return)&&y.call(I)}finally{if(o)throw o.error}}Ie=Ie.filter(function(F){return!S.includes(F.targetId)})}},Qn=function(r){for(;r;){if(r.prototype)return r.id;r=ze(r.parentId)}},kl=function(){var r,o,y;return{viewport:R(),components:Object.fromEntries(ae([],K(Qe),!1).map(function(d){var v=K(d,2),p=v[0],c=v[1];return[p,ge(ge({},c),{parameters:ge({},c.parameters)})]})),mode:k?"edit":"play",scene:Q,variables:ge({},j),time:ce,instances:me.map(function(d){return ge({id:d.id,prototypeId:d.prototypeId,x:d.transform[4],y:d.transform[5]},Wt.snapshot(d.id))}),particles:le.length,animations:Ie.length,contacts:ve.size,spriteFrames:Object.fromEntries(ae([],K(oi),!1).map(function(d){var v,p=K(d,2),c=p[0],w=p[1];return[c,(v=w.frame)!==null&&v!==void 0?v:0]})),input:{dragging:!!Ge,pointerId:(o=(r=Ge==null?void 0:Ge.pointerId)!==null&&r!==void 0?r:xr==null?void 0:xr.pointerId)!==null&&o!==void 0?o:null,pressed:_r!=null?_r:null,holding:!!(xr!=null&&xr.holds.length),occupancy:Ar.snapshot(),joysticks:Object.fromEntries(ae([],K(ln),!1).map(function(d){var v=K(d,2),p=v[0],c=v[1];return[p,{active:c.pointerId!==null,x:c.nx,y:c.ny,magnitude:c.magnitude,angle:c.angle}]}))},feedback:{presses:xn.size,floatingTexts:vt.length,flashes:at.length,shaking:!!Lr,tutorialHands:ii},match:{boards:Object.fromEntries(ae([],K(Mt),!1).map(function(d){var v=K(d,2),p=v[0],c=v[1];return[p,c.snapshot()]})),selected:Dr!=null?Dr:null,cells:ae([],K(Bt),!1).map(function(d){var v=K(d,2),p=v[0],c=v[1];return ge({id:p},c)})},physics:Ol(),paths:Object.fromEntries(ae([],K(Kt),!1).map(function(d){var v=K(d,2),p=v[0],c=v[1];return[p,c.snapshot()]})),canvas:{masks:Object.fromEntries(ae([],K(Kn),!1).map(function(d){var v=K(d,2),p=v[0],c=v[1];return[p,{progress:c.progress}]})),strokes:Object.fromEntries(ae([],K(on),!1).map(function(d){var v=K(d,2),p=v[0],c=v[1];return[p,c.strokes.length]})),walls:Qt.length,joints:wn.filter(function(d){return!d.broken}).length},audio:{state:(y=Ke==null?void 0:Ke.state)!==null&&y!==void 0?y:"locked",voices:In.size,blocked:ua},network:{target:_,ready:ai,visible:Yn,started:gn,closed:An,hostVolume:va},diagnostics:ae([],K(pn),!1)}},Jn=function(){return!k&&!Pr&&!document.hidden&&ai&&Yn&&gn&&!An},Jt=function(){var r,o,y,d;Gt=void 0,no(),ha(),zi(),xr=void 0,bn=void 0,Xr=void 0;try{for(var v=q(on.values()),p=v.next();!p.done;p=v.next()){var c=p.value;c.cancel()}}catch(I){r={error:I}}finally{try{p&&!p.done&&(o=v.return)&&o.call(v)}finally{if(r)throw r.error}}$n.clear(),et=void 0;try{for(var w=q(Mt.values()),m=w.next();!m.done;m=w.next()){var S=m.value;S.cancelSelection()}}catch(I){y={error:I}}finally{try{m&&!m.done&&(d=w.return)&&d.call(w)}finally{if(y)throw y.error}}Mt.size&&(Dr=void 0),_r=void 0,Pt=void 0,xn.clear()},ot=function(r){Tr=!0,pn.push(r),pn=pn.slice(-16),X=[]},De=function(r){var o,y,d;return ge(ge(ge({},r.parameters),r.prototypeId?(o=Qe.get(r.prototypeId))===null||o===void 0?void 0:o.parameters:{}),(d=Qe.get((y=r.runtimeId)!==null&&y!==void 0?y:r.id))===null||d===void 0?void 0:d.parameters)};function pa(r,o){var y,d=xn.get(r.id);if(!d||Z!=null&&Z.matches)return o;var v=ae([],K(o),!1),p=d.held?0:ce-((y=d.releasedAt)!==null&&y!==void 0?y:ce),c=d.held?0:Math.min(1,p/d.behavior.springBackSeconds),w=d.held?d.behavior.scaleDown:d.behavior.scaleDown+(1-d.behavior.scaleDown)*(1-Math.pow(1-c,3)),m=De(r);v[4]+=(1-w)*(v[0]*m.width+v[2]*m.height)/2,v[5]+=(1-w)*(v[1]*m.width+v[3]*m.height)/2;for(var S=0;S<4;S++)v[S]*=w;return v}function kt(r){var o,y,d,v,p,c,w,m=r.transform,S=(d=(y=Qe.get((o=r.runtimeId)!==null&&o!==void 0?o:r.id))===null||y===void 0?void 0:y.transform)!==null&&d!==void 0?d:m,I=Le.get((v=r.prototypeId)!==null&&v!==void 0?v:r.id);if(!I)return pa(r,S);var C=R(),M=ae([],K(S),!1);C.landscape&&(M[4]+=I.x-m[4],M[5]+=I.y-m[5],M[0]*=I.scaleX,M[1]*=I.scaleX,M[2]*=I.scaleY,M[3]*=I.scaleY);var g=(p=I.anchor)!==null&&p!==void 0?p:"none";if(g==="none"&&!I.respectSafeArea)return pa(r,M);var P=I.respectSafeArea?eo(C):{left:0,top:0,right:C.width,bottom:C.height},A=De(r),T=(c=I.marginX)!==null&&c!==void 0?c:0,N=(w=I.marginY)!==null&&w!==void 0?w:0,W=Math.abs(M[0])*A.width+Math.abs(M[2])*A.height,B=Math.abs(M[1])*A.width+Math.abs(M[3])*A.height;return g!=="none"?(M[4]=g.endsWith("left")?P.left+T:g.endsWith("right")?P.right-W-T:(P.left+P.right-W)/2,M[5]=g.startsWith("top")?P.top+N:g.startsWith("bottom")?P.bottom-B-N:(P.top+P.bottom-B)/2):(M[4]=Math.max(P.left+T,Math.min(P.right-W-T,M[4])),M[5]=Math.max(P.top+N,Math.min(P.bottom-B-N,M[5]))),pa(r,M)}var Wi=function(r){return(Ir.has(r)?ae([],K(Ir.values()),!1):ae(ae([],K(e.components),!1),K(me),!1)).filter(function(o){return o.parentId===r&&!o.prototype}).sort(function(o,y){return o.order-y.order||(o.id<y.id?-1:o.id>y.id?1:0)})},io=function(){return e.components.filter(function(r){return r.sceneId===Q&&!r.parentId&&!r.prototype}).sort(function(r,o){return r.order-o.order||(r.id<o.id?-1:r.id>o.id?1:0)})},er=function(r){var o,y;if(r.kind==="sceneEnter"&&((o=e.scenes.find(function(d){return d.id===r.sceneId}))===null||o===void 0?void 0:o.role)==="end-card"&&sa!==r.sceneId&&(sa=r.sceneId,(y=ee==null?void 0:ee.notifyGameEnd)===null||y===void 0||y.call(ee)),X.length>=256){ot("Event queue budget exhausted");return}X.push(r)},lt=function(r,o,y,d){var v,p,c,w;return d===void 0&&(d={}),ge(ge({kind:r,componentId:(v=o.prototypeId)!==null&&v!==void 0?v:o.id,selfInstanceId:(p=o.instanceId)!==null&&p!==void 0?p:o.id,instanceId:o.instanceId},y?{otherId:(c=y.prototypeId)!==null&&c!==void 0?c:y.id,otherInstanceId:(w=y.instanceId)!==null&&w!==void 0?w:y.id}:{}),d)};function ma(r){for(var o,y=r;y;y=ze(y.parentId)){var d=Wt.states.get((o=y.instanceId)!==null&&o!==void 0?o:y.id);if(d)return d}}function ao(r){var o,y,d=St("instance-state",(o=r.prototypeId)!==null&&o!==void 0?o:r.id);return d?Wt.initialize((y=r.instanceId)!==null&&y!==void 0?y:r.id,d.parameters):void 0}function Cl(){var r,o,y,d;try{for(var v=q(e.gameplay.filter(function(I){return I.kind==="instance-state"})),p=v.next();!p.done;p=v.next()){var c=p.value;try{for(var w=(y=void 0,q(Hr(V.get(c.componentId)))),m=w.next();!m.done;m=w.next()){var S=m.value;ao(S)}}catch(I){y={error:I}}finally{try{m&&!m.done&&(d=w.return)&&d.call(w)}finally{if(y)throw y.error}}}}catch(I){r={error:I}}finally{try{p&&!p.done&&(o=v.return)&&o.call(v)}finally{if(r)throw r.error}}}function El(r,o,y,d){var v=ma(r);if(v){var p=v.hp;if(o==="tag")v.tag=y==="set"?String(d):v.tag;else{var c=Number(d);if(v[o]=y==="add"?v[o]+c:y==="sub"?v[o]-c:c,!Number.isFinite(v[o])){ot("Instance state range exceeded");return}o==="hp"&&(v.hp=Math.max(0,Math.min(v.maxHp,v.hp)))}p>0&&v.hp<=0&&er(lt("instanceDepleted",r))}}function Li(r,o){var y,d,v;if(!r)return!0;if(r.all)return r.all.every(function(S){return Li(S,o)});if(r.any)return r.any.some(function(S){return Li(S,o)});var p=r.instanceTarget==="other"?o==null?void 0:o.otherInstanceId:(y=o==null?void 0:o.selfInstanceId)!==null&&y!==void 0?y:o==null?void 0:o.instanceId,c=r.instanceField?(d=ze(p))!==null&&d!==void 0?d:ae([],K(Ir.values()),!1).find(function(S){return S.instanceId===p}):void 0,w=r.instanceField?(v=ma(c))===null||v===void 0?void 0:v[r.instanceField]:j[r.variableId],m=r.compareVariableId?j[r.compareVariableId]:r.value;return{eq:function(){return w===m},ne:function(){return w!==m},lt:function(){return w<m},lte:function(){return w<=m},gt:function(){return w>m},gte:function(){return w>=m}}[r.op]()}function oo(r){var o,y,d;Dr=void 0,et=void 0,r||Bt.clear();try{for(var v=q(e.gameplay),p=v.next();!p.done;p=v.next()){var c=p.value;if(c.kind==="match-tile"){var w=V.get(c.componentId);if(r&&w.id!==r&&!Ct(w,r))continue;Qe.delete(w.id),Bt.set(w.id,{row:c.parameters.row,column:c.parameters.column,group:c.parameters.group,sceneId:w.sceneId,boardId:(d=w.parentId)!==null&&d!==void 0?d:w.sceneId})}}}catch(m){o={error:m}}finally{try{p&&!p.done&&(y=v.return)&&y.call(v)}finally{if(o)throw o.error}}}function Pl(){var r,o,y=function(c){var w,m;if(Mt.has(c.componentId))return"continue";var S=c.componentId,I=c.parameters,C=e.gameplay.filter(function(O){return O.kind==="match-tile"&&V.get(O.componentId).parentId===S}).sort(function(O,F){return O.parameters.row-F.parameters.row||O.parameters.column-F.parameters.column}).map(function(O){return ge({id:O.componentId},O.parameters)}),M=new Map;try{for(var g=(w=void 0,q(C)),P=g.next();!P.done;P=g.next()){var A=P.value;if(!M.has(A.group)){var T=V.get(A.id);M.set(A.group,{fill:T.parameters.fill,children:Wi(A.id).filter(function(O){return["native.image.v1","native.text.v1"].includes(O.contract)})})}}}catch(O){w={error:O}}finally{try{P&&!P.done&&(m=g.return)&&m.call(g)}finally{if(w)throw w.error}}to.set(S,M);var N=V.get(C[I.columns].id).transform[5]-V.get(C[0].id).transform[5],W=function(O,F,G){var H,te=G.from,de=te===void 0?O:te,ne=G.progress,he=ne===void 0?0:ne,Ae=G.offsetRows,We=Ae===void 0?0:Ae,He=G.scale,se=He===void 0?1:He,be=G.opacity,Re=be===void 0?1:be,Ee=C[O],Oe=V.get(Ee.id),pe=V.get(C[de].id),gr=M.get(F),Pe=ae([],K(Oe.transform),!1);Pe[4]+=(pe.transform[4]-Oe.transform[4])*he,Pe[5]+=(pe.transform[5]-Oe.transform[5]+We*N)*he,Pe[4]+=(1-se)*(Pe[0]*Oe.parameters.width+Pe[2]*Oe.parameters.height)/2,Pe[5]+=(1-se)*(Pe[1]*Oe.parameters.width+Pe[3]*Oe.parameters.height)/2;for(var ar=0;ar<4;ar++)Pe[ar]*=se;Qe.set(Ee.id,ge(ge({},Qe.get(Ee.id)),{transform:Pe,parameters:ge(ge({},(H=Qe.get(Ee.id))===null||H===void 0?void 0:H.parameters),{fill:gr.fill,opacity:Re})})),Bt.get(Ee.id).group=F;var we=Wi(Ee.id).filter(function(hr){return["native.image.v1","native.text.v1"].includes(hr.contract)});we.forEach(function(hr,Ue){var Ze,Ur,yr=gr.children[Ue];if(!(!yr||yr.contract!==hr.contract)){var rr=(Ze=Qe.get(hr.id))!==null&&Ze!==void 0?Ze:{transform:ae([],K(hr.transform),!1),parameters:{}};hr.contract==="native.image.v1"?rr.assetId=(Ur=yr.assetSlots[0])===null||Ur===void 0?void 0:Ur.assetId:rr.parameters.text=yr.parameters.text,Qe.set(hr.id,rr)}})},B=Vo(ge(ge({},I),{slots:C,paint:W,onEvent:function(O){Dr=void 0,er({kind:O,componentId:S})}}));Mt.set(S,B)};try{for(var d=q(e.gameplay.filter(function(c){return c.kind==="match-board"})),v=d.next();!v.done;v=d.next()){var p=v.value;y(p)}}catch(c){r={error:c}}finally{try{v&&!v.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}}function lo(r){var o,y;Pl();try{for(var d=q(Mt),v=d.next();!v.done;v=d.next()){var p=K(v.value,2),c=p[0],w=p[1];(!r||r===c||Ct(V.get(c),r))&&w.reset()}}catch(m){o={error:m}}finally{try{v&&!v.done&&(y=d.return)&&y.call(d)}finally{if(o)throw o.error}}}function Hr(r){return Qn(r)?ae([],K(Ir.values()),!1).filter(function(o){return o.prototypeId===r.id}):[r]}function Rr(r){var o=De(r);return cr(mr(r),o.width/2,o.height/2)}function zn(r,o,y){var d;y===void 0&&(y="self");var v=V.get(r),p=y==="other"?o.otherInstanceId:(d=o.selfInstanceId)!==null&&d!==void 0?d:o.instanceId,c=!!(v&&Qn(v));if(p!==void 0){if(r){var w=ae([],K(Ir.values()),!1).find(function(m){return m.prototypeId===r&&(m.instanceId===p||m.id===p)});if(w)return w}if(y==="other"||!r)return ze(p);if(c&&typeof p=="string"&&p.startsWith("instance."))return}return v?c?Hr(v)[0]:ze(r):void 0}function qt(r,o,y){var d,v=De(r),p=(d=Qe.get(r.id))!==null&&d!==void 0?d:{transform:ae([],K(r.transform),!1),parameters:{}},c=ae([],K(p.transform),!1),w=r.parentId?mr(ze(r.parentId)):tn(),m=cr(Xt(w),o,y);c[4]=m.x-(c[0]*v.width+c[2]*v.height)/2,c[5]=m.y-(c[1]*v.width+c[3]*v.height)/2,Qe.set(r.id,ge(ge({},p),{transform:c})),r.prototypeId&&(r.transform=ae([],K(c),!1))}function qn(r,o,y){var d,v,p,c;y===void 0&&(y=!1);var w=(d=Qe.get(r.id))!==null&&d!==void 0?d:{transform:ae([],K(r.transform),!1),parameters:{}},m=(c=(p=V.get((v=r.prototypeId)!==null&&v!==void 0?v:r.id))===null||p===void 0?void 0:p.transform)!==null&&c!==void 0?c:r.transform,S=Math.hypot(m[0],m[1])*(y?-1:1),I=Math.hypot(m[2],m[3]),C=o+(y?0:Math.atan2(m[1],m[0])),M=Math.cos(C),g=Math.sin(C),P=ae([],K(w.transform),!1);P[0]=M*S,P[1]=g*S,P[2]=-g*I,P[3]=M*I,Qe.set(r.id,ge(ge({},w),{transform:P}))}function Bn(r,o){var y=Tt.get(r.id);if(y)return y;var d=mr(r),v=De(r),p=cr(d,v.width/2,v.height/2);return y=ge({id:r.id,sourceId:o.componentId,instanceId:r.instanceId,x:p.x,y:p.y,vx:0,vy:0,width:Math.hypot(d[0],d[1])*v.width,height:Math.hypot(d[2],d[3])*v.height,angle:Math.atan2(d[1],d[0]),restElapsed:0,atRest:!0},o.parameters),Tt.set(r.id,y),y}function ui(r,o){var y,d=Kn.get(r.id);if(d)return d;var v=De(r),p=o.parameters;return d=Go(p,{width:v.width,height:v.height,source:r.contract==="native.image.v1"?Ce.get((y=r.assetSlots[0])===null||y===void 0?void 0:y.assetId):void 0,onProgress:function(c){p.progressVariableId&&(j[p.progressVariableId]=c),er(lt("maskProgress",r))},onComplete:function(){return er(lt("maskComplete",r))}}),Kn.set(r.id,d),d}function Tl(r){var o=on.get(r.componentId);return o||(o=Ko(r.parameters),on.set(r.componentId,o)),o}function fo(){var r,o,y,d,v,p,c,w,m,S,I,C,M=new Set,g=[];try{for(var P=q(e.gameplay.filter(function(Pe){return Pe.kind==="physics-body"})),A=P.next();!A.done;A=P.next()){var T=A.value,N=V.get(T.componentId);if(N.sceneId===Q)try{for(var W=(y=void 0,q(Hr(N))),B=W.next();!B.done;B=W.next()){var O=B.value;if(Cr(O)){if(g.length>=64){ot("Physics body budget exhausted");break}var F=Bn(O,T),G=mr(O),H=De(O),te=cr(G,H.width/2,H.height/2);if(M.add(O.id),F.width=Math.hypot(G[0],G[1])*H.width,F.height=Math.hypot(G[2],G[3])*H.height,F.mode!=="dynamic"){var de=On.get(O.id),ne=O.parentId?mr(ze(O.parentId)):tn(),he=(I=de==null?void 0:de.vx)!==null&&I!==void 0?I:0,Ae=(C=de==null?void 0:de.vy)!==null&&C!==void 0?C:0;F.x=te.x,F.y=te.y,F.angle=Math.atan2(G[1],G[0]),F.vx=ne[0]*he+ne[2]*Ae,F.vy=ne[1]*he+ne[3]*Ae}else F.atRest&&(F.x=te.x,F.y=te.y);g.push(F)}}}catch(Pe){y={error:Pe}}finally{try{B&&!B.done&&(d=W.return)&&d.call(W)}finally{if(y)throw y.error}}}}catch(Pe){r={error:Pe}}finally{try{A&&!A.done&&(o=P.return)&&o.call(P)}finally{if(r)throw r.error}}try{for(var We=q(Tt.keys()),He=We.next();!He.done;He=We.next()){var se=He.value;!M.has(se)&&!Ir.has(se)&&Tt.delete(se)}}catch(Pe){v={error:Pe}}finally{try{He&&!He.done&&(p=We.return)&&p.call(We)}finally{if(v)throw v.error}}var be=[];try{for(var Re=q(e.gameplay.filter(function(Pe){return Pe.kind==="capture-zone"})),Ee=Re.next();!Ee.done;Ee=Re.next()){var T=Ee.value,N=V.get(T.componentId);if(N.sceneId===Q)try{for(var Oe=(m=void 0,q(Hr(N))),pe=Oe.next();!pe.done;pe=Oe.next()){var O=pe.value;if(Cr(O)){var G=mr(O),H=De(O),te=cr(G,H.width/2,H.height/2),gr=Math.max(.1,Math.min(Math.hypot(G[0],G[1]),Math.hypot(G[2],G[3])));be.push(ge(ge({id:O.id,sourceId:N.id,instanceId:O.instanceId,x:te.x,y:te.y},T.parameters),{radius:T.parameters.radius*gr}))}}}catch(we){m={error:we}}finally{try{pe&&!pe.done&&(S=Oe.return)&&S.call(Oe)}finally{if(m)throw m.error}}}}catch(Pe){c={error:Pe}}finally{try{Ee&&!Ee.done&&(w=Re.return)&&w.call(Re)}finally{if(c)throw c.error}}return{bodies:ae(ae([],K(g),!1),K(Qt),!1),zones:be}}function Al(r){var o,y,d,v,p,c,w,m=fo(),S=m.bodies,I=m.zones,C=R();wn=[];try{for(var M=q(e.gameplay.filter(function(ne){return ne.kind==="physics-joint"})),g=M.next();!g.done;g=M.next()){var P=g.value,A=V.get(P.componentId);if(A.sceneId===Q){var T=ze(P.parameters.anchorComponentId),N=St("physics-body",A.id);if(!(!T||!N))try{for(var W=(d=void 0,q(Hr(A))),B=W.next();!B.done;B=W.next()){var O=B.value;Bn(O,N);var F=Rr(T),G=P.id+":"+O.id;wn.push(ge(ge({},P.parameters),{id:P.id,key:G,componentId:A.id,bodyId:O.id,anchorId:T.id,x:F.x,y:F.y,broken:Ni.has(G)}))}}catch(ne){d={error:ne}}finally{try{B&&!B.done&&(v=W.return)&&v.call(W)}finally{if(d)throw d.error}}}}}catch(ne){o={error:ne}}finally{try{g&&!g.done&&(y=M.return)&&y.call(M)}finally{if(o)throw o.error}}Ua({bodies:S,zones:I,joints:wn,bounds:{left:0,top:0,right:C.width,bottom:C.height},dt:r,onEvent:function(ne,he,Ae){var We,He,se,be;if(!(ne==="bodyBounce"&&Ae&&he.sourceId===Ae.sourceId&&he.id>Ae.id)){var Re=(We=he.instanceId)!==null&&We!==void 0?We:he.id,Ee=Ae?(He=Ae.instanceId)!==null&&He!==void 0?He:Ae.id:void 0,Oe=ge(ge({kind:ne,componentId:he.sourceId,selfInstanceId:Re},Ee?{otherInstanceId:Ee}:{}),{instanceId:(se=he.instanceId)!==null&&se!==void 0?se:Ae==null?void 0:Ae.instanceId});if(Ae&&(Oe.otherId=Ae.sourceId),er(Oe),ne==="zoneCapture"){var pe=ze(he.id),gr=V.get(Ae.sourceId);if(Ae.hideCaptured&&pe){var Pe=(be=Qe.get(pe.id))!==null&&be!==void 0?be:{transform:ae([],K(pe.transform),!1),parameters:{}};Pe.parameters.visible=!1,Qe.set(pe.id,Pe)}Ae.stopBody&&gr&&pe&&qt(pe,Ae.x,Ae.y)}}}});try{for(var H=q(S),te=H.next();!te.done;te=H.next()){var de=te.value,O=ze(de.id);!O||de.mode!=="dynamic"||(de.spinToRotation&&qn(O,(w=de.angle)!==null&&w!==void 0?w:0),qt(O,de.x,de.y))}}catch(ne){p={error:ne}}finally{try{te&&!te.done&&(c=H.return)&&c.call(H)}finally{if(p)throw p.error}}}function Rl(){var r,o,y,d,v;try{for(var p=q(e.gameplay.filter(function(B){return B.kind==="oscillate"})),c=p.next();!c.done;c=p.next()){var w=c.value,m=V.get(w.componentId);if(m.sceneId===Q)try{for(var S=(y=void 0,q(Hr(m))),I=S.next();!I.done;I=S.next()){var C=I.value,M=On.get(C.id);M||(M={base:ae([],K(kt(C)),!1),vx:0,vy:0},On.set(C.id,M));var g=w.parameters,P=(ce/g.periodSeconds+g.phase)*Math.PI*2,A=Math.sin(P)*g.amplitude,T=Math.cos(P)*g.amplitude*Math.PI*2/g.periodSeconds,N=(v=Qe.get(C.id))!==null&&v!==void 0?v:{parameters:{}},W=ae([],K(M.base),!1);g.axis==="x"?(W[4]+=A,M.vx=T,M.vy=0):(W[5]+=A,M.vy=T,M.vx=0),Qe.set(C.id,ge(ge({},N),{transform:W})),On.set(C.id,M)}}catch(B){y={error:B}}finally{try{I&&!I.done&&(d=S.return)&&d.call(S)}finally{if(y)throw y.error}}}}catch(B){r={error:B}}finally{try{c&&!c.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}}function uo(){var r,o;Kt.clear();var y=function(c){var w=e.gameplay.filter(function(S){return S.kind==="path-gate"&&S.parameters.networkBehaviorId===c.id}),m=il({id:c.id,nodes:c.parameters.nodes,edges:c.parameters.edges,gates:w,onEvent:function(S,I){var C,M=ze(I.componentId),g=(C=M==null?void 0:M.prototypeId)!==null&&C!==void 0?C:I.componentId;er(ge({kind:S,componentId:g,instanceId:M==null?void 0:M.instanceId},I.nodeId?{nodeId:I.nodeId}:{}))}});Kt.set(c.id,m)};try{for(var d=q(e.gameplay.filter(function(c){return c.kind==="path-network"})),v=d.next();!v.done;v=d.next()){var p=v.value;y(p)}}catch(c){r={error:c}}finally{try{v&&!v.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}}function Di(r,o){var y,d,v,p,c,w,m,S,I,C,M,g,P;o===void 0&&(o=!0);var A=0;try{for(var T=q(e.gameplay.filter(function(Pe){return Pe.kind==="path-agent"})),N=T.next();!N.done;N=T.next()){var W=N.value,B=V.get(W.componentId),O=Kt.get(W.parameters.networkBehaviorId);if(!(B.sceneId!==Q||!O))try{for(var F=(v=void 0,q(Hr(B))),G=F.next();!G.done;G=F.next()){var H=G.value;if(++A>64){ot("Path agent budget exhausted");break}var te=O.getAgent(H.id);te||(te=O.addAgent(ge(ge({},W.parameters),{id:H.id,startNode:(M=H.pathStartNode)!==null&&M!==void 0?M:W.parameters.startNode,targetNode:(g=H.pathTargetNode)!==null&&g!==void 0?g:W.parameters.targetNode}))),te.speedMultiplier=Math.max(0,Number(W.parameters.speedMultiplierVariableId?j[W.parameters.speedMultiplierVariableId]:1))}}catch(Pe){v={error:Pe}}finally{try{G&&!G.done&&(p=F.return)&&p.call(F)}finally{if(v)throw v.error}}}}catch(Pe){y={error:Pe}}finally{try{N&&!N.done&&(d=T.return)&&d.call(T)}finally{if(y)throw y.error}}if(o){var de=function(Pe,ar){var we=e.gameplay.find(function(hr){return hr.id===Pe});V.get(we.componentId).sceneId===Q&&ar.tick(r)};try{for(var ne=q(Kt),he=ne.next();!he.done;he=ne.next()){var Ae=K(he.value,2),We=Ae[0],He=Ae[1];de(We,He)}}catch(Pe){c={error:Pe}}finally{try{he&&!he.done&&(w=ne.return)&&w.call(ne)}finally{if(c)throw c.error}}}try{for(var se=q(e.gameplay.filter(function(Pe){return Pe.kind==="path-agent"})),be=se.next();!be.done;be=se.next()){var W=be.value,B=V.get(W.componentId),Re=Kt.get(W.parameters.networkBehaviorId);if(!(B.sceneId!==Q||!Re))try{for(var Ee=(I=void 0,q(Hr(B))),Oe=Ee.next();!Oe.done;Oe=Ee.next()){var H=Oe.value,te=Re.getAgent(H.id);if(te){if(te.orientToPath==="rotate")qn(H,te.heading);else if(te.orientToPath==="flip-x")qn(H,0,te.flipX);else if(te.orientToPath==="iso-4"){var pe=(P=Qe.get(H.id))!==null&&P!==void 0?P:{transform:ae([],K(H.transform),!1),parameters:{}};pe.pathFrame=te.frame,Qe.set(H.id,pe)}var gr=H.parentId?cr(mr(ze(H.parentId)),te.x,te.y):te;qt(H,gr.x,gr.y)}}}catch(we){I={error:we}}finally{try{Oe&&!Oe.done&&(C=Ee.return)&&C.call(Ee)}finally{if(I)throw I.error}}}}catch(Pe){m={error:Pe}}finally{try{be&&!be.done&&(S=se.return)&&S.call(se)}finally{if(m)throw m.error}}}function ga(r){var o,y,d,v,p,c,w,m,S,I,C=new Set;try{for(var M=q(e.gameplay.filter(function(rr){return rr.kind==="value-meter"})),g=M.next();!g.done;g=M.next()){var P=g.value,A=V.get(P.componentId);if(A.sceneId===Q)try{for(var T=(d=void 0,q(Hr(A))),N=T.next();!N.done;N=T.next()){var W=N.value,B=P.parameters,O=B.instanceField?ma(W):void 0,F=B.instanceField==="hp"&&O?O.hp/O.maxHp*(B.max-B.min)+B.min:B.instanceField==="value"&&O?O.value:Number(j[B.variableId]),G=Vn.get(W.id);G||(G={base:ae([],K(kt(W)),!1),value:Number.isFinite(F)?Math.max(B.min,Math.min(B.max,F)):B.min},Vn.set(W.id,G)),C.add(W.id);var H=Math.max(B.min,Math.min(B.max,F)),te=B.smoothingSeconds?1-Math.exp(-r/B.smoothingSeconds):1;G.value+=((Number.isFinite(H)?H:B.min)-G.value)*te;var de=Math.max(0,Math.min(1,(G.value-B.min)/(B.max-B.min))),ne=ae([],K(G.base),!1),he=(S=Qe.get(W.id))!==null&&S!==void 0?S:{parameters:{}},Ae=B.axis==="x"?De(W).width:De(W).height;if(B.axis==="x"?(ne[0]*=de,ne[1]*=de):(ne[2]*=de,ne[3]*=de),B.direction==="negative"){var We=Ae*(1-de);B.axis==="x"?(ne[4]+=G.base[0]*We,ne[5]+=G.base[1]*We):(ne[4]+=G.base[2]*We,ne[5]+=G.base[3]*We)}Qe.set(W.id,ge(ge({},he),{transform:ne}))}}catch(rr){d={error:rr}}finally{try{N&&!N.done&&(v=T.return)&&v.call(T)}finally{if(d)throw d.error}}}}catch(rr){o={error:rr}}finally{try{g&&!g.done&&(y=M.return)&&y.call(M)}finally{if(o)throw o.error}}try{for(var He=q(Vn.keys()),se=He.next();!se.done;se=He.next()){var be=se.value;C.has(be)||Vn.delete(be)}}catch(rr){p={error:rr}}finally{try{se&&!se.done&&(c=He.return)&&c.call(He)}finally{if(p)throw p.error}}try{for(var Re=q(e.gameplay.filter(function(rr){return rr.kind==="camera-follow"})),Ee=Re.next();!Ee.done;Ee=Re.next()){var P=Ee.value,Oe=V.get(P.componentId),H=ze(P.parameters.targetId);if(!(Oe.sceneId!==Q||!H)){var pe=Ri.get(Oe.id);pe||(pe={base:ae([],K(Oe.transform),!1),x:P.parameters.minX,y:P.parameters.minY},Ri.set(Oe.id,pe));var gr=function(Fr,tt){for(var Zr=[],Er=Fr;Er&&Er.id!==tt.id;Er=ze(Er.parentId))Zr.unshift(Er);return Zr.reduce(function(dr,At){return ri(dr,kt(At))},tn())},ne=Ct(H,Oe.id)?gr(H,Oe):mr(H),B=De(H),Pe=cr(ne,B.width/2,B.height/2),ar=R(),we=P.parameters,hr=Math.max(we.minX,we.maxX-ar.width/we.zoom),Ue=Math.max(we.minY,we.maxY-ar.height/we.zoom),Ze=Math.max(we.minX,Math.min(hr,Pe.x-ar.width/(2*we.zoom))),Ur=Math.max(we.minY,Math.min(Ue,Pe.y-ar.height/(2*we.zoom))),te=1-Math.exp(-we.smoothing*r);pe.x+=(Ze-pe.x)*te,pe.y+=(Ur-pe.y)*te;var he=(I=Qe.get(Oe.id))!==null&&I!==void 0?I:{parameters:{}},yr=ae([],K(pe.base),!1);yr[0]*=we.zoom,yr[1]*=we.zoom,yr[2]*=we.zoom,yr[3]*=we.zoom,yr[4]-=pe.x*we.zoom,yr[5]-=pe.y*we.zoom,Qe.set(Oe.id,ge(ge({},he),{transform:yr}))}}}catch(rr){w={error:rr}}finally{try{Ee&&!Ee.done&&(m=Re.return)&&m.call(Re)}finally{if(w)throw w.error}}}function Ol(){return{bodies:ae([],K(Tt.values()),!1).map(function(r){return{id:r.id,sourceId:r.sourceId,x:r.x,y:r.y,vx:r.vx,vy:r.vy,atRest:!!r.atRest,captured:!!r.captured}}),aiming:Fe?{componentId:Fe.sourceId,pointerId:Fe.pointerId,power:Fe.power}:null}}function Ia(){sa=void 0,Jt(),ln.clear(),Ar.clear(),Oi.clear(),Vi.clear(),Wt.reset(),Kn.clear(),on.clear(),Qt=[],wn=[],Nn.clear(),Ni.clear(),ie.clear(),vt=[],at=[],Lr=void 0,Zt=0,$t=!1,ii=0,j=Object.fromEntries(e.variables.map(function(r){return[r.id,r.initial]})),di(),ua=0,Ir.clear(),oi.clear(),Tt.clear(),On.clear(),Vn.clear(),Ri.clear(),Fe=void 0,me=[],le=[],Ie=[],Qe.clear(),oo(),Rn.clear(),ve.clear(),Ve.clear(),X=[],ce=0,Se=0,$e=0,Tr=!1,Xe=0,Q=e.base.startScene,_r=void 0,Pt=void 0,Ut=void 0,wt=void 0,k||(Cl(),lo(),uo(),Di(0,!1),Ma(),ga(0),er({kind:"sceneEnter",sceneId:Q}))}function xa(){var r,o;if(!(!Ke||Ke.state!=="running"||!Zn.size)){var y=ae([],K(Zn.values()),!1);Zn.clear();try{for(var d=q(y),v=d.next();!v.done;v=d.next()){var p=v.value;so(p)}}catch(c){r={error:c}}finally{try{v&&!v.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}}}function vi(r){if(r===void 0&&(r=!1),!Ke)return Promise.resolve(void 0);if(Ke.state==="running")return Promise.resolve().then(xa),Promise.resolve(Ke);if(!bt||r){var o=Ke,y=Promise.resolve().then(function(){return o.resume()}).then(function(){if(o.state==="running")return xa(),o}).catch(function(){}).finally(function(){bt===y&&(bt=void 0)});bt=y}return bt}function ba(){var r,o,y=ae([],K(Ai.values()),!1),d=y.some(function(I){return I.bus==="voice"}),v=y.some(function(I){return I.bus==="stinger"}),p=v?.2:d?.25:1;try{for(var c=q(y),w=c.next();!w.done;w=c.next()){var m=w.value,S=m.volume*va*(m.bus==="music"?p:1);m.gain.gain.setTargetAtTime?m.gain.gain.setTargetAtTime(S,Ke.currentTime,.04):m.gain.gain.value=S}}catch(I){r={error:I}}finally{try{w&&!w.done&&(o=c.return)&&o.call(c)}finally{if(r)throw r.error}}}function vo(r,o,y){var d,v=(d=y.parameters.bus)!==null&&d!==void 0?d:"sfx";r.connect(o),o.connect(Ke.destination),In.add(r),Ai.set(r,{gain:o,bus:v,volume:y.parameters.volume}),r.onended=function(){In.delete(r),Ai.delete(r),y.parameters.loop&&Gn.delete(y.id),ba()},ba()}function so(r){return $f(this,void 0,void 0,function(){var o,y,d,v,p,c,w,m,S,I,C,M,g,P,A,T,N,W,B,O,F,G,H,te,de,ne,he,Ae,We,He;return Kf(this,function(se){switch(se.label){case 0:return In.size>=32?[2]:Ke?(o=Ke,y=li,d=(te=r.parameters.cooldownMs)!==null&&te!==void 0?te:45,v=o.currentTime,d>0&&v-((de=fa.get(r.id))!==null&&de!==void 0?de:-1/0)<d/1e3?[2]:r.parameters.loop&&Gn.has(r.id)?[2]:(p=V.get(r.componentId),c=Te.get((ne=p==null?void 0:p.assetSlots[0])===null||ne===void 0?void 0:ne.assetId),w=(c==null?void 0:c.mime)==="audio/wav"||(c==null?void 0:c.mime)==="audio/mpeg",!w&&r.parameters.allowSynthFallback===!1?(ua++,[2]):(fa.set(r.id,v),m=o.state!=="running",m?[4,vi()]:[3,2]))):(r.parameters.loop&&Zn.set(r.id,r),[2]);case 1:m=!se.sent(),se.label=2;case 2:if(m)return r.parameters.loop&&Zn.set(r.id,r),[2];if(Ke!==o||o.state!=="running"||y!==li||In.size>=32)return[2];if(S=(he=da.get(r.id))!==null&&he!==void 0?he:0,I=[0,-.5,.5,-1,1],C=((Ae=r.parameters.pitchJitter)!==null&&Ae!==void 0?Ae:0)*I[S%I.length],M=Number((We=j[r.parameters.pitchVariableId])!==null&&We!==void 0?We:0),g=Math.max(-12,Math.min(12,C+M*((He=r.parameters.pitchStep)!==null&&He!==void 0?He:0))),P=Math.pow(2,g/12),da.set(r.id,S+1),!w)return[3,8];r.parameters.loop&&Gn.add(r.id),se.label=3;case 3:if(se.trys.push([3,6,,7]),A=ro.get(c.hash),A)return[3,5];for(T=atob(c.data),N=new Uint8Array(T.length),W=0;W<T.length;W++)N[W]=T.charCodeAt(W);return[4,new Promise(function(be,Re){var Ee=o.decodeAudioData(N.buffer,be,Re);Ee&&typeof Ee.then=="function"&&Ee.then(be,Re)})];case 4:A=se.sent(),ro.set(c.hash,A),se.label=5;case 5:return Ke!==o||o.state!=="running"||y!==li||In.size>=32?(r.parameters.loop&&y===li&&Gn.delete(r.id),[2]):(B=o.createBufferSource(),O=o.createGain(),B.buffer=A,B.loop=r.parameters.loop,B.playbackRate&&(B.playbackRate.value=P),O.gain.value=r.parameters.volume,vo(B,O,r),B.start(),[3,7]);case 6:return F=se.sent(),Gn.delete(r.id),ot("Audio decode failed"),[3,7];case 7:return[2];case 8:return G=o.createOscillator(),H=o.createGain(),G.frequency.value=r.parameters.frequency*P,G.type="sine",H.gain.setValueAtTime(r.parameters.volume,o.currentTime),H.gain.exponentialRampToValueAtTime(.001,o.currentTime+r.parameters.seconds),vo(G,H,r),G.start(),G.stop(o.currentTime+r.parameters.seconds),[2]}})})}function Vl(r,o){for(var y=ae([],K(Bt.values()),!1).filter(function(I){return I.boardId===r}),d=function(I,C){var M;return(M=y.find(function(g){return g.row===I&&g.column===C}))===null||M===void 0?void 0:M.group},v=function(I){for(var C=function(P){var A=d(I,P);if(A&&A===d(I,P+1)&&A===d(I,P+2)&&o.some(function(T){return T.row===I&&T.column>=P&&T.column<=P+2}))return{value:!0}},M=0;M<14;M++){var g=C(M);if(typeof g=="object")return g}},p=0;p<16;p++){var c=v(p);if(typeof c=="object")return c.value}for(var w=function(I){for(var C=function(P){var A=d(P,I);if(A&&A===d(P+1,I)&&A===d(P+2,I)&&o.some(function(T){return T.column===I&&T.row>=P&&T.row<=P+2}))return{value:!0}},M=0;M<14;M++){var g=C(M);if(typeof g=="object")return g}},m=0;m<16;m++){var S=w(m);if(typeof S=="object")return S.value}return!1}function Nl(r){var o,y,d,v=Bt.get(r.id);if(!(!v||v.sceneId!==Q||!De(r).enabled||!Cr(r))){var p=Mt.get(r.parentId);if(p){Dr=p.select(r.id);return}if(Dr===r.id){Dr=void 0;return}var c=Bt.get(Dr);if(!c||c.sceneId!==Q||c.boardId!==v.boardId){Dr=r.id;return}var w=V.get(Dr);if(Math.abs(c.row-v.row)+Math.abs(c.column-v.column)!==1){Dr=r.id;return}if(c.group===v.group){Dr=void 0,er({kind:"invalidMatch",componentId:(o=r.parentId)!==null&&o!==void 0?o:r.id});return}var m=c.row,S=c.column,I=v.row,C=v.column,M=ae([],K(kt(w)),!1),g=ae([],K(kt(r)),!1);if(c.row=I,c.column=C,v.row=m,v.column=S,Vl(v.boardId,[c,v])){var P=function(A,T){var N,W=(N=Qe.get(A.id))!==null&&N!==void 0?N:{transform:ae([],K(kt(A)),!1),parameters:{}};W.transform=ae([],K(W.transform),!1),W.transform[4]=T[4],W.transform[5]=T[5],Qe.set(A.id,W)};P(w,g),P(r,M),Dr=void 0,er({kind:"validMatch",componentId:(y=r.parentId)!==null&&y!==void 0?y:r.id})}else c.row=m,c.column=S,v.row=I,v.column=C,Dr=void 0,er({kind:"invalidMatch",componentId:(d=r.parentId)!==null&&d!==void 0?d:r.id})}}function wa(r){var o,y,d,v,p=[],c=ft(r,mr(r)),w=Rr(r),m=St("drag",(d=r.prototypeId)!==null&&d!==void 0?d:r.id),S=function(g){var P,A,T=V.get(g.componentId),N=g.parameters;if(T.sceneId!==Q)return"continue";var W=function(G){if(G.id===r.id||Ct(G,r.id)||!Cr(G))return"continue";var H=ft(G,mr(G)),te=Rr(G),de=Math.hypot(te.x-w.x,te.y-w.y),ne=N.radiusPx>0?de<=N.radiusPx:c.left<H.right&&c.right>H.left&&c.top<H.bottom&&c.bottom>H.top;if(!ne)return"continue";p.push(ge({id:G.id,c:G,sourceId:T.id,paintOrder:Yt.findIndex(function(he){return he.c.id===G.id}),distance:de,itemTarget:e.gameplay.some(function(he){return he.kind==="drag"&&he.componentId===T.id})},N))};try{for(var B=(P=void 0,q(Hr(T))),O=B.next();!O.done;O=B.next()){var F=O.value;W(F)}}catch(G){P={error:G}}finally{try{O&&!O.done&&(A=B.return)&&A.call(B)}finally{if(P)throw P.error}}};try{for(var I=q(e.gameplay.filter(function(g){return g.kind==="drop-zone"})),C=I.next();!C.done;C=I.next()){var M=C.value;S(M)}}catch(g){o={error:g}}finally{try{C&&!C.done&&(y=I.return)&&y.call(I)}finally{if(o)throw o.error}}return{zones:p,tag:(v=m==null?void 0:m.parameters.tag)!==null&&v!==void 0?v:""}}function Ma(r){var o,y,d=r?[r]:e.gameplay.filter(function(C){return C.kind==="drag"}).flatMap(function(C){return Hr(V.get(C.componentId))});try{for(var v=q(d),p=v.next();!p.done;p=v.next()){var c=p.value;if(!(!c||!Cr(c)||Ar.zoneOf(c.id))){var w=wa(c),m=w.zones,S=w.tag,I=ea({itemId:c.id,tag:S,zones:m.filter(function(C){return!C.itemTarget}),occupancy:Ar});(I==null?void 0:I.kind)==="accept"&&Ar.place(c.id,I.zone.id)}}}catch(C){o={error:C}}finally{try{p&&!p.done&&(y=v.return)&&y.call(v)}finally{if(o)throw o.error}}}function Wn(r,o,y){y===void 0&&(y=.18),r&&$n.to(r.id,Rr(r),o,y)}function Sa(r,o,y,d){var v,p,c=d!=null?d:y==null?void 0:y.c;er(ge(ge({},lt(r,o,c,ge({},y?{otherId:y.sourceId}:{}))),{instanceId:(v=o.instanceId)!==null&&v!==void 0?v:(p=y==null?void 0:y.c)===null||p===void 0?void 0:p.instanceId}))}function zl(r){var o,y,d,v,p,c,w;if(!Ge||Ge.pointerId!==r.pointerId)return!1;var m=Ge,S=ze(m.targetId),I=m.b.parameters;Ge=void 0,bn=void 0;try{!((o=t.hasPointerCapture)===null||o===void 0)&&o.call(t,r.pointerId)&&((y=t.releasePointerCapture)===null||y===void 0||y.call(t,r.pointerId))}catch{}if(!S)return!0;var C=wa(S),M=C.zones,g=C.tag,P=ea({itemId:S.id,tag:g,zones:M,occupancy:Ar}),A=m.origin,T=m.originZone;if(!P)return Sa("dragReject",S,void 0,void 0),I.snapBack&&(T&&Ar.place(S.id,T),Wn(S,A,(d=I.snapBackSeconds)!==null&&d!==void 0?d:.18)),!0;var N=P.zone,W=P.occupantId?ze(P.occupantId):void 0;return P.kind==="reject"?(Sa("dragReject",S,N,W),I.snapBack&&(T&&Ar.place(S.id,T),Wn(S,A,(v=I.snapBackSeconds)!==null&&v!==void 0?v:.18)),!0):(P.kind==="accept"?(Ar.place(S.id,N.id),N.snapMode==="center"&&Wn(S,Rr(N.c),(p=I.snapBackSeconds)!==null&&p!==void 0?p:.18)):P.kind==="swap"&&W&&(Ar.place(S.id,N.id),T?Ar.place(W.id,T):Ar.release(W.id),Wn(S,Rr(N.c),(c=I.snapBackSeconds)!==null&&c!==void 0?c:.18),Wn(W,A,(w=I.snapBackSeconds)!==null&&w!==void 0?w:.18)),Sa("dragDrop",S,N,P.kind==="accept"?N.c:W),!0)}function Bl(r){var o,y,d,v,p;$n.tick(r,function(P,A){var T=ze(P);T&&qt(T,A.x,A.y)});try{for(var c=q(ae([],K(Ar.itemZone.keys()),!1)),w=c.next();!w.done;w=c.next()){var m=w.value,S=ze(m);(!S||!Cr(S))&&Ar.release(m)}}catch(P){o={error:P}}finally{try{w&&!w.done&&(y=c.return)&&y.call(c)}finally{if(o)throw o.error}}if(xr)try{for(var I=q(xr.holds),C=I.next();!C.done;C=I.next()){var M=C.value,g=M.charge.tick(r);g!==j[M.behavior.parameters.variableId]&&(j[M.behavior.parameters.variableId]=g,er({kind:"variableChange",variableId:M.behavior.parameters.variableId,instanceId:M.c.instanceId,selfInstanceId:(p=M.c.instanceId)!==null&&p!==void 0?p:M.c.id}))}}catch(P){d={error:P}}finally{try{C&&!C.done&&(v=I.return)&&v.call(I)}finally{if(d)throw d.error}}}function co(r,o){var y,d,v,p,c=o.targetMode;if(c==="pointer")return ge({},fi);if(c==="component"){var w=ze(o.targetComponentId);return w?Rr(w):void 0}if(c==="nearest-team"){var m=Rr(r),S=[],I=o.team,C=(v=o.maxRangePx)!==null&&v!==void 0?v:0;try{for(var M=q(Wt.states),g=M.next();!g.done;g=M.next()){var P=K(g.value,2),A=P[0],T=P[1],w=ze(A);w&&Cr(w)&&S.push(ge(ge({id:A},Rr(w)),{team:T.team}))}}catch(N){y={error:N}}finally{try{g&&!g.done&&(d=M.return)&&d.call(M)}finally{if(y)throw y.error}}return Xo(m,S,I,C,(p=r.instanceId)!==null&&p!==void 0?p:r.id)}}function Wl(r){var o,y,d,v,p;try{for(var c=q(e.gameplay.filter(function(F){return F.kind==="steer"})),w=c.next();!w.done;w=c.next()){var m=w.value,S=V.get(m.componentId),I=m.parameters;if(S.sceneId===Q)try{for(var C=(d=void 0,q(Hr(S))),M=C.next();!M.done;M=C.next()){var g=M.value;if(Cr(g)){var P=co(g,I);if(P){var A=Rr(g),T=P.x-A.x,N=P.y-A.y;if(!(I.maxRangePx>0&&Math.hypot(T,N)>I.maxRangePx)){var W=Math.atan2(N,T);I.mode==="flee"?W+=Math.PI:I.mode==="orbit"&&(W+=Math.PI/2);var B=(p=Wt.headings.get(g.id))!==null&&p!==void 0?p:W,O=Uo(B,W,I.turnRateDegPerSec*Math.PI/180*r);Wt.headings.set(g.id,O),qt(g,A.x+Math.cos(O)*I.speed*r,A.y+Math.sin(O)*I.speed*r),I.orientToVelocity!==!1&&qn(g,O)}}}}}catch(F){d={error:F}}finally{try{M&&!M.done&&(v=C.return)&&v.call(C)}finally{if(d)throw d.error}}}}catch(F){o={error:F}}finally{try{w&&!w.done&&(y=c.return)&&y.call(c)}finally{if(o)throw o.error}}}function ka(r,o,y,d){var v;if(me.length>=128){ot("Instance budget exhausted");return}var p=V.get(r),c=function(I){return 1+e.components.filter(function(C){return C.parentId===I}).reduce(function(C,M){return C+c(M.id)},0)};if(Ir.size+c(p.id)>4096){ot("Runtime node budget exhausted");return}var w="instance."+ ++$e;function m(I,C){var M,g,P=I.id===p.id?w:w+":"+I.id,A=ge(ge({},I),{id:P,runtimeId:P,instanceId:w,prototypeId:I.id,prototype:!1,parentId:C,transform:ae([],K(I.transform),!1),spawnTime:ce});Ir.set(P,A);try{for(var T=q(e.components.filter(function(B){return B.parentId===I.id})),N=T.next();!N.done;N=T.next()){var W=N.value;m(W,P)}}catch(B){M={error:B}}finally{try{N&&!N.done&&(g=T.return)&&g.call(T)}finally{if(M)throw M.error}}return A}var S=m(p,void 0);return S.transform[4]=o,S.transform[5]=y,d&&(S.pathStartNode=d.startNode,S.pathTargetNode=d.targetNode,S.parentId=(v=e.gameplay.find(function(I){return I.id===d.networkBehaviorId}))===null||v===void 0?void 0:v.componentId),me.push(S),ao(S),Ma(S),d&&Di(0,!1),S}function Ll(r,o,y){var d,v,p,c,w,m,S,I,C,M,g,P,A,T,N,W,B,O,F,G,H,te,de,ne,he,Ae,We,He,se,be,Re;if(++Vr>1024){ot("Action budget exhausted");return}if(r.kind==="add"||r.kind==="set"){var Ee=j[r.variableId],Oe=r.kind==="add"?Ee+r.value:r.value;if(typeof Oe=="number"&&(!Number.isFinite(Oe)||Math.abs(Oe)>1e12)){ot("Variable range exceeded");return}j[r.variableId]=Oe,Ee!==Oe&&er({kind:"variableChange",variableId:r.variableId,instanceId:o.instanceId})}else if(r.kind==="setComponent"||r.kind==="setAsset"){var pe=ze(r.componentId);if(!pe)return;var gr=(C=Qe.get(pe.id))!==null&&C!==void 0?C:{transform:ae([],K(pe.transform),!1),parameters:{}};r.kind==="setComponent"?gr.parameters[r.key]=r.valueVariableId?j[r.valueVariableId]:r.value:gr.assetId=r.assetId,Qe.set(pe.id,gr),r.kind==="setComponent"&&r.key==="visible"&&r.value===!1&&(Ar.release(pe.id),$n.cancel(pe.id))}else if(r.kind==="resetMatch")oo(r.componentId),lo(r.componentId);else if(r.kind==="clearStrokes")(M=on.get(r.componentId))===null||M===void 0||M.clear(),Qt=Qt.filter(function(Jr){return Jr.owner!==r.componentId});else if(r.kind==="resetMask"){var pe=ze(r.componentId),Pe=St("erase-mask",r.componentId);pe&&Pe&&ui(pe,Pe).reset()}else if(r.kind==="copyMatchAsset"){var ar=(g=Mt.get(r.boardId))===null||g===void 0?void 0:g.snapshot().lastMatch,we=V.get(r.componentId),hr=ar&&((A=(P=to.get(r.boardId))===null||P===void 0?void 0:P.get(ar.group))===null||A===void 0?void 0:A.children.find(function(Jr){return Jr.contract==="native.image.v1"}));if(ar&&hr){var Ue=V.get(ar.from),Ze=cr(mr(Ue),Ue.parameters.width/2,Ue.parameters.height/2),Ur=we.parentId?mr(V.get(we.parentId)):tn(),yr=cr(Xt(Ur),Ze.x,Ze.y),rr=(T=Qe.get(we.id))!==null&&T!==void 0?T:{transform:ae([],K(we.transform),!1),parameters:{}};rr.transform=ae([],K(rr.transform),!1),rr.transform[4]=yr.x-we.parameters.width/2,rr.transform[5]=yr.y-we.parameters.height/2,rr.assetId=(N=hr.assetSlots[0])===null||N===void 0?void 0:N.assetId,Qe.set(we.id,rr)}}else if(r.kind==="hintMatch")Dr=void 0,(W=Mt.get(r.componentId))===null||W===void 0||W.showHint();else if(r.kind==="spawn")ka(r.prototypeId,r.x,r.y);else if(r.kind==="spawnAt"){var Yr=(r.at==="self"||r.at==="midpoint")&&(o.selfInstanceId!==void 0||o.instanceId!==void 0)?ze((B=o.selfInstanceId)!==null&&B!==void 0?B:o.instanceId):zn(r.targetComponentId,o,"self"),st=(r.at==="other"||r.at==="midpoint")&&o.otherInstanceId!==void 0?ze(o.otherInstanceId):void 0,we=r.at==="other"?st:Yr;if(r.at==="pointer"||(r.at==="midpoint"?Yr&&st:we))for(var jt=Yr?Rr(Yr):void 0,ct=st?Rr(st):void 0,Ze=r.at==="pointer"?fi:r.at==="midpoint"?{x:(jt.x+ct.x)/2,y:(jt.y+ct.y)/2}:Rr(we),Gr=V.get(r.prototypeId),Fr=Math.max(0,Math.min(16,Math.floor(r.countVariableId?Number(j[r.countVariableId]):(O=r.count)!==null&&O!==void 0?O:1))),tt=0;tt<Fr;tt++){var Zr=r.jitterX?(Wt.rng.next()*2-1)*r.jitterX:0,Er=r.jitterY?(Wt.rng.next()*2-1)*r.jitterY:0;ka(r.prototypeId,Ze.x+r.offsetX+Zr-Gr.parameters.width/2,Ze.y+r.offsetY+Er-Gr.parameters.height/2)}}else if(r.kind==="random"){var Ee=j[r.variableId],Oe=Wt.rng.between(r.min,r.max,r.integer===!0);j[r.variableId]=Oe,Ee!==Oe&&er({kind:"variableChange",variableId:r.variableId,instanceId:o.instanceId})}else if(r.kind==="modifyInstanceState"){var pe=r.target==="component"?ze(r.componentId):zn(r.componentId,o,r.target);pe&&El(pe,r.field,r.op,r.variableId?j[r.variableId]:r.value)}else if(r.kind==="launchToward"){var Ue=V.get(r.componentId),dr=Hr(Ue),At=(F=o.selfInstanceId)!==null&&F!==void 0?F:o.instanceId,pe=Ue.prototype?(G=dr.find(function(ir){return ir.instanceId===At||ir.id===At}))!==null&&G!==void 0?G:dr[dr.length-1]:(H=zn(r.componentId,o,"self"))!==null&&H!==void 0?H:ze(r.componentId),Pe=St("physics-body",r.componentId),Je=pe&&Bn(pe,Pe);if(!Je)return;var $r=void 0;if(r.targetMode==="angle-variable")$r=Number(j[r.angleVariableId])*Math.PI/180;else{var we=co(pe,r);if(!we)return;var Ze=Rr(pe);$r=Math.atan2(we.y-Ze.y,we.x-Ze.x)}var tr=Number(r.speedVariableId?j[r.speedVariableId]:r.speed);if(!Number.isFinite(tr)){ot("Launch speed invalid");return}Je.vx=Math.cos($r)*tr,Je.vy=Math.sin($r)*tr,Je.atRest=!1,Je.restElapsed=0,Je.captured=!1,Je.exited=!1,r.orientToVelocity!==!1&&qn(pe,$r),er(lt("launch",pe))}else if(r.kind==="moveToComponent"){var qe=V.get(r.targetComponentId),pe=zn(r.componentId,o,(te=r.target)!==null&&te!==void 0?te:"self"),we=qe&&Qn(qe)?(de=zn(r.targetComponentId,o,r.target==="other"?"self":"other"))!==null&&de!==void 0?de:Hr(qe)[0]:ze(r.targetComponentId);pe&&we&&Wn(pe,Rr(we),r.seconds)}else if(r.kind==="returnToOrigin"){var pe=zn(r.componentId,o,"self"),Me=pe&&Oi.get(pe.id);pe&&Me&&Wn(pe,Me,r.seconds)}else if(r.kind==="spawnOnPath")ka(r.prototypeId,0,0,{startNode:r.startNode,targetNode:r.targetNode,networkBehaviorId:r.networkBehaviorId});else if(["setVelocity","applyImpulse","stopBody"].includes(r.kind)){var br=V.get(r.componentId),Qr=o.instanceId?ae([],K(Ir.values()),!1).filter(function(ur){return ur.instanceId===o.instanceId&&ur.prototypeId===br.id}):Hr(br),Pe=St("physics-body",br.id);try{for(var dt=q(Qr),pt=dt.next();!pt.done;pt=dt.next()){var pe=pt.value,Je=Bn(pe,Pe);r.kind==="setVelocity"?(Je.vx=r.vxVariableId?j[r.vxVariableId]:r.vx,Je.vy=r.vyVariableId?j[r.vyVariableId]:r.vy):r.kind==="applyImpulse"?(Je.vx+=r.vxVariableId?j[r.vxVariableId]:r.ix,Je.vy+=r.vyVariableId?j[r.vyVariableId]:r.iy):(Je.vx=0,Je.vy=0,Je.atRest=!0),Je.captured=!1,Je.exited=!1,Je.restElapsed=0,r.kind!=="stopBody"&&(Je.atRest=!1)}}catch(ur){d={error:ur}}finally{try{pt&&!pt.done&&(v=dt.return)&&v.call(dt)}finally{if(d)throw d.error}}}else if(r.kind==="setPosition"){var or=V.get(r.componentId),Qr=o.instanceId?ae([],K(Ir.values()),!1).filter(function(Kr){return Kr.instanceId===o.instanceId&&Kr.prototypeId===or.id}):Hr(or),Pe=St("physics-body",or.id);try{for(var ht=q(Qr),Et=ht.next();!Et.done;Et=ht.next()){var pe=Et.value,Je=Bn(pe,Pe);Je.x=r.xVariableId?j[r.xVariableId]:r.x,Je.y=r.yVariableId?j[r.yVariableId]:r.y,Je.vx=0,Je.vy=0,Je.captured=!1,Je.exited=!1,Je.atRest=!0,qt(pe,Je.x,Je.y)}}catch(Kr){p={error:Kr}}finally{try{Et&&!Et.done&&(c=ht.return)&&c.call(ht)}finally{if(p)throw p.error}}}else if(r.kind==="setPathEdge")(ne=Kt.get(r.behaviorId))===null||ne===void 0||ne.setEdge(r.edgeId,r.enabled,r.cost);else if(r.kind==="setPathGate")(Ae=Kt.get((he=e.gameplay.find(function(Jr){return Jr.id===r.behaviorId}))===null||he===void 0?void 0:he.parameters.networkBehaviorId))===null||Ae===void 0||Ae.setGate(r.behaviorId,r.mode,r.holdSeconds);else if(r.kind==="setPathTarget"){var Sn=V.get(r.componentId),Pe=St("path-agent",Sn.id),Rt=Kt.get(Pe.parameters.networkBehaviorId);try{for(var mt=q(o.instanceId?ae([],K(Ir.values()),!1).filter(function(ur){return ur.instanceId===o.instanceId&&ur.prototypeId===Sn.id}):Hr(Sn)),Ot=mt.next();!Ot.done;Ot=mt.next()){var pe=Ot.value;pe.pathTargetNode=r.targetNode,Rt==null||Rt.setTarget(pe.id,r.targetNode)}}catch(ur){w={error:ur}}finally{try{Ot&&!Ot.done&&(m=mt.return)&&m.call(mt)}finally{if(w)throw w.error}}}else if(r.kind==="compute"){var wr=Number(j[r.variableId]),nt=r.operandVariableId!==void 0?Number(j[r.operandVariableId]):r.value;if(["div","mod"].includes(r.op)&&nt===0){ot("Division by zero");return}var Oe={add:function(){return wr+nt},sub:function(){return wr-nt},mul:function(){return wr*nt},div:function(){return nt===0?wr:wr/nt},mod:function(){return nt===0?wr:wr%nt},min:function(){return Math.min(wr,nt)},max:function(){return Math.max(wr,nt)},set:function(){return nt},floor:function(){return Math.floor(wr)},ceil:function(){return Math.ceil(wr)},abs:function(){return Math.abs(wr)},clamp:function(){return Math.max(r.min,Math.min(r.max,wr))}}[r.op]();if(r.round&&(Oe=Math.round(Oe)),!Number.isFinite(Oe)||Math.abs(Oe)>1e12){ot("Variable range exceeded");return}var Ee=j[r.variableId];j[r.variableId]=Oe,Ee!==Oe&&er({kind:"variableChange",variableId:r.variableId,instanceId:o.instanceId})}else if(r.kind==="despawn"){var Yr=(We=o.selfInstanceId)!==null&&We!==void 0?We:o.instanceId;r.target==="other"?Bi(o.otherInstanceId):r.target==="both"?(Bi(Yr),Bi(o.otherInstanceId)):Bi(Yr)}else if(r.kind==="changeScene")wt=r.sceneId;else if(r.kind==="restart")(He=ee==null?void 0:ee.notifyGameRetry)===null||He===void 0||He.call(ee),wt="__restart";else if(r.kind==="cameraShake")Z!=null&&Z.matches||(Lr={intensity:r.intensity,seconds:r.seconds,elapsed:0});else if(r.kind==="screenFlash")at.push({color:r.color,opacity:r.opacity,seconds:r.seconds,elapsed:0}),at.length>8&&at.shift();else if(r.kind==="floatingText"){var yt=V.get(r.componentId),Ue=o.instanceId?(se=ae([],K(Ir.values()),!1).find(function(Kr){return Kr.instanceId===o.instanceId&&Kr.prototypeId===r.componentId}))!==null&&se!==void 0?se:yt:(be=ze(r.componentId))!==null&&be!==void 0?be:yt,we=(Ue==null?void 0:Ue.sceneId)===Q?Ue:yt;if(we){var Ze=void 0;if(!Ze){var Lt=De(we);Ze=cr(mr(we),Lt.width/2,Lt.height/2)}vt.push({x:Ze.x,y:Ze.y,text:r.text.replace(/\{\{([a-z0-9_.-]+)\}\}/g,function(ir,Br){var Ye;return String((Ye=j[Br])!==null&&Ye!==void 0?Ye:"")}),color:r.color,fontSize:r.fontSize,risePx:r.risePx,seconds:r.seconds,elapsed:0}),vt.length>32&&vt.shift()}}else if(r.kind==="store")o.kind==="click"&&o.pointerId!==void 0&&!Gt&&(Gt={pointerId:o.pointerId,targetId:o.targetId,condition:y},(Re=t.setPointerCapture)===null||Re===void 0||Re.call(t,o.pointerId));else if(r.behaviorId){var Nr=e.gameplay.find(function(Jr){return Jr.id===r.behaviorId});if(r.kind==="playAudio")so(Nr);else if(r.kind==="animate"){var dn=V.get(Nr.componentId),Qr=Qn(dn)?ae([],K(Ir.values()),!1).filter(function(ur){return ur.prototypeId===dn.id&&(!o.instanceId||ur.instanceId===o.instanceId)}):[dn],zr=function(ur){var Kr=Nr.id+":"+ur.id;Ie=Ie.filter(function(Br){return Br.id!==Kr});var ir=ge({},Nr.parameters);ir.fromCurrent&&(ir.from=ir.property==="opacity"?De(ur).opacity:kt(ur)[ir.property==="x"?4:5]),Ie.push(ge(ge({},Nr),{parameters:ir,id:Kr,behaviorId:Nr.id,targetId:ur.id,elapsed:0,baseTransform:ae([],K(ur.transform),!1)}))};try{for(var Mr=q(Qr),nr=Mr.next();!nr.done;nr=Mr.next()){var we=nr.value;zr(we)}}catch(ur){S={error:ur}}finally{try{nr&&!nr.done&&(I=Mr.return)&&I.call(Mr)}finally{if(S)throw S.error}}}else r.kind==="stopAnimation"?Ie=Ie.filter(function(Jr){return Jr.behaviorId!==Nr.id}):r.kind==="emit"&&Dl(Nr,o)}}function Dl(r,o){var y,d,v,p,c,w,m=r.parameters,S=m.shape==="pixel-confetti",I=m.shape==="confetti",C=S||I;if(!(C&&(Z!=null&&Z.matches))){if(le.length+m.count>256){ot("Particle budget exhausted");return}if(S&&m.coverage==="screen"){le.push.apply(le,ae([],K(ll(m)),!1));return}if(I&&m.coverage==="screen"){le.push.apply(le,ae([],K(dl(m)),!1));return}for(var M=V.get(r.componentId),g=o.instanceId&&(y=ae([],K(Ir.values()),!1).find(function(G){return G.instanceId===o.instanceId&&G.prototypeId===M.id}))!==null&&y!==void 0?y:M,P=kt(g),A,T=ze(g.parentId);T;T=ze(T.parentId)){if(C&&T.contract==="native.group.v1"&&De(T).clip){A=T.id;break}P=ri(kt(T),P)}var N=De(g),W=m.origin==="anchor"?cr(P,0,0):C||m.origin==="center"?cr(P,N.width/2,N.height/2):{x:P[4]+g.parameters.width/2,y:P[5]+g.parameters.height/2};if(S){le.push.apply(le,ae([],K($a(m,W,A)),!1));return}if(I){le.push.apply(le,ae([],K(Ka(m,W,A)),!1));return}for(var B=0;B<m.count;B++){var O=((d=m.spread)!==null&&d!==void 0?d:360)===360?B*2.399963:-Math.PI/2+((B+.5)/m.count-.5)*((v=m.spread)!==null&&v!==void 0?v:360)*Math.PI/180,F=m.speed*(.5+B%7/14);le.push(ge(ge({},W),{vx:Math.cos(O)*F,vy:Math.sin(O)*F,life:(p=m.lifetime)!==null&&p!==void 0?p:.7,gravity:(c=m.gravity)!==null&&c!==void 0?c:250,color:m.color,shape:(w=m.shape)!==null&&w!==void 0?w:"circle"}))}}}function fn(){for(var r=function(){var o,y,d,v,p,c,w=X.shift();Or++;var m=function(O){return O===void 0||!!ze(O)||ae([],K(Ir.values()),!1).some(function(F){return F.instanceId===O})};if(!m(w.selfInstanceId)||!m(w.otherInstanceId)||["contactBegin","boundaryExit"].includes(w.kind)&&w.instanceId&&!Ir.has(w.instanceId))return"continue";try{for(var S=(o=void 0,q(e.eventBindings)),I=S.next();!I.done;I=S.next()){var C=I.value;if(Object.entries(xe.get(C.eventId)).every(function(O){var F=K(O,2),G=F[0],H=F[1];return G==="id"||w[G]===H})&&Li(C.condition,w)){try{for(var M=(d=void 0,q(C.actions)),g=M.next();!g.done;g=M.next()){var P=g.value;if(Vr>=1024||Tr)break;Ll(P,w,C.condition)}}catch(O){d={error:O}}finally{try{g&&!g.done&&(v=M.return)&&v.call(M)}finally{if(d)throw d.error}}if(wt)break}}}catch(O){o={error:O}}finally{try{I&&!I.done&&(y=S.return)&&y.call(S)}finally{if(o)throw o.error}}if(wt){var A=wt;if(wt=void 0,A==="__restart")Ia();else if(A!==Q){var T=Q;di(),Q=A,ln.clear(),Ar.clear(),Oi.clear(),Vi.clear(),Kn.clear(),on.clear(),Qt=[],wn=[],Nn.clear(),Ni.clear(),Dr=void 0,me=[],le=[],vt=[],at=[],Lr=void 0,$t=!1,ii=0,Ir.clear(),Tt.clear(),On.clear(),Vn.clear(),Ri.clear(),Fe=void 0,uo(),X=X.filter(function(O){return O.kind==="variableChange"}),Qe.clear(),et=void 0;try{for(var N=(p=void 0,q(Mt.values())),W=N.next();!W.done;W=N.next()){var B=W.value;B.reset()}}catch(O){p={error:O}}finally{try{W&&!W.done&&(c=N.return)&&c.call(N)}finally{if(p)throw p.error}}ve.clear(),Ve.clear(),Rn.clear(),Ie=[],Jt(),ie.clear(),_r=void 0,Pt=void 0,Di(0,!1),Ma(),ga(0),er({kind:"sceneExit",sceneId:T}),er({kind:"sceneEnter",sceneId:Q})}}};X.length&&!Tr&&Or<256&&Vr<1024;)r();X.length&&ot("Event/action budget exhausted")}function mr(r){return ri(r.parentId?mr(ze(r.parentId)):tn(),kt(r))}var cr=function(r,o,y){return{x:r[0]*o+r[2]*y+r[4],y:r[1]*o+r[3]*y+r[5]}};function ft(r,o){var y=De(r),d=[[0,0],[y.width,0],[y.width,y.height],[0,y.height]].map(function(v){var p=K(v,2),c=p[0],w=p[1];return cr(o,c,w)});return{left:Math.min.apply(Math,ae([],K(d.map(function(v){return v.x})),!1)),right:Math.max.apply(Math,ae([],K(d.map(function(v){return v.x})),!1)),top:Math.min.apply(Math,ae([],K(d.map(function(v){return v.y})),!1)),bottom:Math.max.apply(Math,ae([],K(d.map(function(v){return v.y})),!1))}}function Cr(r){return De(r).visible&&De(r).opacity>0&&(!r.parentId||Cr(ze(r.parentId)))}function ho(r,o){for(var y=De(r),d=mr(r),v=Math.min(y.width,y.height)/2,p=o==="circle"?Array.from({length:32},function(m,S){return cr(d,y.width/2+Math.cos(S*Math.PI/16)*v,y.height/2+Math.sin(S*Math.PI/16)*v)}):[[0,0],[y.width,0],[y.width,y.height],[0,y.height]].map(function(m){var S=K(m,2),I=S[0],C=S[1];return cr(d,I,C)}),c=r.parentId?ze(r.parentId):void 0,w=function(){var m=De(c);if(c.contract==="native.group.v1"&&m.clip){for(var S=mr(c),I=[[0,0],[m.width,0],[m.width,m.height],[0,m.height]].map(function(A){var T=K(A,2),N=T[0],W=T[1];return cr(S,N,W)}),C=0,M=0;M<4;M++)C+=I[M].x*I[(M+1)%4].y-I[(M+1)%4].x*I[M].y;for(var g=C>=0?1:-1,P=function(A){var T,N,W=I[A],B=I[(A+1)%4],O=function(We){return g*((B.x-W.x)*(We.y-W.y)-(B.y-W.y)*(We.x-W.x))},F=p;p=[];var G=F[F.length-1],H=O(G);try{for(var te=(T=void 0,q(F)),de=te.next();!de.done;de=te.next()){var ne=de.value,he=O(ne);if(he>=0!=H>=0){var Ae=H/(H-he);p.push({x:G.x+(ne.x-G.x)*Ae,y:G.y+(ne.y-G.y)*Ae})}he>=0&&p.push(ne),G=ne,H=he}}catch(We){T={error:We}}finally{try{de&&!de.done&&(N=te.return)&&N.call(te)}finally{if(T)throw T.error}}},M=0;M<4&&p.length;M++)P(M)}c=c.parentId?ze(c.parentId):void 0};c;)w();return p}function Hl(r,o){var y,d,v,p,c,w;if(r.length<3||o.length<3)return!1;try{for(var m=q([r,o]),S=m.next();!S.done;S=m.next())for(var I=S.value,C=0;C<I.length;C++){var M=I[C],g=I[(C+1)%I.length],P=M.y-g.y,A=g.x-M.x,T=1/0,N=-1/0,W=1/0,B=-1/0;try{for(var O=(v=void 0,q(r)),F=O.next();!F.done;F=O.next()){var G=F.value,H=G.x*P+G.y*A;T=Math.min(T,H),N=Math.max(N,H)}}catch(ne){v={error:ne}}finally{try{F&&!F.done&&(p=O.return)&&p.call(O)}finally{if(v)throw v.error}}try{for(var te=(c=void 0,q(o)),de=te.next();!de.done;de=te.next()){var G=de.value,H=G.x*P+G.y*A;W=Math.min(W,H),B=Math.max(B,H)}}catch(ne){c={error:ne}}finally{try{de&&!de.done&&(w=te.return)&&w.call(te)}finally{if(c)throw c.error}}if(N<W||B<T)return!1}}catch(ne){y={error:ne}}finally{try{S&&!S.done&&(d=m.return)&&d.call(m)}finally{if(y)throw y.error}}return!0}function Fl(r){var o,y,d,v,p=R();try{for(var c=q(ln.values()),w=c.next();!w.done;w=c.next()){var m=w.value,S=m.behavior.parameters;if(!(!S.moveComponentId||m.magnitude<=0)){var I=ze(S.moveComponentId);if(!(!I||!Cr(I))){var C=(d=S.moveSpeed)!==null&&d!==void 0?d:220,M=St("physics-body",(v=I.prototypeId)!==null&&v!==void 0?v:I.id);if(M&&M.parameters.mode==="dynamic"){var g=Bn(I,M);g.vx=m.nx*C,g.vy=m.ny*C,g.atRest=!1,g.restElapsed=0}else{var P=Rr(I),A=De(I),T=P.x+m.nx*C*r,N=P.y+m.ny*C*r;yo(I)||(T=Math.max(A.width/2,Math.min(p.width-A.width/2,T)),N=Math.max(A.height/2,Math.min(p.height-A.height/2,N))),qt(I,T,N)}S.orientToMove&&qn(I,Math.atan2(m.ny,m.nx))}}}}catch(W){o={error:W}}finally{try{w&&!w.done&&(y=c.return)&&y.call(c)}finally{if(o)throw o.error}}}function Xl(r){var o,y,d,v,p,c,w,m,S,I,C,M,g,P,A,T,N,W,B,O,F,G,H,te,de,ne,he,Ae,We,He,se,be,Re=R();ce+=r,tf(r),Bl(r),Fl(r),Wl(r),Rl();try{for(var Ee=q(xn),Oe=Ee.next();!Oe.done;Oe=Ee.next()){var pe=K(Oe.value,2),gr=pe[0],Pe=pe[1];!Pe.held&&ce-((H=Pe.releasedAt)!==null&&H!==void 0?H:ce)>=Pe.behavior.springBackSeconds&&xn.delete(gr)}}catch(Ne){o={error:Ne}}finally{try{Oe&&!Oe.done&&(y=Ee.return)&&y.call(Ee)}finally{if(o)throw o.error}}Lr&&(Lr.elapsed+=r,Lr.elapsed>=Lr.seconds&&(Lr=void 0));try{for(var ar=q(at),we=ar.next();!we.done;we=ar.next()){var hr=we.value;hr.elapsed+=r}}catch(Ne){d={error:Ne}}finally{try{we&&!we.done&&(v=ar.return)&&v.call(ar)}finally{if(d)throw d.error}}at=at.filter(function(Ne){return Ne.elapsed<Ne.seconds});try{for(var Ue=q(vt),Ze=Ue.next();!Ze.done;Ze=Ue.next()){var Ur=Ze.value;Ur.elapsed+=r}}catch(Ne){p={error:Ne}}finally{try{Ze&&!Ze.done&&(c=Ue.return)&&c.call(Ue)}finally{if(p)throw p.error}}vt=vt.filter(function(Ne){return Ne.elapsed<Ne.seconds});try{for(var yr=q(Mt),rr=yr.next();!rr.done;rr=yr.next()){var Yr=K(rr.value,2),gr=Yr[0],st=Yr[1];V.get(gr).sceneId===Q&&Cr(V.get(gr))&&st.tick(r)}}catch(Ne){w={error:Ne}}finally{try{rr&&!rr.done&&(m=yr.return)&&m.call(yr)}finally{if(w)throw w.error}}var jt=function(Ne){var vr,qr,sr=V.get(Ne.componentId);if(sr.sceneId!==Q)return"continue";var xt=Qn(sr)?ae([],K(Ir.values()),!1).filter(function(hi){return hi.prototypeId===sr.id}):[sr];try{for(var lr=(vr=void 0,q(xt)),jr=lr.next();!jr.done;jr=lr.next()){var it=jr.value,un=Ne.id+":"+it.id;if(Ne.kind==="motion"){var ut=(te=Qe.get(it.id))!==null&&te!==void 0?te:{transform:ae([],K(it.transform),!1),parameters:{}},_t=(de=ut.velocity)!==null&&de!==void 0?de:{x:Ne.parameters.vx,y:Ne.parameters.vy};_t.y+=Ne.parameters.gravity*r,ut.transform[4]+=_t.x*r,ut.transform[5]+=_t.y*r,ut.velocity=_t,Qe.set(it.id,ut),it.prototypeId&&(it.transform=ut.transform);var _n=mr(it);(_n[5]>Re.height||_n[4]<-300||_n[4]>Re.width+300)&&(ut.exited||(ut.exited=!0,er({kind:"boundaryExit",componentId:sr.id,instanceId:it.instanceId})))}else if(Ne.kind==="timer"){var En=((ne=Rn.get(un))!==null&&ne!==void 0?ne:0)+r;Rn.set(un,En),En>=Ne.parameters.seconds&&En-r<Ne.parameters.seconds&&(er({kind:"timer",behaviorId:Ne.id,componentId:sr.id}),Ne.parameters.repeat&&Rn.set(un,En-Ne.parameters.seconds))}}}catch(hi){vr={error:hi}}finally{try{jr&&!jr.done&&(qr=lr.return)&&qr.call(lr)}finally{if(vr)throw vr.error}}};try{for(var ct=q(e.gameplay),Gr=ct.next();!Gr.done;Gr=ct.next()){var Fr=Gr.value;jt(Fr)}}catch(Ne){S={error:Ne}}finally{try{Gr&&!Gr.done&&(I=ct.return)&&I.call(ct)}finally{if(S)throw S.error}}Al(r),Di(r),ga(r);var tt=[],Zr=function(Ne){var vr,qr,sr=V.get(Ne.componentId);if(sr.sceneId!==Q)return"continue";try{for(var xt=(vr=void 0,q(Qn(sr)?ae([],K(Ir.values()),!1).filter(function(it){return it.prototypeId===sr.id}):[sr])),lr=xt.next();!lr.done;lr=xt.next()){var jr=lr.value;if(Cr(jr)){if(tt.length>=256){ot("Collider budget exhausted");break}tt.push({b:Ne,c:jr,box:ft(jr,mr(jr)),polygon:ho(jr,Ne.parameters.shape)})}}}catch(it){vr={error:it}}finally{try{lr&&!lr.done&&(qr=xt.return)&&qr.call(xt)}finally{if(vr)throw vr.error}}};try{for(var Er=q(e.gameplay.filter(function(Ne){return Ne.kind==="collider"})),dr=Er.next();!dr.done;dr=Er.next()){var Fr=dr.value;Zr(Fr)}}catch(Ne){C={error:Ne}}finally{try{dr&&!dr.done&&(M=Er.return)&&M.call(Er)}finally{if(C)throw C.error}}var At=new Set,Je=new Map,$r=function(Ne,vr,qr){var sr,xt,lr;((sr=vr.c.prototypeId)!==null&&sr!==void 0?sr:vr.c.id)===((xt=qr.c.prototypeId)!==null&&xt!==void 0?xt:qr.c.id)&&vr.c.id>qr.c.id||er(ge(ge({},lt(Ne,vr.c,qr.c)),{instanceId:(lr=vr.c.instanceId)!==null&&lr!==void 0?lr:qr.c.instanceId}))},tr=0;e:for(var qe=0;qe<tt.length;qe++)for(var Fr=qe+1;Fr<tt.length;Fr++){var Me=tt[qe],br=tt[Fr];if(!(Me.c.instanceId&&Me.c.instanceId===br.c.instanceId)){var Qr=Me.box,dt=br.box,pt=Qr.left<dt.right&&Qr.right>dt.left&&Qr.top<dt.bottom&&Qr.bottom>dt.top;if(pt){if(++tr>4096){ot("Collision budget exhausted");break e}pt=Hl(Me.polygon,br.polygon)}if(pt){var or=[Me.c.id,br.c.id].sort().join("|");if(At.add(or),Je.set(or,[Me,br]),!ve.has(or))try{for(var ht=(g=void 0,q([[Me,br],[br,Me]])),Et=ht.next();!Et.done;Et=ht.next()){var Sn=K(Et.value,2),Rt=Sn[0],mt=Sn[1];$r("contactBegin",Rt,mt)}}catch(vr){g={error:vr}}finally{try{Et&&!Et.done&&(P=ht.return)&&P.call(ht)}finally{if(g)throw g.error}}}}}try{for(var Ot=q(Ve),wr=Ot.next();!wr.done;wr=Ot.next()){var nt=K(wr.value,2),or=nt[0],yt=K(nt[1],2),Me=yt[0],br=yt[1];if(!At.has(or))try{for(var Lt=(N=void 0,q([[Me,br],[br,Me]])),Nr=Lt.next();!Nr.done;Nr=Lt.next()){var dn=K(Nr.value,2),Rt=dn[0],mt=dn[1];$r("contactEnd",Rt,mt)}}catch(sr){N={error:sr}}finally{try{Nr&&!Nr.done&&(W=Lt.return)&&W.call(Lt)}finally{if(N)throw N.error}}}}catch(Ne){A={error:Ne}}finally{try{wr&&!wr.done&&(T=Ot.return)&&T.call(Ot)}finally{if(A)throw A.error}}ve=At,Ve=Je;try{for(var zr=q(Ie),Mr=zr.next();!Mr.done;Mr=zr.next()){var qe=Mr.value;qe.elapsed+=r;var nr=qe.parameters,Jr=(he=nr.delay)!==null&&he!==void 0?he:0,ur=qe.elapsed-Jr;if(!(ur<0)){var Kr=ur/nr.seconds,ir=nr.loop?Kr%1:Math.min(1,Kr),Br=(Ae=nr.easing)!==null&&Ae!==void 0?Ae:"ease-out",Ye=ir;nr.loop&&Br==="ease-in-out"?Ye=.5-.5*Math.cos(ir*Math.PI*2):Br==="ease-out"?Ye=1-Math.pow(1-ir,3):Br==="ease-in"?Ye=Math.pow(ir,3):Br==="ease-in-out"?Ye=ir<.5?4*Math.pow(ir,3):1-Math.pow(-2*ir+2,3)/2:Br==="back-out"&&(Ye=1+2.70158*Math.pow(ir-1,3)+1.70158*Math.pow(ir-1,2));var je=nr.from+(nr.to-nr.from)*Ye,kn=ze((We=qe.targetId)!==null&&We!==void 0?We:qe.componentId);if(kn){var gt=(He=Qe.get(kn.id))!==null&&He!==void 0?He:{transform:ae([],K(kn.transform),!1),parameters:{}},It=(se=qe.baseTransform)!==null&&se!==void 0?se:kn.transform;if(nr.property==="opacity")gt.parameters.opacity=Math.max(0,Math.min(1,je));else if(["scale","scaleX","scaleY","rotation"].includes(nr.property)){(be=gt.animationAxes)!==null&&be!==void 0||(gt.animationAxes={scale:1,scaleX:1,scaleY:1,rotation:0}),gt.animationAxes[nr.property]=je;var Dt=gt.animationAxes,Yi=Dt.rotation*Math.PI/180,Ln=Math.cos(Yi),Cn=Math.sin(Yi),jn=Dt.scale*Dt.scaleX,ci=Dt.scale*Dt.scaleY;gt.transform[0]=(It[0]*Ln+It[2]*Cn)*jn,gt.transform[1]=(It[1]*Ln+It[3]*Cn)*jn,gt.transform[2]=(-It[0]*Cn+It[2]*Ln)*ci,gt.transform[3]=(-It[1]*Cn+It[3]*Ln)*ci}else gt.transform[nr.property==="x"?4:5]=je;Qe.set(kn.id,gt),nr.loop&&ur>=nr.seconds&&(qe.elapsed=Jr+ur%nr.seconds)}}}}catch(Ne){B={error:Ne}}finally{try{Mr&&!Mr.done&&(O=zr.return)&&O.call(zr)}finally{if(B)throw B.error}}Ie=Ie.filter(function(Ne){var vr,qr;return ze((vr=Ne.targetId)!==null&&vr!==void 0?vr:Ne.componentId)&&(Ne.elapsed<Ne.parameters.seconds+((qr=Ne.parameters.delay)!==null&&qr!==void 0?qr:0)||Ne.parameters.loop)});try{for(var Ht=q(le),Ft=Ht.next();!Ft.done;Ft=Ht.next()){var nr=Ft.value;if(nr.shape==="pixel-confetti"||nr.shape==="confetti"){nr.age+=r;continue}nr.life-=r,nr.x+=nr.vx*r,nr.y+=nr.vy*r,nr.vy+=nr.gravity*r}}catch(Ne){F={error:Ne}}finally{try{Ft&&!Ft.done&&(G=Ht.return)&&G.call(Ht)}finally{if(F)throw F.error}}le=le.filter(function(Ne){var vr;return Ne.life>((vr=Ne.age)!==null&&vr!==void 0?vr:0)}),fn()}function Hi(r,o){var y,d,v;if(h.beginPath(),r.contract==="native.ellipse.v1")h.ellipse(o.width/2,o.height/2,o.width/2,o.height/2,0,0,Math.PI*2);else if(r.contract==="native.path.v1"){var p=function(M,g){({M:function(){return h.moveTo.apply(h,ae([],K(g),!1))},L:function(){return h.lineTo.apply(h,ae([],K(g),!1))},C:function(){return h.bezierCurveTo.apply(h,ae([],K(g),!1))},Q:function(){return h.quadraticCurveTo.apply(h,ae([],K(g),!1))},Z:function(){return h.closePath()}})[M]()};try{for(var c=q(o.commands),w=c.next();!w.done;w=c.next()){var m=K(w.value),S=m[0],I=m.slice(1);p(S,I)}}catch(M){y={error:M}}finally{try{w&&!w.done&&(d=c.return)&&d.call(c)}finally{if(y)throw y.error}}}else{var C=Math.min((v=o.radius)!==null&&v!==void 0?v:0,o.width/2,o.height/2);typeof h.roundRect=="function"?h.roundRect(0,0,o.width,o.height,C):(h.moveTo(C,0),h.arcTo(o.width,0,o.width,o.height,C),h.arcTo(o.width,o.height,0,o.height,C),h.arcTo(0,o.height,0,0,C),h.arcTo(0,0,o.width,0,C),h.closePath())}}function Ul(r,o,y){var d,v,p,c=(d=Qe.get(r.id))===null||d===void 0?void 0:d.pathFrame;if(c!==void 0)return Math.min(o.frameCount-1,c);if(k||!o.frameRate)return 0;if(r.contract!=="native.walk-sprite.v1")return Math.floor(Math.max(0,ce-((v=r.spawnTime)!==null&&v!==void 0?v:0))*o.frameRate)%o.frameCount;var w=(p=r.runtimeId)!==null&&p!==void 0?p:r.id,m=oi.get(w);if(!m)return oi.set(w,{x:y[4],y:y[5],phase:0,lastMove:-1/0,frame:0}),0;var S=Math.hypot(y[4]-m.x,y[5]-m.y)>.3;if(S){var I=ce-m.lastMove;m.phase=Number.isFinite(I)&&I<.25?m.phase+Math.min(I,.12)*o.frameRate:0,m.lastMove=ce}return m.x=y[4],m.y=y[5],ce-m.lastMove>.11&&(m.phase=0),m.frame=Math.floor(m.phase)%o.frameCount,m.frame}function si(r,o,y,d){var v,p,c,w,m,S,I,C,M;if(o===void 0&&(o=tn()),y===void 0&&(y=[]),r.contract!=="native.mesh3d.v1"){var g=De(r),P=St("erase-mask",(c=r.prototypeId)!==null&&c!==void 0?c:r.id);if(!(!g.visible||g.opacity<=0)){var A=ri(o,kt(r));h.save(),h.transform.apply(h,ae([],K(kt(r)),!1)),h.globalAlpha*=g.opacity;var T=xn.get(r.id);T!=null&&T.behavior.liftShadow&&(h.shadowColor="#00000055",h.shadowBlur=8,h.shadowOffsetY=4);var N=y;r.contract==="native.group.v1"&&g.clip&&(h.beginPath(),h.rect(0,0,g.width,g.height),h.clip(),N=ae(ae([],K(y),!1),[{matrix:A,width:g.width,height:g.height}],!1));var W=!1;if(!["native.group.v1","native.text.v1","native.image.v1","native.sprite.v1","native.walk-sprite.v1","native.stage3d.v1","native.mesh3d.v1"].includes(r.contract)){var B=r.contract==="native.button.v1",O=_r===r.id,F=B?g.enabled?O?g.pressedFill:Ut===r.id?g.hoverFill:g.fill:g.disabledFill:g.fill;if(B&&(g.presentation==="pixel-cta"||g.presentation==="shiny-cta")){var G=(w=ye.get(r.id))!==null&&w!==void 0?w:Se;ie.set(r.id,G);var H=!k&&!(Z!=null&&Z.matches)?Se-G:-1;g.presentation==="shiny-cta"?sl(h,g,F,O,H):vl(h,g,F,O,H)}else g.pixelFrame&&(h.save(),h.translate(3,4),Hi(r,g),h.fillStyle="#3c293366",h.fill(),h.restore()),Hi(r,g),P?(h.save(),h.clip(),ui(r,P).render(h),h.restore(),W=!0,Hi(r,g)):(h.fillStyle=F,h.fill()),g.pixelFrame&&!(g.radius>0)&&(h.fillStyle="#ffffff22",h.fillRect(2,2,Math.max(0,g.width-4),2),h.fillRect(2,2,2,Math.max(0,g.height-4))),g.strokeWidth&&(h.strokeStyle=g.stroke,h.lineWidth=g.strokeWidth,h.stroke());Dr===r.id&&(Hi(r,g),h.strokeStyle="#ffffff",h.lineWidth=5,h.stroke())}var te;if(r.contract==="native.text.v1"){var de=g.text.replace(/\{\{([a-z0-9_.-]+)\}\}/g,function(Ue,Ze){var Ur;return String((Ur=j[Ze])!==null&&Ur!==void 0?Ur:"")});g.pixelPanel&&(h.fillStyle="#3c293366",h.fillRect(3,4,g.width,g.height),h.fillStyle=g.panelFill,h.fillRect(0,0,g.width,g.height),h.strokeStyle=(m=g.panelStroke)!==null&&m!==void 0?m:g.color,h.lineWidth=2,h.strokeRect(1,1,g.width-2,g.height-2),h.fillStyle="#ffffff22",h.fillRect(3,3,Math.max(0,g.width-6),2));var ne=g.fontFamily==="pixel"?Ya(de,g):void 0;ne&&!ne.unsupportedChars.length?te=ol(h,de,g):te=Qf(h,de,ne?ge(ge({},g),{fontFamily:"sans-serif",fontWeight:"700"}):g)}if(["native.image.v1","native.sprite.v1","native.walk-sprite.v1"].includes(r.contract)&&!P){var he=Ce.get((I=(S=Qe.get(r.id))===null||S===void 0?void 0:S.assetId)!==null&&I!==void 0?I:(C=r.assetSlots[0])===null||C===void 0?void 0:C.assetId);if(he!=null&&he.complete&&he.naturalWidth){h.save(),h.beginPath(),h.rect(0,0,g.width,g.height),h.clip();var Ae=r.contract!=="native.image.v1",We=Ae?Math.min(g.frameColumns,g.frameCount):1,He=Ae?Math.ceil(g.frameCount/We):1,se=he.width/We,be=he.height/He,Re=Ae?Ul(r,g,A):0,Ee=Re%We*se,Oe=Math.floor(Re/We)*be,pe=g.fit==="cover"?Math.max(g.width/se,g.height/be):Math.min(g.width/se,g.height/be),gr=g.fit==="stretch"?g.width:se*pe,Pe=g.fit==="stretch"?g.height:be*pe;h.imageSmoothingEnabled=(M=g.smoothing)!==null&&M!==void 0?M:!0,h.drawImage(he,Ee,Oe,se,be,(g.width-gr)/2,(g.height-Pe)/2,gr,Pe),h.restore()}}P&&!W&&ui(r,P).render(h),Yt.push({c:r,m:A,clips:N,instance:d!=null?d:r.prototypeId,textMetrics:te});try{for(var ar=q(Wi(r.id)),we=ar.next();!we.done;we=ar.next()){var hr=we.value;si(hr,A,N,d!=null?d:r.prototypeId)}}catch(Ue){v={error:Ue}}finally{try{we&&!we.done&&(p=ar.return)&&p.call(ar)}finally{if(v)throw v.error}}g.clip&&r.contract==="native.group.v1"&&Ca(r.id),h.restore()}}}function Ca(r,o){var y,d;if(!(Z!=null&&Z.matches))try{for(var v=q(le),p=v.next();!p.done;p=v.next()){var c=p.value;c.shape!=="pixel-confetti"&&c.shape!=="confetti"||c.clipId!==r||!!c.screen!=!!o||(h.save(),c.shape==="confetti"?ul(h,c,o):fl(h,c,o),h.restore())}}catch(w){y={error:w}}finally{try{p&&!p.done&&(d=v.return)&&d.call(v)}finally{if(y)throw y.error}}}function Yl(r,o,y,d){h.save(),h.translate(r,o),h.globalAlpha=.92,h.lineWidth=2,h.lineJoin="round",y==="tap"&&(h.strokeStyle="#fff0bd",h.globalAlpha=.7*(1-d),h.beginPath(),h.arc(0,0,12+d*12,0,Math.PI*2),h.stroke(),h.globalAlpha=.92),h.fillStyle="#fff0bd",h.strokeStyle="#193b46",h.beginPath(),h.moveTo(-7,10),h.lineTo(-9,-1),h.quadraticCurveTo(-9,-5,-5,-5),h.lineTo(-3,-3),h.lineTo(-3,-17),h.quadraticCurveTo(-3,-22,1,-22),h.quadraticCurveTo(5,-22,5,-17),h.lineTo(5,-6),h.quadraticCurveTo(9,-9,11,-5),h.quadraticCurveTo(15,-7,16,-2),h.lineTo(14,9),h.quadraticCurveTo(12,18,3,18),h.lineTo(-1,18),h.quadraticCurveTo(-5,17,-7,10),h.closePath(),h.fill(),h.stroke(),h.restore()}function Gl(){var r,o,y,d,v,p,c,w,m,S,I,C,M,g,P,A,T,N,W;if(ii=0,!k)try{for(var B=q(e.gameplay.filter(function(or){return or.kind==="tutorial-hand"})),O=B.next();!O.done;O=B.next()){var F=O.value,G=V.get(F.componentId),H=ze(F.parameters.targetId);if(!(!G||G.sceneId!==Q||!H||H.sceneId!==Q||!Cr(H))&&!(F.parameters.hideOnFirstInput&&$t)){var te=gn?ce:Se;if(!(te-Zt<F.parameters.idleDelaySeconds)){ii++;var de=F.parameters.destinationId?ze(F.parameters.destinationId):void 0,ne=De(H),he=void 0;he||(he=cr(mr(H),ne.width/2,ne.height/2));var Ae=te%1.2/1.2,We=Z!=null&&Z.matches?0:Ae*Ae*(3-2*Ae),He=he.x,se=he.y;if(F.parameters.mode!=="tap"){var be=de?cr(mr(de),De(de).width/2,De(de).height/2):{x:he.x-36,y:he.y+48};He=he.x+(be.x-he.x)*We,se=he.y+(be.y-he.y)*We}Yl(He+8,se+22,F.parameters.mode,We)}}}}catch(or){r={error:or}}finally{try{O&&!O.done&&(o=B.return)&&o.call(B)}finally{if(r)throw r.error}}try{for(var Re=q(on),Ee=Re.next();!Ee.done;Ee=Re.next()){var Oe=K(Ee.value,2),pe=Oe[0],gr=Oe[1],Pe=St("draw-stroke",pe).parameters;try{for(var ar=(v=void 0,q(gr.strokes)),we=ar.next();!we.done;we=ar.next()){var hr=we.value;if(!(hr.points.length<2)){h.save(),h.globalAlpha=Pe.mode==="slice-blade"?Math.max(0,1-hr.age/.18):1,h.strokeStyle=Pe.color,h.lineWidth=Pe.strokeWidth,h.lineCap="round",h.lineJoin="round",h.beginPath(),h.moveTo(hr.points[0].x,hr.points[0].y);try{for(var Ue=(c=void 0,q(hr.points.slice(1))),Ze=Ue.next();!Ze.done;Ze=Ue.next()){var Ur=Ze.value;h.lineTo(Ur.x,Ur.y)}}catch(or){c={error:or}}finally{try{Ze&&!Ze.done&&(w=Ue.return)&&w.call(Ue)}finally{if(c)throw c.error}}h.stroke(),h.restore()}}}catch(or){v={error:or}}finally{try{we&&!we.done&&(p=ar.return)&&p.call(ar)}finally{if(v)throw v.error}}}}catch(or){y={error:or}}finally{try{Ee&&!Ee.done&&(d=Re.return)&&d.call(Re)}finally{if(y)throw y.error}}try{for(var yr=q(wn),rr=yr.next();!rr.done;rr=yr.next()){var Yr=rr.value;if(!(Yr.broken||!Yr.drawRope)){var st=Tt.get(Yr.bodyId),jt=ze(Yr.anchorId);if(!(!st||!jt)){var ct=Rr(jt);h.save(),h.strokeStyle=Yr.ropeColor,h.lineWidth=Yr.ropeWidth,h.beginPath(),h.moveTo(ct.x,ct.y),h.lineTo(st.x,st.y),h.stroke(),h.restore()}}}}catch(or){m={error:or}}finally{try{rr&&!rr.done&&(S=yr.return)&&S.call(yr)}finally{if(m)throw m.error}}try{for(var Gr=q(e.gameplay.filter(function(or){var ht;return or.kind==="virtual-joystick"&&((ht=V.get(or.componentId))===null||ht===void 0?void 0:ht.sceneId)===Q})),Fr=Gr.next();!Fr.done;Fr=Gr.next()){var F=Fr.value,tt=ze(F.componentId),ne=F.parameters;if(!(!tt||!Cr(tt)||ne.drawControl===!1)){var Zr=ln.get(F.id),Er=Zr&&Zr.pointerId!==null?Zr.origin:Rr(tt),dr=Zr&&Zr.pointerId!==null?Zr.knobX:Er.x,At=Zr&&Zr.pointerId!==null?Zr.knobY:Er.y,Je=(T=ne.radiusPx)!==null&&T!==void 0?T:56;h.save(),h.fillStyle=(N=ne.baseColor)!==null&&N!==void 0?N:"#ffffff44",h.strokeStyle="#ffffffaa",h.lineWidth=2.5,h.beginPath(),h.arc(Er.x,Er.y,Je,0,Math.PI*2),h.fill(),h.stroke(),h.fillStyle=(W=ne.knobColor)!==null&&W!==void 0?W:"#fff0bdee",h.strokeStyle="#193b46aa",h.lineWidth=2,h.beginPath(),h.arc(dr,At,Je*.42,0,Math.PI*2),h.fill(),h.stroke(),h.restore()}}}catch(or){I={error:or}}finally{try{Fr&&!Fr.done&&(C=Gr.return)&&C.call(Gr)}finally{if(I)throw I.error}}try{for(var $r=q(vt),tr=$r.next();!tr.done;tr=$r.next()){var qe=tr.value,Me=Math.min(1,qe.elapsed/qe.seconds);h.save(),h.globalAlpha=1-Me,h.fillStyle=qe.color,h.strokeStyle="#193b46",h.lineWidth=3,h.font="900 "+qe.fontSize+"px sans-serif",h.textAlign="center",h.textBaseline="middle";var se=qe.y-(Z!=null&&Z.matches?0:qe.risePx*Me);h.strokeText(qe.text,qe.x,se),h.fillText(qe.text,qe.x,se),h.restore()}}catch(or){M={error:or}}finally{try{tr&&!tr.done&&(g=$r.return)&&g.call($r)}finally{if(M)throw M.error}}try{for(var br=q(at),Qr=br.next();!Qr.done;Qr=br.next()){var dt=Qr.value,Me=Math.min(1,dt.elapsed/dt.seconds),pt=R();h.save(),h.globalAlpha=dt.opacity*(1-Me),h.fillStyle=dt.color,h.fillRect(0,0,pt.width,pt.height),h.restore()}}catch(or){P={error:or}}finally{try{Qr&&!Qr.done&&(A=br.return)&&A.call(br)}finally{if(P)throw P.error}}}function Zl(){if(Fe){var r=Tt.get(Fe.targetId),o=Fe.behavior.parameters;if(r){var y=Fe.current.x-Fe.start.x,d=Fe.current.y-Fe.start.y,v=Math.hypot(y,d),p=Math.min(o.maxPullPx,v),c=v>.001?p/v:0;h.save(),h.lineCap="round";var w=Math.max(12,Math.min(r.width,r.height)*.62);if(h.strokeStyle="#173a2f66",h.lineWidth=3.5,h.beginPath(),h.arc(r.x,r.y,w,0,Math.PI*2),h.stroke(),h.strokeStyle=o.trajectoryColor,h.lineWidth=2,h.beginPath(),h.arc(r.x,r.y,w,0,Math.PI*2),h.stroke(),o.showTrajectory&&v>=o.minPullPx){var m=Pa(),S=fo(),I=S.bodies,C=S.zones,M=R(),g=tl({body:ge(ge({},r),{vx:m.vx,vy:m.vy,atRest:!1}),bodies:I,zones:C,bounds:{left:0,top:0,right:M.width,bottom:M.height},dots:o.trajectoryDots,bounces:o.trajectoryBounces});g.forEach(function(T,N){var W=.96-.52*(N/Math.max(1,g.length)),B=Math.max(2.2,4.5-N*.22);h.globalAlpha=W,h.fillStyle="#173a2f88",h.beginPath(),h.arc(T.x,T.y,B+1.3,0,Math.PI*2),h.fill(),h.fillStyle=o.trajectoryColor,h.beginPath(),h.arc(T.x,T.y,B,0,Math.PI*2),h.fill()})}if(v>=4){var P=r.x+y*c,A=r.y+d*c;h.globalAlpha=.9,h.strokeStyle="#173a2f66",h.lineWidth=5,h.beginPath(),h.moveTo(r.x,r.y),h.lineTo(P,A),h.stroke(),h.strokeStyle=o.trajectoryColor,h.lineWidth=2.6,h.beginPath(),h.moveTo(r.x,r.y),h.lineTo(P,A),h.stroke(),h.fillStyle="#173a2f88",h.beginPath(),h.arc(P,A,5.2,0,Math.PI*2),h.fill(),h.fillStyle=o.trajectoryColor,h.beginPath(),h.arc(P,A,3.6,0,Math.PI*2),h.fill()}h.restore()}}}function $l(r){var o,y,d,v;try{for(var p=q(io()),c=p.next();!c.done;c=p.next()){var w=c.value,m=w.contract==="native.group.v1"?Wi(w.id):[w];try{for(var S=(d=void 0,q(m)),I=S.next();!I.done;I=S.next()){var C=I.value;if(C.contract==="native.stage3d.v1"&&Cr(C)&&De(C).skyColor)return De(C).skyColor;if(!(C.contract!=="native.rectangle.v1"||!Cr(C))){var M=De(C);if(!(M.opacity<.95||!M.fill||M.fill==="transparent")&&(/(?:^|\.)(background|backdrop|bg)(?:\.fill)?$/.test(C.id)||M.width>=r.width*.9&&M.height>=r.height*.9))return M.fill}}}catch(g){d={error:g}}finally{try{I&&!I.done&&(v=S.return)&&v.call(S)}finally{if(d)throw d.error}}}}catch(g){o={error:g}}finally{try{c&&!c.done&&(y=p.return)&&y.call(p)}finally{if(o)throw o.error}}return"#102a34"}function Kl(){var r;if(bn&&Cr(bn.c)){var o=bn.c,y=De(o);h.save(),h.transform.apply(h,ae([],K(mr(o)),!1)),h.strokeStyle=(r=bn.highlightColor)!==null&&r!==void 0?r:"#ffffff",h.lineWidth=4,h.globalAlpha=.85,h.strokeRect(-4,-4,y.width+8,y.height+8),h.restore()}if(Ge!=null&&Ge.b.parameters.bringToFront){var o=ze(Ge.targetId);o&&si(o,o.parentId?mr(ze(o.parentId)):tn(),[],o.prototypeId)}}function rt(){var r,o,y,d,v,p;ye=ie,ie=new Map;var c=R();ue!==void 0&&ue!==c.landscape&&Jt(),ue=c.landscape;var w=Math.min(devicePixelRatio||1,2),m=t.clientWidth,S=t.clientHeight;(t.width!==Math.round(m*w)||t.height!==Math.round(S*w))&&(t.width=Math.round(m*w),t.height=Math.round(S*w)),h.setTransform(w,0,0,w,0,0),h.fillStyle=$l(c),h.fillRect(0,0,m,S);var I=Math.min(m/c.width,S/c.height),C=(m-c.width*I)/2,M=(S-c.height*I)/2;if(Ml=I||1,Sl=w,h.translate(C,M),h.scale(I,I),Lr){var g=Math.min(1,Lr.elapsed/Lr.seconds),P=Lr.intensity*(1-g);h.translate(Math.sin(Lr.elapsed*95)*P,Math.cos(Lr.elapsed*113)*P)}h.save(),h.beginPath(),h.rect(0,0,c.width,c.height),h.clip(),Yt=[];try{for(var A=q(io()),T=A.next();!T.done;T=A.next()){var N=T.value;si(N)}}catch(se){r={error:se}}finally{try{T&&!T.done&&(o=A.return)&&o.call(A)}finally{if(r)throw r.error}}try{for(var W=q(me),B=W.next();!B.done;B=W.next()){var N=B.value;N.parentId||si(N,tn(),[],N.prototypeId)}}catch(se){y={error:se}}finally{try{B&&!B.done&&(d=W.return)&&d.call(W)}finally{if(y)throw y.error}}if(Kl(),Zl(),k&&zt){for(var O=V.get(zt);O!=null&&O.parentId;)O=V.get(O.parentId);O!=null&&O.prototype&&si(O)}Ca(),h.save();try{for(var F=q(le),G=F.next();!G.done;G=F.next()){var H=G.value;if(!(H.shape==="pixel-confetti"||H.shape==="confetti")){var te=Math.min(1,H.life*2),de=1.5+2.5*te;if(h.globalAlpha=te,h.globalCompositeOperation=H.shape==="square"?"source-over":"lighter",h.fillStyle=H.color,H.shape==="square"){var ne=Math.max(2,Math.round(de*1.6));h.fillRect(Math.round(H.x-ne/2),Math.round(H.y-ne/2),ne,ne);continue}h.globalCompositeOperation="lighter",h.shadowColor=H.color,h.shadowBlur=le.length<=16?6:0,h.strokeStyle=H.color,h.lineWidth=1.5+te,h.beginPath(),h.moveTo(H.x-H.vx*.025,H.y-H.vy*.025),h.lineTo(H.x,H.y),h.stroke(),h.beginPath(),h.arc(H.x,H.y,de,0,Math.PI*2),h.fill()}}}catch(se){v={error:se}}finally{try{G&&!G.done&&(p=F.return)&&p.call(F)}finally{if(v)throw v.error}}if(h.restore(),Gl(),k&&zt){var he=Yt.filter(function(se){return se.c.contract!=="native.group.v1"&&(se.c.id===zt||Ct(se.c,zt))});if(he.length){var Ae=he.map(function(se){return ft(se.c,se.m)}),We=Math.min.apply(Math,ae([],K(Ae.map(function(se){return se.left})),!1)),He=Math.min.apply(Math,ae([],K(Ae.map(function(se){return se.top})),!1));h.strokeStyle="#55e6ef",h.lineWidth=2/I,h.strokeRect(We,He,Math.max.apply(Math,ae([],K(Ae.map(function(se){return se.right})),!1))-We,Math.max.apply(Math,ae([],K(Ae.map(function(se){return se.bottom})),!1))-He)}}h.restore(),I>0&&Ca(void 0,{x:-C/I,y:-M/I,width:m/I,height:S/I})}function Ql(r){var o,y,d,v,p=Array.isArray(r)?ae([],K(new Set(r)),!1):void 0;rt();var c=R(),w=new Set,m=[];try{for(var S=q(Yt),I=S.next();!I.done;I=S.next()){var C=I.value,M=(d=C.c.prototypeId)!==null&&d!==void 0?d:C.c.id;if(!(C.c.contract==="native.group.v1"||p&&!p.includes(M))){w.add(M);var g=ft(C.c,C.m),P=((v=De(C.c).strokeWidth)!==null&&v!==void 0?v:0)/2;g.left-=P,g.right+=P,g.top-=P,g.bottom+=P;var A={left:Math.max(0,-g.left),right:Math.max(0,g.right-c.width),top:Math.max(0,-g.top),bottom:Math.max(0,g.bottom-c.height)};Object.values(A).some(function(N){return N>.01})&&m.push({id:M,contract:C.c.contract,bounds:g,overflow:A})}}}catch(N){o={error:N}}finally{try{I&&!I.done&&(y=S.return)&&y.call(S)}finally{if(o)throw o.error}}var T=p?p.filter(function(N){return!w.has(N)}):[];return{ok:m.length===0&&T.length===0,viewport:ge(ge({},c),{canvasWidth:t.clientWidth,canvasHeight:t.clientHeight}),issues:m,missing:T}}function Jl(r){var o,y,d,v,p,c,w,m,S,I,C,M,g,P,A,T,N,W,B,O,F,G,H,te,de,ne,he,Ae,We,He,se,be,Re,Ee=r===void 0?{}:r,Oe=Ee.ids,pe=Ee.interactiveIds,gr=Ee.network,Pe=gr===void 0?"standalone":gr,ar=Ee.minTouchPx,we=ar===void 0?44:ar,hr=Array.isArray(Oe)?ae([],K(new Set(Oe)),!1):void 0;rt();var Ue=R(),Ze=Math.min(t.clientWidth/Ue.width,t.clientHeight/Ue.height),Ur=eo(Ue,Pe),yr=[],rr=new Set,Yr=function(L){var ke;return!hr||hr.includes((ke=L.c.prototypeId)!==null&&ke!==void 0?ke:L.c.id)},st=Yt.filter(Yr),jt=new Set(e.events.filter(function(L){return L.kind==="click"}).map(function(L){return L.componentId}));try{for(var ct=q(e.gameplay),Gr=ct.next();!Gr.done;Gr=ct.next()){var Fr=Gr.value;["drag","match-tile","aim-launch","aim-launch-3d","swipe-input","hold-charge","virtual-joystick","draw-stroke","erase-mask"].includes(Fr.kind)&&jt.add(Fr.componentId)}}catch(L){o={error:L}}finally{try{Gr&&!Gr.done&&(y=ct.return)&&y.call(ct)}finally{if(o)throw o.error}}var tt=new Set(pe!=null?pe:jt),Zr=new Set(e.gameplay.filter(function(L){return["aim-launch","aim-launch-3d","swipe-input","hold-charge","draw-stroke","virtual-joystick"].includes(L.kind)&&(L.parameters.dragMode==="anywhere"||L.kind==="draw-stroke"||L.kind==="virtual-joystick"&&L.parameters.mode==="floating")}).map(function(L){return L.componentId})),Er=function(L){var ke;return tt.has((ke=L.c.prototypeId)!==null&&ke!==void 0?ke:L.c.id)},dr=function(L,ke,Be,_e,Wr,Sr){return yr.push(ge(ge({kind:L,severity:ke,id:Be},Sr?{otherId:Sr}:{}),{detail:_e,metrics:Wr}))},At=function(L){var ke=[[0,0],[L.width,0],[L.width,L.height],[0,L.height]].map(function(Be){var _e=K(Be,2),Wr=_e[0],Sr=_e[1];return cr(L.matrix,Wr,Sr)});return{left:Math.min.apply(Math,ae([],K(ke.map(function(Be){return Be.x})),!1)),right:Math.max.apply(Math,ae([],K(ke.map(function(Be){return Be.x})),!1)),top:Math.min.apply(Math,ae([],K(ke.map(function(Be){return Be.y})),!1)),bottom:Math.max.apply(Math,ae([],K(ke.map(function(Be){return Be.y})),!1))}};try{for(var Je=q(st),$r=Je.next();!$r.done;$r=Je.next()){var tr=$r.value,qe=(H=tr.c.prototypeId)!==null&&H!==void 0?H:tr.c.id;rr.add(qe);var Me=ft(tr.c,tr.m),br=((te=De(tr.c).strokeWidth)!==null&&te!==void 0?te:0)/2;Me.left-=br,Me.right+=br,Me.top-=br,Me.bottom+=br;var Qr=tr.c.contract==="native.group.v1"&&!De(tr.c).clip,dt=tr.c.contract==="native.image.v1"&&tr.clips.length===0&&De(tr.c).fit==="cover"&&Me.left<=0&&Me.top<=0&&Me.right>=Ue.width&&Me.bottom>=Ue.height||tr.c.contract==="native.stage3d.v1"&&Me.left<=0&&Me.top<=0&&Me.right>=Ue.width&&Me.bottom>=Ue.height,pt=tr.c.contract==="native.rectangle.v1"&&br===0&&Me.left<=0&&Me.top<=0&&Me.right>=Ue.width&&Me.bottom>=Ue.height||dt;if(!Qr){var or={left:Math.max(0,-Me.left),right:Math.max(0,Me.right-Ue.width),top:Math.max(0,-Me.top),bottom:Math.max(0,Me.bottom-Ue.height)};if(!pt&&!yo(tr.c)&&Object.values(or).some(function(L){return L>.01})&&dr("stage-overflow","blocker",qe,"Component extends beyond the active stage.",{bounds:Me,overflow:or}),tr.c.contract==="native.image.v1"&&tr.clips.length===0){var ht=Me.right-Me.left,Et=Me.bottom-Me.top,Sn=/(?:^|\.)(backdrop|background|bg)$/.test(qe)||De(tr.c).fit==="cover"&&!tr.c.parentId&&Me.left<=1&&Me.top<=1&&(ht>=Ue.width*.4||Et>=Ue.height*.4);Sn&&(Me.left>.5||Me.top>.5||Me.right<Ue.width-.5||Me.bottom<Ue.height-.5)&&dr("backdrop-incomplete","blocker",qe,"Backdrop image does not cover the full active stage, leaving a visible seam.",{bounds:Me,stage:{width:Ue.width,height:Ue.height}})}try{for(var Rt=(p=void 0,q(tr.clips)),mt=Rt.next();!mt.done;mt=Rt.next()){var Ot=mt.value,wr=At(Ot),nt={left:Math.max(0,wr.left-Me.left),right:Math.max(0,Me.right-wr.right),top:Math.max(0,wr.top-Me.top),bottom:Math.max(0,Me.bottom-wr.bottom)};Object.values(nt).some(function(L){return L>.01})&&dr("parent-clip-crop","blocker",qe,"Component is cropped by an ancestor clipping group.",{bounds:Me,clip:wr,crop:nt})}}catch(L){p={error:L}}finally{try{mt&&!mt.done&&(c=Rt.return)&&c.call(Rt)}finally{if(p)throw p.error}}}if(tr.textMetrics){var yt=tr.textMetrics;(yt.overflowsWidth||yt.overflowsHeight)&&dr("text-overflow","blocker",qe,"Text does not fit its component after wrapping and auto-fit.",yt);var Lt=(de=yt.fontSize)!==null&&de!==void 0?de:yt.scale*8;Lt<12&&dr("text-illegible",Lt<8?"blocker":"warning",qe,"Rendered text is below the recommended legible size.",ge({renderedFontSize:Lt},yt));var Nr=De(tr.c);if(Nr.pixelPanel&&Nr.align!=="center"){var dn=Math.max(0,Nr.width-2*(Nr.padding===void 0?8:Nr.padding));dn-((ne=yt.renderedWidth)!==null&&ne!==void 0?ne:0)>12&&dr("panel-off-center","blocker",qe,"Text inside a framed pixel panel is not horizontally centered.",{align:Nr.align,innerWidth:dn,renderedWidth:(he=yt.renderedWidth)!==null&&he!==void 0?he:0})}}if(Er(tr)&&!Zr.has(qe)&&(tr.c.contract!=="native.group.v1"||Me.right>Me.left&&Me.bottom>Me.top)){var zr=(Me.right-Me.left)*Ze,Mr=(Me.bottom-Me.top)*Ze;(zr<we-.01||Mr<we-.01)&&dr("touch-target-small","blocker",qe,"Interactive target is smaller than the required physical touch size.",{width:zr,height:Mr,minTouchPx:we,scale:Ze})}if(Er(tr)&&!Zr.has(qe)||tr.c.contract==="native.text.v1")try{for(var nr=(w=void 0,q(Ur.zones)),Jr=nr.next();!Jr.done;Jr=nr.next()){var ur=Jr.value,zr=Math.min(Me.right,ur.right)-Math.max(Me.left,ur.left),Mr=Math.min(Me.bottom,ur.bottom)-Math.max(Me.top,ur.top);zr>.01&&Mr>.01&&dr("sdk-safe-area-collision","blocker",qe,"Component intersects a reserved ad-SDK overlay zone.",{bounds:Me,zone:ur,intersection:{width:zr,height:Mr},network:Pe})}}catch(L){w={error:L}}finally{try{Jr&&!Jr.done&&(m=nr.return)&&m.call(nr)}finally{if(w)throw w.error}}}}catch(L){d={error:L}}finally{try{$r&&!$r.done&&(v=Je.return)&&v.call(Je)}finally{if(d)throw d.error}}for(var Kr=st.filter(function(L){return Er(L)&&L.c.contract!=="native.group.v1"}),ir=0;ir<Kr.length;ir++)for(var Br=ir+1;Br<Kr.length;Br++){var Ye=Kr[ir],je=Kr[Br],kn=(Ae=Ye.c.prototypeId)!==null&&Ae!==void 0?Ae:Ye.c.id,gt=(We=je.c.prototypeId)!==null&&We!==void 0?We:je.c.id;if(!(kn===gt||Ct(Ye.c,je.c.id)||Ct(je.c,Ye.c.id))){var It=ft(Ye.c,Ye.m),Dt=ft(je.c,je.m),zr=Math.min(It.right,Dt.right)-Math.max(It.left,Dt.left),Mr=Math.min(It.bottom,Dt.bottom)-Math.max(It.top,Dt.top);zr>1&&Mr>1&&dr("interactive-overlap","blocker",kn,"Interactive targets overlap.",{intersection:{width:zr,height:Mr},first:It,second:Dt},gt)}}var Yi=function(L){if(!L||L==="transparent")return!1;var ke=/^#([0-9a-f]{4}|[0-9a-f]{8})$/i.exec(L);if(ke)return ke[1].length===4?ke[1][3].toLowerCase()==="f":ke[1].slice(6).toLowerCase()==="ff";var Be=/^rgba\([^,]+,[^,]+,[^,]+,\s*([0-9.]+)\s*\)$/i.exec(L);return Be?Number(Be[1])>=.95:!0},Ln=[];st.forEach(function(L,ke){var Be,_e;L.c.contract==="native.rectangle.v1"&&!Er(L)&&((Be=De(L.c).opacity)!==null&&Be!==void 0?Be:1)>=.95&&Yi(De(L.c).fill)&&Ln.push({rowIndex:ke,row:L,order:(_e=L.c.order)!==null&&_e!==void 0?_e:0,bounds:ft(L.c,L.m)})});var Cn=st.filter(function(L,ke){var Be,_e=ft(L.c,L.m),Wr=(Be=L.c.order)!==null&&Be!==void 0?Be:0;return!Ln.some(function(Sr){return Sr.rowIndex>ke&&Sr.order>Wr&&Sr.row.c.id!==L.c.id&&!Ct(Sr.row.c,L.c.id)&&!Ct(L.c,Sr.row.c.id)&&Sr.bounds.left<=_e.left+1&&Sr.bounds.right>=_e.right-1&&Sr.bounds.top<=_e.top+1&&Sr.bounds.bottom>=_e.bottom-1})}),jn=Cn.map(function(L,ke){return{row:L,rowIndex:ke}}).filter(function(L){var ke,Be=L.row;if(Be.c.contract!=="native.rectangle.v1")return!1;var _e=ft(Be.c,Be.m),Wr=_e.right-_e.left,Sr=_e.bottom-_e.top,vn=((ke=De(Be.c).strokeWidth)!==null&&ke!==void 0?ke:0)===0&&_e.left<=0&&_e.right>=Ue.width;return!vn&&Wr>=180&&Sr>=140&&!Er(Be)}).map(function(L){var ke,Be=L.row,_e=L.rowIndex;return{id:(ke=Be.c.prototypeId)!==null&&ke!==void 0?ke:Be.c.id,row:Be,rowIndex:_e,bounds:ft(Be.c,Be.m)}}),ci=function(L,ke,Be,_e){var Wr,Sr;_e===void 0&&(_e=!1);var vn=(Wr=L.c.prototypeId)!==null&&Wr!==void 0?Wr:L.c.id,bi=(Be.left+Be.right)/2,sn=(Be.top+Be.bottom)/2,za=(Sr=L.c.order)!==null&&Sr!==void 0?Sr:0;return jn.filter(function(pr){var cn;return pr.id!==vn&&(!_e||pr.rowIndex<ke||((cn=pr.row.c.order)!==null&&cn!==void 0?cn:0)===za)&&Be.right-Be.left<=pr.bounds.right-pr.bounds.left+4&&Be.bottom-Be.top<=pr.bounds.bottom-pr.bounds.top+4&&bi>=pr.bounds.left&&bi<=pr.bounds.right&&sn>=pr.bounds.top&&sn<=pr.bounds.bottom}).sort(function(pr,cn){return(pr.bounds.right-pr.bounds.left)*(pr.bounds.bottom-pr.bounds.top)-(cn.bounds.right-cn.bounds.left)*(cn.bounds.bottom-cn.bounds.top)||cn.rowIndex-pr.rowIndex})[0]},Ht=new Map,Ft=new Map;if(jn.length){Cn.forEach(function(L,ke){var Be,_e=(Be=L.c.prototypeId)!==null&&Be!==void 0?Be:L.c.id,Wr=ft(L.c,L.m),Sr=(Wr.left+Wr.right)/2,vn=(Wr.top+Wr.bottom)/2,bi=L.c.contract==="native.button.v1"&&!Bt.has(L.c.id),sn=L.c.parentId?ze(L.c.parentId):void 0,za=L.c.contract==="native.text.v1"&&De(L.c).align==="center"&&(sn==null?void 0:sn.contract)!=="native.button.v1";if(bi||za){var pr=ci(L,ke,Wr,!1);pr&&(Ht.has(pr.id)||Ht.set(pr.id,{panel:pr,items:[]}),Ht.get(pr.id).items.push({id:_e,bounds:Wr,cx:Sr,cy:vn,isBtn:bi}))}if(["native.text.v1","native.image.v1","native.button.v1"].includes(L.c.contract)&&(sn==null?void 0:sn.contract)!=="native.button.v1"){var pr=ci(L,ke,Wr,!0);pr&&(Ft.has(pr.id)||Ft.set(pr.id,{panel:pr,content:[]}),Ft.get(pr.id).content.push({row:L,id:_e,bounds:Wr}))}});try{for(var Ne=q(Ht.values()),vr=Ne.next();!vr.done;vr=Ne.next()){var qr=vr.value,sr=qr.panel,xt=qr.items;if(xt.some(function(L){return L.isBtn})){var lr=sr.bounds,jr=(lr.left+lr.right)/2;try{for(var it=(C=void 0,q(xt)),un=it.next();!un.done;un=it.next()){var ut=un.value,_t={left:ut.bounds.left-lr.left,right:lr.right-ut.bounds.right,top:ut.bounds.top-lr.top,bottom:lr.bottom-ut.bounds.bottom},_n=Math.min(_t.left,_t.right,_t.top,_t.bottom);(_n<10||_n*Ze<8)&&dr("panel-edge-cramped","blocker",ut.id,"Element sits too close to its enclosing panel edge.",{panelId:sr.id,margins:_t,scale:Ze,minStagePx:10,minCssPx:8},sr.id)}}catch(L){C={error:L}}finally{try{un&&!un.done&&(M=it.return)&&M.call(it)}finally{if(C)throw C.error}}var En=[],hi=function(L){var ke=En.find(function(Be){return Math.abs(Be.cy-L.cy)<=16&&Be.isBtn===L.isBtn});ke?ke.items.push(L):En.push({cy:L.cy,isBtn:L.isBtn,items:[L]})};try{for(var Gi=(g=void 0,q(xt)),yi=Gi.next();!yi.done;yi=Gi.next()){var ut=yi.value;hi(ut)}}catch(L){g={error:L}}finally{try{yi&&!yi.done&&(P=Gi.return)&&P.call(Gi)}finally{if(g)throw g.error}}try{for(var Zi=(A=void 0,q(En)),pi=Zi.next();!pi.done;pi=Zi.next()){var Va=pi.value,lf=Math.min.apply(Math,ae([],K(Va.items.map(function(L){return L.bounds.left})),!1)),ff=Math.max.apply(Math,ae([],K(Va.items.map(function(L){return L.bounds.right})),!1)),ko=(lf+ff)/2,Co=ko-jr;Math.abs(Co)>3&&dr("panel-off-center","blocker",Va.items[0].id,"Element is not horizontally centered inside its enclosing panel.",{panelId:sr.id,offsetX:Co,groupCenterX:ko,panelCenterX:jr,scale:Ze},sr.id)}}catch(L){A={error:L}}finally{try{pi&&!pi.done&&(T=Zi.return)&&T.call(Zi)}finally{if(A)throw A.error}}}}}catch(L){S={error:L}}finally{try{vr&&!vr.done&&(I=Ne.return)&&I.call(Ne)}finally{if(S)throw S.error}}try{for(var $i=q(Ft.values()),mi=$i.next();!mi.done;mi=$i.next())for(var Eo=mi.value,sr=Eo.panel,Ki=Eo.content,df=Ht.has(sr.id),ir=0;ir<Ki.length;ir++)for(var Br=ir+1;Br<Ki.length;Br++){var Ye=Ki[ir],je=Ki[Br];if(!(Ye.id===je.id||Ct(Ye.row.c,je.row.c.id)||Ct(je.row.c,Ye.row.c.id))){var uf=Ye.row.c.contract==="native.image.v1"&&je.row.c.contract==="native.image.v1";if(!(uf&&(!df||Ye.row.c.parentId&&Ye.row.c.parentId===je.row.c.parentId))){var zr=Math.min(Ye.bounds.right,je.bounds.right)-Math.max(Ye.bounds.left,je.bounds.left),Mr=Math.min(Ye.bounds.bottom,je.bounds.bottom)-Math.max(Ye.bounds.top,je.bounds.top);zr>2&&Mr>2&&dr("panel-content-overlap","blocker",Ye.id,"Panel elements overlap each other.",{panelId:sr.id,intersection:{width:zr,height:Mr},first:Ye.bounds,second:je.bounds},je.id)}}}}catch(L){N={error:L}}finally{try{mi&&!mi.done&&(W=$i.return)&&W.call($i)}finally{if(N)throw N.error}}}var ei=Cn.filter(function(L){if(L.c.contract!=="native.text.v1")return!1;var ke=L.c.parentId?ze(L.c.parentId):void 0;return(ke==null?void 0:ke.contract)!=="native.button.v1"}).map(function(L){var ke,Be,_e=String((ke=De(L.c).text)!==null&&ke!==void 0?ke:"").replace(/\{\{([a-z0-9_.-]+)\}\}/g,function(Wr,Sr){var vn;return String((vn=j[Sr])!==null&&vn!==void 0?vn:"")}).trim();return{row:L,id:(Be=L.c.prototypeId)!==null&&Be!==void 0?Be:L.c.id,bounds:ft(L.c,L.m),raw:_e,norm:_e.toLowerCase().replace(/[^a-z0-9]+/g," ").trim()}}).filter(function(L){return L.raw.length>0}),vf=jn.filter(function(L){var ke,Be;return((ke=Ht.get(L.id))===null||ke===void 0?void 0:ke.items.some(function(_e){return _e.isBtn}))||((Be=Ft.get(L.id))===null||Be===void 0?void 0:Be.content.some(function(_e){return _e.row.c.contract==="native.button.v1"}))});try{for(var Qi=q(vf),gi=Qi.next();!gi.done;gi=Qi.next()){var sr=gi.value,lr=sr.bounds,jr=(lr.left+lr.right)/2,sf=lr.right-lr.left;try{for(var Ji=(F=void 0,q(ei)),Ii=Ji.next();!Ii.done;Ii=Ji.next()){var en=Ii.value;if(De(en.row.c).align==="center"&&!(en.bounds.bottom>lr.top+6||lr.top-en.bounds.bottom>48)){var Po=en.bounds.right-en.bounds.left,xi=(en.bounds.left+en.bounds.right)/2,cf=Math.min(en.bounds.right,lr.right)-Math.max(en.bounds.left,lr.left);(xi>=lr.left&&xi<=lr.right||cf>=Po*.6)&&Po<=sf+60&&Math.abs(xi-jr)>4&&dr("header-off-center","blocker",en.id,"Centered text above a panel is not horizontally aligned with the panel below it.",{panelId:sr.id,offsetX:xi-jr,textCenterX:xi,panelCenterX:jr,scale:Ze},sr.id)}}}catch(_e){F={error:_e}}finally{try{Ii&&!Ii.done&&(G=Ji.return)&&G.call(Ji)}finally{if(F)throw F.error}}}}catch(L){B={error:L}}finally{try{gi&&!gi.done&&(O=Qi.return)&&O.call(Qi)}finally{if(B)throw B.error}}for(var ir=0;ir<ei.length;ir++)for(var Br=ir+1;Br<ei.length;Br++){var Ye=ei[ir],je=ei[Br];if(!(Ye.id===je.id||Ct(Ye.row.c,je.row.c.id)||Ct(je.row.c,Ye.row.c.id))){var zr=Math.min(Ye.bounds.right,je.bounds.right)-Math.max(Ye.bounds.left,je.bounds.left),Mr=Math.min(Ye.bounds.bottom,je.bounds.bottom)-Math.max(Ye.bounds.top,je.bounds.top);if(zr>2&&Mr>2&&dr("panel-content-overlap","blocker",Ye.id,"Visible text elements overlap.",{intersection:{width:zr,height:Mr},first:Ye.bounds,second:je.bounds},je.id),Ye.norm&&je.norm){var To=K(Ye.norm.length<=je.norm.length?[Ye.norm,je.norm]:[je.norm,Ye.norm],2),qi=To[0],Ao=To[1];(qi===Ao&&qi.length>=6||qi.length>=12&&Ao.includes(qi))&&dr("duplicate-visible-copy","blocker",Ye.id,"Duplicate visible copy appears in multiple text elements simultaneously.",{first:Ye.raw,second:je.raw},je.id)}}}var rn=ei.filter(function(L){return!/^[\d\s/.,:%+\-x]+$/i.test(L.raw)}),ji=rn.reduce(function(L,ke){return L+(ke.norm?ke.norm.split(" ").filter(Boolean).length:0)},0),Na=rn.reduce(function(L,ke){return L+ke.raw.replace(/\s+/g," ").length},0);ji>20||Na>130||rn.length>5?dr("text-clutter-heavy","blocker",(se=(He=rn[0])===null||He===void 0?void 0:He.id)!==null&&se!==void 0?se:null,"Too much visible copy on one screen; keep playable ads visual and concise.",{blocks:rn.length,wordCount:ji,charCount:Na,texts:rn.map(function(L){return L.raw})}):(ji>12||rn.length>4)&&dr("text-clutter-heavy","warning",(Re=(be=rn[0])===null||be===void 0?void 0:be.id)!==null&&Re!==void 0?Re:null,"Screen copy is getting dense; consider trimming narration so gameplay carries the experience.",{blocks:rn.length,wordCount:ji,charCount:Na,texts:rn.map(function(L){return L.raw})});var Ro=hr?hr.filter(function(L){if(rr.has(L))return!1;var ke=ze(L);return(ke==null?void 0:ke.contract)==="native.mesh3d.v1"?!1:!ke||Cr(ke)}):[];return{ok:!yr.some(function(L){return L.severity==="blocker"})&&Ro.length===0,viewport:ge(ge({},Ue),{canvasWidth:t.clientWidth,canvasHeight:t.clientHeight,scale:Ze}),defects:yr,missing:Ro,interactive:Kr.map(function(L){var ke;return{id:(ke=L.c.prototypeId)!==null&&ke!==void 0?ke:L.c.id,bounds:ft(L.c,L.m)}}),safeArea:Ur}}function Ct(r,o){for(;r.parentId;){if(r.parentId===o)return!0;r=ze(r.parentId)}return!1}function yo(r){for(var o=function(v){if(e.gameplay.some(function(p){var c;return p.kind==="camera-follow"&&p.componentId===((c=v.prototypeId)!==null&&c!==void 0?c:v.id)}))return{value:!0}},y=r;y;y=y.parentId?ze(y.parentId):void 0){var d=o(y);if(typeof d=="object")return d.value}return!1}function Ea(r){var o=R(),y=t.getBoundingClientRect(),d=Math.min(y.width/o.width,y.height/o.height);return{x:(r.clientX-y.left-(y.width-o.width*d)/2)/d,y:(r.clientY-y.top-(y.height-o.height*d)/2)/d}}function ql(r,o){var y,d,v,p;try{try{for(var c=q(r.clips),w=c.next();!w.done;w=c.next()){var m=w.value,S=cr(Xt(m.matrix),o.x,o.y);if(S.x<0||S.y<0||S.x>m.width||S.y>m.height)return!1}}catch(O){y={error:O}}finally{try{w&&!w.done&&(d=c.return)&&d.call(c)}finally{if(y)throw y.error}}var I=cr(Xt(r.m),o.x,o.y),C=De(r.c);if(r.c.contract==="native.path.v1"){var M=new Path2D,g=function(O,F){({M:function(){return M.moveTo.apply(M,ae([],K(F),!1))},L:function(){return M.lineTo.apply(M,ae([],K(F),!1))},C:function(){return M.bezierCurveTo.apply(M,ae([],K(F),!1))},Q:function(){return M.quadraticCurveTo.apply(M,ae([],K(F),!1))},Z:function(){return M.closePath()}})[O]()};try{for(var P=q(C.commands),A=P.next();!A.done;A=P.next()){var T=K(A.value),N=T[0],W=T.slice(1);g(N,W)}}catch(O){v={error:O}}finally{try{A&&!A.done&&(p=P.return)&&p.call(P)}finally{if(v)throw v.error}}h.save(),h.setTransform(1,0,0,1,0,0),h.lineWidth=C.strokeWidth;var B=h.isPointInPath(M,I.x,I.y)||C.strokeWidth>0&&h.isPointInStroke(M,I.x,I.y);return h.restore(),B}return r.c.contract==="native.ellipse.v1"?Math.pow((I.x-C.width/2)/(C.width/2),2)+Math.pow((I.y-C.height/2)/(C.height/2),2)<=1:I.x>=0&&I.y>=0&&I.x<=C.width&&I.y<=C.height}catch{return!1}}function Fi(r){return ae([],K(Yt),!1).reverse().find(function(o){return o.c.contract!=="native.group.v1"&&o.c.sceneId===Q&&ze(o.c.id)&&Cr(o.c)&&ql(o,r)})}function Xi(r){for(var o=[];r;)o.push(r),r=ze(r.parentId);return o}function Pa(){if(!Fe)return{vx:0,vy:0,power:0,pull:0};var r=Fe.behavior.parameters,o=Fe.current.x-Fe.start.x,y=Fe.current.y-Fe.start.y,d=Math.hypot(o,y),v=Math.max(0,Math.min(1,(d-r.minPullPx)/Math.max(1,r.maxPullPx-r.minPullPx))),p=r.minSpeed+(r.maxSpeed-r.minSpeed)*v,c=r.invert?-1:1;return{vx:d?o/d*p*c:0,vy:d?y/d*p*c:0,power:v,pull:d}}function po(r){if(Fe){Fe.current=r;var o=Pa();Fe.power=o.power,Fe.behavior.parameters.powerVariableId&&(j[Fe.behavior.parameters.powerVariableId]=o.power)}}function mo(r){var o,y;r===void 0&&(r=!1);try{var d=(o=globalThis.AudioContext)!==null&&o!==void 0?o:globalThis.webkitAudioContext;d&&!Ke&&(Ke=new d,(y=Ke.addEventListener)===null||y===void 0||y.call(Ke,"statechange",function(){(Ke==null?void 0:Ke.state)==="running"&&xa()})),vi(r)}catch{}}function jl(r,o,y){var d,v,p,c,w,m,S=function(F){var G=y.find(function(de){var ne;return((ne=de.prototypeId)!==null&&ne!==void 0?ne:de.id)===F.componentId});if(!G)return"continue";var H=cr(Xt(mr(G)),o.x,o.y),te=ui(G,F);return te.stampSegment(H,H),Xr={kind:"mask",pointerId:r.pointerId,c:G,behavior:F,last:H},(w=t.setPointerCapture)===null||w===void 0||w.call(t,r.pointerId),{value:!0}};try{for(var I=q(e.gameplay.filter(function(F){var G;return F.kind==="erase-mask"&&((G=V.get(F.componentId))===null||G===void 0?void 0:G.sceneId)===Q})),C=I.next();!C.done;C=I.next()){var M=C.value,g=S(M);if(typeof g=="object")return g.value}}catch(F){d={error:F}}finally{try{C&&!C.done&&(v=I.return)&&v.call(I)}finally{if(d)throw d.error}}if(y.some(function(F){return F.contract==="native.button.v1"||e.events.some(function(G){var H;return G.kind==="click"&&G.componentId===((H=F.prototypeId)!==null&&H!==void 0?H:F.id)})}))return!1;try{for(var P=q(e.gameplay.filter(function(F){var G;return F.kind==="draw-stroke"&&((G=V.get(F.componentId))===null||G===void 0?void 0:G.sceneId)===Q})),A=P.next();!A.done;A=P.next()){var M=A.value,T=V.get(M.componentId),N=Xt(mr(T)),W=cr(N,o.x,o.y),B=De(T);if(!(W.x<0||W.y<0||W.x>B.width||W.y>B.height)){var O=Tl(M);return O.begin(o),Xr={kind:"stroke",pointerId:r.pointerId,c:T,behavior:M,store:O,last:o},er({kind:"strokeStart",componentId:T.id}),(m=t.setPointerCapture)===null||m===void 0||m.call(t,r.pointerId),!0}}}catch(F){p={error:F}}finally{try{A&&!A.done&&(c=P.return)&&c.call(P)}finally{if(p)throw p.error}}return!1}function _l(r,o,y){var d,v,p,c,w,m,S,I=y.store.active;if(I){try{for(var C=q(e.gameplay.filter(function(te){var de;return te.kind==="collider"&&((de=V.get(te.componentId))===null||de===void 0?void 0:de.sceneId)===Q})),M=C.next();!M.done;M=C.next()){var g=M.value,P=V.get(g.componentId);try{for(var A=(p=void 0,q(Hr(P))),T=A.next();!T.done;T=A.next()){var N=T.value;!Cr(N)||I.hitIds.has(N.id)||$o(r,o,ho(N,g.parameters.shape))&&(I.hitIds.add(N.id),er(lt("sliceHit",N)))}}catch(te){p={error:te}}finally{try{T&&!T.done&&(c=A.return)&&c.call(A)}finally{if(p)throw p.error}}}}catch(te){d={error:te}}finally{try{M&&!M.done&&(v=C.return)&&v.call(C)}finally{if(d)throw d.error}}try{for(var W=q(wn),B=W.next();!B.done;B=W.next()){var O=B.value;if(!(O.broken||!O.breakable||I.hitIds.has(O.key))){var F=Tt.get(O.bodyId),G=ze(O.anchorId);if(!(!F||!G)){var H=Rr(G);Xa(r,o,{x:H.x,y:H.y},{x:F.x,y:F.y})&&(I.hitIds.add(O.key),O.broken=!0,Ni.add(O.key),er({kind:"jointBreak",behaviorId:O.id,componentId:O.componentId,selfInstanceId:O.bodyId,instanceId:(S=ze(O.bodyId))===null||S===void 0?void 0:S.instanceId}))}}}}catch(te){w={error:te}}finally{try{B&&!B.done&&(m=W.return)&&m.call(W)}finally{if(w)throw w.error}}}}function ef(r,o){var y,d=o.last,v=o.behavior.parameters;if(v.inkVariableId){var p=v.inkVariableId,c=Math.hypot(r.x-d.x,r.y-d.y);if(((y=j[p])!==null&&y!==void 0?y:0)<c)return;j[p]-=c}o.store.add(r)&&(v.mode==="slice-blade"&&_l(d,r,o),o.last=r)}function rf(r){var o,y;if(!(!Xr||Xr.pointerId!==r.pointerId)){var d=Xr;Xr=void 0;try{!((o=t.hasPointerCapture)===null||o===void 0)&&o.call(t,r.pointerId)&&((y=t.releasePointerCapture)===null||y===void 0||y.call(t,r.pointerId))}catch{}if(d.kind==="stroke"){var v=d.store.end(),p=d.behavior.parameters;if(v){if(p.mode==="physics-wall"){var c=new Set(d.store.strokes.map(function(m){return m.id}));Qt=Qt.filter(function(m){return m.owner!==d.c.id||c.has(m.strokeId)}),Qt.push.apply(Qt,ae([],K(Qo(v,p.strokeWidth).map(function(m){return ge(ge({},m),{owner:d.c.id})})),!1))}else if(p.mode==="path-trace"){var w=ze(p.followComponentId);w&&v.points.length>1&&Nn.set(w.id,{points:v.points,index:1,speed:p.followSpeed})}}er({kind:"strokeEnd",componentId:d.c.id})}}}function tf(r){var o,y,d,v;try{for(var p=q(on.values()),c=p.next();!c.done;c=p.next()){var w=c.value;w.tick(r)}}catch(O){o={error:O}}finally{try{c&&!c.done&&(y=p.return)&&y.call(p)}finally{if(o)throw o.error}}try{for(var m=q(Nn),S=m.next();!S.done;S=m.next()){var I=K(S.value,2),C=I[0],M=I[1],g=ze(C);if(!g){Nn.delete(C);continue}var P=M.points[M.index];if(!P){Nn.delete(C),er(lt("pathArrive",g));continue}var A=Rr(g),T=P.x-A.x,N=P.y-A.y,W=Math.hypot(T,N),B=M.speed*r;W<=B?(qt(g,P.x,P.y),M.index++):W>.001&&qt(g,A.x+T/W*B,A.y+N/W*B)}}catch(O){d={error:O}}finally{try{S&&!S.done&&(v=m.return)&&v.call(m)}finally{if(d)throw d.error}}}function nf(r,o,y){var d,v,p=[],c=[],w=function(C){var M=V.get(C.componentId),g=C.parameters.dragMode==="anywhere"?Hr(M).find(function(T){return Cr(T)}):y.find(function(T){var N;return((N=T.prototypeId)!==null&&N!==void 0?N:T.id)===M.id});if(!g)return"continue";if(C.kind==="swipe-input")c.push({behavior:C,c:g});else{var P=C.parameters,A=Math.max(P.min,Math.min(P.max,Number(j[P.variableId])));j[P.variableId]=A,p.push({behavior:C,c:g,charge:Lo(P,A)}),er(lt("holdStart",g))}};try{for(var m=q(e.gameplay.filter(function(C){var M;return["swipe-input","hold-charge"].includes(C.kind)&&((M=V.get(C.componentId))===null||M===void 0?void 0:M.sceneId)===Q})),S=m.next();!S.done;S=m.next()){var I=S.value;w(I)}}catch(C){d={error:C}}finally{try{S&&!S.done&&(v=m.return)&&v.call(m)}finally{if(d)throw d.error}}(p.length||c.length)&&(xr={pointerId:r.pointerId,start:o,current:o,holds:p,swipes:c})}function af(r,o){var y,d,v,p,c,w,m,S;if(!(!xr||xr.pointerId!==r.pointerId)){var I=xr,C=new Set;xr=void 0;try{for(var M=q(ae(ae([],K(I.holds),!1),K(I.swipes),!1)),g=M.next();!g.done;g=M.next()){var P=g.value,A=P.behavior,T=P.c;C.has(A.componentId)||(C.add(A.componentId),er(lt("pointerUp",T,void 0,{targetId:T.id,pointerId:r.pointerId})))}}catch(ne){y={error:ne}}finally{try{g&&!g.done&&(d=M.return)&&d.call(M)}finally{if(y)throw y.error}}try{for(var N=q(I.holds),W=N.next();!W.done;W=N.next()){var B=W.value,O=B.behavior.parameters;if(er(lt("holdRelease",B.c)),O.resetOnRelease!==!1){var F=j[O.variableId];j[O.variableId]=O.min,F!==O.min&&er({kind:"variableChange",variableId:O.variableId,selfInstanceId:(m=B.c.instanceId)!==null&&m!==void 0?m:B.c.id,instanceId:B.c.instanceId})}}}catch(ne){v={error:ne}}finally{try{W&&!W.done&&(p=N.return)&&p.call(N)}finally{if(v)throw v.error}}try{for(var G=q(I.swipes),H=G.next();!H.done;H=G.next()){var te=H.value,de=Wo(I.start,o,te.behavior.parameters.minDistancePx,(S=Vi.get(te.behavior.id))!==null&&S!==void 0?S:-1/0,ce*1e3,te.behavior.parameters.cooldownMs);de&&(Vi.set(te.behavior.id,ce*1e3),er(lt("swipe",te.c,void 0,{direction:de})))}}catch(ne){c={error:ne}}finally{try{H&&!H.done&&(w=G.return)&&w.call(G)}finally{if(c)throw c.error}}return C}}function of(r,o,y){var d,v,p;if(y.some(function(A){return A.contract==="native.button.v1"&&De(A).enabled}))return!1;try{for(var c=q(e.gameplay.filter(function(A){var T;return A.kind==="virtual-joystick"&&((T=V.get(A.componentId))===null||T===void 0?void 0:T.sceneId)===Q})),w=c.next();!w.done;w=c.next()){var m=w.value,S=V.get(m.componentId);if(Cr(S)){var I=ln.get(m.id);if(!(I&&I.pointerId!==null)){var C=cr(Xt(mr(S)),o.x,o.y),M=De(S);if(!(C.x<0||C.y<0||C.x>M.width||C.y>M.height)){var g=m.parameters.mode==="floating"?ge({},o):Rr(S),P=Ha(g,o,m.parameters.radiusPx,m.parameters.deadZone);return I=ge({behavior:m,c:S,pointerId:r.pointerId,origin:g,current:o},P),ln.set(m.id,I),ca(I),er(lt("joystickStart",S)),(p=t.setPointerCapture)===null||p===void 0||p.call(t,r.pointerId),!0}}}}}catch(A){d={error:A}}finally{try{w&&!w.done&&(v=c.return)&&v.call(c)}finally{if(d)throw d.error}}return!1}var go=function(r){var o,y,d,v,p,c,w,m,S,I,C;x();var M=Ea(r),g=Fi(M);if(fi=M,!(!g&&k)){if(k){g&&(zt=g.c.id,Y((p=g.c.prototypeId)!==null&&p!==void 0?p:g.c.id));return}var P=e.gameplay.some(function(be){return be.kind==="virtual-joystick"||be.kind==="fps-controller-3d"});if(!(!r.isTrusted||r.button!==void 0&&r.button!==0||!P&&r.isPrimary===!1||Pr||An||!P&&(Ge&&Ge.pointerId!==r.pointerId||xr&&xr.pointerId!==r.pointerId||Fe&&Fe.pointerId!==r.pointerId)||ee&&(!ai||!Yn))){var A=!gn;Zt=ce,$t=!0,gn=!0,mo(!0),A&&!Tr&&(Or=Vr=0,fn());var T=g?Xi(g.c):[];if(of(r,M,T)){Or=Vr=0,Tr=!1,fn(),rt();return}if(jl(r,M,T)){fn(),rt();return}nf(r,M,T);var N=e.gameplay.find(function(be){return be.kind==="aim-launch"&&V.get(be.componentId).sceneId===Q&&(be.parameters.dragMode==="anywhere"&&!T.some(function(Re){return Re.contract==="native.button.v1"})||T.some(function(Re){var Ee;return((Ee=Re.prototypeId)!==null&&Ee!==void 0?Ee:Re.id)===be.componentId}))});if(N){var W=V.get(N.componentId),B=(c=T.find(function(be){var Re;return((Re=be.prototypeId)!==null&&Re!==void 0?Re:be.id)===W.id}))!==null&&c!==void 0?c:Hr(W).find(function(be){return Cr(be)}),O=B&&Bn(B,St("physics-body",W.id));if(O&&(!N.parameters.onlyWhenAtRest||O.atRest)){Fe={behavior:N,targetId:B.id,sourceId:W.id,pointerId:r.pointerId,start:M,current:M,power:0},po(M),(w=t.setPointerCapture)===null||w===void 0||w.call(t,r.pointerId),rt();return}}try{for(var F=q(T),G=F.next();!G.done;G=F.next()){var H=G.value,te=St("press-feedback",(m=H.prototypeId)!==null&&m!==void 0?m:H.id);te&&(H.contract!=="native.button.v1"||De(H).enabled)&&xn.set(H.id,{behavior:te.parameters,pointerId:r.pointerId,held:!0})}}catch(be){o={error:be}}finally{try{G&&!G.done&&(y=F.return)&&y.call(F)}finally{if(o)throw o.error}}var de=T.find(function(be){var Re;return((Re=Bt.get(be.id))===null||Re===void 0?void 0:Re.sceneId)===Q});if(de){var ne=Mt.get(de.parentId);if(ne!=null&&ne.snapshot().busy)return;Nl(de),ne&&!ne.snapshot().busy&&(et={pointerId:r.pointerId,boardId:de.parentId,tileId:de.id,start:M},(S=t.setPointerCapture)===null||S===void 0||S.call(t,r.pointerId))}_r=(I=T.find(function(be){return be.contract==="native.button.v1"&&De(be).enabled}))===null||I===void 0?void 0:I.id,Pt=_r?r.pointerId:void 0;var he=e.gameplay.find(function(be){return be.kind==="drag"&&T.some(function(Re){var Ee;return((Ee=Re.prototypeId)!==null&&Ee!==void 0?Ee:Re.id)===be.componentId})});if(he){var H=T.find(function(Re){var Ee;return((Ee=Re.prototypeId)!==null&&Ee!==void 0?Ee:Re.id)===he.componentId}),Ae=Rr(H),We=Ar.zoneOf(H.id);Oi.set(H.id,Ae),Ar.release(H.id),Ge={b:he,targetId:H.id,start:M,current:M,origin:Ae,originZone:We,m:ae([],K(kt(H)),!1),pointerId:r.pointerId},er(lt("dragStart",H)),t.setPointerCapture(r.pointerId)}Or=Vr=0,Tr=!1;try{for(var He=q(T),se=He.next();!se.done;se=He.next()){var H=se.value;(H.contract!=="native.button.v1"||De(H).enabled)&&er({kind:"click",componentId:(C=H.prototypeId)!==null&&C!==void 0?C:H.id,instanceId:H.instanceId,targetId:H.id,pointerId:r.pointerId})}}catch(be){d={error:be}}finally{try{se&&!se.done&&(v=He.return)&&v.call(He)}finally{if(d)throw d.error}}fn(),rt()}}};function Io(r,o){if(!et||et.pointerId!==r.pointerId)return!1;if(!r.isTrusted||!Jn())return!0;var y=et,d=Mt.get(y.boardId);if(d.snapshot().busy)return et=void 0,!0;var v=Xt(mr(V.get(y.boardId))),p=cr(v,y.start.x,y.start.y),c=cr(v,o.x,o.y),w=c.x-p.x,m=c.y-p.y,S=V.get(y.tileId);if(Math.max(Math.abs(w),Math.abs(m))<Math.min(S.parameters.width,S.parameters.height)*.35)return!0;var I=Bt.get(S.id),C=Math.abs(w)>Math.abs(m),M=I.row+(C?0:Math.sign(m)),g=I.column+(C?Math.sign(w):0),P=ae([],K(Bt),!1).find(function(A){var T=K(A,2),N=T[1];return N.boardId===y.boardId&&N.row===M&&N.column===g});return P&&d.swap(S.id,P[0])&&(Dr=void 0,rt()),et=void 0,!0}var xo=function(r){var o,y,d,v;if(!Pr){x();var p=R(),c=Ea(r);fi=c,(xr==null?void 0:xr.pointerId)===r.pointerId&&(xr.current=c);try{for(var w=q(ln.values()),m=w.next();!m.done;m=w.next()){var S=m.value;if(S.pointerId===r.pointerId){var I=c.x-S.current.x,C=c.y-S.current.y;Object.assign(S,{current:c},Ha(S.origin,c,S.behavior.parameters.radiusPx,S.behavior.parameters.deadZone)),ca(S),rt();return}}}catch(Re){o={error:Re}}finally{try{m&&!m.done&&(y=w.return)&&y.call(w)}finally{if(o)throw o.error}}if((Xr==null?void 0:Xr.pointerId)===r.pointerId){if(Xr.kind==="mask"){var M=Xr,g=cr(Xt(mr(M.c)),c.x,c.y);ui(M.c,M.behavior).stampSegment(M.last,g),M.last=g}else ef(c,Xr);fn(),rt();return}if((Fe==null?void 0:Fe.pointerId)===r.pointerId){r.isTrusted&&Jn()&&po(c),rt();return}var P=Fi(c);if(Ut=P?(d=Xi(P.c).find(function(Re){return Re.contract==="native.button.v1"}))===null||d===void 0?void 0:d.id:void 0,!Io(r,c)&&!(!Ge||Ge.pointerId!==r.pointerId)){var A=ze(Ge.targetId);if(!A){zi();return}var T=A.parentId?mr(ze(A.parentId)):tn(),N=Xt(T),W=cr(N,Ge.start.x,Ge.start.y),B=cr(N,c.x,c.y),O=ae([],K(Ge.m),!1),F=Ge.b.parameters.axis;if(F!=="y"){var G=Ge.m[4]+B.x-W.x;Number.isFinite(Ge.b.parameters.minX)&&(G=Math.max(Ge.b.parameters.minX,G)),Number.isFinite(Ge.b.parameters.maxX)&&(G=Math.min(Ge.b.parameters.maxX,G)),O[4]=G}if(F!=="x"){var H=Ge.m[5]+B.y-W.y;Number.isFinite(Ge.b.parameters.minY)&&(H=Math.max(Ge.b.parameters.minY,H)),Number.isFinite(Ge.b.parameters.maxY)&&(H=Math.min(Ge.b.parameters.maxY,H)),O[5]=H}if(!A.parentId)F!=="y"&&(O[4]=Math.max(0,Math.min(p.width-A.parameters.width,O[4])));else{var te=ft(A,ri(T,O)),de=0;te.left<0||te.right-te.left>p.width?de=-te.left:te.right>p.width&&(de=p.width-te.right);var ne=F==="y"?0:T[0],he=F==="x"?0:T[2];Math.abs(ne)>=Math.abs(he)&&Math.abs(ne)>1e-8?O[4]+=de/ne:Math.abs(he)>1e-8&&(O[5]+=de/he)}var Ae=(v=Qe.get(A.id))!==null&&v!==void 0?v:{parameters:{}};Qe.set(A.id,ge(ge({},Ae),{transform:O})),Ge.current=c;var We=wa(A),He=We.zones,se=We.tag,be=ea({itemId:A.id,tag:se,zones:He,occupancy:Ar});bn=be&&be.kind!=="reject"?be.zone:void 0}}},bo=function(r){var o,y,d,v;x();var p=Ea(r),c=Gt;fi=p,ha(r.pointerId,!0),rf(r);var w=(d=af(r,p))!==null&&d!==void 0?d:new Set;if(zl(r),r.isTrusted&&Jn()){var m=Fi(p);try{for(var S=q(m?Xi(m.c):[]),I=S.next();!I.done;I=S.next()){var C=I.value;!w.has((v=C.prototypeId)!==null&&v!==void 0?v:C.id)&&(C.contract!=="native.button.v1"||De(C).enabled)&&er(lt("pointerUp",C,void 0,{targetId:C.id,pointerId:r.pointerId}))}}catch(T){o={error:T}}finally{try{I&&!I.done&&(y=S.return)&&y.call(S)}finally{if(o)throw o.error}}}if(fn(),rt(),(Fe==null?void 0:Fe.pointerId)===r.pointerId){var M=Fe,g=Pa(),P=Tt.get(M.targetId);Fe=void 0,M.behavior.parameters.powerVariableId&&(j[M.behavior.parameters.powerVariableId]=0),P&&r.isTrusted&&Jn()&&g.pull>=M.behavior.parameters.minPullPx&&(P.vx=g.vx,P.vy=g.vy,P.atRest=!1,P.restElapsed=0,P.captured=!1,P.exited=!1,er({kind:"launch",componentId:M.sourceId,instanceId:P.instanceId})),ya(r),fn(),rt();return}if(Io(r,p),(et==null?void 0:et.pointerId)===r.pointerId&&(et=void 0),ya(r),!((c==null?void 0:c.pointerId)!==r.pointerId||!r.isTrusted||!Jn()||navigator.userActivation&&navigator.userActivation.isActive!==!0||!Li(c.condition))){var A=Fi(p);!A||!Xi(A.c).some(function(T){return T.id===c.targetId&&(T.contract!=="native.button.v1"||De(T).enabled)})||(ee?ee.openStore(e.base.storeUrl):window.open(e.base.storeUrl,"_blank","noopener"))}},Ui=function(r){var o,y;if(ha(r.pointerId,!0),(Fe==null?void 0:Fe.pointerId)===r.pointerId&&(Fe.behavior.parameters.powerVariableId&&(j[Fe.behavior.parameters.powerVariableId]=0),Fe=void 0),(et==null?void 0:et.pointerId)===r.pointerId&&(et=void 0),(Xr==null?void 0:Xr.pointerId)===r.pointerId&&(Xr.kind==="stroke"&&Xr.store.cancel(),Xr=void 0),(xr==null?void 0:xr.pointerId)===r.pointerId){try{for(var d=q(xr.holds),v=d.next();!v.done;v=d.next()){var p=v.value;p.behavior.parameters.resetOnRelease!==!1&&(j[p.behavior.parameters.variableId]=p.behavior.parameters.min)}}catch(c){o={error:c}}finally{try{v&&!v.done&&(y=d.return)&&y.call(d)}finally{if(o)throw o.error}}xr=void 0}ya(r)},wo=function(r){r!=null&&r.isTrusted&&!k&&!Pr&&!An&&mo(!0)},Ta=function(){Ti||rt()},Mn=typeof globalThis.ResizeObserver=="function"?new globalThis.ResizeObserver(Ta):void 0;try{(u=Mn==null?void 0:Mn.observe)===null||u===void 0||u.call(Mn,t)}catch{}var Mo=function(){Xe=0,fr=0,document.hidden&&Jt(),Ke&&(document.hidden?Ke.suspend().catch(function(){}):!Pr&&gn&&vi())};document.addEventListener("visibilitychange",Mo),(s=globalThis.addEventListener)===null||s===void 0||s.call(globalThis,"resize",Ta),t.addEventListener("pointerdown",go),t.addEventListener("pointermove",xo),t.addEventListener("pointerup",bo),t.addEventListener("pointercancel",Ui),t.addEventListener("lostpointercapture",Ui),t.addEventListener("click",wo);var Aa=ee==null?void 0:ee.onVisibilityChanged(function(r){Yn=r,Xe=0,fr=0,r||Jt(),Ke&&(r?!Pr&&gn&&vi():Ke.suspend().catch(function(){}))}),Ra=ee==null?void 0:ee.onClosed(function(){An=!0,Xe=0,fr=0,Jt(),di()}),Oa=(E=ee==null?void 0:ee.onVolumeChanged)===null||E===void 0?void 0:E.call(ee,function(r){typeof r=="number"&&Number.isFinite(r)&&r>=0&&(va=Math.min(1,r>1?r/100:r),ba())});function So(r){var o=!k&&!Pr&&!document.hidden&&ai&&Yn&&!An;if(o&&fr&&(Se+=Math.min((r-fr)/1e3,5/60)),Jn()){Or=Vr=0,Tr=!1,fr&&(Xe+=Math.min((r-fr)/1e3,5/60));for(var y=0;y<5&&Xe>=1/60;y++)Xl(1/60),Xe-=1/60;fn()}else Xe=0;fr=r,rt(),mn=requestAnimationFrame(So)}return Ia(),k&&(Q=re),rt(),mn=requestAnimationFrame(So),ee&&ee.init().then(function(){Ti||(ai=!0,Yn=ee.isVisible(),Xe=0,fr=0)}).catch(function(){Ti||(An=!0,Jt(),di())}),{state:kl,auditViewport:Ql,auditSceneLayout:Jl,restart:function(){var r;(r=ee==null?void 0:ee.notifyGameRetry)===null||r===void 0||r.call(ee),Ia(),rt()},select:function(r){zt=r},inspectScene:function(r){k&&e.scenes.some(function(o){return o.id===r})&&(Q=r,zt=void 0)},pause:function(r){Pr=r,Xe=0,fr=0,r&&Jt(),Ke&&(r?Ke.suspend().catch(function(){}):gn&&vi())},destroy:function(){var r,o;Ti=!0,cancelAnimationFrame(mn),Jt(),di(),Aa==null||Aa(),Ra==null||Ra(),Oa==null||Oa(),ee==null||ee.destroy(),(r=Mn==null?void 0:Mn.disconnect)===null||r===void 0||r.call(Mn),document.removeEventListener("visibilitychange",Mo),(o=globalThis.removeEventListener)===null||o===void 0||o.call(globalThis,"resize",Ta),t.removeEventListener("pointerdown",go),t.removeEventListener("pointermove",xo),t.removeEventListener("pointerup",bo),t.removeEventListener("pointercancel",Ui),t.removeEventListener("lostpointercapture",Ui),t.removeEventListener("click",wo),Ke==null||Ke.close().catch(function(){})}}}return If(qf);})();
|
|
1
|
+
var ToraNative=(()=>{var Ua=Object.defineProperty;var Pf=Object.getOwnPropertyDescriptor;var Tf=Object.getOwnPropertyNames;var Ef=Object.prototype.hasOwnProperty;var Af=(e,t)=>{for(var n in t)Ua(e,n,{get:t[n],enumerable:!0})},Rf=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of Tf(t))!Ef.call(e,l)&&l!==n&&Ua(e,l,{get:()=>t[l],enumerable:!(a=Pf(t,l))||a.enumerable});return e};var Vf=e=>Rf(Ua({},"__esModule",{value:!0}),e);var dd={};Af(dd,{computeSafeArea:()=>uo,createNetworkBridge:()=>Rl,layoutStandardText:()=>Vl,mountNative:()=>fd});var Uo=function(e,t){if(!e)throw Error(t)},nn=function(){return[1,0,0,1,0,0]};function Ga(e){return Uo(Array.isArray(e)&&e.length===6&&e.every(Number.isFinite),"E_SCENE_MATRIX"),e}function ii(e,t){return Ga(e),Ga(t),[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}function Ut(e){Ga(e);var t=e[0]*e[3]-e[1]*e[2];return Uo(Math.abs(t)>1e-12,"E_SCENE_SINGULAR_TRANSFORM"),[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[3]*e[4])/t,(e[1]*e[4]-e[0]*e[5])/t]}var Za=function(){return Za=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},Za.apply(this,arguments)},an=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},Hn=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},Ya=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Go(e){var t=e.rows,n=e.columns,a=e.seed,l=e.slots,i=e.paint,v=e.onEvent,c=l.map(function(H){return H.group}),P=Hn([],an(new Set(c)),!1),f=Hn([],an(c),!1),w=a,S="idle",W=0,re,U,G=[],oe=[],q=0,ee=0,y=0,O,Te,Se=function(H,de){return H*n+de},be=function(H){return Math.floor(H/n)},Le=function(H){return H%n},Z=function(){return w=Math.imul(w,1664525)+1013904223>>>0,w/4294967296};function ve(H){for(var de=new Set,ze=0;ze<t;ze++)for(var Ae=0;Ae<n;Ae++){var ce=Se(ze,Ae),$e=H[ce];if(Ae+2<n&&$e===H[ce+1]&&$e===H[ce+2])for(var je=0;je<3;je++)de.add(ce+je);if(ze+2<t&&$e===H[ce+n]&&$e===H[ce+n*2])for(var je=0;je<3;je++)de.add(ce+n*je)}return Hn([],an(de),!1)}function ae(H,de){var ze;if(f[H]===f[de])return!1;var Ae=Hn([],an(f),!1);return ze=an([Ae[de],Ae[H]],2),Ae[H]=ze[0],Ae[de]=ze[1],ve(Ae).some(function(ce){return ce===H||ce===de})}function me(){for(var H=[],de=0;de<f.length;de++)Le(de)+1<n&&ae(de,de+1)&&H.push({from:l[de].id,to:l[de+1].id}),be(de)+1<t&&ae(de,de+n)&&H.push({from:l[de].id,to:l[de+n].id});return H}function R(){for(var H=0;H<64;H++){f=[];for(var de=function(Ae){var ce=P.filter(function($e){return!(Le(Ae)>=2&&f[Ae-1]===$e&&f[Ae-2]===$e)&&!(be(Ae)>=2&&f[Ae-n]===$e&&f[Ae-n*2]===$e)});f.push(ce[Math.floor(Z()*ce.length)])},ze=0;ze<l.length;ze++)de(ze);if(me().length)return}f=l.map(function(Ae,ce){return P[(be(ce)*2+Le(ce))%3]}),f[0]=P[0],f[1]=P[1],f[2]=P[0],f[n+1]=P[0]}function b(){for(var H=0;H<l.length;H++)i(H,f[H],{})}function K(){w=a,f=Hn([],an(c),!1),S="idle",W=0,re=void 0,U=void 0,G=[],oe=[],q=0,ee=0,y=0,O=void 0,Te=void 0,(ve(f).length||!me().length)&&R(),b()}function D(H,de){if(S!=="idle")return!1;var ze=l.findIndex(function(ce){return ce.id===H}),Ae=l.findIndex(function(ce){return ce.id===de});return ze<0||Ae<0||Math.abs(be(ze)-be(Ae))+Math.abs(Le(ze)-Le(Ae))!==1?!1:(re=void 0,O=void 0,b(),U=[ze,Ae],S="swap",W=0,!0)}function le(H){if(S==="idle"){if(re===H){re=void 0;return}if(!(re&&D(re,H)))return re=H,re}}function Q(){G=ve(f),y+=G.length,Te={group:f[G[0]],from:l[G[0]].id,count:G.length},v("matchClear"),S="clear",W=0}function fe(){var H=new Set(G),de=Hn([],an(f),!1);oe=[];for(var ze=0;ze<n;ze++){for(var Ae=[],ce=t-1;ce>=0;ce--)H.has(Se(ce,ze))||Ae.push(Se(ce,ze));for(var $e=0,ce=t-1;ce>=0;ce--){var je=Se(ce,ze),lr=Ae[t-1-ce];lr!==void 0?(de[je]=f[lr],oe.push({cell:je,from:lr,offsetRows:0})):(de[je]=P[Math.floor(Z()*P.length)],oe.push({cell:je,from:je,offsetRows:-(ce+1+$e++)}))}}f=de,S="fall",W=0}function _(){if(ve(f).length&&q<3){q++,Q();return}(ve(f).length||!me().length)&&R(),b(),S="idle",W=0,U=void 0,G=[],oe=[],ee++,v("validMatch")}function j(H){var de,ze,Ae,ce,$e,je,lr;if(S==="idle"){if(O){O.elapsed+=H;var Sr=1+.065*Math.sin(Math.min(1,O.elapsed/.8)*Math.PI*4),Tr=function(et){i(l.findIndex(function(Wr){return Wr.id===et}),f[l.findIndex(function(Wr){return Wr.id===et})],{scale:Sr})};try{for(var Lr=Ya(O.ids),zr=Lr.next();!zr.done;zr=Lr.next()){var Rt=zr.value;Tr(Rt)}}catch(et){de={error:et}}finally{try{zr&&!zr.done&&(ze=Lr.return)&&ze.call(Lr)}finally{if(de)throw de.error}}O.elapsed>=.8&&(O=void 0,b())}return}if(W+=H,S==="swap"||S==="reverse"){var pt=Math.min(1,W/.14),_e=pt*pt*(3-2*pt),mn=an(U,2),Ge=mn[0],Gt=mn[1];if(i(Ge,f[Ge],{from:Gt,progress:S==="swap"?_e:1-_e}),i(Gt,f[Gt],{from:Ge,progress:S==="swap"?_e:1-_e}),pt<1)return;if(S==="reverse"){b(),S="idle",U=void 0,v("invalidMatch");return}if(!ae(Ge,Gt)){S="reverse",W=0;return}Ae=an([f[Gt],f[Ge]],2),f[Ge]=Ae[0],f[Gt]=Ae[1],b(),Q();return}if(S==="clear"){var it=Math.min(1,W/.18),Sr=it<.22?1+it*.45:Math.max(.05,1.1*(1-it)/.78);try{for(var Lt=Ya(G),ln=Lt.next();!ln.done;ln=Lt.next()){var Yt=ln.value;i(Yt,f[Yt],{scale:Sr,opacity:1-it})}}catch(Wr){ce={error:Wr}}finally{try{ln&&!ln.done&&($e=Lt.return)&&$e.call(Lt)}finally{if(ce)throw ce.error}}it===1&&fe();return}var Vt=Math.min(1,W/.25),Zt=1-Math.pow(1-Vt,3);try{for(var Ot=Ya(oe),mt=Ot.next();!mt.done;mt=Ot.next()){var st=mt.value;i(st.cell,f[st.cell],{from:st.from,offsetRows:st.offsetRows,progress:1-Zt})}}catch(et){je={error:et}}finally{try{mt&&!mt.done&&(lr=Ot.return)&&lr.call(Ot)}finally{if(je)throw je.error}}Vt===1&&_()}function se(){if(S==="idle"){re=void 0;var H=me()[0];H&&(O={ids:[H.from,H.to],elapsed:0})}}function ye(){var H;return{phase:S,busy:S!=="idle",selected:re!=null?re:null,moves:ee,cleared:y,groups:Hn([],an(f),!1),legalMoves:S==="idle"?me():[],hint:(H=O==null?void 0:O.ids)!==null&&H!==void 0?H:[],lastMatch:Te?Za({},Te):null}}return{reset:K,select:le,swap:D,tick:j,showHint:se,snapshot:ye,cancelSelection:function(){re=void 0,O&&(O=void 0,b())}}}var na=function(){return na=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},na.apply(this,arguments)},Yo=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},Of=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},Zo=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function $o(){var e=new Map,t=new Map,n=function(l){var i,v,c=t.get(l);c!==void 0&&((i=e.get(c))===null||i===void 0||i.delete(l),((v=e.get(c))===null||v===void 0?void 0:v.size)===0&&e.delete(c)),t.delete(l)},a=function(l,i){n(l),i!=null&&(e.has(i)||e.set(i,new Set),e.get(i).add(l),t.set(l,i))};return{occupants:e,itemZone:t,release:n,place:a,clear:function(){e.clear(),t.clear()},items:function(l){var i;return Of([],Yo((i=e.get(l))!==null&&i!==void 0?i:[]),!1).sort()},zoneOf:function(l){return t.get(l)},snapshot:function(){return{itemZone:Object.fromEntries(t)}}}}function ia(e){var t,n,a=e.itemId,l=e.tag,i=l===void 0?"":l,v=e.zones,c=e.occupancy,P=v.filter(function(U){var G,oe,q;return U.id!==a&&(((oe=(G=U.acceptTags)===null||G===void 0?void 0:G.length)!==null&&oe!==void 0?oe:0)===0||((q=U.acceptTags)===null||q===void 0?void 0:q.includes(i)))});P.sort(function(U,G){return Number(G.itemTarget)-Number(U.itemTarget)||G.paintOrder-U.paintOrder||U.distance-G.distance||U.id.localeCompare(G.id)});try{for(var f=Zo(P),w=f.next();!w.done;w=f.next()){var S=w.value,W=c.items(S.id).filter(function(U){return U!==a}),re=S.capacity>0&&W.length>=S.capacity;return S.snapMode==="reject"?{kind:"reject",zone:S,occupantId:W[0]}:re?S.onOccupied==="emit"?{kind:"emit",zone:S,occupantId:W[0]}:S.onOccupied==="swap"&&W.length?{kind:"swap",zone:S,occupantId:W[0]}:{kind:"reject",zone:S,occupantId:W[0]}:{kind:"accept",zone:S}}}catch(U){t={error:U}}finally{try{w&&!w.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}return null}function Ko(e,t,n,a,l,i){if(n===void 0&&(n=28),a===void 0&&(a=-1/0),l===void 0&&(l=0),i===void 0&&(i=80),l-a<i)return null;var v=t.x-e.x,c=t.y-e.y;return Math.max(Math.abs(v),Math.abs(c))<n?null:Math.abs(v)>Math.abs(c)?v<0?"left":"right":c<0?"up":"down"}function Qo(e,t){var n=t,a=1;return{tick:function(l){return e.pingPong?(n+=a*e.ratePerSecond*l,n>=e.max?(n=e.max,a=-1):n<=e.min&&(n=e.min,a=1)):n=Math.max(e.min,Math.min(e.max,n+e.ratePerSecond*l)),n}}}function Jo(){var e=new Map;return{to:function(t,n,a,l,i){l===void 0&&(l=.18),e.set(t,{from:na({},n),to:na({},a),seconds:Math.max(.02,l),elapsed:0,onDone:i})},cancel:function(t){e.delete(t)},clear:function(){e.clear()},tick:function(t,n){var a,l,i;try{for(var v=Zo(e),c=v.next();!c.done;c=v.next()){var P=Yo(c.value,2),f=P[0],w=P[1];w.elapsed+=t;var S=Math.min(1,w.elapsed/w.seconds),W=1-Math.pow(1-S,3);n(f,{x:w.from.x+(w.to.x-w.from.x)*W,y:w.from.y+(w.to.y-w.from.y)*W}),S===1&&(e.delete(f),(i=w.onDone)===null||i===void 0||i.call(w))}}catch(re){a={error:re}}finally{try{c&&!c.done&&(l=v.return)&&l.call(v)}finally{if(a)throw a.error}}}}}function $a(e,t,n,a){n===void 0&&(n=56),a===void 0&&(a=.12);var l=Math.max(1,n),i=t.x-e.x,v=t.y-e.y,c=Math.hypot(i,v),P=Math.min(c,l),f=P/l,w=c>1e-6?i/c:0,S=c>1e-6?v/c:0,W=e.x+w*P,re=e.y+S*P;if(f<=a)return{nx:0,ny:0,magnitude:0,angle:0,knobX:W,knobY:re};var U=(f-a)/Math.max(1e-6,1-a);return{nx:w*U,ny:S*U,magnitude:U,angle:Math.atan2(S,w)*180/Math.PI,knobX:W,knobY:re}}var Ka=function(){return Ka=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},Ka.apply(this,arguments)},qo=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Qa(e){var t,n,a=2166136261;try{for(var l=qo(String(e)),i=l.next();!i.done;i=l.next()){var v=i.value;a^=v.codePointAt(0),a=Math.imul(a,16777619)}}catch(c){t={error:c}}finally{try{i&&!i.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return a>>>0||1}function Ja(e){var t=e>>>0||1,n=t;return{next:function(){return n=Math.imul(n,1664525)+1013904223>>>0,n/4294967296},between:function(a,l,i){if(i===void 0&&(i=!1),i){var v=Math.ceil(a),c=Math.floor(l);return c<v?v:Math.min(c,v+Math.floor((c-v+1)*this.next()))}return a+(l-a)*this.next()},reset:function(){n=t}}}function jo(e,t,n,a,l){var i,v;a===void 0&&(a=0);var c=null,P=1/0;try{for(var f=qo(t),w=f.next();!w.done;w=f.next()){var S=w.value;if(!(S.id===l||S.team!==n)){var W=Math.hypot(S.x-e.x,S.y-e.y);a>0&&W>a||(W<P||W===P&&S.id<(c==null?void 0:c.id))&&(c=S,P=W)}}}catch(re){i={error:re}}finally{try{w&&!w.done&&(v=f.return)&&v.call(f)}finally{if(i)throw i.error}}return c}function _o(e,t,n){var a=((t-e+Math.PI)%(Math.PI*2)+Math.PI*2)%(Math.PI*2)-Math.PI;return e+Math.max(-n,Math.min(n,a))}function el(e){var t=Ja(e),n=new Map,a=new Map;return{rng:t,states:n,headings:a,reset:function(){t.reset(),n.clear(),a.clear()},initialize:function(l,i){var v;return n.has(l)||n.set(l,{hp:i.hp,maxHp:i.maxHp,value:i.value,tag:(v=i.tag)!==null&&v!==void 0?v:"",team:i.team}),n.get(l)},remove:function(l){n.delete(l),a.delete(l)},snapshot:function(l){var i=n.get(l);return i?Ka({},i):void 0}}}function rl(e,t){var n,a,l,i,v=t===void 0?{}:t,c=v.width,P=v.height,f=v.onProgress,w=f===void 0?function(){}:f,S=v.onComplete,W=S===void 0?function(){}:S,re=v.canvasFactory,U=v.source,G=e,oe=G.gridSize,q=new Uint8Array(oe*oe),ee=0,y=!1,O=-1,Te=!1,Se=Math.max(1,c),be=Math.max(1,P),Le=Math.min(1,512/Math.max(Se,be)),Z=(n=re==null?void 0:re())!==null&&n!==void 0?n:!((a=globalThis.document)===null||a===void 0)&&a.createElement?globalThis.document.createElement("canvas"):void 0;Z&&(Z.width=Math.max(1,Math.round(Se*Le)),Z.height=Math.max(1,Math.round(be*Le)));var ve=(l=Z==null?void 0:Z.getContext)===null||l===void 0?void 0:l.call(Z,"2d"),ae=(i=G.maskColor)!==null&&i!==void 0?i:"#dceeff",me=function(){return!!(U&&U.complete&&U.naturalWidth>0)},R=function(){ve&&(ve.globalCompositeOperation="source-over",ve.clearRect(0,0,Z.width,Z.height),G.mode==="erase"&&(me()?(ve.drawImage(U,0,0,Z.width,Z.height),Te=!0):(ve.fillStyle=ae,ve.fillRect(0,0,Z.width,Z.height),Te=!1)))};R();var b=function(){if(!y){var D=Math.round(ee/q.length*100),le=Math.min(100,D);le!==O&&(O=le,w(le)),le>=G.targetPercent&&(y=!0,W(le))}},K=function(D,le){for(var Q=Math.max(0,Math.min(oe-1,Math.floor(D/Se*oe))),fe=Math.max(0,Math.min(oe-1,Math.floor(le/be*oe))),_=Math.max(0,Math.ceil(G.brushRadiusPx/Se*oe)),j=Math.max(0,Math.ceil(G.brushRadiusPx/be*oe)),se=Math.max(0,fe-j);se<=Math.min(oe-1,fe+j);se++)for(var ye=Math.max(0,Q-_);ye<=Math.min(oe-1,Q+_);ye++)if(!(Math.hypot((ye+.5)/oe*Se-D,(se+.5)/oe*be-le)>G.brushRadiusPx)){var H=se*oe+ye;q[H]||(q[H]=1,ee++)}ve&&(ve.save(),ve.scale(Le,Le),ve.globalCompositeOperation=G.mode==="erase"?"destination-out":"source-over",ve.fillStyle=ae,ve.beginPath(),ve.arc(D,le,G.brushRadiusPx,0,Math.PI*2),ve.fill(),G.mode==="reveal"&&U&&(ve.globalCompositeOperation="source-in",ve.drawImage(U,0,0,Se,be)),ve.restore()),b()};return{canvas:Z,stampSegment:function(D,le){for(var Q=Math.hypot(le.x-D.x,le.y-D.y),fe=Math.max(1,Math.ceil(Q/Math.max(1,G.brushRadiusPx*.45))),_=0;_<=fe;_++)K(D.x+(le.x-D.x)*_/fe,D.y+(le.y-D.y)*_/fe)},reset:function(){q.fill(0),ee=0,y=!1,O=-1,R(),b()},get progress(){return Math.round(ee/q.length*100)},render:function(D){G.mode==="erase"&&ee===0&&!Te&&me()&&R(),Z?D.drawImage(Z,0,0,Z.width,Z.height,0,0,c,P):G.mode==="erase"&&this.progress<100&&(D.save(),D.globalAlpha=1-this.progress/100,D.fillStyle=ae,D.fillRect(0,0,c,P),D.restore())}}}var Fn=function(){return Fn=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},Fn.apply(this,arguments)},Bf=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function qa(e,t,n,a){var l=function(w,S,W){return(S.x-w.x)*(W.y-w.y)-(S.y-w.y)*(W.x-w.x)},i=l(e,t,n),v=l(e,t,a),c=l(n,a,e),P=l(n,a,t),f=1e-8;return Math.abs(i)<f&&Math.abs(v)<f&&Math.abs(c)<f&&Math.abs(P)<f?Math.max(Math.min(e.x,t.x),Math.min(n.x,a.x))<=Math.min(Math.max(e.x,t.x),Math.max(n.x,a.x))+f&&Math.max(Math.min(e.y,t.y),Math.min(n.y,a.y))<=Math.min(Math.max(e.y,t.y),Math.max(n.y,a.y))+f:i>0!=v>0&&c>0!=P>0}function tl(e,t){for(var n=!1,a=0,l=t.length-1;a<t.length;l=a++){var i=t[a],v=t[l];i.y>e.y!=v.y>e.y&&e.x<(v.x-i.x)*(e.y-i.y)/(v.y-i.y)+i.x&&(n=!n)}return n}function nl(e,t,n){if(n.length>=3&&(tl(e,n)||tl(t,n)))return!0;for(var a=0;a<n.length;a++)if(qa(e,t,n[a],n[(a+1)%n.length]))return!0;return!1}function il(e){var t=e,n=[],a=null,l=0,i=function(v){return Fn(Fn({},v),{points:v.points.map(function(c){return Fn({},c)})})};return{begin:function(v){var c={id:++l,points:[Fn({},v)],age:0,hitIds:new Set};return a=c,n.push(c),n.length>t.maxStrokes&&n.shift(),c},add:function(v){if(!a||a.points.length>=t.maxPoints)return!1;var c=a.points[a.points.length-1];return Math.hypot(v.x-c.x,v.y-c.y)<t.minSegmentPx?!1:(a.points.push(Fn({},v)),!0)},end:function(){var v=a;return a=null,v?i(v):void 0},cancel:function(){a&&(n=n.filter(function(v){return v!==a})),a=null},clear:function(){a=null,n=[]},tick:function(v){var c,P;try{for(var f=Bf(n),w=f.next();!w.done;w=f.next()){var S=w.value;S.age+=v}}catch(W){c={error:W}}finally{try{w&&!w.done&&(P=f.return)&&P.call(f)}finally{if(c)throw c.error}}n=n.filter(function(W){return W===a||W.age<.18||t.mode!=="slice-blade"})},get active(){return a},get strokes(){return n}}}function al(e,t){for(var n=[],a=1;a<e.points.length;a++){var l=e.points[a-1],i=e.points[a],v=Math.hypot(i.x-l.x,i.y-l.y);v<.001||n.push({id:"stroke-".concat(e.id,"-").concat(a),strokeId:e.id,mode:"static",shape:"box",x:(l.x+i.x)/2,y:(l.y+i.y)/2,width:v,height:Math.max(2,t),angle:Math.atan2(i.y-l.y,i.x-l.x),restitution:.8})}return n}var Si=function(){return Si=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},Si.apply(this,arguments)},vl=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},An=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},zf=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},yn=function(e,t){return Math.hypot(e,t)},ol=function(e,t,n){return Math.max(t,Math.min(n,e))},Xn=function(e){return Math.max(1,Math.min(e.width,e.height)/2)};function ll(e){var t,n,a=Math.cos((t=e.angle)!==null&&t!==void 0?t:0),l=Math.sin((n=e.angle)!==null&&n!==void 0?n:0),i=e.width/2,v=e.height/2;return[[-i,-v],[i,-v],[i,v],[-i,v]].map(function(c){var P=vl(c,2),f=P[0],w=P[1];return{x:e.x+f*a-w*l,y:e.y+f*l+w*a}})}function Wf(e,t){var n,a,l,i,v,c,P,f,w,S,W=ll(e),re=ll(t),U=[(P=e.angle)!==null&&P!==void 0?P:0,((f=e.angle)!==null&&f!==void 0?f:0)+Math.PI/2,(w=t.angle)!==null&&w!==void 0?w:0,((S=t.angle)!==null&&S!==void 0?S:0)+Math.PI/2],G=1/0,oe=1,q=0;try{for(var ee=An(U),y=ee.next();!y.done;y=ee.next()){var O=y.value,Te=Math.cos(O),Se=Math.sin(O),be=1/0,Le=-1/0,Z=1/0,ve=-1/0;try{for(var ae=(l=void 0,An(W)),me=ae.next();!me.done;me=ae.next()){var R=me.value,b=R.x*Te+R.y*Se;b<be&&(be=b),b>Le&&(Le=b)}}catch(Q){l={error:Q}}finally{try{me&&!me.done&&(i=ae.return)&&i.call(ae)}finally{if(l)throw l.error}}try{for(var K=(v=void 0,An(re)),D=K.next();!D.done;D=K.next()){var R=D.value,b=R.x*Te+R.y*Se;b<Z&&(Z=b),b>ve&&(ve=b)}}catch(Q){v={error:Q}}finally{try{D&&!D.done&&(c=K.return)&&c.call(K)}finally{if(v)throw v.error}}var le=Math.min(Le,ve)-Math.max(be,Z);if(le<=0)return null;le<G&&(G=le,oe=Te,q=Se)}}catch(Q){n={error:Q}}finally{try{y&&!y.done&&(a=ee.return)&&a.call(ee)}finally{if(n)throw n.error}}return(e.x-t.x)*oe+(e.y-t.y)*q<0&&(oe=-oe,q=-q),{nx:oe,ny:q,penetration:G}}function fl(e,t){var n,a,l,i=Xn(e),v=-((n=t.angle)!==null&&n!==void 0?n:0),c=Math.cos(v),P=Math.sin(v),f=e.x-t.x,w=e.y-t.y,S=f*c-w*P,W=f*P+w*c,re=t.width/2,U=t.height/2,G=ol(S,-re,re),oe=ol(W,-U,U),q=S-G,ee=W-oe,y=yn(q,ee),O;if(y>=i)return null;if(y<1e-4){var Te=[{d:re-Math.abs(S),x:S>=0?1:-1,y:0},{d:U-Math.abs(W),x:0,y:W>=0?1:-1}].sort(function(Le,Z){return Le.d-Z.d});q=Te[0].x,ee=Te[0].y,O=i+Te[0].d}else q/=y,ee/=y,O=i-y;var Se=Math.cos((a=t.angle)!==null&&a!==void 0?a:0),be=Math.sin((l=t.angle)!==null&&l!==void 0?l:0);return{nx:q*Se-ee*be,ny:q*be+ee*Se,penetration:O}}function dl(e,t){var n;return!!(e.ignoreGroup&&e.ignoreGroup!=="none"&&(e.ignoreGroup==="all"||e.ignoreGroup===((n=t.collisionGroup)!==null&&n!==void 0?n:"all")))}function ul(e,t,n){var a,l,i,v,c,P;if(!(e.captured||t.captured||dl(e,t)||dl(t,e))){var f=e.x-t.x,w=e.y-t.y,S;if(e.shape==="circle"&&t.shape==="circle"){var W=yn(f,w),re=Xn(e)+Xn(t)-W;if(re<=0)return;S=re,W>1e-4?(f/=W,w/=W):(f=1,w=0)}else if(e.shape==="circle"&&t.shape==="box"){var U=fl(e,t);if(!U)return;f=U.nx,w=U.ny,S=U.penetration}else if(e.shape==="box"&&t.shape==="circle"){var U=fl(t,e);if(!U)return;f=-U.nx,w=-U.ny,S=U.penetration}else if(e.shape==="box"&&t.shape==="box"){var U=Wf(e,t);if(!U)return;f=U.nx,w=U.ny,S=U.penetration}else return;var G=e.mode==="dynamic"?1/((a=e.mass)!==null&&a!==void 0?a:1):0,oe=t.mode==="dynamic"?1/((l=t.mass)!==null&&l!==void 0?l:1):0,q=G+oe;if(q){e.x+=f*S*G/q,e.y+=w*S*G/q,t.mode==="dynamic"&&(t.x-=f*S*oe/q,t.y-=w*S*oe/q);var ee=e.vx-((i=t.vx)!==null&&i!==void 0?i:0),y=e.vy-((v=t.vy)!==null&&v!==void 0?v:0),O=ee*f+y*w;if(!(O>=0)){var Te=Math.max((c=e.restitution)!==null&&c!==void 0?c:0,(P=t.restitution)!==null&&P!==void 0?P:0),Se=-(1+Te)*O/q;e.vx+=f*Se*G,e.vy+=w*Se*G,t.mode==="dynamic"&&(t.vx-=f*Se*oe,t.vy-=w*Se*oe),e.atRest=!1,e.restElapsed=0,t.mode==="dynamic"&&(t.atRest=!1,t.restElapsed=0),Math.abs(O)>4&&(n("bodyBounce",e,t,{speed:Math.abs(O)}),t.mode==="dynamic"&&n("bodyBounce",t,e,{speed:Math.abs(O)}))}}}}function Nf(e,t,n,a){var l,i;if(!(e.mode!=="dynamic"||e.captured))try{for(var v=An(t),c=v.next();!c.done;c=v.next()){var P=c.value,f=P.x-e.x,w=P.y-e.y,S=yn(f,w);if(!(S>=P.radius*2.5)){if(S>P.radius&&S>.001&&P.pullStrength>0){var W=P.pullStrength*(1-S/(P.radius*2.5));e.vx+=f/S*W*n,e.vy+=w/S*W*n}if(S<P.radius&&yn(e.vx,e.vy)<=P.maxCaptureSpeed){e.captured=!0,e.atRest=!0,e.vx=P.stopBody?0:e.vx,e.vy=P.stopBody?0:e.vy,P.stopBody&&(e.x=P.x,e.y=P.y),a("zoneCapture",e,P,{});return}}}}catch(re){l={error:re}}finally{try{c&&!c.done&&(i=v.return)&&i.call(v)}finally{if(l)throw l.error}}}function Lf(e,t){var n,a,l,i,v,c,P=function(W){if(W.broken)return"continue";var re=t.find(function(be){return be.id===W.bodyId}),U=t.find(function(be){return be.id===W.anchorId});if(!re||re.mode!=="dynamic")return"continue";var G=(i=(l=U==null?void 0:U.x)!==null&&l!==void 0?l:W.x)!==null&&i!==void 0?i:0,oe=(c=(v=U==null?void 0:U.y)!==null&&v!==void 0?v:W.y)!==null&&c!==void 0?c:0,q=re.x-G,ee=re.y-oe,y=yn(q,ee);if(y<=W.lengthPx||y<1e-4)return"continue";var O=q/y,Te=ee/y;re.x=G+O*W.lengthPx,re.y=oe+Te*W.lengthPx;var Se=re.vx*O+re.vy*Te;Se>0&&(re.vx-=O*Se,re.vy-=Te*Se)};try{for(var f=An(e),w=f.next();!w.done;w=f.next()){var S=w.value;P(S)}}catch(W){n={error:W}}finally{try{w&&!w.done&&(a=f.return)&&a.call(f)}finally{if(n)throw n.error}}}function ja(e){for(var t,n,a,l,i,v,c,P,f,w,S,W=e.bodies,re=e.zones,U=re===void 0?[]:re,G=e.joints,oe=G===void 0?[]:G,q=e.bounds,ee=e.dt,y=e.onEvent,O=y===void 0?function(){}:y,Te=W.filter(function(Ae){return Ae.mode==="dynamic"&&!Ae.captured}),Se=Te.reduce(function(Ae,ce){return Math.max(Ae,yn(ce.vx,ce.vy))},0),be=Te.reduce(function(Ae,ce){return Math.min(Ae,Xn(ce))},24),Le=Math.min(16,Math.max(1,Math.ceil(Se*ee/(be*.45)))),Z=ee/Le,ve=0;ve<Le;ve++){try{for(var ae=(t=void 0,An(Te)),me=ae.next();!me.done;me=ae.next()){var R=me.value;R.vy+=((c=R.gravity)!==null&&c!==void 0?c:0)*Z;var b=yn(R.vx,R.vy);if(b>R.maxSpeed){var K=R.maxSpeed/b;R.vx*=K,R.vy*=K,b=R.maxSpeed}R.x+=R.vx*Z,R.y+=R.vy*Z;var D=Math.max(0,b-((P=R.friction)!==null&&P!==void 0?P:0)*Z),le=Math.exp(-((f=R.linearDamping)!==null&&f!==void 0?f:0)*Z);if(b>1e-4){var Q=D/b*le;R.vx*=Q,R.vy*=Q}R.spinToRotation&&(R.angle=((w=R.angle)!==null&&w!==void 0?w:0)+yn(R.vx,R.vy)*Z/Xn(R)*(R.vx<0?-1:1))}}catch(Ae){t={error:Ae}}finally{try{me&&!me.done&&(n=ae.return)&&n.call(ae)}finally{if(t)throw t.error}}for(var fe=0;fe<Te.length;fe++){var R=Te[fe];try{for(var _=(a=void 0,An(W)),j=_.next();!j.done;j=_.next()){var se=j.value;se.id!==R.id&&se.mode!=="dynamic"&&ul(R,se,O)}}catch(ce){a={error:ce}}finally{try{j&&!j.done&&(l=_.return)&&l.call(_)}finally{if(a)throw a.error}}for(var se=fe+1;se<Te.length;se++)ul(Te[se],R,O);var ye=R.shape==="box"?R.width/2:Xn(R),H=R.shape==="box"?R.height/2:Xn(R);R.wallBounce?(R.x-ye<q.left&&(R.x=q.left+ye,R.vx<0&&(O("bodyBounce",R,null,{speed:Math.abs(R.vx)}),R.vx=-R.vx*R.restitution)),R.x+ye>q.right&&(R.x=q.right-ye,R.vx>0&&(O("bodyBounce",R,null,{speed:Math.abs(R.vx)}),R.vx=-R.vx*R.restitution)),R.y-H<q.top&&(R.y=q.top+H,R.vy<0&&(O("bodyBounce",R,null,{speed:Math.abs(R.vy)}),R.vy=-R.vy*R.restitution)),R.y+H>q.bottom&&(R.y=q.bottom-H,R.vy>0&&(O("bodyBounce",R,null,{speed:Math.abs(R.vy)}),R.vy=-R.vy*R.restitution))):!R.exited&&(R.x+ye<q.left||R.x-ye>q.right||R.y+H<q.top||R.y-H>q.bottom)&&(R.exited=!0,O("boundaryExit",R,null,{})),Nf(R,U,Z,O)}Lf(oe,W)}try{for(var de=An(Te),ze=de.next();!ze.done;ze=de.next()){var R=ze.value,b=yn(R.vx,R.vy);b<R.restSpeed&&!R.captured?(R.restElapsed=((S=R.restElapsed)!==null&&S!==void 0?S:0)+ee,R.restElapsed>=R.restDelaySeconds&&!R.atRest&&(R.atRest=!0,R.vx=0,R.vy=0,O("bodyRest",R,null,{}))):b>=R.restSpeed&&(R.restElapsed=0,R.atRest=!1)}}catch(Ae){i={error:Ae}}finally{try{ze&&!ze.done&&(v=de.return)&&v.call(de)}finally{if(i)throw i.error}}}function sl(e){for(var t=e.body,n=e.bodies,a=e.zones,l=a===void 0?[]:a,i=e.bounds,v=e.dots,c=v===void 0?8:v,P=e.bounces,f=P===void 0?1:P,w=function(y){return Si({},y)},S=w(t),W=n.filter(function(y){return y.id!==t.id}).map(w),re=zf([S],vl(W),!1),U=[],G=0,oe=!1,q=function(y,O,Te,Se){y==="bodyBounce"&&Se.sourceId===t.id&&G++,y==="zoneCapture"&&Se.sourceId===t.id&&(oe=!0)},ee=0;ee<90&&U.length<c&&!oe&&G<=f;ee++)ja({bodies:re,zones:l,bounds:i,dt:1/60,onEvent:function(y,O,Te,Se){return q(y,O,Te,Si(Si({},Se),{sourceId:O.id}))}}),ee%Math.max(1,Math.floor(90/c))===0&&U.push({x:S.x,y:S.y});return U}var pn=function(){return pn=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},pn.apply(this,arguments)},Wt=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},Nt=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},Ci=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},cl=function(e,t,n){return Math.max(t,Math.min(n,e))},Rn=function(e,t){return Math.hypot(t.x-e.x,t.y-e.y)};function hl(e){var t=e.id,n=e.nodes,a=e.edges,l=e.gates,i=l===void 0?[]:l,v=e.onEvent,c=v===void 0?function(){}:v,P=new Map(n.map(function(b){return[b.id,pn({},b)]})),f=new Map(a.map(function(b){return[b.id,pn({speedScale:1,enabled:!0,bidirectional:!1,cost:0},b)]})),w=new Map(i.map(function(b){return[b.id,pn({},b)]})),S=new Map,W=S,re=0,U=0,G=function(b){return P.get(b)},oe=function(b){return Nt([],Wt(w.values()),!1).find(function(K){return K.parameters.nodeId===b})},q=function(b){var K=b.parameters;if(K.mode==="open")return!0;if(K.mode==="closed")return!1;var D=K.openSeconds+K.closedSeconds,le=(re+K.phaseOffsetSeconds)%D;return le<K.openSeconds},ee=function(b){return Nt([],Wt(f.values()),!1).filter(function(K){return K.enabled&&(K.from===b||K.bidirectional&&K.to===b)}).sort(function(K,D){return K.id<D.id?-1:K.id>D.id?1:0})},y=function(b,K){return Nt([],Wt(f.values()),!1).find(function(D){return D.enabled&&(D.from===b&&D.to===K||D.bidirectional&&D.from===K&&D.to===b)})};function O(b,K){var D,le,Q,fe;if(b===K)return[b];for(var _=new Map([[b,0]]),j=new Map,se=new Set([b]);se.size;){var ye=Nt([],Wt(se),!1).sort(function(Lr,zr){return _.get(Lr)-_.get(zr)||(Lr<zr?-1:Lr>zr?1:0)})[0];if(se.delete(ye),ye===K)break;try{for(var H=(D=void 0,Ci(ee(ye))),de=H.next();!de.done;de=H.next()){var ze=de.value,Ae=ze.from===ye?ze.to:ze.from,ce=oe(Ae),$e=G(Ae),je=ce?ce.parameters.holdSeconds*90+(q(ce)?0:ce.parameters.closedSeconds*90):0,lr=_.get(ye)+Rn(G(ye),$e)/ze.speedScale+ze.cost+((Q=$e.cost)!==null&&Q!==void 0?Q:0)+je;lr>=((fe=_.get(Ae))!==null&&fe!==void 0?fe:1/0)||(_.set(Ae,lr),j.set(Ae,ye),se.add(Ae))}}catch(Lr){D={error:Lr}}finally{try{de&&!de.done&&(le=H.return)&&le.call(H)}finally{if(D)throw D.error}}}if(!_.has(K))return[];for(var Sr=[K],Tr=K;Tr!==b;)Tr=j.get(Tr),Sr.unshift(Tr);return Sr}function Te(b){var K,D=b.route.length>=2&&b.segment<b.route.length-1;if(!D){var le=(K=b.route[Math.min(b.segment,b.route.length-1)])!==null&&K!==void 0?K:b.startNode,Q=O(le,b.target);b.route=Q.length?Q:[le],b.segment=0,b.distance=0,b.arrived=!1,b.active=b.route.length>=2;return}var fe=b.route[b.segment],_=b.route[b.segment+1],j=Rn(G(fe),G(_));if(b.arrived||b.distance>=j-1e-4){var Q=O(_,b.target);b.route=Q.length?Q:[_],b.segment=0,b.distance=0,b.arrived=!1,b.active=b.route.length>=2;return}var se=O(_,b.target);b.route=se.length?Nt([fe],Wt(se),!1):[fe,_],b.segment=0}function Se(b){var K,D=O(b.startNode,b.targetNode),le=G(b.startNode),Q=D.length>=2?G(D[1]):le,fe=D.length>=2?Math.atan2(Q.y-le.y,Q.x-le.x):0,_=Math.floor((fe%(Math.PI*2)+Math.PI*2+1e-6)%(Math.PI*2)/(Math.PI/2))%4,j=pn(pn({},b),{loop:(K=b.loop)!==null&&K!==void 0?K:"none",originNode:b.startNode,destinationNode:b.targetNode,target:b.targetNode,networkId:t,route:D.length?D:[b.startNode],segment:0,distance:0,x:le.x,y:le.y,heading:fe,frame:[0,1,2,3][_],flipX:Math.cos(fe)<0,hold:0,arrived:!1,active:b.active&&D.length>=2,blockedTicks:0,blockedEmitted:!1,speedMultiplier:1});return S.set(j.id,j),j}function be(b){if(Le("pathArrive",b,b.target),b.loop==="none"){b.active=!1;return}var K=b.target,D=b.loop==="ping-pong"?K===b.destinationNode?b.originNode:b.destinationNode:K===b.originNode?b.destinationNode:b.originNode;b.startNode=K,b.target=D,b.route=O(K,D),b.segment=0,b.distance=0,b.arrived=!1,b.route.length<2&&(b.active=!1)}function Le(b,K,D){c(b,{componentId:K.id,nodeId:D})}function Z(b,K){var D,le,Q=b.route[b.segment+1],fe=oe(Q);if(fe&&!q(fe)){b.blockedTicks++,b.blockedTicks>=30&&!b.blockedEmitted&&(b.blockedEmitted=!0,Le("pathBlocked",b,Q));return}if(!b.arrived){if(b.arrived=!0,b.segment+1===b.route.length-1){Q===b.target?be(b):(b.active=!1,b.blockedEmitted||(b.blockedEmitted=!0,Le("pathBlocked",b,Q)));return}b.hold=Math.max((D=G(Q).holdSeconds)!==null&&D!==void 0?D:0,(le=fe==null?void 0:fe.parameters.holdSeconds)!==null&&le!==void 0?le:0)}if(b.hold>0){b.hold=Math.max(0,b.hold-K),b.blockedTicks++,b.blockedTicks>=30&&!b.blockedEmitted&&(b.blockedEmitted=!0,Le("pathBlocked",b,Q));return}b.segment++,b.distance=0,b.arrived=!1,b.blockedTicks=0,b.blockedEmitted=!1}function ve(b,K){var D,le;if(b.spacing<=0)return K;var Q=b.route[b.segment],fe=b.route[b.segment+1],_=Rn(G(Q),G(fe)),j=_-b.distance,se=K;try{for(var ye=Ci(W.values()),H=ye.next();!H.done;H=ye.next()){var de=H.value;if(!(de.id===b.id||!de.active||de.route.length<2||de.segment>=de.route.length-1)){var ze=de.route[de.segment],Ae=de.route[de.segment+1],ce=1/0;if(ze===Q&&Ae===fe&&(de.distance>b.distance||de.distance===b.distance&&de.id<b.id))ce=de.distance-b.distance;else if(ze===fe)ce=j+de.distance;else if(Ae===fe&&ze!==Q){var $e=Rn(G(ze),G(Ae))-de.distance;$e<b.spacing&&($e<j||$e===j&&de.id<b.id)&&(ce=j)}ce<1/0&&(se=Math.min(se,Math.max(0,ce-b.spacing)))}}}catch(je){D={error:je}}finally{try{H&&!H.done&&(le=ye.return)&&le.call(ye)}finally{if(D)throw D.error}}return se}function ae(b){var K=G(b.route[b.segment]),D=G(b.route[b.segment+1]),le=Rn(K,D),Q=cl(b.distance/Math.max(1e-4,le),0,1),fe=K.x+(D.x-K.x)*Q,_=K.y+(D.y-K.y)*Q,j=Math.atan2(D.y-K.y,D.x-K.x),se=Math.min(b.cornerRadius,le/3),ye=b.route[b.segment+2];if(se>0&&ye){var H=G(ye),de=Rn(D,H),ze=Math.min(se,de/3);if(b.distance>le-se){var Ae={x:D.x-(D.x-K.x)/le*se,y:D.y-(D.y-K.y)/le*se},ce={x:D.x+(H.x-D.x)/de*ze,y:D.y+(H.y-D.y)/de*ze},$e=cl((b.distance-(le-se))/(se*2),0,.5),je=1-$e;fe=je*je*Ae.x+2*je*$e*D.x+$e*$e*ce.x,_=je*je*Ae.y+2*je*$e*D.y+$e*$e*ce.y;var lr=2*je*(D.x-Ae.x)+2*$e*(ce.x-D.x),Sr=2*je*(D.y-Ae.y)+2*$e*(ce.y-D.y);Math.abs(lr)+Math.abs(Sr)>.001&&(j=Math.atan2(Sr,lr))}}return{x:fe,y:_,heading:j}}function me(b){var K,D,le,Q;re+=b,U++;var fe=Nt([],Wt(S.values()),!1).sort(function(pt,_e){return pt.id<_e.id?-1:pt.id>_e.id?1:0}),_=fe.length?U%fe.length:0,j=Nt(Nt([],Wt(fe.slice(_)),!1),Wt(fe.slice(0,_)),!1);try{for(var se=Ci(j),ye=se.next();!ye.done;ye=se.next()){var H=ye.value;if(!(!H.active||H.route.length<2||H.segment>=H.route.length-1)){var de=H.route[H.segment],ze=H.route[H.segment+1],Ae=Rn(G(de),G(ze));if(!(H.distance>=Ae-1e-4&&(Z(H,b),!H.active||H.route.length<2||H.segment>=H.route.length-1))){var ce=H.route[H.segment],$e=H.route[H.segment+1],je=Rn(G(ce),G($e)),lr=je-H.distance,Sr=(Q=(le=y(ce,$e))===null||le===void 0?void 0:le.speedScale)!==null&&Q!==void 0?Q:1,Tr=Math.min(lr,H.speed*Sr*Math.max(0,H.speedMultiplier)*b),Lr=ve(H,Tr);Lr<=1e-4?(H.blockedTicks++,H.blockedTicks>=30&&!H.blockedEmitted&&(H.blockedEmitted=!0,Le("pathBlocked",H,$e))):(H.distance+=Lr,H.blockedTicks=0,H.blockedEmitted=!1);var zr=ae(H);H.x=zr.x,H.y=zr.y,H.heading=zr.heading;var Rt=Math.floor((H.heading%(Math.PI*2)+Math.PI*2+1e-6)%(Math.PI*2)/(Math.PI/2))%4;H.frame=[0,1,2,3][Rt],H.flipX=Math.cos(H.heading)<0}}}}catch(pt){K={error:pt}}finally{try{ye&&!ye.done&&(D=se.return)&&D.call(se)}finally{if(K)throw K.error}}}function R(){return{id:t,nodeCount:P.size,edgeCount:f.size,activeAgents:Nt([],Wt(S.values()),!1).filter(function(b){return b.active}).length,queuedAgents:Nt([],Wt(S.values()),!1).filter(function(b){return b.active&&b.blockedTicks>0}).length,agents:Nt([],Wt(S.values()),!1).map(function(b){var K;return{id:b.id,x:b.x,y:b.y,heading:b.heading,frame:(K=b.frame)!==null&&K!==void 0?K:0,flipX:!!b.flipX,active:b.active,targetNode:b.target,route:Nt([],Wt(b.route),!1),segment:b.segment,distance:b.distance,blocked:b.blockedTicks>0}})}}return{addAgent:Se,removeAgent:function(b){return S.delete(b)},getAgent:function(b){return S.get(b)},setTarget:function(b,K){var D=S.get(b);return!D||!G(K)?!1:(D.target=K,D.destinationNode=K,D.active=!0,Te(D),!0)},setEdge:function(b,K,D){var le,Q,fe=f.get(b);if(!fe)return!1;fe.enabled=K,D!==void 0&&(fe.cost=D);try{for(var _=Ci(S.values()),j=_.next();!j.done;j=_.next()){var se=j.value;Te(se)}}catch(ye){le={error:ye}}finally{try{j&&!j.done&&(Q=_.return)&&Q.call(_)}finally{if(le)throw le.error}}return!0},setGate:function(b,K,D){var le,Q,fe=w.get(b);if(!fe)return!1;fe.parameters=pn(pn({},fe.parameters),{mode:K,holdSeconds:D});try{for(var _=Ci(S.values()),j=_.next();!j.done;j=_.next()){var se=j.value;Te(se)}}catch(ye){le={error:ye}}finally{try{j&&!j.done&&(Q=_.return)&&Q.call(_)}finally{if(le)throw le.error}}return!0},tick:me,snapshot:R}}var Pi=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},aa=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},oa=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},la={A:["01110","10001","10001","11111","10001","10001","10001"],B:["11110","10001","10001","11110","10001","10001","11110"],C:["01111","10000","10000","10000","10000","10000","01111"],D:["11110","10001","10001","10001","10001","10001","11110"],E:["11111","10000","10000","11110","10000","10000","11111"],F:["11111","10000","10000","11110","10000","10000","10000"],G:["01111","10000","10000","10111","10001","10001","01111"],H:["10001","10001","10001","11111","10001","10001","10001"],I:["11111","00100","00100","00100","00100","00100","11111"],J:["00111","00010","00010","00010","10010","10010","01100"],K:["10001","10010","10100","11000","10100","10010","10001"],L:["10000","10000","10000","10000","10000","10000","11111"],M:["10001","11011","10101","10101","10001","10001","10001"],N:["10001","11001","10101","10011","10001","10001","10001"],O:["01110","10001","10001","10001","10001","10001","01110"],P:["11110","10001","10001","11110","10000","10000","10000"],Q:["01110","10001","10001","10001","10101","10010","01101"],R:["11110","10001","10001","11110","10100","10010","10001"],S:["01111","10000","10000","01110","00001","00001","11110"],T:["11111","00100","00100","00100","00100","00100","00100"],U:["10001","10001","10001","10001","10001","10001","01110"],V:["10001","10001","10001","10001","10001","01010","00100"],W:["10001","10001","10001","10101","10101","10101","01010"],X:["10001","10001","01010","00100","01010","10001","10001"],Y:["10001","10001","01010","00100","00100","00100","00100"],Z:["11111","00001","00010","00100","01000","10000","11111"],0:["01110","10001","10011","10101","11001","10001","01110"],1:["00100","01100","00100","00100","00100","00100","01110"],2:["01110","10001","00001","00010","00100","01000","11111"],3:["11110","00001","00001","01110","00001","00001","11110"],4:["00010","00110","01010","10010","11111","00010","00010"],5:["11111","10000","10000","11110","00001","00001","11110"],6:["01110","10000","10000","11110","10001","10001","01110"],7:["11111","00001","00010","00100","01000","01000","01000"],8:["01110","10001","10001","01110","10001","10001","01110"],9:["01110","10001","10001","01111","00001","00001","01110"],"!":["00100","00100","00100","00100","00100","00000","00100"],"?":["01110","10001","00001","00010","00100","00000","00100"],".":["00000","00000","00000","00000","00000","00110","00110"],",":["00000","00000","00000","00000","00110","00110","00100"],":":["00000","00110","00110","00000","00110","00110","00000"],"+":["00000","00100","00100","11111","00100","00100","00000"],"-":["00000","00000","00000","11111","00000","00000","00000"],"/":["00001","00010","00010","00100","01000","01000","10000"],"'":["00100","00100","00000","00000","00000","00000","00000"]," ":["000","000","000","000","000","000","000"]},Ti=function(e){var t,n,a,l,i=0;try{for(var v=Pi(e),c=v.next();!c.done;c=v.next()){var P=c.value;i+=((l=(a=la[P])===null||a===void 0?void 0:a[0].length)!==null&&l!==void 0?l:5)+1}}catch(f){t={error:f}}finally{try{c&&!c.done&&(n=v.return)&&n.call(v)}finally{if(t)throw t.error}}return Math.max(0,i-1)},Df=function(e,t){var n,a,l=[],i="";try{for(var v=Pi(e),c=v.next();!c.done;c=v.next()){var P=c.value;i&&Ti(i+P)>t&&(l.push(i),i=""),i+=P}}catch(f){n={error:f}}finally{try{c&&!c.done&&(a=v.return)&&a.call(v)}finally{if(n)throw n.error}}return i&&l.push(i),l};function Hf(e,t,n){var a,l,i,v,c;n===void 0&&(n=1);var P=Math.max(1,Math.floor(t/Math.max(1,n))),f=[];try{for(var w=Pi(String(e).toUpperCase().split(`
|
|
2
|
+
`)),S=w.next();!S.done;S=w.next()){var W=S.value,re=W.split(/\s+/).filter(Boolean);if(!re.length){f.push("");continue}var U="";try{for(var G=(i=void 0,Pi(re)),oe=G.next();!oe.done;oe=G.next()){var q=oe.value;if(Ti(q)>P){U&&f.push(U);var ee=Df(q,P);f.push.apply(f,oa([],aa(ee.slice(0,-1)),!1)),U=(c=ee.at(-1))!==null&&c!==void 0?c:""}else{var y=U?U+" "+q:q;Ti(y)<=P?U=y:(U&&f.push(U),U=q)}}}catch(O){i={error:O}}finally{try{oe&&!oe.done&&(v=G.return)&&v.call(G)}finally{if(i)throw i.error}}U&&f.push(U)}}catch(O){a={error:O}}finally{try{S&&!S.done&&(l=w.return)&&l.call(w)}finally{if(a)throw a.error}}return f}var yl=function(e){var t,n=Math.max(0,(t=e.padding)!==null&&t!==void 0?t:4),a=e.pixelPanel&&e.padding===void 0;return{x:a?8:n,y:a?4:n}},Ff=function(e,t,n,a){var l,i=t.wrap===!1?String(e).toUpperCase().split(`
|
|
3
|
+
`):Hf(e,a,n),v=i.slice(0,16),c=Math.round(n*8*((l=t.lineHeight)!==null&&l!==void 0?l:1.2));return{allLines:i,lines:v,renderedWidth:Math.max.apply(Math,oa([0],aa(v.map(function(P){return Ti(P)*n})),!1)),renderedHeight:(v.length-1)*c+7*n}};function _a(e,t){for(var n,a=yl(t),l=Math.max(0,t.width-2*a.x),i=Math.max(0,t.height-2*a.y),v=Math.max(1,Math.floor(t.fontSize/8)),c=t.autoFit===!1?v:Math.min(v,Math.max(1,Math.ceil(((n=t.minFontSize)!==null&&n!==void 0?n:12)/8))),P=oa([],aa(new Set(oa([],aa(String(e).toUpperCase()),!1).filter(function(U){return U!==`
|
|
4
|
+
`&&!la[U]}))),!1),f,w=v;w>=c;w--){var S=Ff(e,t,w,l),W=S.renderedWidth>l,re=S.allLines.length>16||S.renderedHeight>i;if(f={lines:S.lines,scale:w,fontSize:w*8,renderedWidth:S.renderedWidth,renderedHeight:S.renderedHeight,overflowsWidth:W,overflowsHeight:re,unsupportedChars:P},t.autoFit===!1||!W&&!re)break}return f}function pl(e,t,n){var a,l=_a(t,n),i=l.lines,v=l.scale,c=yl(n),P=Math.max(0,n.width-2*c.x),f=Math.max(0,n.height-2*c.y),w=Math.round(l.fontSize*((a=n.lineHeight)!==null&&a!==void 0?a:1.2)),S=c.y+(f-l.renderedHeight)/2;return e.fillStyle=n.color,i.forEach(function(W,re){var U,G,oe,q=Ti(W)*v,ee=n.align==="left"?c.x:n.align==="right"?n.width-q-c.x:c.x+(P-q)/2,y=ee;try{for(var O=Pi(W),Te=O.next();!Te.done;Te=O.next()){var Se=Te.value,be=(oe=la[Se])!==null&&oe!==void 0?oe:la["?"];be.forEach(function(Le,Z){for(var ve=0;ve<Le.length;ve++)Le[ve]==="1"&&e.fillRect(Math.round(y+ve*v),Math.round(S+re*w+Z*v),v,v)}),y+=(be[0].length+1)*v}}catch(Le){U={error:Le}}finally{try{Te&&!Te.done&&(G=O.return)&&G.call(O)}finally{if(U)throw U.error}}}),l}var on=function(){return on=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},on.apply(this,arguments)},ro=Math.PI*2,Pr=function(e,t){return((Math.imul(e+1,2654435769)^Math.imul(t,2246822507))>>>0)/4294967296};function to(e,t,n){var a,l,i=[e.color,e.color2,e.color3].filter(Boolean),v=((a=e.spread)!==null&&a!==void 0?a:360)*Math.PI/180,c=((l=e.direction)!==null&&l!==void 0?l:-90)*Math.PI/180;return Array.from({length:e.count},function(P,f){var w,S,W=c+((f+.2+Pr(f,1)*.6)/e.count-.5)*v,re=e.speed*(.42+.65*Pr(f,2));return on(on({},t),{clipId:n,shape:"pixel-confetti",age:-.12*Pr(f,3),vx:Math.cos(W)*re,vy:Math.sin(W)*re,gravity:(w=e.gravity)!==null&&w!==void 0?w:250,life:((S=e.lifetime)!==null&&S!==void 0?S:.7)*(.6+.4*Pr(f,4)),color:i[f%i.length],size:3+Math.floor(3*Pr(f,5)),angle:ro*Pr(f,6),spin:(Pr(f,7)-.5)*12})})}function ml(e){var t=Math.min(12,Math.ceil(Math.sqrt(e.count))),n=Math.ceil(e.count/t),a=e.speed;return to(e).map(function(l,i){return on(on({},l),{screen:!0,x:(i%t+.15+.7*Pr(i,8))/t,y:(Math.floor(i/t)+.15+.7*Pr(i,9))/n,vx:a*(Pr(i,10)-.5)*.7,vy:a*(.3+.5*Pr(i,11)),size:l.size+1})})}var da=function(e,t){return(e%t+t)%t};function gl(e,t,n){var a=t.x,l=t.y,i=t.vx,v=t.vy,c=t.age,P=t.life,f=t.gravity,w=t.size,S=t.angle,W=t.spin,re=t.color;if(!(c<0)){var U=i*c,G=v*c+f*c*c/2,oe=Math.round(n?n.x+da(a*n.width+U,n.width):a+U),q=Math.round(n?n.y+da(l*n.height+G,n.height):l+G),ee=Math.round((S+W*c)/(Math.PI/4))&3;if(e.globalAlpha*=Math.min(1,(P-c)*4),e.fillStyle="#3c293388",ee===0)e.fillRect(oe-w+1,q+1,w*2+1,w+1);else if(ee===2)e.fillRect(oe+1,q-w+1,w+1,w*2+1);else for(var y=-1;y<=1;y++)e.fillRect(oe+y*w+1,q+y*w*(ee===1?1:-1)+1,w+1,w+1);if(e.fillStyle=re,ee===0)e.fillRect(oe-w,q,w*2,w);else if(ee===2)e.fillRect(oe,q-w,w,w*2);else for(var y=-1;y<=1;y++)e.fillRect(oe+y*w,q+y*w*(ee===1?1:-1),w,w)}}function no(e,t,n){var a,l,i=[e.color,e.color2,e.color3,"#ff6b6b","#4ecdc4","#fff3b0"].filter(Boolean),v=((a=e.spread)!==null&&a!==void 0?a:360)*Math.PI/180,c=((l=e.direction)!==null&&l!==void 0?l:-90)*Math.PI/180;return Array.from({length:e.count},function(P,f){var w,S,W=c+((f+.2+Pr(f,11)*.6)/e.count-.5)*v,re=e.speed*(.45+.65*Pr(f,12));return on(on({},t),{clipId:n,shape:"confetti",age:-.15*Pr(f,13),vx:Math.cos(W)*re,vy:Math.sin(W)*re,gravity:(w=e.gravity)!==null&&w!==void 0?w:140,life:((S=e.lifetime)!==null&&S!==void 0?S:2.6)*(.75+.35*Pr(f,14)),color:i[f%i.length],size:5+Math.floor(5*Pr(f,15)),kind:f%5===0?"star":"ribbon",angle:ro*Pr(f,16),spin:(Pr(f,17)-.5)*5.5,flutter:1.6+2.2*Pr(f,18),phase:ro*Pr(f,19)})})}function xl(e){var t=Math.min(14,Math.ceil(Math.sqrt(e.count))),n=Math.ceil(e.count/t),a=e.speed;return no(e,{x:0,y:0}).map(function(l,i){var v;return on(on({},l),{screen:!0,x:(i%t+.12+.76*Pr(i,20))/t,y:(Math.floor(i/t)+.08+.84*Pr(i,21))/n,vx:a*(Pr(i,22)-.5)*.65,vy:a*(.38+.55*Pr(i,23)),gravity:Math.min((v=e.gravity)!==null&&v!==void 0?v:90,90)})})}function Il(e,t,n){var a=t.x,l=t.y,i=t.vx,v=t.vy,c=t.age,P=t.life,f=t.gravity,w=t.size,S=t.angle,W=t.spin,re=t.flutter,U=t.phase,G=t.color,oe=t.kind;if(!(c<0)){var q=Math.sin(c*re+U)*14,ee=i*c+q,y=v*c+f*c*c/2,O=n?n.x+da(a*n.width+ee,n.width):a+ee,Te=n?n.y+da(l*n.height+y,n.height):l+y,Se=Math.min(1,c*2.8,(P-c)*2.2);if(!(Se<=0)){e.save(),e.globalAlpha*=Se,e.translate(O,Te),e.rotate(S+W*c);var be=Math.cos(c*re*1.4+U);if(e.scale(1,Math.max(.22,Math.abs(be))),e.fillStyle=G,oe==="star"){var Le=w*.85;e.beginPath();for(var Z=0;Z<8;Z++){var ve=Z%2===0?Le:Le*.38,ae=Z*Math.PI/4;Z===0?e.moveTo(Math.cos(ae)*ve,Math.sin(ae)*ve):e.lineTo(Math.cos(ae)*ve,Math.sin(ae)*ve)}e.closePath(),e.fill()}else e.fillRect(-w*.7,-w*.34,w*1.4,w*.68),e.fillStyle="#ffffff55",e.fillRect(-w*.7,-w*.34,w*1.4,w*.2);e.restore()}}}function bl(e,t,n,a,l){var i=t.width,v=t.height;if(!(i<=0||v<=0)){var c=Math.min(3,Math.floor(Math.min(i,v)/8));if(!c){e.fillStyle=n,e.fillRect(0,0,i,v);return}var P=a?c*2:0,f=v-(a?c:c*3),w=l>=0?.5+.5*Math.sin(l*4):0;t.enabled&&!a&&l>=0&&(e.save(),e.shadowColor="#ffd05a99",e.shadowBlur=8+w*9,e.fillStyle=n,e.fillRect(c,P+c,i-2*c,v-P-2*c),e.restore()),e.fillStyle=t.stroke,e.fillRect(c,0,i-2*c,v),e.fillRect(0,c,i,v-2*c),e.fillStyle=n,e.fillRect(c,P+c,i-2*c,v-P-2*c),e.fillStyle="#431d1380",e.fillRect(c,f,i-2*c,v-c-f),e.fillStyle=t.enabled?"#fff4be":"#ffffff55",e.fillRect(2*c,P+c,i-4*c,a?c:c*2),e.fillStyle="#ffffff55",e.fillRect(c,P+3*c,c,Math.max(0,f-P-3*c)),e.fillStyle="#521b2444",e.fillRect(i-2*c,P+3*c,c,Math.max(0,f-P-3*c));var S=l>=0?l%1.9:-1,W=(S-.1)/.55;if(t.enabled&&!a&&W>=0&&W<1){e.save(),e.beginPath(),e.rect(2*c,P+3*c,i-4*c,Math.max(0,f-P-3*c)),e.clip();for(var re=Math.floor(((i+14*c)*W-6*c)/c)*c,U=P+3*c,G=0;U<f;U+=c,G++){var oe=re-Math.floor(G/2)*c;e.fillStyle="#fff4be44",e.fillRect(oe-2*c,U,9*c,c),e.fillStyle="#fffef0aa",e.fillRect(oe,U,4*c,c)}e.restore()}if(t.enabled&&!a&&l>=0){var q=Math.max(0,Math.sin(l*4.2)),ee=Math.max(0,Math.sin(l*4.2+2.2)),y=function(O,Te,Se){if(!(Se<.25)){e.save(),e.globalAlpha*=Se*.95,e.fillStyle="#fffef4";var be=Se>.65?c*2:c;e.fillRect(Math.round(O-be),Math.round(Te-c/2),be*2+c,c),e.fillRect(Math.round(O-c/2),Math.round(Te-be),c,be*2+c),e.restore()}};y(5*c,P+4*c,q),y(i-6*c,P+5*c,ee)}}}function fa(e,t,n,a,l,i){var v=Math.max(0,Math.min(i,a/2,l/2));e.beginPath(),typeof e.roundRect=="function"?e.roundRect(t,n,a,l,v):(e.moveTo(t+v,n),e.arcTo(t+a,n,t+a,n+l,v),e.arcTo(t+a,n+l,t,n+l,v),e.arcTo(t,n+l,t,n,v),e.arcTo(t,n,t+a,n,v),e.closePath())}function eo(e,t,n,a,l){if(!(l<=.02||a<=.5)){e.save(),e.translate(t,n),e.globalAlpha*=l,e.fillStyle="#fffef0",e.beginPath();for(var i=0;i<8;i++){var v=i%2===0?a:a*.24,c=i*Math.PI/4;i===0?e.moveTo(Math.cos(c)*v,Math.sin(c)*v):e.lineTo(Math.cos(c)*v,Math.sin(c)*v)}e.closePath(),e.fill(),e.restore()}}function wl(e,t,n,a,l){var i,v,c,P=t.width,f=t.height;if(!(P<=0||f<=0)){var w=Math.min((i=t.radius)!==null&&i!==void 0?i:16,P/2,f/2),S=a?2:6,W=a?3:0,re=l>=0?.5-.5*Math.cos(l*2.4):0;t.enabled&&!a&&l>=0&&(e.save(),e.shadowColor="#ffd23f99",e.shadowBlur=10+re*12,fa(e,0,W,P,f-W,w),e.fillStyle=n,e.fill(),e.restore()),e.save(),fa(e,0,W+2,P,Math.max(4,f-W-2),w),e.fillStyle="#0e2830",e.fill(),e.restore(),e.save(),fa(e,0,W,P,Math.max(4,f-S),w),e.fillStyle=n,e.fill(),e.clip();var U=(v=e.createLinearGradient)===null||v===void 0?void 0:v.call(e,0,W,0,f-S);if(U!=null&&U.addColorStop&&(U.addColorStop(0,"#ffffffa8"),U.addColorStop(.42,"#ffffff26"),U.addColorStop(.45,"#00000000"),U.addColorStop(1,"#00000024"),e.fillStyle=U,e.fillRect(0,W,P,f-S)),e.fillStyle="#fffef0bb",e.fillRect(w*.55,W+3,Math.max(0,P-w*1.1),3),t.enabled&&!a&&l>=0){var G=(l%2.4-.15)/.95;if(G>0&&G<1){var oe=G*G*(3-2*G),q=Math.sin(G*Math.PI),ee=-P*.36+P*1.72*oe;e.save(),e.globalAlpha*=q,e.translate(ee,W),e.transform(1,0,-.36,1,0,0);var y=(c=e.createLinearGradient)===null||c===void 0?void 0:c.call(e,-48,0,48,0);y!=null&&y.addColorStop?(y.addColorStop(0,"#ffffff00"),y.addColorStop(.32,"#ffffff48"),y.addColorStop(.5,"#fffef8cc"),y.addColorStop(.68,"#ffffff48"),y.addColorStop(1,"#ffffff00"),e.fillStyle=y,e.fillRect(-48,0,96,f)):(e.fillStyle="#fffef8a8",e.fillRect(-14,0,28,f)),e.restore()}}if(e.restore(),t.strokeWidth&&(e.save(),fa(e,0,W,P,Math.max(4,f-S),w),e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,e.stroke(),e.restore()),t.enabled&&!a&&l>=0){var O=Math.max(0,Math.sin(l*2.4)),Te=O*O,Se=Math.max(0,Math.sin(l*2.4+2.1)),be=Se*Se,Le=Math.max(0,Math.sin(l*2.4+4.2)),Z=Le*Le;eo(e,P*.12,W+9,4+Te*6,Te*.92),eo(e,P*.88,W+10,3.8+be*5.5,be*.9),eo(e,P*.76,Math.max(W+14,f-S-8),3+Z*4.2,Z*.8)}}}function ua(e){if(/\s/.test(e)||e.length>512)return!1;var t=/^https:\/\/play\.google\.com\/store\/apps\/details\?id=[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_]*){1,9}$/,n=/^https:\/\/apps\.apple\.com\/([a-z]{2}\/)?app\/([a-zA-Z0-9-]+\/)?id[1-9][0-9]{5,19}$/;return t.test(e)&&!/id=example\.|[.=]placeholder(\.|$)|id=com\.example(\.|$)/.test(e)||n.test(e)}var Ei=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ai=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},io=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))};function Ml(e){var t,n,a;e===void 0&&(e={});var l=(t=e.timeoutMs)!==null&&t!==void 0?t:5e3,i=(n=e.pollMs)!==null&&n!==void 0?n:25;if(![l,i].every(function(Q){return Number.isFinite(Q)&&Q>=1&&Q<=6e4}))throw Error("Invalid Unity host deadline/poll interval");var v=(a=e.getHost)!==null&&a!==void 0?a:(function(){return window.mraid}),c=new Set,P=new Set,f=[],w={},S=!1,W=!1,re=!1,U=!1,G=!1,oe=!1,q,ee,y,O,Te,Se,be=function(){return re||U};function Le(){var Q,fe,_;clearTimeout(Te),clearTimeout(Se);try{for(var j=Ei(f.splice(0)),se=j.next();!se.done;se=j.next()){var ye=Ai(se.value,2),H=ye[0],de=ye[1];try{(_=w.mraid)===null||_===void 0||_.removeEventListener(H,de)}catch{}}}catch(ze){Q={error:ze}}finally{try{se&&!se.done&&(fe=j.return)&&fe.call(j)}finally{if(Q)throw Q.error}}}function Z(Q){O==null||O(Q instanceof Error?Q:Error(String(Q))),y=void 0,O=void 0}function ve(Q){var fe,_;if(!be()){var j=S;if(re=!0,S=!1,W=!1,Le(),Z(Q),j)try{for(var se=Ei(io([],Ai(P),!1)),ye=se.next();!ye.done;ye=se.next()){var H=ye.value;H()}}catch(de){fe={error:de}}finally{try{ye&&!ye.done&&(_=se.return)&&_.call(se)}finally{if(fe)throw fe.error}}c.clear(),P.clear()}}function ae(Q,fe){return f.push([Q,fe]),w.mraid.addEventListener(Q,fe),me(Q,fe)}function me(Q,fe){if(be()){try{w.mraid.removeEventListener(Q,fe)}catch{}return!1}return!0}function R(Q){var fe,_;if(!be()){if(typeof Q!="boolean"){ve(Error("Invalid Unity viewability event"));return}if(!S){q=Q;return}if(W!==Q){W=Q;try{for(var j=Ei(io([],Ai(c),!1)),se=j.next();!se.done;se=j.next()){var ye=se.value;if(be())break;ye(W)}}catch(H){fe={error:H}}finally{try{se&&!se.done&&(_=j.return)&&_.call(j)}finally{if(fe)throw fe.error}}}}}var b=function(Q){Q==="hidden"&&ve(Error("Unity host closed"))},K=function(){var Q;S&&!be()&&((Q=e.onResize)===null||Q===void 0||Q.call(e))};function D(){var Q,fe,_,j;if(!(!G||S||oe||be())){oe=!0;try{var se=w.mraid.getState();if(be()||se==="loading")return;if(se==="hidden")throw Error("Unity host closed before ready");if(!["default","expanded","resized"].includes(se))throw Error("Invalid Unity host state");var ye=w.mraid.getVersion();if(be())return;if(ye!=="3.0")throw Error("Unity Ads UA requires MRAID 3.0");try{for(var H=Ei([["viewableChange",R],["stateChange",b],["sizeChange",K]]),de=H.next();!de.done;de=H.next()){var ze=Ai(de.value,2),Ae=ze[0],ce=ze[1];if(!ae(Ae,ce))return}}catch(Tr){Q={error:Tr}}finally{try{de&&!de.done&&(fe=H.return)&&fe.call(H)}finally{if(Q)throw Q.error}}var $e=w.mraid.isViewable();if(be())return;if(typeof $e!="boolean")throw Error("Invalid Unity initial viewability");W=q!=null?q:$e,S=!0,clearTimeout(Te),clearTimeout(Se),y==null||y(),y=void 0,O=void 0;try{for(var je=Ei(io([],Ai(c),!1)),lr=je.next();!lr.done;lr=je.next()){var Sr=lr.value;if(be())break;Sr(W)}}catch(Tr){_={error:Tr}}finally{try{lr&&!lr.done&&(j=je.return)&&j.call(je)}finally{if(_)throw _.error}}}catch(Tr){ve(Tr)}finally{oe=!1}}}function le(){if(!be())try{var Q=v();if(be())return;if(!Q){Se=setTimeout(le,i);return}if(w.mraid=Q,f.push(["ready",D]),w.mraid.addEventListener("ready",D),!me("ready",D))return;G=!0,D()}catch(fe){ve(fe)}}return{init:function(){return ee||(ee=new Promise(function(Q,fe){y=Q,O=fe}),be()?(Z(Error("Unity bridge destroyed")),ee):(Te=setTimeout(function(){return ve(Error("Unity MRAID readiness timed out"))},l),le(),ee))},isReady:function(){return S&&!be()},isVisible:function(){return S&&W&&!be()},isClosed:be,onVisibilityChanged:function(Q){return be()||c.add(Q),function(){return c.delete(Q)}},onClosed:function(Q){return be()||P.add(Q),function(){return P.delete(Q)}},openStore:function(Q){if(!S||!W||be()||!ua(Q))throw Error("Unity store request not permitted");w.mraid.open(Q)},destroy:function(){U||(U=!0,S=!1,W=!1,Le(),Z(Error("Unity bridge destroyed")),c.clear(),P.clear())}}}var ai=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},oi=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},ao=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))};function kl(e){var t;e===void 0&&(e={});var n=(t=e.getHost)!==null&&t!==void 0?t:(function(){return window.mraid}),a,l=!1,i=!1,v=!1,c=!1,P=!1,f,w,S,W,re,U=new Set,G=new Set,oe=[];function q(){var ae,me;clearTimeout(W),clearTimeout(re);try{for(var R=ai(oe.splice(0)),b=R.next();!b.done;b=R.next()){var K=oi(b.value,2),D=K[0],le=K[1];try{a==null||a.removeEventListener(D,le)}catch{}}}catch(Q){ae={error:Q}}finally{try{b&&!b.done&&(me=R.return)&&me.call(R)}finally{if(ae)throw ae.error}}}function ee(ae,me){if(oe.push([ae,me]),a.addEventListener(ae,me),v||c){try{a.removeEventListener(ae,me)}catch{}return!1}return!0}function y(ae){var me=ae instanceof Error?ae:Error(String(ae));S==null||S(me),w=void 0,S=void 0}function O(ae,me){var R,b;if(!(v||c)&&(v=!0,l=!1,i=!1,q(),y(ae),me))try{for(var K=ai(ao([],oi(G),!1)),D=K.next();!D.done;D=K.next()){var le=D.value;le()}}catch(Q){R={error:Q}}finally{try{D&&!D.done&&(b=K.return)&&b.call(K)}finally{if(R)throw R.error}}}function Te(){var ae,me,R,b;if(!(!P||l||v||c))try{var K=a.getState();if(v||c||K==="loading")return;if(K==="hidden"){O(Error("MRAID closed before ready"),!0);return}if(!["default","expanded","resized"].includes(K))throw Error("Invalid MRAID state");try{for(var D=ai([["viewableChange",be],["stateChange",Le],["sizeChange",Z]]),le=D.next();!le.done;le=D.next()){var Q=oi(le.value,2),fe=Q[0],_=Q[1];if(!ee(fe,_))return}}catch(H){ae={error:H}}finally{try{le&&!le.done&&(me=D.return)&&me.call(D)}finally{if(ae)throw ae.error}}var j=a.isViewable();if(v||c)return;if(typeof j!="boolean")throw Error("Invalid MRAID viewability");i=j,l=!0,clearTimeout(W),clearTimeout(re),w==null||w(),w=void 0,S=void 0;try{for(var se=ai(ao([],oi(U),!1)),ye=se.next();!ye.done;ye=se.next()){var _=ye.value;_(i)}}catch(H){R={error:H}}finally{try{ye&&!ye.done&&(b=se.return)&&b.call(se)}finally{if(R)throw R.error}}}catch(H){O(H,l)}}var Se=function(){return Te()},be=function(ae){var me,R;if(!(!l||v||c)){if(typeof ae!="boolean"){O(Error("Invalid MRAID visibility event"),!0);return}i=ae;try{for(var b=ai(ao([],oi(U),!1)),K=b.next();!K.done;K=b.next()){var D=K.value;D(i)}}catch(le){me={error:le}}finally{try{K&&!K.done&&(R=b.return)&&R.call(b)}finally{if(me)throw me.error}}}},Le=function(ae){ae==="hidden"&&O(Error("MRAID closed"),!0)},Z=function(){var ae;l&&!v&&!c&&((ae=e.onResize)===null||ae===void 0||ae.call(e))};function ve(){var ae,me,R;if(!(v||c))try{if(a=n(),v||c)return;if(!a){re=setTimeout(ve,(R=e.pollMs)!==null&&R!==void 0?R:50);return}if(![a.getState,a.isViewable,a.addEventListener,a.removeEventListener,a.open].every(function(fe){return typeof fe=="function"}))throw Error("Incomplete MRAID 2 interface");try{for(var b=ai([["ready",Se]]),K=b.next();!K.done;K=b.next()){var D=oi(K.value,2),le=D[0],Q=D[1];if(!ee(le,Q))return}}catch(fe){ae={error:fe}}finally{try{K&&!K.done&&(me=b.return)&&me.call(b)}finally{if(ae)throw ae.error}}P=!0,Te()}catch(fe){O(fe,!1)}}return{init:function(){var ae;return f||(f=new Promise(function(me,R){w=me,S=R}),v||c?(y(Error("MRAID bridge destroyed")),f):(W=setTimeout(function(){return O(Error("MRAID readiness timed out"),!1)},(ae=e.timeoutMs)!==null&&ae!==void 0?ae:5e3),ve(),f))},isReady:function(){return l&&!v&&!c},isVisible:function(){return i&&l&&!v&&!c},isClosed:function(){return v||c},onVisibilityChanged:function(ae){return!v&&!c&&U.add(ae),function(){return U.delete(ae)}},onClosed:function(ae){return!v&&!c&&G.add(ae),function(){return G.delete(ae)}},openStore:function(ae){if(!l||!i||v||c||!ua(ae))throw Error("MRAID store request not permitted");a.open(ae)},destroy:function(){c||(c=!0,l=!1,i=!1,q(),y(Error("MRAID bridge destroyed")),U.clear(),G.clear())}}}var Un=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Gn=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},Ri=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))};function Sl(e){e===void 0&&(e={});var t=new Set,n=new Set,a=new Set,l=[],i,v=!1,c=!1,P=!1,f=!1,w,S,W,re,U,G=function(){return P||f};function oe(){var Z,ve;clearTimeout(re),clearTimeout(U);try{for(var ae=Un(l.splice(0)),me=ae.next();!me.done;me=ae.next()){var R=Gn(me.value,2),b=R[0],K=R[1];try{i==null||i.removeEventListener(b,K)}catch{}}}catch(D){Z={error:D}}finally{try{me&&!me.done&&(ve=ae.return)&&ve.call(ae)}finally{if(Z)throw Z.error}}}function q(Z){var ve,ae;if(!G()){P=!0,v=!1,c=!1,oe(),W==null||W(Z instanceof Error?Z:Error(String(Z))),S=void 0,W=void 0;try{for(var me=Un(Ri([],Gn(n),!1)),R=me.next();!R.done;R=me.next()){var b=R.value;b()}}catch(K){ve={error:K}}finally{try{R&&!R.done&&(ae=me.return)&&ae.call(me)}finally{if(ve)throw ve.error}}}}var ee=function(Z){if(!(typeof Z!="number"||!Number.isFinite(Z)||Z<0))return Math.min(1,Z>1?Z/100:Z)},y=function(Z){if(typeof Z=="boolean")return Z;if(Z&&typeof Z=="object"&&typeof Z.isViewable=="boolean")return Z.isViewable},O=function(){var Z,ve,ae,me,R,b;if(!(v||G()||!i||((R=i.isReady)===null||R===void 0?void 0:R.call(i))===!1))try{c=i.isViewable();var K=(b=i.getAudioVolume)===null||b===void 0?void 0:b.call(i),D=K===void 0?void 0:ee(K);if(typeof c!="boolean"||K!==void 0&&D===void 0)throw Error("Invalid DAPI initial state");if(v=!0,clearTimeout(re),clearTimeout(U),S==null||S(),S=void 0,W=void 0,D!==void 0)try{for(var le=Un(Ri([],Gn(a),!1)),Q=le.next();!Q.done;Q=le.next()){var fe=Q.value;fe(D)}}catch(se){Z={error:se}}finally{try{Q&&!Q.done&&(ve=le.return)&&ve.call(le)}finally{if(Z)throw Z.error}}try{for(var _=Un(Ri([],Gn(t),!1)),j=_.next();!j.done;j=_.next()){var fe=j.value;fe(c)}}catch(se){ae={error:se}}finally{try{j&&!j.done&&(me=_.return)&&me.call(_)}finally{if(ae)throw ae.error}}}catch(se){q(se)}},Te=function(Z){var ve,ae;if(!G()){var me=y(Z);if(me===void 0){q(Error("Invalid DAPI visibility"));return}c=me;try{for(var R=Un(Ri([],Gn(t),!1)),b=R.next();!b.done;b=R.next()){var K=b.value;K(me)}}catch(D){ve={error:D}}finally{try{b&&!b.done&&(ae=R.return)&&ae.call(R)}finally{if(ve)throw ve.error}}}},Se=function(Z){var ve,ae;if(!G()){var me=ee(Z);if(me===void 0){q(Error("Invalid DAPI volume"));return}try{for(var R=Un(Ri([],Gn(a),!1)),b=R.next();!b.done;b=R.next()){var K=b.value;K(me)}}catch(D){ve={error:D}}finally{try{b&&!b.done&&(ae=R.return)&&ae.call(R)}finally{if(ve)throw ve.error}}}},be=function(){var Z;v&&!G()&&((Z=e.onResize)===null||Z===void 0||Z.call(e))};function Le(){var Z,ve,ae;if(!G()){if(i=window.dapi,!i){U=setTimeout(Le,(ae=e.pollMs)!==null&&ae!==void 0?ae:25);return}try{try{for(var me=Un([["ready",O],["viewableChange",Te],["audioVolumeChange",Se],["adResized",be]]),R=me.next();!R.done;R=me.next()){var b=Gn(R.value,2),K=b[0],D=b[1];l.push([K,D]),i.addEventListener(K,D)}}catch(le){Z={error:le}}finally{try{R&&!R.done&&(ve=me.return)&&ve.call(me)}finally{if(Z)throw Z.error}}O()}catch(le){q(le)}}}return{init:function(){var Z;return w||(w=new Promise(function(ve,ae){S=ve,W=ae}),G()?(W==null||W(Error("DAPI bridge closed")),w):(re=setTimeout(function(){return q(Error("DAPI readiness timed out"))},(Z=e.timeoutMs)!==null&&Z!==void 0?Z:5e3),Le(),w))},isReady:function(){return v&&!G()},isVisible:function(){return v&&c&&!G()},isClosed:G,onVisibilityChanged:function(Z){return G()||t.add(Z),function(){return t.delete(Z)}},onClosed:function(Z){return G()||n.add(Z),function(){return n.delete(Z)}},onVolumeChanged:function(Z){return G()||a.add(Z),function(){return a.delete(Z)}},openStore:function(){if(!v||!c||G()||typeof(i==null?void 0:i.openStoreUrl)!="function")throw Error("DAPI store host unavailable");i.openStoreUrl()},destroy:function(){f||(f=!0,v=!1,c=!1,oe(),W==null||W(Error("DAPI bridge destroyed")),t.clear(),n.clear(),a.clear())}}}var Xf=function(e,t,n,a){function l(i){return i instanceof n?i:new n(function(v){v(i)})}return new(n||(n=Promise))(function(i,v){function c(w){try{f(a.next(w))}catch(S){v(S)}}function P(w){try{f(a.throw(w))}catch(S){v(S)}}function f(w){w.done?i(w.value):l(w.value).then(c,P)}f((a=a.apply(e,t||[])).next())})},Uf=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,l,i,v=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return v.next=c(0),v.throw=c(1),v.return=c(2),typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function c(f){return function(w){return P([f,w])}}function P(f){if(a)throw new TypeError("Generator is already executing.");for(;v&&(v=0,f[0]&&(n=0)),n;)try{if(a=1,l&&(i=f[0]&2?l.return:f[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,f[1])).done)return i;switch(l=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,l=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){n.label=f[1];break}if(f[0]===6&&n.label<i[1]){n.label=i[1],i=f;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(f);break}i[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(w){f=[6,w],l=0}finally{a=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},Gf=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},Yf=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},Zf=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Cl(){var e=new Set,t=!1,n=!1,a=!1,l=function(){var i,v;if(!a){n=document.visibilityState!=="hidden";try{for(var c=Zf(Yf([],Gf(e),!1)),P=c.next();!P.done;P=c.next()){var f=P.value;f(n)}}catch(w){i={error:w}}finally{try{P&&!P.done&&(v=c.return)&&v.call(c)}finally{if(i)throw i.error}}}};return{init:function(){return Xf(this,void 0,void 0,function(){return Uf(this,function(i){switch(i.label){case 0:if(a)throw Error("Meta bridge destroyed");return document.readyState!=="loading"?[3,2]:[4,new Promise(function(v){return document.addEventListener("DOMContentLoaded",function(){return v()},{once:!0})})];case 1:i.sent(),i.label=2;case 2:if(a)throw Error("Meta bridge destroyed");return document.addEventListener("visibilitychange",l),n=document.visibilityState!=="hidden",t=!0,l(),[2]}})})},isReady:function(){return t&&!a},isVisible:function(){return t&&n&&!a},isClosed:function(){return a},onVisibilityChanged:function(i){return a||e.add(i),function(){return e.delete(i)}},onClosed:function(){return function(){}},openStore:function(){var i=window.FbPlayableAd;if(!t||!n||a||typeof(i==null?void 0:i.onCTAClick)!="function")throw Error("Meta CTA host unavailable");i.onCTAClick()},destroy:function(){a=!0,t=!1,n=!1,document.removeEventListener("visibilitychange",l),e.clear()}}}var $f=function(e,t,n,a){function l(i){return i instanceof n?i:new n(function(v){v(i)})}return new(n||(n=Promise))(function(i,v){function c(w){try{f(a.next(w))}catch(S){v(S)}}function P(w){try{f(a.throw(w))}catch(S){v(S)}}function f(w){w.done?i(w.value):l(w.value).then(c,P)}f((a=a.apply(e,t||[])).next())})},Kf=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,l,i,v=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return v.next=c(0),v.throw=c(1),v.return=c(2),typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function c(f){return function(w){return P([f,w])}}function P(f){if(a)throw new TypeError("Generator is already executing.");for(;v&&(v=0,f[0]&&(n=0)),n;)try{if(a=1,l&&(i=f[0]&2?l.return:f[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,f[1])).done)return i;switch(l=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,l=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){n.label=f[1];break}if(f[0]===6&&n.label<i[1]){n.label=i[1],i=f;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(f);break}i[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(w){f=[6,w],l=0}finally{a=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},Qf=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},Jf=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},qf=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Pl(){var e=new Set,t=!1,n=!1,a=!1,l=function(){var i,v;if(!a){n=document.visibilityState!=="hidden";try{for(var c=qf(Jf([],Qf(e),!1)),P=c.next();!P.done;P=c.next()){var f=P.value;f(n)}}catch(w){i={error:w}}finally{try{P&&!P.done&&(v=c.return)&&v.call(c)}finally{if(i)throw i.error}}}};return{init:function(){return $f(this,void 0,void 0,function(){return Kf(this,function(i){switch(i.label){case 0:if(a)throw Error("Google Ads bridge destroyed");return document.readyState!=="loading"?[3,2]:[4,new Promise(function(v){return document.addEventListener("DOMContentLoaded",function(){return v()},{once:!0})})];case 1:i.sent(),i.label=2;case 2:if(a)throw Error("Google Ads bridge destroyed");return document.addEventListener("visibilitychange",l),n=document.visibilityState!=="hidden",t=!0,l(),[2]}})})},isReady:function(){return t&&!a},isVisible:function(){return t&&n&&!a},isClosed:function(){return a},onVisibilityChanged:function(i){return a||e.add(i),function(){return e.delete(i)}},onClosed:function(){return function(){}},openStore:function(){var i=window.ExitApi;if(!t||!n||a||typeof(i==null?void 0:i.exit)!="function")throw Error("Google ExitApi unavailable");i.exit()},destroy:function(){a=!0,t=!1,n=!1,document.removeEventListener("visibilitychange",l),e.clear()}}}var jf=function(e,t,n,a){function l(i){return i instanceof n?i:new n(function(v){v(i)})}return new(n||(n=Promise))(function(i,v){function c(w){try{f(a.next(w))}catch(S){v(S)}}function P(w){try{f(a.throw(w))}catch(S){v(S)}}function f(w){w.done?i(w.value):l(w.value).then(c,P)}f((a=a.apply(e,t||[])).next())})},_f=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,l,i,v=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return v.next=c(0),v.throw=c(1),v.return=c(2),typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function c(f){return function(w){return P([f,w])}}function P(f){if(a)throw new TypeError("Generator is already executing.");for(;v&&(v=0,f[0]&&(n=0)),n;)try{if(a=1,l&&(i=f[0]&2?l.return:f[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,f[1])).done)return i;switch(l=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,l=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){n.label=f[1];break}if(f[0]===6&&n.label<i[1]){n.label=i[1],i=f;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(f);break}i[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(w){f=[6,w],l=0}finally{a=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},oo=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},lo=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},fo=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Tl(){var e=window,t=new Set,n=new Set,a=e.gameStart,l=e.gameClose,i=!1,v=!1,c=!1,P=!1,f=function(){var S,W;if(!(c||P)){var re=!v||!i;if(i=!0,v=!0,re)try{for(var U=fo(lo([],oo(t),!1)),G=U.next();!G.done;G=U.next()){var oe=G.value;oe(!0)}}catch(q){S={error:q}}finally{try{G&&!G.done&&(W=U.return)&&W.call(U)}finally{if(S)throw S.error}}}},w=function(){var S,W,re,U;if(!(c||P)){i=!1,v=!1,c=!0;try{for(var G=fo(lo([],oo(t),!1)),oe=G.next();!oe.done;oe=G.next()){var q=oe.value;q(!1)}}catch(O){S={error:O}}finally{try{oe&&!oe.done&&(W=G.return)&&W.call(G)}finally{if(S)throw S.error}}try{for(var ee=fo(lo([],oo(n),!1)),y=ee.next();!y.done;y=ee.next()){var q=y.value;q()}}catch(O){re={error:O}}finally{try{y&&!y.done&&(U=ee.return)&&U.call(ee)}finally{if(re)throw re.error}}}};return e.gameStart=f,e.gameClose=w,{init:function(){return jf(this,void 0,void 0,function(){return _f(this,function(S){if(c||P)throw Error("Mintegral bridge closed");if(typeof e.gameReady!="function")throw Error("Mintegral gameReady host unavailable");return e.gameReady(),[2]})})},isReady:function(){return i&&!c&&!P},isVisible:function(){return i&&v&&!c&&!P},isClosed:function(){return c||P},onVisibilityChanged:function(S){return!c&&!P&&t.add(S),function(){return t.delete(S)}},onClosed:function(S){return!c&&!P&&n.add(S),function(){return n.delete(S)}},notifyGameEnd:function(){var S;!c&&!P&&((S=e.gameEnd)===null||S===void 0||S.call(e))},notifyGameRetry:function(){var S;!c&&!P&&((S=e.gameRetry)===null||S===void 0||S.call(e))},openStore:function(){if(!i||!v||c||P||typeof e.install!="function")throw Error("Mintegral install host unavailable");e.install()},destroy:function(){P||(P=!0,i=!1,v=!1,e.gameStart===f&&(a?e.gameStart=a:delete e.gameStart),e.gameClose===w&&(l?e.gameClose=l:delete e.gameClose),t.clear(),n.clear())}}}var ed=function(e,t,n,a){function l(i){return i instanceof n?i:new n(function(v){v(i)})}return new(n||(n=Promise))(function(i,v){function c(w){try{f(a.next(w))}catch(S){v(S)}}function P(w){try{f(a.throw(w))}catch(S){v(S)}}function f(w){w.done?i(w.value):l(w.value).then(c,P)}f((a=a.apply(e,t||[])).next())})},rd=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,l,i,v=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return v.next=c(0),v.throw=c(1),v.return=c(2),typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function c(f){return function(w){return P([f,w])}}function P(f){if(a)throw new TypeError("Generator is already executing.");for(;v&&(v=0,f[0]&&(n=0)),n;)try{if(a=1,l&&(i=f[0]&2?l.return:f[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,f[1])).done)return i;switch(l=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,l=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){n.label=f[1];break}if(f[0]===6&&n.label<i[1]){n.label=i[1],i=f;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(f);break}i[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(w){f=[6,w],l=0}finally{a=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},td=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},nd=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},id=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function El(){var e=new Set,t=!1,n=!1,a=!1,l=function(){var i,v;if(!a){n=document.visibilityState!=="hidden";try{for(var c=id(nd([],td(e),!1)),P=c.next();!P.done;P=c.next()){var f=P.value;f(n)}}catch(w){i={error:w}}finally{try{P&&!P.done&&(v=c.return)&&v.call(c)}finally{if(i)throw i.error}}}};return{init:function(){return ed(this,void 0,void 0,function(){return rd(this,function(i){switch(i.label){case 0:if(a)throw Error("TikTok bridge destroyed");return document.readyState!=="loading"?[3,2]:[4,new Promise(function(v){return document.addEventListener("DOMContentLoaded",function(){return v()},{once:!0})})];case 1:i.sent(),i.label=2;case 2:if(a)throw Error("TikTok bridge destroyed");return document.addEventListener("visibilitychange",l),n=document.visibilityState!=="hidden",t=!0,l(),[2]}})})},isReady:function(){return t&&!a},isVisible:function(){return t&&n&&!a},isClosed:function(){return a},onVisibilityChanged:function(i){return a||e.add(i),function(){return e.delete(i)}},onClosed:function(){return function(){}},openStore:function(){var i,v,c=window,P=typeof c.openAppStore=="function"?c.openAppStore.bind(c):(v=(i=c.playableSDK)===null||i===void 0?void 0:i.openAppStore)===null||v===void 0?void 0:v.bind(c.playableSDK);if(!t||!n||a||!P)throw Error("TikTok store host unavailable");P()},destroy:function(){a=!0,t=!1,n=!1,document.removeEventListener("visibilitychange",l),e.clear()}}}var ge=function(){return ge=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},ge.apply(this,arguments)},ad=function(e,t,n,a){function l(i){return i instanceof n?i:new n(function(v){v(i)})}return new(n||(n=Promise))(function(i,v){function c(w){try{f(a.next(w))}catch(S){v(S)}}function P(w){try{f(a.throw(w))}catch(S){v(S)}}function f(w){w.done?i(w.value):l(w.value).then(c,P)}f((a=a.apply(e,t||[])).next())})},od=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,l,i,v=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return v.next=c(0),v.throw=c(1),v.return=c(2),typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function c(f){return function(w){return P([f,w])}}function P(f){if(a)throw new TypeError("Generator is already executing.");for(;v&&(v=0,f[0]&&(n=0)),n;)try{if(a=1,l&&(i=f[0]&2?l.return:f[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,f[1])).done)return i;switch(l=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,l=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){n.label=f[1];break}if(f[0]===6&&n.label<i[1]){n.label=i[1],i=f;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(f);break}i[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(w){f=[6,w],l=0}finally{a=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},$=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},ie=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},J=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Rl(e){if(e!=="standalone"){if(e==="unity-ads-ua-playable")return Ml();if(e==="applovin-growth-playable")return kl();if(e==="ironsource-levelplay-playable")return Sl();if(e==="meta-audience-playable")return Cl();if(e==="google-ads-app-playable")return Pl();if(e==="mintegral-appgrowth-zip")return Tl();if(e==="tiktok-ads-playable")return El();throw Error("E_NATIVE_TARGET")}}function uo(e){var t,n,a,l,i=(t=e.left)!==null&&t!==void 0?t:0,v=(n=e.top)!==null&&n!==void 0?n:0,c=(a=e.right)!==null&&a!==void 0?a:i+e.width,P=(l=e.bottom)!==null&&l!==void 0?l:v+e.height,f=[{id:"sdk-top-left",left:i,top:v,right:Math.min(i+48,c),bottom:Math.min(v+48,P)},{id:"sdk-top-right",left:Math.max(i,c-56),top:v,right:c,bottom:Math.min(v+56,P)},{id:"sdk-bottom-left",left:i,top:Math.max(v,P-28),right:Math.min(i+48,c),bottom:P}];return{left:Math.min(i+48,c),top:Math.min(v+56,P),right:Math.max(i,c-56),bottom:Math.max(v,P-28),zones:f}}function va(e,t){var n,a,l=(a=(n=e.measureText)===null||n===void 0?void 0:n.call(e,t))===null||a===void 0?void 0:a.width,i=/(\d+(?:\.\d+)?)px/.exec(e.font||"");return Number.isFinite(l)?l:ie([],$(t),!1).length*(i?Number(i[1]):16)*.6}function Al(e,t,n,a){var l,i,v,c,P,f,w;e.font=n.fontWeight+" "+a+"px "+n.fontFamily;var S=Math.max(0,n.width-2*((w=n.padding)!==null&&w!==void 0?w:4)),W=[];try{for(var re=J(String(t).split(`
|
|
5
|
+
`)),U=re.next();!U.done;U=re.next()){var G=U.value;if(n.wrap===!1){W.push(G);continue}var oe=G.trim()?G.trim().split(/\s+/):[""],q=void 0;try{for(var ee=(v=void 0,J(oe)),y=ee.next();!y.done;y=ee.next()){var O=y.value,Te=q?q+" "+O:O;if(va(e,Te)<=S){q=Te;continue}if(q&&W.push(q),va(e,O)<=S){q=O;continue}var Se="";try{for(var be=(P=void 0,J(O)),Le=be.next();!Le.done;Le=be.next()){var Z=Le.value;Se&&va(e,Se+Z)>S?(W.push(Se),Se=Z):Se+=Z}}catch(ve){P={error:ve}}finally{try{Le&&!Le.done&&(f=be.return)&&f.call(be)}finally{if(P)throw P.error}}q=Se}}catch(ve){v={error:ve}}finally{try{y&&!y.done&&(c=ee.return)&&c.call(ee)}finally{if(v)throw v.error}}W.push(q)}}catch(ve){l={error:ve}}finally{try{U&&!U.done&&(i=re.return)&&i.call(re)}finally{if(l)throw l.error}}return W}function Vl(e,t,n){var a,l,i=(a=n.padding)!==null&&a!==void 0?a:4,v=Math.max(0,n.width-2*i),c=Math.max(0,n.height-2*i),P=Math.min(n.fontSize,(l=n.minFontSize)!==null&&l!==void 0?l:12),f=n.fontSize,w=Al(e,t,n,f),S,W=function(){var re;e.font=n.fontWeight+" "+f+"px "+n.fontFamily;var U=Math.max.apply(Math,ie([0],$(w.map(function(ee){return va(e,ee)})),!1)),G=f*((re=n.lineHeight)!==null&&re!==void 0?re:1.2),oe=w.length>16;oe&&(w=w.slice(0,16));var q=w.length*G;return{lines:w,fontSize:f,scale:f/n.fontSize,renderedWidth:U,renderedHeight:q,availableWidth:v,availableHeight:c,padding:i,lineHeight:G,overflowsWidth:U>v+.01,overflowsHeight:oe||q>c+.01,unsupportedChars:[]}};if(S=W(),n.autoFit!==!1)for(;(S.overflowsWidth||S.overflowsHeight)&&f>P;)f=Math.max(P,f-1),w=Al(e,t,n,f),S=W();return S}function ld(e,t,n,a){a===void 0&&(a="en");var l=Vl(e,t,n),i=l.padding,v=n.direction==="rtl"||n.direction!=="ltr"&&/^(ar|fa|he|iw|ps|sd|ug|ur|yi)(?:-|$)/.test(a),c=v&&n.direction!=="rtl"?n.align==="left"?"right":n.align==="right"?"left":n.align:n.align;e.fillStyle=n.color,e.font=n.fontWeight+" "+l.fontSize+"px "+n.fontFamily,e.direction=v?"rtl":"ltr",e.textAlign=c,e.textBaseline="middle";var P=c==="left"?i:c==="right"?n.width-i:n.width/2,f=(n.height-l.renderedHeight)/2;return l.lines.forEach(function(w,S){return e.fillText(w,P,f+(S+.5)*l.lineHeight)}),ge(ge({},l),{direction:v?"rtl":"ltr",resolvedAlign:c,clipped:l.overflowsHeight})}function fd(e,t,n){var a,l,i,v,c,P,f=n===void 0?{}:n,w=f.edit,S=w===void 0?!1:w,W=f.sceneId,re=W===void 0?e.base.startScene:W,U=f.onSelect,G=U===void 0?function(){}:U,oe=f.network,q=oe===void 0?"standalone":oe,ee=Rl(q),y=t.getContext("2d"),O=new Map(e.components.map(function(r){return[r.id,r]})),Te=new Map(e.assets.map(function(r){return[r.id,r]})),Se=new Map,be=new Map(e.events.map(function(r){return[r.id,r]})),Le=new Map(e.gameplay.filter(function(r){return r.kind==="responsive-layout"}).map(function(r){return[r.componentId,r.parameters]})),Z=(i=globalThis.matchMedia)===null||i===void 0?void 0:i.call(globalThis,"(prefers-reduced-motion: reduce)"),ve,ae=new Map,me=ae;function R(){var r=Le.size>0&&t.clientWidth>t.clientHeight;return{width:r?Math.max(e.base.width,e.base.height):e.base.width,height:r?Math.min(e.base.width,e.base.height):e.base.height,landscape:r}}function b(){ve!==R().landscape&&(Qt(),tt())}var K=function(r){var o,d=Te.get(r);return((o=d==null?void 0:d.hash)!==null&&o!==void 0?o:r)+":"+r};try{for(var D=J(e.assets),le=D.next();!le.done;le=D.next()){var Q=le.value;if(Q.mime.startsWith("image/")&&!Se.has(K(Q.id))){var fe=new Image;fe.src="data:"+Q.mime+";base64,"+Q.data,Se.set(K(Q.id),fe)}}}catch(r){a={error:r}}finally{try{le&&!le.done&&(l=D.return)&&l.call(D)}finally{if(a)throw a.error}}var _=re,j={},se=[],ye=[],H=[],de=[],ze=new Set,Ae=new Map,ce=0,$e=0,je=0,lr=0,Sr=0,Tr=!1,Lr=0,zr=0,Rt=!1,pt=[],_e,mn,Ge,Gt,it,Lt,ln,Yt,Vt,Zt,Ot=[],mt,st=[],et=[],Wr,sa=0,Vi=!1,li=0,gn=q==="standalone",fi=q==="standalone",Yn=q==="standalone",Vn=!1,Oi=!1,Je=new Map,On=new Map,Ir=new Map,di=new Map,xn=new Set,vo=new Map,so=new Map,Zn=new Set,$n=new Map,Bi=new Map,ca=new Map,ha=new Map,In=new Map,Dt=new Map,ui=0,ya=0,Dr,rt,pa=1,ma,xt=new Map,co=new Map,Bt=new Map,$t=new Map,Bn=new Map,zn=new Map,zi=new Map,Vr=$o(),Kn=Jo(),Wi=new Map,Ni=new Map,Ht=el(Qa(e.projectId)),Qn=new Map,fn=new Map,Wn=new Map,Li=new Set,dn=new Map,Xe,Ol=1,Bl=1,br,bn,vi={x:0,y:0},Yr,Kt=[],wn=[],We=function(r){var o;return(o=Ir.get(r))!==null&&o!==void 0?o:O.get(r)},It=function(r,o){return e.gameplay.find(function(d){return d.kind===r&&d.componentId===o})},si=function(){var r,o;ui++,Zn.clear(),$n.clear(),ca.clear(),ha.clear();try{for(var d=J(xn),u=d.next();!u.done;u=d.next()){var s=u.value;try{s.stop()}catch{}}}catch(p){r={error:p}}finally{try{u&&!u.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}xn.clear(),Bi.clear()},ho=function(r){var o,d;if(!Xe||r!==void 0&&Xe.pointerId!==r)return!1;var u=Xe.pointerId;Xe.behavior.parameters.powerVariableId&&(j[Xe.behavior.parameters.powerVariableId]=0),Xe=void 0;try{!((o=t.hasPointerCapture)===null||o===void 0)&&o.call(t,u)&&((d=t.releasePointerCapture)===null||d===void 0||d.call(t,u))}catch{}return!0},ga=function(r){var o=r.behavior.parameters;o.axisXVariableId&&(j[o.axisXVariableId]=r.nx),o.axisYVariableId&&(j[o.axisYVariableId]=r.ny),o.magnitudeVariableId&&(j[o.magnitudeVariableId]=r.magnitude),o.angleVariableId&&r.magnitude>0&&(j[o.angleVariableId]=r.angle)},xa=function(r,o){var d,u,s,p;o===void 0&&(o=!1);try{for(var h=J(dn.values()),g=h.next();!g.done;g=h.next()){var x=g.value;if(!(x.pointerId===null||r!==void 0&&x.pointerId!==r)){var k=x.pointerId;x.pointerId=null,x.nx=0,x.ny=0,x.magnitude=0,x.knobX=x.origin.x,x.knobY=x.origin.y,ga(x);try{!((s=t.hasPointerCapture)===null||s===void 0)&&s.call(t,k)&&((p=t.releasePointerCapture)===null||p===void 0||p.call(t,k))}catch{}o&&rr(ot("joystickEnd",x.c))}}}catch(m){d={error:m}}finally{try{g&&!g.done&&(u=h.return)&&u.call(h)}finally{if(d)throw d.error}}},Di=function(r,o){var d,u;if(o===void 0&&(o=!0),!Ge||r!==void 0&&Ge.pointerId!==r)return!1;var s=Ge,p=s.pointerId;if(Ge=void 0,bn=void 0,o){var h=We(s.targetId);h&&s.b.parameters.snapBack&&(Jt(h,s.origin.x,s.origin.y),s.originZone&&Vr.place(h.id,s.originZone))}try{!((d=t.hasPointerCapture)===null||d===void 0)&&d.call(t,p)&&((u=t.releasePointerCapture)===null||u===void 0||u.call(t,p))}catch{}return!0},Ia=function(r){var o,d;(mt==null?void 0:mt.pointerId)===r.pointerId&&(mt=void 0);try{for(var u=J(In.values()),s=u.next();!s.done;s=u.next()){var p=s.value;p.pointerId===r.pointerId&&p.held&&(p.held=!1,p.releasedAt=ce)}}catch(g){o={error:g}}finally{try{s&&!s.done&&(d=u.return)&&d.call(u)}finally{if(o)throw o.error}}var h=Di(r.pointerId);return Lt===r.pointerId?(it=void 0,Lt=void 0,!0):h},Hi=function(r){var o,d,u,s,p,h,g,x;if(r){Ge&&((g=Ir.get(Ge.targetId))===null||g===void 0?void 0:g.instanceId)===r&&Di(void 0,!1),Xe&&((x=Ir.get(Xe.targetId))===null||x===void 0?void 0:x.instanceId)===r&&ho();var k=[];Vr.release(r),Kn.cancel(r),Qn.delete(r),Wn.delete(r),Ht.remove(r),se=se.filter(function(F){return F.id!==r});try{for(var m=J(Ir),C=m.next();!C.done;C=m.next()){var M=$(C.value,2),T=M[0],I=M[1];if(I.instanceId===r){k.push(T),Vr.release(T),Kn.cancel(T),Ir.delete(T),Je.delete(T),di.delete(T),Bt.delete(T),Bn.delete(T),zn.delete(T);try{for(var E=(u=void 0,J($t.values())),A=E.next();!A.done;A=E.next()){var z=A.value;z.removeAgent(T)}}catch(F){u={error:F}}finally{try{A&&!A.done&&(s=E.return)&&s.call(E)}finally{if(u)throw u.error}}try{for(var N=(p=void 0,J(On.keys())),L=N.next();!L.done;L=N.next()){var B=L.value;B.endsWith(":"+T)&&On.delete(B)}}catch(F){p={error:F}}finally{try{L&&!L.done&&(h=N.return)&&h.call(N)}finally{if(p)throw p.error}}}}}catch(F){o={error:F}}finally{try{C&&!C.done&&(d=m.return)&&d.call(m)}finally{if(o)throw o.error}}H=H.filter(function(F){return!k.includes(F.targetId)})}},Jn=function(r){for(;r;){if(r.prototype)return r.id;r=We(r.parentId)}},zl=function(){var r,o,d;return{viewport:R(),components:Object.fromEntries(ie([],$(Je),!1).map(function(u){var s=$(u,2),p=s[0],h=s[1];return[p,ge(ge({},h),{parameters:ge({},h.parameters)})]})),mode:S?"edit":"play",scene:_,variables:ge({},j),time:ce,instances:se.map(function(u){return ge({id:u.id,prototypeId:u.prototypeId,x:u.transform[4],y:u.transform[5]},Ht.snapshot(u.id))}),particles:ye.length,animations:H.length,contacts:ze.size,spriteFrames:Object.fromEntries(ie([],$(di),!1).map(function(u){var s,p=$(u,2),h=p[0],g=p[1];return[h,(s=g.frame)!==null&&s!==void 0?s:0]})),input:{dragging:!!Ge,pointerId:(o=(r=Ge==null?void 0:Ge.pointerId)!==null&&r!==void 0?r:br==null?void 0:br.pointerId)!==null&&o!==void 0?o:null,pressed:it!=null?it:null,holding:!!(br!=null&&br.holds.length),occupancy:Vr.snapshot(),joysticks:Object.fromEntries(ie([],$(dn),!1).map(function(u){var s=$(u,2),p=s[0],h=s[1];return[p,{active:h.pointerId!==null,x:h.nx,y:h.ny,magnitude:h.magnitude,angle:h.angle}]}))},feedback:{presses:In.size,floatingTexts:st.length,flashes:et.length,shaking:!!Wr,tutorialHands:li},match:{boards:Object.fromEntries(ie([],$(xt),!1).map(function(u){var s=$(u,2),p=s[0],h=s[1];return[p,h.snapshot()]})),selected:Dr!=null?Dr:null,cells:ie([],$(Dt),!1).map(function(u){var s=$(u,2),p=s[0],h=s[1];return ge({id:p},h)})},physics:Ul(),paths:Object.fromEntries(ie([],$($t),!1).map(function(u){var s=$(u,2),p=s[0],h=s[1];return[p,h.snapshot()]})),canvas:{masks:Object.fromEntries(ie([],$(Qn),!1).map(function(u){var s=$(u,2),p=s[0],h=s[1];return[p,{progress:h.progress}]})),strokes:Object.fromEntries(ie([],$(fn),!1).map(function(u){var s=$(u,2),p=s[0],h=s[1];return[p,h.strokes.length]})),walls:Kt.length,joints:wn.filter(function(u){return!u.broken}).length},audio:{state:(d=_e==null?void 0:_e.state)!==null&&d!==void 0?d:"locked",voices:xn.size,blocked:ya},network:{target:q,ready:fi,visible:Yn,started:gn,closed:Vn,hostVolume:pa},diagnostics:ie([],$(pt),!1)}},qn=function(){return!S&&!Tr&&!document.hidden&&fi&&Yn&&gn&&!Vn},Qt=function(){var r,o,d,u;mt=void 0,ho(),xa(),Di(),br=void 0,bn=void 0,Yr=void 0;try{for(var s=J(fn.values()),p=s.next();!p.done;p=s.next()){var h=p.value;h.cancel()}}catch(m){r={error:m}}finally{try{p&&!p.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}Kn.clear(),rt=void 0;try{for(var g=J(xt.values()),x=g.next();!x.done;x=g.next()){var k=x.value;k.cancelSelection()}}catch(m){d={error:m}}finally{try{x&&!x.done&&(u=g.return)&&u.call(g)}finally{if(d)throw d.error}}xt.size&&(Dr=void 0),it=void 0,Lt=void 0,In.clear()},at=function(r){Rt=!0,pt.push(r),pt=pt.slice(-16),de=[]},Wl=function(r){var o,d,u;return ge(ge(ge({},r.parameters),r.prototypeId?(o=Je.get(r.prototypeId))===null||o===void 0?void 0:o.parameters:{}),(u=Je.get((d=r.runtimeId)!==null&&d!==void 0?d:r.id))===null||u===void 0?void 0:u.parameters)};function He(r){var o=Wl(r);return o}function ba(r,o){var d,u=In.get(r.id);if(!u||Z!=null&&Z.matches)return o;var s=ie([],$(o),!1),p=u.held?0:ce-((d=u.releasedAt)!==null&&d!==void 0?d:ce),h=u.held?0:Math.min(1,p/u.behavior.springBackSeconds),g=u.held?u.behavior.scaleDown:u.behavior.scaleDown+(1-u.behavior.scaleDown)*(1-Math.pow(1-h,3)),x=He(r);s[4]+=(1-g)*(s[0]*x.width+s[2]*x.height)/2,s[5]+=(1-g)*(s[1]*x.width+s[3]*x.height)/2;for(var k=0;k<4;k++)s[k]*=g;return s}function Fi(r){return{left:0,top:0,right:r.width,bottom:r.height,width:r.width,height:r.height}}function bt(r){var o,d,u,s,p,h,g,x=r.transform,k=(u=(d=Je.get((o=r.runtimeId)!==null&&o!==void 0?o:r.id))===null||d===void 0?void 0:d.transform)!==null&&u!==void 0?u:x,m=Le.get((s=r.prototypeId)!==null&&s!==void 0?s:r.id);if(!m)return ba(r,k);var C=R(),M=ie([],$(k),!1);C.landscape&&(M[4]+=m.x-x[4],M[5]+=m.y-x[5],M[0]*=m.scaleX,M[1]*=m.scaleX,M[2]*=m.scaleY,M[3]*=m.scaleY);var T=(p=m.anchor)!==null&&p!==void 0?p:"none";if(T==="none"&&!m.respectSafeArea)return ba(r,M);var I=Fi(C),E=m.respectSafeArea?uo(I):I,A=He(r),z=(h=m.marginX)!==null&&h!==void 0?h:0,N=(g=m.marginY)!==null&&g!==void 0?g:0,L=Math.abs(M[0])*A.width+Math.abs(M[2])*A.height,B=Math.abs(M[1])*A.width+Math.abs(M[3])*A.height;return T!=="none"?(M[4]=T.endsWith("left")?E.left+z:T.endsWith("right")?E.right-L-z:(E.left+E.right-L)/2,M[5]=T.startsWith("top")?E.top+N:T.startsWith("bottom")?E.bottom-B-N:(E.top+E.bottom-B)/2):(M[4]=Math.max(E.left+z,Math.min(E.right-L-z,M[4])),M[5]=Math.max(E.top+N,Math.min(E.bottom-B-N,M[5]))),ba(r,M)}var Xi=function(r){return(Ir.has(r)?ie([],$(Ir.values()),!1):ie(ie([],$(e.components),!1),$(se),!1)).filter(function(o){return o.parentId===r&&!o.prototype}).sort(function(o,d){return o.order-d.order||(o.id<d.id?-1:o.id>d.id?1:0)})},yo=function(){return e.components.filter(function(r){return r.sceneId===_&&!r.parentId&&!r.prototype}).sort(function(r,o){return r.order-o.order||(r.id<o.id?-1:r.id>o.id?1:0)})},rr=function(r){var o,d;if(r.kind==="sceneEnter"&&((o=e.scenes.find(function(u){return u.id===r.sceneId}))===null||o===void 0?void 0:o.role)==="end-card"&&ma!==r.sceneId&&(ma=r.sceneId,(d=ee==null?void 0:ee.notifyGameEnd)===null||d===void 0||d.call(ee)),de.length>=256){at("Event queue budget exhausted");return}de.push(r)},ot=function(r,o,d,u){var s,p,h,g;return u===void 0&&(u={}),ge(ge({kind:r,componentId:(s=o.prototypeId)!==null&&s!==void 0?s:o.id,selfInstanceId:(p=o.instanceId)!==null&&p!==void 0?p:o.id,instanceId:o.instanceId},d?{otherId:(h=d.prototypeId)!==null&&h!==void 0?h:d.id,otherInstanceId:(g=d.instanceId)!==null&&g!==void 0?g:d.id}:{}),u)};function wa(r){for(var o,d=r;d;d=We(d.parentId)){var u=Ht.states.get((o=d.instanceId)!==null&&o!==void 0?o:d.id);if(u)return u}}function po(r){var o,d,u=It("instance-state",(o=r.prototypeId)!==null&&o!==void 0?o:r.id);return u?Ht.initialize((d=r.instanceId)!==null&&d!==void 0?d:r.id,u.parameters):void 0}function Nl(){var r,o,d,u;try{for(var s=J(e.gameplay.filter(function(m){return m.kind==="instance-state"})),p=s.next();!p.done;p=s.next()){var h=p.value;try{for(var g=(d=void 0,J(Hr(O.get(h.componentId)))),x=g.next();!x.done;x=g.next()){var k=x.value;po(k)}}catch(m){d={error:m}}finally{try{x&&!x.done&&(u=g.return)&&u.call(g)}finally{if(d)throw d.error}}}}catch(m){r={error:m}}finally{try{p&&!p.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}function Ll(r,o,d,u){var s=wa(r);if(s){var p=s.hp;if(o==="tag")s.tag=d==="set"?String(u):s.tag;else{var h=Number(u);if(s[o]=d==="add"?s[o]+h:d==="sub"?s[o]-h:h,!Number.isFinite(s[o])){at("Instance state range exceeded");return}o==="hp"&&(s.hp=Math.max(0,Math.min(s.maxHp,s.hp)))}p>0&&s.hp<=0&&rr(ot("instanceDepleted",r))}}function Ui(r,o){var d,u,s;if(!r)return!0;if(r.all)return r.all.every(function(k){return Ui(k,o)});if(r.any)return r.any.some(function(k){return Ui(k,o)});var p=r.instanceTarget==="other"?o==null?void 0:o.otherInstanceId:(d=o==null?void 0:o.selfInstanceId)!==null&&d!==void 0?d:o==null?void 0:o.instanceId,h=r.instanceField?(u=We(p))!==null&&u!==void 0?u:ie([],$(Ir.values()),!1).find(function(k){return k.instanceId===p}):void 0,g=r.instanceField?(s=wa(h))===null||s===void 0?void 0:s[r.instanceField]:j[r.variableId],x=r.compareVariableId?j[r.compareVariableId]:r.value;return{eq:function(){return g===x},ne:function(){return g!==x},lt:function(){return g<x},lte:function(){return g<=x},gt:function(){return g>x},gte:function(){return g>=x}}[r.op]()}function mo(r){var o,d,u;Dr=void 0,rt=void 0,r||Dt.clear();try{for(var s=J(e.gameplay),p=s.next();!p.done;p=s.next()){var h=p.value;if(h.kind==="match-tile"){var g=O.get(h.componentId);if(r&&g.id!==r&&!wt(g,r))continue;Je.delete(g.id),Dt.set(g.id,{row:h.parameters.row,column:h.parameters.column,group:h.parameters.group,sceneId:g.sceneId,boardId:(u=g.parentId)!==null&&u!==void 0?u:g.sceneId})}}}catch(x){o={error:x}}finally{try{p&&!p.done&&(d=s.return)&&d.call(s)}finally{if(o)throw o.error}}}function Dl(){var r,o,d=function(h){var g,x;if(xt.has(h.componentId))return"continue";var k=h.componentId,m=h.parameters,C=e.gameplay.filter(function(B){return B.kind==="match-tile"&&O.get(B.componentId).parentId===k}).sort(function(B,F){return B.parameters.row-F.parameters.row||B.parameters.column-F.parameters.column}).map(function(B){return ge({id:B.componentId},B.parameters)}),M=new Map;try{for(var T=(g=void 0,J(C)),I=T.next();!I.done;I=T.next()){var E=I.value;if(!M.has(E.group)){var A=O.get(E.id);M.set(E.group,{fill:A.parameters.fill,children:Xi(E.id).filter(function(B){return["native.image.v1","native.text.v1"].includes(B.contract)})})}}}catch(B){g={error:B}}finally{try{I&&!I.done&&(x=T.return)&&x.call(T)}finally{if(g)throw g.error}}co.set(k,M);var z=O.get(C[m.columns].id).transform[5]-O.get(C[0].id).transform[5],N=function(B,F,Y){var X,te=Y.from,ue=te===void 0?B:te,ne=Y.progress,xe=ne===void 0?0:ne,Re=Y.offsetRows,Ne=Re===void 0?0:Re,Fe=Y.scale,pe=Fe===void 0?1:Fe,Ce=Y.opacity,we=Ce===void 0?1:Ce,Me=C[B],Ve=O.get(Me.id),he=O.get(C[ue].id),mr=M.get(F),Ee=ie([],$(Ve.transform),!1);Ee[4]+=(he.transform[4]-Ve.transform[4])*xe,Ee[5]+=(he.transform[5]-Ve.transform[5]+Ne*z)*xe,Ee[4]+=(1-pe)*(Ee[0]*Ve.parameters.width+Ee[2]*Ve.parameters.height)/2,Ee[5]+=(1-pe)*(Ee[1]*Ve.parameters.width+Ee[3]*Ve.parameters.height)/2;for(var fr=0;fr<4;fr++)Ee[fr]*=pe;Je.set(Me.id,ge(ge({},Je.get(Me.id)),{transform:Ee,parameters:ge(ge({},(X=Je.get(Me.id))===null||X===void 0?void 0:X.parameters),{fill:mr.fill,opacity:we})})),Dt.get(Me.id).group=F;var Pe=Xi(Me.id).filter(function(ar){return["native.image.v1","native.text.v1"].includes(ar.contract)});Pe.forEach(function(ar,Ue){var er,Cr,ur=mr.children[Ue];if(!(!ur||ur.contract!==ar.contract)){var Ke=(er=Je.get(ar.id))!==null&&er!==void 0?er:{transform:ie([],$(ar.transform),!1),parameters:{}};ar.contract==="native.image.v1"?Ke.assetId=(Cr=ur.assetSlots[0])===null||Cr===void 0?void 0:Cr.assetId:Ke.parameters.text=ur.parameters.text,Je.set(ar.id,Ke)}})},L=Go(ge(ge({},m),{slots:C,paint:N,onEvent:function(B){Dr=void 0,rr({kind:B,componentId:k})}}));xt.set(k,L)};try{for(var u=J(e.gameplay.filter(function(h){return h.kind==="match-board"})),s=u.next();!s.done;s=u.next()){var p=s.value;d(p)}}catch(h){r={error:h}}finally{try{s&&!s.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}}function go(r){var o,d;Dl();try{for(var u=J(xt),s=u.next();!s.done;s=u.next()){var p=$(s.value,2),h=p[0],g=p[1];(!r||r===h||wt(O.get(h),r))&&g.reset()}}catch(x){o={error:x}}finally{try{s&&!s.done&&(d=u.return)&&d.call(u)}finally{if(o)throw o.error}}}function Hr(r){return Jn(r)?ie([],$(Ir.values()),!1).filter(function(o){return o.prototypeId===r.id}):[r]}function Or(r){var o=He(r);return cr(yr(r),o.width/2,o.height/2)}function Nn(r,o,d){var u;d===void 0&&(d="self");var s=O.get(r),p=d==="other"?o.otherInstanceId:(u=o.selfInstanceId)!==null&&u!==void 0?u:o.instanceId,h=!!(s&&Jn(s));if(p!==void 0){if(r){var g=ie([],$(Ir.values()),!1).find(function(x){return x.prototypeId===r&&(x.instanceId===p||x.id===p)});if(g)return g}if(d==="other"||!r)return We(p);if(h&&typeof p=="string"&&p.startsWith("instance."))return}return s?h?Hr(s)[0]:We(r):void 0}function Jt(r,o,d){var u,s=He(r),p=(u=Je.get(r.id))!==null&&u!==void 0?u:{transform:ie([],$(r.transform),!1),parameters:{}},h=ie([],$(p.transform),!1),g=r.parentId?yr(We(r.parentId)):nn(),x=cr(Ut(g),o,d);h[4]=x.x-(h[0]*s.width+h[2]*s.height)/2,h[5]=x.y-(h[1]*s.width+h[3]*s.height)/2,Je.set(r.id,ge(ge({},p),{transform:h})),r.prototypeId&&(r.transform=ie([],$(h),!1))}function jn(r,o,d){var u,s,p,h;d===void 0&&(d=!1);var g=(u=Je.get(r.id))!==null&&u!==void 0?u:{transform:ie([],$(r.transform),!1),parameters:{}},x=(h=(p=O.get((s=r.prototypeId)!==null&&s!==void 0?s:r.id))===null||p===void 0?void 0:p.transform)!==null&&h!==void 0?h:r.transform,k=Math.hypot(x[0],x[1])*(d?-1:1),m=Math.hypot(x[2],x[3]),C=o+(d?0:Math.atan2(x[1],x[0])),M=Math.cos(C),T=Math.sin(C),I=ie([],$(g.transform),!1);I[0]=M*k,I[1]=T*k,I[2]=-T*m,I[3]=M*m,Je.set(r.id,ge(ge({},g),{transform:I}))}function Ln(r,o){var d=Bt.get(r.id);if(d)return d;var u=yr(r),s=He(r),p=cr(u,s.width/2,s.height/2);return d=ge({id:r.id,sourceId:o.componentId,instanceId:r.instanceId,x:p.x,y:p.y,vx:0,vy:0,width:Math.hypot(u[0],u[1])*s.width,height:Math.hypot(u[2],u[3])*s.height,angle:Math.atan2(u[1],u[0]),restElapsed:0,atRest:!0},o.parameters),Bt.set(r.id,d),d}function ci(r,o){var d,u=Qn.get(r.id);if(u)return u;var s=He(r),p=o.parameters;return u=rl(p,{width:s.width,height:s.height,source:r.contract==="native.image.v1"?Se.get(K((d=r.assetSlots[0])===null||d===void 0?void 0:d.assetId)):void 0,onProgress:function(h){p.progressVariableId&&(j[p.progressVariableId]=h),rr(ot("maskProgress",r))},onComplete:function(){return rr(ot("maskComplete",r))}}),Qn.set(r.id,u),u}function Hl(r){var o=fn.get(r.componentId);return o||(o=il(r.parameters),fn.set(r.componentId,o)),o}function xo(){var r,o,d,u,s,p,h,g,x,k,m,C,M=new Set,T=[];try{for(var I=J(e.gameplay.filter(function(Ee){return Ee.kind==="physics-body"})),E=I.next();!E.done;E=I.next()){var A=E.value,z=O.get(A.componentId);if(z.sceneId===_)try{for(var N=(d=void 0,J(Hr(z))),L=N.next();!L.done;L=N.next()){var B=L.value;if(Er(B)){if(T.length>=64){at("Physics body budget exhausted");break}var F=Ln(B,A),Y=yr(B),X=He(B),te=cr(Y,X.width/2,X.height/2);if(M.add(B.id),F.width=Math.hypot(Y[0],Y[1])*X.width,F.height=Math.hypot(Y[2],Y[3])*X.height,F.mode!=="dynamic"){var ue=Bn.get(B.id),ne=B.parentId?yr(We(B.parentId)):nn(),xe=(m=ue==null?void 0:ue.vx)!==null&&m!==void 0?m:0,Re=(C=ue==null?void 0:ue.vy)!==null&&C!==void 0?C:0;F.x=te.x,F.y=te.y,F.angle=Math.atan2(Y[1],Y[0]),F.vx=ne[0]*xe+ne[2]*Re,F.vy=ne[1]*xe+ne[3]*Re}else F.atRest&&(F.x=te.x,F.y=te.y);T.push(F)}}}catch(Ee){d={error:Ee}}finally{try{L&&!L.done&&(u=N.return)&&u.call(N)}finally{if(d)throw d.error}}}}catch(Ee){r={error:Ee}}finally{try{E&&!E.done&&(o=I.return)&&o.call(I)}finally{if(r)throw r.error}}try{for(var Ne=J(Bt.keys()),Fe=Ne.next();!Fe.done;Fe=Ne.next()){var pe=Fe.value;!M.has(pe)&&!Ir.has(pe)&&Bt.delete(pe)}}catch(Ee){s={error:Ee}}finally{try{Fe&&!Fe.done&&(p=Ne.return)&&p.call(Ne)}finally{if(s)throw s.error}}var Ce=[];try{for(var we=J(e.gameplay.filter(function(Ee){return Ee.kind==="capture-zone"})),Me=we.next();!Me.done;Me=we.next()){var A=Me.value,z=O.get(A.componentId);if(z.sceneId===_)try{for(var Ve=(x=void 0,J(Hr(z))),he=Ve.next();!he.done;he=Ve.next()){var B=he.value;if(Er(B)){var Y=yr(B),X=He(B),te=cr(Y,X.width/2,X.height/2),mr=Math.max(.1,Math.min(Math.hypot(Y[0],Y[1]),Math.hypot(Y[2],Y[3])));Ce.push(ge(ge({id:B.id,sourceId:z.id,instanceId:B.instanceId,x:te.x,y:te.y},A.parameters),{radius:A.parameters.radius*mr}))}}}catch(Pe){x={error:Pe}}finally{try{he&&!he.done&&(k=Ve.return)&&k.call(Ve)}finally{if(x)throw x.error}}}}catch(Ee){h={error:Ee}}finally{try{Me&&!Me.done&&(g=we.return)&&g.call(we)}finally{if(h)throw h.error}}return{bodies:ie(ie([],$(T),!1),$(Kt),!1),zones:Ce}}function Fl(r){var o,d,u,s,p,h,g,x=xo(),k=x.bodies,m=x.zones,C=R();wn=[];try{for(var M=J(e.gameplay.filter(function(ne){return ne.kind==="physics-joint"})),T=M.next();!T.done;T=M.next()){var I=T.value,E=O.get(I.componentId);if(E.sceneId===_){var A=We(I.parameters.anchorComponentId),z=It("physics-body",E.id);if(!(!A||!z))try{for(var N=(u=void 0,J(Hr(E))),L=N.next();!L.done;L=N.next()){var B=L.value;Ln(B,z);var F=Or(A),Y=I.id+":"+B.id;wn.push(ge(ge({},I.parameters),{id:I.id,key:Y,componentId:E.id,bodyId:B.id,anchorId:A.id,x:F.x,y:F.y,broken:Li.has(Y)}))}}catch(ne){u={error:ne}}finally{try{L&&!L.done&&(s=N.return)&&s.call(N)}finally{if(u)throw u.error}}}}}catch(ne){o={error:ne}}finally{try{T&&!T.done&&(d=M.return)&&d.call(M)}finally{if(o)throw o.error}}ja({bodies:k,zones:m,joints:wn,bounds:{left:0,top:0,right:C.width,bottom:C.height},dt:r,onEvent:function(ne,xe,Re){var Ne,Fe,pe,Ce;if(!(ne==="bodyBounce"&&Re&&xe.sourceId===Re.sourceId&&xe.id>Re.id)){var we=(Ne=xe.instanceId)!==null&&Ne!==void 0?Ne:xe.id,Me=Re?(Fe=Re.instanceId)!==null&&Fe!==void 0?Fe:Re.id:void 0,Ve=ge(ge({kind:ne,componentId:xe.sourceId,selfInstanceId:we},Me?{otherInstanceId:Me}:{}),{instanceId:(pe=xe.instanceId)!==null&&pe!==void 0?pe:Re==null?void 0:Re.instanceId});if(Re&&(Ve.otherId=Re.sourceId),rr(Ve),ne==="zoneCapture"){var he=We(xe.id),mr=O.get(Re.sourceId);if(Re.hideCaptured&&he){var Ee=(Ce=Je.get(he.id))!==null&&Ce!==void 0?Ce:{transform:ie([],$(he.transform),!1),parameters:{}};Ee.parameters.visible=!1,Je.set(he.id,Ee)}Re.stopBody&&mr&&he&&Jt(he,Re.x,Re.y)}}}});try{for(var X=J(k),te=X.next();!te.done;te=X.next()){var ue=te.value,B=We(ue.id);!B||ue.mode!=="dynamic"||(ue.spinToRotation&&jn(B,(g=ue.angle)!==null&&g!==void 0?g:0),Jt(B,ue.x,ue.y))}}catch(ne){p={error:ne}}finally{try{te&&!te.done&&(h=X.return)&&h.call(X)}finally{if(p)throw p.error}}}function Xl(){var r,o,d,u,s;try{for(var p=J(e.gameplay.filter(function(L){return L.kind==="oscillate"})),h=p.next();!h.done;h=p.next()){var g=h.value,x=O.get(g.componentId);if(x.sceneId===_)try{for(var k=(d=void 0,J(Hr(x))),m=k.next();!m.done;m=k.next()){var C=m.value,M=Bn.get(C.id);M||(M={base:ie([],$(bt(C)),!1),vx:0,vy:0},Bn.set(C.id,M));var T=g.parameters,I=(ce/T.periodSeconds+T.phase)*Math.PI*2,E=Math.sin(I)*T.amplitude,A=Math.cos(I)*T.amplitude*Math.PI*2/T.periodSeconds,z=(s=Je.get(C.id))!==null&&s!==void 0?s:{parameters:{}},N=ie([],$(M.base),!1);T.axis==="x"?(N[4]+=E,M.vx=A,M.vy=0):(N[5]+=E,M.vy=A,M.vx=0),Je.set(C.id,ge(ge({},z),{transform:N})),Bn.set(C.id,M)}}catch(L){d={error:L}}finally{try{m&&!m.done&&(u=k.return)&&u.call(k)}finally{if(d)throw d.error}}}}catch(L){r={error:L}}finally{try{h&&!h.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}}function Io(){var r,o;$t.clear();var d=function(h){var g=e.gameplay.filter(function(k){return k.kind==="path-gate"&&k.parameters.networkBehaviorId===h.id}),x=hl({id:h.id,nodes:h.parameters.nodes,edges:h.parameters.edges,gates:g,onEvent:function(k,m){var C,M=We(m.componentId),T=(C=M==null?void 0:M.prototypeId)!==null&&C!==void 0?C:m.componentId;rr(ge({kind:k,componentId:T,instanceId:M==null?void 0:M.instanceId},m.nodeId?{nodeId:m.nodeId}:{}))}});$t.set(h.id,x)};try{for(var u=J(e.gameplay.filter(function(h){return h.kind==="path-network"})),s=u.next();!s.done;s=u.next()){var p=s.value;d(p)}}catch(h){r={error:h}}finally{try{s&&!s.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}}function Gi(r,o){var d,u,s,p,h,g,x,k,m,C,M,T,I;o===void 0&&(o=!0);var E=0;try{for(var A=J(e.gameplay.filter(function(Ee){return Ee.kind==="path-agent"})),z=A.next();!z.done;z=A.next()){var N=z.value,L=O.get(N.componentId),B=$t.get(N.parameters.networkBehaviorId);if(!(L.sceneId!==_||!B))try{for(var F=(s=void 0,J(Hr(L))),Y=F.next();!Y.done;Y=F.next()){var X=Y.value;if(++E>64){at("Path agent budget exhausted");break}var te=B.getAgent(X.id);te||(te=B.addAgent(ge(ge({},N.parameters),{id:X.id,startNode:(M=X.pathStartNode)!==null&&M!==void 0?M:N.parameters.startNode,targetNode:(T=X.pathTargetNode)!==null&&T!==void 0?T:N.parameters.targetNode}))),te.speedMultiplier=Math.max(0,Number(N.parameters.speedMultiplierVariableId?j[N.parameters.speedMultiplierVariableId]:1))}}catch(Ee){s={error:Ee}}finally{try{Y&&!Y.done&&(p=F.return)&&p.call(F)}finally{if(s)throw s.error}}}}catch(Ee){d={error:Ee}}finally{try{z&&!z.done&&(u=A.return)&&u.call(A)}finally{if(d)throw d.error}}if(o){var ue=function(Ee,fr){var Pe=e.gameplay.find(function(ar){return ar.id===Ee});O.get(Pe.componentId).sceneId===_&&fr.tick(r)};try{for(var ne=J($t),xe=ne.next();!xe.done;xe=ne.next()){var Re=$(xe.value,2),Ne=Re[0],Fe=Re[1];ue(Ne,Fe)}}catch(Ee){h={error:Ee}}finally{try{xe&&!xe.done&&(g=ne.return)&&g.call(ne)}finally{if(h)throw h.error}}}try{for(var pe=J(e.gameplay.filter(function(Ee){return Ee.kind==="path-agent"})),Ce=pe.next();!Ce.done;Ce=pe.next()){var N=Ce.value,L=O.get(N.componentId),we=$t.get(N.parameters.networkBehaviorId);if(!(L.sceneId!==_||!we))try{for(var Me=(m=void 0,J(Hr(L))),Ve=Me.next();!Ve.done;Ve=Me.next()){var X=Ve.value,te=we.getAgent(X.id);if(te){if(te.orientToPath==="rotate")jn(X,te.heading);else if(te.orientToPath==="flip-x")jn(X,0,te.flipX);else if(te.orientToPath==="iso-4"){var he=(I=Je.get(X.id))!==null&&I!==void 0?I:{transform:ie([],$(X.transform),!1),parameters:{}};he.pathFrame=te.frame,Je.set(X.id,he)}var mr=X.parentId?cr(yr(We(X.parentId)),te.x,te.y):te;Jt(X,mr.x,mr.y)}}}catch(Pe){m={error:Pe}}finally{try{Ve&&!Ve.done&&(C=Me.return)&&C.call(Me)}finally{if(m)throw m.error}}}}catch(Ee){x={error:Ee}}finally{try{Ce&&!Ce.done&&(k=pe.return)&&k.call(pe)}finally{if(x)throw x.error}}}function Ma(r){var o,d,u,s,p,h,g,x,k,m,C=new Set;try{for(var M=J(e.gameplay.filter(function(Ke){return Ke.kind==="value-meter"})),T=M.next();!T.done;T=M.next()){var I=T.value,E=O.get(I.componentId);if(E.sceneId===_)try{for(var A=(u=void 0,J(Hr(E))),z=A.next();!z.done;z=A.next()){var N=z.value,L=I.parameters,B=L.instanceField?wa(N):void 0,F=L.instanceField==="hp"&&B?B.hp/B.maxHp*(L.max-L.min)+L.min:L.instanceField==="value"&&B?B.value:Number(j[L.variableId]),Y=zn.get(N.id);Y||(Y={base:ie([],$(bt(N)),!1),value:Number.isFinite(F)?Math.max(L.min,Math.min(L.max,F)):L.min},zn.set(N.id,Y)),C.add(N.id);var X=Math.max(L.min,Math.min(L.max,F)),te=L.smoothingSeconds?1-Math.exp(-r/L.smoothingSeconds):1;Y.value+=((Number.isFinite(X)?X:L.min)-Y.value)*te;var ue=Math.max(0,Math.min(1,(Y.value-L.min)/(L.max-L.min))),ne=ie([],$(Y.base),!1),xe=(k=Je.get(N.id))!==null&&k!==void 0?k:{parameters:{}},Re=L.axis==="x"?He(N).width:He(N).height;if(L.axis==="x"?(ne[0]*=ue,ne[1]*=ue):(ne[2]*=ue,ne[3]*=ue),L.direction==="negative"){var Ne=Re*(1-ue);L.axis==="x"?(ne[4]+=Y.base[0]*Ne,ne[5]+=Y.base[1]*Ne):(ne[4]+=Y.base[2]*Ne,ne[5]+=Y.base[3]*Ne)}Je.set(N.id,ge(ge({},xe),{transform:ne}))}}catch(Ke){u={error:Ke}}finally{try{z&&!z.done&&(s=A.return)&&s.call(A)}finally{if(u)throw u.error}}}}catch(Ke){o={error:Ke}}finally{try{T&&!T.done&&(d=M.return)&&d.call(M)}finally{if(o)throw o.error}}try{for(var Fe=J(zn.keys()),pe=Fe.next();!pe.done;pe=Fe.next()){var Ce=pe.value;C.has(Ce)||zn.delete(Ce)}}catch(Ke){p={error:Ke}}finally{try{pe&&!pe.done&&(h=Fe.return)&&h.call(Fe)}finally{if(p)throw p.error}}try{for(var we=J(e.gameplay.filter(function(Ke){return Ke.kind==="camera-follow"})),Me=we.next();!Me.done;Me=we.next()){var I=Me.value,Ve=O.get(I.componentId),X=We(I.parameters.targetId);if(!(Ve.sceneId!==_||!X)){var he=zi.get(Ve.id);he||(he={base:ie([],$(Ve.transform),!1),x:I.parameters.minX,y:I.parameters.minY},zi.set(Ve.id,he));var mr=function(Ar,Jr){for(var qr=[],Xr=Ar;Xr&&Xr.id!==Jr.id;Xr=We(Xr.parentId))qr.unshift(Xr);return qr.reduce(function(Zr,vr){return ii(Zr,bt(vr))},nn())},ne=wt(X,Ve.id)?mr(X,Ve):yr(X),L=He(X),Ee=cr(ne,L.width/2,L.height/2),fr=R(),Pe=I.parameters,ar=Math.max(Pe.minX,Pe.maxX-fr.width/Pe.zoom),Ue=Math.max(Pe.minY,Pe.maxY-fr.height/Pe.zoom),er=Math.max(Pe.minX,Math.min(ar,Ee.x-fr.width/(2*Pe.zoom))),Cr=Math.max(Pe.minY,Math.min(Ue,Ee.y-fr.height/(2*Pe.zoom))),te=1-Math.exp(-Pe.smoothing*r);he.x+=(er-he.x)*te,he.y+=(Cr-he.y)*te;var xe=(m=Je.get(Ve.id))!==null&&m!==void 0?m:{parameters:{}},ur=ie([],$(he.base),!1);ur[0]*=Pe.zoom,ur[1]*=Pe.zoom,ur[2]*=Pe.zoom,ur[3]*=Pe.zoom,ur[4]-=he.x*Pe.zoom,ur[5]-=he.y*Pe.zoom,Je.set(Ve.id,ge(ge({},xe),{transform:ur}))}}}catch(Ke){g={error:Ke}}finally{try{Me&&!Me.done&&(x=we.return)&&x.call(we)}finally{if(g)throw g.error}}}function Ul(){return{bodies:ie([],$(Bt.values()),!1).map(function(r){return{id:r.id,sourceId:r.sourceId,x:r.x,y:r.y,vx:r.vx,vy:r.vy,atRest:!!r.atRest,captured:!!r.captured}}),aiming:Xe?{componentId:Xe.sourceId,pointerId:Xe.pointerId,power:Xe.power}:null}}function ka(){Vt=void 0,ma=void 0,Qt(),dn.clear(),Vr.clear(),Wi.clear(),Ni.clear(),Ht.reset(),Qn.clear(),fn.clear(),Kt=[],wn=[],Wn.clear(),Li.clear(),ae.clear(),st=[],et=[],Wr=void 0,sa=0,Vi=!1,li=0,j=Object.fromEntries(e.variables.map(function(r){return[r.id,r.initial]})),si(),ya=0,Ir.clear(),di.clear(),Bt.clear(),Bn.clear(),zn.clear(),zi.clear(),Xe=void 0,se=[],ye=[],H=[],Je.clear(),mo(),On.clear(),ze.clear(),Ae.clear(),de=[],ce=0,$e=0,je=0,Rt=!1,lr=0,_=e.base.startScene,it=void 0,Lt=void 0,Gt=void 0,Yt=void 0,S||(Nl(),go(),Io(),Gi(0,!1),Ta(),Ma(0),rr({kind:"sceneEnter",sceneId:_}))}function Sa(){var r,o;if(!(!_e||_e.state!=="running"||!$n.size)){var d=ie([],$($n.values()),!1);$n.clear();try{for(var u=J(d),s=u.next();!s.done;s=u.next()){var p=s.value;wo(p)}}catch(h){r={error:h}}finally{try{s&&!s.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}}}function hi(r){if(r===void 0&&(r=!1),!_e)return Promise.resolve(void 0);if(_e.state==="running")return Promise.resolve().then(Sa),Promise.resolve(_e);if(!mn||r){var o=_e,d=Promise.resolve().then(function(){return o.resume()}).then(function(){if(o.state==="running")return Sa(),o}).catch(function(){}).finally(function(){mn===d&&(mn=void 0)});mn=d}return mn}function Ca(){var r,o,d=ie([],$(Bi.values()),!1),u=d.some(function(m){return m.bus==="voice"}),s=d.some(function(m){return m.bus==="stinger"}),p=s?.2:u?.25:1;try{for(var h=J(d),g=h.next();!g.done;g=h.next()){var x=g.value,k=x.volume*pa*(x.bus==="music"?p:1);x.gain.gain.setTargetAtTime?x.gain.gain.setTargetAtTime(k,_e.currentTime,.04):x.gain.gain.value=k}}catch(m){r={error:m}}finally{try{g&&!g.done&&(o=h.return)&&o.call(h)}finally{if(r)throw r.error}}}function Gl(r,o){if(!o||typeof r.createBuffer!="function"||typeof o.getChannelData!="function"||!o.numberOfChannels)return o;var d=o.sampleRate||44100,u=o.length;if(u<Math.round(d*.2))return o;for(var s=o.numberOfChannels,p=.002,h=u,g=0,x=0;x<s;x++){for(var k=o.getChannelData(x),m=0;m<h;m++)if(Math.abs(k[m])>p){h=m;break}for(var m=u-1;m>g;m--)if(Math.abs(k[m])>p){g=m;break}}if(h>=g)return o;var C=g-h+1;if(C<Math.round(d*.15))return o;var M=Math.min(Math.round(d*.06),Math.floor(C*.1)),T=C-M;if(M<8||T<Math.round(d*.1))return o;for(var I=r.createBuffer(s,T,d),x=0;x<s;x++){for(var E=o.getChannelData(x),A=I.getChannelData(x),m=0;m<M;m++){var z=m/M;A[m]=E[h+m]*Math.sin(z*Math.PI*.5)+E[h+T+m]*Math.cos(z*Math.PI*.5)}for(var m=M;m<T;m++)A[m]=E[h+m]}return I}function bo(r,o,d){var u,s=(u=d.parameters.bus)!==null&&u!==void 0?u:"sfx";r.connect(o),o.connect(_e.destination),xn.add(r),Bi.set(r,{gain:o,bus:s,volume:d.parameters.volume}),r.onended=function(){xn.delete(r),Bi.delete(r),d.parameters.loop&&Zn.delete(d.id),Ca()},Ca()}function wo(r){return ad(this,void 0,void 0,function(){var o,d,u,s,p,h,g,x,k,m,C,M,T,I,E,A,z,N,L,B,F,Y,X,te,ue,ne,xe,Re,Ne,Fe,pe,Ce;return od(this,function(we){switch(we.label){case 0:return xn.size>=32?[2]:(o=!!r.parameters.loop,_e?(d=_e,u=ui,s=(ne=r.parameters.cooldownMs)!==null&&ne!==void 0?ne:45,p=d.currentTime,s>0&&p-((xe=ca.get(r.id))!==null&&xe!==void 0?xe:-1/0)<s/1e3?[2]:o&&Zn.has(r.id)?[2]:(h=O.get(r.componentId),g=Te.get((Re=h==null?void 0:h.assetSlots[0])===null||Re===void 0?void 0:Re.assetId),x=(g==null?void 0:g.mime)==="audio/wav"||(g==null?void 0:g.mime)==="audio/mpeg",!x&&r.parameters.allowSynthFallback===!1?(ya++,[2]):(ca.set(r.id,p),k=d.state!=="running",k?[4,hi()]:[3,2]))):(o&&$n.set(r.id,r),[2]));case 1:k=!we.sent(),we.label=2;case 2:if(k)return o&&$n.set(r.id,r),[2];if(_e!==d||d.state!=="running"||u!==ui||xn.size>=32)return[2];if(m=(Ne=ha.get(r.id))!==null&&Ne!==void 0?Ne:0,C=[0,-.5,.5,-1,1],M=((Fe=r.parameters.pitchJitter)!==null&&Fe!==void 0?Fe:0)*C[m%C.length],T=Number((pe=j[r.parameters.pitchVariableId])!==null&&pe!==void 0?pe:0),I=Math.max(-12,Math.min(12,M+T*((Ce=r.parameters.pitchStep)!==null&&Ce!==void 0?Ce:0))),E=Math.pow(2,I/12),ha.set(r.id,m+1),!x)return[3,8];o&&Zn.add(r.id),we.label=3;case 3:if(we.trys.push([3,6,,7]),A=vo.get(g.hash),A)return[3,5];for(z=atob(g.data),N=new Uint8Array(z.length),L=0;L<z.length;L++)N[L]=z.charCodeAt(L);return[4,new Promise(function(Me,Ve){var he=d.decodeAudioData(N.buffer,Me,Ve);he&&typeof he.then=="function"&&he.then(Me,Ve)})];case 4:A=we.sent(),vo.set(g.hash,A),we.label=5;case 5:return _e!==d||d.state!=="running"||u!==ui||xn.size>=32?(o&&u===ui&&Zn.delete(r.id),[2]):(B=A,o&&(B=so.get(g.hash),B||(B=Gl(d,A),so.set(g.hash,B))),F=d.createBufferSource(),Y=d.createGain(),F.buffer=B,F.loop=o,F.playbackRate&&(F.playbackRate.value=E),o&&Y.gain.setValueAtTime&&Y.gain.linearRampToValueAtTime?(Y.gain.setValueAtTime(1e-4,d.currentTime),Y.gain.linearRampToValueAtTime(r.parameters.volume,d.currentTime+.025)):Y.gain.value=r.parameters.volume,bo(F,Y,r),F.start(),[3,7]);case 6:return X=we.sent(),Zn.delete(r.id),at("Audio decode failed"),[3,7];case 7:return[2];case 8:return te=d.createOscillator(),ue=d.createGain(),te.frequency.value=r.parameters.frequency*E,te.type="sine",ue.gain.setValueAtTime(r.parameters.volume,d.currentTime),ue.gain.exponentialRampToValueAtTime(.001,d.currentTime+r.parameters.seconds),bo(te,ue,r),te.start(),te.stop(d.currentTime+r.parameters.seconds),[2]}})})}function Yl(r,o){for(var d=ie([],$(Dt.values()),!1).filter(function(m){return m.boardId===r}),u=function(m,C){var M;return(M=d.find(function(T){return T.row===m&&T.column===C}))===null||M===void 0?void 0:M.group},s=function(m){for(var C=function(I){var E=u(m,I);if(E&&E===u(m,I+1)&&E===u(m,I+2)&&o.some(function(A){return A.row===m&&A.column>=I&&A.column<=I+2}))return{value:!0}},M=0;M<14;M++){var T=C(M);if(typeof T=="object")return T}},p=0;p<16;p++){var h=s(p);if(typeof h=="object")return h.value}for(var g=function(m){for(var C=function(I){var E=u(I,m);if(E&&E===u(I+1,m)&&E===u(I+2,m)&&o.some(function(A){return A.column===m&&A.row>=I&&A.row<=I+2}))return{value:!0}},M=0;M<14;M++){var T=C(M);if(typeof T=="object")return T}},x=0;x<16;x++){var k=g(x);if(typeof k=="object")return k.value}return!1}function Zl(r){var o,d,u,s=Dt.get(r.id);if(!(!s||s.sceneId!==_||!He(r).enabled||!Er(r))){var p=xt.get(r.parentId);if(p){Dr=p.select(r.id);return}if(Dr===r.id){Dr=void 0;return}var h=Dt.get(Dr);if(!h||h.sceneId!==_||h.boardId!==s.boardId){Dr=r.id;return}var g=O.get(Dr);if(Math.abs(h.row-s.row)+Math.abs(h.column-s.column)!==1){Dr=r.id;return}if(h.group===s.group){Dr=void 0,rr({kind:"invalidMatch",componentId:(o=r.parentId)!==null&&o!==void 0?o:r.id});return}var x=h.row,k=h.column,m=s.row,C=s.column,M=ie([],$(bt(g)),!1),T=ie([],$(bt(r)),!1);if(h.row=m,h.column=C,s.row=x,s.column=k,Yl(s.boardId,[h,s])){var I=function(E,A){var z,N=(z=Je.get(E.id))!==null&&z!==void 0?z:{transform:ie([],$(bt(E)),!1),parameters:{}};N.transform=ie([],$(N.transform),!1),N.transform[4]=A[4],N.transform[5]=A[5],Je.set(E.id,N)};I(g,T),I(r,M),Dr=void 0,rr({kind:"validMatch",componentId:(d=r.parentId)!==null&&d!==void 0?d:r.id})}else h.row=x,h.column=k,s.row=m,s.column=C,Dr=void 0,rr({kind:"invalidMatch",componentId:(u=r.parentId)!==null&&u!==void 0?u:r.id})}}function Pa(r){var o,d,u,s,p=[],h=lt(r,yr(r)),g=Or(r),x=It("drag",(u=r.prototypeId)!==null&&u!==void 0?u:r.id),k=function(T){var I,E,A=O.get(T.componentId),z=T.parameters;if(A.sceneId!==_)return"continue";var N=function(Y){if(Y.id===r.id||wt(Y,r.id)||!Er(Y))return"continue";var X=lt(Y,yr(Y)),te=Or(Y),ue=Math.hypot(te.x-g.x,te.y-g.y),ne=z.radiusPx>0?ue<=z.radiusPx:h.left<X.right&&h.right>X.left&&h.top<X.bottom&&h.bottom>X.top;if(!ne)return"continue";p.push(ge({id:Y.id,c:Y,sourceId:A.id,paintOrder:Ot.findIndex(function(xe){return xe.c.id===Y.id}),distance:ue,itemTarget:e.gameplay.some(function(xe){return xe.kind==="drag"&&xe.componentId===A.id})},z))};try{for(var L=(I=void 0,J(Hr(A))),B=L.next();!B.done;B=L.next()){var F=B.value;N(F)}}catch(Y){I={error:Y}}finally{try{B&&!B.done&&(E=L.return)&&E.call(L)}finally{if(I)throw I.error}}};try{for(var m=J(e.gameplay.filter(function(T){return T.kind==="drop-zone"})),C=m.next();!C.done;C=m.next()){var M=C.value;k(M)}}catch(T){o={error:T}}finally{try{C&&!C.done&&(d=m.return)&&d.call(m)}finally{if(o)throw o.error}}return{zones:p,tag:(s=x==null?void 0:x.parameters.tag)!==null&&s!==void 0?s:""}}function Ta(r){var o,d,u=r?[r]:e.gameplay.filter(function(C){return C.kind==="drag"}).flatMap(function(C){return Hr(O.get(C.componentId))});try{for(var s=J(u),p=s.next();!p.done;p=s.next()){var h=p.value;if(!(!h||!Er(h)||Vr.zoneOf(h.id))){var g=Pa(h),x=g.zones,k=g.tag,m=ia({itemId:h.id,tag:k,zones:x.filter(function(C){return!C.itemTarget}),occupancy:Vr});(m==null?void 0:m.kind)==="accept"&&Vr.place(h.id,m.zone.id)}}}catch(C){o={error:C}}finally{try{p&&!p.done&&(d=s.return)&&d.call(s)}finally{if(o)throw o.error}}}function Dn(r,o,d){d===void 0&&(d=.18),r&&Kn.to(r.id,Or(r),o,d)}function Ea(r,o,d,u){var s,p,h=u!=null?u:d==null?void 0:d.c;rr(ge(ge({},ot(r,o,h,ge({},d?{otherId:d.sourceId}:{}))),{instanceId:(s=o.instanceId)!==null&&s!==void 0?s:(p=d==null?void 0:d.c)===null||p===void 0?void 0:p.instanceId}))}function $l(r){var o,d,u,s,p,h,g;if(!Ge||Ge.pointerId!==r.pointerId)return!1;var x=Ge,k=We(x.targetId),m=x.b.parameters;Ge=void 0,bn=void 0;try{!((o=t.hasPointerCapture)===null||o===void 0)&&o.call(t,r.pointerId)&&((d=t.releasePointerCapture)===null||d===void 0||d.call(t,r.pointerId))}catch{}if(!k)return!0;var C=Pa(k),M=C.zones,T=C.tag,I=ia({itemId:k.id,tag:T,zones:M,occupancy:Vr}),E=x.origin,A=x.originZone;if(!I)return Ea("dragReject",k,void 0,void 0),m.snapBack&&(A&&Vr.place(k.id,A),Dn(k,E,(u=m.snapBackSeconds)!==null&&u!==void 0?u:.18)),!0;var z=I.zone,N=I.occupantId?We(I.occupantId):void 0;return I.kind==="reject"?(Ea("dragReject",k,z,N),m.snapBack&&(A&&Vr.place(k.id,A),Dn(k,E,(s=m.snapBackSeconds)!==null&&s!==void 0?s:.18)),!0):(I.kind==="accept"?(Vr.place(k.id,z.id),z.snapMode==="center"&&Dn(k,Or(z.c),(p=m.snapBackSeconds)!==null&&p!==void 0?p:.18)):I.kind==="swap"&&N&&(Vr.place(k.id,z.id),A?Vr.place(N.id,A):Vr.release(N.id),Dn(k,Or(z.c),(h=m.snapBackSeconds)!==null&&h!==void 0?h:.18),Dn(N,E,(g=m.snapBackSeconds)!==null&&g!==void 0?g:.18)),Ea("dragDrop",k,z,I.kind==="accept"?z.c:N),!0)}function Kl(r){var o,d,u,s,p;Kn.tick(r,function(I,E){var A=We(I);A&&Jt(A,E.x,E.y)});try{for(var h=J(ie([],$(Vr.itemZone.keys()),!1)),g=h.next();!g.done;g=h.next()){var x=g.value,k=We(x);(!k||!Er(k))&&Vr.release(x)}}catch(I){o={error:I}}finally{try{g&&!g.done&&(d=h.return)&&d.call(h)}finally{if(o)throw o.error}}if(br)try{for(var m=J(br.holds),C=m.next();!C.done;C=m.next()){var M=C.value,T=M.charge.tick(r);T!==j[M.behavior.parameters.variableId]&&(j[M.behavior.parameters.variableId]=T,rr({kind:"variableChange",variableId:M.behavior.parameters.variableId,instanceId:M.c.instanceId,selfInstanceId:(p=M.c.instanceId)!==null&&p!==void 0?p:M.c.id}))}}catch(I){u={error:I}}finally{try{C&&!C.done&&(s=m.return)&&s.call(m)}finally{if(u)throw u.error}}}function Mo(r,o){var d,u,s,p,h=o.targetMode;if(h==="pointer")return ge({},vi);if(h==="component"){var g=We(o.targetComponentId);return g?Or(g):void 0}if(h==="nearest-team"){var x=Or(r),k=[],m=o.team,C=(s=o.maxRangePx)!==null&&s!==void 0?s:0;try{for(var M=J(Ht.states),T=M.next();!T.done;T=M.next()){var I=$(T.value,2),E=I[0],A=I[1],g=We(E);g&&Er(g)&&k.push(ge(ge({id:E},Or(g)),{team:A.team}))}}catch(z){d={error:z}}finally{try{T&&!T.done&&(u=M.return)&&u.call(M)}finally{if(d)throw d.error}}return jo(x,k,m,C,(p=r.instanceId)!==null&&p!==void 0?p:r.id)}}function Ql(r){var o,d,u,s,p;try{for(var h=J(e.gameplay.filter(function(F){return F.kind==="steer"})),g=h.next();!g.done;g=h.next()){var x=g.value,k=O.get(x.componentId),m=x.parameters;if(k.sceneId===_)try{for(var C=(u=void 0,J(Hr(k))),M=C.next();!M.done;M=C.next()){var T=M.value;if(Er(T)){var I=Mo(T,m);if(I){var E=Or(T),A=I.x-E.x,z=I.y-E.y;if(!(m.maxRangePx>0&&Math.hypot(A,z)>m.maxRangePx)){var N=Math.atan2(z,A);m.mode==="flee"?N+=Math.PI:m.mode==="orbit"&&(N+=Math.PI/2);var L=(p=Ht.headings.get(T.id))!==null&&p!==void 0?p:N,B=_o(L,N,m.turnRateDegPerSec*Math.PI/180*r);Ht.headings.set(T.id,B),Jt(T,E.x+Math.cos(B)*m.speed*r,E.y+Math.sin(B)*m.speed*r),m.orientToVelocity!==!1&&jn(T,B)}}}}}catch(F){u={error:F}}finally{try{M&&!M.done&&(s=C.return)&&s.call(C)}finally{if(u)throw u.error}}}}catch(F){o={error:F}}finally{try{g&&!g.done&&(d=h.return)&&d.call(h)}finally{if(o)throw o.error}}}function Aa(r,o,d,u){var s;if(se.length>=128){at("Instance budget exhausted");return}var p=O.get(r),h=function(m){return 1+e.components.filter(function(C){return C.parentId===m}).reduce(function(C,M){return C+h(M.id)},0)};if(Ir.size+h(p.id)>4096){at("Runtime node budget exhausted");return}var g="instance."+ ++je;function x(m,C){var M,T,I=m.id===p.id?g:g+":"+m.id,E=ge(ge({},m),{id:I,runtimeId:I,instanceId:g,prototypeId:m.id,prototype:!1,parentId:C,transform:ie([],$(m.transform),!1),spawnTime:ce});Ir.set(I,E);try{for(var A=J(e.components.filter(function(L){return L.parentId===m.id})),z=A.next();!z.done;z=A.next()){var N=z.value;x(N,I)}}catch(L){M={error:L}}finally{try{z&&!z.done&&(T=A.return)&&T.call(A)}finally{if(M)throw M.error}}return E}var k=x(p,void 0);return k.transform[4]=o,k.transform[5]=d,u&&(k.pathStartNode=u.startNode,k.pathTargetNode=u.targetNode,k.parentId=(s=e.gameplay.find(function(m){return m.id===u.networkBehaviorId}))===null||s===void 0?void 0:s.componentId),se.push(k),po(k),Ta(k),u&&Gi(0,!1),k}function Jl(r,o,d){var u,s,p,h,g,x,k,m,C,M,T,I,E,A,z,N,L,B,F,Y,X,te,ue,ne,xe,Re,Ne,Fe,pe,Ce,we;if(++zr>1024){at("Action budget exhausted");return}if(r.kind==="add"||r.kind==="set"){var Me=j[r.variableId],Ve=r.kind==="add"?Me+r.value:r.value;if(typeof Ve=="number"&&(!Number.isFinite(Ve)||Math.abs(Ve)>1e12)){at("Variable range exceeded");return}j[r.variableId]=Ve,Me!==Ve&&rr({kind:"variableChange",variableId:r.variableId,instanceId:o.instanceId})}else if(r.kind==="setComponent"||r.kind==="setAsset"){var he=We(r.componentId);if(!he)return;var mr=(C=Je.get(he.id))!==null&&C!==void 0?C:{transform:ie([],$(he.transform),!1),parameters:{}};r.kind==="setComponent"?mr.parameters[r.key]=r.valueVariableId?j[r.valueVariableId]:r.value:mr.assetId=r.assetId,Je.set(he.id,mr),r.kind==="setComponent"&&r.key==="visible"&&r.value===!1&&(Vr.release(he.id),Kn.cancel(he.id))}else if(r.kind==="resetMatch")mo(r.componentId),go(r.componentId);else if(r.kind==="clearStrokes")(M=fn.get(r.componentId))===null||M===void 0||M.clear(),Kt=Kt.filter(function(gr){return gr.owner!==r.componentId});else if(r.kind==="resetMask"){var he=We(r.componentId),Ee=It("erase-mask",r.componentId);he&&Ee&&ci(he,Ee).reset()}else if(r.kind==="copyMatchAsset"){var fr=(T=xt.get(r.boardId))===null||T===void 0?void 0:T.snapshot().lastMatch,Pe=O.get(r.componentId),ar=fr&&((E=(I=co.get(r.boardId))===null||I===void 0?void 0:I.get(fr.group))===null||E===void 0?void 0:E.children.find(function(gr){return gr.contract==="native.image.v1"}));if(fr&&ar){var Ue=O.get(fr.from),er=cr(yr(Ue),Ue.parameters.width/2,Ue.parameters.height/2),Cr=Pe.parentId?yr(O.get(Pe.parentId)):nn(),ur=cr(Ut(Cr),er.x,er.y),Ke=(A=Je.get(Pe.id))!==null&&A!==void 0?A:{transform:ie([],$(Pe.transform),!1),parameters:{}};Ke.transform=ie([],$(Ke.transform),!1),Ke.transform[4]=ur.x-Pe.parameters.width/2,Ke.transform[5]=ur.y-Pe.parameters.height/2,Ke.assetId=(z=ar.assetSlots[0])===null||z===void 0?void 0:z.assetId,Je.set(Pe.id,Ke)}}else if(r.kind==="hintMatch")Dr=void 0,(N=xt.get(r.componentId))===null||N===void 0||N.showHint();else if(r.kind==="spawn")Aa(r.prototypeId,r.x,r.y);else if(r.kind==="spawnAt"){var Fr=(r.at==="self"||r.at==="midpoint")&&(o.selfInstanceId!==void 0||o.instanceId!==void 0)?We((L=o.selfInstanceId)!==null&&L!==void 0?L:o.instanceId):Nn(r.targetComponentId,o,"self"),zt=(r.at==="other"||r.at==="midpoint")&&o.otherInstanceId!==void 0?We(o.otherInstanceId):void 0,Pe=r.at==="other"?zt:Fr;if(r.at==="pointer"||(r.at==="midpoint"?Fr&&zt:Pe))for(var Mt=Fr?Or(Fr):void 0,kt=zt?Or(zt):void 0,er=r.at==="pointer"?vi:r.at==="midpoint"?{x:(Mt.x+kt.x)/2,y:(Mt.y+kt.y)/2}:Or(Pe),Qr=O.get(r.prototypeId),Ar=Math.max(0,Math.min(16,Math.floor(r.countVariableId?Number(j[r.countVariableId]):(B=r.count)!==null&&B!==void 0?B:1))),Jr=0;Jr<Ar;Jr++){var qr=r.jitterX?(Ht.rng.next()*2-1)*r.jitterX:0,Xr=r.jitterY?(Ht.rng.next()*2-1)*r.jitterY:0;Aa(r.prototypeId,er.x+r.offsetX+qr-Qr.parameters.width/2,er.y+r.offsetY+Xr-Qr.parameters.height/2)}}else if(r.kind==="random"){var Me=j[r.variableId],Ve=Ht.rng.between(r.min,r.max,r.integer===!0);j[r.variableId]=Ve,Me!==Ve&&rr({kind:"variableChange",variableId:r.variableId,instanceId:o.instanceId})}else if(r.kind==="modifyInstanceState"){var he=r.target==="component"?We(r.componentId):Nn(r.componentId,o,r.target);he&&Ll(he,r.field,r.op,r.variableId?j[r.variableId]:r.value)}else if(r.kind==="launchToward"){var Ue=O.get(r.componentId),Zr=Hr(Ue),vr=(F=o.selfInstanceId)!==null&&F!==void 0?F:o.instanceId,he=Ue.prototype?(Y=Zr.find(function(wr){return wr.instanceId===vr||wr.id===vr}))!==null&&Y!==void 0?Y:Zr[Zr.length-1]:(X=Nn(r.componentId,o,"self"))!==null&&X!==void 0?X:We(r.componentId),Ee=It("physics-body",r.componentId),tr=he&&Ln(he,Ee);if(!tr)return;var jr=void 0;if(r.targetMode==="angle-variable")jr=Number(j[r.angleVariableId])*Math.PI/180;else{var Pe=Mo(he,r);if(!Pe)return;var er=Or(he);jr=Math.atan2(Pe.y-er.y,Pe.x-er.x)}var nt=Number(r.speedVariableId?j[r.speedVariableId]:r.speed);if(!Number.isFinite(nt)){at("Launch speed invalid");return}tr.vx=Math.cos(jr)*nt,tr.vy=Math.sin(jr)*nt,tr.atRest=!1,tr.restElapsed=0,tr.captured=!1,tr.exited=!1,r.orientToVelocity!==!1&&jn(he,jr),rr(ot("launch",he))}else if(r.kind==="moveToComponent"){var De=O.get(r.targetComponentId),he=Nn(r.componentId,o,(te=r.target)!==null&&te!==void 0?te:"self"),Pe=De&&Jn(De)?(ue=Nn(r.targetComponentId,o,r.target==="other"?"self":"other"))!==null&&ue!==void 0?ue:Hr(De)[0]:We(r.targetComponentId);he&&Pe&&Dn(he,Or(Pe),r.seconds)}else if(r.kind==="returnToOrigin"){var he=Nn(r.componentId,o,"self"),nr=he&&Wi.get(he.id);he&&nr&&Dn(he,nr,r.seconds)}else if(r.kind==="spawnOnPath")Aa(r.prototypeId,0,0,{startNode:r.startNode,targetNode:r.targetNode,networkBehaviorId:r.networkBehaviorId});else if(["setVelocity","applyImpulse","stopBody"].includes(r.kind)){var ke=O.get(r.componentId),Br=o.instanceId?ie([],$(Ir.values()),!1).filter(function(sr){return sr.instanceId===o.instanceId&&sr.prototypeId===ke.id}):Hr(ke),Ee=It("physics-body",ke.id);try{for(var ft=J(Br),gt=ft.next();!gt.done;gt=ft.next()){var he=gt.value,tr=Ln(he,Ee);r.kind==="setVelocity"?(tr.vx=r.vxVariableId?j[r.vxVariableId]:r.vx,tr.vy=r.vyVariableId?j[r.vyVariableId]:r.vy):r.kind==="applyImpulse"?(tr.vx+=r.vxVariableId?j[r.vxVariableId]:r.ix,tr.vy+=r.vyVariableId?j[r.vyVariableId]:r.iy):(tr.vx=0,tr.vy=0,tr.atRest=!0),tr.captured=!1,tr.exited=!1,tr.restElapsed=0,r.kind!=="stopBody"&&(tr.atRest=!1)}}catch(sr){u={error:sr}}finally{try{gt&&!gt.done&&(s=ft.return)&&s.call(ft)}finally{if(u)throw u.error}}}else if(r.kind==="setPosition"){var or=O.get(r.componentId),Br=o.instanceId?ie([],$(Ir.values()),!1).filter(function(Kr){return Kr.instanceId===o.instanceId&&Kr.prototypeId===or.id}):Hr(or),Ee=It("physics-body",or.id);try{for(var dt=J(Br),St=dt.next();!St.done;St=dt.next()){var he=St.value,tr=Ln(he,Ee);tr.x=r.xVariableId?j[r.xVariableId]:r.x,tr.y=r.yVariableId?j[r.yVariableId]:r.y,tr.vx=0,tr.vy=0,tr.captured=!1,tr.exited=!1,tr.atRest=!0,Jt(he,tr.x,tr.y)}}catch(Kr){p={error:Kr}}finally{try{St&&!St.done&&(h=dt.return)&&h.call(dt)}finally{if(p)throw p.error}}}else if(r.kind==="setPathEdge")(ne=$t.get(r.behaviorId))===null||ne===void 0||ne.setEdge(r.edgeId,r.enabled,r.cost);else if(r.kind==="setPathGate")(Re=$t.get((xe=e.gameplay.find(function(gr){return gr.id===r.behaviorId}))===null||xe===void 0?void 0:xe.parameters.networkBehaviorId))===null||Re===void 0||Re.setGate(r.behaviorId,r.mode,r.holdSeconds);else if(r.kind==="setPathTarget"){var kn=O.get(r.componentId),Ee=It("path-agent",kn.id),vn=$t.get(Ee.parameters.networkBehaviorId);try{for(var Ct=J(o.instanceId?ie([],$(Ir.values()),!1).filter(function(sr){return sr.instanceId===o.instanceId&&sr.prototypeId===kn.id}):Hr(kn)),ut=Ct.next();!ut.done;ut=Ct.next()){var he=ut.value;he.pathTargetNode=r.targetNode,vn==null||vn.setTarget(he.id,r.targetNode)}}catch(sr){g={error:sr}}finally{try{ut&&!ut.done&&(x=Ct.return)&&x.call(Ct)}finally{if(g)throw g.error}}}else if(r.kind==="compute"){var Nr=Number(j[r.variableId]),Ur=r.operandVariableId!==void 0?Number(j[r.operandVariableId]):r.value;if(["div","mod"].includes(r.op)&&Ur===0){at("Division by zero");return}var Ve={add:function(){return Nr+Ur},sub:function(){return Nr-Ur},mul:function(){return Nr*Ur},div:function(){return Ur===0?Nr:Nr/Ur},mod:function(){return Ur===0?Nr:Nr%Ur},min:function(){return Math.min(Nr,Ur)},max:function(){return Math.max(Nr,Ur)},set:function(){return Ur},floor:function(){return Math.floor(Nr)},ceil:function(){return Math.ceil(Nr)},abs:function(){return Math.abs(Nr)},clamp:function(){return Math.max(r.min,Math.min(r.max,Nr))}}[r.op]();if(r.round&&(Ve=Math.round(Ve)),!Number.isFinite(Ve)||Math.abs(Ve)>1e12){at("Variable range exceeded");return}var Me=j[r.variableId];j[r.variableId]=Ve,Me!==Ve&&rr({kind:"variableChange",variableId:r.variableId,instanceId:o.instanceId})}else if(r.kind==="despawn"){var Fr=(Ne=o.selfInstanceId)!==null&&Ne!==void 0?Ne:o.instanceId;r.target==="other"?Hi(o.otherInstanceId):r.target==="both"?(Hi(Fr),Hi(o.otherInstanceId)):Hi(Fr)}else if(r.kind==="changeScene")r.delaySeconds>0?r.sceneId!==_&&(Vt!=null||(Vt={sceneId:r.sceneId,at:ce+r.delaySeconds})):Yt=r.sceneId;else if(r.kind==="restart")(Fe=ee==null?void 0:ee.notifyGameRetry)===null||Fe===void 0||Fe.call(ee),Yt="__restart";else if(r.kind==="cameraShake")Z!=null&&Z.matches||(Wr={intensity:r.intensity,seconds:r.seconds,elapsed:0});else if(r.kind==="screenFlash")et.push({color:r.color,opacity:r.opacity,seconds:r.seconds,elapsed:0}),et.length>8&&et.shift();else if(r.kind==="floatingText"){var sn=O.get(r.componentId),Ue=o.instanceId?(pe=ie([],$(Ir.values()),!1).find(function(Kr){return Kr.instanceId===o.instanceId&&Kr.prototypeId===r.componentId}))!==null&&pe!==void 0?pe:sn:(Ce=We(r.componentId))!==null&&Ce!==void 0?Ce:sn,Pe=(Ue==null?void 0:Ue.sceneId)===_?Ue:sn;if(Pe){var er=void 0;if(!er){var $r=He(Pe);er=cr(yr(Pe),$r.width/2,$r.height/2)}st.push({x:er.x,y:er.y,text:r.text.replace(/\{\{([a-z0-9_.-]+)\}\}/g,function(wr,ct){var Mr;return String((Mr=j[ct])!==null&&Mr!==void 0?Mr:"")}),color:r.color,fontSize:r.fontSize,risePx:r.risePx,seconds:r.seconds,elapsed:0}),st.length>32&&st.shift()}}else if(r.kind==="store")o.kind==="click"&&o.pointerId!==void 0&&!mt&&(mt={pointerId:o.pointerId,targetId:o.targetId,condition:d},(we=t.setPointerCapture)===null||we===void 0||we.call(t,o.pointerId));else if(r.behaviorId){var _r=e.gameplay.find(function(gr){return gr.id===r.behaviorId});if(r.kind==="playAudio")wo(_r);else if(r.kind==="animate"){var vt=O.get(_r.componentId),Br=Jn(vt)?ie([],$(Ir.values()),!1).filter(function(sr){return sr.prototypeId===vt.id&&(!o.instanceId||sr.instanceId===o.instanceId)}):[vt],Sn=function(sr){var Kr=_r.id+":"+sr.id;H=H.filter(function(ct){return ct.id!==Kr});var wr=ge({},_r.parameters);wr.fromCurrent&&(wr.from=wr.property==="opacity"?He(sr).opacity:bt(sr)[wr.property==="x"?4:5]),H.push(ge(ge({},_r),{parameters:wr,id:Kr,behaviorId:_r.id,targetId:sr.id,elapsed:0,baseTransform:ie([],$(sr.transform),!1)}))};try{for(var Pt=J(Br),Ye=Pt.next();!Ye.done;Ye=Pt.next()){var Pe=Ye.value;Sn(Pe)}}catch(sr){k={error:sr}}finally{try{Ye&&!Ye.done&&(m=Pt.return)&&m.call(Pt)}finally{if(k)throw k.error}}}else r.kind==="stopAnimation"?H=H.filter(function(gr){return gr.behaviorId!==_r.id}):r.kind==="emit"&&ql(_r,o)}}function ql(r,o){var d,u,s,p,h,g=r.parameters,x=g.shape==="pixel-confetti",k=g.shape==="confetti",m=x||k;if(!(m&&(Z!=null&&Z.matches))){if(ye.length+g.count>256){at("Particle budget exhausted");return}if(x&&g.coverage==="screen"){ye.push.apply(ye,ie([],$(ml(g)),!1));return}if(k&&g.coverage==="screen"){ye.push.apply(ye,ie([],$(xl(g)),!1));return}for(var C=O.get(r.componentId),M=o.instanceId&&(d=ie([],$(Ir.values()),!1).find(function(Y){return Y.instanceId===o.instanceId&&Y.prototypeId===C.id}))!==null&&d!==void 0?d:C,T=bt(M),I,E=We(M.parentId);E;E=We(E.parentId)){if(m&&E.contract==="native.group.v1"&&He(E).clip){I=E.id;break}T=ii(bt(E),T)}var A=He(M),z=g.origin==="anchor"?cr(T,0,0):m||g.origin==="center"?cr(T,A.width/2,A.height/2):{x:T[4]+M.parameters.width/2,y:T[5]+M.parameters.height/2};if(x){ye.push.apply(ye,ie([],$(to(g,z,I)),!1));return}if(k){ye.push.apply(ye,ie([],$(no(g,z,I)),!1));return}for(var N=Ja(Qa(M.id+":"+ce.toFixed(3))),L=0;L<g.count;L++){var B=-Math.PI/2+((L+N.next())/g.count-.5)*((u=g.spread)!==null&&u!==void 0?u:360)*Math.PI/180,F=g.speed*N.between(.5,.95);ye.push(ge(ge({},z),{vx:Math.cos(B)*F,vy:Math.sin(B)*F,life:(s=g.lifetime)!==null&&s!==void 0?s:.7,gravity:(p=g.gravity)!==null&&p!==void 0?p:250,color:g.color,shape:(h=g.shape)!==null&&h!==void 0?h:"circle"}))}}}function ko(r){var o,d;if(r==="__restart"){ka();return}if(r!==_){Vt=void 0;var u=_;si(),_=r,dn.clear(),Vr.clear(),Wi.clear(),Ni.clear(),Qn.clear(),fn.clear(),Kt=[],wn=[],Wn.clear(),Li.clear(),Dr=void 0,se=[],ye=[],st=[],et=[],Wr=void 0,Vi=!1,li=0,Ir.clear(),Bt.clear(),Bn.clear(),zn.clear(),zi.clear(),Xe=void 0,Io(),de=de.filter(function(g){return g.kind==="variableChange"}),Je.clear(),rt=void 0;try{for(var s=J(xt.values()),p=s.next();!p.done;p=s.next()){var h=p.value;h.reset()}}catch(g){o={error:g}}finally{try{p&&!p.done&&(d=s.return)&&d.call(s)}finally{if(o)throw o.error}}ze.clear(),Ae.clear(),On.clear(),H=[],Qt(),ae.clear(),it=void 0,Lt=void 0,Gi(0,!1),Ta(),Ma(0),rr({kind:"sceneExit",sceneId:u}),rr({kind:"sceneEnter",sceneId:_})}}function un(){for(var r=function(){var o,d,u,s,p=de.shift();Lr++;var h=function(I){return I===void 0||!!We(I)||ie([],$(Ir.values()),!1).some(function(E){return E.instanceId===I})};if(!h(p.selfInstanceId)||!h(p.otherInstanceId)||["contactBegin","boundaryExit"].includes(p.kind)&&p.instanceId&&!Ir.has(p.instanceId))return"continue";try{for(var g=(o=void 0,J(e.eventBindings)),x=g.next();!x.done;x=g.next()){var k=x.value;if(Object.entries(be.get(k.eventId)).every(function(I){var E=$(I,2),A=E[0],z=E[1];return A==="id"||p[A]===z})&&Ui(k.condition,p)){try{for(var m=(u=void 0,J(k.actions)),C=m.next();!C.done;C=m.next()){var M=C.value;if(zr>=1024||Rt)break;Jl(M,p,k.condition)}}catch(I){u={error:I}}finally{try{C&&!C.done&&(s=m.return)&&s.call(m)}finally{if(u)throw u.error}}if(Yt)break}}}catch(I){o={error:I}}finally{try{x&&!x.done&&(d=g.return)&&d.call(g)}finally{if(o)throw o.error}}if(Yt){var T=Yt;Yt=void 0,ko(T)}};de.length&&!Rt&&Lr<256&&zr<1024;)r();de.length&&at("Event/action budget exhausted")}function yr(r){return ii(r.parentId?yr(We(r.parentId)):nn(),bt(r))}var cr=function(r,o,d){return{x:r[0]*o+r[2]*d+r[4],y:r[1]*o+r[3]*d+r[5]}};function lt(r,o){var d=He(r),u=[[0,0],[d.width,0],[d.width,d.height],[0,d.height]].map(function(s){var p=$(s,2),h=p[0],g=p[1];return cr(o,h,g)});return{left:Math.min.apply(Math,ie([],$(u.map(function(s){return s.x})),!1)),right:Math.max.apply(Math,ie([],$(u.map(function(s){return s.x})),!1)),top:Math.min.apply(Math,ie([],$(u.map(function(s){return s.y})),!1)),bottom:Math.max.apply(Math,ie([],$(u.map(function(s){return s.y})),!1))}}function Er(r){return He(r).visible&&He(r).opacity>0&&(!r.parentId||Er(We(r.parentId)))}function So(r,o){for(var d=He(r),u=yr(r),s=Math.min(d.width,d.height)/2,p=o==="circle"?Array.from({length:32},function(x,k){return cr(u,d.width/2+Math.cos(k*Math.PI/16)*s,d.height/2+Math.sin(k*Math.PI/16)*s)}):[[0,0],[d.width,0],[d.width,d.height],[0,d.height]].map(function(x){var k=$(x,2),m=k[0],C=k[1];return cr(u,m,C)}),h=r.parentId?We(r.parentId):void 0,g=function(){var x=He(h);if(h.contract==="native.group.v1"&&x.clip){for(var k=yr(h),m=[[0,0],[x.width,0],[x.width,x.height],[0,x.height]].map(function(E){var A=$(E,2),z=A[0],N=A[1];return cr(k,z,N)}),C=0,M=0;M<4;M++)C+=m[M].x*m[(M+1)%4].y-m[(M+1)%4].x*m[M].y;for(var T=C>=0?1:-1,I=function(E){var A,z,N=m[E],L=m[(E+1)%4],B=function(Ne){return T*((L.x-N.x)*(Ne.y-N.y)-(L.y-N.y)*(Ne.x-N.x))},F=p;p=[];var Y=F[F.length-1],X=B(Y);try{for(var te=(A=void 0,J(F)),ue=te.next();!ue.done;ue=te.next()){var ne=ue.value,xe=B(ne);if(xe>=0!=X>=0){var Re=X/(X-xe);p.push({x:Y.x+(ne.x-Y.x)*Re,y:Y.y+(ne.y-Y.y)*Re})}xe>=0&&p.push(ne),Y=ne,X=xe}}catch(Ne){A={error:Ne}}finally{try{ue&&!ue.done&&(z=te.return)&&z.call(te)}finally{if(A)throw A.error}}},M=0;M<4&&p.length;M++)I(M)}h=h.parentId?We(h.parentId):void 0};h;)g();return p}function jl(r,o){var d,u,s,p,h,g;if(r.length<3||o.length<3)return!1;try{for(var x=J([r,o]),k=x.next();!k.done;k=x.next())for(var m=k.value,C=0;C<m.length;C++){var M=m[C],T=m[(C+1)%m.length],I=M.y-T.y,E=T.x-M.x,A=1/0,z=-1/0,N=1/0,L=-1/0;try{for(var B=(s=void 0,J(r)),F=B.next();!F.done;F=B.next()){var Y=F.value,X=Y.x*I+Y.y*E;A=Math.min(A,X),z=Math.max(z,X)}}catch(ne){s={error:ne}}finally{try{F&&!F.done&&(p=B.return)&&p.call(B)}finally{if(s)throw s.error}}try{for(var te=(h=void 0,J(o)),ue=te.next();!ue.done;ue=te.next()){var Y=ue.value,X=Y.x*I+Y.y*E;N=Math.min(N,X),L=Math.max(L,X)}}catch(ne){h={error:ne}}finally{try{ue&&!ue.done&&(g=te.return)&&g.call(te)}finally{if(h)throw h.error}}if(z<N||L<A)return!1}}catch(ne){d={error:ne}}finally{try{k&&!k.done&&(u=x.return)&&u.call(x)}finally{if(d)throw d.error}}return!0}function _l(r){var o,d,u,s,p=R();try{for(var h=J(dn.values()),g=h.next();!g.done;g=h.next()){var x=g.value,k=x.behavior.parameters;if(!(!k.moveComponentId||x.magnitude<=0)){var m=We(k.moveComponentId);if(!(!m||!Er(m))){var C=(u=k.moveSpeed)!==null&&u!==void 0?u:220,M=It("physics-body",(s=m.prototypeId)!==null&&s!==void 0?s:m.id);if(M&&M.parameters.mode==="dynamic"){var T=Ln(m,M);T.vx=x.nx*C,T.vy=x.ny*C,T.atRest=!1,T.restElapsed=0}else{var I=Or(m),E=He(m),A=I.x+x.nx*C*r,z=I.y+x.ny*C*r;Co(m)||(A=Math.max(E.width/2,Math.min(p.width-E.width/2,A)),z=Math.max(E.height/2,Math.min(p.height-E.height/2,z))),Jt(m,A,z)}k.orientToMove&&jn(m,Math.atan2(x.ny,x.nx))}}}}catch(N){o={error:N}}finally{try{g&&!g.done&&(d=h.return)&&d.call(h)}finally{if(o)throw o.error}}}function ef(r){var o,d,u,s,p,h,g,x,k,m,C,M,T,I,E,A,z,N,L,B,F,Y,X,te,ue,ne,xe,Re,Ne,Fe,pe,Ce,we=R();ce+=r,Vt&&ce>=Vt.at&&ko(Vt.sceneId),yf(r),Kl(r),_l(r),Ql(r),Xl();try{for(var Me=J(In),Ve=Me.next();!Ve.done;Ve=Me.next()){var he=$(Ve.value,2),mr=he[0],Ee=he[1];!Ee.held&&ce-((X=Ee.releasedAt)!==null&&X!==void 0?X:ce)>=Ee.behavior.springBackSeconds&&In.delete(mr)}}catch(Be){o={error:Be}}finally{try{Ve&&!Ve.done&&(d=Me.return)&&d.call(Me)}finally{if(o)throw o.error}}Wr&&(Wr.elapsed+=r,Wr.elapsed>=Wr.seconds&&(Wr=void 0));try{for(var fr=J(et),Pe=fr.next();!Pe.done;Pe=fr.next()){var ar=Pe.value;ar.elapsed+=r}}catch(Be){u={error:Be}}finally{try{Pe&&!Pe.done&&(s=fr.return)&&s.call(fr)}finally{if(u)throw u.error}}et=et.filter(function(Be){return Be.elapsed<Be.seconds});try{for(var Ue=J(st),er=Ue.next();!er.done;er=Ue.next()){var Cr=er.value;Cr.elapsed+=r}}catch(Be){p={error:Be}}finally{try{er&&!er.done&&(h=Ue.return)&&h.call(Ue)}finally{if(p)throw p.error}}st=st.filter(function(Be){return Be.elapsed<Be.seconds});try{for(var ur=J(xt),Ke=ur.next();!Ke.done;Ke=ur.next()){var Fr=$(Ke.value,2),mr=Fr[0],zt=Fr[1];O.get(mr).sceneId===_&&Er(O.get(mr))&&zt.tick(r)}}catch(Be){g={error:Be}}finally{try{Ke&&!Ke.done&&(x=ur.return)&&x.call(ur)}finally{if(g)throw g.error}}var Mt=function(Be){var dr,Gr,Rr=O.get(Be.componentId);if(Rr.sceneId!==_)return"continue";var Tt=Jn(Rr)?ie([],$(Ir.values()),!1).filter(function(ti){return ti.prototypeId===Rr.id}):[Rr];try{for(var xr=(dr=void 0,J(Tt)),yt=xr.next();!yt.done;yt=xr.next()){var ir=yt.value,jt=Be.id+":"+ir.id;if(Be.kind==="motion"){var Et=(te=Je.get(ir.id))!==null&&te!==void 0?te:{transform:ie([],$(ir.transform),!1),parameters:{}},_t=(ue=Et.velocity)!==null&&ue!==void 0?ue:{x:Be.parameters.vx,y:Be.parameters.vy};_t.y+=Be.parameters.gravity*r,Et.transform[4]+=_t.x*r,Et.transform[5]+=_t.y*r,Et.velocity=_t,Je.set(ir.id,Et),ir.prototypeId&&(ir.transform=Et.transform);var Xt=yr(ir);(Xt[5]>we.height||Xt[4]<-300||Xt[4]>we.width+300)&&(Et.exited||(Et.exited=!0,rr({kind:"boundaryExit",componentId:Rr.id,instanceId:ir.instanceId})))}else if(Be.kind==="timer"){var en=((ne=On.get(jt))!==null&&ne!==void 0?ne:0)+r;On.set(jt,en),en>=Be.parameters.seconds&&en-r<Be.parameters.seconds&&(rr(ge({kind:"timer",behaviorId:Be.id,componentId:Rr.id},ir.instanceId?{instanceId:ir.instanceId,selfInstanceId:ir.instanceId}:{})),Be.parameters.repeat&&On.set(jt,en-Be.parameters.seconds))}}}catch(ti){dr={error:ti}}finally{try{yt&&!yt.done&&(Gr=xr.return)&&Gr.call(xr)}finally{if(dr)throw dr.error}}};try{for(var kt=J(e.gameplay),Qr=kt.next();!Qr.done;Qr=kt.next()){var Ar=Qr.value;Mt(Ar)}}catch(Be){k={error:Be}}finally{try{Qr&&!Qr.done&&(m=kt.return)&&m.call(kt)}finally{if(k)throw k.error}}Fl(r),Gi(r),Ma(r);var Jr=[],qr=function(Be){var dr,Gr,Rr=O.get(Be.componentId);if(Rr.sceneId!==_)return"continue";try{for(var Tt=(dr=void 0,J(Jn(Rr)?ie([],$(Ir.values()),!1).filter(function(ir){return ir.prototypeId===Rr.id}):[Rr])),xr=Tt.next();!xr.done;xr=Tt.next()){var yt=xr.value;if(Er(yt)){if(Jr.length>=256){at("Collider budget exhausted");break}Jr.push({b:Be,c:yt,box:lt(yt,yr(yt)),polygon:So(yt,Be.parameters.shape)})}}}catch(ir){dr={error:ir}}finally{try{xr&&!xr.done&&(Gr=Tt.return)&&Gr.call(Tt)}finally{if(dr)throw dr.error}}};try{for(var Xr=J(e.gameplay.filter(function(Be){return Be.kind==="collider"})),Zr=Xr.next();!Zr.done;Zr=Xr.next()){var Ar=Zr.value;qr(Ar)}}catch(Be){C={error:Be}}finally{try{Zr&&!Zr.done&&(M=Xr.return)&&M.call(Xr)}finally{if(C)throw C.error}}var vr=new Set,tr=new Map,jr=function(Be,dr,Gr){var Rr,Tt,xr;((Rr=dr.c.prototypeId)!==null&&Rr!==void 0?Rr:dr.c.id)===((Tt=Gr.c.prototypeId)!==null&&Tt!==void 0?Tt:Gr.c.id)&&dr.c.id>Gr.c.id||rr(ge(ge({},ot(Be,dr.c,Gr.c)),{instanceId:(xr=dr.c.instanceId)!==null&&xr!==void 0?xr:Gr.c.instanceId}))},nt=0;e:for(var De=0;De<Jr.length;De++)for(var Ar=De+1;Ar<Jr.length;Ar++){var nr=Jr[De],ke=Jr[Ar];if(!(nr.c.instanceId&&nr.c.instanceId===ke.c.instanceId)){var Br=nr.box,ft=ke.box,gt=Br.left<ft.right&&Br.right>ft.left&&Br.top<ft.bottom&&Br.bottom>ft.top;if(gt){if(++nt>4096){at("Collision budget exhausted");break e}gt=jl(nr.polygon,ke.polygon)}if(gt){var or=[nr.c.id,ke.c.id].sort().join("|");if(vr.add(or),tr.set(or,[nr,ke]),!ze.has(or))try{for(var dt=(T=void 0,J([[nr,ke],[ke,nr]])),St=dt.next();!St.done;St=dt.next()){var kn=$(St.value,2),vn=kn[0],Ct=kn[1];jr("contactBegin",vn,Ct)}}catch(dr){T={error:dr}}finally{try{St&&!St.done&&(I=dt.return)&&I.call(dt)}finally{if(T)throw T.error}}}}}try{for(var ut=J(Ae),Nr=ut.next();!Nr.done;Nr=ut.next()){var Ur=$(Nr.value,2),or=Ur[0],sn=$(Ur[1],2),nr=sn[0],ke=sn[1];if(!vr.has(or))try{for(var $r=(z=void 0,J([[nr,ke],[ke,nr]])),_r=$r.next();!_r.done;_r=$r.next()){var vt=$(_r.value,2),vn=vt[0],Ct=vt[1];jr("contactEnd",vn,Ct)}}catch(Rr){z={error:Rr}}finally{try{_r&&!_r.done&&(N=$r.return)&&N.call($r)}finally{if(z)throw z.error}}}}catch(Be){E={error:Be}}finally{try{Nr&&!Nr.done&&(A=ut.return)&&A.call(ut)}finally{if(E)throw E.error}}ze=vr,Ae=tr;try{for(var Sn=J(H),Pt=Sn.next();!Pt.done;Pt=Sn.next()){var De=Pt.value;De.elapsed+=r;var Ye=De.parameters,gr=(xe=Ye.delay)!==null&&xe!==void 0?xe:0,sr=De.elapsed-gr;if(!(sr<0)){var Kr=sr/Ye.seconds,wr=Ye.loop?Kr%1:Math.min(1,Kr),ct=(Re=Ye.easing)!==null&&Re!==void 0?Re:"ease-out",Mr=wr;Ye.loop&&ct==="ease-in-out"?Mr=.5-.5*Math.cos(wr*Math.PI*2):ct==="ease-out"?Mr=1-Math.pow(1-wr,3):ct==="ease-in"?Mr=Math.pow(wr,3):ct==="ease-in-out"?Mr=wr<.5?4*Math.pow(wr,3):1-Math.pow(-2*wr+2,3)/2:ct==="back-out"&&(Mr=1+2.70158*Math.pow(wr-1,3)+1.70158*Math.pow(wr-1,2));var ht=Ye.from+(Ye.to-Ye.from)*Mr,qe=We((Ne=De.targetId)!==null&&Ne!==void 0?Ne:De.componentId);if(qe){var Ze=(Fe=Je.get(qe.id))!==null&&Fe!==void 0?Fe:{transform:ie([],$(qe.transform),!1),parameters:{}},Ft=(pe=De.baseTransform)!==null&&pe!==void 0?pe:qe.transform;if(Ye.property==="opacity")Ze.parameters.opacity=Math.max(0,Math.min(1,ht));else if(["scale","scaleX","scaleY","rotation"].includes(Ye.property)){(Ce=Ze.animationAxes)!==null&&Ce!==void 0||(Ze.animationAxes={scale:1,scaleX:1,scaleY:1,rotation:0}),Ze.animationAxes[Ye.property]=ht;var Cn=Ze.animationAxes,Pn=Cn.rotation*Math.PI/180,qt=Math.cos(Pn),ei=Math.sin(Pn),mi=Cn.scale*Cn.scaleX,ri=Cn.scale*Cn.scaleY;Ze.transform[0]=(Ft[0]*qt+Ft[2]*ei)*mi,Ze.transform[1]=(Ft[1]*qt+Ft[3]*ei)*mi,Ze.transform[2]=(-Ft[0]*ei+Ft[2]*qt)*ri,Ze.transform[3]=(-Ft[1]*ei+Ft[3]*qt)*ri}else Ze.transform[Ye.property==="x"?4:5]=ht;Je.set(qe.id,Ze),Ye.loop&&sr>=Ye.seconds&&(De.elapsed=gr+sr%Ye.seconds)}}}}catch(Be){L={error:Be}}finally{try{Pt&&!Pt.done&&(B=Sn.return)&&B.call(Sn)}finally{if(L)throw L.error}}H=H.filter(function(Be){var dr,Gr;return We((dr=Be.targetId)!==null&&dr!==void 0?dr:Be.componentId)&&(Be.elapsed<Be.parameters.seconds+((Gr=Be.parameters.delay)!==null&&Gr!==void 0?Gr:0)||Be.parameters.loop)});try{for(var Tn=J(ye),En=Tn.next();!En.done;En=Tn.next()){var Ye=En.value;if(Ye.age!==void 0){Ye.age+=r;continue}Ye.life-=r,Ye.x+=Ye.vx*r,Ye.y+=Ye.vy*r,Ye.vy+=Ye.gravity*r}}catch(Be){F={error:Be}}finally{try{En&&!En.done&&(Y=Tn.return)&&Y.call(Tn)}finally{if(F)throw F.error}}ye=ye.filter(function(Be){var dr;return Be.life>((dr=Be.age)!==null&&dr!==void 0?dr:0)}),un()}function Yi(r,o){var d,u,s;if(y.beginPath(),r.contract==="native.ellipse.v1")y.ellipse(o.width/2,o.height/2,o.width/2,o.height/2,0,0,Math.PI*2);else if(r.contract==="native.path.v1"){var p=function(M,T){({M:function(){return y.moveTo.apply(y,ie([],$(T),!1))},L:function(){return y.lineTo.apply(y,ie([],$(T),!1))},C:function(){return y.bezierCurveTo.apply(y,ie([],$(T),!1))},Q:function(){return y.quadraticCurveTo.apply(y,ie([],$(T),!1))},Z:function(){return y.closePath()}})[M]()};try{for(var h=J(o.commands),g=h.next();!g.done;g=h.next()){var x=$(g.value),k=x[0],m=x.slice(1);p(k,m)}}catch(M){d={error:M}}finally{try{g&&!g.done&&(u=h.return)&&u.call(h)}finally{if(d)throw d.error}}}else{var C=Math.min((s=o.radius)!==null&&s!==void 0?s:0,o.width/2,o.height/2);typeof y.roundRect=="function"?y.roundRect(0,0,o.width,o.height,C):(y.moveTo(C,0),y.arcTo(o.width,0,o.width,o.height,C),y.arcTo(o.width,o.height,0,o.height,C),y.arcTo(0,o.height,0,0,C),y.arcTo(0,0,o.width,0,C),y.closePath())}}function rf(r,o,d){var u,s,p,h=(u=Je.get(r.id))===null||u===void 0?void 0:u.pathFrame;if(h!==void 0)return Math.min(o.frameCount-1,h);if(S||!o.frameRate)return 0;if(r.contract!=="native.walk-sprite.v1")return Math.floor(Math.max(0,ce-((s=r.spawnTime)!==null&&s!==void 0?s:0))*o.frameRate)%o.frameCount;var g=(p=r.runtimeId)!==null&&p!==void 0?p:r.id,x=di.get(g);if(!x)return di.set(g,{x:d[4],y:d[5],phase:0,lastMove:-1/0,frame:0}),0;var k=Math.hypot(d[4]-x.x,d[5]-x.y)>.3;if(k){var m=ce-x.lastMove;x.phase=Number.isFinite(m)&&m<.25?x.phase+Math.min(m,.12)*o.frameRate:0,x.lastMove=ce}return x.x=d[4],x.y=d[5],ce-x.lastMove>.11&&(x.phase=0),x.frame=Math.floor(x.phase)%o.frameCount,x.frame}var yi=!1,_n={width:390,height:700};function Ra(r){var o,d;r!==yi&&(r?(y.save(),y.beginPath(),y.rect((o=_n.left)!==null&&o!==void 0?o:0,(d=_n.top)!==null&&d!==void 0?d:0,_n.width,_n.height),y.clip(),yi=!0):(y.restore(),yi=!1))}function pi(r,o,d,u,s){var p,h,g,x,k,m,C,M,T;if(o===void 0&&(o=nn()),d===void 0&&(d=[]),s===void 0&&(s=!1),r.contract!=="native.mesh3d.v1"){var I=He(r),E=It("erase-mask",(g=r.prototypeId)!==null&&g!==void 0?g:r.id);if(!(!I.visible||I.opacity<=0)){var A=ii(o,bt(r));yi||Ra(!0),y.save(),y.transform.apply(y,ie([],$(s?A:bt(r)),!1)),y.globalAlpha*=I.opacity;var z=In.get(r.id);z!=null&&z.behavior.liftShadow&&(y.shadowColor="#00000055",y.shadowBlur=8,y.shadowOffsetY=4);var N=d;r.contract==="native.group.v1"&&I.clip&&(y.beginPath(),y.rect(0,0,I.width,I.height),y.clip(),N=ie(ie([],$(d),!1),[{matrix:A,width:I.width,height:I.height}],!1));var L=!1;if(!["native.group.v1","native.text.v1","native.image.v1","native.sprite.v1","native.walk-sprite.v1","native.stage3d.v1","native.mesh3d.v1"].includes(r.contract)){var B=r.contract==="native.button.v1",F=it===r.id,Y=B?I.enabled?F?I.pressedFill:Gt===r.id?I.hoverFill:I.fill:I.disabledFill:I.fill;if(B&&(I.presentation==="pixel-cta"||I.presentation==="shiny-cta")){var X=(x=me.get(r.id))!==null&&x!==void 0?x:$e;ae.set(r.id,X);var te=!S&&!(Z!=null&&Z.matches)?$e-X:-1;I.presentation==="shiny-cta"?wl(y,I,Y,F,te):bl(y,I,Y,F,te)}else I.pixelFrame&&(y.save(),y.translate(3,4),Yi(r,I),y.fillStyle="#3c293366",y.fill(),y.restore()),Yi(r,I),E?(y.save(),y.clip(),ci(r,E).render(y),y.restore(),L=!0,Yi(r,I)):(y.fillStyle=Y,y.fill()),I.pixelFrame&&!(I.radius>0)&&(y.fillStyle="#ffffff22",y.fillRect(2,2,Math.max(0,I.width-4),2),y.fillRect(2,2,2,Math.max(0,I.height-4))),I.strokeWidth&&(y.strokeStyle=I.stroke,y.lineWidth=I.strokeWidth,y.stroke());Dr===r.id&&(Yi(r,I),y.strokeStyle="#ffffff",y.lineWidth=5,y.stroke())}var ue,ne;if(r.contract==="native.text.v1"){var xe=ne=I.text.replace(/\{\{([a-z0-9_.-]+)\}\}/g,function(Cr,ur){var Ke;return String((Ke=j[ur])!==null&&Ke!==void 0?Ke:"")});I.pixelPanel&&(y.fillStyle="#3c293366",y.fillRect(3,4,I.width,I.height),y.fillStyle=I.panelFill,y.fillRect(0,0,I.width,I.height),y.strokeStyle=(k=I.panelStroke)!==null&&k!==void 0?k:I.color,y.lineWidth=2,y.strokeRect(1,1,I.width-2,I.height-2),y.fillStyle="#ffffff22",y.fillRect(3,3,Math.max(0,I.width-6),2));var Re=I.fontFamily==="pixel"?_a(xe,I):void 0;Re&&!Re.unsupportedChars.length?ue=pl(y,xe,I):ue=ld(y,xe,Re?ge(ge({},I),{fontFamily:"sans-serif",fontWeight:"700"}):I,e.creativeBrief.language)}if(["native.image.v1","native.sprite.v1","native.walk-sprite.v1"].includes(r.contract)&&!E){var Ne=Se.get(K((C=(m=Je.get(r.id))===null||m===void 0?void 0:m.assetId)!==null&&C!==void 0?C:(M=r.assetSlots[0])===null||M===void 0?void 0:M.assetId));if(Ne!=null&&Ne.complete&&Ne.naturalWidth){y.save(),y.beginPath(),y.rect(0,0,I.width,I.height),y.clip();var Fe=r.contract!=="native.image.v1",pe=Fe?Math.min(I.frameColumns,I.frameCount):1,Ce=Fe?Math.ceil(I.frameCount/pe):1,we=Ne.width/pe,Me=Ne.height/Ce,Ve=Fe?rf(r,I,A):0,he=Ve%pe*we,mr=Math.floor(Ve/pe)*Me,Ee=I.fit==="cover"?Math.max(I.width/we,I.height/Me):Math.min(I.width/we,I.height/Me),fr=I.fit==="stretch"?I.width:we*Ee,Pe=I.fit==="stretch"?I.height:Me*Ee;y.imageSmoothingEnabled=(T=I.smoothing)!==null&&T!==void 0?T:!0,y.drawImage(Ne,he,mr,we,Me,(I.width-fr)/2,(I.height-Pe)/2,fr,Pe),y.restore()}}E&&!L&&ci(r,E).render(y),Ot.push({c:r,m:A,clips:N,instance:u!=null?u:r.prototypeId,textMetrics:ue,textContent:ne});try{for(var ar=J(Xi(r.id)),Ue=ar.next();!Ue.done;Ue=ar.next()){var er=Ue.value;pi(er,A,N,u!=null?u:r.prototypeId)}}catch(Cr){p={error:Cr}}finally{try{Ue&&!Ue.done&&(h=ar.return)&&h.call(ar)}finally{if(p)throw p.error}}I.clip&&r.contract==="native.group.v1"&&Va(r.id),y.restore()}}}function Va(r,o){var d,u;if(!(Z!=null&&Z.matches))try{for(var s=J(ye),p=s.next();!p.done;p=s.next()){var h=p.value;h.shape!=="pixel-confetti"&&h.shape!=="confetti"||h.clipId!==r||!!h.screen!=!!o||(y.save(),h.shape==="confetti"?Il(y,h,o):gl(y,h,o),y.restore())}}catch(g){d={error:g}}finally{try{p&&!p.done&&(u=s.return)&&u.call(s)}finally{if(d)throw d.error}}}function tf(r,o,d,u){y.save(),y.translate(r,o),y.globalAlpha=.92,y.lineWidth=2,y.lineJoin="round",d==="tap"&&(y.strokeStyle="#fff0bd",y.globalAlpha=.7*(1-u),y.beginPath(),y.arc(0,0,12+u*12,0,Math.PI*2),y.stroke(),y.globalAlpha=.92),y.fillStyle="#fff0bd",y.strokeStyle="#193b46",y.beginPath(),y.moveTo(-7,10),y.lineTo(-9,-1),y.quadraticCurveTo(-9,-5,-5,-5),y.lineTo(-3,-3),y.lineTo(-3,-17),y.quadraticCurveTo(-3,-22,1,-22),y.quadraticCurveTo(5,-22,5,-17),y.lineTo(5,-6),y.quadraticCurveTo(9,-9,11,-5),y.quadraticCurveTo(15,-7,16,-2),y.lineTo(14,9),y.quadraticCurveTo(12,18,3,18),y.lineTo(-1,18),y.quadraticCurveTo(-5,17,-7,10),y.closePath(),y.fill(),y.stroke(),y.restore()}function nf(){var r,o,d,u,s,p,h,g,x,k,m,C,M,T,I,E,A,z,N;if(li=0,!S)try{for(var L=J(e.gameplay.filter(function(or){return or.kind==="tutorial-hand"})),B=L.next();!B.done;B=L.next()){var F=B.value,Y=O.get(F.componentId),X=We(F.parameters.targetId);if(!(!Y||Y.sceneId!==_||!X||X.sceneId!==_||!Er(X))&&!(F.parameters.hideOnFirstInput&&Vi)){var te=gn?ce:$e;if(!(te-sa<F.parameters.idleDelaySeconds)){li++;var ue=F.parameters.destinationId?We(F.parameters.destinationId):void 0,ne=He(X),xe=void 0;xe||(xe=cr(yr(X),ne.width/2,ne.height/2));var Re=te%1.2/1.2,Ne=Z!=null&&Z.matches?0:Re*Re*(3-2*Re),Fe=xe.x,pe=xe.y;if(F.parameters.mode!=="tap"){var Ce=ue?cr(yr(ue),He(ue).width/2,He(ue).height/2):{x:xe.x-36,y:xe.y+48};Fe=xe.x+(Ce.x-xe.x)*Ne,pe=xe.y+(Ce.y-xe.y)*Ne}tf(Fe+8,pe+22,F.parameters.mode,Ne)}}}}catch(or){r={error:or}}finally{try{B&&!B.done&&(o=L.return)&&o.call(L)}finally{if(r)throw r.error}}try{for(var we=J(fn),Me=we.next();!Me.done;Me=we.next()){var Ve=$(Me.value,2),he=Ve[0],mr=Ve[1],Ee=It("draw-stroke",he).parameters;try{for(var fr=(s=void 0,J(mr.strokes)),Pe=fr.next();!Pe.done;Pe=fr.next()){var ar=Pe.value;if(!(ar.points.length<2)){y.save(),y.globalAlpha=Ee.mode==="slice-blade"?Math.max(0,1-ar.age/.18):1,y.strokeStyle=Ee.color,y.lineWidth=Ee.strokeWidth,y.lineCap="round",y.lineJoin="round",y.beginPath(),y.moveTo(ar.points[0].x,ar.points[0].y);try{for(var Ue=(h=void 0,J(ar.points.slice(1))),er=Ue.next();!er.done;er=Ue.next()){var Cr=er.value;y.lineTo(Cr.x,Cr.y)}}catch(or){h={error:or}}finally{try{er&&!er.done&&(g=Ue.return)&&g.call(Ue)}finally{if(h)throw h.error}}y.stroke(),y.restore()}}}catch(or){s={error:or}}finally{try{Pe&&!Pe.done&&(p=fr.return)&&p.call(fr)}finally{if(s)throw s.error}}}}catch(or){d={error:or}}finally{try{Me&&!Me.done&&(u=we.return)&&u.call(we)}finally{if(d)throw d.error}}try{for(var ur=J(wn),Ke=ur.next();!Ke.done;Ke=ur.next()){var Fr=Ke.value;if(!(Fr.broken||!Fr.drawRope)){var zt=Bt.get(Fr.bodyId),Mt=We(Fr.anchorId);if(!(!zt||!Mt)){var kt=Or(Mt);y.save(),y.strokeStyle=Fr.ropeColor,y.lineWidth=Fr.ropeWidth,y.beginPath(),y.moveTo(kt.x,kt.y),y.lineTo(zt.x,zt.y),y.stroke(),y.restore()}}}}catch(or){x={error:or}}finally{try{Ke&&!Ke.done&&(k=ur.return)&&k.call(ur)}finally{if(x)throw x.error}}try{for(var Qr=J(e.gameplay.filter(function(or){var dt;return or.kind==="virtual-joystick"&&((dt=O.get(or.componentId))===null||dt===void 0?void 0:dt.sceneId)===_})),Ar=Qr.next();!Ar.done;Ar=Qr.next()){var F=Ar.value,Jr=We(F.componentId),ne=F.parameters;if(!(!Jr||!Er(Jr)||ne.drawControl===!1)){var qr=dn.get(F.id),Xr=qr&&qr.pointerId!==null?qr.origin:Or(Jr),Zr=qr&&qr.pointerId!==null?qr.knobX:Xr.x,vr=qr&&qr.pointerId!==null?qr.knobY:Xr.y,tr=(A=ne.radiusPx)!==null&&A!==void 0?A:56;y.save(),y.fillStyle=(z=ne.baseColor)!==null&&z!==void 0?z:"#ffffff44",y.strokeStyle="#ffffffaa",y.lineWidth=2.5,y.beginPath(),y.arc(Xr.x,Xr.y,tr,0,Math.PI*2),y.fill(),y.stroke(),y.fillStyle=(N=ne.knobColor)!==null&&N!==void 0?N:"#fff0bdee",y.strokeStyle="#193b46aa",y.lineWidth=2,y.beginPath(),y.arc(Zr,vr,tr*.42,0,Math.PI*2),y.fill(),y.stroke(),y.restore()}}}catch(or){m={error:or}}finally{try{Ar&&!Ar.done&&(C=Qr.return)&&C.call(Qr)}finally{if(m)throw m.error}}try{for(var jr=J(st),nt=jr.next();!nt.done;nt=jr.next()){var De=nt.value,nr=Math.min(1,De.elapsed/De.seconds);y.save(),y.globalAlpha=1-nr,y.fillStyle=De.color,y.strokeStyle="#193b46",y.lineWidth=3,y.font="900 "+De.fontSize+"px sans-serif",y.textAlign="center",y.textBaseline="middle";var pe=De.y-(Z!=null&&Z.matches?0:De.risePx*nr);y.strokeText(De.text,De.x,pe),y.fillText(De.text,De.x,pe),y.restore()}}catch(or){M={error:or}}finally{try{nt&&!nt.done&&(T=jr.return)&&T.call(jr)}finally{if(M)throw M.error}}try{for(var ke=J(et),Br=ke.next();!Br.done;Br=ke.next()){var ft=Br.value,nr=Math.min(1,ft.elapsed/ft.seconds),gt=R();y.save(),y.globalAlpha=ft.opacity*(1-nr),y.fillStyle=ft.color,y.fillRect(0,0,gt.width,gt.height),y.restore()}}catch(or){I={error:or}}finally{try{Br&&!Br.done&&(E=ke.return)&&E.call(ke)}finally{if(I)throw I.error}}}function af(){if(Xe){var r=Bt.get(Xe.targetId),o=Xe.behavior.parameters;if(r){var d=Xe.current.x-Xe.start.x,u=Xe.current.y-Xe.start.y,s=Math.hypot(d,u),p=Math.min(o.maxPullPx,s),h=s>.001?p/s:0;y.save(),y.lineCap="round";var g=Math.max(12,Math.min(r.width,r.height)*.62);if(y.strokeStyle="#173a2f66",y.lineWidth=3.5,y.beginPath(),y.arc(r.x,r.y,g,0,Math.PI*2),y.stroke(),y.strokeStyle=o.trajectoryColor,y.lineWidth=2,y.beginPath(),y.arc(r.x,r.y,g,0,Math.PI*2),y.stroke(),o.showTrajectory&&s>=o.minPullPx){var x=Ba(),k=xo(),m=k.bodies,C=k.zones,M=R(),T=sl({body:ge(ge({},r),{vx:x.vx,vy:x.vy,atRest:!1}),bodies:m,zones:C,bounds:{left:0,top:0,right:M.width,bottom:M.height},dots:o.trajectoryDots,bounces:o.trajectoryBounces});T.forEach(function(A,z){var N=.96-.52*(z/Math.max(1,T.length)),L=Math.max(2.2,4.5-z*.22);y.globalAlpha=N,y.fillStyle="#173a2f88",y.beginPath(),y.arc(A.x,A.y,L+1.3,0,Math.PI*2),y.fill(),y.fillStyle=o.trajectoryColor,y.beginPath(),y.arc(A.x,A.y,L,0,Math.PI*2),y.fill()})}if(s>=4){var I=r.x+d*h,E=r.y+u*h;y.globalAlpha=.9,y.strokeStyle="#173a2f66",y.lineWidth=5,y.beginPath(),y.moveTo(r.x,r.y),y.lineTo(I,E),y.stroke(),y.strokeStyle=o.trajectoryColor,y.lineWidth=2.6,y.beginPath(),y.moveTo(r.x,r.y),y.lineTo(I,E),y.stroke(),y.fillStyle="#173a2f88",y.beginPath(),y.arc(I,E,5.2,0,Math.PI*2),y.fill(),y.fillStyle=o.trajectoryColor,y.beginPath(),y.arc(I,E,3.6,0,Math.PI*2),y.fill()}y.restore()}}}function of(r){var o,d,u,s;try{for(var p=J(yo()),h=p.next();!h.done;h=p.next()){var g=h.value,x=g.contract==="native.group.v1"?Xi(g.id):[g];try{for(var k=(u=void 0,J(x)),m=k.next();!m.done;m=k.next()){var C=m.value;if(C.contract==="native.stage3d.v1"&&Er(C)&&He(C).skyColor)return He(C).skyColor;if(!(C.contract!=="native.rectangle.v1"||!Er(C))){var M=He(C);if(!(M.opacity<.95||!M.fill||M.fill==="transparent")&&(/(?:^|\.)(background|backdrop|bg)(?:\.fill)?$/.test(C.id)||M.width>=r.width*.9&&M.height>=r.height*.9))return M.fill}}}catch(T){u={error:T}}finally{try{m&&!m.done&&(s=k.return)&&s.call(k)}finally{if(u)throw u.error}}}}catch(T){o={error:T}}finally{try{h&&!h.done&&(d=p.return)&&d.call(p)}finally{if(o)throw o.error}}return"#102a34"}function lf(){var r;if(bn&&Er(bn.c)){var o=bn.c,d=He(o);y.save(),y.transform.apply(y,ie([],$(yr(o)),!1)),y.strokeStyle=(r=bn.highlightColor)!==null&&r!==void 0?r:"#ffffff",y.lineWidth=4,y.globalAlpha=.85,y.strokeRect(-4,-4,d.width+8,d.height+8),y.restore()}if(Ge!=null&&Ge.b.parameters.bringToFront){var o=We(Ge.targetId);o&&pi(o,o.parentId?yr(We(o.parentId)):nn(),[],o.prototypeId)}}function tt(){var r,o,d,u,s,p;me=ae,ae=new Map;var h=R();ve!==void 0&&ve!==h.landscape&&Qt(),ve=h.landscape;var g=Math.min(devicePixelRatio||1,2),x=t.clientWidth,k=t.clientHeight;(t.width!==Math.round(x*g)||t.height!==Math.round(k*g))&&(t.width=Math.round(x*g),t.height=Math.round(k*g)),y.setTransform(g,0,0,g,0,0),y.fillStyle=of(h),y.fillRect(0,0,x,k);var m=Math.min(x/h.width,k/h.height),C=(x-h.width*m)/2,M=(k-h.height*m)/2;if(Ol=m||1,Bl=g,y.translate(C,M),y.scale(m,m),Wr){var T=Math.min(1,Wr.elapsed/Wr.seconds),I=Wr.intensity*(1-T);y.translate(Math.sin(Wr.elapsed*95)*I,Math.cos(Wr.elapsed*113)*I)}_n=h,yi=!1,_n=Fi(h),Ot=[];try{for(var E=J(yo()),A=E.next();!A.done;A=E.next()){var z=A.value;pi(z)}}catch(pe){r={error:pe}}finally{try{A&&!A.done&&(o=E.return)&&o.call(E)}finally{if(r)throw r.error}}Ra(!0);try{for(var N=J(se),L=N.next();!L.done;L=N.next()){var z=L.value;z.parentId||pi(z,nn(),[],z.prototypeId)}}catch(pe){d={error:pe}}finally{try{L&&!L.done&&(u=N.return)&&u.call(N)}finally{if(d)throw d.error}}if(lf(),af(),S&&Zt){for(var B=O.get(Zt);B!=null&&B.parentId;)B=O.get(B.parentId);B!=null&&B.prototype&&pi(B)}Va(),y.save();try{for(var F=J(ye),Y=F.next();!Y.done;Y=F.next()){var X=Y.value;if(X.age===void 0){var te=Math.min(1,X.life*2),ue=1.5+2.5*te;if(y.globalAlpha=te,y.globalCompositeOperation=X.shape==="square"?"source-over":"lighter",y.fillStyle=X.color,X.shape==="square"){var ne=Math.max(2,Math.round(ue*1.6));y.fillRect(Math.round(X.x-ne/2),Math.round(X.y-ne/2),ne,ne);continue}y.globalCompositeOperation="lighter",y.shadowColor=X.color,y.shadowBlur=ye.length<=16?6:0,y.strokeStyle=X.color,y.lineWidth=1.5+te,y.beginPath(),y.moveTo(X.x-X.vx*.025,X.y-X.vy*.025),y.lineTo(X.x,X.y),y.stroke(),y.beginPath(),y.arc(X.x,X.y,ue,0,Math.PI*2),y.fill()}}}catch(pe){s={error:pe}}finally{try{Y&&!Y.done&&(p=F.return)&&p.call(F)}finally{if(s)throw s.error}}if(y.restore(),nf(),S&&Zt){var xe=Ot.filter(function(pe){return pe.c.contract!=="native.group.v1"&&(pe.c.id===Zt||wt(pe.c,Zt))});if(xe.length){var Re=xe.map(function(pe){return lt(pe.c,pe.m)}),Ne=Math.min.apply(Math,ie([],$(Re.map(function(pe){return pe.left})),!1)),Fe=Math.min.apply(Math,ie([],$(Re.map(function(pe){return pe.top})),!1));y.strokeStyle="#55e6ef",y.lineWidth=2/m,y.strokeRect(Ne,Fe,Math.max.apply(Math,ie([],$(Re.map(function(pe){return pe.right})),!1))-Ne,Math.max.apply(Math,ie([],$(Re.map(function(pe){return pe.bottom})),!1))-Fe)}}Ra(!1),m>0&&Va(void 0,{x:-C/m,y:-M/m,width:x/m,height:k/m})}function ff(r){var o,d,u,s,p=Array.isArray(r)?ie([],$(new Set(r)),!1):void 0;tt();var h=R(),g=Fi(h),x=new Set,k=[];try{for(var m=J(Ot),C=m.next();!C.done;C=m.next()){var M=C.value,T=(u=M.c.prototypeId)!==null&&u!==void 0?u:M.c.id;if(!(M.c.contract==="native.group.v1"||p&&!p.includes(T))){x.add(T);var I=lt(M.c,M.m),E=((s=He(M.c).strokeWidth)!==null&&s!==void 0?s:0)/2;I.left-=E,I.right+=E,I.top-=E,I.bottom+=E;var A={left:Math.max(0,g.left-I.left),right:Math.max(0,I.right-g.right),top:Math.max(0,g.top-I.top),bottom:Math.max(0,I.bottom-g.bottom)};Object.values(A).some(function(N){return N>.01})&&k.push({id:T,contract:M.c.contract,bounds:I,overflow:A})}}}catch(N){o={error:N}}finally{try{C&&!C.done&&(d=m.return)&&d.call(m)}finally{if(o)throw o.error}}var z=p?p.filter(function(N){return!x.has(N)}):[];return{ok:k.length===0&&z.length===0,viewport:ge(ge({},h),{canvasWidth:t.clientWidth,canvasHeight:t.clientHeight}),issues:k,missing:z}}function df(r){var o,d,u,s,p,h,g,x,k,m,C,M,T,I,E,A,z,N,L,B,F,Y,X,te,ue,ne,xe,Re,Ne,Fe,pe,Ce,we,Me=r===void 0?{}:r,Ve=Me.ids,he=Me.interactiveIds,mr=Me.network,Ee=mr===void 0?"standalone":mr,fr=Me.minTouchPx,Pe=fr===void 0?44:fr,ar=Array.isArray(Ve)?ie([],$(new Set(Ve)),!1):void 0;tt();var Ue=R(),er=Fi(Ue),Cr=Math.min(t.clientWidth/Ue.width,t.clientHeight/Ue.height),ur=uo(er,Ee),Ke=[],Fr=new Set,zt=function(V){var Ie;return!ar||ar.includes((Ie=V.c.prototypeId)!==null&&Ie!==void 0?Ie:V.c.id)},Mt=Ot.filter(zt),kt=new Set(e.events.filter(function(V){return V.kind==="click"}).map(function(V){return V.componentId}));try{for(var Qr=J(e.gameplay),Ar=Qr.next();!Ar.done;Ar=Qr.next()){var Jr=Ar.value;["drag","match-tile","aim-launch","aim-launch-3d","swipe-input","hold-charge","virtual-joystick","draw-stroke","erase-mask"].includes(Jr.kind)&&kt.add(Jr.componentId)}}catch(V){o={error:V}}finally{try{Ar&&!Ar.done&&(d=Qr.return)&&d.call(Qr)}finally{if(o)throw o.error}}var qr=new Set(he!=null?he:kt),Xr=new Set(ie(ie([],$(e.gameplay.filter(function(V){return["aim-launch","aim-launch-3d","swipe-input","hold-charge","draw-stroke","virtual-joystick"].includes(V.kind)&&(V.parameters.dragMode==="anywhere"||V.kind==="draw-stroke"||V.kind==="virtual-joystick"&&V.parameters.mode==="floating")}).map(function(V){return V.componentId})),!1),$(e.components.filter(function(V){return V.contract==="native.stage3d.v1"}).map(function(V){return V.id})),!1)),Zr=function(V){var Ie;return qr.has((Ie=V.c.prototypeId)!==null&&Ie!==void 0?Ie:V.c.id)},vr=function(V,Ie,Oe,Qe,kr,pr){return Ke.push(ge(ge({kind:V,severity:Ie,id:Oe},pr?{otherId:pr}:{}),{detail:Qe,metrics:kr}))},tr=function(V){var Ie=[[0,0],[V.width,0],[V.width,V.height],[0,V.height]].map(function(Oe){var Qe=$(Oe,2),kr=Qe[0],pr=Qe[1];return cr(V.matrix,kr,pr)});return{left:Math.min.apply(Math,ie([],$(Ie.map(function(Oe){return Oe.x})),!1)),right:Math.max.apply(Math,ie([],$(Ie.map(function(Oe){return Oe.x})),!1)),top:Math.min.apply(Math,ie([],$(Ie.map(function(Oe){return Oe.y})),!1)),bottom:Math.max.apply(Math,ie([],$(Ie.map(function(Oe){return Oe.y})),!1))}};try{for(var jr=J(Mt),nt=jr.next();!nt.done;nt=jr.next()){var De=nt.value,nr=(X=De.c.prototypeId)!==null&&X!==void 0?X:De.c.id;Fr.add(nr);var ke=lt(De.c,De.m),Br=((te=He(De.c).strokeWidth)!==null&&te!==void 0?te:0)/2;ke.left-=Br,ke.right+=Br,ke.top-=Br,ke.bottom+=Br;var ft=De.c.contract==="native.group.v1"&&!He(De.c).clip,gt=De.c.contract==="native.image.v1"&&De.clips.length===0&&He(De.c).fit==="cover"&&ke.left<=0&&ke.top<=0&&ke.right>=Ue.width&&ke.bottom>=Ue.height||De.c.contract==="native.stage3d.v1"&&ke.left<=0&&ke.top<=0&&ke.right>=Ue.width&&ke.bottom>=Ue.height,or=De.c.contract==="native.rectangle.v1"&&Br===0&&ke.left<=0&&ke.top<=0&&ke.right>=Ue.width&&ke.bottom>=Ue.height||gt;if(!ft){var dt={left:Math.max(0,er.left-ke.left),right:Math.max(0,ke.right-er.right),top:Math.max(0,er.top-ke.top),bottom:Math.max(0,ke.bottom-er.bottom)};if(!or&&!Co(De.c)&&Object.values(dt).some(function(V){return V>.01})&&vr("stage-overflow","blocker",nr,"Component extends beyond the active stage.",{bounds:ke,overflow:dt}),De.c.contract==="native.image.v1"&&De.clips.length===0){var St=ke.right-ke.left,kn=ke.bottom-ke.top,vn=/(?:^|\.)(backdrop|background|bg)$/.test(nr)||He(De.c).fit==="cover"&&!De.c.parentId&&ke.left<=1&&ke.top<=1&&(St>=Ue.width*.4||kn>=Ue.height*.4);vn&&(ke.left>.5||ke.top>.5||ke.right<Ue.width-.5||ke.bottom<Ue.height-.5)&&vr("backdrop-incomplete","blocker",nr,"Backdrop image does not cover the full active stage, leaving a visible seam.",{bounds:ke,stage:{width:Ue.width,height:Ue.height}})}try{for(var Ct=(p=void 0,J(De.clips)),ut=Ct.next();!ut.done;ut=Ct.next()){var Nr=ut.value,Ur=tr(Nr),sn={left:Math.max(0,Ur.left-ke.left),right:Math.max(0,ke.right-Ur.right),top:Math.max(0,Ur.top-ke.top),bottom:Math.max(0,ke.bottom-Ur.bottom)};Object.values(sn).some(function(V){return V>.01})&&vr("parent-clip-crop","blocker",nr,"Component is cropped by an ancestor clipping group.",{bounds:ke,clip:Ur,crop:sn})}}catch(V){p={error:V}}finally{try{ut&&!ut.done&&(h=Ct.return)&&h.call(Ct)}finally{if(p)throw p.error}}}if(De.textMetrics){var $r=De.textMetrics;$r.overflowsWidth&&vr("text-overflow","blocker",nr,"Text exceeds its component width after wrapping and auto-fit.",$r),$r.overflowsHeight&&vr("text-clipped","blocker",nr,"Text is vertically clipped by its component after wrapping and auto-fit.",$r);var _r=(ue=$r.fontSize)!==null&&ue!==void 0?ue:$r.scale*8;_r<12&&vr("text-illegible",_r<8?"blocker":"warning",nr,"Rendered text is below the recommended legible size.",ge({renderedFontSize:_r},$r));var vt=He(De.c),Sn=vt.direction==="rtl"||vt.direction!=="ltr"&&/^(ar|fa|he|iw|ps|sd|ug|ur|yi)(?:-|$)/.test(e.creativeBrief.language);if(Sn&&$r.resolvedAlign==="left"&&vr("rtl-alignment","blocker",nr,"Right-to-left copy must resolve to right or center alignment.",{direction:"rtl",align:vt.align,resolvedAlign:$r.resolvedAlign}),vt.pixelPanel&&vt.align!=="center"){var Pt=Math.max(0,vt.width-2*(vt.padding===void 0?8:vt.padding));Pt-((ne=$r.renderedWidth)!==null&&ne!==void 0?ne:0)>12&&vr("panel-off-center","blocker",nr,"Text inside a framed pixel panel is not horizontally centered.",{align:vt.align,innerWidth:Pt,renderedWidth:(xe=$r.renderedWidth)!==null&&xe!==void 0?xe:0})}}if(Zr(De)&&!Xr.has(nr)&&(De.c.contract!=="native.group.v1"||ke.right>ke.left&&ke.bottom>ke.top)){var Ye=(ke.right-ke.left)*Cr,gr=(ke.bottom-ke.top)*Cr;(Ye<Pe-.01||gr<Pe-.01)&&vr("touch-target-small","blocker",nr,"Interactive target is smaller than the required physical touch size.",{width:Ye,height:gr,minTouchPx:Pe,scale:Cr})}if(Zr(De)&&!Xr.has(nr)||De.c.contract==="native.text.v1")try{for(var sr=(g=void 0,J(ur.zones)),Kr=sr.next();!Kr.done;Kr=sr.next()){var wr=Kr.value,Ye=Math.min(ke.right,wr.right)-Math.max(ke.left,wr.left),gr=Math.min(ke.bottom,wr.bottom)-Math.max(ke.top,wr.top);Ye>.01&&gr>.01&&vr("sdk-safe-area-collision","blocker",nr,"Component intersects a reserved ad-SDK overlay zone.",{bounds:ke,zone:wr,intersection:{width:Ye,height:gr},network:Ee})}}catch(V){g={error:V}}finally{try{Kr&&!Kr.done&&(x=sr.return)&&x.call(sr)}finally{if(g)throw g.error}}}}catch(V){u={error:V}}finally{try{nt&&!nt.done&&(s=jr.return)&&s.call(jr)}finally{if(u)throw u.error}}for(var ct=Mt.filter(function(V){return Zr(V)&&V.c.contract!=="native.group.v1"&&V.c.contract!=="native.stage3d.v1"}),Mr=0;Mr<ct.length;Mr++)for(var ht=Mr+1;ht<ct.length;ht++){var qe=ct[Mr],Ze=ct[ht],Ft=(Re=qe.c.prototypeId)!==null&&Re!==void 0?Re:qe.c.id,Cn=(Ne=Ze.c.prototypeId)!==null&&Ne!==void 0?Ne:Ze.c.id;if(!(Ft===Cn||wt(qe.c,Ze.c.id)||wt(Ze.c,qe.c.id))){var Pn=lt(qe.c,qe.m),qt=lt(Ze.c,Ze.m),Ye=Math.min(Pn.right,qt.right)-Math.max(Pn.left,qt.left),gr=Math.min(Pn.bottom,qt.bottom)-Math.max(Pn.top,qt.top);Ye>1&&gr>1&&vr("interactive-overlap","blocker",Ft,"Interactive targets overlap.",{intersection:{width:Ye,height:gr},first:Pn,second:qt},Cn)}}var ei=function(V){if(!V||V==="transparent")return!1;var Ie=/^#([0-9a-f]{4}|[0-9a-f]{8})$/i.exec(V);if(Ie)return Ie[1].length===4?Ie[1][3].toLowerCase()==="f":Ie[1].slice(6).toLowerCase()==="ff";var Oe=/^rgba\([^,]+,[^,]+,[^,]+,\s*([0-9.]+)\s*\)$/i.exec(V);return Oe?Number(Oe[1])>=.95:!0},mi=[];Mt.forEach(function(V,Ie){var Oe,Qe;V.c.contract==="native.rectangle.v1"&&!Zr(V)&&((Oe=He(V.c).opacity)!==null&&Oe!==void 0?Oe:1)>=.95&&ei(He(V.c).fill)&&mi.push({rowIndex:Ie,row:V,order:(Qe=V.c.order)!==null&&Qe!==void 0?Qe:0,bounds:lt(V.c,V.m)})});var ri=Mt.filter(function(V,Ie){var Oe,Qe=lt(V.c,V.m),kr=(Oe=V.c.order)!==null&&Oe!==void 0?Oe:0;return!mi.some(function(pr){return pr.rowIndex>Ie&&pr.order>kr&&pr.row.c.id!==V.c.id&&!wt(pr.row.c,V.c.id)&&!wt(V.c,pr.row.c.id)&&pr.bounds.left<=Qe.left+1&&pr.bounds.right>=Qe.right-1&&pr.bounds.top<=Qe.top+1&&pr.bounds.bottom>=Qe.bottom-1})}),Tn=ri.map(function(V,Ie){return{row:V,rowIndex:Ie}}).filter(function(V){var Ie,Oe=V.row;if(Oe.c.contract!=="native.rectangle.v1")return!1;var Qe=lt(Oe.c,Oe.m),kr=Qe.right-Qe.left,pr=Qe.bottom-Qe.top,At=((Ie=He(Oe.c).strokeWidth)!==null&&Ie!==void 0?Ie:0)===0&&Qe.left<=0&&Qe.right>=Ue.width;return!At&&kr>=180&&pr>=140&&!Zr(Oe)}).map(function(V){var Ie,Oe=V.row,Qe=V.rowIndex;return{id:(Ie=Oe.c.prototypeId)!==null&&Ie!==void 0?Ie:Oe.c.id,row:Oe,rowIndex:Qe,bounds:lt(Oe.c,Oe.m)}}),En=function(V,Ie,Oe,Qe){var kr,pr;Qe===void 0&&(Qe=!1);var At=(kr=V.c.prototypeId)!==null&&kr!==void 0?kr:V.c.id,ki=(Oe.left+Oe.right)/2,cn=(Oe.top+Oe.bottom)/2,Xa=(pr=V.c.order)!==null&&pr!==void 0?pr:0;return Tn.filter(function(hr){var hn;return hr.id!==At&&(!Qe||hr.rowIndex<Ie||((hn=hr.row.c.order)!==null&&hn!==void 0?hn:0)===Xa)&&Oe.right-Oe.left<=hr.bounds.right-hr.bounds.left+4&&Oe.bottom-Oe.top<=hr.bounds.bottom-hr.bounds.top+4&&ki>=hr.bounds.left&&ki<=hr.bounds.right&&cn>=hr.bounds.top&&cn<=hr.bounds.bottom}).sort(function(hr,hn){return(hr.bounds.right-hr.bounds.left)*(hr.bounds.bottom-hr.bounds.top)-(hn.bounds.right-hn.bounds.left)*(hn.bounds.bottom-hn.bounds.top)||hn.rowIndex-hr.rowIndex})[0]},Be=new Map,dr=new Map;if(Tn.length){ri.forEach(function(V,Ie){var Oe,Qe=(Oe=V.c.prototypeId)!==null&&Oe!==void 0?Oe:V.c.id,kr=lt(V.c,V.m),pr=(kr.left+kr.right)/2,At=(kr.top+kr.bottom)/2,ki=V.c.contract==="native.button.v1"&&!Dt.has(V.c.id),cn=V.c.parentId?We(V.c.parentId):void 0,Xa=V.c.contract==="native.text.v1"&&He(V.c).align==="center"&&(cn==null?void 0:cn.contract)!=="native.button.v1";if(ki||Xa){var hr=En(V,Ie,kr,!1);hr&&(Be.has(hr.id)||Be.set(hr.id,{panel:hr,items:[]}),Be.get(hr.id).items.push({id:Qe,bounds:kr,cx:pr,cy:At,isBtn:ki}))}if(["native.text.v1","native.image.v1","native.button.v1"].includes(V.c.contract)&&(cn==null?void 0:cn.contract)!=="native.button.v1"){var hr=En(V,Ie,kr,!0);hr&&(dr.has(hr.id)||dr.set(hr.id,{panel:hr,content:[]}),dr.get(hr.id).content.push({row:V,id:Qe,bounds:kr}))}});try{for(var Gr=J(Be.values()),Rr=Gr.next();!Rr.done;Rr=Gr.next()){var Tt=Rr.value,xr=Tt.panel,yt=Tt.items;if(yt.some(function(V){return V.isBtn})){var ir=xr.bounds,jt=(ir.left+ir.right)/2;try{for(var Et=(C=void 0,J(yt)),_t=Et.next();!_t.done;_t=Et.next()){var Xt=_t.value,en={left:Xt.bounds.left-ir.left,right:ir.right-Xt.bounds.right,top:Xt.bounds.top-ir.top,bottom:ir.bottom-Xt.bounds.bottom},ti=Math.min(en.left,en.right,en.top,en.bottom);(ti<10||ti*Cr<8)&&vr("panel-edge-cramped","blocker",Xt.id,"Element sits too close to its enclosing panel edge.",{panelId:xr.id,margins:en,scale:Cr,minStagePx:10,minCssPx:8},xr.id)}}catch(V){C={error:V}}finally{try{_t&&!_t.done&&(M=Et.return)&&M.call(Et)}finally{if(C)throw C.error}}var Da=[],xf=function(V){var Ie=Da.find(function(Oe){return Math.abs(Oe.cy-V.cy)<=16&&Oe.isBtn===V.isBtn});Ie?Ie.items.push(V):Da.push({cy:V.cy,isBtn:V.isBtn,items:[V]})};try{for(var Qi=(T=void 0,J(yt)),gi=Qi.next();!gi.done;gi=Qi.next()){var Xt=gi.value;xf(Xt)}}catch(V){T={error:V}}finally{try{gi&&!gi.done&&(I=Qi.return)&&I.call(Qi)}finally{if(T)throw T.error}}try{for(var Ji=(E=void 0,J(Da)),xi=Ji.next();!xi.done;xi=Ji.next()){var Ha=xi.value,If=Math.min.apply(Math,ie([],$(Ha.items.map(function(V){return V.bounds.left})),!1)),bf=Math.max.apply(Math,ie([],$(Ha.items.map(function(V){return V.bounds.right})),!1)),Wo=(If+bf)/2,No=Wo-jt;Math.abs(No)>3&&vr("panel-off-center","blocker",Ha.items[0].id,"Element is not horizontally centered inside its enclosing panel.",{panelId:xr.id,offsetX:No,groupCenterX:Wo,panelCenterX:jt,scale:Cr},xr.id)}}catch(V){E={error:V}}finally{try{xi&&!xi.done&&(A=Ji.return)&&A.call(Ji)}finally{if(E)throw E.error}}}}}catch(V){k={error:V}}finally{try{Rr&&!Rr.done&&(m=Gr.return)&&m.call(Gr)}finally{if(k)throw k.error}}try{for(var qi=J(dr.values()),Ii=qi.next();!Ii.done;Ii=qi.next())for(var Lo=Ii.value,xr=Lo.panel,ji=Lo.content,wf=Be.has(xr.id),Mr=0;Mr<ji.length;Mr++)for(var ht=Mr+1;ht<ji.length;ht++){var qe=ji[Mr],Ze=ji[ht];if(!(qe.id===Ze.id||wt(qe.row.c,Ze.row.c.id)||wt(Ze.row.c,qe.row.c.id))){var Mf=qe.row.c.contract==="native.image.v1"&&Ze.row.c.contract==="native.image.v1";if(!(Mf&&(!wf||qe.row.c.parentId&&qe.row.c.parentId===Ze.row.c.parentId))){var Ye=Math.min(qe.bounds.right,Ze.bounds.right)-Math.max(qe.bounds.left,Ze.bounds.left),gr=Math.min(qe.bounds.bottom,Ze.bounds.bottom)-Math.max(qe.bounds.top,Ze.bounds.top);Ye>2&&gr>2&&vr("panel-content-overlap","blocker",qe.id,"Panel elements overlap each other.",{panelId:xr.id,intersection:{width:Ye,height:gr},first:qe.bounds,second:Ze.bounds},Ze.id)}}}}catch(V){z={error:V}}finally{try{Ii&&!Ii.done&&(N=qi.return)&&N.call(qi)}finally{if(z)throw z.error}}}var ni=ri.filter(function(V){if(V.c.contract!=="native.text.v1")return!1;var Ie=V.c.parentId?We(V.c.parentId):void 0;return(Ie==null?void 0:Ie.contract)!=="native.button.v1"}).map(function(V){var Ie,Oe,Qe=String((Ie=He(V.c).text)!==null&&Ie!==void 0?Ie:"").replace(/\{\{([a-z0-9_.-]+)\}\}/g,function(kr,pr){var At;return String((At=j[pr])!==null&&At!==void 0?At:"")}).trim();return{row:V,id:(Oe=V.c.prototypeId)!==null&&Oe!==void 0?Oe:V.c.id,bounds:lt(V.c,V.m),raw:Qe,norm:Qe.toLowerCase().replace(/[^a-z0-9]+/g," ").trim()}}).filter(function(V){return V.raw.length>0}),kf=Tn.filter(function(V){var Ie,Oe;return((Ie=Be.get(V.id))===null||Ie===void 0?void 0:Ie.items.some(function(Qe){return Qe.isBtn}))||((Oe=dr.get(V.id))===null||Oe===void 0?void 0:Oe.content.some(function(Qe){return Qe.row.c.contract==="native.button.v1"}))});try{for(var _i=J(kf),bi=_i.next();!bi.done;bi=_i.next()){var xr=bi.value,ir=xr.bounds,jt=(ir.left+ir.right)/2,Sf=ir.right-ir.left;try{for(var ea=(F=void 0,J(ni)),wi=ea.next();!wi.done;wi=ea.next()){var rn=wi.value;if(He(rn.row.c).align==="center"&&!(rn.bounds.bottom>ir.top+6||ir.top-rn.bounds.bottom>48)){var Do=rn.bounds.right-rn.bounds.left,Mi=(rn.bounds.left+rn.bounds.right)/2,Cf=Math.min(rn.bounds.right,ir.right)-Math.max(rn.bounds.left,ir.left);(Mi>=ir.left&&Mi<=ir.right||Cf>=Do*.6)&&Do<=Sf+60&&Math.abs(Mi-jt)>4&&vr("header-off-center","blocker",rn.id,"Centered text above a panel is not horizontally aligned with the panel below it.",{panelId:xr.id,offsetX:Mi-jt,textCenterX:Mi,panelCenterX:jt,scale:Cr},xr.id)}}}catch(Qe){F={error:Qe}}finally{try{wi&&!wi.done&&(Y=ea.return)&&Y.call(ea)}finally{if(F)throw F.error}}}}catch(V){L={error:V}}finally{try{bi&&!bi.done&&(B=_i.return)&&B.call(_i)}finally{if(L)throw L.error}}for(var Mr=0;Mr<ni.length;Mr++)for(var ht=Mr+1;ht<ni.length;ht++){var qe=ni[Mr],Ze=ni[ht];if(!(qe.id===Ze.id||wt(qe.row.c,Ze.row.c.id)||wt(Ze.row.c,qe.row.c.id))){var Ye=Math.min(qe.bounds.right,Ze.bounds.right)-Math.max(qe.bounds.left,Ze.bounds.left),gr=Math.min(qe.bounds.bottom,Ze.bounds.bottom)-Math.max(qe.bounds.top,Ze.bounds.top);if(Ye>2&&gr>2&&vr("panel-content-overlap","blocker",qe.id,"Visible text elements overlap.",{intersection:{width:Ye,height:gr},first:qe.bounds,second:Ze.bounds},Ze.id),qe.norm&&Ze.norm){var Ho=$(qe.norm.length<=Ze.norm.length?[qe.norm,Ze.norm]:[Ze.norm,qe.norm],2),ra=Ho[0],Fo=Ho[1];(ra===Fo&&ra.length>=6||ra.length>=12&&Fo.includes(ra))&&vr("duplicate-visible-copy","blocker",qe.id,"Duplicate visible copy appears in multiple text elements simultaneously.",{first:qe.raw,second:Ze.raw},Ze.id)}}}var tn=ni.filter(function(V){return!/^[\d\s/.,:%+\-x]+$/i.test(V.raw)}),ta=tn.reduce(function(V,Ie){return V+(Ie.norm?Ie.norm.split(" ").filter(Boolean).length:0)},0),Fa=tn.reduce(function(V,Ie){return V+Ie.raw.replace(/\s+/g," ").length},0);ta>20||Fa>130||tn.length>5?vr("text-clutter-heavy","blocker",(pe=(Fe=tn[0])===null||Fe===void 0?void 0:Fe.id)!==null&&pe!==void 0?pe:null,"Too much visible copy on one screen; keep playable ads visual and concise.",{blocks:tn.length,wordCount:ta,charCount:Fa,texts:tn.map(function(V){return V.raw})}):(ta>12||tn.length>4)&&vr("text-clutter-heavy","warning",(we=(Ce=tn[0])===null||Ce===void 0?void 0:Ce.id)!==null&&we!==void 0?we:null,"Screen copy is getting dense; consider trimming narration so gameplay carries the experience.",{blocks:tn.length,wordCount:ta,charCount:Fa,texts:tn.map(function(V){return V.raw})});var Xo=ar?ar.filter(function(V){if(Fr.has(V))return!1;var Ie=We(V);return(Ie==null?void 0:Ie.contract)==="native.mesh3d.v1"?!1:!Ie||Er(Ie)}):[];return{ok:!Ke.some(function(V){return V.severity==="blocker"})&&Xo.length===0,viewport:ge(ge({},Ue),{canvasWidth:t.clientWidth,canvasHeight:t.clientHeight,scale:Cr}),defects:Ke,missing:Xo,interactive:ct.map(function(V){var Ie;return{id:(Ie=V.c.prototypeId)!==null&&Ie!==void 0?Ie:V.c.id,bounds:lt(V.c,V.m)}}),texts:Mt.filter(function(V){return V.c.contract==="native.text.v1"}).map(function(V){var Ie,Oe,Qe,kr,pr,At;return{id:(Ie=V.c.prototypeId)!==null&&Ie!==void 0?Ie:V.c.id,text:(Oe=V.textContent)!==null&&Oe!==void 0?Oe:"",direction:(kr=(Qe=V.textMetrics)===null||Qe===void 0?void 0:Qe.direction)!==null&&kr!==void 0?kr:"ltr",align:(At=(pr=V.textMetrics)===null||pr===void 0?void 0:pr.resolvedAlign)!==null&&At!==void 0?At:He(V.c).align}}),safeArea:ur}}function wt(r,o){for(;r.parentId;){if(r.parentId===o)return!0;r=We(r.parentId)}return!1}function Co(r){for(var o=function(s){if(e.gameplay.some(function(p){var h;return p.kind==="camera-follow"&&p.componentId===((h=s.prototypeId)!==null&&h!==void 0?h:s.id)}))return{value:!0}},d=r;d;d=d.parentId?We(d.parentId):void 0){var u=o(d);if(typeof u=="object")return u.value}return!1}function Oa(r){var o=R(),d=t.getBoundingClientRect(),u=Math.min(d.width/o.width,d.height/o.height);return{x:(r.clientX-d.left-(d.width-o.width*u)/2)/u,y:(r.clientY-d.top-(d.height-o.height*u)/2)/u}}function uf(r,o){var d,u,s,p;try{try{for(var h=J(r.clips),g=h.next();!g.done;g=h.next()){var x=g.value,k=cr(Ut(x.matrix),o.x,o.y);if(k.x<0||k.y<0||k.x>x.width||k.y>x.height)return!1}}catch(B){d={error:B}}finally{try{g&&!g.done&&(u=h.return)&&u.call(h)}finally{if(d)throw d.error}}var m=cr(Ut(r.m),o.x,o.y),C=He(r.c);if(r.c.contract==="native.path.v1"){var M=new Path2D,T=function(B,F){({M:function(){return M.moveTo.apply(M,ie([],$(F),!1))},L:function(){return M.lineTo.apply(M,ie([],$(F),!1))},C:function(){return M.bezierCurveTo.apply(M,ie([],$(F),!1))},Q:function(){return M.quadraticCurveTo.apply(M,ie([],$(F),!1))},Z:function(){return M.closePath()}})[B]()};try{for(var I=J(C.commands),E=I.next();!E.done;E=I.next()){var A=$(E.value),z=A[0],N=A.slice(1);T(z,N)}}catch(B){s={error:B}}finally{try{E&&!E.done&&(p=I.return)&&p.call(I)}finally{if(s)throw s.error}}y.save(),y.setTransform(1,0,0,1,0,0),y.lineWidth=C.strokeWidth;var L=y.isPointInPath(M,m.x,m.y)||C.strokeWidth>0&&y.isPointInStroke(M,m.x,m.y);return y.restore(),L}return r.c.contract==="native.ellipse.v1"?Math.pow((m.x-C.width/2)/(C.width/2),2)+Math.pow((m.y-C.height/2)/(C.height/2),2)<=1:m.x>=0&&m.y>=0&&m.x<=C.width&&m.y<=C.height}catch{return!1}}function Zi(r){return ie([],$(Ot),!1).reverse().find(function(o){return o.c.contract!=="native.group.v1"&&o.c.sceneId===_&&We(o.c.id)&&Er(o.c)&&uf(o,r)})}function $i(r){for(var o=[];r;)o.push(r),r=We(r.parentId);return o}function Ba(){if(!Xe)return{vx:0,vy:0,power:0,pull:0};var r=Xe.behavior.parameters,o=Xe.current.x-Xe.start.x,d=Xe.current.y-Xe.start.y,u=Math.hypot(o,d),s=Math.max(0,Math.min(1,(u-r.minPullPx)/Math.max(1,r.maxPullPx-r.minPullPx))),p=r.minSpeed+(r.maxSpeed-r.minSpeed)*s,h=r.invert?-1:1;return{vx:u?o/u*p*h:0,vy:u?d/u*p*h:0,power:s,pull:u}}function Po(r){if(Xe){Xe.current=r;var o=Ba();Xe.power=o.power,Xe.behavior.parameters.powerVariableId&&(j[Xe.behavior.parameters.powerVariableId]=o.power)}}function To(r){var o,d;r===void 0&&(r=!1);try{var u=(o=globalThis.AudioContext)!==null&&o!==void 0?o:globalThis.webkitAudioContext;u&&!_e&&(_e=new u,(d=_e.addEventListener)===null||d===void 0||d.call(_e,"statechange",function(){(_e==null?void 0:_e.state)==="running"&&Sa()})),hi(r)}catch{}}function vf(r,o,d){var u,s,p,h,g,x,k=function(F){var Y=d.find(function(ue){var ne;return((ne=ue.prototypeId)!==null&&ne!==void 0?ne:ue.id)===F.componentId});if(!Y)return"continue";var X=cr(Ut(yr(Y)),o.x,o.y),te=ci(Y,F);return te.stampSegment(X,X),Yr={kind:"mask",pointerId:r.pointerId,c:Y,behavior:F,last:X},(g=t.setPointerCapture)===null||g===void 0||g.call(t,r.pointerId),{value:!0}};try{for(var m=J(e.gameplay.filter(function(F){var Y;return F.kind==="erase-mask"&&((Y=O.get(F.componentId))===null||Y===void 0?void 0:Y.sceneId)===_})),C=m.next();!C.done;C=m.next()){var M=C.value,T=k(M);if(typeof T=="object")return T.value}}catch(F){u={error:F}}finally{try{C&&!C.done&&(s=m.return)&&s.call(m)}finally{if(u)throw u.error}}if(d.some(function(F){return F.contract==="native.button.v1"||e.events.some(function(Y){var X;return Y.kind==="click"&&Y.componentId===((X=F.prototypeId)!==null&&X!==void 0?X:F.id)})}))return!1;try{for(var I=J(e.gameplay.filter(function(F){var Y;return F.kind==="draw-stroke"&&((Y=O.get(F.componentId))===null||Y===void 0?void 0:Y.sceneId)===_})),E=I.next();!E.done;E=I.next()){var M=E.value,A=O.get(M.componentId),z=Ut(yr(A)),N=cr(z,o.x,o.y),L=He(A);if(!(N.x<0||N.y<0||N.x>L.width||N.y>L.height)){var B=Hl(M);return B.begin(o),Yr={kind:"stroke",pointerId:r.pointerId,c:A,behavior:M,store:B,last:o},rr({kind:"strokeStart",componentId:A.id}),(x=t.setPointerCapture)===null||x===void 0||x.call(t,r.pointerId),!0}}}catch(F){p={error:F}}finally{try{E&&!E.done&&(h=I.return)&&h.call(I)}finally{if(p)throw p.error}}return!1}function sf(r,o,d){var u,s,p,h,g,x,k,m=d.store.active;if(m){try{for(var C=J(e.gameplay.filter(function(te){var ue;return te.kind==="collider"&&((ue=O.get(te.componentId))===null||ue===void 0?void 0:ue.sceneId)===_})),M=C.next();!M.done;M=C.next()){var T=M.value,I=O.get(T.componentId);try{for(var E=(p=void 0,J(Hr(I))),A=E.next();!A.done;A=E.next()){var z=A.value;!Er(z)||m.hitIds.has(z.id)||nl(r,o,So(z,T.parameters.shape))&&(m.hitIds.add(z.id),rr(ot("sliceHit",z)))}}catch(te){p={error:te}}finally{try{A&&!A.done&&(h=E.return)&&h.call(E)}finally{if(p)throw p.error}}}}catch(te){u={error:te}}finally{try{M&&!M.done&&(s=C.return)&&s.call(C)}finally{if(u)throw u.error}}try{for(var N=J(wn),L=N.next();!L.done;L=N.next()){var B=L.value;if(!(B.broken||!B.breakable||m.hitIds.has(B.key))){var F=Bt.get(B.bodyId),Y=We(B.anchorId);if(!(!F||!Y)){var X=Or(Y);qa(r,o,{x:X.x,y:X.y},{x:F.x,y:F.y})&&(m.hitIds.add(B.key),B.broken=!0,Li.add(B.key),rr({kind:"jointBreak",behaviorId:B.id,componentId:B.componentId,selfInstanceId:B.bodyId,instanceId:(k=We(B.bodyId))===null||k===void 0?void 0:k.instanceId}))}}}}catch(te){g={error:te}}finally{try{L&&!L.done&&(x=N.return)&&x.call(N)}finally{if(g)throw g.error}}}}function cf(r,o){var d,u=o.last,s=o.behavior.parameters;if(s.inkVariableId){var p=s.inkVariableId,h=Math.hypot(r.x-u.x,r.y-u.y);if(((d=j[p])!==null&&d!==void 0?d:0)<h)return;j[p]-=h}o.store.add(r)&&(s.mode==="slice-blade"&&sf(u,r,o),o.last=r)}function hf(r){var o,d;if(!(!Yr||Yr.pointerId!==r.pointerId)){var u=Yr;Yr=void 0;try{!((o=t.hasPointerCapture)===null||o===void 0)&&o.call(t,r.pointerId)&&((d=t.releasePointerCapture)===null||d===void 0||d.call(t,r.pointerId))}catch{}if(u.kind==="stroke"){var s=u.store.end(),p=u.behavior.parameters;if(s){if(p.mode==="physics-wall"){var h=new Set(u.store.strokes.map(function(x){return x.id}));Kt=Kt.filter(function(x){return x.owner!==u.c.id||h.has(x.strokeId)}),Kt.push.apply(Kt,ie([],$(al(s,p.strokeWidth).map(function(x){return ge(ge({},x),{owner:u.c.id})})),!1))}else if(p.mode==="path-trace"){var g=We(p.followComponentId);g&&s.points.length>1&&Wn.set(g.id,{points:s.points,index:1,speed:p.followSpeed})}}rr({kind:"strokeEnd",componentId:u.c.id})}}}function yf(r){var o,d,u,s;try{for(var p=J(fn.values()),h=p.next();!h.done;h=p.next()){var g=h.value;g.tick(r)}}catch(B){o={error:B}}finally{try{h&&!h.done&&(d=p.return)&&d.call(p)}finally{if(o)throw o.error}}try{for(var x=J(Wn),k=x.next();!k.done;k=x.next()){var m=$(k.value,2),C=m[0],M=m[1],T=We(C);if(!T){Wn.delete(C);continue}var I=M.points[M.index];if(!I){Wn.delete(C),rr(ot("pathArrive",T));continue}var E=Or(T),A=I.x-E.x,z=I.y-E.y,N=Math.hypot(A,z),L=M.speed*r;N<=L?(Jt(T,I.x,I.y),M.index++):N>.001&&Jt(T,E.x+A/N*L,E.y+z/N*L)}}catch(B){u={error:B}}finally{try{k&&!k.done&&(s=x.return)&&s.call(x)}finally{if(u)throw u.error}}}function pf(r,o,d){var u,s,p=[],h=[],g=function(C){var M=O.get(C.componentId),T=C.parameters.dragMode==="anywhere"?Hr(M).find(function(A){return Er(A)}):d.find(function(A){var z;return((z=A.prototypeId)!==null&&z!==void 0?z:A.id)===M.id});if(!T)return"continue";if(C.kind==="swipe-input")h.push({behavior:C,c:T});else{var I=C.parameters,E=Math.max(I.min,Math.min(I.max,Number(j[I.variableId])));j[I.variableId]=E,p.push({behavior:C,c:T,charge:Qo(I,E)}),rr(ot("holdStart",T))}};try{for(var x=J(e.gameplay.filter(function(C){var M;return["swipe-input","hold-charge"].includes(C.kind)&&((M=O.get(C.componentId))===null||M===void 0?void 0:M.sceneId)===_})),k=x.next();!k.done;k=x.next()){var m=k.value;g(m)}}catch(C){u={error:C}}finally{try{k&&!k.done&&(s=x.return)&&s.call(x)}finally{if(u)throw u.error}}(p.length||h.length)&&(br={pointerId:r.pointerId,start:o,current:o,holds:p,swipes:h})}function mf(r,o){var d,u,s,p,h,g,x,k;if(!(!br||br.pointerId!==r.pointerId)){var m=br,C=new Set;br=void 0;try{for(var M=J(ie(ie([],$(m.holds),!1),$(m.swipes),!1)),T=M.next();!T.done;T=M.next()){var I=T.value,E=I.behavior,A=I.c;C.has(E.componentId)||(C.add(E.componentId),rr(ot("pointerUp",A,void 0,{targetId:A.id,pointerId:r.pointerId})))}}catch(ne){d={error:ne}}finally{try{T&&!T.done&&(u=M.return)&&u.call(M)}finally{if(d)throw d.error}}try{for(var z=J(m.holds),N=z.next();!N.done;N=z.next()){var L=N.value,B=L.behavior.parameters;if(rr(ot("holdRelease",L.c)),B.resetOnRelease!==!1){var F=j[B.variableId];j[B.variableId]=B.min,F!==B.min&&rr({kind:"variableChange",variableId:B.variableId,selfInstanceId:(x=L.c.instanceId)!==null&&x!==void 0?x:L.c.id,instanceId:L.c.instanceId})}}}catch(ne){s={error:ne}}finally{try{N&&!N.done&&(p=z.return)&&p.call(z)}finally{if(s)throw s.error}}try{for(var Y=J(m.swipes),X=Y.next();!X.done;X=Y.next()){var te=X.value,ue=Ko(m.start,o,te.behavior.parameters.minDistancePx,(k=Ni.get(te.behavior.id))!==null&&k!==void 0?k:-1/0,ce*1e3,te.behavior.parameters.cooldownMs);ue&&(Ni.set(te.behavior.id,ce*1e3),rr(ot("swipe",te.c,void 0,{direction:ue})))}}catch(ne){h={error:ne}}finally{try{X&&!X.done&&(g=Y.return)&&g.call(Y)}finally{if(h)throw h.error}}return C}}function gf(r,o,d){var u,s,p;if(d.some(function(E){return E.contract==="native.button.v1"&&He(E).enabled}))return!1;try{for(var h=J(e.gameplay.filter(function(E){var A;return E.kind==="virtual-joystick"&&((A=O.get(E.componentId))===null||A===void 0?void 0:A.sceneId)===_})),g=h.next();!g.done;g=h.next()){var x=g.value,k=O.get(x.componentId);if(Er(k)){var m=dn.get(x.id);if(!(m&&m.pointerId!==null)){var C=cr(Ut(yr(k)),o.x,o.y),M=He(k);if(!(C.x<0||C.y<0||C.x>M.width||C.y>M.height)){var T=x.parameters.mode==="floating"?ge({},o):Or(k),I=$a(T,o,x.parameters.radiusPx,x.parameters.deadZone);return m=ge({behavior:x,c:k,pointerId:r.pointerId,origin:T,current:o},I),dn.set(x.id,m),ga(m),rr(ot("joystickStart",k)),(p=t.setPointerCapture)===null||p===void 0||p.call(t,r.pointerId),!0}}}}}catch(E){u={error:E}}finally{try{g&&!g.done&&(s=h.return)&&s.call(h)}finally{if(u)throw u.error}}return!1}var Eo=function(r){var o,d,u,s,p,h,g,x,k,m,C;b();var M=Oa(r),T=Zi(M);if(vi=M,!(!T&&S)){if(S){T&&(Zt=T.c.id,G((p=T.c.prototypeId)!==null&&p!==void 0?p:T.c.id));return}var I=e.gameplay.some(function(Ce){return Ce.kind==="virtual-joystick"||Ce.kind==="fps-controller-3d"});if(!(!r.isTrusted||r.button!==void 0&&r.button!==0||!I&&r.isPrimary===!1||Tr||Vn||!I&&(Ge&&Ge.pointerId!==r.pointerId||br&&br.pointerId!==r.pointerId||Xe&&Xe.pointerId!==r.pointerId)||ee&&(!fi||!Yn))){var E=!gn;sa=ce,Vi=!0,gn=!0,To(!0),E&&!Rt&&(Lr=zr=0,un());var A=T?$i(T.c):[];if(gf(r,M,A)){Lr=zr=0,Rt=!1,un(),tt();return}if(vf(r,M,A)){un(),tt();return}pf(r,M,A);var z=e.gameplay.find(function(Ce){return Ce.kind==="aim-launch"&&O.get(Ce.componentId).sceneId===_&&(Ce.parameters.dragMode==="anywhere"&&!A.some(function(we){return we.contract==="native.button.v1"})||A.some(function(we){var Me;return((Me=we.prototypeId)!==null&&Me!==void 0?Me:we.id)===Ce.componentId}))});if(z){var N=O.get(z.componentId),L=(h=A.find(function(Ce){var we;return((we=Ce.prototypeId)!==null&&we!==void 0?we:Ce.id)===N.id}))!==null&&h!==void 0?h:Hr(N).find(function(Ce){return Er(Ce)}),B=L&&Ln(L,It("physics-body",N.id));if(B&&(!z.parameters.onlyWhenAtRest||B.atRest)){Xe={behavior:z,targetId:L.id,sourceId:N.id,pointerId:r.pointerId,start:M,current:M,power:0},Po(M),(g=t.setPointerCapture)===null||g===void 0||g.call(t,r.pointerId),tt();return}}try{for(var F=J(A),Y=F.next();!Y.done;Y=F.next()){var X=Y.value,te=It("press-feedback",(x=X.prototypeId)!==null&&x!==void 0?x:X.id);te&&(X.contract!=="native.button.v1"||He(X).enabled)&&In.set(X.id,{behavior:te.parameters,pointerId:r.pointerId,held:!0})}}catch(Ce){o={error:Ce}}finally{try{Y&&!Y.done&&(d=F.return)&&d.call(F)}finally{if(o)throw o.error}}var ue=A.find(function(Ce){var we;return((we=Dt.get(Ce.id))===null||we===void 0?void 0:we.sceneId)===_});if(ue){var ne=xt.get(ue.parentId);if(ne!=null&&ne.snapshot().busy)return;Zl(ue),ne&&!ne.snapshot().busy&&(rt={pointerId:r.pointerId,boardId:ue.parentId,tileId:ue.id,start:M},(k=t.setPointerCapture)===null||k===void 0||k.call(t,r.pointerId))}it=(m=A.find(function(Ce){return Ce.contract==="native.button.v1"&&He(Ce).enabled}))===null||m===void 0?void 0:m.id,Lt=it?r.pointerId:void 0;var xe=e.gameplay.find(function(Ce){return Ce.kind==="drag"&&A.some(function(we){var Me;return((Me=we.prototypeId)!==null&&Me!==void 0?Me:we.id)===Ce.componentId})});if(xe){var X=A.find(function(we){var Me;return((Me=we.prototypeId)!==null&&Me!==void 0?Me:we.id)===xe.componentId}),Re=Or(X),Ne=Vr.zoneOf(X.id);Wi.set(X.id,Re),Vr.release(X.id),Ge={b:xe,targetId:X.id,start:M,current:M,origin:Re,originZone:Ne,m:ie([],$(bt(X)),!1),pointerId:r.pointerId},rr(ot("dragStart",X)),t.setPointerCapture(r.pointerId)}Lr=zr=0,Rt=!1;try{for(var Fe=J(A),pe=Fe.next();!pe.done;pe=Fe.next()){var X=pe.value;(X.contract!=="native.button.v1"||He(X).enabled)&&rr({kind:"click",componentId:(C=X.prototypeId)!==null&&C!==void 0?C:X.id,instanceId:X.instanceId,targetId:X.id,pointerId:r.pointerId})}}catch(Ce){u={error:Ce}}finally{try{pe&&!pe.done&&(s=Fe.return)&&s.call(Fe)}finally{if(u)throw u.error}}un(),tt()}}};function Ao(r,o){if(!rt||rt.pointerId!==r.pointerId)return!1;if(!r.isTrusted||!qn())return!0;var d=rt,u=xt.get(d.boardId);if(u.snapshot().busy)return rt=void 0,!0;var s=Ut(yr(O.get(d.boardId))),p=cr(s,d.start.x,d.start.y),h=cr(s,o.x,o.y),g=h.x-p.x,x=h.y-p.y,k=O.get(d.tileId);if(Math.max(Math.abs(g),Math.abs(x))<Math.min(k.parameters.width,k.parameters.height)*.35)return!0;var m=Dt.get(k.id),C=Math.abs(g)>Math.abs(x),M=m.row+(C?0:Math.sign(x)),T=m.column+(C?Math.sign(g):0),I=ie([],$(Dt),!1).find(function(E){var A=$(E,2),z=A[1];return z.boardId===d.boardId&&z.row===M&&z.column===T});return I&&u.swap(k.id,I[0])&&(Dr=void 0,tt()),rt=void 0,!0}var Ro=function(r){var o,d,u,s;if(!Tr){b();var p=R(),h=Oa(r);vi=h,(br==null?void 0:br.pointerId)===r.pointerId&&(br.current=h);try{for(var g=J(dn.values()),x=g.next();!x.done;x=g.next()){var k=x.value;if(k.pointerId===r.pointerId){var m=h.x-k.current.x,C=h.y-k.current.y;Object.assign(k,{current:h},$a(k.origin,h,k.behavior.parameters.radiusPx,k.behavior.parameters.deadZone)),ga(k),tt();return}}}catch(we){o={error:we}}finally{try{x&&!x.done&&(d=g.return)&&d.call(g)}finally{if(o)throw o.error}}if((Yr==null?void 0:Yr.pointerId)===r.pointerId){if(Yr.kind==="mask"){var M=Yr,T=cr(Ut(yr(M.c)),h.x,h.y);ci(M.c,M.behavior).stampSegment(M.last,T),M.last=T}else cf(h,Yr);un(),tt();return}if((Xe==null?void 0:Xe.pointerId)===r.pointerId){r.isTrusted&&qn()&&Po(h),tt();return}var I=Zi(h);if(Gt=I?(u=$i(I.c).find(function(we){return we.contract==="native.button.v1"}))===null||u===void 0?void 0:u.id:void 0,!Ao(r,h)&&!(!Ge||Ge.pointerId!==r.pointerId)){var E=We(Ge.targetId);if(!E){Di();return}var A=E.parentId?yr(We(E.parentId)):nn(),z=Ut(A),N=cr(z,Ge.start.x,Ge.start.y),L=cr(z,h.x,h.y),B=ie([],$(Ge.m),!1),F=Ge.b.parameters.axis;if(F!=="y"){var Y=Ge.m[4]+L.x-N.x;Number.isFinite(Ge.b.parameters.minX)&&(Y=Math.max(Ge.b.parameters.minX,Y)),Number.isFinite(Ge.b.parameters.maxX)&&(Y=Math.min(Ge.b.parameters.maxX,Y)),B[4]=Y}if(F!=="x"){var X=Ge.m[5]+L.y-N.y;Number.isFinite(Ge.b.parameters.minY)&&(X=Math.max(Ge.b.parameters.minY,X)),Number.isFinite(Ge.b.parameters.maxY)&&(X=Math.min(Ge.b.parameters.maxY,X)),B[5]=X}if(!E.parentId)F!=="y"&&(B[4]=Math.max(0,Math.min(p.width-E.parameters.width,B[4])));else{var te=lt(E,ii(A,B)),ue=0;te.left<0||te.right-te.left>p.width?ue=-te.left:te.right>p.width&&(ue=p.width-te.right);var ne=F==="y"?0:A[0],xe=F==="x"?0:A[2];Math.abs(ne)>=Math.abs(xe)&&Math.abs(ne)>1e-8?B[4]+=ue/ne:Math.abs(xe)>1e-8&&(B[5]+=ue/xe)}var Re=(s=Je.get(E.id))!==null&&s!==void 0?s:{parameters:{}};Je.set(E.id,ge(ge({},Re),{transform:B})),Ge.current=h;var Ne=Pa(E),Fe=Ne.zones,pe=Ne.tag,Ce=ia({itemId:E.id,tag:pe,zones:Fe,occupancy:Vr});bn=Ce&&Ce.kind!=="reject"?Ce.zone:void 0}}},Vo=function(r){var o,d,u,s;b();var p=Oa(r),h=mt;vi=p,xa(r.pointerId,!0),hf(r);var g=(u=mf(r,p))!==null&&u!==void 0?u:new Set;if($l(r),r.isTrusted&&qn()){var x=Zi(p);try{for(var k=J(x?$i(x.c):[]),m=k.next();!m.done;m=k.next()){var C=m.value;!g.has((s=C.prototypeId)!==null&&s!==void 0?s:C.id)&&(C.contract!=="native.button.v1"||He(C).enabled)&&rr(ot("pointerUp",C,void 0,{targetId:C.id,pointerId:r.pointerId}))}}catch(A){o={error:A}}finally{try{m&&!m.done&&(d=k.return)&&d.call(k)}finally{if(o)throw o.error}}}if(un(),tt(),(Xe==null?void 0:Xe.pointerId)===r.pointerId){var M=Xe,T=Ba(),I=Bt.get(M.targetId);Xe=void 0,M.behavior.parameters.powerVariableId&&(j[M.behavior.parameters.powerVariableId]=0),I&&r.isTrusted&&qn()&&T.pull>=M.behavior.parameters.minPullPx&&(I.vx=T.vx,I.vy=T.vy,I.atRest=!1,I.restElapsed=0,I.captured=!1,I.exited=!1,rr({kind:"launch",componentId:M.sourceId,instanceId:I.instanceId})),Ia(r),un(),tt();return}if(Ao(r,p),(rt==null?void 0:rt.pointerId)===r.pointerId&&(rt=void 0),Ia(r),!((h==null?void 0:h.pointerId)!==r.pointerId||!r.isTrusted||!qn()||navigator.userActivation&&navigator.userActivation.isActive!==!0||!Ui(h.condition))){var E=Zi(p);!E||!$i(E.c).some(function(A){return A.id===h.targetId&&(A.contract!=="native.button.v1"||He(A).enabled)})||(ee?ee.openStore(e.base.storeUrl):window.open(e.base.storeUrl,"_blank","noopener"))}},Ki=function(r){var o,d;if(xa(r.pointerId,!0),(Xe==null?void 0:Xe.pointerId)===r.pointerId&&(Xe.behavior.parameters.powerVariableId&&(j[Xe.behavior.parameters.powerVariableId]=0),Xe=void 0),(rt==null?void 0:rt.pointerId)===r.pointerId&&(rt=void 0),(Yr==null?void 0:Yr.pointerId)===r.pointerId&&(Yr.kind==="stroke"&&Yr.store.cancel(),Yr=void 0),(br==null?void 0:br.pointerId)===r.pointerId){try{for(var u=J(br.holds),s=u.next();!s.done;s=u.next()){var p=s.value;p.behavior.parameters.resetOnRelease!==!1&&(j[p.behavior.parameters.variableId]=p.behavior.parameters.min)}}catch(h){o={error:h}}finally{try{s&&!s.done&&(d=u.return)&&d.call(u)}finally{if(o)throw o.error}}br=void 0}Ia(r)},Oo=function(r){r!=null&&r.isTrusted&&!S&&!Tr&&!Vn&&To(!0)},za=function(){Oi||tt()},Mn=typeof globalThis.ResizeObserver=="function"?new globalThis.ResizeObserver(za):void 0;try{(v=Mn==null?void 0:Mn.observe)===null||v===void 0||v.call(Mn,t)}catch{}var Bo=function(){lr=0,Sr=0,document.hidden&&Qt(),_e&&(document.hidden?_e.suspend().catch(function(){}):!Tr&&gn&&hi())};document.addEventListener("visibilitychange",Bo),(c=globalThis.addEventListener)===null||c===void 0||c.call(globalThis,"resize",za),t.addEventListener("pointerdown",Eo),t.addEventListener("pointermove",Ro),t.addEventListener("pointerup",Vo),t.addEventListener("pointercancel",Ki),t.addEventListener("lostpointercapture",Ki),t.addEventListener("click",Oo);var Wa=ee==null?void 0:ee.onVisibilityChanged(function(r){Yn=r,lr=0,Sr=0,r||Qt(),_e&&(r?!Tr&&gn&&hi():_e.suspend().catch(function(){}))}),Na=ee==null?void 0:ee.onClosed(function(){Vn=!0,lr=0,Sr=0,Qt(),si()}),La=(P=ee==null?void 0:ee.onVolumeChanged)===null||P===void 0?void 0:P.call(ee,function(r){typeof r=="number"&&Number.isFinite(r)&&r>=0&&(pa=Math.min(1,r>1?r/100:r),Ca())});function zo(r){var o=!S&&!Tr&&!document.hidden&&fi&&Yn&&!Vn;if(o&&Sr&&($e+=Math.min((r-Sr)/1e3,5/60)),qn()){Lr=zr=0,Rt=!1,Sr&&(lr+=Math.min((r-Sr)/1e3,5/60));for(var d=0;d<5&&lr>=1/60;d++)ef(1/60),lr-=1/60;un()}else lr=0;Sr=r,tt(),ln=requestAnimationFrame(zo)}return ka(),S&&(_=re),tt(),ln=requestAnimationFrame(zo),ee&&ee.init().then(function(){Oi||(fi=!0,Yn=ee.isVisible(),lr=0,Sr=0)}).catch(function(){Oi||(Vn=!0,Qt(),si())}),{state:zl,auditViewport:ff,auditSceneLayout:df,restart:function(){var r;(r=ee==null?void 0:ee.notifyGameRetry)===null||r===void 0||r.call(ee),ka(),tt()},select:function(r){Zt=r},inspectScene:function(r){S&&e.scenes.some(function(o){return o.id===r})&&(_=r,Zt=void 0)},pause:function(r){Tr=r,lr=0,Sr=0,r&&Qt(),_e&&(r?_e.suspend().catch(function(){}):gn&&hi())},destroy:function(){var r,o;Oi=!0,cancelAnimationFrame(ln),Qt(),si(),Wa==null||Wa(),Na==null||Na(),La==null||La(),ee==null||ee.destroy(),(r=Mn==null?void 0:Mn.disconnect)===null||r===void 0||r.call(Mn),document.removeEventListener("visibilitychange",Bo),(o=globalThis.removeEventListener)===null||o===void 0||o.call(globalThis,"resize",za),t.removeEventListener("pointerdown",Eo),t.removeEventListener("pointermove",Ro),t.removeEventListener("pointerup",Vo),t.removeEventListener("pointercancel",Ki),t.removeEventListener("lostpointercapture",Ki),t.removeEventListener("click",Oo),_e==null||_e.close().catch(function(){})}}}return Vf(dd);})();
|