Files
components/assets/preview.ae58cafd.js
T

6 lines
26 KiB
JavaScript

var ot=Object.defineProperty;var f=(r,t)=>ot(r,"name",{value:t,configurable:!0});import{G as st,H as at,I as ut,J as lt,K as ct,L as ft,M as dt,w as I,N as pt,j as X,O as j,P as Q,Q as yt,R as ht,c as gt}from"./iframe.c2dfa352.js";import"./es.map.constructor.61480a1d.js";var vt=st,_t=at;vt("toPrimitive");_t();var mt=ut,bt=lt,Ot=TypeError,It=f(function(r){if(mt(this),r==="string"||r==="default")r="string";else if(r!=="number")throw Ot("Incorrect hint");return bt(this,r)},"dateToPrimitive$1"),kt=ct,St=ft,wt=It,Et=dt,G=Et("toPrimitive"),W=Date.prototype;kt(W,G)||St(W,G,wt);var O;(function(r){r.DONE="done",r.ERROR="error",r.ACTIVE="active",r.WAITING="waiting"})(O||(O={}));var A;function R(r){return R=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R(r)}f(R,"_typeof");function Rt(r,t){if(r==null)return{};var e=Ct(r,t),n,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(r);for(o=0;o<s.length;o++)n=s[o],!(t.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(r,n)||(e[n]=r[n]))}return e}f(Rt,"_objectWithoutProperties");function Ct(r,t){if(r==null)return{};var e={},n=Object.keys(r),o,s;for(s=0;s<n.length;s++)o=n[s],!(t.indexOf(o)>=0)&&(e[o]=r[o]);return e}f(Ct,"_objectWithoutPropertiesLoose");function Tt(r){var t=Pt(r,"string");return R(t)==="symbol"?t:String(t)}f(Tt,"_toPropertyKey");function Pt(r,t){if(R(r)!=="object"||r===null)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var n=e.call(r,t||"default");if(R(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}f(Pt,"_toPrimitive");function P(r){return Dt(r)||Mt(r)||Z(r)||At()}f(P,"_toConsumableArray");function At(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}f(At,"_nonIterableSpread");function Mt(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}f(Mt,"_iterableToArray");function Dt(r){if(Array.isArray(r))return x(r)}f(Dt,"_arrayWithoutHoles");function M(r,t,e){return t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}f(M,"_defineProperty$1");function Nt(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}f(Nt,"_classCallCheck");function L(r,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}f(L,"_defineProperties");function jt(r,t,e){return t&&L(r.prototype,t),e&&L(r,e),Object.defineProperty(r,"prototype",{writable:!1}),r}f(jt,"_createClass");function q(r,t){return Ut(r)||Ft(r,t)||Z(r,t)||xt()}f(q,"_slicedToArray$1");function xt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}f(xt,"_nonIterableRest$1");function Z(r,t){if(!!r){if(typeof r=="string")return x(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);if(e==="Object"&&r.constructor&&(e=r.constructor.name),e==="Map"||e==="Set")return Array.from(r);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return x(r,t)}}f(Z,"_unsupportedIterableToArray$1");function x(r,t){(t==null||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}f(x,"_arrayLikeToArray$1");function Ft(r,t){var e=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(e!=null){var n=[],o=!0,s=!1,u,i;try{for(e=e.call(r);!(o=(u=e.next()).done)&&(n.push(u.value),!(t&&n.length===t));o=!0);}catch(a){s=!0,i=a}finally{try{!o&&e.return!=null&&e.return()}finally{if(s)throw i}}return n}}f(Ft,"_iterableToArrayLimit$1");function Ut(r){if(Array.isArray(r))return r}f(Ut,"_arrayWithHoles$1");var S={CALL:"instrumenter/call",SYNC:"instrumenter/sync",START:"instrumenter/start",BACK:"instrumenter/back",GOTO:"instrumenter/goto",NEXT:"instrumenter/next",END:"instrumenter/end"},tt=((A=I.FEATURES)===null||A===void 0?void 0:A.interactionsDebugger)!==!0,K={debugger:!tt,start:!1,back:!1,goto:!1,next:!1,end:!1},V=new Error("This function ran after the play function completed. Did you forget to `await` it?"),Y=f(function(t){return Object.prototype.toString.call(t)==="[object Object]"},"isObject"),$t=f(function(t){return Object.prototype.toString.call(t)==="[object Module]"},"isModule"),Bt=f(function(t){if(!Y(t)&&!$t(t))return!1;if(t.constructor===void 0)return!0;var e=t.constructor.prototype;return!(!Y(e)||Object.prototype.hasOwnProperty.call(e,"isPrototypeOf")===!1)},"isInstrumentable"),Gt=f(function(t){try{return new t.constructor}catch{return{}}},"construct"),D=f(function(){return{renderPhase:void 0,isDebugging:!1,isPlaying:!1,isLocked:!1,cursor:0,calls:[],shadowCalls:[],callRefsByResult:new Map,chainedCallIds:new Set,parentId:void 0,playUntil:void 0,resolvers:{},syncTimeout:void 0,forwardedException:void 0}},"getInitialState"),H=f(function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=(e?t.shadowCalls:t.calls).filter(function(s){return s.retain});if(!!n.length){var o=new Map(Array.from(t.callRefsByResult.entries()).filter(function(s){var u=q(s,2),i=u[1];return i.retain}));return{cursor:n.length,calls:n,callRefsByResult:o}}},"getRetainedState"),Wt=function(){function r(){var t=this;Nt(this,r),this.channel=void 0,this.initialized=!1,this.state=void 0,this.channel=X.getChannel(),this.state=I.window.parent.__STORYBOOK_ADDON_INTERACTIONS_INSTRUMENTER_STATE__||{};var e=f(function(c){var l=c.storyId,p=c.isPlaying,g=p===void 0?!0:p,h=c.isDebugging,d=h===void 0?!1:h,y=t.getState(l);t.setState(l,Object.assign({},D(),H(y,d),{shadowCalls:d?y.shadowCalls:[],chainedCallIds:d?y.chainedCallIds:new Set,playUntil:d?y.playUntil:void 0,isPlaying:g,isDebugging:d})),d||t.sync(l)},"resetState");this.channel.on(j,e),this.channel.on(Q,function(a){var c=a.storyId,l=a.newPhase,p=t.getState(c),g=p.isDebugging,h=p.forwardedException;if(t.setState(c,{renderPhase:l}),l==="playing"&&e({storyId:c,isDebugging:g}),l==="played"&&(t.setState(c,{isLocked:!1,isPlaying:!1,isDebugging:!1,forwardedException:void 0}),h))throw h}),this.channel.on(yt,function(){t.initialized?t.cleanup():t.initialized=!0});var n=f(function(c){var l=c.storyId,p=c.playUntil;t.getState(l).isDebugging||t.setState(l,function(h){var d=h.calls;return{calls:[],shadowCalls:d.map(function(y){return Object.assign({},y,{status:O.WAITING})}),isDebugging:!0}});var g=t.getLog(l);t.setState(l,function(h){var d,y=h.shadowCalls,_=y.findIndex(function(v){return v.id===g[0].callId});return{playUntil:p||((d=y.slice(0,_).filter(function(v){return v.interceptable}).slice(-1)[0])===null||d===void 0?void 0:d.id)}}),t.channel.emit(j,{storyId:l,isDebugging:!0})},"start"),o=f(function(c){var l,p=c.storyId,g=t.getState(p),h=g.isDebugging,d=t.getLog(p),y=h?d.findIndex(function(_){var v=_.status;return v===O.WAITING}):d.length;n({storyId:p,playUntil:(l=d[y-2])===null||l===void 0?void 0:l.callId})},"back"),s=f(function(c){var l=c.storyId,p=c.callId,g=t.getState(l),h=g.calls,d=g.shadowCalls,y=g.resolvers,_=h.find(function(b){var E=b.id;return E===p}),v=d.find(function(b){var E=b.id;return E===p});if(!_&&v&&Object.values(y).length>0){var m,k=(m=t.getLog(l).find(function(b){return b.status===O.WAITING}))===null||m===void 0?void 0:m.callId;v.id!==k&&t.setState(l,{playUntil:v.id}),Object.values(y).forEach(function(b){return b()})}else n({storyId:l,playUntil:p})},"goto"),u=f(function(c){var l=c.storyId,p=t.getState(l),g=p.resolvers;if(Object.values(g).length>0)Object.values(g).forEach(function(y){return y()});else{var h,d=(h=t.getLog(l).find(function(y){return y.status===O.WAITING}))===null||h===void 0?void 0:h.callId;d?n({storyId:l,playUntil:d}):i({storyId:l})}},"next"),i=f(function(c){var l=c.storyId;t.setState(l,{playUntil:void 0,isDebugging:!1}),Object.values(t.getState(l).resolvers).forEach(function(p){return p()})},"end");this.channel.on(S.START,n),this.channel.on(S.BACK,o),this.channel.on(S.GOTO,s),this.channel.on(S.NEXT,u),this.channel.on(S.END,i)}return f(r,"Instrumenter"),jt(r,[{key:"getState",value:f(function(e){return this.state[e]||D()},"getState")},{key:"setState",value:f(function(e,n){var o=this.getState(e),s=typeof n=="function"?n(o):n;this.state=Object.assign({},this.state,M({},e,Object.assign({},o,s))),I.window.parent.__STORYBOOK_ADDON_INTERACTIONS_INSTRUMENTER_STATE__=this.state},"setState")},{key:"cleanup",value:f(function(){this.state=Object.entries(this.state).reduce(function(e,n){var o=q(n,2),s=o[0],u=o[1],i=H(u);return i&&(e[s]=Object.assign(D(),i)),e},{}),this.channel.emit(S.SYNC,{controlStates:K,logItems:[]}),I.window.parent.__STORYBOOK_ADDON_INTERACTIONS_INSTRUMENTER_STATE__=this.state},"cleanup")},{key:"getLog",value:f(function(e){var n=this.getState(e),o=n.calls,s=n.shadowCalls,u=P(s);o.forEach(function(a,c){u[c]=a});var i=new Set;return u.reduceRight(function(a,c){return c.args.forEach(function(l){l!=null&&l.__callId__&&i.add(l.__callId__)}),c.path.forEach(function(l){l.__callId__&&i.add(l.__callId__)}),c.interceptable&&!i.has(c.id)&&(a.unshift({callId:c.id,status:c.status}),i.add(c.id)),a},[])},"getLog")},{key:"instrument",value:f(function(e,n){var o=this;if(!Bt(e))return e;var s=n.mutate,u=s===void 0?!1:s,i=n.path,a=i===void 0?[]:i;return Object.keys(e).reduce(function(c,l){var p=e[l];return typeof p!="function"?(c[l]=o.instrument(p,Object.assign({},n,{path:a.concat(l)})),c):typeof p.__originalFn__=="function"?(c[l]=p,c):(c[l]=function(){for(var g=arguments.length,h=new Array(g),d=0;d<g;d++)h[d]=arguments[d];return o.track(l,p,h,n)},c[l].__originalFn__=p,Object.defineProperty(c[l],"name",{value:l,writable:!1}),Object.keys(p).length>0&&Object.assign(c[l],o.instrument(Object.assign({},p),Object.assign({},n,{path:a.concat(l)}))),c)},u?e:Gt(e))},"instrument")},{key:"track",value:f(function(e,n,o,s){var u,i,a,c,l=(o==null||(u=o[0])===null||u===void 0?void 0:u.__storyId__)||((i=I.window.__STORYBOOK_PREVIEW__)===null||i===void 0||(a=i.urlStore)===null||a===void 0||(c=a.selection)===null||c===void 0?void 0:c.storyId),p=this.getState(l),g=p.cursor,h=p.parentId;this.setState(l,{cursor:g+1});var d="".concat(h||l," [").concat(g,"] ").concat(e),y=s.path,_=y===void 0?[]:y,v=s.intercept,m=v===void 0?!1:v,k=s.retain,b=k===void 0?!1:k,E=typeof m=="function"?m(e,_):m,B={id:d,parentId:h,storyId:l,cursor:g,path:_,method:e,args:o,interceptable:E,retain:b},it=(E?this.intercept:this.invoke).call(this,n,B,s);return this.instrument(it,Object.assign({},s,{mutate:!0,path:[{__callId__:B.id}]}))},"track")},{key:"intercept",value:f(function(e,n,o){var s=this,u=this.getState(n.storyId),i=u.chainedCallIds,a=u.isDebugging,c=u.playUntil,l=i.has(n.id);return!a||l||c?(c===n.id&&this.setState(n.storyId,{playUntil:void 0}),this.invoke(e,n,o)):new Promise(function(p){s.setState(n.storyId,function(g){var h=g.resolvers;return{isLocked:!1,resolvers:Object.assign({},h,M({},n.id,p))}})}).then(function(){return s.setState(n.storyId,function(p){var g=p.resolvers,h=n.id;g[h];var d=Rt(g,[h].map(Tt));return{isLocked:!0,resolvers:d}}),s.invoke(e,n,o)})},"intercept")},{key:"invoke",value:f(function(e,n,o){var s=this,u=this.getState(n.storyId),i=u.callRefsByResult,a=u.forwardedException,c=u.renderPhase,l=Object.assign({},n,{args:n.args.map(function(d){if(i.has(d))return i.get(d);if(d instanceof I.window.HTMLElement){var y=d.prefix,_=d.localName,v=d.id,m=d.classList,k=d.innerText,b=Array.from(m);return{__element__:{prefix:y,localName:_,id:v,classNames:b,innerText:k}}}return d})});n.path.forEach(function(d){d!=null&&d.__callId__&&s.setState(n.storyId,function(y){var _=y.chainedCallIds;return{chainedCallIds:new Set(Array.from(_).concat(d.__callId__))}})});var p=f(function(y){if(y instanceof Error){var _=y.name,v=y.message,m=y.stack,k={name:_,message:v,stack:m};if(s.update(Object.assign({},l,{status:O.ERROR,exception:k})),s.setState(n.storyId,function(b){return{callRefsByResult:new Map([].concat(P(Array.from(b.callRefsByResult.entries())),[[y,{__callId__:n.id,retain:n.retain}]]))}}),n.interceptable&&y!==V)throw ht;return s.setState(n.storyId,{forwardedException:y}),y}throw y},"handleException");try{if(a)throw this.setState(n.storyId,{forwardedException:void 0}),a;if(c==="played"&&!n.retain)throw V;var g=o.getArgs?o.getArgs(n,this.getState(n.storyId)):n.args,h=e.apply(void 0,P(g.map(function(d){return typeof d!="function"||Object.keys(d).length?d:function(){var y=s.getState(n.storyId),_=y.cursor,v=y.parentId;s.setState(n.storyId,{cursor:0,parentId:n.id});var m=f(function(){return s.setState(n.storyId,{cursor:_,parentId:v})},"restore"),k=d.apply(void 0,arguments);return k instanceof Promise?k.then(m,m):m(),k}})));return h&&["object","function","symbol"].includes(R(h))&&this.setState(n.storyId,function(d){return{callRefsByResult:new Map([].concat(P(Array.from(d.callRefsByResult.entries())),[[h,{__callId__:n.id,retain:n.retain}]]))}}),this.update(Object.assign({},l,{status:h instanceof Promise?O.ACTIVE:O.DONE})),h instanceof Promise?h.then(function(d){return s.update(Object.assign({},l,{status:O.DONE})),d},p):h}catch(d){return p(d)}},"invoke")},{key:"update",value:f(function(e){var n=this;clearTimeout(this.getState(e.storyId).syncTimeout),this.channel.emit(S.CALL,e),this.setState(e.storyId,function(o){var s=o.calls,u=s.concat(e).reduce(function(i,a){return Object.assign(i,M({},a.id,a))},{});return{calls:Object.values(u).sort(function(i,a){return i.id.localeCompare(a.id,void 0,{numeric:!0})}),syncTimeout:setTimeout(function(){return n.sync(e.storyId)},0)}})},"update")},{key:"sync",value:f(function(e){var n=this.getState(e),o=n.isLocked,s=n.isPlaying,u=this.getLog(e),i=u.some(function(l){return l.status===O.ACTIVE});if(tt||o||i||u.length===0){this.channel.emit(S.SYNC,{controlStates:K,logItems:u});return}var a=u.some(function(l){return[O.DONE,O.ERROR].includes(l.status)}),c={debugger:!0,start:a,back:a,goto:!0,next:s,end:s};this.channel.emit(S.SYNC,{controlStates:c,logItems:u})},"sync")}]),r}();function Lt(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};try{var e,n,o,s,u=!1,i=!1;if(((e=I.window.location)===null||e===void 0||(n=e.search)===null||n===void 0?void 0:n.indexOf("instrument=true"))!==-1?u=!0:((o=I.window.location)===null||o===void 0||(s=o.search)===null||s===void 0?void 0:s.indexOf("instrument=false"))!==-1&&(i=!0),I.window.parent===I.window&&!u||i)return r;I.window.__STORYBOOK_ADDON_INTERACTIONS_INSTRUMENTER__||(I.window.__STORYBOOK_ADDON_INTERACTIONS_INSTRUMENTER__=new Wt);var a=I.window.__STORYBOOK_ADDON_INTERACTIONS_INSTRUMENTER__;return a.instrument(r,t)}catch(c){return pt.warn(c),r}}f(Lt,"instrument");var w={};Object.defineProperty(w,"__esModule",{value:!0});w.spyOn=w.mocked=w.fn=nt=w.ModuleMocker=void 0;function T(r,t,e){return t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}f(T,"_defineProperty");const N="mockConstructor",et=/[\s!-\/:-@\[-`{-~]/,Kt=new RegExp(et.source,"g"),Vt=new Set(["arguments","await","break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","eval","export","extends","false","finally","for","function","if","implements","import","in","instanceof","interface","let","new","null","package","private","protected","public","return","static","super","switch","this","throw","true","try","typeof","var","void","while","with","yield"]);function Yt(r,t){let e;switch(t){case 1:e=f(function(n){return r.apply(this,arguments)},"mockConstructor");break;case 2:e=f(function(n,o){return r.apply(this,arguments)},"mockConstructor");break;case 3:e=f(function(n,o,s){return r.apply(this,arguments)},"mockConstructor");break;case 4:e=f(function(n,o,s,u){return r.apply(this,arguments)},"mockConstructor");break;case 5:e=f(function(n,o,s,u,i){return r.apply(this,arguments)},"mockConstructor");break;case 6:e=f(function(n,o,s,u,i,a){return r.apply(this,arguments)},"mockConstructor");break;case 7:e=f(function(n,o,s,u,i,a,c){return r.apply(this,arguments)},"mockConstructor");break;case 8:e=f(function(n,o,s,u,i,a,c,l){return r.apply(this,arguments)},"mockConstructor");break;case 9:e=f(function(n,o,s,u,i,a,c,l,p){return r.apply(this,arguments)},"mockConstructor");break;default:e=f(function(){return r.apply(this,arguments)},"mockConstructor");break}return e}f(Yt,"matchArity");function F(r){return Object.prototype.toString.apply(r).slice(8,-1)}f(F,"getObjectType");function Ht(r){const t=F(r);return t==="Function"||t==="AsyncFunction"||t==="GeneratorFunction"?"function":Array.isArray(r)?"array":t==="Object"?"object":t==="Number"||t==="String"||t==="Boolean"||t==="Symbol"?"constant":t==="Map"||t==="WeakMap"||t==="Set"?"collection":t==="RegExp"?"regexp":r===void 0?"undefined":r===null?"null":null}f(Ht,"getType");function zt(r,t){if(t==="arguments"||t==="caller"||t==="callee"||t==="name"||t==="length"){const e=F(r);return e==="Function"||e==="AsyncFunction"||e==="GeneratorFunction"}return t==="source"||t==="global"||t==="ignoreCase"||t==="multiline"?F(r)==="RegExp":!1}f(zt,"isReadonlyProp");class U{constructor(t){T(this,"_environmentGlobal",void 0),T(this,"_mockState",void 0),T(this,"_mockConfigRegistry",void 0),T(this,"_spyState",void 0),T(this,"_invocationCallCounter",void 0),this._environmentGlobal=t,this._mockState=new WeakMap,this._mockConfigRegistry=new WeakMap,this._spyState=new Set,this._invocationCallCounter=1}_getSlots(t){if(!t)return[];const e=new Set,n=this._environmentGlobal.Object.prototype,o=this._environmentGlobal.Function.prototype,s=this._environmentGlobal.RegExp.prototype,u=Object.prototype,i=Function.prototype,a=RegExp.prototype;for(;t!=null&&t!==n&&t!==o&&t!==s&&t!==u&&t!==i&&t!==a;){const c=Object.getOwnPropertyNames(t);for(let l=0;l<c.length;l++){const p=c[l];if(!zt(t,p)){const g=Object.getOwnPropertyDescriptor(t,p);(g!==void 0&&!g.get||t.__esModule)&&e.add(p)}}t=Object.getPrototypeOf(t)}return Array.from(e)}_ensureMockConfig(t){let e=this._mockConfigRegistry.get(t);return e||(e=this._defaultMockConfig(),this._mockConfigRegistry.set(t,e)),e}_ensureMockState(t){let e=this._mockState.get(t);return e||(e=this._defaultMockState(),this._mockState.set(t,e)),e.calls.length>0&&(e.lastCall=e.calls[e.calls.length-1]),e}_defaultMockConfig(){return{mockImpl:void 0,mockName:"jest.fn()",specificMockImpls:[],specificReturnValues:[]}}_defaultMockState(){return{calls:[],instances:[],invocationCallOrder:[],results:[]}}_makeComponent(t,e){if(t.type==="object")return new this._environmentGlobal.Object;if(t.type==="array")return new this._environmentGlobal.Array;if(t.type==="regexp")return new this._environmentGlobal.RegExp("");if(t.type==="constant"||t.type==="collection"||t.type==="null"||t.type==="undefined")return t.value;if(t.type==="function"){const n=t.members&&t.members.prototype&&t.members.prototype.members||{},o=this._getSlots(n),s=this,u=Yt(function(...a){const c=s._ensureMockState(i),l=s._ensureMockConfig(i);c.instances.push(this),c.calls.push(a);const p={type:"incomplete",value:void 0};c.results.push(p),c.invocationCallOrder.push(s._invocationCallCounter++);let g,h,d=!1;try{g=(()=>{if(this instanceof i){o.forEach(v=>{if(n[v].type==="function"){const m=this[v];this[v]=s.generateFromMetadata(n[v]),this[v]._protoImpl=m}});const _=l.specificMockImpls.length?l.specificMockImpls.shift():l.mockImpl;return _&&_.apply(this,arguments)}let y=l.specificMockImpls.shift();if(y===void 0&&(y=l.mockImpl),y)return y.apply(this,arguments);if(i._protoImpl)return i._protoImpl.apply(this,arguments)})()}catch(y){throw h=y,d=!0,y}finally{p.type=d?"throw":"return",p.value=d?h:g}return g},t.length||0),i=this._createMockFunction(t,u);return i._isMockFunction=!0,i.getMockImplementation=()=>this._ensureMockConfig(i).mockImpl,typeof e=="function"&&this._spyState.add(e),this._mockState.set(i,this._defaultMockState()),this._mockConfigRegistry.set(i,this._defaultMockConfig()),Object.defineProperty(i,"mock",{configurable:!1,enumerable:!0,get:()=>this._ensureMockState(i),set:a=>this._mockState.set(i,a)}),i.mockClear=()=>(this._mockState.delete(i),i),i.mockReset=()=>(i.mockClear(),this._mockConfigRegistry.delete(i),i),i.mockRestore=()=>(i.mockReset(),e?e():void 0),i.mockReturnValueOnce=a=>i.mockImplementationOnce(()=>a),i.mockResolvedValueOnce=a=>i.mockImplementationOnce(()=>Promise.resolve(a)),i.mockRejectedValueOnce=a=>i.mockImplementationOnce(()=>Promise.reject(a)),i.mockReturnValue=a=>i.mockImplementation(()=>a),i.mockResolvedValue=a=>i.mockImplementation(()=>Promise.resolve(a)),i.mockRejectedValue=a=>i.mockImplementation(()=>Promise.reject(a)),i.mockImplementationOnce=a=>(this._ensureMockConfig(i).specificMockImpls.push(a),i),i.mockImplementation=a=>{const c=this._ensureMockConfig(i);return c.mockImpl=a,i},i.mockReturnThis=()=>i.mockImplementation(function(){return this}),i.mockName=a=>{if(a){const c=this._ensureMockConfig(i);c.mockName=a}return i},i.getMockName=()=>this._ensureMockConfig(i).mockName||"jest.fn()",t.mockImpl&&i.mockImplementation(t.mockImpl),i}else{const n=t.type||"undefined type";throw new Error("Unrecognized type "+n)}}_createMockFunction(t,e){let n=t.name;if(!n)return e;const o="bound ";let s="";if(n&&n.startsWith(o))do n=n.substring(o.length),s=".bind(null)";while(n&&n.startsWith(o));if(n===N)return e;(Vt.has(n)||/^\d/.test(n))&&(n="$"+n),et.test(n)&&(n=n.replace(Kt,"$"));const u="return function "+n+"() {return "+N+".apply(this,arguments);}"+s;return new this._environmentGlobal.Function(N,u)(e)}_generateMock(t,e,n){const o=this._makeComponent(t);return t.refID!=null&&(n[t.refID]=o),this._getSlots(t.members).forEach(s=>{const u=t.members&&t.members[s]||{};u.ref!=null?e.push(function(i){return()=>o[s]=n[i]}(u.ref)):o[s]=this._generateMock(u,e,n)}),t.type!=="undefined"&&t.type!=="null"&&o.prototype&&typeof o.prototype=="object"&&(o.prototype.constructor=o),o}generateFromMetadata(t){const e=[],n={},o=this._generateMock(t,e,n);return e.forEach(s=>s()),o}getMetadata(t,e){const n=e||new Map,o=n.get(t);if(o!=null)return{ref:o};const s=Ht(t);if(!s)return null;const u={type:s};if(s==="constant"||s==="collection"||s==="undefined"||s==="null")return u.value=t,u;s==="function"&&(u.name=t.name,t._isMockFunction===!0&&(u.mockImpl=t.getMockImplementation())),u.refID=n.size,n.set(t,u.refID);let i=null;return s!=="array"&&this._getSlots(t).forEach(a=>{if(s==="function"&&t._isMockFunction===!0&&a.match(/^mock/))return;const c=this.getMetadata(t[a],n);c&&(i||(i={}),i[a]=c)}),i&&(u.members=i),u}isMockFunction(t){return!!t&&t._isMockFunction===!0}fn(t){const e=t?t.length:0,n=this._makeComponent({length:e,type:"function"});return t&&n.mockImplementation(t),n}spyOn(t,e,n){if(n)return this._spyOnProperty(t,e,n);if(typeof t!="object"&&typeof t!="function")throw new Error("Cannot spyOn on a primitive value; "+this._typeOf(t)+" given");const o=t[e];if(!this.isMockFunction(o)){if(typeof o!="function")throw new Error("Cannot spy the "+e+" property because it is not a function; "+this._typeOf(o)+" given instead");const s=Object.prototype.hasOwnProperty.call(t,e);let u=Object.getOwnPropertyDescriptor(t,e),i=Object.getPrototypeOf(t);for(;!u&&i!==null;)u=Object.getOwnPropertyDescriptor(i,e),i=Object.getPrototypeOf(i);let a;if(u&&u.get){const c=u.get;a=this._makeComponent({type:"function"},()=>{u.get=c,Object.defineProperty(t,e,u)}),u.get=()=>a,Object.defineProperty(t,e,u)}else a=this._makeComponent({type:"function"},()=>{s?t[e]=o:delete t[e]}),t[e]=a;a.mockImplementation(function(){return o.apply(this,arguments)})}return t[e]}_spyOnProperty(t,e,n="get"){if(typeof t!="object"&&typeof t!="function")throw new Error("Cannot spyOn on a primitive value; "+this._typeOf(t)+" given");if(!t)throw new Error("spyOn could not find an object to spy upon for "+e);if(!e)throw new Error("No property name supplied");let o=Object.getOwnPropertyDescriptor(t,e),s=Object.getPrototypeOf(t);for(;!o&&s!==null;)o=Object.getOwnPropertyDescriptor(s,e),s=Object.getPrototypeOf(s);if(!o)throw new Error(e+" property does not exist");if(!o.configurable)throw new Error(e+" is not declared configurable");if(!o[n])throw new Error("Property "+e+" does not have access type "+n);const u=o[n];if(!this.isMockFunction(u)){if(typeof u!="function")throw new Error("Cannot spy the "+e+" property because it is not a function; "+this._typeOf(u)+" given instead");o[n]=this._makeComponent({type:"function"},()=>{o[n]=u,Object.defineProperty(t,e,o)}),o[n].mockImplementation(function(){return u.apply(this,arguments)})}return Object.defineProperty(t,e,o),o[n]}clearAllMocks(){this._mockState=new WeakMap}resetAllMocks(){this._mockConfigRegistry=new WeakMap,this._mockState=new WeakMap}restoreAllMocks(){this._spyState.forEach(t=>t()),this._spyState=new Set}_typeOf(t){return t==null?""+t:typeof t}mocked(t,e=!1){return t}}f(U,"ModuleMocker");var nt=w.ModuleMocker=U;const C=new U(gt),Jt=C.fn.bind(C);w.fn=Jt;const Xt=C.spyOn.bind(C);w.spyOn=Xt;const Qt=C.mocked.bind(C);w.mocked=Qt;function qt(r,t){return ne(r)||ee(r,t)||te(r,t)||Zt()}f(qt,"_slicedToArray");function Zt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}f(Zt,"_nonIterableRest");function te(r,t){if(!!r){if(typeof r=="string")return z(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);if(e==="Object"&&r.constructor&&(e=r.constructor.name),e==="Map"||e==="Set")return Array.from(r);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return z(r,t)}}f(te,"_unsupportedIterableToArray");function z(r,t){(t==null||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}f(z,"_arrayLikeToArray");function ee(r,t){var e=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(e!=null){var n=[],o=!0,s=!1,u,i;try{for(e=e.call(r);!(o=(u=e.next()).done)&&(n.push(u.value),!(t&&n.length===t));o=!0);}catch(a){s=!0,i=a}finally{try{!o&&e.return!=null&&e.return()}finally{if(s)throw i}}return n}}f(ee,"_iterableToArrayLimit");function ne(r){if(Array.isArray(r))return r}f(ne,"_arrayWithHoles");var J=new nt(global),re=J.fn.bind(J),ie=Lt({action:re},{retain:!0}),oe=ie.action,rt=X.getChannel(),$=[];rt.on(j,function(){return $.forEach(function(r){var t;return r==null||(t=r.mockClear)===null||t===void 0?void 0:t.call(r)})});rt.on(Q,function(r){var t=r.newPhase;t==="loading"&&$.forEach(function(e){var n;return e==null||(n=e.mockClear)===null||n===void 0?void 0:n.call(e)})});var se=f(function(t){var e=t.id,n=t.initialArgs;return Object.entries(n).reduce(function(o,s){var u=qt(s,2),i=u[0],a=u[1];return typeof a=="function"&&a.name==="actionHandler"?(Object.defineProperty(a,"name",{value:i,writable:!1}),Object.defineProperty(a,"__storyId__",{value:e,writable:!1}),o[i]=oe(a),$.push(o[i]),o):(o[i]=a,o)},{})},"addActionsFromArgTypes"),ce=[se];export{ce as argsEnhancers};
//# sourceMappingURL=preview.ae58cafd.js.map