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AEA,QAAQ,CAAC,GAFT,EAGX,QAHW,EAGD,oBAAK,IAAL,CAHC,EAIX,UAJW,EAIC,YAJD,EAKX,OALW,EAKF,SALE,EAMX,iBANW,EAMS,IAAI,CAAC,SAAL,CAAc,MAAA,CAAA,MAAA,CAAA;AAChC,MAAA,WAAW,EAAE,KAAK,QAAL,CAAc,OAAd,CAAsB,WADH;AAEhC,MAAA,eAAe,EAAE,KAAK,QAAL,CAAc,OAAd,CAAsB,eAFP;AAGhC,MAAA,YAAY,EAAE,CAAC,CAAC,CAAD,CAHiB;AAIhC,MAAA,cAAc,EAAE,KAAK,QAAL,CAAc,cAJE;AAKhC,MAAA,KAAK,EAAE,CAAC,CAAC,CAAD,CALwB;AAMhC,MAAA,gBAAgB,EAAE,KAAK,QAAL,CAAc;AANA,KAAA,EAO7B,OAP6B,CAAd,CANT,CAAb;AAgBA,oCAAa,IAAb,EAAmB;AACjB,MAAA;AADiB,KAAnB;;AAGA,QAAI,QAAQ,CAAC,WAAT,KAAyB,SAA7B,EAAwC;AACtC,MAAA,IAAI,CAAC,IAAL,CAAU,eAAV,EAA2B,IAA3B;AACD;;AAED,UAAM,QAAQ,CAAC,IAAT,CAAc,0BAAd,CAAyC;AAC7C,MAAA,IAAI,EAAE,YADuC;AAE7C,MAAA,gBAAgB,EAAE,QAAQ,CAAC,uBAAT,CAAiC,YAAjC,EAA+C,UAA/C,EAA2D,IAA3D,EAAiE,KAAjE,CAF2B;AAG7C,MAAA,MAAM,EAAE,IAHqC;AAI7C,MAAA,IAJ6C;AAK7C,MAAA,QAL6C;AAM7C,MAAA,iBAAiB,EAAE,IAN0B;AAO7C,MAAA,UAAU,EAAE,MAAM,2CAAwB,IAAxB;AAP2B,KAAzC,CAAN;AASD;;AA7E+C,C","sourcesContent":["import { Arch, serializeToYaml } from \"builder-util\"\nimport { outputFile } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { AppImageOptions } from \"..\"\nimport { Target } from \"../core\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { getAppUpdatePublishConfiguration } from \"../publish/PublishManager\"\nimport { executeAppBuilderAsJson, objectToArgs } from \"../util/appBuilder\"\nimport { getNotLocalizedLicenseFile } from \"../util/license\"\nimport { LinuxTargetHelper } from \"./LinuxTargetHelper\"\nimport { createStageDir } from \"./targetUtil\"\n\n// https://unix.stackexchange.com/questions/375191/append-to-sub-directory-inside-squashfs-file\nexport default class AppImageTarget extends Target {\n readonly options: AppImageOptions = {...this.packager.platformSpecificBuildOptions, ...(this.packager.config as any)[this.name]}\n private readonly desktopEntry: Lazy\n\n constructor(ignored: string, private readonly packager: LinuxPackager, private readonly helper: LinuxTargetHelper, readonly outDir: string) {\n super(\"appImage\")\n\n this.desktopEntry = new Lazy(() => helper.computeDesktopEntry(this.options, \"AppRun\", {\n \"X-AppImage-Version\": `${packager.appInfo.buildVersion}`,\n }))\n }\n\n async build(appOutDir: string, arch: Arch): Promise {\n const packager = this.packager\n const options = this.options\n // https://github.com/electron-userland/electron-builder/issues/775\n // https://github.com/electron-userland/electron-builder/issues/1726\n // tslint:disable-next-line:no-invalid-template-strings\n const artifactName = packager.expandArtifactNamePattern(options, \"AppImage\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: \"AppImage\",\n file: artifactPath,\n arch,\n })\n\n const c = await Promise.all([\n this.desktopEntry.value,\n this.helper.icons,\n getAppUpdatePublishConfiguration(packager, arch, false /* in any case validation will be done on publish */),\n getNotLocalizedLicenseFile(options.license, this.packager, [\"txt\", \"html\"]),\n createStageDir(this, packager, arch),\n ])\n const license = c[3]\n const stageDir = c[4]\n\n const publishConfig = c[2]\n if (publishConfig != null) {\n await outputFile(path.join(packager.getResourcesDir(stageDir.dir), \"app-update.yml\"), serializeToYaml(publishConfig))\n }\n\n if (this.packager.packagerOptions.effectiveOptionComputed != null && await this.packager.packagerOptions.effectiveOptionComputed({desktop: await this.desktopEntry.value})) {\n return\n }\n\n const args = [\n \"appimage\",\n \"--stage\", stageDir.dir,\n \"--arch\", Arch[arch],\n \"--output\", artifactPath,\n \"--app\", appOutDir,\n \"--configuration\", (JSON.stringify({\n productName: this.packager.appInfo.productName,\n productFilename: this.packager.appInfo.productFilename,\n desktopEntry: c[0],\n executableName: this.packager.executableName,\n icons: c[1],\n fileAssociations: this.packager.fileAssociations,\n ...options,\n })),\n ]\n objectToArgs(args, {\n license,\n })\n if (packager.compression === \"maximum\") {\n args.push(\"--compression\", \"xz\")\n }\n\n await packager.info.callArtifactBuildCompleted({\n file: artifactPath,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"AppImage\", arch, false),\n target: this,\n arch,\n packager,\n isWriteUpdateInfo: true,\n updateInfo: await executeAppBuilderAsJson(args),\n })\n }\n}"],"sourceRoot":""}