axp-ui/docs/assets/preview-5c6325c3.js.map

1 line
67 KiB
Plaintext
Raw Normal View History

2023-10-11 10:29:52 +03:00
{"version":3,"file":"preview-5c6325c3.js","sources":["../../node_modules/@storybook/instrumenter/dist/index.mjs","../../node_modules/jest-mock/build/index.js","../../node_modules/@storybook/addon-interactions/dist/preview.mjs"],"sourcesContent":["import { addons } from '@storybook/preview-api';\nimport { once, logger } from '@storybook/client-logger';\nimport { FORCE_REMOUNT, STORY_RENDER_PHASE_CHANGED, SET_CURRENT_STORY, IGNORED_EXCEPTION } from '@storybook/core-events';\nimport { global } from '@storybook/global';\n\nvar CallStates=(CallStates2=>(CallStates2.DONE=\"done\",CallStates2.ERROR=\"error\",CallStates2.ACTIVE=\"active\",CallStates2.WAITING=\"waiting\",CallStates2))(CallStates||{});var EVENTS={CALL:\"storybook/instrumenter/call\",SYNC:\"storybook/instrumenter/sync\",START:\"storybook/instrumenter/start\",BACK:\"storybook/instrumenter/back\",GOTO:\"storybook/instrumenter/goto\",NEXT:\"storybook/instrumenter/next\",END:\"storybook/instrumenter/end\"},controlsDisabled={start:!1,back:!1,goto:!1,next:!1,end:!1},alreadyCompletedException=new Error(\"This function ran after the play function completed. Did you forget to `await` it?\"),isObject=o=>Object.prototype.toString.call(o)===\"[object Object]\",isModule=o=>Object.prototype.toString.call(o)===\"[object Module]\",isInstrumentable=o=>{if(!isObject(o)&&!isModule(o))return !1;if(o.constructor===void 0)return !0;let proto=o.constructor.prototype;return !(!isObject(proto)||Object.prototype.hasOwnProperty.call(proto,\"isPrototypeOf\")===!1)},construct=obj=>{try{return new obj.constructor}catch{return {}}},getInitialState=()=>({renderPhase:void 0,isDebugging:!1,isPlaying:!1,isLocked:!1,cursor:0,calls:[],shadowCalls:[],callRefsByResult:new Map,chainedCallIds:new Set,ancestors:[],playUntil:void 0,resolvers:{},syncTimeout:void 0}),getRetainedState=(state,isDebugging=!1)=>{let calls=(isDebugging?state.shadowCalls:state.calls).filter(call=>call.retain);if(!calls.length)return;let callRefsByResult=new Map(Array.from(state.callRefsByResult.entries()).filter(([,ref])=>ref.retain));return {cursor:calls.length,calls,callRefsByResult}},Instrumenter=class{constructor(){this.initialized=!1;this.channel=addons.getChannel(),this.state=global.window.parent.__STORYBOOK_ADDON_INTERACTIONS_INSTRUMENTER_STATE__||{};let resetState=({storyId,isPlaying=!0,isDebugging=!1})=>{let state=this.getState(storyId);this.setState(storyId,{...getInitialState(),...getRetainedState(state,isDebugging),shadowCalls:isDebugging?state.shadowCalls:[],chainedCallIds:isDebugging?state.chainedCallIds:new Set,playUntil:isDebugging?state.playUntil:void 0,isPlaying,isDebugging}),this.sync(storyId);};this.channel.on(FORCE_REMOUNT,resetState),this.channel.on(STORY_RENDER_PHASE_CHANGED,({storyId,newPhase})=>{let{isDebugging}=this.getState(storyId);this.setState(storyId,{renderPhase:newPhase}),newPhase===\"preparing\"&&isDebugging&&resetState({storyId}),newPhase===\"playing\"&&resetState({storyId,isDebugging}),newPhase===\"played\"&&this.setState(storyId,{isLocked:!1,isPlaying:!1,isDebugging:!1}),newPhase===\"errored\"&&this.setState(storyId,{isLocked:!1,isPlaying:!1});}),this.channel.on(SET_CURRENT_STORY,()=>{this.initialized?this.cleanup():this.initialized=!0;});let start=({storyId,playUntil})=>{this.getState(storyId).isDebugging||this.setState(storyId,({calls})=>({calls:[],shadowCalls:calls.map(call=>({...call,status:\"waiting\"})),isDebugging:!0}));let log=this.getLog(storyId);this.setState(storyId,({shadowCalls})=>{if(playUntil||!log.length)return {playUntil};let firstRowIndex=shadowCalls.findIndex(call=>call.id===log[0].callId);return {playUntil:shadowCalls.slice(0,firstRowIndex).filter(call=>call.interceptable&&!call.ancestors.length).slice(-1)[0]?.id}}),this.channel.emit(FORCE_REMOUNT,{storyId,isDebugging:!0});},back=({storyId})=>{let log=this.getLog(storyId).filter(call=>!call.ancestors.length),last=log.reduceRight((res,item,index)=>res>=0||item.status===\"waiting\"?res:index,-1);start({storyId,playUntil:log[last-1]?.callId});},goto=({storyId,callId})=>{let{calls,shadowCalls,resolvers}=this.getState(storyId),ca