import{i as e,n as t}from"./rolldown-runtime-ConPGZeh.js";import{Jr as n,Nn as r,Xn as i,qr as a}from"./vendor-primevue-D1-E3-0M.js";import{H as o,R as s,fn as c,hn as l,i as u,mn as d,pn as f,r as p}from"./api-DvJuMrZn.js";import{i as m,n as h}from"./remoteConfig-BiMFcSmW.js";function useFeatureFlags(){let e=a({get supportsPreviewMetadata(){return p.getServerFeature(g.SUPPORTS_PREVIEW_METADATA)},get maxUploadSize(){return p.getServerFeature(g.MAX_UPLOAD_SIZE)},get supportsManagerV4(){return p.getServerFeature(g.MANAGER_SUPPORTS_V4)},get modelUploadButtonEnabled(){return m.value.model_upload_button_enabled??p.getServerFeature(g.MODEL_UPLOAD_BUTTON_ENABLED,!1)},get assetDeletionEnabled(){return m.value.asset_deletion_enabled??p.getServerFeature(g.ASSET_DELETION_ENABLED,!1)},get assetRenameEnabled(){return m.value.asset_rename_enabled??p.getServerFeature(g.ASSET_RENAME_ENABLED,!1)},get privateModelsEnabled(){return m.value.private_models_enabled??p.getServerFeature(g.PRIVATE_MODELS_ENABLED,!1)},get onboardingSurveyEnabled(){return m.value.onboarding_survey_enabled??p.getServerFeature(g.ONBOARDING_SURVEY_ENABLED,!0)},get huggingfaceModelImportEnabled(){return m.value.huggingface_model_import_enabled??p.getServerFeature(g.HUGGINGFACE_MODEL_IMPORT_ENABLED,!1)},get linearToggleEnabled(){return m.value.linear_toggle_enabled??p.getServerFeature(g.LINEAR_TOGGLE_ENABLED,!1)},get asyncModelUploadEnabled(){return m.value.async_model_upload_enabled??p.getServerFeature(g.ASYNC_MODEL_UPLOAD_ENABLED,!1)},get teamWorkspacesEnabled(){return l?m.value.team_workspaces_enabled??p.getServerFeature(g.TEAM_WORKSPACES_ENABLED,!1):!1}}),featureFlag=(e,t)=>i(()=>p.getServerFeature(e,t));return{flags:n(e),featureFlag}}var g,_=t((()=>{r(),d(),h(),u(),g=function(e){return e.SUPPORTS_PREVIEW_METADATA=`supports_preview_metadata`,e.MAX_UPLOAD_SIZE=`max_upload_size`,e.MANAGER_SUPPORTS_V4=`extension.manager.supports_v4`,e.MODEL_UPLOAD_BUTTON_ENABLED=`model_upload_button_enabled`,e.ASSET_DELETION_ENABLED=`asset_deletion_enabled`,e.ASSET_RENAME_ENABLED=`asset_rename_enabled`,e.PRIVATE_MODELS_ENABLED=`private_models_enabled`,e.ONBOARDING_SURVEY_ENABLED=`onboarding_survey_enabled`,e.HUGGINGFACE_MODEL_IMPORT_ENABLED=`huggingface_model_import_enabled`,e.LINEAR_TOGGLE_ENABLED=`linear_toggle_enabled`,e.ASYNC_MODEL_UPLOAD_ENABLED=`async_model_upload_enabled`,e.TEAM_WORKSPACES_ENABLED=`team_workspaces_enabled`,e}({})}));function useErrorHandling(){let e=f(),toastErrorHandler=t=>{e.add({severity:`error`,summary:o(`g.error`),detail:t instanceof Error?t.message:o(`g.unknownError`)}),console.error(t)},wrapWithErrorHandling=(e,t,n)=>(...r)=>{try{return e(...r)}catch(e){(t??toastErrorHandler)(e)}finally{n?.()}},wrapWithErrorHandlingAsync=(e,t,n,r=[])=>async(...i)=>{try{return await e(...i)}catch(n){for(let t of r)if(t.shouldHandle(n))try{await t.recover(n,e,i);return}catch(e){console.error(`Recovery strategy failed:`,e)}(t??toastErrorHandler)(n)}finally{n?.()}};return{wrapWithErrorHandling,wrapWithErrorHandlingAsync,toastErrorHandler}}var v=t((()=>{s(),c()}));export{useFeatureFlags as i,useErrorHandling as n,_ as r,v as t};
//# sourceMappingURL=useErrorHandling-DNVxJ2sn.js.map