Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@storybook/manager-api

Package Overview
Dependencies
Maintainers
31
Versions
811
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storybook/manager-api - npm Package Compare versions

Comparing version 7.1.0-alpha.40 to 7.1.0-alpha.41

2

dist/index.js

@@ -15,2 +15,2 @@ var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var src_exports={};__export(src_exports,{ActiveTabs:()=>ActiveTabs2,Consumer:()=>ManagerConsumer,ManagerContext:()=>ManagerContext,Provider:()=>ManagerProvider,addons:()=>addons,combineParameters:()=>combineParameters,controlOrMetaKey:()=>controlOrMetaKey,controlOrMetaSymbol:()=>controlOrMetaSymbol,eventMatchesShortcut:()=>eventMatchesShortcut,eventToShortcut:()=>eventToShortcut,isMacLike:()=>isMacLike,isShortcutTaken:()=>isShortcutTaken,keyToSymbol:()=>keyToSymbol,merge:()=>merge_default,mockChannel:()=>mockChannel,optionOrAltSymbol:()=>optionOrAltSymbol,shortcutMatchesShortcut:()=>shortcutMatchesShortcut,shortcutToHumanString:()=>shortcutToHumanString,types:()=>import_types2.Addon_TypesEnum,useAddonState:()=>useAddonState,useArgTypes:()=>useArgTypes,useArgs:()=>useArgs,useChannel:()=>useChannel,useGlobalTypes:()=>useGlobalTypes,useGlobals:()=>useGlobals,useParameter:()=>useParameter,useSharedState:()=>useSharedState,useStoryPrepared:()=>useStoryPrepared,useStorybookApi:()=>useStorybookApi,useStorybookState:()=>useStorybookState});module.exports=__toCommonJS(src_exports);var import_react2=__toESM(require("react")),import_mergeWith2=__toESM(require("lodash/mergeWith.js")),import_core_events8=require("@storybook/core-events"),import_client_logger6=require("@storybook/client-logger");var import_react=require("react"),createContext=({api,state})=>(0,import_react.createContext)({api,state});var import_store2=__toESM(require("store2"));var import_telejson=require("telejson"),store_setup_default=_=>{_.fn("set",function(key,data){return _.set(this._area,this._in(key),(0,import_telejson.stringify)(data,{maxDepth:50}))}),_.fn("get",function(key,alt){let value=_.get(this._area,this._in(key));return value!==null?(0,import_telejson.parse)(value):alt||value})};store_setup_default(import_store2.default._);var STORAGE_KEY="@storybook/manager/store";function get(storage){return storage.get(STORAGE_KEY)||{}}function set(storage,value){return storage.set(STORAGE_KEY,value)}function update(storage,patch){let previous=get(storage);return set(storage,{...previous,...patch})}var Store=class{constructor({setState,getState}){this.upstreamSetState=setState,this.upstreamGetState=getState}getInitialState(base){return{...base,...get(import_store2.default.local),...get(import_store2.default.session)}}getState(){return this.upstreamGetState()}async setState(inputPatch,cbOrOptions,inputOptions){let callback,options;typeof cbOrOptions=="function"?(callback=cbOrOptions,options=inputOptions):options=cbOrOptions;let{persistence="none"}=options||{},patch={},delta={};typeof inputPatch=="function"?patch=state=>(delta=inputPatch(state),delta):(patch=inputPatch,delta=patch);let newState=await new Promise(resolve=>{this.upstreamSetState(patch,resolve)});if(persistence!=="none"){let storage=persistence==="session"?import_store2.default.session:import_store2.default.local;await update(storage,delta)}return callback&&callback(newState),newState}};var import_mergeWith=__toESM(require("lodash/mergeWith.js")),import_isEqual=__toESM(require("lodash/isEqual.js")),import_client_logger=require("@storybook/client-logger"),merge_default=(a,b)=>(0,import_mergeWith.default)({},a,b,(objValue,srcValue)=>{if(Array.isArray(srcValue)&&Array.isArray(objValue))return srcValue.forEach(s=>{objValue.find(o=>o===s||(0,import_isEqual.default)(o,s))||objValue.push(s)}),objValue;if(Array.isArray(objValue))return import_client_logger.logger.log(["the types mismatch, picking",objValue]),objValue});var main=(...additions)=>additions.reduce((acc,item)=>merge_default(acc,item),{}),initial_state_default=main;var provider_exports={};__export(provider_exports,{init:()=>init});var init=({provider,fullAPI})=>({api:provider.renderPreview?{renderPreview:provider.renderPreview}:{},state:{},init:()=>{provider.handleAPI(fullAPI)}});var addons_exports={};__export(addons_exports,{ensurePanel:()=>ensurePanel,init:()=>init2});var import_types=require("@storybook/types");function ensurePanel(panels,selectedPanel,currentPanel){let keys2=Object.keys(panels);return keys2.indexOf(selectedPanel)>=0?selectedPanel:keys2.length?keys2[0]:currentPanel}var init2=({provider,store:store2,fullAPI})=>{let api={getElements:type=>provider.getElements(type),getPanels:()=>api.getElements(import_types.Addon_TypesEnum.PANEL),getStoryPanels:()=>{let allPanels=api.getElements(import_types.Addon_TypesEnum.PANEL),{storyId}=store2.getState(),story=fullAPI.getData(storyId);if(!allPanels||!story||story.type!=="story")return allPanels;let{parameters}=story,filteredPanels={};return Object.entries(allPanels).forEach(([id,panel])=>{let{paramKey}=panel;paramKey&&parameters&&parameters[paramKey]&&parameters[paramKey].disable||(filteredPanels[id]=panel)}),filteredPanels},getSelectedPanel:()=>{let{selectedPanel}=store2.getState();return ensurePanel(api.getElements(import_types.Addon_TypesEnum.PANEL),selectedPanel,selectedPanel)},setSelectedPanel:panelName=>{store2.setState({selectedPanel:panelName},{persistence:"session"})},setAddonState(addonId,newStateOrMerger,options){let nextState,{addons:existing}=store2.getState();return typeof newStateOrMerger=="function"?nextState=newStateOrMerger(api.getAddonState(addonId)):nextState=newStateOrMerger,store2.setState({addons:{...existing,[addonId]:nextState}},options).then(()=>api.getAddonState(addonId))},getAddonState:addonId=>store2.getState().addons[addonId]};return{api,state:{selectedPanel:ensurePanel(api.getElements(import_types.Addon_TypesEnum.PANEL),store2.getState().selectedPanel),addons:{}}}};var channel_exports={};__export(channel_exports,{init:()=>init3});var import_core_events=require("@storybook/core-events"),init3=({provider})=>{let api={getChannel:()=>provider.channel,on:(type,handler)=>(provider.channel.on(type,handler),()=>provider.channel.off(type,handler)),off:(type,handler)=>provider.channel.off(type,handler),once:(type,handler)=>provider.channel.once(type,handler),emit:(type,data,...args)=>{var _a;(_a=data==null?void 0:data.options)!=null&&_a.target&&data.options.target!=="storybook-preview-iframe"&&!data.options.target.startsWith("storybook-ref-")&&(data.options.target=data.options.target!=="storybook_internal"?`storybook-ref-${data.options.target}`:"storybook-preview-iframe"),provider.channel.emit(type,data,...args)},collapseAll:()=>{api.emit(import_core_events.STORIES_COLLAPSE_ALL,{})},expandAll:()=>{api.emit(import_core_events.STORIES_EXPAND_ALL)}};return{api,state:{}}};var notifications_exports={};__export(notifications_exports,{init:()=>init4});var init4=({store:store2})=>{let api={addNotification:notification=>{api.clearNotification(notification.id);let{notifications}=store2.getState();store2.setState({notifications:[...notifications,notification]})},clearNotification:id=>{let{notifications}=store2.getState();store2.setState({notifications:notifications.filter(n=>n.id!==id)});let notification=notifications.find(n=>n.id===id);notification&&notification.onClear&&notification.onClear()}};return{api,state:{notifications:[]}}};var settings_exports={};__export(settings_exports,{init:()=>init5});var init5=({store:store2,navigate,fullAPI})=>{let isSettingsScreenActive=()=>{let{path}=fullAPI.getUrlState();return!!(path||"").match(/^\/settings/)};return{state:{settings:{lastTrackedStoryId:null}},api:{closeSettings:()=>{let{settings:{lastTrackedStoryId}}=store2.getState();lastTrackedStoryId?fullAPI.selectStory(lastTrackedStoryId):fullAPI.selectFirstStory()},changeSettingsTab:path=>{navigate(`/settings/${path}`)},isSettingsScreenActive,navigateToSettingsPage:async path=>{if(!isSettingsScreenActive()){let{settings,storyId}=store2.getState();await store2.setState({settings:{...settings,lastTrackedStoryId:storyId}})}navigate(path)}}}};var release_notes_exports={};__export(release_notes_exports,{init:()=>init6});var import_global=require("@storybook/global"),import_memoizerific=__toESM(require("memoizerific")),{RELEASE_NOTES_DATA}=import_global.global,getReleaseNotesData=(0,import_memoizerific.default)(1)(()=>{try{return{...JSON.parse(RELEASE_NOTES_DATA)||{}}}catch{return{}}}),init6=({store:store2})=>{let releaseNotesData=getReleaseNotesData(),getReleaseNotesViewed=()=>{let{releaseNotesViewed:persistedReleaseNotesViewed}=store2.getState();return persistedReleaseNotesViewed||[]};return{state:{releaseNotesViewed:[]},api:{releaseNotesVersion:()=>releaseNotesData.currentVersion,setDidViewReleaseNotes:()=>{let releaseNotesViewed=getReleaseNotesViewed();releaseNotesViewed.includes(releaseNotesData.currentVersion)||store2.setState({releaseNotesViewed:[...releaseNotesViewed,releaseNotesData.currentVersion]},{persistence:"permanent"})},showReleaseNotesOnLaunch:()=>{if(!releaseNotesData.currentVersion)return!1;let didViewReleaseNotes=getReleaseNotesViewed().includes(releaseNotesData.currentVersion);return releaseNotesData.showOnFirstLaunch&&!didViewReleaseNotes}}}};var stories_exports={};__export(stories_exports,{init:()=>init8});var import_global3=require("@storybook/global"),import_csf2=require("@storybook/csf"),import_core_events2=require("@storybook/core-events"),import_client_logger3=require("@storybook/client-logger");var import_client_logger2=require("@storybook/client-logger");var refs_exports={};__export(refs_exports,{defaultStoryMapper:()=>defaultStoryMapper,getSourceType:()=>getSourceType,init:()=>init7});var import_global2=require("@storybook/global"),import_ts_dedent2=require("ts-dedent");var import_memoizerific2=__toESM(require("memoizerific")),import_ts_dedent=require("ts-dedent"),import_countBy=__toESM(require("lodash/countBy.js")),import_mapValues=__toESM(require("lodash/mapValues.js")),import_csf=require("@storybook/csf");var TITLE_PATH_SEPARATOR=/\s*\/\s*/,denormalizeStoryParameters=({globalParameters,kindParameters,stories})=>(0,import_mapValues.default)(stories,storyData=>({...storyData,parameters:combineParameters(globalParameters,kindParameters[storyData.kind],storyData.parameters)})),transformSetStoriesStoryDataToStoriesHash=(data,{provider,docsOptions})=>transformStoryIndexToStoriesHash(transformSetStoriesStoryDataToPreparedStoryIndex(data),{provider,docsOptions}),transformSetStoriesStoryDataToPreparedStoryIndex=stories=>({v:4,entries:Object.entries(stories).reduce((acc,[id,story])=>{if(!story)return acc;let{docsOnly,fileName,...parameters}=story.parameters,base={title:story.kind,id,name:story.name,importPath:fileName};if(docsOnly)acc[id]={type:"docs",tags:["stories-mdx"],storiesImports:[],...base};else{let{argTypes,args,initialArgs}=story;acc[id]={type:"story",...base,parameters,argTypes,args,initialArgs}}return acc},{})}),transformStoryIndexV2toV3=index=>({v:3,stories:Object.values(index.stories).reduce((acc,entry)=>(acc[entry.id]={...entry,title:entry.kind,name:entry.name||entry.story,importPath:entry.parameters.fileName||""},acc),{})}),transformStoryIndexV3toV4=index=>{let countByTitle=(0,import_countBy.default)(Object.values(index.stories),"title");return{v:4,entries:Object.values(index.stories).reduce((acc,entry)=>{var _a;let type="story";return((_a=entry.parameters)!=null&&_a.docsOnly||entry.name==="Page"&&countByTitle[entry.title]===1)&&(type="docs"),acc[entry.id]={type,...type==="docs"&&{tags:["stories-mdx"],storiesImports:[]},...entry},delete acc[entry.id].story,delete acc[entry.id].kind,acc},{})}},transformStoryIndexToStoriesHash=(input,{provider,docsOptions})=>{if(!input.v)throw new Error("Composition: Missing stories.json version");let index=input;index=index.v===2?transformStoryIndexV2toV3(index):index,index=index.v===3?transformStoryIndexV3toV4(index):index,index=index;let entryValues=Object.values(index.entries),{sidebar={}}=provider.getConfig(),{showRoots,collapsedRoots=[],renderLabel}=sidebar,setShowRoots=typeof showRoots<"u",storiesHashOutOfOrder=Object.values(entryValues).reduce((acc,item)=>{if(docsOptions.docsMode&&item.type!=="docs")return acc;let{title}=item,groups=title.trim().split(TITLE_PATH_SEPARATOR),root=(!setShowRoots||showRoots)&&groups.length>1?[groups.shift()]:[],names=[...root,...groups],paths=names.reduce((list,name,idx)=>{let parent=idx>0&&list[idx-1],id=(0,import_csf.sanitize)(parent?`${parent}-${name}`:name);if(parent===id)throw new Error(import_ts_dedent.dedent`

Please check your dev-tools network tab.
`});let versions=ref.versions&&Object.keys(ref.versions).length?ref.versions:loadedData.versions;await api.setRef(id,{id,url:urlParseResult.url,...loadedData,...versions?{versions}:{},type:loadedData.storyIndex?"lazy":"auto-inject"})},getRefs:()=>{let{refs:refs2={}}=store2.getState();return refs2},setRef:(id,{storyIndex,setStoriesData,...rest},ready=!1)=>{if(singleStory)return;let{storyMapper=defaultStoryMapper}=provider.getConfig(),ref=api.getRefs()[id],index;setStoriesData?index=transformSetStoriesStoryDataToStoriesHash(map(setStoriesData,ref,{storyMapper}),{provider,docsOptions}):storyIndex&&(index=transformStoryIndexToStoriesHash(storyIndex,{provider,docsOptions})),index&&(index=addRefIds(index,ref)),api.updateRef(id,{index,...rest})},updateRef:(id,data)=>{let{[id]:ref,...updated}=api.getRefs();updated[id]={...ref,...data};let ordered=Object.keys(initialState).reduce((obj,key)=>(obj[key]=updated[key],obj),{});store2.setState({refs:ordered})}},refs=!singleStory&&import_global2.global.REFS||{},initialState=refs;return runCheck&&Object.entries(refs).forEach(([id,ref])=>{api.checkRef({...ref,stories:{}})}),{api,state:{refs:initialState}}};var getEventMetadata=(context,fullAPI)=>{let{source,refId,type}=context,[sourceType,sourceLocation]=getSourceType(source,refId),ref=refId&&fullAPI.getRefs()[refId]?fullAPI.getRefs()[refId]:fullAPI.findRef(sourceLocation),meta={source,sourceType,sourceLocation,refId,ref,type};switch(!0){case typeof refId=="string":case sourceType==="local":case sourceType==="external":return meta;default:return import_client_logger2.logger.warn(`Received a ${type} frame that was not configured as a ref`),null}};var{FEATURES,fetch:fetch2}=import_global3.global,STORY_INDEX_PATH="./index.json",removedOptions=["enableShortcuts","theme","showRoots"];function removeRemovedOptions(options){if(!options||typeof options=="string")return options;let result={...options};return removedOptions.forEach(option=>{option in result&&delete result[option]}),result}var init8=({fullAPI,store:store2,navigate,provider,storyId:initialStoryId,viewMode:initialViewMode,docsOptions={}})=>{let api={storyId:import_csf2.toId,getData:(storyId,refId)=>{let result=api.resolveStory(storyId,refId);if((result==null?void 0:result.type)==="story"||(result==null?void 0:result.type)==="docs")return result},isPrepared:(storyId,refId)=>{let data=api.getData(storyId,refId);return data.type==="story"?data.prepared:!0},resolveStory:(storyId,refId)=>{let{refs,index}=store2.getState();return refId&&!refs[refId]?null:refId?refs[refId].index?refs[refId].index[storyId]:void 0:index?index[storyId]:void 0},getCurrentStoryData:()=>{let{storyId,refId}=store2.getState();return api.getData(storyId,refId)},getParameters:(storyIdOrCombo,parameterName)=>{let{storyId,refId}=typeof storyIdOrCombo=="string"?{storyId:storyIdOrCombo,refId:void 0}:storyIdOrCombo,data=api.getData(storyId,refId);if(["story","docs"].includes(data==null?void 0:data.type)){let{parameters}=data;if(parameters)return parameterName?parameters[parameterName]:parameters}return null},getCurrentParameter:parameterName=>{let{storyId,refId}=store2.getState();return api.getParameters({storyId,refId},parameterName)||void 0},jumpToComponent:direction=>{let{index,storyId,refs,refId}=store2.getState();if(!api.getData(storyId,refId))return;let hash=refId?refs[refId].index||{}:index,result=api.findSiblingStoryId(storyId,hash,direction,!0);result&&api.selectStory(result,void 0,{ref:refId})},jumpToStory:direction=>{let{index,storyId,refs,refId}=store2.getState(),story=api.getData(storyId,refId);if(!story)return;let hash=story.refId?refs[story.refId].index:index,result=api.findSiblingStoryId(storyId,hash,direction,!1);result&&api.selectStory(result,void 0,{ref:refId})},selectFirstStory:()=>{let{index}=store2.getState(),firstStory=Object.keys(index).find(id=>index[id].type==="story");if(firstStory){api.selectStory(firstStory);return}navigate("/")},selectStory:(titleOrId=void 0,name=void 0,options={})=>{let{ref}=options,{storyId,index,refs}=store2.getState(),hash=ref?refs[ref].index:index,kindSlug=storyId==null?void 0:storyId.split("--",2)[0];if(name)if(titleOrId){let id=ref?`${ref}_${(0,import_csf2.toId)(titleOrId,name)}`:(0,import_csf2.toId)(titleOrId,name);if(hash[id])api.selectStory(id,void 0,options);else{let entry=hash[(0,import_csf2.sanitize)(titleOrId)];if((entry==null?void 0:entry.type)==="component"){let foundId=entry.children.find(childId=>hash[childId].name===name);foundId&&api.selectStory(foundId,void 0,options)}}}else{let id=(0,import_csf2.toId)(kindSlug,name);api.selectStory(id,void 0,options)}else{let entry=titleOrId?hash[titleOrId]||hash[(0,import_csf2.sanitize)(titleOrId)]:hash[kindSlug];if(!entry)throw new Error(`Unknown id or title: '${titleOrId}'`);let leafEntry=api.findLeafEntry(hash,entry.id),fullId=leafEntry.refId?`${leafEntry.refId}_${leafEntry.id}`:leafEntry.id;navigate(`/${leafEntry.type}/${fullId}`)}},findLeafEntry(index,storyId){let entry=index[storyId];if(entry.type==="docs"||entry.type==="story")return entry;let childStoryId=entry.children[0];return api.findLeafEntry(index,childStoryId)},findLeafStoryId(index,storyId){var _a;return(_a=api.findLeafEntry(index,storyId))==null?void 0:_a.id},findSiblingStoryId(storyId,index,direction,toSiblingGroup){if(toSiblingGroup){let lookupList2=getComponentLookupList(index),position2=lookupList2.findIndex(i=>i.includes(storyId));return position2===lookupList2.length-1&&direction>0||position2===0&&direction<0?void 0:lookupList2[position2+direction]?lookupList2[position2+direction][0]:void 0}let lookupList=getStoriesLookupList(index),position=lookupList.indexOf(storyId);if(!(position===lookupList.length-1&&direction>0)&&!(position===0&&direction<0))return lookupList[position+direction]},updateStoryArgs:(story,updatedArgs)=>{let{id:storyId,refId}=story;fullAPI.emit(import_core_events2.UPDATE_STORY_ARGS,{storyId,updatedArgs,options:{target:refId}})},resetStoryArgs:(story,argNames)=>{let{id:storyId,refId}=story;fullAPI.emit(import_core_events2.RESET_STORY_ARGS,{storyId,argNames,options:{target:refId}})},fetchIndex:async()=>{try{let result=await fetch2(STORY_INDEX_PATH);if(result.status!==200)throw new Error(await result.text());let storyIndex=await result.json();if(storyIndex.v<3){import_client_logger3.logger.warn(`Skipping story index with version v${storyIndex.v}, awaiting SET_STORIES.`);return}await fullAPI.setIndex(storyIndex)}catch(err){await store2.setState({indexError:err})}},setIndex:async storyIndex=>{let newHash=transformStoryIndexToStoriesHash(storyIndex,{provider,docsOptions}),oldHash=store2.getState().index;await store2.setState({index:addPreparedStories(newHash,oldHash),indexError:void 0})},updateStory:async(storyId,update2,ref)=>{if(ref){let{id:refId,index}=ref;index[storyId]={...index[storyId],...update2},await fullAPI.updateRef(refId,{index})}else{let{index}=store2.getState();index[storyId]={...index[storyId],...update2},await store2.setState({index})}},updateDocs:async(docsId,update2,ref)=>{if(ref){let{id:refId,index}=ref;index[docsId]={...index[docsId],...update2},await fullAPI.updateRef(refId,{index})}else{let{index}=store2.getState();index[docsId]={...index[docsId],...update2},await store2.setState({index})}},setPreviewInitialized:async ref=>{ref?fullAPI.updateRef(ref.id,{previewInitialized:!0}):store2.setState({previewInitialized:!0})},experimental_updateStatus:async(id,update2)=>{let{status}=store2.getState(),addition=Object.entries(update2).reduce((acc,[storyId,value])=>(acc[storyId]=acc[storyId]||{},acc[storyId][id]=value,acc),{});await store2.setState({status:merge_default(status,addition)},{persistence:"session"})}};return{api,state:{storyId:initialStoryId,viewMode:initialViewMode,hasCalledSetOptions:!1,previewInitialized:!1,status:{}},init:async()=>{fullAPI.on(import_core_events2.STORY_SPECIFIED,function({storyId,viewMode}){let{sourceType}=getEventMetadata(this,fullAPI);if(sourceType==="local"){if(fullAPI.isSettingsScreenActive())return;let state=store2.getState();(state.storyId!==storyId||state.viewMode!==viewMode)&&navigate(`/${viewMode}/${storyId}`)}}),fullAPI.on(import_core_events2.CURRENT_STORY_WAS_SET,function(){let{ref}=getEventMetadata(this,fullAPI);fullAPI.setPreviewInitialized(ref)}),fullAPI.on(import_core_events2.STORY_CHANGED,function(){let{sourceType}=getEventMetadata(this,fullAPI);if(sourceType==="local"){let options=fullAPI.getCurrentParameter("options");options&&fullAPI.setOptions(removeRemovedOptions(options))}}),fullAPI.on(import_core_events2.STORY_PREPARED,function({id,...update2}){let{ref,sourceType}=getEventMetadata(this,fullAPI);if(fullAPI.updateStory(id,{...update2,prepared:!0},ref),!ref&&!store2.getState().hasCalledSetOptions){let{options}=update2.parameters;fullAPI.setOptions(removeRemovedOptions(options)),store2.setState({hasCalledSetOptions:!0})}if(sourceType==="local"){let{storyId,index,refId}=store2.getState(),toBePreloaded=Array.from(new Set([api.findSiblingStoryId(storyId,index,1,!0),api.findSiblingStoryId(storyId,index,-1,!0)])).filter(Boolean);fullAPI.emit(import_core_events2.PRELOAD_ENTRIES,{ids:toBePreloaded,options:{target:refId}})}}),fullAPI.on(import_core_events2.DOCS_PREPARED,function({id,...update2}){let{ref}=getEventMetadata(this,fullAPI);fullAPI.updateStory(id,{...update2,prepared:!0},ref)}),fullAPI.on(import_core_events2.SET_INDEX,function(index){let{ref}=getEventMetadata(this,fullAPI);if(ref)fullAPI.setRef(ref.id,{...ref,storyIndex:index},!0);else{fullAPI.setIndex(index);let options=fullAPI.getCurrentParameter("options");fullAPI.setOptions(removeRemovedOptions(options))}}),fullAPI.on(import_core_events2.SET_STORIES,function(data){let{ref}=getEventMetadata(this,fullAPI),setStoriesData=data.v?denormalizeStoryParameters(data):data.stories;if(ref)fullAPI.setRef(ref.id,{...ref,setStoriesData},!0);else throw new Error("Cannot call SET_STORIES for local frame")}),fullAPI.on(import_core_events2.SELECT_STORY,function({kind,title=kind,story,name=story,storyId,...rest}){let{ref}=getEventMetadata(this,fullAPI);ref?fullAPI.selectStory(storyId||title,name,{...rest,ref:ref.id}):fullAPI.selectStory(storyId||title,name,rest)}),fullAPI.on(import_core_events2.STORY_ARGS_UPDATED,function({storyId,args}){let{ref}=getEventMetadata(this,fullAPI);fullAPI.updateStory(storyId,{args},ref)}),fullAPI.on(import_core_events2.CONFIG_ERROR,function(err){let{ref}=getEventMetadata(this,fullAPI);fullAPI.setPreviewInitialized(ref)}),fullAPI.on(import_core_events2.STORY_MISSING,function(err){let{ref}=getEventMetadata(this,fullAPI);fullAPI.setPreviewInitialized(ref)}),FEATURES!=null&&FEATURES.storyStoreV7&&(fullAPI.on(import_core_events2.STORY_INDEX_INVALIDATED,()=>fullAPI.fetchIndex()),await fullAPI.fetchIndex())}}};var layout_exports={};__export(layout_exports,{ActiveTabs:()=>ActiveTabs,focusableUIElements:()=>focusableUIElements,init:()=>init9});var import_global4=require("@storybook/global"),import_pick=__toESM(require("lodash/pick.js")),import_dequal=require("dequal"),import_create=require("@storybook/theming/create"),import_core_events3=require("@storybook/core-events");var{document}=import_global4.global,ActiveTabs={SIDEBAR:"sidebar",CANVAS:"canvas",ADDONS:"addons"},defaultState={ui:{enableShortcuts:!0},layout:{initialActive:ActiveTabs.CANVAS,showToolbar:!0,isFullscreen:!1,showPanel:!0,showNav:!0,panelPosition:"bottom",showTabs:!0},selectedPanel:void 0,theme:(0,import_create.create)()},focusableUIElements={storySearchField:"storybook-explorer-searchfield",storyListMenu:"storybook-explorer-menu",storyPanelRoot:"storybook-panel-root"},init9=({store:store2,provider,singleStory,fullAPI})=>{let api={toggleFullscreen(toggled){return store2.setState(state=>{let{showNav}=state.layout,value=typeof toggled=="boolean"?toggled:!state.layout.isFullscreen,shouldShowNav=showNav===!1&&value===!1;return{layout:{...state.layout,isFullscreen:value,showNav:!singleStory&&shouldShowNav?!0:showNav}}},{persistence:"session"})},togglePanel(toggled){return store2.setState(state=>{let{showNav,isFullscreen}=state.layout,value=typeof toggled<"u"?toggled:!state.layout.showPanel,shouldToggleFullScreen=showNav===!1&&value===!1;return{layout:{...state.layout,showPanel:value,isFullscreen:shouldToggleFullScreen?!0:isFullscreen}}},{persistence:"session"})},togglePanelPosition(position){return typeof position<"u"?store2.setState(state=>({layout:{...state.layout,panelPosition:position}}),{persistence:"permanent"}):store2.setState(state=>({layout:{...state.layout,panelPosition:state.layout.panelPosition==="right"?"bottom":"right"}}),{persistence:"permanent"})},toggleNav(toggled){return store2.setState(state=>{if(singleStory)return{layout:state.layout};let{showPanel,isFullscreen}=state.layout,showNav=typeof toggled<"u"?toggled:!state.layout.showNav,shouldToggleFullScreen=showPanel===!1&&showNav===!1;return{layout:{...state.layout,showNav,isFullscreen:shouldToggleFullScreen?!0:!showNav&&isFullscreen}}},{persistence:"session"})},toggleToolbar(toggled){return store2.setState(state=>{let value=typeof toggled<"u"?toggled:!state.layout.showToolbar;return{layout:{...state.layout,showToolbar:value}}},{persistence:"session"})},resetLayout(){return store2.setState(state=>({layout:{...state.layout,showNav:!1,showPanel:!1,isFullscreen:!1}}),{persistence:"session"})},focusOnUIElement(elementId,select){if(!elementId)return;let element=document.getElementById(elementId);element&&(element.focus(),select&&element.select())},getInitialOptions(){let{theme,selectedPanel,...options}=provider.getConfig();return{...defaultState,layout:{...defaultState.layout,...(0,import_pick.default)(options,Object.keys(defaultState.layout)),...singleStory&&{showNav:!1}},ui:{...defaultState.ui,...(0,import_pick.default)(options,Object.keys(defaultState.ui))},selectedPanel:selectedPanel||defaultState.selectedPanel,theme:theme||defaultState.theme}},setOptions:options=>{let{layout,ui,selectedPanel,theme}=store2.getState();if(options){let updatedLayout={...layout,...options.layout,...(0,import_pick.default)(options,Object.keys(layout)),...singleStory&&{showNav:!1}},updatedUi={...ui,...options.ui,...(0,import_pick.default)(options,Object.keys(ui))},updatedTheme={...theme,...options.theme},modification={};(0,import_dequal.dequal)(ui,updatedUi)||(modification.ui=updatedUi),(0,import_dequal.dequal)(layout,updatedLayout)||(modification.layout=updatedLayout),options.selectedPanel&&!(0,import_dequal.dequal)(selectedPanel,options.selectedPanel)&&(modification.selectedPanel=options.selectedPanel),Object.keys(modification).length&&store2.setState(modification,{persistence:"permanent"}),(0,import_dequal.dequal)(theme,updatedTheme)||store2.setState({theme:updatedTheme})}}},persisted=(0,import_pick.default)(store2.getState(),"layout","selectedPanel");return{api,state:merge_default(api.getInitialOptions(),persisted),init:()=>{api.setOptions(merge_default(api.getInitialOptions(),persisted)),fullAPI.on(import_core_events3.SET_CONFIG,()=>{api.setOptions(merge_default(api.getInitialOptions(),persisted))})}}};var shortcuts_exports={};__export(shortcuts_exports,{controlOrMetaKey:()=>controlOrMetaKey2,defaultShortcuts:()=>defaultShortcuts,init:()=>init10,isMacLike:()=>isMacLike2,keys:()=>keys});var import_global6=require("@storybook/global"),import_core_events4=require("@storybook/core-events");var import_global5=require("@storybook/global"),{navigator}=import_global5.global,isMacLike=()=>navigator&&navigator.platform?!!navigator.platform.match(/(Mac|iPhone|iPod|iPad)/i):!1,controlOrMetaSymbol=()=>isMacLike()?"\u2318":"ctrl",controlOrMetaKey=()=>isMacLike()?"meta":"control",optionOrAltSymbol=()=>isMacLike()?"\u2325":"alt",isShortcutTaken=(arr1,arr2)=>JSON.stringify(arr1)===JSON.stringify(arr2),eventToShortcut=e=>{var _a;if(["Meta","Alt","Control","Shift"].includes(e.key))return null;let keys2=[];if(e.altKey&&keys2.push("alt"),e.ctrlKey&&keys2.push("control"),e.metaKey&&keys2.push("meta"),e.shiftKey&&keys2.push("shift"),e.key&&e.key.length===1&&e.key!==" "){let key=e.key.toUpperCase(),code=(_a=e.code)==null?void 0:_a.toUpperCase().replace("KEY","").replace("DIGIT","");code&&code.length===1&&code!==key?keys2.push([key,code]):keys2.push(key)}return e.key===" "&&keys2.push("space"),e.key==="Escape"&&keys2.push("escape"),e.key==="ArrowRight"&&keys2.push("ArrowRight"),e.key==="ArrowDown"&&keys2.push("ArrowDown"),e.key==="ArrowUp"&&keys2.push("ArrowUp"),e.key==="ArrowLeft"&&keys2.push("ArrowLeft"),keys2.length>0?keys2:null},shortcutMatchesShortcut=(inputShortcut,shortcut)=>!inputShortcut||!shortcut||(inputShortcut.join("").startsWith("shift/")&&inputShortcut.shift(),inputShortcut.length!==shortcut.length)?!1:!inputShortcut.find((input,i)=>Array.isArray(input)?!input.includes(shortcut[i]):input!==shortcut[i]),eventMatchesShortcut=(e,shortcut)=>shortcutMatchesShortcut(eventToShortcut(e),shortcut),keyToSymbol=key=>key==="alt"?optionOrAltSymbol():key==="control"?"\u2303":key==="meta"?"\u2318":key==="shift"?"\u21E7\u200B":key==="Enter"||key==="Backspace"||key==="Esc"||key==="escape"?"":key===" "?"SPACE":key==="ArrowUp"?"\u2191":key==="ArrowDown"?"\u2193":key==="ArrowLeft"?"\u2190":key==="ArrowRight"?"\u2192":key.toUpperCase(),shortcutToHumanString=shortcut=>shortcut.map(keyToSymbol).join(" ");var{navigator:navigator2,document:document2}=import_global6.global,isMacLike2=()=>navigator2&&navigator2.platform?!!navigator2.platform.match(/(Mac|iPhone|iPod|iPad)/i):!1,controlOrMetaKey2=()=>isMacLike2()?"meta":"control";function keys(o){return Object.keys(o)}var defaultShortcuts=Object.freeze({fullScreen:["F"],togglePanel:["A"],panelPosition:["D"],toggleNav:["S"],toolbar:["T"],search:["/"],focusNav:["1"],focusIframe:["2"],focusPanel:["3"],prevComponent:["alt","ArrowUp"],nextComponent:["alt","ArrowDown"],prevStory:["alt","ArrowLeft"],nextStory:["alt","ArrowRight"],shortcutsPage:[controlOrMetaKey2(),"shift",","],aboutPage:[","],escape:["escape"],collapseAll:[controlOrMetaKey2(),"shift","ArrowUp"],expandAll:[controlOrMetaKey2(),"shift","ArrowDown"],remount:["alt","R"]}),addonsShortcuts={};function focusInInput(event){let target=event.target;return/input|textarea/i.test(target.tagName)||target.getAttribute("contenteditable")!==null}var init10=({store:store2,fullAPI})=>{let api={getShortcutKeys(){return store2.getState().shortcuts},getDefaultShortcuts(){return{...defaultShortcuts,...api.getAddonsShortcutDefaults()}},getAddonsShortcuts(){return addonsShortcuts},getAddonsShortcutLabels(){let labels={};return Object.entries(api.getAddonsShortcuts()).forEach(([actionName,{label}])=>{labels[actionName]=label}),labels},getAddonsShortcutDefaults(){let defaults={};return Object.entries(api.getAddonsShortcuts()).forEach(([actionName,{defaultShortcut}])=>{defaults[actionName]=defaultShortcut}),defaults},async setShortcuts(shortcuts){return await store2.setState({shortcuts},{persistence:"permanent"}),shortcuts},async restoreAllDefaultShortcuts(){return api.setShortcuts(api.getDefaultShortcuts())},async setShortcut(action,value){let shortcuts=api.getShortcutKeys();return await api.setShortcuts({...shortcuts,[action]:value}),value},async setAddonShortcut(addon,shortcut){let shortcuts=api.getShortcutKeys();return await api.setShortcuts({...shortcuts,[`${addon}-${shortcut.actionName}`]:shortcut.defaultShortcut}),addonsShortcuts[`${addon}-${shortcut.actionName}`]=shortcut,shortcut},async restoreDefaultShortcut(action){let defaultShortcut=api.getDefaultShortcuts()[action];return api.setShortcut(action,defaultShortcut)},handleKeydownEvent(event){let shortcut=eventToShortcut(event),shortcuts=api.getShortcutKeys(),matchedFeature=keys(shortcuts).find(feature=>shortcutMatchesShortcut(shortcut,shortcuts[feature]));matchedFeature&&(event!=null&&event.preventDefault&&event.preventDefault(),api.handleShortcutFeature(matchedFeature))},handleShortcutFeature(feature){let{layout:{isFullscreen,showNav,showPanel},ui:{enableShortcuts},storyId}=store2.getState();if(enableShortcuts)switch(feature){case"escape":{isFullscreen?fullAPI.toggleFullscreen():showNav||fullAPI.toggleNav();break}case"focusNav":{isFullscreen&&fullAPI.toggleFullscreen(),showNav||fullAPI.toggleNav(),fullAPI.focusOnUIElement(focusableUIElements.storyListMenu);break}case"search":{isFullscreen&&fullAPI.toggleFullscreen(),showNav||fullAPI.toggleNav(),setTimeout(()=>{fullAPI.focusOnUIElement(focusableUIElements.storySearchField,!0)},0);break}case"focusIframe":{let element=document2.getElementById("storybook-preview-iframe");if(element)try{element.contentWindow.focus()}catch{}break}case"focusPanel":{isFullscreen&&fullAPI.toggleFullscreen(),showPanel||fullAPI.togglePanel(),fullAPI.focusOnUIElement(focusableUIElements.storyPanelRoot);break}case"nextStory":{fullAPI.jumpToStory(1);break}case"prevStory":{fullAPI.jumpToStory(-1);break}case"nextComponent":{fullAPI.jumpToComponent(1);break}case"prevComponent":{fullAPI.jumpToComponent(-1);break}case"fullScreen":{fullAPI.toggleFullscreen();break}case"togglePanel":{isFullscreen&&(fullAPI.toggleFullscreen(),fullAPI.resetLayout()),fullAPI.togglePanel();break}case"toggleNav":{isFullscreen&&(fullAPI.toggleFullscreen(),fullAPI.resetLayout()),fullAPI.toggleNav();break}case"toolbar":{fullAPI.toggleToolbar();break}case"panelPosition":{isFullscreen&&fullAPI.toggleFullscreen(),showPanel||fullAPI.togglePanel(),fullAPI.togglePanelPosition();break}case"aboutPage":{fullAPI.navigate("/settings/about");break}case"shortcutsPage":{fullAPI.navigate("/settings/shortcuts");break}case"collapseAll":{fullAPI.collapseAll();break}case"expandAll":{fullAPI.expandAll();break}case"remount":{fullAPI.emit(import_core_events4.FORCE_REMOUNT,{storyId});break}default:addonsShortcuts[feature].action();break}}},{shortcuts:persistedShortcuts=defaultShortcuts}=store2.getState(),state={shortcuts:keys(defaultShortcuts).reduce((acc,key)=>({...acc,[key]:persistedShortcuts[key]||defaultShortcuts[key]}),defaultShortcuts)};return{api,state,init:()=>{document2.addEventListener("keydown",event=>{focusInInput(event)||fullAPI.handleKeydownEvent(event)}),fullAPI.on(import_core_events4.PREVIEW_KEYDOWN,data=>{fullAPI.handleKeydownEvent(data.event)})}}};var url_exports={};__export(url_exports,{init:()=>init11});var import_core_events5=require("@storybook/core-events"),import_router=require("@storybook/router"),import_dequal2=require("dequal"),import_global7=require("@storybook/global"),{window:globalWindow}=import_global7.global,parseBoolean=value=>{if(value==="true"||value==="1")return!0;if(value==="false"||value==="0")return!1},prevParams,initialUrlSupport=({state:{location:location2,path,viewMode,storyId:storyIdFromUrl},singleStory})=>{let{full,panel,nav,shortcuts,addonPanel,tabs,path:queryPath,...otherParams}=(0,import_router.queryFromLocation)(location2),layout={isFullscreen:parseBoolean(full),showNav:!singleStory&&parseBoolean(nav),showPanel:parseBoolean(panel),panelPosition:["right","bottom"].includes(panel)?panel:void 0,showTabs:parseBoolean(tabs)},ui={enableShortcuts:parseBoolean(shortcuts)},selectedPanel=addonPanel||void 0,storyId=storyIdFromUrl,customQueryParams=(0,import_dequal2.dequal)(prevParams,otherParams)?prevParams:otherParams;return prevParams=customQueryParams,{viewMode,layout,ui,selectedPanel,location:location2,path,customQueryParams,storyId}},init11=({store:store2,navigate,state,provider,fullAPI,...rest})=>{let navigateTo=(path,queryParams={},options={})=>{let params=Object.entries(queryParams).filter(([,v])=>v).sort(([a],[b])=>a<b?-1:1).map(([k,v])=>`${k}=${v}`),to=[path,...params].join("&");return navigate(to,options)},api={getQueryParam(key){let{customQueryParams}=store2.getState();return customQueryParams?customQueryParams[key]:void 0},getUrlState(){let{path,customQueryParams,storyId,url,viewMode}=store2.getState();return{path,queryParams:customQueryParams,storyId,url,viewMode}},setQueryParams(input){let{customQueryParams}=store2.getState(),queryParams={},update2={...customQueryParams,...Object.entries(input).reduce((acc,[key,value])=>(value!==null&&(acc[key]=value),acc),queryParams)};(0,import_dequal2.dequal)(customQueryParams,update2)||(store2.setState({customQueryParams:update2}),fullAPI.emit(import_core_events5.UPDATE_QUERY_PARAMS,update2))},navigateUrl(url,options){navigate(url,{...options,plain:!0})}},initModule=()=>{let updateArgsParam=()=>{let{path,queryParams,viewMode}=fullAPI.getUrlState();if(viewMode!=="story")return;let currentStory=fullAPI.getCurrentStoryData();if((currentStory==null?void 0:currentStory.type)!=="story")return;let{args,initialArgs}=currentStory,argsString=(0,import_router.buildArgsParam)(initialArgs,args);navigateTo(path,{...queryParams,args:argsString},{replace:!0}),api.setQueryParams({args:argsString})};fullAPI.on(import_core_events5.SET_CURRENT_STORY,()=>updateArgsParam());let handleOrId;fullAPI.on(import_core_events5.STORY_ARGS_UPDATED,()=>{"requestIdleCallback"in globalWindow?(handleOrId&&globalWindow.cancelIdleCallback(handleOrId),handleOrId=globalWindow.requestIdleCallback(updateArgsParam,{timeout:1e3})):(handleOrId&&clearTimeout(handleOrId),setTimeout(updateArgsParam,100))}),fullAPI.on(import_core_events5.GLOBALS_UPDATED,({globals,initialGlobals})=>{let{path,queryParams}=fullAPI.getUrlState(),globalsString=(0,import_router.buildArgsParam)(initialGlobals,globals);navigateTo(path,{...queryParams,globals:globalsString},{replace:!0}),api.setQueryParams({globals:globalsString})}),fullAPI.on(import_core_events5.NAVIGATE_URL,(url,options)=>{fullAPI.navigateUrl(url,options)}),fullAPI.showReleaseNotesOnLaunch()&&navigate("/settings/release-notes")};return{api,state:initialUrlSupport({store:store2,navigate,state,provider,fullAPI,...rest}),init:initModule}};var versions_exports={};__export(versions_exports,{init:()=>init12});var import_global8=require("@storybook/global"),import_semver=__toESM(require("semver")),import_memoizerific3=__toESM(require("memoizerific"));var version="7.1.0-alpha.40";var{VERSIONCHECK}=import_global8.global,getVersionCheckData=(0,import_memoizerific3.default)(1)(()=>{try{return{...JSON.parse(VERSIONCHECK).data||{}}}catch{return{}}}),init12=({store:store2,mode,fullAPI})=>{let{dismissedVersionNotification}=store2.getState(),state={versions:{current:{version},...getVersionCheckData()},dismissedVersionNotification},api={getCurrentVersion:()=>{let{versions:{current}}=store2.getState();return current},getLatestVersion:()=>{let{versions:{latest,next,current}}=store2.getState();return current&&import_semver.default.prerelease(current.version)&&next?latest&&import_semver.default.gt(latest.version,next.version)?latest:next:latest},versionUpdateAvailable:()=>{let latest=api.getLatestVersion(),current=api.getCurrentVersion();if(latest){if(!latest.version||!current.version)return!0;let actualCurrent=!!import_semver.default.prerelease(current.version)?`${import_semver.default.major(current.version)}.${import_semver.default.minor(current.version)}.${import_semver.default.patch(current.version)}`:current.version,diff=import_semver.default.diff(actualCurrent,latest.version);return import_semver.default.gt(latest.version,actualCurrent)&&diff!=="patch"&&!diff.includes("pre")}return!1}};return{init:async()=>{let{versions={}}=store2.getState(),{latest,next}=getVersionCheckData();if(await store2.setState({versions:{...versions,latest,next}}),api.versionUpdateAvailable()){let latestVersion=api.getLatestVersion().version,diff=import_semver.default.diff(versions.current.version,versions.latest.version);latestVersion!==dismissedVersionNotification&&diff!=="patch"&&!import_semver.default.prerelease(latestVersion)&&mode!=="production"&&fullAPI.addNotification({id:"update",link:"/settings/about",content:{headline:`Storybook ${latestVersion} is available!`,subHeadline:`Your current version is: ${versions.current.version}`},icon:{name:"book"},onClear(){store2.setState({dismissedVersionNotification:latestVersion},{persistence:"permanent"})}})}},state,api}};var globals_exports={};__export(globals_exports,{init:()=>init13});var import_core_events6=require("@storybook/core-events"),import_client_logger4=require("@storybook/client-logger"),import_dequal3=require("dequal");var init13=({store:store2,fullAPI})=>{let api={getGlobals(){return store2.getState().globals},getGlobalTypes(){return store2.getState().globalTypes},updateGlobals(newGlobals){fullAPI.emit(import_core_events6.UPDATE_GLOBALS,{globals:newGlobals,options:{target:"storybook-preview-iframe"}})}},state={globals:{},globalTypes:{}},updateGlobals=globals=>{var _a;let currentGlobals=(_a=store2.getState())==null?void 0:_a.globals;(0,import_dequal3.dequal)(globals,currentGlobals)||store2.setState({globals})};return{api,state,init:()=>{fullAPI.on(import_core_events6.GLOBALS_UPDATED,function({globals}){let{ref}=getEventMetadata(this,fullAPI);ref?import_client_logger4.logger.warn("received a GLOBALS_UPDATED from a non-local ref. This is not currently supported."):updateGlobals(globals)}),fullAPI.on(import_core_events6.SET_GLOBALS,function({globals,globalTypes}){var _a;let{ref}=getEventMetadata(this,fullAPI),currentGlobals=(_a=store2.getState())==null?void 0:_a.globals;ref?Object.keys(globals).length>0&&import_client_logger4.logger.warn("received globals from a non-local ref. This is not currently supported."):store2.setState({globals,globalTypes}),currentGlobals&&Object.keys(currentGlobals).length!==0&&!(0,import_dequal3.dequal)(globals,currentGlobals)&&api.updateGlobals(currentGlobals)})}}};var import_global9=require("@storybook/global"),import_core_events7=require("@storybook/core-events"),import_types2=require("@storybook/types"),import_client_logger5=require("@storybook/client-logger");var import_channels=require("@storybook/channels");function mockChannel(){let transport={setHandler:()=>{},send:()=>{}};return new import_channels.Channel({transport})}var AddonStore=class{constructor(){this.loaders={};this.elements={};this.config={};this.getChannel=()=>(this.channel||this.setChannel(mockChannel()),this.channel);this.getServerChannel=()=>{if(!this.serverChannel)throw new Error("Accessing non-existent serverChannel");return this.serverChannel};this.ready=()=>this.promise;this.hasChannel=()=>!!this.channel;this.hasServerChannel=()=>!!this.serverChannel;this.setChannel=channel=>{this.channel=channel,this.resolve()};this.setServerChannel=channel=>{this.serverChannel=channel};this.getElements=type=>(this.elements[type]||(this.elements[type]={}),this.elements[type]);this.addPanel=(name,options)=>{this.add(name,{type:import_types2.Addon_TypesEnum.PANEL,...options})};this.add=(name,addon)=>{let{type}=addon,collection=this.getElements(type);collection[name]={id:name,...addon}};this.setConfig=value=>{Object.assign(this.config,value),this.hasChannel()?this.getChannel().emit(import_core_events7.SET_CONFIG,this.config):this.ready().then(channel=>{channel.emit(import_core_events7.SET_CONFIG,this.config)})};this.getConfig=()=>this.config;this.register=(name,registerCallback)=>{this.loaders[name]&&import_client_logger5.logger.warn(`${name} was loaded twice, this could have bad side-effects`),this.loaders[name]=registerCallback};this.loadAddons=api=>{Object.values(this.loaders).forEach(value=>value(api))};this.promise=new Promise(res=>{this.resolve=()=>res(this.getChannel())})}},KEY="__STORYBOOK_ADDONS_MANAGER";function getAddonsStore(){return import_global9.global[KEY]||(import_global9.global[KEY]=new AddonStore),import_global9.global[KEY]}var addons=getAddonsStore();var{ActiveTabs:ActiveTabs2}=layout_exports;var ManagerContext=createContext({api:void 0,state:initial_state_default({})}),combineParameters=(...parameterSets)=>(0,import_mergeWith2.default)({},...parameterSets,(objValue,srcValue)=>{if(Array.isArray(srcValue))return srcValue}),ManagerProvider=class extends import_react2.Component{constructor(props){super(props);this.api={};this.initModules=()=>{this.modules.forEach(module2=>{"init"in module2&&module2.init()})};let{location:location2,path,refId,viewMode=props.docsOptions.docsMode?"docs":"story",singleStory,storyId,docsOptions,navigate}=props,store2=new Store({getState:()=>this.state,setState:(stateChange,callback)=>this.setState(stateChange,callback)}),routeData={location:location2,path,viewMode,singleStory,storyId,refId},optionsData={docsOptions};this.state=store2.getInitialState(initial_state_default({...routeData,...optionsData}));let apiData={navigate,store:store2,provider:props.provider};this.modules=[provider_exports,channel_exports,addons_exports,layout_exports,notifications_exports,settings_exports,release_notes_exports,shortcuts_exports,stories_exports,refs_exports,globals_exports,url_exports,versions_exports].map(m=>m.init({...routeData,...optionsData,...apiData,state:this.state,fullAPI:this.api}));let state=initial_state_default(this.state,...this.modules.map(m=>m.state)),api=Object.assign(this.api,{navigate},...this.modules.map(m=>m.api));this.state=state,this.api=api}static getDerivedStateFromProps(props,state){return state.path!==props.path?{...state,location:props.location,path:props.path,refId:props.refId,viewMode:props.viewMode,storyId:props.storyId}:null}shouldComponentUpdate(nextProps,nextState){let prevState=this.state,prevProps=this.props;return prevState!==nextState||prevProps.path!==nextProps.path}render(){let{children}=this.props,value={state:this.state,api:this.api};return import_react2.default.createElement(EffectOnMount,{effect:this.initModules},import_react2.default.createElement(ManagerContext.Provider,{value},import_react2.default.createElement(ManagerConsumer,null,children)))}};ManagerProvider.displayName="Manager";var EffectOnMount=({children,effect})=>(import_react2.default.useEffect(effect,[]),children),defaultFilter=c=>c;function ManagerConsumer({filter=defaultFilter,children}){let c=(0,import_react2.useContext)(ManagerContext),renderer=(0,import_react2.useRef)(children),filterer=(0,import_react2.useRef)(filter);if(typeof renderer.current!="function")return import_react2.default.createElement(import_react2.Fragment,null,renderer.current);let data=filterer.current(c),l=(0,import_react2.useMemo)(()=>[...Object.entries(data).reduce((acc,keyval)=>acc.concat(keyval),[])],[c.state]);return(0,import_react2.useMemo)(()=>{let Child=renderer.current;return import_react2.default.createElement(Child,{...data})},l)}function useStorybookState(){let{state}=(0,import_react2.useContext)(ManagerContext);return{...state,get storiesHash(){return(0,import_client_logger6.deprecate)("state.storiesHash is deprecated, please use state.index"),this.index||{}},get storiesConfigured(){return(0,import_client_logger6.deprecate)("state.storiesConfigured is deprecated, please use state.previewInitialized"),this.previewInitialized},get storiesFailed(){return(0,import_client_logger6.deprecate)("state.storiesFailed is deprecated, please use state.indexError"),this.indexError}}}function useStorybookApi(){let{api}=(0,import_react2.useContext)(ManagerContext);return api}function orDefault(fromStore,defaultState2){return typeof fromStore>"u"?defaultState2:fromStore}var useChannel=(eventMap,deps=[])=>{let api=useStorybookApi();return(0,import_react2.useEffect)(()=>(Object.entries(eventMap).forEach(([type,listener])=>api.on(type,listener)),()=>{Object.entries(eventMap).forEach(([type,listener])=>api.off(type,listener))}),deps),api.emit};function useStoryPrepared(storyId){return useStorybookApi().isPrepared(storyId)}function useParameter(parameterKey,defaultValue){let result=useStorybookApi().getCurrentParameter(parameterKey);return orDefault(result,defaultValue)}var addonStateCache={};function useSharedState(stateId,defaultState2){let api=useStorybookApi(),existingState=api.getAddonState(stateId),state=orDefault(existingState,addonStateCache[stateId]?addonStateCache[stateId]:defaultState2),setState=(s,options)=>{addonStateCache[stateId]&&(addonStateCache[stateId]=s),api.setAddonState(stateId,s,options)},allListeners=(0,import_react2.useMemo)(()=>{let stateChangeHandlers={[`${import_core_events8.SHARED_STATE_CHANGED}-client-${stateId}`]:s=>setState(s),[`${import_core_events8.SHARED_STATE_SET}-client-${stateId}`]:s=>setState(s)},stateInitializationHandlers={[import_core_events8.SET_STORIES]:()=>{let currentState=api.getAddonState(stateId);currentState?(addonStateCache[stateId]=currentState,api.emit(`${import_core_events8.SHARED_STATE_SET}-manager-${stateId}`,currentState)):addonStateCache[stateId]?(setState(addonStateCache[stateId]),api.emit(`${import_core_events8.SHARED_STATE_SET}-manager-${stateId}`,addonStateCache[stateId])):defaultState2!==void 0&&(setState(defaultState2),addonStateCache[stateId]=defaultState2,api.emit(`${import_core_events8.SHARED_STATE_SET}-manager-${stateId}`,defaultState2))},[import_core_events8.STORY_CHANGED]:()=>{let currentState=api.getAddonState(stateId);currentState!==void 0&&api.emit(`${import_core_events8.SHARED_STATE_SET}-manager-${stateId}`,currentState)}};return{...stateChangeHandlers,...stateInitializationHandlers}},[stateId]),emit=useChannel(allListeners);return[state,(newStateOrMerger,options)=>{setState(newStateOrMerger,options),emit(`${import_core_events8.SHARED_STATE_CHANGED}-manager-${stateId}`,newStateOrMerger)}]}function useAddonState(addonId,defaultState2){return useSharedState(addonId,defaultState2)}function useArgs(){let{getCurrentStoryData,updateStoryArgs,resetStoryArgs}=useStorybookApi(),data=getCurrentStoryData(),args=(data==null?void 0:data.type)==="story"?data.args:{},updateArgs=(0,import_react2.useCallback)(newArgs=>updateStoryArgs(data,newArgs),[data,updateStoryArgs]),resetArgs=(0,import_react2.useCallback)(argNames=>resetStoryArgs(data,argNames),[data,resetStoryArgs]);return[args,updateArgs,resetArgs]}function useGlobals(){let api=useStorybookApi();return[api.getGlobals(),api.updateGlobals]}function useGlobalTypes(){return useStorybookApi().getGlobalTypes()}function useCurrentStory(){let{getCurrentStoryData}=useStorybookApi();return getCurrentStoryData()}function useArgTypes(){let current=useCurrentStory();return(current==null?void 0:current.type)==="story"&&current.argTypes||{}}0&&(module.exports={ActiveTabs,Consumer,ManagerContext,Provider,addons,combineParameters,controlOrMetaKey,controlOrMetaSymbol,eventMatchesShortcut,eventToShortcut,isMacLike,isShortcutTaken,keyToSymbol,merge,mockChannel,optionOrAltSymbol,shortcutMatchesShortcut,shortcutToHumanString,types,useAddonState,useArgTypes,useArgs,useChannel,useGlobalTypes,useGlobals,useParameter,useSharedState,useStoryPrepared,useStorybookApi,useStorybookState});
`});let versions=ref.versions&&Object.keys(ref.versions).length?ref.versions:loadedData.versions;await api.setRef(id,{id,url:urlParseResult.url,...loadedData,...versions?{versions}:{},type:loadedData.storyIndex?"lazy":"auto-inject"})},getRefs:()=>{let{refs:refs2={}}=store2.getState();return refs2},setRef:(id,{storyIndex,setStoriesData,...rest},ready=!1)=>{if(singleStory)return;let{storyMapper=defaultStoryMapper}=provider.getConfig(),ref=api.getRefs()[id],index;setStoriesData?index=transformSetStoriesStoryDataToStoriesHash(map(setStoriesData,ref,{storyMapper}),{provider,docsOptions}):storyIndex&&(index=transformStoryIndexToStoriesHash(storyIndex,{provider,docsOptions})),index&&(index=addRefIds(index,ref)),api.updateRef(id,{index,...rest})},updateRef:(id,data)=>{let{[id]:ref,...updated}=api.getRefs();updated[id]={...ref,...data};let ordered=Object.keys(initialState).reduce((obj,key)=>(obj[key]=updated[key],obj),{});store2.setState({refs:ordered})}},refs=!singleStory&&import_global2.global.REFS||{},initialState=refs;return runCheck&&Object.entries(refs).forEach(([id,ref])=>{api.checkRef({...ref,stories:{}})}),{api,state:{refs:initialState}}};var getEventMetadata=(context,fullAPI)=>{let{source,refId,type}=context,[sourceType,sourceLocation]=getSourceType(source,refId),ref=refId&&fullAPI.getRefs()[refId]?fullAPI.getRefs()[refId]:fullAPI.findRef(sourceLocation),meta={source,sourceType,sourceLocation,refId,ref,type};switch(!0){case typeof refId=="string":case sourceType==="local":case sourceType==="external":return meta;default:return import_client_logger2.logger.warn(`Received a ${type} frame that was not configured as a ref`),null}};var{FEATURES,fetch:fetch2}=import_global3.global,STORY_INDEX_PATH="./index.json",removedOptions=["enableShortcuts","theme","showRoots"];function removeRemovedOptions(options){if(!options||typeof options=="string")return options;let result={...options};return removedOptions.forEach(option=>{option in result&&delete result[option]}),result}var init8=({fullAPI,store:store2,navigate,provider,storyId:initialStoryId,viewMode:initialViewMode,docsOptions={}})=>{let api={storyId:import_csf2.toId,getData:(storyId,refId)=>{let result=api.resolveStory(storyId,refId);if((result==null?void 0:result.type)==="story"||(result==null?void 0:result.type)==="docs")return result},isPrepared:(storyId,refId)=>{let data=api.getData(storyId,refId);return data.type==="story"?data.prepared:!0},resolveStory:(storyId,refId)=>{let{refs,index}=store2.getState();return refId&&!refs[refId]?null:refId?refs[refId].index?refs[refId].index[storyId]:void 0:index?index[storyId]:void 0},getCurrentStoryData:()=>{let{storyId,refId}=store2.getState();return api.getData(storyId,refId)},getParameters:(storyIdOrCombo,parameterName)=>{let{storyId,refId}=typeof storyIdOrCombo=="string"?{storyId:storyIdOrCombo,refId:void 0}:storyIdOrCombo,data=api.getData(storyId,refId);if(["story","docs"].includes(data==null?void 0:data.type)){let{parameters}=data;if(parameters)return parameterName?parameters[parameterName]:parameters}return null},getCurrentParameter:parameterName=>{let{storyId,refId}=store2.getState();return api.getParameters({storyId,refId},parameterName)||void 0},jumpToComponent:direction=>{let{index,storyId,refs,refId}=store2.getState();if(!api.getData(storyId,refId))return;let hash=refId?refs[refId].index||{}:index,result=api.findSiblingStoryId(storyId,hash,direction,!0);result&&api.selectStory(result,void 0,{ref:refId})},jumpToStory:direction=>{let{index,storyId,refs,refId}=store2.getState(),story=api.getData(storyId,refId);if(!story)return;let hash=story.refId?refs[story.refId].index:index,result=api.findSiblingStoryId(storyId,hash,direction,!1);result&&api.selectStory(result,void 0,{ref:refId})},selectFirstStory:()=>{let{index}=store2.getState(),firstStory=Object.keys(index).find(id=>index[id].type==="story");if(firstStory){api.selectStory(firstStory);return}navigate("/")},selectStory:(titleOrId=void 0,name=void 0,options={})=>{let{ref}=options,{storyId,index,refs}=store2.getState(),hash=ref?refs[ref].index:index,kindSlug=storyId==null?void 0:storyId.split("--",2)[0];if(name)if(titleOrId){let id=ref?`${ref}_${(0,import_csf2.toId)(titleOrId,name)}`:(0,import_csf2.toId)(titleOrId,name);if(hash[id])api.selectStory(id,void 0,options);else{let entry=hash[(0,import_csf2.sanitize)(titleOrId)];if((entry==null?void 0:entry.type)==="component"){let foundId=entry.children.find(childId=>hash[childId].name===name);foundId&&api.selectStory(foundId,void 0,options)}}}else{let id=(0,import_csf2.toId)(kindSlug,name);api.selectStory(id,void 0,options)}else{let entry=titleOrId?hash[titleOrId]||hash[(0,import_csf2.sanitize)(titleOrId)]:hash[kindSlug];if(!entry)throw new Error(`Unknown id or title: '${titleOrId}'`);let leafEntry=api.findLeafEntry(hash,entry.id),fullId=leafEntry.refId?`${leafEntry.refId}_${leafEntry.id}`:leafEntry.id;navigate(`/${leafEntry.type}/${fullId}`)}},findLeafEntry(index,storyId){let entry=index[storyId];if(entry.type==="docs"||entry.type==="story")return entry;let childStoryId=entry.children[0];return api.findLeafEntry(index,childStoryId)},findLeafStoryId(index,storyId){var _a;return(_a=api.findLeafEntry(index,storyId))==null?void 0:_a.id},findSiblingStoryId(storyId,index,direction,toSiblingGroup){if(toSiblingGroup){let lookupList2=getComponentLookupList(index),position2=lookupList2.findIndex(i=>i.includes(storyId));return position2===lookupList2.length-1&&direction>0||position2===0&&direction<0?void 0:lookupList2[position2+direction]?lookupList2[position2+direction][0]:void 0}let lookupList=getStoriesLookupList(index),position=lookupList.indexOf(storyId);if(!(position===lookupList.length-1&&direction>0)&&!(position===0&&direction<0))return lookupList[position+direction]},updateStoryArgs:(story,updatedArgs)=>{let{id:storyId,refId}=story;fullAPI.emit(import_core_events2.UPDATE_STORY_ARGS,{storyId,updatedArgs,options:{target:refId}})},resetStoryArgs:(story,argNames)=>{let{id:storyId,refId}=story;fullAPI.emit(import_core_events2.RESET_STORY_ARGS,{storyId,argNames,options:{target:refId}})},fetchIndex:async()=>{try{let result=await fetch2(STORY_INDEX_PATH);if(result.status!==200)throw new Error(await result.text());let storyIndex=await result.json();if(storyIndex.v<3){import_client_logger3.logger.warn(`Skipping story index with version v${storyIndex.v}, awaiting SET_STORIES.`);return}await fullAPI.setIndex(storyIndex)}catch(err){await store2.setState({indexError:err})}},setIndex:async storyIndex=>{let newHash=transformStoryIndexToStoriesHash(storyIndex,{provider,docsOptions}),oldHash=store2.getState().index;await store2.setState({index:addPreparedStories(newHash,oldHash),indexError:void 0})},updateStory:async(storyId,update2,ref)=>{if(ref){let{id:refId,index}=ref;index[storyId]={...index[storyId],...update2},await fullAPI.updateRef(refId,{index})}else{let{index}=store2.getState();index[storyId]={...index[storyId],...update2},await store2.setState({index})}},updateDocs:async(docsId,update2,ref)=>{if(ref){let{id:refId,index}=ref;index[docsId]={...index[docsId],...update2},await fullAPI.updateRef(refId,{index})}else{let{index}=store2.getState();index[docsId]={...index[docsId],...update2},await store2.setState({index})}},setPreviewInitialized:async ref=>{ref?fullAPI.updateRef(ref.id,{previewInitialized:!0}):store2.setState({previewInitialized:!0})},experimental_updateStatus:async(id,update2)=>{let{status}=store2.getState(),addition=Object.entries(update2).reduce((acc,[storyId,value])=>(acc[storyId]=acc[storyId]||{},acc[storyId][id]=value,acc),{});await store2.setState({status:merge_default(status,addition)},{persistence:"session"})}};return{api,state:{storyId:initialStoryId,viewMode:initialViewMode,hasCalledSetOptions:!1,previewInitialized:!1,status:{}},init:async()=>{fullAPI.on(import_core_events2.STORY_SPECIFIED,function({storyId,viewMode}){let{sourceType}=getEventMetadata(this,fullAPI);if(sourceType==="local"){if(fullAPI.isSettingsScreenActive())return;let state=store2.getState();(state.storyId!==storyId||state.viewMode!==viewMode)&&navigate(`/${viewMode}/${storyId}`)}}),fullAPI.on(import_core_events2.CURRENT_STORY_WAS_SET,function(){let{ref}=getEventMetadata(this,fullAPI);fullAPI.setPreviewInitialized(ref)}),fullAPI.on(import_core_events2.STORY_CHANGED,function(){let{sourceType}=getEventMetadata(this,fullAPI);if(sourceType==="local"){let options=fullAPI.getCurrentParameter("options");options&&fullAPI.setOptions(removeRemovedOptions(options))}}),fullAPI.on(import_core_events2.STORY_PREPARED,function({id,...update2}){let{ref,sourceType}=getEventMetadata(this,fullAPI);if(fullAPI.updateStory(id,{...update2,prepared:!0},ref),!ref&&!store2.getState().hasCalledSetOptions){let{options}=update2.parameters;fullAPI.setOptions(removeRemovedOptions(options)),store2.setState({hasCalledSetOptions:!0})}if(sourceType==="local"){let{storyId,index,refId}=store2.getState(),toBePreloaded=Array.from(new Set([api.findSiblingStoryId(storyId,index,1,!0),api.findSiblingStoryId(storyId,index,-1,!0)])).filter(Boolean);fullAPI.emit(import_core_events2.PRELOAD_ENTRIES,{ids:toBePreloaded,options:{target:refId}})}}),fullAPI.on(import_core_events2.DOCS_PREPARED,function({id,...update2}){let{ref}=getEventMetadata(this,fullAPI);fullAPI.updateStory(id,{...update2,prepared:!0},ref)}),fullAPI.on(import_core_events2.SET_INDEX,function(index){let{ref}=getEventMetadata(this,fullAPI);if(ref)fullAPI.setRef(ref.id,{...ref,storyIndex:index},!0);else{fullAPI.setIndex(index);let options=fullAPI.getCurrentParameter("options");fullAPI.setOptions(removeRemovedOptions(options))}}),fullAPI.on(import_core_events2.SET_STORIES,function(data){let{ref}=getEventMetadata(this,fullAPI),setStoriesData=data.v?denormalizeStoryParameters(data):data.stories;if(ref)fullAPI.setRef(ref.id,{...ref,setStoriesData},!0);else throw new Error("Cannot call SET_STORIES for local frame")}),fullAPI.on(import_core_events2.SELECT_STORY,function({kind,title=kind,story,name=story,storyId,...rest}){let{ref}=getEventMetadata(this,fullAPI);ref?fullAPI.selectStory(storyId||title,name,{...rest,ref:ref.id}):fullAPI.selectStory(storyId||title,name,rest)}),fullAPI.on(import_core_events2.STORY_ARGS_UPDATED,function({storyId,args}){let{ref}=getEventMetadata(this,fullAPI);fullAPI.updateStory(storyId,{args},ref)}),fullAPI.on(import_core_events2.CONFIG_ERROR,function(err){let{ref}=getEventMetadata(this,fullAPI);fullAPI.setPreviewInitialized(ref)}),fullAPI.on(import_core_events2.STORY_MISSING,function(err){let{ref}=getEventMetadata(this,fullAPI);fullAPI.setPreviewInitialized(ref)}),FEATURES!=null&&FEATURES.storyStoreV7&&(fullAPI.on(import_core_events2.STORY_INDEX_INVALIDATED,()=>fullAPI.fetchIndex()),await fullAPI.fetchIndex())}}};var layout_exports={};__export(layout_exports,{ActiveTabs:()=>ActiveTabs,focusableUIElements:()=>focusableUIElements,init:()=>init9});var import_global4=require("@storybook/global"),import_pick=__toESM(require("lodash/pick.js")),import_dequal=require("dequal"),import_create=require("@storybook/theming/create"),import_core_events3=require("@storybook/core-events");var{document}=import_global4.global,ActiveTabs={SIDEBAR:"sidebar",CANVAS:"canvas",ADDONS:"addons"},defaultState={ui:{enableShortcuts:!0},layout:{initialActive:ActiveTabs.CANVAS,showToolbar:!0,isFullscreen:!1,showPanel:!0,showNav:!0,panelPosition:"bottom",showTabs:!0},selectedPanel:void 0,theme:(0,import_create.create)()},focusableUIElements={storySearchField:"storybook-explorer-searchfield",storyListMenu:"storybook-explorer-menu",storyPanelRoot:"storybook-panel-root"},init9=({store:store2,provider,singleStory,fullAPI})=>{let api={toggleFullscreen(toggled){return store2.setState(state=>{let{showNav}=state.layout,value=typeof toggled=="boolean"?toggled:!state.layout.isFullscreen,shouldShowNav=showNav===!1&&value===!1;return{layout:{...state.layout,isFullscreen:value,showNav:!singleStory&&shouldShowNav?!0:showNav}}},{persistence:"session"})},togglePanel(toggled){return store2.setState(state=>{let{showNav,isFullscreen}=state.layout,value=typeof toggled<"u"?toggled:!state.layout.showPanel,shouldToggleFullScreen=showNav===!1&&value===!1;return{layout:{...state.layout,showPanel:value,isFullscreen:shouldToggleFullScreen?!0:isFullscreen}}},{persistence:"session"})},togglePanelPosition(position){return typeof position<"u"?store2.setState(state=>({layout:{...state.layout,panelPosition:position}}),{persistence:"permanent"}):store2.setState(state=>({layout:{...state.layout,panelPosition:state.layout.panelPosition==="right"?"bottom":"right"}}),{persistence:"permanent"})},toggleNav(toggled){return store2.setState(state=>{if(singleStory)return{layout:state.layout};let{showPanel,isFullscreen}=state.layout,showNav=typeof toggled<"u"?toggled:!state.layout.showNav,shouldToggleFullScreen=showPanel===!1&&showNav===!1;return{layout:{...state.layout,showNav,isFullscreen:shouldToggleFullScreen?!0:!showNav&&isFullscreen}}},{persistence:"session"})},toggleToolbar(toggled){return store2.setState(state=>{let value=typeof toggled<"u"?toggled:!state.layout.showToolbar;return{layout:{...state.layout,showToolbar:value}}},{persistence:"session"})},resetLayout(){return store2.setState(state=>({layout:{...state.layout,showNav:!1,showPanel:!1,isFullscreen:!1}}),{persistence:"session"})},focusOnUIElement(elementId,select){if(!elementId)return;let element=document.getElementById(elementId);element&&(element.focus(),select&&element.select())},getInitialOptions(){let{theme,selectedPanel,...options}=provider.getConfig();return{...defaultState,layout:{...defaultState.layout,...(0,import_pick.default)(options,Object.keys(defaultState.layout)),...singleStory&&{showNav:!1}},ui:{...defaultState.ui,...(0,import_pick.default)(options,Object.keys(defaultState.ui))},selectedPanel:selectedPanel||defaultState.selectedPanel,theme:theme||defaultState.theme}},setOptions:options=>{let{layout,ui,selectedPanel,theme}=store2.getState();if(options){let updatedLayout={...layout,...options.layout,...(0,import_pick.default)(options,Object.keys(layout)),...singleStory&&{showNav:!1}},updatedUi={...ui,...options.ui,...(0,import_pick.default)(options,Object.keys(ui))},updatedTheme={...theme,...options.theme},modification={};(0,import_dequal.dequal)(ui,updatedUi)||(modification.ui=updatedUi),(0,import_dequal.dequal)(layout,updatedLayout)||(modification.layout=updatedLayout),options.selectedPanel&&!(0,import_dequal.dequal)(selectedPanel,options.selectedPanel)&&(modification.selectedPanel=options.selectedPanel),Object.keys(modification).length&&store2.setState(modification,{persistence:"permanent"}),(0,import_dequal.dequal)(theme,updatedTheme)||store2.setState({theme:updatedTheme})}}},persisted=(0,import_pick.default)(store2.getState(),"layout","selectedPanel");return{api,state:merge_default(api.getInitialOptions(),persisted),init:()=>{api.setOptions(merge_default(api.getInitialOptions(),persisted)),fullAPI.on(import_core_events3.SET_CONFIG,()=>{api.setOptions(merge_default(api.getInitialOptions(),persisted))})}}};var shortcuts_exports={};__export(shortcuts_exports,{controlOrMetaKey:()=>controlOrMetaKey2,defaultShortcuts:()=>defaultShortcuts,init:()=>init10,isMacLike:()=>isMacLike2,keys:()=>keys});var import_global6=require("@storybook/global"),import_core_events4=require("@storybook/core-events");var import_global5=require("@storybook/global"),{navigator}=import_global5.global,isMacLike=()=>navigator&&navigator.platform?!!navigator.platform.match(/(Mac|iPhone|iPod|iPad)/i):!1,controlOrMetaSymbol=()=>isMacLike()?"\u2318":"ctrl",controlOrMetaKey=()=>isMacLike()?"meta":"control",optionOrAltSymbol=()=>isMacLike()?"\u2325":"alt",isShortcutTaken=(arr1,arr2)=>JSON.stringify(arr1)===JSON.stringify(arr2),eventToShortcut=e=>{var _a;if(["Meta","Alt","Control","Shift"].includes(e.key))return null;let keys2=[];if(e.altKey&&keys2.push("alt"),e.ctrlKey&&keys2.push("control"),e.metaKey&&keys2.push("meta"),e.shiftKey&&keys2.push("shift"),e.key&&e.key.length===1&&e.key!==" "){let key=e.key.toUpperCase(),code=(_a=e.code)==null?void 0:_a.toUpperCase().replace("KEY","").replace("DIGIT","");code&&code.length===1&&code!==key?keys2.push([key,code]):keys2.push(key)}return e.key===" "&&keys2.push("space"),e.key==="Escape"&&keys2.push("escape"),e.key==="ArrowRight"&&keys2.push("ArrowRight"),e.key==="ArrowDown"&&keys2.push("ArrowDown"),e.key==="ArrowUp"&&keys2.push("ArrowUp"),e.key==="ArrowLeft"&&keys2.push("ArrowLeft"),keys2.length>0?keys2:null},shortcutMatchesShortcut=(inputShortcut,shortcut)=>!inputShortcut||!shortcut||(inputShortcut.join("").startsWith("shift/")&&inputShortcut.shift(),inputShortcut.length!==shortcut.length)?!1:!inputShortcut.find((input,i)=>Array.isArray(input)?!input.includes(shortcut[i]):input!==shortcut[i]),eventMatchesShortcut=(e,shortcut)=>shortcutMatchesShortcut(eventToShortcut(e),shortcut),keyToSymbol=key=>key==="alt"?optionOrAltSymbol():key==="control"?"\u2303":key==="meta"?"\u2318":key==="shift"?"\u21E7\u200B":key==="Enter"||key==="Backspace"||key==="Esc"||key==="escape"?"":key===" "?"SPACE":key==="ArrowUp"?"\u2191":key==="ArrowDown"?"\u2193":key==="ArrowLeft"?"\u2190":key==="ArrowRight"?"\u2192":key.toUpperCase(),shortcutToHumanString=shortcut=>shortcut.map(keyToSymbol).join(" ");var{navigator:navigator2,document:document2}=import_global6.global,isMacLike2=()=>navigator2&&navigator2.platform?!!navigator2.platform.match(/(Mac|iPhone|iPod|iPad)/i):!1,controlOrMetaKey2=()=>isMacLike2()?"meta":"control";function keys(o){return Object.keys(o)}var defaultShortcuts=Object.freeze({fullScreen:["F"],togglePanel:["A"],panelPosition:["D"],toggleNav:["S"],toolbar:["T"],search:["/"],focusNav:["1"],focusIframe:["2"],focusPanel:["3"],prevComponent:["alt","ArrowUp"],nextComponent:["alt","ArrowDown"],prevStory:["alt","ArrowLeft"],nextStory:["alt","ArrowRight"],shortcutsPage:[controlOrMetaKey2(),"shift",","],aboutPage:[","],escape:["escape"],collapseAll:[controlOrMetaKey2(),"shift","ArrowUp"],expandAll:[controlOrMetaKey2(),"shift","ArrowDown"],remount:["alt","R"]}),addonsShortcuts={};function focusInInput(event){let target=event.target;return/input|textarea/i.test(target.tagName)||target.getAttribute("contenteditable")!==null}var init10=({store:store2,fullAPI})=>{let api={getShortcutKeys(){return store2.getState().shortcuts},getDefaultShortcuts(){return{...defaultShortcuts,...api.getAddonsShortcutDefaults()}},getAddonsShortcuts(){return addonsShortcuts},getAddonsShortcutLabels(){let labels={};return Object.entries(api.getAddonsShortcuts()).forEach(([actionName,{label}])=>{labels[actionName]=label}),labels},getAddonsShortcutDefaults(){let defaults={};return Object.entries(api.getAddonsShortcuts()).forEach(([actionName,{defaultShortcut}])=>{defaults[actionName]=defaultShortcut}),defaults},async setShortcuts(shortcuts){return await store2.setState({shortcuts},{persistence:"permanent"}),shortcuts},async restoreAllDefaultShortcuts(){return api.setShortcuts(api.getDefaultShortcuts())},async setShortcut(action,value){let shortcuts=api.getShortcutKeys();return await api.setShortcuts({...shortcuts,[action]:value}),value},async setAddonShortcut(addon,shortcut){let shortcuts=api.getShortcutKeys();return await api.setShortcuts({...shortcuts,[`${addon}-${shortcut.actionName}`]:shortcut.defaultShortcut}),addonsShortcuts[`${addon}-${shortcut.actionName}`]=shortcut,shortcut},async restoreDefaultShortcut(action){let defaultShortcut=api.getDefaultShortcuts()[action];return api.setShortcut(action,defaultShortcut)},handleKeydownEvent(event){let shortcut=eventToShortcut(event),shortcuts=api.getShortcutKeys(),matchedFeature=keys(shortcuts).find(feature=>shortcutMatchesShortcut(shortcut,shortcuts[feature]));matchedFeature&&(event!=null&&event.preventDefault&&event.preventDefault(),api.handleShortcutFeature(matchedFeature))},handleShortcutFeature(feature){let{layout:{isFullscreen,showNav,showPanel},ui:{enableShortcuts},storyId}=store2.getState();if(enableShortcuts)switch(feature){case"escape":{isFullscreen?fullAPI.toggleFullscreen():showNav||fullAPI.toggleNav();break}case"focusNav":{isFullscreen&&fullAPI.toggleFullscreen(),showNav||fullAPI.toggleNav(),fullAPI.focusOnUIElement(focusableUIElements.storyListMenu);break}case"search":{isFullscreen&&fullAPI.toggleFullscreen(),showNav||fullAPI.toggleNav(),setTimeout(()=>{fullAPI.focusOnUIElement(focusableUIElements.storySearchField,!0)},0);break}case"focusIframe":{let element=document2.getElementById("storybook-preview-iframe");if(element)try{element.contentWindow.focus()}catch{}break}case"focusPanel":{isFullscreen&&fullAPI.toggleFullscreen(),showPanel||fullAPI.togglePanel(),fullAPI.focusOnUIElement(focusableUIElements.storyPanelRoot);break}case"nextStory":{fullAPI.jumpToStory(1);break}case"prevStory":{fullAPI.jumpToStory(-1);break}case"nextComponent":{fullAPI.jumpToComponent(1);break}case"prevComponent":{fullAPI.jumpToComponent(-1);break}case"fullScreen":{fullAPI.toggleFullscreen();break}case"togglePanel":{isFullscreen&&(fullAPI.toggleFullscreen(),fullAPI.resetLayout()),fullAPI.togglePanel();break}case"toggleNav":{isFullscreen&&(fullAPI.toggleFullscreen(),fullAPI.resetLayout()),fullAPI.toggleNav();break}case"toolbar":{fullAPI.toggleToolbar();break}case"panelPosition":{isFullscreen&&fullAPI.toggleFullscreen(),showPanel||fullAPI.togglePanel(),fullAPI.togglePanelPosition();break}case"aboutPage":{fullAPI.navigate("/settings/about");break}case"shortcutsPage":{fullAPI.navigate("/settings/shortcuts");break}case"collapseAll":{fullAPI.collapseAll();break}case"expandAll":{fullAPI.expandAll();break}case"remount":{fullAPI.emit(import_core_events4.FORCE_REMOUNT,{storyId});break}default:addonsShortcuts[feature].action();break}}},{shortcuts:persistedShortcuts=defaultShortcuts}=store2.getState(),state={shortcuts:keys(defaultShortcuts).reduce((acc,key)=>({...acc,[key]:persistedShortcuts[key]||defaultShortcuts[key]}),defaultShortcuts)};return{api,state,init:()=>{document2.addEventListener("keydown",event=>{focusInInput(event)||fullAPI.handleKeydownEvent(event)}),fullAPI.on(import_core_events4.PREVIEW_KEYDOWN,data=>{fullAPI.handleKeydownEvent(data.event)})}}};var url_exports={};__export(url_exports,{init:()=>init11});var import_core_events5=require("@storybook/core-events"),import_router=require("@storybook/router"),import_dequal2=require("dequal"),import_global7=require("@storybook/global"),{window:globalWindow}=import_global7.global,parseBoolean=value=>{if(value==="true"||value==="1")return!0;if(value==="false"||value==="0")return!1},prevParams,initialUrlSupport=({state:{location:location2,path,viewMode,storyId:storyIdFromUrl},singleStory})=>{let{full,panel,nav,shortcuts,addonPanel,tabs,path:queryPath,...otherParams}=(0,import_router.queryFromLocation)(location2),layout={isFullscreen:parseBoolean(full),showNav:!singleStory&&parseBoolean(nav),showPanel:parseBoolean(panel),panelPosition:["right","bottom"].includes(panel)?panel:void 0,showTabs:parseBoolean(tabs)},ui={enableShortcuts:parseBoolean(shortcuts)},selectedPanel=addonPanel||void 0,storyId=storyIdFromUrl,customQueryParams=(0,import_dequal2.dequal)(prevParams,otherParams)?prevParams:otherParams;return prevParams=customQueryParams,{viewMode,layout,ui,selectedPanel,location:location2,path,customQueryParams,storyId}},init11=({store:store2,navigate,state,provider,fullAPI,...rest})=>{let navigateTo=(path,queryParams={},options={})=>{let params=Object.entries(queryParams).filter(([,v])=>v).sort(([a],[b])=>a<b?-1:1).map(([k,v])=>`${k}=${v}`),to=[path,...params].join("&");return navigate(to,options)},api={getQueryParam(key){let{customQueryParams}=store2.getState();return customQueryParams?customQueryParams[key]:void 0},getUrlState(){let{path,customQueryParams,storyId,url,viewMode}=store2.getState();return{path,queryParams:customQueryParams,storyId,url,viewMode}},setQueryParams(input){let{customQueryParams}=store2.getState(),queryParams={},update2={...customQueryParams,...Object.entries(input).reduce((acc,[key,value])=>(value!==null&&(acc[key]=value),acc),queryParams)};(0,import_dequal2.dequal)(customQueryParams,update2)||(store2.setState({customQueryParams:update2}),fullAPI.emit(import_core_events5.UPDATE_QUERY_PARAMS,update2))},navigateUrl(url,options){navigate(url,{...options,plain:!0})}},initModule=()=>{let updateArgsParam=()=>{let{path,queryParams,viewMode}=fullAPI.getUrlState();if(viewMode!=="story")return;let currentStory=fullAPI.getCurrentStoryData();if((currentStory==null?void 0:currentStory.type)!=="story")return;let{args,initialArgs}=currentStory,argsString=(0,import_router.buildArgsParam)(initialArgs,args);navigateTo(path,{...queryParams,args:argsString},{replace:!0}),api.setQueryParams({args:argsString})};fullAPI.on(import_core_events5.SET_CURRENT_STORY,()=>updateArgsParam());let handleOrId;fullAPI.on(import_core_events5.STORY_ARGS_UPDATED,()=>{"requestIdleCallback"in globalWindow?(handleOrId&&globalWindow.cancelIdleCallback(handleOrId),handleOrId=globalWindow.requestIdleCallback(updateArgsParam,{timeout:1e3})):(handleOrId&&clearTimeout(handleOrId),setTimeout(updateArgsParam,100))}),fullAPI.on(import_core_events5.GLOBALS_UPDATED,({globals,initialGlobals})=>{let{path,queryParams}=fullAPI.getUrlState(),globalsString=(0,import_router.buildArgsParam)(initialGlobals,globals);navigateTo(path,{...queryParams,globals:globalsString},{replace:!0}),api.setQueryParams({globals:globalsString})}),fullAPI.on(import_core_events5.NAVIGATE_URL,(url,options)=>{fullAPI.navigateUrl(url,options)}),fullAPI.showReleaseNotesOnLaunch()&&navigate("/settings/release-notes")};return{api,state:initialUrlSupport({store:store2,navigate,state,provider,fullAPI,...rest}),init:initModule}};var versions_exports={};__export(versions_exports,{init:()=>init12});var import_global8=require("@storybook/global"),import_semver=__toESM(require("semver")),import_memoizerific3=__toESM(require("memoizerific"));var version="7.1.0-alpha.41";var{VERSIONCHECK}=import_global8.global,getVersionCheckData=(0,import_memoizerific3.default)(1)(()=>{try{return{...JSON.parse(VERSIONCHECK).data||{}}}catch{return{}}}),init12=({store:store2,mode,fullAPI})=>{let{dismissedVersionNotification}=store2.getState(),state={versions:{current:{version},...getVersionCheckData()},dismissedVersionNotification},api={getCurrentVersion:()=>{let{versions:{current}}=store2.getState();return current},getLatestVersion:()=>{let{versions:{latest,next,current}}=store2.getState();return current&&import_semver.default.prerelease(current.version)&&next?latest&&import_semver.default.gt(latest.version,next.version)?latest:next:latest},versionUpdateAvailable:()=>{let latest=api.getLatestVersion(),current=api.getCurrentVersion();if(latest){if(!latest.version||!current.version)return!0;let actualCurrent=!!import_semver.default.prerelease(current.version)?`${import_semver.default.major(current.version)}.${import_semver.default.minor(current.version)}.${import_semver.default.patch(current.version)}`:current.version,diff=import_semver.default.diff(actualCurrent,latest.version);return import_semver.default.gt(latest.version,actualCurrent)&&diff!=="patch"&&!diff.includes("pre")}return!1}};return{init:async()=>{let{versions={}}=store2.getState(),{latest,next}=getVersionCheckData();if(await store2.setState({versions:{...versions,latest,next}}),api.versionUpdateAvailable()){let latestVersion=api.getLatestVersion().version,diff=import_semver.default.diff(versions.current.version,versions.latest.version);latestVersion!==dismissedVersionNotification&&diff!=="patch"&&!import_semver.default.prerelease(latestVersion)&&mode!=="production"&&fullAPI.addNotification({id:"update",link:"/settings/about",content:{headline:`Storybook ${latestVersion} is available!`,subHeadline:`Your current version is: ${versions.current.version}`},icon:{name:"book"},onClear(){store2.setState({dismissedVersionNotification:latestVersion},{persistence:"permanent"})}})}},state,api}};var globals_exports={};__export(globals_exports,{init:()=>init13});var import_core_events6=require("@storybook/core-events"),import_client_logger4=require("@storybook/client-logger"),import_dequal3=require("dequal");var init13=({store:store2,fullAPI})=>{let api={getGlobals(){return store2.getState().globals},getGlobalTypes(){return store2.getState().globalTypes},updateGlobals(newGlobals){fullAPI.emit(import_core_events6.UPDATE_GLOBALS,{globals:newGlobals,options:{target:"storybook-preview-iframe"}})}},state={globals:{},globalTypes:{}},updateGlobals=globals=>{var _a;let currentGlobals=(_a=store2.getState())==null?void 0:_a.globals;(0,import_dequal3.dequal)(globals,currentGlobals)||store2.setState({globals})};return{api,state,init:()=>{fullAPI.on(import_core_events6.GLOBALS_UPDATED,function({globals}){let{ref}=getEventMetadata(this,fullAPI);ref?import_client_logger4.logger.warn("received a GLOBALS_UPDATED from a non-local ref. This is not currently supported."):updateGlobals(globals)}),fullAPI.on(import_core_events6.SET_GLOBALS,function({globals,globalTypes}){var _a;let{ref}=getEventMetadata(this,fullAPI),currentGlobals=(_a=store2.getState())==null?void 0:_a.globals;ref?Object.keys(globals).length>0&&import_client_logger4.logger.warn("received globals from a non-local ref. This is not currently supported."):store2.setState({globals,globalTypes}),currentGlobals&&Object.keys(currentGlobals).length!==0&&!(0,import_dequal3.dequal)(globals,currentGlobals)&&api.updateGlobals(currentGlobals)})}}};var import_global9=require("@storybook/global"),import_core_events7=require("@storybook/core-events"),import_types2=require("@storybook/types"),import_client_logger5=require("@storybook/client-logger");var import_channels=require("@storybook/channels");function mockChannel(){let transport={setHandler:()=>{},send:()=>{}};return new import_channels.Channel({transport})}var AddonStore=class{constructor(){this.loaders={};this.elements={};this.config={};this.getChannel=()=>(this.channel||this.setChannel(mockChannel()),this.channel);this.getServerChannel=()=>{if(!this.serverChannel)throw new Error("Accessing non-existent serverChannel");return this.serverChannel};this.ready=()=>this.promise;this.hasChannel=()=>!!this.channel;this.hasServerChannel=()=>!!this.serverChannel;this.setChannel=channel=>{this.channel=channel,this.resolve()};this.setServerChannel=channel=>{this.serverChannel=channel};this.getElements=type=>(this.elements[type]||(this.elements[type]={}),this.elements[type]);this.addPanel=(name,options)=>{this.add(name,{type:import_types2.Addon_TypesEnum.PANEL,...options})};this.add=(name,addon)=>{let{type}=addon,collection=this.getElements(type);collection[name]={id:name,...addon}};this.setConfig=value=>{Object.assign(this.config,value),this.hasChannel()?this.getChannel().emit(import_core_events7.SET_CONFIG,this.config):this.ready().then(channel=>{channel.emit(import_core_events7.SET_CONFIG,this.config)})};this.getConfig=()=>this.config;this.register=(name,registerCallback)=>{this.loaders[name]&&import_client_logger5.logger.warn(`${name} was loaded twice, this could have bad side-effects`),this.loaders[name]=registerCallback};this.loadAddons=api=>{Object.values(this.loaders).forEach(value=>value(api))};this.promise=new Promise(res=>{this.resolve=()=>res(this.getChannel())})}},KEY="__STORYBOOK_ADDONS_MANAGER";function getAddonsStore(){return import_global9.global[KEY]||(import_global9.global[KEY]=new AddonStore),import_global9.global[KEY]}var addons=getAddonsStore();var{ActiveTabs:ActiveTabs2}=layout_exports;var ManagerContext=createContext({api:void 0,state:initial_state_default({})}),combineParameters=(...parameterSets)=>(0,import_mergeWith2.default)({},...parameterSets,(objValue,srcValue)=>{if(Array.isArray(srcValue))return srcValue}),ManagerProvider=class extends import_react2.Component{constructor(props){super(props);this.api={};this.initModules=()=>{this.modules.forEach(module2=>{"init"in module2&&module2.init()})};let{location:location2,path,refId,viewMode=props.docsOptions.docsMode?"docs":"story",singleStory,storyId,docsOptions,navigate}=props,store2=new Store({getState:()=>this.state,setState:(stateChange,callback)=>this.setState(stateChange,callback)}),routeData={location:location2,path,viewMode,singleStory,storyId,refId},optionsData={docsOptions};this.state=store2.getInitialState(initial_state_default({...routeData,...optionsData}));let apiData={navigate,store:store2,provider:props.provider};this.modules=[provider_exports,channel_exports,addons_exports,layout_exports,notifications_exports,settings_exports,release_notes_exports,shortcuts_exports,stories_exports,refs_exports,globals_exports,url_exports,versions_exports].map(m=>m.init({...routeData,...optionsData,...apiData,state:this.state,fullAPI:this.api}));let state=initial_state_default(this.state,...this.modules.map(m=>m.state)),api=Object.assign(this.api,{navigate},...this.modules.map(m=>m.api));this.state=state,this.api=api}static getDerivedStateFromProps(props,state){return state.path!==props.path?{...state,location:props.location,path:props.path,refId:props.refId,viewMode:props.viewMode,storyId:props.storyId}:null}shouldComponentUpdate(nextProps,nextState){let prevState=this.state,prevProps=this.props;return prevState!==nextState||prevProps.path!==nextProps.path}render(){let{children}=this.props,value={state:this.state,api:this.api};return import_react2.default.createElement(EffectOnMount,{effect:this.initModules},import_react2.default.createElement(ManagerContext.Provider,{value},import_react2.default.createElement(ManagerConsumer,null,children)))}};ManagerProvider.displayName="Manager";var EffectOnMount=({children,effect})=>(import_react2.default.useEffect(effect,[]),children),defaultFilter=c=>c;function ManagerConsumer({filter=defaultFilter,children}){let c=(0,import_react2.useContext)(ManagerContext),renderer=(0,import_react2.useRef)(children),filterer=(0,import_react2.useRef)(filter);if(typeof renderer.current!="function")return import_react2.default.createElement(import_react2.Fragment,null,renderer.current);let data=filterer.current(c),l=(0,import_react2.useMemo)(()=>[...Object.entries(data).reduce((acc,keyval)=>acc.concat(keyval),[])],[c.state]);return(0,import_react2.useMemo)(()=>{let Child=renderer.current;return import_react2.default.createElement(Child,{...data})},l)}function useStorybookState(){let{state}=(0,import_react2.useContext)(ManagerContext);return{...state,get storiesHash(){return(0,import_client_logger6.deprecate)("state.storiesHash is deprecated, please use state.index"),this.index||{}},get storiesConfigured(){return(0,import_client_logger6.deprecate)("state.storiesConfigured is deprecated, please use state.previewInitialized"),this.previewInitialized},get storiesFailed(){return(0,import_client_logger6.deprecate)("state.storiesFailed is deprecated, please use state.indexError"),this.indexError}}}function useStorybookApi(){let{api}=(0,import_react2.useContext)(ManagerContext);return api}function orDefault(fromStore,defaultState2){return typeof fromStore>"u"?defaultState2:fromStore}var useChannel=(eventMap,deps=[])=>{let api=useStorybookApi();return(0,import_react2.useEffect)(()=>(Object.entries(eventMap).forEach(([type,listener])=>api.on(type,listener)),()=>{Object.entries(eventMap).forEach(([type,listener])=>api.off(type,listener))}),deps),api.emit};function useStoryPrepared(storyId){return useStorybookApi().isPrepared(storyId)}function useParameter(parameterKey,defaultValue){let result=useStorybookApi().getCurrentParameter(parameterKey);return orDefault(result,defaultValue)}var addonStateCache={};function useSharedState(stateId,defaultState2){let api=useStorybookApi(),existingState=api.getAddonState(stateId),state=orDefault(existingState,addonStateCache[stateId]?addonStateCache[stateId]:defaultState2),setState=(s,options)=>{addonStateCache[stateId]&&(addonStateCache[stateId]=s),api.setAddonState(stateId,s,options)},allListeners=(0,import_react2.useMemo)(()=>{let stateChangeHandlers={[`${import_core_events8.SHARED_STATE_CHANGED}-client-${stateId}`]:s=>setState(s),[`${import_core_events8.SHARED_STATE_SET}-client-${stateId}`]:s=>setState(s)},stateInitializationHandlers={[import_core_events8.SET_STORIES]:()=>{let currentState=api.getAddonState(stateId);currentState?(addonStateCache[stateId]=currentState,api.emit(`${import_core_events8.SHARED_STATE_SET}-manager-${stateId}`,currentState)):addonStateCache[stateId]?(setState(addonStateCache[stateId]),api.emit(`${import_core_events8.SHARED_STATE_SET}-manager-${stateId}`,addonStateCache[stateId])):defaultState2!==void 0&&(setState(defaultState2),addonStateCache[stateId]=defaultState2,api.emit(`${import_core_events8.SHARED_STATE_SET}-manager-${stateId}`,defaultState2))},[import_core_events8.STORY_CHANGED]:()=>{let currentState=api.getAddonState(stateId);currentState!==void 0&&api.emit(`${import_core_events8.SHARED_STATE_SET}-manager-${stateId}`,currentState)}};return{...stateChangeHandlers,...stateInitializationHandlers}},[stateId]),emit=useChannel(allListeners);return[state,(newStateOrMerger,options)=>{setState(newStateOrMerger,options),emit(`${import_core_events8.SHARED_STATE_CHANGED}-manager-${stateId}`,newStateOrMerger)}]}function useAddonState(addonId,defaultState2){return useSharedState(addonId,defaultState2)}function useArgs(){let{getCurrentStoryData,updateStoryArgs,resetStoryArgs}=useStorybookApi(),data=getCurrentStoryData(),args=(data==null?void 0:data.type)==="story"?data.args:{},updateArgs=(0,import_react2.useCallback)(newArgs=>updateStoryArgs(data,newArgs),[data,updateStoryArgs]),resetArgs=(0,import_react2.useCallback)(argNames=>resetStoryArgs(data,argNames),[data,resetStoryArgs]);return[args,updateArgs,resetArgs]}function useGlobals(){let api=useStorybookApi();return[api.getGlobals(),api.updateGlobals]}function useGlobalTypes(){return useStorybookApi().getGlobalTypes()}function useCurrentStory(){let{getCurrentStoryData}=useStorybookApi();return getCurrentStoryData()}function useArgTypes(){let current=useCurrentStory();return(current==null?void 0:current.type)==="story"&&current.argTypes||{}}0&&(module.exports={ActiveTabs,Consumer,ManagerContext,Provider,addons,combineParameters,controlOrMetaKey,controlOrMetaSymbol,eventMatchesShortcut,eventToShortcut,isMacLike,isShortcutTaken,keyToSymbol,merge,mockChannel,optionOrAltSymbol,shortcutMatchesShortcut,shortcutToHumanString,types,useAddonState,useArgTypes,useArgs,useChannel,useGlobalTypes,useGlobals,useParameter,useSharedState,useStoryPrepared,useStorybookApi,useStorybookState});
{
"name": "@storybook/manager-api",
"version": "7.1.0-alpha.40",
"version": "7.1.0-alpha.41",
"description": "Core Storybook Manager API & Context",

@@ -45,10 +45,10 @@ "keywords": [

"dependencies": {
"@storybook/channels": "7.1.0-alpha.40",
"@storybook/client-logger": "7.1.0-alpha.40",
"@storybook/core-events": "7.1.0-alpha.40",
"@storybook/channels": "7.1.0-alpha.41",
"@storybook/client-logger": "7.1.0-alpha.41",
"@storybook/core-events": "7.1.0-alpha.41",
"@storybook/csf": "^0.1.0",
"@storybook/global": "^5.0.0",
"@storybook/router": "7.1.0-alpha.40",
"@storybook/theming": "7.1.0-alpha.40",
"@storybook/types": "7.1.0-alpha.40",
"@storybook/router": "7.1.0-alpha.41",
"@storybook/theming": "7.1.0-alpha.41",
"@storybook/types": "7.1.0-alpha.41",
"dequal": "^2.0.2",

@@ -55,0 +55,0 @@ "lodash": "^4.17.21",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc