@openfairygui/functions 0.2.0-alpha.34 → 0.2.0-alpha.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { BinaryWriter, GearType, ProjectType, TransitionActionType } from "@openfairygui/core";
1
+ import { BinaryWriter, GearType, ProjectType, TransitionActionType, deriveMovieClipModel, parseJta, probeRasterImage } from "@openfairygui/core";
2
2
  //#region src/utils.ts
3
3
  /**
4
4
  * Wraps a transform function, assigning it a name for the transform stack.
@@ -599,153 +599,76 @@ function parseFnt(text) {
599
599
  }
600
600
  //#endregion
601
601
  //#region src/atlas/jta.ts
602
- const PNG_SIGNATURE = new Uint8Array([
603
- 137,
604
- 80,
605
- 78,
606
- 71,
607
- 13,
608
- 10,
609
- 26,
610
- 10
611
- ]);
612
602
  function extractJtaFrames(data) {
613
- const frames = [];
614
- let offset = 0;
615
- let firstPngOffset = -1;
616
- while (offset < data.length) {
617
- const signatureIndex = findPngSignature(data, offset);
618
- if (signatureIndex === -1) break;
619
- if (firstPngOffset === -1) firstPngOffset = signatureIndex;
620
- const end = findPngEnd(data, signatureIndex);
621
- if (end === -1) break;
622
- frames.push(data.subarray(signatureIndex, end));
623
- offset = end;
624
- }
625
- if (firstPngOffset === -1 || frames.length === 0) return { frames: [] };
603
+ const parsed = parseJta(data);
604
+ const derived = deriveMovieClipModel(parsed);
626
605
  return {
627
- frames,
628
- meta: parseJtaHeader(data, firstPngOffset, frames.length)
606
+ frames: parsed.textures.map((texture) => texture.raw),
607
+ meta: {
608
+ interval: derived.interval,
609
+ repeatDelay: derived.repeatDelay,
610
+ swing: derived.swing,
611
+ width: derived.dimensions.width,
612
+ height: derived.dimensions.height,
613
+ frames: derived.frames.map((frame) => ({
614
+ addDelay: frame.addDelay,
615
+ offsetX: frame.rectX,
616
+ offsetY: frame.rectY,
617
+ width: frame.rectWidth,
618
+ height: frame.rectHeight,
619
+ textureIndex: frame.textureIndex
620
+ }))
621
+ }
629
622
  };
630
623
  }
631
- function findPngSignature(data, fromIndex) {
632
- for (let index = fromIndex; index <= data.length - PNG_SIGNATURE.length; index += 1) {
633
- let matched = true;
634
- for (let signatureIndex = 0; signatureIndex < PNG_SIGNATURE.length; signatureIndex += 1) if (data[index + signatureIndex] !== PNG_SIGNATURE[signatureIndex]) {
635
- matched = false;
636
- break;
637
- }
638
- if (matched) return index;
639
- }
640
- return -1;
641
- }
642
- function findPngEnd(data, start) {
643
- let position = start + PNG_SIGNATURE.length;
644
- while (position + 8 <= data.length) {
645
- const length = readUint32BE(data, position);
646
- position += 8;
647
- if (position + length + 4 > data.length) return -1;
648
- const isEnd = data[position - 4] === 73 && data[position - 3] === 69 && data[position - 2] === 78 && data[position - 1] === 68;
649
- position += length + 4;
650
- if (isEnd) return position;
651
- }
652
- return -1;
653
- }
654
- function parseJtaHeader(data, firstPngOffset, frameCount) {
655
- if (data.length < 10) return void 0;
656
- const state = { offset: 0 };
657
- const end = Math.min(firstPngOffset, data.length);
658
- if (!readUtfBE(data, state, end)) return void 0;
659
- const version = readInt32BEAt(data, state, end);
660
- if (version == null) return void 0;
661
- const fpsRaw = readInt8At(data, state, end);
662
- if (fpsRaw == null) return void 0;
663
- const fps = fpsRaw > 0 ? fpsRaw : 24;
664
- if (state.offset + 3 > end) return void 0;
665
- state.offset += 3;
666
- if (version < 102) return void 0;
667
- readUint16BEAt(data, state, end);
668
- readUint16BEAt(data, state, end);
669
- const width = readUint16BEAt(data, state, end);
670
- const height = readUint16BEAt(data, state, end);
671
- if (width == null || height == null) return void 0;
672
- const speedRaw = readUint8At(data, state, end);
673
- const repeatDelayRaw = readUint8At(data, state, end);
674
- const swingRaw = readInt8At(data, state, end);
675
- const frameTableCount = readInt16BEAt(data, state, end);
676
- if (speedRaw == null || repeatDelayRaw == null || swingRaw == null || frameTableCount == null) return void 0;
677
- const frames = [];
678
- for (let index = 0; index < frameTableCount; index += 1) {
679
- const delayRaw = readInt16BEAt(data, state, end);
680
- const offsetX = readInt16BEAt(data, state, end);
681
- const offsetY = readInt16BEAt(data, state, end);
682
- const frameWidth = readInt16BEAt(data, state, end);
683
- const frameHeight = readInt16BEAt(data, state, end);
684
- const textureIndex = readInt16BEAt(data, state, end);
685
- if (delayRaw == null || offsetX == null || offsetY == null || frameWidth == null || frameHeight == null || textureIndex == null) break;
686
- frames.push({
687
- addDelay: Math.trunc(1e3 / fps * delayRaw),
688
- offsetX,
689
- offsetY,
690
- width: frameWidth,
691
- height: frameHeight,
692
- textureIndex
624
+ function detectSupportedRasterFormat(data) {
625
+ if (data.length >= 8 && data[0] === 137 && data[1] === 80 && data[2] === 78 && data[3] === 71 && data[4] === 13 && data[5] === 10 && data[6] === 26 && data[7] === 10) return "png";
626
+ if (data.length >= 2 && data[0] === 255 && data[1] === 216) return "jpeg";
627
+ return null;
628
+ }
629
+ function couldNotDecode(filePath, frameIndex, textureIndex) {
630
+ return /* @__PURE__ */ new Error(`atlas: Could not decode MovieClip "${filePath}" frame ${frameIndex} (texture ${textureIndex}).`);
631
+ }
632
+ async function prepareJtaForPublish(data, encoder, filePath) {
633
+ const extracted = extractJtaFrames(data);
634
+ const firstFrameIndexByTextureIndex = /* @__PURE__ */ new Map();
635
+ for (let frameIndex = 0; frameIndex < extracted.meta.frames.length; frameIndex += 1) {
636
+ const textureIndex = extracted.meta.frames[frameIndex].textureIndex;
637
+ if (textureIndex >= 0 && !firstFrameIndexByTextureIndex.has(textureIndex)) firstFrameIndexByTextureIndex.set(textureIndex, frameIndex);
638
+ }
639
+ const referencedTextures = [];
640
+ for (let textureIndex = 0; textureIndex < extracted.frames.length; textureIndex += 1) {
641
+ const firstFrameIndex = firstFrameIndexByTextureIndex.get(textureIndex);
642
+ if (firstFrameIndex === void 0) continue;
643
+ const raw = extracted.frames[textureIndex];
644
+ if (raw.byteLength === 0) throw new Error(`atlas: MovieClip "${filePath}" frame ${firstFrameIndex} references empty texture ${textureIndex}.`);
645
+ const detectedFormat = detectSupportedRasterFormat(raw);
646
+ if (!detectedFormat) throw new Error(`atlas: MovieClip "${filePath}" frame ${firstFrameIndex} (texture ${textureIndex}) uses an unsupported raster format; only PNG and JPEG are supported.`);
647
+ const imageInfo = probeRasterImage(raw);
648
+ if (!imageInfo || imageInfo.format !== detectedFormat) throw couldNotDecode(filePath, firstFrameIndex, textureIndex);
649
+ let buffer = raw;
650
+ if (encoder) {
651
+ try {
652
+ buffer = await encoder(raw).png().toBuffer();
653
+ } catch {
654
+ throw couldNotDecode(filePath, firstFrameIndex, textureIndex);
655
+ }
656
+ const normalizedInfo = probeRasterImage(buffer);
657
+ if (!normalizedInfo || normalizedInfo.format !== "png" || normalizedInfo.width !== imageInfo.width || normalizedInfo.height !== imageInfo.height) throw couldNotDecode(filePath, firstFrameIndex, textureIndex);
658
+ }
659
+ referencedTextures.push({
660
+ textureIndex,
661
+ firstFrameIndex,
662
+ buffer,
663
+ width: imageInfo.width,
664
+ height: imageInfo.height
693
665
  });
694
666
  }
695
667
  return {
696
- interval: Math.trunc(1e3 / fps * (speedRaw || 1)),
697
- repeatDelay: Math.trunc(1e3 / fps * repeatDelayRaw),
698
- swing: swingRaw === 1,
699
- width,
700
- height,
701
- frames: frames.length === 0 && frameCount > 0 ? [] : frames
668
+ ...extracted,
669
+ referencedTextures
702
670
  };
703
671
  }
704
- function readUtfBE(data, state, end) {
705
- const length = readUint16BEAt(data, state, end);
706
- if (length == null || state.offset + length > end) return null;
707
- const value = new TextDecoder().decode(data.subarray(state.offset, state.offset + length));
708
- state.offset += length;
709
- return value;
710
- }
711
- function readUint8At(data, state, end) {
712
- if (state.offset + 1 > end) return null;
713
- const value = data[state.offset];
714
- state.offset += 1;
715
- return value ?? 0;
716
- }
717
- function readInt8At(data, state, end) {
718
- if (state.offset + 1 > end) return null;
719
- const value = new DataView(data.buffer, data.byteOffset, data.byteLength).getInt8(state.offset);
720
- state.offset += 1;
721
- return value;
722
- }
723
- function readUint16BEAt(data, state, end) {
724
- if (state.offset + 2 > end) return null;
725
- const value = readUint16BE(data, state.offset);
726
- state.offset += 2;
727
- return value;
728
- }
729
- function readInt16BEAt(data, state, end) {
730
- if (state.offset + 2 > end) return null;
731
- const value = new DataView(data.buffer, data.byteOffset, data.byteLength).getInt16(state.offset, false);
732
- state.offset += 2;
733
- return value;
734
- }
735
- function readInt32BEAt(data, state, end) {
736
- if (state.offset + 4 > end) return null;
737
- const value = new DataView(data.buffer, data.byteOffset, data.byteLength).getInt32(state.offset, false);
738
- state.offset += 4;
739
- return value;
740
- }
741
- function readUint16BE(data, offset) {
742
- if (offset + 1 >= data.length) return 0;
743
- return data[offset] << 8 | data[offset + 1];
744
- }
745
- function readUint32BE(data, offset) {
746
- if (offset + 3 >= data.length) return 0;
747
- return data[offset] * 16777216 + ((data[offset + 1] ?? 0) << 16) + ((data[offset + 2] ?? 0) << 8) + (data[offset + 3] ?? 0);
748
- }
749
672
  //#endregion
