@minecraft/creator-tools
Version:
Minecraft Creator Tools command line and libraries.
1 lines • 1.46 MB
JavaScript
(()=>{var e,t,i={428:(e,t,i)=>{"use strict";i.d(t,{A:()=>c});var s=i(14466),n=i(46882),a=i(59701),r=i(67687),o=i(51044),l=i(40267),d=i(77452);class c{_data;_file;_isLoaded=!1;_loadedWithComments=!1;_onLoaded=new n.Qe;get isLoaded(){return this._isLoaded}get file(){return this._file}get data(){return this._data}get onLoaded(){return this._onLoaded.asEvent()}set file(e){this._file=e}get textureData(){if(this._data)return void 0===this._data.texture_data&&(this._data.texture_data={}),this._data.texture_data}getCanonicalizedTexturePathList(){if(!this._data||!this._data.texture_data)return;const e=[];for(const t in this._data.texture_data){const i=this._data.texture_data[t];if(i&&i.textures)if("string"==typeof i.textures){const t=d.A.canonicalizeTexturePath(i.textures);t&&e.push(t)}else if(Array.isArray(i.textures))for(const t of i.textures)if("string"==typeof t){const i=d.A.canonicalizeTexturePath(t);i&&e.push(i)}else if(t){let i=t.path;"string"==typeof i&&(i=d.A.canonicalizeTexturePath(i),i&&e.push(i))}}return e}getTexturePathList(){if(!this._data||!this._data.texture_data)return;const e=[];for(const t in this._data.texture_data){const i=this._data.texture_data[t];if(i&&i.textures)if("string"==typeof i.textures)e.push(i.textures);else if(Array.isArray(i.textures))for(const t of i.textures)if("string"==typeof t){const i=d.A.canonicalizeTexturePath(t);i&&e.push(i)}else if(t){let i=t.path;"string"==typeof i&&(i=d.A.canonicalizeTexturePath(i),i&&e.push(i))}}return e}get texturesIdList(){if(!this._data||!this._data.texture_data)return;const e=[];for(const t in this._data.texture_data)e.push(t);return e}static async ensureOnFile(e,t){let i;return void 0===e.manager&&(i=new c,i.file=e,e.manager=i),void 0!==e.manager&&e.manager instanceof c&&(i=e.manager,i.isLoaded||(t&&i.onLoaded.subscribe(t),await i.load())),i}persist(){return void 0!==this._file&&!!this._data&&this._file.setObjectContentIfSemanticallyDifferent(this._data)}getPackRootFolder(){let e;if(this.file&&this.file.parentFolder){let t=this.file.parentFolder;e=a.Ay.getParentOfParentFolderNamed("textures",t)}return e}getTextureReferences(){const e=[];if(this.data?.texture_data)for(const t in this.data.texture_data){const i=this.data.texture_data[t];i&&i.textures&&(e.includes(t)||e.push(t))}return e}async addChildItems(e,t){const i=e.getItemsByType(r.bD.texture);let s=this.getPackRootFolder(),n=this.getCanonicalizedTexturePathList();for(const e of i)if(s&&n&&(e.isContentLoaded||await e.loadContent(),e.primaryFile)){let i=d.A.canonicalizeTexturePath(a.Ay.getBaseRelativePath(e.primaryFile,s));i&&n&&n.includes(i)&&(t.addChildItem(e),n=o.A.removeItemInArray(i,n))}if(n)for(const e of n)t.addUnfulfilledRelationship(e,r.bD.texture,await l.A.isVanillaToken(e))}async load(e=!1){if(this._isLoaded&&this._loadedWithComments)return;if(this._isLoaded&&!e)return;if(void 0===this._file)return void s.Ay.unexpectedUndefined("ITCDF");if(this._file.isContentLoaded||await this._file.loadContent(),!this._file.content||this._file.content instanceof Uint8Array)return this._isLoaded=!0,this._loadedWithComments=e,void this._onLoaded.dispatch(this,this);let t={},i=e?a.Ay.getJsonObjectWithComments(this._file):a.Ay.getJsonObject(this._file);i&&(t=i),this._data=t,this._isLoaded=!0,this._loadedWithComments=e,this._onLoaded.dispatch(this,this)}}},652:(e,t,i)=>{"use strict";i.d(t,{OL:()=>r});var s=i(14466);const n=[{geometryPatterns:["geometry.cat","geometry.ocelot.v1.8"],reason:"Body cube modeled vertically [4,16,6] — Minecraft hardcodes per-cube 90° X rotation (matches cow.v2 convention)",boneTransforms:[{boneName:"body",setCubeRotation:[90,0,0]}]},{geometryPatterns:["geometry.sheep.sheared.v1.8","geometry.sheep.v1.8*"],reason:"Sheep legs are in world coordinates — detach from rotated body bone",boneTransforms:[{boneName:"leg0",removeParent:!0},{boneName:"leg1",removeParent:!0},{boneName:"leg2",removeParent:!0},{boneName:"leg3",removeParent:!0}]},{geometryPatterns:["geometry.turtle","geometry.turtle.*"],reason:"Turtle head/flippers are in world coordinates — detach from rotated body",boneTransforms:[{boneName:"head",removeParent:!0},{boneName:"leg0",removeParent:!0,addCubeOriginOffset:[0,0,-27]},{boneName:"leg1",removeParent:!0,addCubeOriginOffset:[0,0,-27]},{boneName:"leg2",removeParent:!0,addCubeOriginOffset:[0,0,-23]},{boneName:"leg3",removeParent:!0,addCubeOriginOffset:[0,0,-23]}]},{geometryPatterns:["geometry.enderman*"],reason:"Replicates animation.enderman.base_pose offsets + head-to-top lift",boneTransforms:[{boneName:"body",addCubeOriginOffset:[0,11,0]},{boneName:"head",addCubeOriginOffset:[0,25,0]},{boneName:"hat",addCubeOriginOffset:[0,11,0]},{boneName:"rightArm",addCubeOriginOffset:[-4,11,0]},{boneName:"leftArm",addCubeOriginOffset:[4,11,0]},{boneName:"rightLeg",addCubeOriginOffset:[0,6,0]},{boneName:"leftLeg",addCubeOriginOffset:[0,6,0]}]}];function a(e,t){const i=e.toLowerCase(),s=t.toLowerCase();if(s.includes("*")){const e=s.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*");return new RegExp("^"+e+"$").test(i)}return i===s}function r(e,t){const i=function(e){for(const t of n)for(const i of t.geometryPatterns)if(a(e,i))return s.Ay.verbose(`VanillaGeometryTransforms: Found transform for ${e} (pattern: ${i})`),t}(t);if(!i)return e;s.Ay.verbose(`VanillaGeometryTransforms: Applying transforms to ${t}: ${i.reason}`);const r=JSON.parse(JSON.stringify(e));if(!r.bones)return r;for(const e of i.boneTransforms)for(const t of r.bones)if("*"===e.boneName||t.name===e.boneName){if(s.Ay.verbose(`VanillaGeometryTransforms: Transforming bone "${t.name}"`),void 0!==e.setBindPoseRotation&&(t.bind_pose_rotation=[...e.setBindPoseRotation],s.Ay.verbose(` - Set bind_pose_rotation to [${t.bind_pose_rotation.join(", ")}]`)),void 0!==e.addBindPoseRotation){const i=t.bind_pose_rotation||[0,0,0];t.bind_pose_rotation=[i[0]+e.addBindPoseRotation[0],i[1]+e.addBindPoseRotation[1],i[2]+e.addBindPoseRotation[2]],s.Ay.verbose(` - Added to bind_pose_rotation, now [${t.bind_pose_rotation.join(", ")}]`)}if(void 0!==e.setPivot&&(t.pivot=[...e.setPivot],s.Ay.verbose(` - Set pivot to [${t.pivot.join(", ")}]`)),void 0!==e.addPivotOffset){const i=t.pivot||[0,0,0];t.pivot=[i[0]+e.addPivotOffset[0],i[1]+e.addPivotOffset[1],i[2]+e.addPivotOffset[2]],s.Ay.verbose(` - Added to pivot, now [${t.pivot.join(", ")}]`)}if(void 0!==e.addCubeOriginOffset&&t.cubes){for(const i of t.cubes)i.origin&&(i.origin=[i.origin[0]+e.addCubeOriginOffset[0],i.origin[1]+e.addCubeOriginOffset[1],i.origin[2]+e.addCubeOriginOffset[2]]);s.Ay.verbose(` - Added offset to ${t.cubes.length} cube origins`)}if(void 0!==e.setCubeRotation&&t.cubes){const i=t.pivot||[0,0,0];for(const s of t.cubes)s.rotation=[...e.setCubeRotation],s.pivot=[...i];s.Ay.verbose(` - Set per-cube rotation [${e.setCubeRotation.join(", ")}] on ${t.cubes.length} cubes (pivot: [${i.join(", ")}])`)}e.removeParent&&(delete t.parent,s.Ay.verbose(" - Removed parent")),void 0!==e.setParent&&(null===e.setParent?delete t.parent:t.parent=e.setParent,s.Ay.verbose(` - Set parent to "${t.parent||"(none)"}"`))}return r}},941:(e,t,i)=>{"use strict";i.d(t,{A:()=>c});var s=i(14466),n=i(46882),a=i(59701),r=i(67687),o=i(51044),l=i(40267),d=i(77452);class c{jsonUIScreen;_file;_isLoaded=!1;_loadedWithComments=!1;_onLoaded=new n.Qe;get isLoaded(){return this._isLoaded}get file(){return this._file}get onLoaded(){return this._onLoaded.asEvent()}set file(e){this._file=e}get namespaceId(){if(this.jsonUIScreen&&this.jsonUIScreen.namespace)return this.jsonUIScreen.namespace}static async ensureOnFile(e,t){let i;return void 0===e.manager&&(i=new c,i.file=e,e.manager=i),void 0!==e.manager&&e.manager instanceof c&&(i=e.manager,i.isLoaded||(t&&i.onLoaded.subscribe(t),await i.load())),i}persist(){return void 0!==this._file&&(this.jsonUIScreen?this._file.setObjectContentIfSemanticallyDifferent(this.jsonUIScreen):(s.Ay.unexpectedUndefined("ITRDP"),!1))}getControlRefs(){const e=[];if(this.namespaceId&&this.jsonUIScreen)for(const t in this.jsonUIScreen){const i=this.jsonUIScreen[t];"namespace"!==t&&i&&i.texture&&(e.includes(t)||e.push(t))}return e}getTexturePaths(){const e=[];return this.jsonUIScreen&&this.addTexturesFromArrayOfKeyPaths([this.jsonUIScreen],e),e}addTexturesFromArrayOfKeyPaths(e,t){if(Array.isArray(e))for(const i of e)for(const e in i){const s=i[e];if("namespace"!==e&&"controls"!==e)if("string"==typeof s)t.push(s);else{if(s.texture){const e=d.A.canonicalizeTexturePath(s.texture);e&&t.push(e)}s.controls&&this.addTexturesFromArrayOfKeyPaths(s.controls,t)}}}async load(e=!1){if(this._isLoaded&&this._loadedWithComments)return;if(this._isLoaded&&!e)return;if(void 0===this._file)return void s.Ay.unexpectedUndefined("PERPF");if(this._file.isContentLoaded||await this._file.loadContent(),!this._file.content||this._file.content instanceof Uint8Array)return this._isLoaded=!0,this._loadedWithComments=e,void this._onLoaded.dispatch(this,this);let t={},i=e?a.Ay.getJsonObjectWithComments(this._file):a.Ay.getJsonObject(this._file);i&&(t=i),this.jsonUIScreen=t,this._isLoaded=!0,this._loadedWithComments=e,this._onLoaded.dispatch(this,this)}getPackRootFolder(){let e;if(this.file&&this.file.parentFolder){let t=this.file.parentFolder;e=a.Ay.getParentOfParentFolderNamed("ui",t)}return e}async addChildItems(e,t){const i=[...e.getItemsByType(r.bD.texture),...e.getItemsByType(r.bD.uiTexture)];let s=this.getPackRootFolder(),n=this.getTexturePaths();if(n.length>0){for(const e of i)if(s&&n&&(e.isContentLoaded||await e.loadContent(),e.primaryFile)){let i=d.A.canonicalizeTexturePath(a.Ay.getBaseRelativePath(e.primaryFile,s));i&&n&&n.includes(i)&&(t.addChildItem(e),n=o.A.removeItemInArray(i,n))}if(n)for(const e of n)if(!e.startsWith("$")){const i=await l.A.isVanillaToken(e);t.addUnfulfilledRelationship(e,r.bD.texture,i)}}}}},1001:(e,t,i)=>{"use strict";i.d(t,{A:()=>C});var s=i(44412),n=i(67687),a=i(72327),r=i(14466),o=i(75236),l=i(59701),d=i(23121),c=i(53058),h=i(87897),u=i(70979),f=i(60382),m=i(46882);const p=["esbenp.prettier-vscode","blockceptionltd.blockceptionvscodeminecraftbedrockdevelopmentextension","mojang-studios.minecraft-debugger"];class g{_file;_id;_isLoaded=!1;definition;_onLoaded=new m.Qe;get isLoaded(){return this._isLoaded}get file(){return this._file}set file(e){this._file=e}get onLoaded(){return this._onLoaded.asEvent()}get id(){return this._id}set id(e){this._id=e}static async ensureOnFile(e,t){let i;return void 0===e.manager&&(i=new g,i.file=e,e.manager=i),void 0!==e.manager&&e.manager instanceof g?(i=e.manager,!i.isLoaded&&t&&i.onLoaded.subscribe(t),await i.load(),i):i}async persist(){return void 0!==this._file&&(r.Ay.assert(null!==this.definition,"VSED"),!!this.definition&&this._file.setObjectContentIfSemanticallyDifferent(this.definition))}async save(){void 0!==this._file&&await this.persist()&&await this._file.saveContent(!1)}async hasMinContent(){if(await this.load(),!this.definition||!this.definition.recommendations)return!1;for(const e of p)if(!this.definition.recommendations.includes(e))return!1;return!0}async ensureMinContent(){if(await this.hasMinContent())return!0;this.definition||(this.definition={recommendations:[]}),this.definition.recommendations||(this.definition.recommendations=[]);for(const e of p)this.definition.recommendations.includes(e)||this.definition.recommendations.push(e);return this.definition}async load(){if(!(void 0===this._file||this._isLoaded||(await this._file.loadContent(),null===this._file.content||this._file.content instanceof Uint8Array))){this.id=this._file.name;try{const e=JSON.parse(this._file.content);this.definition=e}catch(e){r.Ay.fail("Could not parse vscode launch JSON "+e)}this._isLoaded=!0}}}const y={"[javascript]":{"editor.defaultFormatter":"esbenp.prettier-vscode"},"[typescript]":{"editor.defaultFormatter":"esbenp.prettier-vscode"},"[typescriptreact]":{"editor.defaultFormatter":"esbenp.prettier-vscode"},"[json]":{"editor.defaultFormatter":"esbenp.prettier-vscode"},"git.ignoreLimitWarning":!0,"editor.formatOnSave":!0,"search.exclude":{"**/.git":!0,"**/node_modules":!0,"**/dist":!0,"**/lib":!0},"files.exclude":{"**/.git":!0,"**/.DS_Store":!0,"**/node_modules":!0},"cSpell.words":["gametest","gametests","mcaddon"],"editor.tabSize":2,"eslint.experimental.useFlatConfig":!0};class v{_file;_id;_isLoaded=!1;definition;_onLoaded=new m.Qe;get isLoaded(){return this._isLoaded}get file(){return this._file}set file(e){this._file=e}get onLoaded(){return this._onLoaded.asEvent()}get id(){return this._id}set id(e){this._id=e}static async ensureOnFile(e,t){let i;return void 0===e.manager&&(i=new v,i.file=e,e.manager=i),void 0!==e.manager&&e.manager instanceof v?(i=e.manager,!i.isLoaded&&t&&i.onLoaded.subscribe(t),await i.load(),i):i}async persist(){return void 0!==this._file&&(r.Ay.assert(null!==this.definition,"VCSP"),!!this.definition&&this._file.setObjectContentIfSemanticallyDifferent(this.definition))}async save(){void 0!==this._file&&await this.persist()&&await this._file.saveContent(!1)}async hasMinContent(){if(await this.load(),!this.definition)return!1;for(const e in y)if(void 0===this.definition[e])return!1;return!0}async ensureMinContent(){if(await this.hasMinContent())return!0;this.definition||(this.definition=y);for(const e in y)void 0===this.definition[e]&&(this.definition[e]=y[e]);return this.definition}async load(){if(!(void 0===this._file||this._isLoaded||(await this._file.loadContent(),null===this._file.content||this._file.content instanceof Uint8Array))){this.id=this._file.name;try{const e=JSON.parse(this._file.content);this.definition=e}catch(e){r.Ay.fail("Could not parse vscode launch JSON "+e)}this._isLoaded=!0}}}const b={trailingComma:"es5",tabWidth:2,semi:!0,singleQuote:!1,bracketSpacing:!0,arrowParens:"always",printWidth:120,endOfLine:"auto"};class _{_file;_id;_isLoaded=!1;definition;_onLoaded=new m.Qe;get isLoaded(){return this._isLoaded}get file(){return this._file}set file(e){this._file=e}get onLoaded(){return this._onLoaded.asEvent()}get id(){return this._id}set id(e){this._id=e}static async ensureOnFile(e,t){let i;return void 0===e.manager&&(i=new _,i.file=e,e.manager=i),void 0!==e.manager&&e.manager instanceof _?(i=e.manager,!i.isLoaded&&t&&i.onLoaded.subscribe(t),await i.load(),i):i}async persist(){return void 0!==this._file&&(r.Ay.assert(null!==this.definition,"PRCP"),!!this.definition&&this._file.setObjectContentIfSemanticallyDifferent(this.definition))}async save(){void 0!==this._file&&await this.persist()&&await this._file.saveContent(!1)}async hasMinContent(){if(await this.load(),!this.definition)return!1;for(const e in b)if(void 0===this.definition[e])return!1;return!0}async ensureMinContent(){if(await this.hasMinContent())return!0;this.definition||(this.definition=b);for(const e in b)void 0===this.definition[e]&&(this.definition[e]=b[e]);return this.definition}async load(){if(!(void 0===this._file||this._isLoaded||(this._file.isContentLoaded||await this._file.loadContent(),null===this._file.content||this._file.content instanceof Uint8Array))){this.id=this._file.name;try{const e=JSON.parse(this._file.content);this.definition=e}catch(e){r.Ay.fail("Could not parse vscode launch JSON "+e)}this._isLoaded=!0}}}var w=i(96927),F=i(43109),A=i(75065);class C{static async updateProjectAutogeneration(e,t){let i=0,s=0,r=0,o=!1,l=!1,d=0,c=0,h=0;const u=e.getItemsCopy();for(let e=0;e<u.length;e++){const t=u[e];if(t.itemType===n.bD.packageJson){i++;const e=t.primaryFile;e&&(e.isContentLoaded||await e.loadContent(),e.content&&"string"==typeof e.content&&(e.content.indexOf("just-scripts")>0&&(o=!0),e.content.indexOf("eslint")>0&&(l=!0)))}else t.itemType===n.bD.env?s++:t.itemType===n.bD.vsCodeLaunchJson?c++:t.itemType===n.bD.prettierRcJson?h++:t.itemType===n.bD.esLintConfigMjs?d++:t.itemType===n.bD.justConfigTs&&r++}0===s&&(r>0||o)&&t&&e.ensureItemByProjectPath("/.env",n.K5.singleFile,".env",n.bD.env,a.S.unknown,void 0,n.E9.generated),0===h&&i>0&&t&&e.ensureItemByProjectPath("/.prettierrc.json",n.K5.singleFile,".prettierrc.json",n.bD.prettierRcJson,a.S.unknown,void 0,n.E9.generated),0===r&&o&&t&&e.ensureItemByProjectPath("/just.config.ts",n.K5.singleFile,"just.config.ts",n.bD.justConfigTs,a.S.unknown,void 0,n.E9.generated),0===d&&l&&t&&e.ensureItemByProjectPath("/eslint.config.mjs",n.K5.singleFile,"eslint.config.mjs",n.bD.esLintConfigMjs,a.S.unknown,void 0,n.E9.generated),0===c&&i>0&&e.projectFolder&&t&&e.ensureItemByProjectPath("/.vscode/launch.json",n.K5.singleFile,"launch.json",n.bD.vsCodeLaunchJson,a.S.unknown,void 0,n.E9.generated),i>0&&e.projectFolder&&t&&e.ensureItemByProjectPath("/.vscode/settings.json",n.K5.singleFile,"settings.json",n.bD.vsCodeSettingsJson,a.S.unknown,void 0,n.E9.generated),i>0&&e.projectFolder&&t&&e.ensureItemByProjectPath("/.vscode/tasks.json",n.K5.singleFile,"tasks.json",n.bD.vsCodeTasksJson,a.S.unknown,void 0,n.E9.generated),i>0&&e.projectFolder&&t&&e.ensureItemByProjectPath("/.vscode/extensions.json",n.K5.singleFile,"extensions.json",n.bD.vsCodeExtensionsJson,a.S.unknown,void 0,n.E9.generated);for(let e=0;e<u.length;e++){const t=u[e];t.creationType===n.E9.generated&&await C.updateItemAutogeneration(t),await C.updateItemAutogeneratedSideFiles(t)}}static async updateItemAutogeneratedSideFiles(e){if(e.primaryFile&&e.project&&e.itemType===n.bD.worldTest){const t=await s.A.ensureOnFile(e.primaryFile);t&&await t.persistSideFiles(e.project)}}static async updateItemAutogeneration(e,t){if(t||e.isContentLoaded||await e.loadContent(),null!=e.primaryFile&&e.creationType===n.E9.generated)if(e.itemType===n.bD.catalogIndexJs)e.primaryFile.isContentLoaded||await e.primaryFile.loadContent(),C.updateCatalogJsContent(e,await C.getCatalogJsContent(e.project));else if(e.itemType===n.bD.env)e.primaryFile.setContentIfSemanticallyDifferent(await h.A.getContent(e.project,"string"==typeof e.primaryFile.content?e.primaryFile.content:void 0),A.C.versionlessEdit);else if(e.itemType===n.bD.justConfigTs){const t=await w.A.ensureOnFile(e.primaryFile);t&&(await t.ensureDefault(),await t.save())}else if(e.itemType===n.bD.vsCodeLaunchJson){const t=await u.A.ensureOnFile(e.primaryFile);t&&(await t.ensureMinContent(),await t.save())}else if(e.itemType===n.bD.vsCodeTasksJson){const t=await f.A.ensureOnFile(e.primaryFile);t&&(await t.ensureMinContent(),await t.save())}else if(e.itemType===n.bD.vsCodeExtensionsJson){const t=await g.ensureOnFile(e.primaryFile);t&&(await t.ensureMinContent(),await t.save())}else if(e.itemType===n.bD.vsCodeSettingsJson){const t=await v.ensureOnFile(e.primaryFile);t&&(await t.ensureMinContent(),await t.save())}else if(e.itemType===n.bD.prettierRcJson){const t=await _.ensureOnFile(e.primaryFile);t&&(await t.ensureMinContent(),await t.save())}else if(e.itemType===n.bD.packageJson){const t=await F.Ay.ensureOnFile(e.primaryFile);t&&(await t.ensureMinContent(e.project),await t.save())}else if(e.itemType===n.bD.behaviorPackManifestJson)e.primaryFile.isContentLoaded&&e.primaryFile.content||e.primaryFile.setContent(await c.A.getContent(e.project,t));else if(e.itemType===n.bD.entityTypeBaseJs){const t=await C.getGeneratedEntityTypeScript(e);void 0!==t.javaScript&&e.primaryFile.setContent(t.javaScript,A.C.versionlessEdit),e.project.preferredScriptLanguage===o.NJ.typeScript&&void 0!==t.typeScript&&e.primaryFile.parentFolder.ensureFile(l.Ay.getBaseFromName(e.primaryFile.name)+".ts").setContent(t.typeScript,A.C.versionlessEdit),e.project.preferredScriptLanguage===o.NJ.typeScript&&void 0!==t.typeScript&&e.primaryFile.parentFolder.ensureFile(l.Ay.getBaseFromName(e.primaryFile.name)+".ts").setContent(t.typeScript,A.C.versionlessEdit)}else if(e.itemType===n.bD.entityTypeBaseTs){const t=await C.getGeneratedEntityTypeScript(e);void 0!==t.typeScript&&e.primaryFile.setContent(t.typeScript,A.C.versionlessEdit)}}static async getCatalogJsContent(e){const t=[],i=await e.ensureDefaultBehaviorPackFolder(),s=e.getItemsCopy();for(let e=0;e<s.length;e++){const a=s[e];if(a.itemType===n.bD.worldTest){const e=await a.loadFileContent();if(e){const i=l.Ay.getBaseFromName(e.name)+".gen.js";t.push('import "scripts/'+i+'";')}}else if(a.itemType===n.bD.js||a.itemType===n.bD.buildProcessedJs||a.itemType===n.bD.entityTypeBaseJs||a.itemType===n.bD.testJs){const e=await a.loadFileContent();if(e){let s=e.getFolderRelativePath(i);e.isContentLoaded||await e.loadContent(!1),null===e.content&&null===s||void 0===s||(s.startsWith("/scripts/")&&(s=s.substring(9,s.length)),s.startsWith("/")&&(s=s.substring(1,s.length)),t.push('import "'+s+'";'))}}}return a.dR+"\n\n"+t.join("\n")}static async updateCatalogJsContent(e,t){if(null==e.primaryFile||e.primaryFile.content instanceof Uint8Array)return void r.Ay.unexpectedContentState();if(void 0===e.primaryFile.content||null===e.primaryFile.content||""===e.primaryFile.content.trim())return void e.primaryFile.setContent(t,A.C.versionlessEdit);let i=e.primaryFile.content;const s=i.indexOf(a.P4);if(s>=0){let e=i.lastIndexOf("\r",s);e<0&&(e=i.lastIndexOf("\n",s),e<0&&(e=0));const t=i.lastIndexOf("//",s);t>e+2&&(e=t),e>=0&&(i=i.substring(0,e))}i+=t,e.primaryFile.setContent(i,A.C.versionlessEdit)}static async getGeneratedEntityTypeScript(e){if(null===e.projectPath||void 0===e.projectPath)return{javaScript:"",typeScript:void 0};let t=l.Ay.getBaseFromName(l.Ay.getLeafName(e.projectPath));t.endsWith(".base")&&(t=t.substring(0,t.length-5));const i=e.project.getItemsCopy();for(let s=0;s<i.length;s++){const a=i[s];if(a.itemType===n.bD.entityTypeBehavior&&null!==a.projectPath&&void 0!==a.projectPath&&l.Ay.getBaseFromName(l.Ay.getLeafName(a.projectPath))===t){const t=await a.loadFileContent();if(null!=t&&(void 0===t.manager&&await d.Ay.ensureOnFile(t),t.manager)){const i=t.manager,s=i.getScript(!1);let n;return e.project.preferredScriptLanguage===o.NJ.typeScript&&(n=i.getScript(!0)),{javaScript:s,typeScript:n}}}}return{javaScript:"",typeScript:void 0}}}},1606:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});var s=i(62039),n=i(46882),a=i(14466);class r{_playerLocation;_playerLocationHistory=[];_playerLocationHistoryTimes=[];_itemInteractedLocationHistory=[];_itemInteractedLocationHistoryTimes=[];_playerMajorLocationHistory=[];_playerMajorLocationHistoryTimes=[];curTick=0;pendingLocationChangeProcess=-1;_lastPlayerTravelledMessage;_eventsSeen={};_onPlayerTravelled=new n.Qe;_onItemInteracted=new n.Qe;_onBlockBroken=new n.Qe;_onPlayerMajorTravelled=new n.Qe;get playerMajorLocationHistory(){return this._playerMajorLocationHistory}get playerLocationHistory(){return this._playerLocationHistory}get itemInteractedHistory(){return this._itemInteractedLocationHistory}get playerLocation(){return this._playerLocation}get onPlayerTravelled(){return this._onPlayerTravelled.asEvent()}get onPlayerMajorTravelled(){return this._onPlayerMajorTravelled.asEvent()}get onItemInteracted(){return this._onItemInteracted.asEvent()}get onBlockBroken(){return this._onBlockBroken.asEvent()}constructor(e){this._tick=this._tick.bind(this),"undefined"!=typeof window&&window.setInterval(this._tick,50)}_tick(){const e=this.curTick++;if(this.pendingLocationChangeProcess===e&&this._lastPlayerTravelledMessage){this.pendingLocationChangeProcess=-1;const e=this._playerLocationHistory[this._playerLocationHistory.length-1],t=this._playerMajorLocationHistoryTimes[this._playerMajorLocationHistoryTimes.length-1];this._playerMajorLocationHistory.push(e),this._playerMajorLocationHistoryTimes.push(t),this._onPlayerMajorTravelled.dispatch(this,this._lastPlayerTravelledMessage)}}handleEvent(e){if(!e.header)return;const t=e.eventId;if(t){if(!0===this._eventsSeen[t])return;this._eventsSeen[t]=!0}const i=e.header.eventName;if(i)switch(i){case"BlockBroken":const t=e;this._onBlockBroken.dispatch(this,t);break;case"ItemInteracted":const i=e,n=new Date;let r=new s.A(0,0,0);this._lastPlayerTravelledMessage&&(r=new s.A(this._lastPlayerTravelledMessage.body.player.position.x,this._lastPlayerTravelledMessage.body.player.position.y,this._lastPlayerTravelledMessage.body.player.position.z)),this._itemInteractedLocationHistory.push(r),this._itemInteractedLocationHistoryTimes.push(n),this._onItemInteracted.dispatch(this,i),a.Ay.verbose("Item was interacted");break;case"PlayerTravelled":const o=e,l=new s.A(o.body.player.position.x,o.body.player.position.y,o.body.player.position.z),d=new Date;this._lastPlayerTravelledMessage=o,this._playerLocationHistory.push(l),this._playerLocationHistoryTimes.push(d),this._playerLocation=l,this._onPlayerTravelled.dispatch(this,o);let c=!1;if(0===this._playerMajorLocationHistory.length)c=!0;else{const e=this._playerMajorLocationHistory[this._playerMajorLocationHistory.length-1];l.distanceTo(e)>2&&(c=!0)}c?(this._playerMajorLocationHistory.push(l),this._playerMajorLocationHistoryTimes.push(d),this._onPlayerMajorTravelled.dispatch(this,o)):this.pendingLocationChangeProcess=this.curTick+60}}}},1986:(e,t,i)=>{"use strict";i.d(t,{A:()=>g});var s=i(14466),n=i(46882),a=i(59701),r=i(67687),o=i(21382),l=i(40267),d=i(51044),c=i(71235),h=i(90469),u=i(47089),f=i(66207),m=i(77452),p=i(93149);class g{_dataWrapper;_file;_isLoaded=!1;_loadedWithComments=!1;_data;_onLoaded=new n.Qe;get isLoaded(){return this._isLoaded}get dataWrapper(){return this._data}get data(){return this._data}get file(){return this._file}get onLoaded(){return this._onLoaded.asEvent()}set file(e){this._file=e}get id(){if(this._data)return this._data.identifier}set id(e){this._data&&void 0!==e&&(this._data.identifier=e)}get textures(){if(this._data)return void 0===this._data.textures&&(this._data.textures={}),this._data.textures}getCanonicalizedTexturesList(){if(!this._data||!this._data.textures)return;const e=[];for(const t in this._data.textures){const i=m.A.canonicalizeTexturePath(this._data.textures[t]);i&&e.push(i)}return e}get texturesIdList(){if(!this._data||!this._data.textures)return;const e=[];for(const t in this._data.textures)e.push(t);return e}get renderControllerIdList(){if(this._data&&this._data.render_controllers)return this._data.render_controllers}get animationControllerIdList(){if(!this._data||!this._data.animation_controllers)return;const e=[];for(const t in this._data.animation_controllers)e.push(t);return e}get animationControllerList(){if(!this._data||!this._data.animation_controllers)return;const e=[];for(const t in this._data.animation_controllers){const i=this._data.animation_controllers[t];i&&e.push(i)}return e}get animationIdList(){if(!this._data||!this._data.animations)return;const e=[];for(const t in this._data.animations)e.push(t);return e}get animationList(){if(!this._data||!this._data.animations)return;const e=[];for(const t in this._data.animations){const i=this._data.animations[t];i&&e.push(i)}return e}get geometry(){if(this._data)return this._data.geometry}get geometryList(){if(!this._data||!this._data.geometry)return;const e=[];for(const t in this._data.geometry){const i=this._data.geometry[t];i&&e.push(i)}return e}get variantKeys(){const e=new Set;if(this._data?.geometry)for(const t in this._data.geometry)e.add(t);if(this._data?.textures)for(const t in this._data.textures)e.add(t);return Array.from(e)}getGeometryByKey(e){if(!this._data?.geometry)return;if(this._data.geometry[e])return this._data.geometry[e];if("default"!==e&&this._data.geometry.default)return this._data.geometry.default;const t=Object.keys(this._data.geometry);return t.length>0?this._data.geometry[t[0]]:void 0}getTextureByKey(e){if(!this._data?.textures)return;if(this._data.textures[e])return this._data.textures[e];if("default"!==e&&this._data.textures.default)return this._data.textures.default;const t=Object.keys(this._data.textures);return t.length>0?this._data.textures[t[0]]:void 0}getMatchedGeometryAndTexture(e="default"){return{geometryId:this.getGeometryByKey(e),texturePath:this.getTextureByKey(e)}}ensureAnimationAndGetShortName(e){if(!this._data||!this._data.animations)return;let t=!1,i=e;for(const s in this._data.animations)this._data.animations[s]===e&&(i=s,t=!0);if(!t){const t=e.lastIndexOf(".");t>0&&(i=e.substring(t+1).toLowerCase()),d.A.isUsableAsObjectKey(i)&&(this._data.animations[i]=e)}return i}ensureAnimationAndScript(e){if(!this._data)return;const t=this.ensureAnimationAndGetShortName(e);if(t&&this.getIsVersion1_10_0OrHigher()){this._data.scripts||(this._data.scripts={}),this._data.scripts.animate||(this._data.scripts.animate=[]);const e=this._data.scripts.animate;let i=!1;if(e&&Array.isArray(e))for(const s of e)("string"==typeof s&&s===t||"object"==typeof s&&s[t])&&(i=!0);i||e.push(t)}}getTextureItems(e){if(!this._data||!this._data.geometry||!e.childItems)return;const t={};for(const i in this._data.textures){let s=this._data.textures[i];if(s){s=a.Ay.canonicalizePath(s);for(const n of e.childItems)if(n.childItem.itemType===r.bD.texture&&n.childItem.projectPath){let e=a.Ay.canonicalizePath(n.childItem.projectPath);const r=e.lastIndexOf(".");r>=0&&(e=e.substring(0,r).toLowerCase()),e.endsWith(s)&&d.A.isUsableAsObjectKey(i)&&(t[i]=n.childItem)}}}return t}getIsVersion1_8_0OrLower(){let e=this.getFormatVersion();return e[0]<=1&&e[1]<=8}getIsVersion1_10_0OrHigher(){let e=this.getFormatVersion();return e[0]>=1&&e[1]>=10}getFormatVersion(){return this._dataWrapper&&this._dataWrapper.format_version?p.Ay.getVersionArrayFrom(this._dataWrapper.format_version):[0,0,0]}get formatVersion(){if(this._dataWrapper&&this._dataWrapper.format_version)return this._dataWrapper.format_version}static async ensureOnFile(e,t){let i;return void 0===e.manager&&(i=new g,i.file=e,e.manager=i),void 0!==e.manager&&e.manager instanceof g&&(i=e.manager,i.isLoaded||(t&&i.onLoaded.subscribe(t),await i.load())),i}ensureData(){if(this._data)return this._data;const e={description:{identifier:"",materials:{},textures:{},geometry:{},animation_controllers:{},particle_effects:{},animations:{},render_controllers:[],scripts:{}}};return this._dataWrapper?(void 0!==this._dataWrapper["minecraft:client_entity"]&&void 0!==this._dataWrapper["minecraft:client_entity"].description||(this._dataWrapper["minecraft:client_entity"]=e),this._data=this._dataWrapper["minecraft:client_entity"].description,this._data):(this._dataWrapper={format_version:"1.10.0","minecraft:client_entity":e},this._data=this._dataWrapper["minecraft:client_entity"].description,this._data)}persist(){return void 0!==this._file&&(s.Ay.assert(null!==this._dataWrapper,"ETRDP"),!!this._dataWrapper&&this._file.setObjectContentIfSemanticallyDifferent(this._dataWrapper))}async load(e=!1){if(this._isLoaded&&this._loadedWithComments)return;if(this._isLoaded&&!e)return;if(void 0===this._file)return void s.Ay.unexpectedUndefined("ETRPF");if(this._file.isContentLoaded||await this._file.loadContent(),!this._file.content||this._file.content instanceof Uint8Array)return this._isLoaded=!0,this._loadedWithComments=e,void this._onLoaded.dispatch(this,this);let t={},i=e?a.Ay.getJsonObjectWithComments(this._file):a.Ay.getJsonObject(this._file);i&&(t=i),this._dataWrapper=t,this._dataWrapper&&this._dataWrapper["minecraft:client_entity"]&&(this._data=this._dataWrapper["minecraft:client_entity"].description),this._isLoaded=!0,this._loadedWithComments=e,this._onLoaded.dispatch(this,this)}async deleteLinkToChild(e){let t=this.getPackRootFolder();void 0===this._data&&await this.load();const i=e.parentItem.childItems;if(e.childItem.itemType===r.bD.texture&&this._data&&this._data.textures&&(e.childItem.isContentLoaded||await e.childItem.loadContent(),e.childItem.primaryFile&&t)){let s=a.Ay.getBaseRelativePath(e.childItem.primaryFile,t);if(s)for(const e in this._data.textures)if(this._data.textures[e]===s&&(this._data.textures[e]=void 0,i))for(const t of i)t.childItem.itemType===r.bD.renderControllerJson&&(await f.A.get(t.childItem)).removeTexture(e)}this.persist()}getPackRootFolder(){let e;if(this.file&&this.file.parentFolder){let t=this.file.parentFolder;e=a.Ay.getParentOfParentFolderNamed("entity",t)}return e}async addChildItems(e,t,i){let s=this.getPackRootFolder(),n=this.getCanonicalizedTexturesList(),f=this.geometryList,p=this.renderControllerIdList,g=this.animationControllerIdList,y=this.animationList;if(i){if(y&&y.length>0&&i.addUniqueChildItems(t,i.animationsById,y),g&&g.length>0&&i.addUniqueChildItems(t,i.animationControllersById,g),p&&p.length>0&&i.addUniqueChildItems(t,i.renderControllersById,p),f&&f.length>0){const e=i.addUniqueChildItems(t,i.modelsById,f);f=f.filter(t=>!e.has(t))}if(s&&n&&n.length>0){const i=e.getItemsByType(r.bD.texture);for(const e of i)if(e.primaryFile){let i=m.A.canonicalizeTexturePath(a.Ay.getBaseRelativePath(e.primaryFile,s));i&&n&&n.includes(i)&&(t.addChildItem(e),n=d.A.removeItemInArray(i,n))}}}else{if(y&&y.length>0){const i=e.getItemsByType(r.bD.animationResourceJson);for(const e of i)if(e.isContentLoaded||await e.loadContent(),e.primaryFile){const i=await u.A.ensureOnFile(e.primaryFile),s=i?.idList;if(s)for(const i of y)s.has(i)&&t.addChildItem(e)}}if(g&&g.length>0){const i=e.getItemsByType(r.bD.animationControllerResourceJson);for(const e of i)if(e.isContentLoaded||await e.loadContent(),e.primaryFile){const i=await h.A.ensureOnFile(e.primaryFile),s=i?.idList;if(s)for(const i of g)s.has(i)&&t.addChildItem(e)}}if(p&&p.length>0){const i=e.getItemsByType(r.bD.renderControllerJson);for(const e of i)if(e.isContentLoaded||await e.loadContent(),e.primaryFile){const i=await c.A.ensureOnFile(e.primaryFile),s=i?.idList;if(s)for(const i of p)s.has(i)&&t.addChildItem(e)}}if(s&&n&&n.length>0){const i=e.getItemsByType(r.bD.texture);for(const e of i)if(e.isContentLoaded||await e.loadContent(),e.primaryFile){let i=m.A.canonicalizeTexturePath(a.Ay.getBaseRelativePath(e.primaryFile,s));i&&n&&n.includes(i)&&(t.addChildItem(e),n=d.A.removeItemInArray(i,n))}}if(f&&f.length>0){const i=e.getItemsByType(r.bD.modelGeometryJson);for(const e of i)if(e.isContentLoaded||await e.loadContent(),e.primaryFile){const i=await o.A.ensureOnFile(e.primaryFile);if(i){let s=!1;for(const e of i.identifiers)f&&f.includes(e)&&(s=!0,f=d.A.removeItemInArray(e,f));s&&t.addChildItem(e)}}}}if(n)for(const e of n){const i=await l.A.isVanillaToken(e);t.addUnfulfilledRelationship(e,r.bD.texture,i)}if(f)for(const e of f)t.addUnfulfilledRelationship(e,r.bD.modelGeometryJson,await l.A.isVanillaToken(e))}}},2230:(e,t,i)=>{"use strict";i.d(t,{A:()=>u});var s=i(46882),n=i(59701),a=i(36836),r=i(41039),o=i(60825),l=i(67687),d=i(4849),c=i(92898),h=i(51044);class u{_file;_id;_isLoaded=!1;items=[];_backgroundItem;data;_onLoaded=new s.Qe;project=void 0;get stackPosition(){return this.data?.stackPosition}set stackPosition(e){this.data&&(this.data.stackPosition=e)}get backgroundItem(){let e=this._backgroundItem;return e||(this.data?(e=new r.p({origin:{x:0,y:0},type:2,coords:[]}),this._backgroundItem=e,e):void 0)}ensureBackgroundItem(e){return this._backgroundItem?this._backgroundItem.data=e:this._backgroundItem=new r.p(e),this.data||(this.data={items:[]}),this.data.backgroundItem=this._backgroundItem.data,this._backgroundItem}get height(){return this.data&&this.data.height?this.data.height:64}set height(e){this.data&&(this.data.height=e)}get width(){return this.data&&this.data.width?this.data.width:64}set width(e){this.data&&(this.data.width=e)}get isLoaded(){return this._isLoaded}get file(){return this._file}set file(e){this._file=e}get onLoaded(){return this._onLoaded.asEvent()}get id(){return this._id}set id(e){this._id=e}get outputs(){if(this.data)return this.data.outputs}ensureData(){return this.data||(this.data={items:[]}),this.data.items||(this.data.items=[]),this.data}async updateOutputs(e){if(this.data?.outputs)for(const t of this.data.outputs)await this.updateOutput(e,t)}async getCorrespondingResourcePackFolder(){if(this.project)return await(this.project?.getDefaultResourcePackFolder())}async getPaintingOverrideFolder(){let e=await this.getCorrespondingResourcePackFolder();if(e&&this._file)return e=await e.ensureFolderFromRelativePath("/textures/painting/"),e}async getCorrespondingBlockTextureFolder(){let e=await this.getCorrespondingResourcePackFolder();if(!e)return;if(!this._file)return;e=await e.ensureFolderFromRelativePath("/textures/blocks/");const t=n.Ay.getBaseFromName(this._file?.name);return e=e?.ensureFolder(t),e}async updateOutput(e,t){t.name&&(t.type===a.vg.blockBillboard3x3?await this.updateBlocks(e,t.name,3,3):t.type===a.vg.blockBillboard4x6?await this.updateBlocks(e,t.name,6,4):t.type===a.vg.blockBillboard5x8&&await this.updateBlocks(e,t.name,8,5))}async setFromCreationData(e){this.data||(void 0===e.items&&(e.items=[]),this.data=e),e.outputs&&(this.data.outputs=e.outputs),e.width&&(this.data.width=e.width),e.height&&(this.data.height=e.height),await this.persist()}static getPaintingWidth(e){switch(e){case a.qE.threeByThree:case a.qE.threeByFourPortrait:return 48}return 16}static getPaintingHeight(e){switch(e){case a.qE.oneBlock:return 16;case a.qE.threeByThree:return 48;case a.qE.threeByFourPortrait:return 64}return 16}async updateBlocks(e,t,i,s){const n=await this.getCorrespondingBlockTextureFolder();if(n)for(let a=0;a<s;a++)for(let s=0;s<i;s++){const i=t+"_r"+String(a+1)+"c"+String(s+1);let r=o.Ay.getItemByTypeAndName(e,i,l.bD.blockTypeBehavior);if(!r){const t=await e.creatorTools.getGalleryProjectById("basicDieBlock");t&&await d.A.addFromGallery(e,i,t),r=o.Ay.getItemByTypeAndName(e,i,l.bD.blockTypeBehavior)}if(r&&(r.isContentLoaded||await r.loadContent(),r.primaryFile)){const t=await c.A.ensureOnFile(r.primaryFile);if(t&&n.parentFolder){const s=n.ensureFile(i+".png");let a=n;for(;void 0!==a.parentFolder&&null!==a.parentFolder&&"textures"!==a.name.toLowerCase();)a=a.parentFolder;a.parentFolder&&(a=a.parentFolder);let r=s.getFolderRelativePath(a);r&&(await t.setBlockCatalogTexture(e,"north",i),await t.setBlockCatalogTexture(e,"east",i),await t.setBlockCatalogTexture(e,"south",i),await t.setBlockCatalogTexture(e,"west",i),await t.setBlockCatalogTexture(e,"up",i),await t.setBlockCatalogTexture(e,"down",i),r.endsWith(".png")&&(r=r.substring(0,r.length-4)),r=h.A.ensureNotStartsWithSlash(r),await t.setTerrainTexture(e,i,{textures:[{path:r,overlay_color:"#8ab689"}]}))}}}}addNewDrawingItem(e){let t=this.data;t||(t=this.ensureData()),void 0!==t.stackPosition&&(this.items=this.items.slice(0,t.stackPosition),t.items=t.items.slice(0,t.stackPosition),this.stackPosition=void 0),t.items.push(e.data),this.items.push(e)}static async ensureAsAccessoryOnImageProjectItem(e){const t=(await e.ensureAccessoryFolder()).ensureFile("image_edits.json");return await u.ensureOnFile(t,e.project)}static async ensureOnFile(e,t,i){let s;return void 0===e.manager&&(s=new u,s.project=t,s.file=e,e.manager=s),void 0!==e.manager&&e.manager instanceof u?(s=e.manager,!s.isLoaded&&i&&s.onLoaded.subscribe(i),await s.load(),s):s}async persist(){return void 0!==this._file&&this._file.setObjectContentIfSemanticallyDifferent(this.data)}async save(){void 0!==this._file&&(await this.persist(),await this._file.saveContent(!1))}_loadFromItems(){if(this.items=[],this.data?.backgroundItem&&(this._backgroundItem=new r.p(this.data.backgroundItem)),this.data?.items)for(const e of this.data?.items)this.items.push(new r.p(e))}async load(){void 0===this._file||this._isLoaded||(this._file.isContentLoaded||await this._file.loadContent(),null===this._file.content||this._file.content instanceof Uint8Array||(this.id=this._file.name,this.data=n.Ay.getJsonObject(this._file),this._loadFromItems(),this._isLoaded=!0))}}},2233:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});var s=i(46882),n=i(59701),a=i(14466);class r{_file;_id;_title;_isLoaded=!1;formDefinition;_onLoaded=new s.Qe;get isLoaded(){return this._isLoaded}get file(){return this._file}set file(e){this._file=e}get onLoaded(){return this._onLoaded.asEvent()}get title(){return this.formDefinition?this.formDefinition.title:this._title}get id(){return this._id}set id(e){if(this._id=e,e){const t=e.lastIndexOf("_");t>=0&&t<e.length-2?this._title=e.substring(0,t):this._title=e}}static async ensureOnFile(e,t){let i;return void 0===e.manager&&(i=new r,i.file=e,e.manager=i),void 0!==e.manager&&e.manager instanceof r&&(i=e.manager,!i.isLoaded&&t&&i.onLoaded.subscribe(t),await i.load()),i}persist(){return void 0!==this._file&&(a.Ay.assert(null!==this.formDefinition,"DFFP"),!!this.formDefinition&&this._file.setObjectContentIfSemanticallyDifferent(this.formDefinition))}async load(){void 0===this._file||this._isLoaded||(this._file.isContentLoaded||await this._file.loadContent(),null===this._file.content||this._file.content instanceof Uint8Array||(this.formDefinition=n.Ay.getJsonObject(this._file),this._isLoaded=!0))}}},2610:(e,t,i)=>{"use strict";i.d(t,{A:()=>d});var s,n=i(62039),a=i(86816),r=i(46882),o=i(51044),l=i(14466);!function(e){e.simulatedPlayerSpawn="test_simulated_player_spawn",e.simulatedPlayerMove="test_simulated_player_move",e.simulatedPlayerInteract="test_simulated_player_interact",e.entitySpawn="entity_spawn",e.idle="test_idle"}(s||(s={}));class d{data;group;typeForm;actionSet;get id(){return this.data.id}set id(e){this.data.id=e}_onPropertyChanged=new r.Qe;get onPropertyChanged(){return this._onPropertyChanged.asEvent()}get typeId(){return"action"}get shortSubjectId(){return"obj"}get withId(){return this.data.withId||this.shortSubjectId}get setId(){return this.data.setId||this.shortSubjectId}get type(){return this.data.type}getDataCopy(){const e={};if(this.data)for(const t in this.data){let i=this.data[t];i&&(e[t]=i)}return e}constructor(e,t){if(this.group=e,!this.group._actionSet)throw new Error("Cannot add action to unattached group");this.actionSet=this.group._actionSet,this.data=t}run(e){}getProperty(e){if(!o.A.isUsableAsObjectKey(e))throw l.Ay.unsupportedToken(e),new Error;return this.data[e]}setProperty(e,t){if(!o.A.isUsableAsObjectKey(e))throw l.Ay.unsupportedToken(e),new Error;this.data[e]=t}getBaseValue(){return this.data}setBaseValue(e){this.data=e}getArgumentAsLocation(e){const t=this.data[e];if(t instanceof Array&&t.length>=3)return new n.A(t[0],t[1],t[2])}getArgumentAsBlockLocation(e){const t=this.data[e];if(t instanceof Array&&t.length>=3)return new a.A(t[0],t[1],t[2])}_notifyPropertyChanged(e){this._onPropertyChanged.dispatch(this,e)}getScriptTest(){return"test"}getScriptWith(){return this.data.withId?this.data.withId:"obj"}getScriptSet(){return this.data.setId?this.data.setId:"obj"}getCommandWith(){return this.data.withId?this.data.withId:"obj"}getCommandSet(){return this.data.setId?this.data.setId:"obj"}getArgumentAsNumber(e){const t=this.data[e];return"number"==typeof t?t:"string"==typeof t?parseFloat(t):0}getArgumentAsString(e){return this.data[e]}validateArgumentIsEntityType(e){const t=this.data[e];if(!t||"string"!=typeof t)throw new Error("Argument '"+e+"' is not defined.");return!0}absolutizeLocation(e){return this.actionSet.locationRoot?new n.A(this.actionSet.locationRoot.x+e.x,this.actionSet.locationRoot.y+e.y,this.actionSet.locationRoot.z+e.z):e}absolutizeBlockLocation(e){return this.actionSet.locationRoot?new a.A(Math.round(this.actionSet.locationRoot.x+e.x),Math.round(this.actionSet.locationRoot.y+e.y),Math.round(this.actionSet.locationRoot.z+e.z)):e}validateArgumentIsType(e,t){const i=this.data[e],s=typeof i;switch(t){case"BlockLocation":case"Location":if(!(i instanceof Array)||3!==i.length)throw new Error("Expected an array of 3 numbers for parameter '"+e+"'");break;case"boolean":case"number":case"string":if(s!==t)throw new Error("Unexpected type mismatch: "+e+" is "+s+" (expected "+t+")")}return!0}}},3234:(e,t,i)=>{"use strict";i.d(t,{$:()=>s,A:()=>l});var s,n=i(51044),a=i(14466),r=i(46882),o=i(96997);!function(e){e.fsExists="fsExists",e.fsFolderExists="fsFolderExists",e.fsRenameFolder="fsRenameFolder",e.fsDeleteFolder="fsDeleteFolder",e.fsRootStorageExists="fsRootStorageExists",e.fsMkdir="fsMkdir",e.fsReadUtf8File="fsReadUtf8File",e.fsReadFile="fsReadFile",e.fsWriteUtf8File="fsWriteUtf8File",e.fsWriteFile="fsWriteFile",e.fsReaddir="fsReaddir",e.fsStat="fsStat",e.getDirname="getDirname",e.getDedicatedServerStatus="getDedicatedServerStatus",e.getDedicatedServerProjectDeployDir="getDedicatedServerProjectDir",e.getDedicatedServerWorldDeployDir="getDedicatedServerWorldDir",e.getMinecraftGameProjectDeployDir="getMinecraftGameProjectDeployDir",e.getMinecraftGameWorldDeployDir="getMinecraftGameWorldDeployDir",e.getIsDev="getIsDev",e.openFolder="openFolder",e.shellOpenPath="shellOpenPath",e.shellOpenFolderInExplorer="shellOpenFolderInExplorer",e.webSocketCommand="webSocketCommand",e.dedicatedServerCommand="dedicatedServerCommand",e.startWebSocketServer="startWebSocketServer",e.stopWebSocketServer="stopWebSocketServer",e.startDedicatedServer="startDedicatedServer",e.stopDedicatedServer="stopDedicatedServer",e.debugPause="debugPause",e.debugResume="debugResume",e.debugStartProfiler="debugStartProfiler",e.debugStopProfiler="debugStopProfiler",e.shellRecycleItem="shellRecycleItem",e.reloadMct="reloadMct",e.getContentSources="getContentSources",e.minecraftShell="minecraftShell",e.windowClose="windowClose",e.windowRestore="windowRestore",e.windowMove="windowMove",e.logToConsole="logToConsole",e.windowMinimize="windowMinimize",e.windowMaximize="windowMaximize",e.windowUpdate="windowUpdate",e.windowLeftSide="windowLeftSide",e.windowRightSide="windowRightSide",e.getWindowState="getWindowState",e.getPlatform="getPlatform",e.appGetPath="appGetPath",e.updateIAgree="updateIAgree",e.convertFile="convertFile"}(s||(s={}));class l{static _api;static _pendingStringPromiseResolvers=[];static _pendingArrayBufferPromiseResolvers=[];static _pendingStringPromiseRejecters=[];static _pendingArrayPromiseRejecters=[];static _onMessage=new r.Qe;static get onMessage(){return l._onMessage.asEvent()}static get hasAppService(){return void 0!==l._api}static get hasAppServiceOrDebug(){return void 0!==l._api||n.A.isDebug}static get hasAppServiceOrSim(){return void 0!==l._api||n.A.isAppSim}static init(){"undefined"!=typeof window&&(l._api=window.api,l._api&&o.Ay.hostType!==o.RN.vsCodeMainWeb&&o.Ay.hostType!==o.RN.vsCodeWebWeb&&(o.Ay.hostType=o.RN.electronWeb,o.Ay.fullLocalStorage=!0)),void 0!==l._api&&(l._api.receive("appsvc",l._handleNewMessage),a.Ay.onItemAdded.subscribe(l._handleLog))}static _handleLog(e,t){l.logToConsole(t.message+" "+a.Ay.getStack().replace("Error\n",""))}static async logToConsole(e){await l.sendAsync(s.logToConsole,e)}static send(e,t){if(void 0===l._api){if(n.A.isAppSim)return void a.Ay.debugAlert("Command: "+e+" Data: "+t);throw new Error("Not an Electron API")}if(e===s.fsWriteFile){let e=t.content;e instanceof Uint8Array?e=n.A.uint8ArrayToBase64(e):t instanceof ArrayBuffer?e=n.A.arrayBufferToBase64(e):(t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Uint8ClampedArray||t instanceof BigUint64Array)&&a.Ay.fail("Unsupported binary type encountered."+t),t.content=e}let i;try{i=l._api.send("appweb",e,t)}catch(i){let s=t;throw"object"==typeof t&&(s=JSON.stringify(t)),new Error("Error running command "+e+", data: "+s+", error: "+i)}if(e===s.fsReadFile){if(void 0===i||0===i.length)return;return n.A.base64ToArrayBuffer(i)}return i}static sendAsyncBinary(e,t){const i=new Promise(l._arrayBufferPromiseHandler);if(void 0===l._api){if(n.A.isAppSim)return a.Ay.debugAlert("Command: "+e+" Data: "+t),i;throw new Error("Not an Electron API")}const s="bsync"+e+"|"+(l._pendingArrayBufferPromiseResolvers.length-1);return l._api.send("appweb",s,t),i}static sendBinaryAsync(e,t){const i=new Promise(l._stringPromiseHandler);if(void 0===l._api){if(n.A.isAppSim)return a.Ay.debugAlert("Command: "+e+" Data: "+t),i;throw new Error("Not an Electron API")}let s=t.content;s instanceof Uint8Array?s=n.A.uint8ArrayToBase64(s):t instanceof ArrayBuffer?s=n.A.arrayBufferToBase64(s):(t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Uint8ClampedArray||t instanceof BigUint64Array)&&a.Ay.fail("Unsupported binary type encountered."+t),t.content=s;const r="async"+e+"|"+(l._pendingStringPromiseResolvers.length-1);return l._api.send("appweb",r,t),i}static sendAsync(e,t,i){const s=new Promise(l._stringPromiseHandler);if(void 0===l._api){if(n.A.isAppSim)return i||a.Ay.debugAlert("Command: "+e+" Data: "+t),s;throw new Error("Not an Electron API")}const r="async"+e+"|"+(l._pendingStringPromiseResolvers.length-1);return l._api.send("appweb",r,t),s}static sendHost(e,t,i){if(void 0===l._api)throw new Error("Not an Electron API");"object"==typeof i?i=JSON.stringify(i):"string"!=typeof i&&(i=i.toString()),l._api.send(e,t,i)}static openLinkExternal(e){try{"undefined"!=typeof window&&window.open(e,"_blank")}catch(e){}}static _arrayBufferPromiseHandler(e,t){const i=l._pendingArrayBufferPromiseResolvers.length;l._pendingArrayBufferPromiseResolvers[i]=e,l._pendingStringPromiseRejecters[i]=t}static _stringPromiseHandler(e,t){const i=l._pendingStringPromiseResolvers.length;l._pendingStringPromiseResolvers[i]=e,l._pendingStringPromiseRejecters[i]=t}static _handleNewMessage(e){if(null!==e&&e.length>0)if(e.startsWith("async")){const t=n.A.splitUntil(e,"|",2);if(t.length>2){const e=parseInt(t[1]);if(e>=0){const i=l._pendingStringPromiseResolvers[e];let s=t[2];"<undefined>"===s&&(s=void 0),i(s)}}}else if(e.startsWith("bsync")){const t=n.A.splitUntil(e,"|",2);if(t.length>2){const e=parseInt(t[1]);if(e>=0){const i=l._pendingArrayBufferPromiseResolvers[e];let s;"<undefined>"!==t[2]&&(s=n.A.base64ToArrayBuffer(t[2])),i(s)}}}else{const t=e.indexOf("|");t>=0&&l._onMessage.dispatch(e.substring(0,t),e.substring(t+1,e.length))}}}},4849:(e,t,i)=>{"use strict";i.d(t,{A:()=>_});var s=i(72327),n=i(18458),a=i(75236),r=i(67687),o=i(59701),l=i(98906),d=i(60825),c=i(1001),h=i(40267),u=i(14466),f=i(26288),m=i(93639),p=i(93149),g=i(38524),y=i(59327),v=i(2230),b=i(28740);class _{static async _getDefaultBehaviorPackPath(e){const t=await e.ensureDefaultBehaviorPackFolder();if(null!==e.projectFolder)return t.getFolderRelativePath(e.projectFolder)}static async _getDefaultBehaviorPackFolderPath(e,t){const i=await e.ensureDefaultBehaviorPackFolder();if(null===e.projectFolder)return;const s=i.ensureFolder(t);return await s.ensureExists(),s.getFolderRelativePath(e.projectFolder)}static async _getDefaultDesignPackFolde