"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ProductStack=void 0;const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),crypto=require("crypto"),fs=require("fs"),path=require("path"),cdk=require("../../core"),product_stack_synthesizer_1=require("./private/product-stack-synthesizer");class ProductStack extends cdk.Stack{constructor(scope,id){super(scope,id,{synthesizer:new product_stack_synthesizer_1.ProductStackSynthesizer}),this._parentStack=findParentStack(scope),this.templateFile=`${cdk.Names.uniqueId(this)}.product.template.json`}_setParentProductStackHistory(parentProductStackHistory){return this._parentProductStackHistory=parentProductStackHistory}_getTemplateUrl(){return cdk.Lazy.uncachedString({produce:()=>this._templateUrl})}_synthesizeTemplate(session){const cfn=JSON.stringify(this._toCloudFormation(),void 0,2),templateHash=crypto.createHash("sha256").update(cfn).digest("hex");this._templateUrl=this._parentStack.synthesizer.addFileAsset({packaging:cdk.FileAssetPackaging.FILE,sourceHash:templateHash,fileName:this.templateFile}).httpUrl,this._parentProductStackHistory&&this._parentProductStackHistory._writeTemplateToSnapshot(cfn),fs.writeFileSync(path.join(session.assembly.outdir,this.templateFile),cfn)}}exports.ProductStack=ProductStack,_a=JSII_RTTI_SYMBOL_1,ProductStack[_a]={fqn:"aws-cdk-lib.aws_servicecatalog.ProductStack",version:"2.29.0"};function findParentStack(scope){try{return cdk.Stack.of(scope)}catch{throw new Error("Product stacks must be defined within scope of another non-product stack")}}
//# sourceMappingURL=product-stack.js.map