750
673
  //#region src/atlas/inputs.ts
751
674
  function getPublishedItemId(resource) {
@@ -815,6 +738,27 @@ async function _trimImage(encoder, input, originalWidth, originalHeight) {
815
738
  };
816
739
  }
817
740
  }
741
+ function resolveMovieClipSourcePath(resource, pkg, basePath) {
742
+ const fileName = `${resource.getName()}.jta`;
743
+ const resourcePath = resource.getPath() ?? "/";
744
+ return `${basePath}/${pkg.getName()}${resourcePath}${fileName}`;
745
+ }
746
+ async function prepareMovieClipResource(resource, pkg, encoder, basePath, readFileRaw) {
747
+ const filePath = resolveMovieClipSourcePath(resource, pkg, basePath);
748
+ let raw;
749
+ try {
750
+ raw = await readFileRaw(filePath);
751
+ } catch {
752
+ throw new Error(`atlas: Could not read MovieClip "${filePath}".`);
753
+ }
754
+ try {
755
+ return await prepareJtaForPublish(raw, encoder, filePath);
756
+ } catch (error) {
757
+ if (error instanceof Error && error.message.startsWith("atlas:")) throw error;
758
+ const detail = error instanceof Error ? ` ${error.message}` : "";
759
+ throw new Error(`atlas: Could not parse MovieClip "${filePath}".${detail}`);
760
+ }
761
+ }
818
762
  /** Collect a single ImageResource into the inputs array. */
