UNPKG

63.3 kBJavaScriptView Raw
1!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("dsmStorybookNode",[],t):"object"==typeof exports?exports.dsmStorybookNode=t():e.dsmStorybookNode=t()}(global,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=67)}([function(e,t){const n="Please contact support@invisionapp.com.",o="https://support.invisionapp.com",r="https://support.invisionapp.com/hc/en-us/articles/115005674286",i={configurationAlreadyLoaded:()=>`Attempting to initialize an already loaded build configuration. ${n}`,configNotReady:()=>`Attempt to read uninitialized configuration. ${n}`,configLoadFailed:()=>`Failed to load configuration. ${n}`,missingConfigurationKey:e=>`Missing configuration key: ${e}. Please ensure to include a configuration key in the .dsmrc file, or pass the key as a command line argument.`,configurationFileNotFound:e=>`Could not find required configuration, please create a "${e}" file or provide commandline arguments.`,analysisWritten:e=>`Analysis result written to file ${e}.`,creatingStorybookBundle:()=>"Creating Storybook bundle...",projectRootNotFound:()=>"Could not determine project root directory, package.json not found. Please ensure to run the command from the project root.",verifyingCliVersion:e=>`Verifying dsm-storybook version (${e}) is valid...`,unknownStorybookVersion:()=>`Could not detect dsm-storybook version. Please verify your setup. For further assistance visit (${o}).`,verifyingOrganizationSubscription:e=>`Verifying ${e} subscription...`,storybookBuildFailed:()=>`Failed to build Storybook. For further assistance visit (${o}).`,assetUploadComplete:()=>"Asset upload complete.",updatingDsm:()=>"updating DSM...",unmatchedComponentContainerIds:()=>"The following component container IDs are used in stories, but no matching IDs were found in DSM. DSM will not display stories with these IDs.",noDsmStoriesFound:()=>`No stories with DSM component container IDs were found. For further assistance visit (${o}).`,storybookNotDetected:()=>"Failed to detect Storybook framework. Please ensure you installed Storybook for your selected UI library correctly. See https://storybook.js.org/basics/slow-start-guide/ for details.",storyboookMissingInPackageJson:()=>"Failed to get @storybook NPM packages. Please ensure Storybook is properly installed.",storybookMissingInNodeModules:()=>'Failed to find installed "node_modules" Storybook packages. Try running "npm install".',packageMissingInNodeModules:e=>`Package ${e} was not found in node_modules directory. Try running "npm install".`,uploadingFile:e=>`Uploading file: ${e}...`,uploadComplete:e=>`Upload complete: ${e}`,uploadError:e=>`Upload failed: ${e}`,previewServerStarted:e=>`DSM storybook preview-data server is listening on port: ${e}`,enterpriseGating:()=>`Publishing stories to DSM is only available on the DSM Enterprise plan. Visit ${r} to learn more.`,subscriptionVerificationFailed:e=>`Could not verify ${e} subscription plan. Please check your connection.`,cliVersionVerificationFailed:()=>"Could not verify @invisionapp/dsm-storybook version. Please check your connection",cliUpgradeRequired:(e,t)=>`Please upgrade @invisionapp/dsm-storybook. Your version (${e}) is out of date (minimum supported version: ${t})`,oneReturnStatementPerStory:()=>"A story must have 1 explicit return statement",storyMustReturnObject:()=>"A story must return an object",templateMustBeString:()=>"Template property must be a string",noSampleCodeIfNoTemplate:()=>"No sample code will be displayed for a story with no template prop",invalidStory:()=>"Invalid story",missingComponentPath:()=>"componentPath is not provided in in-dsm, can't generate props table info",invalidComponentProp:()=>"Invalid component property for story",sampleCodeNotAvailable:()=>"Sample code is not available (please check output log for warnings/errors)",passedEmptyKey:e=>`You passed an empty key '${e}'`,dsmInfoErrorsTableTitle:(e,t)=>`The following problems were detected in 'dsm-info' configuration object in story '${e}' of '${t}':`,missingRequiredKey:e=>`Missing required key '${e}'`,missingKeyInVersionFromFile:e=>`Failed to find a version key in 'versionFilePath': ${e}`,failedWithFallbackVersionFromFile:e=>`Failed to load 'versionFilePath': ${e}, falling back to 'version'.`,failedVersionFromFile:e=>`Failed to load 'versionFilePath': ${e}`,dsmUpdateComplete:e=>`DSM update complete. buildId: ${e}`,prettierConfigFound:()=>"Custom prettier configuration was found for this project",prettierConfigNotFound:()=>"Custom prettier configuration was not found for this project",analyzingFile:e=>`Analyzing file ${e}`,noStoryFilesMatchingSearchPattern:e=>`No story files matching search pattern: ${e}`,failedToAnalyzeFile:e=>`Failed to analyze story source file "${e}"`,failedToReadStorySourceFile:e=>`Failed to read story source file "${e}"`,failedToParseStorySourceFile:e=>`Failed to parse story source file "${e}"`,missingDocumentationFilePath:()=>'"docFilePath" is not provided in "in-dsm", can\'t generate prop table information',failedToLoadDocumentationFile:e=>`Failed to load documentation file "${e}"`,missingMandatoryFieldInDocumentationFile:e=>`Missing mandatory field "${e}" in documentation file for one of the items`,containerClassNotFound:e=>`No containers with the class "${e} found. Make sure to add the class to the container.`,multipleContainerClassesFound:e=>`More than 1 containers with the class "${e}" detected. Make sure the classname is unique.`,failedToExtractSampleCode:()=>`Failed to extract sample code. ${n}`,failedToParseInDsmInformation:(e,t)=>`Parsing of "${e}" (type: "${t}") failed while trying to extract in-dsm options. ${n}`,moreThanOneCallToInitDsm:e=>`More than 1 call to "initDsm" found in ${e}.\n There should only be 1 call to "initDsm".\n For further assistance visit ${o}`,noInitDsmCallFound:e=>`Didn't find any call to initialize DSM Storybook in ${e}`,initDsmWrongArgument:()=>'"initDsm" takes only one object argument.',initDsmMissingParameters:e=>`Please initialize DSM Storybook according to the instructions at help page.\n Missing parameters: ${e.join(", ")}`,moreThanOneCallToConfigure:e=>`More than 1 call to "configure" found in ${e}.\n There should be only 1 call to configure inside "initDsm" "callback" parameter.\n For further assistance visit ${o}`,failedToReadStorybookConfigFile:e=>`Failed to read Storybook config file "${e}"`,failedToParseStorybookConfigFile:()=>"Failed to parse Storybook config file.",providedFrameworkIsIncorrect:e=>`The framework '${e}' provided from '.dsmrc' file is incorrect. Make sure you written it correctly inside the '.dsmrc' file. For further assistance visit ${o}`,usingFrameworkFromConfiguration:e=>`Using framework '${e}' from '.dsmrc' configuration file`,moreThanOneStorybookFrameworkDetected:()=>"More than 1 Storybook UI framework dependencies detected. You can set the UI framework you want to use explicitly inside the '.dsmrc' file or make sure only 1 '@storybook/<framework>' is inside the 'package.json' file.",explicitFrameworkNotDetectedInInstalledPackages:e=>`Failed to detect the framework '${e}' that was provided in '.dsmrc' file. Please ensure you installed Storybook for your selected UI library correctly. See https://storybook.js.org/basics/slow-start-guide/ for details.`};e.exports=i},function(e,t){e.exports=require("@babel/types")},function(e,t,n){const o=n(53),r=n(69),{createErrorLogFile:i}=n(54),s=n(70)({prefixText:o.cyan("DSM => ")});e.exports={info:e=>s.stopAndPersist({text:e}),warning:e=>s.stopAndPersist({text:o.yellow(e)}),success:e=>s.succeed(e),progress:e=>{s.start(),s.text=e},error:(e,t,{storyFilePath:n,storySourceCode:a,storyMetadata:u}={})=>{const c=`${(e=>e&&r(e)?e:e.stack)(e)} ${t?`\n${t.stack}`:""}`;return i({errorMessage:c,storyFilePath:n,storySourceCode:a,storyMetadata:u}),s.fail(o.red(c))}}},function(e,t){e.exports=require("lodash/isEmpty")},function(e,t){e.exports={DSM_ADDON_NAME:"invision-dsm",DSM_INFO_OBJECT_KEY:"in-dsm",STORY_SELECTED_EVENT:"invision-dsm/on_story_selected",HTML_SAMPLE_CODE_CHANGED_EVENT:"invision-dsm/on_html_sample_code_changed",INIT_DSM_REGISTERED_EVENT:"invision-dsm/on_init_dsm_registered",INIT_DSM_EVENT:"invision-dsm/on_init_dsm",INJECTED_SOURCE_PLACEHOLDER:"__DSM_INJECTED_SOURCE__",KNOBS_SET_EVENT:"addon:knobs:setKnobs",KNOBS_SET_EVENT_V5_1:"storybookjs/knobs/set",STORY_CHANGED_EVENT:"storyChanged",STORYBOOK_ENV_VARIABLE:"STORYBOOK_DSM",WINDOW_MODES:{normal:"normal",fullscreen:"fullscreen"},WINDOW_MODE_PARAM:"mode",FRAMEWORKS:{html:"html",react:"react",angular:"angular",vue:"vue"}}},function(e,t){e.exports=require("@babel/traverse")},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("lodash")},function(e,t,n){const o=n(17);e.exports=function(e,t="javascript"){return function(e){if("javascript"===e)return o.parsers.babylon;throw new Error(`Parser unsupported: "${e}"`)}(t).parse(e)}},function(e,t){e.exports=require("prettier/standalone")},function(e,t){e.exports=require("fs-extra")},function(e,t){e.exports=require("lodash/get")},function(e,t,n){const o=n(1),r=n(39);e.exports={getAvailableKnobsFunctions:function(e){const t=r(e,{moduleName:"@storybook/addon-knobs"});return t?t.bindings:[]},isKnownKnobMethodCall:function(e,t){return!(!o.isCallExpression(e)||!o.isIdentifier(e.callee))&&(0!==e.arguments.length&&t.includes(e.callee.name))},extractKnobProperties:function(e){const t=e.arguments,n={knobLabel:t[0].value},o=function(e){switch(e){case"select":case"radios":case"files":case"optionsKnob":case"options":return 2;case"button":return null;default:return 1}}(e.callee.name);return o&&t.length>o&&(n.value=t[o].value),n}}},function(module,exports){function getChildrenString(e,t){return e.reduce((e,n)=>{return`${e}${hasValueSet(n,t)?getFieldValue(n,t):""}`},"")}function getFieldValue(e,t){return hasKnobValue(e,t)?t[e.knobLabel].value:e.value}function hasKnobValue(e,t){return!(!t||!e.knobLabel)&&(t.hasOwnProperty(e.knobLabel)&&hasValueSet(t[e.knobLabel]))}function hasValueSet(e,t){return e.hasOwnProperty("value")||t&&hasKnobValue(e,t)}function isDefaultValue(e,t){if(!e||!e.defaultValue)return!t;return getDefaultValueString(e.type.name,e.defaultValue.value)===JSON.stringify(t)}function getDefaultValueString(e,t){if(["object","array","objectOf","arrayOf"].includes(e)){const e=tryToEvalValue(t);if(e)return JSON.stringify(e)}return normalizeWrappingQuotes(t)}function tryToEvalValue(value){let defaultValueEval;try{defaultValueEval=eval(value)}catch(e){}return defaultValueEval}function normalizeWrappingQuotes(e){return e?e[0]!==e.slice(-1)?e:"'"===e[0]?`"${e.slice(1,-1)}"`:e:e}function getPropValueString(e){return"object"==typeof e?JSON.stringify(e).replace(/"/g,"'"):e.toString()}module.exports={getChildrenString:getChildrenString,getFieldValue:getFieldValue,getPropValueString:getPropValueString,hasValueSet:hasValueSet,isDefaultValue:isDefaultValue}},function(e,t){e.exports=require("prettier/parser-html")},function(e,t){e.exports=require("fs")},function(e,t){e.exports={STORYBOOK_BUILD_FOLDER:"storybook",CLI_CLIENT_NAME:"dsm_storybook_cli",FRAMEWORKS:{react:"react",reactNative:"react-native",vue:"vue",angular:"angular",mithril:"mithril",marko:"marko",html:"html",svelte:"svelte",ember:"ember",riot:"riot"}}},function(e,t){e.exports=require("prettier/parser-babylon")},function(e,t,n){const o=n(1),{forEach:r}=n(7),i=n(0);e.exports={isFunction:e=>o.isArrowFunctionExpression(e)||o.isFunctionExpression(e),findPropertyNodeByKey:(e,t)=>e.properties.find(e=>{return(e.key.value||e.key.name)===t}),objectExpressionToJsObject:function e(t,n=!0,s={}){return r(t.properties,t=>{const r=t.key.value||t.key.name;if(o.isLiteral(t.value))s[r]=t.value.value;else if(o.isIdentifier(t.value))s[r]=t.value.name;else if(o.isObjectExpression(t.value))s[r]=e(t.value);else if(n)throw new Error(i.failedToParseInDsmInformation(r,t.value.type))}),s}}},function(e,t){e.exports=require("semver")},function(e,t,n){const o=n(6),r=n(10),i=n(11),s=n(57),a=["js","jsx","ts","tsx"];function u(e,t){if(!t)return null;let n=o.resolve(o.parse(e).dir,t);if(r.existsSync(n)){const e=r.lstatSync(n);if(e.isDirectory())n=o.join(n,"index");else if(e.isFile())return n}let i=null;return s(a,e=>{const t=`${n}.${e}`;if(r.existsSync(t))return i=t,!1}),i}e.exports={resolveFromComponentName:function(e,t={},n,o){if(!e)return;const r=function(e,t,n){if(e.componentPath)return e.componentPath;return i(t[n],"path.parent.source.value")||i(t[n],'path.node.init.object.arguments["0"].value')}(t,i(n,"scope.bindings")||{},e);return r?u(o,r):void 0},resolveFromComponentPath:u}},function(e,t,n){const{CustomError:o}=n(22);e.exports={FrameworkAnalyzerError:class extends o{constructor(e,...t){super(...t),this.name="FrameworkAnalyzerError",this.isFatal=e}}}},function(e,t){class n extends Error{constructor(...e){super(...e),Error.captureStackTrace&&Error.captureStackTrace(this,n)}}e.exports={CustomError:n}},function(e,t,n){const o=n(5).default,r=n(1),i=n(8),s=n(11);function a(e,t){const n=function(e){const t=i(e);return function(e){if(!e)return!1;const t=s(e,"program.body[0]");return r.isExpressionStatement(t)&&(r.isJSXElement(t.expression)||r.isJSXFragment(t.expression))}(t)?t:null}(e);if(!n)return null;const a=function(e){const t=e.component;if(t)return e=>e===t;return e=>e[0]!==e[0].toLowerCase()&&"Fragment"!==e}(t);let u=null;return o(n,{JSXElement(e){const t=s(e,"node.openingElement.name.name");t&&a(t)&&(u=e.node,e.stop())}}),u}e.exports={getStorySubject:a,getComponentName:function(e,t){const n=a(e,t);return n?n.openingElement.name.name:null}}},function(e,t,n){"use strict";n.r(t),n.d(t,"getByVersion",(function(){return i})),n.d(t,"resolvers",(function(){return s}));const{UnsupportedVersionError:o}=n(29),{versionResolvers:r}=n(30),i=(e,t)=>{const n=r[e](t);if(!n)throw new o(t);return n},s={getStoryUrlParams:"getStoryUrlParamsResolver",initDsmParams:"initDsmParamsResolver"}},function(e,t,n){const o={sampleCodeAnalyzers:{react:n(38),vue:n(40),angular:n(43),html:()=>{}},sampleCodeBuilders:{react:n(46),vue:n(47),angular:n(49),html:n(50)}},r=(e,t)=>{const n=t[e];if(!n)throw`Unsupported framework detected: ${e}`;return n};e.exports={getSampleCodeAnalyzer:e=>r(e,o.sampleCodeAnalyzers),getSampleCodeBuilder:e=>r(e,o.sampleCodeBuilders)}},function(e,t){e.exports=require("glob")},function(e,t,n){const o=n(5).default,r=n(1),i=n(8),{isFunction:s}=n(18),a=e=>{if(s(e))return e;if(!r.isCallExpression(e))return null;for(let t=0;t<e.arguments.length;t++){let n=e.arguments[t];if(s(n))return n;if(r.isCallExpression(n))return a(n)}},u=e=>{const t=[];return o(e,{ReturnStatement(e){t.push(e.node)}}),{returnStatements:t,ast:e}};e.exports={getStoryCodeNode:a,findReturnStatementNodesBySource:e=>{const t=i(e);return u(t)},findReturnStatementsNodesByAst:u}},function(e,t,n){const o=n(15),r=n(2),i=n(0),s=n(5).default;e.exports={getConfigSourceCode:function(e){try{return o.readFileSync(e,"utf8")}catch(t){return r.error(i.failedToReadStorybookConfigFile(e),t),null}},getCallExpressionsToValidate:function(e,t){const n=[];return s(e,{CallExpression(e){e.node.callee.name===t&&n.push(e.node)}}),n}}},function(e,t,n){const{CustomError:o}=n(22);e.exports={ModuleNotFoundError:class extends o{constructor(e,...t){super(...t),this.name="ModuleNotFoundError",this.message=`Could not load '${e}'. This module is required by dsm-storybook. \n Please install a version of '${e}' that is compatible with the installed version of Storybook`}},UnsupportedVersionError:class extends o{constructor(e,...t){super(...t),this.name="UnsupportedVersionError",this.message=`Unsupported @Storybook version (${e}). \n @invisionapp/dsm-storybook plugin does not support this version of Storybook.`}}}},function(e,t,n){const o={getStoryUrlParamsResolver:n(31),initDsmParamsResolver:n(35)};e.exports={versionResolvers:o}},function(e,t,n){const o=n(19),r=n(32),i=n(33);e.exports=function(e){return!e||o.satisfies(e,"^4.0.0")?r:o.satisfies(e,"^5.1.0-alpha.23")?i:void 0}},function(e,t){e.exports={getStoryUrlParams:(e,t)=>({selectedKind:e,selectedStory:t}),sanitizeParams:(e,t)=>({kind:e,name:t})}},function(e,t,n){const{sanitize:o}=n(34),r=(e,t)=>{return{kind:o(e),name:o(t)}};e.exports={getStoryUrlParams:(e,t)=>{const{kind:n,name:o}=r(e,t);return{path:`/story/${n}--${o}`}},sanitizeParams:r}},function(e,t){e.exports={sanitize:e=>e.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi,"-").replace(/-+/g,"-").replace(/^-+/,"").replace(/-+$/,""),translateId:e=>{const t=e.split("--");return{kind:t[0],name:t[1]}}}},function(e,t,n){const o=n(19),r=n(36),i=n(37);e.exports=function(e){return!e||o.satisfies(e,"^4.0.0")?r:o.satisfies(e,"^5.1.1")?i:void 0}},function(e,t){e.exports=["addDecorator","callback"]},function(e,t){e.exports=["addDecorator","addParameters","callback"]},function(e,t,n){const o=n(1),{get:r}=n(7),{getStorySubject:i}=n(23),{INJECTED_SOURCE_PLACEHOLDER:s}=n(4),{getAvailableKnobsFunctions:a,isKnownKnobMethodCall:u,extractKnobProperties:c}=n(12);function l(e,t,n){return t.openingElement.attributes.map(t=>(function(e,t,n){if(o.isJSXSpreadAttribute(e))return{value:n.substring(e.start,e.end),isExpression:!0};const i=r(e,"name.name");let s=function(e,t,n){if(o.isStringLiteral(e))return{value:e.value};if(!o.isJSXExpressionContainer(e))return{};const r=e.expression;if(o.isIdentifier(r))return{value:r.name,isExpression:!0};if(u(r,t))return c(r);return{value:p(n,r.start,r.end),isExpression:!0}}(e.value,t,n);return{name:i,...s}})(t,n,e))}function d(e,t){const n=p(e,0,t.start),o=p(e,t.end);return`${n}${s}${o}`}function f(e,t,n){return 0===e.length?[]:e.map(e=>o.isJSXExpressionContainer(e)&&u(e.expression,n)?c(e.expression):{value:p(t,e.start,e.end)})}function p(e,t,n){return e.substring(t,n)}e.exports=function(e,t){try{const t=i(e.frameworkMetadata.returnStatement,e.dsmInfo);if(!t)return null;const n=a(e.importDeclarations),o=e.frameworkMetadata.returnStatement;return{componentName:t.openingElement.name.name,props:l(o,t,n),children:f(t.children,o,n),sourceTemplate:d(o,t)}}catch(n){return t&&t.error(`Failed to analyze sample code for story ${e?`${e.kind} - ${e.name}`:""} \n ${n.stack}`),null}}},function(e,t){e.exports=require("lodash/find")},function(e,t,n){const o=n(1),r=n(5).default,{getStorySubject:i,vueTemplateCompilerTypes:s}=n(41),{INJECTED_SOURCE_PLACEHOLDER:a}=n(4),{getAvailableKnobsFunctions:u,isKnownKnobMethodCall:c,extractKnobProperties:l}=n(12),d=n(8),f="let dummyObject =";function p(e,t){const{attrsList:n,attrsMap:o}=e,r={},i=n.map(e=>(r[e.name]=!0,g(e,t)));return Object.keys(o).forEach(e=>{if(!r[e])if(""===o[e])i.push({name:e});else{const n={name:e,value:o[e]};i.push(g(n,t))}}),i}function m(e,t){return t.find(t=>t.storyPropName===e)}function g(e,t){if(!(e.name.startsWith(":")||e.name.startsWith("v-bind:")))return{name:e.name,value:e.value};const n=m(e.value,t);if(n){return{name:e.name.split(":")[1],value:n.value,knobLabel:n.knobLabel}}return{name:e.name,value:e.value}}function y(e,t){const n=b(e,0,t.start),o=b(e,t.end);return`${n}${a}${o}`}function h(e,t,n){if(0===e.length)return[];const o=[];return e.forEach(e=>{if(e.type!==s.expression||0===e.tokens.length)o.push({value:b(t,e.start,e.end)});else{e.tokens.forEach(e=>{const t=e["@binding"];if(t){const e=m(t,n);e?o.push({value:e.value,knobLabel:e.knobLabel}):o.push({value:`{{${t}}}`})}else o.push({value:`${e}`})})}}),o}function b(e,t,n){return e.substring(t,n)}e.exports=function(e,t){try{if(!e.frameworkMetadata||!e.frameworkMetadata.storyTemplate)return null;e.frameworkMetadata.storyTemplate=e.frameworkMetadata.storyTemplate.trim();const t=e.frameworkMetadata.storyTemplate,n=i(t,e.dsmInfo);if(!n)return null;const s=u(e.importDeclarations),a=function(e,t){if(!e)return[];const n=[],i=d(f+e);return r(i,{ObjectProperty(e){const r=e.node,i=function(e){if(!e.value||!o.isObjectExpression(e.value))return;const t=(n=e.value.properties,r="default",n.find(e=>e.key.name===r));var n,r;return t&&t.value}(r);if(i&&o.isCallExpression(i)&&c(i,t)){const e=l(i);n.push(Object.assign({storyPropName:r.key.name},e))}}}),n}(e.frameworkMetadata.storyLevelProps,s);return{componentName:n.tag,props:p(n,a),children:h(n.children,t,a),sourceTemplate:y(t,n)}}catch(n){return t&&t.error(`Failed to analyze sample code for story ${e?`${e.kind} - ${e.name}`:""}\n ${n.stack}`),null}}},function(e,t,n){const o=n(42),r={component:1,expression:2,string:3};function i(e,t){const n=function(e){return o.compile(e,{outputSourceRange:!0}).ast}(e);if(!n)return null;let i=n;const s=t.component;return s&&i.tag!==s&&(i=function e(t,n){if(t.type===r.component){if(t.tag===n)return t;let o;for(let r of t.children)if(o=e(r,n))break;return o}}(i,s)),i}e.exports={getStorySubject:i,getComponentTagName:function(e,t){const n=i(e,t);return n?n.tag:null},vueTemplateCompilerTypes:r}},function(e,t){e.exports=require("vue-template-compiler")},function(e,t,n){const o=n(7),r=n(1),i=n(5).default,{getStorySubject:s}=n(44),{INJECTED_SOURCE_PLACEHOLDER:a}=n(4),{getAvailableKnobsFunctions:u,isKnownKnobMethodCall:c,extractKnobProperties:l}=n(12),d=n(8),f="let dummyObject =";function p(e,t){const{attributes:n,inputs:r,outputs:i}=e,s=n.map(e=>e.valueSpan?{name:e.name,value:e.value}:{name:e.name});return r.forEach(e=>{s.push(function(e,t){const n=o.get(e,"value.source");if("BoundAttribute"!==y(e))return{name:e.name,value:n};const r=m(n,t);return r?{name:e.name,value:r.value,knobLabel:r.knobLabel}:{name:`[${e.name}]`,value:n}}(e,t))}),i.forEach(e=>{s.push({name:`(${e.name})`,value:e.handler.source})}),s}function m(e,t){return t.find(t=>t.storyPropName===e)}function g(e,t){const n=b(e,0,t.sourceSpan.start.offset),o=b(e,t.endSourceSpan.end.offset);return`${n}${a}${o}`}function y(e){return e.constructor&&e.constructor.name}function h(e,t,n){if(0===e.length)return[];const r=[];return e.forEach(e=>{const i=o.get(e,"sourceSpan");if(!i)return;const s=y(e);if("Element"!==s){if("BoundText"===s){const t=function(e,t){const n=o.get(e,"value.ast.expressions");if(n&&1===n.length&&"PropertyRead"===y(n[0])){const e=m(n[0].name,t);if(e)return{value:e.value,knobLabel:e.knobLabel}}}(e,n);if(t)return void r.push(t)}r.push({value:b(t,i.start.offset,i.end.offset)})}else{const n=e.startSourceSpan.start.offset,i=o.get(e,"endSourceSpan.end.offset")||e.startSourceSpan.end.offset;r.push({value:b(t,n,i)})}}),r}function b(e,t,n){return e.substring(t,n)}e.exports=function(e,t){try{const t=e.frameworkMetadata&&e.frameworkMetadata.storyTemplate;if(!t)return null;const n=s(t,e.dsmInfo);if(!n)return null;const o=u(e.importDeclarations),a=function(e,t){if(!e)return[];const n=[],o=d(f+e);return i(o,{ObjectProperty(e){const o=e.node,i=o.value;if(i&&r.isCallExpression(i)&&c(i,t)){const e=l(i);n.push(Object.assign({storyPropName:o.key.name},e))}}}),n}(e.frameworkMetadata.storyLevelProps,o);return{componentName:n.name,props:p(n,a),children:h(n.children,t,a),sourceTemplate:g(t,n)}}catch(n){return t&&t.error(`Failed to analyze sample code for story ${e?`${e.kind} - ${e.name}`:""}\n ${n.stack}`),null}}},function(e,t,n){const o=n(45),{parseTemplate:r}=o;function i(e,t){const n=t.component,o=function(e){return r(e,"",{},"")}(e);if(!o||!o.nodes||0===o.nodes.length)return null;const i=1===o.nodes.length;let s;if(!n&&!i)throw"Template contains multiple root elements; component name must be provided as `component` option in in-dsm object";return s=i?o.nodes[0]:{name:"____fake-root____",children:o.nodes},n&&s.name!==n&&(s=function e(t,n){if(t.name){if(t.name===n)return t;let o;for(let r of t.children)if(o=e(r,n))break;return o}}(s,n)),s}e.exports={getStorySubject:i,getComponentTagName:function(e,t){const n=i(e,t);return n?n.name:null}}},function(e,t){e.exports=require("@angular/compiler")},function(e,t,n){const o=n(9),r=[n(17)],i=n(3),{INJECTED_SOURCE_PLACEHOLDER:s}=n(4),{getChildrenString:a,getFieldValue:u,getPropValueString:c,hasValueSet:l,isDefaultValue:d}=n(13);e.exports=function(e,t={},n={},f){if(i(e))return"";const p=`<${e.componentName}`,m=function(e,t,n){if(!e||0===e.length)return"";return e.reduce((e,o)=>`${e} ${function(e,t,n){if(!l(e,n))return"";const o=u(e,n);if(d(t,o))return"";if("boolean"==typeof o&&o)return`${e.name}`;const r=!e.isExpression&&"string"==typeof o,i=r?'"':"{",s=r?'"':"}";return e.name?`${e.name}=${i}${c(o)}${s} `:c(o)}(o,t[o.name],n)}`,"")}(e.props,n,f),g=a(e.children,f),y=`${p} ${m} ${g?">":"/>"}${g}${g?`</${e.componentName}>`:""}`,h=e.sourceTemplate.replace(s,y),b=Object.assign({},{parser:"babel",plugins:r},t);try{return o.format(h,b)}catch(e){return e.message}}},function(e,t,n){const o=n(9),r=[n(14)],i=n(3),s=n(48),{INJECTED_SOURCE_PLACEHOLDER:a}=n(4),{getChildrenString:u,getFieldValue:c,getPropValueString:l,hasValueSet:d,isDefaultValue:f}=n(13);e.exports=function(e,t={},n={},p){if(i(e))return"";const m=`<${e.componentName}`,g=function(e,t,n){if(!e||0===e.length)return"";return e.reduce((e,o)=>`${e} ${function(e,t,n){if(!d(e,n))return e.name+" ";const o=c(e,n);if(f(t,o))return"";return`${e.name}="${l(o)}" `}(o,t[o.name],n)}`,"")}(e.props,n,p),y=u(e.children,p),h=`</${e.componentName}>`,b=`${m}${s(g)}>${y}${h}`,S=e.sourceTemplate.replace(a,b),v=Object.assign({},{parser:"vue",plugins:r},t);try{return o.format(S,v)}catch(e){return e.message}}},function(e,t){e.exports=require("lodash/trimEnd")},function(e,t,n){const o=n(9),r=[n(14)],i=n(3),{INJECTED_SOURCE_PLACEHOLDER:s}=n(4),{getChildrenString:a,getFieldValue:u,hasValueSet:c,isDefaultValue:l,getPropValueString:d}=n(13);e.exports=function(e,t={},n={},f){if(i(e))return"";const p=`${`<${e.componentName}`}${function(e,t,n){if(!e||0===e.length)return"";return e.reduce((e,o)=>`${e} ${function(e,t,n){if(!c(e,n))return e.name+" ";const o=u(e,n);if(l(t,o))return"";return`${e.name}="${d(o)}" `}(o,t[o.name],n)}`,"")}(e.props,n,f)}>${a(e.children,f)}${`</${e.componentName}>`}`,m=e.sourceTemplate.replace(s,p),g=Object.assign({},{parser:"angular",plugins:r},t);try{return o.format(m,g)}catch(e){return e.message}}},function(e,t,n){const o=n(9),r=[n(14)],i=n(3);e.exports=function({sampleCode:e},t={},n={},s){if(i(e))return"";const a=Object.assign({},{parser:"html",plugins:r},t);try{return o.format(e,a)}catch(e){return e.message}}},function(e,t){e.exports=function(e){const t=[];return e.forEach(e=>{e.stories.forEach(n=>{t.push({importDeclarations:[...e.importDeclarations],...n})})}),t}},function(e,t){e.exports=require("lodash/keys")},function(e,t){e.exports=require("chalk")},function(e,t,n){const o=n(26),r=n(6),i=n(10),s=n(55),{get:a}=n(7),{getStorybookConfigPath:u}=n(56),{resolveFromComponentPath:c}=n(20),l="logs";let d,f,p=!1,m={},g={};const y=[];function h(e,t){return`\n### ${e}\n \n${"object"==typeof t?(n=t,JSON.stringify(n,null,2)):t}\n`;var n}function b(e){let t;try{t=i.readFileSync(e,"utf8")}catch(n){t=`Failed to read file ${e}`}return t}e.exports={initializeLogManager:function(e,t){m=e,g=t,d=r.resolve(m.appDirectory,m.outputDir,l);const{storybookConfigPath:n}=u(g);if(n){f=r.resolve(m.appDirectory,n,"../*"),o.sync(f).forEach(e=>{y.push({title:`FILE: ${e}`,data:b(e)})})}s.sync(d),p=!0},createErrorLogFile:function({errorMessage:e,storyFilePath:t,storyFileSource:n,storyMetadata:o}){if(!p)return;const s=[];let u="log.error",l=r.resolve(d,u),g=n;t&&(u=t?`${r.basename(t,r.extname(t))}.error`:"",l=r.resolve(d,u),g=g?"":b(t));const S=a(o,"dsmInfo.componentPath"),v=S&&c(t,S),k=v&&b(v),{packageJson:x,dsmRcConfiguration:E}=m.logInformation;delete E.authToken,x&&s.push({title:"FILE: package.json",data:x}),E&&s.push({title:"FILE: '.dsmrc'",data:E}),o&&s.push({title:"Story metadata",data:o}),g&&s.push({title:"Story source code",data:g}),k&&s.push({title:"Component source code",data:k});const C=`\n--------------------------------------------------- DSM Log Start ---------------------------------------------------\nError message: ${e}\n \nCreated Date: ${(new Date).toLocaleString()}\nStory file path: ${t||"No story file path"}\nComponent file path: ${v||'Not found in "in-dsm"'}\n${s.map(({title:e,data:t})=>h(e,t)).join("")}\n#### STORYBOOK CONFIG ${f}\n \n${y.map(({title:e,data:t})=>h(e,t))} \n--------------------------------------------------- DSM Log End -----------------------------------------------------\n`;return i.ensureFileSync(l),i.appendFileSync(l,C)}}},function(e,t){e.exports=require("rimraf")},function(e,t,n){const o=n(6),r=n(10),{forEach:i}=n(7),s="./.storybook",a=["-c","--config-dir"],u=[".js",".ts"];e.exports={getStorybookConfigPath:function(e){const t=e.split(" "),n=t.findIndex(e=>a.includes(e));let c=s;-1!==n&&(c=t[n+1]);let l=null;return i(u,e=>{const t=o.resolve(c,`config${e}`);if(r.existsSync(t))return l=t,!1}),{storybookConfigPath:l,storybookConfigFolderPath:c}}}},function(e,t){e.exports=require("lodash/forEach")},function(e,t,n){const o=n(71),r=n(72),i=n(2),{getInstalledPackagePath:s,CWD:a}=n(59),u=n(0);e.exports={getClientPackageJson:function(){const e=o.sync({cwd:a});return function(e){return e&&e.path}(e)||(i.error(u.projectRootNotFound()),process.exit(1)),e},getPackageJsonFromPath:function(e){return r.sync({cwd:e})},getDependencyPackageJson:function(e){let t=s(e);return t?r.sync({cwd:t.packageResolvedPath}):null}}},function(e,t,n){const o=n(15),r=n(6),i=n(73),s=o.realpathSync(process.cwd()),a=i.sync(r.resolve(s,"../")),u=r.resolve(s,"node_modules"),c=a&&r.resolve(a,"node_modules");function l(e,t){const n=r.resolve(e,t);return o.existsSync(n)?n:null}e.exports={getInstalledPackagePath:function(e){let t=u,n=l(t,e);return n?{nodeModulesPath:t,packageResolvedPath:n}:(n=(t=c)&&l(t,e))?{nodeModulesPath:t,packageResolvedPath:n}:null},CWD:s,MONO_REPO_WD:a,CWD_NODE_MODULES_DIRECTORY:u,MONO_REPO_WD_NODE_MODULES_DIRECTORY:c}},function(e,t,n){const o=n(10),r=n(75),i={};e.exports=function(e,t){if(!o.existsSync(e))return i;const n=r(t,{loaders:{noExt:r.loadJson}}).loadSync(e);return n&&n.config&&!n.isEmpty?n.config:i}},function(e,t,n){const o={react:n(85),vue:n(89),angular:n(94),html:n(98)};e.exports={getFrameworkAnalyzer:e=>{const t=o[e];if(!t)throw`Unsupported framework detected: ${e}`;return t}}},function(e,t,n){const o=n(10),r=n(6);e.exports={readJsonFileFromPath:(e,t)=>{const n=r.resolve(r.parse(e).dir,t);return{file:o.readJsonSync(n,{throws:!1}),filePath:n}}}},function(e,t,n){const o=n(0),r=n(2),{readJsonFileFromPath:i}=n(62);e.exports=function(e,t){if(!e.versionFilePath)return e;const{file:n,filePath:s}=i(t,e.versionFilePath);return n?n.version?e.version=n.version:r.warning(o.missingKeyInVersionFromFile(s)):e.version?r.warning(o.failedWithFallbackVersionFromFile(s)):r.warning(o.failedVersionFromFile(s)),e}},function(e,t,n){const o=n(0),r=n(65),i=n(53);e.exports=function(e,t,n,s){let a=!0,u=[];if(e.id||(u.push({type:"error",message:o.missingRequiredKey("id")}),a=!1),["version","versionFilePath","component"].forEach(t=>{(t in e&&!e[t]||e[t]&&""===e[t].trim())&&u.push({type:"warning",message:o.passedEmptyKey(t)})}),(u=u.concat(s(e))).length){const e=new r({wordWrap:!0,colWidths:[100],style:{border:["cyan"]}});e.push([{content:o.dsmInfoErrorsTableTitle(i.cyan(t),i.cyan(n))}]),u.forEach(t=>{e.push([{content:"error"===t.type?i.red(t.message):i.yellow(t.message)}])}),console.log(e.toString())}return{isValid:a,errorsList:u}}},function(e,t){e.exports=require("cli-table3")},function(e,t,n){const o=n(1),{get:r}=n(7),i=n(2),{objectExpressionToJsObject:s,findPropertyNodeByKey:a}=n(18);function u(e,t,n,{storyFilePath:o,storySourceCode:r,storyMetadata:s}){const a=`${e.message} (detected in story "${t}" of ${n})`;"FrameworkAnalyzerError"!==e.name||e.isFatal?i.error(a,null,{storyFilePath:o,storySourceCode:r,storyMetadata:s}):i.warning(a)}function c(e){return{moduleName:e,bindings:[]}}e.exports={extractMetadata:function(e,t,n,o,r,i,s){try{e.frameworkMetadata=t.extractMetadata(n,r)}catch(t){u(t,i,s,{storyFilePath:o,storyFileSource:r,storyMetadata:e}),e.frameworkMetadata=null}},extractDocgenInfo:function(e,t,n,o,r,i,s,a){try{e.dsmInfo.docgenInfo=t.extractDocgenInfo({path:n,storyFileSource:r,storyFilePath:o,dsmInfo:a})}catch(t){u(t,i,s,{storyFilePath:o,storySourceCode:r,storyMetadata:e}),e.dsmInfo.docgenInfo=null}},getDsmInfo:function(e){if(!o.isObjectExpression(e))return null;let t=a(e,"in-dsm");if(!t){const n=a(e,"parameters");if(!n)return null;if(!(t=a(n.value,"in-dsm")))return null}return s({properties:[t]})["in-dsm"]},addImportDeclaration:function(e,t){const n=e.node,r=c(n.source.value);t.push(r),n.specifiers.forEach(e=>{o.isImportSpecifier(e)?r.bindings.push(e.imported.name):(o.isImportDefaultSpecifier(e)||o.isImportNamespaceSpecifier(e))&&r.bindings.push(e.local.name)})},addRequireDeclaration:function(e,t){const n=e.node;if(function(e){return o.isCallExpression(e.init)&&o.isIdentifier(e.init.callee)&&"require"===e.init.callee.name}(n)){const e=r(n,"init.arguments[0].value");if(!e)return;const i=c(e);t.push(i),o.isObjectPattern(n.id)?n.id.properties.forEach(e=>{i.bindings.push(e.value.name)}):o.isIdentifier(n.id)&&i.bindings.push(n.id.name)}}}},function(e,t,n){t.buildConfiguration=n(68),t.cliLogger=n(2),t.cliUtils=n(79),t.runner=n(80)},function(e,t,n){const o=n(6),r=n(52),i=n(2),s=n(0),{getClientPackageJson:a,getDependencyPackageJson:u}=n(58),{getPrettierConfiguration:c}=n(74),l=n(76),d=n(78),f=n(60),{getInstalledPackagePath:p,CWD_NODE_MODULES_DIRECTORY:m}=n(59),g="@storybook",y="@invisionapp/dsm-storybook",h=".dsmrc",b={dsmHost:"dsmHost",authToken:"authToken",storyPath:"storyPath",outputDir:"outputDir"};let S=null;e.exports={create:function(e){S&&(i.error(s.configurationAlreadyLoaded()),process.exit(1));const t=a(),n=o.dirname(t.path),v=o.join(n,h),k=f(v,y),x=p(g),E=x?x.nodeModulesPath:m,C=l(t.pkg,E),F=d(C,k),D=function(){const e=u(y);return e&&e.version}(),w=c(n,t.pkg),P={logInformation:{packageJson:t,dsmRcConfiguration:k},appDirectory:n,version:t.pkg.version,nodeModulesPath:E,storybookDependencies:C,storybookFramework:F.name,storybookVersion:F.version,dsmStorybookVersion:D,prettierConfiguration:w},$=function(){const e=process.env.DSM_AUTH_TOKEN;return e?{authToken:e}:{}}();return S=function(e,t,n={},o){return Object.assign(e,n,o,t)}(P,e,k,$),function(){S||(i.error(s.configLoadFailed()),process.exit(1));let e=!1;r(b).map(t=>{S[t]||(i.error(s.missingConfigurationKey(t)),e=!0)}),e&&(i.error(s.configurationFileNotFound(h)),process.exit(1))}(),S},get:function(){return S||(i.error(s.configNotReady()),process.exit(1)),S},configurationKeys:b}},function(e,t){e.exports=require("lodash/isString")},function(e,t){e.exports=require("ora")},function(e,t){e.exports=require("read-pkg-up")},function(e,t){e.exports=require("read-pkg")},function(e,t){e.exports=require("pkg-dir")},function(e,t,n){const o=n(2),r=n(6),i=n(57),s=n(3),a=n(0),u=n(60),c="prettier",l=[".prettierrc",".prettierrc.json"];e.exports={getPrettierConfiguration:function(e,t){let n=t.prettier;return s(n)&&i(l,t=>{if(n=function(e,t){const n=r.join(e,t);return u(n,c)}(e,t),!s(n))return!1}),o.info(s(n)?a.prettierConfigNotFound():a.prettierConfigFound()),n}}},function(e,t){e.exports=require("cosmiconfig")},function(e,t,n){const o=n(6),r=n(52),i=n(3),s=n(77),a=n(2),u=n(0),{getPackageJsonFromPath:c}=n(58);function l(e){return e?r(e).filter(e=>e.startsWith("@storybook")).map(t=>({name:t,version:e[t]})):[]}e.exports=function(e,t){const n=l(e.devDependencies).concat(l(e.dependencies));i(n)&&(a.error(u.storyboookMissingInPackageJson()),process.exit(1));const r=function(e,t){return e.reduce((e,{name:n})=>{const r=o.join(t,n);try{const t=c(r);e.push({name:t.name,version:t.version})}catch(e){a.warning(u.packageMissingInNodeModules(n))}return e},[])}(n,t);return i(r)?(a.warning(u.storybookMissingInNodeModules()),n):s(r,n,"name")}},function(e,t){e.exports=require("lodash/unionBy")},function(e,t,n){const o=n(2),r=n(0),{FRAMEWORKS:i}=n(16),s={"@storybook/react":i.react,"@storybook/react-native":i.reactNative,"@storybook/vue":i.vue,"@storybook/angular":i.angular,"@storybook/mithril":i.mithril,"@storybook/marko":i.marko,"@storybook/html":i.html,"@storybook/svelte":i.svelte,"@storybook/ember":i.ember,"@storybook/riot":i.riot};e.exports=function(e,t){const n=function(e){const{framework:t}=e;if(!t)return null;const n=t.toLowerCase();if(!Object.values(i).includes(n))return o.warning(r.providedFrameworkIsIncorrect(n)),null;return o.info(r.usingFrameworkFromConfiguration(n)),n}(t),a=e.filter(e=>s[e.name]);0===a.length&&(o.error(r.storybookNotDetected()),process.exit(1)),a.length>1&&!n&&(o.error(r.moreThanOneStorybookFrameworkDetected()),process.exit(1));let u=null;return n?(u=a.find(e=>s[e.name]===n))||(o.error(r.explicitFrameworkNotDetectedInInstalledPackages(n)),process.exit(1)):u=a[0],{name:s[u.name],version:u.version}}},function(e,t){const n=e=>{const t=e.findIndex(e=>e.startsWith("-"));return t>0?t:0};e.exports={getCustomArgs:e=>e.rawArgs.splice(n(e.rawArgs)).filter((t,n,o)=>{if(e.options.find(e=>e.short===t||e.long===t))return!1;const r=o[n-1],i=e.optionFor(r);return!i||e[i.attributeName()]!==t})}},function(e,t,n){const o=n(81),r=n(82),i=n(101),s=n(104),a=n(106),u=n(107),c=n(2),{initializeLogManager:l}=n(54),d=n(0),f=n(110),p=n(116),m=n(3),g=n(11),y=n(122),h=n(65),b=n(123),S=n(25).getSampleCodeAnalyzer,v=n(51),k=n(124),{getByVersion:x,resolvers:E}=n(24);function C(e,t){m(e)&&(c.error(d.noDsmStoriesFound()),t&&process.exit(1))}o.characters("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_."),e.exports={publish:async function(e,t){const n=new f(e,c);l(e,t),await p(n,e,t);const y=r.collect(e);C(y,!0),i.writeStoryMetadata(y,e),i.buildStorybook(e,t)||(c.error(d.storybookBuildFailed()),process.exit(1));const h=o.generate(),b=s(e.outputDir);a(b,{...e,buildId:h});const S=await u(n,b);c.success(d.assetUploadComplete());const v={assets:S.map(e=>({fileName:e.fileName,assetKey:e.assetKey})),framework:e.storybookFramework,storybookVersion:e.storybookVersion,version:e.version,storybookDependencies:e.storybookDependencies,storiesMetadata:y,buildId:h,prettierConfiguration:e.prettierConfiguration};c.progress(d.updatingDsm());const k=await n.addMetadata(v),x=g(k,"data.result.missingExternalComponentIds");m(x)||(c.warning(d.unmatchedComponentContainerIds()),x.forEach(e=>c.warning(e))),c.success(d.dsmUpdateComplete(h))},preview:async function(e,t){const n=new f(e,c);l(e,t),await p(n,e,t,!0);const o=r.collect(e);C(o);const s={storiesMetadata:function(e,{storybookFramework:t,storybookVersion:n}){const{sanitizeParams:o}=x(E.getStoryUrlParams,n),r=S(t);return e.map(e=>{const t=r(e,c),{kind:n,name:i}=o(e.kind,e.name);return{kind:e.kind,name:e.name,sanitizedKind:n,sanitizedName:i,sampleCodeMetadata:t,docgenInfo:e.dsmInfo.docgenInfo}})}(v(o),e),prettierConfig:e.prettierConfiguration},a=await y();k.start(s,{port:a}),i.runStorybook(e,t,a)},clearPreviousBuild:function(e){i.clearOutputFolder(e)},listStorybooks:async function(e,t){const n=new f(e,c);await p(n,e),c.info("Retrieving your latest storybook uploads");const o=await n.getStorybooks(t);if(o.data&&o.data.result&&!m(o.data.result.storybooks)){const e=new h({head:["Build ID","Framework","Storybook Version","Creation Date"]});o.data.result.storybooks.forEach(({buildId:t,framework:n,version:o,createdDate:r})=>{const i=new b(r).format("YYYY-MM-DD HH:mm");e.push([t,n,o,i])}),console.log(e.toString())}else c.error("No DSM storybooks found")},deleteStorybook:async function(e,t){const n=new f(e,c);await p(n,e),c.info(`Deleting storybook with buildId: ${t}`);try{await n.deleteStorybook(t),c.info("Deleted successfully.")}catch(e){e.response&&e.response&&404===e.response.status||404===e.statusCode?c.error(`Storybook with buildId ${t} doesn't exist.`):c.error("Failed to delete storybook.")}}}},function(e,t){e.exports=require("shortid")},function(e,t,n){const o=n(15),r=n(26),i=n(8),s=n(83),a=n(2),u=n(0),c=n(3),l="src/stories/**/*.js";function d(e,t){return e.reduce((e,n)=>{a.info(u.analyzingFile(n));const r=function(e){try{return o.readFileSync(e,"utf8")}catch(t){return a.error(u.failedToReadStorySourceFile(e),t,{storyFilePath:e}),null}}(n),l=function(e,t,n,o){if(!e||!t)return null;try{return s(e,t,n,o)}catch(e){return a.error(u.failedToAnalyzeFile(n),e,{storyFilePath:n,storySourceCode:t}),null}}(function(e,t){if(!e)return null;try{return i(e)}catch(n){const o=u.failedToParseStorySourceFile(t);return a.error(o,n,{storyFilePath:t,storySourceCode:e}),null}}(r,n),r,n,t);return c(l)?e:e.concat(l)},[])}e.exports={collect:function(e){return d(function(e){const t=r.sync(e);return t.length||a.error(u.noStoryFilesMatchingSearchPattern(e)),t}(e.storyPath||l),e.storybookFramework)}}},function(e,t,n){const o=[n(84),n(100)],r={};e.exports=function(e,t,n,i){let s=[],a=[];for(const r of o){const{importDeclarations:o,dsmStoriesData:u}=r.analyze(e,t,n,i);if(u.length){a=o,s=u;break}}return s.length?{importDeclarations:a,stories:s}:r}},function(e,t,n){const o=n(5).default,r=n(1),i="storiesOf",s=n(61).getFrameworkAnalyzer,a=n(63),u=n(64),c="add",{getDsmInfo:l,extractMetadata:d,extractDocgenInfo:f,addImportDeclaration:p,addRequireDeclaration:m}=n(66);function g(e,t){if(r.isCallExpression(e)&&e.arguments.length>t){const n=e.arguments[t];return r.isLiteral(n)?n.value:n}return null}e.exports={analyze:function(e,t,n,y){const h=[],b=[];return o(e,{CallExpression(e){const o=function(e,t,n,o){if(!r.isMemberExpression(e.node.callee))return;if(e.node.callee.property.name!==c)return;const p=function e(t,n){return r.isCallExpression(t)&&function(e,t){return function(e){return r.isIdentifier(e)&&e.name===i}(e)||function(e,t){return r.isMemberExpression(e)&&r.isIdentifier(e.object)&&t.bindings[e.object.name]&&r.isIdentifier(e.property)&&e.property.name===i}(e,t)}(t.callee,n)?t:r.isCallExpression(t)?e(t.callee,n):r.isMemberExpression(t)?e(t.object,n):null}(e.node,e.scope);if(!p)return;const m=function(e){if(r.isCallExpression(e)&&e.arguments.length>0&&r.isStringLiteral(e.arguments[0]))return e.arguments[0].value;return null}(p);if(!m)return;const y=(h=e.node,g(h,0));var h;if(!y)return;const b=l(g(e.node,2));if(!b)return;const S=s(o);if(!u(b,y,m,S.validateDsmInfo).isValid)return;const v={externalComponentId:b.id,kind:m,name:y,dsmInfo:a(b,n)};return d(v,S,e,n,t,y,m),f(v,S,e,n,t,y,m,b),v}(e,t,n,y);o&&h.push(o)},ImportDeclaration(e){p(e,b)},VariableDeclarator(e){m(e,b)}}),{importDeclarations:b,dsmStoriesData:h}}}},function(e,t,n){const o=n(1),{FrameworkAnalyzerError:r}=n(21),i=n(86),s=n(20),{getComponentName:a}=n(23),{getStoryCodeNode:u,findReturnStatementNodesBySource:c}=n(27),l=n(0);function d(e,t){const n=u(e);if(!o.isArrowFunctionExpression(n)&&!o.isFunctionExpression(n))throw new r(!0,l.invalidStory());return i=n.body,o.isJSXElement(i)||o.isJSXFragment(i)?t.substring(n.body.start,n.body.end):function(e,t){const n=t.substring(e.start,e.end),{returnStatements:o}=c(n);if(1!==o.length)throw new r(!0,l.oneReturnStatementPerStory());const i=o[0].argument;return n.substring(i.start,i.end)}(n.body,t);var i}e.exports={extractMetadata:function(e,t){return{returnStatement:d(e.node,t)}},extractDocgenInfo:function({path:e,storyFileSource:t,storyFilePath:n,dsmInfo:o}){const r=d(e.node,t),u=a(r,o),c=s.resolveFromComponentName(u,o,e,n);return i.extract(c)},validateDsmInfo:function(){return[]}}},function(e,t,n){const o=n(10),r=n(87),i=n(88);const s="ReactReactNode",a=["union"],u=["signature","intersection","tuple"],c="literal";e.exports={extract:function(e){if(!e)return;const t=o.readFileSync(e,"utf8");return function(e){if(!e.props)return e;const{props:t}=e,n=Object.keys(t);if(function(e,t){return e.every(e=>!t[e].tsType&&!t[e].flowType)}(n,t))return e;const o={};return n.forEach(e=>{const n=t[e],r=n.tsType||n.flowType;let l={...n};r&&(l.type=function(e){if(e.name===s)return{name:"ReactNode"};if(e.name===c)return e;if(a.includes(e.name))return{name:e.name,value:e.elements};if(u.includes(e.name))return{name:e.name,value:e.raw};if(e.name&&i(e.value)&&i(e.raw))return{name:e.name};return{name:e.raw}}(r)),o[e]=l}),{...e,props:o}}(r.parse(t,null,null,{filename:e}))}}},function(e,t){e.exports=require("react-docgen")},function(e,t){e.exports=require("lodash/isUndefined")},function(e,t,n){const o=n(1),{FrameworkAnalyzerError:r}=n(21),{findPropertyNodeByKey:i}=n(18),{getStoryCodeNode:s,findReturnStatementNodesBySource:a,findReturnStatementsNodesByAst:u}=n(27),c=n(20),l=n(90),d=n(0);e.exports={extractMetadata:function(e,t){return function(e,t){const n=s(e);if(!o.isArrowFunctionExpression(n)&&!o.isFunctionExpression(n))throw new r(!0,d.invalidStory());let c=null,l=t;f=n.body,o.isObjectExpression(f)?c=n.body:(c=function(e,t){const n=t.substring(e.start,e.end),{returnStatements:i,ast:s}=a(n);if(0===i.length)throw new r(!0,d.oneReturnStatementPerStory());let c;if(1===i.length)c=i[0].argument;else{const e=s.program.body[0].body.reduce((e,t,n)=>(o.isReturnStatement(t)&&e.push({node:t,index:n}),e),[]);if(1!==e.length)throw new r(!0,d.oneReturnStatementPerStory());const t=e[0];c=t.node.argument,s.program.body[0].body.splice(t.index,1);const{returnStatements:n}=u(s);if(0!==n.length)throw new r(!0,d.oneReturnStatementPerStory())}if(!c||!o.isObjectExpression(c))throw new r(!0,d.storyMustReturnObject());return c}(n.body,t),l=t.substring(n.body.start,n.body.end));var f;const p=i(c,"template");if(!p)throw new r(!1,d.noSampleCodeIfNoTemplate());if(!o.isStringLiteral(p.value)&&!o.isTemplateLiteral(p.value))throw new r(!0,d.templateMustBeString());let m={};m=o.isStringLiteral(p.value)?{storyTemplate:p.value.value}:{storyTemplate:l.substring(p.value.start+1,p.value.end-1)};const g=i(c,"props");g&&(m.storyLevelProps=l.substring(g.value.start,g.value.end));return m}(e.node,t)},extractDocgenInfo:function({storyFilePath:e,dsmInfo:t}){if(!t.componentPath)return null;const n=c.resolveFromComponentPath(e,t.componentPath);return l.extract(n)},validateDsmInfo:function(e){const t=[];return e.componentPath||t.push({type:"warning",message:d.missingComponentPath()}),t}}},function(e,t,n){const o=n(91),r=n(92),i=n(93);e.exports={extract:function(e){if(!e)return;return function(e){const t=r(e,["displayName","description"]),n={};return i(e.props,(e,t,o)=>{n[t]=r(e,["description","type","required"]),o[t].defaultValue&&(n[t].defaultValue={value:o[t].defaultValue.func?"func":o[t].defaultValue.value})}),t.props=n,t}(o.parse(e))}}},function(e,t){e.exports=require("vue-docgen-api")},function(e,t){e.exports=require("lodash/pick")},function(e,t){e.exports=require("lodash/forOwn")},function(e,t,n){const o=n(1),{FrameworkAnalyzerError:r}=n(21),{findPropertyNodeByKey:i}=n(18),{getStoryCodeNode:s,findReturnStatementNodesBySource:a}=n(27),u=n(20),c=n(95),l=n(0);e.exports={extractMetadata:function(e,t){return function(e,t){const{returnedObject:n,parsedSourceCode:u}=function(e,t){const n=s(e);if(!o.isArrowFunctionExpression(n)&&!o.isFunctionExpression(n))throw new r(!0,l.invalidStory());let i=null,u=t;const c=n.body;d=c,o.isObjectExpression(d)?i=c:(i=function(e,t){const n=t.substring(e.start,e.end),{returnStatements:i}=a(n);if(1!==i.length)throw new r(!0,l.oneReturnStatementPerStory());const s=i[0].argument;if(!s||!o.isObjectExpression(s))throw new r(!0,l.storyMustReturnObject());return s}(c,t),u=t.substring(c.start,c.end));var d;return{returnedObject:i,parsedSourceCode:u}}(e,t),c=i(n,"template");if(!c)throw new r(!1,l.noSampleCodeIfNoTemplate());if(!o.isStringLiteral(c.value)&&!o.isTemplateLiteral(c.value))throw new r(!0,l.templateMustBeString());let d;d=o.isStringLiteral(c.value)?{storyTemplate:c.value.value}:{storyTemplate:u.substring(c.value.start+1,c.value.end-1)};const f=i(n,"props");f&&(d.storyLevelProps=u.substring(f.value.start,f.value.end));return d}(e.node,t)},extractDocgenInfo:function({storyFilePath:e,dsmInfo:t}){let n;return(n=u.resolveFromComponentPath(e,t.componentPath))?c.extract(n):null},validateDsmInfo:function(e){const t=[];return e.componentPath||t.push({type:"warning",message:l.missingComponentPath()}),t}}},function(e,t,n){const o=n(10),r=n(96).default,i=n(97);function s(e,t){const n=String(t);return"string"===e?`'${n}'`:n}e.exports={extract:function(e){if(!e)return;const t=o.readFileSync(e,"utf8");return function(e){const t=e.component;if(!t)return null;const n={description:t.description,displayName:t.name,selector:t.selector},o={};e.inputs&&e.inputs.forEach(e=>{const t=e.name,n={};n.description=e.description,n.type={name:e.type},i(e.value)||(n.defaultValue={value:s(e.type,e.value)}),e.options&&(n.type.name="enum",n.type.value=e.options.map(t=>({value:s(e.type,t)}))),o[t]=n});return n.props=o,n}(r(t))}}},function(e,t){e.exports=require("angular-docgen")},function(e,t){e.exports=require("lodash/isNil")},function(e,t,n){const o=n(3),r=n(99),{readJsonFileFromPath:i}=n(62),{FrameworkAnalyzerError:s}=n(21),a=n(0);e.exports={extractMetadata:function(){return null},extractDocgenInfo:function({storyFilePath:e,dsmInfo:t}){if(o(t.docFilePath))return null;const{file:n,filePath:u}=i(e,t.docFilePath);if(o(n))throw new s(!0,a.failedToLoadDocumentationFile(u));return{description:(c=n).description,displayName:c.displayName,props:r(c.props,({value:e,description:t,required:n})=>{if(o(e))throw new s(!0,a.missingMandatoryFieldInDocumentationFile("value"));return{value:e,description:t,required:!!n}})};var c},validateDsmInfo:function(e){const t=[];return o(e.docFilePath)&&t.push({type:"warning",message:a.missingDocumentationFilePath()}),t}}},function(e,t){e.exports=require("lodash/map")},function(e,t,n){const o=n(5).default,r=n(1),{get:i,setWith:s,startCase:a}=n(7),u=n(61).getFrameworkAnalyzer,c=n(63),l=n(64),{objectExpressionToJsObject:d,findPropertyNodeByKey:f,isFunction:p}=n(18),{getDsmInfo:m,extractMetadata:g,extractDocgenInfo:y,addImportDeclaration:h,addRequireDeclaration:b}=n(66);function S(e){return r.isMemberExpression(e)?null:e.name||e.value}e.exports={analyze:function(e,t,n,v){const{importDeclarations:k,exportDeclarations:x,storiesParameters:E,storyCandidates:C,kind:F,globalDsmInfo:D}=function(e){const t={importDeclarations:[],storyCandidates:[],exportDeclarations:[],storiesParameters:{},kind:null,globalDsmInfo:null};return o(e,{VariableDeclarator(e){p(e.node.init)&&t.storyCandidates.push({name:e.node.id.name,storyNode:e.node.init,scope:e.scope}),b(e,t.importDeclarations)},ImportDeclaration(e){h(e,t.importDeclarations)},ExportDefaultDeclaration(e){const{declaration:n}=e.node;t.globalDsmInfo=m(n),t.kind=function(e){if(!e.properties)return null;const t=f(e,"title");return i(t,"value.value")}(n)},ExportNamedDeclaration(e){if(e.node.declaration){const n=i(e,"node.declaration.declarations[0]");n&&p(n.init)&&t.exportDeclarations.push(n.id.name)}},ExportSpecifier(e){t.exportDeclarations.push(e.node.local.name)},AssignmentExpression(e){const{left:n,right:o}=e.node,{storyName:a,path:u}=function e(t,n=""){if(!r.isMemberExpression(t))return{};const{property:o,object:i}=t;const s=S(o);if(!s)return{};if("story"===s&&r.isIdentifier(i))return{storyName:S(i),path:n};if(r.isIdentifier(i))return{};n=n?s.concat(".",n):s;return e(i,n)}(n);if(a){const{customName:e,customDsmInfo:n}=function(e,t){const n=s({},e?`data.${e}`:"data",function(e){if(r.isObjectExpression(e)){return d(e,!1)}if(r.isLiteral(e))return e.value;return null}(t),Object),o=i(n,"data.name"),a=i(n,'data["in-dsm"]')||i(n,'data.parameters["in-dsm"]');return{customName:o,customDsmInfo:a}}(u,o),c=t.storiesParameters[a]||{};t.storiesParameters[a]={customName:e||c.customName,customDsmInfo:n?{...c.customDsmInfo,...n}:c.customDsmInfo}}}}),t}(e);if(!F)return{importDeclarations:k,dsmStoriesData:[]};const w=u(v);return{importDeclarations:k,dsmStoriesData:C.reduce((e,o)=>{const{customName:r,customDsmInfo:i}=E[o.name]||{},s=a(o.name),u=i?{...D||{},...i}:D;if(!u||!x.includes(o.name))return e;if(!l(u,s,F,w.validateDsmInfo).isValid)return e;const d={externalComponentId:u.id,kind:F,name:s,dsmInfo:c(u,n)};r&&(d.displayName=r);const f={scope:o.scope,node:o.storyNode};return g(d,w,f,n,t,s,F),y(d,w,f,n,t,s,F,u),e.push(d),e},[])}}}},function(e,t,n){const o=n(10),r=n(55),i=n(102),s=n(6),a=n(2),u=n(0),{environmentKeys:c}=n(103),{STORYBOOK_ENV_VARIABLE:l}=n(4),{STORYBOOK_BUILD_FOLDER:d}=n(16),f="story-metadata.json";function p(e,t={}){return 0===i.exec(e,t).code}function m(e,t,n,...r){const i=s.resolve(t,".bin",n),a=s.resolve(t,".bin",`${n}.cmd`),u=o.pathExistsSync(a)?a:`node ${i}`;return`${s.resolve(t,".bin","cross-env")} ${function(e){const t=`${JSON.stringify(e).replace(/'|"/g,'\\"')}`;return`${l}="${t}"`}(e)} ${u} ${r.join(" ")}`}e.exports={writeStoryMetadata:function(e,t){const n=s.resolve(t.appDirectory,t.outputDir,"metadata",f);o.outputJsonSync(n,e),a.info(u.analysisWritten(n))},buildStorybook:function(e,t){const n={[c.dsmProdEnvironment]:!0,[c.dsmHost]:e.dsmHost,[c.storybookFramework]:e.storybookFramework,[c.storybookVersion]:e.storybookVersion},o=s.join(e.outputDir,d),r=m(n,e.nodeModulesPath,"build-storybook",`-o ${o}`,t);return a.info(u.creatingStorybookBundle()),p(r)},runStorybook:function(e,t,n){return p(m({[c.previewServerPort]:n,[c.dsmHost]:e.dsmHost,[c.storybookFramework]:e.storybookFramework,[c.storybookVersion]:e.storybookVersion},e.nodeModulesPath,"start-storybook",t),{async:!0})},clearOutputFolder:function({appDirectory:e,outputDir:t}){const n=s.resolve(e,t);r.sync(n)}}},function(e,t){e.exports=require("shelljs")},function(e,t,n){const o=n(3);let r=null;function i(){return null!==r||(console.log("ERROR: run configuration was not set"),!1)}e.exports={setConfiguration:function(e){r=e?JSON.parse(e):{}},environmentKeys:{dsmHost:"DSM_HOST",dsmProdEnvironment:"DSM_PROD_ENV",authToken:"DSM_AUTH_TOKEN",previewServerPort:"DSM_PREVIEW_SERVER_PORT",storybookFramework:"STORYBOOK_FRAMEWORK",storybookVersion:"STORYBOOK_VERSION"},getByEnvKey:function(e){return i()?r[e]:null},isInDsmContext:function(){return!!i()&&!o(r)}}},function(e,t,n){const o=n(15),r=n(6),i=n(105),s=n(26),{STORYBOOK_BUILD_FOLDER:a}=n(16);e.exports=function(e){const t=`${e}/${a}`,n=i(s.sync(`${t}/**/*`),e=>/.map$/.test(e)||o.lstatSync(e).isDirectory()),u=t.length+1;return n.map(e=>({fileName:e.substring(u),resolvedPath:r.resolve(e)}))}},function(e,t){e.exports=require("lodash/reject")},function(e,t,n){const o=n(15),r="iframe.html";const i=/.css$/;e.exports=function(e,t){const n=(s=t.dsmHost,a=t.organization,u=t.buildId,`https://${s}/dsm-api/storybook/${a}/${u}/asset-proxy?assetName=`);var s,a,u;e.forEach(t=>{(function(e){return/.bundle.js$/.test(e)||/.html$/.test(e)||i.test(e)})(t.fileName)&&function(e,t,n){let s=o.readFileSync(e.resolvedPath,"utf8"),a=!1;t.forEach(t=>{if(function(e,t,n){return o=t.fileName,r=n.fileName,!(o===r)&&function(e,t){return e.indexOf(t.fileName)>-1}(e,n);var o,r}(s,e,t))if(a=!0,t.fileName===r){const e=RegExp(`"${r}`,"g");s=s.replace(e,`"${n}${r}`)}else s=function(e,t,n,o){const r=`\\.?\\/?${n.fileName}`,s=`${o}${n.fileName}`;if(i.test(t))return e.replace(RegExp(`(\\()('|")?(${r})('|")?(\\))`,"gi"),`(${s})`);return e.replace(RegExp(`"${r}"`,"gi"),`"${s}"`)}(s,e.fileName,t,n)}),a&&o.writeFileSync(e.resolvedPath,s,"utf8")}(t,e,n)})}},function(e,t,n){const o=n(15),r=n(108),i=n(109),s=n(11),a=n(2),u=n(0);process.env.NODE_TLS_REJECT_UNAUTHORIZED=0,e.exports=async function(e,t){const n=await async function(e,t){try{const n=await e.signFiles(t.map(e=>e.fileName)),o=i(n.data.result,e=>e.fileName);return t.map(e=>({...e,...o[e.fileName]}))}catch(e){const t=s(e,"response.status");if(t&&404!==t)throw e;throw new Error(`Failed to connect to DSM server. Check the correctness of your '.dsmrc' file. \n${e.stack}`)}}(e,t);return await async function(e,t){for(let n=0;n<t.length;n++){let i=t[n];a.progress(u.uploadingFile(i.resolvedPath));const s={"Content-Type":r.lookup(i.fileName)};try{const t=o.createReadStream(i.resolvedPath);await e.uploadFile(i.signedUrl,t,s),a.success(u.uploadComplete(i.fileName))}catch(e){throw a.error(u.uploadError(i.fileName)),e}}}(e,n),n}},function(e,t){e.exports=require("mime-types")},function(e,t){e.exports=require("lodash/keyBy")},function(e,t,n){const o=n(111),r=n(114),i=function(e,t){this.organization=e.organization,"rp"===e.httpClient?this.httpClient=new r(e,t):this.httpClient=new o(e,t)};i.prototype.signFiles=function(e){return this.httpClient.post(`${this.organization}/sign-files`,{fileNames:e})},i.prototype.addMetadata=function(e){return this.httpClient.post(`${this.organization}/metadata`,{metadata:e})},i.prototype.getStorybooks=function(e){return this.httpClient.post(`${this.organization}/storybooks`,{limit:e})},i.prototype.deleteStorybook=function(e){return this.httpClient.delete(`${this.organization}/${e}`)},i.prototype.verifyPackageVersion=function(){return this.httpClient.get("/verify-version")},i.prototype.verifyOrganizationSubscription=function(){return this.httpClient.post(`${this.organization}/verify-organization-subscription`)},i.prototype.uploadFile=function(e,t,n){return this.httpClient.uploadFile(e,t,n)},e.exports=i},function(e,t,n){const o=n(112),{CLI_CLIENT_NAME:r}=n(16),i={"Request-Source":r};e.exports=class{constructor(e,t){this.authToken=e.authToken;const i=e.dsmStorybookVersion;this.clientVersionInfo={client:r,clientVersion:i};const s=e.port||443,a={baseURL:`https://${e.dsmHost}:${s}/dsm-api/storybook`};if(e.proxyUrl&&e.proxyPort){const t={host:e.proxyUrl,port:e.proxyPort};if(e.tunnel){const e=n(113);a.httpsAgent=e.httpsOverHttp({proxy:t}),a.proxy=!1}else a.proxy=t}this.axiosClient=o.create(a),this.logger=t,e.debug&&this._configureDebugInterceptors()}get(e,t={}){return this.axiosClient.get(e,{params:Object.assign({},t,this.clientVersionInfo)})}post(e,t={},n={}){const o=Object.assign({},t,{authToken:this.authToken}),r={params:this.clientVersionInfo,headers:Object.assign({},i,n)};return this.axiosClient.post(e,o,r)}delete(e){return this.axiosClient.delete(e,{data:{authToken:this.authToken,params:this.clientVersionInfo},headers:i})}uploadFile(e,t,n={}){return this.axiosClient({method:"post",url:e,data:t,maxContentLength:104857600,headers:Object.assign({},i,n)})}_configureDebugInterceptors(){if(!this.logger)return;const e=()=>{const e=new WeakSet;return(t,n)=>{if("object"==typeof n&&null!==n){if(e.has(n))return;e.add(n)}return n}};this.axiosClient.interceptors.request.use(t=>(this.logger.info(`AXIOS_REQUEST_INTERCEPT: ${JSON.stringify(t,e())}`),t),e=>(this.logger.error("AXIOS_REQUEST_ERROR",e),Promise.reject(e))),this.axiosClient.interceptors.response.use(t=>(this.logger.info(`AXIOS_RESPONSE_INTERCEPT: ${JSON.stringify(t.headers,e())}`),t),e=>(this.logger.error("AXIOS_RESPONSE_ERROR",e),Promise.reject(e)))}}},function(e,t){e.exports=require("axios")},function(e,t){e.exports=require("tunnel")},function(e,t,n){const o=n(115),{CLI_CLIENT_NAME:r}=n(16),i={"Request-Source":r},s=36e4;e.exports=class{constructor(e,t){this.authToken=e.authToken,this.logger=t,this.clientVersionInfo={client:r,clientVersion:e.dsmStorybookVersion},o.debug=!!e.debug;const n=e.port||443,i={baseUrl:`https://${e.dsmHost}:${n}/dsm-api/storybook/`,timeout:s};e.proxyUrl&&e.proxyPort&&(i.proxy=`${e.proxyUrl}:${e.proxyPort}`,i.tunnel=!!e.tunnel),this.request=o.defaults(i)}get(e,t={}){const n={method:"GET",json:!0,url:e,qs:Object.assign({},t,this.clientVersionInfo)};return this.request(n).then(e=>({data:{result:e.result}}))}post(e,t={},n={}){const o={method:"POST",url:e,json:!0,body:Object.assign({},t,{authToken:this.authToken}),qs:this.clientVersionInfo,headers:Object.assign({},i,n)};return this.request(o).then(e=>({data:{result:e.result}}))}delete(e){const t={method:"DELETE",url:e,json:!0,body:{authToken:this.authToken},qs:this.clientVersionInfo,headers:i};return this.request(t)}uploadFile(e,t,n={}){return this.request.defaults({baseUrl:null})({method:"POST",url:e,body:t,maxContentLength:104857600,headers:Object.assign({},i,n)})}}},function(e,t){e.exports=require("request-promise")},function(e,t,n){const o=n(11),r=n(2),i=n(0),{validateStorybookConfigJs:s}=n(117);function a(e,t,n){if(!t){if(r.error(e),n)throw n;process.exit(1)}r.warning(e)}e.exports=async function(e,t,n="",u=!1){s(t.storybookVersion,n),await async function(e,t,n=!1){const s=t.dsmStorybookVersion;s||(r.error(i.unknownStorybookVersion()),process.exit(1)),r.info(i.verifyingCliVersion(s));try{const t=await e.verifyPackageVersion(),r=o(t,"data.result"),{valid:u,minVersion:c}=r;u||a(i.cliUpgradeRequired(s,c),n)}catch(e){a(i.cliVersionVerificationFailed(),n,e)}}(e,t,u),await async function(e,t,n=!1){r.info(i.verifyingOrganizationSubscription(t.organization));try{const t=await e.verifyOrganizationSubscription();o(t,"data.result.allowed")||a(i.enterpriseGating(),n)}catch(e){a(i.subscriptionVerificationFailed(t.organization),n,e)}}(e,t,u)}},function(e,t,n){const{getConfigSourceCode:o}=n(28),{getStorybookConfigPath:r}=n(56),i=n(8),s=n(118),a=n(2),u=n(0);e.exports={validateStorybookConfigJs:function(e,t){const{storybookConfigPath:n,storybookConfigFolderPath:c}=r(t);if(!n)return void a.error(u.failedToReadStorybookConfigFile(c));const l=o(n);if(!l)return;const d=function(e){try{return i(e)}catch(e){return a.error(u.failedToParseStorybookConfigFile(),e),null}}(l);d&&s(d,n,e)}}},function(e,t,n){const o=n(119);e.exports=function(e,t,n){o.forEach(o=>o({configAst:e,configPath:t,storybookVersion:n}))}},function(e,t,n){const o=n(120),r=n(121);e.exports=[o,r]},function(e,t,n){const o=n(2),r=n(0),{getByVersion:i,resolvers:s}=n(24),{getCallExpressionsToValidate:a}=n(28);e.exports=function({configAst:e,configPath:t,storybookVersion:n}){const u=a(e,"initDsm");u.length>1&&o.error(r.moreThanOneCallToInitDsm(t));const c=u[0];if(!c)return void o.warning(r.noInitDsmCallFound(t));if(1!==c.arguments.length)return void o.warning(r.initDsmWrongArgument());const l=c.arguments[0];if("Identifier"===l.type)return;const d=l.properties.map(e=>e.key.name),f=i(s.initDsmParams,n).reduce((e,t)=>d.includes(t)?e:[...e,t],[]);if(0!==f.length)throw new Error(r.initDsmMissingParameters(f))}},function(e,t,n){const o=n(2),r=n(0),{getCallExpressionsToValidate:i}=n(28);e.exports=function({configAst:e,configPath:t}){i(e,"configure").length>1&&o.error(r.moreThanOneCallToConfigure(t))}},function(e,t){e.exports=require("get-port")},function(e,t){e.exports=require("moment")},function(e,t,n){"use strict";const o=n(125),r=n(2),i=n(0);let s=null;e.exports={start:function(e,t){const n=o(),a=t.port;s=e,n.use((function(e,t,n){t.header("Access-Control-Allow-Origin","*"),t.header("Access-Control-Allow-Headers","Origin, X-Requested-With, Content-Type, Accept"),n()})),n.get("/sample-code-data",(function(e,t){t.send(s)})),n.listen(a,(function(){r.info(i.previewServerStarted(a))}))}}},function(e,t){e.exports=require("express")}])}));
\No newline at end of file