"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/objectWithoutProperties"),t=require("react/jsx-runtime"),l=require("react"),s=require("lodash"),o=require("./createPickerPropsStore.js"),i=require("./PickerPropsStoreContext.js"),a=require("./utils/getEffectiveIsLoadAllWells.js"),u=require("../utils/useSyncProps.js"),n=require("../utils/useStableCallback.js");require("../../viewport/ViewportProvider.js");var c=require("../../viewport/useViewType.js");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var y=f(e),d=f(r),b=["children"];function p(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);r&&(l=l.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,l)}return t}function P(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?p(Object(t),!0).forEach((function(r){y.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}exports.PickerPropsStoreProvider=function(e){var r=e.children,f=d.default(e,b),y=l.useRef(null),p=c.useViewType().isMobile,k=n.useStableCallback(f.onSave),j=n.useStableCallback(f.onClose),v=n.useStableCallback(f.addWellsUsabilityInfo);return y.current||(y.current=o.createPickerPropsStore(P(P({},f),{},{onSave:k,onClose:j,addWellsUsabilityInfo:v})),p&&y.current.setState({isLoadAllWells:!1})),u.useSyncProps(y.current,f,[{key:"segment"},{key:"open"},{key:"isViewOnly"},{key:"isWDUser"},{key:"defaultSubjectWell",equals:s.isEqual},{key:"offsetSettings",equals:s.isEqual},{key:"currentUser",equals:s.isEqual},{key:"maxOffsetSize"},{key:"localMaxOffsetSize"},{key:"syncAutoEnabled"},{key:"isManualWellsEnabled"},{key:"isGlobalMode"},{key:"loadAllWellsByDefault"},{key:"additionalFilterControls",equals:s.isEqual,transform:function(e){return null!=e?e:[]}},{key:"isLoadAllWells",transform:function(e,r){var t;return!p&&a.getEffectiveIsLoadAllWells({offsetSettingsIsLoadAllWells:null===(t=r.offsetSettings)||void 0===t?void 0:t.isLoadAllWells,loadAllWellsByDefault:r.loadAllWellsByDefault,isGlobalMode:r.isGlobalMode})}}]),t.jsx(i.PickerPropsStoreContext.Provider,{value:y.current,children:r})};
//# sourceMappingURL=PickerPropsStoreProvider.js.map
