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