{"ast":null,"code":"\"use strict\";\n\nvar _Set = require(\"@babel/runtime-corejs2/core-js/set\");\n\nvar _Object$defineProperty = require(\"@babel/runtime-corejs2/core-js/object/define-property\");\n\n_Object$defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nconst react_1 = require(\"react\");\n\nconst isServer = true;\n\nexports.default = () => {\n  const mountedInstances = new _Set();\n  let state;\n\n  function emitChange(component) {\n    state = component.props.reduceComponentsToState([...mountedInstances], component.props);\n\n    if (component.props.handleStateChange) {\n      component.props.handleStateChange(state);\n    }\n  }\n\n  return class extends react_1.Component {\n    // Used when server rendering\n    static rewind() {\n      const recordedState = state;\n      state = undefined;\n      mountedInstances.clear();\n      return recordedState;\n    }\n\n    constructor(props) {\n      super(props);\n\n      if (isServer) {\n        mountedInstances.add(this);\n        emitChange(this);\n      }\n    }\n\n    componentDidMount() {\n      mountedInstances.add(this);\n      emitChange(this);\n    }\n\n    componentDidUpdate() {\n      emitChange(this);\n    }\n\n    componentWillUnmount() {\n      mountedInstances.delete(this);\n      emitChange(this);\n    }\n\n    render() {\n      return null;\n    }\n\n  };\n};","map":{"version":3,"sources":["/Users/sbourgal/Documents/Projets/DAN/dan-framework/template/node_modules/next/dist/next-server/lib/side-effect.js"],"names":["exports","value","react_1","require","isServer","default","mountedInstances","state","emitChange","component","props","reduceComponentsToState","handleStateChange","Component","rewind","recordedState","undefined","clear","constructor","add","componentDidMount","componentDidUpdate","componentWillUnmount","delete","render"],"mappings":"AAAA;;;;;;AACA,uBAAsBA,OAAtB,EAA+B,YAA/B,EAA6C;AAAEC,EAAAA,KAAK,EAAE;AAAT,CAA7C;;AACA,MAAMC,OAAO,GAAGC,OAAO,CAAC,OAAD,CAAvB;;AACA,MAAMC,QAAQ,OAAd;;AACAJ,OAAO,CAACK,OAAR,GAAkB,MAAM;AACpB,QAAMC,gBAAgB,GAAG,UAAzB;AACA,MAAIC,KAAJ;;AACA,WAASC,UAAT,CAAoBC,SAApB,EAA+B;AAC3BF,IAAAA,KAAK,GAAGE,SAAS,CAACC,KAAV,CAAgBC,uBAAhB,CAAwC,CAAC,GAAGL,gBAAJ,CAAxC,EAA+DG,SAAS,CAACC,KAAzE,CAAR;;AACA,QAAID,SAAS,CAACC,KAAV,CAAgBE,iBAApB,EAAuC;AACnCH,MAAAA,SAAS,CAACC,KAAV,CAAgBE,iBAAhB,CAAkCL,KAAlC;AACH;AACJ;;AACD,SAAO,cAAcL,OAAO,CAACW,SAAtB,CAAgC;AACnC;AACA,WAAOC,MAAP,GAAgB;AACZ,YAAMC,aAAa,GAAGR,KAAtB;AACAA,MAAAA,KAAK,GAAGS,SAAR;AACAV,MAAAA,gBAAgB,CAACW,KAAjB;AACA,aAAOF,aAAP;AACH;;AACDG,IAAAA,WAAW,CAACR,KAAD,EAAQ;AACf,YAAMA,KAAN;;AACA,UAAIN,QAAJ,EAAc;AACVE,QAAAA,gBAAgB,CAACa,GAAjB,CAAqB,IAArB;AACAX,QAAAA,UAAU,CAAC,IAAD,CAAV;AACH;AACJ;;AACDY,IAAAA,iBAAiB,GAAG;AAChBd,MAAAA,gBAAgB,CAACa,GAAjB,CAAqB,IAArB;AACAX,MAAAA,UAAU,CAAC,IAAD,CAAV;AACH;;AACDa,IAAAA,kBAAkB,GAAG;AACjBb,MAAAA,UAAU,CAAC,IAAD,CAAV;AACH;;AACDc,IAAAA,oBAAoB,GAAG;AACnBhB,MAAAA,gBAAgB,CAACiB,MAAjB,CAAwB,IAAxB;AACAf,MAAAA,UAAU,CAAC,IAAD,CAAV;AACH;;AACDgB,IAAAA,MAAM,GAAG;AACL,aAAO,IAAP;AACH;;AA5BkC,GAAvC;AA8BH,CAvCD","sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst react_1 = require(\"react\");\nconst isServer = typeof window === 'undefined';\nexports.default = () => {\n    const mountedInstances = new Set();\n    let state;\n    function emitChange(component) {\n        state = component.props.reduceComponentsToState([...mountedInstances], component.props);\n        if (component.props.handleStateChange) {\n            component.props.handleStateChange(state);\n        }\n    }\n    return class extends react_1.Component {\n        // Used when server rendering\n        static rewind() {\n            const recordedState = state;\n            state = undefined;\n            mountedInstances.clear();\n            return recordedState;\n        }\n        constructor(props) {\n            super(props);\n            if (isServer) {\n                mountedInstances.add(this);\n                emitChange(this);\n            }\n        }\n        componentDidMount() {\n            mountedInstances.add(this);\n            emitChange(this);\n        }\n        componentDidUpdate() {\n            emitChange(this);\n        }\n        componentWillUnmount() {\n            mountedInstances.delete(this);\n            emitChange(this);\n        }\n        render() {\n            return null;\n        }\n    };\n};\n"]},"metadata":{},"sourceType":"script"}