819
763
  async function collectImage(resource, pkg, inputs, encoder, options, doTrim, logger) {
820
764
  let origW = resource.getWidth() ?? 0;
@@ -842,8 +786,11 @@ async function collectImage(resource, pkg, inputs, encoder, options, doTrim, log
842
786
  }).png().toBuffer();
843
787
  sourceHasAlpha = true;
844
788
  }
845
- } catch {
846
- if (options.strictOutput) throw new Error(`atlas: Could not read image "${filePath}".`);
789
+ } catch (error) {
790
+ if (options.strictOutput) {
791
+ const detail = error instanceof Error && error.message.startsWith("publishBrowser:") ? ` ${error.message}` : "";
792
+ throw new Error(`atlas: Could not read image "${filePath}".${detail}`);
793
+ }
847
794
  if (origW === 0 || origH === 0) {
848
795
  logger.warn(`atlas: Could not read image "${filePath}", skipping.`);
849
796
  return;
@@ -888,82 +835,45 @@ async function collectMovieClipFrames(doc, resource, pkg, inputs, encoder, optio
888
835
  }
889
836
  if (!encoder && options.strictOutput) throw new Error(`atlas: MovieClip "${resource.getId()}" requires an encoder for complete raster output.`);
890
837
  const mcId = resource.getId();
891
- const mcName = resource.getName() + ".jta";
892
- const mcPath = resource.getPath() ?? "/";
893
- const filePath = `${options.basePath}/${pkg.getName()}${mcPath}${mcName}`;
838
+ const filePath = resolveMovieClipSourcePath(resource, pkg, options.basePath);
894
839
  try {
895
- const jta = extractJtaFrames(await options.readFileRaw(filePath));
896
- if (jta.frames.length === 0) return;
897
- const frameMetas = jta.meta?.frames ?? [];
840
+ const jta = options.preparedMovieClips?.get(resource) ?? await prepareMovieClipResource(resource, pkg, encoder, options.basePath, options.readFileRaw);
898
841
  for (const frame of resource.listFrames()) resource.removeFrame(frame);
899
- resource.setInterval(jta.meta?.interval ?? 100).setSwing(jta.meta?.swing ?? false).setRepeatDelay(jta.meta?.repeatDelay ?? 0);
900
- if (frameMetas.length > 0) {
901
- const firstFrameIndexByTextureIndex = /* @__PURE__ */ new Map();
902
- for (let frameIndex = 0; frameIndex < frameMetas.length; frameIndex += 1) {
903
- const meta = frameMetas[frameIndex];
904
- const textureIndex = Number.isFinite(meta.textureIndex) ? meta.textureIndex : frameIndex;
905
- if (!firstFrameIndexByTextureIndex.has(textureIndex)) firstFrameIndexByTextureIndex.set(textureIndex, frameIndex);
906
- }
907
- const spriteIdByTextureIndex = /* @__PURE__ */ new Map();
908
- for (let textureIndex = 0; textureIndex < jta.frames.length; textureIndex += 1) {
909
- const exportFrameIndex = firstFrameIndexByTextureIndex.get(textureIndex);
910
- if (exportFrameIndex === void 0) continue;
911
- const itemId = `${mcId}_${exportFrameIndex}`;
912
- const input = await createMovieClipFrameInput(jta.frames[textureIndex], itemId, resource, encoder, options.strictOutput);
913
- if (!input) continue;
914
- inputs.push(input);
915
- spriteIdByTextureIndex.set(textureIndex, itemId);
916
- }
917
- for (let frameIndex = 0; frameIndex < frameMetas.length; frameIndex += 1) {
918
- const meta = frameMetas[frameIndex];
919
- const textureIndex = Number.isFinite(meta.textureIndex) ? meta.textureIndex : frameIndex;
920
- const frame = doc.createMovieFrame(`${mcId}_${frameIndex}`);
921
- frame.setRectX(meta.offsetX).setRectY(meta.offsetY).setRectWidth(meta.width).setRectHeight(meta.height).setAddDelay(meta.addDelay).setSpriteId(spriteIdByTextureIndex.get(textureIndex) ?? "");
922
- resource.addFrame(frame);
923
- }
924
- } else for (let frameIndex = 0; frameIndex < jta.frames.length; frameIndex += 1) {
925
- const itemId = `${mcId}_${frameIndex}`;
926
- const input = await createMovieClipFrameInput(jta.frames[frameIndex], itemId, resource, encoder, options.strictOutput);
927
- if (!input) continue;
928
- inputs.push(input);
929
- const frame = doc.createMovieFrame(itemId);
930
- frame.setRectX(0).setRectY(0).setRectWidth(input.originalWidth).setRectHeight(input.originalHeight).setAddDelay(0).setSpriteId(itemId);
842
+ resource.setInterval(jta.meta.interval).setSwing(jta.meta.swing).setRepeatDelay(jta.meta.repeatDelay);
843
+ const spriteIdByTextureIndex = /* @__PURE__ */ new Map();
844
+ for (const texture of jta.referencedTextures) {
845
+ if (texture.width <= 0 || texture.height <= 0) continue;
846
+ const itemId = `${mcId}_${texture.firstFrameIndex}`;
847
+ inputs.push({
848
+ id: itemId,
849
+ width: texture.width,
850
+ height: texture.height,
851
+ originalWidth: texture.width,
852
+ originalHeight: texture.height,
853
+ offsetX: 0,
854
+ offsetY: 0,
855
+ resource,
856
+ trimBuffer: texture.buffer,
857
+ sourceKind: "movieclip-frame"
858
+ });
859
+ spriteIdByTextureIndex.set(texture.textureIndex, itemId);
860
+ }
861
+ for (let frameIndex = 0; frameIndex < jta.meta.frames.length; frameIndex += 1) {
862
+ const meta = jta.meta.frames[frameIndex];
863
+ const frame = doc.createMovieFrame(`${mcId}_${frameIndex}`);
864
+ frame.setRectX(meta.offsetX).setRectY(meta.offsetY).setRectWidth(meta.width).setRectHeight(meta.height).setAddDelay(meta.addDelay).setSpriteId(meta.textureIndex === -1 ? "" : spriteIdByTextureIndex.get(meta.textureIndex) ?? "");
931
865
  resource.addFrame(frame);
932
866
  }
933
- if ((jta.meta?.width ?? 0) > 0 && (jta.meta?.height ?? 0) > 0) {
934
- resource.setWidth(jta.meta?.width ?? 0);
935
- resource.setHeight(jta.meta?.height ?? 0);
867
+ if (jta.meta.width > 0 && jta.meta.height > 0) {
868
+ resource.setWidth(jta.meta.width);
869
+ resource.setHeight(jta.meta.height);
936
870
  }
937
- } catch {
938
- const message = `atlas: Could not parse MovieClip "${filePath}".`;
939
- if (options.strictOutput) throw new Error(message);
871
+ } catch (error) {
872
+ const message = error instanceof Error ? error.message : `atlas: Could not parse MovieClip "${filePath}".`;
873
+ if (options.strictOutput) throw error;
940
874
  logger.warn(`${message} Skipping frames.`);
941
875
  }
942
876
  }
943
- async function createMovieClipFrameInput(buffer, itemId, resource, encoder, strictOutput) {
944
- if (!encoder || buffer.length === 0) return null;
945
- try {
946
- const meta = await encoder(buffer).metadata();
947
- const width = meta.width ?? 0;
948
- const height = meta.height ?? 0;
949
- if (width <= 0 || height <= 0) return null;
950
- return {
951
- id: itemId,
952
- width,
953
- height,
954
- originalWidth: width,
955
- originalHeight: height,
956
- offsetX: 0,
957
- offsetY: 0,
958
- resource,
959
- trimBuffer: buffer,
960
- sourceKind: "movieclip-frame"
961
- };
962
- } catch {
963
- if (strictOutput) throw new Error(`atlas: Could not decode MovieClip frame "${itemId}".`);
964
- return null;
965
- }
966
- }
967
877
  /** Collect a Bitmap Font's texture image, packed under the font's ID. */
968
878
  async function collectFontTexture(doc, fontRes, pkg, options) {
969
879
  const textureId = fontRes.getTextureId?.() ?? "";
@@ -3137,7 +3047,7 @@ function publish(options) {
3137
3047
  return paths.join("/");
3138
3048
  }
3139
3049
  });
3140
- const publishPackage = async (plan, writerFs, packageIndex) => {
3050
+ const publishPackage = async (plan, writerFs, packageIndex, preparedMovieClips) => {
3141
3051
  if (options.fs && !plan.outputDir) throw new Error("publish: no output directory resolved. Provide --output, or configure global publish.path / package publishPath.");
3142
3052
  if (options.fs) {
3143
3053
  await options.fs.mkdir(plan.outputDir);
@@ -3155,6 +3065,7 @@ function publish(options) {
3155
3065
  mkdir: options.fs ? options.fs.mkdir : void 0,
3156
3066
  readFileRaw: options.atlas?.readFileRaw ?? options.fs?.readFileRaw,
3157
3067
  strictOutput: options.fs !== void 0,
3068
+ preparedMovieClips,
3158
3069
  packages: [plan.pkg.getName()],
3159
3070
  ...atlasRuntimeOptions
3160
3071
  })(doc);
@@ -3207,8 +3118,25 @@ function publish(options) {
3207
3118
  }
3208
3119
  const unresolvedPlan = plans.find((plan) => !plan.outputDir);
3209
3120
  if (unresolvedPlan) throw new Error(`publish: no output directory resolved for package "${unresolvedPlan.pkg.getName()}". Provide --output, or configure global publish.path / package publishPath.`);
3121
+ const publishedMovieClips = allPackages.flatMap((pkg) => {
3122
+ const publishedResourceIds = getAnnotatedPublishedResourceIds(pkg);
3123
+ return pkg.listResources().filter((resource) => {
3124
+ return publishedResourceIds.has(resource.getId()) && isMovieClipResource(resource);
3125
+ }).map((resource) => ({
3126
+ pkg,
3127
+ resource
3128
+ }));
3129
+ });
3130
+ const preparedMovieClips = /* @__PURE__ */ new Map();
3131
+ if (publishedMovieClips.length > 0) {
3132
+ if (!options.encoder) throw new Error("publish: MovieClip output requires an encoder.");
3133
+ if (!options.basePath) throw new Error("publish: MovieClip output requires basePath.");
3134
+ const readFileRaw = options.atlas?.readFileRaw ?? options.fs.readFileRaw;
3135
+ if (!readFileRaw) throw new Error("publish: MovieClip output requires readFileRaw.");
3136
+ for (const { pkg, resource } of publishedMovieClips) preparedMovieClips.set(resource, await prepareMovieClipResource(resource, pkg, options.encoder, options.basePath, readFileRaw));
3137
+ }
3210
3138
  const writerFs = toBinaryWriterFileSystem(options.fs);
3211
- for (const plan of plans) await publishPackage(plan, writerFs, allDocPackages.indexOf(plan.pkg));
3139
+ for (const plan of plans) await publishPackage(plan, writerFs, allDocPackages.indexOf(plan.pkg), preparedMovieClips);
3212
3140
  if (options.codeGeneration !== false) await publishCodeGeneration(doc, {
3213
3141
  basePath: options.basePath,
3214
3142
  fs: options.fs,
@@ -3243,4 +3171,4 @@ function _computeDependencies(doc, pkg, pkgMap) {
3243
3171
  }
3244
3172
  }
3245
3173
  //#endregion
3246
- export { decodeText as a, resolvePackageCodegenPlan as c, normalizeComparablePath as d, trimTrailingSlashes as f, createTransform as h, buildCodegenClasses as i, resolveProjectBasePath as l, atlas as m, resolvePublishOptions as n, encodeText as o, formatPluginError as p, AUTO_GENERATED_CODE_MARK as r, publishCodeGeneration as s, publish as t, basename as u };
3174
+ export { decodeText as a, resolveCodeGenerationSettings as c, basename as d, normalizeComparablePath as f, createTransform as g, atlas as h, buildCodegenClasses as i, resolvePackageCodegenPlan as l, formatPluginError as m, resolvePublishOptions as n, encodeText as o, trimTrailingSlashes as p, AUTO_GENERATED_CODE_MARK as r, publishCodeGeneration as s, publish as t, resolveProjectBasePath as u };
@@ -1,4 +1,4 @@
1
- import { d as normalizeComparablePath, f as trimTrailingSlashes, u as basename } from "./publish-BJk8UzRP.js";
1
+ import { d as basename, f as normalizeComparablePath, p as trimTrailingSlashes } from "./publish-DXoaC1Nl.js";
2
2
  import { BinaryReader, ProjectType, ProjectWriter, generateId } from "@openfairygui/core";
3
3
  //#region src/restore-internals/output-transaction.ts
4
4
  function isPathWithin(root, candidate) {
@@ -486,6 +486,14 @@ var RestoreWorkflow = class {
486
486
  common: {},
487
487
  adaptation: {}
488
488
  });
489
+ for (const pkg of doc.getRoot().listPackages()) pkg.setSourceAtlasSettings({
490
+ ...pkg.getSourceAtlasSettings(),
491
+ atlases: pkg.listAtlases().map((atlas) => ({
492
+ index: atlas.getIndex(),
493
+ name: atlas.getIndex() === 0 ? "Default" : atlas.getName(),
494
+ compression: false
495
+ }))
496
+ });
489
497
  }
490
498
  _initializeImageFileNames(doc) {
491
499
  for (const pkg of doc.getRoot().listPackages()) for (const resource of pkg.listResources()) {
@@ -1,4 +1,4 @@
1
- const require_publish = require("./publish-DCP0AYx2.cjs");
1
+ const require_publish = require("./publish-CykUJfVa.cjs");
2
2
  let _openfairygui_core = require("@openfairygui/core");
3
3
  //#region src/restore-internals/output-transaction.ts
4
4
  function isPathWithin(root, candidate) {
@@ -486,6 +486,14 @@ var RestoreWorkflow = class {
486
486
  common: {},
487
487
  adaptation: {}
488
488
  });
489
+ for (const pkg of doc.getRoot().listPackages()) pkg.setSourceAtlasSettings({
490
+ ...pkg.getSourceAtlasSettings(),
491
+ atlases: pkg.listAtlases().map((atlas) => ({
492
+ index: atlas.getIndex(),
493
+ name: atlas.getIndex() === 0 ? "Default" : atlas.getName(),
494
+ compression: false
495
+ }))
496
+ });
489
497
  }
490
498
  _initializeImageFileNames(doc) {
491
499
  for (const pkg of doc.getRoot().listPackages()) for (const resource of pkg.listResources()) {