@storybook/addon-interactions 8.0.0-alpha.1 → 8.0.0-alpha.10

Sign up to get free protection for your applications and to get access to all the features.
package/dist/manager.js CHANGED
@@ -3,7 +3,7 @@ import React10__default, { memo, useState, useRef, useEffect, useMemo, Fragment,
3
3
  import { useAddonState, useChannel, useParameter, addons, types, Consumer } from '@storybook/manager-api';
4
4
  import { Button, TooltipNote, IconButton, Separator, P, Icons, Placeholder, Link, AddonPanel, Bar, WithTooltip, Spaced, Badge } from '@storybook/components';
5
5
  import '@storybook/client-logger';
6
- import { STORY_RENDER_PHASE_CHANGED, STORY_THREW_EXCEPTION, PLAY_FUNCTION_THREW_EXCEPTION, IGNORED_EXCEPTION, FORCE_REMOUNT } from '@storybook/core-events';
6
+ import { STORY_RENDER_PHASE_CHANGED, STORY_THREW_EXCEPTION, PLAY_FUNCTION_THREW_EXCEPTION, UNHANDLED_ERRORS_WHILE_PLAYING, FORCE_REMOUNT } from '@storybook/core-events';
7
7
  import { global } from '@storybook/global';
8
8
  import { styled, typography, useTheme as useTheme$1 } from '@storybook/theming';
9
9
  import { transparentize } from 'polished';
@@ -16,6 +16,6 @@ ${indentationNext}`)},{edgeSpacing:config.spacingOuter,min:config.min,spacing:co
16
16
  `});function createIndent(indent){return new Array(indent+1).join(" ")}function format3(val,options){if(options&&(validateOptions(options),options.plugins)){let plugin=findPlugin(options.plugins,val);if(plugin!==null)return printPlugin(plugin,val,getConfig(options),"",0,[])}let basicResult=printBasicValue(val,getPrintFunctionName(options),getEscapeRegex(options),getEscapeString(options));return basicResult!==null?basicResult:printComplexValue(val,getConfig(options),"",0,[])}var plugins3={AsymmetricMatcher:_AsymmetricMatcher.default,DOMCollection:_DOMCollection.default,DOMElement:_DOMElement.default,Immutable:_Immutable.default,ReactElement:_ReactElement.default,ReactTestComponent:_ReactTestComponent.default};exports.plugins=plugins3;var _default=format3;exports.default=_default;}}),require_build2=__commonJS2({"../../node_modules/diff-sequences/build/index.js"(exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=diffSequence;var pkg="diff-sequences",NOT_YET_SET=0,countCommonItemsF=(aIndex,aEnd,bIndex,bEnd,isCommon)=>{let nCommon=0;for(;aIndex<aEnd&&bIndex<bEnd&&isCommon(aIndex,bIndex);)aIndex+=1,bIndex+=1,nCommon+=1;return nCommon},countCommonItemsR=(aStart,aIndex,bStart,bIndex,isCommon)=>{let nCommon=0;for(;aStart<=aIndex&&bStart<=bIndex&&isCommon(aIndex,bIndex);)aIndex-=1,bIndex-=1,nCommon+=1;return nCommon},extendPathsF=(d,aEnd,bEnd,bF,isCommon,aIndexesF,iMaxF)=>{let iF=0,kF=-d,aFirst=aIndexesF[iF],aIndexPrev1=aFirst;aIndexesF[iF]+=countCommonItemsF(aFirst+1,aEnd,bF+aFirst-kF+1,bEnd,isCommon);let nF=d<iMaxF?d:iMaxF;for(iF+=1,kF+=2;iF<=nF;iF+=1,kF+=2){if(iF!==d&&aIndexPrev1<aIndexesF[iF])aFirst=aIndexesF[iF];else if(aFirst=aIndexPrev1+1,aEnd<=aFirst)return iF-1;aIndexPrev1=aIndexesF[iF],aIndexesF[iF]=aFirst+countCommonItemsF(aFirst+1,aEnd,bF+aFirst-kF+1,bEnd,isCommon);}return iMaxF},extendPathsR=(d,aStart,bStart,bR,isCommon,aIndexesR,iMaxR)=>{let iR=0,kR=d,aFirst=aIndexesR[iR],aIndexPrev1=aFirst;aIndexesR[iR]-=countCommonItemsR(aStart,aFirst-1,bStart,bR+aFirst-kR-1,isCommon);let nR=d<iMaxR?d:iMaxR;for(iR+=1,kR-=2;iR<=nR;iR+=1,kR-=2){if(iR!==d&&aIndexesR[iR]<aIndexPrev1)aFirst=aIndexesR[iR];else if(aFirst=aIndexPrev1-1,aFirst<aStart)return iR-1;aIndexPrev1=aIndexesR[iR],aIndexesR[iR]=aFirst-countCommonItemsR(aStart,aFirst-1,bStart,bR+aFirst-kR-1,isCommon);}return iMaxR},extendOverlappablePathsF=(d,aStart,aEnd,bStart,bEnd,isCommon,aIndexesF,iMaxF,aIndexesR,iMaxR,division)=>{let bF=bStart-aStart,aLength=aEnd-aStart,baDeltaLength=bEnd-bStart-aLength,kMinOverlapF=-baDeltaLength-(d-1),kMaxOverlapF=-baDeltaLength+(d-1),aIndexPrev1=NOT_YET_SET,nF=d<iMaxF?d:iMaxF;for(let iF=0,kF=-d;iF<=nF;iF+=1,kF+=2){let insert=iF===0||iF!==d&&aIndexPrev1<aIndexesF[iF],aLastPrev=insert?aIndexesF[iF]:aIndexPrev1,aFirst=insert?aLastPrev:aLastPrev+1,bFirst=bF+aFirst-kF,nCommonF=countCommonItemsF(aFirst+1,aEnd,bFirst+1,bEnd,isCommon),aLast=aFirst+nCommonF;if(aIndexPrev1=aIndexesF[iF],aIndexesF[iF]=aLast,kMinOverlapF<=kF&&kF<=kMaxOverlapF){let iR=(d-1-(kF+baDeltaLength))/2;if(iR<=iMaxR&&aIndexesR[iR]-1<=aLast){let bLastPrev=bF+aLastPrev-(insert?kF+1:kF-1),nCommonR=countCommonItemsR(aStart,aLastPrev,bStart,bLastPrev,isCommon),aIndexPrevFirst=aLastPrev-nCommonR,bIndexPrevFirst=bLastPrev-nCommonR,aEndPreceding=aIndexPrevFirst+1,bEndPreceding=bIndexPrevFirst+1;division.nChangePreceding=d-1,d-1===aEndPreceding+bEndPreceding-aStart-bStart?(division.aEndPreceding=aStart,division.bEndPreceding=bStart):(division.aEndPreceding=aEndPreceding,division.bEndPreceding=bEndPreceding),division.nCommonPreceding=nCommonR,nCommonR!==0&&(division.aCommonPreceding=aEndPreceding,division.bCommonPreceding=bEndPreceding),division.nCommonFollowing=nCommonF,nCommonF!==0&&(division.aCommonFollowing=aFirst+1,division.bCommonFollowing=bFirst+1);let aStartFollowing=aLast+1,bStartFollowing=bFirst+nCommonF+1;return division.nChangeFollowing=d-1,d-1===aEnd+bEnd-aStartFollowing-bStartFollowing?(division.aStartFollowing=aEnd,division.bStartFollowing=bEnd):(division.aStartFollowing=aStartFollowing,division.bStartFollowing=bStartFollowing),!0}}}return !1},extendOverlappablePathsR=(d,aStart,aEnd,bStart,bEnd,isCommon,aIndexesF,iMaxF,aIndexesR,iMaxR,division)=>{let bR=bEnd-aEnd,aLength=aEnd-aStart,baDeltaLength=bEnd-bStart-aLength,kMinOverlapR=baDeltaLength-d,kMaxOverlapR=baDeltaLength+d,aIndexPrev1=NOT_YET_SET,nR=d<iMaxR?d:iMaxR;for(let iR=0,kR=d;iR<=nR;iR+=1,kR-=2){let insert=iR===0||iR!==d&&aIndexesR[iR]<aIndexPrev1,aLastPrev=insert?aIndexesR[iR]:aIndexPrev1,aFirst=insert?aLastPrev:aLastPrev-1,bFirst=bR+aFirst-kR,nCommonR=countCommonItemsR(aStart,aFirst-1,bStart,bFirst-1,isCommon),aLast=aFirst-nCommonR;if(aIndexPrev1=aIndexesR[iR],aIndexesR[iR]=aLast,kMinOverlapR<=kR&&kR<=kMaxOverlapR){let iF=(d+(kR-baDeltaLength))/2;if(iF<=iMaxF&&aLast-1<=aIndexesF[iF]){let bLast=bFirst-nCommonR;if(division.nChangePreceding=d,d===aLast+bLast-aStart-bStart?(division.aEndPreceding=aStart,division.bEndPreceding=bStart):(division.aEndPreceding=aLast,division.bEndPreceding=bLast),division.nCommonPreceding=nCommonR,nCommonR!==0&&(division.aCommonPreceding=aLast,division.bCommonPreceding=bLast),division.nChangeFollowing=d-1,d===1)division.nCommonFollowing=0,division.aStartFollowing=aEnd,division.bStartFollowing=bEnd;else {let bLastPrev=bR+aLastPrev-(insert?kR-1:kR+1),nCommonF=countCommonItemsF(aLastPrev,aEnd,bLastPrev,bEnd,isCommon);division.nCommonFollowing=nCommonF,nCommonF!==0&&(division.aCommonFollowing=aLastPrev,division.bCommonFollowing=bLastPrev);let aStartFollowing=aLastPrev+nCommonF,bStartFollowing=bLastPrev+nCommonF;d-1===aEnd+bEnd-aStartFollowing-bStartFollowing?(division.aStartFollowing=aEnd,division.bStartFollowing=bEnd):(division.aStartFollowing=aStartFollowing,division.bStartFollowing=bStartFollowing);}return !0}}}return !1},divide=(nChange,aStart,aEnd,bStart,bEnd,isCommon,aIndexesF,aIndexesR,division)=>{let bF=bStart-aStart,bR=bEnd-aEnd,aLength=aEnd-aStart,bLength=bEnd-bStart,baDeltaLength=bLength-aLength,iMaxF=aLength,iMaxR=aLength;if(aIndexesF[0]=aStart-1,aIndexesR[0]=aEnd,baDeltaLength%2===0){let dMin=(nChange||baDeltaLength)/2,dMax=(aLength+bLength)/2;for(let d=1;d<=dMax;d+=1)if(iMaxF=extendPathsF(d,aEnd,bEnd,bF,isCommon,aIndexesF,iMaxF),d<dMin)iMaxR=extendPathsR(d,aStart,bStart,bR,isCommon,aIndexesR,iMaxR);else if(extendOverlappablePathsR(d,aStart,aEnd,bStart,bEnd,isCommon,aIndexesF,iMaxF,aIndexesR,iMaxR,division))return}else {let dMin=((nChange||baDeltaLength)+1)/2,dMax=(aLength+bLength+1)/2,d=1;for(iMaxF=extendPathsF(d,aEnd,bEnd,bF,isCommon,aIndexesF,iMaxF),d+=1;d<=dMax;d+=1)if(iMaxR=extendPathsR(d-1,aStart,bStart,bR,isCommon,aIndexesR,iMaxR),d<dMin)iMaxF=extendPathsF(d,aEnd,bEnd,bF,isCommon,aIndexesF,iMaxF);else if(extendOverlappablePathsF(d,aStart,aEnd,bStart,bEnd,isCommon,aIndexesF,iMaxF,aIndexesR,iMaxR,division))return}throw new Error(`${pkg}: no overlap aStart=${aStart} aEnd=${aEnd} bStart=${bStart} bEnd=${bEnd}`)},findSubsequences=(nChange,aStart,aEnd,bStart,bEnd,transposed,callbacks,aIndexesF,aIndexesR,division)=>{if(bEnd-bStart<aEnd-aStart){if(transposed=!transposed,transposed&&callbacks.length===1){let{foundSubsequence:foundSubsequence2,isCommon:isCommon2}=callbacks[0];callbacks[1]={foundSubsequence:(nCommon,bCommon,aCommon)=>{foundSubsequence2(nCommon,aCommon,bCommon);},isCommon:(bIndex,aIndex)=>isCommon2(aIndex,bIndex)};}let tStart=aStart,tEnd=aEnd;aStart=bStart,aEnd=bEnd,bStart=tStart,bEnd=tEnd;}let{foundSubsequence,isCommon}=callbacks[transposed?1:0];divide(nChange,aStart,aEnd,bStart,bEnd,isCommon,aIndexesF,aIndexesR,division);let{nChangePreceding,aEndPreceding,bEndPreceding,nCommonPreceding,aCommonPreceding,bCommonPreceding,nCommonFollowing,aCommonFollowing,bCommonFollowing,nChangeFollowing,aStartFollowing,bStartFollowing}=division;aStart<aEndPreceding&&bStart<bEndPreceding&&findSubsequences(nChangePreceding,aStart,aEndPreceding,bStart,bEndPreceding,transposed,callbacks,aIndexesF,aIndexesR,division),nCommonPreceding!==0&&foundSubsequence(nCommonPreceding,aCommonPreceding,bCommonPreceding),nCommonFollowing!==0&&foundSubsequence(nCommonFollowing,aCommonFollowing,bCommonFollowing),aStartFollowing<aEnd&&bStartFollowing<bEnd&&findSubsequences(nChangeFollowing,aStartFollowing,aEnd,bStartFollowing,bEnd,transposed,callbacks,aIndexesF,aIndexesR,division);},validateLength=(name,arg)=>{if(typeof arg!="number")throw new TypeError(`${pkg}: ${name} typeof ${typeof arg} is not a number`);if(!Number.isSafeInteger(arg))throw new RangeError(`${pkg}: ${name} value ${arg} is not a safe integer`);if(arg<0)throw new RangeError(`${pkg}: ${name} value ${arg} is a negative integer`)},validateCallback=(name,arg)=>{let type=typeof arg;if(type!=="function")throw new TypeError(`${pkg}: ${name} typeof ${type} is not a function`)};function diffSequence(aLength,bLength,isCommon,foundSubsequence){validateLength("aLength",aLength),validateLength("bLength",bLength),validateCallback("isCommon",isCommon),validateCallback("foundSubsequence",foundSubsequence);let nCommonF=countCommonItemsF(0,aLength,0,bLength,isCommon);if(nCommonF!==0&&foundSubsequence(nCommonF,0,0),aLength!==nCommonF||bLength!==nCommonF){let aStart=nCommonF,bStart=nCommonF,nCommonR=countCommonItemsR(aStart,aLength-1,bStart,bLength-1,isCommon),aEnd=aLength-nCommonR,bEnd=bLength-nCommonR,nCommonFR=nCommonF+nCommonR;aLength!==nCommonFR&&bLength!==nCommonFR&&findSubsequences(0,aStart,aEnd,bStart,bEnd,!1,[{foundSubsequence,isCommon}],[NOT_YET_SET],[NOT_YET_SET],{aCommonFollowing:NOT_YET_SET,aCommonPreceding:NOT_YET_SET,aEndPreceding:NOT_YET_SET,aStartFollowing:NOT_YET_SET,bCommonFollowing:NOT_YET_SET,bCommonPreceding:NOT_YET_SET,bEndPreceding:NOT_YET_SET,bStartFollowing:NOT_YET_SET,nChangeFollowing:NOT_YET_SET,nChangePreceding:NOT_YET_SET,nCommonFollowing:NOT_YET_SET,nCommonPreceding:NOT_YET_SET}),nCommonR!==0&&foundSubsequence(nCommonR,aEnd,bEnd);}}}}),require_loupe=__commonJS2({"../../node_modules/loupe/loupe.js"(exports,module){(function(global22,factory){typeof exports=="object"&&typeof module<"u"?factory(exports):typeof define=="function"&&define.amd?define(["exports"],factory):(global22=typeof globalThis<"u"?globalThis:global22||self,factory(global22.loupe={}));})(exports,function(exports2){function _typeof(obj){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof=function(obj2){return typeof obj2}:_typeof=function(obj2){return obj2&&typeof Symbol=="function"&&obj2.constructor===Symbol&&obj2!==Symbol.prototype?"symbol":typeof obj2},_typeof(obj)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _iterableToArrayLimit(arr,i){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(arr)))){var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!(i&&_arr.length===i));_n=!0);}catch(err){_d=!0,_e=err;}finally{try{!_n&&_i.return!=null&&_i.return();}finally{if(_d)throw _e}}return _arr}}function _unsupportedIterableToArray(o,minLen){if(o){if(typeof o=="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor&&(n=o.constructor.name),n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}}function _arrayLikeToArray(arr,len){(len==null||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _nonIterableRest(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
17
17
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var ansiColors={bold:["1","22"],dim:["2","22"],italic:["3","23"],underline:["4","24"],inverse:["7","27"],hidden:["8","28"],strike:["9","29"],black:["30","39"],red:["31","39"],green:["32","39"],yellow:["33","39"],blue:["34","39"],magenta:["35","39"],cyan:["36","39"],white:["37","39"],brightblack:["30;1","39"],brightred:["31;1","39"],brightgreen:["32;1","39"],brightyellow:["33;1","39"],brightblue:["34;1","39"],brightmagenta:["35;1","39"],brightcyan:["36;1","39"],brightwhite:["37;1","39"],grey:["90","39"]},styles={special:"cyan",number:"yellow",bigint:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",symbol:"green",date:"magenta",regexp:"red"},truncator="\u2026";function colorise(value,styleType){var color=ansiColors[styles[styleType]]||ansiColors[styleType];return color?"\x1B[".concat(color[0],"m").concat(String(value),"\x1B[").concat(color[1],"m"):String(value)}function normaliseOptions(){var _ref=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},_ref$showHidden=_ref.showHidden,showHidden=_ref$showHidden===void 0?!1:_ref$showHidden,_ref$depth=_ref.depth,depth=_ref$depth===void 0?2:_ref$depth,_ref$colors=_ref.colors,colors2=_ref$colors===void 0?!1:_ref$colors,_ref$customInspect=_ref.customInspect,customInspect=_ref$customInspect===void 0?!0:_ref$customInspect,_ref$showProxy=_ref.showProxy,showProxy=_ref$showProxy===void 0?!1:_ref$showProxy,_ref$maxArrayLength=_ref.maxArrayLength,maxArrayLength=_ref$maxArrayLength===void 0?1/0:_ref$maxArrayLength,_ref$breakLength=_ref.breakLength,breakLength=_ref$breakLength===void 0?1/0:_ref$breakLength,_ref$seen=_ref.seen,seen=_ref$seen===void 0?[]:_ref$seen,_ref$truncate=_ref.truncate,truncate2=_ref$truncate===void 0?1/0:_ref$truncate,_ref$stylize=_ref.stylize,stylize=_ref$stylize===void 0?String:_ref$stylize,options={showHidden:!!showHidden,depth:Number(depth),colors:!!colors2,customInspect:!!customInspect,showProxy:!!showProxy,maxArrayLength:Number(maxArrayLength),breakLength:Number(breakLength),truncate:Number(truncate2),seen,stylize};return options.colors&&(options.stylize=colorise),options}function truncate(string2,length){var tail=arguments.length>2&&arguments[2]!==void 0?arguments[2]:truncator;string2=String(string2);var tailLength=tail.length,stringLength=string2.length;return tailLength>length&&stringLength>tailLength?tail:stringLength>length&&stringLength>tailLength?"".concat(string2.slice(0,length-tailLength)).concat(tail):string2}function inspectList(list,options,inspectItem){var separator=arguments.length>3&&arguments[3]!==void 0?arguments[3]:", ";inspectItem=inspectItem||options.inspect;var size=list.length;if(size===0)return "";for(var originalLength=options.truncate,output="",peek="",truncated="",i=0;i<size;i+=1){var last=i+1===list.length,secondToLast=i+2===list.length;truncated="".concat(truncator,"(").concat(list.length-i,")");var value=list[i];options.truncate=originalLength-output.length-(last?0:separator.length);var string2=peek||inspectItem(value,options)+(last?"":separator),nextLength=output.length+string2.length,truncatedLength=nextLength+truncated.length;if(last&&nextLength>originalLength&&output.length+truncated.length<=originalLength||!last&&!secondToLast&&truncatedLength>originalLength||(peek=last?"":inspectItem(list[i+1],options)+(secondToLast?"":separator),!last&&secondToLast&&truncatedLength>originalLength&&nextLength+peek.length>originalLength))break;if(output+=string2,!last&&!secondToLast&&nextLength+peek.length>=originalLength){truncated="".concat(truncator,"(").concat(list.length-i-1,")");break}truncated="";}return "".concat(output).concat(truncated)}function quoteComplexKey(key){return key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)?key:JSON.stringify(key).replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'")}function inspectProperty(_ref2,options){var _ref3=_slicedToArray(_ref2,2),key=_ref3[0],value=_ref3[1];return options.truncate-=2,typeof key=="string"?key=quoteComplexKey(key):typeof key!="number"&&(key="[".concat(options.inspect(key,options),"]")),options.truncate-=key.length,value=options.inspect(value,options),"".concat(key,": ").concat(value)}function inspectArray(array,options){var nonIndexProperties=Object.keys(array).slice(array.length);if(!array.length&&!nonIndexProperties.length)return "[]";options.truncate-=4;var listContents=inspectList(array,options);options.truncate-=listContents.length;var propertyContents="";return nonIndexProperties.length&&(propertyContents=inspectList(nonIndexProperties.map(function(key){return [key,array[key]]}),options,inspectProperty)),"[ ".concat(listContents).concat(propertyContents?", ".concat(propertyContents):""," ]")}var toString=Function.prototype.toString,functionNameMatch=/\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/,maxFunctionSourceLength=512;function getFuncName(aFunc){if(typeof aFunc!="function")return null;var name="";if(typeof Function.prototype.name>"u"&&typeof aFunc.name>"u"){var functionSource=toString.call(aFunc);if(functionSource.indexOf("(")>maxFunctionSourceLength)return name;var match=functionSource.match(functionNameMatch);match&&(name=match[1]);}else name=aFunc.name;return name}var getFuncName_1=getFuncName,getArrayName=function(array){return typeof Buffer=="function"&&array instanceof Buffer?"Buffer":array[Symbol.toStringTag]?array[Symbol.toStringTag]:getFuncName_1(array.constructor)};function inspectTypedArray(array,options){var name=getArrayName(array);options.truncate-=name.length+4;var nonIndexProperties=Object.keys(array).slice(array.length);if(!array.length&&!nonIndexProperties.length)return "".concat(name,"[]");for(var output="",i=0;i<array.length;i++){var string2="".concat(options.stylize(truncate(array[i],options.truncate),"number")).concat(i===array.length-1?"":", ");if(options.truncate-=string2.length,array[i]!==array.length&&options.truncate<=3){output+="".concat(truncator,"(").concat(array.length-array[i]+1,")");break}output+=string2;}var propertyContents="";return nonIndexProperties.length&&(propertyContents=inspectList(nonIndexProperties.map(function(key){return [key,array[key]]}),options,inspectProperty)),"".concat(name,"[ ").concat(output).concat(propertyContents?", ".concat(propertyContents):""," ]")}function inspectDate(dateObject,options){var stringRepresentation=dateObject.toJSON();if(stringRepresentation===null)return "Invalid Date";var split=stringRepresentation.split("T"),date=split[0];return options.stylize("".concat(date,"T").concat(truncate(split[1],options.truncate-date.length-1)),"date")}function inspectFunction(func,options){var name=getFuncName_1(func);return name?options.stylize("[Function ".concat(truncate(name,options.truncate-11),"]"),"special"):options.stylize("[Function]","special")}function inspectMapEntry(_ref,options){var _ref2=_slicedToArray(_ref,2),key=_ref2[0],value=_ref2[1];return options.truncate-=4,key=options.inspect(key,options),options.truncate-=key.length,value=options.inspect(value,options),"".concat(key," => ").concat(value)}function mapToEntries(map){var entries=[];return map.forEach(function(value,key){entries.push([key,value]);}),entries}function inspectMap(map,options){var size=map.size-1;return size<=0?"Map{}":(options.truncate-=7,"Map{ ".concat(inspectList(mapToEntries(map),options,inspectMapEntry)," }"))}var isNaN2=Number.isNaN||function(i){return i!==i};function inspectNumber(number,options){return isNaN2(number)?options.stylize("NaN","number"):number===1/0?options.stylize("Infinity","number"):number===-1/0?options.stylize("-Infinity","number"):number===0?options.stylize(1/number===1/0?"+0":"-0","number"):options.stylize(truncate(number,options.truncate),"number")}function inspectBigInt(number,options){var nums=truncate(number.toString(),options.truncate-1);return nums!==truncator&&(nums+="n"),options.stylize(nums,"bigint")}function inspectRegExp(value,options){var flags=value.toString().split("/")[2],sourceLength=options.truncate-(2+flags.length),source=value.source;return options.stylize("/".concat(truncate(source,sourceLength),"/").concat(flags),"regexp")}function arrayFromSet(set){var values=[];return set.forEach(function(value){values.push(value);}),values}function inspectSet(set,options){return set.size===0?"Set{}":(options.truncate-=7,"Set{ ".concat(inspectList(arrayFromSet(set),options)," }"))}var stringEscapeChars=new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]","g"),escapeCharacters={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","'":"\\'","\\":"\\\\"},hex=16,unicodeLength=4;function escape(char){return escapeCharacters[char]||"\\u".concat("0000".concat(char.charCodeAt(0).toString(hex)).slice(-unicodeLength))}function inspectString(string2,options){return stringEscapeChars.test(string2)&&(string2=string2.replace(stringEscapeChars,escape)),options.stylize("'".concat(truncate(string2,options.truncate-2),"'"),"string")}function inspectSymbol(value){return "description"in Symbol.prototype?value.description?"Symbol(".concat(value.description,")"):"Symbol()":value.toString()}var getPromiseValue=function(){return "Promise{\u2026}"};try{var _process$binding=process.binding("util"),getPromiseDetails=_process$binding.getPromiseDetails,kPending=_process$binding.kPending,kRejected=_process$binding.kRejected;Array.isArray(getPromiseDetails(Promise.resolve()))&&(getPromiseValue=function(value,options){var _getPromiseDetails=getPromiseDetails(value),_getPromiseDetails2=_slicedToArray(_getPromiseDetails,2),state=_getPromiseDetails2[0],innerValue=_getPromiseDetails2[1];return state===kPending?"Promise{<pending>}":"Promise".concat(state===kRejected?"!":"","{").concat(options.inspect(innerValue,options),"}")});}catch{}var inspectPromise=getPromiseValue;function inspectObject(object,options){var properties=Object.getOwnPropertyNames(object),symbols=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(object):[];if(properties.length===0&&symbols.length===0)return "{}";if(options.truncate-=4,options.seen=options.seen||[],options.seen.indexOf(object)>=0)return "[Circular]";options.seen.push(object);var propertyContents=inspectList(properties.map(function(key){return [key,object[key]]}),options,inspectProperty),symbolContents=inspectList(symbols.map(function(key){return [key,object[key]]}),options,inspectProperty);options.seen.pop();var sep="";return propertyContents&&symbolContents&&(sep=", "),"{ ".concat(propertyContents).concat(sep).concat(symbolContents," }")}var toStringTag=typeof Symbol<"u"&&Symbol.toStringTag?Symbol.toStringTag:!1;function inspectClass(value,options){var name="";return toStringTag&&toStringTag in value&&(name=value[toStringTag]),name=name||getFuncName_1(value.constructor),(!name||name==="_class")&&(name="<Anonymous Class>"),options.truncate-=name.length,"".concat(name).concat(inspectObject(value,options))}function inspectArguments(args,options){return args.length===0?"Arguments[]":(options.truncate-=13,"Arguments[ ".concat(inspectList(args,options)," ]"))}var errorKeys=["stack","line","column","name","message","fileName","lineNumber","columnNumber","number","description"];function inspectObject$1(error,options){var properties=Object.getOwnPropertyNames(error).filter(function(key){return errorKeys.indexOf(key)===-1}),name=error.name;options.truncate-=name.length;var message="";typeof error.message=="string"?message=truncate(error.message,options.truncate):properties.unshift("message"),message=message?": ".concat(message):"",options.truncate-=message.length+5;var propertyContents=inspectList(properties.map(function(key){return [key,error[key]]}),options,inspectProperty);return "".concat(name).concat(message).concat(propertyContents?" { ".concat(propertyContents," }"):"")}function inspectAttribute(_ref,options){var _ref2=_slicedToArray(_ref,2),key=_ref2[0],value=_ref2[1];return options.truncate-=3,value?"".concat(options.stylize(key,"yellow"),"=").concat(options.stylize('"'.concat(value,'"'),"string")):"".concat(options.stylize(key,"yellow"))}function inspectHTMLCollection(collection,options){return inspectList(collection,options,inspectHTML,`
18
18
  `)}function inspectHTML(element,options){var properties=element.getAttributeNames(),name=element.tagName.toLowerCase(),head=options.stylize("<".concat(name),"special"),headClose=options.stylize(">","special"),tail=options.stylize("</".concat(name,">"),"special");options.truncate-=name.length*2+5;var propertyContents="";properties.length>0&&(propertyContents+=" ",propertyContents+=inspectList(properties.map(function(key){return [key,element.getAttribute(key)]}),options,inspectAttribute," ")),options.truncate-=propertyContents.length;var truncate2=options.truncate,children=inspectHTMLCollection(element.children,options);return children&&children.length>truncate2&&(children="".concat(truncator,"(").concat(element.children.length,")")),"".concat(head).concat(propertyContents).concat(headClose).concat(children).concat(tail)}var symbolsSupported=typeof Symbol=="function"&&typeof Symbol.for=="function",chaiInspect=symbolsSupported?Symbol.for("chai/inspect"):"@@chai/inspect",nodeInspect=!1;try{var nodeUtil=__require2("util");nodeInspect=nodeUtil.inspect?nodeUtil.inspect.custom:!1;}catch{nodeInspect=!1;}function FakeMap(){this.key="chai/loupe__"+Math.random()+Date.now();}FakeMap.prototype={get:function(key){return key[this.key]},has:function(key){return this.key in key},set:function(key,value){Object.isExtensible(key)&&Object.defineProperty(key,this.key,{value,configurable:!0});}};var constructorMap=new(typeof WeakMap=="function"?WeakMap:FakeMap),stringTagMap={},baseTypesMap={undefined:function(value,options){return options.stylize("undefined","undefined")},null:function(value,options){return options.stylize(null,"null")},boolean:function(value,options){return options.stylize(value,"boolean")},Boolean:function(value,options){return options.stylize(value,"boolean")},number:inspectNumber,Number:inspectNumber,bigint:inspectBigInt,BigInt:inspectBigInt,string:inspectString,String:inspectString,function:inspectFunction,Function:inspectFunction,symbol:inspectSymbol,Symbol:inspectSymbol,Array:inspectArray,Date:inspectDate,Map:inspectMap,Set:inspectSet,RegExp:inspectRegExp,Promise:inspectPromise,WeakSet:function(value,options){return options.stylize("WeakSet{\u2026}","special")},WeakMap:function(value,options){return options.stylize("WeakMap{\u2026}","special")},Arguments:inspectArguments,Int8Array:inspectTypedArray,Uint8Array:inspectTypedArray,Uint8ClampedArray:inspectTypedArray,Int16Array:inspectTypedArray,Uint16Array:inspectTypedArray,Int32Array:inspectTypedArray,Uint32Array:inspectTypedArray,Float32Array:inspectTypedArray,Float64Array:inspectTypedArray,Generator:function(){return ""},DataView:function(){return ""},ArrayBuffer:function(){return ""},Error:inspectObject$1,HTMLCollection:inspectHTMLCollection,NodeList:inspectHTMLCollection},inspectCustom=function(value,options,type){return chaiInspect in value&&typeof value[chaiInspect]=="function"?value[chaiInspect](options):nodeInspect&&nodeInspect in value&&typeof value[nodeInspect]=="function"?value[nodeInspect](options.depth,options):"inspect"in value&&typeof value.inspect=="function"?value.inspect(options.depth,options):"constructor"in value&&constructorMap.has(value.constructor)?constructorMap.get(value.constructor)(value,options):stringTagMap[type]?stringTagMap[type](value,options):""},toString$1=Object.prototype.toString;function inspect2(value,options){options=normaliseOptions(options),options.inspect=inspect2;var _options=options,customInspect=_options.customInspect,type=value===null?"null":_typeof(value);if(type==="object"&&(type=toString$1.call(value).slice(8,-1)),baseTypesMap[type])return baseTypesMap[type](value,options);if(customInspect&&value){var output=inspectCustom(value,options,type);if(output)return typeof output=="string"?output:inspect2(output,options)}var proto=value?Object.getPrototypeOf(value):!1;return proto===Object.prototype||proto===null?inspectObject(value,options):value&&typeof HTMLElement=="function"&&value instanceof HTMLElement?inspectHTML(value,options):"constructor"in value?value.constructor!==Object?inspectClass(value,options):inspectObject(value,options):value===Object(value)?inspectObject(value,options):options.stylize(String(value),type)}function registerConstructor(constructor,inspector){return constructorMap.has(constructor)?!1:(constructorMap.set(constructor,inspector),!0)}function registerStringTag(stringTag,inspector){return stringTag in stringTagMap?!1:(stringTagMap[stringTag]=inspector,!0)}var custom=chaiInspect;exports2.custom=custom,exports2.default=inspect2,exports2.inspect=inspect2,exports2.registerConstructor=registerConstructor,exports2.registerStringTag=registerStringTag,Object.defineProperty(exports2,"__esModule",{value:!0});});}}),import_pretty_format=__toESM2(require_build(),1);__toESM2(require_build2(),1);var colorsMap={bold:["\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"],dim:["\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"],italic:["\x1B[3m","\x1B[23m"],underline:["\x1B[4m","\x1B[24m"],inverse:["\x1B[7m","\x1B[27m"],hidden:["\x1B[8m","\x1B[28m"],strikethrough:["\x1B[9m","\x1B[29m"],black:["\x1B[30m","\x1B[39m"],red:["\x1B[31m","\x1B[39m"],green:["\x1B[32m","\x1B[39m"],yellow:["\x1B[33m","\x1B[39m"],blue:["\x1B[34m","\x1B[39m"],magenta:["\x1B[35m","\x1B[39m"],cyan:["\x1B[36m","\x1B[39m"],white:["\x1B[37m","\x1B[39m"],gray:["\x1B[90m","\x1B[39m"],bgBlack:["\x1B[40m","\x1B[49m"],bgRed:["\x1B[41m","\x1B[49m"],bgGreen:["\x1B[42m","\x1B[49m"],bgYellow:["\x1B[43m","\x1B[49m"],bgBlue:["\x1B[44m","\x1B[49m"],bgMagenta:["\x1B[45m","\x1B[49m"],bgCyan:["\x1B[46m","\x1B[49m"],bgWhite:["\x1B[47m","\x1B[49m"]},colorsEntries=Object.entries(colorsMap);function string(str){return String(str)}string.open="";string.close="";colorsEntries.reduce((acc,[key])=>(acc[key]=string,acc),{isColorSupported:!1});import_pretty_format.plugins;var import_pretty_format2=__toESM2(require_build(),1);__toESM2(require_loupe(),1);import_pretty_format2.plugins;__toESM2(require_build(),1);__toESM2(require_build2(),1);__toESM2(require_loupe(),1);var CallStates=(CallStates2=>(CallStates2.DONE="done",CallStates2.ERROR="error",CallStates2.ACTIVE="active",CallStates2.WAITING="waiting",CallStates2))(CallStates||{}),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"};var ADDON_ID="storybook/interactions",PANEL_ID=`${ADDON_ID}/panel`;var StyledBadge=styled.div(({theme:theme2,status})=>({padding:"4px 6px 4px 8px;",borderRadius:"4px",backgroundColor:{[CallStates.DONE]:theme2.color.positive,[CallStates.ERROR]:theme2.color.negative,[CallStates.ACTIVE]:theme2.color.warning,[CallStates.WAITING]:theme2.color.warning}[status],color:"white",fontFamily:typography.fonts.base,textTransform:"uppercase",fontSize:typography.size.s1,letterSpacing:3,fontWeight:typography.weight.bold,width:65,textAlign:"center"})),StatusBadge=({status})=>{let badgeText={[CallStates.DONE]:"Pass",[CallStates.ERROR]:"Fail",[CallStates.ACTIVE]:"Runs",[CallStates.WAITING]:"Runs"}[status];return React10__default.createElement(StyledBadge,{"aria-label":"Status of the test run",status},badgeText)};var SubnavWrapper=styled.div(({theme:theme2})=>({background:theme2.background.app,borderBottom:`1px solid ${theme2.appBorderColor}`,position:"sticky",top:0,zIndex:1})),StyledSubnav=styled.nav(({theme:theme2})=>({height:40,display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:15})),StyledButton=styled(Button)(({theme:theme2})=>({borderRadius:4,padding:6,color:theme2.textMutedColor,"&:not(:disabled)":{"&:hover,&:focus-visible":{color:theme2.color.secondary}}})),Note=styled(TooltipNote)(({theme:theme2})=>({fontFamily:theme2.typography.fonts.base})),StyledIconButton=styled(IconButton)(({theme:theme2})=>({color:theme2.textMutedColor,margin:"0 3px"})),StyledSeparator=styled(Separator)({marginTop:0}),StyledLocation=styled(P)(({theme:theme2})=>({color:theme2.textMutedColor,justifyContent:"flex-end",textAlign:"right",whiteSpace:"nowrap",marginTop:"auto",marginBottom:1,paddingRight:15,fontSize:13})),Group=styled.div({display:"flex",alignItems:"center"}),RewindButton=styled(StyledIconButton)({marginLeft:9}),JumpToEndButton=styled(StyledButton)({marginLeft:9,marginRight:9,marginBottom:1,lineHeight:"12px"}),RerunButton=styled(StyledIconButton)(({theme:theme2,animating,disabled})=>({opacity:disabled?.5:1,svg:{animation:animating&&`${theme2.animation.rotate360} 200ms ease-out`}})),Subnav=({controls,controlStates,status,storyFileName,onScrollToEnd})=>{let buttonText=status===CallStates.ERROR?"Scroll to error":"Scroll to end";return React10__default.createElement(SubnavWrapper,null,React10__default.createElement(Bar,null,React10__default.createElement(StyledSubnav,null,React10__default.createElement(Group,null,React10__default.createElement(StatusBadge,{status}),React10__default.createElement(JumpToEndButton,{onClick:onScrollToEnd,disabled:!onScrollToEnd},buttonText),React10__default.createElement(StyledSeparator,null),React10__default.createElement(WithTooltip,{trigger:"hover",hasChrome:!1,tooltip:React10__default.createElement(Note,{note:"Go to start"})},React10__default.createElement(RewindButton,{"aria-label":"Go to start",containsIcon:!0,onClick:controls.start,disabled:!controlStates.start},React10__default.createElement(RewindIcon,null))),React10__default.createElement(WithTooltip,{trigger:"hover",hasChrome:!1,tooltip:React10__default.createElement(Note,{note:"Go back"})},React10__default.createElement(StyledIconButton,{"aria-label":"Go back",containsIcon:!0,onClick:controls.back,disabled:!controlStates.back},React10__default.createElement(PlayBackIcon,null))),React10__default.createElement(WithTooltip,{trigger:"hover",hasChrome:!1,tooltip:React10__default.createElement(Note,{note:"Go forward"})},React10__default.createElement(StyledIconButton,{"aria-label":"Go forward",containsIcon:!0,onClick:controls.next,disabled:!controlStates.next},React10__default.createElement(PlayNextIcon,null))),React10__default.createElement(WithTooltip,{trigger:"hover",hasChrome:!1,tooltip:React10__default.createElement(Note,{note:"Go to end"})},React10__default.createElement(StyledIconButton,{"aria-label":"Go to end",containsIcon:!0,onClick:controls.end,disabled:!controlStates.end},React10__default.createElement(FastForwardIcon,null))),React10__default.createElement(WithTooltip,{trigger:"hover",hasChrome:!1,tooltip:React10__default.createElement(Note,{note:"Rerun"})},React10__default.createElement(RerunButton,{"aria-label":"Rerun",containsIcon:!0,onClick:controls.rerun},React10__default.createElement(SyncIcon,null)))),storyFileName&&React10__default.createElement(Group,null,React10__default.createElement(StyledLocation,null,storyFileName)))))};var import_extends4=__toESM(require_extends()),import_objectWithoutProperties5=__toESM(require_objectWithoutProperties());function toVal(mix){var k,y,str="";if(mix)if(typeof mix=="object")if(Array.isArray(mix))for(k=0;k<mix.length;k++)mix[k]&&(y=toVal(mix[k]))&&(str&&(str+=" "),str+=y);else for(k in mix)mix[k]&&(y=toVal(k))&&(str&&(str+=" "),str+=y);else typeof mix!="boolean"&&!mix.call&&(str&&(str+=" "),str+=mix);return str}function clsx_m_default(){for(var i=0,x,str="";i<arguments.length;)(x=toVal(arguments[i++]))&&(str&&(str+=" "),str+=x);return str}var isArray=val=>Array.isArray(val)||ArrayBuffer.isView(val)&&!(val instanceof DataView),isObject=val=>val!==null&&typeof val=="object"&&!isArray(val)&&!(val instanceof Date)&&!(val instanceof RegExp)&&!(val instanceof Error)&&!(val instanceof WeakMap)&&!(val instanceof WeakSet),isKnownObject=val=>isObject(val)||isArray(val)||typeof val=="function"||val instanceof Promise,getPromiseState=promise=>{let unique=/unique/;return Promise.race([promise,unique]).then(result=>result===unique?["pending"]:["fulfilled",result],e=>["rejected",e])},buildAST=async(key,value,depth,sortKeys,isPrototype,showPrototype)=>{let astNode={key,depth,value,type:"value",parent:void 0};if(value&&isKnownObject(value)&&depth<100){let children=[],t="object";if(isArray(value)){for(let i=0;i<value.length;i++)children.push(async()=>{let child=await buildAST(i.toString(),value[i],depth+1,sortKeys);return child.parent=astNode,child});t="array";}else {let keys=Object.getOwnPropertyNames(value);sortKeys&&keys.sort();for(let i=0;i<keys.length;i++){let safeValue;try{safeValue=value[keys[i]];}catch{}children.push(async()=>{let child=await buildAST(keys[i],safeValue,depth+1,sortKeys);return child.parent=astNode,child});}if(typeof value=="function"&&(t="function"),value instanceof Promise){let[status,result]=await getPromiseState(value);children.push(async()=>{let child=await buildAST("<state>",status,depth+1,sortKeys);return child.parent=astNode,child}),status!=="pending"&&children.push(async()=>{let child=await buildAST("<value>",result,depth+1,sortKeys);return child.parent=astNode,child}),t="promise";}if(value instanceof Map){let parsedEntries=Array.from(value.entries()).map(entry=>{let[entryKey,entryValue]=entry;return {"<key>":entryKey,"<value>":entryValue}});children.push(async()=>{let child=await buildAST("<entries>",parsedEntries,depth+1,sortKeys);return child.parent=astNode,child}),children.push(async()=>{let child=await buildAST("size",value.size,depth+1,sortKeys);return child.parent=astNode,child}),t="map";}if(value instanceof Set){let parsedEntries=Array.from(value.entries()).map(entry=>entry[1]);children.push(async()=>{let child=await buildAST("<entries>",parsedEntries,depth+1,sortKeys);return child.parent=astNode,child}),children.push(async()=>{let child=await buildAST("size",value.size,depth+1,sortKeys);return child.parent=astNode,child}),t="set";}}value!==Object.prototype&&showPrototype&&children.push(async()=>{let child=await buildAST("<prototype>",Object.getPrototypeOf(value),depth+1,sortKeys,!0);return child.parent=astNode,child}),astNode.type=t,astNode.children=children,astNode.isPrototype=isPrototype;}return astNode},parse=(data,sortKeys,includePrototypes)=>buildAST("root",data,0,sortKeys===!1?sortKeys:!0,void 0,includePrototypes===!1?includePrototypes:!0);var import_objectSpread2=__toESM(require_objectSpread2()),import_objectWithoutProperties=__toESM(require_objectWithoutProperties2());var _excluded=["children"];var ThemeContext=React10__default.createContext({theme:"chrome",colorScheme:"light"});var ThemeProvider=_ref=>{let{children}=_ref,value=(0, import_objectWithoutProperties.default)(_ref,_excluded),wrappedTheme=React10__default.useContext(ThemeContext);return React10__default.createElement(ThemeContext.Provider,{value:(0, import_objectSpread2.default)((0, import_objectSpread2.default)({},wrappedTheme),value)},children)},useTheme=(props,styles={})=>{let themeContext=React10__default.useContext(ThemeContext),currentTheme=props.theme||themeContext.theme||"chrome",currentColorScheme=props.colorScheme||themeContext.colorScheme||"light",themeClass=clsx_m_default(styles[currentTheme],styles[currentColorScheme]);return {currentColorScheme,currentTheme,themeClass}};var import_objectSpread22=__toESM(require_objectSpread22());var import_extends=__toESM(require_extends2()),import_objectWithoutProperties2=__toESM(require_objectWithoutProperties3());var TreeContext=React10__default.createContext({isChild:!1,depth:0,hasHover:!0}),TreeContext_default=TreeContext;var Tree_css_default={tree:"Tree-tree-fbbbe38",item:"Tree-item-353d6f3",group:"Tree-group-d3c3d8a",label:"Tree-label-d819155",focusWhite:"Tree-focusWhite-f1e00c2",arrow:"Tree-arrow-03ab2e7",hover:"Tree-hover-3cc4e5d",open:"Tree-open-3f1a336",dark:"Tree-dark-1b4aa00",chrome:"Tree-chrome-bcbcac6",light:"Tree-light-09174ee"};var _excluded2=["theme","hover","colorScheme","children","label","className","onUpdate","onSelect","open"],Tree=props=>{let{theme:theme2,hover,colorScheme,children,label,className,onUpdate,onSelect,open}=props,html=(0, import_objectWithoutProperties2.default)(props,_excluded2),{themeClass,currentTheme}=useTheme({theme:theme2,colorScheme},Tree_css_default),[isOpen,setOpen]=useState(open);useEffect(()=>{setOpen(open);},[open]);let updateState=value=>{setOpen(value),onUpdate&&onUpdate(value);},hasChildren=React10__default.Children.count(children)>0,updateFocus=(newNode,previousNode)=>{if(newNode.isSameNode(previousNode||null))return;let focusableNode=newNode.querySelector('[tabindex="-1"]');focusableNode?.focus(),newNode.setAttribute("aria-selected","true"),previousNode?.removeAttribute("aria-selected");},getParent=(node,role)=>{let parent=node;for(;parent&&parent.parentElement;){if(parent.getAttribute("role")===role)return parent;parent=parent.parentElement;}return null},getListElements=node=>{let tree=getParent(node,"tree");return tree?Array.from(tree.querySelectorAll("li")):[]},moveBack=node=>{let group=getParent(node,"group"),toggle=group?.previousElementSibling;if(toggle&&toggle.getAttribute("tabindex")==="-1"){let toggleParent=toggle.parentElement,nodeParent=node.parentElement;updateFocus(toggleParent,nodeParent);}},moveHome=(node,direction)=>{let elements=getListElements(node);elements.forEach(element=>{element.removeAttribute("aria-selected");}),direction==="start"&&elements[0]&&updateFocus(elements[0]),direction==="end"&&elements[elements.length-1]&&updateFocus(elements[elements.length-1]);},moveFocusAdjacent=(node,direction)=>{let elements=getListElements(node)||[];for(let i=0;i<elements.length;i++){let currentNode=elements[i];if(currentNode.getAttribute("aria-selected")==="true"){direction==="up"&&elements[i-1]?updateFocus(elements[i-1],currentNode):direction==="down"&&elements[i+1]&&updateFocus(elements[i+1],currentNode);return}}updateFocus(elements[0]);},handleKeypress=(event,isChild2)=>{let node=event.target;(event.key==="Enter"||event.key===" ")&&updateState(!isOpen),event.key==="ArrowRight"&&isOpen&&!isChild2?moveFocusAdjacent(node,"down"):event.key==="ArrowRight"&&updateState(!0),event.key==="ArrowLeft"&&(!isOpen||isChild2)?moveBack(node):event.key==="ArrowLeft"&&updateState(!1),event.key==="ArrowDown"&&moveFocusAdjacent(node,"down"),event.key==="ArrowUp"&&moveFocusAdjacent(node,"up"),event.key==="Home"&&moveHome(node,"start"),event.key==="End"&&moveHome(node,"end");},handleClick=(event,isChild2)=>{let node=event.target,parent=getParent(node,"treeitem"),elements=getListElements(node)||[],found=!1;for(let i=0;i<elements.length;i++){let currentNode=elements[i];if(currentNode.getAttribute("aria-selected")==="true"){parent&&(found=!0,updateFocus(parent,currentNode));break}}!found&&parent&&updateFocus(parent),isChild2||updateState(!isOpen);},handleBlur=event=>{let node=event.currentTarget;!node.contains(document.activeElement)&&node.getAttribute("role")==="tree"&&node.setAttribute("tabindex","0");},handleFocus=event=>{let node=event.target;if(node.getAttribute("role")==="tree"){let selected=node.querySelector('[aria-selected="true"]');selected?updateFocus(selected):moveFocusAdjacent(node,"down"),node.setAttribute("tabindex","-1");}},handleButtonFocus=()=>{onSelect?.();},getPaddingStyles=depth2=>{let space=depth2*.9+.3;return {paddingLeft:`${space}em`,width:`calc(100% - ${space}em)`}},{isChild,depth,hasHover}=React10__default.useContext(TreeContext_default),showHover=hasHover?hover:!1;if(!isChild)return React10__default.createElement("ul",(0, import_extends.default)({role:"tree",tabIndex:0,className:clsx_m_default(Tree_css_default.tree,Tree_css_default.group,themeClass,className),onFocus:handleFocus,onBlur:handleBlur},html),React10__default.createElement(TreeContext_default.Provider,{value:{isChild:!0,depth:0,hasHover:showHover}},React10__default.createElement(Tree,props)));if(!hasChildren)return React10__default.createElement("li",(0, import_extends.default)({role:"treeitem",className:Tree_css_default.item},html),React10__default.createElement("div",{role:"button",className:clsx_m_default(Tree_css_default.label,{[Tree_css_default.hover]:showHover,[Tree_css_default.focusWhite]:currentTheme==="firefox"}),tabIndex:-1,style:getPaddingStyles(depth),onKeyDown:e=>{handleKeypress(e,isChild);},onClick:e=>handleClick(e,!0),onFocus:handleButtonFocus},React10__default.createElement("span",null,label)));let arrowClass=clsx_m_default(Tree_css_default.arrow,{[Tree_css_default.open]:isOpen});return React10__default.createElement("li",{role:"treeitem","aria-expanded":isOpen,className:Tree_css_default.item},React10__default.createElement("div",{role:"button",tabIndex:-1,className:clsx_m_default(Tree_css_default.label,{[Tree_css_default.hover]:showHover,[Tree_css_default.focusWhite]:currentTheme==="firefox"}),style:getPaddingStyles(depth),onClick:e=>handleClick(e),onKeyDown:e=>handleKeypress(e),onFocus:handleButtonFocus},React10__default.createElement("span",null,React10__default.createElement("span",{"aria-hidden":!0,className:arrowClass}),React10__default.createElement("span",null,label))),React10__default.createElement("ul",(0, import_extends.default)({role:"group",className:clsx_m_default(className,Tree_css_default.group)},html),isOpen&&React10__default.Children.map(children,child=>React10__default.createElement(TreeContext_default.Provider,{value:{isChild:!0,depth:depth+1,hasHover:showHover}},child))))};Tree.defaultProps={open:!1,hover:!0};var import_extends2=__toESM(require_extends()),import_objectWithoutProperties3=__toESM(require_objectWithoutProperties());var ObjectInspector_css_default={"object-inspector":"ObjectInspector-object-inspector-0c33e82",objectInspector:"ObjectInspector-object-inspector-0c33e82","object-label":"ObjectInspector-object-label-b81482b",objectLabel:"ObjectInspector-object-label-b81482b",text:"ObjectInspector-text-25f57f3",key:"ObjectInspector-key-4f712bb",value:"ObjectInspector-value-f7ec2e5",string:"ObjectInspector-string-c496000",regex:"ObjectInspector-regex-59d45a3",error:"ObjectInspector-error-b818698",boolean:"ObjectInspector-boolean-2dd1642",number:"ObjectInspector-number-a6daabb",undefined:"ObjectInspector-undefined-3a68263",null:"ObjectInspector-null-74acb50",function:"ObjectInspector-function-07bbdcd","function-decorator":"ObjectInspector-function-decorator-3d22c24",functionDecorator:"ObjectInspector-function-decorator-3d22c24",prototype:"ObjectInspector-prototype-f2449ee",dark:"ObjectInspector-dark-0c96c97",chrome:"ObjectInspector-chrome-2f3ca98",light:"ObjectInspector-light-78bef54"};var _excluded3=["ast","theme","showKey","colorScheme","className"],buildValue=(key,value,valueClass,showKey,depth)=>{let computedKey=key.includes("-")?`"${key}"`:key,isRoot=depth<=0;return React10__default.createElement("span",{className:ObjectInspector_css_default.text},!isRoot&&showKey&&React10__default.createElement(React10__default.Fragment,null,React10__default.createElement("span",{className:ObjectInspector_css_default.key},computedKey),React10__default.createElement("span",null,":\xA0")),React10__default.createElement("span",{className:valueClass},value))},ObjectValue=props=>{let{ast,theme:theme2,showKey,colorScheme,className}=props,html=(0, import_objectWithoutProperties3.default)(props,_excluded3),{themeClass}=useTheme({theme:theme2,colorScheme},ObjectInspector_css_default),[asyncValue,setAsyncValue]=useState(React10__default.createElement("span",null)),value=React10__default.createElement("span",null);return useEffect(()=>{ast.value instanceof Promise&&(async promise=>{setAsyncValue(buildValue(ast.key,`Promise { "${await getPromiseState(promise)}" }`,ObjectInspector_css_default.key,showKey,ast.depth));})(ast.value);},[ast,showKey]),typeof ast.value=="number"||typeof ast.value=="bigint"?value=buildValue(ast.key,String(ast.value),ObjectInspector_css_default.number,showKey,ast.depth):typeof ast.value=="boolean"?value=buildValue(ast.key,String(ast.value),ObjectInspector_css_default.boolean,showKey,ast.depth):typeof ast.value=="string"?value=buildValue(ast.key,`"${ast.value}"`,ObjectInspector_css_default.string,showKey,ast.depth):typeof ast.value>"u"?value=buildValue(ast.key,"undefined",ObjectInspector_css_default.undefined,showKey,ast.depth):typeof ast.value=="symbol"?value=buildValue(ast.key,ast.value.toString(),ObjectInspector_css_default.string,showKey,ast.depth):typeof ast.value=="function"?value=buildValue(ast.key,`${ast.value.name}()`,ObjectInspector_css_default.key,showKey,ast.depth):typeof ast.value=="object"&&(ast.value===null?value=buildValue(ast.key,"null",ObjectInspector_css_default.null,showKey,ast.depth):Array.isArray(ast.value)?value=buildValue(ast.key,`Array(${ast.value.length})`,ObjectInspector_css_default.key,showKey,ast.depth):ast.value instanceof Date?value=buildValue(ast.key,`Date ${ast.value.toString()}`,ObjectInspector_css_default.value,showKey,ast.depth):ast.value instanceof RegExp?value=buildValue(ast.key,ast.value.toString(),ObjectInspector_css_default.regex,showKey,ast.depth):ast.value instanceof Error?value=buildValue(ast.key,ast.value.toString(),ObjectInspector_css_default.error,showKey,ast.depth):isObject(ast.value)?value=buildValue(ast.key,"{\u2026}",ObjectInspector_css_default.key,showKey,ast.depth):value=buildValue(ast.key,ast.value.constructor.name,ObjectInspector_css_default.key,showKey,ast.depth)),React10__default.createElement("span",(0, import_extends2.default)({className:clsx_m_default(themeClass,className)},html),asyncValue,value)};ObjectValue.defaultProps={showKey:!0};var ObjectValue_default=ObjectValue;var import_extends3=__toESM(require_extends()),import_objectWithoutProperties4=__toESM(require_objectWithoutProperties());var _excluded4=["ast","theme","previewMax","open","colorScheme","className"],buildPreview=(children,previewMax,showKey)=>{let previews=[];for(let i=0;i<children.length;i++){let child=children[i];if(child.isPrototype||(previews.push(React10__default.createElement(ObjectValue_default,{key:child.key,ast:child,showKey})),i<children.length-1?previews.push(", "):previews.push(" ")),child.isPrototype&&i===children.length-1&&(previews.pop(),previews.push(" ")),i===previewMax-1&&children.length>previewMax){previews.push("\u2026 ");break}}return previews},getArrayLabel=(ast,open,previewMax,theme2)=>{let l=ast.value.length;return open?React10__default.createElement("span",null,"Array(",l,")"):React10__default.createElement(React10__default.Fragment,null,React10__default.createElement("span",null,`${theme2==="firefox"?"Array":""}(${l}) [ `),buildPreview(ast.children,previewMax,!1),React10__default.createElement("span",null,"]"))},getObjectLabel=(ast,open,previewMax,theme2)=>ast.isPrototype?React10__default.createElement("span",null,`Object ${theme2==="firefox"?"{ \u2026 }":""}`):open?React10__default.createElement("span",null,"{\u2026}"):React10__default.createElement(React10__default.Fragment,null,React10__default.createElement("span",null,`${theme2==="firefox"?"Object ":""}{ `),buildPreview(ast.children,previewMax,!0),React10__default.createElement("span",null,"}")),getPromiseLabel=(ast,open,previewMax)=>open?React10__default.createElement("span",null,`Promise { "${String(ast.children[0].value)}" }`):React10__default.createElement(React10__default.Fragment,null,React10__default.createElement("span",null,"Promise { "),buildPreview(ast.children,previewMax,!0),React10__default.createElement("span",null,"}")),getMapLabel=(ast,open,previewMax,theme2)=>{let{size}=ast.value;return open?React10__default.createElement("span",null,`Map(${size})`):React10__default.createElement(React10__default.Fragment,null,React10__default.createElement("span",null,`Map${theme2==="chrome"?`(${size})`:""} { `),buildPreview(ast.children,previewMax,!0),React10__default.createElement("span",null,"}"))},getSetLabel=(ast,open,previewMax)=>{let{size}=ast.value;return open?React10__default.createElement("span",null,"Set(",size,")"):React10__default.createElement(React10__default.Fragment,null,React10__default.createElement("span",null,`Set(${ast.value.size}) {`),buildPreview(ast.children,previewMax,!0),React10__default.createElement("span",null,"}"))},ObjectLabel=props=>{let{ast,theme:theme2,previewMax,open,colorScheme,className}=props,html=(0, import_objectWithoutProperties4.default)(props,_excluded4),{themeClass,currentTheme}=useTheme({theme:theme2,colorScheme},ObjectInspector_css_default),isPrototype=ast.isPrototype||!1,classes=clsx_m_default(ObjectInspector_css_default.objectLabel,themeClass,className,{[ObjectInspector_css_default.prototype]:isPrototype}),isRoot=ast.depth<=0,Key=()=>React10__default.createElement("span",{className:isPrototype?ObjectInspector_css_default.prototype:ObjectInspector_css_default.key},isRoot?"":`${ast.key}: `);return ast.type==="array"?React10__default.createElement("span",(0, import_extends3.default)({className:classes},html),React10__default.createElement(Key,null),getArrayLabel(ast,open,previewMax,currentTheme)):ast.type==="function"?React10__default.createElement("span",(0, import_extends3.default)({className:classes},html),React10__default.createElement(Key,null),currentTheme==="chrome"&&React10__default.createElement("span",{className:ObjectInspector_css_default.functionDecorator},"\u0192 "),React10__default.createElement("span",{className:clsx_m_default({[ObjectInspector_css_default.function]:!isPrototype})},`${ast.value.name}()`)):ast.type==="promise"?React10__default.createElement("span",(0, import_extends3.default)({className:classes},html),React10__default.createElement(Key,null),getPromiseLabel(ast,open,previewMax)):ast.type==="map"?React10__default.createElement("span",(0, import_extends3.default)({className:classes},html),React10__default.createElement(Key,null),getMapLabel(ast,open,previewMax,currentTheme)):ast.type==="set"?React10__default.createElement("span",(0, import_extends3.default)({className:classes},html),React10__default.createElement(Key,null),getSetLabel(ast,open,previewMax)):React10__default.createElement("span",(0, import_extends3.default)({className:classes},html),React10__default.createElement(Key,null),getObjectLabel(ast,open,previewMax,currentTheme))};ObjectLabel.defaultProps={previewMax:8,open:!1};var ObjectLabel_default=ObjectLabel;var ObjectInspectorItem=props=>{let{ast,expandLevel,depth}=props,[resolved,setResolved]=useState(),[open,setOpen]=useState(depth<expandLevel);return useEffect(()=>{(async()=>{if(ast.type!=="value"){let promises=ast.children.map(f=>f()),children=await Promise.all(promises),r=(0, import_objectSpread22.default)((0, import_objectSpread22.default)({},ast),{},{children});setResolved(r);}})();},[ast]),resolved?React10__default.createElement(Tree,{hover:!1,open,label:React10__default.createElement(ObjectLabel_default,{open,ast:resolved}),onSelect:()=>{var _props$onSelect;(_props$onSelect=props.onSelect)===null||_props$onSelect===void 0||_props$onSelect.call(props,ast);},onUpdate:value=>{setOpen(value);}},resolved.children.map(child=>React10__default.createElement(ObjectInspectorItem,{key:child.key,ast:child,depth:depth+1,expandLevel,onSelect:props.onSelect}))):React10__default.createElement(Tree,{hover:!1,label:React10__default.createElement(ObjectValue_default,{ast}),onSelect:()=>{var _props$onSelect2;(_props$onSelect2=props.onSelect)===null||_props$onSelect2===void 0||_props$onSelect2.call(props,ast);}})};ObjectInspectorItem.defaultProps={expandLevel:0,depth:0};var ObjectInspectorItem_default=ObjectInspectorItem;var _excluded5=["data","expandLevel","sortKeys","includePrototypes","className","theme","colorScheme","onSelect"],ObjectInspector=props=>{let{data,expandLevel,sortKeys,includePrototypes,className,theme:theme2,colorScheme,onSelect}=props,html=(0, import_objectWithoutProperties5.default)(props,_excluded5),[ast,setAST]=useState(void 0),{themeClass,currentTheme,currentColorScheme}=useTheme({theme:theme2,colorScheme},ObjectInspector_css_default);return useEffect(()=>{(async()=>{setAST(await parse(data,sortKeys,includePrototypes));})();},[data,sortKeys,includePrototypes]),React10__default.createElement("div",(0, import_extends4.default)({className:clsx_m_default(ObjectInspector_css_default.objectInspector,className,themeClass)},html),ast&&React10__default.createElement(ThemeProvider,{theme:currentTheme,colorScheme:currentColorScheme},React10__default.createElement(ObjectInspectorItem_default,{ast,expandLevel,onSelect})))};ObjectInspector.defaultProps={expandLevel:0,sortKeys:!0,includePrototypes:!0};var colorsLight={base:"#444",nullish:"#7D99AA",string:"#16B242",number:"#5D40D0",boolean:"#f41840",objectkey:"#698394",instance:"#A15C20",function:"#EA7509",muted:"#7D99AA",tag:{name:"#6F2CAC",suffix:"#1F99E5"},date:"#459D9C",error:{name:"#D43900",message:"#444"},regex:{source:"#A15C20",flags:"#EA7509"},meta:"#EA7509",method:"#0271B6"},colorsDark={base:"#eee",nullish:"#aaa",string:"#5FE584",number:"#6ba5ff",boolean:"#ff4191",objectkey:"#accfe6",instance:"#E3B551",function:"#E3B551",muted:"#aaa",tag:{name:"#f57bff",suffix:"#8EB5FF"},date:"#70D4D3",error:{name:"#f40",message:"#eee"},regex:{source:"#FAD483",flags:"#E3B551"},meta:"#FAD483",method:"#5EC1FF"},useThemeColors=()=>{let{base}=useTheme$1();return base==="dark"?colorsDark:colorsLight},special=/[^A-Z0-9]/i,trimEnd=/[\s.,…]+$/gm,ellipsize=(string2,maxlength)=>{if(string2.length<=maxlength)return string2;for(let i=maxlength-1;i>=0;i-=1)if(special.test(string2[i])&&i>10)return `${string2.slice(0,i).replace(trimEnd,"")}\u2026`;return `${string2.slice(0,maxlength).replace(trimEnd,"")}\u2026`},stringify=value=>{try{return JSON.stringify(value,null,1)}catch{return String(value)}},interleave=(nodes,separator)=>nodes.flatMap((node,index)=>index===nodes.length-1?[node]:[node,React10__default.cloneElement(separator,{key:`sep${index}`})]),Node=({value,nested,showObjectInspector,callsById,...props})=>{switch(!0){case value===null:return React10__default.createElement(NullNode,{...props});case value===void 0:return React10__default.createElement(UndefinedNode,{...props});case Array.isArray(value):return React10__default.createElement(ArrayNode,{...props,value,callsById});case typeof value=="string":return React10__default.createElement(StringNode,{...props,value});case typeof value=="number":return React10__default.createElement(NumberNode,{...props,value});case typeof value=="boolean":return React10__default.createElement(BooleanNode,{...props,value});case Object.prototype.hasOwnProperty.call(value,"__date__"):return React10__default.createElement(DateNode,{...props,...value.__date__});case Object.prototype.hasOwnProperty.call(value,"__error__"):return React10__default.createElement(ErrorNode,{...props,...value.__error__});case Object.prototype.hasOwnProperty.call(value,"__regexp__"):return React10__default.createElement(RegExpNode,{...props,...value.__regexp__});case Object.prototype.hasOwnProperty.call(value,"__function__"):return React10__default.createElement(FunctionNode,{...props,...value.__function__});case Object.prototype.hasOwnProperty.call(value,"__symbol__"):return React10__default.createElement(SymbolNode,{...props,...value.__symbol__});case Object.prototype.hasOwnProperty.call(value,"__element__"):return React10__default.createElement(ElementNode,{...props,...value.__element__});case Object.prototype.hasOwnProperty.call(value,"__class__"):return React10__default.createElement(ClassNode,{...props,...value.__class__});case Object.prototype.hasOwnProperty.call(value,"__callId__"):return React10__default.createElement(MethodCall,{call:callsById.get(value.__callId__),callsById});case Object.prototype.toString.call(value)==="[object Object]":return React10__default.createElement(ObjectNode,{value,showInspector:showObjectInspector,callsById,...props});default:return React10__default.createElement(OtherNode,{value,...props})}},NullNode=props=>{let colors2=useThemeColors();return React10__default.createElement("span",{style:{color:colors2.nullish},...props},"null")},UndefinedNode=props=>{let colors2=useThemeColors();return React10__default.createElement("span",{style:{color:colors2.nullish},...props},"undefined")},StringNode=({value,...props})=>{let colors2=useThemeColors();return React10__default.createElement("span",{style:{color:colors2.string},...props},JSON.stringify(ellipsize(value,50)))},NumberNode=({value,...props})=>{let colors2=useThemeColors();return React10__default.createElement("span",{style:{color:colors2.number},...props},value)},BooleanNode=({value,...props})=>{let colors2=useThemeColors();return React10__default.createElement("span",{style:{color:colors2.boolean},...props},String(value))},ArrayNode=({value,nested=!1,callsById})=>{let colors2=useThemeColors();if(nested)return React10__default.createElement("span",{style:{color:colors2.base}},"[\u2026]");let nodes=value.slice(0,3).map(v=>React10__default.createElement(Node,{key:JSON.stringify(v),value:v,nested:!0,callsById})),nodelist=interleave(nodes,React10__default.createElement("span",null,", "));return value.length<=3?React10__default.createElement("span",{style:{color:colors2.base}},"[",nodelist,"]"):React10__default.createElement("span",{style:{color:colors2.base}},"(",value.length,") [",nodelist,", \u2026]")},ObjectNode=({showInspector,value,callsById,nested=!1})=>{let isDarkMode=useTheme$1().base==="dark",colors2=useThemeColors();if(showInspector)return React10__default.createElement(React10__default.Fragment,null,React10__default.createElement(ObjectInspector,{id:"interactions-object-inspector",data:value,includePrototypes:!1,colorScheme:isDarkMode?"dark":"light"}));if(nested)return React10__default.createElement("span",{style:{color:colors2.base}},"{\u2026}");let nodelist=interleave(Object.entries(value).slice(0,2).map(([k,v])=>React10__default.createElement(Fragment,{key:k},React10__default.createElement("span",{style:{color:colors2.objectkey}},k,": "),React10__default.createElement(Node,{value:v,callsById,nested:!0}))),React10__default.createElement("span",null,", "));return Object.keys(value).length<=2?React10__default.createElement("span",{style:{color:colors2.base}},"{ ",nodelist," }"):React10__default.createElement("span",{style:{color:colors2.base}},"(",Object.keys(value).length,") ","{ ",nodelist,", \u2026 }")},ClassNode=({name})=>{let colors2=useThemeColors();return React10__default.createElement("span",{style:{color:colors2.instance}},name)},FunctionNode=({name})=>{let colors2=useThemeColors();return name?React10__default.createElement("span",{style:{color:colors2.function}},name):React10__default.createElement("span",{style:{color:colors2.nullish,fontStyle:"italic"}},"anonymous")},ElementNode=({prefix,localName,id,classNames=[],innerText})=>{let name=prefix?`${prefix}:${localName}`:localName,colors2=useThemeColors();return React10__default.createElement("span",{style:{wordBreak:"keep-all"}},React10__default.createElement("span",{key:`${name}_lt`,style:{color:colors2.muted}},"<"),React10__default.createElement("span",{key:`${name}_tag`,style:{color:colors2.tag.name}},name),React10__default.createElement("span",{key:`${name}_suffix`,style:{color:colors2.tag.suffix}},id?`#${id}`:classNames.reduce((acc,className)=>`${acc}.${className}`,"")),React10__default.createElement("span",{key:`${name}_gt`,style:{color:colors2.muted}},">"),!id&&classNames.length===0&&innerText&&React10__default.createElement(React10__default.Fragment,null,React10__default.createElement("span",{key:`${name}_text`},innerText),React10__default.createElement("span",{key:`${name}_close_lt`,style:{color:colors2.muted}},"<"),React10__default.createElement("span",{key:`${name}_close_tag`,style:{color:colors2.tag.name}},"/",name),React10__default.createElement("span",{key:`${name}_close_gt`,style:{color:colors2.muted}},">")))},DateNode=({value})=>{let[date,time,ms]=value.split(/[T.Z]/),colors2=useThemeColors();return React10__default.createElement("span",{style:{whiteSpace:"nowrap",color:colors2.date}},date,React10__default.createElement("span",{style:{opacity:.7}},"T"),time==="00:00:00"?React10__default.createElement("span",{style:{opacity:.7}},time):time,ms==="000"?React10__default.createElement("span",{style:{opacity:.7}},".",ms):`.${ms}`,React10__default.createElement("span",{style:{opacity:.7}},"Z"))},ErrorNode=({name,message})=>{let colors2=useThemeColors();return React10__default.createElement("span",{style:{color:colors2.error.name}},name,message&&": ",message&&React10__default.createElement("span",{style:{color:colors2.error.message},title:message.length>50?message:""},ellipsize(message,50)))},RegExpNode=({flags,source})=>{let colors2=useThemeColors();return React10__default.createElement("span",{style:{whiteSpace:"nowrap",color:colors2.regex.flags}},"/",React10__default.createElement("span",{style:{color:colors2.regex.source}},source),"/",flags)},SymbolNode=({description})=>{let colors2=useThemeColors();return React10__default.createElement("span",{style:{whiteSpace:"nowrap",color:colors2.instance}},"Symbol(",description&&React10__default.createElement("span",{style:{color:colors2.meta}},'"',description,'"'),")")},OtherNode=({value})=>{let colors2=useThemeColors();return React10__default.createElement("span",{style:{color:colors2.meta}},stringify(value))},StepNode=({label})=>{let colors2=useThemeColors(),{typography:typography4}=useTheme$1();return React10__default.createElement("span",{style:{color:colors2.base,fontFamily:typography4.fonts.base,fontSize:typography4.size.s2-1}},label)},MethodCall=({call,callsById})=>{if(!call)return null;if(call.method==="step"&&call.path.length===0)return React10__default.createElement(StepNode,{label:call.args[0]});let path=call.path.flatMap((elem,index)=>{let callId=elem.__callId__;return [callId?React10__default.createElement(MethodCall,{key:`elem${index}`,call:callsById.get(callId),callsById}):React10__default.createElement("span",{key:`elem${index}`},elem),React10__default.createElement("wbr",{key:`wbr${index}`}),React10__default.createElement("span",{key:`dot${index}`},".")]}),args=call.args.flatMap((arg,index,array)=>{let node=React10__default.createElement(Node,{key:`node${index}`,value:arg,callsById});return index<array.length-1?[node,React10__default.createElement("span",{key:`comma${index}`},",\xA0"),React10__default.createElement("wbr",{key:`wbr${index}`})]:[node]}),colors2=useThemeColors();return React10__default.createElement(React10__default.Fragment,null,React10__default.createElement("span",{style:{color:colors2.base}},path),React10__default.createElement("span",{style:{color:colors2.method}},call.method),React10__default.createElement("span",{style:{color:colors2.base}},"(",React10__default.createElement("wbr",null),args,React10__default.createElement("wbr",null),")"))};var getParams=(line,fromIndex=0)=>{for(let i=fromIndex,depth=1;i<line.length;i+=1)if(line[i]==="("?depth+=1:line[i]===")"&&(depth-=1),depth===0)return line.slice(fromIndex,i);return ""},parseValue=value=>{try{return value==="undefined"?void 0:JSON.parse(value)}catch{return value}},StyledExpected=styled.span(({theme:theme2})=>({color:theme2.base==="light"?theme2.color.positiveText:theme2.color.positive})),StyledReceived=styled.span(({theme:theme2})=>({color:theme2.base==="light"?theme2.color.negativeText:theme2.color.negative})),Received=({value,parsed})=>parsed?React10__default.createElement(Node,{showObjectInspector:!0,value,style:{color:"#D43900"}}):React10__default.createElement(StyledReceived,null,value),Expected=({value,parsed})=>parsed?typeof value=="string"&&value.startsWith("called with")?React10__default.createElement(React10__default.Fragment,null,value):React10__default.createElement(Node,{showObjectInspector:!0,value,style:{color:"#16B242"}}):React10__default.createElement(StyledExpected,null,value),MatcherResult=({message,style={}})=>{let lines=message.split(`
