hypnagaga/docs/assets/collect-stories-fa95313f.js
2024-05-23 10:39:02 +00:00

2 lines
9.6 KiB
JavaScript

import{n as G,s as h,$ as V,a0 as se,a1 as oe,S,i as w,C as b,a2 as C,v as D,d as F,t as m,w as K,h as p,x as P,f as U,a3 as J,y as pe,U as v,l as re,u as ie,p as ae,q as ce,I as R,g as I,m as M,j}from"./index-85f88930.js";const k=[];function Q(s,e=G){let o;const t=new Set;function n(c){if(h(s,c)&&(s=c,o)){const u=!k.length;for(const a of t)a[1](),k.push(a,s);if(u){for(let a=0;a<k.length;a+=2)k[a][0](k[a+1]);k.length=0}}}function r(c){n(c(s))}function i(c,u=G){const a=[c,u];return t.add(a),t.size===1&&(o=e(n,r)||G),c(s),()=>{t.delete(a),t.size===0&&o&&(o(),o=null)}}return{set:n,update:r,subscribe:i}}const L="storybook-registration-context",B="storybook-registration-context-component";function le(s={}){V(L,{render:!0,register:()=>{},meta:{},args:{},...s})}function ye(s){V(L,{render:!1,register:e=>{s.stories.push(e)},set meta(e){s.meta=e},args:{}})}function X(){return se(L)||le(),oe(L)}function W(){return se(B)||V(B,{argsStore:Q({}),storyContextStore:Q({})}),oe(B)}function _e(s,e){const o=W();o.argsStore.set(s),o.storyContextStore.set(e)}function ge(s,e,o){return X().meta=e,s.$$set=t=>{o(0,e=b(b({},e),C(t)))},e=C(e),[]}class xe extends S{constructor(e){super(),w(this,e,ge,null,h,{})}}xe.__docgen={version:3,name:"Meta.svelte",data:[],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[],refs:[]};const ke=s=>s&2,be=s=>({context:s&4,args:s&2}),Z=s=>({...s[1],context:s[2],args:s[1]});function H(s){let e;const o=s[8].default,t=re(o,s,s[7],Z);return{c(){t&&t.c()},m(n,r){t&&t.m(n,r),e=!0},p(n,r){t&&t.p&&(!e||r&134)&&ie(t,o,n,n[7],ke(r)||!e?ae(n[7]):ce(o,n[7],r,be),Z)},i(n){e||(m(t,n),e=!0)},o(n){p(t,n),e=!1},d(n){t&&t.d(n)}}}function he(s){let e,o,t=s[0]&&H(s);return{c(){t&&t.c(),e=D()},m(n,r){t&&t.m(n,r),F(n,e,r),o=!0},p(n,[r]){n[0]?t?(t.p(n,r),r&1&&m(t,1)):(t=H(n),t.c(),m(t,1),t.m(e.parentNode,e)):t&&(K(),p(t,1,1,()=>{t=null}),P())},i(n){o||(m(t),o=!0)},o(n){p(t),o=!1},d(n){n&&U(e),t&&t.d(n)}}}function Ce(s,e,o){let t;const n=["name","template"];let r=J(e,n),i,c,{$$slots:u={},$$scope:a}=e;const y=pe(u),_=X();let{name:d}=e,{template:l=null}=e;if(!d)throw new Error("Missing Story name");_.register({name:d,...r,template:l??(y.default?null:"default")});const O=W(),g=O.argsStore;v(s,g,f=>o(1,i=f));const E=O.storyContextStore;return v(s,E,f=>o(2,c=f)),s.$$set=f=>{e=b(b({},e),C(f)),o(12,r=J(e,n)),"name"in f&&o(5,d=f.name),"template"in f&&o(6,l=f.template),"$$scope"in f&&o(7,a=f.$$scope)},s.$$.update=()=>{s.$$.dirty&32&&o(0,t=_.render&&!_.templateName&&_.storyName==d)},[t,i,c,g,E,d,l,a,u]}class Se extends S{constructor(e){super(),w(this,e,Ce,he,h,{name:5,template:6})}}Se.__docgen={version:3,name:"Story.svelte",data:[{visibility:"public",description:null,keywords:[],name:"name",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"any",type:"any"}},{visibility:"public",description:null,keywords:[],name:"template",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"object",type:"object"},defaultValue:null}],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[{keywords:[],visibility:"public",description:"",name:"default",params:[{name:"{...$args}",type:{kind:"type",text:"*",type:"any"}},{name:"context",type:{kind:"type",text:"*",type:"any"}},{name:"args",type:{kind:"type",text:"*",type:"any"}}],parameters:[{name:"{...$args}",type:{kind:"type",text:"*",type:"any"}},{name:"context",type:{kind:"type",text:"*",type:"any"}},{name:"args",type:{kind:"type",text:"*",type:"any"}}]}],refs:[]};const we=s=>s&2,Oe=s=>({context:s&4,args:s&2}),$=s=>({...s[1],context:s[2],args:s[1]});function ee(s){let e;const o=s[7].default,t=re(o,s,s[6],$);return{c(){t&&t.c()},m(n,r){t&&t.m(n,r),e=!0},p(n,r){t&&t.p&&(!e||r&70)&&ie(t,o,n,n[6],we(r)||!e?ae(n[6]):ce(o,n[6],r,Oe),$)},i(n){e||(m(t,n),e=!0)},o(n){p(t,n),e=!1},d(n){t&&t.d(n)}}}function Ee(s){let e,o,t=s[0]&&ee(s);return{c(){t&&t.c(),e=D()},m(n,r){t&&t.m(n,r),F(n,e,r),o=!0},p(n,[r]){n[0]?t?(t.p(n,r),r&1&&m(t,1)):(t=ee(n),t.c(),m(t,1),t.m(e.parentNode,e)):t&&(K(),p(t,1,1,()=>{t=null}),P())},i(n){o||(m(t),o=!0)},o(n){p(t),o=!1},d(n){n&&U(e),t&&t.d(n)}}}function Te(s,e,o){let t,n,r,{$$slots:i={},$$scope:c}=e;const u=X();let{id:a="default"}=e;u.register({id:a,isTemplate:!0});const y=W(),_=y.argsStore;v(s,_,l=>o(1,n=l));const d=y.storyContextStore;return v(s,d,l=>o(2,r=l)),s.$$set=l=>{"id"in l&&o(5,a=l.id),"$$scope"in l&&o(6,c=l.$$scope)},s.$$.update=()=>{s.$$.dirty&32&&o(0,t=u.render&&u.templateId===a)},[t,n,r,_,d,a,c,i]}class Ne extends S{constructor(e){super(),w(this,e,Te,Ee,h,{id:5})}}Ne.__docgen={version:3,name:"Template.svelte",data:[{visibility:"public",description:null,keywords:[],name:"id",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:"default"}],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[{keywords:[],visibility:"public",description:"",name:"default",params:[{name:"{...$args}",type:{kind:"type",text:"*",type:"any"}},{name:"context",type:{kind:"type",text:"*",type:"any"}},{name:"args",type:{kind:"type",text:"*",type:"any"}}],parameters:[{name:"{...$args}",type:{kind:"type",text:"*",type:"any"}},{name:"context",type:{kind:"type",text:"*",type:"any"}},{name:"args",type:{kind:"type",text:"*",type:"any"}}]}],refs:[]};var ne;(ne=module==null?void 0:module.hot)!=null&&ne.decline&&module.hot.decline();function ve(s){let e,o,t;var n=s[0];function r(i,c){return{}}return n&&(e=R(n,r())),{c(){e&&I(e.$$.fragment),o=D()},m(i,c){e&&M(e,i,c),F(i,o,c),t=!0},p(i,[c]){if(c&1&&n!==(n=i[0])){if(e){K();const u=e;p(u.$$.fragment,1,0,()=>{j(u,1)}),P()}n?(e=R(n,r()),I(e.$$.fragment),m(e.$$.fragment,1),M(e,o.parentNode,o)):e=null}},i(i){t||(e&&m(e.$$.fragment,i),t=!0)},o(i){e&&p(e.$$.fragment,i),t=!1},d(i){i&&U(o),e&&j(e,i)}}}function Re(s,e,o){let{Stories:t}=e,{repositories:n}=e;return ye(n),s.$$set=r=>{"Stories"in r&&o(0,t=r.Stories),"repositories"in r&&o(1,n=r.repositories)},[t,n]}class ue extends S{constructor(e){super(),w(this,e,Re,ve,h,{Stories:0,repositories:1})}}ue.__docgen={version:3,name:"RegisterContext.svelte",data:[{visibility:"public",description:null,keywords:[],name:"Stories",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"any",type:"any"}},{visibility:"public",description:null,keywords:[],name:"repositories",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"any",type:"any"}}],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[],refs:[]};function Ie(s){let e,o,t;var n=s[0];function r(i,c){return{}}return n&&(e=R(n,r())),{c(){e&&I(e.$$.fragment),o=D()},m(i,c){e&&M(e,i,c),F(i,o,c),t=!0},p(i,[c]){if(c&1&&n!==(n=i[0])){if(e){K();const u=e;p(u.$$.fragment,1,0,()=>{j(u,1)}),P()}n?(e=R(n,r()),I(e.$$.fragment),m(e.$$.fragment,1),M(e,o.parentNode,o)):e=null}},i(i){t||(e&&m(e.$$.fragment,i),t=!0)},o(i){e&&p(e.$$.fragment,i),t=!1},d(i){i&&U(o),e&&j(e,i)}}}function Me(s,e,o){let{Stories:t}=e,{args:n={}}=e,{storyContext:r={}}=e;return le(e),s.$$set=i=>{o(3,e=b(b({},e),C(i))),"Stories"in i&&o(0,t=i.Stories),"args"in i&&o(1,n=i.args),"storyContext"in i&&o(2,r=i.storyContext)},s.$$.update=()=>{s.$$.dirty&6&&_e(n,r)},e=C(e),[t,n,r]}class fe extends S{constructor(e){super(),w(this,e,Me,Ie,h,{Stories:0,args:1,storyContext:2})}}fe.__docgen={version:3,name:"RenderContext.svelte",data:[{visibility:"public",description:null,keywords:[],name:"Stories",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"any",type:"any"}},{visibility:"public",description:null,keywords:[],name:"args",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"object",type:"object"}},{visibility:"public",description:null,keywords:[],name:"storyContext",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"object",type:"object"}}],computed:[],methods:[],components:[],description:"@component",keywords:[{name:"component",description:""},{name:"wrapper",description:""}],events:[],slots:[],refs:[]};const{logger:je}=__STORYBOOK_MODULE_CLIENT_LOGGER__;function Le(s){const e=s.split("").reduce((o,t)=>(o<<5)-o+t.charCodeAt(0)|0,0);return Math.abs(e).toString(16)}function De({id:s,name:e},o=[]){if(s)return s;if(!e)throw new Error("Id or Name should be specified");let t=e.replace(/\W+(.|$)/g,(n,r)=>r.toUpperCase());return o.indexOf(t)>=0&&(je.warn(`Story name conflict with exports - Please add an explicit id for story ${e}`),t+=Le(e)),t}const{combineParameters:te}=__STORYBOOK_MODULE_CLIENT_API__,{logger:z}=__STORYBOOK_MODULE_CLIENT_LOGGER__,Fe=document.createDocumentFragment?()=>document.createDocumentFragment():()=>document.createElement("div"),Pe=(s,{stories:e={},allocatedIds:o=[]},t=void 0)=>{const n={meta:null,stories:[]};try{new ue({target:Fe(),props:{Stories:s,repositories:n}}).$destroy()}catch(a){z.error(`Error extracting stories ${a.toString()}`,a)}const r=t||n.meta;if(!r)return z.error("Missing <Meta/> tag"),{};const{component:i}=r,c=n.stories.filter(a=>a.isTemplate).map(a=>a.id),u=c.filter((a,y)=>c.indexOf(a)!==y);return u.length>0&&z.warn(`Found duplicates templates id for stories '${r.name}': ${u}`),{meta:r,stories:n.stories.filter(a=>!a.isTemplate).reduce((a,y)=>{const{id:_,name:d,template:l,component:O,source:g=!1,...E}=y,f=De(y,o);if(!f)return a;const de=l!=null&&c.indexOf(l)<0,x=(q,A)=>{if(de)throw new Error(`Story ${d} is referencing an unknown template ${l}`);return{Component:fe,props:{Stories:s,storyName:d,templateId:l,args:q,storyContext:A,sourceComponent:O||i}}};x.storyName=d,Object.entries(E).forEach(([q,A])=>{x[q]=A});const T=e[l?`tpl:${l}`:f],me=T?T.hasArgs:!0,Y=T?T.source:null;Y&&(x.parameters=te(x.parameters||{},{storySource:{source:Y}}));let N;return g===!0||g===!1&&!me?N=Y:typeof g=="string"&&(N=g),N&&(x.parameters=te(x.parameters||{},{docs:{source:{code:N}}})),a[f]=x,a},{})}};export{xe as M,Se as S,Ne as T,Pe as p,Q as w};
//# sourceMappingURL=collect-stories-fa95313f.js.map