{"version":3,"file":"migrate-font-family.mjs","names":["blockEditorPrivateApis"],"sources":["../../src/utils/migrate-font-family.js"],"sourcesContent":["import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { unlock } from '../lock-unlock';\n\nconst { cleanEmptyObject } = unlock( blockEditorPrivateApis );\n\n/**\n * Migrates the current style.typography.fontFamily attribute,\n * whose value was \"var:preset|font-family|helvetica-arial\",\n * to the style.fontFamily attribute, whose value will be \"helvetica-arial\".\n *\n * @param {Object} attributes The current attributes\n * @return {Object} The updated attributes.\n */\nexport default function ( attributes ) {\n\tif ( ! attributes?.style?.typography?.fontFamily ) {\n\t\treturn attributes;\n\t}\n\n\tconst { fontFamily, ...typography } = attributes.style.typography;\n\n\treturn {\n\t\t...attributes,\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...attributes.style,\n\t\t\ttypography,\n\t\t} ),\n\t\tfontFamily: fontFamily.split( '|' ).pop(),\n\t};\n}\n"],"mappings":";;;AAGA,MAAM,EAAE,qBAAqB,OAAQA,WAAuB;;;;;;;;;AAU5D,SAAA,4BAA0B,YAAa;CACtC,IAAK,CAAE,YAAY,OAAO,YAAY,YACrC,OAAO;CAGR,MAAM,EAAE,YAAY,GAAG,eAAe,WAAW,MAAM;CAEvD,OAAO;EACN,GAAG;EACH,OAAO,iBAAkB;GACxB,GAAG,WAAW;GACd;EACD,CAAE;EACF,YAAY,WAAW,MAAO,GAAI,CAAC,CAAC,IAAI;CACzC;AACD"}