19
- `);return React10__default.createElement("pre",{style:{margin:0,padding:"8px 10px 8px 36px",fontSize:typography.size.s1,...style}},lines.flatMap((line,index)=>{if(line.startsWith("expect(")){let received=getParams(line,7),remainderIndex=received&&7+received.length,matcher=received&&line.slice(remainderIndex).match(/\.(to|last|nth)[A-Z]\w+\(/);if(matcher){let expectedIndex=remainderIndex+matcher.index+matcher[0].length,expected=getParams(line,expectedIndex);if(expected)return ["expect(",React10__default.createElement(Received,{key:`received_${received}`,value:received}),line.slice(remainderIndex,expectedIndex),React10__default.createElement(Expected,{key:`expected_${expected}`,value:expected}),line.slice(expectedIndex+expected.length),React10__default.createElement("br",{key:`br${index}`})]}}if(line.match(/^\s*- /))return [React10__default.createElement(Expected,{key:line+index,value:line}),React10__default.createElement("br",{key:`br${index}`})];if(line.match(/^\s*\+ /))return [React10__default.createElement(Received,{key:line+index,value:line}),React10__default.createElement("br",{key:`br${index}`})];let[,assertionLabel,assertionValue]=line.match(/^(Expected|Received): (.*)$/)||[];if(assertionLabel&&assertionValue)return assertionLabel==="Expected"?["Expected: ",React10__default.createElement(Expected,{key:line+index,value:parseValue(assertionValue),parsed:!0}),React10__default.createElement("br",{key:`br${index}`})]:["Received: ",React10__default.createElement(Received,{key:line+index,value:parseValue(assertionValue),parsed:!0}),React10__default.createElement("br",{key:`br${index}`})];let[,prefix,numberOfCalls]=line.match(/(Expected number|Received number|Number) of calls: (\d+)$/i)||[];if(prefix&&numberOfCalls)return [`${prefix} of calls: `,React10__default.createElement(Node,{key:line+index,value:Number(numberOfCalls)}),React10__default.createElement("br",{key:`br${index}`})];let[,receivedValue]=line.match(/^Received has value: (.+)$/)||[];return receivedValue?["Received has value: ",React10__default.createElement(Node,{key:line+index,value:parseValue(receivedValue)}),React10__default.createElement("br",{key:`br${index}`})]:[React10__default.createElement("span",{key:line+index},line),React10__default.createElement("br",{key:`br${index}`})]}))};var colors={pure:{gray:{500:"#CCCCCC"}}},theme={colors},theme_default=theme;var{colors:{pure:{gray}}}=theme_default,StyledStatusIcon=styled(Icons)(({theme:theme2,status})=>{let color={[CallStates.DONE]:theme2.color.positive,[CallStates.ERROR]:theme2.color.negative,[CallStates.ACTIVE]:theme2.color.secondary,[CallStates.WAITING]:transparentize(.5,gray[500])}[status];return {width:status===CallStates.WAITING?6:12,height:status===CallStates.WAITING?6:12,color,justifySelf:"center"}}),StatusIcon=({status,className})=>{let icon={[CallStates.DONE]:"check",[CallStates.ERROR]:"stopalt",[CallStates.ACTIVE]:"play",[CallStates.WAITING]:"circle"}[status];return React10__default.createElement(StyledStatusIcon,{"data-testid":`icon-${status}`,status,icon,className})};var MethodCallWrapper=styled.div(()=>({fontFamily:typography.fonts.mono,fontSize:typography.size.s1,overflowWrap:"break-word",inlineSize:"calc( 100% - 40px )"})),RowContainer=styled("div",{shouldForwardProp:prop=>!["call","pausedAt"].includes(prop.toString())})(({theme:theme2,call})=>({position:"relative",display:"flex",flexDirection:"column",borderBottom:`1px solid ${theme2.appBorderColor}`,fontFamily:typography.fonts.base,fontSize:13,...call.status===CallStates.ERROR&&{backgroundColor:theme2.base==="dark"?transparentize(.93,theme2.color.negative):theme2.background.warning},paddingLeft:call.ancestors.length*20}),({theme:theme2,call,pausedAt})=>pausedAt===call.id&&{"&::before":{content:'""',position:"absolute",top:-5,zIndex:1,borderTop:"4.5px solid transparent",borderLeft:`7px solid ${theme2.color.warning}`,borderBottom:"4.5px solid transparent"},"&::after":{content:'""',position:"absolute",top:-1,zIndex:1,width:"100%",borderTop:`1.5px solid ${theme2.color.warning}`}}),RowHeader=styled.div(({theme:theme2,isInteractive})=>({display:"flex","&:hover":isInteractive?{}:{background:theme2.background.hoverable}})),RowLabel=styled("button",{shouldForwardProp:prop=>!["call"].includes(prop.toString())})(({theme:theme2,disabled,call})=>({flex:1,display:"grid",background:"none",border:0,gridTemplateColumns:"15px 1fr",alignItems:"center",minHeight:40,margin:0,padding:"8px 15px",textAlign:"start",cursor:disabled||call.status===CallStates.ERROR?"default":"pointer","&:focus-visible":{outline:0,boxShadow:`inset 3px 0 0 0 ${call.status===CallStates.ERROR?theme2.color.warning:theme2.color.secondary}`,background:call.status===CallStates.ERROR?"transparent":theme2.background.hoverable},"& > div":{opacity:call.status===CallStates.WAITING?.5:1}})),RowActions=styled.div({padding:6}),StyledIconButton2=styled(IconButton)(({theme:theme2})=>({color:theme2.textMutedColor,margin:"0 3px"})),Note2=styled(TooltipNote)(({theme:theme2})=>({fontFamily:theme2.typography.fonts.base})),RowMessage=styled("div")(({theme:theme2})=>({padding:"8px 10px 8px 36px",fontSize:typography.size.s1,color:theme2.color.defaultText,pre:{margin:0,padding:0}})),Exception=({exception})=>{if(exception.message.startsWith("expect("))return React10.createElement(MatcherResult,{...exception});let paragraphs=exception.message.split(`
19
+ `);return React10__default.createElement("pre",{style:{margin:0,padding:"8px 10px 8px 36px",fontSize:typography.size.s1,...style}},lines.flatMap((line,index)=>{if(line.startsWith("expect(")){let received=getParams(line,7),remainderIndex=received&&7+received.length,matcher=received&&line.slice(remainderIndex).match(/\.(to|last|nth)[A-Z]\w+\(/);if(matcher){let expectedIndex=remainderIndex+matcher.index+matcher[0].length,expected=getParams(line,expectedIndex);if(expected)return ["expect(",React10__default.createElement(Received,{key:`received_${received}`,value:received}),line.slice(remainderIndex,expectedIndex),React10__default.createElement(Expected,{key:`expected_${expected}`,value:expected}),line.slice(expectedIndex+expected.length),React10__default.createElement("br",{key:`br${index}`})]}}if(line.match(/^\s*- /))return [React10__default.createElement(Expected,{key:line+index,value:line}),React10__default.createElement("br",{key:`br${index}`})];if(line.match(/^\s*\+ /))return [React10__default.createElement(Received,{key:line+index,value:line}),React10__default.createElement("br",{key:`br${index}`})];let[,assertionLabel,assertionValue]=line.match(/^(Expected|Received): (.*)$/)||[];if(assertionLabel&&assertionValue)return assertionLabel==="Expected"?["Expected: ",React10__default.createElement(Expected,{key:line+index,value:parseValue(assertionValue),parsed:!0}),React10__default.createElement("br",{key:`br${index}`})]:["Received: ",React10__default.createElement(Received,{key:line+index,value:parseValue(assertionValue),parsed:!0}),React10__default.createElement("br",{key:`br${index}`})];let[,prefix,numberOfCalls]=line.match(/(Expected number|Received number|Number) of calls: (\d+)$/i)||[];if(prefix&&numberOfCalls)return [`${prefix} of calls: `,React10__default.createElement(Node,{key:line+index,value:Number(numberOfCalls)}),React10__default.createElement("br",{key:`br${index}`})];let[,receivedValue]=line.match(/^Received has value: (.+)$/)||[];return receivedValue?["Received has value: ",React10__default.createElement(Node,{key:line+index,value:parseValue(receivedValue)}),React10__default.createElement("br",{key:`br${index}`})]:[React10__default.createElement("span",{key:line+index},line),React10__default.createElement("br",{key:`br${index}`})]}))};var colors={pure:{gray:{500:"#CCCCCC"}}},theme={colors},theme_default=theme;var{colors:{pure:{gray}}}=theme_default,StyledStatusIcon=styled(Icons)(({theme:theme2,status})=>{let color={[CallStates.DONE]:theme2.color.positive,[CallStates.ERROR]:theme2.color.negative,[CallStates.ACTIVE]:theme2.color.secondary,[CallStates.WAITING]:transparentize(.5,gray[500])}[status];return {width:status===CallStates.WAITING?6:12,height:status===CallStates.WAITING?6:12,color,justifySelf:"center"}}),StatusIcon=({status,className})=>{let icon={[CallStates.DONE]:"check",[CallStates.ERROR]:"stopalt",[CallStates.ACTIVE]:"play",[CallStates.WAITING]:"circle"}[status];return React10__default.createElement(StyledStatusIcon,{"data-testid":`icon-${status}`,status,icon,className})};function isTestAssertionError(error){return isChaiError(error)||isJestError(error)}function isChaiError(error){return error&&typeof error=="object"&&"name"in error&&typeof error.name=="string"&&error.name==="AssertionError"}function isJestError(error){return error&&typeof error=="object"&&"message"in error&&typeof error.message=="string"&&error.message.startsWith("expect(")}var MethodCallWrapper=styled.div(()=>({fontFamily:typography.fonts.mono,fontSize:typography.size.s1,overflowWrap:"break-word",inlineSize:"calc( 100% - 40px )"})),RowContainer=styled("div",{shouldForwardProp:prop=>!["call","pausedAt"].includes(prop.toString())})(({theme:theme2,call})=>({position:"relative",display:"flex",flexDirection:"column",borderBottom:`1px solid ${theme2.appBorderColor}`,fontFamily:typography.fonts.base,fontSize:13,...call.status===CallStates.ERROR&&{backgroundColor:theme2.base==="dark"?transparentize(.93,theme2.color.negative):theme2.background.warning},paddingLeft:call.ancestors.length*20}),({theme:theme2,call,pausedAt})=>pausedAt===call.id&&{"&::before":{content:'""',position:"absolute",top:-5,zIndex:1,borderTop:"4.5px solid transparent",borderLeft:`7px solid ${theme2.color.warning}`,borderBottom:"4.5px solid transparent"},"&::after":{content:'""',position:"absolute",top:-1,zIndex:1,width:"100%",borderTop:`1.5px solid ${theme2.color.warning}`}}),RowHeader=styled.div(({theme:theme2,isInteractive})=>({display:"flex","&:hover":isInteractive?{}:{background:theme2.background.hoverable}})),RowLabel=styled("button",{shouldForwardProp:prop=>!["call"].includes(prop.toString())})(({theme:theme2,disabled,call})=>({flex:1,display:"grid",background:"none",border:0,gridTemplateColumns:"15px 1fr",alignItems:"center",minHeight:40,margin:0,padding:"8px 15px",textAlign:"start",cursor:disabled||call.status===CallStates.ERROR?"default":"pointer","&:focus-visible":{outline:0,boxShadow:`inset 3px 0 0 0 ${call.status===CallStates.ERROR?theme2.color.warning:theme2.color.secondary}`,background:call.status===CallStates.ERROR?"transparent":theme2.background.hoverable},"& > div":{opacity:call.status===CallStates.WAITING?.5:1}})),RowActions=styled.div({padding:6}),StyledIconButton2=styled(IconButton)(({theme:theme2})=>({color:theme2.textMutedColor,margin:"0 3px"})),Note2=styled(TooltipNote)(({theme:theme2})=>({fontFamily:theme2.typography.fonts.base})),RowMessage=styled("div")(({theme:theme2})=>({padding:"8px 10px 8px 36px",fontSize:typography.size.s1,color:theme2.color.defaultText,pre:{margin:0,padding:0}})),Exception=({exception})=>{if(isJestError(exception))return React10.createElement(MatcherResult,{...exception});let paragraphs=exception.message.split(`
20
20
 
