"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),r=require("react/jsx-runtime"),t=require("react"),i=require("../utils/useSyncProps.js"),l=require("./utils/getDefaultRadiusMiles.js"),n=require("./createFilterStore.js"),o=require("./FilterStoreContext.js"),s=require("./utils/normalizeFilters.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=u(e);function c(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,i)}return t}function d(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?c(Object(t),!0).forEach((function(r){a.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):c(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var f=function(e){var u=e.children,a=e.filters,c=e.canViewCompanies,f=t.useRef(null);if(!f.current){var p,v,j,y,b=l.getDefaultRadiusMiles(),O=s.normalizeFilters(a),P=d(d({},O),{},{selectionMode:null!==(p=null==O?void 0:O.selectionMode)&&void 0!==p?p:"radius",radius:null!==(v=null==O?void 0:O.radius)&&void 0!==v?v:b,drillingWells:null===(j=null==O?void 0:O.drillingWells)||void 0===j||j,interventionWells:null===(y=null==O?void 0:O.interventionWells)||void 0===y||y}),g={selectionMode:"radius",radius:b,drillingWells:!0,interventionWells:!0};f.current=n.createFilterStore({filters:P,defaultFilters:g,canViewCompanies:c})}var m=f.current;return i.useSyncProps(m,{canViewCompanies:c},[{key:"canViewCompanies"}]),t.useEffect((function(){var e=s.normalizeFilters(a);void 0!==e&&m.getState().setFilters(e,"external_sync")}),[m,a]),r.jsx(o.FilterStoreContext.Provider,{value:m,children:u})};f.displayName="FilterStoreProvider",exports.FilterStoreProvider=f;
//# sourceMappingURL=FilterStoreProvider.js.map
