import{jsx as e}from"react/jsx-runtime";import{useRef as t}from"react";import{createStore as r}from"zustand";import{createInitialStore as o}from"../Store/Store.js";import"../Store/utils.js";import{StoreContext as l}from"../utils.js";import"../../AppCommonsProvider/AppCommonsProvider.js";import{useAppCommons as p}from"../../AppCommonsProvider/AppCommonsContext.js";import{StoreControl as n}from"./StoreControl.js";var a=function(a){var m=a.children,i=a.presetTemplates,s=a.onChange,d=a.foldersEnabled,u=void 0===d||d,c=a.templateIconColors,f=a.templateIconMap,I=a.defaultTemplateIcon,C=a.currentTemplateId,T=a.templateSettings,v=a.publishEnabled,g=void 0===v||v,b=a.getDefaultTemplate,h=a.defaultTemplateIconColor,j=a.filterInitialTemplates,S=a.templateControls,E=a.reloadListOnOpen,P=void 0===E||E,A=p(),O=A.appKey,x=A.currentUser,y=A.rig,D=t(null);return null===D.current&&null!=x&&x.id&&(D.current=r()(o({presetTemplates:i,appKey:O,foldersEnabled:u,templateIconColors:c,templateIconMap:f,defaultTemplateIcon:I,userId:x.id,userProgramIds:x.unit_ids,publishEnabled:g,defaultTemplateIconColor:h,appEntities:{rigId:y?Number(y.id):void 0},reloadListOnOpen:P}))),e(l.Provider,{value:D.current,children:e(n,{onChange:s,templateSettings:T,currentTemplateId:C,getDefaultTemplate:b,filterInitialTemplates:j,templateControls:S,children:m})})};export{a as Provider};
//# sourceMappingURL=Provider.js.map
