"use strict";(globalThis.webpackChunk_automattic_jetpack_forms_blocks=globalThis.webpackChunk_automattic_jetpack_forms_blocks||[]).push([[420],{329(t,e,r){var a=r(4715),o=r(7143),s=r(3656),c=r(2619),i=r(7723),n=r(692),l=r(1435),u=r(2441);const __=i.__;async function k(t,e){if("jetpack/contact-form"!==e)return;const r=(0,o.select)(s.store);if(r.getCurrentPostType()===l.$8)return;const c=(0,o.select)(a.store),i=c.getBlock(t);if(!i||!i.innerBlocks?.length)return;if(i.attributes?.ref)return;const k=r.getCurrentPostId()||0,f=r.getEditedPostAttribute("title")||__("Generated Form","jetpack-forms");try{const e=await(0,u.r)({attributes:i.attributes,innerBlocks:i.innerBlocks},f,Number(k)||0);if(!e)return;const r=c.getBlock(t);if(!r||r.attributes?.ref)return;(0,o.dispatch)(a.store).updateBlockAttributes(t,{ref:e})}catch(t){console.error("Failed to create synced form:",t),(0,o.dispatch)(n.store).createErrorNotice(__("Failed to save the Generated form. Your form is still available but not synced.","jetpack-forms"),{type:"snackbar"})}}(0,c.hasAction)("jetpack_ai_assistant_generation_complete","jetpack-forms/ai-integration")||(0,c.addAction)("jetpack_ai_assistant_generation_complete","jetpack-forms/ai-integration",k)}},t=>{var e;e=329,t(t.s=e)}]);