/
a19x9y7
/
SolarScrap2
Обзор
Документация
Войти
/
a19x9y7
/
SolarScrap2
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
scripts/c3runtime.js
1 443 строки
1 MB
a19x9y7
Create: new_file, c3main.js, c3runtime.js, dispatchworker.js, jobworker.js, main.js, modernjscheck.js, objRefTable.js, offlineclient.js, register-sw.js, supportcheck.js
20 июл 2026, 07:35
Верифицирован
20 июл 2026, 07:35
b8bac69
Код
Авторство
О чём код?
// Generated by Construct, the game and animation creation tool // Visit: https://www.construct.net // ../3rdparty/glmatrix.js { /*! @fileoverview gl-matrix - High performance matrix and vector operations @author Brandon Jones @author Colin MacKenzie IV @version 3.4.1 Copyright (c) 2015-2021, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ var EPSILON=1e-6,ARRAY_TYPE="undefined"!=typeof Float32Array?Float32Array:Array,RANDOM=Math.random,ANGLE_ORDER="zyx";function setMatrixArrayType(t){ARRAY_TYPE=t}var degree=Math.PI/180;function toRadia … [Строка слишком длинная. Вы можете скачать файл] } // 3rdparty/poly-decomp.js { function lineInt(o,n,t){t=t||0;var e,l,p,g,r,i,y,u=[0,0];return e=o[1][1]-o[0][1],l=o[0][0]-o[1][0],p=e*o[0][0]+l*o[0][1],g=n[1][1]-n[0][1],r=n[0][0]-n[1][0],i=g*n[0][0]+r*n[0][1],scalar_eq(y=e*r-g*l,0,t)||(u[0]=(r*p-l*i)/y,u[1]=(e*i-g*p)/y),u}function lineSegmentsIntersect(o,n,t,e){var l=n[0]-o[0],p=n[1]-o[1],g=e[0]-t[0],r=e[1]-t[1];if(g*p-r*l===0)return!1;var i=(l*(t[1]-o[1])+p*(o[0]-t[0]))/(g*p-r*l),y=(g*(o[1]-t[1])+r*(t[0]-o[0]))/(r*l-g*p);return i>=0&&i<=1&&y>=0&&y<=1}function triangleArea(o,n,t){return(n[0]-o[0])*(t[1]-o[1])-(t[0]-o[0])*(n[1]-o[1])}function isLeft(o,n,t){return triangleArea(o,n,t)>0}function isLeftOn(o,n,t){return triangleArea(o,n,t)>=0}function isRight(o,n,t){return triangleArea(o,n,t)<0}function isRightOn(o,n,t){return triangleArea(o,n,t)<=0}var tmpPoint1=[],tmpPoint2=[];function collinear(o,n,t,e){if(e){var l=tmpPoint1,p=tmpPoint2;l[0]=n[0]-o[0],l[1]=n[1]-o[1],p[0]=t[0]-n[0],p[1]=t[1]-n[1];var g=l[0]*p[0]+l[1]*p[1],r=Math.sqrt(l[0]*l[0]+l[1]*l[1]),i=Math.sqrt(p[0]*p[0]+p[1]*p[1]);return Math.acos(g/(r*i))<e}return 0===triangleArea(o,n,t)}function sqdist(o,n){var t=n[0]-o[0],e=n[1]-o[1];return t*t+e*e}function polygonAt(o,n){var t=o.length;return o[n<0?n%t+t:n%t]}function polygonClear(o){o.length=0}function polygonAppend(o,n,t,e){for(var l=t;l<e;l++)o.push(n[l])}function polygonMakeCCW(o){for(var n=0,t=o,e=1;e<o.length;++e)(t[e][1]<t[n][1]||t[e][1]===t[n][1]&&t[e][0]>t[n][0])&&(n=e);return!isLeft(polygonAt(o,n-1),polygonAt(o,n),polygonAt(o,n+1))&&(polygonReverse(o),!0)}function polygonReverse(o){for(var n=[],t=o.length,e=0;e!==t;e++)n.push(o.pop());for(e=0;e!==t;e++)o[e]=n[e]}function polygonIsReflex(o,n){return isRight(polygonAt(o,n-1),polygonAt(o,n),polygonAt(o,n+1))}var tmpLine1=[],tmpLine2=[];function polygonCanSee(o,n,t){var e,l,p=tmpLine1,g=tmpLine2;if(isLeftOn(polygonAt(o,n+1),polygonAt(o,n),polygonAt(o,t))&&isRightOn(polygonAt(o,n-1),polygonAt(o,n),polygonAt(o,t)))return!1;l=sqdist(polygonAt(o,n),polygonAt(o,t));for(var r=0;r!==o.length;++r)if((r+1)%o.length!==n&&r!==n&&isLeftOn(polygonAt(o,n),polygonAt(o,t),polygonAt(o,r+1))&&isRightOn(polygonAt(o,n),polygonAt(o,t),polygonAt(o,r))&&(p[0]=polygonAt(o,n),p[1]=polygonAt(o,t),g[0]=polygonAt(o,r),g[1]=polygonAt(o,r+1),e=lineInt(p,g),sqdist(polygonAt(o,n),e)<l))return!1;return!0}function polygonCanSee2(o,n,t){for(var e=0;e!==o.length;++e)if(e!==n&&e!==t&&(e+1)%o.length!==n&&(e+1)%o.length!==t&&lineSegmentsIntersect(polygonAt(o,n),polygonAt(o,t),polygonAt(o,e),polygonAt(o,e+1)))return!1;return!0}function polygonCopy(o,n,t,e){var l=e||[];if(polygonClear(l),n<t)for(var p=n;p<=t;p++)l.push(o[p]);else{for(p=0;p<=t;p++)l.push(o[p]);for(p=n;p<o.length;p++)l.push(o[p])}return l}function polygonGetCutEdges(o){for(var n=[],t=[],e=[],l=[],p=Number.MAX_VALUE,g=0;g<o.length;++g)if(polygonIsReflex(o,g))for(var r=0;r<o.length;++r)if(polygonCanSee(o,g,r)){t=polygonGetCutEdges(polygonCopy(o,g,r,l)),e=polygonGetCutEdges(polygonCopy(o,r,g,l));for(var i=0;i<e.length;i++)t.push(e[i]);t.length<p&&(n=t,p=t.length,n.push([polygonAt(o,g),polygonAt(o,r)]))}return n}function polygonDecomp(o){var n=polygonGetCutEdges(o);return n.length>0?polygonSlice(o,n):[o]}function polygonSlice(o,n){if(0===n.length)return[o];if(n instanceof Array&&n.length&&n[0]instanceof Array&&2===n[0].length&&n[0][0]instanceof Array){for(var t=[o],e=0;e<n.length;e++)for(var l=n[e],p=0;p<t.length;p++){var g=polygonSlice(t[p],l);if(g){t.splice(p,1),t.push(g[0],g[1]);break}}return t}l=n,e=o.indexOf(l[0]),p=o.indexOf(l[1]);return-1!==e&&-1!==p&&[polygonCopy(o,e,p),polygonCopy(o,p,e)]}function polygonIsSimple(o){var n,t=o;for(n=0;n<t.length-1;n++)for(var e=0;e<n-1;e++)if(lineSegmentsIntersect(t[n],t[n+1],t[e],t[e+1]))return!1;for(n=1;n<t.length-2;n++)if(lineSegmentsIntersect(t[0],t[t.length-1],t[n],t[n+1]))return!1;return!0}function getIntersectionPoint(o,n,t,e,l){l=l||0;var p=n[1]-o[1],g=o[0]-n[0],r=p*o[0]+g*o[1],i=e[1]-t[1],y=t[0]-e[0],u=i*t[0]+y*t[1],s=p*y-i*g;return scalar_eq(s,0,l)?[0,0]:[(y*r-g*u)/s,(p*u-i*r)/s]}function polygonQuickDecomp(o,n,t,e,l,p,g){p=p||100,g=g||0,l=l||25,n=void 0!==n?n:[],t=t||[],e=e||[];var r=[0,0],i=[0,0],y=[0,0],u=0,s=0,A=0,a=0,f=0,c=0,h=0,v=[],m=[],d=o,C=o;if(C.length<3)return n;if(++g>p)return console.warn("quickDecomp: max level ("+p+") reached."),n;for(var R=0;R<o.length;++R)if(polygonIsReflex(d,R)){t.push(d[R]),u=s=Number.MAX_VALUE;for(var q=0;q<o.length;++q)isLeft(polygonAt(d,R-1),polygonAt(d,R),polygonAt(d,q))&&isRightOn(polygonAt(d,R-1),polygonAt(d,R),polygonAt(d,q-1))&&(y=getIntersectionPoint(polygonAt(d,R-1),polygonAt(d,R),polygonAt(d,q),polygonAt(d,q-1)),isRight(polygonAt(d,R+1),polygonAt(d,R),y)&&(A=sqdist(d[R],y))<s&&(s=A,i=y,c=q)),isLeft(polygonAt(d,R+1),polygonAt(d,R),polygonAt(d,q+1))&&isRightOn(polygonAt(d,R+1),polygonAt(d,R),polygonAt(d,q))&&(y=getIntersectionPoint(polygonAt(d,R+1),polygonAt(d,R),polygonAt(d,q),polygonAt(d,q+1)),isLeft(polygonAt(d,R-1),polygonAt(d,R),y)&&(A=sqdist(d[R],y))<u&&(u=A,r=y,f=q));if(c===(f+1)%o.length)y[0]=(i[0]+r[0])/2,y[1]=(i[1]+r[1])/2,e.push(y),R<f?(polygonAppend(v,d,R,f+1),v.push(y),m.push(y),0!==c&&polygonAppend(m,d,c,d.length),polygonAppend(m,d,0,R+1)):(0!==R&&polygonAppend(v,d,R,d.length),polygonAppend(v,d,0,f+1),v.push(y),m.push(y),polygonAppend(m,d,c,R+1));else{if(c>f&&(f+=o.length),a=Number.MAX_VALUE,f<c)return n;for(q=c;q<=f;++q)isLeftOn(polygonAt(d,R-1),polygonAt(d,R),polygonAt(d,q))&&isRightOn(polygonAt(d,R+1),polygonAt(d,R),polygonAt(d,q))&&(A=sqdist(polygonAt(d,R),polygonAt(d,q)))<a&&polygonCanSee2(d,R,q)&&(a=A,h=q%o.length);R<h?(polygonAppend(v,d,R,h+1),0!==h&&polygonAppend(m,d,h,C.length),polygonAppend(m,d,0,R+1)):(0!==R&&polygonAppend(v,d,R,C.length),polygonAppend(v,d,0,h+1),polygonAppend(m,d,h,R+1))}return v.length<m.length?(polygonQuickDecomp(v,n,t,e,l,p,g),polygonQuickDecomp(m,n,t,e,l,p,g)):(polygonQuickDecomp(m,n,t,e,l,p,g),polygonQuickDecomp(v,n,t,e,l,p,g)),n}return n.push(o),n}function polygonRemoveCollinearPoints(o,n){for(var t=0,e=o.length-1;o.length>3&&e>=0;--e)collinear(polygonAt(o,e-1),polygonAt(o,e),polygonAt(o,e+1),n)&&(o.splice(e%o.length,1),t++);return t}function polygonRemoveDuplicatePoints(o,n){for(var t=o.length-1;t>=1;--t)for(var e=o[t],l=t-1;l>=0;--l)points_eq(e,o[l],n)&&o.splice(t,1)}function scalar_eq(o,n,t){return t=t||0,Math.abs(o-n)<=t}function points_eq(o,n,t){return scalar_eq(o[0],n[0],t)&&scalar_eq(o[1],n[1],t)}self.polyDecomp={decomp:polygonDecomp,quickDecomp:polygonQuickDecomp,isSimple:polygonIsSimple,removeCollinearPoints:polygonRemoveCollinearPoints,removeDuplicatePoints:polygonRemoveDuplicatePoints,makeCCW:polygonMakeCCW}; } // lib/c3.js { let isReady=!1,hasAppStarted=!1,buildMode="dev";const internalApiToken=Symbol("Construct internal API token");let internalApiTokenAccessesRemaining=16;const C3=self.C3=class{constructor(){throw TypeError("static class can't be instantiated")}static _GetInternalAPIToken(){if(internalApiTokenAccessesRemaining<=0)throw new Error("cannot obtain internal API token");return--internalApiTokenAccessesRemaining,internalApiToken}static SetReady(){isReady=!0}static IsReady(){return isReady}static SetAppStarted(){hasAppStarted=!0}static HasAppStarted(){return hasAppStarted}static SetBuildMode(e){buildMode=e}static GetBuildMode(){return buildMode}static IsReleaseBuild(){return"final"===buildMode}};C3.isDebug=!1,C3.isDebugDefend=!1,C3.hardwareConcurrency=navigator.hardwareConcurrency||2,self.C3X={}; } // ../lib/queryParser.js { const C3=self.C3;C3.QueryParser=class{constructor(e){this._queryString=e,this._parameters=new Map,this._Parse()}_Parse(){let e=this._queryString;(e.startsWith("?")||e.startsWith("#"))&&(e=e.substr(1));const r=e.split("&");for(const e of r)this._ParseParameter(e)}_ParseParameter(e){if(!e)return;if(!e.includes("="))return void this._parameters.set(e,null);const r=e.indexOf("="),t=decodeURIComponent(e.substring(0,r)),s=decodeURIComponent(e.substring(r+1));this._parameters.set(t,s)}LogAll(){for(const e of this._parameters)console.log("[QueryParser] Parameter '"+e[0]+"' = "+(null===e[1]?"null":"'"+e[1]+"'"))}Has(e){return this._parameters.has(e)}Get(e){const r=this._parameters.get(e);return void 0===r?null:r}ClearHash(){history.replaceState("",document.title,location.pathname+location.search)}Reparse(e){this._queryString=e,this._parameters.clear(),this._Parse()}},C3.QueryString=new C3.QueryParser(location.search),C3.LocationHashString=new C3.QueryParser(location.hash),C3.QueryString.Has("perf")&&(C3.isPerformanceProfiling=!0),"dev"!==C3.QueryString.Get("mode")&&C3.SetBuildMode("final"); } // ../lib/detect/detect.js { const C3=self.C3,UNKNOWN="(unknown)";C3.Platform={OS:UNKNOWN,OSVersion:UNKNOWN,Browser:UNKNOWN,BrowserVersion:UNKNOWN,BrowserVersionNumber:NaN,BrowserEngine:UNKNOWN,Context:"browser",IsDesktop:!0,IsMobile:!1,IsAppleOS:!1,IsIpadOS:!1,GetDetailedInfo:async()=>{}};const windowsNTVerMap=new Map([[5,"2000"],[5.1,"XP"],[5.2,"XP"],[6,"Vista"],[6.1,"7"],[6.2,"8"],[6.3,"8.1"],[10,"10"]]);function GetWindowsNTVersionName(r){const o=parseFloat(r),e=windowsNTVerMap.get(o);return e||(o>=13?"11":"NT "+r)}const uaStr=navigator.userAgent,uaData=navigator["userAgentData"];if(uaData&&uaData["brands"].length>0){C3.Platform.OS=uaData["platform"],C3.Platform.IsMobile=uaData["mobile"],C3.Platform.IsDesktop=!C3.Platform.IsMobile;const r=new Map([["Google Chrome","Chrome"],["Microsoft Edge","Edge"],["Opera","Opera"],["Opera GX","Opera GX"],["Mozilla Firefox","Firefox"],["Apple Safari","Safari"],["NW.js","NW.js"]]),o=new Map([["Chromium","Chromium"],["Gecko","Gecko"],["WebKit","WebKit"]]);function ReadBrandList(e){let t="",a="",s="",n="";for(const i of e){const e=r.get(i["brand"]);!t&&e&&(t=e,a=i["version"]);const m=o.get(i["brand"]);!s&&m&&(s=m,n=i["version"])}t||"Chromium"!==s||(C3.Platform.Browser="Chromium",C3.Platform.BrowserVersion=n),C3.Platform.Browser=t||UNKNOWN,C3.Platform.BrowserVersion=a||UNKNOWN,C3.Platform.BrowserEngine=s||UNKNOWN}ReadBrandList(uaData["brands"]);let e=!1;C3.Platform.GetDetailedInfo=async()=>{if(!e)try{const r=await navigator["userAgentData"]["getHighEntropyValues"](["platformVersion","fullVersionList"]);ReadBrandList(r["fullVersionList"]),"Windows"===C3.Platform.OS?C3.Platform.OSVersion=GetWindowsNTVersionName(r["platformVersion"]):C3.Platform.OSVersion=r["platformVersion"],e=!0}catch(r){console.warn("Failed to get detailed user agent information: ",r)}}}else{function RunTest(r,o){const e=Array.isArray(r)?r:[r];for(const r of e){const e=r.exec(uaStr);if(e){o(e);break}}}RunTest(/windows\s+nt\s+([\d\.]+)/i,r=>{C3.Platform.OS="Windows";const o=r[1];C3.Platform.OSVersion=GetWindowsNTVersionName(o)}),RunTest(/mac\s+os\s+x\s+([\d\._]+)/i,r=>{C3.Platform.OS="macOS",C3.Platform.OSVersion=r[1].replace(/_/g,".")}),RunTest(/CrOS/,()=>{C3.Platform.OS="Chrome OS"}),RunTest(/linux|openbsd|freebsd|netbsd/i,()=>{C3.Platform.OS="Linux"}),RunTest(/android/i,()=>{C3.Platform.OS="Android"}),RunTest(/android\s+([\d\.]+)/i,r=>{C3.Platform.OS="Android",C3.Platform.OSVersion=r[1]}),C3.Platform.OS===UNKNOWN&&(RunTest(/(iphone|ipod|ipad)/i,r=>{C3.Platform.OS="iOS"}),RunTest([/iphone\s+os\s+([\d\._]+)/i,/ipad[^)]*os\s+([\d\._]+)/i],r=>{C3.Platform.OS="iOS",C3.Platform.OSVersion=r[1].replace(/_/g,".")}));const t=/chrome\//i.test(uaStr),a=/chromium\//i.test(uaStr),s=/edg\//i.test(uaStr),n=/OPR\//.test(uaStr),i=/nwjs/i.test(uaStr),m=/safari\//i.test(uaStr),l=/webkit/i.test(uaStr);s||n||RunTest(/chrome\/([\d\.]+)/i,r=>{C3.Platform.Browser="Chrome",C3.Platform.BrowserVersion=r[1],C3.Platform.BrowserEngine="Chromium"}),RunTest(/edg\/([\d\.]+)/i,r=>{C3.Platform.Browser="Edge",C3.Platform.BrowserVersion=r[1],C3.Platform.BrowserEngine="Chromium"}),RunTest(/OPR\/([\d\.]+)/,r=>{C3.Platform.Browser="Opera",C3.Platform.BrowserVersion=r[1],C3.Platform.BrowserEngine="Chromium"}),RunTest(/chromium\/([\d\.]+)/i,r=>{C3.Platform.Browser="Chromium",C3.Platform.BrowserVersion=r[1],C3.Platform.BrowserEngine="Chromium"}),RunTest(/nwjs\/[0-9.]+/i,r=>{C3.Platform.Browser="NW.js",C3.Platform.BrowserVersion=r[1],C3.Platform.BrowserEngine="Chromium",C3.Platform.Context="nwjs"}),RunTest(/firefox\/([\d\.]+)/i,r=>{C3.Platform.Browser="Firefox",C3.Platform.BrowserVersion=r[1],C3.Platform.BrowserEngine="Gecko"}),!m||t||a||s||n||i||(C3.Platform.Browser="Safari",C3.Platform.BrowserEngine="WebKit",RunTest(/version\/([\d\.]+)/i,r=>{C3.Platform.BrowserVersion=r[1]}),RunTest(/crios\/([\d\.]+)/i,r=>{C3.Platform.Browser="Chrome for iOS",C3.Platform.BrowserVersion=r[1]}),RunTest(/fxios\/([\d\.]+)/i,r=>{C3.Platform.Browser="Firefox for iOS",C3.Platform.BrowserVersion=r[1]}),RunTest(/edgios\/([\d\.]+)/i,r=>{C3.Platform.Browser="Edge for iOS",C3.Platform.BrowserVersion=r[1]})),C3.Platform.BrowserEngine===UNKNOWN&&l&&(C3.Platform.BrowserEngine="WebKit"),"Android"===C3.Platform.OS&&"Safari"===C3.Platform.Browser&&(C3.Platform.Browser="Stock");const f=new Set(["Windows","macOS","Linux","Chrome OS"]).has(C3.Platform.OS)||"nwjs"===C3.Platform.Context;C3.Platform.IsDesktop=f,C3.Platform.IsMobile=!f}"Chrome"===C3.Platform.Browser&&"browser"===C3.Platform.Context&&/wv\)/.test(uaStr)&&(C3.Platform.Context="webview"),"nwjs"!==C3.Platform.Context&&"undefined"!=typeof window&&(window.matchMedia&&window.matchMedia("(display-mode: standalone)").matches||navigator["standalone"])&&(C3.Platform.Context="webapp"),C3.Platform.BrowserVersionNumber=parseFloat(C3.Platform.BrowserVersion);const looksLikeIPadOS="macOS"===C3.Platform.OS&&navigator["maxTouchPoints"]&&navigator["maxTouchPoints"]>2;looksLikeIPadOS&&(C3.Platform.OS="iOS",C3.Platform.OSVersion=C3.Platform.BrowserVersion,C3.Platform.IsDesktop=!1,C3.Platform.IsMobile=!0,C3.Platform.IsIpadOS=!0),C3.Platform.IsAppleOS="macOS"===C3.Platform.OS||"iOS"===C3.Platform.OS; } // ../lib/storage/kvStorage.js { "use strict";{const e=2,t="keyvaluepairs",r=new Map,n="undefined"!=typeof IDBObjectStore&&"function"==typeof IDBObjectStore.prototype.getAll,o="undefined"!=typeof IDBObjectStore&&"function"==typeof IDBObjectStore.prototype.getAllKeys;function s(e){return new Promise((t,r)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>r(e.error)})}function a(e){return new Promise((t,r)=>{e.oncomplete=()=>t(),e.onerror=()=>r(e.error),e.onabort=()=>r(e.error)})}function c(e,t){return u(e,t)}function i(e,t){return u(e,t,!0)}async function u(e,n,o=!1,s=!0){const a=await l(e);try{return n(a.transaction([t],o?"readwrite":"readonly"))}catch(t){if(s&&"InvalidStateError"===t["name"])return r.delete(e),u(e,n,o,!1);throw t}}function l(e){f(e);let t=r.get(e);return t instanceof Promise||(t=y(e),r.set(e,t),t.catch(t=>r.delete(e))),t}async function y(r){f(r);const n=indexedDB.open(r,e);return n.addEventListener("upgradeneeded",e=>{try{e.target.result.createObjectStore(t)}catch(e){console.error(`Failed to create objectstore for database ${r}`,e)}}),s(n)}function f(e){if("string"!=typeof e)throw new TypeError("expected string")}function d(e,r){const n=e.objectStore(t).openCursor();return new Promise(e=>{const t=[];n.onsuccess=n=>{const o=n.target.result;if(o){switch(r){case"entries":t.push([o.key,o.value]);break;case"keys":t.push(o.key);break;case"values":t.push(o.value)}o.continue()}else e(t)}})}class m{constructor(e){f(e),this.name=e}async ready(){await l(this.name)}set(e,r){return f(e),i(this.name,async n=>{const o=s(n.objectStore(t).put(r,e)),c=a(n);await Promise.all([c,o])})}get(e){return f(e),c(this.name,async r=>{const n=s(r.objectStore(t).get(e)),o=a(r),[c,i]=await Promise.all([o,n]);return i})}delete(e){return f(e),i(this.name,async r=>{const n=s(r.objectStore(t).delete(e)),o=a(r);await Promise.all([o,n])})}clear(){return i(this.name,async e=>{const r=s(e.objectStore(t).clear()),n=a(e);await Promise.all([n,r])})}keys(){return c(this.name,async e=>{let r;if(o){r=s(e.objectStore(t).getAllKeys())}else r=d(e,"keys");const n=a(e),[c,i]=await Promise.all([n,r]);return i})}values(){return c(this.name,async e=>{let r;if(n){r=s(e.objectStore(t).getAll())}else r=d(e,"values");const o=a(e),[c,i]=await Promise.all([o,r]);return i})}entries(){return c(this.name,async e=>{const t=d(e,"entries"),r=a(e),[n,o]=await Promise.all([r,t]);return o})}}self.KVStorageContainer=m} } // ../lib/storage/localForageAdaptor.js { "use strict";{const e=self.KVStorageContainer,t=[/no available storage method found/i,/an attempt was made to break through the security policy of the user agent/i,/the user denied permission to access the database/i,/a mutation operation was attempted on a database that did not allow mutations/i,/idbfactory\.open\(\) called in an invalid security context/i];new WeakMap;function r(e){throw new Error(`"${e}" is not implemented`)}function a(e){if("function"==typeof e)throw new Error("localforage callback API is not implemented; please use the promise API instead")}function o(e){return"object"==typeof e?new Promise(t=>{const{port1:r,port2:a}=new MessageChannel;a.onmessage=e=>t(e.data),r.postMessage(e)}):Promise.resolve(e)}class s{constructor(e){this._inst=e,this._isInMemory=!this._inst,this._isInMemory||"undefined"!=typeof indexedDB||(this._isInMemory=!0,console.warn("Unable to use local storage because IndexedDB API is not available")),this._memoryStorage=new Map}_MaybeSwitchToMemoryFallback(e){if(!this._isInMemory)for(const r of t)if(e&&r.test(e.message)){console.error("Unable to use local storage, reverting to in-memory store: ",e,e.message),this._isInMemory=!0;break}}async _getItemFallback(e){const t=this._memoryStorage.get(e),r=await o(t);return void 0===r?null:r}async _setItemFallback(e,t){t=await o(t),this._memoryStorage.set(e,t)}_removeItemFallback(e){this._memoryStorage.delete(e)}_clearFallback(){this._memoryStorage.clear()}_keysFallback(){return Array.from(this._memoryStorage.keys())}IsInMemory(){return this._isInMemory}GetMemoryStorage(){return this._memoryStorage}SetMemoryStorage(e){this._memoryStorage=e}async getItem(e,t){if(a(t),this._isInMemory)return await this._getItemFallback(e);let r;try{r=await this._inst.get(e)}catch(t){return this._MaybeSwitchToMemoryFallback(t),this._isInMemory?await this._getItemFallback(e):(console.error(`Error reading '${e}' from storage, returning null: `,t),null)}return void 0===r?null:r}async setItem(e,t,r){if(a(r),void 0===t&&(t=null),this._isInMemory)await this._setItemFallback(e,t);else try{await this._inst.set(e,t)}catch(r){if(this._MaybeSwitchToMemoryFallback(r),!this._isInMemory)throw r;await this._setItemFallback(e,t)}}async removeItem(e,t){if(a(t),this._isInMemory)this._removeItemFallback(e);else try{await this._inst.delete(e)}catch(t){this._MaybeSwitchToMemoryFallback(t),this._isInMemory?this._removeItemFallback(e):console.error(`Error removing '${e}' from storage: `,t)}}async clear(e){if(a(e),this._isInMemory)this._clearFallback();else try{await this._inst.clear()}catch(e){this._MaybeSwitchToMemoryFallback(e),this._isInMemory?this._clearFallback():console.error("Error clearing storage: ",e)}}async keys(e){if(a(e),this._isInMemory)return this._keysFallback();let t=[];try{t=await this._inst.keys()}catch(e){if(this._MaybeSwitchToMemoryFallback(e),this._isInMemory)return this._keysFallback();console.error("Error getting storage keys: ",e)}return t}ready(e){return a(e),this._isInMemory?Promise.resolve(!0):this._inst.ready()}createInstance(t){if(t.forceInMemoryFallback)return new s(null);{const r=t.name;if("string"!=typeof r)throw new TypeError("invalid store name");const a=new e(r);return new s(a)}}length(e){r("localforage.length()")}key(e,t){r("localforage.key()")}iterate(e,t){r("localforage.iterate()")}setDriver(e){r("localforage.setDriver()")}config(e){r("localforage.config()")}defineDriver(e){r("localforage.defineDriver()")}driver(){r("localforage.driver()")}supports(e){r("localforage.supports()")}dropInstance(){r("localforage.dropInstance()")}}self["localforage"]=new s(new e("localforage"))} } // ../lib/misc/supports.js { const C3=self.C3;if(C3.Supports={},C3.Supports.WebAnimations=(()=>{try{if("undefined"==typeof document)return!1;const e=document.createElement("div");if(void 0===e.animate)return!1;return void 0!==e.animate([{opacity:"0"},{opacity:"1"}],1e3).reverse}catch(e){return!1}})(),C3.Supports.DialogElement="undefined"!=typeof HTMLDialogElement,C3.Supports.RequestIdleCallback=!!self.requestIdleCallback,C3.Supports.ImageBitmap=!!self.createImageBitmap,C3.Supports.ImageBitmapOptions=!1,C3.Supports.ImageBitmapOptionsResize=!1,C3.Supports.ImageBitmap){try{self.createImageBitmap(new ImageData(32,32),{"premultiplyAlpha":"none"}).then(()=>{C3.Supports.ImageBitmapOptions=!0}).catch(()=>{C3.Supports.ImageBitmapOptions=!1})}catch(e){C3.Supports.ImageBitmapOptions=!1}try{self.createImageBitmap(new ImageData(32,32),{"resizeWidth":10,"resizeHeight":10}).then(e=>{C3.Supports.ImageBitmapOptionsResize=10===e.width&&10===e.height}).catch(()=>{C3.Supports.ImageBitmapOptionsResize=!1})}catch(e){C3.Supports.ImageBitmapOptionsResize=!1}}if(C3.Supports.ClipboardReadText=!(!navigator["clipboard"]||!navigator["clipboard"]["readText"]),C3.Supports.PermissionsQuery=!(!navigator["permissions"]||!navigator["permissions"]["query"]),C3.Supports.ClipboardPermissionsQuery=!1,C3.Supports.PermissionsQuery){const e={"name":"clipboard-read"};navigator["permissions"]["query"](e).then(()=>{C3.Supports.ClipboardPermissionsQuery=!0}).catch(()=>{C3.Supports.ClipboardPermissionsQuery=!1})}C3.Supports.AsyncClipboardApi=!!(navigator["permissions"]&&navigator["clipboard"]&&self["ClipboardItem"]),C3.Supports.Proxies="undefined"!=typeof Proxy,C3.Supports.DownloadAttribute=(()=>{if("undefined"==typeof document)return!1;return void 0!==document.createElement("a").download})(),C3.Supports.Fetch="function"==typeof fetch,C3.Supports.PersistentStorage=!!(self.isSecureContext&&"Opera"!==C3.Platform.Browser&&navigator["storage"]&&navigator["storage"]["persist"]),C3.Supports.StorageQuotaEstimate=!!(self.isSecureContext&&navigator["storage"]&&navigator["storage"]["estimate"]),C3.Supports.Fullscreen=(()=>{if("undefined"==typeof document)return!1;if("iOS"===C3.Platform.OS)return!1;const e=document.documentElement;return!!(e.requestFullscreen||e.msRequestFullscreen||e.mozRequestFullScreen||e.webkitRequestFullscreen)})(),C3.Supports.ImageDecoder=void 0!==self["ImageDecoder"],C3.Supports.WebCodecs=!!self["VideoEncoder"],C3.Supports.NativeFileSystemAPI=!!self["showOpenFilePicker"],C3.Supports.FileInputDirectory=function(){if("undefined"==typeof document)return!1;const e=document.createElement("input");return e.type="file","webkitdirectory"in e||"directory"in e}(),C3.Supports.QueryLocalFonts=!!self["queryLocalFonts"],C3.Supports.UserActivation=!!navigator["userActivation"],C3.Supports.CanvasToBlobWebP=!1,(async()=>{let e;"undefined"==typeof document?e=new OffscreenCanvas(32,32):(e=document.createElement("canvas"),e.width=32,e.height=32);const t=e.getContext("2d");t.fillStyle="blue",t.fillRect(0,0,32,32);let o=null;try{e["convertToBlob"]?o=await e["convertToBlob"]({"type":"image/webp","quality":1}):e.toBlob&&(o=await new Promise(t=>e.toBlob(t,"image/webp",1))),C3.Supports.CanvasToBlobWebP=o&&"image/webp"===o.type}catch(e){C3.Supports.CanvasToBlobWebP=!1}})(); } // ../lib/misc/polyfills.js { const C3=self.C3;String.prototype.replaceAll||(String.prototype.replaceAll=function(t,e){return this.replace(new RegExp(C3.EscapeRegex(t),"g"),e)}),Array.prototype.at||(Array.prototype.at=function(t){if((t=Math.trunc(t)||0)<0&&(t+=this.length),!(t<0||t>=this.length))return this[t]}),String.prototype.at||(String.prototype.at=function(t){if((t=Math.trunc(t)||0)<0&&(t+=this.length),!(t<0||t>=this.length))return this[t]}),RegExp.escape||(RegExp.escape=function(t){return String(t).replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}),Set.prototype.isSubsetOf||(Set.prototype.isSubsetOf=function(t){if(!(t instanceof Set))throw new TypeError("argument must be a Set");for(const e of this)if(!t.has(e))return!1;return!0}),Set.prototype.difference||(Set.prototype.difference=function(t){if(!(t instanceof Set))throw new TypeError("argument must be a Set");const e=new Set;for(const r of this)t.has(r)||e.add(r);return e}),Set.prototype.union||(Set.prototype.union=function(t){const e=new Set(this);for(const r of t)e.add(r);return e}),navigator["storage"]&&!navigator["storage"]["estimate"]&&navigator["webkitTemporaryStorage"]&&navigator["webkitTemporaryStorage"]["queryUsageAndQuota"]&&(navigator["storage"]["estimate"]=function(){return new Promise((t,e)=>navigator["webkitTemporaryStorage"]["queryUsageAndQuota"]((e,r)=>t({"usage":e,"quota":r}),e))}); } // lib/misc/assert.js { const C3=self.C3;function assertFail(e){let s="Assertion failure: "+e+"\n\nStack trace:\n"+C3.GetCallStack();console.error(s)}self.assert=function(e,s){e||assertFail(s)}; } // ../lib/misc/typeChecks.js { const C3=self.C3,C3X=self.C3X;C3.IsNumber=function(e){return"number"==typeof e},C3.IsFiniteNumber=function(e){return C3.IsNumber(e)&&isFinite(e)},C3.RequireNumber=function(e){if(!C3.IsNumber(e))throw new TypeError("expected number")},C3.RequireOptionalNumber=function(e){C3.IsNullOrUndefined(e)},C3.RequireNumberInRange=function(e,n,r){if(!C3.IsNumber(e)||isNaN(e)||n>e||r<e)throw new RangeError("number outside of range")},C3.RequireAllNumber=function(...e){for(let n of e);},C3.RequireFiniteNumber=function(e){if(!C3.IsFiniteNumber(e))throw new TypeError("expected finite number")},C3.RequireOptionalFiniteNumber=function(e){C3.IsNullOrUndefined(e)},C3.RequireAllFiniteNumber=function(...e){for(let n of e);},C3.IsDataURI=function(e){return!!C3.IsString(e)&&/^data:.+,.+$/i.test(e)},C3.IsString=function(e){return"string"==typeof e},C3.RequireString=function(e){if(!C3.IsString(e))throw new TypeError("expected string")},C3.RequireOptionalString=function(e){C3.IsNullOrUndefined(e)},C3.RequireAllString=function(...e){for(let n of e);},C3.IsSimpleObject=function(e){if("object"!=typeof e||null===e)return!1;let n=Object.getPrototypeOf(e);return n?n.constructor===Object:null===n},C3.RequireSimpleObject=function(e){if(!C3.IsSimpleObject(e))throw new TypeError("expected simple object")},C3.RequireOptionalSimpleObject=function(e){if(!C3.IsNullOrUndefined(e)&&!C3.IsSimpleObject(e))throw new TypeError("expected simple object")},C3.IsObject=function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)},C3.RequireObject=function(e){if(!C3.IsObject(e))throw new TypeError("expected object")},C3.RequireOptionalObject=function(e){C3.IsNullOrUndefined(e)},C3.RequireAllObject=function(...e){for(let n of e);},C3.IsFileLike=function(e){return C3.WeakIsInstanceOf(e,Blob)&&"string"==typeof e["name"]},C3.RequireFileLike=function(e){if(!C3.IsFileLike(e))throw new TypeError("expected file")},C3.RequireOptionalFileLike=function(e){C3.IsNullOrUndefined(e)},C3.IsArray=function(e){return Array.isArray(e)},C3.RequireArray=function(e){if(!C3.IsArray(e))throw new TypeError("expected array")},C3.RequireOptionalArray=function(e){C3.IsNullOrUndefined(e)},C3.RequireAllArray=function(...e){for(let n of e);},C3.Is2DArray=function(e){return!!C3.IsArray(e)&&(!e.length||!!C3.IsArray(e[0]))},C3.Require2DArray=function(e){if(!C3.Is2DArray(e))throw new TypeError("expected 2d array");for(let n of e)if(!C3.IsArray(n))throw new TypeError("expected 2d array")},C3.RequireOptional2DArray=function(e){C3.IsNullOrUndefined(e)},C3.IsFunction=function(e){return"function"==typeof e},C3.RequireFunction=function(e,n){if(!C3.IsFunction(e))throw new TypeError("expected function");if(!C3.IsNullOrUndefined(n)&&e!==n)throw new TypeError("expected same function reference")},C3.RequireOptionalFunction=function(e){C3.IsNullOrUndefined(e)},C3.RequireAllFunction=function(...e){for(let n of e);},C3.RequireAnyFunction=function(e,...n){if(!C3.IsFunction(e))throw new TypeError("expected function");if(!n.length)throw new Error("missing comparison functions");for(let r of n)if(!C3.IsNullOrUndefined(r)&&e===r)return;throw new TypeError("expected same function reference")},C3.RequireOptionalAllFunction=function(...e){if(!C3.IsNullOrUndefined(e))for(let n of e);},C3.IsInstanceOf=function(e,n){return e instanceof n},C3.IsInstanceOfAny=function(e,...n){for(let r of n)if(C3.IsInstanceOf(e,r))return!0;return!1},C3.RequireInstanceOf=function(e,n){if(!C3.IsInstanceOf(e,n))throw new TypeError("unexpected type")},C3.RequireOptionalInstanceOf=function(e,n){C3.IsNullOrUndefined(e)},C3.RequireAllInstanceOf=function(e,...n){for(let e of n);},C3.RequireAnyInstanceOf=function(e,...n){if(!C3.IsInstanceOfAny(e,...n))throw new TypeError("unexpected type")},C3.RequireAnyOptionalInstanceOf=function(e,...n){if(!C3.IsNullOrUndefined(e)&&!C3.IsInstanceOfAny(e,...n))throw new TypeError("unexpected type")},C3.IsArrayOf=function(e,n){for(let r of e)if(!C3.IsInstanceOf(r,n))return!1;return!0},C3.IsArrayOfFiniteNumbers=function(e){for(let n of e)if(!C3.IsFiniteNumber(n))return!1;return!0},C3.RequireArrayOf=function(e,n){for(let n of e);},C3.RequireOptionalArrayOf=function(e,n){if(!C3.IsNullOrUndefined(e))for(let n of e);},C3.RequireOptionalArrayOfFunctions=function(e,n){if(!C3.IsNullOrUndefined(e))for(let n of e);},C3.RequireArrayOfAny=function(e,...n){for(let n of e);},C3.RequireOptionalArrayOfAny=function(e,...n){if(!C3.IsNullOrUndefined(e))for(let n of e);},C3.IsDOMNode=function(e,n){return!(C3.IsNullOrUndefined(e)||!C3.IsString(e.nodeName))&&(!n||C3.equalsNoCase(e.nodeName,n))},C3.RequireDOMNode=function(e,n){if(C3.IsNullOrUndefined(e)||!C3.IsString(e.nodeName))throw new TypeError("expected DOM node");if(n&&!C3.equalsNoCase(e.nodeName,n))throw new TypeError(`expected DOM '${n}' node`)},C3.RequireOptionalDOMNode=function(e,n){C3.IsNullOrUndefined(e)},C3.IsHTMLElement=function(e,n){return!(C3.IsNullOrUndefined(e)||!C3.IsString(e.tagName))&&(!n||C3.equalsNoCase(e.tagName,n))},C3.RequireHTMLElement=function(e,n){if(C3.IsNullOrUndefined(e)||!C3.IsString(e.tagName))throw new TypeError("expected HTML element");if(n&&!C3.equalsNoCase(e.tagName,n))throw new TypeError(`expected HTML '${n}' element`)},C3.RequireOptionalHTMLElement=function(e,n){C3.IsNullOrUndefined(e)},C3.IsDrawable=function(e){return C3.IsHTMLElement(e,"img")||C3.IsHTMLElement(e,"canvas")||C3.IsHTMLElement(e,"video")||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap},C3.RequireDrawable=function(e){if(!C3.IsDrawable(e))throw new TypeError("expected drawable")},C3.RequireOptionalDrawable=function(e){C3.IsNullOrUndefined(e)},C3.IsDrawableOrImageData=function(e){return e instanceof ImageData||C3.IsDrawable(e)},C3.RequireDrawableOrImageData=function(e){if(!C3.IsDrawableOrImageData(e))throw new TypeError("expected drawable or image data")},C3.RequireOptionalDrawableOrImageData=function(e){if(!C3.IsNullOrUndefined(e)&&!C3.IsDrawableOrImageData(e))throw new TypeError("expected drawable or image data")},C3.IsStringLike=function(e){return"string"==typeof e||C3.HtmlString&&e instanceof C3.HtmlString||e instanceof C3.BBString},C3.RequireStringLike=function(e){if(!C3.IsStringLike(e))throw new TypeError("expected string-like")},C3.RequireOptionalStringLike=function(e){C3.IsNullOrUndefined(e)},C3.RequireAllStringLike=function(...e){for(let n of e);},C3.RequireOverride=function(){throw new Error("must be overridden")},C3.NotYetImplemented=function(){throw new Error("not yet implemented")},C3.IsGeneratorFunction=function(e){return e.constructor===function*(){}.constructor},C3.RequireGeneratorFunction=function(e){if(!C3.IsGeneratorFunction(e))throw new Error("expected generator function")},C3.IsIterable=function(e){return"function"===e[Symbol.iterator]},C3.RequireIterable=function(e){if(!C3.IsIterable(e))throw new Error("expected iterable")},C3.IsDefined=function(e){return!C3.IsNullOrUndefined(e)},C3.IsNullOrUndefined=function(e){return null==e},C3.AreArrayElementsOfSameType=function(e){let n=e[0].constructor;for(let r of e)if(r.constructor!==n)return!1;return n},C3.AreArrayElementsOfType=function(e,n){for(let r of e)if(!(r instanceof n))return!1;return!0};const TypedArray=Object.getPrototypeOf(Uint8Array);C3.IsTypedArray=function(e){return C3.IsInstanceOf(e,TypedArray)},C3.RequireTypedArray=function(e){},C3.WeakRequireTypedArray=function(e){C3.WeakRequireInstanceOf(e,TypedArray)},C3.WeakRequireAnyInstanceOf=function(e,...n){if(!C3.WeakIsAnyInstanceOf(e,...n))throw new TypeError("unexpected type")},C3.WeakIsAnyInstanceOf=function(e,...n){for(const r of n)if(C3.WeakIsInstanceOf(e,r))return!0;return!1},C3.WeakRequireInstanceOf=function(e,n){if(!C3.WeakIsInstanceOf(e,n))throw new TypeError("unexpected type")},C3.WeakIsInstanceOf=function(e,n){for(;e=Object.getPrototypeOf(e);)if(e.constructor.name===n.name)return!0;return!1},C3X.RequireNumber=C3.RequireNumber,C3X.RequireOptionalNumber=C3.RequireOptionalNumber,C3X.RequireFiniteNumber=C3.RequireFiniteNumber,C3X.RequireOptionalFiniteNumber=C3.RequireOptionalFiniteNumber,C3X.RequireString=C3.RequireString,C3X.RequireOptionalString=C3.RequireOptionalString,C3X.RequireObject=C3.RequireObject,C3X.RequireOptionalObject=C3.RequireOptionalObject,C3X.RequireArray=C3.RequireArray,C3X.RequireOptionalArray=C3.RequireOptionalArray,C3X.RequireFunction=C3.RequireFunction,C3X.RequireOptionalFunction=C3.RequireOptionalFunction,C3X.RequireInstanceOf=C3.RequireInstanceOf,C3X.RequireOptionalInstanceOf=C3.RequireOptionalInstanceOf,C3X.IsNullOrUndefined=C3.IsNullOrUndefined; } // ../lib/misc/jsutil.js { const C3=self.C3,logRafIds=new Map;let measures;function isValidTypeChange(e,t){let r=C3.getType(e),n=C3.getType(t);return"null"===r||"null"===n||"undefined"!==r&&"undefined"!==n&&r===n}C3.ColorLog=function(e,t){console.log(`%c${e}`,`font-weight: bold; color:${t}`)},C3.RafLog=function(e,...t){logRafIds.has(e)||logRafIds.set(e,-1),-1===logRafIds.get(e)&&logRafIds.set(e,requestAnimationFrame(()=>{console.log(`%c${e}`,"font-weight: bold",...t),logRafIds.set(e,-1)}))},C3.StartMeasure=function(e){performance.mark(e),measures||(measures=new Map),measures.has(e)||measures.set(e,{current:0,total:0,average:0,calls:1,toString:function(){return`${e} :: current => ${this.current.toPrecision(3)} :: average => ${this.average.toPrecision(3)} :: calls => ${this.calls}`}})},C3.EndMeasure=function(e){performance.measure(`measure-${e}`,e);const t=performance.getEntriesByName(`measure-${e}`)[0],r=measures.get(e);r.current=t.duration,r.total+=r.current,r.average=r.total/r.calls,console.log(r.toString()),r.calls++,performance.clearMarks(e),performance.clearMeasures(`measure-${e}`)},C3.GetCallStack=function(){return(new Error).stack},C3.Debugger=function(){},C3.cast=function(e,t){return e&&e instanceof t?e:null},C3.getName=function(e){return void 0===e?"undefined":null===e?"null":"boolean"==typeof e?"<boolean>":C3.IsNumber(e)?"<number>":C3.IsString(e)?"<string>":C3.IsArray(e)?"<array>":"symbol"==typeof e?"<"+e.toString()+">":C3.IsFunction(e)?e.name&&"Function"!==e.name?e.name:"<anonymous function>":"object"==typeof e?e.constructor&&e.constructor.name&&"Object"!==e.constructor.name?e.constructor.name:"<anonymous object>":"<unknown>"},C3.getType=function(e){return null===e?"null":Array.isArray(e)?"array":typeof e},C3.range=function*(e,t){if(!isFinite(Math.abs(e-t)))throw new Error("Invalid parameters");if(e>t)for(let r=e-1;r>=t;r--)yield r;else for(let r=e;r<t;r++)yield r};let ctorObjectToProxy=new Map,ctorProxyToObject=new Map,proxyToObject=new WeakMap,releasedObjects=new WeakMap;C3.DefendHandler={};const VALID_GET_MISSING_KEYS=new Set(["then","splice"]);function logDefendedObjectWarning(e){console.warn("[Defence] "+e+" @",C3.GetCallStack())}C3.DefendHandler.get=function(e,t){return t in e||"symbol"==typeof t||VALID_GET_MISSING_KEYS.has(t)||logDefendedObjectWarning(`Accessed missing property '${t}' from defended object '${C3.getName(e)}', returning undefined`),releasedObjects.has(e)&&"symbol"!=typeof t&&!VALID_GET_MISSING_KEYS.has(t)&&logDefendedObjectWarning(`Accessed property '${t}' on a released object '${C3.getName(e)}'\nObject was originally released at: ${releasedObjects.get(e)})\nCall stack at access: `),e[t]},C3.DefendHandler.set=function(e,t,r){return t in e||ctorObjectToProxy.has(e)||logDefendedObjectWarning(`Set non-existent property '${t}' to '${r}' on defended object '${C3.getName(e)}'`),isValidTypeChange(e[t],r)||ctorObjectToProxy.has(e)||logDefendedObjectWarning(`Set '${C3.getType(e[t])}' property '${t}' to type '${C3.getType(r)}' on defended object '${C3.getName(e)}'`),releasedObjects.has(e)&&logDefendedObjectWarning(`Set property '${t}' on a released object '${C3.getName(e)}'\nObject was originally released at: ${releasedObjects.get(e)})\nCall stack at access: `),e[t]=r,!0},C3.DefendHandler.deleteProperty=function(e,t){throw new ReferenceError(`Cannot delete property '${t}' from defended object '${C3.getName(e)}'`)},C3.DefendHandler.defineProperty=function(e,t,r){throw new ReferenceError(`Cannot define property '${t}' on defended object '${C3.getName(e)}'`)},C3.DefendHandler.enumerate=function(e){throw new ReferenceError(`Cannot enumerate defended object '${C3.getName(e)}'`)};let checkRafId=-1;function CheckDefendedObjectsUsedCorrectly(){if(checkRafId=-1,ctorObjectToProxy.size>0||ctorProxyToObject.size>0){let e=[...new Set([...ctorObjectToProxy.keys()].map(e=>C3.getName(e)))].join(",");console.warn(`An object derived from DefendedBase was not protected with debugDefend(). This will disable some checks. See the coding guidelines! Possible affected class names: ${e}`),ctorObjectToProxy.clear(),ctorProxyToObject.clear()}}C3.DefendedBase=class{constructor(){if(!C3.isDebugDefend||!C3.Supports.Proxies)return;let e=new.target,t=Object.create(e.prototype),r=new Proxy(t,C3.DefendHandler);return ctorObjectToProxy.set(t,r),ctorProxyToObject.set(r,t),proxyToObject.set(r,t),-1===checkRafId&&(checkRafId=requestAnimationFrame(CheckDefendedObjectsUsedCorrectly)),r}},C3.debugDefend=function(e){if(C3.isDebugDefend&&C3.Supports.Proxies&&e instanceof C3.DefendedBase){if(!ctorProxyToObject.has(e))return e;let t=ctorProxyToObject.get(e);return ctorProxyToObject.delete(e),ctorObjectToProxy.delete(t),e}return C3.isDebug?Object.seal(e):e},C3.New=function(e,...t){let r;try{r=new e(...t)}catch(e){throw ctorProxyToObject.clear(),ctorObjectToProxy.clear(),e}return C3.isDebugDefend&&VerifyObjectPropertiesConsistent(e,r),C3.debugDefend(r)},C3.Release=function(e){let t=proxyToObject.get(e);t&&releasedObjects.set(t,C3.GetCallStack())},C3.WasReleased=function(e){let t=proxyToObject.get(e);return!!t&&!!releasedObjects.get(t)};let typeProperties=new Map;function getObjectPropertySet(e){let t=new Set;for(let r in e)t.add(r);return t}function VerifyObjectPropertiesConsistent(e,t){let r=getObjectPropertySet(t),n=typeProperties.get(e);if(n){let t=[];for(let e of n.values())r.has(e)?r.delete(e):t.push(e);C3.appendArray(t,[...r]),t.length&&console.warn(`[Defence] '${C3.getName(e)}' constructor creates inconsistent properties: ${t.join(", ")}`)}else typeProperties.set(e,r)}C3.PerfMark=class{constructor(e){this._name="",e&&this.start(e)}start(e){C3.isPerformanceProfiling&&(this._name=e,performance.mark(this._name+"-Start"))}end(){C3.isPerformanceProfiling&&(performance.mark(this._name+"-End"),performance.measure(this._name,this._name+"-Start",this._name+"-End"))}next(e){C3.isPerformanceProfiling&&(this.end(),this._name=e,performance.mark(this._name+"-Start"))}}; } // ../lib/misc/mathutil.js { const C3=globalThis.C3,glMatrix=globalThis.glMatrix,vec3=glMatrix.vec3,TWO_PI=2*Math.PI,D_TO_R=Math.PI/180,R_TO_D=180/Math.PI;C3.wrap=function(t,e,n){t=Math.floor(t),e=Math.floor(e);const r=(n=Math.fl … [Строка слишком длинная. Вы можете скачать файл] } // ../lib/misc/miscutil.js { const C3=self.C3;let mainDocument=null,baseHref="";if("undefined"!=typeof document){mainDocument=document;const e=document.querySelector("base");baseHref=e&&e.hasAttribute("href")?e.getAttribute("href"):"",baseHref&&(baseHref.startsWith("/")&&(baseHref=baseHref.substr(1)),baseHref.endsWith("/")||(baseHref+="/"))}C3.GetBaseHref=function(){return baseHref},C3.GetBaseURL=function(){if(!mainDocument)return"";const e=mainDocument.location;return C3.GetPathFromURL(e.origin+e.pathname)+baseHref},C3.GetPathFromURL=function(e){if(!e.length)return e;if(e.endsWith("/")||e.endsWith("\\"))return e;const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return-1===t?"":e.substr(0,t+1)},C3.GetFilenameFromURL=function(e){if(!e.length)return e;if(e.endsWith("/")||e.endsWith("\\"))return"";const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return-1===t?e:e.substr(t+1)},C3.GetFileExtension=function(e){let t=e.lastIndexOf(".");return t<1?"":e.substr(t)},C3.SetFileExtension=function(e,t){const n=e.lastIndexOf(".");return-1===n?e+"."+t:e.substr(0,n+1)+t},C3.GetFileNamePart=function(e){let t=e.lastIndexOf(".");return t<1?e:e.substr(0,t)},C3.NormalizeFileSeparator=function(e){return e.replace(/\\/g,"/")},C3.IsFileExtension=function(e,t){return t===(e?C3.GetFileExtension(e).slice(1):"")},C3.FileNameEquals=function(e,t){let n,r;return C3.IsFileLike(e)&&(n=C3.GetFileNamePart(e["name"])),C3.IsString(e)&&(n=C3.GetFileNamePart(e)),C3.IsFileLike(t)&&(r=C3.GetFileNamePart(t["name"])),C3.IsString(t)&&(r=C3.GetFileNamePart(t)),n===r},C3.ParseFilePath=function(e){e=C3.NormalizeFileSeparator(e);let t=/^\w\:\//.exec(e);t?(t=t[0],"/"!==(e=e.slice(3))[0]&&(e="/"+e)):t="",(e=e.replace(/\/{2,}/g,"/")).length>1&&"/"===e.slice(-1)&&(e=e.slice(0,-1));const n=e.lastIndexOf("/")+1;let r,a="",s=e,i="";n>0&&(a=e.slice(0,n),s=e.slice(n)),r=s;const o=s.lastIndexOf(".");o>0&&(i=s.slice(o),r=s.slice(0,-i.length));return{dir:a,base:s,name:r,root:t,ext:i,full:t+a+s}},C3.Wait=function(e,t){return new Promise((n,r)=>{self.setTimeout(n,e,t)})},C3.swallowException=function(e){try{e()}catch(e){C3.isDebug&&console.warn("Swallowed exception: ",e)}},C3.noop=function(){},C3.equalsNoCase=function(e,t){return"string"==typeof e&&"string"==typeof t&&(e===t||e.normalize().toLowerCase()===t.normalize().toLowerCase())},C3.equalsCase=function(e,t){return"string"==typeof e&&"string"==typeof t&&(e===t||e.normalize()===t.normalize())},C3.typedArraySet16=function(e,t,n){e[n++]=t[0],e[n++]=t[1],e[n++]=t[2],e[n++]=t[3],e[n++]=t[4],e[n++]=t[5],e[n++]=t[6],e[n++]=t[7],e[n++]=t[8],e[n++]=t[9],e[n++]=t[10],e[n++]=t[11],e[n++]=t[12],e[n++]=t[13],e[n++]=t[14],e[n]=t[15]},C3.truncateArray=function(e,t){e.length=t},C3.clearArray=function(e){e&&0!==e.length&&C3.truncateArray(e,0)},C3.clear2DArray=function(e){if(e){for(let t=0;t<e.length;t++){let n=e[t];C3.truncateArray(n,0)}C3.truncateArray(e,0)}},C3.extendArray=function(e,t,n){t|=0;const r=e.length;if(!(t<=r))for(let a=r;a<t;++a)e.push(n)},C3.resizeArray=function(e,t,n){t|=0;const r=e.length;t<r?C3.truncateArray(e,t):t>r&&C3.extendArray(e,t,n)},C3.shallowAssignArray=function(e,t){C3.clearArray(e),C3.appendArray(e,t)},C3.appendArray=function(e,t){if(t.length<1e4)e.push(...t);else for(let n=0,r=t.length;n<r;++n)e.push(t[n])},C3.arrayRemove=function(e,t){if((t=Math.floor(t))<0||t>=e.length)return;let n=e.length-1;for(let r=t;r<n;++r)e[r]=e[r+1];C3.truncateArray(e,n)},C3.arrayFindRemove=function(e,t){let n=e.indexOf(t);n>=0&&e.splice(n,1)},C3.arraysEqual=function(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=0;r<n;++r)if(e[r]!==t[r])return!1;return!0},C3.mapsEqual=function(e,t){if(e.size!==t.size)return!1;for(const[n,r]of e){if(!t.has(n))return!1;if(r!==t.get(n))return!1}return!0},C3.arrayFilterOut=function(e,t){let n=[],r=0;for(let a=0,s=e.length;a<s;++a){let s=e[a];t(s)?n.push(s):(e[r]=s,++r)}return C3.truncateArray(e,r),n},C3.arrayRemoveAllInSet=function(e,t){const n=e.length;let r=0;for(let n=0,a=e.length;n<a;++n){let a=e[n];t.has(a)||(e[r++]=a)}return C3.truncateArray(e,r),n-r},C3.isArrayIndexInBounds=function(e,t){return e===Math.floor(e)&&(e>=0&&e<t.length)},C3.validateArrayIndex=function(e,t){if(!C3.isArrayIndexInBounds(e,t))throw new RangeError("array index out of bounds")},C3.cloneArray=function(e){return e.slice()},C3.deepCloneArray=function(e,t){let n=[];for(let r of e)if(C3.IsObject(r)){let e=t(r);if(!e)throw new Error("missing clone");if(e.constructor!==r.constructor)throw new Error("object is not a clone");n.push(e)}else C3.IsArray(r)?n.push(C3.deepCloneArray(r,t)):n.push(r);return n},C3.clone2DArray=function(e){let t=[];for(let n of e)t.push(n.slice());return t},C3.toArrayLike=function(e){return C3.IsArray(e)||C3.IsTypedArray(e)?e:e?(e.length=Object.keys(e).length,e):void 0},C3.splitStringAndNormalize=function(e,t=" "){return e?e.split(t).map(e=>e.trim()).filter(e=>!!e):[]},C3.ensureSet=function(e){return e instanceof Set?e:new Set(e)},C3.filterSet=function(e,t,n){const r=new Set;for(const a of e.values())t(a)&&(n?r.add(n(a)):r.add(a));return r},C3.mergeSetsInPlace=function(e,t){for(const n of t)e.add(n);return e},C3.first=function(e){for(let t of e)return t;return null},C3.xor=function(e,t){return!e!=!t},C3.compare=function(e,t,n){switch(t){case 0:return e===n;case 1:return e!==n;case 2:return e<n;case 3:return e<=n;case 4:return e>n;case 5:return e>=n;default:return!1}},C3.hasAnyOwnProperty=function(e){for(let t in e)if(e.hasOwnProperty(t))return!0;return!1},C3.PromiseAllWithProgress=function(e,t){return e.length?new Promise((n,r)=>{const a=[];let s=0,i=!1;for(let o=0,l=e.length;o<l;++o)a.push(void 0),e[o].then(r=>{i||(a[o]=r,++s,s===e.length?n(a):t(s,e.length))}).catch(e=>{i=!0,r(e)})}):Promise.resolve([])};let memoryCallbacks=[];C3.AddLibraryMemoryCallback=function(e){memoryCallbacks.push(e)},C3.GetEstimatedLibraryMemoryUsage=function(){let e=0;for(let t of memoryCallbacks){e+=t()}return Math.floor(e)};let nextTaskId=1;const activeTaskIds=new Map;function OnTask(e){const t=activeTaskIds.get(e);activeTaskIds.delete(e),t&&t(performance.now())}const scheduler=globalThis["scheduler"],taskMessageChannel=new MessageChannel;taskMessageChannel.port2.onmessage=e=>OnTask(e.data),C3.RequestUnlimitedAnimationFrame=function(e,t="user-visible"){const n=nextTaskId++;return activeTaskIds.set(n,e),scheduler?scheduler["postTask"](()=>OnTask(n),{priority:t}):taskMessageChannel.port1.postMessage(n),n},C3.CancelUnlimitedAnimationFrame=function(e){activeTaskIds.delete(e)},C3.PostTask=C3.RequestUnlimitedAnimationFrame,C3.WaitForNextTask=function(){return new Promise(e=>C3.PostTask(e))};const activeRPAFids=new Set;C3.RequestPostAnimationFrame=function(e){const t=self.requestAnimationFrame(async n=>{await C3.WaitForNextTask(),activeRPAFids.has(t)&&(activeRPAFids.delete(t),e(n))});return activeRPAFids.add(t),t},C3.CancelPostAnimationFrame=function(e){activeRPAFids.has(e)&&(self.cancelAnimationFrame(e),activeRPAFids.delete(e))}; } // lib/misc/runtimeutil.js { const C3=self.C3;C3.IsAbsoluteURL=function(e){return/^(?:[a-z\-]+:)?\/\//.test(e)||"data:"===e.substr(0,5)||"blob:"===e.substr(0,5)},C3.IsRelativeURL=function(e){return!C3.IsAbsoluteURL(e)},C3.ThrowIfNotOk=function(e){if(!e.ok)throw new Error(`fetch '${e.url}' response returned ${e.status} ${e.statusText}`)},C3.FetchOk=function(e,t){return fetch(e,t).then(e=>(C3.ThrowIfNotOk(e),e))},C3.FetchText=function(e){return C3.FetchOk(e).then(e=>e.text())},C3.FetchJson=function(e){return C3.FetchOk(e).then(e=>e.json())},C3.FetchBlob=function(e){return C3.FetchOk(e).then(e=>e.blob())},C3.FetchArrayBuffer=function(e){return C3.FetchOk(e).then(e=>e.arrayBuffer())},C3.FetchImage=function(e){return new Promise((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=e=>n(e),r.src=e})},C3.BlobToArrayBuffer=function(e){return"function"==typeof e["arrayBuffer"]?e["arrayBuffer"]():new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(r.error),r.readAsArrayBuffer(e)})},C3.BlobToString=function(e){return"function"==typeof e["text"]?e["text"]():new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(r.error),r.readAsText(e)})},C3.BlobToJson=function(e){return C3.BlobToString(e).then(e=>JSON.parse(e))},C3.BlobToImage=async function(e,t){let n=URL.createObjectURL(e);try{const e=await C3.FetchImage(n);return URL.revokeObjectURL(n),n="",t&&"function"==typeof e["decode"]&&await e["decode"](),e}finally{n&&URL.revokeObjectURL(n)}},C3.CreateCanvas=function(e,t){if("undefined"!=typeof document&&"function"==typeof document.createElement){const n=document.createElement("canvas");return n.width=e,n.height=t,n}return new OffscreenCanvas(e,t)},C3.CanvasToBlob=function(e,t,n){if("number"!=typeof n&&(n=1),t=t||"image/png",n=C3.clamp(n,0,1),e["convertToBlob"])return e["convertToBlob"]({"type":t,"quality":n});if(e.toBlob)return new Promise(r=>e.toBlob(r,t,n));throw new Error("could not convert canvas to blob")},C3.DrawableToBlob=function(e,t,n){const r=C3.CreateCanvas(e.width,e.height);return r.getContext("2d").drawImage(e,0,0),C3.CanvasToBlob(r,t,n)},C3.ImageDataToBlob=function(e,t,n){if(C3.Supports.ImageBitmapOptions)return createImageBitmap(e,{"premultiplyAlpha":"none"}).then(e=>C3.DrawableToBlob(e,t,n));if(C3.Supports.ImageBitmap)return createImageBitmap(e).then(e=>C3.DrawableToBlob(e,t,n));{const r=C3.CreateCanvas(e.width,e.height);return r.getContext("2d").putImageData(e,0,0),C3.CanvasToBlob(r,t,n)}},C3.CopySet=function(e,t){e.clear();for(const n of t)e.add(n)},C3.MapToObject=function(e){const t=Object.create(null);for(const[n,r]of e.entries())t[n]=r;return t},C3.ObjectToMap=function(e,t){t.clear();for(const[n,r]of Object.entries(e))t.set(n,r)},C3.ToSuperJSON=function e(t){if("object"==typeof t&&null!==t){if(t instanceof Set)return{"_c3type_":"set","data":[...t].map(t=>e(t))};if(t instanceof Map)return{"_c3type_":"map","data":[...t].map(t=>[t[0],e(t[1])])};{const n=Object.create(null);for(const[r,o]of Object.entries(t))n[r]=e(o);return n}}return t},C3.FromSuperJSON=function e(t){if("object"==typeof t&null!==t){if("set"===t["_c3type_"])return new Set(t["data"].map(t=>e(t)));if("map"===t["_c3type_"])return new Map(t["data"].map(t=>[t[0],e(t[1])]));{const n=Object.create(null);for(const[r,o]of Object.entries(t))n[r]=e(o);return n}}return t},C3.CSSToCamelCase=function(e){if(e.startsWith("--"))return e;let t="",n=!1,r=0;for(const o of e)"-"===o?r>0&&(n=!0):n?(t+=o.toUpperCase(),n=!1):t+=o,++r;return t},C3.IsIterator=function(e){return"object"==typeof e&&"function"==typeof e.next},C3.MakeFilledArray=function(e,t){const n=[];if("function"==typeof t)for(let r=0;r<e;++r)n.push(t());else for(let r=0;r<e;++r)n.push(t);return n}; } // ../lib/misc/color.js { const C3=self.C3,HSL_TEST=/([0-9.]+),([0-9.]+)\%?,([0-9.]+)\%?/i,HSLA_TEST=/([0-9.]+),([0-9.]+)\%?,([0-9.]+)\%?,([0-9.])/i;function padTwoDigits(t){return 0===t.length?"00":1===t.length?"0"+t:t}function hueToRGB(t,s,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+6*(s-t)*e:e<.5?s:e<2/3?t+(s-t)*(2/3-e)*6:t}C3.Color=class{constructor(t,s,e,r){this._r=NaN,this._g=NaN,this._b=NaN,this._a=NaN,this._r=0,this._g=0,this._b=0,this._a=0,t instanceof C3.Color?this.set(t):this.setRgba(t||0,s||0,e||0,r||0)}setRgb(t,s,e){return this._r=+t,this._g=+s,this._b=+e,this.clamp(),this}setRgba(t,s,e,r){return this._r=+t,this._g=+s,this._b=+e,this._a=+r,this.clamp(),this}set(t){return this._r=t._r,this._g=t._g,this._b=t._b,this._a=t._a,this}copy(t){return this.set(t)}add(t){this._r+=t._r,this._g+=t._g,this._b+=t._b,this._a+=t._a,this.clamp()}addRgb(t,s,e,r=0){this._r+=+t,this._g+=+s,this._b+=+e,this._a+=+r,this.clamp()}diff(t){this.setR(Math.max(this._r,t._r)-Math.min(this._r,t._r)),this.setG(Math.max(this._g,t._g)-Math.min(this._g,t._g)),this.setB(Math.max(this._b,t._b)-Math.min(this._b,t._b)),this.setA(Math.max(this._a,t._a)-Math.min(this._a,t._a)),this.clamp()}copyRgb(t){this._r=t._r,this._g=t._g,this._b=t._b}setR(t){this._r=C3.clamp(+t,0,1)}getR(){return this._r}setG(t){this._g=C3.clamp(+t,0,1)}getG(){return this._g}setB(t){this._b=C3.clamp(+t,0,1)}getB(){return this._b}setA(t){this._a=C3.clamp(+t,0,1)}getA(){return this._a}clone(){return C3.New(C3.Color,this._r,this._g,this._b,this._a)}toArray(){return[this._r,this._g,this._b,this._a]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(t,s){t[s++]=this._r,t[s++]=this._g,t[s++]=this._b,t[s]=this._a}writeToTypedArrayx4(t,s){const e=this._r,r=this._g,i=this._b,a=this._a;t[s++]=e,t[s++]=r,t[s++]=i,t[s++]=a,t[s++]=e,t[s++]=r,t[s++]=i,t[s++]=a,t[s++]=e,t[s++]=r,t[s++]=i,t[s++]=a,t[s++]=e,t[s++]=r,t[s++]=i,t[s]=a}writeRGBToTypedArray(t,s){t[s++]=this._r,t[s++]=this._g,t[s]=this._b}equals(t){return this._r===t._r&&this._g===t._g&&this._b===t._b&&this._a===t._a}equalsIgnoringAlpha(t){return this._r===t._r&&this._g===t._g&&this._b===t._b}equalsRgb(t,s,e){return this._r===t&&this._g===s&&this._b===e}equalsRgba(t,s,e,r){return this._r===t&&this._g===s&&this._b===e&&this._a===r}equalsF32Array(t,s){return t[s]===Math.fround(this._r)&&t[s+1]===Math.fround(this._g)&&t[s+2]===Math.fround(this._b)&&t[s+3]===Math.fround(this._a)}equalsRGBF32Array(t,s){return t[s]===Math.fround(this._r)&&t[s+1]===Math.fround(this._g)&&t[s+2]===Math.fround(this._b)}multiply(t){this._r*=t._r,this._g*=t._g,this._b*=t._b,this._a*=t._a}multiplyAlpha(t){this._r*=t,this._g*=t,this._b*=t,this._a*=t}premultiply(){return this._r*=this._a,this._g*=this._a,this._b*=this._a,this}unpremultiply(){return this._r/=this._a,this._g/=this._a,this._b/=this._a,this}clamp(){return this._r=C3.clamp(this._r,0,1),this._g=C3.clamp(this._g,0,1),this._b=C3.clamp(this._b,0,1),this._a=C3.clamp(this._a,0,1),this}setFromRgbValue(t){this._r=C3.GetRValue(t),this._g=C3.GetGValue(t),this._b=C3.GetBValue(t),this._a=C3.GetAValue(t)}getCssRgb(t,s,e){return`rgb(${100*(C3.IsFiniteNumber(t)?t:this.getR())}%, ${100*(C3.IsFiniteNumber(s)?s:this.getG())}%, ${100*(C3.IsFiniteNumber(e)?e:this.getB())}%)`}getCssRgba(t,s,e,r){return`rgba(${100*(C3.IsFiniteNumber(t)?t:this.getR())}%, ${100*(C3.IsFiniteNumber(s)?s:this.getG())}%, ${100*(C3.IsFiniteNumber(e)?e:this.getB())}%, ${C3.IsFiniteNumber(r)?r:this.getA()})`}toHexString(t=!1){const s=Math.round(255*this.getR()),e=Math.round(255*this.getG()),r=Math.round(255*this.getB());let i="#"+padTwoDigits(s.toString(16))+padTwoDigits(e.toString(16))+padTwoDigits(r.toString(16));if(t){i+=padTwoDigits(Math.round(255*this.getA()).toString(16))}return i}parseHexString(t){if("string"!=typeof t)return!1;let s,e,r,i;if("#"===(t=t.trim()).charAt(0)&&(t=t.substr(1)),3===t.length||4===t.length)s=parseInt(t[0],16)/15,e=parseInt(t[1],16)/15,r=parseInt(t[2],16)/15,4===t.length&&(i=parseInt(t[3],16)/15);else{if(6!==t.length&&8!==t.length)return!1;s=parseInt(t.substr(0,2),16)/255,e=parseInt(t.substr(2,2),16)/255,r=parseInt(t.substr(4,2),16)/255,8===t.length&&(i=parseInt(t.substr(6,2),16)/255)}return!!(Number.isFinite(s)&&Number.isFinite(e)&&Number.isFinite(r))&&(this.setRgb(s,e,r),Number.isFinite(i)?this.setA(i):this.setA(1),!0)}toCommaSeparatedRgb(){return`${Math.round(255*this.getR())}, ${Math.round(255*this.getG())}, ${Math.round(255*this.getB())}`}toRgbArray(){return[Math.round(255*this.getR()),Math.round(255*this.getG()),Math.round(255*this.getB())]}parseCommaSeparatedRgb(t){if("string"!=typeof t)return!1;const s=(t=t.replace(/^rgb\(|\)|%/,"")).split(",");if(s.length<3)return!1;const e=parseInt(s[0].trim(),10)/255,r=parseInt(s[1].trim(),10)/255,i=parseInt(s[2].trim(),10)/255;return isFinite(e)&&this.setR(e),isFinite(r)&&this.setG(r),isFinite(i)&&this.setB(i),this.setA(1),!0}parseCommaSeparatedPercentageRgb(t){if("string"!=typeof t)return!1;const s=(t=t.replace(/^rgb\(|\)|%/,"")).split(",");if(s.length<3)return!1;const e=parseInt(s[0].trim(),10)/100,r=parseInt(s[1].trim(),10)/100,i=parseInt(s[2].trim(),10)/100;return isFinite(e)&&this.setR(e),isFinite(r)&&this.setG(r),isFinite(i)&&this.setB(i),this.setA(1),!0}parseCommaSeparatedRgba(t){if("string"!=typeof t)return!1;const s=(t=t.replace(/^rgba\(|\)|%/,"")).split(",");if(s.length<4)return!1;const e=parseInt(s[0].trim(),10)/255,r=parseInt(s[1].trim(),10)/255,i=parseInt(s[2].trim(),10)/255,a=parseFloat(s[3].trim());return isFinite(e)&&this.setR(e),isFinite(r)&&this.setG(r),isFinite(i)&&this.setB(i),isFinite(a)&&this.setA(a),!0}parseCommaSeparatedPercentageRgba(t){if("string"!=typeof t)return!1;const s=(t=t.replace(/^rgba\(|\)|%/,"")).split(",");if(s.length<4)return!1;const e=parseInt(s[0].trim(),10)/100,r=parseInt(s[1].trim(),10)/100,i=parseInt(s[2].trim(),10)/100,a=parseFloat(s[3].trim());return isFinite(e)&&this.setR(e),isFinite(r)&&this.setG(r),isFinite(i)&&this.setB(i),isFinite(a)&&this.setA(a),!0}parseString(t){if("string"!=typeof t)return!1;if((t=t.replace(/\s+/,"")).includes(",")){if(t.startsWith("rgb("))return t.includes("%")?this.parseCommaSeparatedPercentageRgb(t):this.parseCommaSeparatedRgb(t);if(t.startsWith("rgba("))return t.includes("%")?this.parseCommaSeparatedPercentageRgba(t):this.parseCommaSeparatedRgba(t);if(t.startsWith("hsl(")||t.startsWith("hsla("))return this.parseHSLString(t);{const s=t.split(",");return t.includes("%")?3===s.length?this.parseCommaSeparatedPercentageRgb(t):4===s.length&&this.parseCommaSeparatedPercentageRgba(t):3===s.length?this.parseCommaSeparatedRgb(t):4===s.length&&this.parseCommaSeparatedRgba(t)}}return this.parseHexString(t)}toJSON(){return[this._r,this._g,this._b,this._a]}setFromHSLA(t,s,e,r){let i,a,h;if(t%=360,s=C3.clamp(s,0,100),e=C3.clamp(e,0,100),r=C3.clamp(r,0,1),t/=360,e/=100,0===(s/=100))i=a=h=e;else{const r=e<.5?e*(1+s):e+s-e*s,n=2*e-r;i=hueToRGB(n,r,t+1/3),a=hueToRGB(n,r,t),h=hueToRGB(n,r,t-1/3)}return this.setR(i),this.setG(a),this.setB(h),this.setA(r),this}parseHSLString(t){const s=t.replace(/ |hsl|hsla|\(|\)|;/gi,""),e=HSL_TEST.exec(s),r=HSLA_TEST.exec(s);return e&&4===e.length?(this.setFromHSLA(+e[1],+e[2],+e[3],1),!0):!(!r||5!==r.length)&&(this.setFromHSLA(+e[1],+e[2],+e[3],+e[4]),!0)}toHSLAString(){const t=this._r,s=this._g,e=this._b,r=this._a;return`hsla(${C3.Color.GetHue(t,s,e)}, ${C3.Color.GetSaturation(t,s,e)}%, ${C3.Color.GetLuminosity(t,s,e)}%, ${r})`}toHSLAArray(){const t=this._r,s=this._g,e=this._b;return[C3.Color.GetHue(t,s,e),C3.Color.GetSaturation(t,s,e),C3.Color.GetLuminosity(t,s,e),this._a]}setFromJSON(t){Array.isArray(t)&&(t.length<3||(this._r=t[0],this._g=t[1],this._b=t[2],t.length>=4?this._a=t[3]:this._a=1))}set r(t){this.setR(t)}get r(){return this.getR()}set g(t){this.setG(t)}get g(){return this.getG()}set b(t){this.setB(t)}get b(){return this.getB()}set a(t){this.setA(t)}get a(){return this.getA()}setAtIndex(t,s){switch(t){case 0:this.setR(s);break;case 1:this.setG(s);break;case 2:this.setB(s);break;case 3:this.setA(s);break;default:throw new RangeError("invalid color index")}}getAtIndex(t){switch(t){case 0:return this.getR();case 1:return this.getG();case 2:return this.getB();case 3:return this.getA();default:throw new RangeError("invalid color index")}}static Equals(t,s){let e,r;if(Array.isArray(t))e=new C3.Color,e.setFromJSON(t);else{if(!(t instanceof C3.Color))throw new Error("unexpected type");e=t}if(Array.isArray(s))r=new C3.Color,r.setFromJSON(s);else{if(!(s instanceof C3.Color))throw new Error("unexpected type");r=s}return e.equals(r)}static DiffChannel(t,s){return C3.clamp(Math.max(t,s)-Math.min(t,s),0,1)}static Diff(t,s){const e=new C3.Color;return e.setR(Math.max(t._r,s._r)-Math.min(t._r,s._r)),e.setG(Math.max(t._g,s._g)-Math.min(t._g,s._g)),e.setB(Math.max(t._b,s._b)-Math.min(t._b,s._b)),e.setA(Math.max(t._a,s._a)-Math.min(t._a,s._a)),e}static DiffNoAlpha(t,s){const e=new C3.Color(0,0,0,1);return e.setR(Math.max(t._r,s._r)-Math.min(t._r,s._r)),e.setG(Math.max(t._g,s._g)-Math.min(t._g,s._g)),e.setB(Math.max(t._b,s._b)-Math.min(t._b,s._b)),e}static GetHue(t,s,e){const r=Math.max(t,s,e),i=Math.min(t,s,e);if(r===i)return 0;let a=0;switch(r){case t:a=(s-e)/(r-i)+(s<e?6:0);break;case s:a=(e-t)/(r-i)+2;break;case e:a=(t-s)/(r-i)+4}return Math.round(a/6*360)}static GetSaturation(t,s,e){const r=Math.max(t,s,e),i=Math.min(t,s,e);if(r===i)return 0;const a=r-i,h=(r+i)/2>.5?a/(2-r-i):a/(r+i);return Math.round(100*h)}static GetLuminosity(t,s,e){const r=Math.max(t,s,e),i=(r+Math.min(t,s,e))/2;return r?Math.round(100*i):0}},C3.Color.White=Object.freeze(C3.New(C3.Color,1,1,1,1)),C3.Color.Black=Object.freeze(C3.New(C3.Color,0,0,0,1)),C3.Color.TransparentBlack=Object.freeze(C3.New(C3.Color,0,0,0,0)); } // ../lib/geometry/vector2.js { const C3=self.C3;C3.Vector2=class{constructor(t,s){this._x=0,this._y=0,t instanceof C3.Vector2?this.copy(t):this.set(t||0,s||0)}set(t,s){this._x=+t,this._y=+s}copy(t){this._x=t._x,this._y=t._y}equals(t){return this._x===t._x&&this._y===t._y}equalsValues(t,s){return this._x===t&&this._y===s}equalsF32Array(t,s){return t[s]===Math.fround(this._x)&&t[s+1]===Math.fround(this._y)}setX(t){this._x=+t}getX(){return this._x}setY(t){this._y=+t}getY(){return this._y}toArray(){return[this._x,this._y]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(t,s){t[s++]=this._x,t[s]=this._y}offset(t,s){this._x+=+t,this._y+=+s}scale(t,s){this._x*=t,this._y*=s}divide(t,s){this._x/=t,this._y/=s}round(){this._x=Math.round(this._x),this._y=Math.round(this._y)}floor(){this._x=Math.floor(this._x),this._y=Math.floor(this._y)}ceil(){this._x=Math.ceil(this._x),this._y=Math.ceil(this._y)}angle(){return C3.angleTo(0,0,this._x,this._y)}lengthSquared(){return this._x*this._x+this._y*this._y}length(){return C3.hypot2DFast(this._x,this._y)}rotatePrecalc(t,s){const h=this._x*s-this._y*t;this._y=this._y*s+this._x*t,this._x=h}rotate(t){0!==t&&this.rotatePrecalc(Math.sin(t),Math.cos(t))}rotateAbout(t,s,h){0===t||s===this._x&&h===this._y||(this._x-=s,this._y-=h,this.rotatePrecalc(Math.sin(t),Math.cos(t)),this._x+=+s,this._y+=+h)}move(t,s){0!==s&&(this._x+=Math.cos(t)*s,this._y+=Math.sin(t)*s)}normalize(){const t=this.length();0!==t&&1!==t&&(this._x/=t,this._y/=t)}clamp(t,s){this._x=C3.clamp(this._x,t,s),this._y=C3.clamp(this._y,t,s)}dot(t){return this._x*t._x+this._y*t._y}reverse(){this._x=-this._x,this._y=-this._y}perp(){let t=this._x;return this._x=this._y,this._y=-t,this}}; } // ../lib/geometry/rect.js { const C3=self.C3;C3.Rect=class{constructor(t,i,h,o){this._left=NaN,this._top=NaN,this._right=NaN,this._bottom=NaN,this._left=0,this._top=0,this._right=0,this._bottom=0,t instanceof C3.Rect?this.copy(t):this.set(t||0,i||0,h||0,o||0)}set(t,i,h,o){this._left=+t,this._top=+i,this._right=+h,this._bottom=+o}setWH(t,i,h,o){t=+t,i=+i,this._left=t,this._top=i,this._right=t+ +h,this._bottom=i+ +o}copy(t){this._left=+t._left,this._top=+t._top,this._right=+t._right,this._bottom=+t._bottom}setFromAABB3D(t){this._left=t.getLeft(),this._top=t.getTop(),this._right=t.getRight(),this._bottom=t.getBottom()}clone(){return new C3.Rect(this._left,this._top,this._right,this._bottom)}static Merge(t,i){const h=new C3.Rect;return h.setLeft(Math.min(t._left,i._left)),h.setTop(Math.min(t._top,i._top)),h.setRight(Math.max(t._right,i._right)),h.setBottom(Math.max(t._bottom,i._bottom)),h}static FromObject(t){return new C3.Rect(t.left,t.top,t.right,t.bottom)}equals(t){return this._left===t._left&&this._top===t._top&&this._right===t._right&&this._bottom===t._bottom}equalsWH(t,i,h,o){return this._left===t&&this._top===i&&this.width()===h&&this.height()===o}equalsF32Array(t,i){return t[i]===Math.fround(this._left)&&t[i+1]===Math.fround(this._top)&&t[i+2]===Math.fround(this._right)&&t[i+3]===Math.fround(this._bottom)}setLeft(t){this._left=+t}getLeft(){return this._left}setTop(t){this._top=+t}getTop(){return this._top}setRight(t){this._right=+t}getRight(){return this._right}setBottom(t){this._bottom=+t}getBottom(){return this._bottom}toArray(){return[this._left,this._top,this._right,this._bottom]}toTypedArray(){return new Float64Array(this.toArray())}toDOMRect(){return new DOMRect(this._left,this._top,this.width(),this.height())}static fromDOMRect(t){return C3.New(C3.Rect,t.left,t.top,t.right,t.bottom)}writeToTypedArray(t,i){t[i++]=this._left,t[i++]=this._top,t[i++]=this._right,t[i]=this._bottom}writeAsQuadToTypedArray(t,i){const h=this._left,o=this._top,s=this._right,_=this._bottom;t[i++]=h,t[i++]=o,t[i++]=s,t[i++]=o,t[i++]=s,t[i++]=_,t[i++]=h,t[i]=_}writeAsQuadToTypedArray3D(t,i,h){const o=this._left,s=this._top,_=this._right,e=this._bottom;t[i++]=o,t[i++]=s,t[i++]=h,t[i++]=_,t[i++]=s,t[i++]=h,t[i++]=_,t[i++]=e,t[i++]=h,t[i++]=o,t[i++]=e,t[i]=h}width(){return this._right-this._left}height(){return this._bottom-this._top}midX(){return(this._left+this._right)/2}midY(){return(this._top+this._bottom)/2}offset(t,i){t=+t,i=+i,this._left+=t,this._top+=i,this._right+=t,this._bottom+=i}offsetLeft(t){this._left+=+t}offsetTop(t){this._top+=+t}offsetRight(t){this._right+=+t}offsetBottom(t){this._bottom+=+t}toSquare(t){if("x"!==t)throw new Error("invalid axis, only 'x' supported");this._top<this._bottom?this._left<this._right?this._bottom=this._top+this.width():this._bottom=this._top-this.width():this._left<this._right?this._bottom=this._top-this.width():this._bottom=this._top+this.width()}inflate(t,i){t=+t,i=+i,this._left-=t,this._top-=i,this._right+=t,this._bottom+=i}deflate(t,i){t=+t,i=+i,this._left+=t,this._top+=i,this._right-=t,this._bottom-=i}multiply(t,i){this._left*=t,this._top*=i,this._right*=t,this._bottom*=i}divide(t,i){this._left/=t,this._top/=i,this._right/=t,this._bottom/=i}mirrorAround(t){this._left=+t-this._left,this._right=+t-this._right}flipAround(t){this._top=+t-this._top,this._bottom=+t-this._bottom}rotate90DegreesAround(t,i){const h=this.width(),o=this.height(),s=this.getLeft()+h*t,_=this.getTop()+o*i;this.setWH(s-o*i,_-h*t,o,h)}swapLeftRight(){const t=this._left;this._left=this._right,this._right=t}swapTopBottom(){const t=this._top;this._top=this._bottom,this._bottom=t}shuntY(t){const i=this._top;this._top=+t-this._bottom,this._bottom=+t-i}round(){this._left=Math.round(this._left),this._top=Math.round(this._top),this._right=Math.round(this._right),this._bottom=Math.round(this._bottom)}roundInner(){this._left=Math.ceil(this._left),this._top=Math.ceil(this._top),this._right=Math.floor(this._right),this._bottom=Math.floor(this._bottom)}roundOuter(){this._left=Math.floor(this._left),this._top=Math.floor(this._top),this._right=Math.ceil(this._right),this._bottom=Math.ceil(this._bottom)}floor(){this._left=Math.floor(this._left),this._top=Math.floor(this._top),this._right=Math.floor(this._right),this._bottom=Math.floor(this._bottom)}ceil(){this._left=Math.ceil(this._left),this._top=Math.ceil(this._top),this._right=Math.ceil(this._right),this._bottom=Math.ceil(this._bottom)}clamp(t,i,h,o){this._left=Math.max(this._left,+t),this._top=Math.max(this._top,+i),this._right=Math.min(this._right,+h),this._bottom=Math.min(this._bottom,+o)}clampBoth(t,i,h,o){t=+t,i=+i,h=+h,o=+o,this._left=C3.clamp(this._left,t,h),this._top=C3.clamp(this._top,i,o),this._right=C3.clamp(this._right,t,h),this._bottom=C3.clamp(this._bottom,i,o)}normalize(){this._left>this._right&&this.swapLeftRight(),this._top>this._bottom&&this.swapTopBottom()}intersectsRect(t){return!(t._right<this._left||t._bottom<this._top||t._left>this._right||t._top>this._bottom)}intersectsRectOffset(t,i,h){return!(t._right+i<this._left||t._bottom+h<this._top||t._left+i>this._right||t._top+h>this._bottom)}containsPoint(t,i){return t>=this._left&&t<=this._right&&i>=this._top&&i<=this._bottom}containsRect(t){return t._left>=this._left&&t._top>=this._top&&t._right<=this._right&&t._bottom<=this._bottom}intersectsAABB3D(t){return!(t.getRight()<this._left||t.getBottom()<this._top||t.getLeft()>this._right||t.getTop()>this._bottom)}containsAABB3D(t){return t.getLeft()>=this._left&&t.getTop()>=this._top&&t.getRight()<=this._right&&t.getBottom()<=this._bottom}expandToContain(t){t._left<this._left&&(this._left=+t._left),t._top<this._top&&(this._top=+t._top),t._right>this._right&&(this._right=+t._right),t._bottom>this._bottom&&(this._bottom=+t._bottom)}lerpInto(t){this._left=C3.lerp(t._left,t._right,this._left),this._top=C3.lerp(t._top,t._bottom,this._top),this._right=C3.lerp(t._left,t._right,this._right),this._bottom=C3.lerp(t._top,t._bottom,this._bottom)}}; } // ../lib/geometry/quad2d.js { const C3=self.C3;C3.Quad2D=class{constructor(t,s,i,h,_,r,e,l){this._tlx=NaN,this._tly=NaN,this._trx=NaN,this._try=NaN,this._brx=NaN,this._bry=NaN,this._blx=NaN,this._bly=NaN,this._tlx=0,this._tly=0,this._trx=0,this._try=0,this._brx=0,this._bry=0,this._blx=0,this._bly=0,t instanceof C3.Quad2D?this.copy(t):this.set(t||0,s||0,i||0,h||0,_||0,r||0,e||0,l||0)}set(t,s,i,h,_,r,e,l){this._tlx=+t,this._tly=+s,this._trx=+i,this._try=+h,this._brx=+_,this._bry=+r,this._blx=+e,this._bly=+l}setRect(t,s,i,h){this.set(t,s,i,s,i,h,t,h)}setFromQuad3d(t){this.set(t.getTlx(),t.getTly(),t.getTrx(),t.getTry(),t.getBrx(),t.getBry(),t.getBlx(),t.getBly())}copy(t){this._tlx=t._tlx,this._tly=t._tly,this._trx=t._trx,this._try=t._try,this._brx=t._brx,this._bry=t._bry,this._blx=t._blx,this._bly=t._bly}equals(t){return this._tlx===t._tlx&&this._tly===t._tly&&this._trx===t._trx&&this._try===t._try&&this._brx===t._brx&&this._bry===t._bry&&this._blx===t._blx&&this._bly===t._bly}setTlx(t){this._tlx=+t}getTlx(){return this._tlx}setTly(t){this._tly=+t}getTly(){return this._tly}setTrx(t){this._trx=+t}getTrx(){return this._trx}setTry(t){this._try=+t}getTry(){return this._try}setBrx(t){this._brx=+t}getBrx(){return this._brx}setBry(t){this._bry=+t}getBry(){return this._bry}setBlx(t){this._blx=+t}getBlx(){return this._blx}setBly(t){this._bly=+t}getBly(){return this._bly}toDOMQuad(){return new DOMQuad(new DOMPoint(this._tlx,this._tly),new DOMPoint(this._trx,this._try),new DOMPoint(this._brx,this._bry),new DOMPoint(this._blx,this._bly))}static fromDOMQuad(t){return C3.New(C3.Quad2D,t.p1.x,t.p1.y,t.p2.x,t.p2.y,t.p3.x,t.p3.y,t.p4.x,t.p4.y)}toArray(){return[this._tlx,this._tly,this._trx,this._try,this._brx,this._bry,this._blx,this._bly]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(t,s){t[s++]=this._tlx,t[s++]=this._tly,t[s++]=this._trx,t[s++]=this._try,t[s++]=this._brx,t[s++]=this._bry,t[s++]=this._blx,t[s]=this._bly}writeToTypedArray3D(t,s,i){t[s++]=this._tlx,t[s++]=this._tly,t[s++]=i,t[s++]=this._trx,t[s++]=this._try,t[s++]=i,t[s++]=this._brx,t[s++]=this._bry,t[s++]=i,t[s++]=this._blx,t[s++]=this._bly,t[s]=i}offset(t,s){t=+t,s=+s,this._tlx+=t,this._tly+=s,this._trx+=t,this._try+=s,this._brx+=t,this._bry+=s,this._blx+=t,this._bly+=s}round(){this._tlx=Math.round(this._tlx),this._tly=Math.round(this._tly),this._trx=Math.round(this._trx),this._try=Math.round(this._try),this._brx=Math.round(this._brx),this._bry=Math.round(this._bry),this._blx=Math.round(this._blx),this._bly=Math.round(this._bly)}floor(){this._tlx=Math.floor(this._tlx),this._tly=Math.floor(this._tly),this._trx=Math.floor(this._trx),this._try=Math.floor(this._try),this._brx=Math.floor(this._brx),this._bry=Math.floor(this._bry),this._blx=Math.floor(this._blx),this._bly=Math.floor(this._bly)}ceil(){this._tlx=Math.ceil(this._tlx),this._tly=Math.ceil(this._tly),this._trx=Math.ceil(this._trx),this._try=Math.ceil(this._try),this._brx=Math.ceil(this._brx),this._bry=Math.ceil(this._bry),this._blx=Math.ceil(this._blx),this._bly=Math.ceil(this._bly)}setFromRect(t){this._tlx=t._left,this._tly=t._top,this._trx=t._right,this._try=t._top,this._brx=t._right,this._bry=t._bottom,this._blx=t._left,this._bly=t._bottom}setFromAABB3DIgnoringZ(t){this._tlx=t.getLeft(),this._tly=t.getTop(),this._trx=t.getRight(),this._try=t.getTop(),this._brx=t.getRight(),this._bry=t.getBottom(),this._blx=t.getLeft(),this._bly=t.getBottom()}setFromRotatedRect(t,s){0===s?this.setFromRect(t):this.setFromRotatedRectPrecalc(t,Math.sin(s),Math.cos(s))}setFromRotatedRectPrecalc(t,s,i){const h=t._left*s,_=t._top*s,r=t._right*s,e=t._bottom*s,l=t._left*i,x=t._top*i,y=t._right*i,b=t._bottom*i;this._tlx=l-_,this._tly=x+h,this._trx=y-_,this._try=x+r,this._brx=y-e,this._bry=b+r,this._blx=l-e,this._bly=b+h}getBoundingBox(t){t.set(Math.min(this._tlx,this._trx,this._brx,this._blx),Math.min(this._tly,this._try,this._bry,this._bly),Math.max(this._tlx,this._trx,this._brx,this._blx),Math.max(this._tly,this._try,this._bry,this._bly))}containsPoint(t,s){let i=this._trx-this._tlx,h=this._try-this._tly;const _=this._brx-this._tlx,r=this._bry-this._tly,e=t-this._tlx,l=s-this._tly;let x=i*i+h*h,y=i*_+h*r,b=i*e+h*l;const a=_*_+r*r,n=_*e+r*l;let o=1/(x*a-y*y),c=(a*b-y*n)*o,u=(x*n-y*b)*o;return c>=0&&u>0&&c+u<1||(i=this._blx-this._tlx,h=this._bly-this._tly,x=i*i+h*h,y=i*_+h*r,b=i*e+h*l,o=1/(x*a-y*y),c=(a*b-y*n)*o,u=(x*n-y*b)*o,c>=0&&u>0&&c+u<1)}midX(){return(this._tlx+this._trx+this._brx+this._blx)/4}midY(){return(this._tly+this._try+this._bry+this._bly)/4}intersectsSegment(t,s,i,h){return!(!this.containsPoint(t,s)&&!this.containsPoint(i,h))||C3.segmentIntersectsQuad(t,s,i,h,this)}intersectsQuad(t){let s=t.midX(),i=t.midY();if(this.containsPoint(s,i))return!0;if(s=this.midX(),i=this.midY(),t.containsPoint(s,i))return!0;const h=this._tlx,_=this._tly,r=this._trx,e=this._try,l=this._brx,x=this._bry,y=this._blx,b=this._bly;return C3.segmentIntersectsQuad(h,_,r,e,t)||C3.segmentIntersectsQuad(r,e,l,x,t)||C3.segmentIntersectsQuad(l,x,y,b,t)||C3.segmentIntersectsQuad(y,b,h,_,t)}rotatePointsAnticlockwise(){const t=this._tlx,s=this._tly;this._tlx=this._trx,this._tly=this._try,this._trx=this._brx,this._try=this._bry,this._brx=this._blx,this._bry=this._bly,this._blx=t,this._bly=s}mirror(){this._swap(0,2),this._swap(1,3),this._swap(6,4),this._swap(7,5)}flip(){this._swap(0,6),this._swap(1,7),this._swap(2,4),this._swap(3,5)}diag(){this._swap(2,6),this._swap(3,7)}_swap(t,s){const i=this._getAtIndex(t);this._setAtIndex(t,this._getAtIndex(s)),this._setAtIndex(s,i)}_getAtIndex(t){switch(t){case 0:return this._tlx;case 1:return this._tly;case 2:return this._trx;case 3:return this._try;case 4:return this._brx;case 5:return this._bry;case 6:return this._blx;case 7:return this._bly;default:throw new RangeError("invalid quad point index")}}_setAtIndex(t,s){switch(s=+s,t){case 0:this._tlx=s;break;case 1:this._tly=s;break;case 2:this._trx=s;break;case 3:this._try=s;break;case 4:this._brx=s;break;case 5:this._bry=s;break;case 6:this._blx=s;break;case 7:this._bly=s;break;default:throw new RangeError("invalid quad point index")}}divide(t,s){this._tlx/=t,this._tly/=s,this._trx/=t,this._try/=s,this._brx/=t,this._bry/=s,this._blx/=t,this._bly/=s}},C3.Quad=C3.Quad2D; } // ../lib/geometry/quad3d.js { const C3=globalThis.C3;C3.Quad3D=class{#t=NaN;#s=NaN;#i=NaN;#h=NaN;#r=NaN;#l=NaN;#b=NaN;#y=NaN;#x=NaN;#z=NaN;#e=NaN;#a=NaN;constructor(t,s,i,h,r,l,b,y,x,z,e,a){this.#t=0,this.#s=0,this.#i=0,this.#h=0,this.#r=0,this.#l=0,this.#b=0,this.#y=0,this.#x=0,this.#z=0,this.#e=0,this.#a=0,t instanceof C3.Quad3D?this.copy(t):this.set(t??0,s??0,i??0,h??0,r??0,l??0,b??0,y??0,x??0,z??0,e??0,a??0)}set(t,s,i,h,r,l,b,y,x,z,e,a){this.#t=+t,this.#s=+s,this.#i=+i,this.#h=+h,this.#r=+r,this.#l=+l,this.#b=+b,this.#y=+y,this.#x=+x,this.#z=+z,this.#e=+e,this.#a=+a}toArray(){return[this.#t,this.#s,this.#i,this.#h,this.#r,this.#l,this.#b,this.#y,this.#x,this.#z,this.#e,this.#a]}copy(t){[this.#t,this.#s,this.#i,this.#h,this.#r,this.#l,this.#b,this.#y,this.#x,this.#z,this.#e,this.#a]=t.toArray()}setFromQuad2d(t,s=0){[this.#t,this.#s,this.#h,this.#r,this.#b,this.#y,this.#z,this.#e]=t.toArray(),this.#i=s,this.#l=s,this.#x=s,this.#a=s}setTlx(t){this.#t=+t}getTlx(){return this.#t}setTly(t){this.#s=+t}getTly(){return this.#s}setTlz(t){this.#i=+t}getTlz(){return this.#i}setTrx(t){this.#h=+t}getTrx(){return this.#h}setTry(t){this.#r=+t}getTry(){return this.#r}setTrz(t){this.#l=t}getTrz(){return this.#l}setBrx(t){this.#b=+t}getBrx(){return this.#b}setBry(t){this.#y=+t}getBry(){return this.#y}setBrz(t){this.#x=t}getBrz(){return this.#x}setBlx(t){this.#z=+t}getBlx(){return this.#z}setBly(t){this.#e=+t}getBly(){return this.#e}setBlz(t){this.#a=t}getBlz(){return this.#a}midX(){return(this.#t+this.#h+this.#b+this.#z)/4}midY(){return(this.#s+this.#r+this.#y+this.#e)/4}midZ(){return(this.#i+this.#l+this.#x+this.#a)/4}writeToTypedArray(t,s){t[s++]=this.#t,t[s++]=this.#s,t[s++]=this.#i,t[s++]=this.#h,t[s++]=this.#r,t[s++]=this.#l,t[s++]=this.#b,t[s++]=this.#y,t[s++]=this.#x,t[s++]=this.#z,t[s++]=this.#e,t[s]=this.#a}writeToTypedArrayWithZOffset(t,s,i){t[s++]=this.#t,t[s++]=this.#s,t[s++]=this.#i+i,t[s++]=this.#h,t[s++]=this.#r,t[s++]=this.#l+i,t[s++]=this.#b,t[s++]=this.#y,t[s++]=this.#x+i,t[s++]=this.#z,t[s++]=this.#e,t[s]=this.#a+i}getBoundingAABB3D(t){t.set(Math.min(this.#t,this.#h,this.#b,this.#z),Math.min(this.#s,this.#r,this.#y,this.#e),Math.min(this.#i,this.#l,this.#x,this.#a),Math.max(this.#t,this.#h,this.#b,this.#z),Math.max(this.#s,this.#r,this.#y,this.#e),Math.max(this.#i,this.#l,this.#x,this.#a))}toQuad2dXYPlane(t){t.set(this.#t,this.#s,this.#h,this.#r,this.#b,this.#y,this.#z,this.#e)}toQuad2dYZPlane(t){t.set(this.#s,this.#i,this.#r,this.#l,this.#y,this.#x,this.#e,this.#a)}toQuad2dXZPlane(t){t.set(this.#t,this.#i,this.#h,this.#l,this.#b,this.#x,this.#z,this.#a)}}; } // ../lib/geometry/aabb3d.js { const C3=globalThis.C3;C3.AABB3D=class{#t=NaN;#i=NaN;#h=NaN;#s=NaN;#o=NaN;#e=NaN;constructor(t,i,h,s,o,e){t instanceof C3.Rect?this.copyRect(t):t instanceof C3.AABB3D?this.copyAABB3D(t):this.set(t??0,i??0,h??0,s??0,o??0,e??0)}set(t,i,h,s,o,e){this.#t=+t,this.#i=+i,this.#h=+h,this.#s=+s,this.#o=+o,this.#e=+e}setWHD(t,i,h,s,o,e){t=+t,i=+i,h=+h,this.#t=t,this.#i=i,this.#h=h,this.#s=t+ +s,this.#o=i+ +o,this.#e=h+ +e}setFromRect(t,i=0,h=0){this.#t=t.getLeft(),this.#i=t.getTop(),this.#h=+i,this.#s=t.getRight(),this.#o=t.getBottom(),this.#e=+h}copy(t){if(t instanceof C3.Rect)this.copyRect(t);else{if(!(t instanceof C3.AABB3D))throw new TypeError("expected Rect or AABB3D");this.copyAABB3D(t)}}copyRect(t){this.#t=t.getLeft(),this.#i=t.getTop(),this.#h=0,this.#s=t.getRight(),this.#o=t.getBottom(),this.#e=0}copyAABB3D(t){this.#t=t.getLeft(),this.#i=t.getTop(),this.#h=t.getBack(),this.#s=t.getRight(),this.#o=t.getBottom(),this.#e=t.getFront()}clone(){return new C3.AABB3D(this.#t,this.#i,this.#h,this.#s,this.#o,this.#e)}toRect(){return new C3.Rect(this.#t,this.#i,this.#s,this.#o)}toDOMRect(){return new DOMRect(this.#t,this.#i,this.width(),this.height())}toArray(){return[this.#t,this.#i,this.#h,this.#s,this.#o,this.#e]}setLeft(t){this.#t=+t}getLeft(){return this.#t}setTop(t){this.#i=+t}getTop(){return this.#i}setBack(t){this.#h=+t}getBack(){return this.#h}setRight(t){this.#s=+t}getRight(){return this.#s}setBottom(t){this.#o=+t}getBottom(){return this.#o}setFront(t){this.#e=+t}getFront(){return this.#e}width(){return this.#s-this.#t}height(){return this.#o-this.#i}depth(){return this.#e-this.#h}midX(){return(this.#t+this.#s)/2}midY(){return(this.#i+this.#o)/2}midZ(){return(this.#h+this.#e)/2}offset(t,i,h){t=+t,i=+i,h=+h,this.#t+=t,this.#i+=i,this.#h+=h,this.#s+=t,this.#o+=i,this.#e+=h}offsetLeft(t){this.#t+=+t}offsetTop(t){this.#i+=+t}offsetBack(t){this.#h+=+t}offsetRight(t){this.#s+=+t}offsetBottom(t){this.#o+=+t}offsetFront(t){this.#e+=+t}swapLeftRight(){const t=this.#t;this.#t=this.#s,this.#s=t}swapTopBottom(){const t=this.#i;this.#i=this.#o,this.#o=t}swapBackFront(){const t=this.#h;this.#h=this.#e,this.#e=t}normalize(){this.#t>this.#s&&this.swapLeftRight(),this.#i>this.#o&&this.swapTopBottom(),this.#h>this.#e&&this.swapBackFront()}expandToContain(t){t.getLeft()<this.#t&&(this.#t=t.getLeft()),t.getTop()<this.#i&&(this.#i=t.getTop()),t.getBack()<this.#h&&(this.#h=t.getBack()),t.getRight()>this.#s&&(this.#s=t.getRight()),t.getBottom()>this.#o&&(this.#o=t.getBottom()),t.getFront()>this.#e&&(this.#e=t.getFront())}intersectsRect(t){return!(t.getRight()<this.#t||t.getBottom()<this.#i||t.getLeft()>this.#s||t.getTop()>this.#o)}containsRect(t){return t.getLeft()>=this.#t&&t.getTop()>=this.#i&&t.getRight()<=this.#s&&t.getBottom()<=this.#o}intersectsAABB3D(t){return!(t.getRight()<this.#t||t.getBottom()<this.#i||t.getFront()<this.#h||t.getLeft()>this.#s||t.getTop()>this.#o||t.getBack()>this.#e)}intersectsAABB3DIgnoringZ(t){return!(t.getRight()<this.#t||t.getBottom()<this.#i||t.getLeft()>this.#s||t.getTop()>this.#o)}containsPoint(t,i,h){return t>=this.#t&&t<=this.#s&&i>=this.#i&&i<=this.#o&&h>=this.#h&&h<=this.#e}containsPoint2d(t,i){return t>=this.#t&&t<=this.#s&&i>=this.#i&&i<=this.#o}}; } // ../lib/geometry/hexahedron.js { const C3=globalThis.C3;C3.Hexahedron=class{#t=NaN;#l=NaN;#h=NaN;#s=NaN;#i=NaN;#r=NaN;#u=NaN;#b=NaN;#x=NaN;#y=NaN;#z=NaN;#N=NaN;#a=NaN;#n=NaN;#o=NaN;#e=NaN;#c=NaN;#m=NaN;#M=NaN;#A=NaN;#C=NaN;#d=NaN;#g=NaN;#B=NaN;constructor(t){t instanceof C3.Hexahedron?this.copy(t):(this.#t=0,this.#l=0,this.#h=0,this.#s=0,this.#i=0,this.#r=0,this.#u=0,this.#b=0,this.#x=0,this.#y=0,this.#z=0,this.#N=0,this.#a=0,this.#n=0,this.#o=0,this.#e=0,this.#c=0,this.#m=0,this.#M=0,this.#A=0,this.#C=0,this.#d=0,this.#g=0,this.#B=0)}toArray(){return[this.#t,this.#l,this.#h,this.#s,this.#i,this.#r,this.#u,this.#b,this.#x,this.#y,this.#z,this.#N,this.#a,this.#n,this.#o,this.#e,this.#c,this.#m,this.#M,this.#A,this.#C,this.#d,this.#g,this.#B]}copy(t){[this.#t,this.#l,this.#h,this.#s,this.#i,this.#r,this.#u,this.#b,this.#x,this.#y,this.#z,this.#N,this.#a,this.#n,this.#o,this.#e,this.#c,this.#m,this.#M,this.#A,this.#C,this.#d,this.#g,this.#B]=t.toArray()}getBoundingAABB3D(t){t.set(Math.min(this.#t,this.#s,this.#u,this.#y,this.#a,this.#e,this.#M,this.#d),Math.min(this.#l,this.#i,this.#b,this.#z,this.#n,this.#c,this.#A,this.#g),Math.min(this.#h,this.#r,this.#x,this.#N,this.#o,this.#m,this.#C,this.#B),Math.max(this.#t,this.#s,this.#u,this.#y,this.#a,this.#e,this.#M,this.#d),Math.max(this.#l,this.#i,this.#b,this.#z,this.#n,this.#c,this.#A,this.#g),Math.max(this.#h,this.#r,this.#x,this.#N,this.#o,this.#m,this.#C,this.#B))}}; } // lib/misc/collisionPoly.js { const C3=self.C3,assert=self.assert,DEFAULT_POLY_POINTS=[0,0,1,0,1,1,0,1],tempQuad=C3.New(C3.Quad2D);C3.CollisionPoly=class extends C3.DefendedBase{constructor(t,s=!0){super(),t||(t=DEFAULT_POLY_POINTS),this._ptsArr=Float64Array.from(t),this._bbox=new C3.Rect,this._isBboxChanged=!0,this._enabled=s}Release(){}pointsArr(){return this._ptsArr}pointCount(){return this._ptsArr.length/2}setPoints(t){this._ptsArr.length===t.length?this._ptsArr.set(t):this._ptsArr=Float64Array.from(t),this._isBboxChanged=!0}setDefaultPoints(){this.setPoints(DEFAULT_POLY_POINTS)}copy(t){this.setPoints(t._ptsArr)}setBboxChanged(){this._isBboxChanged=!0}_updateBbox(){if(!this._isBboxChanged)return;const t=this._ptsArr;let s=t[0],e=t[1],r=s,n=e;for(let o=0,i=t.length;o<i;o+=2){const i=t[o],h=t[o+1];i<s&&(s=i),i>r&&(r=i),h<e&&(e=h),h>n&&(n=h)}this._bbox.set(s,e,r,n),this._isBboxChanged=!1}setFromRect(t,s,e){let r=this._ptsArr;8!==r.length&&(r=new Float64Array(8),this._ptsArr=r),r[0]=t.getLeft()-s,r[1]=t.getTop()-e,r[2]=t.getRight()-s,r[3]=t.getTop()-e,r[4]=t.getRight()-s,r[5]=t.getBottom()-e,r[6]=t.getLeft()-s,r[7]=t.getBottom()-e,this._bbox.copy(t),0===s&&0===e||this._bbox.offset(-s,-e),this._isBboxChanged=!1}setFromQuad(t,s,e){tempQuad.copy(t),tempQuad.offset(s,e),this.setPoints(tempQuad.toArray()),this._isBboxChanged=!0}transform(t,s,e){let r=0,n=1;0!==e&&(r=Math.sin(e),n=Math.cos(e)),this.transformPrecalc(t,s,r,n)}transformPrecalc(t,s,e,r){const n=this._ptsArr;for(let o=0,i=n.length;o<i;o+=2){const i=o+1,h=n[o]*t,l=n[i]*s;n[o]=h*r-l*e,n[i]=l*r+h*e}this._isBboxChanged=!0}offset(t,s){const e=this._ptsArr;for(let r=0,n=e.length;r<n;r+=2)e[r]+=t,e[r+1]+=s}containsPoint(t,s){const e=this._ptsArr;if(t===e[0]&&s===e[1])return!0;this._updateBbox();const r=this._bbox,n=r.getLeft()-110,o=r.getTop()-101,i=r.getRight()+131,h=r.getBottom()+120;let l=0,a=0,c=0,g=0,_=0,p=0,f=0,u=0;n<t?(l=n,c=t):(l=t,c=n),o<s?(a=o,g=s):(a=s,g=o),i<t?(_=i,f=t):(_=t,f=i),h<s?(p=h,u=s):(p=s,u=h);let C=0,A=0;for(let r=0,d=e.length;r<d;r+=2){const b=(r+2)%d,P=e[r],m=e[r+1],x=e[b],B=e[b+1];C3.segmentsIntersectPreCalc(n,o,t,s,l,c,a,g,P,m,x,B)&&++C,C3.segmentsIntersectPreCalc(i,h,t,s,_,f,p,u,P,m,x,B)&&++A}return C%2==1||A%2==1}intersectsPoly(t,s,e){const r=t._ptsArr,n=this._ptsArr;if(this.containsPoint(r[0]+s,r[1]+e))return!0;if(t.containsPoint(n[0]-s,n[1]-e))return!0;for(let t=0,o=n.length;t<o;t+=2){const i=(t+2)%o,h=n[t],l=n[t+1],a=n[i],c=n[i+1];let g=0,_=0,p=0,f=0;h<a?(g=h,p=a):(g=a,p=h),l<c?(_=l,f=c):(_=c,f=l);for(let t=0,n=r.length;t<n;t+=2){const o=(t+2)%n,i=r[t]+s,u=r[t+1]+e,C=r[o]+s,A=r[o+1]+e;if(C3.segmentsIntersectPreCalc(h,l,a,c,g,p,_,f,i,u,C,A))return!0}}return!1}intersectsSegment(t,s,e,r,n,o){if(this.containsPoint(e-t,r-s))return!0;if(this.containsPoint(n-t,o-s))return!0;let i=0,h=0,l=0,a=0;e<n?(i=e,l=n):(i=n,l=e),r<o?(h=r,a=o):(h=o,a=r);const c=this._ptsArr;for(let g=0,_=c.length;g<_;g+=2){const p=(g+2)%_,f=c[g]+t,u=c[g+1]+s,C=c[p]+t,A=c[p+1]+s;if(C3.segmentsIntersectPreCalc(e,r,n,o,i,l,h,a,f,u,C,A))return!0}return!1}mirror(t){const s=this._ptsArr;for(let e=0,r=s.length;e<r;e+=2)s[e]=2*t-s[e];this._isBboxChanged=!0}flip(t){const s=this._ptsArr;for(let e=0,r=s.length;e<r;e+=2){const r=e+1;s[r]=2*t-s[r]}this._isBboxChanged=!0}diag(){const t=this._ptsArr;for(let s=0,e=t.length;s<e;s+=2){const e=s+1,r=t[s];t[s]=t[e],t[e]=r}this._isBboxChanged=!0}GetMidX(){const t=this._ptsArr;let s=0;for(let e=0,r=t.length;e<r;e+=2)s+=t[e];return s/this.pointCount()}GetMidY(){const t=this._ptsArr;let s=0;for(let e=0,r=t.length;e<r;e+=2)s+=t[e+1];return s/this.pointCount()}GetPointsArray(){return this._ptsArr}GetPointCount(){return this.pointCount()}IsEnabled(){return this._enabled}}; } // lib/misc/pairMap.js { const C3=self.C3;C3.PairMap=class extends C3.DefendedBase{constructor(e){if(super(),this._firstMap=new Map,e)for(const[t,s,r]of e)this.Set(t,s,r)}Release(){this.Clear(),this._firstMap=null}IsEmpty(){return 0===this._firstMap.size}Clear(){const e=this._firstMap;for(const t of e.values())t.clear();e.clear()}Set(e,t,s){const r=this._firstMap;let i=r.get(e);i||(i=new Map,r.set(e,i)),i.set(t,s)}Get(e,t){const s=this._firstMap.get(e);return s?s.get(t):s}Has(e,t){const s=this._firstMap.get(e);return!!s&&s.has(t)}Delete(e,t){const s=this._firstMap,r=s.get(e);if(!r)return!1;const i=r.delete(t);return i&&0===r.size&&s.delete(e),i}DeleteEither(e){const t=this._firstMap,s=t.get(e);s&&(s.clear(),t.delete(e));for(const[s,r]of t.entries())r.delete(e)&&0===r.size&&t.delete(s)}GetSize(){let e=0;for(const t of this._firstMap.values())e+=t.size;return e}*values(){for(const e of this._firstMap.values())yield*e.values()}*keyPairs(){for(const[e,t]of this._firstMap.entries())for(const s of t.keys())yield[e,s]}*entries(){for(const[e,t]of this._firstMap.entries())for(const[s,r]of t.entries())yield[e,s,r]}}; } // lib/misc/arraySet.js { const C3=self.C3;C3.ArraySet=class extends C3.DefendedBase{constructor(){super(),this._set=new Set,this._arr=[],this._needToRebuildArray=!1}Release(){this.Clear()}Clear(){this._set.clear(),C3.clearArray(this._arr),this._needToRebuildArray=!1}Add(e){this._set.has(e)||(this._set.add(e),this._needToRebuildArray||this._arr.push(e))}Has(e){return this._set.has(e)}Delete(e){this._set.delete(e)&&(this._needToRebuildArray=!0)}GetSize(){return this._set.size}IsEmpty(){return 0===this._set.size}GetArray(){return this._needToRebuildArray&&(this._RebuildArray(),this._needToRebuildArray=!1),this._arr}_RebuildArray(){const e=this._arr;C3.clearArray(e);for(const r of this._set)e.push(r)}}; } // ../lib/misc/ease.js { const C3=self.C3,EASE_MAP=new Map,PREDEFINED_EASE_MAP=new Map,CUSTOM_EASE_EDITOR_MAP=new Map,CUSTOM_EASE_DATA_EDITOR_MAP=new Map,CUSTOM_EASE_RUNTIME_MAP=new Map,CUSTOM_EASE_DATA_RUNTIME_MAP=new Map,PR … [Строка слишком длинная. Вы можете скачать файл] } // ../lib/misc/probability.js { const C3=self.C3;function RequireStringOrNumber(t){C3.IsString(t)}C3.ProbabilityTable=class{constructor(t){this._items=[],this._name=t||"",this._totalWeight=0}Release(){this.Clear(),this._items=null}GetName(){return this._name}Clear(){C3.clear2DArray(this._items),this._totalWeight=0}GetTotalWeight(){return this._totalWeight}Sample(t=Math.random()*this.GetTotalWeight()){let e=0;for(const[i,s]of this._items)if(e+=i,t<e)return s;return 0}HasItems(){return!!this._items.length}AddItem(t,e){RequireStringOrNumber(e),this._totalWeight+=t,this._items.push([t,e])}RemoveItem(t,e){RequireStringOrNumber(e);const i=0===t;for(let s=0;s<this._items.length;s++){const r=this._items[s],h=i||r[0]===t,n=r[1]===e;if(h&&n){this._items.splice(s,1),this._totalWeight-=r[0];break}}}asJSON(){return JSON.stringify(this._items)}static fromJSON(t,e){const i=new C3.ProbabilityTable(e),s=JSON.parse(t);for(const t of s){const e=t[0],s=t[1];i.AddItem(e,s)}return i}}; } // lib/misc/screenReaderText.js { const C3=self.C3;let nextId=0;C3.ScreenReaderText=class{constructor(t,e){this._runtime=t,this._text=e,this._id=nextId++,this._runtime.PostComponentMessageToDOM("runtime","screen-reader-text",{"type":"create","id":this._id,"text":this._text})}Release(){this._runtime.PostComponentMessageToDOM("runtime","screen-reader-text",{"type":"release","id":this._id}),this._runtime=null,this._text="",this._id=-1}SetText(t){this._text!==t&&(this._text=t,this._runtime.PostComponentMessageToDOM("runtime","screen-reader-text",{"type":"update","id":this._id,"text":this._text}))}}; } // ../lib/events/event.js { const C3=self.C3;C3.Event=class{constructor(t,e){this.type=t,this.cancelable=!!e,this.defaultPrevented=!1,this.propagationStopped=!1,this.isAsync=!1}preventDefault(){if(!this.cancelable)throw new Error(`event '${this.type}' is not cancelable`);this.defaultPrevented=!0}stopPropagation(){if(!this.cancelable)throw new Error(`event '${this.type}' cannot be stopped`);if(this.isAsync)throw new Error(`cannot stop async event '${this.type}' propagation`);this.propagationStopped=!0}}; } // ../lib/events/handler.js { const C3=self.C3,assert=self.assert;C3.Event.Handler=class extends C3.DefendedBase{#e=null;#s=null;#t=0;#i=null;constructor(){super()}Release(){this.#t>0||(this.#e&&(this.#e.clear(),this.#e=null),this.#s&&(this.#s.clear(),this.#s=null),this.#i&&(C3.clearArray(this.#i),this.#i=null),C3.Release(this))}_AddListener(e,s){if(this.#r())return this.#i||(this.#i=[]),void this.#i.push({op:"add",func:e,capture:s});s?(this.#e||(this.#e=new Set),this.#e.add(e)):(this.#s||(this.#s=new Set),this.#s.add(e))}_RemoveListener(e,s){if(this.#r())return this.#i||(this.#i=[]),void this.#i.push({op:"remove",func:e,capture:s});s?this.#e&&(this.#e.delete(e),0===this.#e.size&&(this.#e=null)):this.#s&&(this.#s.delete(e),0===this.#s.size&&(this.#s=null))}_IsEmpty(){return!this.#e&&!this.#s}#r(){return this.#t>0}#n(){if(this.#i){for(const e of this.#i)if("add"===e.op)this._AddListener(e.func,e.capture);else{if("remove"!==e.op)throw new Error("invalid op");this._RemoveListener(e.func,e.capture)}C3.clearArray(this.#i),this.#i=null}}_FireCancellable(e){this.#h();let s=!1;if(this.#e)for(const t of this.#e)if(t(e),e.propagationStopped){s=!0;break}if(!s&&this.#s)for(const s of this.#s)if(s(e),e.propagationStopped)break;return this.#o(),!e.defaultPrevented}_FireNonCancellable(e){if(this.#h(),this.#e)for(const s of this.#e)s(e);if(this.#s)for(const s of this.#s)s(e);return this.#o(),!0}#h(){this.#t++}#o(){this.#t--,0===this.#t&&this.#i&&this.#i.length>0&&this.#n()}SetDelayRemoveEventsEnabled(e){e?this.#h():this.#o()}_FireAsync(e){let s=[];if(this.#e)for(const t of this.#e)s.push(C3.Asyncify(()=>t(e)));if(this.#s)for(const t of this.#s)s.push(C3.Asyncify(()=>t(e)));return Promise.all(s).then(()=>!e.defaultPrevented)}_FireAndWait_AsyncOptional(e){const s=[];if(this.#h(),this.#e)for(const t of this.#e){const i=t(e);i instanceof Promise&&s.push(i)}if(this.#s)for(const t of this.#s){const i=t(e);i instanceof Promise&&s.push(i)}return this.#o(),s.length?Promise.all(s).then(()=>!e.defaultPrevented):!e.defaultPrevented}async _FireAndWaitAsync(e){return await this._FireAndWait_AsyncOptional(e)}async _FireAndWaitAsyncSequential(e){if(this.#h(),this.#e)for(const s of this.#e){const t=s(e);t instanceof Promise&&await t}if(this.#s)for(const s of this.#s){const t=s(e);t instanceof Promise&&await t}return this.#o(),!e.defaultPrevented}*_FireAsGenerator(e){if(this.#h(),this.#e)for(const s of this.#e){const t=s(e);C3.IsIterator(t)&&(yield*t)}if(this.#s)for(const s of this.#s){const t=s(e);C3.IsIterator(t)&&(yield*t)}this.#o()}}; } // ../lib/events/dispatcher.js { const C3=self.C3,releasedDispatchers=new WeakSet;C3.Event.Dispatcher=class extends C3.DefendedBase{#e=null;constructor(){super()}Release(){if(releasedDispatchers.has(this))throw new Error("already released");this.ClearEvents(),releasedDispatchers.add(this),C3.Release(this)}WasReleased(){return releasedDispatchers.has(this)}ClearEvents(){if(this.#e){for(const e of this.#e.values())e.Release();this.#e.clear(),this.#e=null}}_GetHandlerByType(e,t){if(this.#e){const t=this.#e.get(e);if(t)return t}if(t){const t=C3.New(C3.Event.Handler);return this.#e||(this.#e=new Map),this.#e.set(e,t),t}return null}HasAnyHandlerFor(e){return this.#e&&this.#e.has(e)}addEventListener(e,t,n){this._GetHandlerByType(e,!0)._AddListener(t,!!n)}removeEventListener(e,t,n){const s=this._GetHandlerByType(e,!1);s&&(s._RemoveListener(t,!!n),this.#e&&s._IsEmpty()&&this.#e.delete(e))}dispatchEvent(e){const t=this._GetHandlerByType(e.type,!1);return!t||(e.cancelable?t._FireCancellable(e):t._FireNonCancellable(e))}dispatchEventAsync(e){const t=this._GetHandlerByType(e.type,!1);return t?(e.isAsync=!0,t._FireAsync(e)):Promise.resolve(!0)}async dispatchEventAndClearAsync(e){const t=this._GetHandlerByType(e.type,!1);if(!t)return!0;this.#e&&this.#e.delete(e.type),e.isAsync=!0;const n=await t._FireAsync(e);return t.Release(),n}async dispatchEventAndWaitAsync(e){const t=this._GetHandlerByType(e.type,!1);return!t||await t._FireAndWaitAsync(e)}dispatchEventAndWait_AsyncOptional(e){const t=this._GetHandlerByType(e.type,!1);return!t||t._FireAndWait_AsyncOptional(e)}async dispatchEventAndWaitAsyncSequential(e){const t=this._GetHandlerByType(e.type,!1);return!t||await t._FireAndWaitAsyncSequential(e)}dispatchGeneratorEvent(e){const t=this._GetHandlerByType(e.type,!1);if(!t)return null;if(e.cancelable)throw new Error("not supported");return t._FireAsGenerator(e)}SetDelayRemoveEventsEnabled(e){if(this.#e)for(const t of this.#e.values())t.SetDelayRemoveEventsEnabled(e)}}; } // ../lib/util/asyncify.js { const C3=self.C3,SETTIMEOUT_WORK_DURATION=12,SETTIMEOUT_INTERVAL=16,IDLECALLBACK_TIMEOUT=35,SUPPORTS_RIC="undefined"!=typeof requestIdleCallback;let workQueue=[],callbackId=-1,highThroughputMode=0;function SetNewCallback(e){callbackId=SUPPORTS_RIC&&0===highThroughputMode?requestIdleCallback(DoAsyncifiedWork,{timeout:35}):setTimeout(DoAsyncifiedWork,highThroughputMode>0?1:e)}function DoAsyncifiedWork(e){if(callbackId=-1,!workQueue.length)return;let o=performance.now(),i=o,t=0,n=0;do{DoNextAsyncifiedJob(workQueue.shift()),i=performance.now(),++t,n=(i-o)/t*1.1}while(workQueue.length&&(SUPPORTS_RIC&&0===highThroughputMode&&void 0!==e?n<e["timeRemaining"]():i-o+n<12));if(-1===callbackId&&workQueue.length){let e=i-o;SetNewCallback(Math.max(16-e,4))}}function DoNextAsyncifiedJob(e){let o;try{o=e.func()}catch(o){return void e.reject(o)}e.resolve(o)}let asyncifyDisabled=C3.QueryString.Has("disable-asyncify");asyncifyDisabled&&console.warn("[Asyncify] Asyncify has been disabled due to disable-asyncify in the query string. Some work will now be done synchronously."),C3.Asyncify=function(e){let o=null;return C3.isDebug&&(o=C3.GetCallStack()),new Promise((i,t)=>{workQueue.push({func:e,resolve:i,reject:t,stack:o}),asyncifyDisabled?DoNextAsyncifiedJob(workQueue.pop()):-1===callbackId&&SetNewCallback(16)})},C3.Asyncify.SetHighThroughputMode=function(e){if(e)++highThroughputMode;else if(--highThroughputMode,highThroughputMode<0)throw new Error("already turned off high throughput mode")}; } // ../lib/util/idleTimeout.js { const C3=self.C3,IDLE_CHECK_MIN_INTERVAL=1e3,IDLE_CHECK_TIMER_OVERSHOOT=100;let cachedNowTime=-1;function ClearTimeCache(){cachedNowTime=-1}C3.FastGetDateNow=function(){return-1===cachedNowTime&&(cachedNowTime=Date.now(),self.setTimeout(ClearTimeCache,16)),cachedNowTime};let timerId=-1,nextDeadline=-1,activeIdleTimeouts=new Set;function CheckActiveIdleTimeouts(){timerId=-1,nextDeadline=-1;let e=Date.now();for(let t of activeIdleTimeouts)if(t._CheckTimeout(e)){let e=t._GetDeadline();(-1===nextDeadline||e<nextDeadline)&&(nextDeadline=e)}else activeIdleTimeouts.delete(t);if(-1!==nextDeadline){let t=Math.max(nextDeadline-e+100,1e3);timerId=self.setTimeout(CheckActiveIdleTimeouts,t)}}C3.IdleTimeout=class{constructor(e,t){this._callback=e,this._timeout=1e3*t,this._deadline=0,this._isActive=!1}Reset(){let e=C3.FastGetDateNow();this._deadline=e+this._timeout,this._isActive||(activeIdleTimeouts.add(this),this._isActive=!0),-1===timerId?(nextDeadline=this._deadline,timerId=self.setTimeout(CheckActiveIdleTimeouts,this._timeout+100)):this._deadline<nextDeadline&&nextDeadline>e+1e3&&(self.clearTimeout(timerId),nextDeadline=this._deadline,timerId=self.setTimeout(CheckActiveIdleTimeouts,this._timeout+100))}_CheckTimeout(e){return!(e>=this._deadline)||(this._callback()?(this._deadline=e+this._timeout,!0):(this._isActive=!1,!1))}_GetDeadline(){return this._deadline}Cancel(){this._isActive&&(activeIdleTimeouts.delete(this),this._isActive=!1,0===activeIdleTimeouts.size&&-1!==timerId&&(self.clearTimeout(timerId),timerId=-1,nextDeadline=-1))}Release(){this.Cancel(),this._callback=null}}; } // ../lib/util/disposable.js { const C3=self.C3,disposedDisposables=new WeakSet;C3.Disposable=class s{constructor(s){this._disposeAction=s}Dispose(){disposedDisposables.has(this)||(disposedDisposables.add(this),this._disposeAction&&(this._disposeAction(),this._disposeAction=null))}IsDisposed(){return disposedDisposables.has(this)}Release(){this.Dispose()}static Release(e){return new s(()=>e.Release())}static From(s,e,i,o,t){if("string"!=typeof e&&!Array.isArray(e))throw new TypeError("expected string or array");if(null==o)o=!1;else if("boolean"!=typeof o&&"object"!=typeof o)throw new TypeError("invalid event listener options");if(t&&(i=i.bind(t)),Array.isArray(e)||e.includes(" ")){"string"==typeof e&&(e=e.split(" "));const t=new C3.CompositeDisposable;for(const r of e)s.addEventListener(r,i,o),t.Add(C3.New(C3.Disposable,()=>s.removeEventListener(r,i,o)));return t}return s.addEventListener(e,i,o),C3.New(C3.Disposable,()=>s.removeEventListener(e,i,o))}},C3.StubDisposable=class extends C3.Disposable{SetAction(s){this._disposeAction=s}},C3.CompositeDisposable=class extends C3.Disposable{constructor(...s){super(),this._disposables=new Set;for(const e of s)this.Add(e)}Add(...s){if(this.IsDisposed())throw new Error("already disposed");for(const e of s)this._disposables.add(e)}Remove(s){if(this.IsDisposed())throw new Error("already disposed");this._disposables.delete(s)}RemoveAll(){if(this.IsDisposed())throw new Error("already disposed");if(this._disposables){for(const s of this._disposables)s.Dispose();this._disposables.clear()}}Dispose(){if(this.IsDisposed())throw new Error("already disposed");super.Dispose();for(const s of this._disposables)s.Dispose();this._disposables.clear(),this._disposables=null}}; } // lib/util/kahanSum.js { const C3=self.C3;C3.KahanSum=class extends C3.DefendedBase{constructor(){super(),this._c=0,this._y=0,this._t=0,this._sum=0}Add(s){s=+s,this._y=s-this._c,this._t=this._sum+this._y,this._c=this._t-this._sum-this._y,this._sum=this._t}Subtract(s){this._sum-=+s}Get(){return this._sum}Reset(){this._c=0,this._y=0,this._t=0,this._sum=0}Set(s){this._c=0,this._y=0,this._t=0,this._sum=+s}Copy(s){this._c=s._c,this._y=s._y,this._t=s._t,this._sum=s._sum}Release(){}}; } // lib/util/redblackset.js { const C3=self.C3,js_cols={},RED=!0,BLACK=!1;js_cols.RBnode=function(t){this.tree=t,this.right=this.tree.sentinel,this.left=this.tree.sentinel,this.parent=null,this.color=!1,this.key=null},js_cols.RedB … [Строка слишком длинная. Вы можете скачать файл] } // ../lib/util/promiseThrottle.js { const C3=self.C3;C3.PromiseThrottle=class{constructor(e=C3.hardwareConcurrency){this._maxParallel=e,this._queue=[],this._activeCount=0}Add(e,t){return new Promise((r,n)=>{const s={func:e,resolve:r,reject:n,opts:t};t?.signal&&t.signal.aborted?n(new Error("abort")):(t?.signal&&(s.onabort=()=>{const e=this._queue.indexOf(s);-1!==e&&(this._queue.splice(e,1),n(new Error("abort")))},t.signal.addEventListener("abort",s.onabort)),this._queue.push(s),this._MaybeStartNext())})}_FindInQueue(e){for(let t=0,r=this._queue.length;t<r;++t)if(this._queue[t].func===e)return t;return-1}RemoveAndResolve(e,t){const r=this._FindInQueue(e);if(-1===r)throw new Error("cannot find promise to resolve");this._queue[r].resolve(t),this._queue.splice(r,1)}RemoveAndReject(e,t){const r=this._FindInQueue(e);if(-1===r)throw new Error("cannot find promise to reject");this._queue[r].reject(t),this._queue.splice(r,1)}async _MaybeStartNext(){if(!this._queue.length)return;if(this._activeCount>=this._maxParallel)return;this._activeCount++;const e=this._queue.shift();e.opts?.signal&&e.onabort&&e.opts.signal.removeEventListener("abort",e.onabort);try{const t=await e.func();e.resolve(t)}catch(t){e.reject(t)}this._activeCount--,this._MaybeStartNext()}}; } // ../lib/util/rateLimiter.js { const C3=self.C3;C3.RateLimiter=class{constructor(t,e,i){this._callback=t,this._interval=e,this._intervalOnBattery=i||2*e,this._timerId=-1,this._lastCallTime=-1/0,this._timerCallFunc=()=>this._OnTimer(),this._ignoreReset=!1,this._canRunImmediate=!1,this._callbackArguments=null}SetCanRunImmediate(t){this._canRunImmediate=!!t}_GetInterval(){return void 0!==C3.Battery&&C3.Battery.IsOnBatteryPower()?this._intervalOnBattery:this._interval}Call(...t){if(-1!==this._timerId)return;this._callbackArguments=t;let e=C3.FastGetDateNow(),i=e-this._lastCallTime,l=this._GetInterval();i>=l&&this._canRunImmediate?(this._lastCallTime=e,this._RunCallback()):this._timerId=self.setTimeout(this._timerCallFunc,Math.max(l-i,4))}_RunCallback(){this._ignoreReset=!0;const t=this._callbackArguments;this._callbackArguments=null,t?this._callback(...t):this._callback(),this._ignoreReset=!1}Reset(){this._ignoreReset||(this._CancelTimer(),this._callbackArguments=null,this._lastCallTime=C3.FastGetDateNow())}_OnTimer(){this._timerId=-1,this._lastCallTime=C3.FastGetDateNow(),this._RunCallback()}_CancelTimer(){-1!==this._timerId&&(self.clearTimeout(this._timerId),this._timerId=-1)}Release(){this._CancelTimer(),this._callback=null,this._callbackArguments=null,this._timerCallFunc=null}}; } // ../lib/util/svgRaster/svgRasterManager.js { const C3=self.C3;C3.SVGRasterManager=class{constructor(){this._images=new Map,this._allowNpotSurfaces=!1,this._getBaseSizeCallback=null,this._rasterAtSizeCallback=null,this._releaseResultCallback=null,this._redrawCallback=null}SetNpotSurfaceAllowed(e){this._allowNpotSurfaces=!!e}IsNpotSurfaceAllowed(){return this._allowNpotSurfaces}SetGetBaseSizeCallback(e){this._getBaseSizeCallback=e}GetBaseSize(e){if(!this._getBaseSizeCallback)throw new Error("no get base size callback set");return this._getBaseSizeCallback(e)}SetRasterAtSizeCallback(e){this._rasterAtSizeCallback=e}RasterAtSize(e,a,t,l,s,r){if(!this._rasterAtSizeCallback)throw new Error("no raster at size callback set");return this._rasterAtSizeCallback(e,a,t,l,s,r)}SetReleaseResultCallback(e){this._releaseResultCallback=e}ReleaseResult(e){if(!this._releaseResultCallback)throw new Error("no release result callback set");this._releaseResultCallback(e)}SetRedrawCallback(e){this._redrawCallback=e}Redraw(){if(!this._redrawCallback)throw new Error("no redraw callback set");this._redrawCallback()}AddImage(e){let a=this._images.get(e);return a||(a=C3.New(C3.SVGRasterImage,this,e),this._images.set(e,a)),a.IncReference(),a}_RemoveImage(e){this._images.delete(e.GetDataSource())}OnTexturesChanged(){for(const e of this._images.values())e.ReleaseRasterizedResult(),e.ForceRasterAgain()}}; } // ../lib/util/svgRaster/svgRasterImage.js { const C3=self.C3,MAX_SURFACE_SIZE=4096;C3.SVGRasterImage=class{constructor(e,t){this._manager=e,this._dataSource=t,this._refCount=0,this._baseWidth=0,this._baseHeight=0,this._getBaseSizePromise=this._manager.GetBaseSize(t).then(e=>{this._manager&&(this._baseWidth=e[0],this._baseHeight=e[1],this._manager.Redraw())}).catch(e=>{console.error("[SVG] Error loading SVG: ",e),this._hadError=!0,this._manager&&this._manager.Redraw()}),this._rasterSurfaceWidth=0,this._rasterSurfaceHeight=0,this._rasterImageWidth=0,this._rasterImageHeight=0,this._isRasterizing=!1,this._rasterizedResult=null,this._forceRaster=!1,this._hadError=!1}Release(){if(this._refCount<=0)throw new Error("already released");this._refCount--,0===this._refCount&&this._Release()}ReleaseRasterizedResult(){this._rasterizedResult&&(this._manager.ReleaseResult(this._rasterizedResult),this._rasterizedResult=null)}_Release(){this.ReleaseRasterizedResult(),this._manager._RemoveImage(this),this._manager=null}GetDataSource(){return this._dataSource}IncReference(){this._refCount++}HasReferences(){return this._refCount>0}GetRasterizedResult(){return this._rasterizedResult}ForceRasterAgain(){this._forceRaster=!0}async StartRasterForSize(e,t,r){if(0===t||0===r||this._hadError)return;if(this._isRasterizing)return;let s=C3.nextHighestPowerOfTwo(Math.ceil(t)),a=C3.nextHighestPowerOfTwo(Math.ceil(r));const i=Math.max(s,a);if(i>4096){const e=4096/i;t*=e,r*=e,s=Math.min(Math.ceil(s*e),4096),a=Math.min(Math.ceil(a*e),4096)}if(t<s&&r<a){const e=t/r;s/a>e?(t=a*e,r=a):(t=s,r=s/e)}if(this._manager.IsNpotSurfaceAllowed()&&(s=Math.ceil(t),a=Math.ceil(r)),s<=this._rasterSurfaceWidth&&a<=this._rasterSurfaceHeight&&!this._forceRaster)return;this._isRasterizing=!0,this._rasterSurfaceWidth=s,this._rasterSurfaceHeight=a;const h=await this._manager.RasterAtSize(this._dataSource,e,this._rasterSurfaceWidth,this._rasterSurfaceHeight,t,r);this._manager&&(this.ReleaseRasterizedResult(),this._rasterizedResult=h,this._rasterImageWidth=t,this._rasterImageHeight=r,this._isRasterizing=!1,this._forceRaster=!1,this._manager.Redraw())}WhenBaseSizeReady(){return this._getBaseSizePromise}GetBaseWidth(){return this._baseWidth}GetBaseHeight(){return this._baseHeight}GetRasterWidth(){return this._rasterImageWidth}GetRasterHeight(){return this._rasterImageHeight}HadError(){return this._hadError}}; } // ../lib/str/str.js { const C3=self.C3;C3.UTF8_BOM="\ufeff";const NUMERIC_CHARS=new Set("0123456789");C3.IsNumericChar=function(t){return NUMERIC_CHARS.has(t)};const WHITESPACE_CHARS=new Set(" \t\n\r \u2028\u2029 ");C3.IsWhitespaceChar=function(t){return WHITESPACE_CHARS.has(t)},C3.FilterWhitespace=function(t){return[...t].filter(t=>!C3.IsWhitespaceChar(t)).join("")},C3.IsStringAllWhitespace=function(t){for(const e of t)if(!C3.IsWhitespaceChar(e))return!1;return!0},C3.IsCharArrayAllWhitespace=function(t){for(const e of t)if(!C3.IsWhitespaceChar(e))return!1;return!0},C3.IsUnprintableChar=function(t){return 1===t.length&&t.charCodeAt(0)<32},C3.FilterUnprintableChars=function(t){return[...t].filter(t=>!C3.IsUnprintableChar(t)).join("")};let cjkPunctuationRegex=null;try{cjkPunctuationRegex=new RegExp("\\p{P}(?<=[\\u3000-\\u303F\\uFF00-\\uFFEF])","u")}catch(t){console.warn("Unable to detect CJK punctuation: ",t)}C3.IsCJKPunctuationChar=function(t){return!C3.IsWhitespaceChar(t)&&cjkPunctuationRegex&&cjkPunctuationRegex.test(t)};const NUMERIC_STRING_CHARS=new Set("0123456789.+-e");C3.IsStringNumber=function(t){if(!(t=t.trim()).length)return!1;let e=t.charAt(0);if("-"!==e&&!NUMERIC_CHARS.has(e))return!1;for(let e of t)if(!NUMERIC_STRING_CHARS.has(e))return!1;return!0},C3.RemoveTrailingDigits=function(t){let e=t.length;for(;e>0;){let n=t.charAt(e-1);if(!C3.IsNumericChar(n))break;--e}return t.substr(0,e)},C3.IncrementNumberAtEndOf=function(t){let e=C3.RemoveTrailingDigits(t),n=t.substr(e.length);return n=n?(parseInt(n,10)+1).toString():"2",e+n};const HTML_ENTITY_MAP=new Map([["&","&"],["<","<"],[">",">"],['"',"""],["'","'"]]);function lookupHtmlEntity(t){return HTML_ENTITY_MAP.get(t)}const HTML_ENTITY_REGEX=/[&<>"']/g;C3.EscapeHTML=function(t){return t.replace(HTML_ENTITY_REGEX,lookupHtmlEntity)},C3.EscapeJS=function(t){let e=C3.ReplaceAll(t,"\\","\\\\");return e=C3.ReplaceAll(e,'"','\\"'),e=C3.ReplaceAll(e,"\t","\\t"),e=C3.ReplaceAll(e,"\r",""),C3.ReplaceAll(e,"\n","\\n")},C3.EscapeXML=function(t){let e=C3.ReplaceAll(t,"&","&");return e=C3.ReplaceAll(e,"<","<"),e=C3.ReplaceAll(e,">",">"),C3.ReplaceAll(e,'"',""")};const ESCAPE_REGEX=/[-[\]{}()*+?.,\\^$|#\s]/g;C3.EscapeRegex=function(t){return t.replace(ESCAPE_REGEX,"\\$&")},C3.CountCharsInString=function(t,e){let n=0;for(const r of t)r===e&&++n;return n},C3.StringPosToLineNumber=function(t,e){let n=0,r=0;for(;n<e;){if(n=t.indexOf("\n",n),-1===n)return r;r++,n++}return r},C3.FindAll=function(t,e,n=!1){if(!e)return[];n||(t=t.toLowerCase(),e=e.toLowerCase());const r=e.length;let o=0,i=0,l=[];for(;(i=t.indexOf(e,o))>-1;)l.push(i),o=i+r;return l},C3.ReplaceAll=function(t,e,n){return t.replaceAll(e,()=>n)},C3.ReplaceAllCaseInsensitive=function(t,e,n){return t.replace(new RegExp(C3.EscapeRegex(e),"gi"),()=>n)},C3.SetElementContent=function(t,e){"string"==typeof e?t.textContent=e:e.isPlainText()?t.textContent=e.toString():(t.innerHTML=e.toHTML(),e instanceof C3.BBString&&e.attachLinkHandlers(t))},C3.StringLikeEquals=function(t,e){return t instanceof C3.HtmlString||t instanceof C3.BBString?t.equals(e):e instanceof C3.HtmlString||e instanceof C3.BBString?e.equals(t):t===e},C3.StringSubstitute=function(t,...e){let n=t;for(let r=0,o=e.length;r<o;++r){const o=`{${r}}`;if(!t.includes(o))throw new Error(`missing placeholder '${o}' in string substitution`);n=n.replace(o,e[r].toString())}return n},C3.StringSubstituteAllowMissing=function(t,...e){let n=t,r=-1,o=-1;for(let i=0,l=e.length;i<l;++i){const l=`{${i}}`;t.includes(l)?(o=i,n=n.replace(l,e[i].toString())):-1===r&&(r=i)}if(r>=0&&o>=0&&r<o)throw new Error(`missing placeholder '${r}' in string substitution`);return n},C3.StringSubstituteMap=function(t,e){let n=t;for(let[t,r]of Object.entries(e))n=n.replaceAll(t,r.toString());return n},C3.SortAZ=function(t,e){return t>e?1:t<e?-1:0},C3.SortAZCaseInsensitive=function(t,e){let n=t.toLowerCase(),r=e.toLowerCase();return n>r?1:n<r?-1:0};const intlSegmenter=new self["Intl"]["Segmenter"];C3.SplitGraphemes=function(t){if(1===t.length)return[t];const e=[];for(const n of intlSegmenter["segment"](t))e.push(n["segment"]);return e},C3.IterateGraphemes=function*(t){for(const e of intlSegmenter["segment"](t))yield e["segment"]},C3.CountGraphemes=function(t){let e=0;for(const n of intlSegmenter["segment"](t))++e;return e};const KILOBYTE=1024,MEGABYTE=1048576,GIGABYTE=1073741824,TERABYTE=1099511627776;C3.FormatDataSize=function(t,e){let n="common."+(e?"dataRates":"dataSizes")+".";const r=self.langSub;if(t<1024)return r(n+"bytes",t);if(t<1048576){let e=t/1024;return e=e<10?Math.round(10*e)/10:Math.round(e),r(n+"kilobytes",e)}if(t<GIGABYTE){let e=t/1048576;return e=e<10?Math.round(10*e)/10:Math.round(e),r(n+"megabytes",e)}if(t<TERABYTE){let e=t/GIGABYTE;return e=e<10?Math.round(10*e)/10:Math.round(e),r(n+"gigabytes",e)}{let e=t/TERABYTE;return e=e<10?Math.round(10*e)/10:Math.round(e),r(n+"terabytes",e)}};const DEFAULT_FORMATTIME_OPTS={approximate:!1,days:!0,hours:!0,minutes:!0,seconds:!0};C3.FormatTime=function(t,e){e=Object.assign({},DEFAULT_FORMATTIME_OPTS,e),C3.Lang.PushContext("common.time");const n=[],r=self.lang,o=self.langPluralSub;if(e.days){const e=Math.floor(t/86400);e>0&&(t-=24*e*3600,n.push(o(".days",null,e)))}if(e.hours){const e=Math.floor(t/3600);(e>0||n.length)&&(t-=3600*e,n.push(o(".hours",null,e)))}if(e.minutes){const r=Math.floor(t/60);(r>0||n.length||!e.seconds)&&(t-=60*r,n.push(o(".minutes",null,r)))}if(e.seconds){const e=Math.floor(t%60);n.push(o(".seconds",null,e))}const i=(e.approximate?r(".approx-prefix"):"")+n.join(r(".separator"));return C3.Lang.PopContext(),i},C3.ZeroPad=function(t,e){let n=t<0?"-":"",r=(t=Math.abs(t)).toString(),o=e-r.length;for(let t=0;t<o;++t)n+="0";return n+r},C3.StringToTitleCase=function(t){return t.toLowerCase().replace(/\b\w/g,t=>t.toUpperCase())},C3.CompareVersionStrings=function(t,e){let n=t.split(".").map(t=>t.trim()),r=e.split(".").map(t=>t.trim());C3.resizeArray(n,4,"0"),C3.resizeArray(r,4,"0"),n=n.map(t=>parseInt(t,10)),r=r.map(t=>parseInt(t,10));for(let t=0;t<4;++t){const e=n[t]-r[t];if(0!==e)return e<0?-1:1}return 0},C3.CreateGUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.floor(16*Math.random());return("x"===t?e:3&e|8).toString(16)})},C3.StringHammingDistance=function(t,e){if(t.length!==e.length)throw new Error("strings must be same length");let n=0;for(let r=0,o=t.length;r<o;++r)t.charAt(r)!==e.charAt(r)&&++n;return n},C3.StringLevenshteinDistance=function(t,e){if(0===t.length)return e.length;if(0===e.length)return t.length;let n,r,o,i,l,s;for(t.length>e.length&&(n=t,t=e,e=n),s=Array(t.length+1),r=0;r<=t.length;r++)s[r]=r;for(r=1;r<=e.length;r++){for(i=r,o=1;o<=t.length;o++)l=e[r-1]===t[o-1]?s[o-1]:Math.min(s[o-1]+1,Math.min(i+1,s[o]+1)),s[o-1]=i,i=l;s[t.length]=i}return s[t.length]},C3.StringByteLengthAsUTF8=function(t){return(new TextEncoder).encode(t).length}; } // ../lib/str/bbstring.js { const C3=self.C3,assert=self.assert,BB_CODE_MAP=new Map([["b","strong"],["i","em"],["s","s"],["u","u"],["sub","sub"],["sup","sup"],["small","small"],["mark","mark"],["code","code"],["a1","a"],["a2","a"],["a3","a"],["a4","a"],["a5","a"],["a6","a"],["a7","a"],["a8","a"],["a9","a"],["tip1","abbr"],["tip2","abbr"],["tip3","abbr"],["tip4","abbr"],["tip5","abbr"],["tip6","abbr"],["tip7","abbr"],["tip8","abbr"],["tip9","abbr"],["bad",["span","bbCodeBad"]],["good",["span","bbCodeGood"]],["info",["span","bbCodeInfo"]],["h1",["span","bbCodeH1"]],["h2",["span","bbCodeH2"]],["h3",["span","bbCodeH3"]],["h4",["span","bbCodeH4"]],["item",["span","bbCodeItem"]]]),SELF_CLOSING_TAGS=new Set(["icon"]),BBREGEX=/\[(\/?)([a-zA-Z0-9]+)\]/g,CUSTOM_BBREGEX=/\[(\/?)([^\[\n]*?)\]/g;let linkActions=null,tipList=null,classIndex=0;function bbToHtmlReplacerFunc(t,s,i){const n=BB_CODE_MAP.get(i);if(!n)return"class"===i?s?"</span>":`<span class="bbclass${classIndex++}">`:t;if("string"==typeof n){if("a"===n&&0===linkActions.length||"abbr"===n&&0===tipList.length)return t;if("a"!==n||s){if("abbr"!==n||s)return"<"+s+n+">";{const t=parseInt(i.substring(3),10)-1;if(t<0||t>=tipList.length)throw new Error("invalid bbcode tip substitution");const s=tipList[t];let n="";if("string"==typeof s?n=s:"function"==typeof s&&(n=s()),"string"!=typeof n)throw new TypeError("invalid bbcode tip");return`<abbr title="${C3.ReplaceAll(n,'"',""")}">`}}{const t=parseInt(i.substring(1),10)-1;if(t<0||t>=linkActions.length)throw new Error("invalid bbcode link substitution");const s=linkActions[t];if("string"==typeof s)return`<a href="${linkActions[t]}">`;if("function"==typeof s)return`<a class="bblink${t}">`;throw new TypeError("invalid bbcode link action")}}if(Array.isArray(n)){let t=n[0],i=n[1];return s?"</"+t+">":`<${t} class="${i}">`}}const LINEBREAK_REGEX=/\n/g;C3.BBString=class{constructor(t,s){if(this._bbstr=s&&s.noEscape?t:C3.EscapeHTML(t),this._htmlstr="",this._convertLineBreaks=!1,this._linkActions=[],this._tipList=[],s){if(this._convertLineBreaks=!!s.convertLineBreaks,s.links){if(s.links.length>9)throw new Error("too many links");this._linkActions=s.links}if(s.tips){if(s.tips.length>9)throw new Error("too many tips");this._tipList=s.tips}}this._hasAnyBBtags=this._bbstr.includes("["),this._needsLineBreakConversion=this._convertLineBreaks&&this._bbstr.includes("\n"),this._isPlain=!this._hasAnyBBtags&&!this._needsLineBreakConversion&&!this._bbstr.includes("&"),this._hasParsedFragments=!1,this._fragments=[]}toString(){return this._bbstr}valueOf(){return this._bbstr}isPlainText(){return this._isPlain}toPlainText(){return this._hasAnyBBtags?this._bbstr.replace(BBREGEX,""):this._bbstr}toHTML(){if(this._isPlain)return this._bbstr;if(!this._htmlstr&&this._bbstr){let t=this._bbstr;this._hasAnyBBtags&&(classIndex=0,linkActions=this._linkActions,tipList=this._tipList,t=t.replace(BBREGEX,bbToHtmlReplacerFunc),linkActions=null,tipList=null),this._needsLineBreakConversion&&(t=t.replace(LINEBREAK_REGEX,"<br>")),this._htmlstr=t}return this._htmlstr}attachLinkHandlers(t){if(this._linkActions.length)for(let s=0,i=this._linkActions.length;s<i;++s){const i=this._linkActions[s];if("function"!=typeof i)continue;const n=t.querySelector(".bblink"+s);if(!n)throw new Error("unable to attach BBString link handler");n.onclick=i}}equals(t){return t instanceof C3.HtmlString?this.toHTML()===t.toHTML():t instanceof C3.BBString?this._bbstr===t._bbstr:this._bbstr===t}toFragmentList(){if(this._hasParsedFragments)return this._fragments;const t=[],s=this._bbstr,i=[];CUSTOM_BBREGEX.lastIndex=0;let n=0,e=null;for(;null!==(e=CUSTOM_BBREGEX.exec(s));){const r=e.index;if(r>0&&"\\"===s.charAt(r-1))continue;const a=e[0],o=e[1],l=e[2],b=s.substring(n,r);if(n=r+a.length,b&&t.push({text:b,styles:i.slice(0)}),l)if(o){const t=l.toLowerCase();for(let s=i.length-1;s>=0;--s)if(i[s].tag===t){i.splice(s,1);break}}else{let s=l,n=null;const e=l.indexOf("=");if(-1!==e?(s=l.substring(0,e).toLowerCase(),n=l.substring(e+1)):s=s.toLowerCase(),SELF_CLOSING_TAGS.has(s)){if("icon"!==s)throw new Error(`unknown self-closing tag ${s}`);t.push({icon:n,styles:i.slice(0)})}else i.push({tag:s,param:n})}}n<s.length&&t.push({text:s.substring(n),styles:i.slice(0)});for(const s of t)s.text&&(s.text=this._ProcessBBCodeEscapeSequences(s.text));return this._fragments=t.map(t=>t.icon?C3.New(C3.IconFragment,{icon:t.icon,styles:t.styles}):C3.New(C3.TextFragment,{chArr:C3.SplitGraphemes(t.text),styles:t.styles})),this._hasParsedFragments=!0,this._fragments}_ProcessBBCodeEscapeSequences(t){return t=C3.ReplaceAll(t,"\\[","["),C3.ReplaceAll(t,"\\\\","\\")}static StripTags(t){return C3.New(C3.BBString,t,{noEscape:!0}).toPlainText()}static StripAnyTags(t){return t.replace(CUSTOM_BBREGEX,"")}}; } // ../lib/str/textLayout/wordWrap.js { const C3=self.C3;function IsWordBreakWhiteSpace(t){return" "!==t&&" "!==t&&C3.IsWhitespaceChar(t)}const CJK_OPEN_PUNCTUATION=new Set("〈《「『【〔〖〘〚〝");function IsOpeningCJKPunctiationChar(t){return CJK_OPEN_PUNCTUATION.has(t)}function IsContinuingCJKPunctuationChar(t){return C3.IsCJKPunctuationChar(t)&&!IsOpeningCJKPunctiationChar(t)}function WordBreakTrimEnd(t){for(;t.length>0&&IsWordBreakWhiteSpace(t.at(-1));)t.pop()}function IsNewline(t){return"\n"===t||"\r\n"===t}class CurrentLineState{constructor(){this.fragments=[],this.width=0,this.height=0,this.fontBoundingBoxAscent=0,this.fontBoundingBoxDescent=0,this.topToAlphabeticDistance=0,this.isMeasured=!1}static FromSingleFragment(t,e,n,i,s,r){const h=new CurrentLineState;return h.fragments.push(t),h.width=e,h.height=n,h.fontBoundingBoxAscent=i,h.fontBoundingBoxDescent=s,h.topToAlphabeticDistance=r,h}Copy(t){this.fragments=t.fragments.map(t=>t._Clone()),this.width=t.width,this.height=t.height,this.fontBoundingBoxAscent=t.fontBoundingBoxAscent,this.fontBoundingBoxDescent=t.fontBoundingBoxDescent,this.topToAlphabeticDistance=t.topToAlphabeticDistance,this.isMeasured=t.isMeasured}Reset(){this.fragments=[],this.width=0,this.height=0,this.fontBoundingBoxAscent=0,this.fontBoundingBoxDescent=0,this.topToAlphabeticDistance=0,this.isMeasured=!1}SetMetrics(t,e){e||(this.width=t.width),this.height=t.height||0,this.fontBoundingBoxAscent=t.fontBoundingBoxAscent||0,this.fontBoundingBoxDescent=t.fontBoundingBoxDescent||0,this.topToAlphabeticDistance=t.topToAlphabeticDistance||0,this.isMeasured=!0}AddWord(t){const e=this.fragments.length?this.fragments.at(-1):null;let n=0;e&&e.IsText()&&t[0].IsText()&&t[0].GetStyles()===e.GetStyles()&&(e._Append(t[0].GetCharacterArray()),n=1);for(let e=t.length;n<e;++n){const e=t[n];this.fragments.push(e._Clone())}this.isMeasured=!1}}C3.WordWrap=class{constructor(){this._lines=[],this._iconSet=null,this._lastFitLineState=new CurrentLineState,this._tryLineState=new CurrentLineState,this._hitNewline=!1}GetLines(){return this._lines}GetLineCount(){return this._lines.length}SetIconSet(t){this._iconSet=t}WordWrap(t,e,n,i,s){if("string"==typeof t&&(t=[C3.New(C3.TextFragment,{chArr:C3.SplitGraphemes(t)})]),C3.clearArray(this._lines),!t.length||1===t.length&&t[0].IsText()&&t[0].IsEmpty()||n<2)return;if(1===t.length){const i=t[0];if(i.IsText()&&i.GetLength()<=100&&!i.HasNewLine()){let{width:t,height:r,fontBoundingBoxAscent:h,fontBoundingBoxDescent:o,topToAlphabeticDistance:a}=e(i);if(t+=s,i.SetWidth(t),i.SetHeight(r),i.SetFontBoundingBoxAscent(h||0),i.SetFontBoundingBoxDescent(o||0),i.SetTopToAlphabeticDistance(a||0),t<=n)return void this._AddLine(CurrentLineState.FromSingleFragment(i,t,r,h,o,a))}}let r,h=4;"word"===i?r=this._TokeniseByWord(t):"cjk"===i?(r=this._TokeniseByCJK(t),h=8):(r=this._TokeniseByChar(t),h=8),this._WrapText(r,e,n,h,s)}_TokeniseByWord(t){const e=[];let n=[],i=!1;for(const s of t){const t=s.GetStyles();if(s.IsIcon())n.length>0&&e.push(n),e.push([s]),n=[];else for(const r of s.GetCharacterArray())if(IsNewline(r))n.length>0&&e.push(n),e.push([C3.New(C3.TextFragment,{chArr:["\n"],styles:t})]),n=[];else if(0===n.length)n.push(C3.New(C3.TextFragment,{chArr:[r],styles:t})),i=IsWordBreakWhiteSpace(r);else{const s=IsWordBreakWhiteSpace(r);if(s===i){const e=n.at(-1);e.GetStyles()===t?e._AppendChar(r):n.push(C3.New(C3.TextFragment,{chArr:[r],styles:t}))}else e.push(n),n=[C3.New(C3.TextFragment,{chArr:[r],styles:t})],i=s}}return n.length>0&&e.push(n),e}_TokeniseByCJK(t){const e=[];let n=[],i=!1;for(const s of t){const t=s.GetStyles();if(s.IsIcon())n.length>0&&e.push(n),e.push([s]),n=[];else for(const r of s.GetCharacterArray())if(IsNewline(r))n.length>0&&e.push(n),e.push([C3.New(C3.TextFragment,{chArr:["\n"],styles:t})]),n=[];else if(0===n.length)n.push(C3.New(C3.TextFragment,{chArr:[r],styles:t})),i=IsOpeningCJKPunctiationChar(r);else if(i||IsContinuingCJKPunctuationChar(r)){const e=n.at(-1);e.GetStyles()===t?e._AppendChar(r):n.push(C3.New(C3.TextFragment,{chArr:[r],styles:t})),i=IsOpeningCJKPunctiationChar(r)}else e.push(n),n=[C3.New(C3.TextFragment,{chArr:[r],styles:t})],i=IsOpeningCJKPunctiationChar(r)}return n.length>0&&e.push(n),e}_TokeniseByChar(t){const e=[];for(const n of t)if(n.IsText()){const t=n.GetCharacterArray();C3.appendArray(e,t.map(t=>[C3.New(C3.TextFragment,{chArr:[t],styles:n.GetStyles()})]))}else e.push([n]);return e}_MeasureLine(t,e){let n=0,i=0,s=0,r=0,h=0;for(const o of t){if(-1===o.GetWidth()){const t=e(o);o.SetHeight(t.height),o.SetFontBoundingBoxAscent(t.fontBoundingBoxAscent||0),o.SetFontBoundingBoxDescent(t.fontBoundingBoxDescent||0),o.SetTopToAlphabeticDistance(t.topToAlphabeticDistance||0),o.IsText()?o.SetWidth(t.width):o.IsIcon()&&o.CalculateWidthFromHeight(this._iconSet)}n+=o.GetWidth(),i=Math.max(i,o.GetHeight()),s=Math.max(s,o.GetFontBoundingBoxAscent()),r=Math.max(r,o.GetFontBoundingBoxDescent()),h=Math.max(h,o.GetTopToAlphabeticDistance())}return{width:n,height:i,fontBoundingBoxAscent:s,fontBoundingBoxDescent:r,topToAlphabeticDistance:h}}_ResetLineStates(){this._lastFitLineState.Reset(),this._tryLineState.Reset()}_AddLine(t){this._lines.push(new C3.WordWrap.Line(t)),this._ResetLineStates()}_IsWordNewLine(t){return 1===t.length&&t[0].IsText()&&1===t[0].GetLength()&&IsNewline(t[0].GetCharacterArray()[0])}_IsWordWhitespace(t){return t[0].IsText()&&C3.IsCharArrayAllWhitespace(t[0].GetCharacterArray())}_WrapText(t,e,n,i,s){let r=0;for(;r<t.length;)r=this._WrapText_Chunk(t,r,e,n,i);if(this._tryLineState.fragments.length>0){if(!this._tryLineState.isMeasured){const t=this._MeasureLine(this._tryLineState.fragments,e);this._tryLineState.SetMetrics(t)}this._AddLine(this._tryLineState)}this._TrimLinesTrailingWhitespace(e,s),this._ResetLineStates(),this._hitNewline=!1}_WrapText_Chunk(t,e,n,i,s){const r=this._lastFitLineState,h=this._tryLineState,o=t[e];if(this._IsWordNewLine(o)){if(!h.isMeasured){const t=n(C3.New(C3.TextFragment,{chArr:[" "],styles:o[0].GetStyles()}));h.SetMetrics(t,!0)}return this._AddLine(h),e+1}const a=this._WrapText_CollectChunk(t,e,s),c=this._MeasureLine(h.fragments,n);return h.SetMetrics(c),c.width>=i?this._WrapText_RetryChunk(t,e,n,i):(r.Copy(h),this._hitNewline&&this._AddLine(r),a+1)}_WrapText_CollectChunk(t,e,n){const i=this._tryLineState;this._hitNewline=!1;let s=e,r=0;for(let e=t.length;s<e;++s){const e=t[s];if(this._IsWordNewLine(e)){this._hitNewline=!0;break}if(i.AddWord(e),!this._IsWordWhitespace(e)&&(++r,r===n))break}return s}_WrapText_RetryChunk(t,e,n,i){const s=this._lastFitLineState,r=this._tryLineState;r.Copy(s);let h=e;for(let e=t.length;h<e;++h){const o=t[h];if(this._IsWordNewLine(o))return this._AddLine(s),h+1;if(r.AddWord(o),!this._IsWordWhitespace(o)||0===s.fragments.length){const o=this._MeasureLine(r.fragments,n);if(r.SetMetrics(o),o.width>=i){let n;return s.fragments.length>0?n=s:(n=r,++h,h<e&&this._IsWordWhitespace(t[h])&&++h),this._AddLine(n),h}s.Copy(r)}}return h}_TrimLinesTrailingWhitespace(t,e){for(const n of this._lines){const i=n._GetFragmentsArray();if(!i.length)continue;let s=i.at(-1);if(s.IsText()){const r=s.GetCharacterArray(),h=r.slice(0);if(WordBreakTrimEnd(h),0===h.length)n.OffsetWidth(-s.GetWidth()),i.pop();else if(h.length<r.length){s.SetCharacterArray(h);const e=t(s).width,i=s.GetWidth()-e;s.SetWidth(e),n.OffsetWidth(-i)}0!==e&&i.length>0&&(s=i.at(-1),s.OffsetWidth(e),n.OffsetWidth(e))}}}Clear(){C3.clearArray(this._lines)}GetMaxLineWidth(){return this._lines.reduce((t,e)=>Math.max(t,e.GetWidth()),0)}GetTotalLineHeight(){return this._lines.reduce((t,e)=>t+e.GetHeight(),0)}}; } // ../lib/str/textLayout/line.js { const C3=self.C3;C3.WordWrap.Line=class{constructor(t){this._fragments=t.fragments,this._width=t.width,this._height=t.height,this._fontBoundingBoxAscent=t.fontBoundingBoxAscent,this._fontBoundingBoxDescent=t.fontBoundingBoxDescent,this._topToAlphabeticDistance=t.topToAlphabeticDistance,this._posX=0,this._posY=0}fragments(){return this._fragments.values()}*fragmentsReverse(){const t=this._fragments;for(let e=t.length-1;e>=0;--e)yield t[e]}_GetFragmentsArray(){return this._fragments}OffsetWidth(t){this._width+=t}GetWidth(){return this._width}GetHeight(){return this._height}GetFoundBoundingBoxAscent(){return this._fontBoundingBoxAscent}GetFontBoundingBoxDescent(){return this._fontBoundingBoxDescent}GetTopToAlphabeticDistance(){return this._topToAlphabeticDistance}SetPosX(t){this._posX=t}GetPosX(){return this._posX}SetPosY(t){this._posY=t}GetPosY(){return this._posY}}; } // ../lib/str/textLayout/fragmentBase.js { const C3=self.C3;C3.FragmentBase=class{constructor(t){this._styles=t.styles||[],this._width=t.width||-1,this._height=t.height||-1,this._fontBoundingBoxAscent=t.fontBoundingBoxAscent||-1,this._fontBoundingBoxDescent=t.fontBoundingBoxDescent||-1,this._topToAlphabeticDistance=t.topToAlphabeticDistance||-1,this._posX=0,this._posY=0}IsText(){return!1}IsIcon(){return!1}GetStyles(){return this._styles}GetStyleTag(t){const e=this._styles;for(let s=e.length-1;s>=0;--s){const n=e[s];if(n.tag===t)return n}return null}HasStyleTag(t){return!!this.GetStyleTag(t)}GetStyleMap(){const t=new Map;for(const e of this._styles)t.set(e.tag,e.param);return t}OffsetWidth(t){this._width+=t}SetWidth(t){this._width=t}GetWidth(){return this._width}SetHeight(t){this._height=t}GetHeight(){return this._height}SetFontBoundingBoxAscent(t){this._fontBoundingBoxAscent=t}GetFontBoundingBoxAscent(){return this._fontBoundingBoxAscent}SetFontBoundingBoxDescent(t){this._fontBoundingBoxDescent=t}GetFontBoundingBoxDescent(){return this._fontBoundingBoxDescent}SetTopToAlphabeticDistance(t){this._topToAlphabeticDistance=t}GetTopToAlphabeticDistance(){return this._topToAlphabeticDistance}SetPosX(t){this._posX=t}GetPosX(){return this._posX}SetPosY(t){this._posY=t}GetPosY(){return this._posY}}; } // ../lib/str/textLayout/textFragment.js { const C3=self.C3;C3.TextFragment=class extends C3.FragmentBase{constructor(t){super(t),this._chArr=t.chArr}IsText(){return!0}_Append(t){C3.appendArray(this._chArr,t),this._width=-1,this._height=-1,this._fontBoundingBoxAscent=-1,this._fontBoundingBoxDescent=-1,this._topToAlphabeticDistance=-1}_AppendChar(t){this._chArr.push(t)}_Clone(){return C3.New(C3.TextFragment,{chArr:this._chArr.slice(0),styles:this._styles,width:this._width,height:this._height,fontBoundingBoxAscent:this._fontBoundingBoxAscent,fontBoundingBoxDescent:this._fontBoundingBoxDescent,topToAlphabeticDistance:this._topToAlphabeticDistance})}GetCharacterArray(){return this._chArr}SetCharacterArray(t){this._chArr=t}GetLength(){return this._chArr.length}IsEmpty(){return 0===this._chArr.length}HasNewLine(){return this._chArr.includes("\n")}}; } // ../lib/str/textLayout/iconFragment.js { const C3=self.C3;C3.IconFragment=class extends C3.FragmentBase{constructor(t){super(t),this._icon=t.icon}IsIcon(){return!0}GetIconParameter(){return this._icon}_Clone(){return C3.New(C3.IconFragment,{icon:this._icon,styles:this._styles,width:this._width,height:this._height,fontBoundingBoxAscent:this._fontBoundingBoxAscent,fontBoundingBoxDescent:this._fontBoundingBoxDescent,topToAlphabeticDistance:this._topToAlphabeticDistance})}GetTextIcon(t){if(!t)return null;let e=Number(this._icon);return String(e)===this._icon?(e=Math.floor(e),t.GetTextIconByIndex(e)):t.GetTextIconByTag(this._icon)}CalculateWidthFromHeight(t){const e=this.GetTextIcon(t);this._width=e?this._height*e.GetWidth()/e.GetHeight():0}GetDrawable(t){const e=this.GetTextIcon(t);return e?e.GetDrawable():null}GetLength(){return 1}}; } // ../lib/str/textLayout/textIconManager.js { const C3=self.C3;C3.TextIconManager=class{constructor(t){this._iconSets=new Map,this._getIconSetMetaCallback=t.getIconSetMeta,this._getIconSetContentCallback=t.getIconSetContent}Release(){for(const t of this._iconSets.values())t.Release();this._iconSets.clear()}GetIconSet(t){let e=this._iconSets.get(t);if(e)return e;const n=this._getIconSetMetaCallback(t);return e=C3.New(C3.TextIconSet,this,{source:t,iconMeta:n}),this._iconSets.set(t,e),e}HasIconSet(t){return this._iconSets.has(t)}DeleteIconSet(t){const e=this._iconSets.get(t);e&&e.Release(),this._iconSets.delete(t)}async _GetIconSetContent(t){return await this._getIconSetContentCallback(t)}}; } // ../lib/str/textLayout/textIconSet.js { const C3=self.C3;C3.TextIconSet=class{constructor(t,s){this._textIconManager=t,this._source=s.source,this._iconsArray=[],this._iconsByTag=new Map,this._hasStartedLoad=!1,this._isLoading=!1,this._loadPromise=null;const o=s.iconMeta.icons;for(let t=0,s=o.length;t<s;++t){const s=o[t],e=C3.New(C3.TextIcon,this,{index:t,tag:s.tag,source:s.source,width:s.width,height:s.height});this._iconsArray.push(e),s.tag&&this._iconsByTag.set(s.tag.toLowerCase(),e)}}Release(){for(const t of this._iconsArray)t.Release();C3.clearArray(this._iconsArray),this._iconsByTag.clear(),this._textIconManager=null,this._source=null}HasLoaded(){return this._hasStartedLoad}IsLoading(){return this._isLoading}LoadContent(){return this._loadPromise||(this._loadPromise=this._DoLoadContent()),this._loadPromise}async _DoLoadContent(){if(this._hasStartedLoad)return;this._hasStartedLoad=!0,this._isLoading=!0;const t=await this._textIconManager._GetIconSetContent(this._source);if(!this._textIconManager)return;const s=t.icons;for(let t=0,o=Math.min(s.length,this._iconsArray.length);t<o;++t){const o=s[t].drawable;this._iconsArray[t]._SetDrawable(o)}this._isLoading=!1}GetTextIconByIndex(t){return(t=Math.floor(t))<0||t>=this._iconsArray.length?null:this._iconsArray[t]}GetTextIconByTag(t){return this._iconsByTag.get(t.toLowerCase())||null}}; } // ../lib/str/textLayout/textIcon.js { const C3=self.C3;C3.TextIcon=class{constructor(t,e){this._textIconSet=t,this._source=e.source||null,this._index=e.index,this._tag=e.tag,this._width=e.width,this._height=e.height,this._drawable=null}Release(){this._width=0,this._height=0,this._textIconSet=null}GetSource(){return this._source}GetWidth(){return this._width}GetHeight(){return this._height}_SetDrawable(t){this._drawable=t}GetDrawable(){return this._drawable}}; } // ../lib/gfx/gfx.js { const C3=self.C3,glMatrix=self.glMatrix,vec3=glMatrix.vec3,vec4=glMatrix.vec4,mat4=glMatrix.mat4,tempVec3a=vec3.create(),tempVec3b=vec3.create(),tempVec3c=vec3.create(),tempVec4=vec4.create(),tempMat4=mat4.create(),neartl=vec3.create(),neartr=vec3.create(),nearbl=vec3.create(),nearbr=vec3.create(),fartl=vec3.create(),fartr=vec3.create(),farbl=vec3.create(),farbr=vec3.create(),unitViewport=vec4.fromValues(0,0,1,1);C3.Gfx={Project(t,e,n,r,s,i,o){const c=r[0]*t+r[4]*e+r[8]*n+r[12],a=r[1]*t+r[5]*e+r[9]*n+r[13],P=r[2]*t+r[6]*e+r[10]*n+r[14],h=r[3]*t+r[7]*e+r[11]*n+r[15];let l=s[0]*c+s[4]*a+s[8]*P+s[12]*h,f=s[1]*c+s[5]*a+s[9]*P+s[13]*h,m=s[2]*c+s[6]*a+s[10]*P+s[14]*h,p=s[3]*c+s[7]*a+s[11]*P+s[15]*h;return 0!==p&&(p=1/p,l*=p,f*=p,m*=p,o[0]=(.5*l+.5)*i[2]+i[0],o[1]=(.5*f+.5)*i[3]+i[1],o[2]=.5*(1+m),!0)},Unproject(t,e,n,r,s,i,o){const c=tempMat4,a=tempVec4;return mat4.multiply(c,s,r),null!==mat4.invert(c,c)&&(vec4.set(a,(t-i[0])/i[2]*2-1,(e-i[1])/i[3]*2-1,2*n-1,1),vec4.transformMat4(a,a,c),0!==a[3]&&(a[3]=1/a[3],o[0]=a[0]*a[3],o[1]=a[1]*a[3],o[2]=a[2]*a[3],!0))},UnprojectToWorldRay:(t,e,n,r,s,i,o)=>!!C3.Gfx.Unproject(t,e,0,n,r,s,i)&&C3.Gfx.Unproject(t,e,1,n,r,s,o),UnprojectScreenToPlane(t,e,n,r,s,i,o){const c=tempVec3a,a=tempVec3b;if(!C3.Gfx.UnprojectToWorldRay(t,e,r,s,i,c,a))return!1;const P=n.segmentIntersection(c[0],c[1],c[2],a[0],a[1],a[2]);return null!==P&&(vec3.set(o,P[0],P[1],P[2]),!0)},UnprojectScreenToXYPlane:(t,e,n,r,s,i,o)=>(tempPlane.set(0,0,1,n),C3.Gfx.UnprojectScreenToPlane(t,e,tempPlane,r,s,i,o)),UnprojectScreenToYZPlane:(t,e,n,r,s,i,o)=>(tempPlane.set(1,0,0,n),C3.Gfx.UnprojectScreenToPlane(t,e,tempPlane,r,s,i,o)),UnprojectScreenToXZPlane:(t,e,n,r,s,i,o)=>(tempPlane.set(0,1,0,n),C3.Gfx.UnprojectScreenToPlane(t,e,tempPlane,r,s,i,o))};class Plane{#t=NaN;#e=NaN;#n=NaN;#r=NaN;#s=NaN;#i=NaN;#o=NaN;constructor(){}setFromPoints(t,e,n){const r=tempVec3c;vec3.subtract(tempVec3a,n,e),vec3.subtract(tempVec3b,t,e),vec3.cross(r,tempVec3a,tempVec3b),vec3.normalize(r,r),this.set(r[0],r[1],r[2],vec3.dot(t,r))}set(t,e,n,r){this.#t=t,this.#e=e,this.#n=n,this.#r=r,this.#s=t>0?1:0,this.#i=e>0?1:0,this.#o=n>0?1:0}isPointInFront(t,e,n){return this.#t*t+this.#e*e+this.#n*n>=this.#r}segmentIntersection(t,e,n,r,s,i){const o=this.#t*t+this.#e*e+this.#n*n-this.#r,c=this.#t*r+this.#e*s+this.#n*i-this.#r;if(o*c>0)return null;const a=c-o,P=r-t,h=s-e,l=i-n;if(a*a<1e-12*(P*P+h*h+l*l))return null;const f=-o/a;return[t+f*P,e+f*h,n+f*l]}checkAABB3DIntersection(t){const e=t.getLeft(),n=t.getTop(),r=t.getBack(),s=t.getRight(),i=t.getBottom(),o=t.getFront(),c=this.#t,a=this.#e,P=this.#n,h=this.#r,l=this.#s,f=this.#i,m=this.#o,p=1-l,I=1-f,u=1-m;if(c*e*l+c*s*p+a*n*f+a*i*I+P*r*m+P*o*u>=h)return 1;return c*s*l+c*e*p+a*i*f+a*n*I+P*o*m+P*r*u<=h?-1:0}}const tempPlane=new Plane;C3.Gfx.ViewFrustum=class{#c=new Plane;#a=new Plane;#P=new Plane;#h=new Plane;#l=new Plane;#f=new Plane;constructor(){}CalculatePlanes(t,e,n=0,r=1,s=1,i=0){const o=unitViewport;C3.Gfx.Unproject(n,r,0,t,e,o,neartl),C3.Gfx.Unproject(s,r,0,t,e,o,neartr),C3.Gfx.Unproject(n,i,0,t,e,o,nearbl),C3.Gfx.Unproject(s,i,0,t,e,o,nearbr),C3.Gfx.Unproject(n,r,1,t,e,o,fartl),C3.Gfx.Unproject(s,r,1,t,e,o,fartr),C3.Gfx.Unproject(n,i,1,t,e,o,farbl),C3.Gfx.Unproject(s,i,1,t,e,o,farbr),this.#c.setFromPoints(nearbl,neartl,fartl),this.#a.setFromPoints(neartl,neartr,fartr),this.#P.setFromPoints(neartr,nearbr,farbr),this.#h.setFromPoints(nearbr,nearbl,farbl),this.#f.setFromPoints(farbl,fartl,fartr),this.#l.setFromPoints(nearbr,neartr,neartl)}ContainsAABB(t){return this.#m(t,0)}FullyContainsAABB3D(t){return this.#m(t,1)}#m(t,e){return this.#c.checkAABB3DIntersection(t)>=e&&this.#a.checkAABB3DIntersection(t)>=e&&this.#P.checkAABB3DIntersection(t)>=e&&this.#h.checkAABB3DIntersection(t)>=e&&this.#l.checkAABB3DIntersection(t)>=e&&this.#f.checkAABB3DIntersection(t)>=e}ContainsPoint(t,e,n){return this.#c.isPointInFront(t,e,n)&&this.#a.isPointInFront(t,e,n)&&this.#P.isPointInFront(t,e,n)&&this.#h.isPointInFront(t,e,n)&&this.#l.isPointInFront(t,e,n)&&this.#f.isPointInFront(t,e,n)}#p(t,e,n,r){return(t===this.#c||this.#c.isPointInFront(e,n,r))&&(t===this.#a||this.#a.isPointInFront(e,n,r))&&(t===this.#P||this.#P.isPointInFront(e,n,r))&&(t===this.#h||this.#h.isPointInFront(e,n,r))&&(t===this.#l||this.#l.isPointInFront(e,n,r))&&(t===this.#f||this.#f.isPointInFront(e,n,r))}IsBehindNearPlane(t,e,n){return!this.#l.isPointInFront(t,e,n)}#I(t,e,n,r,s,i,o){const c=t.segmentIntersection(e,n,r,s,i,o);return c&&this.#p(t,c[0],c[1],c[2])?c:null}FirstSegmentIntersection(t,e,n,r,s,i){let o=this.#I(this.#c,t,e,n,r,s,i);return o||(o=this.#I(this.#a,t,e,n,r,s,i),o||(o=this.#I(this.#P,t,e,n,r,s,i),o||(o=this.#I(this.#h,t,e,n,r,s,i),o||(o=this.#I(this.#l,t,e,n,r,s,i),o||this.#I(this.#f,t,e,n,r,s,i)))))}FirstTwoSegmentIntersections(t,e,n,r,s,i){let o=this.#I(this.#c,t,e,n,r,s,i),c=this.#I(this.#a,t,e,n,r,s,i);if(c){if(o)return[o,c];o=c}if(c=this.#I(this.#P,t,e,n,r,s,i),c){if(o)return[o,c];o=c}if(c=this.#I(this.#h,t,e,n,r,s,i),c){if(o)return[o,c];o=c}if(c=this.#I(this.#l,t,e,n,r,s,i),c){if(o)return[o,c];o=c}if(c=this.#I(this.#f,t,e,n,r,s,i),c){if(o)return[o,c];o=c}return[o,c]}}; } // ../lib/gfx/rendererBase.js { const C3=self.C3,glMatrix=self.glMatrix,vec3=glMatrix.vec3,vec4=glMatrix.vec4,mat4=glMatrix.mat4,tempMat4=mat4.create(),tmpVec3a=vec3.fromValues(0,0,0),tmpVec3b=vec3.fromValues(0,0,0),tmpVec3c=vec3.fr … [Строка слишком длинная. Вы можете скачать файл] } // ../lib/gfx/shaderProgramBase.js { const C3=self.C3;C3.Gfx.ShaderProgramBase=class{constructor(e,t){this._name=t.name,this._renderer=e,this._extendBoxHorizontal=t.extendBoxHorizontal||0,this._extendBoxVertical=t.extendBoxVertical||0,this._crossSampling=!!t.crossSampling,this._mustPreDraw=!!t.mustPreDraw,this._preservesOpaqueness=!!t.preservesOpaqueness,this._supports3dDirectRendering=!!t.supports3dDirectRendering,this._animated=!!t.animated,this._blendsBackground=!!t.blendsBackground,this._usesDepth=!!t.usesDepth,this._usesAnySrcRectOrPixelSize=!1,this._needsPostDrawOrExtendBox=this._crossSampling||this._blendsBackground||0!==this._extendBoxHorizontal||0!==this._extendBoxVertical}Release(){this._renderer=null}GetRenderer(){return this._renderer}GetName(){return this._name}ExtendsBox(){return 0!==this._extendBoxHorizontal||0!==this._extendBoxVertical}GetBoxExtendHorizontal(){return this._extendBoxHorizontal}GetBoxExtendVertical(){return this._extendBoxVertical}UsesCrossSampling(){return this._crossSampling}MustPreDraw(){return this._mustPreDraw}PreservesOpaqueness(){return this._preservesOpaqueness}Supports3DDirectRendering(){return this._supports3dDirectRendering}IsAnimated(){return this._animated}BlendsBackground(){return this._blendsBackground}UsesDepth(){return this._usesDepth}UsesAnySrcRectOrPixelSize(){return this._usesAnySrcRectOrPixelSize}NeedsPostDrawOrExtendsBox(){return this._needsPostDrawOrExtendBox}UsesIsSrcTexRotated(){return!1}}; } // ../lib/gfx/stateGroup.js { const C3=self.C3;C3.Gfx.StateGroup=class{constructor(e,r,t,s,o,a,i){this._renderer=e,this._refCount=0,this._shaderProgram=null,this._shaderProgramName="",this._blendMode=t,this._color=C3.New(C3.Color),this._color.set(s),this._zElevation=o,this._cullFaceMode=a,this._frontFaceWinding=i,"string"==typeof r?this._shaderProgramName=r:(this._shaderProgram=r,this._shaderProgramName=this._shaderProgram.GetName())}Release(){if(this._refCount>0)throw new Error("releasing state group still in use");this._renderer=null,this._shaderProgram=null,this._shaderProgramName=""}Apply(){const e=this._renderer;e.SetProgram(this._shaderProgram),e.SetBlendMode(this._blendMode),e.SetColor(this._color),e.SetCurrentZ(this._zElevation),e.SetCullFaceMode(this._cullFaceMode),e.SetFrontFaceWinding(this._frontFaceWinding),e._SetCurrentStateGroup(this)}GetKey(){return C3.Gfx.StateGroup.MakeKey(this._shaderProgramName,this._blendMode,this._color,this._zElevation,this._cullFaceMode,this._frontFaceWinding)}AddRef(){++this._refCount}DecRef(){--this._refCount}_GetRefCount(){return this._refCount}OnContextLost(){this._shaderProgram=null}OnContextRestored(e){if(this._shaderProgram=e.GetShaderProgramByName(this._shaderProgramName),!this._shaderProgram)throw new Error("failed to restore shader program")}static MakeKey(e,r,t,s,o,a){return("string"==typeof e?e:e.GetName())+","+r+","+t.getR()+","+t.getG()+","+t.getB()+","+t.getA()+","+s+","+o+","+a}}; } // ../lib/gfx/deformMesh.js { const C3=globalThis.C3,assert=globalThis.assert,MAX_VERTICES=65535;function interpolateQuad(t,e,s){const i=s.getTlx(),h=s.getTly(),o=s.getTrx()-i,n=s.getTry()-h;return[i+o*t+(s.getBlx()-i)*e,h+n*t+(s.getBly()-h)*e]}C3.Gfx.DeformMeshPoint=class{#t;#e=0;#s=0;#i=NaN;#h=NaN;#o=NaN;#n=NaN;#a=NaN;constructor(t,e,s){this.#t=t,this.#e=e,this.#s=s,this.#i=0,this.#h=0,this.#o=0,this.#n=0,this.#a=0}_Init(t,e,s,i){this.#i=t,this.#h=e,this.#n=s,this.#a=i}CopyFrom(t,e=1,s=1){this.#i=t.GetX()*e,this.#h=t.GetY()*s,this.#o=t.GetZ(),this.#n=t.GetU()*e,this.#a=t.GetV()*s}GetX(){return this.#i}SetX(t){this.#i!==t&&(this.#i=t,this.#t._SetPointsChanged())}GetY(){return this.#h}SetY(t){this.#h!==t&&(this.#h=t,this.#t._SetPointsChanged())}GetZ(){return this.#o}SetZ(t){this.#o!==t&&(this.#o=t,this.#t._SetPointsChanged())}GetU(){return this.#n}SetU(t){this.#n=t}GetV(){return this.#a}SetV(t){this.#a=t}_Interpolate_TexRect(t,e,s){[this.#i,this.#h]=interpolateQuad(t.GetX(),t.GetY(),e),this.#o=t.GetZ(),this.#n=C3.lerp(s.getLeft(),s.getRight(),t.GetU()),this.#a=C3.lerp(s.getTop(),s.getBottom(),t.GetV())}_Interpolate_TexQuad(t,e,s){[this.#i,this.#h]=interpolateQuad(t.GetX(),t.GetY(),e),this.#o=t.GetZ(),[this.#n,this.#a]=interpolateQuad(t.GetU(),t.GetV(),s)}SaveToJson(){return{"x":this.GetX(),"y":this.GetY(),"z":this.GetZ(),"u":this.GetU(),"v":this.GetV()}}LoadFromJson(t){this.SetX(t["x"]),this.SetY(t["y"]),t.hasOwnProperty("z")&&this.SetZ(t["z"]),this.SetU(t["u"]),this.SetV(t["v"])}GetMesh(){return this.#t}GetColumn(){return this.#e}GetRow(){return this.#s}},C3.Gfx.DeformMesh=class{#r=null;#l=0;#G=0;#m=[];#u=0;#c=0;#M=0;#C=0;#f=0;#d=0;#p=!1;#g=null;#y=!0;#x=0;#z=new C3.Color(0,0,0,0);constructor(t,e,s){if(t<2||e<2)throw new Error("invalid mesh size");this.#l=t,this.#G=e,this.#r=s||null;const i=t-1,h=e-1;for(let s=0;s<e;++s){const e=[];for(let o=0;o<t;++o){const t=C3.New(C3.Gfx.DeformMeshPoint,this,o,s),n=o/i,a=s/h;t._Init(n,a,n,a),e.push(t)}this.#m.push(e)}}Release(){this.#g&&(this.#g.Release(),this.#g=null),C3.clearArray(this.#m)}CopyFrom(t,e=1,s=1){for(let i=0,h=Math.min(this.GetVSize(),t.GetVSize());i<h;++i)for(let h=0,o=Math.min(this.GetHSize(),t.GetHSize());h<o;++h)this.GetMeshPointAt(h,i).CopyFrom(t.GetMeshPointAt(h,i),e,s);this._SetPointsChanged()}GetHSize(){return this.#l}GetVSize(){return this.#G}GetOwner(){return this.#r}_GetPoints(){return this.#m}_SetPointsChanged(){this.#p=!0,this.#y=!0}#D(){if(!this.#p)return;let t=1/0,e=1/0,s=1/0,i=-1/0,h=-1/0,o=-1/0;for(const n of this.#m)for(const a of n){const n=a.GetX(),r=a.GetY(),l=a.GetZ();t=Math.min(t,n),e=Math.min(e,r),s=Math.min(s,l),i=Math.max(i,n),h=Math.max(h,r),o=Math.max(o,l)}this.#u=t,this.#c=e,this.#M=s,this.#C=i,this.#f=h,this.#d=o,this.#p=!1}GetMinX(){return this.#D(),this.#u}GetMinY(){return this.#D(),this.#c}GetMinZ(){return this.#D(),this.#M}GetMaxX(){return this.#D(),this.#C}GetMaxY(){return this.#D(),this.#f}GetMaxZ(){return this.#D(),this.#d}ApplyZScale(t){for(const e of this.#m)for(const s of e)s.SetZ(s.GetZ()*t)}HasAnyZElevation(){return this.GetMinZ()<0||this.GetMaxZ()>0}GetMeshPointAt(t,e){return t=Math.floor(t),e=Math.floor(e),t<0||t>=this.#l||e<0||e>=this.#G?null:this.#m[e][t]}CalculateTransformedMesh(t,e,s){const i=s instanceof C3.Rect;if(t.GetHSize()!==this.GetHSize()||t.GetVSize()!==this.GetVSize())throw new Error("source mesh wrong size");const h=t._GetPoints(),o=this._GetPoints();for(let t=0,n=o.length;t<n;++t){const n=h[t],a=o[t];for(let t=0,h=a.length;t<h;++t){const h=n[t],o=a[t];i?o._Interpolate_TexRect(h,e,s):o._Interpolate_TexQuad(h,e,s)}}this.#y=!0}#S(t){if(this.#g)return;const e=this.#l,s=this.#G,i=e*s,h=(e-1)*(s-1)*6;this.#g=t.CreateMeshData(i,h,{staticIndices:!0,debugLabel:"deformmesh"}),this.#g.CreateGPUResources(),this.#P()}#P(){const t=this.#l,e=this.#G,s=this.#g.indices;let i=0;for(let h=0,o=e-1;h<o;++h){const e=h*t,o=(h+1)*t;for(let h=0,n=t-1;h<n;++h){const t=h+1,n=h+e,a=t+e,r=t+o,l=h+o;s[i++]=n,s[i++]=a,s[i++]=r,s[i++]=n,s[i++]=r,s[i++]=l}}this.#g.MarkIndexDataChanged()}#Z(t){if(!this.#y&&this.#x===t)return;const e=this.#m,s=this.#G,i=this.#g.positions,h=this.#g.texCoords;let o=0,n=0,a=0,r=-1,l=-1,G=-1,m=-1;for(let u=0,c=s;u<c;++u){const s=e[u];for(let e=0,u=s.length;e<u;++e){const u=s[e],c=Math.fround(u.GetX()),M=i[o];i[o++]=c;const C=Math.fround(u.GetY()),f=i[o];i[o++]=C;const d=Math.fround(u.GetZ()+t),p=i[o];i[o++]=d;const g=Math.fround(u.GetU()),y=h[n];h[n++]=g;const x=Math.fround(u.GetV()),z=h[n];h[n++]=x,c===M&&C===f&&d===p||(-1===r?(r=a,l=a+1):l=a+1),g===y&&x===z||(-1===G?(G=a,m=a+1):m=a+1),a++}}-1!==r&&this.#g.MarkDataChanged("positions",r,l),-1!==G&&this.#g.MarkDataChanged("texCoords",G,m),this.#y=!1,this.#x=t}#b(t){if(t.equals(this.#z))return;this.#z.set(t);const e=this.#g.colors,s=t.getR(),i=t.getG(),h=t.getB(),o=t.getA();for(let t=0,n=e.length;t<n;)e[t++]=s,e[t++]=i,e[t++]=h,e[t++]=o;this.#g.MarkDataChanged("colors",0,this.#g.GetVertexCount())}Draw(t,e){this.#S(t),this.#Z(e),this.#b(t.GetColor()),t.DrawMeshData(this.#g)}Outline(t,e){e||(e=(t,e,s)=>[t,e,s]);const s=this.#m;let i=s[0];for(let h=1,o=s.length;h<o;++h){const n=s[h];let a=i[0],r=n[0];for(let s=1,l=n.length;s<l;++s){const G=i[s],m=n[s],[u,c,M]=e(a.GetX(),a.GetY(),a.GetZ()),[C,f,d]=e(G.GetX(),G.GetY(),G.GetZ()),[p,g,y]=e(m.GetX(),m.GetY(),m.GetZ()),[x,z,D]=e(r.GetX(),r.GetY(),r.GetZ());t.Line3D(u,c,M,C,f,d),t.Line3D(u,c,M,p,g,y),t.Line3D(u,c,M,x,z,D),s===l-1&&t.Line3D(C,f,d,p,g,y),h===o-1&&t.Line3D(x,z,D,p,g,y),a=G,r=m}i=n}}InsertPolyMeshVertices(t){const e=.001,s=.99999999,i=t.pointsArr(),h=[],o=this.GetHSize()-1,n=this.GetVSize()-1,a=1/o,r=1/n,l=o-1,G=n-1;let m=i[0],u=i[1],c=C3.clamp(Math.floor(m*o),0,l),M=C3.clamp(Math.floor(u*n),0,G),C=!0,f=0,d=0,p=0;let g=-1;const y=()=>{m=C3.clamp(C3.lerp(m,f,p),0,1),u=C3.clamp(C3.lerp(u,d,p),0,1),h.push(m,u)};for(let t=0,x=i.length;t<x;t+=2){m=i[t],u=i[t+1],h.push(m,u),c=C3.clamp(Math.floor(m*o),0,l),M=C3.clamp(Math.floor(u*n),0,G);const z=(t+2)%x;for(f=i[z],d=i[z+1],g=-1;;){if(h.length>1e6)throw new Error("Too many mesh poly points");const t=c*a,i=M*r,o=(c+1)*a,n=(M+1)*r;if(C=C3.isPointInTriangleInclusive(m,u,t,i,o,i,o,n),0!==g&&(p=C3.rayIntersectExtended(m,u,f,d,t,i,o,n,-.001),p>=0&&p<=s))y(),C=!C,g=0;else if(M>0&&2!==g&&(p=C3.rayIntersectExtended(m,u,f,d,t,i,o,i,e),p>=0&&p<=s))y(),M--,C=!1,g=4;else if(c<l&&3!==g&&(p=C3.rayIntersectExtended(m,u,f,d,o,i,o,n,e),p>=0&&p<=s))y(),c++,C=!1,g=1;else if(c>0&&1!==g&&(p=C3.rayIntersectExtended(m,u,f,d,t,i,t,n,e),p>=0&&p<=s))y(),c--,C=!0,g=3;else{if(!(M<G&&4!==g&&(p=C3.rayIntersectExtended(m,u,f,d,t,n,o,n,e),p>=0&&p<=s)))break;y(),M++,C=!0,g=2}}}return C3.New(C3.CollisionPoly,h)}TransformCollisionPoly(t,e){const s=this.#w(t);this.#T(s),e.setPoints(s)}#w(t){const e=[],s=t.pointsArr();for(let t=0,i=s.length;t<i;t+=2){const i=s[t],h=s[t+1],[o,n]=this.TransformPoint(i,h);e.push(o,n)}return e}TransformPoint(t,e){const s=this.GetHSize()-1,i=this.GetVSize()-1,h=1/s,o=1/i,n=C3.clamp(Math.floor(t*s),0,s-1),a=C3.clamp(Math.floor(e*i),0,i-1),r=n*h,l=a*o,G=(n+1)*h,m=(a+1)*o,u=this.GetMeshPointAt(n,a),c=this.GetMeshPointAt(n+1,a+1),M=C3.isPointInTriangleInclusive(t,e,r,l,G,l,G,m),C=M?r+h:r,f=M?l:l+o,d=this.GetMeshPointAt(n+(M?1:0),a+(M?0:1)),[p,g,y]=C3.triangleCartesianToBarycentric(t,e,r,l,C,f,G,m);return C3.triangleBarycentricToCartesian3d(p,g,y,u.GetX(),u.GetY(),u.GetZ(),d.GetX(),d.GetY(),d.GetZ(),c.GetX(),c.GetY(),c.GetZ())}#T(t){const e=[],s=1e-7;let i=t[0],h=t[1],o=i-t.at(-2),n=h-t.at(-1);for(let a=0,r=t.length;a<r;a+=2){const l=(a+2)%r,G=t[l],m=t[l+1],u=G-i,c=m-h,M=Math.abs(u)<s&&Math.abs(o)<s&&Math.sign(c)===Math.sign(n),C=Math.abs(c)<s&&Math.abs(n)<s&&Math.sign(u)===Math.sign(o);(!M&&!C&&Math.abs(u/o-c/n)>.001||0==u&&0===c)&&e.push(i,h),i=G,h=m,o=u,n=c}e.length>=6&&e.length<t.length&&C3.shallowAssignArray(t,e)}SaveToJson(){return{"cols":this.GetHSize(),"rows":this.GetVSize(),"points":this.#m.map(t=>t.map(t=>t.SaveToJson()))}}LoadFromJson(t){const e=this.GetHSize(),s=this.GetVSize();if(t["cols"]!==e||t["rows"]!==s)throw new Error("mesh data wrong size");const i=t["points"];for(let t=0;t<s;++t){const s=i[t];for(let i=0;i<e;++i){this.GetMeshPointAt(i,t).LoadFromJson(s[i])}}}}; } // ../lib/gfx/meshData.js { const C3=globalThis.C3,assert=globalThis.assert,DEFAULT_MESHDATA_OPTS={staticPositions:!1,staticTexCoords:!1,staticColors:!1,staticIndices:!1,texIndices:!1,debugLabel:""},SMALL_MESH_VERTICES=128,SMALL_MESH_INDICES=1024;class PendingBufferUpdate{#e=!1;#t=0;#n=0;#i=0;SetMaxSize(e){this.#i=e}MarkChanged(e,t){if(e<0||t>this.#i)throw new RangeError(`invalid data range (${e} to ${t} outside allowed range 0 to ${this.#i})`);this.#e?(this.#t=Math.min(e,this.#t),this.#n=Math.max(t,this.#n)):(this.#e=!0,this.#t=e,this.#n=t)}GetPendingChange(){return this.#e?{start:this.#t,end:this.#n}:null}Reset(){this.#e=!1}}C3.Gfx.MeshData=class{positions=null;texCoords=null;texIndices=null;colors=null;indices=null;#s;#a="";#r=0;#d=0;#o=!1;#h=0;#l=new PendingBufferUpdate;#u=new PendingBufferUpdate;#x=null;#C=new PendingBufferUpdate;#c=new PendingBufferUpdate;constructor(e,t,n,i){if(t=Math.floor(t),n=Math.floor(n),t<0||n<0)throw new Error("invalid count");this.#s=e,this.#r=t,this.#d=n,i=Object.assign({},DEFAULT_MESHDATA_OPTS,i),this.#o=i.texIndices,this.#a=i.debugLabel,this.#l.SetMaxSize(t),this.#u.SetMaxSize(t),this.#C.SetMaxSize(t),this.#c.SetMaxSize(n),this.#o&&(this.#x=new PendingBufferUpdate,this.#x.SetMaxSize(t))}Release(){this.#s._ReleaseMeshData(this),this.ReleaseGPUResources(),this.positions=null,this.texCoords=null,this.texIndices=null,this.colors=null,this.indices=null,this.#s=null}GetRenderer(){return this.#s}GetDebugLabel(){return this.#a}CreateGPUResources(){if(!this.positions)if(this.positions=new Float32Array(3*this.#r),this.texCoords=new Float32Array(2*this.#r),this.#o&&(this.texIndices=new Uint32Array(this.#r)),this.#s.IsColorDataF16()?this.colors=new globalThis["Float16Array"](4*this.#r):this.colors=new Float32Array(4*this.#r),this.IsIndexTypeUint16()){const e=4*Math.ceil(this.#d/2),t=new ArrayBuffer(e);this.indices=new Uint16Array(t,0,this.#d)}else this.indices=new Uint32Array(this.#d)}WriteGPUData(){}ReleaseGPUResources(){this.positions=null,this.texCoords=null,this.texIndices=null,this.colors=null,this.indices=null,this.#s._GetCurrentMeshData()===this&&this.#s.EndBatch()}OnContextLost(){}OnContextRestored(){this.CreateGPUResources(),this.MarkAllVertexDataChanged(),this.MarkIndexDataChanged()}IsIndexTypeUint16(){return this.GetVertexCount()<65536}GetVertexCount(){return this.#r}GetIndexCount(){return this.#d}IsSmall(){return this.GetVertexCount()<128&&this.GetIndexCount()<1024}GetPendingBufferUpdate(e){switch(e){case"positions":return this.#l;case"texCoords":return this.#u;case"texIndices":if(!this.#o)throw new Error("texture indices not enabled");return this.#x;case"colors":return this.#C;case"indices":return this.#c;default:throw new Error(`invalid buffer type '${e}'`)}}MarkDataChanged(e,t,n){(t=Math.floor(t))!==(n=Math.floor(n))&&this.GetPendingBufferUpdate(e).MarkChanged(t,n)}MarkAllVertexDataChanged(e=0,t=this.GetVertexCount()){this.MarkDataChanged("positions",e,t),this.MarkDataChanged("texCoords",e,t),this.MarkDataChanged("colors",e,t),this.#o&&this.MarkDataChanged("texIndices",e,t)}MarkPositionDataChanged(e=0,t=this.GetVertexCount()){this.MarkDataChanged("positions",e,t)}MarkTexCoordsDataChanged(e=0,t=this.GetVertexCount()){this.MarkDataChanged("texCoords",e,t)}MarkColorsDataChanged(e=0,t=this.GetVertexCount()){this.MarkDataChanged("colors",e,t)}MarkIndexDataChanged(e=0,t=this.GetIndexCount()){this.MarkDataChanged("indices",e,t)}FillColor(e,t,n,i){const s=this.colors;for(let a=0,r=s.length;a<r;)s[a++]=e,s[a++]=t,s[a++]=n,s[a++]=i}FillTexIndices(e){this.#h!==e&&(this.#h=e,this.texIndices.fill(e),this.MarkDataChanged("texIndices",0,this.GetVertexCount()))}}; } // ../lib/gfx/dynamicMeshData.js { const C3=globalThis.C3,assert=globalThis.assert,MAX_VERTICES=65535,MAX_INDICES=393210,defaultTexCoordsQuad=new C3.Quad2D(0,0,1,0,1,1,0,1),DEFAULT_DYNAMICMESHDATA_OPTS={texIndices:!1};C3.Gfx.DynamicMeshData=class{#t;#e=0;#s=0;#i=null;#r=null;#o=null;#a=null;#n=null;#h=new C3.Color(1,1,1,1);constructor(t,e){e=Object.assign({},DEFAULT_DYNAMICMESHDATA_OPTS,e),this.#t=t.CreateMeshData(65535,393210,{texIndices:e.texIndices,debugLabel:"dynamic"})}Release(){this.#t.Release(),this.#t=null,this.#i=null,this.#r=null,this.#o=null,this.#a=null,this.#n=null}_GetMeshData(){return this.#t}CreateGPUResources(){this.#t.CreateGPUResources(),this.#i=this.#t.positions,this.#r=this.#t.texCoords,this.#o=this.#t.texIndices,this.#a=this.#t.colors,this.#n=this.#t.indices}WriteGPUData(t){this.#t.MarkAllVertexDataChanged(0,this.#e),this.#t.MarkIndexDataChanged(0,this.#s),this.#t.WriteGPUData(t),this.#e=0,this.#s=0}ReleaseGPUResources(){this.#t.ReleaseGPUResources(),this.#i=null,this.#r=null,this.#o=null,this.#a=null,this.#n=null}OnContextLost(){this.#t.OnContextLost()}WebGPUInitRenderPassVertexBuffers(t){this.#t.WebGPUInitRenderPassVertexBuffers(t)}WebGPUInitRenderPassIndexBuffer(t){this.#t.WebGPUInitRenderPassIndexBuffer(t)}CanFit(t,e){return this.#e+t<=65535&&this.#s+e<=393210}GetVertexPtr(){return this.#e}GetIndexPtr(){return this.#s}static GetMaxVertices(){return 65535}static GetMaxIndices(){return 393210}GetDefaultColor(){return this.#h}#d(){const t=this.#e;this.#e+=4;let e=this.#s;this.#s+=6;const s=this.#n;return s[e++]=t,s[e++]=t+1,s[e++]=t+2,s[e++]=t,s[e++]=t+2,s[e]=t+3,t}WriteTexIndicesForQuad(t,e){const s=this.#o;s[t++]=e,s[t++]=e,s[t++]=e,s[t]=e}FillTexIndices(t,e,s){this.#o.fill(s,t,t+e)}WriteQuad(t,e){return this.WriteQuad4(t,e,defaultTexCoordsQuad)}WriteQuad2(t,e,s,i,r,o,a,n,h){const d=this.#d(),l=this.#i;let u=3*d;return l[u++]=e,l[u++]=s,l[u++]=t,l[u++]=i,l[u++]=r,l[u++]=t,l[u++]=o,l[u++]=a,l[u++]=t,l[u++]=n,l[u++]=h,l[u]=t,defaultTexCoordsQuad.writeToTypedArray(this.#r,2*d),this.#h.writeToTypedArrayx4(this.#a,4*d),d}WriteQuad3(t,e,s){const i=this.#d();return e.writeToTypedArray3D(this.#i,3*i,t),s.writeAsQuadToTypedArray(this.#r,2*i),this.#h.writeToTypedArrayx4(this.#a,4*i),i}WriteQuad4(t,e,s){const i=this.#d();return e.writeToTypedArray3D(this.#i,3*i,t),s.writeToTypedArray(this.#r,2*i),this.#h.writeToTypedArrayx4(this.#a,4*i),i}WriteQuad5(t,e,s,i){const r=this.#d();return e.writeToTypedArray3D(this.#i,3*r,t),s.writeToTypedArray(this.#r,2*r),this.#a.set(i,4*r),r}WriteQuad3D(t,e,s,i,r,o,a,n,h,d,l,u,c,x){const T=this.#d(),C=this.#i;let D=3*T;return C[D++]=e,C[D++]=s,C[D++]=i+t,C[D++]=r,C[D++]=o,C[D++]=a+t,C[D++]=n,C[D++]=h,C[D++]=d+t,C[D++]=l,C[D++]=u,C[D]=c+t,x.writeAsQuadToTypedArray(this.#r,2*T),this.#h.writeToTypedArrayx4(this.#a,4*T),T}WriteQuad3D2(t,e,s,i,r,o,a,n,h,d,l,u,c,x){const T=this.#d(),C=this.#i;let D=3*T;return C[D++]=e,C[D++]=s,C[D++]=i+t,C[D++]=r,C[D++]=o,C[D++]=a+t,C[D++]=n,C[D++]=h,C[D++]=d+t,C[D++]=l,C[D++]=u,C[D]=c+t,x.writeToTypedArray(this.#r,2*T),this.#h.writeToTypedArrayx4(this.#a,4*T),T}WriteQuad3D3(t,e,s,i,r,o,a,n,h,d,l,u,c,x,T){const C=this.#d(),D=this.#i;let y=3*C;return D[y++]=e,D[y++]=s,D[y++]=i+t,D[y++]=r,D[y++]=o,D[y++]=a+t,D[y++]=n,D[y++]=h,D[y++]=d+t,D[y++]=l,D[y++]=u,D[y]=c+t,x.writeToTypedArray(this.#r,2*C),this.#a.set(T,4*C),this.#h.writeToTypedArrayx4(this.#a,4*C),C}WriteQuad3D4(t,e,s){const i=this.#d();return e.writeToTypedArrayWithZOffset(this.#i,3*i,t),s.writeAsQuadToTypedArray(this.#r,2*i),this.#h.writeToTypedArrayx4(this.#a,4*i),i}WriteMesh(t,e,s,i,r=0){const o=Math.floor(t.length/3),a=this.#e;this.#i.set(t,3*a),this.#r.set(e,2*a);const n=this.#n;if(0===a&&0===r)n.set(s,this.#s);else{let t=this.#s;for(let e=0,i=s.length;e<i;++e)n[t++]=s[e]+a-r}const h=this.#a;if(i)h.set(i,4*a);else{const t=this.#h,e=t.getR(),s=t.getG(),i=t.getB(),r=t.getA();let n=4*a;for(let t=0,a=o;t<a;++t)h[n++]=e,h[n++]=s,h[n++]=i,h[n++]=r}return this.#e+=o,this.#s+=s.length,a}static CalculatePartialIndexRange(t,e,s){let i=t[e],r=t[e];for(let o=e+1,a=e+s;o<a;++o){const e=t[o];i=Math.min(i,e),r=Math.max(r,e)}return{minIndex:i,maxIndex:r}}}; } // ../lib/gfx/coplanarManager.js { const C3=globalThis.C3,coplanarInstances=[],postRenderInstances=[];C3.Gfx.CoplanarManagerMethods=class{#e=null;#n(e,n){const a=this.GetInstanceLayer(e);this.#e!==a&&(this.PrepareLayerForDraw(a,n),this.#e=a)}ShouldDrawInstance(e){}GetInstanceBaseZ(e){}GetInstanceDepth(e){}InstanceRendersToOwnZPlane(e){}InstanceMustMitigateZFighting(e){}SetInstanceDrawBackFaceOnly(e,n){}SetInstanceDrawNonBackFacesOnly(e,n){}DrawInstance(e,n,a,t,s){this.#n(t,e)}GetInstanceLayer(e){}PrepareLayerForDraw(e,n){}_Reset(){this.#e=null}},C3.Gfx.CoplanarManager=class{#a;#t=!0;constructor(e){this.#a=e}GetMethods(){return this.#a}SetEffectsEnabled(e){this.#t=!!e}DrawCoplanar(e,n,a,t){const s=this.#a;for(let r=0,c=t.length;r<c;){const o=t[r];if(!s.ShouldDrawInstance(o)){++r;continue}s.InstanceRendersToOwnZPlane(o)&&0===s.GetInstanceDepth(o)||postRenderInstances.push(o);const l=s.GetInstanceBaseZ(o);coplanarInstances.push(o);let I=r+1;for(;I<c;++I){const e=t[I];if(s.ShouldDrawInstance(e)){if(s.GetInstanceBaseZ(e)!==l)break;s.InstanceRendersToOwnZPlane(e)?(0!==s.GetInstanceDepth(e)&&postRenderInstances.push(e),coplanarInstances.push(e)):postRenderInstances.push(e)}}if(1!==coplanarInstances.length||s.InstanceMustMitigateZFighting(coplanarInstances[0])){this.#s(e,n,a,coplanarInstances);for(let t=0,r=postRenderInstances.length;t<r;++t){const r=postRenderInstances[t];s.SetInstanceDrawNonBackFacesOnly(r,!0),s.DrawInstance(e,n,a,r,this.#t),s.SetInstanceDrawNonBackFacesOnly(r,!1)}}else{s.DrawInstance(e,n,a,coplanarInstances[0],this.#t);for(let t=0,r=postRenderInstances.length;t<r;++t){const r=postRenderInstances[t];r!==o&&s.DrawInstance(e,n,a,r,this.#t)}}r=I,C3.clearArray(coplanarInstances),C3.clearArray(postRenderInstances)}s._Reset()}#s(e,n,a,t){const s=this.#a;e.CoplanarStartStencilPass();for(let r=0,c=t.length;r<c;++r){const c=t[r];s.SetInstanceDrawBackFaceOnly(c,!0),s.DrawInstance(e,n,a,c,!1)}e.CoplanarStartColorPass();for(let r=0,c=t.length;r<c;++r){const c=t[r];s.DrawInstance(e,n,a,c,this.#t),s.SetInstanceDrawBackFaceOnly(c,!1)}e.CoplanarRestoreStandardRendering()}}; } // ../lib/gfx/webgl/texture.js { const C3=self.C3,VALID_PIXEL_FORMATS=new Set(["rgba8","rgb8","rgba4","rgb5_a1","rgb565"]),VALID_MIPMAP_QUALITIES=new Set(["default","low","high"]),VALID_WRAP_MODES=new Set(["clamp-to-edge","repeat","m … [Строка слишком длинная. Вы можете скачать файл] } // ../lib/gfx/webgl/renderTarget.js { const C3=self.C3,assert=self.assert,glMatrix=self.glMatrix,vec3=glMatrix.vec3,mat4=glMatrix.mat4,DEFAULT_RENDERTARGET_OPTIONS={defaultSampling:"trilinear",alpha:!0,depth:!1,isSampled:!0,isDefaultSize:!0,multisampling:0},allRenderTargets=new Set;C3.Gfx.WebGLRenderTarget=class{#e="trilinear";constructor(e){this._renderer=e,this._frameBuffer=null,this._frameBufferNoDepth=null,this._texture=null,this._renderBuffer=null,this._width=0,this._height=0,this._isDefaultSize=!0,this._alpha=!0,this._depth=!1,this._isSampled=!0,this._multisampling=0,this._projectionMatrix=mat4.create(),this._lastFov=0,this._lastNearZ=0,this._lastFarZ=0}_Create(e,t,r){r=Object.assign({},DEFAULT_RENDERTARGET_OPTIONS,r);const i=this._renderer.GetWebGLVersionNumber();if(this._texture||this._renderBuffer)throw new Error("already created render target");if(this.#e=r.defaultSampling,this._alpha=!!r.alpha,this._depth=!!r.depth,this._isSampled=!!r.isSampled,this._isDefaultSize=!!r.isDefaultSize,this._multisampling=r.multisampling,!C3.Gfx.RendererBase.IsValidSamplingMode(this.#e)||"auto"===this.#e)throw new Error("invalid sampling");if(this._multisampling>0&&(i<2||this._isSampled))throw new Error("invalid use of multisampling");if(i<2&&(this._isSampled=!0),this._width=e,this._height=t,this._width<=0||this._height<=0)throw new Error("invalid render target size");this._CalculateProjection();const a=this._renderer.GetContext();if(this._frameBuffer=a.createFramebuffer(),this._depth&&(this._frameBufferNoDepth=a.createFramebuffer()),this._isSampled){this._texture=this._renderer.CreateDynamicTexture(this._width,this._height,{defaultSampling:this.#e,pixelFormat:this._alpha?"rgba8":"rgb8",mipMap:!1});const e=this._texture._GetTexture();a.bindFramebuffer(a.FRAMEBUFFER,this._frameBuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e,0),this._depth&&(a.bindFramebuffer(a.FRAMEBUFFER,this._frameBufferNoDepth),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e,0))}else{this._renderBuffer=a.createRenderbuffer(),a.bindRenderbuffer(a.RENDERBUFFER,this._renderBuffer);const e=this._alpha?a.RGBA8:a.RGB8;if(this._multisampling>0){const t=a.getInternalformatParameter(a.RENDERBUFFER,e,a.SAMPLES);if(t&&t[0]){const e=t[0];this._multisampling>e&&(this._multisampling=e)}else this._multisampling=0}0===this._multisampling?a.renderbufferStorage(a.RENDERBUFFER,e,this._width,this._height):a.renderbufferStorageMultisample(a.RENDERBUFFER,this._multisampling,e,this._width,this._height),a.bindFramebuffer(a.FRAMEBUFFER,this._frameBuffer),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.RENDERBUFFER,this._renderBuffer),this._depth&&(a.bindFramebuffer(a.FRAMEBUFFER,this._frameBufferNoDepth),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.RENDERBUFFER,this._renderBuffer)),a.bindRenderbuffer(a.RENDERBUFFER,null)}const s=this._renderer._GetDepthBuffer();this._depth&&s&&(a.bindFramebuffer(a.FRAMEBUFFER,this._frameBuffer),this._renderer._CanSampleDepth()?a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.TEXTURE_2D,s,0):a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.RENDERBUFFER,s)),a.bindFramebuffer(a.FRAMEBUFFER,null),allRenderTargets.add(this)}_Resize(e,t){if(this._width===e&&this._height===t)return;this._width=e,this._height=t,this._CalculateProjection();const r=this._renderer.GetContext();r.bindFramebuffer(r.FRAMEBUFFER,this._frameBuffer),this._texture?this._texture._Update(new ImageData(this._width,this._height)):(r.bindRenderbuffer(r.RENDERBUFFER,this._renderBuffer),r.renderbufferStorage(r.RENDERBUFFER,this._alpha?r.RGBA8:r.RGB8,this._width,this._height),r.bindRenderbuffer(r.RENDERBUFFER,null));const i=this._renderer._GetDepthBuffer();this._depth&&i&&(this._renderer._CanSampleDepth()?r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,i,0):r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,i)),r.bindFramebuffer(r.FRAMEBUFFER,null)}_Delete(){if(!this._texture&&!this._renderBuffer)throw new Error("already deleted render target");allRenderTargets.delete(this);const e=this._renderer.GetContext();this._texture?(e.bindFramebuffer(e.FRAMEBUFFER,this._frameBuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0),this._depth&&(e.bindFramebuffer(e.FRAMEBUFFER,this._frameBufferNoDepth),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0)),this._renderer.DeleteTexture(this._texture),this._texture=null):this._renderBuffer&&(e.bindFramebuffer(e.FRAMEBUFFER,this._frameBuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,null),this._depth&&(e.bindFramebuffer(e.FRAMEBUFFER,this._frameBufferNoDepth),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,null)),e.deleteRenderbuffer(this._renderBuffer),this._renderBuffer=null),e.bindFramebuffer(e.FRAMEBUFFER,null),this._renderer.GetWebGLVersionNumber()>=2&&(e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null)),e.deleteFramebuffer(this._frameBuffer),this._depth&&e.deleteFramebuffer(this._frameBufferNoDepth);const t=this._renderer.GetBatchState();t.currentFramebuffer=null,t.currentFramebufferNoDepth=null,this._frameBuffer=null}_CalculateProjection(){this._renderer.CalculatePerspectiveMatrix(this._projectionMatrix,this._width/this._height),this._lastFov=this._renderer.GetFovY(),this._lastNearZ=this._renderer.GetNearZ(),this._lastFarZ=this._renderer.GetFarZ()}_GetFramebuffer(){return this._frameBuffer}_GetFramebufferNoDepth(){return this._frameBufferNoDepth}GetRenderer(){return this._renderer}GetTexture(){return this._texture}GetProjectionMatrix(){return this._renderer.GetFovY()===this._lastFov&&this._renderer.GetNearZ()===this._lastNearZ&&this._renderer.GetFarZ()===this._lastFarZ||this._CalculateProjection(),this._projectionMatrix}HasAlpha(){return this._alpha}IsSampled(){return this._isSampled}HasDepthBuffer(){return this._depth}GetWidth(){return this._width}GetHeight(){return this._height}IsDefaultSize(){return this._isDefaultSize}SetDefaultSampling(e){this.#e=e,this._texture&&this._texture.SetDefaultSampling(e)}GetDefaultSampling(){return this.#e}GetMultisampling(){return this._multisampling}GetOptions(){const e={alpha:this._alpha,isSampled:this._isSampled};return this._isDefaultSize||(e.width=this._width,e.height=this._height),e}IsCompatibleWithOptions(e){return!!(e=Object.assign({},DEFAULT_RENDERTARGET_OPTIONS,e)).alpha===this.HasAlpha()&&(!!e.depth===this.HasDepthBuffer()&&(!(this._renderer.GetWebGLVersionNumber()>=2&&!!e.isSampled!==this.IsSampled())&&("number"==typeof e.width||"number"==typeof e.height?!this.IsDefaultSize()&&this.GetWidth()===Math.floor(e.width)&&this.GetHeight()===Math.floor(e.height):this.IsDefaultSize())))}_GetWebGLTexture(){return this._texture?this._texture._GetTexture():null}GetEstimatedMemoryUsage(){return this._texture?this._texture.GetEstimatedMemoryUsage():this._width*this._height*(this._alpha?4:3)}static async DebugReadPixelsToBlob(e,t){const r=await e.ReadBackRenderTargetToImageData(t,!0);return await C3.ImageDataToBlob(r)}static OnContextLost(){allRenderTargets.clear()}static allRenderTargets(){return allRenderTargets.values()}static ResizeAll(e,t){for(const r of allRenderTargets)r.IsDefaultSize()&&r._Resize(e,t)}}; } // ../lib/gfx/webgl/shaderProgram.js { const C3=self.C3,glMatrix=self.glMatrix,vec3=glMatrix.vec3,mat4=glMatrix.mat4,RESERVED_UNIFORM_NAMES=new Set(["aPos","aTex","aColor","aPoints","matP","matMV","samplerFront","samplerBack","samplerDepth … [Строка слишком длинная. Вы можете скачать файл] } // ../lib/gfx/webgl/shaderUniform.js { const C3=self.C3,glMatrix=self.glMatrix,mat4=glMatrix.mat4,TYPE_SIZES=new Map([["float",1],["percent",1],["sampler",1],["vec2",2],["vec3",3],["color",3],["vec4",4],["mat4",16]]);C3.Gfx.WebGLShaderUniform=class{constructor(t,s,a){if(!TYPE_SIZES.has(a))throw new Error("invalid uniform type");this._owner=t,this._gl=this._owner.GetWebGLContext(),this._name=s,this._type=a,this._isColorType="color"===this._type,this._location=this._gl.getUniformLocation(this._owner.GetShaderProgram(),s),this._isUsed=!!this._location;const i=TYPE_SIZES.get(a);this._lastValue=new Float32Array(i),this._lastBatchValue=new Float32Array(i)}Release(){this._owner=null,this._gl=null,this._location=null}IsUsed(){return this._isUsed}GetType(){return this._type}IsColorType(){return this._isColorType}Init1f(t){this.IsUsed()&&(this._lastValue[0]=t,this._lastBatchValue.set(this._lastValue),this._gl.uniform1f(this._location,t))}Init1i(t){this.IsUsed()&&(this._lastValue[0]=t,this._lastBatchValue.set(this._lastValue),this._gl.uniform1i(this._location,t))}Init2f(t,s){this.IsUsed()&&(this._lastValue[0]=t,this._lastValue[1]=s,this._lastBatchValue.set(this._lastValue),this._gl.uniform2f(this._location,t,s))}Init3f(t,s,a){this.IsUsed()&&(this._lastValue[0]=t,this._lastValue[1]=s,this._lastValue[2]=a,this._lastBatchValue.set(this._lastValue),this._gl.uniform3f(this._location,t,s,a))}Init4f(t,s,a,i){this.IsUsed()&&(this._lastValue[0]=t,this._lastValue[1]=s,this._lastValue[2]=a,this._lastValue[3]=i,this._lastBatchValue.set(this._lastValue),this._gl.uniform4f(this._location,t,s,a,i))}Update1f(t){t=Math.fround(t);const s=this._lastValue;s[0]!==t&&(s[0]=t,this._gl.uniform1f(this._location,t))}Update1i(t){const s=this._lastValue;s[0]!==t&&(s[0]=t,this._gl.uniform1i(this._location,t))}Update2f(t,s){t=Math.fround(t),s=Math.fround(s);const a=this._lastValue;a[0]===t&&a[1]===s||(a[0]=t,a[1]=s,this._gl.uniform2f(this._location,t,s))}Update3f(t,s,a){t=Math.fround(t),s=Math.fround(s),a=Math.fround(a);const i=this._lastValue;i[0]===t&&i[1]===s&&i[2]===a||(i[0]=t,i[1]=s,i[2]=a,this._gl.uniform3f(this._location,t,s,a))}Update4f(t,s,a,i){t=Math.fround(t),s=Math.fround(s),a=Math.fround(a),i=Math.fround(i);const l=this._lastValue;l[0]===t&&l[1]===s&&l[2]===a&&l[3]===i||(l[0]=t,l[1]=s,l[2]=a,l[3]=i,this._gl.uniform4f(this._location,t,s,a,i))}UpdateMatrix4fv(t){const s=this._lastValue;mat4.exactEquals(s,t)||(C3.typedArraySet16(s,t,0),this._gl.uniformMatrix4fv(this._location,!1,t))}IsSetToCustomInBatch(t){const s=this._lastBatchValue;return this.IsColorType()?s[0]===Math.fround(t.getR())&&s[1]===Math.fround(t.getG())&&s[2]===Math.fround(t.getB()):s[0]===Math.fround(t)}SetBatchValueCustom(t){const s=this._lastBatchValue;this.IsColorType()?(s[0]=t.getR(),s[1]=t.getG(),s[2]=t.getB()):s[0]=t}IsSetTo1InBatch(t){return this._lastBatchValue[0]===Math.fround(t)}IsSetTo2InBatch(t,s){const a=this._lastBatchValue;return a[0]===Math.fround(t)&&a[1]===Math.fround(s)}SetBatch1(t){this._lastBatchValue[0]=t}SetBatch2(t,s){const a=this._lastBatchValue;a[0]=t,a[1]=s}}; } // ../lib/gfx/webgl/batchJob.js { const C3=self.C3,glMatrix=self.glMatrix,vec4=glMatrix.vec4,mat4=glMatrix.mat4,BATCH_NULL=0,BATCH_DRAW=1,BATCH_SETTEXTURE=2,BATCH_SETBLEND=3,BATCH_SETVIEWPORT=4,BATCH_SETPROJECTION=5,BATCH_SETMODELVIEW … [Строка слишком длинная. Вы можете скачать файл] } // ../lib/gfx/text.js { const C3=self.C3,MAX_TEXTURE_SIZE=4096,EXTRA_LINE_HEIGHT=4,GENERIC_FONT_FAMILIES=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui … [Строка слишком длинная. Вы можете скачать файл] } // ../lib/gfx/webgl/query.js { const C3=self.C3;class WebGLRealTimeElapsedQuery{constructor(e){this._gl=e.GetContext(),this._version=e.GetWebGLVersionNumber(),this._timerExt=e._GetDisjointTimerQueryExtension(),this._query=null,this._isActive=!1,this._hasResult=!1,this._result=0,1===this._version?this._query=this._timerExt["createQueryEXT"]():this._query=this._gl["createQuery"]()}Release(){this._DeleteQueryObject(),this._gl=null,this._timerExt=null,this._hasResult=!1}_DeleteQueryObject(){this._query&&(1===this._version?this._timerExt["deleteQueryEXT"](this._query):this._gl["deleteQuery"](this._query),this._query=null)}BeginTimeElapsed(){if(this._isActive)throw new Error("query already active");1===this._version?this._timerExt["beginQueryEXT"](this._timerExt["TIME_ELAPSED_EXT"],this._query):this._gl["beginQuery"](this._timerExt["TIME_ELAPSED_EXT"],this._query),this._isActive=!0}EndTimeElapsed(){if(!this._isActive)throw new Error("query not active");1===this._version?this._timerExt["endQueryEXT"](this._timerExt["TIME_ELAPSED_EXT"]):this._gl["endQuery"](this._timerExt["TIME_ELAPSED_EXT"]),this._isActive=!1}CheckForResult(){if(!this._query||this._hasResult||this._isActive)return;let e=!1;e=1===this._version?this._timerExt["getQueryObjectEXT"](this._query,this._timerExt["QUERY_RESULT_AVAILABLE_EXT"]):this._gl["getQueryParameter"](this._query,this._gl["QUERY_RESULT_AVAILABLE"]);const t=this._gl.getParameter(this._timerExt["GPU_DISJOINT_EXT"]);e&&!t&&(1===this._version?this._result=this._timerExt["getQueryObjectEXT"](this._query,this._timerExt["QUERY_RESULT_EXT"]):this._result=this._gl["getQueryParameter"](this._query,this._gl["QUERY_RESULT"]),this._result/=1e9,this._hasResult=!0),(e||t)&&this._DeleteQueryObject()}HasResult(){return this._hasResult}GetResult(){if(!this._hasResult)throw new Error("no result available");return this._result}}C3.Gfx.WebGLTimeElapsedQuery=class{constructor(e){this._renderer=e,this._frameNumber=e.GetFrameNumber(),this._isActive=!1,this._parentQuery=null,this._isNested=!1,this._realQuery=null,this._queries=[]}Release(){for(const e of this._queries)e instanceof WebGLRealTimeElapsedQuery&&e.Release();C3.clearArray(this._queries),this._parentQuery=null,this._realQuery=null,this._renderer=null}BeginTimeElapsed(){if(this._isActive)throw new Error("query already active");const e=this._renderer._GetTimeQueryStack();e.length>0?(this._isNested=!0,this._parentQuery=e.at(-1),this._parentQuery._EndReal(),this._parentQuery._queries.push(this)):(this._isNested=!1,this._parentQuery=null),this._isActive=!0,e.push(this),this._StartReal()}EndTimeElapsed(){if(!this._isActive)throw new Error("query not active");if(this._renderer._GetTimeQueryStack().pop()!==this)throw new Error("can only end most nested query");this._isActive=!1,this._EndReal(),this._parentQuery&&(this._parentQuery._StartReal(),this._parentQuery=null)}_StartReal(){this._realQuery=C3.New(WebGLRealTimeElapsedQuery,this._renderer),this._queries.push(this._realQuery),this._realQuery.BeginTimeElapsed()}_EndReal(){this._realQuery.EndTimeElapsed(),this._realQuery=null}CheckForResult(){for(const e of this._queries)e.CheckForResult()}IsNested(){return this._isNested}HasResult(){return this._queries.every(e=>e.HasResult())}GetResult(){return this._queries.reduce((e,t)=>e+t.GetResult(),0)}GetFrameNumber(){return this._frameNumber}}; } // ../lib/gfx/webgl/queryResultBuffer.js { const C3=self.C3;C3.Gfx.WebGLQueryResultBuffer=class{constructor(e,r=1e3){this._renderer=e,this._maxQueries=r,this._buffer=[],this._renderer._AddQueryResultBuffer(this)}Release(){this.Clear(),this._renderer._RemoveQueryResultBuffer(this),this._renderer=null}Clear(){for(const e of this._buffer)e.Release();C3.clearArray(this._buffer)}AddTimeElapsedQuery(){const e=new C3.Gfx.WebGLTimeElapsedQuery(this._renderer);if(this._buffer.push(e),this._buffer.length>this._maxQueries){this._buffer.shift().Release()}return e}CheckForResults(e){for(const r of this._buffer){if(r.GetFrameNumber()>=e)return;if(r.IsNested())return;r.CheckForResult()}}GetFrameRangeResultSum(e,r){if(r<=e)return NaN;let t=0;for(const s of this._buffer){if(s.GetFrameNumber()>=r)break;if(!(s.GetFrameNumber()<e)){if(!s.HasResult())return NaN;t+=s.GetResult()}}return t}DeleteAllBeforeFrameNumber(e){for(let r=0,t=this._buffer.length;r<t;++r){const t=this._buffer[r];if(!(t.GetFrameNumber()<e))return void(r>0&&this._buffer.splice(0,r));t.Release()}}}; } // ../lib/gfx/webgl/meshData.js { const C3=globalThis.C3,assert=globalThis.assert,SIZEOF_F32=4,SIZEOF_F16=2,SIZEOF_U32=4,SIZEOF_U16=2;C3.Gfx.MeshDataWebGL=class extends C3.Gfx.MeshData{#e=null;#t=null;#s=null;#r=null;#i=null;#o=!1;#f=!1;#n=!1;#a=!1;constructor(e,t,s,r){super(e,t,s,r),this.#o=!!r.staticPositions,this.#f=!!r.staticTexCoords,this.#n=!!r.staticColors,this.#a=!!r.staticIndices}CreateGPUResources(){if(super.CreateGPUResources(),this.IsSmall())return;const e=this.GetRenderer(),t=e.GetContext();e.GetWebGLVersionNumber()<2?this.#i=e._GetVAOExtension()["createVertexArrayOES"]():this.#i=t.createVertexArray(),e._BindVAO(this.#i),this.#e=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.#e),t.bufferData(t.ARRAY_BUFFER,this.positions.byteLength,this.#o?t.STATIC_DRAW:t.DYNAMIC_DRAW),t.enableVertexAttribArray(0),t.vertexAttribPointer(0,3,t.FLOAT,!1,0,0),this.#t=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.#t),t.bufferData(t.ARRAY_BUFFER,this.texCoords.byteLength,this.#f?t.STATIC_DRAW:t.DYNAMIC_DRAW),t.enableVertexAttribArray(1),t.vertexAttribPointer(1,2,t.FLOAT,!1,0,0),this.#s=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.#s),t.bufferData(t.ARRAY_BUFFER,this.colors.byteLength,this.#n?t.STATIC_DRAW:t.DYNAMIC_DRAW),t.enableVertexAttribArray(2),t.vertexAttribPointer(2,4,e.IsColorDataF16()?t["HALF_FLOAT"]:t.FLOAT,!1,0,0),this.#r=t.createBuffer(),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.#r),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indices.byteLength,this.#a?t.STATIC_DRAW:t.DYNAMIC_DRAW),e._BindVAO(null)}WriteGPUData(){const e=this.GetRenderer(),t=e.GetContext();let s=!1,r=this.GetPendingBufferUpdate("positions"),i=r.GetPendingChange();if(i&&(t.bindBuffer(t.ARRAY_BUFFER,this.#e),t.bufferSubData(t.ARRAY_BUFFER,3*i.start*4,this.positions.subarray(3*i.start,3*i.end)),r.Reset()),r=this.GetPendingBufferUpdate("texCoords"),i=r.GetPendingChange(),i&&(t.bindBuffer(t.ARRAY_BUFFER,this.#t),t.bufferSubData(t.ARRAY_BUFFER,2*i.start*4,this.texCoords.subarray(2*i.start,2*i.end)),r.Reset()),r=this.GetPendingBufferUpdate("colors"),i=r.GetPendingChange(),i){const s=e.IsColorDataF16()?2:4;t.bindBuffer(t.ARRAY_BUFFER,this.#s),t.bufferSubData(t.ARRAY_BUFFER,4*i.start*s,this.colors.subarray(4*i.start,4*i.end)),r.Reset()}if(r=this.GetPendingBufferUpdate("indices"),i=r.GetPendingChange(),i){e._BindVAO(this.#i),s=!0;const o=this.IsIndexTypeUint16()?2:4;t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,i.start*o,this.indices.subarray(i.start,i.end)),r.Reset()}return s}_GetVAO(){return this.#i}ReleaseGPUResources(){super.ReleaseGPUResources();const e=this.GetRenderer(),t=e.GetContext();this.#i&&(e.GetWebGLVersionNumber()<2?e._GetVAOExtension()["deleteVertexArrayOES"](this.#i):t.deleteVertexArray(this.#i),this.#i=null),this.#e&&(t.deleteBuffer(this.#e),this.#e=null),this.#t&&(t.deleteBuffer(this.#t),this.#t=null),this.#s&&(t.deleteBuffer(this.#s),this.#s=null),this.#r&&(t.deleteBuffer(this.#r),this.#r=null)}OnContextLost(){this.#e=null,this.#t=null,this.#s=null,this.#r=null,this.#i=null}}; } // ../lib/gfx/webgl/webglRenderer.js { const C3=self.C3,assert=self.assert,glMatrix=self.glMatrix,vec3=glMatrix.vec3,vec4=glMatrix.vec4,mat4=glMatrix.mat4,DEFAULT_WEBGLRENDERER_OPTS={powerPreference:"default",enableGpuProfiling:!0,alpha:!1 … [Строка слишком длинная. Вы можете скачать файл] } // ../lib/gfx/webgpu/webgpuRenderer.js { const C3=globalThis.C3,glMatrix=globalThis.glMatrix,vec3=glMatrix.vec3,mat4=glMatrix.mat4,assert=globalThis.assert,GPUBufferUsage=globalThis["GPUBufferUsage"],GPUShaderStage=globalThis["GPUShaderStage … [Строка слишком длинная. Вы можете скачать файл] } // ../lib/gfx/webgpu/bufferManager.js { const C3=self.C3,ENABLE_RECYCLING=!0;C3.Gfx.WebGPUBufferManager=class{constructor(e){this._renderer=e,this._buffers=new Map,this._recycleAfterSubmit=[],this._releaseAfterSubmit=[],this._destroyAfterSubmit=[],this._totalBufferCount=0,this._totalBufferSize=0,this._totalCreated=0,this._totalReleased=0,this._totalReturned=0,this._totalRecycled=0}GetRenderer(){return this._renderer}OnContextLost(){this._buffers.clear(),C3.clearArray(this._recycleAfterSubmit),C3.clearArray(this._releaseAfterSubmit),C3.clearArray(this._destroyAfterSubmit)}_RoundBufferSizeClass(e){return Math.max(C3.nextHighestPowerOfTwo(e),16)}GetRecyclableBuffer(e){this._totalReturned++;const t=this._RoundBufferSizeClass(e);{const e=this._buffers.get(t);if(void 0!==e&&e.length>0){const r=e.pop();return r.MarkInUse(),0===e.length&&this._buffers.delete(t),r}}return this._totalBufferCount++,this._totalBufferSize+=t,this._totalCreated++,C3.New(C3.Gfx.WebGPURecyclableBuffer,this,t)}_AddRecycledBuffer(e){this._totalRecycled++;const t=e.GetSize(),r=this._buffers.get(t);void 0===r?this._buffers.set(t,[e]):r.push(e)}_DestroyAfterSubmit(e){this._destroyAfterSubmit.push(e)}AfterSubmit(){for(const e of this._recycleAfterSubmit)e.Recycle();C3.clearArray(this._recycleAfterSubmit);for(const e of this._releaseAfterSubmit)this._totalBufferCount--,this._totalBufferSize-=e.GetSize(),e.Release();C3.clearArray(this._releaseAfterSubmit);for(const e of this._destroyAfterSubmit)e["destroy"]();C3.clearArray(this._destroyAfterSubmit)}MaybeCollectUnusedBuffers(e){e%30==0&&this._CollectUnusedBuffers(e)}_CollectUnusedBuffers(e){for(const[t,r]of this._buffers.entries()){let s=0;for(let t=0,f=r.length;t<f;++t){const f=r[t];f._ShouldCollect(e)?(this._totalBufferCount--,this._totalBufferSize-=f.GetSize(),f.Release(),this._totalReleased++):(r[s]=f,++s)}0===s?this._buffers.delete(t):C3.truncateArray(r,s)}this._DebugLogBufferMap()}UpdateBufferSubData(e,t,r,s,f){const i=this.GetRecyclableBuffer(f),u=i.GetBuffer(),l=u["getMappedRange"](0,f);new Uint8Array(l).set(new Uint8Array(r,s,f)),u["unmap"](),e["copyBufferToBuffer"](u,0,t,s,f),this._recycleAfterSubmit.push(i)}_DebugLogBufferMap(){this._totalCreated=0,this._totalReleased=0,this._totalReturned=0,this._totalRecycled=0}}; } // ../lib/gfx/webgpu/recyclableBuffer.js { const C3=self.C3,GPUBufferUsage=self["GPUBufferUsage"],GPUMapMode=self["GPUMapMode"],assert=self.assert,STATE_AVAILABLE=0,STATE_IN_USE=1,STATE_RECYCLING=2;C3.Gfx.WebGPURecyclableBuffer=class{constructor(e,t){this._bufferManager=e,this._state=1,this._size=t,this._buffer=this.GetRenderer()._GetDevice()["createBuffer"]({"mappedAtCreation":!0,"size":t,"usage":GPUBufferUsage["COPY_SRC"]|GPUBufferUsage["MAP_WRITE"]}),this._recycledFrameNumber=0}GetRenderer(){return this._bufferManager.GetRenderer()}GetState(){return this._state}GetSize(){return this._size}GetBuffer(){return this._buffer}MarkInUse(){this._state=1}async Recycle(){this._state=2;try{await this._buffer["mapAsync"](GPUMapMode["WRITE"])}catch(e){return void console.warn("[WebGPU] Error recycling buffer, assuming device was lost: ",e)}this.GetRenderer().IsContextLost()||(this._state=0,this._recycledFrameNumber=this.GetRenderer().GetFrameNumber(),this._bufferManager._AddRecycledBuffer(this))}Discard(){this._state=0}_ShouldCollect(e){return this._recycledFrameNumber<=e-25}Release(){this._buffer["destroy"](),this._buffer=null,this._bufferManager=null}}; } // ../lib/gfx/webgpu/customParamsBuffer.js { const C3=self.C3,assert=self.assert,GPUBufferUsage=self["GPUBufferUsage"];C3.Gfx.WebGPUEffectCustomParamsBuffer=class{constructor(e){const r=e.GetRenderer();this._shaderProgram=e,this._byteSize=e.GetCustomParametersByteSize(),this._arrayBuffer=new ArrayBuffer(this._byteSize),this._f32arr=new Float32Array(this._arrayBuffer),this._isChanged=!1,this._buffer=r._GetDevice()["createBuffer"]({"size":this._byteSize,"usage":GPUBufferUsage["UNIFORM"]|GPUBufferUsage["COPY_DST"]}),this._bufferBindGroup=r._CreateBufferBindGroup(this._buffer)}Release(){this.GetRenderer()._OnBufferBindGroupDestroyed(this._bufferBindGroup),this.GetRenderer().GetBufferManager()._DestroyAfterSubmit(this._buffer),this._buffer=null,this._shaderProgram=null,this._arrayBuffer=null,this._f32arr=null,this._bufferBindGroup=null}GetRenderer(){return this._shaderProgram.GetRenderer()}GetShaderProgram(){return this._shaderProgram}GetBufferBindGroup(){return this._bufferBindGroup}SetParameterValue(e,r){const t=this._shaderProgram._GetCustomParameterInfo(e),s=t.type,f=t.offset/4,a=this._f32arr;if("color"===s){if(r.equalsRGBF32Array(a,f))return;r.writeRGBToTypedArray(a,f),this._isChanged=!0}else{if("float"!==s&&"percent"!==s)throw new Error(`unexpected shader param type '${s}'`);if(a[f]===Math.fround(r))return;a[f]=r,this._isChanged=!0}}IsChanged(){return this._isChanged}UpdateBuffer(e){this.GetRenderer().GetBufferManager().UpdateBufferSubData(e,this._buffer,this._arrayBuffer,0,this._byteSize),this._isChanged=!1}}; } // ../lib/gfx/webgpu/shaderProgram.js { const C3=self.C3,SIZEOF_F32=4,SIZEOF_F16=2,SIZEOF_U32=4,SIZEOF_VEC2_F32=8,SIZEOF_VEC4_F32=16,SIZEOF_MAT4_F32=64;function UpdateLayoutEndValues(t){for(const e of Object.values(t))e.end=e.offset+e.size} … [Строка слишком длинная. Вы можете скачать файл] } // ../lib/gfx/webgpu/texture.js { const C3=self.C3,VALID_WRAP_MODES=new Set(["clamp-to-edge","repeat","mirror-repeat"]),GPUTextureUsage=self["GPUTextureUsage"],DEFAULT_CREATE_OPTIONS={wrapX:"clamp-to-edge",wrapY:"clamp-to-edge",defaul … [Строка слишком длинная. Вы можете скачать файл] } // ../lib/gfx/webgpu/multiTextureGroup.js { const C3=self.C3,allMultiTextureGroups=new Set;C3.Gfx.WebGPUMultiTextureGroup=class{#e=[null,null,null];constructor(e,t){if(t.length<2)throw new Error("invalid multi-texture group");this._renderer=e,this._textures=t;for(let e=0,r=t.length;e<r;++e)t[e]._SetMultiTextureGroup(this,e);t.length<C3.Gfx.WebGPUMultiTextureGroup.GetMultiTextureLimit()&&this._renderer._SetMultiTextureGroupNonFull(this,!0),allMultiTextureGroups.add(this)}Release(){allMultiTextureGroups.delete(this),this._renderer._SetMultiTextureGroupNonFull(this,!1);for(const e of this._textures)e._ClearMultiTextureGroup();this.DeleteBindGroups(),C3.clearArray(this._textures),this._renderer=null}#t(e){const t=this._renderer,r=t._GetDevice(),u=[],i=C3.Gfx.WebGPUMultiTextureGroup.GetMultiTextureLimit();for(let t=0;t<i;++t){const r=this._textures[Math.min(t,this._textures.length-1)];u.push({"binding":2*t,"resource":r._GetSampler(e)},{"binding":2*t+1,"resource":r._GetTextureView(e)})}return r["createBindGroup"]({"layout":t._GetTextureBindGroupLayout(),"entries":u})}DeleteBindGroups(){for(const e of this.#e)e&&this._renderer._OnMultiTextureBindGroupReleased(e);this.#e.fill(null)}_GetBindGroup(e){return this.#e[e]||(this.#e[e]=this.#t(e)),this.#e[e]}static GetMultiTextureLimit(){return 14}static all(){return allMultiTextureGroups.values()}}; } // ../lib/gfx/webgpu/renderTarget.js { const C3=self.C3,glMatrix=self.glMatrix,vec3=glMatrix.vec3,mat4=glMatrix.mat4,DEFAULT_RENDERTARGET_OPTIONS={defaultSampling:"trilinear",alpha:!0,depth:!1,isSampled:!0,canReadPixels:!1,canUpdate:!1,isDefaultSize:!0,multisampling:0},allRenderTargets=new Set;C3.Gfx.WebGPURenderTarget=class{constructor(e,t){this._renderer=e,this._isBackBuffer=!!t,this._depth=!!t&&e.UsesDepthBuffer(),this._rendererTexture=null,this._isDefaultSize=!0,this._multisampling=0,this._isAwaitingClear=!1,this._clearColor=C3.New(C3.Color),this._projectionMatrix=mat4.create(),this._lastFov=0,this._lastNearZ=0,this._lastFarZ=0,this._isBackBuffer&&(this._rendererTexture=C3.New(C3.Gfx.WebGPURendererTexture,e,!0))}_Create(e,t,r){if(r=Object.assign({},DEFAULT_RENDERTARGET_OPTIONS,r),this._rendererTexture)throw new Error("already created render target");if(this._depth=!!r.depth,this._isDefaultSize=!!r.isDefaultSize,this._multisampling=this._renderer._ClampToSupportedMultisampleValues(r.multisampling),this._multisampling>=2&&r.isSampled)throw new Error("invalid use of multisampling");this._rendererTexture=this._renderer.CreateDynamicTexture(e,t,{defaultSampling:r.defaultSampling,mipMap:!1,isRenderTarget:!0,isSampled:r.isSampled,canReadPixels:r.canReadPixels,canUpdate:r.canUpdate,multisampling:this._multisampling}),this._CalculateProjection(),allRenderTargets.add(this)}_Delete(){allRenderTargets.delete(this),this._rendererTexture._DeleteGPUResources(),this._rendererTexture=null,this._renderer=null}_Resize(e,t){if(e===this.GetWidth()&&t===this.GetHeight())return;const r=this._rendererTexture.GetDefaultSampling(),i=this._rendererTexture.IsSampled(),s=this._rendererTexture.CanReadPixels();this._rendererTexture._DeleteGPUResources(),this._rendererTexture=null,this._rendererTexture=this._renderer.CreateDynamicTexture(e,t,{defaultSampling:r,mipMap:!1,isRenderTarget:!0,isSampled:i,canReadPixels:s}),this._CalculateProjection()}_GetTextureView(){return this._isBackBuffer?this._renderer._GetSwapChainTexView():this._rendererTexture._GetTextureView(this._rendererTexture._GetDefaultSamplingIndex())}_CalculateProjection(){this._renderer.CalculatePerspectiveMatrix(this._projectionMatrix,this.GetWidth()/this.GetHeight()),this._lastFov=this._renderer.GetFovY(),this._lastNearZ=this._renderer.GetNearZ(),this._lastFarZ=this._renderer.GetFarZ()}IsDefaultSize(){return this._isDefaultSize}IsBackBuffer(){return this._isBackBuffer}SetDefaultSampling(e){this._rendererTexture.SetDefaultSampling(e)}GetDefaultSampling(){return this._rendererTexture.GetDefaultSampling()}HasDepthBuffer(){return this._depth}GetWidth(){return this._isBackBuffer?this._renderer.GetWidth():this._rendererTexture.GetWidth()}GetHeight(){return this._isBackBuffer?this._renderer.GetHeight():this._rendererTexture.GetHeight()}GetTexture(){if(this._rendererTexture)return this._rendererTexture;throw new Error("no texture")}GetRenderer(){return this._renderer}GetMultisampling(){return this._multisampling}GetProjectionMatrix(){return this._renderer.GetFovY()===this._lastFov&&this._renderer.GetNearZ()===this._lastNearZ&&this._renderer.GetFarZ()===this._lastFarZ||this._CalculateProjection(),this._projectionMatrix}IsSampled(){return this._rendererTexture.IsSampled()}CanReadPixels(){return this._rendererTexture.CanReadPixels()}IsCompatibleWithOptions(e){return!!(e=Object.assign({},DEFAULT_RENDERTARGET_OPTIONS,e)).isSampled===this.IsSampled()&&(!!e.canReadPixels===this.CanReadPixels()&&(!!e.depth===this.HasDepthBuffer()&&("number"==typeof e.width||"number"==typeof e.height?!this.IsDefaultSize()&&this.GetWidth()===Math.floor(e.width)&&this.GetHeight()===Math.floor(e.height):this.IsDefaultSize())))}_SetIsAwaitingClear(e){this._isAwaitingClear=!!e}_IsAwaitingClear(){return this._isAwaitingClear}_GetClearColor(){return this._clearColor}static OnContextLost(){}static allRenderTargets(){return allRenderTargets.values()}}; } // ../lib/gfx/webgpu/timeQuerySet.js { const C3=self.C3;C3.Gfx.WebGPUTimeQuerySet=class{#e;#r=0;#t=null;#s=null;#u=null;constructor(e){this.#e=e}SetQueryCount(e){if(e!==this.#r&&(this.#r=e,this.#t&&this.#t["destroy"](),this.#s&&this.#s["destroy"](),this.#u&&this.#u["destroy"](),this.#r>0)){const e=this.#e._GetDevice();this.#t=e["createQuerySet"]({"count":this.#r,"type":"timestamp"});const r=globalThis["GPUBufferUsage"];this.#s=e["createBuffer"]({"size":this.#f(),"usage":r["QUERY_RESOLVE"]|r["COPY_SRC"]}),this.#u=this.#i()}}GetQueryCount(){return this.#r}#i(){const e=this.#e._GetDevice(),r=globalThis["GPUBufferUsage"];return e["createBuffer"]({"size":this.#f(),"usage":r["COPY_DST"]|r["MAP_READ"]})}#f(){return 8*this.#r}_GetQuerySet(){return this.#t}Resolve(e){e["resolveQuerySet"](this.#t,0,this.#r,this.#s,0),e["copyBufferToBuffer"](this.#s,0,this.#u,0,this.#f())}async GetResult(e){const r=this.#u;this.#u=this.#i();const t=this.#f();await r["mapAsync"](globalThis["GPUMapMode"]["READ"],0,t);const s=r["getMappedRange"](0,t),u=new BigUint64Array(s.slice(0));r["destroy"]();for(let r=0,t=u.length;r<t;++r)e.has(r)||(u[r]=BigInt(0));return u}}; } // ../lib/gfx/webgpu/meshData.js { const C3=globalThis.C3,assert=globalThis.assert,GPUBufferUsage=globalThis["GPUBufferUsage"],SIZEOF_U16=2,SIZEOF_U32=4,SIZEOF_F16=2,SIZEOF_F32=4;C3.Gfx.MeshDataWebGPU=class extends C3.Gfx.MeshData{#e=null;#t=null;#f=null;#s=null;#r=null;WebGPUInitRenderPassVertexBuffers(e){e["setVertexBuffer"](0,this.#e),e["setVertexBuffer"](1,this.#t),e["setVertexBuffer"](2,this.#s),e["setVertexBuffer"](3,this.#f)}WebGPUInitRenderPassIndexBuffer(e){e["setIndexBuffer"](this.#r,this.IsIndexTypeUint16()?"uint16":"uint32")}CreateGPUResources(){if(super.CreateGPUResources(),this.IsSmall())return;const e=this.GetRenderer()._GetDevice(),t=this.GetDebugLabel(),f=t?"-"+t:"";this.#e=e["createBuffer"]({"label":"positionbuffer"+f,"size":this.positions.byteLength,"usage":GPUBufferUsage["VERTEX"]|GPUBufferUsage["COPY_DST"]}),this.#t=e["createBuffer"]({"label":"texcoordbuffer"+f,"size":this.texCoords.byteLength,"usage":GPUBufferUsage["VERTEX"]|GPUBufferUsage["COPY_DST"]}),this.#f=e["createBuffer"]({"label":"texindexbuffer"+f,"size":this.texIndices.byteLength,"usage":GPUBufferUsage["VERTEX"]|GPUBufferUsage["COPY_DST"]}),this.#s=e["createBuffer"]({"label":"colorbuffer"+f,"size":this.colors.byteLength,"usage":GPUBufferUsage["VERTEX"]|GPUBufferUsage["COPY_DST"]}),this.#r=e["createBuffer"]({"label":"indexbuffer"+f,"size":4*Math.ceil(this.indices.byteLength/4),"usage":GPUBufferUsage["INDEX"]|GPUBufferUsage["COPY_DST"]})}WriteGPUData(e){const t=this.GetRenderer(),f=t._GetDevice()["queue"];let s=this.GetPendingBufferUpdate("positions"),r=s.GetPendingChange();if(r){const e=r.end-r.start,t=12;f["writeBuffer"](this.#e,r.start*t,this.positions.buffer,r.start*t,e*t),s.Reset()}if(s=this.GetPendingBufferUpdate("texCoords"),r=s.GetPendingChange(),r){const e=r.end-r.start,t=8;f["writeBuffer"](this.#t,r.start*t,this.texCoords.buffer,r.start*t,e*t),s.Reset()}if(e&&(s=this.GetPendingBufferUpdate("texIndices"),r=s.GetPendingChange(),r)){const e=r.end-r.start;f["writeBuffer"](this.#f,4*r.start,this.texIndices.buffer,4*r.start,4*e),s.Reset()}if(s=this.GetPendingBufferUpdate("colors"),r=s.GetPendingChange(),r){const e=r.end-r.start,i=4*(t.IsColorDataF16()?2:4);f["writeBuffer"](this.#s,r.start*i,this.colors.buffer,r.start*i,e*i),s.Reset()}if(s=this.GetPendingBufferUpdate("indices"),r=s.GetPendingChange(),r){const e=this.IsIndexTypeUint16()?2:4;let t=r.start*e,i=(r.end-r.start)*e;t%4!=0&&(t-=t%4),i%4!=0&&(i+=4-i%4),f["writeBuffer"](this.#r,t,this.indices.buffer,t,i),s.Reset()}}ReleaseGPUResources(){super.ReleaseGPUResources(),this.#e&&(this.#e["destroy"](),this.#e=null),this.#t&&(this.#t["destroy"](),this.#t=null),this.#f&&(this.#f["destroy"](),this.#f=null),this.#s&&(this.#s["destroy"](),this.#s=null),this.#r&&(this.#r["destroy"](),this.#r=null)}OnContextLost(){this.#e=null,this.#t=null,this.#f=null,this.#s=null,this.#r=null}}; } // ../lib/gfx/effectCompositor/effectChainManager.js { const C3=self.C3,DEFAULT_CTOR_OPTS={getDrawSize:null,getRenderTarget:null,releaseRenderTarget:null,getTime:null,redraw:null};C3.Gfx.EffectChainManager=class{constructor(e){e=Object.assign({},DEFAULT_CTOR_OPTS,e),this._cbGetDrawSize=e.getDrawSize,this._cbGetRenderTarget=e.getRenderTarget,this._cbReleaseRenderTarget=e.releaseRenderTarget,this._cbGetTime=e.getTime,this._cbRedraw=e.redraw,this._webgpuBackTexture=null,this._allEffectChains=new Set}_AddEffectChain(e){this._allEffectChains.add(e)}_RemoveEffectChain(e){this._allEffectChains.delete(e)}OnContextLost(){this._webgpuBackTexture=null;for(const e of this._allEffectChains)e.OnContextLost()}GetDrawSize(e){return this._cbGetDrawSize?this._cbGetDrawSize(e):[e.GetWidth(),e.GetHeight()]}GetRenderTarget(e){return this._cbGetRenderTarget(e)}ReleaseRenderTarget(e,t){this._cbReleaseRenderTarget(e,t)}GetTime(){return this._cbGetTime()}Redraw(e){this._cbRedraw(e)}_GetWebGPUBackTexture(e,t,r){return t=Math.floor(t),r=Math.floor(r),!this._webgpuBackTexture||this._webgpuBackTexture.GetWidth()===t&&this._webgpuBackTexture.GetHeight()===r||(e.DeleteTexture(this._webgpuBackTexture),this._webgpuBackTexture=null),null===this._webgpuBackTexture&&(this._webgpuBackTexture=e.CreateStaticTexture(null,{width:t,height:r,mipMap:!1})),this._webgpuBackTexture}}; } // ../lib/gfx/effectCompositor/effectChain.js { const C3=self.C3,assert=self.assert,glMatrix=self.glMatrix,mat4=glMatrix.mat4,tempRect=C3.New(C3.Rect),tempRect2=C3.New(C3.Rect),tempRect3=C3.New(C3.Rect),tempRect4=C3.New(C3.Rect),tempMat4a=mat4.crea … [Строка слишком длинная. Вы можете скачать файл] } // ../lib/gfx/effectCompositor/step.js { const C3=self.C3;C3.Gfx.EffectChain.Step=class{constructor(t,e,r,s=-1){this._effectChain=t,this._srcTargetId=e,this._destTargetId=r,this._index=s}GetEffectChain(){return this._effectChain}GetSrcTargetId(){return this._srcTargetId}GetDestTargetId(){return this._destTargetId}GetIndex(){return this._index}GetShaderProgram(){return this.GetEffectChain()._GetShaderProgramAt(this.GetIndex())}Run_WebGL(t,e,r){}Run_WebGPU(t,e,r){}}; } // ../lib/gfx/effectCompositor/preDrawStep.js { const C3=self.C3;C3.Gfx.EffectChain.Step.PreDraw=class extends C3.Gfx.EffectChain.Step{constructor(e,t,a,n){super(e,t,a,n)}Run_WebGL(e,t,a){const n=this.GetEffectChain();e.SetAlphaBlend(),e.ResetCullState(),e.SetTextureFillMode(),e.SetRenderTarget(a,n._UpdateOwnProjection()),e.ClearRgba(0,0,0,0),n._DrawContent(e),n._ClampRcTexDest()}Run_WebGPU(e,t,a){const n=this.GetEffectChain();e.SetAlphaBlend(),e.ResetCullState(),e.SetTextureFillMode(),e.SetRenderTarget(a,!1),e.ClearRgba(0,0,0,0),n._DrawContent(e),n._ClampRcTexDest()}}; } // ../lib/gfx/effectCompositor/postDrawStep.js { const C3=self.C3,tempRect=C3.New(C3.Rect),tempQuad=C3.New(C3.Quad2D);C3.Gfx.EffectChain.Step.PostDraw=class extends C3.Gfx.EffectChain.Step{constructor(e,t,r,a){super(e,t,r,a)}Run_WebGL(e,t,r){const a=this.GetEffectChain();e.SetTextureFillMode(),e.SetRenderTarget(r),a._SetDeviceTransform(e,!0),e.SetBlendMode(a._GetBlendMode()),e.SetTexture(t.GetTexture()),tempQuad.setFromRect(a._GetDrawSurfaceRect()),tempRect.copy(a._GetRcTexBounce()),tempRect.flipAround(1),e.Quad3(tempQuad,tempRect),a._ShouldInvalidateRenderTargets()&&e.InvalidateRenderTarget(t)}Run_WebGPU(e,t,r){const a=this.GetEffectChain();e.SetTextureFillMode(),e.SetRenderTarget(r,!1),a._IsRenderTargetSameSizeAndOffset(e)?tempQuad.setFromRect(a._GetRcTexBounce()):(e.SetNormalizedCoordsProgramVariant(!1),a._SetDeviceTransform(e,!0),tempQuad.setFromRect(a._GetDrawSurfaceRect())),e.SetBackTexture(null),e.SetBlendMode(a._GetBlendMode()),e.SetTexture(t.GetTexture()),a.UseFullSurface()?e.FullscreenQuad():e.Quad3(tempQuad,a._GetRcTexBounce())}}; } // ../lib/gfx/effectCompositor/firstBounceStep.js { const C3=self.C3;C3.Gfx.EffectChain.Step.FirstBounce=class extends C3.Gfx.EffectChain.Step{constructor(e,t,r,a){super(e,t,r,a)}Run_WebGL(e,t,r){const a=this.GetEffectChain();e.SetRenderTarget(r,a._UpdateOwnProjection()),e.ClearRgba(0,0,0,0),e.SetCopyBlend(),e.SetProgram(this.GetShaderProgram()),a._SetFirstBounceProgramParameters(e,this.GetIndex()),a._DrawContent(e),a._ClampRcTexDest()}Run_WebGPU(e,t,r){const a=this.GetEffectChain();e.SetRenderTarget(r,!1),e.ClearRgba(0,0,0,0),e.SetCopyBlend(),e.SetProgram(this.GetShaderProgram()),a._SetFirstBounceProgramParameters(e,this.GetIndex()),a._DrawContent(e),a._ClampRcTexDest()}}; } // ../lib/gfx/effectCompositor/bounceStep.js { const C3=self.C3,tempRect=C3.New(C3.Rect),tempQuad=C3.New(C3.Quad2D);C3.Gfx.EffectChain.Step.Bounce=class extends C3.Gfx.EffectChain.Step{constructor(e,t,r,a){super(e,t,r,a)}Run_WebGL(e,t,r){const a=this.GetEffectChain();e.SetRenderTarget(r);const d=0===this.GetDestTargetId();d?e.SetBlendMode(a._GetBlendMode()):(e.ClearRgba(0,0,0,0),e.SetCopyBlend()),e.SetProgram(this.GetShaderProgram()),a._SetProgramParameters(e,this.GetIndex()),e.SetTexture(t.GetTexture()),a._SetDeviceTransform(e,d),tempQuad.setFromRect(a._GetDrawSurfaceRect()),tempRect.copy(a._GetRcTexBounce()),tempRect.flipAround(1),e.Quad3(tempQuad,tempRect),a._ShouldInvalidateRenderTargets()&&e.InvalidateRenderTarget(t)}Run_WebGPU(e,t,r){const a=this.GetEffectChain();e.SetRenderTarget(r,!1);0===this.GetDestTargetId()?(e.SetBlendMode(a._GetBlendMode()),e.SetBackTexture(null),a._IsRenderTargetSameSizeAndOffset(e)?tempQuad.setFromRect(a._GetRcTexBounce()):(e.SetNormalizedCoordsProgramVariant(!1),a._SetDeviceTransform(e,!0),tempQuad.setFromRect(a._GetDrawSurfaceRect()))):(e.ClearRgba(0,0,0,0),e.SetCopyBlend(),tempQuad.setFromRect(a._GetRcTexBounce())),e.SetProgram(this.GetShaderProgram()),a._SetProgramParameters(e,this.GetIndex()),e.SetTexture(t.GetTexture()),a.UseFullSurface()?e.FullscreenQuad():e.Quad3(tempQuad,a._GetRcTexBounce())}}; } // interfaces/IRuntime.js { const C3=self.C3,C3X=self.C3X;let runtime=null;const keysDownByKey=new Set,loggedDeprecationIds=new Set;function SortZOrderList(e,t){const r=e[0]-t[0];if(0!==r)return r;return e[1]-t[1]}const tempZOrd … [Строка слишком длинная. Вы можете скачать файл] } // interfaces/other/IAssetManager.js { const C3=self.C3,C3X=self.C3X;let assetManager=null;self.IAssetManager=class{constructor(e){assetManager=e,Object.defineProperties(this,{runtime:{value:assetManager.GetRuntime().GetIRuntime(),writable:!1}})}get isWebMOpusSupported(){return this.runtime._logDeprecationWarning("IAssetManager.isWebMOpusSupported","IAssetManager 'isWebMOpusSupported' property is deprecated. It is always true."),!0}loadImageAsset(e){const t=self.IImageInfo._Unwrap(e);if(!t)throw new Error("invalid IImageInfo");t.LoadAsset(assetManager.GetRuntime())}fetchText(e){return assetManager.FetchText(e)}fetchJson(e){return assetManager.FetchJson(e)}fetchBlob(e){return assetManager.FetchBlob(e)}fetchArrayBuffer(e){return assetManager.FetchArrayBuffer(e)}getProjectFileUrl(e){return Promise.resolve(assetManager.GetProjectFileUrl(e))}getMediaFileUrl(e){return assetManager.GetMediaFileUrl(e)}get mediaFolder(){return assetManager.GetMediaSubfolder()}async decodeWebMOpus(e,t){throw new Error("decodeWebMOpus() is no longer supported - use Web Audio's decodeAudioData() directly as all supported platforms now support WebM Opus")}loadScripts(...e){return assetManager.LoadScripts(...e)}compileWebAssembly(e){return assetManager.CompileWebAssembly(e)}loadStyleSheet(e){return assetManager.LoadStyleSheet(e)}get projectFileList(){return assetManager.GetExportedFileList()}}; } // interfaces/other/ICollisionEngine.js { const C3=self.C3,C3X=self.C3X;let collisionEngine=null;self.ICollisionEngine=class{constructor(n){collisionEngine=n,Object.defineProperties(this,{runtime:{value:collisionEngine.GetRuntime(),writable:!1}})}testOverlap(n,e){const l=collisionEngine.GetRuntime(),i=l._UnwrapIWorldInstance(n),t=l._UnwrapIWorldInstance(e);return collisionEngine.TestOverlap(i,t)}testOverlapAny(n,e){const l=collisionEngine.GetRuntime(),i=l._UnwrapIWorldInstance(n);for(const n of e){const e=l._UnwrapIWorldInstance(n);if(collisionEngine.TestOverlap(i,e))return n}return null}testOverlapSolid(n){const e=collisionEngine.GetRuntime()._UnwrapIWorldInstance(n),l=collisionEngine.TestOverlapSolid(e);return l?l.GetInterfaceClass():null}setCollisionCellSize(n,e){if(C3X.RequireFiniteNumber(n),C3X.RequireFiniteNumber(e),n=Math.floor(n),e=Math.floor(e),n<=0||e<=0)throw new Error("invalid cell size");collisionEngine.SetCollisionCellSize(n,e)}getCollisionCellSize(){return collisionEngine.GetCollisionCellSize()}getCollisionCandidates(n,e){const l=collisionEngine.GetRuntime();let i;i=Array.isArray(n)?n.map(n=>l._UnwrapIObjectClass(n)):[l._UnwrapIObjectClass(n)];const t=C3.Rect.FromObject(e),o=[];return collisionEngine.GetObjectClassesCollisionCandidates(null,i,t,o),o.map(n=>n.GetInterfaceClass())}}; } // interfaces/other/IPlatformInfo.js { const C3=self.C3,C3X=self.C3X;let runtime=null;const osMap=new Map([["Windows","windows"],["macOS","macos"],["Linux","linux"],["Chrome OS","chrome-os"],["Android","android"],["iOS","ios"]]),browserMap=new Map([["Chrome","chrome"],["Chromium","chromium"],["Edge","edge"],["Opera","opera"],["Firefox","firefox"],["Safari","safari"]]),browserEngineMap=new Map([["Chromium","chromium"],["Gecko","gecko"],["WebKit","webkit"]]);self.IPlatformInfo=class{constructor(e){runtime=e,Object.defineProperties(this,{isMobile:{value:C3.Platform.IsMobile,writable:!1},os:{value:osMap.get(C3.Platform.OS)||"unknown",writable:!1},osVersion:{value:C3.Platform.OSVersion,writable:!1},browser:{value:browserMap.get(C3.Platform.Browser)||"unknown",writable:!1},browserVersion:{value:C3.Platform.BrowserVersion,writable:!1},browserEngine:{value:browserEngineMap.get(C3.Platform.BrowserEngine)||"unknown",writable:!1}})}get exportType(){let e=runtime.GetExportType();return runtime.IsWindowsWebView2()?e="windows-webview2":"cordova"===e?e="Android"===C3.Platform.OS?"cordova-android":"cordova-ios":"playable-ad-single-file"!==e&&"playable-ad-zip"!==e||(e="playable-ad"),e}get renderer(){return runtime.GetCanvasManager().GetRendererString()}get rendererDetail(){return runtime.GetCanvasManager().GetRendererDetailString()}get canvasClientX(){return runtime.GetCanvasManager().GetCanvasClientX()}get canvasClientY(){return runtime.GetCanvasManager().GetCanvasClientY()}get canvasCssWidth(){return runtime.GetCanvasManager().GetCssWidth()}get canvasCssHeight(){return runtime.GetCanvasManager().GetCssHeight()}get canvasDeviceWidth(){return runtime.GetCanvasManager().GetDeviceWidth()}get canvasDeviceHeight(){return runtime.GetCanvasManager().GetDeviceHeight()}get devicePixelRatio(){return runtime.GetDevicePixelRatio()}}; } // interfaces/other/IStorage.js { const C3=self.C3,C3X=self.C3X;self.IStorage=class{constructor(e){this._storage=e._GetProjectStorage()}getItem(e){return C3X.RequireString(e),this._storage.getItem(e)}setItem(e,t){return C3X.RequireString(e),this._storage.setItem(e,t)}removeItem(e){return C3X.RequireString(e),this._storage.removeItem(e)}clear(){return this._storage.clear()}keys(){return this._storage.keys()}}; } // interfaces/util/IAABB3D.js { const C3=globalThis.C3,C3X=globalThis.C3X;globalThis.IAABB3D=class t{#t;constructor(t,a,b,s,e,o){this.#t=new C3.AABB3D(t??0,a??0,b??0,s??0,e??0,o??0),t instanceof C3.AABB3D&&this.#t.copy(t)}clone(){return new t(this.left,this.top,this.back,this.right,this.bottom,this.front)}copy(t){this.#t.set(t.left,t.top,t.back,t.right,t.bottom,t.front)}set(t,a,b,s,e,o){this.#t.set(t,a,b,s,e,o)}set left(t){this.#t.setLeft(t)}get left(){return this.#t.getLeft()}set top(t){this.#t.setTop(t)}get top(){return this.#t.getTop()}set back(t){this.#t.setBack(t)}get back(){return this.#t.getBack()}set right(t){this.#t.setRight(t)}get right(){return this.#t.getRight()}set bottom(t){this.#t.setBottom(t)}get bottom(){return this.#t.getBottom()}set front(t){this.#t.setFront(t)}get front(){return this.#t.getFront()}}; } // interfaces/objects/IPlugin.js { const C3=self.C3,C3X=self.C3X,internalApiToken=C3._GetInternalAPIToken();self.IPlugin=class{#e;constructor(){const e=C3.AddonManager._GetInitObject2(internalApiToken);this.#e=e,Object.defineProperties(this,{runtime:{value:e.GetRuntime().GetIRuntime(),writable:!1},id:{value:e.GetID(),writable:!1},isSingleGlobal:{value:e.IsSingleGlobal(),writable:!1},isWorldType:{value:e.IsWorldType(),writable:!1},isHTMLElementType:{value:e.IsHTMLElementType(),writable:!1},isRotatable:{value:e.IsRotatable(),writable:!1},hasEffects:{value:e.HasEffects(),writable:!1},is3d:{value:e.Is3D(),writable:!1},supportsHierarchies:{value:e.SupportsSceneGraph(),writable:!1},supportsMesh:{value:e.SupportsMesh(),writable:!1}}),e.GetRuntime()._MapScriptInterface(this,e)}static getByConstructor(e){if(!e)return null;const t=C3.AddonManager.GetPluginByConstructorFunction(e);return t?t.GetIPlugin():null}getSingleGlobalObjectType(){return this.#e.GetSingleGlobalObjectClass().GetIObjectClass()}getSingleGlobalInstance(){return this.#e.GetSingleGlobalInstance().GetInterfaceClass()}}; } // interfaces/objects/IObjectClass.js { const C3=globalThis.C3,C3X=globalThis.C3X,internalApiToken=C3._GetInternalAPIToken();globalThis.IObjectClass=class{#e;constructor(){const e=C3.AddonManager._GetInitObject2(internalApiToken);this.#e=e,Object.defineProperties(this,{name:{value:e.GetName(),writable:!1},runtime:{value:e.GetRuntime().GetIRuntime(),writable:!1},plugin:{value:e.GetPlugin().GetIPlugin(),writable:!1}}),e.GetRuntime()._MapScriptInterface(this,e)}addEventListener(e,t){C3X.RequireString(e),C3X.RequireFunction(t),this.#e.UserScriptDispatcher().addEventListener(e,t)}removeEventListener(e,t){C3X.RequireString(e),C3X.RequireFunction(t),this.#e.UserScriptDispatcher().removeEventListener(e,t)}getAllInstances(){return[...this.instances()]}getFirstInstance(){return C3.first(this.instances())}getPickedInstances(){return[...this.pickedInstances()]}getFirstPickedInstance(){return C3.first(this.pickedInstances())}getPairedInstance(e){const t=this.#e,n=t.GetRuntime()._UnwrapIInstance(e),s=t.GetPairedInstance(n);return s?s.GetInterfaceClass():null}*instances(){for(const e of this.#e.instancesIncludingPendingCreate())yield e.GetInterfaceClass()}*pickedInstances(){for(const e of this.#e.GetCurrentSol().GetInstances())yield e.GetInterfaceClass()}callCustomAction(e,t,...n){C3X.RequireString(e);const s=this.#e,i=s.GetRuntime(),r=i.GetEventSheetManager(),a=r.GetCustomActionBlockByName(s,e);if(!a)throw new Error(`cannot find '${this.name}' custom action '${e}'`);if(!a.IsEnabled())return null;if(n.length<a.GetFunctionParameterCount())throw new Error(`not enough function parameters passed for '${this.name}' custom action '${e}' (${n.length} passed, ${a.GetFunctionParameterCount()} expected)`);const c=a.GetEventBlock();let o=c.GetSolModifiersIncludingParents();const l=r.GetCurrentEvent();if(l){o=o.slice(0);const e=new Set(o);for(const t of l.GetSolModifiersIncludingParents())e.has(t)||(o.push(t),e.add(t));for(const t of r.GetDynamicSolModifiersSet())e.has(t)||(o.push(t),e.add(t))}if(s.IsFamily()&&a.HasCustomACEOverrides()){const r=new Map,l=[];for(const n of t){const t=i._UnwrapIInstance(n),s=t.GetObjectClass();if(s.HasOwnCustomActionByName(e)){const e=r.get(s);Array.isArray(e)?e.push(t):r.set(s,[t])}else l.push(t)}const u=[];if(l.length>0){const e={pickObjectClass:s,pickInstances:l},t=c.RunAsExpressionOrJSFunctionCall(o,a.IsCopyPicked(),0,null,e,...n);u.push(t)}if(r.size>0)for(const[t,s]of r){const i=t.GetOwnCustomActionByName(e).GetEventBlock(),r=[...new Set([...o,...i.GetSolModifiers()])],c={pickObjectClass:t,pickInstances:s},l=i.RunAsExpressionOrJSFunctionCall(r,a.IsCopyPicked(),0,null,c,...n);u.push(l)}return Promise.all(u)}{const e={pickObjectClass:a.GetObjectClass(),pickInstances:(Array.isArray(t)?t:[...t]).map(e=>i._UnwrapIInstance(e))},s=c.RunAsExpressionOrJSFunctionCall(o,a.IsCopyPicked(),0,null,e,...n);return s instanceof Promise?s:Promise.resolve()}}}; } // interfaces/objects/IObjectType.js { const C3=globalThis.C3,C3X=globalThis.C3X,internalApiToken=C3._GetInternalAPIToken();globalThis.IObjectType=class extends globalThis.IObjectClass{#e;constructor(){super();const e=C3.AddonManager._GetInitObject2(internalApiToken);this.#e=e}setInstanceClass(e){C3X.RequireFunction(e);const t=this.#e;if(t.GetInstanceCount()>0)throw new Error("setInstanceClass() called too late, because instances have already been created - call in runOnStartup");t._SetUserScriptInstanceClass(e)}createInstance(e,t,n,a,s){if(C3X.RequireNumber(t),C3X.RequireNumber(n),"number"!=typeof e&&"string"!=typeof e)throw new TypeError("invalid layer parameter");const r=this.#e,i=r.GetRuntime(),l=i.GetMainRunningLayout().GetLayer(e);if(!l)throw new Error("invalid layer");const c=i.CreateInstance(r,l,t,n,a,s);a&&l.SortAndAddInstancesByZIndex(c);const o=i.GetEventSheetManager();return o.BlockFlushingInstances(!0),c._TriggerOnCreatedOnSelfAndRelated(),o.BlockFlushingInstances(!1),o.IsInEventEngine()||i.GetLayoutManager().IsEndingLayout()||i.FlushPendingInstances(),c.GetInterfaceClass()}getAllFamilies(){return this.#e.GetFamilies().map(e=>e.GetIObjectClass())}*families(){for(const e of this.#e.GetFamilies())yield e.GetIObjectClass()}isInFamily(e){return C3X.RequireInstanceOf(e,globalThis.IFamily),e.hasObjectType(this)}}; } // interfaces/objects/IFamily.js { const C3=globalThis.C3,C3X=globalThis.C3X,IObjectType=globalThis.IObjectType,internalApiToken=C3._GetInternalAPIToken();globalThis.IFamily=class extends globalThis.IObjectClass{#e;constructor(){super();const e=C3.AddonManager._GetInitObject2(internalApiToken);this.#e=e}getAllObjectTypes(){return this.#e.GetFamilyMembers().map(e=>e.GetIObjectClass())}*objectTypes(){for(const e of this.#e.GetFamilyMembers())yield e.GetIObjectClass()}hasObjectType(e){C3X.RequireInstanceOf(e,IObjectType);const t=this.#e,s=t.GetRuntime()._UnwrapIObjectClass(e);return t.FamilyHasMember(s)}}; } // interfaces/layouts/ILayout.js { const C3=self.C3,C3X=self.C3X,VALID_WHERE_STRINGS=["above","below","top-sublayer","bottom-sublayer"];self.ILayout=class{#e;constructor(e){this.#e=e;const t=[],r=e.GetEffectList(),i=r.GetAllEffectTypes().length;for(let e=0;e<i;++e){const i=new self.IEffectInstance(r,e);t.push(i),t[i.name]=i}Object.defineProperties(this,{runtime:{value:e.GetRuntime().GetIRuntime(),writable:!1},name:{value:e.GetName(),writable:!1},index:{value:e.GetIndex(),writable:!1},effects:{value:t,writable:!1}})}addEventListener(e,t){C3X.RequireString(e),C3X.RequireFunction(t),this.#e.UserScriptDispatcher().addEventListener(e,t)}removeEventListener(e,t){C3X.RequireString(e),C3X.RequireFunction(t),this.#e.UserScriptDispatcher().removeEventListener(e,t)}get width(){return this.#e.GetWidth()}set width(e){C3X.RequireFiniteNumber(e),this.#e.SetWidth(e)}get height(){return this.#e.GetHeight()}set height(e){C3X.RequireFiniteNumber(e),this.#e.SetHeight(e)}setSize(e,t){C3X.RequireFiniteNumber(e),C3X.RequireFiniteNumber(t);const r=this.#e;r.SetWidth(e),r.SetHeight(t)}getSize(){const e=this.#e;return[e.GetWidth(),e.GetHeight()]}set scale(e){C3X.RequireFiniteNumber(e),this.#e.SetScale(e)}get scale(){return this.#e.GetScale()}set angle(e){C3X.RequireFiniteNumber(e),this.#e.SetAngle(e)}get angle(){return this.#e.GetAngle()}set scrollX(e){C3X.RequireNumber(e),this.#e.SetScrollX(e)}get scrollX(){return this.#e.GetScrollX()}set scrollY(e){C3X.RequireNumber(e),this.#e.SetScrollY(e)}get scrollY(){return this.#e.GetScrollY()}set sampling(e){this.#e.SetSamplingMode(e)}get sampling(){return this.#e.GetSamplingMode()}get activeSampling(){return this.#e.GetActiveSampling()}scrollTo(e,t){C3X.RequireNumber(e),C3X.RequireNumber(t);const r=this.#e;r.SetScrollX(e),r.SetScrollY(t)}getScrollPosition(){const e=this.#e;return[e.GetScrollX(),e.GetScrollY()]}get isUnboundedScrolling(){return this.#e.IsUnboundedScrolling()}getLayer(e){const t=this.#e;let r=null;if("number"!=typeof e&&"string"!=typeof e)throw new TypeError("expected string or number");return r=t.GetLayer(e),r?r.GetILayer():null}getAllLayers(){return this.#e.GetLayers().map(e=>e.GetILayer())}*allLayers(){for(const e of this.#e.allLayers())yield e.GetILayer()}addLayer(e,t,r){const i=this.#e,n=self.ILayer;C3X.RequireString(e),C3X.RequireOptionalInstanceOf(t,n);const a=t?i.GetRuntime()._UnwrapScriptInterface(t):null,s=VALID_WHERE_STRINGS.indexOf(r);if(s<0)throw new Error("invalid location");i.AddLayer(e,a,s)}moveLayer(e,t,r){const i=this.#e,n=i.GetRuntime(),a=self.ILayer;C3X.RequireInstanceOf(e,a);const s=n._UnwrapScriptInterface(e);if(!s)throw new Error("invalid layer");C3X.RequireOptionalInstanceOf(t,a);const o=t?n._UnwrapScriptInterface(t):null,l=VALID_WHERE_STRINGS.indexOf(r);if(l<0)throw new Error("invalid location");i.MoveLayer(s,o,l)}removeLayer(e){const t=this.#e,r=self.ILayer;C3X.RequireInstanceOf(e,r);const i=t.GetRuntime()._UnwrapScriptInterface(e);if(!i)throw new Error("invalid layer");const n=i.GetRuntime();t.RemoveLayer(i),n.GetEventSheetManager().IsInEventEngine()||n.FlushPendingInstances()}removeAllDynamicLayers(){const e=this.#e,t=e.GetRuntime();e.RemoveAllDynamicLayers(),t.GetEventSheetManager().IsInEventEngine()||t.FlushPendingInstances()}setVanishingPoint(e,t){C3X.RequireFiniteNumber(e),C3X.RequireFiniteNumber(t),this.#e.SetVanishingPointXY(e,t)}getVanishingPoint(){return this.#e.GetVanishingPoint()}set projection(e){C3X.RequireString(e);const t=this.#e;if("perspective"===e)t.SetPerspectiveProjection();else{if("orthographic"!==e)throw new Error("invalid projection");t.SetOrthographicProjection()}}get projection(){return this.#e.IsOrthographicProjection()?"orthographic":"perspective"}}; } // interfaces/layouts/ILayer.js { const C3=self.C3,C3X=self.C3X,BLEND_MODE_TO_INDEX=new Map([["normal",0],["additive",1],["copy",3],["destination-over",4],["source-in",5],["destination-in",6],["source-out",7],["destination-out",8],["source-atop",9],["destination-atop",10],["lighten",11],["darken",12],["multiply",13],["screen",14]]),INDEX_TO_BLEND_MODE=new Map([...BLEND_MODE_TO_INDEX.entries()].map(e=>[e[1],e[0]])),VALID_RENDERING_MODES=new Set(["2d","3d"]),tempColor=C3.New(C3.Color);self.ILayer=class{#e;constructor(e){this.#e=e;const t=[],r=e.GetEffectList(),i=r.GetAllEffectTypes().length;for(let e=0;e<i;++e){const i=new self.IEffectInstance(r,e);t.push(i),t[i.name]=i}Object.defineProperties(this,{runtime:{value:e.GetRuntime().GetIRuntime(),writable:!1},name:{value:e.GetName(),writable:!1},layout:{value:e.GetLayout().GetILayout(),writable:!1},effects:{value:t,writable:!1}}),e.GetRuntime()._MapScriptInterface(this,e)}addEventListener(e,t){this.#e.UserScriptDispatcher().addEventListener(e,t)}removeEventListener(e,t){this.#e.UserScriptDispatcher().removeEventListener(e,t)}get parentLayer(){const e=this.#e.GetParentLayer();return e?e.GetILayer():null}*parentLayers(){for(const e of this.#e.parentLayers())yield e.GetILayer()}*subLayers(){for(const e of this.#e.GetSubLayers())yield e.GetILayer()}*allSubLayers(){for(const e of this.#e.GetSubLayers())for(const t of e.selfAndAllSubLayers())yield t.GetILayer()}get index(){return this.#e.GetIndex()}get isVisible(){return this.#e._IsVisibleFlagSet()}set isVisible(e){this.#e.SetVisible(e)}get isSelfAndParentsVisible(){return this.#e.IsVisible()}get isInteractive(){return this.#e.IsInteractive()}set isInteractive(e){this.#e.SetInteractive(e)}get isHTMLElementsLayer(){return this.#e.IsHTMLElementsLayer()}set isHTMLElementsLayer(e){this.#e.SetIsHTMLElementsLayer(!!e)}get isSelfAndParentsInteractive(){return this.#e.IsSelfAndParentsInteractive()}get opacity(){return this.#e.GetOpacity()}set opacity(e){e=C3.clamp(+e,0,1),isNaN(e)||this.#e.SetOpacity(e)}set scale(e){C3X.RequireFiniteNumber(e),this.#e.SetOwnScale(e)}get scale(){return this.#e.GetOwnScale()}set scaleRate(e){C3X.RequireFiniteNumber(e),this.#e.SetScaleRate(e)}get scaleRate(){return this.#e.GetScaleRate()}set angle(e){C3X.RequireFiniteNumber(e),this.#e.SetAngle(e)}get angle(){return this.#e.GetOwnAngle()}set parallaxX(e){C3X.RequireFiniteNumber(e),this.#e.SetParallaxX(e)}get parallaxX(){return this.#e.GetParallaxX()}set parallaxY(e){C3X.RequireFiniteNumber(e),this.#e.SetParallaxY(e)}get parallaxY(){return this.#e.GetParallaxY()}set zElevation(e){C3X.RequireFiniteNumber(e),this.#e.SetZElevation(e)}get zElevation(){return this.#e.GetZElevation()}set renderingMode(e){if(!VALID_RENDERING_MODES.has(e))throw TypeError("invalid rendering mode");this.#e.SetRenderAs3D("3d"===e)}get renderingMode(){return this.#e.IsRenderAs3D()?"3d":"2d"}set isTransparent(e){this.#e.SetTransparent(e)}get isTransparent(){return this.#e.IsTransparent()}set isForceOwnTexture(e){this.#e.SetForceOwnTexture(e)}get isForceOwnTexture(){return this.#e.IsForceOwnTexture()}set blendMode(e){C3X.RequireString(e);const t=BLEND_MODE_TO_INDEX.get(e);if("number"!=typeof t)throw new Error("invalid blend mode");this.#e.SetBlendMode(t)}get blendMode(){return INDEX_TO_BLEND_MODE.get(this.#e.GetBlendMode())}set backgroundColor(e){if(C3X.RequireArray(e),e.length<3)throw new Error("expected 3 elements");tempColor.setRgb(e[0],e[1],e[2]);const t=this.#e,r=t.GetBackgroundColor();r.equalsIgnoringAlpha(tempColor)||(r.copyRgb(tempColor),t.GetRuntime().UpdateRender())}get backgroundColor(){const e=this.#e.GetBackgroundColor();return[e.getR(),e.getG(),e.getB()]}set sampling(e){this.#e.SetSamplingMode(e)}get sampling(){return this.#e.GetSamplingMode()}get activeSampling(){return this.#e.GetActiveSampling()}set scrollX(e){C3X.RequireNumber(e);const t=this.#e;t.SetOwnScrollPositionEnabled(!0),t.SetScrollX(e)}get scrollX(){return this.#e.GetScrollX()}set scrollY(e){C3X.RequireNumber(e);const t=this.#e;t.SetOwnScrollPositionEnabled(!0),t.SetScrollY(e)}get scrollY(){return this.#e.GetScrollY()}scrollTo(e,t){C3X.RequireNumber(e),C3X.RequireNumber(t);const r=this.#e;r.SetOwnScrollPositionEnabled(!0),r.SetScrollX(e),r.SetScrollY(t)}getScrollPosition(){const e=this.#e;return[e.GetScrollX(),e.GetScrollY()]}restoreScrollPosition(){this.#e.SetOwnScrollPositionEnabled(!1)}getViewport(){return this.#e.GetViewport().toDOMRect()}cssPxToLayer(e,t,r=0){C3X.RequireNumber(e),C3X.RequireNumber(t),C3X.RequireNumber(r);const i=this.#e,a=i.GetRuntime();return i.CanvasCssToLayer(e-a.GetCanvasClientX(),t-a.GetCanvasClientY(),r)}layerToCssPx(e,t,r=0){C3X.RequireNumber(e),C3X.RequireNumber(t),C3X.RequireNumber(r);const i=this.#e,a=i.GetRuntime(),[s,n]=i.LayerToCanvasCss(e,t,r);return[s+a.GetCanvasClientX(),n+a.GetCanvasClientY()]}drawSurfaceToLayer(e,t,r=0){return C3X.RequireNumber(e),C3X.RequireNumber(t),C3X.RequireNumber(r),this.#e.DrawSurfaceToLayer(e,t,r)}layerToDrawSurface(e,t,r=0){return C3X.RequireNumber(e),C3X.RequireNumber(t),C3X.RequireNumber(r),this.#e.LayerToDrawSurface(e,t,r)}get renderScale(){return this.#e.GetRenderScale()}}; } // interfaces/objects/IInstance.js { const C3=self.C3,C3X=self.C3X,dispatchers=new WeakMap,internalApiToken=C3._GetInternalAPIToken();function GetDispatcher(e){let t=dispatchers.get(e);return t||(t=C3.New(C3.Event.Dispatcher),dispatchers.set(e,t),t)}self.IInstance=class{#e;constructor(){const e=C3.AddonManager._GetInitObject2(internalApiToken);this.#e=e;const t={runtime:{value:e.GetRuntime().GetIRuntime(),writable:!1},objectType:{value:e.GetObjectClass().GetIObjectClass(),writable:!1},plugin:{value:e.GetPlugin().GetIPlugin(),writable:!1}};e._GetInstVarsScriptDescriptor(t),e._GetBehaviorsScriptDescriptor(t),Object.defineProperties(this,t),e.GetRuntime()._MapScriptInterface(this,e)}static _GetInitInst(){return C3.AddonManager._GetInitObject()}_release(){const e=dispatchers.get(this);e&&(e.Release(),dispatchers.delete(this))}addEventListener(e,t,i){C3X.RequireString(e),C3X.RequireFunction(t),GetDispatcher(this).addEventListener(e,t,i)}removeEventListener(e,t,i){C3X.RequireString(e),C3X.RequireFunction(t),GetDispatcher(this).removeEventListener(e,t,i)}dispatchEvent(e){GetDispatcher(this).dispatchEvent(e)}destroy(){const e=this.#e,t=e.GetRuntime();t.DestroyInstance(e),t.GetEventSheetManager().IsInEventEngine()||t.GetLayoutManager().IsEndingLayout()||t.GetEventSheetManager().IsFlushingBlocked()||t.FlushPendingInstances()}getOtherContainerInstances(){const e=this.#e.GetSiblings();return e?e.map(e=>e.GetInterfaceClass()):[]}*otherContainerInstances(){const e=this.#e;if(e.IsInContainer())for(const t of e.siblings())yield t.GetInterfaceClass()}get uid(){return this.#e.GetUID()}get iid(){return this.#e.GetIID()}get templateName(){return this.#e.GetTemplateName()}set timeScale(e){C3X.RequireFiniteNumber(e),this.#e.SetTimeScale(e)}get timeScale(){return this.#e.GetActiveTimeScale()}restoreTimeScale(){this.#e.RestoreTimeScale()}get dt(){const e=this.#e;return e.GetRuntime().GetDt(e)}hasTag(e){return C3X.RequireString(e),this.#e.HasTag(e)}hasTags(...e){C3X.RequireArray(e);const t=new Set(e.map(e=>e.toLowerCase())),i=this.#e.GetLowercaseTagsSet();return t.isSubsetOf(i)}setAllTags(e){this.#e.SetTagsSet(C3.ensureSet(e))}getAllTags(){return new Set(this.#e.GetTagsSet())}signal(e){C3X.RequireString(e);const t=this.#e;t.GetRuntime().GetEventSheetManager().InstanceSignal(t,e)}waitForSignal(e){C3X.RequireString(e);const t=this.#e;return t.GetRuntime().GetEventSheetManager().WaitForInstanceSignal(t,e)}callCustomAction(e,...t){return this.objectType.callCustomAction(e,[this],...t)}}; } // interfaces/sdk/ISDKInstanceBase.js { const C3=self.C3,C3X=self.C3X,internalApiToken=C3._GetInternalAPIToken();self.ISDKInstanceBase=class extends self.IInstance{#e;#t=!1;#n=null;#i=!1;#r=null;#s;#o;constructor(e){super(),this.#e=C3.AddonManager._GetInitObject2(internalApiToken),this.#t=!1,this.#n=null,this.#i=!1,this.#r=null,this.#s=e?.domComponentId,this.#o=e?.wrapperComponentId}_release(){this._setTicking(!1),this._setTicking2(!1),super._release()}_getInitProperties(){return C3.AddonManager._GetInitProperties()}_trigger(e){const t=this.#e;t.GetRuntime().Trigger(e,t)}_triggerAsync(e){const t=this.#e;return t.GetRuntime().TriggerAsync(e,t)}_addDOMMessageHandler(e,t){if(C3X.RequireString(e),C3X.RequireFunction(t),!this.#s)throw new Error("no DOM component id set");this.#e.GetRuntime().AddDOMComponentMessageHandler(this.#s,e,t)}_addDOMMessageHandlers(e){C3X.RequireArray(e);for(const[t,n]of e)this._addDOMMessageHandler(t,n)}_postToDOM(e,t){if(C3X.RequireString(e),!this.#s)throw new Error("no DOM component id set");this.#e.GetRuntime().PostComponentMessageToDOM(this.#s,e,t)}_postToDOMAsync(e,t){if(C3X.RequireString(e),!this.#s)throw new Error("no DOM component id set");return this.#e.GetRuntime().PostComponentMessageToDOMAsync(this.#s,e,t)}_postToDOMMaybeSync(e,t){if(!this.#e.GetRuntime().IsInWorker())return window["c3_runtimeInterface"]["_OnMessageFromRuntime"]({"type":"event","component":this.#s,"handler":e,"data":t,"responseId":null});this._postToDOM(e,t)}_setTicking(e){if(e=!!e,this.#t===e)return;this.#t=e;const t=this.#e.GetRuntime();if(e){if(!this.#n)if(this.#e.GetRuntime().IsDebug()){const e=globalThis.C3Debugger,t=this.plugin;this.#n=()=>{const n=performance.now();this._tick(),e.AddIndividualPluginTickTime(t,performance.now()-n)}}else this.#n=()=>this._tick();t.Dispatcher().addEventListener("tick",this.#n)}else t.Dispatcher().removeEventListener("tick",this.#n)}_isTicking(){return this.#t}_tick(){}_setTicking2(e){if(e=!!e,this.#i===e)return;this.#i=e;const t=this.#e.GetRuntime();if(e){if(!this.#r)if(this.#e.GetRuntime().IsDebug()){const e=globalThis.C3Debugger,t=this.plugin;this.#r=()=>{const n=performance.now();this._tick2(),e.AddIndividualPluginTickTime(t,performance.now()-n)}}else this.#r=()=>this._tick2();t.Dispatcher().addEventListener("tick2",this.#r)}else t.Dispatcher().removeEventListener("tick2",this.#r)}_isTicking2(){return this.#i}_tick2(){}_getDebuggerProperties(){return[]}_saveToJson(){return null}_loadFromJson(e){}_isWrapperExtensionAvailable(){if(!this.#o)throw new Error("no wrapper component id set");return this.#e.GetRuntime().HasWrapperComponentId(this.#o)}_addWrapperExtensionMessageHandler(e,t){if(C3X.RequireString(e),C3X.RequireFunction(t),!this.#o)throw new Error("no wrapper component id set");this.#e.GetRuntime().AddWrapperExtensionMessageHandler(this.#o,e,t)}_addWrapperMessageHandlers(e){C3X.RequireArray(e);for(const[t,n]of e)this._addWrapperExtensionMessageHandler(t,n)}_sendWrapperExtensionMessage(e,t){if(!this.#o)throw new Error("no wrapper component id set");this.runtime.sdk.sendWrapperExtensionMessage(this.#o,e,t)}_sendWrapperExtensionMessageAsync(e,t){if(!this.#o)throw new Error("no wrapper component id set");return this.runtime.sdk.sendWrapperExtensionMessageAsync(this.#o,e,t)}}; } // interfaces/objects/IWorldInstance.js { const C3=self.C3,C3X=self.C3X,IInstance=self.IInstance,ILayer=self.ILayer,tempAABB3D=new C3.AABB3D,tempQuad=new C3.Quad2D,map=new WeakMap,internalApiToken=C3._GetInternalAPIToken(),BLEND_MODE_TO_INDEX=new Map([["normal",0],["additive",1],["copy",3],["destination-over",4],["source-in",5],["destination-in",6],["source-out",7],["destination-out",8],["source-atop",9],["destination-atop",10],["lighten",11],["darken",12],["multiply",13],["screen",14]]),INDEX_TO_BLEND_MODE=new Map([...BLEND_MODE_TO_INDEX.entries()].map(t=>[t[1],t[0]])),tempColor=C3.New(C3.Color);function MakeIWorldInstanceClass(t){return class extends t{#t;#e;constructor(t){super(t);const e=C3.AddonManager._GetInitObject2(internalApiToken),i=e.GetWorldInfo();this.#t=e,this.#e=i,map.set(this,e);const n=[],r=i.GetInstanceEffectList();if(r){const t=i.GetObjectClass().GetEffectList().GetAllEffectTypes().length;for(let e=0;e<t;++e){const t=new self.IEffectInstance(r,e);n.push(t),n[t.name]=t}}const s={effects:{value:n,writable:!1}};Object.defineProperties(this,s)}get layout(){return this.#e.GetLayout().GetILayout()}get layer(){return this.#e.GetLayer().GetILayer()}get x(){return this.#e.GetX()}set x(t){t=+t;const e=this.#e;isNaN(t)||e.GetX()===t||(e.SetX(t),e.SetBboxChanged())}get y(){return this.#e.GetY()}set y(t){t=+t;const e=this.#e;isNaN(t)||e.GetY()===t||(e.SetY(t),e.SetBboxChanged())}get z(){return this.#e.GetZ()}set z(t){t=+t;this.#t;const e=this.#e;isNaN(t)||e.GetZ()===t||(e.SetZ(t),e.SetBboxChanged())}get totalZ(){return this.#e.GetTotalZ()}get zElevation(){return this.runtime._logDeprecationWarning("IWorldInstance.zElevation","IWorldInstance 'zElevation' property is deprecated. Use 'z' instead."),this.z}set zElevation(t){this.runtime._logDeprecationWarning("IWorldInstance.zElevation","IWorldInstance 'zElevation' property is deprecated. Use 'z' instead."),this.z=t}get totalZElevation(){return this.runtime._logDeprecationWarning("IWorldInstance.totalZElevation","IWorldInstance 'totalZElevation' property is deprecated. Use 'totalZ' instead."),this.totalZ}setPosition(t,e){t=+t,e=+e;const i=this.#e;isNaN(t)||isNaN(e)||i.EqualsXY(t,e)||(i.SetXY(t,e),i.SetBboxChanged())}getPosition(){return this.#e.GetXY()}offsetPosition(t,e){if(t=+t,e=+e,isNaN(t)||isNaN(e)||0===t&&0===e)return;const i=this.#e;i.OffsetXY(t,e),i.SetBboxChanged()}setPosition3d(t,e,i){t=+t,e=+e,i=+i;const n=this.#e;isNaN(t)||isNaN(e)||isNaN(i)||n.EqualsXYZ(t,e,i)||(n.SetXYZ(t,e,i),n.SetBboxChanged())}getPosition3d(){return this.#e.GetXYZ()}offsetPosition3d(t,e,i){if(t=+t,e=+e,i=+i,isNaN(t)||isNaN(e)||isNaN(i)||0===t&&0===e&&0===i)return;const n=this.#e;n.OffsetXYZ(t,e,i),n.SetBboxChanged()}set originX(t){t=+t;const e=this.#e;isNaN(t)||e.GetOriginX()===t||(e.SetOriginX(t),e.SetBboxChanged())}get originX(){return this.#e.GetOriginX()}set originY(t){t=+t;const e=this.#e;isNaN(t)||e.GetOriginY()===t||(e.SetOriginY(t),e.SetBboxChanged())}get originY(){return this.#e.GetOriginY()}setOrigin(t,e){t=+t,e=+e;const i=this.#e;isNaN(t)||isNaN(e)||i.GetOriginX()===t&&i.GetOriginY()===e||(i.SetOriginX(t),i.SetOriginY(e),i.SetBboxChanged())}getOrigin(){const t=this.#e;return[t.GetOriginX(),t.GetOriginY()]}get width(){return this.#e.GetWidth()}set width(t){t=+t;const e=this.#e;isNaN(t)||e.GetWidth()===t||(e.SetWidth(t),e.SetBboxChanged())}get height(){return this.#e.GetHeight()}set height(t){t=+t;const e=this.#e;isNaN(t)||e.GetHeight()===t||(e.SetHeight(t),e.SetBboxChanged())}get depth(){return this.#e.GetDepth()}set depth(t){t=+t;const e=this.#e;isNaN(t)||e.GetDepth()===t||(e.SetDepth(t),e.SetBboxChanged())}setSize(t,e){t=+t,e=+e;const i=this.#e;isNaN(t)||isNaN(e)||i.GetWidth()===t&&i.GetHeight()===e||(i.SetSize(t,e),i.SetBboxChanged())}getSize(){const t=this.#e;return[t.GetWidth(),t.GetHeight()]}setSize3d(t,e,i){t=+t,e=+e,i=+i;const n=this.#e;isNaN(t)||isNaN(e)||isNaN(i)||n.GetWidth()===t&&n.GetHeight()===e&&n.GetDepth()===i||(n.SetSize(t,e),n.SetDepth(i),n.SetBboxChanged())}getSize3d(){const t=this.#e;return[t.GetWidth(),t.GetHeight(),t.GetDepth()]}get angle(){return this.#e.GetAngle()}set angle(t){t=C3.clampAngle(+t);const e=this.#e;isNaN(t)||e.GetAngle()===t||(e.SetAngle(t),e.SetBboxChanged())}get angleDegrees(){return C3.toDegrees(this.angle)}set angleDegrees(t){this.angle=C3.toRadians(t)}getBoundingBox(t){return t?(this.#e.CalculateBbox(tempAABB3D,tempQuad,!1),tempAABB3D.toDOMRect()):this.#e.GetBoundingBox().toDOMRect()}getBoundingBox3d(t){return t?(this.#e.CalculateBbox(tempAABB3D,tempQuad,!1),new globalThis.IAABB3D(tempAABB3D)):new globalThis.IAABB3D(this.#e.GetBoundingBox())}getBoundingQuad(t){return t?(this.#e.CalculateBbox(null,tempQuad,!1),tempQuad.toDOMQuad()):this.#e.GetBoundingQuad().toDOMQuad()}isOnScreen(){return this.#e.IsInViewport2()}get isVisible(){return this.#e.IsVisible()}set isVisible(t){t=!!t;const e=this.#t,i=this.#e;i.IsVisible()!==t&&(i.SetVisible(t),e.GetRuntime().UpdateRender())}get opacity(){return this.#e.GetOpacity()}set opacity(t){t=C3.clamp(+t,0,1);const e=this.#t,i=this.#e;isNaN(t)||i.GetOpacity()===t||(i.SetOpacity(t),e.GetRuntime().UpdateRender())}set colorRgb(t){if(C3X.RequireArray(t),t.length<3)throw new Error("expected 3 elements");tempColor.setRgb(t[0],t[1],t[2]);const e=this.#t,i=this.#e;i.GetUnpremultipliedColor().equalsIgnoringAlpha(tempColor)||(i.SetUnpremultipliedColor(tempColor),e.GetRuntime().UpdateRender())}get colorRgb(){const t=this.#e.GetUnpremultipliedColor();return[t.getR(),t.getG(),t.getB()]}set blendMode(t){C3X.RequireString(t);const e=BLEND_MODE_TO_INDEX.get(t);if("number"!=typeof e)throw new Error("invalid blend mode");const i=this.#t;this.#e.SetBlendMode(e),i.GetRuntime().UpdateRender()}get blendMode(){return INDEX_TO_BLEND_MODE.get(this.#e.GetBlendMode())}set sampling(t){this.#e.SetSamplingMode(t)}get sampling(){return this.#e.GetSamplingMode()}get activeSampling(){return C3.Gfx.RendererBase.SamplingNumberToMode(this.#e.GetActiveSampling())}moveToTop(){this.#e.ZOrderMoveToTop()}moveToBottom(){this.#e.ZOrderMoveToBottom()}moveToLayer(t){C3X.RequireInstanceOf(t,ILayer);const e=this.#t,i=e.GetRuntime()._UnwrapScriptInterface(t);if(!i)throw new Error("invalid layer");e.GetWorldInfo().ZOrderMoveToLayer(i)}moveAdjacentToInstance(t,e){C3X.RequireIWorldInstance(t),this.#e.ZOrderMoveAdjacentToInstance(map.get(t),e)}get zIndex(){return this.#e.GetZIndex()}get isCollisionEnabled(){return this.#e.IsCollisionEnabled()}set isCollisionEnabled(t){this.#e.SetCollisionEnabled(!!t)}containsPoint(t,e){return C3X.RequireNumber(t),C3X.RequireNumber(e),this.#e.ContainsPoint(+t,+e)}testOverlap(t){C3X.RequireIWorldInstance(t);const e=this.#t,i=map.get(t);return e.GetRuntime().GetCollisionEngine().TestOverlap(e,i)}testOverlapSolid(){const t=this.#t,e=t.GetRuntime().GetCollisionEngine().TestOverlapSolid(t);return e?e.GetInterfaceClass():null}getParent(){const t=this.#t.GetParent();return t?t.GetInterfaceClass():null}getTopParent(){const t=this.#t.GetTopParent();return t?t.GetInterfaceClass():null}*parents(){for(const t of this.#t.parents())yield t.GetInterfaceClass()}getChildCount(){return this.#t.GetChildCount()}getChildAt(t){const e=this.#t.GetChildAt(t);return e?e.GetInterfaceClass():null}*children(){for(const t of this.#t.children())yield t.GetInterfaceClass()}*allChildren(){for(const t of this.#t.allChildren())yield t.GetInterfaceClass()}addChild(t,e){C3X.RequireIWorldInstance(t),C3X.RequireOptionalObject(e),e||(e={});const i=this.#t,n=map.get(t);"number"!=typeof e.transformZ&&"number"==typeof e.transformZElevation&&(this.runtime._logDeprecationWarning("IWorldInstance.addChild","IWorldInstance 'addChild' method option 'transformZElevation' is deprecated. Use 'transformZ' instead."),e.transformZ=e.transformZElevation),i.AddChild(n,e)}removeChild(t){C3X.RequireIWorldInstance(t);const e=this.#t,i=map.get(t);e.RemoveChild(i)}removeFromParent(){const t=this.#t;if(!t.HasParent())return;t.GetParent().RemoveChild(t)}getHierarchyOpts(){const t=this.#e;return{transformX:t.GetTransformWithParentX(),transformY:t.GetTransformWithParentY(),transformZ:t.GetTransformWithParentZ(),transformWidth:t.GetTransformWithParentWidth(),transformHeight:t.GetTransformWithParentHeight(),transformAngle:t.GetTransformWithParentAngle(),transformOpacity:t.GetTransformWithParentOpacity(),transformVisibility:t.GetTransformWithParentVisibility(),destroyWithParent:t.GetDestroyWithParent()}}createMesh(t,e,i=!1){C3X.RequireFiniteNumber(t),C3X.RequireFiniteNumber(e),this.#e.CreateMesh(t,e,i)}releaseMesh(){const t=this.#e;t.ReleaseMesh(),t.SetBboxChanged()}setMeshPoint(t,e,i){C3X.RequireFiniteNumber(t),C3X.RequireFiniteNumber(e),C3X.RequireObject(i);const n=this.#e;"number"!=typeof i.z&&"number"==typeof i.zElevation&&(this.runtime._logDeprecationWarning("IWorldInstance.setMeshPoint","IWorldInstance 'setMeshPoint' method option 'zElevation' is deprecated. Use 'z' instead."),i.z=i.zElevation),n.SetMeshPoint(t,e,i)&&n.SetBboxChanged()}getMeshPoint(t,e){let i=NaN,n=NaN,r=NaN,s=NaN,a=NaN;const o=this.#e;if(o.HasMesh()){const l=o.GetSourceMesh().GetMeshPointAt(t,e);null!==l&&(i=l.GetX(),n=l.GetY(),r=l.GetZ(),s=l.GetU(),a=l.GetV())}return{x:i,y:n,z:r,u:s,v:a}}getMeshSize(){const t=this.#e;if(!t.HasMesh())return[0,0];const e=t.GetSourceMesh();return[e.GetHSize(),e.GetVSize()]}}}const IWorldInstance=MakeIWorldInstanceClass(globalThis.IInstance),IWorldInstanceSDKBase=MakeIWorldInstanceClass(globalThis.ISDKInstanceBase);globalThis.IWorldInstance=IWorldInstance,globalThis.IWorldInstanceSDKBase=IWorldInstanceSDKBase,C3X.IsIWorldInstance=function(t){return t instanceof IWorldInstance||t instanceof IWorldInstanceSDKBase},C3X.RequireIWorldInstance=function(t){if(!C3X.IsIWorldInstance(t))throw new TypeError("expected IWorldInstance")}; } // interfaces/objects/IDOMInstance.js { const C3=self.C3,C3X=self.C3X;self.IDOMInstance=class extends self.IWorldInstance{#e;constructor(){super(),this.#e=self.IInstance._GetInitInst()}getElement(){return this.#e.GetSdkInstance()._GetElementInDOMMode()}focus(){this.#e.GetSdkInstance().FocusElement()}blur(){this.#e.GetSdkInstance().BlurElement()}setCssStyle(e,t){C3X.RequireString(e),this.#e.GetSdkInstance().SetElementCSSStyle(e,t)}}; } // interfaces/objects/IBehaviorInstance.js { const C3=self.C3,C3X=self.C3X,dispatchers=new WeakMap,internalApiToken=C3._GetInternalAPIToken();function GetDispatcher(e){let t=dispatchers.get(e);return t||(t=C3.New(C3.Event.Dispatcher),dispatchers.set(e,t),t)}self.IBehaviorInstance=class{#e;constructor(){const e=C3.AddonManager._GetInitObject2(internalApiToken);this.#e=e;const t={runtime:{value:e.GetRuntime().GetIRuntime(),writable:!1},behavior:{value:e.GetBehavior().GetIBehavior(),writable:!1},behaviorType:{value:e.GetBehaviorType().GetIBehaviorType(),writable:!1}};Object.defineProperties(this,t),e.GetRuntime()._MapScriptInterface(this,e)}static _GetInitInst(){return C3.AddonManager._GetInitObject()}get instance(){return this.#e.GetObjectInstance().GetInterfaceClass()}_release(){const e=dispatchers.get(this);e&&(e.Release(),dispatchers.delete(this))}addEventListener(e,t,i){C3X.RequireString(e),C3X.RequireFunction(t),GetDispatcher(this).addEventListener(e,t,i)}removeEventListener(e,t,i){C3X.RequireString(e),C3X.RequireFunction(t),GetDispatcher(this).removeEventListener(e,t,i)}dispatchEvent(e){GetDispatcher(this).dispatchEvent(e)}}; } // interfaces/objects/IBehaviorType.js { const C3=self.C3,C3X=self.C3X,internalApiToken=C3._GetInternalAPIToken();self.IBehaviorType=class{constructor(){const e=C3.AddonManager._GetInitObject2(internalApiToken),t={runtime:{value:e.GetRuntime().GetIRuntime(),writable:!1},behavior:{value:e.GetBehavior().GetIBehavior(),writable:!1},name:{value:e.GetName(),writable:!1}};Object.defineProperties(this,t)}}; } // interfaces/objects/IBehavior.js { const C3=self.C3,C3X=self.C3X,internalApiToken=C3._GetInternalAPIToken();self.IBehavior=class{#t;constructor(){const t=C3.AddonManager._GetInitObject2(internalApiToken);this.#t=t;const e={runtime:{value:t.GetRuntime().GetIRuntime(),writable:!1},id:{value:t.GetID(),writable:!1}};Object.defineProperties(this,e),t.GetRuntime()._MapScriptInterface(this,t)}getAllInstances(){return this.#t.GetInstances().map(t=>t.GetInterfaceClass())}static getByConstructor(t){if(!t)return null;const e=C3.AddonManager.GetBehaviorByConstructorFunction(t);return e?e.GetIBehavior():null}}; } // interfaces/objects/IEffectInstance.js { const C3=self.C3,C3X=self.C3X,tempColor=C3.New(C3.Color);self.IEffectInstance=class{#e;constructor(e,t){this.#e=e;const i={index:{value:t,writable:!1}};Object.defineProperties(this,i)}get name(){return this.#e.GetAllEffectTypes()[this.index].GetName()}get isActive(){return this.#e.IsEffectIndexActive(this.index)}set isActive(e){e=!!e;const t=this.#e;t.IsEffectIndexActive(this.index)!==e&&(t.SetEffectIndexActive(this.index,e),t.UpdateActiveEffects(),t.GetRuntime().UpdateRender())}setParameter(e,t){C3X.RequireFiniteNumber(e),e=Math.floor(+e);const i=this.#e,r=i.GetEffectParameter(this.index,e);if(null===r)throw new RangeError("invalid index");if(r instanceof C3.Color){if(!Array.isArray(t)||t.length<3)throw new TypeError("expected array with 3 elements");tempColor.setRgb(t[0],t[1],t[2]),t=tempColor}else if("number"!=typeof t)throw new TypeError("expected number");i.SetEffectParameter(this.index,e,t)&&i.IsEffectIndexActive(this.index)&&i.GetRuntime().UpdateRender()}getParameter(e){C3X.RequireFiniteNumber(e),e=Math.floor(+e);const t=this.#e.GetEffectParameter(this.index,e);if(null===t)throw new RangeError("invalid index");return t instanceof C3.Color?[t.getR(),t.getG(),t.getB()]:t}}; } // interfaces/objects/IAnimation.js { const C3=self.C3,C3X=self.C3X;self.IAnimation=class{#e;constructor(e){this.#e=e,Object.defineProperties(this,{name:{value:e.GetName(),writable:!1}})}get speed(){return this.#e.GetSpeed()}get isLooping(){return this.#e.IsLooping()}get repeatCount(){return this.#e.GetRepeatCount()}get repeatTo(){return this.#e.GetRepeatTo()}get isPingPong(){return this.#e.IsPingPong()}get frameCount(){return this.#e.GetFrameCount()}getFrames(){return this.#e.GetFrames().map(e=>e.GetIAnimationFrame())}*frames(){for(const e of this.#e.GetFrames())yield e.GetIAnimationFrame()}}; } // interfaces/objects/IImageInfo.js { const C3=self.C3,C3X=self.C3X;self.IImageInfo=class{#t;constructor(t){this.#t=t}static _Unwrap(t){return t.#t}get width(){return this.#t.GetWidth()}get height(){return this.#t.GetHeight()}getSize(){const t=this.#t;return[t.GetWidth(),t.GetHeight()]}getTexture(t){return t.getTextureForImageInfo(this)}getTexRect(){return this.#t.GetTexRect().toDOMRect()}}; } // interfaces/objects/IAnimationFrame.js { const C3=self.C3,C3X=self.C3X;self.IAnimationFrame=class extends self.IImageInfo{#t;constructor(t){super(t.GetImageInfo()),this.#t=t,Object.defineProperties(this,{duration:{value:t.GetDuration(),writable:!1},originX:{value:t.GetOriginX(),writable:!1},originY:{value:t.GetOriginY(),writable:!1}})}getOrigin(){const t=this.#t;return[t.GetOriginX(),t.GetOriginY()]}getImagePointCount(){return this.#t.GetImagePointCount()}getImagePointX(t){return this.getImagePoint(t)[0]}getImagePointY(t){return this.getImagePoint(t)[1]}getImagePoint(t){const e=this.#t;let i=null;if("number"==typeof t)i=e.GetImagePointByIndex(Math.floor(t));else{if("string"!=typeof t)throw new TypeError("expected string or number");i=e.GetImagePointByName(t)}return i?[i.GetX(),i.GetY()]:this.getOrigin()}getPolyPointCount(){const t=this.#t.GetCollisionPoly();return t?t.pointCount():0}getPolyPointX(t){return this.getPolyPoint(t)[0]}getPolyPointY(t){return this.getPolyPoint(t)[1]}getPolyPoint(t){C3X.RequireFiniteNumber(t),t=Math.floor(t);const e=this.#t.GetCollisionPoly();if(!e||t<0||t>=e.pointCount())return[0,0];const i=e.pointsArr();return[i[2*t],i[2*t+1]]}get tag(){return this.#t.GetTag()}}; } // interfaces/other/ITimelineStateBase.js { const C3=self.C3,C3X=self.C3X,map=new WeakMap;function GetTimelineState(e){const t=map.get(e);if(t.IsReleased())throw new Error("timeline/tween was released and is no longer valid");return t}self.ITimelineStateBase=class{constructor(e){map.set(this,e),e.GetRuntime()._MapScriptInterface(this,e)}pause(){GetTimelineState(this).Stop()}resume(){GetTimelineState(this).Resume()}stop(){GetTimelineState(this).Reset()}hasTags(e){return GetTimelineState(this).HasTags(e)}set time(e){C3X.RequireFiniteNumber(e),GetTimelineState(this).SetTime(e)}get time(){return GetTimelineState(this).GetTime()}set totalTime(e){C3X.RequireFiniteNumber(e),GetTimelineState(this).SetTotalTime(e)}get totalTime(){return GetTimelineState(this).GetTotalTime()}set isLooping(e){GetTimelineState(this).SetLoop(!!e)}get isLooping(){return GetTimelineState(this).GetLoop()}set isPingPong(e){GetTimelineState(this).SetPingPong(!!e)}get isPingPong(){return GetTimelineState(this).GetPingPong()}set playbackRate(e){C3X.RequireFiniteNumber(e),GetTimelineState(this).SetPlaybackRate(e)}get playbackRate(){return GetTimelineState(this).GetPlaybackRate()}get progress(){const e=GetTimelineState(this);return e.GetTime()/e.GetTotalTime()}get tags(){return GetTimelineState(this).GetTags()}get finished(){return GetTimelineState(this).GetPlayPromise()}get isPlaying(){return GetTimelineState(this).IsPlaying()}get isPaused(){return GetTimelineState(this).IsPaused()}get isReleased(){return map.get(this).IsReleased()}}; } // interfaces/other/ITimelineState.js { const C3=self.C3,C3X=self.C3X,map=new WeakMap;let easeToIndexFunc=null;function GetTimelineState(e){const t=map.get(e);if(t.IsReleased())throw new Error("timeline was released and is no longer valid");return t}self.ITimelineState=class extends self.ITimelineStateBase{constructor(e){super(e),map.set(this,e);const t={name:{value:e.GetName(),writable:!1}};Object.defineProperties(this,t)}}; } // interfaces/other/ITweenState.js { const C3=self.C3,C3X=self.C3X,map=new WeakMap,behInstMap=new WeakMap;let easeToIndexFunc=null;function GetTweenState(e){const t=map.get(e);if(t.IsReleased())throw new Error("tween was released and is no longer valid");return t}self.ITweenState=class extends self.ITimelineStateBase{constructor(e,t,n){super(e),easeToIndexFunc||(easeToIndexFunc=n.easeToIndexFunc),map.set(this,e),t&&behInstMap.set(this,t)}stop(){const e=GetTweenState(this);behInstMap.get(this).ReleaseTween(e)}setEase(e){C3X.RequireString(e);const t=self.Ease.GetEaseFromIndex(easeToIndexFunc(e));GetTweenState(this).SetEase(t)}get instance(){const e=GetTweenState(this).GetInstance();return e?e.GetInterfaceClass():null}get isDestroyOnComplete(){return GetTweenState(this).GetDestroyInstanceOnComplete()}set isDestroyOnComplete(e){GetTweenState(this).SetDestroyInstanceOnComplete(!!e)}get finished(){const e=GetTweenState(this);return e.GetPlayPromise().then(()=>new Promise(t=>{e.IsComplete()&&t()}))}get released(){return GetTweenState(this).GetReleasePromise()}get value(){const e=GetTweenState(this);if("value"!==e.GetId())throw new Error("not a value tween");return e.GetPropertyTrack("value").GetSourceAdapterValue()}}; } // interfaces/sdk/ISDKPluginBase.js { const C3=self.C3,C3X=self.C3X;self.ISDKPluginBase=class extends self.IPlugin{constructor(){super()}}; } // interfaces/sdk/ISDKDOMPluginBase.js { const C3=self.C3,C3X=self.C3X,internalApiToken=C3._GetInternalAPIToken();self.ISDKDOMPluginBase=class extends self.ISDKPluginBase{#e;#n;#t=0;#s=new Map;constructor(e){if(super(),this.#e=C3.AddonManager._GetInitObject2(internalApiToken),!e?.domComponentId)throw new Error("no DOM component ID specified");this.#n=e.domComponentId,this._addElementMessageHandler("elem-focused",e=>e._onElemFocused()),this._addElementMessageHandler("elem-blurred",e=>{e&&e._onElemBlurred()})}_addElement(e){const n=this.#t++;return this.#s.set(n,e),n}_removeElement(e){this.#s.delete(e)}_addElementMessageHandler(e,n){this.#e.GetRuntime().AddDOMComponentMessageHandler(this.#n,e,e=>{const t=this.#s.get(e["elementId"]);n(t,e)})}_addElementMessageHandlers(e){C3X.RequireArray(e);for(const[n,t]of e)this._addElementMessageHandlers(n,t)}}; } // interfaces/sdk/ISDKObjectTypeBase.js { const C3=self.C3,C3X=self.C3X,map=new WeakMap,internalApiToken=C3._GetInternalAPIToken();self.ISDKObjectTypeBase=class extends self.IObjectType{#e;constructor(){super(),this.#e=C3.AddonManager._GetInitObject2(internalApiToken)}_onCreate(){}getImageInfo(){return this.#e.GetImageInfo().GetIImageInfo()}_loadTextures(e){}_releaseTextures(e){}_onDynamicTextureLoadComplete(){}_preloadTexturesWithInstances(e){}}; } // interfaces/sdk/ISDKWorldInstanceBase.js { const C3=self.C3,C3X=self.C3X,map=new WeakMap,internalApiToken=C3._GetInternalAPIToken();self.ISDKWorldInstanceBase=class extends self.IWorldInstanceSDKBase{#e;#t=null;#r=null;constructor(e){super(e),this.#e=C3.AddonManager._GetInitObject2(internalApiToken)}_release(){if(super._release(),this.#t){const e=this.#e.GetRuntime().Dispatcher();e.removeEventListener("renderercontextlost",this.#t),e.removeEventListener("renderercontextrestored",this.#r),this.#t=null,this.#r=null}}_handleRendererContextLoss(){if(this.#t)return;this.#t=()=>this._onRendererContextLost(),this.#r=()=>this._onRendererContextRestored();const e=this.#e.GetRuntime().Dispatcher();e.addEventListener("renderercontextlost",this.#t),e.addEventListener("renderercontextrestored",this.#r)}_onRendererContextLost(){}_onRendererContextRestored(){}_draw(e){}_isOriginalSizeKnown(){return!1}_getOriginalSize(){}_rendersToOwnZPlane(){return!0}_setMustMitigateZFighting(){this.#e.SetMustMitigateZFighting()}_mustPreDraw(){return!1}}; } // interfaces/sdk/ISDKDOMInstanceBase.js { const C3=self.C3,C3X=self.C3X,tempRect=C3.New(C3.Rect),map=new WeakMap,internalApiToken=C3._GetInternalAPIToken();self.ISDKDOMInstanceBase=class extends self.ISDKWorldInstanceBase{#e=-1;#t=!0;#s=!1;#i=!1;#n=-.2;#o=C3.New(C3.Rect,0,0,-1,-1);#l=0;#a=0;#h=-1;#d=-1;#m=!1;constructor(e){if(!e?.domComponentId)throw new Error("no DOM component ID specified");super(e);const t=C3.AddonManager._GetInitObject2(internalApiToken);map.set(this,t),this.#e=this.plugin._addElement(this);const s=t.GetRuntime().GetCanvasManager();this.#l=s.GetLastWidth(),this.#a=s.GetLastHeight(),this._setTicking(!0)}_release(){super._release(),this.plugin._removeElement(this.#e),this._postToDOMElement("destroy"),this.#e=-1,map.delete(this)}_getElementInDOMMode(){if(map.get(this).GetRuntime().IsInWorker())throw new Error("not valid in worker mode");return this._postToDOMElementMaybeSync("get-element")}_postToDOMElement(e,t){t||(t={}),t["elementId"]=this.#e,this._postToDOM(e,t)}_postToDOMElementMaybeSync(e,t){return t||(t={}),t["elementId"]=this.#e,this._postToDOMMaybeSync(e,t)}_postToDOMElementAsync(e,t){return t||(t={}),t["elementId"]=this.#e,this._postToDOMAsync(e,t)}_createElement(e){e||(e={});const t=map.get(this).GetWorldInfo();e["elementId"]=this.#e,e["isVisible"]=t.IsVisible(),e["htmlIndex"]=t.GetLayer().GetHTMLIndex(),e["htmlZIndex"]=t.GetHTMLZIndex(),Object.assign(e,this._getElementState()),this.#t=!!e["isVisible"],this._postToDOMMaybeSync("create",e),this._updatePosition(!0)}setElementVisible(e){e=!!e,this.#t!==e&&(this.#t=e,this._postToDOMElement("set-visible",{"isVisible":e}))}_tick(){this._updatePosition(!1)}_shouldPreserveElement(){const e=map.get(this).GetRuntime().GetCanvasManager().GetFullscreenMode();return"Android"===C3.Platform.OS&&("scale-inner"===e||"integer-scale-inner"===e||"scale-outer"===e||"integer-scale-outer"===e||"crop"===e)}_updatePosition(e){const t=map.get(this);if(t.IsDestroyed())return;const s=t.GetWorldInfo(),i=s.GetLayer(),n=s.GetBoundingBox();let[o,l]=i.LayerToCanvasCss(n.getLeft(),n.getTop()),[a,h]=i.LayerToCanvasCss(n.getRight(),n.getBottom());const d=t.GetRuntime().GetCanvasManager(),m=d.GetCssWidth(),r=d.GetCssHeight();if(!s.IsVisible()||!i.IsVisible())return void this.setElementVisible(!1);if(!this._shouldPreserveElement()&&(a<=0||h<=0||o>=m||l>=r))return void this.setElementVisible(!1);tempRect.set(o,l,a,h);const c=d.GetLastWidth(),u=d.GetLastHeight(),p=i.GetHTMLIndex(),M=s.GetHTMLZIndex();if(!e&&tempRect.equals(this.#o)&&this.#l===c&&this.#a===u&&this.#h===p&&this.#d===M)return void this.setElementVisible(!0);this.#o.copy(tempRect),this.#l=c,this.#a=u,this.#h=p,this.#d=M,this.setElementVisible(!0);let I=null;this.#i&&(I=i.GetDisplayScale()+this.#n),this._postToDOMElement("update-position",{"left":Math.round(this.#o.getLeft()),"top":Math.round(this.#o.getTop()),"width":Math.round(this.#o.width()),"height":Math.round(this.#o.height()),"htmlIndex":p,"htmlZIndex":M,"fontSize":I})}focusElement(){this._postToDOMElementMaybeSync("focus",{"focus":!0})}blurElement(){this._postToDOMElementMaybeSync("focus",{"focus":!1})}_onElemFocused(){this.#s=!0}_onElemBlurred(){this.#s=!1}isElementFocused(){return this.#s}setElementCSSStyle(e,t){this.postToDOMElement("set-css-style",{"prop":C3.CSSToCamelCase(e),"val":t})}setElementAttribute(e,t){this.postToDOMElement("set-attribute",{"name":e,"val":t})}removeElementAttribute(e){this.postToDOMElement("remove-attribute",{"name":e})}_updateElementState(){this.#m||(this.#m=!0,Promise.resolve().then(()=>{this.#m=!1,this._postToDOMElement("update-state",this._getElementState())}))}_getElementState(){}_getElementId(){return this.#e}}; } // interfaces/sdk/ISDKBehaviorBase.js { const C3=self.C3,C3X=self.C3X;self.ISDKBehaviorBase=class extends self.IBehavior{constructor(){super()}}; } // interfaces/sdk/ISDKBehaviorTypeBase.js { const C3=self.C3,C3X=self.C3X;self.ISDKBehaviorTypeBase=class extends globalThis.IBehaviorType{constructor(){super()}_onCreate(){}}; } // interfaces/sdk/ISDKBehaviorInstanceBase.js { const C3=self.C3,C3X=self.C3X,map=new WeakMap,internalApiToken=C3._GetInternalAPIToken();self.ISDKBehaviorInstanceBase=class extends self.IBehaviorInstance{#i=!1;#t=!1;#e=!1;constructor(){super(),map.set(this,C3.AddonManager._GetInitObject2(internalApiToken))}_release(){super._release(),this._setTicking(!1),this._setTicking2(!1),this._setPostTicking(!1),map.delete(this)}_getInitProperties(){return C3.AddonManager._GetInitProperties()}_postCreate(){}_trigger(i){const t=map.get(this);t.GetRuntime().Trigger(i,t.GetObjectInstance(),t.GetBehaviorType())}_triggerAsync(i){const t=map.get(this);return t.GetRuntime().TriggerAsync(i,t.GetObjectInstance(),t.GetBehaviorType())}_setTicking(i){if(i=!!i,this.#i===i)return;this.#i=i;const t=map.get(this).GetRuntime();i?t._AddBehInstToTick(this):t._RemoveBehInstToTick(this)}_isTicking(){return this.#i}_tick(){}_setTicking2(i){if(i=!!i,this.#t===i)return;this.#t=i;const t=map.get(this).GetRuntime();i?t._AddBehInstToTick2(this):t._RemoveBehInstToTick2(this)}_isTicking2(){return this.#t}_tick2(){}_setPostTicking(i){if(i=!!i,this.#e===i)return;this.#e=i;const t=map.get(this).GetRuntime();i?t._AddBehInstToPostTick(this):t._RemoveBehInstToPostTick(this)}_isPostTicking(){return this.#e}_postTick(){}_getDebuggerProperties(){return[]}_saveToJson(){return null}_loadFromJson(i){}}; } // interfaces/sdk/ISDKUtils.js { const C3=self.C3,C3X=self.C3X;let runtime=null;self.ISDKUtils=class{constructor(e){runtime=e,Object.defineProperties(this,{constructVersionCode:{value:runtime.GetConstructVersionCode(),writable:!1}})}updateRender(){runtime.UpdateRender()}addLoadPromise(e){runtime.AddLoadPromise(e)}isWrapperExtensionAvailable(e){return C3X.RequireString(e),runtime.HasWrapperComponentId(e)}sendWrapperExtensionMessage(e,n,t){C3X.RequireString(e),C3X.RequireString(n),C3X.RequireOptionalArray(t),runtime.SendWrapperExtensionMessage(e,n,t)}sendWrapperExtensionMessageAsync(e,n,t){return C3X.RequireString(e),C3X.RequireString(n),C3X.RequireOptionalArray(t),runtime.SendWrapperExtensionMessageAsync(e,n,t)}createLoopingConditionContext(e){return C3X.RequireOptionalString(e),new self.ILoopingConditionContext(runtime,e)}set isAutoSuspendEnabled(e){runtime._SetAutoSuspendEnabled(!!e)}get isAutoSuspendEnabled(){return runtime._IsAutoSuspendEnabled()}setSuspended(e){runtime.SetSuspended(!!e)}getObjectClassBySid(e){C3X.RequireNumber(e);const n=runtime.GetObjectClassBySID(e);return n?n.GetIObjectClass():null}}; } // interfaces/sdk/ILoopingConditionContext.js { const C3=self.C3,C3X=self.C3X;self.ILoopingConditionContext=class{#e;#t;#o;#n;#s;#r;constructor(e,t){this.#e=e;const o=e.GetEventSheetManager(),n=e.GetCurrentEvent();this.#t=n,this.#o=n.GetSolModifiers();const s=e.GetEventStack();this.#n=s.GetCurrentStackFrame(),this.#s=s.Push(n);const r=o.GetLoopStack().Push();this.#r=r,t&&r.SetName(t),e.SetDebuggingEnabled(!1)}retrigger(){const e=this.#e.GetEventSheetManager(),t=this.#o,o=this.#r;e.PushCopySol(t),this.#t.Retrigger(this.#n,this.#s),e.PopSol(t),o.SetIndex(o.GetIndex()+1)}get isStopped(){return this.#r.IsStopped()}release(){const e=this.#e,t=e.GetEventStack(),o=e.GetEventSheetManager().GetLoopStack();e.SetDebuggingEnabled(!0),o.Pop(),t.Pop()}}; } // interfaces/gfx/IRenderer.js { const C3=globalThis.C3,C3X=globalThis.C3X;function IsStaticTextureDataType(e){return e instanceof ImageBitmap||"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas}const CULL_MODE_ARR=["none","back","front"],FRONT_FACE_WINDING_ARR=["cw","ccw"],DEFAULT_MESHDATA_OPTS={debugLabel:""};globalThis.IRenderer=class{#e;#r;constructor(e,r){this.#e=e,this.#r=r}setAlphaBlendMode(){this.#r.SetAlphaBlend()}setBlendMode(e){this.#r.SetNamedBlendMode(e)}setColorFillMode(){this.#r.SetColorFillMode()}setTextureFillMode(){this.#r.SetTextureFillMode()}setSmoothLineFillMode(){this.#r.SetSmoothLineFillMode()}setColor(e){this.#r.SetColorRgba(e[0],e[1],e[2],e[3])}setColorRgba(e,r,t,n){this.#r.SetColorRgba(e,r,t,n)}resetColor(){this.#r.ResetColor()}setOpacity(e){this.#r.SetOpacity(e)}setCurrentZ(e){this.#r.SetCurrentZ(e)}getCurrentZ(){return this.#r.GetCurrentZ()}setCullFaceMode(e){const r=CULL_MODE_ARR.indexOf(e);if(-1===r)throw new Error("invalid cull mode");this.#r.SetCullFaceMode(r)}getCullFaceMode(){return CULL_MODE_ARR[this.#r.GetCullFaceMode()]}setFrontFaceWinding(e){const r=FRONT_FACE_WINDING_ARR.indexOf(e);if(-1===r)throw new Error("invalid front face winding");this.#r.SetFrontFaceWinding(r)}getFrontFaceWinding(){return FRONT_FACE_WINDING_ARR[this.#r.GetFrontFaceWinding()]}rect(e){this.#r.Rect2(e.left,e.top,e.right,e.bottom)}rect2(e,r,t,n){this.#r.Rect2(e,r,t,n)}quad(e){this.#r.Quad(C3.Quad2D.fromDOMQuad(e))}quad2(e,r,t,n,a,i,d,s){this.#r.Quad2(e,r,t,n,a,i,d,s)}quad3(e,r){this.#r.Quad3(C3.Quad2D.fromDOMQuad(e),C3.Rect.fromDOMRect(r))}quad4(e,r){this.#r.Quad4(C3.Quad2D.fromDOMQuad(e),C3.Quad2D.fromDOMQuad(r))}quad5(e,r,t){this.#r.Quad5(C3.Quad2D.fromDOMQuad(e),C3.Quad2D.fromDOMQuad(r),t)}quad3D(e,r,t,n,a,i,d,s,o,u,l,h,c){this.#r.Quad3D(e,r,t,n,a,i,d,s,o,u,l,h,C3.Rect.fromDOMRect(c))}quad3D2(e,r,t,n,a,i,d,s,o,u,l,h,c){this.#r.Quad3D2(e,r,t,n,a,i,d,s,o,u,l,h,C3.Quad2D.fromDOMQuad(c))}quad3D3(e,r,t,n,a,i,d,s,o,u,l,h,c,p){this.#r.Quad3D3(e,r,t,n,a,i,d,s,o,u,l,h,C3.Quad2D.fromDOMQuad(c),p)}drawMesh(e,r,t,n){this.#r.DrawMesh(e,r,t,n)}createMeshData(e,r,t){C3X.RequireFiniteNumber(e),C3X.RequireFiniteNumber(r),t=Object.assign({},DEFAULT_MESHDATA_OPTS,t);const n=this.#r.CreateMeshData(e,r,{debugLabel:t.debugLabel});n.CreateGPUResources();const a=new globalThis.IMeshData(n);return this.#e._MapScriptInterface(a,n),a}drawMeshData(e,r=0,t=e.indexCount){const n=this.#e._UnwrapScriptInterface(e);this.#r.DrawMeshData(n,r,t)}convexPoly(e){this.#r.ConvexPoly(e)}line(e,r,t,n){this.#r.Line(e,r,t,n)}texturedLine(e,r,t,n,a,i){this.#r.TexturedLine(e,r,t,n,a,i)}lineRect(e,r,t,n){this.#r.LineRect(e,r,t,n)}lineRect2(e){this.#r.LineRect2(C3.Rect.fromDOMRect(e))}lineQuad(e){this.#r.LineQuad(C3.Quad2D.fromDOMQuad(e))}pushLineWidth(e){this.#r.PushLineWidth(e)}popLineWidth(){this.#r.PopLineWidth()}pushLineCap(e){this.#r.PushLineCap(e)}popLineCap(){this.#r.PopLineCap()}setTexture(e,r="auto"){C3X.RequireOptionalInstanceOf(e,globalThis.ITexture);const t=e?this.#e._UnwrapScriptInterface(e):null;this.#r.SetTexture(t,C3.Gfx.RendererBase.SamplingModeToNumber(r))}loadTextureForImageInfo(e,r){const t=globalThis.IImageInfo._Unwrap(e);if(!t)throw new Error("invalid IImageInfo");return t.LoadStaticTexture(this.#r,{wrapX:r?.wrapX??"clamp-to-edge",wrapY:r?.wrapY??"clamp-to-edge",defaultSampling:r?.defaultSampling??r?.sampling??"trilinear",mipMap:r?.mipMap??!0})}releaseTextureForImageInfo(e){const r=globalThis.IImageInfo._Unwrap(e);if(!r)throw new Error("invalid IImageInfo");r.ReleaseTexture()}getTextureForImageInfo(e){const r=globalThis.IImageInfo._Unwrap(e);if(!r)throw new Error("invalid IImageInfo");const t=r.GetTexture();return globalThis.ITexture.GetInterface(this.#e,t)}createStaticTexture(e,r){if(!IsStaticTextureDataType(e))throw new TypeError("invalid texture data");const t=this.#r.CreateStaticTexture(e,{wrapX:r?.wrapX??"clamp-to-edge",wrapY:r?.wrapY??"clamp-to-edge",defaultSampling:r?.defaultSampling??r?.sampling??"trilinear",mipMap:r?.mipMap??!0});return globalThis.ITexture.GetInterface(this.#e,t)}createDynamicTexture(e,r,t){C3X.RequireFiniteNumber(e),C3X.RequireFiniteNumber(r);const n=this.#r.CreateDynamicTexture(e,r,{wrapX:t?.wrapX??"clamp-to-edge",wrapY:t?.wrapY??"clamp-to-edge",defaultSampling:t?.defaultSampling??t?.sampling??"trilinear",mipMap:t?.mipMap??!0});return globalThis.ITexture.GetInterface(this.#e,n)}updateTexture(e,r,t){C3X.RequireInstanceOf(r,globalThis.ITexture);const n=this.#e._UnwrapScriptInterface(r);this.#r.UpdateTexture(e,n,{premultiplyAlpha:t?.premultiplyAlpha??!0})}deleteTexture(e){C3X.RequireInstanceOf(e,globalThis.ITexture);const r=this.#e._UnwrapScriptInterface(e);this.#r.DeleteTexture(r)}createRendererText(){const e=this.#r.CreateRendererText();return new globalThis.IRendererText(this.#e,e)}setDeviceTransform(){this.#e.GetCanvasManager().SetDeviceTransform(this.#r)}setLayerTransform(e){C3X.RequireInstanceOf(e,globalThis.ILayer);this.#e._UnwrapScriptInterface(e)._SetTransform(this.#r)}}; } // interfaces/gfx/ITexture.js { const C3=globalThis.C3,C3X=globalThis.C3X,reverseMap=new WeakMap;globalThis.ITexture=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t,reverseMap.set(t,this),e._MapScriptInterface(this,t),Object.defineProperties(this,{width:{value:t.GetWidth(),writable:!1},height:{value:t.GetHeight(),writable:!1},defaultSampling:{value:t.GetDefaultSampling(),writable:!1}})}static GetInterface(e,t){if(!t)return null;const r=reverseMap.get(t);return r||new globalThis.ITexture(e,t)}}; } // interfaces/gfx/IRendererText.js { const C3=globalThis.C3,C3X=globalThis.C3X;globalThis.IRendererText=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t,e._MapScriptInterface(this,t)}release(){this.#t.Release()}set fontFace(e){C3X.RequireString(e),this.#t.SetFontName(e)}get fontFace(){return this.#t.GetFontName()}set sizePt(e){C3X.RequireFiniteNumber(e),this.#t.SetFontSize(e)}get sizePt(){return this.#t.GetFontSize()}set lineHeight(e){C3X.RequireFiniteNumber(e),this.#t.SetLineHeight(e)}get lineHeight(){return this.#t.GetLineHeight()}set isBold(e){this.#t.SetBold(e)}get isBold(){return this.#t.IsBold()}set isItalic(e){this.#t.SetItalic(e)}get isItalic(){return this.#t.IsItalic()}setColor(e){C3X.RequireArray(e),this.setColorRgb(e[0],e[1],e[2])}setColorRgb(e,t,r){this.#t.SetColorRgb(e,t,r)}setCssColor(e){C3X.RequireString(e),this.#t.SetColor(e)}set horizontalAlign(e){this.#t.SetHorizontalAlignment(e)}get horizontalAlign(){return this.#t.GetHorizontalAlignment()}set verticalAlign(e){this.#t.SetVerticalAlignment(e)}get verticalAlign(){return this.#t.GetVerticalAlignment()}set wordWrapMode(e){this.#t.SetWordWrapMode(e)}get wordWrapMode(){return this.#t.GetWordWrapMode()}set textDirection(e){this.#t.SetTextDirection(e)}get textDirection(){return this.#t.GetTextDirection()}set text(e){C3X.RequireString(e),this.#t.SetText(e)}get text(){return this.#t.GetText()}setSize(e,t,r){C3X.RequireFiniteNumber(e),C3X.RequireFiniteNumber(t),C3X.RequireFiniteNumber(r),this.#t.SetSize(e,t,r)}getTexture(){const e=this.#t.GetTexture();return globalThis.ITexture.GetInterface(this.#e,e)}getTexRect(){return this.#t.GetTexRect().toDOMRect()}setTextureUpdateCallback(e){C3X.RequireFunction(e),this.#t.ontextureupdate=e}releaseTexture(){this.#t.ReleaseTexture()}get textWidth(){return this.#t.GetTextWidth()}get textHeight(){return this.#t.GetTextHeight()}}; } // interfaces/gfx/IMeshData.js { const C3=globalThis.C3,C3X=globalThis.C3X;globalThis.IMeshData=class{#e;constructor(e){this.#e=e,Object.defineProperties(this,{vertexCount:{value:e.GetVertexCount(),writable:!1},indexCount:{value:e.GetIndexCount(),writable:!1},positions:{value:e.positions,writable:!1},texCoords:{value:e.texCoords,writable:!1},colors:{value:e.colors,writable:!1},indices:{value:e.indices,writable:!1},debugLabel:{value:e.GetDebugLabel(),writable:!1}})}markDataChanged(e,a,t){this.#e.MarkDataChanged(e,a,t)}markAllVertexDataChanged(e=0,a=this.vertexCount){this.#e.MarkAllVertexDataChanged(e,a)}markIndexDataChanged(e=0,a=this.indexCount){this.#e.MarkIndexDataChanged(e,a)}fillColor(e,a,t,l){this.#e.FillColor(e,a,t,l)}release(){this.#e.Release()}}; } // assets/assetManager.js { const C3=self.C3,VALID_LOAD_POLICIES=new Set(["local","remote"]),EXT_TO_TYPE=new Map([["mp4","video/mp4"],["webm","video/webm"],["m4a","audio/mp4"],["mp3","audio/mpeg"],["js","application/javascript"],["wasm","application/wasm"],["svg","image/svg+xml"],["html","text/html"]]);function GetTypeFromFileExtension(e){if(!e)return"";const t=e.split(".");if(t.length<2)return"";const s=t.at(-1).toLowerCase();return EXT_TO_TYPE.get(s)||""}function AddScript(e){return new Promise((t,s)=>{const i=document.createElement("script");i.onload=t,i.onerror=s,i.async=!1,i.type="module",i.src=e,document.head.appendChild(i)})}C3.AssetManager=class extends C3.DefendedBase{constructor(e,t){super();const s=t["exportType"];this._runtime=e,this._cordovaBlobUrlCache=new Map,this._isCordova="cordova"===s,this._isiOSCordova=!!t["isiOSCordova"],this._swClientId=t["swClientId"],this._supportedAudioFormats=t["supportedAudioFormats"]||{},this._audioFiles=new Map,this._preloadSounds=!1,this._scriptSubfolder=t["scriptFolder"],this._mediaSubfolder="",this._fontsSubfolder="",this._iconsSubfolder="",this._fileMap=t["fileMap"]||new Map,this._fileMapBlobUrls=new Map,this._exportedFileList=[];const i="html5"===s||"scirra-arcade"===s||"instant-games"===s;this._defaultLoadPolicy=i?"remote":"local",this._imageAssetsMap=new Map,this._webFonts=[],this._loadPromises=[],this._hasFinishedInitialLoad=!1,this._totalAssetSizeToLoad=0,this._assetSizeLoaded=0,this._lastLoadProgress=0,this._hasHadErrorLoading=!1,this._loadingRateLimiter=C3.New(C3.RateLimiter,()=>this._FireLoadingProgressEvent(),50),this._localPromiseThrottle=C3.New(C3.PromiseThrottle,Math.max(C3.hardwareConcurrency,8)),this._remotePromiseThrottle=C3.New(C3.PromiseThrottle,20),this._iAssetManager=new self.IAssetManager(this)}Release(){for(const e of this._imageAssetsMap.values())e.Release();this._imageAssetsMap.clear(),C3.clearArray(this._loadPromises),this._runtime=null}GetRuntime(){return this._runtime}GetScriptSubfolder(){return this._scriptSubfolder}_SetMediaSubfolder(e){this._mediaSubfolder=e}GetMediaSubfolder(){return this._mediaSubfolder}_SetFontsSubfolder(e){this._fontsSubfolder=e}GetFontsSubfolder(){return this._fontsSubfolder}_SetIconsSubfolder(e){this._iconsSubfolder=e}GetIconsSubfolder(){return this._iconsSubfolder}_SetExportedFileList(e){this._exportedFileList=e}GetExportedFileList(){return this._exportedFileList}FetchBlob(e,t){return t=t||this._defaultLoadPolicy,C3.IsRelativeURL(e)?"playable-ad-single-file"===this._runtime.GetExportType()?self["c3_runtimeInterface"]["_PlayableAdFetchBlob"](e):"local"===t?this._localPromiseThrottle.Add(()=>C3.FetchBlob(e)):this._remotePromiseThrottle.Add(()=>C3.FetchBlob(e)):C3.FetchBlob(e)}FetchArrayBuffer(e){return C3.IsRelativeURL(e)?"playable-ad-single-file"===this._runtime.GetExportType()?C3.BlobToArrayBuffer(self["c3_runtimeInterface"]["_PlayableAdFetchBlob"](e)):"local"===this._defaultLoadPolicy?this._localPromiseThrottle.Add(()=>C3.FetchArrayBuffer(e)):this._remotePromiseThrottle.Add(()=>C3.FetchArrayBuffer(e)):C3.FetchArrayBuffer(e)}FetchText(e){return C3.IsRelativeURL(e)?"playable-ad-single-file"===this._runtime.GetExportType()?C3.BlobToString(self["c3_runtimeInterface"]["_PlayableAdFetchBlob"](e)):"local"===this._defaultLoadPolicy?this._localPromiseThrottle.Add(()=>C3.FetchText(e)):this._remotePromiseThrottle.Add(()=>C3.FetchText(e)):C3.FetchText(e)}async FetchJson(e){const t=await this.FetchText(e);return JSON.parse(t)}GetMediaFileUrl(e){let t=this._mediaSubfolder+e;return"Gecko"===C3.Platform.BrowserEngine&&"preview"===this._runtime.GetExportType()&&(t=this._GetLocalBlobURLFromFileMap(t)),t}GetProjectFileUrl(e){return"playable-ad-single-file"===this._runtime.GetExportType()&&C3.IsRelativeURL(e)?URL.createObjectURL(self["c3_runtimeInterface"]["_PlayableAdFetchBlob"](e)):e}GetProjectFileIframeUrl(e){if(C3.IsAbsoluteURL(e)||"preview"!==this._runtime.GetExportType()||!this._swClientId||!e)return e;try{const t=new URL(e,location.href);return t.searchParams.set("__c3_client_id",this._swClientId),t.toString()}catch(t){return console.warn("Invalid iframe URL: "+e),e}}_GetImageAssetKey(e,t){return(t?"true":"false")+"|"+e}LoadImage(e){const t=!!e.isTiled;if(e.loadPolicy&&!VALID_LOAD_POLICIES.has(e.loadPolicy))throw new Error("invalid load policy");const s=this._GetImageAssetKey(e.url,t);let i=this._imageAssetsMap.get(s);return i||(i=C3.New(C3.ImageAsset,this,{url:e.url,size:e.size||0,loadPolicy:e.loadPolicy||this._defaultLoadPolicy,isTiled:t}),this._imageAssetsMap.set(s,i),this._hasFinishedInitialLoad||(this._totalAssetSizeToLoad+=i.GetSize(),this._loadPromises.push(i.Load().then(()=>this._AddLoadedSize(i.GetSize())))),i)}_ReleaseImageAsset(e){const t=this._GetImageAssetKey(e.GetURL(),e.IsTiled());this._imageAssetsMap.delete(t)}async WaitForAllToLoad(e){try{await Promise.all(this._loadPromises),this._lastLoadProgress=1,e&&0===this._totalAssetSizeToLoad&&this._FireLoadingProgressEvent()}catch(e){console.error("Error loading: ",e),this._hasHadErrorLoading=!0,this._FireLoadingProgressEvent()}}SetInitialLoadFinished(){this._hasFinishedInitialLoad=!0}HasHadErrorLoading(){return this._hasHadErrorLoading}_AddLoadedSize(e){this._assetSizeLoaded+=e,this._loadingRateLimiter.Call()}_FireLoadingProgressEvent(){const e=C3.New(C3.Event,"loadingprogress");0===this._totalAssetSizeToLoad?this._lastLoadProgress=1:this._lastLoadProgress=C3.clamp(this._assetSizeLoaded/this._totalAssetSizeToLoad,0,1),e.progress=this._lastLoadProgress,this._runtime.Dispatcher().dispatchEvent(e),this._runtime.DispatchUserScriptEvent(C3.New(C3.Event,"loadingprogress"))}GetLoadProgress(){return this._lastLoadProgress}GetImageLoadProgress(){return this._runtime.GetSystemPlugin().GetImageLoadingProgress()}_SetWebFonts(e){C3.shallowAssignArray(this._webFonts,e),this._webFonts.length&&this._loadPromises.push(this._LoadWebFonts())}async _LoadWebFonts(){const e=[],t=[];for(const[s,i,o]of this._webFonts)this._totalAssetSizeToLoad+=o,e.push(this._LoadWebFont(s,i,t).then(()=>this._AddLoadedSize(o)));await Promise.all(e),this._runtime.IsInWorker()&&t.length>0&&await this._runtime.PostComponentMessageToDOMAsync("runtime","load-webfonts",{"webfonts":t})}async _LoadWebFont(e,t,s){try{let i=this.GetProjectFileUrl(t);"Gecko"===C3.Platform.BrowserEngine&&(e=`'${e}'`),("Gecko"===C3.Platform.BrowserEngine&&"preview"===this._runtime.GetExportType()||"playable-ad-single-file"===this._runtime.GetExportType())&&(i=this._GetLocalBlobURLFromFileMap(i));const o=new FontFace(e,`url('${i}')`);this._runtime.IsInWorker()?self.fonts.add(o):document.fonts.add(o),await o.load(),this._runtime.IsInWorker()&&s.push({name:e,url:i})}catch(t){console.warn(`[C3 runtime] Failed to load web font '${e}': `,t)}}IsAudioFormatSupported(e){return!!this._supportedAudioFormats[e]}_SetAudioFiles(e,t){this._preloadSounds=!!t;for(const[t,s,i]of e)this._audioFiles.set(t,{fileName:t,formats:s.map(e=>({type:e[0],fileExtension:e[1],fullName:t+e[1],fileSize:e[2]})),isMusic:i})}GetPreferredAudioFile(e){const t=this._audioFiles.get(e);if(!t)return null;let s=null;for(const e of t.formats)if(s||"audio/webm; codecs=opus"!==e.type||(s=e),this.IsAudioFormatSupported(e.type))return e;return s}GetProjectAudioFileUrl(e){const t=this.GetPreferredAudioFile(e);return t?{url:this.GetMediaFileUrl(t.fullName),type:t.type}:null}GetAudioToPreload(){if(this._preloadSounds){const e=[];for(const t of this._audioFiles.values()){if(t.isMusic)continue;const s=this.GetPreferredAudioFile(t.fileName);s&&e.push({originalUrl:t.fileName,url:this.GetMediaFileUrl(s.fullName),type:s.type,fileSize:s.fileSize})}return e}return[]}_GetLocalBlobFromFileMap(e){return"preview"===this._runtime.GetExportType()&&(e=new URL(e,location.href).toString()),this._fileMap.get(e)||null}_GetLocalBlobURLFromFileMap(e){let t=this._fileMapBlobUrls.get(e);if(t)return t;const s=this._GetLocalBlobFromFileMap(e);return s?(t=URL.createObjectURL(s),this._fileMapBlobUrls.set(e,t),t):e}GetIAssetManager(){return this._iAssetManager}async LoadScripts(...e){const t=e.map(e=>this.GetProjectFileUrl(e));if(this._runtime.IsInWorker())if(1===e.length){const t=e[0];await import(new URL(t,location.href).toString())}else{const t=e.map(e=>`import "${new URL(e,location.href).toString()}";`).join("\n"),s=URL.createObjectURL(new Blob([t],{type:"application/javascript"}));await import(s)}else await Promise.all(t.map(e=>AddScript(e)))}async CompileWebAssembly(e){if(WebAssembly.compileStreaming){const t=this.GetProjectFileUrl(e);return await WebAssembly.compileStreaming(fetch(t))}{const t=await C3.FetchArrayBuffer(e);return await WebAssembly.compile(t)}}async LoadStyleSheet(e){const t=this.GetProjectFileUrl(e);return await this._runtime.PostComponentMessageToDOMAsync("runtime","add-stylesheet",{"url":t})}}; } // assets/asset.js { const C3=self.C3;C3.Asset=class extends C3.DefendedBase{constructor(s,i){super(),this._assetManager=s,this._runtime=s.GetRuntime(),this._url=i.url||"",this._size=i.size,this._loadPolicy=i.loadPolicy,this._blob=i.blob||null,this._isLoaded=!!this._blob,this._loadPromise=null}Release(){this._loadPromise=null,this._assetManager=null,this._runtime=null,this._blob=null}GetURL(){return this._url}GetSize(){return this._size}Load(){return"local"===this._loadPolicy||this._blob?(this._isLoaded=!0,Promise.resolve()):(this._loadPromise||(this._loadPromise=this._assetManager.FetchBlob(this._url,this._loadPolicy).then(s=>(this._isLoaded=!0,this._loadPromise=null,this._blob=s,s)).catch(s=>{console.error("Error loading resource: ",s),this._loadPromise=null})),this._loadPromise)}IsLoaded(){return this._isLoaded}GetBlob(){return this._blob?Promise.resolve(this._blob):this._loadPromise?this._loadPromise:this._assetManager.FetchBlob(this._url,this._loadPolicy)}}; } // assets/imageAsset.js { const C3=self.C3,promiseThrottle=new C3.PromiseThrottle,allImageAssets=new Set;C3.ImageAsset=class extends C3.Asset{constructor(e,t){super(e,t),this._texturePromise=null,this._webglTexture=null,this._refCount=0,this._imageWidth=-1,this._imageHeight=-1,this._isTiled=!!t.isTiled,allImageAssets.add(this)}Release(){if(0!==this._refCount)throw new Error("released image asset which still has references");this._assetManager._ReleaseImageAsset(this),this._texturePromise=null,allImageAssets.delete(this),super.Release()}static OnRendererContextLost(){for(const e of allImageAssets)e._texturePromise=null,e._webglTexture=null,e._refCount=0}LoadStaticTexture(e,t){return t=t||{},this._refCount++,this._webglTexture?Promise.resolve(this._webglTexture):(this._texturePromise||(t.anisotropy=this._runtime.GetCanvasManager().GetTextureAnisotropy(),this._texturePromise=this._DoLoadStaticTexture(e,t)),this._texturePromise)}async _DoLoadStaticTexture(e,t){try{const s=await this.GetBlob();return 0===this._refCount?(this._texturePromise=null,null):await promiseThrottle.Add(async()=>{const r=await e.CreateStaticTextureAsync(s,t);return this._texturePromise=null,0===this._refCount?(e.DeleteTexture(r),null):(this._webglTexture=r,this._imageWidth=r.GetWidth(),this._imageHeight=r.GetHeight(),this._webglTexture)})}catch(e){throw console.error("Failed to load texture: ",e),e}}ReleaseTexture(){if(this._refCount<=0)throw new Error("texture released too many times");if(this._refCount--,0===this._refCount&&this._webglTexture){this._webglTexture.GetRenderer().DeleteTexture(this._webglTexture),this._webglTexture=null}}IncRefCount(){this._refCount++}GetRefCount(){return this._refCount}DecRefCount(){this._refCount--}GetTexture(){return this._webglTexture}GetWidth(){return this._imageWidth}GetHeight(){return this._imageHeight}IsTiled(){return this._isTiled}async LoadToDrawable(){const e=await this.GetBlob();return C3.Supports.ImageBitmap?await createImageBitmap(e):await C3.BlobToImage(e)}}; } // layouts/renderCell.js { const C3=self.C3,assert=self.assert;function SortByInstLastCachedZIndex(e,s){return e.GetWorldInfo()._GetLastCachedZIndex()-s.GetWorldInfo()._GetLastCachedZIndex()}C3.RenderCell=class extends C3.DefendedBase{constructor(e,s,n){super(),this._grid=e,this._x=s,this._y=n,this._instances=[],this._isSorted=!0,this._pendingRemoval=new Set,this._isAnyPendingRemoval=!1}Release(){C3.clearArray(this._instances),this._pendingRemoval.clear(),this._grid=null}Reset(){C3.clearArray(this._instances),this._isSorted=!0,this._pendingRemoval.clear(),this._isAnyPendingRemoval=!1}SetChanged(){this._isSorted=!1}IsEmpty(){return!this._instances.length||!(this._instances.length>this._pendingRemoval.size)&&(this._FlushPending(),!0)}Insert(e){if(this._pendingRemoval.has(e))return this._pendingRemoval.delete(e),void(0===this._pendingRemoval.size&&(this._isAnyPendingRemoval=!1));this._instances.push(e),this._isSorted=1===this._instances.length}Remove(e){this._pendingRemoval.add(e),this._isAnyPendingRemoval=!0,this._pendingRemoval.size>=50&&this._FlushPending()}_FlushPending(){this._isAnyPendingRemoval&&(this._instances.length!==this._pendingRemoval.size?(C3.arrayRemoveAllInSet(this._instances,this._pendingRemoval),this._pendingRemoval.clear(),this._isAnyPendingRemoval=!1):this.Reset())}_EnsureSorted(){this._isSorted||(this._instances.sort(SortByInstLastCachedZIndex),this._isSorted=!0)}Dump(e){this._FlushPending(),this._EnsureSorted(),this._instances.length&&e.push(this._instances)}}; } // layouts/renderGrid.js { const C3=self.C3;C3.RenderGrid=class extends C3.DefendedBase{constructor(e,t){super(),this._cellWidth=e,this._cellHeight=t,this._cells=C3.New(C3.PairMap)}Release(){this._cells.Release(),this._cells=null}GetCell(e,t,l){let o=this._cells.Get(e,t);return o||(l?(o=C3.New(C3.RenderCell,this,e,t),this._cells.Set(e,t,o),o):null)}XToCell(e){return Math.floor(e/this._cellWidth)}YToCell(e){return Math.floor(e/this._cellHeight)}Update(e,t,l){if(t)for(let o=t.getLeft(),s=t.getRight();o<=s;++o)for(let s=t.getTop(),i=t.getBottom();s<=i;++s){if(l&&l.containsPoint(o,s))continue;const t=this.GetCell(o,s,!1);t&&(t.Remove(e),t.IsEmpty()&&this._cells.Delete(o,s))}if(l)for(let o=l.getLeft(),s=l.getRight();o<=s;++o)for(let s=l.getTop(),i=l.getBottom();s<=i;++s)t&&t.containsPoint(o,s)||this.GetCell(o,s,!0).Insert(e)}QueryRange(e,t){let l=this.XToCell(e.getLeft());const o=this.YToCell(e.getTop()),s=this.XToCell(e.getRight()),i=this.YToCell(e.getBottom());for(;l<=s;++l)for(let e=o;e<=i;++e){const o=this.GetCell(l,e,!1);o&&o.Dump(t)}}MarkRangeChanged(e){let t=e.getLeft();const l=e.getTop(),o=e.getRight(),s=e.getBottom();for(;t<=o;++t)for(let e=l;e<=s;++e){const l=this.GetCell(t,e,!1);l&&l.SetChanged()}}}; } // layouts/layer.js { const C3=self.C3,assert=self.assert,tmpRect=new C3.Rect,tmpQuad=new C3.Quad2D,renderCellArr=[],tmpDestRect=new C3.Rect,tmpSrcRect=new C3.Rect,glMatrix=self.glMatrix,vec3=glMatrix.vec3,vec4=glMatrix.ve … [Строка слишком длинная. Вы можете скачать файл] } // layouts/layout.js { const C3=self.C3,C3Debugger=self.C3Debugger,assert=self.assert,tempDestRect=C3.New(C3.Rect),tempSrcRect=C3.New(C3.Rect),tempLayoutRect=C3.New(C3.Rect),tempColor=C3.New(C3.Color),glMatrix=self.glMatrix … [Строка слишком длинная. Вы можете скачать файл] } // layouts/layoutManager.js { const C3=self.C3;C3.LayoutManager=class extends C3.DefendedBase{#t;#n=[];#u=new Map;#a=new Map;#i=null;#e=[];#s=null;#o=0;#y=null;constructor(t){super(),this.#t=t}Release(){this.#t=null,this.#i=null,this.#s=null,this.#y=null,C3.clearArray(this.#n),this.#u.clear(),this.#a.clear(),C3.clearArray(this.#e)}Create(t){const n=C3.New(C3.Layout,this,this.#n.length,t);this.#n.push(n),this.#u.set(n.GetName().toLowerCase(),n),this.#a.set(n.GetSID(),n)}GetRuntime(){return this.#t}SetFirstLayout(t){this.#s=t}GetFirstLayout(){if(this.#s)return this.#s;if(this.#n.length)return this.#n[0];throw new Error("no first layout")}GetLayoutByName(t){return this.#u.get(t.toLowerCase())||null}GetLayoutBySID(t){return this.#a.get(t)||null}GetLayoutByIndex(t){return t=C3.clamp(Math.floor(t),0,this.#n.length-1),this.#n[t]}GetLayout(t){return"number"==typeof t?this.GetLayoutByIndex(t):this.GetLayoutByName(t.toString())}GetAllLayouts(){return this.#n}_SetMainRunningLayout(t){this.#i=t}GetMainRunningLayout(){return this.#i}_AddRunningSubLayout(t){if(this.#e.includes(t))throw new Error("layout already running");this.#e.push(t)}_RemoveRunningSubLayout(t){const n=this.#e.indexOf(t);if(-1===n)throw new Error("layout not running");this.#e.splice(n,1)}*runningLayouts(){this.#i&&(yield this.#i),this.#e.length&&(yield*this.#e)}IsLayoutRunning(t){return this.#i===t||this.#e.includes(t)}SetIsEndingLayout(t){if(t)this.#o++;else{if(this.#o<=0)throw new Error("already unset");this.#o--}}IsEndingLayout(){return this.#o>0}ChangeMainLayout(t){this.#y=t}ClearPendingChangeLayout(){this.#y=null}IsPendingChangeMainLayout(){return!!this.#y}GetPendingChangeMainLayout(){return this.#y}SetAllLayerProjectionChanged(){const t=this.GetMainRunningLayout();t&&t._SetAllLayersProjectionChanged()}SetAllLayerMVChanged(){const t=this.GetMainRunningLayout();t&&t._SetAllLayersMVChanged()}}; } // timelines/timelineManager.js { const C3=self.C3,NAMES_REGEXP=new RegExp("<(.+?)>","g");C3.TimelineManager=class extends C3.DefendedBase{constructor(e){super(),this._runtime=e,this._timelineDataManager=C3.New(C3.TimelineDataManager) … [Строка слишком длинная. Вы можете скачать файл] } // timelines/timelineInfo.js { const C3=self.C3,STEPS=100,LENGTH_STEP_SIZE=.01,BEZIER_STEP_SIZE=25,REFINE_ITERATIONS=20,LOOKUP_STEPS_FROM_LAST=5,TANGENT_RESULT=[0,0],MAP_RESULT=[0,0],SHORT_PROJECTION_RESULT=[0,0],PROJECTION_RESULT=[0,0,0,0,0],REFINE_LUT=new Array(4),REFINE_LUT_OBJECTS=[{x:0,y:0,t:0,distance:0},{x:0,y:0,t:0,distance:0},{x:0,y:0,t:0,distance:0}],REFINE_RESULT={x:0,y:0,t:0,distance:0};C3.TimelineInfo=class{constructor(t,i){this._initialized=!1,this._timeline=t,this._segments=[];let e=null;if(e=i?this._timeline.GetTrackById(i):C3.first(this._timeline.GetTracks()),!e)return;const s=e.GetPropertyTrack("offsetX"),_=e.GetPropertyTrack("offsetY");if(!s||!_)return;this._xTrack=s,this._yTrack=_;const h=s.GetPropertyKeyframeDataItemArrayIncludingDisabled(),n=_.GetPropertyKeyframeDataItemArrayIncludingDisabled();for(let t=1,i=Math.min(h.length,n.length);t<i;++t){const i=h[t],e=(i.GetNext(),i.GetPrevious()),s=n[t],_=(s.GetNext(),s.GetPrevious());e&&"cubic-bezier"===e.GetPathMode()&&_&&"cubic-bezier"===_.GetPathMode()?this._segments.push(C3.New(C3.TimelineCubicBezierSegmentInfo,e,_,i,s,this._segments.length)):(e&&"line"===e.GetPathMode()&&_&&_.GetPathMode(),this._segments.push(C3.New(C3.TimelineLineSegmentInfo,i,s,this._segments.length)))}this._initialized=!0}Release(){for(const t of this._segments)t.Release();C3.clearArray(this._segments),this._segments=null,this._timeline=null,this._xTrack=null,this._yTrack=null}WasInitialized(){return this._initialized}segments(){return this._segments}SetOrigin(t){const i="relative"===this._xTrack.GetResultMode()?t.GetX():0,e="relative"===this._yTrack.GetResultMode()?t.GetY():0;for(const t of this._segments)t.SetOrigin(i,e)}Project(t,i,e){let s=NaN,_=this._segments.length;for(let e=0;e<_;e++){const _=this._segments[e];if("cubic-bezier"===_.GetType()){const e=_.Project(t,i);(isNaN(s)||e[3]<s)&&(s=e[3],SHORT_PROJECTION_RESULT[0]=e[2],SHORT_PROJECTION_RESULT[1]=_.GetIndex())}}return SHORT_PROJECTION_RESULT}ProjectWithOptions(t,i,e){const s=e.tRange;C3.IsFiniteNumber(s[0])||(s[0]=0),C3.IsFiniteNumber(s[1])||(s[1]=1);let _=NaN,h=this._segments.length;for(let e=0;e<h;e++){const h=this._segments[e];if("cubic-bezier"===h.GetType()){const e=h.ProjectWithRange(t,i,s);(isNaN(_)||e[3]<_)&&(_=e[3],SHORT_PROJECTION_RESULT[0]=e[2],SHORT_PROJECTION_RESULT[1]=h.GetIndex())}}return SHORT_PROJECTION_RESULT}Tangent(t,i){return this._segments[i].Tangent(t)}TangentAngle(t,i){return this._segments[i].TangentAngle(t)}},C3.TimelineCubicBezierSegmentInfo=class{constructor(t,i,e,s,_){this._index=_;const h=t.GetAddOn("cubic-bezier"),n=e.GetAddOn("cubic-bezier"),r=i.GetAddOn("cubic-bezier"),a=s.GetAddOn("cubic-bezier");this._aX=t.GetValueWithResultMode(),this._aY=i.GetValueWithResultMode(),this._bX=t.GetValueWithResultMode()+h.GetStartAnchor(),this._bY=i.GetValueWithResultMode()+r.GetStartAnchor(),this._cX=e.GetValueWithResultMode()+n.GetEndAnchor(),this._cY=s.GetValueWithResultMode()+a.GetEndAnchor(),this._dX=e.GetValueWithResultMode(),this._dY=s.GetValueWithResultMode(),this._aXO=0,this._aYO=0,this._bXO=0,this._bYO=0,this._cXO=0,this._cYO=0,this._dXO=0,this._dYO=0,this._d0x=0,this._d0y=0,this._d1x=0,this._d1y=0,this._d2x=0,this._d2y=0,this._x1Factor=0,this._x2Factor=0,this._x3Factor=0,this._y1Factor=0,this._y2Factor=0,this._y3Factor=0,this._lutIndex=NaN,this._initialized=!1,this._len=100,this._arcLengths=new Array(this._len+1),this._arcLengths[0]=0,this._length=0,this._lut=[],this._lutObjects=[];for(let t=0;t<100;t++)this._lutObjects.push({x:0,y:0,t:0,distance:0});this._CalculateLength()}Release(){C3.clearArray(this._arcLengths),this._arcLengths=null,C3.clearArray(this._lut),this._lut=null,C3.clearArray(this._lutObjects),this._lutObjects=null}GetType(){return"cubic-bezier"}GetIndex(){return this._index}GetStepCount(){return Math.floor(this._length/25)}GetStepIncrement(){return 1/this.GetStepCount()}SetOrigin(t,i){this._originX=t,this._originY=i,this._arcLengths=new Array(this._len+1),this._arcLengths[0]=0,this._CalculateLength(),this._aXO=this._aX+this._originX,this._aYO=this._aY+this._originY,this._bXO=this._bX+this._originX,this._bYO=this._bY+this._originY,this._cXO=this._cX+this._originX,this._cYO=this._cY+this._originY,this._dXO=this._dX+this._originX,this._dYO=this._dY+this._originY,this._d0x=3*(this._bXO-this._aXO),this._d0y=3*(this._bYO-this._aYO),this._d1x=3*(this._cXO-this._bXO),this._d1y=3*(this._cYO-this._bYO),this._d2x=3*(this._dXO-this._cXO),this._d2y=3*(this._dYO-this._cYO),this._x1Factor=3*(this._bXO-this._aXO),this._x2Factor=3*(this._aXO+this._cXO-2*this._bXO),this._x3Factor=this._dXO-this._aXO+3*(this._bXO-this._cXO),this._y1Factor=3*(this._bYO-this._aYO),this._y2Factor=3*(this._aYO+this._cYO-2*this._bYO),this._y3Factor=this._dYO-this._aYO+3*(this._bYO-this._cYO)}Map(t){if(!this._initialized)return NaN;const i=this._Map(t);return MAP_RESULT[0]=this._X(i),MAP_RESULT[1]=this._Y(i),MAP_RESULT}Project(t,i){const e=this._GenerateLUT(100),s=this._FindClosestFromLUT(t,i,e),_=this._RefineProjection(t,i,e,s);return PROJECTION_RESULT[0]=_.x,PROJECTION_RESULT[1]=_.y,PROJECTION_RESULT[2]=_.t,PROJECTION_RESULT[3]=_.distance,PROJECTION_RESULT}ProjectWithRange(t,i,e){const s=this._GenerateLUT(100),_=this._FindClosestFromLUTWithRange(t,i,s,e),h=this._RefineProjection(t,i,s,_);return PROJECTION_RESULT[0]=h.x,PROJECTION_RESULT[1]=h.y,PROJECTION_RESULT[2]=h.t,PROJECTION_RESULT[3]=h.distance,PROJECTION_RESULT}Tangent(t){const i=1-t,e=i*i,s=2*i*t,_=t*t,h=e*this._d0x+s*this._d1x+_*this._d2x,n=e*this._d0y+s*this._d1y+_*this._d2y,r=C3.hypot2DFast(h,n);return TANGENT_RESULT[0]=h/r,TANGENT_RESULT[1]=n/r,TANGENT_RESULT}TangentAngle(t){const i=1-t,e=i*i,s=2*i*t,_=t*t,h=e*this._d0x+s*this._d1x+_*this._d2x,n=e*this._d0y+s*this._d1y+_*this._d2y;return Math.atan2(n,h)}_Map(t){if(!this._initialized)return;let i=t*this._arcLengths[this._len],e=0,s=this._len,_=0;for(;e<s;)_=e+((s-e)/2|0),this._arcLengths[_]<i?e=_+1:s=_;this._arcLengths[_]>i&&_--;const h=this._arcLengths[_];return h===i?_/this._len:(_+(i-h)/(this._arcLengths[_+1]-h))/this._len}_X(t){return this._initialized?self.Ease.GetRuntimeEase("cubicbezier")(t,this._aX+this._originX,this._bX+this._originX,this._cX+this._originX,this._dX+this._originX):NaN}_Y(t){return this._initialized?self.Ease.GetRuntimeEase("cubicbezier")(t,this._aY+this._originY,this._bY+this._originY,this._cY+this._originY,this._dY+this._originY):NaN}_GenerateLUT(t){if(t=t||100,this._lut.length>=t)return this._lut;this._lut=new Array(t),t++;for(let i=0;i<t-1;i++){const e=i/(t-1),s=e**2,_=e**3,h=this._x1Factor*e,n=this._x2Factor*s,r=this._x3Factor*_,a=this._y1Factor*e,c=this._y2Factor*s,l=this._y3Factor*_,o=this._aXO+h+n+r,d=this._aYO+a+c+l;this._lutObjects[i].x=o,this._lutObjects[i].y=d,this._lutObjects[i].t=e,this._lutObjects[i].distance=0,this._lut[i]=this._lutObjects[i]}return this._lut}_FindClosestFromLUT(t,i,e,s=null,_=Number.MAX_SAFE_INTEGER){let h=0;if(isNaN(this._lutIndex))for(let s=0;s<100;s++){const n=e[s],r=n.x-t,a=n.y-i;n.distance=r*r+a*a,n.distance<_&&(_=n.distance,h=s)}else{for(let s=this._lutIndex;s<this._lutIndex+5&&!(s>=e.length);s++){const n=e[s],r=n.x-t,a=n.y-i;n.distance=r*r+a*a,n.distance<_&&(_=n.distance,h=s)}for(let s=this._lutIndex;s>this._lutIndex-5&&!(s<0);s--){const n=e[s],r=n.x-t,a=n.y-i;n.distance=r*r+a*a,n.distance<_&&(_=n.distance,h=s)}}return this._lutIndex=h,h}_FindClosestFromLUTWithRange(t,i,e,s,_=Number.MAX_SAFE_INTEGER){let h=0;if(isNaN(this._lutIndex))for(let n=0;n<100;n++){const r=e[n],a=r.x-t,c=r.y-i;r.distance=a*a+c*c,r.t>=s[0]&&r.t<=s[1]&&r.distance<_&&(_=r.distance,h=n)}else{for(let n=this._lutIndex;n<this._lutIndex+5&&!(n>=e.length);n++){const r=e[n],a=r.x-t,c=r.y-i;r.distance=a*a+c*c,r.t>=s[0]&&r.t<=s[1]&&r.distance<_&&(_=r.distance,h=n)}for(let n=this._lutIndex;n>this._lutIndex-5&&!(n<0);n--){const r=e[n],a=r.x-t,c=r.y-i;r.distance=a*a+c*c,r.t>=s[0]&&r.t<=s[1]&&r.distance<_&&(_=r.distance,h=n)}}return this._lutIndex=h,h}_RefineProjection(t,i,e,s){let _=e[s],h=1,n=Number.MAX_SAFE_INTEGER;t:do{const h=e.length;let r=0===s?0:s-1,a=s===h-1?h-1:s+1,c=e[r].t,l=(e[a].t-c)/4;if(l<.001)break;REFINE_LUT[0]=e[r];for(let e=1;e<=2;e++){const h=c+e*l,r=h**2,a=h**3,o=this._x1Factor*h,d=this._x2Factor*r,u=this._x3Factor*a,O=this._y1Factor*h,T=this._y2Factor*r,E=this._y3Factor*a,R=this._aXO+o+d+u,g=this._aYO+O+T+E,N=R-t,I=g-i,S=N*N+I*I;if(S<n){n=S,s=e,REFINE_RESULT.x=R,REFINE_RESULT.y=g,REFINE_RESULT.t=h,REFINE_RESULT.distance=S,_=REFINE_RESULT;break t}const x=REFINE_LUT_OBJECTS[e-1];x.x=R,x.y=g,x.t=h,x.distance=S,REFINE_LUT[e]=x}REFINE_LUT[3]=e[a],e=REFINE_LUT}while(h++<20);return _}_CalculateLength(){this._initialized=!0;let t=this._X(0),i=this._Y(0),e=0;for(let s=1;s<=this._len;s++){const _=this._X(.01*s),h=this._Y(.01*s),n=t-_,r=i-h;e+=C3.hypot2DFast(n,r),this._arcLengths[s]=e,t=_,i=h}this._length=e}},C3.TimelineLineSegmentInfo=class{constructor(t,i,e){this._index=e,this._targetX=t.GetValueWithResultMode(),this._targetY=i.GetValueWithResultMode(),this._originX=0,this._originY=0}Release(){}GetType(){return"line"}GetIndex(){return this._index}SetOrigin(t,i){this._originX=t,this._originY=i}GetX(){return this._targetX+this._originX}GetY(){return this._targetY+this._originY}}; } // timelines/state/timelineState.js { const C3=self.C3,PING_PONG_BEGIN=0,PING_PONG_END=1;C3.TimelineState=class extends C3.DefendedBase{constructor(t,e,i){super(),this._runtime=i.GetRuntime(),this._timelineManager=i,this._timelineDataItem … [Строка слишком длинная. Вы можете скачать файл] } // timelines/state/trackState.js { const C3=self.C3,INSTANCE_TRACK=0,VALUE_TRACK=1,AUDIO_TRACK=2;C3.TrackState=class extends C3.DefendedBase{constructor(t,e){super(),this._timeline=t,this._trackDataItem=e,this._trackData=e.GetTrackData … [Строка слишком длинная. Вы можете скачать файл] } // timelines/state/propertyTrackState.js { const C3=self.C3;C3.PropertyTrackState=class extends C3.DefendedBase{constructor(e,t){super(),this._track=e,this._propertyTrackDataItem=t,this._propertyTrackData=t.GetPropertyTrackData(),this._worldIn … [Строка слишком длинная. Вы можете скачать файл] } // timelines/state/propertySourceAdapters/propertySourceAdapter.js { const C3=self.C3,NS=C3.PropertyTrackState;NS.PropertySourceAdapter=class{constructor(e){this._propertyTrack=e,this._propertyAdapter=null,this.GetPropertyAdapter()}Release(){this._propertyAdapter&&(this._propertyAdapter.Release(),this._propertyAdapter=null),this._propertyTrack=null}MayNeedBeforeAndAfterInterpolate(){return this._propertyAdapter.MayNeedBeforeAndAfterInterpolate()}GetPropertyTrack(){return this._propertyTrack}TimelineRemoved(){this._propertyAdapter&&this._propertyAdapter.TimelineRemoved()}CleanCaches(){this._propertyAdapter&&this._propertyAdapter.CleanCaches()}GetPropertyAdapter(){return this._propertyAdapter||(this._propertyAdapter=this._CreatePropertyAdapter()),this._propertyAdapter}GetEditorIndex(){}GetIndex(){return this.GetEditorIndex()}GetTarget(){}SetResetState(){this.GetPropertyAdapter().SetResetState()}SetInitialState(){this.GetPropertyAdapter().SetInitialState()}SetResumeState(){this.GetPropertyAdapter().SetResumeState()}BeforeInterpolate(e,t){this._propertyAdapter.BeforeChangeProperty(e,t)}Interpolate(e,t,r,p,a,o,n){let s;switch(this._propertyTrack.GetPropertyKeyframeType()){case"numeric":s=NS.NumericTypeAdapter.Interpolate(e,t,r,this._propertyTrack);break;case"angle":s=NS.AngleTypeAdapter.Interpolate(e,t,r,this._propertyTrack);break;case"boolean":s=NS.BooleanTypeAdapter.Interpolate(e,t,r,this._propertyTrack);break;case"color":s=NS.ColorTypeAdapter.Interpolate(e,t,r,this._propertyTrack);break;case"text":s=NS.TextTypeAdapter.Interpolate(e,t,r,this._propertyTrack);break;case"map":s=NS.MapTypeAdapter.Interpolate(e,t,r,this._propertyTrack)}this._propertyAdapter.ChangeProperty(e,s,t,r,p,a,o,n)}GetInterpolatedValue(e,t,r){switch(this._propertyTrack.GetPropertyKeyframeType()){case"numeric":return NS.NumericTypeAdapter.Interpolate(e,t,r,this._propertyTrack);case"angle":return NS.AngleTypeAdapter.Interpolate(e,t,r,this._propertyTrack);case"boolean":return NS.BooleanTypeAdapter.Interpolate(e,t,r,this._propertyTrack);case"color":return NS.ColorTypeAdapter.Interpolate(e,t,r,this._propertyTrack);case"text":return NS.TextTypeAdapter.Interpolate(e,t,r,this._propertyTrack);case"map":return NS.MapTypeAdapter.Interpolate(e,t,r,this._propertyTrack)}}AfterInterpolate(e,t){this._propertyAdapter.AfterChangeProperty(e,t)}SaveState(){this.GetPropertyAdapter().SetSaveState()}ClearSaveState(){this.GetPropertyAdapter().ClearSaveState()}GetCurrentState(){return this.GetPropertyAdapter().GetCurrentState()}CompareInitialStateWithCurrent(){return this.GetPropertyAdapter().CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){return this.GetPropertyAdapter().CompareSaveStateWithCurrent()}GetValueAtTime(){const e=this._propertyTrack,t=e.GetTrack().GetTimeline().GetTime(),r=NS.GetStartPropertyKeyframeForTime(t,e),p=r.GetNext();switch(e.GetPropertyKeyframeType()){case"numeric":return NS.NumericTypeAdapter.Interpolate(t,r,p,e);case"angle":return NS.AngleTypeAdapter.Interpolate(t,r,p,e);case"boolean":return NS.BooleanTypeAdapter.Interpolate(t,r,p,e);case"color":return NS.ColorTypeAdapter.Interpolate(t,r,p,e);case"text":return NS.TextTypeAdapter.Interpolate(t,r,p,e);case"map":return NS.MapTypeAdapter.Interpolate(t,r,p,e)}}_CreatePropertyAdapter(){const e=this._propertyTrack;switch(e.CanHavePropertyKeyframes()?e.GetPropertyKeyframeType():""){case"combo":case"boolean":case"text":case"string":case"map":return new NS.PropertyInterpolationAdapter.NoInterpolationAdapter(this);case"numeric":case"number":case"angle":return"combo"===this._propertyTrack.GetPropertyType()?new NS.PropertyInterpolationAdapter.NoInterpolationAdapter(this):new NS.PropertyInterpolationAdapter.NumericInterpolationAdapter(this);case"color":case"offsetColor":return new NS.PropertyInterpolationAdapter.ColorInterpolationAdapter(this);default:return new NS.PropertyInterpolationAdapter.NumericInterpolationAdapter(this)}}_SaveToJson(){return{"propertyAdapterJson":this.GetPropertyAdapter()._SaveToJson()}}_LoadFromJson(e){e&&this.GetPropertyAdapter()._LoadFromJson(e["propertyAdapterJson"])}}; } // timelines/state/propertySourceAdapters/instanceVariableSourceAdapter.js { const C3=self.C3,INDEX=0;class InstanceVariableSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(e){super(e),this._updatedIndex=NaN}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]}GetIndex(){return this._updatedIndex?this._updatedIndex:super.GetIndex()}GetTarget(){return this._propertyTrack.GetTrack().GetInstance()}UpdateInstanceVariableIndex(e){this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]!==e&&(this._updatedIndex=e)}Interpolate(e,t,r,a,n,d,p){this.GetPropertyAdapter().CanChange(t.GetValue())&&super.Interpolate(e,t,r,a,n,d,p)}GetInterpolatedValue(e,t,r){if(this.GetPropertyAdapter().CanChange(t.GetValue()))return super.GetInterpolatedValue(e,t,r)}_SaveToJson(){return Object.assign(super._SaveToJson(),{"index":this._updatedIndex})}_LoadFromJson(e){e&&(super._LoadFromJson(e),this._updatedIndex=e["index"])}}C3.PropertyTrackState.InstanceVariableSourceAdapter=InstanceVariableSourceAdapter; } // timelines/state/propertySourceAdapters/behaviorSourceAdapter.js { const C3=self.C3,SID=0,INDEX=1,NAME=2;class BehaviorSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(e){super(e),this._sid=NaN}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){const e=this._propertyTrack.GetPropertyTrackDataItem(),t=this._propertyTrack.GetTrack(),r=this._sid?this._sid:e.GetSourceAdapterArguments()[0],a=t.GetInstance(),s=a.GetBehaviorIndexBySID(r);return a.GetBehaviorInstances()[s].GetSdkInstance()}GetBehaviorType(e){const t=this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[2];return e.GetBehaviorTypeByName(t)}UpdateBehaviorTypeSid(e){this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]!==e&&(this._sid=e)}Interpolate(e,t,r,a,s,o,p){const c=this._propertyTrack.GetTrack().GetInstance();this.GetBehaviorType(c.GetObjectClass())&&super.Interpolate(e,t,r,a,s,o,p)}GetInterpolatedValue(e,t,r){const a=this._propertyTrack.GetTrack().GetInstance();if(this.GetBehaviorType(a.GetObjectClass()))return super.GetInterpolatedValue(e,t,r)}_SaveToJson(){return Object.assign(super._SaveToJson(),{"sid":this._sid})}_LoadFromJson(e){e&&(super._LoadFromJson(e),this._sid=e["sid"])}}C3.PropertyTrackState.BehaviorSourceAdapter=BehaviorSourceAdapter; } // timelines/state/propertySourceAdapters/effectSourceAdapter.js { const C3=self.C3,NAME=0,INDEX=1;class EffectSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(e){super(e)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){const e=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList(),t=e.GetEffectList(),r=this.GetEffectType(t).GetIndex();return e.IsEffectIndexActive(r)?e.GetEffectParametersForIndex(r):null}GetEffectType(e){const t=this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0];return e.GetEffectTypeByName(t)}Interpolate(e,t,r,c,f,a,s){this._IsEffectActive()&&super.Interpolate(e,t,r,c,f,a,s)}GetInterpolatedValue(e,t,r){if(this._IsEffectActive())return super.GetInterpolatedValue(e,t,r)}_IsEffectActive(){const e=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList(),t=e.GetEffectList(),r=this.GetEffectType(t);if(!r)return;const c=r.GetIndex();return e.IsEffectIndexActive(c)}}C3.PropertyTrackState.EffectSourceAdapter=EffectSourceAdapter; } // timelines/state/propertySourceAdapters/pluginSourceAdapter.js { const C3=self.C3,INDEX=0,UNIQUE_PROPERTIES=1,SPRITE_START_FROM_UNIQUE_PROPERTY=0;class PluginSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(t){super(t),this._optionalCallbacksRelative=null,this._optionalCallbacksAbsolute=null,this._forceNextChange=!1}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]}GetTarget(){return this._propertyTrack.GetTrack().GetInstance().GetSdkInstance()}Interpolate(t,e,a,i,r,s,n){const o=this._propertyTrack.GetTrack();o.GetObjectClass().GetPlugin()===o.GetInstance().GetObjectClass().GetPlugin()&&super.Interpolate(t,e,a,i,r,s,n)}GetInterpolatedValue(t,e,a){const i=this._propertyTrack.GetTrack();if(i.GetObjectClass().GetPlugin()===i.GetInstance().GetObjectClass().GetPlugin())return super.GetInterpolatedValue(t,e,a)}_IsTimelineChunkDiscreteLike(t,e){if(!e)return!0;if(t?.GetValueWithResultMode()===e?.GetValueWithResultMode())return!0;const a=this._propertyTrack?.GetInterpolationMode();return"discrete"===a}_WasKeyframeReached(t,e,a){const i=t.WasKeyframeReachedOnCurrentTick();if(!i)return!1;return this._propertyTrack.GetTimeline().IsForwardPlayBack()?i.GetTime()===e.GetTime():i.GetTime()===a.GetTime()}SetResetState(){this.GetPropertyAdapter().SetResetState();const t=this._propertyTrack.GetTrack().GetObjectClass().GetPlugin();this._forceNextChange=!1,C3.Plugins.Sprite&&t instanceof C3.Plugins.Sprite&&"initial-animation"===this._propertyTrack.GetPropertyName()&&(this._forceNextChange=!0)}ForceChanges(){const t=this._forceNextChange;return this._forceNextChange=!1,t}GetOptionalCallbacks(t,e){const a=this._propertyTrack.GetTrack(),i=a.GetObjectClass().GetPlugin();if(C3.Plugins.Sprite&&i instanceof C3.Plugins.Sprite){if("initial-frame"===this._propertyTrack.GetPropertyName()||"initial-animation"===this._propertyTrack.GetPropertyName())switch(this._propertyTrack.GetResultMode()){case"relative":return this._optionalCallbacksRelative?(this._optionalCallbacksRelative.startFrom=t.GetAddOn("initial-animation")?.GetStartFrom()??0,this._optionalCallbacksRelative.keyframeReached=this._WasKeyframeReached(a,t,e),this._optionalCallbacksRelative.isChunkDiscreteLike=this._IsTimelineChunkDiscreteLike(t,e),this._optionalCallbacksRelative):(this._optionalCallbacksRelative={onFrameChange:(t,e,i,r,s)=>{if(e!==r){const i=r/e,s=a.GetPropertyTrack("offsetWidth"),n=a.GetPropertyTrack("offsetScaleX");if(s||n){const o=s?.GetSourceAdapter()?.GetPropertyAdapter(),l=n?.GetSourceAdapter()?.GetPropertyAdapter();if(t.HasParent()&&t.GetTransformWithParentWidth())l&&l.SetOriginalSizeProperty(r),t.SetWidth(this.GetNewWidth(r,e,t,a,o,l));else{const e=r*((t._GetSceneGraphInfo()?._GetStartWidth()??this.GetInstanceOriginalWidth(t,a))/this.GetInstanceOriginalWidth(t,a));l&&l.SetOriginalSizeProperty(r);const s=o?.GetChangeAccumulatorProperty()??0,n=l?.GetChangeAccumulatorProperty()??0;t.SetWidth(e+(s+n*i))}}else t.SetWidth(t.GetWidth()*i)}if(i!==s){const e=s/i,r=a.GetPropertyTrack("offsetHeight"),n=a.GetPropertyTrack("offsetScaleY");if(r||n){const o=r?.GetSourceAdapter()?.GetPropertyAdapter(),l=n?.GetSourceAdapter()?.GetPropertyAdapter();if(t.HasParent()&&t.GetTransformWithParentHeight())l&&l.SetOriginalSizeProperty(s),t.SetHeight(this.GetNewHeight(s,i,t,a,o,l));else{const i=s*((t._GetSceneGraphInfo()?._GetStartHeight()??this.GetInstanceOriginalHeight(t,a))/this.GetInstanceOriginalHeight(t,a));l&&l.SetOriginalSizeProperty(s);const r=o?.GetChangeAccumulatorProperty()??0,n=l?.GetChangeAccumulatorProperty()??0;t.SetHeight(i+(r+n*e))}}else t.SetHeight(t.GetHeight()*e)}},startFrom:t.GetAddOn("initial-animation")?.GetStartFrom()??0,keyframeReached:this._WasKeyframeReached(a,t,e),isChunkDiscreteLike:this._IsTimelineChunkDiscreteLike(t,e)},this._optionalCallbacksRelative);case"absolute":return this._optionalCallbacksAbsolute?(this._optionalCallbacksAbsolute.startFrom=t.GetAddOn("initial-animation")?.GetStartFrom()??0,this._optionalCallbacksAbsolute.keyframeReached=this._WasKeyframeReached(a,t,e),this._optionalCallbacksAbsolute.isChunkDiscreteLike=this._IsTimelineChunkDiscreteLike(t,e),this._optionalCallbacksAbsolute):(this._optionalCallbacksAbsolute={startFrom:t.GetAddOn("initial-animation")?.GetStartFrom()??0,keyframeReached:this._WasKeyframeReached(a,t,e),isChunkDiscreteLike:this._IsTimelineChunkDiscreteLike(t,e)},this._optionalCallbacksAbsolute)}}else if(C3.Plugins.Model3D&&i instanceof C3.Plugins.Model3D)switch(this._propertyTrack.GetResultMode()){case"relative":return this._optionalCallbacksRelative?(this._optionalCallbacksRelative.relative=!0,this._optionalCallbacksRelative.absolute=!1,this._optionalCallbacksRelative):(this._optionalCallbacksRelative={relative:!0,absolute:!1},this._optionalCallbacksRelative);case"absolute":return this._optionalCallbacksAbsolute?(this._optionalCallbacksAbsolute.relative=!1,this._optionalCallbacksAbsolute.absolute=!0,this._optionalCallbacksAbsolute):(this._optionalCallbacksAbsolute={relative:!1,absolute:!0},this._optionalCallbacksAbsolute)}}GetLastPropertyKeyframeValue(t,e,a,i=0){const r=e.GetTimeline().GetTrackFromInstance(t.GetInstance());if(!r)return i;const s=r.GetPropertyTrack(a);if(!s)return i;const n=s.GetPropertyTrackDataItem().GetPropertyKeyframeData();if(!n)return i;const o=n.GetLastPropertyKeyframeDataItem();return o?o.GetValue():i}GetInstanceOriginalWidth(t,e){const a=e.GetTimeline().GetTrackFromInstance(t.GetInstance());if(a)return a.GetOriginalSize()[0];const i=t.GetInstance();return i.IsOriginalSizeKnown()?i.GetOriginalSize()[0]:t._GetSceneGraphInfo()._GetStartWidth()}GetInstanceOriginalHeight(t,e){const a=e.GetTimeline().GetTrackFromInstance(t.GetInstance());if(a)return a.GetOriginalSize()[1];const i=t.GetInstance();return i.IsOriginalSizeKnown()?i.GetOriginalSize()[1]:t._GetSceneGraphInfo()._GetStartHeight()}GetNewWidth(t,e,a,i,r,s){const n=a._GetSceneGraphInfo()._GetStartWidth(),o=n/a.GetParent()._GetSceneGraphInfo()._GetStartWidth();let l=1;const c=s?.GetAbsoluteScaleXOffsetProperty()??0;if(0!==c){const t=n/this.GetInstanceOriginalWidth(a,i);l=(t+c)/(0===t?Number.EPSILON:t)}const h=n*(t/e);let G=r?.GetAbsoluteWidthOffsetProperty()??0;G+=h-n;const p=(n+G)/(0===n?Number.EPSILON:n);return a.GetParent().GetWidth()*o*l*p}GetNewHeight(t,e,a,i,r,s){const n=a._GetSceneGraphInfo()._GetStartHeight(),o=n/a.GetParent()._GetSceneGraphInfo()._GetStartHeight();let l=1;const c=s?.GetAbsoluteScaleYOffsetProperty()??0;if(0!==c){const t=n/this.GetInstanceOriginalHeight(a,i);l=(t+c)/(0===t?Number.EPSILON:t)}const h=n*(t/e);let G=r?.GetAbsoluteHeightOffsetProperty()??0;G+=h-n;const p=(n+G)/(0===n?Number.EPSILON:n);return a.GetParent().GetHeight()*o*l*p}}C3.PropertyTrackState.PluginSourceAdapter=PluginSourceAdapter; } // timelines/state/propertySourceAdapters/valueSourceAdapter.js { const C3=self.C3;class ValueSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(t){super(t),this._value=0,this._init=!1}MayNeedBeforeAndAfterInterpolate(){return!1}SetInitialState(){const t=this._propertyTrack.GetPropertyTrackData();let e=this._propertyTrack.GetPropertyTrackDataItem();e=t.GetFirstPropertyKeyframeDataItem(e),this._value=e.GetValueWithResultMode()}SetResumeState(){}GetValue(){return this._init||this._propertyTrack.Interpolate(0),this._value}Interpolate(t,e,r,a,i,o,u){this._value=C3.PropertyTrackState.NumericTypeAdapter.Interpolate(t,e,r,this._propertyTrack),this._init=!0}SaveState(){}ClearSaveState(){}GetCurrentState(){return this._value}CompareInitialStateWithCurrent(){return!1}CompareSaveStateWithCurrent(){return!1}_SaveToJson(){return{"value":this._value,"init":this._init}}_LoadFromJson(t){t&&(this._value=t["value"],this._init=!t.hasOwnProperty("init")||t["init"])}}C3.PropertyTrackState.ValueSourceAdapter=ValueSourceAdapter; } // timelines/state/propertySourceAdapters/audioSourceAdapter.js { const C3=self.C3,PROJECT_FILE=0,PROJECT_FILE_NAME=0,PROJECT_FILE_TYPE=1,START_OFFSET=1,AUDIO_DURATION=2,AUDIO_TAG=3;class AudioSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(t){super(t),this._audioPlaybackStarted=!1,this._sdkInstance=null,this._actions=null,this._expressions=null,this._timeline=this._propertyTrack.GetTimeline(),this._track=this._propertyTrack.GetTrack(),this._sourceAdapterArgs=this._propertyTrack.GetSourceAdapterArgs(),this._fileArgs=this._sourceAdapterArgs[0],this._startOffsetTime=this._sourceAdapterArgs[1],this._sourceAdapterArgs[3]?this._audioTag=this._sourceAdapterArgs[3]:this._audioTag=Math.random().toString(36).slice(2),this._pauseTime=NaN,this._pauseVolume=NaN,this._volume=NaN,this._audioSource=null,this._Initialize()}Release(){super.Release(),this._sdkInstance=null,this._actions=null,this._expressions=null,this._timeline=null,this._track=null,this._sourceAdapterArgs=null,this._fileArgs=null,this._audioSource=null}_Initialize(){if(!self.C3.Plugins.Audio)return;const t=this._propertyTrack.GetRuntime().GetSingleGlobalObjectClassByCtor(self.C3.Plugins.Audio);t&&(this._sdkInstance=t.GetSingleGlobalInstance().GetSdkInstance()),this._actions=self.C3.Plugins.Audio.Acts,this._expressions=self.C3.Plugins.Audio.Exps}_MaybeSetAudioSource(){if(this._audioSource)return;const t=this._propertyTrack.GetTrack().GetPropertyTrack("audioSource");t&&(this._audioSource=t.GetSourceAdapter())}_GetPauseVolume(){const t=this._propertyTrack.GetTrack().GetPropertyTrack("volume");return t?t.GetSourceAdapter()._pauseVolume:this._pauseVolume}TimelineRemoved(){super.TimelineRemoved(),this._audioPlaybackStarted=!1,this._sdkInstance&&(this._expressions&&(this._pauseTime=this._expressions.PlaybackTime.call(this._sdkInstance,this._audioTag),this._pauseVolume=this._expressions.Volume.call(this._sdkInstance,this._audioTag)),this._actions&&this._actions.Stop.call(this._sdkInstance,this._audioTag))}GetAudioTag(){return this._audioTag}GetVolume(){return this._volume}SetVolume(t){this._volume=t}SetInitialState(){super.SetInitialState(),this._pauseTime=NaN,this._audioPlaybackStarted=!1}SetResumeState(){super.SetResumeState();const t=this._propertyTrack.GetTimeline().GetTime();switch(this._pauseTime=t-this._startOffsetTime,this._propertyTrack.GetPropertyName()){case"audioSource":break;case"volume":this._pauseVolume=this._propertyTrack.GetInterpolatedValue(t)}this._audioPlaybackStarted=!1}Interpolate(t,e,s,i,a,o,r){if(this._sdkInstance)switch(this._propertyTrack.GetPropertyName()){case"audioSource":{if(!this._timeline.IsForwardPlayBack())return;if(i)return void(this._actions&&this._actions.Stop.call(this._sdkInstance,this._audioTag));if(t<this._startOffsetTime)return void(this._audioPlaybackStarted=!1);const e=this._expressions.PlaybackRate.call(this._sdkInstance,this._audioTag),s=this._timeline.GetPlaybackRate();if(s!==e&&this._actions.SetPlaybackRate.call(this._sdkInstance,this._audioTag,s),this._audioPlaybackStarted)return;if(!this._propertyTrack.GetTimeline().IsPlaying())return;if(this._audioPlaybackStarted=!0,isNaN(this._pauseTime)){const e=self["performance"].now(),s=t-this._startOffsetTime;if("suspended"===this._sdkInstance.GetAudioContextState())return void(this._audioPlaybackStarted=!1);const i=s+(self["performance"].now()-e)/1e3;if(this._actions){let t=this.GetVolume();isNaN(t)?(this.SetVolume(0),t=0):this.SetVolume(t),this._actions.PlayFromTimeline.call(this._sdkInstance,this._fileArgs,t,this._audioTag,i)}}else{const t=this._pauseTime;this._pauseTime=NaN;const e=this._GetPauseVolume();this._pauseVolume=NaN;if("suspended"===this._sdkInstance.GetAudioContextState())return void(this._audioPlaybackStarted=!1);this._actions&&(this.SetVolume(e),this._actions.PlayFromTimeline.call(this._sdkInstance,this._fileArgs,e,this._audioTag,t))}break}case"volume":this._MaybeSetAudioSource(),super.Interpolate(t,e,s,i,a,o,r)}}GetInterpolatedValue(t,e,s){if(this._sdkInstance)switch(this._propertyTrack.GetPropertyName()){case"audioSource":return;case"volume":return this._MaybeSetAudioSource(),super.GetInterpolatedValue(t,e,s)}}Getter(t,e){return this._audioSource?this._audioSource.GetVolume():0}Setter(t,e,s,i){this._audioSource&&this._audioSource.SetVolume(this.Getter()+e),this._actions&&this._audioSource&&this._actions.SetVolume.call(this._sdkInstance,this._audioSource.GetAudioTag(),this._audioSource.GetVolume())}AbsoluteSetter(t,e,s){this._audioSource&&this._audioSource.SetVolume(e),this._actions&&this._audioSource&&this._actions.SetVolume.call(this._sdkInstance,this._audioSource.GetAudioTag(),this._audioSource.GetVolume())}DoesRounding(){return!0}_SaveToJson(){return{"audioPlaybackStarted":this._audioPlaybackStarted,"audioTag":this._audioTag,"pauseTime":this._pauseTime,"pauseVolume":this._pauseVolume,"volume":this._volume}}_LoadFromJson(t){t&&(this._audioPlaybackStarted=t["audioPlaybackStarted"],this._audioTag=t["audioTag"],this._pauseTime=t["pauseTime"],this._pauseVolume=t["pauseVolume"],this._volume=t["volume"],this._Initialize())}}C3.PropertyTrackState.AudioSourceAdapter=AudioSourceAdapter; } // timelines/state/propertyInterpolationAdapters/propertyInterpolationAdapter.js { const C3=self.C3;C3.PropertyTrackState.PropertyInterpolationAdapter=class{constructor(t){this._sourceAdapter=t,this._propertyTrack=t.GetPropertyTrack(),this._worldInfo=this._propertyTrack.GetTrack().GetWorldInfo(),this._property=this._propertyTrack.GetPropertyName(),this._firstAbsoluteUpdate=!1,this._saveState=null,this._target=null}Release(){this._sourceAdapter=null,this._propertyTrack=null,this._worldInfo=null,this._saveState=null,this._target=null}MayNeedBeforeAndAfterInterpolate(){return!1}TimelineRemoved(){}CleanCaches(){this._worldInfo=null,this._saveState=null,this._target=null}GetSourceAdapter(){return this._sourceAdapter}GetPropertyTrack(){return this._propertyTrack}GetWorldInfo(){return this._worldInfo||(this._worldInfo=this._propertyTrack.GetTrack().GetWorldInfo()),this._worldInfo}SetFirstAbsoluteUpdate(t){this._firstAbsoluteUpdate=!!t}GetFirstAbsoluteUpdate(){return this._firstAbsoluteUpdate}SetResetState(){}SetInitialState(){}SetResumeState(){}SetSaveState(){this._saveState=this.GetCurrentState()}ClearSaveState(){this._saveState=null}GetCurrentState(){}CompareInitialStateWithCurrent(){}CompareSaveStateWithCurrent(){}CanChange(t){return typeof this._Getter()===typeof t}BeforeChangeProperty(t,e){}ChangeProperty(t,e,r,a,s,o,i,n){}AfterChangeProperty(t,e){}_FirstKeyframeGetter(){return this._PickTimelinePlaybackMode(()=>{const t=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(t)},()=>{const t=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(t)}).GetAbsoluteValue()}_CurrentKeyframeGetter(){const t=this._propertyTrack.GetTimeline().GetTime()-this._propertyTrack.GetTrack().GetStartOffset();return this._PickTimelinePlaybackMode(()=>{const e=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(t,e)},()=>{const e=this._propertyTrack.GetPropertyTrackDataItem(),r=this._propertyTrack.GetPropertyTrackData(),a=r.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(t,e);return a||r.GetLastPropertyKeyframeDataItem(e)}).GetAbsoluteValue()}_PickTimelinePlaybackMode(t,e){return this._propertyTrack.GetTimeline().IsForwardPlayBack()?t():e()}_PickResultMode(t,e){return"relative"===this._propertyTrack.GetResultMode()?t():e()}_PickFirstAbsoluteUpdate(t,e){return this.GetFirstAbsoluteUpdate()?(this.SetFirstAbsoluteUpdate(!1),t()):e()}_GetAbsoluteInitialValue(t){}_GetIndex(){return this._sourceAdapter.GetIndex()}_GetTarget(){return this._target||(this._target=this._sourceAdapter.GetTarget()),this._target}_PickSource(t,e,r,a,s,o){switch(this._propertyTrack.GetSourceAdapterId()){case"behavior":return t();case"effect":return e();case"instance-variable":return r();case"plugin":return a();case"world-instance":return s();case"audio":return o()}}_SaveToJson(){return{"firstAbsoluteUpdate":this._firstAbsoluteUpdate,"saveState":this._saveState}}_LoadFromJson(t){t&&(this._firstAbsoluteUpdate=t["firstAbsoluteUpdate"],this._saveState=t["saveState"])}_GetPropertyKeyframeStubs(t,e=!1){const r=[];for(const a of t){const t=a.GetTrack().GetStartOffset();for(const s of a.GetPropertyKeyframeDataItems())e&&0===s.GetTime()?r.push({time:t+s.GetTime(),value:s.GetAbsoluteValue()}):e||r.push({time:t+s.GetTime(),value:s.GetAbsoluteValue()})}return r.sort((t,e)=>t.time-e.time)}_GetLastPropertyKeyframeStub(t,e,r){return this._GetPropertyKeyframeStubLowerThanPlayhead(e,r)}_GetPropertyKeyframeStubLowerThanPlayhead(t,e){for(let r=e.length-1;r>=0;r--){if(e[r].time<=t)return e[r]}return null}}; } // timelines/state/propertyInterpolationAdapters/colorInterpolationAdapter.js { const C3=self.C3,TMP_COLORS_MAP=new Map,TMP_COLOR=[0,0,0];class ColorInterpolationAdapter extends C3.PropertyTrackState.PropertyInterpolationAdapter{constructor(e){super(e)}SetResetState(){}SetInitialState(){}SetResumeState(){}GetCurrentState(){const e=this._propertyTrack.GetSourceAdapterId(),t=this._GetTarget(),r=this._GetIndex();switch(e){case"behavior":case"plugin":return this._ToColorArray(t.GetPropertyValueByIndex(r));case"effect":return this._ToColorArray(t[r]);case"world-instance":return this._ToColorArray(this._Getter())}}CompareInitialStateWithCurrent(){const e=this._FirstKeyframeGetter();return!this._CompareColors(e,this._Getter())}CompareSaveStateWithCurrent(){return!C3.IsNullOrUndefined(this._saveState)&&!this._CompareColors(this._saveState,this._Getter())}_CompareColors(e,t){return e=this._GetColorFromArray(e),t=this._GetColorFromArray(t),e.equalsIgnoringAlpha(t)}_FirstKeyframeGetter(){const e=super._FirstKeyframeGetter();return this._GetColorFromArray(e)}_CurrentKeyframeGetter(){const e=super._CurrentKeyframeGetter();return this._GetColorFromArray(e)}_GetAbsoluteInitialValue(e){}_ToColorArray(e){return C3.IsInstanceOf(e,C3.Color)?e.toArray().slice(0,3):e.slice(0,3)}_GetColorFromArray(e){return C3.IsInstanceOf(e,C3.Color)?e:new C3.Color(e[0],e[1],e[2],1)}CanChange(e){return!0}MayNeedBeforeAndAfterInterpolate(){return!0}BeforeChangeProperty(){const e=this._propertyTrack.GetTimeline(),t=this._propertyTrack.GetInstance(),r=this._propertyTrack.GetSourceAdapter(),o=e.GetSimilarPropertyTracks(t,r,this._property,this._propertyTrack);if(o&&o.length>1){TMP_COLORS_MAP.has(t)||TMP_COLORS_MAP.set(t,new Map);const e=TMP_COLORS_MAP.get(t),r=this._propertyTrack.GetSourceAdapterId();e.has(r)||e.set(r,new Map);const o=e.get(r);o.has(this._property)||o.set(this._property,{used:!1,color:new C3.Color(0,0,0,1)})}}_GetTmpColor(e,t,r){const o=TMP_COLORS_MAP.get(e).get(t).get(r);return o.used=!0,o.color}ChangeProperty(e,t,r,o,s,a,n,i){const p=this._propertyTrack.GetTimeline(),_=this._propertyTrack.GetTrack(),c=this._propertyTrack.GetInstance(),l=this._propertyTrack.GetSourceAdapter(),h=this._propertyTrack.GetSourceAdapterId(),C=this._property,y=p.GetSimilarPropertyTracks(c,l,C,this._propertyTrack);if(y&&y.length>1){const e=this._GetPropertyKeyframeStubs(y,!0),r=this._GetLastPropertyKeyframeStub(p,p.GetTime(),e);if(r){const e=_.GetStartOffset(),o=r.time-e;if(0===o)this._GetTmpColor(c,h,this._property).addRgb(t[0],t[1],t[2]);else{if(o<0)return;const e=t[0],r=t[1],s=t[2],a=this._propertyTrack.Interpolate(o,!1,!0),n=C3.Color.DiffChannel(e,a[0]),i=C3.Color.DiffChannel(r,a[1]),p=C3.Color.DiffChannel(s,a[2]);this._GetTmpColor(c,h,this._property).addRgb(n,i,p)}}}else this._Setter(t[0],t[1],t[2])}AfterChangeProperty(){const e=this._propertyTrack.GetInstance();if(!TMP_COLORS_MAP.has(e))return;const t=TMP_COLORS_MAP.get(e),r=this._propertyTrack.GetSourceAdapterId();if(!t.has(r))return;const o=t.get(r);if(!o.has(this._property))return;const s=o.get(this._property),a=s.used,n=s.color;a&&this._Setter(n.getR(),n.getG(),n.getB()),0===o.size&&t.delete(r),0===t.size&&TMP_COLORS_MAP.delete(e)}_Getter(){const e=this._propertyTrack.GetSourceAdapterId(),t=this._GetTarget(),r=this._GetIndex();switch(e){case"behavior":case"plugin":return this._GetColorFromArray(t.GetPropertyValueByIndex(r));case"effect":return t[r].clone();case"world-instance":return this.GetWorldInfo().GetUnpremultipliedColor().clone()}}_Setter(e,t,r){const o=this._propertyTrack.GetSourceAdapterId(),s=this._GetTarget(),a=this._GetIndex();switch(o){case"behavior":case"plugin":TMP_COLOR[0]=e,TMP_COLOR[1]=t,TMP_COLOR[2]=r,s.SetPropertyValueByIndex(a,TMP_COLOR);break;case"effect":s[a].setRgb(e,t,r);break;case"world-instance":this.GetWorldInfo().SetUnpremultipliedColorRGB(e,t,r)}}_SaveToJson(){}_LoadFromJson(e){}}C3.PropertyTrackState.PropertyInterpolationAdapter.ColorInterpolationAdapter=ColorInterpolationAdapter; } // timelines/state/propertyInterpolationAdapters/noInterpolationAdapter.js { const C3=self.C3,NS=C3.PropertyTrackState;class NoInterpolationAdapter extends C3.PropertyTrackState.PropertyInterpolationAdapter{constructor(e){super(e)}SetResetState(){}SetInitialState(){}SetResumeState(){}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return!C3.IsNullOrUndefined(this._saveState)&&this._saveState!==this.GetCurrentState()}MayNeedBeforeAndAfterInterpolate(){return!1}ChangeProperty(e,t,r,a,s,n,i,o){const c=this._propertyTrack,p=c.GetTrack(),h=c.GetSourceAdapterId(),l=c.GetTimeline(),u=p.GetInstance(),S=c.GetSourceAdapter(),G=this._property,d=l.GetSimilarPropertyTracks(u,S,G,c);if(d&&d.length>1){const r=this._GetPropertyKeyframeStubs(d),a=e+p.GetStartOffset(),s=this._GetLastPropertyKeyframeStub(l,a,r);s&&(t=s.value)}switch(c.GetPropertyKeyframeType()){case"numeric":if(!NS.NumericTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),t,h))return;this._Setter(t,r,a);break;case"angle":if(!NS.AngleTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),t,h))return;this._Setter(t,r,a);break;case"boolean":if(!NS.BooleanTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),t,h))return;this._Setter(t,r,a);break;case"color":if(!NS.ColorTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),t,h))return;this._Setter(t,r,a);break;case"text":{const e=this._ForceChanges();if(!NS.TextTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),t,h)&&!e)return;this._Setter(t,r,a);break}case"map":{const e=this._ForceChanges();if(!NS.MapTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),t,h)&&!e)return;this._Setter(t,r,a);break}}}_ForceChanges(){switch(this._propertyTrack.GetSourceAdapterId()){case"behavior":case"effect":case"instance-variable":return!1;case"plugin":return this.GetSourceAdapter().ForceChanges()}return!1}_Getter(){const e=this._propertyTrack.GetSourceAdapterId(),t=this._GetTarget(),r=this._GetIndex();switch(e){case"behavior":case"plugin":return t.GetPropertyValueByIndex(r);case"effect":return t[r];case"instance-variable":return t.GetInstanceVariableValue(r)}}_Setter(e,t,r){const a=this._propertyTrack.GetSourceAdapterId(),s=this._GetTarget(),n=this._GetIndex();switch(a){case"behavior":s.SetPropertyValueByIndex(n,e);break;case"effect":s[n]=e;break;case"instance-variable":s.SetInstanceVariableValue(n,e);break;case"plugin":s.SetPropertyValueByIndex(n,e,this.GetSourceAdapter().GetOptionalCallbacks(t,r))}}}C3.PropertyTrackState.PropertyInterpolationAdapter.NoInterpolationAdapter=NoInterpolationAdapter; } // timelines/state/propertyInterpolationAdapters/numericInterpolationAdapter.js { const C3=self.C3,NS=C3.PropertyTrackState.PropertyInterpolationAdapter,INSTANCE_FUNC_MAP=new Map,add=(t,e,a,r,i,s=!1,o=null,n=null)=>{INSTANCE_FUNC_MAP.set(t,{setter:e,absolute_setter:a,getter:r,round … [Строка слишком длинная. Вы можете скачать файл] } // timelines/state/propertyInterpolationAdapters/numericInterpolationAdapterForTimeline.js { const C3=self.C3;class AbsoluteValueObject{constructor(e){this._used=!1,this._value=0,this._propertyKeyframeReached=!1,this._endState=!1,this._propertyTracks=e;for(let e=0,t=this._propertyTracks.length;e<t;e++)this._propertyTracks[e].SetAbsoluteValueObject(this)}GetPropertyTracks(){return this._propertyTracks}SetUsed(){this._used=!0}GetUsed(){return this._used}SetValue(e){this._value=e}GetValue(){return this._value}SetPropertyKeyframeReached(e){this._propertyKeyframeReached=e}GetPropertyKeyframeReached(){return this._propertyKeyframeReached}SetEndState(e){this._endState=e}GetEndState(){return this._endState}Reset(){this._used=!1,this._value=0,this._propertyKeyframeReached=!1,this._endState=!1}}class NumericInterpolationAdapterForTimeline{constructor(e){this._numericInterpolationAdapter=e}Release(){this._numericInterpolationAdapter=null}GetType(){return 0}SetInitialState(){const e=this._numericInterpolationAdapter;this._numericInterpolationAdapter.GetPropertyTrack();return e._PickResultMode(()=>e._PickTimelinePlaybackMode(()=>0,()=>e.GetSourceAdapter().GetValueAtTime()),()=>{})}SetResumeState(){}MayNeedBeforeAndAfterInterpolate(){this._numericInterpolationAdapter;switch(this._numericInterpolationAdapter.GetPropertyTrack().GetResultMode()){case"relative":return!1;case"absolute":return!0}}BeforeChangeProperty(e,t){this._numericInterpolationAdapter;const r=this._numericInterpolationAdapter.GetPropertyTrack(),a=r.GetPropertyName();switch(r.GetResultMode()){case"relative":break;case"absolute":if(r.HasAbsoluteValueObject()){r.GetAbsoluteValueObject().Reset()}else{const e=r.GetTimeline(),t=r.GetInstance(),s=r.GetSourceAdapter(),o=e.GetSimilarPropertyTracks(t,s,a,r);o&&o.length>1&&new AbsoluteValueObject(o)}}}ChangeProperty(e,t,r,a,s,o,i,n){const l=this._numericInterpolationAdapter,u=this._numericInterpolationAdapter.GetPropertyTrack();switch(u.GetResultMode()){case"relative":{const i=l.GetLastValue();l._Setter(t-i,r,a),o&&this._MaybeEnsureValue(e,r,a,s,i,t),l.SetLastValue(t);break}case"absolute":{const e=u.GetTimeline(),s=u.GetTrack();u.GetInstance(),u.GetSourceAdapter();if(u.HasAbsoluteValueObject()){const r=u.GetAbsoluteValueObject(),a=r.GetPropertyTracks(),o=l._GetPropertyKeyframeStubs(a,!0),c=l._GetLastPropertyKeyframeStub(e,e.GetTime(),o);if(c){const e=s.GetStartOffset(),a=c.time-e;if(0===a)r.SetEndState(i),r.SetPropertyKeyframeReached(n),r.SetUsed(),r.SetValue(r.GetValue()+t);else{if(a<0)return;const e=u.GetInterpolatedValue(a);r.SetEndState(i),r.SetPropertyKeyframeReached(n),r.SetUsed(),r.SetValue(r.GetValue()+(t-e))}}}else l._SetterAbsolute(t,n,i,r,a);break}}}AfterChangeProperty(e,t){const r=this._numericInterpolationAdapter,a=this._numericInterpolationAdapter.GetPropertyTrack();switch(a.GetResultMode()){case"relative":break;case"absolute":if(a.HasAbsoluteValueObject()){const s=a.GetAbsoluteValueObject();s.GetUsed()&&r._SetterAbsolute(s.GetValue(),s.GetPropertyKeyframeReached(),s.GetEndState(),e,t)}}}_MaybeEnsureValue(e,t,r,a,s,o){const i=this._numericInterpolationAdapter;a||(t&&e===t.GetTime()?i._AddDelta(t.GetValueWithResultMode(),t,r):r&&e===r.GetTime()?i._AddDelta(r.GetValueWithResultMode(),t,r):o-s===0&&i._AddDelta(t.GetValueWithResultMode(),t,r))}}C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline=NumericInterpolationAdapterForTimeline; } // timelines/state/propertyInterpolationAdapters/numericInterpolationAdapterForTween.js { const C3=self.C3;class NumericInterpolationAdapterForTween{constructor(e){this._numericInterpolationAdapter=e}Release(){this._numericInterpolationAdapter=null}GetType(){return 1}SetInitialState(){const e=this._numericInterpolationAdapter;return e.SetFirstAbsoluteUpdate(!0),this._GetAbsoluteInitialValue(e._FirstKeyframeGetter())}SetResumeState(){const e=this._numericInterpolationAdapter;if(e._FirstKeyframeGetter()!==e._CurrentKeyframeGetter())return e.SetFirstAbsoluteUpdate(!0),this._GetAbsoluteInitialValue(e._CurrentKeyframeGetter())}MayNeedBeforeAndAfterInterpolate(){return!1}BeforeChangeProperty(){}ChangeProperty(e,t,r,a,n,i,o,l){const s=this._numericInterpolationAdapter,u=s.GetLastValue();switch(s.GetPropertyTrack().GetResultMode()){case"relative":s._Setter(t-u,r,a),i&&this._MaybeEnsureValue(e,r,a,n,u,t,!1,o);break;case"absolute":s.GetFirstAbsoluteUpdate()?(s.SetFirstAbsoluteUpdate(!1),s._Setter(u,r,a)):0===e&&0===s.GetPropertyTrack().GetTimeline().GetTotalTime()?s._SetterAbsolute(t,!0,!1,r,a):(s._Setter(t-u,r,a),i&&this._MaybeEnsureValue(e,r,a,n,u,t,this._ForceEndValue(),o))}s.SetLastValue(t)}AfterChangeProperty(){}_GetAbsoluteInitialValue(e){return e-this._numericInterpolationAdapter.GetCurrentState()}_ForceEndValue(){const e=this._numericInterpolationAdapter,t=e.GetWorldInfo().GetInstance(),r=e.GetPropertyTrack().GetRuntime().GetTimelineManager();let a=0;for(const e of r.GetPlayingTimelines())0===e.GetType()?e.HasTrackInstance(t)&&a++:1===e.GetType()&&e.GetInstance()===t&&a++;return a<=1}_MaybeEnsureValue(e,t,r,a,n,i,o,l){const s=this._numericInterpolationAdapter;a?t&&e===t.GetTime()?s._AddDelta(t.GetValueWithResultMode(),t,r,o,l):r&&e===r.GetTime()?s._AddDelta(r.GetValueWithResultMode(),t,r,o,l):r||s._AddDelta(t.GetValueWithResultMode(),t,r,o,l):t&&e===t.GetTime()?s._AddDelta(t.GetValueWithResultMode(),t,r,o,l):r&&e===r.GetTime()?s._AddDelta(r.GetValueWithResultMode(),t,r,o,l):i-n===0&&s._AddDelta(t.GetValueWithResultMode(),t,r,o,l)}}C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween=NumericInterpolationAdapterForTween; } // timelines/state/propertyTypeAdapters/numericTypeAdapter.js { const C3=self.C3,Ease=self.Ease;C3.PropertyTrackState.NumericTypeAdapter=class{constructor(){}static WillChange(e,t,a,r){let n;switch(r){case"behavior":case"plugin":n=t.GetPropertyValueByIndex(e);break;case"effect":n=t[e];break;case"instance-variable":n=t.GetInstanceVariableValue(e)}return n!==a}static Interpolate(e,t,a,r){if(!a){const e=r.GetPropertyTrackDataItem();return r.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(e).GetValueWithResultMode()}let n=r.GetInterpolationMode();if("default"===n&&(n="continuous"),"combo"===r.GetPropertyType()&&(n="discrete"),"discrete"===n)return C3.PropertyTrackState.GetPropertyKeyframeValueWithPlaybackDirection(t,a,r);if("continuous"===n||"step"===n){const s=r.GetTimeline().GetStep();if("step"===n&&0!==s){const t=1/s;e=Math.floor(e*t)/t}const c=t.GetValueWithResultMode(),i=a.GetValueWithResultMode(),o=t.GetAddOn("cubic-bezier"),l=a.GetAddOn("cubic-bezier"),u=o&&o.GetStartEnable()&&l&&l.GetEndEnable();if(!u&&c===i)return c;const G=t.GetTime(),p=a.GetTime();"step"===n&&0!==s&&(e=C3.clamp(e,G,p));const y=C3.normalize(e,G,p),b=t.GetEase();let d;if(u){const e=p-G;d=Ease.GetRuntimeEase(b)(e*y,0,1,e),d=Ease.GetRuntimeEase("cubicbezier")(d,c,c+o.GetStartAnchor(),i+l.GetEndAnchor(),i)}else d=Ease.GetRuntimeEase(b)((p-G)*y,c,i-c,p-G);return"integer"===r.GetPropertyType()?Math.floor(d):d}}}; } // timelines/state/propertyTypeAdapters/angleTypeAdapter.js { const C3=self.C3;C3.PropertyTrackState.AngleTypeAdapter=class{constructor(){}static WillChange(e,t,a,r){let s;switch(r){case"behavior":case"plugin":s=t.GetPropertyValueByIndex(e);break;case"effect":s=t[e];break;case"instance-variable":s=t.GetInstanceVariableValue(e)}return s!==a}static Interpolate(e,t,a,r){if(!a){const e=r.GetPropertyTrackDataItem();return r.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(e).GetValueWithResultMode()}let s=r.GetInterpolationMode();if("default"===s&&(s="continuous"),"combo"===r.GetPropertyType()&&(s="discrete"),"discrete"===s)return C3.PropertyTrackState.GetPropertyKeyframeValueWithPlaybackDirection(t,a,r);if("continuous"===s||"step"===s){const n=r.GetTimeline().GetStep();if("step"===s&&0!==n){const t=1/n;e=Math.floor(e*t)/t}const c=t.GetTime(),o=a.GetTime(),i=t.GetValueWithResultMode(),l=a.GetValueWithResultMode();"step"===s&&0!==n&&(e=C3.clamp(e,c,o));const u=t.GetAddOn("angle");if(!u){if(i===l)return i;const a=C3.normalize(e,c,o),r=self.Ease.GetRuntimeEase(t.GetEase());return C3.angleLerp(i,l,r(a,0,1,1))}{const a=u.GetRevolutions();if(i===l&&0===a)return i;const r=C3.normalize(e,c,o),s=self.Ease.GetRuntimeEase(t.GetEase())(r,0,1,1);switch(u.GetDirection()){case"closest":return C3.angleLerp(i,l,s,a);case"clockwise":return C3.angleLerpClockwise(i,l,s,a);case"anti-clockwise":return C3.angleLerpAntiClockwise(i,l,s,a)}}}}}; } // timelines/state/propertyTypeAdapters/booleanTypeAdapter.js { const C3=self.C3;C3.PropertyTrackState.BooleanTypeAdapter=class{constructor(){}static WillChange(e,t,a,r){let c;switch(r){case"behavior":case"plugin":c=t.GetPropertyValueByIndex(e);break;case"effect":c=t[e];break;case"instance-variable":c=t.GetInstanceVariableValue(e)}return!!c!=!!a}static Interpolate(e,t,a,r){if(!a){const e=r.GetPropertyTrackDataItem();return r.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(e).GetValueWithResultMode()?1:0}return C3.PropertyTrackState.GetPropertyKeyframeValueWithPlaybackDirection(t,a,r)?1:0}}; } // timelines/state/propertyTypeAdapters/colorTypeAdapter.js { const C3=self.C3,TEMP_COLOR_ARRAY=[0,0,0],TEMP_COLOR_ARRAY_2=[0,0,0],TEMP_COLOR_ARRAY_3=[0,0,0];C3.PropertyTrackState.ColorTypeAdapter=class{constructor(){}static WillChange(R,e,_,t){let A;switch(t){case"behavior":case"plugin":A=e.GetPropertyValueByIndex(R);break;case"effect":A=e[R];break;case"instance-variable":A=e.GetInstanceVariableValue(R)}return Array.isArray(_)?(TEMP_COLOR_ARRAY[0]=_[0],TEMP_COLOR_ARRAY[1]=_[1],TEMP_COLOR_ARRAY[2]=_[2]):(TEMP_COLOR_ARRAY_3.parseCommaSeparatedRgb(_),TEMP_COLOR_ARRAY[0]=Math.floor(255*TEMP_COLOR_ARRAY_3.getR()),TEMP_COLOR_ARRAY[1]=Math.floor(255*TEMP_COLOR_ARRAY_3.getG()),TEMP_COLOR_ARRAY[2]=Math.floor(255*TEMP_COLOR_ARRAY_3.getB())),Array.isArray(A)?(TEMP_COLOR_ARRAY_2[0]=A[0],TEMP_COLOR_ARRAY_2[1]=A[1],TEMP_COLOR_ARRAY_2[2]=A[2]):(TEMP_COLOR_ARRAY_3.parseCommaSeparatedRgb(A),TEMP_COLOR_ARRAY_2[0]=Math.floor(255*TEMP_COLOR_ARRAY_3.getR()),TEMP_COLOR_ARRAY_2[1]=Math.floor(255*TEMP_COLOR_ARRAY_3.getG()),TEMP_COLOR_ARRAY_2[2]=Math.floor(255*TEMP_COLOR_ARRAY_3.getB())),TEMP_COLOR_ARRAY[0]!==TEMP_COLOR_ARRAY_2[0]||(TEMP_COLOR_ARRAY[1]!==TEMP_COLOR_ARRAY_2[1]||TEMP_COLOR_ARRAY[2]!==TEMP_COLOR_ARRAY_2[2])}static Interpolate(R,e,_,t){if(!_){const R=t.GetPropertyTrackDataItem(),e=t.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(R).GetValueWithResultMode();return TEMP_COLOR_ARRAY[0]=e[0],TEMP_COLOR_ARRAY[1]=e[1],TEMP_COLOR_ARRAY[2]=e[2],TEMP_COLOR_ARRAY}let A=t.GetInterpolationMode();if("default"===A&&(A="continuous"),"discrete"===A){const R=C3.PropertyTrackState.GetPropertyKeyframeValueWithPlaybackDirection(e,_,t);return TEMP_COLOR_ARRAY[0]=R[0],TEMP_COLOR_ARRAY[1]=R[1],TEMP_COLOR_ARRAY[2]=R[2],TEMP_COLOR_ARRAY}if("continuous"===A||"step"===A){const O=t.GetTimeline().GetStep();if("step"===A&&0!==O){const e=1/O;R=Math.floor(R*e)/e}const a=e.GetTime(),r=_.GetTime(),M=e.GetValueWithResultMode(),C=_.GetValueWithResultMode();"step"===A&&0!==O&&(R=C3.clamp(R,a,r));const P=C3.normalize(R,a,r),T=e.GetEase(),o=M[0],E=M[1],L=M[2],Y=C[0],s=C[1],l=C[2],i=self.Ease.GetRuntimeEase(T),c=r-a,n=c*P;return TEMP_COLOR_ARRAY[0]=o===Y?o:i(n,o,Y-o,c),TEMP_COLOR_ARRAY[1]=E===s?E:i(n,E,s-E,c),TEMP_COLOR_ARRAY[2]=L===l?L:i(n,L,l-L,c),TEMP_COLOR_ARRAY}}}; } // timelines/state/propertyTypeAdapters/textTypeAdapter.js { const C3=self.C3;C3.PropertyTrackState.TextTypeAdapter=class{constructor(){}static WillChange(e,t,a,r){let c;switch(r){case"behavior":case"plugin":c=t.GetPropertyValueByIndex(e);break;case"effect":c=t[e];break;case"instance-variable":c=t.GetInstanceVariableValue(e)}return c!==a}static Interpolate(e,t,a,r){if(!a){const e=r.GetPropertyTrackDataItem();return r.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(e).GetValueWithResultMode()}return C3.PropertyTrackState.GetPropertyKeyframeValueWithPlaybackDirection(t,a,r)}}; } // timelines/state/propertyTypeAdapters/mapTypeAdapter.js { const C3=self.C3;C3.PropertyTrackState.MapTypeAdapter=class{constructor(){}static WillChange(e,t,r,a){let s;switch(a){case"behavior":case"plugin":s=t.GetPropertyValueByIndex(e);break;case"effect":s=t[e];break;case"instance-variable":s=t.GetInstanceVariableValue(e)}return this.#e(s,r)}static Interpolate(e,t,r,a){if(!r){const e=a.GetPropertyTrackDataItem();return a.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(e).GetValueWithResultMode()}return C3.PropertyTrackState.GetPropertyKeyframeValueWithPlaybackDirection(t,r,a)}static#e(e,t){if(e.size!==t.size)return!0;for(const[r,a]of e)if(!t.has(r)||t.get(r)!==a)return!0;return!1}}; } // timelines/data/timelineDataManager.js { const C3=self.C3;C3.TimelineDataManager=class{constructor(){this._timelineDataItems=new Map}Release(){for(const e of this._timelineDataItems.values())e.Release();this._timelineDataItems.clear(),this._timelineDataItems=null}Add(e){const a=new C3.TimelineDataItem(e),t=a.GetName();this._timelineDataItems.set(t,a)}Get(e){return this._timelineDataItems.get(e)}GetNameId(){return 0}static _CreateDataItems(e,a,t,s){if(a)for(const i of a)C3.TimelineDataManager._CreateDataItem("create",i,e,t,s)}static _CreateDataItemsIncludingDisabled(e,a,t,s){if(a)for(const i of a)C3.TimelineDataManager._CreateDataItem("create-including-disabled",i,e,t,s)}static _LoadDataItemsFromJson(e,a,t,s){e.length?a.forEach((a,t)=>{e[t]._LoadFromJson(a)}):a.forEach(a=>{C3.TimelineDataManager._CreateDataItem("load",a,e,t,s)})}static _CreateDataItem(e,a,t,s,i){let n;if("function"==typeof s)switch(e){case"load":n=new s(null,i);break;case"create":case"create-including-disabled":n=new s(a,i)}else if("object"==typeof s){const t=a[s.prop],c=s.map.get(t);switch(e){case"load":n=new c(null,i);break;case"create":case"create-including-disabled":n=new c(a,i)}}switch(e){case"load":n._LoadFromJson(a),t.push(n);break;case"create":if("function"==typeof n.GetEnable&&!n.GetEnable())return n.Release();t.push(n);break;case"create-including-disabled":t.push(n)}}}; } // timelines/data/timelineData.js { const C3=self.C3,NAME=0,TOTAL_TIME=1,STEP=2,INTERPOLATION_MODE=3,RESULT_MODE=4,TRACKS=5,LOOP=6,PING_PONG=7,REPEAT_COUNT=8,START_ON_LAYOUT=9,TRANSFORM_WITH_SCENE_GRAPH=10,USE_SYSTEM_TIMESCALE=11;C3.TimelineDataItem=class{constructor(t){this._name="",this._totalTime=NaN,this._step=0,this._interpolationMode="default",this._resultMode="default",this._loop=!1,this._pingPong=!1,this._repeatCount=1,this._trackData=null,this._startOnLayout="",this._transformWithSceneGraph=!1,this._useSystemTimescale=!0,t&&(this._name=t[0],this._totalTime=t[1],this._step=t[2],this._interpolationMode=t[3],this._resultMode=t[4],this._loop=!!t[6],this._pingPong=!!t[7],this._repeatCount=t[8],this._startOnLayout=t[9],this._transformWithSceneGraph=!!t[10],this._useSystemTimescale=!!t[11],this._trackData=new C3.TrackData(t[5],this))}Release(){this._trackData.Release(),this._trackData=null}GetTrackData(){return this._trackData||(this._trackData=new C3.TrackData(null,this)),this._trackData}GetName(){return this._name}SetName(t){this._name=t}GetTotalTime(){return this._totalTime}SetTotalTime(t){this._totalTime=t}GetStep(){return this._step}SetStep(t){this._step=t}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(t){this._interpolationMode=t}GetResultMode(){return this._resultMode}SetResultMode(t){this._resultMode=t}GetLoop(){return this._loop}SetLoop(t){this._loop=t}GetPingPong(){return this._pingPong}SetPingPong(t){this._pingPong=t}GetRepeatCount(){return this._repeatCount}SetRepeatCount(t){this._repeatCount=t}GetStartOnLayout(){return this._startOnLayout}GetTransformWithSceneGraph(){return this._transformWithSceneGraph}GetUseSystemTimescale(){return this._useSystemTimescale}_SaveToJson(){return{"trackDataJson":this._trackData._SaveToJson(),"name":this._name,"totalTime":this._totalTime,"step":this._step,"interpolationMode":this._interpolationMode,"resultMode":this._resultMode,"loop":this._loop,"pingPong":this._pingPong,"repeatCount":this._repeatCount,"startOnLayout":this._startOnLayout,"transformWithSceneGraph":!!this._transformWithSceneGraph,"useSystemTimescale":this._useSystemTimescale}}_LoadFromJson(t){t&&(this.GetTrackData()._LoadFromJson(t["trackDataJson"]),this._name=t["name"],this._totalTime=t["totalTime"],this._step=t["step"],this._interpolationMode=t["interpolationMode"],this._resultMode=t["resultMode"],this._loop=t["loop"],this._pingPong=t["pingPong"],this._repeatCount=t["repeatCount"],this._startOnLayout=t["startOnLayout"],this._transformWithSceneGraph=!!t["transformWithSceneGraph"],this._useSystemTimescale=!!t["useSystemTimescale"])}}; } // timelines/data/trackData.js { const C3=self.C3,WI_DATA=0,OC_INDEX=1,WI_UID=2,INTERPOLATION_MODE=1,RESULT_MODE=2,ENABLED=3,KEYFRAMES=4,PROPERTY_TRACKS=5,ID=6,NESTED_DATA=7,START_OFFSET=0,LOCAL_TOTAL_TIME=1,WI_ADDITIONAL_DATA=8,ORIGINAL_WIDTH=0,ORIGINAL_HEIGHT=1,TRACK_TYPE=9,TRACK_NAME=10;class TrackDataItem{constructor(t,a){this._trackData=a,this._instanceData=null,this._additionalInstanceData=null,this._instanceUid=NaN,this._objectClassIndex=NaN,this._interpolationMode="default",this._resultMode="default",this._enabled=!1,this._keyframeData=null,this._propertyTrackData=null,this._id="",this._nestedData=null,this._startOffset=0,this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime(),this._type=0,this._name="",t&&(t[0]&&(this._instanceData=t[0],this._instanceUid=t[0][2],this._objectClassIndex=t[0][1]),this._interpolationMode=t[1],this._resultMode=t[2],this._enabled=!!t[3],t[6]&&(this._id=t[6]),t[7]&&(this._nestedData=t[7],this._startOffset=t[7][0],this._localTotalTime=t[7][1]),t[8]&&(this._additionalInstanceData=t[8]),t[8]&&(this._additionalInstanceData=t[8]),t[9]&&(this._type=t[9]),t[10]&&(this._name=t[10]),this._keyframeData=new C3.KeyframeData(t[4],this),this._propertyTrackData=new C3.PropertyTrackData(t[5],this))}Release(){this._instanceData=null,this._trackData=null,this._keyframeData&&(this._keyframeData.Release(),this._keyframeData=null),this._propertyTrackData&&(this._propertyTrackData.Release(),this._propertyTrackData=null),this._nestedData=null}GetTrackData(){return this._trackData}GetKeyframeData(){return this._keyframeData||(this._keyframeData=new C3.KeyframeData(null,this)),this._keyframeData}GetPropertyTrackData(){return this._propertyTrackData||(this._propertyTrackData=new C3.PropertyTrackData(null,this)),this._propertyTrackData}GetInstanceData(){return this._instanceData}GetObjectClassIndex(){return this._objectClassIndex}SetObjectClassIndex(t){this._objectClassIndex=t}GetInstanceUID(){return this._instanceUid}SetInstanceUID(t){this._instanceUid=t}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(t){this._interpolationMode=t}GetResultMode(){return this._resultMode}SetResultMode(t){this._resultMode=t}GetEnable(){return this._enabled}SetEnable(t){this._enabled=!!t}GetId(){return this._id}GetStartOffset(){return this._startOffset}GetLocalTotalTime(){return this._localTotalTime}SetLocalTotalTime(t){this._localTotalTime=t}GetOriginalSize(){return[this.GetOriginalWidth(),this.GetOriginalHeight(),0]}GetOriginalWidth(){return this._additionalInstanceData[0]}SetOriginalWidth(t){this._additionalInstanceData||(this._additionalInstanceData=[]),this._additionalInstanceData[0]=t}GetOriginalHeight(){return this._additionalInstanceData||(this._additionalInstanceData=[]),this._additionalInstanceData[1]}SetOriginalHeight(t){this._additionalInstanceData||(this._additionalInstanceData=[]),this._additionalInstanceData[1]=t}GetType(){return this._type}GetName(){return this._name}_SaveToJson(){return{"keyframeDataJson":this._keyframeData._SaveToJson(),"propertyTrackDataJson":this._propertyTrackData._SaveToJson(),"instanceData":this._instanceData,"additionalInstanceData":this._additionalInstanceData,"instanceUid":this._instanceUid,"objectClassIndex":this._objectClassIndex,"interpolationMode":this._interpolationMode,"resultMode":this._resultMode,"enabled":this._enabled,"id":this._id,"nestedData":this._nestedData,"type":this._type,"name":this._name}}_LoadFromJson(t){t&&(this._instanceData=t["instanceData"],this._instanceUid=t["instanceUid"],this._objectClassIndex=t["objectClassIndex"],this._interpolationMode=t["interpolationMode"],this._resultMode=t["resultMode"],this._enabled=t["enabled"],this._id=t["id"],this._type=t["type"]?t["type"]:0,this._name=t["name"]?t["name"]:"",this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime(),t["nestedData"]&&(this._nestedData=t["nestedData"],this._startOffset=this._nestedData[0],this._localTotalTime=this._nestedData[1]),t["additionalInstanceData"]&&(this._additionalInstanceData=t["additionalInstanceData"]),this.GetKeyframeData()._LoadFromJson(t["keyframeDataJson"]),this.GetPropertyTrackData()._LoadFromJson(t["propertyTrackDataJson"]))}}C3.TrackData=class{constructor(t,a){this._timelineDataItem=a,this._trackDataItems=[],C3.TimelineDataManager._CreateDataItems(this._trackDataItems,t,TrackDataItem,this)}Release(){this._timelineDataItem=null;for(const t of this._trackDataItems)t.Release();C3.clearArray(this._trackDataItems),this._trackDataItems=null}GetTimelineDataItem(){return this._timelineDataItem}AddEmptyTrackDataItem(){const t=new TrackDataItem(null,this);return this._trackDataItems.push(t),t}GetFirstKeyframeDataItem(t){return t.GetKeyframeData().GetKeyframeDataItemArray()[0]}GetLastKeyframeDataItem(t){return t.GetKeyframeData().GetKeyframeDataItemArray().at(-1)}GetKeyFrameDataItemAtTime(t,a){const e=a.GetKeyframeData().GetKeyframeDataItemArray(),i=e.length;for(let a=0;a<i;a++){const i=e[a];if(i.GetTime()===t)return i}}GetFirstKeyFrameDataItemHigherThan(t,a){const e=a.GetKeyframeData().GetKeyframeDataItemArray(),i=e.length;for(let a=0;a<i;a++){const i=e[a];if(i.GetTime()>t)return i}}GetFirstKeyFrameDataItemHigherOrEqualThan(t,a){const e=a.GetKeyframeData().GetKeyframeDataItemArray(),i=e.length;for(let a=0;a<i;a++){const i=e[a];if(i.GetTime()>=t)return i}}GetFirstKeyFrameDataItemLowerOrEqualThan(t,a){const e=a.GetKeyframeData().GetKeyframeDataItemArray();for(let a=e.length-1;a>=0;a--){const i=e[a];if(i.GetTime()<=t)return i}}*trackDataItems(){for(const t of this._trackDataItems)yield t}_SaveToJson(){return{"trackDataItemsJson":this._trackDataItems.map(t=>t._SaveToJson())}}_LoadFromJson(t){t&&C3.TimelineDataManager._LoadDataItemsFromJson(this._trackDataItems,t["trackDataItemsJson"],TrackDataItem,this)}}; } // timelines/data/propertyTrackData.js { const C3=self.C3,SOURCE_DATA=0,SOURCE=0,PROPERTY=1,TYPE=2,MIN=3,MAX=4,INTERPOLATION_MODE=5,RESULT_MODE=6,ENABLED=7,PROPERTY_KEYFRAMES=8,CAN_HAVE_PROPERTY_KEYFRAMES=9;class PropertyTrackDataItem{constructor(t,e){this._propertyTrackData=e,this._sourceAdapterId="",this._sourceAdapterArguments=null,this._property=null,this._type=null,this._min=NaN,this._max=NaN,this._interpolationMode="default",this._resultMode="default",this._enabled=!1,this._propertyKeyframeData=null,this._canHavePropertyKeyframes=!0,t&&(this._sourceAdapterId=t[0][0],this._sourceAdapterArguments=t[0].slice(1),this._property=t[1],this._type=t[2],this._min=t[3],this._max=t[4],this._interpolationMode=t[5],this._resultMode=t[6],this._enabled=!!t[7],this._propertyKeyframeData=new C3.PropertyKeyframeData(t[8],this),this._canHavePropertyKeyframes=t[9])}Release(){this._propertyKeyframeData.Release(),this._propertyKeyframeData=null,this._propertyTrackData=null,this._sourceAdapterArguments=null}GetPropertyTrackData(){return this._propertyTrackData}GetPropertyKeyframeData(){return this._propertyKeyframeData||(this._propertyKeyframeData=new C3.PropertyKeyframeData(null,this)),this._propertyKeyframeData}GetSourceAdapterId(){return this._sourceAdapterId}SetSourceAdapterId(t){this._sourceAdapterId=t}GetSourceAdapterArguments(){return this._sourceAdapterArguments}SetSourceAdapterArguments(t){this._sourceAdapterArguments=t}GetProperty(){return this._property}SetProperty(t){this._property=t}GetType(){return this._type}SetType(t){this._type=t}GetMin(){return this._min}SetMin(t){this._min=t}GetMax(){return this._max}SetMax(t){this._max=t}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(t){this._interpolationMode=t}GetResultMode(){return this._resultMode}SetResultMode(t){this._resultMode=t}GetEnable(){return this._enabled}SetEnable(t){this._enabled=!!t}CanHavePropertyKeyframes(){return!!this._canHavePropertyKeyframes}_SaveToJson(){return{"propertyKeyframeDataJson":this._propertyKeyframeData._SaveToJson(),"sourceAdapterId":this._sourceAdapterId,"sourceAdapterArguments":this._sourceAdapterArguments,"property":this._property,"type":this._type,"min":this._min,"max":this._max,"interpolationMode":this._interpolationMode,"resultMode":this._resultMode,"enabled":this._enabled,"canHavePropertyKeyframes":this._canHavePropertyKeyframes}}_LoadFromJson(t){t&&(this._sourceAdapterId=t["sourceAdapterId"],this._sourceAdapterArguments=t["sourceAdapterArguments"],this._property=t["property"],this._type=t["type"],this._min=t["min"],this._max=t["max"],this._interpolationMode=t["interpolationMode"],this._resultMode=t["resultMode"],this._enabled=t["enabled"],this._canHavePropertyKeyframes=t["canHavePropertyKeyframes"],this.GetPropertyKeyframeData()._LoadFromJson(t["propertyKeyframeDataJson"]))}}C3.PropertyTrackData=class{constructor(t,e){this._trackDataItem=e,this._propertyTrackDataItems=[],C3.TimelineDataManager._CreateDataItems(this._propertyTrackDataItems,t,PropertyTrackDataItem,this)}Release(){this._trackDataItem=null;for(const t of this._propertyTrackDataItems)t.Release();C3.clearArray(this._propertyTrackDataItems),this._propertyTrackDataItems=null}GetTrackDataItem(){return this._trackDataItem}AddEmptyPropertyTrackDataItem(){const t=new PropertyTrackDataItem(null,this);return this._propertyTrackDataItems.push(t),t}GetFirstPropertyKeyframeDataItem(t){return t.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()[0]}GetLastPropertyKeyframeDataItem(t){return t.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray().at(-1)}GetPropertyKeyFrameDataItemAtTime(t,e){const r=e.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray(),a=r.length;for(let e=0;e<a;e++){const a=r[e];if(a.GetTime()===t)return a}}GetFirstPropertyKeyFrameDataItemHigherThan(t,e){const r=e.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray(),a=r.length;for(let e=0;e<a;e++){const a=r[e];if(a.GetTime()>t)return a}}GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(t,e){const r=e.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray(),a=r.length;for(let e=0;e<a;e++){const a=r[e];if(a.GetTime()>=t)return a}}GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(t,e){const r=e.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();for(let e=r.length-1;e>=0;e--){const a=r[e];if(a.GetTime()<=t)return a}}*propertyTrackDataItems(){for(const t of this._propertyTrackDataItems)yield t}_SaveToJson(){return{"propertyTrackDataItemsJson":this._propertyTrackDataItems.map(t=>t._SaveToJson())}}_LoadFromJson(t){t&&C3.TimelineDataManager._LoadDataItemsFromJson(this._propertyTrackDataItems,t["propertyTrackDataItemsJson"],PropertyTrackDataItem,this)}}; } // timelines/data/keyframeData.js { const C3=self.C3,TIME=0,EASE=1,ENABLE=2,TAGS=3;class KeyframeDataItem{constructor(e,t){if(this._keyframeData=t,this._time=-1,this._ease="noease",this._enable=!1,this._tags=null,this._lowerTags=null,!e)return;this._time=e[0],this._ease=e[1],this._enable=!!e[2];const a=e[3];this._tags=a?a.split(" "):[],this._lowerTags=new Set(this._tags.map(e=>e.toLowerCase())),this._next=null,this._last=null}Release(){this._keyframeData=null,C3.clearArray(this._tags),this._tags=null,this._lowerTags.clear(),this._lowerTags=null,this._next=null}GetKeyframeData(){return this._keyframeData}GetNext(){return this._next}SetNext(e){this._next=e}GetLast(){return this._last}SetLast(e){this._last=e}GetTime(){return this._time}SetTime(e){this._time=e,this._keyframeData._LinkKeyframeDataItems()}GetEase(){return this._ease}SetEase(e){this._ease=e}GetEnable(){return this._enable}SetEnable(e){this._enable=!!e}GetTags(){return this._tags}SetTags(e){this._tags=e?e.split(" "):[],this._lowerTags=new Set(this._tags.map(e=>e.toLowerCase()))}GetLowerTags(){return this._lowerTags}GetTagsString(){return Array.from(this._lowerTags).join(",").trim()}HasTag(e){return this._lowerTags.has(e.toLowerCase())}_SaveToJson(){return{"time":this._time,"ease":this._ease,"enable":this._enable,"tags":this._tags}}_LoadFromJson(e){e&&(this._time=e["time"],this._ease=e["ease"],this._enable=e["enable"],this._tags=e["tags"],this._lowerTags=new Set(this._tags.map(e=>e.toLowerCase())))}}C3.KeyframeData=class{constructor(e,t){this._trackDataItem=t,this._keyframeDataItems=[],C3.TimelineDataManager._CreateDataItems(this._keyframeDataItems,e,KeyframeDataItem,this),this._LinkKeyframeDataItems()}Release(){this._trackDataItem=null;for(const e of this._keyframeDataItems)e.Release();C3.clearArray(this._keyframeDataItems),this._keyframeDataItems=null}_LinkKeyframeDataItems(){this._keyframeDataItems.sort((e,t)=>e.GetTime()-t.GetTime());for(let e=0;e<this._keyframeDataItems.length;e++){const t=this._keyframeDataItems[e];t.SetNext(this._keyframeDataItems[e+1]),t.SetLast(this._keyframeDataItems[e-1])}}GetTrackDataItem(){return this._trackDataItem}GetKeyframeDataItemCount(){return this._keyframeDataItems.length}GetKeyframeDataItemArray(){return this._keyframeDataItems}AddEmptyKeyframeDataItem(){const e=new KeyframeDataItem(null,this);return this._keyframeDataItems.push(e),this._LinkKeyframeDataItems(),e}DeleteKeyframeDataItems(e){for(const t of this._keyframeDataItems){if(!e(t))continue;const a=this._keyframeDataItems.indexOf(t);-1!==a&&(t.Release(),this._keyframeDataItems.splice(a,1))}this.SortKeyframeDataItems(),this._LinkKeyframeDataItems()}SortKeyframeDataItems(){this._keyframeDataItems.sort((e,t)=>e.GetTime()-t.GetTime())}GetKeyframeDataItemIndex(e){return this._keyframeDataItems.indexOf(e)}GetKeyframeDataItemFromIndex(e){return this._keyframeDataItems[e]}*keyframeDataItems(){for(const e of this._keyframeDataItems)yield e}*keyframeDataItemsReverse(){for(let e=this._keyframeDataItems.length-1;e>=0;e--)yield this._keyframeDataItems[e]}_SaveToJson(){return{"keyframeDataItemsJson":this._keyframeDataItems.map(e=>e._SaveToJson())}}_LoadFromJson(e){e&&(C3.TimelineDataManager._LoadDataItemsFromJson(this._keyframeDataItems,e["keyframeDataItemsJson"],KeyframeDataItem,this),this._LinkKeyframeDataItems())}}; } // timelines/data/propertyKeyframeData.js { const C3=self.C3,VALUE_DATA=0,VALUE_DATA_VALUE=0,VALUE_DATA_ABSOLUTE_VALUE=1,VALUE_DATA_TYPE=2,TIME=1,EASE=2,ENABLE=3,ADDONS=4,PATH_MODE=5;class PropertyKeyframeDataItem{constructor(e,t){this._propertyKeyframeData=t,this._value=null,this._aValue=null,this._type="",this._time=NaN,this._ease="noease",this._enable=!1,this._addonData=null,this._addonInstance=void 0,this._pathMode="line",e&&(this._value=e[0][0],this._aValue=e[0][1],this._type=e[0][2],"map"===this._type&&(this._value=new Map(this._value),this._aValue=new Map(this._aValue)),this._time=e[1],this._ease=e[2],this._enable=!!e[3],this._pathMode=e[5],this._addonData=null,e[4]&&(this._addonData=new C3.AddonData(e[4],this)),this._next=null,this._prev=null)}Release(){this._propertyKeyframeData=null,this._addonData&&(this._addonData.Release(),this._addonData=null),this._next=null,this._prev=null}GetAddonData(){return this._addonData}SetNext(e){this._next=e}GetNext(){return this._next}SetPrevious(e){this._prev=e}GetPrevious(){return this._prev}GetValue(){return this._value}SetValue(e){"color"===this._type&&C3.IsFiniteNumber(e)?(this._value[0]=C3.GetRValue(e),this._value[1]=C3.GetGValue(e),this._value[2]=C3.GetBValue(e)):this._value=e}GetAbsoluteValue(){return this._aValue}SetAbsoluteValue(e){"color"===this._type&&C3.IsFiniteNumber(e)?(this._aValue[0]=C3.GetRValue(e),this._aValue[1]=C3.GetGValue(e),this._aValue[2]=C3.GetBValue(e)):this._aValue=e}GetValueWithResultMode(){const e=this._propertyKeyframeData.GetPropertyTrackDataItem().GetResultMode();return"relative"===e?this.GetValue():"absolute"===e?this.GetAbsoluteValue():void 0}GetType(){return this._type}SetType(e){this._type=e}GetTime(){return this._time}SetTime(e){this._time=e,this._propertyKeyframeData._LinkPropertyKeyframeDataItems()}GetEase(){return this._ease}SetEase(e){this._ease=e}GetEnable(){return this._enable}SetEnable(e){this._enable=!!e}GetPathMode(){return this._pathMode}GetAddOn(e){if(!this._addonData)return;if(this._addonInstance||null===this._addonInstance)return this._addonInstance;const t=this._addonData.GetAddDataItemArray();if(!t)return this._addonInstance=null,this._addonInstance;const a=t.length;for(let r=0;r<a;r++){const a=t[r];if(a.GetId()===e)return this._addonInstance=a,this._addonInstance}return this._addonInstance=null,this._addonInstance}_SaveToJson(){const e=this._addonData;return{"addonDataJson":e?e._SaveToJson():e,"value":this._value,"aValue":this._aValue,"type":this._type,"time":this._time,"ease":this._ease,"enable":this._enable}}_LoadFromJson(e){e&&(e["addonDataJson"]&&this._addonData._SetFromJson(e["addonDataJson"]),this._value=e["value"],this._aValue=e["aValue"],this._type=e["type"],this._time=e["time"],this._ease=e["ease"],this._enable=e["enable"])}}C3.PropertyKeyframeData=class{constructor(e,t){this._propertyTrackDataItem=t,this._propertyKeyframeDataItems=[],this._propertyKeyframeDataItemsIncludingDisabled=[],C3.TimelineDataManager._CreateDataItems(this._propertyKeyframeDataItems,e,PropertyKeyframeDataItem,this),C3.TimelineDataManager._CreateDataItemsIncludingDisabled(this._propertyKeyframeDataItemsIncludingDisabled,e,PropertyKeyframeDataItem,this),this._LinkPropertyKeyframeDataItems()}Release(){this._propertyTrackDataItem=null;for(const e of this._propertyKeyframeDataItems)e.Release();C3.clearArray(this._propertyKeyframeDataItems),this._propertyKeyframeDataItems=null;for(const e of this._propertyKeyframeDataItemsIncludingDisabled)e.Release();C3.clearArray(this._propertyKeyframeDataItemsIncludingDisabled),this._propertyKeyframeDataItemsIncludingDisabled=null}_LinkPropertyKeyframeDataItems(){let e=this._propertyKeyframeDataItems;e.sort((e,t)=>e.GetTime()-t.GetTime());for(let t=0;t<e.length;t++){const a=e[t];t+1<e.length&&a.SetNext(e[t+1]),t-1>=0&&a.SetPrevious(e[t-1])}e=this._propertyKeyframeDataItemsIncludingDisabled,e.sort((e,t)=>e.GetTime()-t.GetTime());for(let t=0;t<e.length;t++){const a=e[t];t+1<e.length&&a.SetNext(e[t+1]),t-1>=0&&a.SetPrevious(e[t-1])}}AddEmptyPropertyKeyframeDataItem(){const e=new PropertyKeyframeDataItem(null,this);return this._propertyKeyframeDataItems.push(e),this._LinkPropertyKeyframeDataItems(),e}DeletePropertyKeyframeDataItems(e){for(const t of this._propertyKeyframeDataItems){if(!e(t))continue;const a=this._propertyKeyframeDataItems.indexOf(t);-1!==a&&(t.Release(),this._propertyKeyframeDataItems.splice(a,1))}this.SortPropertyKeyFrameDataItems(),this._LinkPropertyKeyframeDataItems()}SortPropertyKeyFrameDataItems(){this._propertyKeyframeDataItems.sort((e,t)=>e.GetTime()-t.GetTime())}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyKeyframeDataItemCount(){return this._propertyKeyframeDataItems.length}GetLastPropertyKeyframeDataItem(){return this._propertyKeyframeDataItems[this._propertyKeyframeDataItems.length-1]}GetPropertyKeyframeDataItemArray(){return this._propertyKeyframeDataItems}GetPropertyKeyframeDataItemArrayIncludingDisabled(){return this._propertyKeyframeDataItemsIncludingDisabled}*propertyKeyframeDataItems(){for(const e of this._propertyKeyframeDataItems)yield e}*propertyKeyframeDataItemsReverse(){for(let e=this._propertyKeyframeDataItems.length-1;e>=0;e--)yield this._propertyKeyframeDataItems[e]}_SaveToJson(){const e=this._propertyKeyframeDataItems,t=this._propertyKeyframeDataItemsIncludingDisabled;return{"propertyKeyframeDataItemsJson":e.map(e=>e._SaveToJson()),"propertyKeyframeDataItemsIncludingDisabledJson":t.map(e=>e._SaveToJson())}}_LoadFromJson(e){e&&(C3.TimelineDataManager._LoadDataItemsFromJson(this._propertyKeyframeDataItems,e["propertyKeyframeDataItemsJson"],PropertyKeyframeDataItem,this),C3.TimelineDataManager._LoadDataItemsFromJson(this._propertyKeyframeDataItemsIncludingDisabled,e["propertyKeyframeDataItemsIncludingDisabledJson"],PropertyKeyframeDataItem,this),this._LinkPropertyKeyframeDataItems())}}; } // timelines/data/propertyKeyframeAddonData.js { const C3=self.C3,ADDON_ID=0,ADDON_DATA=1;class AddonDataItem{constructor(t,a){this._addonData=a,this._id=t[0],this._data=t[1]}Release(){this._addonData=null,this._data=null}GetAddonData(){return this._addonData}GetId(){return this._id}_SaveToJson(){return{"id":this._id,"data":this._data}}_LoadFromJson(t){t&&(this._id=t["id"],this._data=t["data"])}}const START_ANCHOR=0,START_ENABLE=1,END_ANCHOR=2,END_ENABLE=3;class AddonDataCubicBezierItem extends AddonDataItem{constructor(t,a){super(t,a),this._startAnchor=this._data[0],this._startEnable=!!this._data[1],this._endAnchor=this._data[2],this._endEnable=!!this._data[3]}Release(){super.Release()}GetStartAnchor(){return this._startAnchor}GetStartEnable(){return this._startEnable}GetEndAnchor(){return this._endAnchor}GetEndEnable(){return this._endEnable}_SaveToJson(){return Object.assign(super._SaveToJson(),{"startAnchor":this._startAnchor,"startEnable":!!this._startEnable,"endAnchor":this._endAnchor,"endEnable":!!this._endEnable})}_LoadFromJson(t){t&&(super._LoadFromJson(t),this._startAnchor=t["startAnchor"],this._startEnable=!!t["startEnable"],this._endAnchor=t["endAnchor"],this._endEnable=!!t["endEnable"])}}const DIRECTION=0,REVOLUTIONS=1;class AddonDataAngleItem extends AddonDataItem{constructor(t,a){super(t,a),this._direction=this._data[0],this._revolutions=this._data[1]}Release(){super.Release()}GetDirection(){return this._direction}GetRevolutions(){return this._revolutions}_SaveToJson(){return Object.assign(super._SaveToJson(),{"direction":this._direction,"revolutions":this._revolutions})}_LoadFromJson(t){t&&(super._LoadFromJson(t),this._direction=t["direction"],this._revolutions=t["revolutions"])}}const START_FROM=0;class AddonDataInitialAnimationItem extends AddonDataItem{constructor(t,a){super(t,a),this._startFrom=this._data[0]}Release(){super.Release()}GetStartFrom(){return this._startFrom}_SaveToJson(){return Object.assign(super._SaveToJson(),{"startFrom":this._startFrom})}_LoadFromJson(t){t&&(super._LoadFromJson(t),this._startFrom=t["startFrom"])}}C3.AddonData=class{constructor(t,a){this._propertyKeyframeDataItem=a,this._addonDataItems=[],C3.TimelineDataManager._CreateDataItems(this._addonDataItems,t,{prop:0,map:new Map([["cubic-bezier",AddonDataCubicBezierItem],["angle",AddonDataAngleItem],["initial-animation",AddonDataInitialAnimationItem]])},this)}Release(){this._propertyKeyframeDataItem=null;for(const t of this._addonDataItems)t.Release();C3.clearArray(this._addonDataItems),this._addonDataItems=null}GetPropertyKeyframeDataItem(){return this._propertyKeyframeDataItem}GetAddDataItemArray(){return this._addonDataItems}*addonDataItems(){for(const t of this._addonDataItems)yield t}_SaveToJson(){return{"addonDataItemsJson":this._addonDataItems.map(t=>t._SaveToJson())}}_LoadFromJson(t){t&&C3.TimelineDataManager._LoadDataItemsFromJson(this._addonDataItems,t["addonDataItemsJson"],{prop:"id",map:new Map([["cubic-bezier",AddonDataCubicBezierItem],["angle",AddonDataAngleItem],["initial-animation",AddonDataInitialAnimationItem]])},this)}}; } // timelines/tweens/tweenState.js { const C3=self.C3,INITIAL_VALUE_MODE_START_VALUE="start-value",INITIAL_VALUE_MODE_CURRENT_STATE="current-state",PING_PONG_BEGIN=0,PING_PONG_END=1;let createdTweens=0;C3.TweenState=class extends C3.Time … [Строка слишком длинная. Вы можете скачать файл] } // timelines/tweens/tweenTrackState.js { const C3=self.C3;C3.TweenTrackState=class extends C3.TrackState{constructor(t,r){super(t,r),this._firstPropertyTrack=null,this._secondPropertyTrack=null,this._thirdPropertyTrack=null}static Create(t,r){return C3.New(C3.TweenTrackState,t,r)}_CachePropertyTracks(){1===this._propertyTracks.length?this._firstPropertyTrack=this._propertyTracks[0]:2===this._propertyTracks.length?(this._firstPropertyTrack=this._propertyTracks[0],this._secondPropertyTrack=this._propertyTracks[1]):(this._firstPropertyTrack=this._propertyTracks[0],this._secondPropertyTrack=this._propertyTracks[1],this._thirdPropertyTrack=this._propertyTracks[2])}CreatePropertyTrackStates(){for(const t of this._trackDataItem.GetPropertyTrackData().propertyTrackDataItems())this._propertyTracks.push(C3.TweenPropertyTrackState.Create(this,t));this._CachePropertyTracks()}AddPropertyTrack(){const t=this._trackDataItem.GetPropertyTrackData().AddEmptyPropertyTrackDataItem(),r=C3.TweenPropertyTrackState.Create(this,t);return this._propertyTracks.push(r),this._CachePropertyTracks(),r}SetInitialState(){if(this.MaybeGetInstance(),!this.IsInstanceValid()&&this.IsInstanceTrack())return;const t=this.GetTimeline().IsForwardPlayBack()?0:this.GetLocalTotalTime();for(const r of this._propertyTracks)r.SetInitialState(t),0===this._worldInfoChange&&1===r.GetWorldInfoChange()&&(this._worldInfoChange=1),0===this._renderChange&&1===r.GetRenderChange()&&(this._renderChange=1);this._needsBeforeAndAfter=0;this._propertyTracks.some(t=>t.GetNeedsBeforeAndAfter())&&(this._needsBeforeAndAfter=1),this._lastKeyframeDataItem=this._GetLastKeyFrameBeforeTime(t),this._initialStateOfNestedSet=!1,this._endStateOfNestedSet=!1,this.Interpolate(t)}BeforeInterpolate(){}Interpolate(t,r=!1,e=!1,s=!1,a=!1,o=!1,i=!1){if(this._instance||this.GetInstance(),!this._instance)return;return!this._instance.IsDestroyed()&&((!o||!this.GetObjectClass().IsGlobal())&&(this._thirdPropertyTrack?(this._firstPropertyTrack.Interpolate(t,e,s,i),this._secondPropertyTrack.Interpolate(t,e,s,i),this._thirdPropertyTrack.Interpolate(t,e,s,i)):this._secondPropertyTrack?(this._firstPropertyTrack.Interpolate(t,e,s,i),this._secondPropertyTrack.Interpolate(t,e,s,i)):this._firstPropertyTrack.Interpolate(t,e,s,i),void(0!==this._firstPropertyTrack.GetWorldInfoChange()&&(this._worldInfo||(this._worldInfo=this._instance.GetWorldInfo()),this._worldInfo&&this._worldInfo.SetBboxChanged()))))}AfterInterpolate(){}_LoadFromJson(t){super._LoadFromJson(t),this._CachePropertyTracks()}}; } // timelines/tweens/tweenPropertyTrackState.js { const C3=self.C3;C3.TweenPropertyTrackState=class extends C3.PropertyTrackState{constructor(t,e){super(t,e),this._basic=!1}static Create(t,e){return C3.New(C3.TweenPropertyTrackState,t,e)}Interpolate(t,e=!1,r=!1,a=!1){let s,o;if(this._basic)s=this._propertyKeyframeDataItems[0],o=this._propertyKeyframeDataItems[1];else if(e)s=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(t,this._propertyTrackDataItem),o=s.GetNext();else{if(this._lastPropertyKeyframeDataItem){const e=this.GetTimeline(),r=this._lastPropertyKeyframeDataItem.GetNext(),a=this._lastPropertyKeyframeDataItem.GetTime(),s=r?r.GetTime():e.GetTotalTime();(t<=a||t>=s)&&(this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(t,this._propertyTrackDataItem))}else this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(t,this._propertyTrackDataItem);s=this._lastPropertyKeyframeDataItem,o=s.GetNext()}this._sourceAdapter.Interpolate(t,s,o,e,r,a)}AddPropertyKeyframe(){const t=this._propertyTrackDataItem.GetPropertyKeyframeData().AddEmptyPropertyKeyframeDataItem();return this._lastPropertyKeyframeDataItem=null,this._basic=this.GetPropertyKeyframeDataItems().length<=2,t}DeletePropertyKeyframes(t){this._lastPropertyKeyframeDataItem=null;this._propertyTrackDataItem.GetPropertyKeyframeData().DeletePropertyKeyframeDataItems(t),this._basic=this.GetPropertyKeyframeDataItems().length<=2}_SaveToJson(){return{"sourceAdapterJson":this.GetSourceAdapter()._SaveToJson(),"basic":this._basic}}_LoadFromJson(t){t&&(this.GetSourceAdapter()._LoadFromJson(t["sourceAdapterJson"]),this._basic=t["basic"])}}; } // timelines/transitions/transition.js { const C3=self.C3,Ease=self.Ease,NAME=0,TRANSITION_KEYFRAMES=1,LINEAR=2;C3.Transition=class extends C3.DefendedBase{constructor(e,t=!0){super(),this._name=e[0],this._linear=e[2],this._transitionKeyframes=[];for(const t of e[1]){const e=C3.TransitionKeyframe.Create(this,t);this._transitionKeyframes.push(e)}for(let e=0;e<this._transitionKeyframes.length;e++){const t=this._transitionKeyframes[e],a=this._transitionKeyframes[e+1],s=this._transitionKeyframes[e-1];t.SetNext(a),t.SetPrevious(s)}this._precalculatedSamples=new Map,this._transitionKeyframeCache=new Map,this._PreCalcSamples(),t&&Ease.AddCustomEase(this._name,(e,t,a,s)=>this.Interpolate(e,t,a,s),null,{transition:this})}static Create(e){return C3.New(C3.Transition,e)}Release(){for(const e of this._transitionKeyframes)e.Release();C3.clearArray(this._transitionKeyframes),this._transitionKeyframes=null,this._precalculatedSamples.clear(),this._precalculatedSamples=null,this._transitionKeyframeCache.clear(),this._transitionKeyframeCache=null}MakeLinear(e){this._linear=!!e}GetTransitionKeyFrameAt(e){const t=this._transitionKeyframeCache.get(e);if(t)return t;for(const t of this._transitionKeyframes)if(t.GetValueX()===e)return this._transitionKeyframeCache.set(e,t),t}GetFirstTransitionKeyFrameLowerOrEqualThan(e){for(let t=this._transitionKeyframes.length-1;t>=0;t--){const a=this._transitionKeyframes[t],s=a.GetValueX();if(s<=e){let t=a;if(s<e)return t;if(s===e){for(;t;){const e=t.GetPrevious();if(!e)break;if(e.GetValueX()!==t.GetValueX())break;t=e}return t}}}}Interpolate(e,t,a,s){let n=e/s;if(this._linear){const n=this.GetTransitionKeyFrameAt(0),r=this.GetTransitionKeyFrameAt(1),i=t+(t+a)*n.GetValueY(),l=(t+a)*r.GetValueY()-i;return 0===s?i+l:Ease.NoEase(e,i,l,s)}0===s&&(n=1);let r=this.GetFirstTransitionKeyFrameLowerOrEqualThan(n),i=r.GetNext();if(!i){const e=r.GetPrevious(),t=r;r=e,i=t}const l=i.GetValueX()-r.GetValueX(),o=C3.mapToRange(n,r.GetValueX(),i.GetValueX(),0,l);if(r.IsSegmentLinear()||0===l){const e=t+(t+a)*r.GetValueY(),s=(t+a)*i.GetValueY()-e;return 0===l?1===o?e+s:e:Ease.NoEase(o,e,s,l)}const h=r.GetValueX(),u=r.GetValueY(),c=r.GetValueX()+r.GetStartAnchorX(),f=r.GetValueY()+r.GetStartAnchorY(),G=i.GetValueX()+i.GetEndAnchorX(),m=i.GetValueY()+i.GetEndAnchorY(),_=i.GetValueX(),y=i.GetValueY();let K=Ease.GetRuntimeEase("spline")(o,h,u,c,f,G,m,_,y,this._precalculatedSamples.get(r));return K+=r.GetValueY(),(1-K)*t+K*(t+a)}_PreCalcSamples(){this._precalculatedSamples.clear();for(let e=0;e<this._transitionKeyframes.length-1;e++){const t=this._transitionKeyframes[e];if(!t.GetStartEnable())continue;const a=t,s=this._transitionKeyframes[e+1];if(!s.GetEndEnable())continue;const n=a.GetValueX(),r=a.GetValueX()+a.GetStartAnchorX(),i=s.GetValueX()+s.GetEndAnchorX(),l=s.GetValueX();this._precalculatedSamples.set(a,Ease.GetBezierSamples(n,r,i,l))}}}; } // timelines/transitions/transitionKeyframe.js { const C3=self.C3,VALUE_X=0,VALUE_Y=1,START_ANCHOR_X=2,START_ANCHOR_Y=3,END_ANCHOR_X=4,END_ANCHOR_Y=5,START_ENABLE=6,END_ENABLE=7,SEGMENT_MODE=8;C3.TransitionKeyframe=class extends C3.DefendedBase{constructor(t,e){super(),this._transition=t,this._valueX=e[0],this._valueY=e[1],this._startAnchorX=e[2],this._startAnchorY=e[3],this._endAnchorX=e[4],this._endAnchorY=e[5],this._startEnable=e[6],this._endEnable=e[7],this._segmentMode=e[8],this._next=null,this._prev=null}Release(){this._transition=null}static Create(t,e){return C3.New(C3.TransitionKeyframe,t,e)}SetNext(t){this._next=t}GetNext(){return this._next}SetPrevious(t){this._prev=t}GetPrevious(){return this._prev}GetValueX(){return this._valueX}GetValueY(){return this._valueY}GetStartAnchorX(){return this._startAnchorX}GetStartAnchorY(){return this._startAnchorY}GetEndAnchorX(){return this._endAnchorX}GetEndAnchorY(){return this._endAnchorY}GetStartEnable(){return this._startEnable}GetEndEnable(){return this._endEnable}IsSegmentLinear(){return"linear"===this._segmentMode}IsSegmentCubic(){return"cubic"===this._segmentMode}}; } // timelines/transitions/transitionManager.js { const C3=self.C3;C3.TransitionManager=class extends C3.DefendedBase{constructor(s){super(),this._runtime=s,this._transitions=[]}Release(){for(const s of this._transitions)s.Release();C3.clearArray(this._transitions),this._transitions=null}Create(s){this._transitions.push(C3.Transition.Create(s))}}; } // templates/templateManager.js { const C3=self.C3;C3.TemplateManager=class extends C3.DefendedBase{constructor(e){super(),this._runtime=e,this._templateDataMap=null,this._instanceToTemplateNameMap=null,this._instanceDestroy=e=>this._OnInstanceDestroy(e.instance)}Release(){if(this.RemoveRuntimeListeners(),this._templateDataMap){for(const e of this._templateDataMap.values())e.clear();this._templateDataMap.clear()}this._templateDataMap=null,this._runtime=null}Create(e){if(this._templateDataMap||(this._templateDataMap=new Map),!e)return;const t=e[0][17][0],a=e[1];this._templateDataMap.has(a)||this._templateDataMap.set(a,new Map);this._templateDataMap.get(a).set(t,e)}AddRuntimeListeners(){const e=this._runtime.Dispatcher();e&&e.addEventListener("instancedestroy",this._instanceDestroy)}RemoveRuntimeListeners(){const e=this._runtime.Dispatcher();e&&e.removeEventListener("instancedestroy",this._instanceDestroy)}HasTemplates(){return!!this._templateDataMap&&0!==this._templateDataMap.size}GetTemplateData(e,t){let a=0;if(a=e instanceof C3.ObjectClass?e.GetIndex():e,!this._templateDataMap.has(a))return;const s=this._templateDataMap.get(a).get(t);return s?JSON.parse(JSON.stringify(s)):void 0}MapInstanceToTemplateName(e,t){this._instanceToTemplateNameMap||(this._instanceToTemplateNameMap=new WeakMap),this._instanceToTemplateNameMap.has(e)||this._instanceToTemplateNameMap.set(e,t)}GetInstanceTemplateName(e){if(!this._instanceToTemplateNameMap)return"";const t=this._instanceToTemplateNameMap.get(e);return t||""}_OnInstanceDestroy(e){this._instanceToTemplateNameMap&&this._instanceToTemplateNameMap.has(e)&&this._instanceToTemplateNameMap.delete(e)}}; } // flowcharts/flowchartManager.js { const C3=self.C3;C3.FlowchartManager=class{constructor(a){this._runtime=a,this._flowchartDataManager=new C3.FlowchartDataManager}Release(){this._flowchartDataManager.Release(),this._flowchartDataManager=null,this._runtime=null}GetRuntime(){return this._runtime}Create(a){this._flowchartDataManager.Add(a)}GetFlowchartDataItemByName(a){return this._flowchartDataManager.Get(a)}HasFlowcharts(){return this._flowchartDataManager.HasFlowcharts()}}; } // flowcharts/state/flowchartState.js { const C3=self.C3;C3.FlowchartState=class{constructor(t,e,r,a,o,h,s){this._runtime=o.GetRuntime(),this._flowchartManager=o,this._flowchartName=t,this._startNodeTag=r,this._flowchartDataItem=a,this._tag … [Строка слишком длинная. Вы можете скачать файл] } // flowcharts/state/flowchartStateManager.js { const C3=self.C3;C3.FlowchartStateManager=class{constructor(t){this._runtime=t,this._flowchartStates=new Map,this._currentFlowchartState=null,this._flowchartStateStack=[],this._on_after_load=()=>this._OnAfterLoad(),this._loadJson=null}Release(){C3.clearArray(this._flowchartStateStack),this._flowchartStateStack=null,this._flowchartStates.clear(),this._flowchartStates=null,this._currentFlowchartState=null,this._runtime=null,this._loadJson=null}GetRuntime(){return this._runtime}GetFlowchartDataItemByName(t){return this._runtime.GetFlowchartManager().GetFlowchartDataItemByName(t)}AddFlowchartState(t,e,a,r,h,s){const o=this._runtime.GetFlowchartManager().GetFlowchartDataItemByName(t);if(!o)return void console.warn(`[Flowcharts] no flowchart found with name '${t}'`);if(this._flowchartStates.has(a)){const t=this._flowchartStates.get(a);t&&this.RemoveFlowchartState(t)}const n=new C3.FlowchartState(t,a,e,o,this,r,s);return this._flowchartStates.set(a,n),h&&this.SetCurrentFlowchartState(n,!0),n}RemoveFlowchartState(t){if(t.MarkForRelease(),t.IsInTriggerState())return;const e=t.GetTag();this._flowchartStates.delete(e),t.Release(),this._currentFlowchartState===t&&(this._currentFlowchartState=null)}ResetFlowchartState(t){t.Reset()}GetFlowchartState(t){return this._flowchartStates.get(t)}PushFlowchartState(t){this._flowchartStateStack.push(t)}PopFlowchartState(){this._flowchartStateStack.pop()}SetCurrentFlowchartState(t,e=!1,a=!1,r=!0){if(r){const e=t.GetCurrentReferenceFlowchart();t=e||t}t!==this._currentFlowchartState&&(this._TriggerBeforeFlowchartChange(),this._TriggerAfterFlowchartChange(t,e,a))}GetCurrentFlowchartState(t){return"string"==typeof t?this.GetFlowchartState(t):this._flowchartStateStack.length?this._flowchartStateStack[this._flowchartStateStack.length-1]:this._currentFlowchartState}_TriggerBeforeFlowchartChange(){if(!this._currentFlowchartState)return;if(this._currentFlowchartState.WasReleased())return;const t=this._currentFlowchartState.GetPluginInstance().GetInstance();this._currentFlowchartState.PushIsTriggerState(),this.PushFlowchartState(this._currentFlowchartState),this._runtime.Trigger(C3.Plugins.Flowchart.Cnds.OnBeforeFlowchartChange,t),this.PopFlowchartState(),this._currentFlowchartState.PopIsTriggerState()}_TriggerAfterFlowchartChange(t,e=!1,a=!1){if(this._currentFlowchartState=t,!this._currentFlowchartState)return;if(this._currentFlowchartState.WasReleased())return;const r=this._currentFlowchartState.GetPluginInstance().GetInstance();this._currentFlowchartState.PushIsTriggerState(),this.PushFlowchartState(this._currentFlowchartState),this._runtime.Trigger(C3.Plugins.Flowchart.Cnds.OnFlowchartChange,r),!0!==a&&"number"!=typeof a||this._currentFlowchartState._SetStartFlowchartNode(a),e&&(this._runtime.Trigger(C3.Plugins.Flowchart.Cnds.OnAnyNodeChange,r),this._runtime.Trigger(C3.Plugins.Flowchart.Cnds.OnTaggedNodeChange,r),this._runtime.Trigger(C3.Plugins.Flowchart.Cnds.OnAnyNodeChangeInFlowchart,r),this._runtime.Trigger(C3.Plugins.Flowchart.Cnds.OnTaggedNodeChangeInFlowchart,r)),this.PopFlowchartState(),this._currentFlowchartState.PopIsTriggerState()}_SaveToJson(){return{"flowchartJsonObjects":[...this._flowchartStates.values()].map(t=>t._SaveToJson()),"currentFlowchartTag":this._currentFlowchartState?this._currentFlowchartState.GetTag():null}}_LoadFromJson(t){if(!t)return;this._loadJson=t;const e=new Map;for(const t of this._loadJson["flowchartJsonObjects"]){const a=t["flowchartTag"];if(this._flowchartStates.has(a)){const r=this._flowchartStates.get(a);r._LoadFromJson(t),e.set(a,r)}else{const a=this.AddFlowchartState(t["flowchartName"],t["startNodeTag"],t["flowchartTag"],null,!1,t["pluginUID"]);a._LoadFromJson(t),e.set(t["flowchartTag"],a)}}for(const[t,a]of this._flowchartStates.entries())e.has(t)||a.Release();this._flowchartStates.clear(),this._flowchartStates=e,this._runtime.IsLoadingState()?this._runtime.Dispatcher().addEventListener("afterload",this._on_after_load):this._OnAfterLoad()}_OnAfterLoad(){this._runtime.Dispatcher().removeEventListener("afterload",this._on_after_load);const t=this._flowchartStates.get(this._loadJson["currentFlowchartTag"]);t&&this.SetCurrentFlowchartState(t,!0),this._loadJson=null}}; } // flowcharts/data/flowchartDataManager.js { const C3=self.C3;C3.FlowchartDataManager=class{constructor(){this._flowchartDataItems=new Map}Release(){for(const t of this._flowchartDataItems.values())t.Release();this._flowchartDataItems.clear(),this._flowchartDataItems=null}Add(t){const a=new C3.FlowchartDataItem(t),s=a.GetName();this._flowchartDataItems.set(s,a)}Get(t){return this._flowchartDataItems.get(t)}HasFlowcharts(){return!!this._flowchartDataItems.size}static CreateDataItems(t,a,s,e){if(a)for(const o of a){const a=new s(o,e);t.push(a)}}}; } // flowcharts/data/flowchartData.js { const C3=self.C3,NAME=0,NODES=1;C3.FlowchartDataItem=class{constructor(t){this._name=t[0],this._flowchartNodeData=new C3.FlowchartNodeData(t[1],this)}Release(){this._flowchartNodeData.Release(),this._flowchartNodeData=null}GetFlowchartNodeData(){return this._flowchartNodeData}GetFlowchartElementById(t){return this._flowchartNodeData.GetFlowchartElementById(t)}GetFlowchartNodeByTags(t){return this._flowchartNodeData.GetFlowchartNodeByTags(t)}GetFlowchartStartNode(){return this._flowchartNodeData.GetFlowchartStartNode()}GetName(){return this._name}}; } // flowcharts/data/flowchartNodeData.js { const C3=self.C3,FLOWCHART_ID=0,TAG=1,PARENT_FLOWCHART_IDS=2,PARENT_OUTPUT_FLOWCHART_IDS=3,CHILDREN_FLOWCHART_IDS=4,OUTPUTS=5,IS_START=6,TYPE=7,DICTIONARY_ENABLE=8,REFERENCE_FLOWCHART=8,REFERENCE_FLOWCHART_START_NODE=9,REFERENCE_FLOWCHART_TAG=10,REFERENCE_FLOWCHART_ENABLE=11;class FlowchartNodeDataItem{constructor(t,e){this._flowchartNodeData=e,this._type=t[7],this._flowchartId=t[0],this._tag=t[1],this._tag?this._tags=this._tag.trim().split(" ").map(t=>t.trim()):this._tags=[],this._parentFlowchartIds=t[2],this._parentOutputFlowchartIds=null,this._childrenFlowchartIds=null,this._enable=!1,"dictionary"===this._type&&(this._parentOutputFlowchartIds=t[3],this._childrenFlowchartIds=t[4],this._enable=t[8]),this._isStart=t[6],this._referenceFlowchartName=null,this._referenceFlowchartStartNodeTag=null,this._referenceFlowchartTag=null,"reference"===this._type&&(this._referenceFlowchartName=t[8],this._referenceFlowchartStartNodeTag=t[9],this._referenceFlowchartTag=t[10],this._enable=t[11]),this._flowchartNodeOutputData=new C3.FlowchartNodeOutputData(t[5],this)}Release(){this._flowchartNodeData=null}GetFlowchartNodeData(){return this._flowchartNodeData}GetFlowchartNodeOutputData(){return this._flowchartNodeOutputData}GetFlowchartId(){return this._flowchartId}GetTag(){return this._tag}GetTags(){return this._tags}HasTags(t){if(!this._tags)return!1;if(!this._tags.length)return!1;const e=C3.FlowchartState._GetTagArray(t);return!(!e||!e.length)&&e.every(C3.FlowchartState._HasTag,this._tags)}GetIsStart(){return this._isStart}SetIsStart(t){this._isStart=!!t}CanBeStartNode(){if("dictionary"===this._type)return!0;if("reference"===this._type)return!1;throw new Error(`unexpected flowchart node type: ${this._type}`)}GetParentFlowchartIds(){return this._parentFlowchartIds}GetParentOutputFlowchartIds(){return this._parentOutputFlowchartIds}GetChildrenFlowchartIds(){return this._childrenFlowchartIds}GetType(){return this._type}GetEnable(){return this._enable}GetReferenceFlowchartName(){return this._referenceFlowchartName}GetReferenceFlowchartStartNodeTag(){return this._referenceFlowchartStartNodeTag}GetReferenceFlowchartTag(){return this._referenceFlowchartTag}}C3.FlowchartNodeData=class{constructor(t,e){this._flowchartDataItem=e,this._flowchartNodeItems=[],this._flowchartNodeItemsIdMap=new Map,this._flowchartNodeItemsTagMap=new Map,this._flowchartNodeStartItem=null,C3.FlowchartDataManager.CreateDataItems(this._flowchartNodeItems,t,FlowchartNodeDataItem,this);for(const t of this._flowchartNodeItems){const e=t.GetFlowchartId(),a=t.GetTag(),r=t.GetTags(),s=t.GetIsStart();if(this._flowchartNodeItemsIdMap.set(e,t),a)for(const e of r)this._flowchartNodeItemsTagMap.has(e)||this._flowchartNodeItemsTagMap.set(e,new Set),this._flowchartNodeItemsTagMap.get(e).add(t);s&&(this._flowchartNodeStartItem=t);const o=t.GetFlowchartNodeOutputData();for(const t of o.flowchartNodeOutputDataItems()){const e=t.GetFlowchartId();this._flowchartNodeItemsIdMap.set(e,t)}}this._flowchartNodeStartItem||this._SetStartNodeIfMissing()}Release(){this._flowchartDataItem=null;for(const t of this._flowchartNodeItems)t.Release();C3.clearArray(this._flowchartNodeItems),this._flowchartNodeItems=null}GetFlowchartDataItem(){return this._flowchartDataItem}GetFlowchartElementById(t){return this._flowchartNodeItemsIdMap.get(t)}GetFlowchartNodeByTags(t){if(!t||!t.length)return null;const e=[];for(const a of t.trim().split(" ")){let t=this._flowchartNodeItemsTagMap.get(a.trim())??new Set;if(0===t.size)return null;e.push(t)}return[...e.reduce((t,e)=>e.size<t.size?e:t)].filter(t=>e.every(e=>e.has(t)))[0]}GetFlowchartStartNode(){return this._flowchartNodeStartItem}*flowchartNodeDataItems(){for(const t of this._flowchartNodeItems)yield t}_SetStartNodeIfMissing(){let t=0;for(const e of this.flowchartNodeDataItems())e.GetIsStart()&&t++;if(0===t){for(const t of this.flowchartNodeDataItems())if(t.CanBeStartNode()&&!t.GetIsStart())return void t.SetIsStart(!0)}else{if(1===t)return;if(t>1){let t=!0;for(const e of this.flowchartNodeDataItems())e.CanBeStartNode()&&(e.GetIsStart()&&t?t=!1:e.GetIsStart()&&!t&&e.SetIsStart(!1))}}for(const t of this.flowchartNodeDataItems())if(t.CanBeStartNode()&&t.GetIsStart())return void(this._flowchartNodeStartItem=t)}}; } // flowcharts/data/flowchartNodeOutputData.js { const C3=self.C3,FLOWCHART_ID=0,NAME=1,VALUE=2,CONNECTED_FLOWCHART_NODE_FLOWCHART_ID=3,ENABLE=4,DEFAULT=5;class FlowchartNodeDataOutputItem{constructor(t,e){this._flowchartNodeOutputData=e,this._flowchartId=t[0],this._name=t[1],this._value=t[2],this._connectedFlowchartNodeFlowchartId=t[3],this._enable=t[4],this._default=t[5]}Release(){this._flowchartNodeOutputData=null}GetFlowchartNodeOutputData(){return this._flowchartNodeOutputData}GetFlowchartId(){return this._flowchartId}GetName(){return this._name}GetValue(){return this._value}GetConnectedFlowchartNodeFlowchartId(){return this._connectedFlowchartNodeFlowchartId}GetEnable(){return this._enable}GetDefault(){return this._default}}C3.FlowchartNodeOutputData=class{constructor(t,e){this._flowchartDataNodeItem=e,this._flowchartNodeOutputItems=[],this._flowchartNodeOutputItemsNameMap=new Map,C3.FlowchartDataManager.CreateDataItems(this._flowchartNodeOutputItems,t,FlowchartNodeDataOutputItem,this),this._enabledFlowchartNodeOutputItems=this._flowchartNodeOutputItems.filter(t=>t.GetEnable());for(const t of this._enabledFlowchartNodeOutputItems)this._flowchartNodeOutputItemsNameMap.set(t.GetName(),t)}Release(){this._flowchartDataNodeItem=null;for(const t of this._flowchartNodeOutputItems)t.Release();C3.clearArray(this._flowchartNodeOutputItems),this._flowchartNodeOutputItems=null,C3.clearArray(this._enabledFlowchartNodeOutputItems),this._enabledFlowchartNodeOutputItems=null}GetFlowchartNodeDataItem(){return this._flowchartDataNodeItem}GetFlowchartNodeOutputDataItemCount(){return this._enabledFlowchartNodeOutputItems.length}GetFlowchartNodeOutputDataItems(){return this._enabledFlowchartNodeOutputItems}GetFlowchartNodeOutputDataItemByName(t){return this._flowchartNodeOutputItemsNameMap.get(t)}GetFlowchartNodeOutputDefault(){for(const t of this._enabledFlowchartNodeOutputItems)if(t.GetDefault())return t}*flowchartNodeOutputDataItems(){for(const t of this._enabledFlowchartNodeOutputItems)yield t}}; } // models3d/model3dManager.js { const C3=self.C3;C3.Model3dManager=class{#e;#t=new Map;constructor(e){this.#e=e}Release(){for(const e of this.#t.values())e.Release();this.#t.clear(),this.#t=null,this._runtime=null}GetRuntime(){return this._runtime}Create(e){const t=new C3.Model3dDataItem(e,this.#e);this.#t.set(t.GetName(),t)}*GetModel3dDataItems(){yield*this.#t.values()}GetModel3dDataItemByName(e){return this.#t.get(e)}HasModels3d(){return this.#t.size}static CreateDataItems(e,t,s,d){if(t)for(const l of t){const t=new s(l,d);e.push(t)}}}; } // models3d/model3dData.js { const C3=self.C3,NAME=0,OFFSET=1,ROTATION=2,SCALE=3;C3.Model3dDataItem=class{#e;#t=null;#s=null;#a=null;#i=null;#n=null;#o=null;#l=null;#r=null;#h=!1;constructor(e,t){this.#e=e[0],this.#r=(async()=>{const e=new C3.ZipFile;try{const s=await t.GetAssetManager().FetchBlob(`3dmodels/${this.#e}.zip`);await e.LoadFromBlob(s,t);const a=await e.ReadBlob(e.GetEntry(`${this.#e}.bin`)),i=await a.arrayBuffer(),n=new C3.Model3dBinaryBlobSerializer,o=await n.Deserialize(i);this.#t=new C3.Model3dAnimationData(o["animations"],this),this.#s=new C3.Model3dMeshData(o["meshes"],this),this.#a=new C3.Model3dObjectData(o["objects"],this),this.#i=new C3.Model3dObjectData(o["bones"],this),await this.#s.OnCreate(),this.#h=!0}finally{e.Release()}})(),this.#n=new globalThis.Float32Array(C3.toArrayLike(e[1])),this.#o=new globalThis.Float32Array(C3.toArrayLike(e[2])),this.#l=new globalThis.Float32Array(C3.toArrayLike(e[3]))}Release(){this.#t.Release(),this.#t=null,this.#s.Release(),this.#s=null,this.#a.Release(),this.#a=null,this.#i.Release(),this.#i=null}IsReady(){return this.#r}Resolved(){return this.#h}GetName(){return this.#e}GetAnimations(){return this.#t.GetAnimationsMap()}GetMeshes(){return this.#s.GetMeshesMap()}GetObjects(){return this.#a.GetObjectsMap()}GetBones(){return this.#i.GetObjectsMap()}*GetTextures(){for(const e of this.GetMeshes().values())yield e.GetModel3dTexture()}GetObjectById(e){if(this.GetMeshes())for(const t of this.GetMeshes().values())if(t.GetId()===e)return t;if(this.GetObjects())for(const t of this.GetObjects().values())if(t.GetId()===e)return t;if(this.GetBones())for(const t of this.GetBones().values())if(t.GetId()===e)return t}GetOffset(){return this.#n}GetRotation(){return this.#o}GetScale(){return this.#l}}; } // models3d/model3dAnimationData.js { const C3=self.C3;C3.Model3dAnimationDataItem=class{#t;#a;#e;#i;constructor(t){this.#t=t["id"],this.#a=t["name"],this.#e=t["duration"],this.#i=t["tracks"].map(t=>new TrackDataItem(t))}Release(){for(const t of this.#i)t.Release();this.#i=null}GetId(){return this.#t}GetName(){return this.#a}GetDuration(){return this.#e}GetTracks(){return this.#i}};class TrackDataItem{#s;#a;#n;#o;#r;#m;constructor(t){this.#s=t["type"],this.#a=t["name"],this.#n=new globalThis.Float32Array(C3.toArrayLike(t["times"])),this.#o=new globalThis.Float32Array(C3.toArrayLike(t["values"])),this.#r=t["interpolation"],this.#m=t["lookup-id"]}Release(){this.#n=null,this.#o=null}GetType(){return this.#s}GetName(){return this.#a}GetTimes(){return this.#n}GetValues(){return this.#o}GetInterpolation(){return this.#r}GetLookupUUID(){return this.#m}static get STEP_INTERPOLATION(){return"step"}static get LINEAR_INTERPOLATION(){return"linear"}static get CUBIC_SPLINE_INTERPOLATION(){return"cubic-spline"}}C3.Model3dAnimationData=class{#l;#h;#d;constructor(t,a){this.#l=a,this.#h=[],C3.Model3dManager.CreateDataItems(this.#h,t,C3.Model3dAnimationDataItem,this)}Release(){this.#l=null;for(const t of this.#h)t.Release();C3.clearArray(this.#h),this.#h=null,this.#d&&this.#d.clear(),this.#d=null}GetModel3dDataItem(){return this.#l}GetAnimationsMap(){if(this.#d)return this.#d;this.#d=new Map;for(const t of this.#h)this.#d.set(t.GetName(),t);return this.#d}}; } // models3d/model3dObjectData.js { const C3=self.C3;C3.Model3dObjectDataItem=class{#t;#e;#a;#i;#s;#r;#n;#o;constructor(t){this.#t=t["id"],this.#e=t["parent-id"],this.#a=t["name"],this.#i=new globalThis.Float32Array(C3.toArrayLike(t["position"])),this.#s=new globalThis.Float32Array(C3.toArrayLike(t["quaternion"])),this.#r=new globalThis.Float32Array(C3.toArrayLike(t["scale"])),this.#n=new globalThis.Float32Array(C3.toArrayLike(t["bind-matrix"])),this.#o=new globalThis.Float32Array(C3.toArrayLike(t["bind-inverse-matrix"]))}Release(){this.#i=null,this.#s=null,this.#r=null,this.#n=null,this.#o=null}GetId(){return this.#t}GetParentId(){return this.#e}GetName(){return this.#a}GetPosition(){return this.#i}GetQuaternion(){return this.#s}GetScale(){return this.#r}GetBindMatrix(){return this.#n}GetBindMatrixInverse(){return this.#o}},C3.Model3dObjectData=class{#l;#d;#h;constructor(t,e){this.#l=e,this.#d=[],C3.Model3dManager.CreateDataItems(this.#d,t,C3.Model3dObjectDataItem,this)}Release(){this.#l=null;for(const t of this.#d)t.Release();C3.clearArray(this.#d),this.#d=null,this.#h&&this.#h.clear(),this.#h=null}GetModel3dDataItem(){return this.#l}GetObjectsMap(){if(this.#h)return this.#h;this.#h=new Map;for(const t of this.#d)this.#h.set(t.GetName(),t);return this.#h}}; } // models3d/model3dMeshData.js { const C3=self.C3;C3.Model3dMeshDataItem=class extends C3.Model3dObjectDataItem{#t;#e;#a;#s;#n;#i;#r;#o;#d;#h;#l;#D;#m;#u;constructor(t,e){super(t),this.#u=e,t["vertex-data"]&&(this.#t=new globalThis.Float32Array(C3.toArrayLike(t["vertex-data"]))),t["uv-data"]&&(this.#e=new globalThis.Float32Array(C3.toArrayLike(t["uv-data"]))),t["index-data"]&&(this.#a=new globalThis.Float32Array(C3.toArrayLike(t["index-data"]))),this.#s=t["is-skinned"],t["skin-index-data"]&&(this.#n=new globalThis.Float32Array(C3.toArrayLike(t["skin-index-data"]))),t["skin-weigth-data"]&&(this.#i=new globalThis.Float32Array(C3.toArrayLike(t["skin-weigth-data"]))),t["color-data"]&&(this.#r=new globalThis.Float32Array(C3.toArrayLike(t["color-data"]))),t["render-type"]&&(this.#D=t["render-type"]),t["bones-data"]&&(this.#o=t["bones-data"].map(t=>new Bone(t))),this.#d=t["bone-inverse-matrices"],t["bone-bind-data"]&&(this.#h=t["bone-bind-data"].map(t=>new Bone(t))),this.#l=new C3.Model3dTextureDataItem(t["texture"])}Release(){if(super.Release(),this.#t=null,this.#e=null,this.#a=null,this.#n=null,this.#i=null,this.#r=null,this.#o)for(const t of this.#o)t.Release();if(this.#o=null,this.#d=null,this.#h)for(const t of this.#h)t.Release();this.#h=null,this.#m&&this.#m.clear(),this.#m=null,this.#l&&this.#l.Release()}OnCreate(){for(const t of this.#u.GetAnimations().values()){const e=t.GetTracks(),a=e.some(t=>{const e=this.#u.GetObjectById(t.GetLookupUUID());if(!e)return!1;let a=this;for(;a;){if(a.GetId()===e.GetId())return!0;const t=a.GetParentId();a=t?this.#u.GetObjectById(t):null}return!1});let s=!1;if(this.#o)for(const t of this.#o)s||=e.some(e=>{const a=this.#u.GetObjectById(e.GetLookupUUID());return!(!a||a.GetId()!==t.GetId())});(a||s)&&(this.#m||(this.#m=new Map),this.#m.set(t.GetName(),t))}}GetAnimationsMap(){return this.#m}GetVertexData(){return this.#t}GetUVData(){return this.#e}GetIndexData(){return this.#a}IsSkinned(){return this.#s}GetSkinIndexData(){return this.#n}GetSkinWeigthData(){return this.#i}GetColorData(){return this.#r}GetRenderType(){return this.#D}GetBoneData(){return this.#o}GetBoneInverseMatricesData(){return this.#d}GetBoneBindPoseData(){return this.#h}GetModel3dTexture(){return this.#l}};class Bone{#I;#c;#x;#M;#b;#p;#G;#k;constructor(t){this.#I=t["id"],this.#c=t["parent-id"],this.#x=t["index"],this.#M=t["parent-index"],this.#b=t["name"],this.#p=new globalThis.Float32Array(C3.toArrayLike(t["position"])),this.#G=new globalThis.Float32Array(C3.toArrayLike(t["quaternion"])),this.#k=new globalThis.Float32Array(C3.toArrayLike(t["scale"]))}Release(){this.#p=null,this.#G=null,this.#k=null}GetId(){return this.#I}GetParentId(){return this.#c}GetIndex(){return this.#x}GetParentIndex(){return this.#M}GetName(){return this.#b}GetPosition(){return this.#p}GetQuaternion(){return this.#G}GetScale(){return this.#k}}C3.Model3dMeshData=class{#u;#y;#C;constructor(t,e){this.#u=e,this.#y=[],C3.Model3dManager.CreateDataItems(this.#y,t,C3.Model3dMeshDataItem,e)}Release(){this.#u=null;for(const t of this.#y)t.Release();C3.clearArray(this.#y),this.#y=null,this.#C&&this.#C.clear(),this.#C=null}GetModel3dDataItem(){return this.#u}GetMeshesMap(){if(this.#C)return this.#C;this.#C=new Map;for(const t of this.#y)this.#C.set(t.GetName(),t);return this.#C}OnCreate(){for(const t of this.#y)t.OnCreate()}}; } // models3d/model3dTextureData.js { const C3=self.C3,uniqueTextureDataItems=new Map;C3.Model3dTextureDataItem=class{#e;#t;#r;#s;#a;#i;#h;#o;#u;#n;#I;#m;#d;#T;constructor(e){uniqueTextureDataItems.has(e["url"])?this.#T=uniqueTextureDataItems.get(e["url"]):(this.#o=new C3.ImageInfo,this.#o.LoadData(e),uniqueTextureDataItems.set(e["url"],this));const t=e["color"];this.#e=e["url"],this.#t=e["name"],this.#r=e["color"]?new C3.Color(t[0],t[1],t[2],t[3]):null,this.#s=e["wrap-x"],this.#a=e["wrap-y"],this.#i=e["has-content"],this.#h=e["content-type"],this.#u=!1,this.#n=!1,this.#I=!1,this.#m=!1}Release(){this.#T||(this.#o.Release(),uniqueTextureDataItems.delete(this.#e)),this.#o=null,this.#T=null}HasContent(){return this.#i}GetContentType(){return this.#h}GetColor(){return this.#r}GetOpacity(){return this.#r?this.#r.getA():1}GetImageInfo(){return this.#T?this.#T.GetImageInfo():this.#o}GetSpriteSheetWidth(){if(this.#T)return this.#T.GetSpriteSheetWidth();const e=this.GetImageInfo().GetSheetWidth();return-1===e?NaN:e}GetSpriteSheetHeight(){if(this.#T)return this.#T.GetSpriteSheetHeight();const e=this.#o.GetSheetHeight();return-1===e?NaN:e}GetSpriteSheetOffsetX(){return this.#T?this.#T.GetSpriteSheetOffsetX():this.#o.GetOffsetX()}GetSpriteSheetOffsetY(){return this.#T?this.#T.GetSpriteSheetOffsetY():this.#o.GetOffsetY()}GetWidthInSpriteSheet(){return this.#T?this.#T.GetWidthInSpriteSheet():this.#o.GetWidth()}GetHeightInSpriteSheet(){return this.#T?this.#T.GetHeightInSpriteSheet():this.#o.GetHeight()}IsContentReady(){return this.#T?this.#T.IsContentReady():this.#n&&!this.#u}IsLoadingTexture(){return this.#T?this.#T.IsLoadingTexture():this.#I}LoadAsset(e,t){if(this.#T)return this.#T.LoadAsset(e,t);!this.#m&&this.HasContent()&&this.#o.LoadAsset(e,t),this.#m=!0}GetTexture(e,t,r){if(this.#T)return this.#T.GetTexture(e,t,r);if(!this.HasContent()||this.#u)return null;if(this.#n)return this.#o.GetTexture();if(!this.#I&&!this.#n){this.LoadAsset(e,r),r?(r.wrapX=this.#s,r.wrapY=this.#a):r={wrapX:this.#s,wrapY:this.#a},this.#I=!0;const s=this.#o.GetImageAsset(),a=s.IsLoaded()?s.GetBlob():this.#o.GetImageAsset().Load();this.#d=a.then(()=>this.#o.LoadStaticTexture(t,r)).then(e=>{this.#u=!1,this.#I=!1,this.#n=!0}).catch(e=>{this.#u=!0,this.#I=!1,this.#n=!1})}return this.#o.GetTexture()}ReleaseTexture(){if(this.#T)return this.#T.ReleaseTexture();!this.#I&&this.#o&&this.#o.ReleaseTexture(),this.#u=!1,this.#I=!1,this.#n=!1}HasTexture(){return this.#T?this.#T.HasTexture():!!this.#o&&!!this.#o?.GetImageAsset()?.GetTexture()}HadTextureError(){return this.#T?this.#T.HadTextureError():this.#u}IsReady(){return this.#d}}; } // events/stacks/solStack.js { const C3=self.C3;C3.SolStack=class extends C3.DefendedBase{constructor(t){super(),this._objectClass=t,this._stack=[],this._stack.push(C3.New(C3.Sol,this)),this._index=0,this._current=this._stack[0]}Release(){for(const t of this._stack)t.Release();C3.clearArray(this._stack),this._current=null,this._objectClass=null}GetObjectClass(){return this._objectClass}GetCurrentSol(){return this._current}GetOneBelowCurrentSol(){return this._stack[this._index-1]}Clear(){this.GetCurrentSol().Clear()}PushClean(){const t=this._stack,s=++this._index;if(s===t.length){const s=C3.New(C3.Sol,this);t.push(s),this._current=s}else{const e=t[s];e.Reset(),this._current=e}}PushCopy(){const t=this._stack,s=++this._index;s===t.length&&t.push(C3.New(C3.Sol,this));const e=t[s];e.Copy(t[s-1]),this._current=e}Pop(){this._current=this._stack[--this._index]}RemoveInstances(t){const s=this._stack;for(let e=0,n=s.length;e<n;++e)s[e].RemoveInstances(t)}}; } // events/stacks/sol.js { const C3=self.C3;C3.Sol=class extends C3.DefendedBase{constructor(s){super(),this._stack=s,this._objectClass=this._stack.GetObjectClass(),this._eventStack=this._objectClass.GetRuntime().GetEventStack(),this._selectAll=!0,this._instances=[],this._elseInstances=[]}Release(){this.ClearArrays(),this._stack=null,this._objectClass=null,this._eventStack=null}ClearArrays(){C3.clearArray(this._instances),C3.clearArray(this._elseInstances)}GetObjectClass(){return this._objectClass}IsSelectAll(){return this._selectAll}HasAnyInstances(){return this._selectAll?!!this._objectClass.GetInstanceCount():!!this._instances.length}GetInstances(){return this._selectAll?this._objectClass.GetInstances():this._instances}HasAnyElseInstances(){return!!this._elseInstances.length}GetElseInstances(){return this._elseInstances}GetExpressionInstances(){const s=this.GetInstances();return s.length?s:this._elseInstances}Reset(){this._selectAll=!0,C3.clearArray(this._elseInstances)}Clear(){this._selectAll=!0}Copy(s){s.IsSelectAll()?this.Reset():(this._selectAll=!1,C3.shallowAssignArray(this._instances,s._instances),C3.clearArray(this._elseInstances))}_PushInstance(s){this._instances.push(s)}_PushElseInstance(s){this._elseInstances.push(s)}_SetSelectAll(s){this._selectAll=!!s}_GetOwnInstances(){return this._instances}_GetOwnElseInstances(){return this._elseInstances}SetSinglePicked(s){this._selectAll=!1,C3.clearArray(this._instances),this._instances.push(s)}SetArrayPicked(s){this._selectAll=!1,C3.shallowAssignArray(this._instances,s)}SetSetPicked(s){this._selectAll=!1,C3.clearArray(this._instances);for(const e of s)this._instances.push(e)}AddElseInstances(s,e){for(const t of e)s.has(t)||this._elseInstances.push(t)}TransferElseInstancesToOwn(s){for(const e of s)this._instances.push(e);C3.arrayRemoveAllInSet(this._elseInstances,s)}ClearElseInstances(){C3.clearArray(this._elseInstances)}PickOne(s){if(s)if(this._eventStack.GetCurrentStackFrame().GetCurrentEvent().IsOrBlock()){this.IsSelectAll()&&(C3.clearArray(this._instances),C3.shallowAssignArray(this._elseInstances,s.GetObjectClass().GetInstances()),this._selectAll=!1);const e=this._elseInstances.indexOf(s);-1!==e&&(this._instances.push(this._elseInstances[e]),this._elseInstances.splice(e,1))}else this.SetSinglePicked(s)}RemoveInstances(s){C3.arrayRemoveAllInSet(this._instances,s),C3.arrayRemoveAllInSet(this._elseInstances,s)}}; } // events/stacks/eventStack.js { const C3=self.C3;C3.EventStack=class extends C3.DefendedBase{constructor(t){super(),this._eventSheetManager=t,this._runtime=this._eventSheetManager.GetRuntime(),this._stack=[],this._stack.push(C3.New(C3.EventStackFrame,this,null)),this._index=0,this._expFuncStack=[]}Release(){for(const t of this._stack)t.Release();C3.clearArray(this._stack),C3.clearArray(this._expFuncStack),this._eventSheetManager=null,this._runtime=null}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetCurrentStackFrame(){return this._stack[this._index]}GetAllStackFrames(){return this._stack}GetCurrentStackFrameIndex(){return this._index}Push(t){const e=this._stack,n=++this._index;if(n===e.length){const n=C3.New(C3.EventStackFrame,this,t);return e.push(n),n}{const s=e[n];return s.Reset(t),s}}Pop(){--this._index}PushExpFunc(t){this._expFuncStack.push(t)}PopExpFunc(){this._expFuncStack.pop()}GetCurrentExpFuncStackFrame(){const t=this._expFuncStack;return 0===t.length?null:t.at(-1)}}; } // events/stacks/eventStackFrame.js { const C3=self.C3;C3.EventStackFrame=class extends C3.DefendedBase{constructor(t,e){super(),this._stack=t,this._runtime=this._stack.GetRuntime(),this._currentEvent=e,this._cndIndex=0,this._actIndex=0,this._lastEventTrue=!1,this._elseBranchRan=!1,this._expressionObjectClass=null,this._functionReturnType=0,this._functionReturnValue=0,this._dynamicSolModifiers=null}Release(){this.Reset(null),this._stack=null,this._runtime=null}Reset(t){this._currentEvent=t,this._cndIndex=0,this._actIndex=0,this._lastEventTrue=!1,this._elseBranchRan=!1,this._dynamicSolModifiers=null}_Restore(t,e){this._currentEvent=t,this._cndIndex=0,this._actIndex=e}ResetQuick(){this._cndIndex=0,this._actIndex=0}GetCurrentEvent(){return this._currentEvent}SetCurrentEvent(t){this._currentEvent=t}GetConditionIndex(){return this._cndIndex}SetConditionIndex(t){this._cndIndex=t}GetActionIndex(){return this._actIndex}SetActionIndex(t){this._actIndex=t}SetLastEventTrue(t){this._lastEventTrue=!!t}GetLastEventTrue(){return this._lastEventTrue}SetElseBranchRan(t){this._elseBranchRan=!!t}GetElseBranchRan(){return this._elseBranchRan}SetExpressionObjectClass(t){this._expressionObjectClass=t}GetExpressionObjectClass(){return this._expressionObjectClass}InitCallFunctionExpression(t,e){this._functionReturnType=t,this._functionReturnValue=e}GetFunctionReturnType(){return this._functionReturnType}SetFunctionReturnValue(t){this._functionReturnValue=t}GetFunctionReturnValue(){return this._functionReturnValue}IsSolModifierAfterCnds(){const t=this._currentEvent;return!!t.IsSolWriterAfterCnds()||this._cndIndex<t.GetConditionCount()-1&&!!t.GetSolModifiers().length}SetDynamicSolModifiers(t){this._dynamicSolModifiers=t}GetDynamicSolModifiers(){return this._dynamicSolModifiers}}; } // events/stacks/localVarStack.js { const C3=self.C3;C3.LocalVarStack=class extends C3.DefendedBase{constructor(t){super(),this._eventSheetManager=t,this._runtime=this._eventSheetManager.GetRuntime(),this._stack=[],this._index=-1,this._current=null,this._initialValues=[]}Release(){C3.clearArray(this._stack),this._eventSheetManager=null,this._runtime=null}_SetInitialValues(t){this._initialValues=t;const e=this._initialValues.slice(0);this._stack.push(e),this._index=0,this._current=e}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetCurrent(){return this._current}Push(){const t=++this._index,e=this._stack;t===e.length?e.push(this._initialValues.slice(0)):C3.shallowAssignArray(e[t],this._initialValues),this._current=e[t]}Pop(){this._current=this._stack[--this._index]}}; } // events/stacks/loopStack.js { const C3=self.C3;C3.LoopStack=class extends C3.DefendedBase{constructor(t){super(),this._eventSheetManager=t,this._runtime=this._eventSheetManager.GetRuntime(),this._stack=[],this._index=-1}Release(){C3.clearArray(this._stack),this._eventSheetManager=null,this._runtime=null}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}IsInLoop(){return this._index>=0}GetCurrent(){return this._stack[this._index]}Push(){if(++this._index,this._index===this._stack.length){const t=C3.New(C3.Loop,this);return this._stack.push(t),t}{const t=this._stack[this._index];return t.Reset(),t}}Pop(){--this._index}FindByName(t){const e=this._stack;for(let s=this._index;s>=0;--s){const n=e[s];if(n.GetName()===t)return n}return null}_GetStack(){return this._stack.slice(0,this._index+1)}}; } // events/stacks/loop.js { const C3=self.C3;C3.Loop=class extends C3.DefendedBase{constructor(e){super(),this._loopStack=e,this._name="",this._index=0,this._isStopped=!1,this._end=NaN}Reset(){this._name="",this._index=0,this._isStopped=!1,this._end=NaN}SetName(e){this._name=e}GetName(){return this._name}SetIndex(e){this._index=e}GetIndex(){return this._index}Stop(){this._isStopped=!0}IsStopped(){return this._isStopped}SetEnd(e){this._end=e}GetEnd(){return this._end}}; } // events/stacks/arrayStack.js { const C3=self.C3;C3.ArrayStack=class extends C3.DefendedBase{constructor(){super(),this._stack=[],this._index=-1}Release(){C3.clearArray(this._stack)}GetCurrent(){return this._stack[this._index]}Push(){if(++this._index,this._index===this._stack.length){const s=[];return this._stack.push(s),s}return this._stack[this._index]}Pop(){--this._index}}; } // events/eventSheetManager.js { const C3=self.C3,assert=self.assert;function SortSolArray(t,e){return t.GetIndex()-e.GetIndex()}function IsSolArrayIdentical(t,e){for(let s=0,n=t.length;s<n;++s)if(t[s]!==e[s])return!1;return!0}C3.Eve … [Строка слишком длинная. Вы можете скачать файл] } // events/eventSheet.js { const C3=self.C3;C3.EventSheet=class extends C3.DefendedBase{constructor(e,t){super(),this._eventSheetManager=e,this._runtime=e.GetRuntime(),this._name=t[0],this._events=[],this._triggers=new Map,this._fastTriggers=new Map,this._eventsByDisplayNumber=new Map,this._hasRun=!1,this._shallowIncludes=[],this._deepIncludes=[],this._alreadyIncludedSheets=new Set;for(const e of t[1])this._CreateEvent(e,null,this._events);this._perfRecord=this._runtime.IsDebug()?{type:"sheet",name:this._name,totalTimeCounter:0,children:[]}:null}Release(){this._eventSheetManager=null,this._runtime=null}_CreateEvent(e,t,s){switch(e[0]){case 0:case 3:this._CreateEventBlock(e,t,s);break;case 1:this._CreateEventVariable(e,t,s);break;case 2:this._CreateInclude(e,t,s);break;case 4:this._CreateFunctionBlock(e,t);break;case 5:this._CreateScriptBlock(e,t,s);break;case 6:this._CreateCustomACEBlock(e,t);break;default:throw new Error("invalid event type")}}_CreateEventBlock(e,t,s){const n=C3.EventBlock.Create(this,t,e);if(n.IsOrBlock()){s.push(n);const e=n.GetConditions();for(let t=0,s=e.length;t<s;++t)e[t].IsTrigger()&&this._InitTrigger(n,t)}else n.IsTrigger()?this._InitTrigger(n,0):s.push(n)}_CreateFunctionBlock(e,t){const s=C3.FunctionBlock.CreateFunctionBlock(this,t,e);this._eventSheetManager._RegisterFunctionBlock(s)}_CreateCustomACEBlock(e,t){const s=C3.FunctionBlock.CreateCustomACEBlock(this,t,e);this._eventSheetManager._RegisterFunctionBlock(s)}_CreateEventVariable(e,t,s){const n=C3.EventVariable.Create(this,t,e);s.push(n)}_CreateInclude(e,t,s){const n=C3.EventInclude.Create(this,t,e);s.push(n)}_CreateScriptBlock(e,t,s){const n=C3.EventScript.Create(this,t,e);s.push(n)}_InitTrigger(e,t){e.IsOrBlock()||this._eventSheetManager._AddTriggerToPostInit(e);const s=e.GetConditionAt(t),n=s._GetFunc(),r=s.GetObjectClass();if(s.IsFastTrigger()){let i=this._fastTriggers.get(r);i||(i=new Map,this._fastTriggers.set(r,i));const l=s.GetFastTriggerValue().toLowerCase();let o=i.get(n);o||(o=new Map,i.set(n,o));let a=o.get(l);a||(a=[],o.set(l,a)),a.push([e,t])}else{let i=this._triggers.get(r);i||(i={methodMap:new Map,behaviors:new Map},this._triggers.set(r,i));const l=s.GetBehaviorType();let o;l?(o=i.behaviors.get(l),o||(o=new Map,i.behaviors.set(l,o))):o=i.methodMap;let a=o.get(n);a||(a=[],o.set(n,a)),a.push([e,t])}}_PostInit(){const e=this._events;for(let t=0,s=e.length;t<s;++t){const n=t<s-1&&e[t+1]instanceof C3.EventBlock&&e[t+1].IsElseBlock();e[t]._PostInit(n)}}_AddShallowInclude(e){this._shallowIncludes.push(e)}_UpdateDeepIncludes(){C3.clearArray(this._deepIncludes),this._AddDeepIncludes(this),this._alreadyIncludedSheets.clear()}_AddDeepIncludes(e){const t=e._deepIncludes,s=e._alreadyIncludedSheets;for(const n of this._shallowIncludes){const r=n.GetIncludeSheet();n.IsActive()&&e!==r&&!s.has(r)&&(s.add(r),r._AddDeepIncludes(e),t.push(r))}}deepIncludes(){return this._deepIncludes}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetName(){return this._name}_RegisterEventByDisplayNumber(e,t){this._eventsByDisplayNumber.set(t,e)}_GetEventByDisplayNumber(e){return this._eventsByDisplayNumber.get(e)||null}_ResetHasRunFlag(){this._hasRun=!1}Run(){if(this._hasRun)return;const e=this._runtime,t=e.IsCPUProfiling(),s=t?performance.now():0;this._hasRun=!0;const n=this.GetEventSheetManager(),r=n.GetCurrentEventStackFrame();for(const t of this._events)t.Run(r),n.ClearSol(t.GetSolModifiers()),n.ClearAsyncActionPromises(),e.FlushPendingInstances();r.Reset(null),t&&(this._perfRecord.totalTimeCounter+=performance.now()-s)}*DebugRun(){if(this._hasRun)return;this._hasRun=!0;const e=this._runtime,t=this.GetEventSheetManager(),s=t.GetCurrentEventStackFrame();for(const n of this._events)yield*n.DebugRun(s),t.ClearSol(n.GetSolModifiers()),t.ClearAsyncActionPromises(),e.FlushPendingInstances();s.Reset(null)}_Trigger(e,t,s){if(!t)return this._TriggerForClass(e,t,null,null);{const n=t.GetObjectClass();let r=!1,i=this._TriggerForClass(e,t,n,s);r=r||i;for(const l of n.GetFamilies())i=this._TriggerForClass(e,t,l,s),r=r||i}}_TriggerForClass(e,t,s,n){const r=this._triggers.get(s);if(!r)return!1;const i=n?r.behaviors.get(n):r.methodMap;if(!i)return!1;const l=i.get(e);if(!l)return!1;let o=!1;for(const[e,s]of l){const n=this._ExecuteTrigger(t,e,s);o=o||n}return o}*_DebugTrigger(e,t,s){if(!t)return yield*this._DebugTriggerForClass(e,t,null,null);{const n=t.GetObjectClass();let r=!1,i=yield*this._DebugTriggerForClass(e,t,n,s);r=r||i;for(const l of n.GetFamilies())i=yield*this._DebugTriggerForClass(e,t,l,s),r=r||i}}*_DebugTriggerForClass(e,t,s,n){const r=this._triggers.get(s);if(!r)return!1;const i=n?r.behaviors.get(n):r.methodMap;if(!i)return!1;const l=i.get(e);if(!l)return!1;let o=!1;for(const[e,s]of l){let n;n=e.DebugCanRunFast()?this._ExecuteTrigger(t,e,s):yield*this._DebugExecuteTrigger(t,e,s),o=o||n}return o}_FastTrigger(e,t,s){const n=t.GetObjectClass(),r=this._fastTriggers.get(n);if(!r)return!1;const i=r.get(e);if(!i)return!1;const l=i.get(s);if(!l)return!1;let o=!1;for(let e=0,t=l.length;e<t;++e){const t=l[e],s=this._ExecuteTrigger(null,t[0],t[1]);o=o||s}return o}*_DebugFastTrigger(e,t,s){const n=t.GetObjectClass(),r=this._fastTriggers.get(n);if(!r)return!1;const i=r.get(e);if(!i)return!1;const l=i.get(s);if(!l)return!1;let o=!1;for(let e=0,t=l.length;e<t;++e){const t=l[e],s=t[0],n=t[1];let r;r=s.DebugCanRunFast()?this._ExecuteTrigger(null,s,n):yield*this._DebugExecuteTrigger(null,s,n),o=o||r}return o}_ExecuteTrigger(e,t,s){const n=this._runtime,r=this._eventSheetManager,i=r.GetCurrentEvent(),l=r.GetEventStack(),o=r.GetTriggerDepth();let a=!1,c=null,u=null;if(i){const e=new Set(t.GetSolModifiersIncludingParents());for(const t of i.GetSolModifiersIncludingParents())e.add(t);c=[...e],u=r.PushCleanSolDynamic(e)}else c=t.GetSolModifiersIncludingParents();r.PushCleanSol(c);const g=o>1;g&&r.GetLocalVarStack().Push();const h=l.Push(t);if(e){t.GetConditions()[s].GetObjectClass().GetCurrentSol().SetSinglePicked(e),e.IsInContainer()&&e.SetSiblingsSinglePicked()}let _=!0;if(t.GetParent()){const e=t.GetTriggerParents();for(let t=0,s=e.length;t<s;++t)if(!e[t].RunPreTrigger(h)){_=!1;break}}return _&&(t.IsOrBlock()?t.RunOrBlockTrigger(h,s):t.Run(h),a=h.GetLastEventTrue()),l.Pop(),g&&r.GetLocalVarStack().Pop(),r.PopSol(c),u&&r.PopSol(u),i||1!==o||(r.ClearAsyncActionPromises(),r.IsFlushingBlocked()||n.FlushPendingInstances()),a}*_DebugExecuteTrigger(e,t,s){const n=this._runtime,r=this._eventSheetManager,i=r.GetCurrentEvent(),l=r.GetEventStack(),o=r.GetTriggerDepth();let a=!1;i&&r.PushCleanSol(i.GetSolModifiersIncludingParents()),r.PushCleanSol(t.GetSolModifiersIncludingParents());const c=o>1;c&&r.GetLocalVarStack().Push();const u=l.Push(t);if(e){t.GetConditions()[s].GetObjectClass().GetCurrentSol().SetSinglePicked(e),e.IsInContainer()&&e.SetSiblingsSinglePicked()}let g=!0;if(t.GetParent()){const e=t.GetTriggerParents();for(let t=0,s=e.length;t<s;++t)if(!(yield*e[t].DebugRunPreTrigger(u))){g=!1;break}}return g&&(t.IsOrBlock()?yield*t.DebugRunOrBlockTrigger(u,s):yield*t.DebugRun(u),a=u.GetLastEventTrue()),l.Pop(),c&&r.GetLocalVarStack().Pop(),r.PopSol(t.GetSolModifiersIncludingParents()),i&&r.PopSol(i.GetSolModifiersIncludingParents()),i||1!==o||(r.ClearAsyncActionPromises(),r.IsFlushingBlocked()||n.FlushPendingInstances()),a}_GetPerfRecord(){return this._perfRecord}}; } // events/eventBlock.js { const C3=self.C3,EMPTY_ARRAY=[];function NoActions(t,e){return!0}function*DebugNoActions(t,e){return!0}C3.EventBlock=class extends C3.DefendedBase{constructor(t,e,n){super(),this._eventSheet=t,this._r … [Строка слишком длинная. Вы можете скачать файл] } // events/eventScript.js { const C3=self.C3,EMPTY_SOL_MODIFIERS=[];let hadUserScriptException=!1;C3.EventScript=class extends C3.DefendedBase{constructor(e,t,i){super();const r=e.GetRuntime(),n=e.GetEventSheetManager();this._eventSheet=e,this._eventSheetManager=n,this._runtime=e.GetRuntime(),this._parent=t;const s=r.GetObjectReference(i[1]);this._func=s,this._displayNumber=i[2],this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber),this._debugData=r.IsDebug()?{isBreakpoint:i[3][0],isBreakable:i[3][1]}:null}static Create(e,t,i){return C3.New(C3.EventScript,e,t,i)}_PostInit(){const e=this._func,t=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this);this._func=e.bind(null,this._runtime.GetIRuntime(),t)}GetParent(){return this._parent}GetScopeParent(){return this._parent}GetEventSheet(){return this._eventSheet}GetDisplayNumber(){return this._displayNumber}IsDebugBreakable(){return this._debugData&&this._debugData.isBreakable}IsDebugBreakpoint(){return this.IsDebugBreakable()&&this._debugData.isBreakpoint}_SetDebugBreakpoint(e){this._debugData.isBreakpoint=!!e}IsElseBlock(){return!1}GetSolModifiers(){return EMPTY_SOL_MODIFIERS}GetSolModifiersIncludingParents(){return this._parent?this._parent.GetSolModifiersIncludingParents():EMPTY_SOL_MODIFIERS}Run(e){e.SetCurrentEvent(this),this._eventSheetManager.AddAsyncActionPromise(this._RunUserScript())}async _RunUserScript(){try{await this._func()}catch(e){console.error(`Unhandled exception running script %c${this.GetEventSheet().GetName()}, event ${this.GetDisplayNumber()}:`,"font-size: 1.2em; font-weight: bold;",e),self.C3Debugger&&self.C3Debugger._SetLastErrorScript(this),hadUserScriptException||(console.info("%cTip:%c run this to highlight in Construct the last script that had an error: %cgoToLastErrorScript()","font-weight: bold; text-decoration: underline","","font-weight: bold"),hadUserScriptException=!0)}}*DebugRun(e){e.SetCurrentEvent(this),(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())&&(yield this),this.Run(e)}DebugCanRunFast(){return!this.IsDebugBreakpoint()&&!this._runtime.DebugBreakNext()}static HadUserScriptException(){return hadUserScriptException}static SetHadUserScriptException(){hadUserScriptException=!0}}; } // events/functionBlock.js { const C3=self.C3,assert=self.assert;C3.FunctionBlock=class extends C3.DefendedBase{constructor(t,e,s){super(),this._eventSheet=t,this._runtime=t.GetRuntime(),this._parent=e,this._functionType=0,this._functionName="",this._returnType=0,this._functionParameters=[],this._isEnabled=!0,this._aceName="",this._objectClass=null,this._hasOverrides=!1,this._innerLocalVariables=[],this._isCopyPicked=!1,this._isAsync=!1,this._nextAsyncId=0,this._currentAsyncId=-1,this._asyncMap=new Map,this._eventBlock=C3.EventBlock.Create(t,e,s),this._eventBlock._SetScopeParent(this)}InitFunctionBlock(t){this._functionType=0,this._functionName=t[0],this._returnType=t[1],this._functionParameters=t[2].map(t=>C3.EventVariable.Create(this._eventSheet,this,t)),this._isEnabled=t[3],this._isAsync=t[4],this._isCopyPicked=t[5]}InitCustomACEBlock(t){this._functionType=1,this._aceName=t[1],this._objectClass=this._runtime.GetObjectClassByIndex(t[2]),this._eventBlock._AddSolModifier(this._objectClass),this._functionName=this._objectClass.GetName()+"."+this._aceName,this._returnType=t[3],this._functionParameters=t[4].map(t=>C3.EventVariable.Create(this._eventSheet,this,t)),this._isEnabled=t[5],this._isAsync=t[6],this._isCopyPicked=t[7],this._objectClass.AddCustomAction(this)}static CreateFunctionBlock(t,e,s){const n=C3.New(C3.FunctionBlock,t,e,s),i=s[1];return n.InitFunctionBlock(i),n}static CreateCustomACEBlock(t,e,s){const n=C3.New(C3.FunctionBlock,t,e,s),i=s[1];return n.InitCustomACEBlock(i),n}_CheckOverrideState(){if(this._objectClass&&this._objectClass.IsFamily())for(const t of this._objectClass.GetFamilyMembers())if(t.HasOwnCustomActionByName(this._aceName)){this._hasOverrides=!0;break}}_PostInit(){for(const t of this._functionParameters)t._PostInit();this._eventBlock._PostInit(!1)}GetFunctionType(){return this._functionType}_GetAllLocalVariablesInScope(){return this._functionParameters}GetFunctionParameters(){return this._functionParameters}GetFunctionParameterCount(){return this._functionParameters.length}_RegisterLocalVariable(t){this._innerLocalVariables.push(t)}_GetAllInnerLocalVariables(){return this._innerLocalVariables}EvaluateFunctionParameters(t){const e=this._functionParameters;for(let s=0,n=e.length;s<n;++s)e[s].SetValue(t[s].Get(0))}SetFunctionParameters(t){const e=this._functionParameters;for(let s=0,n=e.length;s<n;++s)e[s].SetValue(t[s])}CaptureFunctionParameters(){return this._functionParameters.map(t=>t.GetValue())}GetParent(){return this._parent}GetScopeParent(){return this._parent}GetFunctionName(){return this._functionName}GetACEName(){return this._aceName}HasCustomACEOverrides(){return this._hasOverrides}GetReturnType(){return this._returnType}GetObjectClass(){return this._objectClass}IsEnabled(){return this._isEnabled}GetDefaultReturnValue(){switch(this._returnType){case 0:return null;case 2:return"";default:return 0}}GetEventBlock(){return this._eventBlock}IsCopyPicked(){return this._isCopyPicked}IsAsync(){return this._isAsync}StartAsyncFunctionCall(){const t=this._nextAsyncId++;let e;this._currentAsyncId=t;const s=new Promise(t=>e=t);return this._asyncMap.set(t,{resolve:e,pauseCount:0}),[t,s]}MaybeFinishAsyncFunctionCall(t){const e=this._asyncMap.get(t);0===e.pauseCount&&(e.resolve(),this._asyncMap.delete(t)),this._currentAsyncId=-1}PauseCurrentAsyncFunction(){return this._asyncMap.get(this._currentAsyncId).pauseCount++,this._currentAsyncId}ResumeAsyncFunction(t){this._currentAsyncId=t;this._asyncMap.get(t).pauseCount--}RunAsFamilyCustomActionWithOverrides(t,e){const s=new Map,n=[];for(const t of this._objectClass.GetCurrentSol().GetInstances()){const e=t.GetObjectClass();if(e.HasOwnCustomActionByName(this._aceName)){const n=s.get(e);Array.isArray(n)?n.push(t):s.set(e,[t])}else n.push(t)}if(n.length>0&&this._eventBlock.RunAsFunctionCall(t,e,this._isCopyPicked,{pickObjectClass:this._objectClass,pickInstances:n}),s.size>0)for(const[n,i]of s){const s=n.GetOwnCustomActionByName(this._aceName).GetEventBlock(),a=[...new Set([...t,...s.GetSolModifiers()])];s.RunAsFunctionCall(a,e,this._isCopyPicked,{pickObjectClass:n,pickInstances:i})}}*DebugRunAsFamilyCustomActionWithOverrides(t,e){const s=new Map,n=[];for(const t of this._objectClass.GetCurrentSol().GetInstances()){const e=t.GetObjectClass();if(e.HasOwnCustomActionByName(this._aceName)){const n=s.get(e);Array.isArray(n)?n.push(t):s.set(e,[t])}else n.push(t)}if(n.length>0&&(yield*this._eventBlock.DebugRunAsFunctionCall(t,e,this._isCopyPicked,{pickObjectClass:this._objectClass,pickInstances:n})),s.size>0)for(const[n,i]of s){const s=n.GetOwnCustomActionByName(this._aceName).GetEventBlock(),a=[...new Set([...t,...s.GetSolModifiers()])];yield*s.DebugRunAsFunctionCall(a,e,this._isCopyPicked,{pickObjectClass:n,pickInstances:i})}}}; } // events/eventVariable.js { const C3=self.C3,EMPTY_SOL_MODIFIERS=[];C3.EventVariable=class extends C3.DefendedBase{constructor(t,e,s){super();const i=t.GetEventSheetManager();this._eventSheet=t,this._eventSheetManager=i,this._runtime=t.GetRuntime(),this._parent=e,this._localVarStack=i.GetLocalVarStack(),this._name=s[1],this._type=s[2],this._initialValue=s[3],this._isStatic=!!s[4],this._isConstant=!!s[5],this._isFunctionParameter=e instanceof C3.FunctionBlock,this._sid=s[6],this._jsPropName=this._runtime.GetJsPropName(s[8]),this._scriptSetter=t=>this._ScriptSetValue(t),this._scriptGetter=()=>this.GetTypedValue(),this._hasSingleValue=!this._parent||this._isStatic||this._isConstant,this._value=this._initialValue,this._localIndex=-1,this.IsBoolean()&&(this._value=this._value?1:0),!this.IsLocal()||this.IsStatic()||this.IsConstant()||(this._localIndex=i._GetNextLocalVarIndex(this)),i._RegisterEventVariable(this)}static Create(t,e,s){return C3.New(C3.EventVariable,t,e,s)}_PostInit(){if(this.IsLocal()&&!this.IsStatic()&&!this.IsConstant()&&!this.IsFunctionParameter()){const t=this._eventSheetManager.FindFirstFunctionBlockParent(this);t&&t._RegisterLocalVariable(this)}}GetName(){return this._name}GetJsPropName(){return this._jsPropName}GetParent(){return this._parent}GetScopeParent(){return this.GetParent()}IsGlobal(){return!this.GetParent()}IsLocal(){return!this.IsGlobal()}IsFunctionParameter(){return this._isFunctionParameter}IsStatic(){return this._isStatic}IsConstant(){return this._isConstant}IsNumber(){return 0===this._type}IsString(){return 1===this._type}IsBoolean(){return 2===this._type}IsElseBlock(){return!1}GetSID(){return this._sid}GetInitialValue(){return this._initialValue}GetSolModifiers(){return EMPTY_SOL_MODIFIERS}Run(t){!this.IsLocal()||this.IsStatic()||this.IsConstant()||this.SetValue(this.GetInitialValue())}DebugCanRunFast(){return!0}*DebugRun(t){this.Run(t)}SetValue(t){this.IsNumber()?"number"!=typeof t&&(t=parseFloat(t)):this.IsString()?"string"!=typeof t&&(t=t.toString()):this.IsBoolean()&&(t=t?1:0),this._hasSingleValue?this._value=t:this._localVarStack.GetCurrent()[this._localIndex]=t}_ScriptSetValue(t){if(this.IsConstant())throw new Error(`assignment to constant event variable '${this.GetName()}'`);this.SetValue(t)}GetValue(){return this._hasSingleValue?this._value:this._localVarStack.GetCurrent()[this._localIndex]}GetTypedValue(){let t=this.GetValue();return this.IsBoolean()&&(t=!!t),t}ResetToInitialValue(){this._value=this._initialValue}_GetScriptInterfaceDescriptor(){return{configurable:!1,enumerable:!0,get:this._scriptGetter,set:this._scriptSetter}}}; } // events/eventInclude.js { const C3=self.C3,assert=self.assert,EMPTY_SOL_MODIFIERS=[];C3.EventInclude=class extends C3.DefendedBase{constructor(e,t,n){super();const s=e.GetEventSheetManager();this._eventSheet=e,this._eventSheetManager=s,this._runtime=e.GetRuntime(),this._parent=t,this._includeSheet=null,this._includeSheetName=n[1],this._isActive=!0}static Create(e,t,n){return C3.New(C3.EventInclude,e,t,n)}_PostInit(){this._includeSheet=this._eventSheetManager.GetEventSheetByName(this._includeSheetName),this._eventSheet._AddShallowInclude(this);let e=this.GetParent();for(;e;)e instanceof C3.EventBlock&&e.IsGroup()&&e._AddContainedInclude(this),e=e.GetParent();this.UpdateActive(),this._runtime.IsDebug()&&this._eventSheet._GetPerfRecord().children.push(this._includeSheet._GetPerfRecord())}GetParent(){return this._parent}GetSolModifiers(){return EMPTY_SOL_MODIFIERS}GetIncludeSheet(){return this._includeSheet}Run(e){const t=!!this.GetParent(),n=this._runtime.GetAllObjectClasses();t&&this._eventSheetManager.PushCleanSol(n),this._includeSheet.Run(),t&&this._eventSheetManager.PopSol(n)}*DebugRun(e){const t=!!this.GetParent(),n=this._runtime.GetAllObjectClasses();t&&this._eventSheetManager.PushCleanSol(n),yield*this._includeSheet.DebugRun(),t&&this._eventSheetManager.PopSol(n)}DebugCanRunFast(){return!1}IsActive(){return this._isActive}UpdateActive(){let e=this.GetParent();for(;e;){if(e instanceof C3.EventBlock&&e.IsGroup()&&!e.IsGroupActive())return void(this._isActive=!1);e=e.GetParent()}this._isActive=!0}}; } // events/expNode.js { const C3=self.C3,assert=self.assert;C3.ExpNode=class extends C3.DefendedBase{constructor(e){super(),this._owner=e,this._runtime=e.GetRuntime()}_PostInit(){}static CreateNode(e,t){const s=t[0],n=[BehaviorExpressionNode,ObjectExpressionNode,InstVarExpressionNode,EventVarExpNode,SystemExpressionExpNode,CallFunctionExpressionExpNode];return C3.New(n[s],e,t)}};class SystemExpressionExpNode extends C3.ExpNode{constructor(e,t){super(e),this._systemPlugin=this._runtime.GetSystemPlugin(),this._func=this._runtime.GetObjectReference(t[1]),this._func!==C3.Plugins.System.Exps.random&&this._func!==C3.Plugins.System.Exps.choose||this._owner.SetVariesPerInstance()}GetBoundMethod(){return this._systemPlugin._GetBoundACEMethod(this._func,this._systemPlugin)}}class CallFunctionExpressionExpNode extends C3.ExpNode{constructor(e,t){super(e),this._functionBlock=null,this._functionName=t[1],this._owner.SetVariesPerInstance()}_PostInit(){const e=this._runtime.GetEventSheetManager();this._functionBlock=e.GetFunctionBlockByName(this._functionName),this._functionName=null;const t=this._owner.GetEventBlock(),s=this._functionBlock.GetEventBlock();this._combinedSolModifiers=[...new Set([...t.GetSolModifiersIncludingParents(),...s.GetSolModifiersIncludingParents()])],this._combinedSolModifiers=e._DeduplicateSolModifierList(this._combinedSolModifiers)}GetBoundMethod(){const e=this._functionBlock;if(e.IsEnabled()){const t=e.GetEventBlock();return C3.EventBlock.prototype.RunAsExpressionOrJSFunctionCall.bind(t,this._combinedSolModifiers,e.IsCopyPicked(),e.GetReturnType(),e.GetDefaultReturnValue(),null)}{const t=e.GetDefaultReturnValue();return()=>t}}}function WrapIndex(e,t){return e>=t?e%t:e<0?(e<=-t&&(e%=t),e<0&&(e+=t),e):e}class ObjectExpressionNode extends C3.ExpNode{constructor(e,t){super(e),this._objectClass=this._runtime.GetObjectClassByIndex(t[1]),this._func=this._runtime.GetObjectReference(t[2]),this._returnsString=!!t[3],this._eventStack=this._runtime.GetEventSheetManager().GetEventStack(),this._owner._MaybeVaryFor(this._objectClass)}GetBoundMethod(){return this._objectClass.GetPlugin()._GetBoundACEMethod(this._func,this._objectClass.GetSingleGlobalInstance().GetSdkInstance())}ExpObject(...e){const t=this._objectClass,s=t.GetCurrentSol().GetExpressionInstances(),n=s.length;if(0===n)return this._returnsString?"":0;const r=WrapIndex(this._owner.GetSolIndex(),n);return this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(t),this._func.apply(s[r].GetSdkInstance(),e)}ExpObject_InstExpr(e,...t){const s=this._objectClass,n=s.GetInstances(),r=n.length;if(0===r||"number"!=typeof e)return this._returnsString?"":0;const i=WrapIndex(e,r);return this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(s),this._func.apply(n[i].GetSdkInstance(),t)}}class InstVarExpressionNode extends C3.ExpNode{constructor(e,t){super(e),this._objectClass=this._runtime.GetObjectClassByIndex(t[1]),this._varIndex=t[3],this._returnsString=!!t[2],this._owner._MaybeVaryFor(this._objectClass)}ExpInstVar(){const e=this._objectClass.GetCurrentSol().GetExpressionInstances(),t=e.length;if(0===t)return this._returnsString?"":0;return e[WrapIndex(this._owner.GetSolIndex(),t)]._GetInstanceVariableValueUnchecked(this._varIndex)}ExpInstVar_Family(){const e=this._objectClass,t=e.GetCurrentSol().GetExpressionInstances(),s=t.length;if(0===s)return this._returnsString?"":0;const n=t[WrapIndex(this._owner.GetSolIndex(),s)],r=n.GetObjectClass().GetFamilyInstanceVariableOffset(e.GetFamilyIndex());return n._GetInstanceVariableValueUnchecked(this._varIndex+r)}ExpInstVar_InstExpr(e){const t=this._objectClass,s=t.GetInstances(),n=s.length;if(0===n||"number"!=typeof e)return this._returnsString?"":0;const r=s[WrapIndex(e,n)];let i=0;return t.IsFamily()&&(i=r.GetObjectClass().GetFamilyInstanceVariableOffset(t.GetFamilyIndex())),r._GetInstanceVariableValueUnchecked(this._varIndex+i)}}class BehaviorExpressionNode extends C3.ExpNode{constructor(e,t){super(e),this._objectClass=this._runtime.GetObjectClassByIndex(t[1]),this._behaviorType=this._objectClass.GetBehaviorTypeByName(t[2]),this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(t[2]),this._func=this._runtime.GetObjectReference(t[3]),this._returnsString=!!t[4],this._eventStack=this._runtime.GetEventSheetManager().GetEventStack(),this._owner._MaybeVaryFor(this._objectClass)}ExpBehavior(...e){const t=this._objectClass,s=t.GetCurrentSol().GetExpressionInstances(),n=s.length;if(0===n)return this._returnsString?"":0;const r=WrapIndex(this._owner.GetSolIndex(),n);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(t);const i=s[r];let o=0;return t.IsFamily()&&(o=i.GetObjectClass().GetFamilyBehaviorOffset(t.GetFamilyIndex())),this._func.apply(i.GetBehaviorInstances()[this._behaviorIndex+o].GetSdkInstance(),e)}ExpBehavior_InstExpr(e,...t){const s=this._objectClass,n=s.GetInstances(),r=n.length;if(0===r||"number"!=typeof e)return this._returnsString?"":0;const i=WrapIndex(e,r);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(s);const o=n[i];let a=0;return s.IsFamily()&&(a=o.GetObjectClass().GetFamilyBehaviorOffset(s.GetFamilyIndex())),this._func.apply(o.GetBehaviorInstances()[this._behaviorIndex+a].GetSdkInstance(),t)}}class EventVarExpNode extends C3.ExpNode{constructor(e,t){super(e),this._eventVar=null,this._eventVarSid=t[1]}_PostInit(){this._eventVar=this._runtime.GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetVar(){return this._eventVar}} } // events/parameter.js { const C3=self.C3,assert=self.assert;function GetExpressionFunc(t){const e=self.C3_ExpressionFuncs[t];if(!e)throw new Error("invalid expression number");return e}C3.Parameter=class extends C3.DefendedBase{constructor(t,e,s){super(),this._owner=t,this._index=s,this._type=e,this.Get=null,this._variesPerInstance=!1,this._isConstant=!1}static Create(t,e,s){const r=e[0],n=[ExpressionParameter,StringExpressionParameter,FileParameter,ComboParameter,ObjectParameter,LayerExpressionParameter,LayoutParameter,ExpressionParameter,ComboParameter,ComboParameter,InstVarParameter,EventVarParameter,FileParameter,VariadicParameter,StringExpressionParameter,TimelineParameter,BooleanParameter,FunctionParameter,EaseParameter,TilemapBrushParameter,TemplateExpressionParameter,FlowchartParameter,Model3dParameter];return C3.New(n[r],t,r,s,e)}_PostInit(){}SetVariesPerInstance(){this._variesPerInstance=!0}_MaybeVaryFor(t){this._variesPerInstance||t&&(t.GetPlugin().IsSingleGlobal()||(this._variesPerInstance=!0))}VariesPerInstance(){return this._variesPerInstance}GetIndex(){return this._index}GetRuntime(){return this._owner.GetRuntime()}GetEventBlock(){return this._owner.GetEventBlock()}IsConstant(){return this._isConstant}IsObjectParameter(){return 4===this._type}};class ExpressionParameter extends C3.Parameter{constructor(t,e,s,r){super(t,e,s),this._solIndex=0;const n=r[1];this._expressionNumber=n[0],this._numberedNodes=[],this._expressionFunc=null;for(let t=1,e=n.length;t<e;++t)this._numberedNodes.push(C3.ExpNode.CreateNode(this,n[t]));this._numberedNodes.length?this.Get=this.GetExpression:(this.Get=GetExpressionFunc(this._expressionNumber),this._isConstant=!0)}_GetNode(t){if(t<0||t>=this._numberedNodes.length)throw new RangeError("invalid numbered node");return this._numberedNodes[t]}_PostInit(){for(const t of this._numberedNodes)t._PostInit();const t=GetExpressionFunc(this._expressionNumber);this._numberedNodes.length?this._expressionFunc=t(this):this._expressionFunc=t}GetSolIndex(){return this._solIndex}GetExpression(t){return this._solIndex=t,this._expressionFunc()}}class StringExpressionParameter extends ExpressionParameter{constructor(t,e,s,r){super(t,e,s,r),this.Get=this.GetStringExpression,14===e&&(this.GetEventBlock().SetAllSolModifiers(),this._owner instanceof C3.Action&&this.GetEventBlock().SetSolWriterAfterCnds())}GetStringExpression(t){this._solIndex=t;const e=this._expressionFunc();return"string"==typeof e?e:""}_GetFastTriggerValue(){return GetExpressionFunc(this._expressionNumber)()}}class LayerExpressionParameter extends ExpressionParameter{constructor(t,e,s,r){super(t,e,s,r),t.GetImplementationSdkVersion()>=2?this.Get=this.GetILayer:this.Get=this.GetLayer,this._isConstant=!1}GetLayer(t){this._solIndex=t;const e=this._expressionFunc();return this.GetRuntime().GetCurrentLayout().GetLayer(e)}GetILayer(t){const e=this.GetLayer(t);return e?e.GetILayer():null}}class ComboParameter extends C3.Parameter{constructor(t,e,s,r){super(t,e,s),this._combo=r[1],this.Get=this.GetCombo,this._isConstant=!0}GetCombo(){return this._combo}}class BooleanParameter extends C3.Parameter{constructor(t,e,s,r){super(t,e,s),this._bool=r[1],this.Get=this.GetBoolean,this._isConstant=!0}GetBoolean(){return this._bool}}class ObjectParameter extends C3.Parameter{constructor(t,e,s,r){super(t,e,s),this._objectClass=this.GetRuntime().GetObjectClassByIndex(r[1]),t.GetImplementationSdkVersion()>=2?this.Get=this.GetIObjectClass:this.Get=this.GetObjectClass;const n=this.GetEventBlock();n._AddSolModifier(this._objectClass),this._owner instanceof C3.Action?n.SetSolWriterAfterCnds():n.GetParent()&&n.GetParent().SetSolWriterAfterCnds(),this._isConstant=!0}GetObjectClass(){return this._objectClass}GetIObjectClass(){return this._objectClass?this._objectClass.GetIObjectClass():null}}class LayoutParameter extends C3.Parameter{constructor(t,e,s,r){super(t,e,s),this._layout=this.GetRuntime().GetLayoutManager().GetLayoutByName(r[1]),t.GetImplementationSdkVersion()>=2?this.Get=this.GetILayout:this.Get=this.GetLayout,this._isConstant=!0}GetLayout(){return this._layout}GetILayout(){return this._layout?this._layout.GetILayout():null}}class TimelineParameter extends C3.Parameter{constructor(t,e,s,r){super(t,e,s),this._timeline=this.GetRuntime().GetTimelineManager().GetTimelineByName(r[1]),t.GetImplementationSdkVersion()>=2?this.Get=this.GetITimelineState:this.Get=this.GetTimeline,this._isConstant=!0}GetTimeline(){return this._timeline}GetITimelineState(){return this._timeline?this._timeline.GetITimelineState():null}}class FileParameter extends C3.Parameter{constructor(t,e,s,r){super(t,e,s),this._fileInfo=r[1],this.Get=this.GetFile,this._isConstant=!0}GetFile(){return this._fileInfo}}class InstVarParameter extends C3.Parameter{constructor(t,e,s,r){super(t,e,s),this._instVarIndex=r[1];const n=this._owner.GetObjectClass();this._owner instanceof C3.Condition&&this._owner.IsStatic()?(this.Get=this.GetInstanceVariable,this._isConstant=!0):n&&n.IsFamily()?(this.Get=this.GetFamilyInstanceVariable,this.SetVariesPerInstance()):(this.Get=this.GetInstanceVariable,this._isConstant=!0)}GetInstanceVariable(){return this._instVarIndex}GetFamilyInstanceVariable(t){t=t||0;const e=this._owner.GetObjectClass(),s=e.GetCurrentSol(),r=s.GetInstances();let n=null;if(r.length)n=r[t%r.length].GetObjectClass();else if(s.HasAnyElseInstances()){const e=s.GetElseInstances();n=e[t%e.length].GetObjectClass()}else{if(!(e.GetInstanceCount()>0))return 0;{const s=e.GetInstances();n=s[t%s.length].GetObjectClass()}}return this._instVarIndex+n.GetFamilyInstanceVariableOffset(e.GetFamilyIndex())}}class EventVarParameter extends C3.Parameter{constructor(t,e,s,r){super(t,e,s),this._eventVarSid=r[1],this._eventVar=null,t.GetImplementationSdkVersion()>=2?this.Get=this.GetIEventVariable:this.Get=this.GetEventVariable,this._isConstant=!0}_PostInit(){this._eventVar=this.GetRuntime().GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetEventVariable(){return this._eventVar}GetIEventVariable(){return null}}class FunctionParameter extends C3.Parameter{constructor(t,e,s,r){super(t,e,s),this._functionBlockName=r[1],this._functionBlock=null,t.GetImplementationSdkVersion()>=2?this.Get=this.GetIFunction:this.Get=this.GetFunction,this._isConstant=!0}_PostInit(){this._functionBlock=this.GetRuntime().GetEventSheetManager().GetFunctionBlockByName(this._functionBlockName),this._functionBlockName=null}GetFunction(){return this._functionBlock}GetIFunction(){return null}}class VariadicParameter extends C3.Parameter{constructor(t,e,s,r){super(t,e,s),this._subParams=[],this._variadicRet=[],this._isConstant=!0;for(let t=1,e=r.length;t<e;++t){const e=C3.Parameter.Create(this._owner,r[t],0);this._subParams.push(e),this._variadicRet.push(0),e.IsConstant()||(this._isConstant=!1)}this.Get=this.GetVariadic}_PostInit(){for(const t of this._subParams)t._PostInit()}GetVariadic(){const t=this._subParams,e=this._variadicRet;for(let s=0,r=t.length;s<r;++s)e[s]=t[s].Get(0);return e}}class EaseParameter extends C3.Parameter{constructor(t,e,s,r){super(t,e,s),this._easeIndex=r[1],this.Get=this.GetEase,this._isConstant=!0}GetEase(){return this._easeIndex}}class TilemapBrushParameter extends C3.Parameter{constructor(t,e,s,r){super(t,e,s),this._brushIndex=r[1],this.Get=this.GetTilemapBrush,this._isConstant=!0}GetTilemapBrush(){return this._brushIndex}}class TemplateExpressionParameter extends ExpressionParameter{constructor(t,e,s,r){super(t,e,s,r),this.Get=this.GetTemplateName,this._isConstant=!1}GetTemplateName(){return this._expressionFunc()}}class FlowchartParameter extends C3.Parameter{constructor(t,e,s,r){super(t,e,s),this._flowchartDataItem=this.GetRuntime().GetFlowchartManager().GetFlowchartDataItemByName(r[1]),this.Get=this.GetFlowchartName,this._isConstant=!0}GetFlowchartName(){return this._flowchartDataItem.GetName()}}class Model3dParameter extends C3.Parameter{constructor(t,e,s,r){super(t,e,s),this._model3dDataItem=this.GetRuntime().GetModel3dManager().GetModel3dDataItemByName(r[1]),this.Get=this.GetModel3dName,this._isConstant=!0}GetModel3dName(){return this._model3dDataItem.GetName()}} } // events/condition.js { const C3=self.C3,assert=self.assert;function EvalParams(t,e){for(let s=0,n=t.length;s<n;++s)e[s]=t[s].Get(0)}const EMPTY_PARAMS_ARRAY=[],noop=function(){};C3.Condition=class extends C3.DefendedBase{co … [Строка слишком длинная. Вы можете скачать файл] } // events/action.js { const C3=self.C3,assert=self.assert;function EvalParams(t,e){for(let s=0,n=t.length;s<n;++s)e[s]=t[s].Get(0)}const EMPTY_PARAMS_ARRAY=[],noop=function(){},noopGenerator=function*(){},FLAG_CANPICKANYOB … [Строка слишком длинная. Вы можете скачать файл] } // events/commonACEs.js { const C3=self.C3,tempColor=new C3.Color,AnySDK={},SDKv1={},SDKv2={};let runtime=null;C3.CommonACES_SetRuntime=function(t){runtime=t};const IInstance=self.IInstance,IObjectClass=self.IObjectClass,ILaye … [Строка слишком длинная. Вы можете скачать файл] } // events/scheduledWait.js { const C3=self.C3;C3.ScheduledWait=class extends C3.DefendedBase{constructor(t){super(),this._eventSheetManager=t,this._type="",this._time=-1,this._signalTag="",this._isSignalled=!1,this._event=null,this._actIndex=0,this._triggerDepth=0,this._solModifiers=[],this._dynamicSolModifiers=null,this._sols=new Map,this._pendingInstances=null,this._callingFunctionBlock=null,this._asyncId=-1,this._functionParameters=null,this._functionInnerLocalVars=null,this._shouldRelease=!1}Release(){this._type="",this._time=-1,this._signalTag="",this._event=null,this._callingFunctionBlock=null,this._functionParameters=null,this._functionInnerLocalVars=null,this._asyncId=-1,C3.clearArray(this._solModifiers),this._dynamicSolModifiers&&(this._dynamicSolModifiers.clear(),this._dynamicSolModifiers=null);for(const t of this._sols.values())t.Release();this._sols.clear(),this._pendingInstances=null}_Init(){const t=this._eventSheetManager,e=t.GetRuntime().GetAllObjectClasses(),s=t.GetCurrentEventStackFrame();this._event=s.GetCurrentEvent(),this._actIndex=s.GetActionIndex()+1,this._triggerDepth=t.GetTriggerDepth();const i=t.FindFirstFunctionBlockParent(this._event);i&&(this._callingFunctionBlock=i,this._functionParameters=i.CaptureFunctionParameters(),this._functionInnerLocalVars=i._GetAllInnerLocalVariables().map(t=>t.GetValue()),i.IsAsync()&&(this._asyncId=i.PauseCurrentAsyncFunction()));for(const t of e){const e=t.GetCurrentSol();e.IsSelectAll()&&!this._event.HasSolModifier(t)||(this._solModifiers.push(t),this._sols.set(t,C3.New(C3.SolState,e)))}const n=t.GetDynamicSolModifiersSet();this._dynamicSolModifiers=n.size>0?n:null}InitTimer(t){this._type="timer",this._Init(),this._time=this._eventSheetManager.GetRuntime().GetGameTime()+t}InitWallTimer(t){this._type="walltimer",this._Init(),this._time=this._eventSheetManager.GetRuntime().GetWallTime()+t}InitSignal(t){this._type="signal",this._Init(),this._signalTag=t.toLowerCase()}InitInstanceSignals(t,e){this._type="instance-signals",this._Init(),this._signalTag=e.toLowerCase(),this._pendingInstances=new Set(t)}InitPromise(t){this._type="promise",this._Init(),t.then(()=>this.SetSignalled()).catch(t=>{console.warn("[C3 runtime] Promise rejected in 'Wait for previous actions to complete': ",t),this.SetSignalled()})}IsTimer(){return"timer"===this._type}IsWallTimer(){return"walltimer"===this._type}IsSignal(){return"signal"===this._type}IsInstanceSignals(){return"instance-signals"===this._type}IsPromise(){return"promise"===this._type}GetSignalTag(){return this._signalTag}IsSignalled(){return this._isSignalled}SetSignalled(){this._isSignalled=!0}SetInstanceSignalled(t){this._pendingInstances.delete(t),0===this._pendingInstances.size&&this.SetSignalled()}_ShouldRun(){return this.IsTimer()?this._time<=this._eventSheetManager.GetRuntime().GetGameTime():this.IsWallTimer()?this._time<=this._eventSheetManager.GetRuntime().GetWallTime():this.IsSignalled()}_RestoreState(t){t._Restore(this._event,this._actIndex),this._eventSheetManager._SetTriggerDepth(this._triggerDepth);for(const[t,e]of this._sols.entries()){const s=t.GetCurrentSol();e._Restore(s)}this._dynamicSolModifiers&&t.SetDynamicSolModifiers([...this._dynamicSolModifiers]);const e=this._callingFunctionBlock;e&&(e.SetFunctionParameters(this._functionParameters),e._GetAllInnerLocalVariables().map((t,e)=>t.SetValue(this._functionInnerLocalVars[e])),e.IsAsync()&&e.ResumeAsyncFunction(this._asyncId))}_Run(t){this._RestoreState(t),this._event._ResumeActionsAndSubEvents(t),this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync()&&this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId),this._eventSheetManager.ClearSol(this._solModifiers),this._shouldRelease=!0}async _DebugRun(t){this._RestoreState(t);for(const e of this._event._DebugResumeActionsAndSubEvents(t))await this._eventSheetManager.GetRuntime().DebugBreak(e);this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync()&&this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId),this._eventSheetManager.ClearSol(this._solModifiers),this._shouldRelease=!0}ShouldRelease(){return this._shouldRelease}RemoveInstances(t){for(const e of this._sols.values())e.RemoveInstances(t);if("instance-signals"===this._type){for(const e of t)this._pendingInstances.delete(e);0===this._pendingInstances.size&&this.SetSignalled()}}_SaveToJson(){const t={},e={"wt":this._type,"t":this._time,"st":this._signalTag,"s":this._isSignalled,"ev":this._event.GetSID(),"sm":this._solModifiers.map(t=>t.GetSID()),"dsm":this._dynamicSolModifiers?[...this._dynamicSolModifiers].map(t=>t.GetSID()):null,"sols":t};this._event._HasActionIndex(this._actIndex)&&(e["act"]=this._event.GetActionAt(this._actIndex).GetSID());for(const[e,s]of this._sols)t[e.GetSID().toString()]=s._SaveToJson();return"instance-signals"===this._type&&(e["pi"]=[...this._pendingInstances].map(t=>t.GetUID())),e}static _CreateFromJson(t,e){const s=t.GetRuntime(),i=t.GetEventBlockBySID(e["ev"]);if(!i)return null;let n=0;if(e.hasOwnProperty("act")){const s=t.GetActionBySID(e["act"]);if(!s)return null;n=s.GetIndex()}const a=C3.New(C3.ScheduledWait,t);a._time=e["t"],e.hasOwnProperty("wt")?a._type=e["wt"]:a._type=-1===a._time?"signal":"timer",a._signalTag=e["st"],a._isSignalled=e["s"],a._event=i,a._actIndex=n;for(const t of e["sm"]){const e=s.GetObjectClassBySID(t);e&&a._solModifiers.push(e)}if(Array.isArray(e["dsm"]))for(const t of e["dsm"]){const e=s.GetObjectClassBySID(t);e&&(a._dynamicSolModifiers||(a._dynamicSolModifiers=new Set),a._dynamicSolModifiers.add(e))}for(const[i,n]of Object.entries(e["sols"])){const e=parseInt(i,10),l=s.GetObjectClassBySID(e);if(!l)continue;const o=C3.New(C3.SolState,null);o._LoadFromJson(t,n),a._sols.set(l,o)}if("instance-signals"===a._type){a._pendingInstances=new Set;for(const t of e["pi"]){const e=s.GetInstanceByUID(t);e&&a._pendingInstances.add(e)}}return a}}; } // events/solState.js { const C3=self.C3;C3.SolState=class extends C3.DefendedBase{constructor(s){super(),this._objectClass=null,this._isSelectAll=!0,this._instances=[],s&&(this._objectClass=s.GetObjectClass(),this._isSelectAll=s.IsSelectAll(),C3.shallowAssignArray(this._instances,s._GetOwnInstances()))}Release(){this._objectClass=null,C3.clearArray(this._instances)}_Restore(s){s._SetSelectAll(this._isSelectAll),C3.shallowAssignArray(s._GetOwnInstances(),this._instances)}RemoveInstances(s){C3.arrayRemoveAllInSet(this._instances,s)}_SaveToJson(){return{"sa":this._isSelectAll,"insts":this._instances.map(s=>s.GetUID())}}_LoadFromJson(s,e){const t=s.GetRuntime();this._isSelectAll=!!e["sa"],C3.clearArray(this._instances);for(const s of e["insts"]){const e=t.GetInstanceByUID(s);e&&this._instances.push(e)}}}; } // sdk/sdkPluginBase.js { const C3=self.C3;function GetNextParamMap(t,e){let s=t.get(e);return s||(s=new Map,t.set(e,s)),s}C3.SDKPluginBase=class extends C3.DefendedBase{#t=!1;#e=!1;constructor(t){super(),this._runtime=t.runtime,this._id=t.id,this._name=t.name??"",this._isSingleGlobal=!!t.isSingleGlobal,this._isWorldType=!!t.isWorld,this._isRotatable=!!t.isRotatable,this._mustPredraw=!!t.mustPredraw,this._hasEffects=!!t.hasEffects,this._supportsSceneGraph=!!t.supportsSceneGraph,this._supportsMesh=!!t.supportsMesh,this._isHTMLElementType=!!t.isHTMLElementType,this._is3d=!!t.is3d,this._sdkVersion=t.sdkVersion,this.#t=t.supportsZElevation,this.#e=t.supportsChangingSampling,this._exportData=t.exportData,this._singleGlobalObjectClass=null,this._boundACEMethodCache=new Map,this._boundACEMethodCache_1param=new Map,this._boundACEMethodCache_2params=new Map,this._boundACEMethodCache_3params=new Map,this._scriptInterfaceClass=t.scriptInterfaceClass,this._iPlugin=null}Release(){this._runtime=null}GetRuntime(){return this._runtime}GetID(){return this._id}GetName(){return this._name}OnCreate(){}GetConstructor(){return this.GetSdkVersion()>=2?this._iPlugin.constructor:this.constructor}GetSdkVersion(){return this._sdkVersion}GetScriptInterfaceClass(t=!1){let e=this._scriptInterfaceClass;return t&&"function"!=typeof e&&this.GetSdkVersion()>=2&&(e=globalThis.ISDKPluginBase),e}GetExportData(){return this._exportData}IsSingleGlobal(){return this._isSingleGlobal}IsWorldType(){return this._isWorldType}IsHTMLElementType(){return this._isHTMLElementType}Is3D(){return this._is3d}IsRotatable(){return this._isRotatable}MustPreDraw(){return this._mustPredraw}HasEffects(){return this._hasEffects}SupportsSceneGraph(){return this._supportsSceneGraph}SupportsMesh(){return this._supportsMesh}SupportsZElevation(){return this.#t}SupportsChangingSampling(){return this.#e}_GetBoundACEMethod(t,e){if(!e)throw new Error("missing 'this' binding");let s=this._boundACEMethodCache.get(t);return s||(s=t.bind(e),this._boundACEMethodCache.set(t,s),s)}_GetBoundACEMethod_1param(t,e,s){if(!e)throw new Error("missing 'this' binding");const i=GetNextParamMap(this._boundACEMethodCache_1param,t);let n=i.get(s);return n||(n=t.bind(e,s),i.set(s,n),n)}_GetBoundACEMethod_2params(t,e,s,i){if(!e)throw new Error("missing 'this' binding");const n=GetNextParamMap(this._boundACEMethodCache_2params,t),r=GetNextParamMap(n,s);let a=r.get(i);return a||(a=t.bind(e,s,i),r.set(i,a),a)}_GetBoundACEMethod_3params(t,e,s,i,n){if(!e)throw new Error("missing 'this' binding");const r=GetNextParamMap(this._boundACEMethodCache_3params,t),a=GetNextParamMap(r,s),o=GetNextParamMap(a,i);let l=o.get(n);return l||(l=t.bind(e,s,i,n),o.set(n,l),l)}_SetSingleGlobalObjectClass(t){if(!this.IsSingleGlobal())throw new Error("must be single-global plugin");this._singleGlobalObjectClass=t}GetSingleGlobalObjectClass(){if(!this.IsSingleGlobal())throw new Error("must be single-global plugin");return this._singleGlobalObjectClass}GetSingleGlobalInstance(){if(!this.IsSingleGlobal())throw new Error("must be single-global plugin");return this._singleGlobalObjectClass.GetSingleGlobalInstance()}_InitScriptInterface(){const t=this.GetSdkVersion();C3.AddonManager._PushInitObject(this,t);const e=this.GetScriptInterfaceClass(!0);if(e){if(this._iPlugin=new e,!(this._iPlugin instanceof self.IPlugin))throw new TypeError("plugin class must derive from IPlugin")}else this._iPlugin=new self.IPlugin;C3.AddonManager._PopInitObject(t)}GetIPlugin(){return this._iPlugin}}; } // sdk/sdkDOMPluginBase.js { const C3=self.C3;C3.SDKDOMPluginBase=class extends C3.SDKPluginBase{constructor(e,s){super(e),this._domComponentId=s,this._nextElementId=0,this._instMap=new Map,this.AddElementMessageHandler("elem-focused",e=>e._OnElemFocused()),this.AddElementMessageHandler("elem-blurred",e=>{e&&e._OnElemBlurred()})}Release(){super.Release()}_AddElement(e){const s=this._nextElementId++;return this._instMap.set(s,e),s}_RemoveElement(e){this._instMap.delete(e)}AddElementMessageHandler(e,s){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,e,e=>{const t=this._instMap.get(e["elementId"]);s(t,e)})}}; } // sdk/sdkTypeBase.js { const C3=self.C3;C3.SDKTypeBase=class extends C3.DefendedBase{constructor(e){super(),this._objectClass=e,this._runtime=e.GetRuntime(),this._plugin=e.GetPlugin()}Release(){this._objectClass=null,this._runtime=null,this._plugin=null}GetObjectClass(){return this._objectClass}GetRuntime(){return this._runtime}GetPlugin(){return this._plugin}GetImageInfo(){return this._objectClass.GetImageInfo()}OnCreate(){}FinishCondition(e){}BeforeRunAction(e){}AfterRunAction(e){}LoadTextures(e){}ReleaseTextures(){}ReleaseUnusedTextures(){}OnDynamicTextureLoadComplete(){}PreloadTexturesWithInstances(e){}LoadTilemapData(){}GetScriptInterfaceClass(){return null}DispatchScriptEvent(e,t,s){const n=C3.New(C3.Event,e,t);n.objectClass=this,s&&Object.assign(n,s),this.GetObjectClass().DispatchUserScriptEvent(n)}}; } // sdk/sdkInstanceBase.js { const C3=self.C3;C3.SDKInstanceBase=class extends C3.DefendedBase{constructor(e,t){super(),this._inst=e,this._domComponentId=t,this._wrapperComponentId=null,this._runtime=e.GetRuntime(),this._objectClass=this._inst.GetObjectClass(),this._sdkType=this._objectClass.GetSdkType(),this._tickFunc=null,this._tick2Func=null,this._isTicking=!1,this._isTicking2=!1,this._disposables=null,this._wasReleased=!1}Release(){this._wasReleased=!0,this._StopTicking(),this._StopTicking2(),this._tickFunc=null,this._tick2Func=null,this._disposables&&(this._disposables.Release(),this._disposables=null),this._inst=null,this._runtime=null,this._objectClass=null,this._sdkType=null}WasReleased(){return this._wasReleased}GetInstance(){return this._inst}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetPlugin(){return this._sdkType.GetPlugin()}GetSdkType(){return this._sdkType}GetScriptInterface(){return this._inst.GetInterfaceClass()}Trigger(e){return this._runtime.Trigger(e,this._inst,null)}DebugTrigger(e){return this._runtime.DebugTrigger(e,this._inst,null)}TriggerAsync(e){return this._runtime.TriggerAsync(e,this._inst,null)}FastTrigger(e,t){return this._runtime.FastTrigger(e,this._inst,t)}DebugFastTrigger(e,t){return this._runtime.DebugFastTrigger(e,this._inst,t)}ScheduleTriggers(e){return this._runtime.ScheduleTriggers(e)}AddDOMMessageHandler(e,t){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,e,t)}AddDOMMessageHandlers(e){for(const[t,i]of e)this.AddDOMMessageHandler(t,i)}PostToDOM(e,t){this._runtime.PostComponentMessageToDOM(this._domComponentId,e,t)}PostToDOMAsync(e,t){return this._runtime.PostComponentMessageToDOMAsync(this._domComponentId,e,t)}_PostToDOMMaybeSync(e,t){if(!this._runtime.IsInWorker())return window["c3_runtimeInterface"]["_OnMessageFromRuntime"]({"type":"event","component":this._domComponentId,"handler":e,"data":t,"responseId":null});this.PostToDOM(e,t)}SetWrapperExtensionComponentId(e){if(!e)throw new Error("cannot set empty component id");this._wrapperComponentId=e}IsWrapperExtensionAvailable(){if(!this._wrapperComponentId)throw new Error("wrapper extension component id not set");return this._runtime.HasWrapperComponentId(this._wrapperComponentId)}AddWrapperExtensionMessageHandler(e,t){if(!this._wrapperComponentId)throw new Error("wrapper extension component id not set");this._runtime.AddWrapperExtensionMessageHandler(this._wrapperComponentId,e,t)}AddWrapperExtensionMessageHandlers(e){for(const[t,i]of e)this.AddWrapperExtensionMessageHandler(t,i)}SendWrapperExtensionMessage(e,t){if(!this._wrapperComponentId)throw new Error("wrapper extension component id not set");this._runtime.SendWrapperExtensionMessage(this._wrapperComponentId,e,t)}SendWrapperExtensionMessageAsync(e,t){if(!this._wrapperComponentId)throw new Error("wrapper extension component id not set");return this._runtime.SendWrapperExtensionMessageAsync(this._wrapperComponentId,e,t)}Tick(){}Tick2(){}_StartTicking(){if(!this._isTicking){if(!this._tickFunc)if(this._runtime.IsDebug()){const e=globalThis.C3Debugger,t=this.GetPlugin();this._tickFunc=()=>{const i=performance.now();this.Tick(),e.AddIndividualPluginTickTime(t,performance.now()-i)}}else this._tickFunc=()=>this.Tick();this._runtime.Dispatcher().addEventListener("tick",this._tickFunc),this._isTicking=!0}}_StopTicking(){this._isTicking&&(this._runtime.Dispatcher().removeEventListener("tick",this._tickFunc),this._isTicking=!1)}IsTicking(){return this._isTicking}_StartTicking2(){if(!this._isTicking2){if(!this._tick2Func)if(this._runtime.IsDebug()){const e=globalThis.C3Debugger,t=this.GetPlugin();this._tick2Func=()=>{const i=performance.now();this.Tick2(),e.AddIndividualPluginTickTime(t,performance.now()-i)}}else this._tick2Func=()=>this.Tick2();this._runtime.Dispatcher().addEventListener("tick2",this._tick2Func),this._isTicking2=!0}}_StopTicking2(){this._isTicking2&&(this._runtime.Dispatcher().removeEventListener("tick2",this._tick2Func),this._isTicking2=!1)}IsTicking2(){return this._isTicking2}GetDebuggerProperties(){return[]}SaveToJson(){return null}LoadFromJson(e){}GetPropertyValueByIndex(e){}SetPropertyValueByIndex(e,t){}OffsetPropertyValueByIndex(e,t,i){if(0===t)return;const n=this.GetPropertyValueByIndex(e);if("number"!=typeof n)throw new Error("expected number");this.SetPropertyValueByIndex(e,n+t,i)}SetPropertyColorOffsetValueByIndex(e,t,i,n){}CallAction(e,...t){e.call(this,...t)}CallExpression(e,...t){return e.call(this,...t)}GetScriptInterfaceClass(){return null}DispatchScriptEvent(e,t,i){if(!this._inst.HasScriptInterface())return;const n=this.GetScriptInterface(),s=C3.New(C3.Event,e,t);s.instance=n,i&&Object.assign(s,i),n.dispatchEvent(s)}MustPreDraw(){return!1}}; } // sdk/sdkWorldInstanceBase.js { const C3=self.C3;C3.SDKWorldInstanceBase=class extends C3.SDKInstanceBase{constructor(e,t){super(e,t),this._worldInfo=e.GetWorldInfo(),this._renderercontextlost_handler=null,this._renderercontextrestored_handler=null}Release(){if(this._renderercontextlost_handler){const e=this._runtime.Dispatcher();e.removeEventListener("renderercontextlost",this._renderercontextlost_handler),e.removeEventListener("renderercontextrestored",this._renderercontextrestored_handler),this._renderercontextlost_handler=null,this._renderercontextrestored_handler=null}this._worldInfo=null,super.Release()}HandleWebGLContextLoss(){this.HandleRendererContextLoss()}OnWebGLContextLost(){}OnWebGLContextRestored(){}HandleRendererContextLoss(){if(this._renderercontextlost_handler)return;this._renderercontextlost_handler=()=>this.OnRendererContextLost(),this._renderercontextrestored_handler=()=>this.OnRendererContextRestored();const e=this._runtime.Dispatcher();e.addEventListener("renderercontextlost",this._renderercontextlost_handler),e.addEventListener("renderercontextrestored",this._renderercontextrestored_handler)}OnRendererContextLost(){this.OnWebGLContextLost()}OnRendererContextRestored(){this.OnWebGLContextRestored()}GetWorldInfo(){return this._worldInfo}IsOriginalSizeKnown(){return!1}GetOriginalSize(){if(!this.IsOriginalSizeKnown())throw new Error("original size not known");const e=this.GetCurrentImageInfo();if(e)return[e.GetWidth(),e.GetHeight(),0]}GetCurrentImageInfo(){return null}GetCurrentSurfaceSize(){const e=this.GetCurrentImageInfo();if(e){const t=e.GetTexture();if(t)return[t.GetWidth(),t.GetHeight()]}return[100,100]}GetCurrentTexRect(){const e=this.GetCurrentImageInfo();return e?e.GetTexRect():null}GetCurrentTexQuad(){const e=this.GetCurrentImageInfo();return e?e.GetTexQuad():null}IsCurrentTexRotated(){const e=this.GetCurrentImageInfo();return!!e&&e.IsRotated()}GetImagePoint(e){const t=this._inst.GetWorldInfo();return[t.GetX(),t.GetY(),t.GetTotalZ()]}LoadTilemapData(e,t,r){}TestPointOverlapTile(e,t){}RendersToOwnZPlane(){return!0}}; } // sdk/sdkDOMInstanceBase.js { const C3=self.C3,tempRect=C3.New(C3.Rect);C3.SDKDOMInstanceBase=class extends C3.SDKWorldInstanceBase{constructor(e,t){super(e,t),this._elementId=this.GetPlugin()._AddElement(this),this._isElementShowing=!0,this._elemHasFocus=!1,this._autoFontSize=!1,this._autoFontSizeOffset=-.2,this._lastRect=C3.New(C3.Rect,0,0,-1,-1);const s=this._runtime.GetCanvasManager();this._lastWindowWidth=s.GetLastWidth(),this._lastWindowHeight=s.GetLastHeight(),this._lastHTMLIndex=-1,this._lastHTMLZIndex=-1,this._isPendingUpdateState=!1,this._StartTicking()}Release(){this.GetPlugin()._RemoveElement(this._elementId),this.PostToDOMElement("destroy"),this._elementId=-1,super.Release()}_GetElementInDOMMode(){if(this._runtime.IsInWorker())throw new Error("not valid in worker mode");return this._PostToDOMElementMaybeSync("get-element")}PostToDOMElement(e,t){t||(t={}),t["elementId"]=this._elementId,this.PostToDOM(e,t)}_PostToDOMElementMaybeSync(e,t){return t||(t={}),t["elementId"]=this._elementId,this._PostToDOMMaybeSync(e,t)}PostToDOMElementAsync(e,t){return t||(t={}),t["elementId"]=this._elementId,this.PostToDOMAsync(e,t)}CreateElement(e){e||(e={});const t=this.GetWorldInfo();e["elementId"]=this._elementId,e["isVisible"]=t.IsVisible(),e["htmlIndex"]=t.GetLayer().GetHTMLIndex(),e["htmlZIndex"]=t.GetHTMLZIndex(),Object.assign(e,this.GetElementState()),this._isElementShowing=!!e["isVisible"],this._PostToDOMMaybeSync("create",e),this._UpdatePosition(!0)}SetElementVisible(e){e=!!e,this._isElementShowing!==e&&(this._isElementShowing=e,this.PostToDOMElement("set-visible",{"isVisible":e}))}Tick(){this._UpdatePosition(!1)}_ShouldPreserveElement(){const e=this._runtime.GetCanvasManager().GetFullscreenMode();return"Android"===C3.Platform.OS&&("scale-inner"===e||"integer-scale-inner"===e||"scale-outer"===e||"integer-scale-outer"===e||"crop"===e)}_UpdatePosition(e){if(this.GetInstance().IsDestroyed())return;const t=this.GetWorldInfo(),s=t.GetLayer(),i=t.GetBoundingBox();let[n,l]=s.LayerToCanvasCss(i.getLeft(),i.getTop()),[o,h]=s.LayerToCanvasCss(i.getRight(),i.getBottom());const a=this._runtime.GetCanvasManager(),d=a.GetCssWidth(),m=a.GetCssHeight();if(!t.IsVisible()||!s.IsVisible())return void this.SetElementVisible(!1);if(!this._ShouldPreserveElement()&&(o<=0||h<=0||n>=d||l>=m))return void this.SetElementVisible(!1);tempRect.set(n,l,o,h);const r=a.GetLastWidth(),_=a.GetLastHeight(),c=s.GetHTMLIndex(),u=t.GetHTMLZIndex();if(!e&&tempRect.equals(this._lastRect)&&this._lastWindowWidth===r&&this._lastWindowHeight===_&&this._lastHTMLIndex===c&&this._lastHTMLZIndex===u)return void this.SetElementVisible(!0);this._lastRect.copy(tempRect),this._lastWindowWidth=r,this._lastWindowHeight=_,this._lastHTMLIndex=c,this._lastHTMLZIndex=u,this.SetElementVisible(!0);let M=null;this._autoFontSize&&(M=s.GetDisplayScale()+this._autoFontSizeOffset),this._PostToDOMElementMaybeSync("update-position",{"left":Math.round(this._lastRect.getLeft()),"top":Math.round(this._lastRect.getTop()),"width":Math.round(this._lastRect.width()),"height":Math.round(this._lastRect.height()),"htmlIndex":c,"htmlZIndex":u,"fontSize":M})}FocusElement(){this._PostToDOMElementMaybeSync("focus",{"focus":!0})}BlurElement(){this._PostToDOMElementMaybeSync("focus",{"focus":!1})}_OnElemFocused(){this._elemHasFocus=!0}_OnElemBlurred(){this._elemHasFocus=!1}IsElementFocused(){return this._elemHasFocus}SetElementCSSStyle(e,t){this.PostToDOMElement("set-css-style",{"prop":C3.CSSToCamelCase(e),"val":t})}SetElementAttribute(e,t){this.PostToDOMElement("set-attribute",{"name":e,"val":t})}RemoveElementAttribute(e){this.PostToDOMElement("remove-attribute",{"name":e})}UpdateElementState(){this._isPendingUpdateState||(this._isPendingUpdateState=!0,Promise.resolve().then(()=>{this._isPendingUpdateState=!1,this.PostToDOMElement("update-state",this.GetElementState())}))}GetElementState(){}GetElementId(){return this._elementId}}; } // sdk/sdkBehaviorBase.js { const C3=self.C3,IBehavior=self.IBehavior;C3.SDKBehaviorBase=class extends C3.DefendedBase{constructor(e){super(),this._runtime=e.runtime,this._id=e.id,this._name=e.name??"",this._myObjectClasses=C3.New(C3.ArraySet),this._myInstances=C3.New(C3.ArraySet),this._sdkVersion=e.sdkVersion,this._scriptInterfaceClass=e.scriptInterfaceClass,this._iBehavior=null}Release(){this._myInstances.Release(),this._myObjectClasses.Release(),this._runtime=null}GetRuntime(){return this._runtime}GetID(){return this._id}GetName(){return this._name}OnCreate(){}GetSdkVersion(){return this._sdkVersion}GetScriptInterfaceClass(e=!1){let s=this._scriptInterfaceClass;return e&&"function"!=typeof s&&this.GetSdkVersion()>=2&&(s=globalThis.ISDKBehaviorBase),s}_AddObjectClass(e){this._myObjectClasses.Add(e)}GetObjectClasses(){return this._myObjectClasses.GetArray()}_AddInstance(e){this._myInstances.Add(e)}_RemoveInstance(e){this._myInstances.Delete(e)}GetInstances(){return this._myInstances.GetArray()}_InitScriptInterface(){const e=this.GetSdkVersion();C3.AddonManager._PushInitObject(this,e);const s=this.GetScriptInterfaceClass(!0);if(s){if(this._iBehavior=new s,!(this._iBehavior instanceof IBehavior))throw new TypeError("behavior class must derive from IBehavior")}else this._iBehavior=new IBehavior;C3.AddonManager._PopInitObject(e)}GetIBehavior(){return this._iBehavior}}; } // sdk/sdkBehaviorTypeBase.js { const C3=self.C3;C3.SDKBehaviorTypeBase=class extends C3.DefendedBase{constructor(e){super(),this._runtime=e.GetRuntime(),this._behaviorType=e,this._objectClass=e.GetObjectClass(),this._behavior=e.GetBehavior(),this._behavior._AddObjectClass(this._objectClass)}Release(){this._runtime=null,this._behaviorType=null,this._objectClass=null,this._behavior=null}OnCreate(){}GetBehaviorType(){return this._behaviorType}GetObjectClass(){return this._objectClass}GetRuntime(){return this._runtime}GetBehavior(){return this._behavior}}; } // sdk/sdkBehaviorInstanceBase.js { const C3=self.C3;C3.SDKBehaviorInstanceBase=class extends C3.DefendedBase{constructor(t,i){super(),this._behInst=t,this._domComponentId=i,this._inst=t.GetObjectInstance(),this._runtime=t.GetRuntime(),this._behaviorType=t.GetBehaviorType(),this._sdkType=this._behaviorType.GetSdkType(),this._isTicking=!1,this._isTicking2=!1,this._isPostTicking=!1,this._disposables=null}Release(){this._StopTicking(),this._StopTicking2(),this._StopPostTicking(),this._disposables&&(this._disposables.Release(),this._disposables=null),this._behInst=null,this._inst=null,this._runtime=null,this._behaviorType=null,this._sdkType=null}GetBehavior(){return this._behaviorType.GetBehavior()}GetBehaviorInstance(){return this._behInst}GetObjectInstance(){return this._inst}GetObjectClass(){return this._inst.GetObjectClass()}GetWorldInfo(){return this._inst.GetWorldInfo()}GetRuntime(){return this._runtime}GetBehaviorType(){return this._behaviorType}GetSdkType(){return this._sdkType}GetScriptInterface(){return this._behInst.GetScriptInterface()}Trigger(t){return this._runtime.Trigger(t,this._inst,this._behaviorType)}DebugTrigger(t){return this._runtime.DebugTrigger(t,this._inst,this._behaviorType)}TriggerAsync(t){return this._runtime.TriggerAsync(t,this._inst,this._behaviorType)}PostCreate(){}Tick(){}Tick2(){}PostTick(){}_StartTicking(){this._isTicking||(this._runtime._AddBehInstToTick(this),this._isTicking=!0)}_StopTicking(){this._isTicking&&(this._runtime._RemoveBehInstToTick(this),this._isTicking=!1)}IsTicking(){return this._isTicking}_StartTicking2(){this._isTicking2||(this._runtime._AddBehInstToTick2(this),this._isTicking2=!0)}_StopTicking2(){this._isTicking2&&(this._runtime._RemoveBehInstToTick2(this),this._isTicking2=!1)}IsTicking2(){return this._isTicking2}_StartPostTicking(){this._isPostTicking||(this._runtime._AddBehInstToPostTick(this),this._isPostTicking=!0)}_StopPostTicking(){this._isPostTicking&&(this._runtime._RemoveBehInstToPostTick(this),this._isPostTicking=!1)}IsPostTicking(){return this._isPostTicking}GetDebuggerProperties(){return[]}AddDOMMessageHandler(t,i){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,t,i)}OnSpriteFrameChanged(t,i){}SaveToJson(){return null}LoadFromJson(t){}GetPropertyValueByIndex(t){}SetPropertyValueByIndex(t,i){}OffsetPropertyValueByIndex(t,i){if(0===i)return;const e=this.GetPropertyValueByIndex(t);if("number"!=typeof e)throw new Error("expected number");this.SetPropertyValueByIndex(t,e+i)}SetPropertyColorOffsetValueByIndex(t,i,e,s){}CallAction(t,...i){t.call(this,...i)}CallExpression(t,...i){return t.call(this,...i)}GetScriptInterfaceClass(){return null}DispatchScriptEvent(t,i,e){if(!this._behInst.HasScriptInterface())return;const s=this.GetScriptInterface(),n=C3.New(C3.Event,t,i);n.behaviorInstance=s,n.instance=s.instance,e&&Object.assign(n,e),s.dispatchEvent(n)}}; } // objects/addonManager.js { const C3=self.C3;C3.Plugins={},C3.Behaviors={};const internalApiToken=C3._GetInternalAPIToken();function ValidateInternalAPIToken(t){if(t!==internalApiToken)throw new Error("invalid internal API token")}let initObjectStack=[],initObjectStack2=[],initPropertiesStack=[],originalPushInitObject=null,originalPopInitObject=null,originalGetInitObject=null,originalGetInitObject2=null;const pluginsByCtor=new Map,behaviorsByCtor=new Map;C3.AddonManager=class extends C3.DefendedBase{#t=null;#e=[];#i=null;#n=[];#r=new Map;#o=null;#s=null;#a;constructor(t,e){super(),this.#t=t,this.#a=new Set(e)}CreatePlugin(t){const e=t[19],i=this.#t.GetObjectReference(t[0]);if(!i)throw new Error("missing plugin");C3.AddCommonACEs(t,i,e);const n=e>=2?C3.SDKPluginBase:i,r=C3.New(n,{runtime:this.#t,isSingleGlobal:t[1],isWorld:t[2],isRotatable:t[5],hasEffects:t[8],mustPredraw:t[9],supportsSceneGraph:t[13],supportsMesh:t[14],isHTMLElementType:t[17],is3d:t[18],sdkVersion:e,id:t[20],name:t[21],scriptInterfaceClass:e>=2?i:null,supportsChangingSampling:t[22],supportsZElevation:t[23],exportData:t[24]});r.OnCreate(),this.#e.push(r),pluginsByCtor.set(i,r)}CreateSystemPlugin(){this.#i=C3.New(C3.Plugins.System,{runtime:this.#t,isSingleGlobal:!0}),this.#i.OnCreate()}CreateBehavior(t){const e=t[1],i=t[2],n=t[3],r=this.#t.GetObjectReference(t[0]);if(!r)throw new Error("missing behavior");this.#r.set(r,()=>{const t=e>=2?C3.SDKBehaviorBase:r,o=C3.New(t,{runtime:this.#t,id:i,name:n,sdkVersion:e,scriptInterfaceClass:e>=2?r:null});o.OnCreate(),this.#n.push(o),behaviorsByCtor.set(r,o),!this.#o&&C3.Behaviors.solid&&o instanceof C3.Behaviors.solid?this.#o=o:!this.#s&&C3.Behaviors.jumpthru&&o instanceof C3.Behaviors.jumpthru&&(this.#s=o),o._InitScriptInterface()})}_DelayCreateBehavior(t){const e=this.#r.get(t);e&&(e(),this.#r.delete(t))}static _PushInitObject(t,e=1){if(C3.AddonManager._PushInitObject!==originalPushInitObject)throw new Error("invalid method");1===e&&initObjectStack.push(t),initObjectStack2.push(t)}static _PopInitObject(t=1){if(C3.AddonManager._PopInitObject!==originalPopInitObject)throw new Error("invalid method");1===t&&initObjectStack.pop(),initObjectStack2.pop()}static _GetInitObject(){if(C3.AddonManager._GetInitObject!==originalGetInitObject)throw new Error("invalid method");if(0===initObjectStack.length)throw new Error("no init object set");return initObjectStack.at(-1)}static _GetInitObject2(t){if(C3.AddonManager._GetInitObject2!==originalGetInitObject2)throw new Error("invalid method");if(ValidateInternalAPIToken(t),0===initObjectStack2.length)throw new Error("no init object set");return initObjectStack2.at(-1)}static _PushInitProperties(t){initPropertiesStack.push(t)}static _PopInitProperties(){initPropertiesStack.pop()}static _GetInitProperties(){if(0===initPropertiesStack.length)throw new Error("no init properties set");return initPropertiesStack.at(-1)}_InitAddonScriptInterfaces(){for(const t of this.#e)t._InitScriptInterface()}static GetPluginByConstructorFunction(t){return pluginsByCtor.get(t)||null}static GetBehaviorByConstructorFunction(t){return behaviorsByCtor.get(t)||null}GetSystemPlugin(){return this.#i}GetSolidBehavior(){return this.#o}GetJumpthruBehavior(){return this.#s}HasWrapperComponentId(t){return this.#a.has(t)}},originalPushInitObject=C3.AddonManager._PushInitObject,originalPopInitObject=C3.AddonManager._PopInitObject,originalGetInitObject=C3.AddonManager._GetInitObject,originalGetInitObject2=C3.AddonManager._GetInitObject2; } // objects/imageInfo.js { const C3=self.C3,allImageInfos=new Set;C3.ImageInfo=class extends C3.DefendedBase{constructor(){super(),this._generation=0,this._url="",this._size=0,this._offsetX=0,this._offsetY=0,this._width=0,this._height=0,this._isRotated=!1,this._hasMetaData=!1,this._imageAsset=null,this._textureState="",this._rcTex=C3.New(C3.Rect),this._quadTex=C3.New(C3.Quad2D),this._blobUrl="",this._iImageInfo=new self.IImageInfo(this),allImageInfos.add(this)}Release(){this.ReleaseTexture(),this._imageAsset&&0===this._imageAsset.GetRefCount()&&this._imageAsset.Release(),this._imageAsset=null,allImageInfos.delete(this),this.ReleaseBlobURL()}static OnRendererContextLost(){for(const t of allImageInfos)t._textureState="",t._rcTex.set(0,0,0,0),t._quadTex.setFromRect(t._rcTex)}LoadData(t){this._url=t[0]??t["url"],this._size=t[1]??t["size"],this._offsetX=t[2]??t["offset-x"],this._offsetY=t[3]??t["offset-y"],this._width=t[4]??t["width"],this._height=t[5]??t["height"],this._isRotated=t[6]??t["rotated"],this._hasMetaData=!0}LoadDynamicAsset(t,e,s){if(s=!!s,this._imageAsset)throw new Error("already loaded asset");this._url=e;const i={isTiled:s};return C3.IsAbsoluteURL(e)&&(i.loadPolicy="remote"),this.LoadAsset(t,i),this._imageAsset.Load()}LoadDynamicBlobAsset(t,e){if(this._imageAsset)throw new Error("already loaded asset");this._url="",this._size=e.size,this._imageAsset=C3.New(C3.ImageAsset,t.GetAssetManager(),{blob:e,size:this._size,loadPolicy:"local"})}ReplaceWith(t){if(t===this)throw new Error("cannot replace with self");this._generation++,this.ReleaseTexture(),this._url=t._url,this._size=t._size,this._offsetX=t._offsetX,this._offsetY=t._offsetY,this._width=t._width,this._height=t._height,this._isRotated=t._isRotated,this._hasMetaData=t._hasMetaData,this._imageAsset=t._imageAsset,this._textureState=t._textureState,this._rcTex=t._rcTex,this._quadTex=t._quadTex,this.ReleaseBlobURL()}GetURL(){return this._url}GetSize(){return this._size}GetOffsetX(){return this._offsetX}GetOffsetY(){return this._offsetY}IsRotated(){return this._isRotated}GetWidth(){return this._width}GetHeight(){return this._height}GetSheetWidth(){return this._imageAsset.GetWidth()}GetSheetHeight(){return this._imageAsset.GetHeight()}LoadAsset(t,e){if(this._imageAsset)throw new Error("already got asset");e=Object.assign({},e,{url:this.GetURL(),size:this.GetSize()}),this._imageAsset=t.LoadImage(e)}IsLoaded(){return this._imageAsset&&this._imageAsset.IsLoaded()}async LoadStaticTexture(t,e){if(!this._imageAsset)throw new Error("no asset");if(this._textureState)throw new Error("already loaded texture");const s=this._generation;this._textureState="loading";const i=await this._imageAsset.LoadStaticTexture(t,e);if(this._generation!==s)return null;if(!i)return this._textureState="",null;this._textureState="loaded",this._hasMetaData||(this._width=i.GetWidth(),this._height=i.GetHeight(),this._hasMetaData=!0);const h=this._isRotated?this._height:this._width,a=this._isRotated?this._width:this._height;return this._rcTex.set(this._offsetX,this._offsetY,this._offsetX+h,this._offsetY+a),this._rcTex.divide(i.GetWidth(),i.GetHeight()),this._quadTex.setFromRect(this._rcTex),this._isRotated&&this._quadTex.rotatePointsAnticlockwise(),i}ReleaseTexture(){this._textureState&&(this._imageAsset&&this._imageAsset.ReleaseTexture(),this._textureState="",this._rcTex.set(0,0,0,0),this._quadTex.setFromRect(this._rcTex))}GetTexture(){return this._imageAsset&&"loaded"===this._textureState?this._imageAsset.GetTexture():null}GetTexRect(){return this._rcTex}GetTexQuad(){return this._quadTex}GetIImageInfo(){return this._iImageInfo}GetImageAsset(){return this._imageAsset}async ExtractImageToCanvas(t){t||(t=await this._imageAsset.LoadToDrawable()),this._hasMetaData||(this._width=t.width,this._height=t.height,this._hasMetaData=!0);const e=C3.CreateCanvas(this._width,this._height),s=e.getContext("2d");return this._isRotated?(s.rotate(Math.PI/-2),s.translate(-this._height,0),s.drawImage(t,this._offsetX,this._offsetY,this._height,this._width,0,0,this._height,this._width)):s.drawImage(t,this._offsetX,this._offsetY,this._width,this._height,0,0,this._width,this._height),e}async ExtractImageToBlobURL(t){if(this._blobUrl)return this._blobUrl;const e=await this.ExtractImageToCanvas(t),s=await C3.CanvasToBlob(e);return this._blobUrl=URL.createObjectURL(s),this._blobUrl}ReleaseBlobURL(){this._blobUrl&&(URL.revokeObjectURL(this._blobUrl),this._blobUrl="")}}; } // objects/animationInfo.js { const C3=self.C3;C3.AnimationInfo=class extends C3.DefendedBase{constructor(e){super(),this._name=e[0],this._speed=e[1],this._isLooping=!!e[2],this._repeatCount=e[3],this._repeatTo=e[4],this._isPingPong=!!e[5],this._sid=e[6],this._frames=e[7].map(e=>C3.New(C3.AnimationFrameInfo,e)),this._iAnimation=new self.IAnimation(this)}static CreateDynamic(e,t){const r=C3.New(C3.AnimationInfo,[t,0,!1,0,0,!1,Math.floor(1e15*Math.random()),[]]);return r._frames.push(C3.AnimationFrameInfo.CreateDynamic(e)),r}Release(){for(const e of this._frames)e.Release();C3.clearArray(this._frames)}LoadAllAssets(e){for(const t of this._frames)t.GetImageInfo().LoadAsset(e)}LoadAllTextures(e,t){return Promise.all(this._frames.map(r=>r.GetImageInfo().LoadStaticTexture(e,t)))}ReleaseAllTextures(){for(const e of this._frames)e.GetImageInfo().ReleaseTexture()}GetName(){return this._name}GetSID(){return this._sid}GetFrameCount(){return this._frames.length}GetFrames(){return this._frames}GetFrameAt(e){if((e=Math.floor(e))<0||e>=this._frames.length)throw new RangeError("invalid frame");return this._frames[e]}InsertFrameAt(e,t){(t=Math.floor(t))<0?this._frames.unshift(e):t>=this._frames.length?this._frames.push(e):this._frames.splice(t,0,e)}RemoveFrameAt(e){if((e=Math.floor(e))<0||e>=this._frames.length)throw new RangeError("invalid frame");this._frames[e].Release(),this._frames.splice(e,1)}GetFrameIndexByTag(e){for(let t=0,r=this._frames.length;t<r;++t)if(C3.equalsNoCase(this._frames[t].GetTag(),e))return t;return-1}FrameTagOrIndexToIndex(e){if("string"==typeof e){const t=this.GetFrameIndexByTag(e);if(-1===t)throw new Error(`cannot find animation frame with tag ${e}`);return t}return e}GetSpeed(){return this._speed}IsLooping(){return this._isLooping}GetRepeatCount(){return this._repeatCount}GetRepeatTo(){return this._repeatTo}IsPingPong(){return this._isPingPong}GetIAnimation(){return this._iAnimation}}; } // objects/animationFrameInfo.js { const C3=self.C3,EMPTY_IMAGE_BLOB=(()=>{const t=atob("iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAQMAAABKLAcXAAAAAXNSR0IArs4c6QAAAANQTFRFAAAAp3o92gAAAAF0Uk5TAEDm2GYAAAATSURBVBgZYxgFo2AUjIJRQFcAAAV4AAHcRQIbAAAAAElFTkSuQmCC"),i=new Uint8Array(t.length);for(let e=0,n=t.length;e<n;++e)i[e]=t.charCodeAt(e);return new Blob([i],{type:"image/png"})})();C3.AnimationFrameInfo=class extends C3.DefendedBase{constructor(t){super(),this._imageInfo=C3.New(C3.ImageInfo),this._imageInfo.LoadData(t),this._duration=t[7],this._origin=C3.New(C3.Vector2,t[8],t[9]),this._imagePoints=t[10].map(t=>C3.New(C3.ImagePoint,this,t)),this._imagePointsByName=new Map;for(const t of this._imagePoints)this._imagePointsByName.set(t.GetName().toLowerCase(),t);this._collisionPoly=null;const i=t[11];i.length>=6&&(this._collisionPoly=C3.New(C3.CollisionPoly,i)),this._tag=t[12]?t[12]:"",this._iAnimationFrame=new self.IAnimationFrame(this)}static CreateDynamic(t){const i=C3.New(C3.AnimationFrameInfo,["",0,0,0,100,100,!1,1,0,0,[],[],""]);return i._imageInfo.LoadDynamicBlobAsset(t,EMPTY_IMAGE_BLOB),i}Release(){this._collisionPoly&&(this._collisionPoly.Release(),this._collisionPoly=null),this._imageInfo.Release(),this._imageInfo=null}GetImageInfo(){return this._imageInfo}GetDuration(){return this._duration}GetOriginX(){return this._origin.getX()}GetOriginY(){return this._origin.getY()}GetCollisionPoly(){return this._collisionPoly}GetImagePointByName(t){return this._imagePointsByName.get(t.toLowerCase())||null}GetImagePointByIndex(t){return(t=Math.floor(t))<0||t>=this._imagePoints.length?null:this._imagePoints[t]}GetImagePointCount(){return this._imagePoints.length}GetTag(){return this._tag}GetIAnimationFrame(){return this._iAnimationFrame}}; } // objects/imagePoint.js { const C3=self.C3;C3.ImagePoint=class extends C3.DefendedBase{constructor(e,t){super(),this._afi=e,this._name=t[0],this._pos=C3.New(C3.Vector2,t[1],t[2])}Release(){}GetName(){return this._name}GetX(){return this._pos.getX()}GetY(){return this._pos.getY()}GetVec2(){return this._pos}}; } // objects/objectClass.js { const C3=globalThis.C3,C3Debugger=globalThis.C3Debugger,IObjectClass=globalThis.IObjectClass,IObjectType=globalThis.IObjectType,IFamily=globalThis.IFamily,assert=globalThis.assert;C3.ObjectClass=class … [Строка слишком длинная. Вы можете скачать файл] } // objects/container.js { const C3=self.C3;C3.Container=class extends C3.DefendedBase{constructor(e,t){super(),this._runtime=e,this._objectTypes=t;for(const e of this._objectTypes)e._SetContainer(this)}Release(){this._runtime=null}GetRuntime(){return this._runtime}GetObjectTypes(){return this._objectTypes}objectTypes(){return this._objectTypes}HasAnyWorldType(){return this._objectTypes.some(e=>e.IsWorldType())}}; } // objects/instance.js { const C3=self.C3,C3Debugger=self.C3Debugger,IInstance=self.IInstance,originalAddonManager=C3.AddonManager,EMPTY_ARRAY=[],EMPTY_SET=new Set;let nextPuid=0;const savedDataMaps=new WeakMap,FLAG_DESTROYED … [Строка слишком длинная. Вы можете скачать файл] } // objects/sceneGraphInfo.js { const C3=self.C3,updatedInstances=new Map;C3.SceneGraphInfo=class extends C3.DefendedBase{constructor(t){super(),this._owner=t,this._parent=null,this._children=[],this._startWidth=t.GetWidth(),this._s … [Строка слишком длинная. Вы можете скачать файл] } // objects/worldInfo.js { const C3=self.C3,glMatrix=self.glMatrix,vec3=glMatrix.vec3,vec4=glMatrix.vec4,tempRect=new C3.Rect,tempRect2=new C3.Rect,tempQuad=C3.New(C3.Quad2D),bboxChangeEvent=C3.New(C3.Event,"bboxchange",!1),tem … [Строка слишком длинная. Вы можете скачать файл] } // objects/behaviorType.js { const C3=self.C3;C3.BehaviorType=class extends C3.DefendedBase{constructor(e,t){super();const s=e.GetRuntime(),i=s.GetObjectReference(t[1]);s.GetAddonManager()._DelayCreateBehavior(i),this._runtime=s,this._objectClass=e,this._behavior=C3.AddonManager.GetBehaviorByConstructorFunction(i),this._sdkType=null,this._iBehaviorType=null,this._instSdkCtor=i.Instance,this._sid=t[2],this._name=t[0],this._jsPropName=this._runtime.GetJsPropName(t[3]);const r=this._behavior.GetSdkVersion();if(r<2&&(this._sdkType=C3.New(i.Type,this),!(this._sdkType instanceof C3.SDKBehaviorTypeBase)))throw new Error("v1 sdk type must derive from SDKBehaviorBase");if(C3.AddonManager._PushInitObject(this,r),r>=2){const e=i.Type??globalThis.ISDKBehaviorTypeBase;if(this._iBehaviorType=new e,!(this._iBehaviorType instanceof globalThis.ISDKBehaviorTypeBase))throw new Error("script interface class must derive from ISDKBehaviorTypeBase")}else this._iBehaviorType=new globalThis.IBehaviorType;C3.AddonManager._PopInitObject(r),this.OnCreate()}static Create(e,t){return C3.New(C3.BehaviorType,e,t)}Release(){this._runtime=null,this._behavior=null,this._sdkType&&(this._sdkType.Release(),this._sdkType=null),this._instSdkCtor=null}GetSdkType(){return this._sdkType}OnCreate(){this._sdkType?this._sdkType.OnCreate():this._iBehaviorType&&this._iBehaviorType._onCreate()}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetBehavior(){return this._behavior}GetInstanceSdkCtor(){return this._instSdkCtor}GetName(){return this._name}GetSID(){return this._sid}GetIBehaviorType(){return this._iBehaviorType}GetJsPropName(){return this._jsPropName}}; } // objects/behaviorInstance.js { const C3=self.C3,IBehaviorInstance=self.IBehaviorInstance;C3.BehaviorInstance=class extends C3.DefendedBase{constructor(t){super(),this._runtime=t.runtime,this._behaviorType=t.behaviorType,this._behavior=this._behaviorType.GetBehavior(),this._inst=t.instance,this._index=t.index,this._sdkInst=null,this._iScriptInterface=null,this._behavior._AddInstance(this._inst)}Release(){this._iScriptInterface&&(this._iScriptInterface._release(),this._iScriptInterface=null),this._behavior._RemoveInstance(this._inst),this._sdkInst&&(this._sdkInst.Release(),this._sdkInst=null),this._runtime=null,this._behaviorType=null,this._behavior=null,this._inst=null}_CreateSdkInstance(t){if(this._sdkInst)throw new Error("already got sdk instance");if(this.GetBehavior().GetSdkVersion()<2){if(this._sdkInst=C3.New(this._behaviorType.GetInstanceSdkCtor(),this,t),!(this._sdkInst instanceof C3.SDKBehaviorInstanceBase))throw new Error("v1 sdk type must derive from SDKBehaviorInstanceBase")}else{const e=this.GetBehavior().GetScriptInterfaceClass();this._InitScriptInterface(e.Instance,t)}}GetSdkInstance(){return this._sdkInst??this._iScriptInterface}GetObjectInstance(){return this._inst}GetRuntime(){return this._runtime}GetBehaviorType(){return this._behaviorType}GetBehavior(){return this._behavior}_GetIndex(){return this._index}PostCreate(){this._sdkInst?this._sdkInst.PostCreate():this._iScriptInterface._postCreate()}OnSpriteFrameChanged(t,e){this._sdkInst&&this._sdkInst.OnSpriteFrameChanged(t,e)}_GetDebuggerProperties(){return this._sdkInst?this._sdkInst.GetDebuggerProperties():this._iScriptInterface._getDebuggerProperties()}SaveToJson(t="full"){return this._sdkInst?this._sdkInst.SaveToJson(t):this._iScriptInterface._saveToJson(t)}LoadFromJson(t,e="full"){if(this._sdkInst)return this._sdkInst.LoadFromJson(t,e);this._iScriptInterface._loadFromJson(t,e)}static SortByTickSequence(t,e,s){const n=globalThis.ISDKBehaviorInstanceBase;let i,r;i=e instanceof n?t._UnwrapScriptInterface(e):e.GetBehaviorInstance(),r=s instanceof n?t._UnwrapScriptInterface(s):s.GetBehaviorInstance();const a=i.GetObjectInstance(),h=r.GetObjectInstance(),c=a.GetObjectClass().GetIndex(),o=h.GetObjectClass().GetIndex();if(c!==o)return c-o;const I=a.GetPUID(),_=h.GetPUID();return I!==_?I-_:i._GetIndex()-r._GetIndex()}_InitScriptInterface(t,e){const s=IBehaviorInstance,n=t??this._sdkInst.GetScriptInterfaceClass(),i=n||s,r=this.GetBehavior().GetSdkVersion();if(C3.AddonManager._PushInitObject(this,r),C3.AddonManager._PushInitProperties(e),this._iScriptInterface=new i,C3.AddonManager._PopInitProperties(),C3.AddonManager._PopInitObject(r),n&&!(this._iScriptInterface instanceof s))throw new TypeError(`script interface class '${n.name}' does not extend the right base class '${s.name}'`);return this._iScriptInterface}GetScriptInterface(){return this._iScriptInterface||this._InitScriptInterface()}HasScriptInterface(){return!!this._iScriptInterface}}; } // objects/effectList.js { const C3=self.C3;C3.EffectList=class extends C3.DefendedBase{constructor(e,t){super(),this._owner=e,this._allEffectTypes=[],this._activeEffectTypes=[],this._effectTypesByName=new Map,this._effectParams=[],this._effectParamBuffers=[],this._allInstanceEffectLists=new Set,this._preservesOpaqueness=!0;for(const e of t){const t=C3.New(C3.EffectType,this,e,this._allEffectTypes.length);this._allEffectTypes.push(t),this._effectTypesByName.set(t.GetName().toLowerCase(),t),e.length>=3&&this._effectParams.push(this._LoadSingleEffectParameters(t,e[2]))}this.GetRuntime()._AddEffectList(this)}Release(){this.GetRuntime()._RemoveEffectList(this);for(const e of this._effectParamBuffers)e.Release();C3.clearArray(this._effectParamBuffers),C3.clearArray(this._allEffectTypes),C3.clearArray(this._activeEffectTypes),this._effectTypesByName.clear(),C3.clearArray(this._effectParams),this._owner=null}_AddInstanceEffectList(e){this._allInstanceEffectLists.add(e)}_RemoveInstanceEffectList(e){this._allInstanceEffectLists.delete(e)}_InitRenderer(e){e.IsWebGPU()&&(this._effectParamBuffers=this._allEffectTypes.map(e=>{const t=e.GetShaderProgram();return t.GetCustomParametersByteSize()>0?C3.New(C3.Gfx.WebGPUEffectCustomParamsBuffer,t):null}),this._UpdateAllEffectParamBuffers());for(const t of this._allInstanceEffectLists)t._InitRenderer(e)}PrependEffectTypes(e){if(e.length){this._allEffectTypes=e.concat(this._allEffectTypes);for(const t of e)this._effectTypesByName.set(t.GetName().toLowerCase(),t);for(let e=0,t=this._allEffectTypes.length;e<t;++e)this._allEffectTypes[e]._SetIndex(e)}}_LoadSingleEffectParameters(e,t){e.SetActive(t[0]);const s=t.slice(1);for(let e=0,t=s.length;e<t;++e){const t=s[e];if(Array.isArray(t)){const f=C3.New(C3.Color);f.setFromJSON(t),s[e]=f}}return s}GetOwner(){return this._owner}GetRuntime(){return this._owner.GetRuntime()}UpdateActiveEffects(){C3.clearArray(this._activeEffectTypes);let e=!0;for(const t of this._allEffectTypes)t.IsActive()&&(this._activeEffectTypes.push(t),t.GetShaderProgram().PreservesOpaqueness()||(e=!1));this._preservesOpaqueness=e}GetAllEffectTypes(){return this._allEffectTypes}HasAnyEffectType(){return this._allEffectTypes.length>0}GetEffectTypeByName(e){return this._effectTypesByName.get(e.toLowerCase())||null}GetEffectTypeByIndex(e){if((e=Math.floor(+e))<0||e>=this._allEffectTypes.length)throw new RangeError("invalid effect type index");return this._allEffectTypes[e]}IsEffectIndexActive(e){return this.GetEffectTypeByIndex(e).IsActive()}SetEffectIndexActive(e,t){this.GetEffectTypeByIndex(e).SetActive(t)}GetActiveEffectTypes(){return this._activeEffectTypes}HasAnyActiveEffect(){return this._activeEffectTypes.length>0}PreservesOpaqueness(){return this._preservesOpaqueness}GetEffectParametersForIndex(e){return this._effectParams[e]}_GetEffectChainShaderParametersForIndex(e){return e<this._effectParamBuffers.length?this._effectParamBuffers[e]:this._effectParams[e]}GetEffectParameter(e,t){if(e<0||e>=this._effectParams.length)return null;const s=this._effectParams[e];return t<0||t>=s.length?null:s[t]}SetEffectParameter(e,t,s){if(e<0||e>=this._effectParams.length)return!1;const f=this._effectParams[e];if(t<0||t>=f.length)return!1;const r=f[t];if(r instanceof C3.Color){if(r.equalsIgnoringAlpha(s))return!1;r.copyRgb(s)}else{if(r===s)return!1;f[t]=s}return e<this._effectParamBuffers.length&&this._effectParamBuffers[e].SetParameterValue(t,s),!0}_UpdateAllEffectParamBuffers(){const e=this._effectParams,t=this._effectParamBuffers;for(let s=0,f=Math.min(e.length,t.length);s<f;++s){const f=t[s],r=e[s];for(let e=0,t=r.length;e<t;++e)f.SetParameterValue(e,r[e])}}static SaveFxParamToJson(e){return e&&e instanceof C3.Color?{"t":"color","v":e.toJSON()}:e}static LoadFxParamFromJson(e){if(null===e)return NaN;if("object"==typeof e){if("color"===e["t"]){const t=C3.New(C3.Color);return t.setFromJSON(e["v"]),t}throw new Error("invalid effect parameter type")}return e}static SaveFxParamsToJson(e){return e.map(C3.EffectList.SaveFxParamToJson)}static LoadFxParamsFromJson(e){return e.map(C3.EffectList.LoadFxParamFromJson)}SaveToJson(){return this._allEffectTypes.map(e=>({"name":e.GetName(),"active":e.IsActive(),"params":C3.EffectList.SaveFxParamsToJson(this._effectParams[e.GetIndex()])}))}LoadFromJson(e){for(const t of e){const e=this.GetEffectTypeByName(t["name"]);e&&(e.SetActive(t["active"]),this._effectParams[e.GetIndex()]=C3.EffectList.LoadFxParamsFromJson(t["params"]))}this.UpdateActiveEffects(),this._UpdateAllEffectParamBuffers()}}; } // objects/effectType.js { const C3=self.C3;C3.EffectType=class extends C3.DefendedBase{constructor(e,t,r){super(),this._effectList=e,this._id=t[0],this._name=t[1],this._index=r,this._shaderProgram=null,this._isActive=!0}Release(){this._effectList=null,this._shaderProgram=null}Clone(e){const t=C3.New(C3.EffectType,e,[this._id,this._name],-1);return t._shaderProgram=this._shaderProgram,t._isActive=this._isActive,t}_InitRenderer(e){const t=e.GetShaderProgramByName(this._id);if(!t)throw new Error("failed to find shader program '"+this._id+"'");this._shaderProgram=t}GetEffectList(){return this._effectList}GetName(){return this._name}_SetIndex(e){this._index=e}GetIndex(){return this._index}GetOwner(){return this._effectList.GetOwner()}GetRuntime(){return this._effectList.GetRuntime()}SetActive(e){this._isActive=!!e}IsActive(){return this._isActive}GetShaderProgram(){return this._shaderProgram}GetDefaultParameterValues(){const e=[];for(let t=0,r=this._shaderProgram.GetParameterCount();t<r;++t){const r=this._shaderProgram.GetParameterType(t);if("float"===r||"percent"===r)e.push(0);else{if("color"!==r)throw new TypeError("unknown effect parameter type");e.push(C3.New(C3.Color,1,1,1,1))}}return e}}; } // objects/instanceEffectList.js { const C3=self.C3;C3.InstanceEffectList=class extends C3.DefendedBase{constructor(e,t){super(),this._inst=e,this._wi=t,this._effectList=e.GetObjectClass().GetEffectList(),this._needsRebuildSteps=!0,this._wasDefaultColor=!0,this._was3D=!1,this._wasRotatedOrNegativeSize=!1,this._wasTexRotated=!1,this._wasMustPreDraw=!1,this._effectChain=C3.New(C3.Gfx.EffectChain,e.GetRuntime().GetCanvasManager().GetEffectChainManager(),{drawContent:(e,t)=>{const s=t.GetContentObject(),f=s.GetWorldInfo();e.SetColor(f.GetPremultipliedColor()),e.SetCurrentZ(f.GetTotalZ()),s.Draw(e),e.SetCurrentZ(0)},getSourceTextureInfo:e=>{const t=e.GetCurrentTexRect(),[s,f]=e.GetCurrentSurfaceSize();return{srcTexRect:t,srcWidth:s,srcHeight:f}},getShaderParameters:e=>this._GetEffectChainShaderParametersForIndex(e)}),this._activeEffectFlags=[],this._activeEffectTypes=[],this._preservesOpaqueness=!0,this._effectParams=[],this._effectParamBuffers=[],this._InitRenderer(e.GetRuntime().GetRenderer());for(let e=0,t=this._effectList.GetAllEffectTypes().length;e<t;++e)this._activeEffectFlags.push(!0);this.UpdateActiveEffects(),this._effectList._AddInstanceEffectList(this)}Release(){this._effectList._RemoveInstanceEffectList(this);for(const e of this._effectParamBuffers)e&&e.Release();C3.clearArray(this._effectParamBuffers),this._effectChain.Release(),this._effectChain=null,C3.clearArray(this._activeEffectFlags),C3.clearArray(this._activeEffectTypes),C3.clearArray(this._effectParams),this._inst=null,this._effectList=null}_InitRenderer(e){e.IsWebGPU()&&(this._effectParamBuffers=this._effectList.GetAllEffectTypes().map(e=>{const t=e.GetShaderProgram();return t.GetCustomParametersByteSize()>0?C3.New(C3.Gfx.WebGPUEffectCustomParamsBuffer,t):null}))}_LoadEffectParameters(e){let t=0;for(const s of e)this._effectParams.push(this._LoadSingleEffectParameters(t,s)),++t;this._UpdateAllEffectParamBuffers(),this.UpdateActiveEffects()}_LoadSingleEffectParameters(e,t){this._activeEffectFlags[e]=t[0];const s=t.slice(1);for(let e=0,t=s.length;e<t;++e){const t=s[e];if(Array.isArray(t)){const f=C3.New(C3.Color);f.setFromJSON(t),s[e]=f}}return s}LoadDefaultEffectParameters(){for(const e of this._effectList.GetAllEffectTypes())this._effectParams.push(e.GetDefaultParameterValues());this._UpdateAllEffectParamBuffers()}GetOwner(){return this._owner}GetEffectList(){return this._effectList}GetEffectChain(){return this._MaybeRebuildEffectChainSteps(),this._effectChain}GetRuntime(){return this._inst.GetRuntime()}UpdateActiveEffects(){C3.clearArray(this._activeEffectTypes);const e=this._wi,t=this._effectList.GetAllEffectTypes(),s=this._activeEffectTypes,f=this._activeEffectFlags;let a=!0;for(let e=0,r=t.length;e<r;++e)if(f[e]){const f=t[e];s.push(f),f.GetShaderProgram().PreservesOpaqueness()||(a=!1)}this._preservesOpaqueness=a,e._SetHasAnyActiveEffect(!!s.length),this._needsRebuildSteps=!0}_MaybeRebuildEffectChainSteps(){const e=this._inst,t=this._wi,s=t.HasDefaultColor(),f=e.GetPlugin().Is3D(),a=0!==t.GetAngle()||0!==t.GetLayer().GetAngle()||t.GetWidth()<0||t.GetHeight()<0,r=e.IsCurrentTexRotated(),i=e.MustPreDraw();(this._needsRebuildSteps||s!==this._wasDefaultColor||f!==this._was3D||a!==this._wasRotatedOrNegativeSize||r!==this._wasTexRotated||i!==this._wasMustPreDraw||this._effectChain.NeedsRebuild())&&(this._effectChain.BuildSteps(this._activeEffectTypes.map(e=>e.GetShaderProgram()),{indexMap:this._activeEffectTypes.map(e=>e.GetIndex()),forcePreDraw:!s||i,is3D:f,isSourceTextureRotated:r,isRotatedOrNegativeSizeInstance:a}),this._needsRebuildSteps=!1,this._wasDefaultColor=s,this._was3D=f,this._wasRotatedOrNegativeSize=a,this._wasTexRotated=r,this._wasMustPreDraw=i)}GetActiveEffectTypes(){return this._activeEffectTypes}GetEffectParametersForIndex(e){return this._effectParams[e]}_GetEffectChainShaderParametersForIndex(e){return e<this._effectParamBuffers.length?this._effectParamBuffers[e]:this._effectParams[e]}GetEffectParameter(e,t){if(e<0||e>=this._effectParams.length)return null;const s=this._effectParams[e];return t<0||t>=s.length?null:s[t]}SetEffectParameter(e,t,s){if(e<0||e>=this._effectParams.length)return!1;const f=this._effectParams[e];if(t<0||t>=f.length)return!1;const a=f[t];if(a instanceof C3.Color){if(a.equalsIgnoringAlpha(s))return!1;a.copyRgb(s)}else{if(a===s)return!1;f[t]=s}return e<this._effectParamBuffers.length&&this._effectParamBuffers[e].SetParameterValue(t,s),!0}_UpdateAllEffectParamBuffers(){const e=this._effectParams,t=this._effectParamBuffers;for(let s=0,f=t.length;s<f;++s){const f=t[s],a=e[s];for(let e=0,t=a.length;e<t;++e)f.SetParameterValue(e,a[e])}}PreservesOpaqueness(){return this._preservesOpaqueness}HasAnyActiveBackgroundBlendingEffect(){return this._activeEffectTypes.some(e=>e.GetShaderProgram().BlendsBackground())}IsEffectIndexActive(e){return this._activeEffectFlags[e]}SetEffectIndexActive(e,t){this._activeEffectFlags[e]=!!t}GetAllEffectTypes(){return this._effectList.GetAllEffectTypes()}_SaveToJson(){return this._effectList.GetAllEffectTypes().map(e=>({"name":e.GetName(),"active":this._activeEffectFlags[e.GetIndex()],"params":C3.EffectList.SaveFxParamsToJson(this._effectParams[e.GetIndex()])}))}_LoadFromJson(e){for(const t of e){const e=this._effectList.GetEffectTypeByName(t["name"]);e&&(this._activeEffectFlags[e.GetIndex()]=t["active"],this._effectParams[e.GetIndex()]=C3.EffectList.LoadFxParamsFromJson(t["params"]))}this.UpdateActiveEffects(),this._UpdateAllEffectParamBuffers()}}; } // collisions/collisionEngine.js { const C3=self.C3,tempCandidates=[],tileCollRectCandidates=[],tempJumpthruRet=[],tempPolyA=C3.New(C3.CollisionPoly),tempPolyB=C3.New(C3.CollisionPoly),tempQuad=C3.New(C3.Quad2D),tempRect=C3.New(C3.Rect … [Строка слишком длинная. Вы можете скачать файл] } // collisions/sparseGrid.js { const C3=self.C3;C3.SparseGrid=class extends C3.DefendedBase{constructor(t,e){super(),this._cellWidth=t,this._cellHeight=e,this._cells=C3.New(C3.PairMap)}Release(){this._cells.Release(),this._cells=null}SetCellSize(t,e){if(!this._cells.IsEmpty())throw new Error("grid not empty");this._cellWidth=t,this._cellHeight=e}GetCell(t,e,l){let i=this._cells.Get(t,e);return i||(l?(i=C3.New(C3.GridCell,this,t,e),this._cells.Set(t,e,i),i):null)}XToCell(t){const e=Math.floor(t/this._cellWidth);return isFinite(e)?e:0}YToCell(t){const e=Math.floor(t/this._cellHeight);return isFinite(e)?e:0}Update(t,e,l){if(e)for(let i=e.getLeft(),s=e.getRight();i<=s;++i)for(let s=e.getTop(),o=e.getBottom();s<=o;++s){if(l&&l.containsPoint(i,s))continue;const e=this.GetCell(i,s,!1);e&&(e.Remove(t),e.IsEmpty()&&this._cells.Delete(i,s))}if(l)for(let i=l.getLeft(),s=l.getRight();i<=s;++i)for(let s=l.getTop(),o=l.getBottom();s<=o;++s)e&&e.containsPoint(i,s)||this.GetCell(i,s,!0).Insert(t)}QueryRange(t,e){let l=this.XToCell(t.getLeft());const i=this.YToCell(t.getTop()),s=this.XToCell(t.getRight()),o=this.YToCell(t.getBottom());if(isFinite(s)&&isFinite(o))for(;l<=s;++l)for(let t=i;t<=o;++t){const i=this.GetCell(l,t,!1);i&&i.Dump(e)}}}; } // collisions/gridCell.js { const C3=self.C3;C3.GridCell=class extends C3.DefendedBase{constructor(s,e,t){super(),this._grid=s,this._x=e,this._y=t,this._instances=C3.New(C3.ArraySet)}Release(){this._instances.Release(),this._instances=null,this._grid=null}IsEmpty(){return this._instances.IsEmpty()}Insert(s){this._instances.Add(s)}Remove(s){this._instances.Delete(s)}Dump(s){C3.appendArray(s,this._instances.GetArray())}}; } // collisions/ray.js { const C3=self.C3,PADDING=1e-6,NO_HIT=2;C3.Ray=class{constructor(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.dx=0,this.dy=0,this.rect=new C3.Rect,this.hitFraction=2,this.hitUid=null,this.hitNormal=0,this.hitNormalDx=0,this.hitNormalDy=0,this.hitX=0,this.hitY=0,this.distance=0,this.normalX=1,this.normalY=0,this.reflectionX=1,this.reflectionY=0}DidCollide(){return this.hitFraction<1.000001}Reset(){this.hitFraction=2}Set(t,i,s,h){return this.x1=t,this.y1=i,this.x2=s,this.y2=h,this.dx=s-t,this.dy=h-i,this.rect.set(t,i,s,h),this.rect.normalize(),this.hitFraction=2,this.hitUid=null,this.hitNormal=0,this.hitNormalDx=0,this.hitNormalDy=0,this.hitX=0,this.hitY=0,this.distance=0,this.normalX=1,this.normalY=0,this.reflectionX=1,this.reflectionY=0,this}Complete(){if(!1===this.DidCollide())return;const t=this.dx*this.hitFraction,i=this.dy*this.hitFraction,s=C3.hypot2DFast(t,i),h=t/s,e=i/s;this.distance=s-PADDING,this.hitX=this.x1+h*this.distance,this.hitY=this.y1+e*this.distance,this.hitNormal=Math.atan2(this.hitNormalDy,this.hitNormalDx)+Math.PI/2,this.normalX=Math.cos(this.hitNormal),this.normalY=Math.sin(this.hitNormal);const n=h*this.normalX+e*this.normalY;if(this.reflectionX=h-2*this.normalX*n,this.reflectionY=e-2*this.normalY*n,n>0){const t=Math.PI;this.hitNormal=C3.clampAngle(this.hitNormal+t),this.normalX=-this.normalX,this.normalY=-this.normalY}}TestInstanceSegment(t,i,s,h,e){const n=C3.rayIntersect(this.x1,this.y1,this.x2,this.y2,i,s,h,e);n>=0&&n<this.hitFraction&&(this.hitFraction=n,this.hitUid=t.GetUID(),this.hitNormalDx=i-h,this.hitNormalDy=s-e)}TestInstanceRect(t,i,s,h){const e=i+h.getLeft(),n=i+h.getRight(),a=s+h.getTop(),o=s+h.getBottom();this.TestInstanceSegment(t,e,a,n,a),this.TestInstanceSegment(t,n,a,n,o),this.TestInstanceSegment(t,n,o,e,o),this.TestInstanceSegment(t,e,o,e,a)}TestInstanceQuad(t,i){const s=i.getTlx(),h=i.getTly(),e=i.getTrx(),n=i.getTry(),a=i.getBrx(),o=i.getBry(),r=i.getBlx(),l=i.getBly();this.TestInstanceSegment(t,s,h,e,n),this.TestInstanceSegment(t,e,n,a,o),this.TestInstanceSegment(t,a,o,r,l),this.TestInstanceSegment(t,r,l,s,h)}TestInstancePoly(t,i,s,h){const e=h.pointsArr();for(let h=0,n=e.length;h<n;h+=2){const a=(h+2)%n,o=e[h]+i,r=e[h+1]+s,l=e[a]+i,c=e[a+1]+s;this.TestInstanceSegment(t,o,r,l,c)}}}; } // collisions/layerStateCache.js { const C3=self.C3;C3.LayerStateCache=class{constructor(){this._layerCache=new Map}Release(){for(const e of this._layerCache.values())e.layerPts.Clear();this._layerCache.clear()}_GetLayerCache(e){let a=this._layerCache.get(e);return void 0===a&&(a={isInteractive:null,layerPts:new C3.PairMap},this._layerCache.set(e,a)),a}IsInteractive(e){const a=this._GetLayerCache(e);return null===a.isInteractive&&(a.isInteractive=e.IsSelfAndParentsInteractive()),a.isInteractive}CanvasCssToLayer(e,a,t,s){if(0!==s)return e.CanvasCssToLayer(a,t,s);const r=this._GetLayerCache(e);let n=r.layerPts.Get(a,t);return void 0===n&&(n=e.CanvasCssToLayer(a,t,s),r.layerPts.Set(a,t,n)),n}}; } // canvasManager.js { const C3=self.C3,VALID_FULLSCREEN_MODES=new Set(["off","crop","scale-inner","integer-scale-inner","scale-outer","integer-scale-outer","letterbox-scale","letterbox-integer-scale"]),VALID_FULLSCREEN_SCA … [Строка слишком длинная. Вы можете скачать файл] } // runtime.js { const C3=globalThis.C3,C3X=globalThis.C3X,C3Debugger=globalThis.C3Debugger,assert=globalThis.assert,ISDKBehaviorInstanceBase=globalThis.ISDKBehaviorInstanceBase,DEFAULT_RUNTIME_OPTS={"messagePort":nul … [Строка слишком длинная. Вы можете скачать файл] } // workers/jobSchedulerRuntime.js { const C3=self.C3;C3.JobSchedulerRuntime=class extends C3.DefendedBase{constructor(r,e){super(),this._runtime=r,this._jobPromises=new Map,this._nextJobId=0,this._inputPort=e["inputPort"],e["outputPort"].onmessage=r=>this._OnJobWorkerMessage(r),this._maxNumWorkers=e["maxNumWorkers"],this._jobWorkerCount=1,this._isCreatingWorker=!1,this._hadErrorCreatingWorker=!1}GetMaxNumWorkers(){return this._maxNumWorkers}ImportScriptsToJobWorkers(r){this._inputPort.postMessage({"type":"_import_scripts","scripts":r})}SendBlobToJobWorkers(r,e){this._inputPort.postMessage({"type":"_send_blob","blob":r,"id":e})}SendBufferToJobWorkers(r,e){this._inputPort.postMessage({"type":"_send_buffer","buffer":r,"id":e},[r])}AddJob(r,e,o,s,t,i){if(o||(o=[]),"number"==typeof i&&(i=Math.floor(i))<=0)throw new Error("invalid maxWorkerNum");const n=this._nextJobId++,a={"type":r,"isBroadcast":!1,"maxWorkerNum":i,"jobId":n,"params":e,"transferables":o},_=new Promise((r,e)=>{this._jobPromises.set(n,{resolve:r,progress:s,reject:e,cancelled:!1,maxWorkerNum:i})});return t&&t.SetAction(()=>this._CancelJob(n)),this._inputPort.postMessage(a,o),this._MaybeCreateExtraWorker(),_}BroadcastJob(r,e,o,s){if(o||(o=[]),"number"==typeof s&&(s=Math.floor(s))<=0)throw new Error("invalid maxWorkerNum");const t={"type":r,"isBroadcast":!0,"maxWorkerNum":s,"jobId":this._nextJobId++,"params":e,"transferables":o};this._inputPort.postMessage(t,o)}_CancelJob(r){const e=this._jobPromises.get(r);e&&(e.cancelled=!0,e.resolve=null,e.progress=null,e.reject=null,this._inputPort.postMessage({"type":"_cancel","jobId":r}))}_OnJobWorkerMessage(r){const e=r.data,o=e["type"],s=e["jobId"];switch(o){case"result":this._OnJobResult(s,e["result"]);break;case"progress":this._OnJobProgress(s,e["progress"]);break;case"error":this._OnJobError(s,e["error"]);break;case"ready":this._OnJobWorkerReady();break;default:throw new Error(`unknown message from worker '${o}'`)}}_OnJobResult(r,e){const o=this._jobPromises.get(r);if(!o)throw new Error("invalid job ID");o.cancelled||o.resolve(e),this._jobPromises.delete(r)}_OnJobProgress(r,e){const o=this._jobPromises.get(r);if(!o)throw new Error("invalid job ID");!o.cancelled&&o.progress&&o.progress(e)}_OnJobError(r,e){const o=this._jobPromises.get(r);if(!o)throw new Error("invalid job ID");o.cancelled||o.reject(e),this._jobPromises.delete(r)}_OnJobWorkerReady(){this._isCreatingWorker&&(this._isCreatingWorker=!1,this._jobWorkerCount++,this._jobWorkerCount<this._maxNumWorkers?this._MaybeCreateExtraWorker():this._inputPort.postMessage({"type":"_no_more_workers"}))}_GetWorkerCountNeededForPendingJobs(){let r=0;const e=[...this._jobPromises.values()].sort((r,e)=>(r.maxWorkerNum||1/0)-(e.maxWorkerNum||1/0));for(const o of e){r<(o.maxWorkerNum||1/0)&&r++}return r}async _MaybeCreateExtraWorker(){if(!(this._jobWorkerCount>=this._maxNumWorkers||this._isCreatingWorker||this._hadErrorCreatingWorker||this._GetWorkerCountNeededForPendingJobs()<=this._jobWorkerCount))try{this._isCreatingWorker=!0;(await this._runtime.PostComponentMessageToDOMAsync("runtime","create-job-worker"))["outputPort"].onmessage=r=>this._OnJobWorkerMessage(r)}catch(r){this._hadErrorCreatingWorker=!0,this._isCreatingWorker=!1,console.error(`[Construct] Failed to create job worker; stopping creating any more (created ${this._jobWorkerCount} so far)`,r)}}}; } // scripts/shaders.js { self["C3_Shaders"] = {}; } // scripts/plugins/system/c3runtime/runtime.js { {const e=self.C3;let t=null,n="",r="",a=[],i="",s="",o="";const u=e.New(e.ArrayStack);function ForEachOrdered_SortInstances(e,t){const n=e[1],r=t[1];if("number"==typeof n&&"number"==typeof r)return n- … [Строка слишком длинная. Вы можете скачать файл] } // scripts/plugins/Sprite/c3runtime/runtime.js { {const t=self.C3;t.Plugins.Sprite=class extends t.SDKPluginBase{constructor(t){super(t)}Release(){super.Release()}}}{const t=self.C3,e=self.C3X,n=[];t.Plugins.Sprite.Type=class extends t.SDKTypeBase{c … [Строка слишком длинная. Вы можете скачать файл] } // scripts/plugins/Keyboard/c3runtime/runtime.js { {const e=self.C3;e.Plugins.Keyboard=class extends e.SDKPluginBase{constructor(e){super(e)}Release(){super.Release()}}}{const r=self.C3;self.C3X;r.Plugins.Keyboard.Type=class extends r.SDKTypeBase{constructor(e){super(e)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IKeyboardObjectType}};let t=null;function GetKeyboardSdkInstance(){return t.GetSingleGlobalInstance().GetSdkInstance()}self.IKeyboardObjectType=class extends self.IObjectType{constructor(e){super(e),t=e,e.GetRuntime()._GetCommonScriptInterfaces().keyboard=this}isKeyDown(e){const r=GetKeyboardSdkInstance();if("string"==typeof e)return r.IsKeyDown(e);if("number"==typeof e)return r.IsKeyCodeDown(e);throw new TypeError("expected string or number")}}}{const s=self.C3,n="keyboard";s.Plugins.Keyboard.Instance=class extends s.SDKInstanceBase{constructor(e,r){super(e,n),this._keysDownByString=new Set,this._keysDownByWhich=new Set,this._triggerWhich=0,this._triggerString="",this._triggerTypedKey="",this._isKeyboardLockSupported=!1;const t=this.GetRuntime().Dispatcher();this._disposables=new s.CompositeDisposable(s.Disposable.From(t,"keydown",e=>this._OnKeyDown(e.data)),s.Disposable.From(t,"keyup",e=>this._OnKeyUp(e.data)),s.Disposable.From(t,"window-blur",()=>this._OnWindowOrKeyboardBlur()),s.Disposable.From(t,"keyboard-blur",()=>this._OnWindowOrKeyboardBlur())),this._runtime.AddLoadPromise(this._Init())}Release(){super.Release()}async _Init(){const e=await this.PostToDOMAsync("init");this._isKeyboardLockSupported=e["isKeyboardLockSupported"]}_OnKeyDown(e){const r=e["which"],t=e["code"]||r.toString(),n=e["key"];this._keysDownByString.has(t)||(this._keysDownByString.add(t),this._keysDownByWhich.add(r),this._triggerString=t,this._triggerWhich=r,this._triggerTypedKey=n,this.Trigger(s.Plugins.Keyboard.Cnds.OnAnyKey),this.Trigger(s.Plugins.Keyboard.Cnds.OnKey),this.Trigger(s.Plugins.Keyboard.Cnds.OnLeftRightKeyPressed),this.Trigger(s.Plugins.Keyboard.Cnds.OnKeyCode))}_OnKeyUp(e){const r=e["which"],t=e["code"]||r.toString(),n=e["key"];this._keysDownByString.delete(t),this._keysDownByWhich.delete(r),this._triggerString=t,this._triggerWhich=r,this._triggerTypedKey=n,this.Trigger(s.Plugins.Keyboard.Cnds.OnAnyKeyReleased),this.Trigger(s.Plugins.Keyboard.Cnds.OnKeyReleased),this.Trigger(s.Plugins.Keyboard.Cnds.OnLeftRightKeyReleased),this.Trigger(s.Plugins.Keyboard.Cnds.OnKeyCodeReleased)}_OnWindowOrKeyboardBlur(){for(const e of this._keysDownByWhich)this._keysDownByWhich.delete(e),this._triggerWhich=e,this.Trigger(s.Plugins.Keyboard.Cnds.OnAnyKeyReleased),this.Trigger(s.Plugins.Keyboard.Cnds.OnKeyReleased),this.Trigger(s.Plugins.Keyboard.Cnds.OnKeyCodeReleased);this._keysDownByString.clear()}IsKeyDown(e){return this._keysDownByString.has(e)}IsKeyCodeDown(e){return this._keysDownByWhich.has(e)}SaveToJson(){return{"tk":this._triggerWhich,"tkk":this._triggerTypedKey}}LoadFromJson(e){this._triggerWhich=e["tk"],e.hasOwnProperty("tkk")&&(this._triggerTypedKey=e["tkk"])}GetDebuggerProperties(){const e="plugins.keyboard";return[{title:e+".name",properties:[{name:e+".debugger.last-key-code",value:this._triggerWhich},{name:e+".debugger.last-key-string",value:s.Plugins.Keyboard.Exps.StringFromKeyCode(this._triggerWhich)},{name:e+".debugger.last-typed-key",value:this._triggerTypedKey}]}]}}}{const i=self.C3,a=["ShiftLeft","ShiftRight","ControlLeft","ControlRight","AltLeft","AltRight","MetaLeft","MetaRight"];i.Plugins.Keyboard.Cnds={IsKeyDown(e){return this._keysDownByWhich.has(e)},OnKey(e){return this._triggerWhich===e},OnAnyKey:()=>!0,OnAnyKeyReleased:()=>!0,OnKeyReleased(e){return this._triggerWhich===e},IsKeyCodeDown(e){return e=Math.floor(e),this._keysDownByWhich.has(e)},OnKeyCode(e){return this._triggerWhich===e},OnKeyCodeReleased(e){return this._triggerWhich===e},OnLeftRightKeyPressed(e){const r=a[e];return this._triggerString===r},OnLeftRightKeyReleased(e){const r=a[e];return this._triggerString===r},IsLeftRightKeyDown(e){const r=a[e];return this._keysDownByString.has(r)},IsKeyboardLockSupported(){return this._isKeyboardLockSupported},OnKeyboardLocked:()=>!0,OnKeyboardLockError:()=>!0}}{const o=self.C3;o.Plugins.Keyboard.Acts={async LockKeyboard(e){if(!this._isKeyboardLockSupported)return;let r=[];e&&(r=e.split(","));(await this.PostToDOMAsync("lock-keyboard",{"keysArr":r}))["isOk"]?this.Trigger(o.Plugins.Keyboard.Cnds.OnKeyboardLocked):this.Trigger(o.Plugins.Keyboard.Cnds.OnKeyboardLockError)},UnlockKeyboard(){this._isKeyboardLockSupported&&this.PostToDOMAsync("unlock-keyboard")}}}{function StringFromCharCode(e){switch(e=Math.floor(e)){case 8:return"backspace";case 9:return"tab";case 13:return"enter";case 16:return"shift";case 17:return"control";case 18:return"alt";case 19:return"pause";case 20:return"capslock";case 27:return"esc";case 33:return"pageup";case 34:return"pagedown";case 35:return"end";case 36:return"home";case 37:return"←";case 38:return"↑";case 39:return"→";case 40:return"↓";case 45:return"insert";case 46:return"del";case 91:return"left window key";case 92:return"right window key";case 93:return"select";case 96:return"numpad 0";case 97:return"numpad 1";case 98:return"numpad 2";case 99:return"numpad 3";case 100:return"numpad 4";case 101:return"numpad 5";case 102:return"numpad 6";case 103:return"numpad 7";case 104:return"numpad 8";case 105:return"numpad 9";case 106:return"numpad *";case 107:return"numpad +";case 109:return"numpad -";case 110:return"numpad .";case 111:return"numpad /";case 112:return"F1";case 113:return"F2";case 114:return"F3";case 115:return"F4";case 116:return"F5";case 117:return"F6";case 118:return"F7";case 119:return"F8";case 120:return"F9";case 121:return"F10";case 122:return"F11";case 123:return"F12";case 144:return"numlock";case 145:return"scroll lock";case 186:return";";case 187:return"=";case 188:return",";case 189:return"-";case 190:return".";case 191:return"/";case 192:return"'";case 219:return"[";case 220:return"\\";case 221:return"]";case 222:return"#";case 223:return"`";default:return String.fromCharCode(e)}}self.C3.Plugins.Keyboard.Exps={LastKeyCode(){return this._triggerWhich},StringFromKeyCode:e=>StringFromCharCode(e),TypedKey(){return this._triggerTypedKey}}} } // scripts/behaviors/solid/c3runtime/runtime.js { {const e=self.C3;e.Behaviors.solid=class extends e.SDKBehaviorBase{constructor(e){super(e)}Release(){super.Release()}}}{const e=self.C3;e.Behaviors.solid.Type=class extends e.SDKBehaviorTypeBase{constructor(e){super(e)}Release(){super.Release()}OnCreate(){}}}{const e=self.C3,s=self.C3X,t=self.IBehaviorInstance,a=0,n=1,i=2,r=new Set;e.Behaviors.solid.Instance=class extends e.SDKBehaviorInstanceBase{constructor(s,t){super(s),this.SetEnabled(!0),t&&(this.SetEnabled(t[a]),this._SetUsesInstanceTags(t[n]),this.SetTags(e.splitStringAndNormalize(t[i])))}Release(){super.Release()}SetEnabled(e){this._inst._SetSolidEnabled(!!e)}IsEnabled(){return this._inst._IsSolidEnabled()}_SetUsesInstanceTags(e){this._inst._SetSolidUsingInstanceTags(e)}UsesInstanceTags(){return this._inst._IsSolidUsingInstanceTags()}SetTags(e){const s=this._inst.GetSavedDataMap();let t=s.get("solidTags");t||(t=new Set,s.set("solidTags",t)),t.clear();for(const s of e)t.add(s.toLowerCase());0===t.size&&s.delete("solidTags")}GetTags(){return this._inst.GetSavedDataMap().get("solidTags")||r}_GetTagsString(){return[...this.GetTags()].join(" ")}SaveToJson(){return{"e":this.IsEnabled(),"it":this.UsesInstanceTags()}}LoadFromJson(e){this.SetEnabled(e["e"]),this._SetUsesInstanceTags(!!e["it"])}GetPropertyValueByIndex(e){if(e===a)return this.IsEnabled()}SetPropertyValueByIndex(e,s){if(e===a)this.SetEnabled(s)}GetDebuggerProperties(){const s=[{name:"behaviors.solid.properties.enabled.name",value:this.IsEnabled(),onedit:e=>this.SetEnabled(e)},{name:"behaviors.solid.properties.use-instance-tags.name",value:this.UsesInstanceTags()}];return this.UsesInstanceTags()||s.push({name:"behaviors.solid.properties.tags.name",value:this._GetTagsString(),onedit:s=>this.SetTags(e.splitStringAndNormalize(s))}),[{title:"$"+this.GetBehaviorType().GetName(),properties:s}]}GetScriptInterfaceClass(){return self.ISolidBehaviorInstance}},self.ISolidBehaviorInstance=class extends t{#e;constructor(){super(),this.#e=t._GetInitInst().GetSdkInstance()}set isEnabled(e){this.#e.SetEnabled(!!e)}get isEnabled(){return this.#e.IsEnabled()}get usesInstanceTags(){return this.#e.UsesInstanceTags()}set tags(t){this.runtime._logDeprecationWarning("ISolidBehaviorInstance.tags","ISolidBehaviorInstance 'tags' property is deprecated. Use instance tags instead."),s.RequireString(t),this.#e.SetTags(e.splitStringAndNormalize(t))}get tags(){return this.runtime._logDeprecationWarning("ISolidBehaviorInstance.tags","ISolidBehaviorInstance 'tags' property is deprecated. Use instance tags instead."),this.#e._GetTagsString()}setAllTags(e){this.runtime._logDeprecationWarning("ISolidBehaviorInstance.setAllTags","ISolidBehaviorInstance 'setAllTags' method is deprecated. Use instance tags instead."),this.#e.SetTags(e)}getAllTags(){return this.runtime._logDeprecationWarning("ISolidBehaviorInstance.getAllTags","ISolidBehaviorInstance 'getAllTags' method is deprecated. Use instance tags instead."),new Set(this.#e.GetTags())}}}self.C3.Behaviors.solid.Cnds={IsEnabled(){return this.IsEnabled()}};{const e=self.C3;e.Behaviors.solid.Acts={SetEnabled(e){this.SetEnabled(e)},SetTags(s){this.SetTags(e.splitStringAndNormalize(s))}}}self.C3.Behaviors.solid.Exps={}; } // scripts/behaviors/Rotate/c3runtime/runtime.js { {const e=self.C3;e.Behaviors.Rotate=class extends e.SDKBehaviorBase{constructor(e){super(e)}Release(){super.Release()}}}{const e=self.C3;e.Behaviors.Rotate.Type=class extends e.SDKBehaviorTypeBase{constructor(e){super(e)}Release(){super.Release()}OnCreate(){}}}{const e=self.C3,t=self.C3X,s=self.IBehaviorInstance,a=0,i=1,n=2;e.Behaviors.Rotate.Instance=class extends e.SDKBehaviorInstanceBase{constructor(t,s){super(t),this._speed=0,this._acceleration=0,this._isEnabled=!0,s&&(this._speed=e.toRadians(s[a]),this._acceleration=e.toRadians(s[i]),this._isEnabled=s[n]),this._isEnabled&&this._StartTicking()}Release(){super.Release()}_SetSpeed(e){this._speed=e}_GetSpeed(){return this._speed}_SetAcceleration(e){this._acceleration=e}_GetAcceleration(){return this._acceleration}SaveToJson(){return{"s":this._speed,"a":this._acceleration,"e":this._isEnabled}}LoadFromJson(e){this._speed=e["s"],this._acceleration=e["a"],this._SetEnabled(e["e"])}Tick(){if(!this._isEnabled)return;const e=this._runtime.GetDt(this._inst);if(0!==e&&(0!==this._acceleration&&(this._speed+=this._acceleration*e),0!==this._speed)){const t=this._inst.GetWorldInfo();t.SetAngle(t.GetAngle()+this._speed*e),t.SetBboxChanged()}}GetPropertyValueByIndex(t){switch(t){case a:return e.toDegrees(this._GetSpeed());case i:return e.toDegrees(this._GetAcceleration());case n:return this._IsEnabled()}}SetPropertyValueByIndex(t,s){switch(t){case a:this._SetSpeed(e.toRadians(s));break;case i:this._SetAcceleration(e.toRadians(s));break;case n:this._SetEnabled(s)}}_SetEnabled(e){this._isEnabled=!!e,this._isEnabled?this._StartTicking():this._StopTicking()}_IsEnabled(){return this._isEnabled}GetDebuggerProperties(){const t="behaviors.rotate";return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:t+".properties.speed.name",value:e.toDegrees(this._GetSpeed()),onedit:t=>this._SetSpeed(e.toRadians(t))},{name:t+".properties.acceleration.name",value:e.toDegrees(this._GetAcceleration()),onedit:t=>this._SetAcceleration(e.toRadians(t))},{name:t+".properties.enabled.name",value:this._IsEnabled(),onedit:e=>this._SetEnabled(e)}]}]}GetScriptInterfaceClass(){return self.IRotateBehaviorInstance}};const r=new WeakMap;self.IRotateBehaviorInstance=class extends s{constructor(){super(),r.set(this,s._GetInitInst().GetSdkInstance())}set speed(e){t.RequireFiniteNumber(e),r.get(this)._SetSpeed(e)}get speed(){return r.get(this)._GetSpeed()}set acceleration(e){t.RequireFiniteNumber(e),r.get(this)._SetAcceleration(e)}get acceleration(){return r.get(this)._GetAcceleration()}get isEnabled(){return r.get(this)._IsEnabled()}set isEnabled(e){r.get(this)._SetEnabled(e)}}}self.C3.Behaviors.Rotate.Cnds={IsEnabled(){return this._IsEnabled()}};{const e=self.C3;e.Behaviors.Rotate.Acts={SetSpeed(t){this._SetSpeed(e.toRadians(t))},SetAcceleration(t){this._SetAcceleration(e.toRadians(t))},SetEnabled(e){this._SetEnabled(e)}}}{const e=self.C3;e.Behaviors.Rotate.Exps={Speed(){return e.toDegrees(this._GetSpeed())},Acceleration(){return e.toDegrees(this._GetAcceleration())}}} } // scripts/expTable.js { const C3 = self.C3; function unaryminus(n) { return (typeof n === "number" ? -n : n); } function bothNumbers(a, b) { return typeof a === "number" && typeof b === "number"; } function add(l, r) { if (bothNumbers(l, r)) return l + r; else return l; } function subtract(l, r) { if (bothNumbers(l, r)) return l - r; else return l; } function multiply(l, r) { if (bothNumbers(l, r)) return l * r; else return l; } function divide(l, r) { if (bothNumbers(l, r)) return l / r; else return l; } function mod(l, r) { if (bothNumbers(l, r)) return l % r; else return l; } function pow(l, r) { if (bothNumbers(l, r)) return Math.pow(l, r); else return l; } function and(l, r) { if (typeof l === "string" || typeof r === "string") { // & with either side string does string concatenation let lstr, rstr; if (typeof l === "number") lstr = (Math.round(l * 1e10) / 1e10).toString(); else lstr = l; if (typeof r === "number") rstr = (Math.round(r * 1e10) / 1e10).toString(); else rstr = r; return lstr + rstr; } else { // & with neither side a string does logical AND return (l && r ? 1 : 0); } } function or(l, r) { if (bothNumbers(l, r)) return (l || r ? 1 : 0); else return l; } self.C3_ExpressionFuncs = [ () => "Gravity System", () => 81, () => 0, p => { const n0 = p._GetNode(0); const n1 = p._GetNode(1); const n2 = p._GetNode(2); const n3 = p._GetNode(3); return () => C3.toDegrees(C3.angleTo(n0.ExpObject(), n1.ExpObject(), n2.ExpObject(), n3.ExpObject())); }, p => { const n0 = p._GetNode(0); const n1 = p._GetNode(1); const n2 = p._GetNode(2); const f3 = p._GetNode(3).GetBoundMethod(); return () => (n0.ExpInstVar() + (((Math.cos(C3.toRadians(n1.ExpInstVar())) * n2.ExpInstVar()) * f3()) * 50)); }, p => { const n0 = p._GetNode(0); const n1 = p._GetNode(1); const n2 = p._GetNode(2); const f3 = p._GetNode(3).GetBoundMethod(); return () => (n0.ExpInstVar() + (((Math.sin(C3.toRadians(n1.ExpInstVar())) * n2.ExpInstVar()) * f3()) * 50)); }, p => { const n0 = p._GetNode(0); return () => (n0.ExpInstVar() - 90); }, p => { const n0 = p._GetNode(0); const n1 = p._GetNode(1); const f2 = p._GetNode(2).GetBoundMethod(); return () => (n0.ExpObject() + (n1.ExpInstVar() * f2())); }, p => { const n0 = p._GetNode(0); const n1 = p._GetNode(1); return () => (n0.ExpObject() - (Math.cos(C3.toRadians(n1.ExpInstVar())) * 2)); }, p => { const n0 = p._GetNode(0); const n1 = p._GetNode(1); return () => (n0.ExpObject() - (Math.sin(C3.toRadians(n1.ExpInstVar())) * 2)); }, p => { const n0 = p._GetNode(0); const n1 = p._GetNode(1); return () => (n0.ExpInstVar() - (Math.cos(C3.toRadians(n1.ExpInstVar())) * 400)); }, p => { const n0 = p._GetNode(0); const n1 = p._GetNode(1); return () => (n0.ExpInstVar() - (Math.sin(C3.toRadians(n1.ExpInstVar())) * 400)); }, p => { const n0 = p._GetNode(0); const n1 = p._GetNode(1); const f2 = p._GetNode(2).GetBoundMethod(); return () => (n0.ExpInstVar() + ((Math.cos(C3.toRadians((n1.ExpInstVar() - 90))) * 1500) * f2())); }, p => { const n0 = p._GetNode(0); const n1 = p._GetNode(1); const f2 = p._GetNode(2).GetBoundMethod(); return () => (n0.ExpInstVar() + ((Math.sin(C3.toRadians((n1.ExpInstVar() - 90))) * 1500) * f2())); }, p => { const n0 = p._GetNode(0); const n1 = p._GetNode(1); const f2 = p._GetNode(2).GetBoundMethod(); return () => (n0.ExpInstVar() + ((Math.cos(C3.toRadians((n1.ExpInstVar() + 90))) * 1500) * f2())); }, p => { const n0 = p._GetNode(0); const n1 = p._GetNode(1); const f2 = p._GetNode(2).GetBoundMethod(); return () => (n0.ExpInstVar() + ((Math.sin(C3.toRadians((n1.ExpInstVar() + 90))) * 1500) * f2())); }, p => { const n0 = p._GetNode(0); return () => (n0.ExpInstVar() * 0.85); }, p => { const v0 = p._GetNode(0).GetVar(); return () => (v0.GetValue() + 1); }, p => { const v0 = p._GetNode(0).GetVar(); return () => v0.GetValue(); } ]; }