{"version":3,"file":"reducer.mjs","names":[],"sources":["../../src/store/reducer.ts"],"sourcesContent":["import { combineReducers } from '@wordpress/data';\nimport type { Action, StoreState } from './types';\n\nexport function complementaryAreas(\n\tstate: StoreState[ 'complementaryAreas' ] = {},\n\taction: Action\n): StoreState[ 'complementaryAreas' ] {\n\tswitch ( action.type ) {\n\t\tcase 'SET_DEFAULT_COMPLEMENTARY_AREA': {\n\t\t\tconst { scope, area } = action;\n\n\t\t\t// If there's already an area, don't overwrite it.\n\t\t\tif ( state[ scope ] ) {\n\t\t\t\treturn state;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ scope ]: area,\n\t\t\t};\n\t\t}\n\t\tcase 'ENABLE_COMPLEMENTARY_AREA': {\n\t\t\tconst { scope, area } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ scope ]: area,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for storing the name of the open modal, or null if no modal is open.\n *\n * @param state  Previous state.\n * @param action Action object containing the `name` of the modal\n *\n * @return Updated state\n */\nexport function activeModal(\n\tstate: StoreState[ 'activeModal' ] = null,\n\taction: Action\n): StoreState[ 'activeModal' ] {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_MODAL':\n\t\t\treturn action.name;\n\t\tcase 'CLOSE_MODAL':\n\t\t\treturn null;\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tcomplementaryAreas,\n\tactiveModal,\n} );\n"],"mappings":";;AAGA,SAAgB,mBACf,QAA4C,CAAC,GAC7C,QACqC;CACrC,QAAS,OAAO,MAAhB;EACC,KAAK,kCAAkC;GACtC,MAAM,EAAE,OAAO,SAAS;GAGxB,IAAK,MAAO,QACX,OAAO;GAGR,OAAO;IACN,GAAG;KACD,QAAS;GACZ;EACD;EACA,KAAK,6BAA6B;GACjC,MAAM,EAAE,OAAO,SAAS;GACxB,OAAO;IACN,GAAG;KACD,QAAS;GACZ;EACD;CACD;CAEA,OAAO;AACR;;;;;;;;;AAUA,SAAgB,YACf,QAAqC,MACrC,QAC8B;CAC9B,QAAS,OAAO,MAAhB;EACC,KAAK,cACJ,OAAO,OAAO;EACf,KAAK,eACJ,OAAO;CACT;CAEA,OAAO;AACR;AAEA,IAAA,kBAAe,gBAAiB;CAC/B;CACA;AACD,CAAE"}