@knapsack/types 4.71.2--canary.4990.bff88e0.0 → 4.71.2

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import * as t from 'superstruct';
2
2
  import { define, union, type, literal, string, object, enums, number, optional, size, array, boolean, defaulted } from 'superstruct';
3
- import Ae from 'color-string';
3
+ import Re from 'color-string';
4
4
  import { expectType, isObject, isObjKey, parseNumberWithUnit } from '@knapsack/utils';
5
5
  export { isObjKey, isObject } from '@knapsack/utils';
6
6
  import { isDraft } from 'immer';
7
7
 
8
- var ce=Object.defineProperty;var n=(e,r)=>ce(e,"name",{value:r,configurable:!0});var ue=(e,r)=>{for(var i in r)ce(e,i,{get:r[i],enumerable:!0});};function Fe(e){if(typeof e!="string")return !1;try{return !!Ae.get(e)}catch{return !1}}n(Fe,"isColor");var F=define("ColorStringStruct",e=>typeof e=="string"&&Fe(e)),p=union([type({type:literal("value"),colorValue:F}),type({type:literal("design-token"),tokenName:string()})]),uo=type({type:literal("design-token"),tokenName:string()});var So=["h1","h2","h3","h4","h5","h6"],me=object({unit:enums(["rem","px"]),value:number()}),ye=union([string(),number()]),We=(i=>(i.woff2="woff2",i.woff="woff",i))(We||{}),_e=enums(["woff2","woff"]),Le=type({format:_e,type:literal("url"),path:string()}),N=type({family:optional(string()),weight:optional(union([ye,size(array(ye),2)])),src:optional(array(Le)),style:optional(string()),display:optional(enums(["auto","block","swap","fallback","optional"])),variationSettings:optional(string()),unicodeRange:optional(string())}),Ge=(f=>(f.inherit="As typed",f.capitalize="Capitalize",f.lowercase="Lowercase",f.uppercase="Uppercase",f))(Ge||{}),$e=(u=>(u["ultra-condensed"]="Ultra-condensed",u["extra-condensed"]="Extra-condensed",u.condensed="Condensed",u["semi-condensed"]="Semi-condensed",u.normal="Normal",u["semi-expanded"]="Semi-expanded",u.expanded="Expanded",u["extra-expanded"]="Extra-expanded",u["ultra-expanded"]="Ultra-expanded",u))($e||{}),w=type({fontWeight:optional(union([string(),number()])),textColor:optional(p),hoverColor:optional(p),underline:optional(boolean()),textTransform:optional(enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:optional(enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))}),He=type({min:me,max:optional(me)}),a=type({fontSize:optional(He),lineHeight:optional(union([string(),number()])),fontWeight:optional(union([string(),number()])),letterSpacing:optional(string()),fontFamily:optional(string()),textColor:optional(p),textTransform:optional(enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:optional(enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))}),m={},de={},Co={pageTitle:m,pageDescription:m,headingLarge:m,headingMedium:m,headingSmall:m,bodyText:m,link:de},xo={pageTitle:m,pageDescription:m,headingXLarge:m,headingLarge:m,headingMedium:m,headingSmall:m,headingXSmall:m,bodyText:m,link:de};var I=union([a,type({accentColor:optional(p)})]),j=union([I,type({hoverColor:optional(p),backgroundColor:optional(p)})]),W=union([I,type({backgroundColor:optional(p)})]),qe={},Je={},Ye={},Ro={primaryNav:Ye,secondaryNav:Je,tabs:qe};var jo=object({version:literal(1),oldSillySidebarBgColor:F}),Wo=object({version:literal(2),anotherSillySidebarBgColor:F}),_o=object({version:literal(3),sidebarBgColor:F}),Lo=object({version:literal(4),primaryColor:p,darkColor:p,lightColor:p,enableSidebarIcons:optional(defaulted(boolean(),!0))}),Go=object({version:literal(5),primaryColor:p,darkColor:p,lightColor:p,linkColor:p,enableSidebarIcons:optional(defaulted(boolean(),!0))}),$o=object({version:literal(6),primaryColor:p,darkColor:p,lightColor:p,linkColor:p,enableSidebarIcons:optional(defaulted(boolean(),!0)),appearance:type({customFonts:optional(array(N)),pageElements:type({pageTitle:optional(a),pageDescription:optional(a),headingLarge:optional(a),headingMedium:optional(a),headingSmall:optional(a),bodyText:optional(a),link:optional(w)})})}),Ho=object({version:literal(7),primaryColor:p,darkColor:p,lightColor:p,linkColor:p,enableSidebarIcons:optional(defaulted(boolean(),!0)),appearance:type({customFonts:optional(array(N)),navigation:optional(type({primaryNav:optional(j),secondaryNav:optional(W),tabs:optional(I)})),pageElements:type({pageTitle:optional(a),pageDescription:optional(a),headingLarge:optional(a),headingMedium:optional(a),headingSmall:optional(a),bodyText:optional(a),link:optional(w)})})}),qo=object({version:literal(8),primaryColor:p,darkColor:p,lightColor:p,linkColor:p,appearance:type({customFonts:optional(array(N)),navigation:optional(type({primaryNav:optional(j),secondaryNav:optional(W),tabs:optional(I)})),pageElements:type({pageTitle:optional(a),pageDescription:optional(a),headingLarge:optional(a),headingMedium:optional(a),headingSmall:optional(a),bodyText:optional(a),link:optional(w)})})}),Jo=object({version:literal(9),appearance:type({customFonts:optional(array(N)),navigation:optional(type({primaryNav:optional(j),secondaryNav:optional(W),tabs:optional(I)})),pageElements:type({pageTitle:optional(a),pageDescription:optional(a),headingLarge:optional(a),headingMedium:optional(a),headingSmall:optional(a),bodyText:optional(a),link:optional(w)})})}),Xe=object({version:literal(10),appearance:type({customFonts:optional(array(N)),navigation:optional(type({primaryNav:optional(j),secondaryNav:optional(W),tabs:optional(I)})),pageElements:type({pageTitle:optional(a),pageDescription:optional(a),headingXLarge:optional(a),headingLarge:optional(a),headingMedium:optional(a),headingSmall:optional(a),headingXSmall:optional(a),bodyText:optional(a),link:optional(w)})})}),Yo=Xe;var en=["large","medium","small"],tn=["large","medium","small"];var nn={default:"Default",android:"Android",cssVar:"CSS Var",json:"JSON",less:"Less",scss:"SCSS",swift:"Swift"};var an=["solid","dashed","dotted","double","groove","ridge","outset","inset"];function Qe(e){return typeof e!="string"?!1:e.split("{").length-1===1&&e.startsWith("{")&&e.endsWith("}")}n(Qe,"isTokenReference");function b(e){return typeof e=="string"&&e.includes("{")}n(b,"hasTokenReferences");function Ze(e){return !Qe(e)}n(Ze,"isNotTokenReference");var l=t.define("Token Reference",e=>typeof e!="string"?!1:Ze(e)?"Must start and end with curly braces":!0),et={border:"border",shadow:"shadow",transition:"transition"},tt=Object.values(et),ot={string:"string",number:"number",boolean:"boolean",color:"color",dimension:"dimension",duration:"duration",fontWeight:"fontWeight",strokeStyle:"strokeStyle",cubicBezier:"cubicBezier"},nt=Object.values(ot);function q(e){return tt.includes(e)}n(q,"isTokenTypeComposite");function Te(e){return nt.includes(e)}n(Te,"isTokenTypeSingular");expectType([{inset:!1,color:"#000",offsetX:"0px",offsetY:"0px",spread:"0px",blur:"0px"},{color:"#000",offsetX:"0px",offsetY:"0px",spread:"0px",blur:"0px",inset:!0}]);var c=t.type({id:t.string(),description:t.optional(t.string()),references:t.optional(t.array(t.array(t.string()))),tokenConfig:t.optional(t.type({purpose:t.optional(t.string())}))});expectType([{type:"duration",value:"1ms",originalValue:"1ms",id:"1",kind:"static"},{type:"duration",value:"1ms",kind:"ref",id:"1",originalValue:"{a.b}",referencedTokenId:"1"},{type:"duration",value:"1ms",originalValue:"1ms",id:"1",kind:"ref"},{type:"duration",value:"1ms",kind:"static",id:"1",originalValue:"{a.b}",referencedTokenId:"1"},{type:"color",value:"#000",kind:"static",id:"1",originalValue:"#000"},{type:"color",value:"#000",kind:"ref",id:"1",originalValue:"{c.b}",referencedTokenId:"c.b"},{type:"cubicBezier",kind:"static",value:[0,0,0,1],originalValue:[0,0,0,1],id:"1"}]);function Tn(e){return q(e.type)}n(Tn,"isTokenDataComposite");expectType([{type:"border",kind:"static",id:"1",value:{color:"#000",style:"solid",width:"1px"},originalValue:{color:"#000",style:"solid",width:"1px"}},{type:"border",kind:"ref",referencedTokenId:"a.b",id:"1",value:{color:"red",style:"dashed",width:"2px"},originalValue:"{a.b}"},{type:"shadow",value:{color:"#000",offsetX:"1px",offsetY:"1px",blur:"1px",spread:"1px",inset:!1},originalValue:{color:"#000",offsetX:"{a.a}",offsetY:"1px",blur:"1px",spread:"1px",inset:!1},id:"1",kind:"static"},{type:"shadow",kind:"ref",referencedTokenId:"a.b",value:{inset:!0,color:"red",offsetX:"1px",blur:"2px",offsetY:"3px",spread:"4px"},originalValue:"{a.b}",id:"1"},{type:"transition",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:"{a.b}",kind:"ref",referencedTokenId:"a.b",id:"1"},{type:"transition",kind:"static",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:{duration:"100ms",delay:"{a.c}",timingFunction:"{a.c}"},id:"1"},{type:"transition",kind:"static",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},id:"1"}]);function it(e){return typeof e=="string"&&!b(e)}n(it,"isTokenValueColor");var A=t.define("Color Value",e=>typeof e!="string"?"Value must be a string":e===""?"Value must not be empty":b(e)?"Value must not contain {} (token references)":!0),at=t.assign(t.type({type:t.literal("color"),value:A,kind:t.literal("static"),originalValue:A}),c),st=t.assign(t.type({type:t.literal("color"),value:A,kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c);function J(e){return typeof e=="string"&&(e.endsWith("px")||e.endsWith("rem"))&&!b(e)}n(J,"isTokenValueDimension");var D=t.define("Dimension Value",e=>typeof e!="string"?"Value must be a string":b(e)?"Value must not contain {} (token references)":!e.endsWith("px")&&!e.endsWith("rem")&&!e.endsWith("em")&&!e.endsWith("%")?"Value must end with px, rem, em or %":!0),pt=t.assign(t.type({type:t.literal("dimension"),value:D,kind:t.literal("static"),originalValue:D}),c),lt=t.assign(t.type({type:t.literal("dimension"),value:D,kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c);function Sn(e){return typeof e=="string"&&e.endsWith("ms")&&!b(e)}n(Sn,"isTokenValueDuration");var R=t.define("Duration Value",e=>typeof e!="string"?"Value must be a string":b(e)?"Value must not contain {} (token references)":/^\d+ms$/.test(e)?!0:'Value must be a number followed by "ms" (e.g., "100ms")'),ct=t.assign(t.type({type:t.literal("duration"),value:R,kind:t.literal("static"),originalValue:R}),c),ut=t.assign(t.type({type:t.literal("duration"),value:R,kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c);function Cn(e){return (typeof e=="string"||typeof e=="number")&&!b(e)}n(Cn,"isTokenValueFontWeight");var ae=t.define("Font Weight Value",e=>typeof e!="string"&&typeof e!="number"?"Value must be a string or number":b(e)?"Value must not contain {} (token references)":!0),gt=t.assign(t.type({type:t.literal("fontWeight"),value:ae,kind:t.literal("static"),originalValue:ae}),c),ft=t.assign(t.type({type:t.literal("fontWeight"),value:ae,kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c),L=t.define("Cubic Bezier Value",e=>Array.isArray(e)?e.length!==4||!e.every(r=>typeof r=="number")?"Value must be an array of 4 numbers":e[0]<0||e[0]>1||e[2]<0||e[2]>1?"The first and third cubicBezier values must be between 0 and 1":!0:"Value must be an array"),mt=t.assign(t.type({type:t.literal("cubicBezier"),value:L,kind:t.literal("static"),originalValue:L}),c),yt=t.assign(t.type({type:t.literal("cubicBezier"),value:L,kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c);function dt(e){return isObject(e)&&it(e.color)&&J(e.offsetX)&&J(e.offsetY)&&J(e.blur)&&J(e.spread)}n(dt,"isTokenValueShadow");var Se=t.define("Shadow Value",e=>dt(e)?!0:`Expected a shadow value, got ${JSON.stringify(e)}`),kt=t.assign(t.type({type:t.literal("shadow"),value:Se,kind:t.literal("static"),originalValue:t.type({color:t.union([A,l]),offsetX:t.union([D,l]),offsetY:t.union([D,l]),blur:t.union([D,l]),spread:t.union([D,l]),inset:t.union([t.optional(t.boolean()),l])})}),c),Tt=t.assign(t.type({type:t.literal("shadow"),value:Se,kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c),O=t.union([t.literal("solid"),t.literal("dashed"),t.literal("dotted"),t.literal("double"),t.literal("groove"),t.literal("ridge"),t.literal("outset"),t.literal("inset")]);function St(e){return isObject(e)&&A.is(e.color)&&O.is(e.style)&&D.is(e.width)}n(St,"isTokenValueBorder");var Ce=t.define("Border Value",St),Ct=t.assign(t.type({type:t.literal("border"),value:Ce,kind:t.literal("static"),originalValue:t.type({color:t.union([A,l]),style:t.union([O,l]),width:t.union([D,l])})}),c),xt=t.assign(t.type({type:t.literal("border"),value:Ce,kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c);function bt(e){return isObject(e)&&L.is(e.timingFunction)&&R.is(e.duration)&&R.is(e.delay)}n(bt,"isTokenValueTransition");var xe=t.define("Transition Value",bt),Dt=t.assign(t.type({type:t.literal("transition"),value:xe,kind:t.literal("static"),originalValue:t.type({timingFunction:t.union([L,l]),duration:t.union([R,l]),delay:t.union([R,l])})}),c),ht=t.assign(t.type({type:t.literal("transition"),value:xe,kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c),Vt=t.assign(t.type({type:t.literal("string"),value:t.string(),kind:t.literal("static"),originalValue:t.string()}),c),Pt=t.assign(t.type({type:t.literal("string"),value:t.string(),kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c),vt=t.assign(t.type({type:t.literal("strokeStyle"),value:O,kind:t.literal("static"),originalValue:O}),c),It=t.assign(t.type({type:t.literal("strokeStyle"),value:O,kind:t.literal("ref"),originalValue:l,referencedTokenId:O}),c),Rt=t.assign(t.type({type:t.literal("number"),value:t.number(),kind:t.literal("static"),originalValue:t.number()}),c),Bt=t.assign(t.type({type:t.literal("number"),value:t.number(),kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c),Et=t.assign(t.type({type:t.literal("boolean"),value:t.boolean(),kind:t.literal("static"),originalValue:t.boolean()}),c),Nt=t.assign(t.type({type:t.literal("boolean"),value:t.boolean(),kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c),xn=n(e=>{if(!isObject(e))throw new Error(`Expected token data to be an object, got ${JSON.stringify(e)}`);if(!isObjKey("type",e))throw new Error(`Expected token data to have a "type" property, got ${JSON.stringify(e)}`);if(typeof e.type!="string")throw new Error(`Expected token data "type" property to be a string, got ${JSON.stringify(e)}`);let r=e.type,i=e.kind;try{switch(r){case"boolean":i==="ref"?Nt.assert(e):Et.assert(e);return;case"border":i==="ref"?xt.assert(e):Ct.assert(e);return;case"color":i==="ref"?st.assert(e):at.assert(e);return;case"cubicBezier":i==="ref"?yt.assert(e):mt.assert(e);return;case"dimension":i==="ref"?lt.assert(e):pt.assert(e);return;case"duration":i==="ref"?ut.assert(e):ct.assert(e);return;case"fontWeight":i==="ref"?ft.assert(e):gt.assert(e);return;case"number":i==="ref"?Bt.assert(e):Rt.assert(e);return;case"shadow":i==="ref"?Tt.assert(e):kt.assert(e);return;case"string":i==="ref"?Pt.assert(e):Vt.assert(e);return;case"strokeStyle":i==="ref"?It.assert(e):vt.assert(e);return;case"transition":i==="ref"?ht.assert(e):Dt.assert(e);return;default:{throw new Error(`Unknown token data type: ${r}`)}}}catch(u){throw u instanceof t.StructError?new Error(`Invalid token data for type "${r}": ${u.message}. Received this data: "${JSON.stringify(e)}"`):u}},"assertTokenData");expectType([{type:"dimension",kind:"static",value:"1px"},{type:"dimension",kind:"ref",referencedTokenId:"a.b"}]);expectType([{type:"border",kind:"ref",referencedTokenId:"a.b"},{type:"border",kind:"static",value:{color:{kind:"static",type:"color",value:"red"},style:{kind:"ref",type:"strokeStyle",referencedTokenId:""},width:{kind:"static",type:"dimension",value:"2px"}}}]);expectType([{type:"transition",kind:"ref",referencedTokenId:"a.b"},{type:"transition",kind:"static",value:{delay:{kind:"static",type:"duration",value:"1ms"},duration:{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},timingFunction:{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]}}}]);function Bn(e){return Te(e?.type)}n(Bn,"isTokenSrcValueInfoSingular");function En(e){return q(e?.type)}n(En,"isTokenSrcValueInfoComposite");expectType([{type:"dimension",kind:"static",value:"1px"},{type:"transition",kind:"ref",referencedTokenId:"a.b"},{type:"transition",kind:"ref",value:"1px"},{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]},{type:"transition",kind:"static",value:{delay:{kind:"static",type:"duration",value:"1ms"},duration:{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},timingFunction:{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]}}}]);function At(e){return isObject(e)&&isObjKey("cloud.knapsack",e)}n(At,"isTokenSrcExtensions");expectType(["#ddd",!0,[83,1,1,1],{color:"#000",style:"solid",width:"1px"},{inset:!0,color:"#000",offsetX:"0px",offsetY:"{spacing.medium}",spread:"0px",blur:"0px"},{timingFunction:"{timing.ease}",duration:"{timing.duration.medium}",delay:"7ms",color:"#000"}]);function Kn(e){return !!(isObject(e)&&isObjKey("$value",e))}n(Kn,"isTokenSrc");function Ot(e){return isObject(e)&&!At(e)&&!isObjKey("$value",e)&&!isObjKey("cloud.knapsack",e)}n(Ot,"isTokenGroup");function Fn(e){if(Ot(e)){let r=e.$extensions["cloud.knapsack"].group.collectionInfo;if(isObjKey("type",r)&&isObjKey("referenceId",r))return !0}return !1}n(Fn,"isTokenTypeVarRef");function jn(e){let r=typeof e;if(r==="string"||r==="number"||r==="boolean")return r;throw new Error(`Invalid token value type: ${JSON.stringify(r)}. Token value is: ${JSON.stringify(e)}`)}n(jn,"getPrimitiveValue");var Wn=n(e=>e.includes("px")||e.includes("rem")||e.includes("em")||e.includes("%"),"isDimensionString");function _n(e){let{value:r,unit:i}=parseNumberWithUnit(e);if(!i)return {value:r};if(i!=="px"&&i!=="rem"&&i!=="em"&&i!=="%")throw new Error(`Invalid unit "${i}" for value: ${r}`);return {value:r,unit:i}}n(_n,"parseTokenDimensionValue");var Hn=n(e=>isObject(e)&&e.type==="text","isSlottedText");function qn(e){return isObject(e)&&e.type==="template-demo"}n(qn,"isSlottedTemplateDemo");function Jn(e){return isObject(e)&&e.type==="template-reference"}n(Jn,"isSlottedTemplateReference");var Ft=(i=>(i.portrait="portrait",i.landscape="landscape",i))(Ft||{});function Yn(e){return e?.type==="data"}n(Yn,"isDataDemo");function Xn(e){return e?.type==="template"}n(Xn,"isTemplateDemo");var be=(d=>(d.auto="auto",d.small="small",d.medium="medium",d.large="large",d.full="full",d))(be||{});function zt(e){return !isObject(e)||!["assetSetsState","customPagesState","navsState","patternsState","tokensSrc","db"].every(i=>isObjKey(i,e))?!1:!isObjKey("metaState",e)}n(zt,"isKsAppClientDataNoMeta");var rr=define("KsAppClientDataNoMeta",zt);function Mt(e){return isObject(e)?["assetSetsState","customPagesState","navsState","patternsState","tokensSrc","metaState","db"].every(i=>isObjKey(i,e)):!1}n(Mt,"isKsAppClientDataAndMeta");var ir=define("KsAppClientDataAndMeta",Mt),jt=type({isLocalDev:boolean(),plugins:array(type({id:string(),hasContent:boolean(),clientPluginPath:optional(string()),cssPath:optional(string())})),meta:optional(type({version:optional(string()),hasKnapsackCloud:boolean(),knapsackCloudSiteId:optional(string()),serverPort:optional(number()),websocketsPort:optional(number()),https:optional(boolean()),cacheDir:optional(string()),ksVersions:type({app:string()})}))}),ar=jt.is;function _t(e){return !isObject(e)||!["assetSetsState","customPagesState","navsState","patternsState","settingsState","tokensState"].every(i=>isObjKey(i,e))?!1:!isObjKey("metaState",e)}n(_t,"isKsAppClientDataNoMetaV3");var br=define("KsAppClientDataNoMeta",_t);function Lt(e){return isObject(e)?["assetSetsState","customPagesState","navsState","patternsState","settingsState","tokensState","metaState"].every(i=>isObjKey(i,e)):!1}n(Lt,"isKsAppClientDataAndMetaV3");var Dr=define("KsAppClientDataAndMeta",Lt),Gt=type({isLocalDev:boolean(),plugins:array(type({id:string(),hasContent:boolean(),clientPluginPath:optional(string()),cssPath:optional(string())})),meta:optional(type({version:optional(string()),hasKnapsackCloud:boolean(),knapsackCloudSiteId:optional(string()),serverPort:optional(number()),websocketsPort:optional(number()),https:optional(boolean()),cacheDir:optional(string()),ksVersions:type({app:string()})}))}),hr=Gt.is;var ve={version:"4.1.7",checkIfNeeded:n(e=>!0,"checkIfNeeded"),migrate:n(e=>{if(!isDraft(e))throw new Error("Tried to run migrations on appClientData but it is not an Immer Draft");Object.values(e.patternsState.patterns).forEach(r=>{delete r.demoSize;}),Object.values(e.db.demos.byId).forEach(r=>{r.type==="data"&&(Object.entries(r.data.slots??{}).forEach(([i,u])=>{r.data.slots[i]=u.map(f=>typeof f=="string"?{type:"text",text:f}:(f.type==="template-reference"||f.type==="text"||(f.type="template-demo"),f));}),!(r.patternId&&r.templateId)&&(()=>{for(let{id:i,templates:u=[]}of Object.values(e.patternsState.patterns))for(let{id:f,demoIds:d=[]}of u)if(d.includes(r.id)){r.patternId=i,r.templateId=f;return}})());});},"migrate")};var Er=[ve];var Ht=(k=>(k.string="string",k.boolean="boolean",k.number="number",k.object="object",k.options="options",k.function="function",k.customTypeScript="customTypeScript",k.array="array",k.arrayOfObjects="arrayOfObjects",k.arrayOfStrings="arrayOfStrings",k.arrayOfNumbers="arrayOfNumbers",k.unknown="unknown",k))(Ht||{}),wr=n(e=>"type"in e&&e.type==="string"&&!("enum"in e),"isStringProp"),Ar=n(e=>"type"in e&&e.type==="number","isNumberProp"),Or=n(e=>"type"in e&&e.type==="boolean","isBooleanProp"),Kr=n(e=>"enum"in e,"isOptionsProp"),Fr=n(e=>"typeof"in e&&e?.typeof==="function","isFunctionProp"),Ur=n(e=>!("typeof"in e)&&"tsType"in e,"isCustomTypeScriptProp"),zr=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="object","isArrayOfObjectsProp"),Mr=n(e=>"type"in e&&e.type==="object"&&"properties"in e&&Object.keys(e.properties).length>0,"isObjectProp"),jr=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="string","isArrayOfStringsProp"),Wr=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="number","isArrayOfNumbersProp");var Ie=t.object({op:t.union([t.literal("replace"),t.literal("remove"),t.literal("add")]),path:t.array(t.union([t.string(),t.number()])),value:t.optional(t.any())}),qt=Ie,Gr=n(e=>qt.is(e),"isPatch"),le=t.array(Ie),Jt=le,$r=n(e=>Jt.is(e),"isPatches"),Re=t.type({patches:le,inversePatches:t.optional(le),event:t.optional(t.object({type:t.string()})),id:t.string(),date:t.string(),userId:t.optional(t.string())}),Yt=Re,Hr=n(e=>Yt.is(e),"isKsRemoteChange"),Xt=t.array(Re),Qt=Xt,qr=n(e=>Qt.is(e),"isKsRemoteChanges");var Xr={react:"react",vue:"vue","web-components":"web-components",twig:"twig",hbs:"hbs",angular:"angular",html:"html"};var Zt=(r=>(r.ready="ready",r))(Zt||{}),Zr="ks-meta";var ti={PATTERN_TEMPLATE_CHANGED:"PATTERN_TEMPLATE_CHANGED",PATTERN_ASSET_CHANGED:"PATTERN_ASSET_CHANGED",DESIGN_TOKENS_CHANGED:"DESIGN_TOKENS_CHANGED",RENDERER_CLIENT_RELOAD:"RENDERER_CLIENT_RELOAD",APP_CLIENT_DATA_CHANGED:"APP_CLIENT_DATA_CHANGED"};var eo=(d=>(d.GitHub="GitHub",d.GitLab="GitLab",d.GitLabRest="GitLabRest",d.Bitbucket="Bitbucket",d.Azure="Azure",d))(eo||{}),to=(u=>(u.Conflicting="CONFLICTING",u.Mergeable="MERGEABLE",u.Unknown="UNKNOWN",u))(to||{}),oo=(f=>(f.Create="CREATE",f.Move="MOVE",f.Update="UPDATE",f.Chmod="CHMOD",f))(oo||{}),no=(i=>(i.Base64="BASE64",i.Text="TEXT",i))(no||{});var Ee={};ue(Ee,{ACTIONS:()=>Be,endpoint:()=>ro});var ro="/plugins",Be=(r=>(r.getContent="getContent",r))(Be||{});var we={};ue(we,{ACTIONS:()=>Ne,endpoint:()=>io});var io="/files",Ne=(r=>(r.verify="verify",r))(Ne||{});var ao={ADMIN:"ADMIN",ANONYMOUS:"ANONYMOUS",CONTRIBUTOR:"CONTRIBUTOR",EDITOR:"EDITOR",MANAGER:"MANAGER",VIEWER:"VIEWER"},ii=Object.values(ao);
8
+ var Ie=Object.defineProperty;var n=(e,r)=>Ie(e,"name",{value:r,configurable:!0});function Ne(e){if(typeof e!="string")return !1;try{return !!Re.get(e)}catch{return !1}}n(Ne,"isColor");var F=define("ColorStringStruct",e=>typeof e=="string"&&Ne(e)),p=union([type({type:literal("value"),colorValue:F}),type({type:literal("design-token"),tokenName:string()})]),ro=type({type:literal("design-token"),tokenName:string()});var uo=["h1","h2","h3","h4","h5","h6"],ge=object({unit:enums(["rem","px"]),value:number()}),fe=union([string(),number()]),Fe=(i=>(i.woff2="woff2",i.woff="woff",i))(Fe||{}),Ue=enums(["woff2","woff"]),ze=type({format:Ue,type:literal("url"),path:string()}),N=type({family:optional(string()),weight:optional(union([fe,size(array(fe),2)])),src:optional(array(ze)),style:optional(string()),display:optional(enums(["auto","block","swap","fallback","optional"])),variationSettings:optional(string()),unicodeRange:optional(string())}),Me=(f=>(f.inherit="As typed",f.capitalize="Capitalize",f.lowercase="Lowercase",f.uppercase="Uppercase",f))(Me||{}),je=(u=>(u["ultra-condensed"]="Ultra-condensed",u["extra-condensed"]="Extra-condensed",u.condensed="Condensed",u["semi-condensed"]="Semi-condensed",u.normal="Normal",u["semi-expanded"]="Semi-expanded",u.expanded="Expanded",u["extra-expanded"]="Extra-expanded",u["ultra-expanded"]="Ultra-expanded",u))(je||{}),w=type({fontWeight:optional(union([string(),number()])),textColor:optional(p),hoverColor:optional(p),underline:optional(boolean()),textTransform:optional(enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:optional(enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))}),We=type({min:ge,max:optional(ge)}),a=type({fontSize:optional(We),lineHeight:optional(union([string(),number()])),fontWeight:optional(union([string(),number()])),letterSpacing:optional(string()),fontFamily:optional(string()),textColor:optional(p),textTransform:optional(enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:optional(enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))}),m={},me={},go={pageTitle:m,pageDescription:m,headingLarge:m,headingMedium:m,headingSmall:m,bodyText:m,link:me},fo={pageTitle:m,pageDescription:m,headingXLarge:m,headingLarge:m,headingMedium:m,headingSmall:m,headingXSmall:m,bodyText:m,link:me};var I=union([a,type({accentColor:optional(p)})]),j=union([I,type({hoverColor:optional(p),backgroundColor:optional(p)})]),W=union([I,type({backgroundColor:optional(p)})]),_e={},Le={},Ge={},xo={primaryNav:Ge,secondaryNav:Le,tabs:_e};var Ao=object({version:literal(1),oldSillySidebarBgColor:F}),Oo=object({version:literal(2),anotherSillySidebarBgColor:F}),Ko=object({version:literal(3),sidebarBgColor:F}),Fo=object({version:literal(4),primaryColor:p,darkColor:p,lightColor:p,enableSidebarIcons:optional(defaulted(boolean(),!0))}),Uo=object({version:literal(5),primaryColor:p,darkColor:p,lightColor:p,linkColor:p,enableSidebarIcons:optional(defaulted(boolean(),!0))}),zo=object({version:literal(6),primaryColor:p,darkColor:p,lightColor:p,linkColor:p,enableSidebarIcons:optional(defaulted(boolean(),!0)),appearance:type({customFonts:optional(array(N)),pageElements:type({pageTitle:optional(a),pageDescription:optional(a),headingLarge:optional(a),headingMedium:optional(a),headingSmall:optional(a),bodyText:optional(a),link:optional(w)})})}),Mo=object({version:literal(7),primaryColor:p,darkColor:p,lightColor:p,linkColor:p,enableSidebarIcons:optional(defaulted(boolean(),!0)),appearance:type({customFonts:optional(array(N)),navigation:optional(type({primaryNav:optional(j),secondaryNav:optional(W),tabs:optional(I)})),pageElements:type({pageTitle:optional(a),pageDescription:optional(a),headingLarge:optional(a),headingMedium:optional(a),headingSmall:optional(a),bodyText:optional(a),link:optional(w)})})}),jo=object({version:literal(8),primaryColor:p,darkColor:p,lightColor:p,linkColor:p,appearance:type({customFonts:optional(array(N)),navigation:optional(type({primaryNav:optional(j),secondaryNav:optional(W),tabs:optional(I)})),pageElements:type({pageTitle:optional(a),pageDescription:optional(a),headingLarge:optional(a),headingMedium:optional(a),headingSmall:optional(a),bodyText:optional(a),link:optional(w)})})}),Wo=object({version:literal(9),appearance:type({customFonts:optional(array(N)),navigation:optional(type({primaryNav:optional(j),secondaryNav:optional(W),tabs:optional(I)})),pageElements:type({pageTitle:optional(a),pageDescription:optional(a),headingLarge:optional(a),headingMedium:optional(a),headingSmall:optional(a),bodyText:optional(a),link:optional(w)})})}),$e=object({version:literal(10),appearance:type({customFonts:optional(array(N)),navigation:optional(type({primaryNav:optional(j),secondaryNav:optional(W),tabs:optional(I)})),pageElements:type({pageTitle:optional(a),pageDescription:optional(a),headingXLarge:optional(a),headingLarge:optional(a),headingMedium:optional(a),headingSmall:optional(a),headingXSmall:optional(a),bodyText:optional(a),link:optional(w)})})}),_o=$e;var Ho=["large","medium","small"],Jo=["large","medium","small"];var qo={default:"Default",android:"Android",cssVar:"CSS Var",json:"JSON",less:"Less",scss:"SCSS",swift:"Swift"};var Qo=["solid","dashed","dotted","double","groove","ridge","outset","inset"];function He(e){return typeof e!="string"?!1:e.split("{").length-1===1&&e.startsWith("{")&&e.endsWith("}")}n(He,"isTokenReference");function x(e){return typeof e=="string"&&e.includes("{")}n(x,"hasTokenReferences");function Je(e){return !He(e)}n(Je,"isNotTokenReference");var l=t.define("Token Reference",e=>typeof e!="string"?!1:Je(e)?"Must start and end with curly braces":!0),Ye={border:"border",shadow:"shadow",transition:"transition"},qe=Object.values(Ye),Xe={string:"string",number:"number",boolean:"boolean",color:"color",dimension:"dimension",duration:"duration",fontWeight:"fontWeight",strokeStyle:"strokeStyle",cubicBezier:"cubicBezier"},Qe=Object.values(Xe);function J(e){return qe.includes(e)}n(J,"isTokenTypeComposite");function de(e){return Qe.includes(e)}n(de,"isTokenTypeSingular");expectType([{inset:!1,color:"#000",offsetX:"0px",offsetY:"0px",spread:"0px",blur:"0px"},{color:"#000",offsetX:"0px",offsetY:"0px",spread:"0px",blur:"0px",inset:!0}]);var c=t.type({id:t.string(),description:t.optional(t.string()),references:t.optional(t.array(t.array(t.string()))),tokenConfig:t.optional(t.type({purpose:t.optional(t.string())}))});expectType([{type:"duration",value:"1ms",originalValue:"1ms",id:"1",kind:"static"},{type:"duration",value:"1ms",kind:"ref",id:"1",originalValue:"{a.b}",referencedTokenId:"1"},{type:"duration",value:"1ms",originalValue:"1ms",id:"1",kind:"ref"},{type:"duration",value:"1ms",kind:"static",id:"1",originalValue:"{a.b}",referencedTokenId:"1"},{type:"color",value:"#000",kind:"static",id:"1",originalValue:"#000"},{type:"color",value:"#000",kind:"ref",id:"1",originalValue:"{c.b}",referencedTokenId:"c.b"},{type:"cubicBezier",kind:"static",value:[0,0,0,1],originalValue:[0,0,0,1],id:"1"}]);function un(e){return J(e.type)}n(un,"isTokenDataComposite");expectType([{type:"border",kind:"static",id:"1",value:{color:"#000",style:"solid",width:"1px"},originalValue:{color:"#000",style:"solid",width:"1px"}},{type:"border",kind:"ref",referencedTokenId:"a.b",id:"1",value:{color:"red",style:"dashed",width:"2px"},originalValue:"{a.b}"},{type:"shadow",value:{color:"#000",offsetX:"1px",offsetY:"1px",blur:"1px",spread:"1px",inset:!1},originalValue:{color:"#000",offsetX:"{a.a}",offsetY:"1px",blur:"1px",spread:"1px",inset:!1},id:"1",kind:"static"},{type:"shadow",kind:"ref",referencedTokenId:"a.b",value:{inset:!0,color:"red",offsetX:"1px",blur:"2px",offsetY:"3px",spread:"4px"},originalValue:"{a.b}",id:"1"},{type:"transition",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:"{a.b}",kind:"ref",referencedTokenId:"a.b",id:"1"},{type:"transition",kind:"static",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:{duration:"100ms",delay:"{a.c}",timingFunction:"{a.c}"},id:"1"},{type:"transition",kind:"static",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},id:"1"}]);function et(e){return typeof e=="string"&&!x(e)}n(et,"isTokenValueColor");var A=t.define("Color Value",e=>typeof e!="string"?"Value must be a string":e===""?"Value must not be empty":x(e)?"Value must not contain {} (token references)":!0),tt=t.assign(t.type({type:t.literal("color"),value:A,kind:t.literal("static"),originalValue:A}),c),ot=t.assign(t.type({type:t.literal("color"),value:A,kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c);function Y(e){return typeof e=="string"&&(e.endsWith("px")||e.endsWith("rem"))&&!x(e)}n(Y,"isTokenValueDimension");var D=t.define("Dimension Value",e=>typeof e!="string"?"Value must be a string":x(e)?"Value must not contain {} (token references)":!e.endsWith("px")&&!e.endsWith("rem")&&!e.endsWith("em")&&!e.endsWith("%")?"Value must end with px, rem, em or %":!0),nt=t.assign(t.type({type:t.literal("dimension"),value:D,kind:t.literal("static"),originalValue:D}),c),rt=t.assign(t.type({type:t.literal("dimension"),value:D,kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c);function gn(e){return typeof e=="string"&&e.endsWith("ms")&&!x(e)}n(gn,"isTokenValueDuration");var R=t.define("Duration Value",e=>typeof e!="string"?"Value must be a string":x(e)?"Value must not contain {} (token references)":/^\d+ms$/.test(e)?!0:'Value must be a number followed by "ms" (e.g., "100ms")'),it=t.assign(t.type({type:t.literal("duration"),value:R,kind:t.literal("static"),originalValue:R}),c),at=t.assign(t.type({type:t.literal("duration"),value:R,kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c);function fn(e){return (typeof e=="string"||typeof e=="number")&&!x(e)}n(fn,"isTokenValueFontWeight");var ae=t.define("Font Weight Value",e=>typeof e!="string"&&typeof e!="number"?"Value must be a string or number":x(e)?"Value must not contain {} (token references)":!0),st=t.assign(t.type({type:t.literal("fontWeight"),value:ae,kind:t.literal("static"),originalValue:ae}),c),pt=t.assign(t.type({type:t.literal("fontWeight"),value:ae,kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c),L=t.define("Cubic Bezier Value",e=>Array.isArray(e)?e.length!==4||!e.every(r=>typeof r=="number")?"Value must be an array of 4 numbers":e[0]<0||e[0]>1||e[2]<0||e[2]>1?"The first and third cubicBezier values must be between 0 and 1":!0:"Value must be an array"),lt=t.assign(t.type({type:t.literal("cubicBezier"),value:L,kind:t.literal("static"),originalValue:L}),c),ct=t.assign(t.type({type:t.literal("cubicBezier"),value:L,kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c);function ut(e){return isObject(e)&&et(e.color)&&Y(e.offsetX)&&Y(e.offsetY)&&Y(e.blur)&&Y(e.spread)}n(ut,"isTokenValueShadow");var ke=t.define("Shadow Value",e=>ut(e)?!0:`Expected a shadow value, got ${JSON.stringify(e)}`),gt=t.assign(t.type({type:t.literal("shadow"),value:ke,kind:t.literal("static"),originalValue:t.type({color:t.union([A,l]),offsetX:t.union([D,l]),offsetY:t.union([D,l]),blur:t.union([D,l]),spread:t.union([D,l]),inset:t.union([t.optional(t.boolean()),l])})}),c),ft=t.assign(t.type({type:t.literal("shadow"),value:ke,kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c),O=t.union([t.literal("solid"),t.literal("dashed"),t.literal("dotted"),t.literal("double"),t.literal("groove"),t.literal("ridge"),t.literal("outset"),t.literal("inset")]);function mt(e){return isObject(e)&&A.is(e.color)&&O.is(e.style)&&D.is(e.width)}n(mt,"isTokenValueBorder");var Te=t.define("Border Value",mt),yt=t.assign(t.type({type:t.literal("border"),value:Te,kind:t.literal("static"),originalValue:t.type({color:t.union([A,l]),style:t.union([O,l]),width:t.union([D,l])})}),c),dt=t.assign(t.type({type:t.literal("border"),value:Te,kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c);function kt(e){return isObject(e)&&L.is(e.timingFunction)&&R.is(e.duration)&&R.is(e.delay)}n(kt,"isTokenValueTransition");var Se=t.define("Transition Value",kt),Tt=t.assign(t.type({type:t.literal("transition"),value:Se,kind:t.literal("static"),originalValue:t.type({timingFunction:t.union([L,l]),duration:t.union([R,l]),delay:t.union([R,l])})}),c),St=t.assign(t.type({type:t.literal("transition"),value:Se,kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c),Ct=t.assign(t.type({type:t.literal("string"),value:t.string(),kind:t.literal("static"),originalValue:t.string()}),c),bt=t.assign(t.type({type:t.literal("string"),value:t.string(),kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c),xt=t.assign(t.type({type:t.literal("strokeStyle"),value:O,kind:t.literal("static"),originalValue:O}),c),Dt=t.assign(t.type({type:t.literal("strokeStyle"),value:O,kind:t.literal("ref"),originalValue:l,referencedTokenId:O}),c),ht=t.assign(t.type({type:t.literal("number"),value:t.number(),kind:t.literal("static"),originalValue:t.number()}),c),Vt=t.assign(t.type({type:t.literal("number"),value:t.number(),kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c),Pt=t.assign(t.type({type:t.literal("boolean"),value:t.boolean(),kind:t.literal("static"),originalValue:t.boolean()}),c),vt=t.assign(t.type({type:t.literal("boolean"),value:t.boolean(),kind:t.literal("ref"),originalValue:l,referencedTokenId:t.string()}),c),mn=n(e=>{if(!isObject(e))throw new Error(`Expected token data to be an object, got ${JSON.stringify(e)}`);if(!isObjKey("type",e))throw new Error(`Expected token data to have a "type" property, got ${JSON.stringify(e)}`);if(typeof e.type!="string")throw new Error(`Expected token data "type" property to be a string, got ${JSON.stringify(e)}`);let r=e.type,i=e.kind;try{switch(r){case"boolean":i==="ref"?vt.assert(e):Pt.assert(e);return;case"border":i==="ref"?dt.assert(e):yt.assert(e);return;case"color":i==="ref"?ot.assert(e):tt.assert(e);return;case"cubicBezier":i==="ref"?ct.assert(e):lt.assert(e);return;case"dimension":i==="ref"?rt.assert(e):nt.assert(e);return;case"duration":i==="ref"?at.assert(e):it.assert(e);return;case"fontWeight":i==="ref"?pt.assert(e):st.assert(e);return;case"number":i==="ref"?Vt.assert(e):ht.assert(e);return;case"shadow":i==="ref"?ft.assert(e):gt.assert(e);return;case"string":i==="ref"?bt.assert(e):Ct.assert(e);return;case"strokeStyle":i==="ref"?Dt.assert(e):xt.assert(e);return;case"transition":i==="ref"?St.assert(e):Tt.assert(e);return;default:{throw new Error(`Unknown token data type: ${r}`)}}}catch(u){throw u instanceof t.StructError?new Error(`Invalid token data for type "${r}": ${u.message}. Received this data: "${JSON.stringify(e)}"`):u}},"assertTokenData");expectType([{type:"dimension",kind:"static",value:"1px"},{type:"dimension",kind:"ref",referencedTokenId:"a.b"}]);expectType([{type:"border",kind:"ref",referencedTokenId:"a.b"},{type:"border",kind:"static",value:{color:{kind:"static",type:"color",value:"red"},style:{kind:"ref",type:"strokeStyle",referencedTokenId:""},width:{kind:"static",type:"dimension",value:"2px"}}}]);expectType([{type:"transition",kind:"ref",referencedTokenId:"a.b"},{type:"transition",kind:"static",value:{delay:{kind:"static",type:"duration",value:"1ms"},duration:{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},timingFunction:{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]}}}]);function Dn(e){return de(e?.type)}n(Dn,"isTokenSrcValueInfoSingular");function hn(e){return J(e?.type)}n(hn,"isTokenSrcValueInfoComposite");expectType([{type:"dimension",kind:"static",value:"1px"},{type:"transition",kind:"ref",referencedTokenId:"a.b"},{type:"transition",kind:"ref",value:"1px"},{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]},{type:"transition",kind:"static",value:{delay:{kind:"static",type:"duration",value:"1ms"},duration:{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},timingFunction:{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]}}}]);function Rt(e){return isObject(e)&&isObjKey("cloud.knapsack",e)}n(Rt,"isTokenSrcExtensions");expectType(["#ddd",!0,[83,1,1,1],{color:"#000",style:"solid",width:"1px"},{inset:!0,color:"#000",offsetX:"0px",offsetY:"{spacing.medium}",spread:"0px",blur:"0px"},{timingFunction:"{timing.ease}",duration:"{timing.duration.medium}",delay:"7ms",color:"#000"}]);function Rn(e){return !!(isObject(e)&&isObjKey("$value",e))}n(Rn,"isTokenSrc");function Bt(e){return isObject(e)&&!Rt(e)&&!isObjKey("$value",e)&&!isObjKey("cloud.knapsack",e)}n(Bt,"isTokenGroup");function Bn(e){if(Bt(e)){let r=e.$extensions["cloud.knapsack"].group.collectionInfo;if(isObjKey("type",r)&&isObjKey("referenceId",r))return !0}return !1}n(Bn,"isTokenTypeVarRef");function An(e){let r=typeof e;if(r==="string"||r==="number"||r==="boolean")return r;throw new Error(`Invalid token value type: ${JSON.stringify(r)}. Token value is: ${JSON.stringify(e)}`)}n(An,"getPrimitiveValue");var On=n(e=>e.includes("px")||e.includes("rem")||e.includes("em")||e.includes("%"),"isDimensionString");function Kn(e){let{value:r,unit:i}=parseNumberWithUnit(e);if(!i)return {value:r};if(i!=="px"&&i!=="rem"&&i!=="em"&&i!=="%")throw new Error(`Invalid unit "${i}" for value: ${r}`);return {value:r,unit:i}}n(Kn,"parseTokenDimensionValue");var Mn=n(e=>isObject(e)&&e.type==="text","isSlottedText");function jn(e){return isObject(e)&&e.type==="template-demo"}n(jn,"isSlottedTemplateDemo");function Wn(e){return isObject(e)&&e.type==="template-reference"}n(Wn,"isSlottedTemplateReference");var Nt=(i=>(i.portrait="portrait",i.landscape="landscape",i))(Nt||{});function _n(e){return e?.type==="data"}n(_n,"isDataDemo");function Ln(e){return e?.type==="template"}n(Ln,"isTemplateDemo");var Ce=(d=>(d.auto="auto",d.small="small",d.medium="medium",d.large="large",d.full="full",d))(Ce||{});function At(e){return !isObject(e)||!["assetSetsState","customPagesState","navsState","patternsState","tokensSrc","db"].every(i=>isObjKey(i,e))?!1:!isObjKey("metaState",e)}n(At,"isKsAppClientDataNoMeta");var Xn=define("KsAppClientDataNoMeta",At);function Ot(e){return isObject(e)?["assetSetsState","customPagesState","navsState","patternsState","tokensSrc","metaState","db"].every(i=>isObjKey(i,e)):!1}n(Ot,"isKsAppClientDataAndMeta");var Qn=define("KsAppClientDataAndMeta",Ot),Kt=type({isLocalDev:boolean(),plugins:array(type({id:string(),hasContent:boolean(),clientPluginPath:optional(string()),cssPath:optional(string())})),meta:optional(type({version:optional(string()),hasKnapsackCloud:boolean(),knapsackCloudSiteId:optional(string()),serverPort:optional(number()),websocketsPort:optional(number()),https:optional(boolean()),cacheDir:optional(string()),ksVersions:type({app:string()})}))}),Zn=Kt.is;function Ut(e){return !isObject(e)||!["assetSetsState","customPagesState","navsState","patternsState","settingsState","tokensState"].every(i=>isObjKey(i,e))?!1:!isObjKey("metaState",e)}n(Ut,"isKsAppClientDataNoMetaV3");var yr=define("KsAppClientDataNoMeta",Ut);function zt(e){return isObject(e)?["assetSetsState","customPagesState","navsState","patternsState","settingsState","tokensState","metaState"].every(i=>isObjKey(i,e)):!1}n(zt,"isKsAppClientDataAndMetaV3");var dr=define("KsAppClientDataAndMeta",zt),Mt=type({isLocalDev:boolean(),plugins:array(type({id:string(),hasContent:boolean(),clientPluginPath:optional(string()),cssPath:optional(string())})),meta:optional(type({version:optional(string()),hasKnapsackCloud:boolean(),knapsackCloudSiteId:optional(string()),serverPort:optional(number()),websocketsPort:optional(number()),https:optional(boolean()),cacheDir:optional(string()),ksVersions:type({app:string()})}))}),kr=Mt.is;var Ve={version:"4.1.7",checkIfNeeded:n(e=>!0,"checkIfNeeded"),migrate:n(e=>{if(!isDraft(e))throw new Error("Tried to run migrations on appClientData but it is not an Immer Draft");Object.values(e.patternsState.patterns).forEach(r=>{delete r.demoSize;}),Object.values(e.db.demos.byId).forEach(r=>{r.type==="data"&&(Object.entries(r.data.slots??{}).forEach(([i,u])=>{r.data.slots[i]=u.map(f=>typeof f=="string"?{type:"text",text:f}:(f.type==="template-reference"||f.type==="text"||(f.type="template-demo"),f));}),!(r.patternId&&r.templateId)&&(()=>{for(let{id:i,templates:u=[]}of Object.values(e.patternsState.patterns))for(let{id:f,demoIds:d=[]}of u)if(d.includes(r.id)){r.patternId=i,r.templateId=f;return}})());});},"migrate")};var hr=[Ve];var Wt=(k=>(k.string="string",k.boolean="boolean",k.number="number",k.object="object",k.options="options",k.function="function",k.customTypeScript="customTypeScript",k.array="array",k.arrayOfObjects="arrayOfObjects",k.arrayOfStrings="arrayOfStrings",k.arrayOfNumbers="arrayOfNumbers",k.unknown="unknown",k))(Wt||{}),Pr=n(e=>"type"in e&&e.type==="string"&&!("enum"in e),"isStringProp"),vr=n(e=>"type"in e&&e.type==="number","isNumberProp"),Ir=n(e=>"type"in e&&e.type==="boolean","isBooleanProp"),Rr=n(e=>"enum"in e,"isOptionsProp"),Br=n(e=>"typeof"in e&&e?.typeof==="function","isFunctionProp"),Er=n(e=>!("typeof"in e)&&"tsType"in e,"isCustomTypeScriptProp"),Nr=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="object","isArrayOfObjectsProp"),wr=n(e=>"type"in e&&e.type==="object"&&"properties"in e&&Object.keys(e.properties).length>0,"isObjectProp"),Ar=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="string","isArrayOfStringsProp"),Or=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="number","isArrayOfNumbersProp");var Pe=t.object({op:t.union([t.literal("replace"),t.literal("remove"),t.literal("add")]),path:t.array(t.union([t.string(),t.number()])),value:t.optional(t.any())}),_t=Pe,Ur=n(e=>_t.is(e),"isPatch"),le=t.array(Pe),Lt=le,zr=n(e=>Lt.is(e),"isPatches"),ve=t.type({patches:le,inversePatches:t.optional(le),event:t.optional(t.object({type:t.string()})),id:t.string(),date:t.string(),userId:t.optional(t.string())}),Gt=ve,Mr=n(e=>Gt.is(e),"isKsRemoteChange"),$t=t.array(ve),Ht=$t,jr=n(e=>Ht.is(e),"isKsRemoteChanges");var Lr={react:"react",vue:"vue","web-components":"web-components",twig:"twig",hbs:"hbs",angular:"angular",html:"html"};var Jt=(r=>(r.ready="ready",r))(Jt||{}),$r="ks-meta";var Jr={PATTERN_TEMPLATE_CHANGED:"PATTERN_TEMPLATE_CHANGED",PATTERN_ASSET_CHANGED:"PATTERN_ASSET_CHANGED",DESIGN_TOKENS_CHANGED:"DESIGN_TOKENS_CHANGED",RENDERER_CLIENT_RELOAD:"RENDERER_CLIENT_RELOAD",APP_CLIENT_DATA_CHANGED:"APP_CLIENT_DATA_CHANGED"};var Yt=(d=>(d.GitHub="GitHub",d.GitLab="GitLab",d.GitLabRest="GitLabRest",d.Bitbucket="Bitbucket",d.Azure="Azure",d))(Yt||{}),qt=(u=>(u.Conflicting="CONFLICTING",u.Mergeable="MERGEABLE",u.Unknown="UNKNOWN",u))(qt||{}),Xt=(f=>(f.Create="CREATE",f.Move="MOVE",f.Update="UPDATE",f.Chmod="CHMOD",f))(Xt||{}),Qt=(i=>(i.Base64="BASE64",i.Text="TEXT",i))(Qt||{});var Zt={ADMIN:"ADMIN",ANONYMOUS:"ANONYMOUS",CONTRIBUTOR:"CONTRIBUTOR",EDITOR:"EDITOR",MANAGER:"MANAGER",VIEWER:"VIEWER"},Xr=Object.values(Zt);
9
9
 
10
- export { en as BlockSizes, tn as BlockSpacings, p as ColorConfigStruct, F as ColorStringStruct, uo as ColorTokenConfigStruct, we as FilesApi, N as FontFaceConfigStruct, _e as FontFaceFormatsEnumStruct, We as FontFaceSourceFormats, Le as FontFaceSourceStruct, ye as FontFaceWeightStruct, He as FontSizeConfigStruct, me as FontSizeConfigValStruct, $e as FontStretches, eo as GitProviderType, So as HeadingLevels, ir as KsAppClientDataAndMetaStruct, Dr as KsAppClientDataAndMetaStructV3, rr as KsAppClientDataNoMetaStruct, br as KsAppClientDataNoMetaStructV3, jt as KsMetaStateStruct, Gt as KsMetaStateStructV3, Qt as KsRemoteChangesStruct, Zt as KsRendererClientEvents, to as MergeableState, I as NavCustomizationConfigStruct, be as PageHeaderSizes, Ee as PluginsApi, j as PrimaryNavCustomizationConfigStruct, Ht as PropTypeNames, oo as RestActions, W as SecondaryNavCustomizationConfigStruct, Ft as StageLayouts, no as TextEncoding, Ge as TextTransforms, l as TokenReferenceStruct, A as TokenValueColorStruct, L as TokenValueCubicBezierStruct, D as TokenValueDimensionStruct, R as TokenValueDurationStruct, ae as TokenValueFontWeightStruct, O as TokenValueStrokeStyleStruct, a as TypographyConfigStruct, w as TypographyLinkConfigStruct, Yo as UiConfigStruct, Xe as UiConfigV10Struct, jo as UiConfigV1Struct, Wo as UiConfigV2Struct, _o as UiConfigV3Struct, Lo as UiConfigV4Struct, Go as UiConfigV5Struct, $o as UiConfigV6Struct, Ho as UiConfigV7Struct, qo as UiConfigV8Struct, Jo as UiConfigV9Struct, ti as WS_EVENTS, xn as assertTokenData, Ro as customizableNavElements, jn as getPrimitiveValue, b as hasTokenReferences, Wr as isArrayOfNumbersProp, zr as isArrayOfObjectsProp, jr as isArrayOfStringsProp, Or as isBooleanProp, Ur as isCustomTypeScriptProp, Yn as isDataDemo, Wn as isDimensionString, Fr as isFunctionProp, Mt as isKsAppClientDataAndMeta, Lt as isKsAppClientDataAndMetaV3, zt as isKsAppClientDataNoMeta, _t as isKsAppClientDataNoMetaV3, ar as isKsMetaState, hr as isKsMetaStateV3, Hr as isKsRemoteChange, qr as isKsRemoteChanges, Ze as isNotTokenReference, Ar as isNumberProp, Mr as isObjectProp, Kr as isOptionsProp, Gr as isPatch, $r as isPatches, qn as isSlottedTemplateDemo, Jn as isSlottedTemplateReference, Hn as isSlottedText, wr as isStringProp, Xn as isTemplateDemo, Tn as isTokenDataComposite, Ot as isTokenGroup, Qe as isTokenReference, Kn as isTokenSrc, At as isTokenSrcExtensions, En as isTokenSrcValueInfoComposite, Bn as isTokenSrcValueInfoSingular, q as isTokenTypeComposite, Te as isTokenTypeSingular, Fn as isTokenTypeVarRef, St as isTokenValueBorder, it as isTokenValueColor, J as isTokenValueDimension, Sn as isTokenValueDuration, Cn as isTokenValueFontWeight, dt as isTokenValueShadow, bt as isTokenValueTransition, Zr as ksRendererClientMetaId, Er as migrations, Co as pageElements, xo as pageElementsV2, _n as parseTokenDimensionValue, Xr as rendererIds, ii as roles, ao as rolesById, an as strokeStyleValues, nn as tokenNameDisplayFormats, tt as tokenTypeComposites, nt as tokenTypeSingulars };
10
+ export { Ho as BlockSizes, Jo as BlockSpacings, p as ColorConfigStruct, F as ColorStringStruct, ro as ColorTokenConfigStruct, N as FontFaceConfigStruct, Ue as FontFaceFormatsEnumStruct, Fe as FontFaceSourceFormats, ze as FontFaceSourceStruct, fe as FontFaceWeightStruct, We as FontSizeConfigStruct, ge as FontSizeConfigValStruct, je as FontStretches, Yt as GitProviderType, uo as HeadingLevels, Qn as KsAppClientDataAndMetaStruct, dr as KsAppClientDataAndMetaStructV3, Xn as KsAppClientDataNoMetaStruct, yr as KsAppClientDataNoMetaStructV3, Kt as KsMetaStateStruct, Mt as KsMetaStateStructV3, Ht as KsRemoteChangesStruct, Jt as KsRendererClientEvents, qt as MergeableState, I as NavCustomizationConfigStruct, Ce as PageHeaderSizes, j as PrimaryNavCustomizationConfigStruct, Wt as PropTypeNames, Xt as RestActions, W as SecondaryNavCustomizationConfigStruct, Nt as StageLayouts, Qt as TextEncoding, Me as TextTransforms, l as TokenReferenceStruct, A as TokenValueColorStruct, L as TokenValueCubicBezierStruct, D as TokenValueDimensionStruct, R as TokenValueDurationStruct, ae as TokenValueFontWeightStruct, O as TokenValueStrokeStyleStruct, a as TypographyConfigStruct, w as TypographyLinkConfigStruct, _o as UiConfigStruct, $e as UiConfigV10Struct, Ao as UiConfigV1Struct, Oo as UiConfigV2Struct, Ko as UiConfigV3Struct, Fo as UiConfigV4Struct, Uo as UiConfigV5Struct, zo as UiConfigV6Struct, Mo as UiConfigV7Struct, jo as UiConfigV8Struct, Wo as UiConfigV9Struct, Jr as WS_EVENTS, mn as assertTokenData, xo as customizableNavElements, An as getPrimitiveValue, x as hasTokenReferences, Or as isArrayOfNumbersProp, Nr as isArrayOfObjectsProp, Ar as isArrayOfStringsProp, Ir as isBooleanProp, Er as isCustomTypeScriptProp, _n as isDataDemo, On as isDimensionString, Br as isFunctionProp, Ot as isKsAppClientDataAndMeta, zt as isKsAppClientDataAndMetaV3, At as isKsAppClientDataNoMeta, Ut as isKsAppClientDataNoMetaV3, Zn as isKsMetaState, kr as isKsMetaStateV3, Mr as isKsRemoteChange, jr as isKsRemoteChanges, Je as isNotTokenReference, vr as isNumberProp, wr as isObjectProp, Rr as isOptionsProp, Ur as isPatch, zr as isPatches, jn as isSlottedTemplateDemo, Wn as isSlottedTemplateReference, Mn as isSlottedText, Pr as isStringProp, Ln as isTemplateDemo, un as isTokenDataComposite, Bt as isTokenGroup, He as isTokenReference, Rn as isTokenSrc, Rt as isTokenSrcExtensions, hn as isTokenSrcValueInfoComposite, Dn as isTokenSrcValueInfoSingular, J as isTokenTypeComposite, de as isTokenTypeSingular, Bn as isTokenTypeVarRef, mt as isTokenValueBorder, et as isTokenValueColor, Y as isTokenValueDimension, gn as isTokenValueDuration, fn as isTokenValueFontWeight, ut as isTokenValueShadow, kt as isTokenValueTransition, $r as ksRendererClientMetaId, hr as migrations, go as pageElements, fo as pageElementsV2, Kn as parseTokenDimensionValue, Lr as rendererIds, Xr as roles, Zt as rolesById, Qo as strokeStyleValues, qo as tokenNameDisplayFormats, qe as tokenTypeComposites, Qe as tokenTypeSingulars };
11
11
  //# sourceMappingURL=index.mjs.map
12
12
  //# sourceMappingURL=index.mjs.map