21
- `),more=paragraphs.length>1;return React10.createElement(RowMessage,null,React10.createElement("pre",null,paragraphs[0]),exception.showDiff&&exception.diff?React10.createElement(React10.Fragment,null,React10.createElement("br",null),React10.createElement(MatcherResult,{message:exception.diff,style:{padding:0}})):React10.createElement("pre",null,React10.createElement("br",null),exception.expected&&React10.createElement(React10.Fragment,null,"Expected: ",React10.createElement(Expected,{value:exception.expected}),React10.createElement("br",null)),exception.actual&&React10.createElement(React10.Fragment,null,"Received: ",React10.createElement(Received,{value:exception.actual}),React10.createElement("br",null))),more&&React10.createElement("p",null,"See the full stack trace in the browser console."))},Interaction=({call,callsById,controls,controlStates,childCallIds,isHidden,isCollapsed,toggleCollapsed,pausedAt})=>{let[isHovered,setIsHovered]=React10.useState(!1),isInteractive=!controlStates.goto||!call.interceptable||!!call.ancestors.length;return isHidden?null:React10.createElement(RowContainer,{call,pausedAt},React10.createElement(RowHeader,{isInteractive},React10.createElement(RowLabel,{"aria-label":"Interaction step",call,onClick:()=>controls.goto(call.id),disabled:isInteractive,onMouseEnter:()=>controlStates.goto&&setIsHovered(!0),onMouseLeave:()=>controlStates.goto&&setIsHovered(!1)},React10.createElement(StatusIcon,{status:isHovered?CallStates.ACTIVE:call.status}),React10.createElement(MethodCallWrapper,{style:{marginLeft:6,marginBottom:1}},React10.createElement(MethodCall,{call,callsById}))),React10.createElement(RowActions,null,childCallIds?.length>0&&React10.createElement(WithTooltip,{hasChrome:!1,tooltip:React10.createElement(Note2,{note:`${isCollapsed?"Show":"Hide"} interactions`})},React10.createElement(StyledIconButton2,{containsIcon:!0,onClick:toggleCollapsed},React10.createElement(ListUnorderedIcon,null))))),call.status===CallStates.ERROR&&call.exception?.callId===call.id&&React10.createElement(Exception,{exception:call.exception}))};var Container=styled.div(({theme:theme2,withException})=>({minHeight:"100%",background:theme2.background.content,...withException&&{backgroundColor:theme2.base==="dark"?transparentize(.93,theme2.color.negative):theme2.background.warning}})),CaughtException=styled.div(({theme:theme2})=>({padding:15,fontSize:theme2.typography.size.s2-1,lineHeight:"19px"})),CaughtExceptionCode=styled.code(({theme:theme2})=>({margin:"0 1px",padding:3,fontSize:theme2.typography.size.s1-1,lineHeight:1,verticalAlign:"top",background:"rgba(0, 0, 0, 0.05)",border:`1px solid ${theme2.appBorderColor}`,borderRadius:3})),CaughtExceptionTitle=styled.div({paddingBottom:4,fontWeight:"bold"}),CaughtExceptionDescription=styled.p({margin:0,padding:"0 0 20px"}),CaughtExceptionStack=styled.pre(({theme:theme2})=>({margin:0,padding:0,fontSize:theme2.typography.size.s1-1})),InteractionsPanel=React10.memo(function({calls,controls,controlStates,interactions,fileName,hasException,caughtException,isPlaying,pausedAt,onScrollToEnd,endRef}){return React10.createElement(Container,{withException:!!caughtException},(interactions.length>0||hasException)&&React10.createElement(Subnav,{controls,controlStates,status:isPlaying?CallStates.ACTIVE:hasException?CallStates.ERROR:CallStates.DONE,storyFileName:fileName,onScrollToEnd}),React10.createElement("div",{"aria-label":"Interactions list"},interactions.map(call=>React10.createElement(Interaction,{key:call.id,call,callsById:calls,controls,controlStates,childCallIds:call.childCallIds,isHidden:call.isHidden,isCollapsed:call.isCollapsed,toggleCollapsed:call.toggleCollapsed,pausedAt}))),caughtException&&!caughtException.message?.startsWith("ignoredException")&&React10.createElement(CaughtException,null,React10.createElement(CaughtExceptionTitle,null,"Caught exception in ",React10.createElement(CaughtExceptionCode,null,"play")," function"),React10.createElement(CaughtExceptionDescription,null,"This story threw an error after it finished rendering which means your interactions couldn' t be run.Go to this story' s play function in ",fileName," to fix."),React10.createElement(CaughtExceptionStack,{"data-chromatic":"ignore"},caughtException.stack||`${caughtException.name}: ${caughtException.message}`)),React10.createElement("div",{ref:endRef}),!isPlaying&&!caughtException&&interactions.length===0&&React10.createElement(Placeholder,null,"No interactions found",React10.createElement(Link,{href:"https://storybook.js.org/docs/react/writing-stories/play-function",target:"_blank",withArrow:!0},"Learn how to add interactions to your story")))});var INITIAL_CONTROL_STATES={start:!1,back:!1,goto:!1,next:!1,end:!1},getInteractions=({log,calls,collapsed,setCollapsed})=>{let callsById=new Map,childCallMap=new Map;return log.map(({callId,ancestors,status})=>{let isHidden=!1;return ancestors.forEach(ancestor=>{collapsed.has(ancestor)&&(isHidden=!0),childCallMap.set(ancestor,(childCallMap.get(ancestor)||[]).concat(callId));}),{...calls.get(callId),status,isHidden}}).map(call=>{let status=call.status===CallStates.ERROR&&callsById.get(call.ancestors.slice(-1)[0])?.status===CallStates.ACTIVE?CallStates.ACTIVE:call.status;return callsById.set(call.id,{...call,status}),{...call,status,childCallIds:childCallMap.get(call.id),isCollapsed:collapsed.has(call.id),toggleCollapsed:()=>setCollapsed(ids=>(ids.has(call.id)?ids.delete(call.id):ids.add(call.id),new Set(ids)))}})},Panel=memo(function({storyId}){let[addonState,set]=useAddonState(ADDON_ID,{controlStates:INITIAL_CONTROL_STATES,isErrored:!1,pausedAt:void 0,interactions:[],isPlaying:!1,hasException:!1,caughtException:void 0,interactionsCount:0}),[scrollTarget,setScrollTarget]=useState(void 0),[collapsed,setCollapsed]=useState(new Set),{controlStates=INITIAL_CONTROL_STATES,isErrored=!1,pausedAt=void 0,interactions=[],isPlaying=!1,caughtException=void 0}=addonState,log=useRef([]),calls=useRef(new Map),setCall=({status,...call})=>calls.current.set(call.id,call),endRef=useRef();useEffect(()=>{let observer;return global.IntersectionObserver&&(observer=new global.IntersectionObserver(([end])=>setScrollTarget(end.isIntersecting?void 0:end.target),{root:global.document.querySelector("#panel-tab-content")}),endRef.current&&observer.observe(endRef.current)),()=>observer?.disconnect()},[]);let emit=useChannel({[EVENTS.CALL]:setCall,[EVENTS.SYNC]:payload=>{set(s=>{let list=getInteractions({log:payload.logItems,calls:calls.current,collapsed,setCollapsed});return {...s,controlStates:payload.controlStates,pausedAt:payload.pausedAt,interactions:list,interactionsCount:list.filter(({method})=>method!=="step").length}}),log.current=payload.logItems;},[STORY_RENDER_PHASE_CHANGED]:event=>{if(event.newPhase==="preparing"){set({controlStates:INITIAL_CONTROL_STATES,isErrored:!1,pausedAt:void 0,interactions:[],isPlaying:!1,hasException:!1,caughtException:void 0,interactionsCount:0});return}set(s=>({...s,isPlaying:event.newPhase==="playing",pausedAt:void 0,...event.newPhase==="rendering"?{isErrored:!1,caughtException:void 0}:{}}));},[STORY_THREW_EXCEPTION]:()=>{set(s=>({...s,isErrored:!0}));},[PLAY_FUNCTION_THREW_EXCEPTION]:e=>{e?.message!==IGNORED_EXCEPTION.message?set(s=>({...s,caughtException:e})):set(s=>({...s,caughtException:void 0}));}},[collapsed]);useEffect(()=>{set(s=>{let list=getInteractions({log:log.current,calls:calls.current,collapsed,setCollapsed});return {...s,interactions:list,interactionsCount:list.filter(({method})=>method!=="step").length}});},[collapsed]);let controls=useMemo(()=>({start:()=>emit(EVENTS.START,{storyId}),back:()=>emit(EVENTS.BACK,{storyId}),goto:callId=>emit(EVENTS.GOTO,{storyId,callId}),next:()=>emit(EVENTS.NEXT,{storyId}),end:()=>emit(EVENTS.END,{storyId}),rerun:()=>{emit(FORCE_REMOUNT,{storyId});}}),[storyId]),storyFilePath=useParameter("fileName",""),[fileName]=storyFilePath.toString().split("/").slice(-1),scrollToTarget=()=>scrollTarget?.scrollIntoView({behavior:"smooth",block:"end"}),hasException=!!caughtException||interactions.some(v=>v.status===CallStates.ERROR);return isErrored?React10__default.createElement(Fragment,{key:"interactions"}):React10__default.createElement(Fragment,{key:"interactions"},React10__default.createElement(InteractionsPanel,{calls:calls.current,controls,controlStates,interactions,fileName,hasException,caughtException,isPlaying,pausedAt,endRef,onScrollToEnd:scrollTarget&&scrollToTarget}))});var TabIcon=styled(StatusIcon)({marginLeft:5});function Title(){let[addonState={}]=useAddonState(ADDON_ID),{hasException,interactionsCount}=addonState;return React10__default.createElement("div",null,React10__default.createElement(Spaced,{col:1},React10__default.createElement("span",{style:{display:"inline-block",verticalAlign:"middle"}},"Interactions"),interactionsCount&&!hasException?React10__default.createElement(Badge,{status:"neutral"},interactionsCount):null,hasException?React10__default.createElement(TabIcon,{status:CallStates.ERROR}):null))}addons.register(ADDON_ID,api=>{addons.add(PANEL_ID,{type:types.PANEL,title:Title,match:({viewMode})=>viewMode==="story",render:({active})=>{let newLocal=useCallback(({state})=>({storyId:state.storyId}),[]);return React10__default.createElement(AddonPanel,{active},React10__default.createElement(Consumer,{filter:newLocal},({storyId})=>React10__default.createElement(Panel,{storyId})))}});});
21
+ `),more=paragraphs.length>1;return React10.createElement(RowMessage,null,React10.createElement("pre",null,paragraphs[0]),exception.showDiff&&exception.diff?React10.createElement(React10.Fragment,null,React10.createElement("br",null),React10.createElement(MatcherResult,{message:exception.diff,style:{padding:0}})):React10.createElement("pre",null,React10.createElement("br",null),exception.expected&&React10.createElement(React10.Fragment,null,"Expected: ",React10.createElement(Expected,{value:exception.expected}),React10.createElement("br",null)),exception.actual&&React10.createElement(React10.Fragment,null,"Received: ",React10.createElement(Received,{value:exception.actual}),React10.createElement("br",null))),more&&React10.createElement("p",null,"See the full stack trace in the browser console."))},Interaction=({call,callsById,controls,controlStates,childCallIds,isHidden,isCollapsed,toggleCollapsed,pausedAt})=>{let[isHovered,setIsHovered]=React10.useState(!1),isInteractive=!controlStates.goto||!call.interceptable||!!call.ancestors.length;return isHidden?null:React10.createElement(RowContainer,{call,pausedAt},React10.createElement(RowHeader,{isInteractive},React10.createElement(RowLabel,{"aria-label":"Interaction step",call,onClick:()=>controls.goto(call.id),disabled:isInteractive,onMouseEnter:()=>controlStates.goto&&setIsHovered(!0),onMouseLeave:()=>controlStates.goto&&setIsHovered(!1)},React10.createElement(StatusIcon,{status:isHovered?CallStates.ACTIVE:call.status}),React10.createElement(MethodCallWrapper,{style:{marginLeft:6,marginBottom:1}},React10.createElement(MethodCall,{call,callsById}))),React10.createElement(RowActions,null,childCallIds?.length>0&&React10.createElement(WithTooltip,{hasChrome:!1,tooltip:React10.createElement(Note2,{note:`${isCollapsed?"Show":"Hide"} interactions`})},React10.createElement(StyledIconButton2,{containsIcon:!0,onClick:toggleCollapsed},React10.createElement(ListUnorderedIcon,null))))),call.status===CallStates.ERROR&&call.exception?.callId===call.id&&React10.createElement(Exception,{exception:call.exception}))};var Container=styled.div(({theme:theme2})=>({minHeight:"100%",background:theme2.background.content})),CaughtException=styled.div(({theme:theme2})=>({borderBottom:`1px solid ${theme2.appBorderColor}`,backgroundColor:theme2.base==="dark"?transparentize(.93,theme2.color.negative):theme2.background.warning,padding:15,fontSize:theme2.typography.size.s2-1,lineHeight:"19px"})),CaughtExceptionCode=styled.code(({theme:theme2})=>({margin:"0 1px",padding:3,fontSize:theme2.typography.size.s1-1,lineHeight:1,verticalAlign:"top",background:"rgba(0, 0, 0, 0.05)",border:`1px solid ${theme2.appBorderColor}`,borderRadius:3})),CaughtExceptionTitle=styled.div({paddingBottom:4,fontWeight:"bold"}),CaughtExceptionDescription=styled.p({margin:0,padding:"0 0 20px"}),CaughtExceptionStack=styled.pre(({theme:theme2})=>({margin:0,padding:0,"&:not(:last-child)":{paddingBottom:16},fontSize:theme2.typography.size.s1-1})),InteractionsPanel=React10.memo(function({calls,controls,controlStates,interactions,fileName,hasException,caughtException,unhandledErrors,isPlaying,pausedAt,onScrollToEnd,endRef}){return React10.createElement(Container,null,(interactions.length>0||hasException)&&React10.createElement(Subnav,{controls,controlStates,status:isPlaying?CallStates.ACTIVE:hasException?CallStates.ERROR:CallStates.DONE,storyFileName:fileName,onScrollToEnd}),React10.createElement("div",{"aria-label":"Interactions list"},interactions.map(call=>React10.createElement(Interaction,{key:call.id,call,callsById:calls,controls,controlStates,childCallIds:call.childCallIds,isHidden:call.isHidden,isCollapsed:call.isCollapsed,toggleCollapsed:call.toggleCollapsed,pausedAt}))),caughtException&&!isTestAssertionError(caughtException)&&React10.createElement(CaughtException,null,React10.createElement(CaughtExceptionTitle,null,"Caught exception in ",React10.createElement(CaughtExceptionCode,null,"play")," function"),React10.createElement(CaughtExceptionStack,{"data-chromatic":"ignore"},printSerializedError(caughtException))),unhandledErrors&&React10.createElement(CaughtException,null,React10.createElement(CaughtExceptionTitle,null,"Unhandled Errors"),React10.createElement(CaughtExceptionDescription,null,"Found ",unhandledErrors.length," unhandled error",unhandledErrors.length>1?"s":""," ","while running the play function. This might cause false positive assertions. Resolve unhandled errors or ignore unhandled errors with setting the",React10.createElement(CaughtExceptionCode,null,"test.dangerouslyIgnoreUnhandledErrors")," ","parameter to ",React10.createElement(CaughtExceptionCode,null,"true"),"."),unhandledErrors.map((error,i)=>React10.createElement(CaughtExceptionStack,{key:i,"data-chromatic":"ignore"},printSerializedError(error)))),React10.createElement("div",{ref:endRef}),!isPlaying&&!caughtException&&interactions.length===0&&React10.createElement(Placeholder,null,"No interactions found",React10.createElement(Link,{href:"https://storybook.js.org/docs/react/writing-stories/play-function",target:"_blank",withArrow:!0},"Learn how to add interactions to your story")))});function printSerializedError(error){return error.stack||`${error.name}: ${error.message}`}var INITIAL_CONTROL_STATES={start:!1,back:!1,goto:!1,next:!1,end:!1},getInteractions=({log,calls,collapsed,setCollapsed})=>{let callsById=new Map,childCallMap=new Map;return log.map(({callId,ancestors,status})=>{let isHidden=!1;return ancestors.forEach(ancestor=>{collapsed.has(ancestor)&&(isHidden=!0),childCallMap.set(ancestor,(childCallMap.get(ancestor)||[]).concat(callId));}),{...calls.get(callId),status,isHidden}}).map(call=>{let status=call.status===CallStates.ERROR&&callsById.get(call.ancestors.slice(-1)[0])?.status===CallStates.ACTIVE?CallStates.ACTIVE:call.status;return callsById.set(call.id,{...call,status}),{...call,status,childCallIds:childCallMap.get(call.id),isCollapsed:collapsed.has(call.id),toggleCollapsed:()=>setCollapsed(ids=>(ids.has(call.id)?ids.delete(call.id):ids.add(call.id),new Set(ids)))}})},Panel=memo(function({storyId}){let[addonState,set]=useAddonState(ADDON_ID,{controlStates:INITIAL_CONTROL_STATES,isErrored:!1,pausedAt:void 0,interactions:[],isPlaying:!1,hasException:!1,caughtException:void 0,interactionsCount:0,unhandledErrors:void 0}),[scrollTarget,setScrollTarget]=useState(void 0),[collapsed,setCollapsed]=useState(new Set),{controlStates=INITIAL_CONTROL_STATES,isErrored=!1,pausedAt=void 0,interactions=[],isPlaying=!1,caughtException=void 0,unhandledErrors=void 0}=addonState,log=useRef([]),calls=useRef(new Map),setCall=({status,...call})=>calls.current.set(call.id,call),endRef=useRef();useEffect(()=>{let observer;return global.IntersectionObserver&&(observer=new global.IntersectionObserver(([end])=>setScrollTarget(end.isIntersecting?void 0:end.target),{root:global.document.querySelector("#panel-tab-content")}),endRef.current&&observer.observe(endRef.current)),()=>observer?.disconnect()},[]);let emit=useChannel({[EVENTS.CALL]:setCall,[EVENTS.SYNC]:payload=>{set(s=>{let list=getInteractions({log:payload.logItems,calls:calls.current,collapsed,setCollapsed});return {...s,controlStates:payload.controlStates,pausedAt:payload.pausedAt,interactions:list,interactionsCount:list.filter(({method})=>method!=="step").length}}),log.current=payload.logItems;},[STORY_RENDER_PHASE_CHANGED]:event=>{if(event.newPhase==="preparing"){set({controlStates:INITIAL_CONTROL_STATES,isErrored:!1,pausedAt:void 0,interactions:[],isPlaying:!1,hasException:!1,caughtException:void 0,interactionsCount:0,unhandledErrors:void 0});return}set(s=>({...s,isPlaying:event.newPhase==="playing",pausedAt:void 0,...event.newPhase==="rendering"?{isErrored:!1,caughtException:void 0}:{}}));},[STORY_THREW_EXCEPTION]:()=>{set(s=>({...s,isErrored:!0}));},[PLAY_FUNCTION_THREW_EXCEPTION]:e=>{set(s=>({...s,caughtException:e}));},[UNHANDLED_ERRORS_WHILE_PLAYING]:e=>{set(s=>({...s,unhandledErrors:e}));}},[collapsed]);useEffect(()=>{set(s=>{let list=getInteractions({log:log.current,calls:calls.current,collapsed,setCollapsed});return {...s,interactions:list,interactionsCount:list.filter(({method})=>method!=="step").length}});},[collapsed]);let controls=useMemo(()=>({start:()=>emit(EVENTS.START,{storyId}),back:()=>emit(EVENTS.BACK,{storyId}),goto:callId=>emit(EVENTS.GOTO,{storyId,callId}),next:()=>emit(EVENTS.NEXT,{storyId}),end:()=>emit(EVENTS.END,{storyId}),rerun:()=>{emit(FORCE_REMOUNT,{storyId});}}),[storyId]),storyFilePath=useParameter("fileName",""),[fileName]=storyFilePath.toString().split("/").slice(-1),scrollToTarget=()=>scrollTarget?.scrollIntoView({behavior:"smooth",block:"end"}),hasException=!!caughtException||!!unhandledErrors||interactions.some(v=>v.status===CallStates.ERROR);return isErrored?React10__default.createElement(Fragment,{key:"interactions"}):React10__default.createElement(Fragment,{key:"interactions"},React10__default.createElement(InteractionsPanel,{calls:calls.current,controls,controlStates,interactions,fileName,hasException,caughtException,unhandledErrors,isPlaying,pausedAt,endRef,onScrollToEnd:scrollTarget&&scrollToTarget}))});var TabIcon=styled(StatusIcon)({marginLeft:5});function Title(){let[addonState={}]=useAddonState(ADDON_ID),{hasException,interactionsCount}=addonState;return React10__default.createElement("div",null,React10__default.createElement(Spaced,{col:1},React10__default.createElement("span",{style:{display:"inline-block",verticalAlign:"middle"}},"Interactions"),interactionsCount&&!hasException?React10__default.createElement(Badge,{status:"neutral"},interactionsCount):null,hasException?React10__default.createElement(TabIcon,{status:CallStates.ERROR}):null))}addons.register(ADDON_ID,api=>{addons.add(PANEL_ID,{type:types.PANEL,title:Title,match:({viewMode})=>viewMode==="story",render:({active})=>{let newLocal=useCallback(({state})=>({storyId:state.storyId}),[]);return React10__default.createElement(AddonPanel,{active},React10__default.createElement(Consumer,{filter:newLocal},({storyId})=>React10__default.createElement(Panel,{storyId})))}});});