{"version":3,"file":"deprecated.mjs","names":[],"sources":["../../src/math/deprecated.jsx"],"sourcesContent":["import { useBlockProps } from '@wordpress/block-editor';\n\n// Earlier versions stored the LaTeX source in the block comment. Content that\n// could not be rendered was saved with an empty `<math>`, so the source is\n// only available from the comment attribute for such blocks.\nconst legacyAttributes = {\n\tlatex: {\n\t\ttype: 'string',\n\t\trole: 'content',\n\t},\n\tmathML: {\n\t\ttype: 'string',\n\t\tsource: 'html',\n\t\tselector: 'math',\n\t},\n};\n\n// v2: The LaTeX source was stored in the block comment.\nconst v2 = {\n\tattributes: legacyAttributes,\n\tsave( { attributes } ) {\n\t\tconst { latex, mathML } = attributes;\n\n\t\tif ( ! latex ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<div { ...useBlockProps.save() }>\n\t\t\t\t<math\n\t\t\t\t\tdisplay=\"block\"\n\t\t\t\t\tdangerouslySetInnerHTML={ { __html: mathML } }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t},\n};\n\n// v1: Add a wrapper div around the math element.\nconst v1 = {\n\tattributes: legacyAttributes,\n\tsave( { attributes } ) {\n\t\tconst { latex, mathML } = attributes;\n\n\t\tif ( ! latex ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<math\n\t\t\t\t{ ...useBlockProps.save() }\n\t\t\t\tdisplay=\"block\"\n\t\t\t\tdangerouslySetInnerHTML={ { __html: mathML } }\n\t\t\t/>\n\t\t);\n\t},\n};\n\n/**\n * New deprecations need to be placed first\n * for them to have higher priority.\n *\n * Old deprecations may need to be updated as well.\n *\n * See block-deprecation.md\n */\nexport default [ v2, v1 ];\n"],"mappings":";;;AAKA,MAAM,mBAAmB;CACxB,OAAO;EACN,MAAM;EACN,MAAM;CACP;CACA,QAAQ;EACP,MAAM;EACN,QAAQ;EACR,UAAU;CACX;AACD;;;;;;;;;AAmDA,IAAA,qBAAe,CAAE;CA/ChB,YAAY;CACZ,KAAM,EAAE,cAAe;EACtB,MAAM,EAAE,OAAO,WAAW;EAE1B,IAAK,CAAE,OACN,OAAO;EAGR,OACC,oBAAC,OAAD;GAAK,GAAK,cAAc,KAAK;GAC5B,UAAA,oBAAC,QAAD;IACC,SAAQ;IACR,yBAA0B,EAAE,QAAQ,OAAO;GAC3C,CAAA;EACG,CAAA;CAEP;AA+BgB,GAAI;CA1BpB,YAAY;CACZ,KAAM,EAAE,cAAe;EACtB,MAAM,EAAE,OAAO,WAAW;EAE1B,IAAK,CAAE,OACN,OAAO;EAGR,OACC,oBAAC,QAAD;GACC,GAAK,cAAc,KAAK;GACxB,SAAQ;GACR,yBAA0B,EAAE,QAAQ,OAAO;EAC3C,CAAA;CAEH;AAWoB,CAAG"}