@knapsack/types 4.104.5-canary-20261009230149 → 4.104.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -56,19 +56,6 @@ export interface KsAppClientData {
56
56
  * @see {@link createTemplateInfoId} for getting the key
57
57
  */
58
58
  templatesConfig?: Record<TemplateInfoId, RendererTemplateConfig>;
59
- /**
60
- * Which branches' changes this content already contains. The api-server
61
- * writes it into `db.yml` when it commits a branch, so the deployed
62
- * content says what is in it: the branch reduction skips changes listed
63
- * here instead of applying them a second time, and the hourly cron marks
64
- * a PUBLISHING branch PUBLISHED once the deployed content lists it.
65
- * Lives under `db` because the App Client writes every `db` key it does
66
- * not split into other files back to `db.yml`.
67
- */
68
- publishState?: {
69
- /** Instance id to the id of its last dataChanges row in this content */
70
- includedDataChangeIds?: Record<string, string>;
71
- };
72
59
  settings: {
73
60
  title?: string;
74
61
  hideTitleInNavigation?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/app-client-data/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,QAAQ,EAMd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,w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AM,aAAa,wCAAuB,CAAC"}
package/dist/changes.d.ts CHANGED
@@ -49,20 +49,4 @@ export type KsRemoteChange = SetOptional<KsChange, 'inversePatches' | 'event' |
49
49
  export declare const isKsRemoteChange: (change: unknown) => change is KsRemoteChange;
50
50
  export declare const KsRemoteChangesStruct: s.Describe<KsRemoteChange[]>;
51
51
  export declare const isKsRemoteChanges: (changes: unknown) => changes is KsRemoteChange[];
52
- /**
53
- * The changes of PUBLISHING instances that the content does not contain yet,
54
- * in order. `includedDataChangeIds` (the content's
55
- * `db.publishState.includedDataChangeIds`) maps an instance id to its last
56
- * dataChanges row in the content; that row and every row before it are left
57
- * out, since applying them again would duplicate what they added. When the
58
- * listed id is not among the instance's rows, all of them are kept: nothing
59
- * proves the content has them.
60
- */
61
- export declare function selectPublishingChangesToApply({ publishingInstances, includedDataChangeIds, }: {
62
- publishingInstances: ReadonlyArray<{
63
- readonly id: string;
64
- readonly changes: KsRemoteChange[];
65
- }>;
66
- includedDataChangeIds: Readonly<Record<string, string>> | undefined;
67
- }): KsRemoteChange[];
68
52
  //# sourceMappingURL=changes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../src/changes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAE/C;;GAEG;AAEH,YAAY,EAAE,KAAK,EAAE,CAAC;AAStB,eAAO,MAAM,OAAO,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,KAC3B,CAAC;AAKxB,eAAO,MAAM,SAAS,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,KAAK,EAClC,CAAC;AAE5B;;;;;;GAMG;AACH,MAAM,MAAM,SAA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F,eAAO,MAAM,gBAAgB,GAAI,QAAQ,OAAO,KAAG,MAAM,IAAI,cAC5B,CAAC;AAGlC,eAAO,MAAM,qBAAqB,EAAE,CAAC,CAAC,QAAQ,CAAC,cAAc,EAAE,CACjC,CAAC;AAE/B,eAAO,MAAM,iBAAiB,GAC5B,SAAS,OAAO,KACf,OAAO,IAAI,cAAc,EAAuC,CAAC"}
package/dist/changes.js CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var t=require('superstruct');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var t__namespace=/*#__PURE__*/_interopNamespace(t);var d=Object.defineProperty;var s=(e,i)=>d(e,"name",{value:i,configurable:true});var c=t__namespace.object({op:t__namespace.union([t__namespace.literal("replace"),t__namespace.literal("remove"),t__namespace.literal("add")]),path:t__namespace.array(t__namespace.union([t__namespace.string(),t__namespace.number()])),value:t__namespace.optional(t__namespace.any())}),u=c,f=s(e=>u.is(e),"isPatch"),a=t__namespace.array(c),l=a,K=s(e=>l.is(e),"isPatches"),m=t__namespace.union([t__namespace.object({kind:t__namespace.literal("page"),id:t__namespace.string()}),t__namespace.object({kind:t__namespace.literal("pattern"),id:t__namespace.string()})]),p=t__namespace.type({patches:a,inversePatches:t__namespace.optional(a),event:t__namespace.optional(t__namespace.object({type:t__namespace.string()})),entityRefs:t__namespace.optional(t__namespace.array(m)),id:t__namespace.string(),date:t__namespace.string(),userId:t__namespace.optional(t__namespace.string())}),y=p,x=s(e=>y.is(e),"isKsRemoteChange"),R=t__namespace.array(p),P=R,S=s(e=>P.is(e),"isKsRemoteChanges");function b({publishingInstances:e,includedDataChangeIds:i}){return e.flatMap(({id:h,changes:n})=>{let r=i?.[h];if(!r)return n;let o=n.findIndex(g=>g.id===r);return o===-1?n:n.slice(o+1)})}s(b,"selectPublishingChangesToApply");exports.KsRemoteChangesStruct=P;exports.isKsRemoteChange=x;exports.isKsRemoteChanges=S;exports.isPatch=f;exports.isPatches=K;exports.selectPublishingChangesToApply=b;//# sourceMappingURL=changes.js.map
1
+ 'use strict';var t=require('superstruct');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var t__namespace=/*#__PURE__*/_interopNamespace(t);var o=Object.defineProperty;var s=(e,r)=>o(e,"name",{value:r,configurable:true});var i=t__namespace.object({op:t__namespace.union([t__namespace.literal("replace"),t__namespace.literal("remove"),t__namespace.literal("add")]),path:t__namespace.array(t__namespace.union([t__namespace.string(),t__namespace.number()])),value:t__namespace.optional(t__namespace.any())}),c=i,R=s(e=>c.is(e),"isPatch"),n=t__namespace.array(i),p=n,l=s(e=>p.is(e),"isPatches"),h=t__namespace.union([t__namespace.object({kind:t__namespace.literal("page"),id:t__namespace.string()}),t__namespace.object({kind:t__namespace.literal("pattern"),id:t__namespace.string()})]),a=t__namespace.type({patches:n,inversePatches:t__namespace.optional(n),event:t__namespace.optional(t__namespace.object({type:t__namespace.string()})),entityRefs:t__namespace.optional(t__namespace.array(h)),id:t__namespace.string(),date:t__namespace.string(),userId:t__namespace.optional(t__namespace.string())}),g=a,d=s(e=>g.is(e),"isKsRemoteChange"),m=t__namespace.array(a),u=m,P=s(e=>u.is(e),"isKsRemoteChanges");exports.KsRemoteChangesStruct=u;exports.isKsRemoteChange=d;exports.isKsRemoteChanges=P;exports.isPatch=R;exports.isPatches=l;//# sourceMappingURL=changes.js.map
2
2
  //# sourceMappingURL=changes.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/changes.ts"],"names":["PatchStructRuntime","t","PatchStruct","isPatch","__name","patch","PatchesStructRuntime","PatchesStruct","isPatches","patches","EntityRefStructRuntime","KsRemoteChangeRuntime","KsRemoteChangeStruct","isKsRemoteChange","change","KsRemoteChangesStructRuntime","KsRemoteChangesStruct","isKsRemoteChanges","changes","selectPublishingChangesToApply","publishingInstances","includedDataChangeIds","id","includedId","includedIndex"],"mappings":"ieAWA,IAAMA,CAAAA,CAAuBC,oBAAO,CAClC,EAAA,CAAMA,mBAAM,CAAGA,YAAA,CAAA,OAAA,CAAQ,SAAS,CAAA,CAAKA,YAAA,CAAA,OAAA,CAAQ,QAAQ,CAAA,CAAKA,YAAA,CAAA,OAAA,CAAQ,KAAK,CAAC,CAAC,CAAA,CACzE,IAAA,CAAQA,YAAA,CAAA,KAAA,CAAQA,YAAA,CAAA,KAAA,CAAM,CAAGA,YAAA,CAAA,MAAA,EAAO,CAAKA,qBAAQ,CAAC,CAAC,CAAA,CAC/C,KAAA,CAASA,YAAA,CAAA,QAAA,CAAWA,YAAA,CAAA,GAAA,EAAK,CAC3B,CAAC,CAAA,CACKC,CAAAA,CAAiCF,EAE1BG,CAAAA,CAAUC,CAAAA,CAACC,GACtBH,CAAAA,CAAY,EAAA,CAAGG,CAAK,CAAA,CADC,SAAA,CAAA,CAGjBC,CAAAA,CAAyBL,mBAAMD,CAAkB,CAAA,CACjDO,EAAqCD,CAAAA,CAE9BE,CAAAA,CAAYJ,EAACK,CAAAA,EACxBF,CAAAA,CAAc,EAAA,CAAGE,CAAO,CAAA,CADD,WAAA,CAAA,CAcnBC,EAA2BT,YAAA,CAAA,KAAA,CAAM,CACnCA,oBAAO,CAAE,IAAA,CAAQA,qBAAQ,MAAM,CAAA,CAAG,EAAA,CAAMA,YAAA,CAAA,MAAA,EAAS,CAAC,EAClDA,YAAA,CAAA,MAAA,CAAO,CAAE,KAAQA,YAAA,CAAA,OAAA,CAAQ,SAAS,EAAG,EAAA,CAAMA,YAAA,CAAA,MAAA,EAAS,CAAC,CACzD,CAAC,EA0BKU,CAAAA,CAA0BV,YAAA,CAAA,IAAA,C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H,CAlBgBpB,CAAAA,CAAAe,CAAAA,CAAA,gCAAA,CAAA","file":"changes.js","sourcesContent":["import * as s from 'superstruct';\nimport type { Patch } from 'immer';\nimport type { SetOptional } from '@knapsack/utils';\nimport type { UUID, DateString } from './misc';\n\n/**\n * Patch\n */\n\nexport type { Patch };\n\nconst PatchStructRuntime = s.object({\n op: s.union([s.literal('replace'), s.literal('remove'), s.literal('add')]),\n path: s.array(s.union([s.string(), s.number()])),\n value: s.optional(s.any()),\n});\nconst PatchStruct: s.Describe<Patch> = PatchStructRuntime;\n\nexport const isPatch = (patch: unknown): patch is Patch =>\n PatchStruct.is(patch);\n\nconst PatchesStructRuntime = s.array(PatchStructRuntime);\nconst PatchesStruct: s.Describe<Patch[]> = PatchesStructRuntime;\n\nexport const isPatches = (patches: unknown): patches is Patch[] =>\n PatchesStruct.is(patches);\n\n/**\n * EntityRef\n *\n * Identifies which page or pattern a change touched - used to derive\n * concurrent-editing presence (ENG-8951) without needing full patch\n * inspection at read time.\n */\nexport type EntityRef =\n | { kind: 'page'; id: string }\n | { kind: 'pattern'; id: string };\n\nconst EntityRefStructRuntime = s.union([\n s.object({ kind: s.literal('page'), id: s.string() }),\n s.object({ kind: s.literal('pattern'), id: s.string() }),\n]);\n\n/**\n * KsRemoteChange\n */\nexport type KsChange<Event extends { type: string } = { type: string }> = {\n patches: Patch[];\n inversePatches: Patch[];\n event: Event;\n entityRefs: EntityRef[];\n id: UUID;\n date: DateString;\n};\n/**\n * `entityRefs` is optional here (unlike on `KsChange`) since remote changes\n * may come from a `dataChanges` row saved before the `entityRefs` column\n * existed, or from a subscription payload that doesn't select it yet -\n * consumers should treat a missing value as `[]`.\n */\nexport type KsRemoteChange = SetOptional<\n KsChange,\n 'inversePatches' | 'event' | 'entityRefs'\n> & {\n userId?: string;\n};\n\nconst KsRemoteChangeRuntime = s.type({\n patches: PatchesStructRuntime,\n inversePatches: s.optional(PatchesStructRuntime),\n event: s.optional(s.object({ type: s.string() })),\n entityRefs: s.optional(s.array(EntityRefStructRuntime)),\n id: s.string(),\n date: s.string(),\n userId: s.optional(s.string()),\n});\nconst KsRemoteChangeStruct: s.Describe<KsRemoteChange> = KsRemoteChangeRuntime;\n\nexport const isKsRemoteChange = (change: unknown): change is KsRemoteChange =>\n KsRemoteChangeStruct.is(change);\n\nconst KsRemoteChangesStructRuntime = s.array(KsRemoteChangeRuntime);\nexport const KsRemoteChangesStruct: s.Describe<KsRemoteChange[]> =\n KsRemoteChangesStructRuntime;\n\nexport const isKsRemoteChanges = (\n changes: unknown,\n): changes is KsRemoteChange[] => KsRemoteChangesStruct.is(changes);\n\n/**\n * The changes of PUBLISHING instances that the content does not contain yet,\n * in order. `includedDataChangeIds` (the content's\n * `db.publishState.includedDataChangeIds`) maps an instance id to its last\n * dataChanges row in the content; that row and every row before it are left\n * out, since applying them again would duplicate what they added. When the\n * listed id is not among the instance's rows, all of them are kept: nothing\n * proves the content has them.\n */\nexport function selectPublishingChangesToApply({\n publishingInstances,\n includedDataChangeIds,\n}: {\n publishingInstances: ReadonlyArray<{\n readonly id: string;\n readonly changes: KsRemoteChange[];\n }>;\n includedDataChangeIds: Readonly<Record<string, string>> | undefined;\n}): KsRemoteChange[] {\n return publishingInstances.flatMap(({ id, changes }) => {\n const includedId = includedDataChangeIds?.[id];\n if (!includedId) return changes;\n const includedIndex = changes.findIndex(\n (change) => change.id === includedId,\n );\n return includedIndex === -1 ? changes : changes.slice(includedIndex + 1);\n });\n}\n"]}
1
+ {"version":3,"sources":["../src/changes.ts"],"names":["PatchStructRuntime","t","PatchStruct","isPatch","__name","patch","PatchesStructRuntime","PatchesStruct","isPatches","patches","EntityRefStructRuntime","KsRemoteChangeRuntime","KsRemoteChangeStruct","isKsRemoteChange","change","KsRemoteChangesStructRuntime","KsRemoteChangesStruct","isKsRemoteChanges","changes"],"mappings":"gZAAA,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAA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BL,YAAA,CAAA,QAAA,CAASK,CAAoB,CAAA,CAC/C,KAAA,CAASL,sBAAWA,YAAA,CAAA,MAAA,CAAO,CAAE,IAAA,CAAQA,YAAA,CAAA,MAAA,EAAS,CAAC,CAAC,CAAA,CAChD,UAAA,CAAcA,sBAAWA,YAAA,CAAA,KAAA,CAAMS,CAAsB,CAAC,CAAA,CACtD,EAAA,CAAMT,YAAA,CAAA,MAAA,EAAO,CACb,IAAA,CAAQA,qBAAO,CACf,MAAA,CAAUA,YAAA,CAAA,QAAA,CAAWA,YAAA,CAAA,MAAA,EAAQ,CAC/B,CAAC,CAAA,CACKW,CAAAA,CAAmDD,EAE5CE,CAAAA,CAAmBT,CAAAA,CAACU,CAAAA,EAC/BF,CAAAA,CAAqB,GAAGE,CAAM,CAAA,CADA,kBAAA,CAAA,CAG1BC,CAAAA,CAAiCd,mBAAMU,CAAqB,CAAA,CACrDK,CAAAA,CACXD,CAAAA,CAEWE,EAAoBb,CAAAA,CAC/Bc,CAAAA,EACgCF,CAAAA,CAAsB,EAAA,CAAGE,CAAO,CAAA,CAFjC,mBAAA","file":"changes.js","sourcesContent":["import * as s from 'superstruct';\nimport type { Patch } from 'immer';\nimport type { SetOptional } from '@knapsack/utils';\nimport type { UUID, DateString } from './misc';\n\n/**\n * Patch\n */\n\nexport type { Patch };\n\nconst PatchStructRuntime = s.object({\n op: s.union([s.literal('replace'), s.literal('remove'), s.literal('add')]),\n path: s.array(s.union([s.string(), s.number()])),\n value: s.optional(s.any()),\n});\nconst PatchStruct: s.Describe<Patch> = PatchStructRuntime;\n\nexport const isPatch = (patch: unknown): patch is Patch =>\n PatchStruct.is(patch);\n\nconst PatchesStructRuntime = s.array(PatchStructRuntime);\nconst PatchesStruct: s.Describe<Patch[]> = PatchesStructRuntime;\n\nexport const isPatches = (patches: unknown): patches is Patch[] =>\n PatchesStruct.is(patches);\n\n/**\n * EntityRef\n *\n * Identifies which page or pattern a change touched - used to derive\n * concurrent-editing presence (ENG-8951) without needing full patch\n * inspection at read time.\n */\nexport type EntityRef =\n | { kind: 'page'; id: string }\n | { kind: 'pattern'; id: string };\n\nconst EntityRefStructRuntime = s.union([\n s.object({ kind: s.literal('page'), id: s.string() }),\n s.object({ kind: s.literal('pattern'), id: s.string() }),\n]);\n\n/**\n * KsRemoteChange\n */\nexport type KsChange<Event extends { type: string } = { type: string }> = {\n patches: Patch[];\n inversePatches: Patch[];\n event: Event;\n entityRefs: EntityRef[];\n id: UUID;\n date: DateString;\n};\n/**\n * `entityRefs` is optional here (unlike on `KsChange`) since remote changes\n * may come from a `dataChanges` row saved before the `entityRefs` column\n * existed, or from a subscription payload that doesn't select it yet -\n * consumers should treat a missing value as `[]`.\n */\nexport type KsRemoteChange = SetOptional<\n KsChange,\n 'inversePatches' | 'event' | 'entityRefs'\n> & {\n userId?: string;\n};\n\nconst KsRemoteChangeRuntime = s.type({\n patches: PatchesStructRuntime,\n inversePatches: s.optional(PatchesStructRuntime),\n event: s.optional(s.object({ type: s.string() })),\n entityRefs: s.optional(s.array(EntityRefStructRuntime)),\n id: s.string(),\n date: s.string(),\n userId: s.optional(s.string()),\n});\nconst KsRemoteChangeStruct: s.Describe<KsRemoteChange> = KsRemoteChangeRuntime;\n\nexport const isKsRemoteChange = (change: unknown): change is KsRemoteChange =>\n KsRemoteChangeStruct.is(change);\n\nconst KsRemoteChangesStructRuntime = s.array(KsRemoteChangeRuntime);\nexport const KsRemoteChangesStruct: s.Describe<KsRemoteChange[]> =\n KsRemoteChangesStructRuntime;\n\nexport const isKsRemoteChanges = (\n changes: unknown,\n): changes is KsRemoteChange[] => KsRemoteChangesStruct.is(changes);\n"]}
package/dist/changes.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import*as t from'superstruct';var d=Object.defineProperty;var s=(e,i)=>d(e,"name",{value:i,configurable:true});var c=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())}),u=c,f=s(e=>u.is(e),"isPatch"),a=t.array(c),l=a,K=s(e=>l.is(e),"isPatches"),m=t.union([t.object({kind:t.literal("page"),id:t.string()}),t.object({kind:t.literal("pattern"),id:t.string()})]),p=t.type({patches:a,inversePatches:t.optional(a),event:t.optional(t.object({type:t.string()})),entityRefs:t.optional(t.array(m)),id:t.string(),date:t.string(),userId:t.optional(t.string())}),y=p,x=s(e=>y.is(e),"isKsRemoteChange"),R=t.array(p),P=R,S=s(e=>P.is(e),"isKsRemoteChanges");function b({publishingInstances:e,includedDataChangeIds:i}){return e.flatMap(({id:h,changes:n})=>{let r=i?.[h];if(!r)return n;let o=n.findIndex(g=>g.id===r);return o===-1?n:n.slice(o+1)})}s(b,"selectPublishingChangesToApply");export{P as KsRemoteChangesStruct,x as isKsRemoteChange,S as isKsRemoteChanges,f as isPatch,K as isPatches,b as selectPublishingChangesToApply};//# sourceMappingURL=changes.mjs.map
1
+ import*as t from'superstruct';var o=Object.defineProperty;var s=(e,r)=>o(e,"name",{value:r,configurable:true});var i=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())}),c=i,R=s(e=>c.is(e),"isPatch"),n=t.array(i),p=n,l=s(e=>p.is(e),"isPatches"),h=t.union([t.object({kind:t.literal("page"),id:t.string()}),t.object({kind:t.literal("pattern"),id:t.string()})]),a=t.type({patches:n,inversePatches:t.optional(n),event:t.optional(t.object({type:t.string()})),entityRefs:t.optional(t.array(h)),id:t.string(),date:t.string(),userId:t.optional(t.string())}),g=a,d=s(e=>g.is(e),"isKsRemoteChange"),m=t.array(a),u=m,P=s(e=>u.is(e),"isKsRemoteChanges");export{u as KsRemoteChangesStruct,d as isKsRemoteChange,P as isKsRemoteChanges,R as isPatch,l as isPatches};//# sourceMappingURL=changes.mjs.map
2
2
  //# sourceMappingURL=changes.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/changes.ts"],"names":["PatchStructRuntime","PatchStruct","isPatch","__name","patch","PatchesStructRuntime","PatchesStruct","isPatches","patches","EntityRefStructRuntime","KsRemoteChangeRuntime","KsRemoteChangeStruct","isKsRemoteChange","change","KsRemoteChangesStructRuntime","KsRemoteChangesStruct","isKsRemoteChanges","changes","selectPublishingChangesToApply","publishingInstances","includedDataChangeIds","id","includedId","includedIndex"],"mappings":"+GAWA,IAAMA,CAAAA,CAAuB,SAAO,CAClC,EAAA,CAAM,QAAM,CAAG,CAAA,CAAA,OAAA,CAAQ,SAAS,CAAA,CAAK,CAAA,CAAA,OAAA,CAAQ,QAAQ,CAAA,CAAK,CAAA,CAAA,OAAA,CAAQ,KAAK,CAAC,CAAC,CAAA,CACzE,IAAA,CAAQ,CAAA,CAAA,KAAA,CAAQ,CAAA,CAAA,KAAA,CAAM,CAAG,CAAA,CAAA,MAAA,EAAO,CAAK,UAAQ,CAAC,CAAC,CAAA,CAC/C,KAAA,CAAS,CAAA,CAAA,QAAA,CAAW,CAAA,CAAA,GAAA,EAAK,CAC3B,CAAC,CAAA,CACKC,CAAAA,CAAiCD,EAE1BE,CAAAA,CAAUC,CAAAA,CAACC,GACtBH,CAAAA,CAAY,EAAA,CAAGG,CAAK,CAAA,CADC,SAAA,CAAA,CAGjBC,CAAAA,CAAyB,QAAML,CAAkB,CAAA,CACjDM,EAAqCD,CAAAA,CAE9BE,CAAAA,CAAYJ,EAACK,CAAAA,EACxBF,CAAAA,CAAc,EAAA,CAAGE,CAAO,CAAA,CADD,WAAA,CAAA,CAcnBC,EAA2B,CAAA,CAAA,KAAA,CAAM,CACnC,SAAO,CAAE,IAAA,CAAQ,UAAQ,MAAM,CAAA,CAAG,EAAA,CAAM,CAAA,CAAA,MAAA,EAAS,CAAC,EAClD,CAAA,CAAA,MAAA,CAAO,CAAE,KAAQ,CAAA,CAAA,OAAA,CAAQ,SAAS,EAAG,EAAA,CAAM,CAAA,CAAA,MAAA,EAAS,CAAC,CACzD,CAAC,EA0BKC,CAAAA,CAA0B,CAAA,CAAA,IAAA,CAAK,CACnC,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,CAAAe,CAAAA,CAAA,gCAAA,CAAA","file":"changes.mjs","sourcesContent":["import * as s from 'superstruct';\nimport type { Patch } from 'immer';\nimport type { SetOptional } from '@knapsack/utils';\nimport type { UUID, DateString } from './misc';\n\n/**\n * Patch\n */\n\nexport type { Patch };\n\nconst PatchStructRuntime = s.object({\n op: s.union([s.literal('replace'), s.literal('remove'), s.literal('add')]),\n path: s.array(s.union([s.string(), s.number()])),\n value: s.optional(s.any()),\n});\nconst PatchStruct: s.Describe<Patch> = PatchStructRuntime;\n\nexport const isPatch = (patch: unknown): patch is Patch =>\n PatchStruct.is(patch);\n\nconst PatchesStructRuntime = s.array(PatchStructRuntime);\nconst PatchesStruct: s.Describe<Patch[]> = PatchesStructRuntime;\n\nexport const isPatches = (patches: unknown): patches is Patch[] =>\n PatchesStruct.is(patches);\n\n/**\n * EntityRef\n *\n * Identifies which page or pattern a change touched - used to derive\n * concurrent-editing presence (ENG-8951) without needing full patch\n * inspection at read time.\n */\nexport type EntityRef =\n | { kind: 'page'; id: string }\n | { kind: 'pattern'; id: string };\n\nconst EntityRefStructRuntime = s.union([\n s.object({ kind: s.literal('page'), id: s.string() }),\n s.object({ kind: s.literal('pattern'), id: s.string() }),\n]);\n\n/**\n * KsRemoteChange\n */\nexport type KsChange<Event extends { type: string } = { type: string }> = {\n patches: Patch[];\n inversePatches: Patch[];\n event: Event;\n entityRefs: EntityRef[];\n id: UUID;\n date: DateString;\n};\n/**\n * `entityRefs` is optional here (unlike on `KsChange`) since remote changes\n * may come from a `dataChanges` row saved before the `entityRefs` column\n * existed, or from a subscription payload that doesn't select it yet -\n * consumers should treat a missing value as `[]`.\n */\nexport type KsRemoteChange = SetOptional<\n KsChange,\n 'inversePatches' | 'event' | 'entityRefs'\n> & {\n userId?: string;\n};\n\nconst KsRemoteChangeRuntime = s.type({\n patches: PatchesStructRuntime,\n inversePatches: s.optional(PatchesStructRuntime),\n event: s.optional(s.object({ type: s.string() })),\n entityRefs: s.optional(s.array(EntityRefStructRuntime)),\n id: s.string(),\n date: s.string(),\n userId: s.optional(s.string()),\n});\nconst KsRemoteChangeStruct: s.Describe<KsRemoteChange> = KsRemoteChangeRuntime;\n\nexport const isKsRemoteChange = (change: unknown): change is KsRemoteChange =>\n KsRemoteChangeStruct.is(change);\n\nconst KsRemoteChangesStructRuntime = s.array(KsRemoteChangeRuntime);\nexport const KsRemoteChangesStruct: s.Describe<KsRemoteChange[]> =\n KsRemoteChangesStructRuntime;\n\nexport const isKsRemoteChanges = (\n changes: unknown,\n): changes is KsRemoteChange[] => KsRemoteChangesStruct.is(changes);\n\n/**\n * The changes of PUBLISHING instances that the content does not contain yet,\n * in order. `includedDataChangeIds` (the content's\n * `db.publishState.includedDataChangeIds`) maps an instance id to its last\n * dataChanges row in the content; that row and every row before it are left\n * out, since applying them again would duplicate what they added. When the\n * listed id is not among the instance's rows, all of them are kept: nothing\n * proves the content has them.\n */\nexport function selectPublishingChangesToApply({\n publishingInstances,\n includedDataChangeIds,\n}: {\n publishingInstances: ReadonlyArray<{\n readonly id: string;\n readonly changes: KsRemoteChange[];\n }>;\n includedDataChangeIds: Readonly<Record<string, string>> | undefined;\n}): KsRemoteChange[] {\n return publishingInstances.flatMap(({ id, changes }) => {\n const includedId = includedDataChangeIds?.[id];\n if (!includedId) return changes;\n const includedIndex = changes.findIndex(\n (change) => change.id === includedId,\n );\n return includedIndex === -1 ? changes : changes.slice(includedIndex + 1);\n });\n}\n"]}
1
+ {"version":3,"sources":["../src/changes.ts"],"names":["PatchStructRuntime","PatchStruct","isPatch","__name","patch","PatchesStructRuntime","PatchesStruct","isPatches","patches","EntityRefStructRuntime","KsRemoteChangeRuntime","KsRemoteChangeStruct","isKsRemoteChange","change","KsRemoteChangesStructRuntime","KsRemoteChangesStruct","isKsRemoteChanges","changes"],"mappings":"8BAAA,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA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/C,KAAA,CAAS,WAAW,CAAA,CAAA,MAAA,CAAO,CAAE,IAAA,CAAQ,CAAA,CAAA,MAAA,EAAS,CAAC,CAAC,CAAA,CAChD,UAAA,CAAc,WAAW,CAAA,CAAA,KAAA,CAAMI,CAAsB,CAAC,CAAA,CACtD,EAAA,CAAM,CAAA,CAAA,MAAA,EAAO,CACb,IAAA,CAAQ,UAAO,CACf,MAAA,CAAU,CAAA,CAAA,QAAA,CAAW,CAAA,CAAA,MAAA,EAAQ,CAC/B,CAAC,CAAA,CACKE,CAAAA,CAAmDD,EAE5CE,CAAAA,CAAmBT,CAAAA,CAACU,CAAAA,EAC/BF,CAAAA,CAAqB,GAAGE,CAAM,CAAA,CADA,kBAAA,CAAA,CAG1BC,CAAAA,CAAiC,QAAMJ,CAAqB,CAAA,CACrDK,CAAAA,CACXD,CAAAA,CAEWE,EAAoBb,CAAAA,CAC/Bc,CAAAA,EACgCF,CAAAA,CAAsB,EAAA,CAAGE,CAAO,CAAA,CAFjC,mBAAA","file":"changes.mjs","sourcesContent":["import * as s from 'superstruct';\nimport type { Patch } from 'immer';\nimport type { SetOptional } from '@knapsack/utils';\nimport type { UUID, DateString } from './misc';\n\n/**\n * Patch\n */\n\nexport type { Patch };\n\nconst PatchStructRuntime = s.object({\n op: s.union([s.literal('replace'), s.literal('remove'), s.literal('add')]),\n path: s.array(s.union([s.string(), s.number()])),\n value: s.optional(s.any()),\n});\nconst PatchStruct: s.Describe<Patch> = PatchStructRuntime;\n\nexport const isPatch = (patch: unknown): patch is Patch =>\n PatchStruct.is(patch);\n\nconst PatchesStructRuntime = s.array(PatchStructRuntime);\nconst PatchesStruct: s.Describe<Patch[]> = PatchesStructRuntime;\n\nexport const isPatches = (patches: unknown): patches is Patch[] =>\n PatchesStruct.is(patches);\n\n/**\n * EntityRef\n *\n * Identifies which page or pattern a change touched - used to derive\n * concurrent-editing presence (ENG-8951) without needing full patch\n * inspection at read time.\n */\nexport type EntityRef =\n | { kind: 'page'; id: string }\n | { kind: 'pattern'; id: string };\n\nconst EntityRefStructRuntime = s.union([\n s.object({ kind: s.literal('page'), id: s.string() }),\n s.object({ kind: s.literal('pattern'), id: s.string() }),\n]);\n\n/**\n * KsRemoteChange\n */\nexport type KsChange<Event extends { type: string } = { type: string }> = {\n patches: Patch[];\n inversePatches: Patch[];\n event: Event;\n entityRefs: EntityRef[];\n id: UUID;\n date: DateString;\n};\n/**\n * `entityRefs` is optional here (unlike on `KsChange`) since remote changes\n * may come from a `dataChanges` row saved before the `entityRefs` column\n * existed, or from a subscription payload that doesn't select it yet -\n * consumers should treat a missing value as `[]`.\n */\nexport type KsRemoteChange = SetOptional<\n KsChange,\n 'inversePatches' | 'event' | 'entityRefs'\n> & {\n userId?: string;\n};\n\nconst KsRemoteChangeRuntime = s.type({\n patches: PatchesStructRuntime,\n inversePatches: s.optional(PatchesStructRuntime),\n event: s.optional(s.object({ type: s.string() })),\n entityRefs: s.optional(s.array(EntityRefStructRuntime)),\n id: s.string(),\n date: s.string(),\n userId: s.optional(s.string()),\n});\nconst KsRemoteChangeStruct: s.Describe<KsRemoteChange> = KsRemoteChangeRuntime;\n\nexport const isKsRemoteChange = (change: unknown): change is KsRemoteChange =>\n KsRemoteChangeStruct.is(change);\n\nconst KsRemoteChangesStructRuntime = s.array(KsRemoteChangeRuntime);\nexport const KsRemoteChangesStruct: s.Describe<KsRemoteChange[]> =\n KsRemoteChangesStructRuntime;\n\nexport const isKsRemoteChanges = (\n changes: unknown,\n): changes is KsRemoteChange[] => KsRemoteChangesStruct.is(changes);\n"]}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var t=require('superstruct'),Be=require('color-string'),v4Mini=require('zod/v4-mini'),utils=require('@knapsack/utils'),immer=require('immer'),zod=require('zod'),urls=require('@knapsack/utils/urls');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var t__namespace=/*#__PURE__*/_interopNamespace(t);var Be__default=/*#__PURE__*/_interopDefault(Be);var Oe=Object.defineProperty;var n=(e,r)=>Oe(e,"name",{value:r,configurable:true});function Fe(e){if(typeof e!="string")return false;try{return !!Be__default.default.get(e)}catch{return false}}n(Fe,"isColor");var M=t.define("ColorStringStruct",e=>typeof e=="string"&&Fe(e)),l=t.union([t.type({type:t.literal("value"),colorValue:M}),t.type({type:t.literal("design-token"),tokenName:t.string()})]),yn=t.type({type:t.literal("design-token"),tokenName:t.string()});var Cn=["h1","h2","h3","h4","h5","h6"],me=t.object({unit:t.enums(["rem","px"]),value:t.number()}),ye=t.union([t.string(),t.number()]),We=(a=>(a.woff2="woff2",a.woff="woff",a))(We||{}),Le=t.enums(["woff2","woff"]),_e=t.type({format:Le,type:t.literal("url"),path:t.string()}),w=t.type({family:t.optional(t.string()),weight:t.optional(t.union([ye,t.size(t.array(ye),2)])),src:t.optional(t.array(_e)),style:t.optional(t.string()),display:t.optional(t.enums(["auto","block","swap","fallback","optional"])),variationSettings:t.optional(t.string()),unicodeRange:t.optional(t.string())}),Ge=(f=>(f.inherit="As typed",f.capitalize="Capitalize",f.lowercase="Lowercase",f.uppercase="Uppercase",f))(Ge||{}),$e=(c=>(c["ultra-condensed"]="Ultra-condensed",c["extra-condensed"]="Extra-condensed",c.condensed="Condensed",c["semi-condensed"]="Semi-condensed",c.normal="Normal",c["semi-expanded"]="Semi-expanded",c.expanded="Expanded",c["extra-expanded"]="Extra-expanded",c["ultra-expanded"]="Ultra-expanded",c))($e||{}),O=t.type({fontWeight:t.optional(t.union([t.string(),t.number()])),textColor:t.optional(l),hoverColor:t.optional(l),underline:t.optional(t.boolean()),textTransform:t.optional(t.enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:t.optional(t.enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))}),He=t.type({min:me,max:t.optional(me)}),p=t.type({fontSize:t.optional(He),lineHeight:t.optional(t.union([t.string(),t.number()])),fontWeight:t.optional(t.union([t.string(),t.number()])),letterSpacing:t.optional(t.string()),fontFamily:t.optional(t.string()),textColor:t.optional(l),textTransform:t.optional(t.enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:t.optional(t.enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))}),y={},Te={},xn={pageTitle:y,pageDescription:y,headingLarge:y,headingMedium:y,headingSmall:y,bodyText:y,link:Te},hn={pageTitle:y,pageDescription:y,headingXLarge:y,headingLarge:y,headingMedium:y,headingSmall:y,headingXSmall:y,bodyText:y,link:Te};var V=t.union([p,t.type({accentColor:t.optional(l)})]),W=t.union([V,t.type({hoverColor:t.optional(l),backgroundColor:t.optional(l)})]),L=t.union([V,t.type({backgroundColor:t.optional(l)})]),Ye={},qe={},Je={},Vn={primaryNav:Je,secondaryNav:qe,tabs:Ye};var Bn=t.object({version:t.literal(1),oldSillySidebarBgColor:M}),An=t.object({version:t.literal(2),anotherSillySidebarBgColor:M}),Kn=t.object({version:t.literal(3),sidebarBgColor:M}),Fn=t.object({version:t.literal(4),primaryColor:l,darkColor:l,lightColor:l,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),true))}),Mn=t.object({version:t.literal(5),primaryColor:l,darkColor:l,lightColor:l,linkColor:l,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),true))}),Un=t.object({version:t.literal(6),primaryColor:l,darkColor:l,lightColor:l,linkColor:l,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),true)),appearance:t.type({customFonts:t.optional(t.array(w)),pageElements:t.type({pageTitle:t.optional(p),pageDescription:t.optional(p),headingLarge:t.optional(p),headingMedium:t.optional(p),headingSmall:t.optional(p),bodyText:t.optional(p),link:t.optional(O)})})}),jn=t.object({version:t.literal(7),primaryColor:l,darkColor:l,lightColor:l,linkColor:l,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),true)),appearance:t.type({customFonts:t.optional(t.array(w)),navigation:t.optional(t.type({primaryNav:t.optional(W),secondaryNav:t.optional(L),tabs:t.optional(V)})),pageElements:t.type({pageTitle:t.optional(p),pageDescription:t.optional(p),headingLarge:t.optional(p),headingMedium:t.optional(p),headingSmall:t.optional(p),bodyText:t.optional(p),link:t.optional(O)})})}),zn=t.object({version:t.literal(8),primaryColor:l,darkColor:l,lightColor:l,linkColor:l,appearance:t.type({customFonts:t.optional(t.array(w)),navigation:t.optional(t.type({primaryNav:t.optional(W),secondaryNav:t.optional(L),tabs:t.optional(V)})),pageElements:t.type({pageTitle:t.optional(p),pageDescription:t.optional(p),headingLarge:t.optional(p),headingMedium:t.optional(p),headingSmall:t.optional(p),bodyText:t.optional(p),link:t.optional(O)})})}),Wn=t.object({version:t.literal(9),appearance:t.type({customFonts:t.optional(t.array(w)),navigation:t.optional(t.type({primaryNav:t.optional(W),secondaryNav:t.optional(L),tabs:t.optional(V)})),pageElements:t.type({pageTitle:t.optional(p),pageDescription:t.optional(p),headingLarge:t.optional(p),headingMedium:t.optional(p),headingSmall:t.optional(p),bodyText:t.optional(p),link:t.optional(O)})})}),Xe=t.object({version:t.literal(10),appearance:t.type({customFonts:t.optional(t.array(w)),navigation:t.optional(t.type({primaryNav:t.optional(W),secondaryNav:t.optional(L),tabs:t.optional(V)})),pageElements:t.type({pageTitle:t.optional(p),pageDescription:t.optional(p),headingXLarge:t.optional(p),headingLarge:t.optional(p),headingMedium:t.optional(p),headingSmall:t.optional(p),headingXSmall:t.optional(p),bodyText:t.optional(p),link:t.optional(O)})})}),Ln=Xe;var Hn=["large","medium","small"],Yn=["large","medium","small"];var Jn={default:"Default",android:"Android",cssVar:"CSS Var",json:"JSON",less:"Less",scss:"SCSS",swift:"Swift"};var Zn=["solid","dashed","dotted","double","groove","ridge","outset","inset"];function Ze(e){return typeof e!="string"?false:e.split("{").length-1===1&&e.startsWith("{")&&e.endsWith("}")}n(Ze,"isTokenReference");function x(e){return typeof e=="string"&&e.includes("{")}n(x,"hasTokenReferences");function Qe(e){return !Ze(e)}n(Qe,"isNotTokenReference");var d=t__namespace.define("Token Reference",e=>typeof e!="string"?false:Qe(e)?"Must start and end with curly braces":true),et={border:"border",shadow:"shadow",transition:"transition"},tt=Object.values(et),nt={string:"string",number:"number",boolean:"boolean",color:"color",dimension:"dimension",duration:"duration",fontWeight:"fontWeight",strokeStyle:"strokeStyle",cubicBezier:"cubicBezier"},ot=Object.values(nt);function q(e){return tt.includes(e)}n(q,"isTokenTypeComposite");function Se(e){return ot.includes(e)}n(Se,"isTokenTypeSingular");utils.expectType([{inset:false,color:"#000",offsetX:"0px",offsetY:"0px",spread:"0px",blur:"0px"},{color:"#000",offsetX:"0px",offsetY:"0px",spread:"0px",blur:"0px",inset:true}]);var u=t__namespace.type({id:t__namespace.string(),description:t__namespace.optional(t__namespace.string()),references:t__namespace.optional(t__namespace.array(t__namespace.array(t__namespace.string()))),tokenConfig:t__namespace.optional(t__namespace.type({purpose:t__namespace.optional(t__namespace.string())}))});utils.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 oo(e){return q(e.type)}n(oo,"isTokenDataComposite");utils.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:false},originalValue:{color:"#000",offsetX:"{a.a}",offsetY:"1px",blur:"1px",spread:"1px",inset:false},id:"1",kind:"static"},{type:"shadow",kind:"ref",referencedTokenId:"a.b",value:{inset:true,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 at(e){return typeof e=="string"&&!x(e)}n(at,"isTokenValueColor");var A=t__namespace.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)":true),it=t__namespace.assign(t__namespace.type({type:t__namespace.literal("color"),value:A,kind:t__namespace.literal("static"),originalValue:A}),u),st=t__namespace.assign(t__namespace.type({type:t__namespace.literal("color"),value:A,kind:t__namespace.literal("ref"),originalValue:d,referencedTokenId:t__namespace.string()}),u);function J(e){return typeof e=="string"&&(e.endsWith("px")||e.endsWith("rem"))&&!x(e)}n(J,"isTokenValueDimension");var h=t__namespace.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 %":true),pt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("dimension"),value:h,kind:t__namespace.literal("static"),originalValue:h}),u),lt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("dimension"),value:h,kind:t__namespace.literal("ref"),originalValue:d,referencedTokenId:t__namespace.string()}),u);function ro(e){return typeof e=="string"&&e.endsWith("ms")&&!x(e)}n(ro,"isTokenValueDuration");var E=t__namespace.define("Duration Value",e=>typeof e!="string"?"Value must be a string":x(e)?"Value must not contain {} (token references)":/^\d+ms$/.test(e)?true:'Value must be a number followed by "ms" (e.g., "100ms")'),ct=t__namespace.assign(t__namespace.type({type:t__namespace.literal("duration"),value:E,kind:t__namespace.literal("static"),originalValue:E}),u),dt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("duration"),value:E,kind:t__namespace.literal("ref"),originalValue:d,referencedTokenId:t__namespace.string()}),u);function ao(e){return (typeof e=="string"||typeof e=="number")&&!x(e)}n(ao,"isTokenValueFontWeight");var pe=t__namespace.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)":true),ut=t__namespace.assign(t__namespace.type({type:t__namespace.literal("fontWeight"),value:pe,kind:t__namespace.literal("static"),originalValue:pe}),u),ft=t__namespace.assign(t__namespace.type({type:t__namespace.literal("fontWeight"),value:pe,kind:t__namespace.literal("ref"),originalValue:d,referencedTokenId:t__namespace.string()}),u),G=t__namespace.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":true:"Value must be an array"),gt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("cubicBezier"),value:G,kind:t__namespace.literal("static"),originalValue:G}),u),mt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("cubicBezier"),value:G,kind:t__namespace.literal("ref"),originalValue:d,referencedTokenId:t__namespace.string()}),u);function yt(e){return utils.isObject(e)&&at(e.color)&&J(e.offsetX)&&J(e.offsetY)&&J(e.blur)&&J(e.spread)}n(yt,"isTokenValueShadow");var be=t__namespace.define("Shadow Value",e=>yt(e)?true:`Expected a shadow value, got ${JSON.stringify(e)}`),Tt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("shadow"),value:be,kind:t__namespace.literal("static"),originalValue:t__namespace.type({color:t__namespace.union([A,d]),offsetX:t__namespace.union([h,d]),offsetY:t__namespace.union([h,d]),blur:t__namespace.union([h,d]),spread:t__namespace.union([h,d]),inset:t__namespace.union([t__namespace.optional(t__namespace.boolean()),d])})}),u),kt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("shadow"),value:be,kind:t__namespace.literal("ref"),originalValue:d,referencedTokenId:t__namespace.string()}),u),K=t__namespace.union([t__namespace.literal("solid"),t__namespace.literal("dashed"),t__namespace.literal("dotted"),t__namespace.literal("double"),t__namespace.literal("groove"),t__namespace.literal("ridge"),t__namespace.literal("outset"),t__namespace.literal("inset")]);function St(e){return utils.isObject(e)&&A.is(e.color)&&K.is(e.style)&&h.is(e.width)}n(St,"isTokenValueBorder");var Ce=t__namespace.define("Border Value",St),bt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("border"),value:Ce,kind:t__namespace.literal("static"),originalValue:t__namespace.type({color:t__namespace.union([A,d]),style:t__namespace.union([K,d]),width:t__namespace.union([h,d])})}),u),Ct=t__namespace.assign(t__namespace.type({type:t__namespace.literal("border"),value:Ce,kind:t__namespace.literal("ref"),originalValue:d,referencedTokenId:t__namespace.string()}),u);function xt(e){return utils.isObject(e)&&G.is(e.timingFunction)&&E.is(e.duration)&&E.is(e.delay)}n(xt,"isTokenValueTransition");var xe=t__namespace.define("Transition Value",xt),ht=t__namespace.assign(t__namespace.type({type:t__namespace.literal("transition"),value:xe,kind:t__namespace.literal("static"),originalValue:t__namespace.type({timingFunction:t__namespace.union([G,d]),duration:t__namespace.union([E,d]),delay:t__namespace.union([E,d])})}),u),Dt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("transition"),value:xe,kind:t__namespace.literal("ref"),originalValue:d,referencedTokenId:t__namespace.string()}),u),It=t__namespace.assign(t__namespace.type({type:t__namespace.literal("string"),value:t__namespace.string(),kind:t__namespace.literal("static"),originalValue:t__namespace.string()}),u),Pt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("string"),value:t__namespace.string(),kind:t__namespace.literal("ref"),originalValue:d,referencedTokenId:t__namespace.string()}),u),Rt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("strokeStyle"),value:K,kind:t__namespace.literal("static"),originalValue:K}),u),Vt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("strokeStyle"),value:K,kind:t__namespace.literal("ref"),originalValue:d,referencedTokenId:K}),u),Et=t__namespace.assign(t__namespace.type({type:t__namespace.literal("number"),value:t__namespace.number(),kind:t__namespace.literal("static"),originalValue:t__namespace.number()}),u),vt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("number"),value:t__namespace.number(),kind:t__namespace.literal("ref"),originalValue:d,referencedTokenId:t__namespace.string()}),u),Nt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("boolean"),value:t__namespace.boolean(),kind:t__namespace.literal("static"),originalValue:t__namespace.boolean()}),u),wt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("boolean"),value:t__namespace.boolean(),kind:t__namespace.literal("ref"),originalValue:d,referencedTokenId:t__namespace.string()}),u),io=n(e=>{if(!utils.isObject(e))throw new Error(`Expected token data to be an object, got ${JSON.stringify(e)}`);if(!utils.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,a=e.kind;try{switch(r){case "boolean":a==="ref"?wt.assert(e):Nt.assert(e);return;case "border":a==="ref"?Ct.assert(e):bt.assert(e);return;case "color":a==="ref"?st.assert(e):it.assert(e);return;case "cubicBezier":a==="ref"?mt.assert(e):gt.assert(e);return;case "dimension":a==="ref"?lt.assert(e):pt.assert(e);return;case "duration":a==="ref"?dt.assert(e):ct.assert(e);return;case "fontWeight":a==="ref"?ft.assert(e):ut.assert(e);return;case "number":a==="ref"?vt.assert(e):Et.assert(e);return;case "shadow":a==="ref"?kt.assert(e):Tt.assert(e);return;case "string":a==="ref"?Pt.assert(e):It.assert(e);return;case "strokeStyle":a==="ref"?Vt.assert(e):Rt.assert(e);return;case "transition":a==="ref"?Dt.assert(e):ht.assert(e);return;default:{throw new Error(`Unknown token data type: ${r}`)}}}catch(c){throw c instanceof t__namespace.StructError?new Error(`Invalid token data for type "${r}": ${c.message}. Received this data: "${JSON.stringify(e)}"`):c}},"assertTokenData");utils.expectType([{type:"dimension",kind:"static",value:"1px"},{type:"dimension",kind:"ref",referencedTokenId:"a.b"}]);utils.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"}}}]);utils.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 uo(e){return Se(e?.type)}n(uo,"isTokenSrcValueInfoSingular");function fo(e){return q(e?.type)}n(fo,"isTokenSrcValueInfoComposite");utils.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 Bt(e){return utils.isObject(e)&&utils.isObjKey("cloud.knapsack",e)}n(Bt,"isTokenSrcExtensions");utils.expectType(["#ddd",true,[83,1,1,1],{color:"#000",style:"solid",width:"1px"},{inset:true,color:"#000",offsetX:"0px",offsetY:"{spacing.medium}",spread:"0px",blur:"0px"},{timingFunction:"{timing.ease}",duration:"{timing.duration.medium}",delay:"7ms",color:"#000"}]);function To(e){return !!(utils.isObject(e)&&utils.isObjKey("$value",e))}n(To,"isTokenSrc");function At(e){return utils.isObject(e)&&!Bt(e)&&!utils.isObjKey("$value",e)&&!utils.isObjKey("cloud.knapsack",e)}n(At,"isTokenGroup");function ko(e){if(At(e)){let r=e.$extensions["cloud.knapsack"].group.collectionInfo;if(utils.isObjKey("type",r)&&utils.isObjKey("referenceId",r))return true}return false}n(ko,"isTokenTypeVarRef");function xo(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(xo,"getPrimitiveValue");var ho=n(e=>e.includes("px")||e.includes("rem")||e.includes("em")||e.includes("%"),"isDimensionString");function Do(e){let{value:r,unit:a}=utils.parseNumberWithUnit(e);if(!a)return {value:r};if(a!=="px"&&a!=="rem"&&a!=="em"&&a!=="%")throw new Error(`Invalid unit "${a}" for value: ${r}`);return {value:r,unit:a}}n(Do,"parseTokenDimensionValue");function Ro(e){return e?.type==="data"||e?.type==="data-w-template-info"}n(Ro,"isDemoWithData");function Vo(e){return e?.type==="data"}n(Vo,"isDataDemo");function Eo(e){return e?.type==="template"}n(Eo,"isTemplateDemo");var he=["removeHtmlAttributes","removeClassName","removeStyle","removeAria","removeEventHandlers"],vo={removeHtmlAttributes:false,removeClassName:false,removeStyle:false,removeAria:false,removeEventHandlers:false};function No(e){if(e)return he.filter(r=>e[r]===true).join(",")}n(No,"encodeInferSpecFilters");function wo(e){let r=new Set(e.split(",").map(a=>a.trim()).filter(Boolean));return Object.fromEntries(he.map(a=>[a,r.has(a)]))}n(wo,"decodeInferSpecFilters");function Oo(e){return typeof e=="object"&&!e.isInferred}n(Oo,"isSpecNotInferred");var Ko={designSrc:"Design Source",subPage:"Subpage",template:"Template"};var De=(m=>(m.auto="auto",m.small="small",m.medium="medium",m.large="large",m.full="full",m))(De||{});var Wo={patternsState:{patterns:{},renderers:{},statusSets:[]},customPagesState:{pages:{}},assetSetsState:{},navsState:{byId:{},order:[]},tokensSrc:{},filesState:{files:{}},db:{blocks:{byId:{},settings:{tokens:{rootFontSize:"16px"}}},demos:{byId:{},settings:{}},tabs:{byId:{},settings:{}},blockCollections:{byId:{},settings:{}},settings:{title:"",logoUrl:""}}};function Mt(e){return !utils.isObject(e)||!["assetSetsState","customPagesState","navsState","patternsState","tokensSrc","db"].every(a=>utils.isObjKey(a,e))?false:!utils.isObjKey("metaState",e)}n(Mt,"isKsAppClientDataNoMeta");var Lo=t.define("KsAppClientDataNoMeta",Mt),Ut=v4Mini.z.strictObject({assetSetsState:v4Mini.z.object({}),customPagesState:v4Mini.z.object({pages:v4Mini.z.object({})}),navsState:v4Mini.z.object({byId:v4Mini.z.object(),order:v4Mini.z.array(v4Mini.z.string())}),patternsState:v4Mini.z.object({patterns:v4Mini.z.object({}),renderers:v4Mini.z.object({}),statusSets:v4Mini.z.array(v4Mini.z.object())}),tokensSrc:v4Mini.z.object({}),filesState:v4Mini.z.object({files:v4Mini.z.object({})}),db:v4Mini.z.object({blocks:v4Mini.z.object({byId:v4Mini.z.object({}),settings:v4Mini.z.object({})}),demos:v4Mini.z.object({byId:v4Mini.z.object({}),settings:v4Mini.z.object({})}),tabs:v4Mini.z.optional(v4Mini.z.object({byId:v4Mini.z.object({}),settings:v4Mini.z.object({})})),blockCollections:v4Mini.z.optional(v4Mini.z.object({byId:v4Mini.z.object({}),settings:v4Mini.z.object({})})),templatesConfig:v4Mini.z.optional(v4Mini.z.object({})),settings:v4Mini.z.object({title:v4Mini.z.optional(v4Mini.z.string()),hideTitleInNavigation:v4Mini.z.optional(v4Mini.z.boolean()),logoUrl:v4Mini.z.optional(v4Mini.z.string())})})}),_o=v4Mini.z.custom().check(e=>{let{error:r}=Ut.safeParse(e.value);r&&e.issues.push(...r.issues);});function jt(e){return utils.isObject(e)?["assetSetsState","customPagesState","navsState","patternsState","tokensSrc","metaState","db"].every(a=>utils.isObjKey(a,e)):false}n(jt,"isKsAppClientDataAndMeta");var Go=t.define("KsAppClientDataAndMeta",jt),zt=t.type({isLocalDev:t.boolean(),plugins:t.array(t.type({id:t.string(),hasContent:t.boolean(),clientPluginPath:t.optional(t.string()),cssPath:t.optional(t.string())})),meta:t.optional(t.type({version:t.optional(t.string()),hasKnapsackCloud:t.boolean(),knapsackCloudSiteId:t.optional(t.string()),serverPort:t.optional(t.number()),websocketsPort:t.optional(t.number()),https:t.optional(t.boolean()),cacheDir:t.optional(t.string()),ksVersions:t.type({app:t.string()})}))}),$o=zt.is;function Lt(e){return !utils.isObject(e)||!["assetSetsState","customPagesState","navsState","patternsState","settingsState","tokensState"].every(a=>utils.isObjKey(a,e))?false:!utils.isObjKey("metaState",e)}n(Lt,"isKsAppClientDataNoMetaV3");var lr=t.define("KsAppClientDataNoMeta",Lt);function _t(e){return utils.isObject(e)?["assetSetsState","customPagesState","navsState","patternsState","settingsState","tokensState","metaState"].every(a=>utils.isObjKey(a,e)):false}n(_t,"isKsAppClientDataAndMetaV3");var cr=t.define("KsAppClientDataAndMeta",_t),Gt=t.type({isLocalDev:t.boolean(),plugins:t.array(t.type({id:t.string(),hasContent:t.boolean(),clientPluginPath:t.optional(t.string()),cssPath:t.optional(t.string())})),meta:t.optional(t.type({version:t.optional(t.string()),hasKnapsackCloud:t.boolean(),knapsackCloudSiteId:t.optional(t.string()),serverPort:t.optional(t.number()),websocketsPort:t.optional(t.number()),https:t.optional(t.boolean()),cacheDir:t.optional(t.string()),ksVersions:t.type({app:t.string()})}))}),dr=Gt.is;var Ee={version:"4.1.7",checkIfNeeded:n(e=>true,"checkIfNeeded"),migrate:n(e=>{if(!immer.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(([a,c])=>{r.data.slots[a]=c.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:a,templates:c=[]}of Object.values(e.patternsState.patterns))for(let{id:f,demoIds:m=[]}of c)if(m.includes(r.id)){r.patternId=a,r.templateId=f;return}})());});},"migrate")};var kr=[Ee];var Ht={ROOT:"ROOT",DESIGN:"Design",DEVELOP:"Develop",DOCUMENT:"Documentation",MCP:"MCP",PROTOTYPE:"Prototype",SETTINGS:"Settings"},br=Object.values(Ht);var Yt=(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))(Yt||{}),xr=n(e=>"type"in e&&e.type==="string"&&!("enum"in e),"isStringProp"),hr=n(e=>"type"in e&&e.type==="number","isNumberProp"),Dr=n(e=>"type"in e&&e.type==="boolean","isBooleanProp"),Ir=n(e=>"enum"in e,"isOptionsProp"),Pr=n(e=>"typeof"in e&&e?.typeof==="function","isFunctionProp"),Rr=n(e=>!("typeof"in e)&&"tsType"in e,"isCustomTypeScriptProp"),Vr=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="object","isArrayOfObjectsProp"),Er=n(e=>"type"in e&&e.type==="object"&&"properties"in e&&Object.keys(e.properties).length>0,"isObjectProp"),vr=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="string","isArrayOfStringsProp"),Nr=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="number","isArrayOfNumbersProp");var ve=t__namespace.object({op:t__namespace.union([t__namespace.literal("replace"),t__namespace.literal("remove"),t__namespace.literal("add")]),path:t__namespace.array(t__namespace.union([t__namespace.string(),t__namespace.number()])),value:t__namespace.optional(t__namespace.any())}),qt=ve,Br=n(e=>qt.is(e),"isPatch"),de=t__namespace.array(ve),Jt=de,Ar=n(e=>Jt.is(e),"isPatches"),Xt=t__namespace.union([t__namespace.object({kind:t__namespace.literal("page"),id:t__namespace.string()}),t__namespace.object({kind:t__namespace.literal("pattern"),id:t__namespace.string()})]),Ne=t__namespace.type({patches:de,inversePatches:t__namespace.optional(de),event:t__namespace.optional(t__namespace.object({type:t__namespace.string()})),entityRefs:t__namespace.optional(t__namespace.array(Xt)),id:t__namespace.string(),date:t__namespace.string(),userId:t__namespace.optional(t__namespace.string())}),Zt=Ne,Kr=n(e=>Zt.is(e),"isKsRemoteChange"),Qt=t__namespace.array(Ne),en=Qt,Fr=n(e=>en.is(e),"isKsRemoteChanges");function Mr({publishingInstances:e,includedDataChangeIds:r}){return e.flatMap(({id:a,changes:c})=>{let f=r?.[a];if(!f)return c;let m=c.findIndex(we=>we.id===f);return m===-1?c:c.slice(m+1)})}n(Mr,"selectPublishingChangesToApply");var oe={react:"react",vue:"vue","web-components":"web-components",twig:"twig",hbs:"hbs",angular:"angular",html:"html",ios:"ios",android:"android"},Wr=zod.z.strictObject({path:zod.z.string().describe("Can contain glob patterns, relative paths, absolute paths, package paths, or package sub-paths"),filter:zod.z.custom(e=>typeof e=="function").optional().describe("A function that takes a path and returns a boolean")});function Lr(e){return "codeSrcPath"in e}n(Lr,"isTemplateInfoWithCodeSrcPath");function tn(e){switch(e.rendererId){case "angular":case "react":return `${e.rendererId}---${e.codeSrcPath}---${e.exportName||"default"}`;case "web-components":return `${e.rendererId}---${e.elementName}`;case "twig":return `${e.rendererId}---${e.namespacePath}`;case "vue":case "hbs":case "html":return `${e.rendererId}---${e.codeSrcPath}`;case "ios":return `${e.rendererId}---${e.moduleName}---${e.symbolName}`;case "android":return `${e.rendererId}---${e.packageName}---${e.componentName}`;default:{throw new Error(`Invalid template info: ${JSON.stringify(e)}`)}}}n(tn,"createTemplateInfoId");function _r(e){return {...e,id:tn(e)}}n(_r,"addIdToTemplateInfo");function Gr({rendererId:e,alias:r,path:a}){return (()=>{switch(e){case "react":case "angular":return {rendererId:e,codeSrcPath:a,exportName:r||"default"};case "vue":case "hbs":case "html":return {rendererId:e,codeSrcPath:a};case "twig":return {rendererId:e,namespacePath:r};case "web-components":return {rendererId:e,elementName:r};case "ios":return {rendererId:e,moduleName:a,symbolName:r};case "android":return {rendererId:e,packageName:a,componentName:r};default:{throw new Error(`Invalid renderer ID: ${e}`)}}})()}n(Gr,"normalizeTemplateInfo");function $r(e){switch(e.rendererId){case "react":case "angular":return {path:e.codeSrcPath,alias:e.exportName};case "hbs":case "html":case "vue":return {path:e.codeSrcPath};case "twig":return {alias:e.namespacePath};case "web-components":return {alias:e.elementName};case "ios":return {path:e.moduleName,alias:e.symbolName};case "android":return {path:e.packageName,alias:e.componentName};default:{throw new Error(`Invalid template info: ${JSON.stringify(e)}`)}}}n($r,"convertTemplateInfoToOldWay");var Hr={id:oe.ios,title:"iOS",aliasUse:"required",aliasTitle:"Symbol Name",aliasDescription:"The synchronized name of the iOS symbol.",enableDataDemos:true,enableTemplateDemos:false,hasTemplateImgSupport:true,hasSlotsSupport:false,hasSlotOptionsSupport:false,hasInferSpecSupport:true,hasTemplateSuggestionsSupport:true},Yr={id:oe.android,title:"Android",aliasUse:"required",aliasTitle:"Component Name",aliasDescription:"The synchronized name of the Android component.",enableDataDemos:true,enableTemplateDemos:false,hasSlotsSupport:false,hasSlotOptionsSupport:false,hasTemplateImgSupport:true,hasInferSpecSupport:true,hasTemplateSuggestionsSupport:true},nn=[oe.ios,oe.android];function on(e){return nn.includes(e)}n(on,"isRendererIdForNativeMobile");function qr(e){return on(e.rendererId)}n(qr,"isTemplateInfoForNativeMobile");var rn=(r=>(r.ready="ready",r))(rn||{}),Zr="ks-meta";var ea={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 an=(m=>(m.GitHub="GitHub",m.GitLab="GitLab",m.GitLabRest="GitLabRest",m.Bitbucket="Bitbucket",m.Azure="Azure",m))(an||{}),sn=(c=>(c.Conflicting="CONFLICTING",c.Mergeable="MERGEABLE",c.Unknown="UNKNOWN",c))(sn||{}),pn=(f=>(f.Create="CREATE",f.Move="MOVE",f.Update="UPDATE",f.Chmod="CHMOD",f))(pn||{}),ln=(a=>(a.Base64="BASE64",a.Text="TEXT",a))(ln||{});var cn={ADMIN:{id:"ADMIN",title:"Admin",description:"Full access. Can manage users, publish changes, and configure all settings.",hierarchy:4,permissions:{canManageUsers:true,canDelete:true,canEdit:true,canPublish:true,canView:true},sectionAccess:{ROOT:{canEdit:false,canView:true},DOCUMENT:{canEdit:true,canView:true},DESIGN:{canEdit:true,canView:true},DEVELOP:{canEdit:true,canView:true},PROTOTYPE:{canEdit:true,canView:true},SETTINGS:{canEdit:true,canView:true},MCP:{canEdit:true,canView:true}}},CONTRIBUTOR:{id:"CONTRIBUTOR",title:"Contributor",description:"Can view and edit content across Design, Develop, and Prototype. Cannot publish or manage users.",hierarchy:3,permissions:{canManageUsers:false,canDelete:false,canEdit:true,canPublish:false,canView:true},sectionAccess:{ROOT:{canEdit:false,canView:true},DOCUMENT:{canEdit:true,canView:true},DESIGN:{canEdit:true,canView:true},DEVELOP:{canEdit:true,canView:true},PROTOTYPE:{canEdit:true,canView:true},SETTINGS:{canEdit:true,canView:true},MCP:{canEdit:false,canView:false}}},CONSUMER:{id:"CONSUMER",title:"Consumer",description:"Can view documentation and edit prototypes. Cannot access Design or Develop sections.",hierarchy:2,permissions:{canManageUsers:false,canDelete:false,canEdit:true,canPublish:false,canView:true},sectionAccess:{ROOT:{canEdit:false,canView:true},DOCUMENT:{canEdit:false,canView:true},DESIGN:{canEdit:false,canView:false},DEVELOP:{canEdit:false,canView:false},PROTOTYPE:{canEdit:true,canView:true},SETTINGS:{canEdit:false,canView:false},MCP:{canEdit:false,canView:false}}},VIEWER:{id:"VIEWER",title:"Viewer",description:"Read-only access to documentation. Cannot edit anything.",hierarchy:1,permissions:{canManageUsers:false,canDelete:false,canEdit:false,canPublish:false,canView:true},sectionAccess:{ROOT:{canEdit:false,canView:true},DOCUMENT:{canEdit:false,canView:true},DESIGN:{canEdit:false,canView:false},DEVELOP:{canEdit:false,canView:false},PROTOTYPE:{canEdit:false,canView:false},SETTINGS:{canEdit:false,canView:false},MCP:{canEdit:false,canView:false}}},ANONYMOUS:{id:"ANONYMOUS",title:"Anonymous",description:"",hierarchy:0,permissions:{canManageUsers:false,canDelete:false,canEdit:false,canPublish:false,canView:true},sectionAccess:{ROOT:{canEdit:false,canView:true},DOCUMENT:{canEdit:false,canView:true},DESIGN:{canEdit:false,canView:false},DEVELOP:{canEdit:false,canView:false},PROTOTYPE:{canEdit:false,canView:false},SETTINGS:{canEdit:false,canView:false},MCP:{canEdit:false,canView:false}}},EDITOR:{id:"EDITOR",title:"Editor",description:"",hierarchy:0,permissions:{canManageUsers:false,canDelete:false,canEdit:false,canPublish:false,canView:false},sectionAccess:{ROOT:{canEdit:false,canView:false},DOCUMENT:{canEdit:false,canView:false},DESIGN:{canEdit:false,canView:false},DEVELOP:{canEdit:false,canView:false},PROTOTYPE:{canEdit:false,canView:false},SETTINGS:{canEdit:false,canView:false},MCP:{canEdit:false,canView:false}}},MANAGER:{id:"MANAGER",title:"Manager",description:"",hierarchy:0,permissions:{canManageUsers:false,canDelete:false,canEdit:false,canPublish:false,canView:false},sectionAccess:{ROOT:{canEdit:false,canView:false},DOCUMENT:{canEdit:false,canView:false},DESIGN:{canEdit:false,canView:false},DEVELOP:{canEdit:false,canView:false},PROTOTYPE:{canEdit:false,canView:false},SETTINGS:{canEdit:false,canView:false},MCP:{canEdit:false,canView:false}}}},oa=Object.values(cn);function ia({path:e,queryParams:r,origin:a}){return urls.createUrlWithParams({url:e,queryParams:r,origin:a})}n(ia,"createUrlForRoute");function un(e){return Object.fromEntries(e.entries())}n(un,"getParams");function sa(e){return un(e)}n(sa,"getParamsForRoute");Object.defineProperty(exports,"isObjKey",{enumerable:true,get:function(){return utils.isObjKey}});Object.defineProperty(exports,"isObject",{enumerable:true,get:function(){return utils.isObject}});exports.ALL_INFER_SPEC_FILTER_KEYS=he;exports.BlockSizes=Hn;exports.BlockSpacings=Yn;exports.CodeSrcUserConfigSchema=Wr;exports.ColorConfigStruct=l;exports.ColorStringStruct=M;exports.ColorTokenConfigStruct=yn;exports.DEFAULT_INFER_SPEC_FILTERS=vo;exports.FontFaceConfigStruct=w;exports.FontFaceFormatsEnumStruct=Le;exports.FontFaceSourceFormats=We;exports.FontFaceSourceStruct=_e;exports.FontFaceWeightStruct=ye;exports.FontSizeConfigStruct=He;exports.FontSizeConfigValStruct=me;exports.FontStretches=$e;exports.GitProviderType=an;exports.HeadingLevels=Cn;exports.KsAppClientDataAndMetaStruct=Go;exports.KsAppClientDataAndMetaStructV3=cr;exports.KsAppClientDataNoMetaStruct=Lo;exports.KsAppClientDataNoMetaStructV3=lr;exports.KsAppClientDataNoMetaZod=_o;exports.KsMetaStateStruct=zt;exports.KsMetaStateStructV3=Gt;exports.KsRemoteChangesStruct=en;exports.KsRendererClientEvents=rn;exports.MergeableState=sn;exports.NavCustomizationConfigStruct=V;exports.PageHeaderSizes=De;exports.PrimaryNavCustomizationConfigStruct=W;exports.PropTypeNames=Yt;exports.RestActions=pn;exports.SecondaryNavCustomizationConfigStruct=L;exports.TextEncoding=ln;exports.TextTransforms=Ge;exports.TokenReferenceStruct=d;exports.TokenValueColorStruct=A;exports.TokenValueCubicBezierStruct=G;exports.TokenValueDimensionStruct=h;exports.TokenValueDurationStruct=E;exports.TokenValueFontWeightStruct=pe;exports.TokenValueStrokeStyleStruct=K;exports.TypographyConfigStruct=p;exports.TypographyLinkConfigStruct=O;exports.UiConfigStruct=Ln;exports.UiConfigV10Struct=Xe;exports.UiConfigV1Struct=Bn;exports.UiConfigV2Struct=An;exports.UiConfigV3Struct=Kn;exports.UiConfigV4Struct=Fn;exports.UiConfigV5Struct=Mn;exports.UiConfigV6Struct=Un;exports.UiConfigV7Struct=jn;exports.UiConfigV8Struct=zn;exports.UiConfigV9Struct=Wn;exports.WS_EVENTS=ea;exports.addIdToTemplateInfo=_r;exports.appSections=br;exports.appSectionsById=Ht;exports.assertTokenData=io;exports.convertTemplateInfoToOldWay=$r;exports.createTemplateInfoId=tn;exports.createUrlForRoute=ia;exports.customizableNavElements=Vn;exports.decodeInferSpecFilters=wo;exports.emptyAppClientData=Wo;exports.encodeInferSpecFilters=No;exports.getParams=un;exports.getParamsForRoute=sa;exports.getPrimitiveValue=xo;exports.hasTokenReferences=x;exports.isArrayOfNumbersProp=Nr;exports.isArrayOfObjectsProp=Vr;exports.isArrayOfStringsProp=vr;exports.isBooleanProp=Dr;exports.isCustomTypeScriptProp=Rr;exports.isDataDemo=Vo;exports.isDemoWithData=Ro;exports.isDimensionString=ho;exports.isFunctionProp=Pr;exports.isKsAppClientDataAndMeta=jt;exports.isKsAppClientDataAndMetaV3=_t;exports.isKsAppClientDataNoMeta=Mt;exports.isKsAppClientDataNoMetaV3=Lt;exports.isKsMetaState=$o;exports.isKsMetaStateV3=dr;exports.isKsRemoteChange=Kr;exports.isKsRemoteChanges=Fr;exports.isNotTokenReference=Qe;exports.isNumberProp=hr;exports.isObjectProp=Er;exports.isOptionsProp=Ir;exports.isPatch=Br;exports.isPatches=Ar;exports.isRendererIdForNativeMobile=on;exports.isSpecNotInferred=Oo;exports.isStringProp=xr;exports.isTemplateDemo=Eo;exports.isTemplateInfoForNativeMobile=qr;exports.isTemplateInfoWithCodeSrcPath=Lr;exports.isTokenDataComposite=oo;exports.isTokenGroup=At;exports.isTokenReference=Ze;exports.isTokenSrc=To;exports.isTokenSrcExtensions=Bt;exports.isTokenSrcValueInfoComposite=fo;exports.isTokenSrcValueInfoSingular=uo;exports.isTokenTypeComposite=q;exports.isTokenTypeSingular=Se;exports.isTokenTypeVarRef=ko;exports.isTokenValueBorder=St;exports.isTokenValueColor=at;exports.isTokenValueDimension=J;exports.isTokenValueDuration=ro;exports.isTokenValueFontWeight=ao;exports.isTokenValueShadow=yt;exports.isTokenValueTransition=xt;exports.ksRendererClientMetaId=Zr;exports.metaForAndroidRenderer=Yr;exports.metaForIosRenderer=Hr;exports.migrations=kr;exports.normalizeTemplateInfo=Gr;exports.pageElements=xn;exports.pageElementsV2=hn;exports.parseTokenDimensionValue=Do;exports.patternTabTypes=Ko;exports.rendererIds=oe;exports.rendererIdsForNativeMobile=nn;exports.roles=oa;exports.rolesById=cn;exports.selectPublishingChangesToApply=Mr;exports.strokeStyleValues=Zn;exports.tokenNameDisplayFormats=Jn;exports.tokenTypeComposites=tt;exports.tokenTypeSingulars=ot;//# sourceMappingURL=index.js.map
1
+ 'use strict';var t=require('superstruct'),Oe=require('color-string'),v4Mini=require('zod/v4-mini'),utils=require('@knapsack/utils'),immer=require('immer'),zod=require('zod'),urls=require('@knapsack/utils/urls');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var t__namespace=/*#__PURE__*/_interopNamespace(t);var Oe__default=/*#__PURE__*/_interopDefault(Oe);var we=Object.defineProperty;var n=(e,r)=>we(e,"name",{value:r,configurable:true});function Ke(e){if(typeof e!="string")return false;try{return !!Oe__default.default.get(e)}catch{return false}}n(Ke,"isColor");var M=t.define("ColorStringStruct",e=>typeof e=="string"&&Ke(e)),l=t.union([t.type({type:t.literal("value"),colorValue:M}),t.type({type:t.literal("design-token"),tokenName:t.string()})]),mn=t.type({type:t.literal("design-token"),tokenName:t.string()});var bn=["h1","h2","h3","h4","h5","h6"],me=t.object({unit:t.enums(["rem","px"]),value:t.number()}),ye=t.union([t.string(),t.number()]),ze=(a=>(a.woff2="woff2",a.woff="woff",a))(ze||{}),We=t.enums(["woff2","woff"]),Le=t.type({format:We,type:t.literal("url"),path:t.string()}),w=t.type({family:t.optional(t.string()),weight:t.optional(t.union([ye,t.size(t.array(ye),2)])),src:t.optional(t.array(Le)),style:t.optional(t.string()),display:t.optional(t.enums(["auto","block","swap","fallback","optional"])),variationSettings:t.optional(t.string()),unicodeRange:t.optional(t.string())}),_e=(g=>(g.inherit="As typed",g.capitalize="Capitalize",g.lowercase="Lowercase",g.uppercase="Uppercase",g))(_e||{}),Ge=(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))(Ge||{}),O=t.type({fontWeight:t.optional(t.union([t.string(),t.number()])),textColor:t.optional(l),hoverColor:t.optional(l),underline:t.optional(t.boolean()),textTransform:t.optional(t.enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:t.optional(t.enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))}),$e=t.type({min:me,max:t.optional(me)}),p=t.type({fontSize:t.optional($e),lineHeight:t.optional(t.union([t.string(),t.number()])),fontWeight:t.optional(t.union([t.string(),t.number()])),letterSpacing:t.optional(t.string()),fontFamily:t.optional(t.string()),textColor:t.optional(l),textTransform:t.optional(t.enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:t.optional(t.enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))}),m={},Te={},Cn={pageTitle:m,pageDescription:m,headingLarge:m,headingMedium:m,headingSmall:m,bodyText:m,link:Te},xn={pageTitle:m,pageDescription:m,headingXLarge:m,headingLarge:m,headingMedium:m,headingSmall:m,headingXSmall:m,bodyText:m,link:Te};var R=t.union([p,t.type({accentColor:t.optional(l)})]),W=t.union([R,t.type({hoverColor:t.optional(l),backgroundColor:t.optional(l)})]),L=t.union([R,t.type({backgroundColor:t.optional(l)})]),He={},Ye={},qe={},Vn={primaryNav:qe,secondaryNav:Ye,tabs:He};var On=t.object({version:t.literal(1),oldSillySidebarBgColor:M}),Bn=t.object({version:t.literal(2),anotherSillySidebarBgColor:M}),An=t.object({version:t.literal(3),sidebarBgColor:M}),Kn=t.object({version:t.literal(4),primaryColor:l,darkColor:l,lightColor:l,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),true))}),Fn=t.object({version:t.literal(5),primaryColor:l,darkColor:l,lightColor:l,linkColor:l,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),true))}),Mn=t.object({version:t.literal(6),primaryColor:l,darkColor:l,lightColor:l,linkColor:l,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),true)),appearance:t.type({customFonts:t.optional(t.array(w)),pageElements:t.type({pageTitle:t.optional(p),pageDescription:t.optional(p),headingLarge:t.optional(p),headingMedium:t.optional(p),headingSmall:t.optional(p),bodyText:t.optional(p),link:t.optional(O)})})}),Un=t.object({version:t.literal(7),primaryColor:l,darkColor:l,lightColor:l,linkColor:l,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),true)),appearance:t.type({customFonts:t.optional(t.array(w)),navigation:t.optional(t.type({primaryNav:t.optional(W),secondaryNav:t.optional(L),tabs:t.optional(R)})),pageElements:t.type({pageTitle:t.optional(p),pageDescription:t.optional(p),headingLarge:t.optional(p),headingMedium:t.optional(p),headingSmall:t.optional(p),bodyText:t.optional(p),link:t.optional(O)})})}),jn=t.object({version:t.literal(8),primaryColor:l,darkColor:l,lightColor:l,linkColor:l,appearance:t.type({customFonts:t.optional(t.array(w)),navigation:t.optional(t.type({primaryNav:t.optional(W),secondaryNav:t.optional(L),tabs:t.optional(R)})),pageElements:t.type({pageTitle:t.optional(p),pageDescription:t.optional(p),headingLarge:t.optional(p),headingMedium:t.optional(p),headingSmall:t.optional(p),bodyText:t.optional(p),link:t.optional(O)})})}),zn=t.object({version:t.literal(9),appearance:t.type({customFonts:t.optional(t.array(w)),navigation:t.optional(t.type({primaryNav:t.optional(W),secondaryNav:t.optional(L),tabs:t.optional(R)})),pageElements:t.type({pageTitle:t.optional(p),pageDescription:t.optional(p),headingLarge:t.optional(p),headingMedium:t.optional(p),headingSmall:t.optional(p),bodyText:t.optional(p),link:t.optional(O)})})}),Je=t.object({version:t.literal(10),appearance:t.type({customFonts:t.optional(t.array(w)),navigation:t.optional(t.type({primaryNav:t.optional(W),secondaryNav:t.optional(L),tabs:t.optional(R)})),pageElements:t.type({pageTitle:t.optional(p),pageDescription:t.optional(p),headingXLarge:t.optional(p),headingLarge:t.optional(p),headingMedium:t.optional(p),headingSmall:t.optional(p),headingXSmall:t.optional(p),bodyText:t.optional(p),link:t.optional(O)})})}),Wn=Je;var $n=["large","medium","small"],Hn=["large","medium","small"];var qn={default:"Default",android:"Android",cssVar:"CSS Var",json:"JSON",less:"Less",scss:"SCSS",swift:"Swift"};var Xn=["solid","dashed","dotted","double","groove","ridge","outset","inset"];function Xe(e){return typeof e!="string"?false:e.split("{").length-1===1&&e.startsWith("{")&&e.endsWith("}")}n(Xe,"isTokenReference");function x(e){return typeof e=="string"&&e.includes("{")}n(x,"hasTokenReferences");function Ze(e){return !Xe(e)}n(Ze,"isNotTokenReference");var c=t__namespace.define("Token Reference",e=>typeof e!="string"?false:Ze(e)?"Must start and end with curly braces":true),Qe={border:"border",shadow:"shadow",transition:"transition"},et=Object.values(Qe),tt={string:"string",number:"number",boolean:"boolean",color:"color",dimension:"dimension",duration:"duration",fontWeight:"fontWeight",strokeStyle:"strokeStyle",cubicBezier:"cubicBezier"},nt=Object.values(tt);function q(e){return et.includes(e)}n(q,"isTokenTypeComposite");function Se(e){return nt.includes(e)}n(Se,"isTokenTypeSingular");utils.expectType([{inset:false,color:"#000",offsetX:"0px",offsetY:"0px",spread:"0px",blur:"0px"},{color:"#000",offsetX:"0px",offsetY:"0px",spread:"0px",blur:"0px",inset:true}]);var d=t__namespace.type({id:t__namespace.string(),description:t__namespace.optional(t__namespace.string()),references:t__namespace.optional(t__namespace.array(t__namespace.array(t__namespace.string()))),tokenConfig:t__namespace.optional(t__namespace.type({purpose:t__namespace.optional(t__namespace.string())}))});utils.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 no(e){return q(e.type)}n(no,"isTokenDataComposite");utils.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:false},originalValue:{color:"#000",offsetX:"{a.a}",offsetY:"1px",blur:"1px",spread:"1px",inset:false},id:"1",kind:"static"},{type:"shadow",kind:"ref",referencedTokenId:"a.b",value:{inset:true,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 rt(e){return typeof e=="string"&&!x(e)}n(rt,"isTokenValueColor");var A=t__namespace.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)":true),at=t__namespace.assign(t__namespace.type({type:t__namespace.literal("color"),value:A,kind:t__namespace.literal("static"),originalValue:A}),d),it=t__namespace.assign(t__namespace.type({type:t__namespace.literal("color"),value:A,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d);function J(e){return typeof e=="string"&&(e.endsWith("px")||e.endsWith("rem"))&&!x(e)}n(J,"isTokenValueDimension");var h=t__namespace.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 %":true),st=t__namespace.assign(t__namespace.type({type:t__namespace.literal("dimension"),value:h,kind:t__namespace.literal("static"),originalValue:h}),d),pt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("dimension"),value:h,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d);function oo(e){return typeof e=="string"&&e.endsWith("ms")&&!x(e)}n(oo,"isTokenValueDuration");var E=t__namespace.define("Duration Value",e=>typeof e!="string"?"Value must be a string":x(e)?"Value must not contain {} (token references)":/^\d+ms$/.test(e)?true:'Value must be a number followed by "ms" (e.g., "100ms")'),lt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("duration"),value:E,kind:t__namespace.literal("static"),originalValue:E}),d),ct=t__namespace.assign(t__namespace.type({type:t__namespace.literal("duration"),value:E,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d);function ro(e){return (typeof e=="string"||typeof e=="number")&&!x(e)}n(ro,"isTokenValueFontWeight");var pe=t__namespace.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)":true),dt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("fontWeight"),value:pe,kind:t__namespace.literal("static"),originalValue:pe}),d),ut=t__namespace.assign(t__namespace.type({type:t__namespace.literal("fontWeight"),value:pe,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d),G=t__namespace.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":true:"Value must be an array"),ft=t__namespace.assign(t__namespace.type({type:t__namespace.literal("cubicBezier"),value:G,kind:t__namespace.literal("static"),originalValue:G}),d),gt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("cubicBezier"),value:G,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d);function mt(e){return utils.isObject(e)&&rt(e.color)&&J(e.offsetX)&&J(e.offsetY)&&J(e.blur)&&J(e.spread)}n(mt,"isTokenValueShadow");var be=t__namespace.define("Shadow Value",e=>mt(e)?true:`Expected a shadow value, got ${JSON.stringify(e)}`),yt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("shadow"),value:be,kind:t__namespace.literal("static"),originalValue:t__namespace.type({color:t__namespace.union([A,c]),offsetX:t__namespace.union([h,c]),offsetY:t__namespace.union([h,c]),blur:t__namespace.union([h,c]),spread:t__namespace.union([h,c]),inset:t__namespace.union([t__namespace.optional(t__namespace.boolean()),c])})}),d),Tt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("shadow"),value:be,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d),K=t__namespace.union([t__namespace.literal("solid"),t__namespace.literal("dashed"),t__namespace.literal("dotted"),t__namespace.literal("double"),t__namespace.literal("groove"),t__namespace.literal("ridge"),t__namespace.literal("outset"),t__namespace.literal("inset")]);function kt(e){return utils.isObject(e)&&A.is(e.color)&&K.is(e.style)&&h.is(e.width)}n(kt,"isTokenValueBorder");var Ce=t__namespace.define("Border Value",kt),St=t__namespace.assign(t__namespace.type({type:t__namespace.literal("border"),value:Ce,kind:t__namespace.literal("static"),originalValue:t__namespace.type({color:t__namespace.union([A,c]),style:t__namespace.union([K,c]),width:t__namespace.union([h,c])})}),d),bt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("border"),value:Ce,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d);function Ct(e){return utils.isObject(e)&&G.is(e.timingFunction)&&E.is(e.duration)&&E.is(e.delay)}n(Ct,"isTokenValueTransition");var xe=t__namespace.define("Transition Value",Ct),xt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("transition"),value:xe,kind:t__namespace.literal("static"),originalValue:t__namespace.type({timingFunction:t__namespace.union([G,c]),duration:t__namespace.union([E,c]),delay:t__namespace.union([E,c])})}),d),ht=t__namespace.assign(t__namespace.type({type:t__namespace.literal("transition"),value:xe,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d),Dt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("string"),value:t__namespace.string(),kind:t__namespace.literal("static"),originalValue:t__namespace.string()}),d),It=t__namespace.assign(t__namespace.type({type:t__namespace.literal("string"),value:t__namespace.string(),kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d),Pt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("strokeStyle"),value:K,kind:t__namespace.literal("static"),originalValue:K}),d),Vt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("strokeStyle"),value:K,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:K}),d),Rt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("number"),value:t__namespace.number(),kind:t__namespace.literal("static"),originalValue:t__namespace.number()}),d),Et=t__namespace.assign(t__namespace.type({type:t__namespace.literal("number"),value:t__namespace.number(),kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d),vt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("boolean"),value:t__namespace.boolean(),kind:t__namespace.literal("static"),originalValue:t__namespace.boolean()}),d),Nt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("boolean"),value:t__namespace.boolean(),kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d),ao=n(e=>{if(!utils.isObject(e))throw new Error(`Expected token data to be an object, got ${JSON.stringify(e)}`);if(!utils.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,a=e.kind;try{switch(r){case "boolean":a==="ref"?Nt.assert(e):vt.assert(e);return;case "border":a==="ref"?bt.assert(e):St.assert(e);return;case "color":a==="ref"?it.assert(e):at.assert(e);return;case "cubicBezier":a==="ref"?gt.assert(e):ft.assert(e);return;case "dimension":a==="ref"?pt.assert(e):st.assert(e);return;case "duration":a==="ref"?ct.assert(e):lt.assert(e);return;case "fontWeight":a==="ref"?ut.assert(e):dt.assert(e);return;case "number":a==="ref"?Et.assert(e):Rt.assert(e);return;case "shadow":a==="ref"?Tt.assert(e):yt.assert(e);return;case "string":a==="ref"?It.assert(e):Dt.assert(e);return;case "strokeStyle":a==="ref"?Vt.assert(e):Pt.assert(e);return;case "transition":a==="ref"?ht.assert(e):xt.assert(e);return;default:{throw new Error(`Unknown token data type: ${r}`)}}}catch(u){throw u instanceof t__namespace.StructError?new Error(`Invalid token data for type "${r}": ${u.message}. Received this data: "${JSON.stringify(e)}"`):u}},"assertTokenData");utils.expectType([{type:"dimension",kind:"static",value:"1px"},{type:"dimension",kind:"ref",referencedTokenId:"a.b"}]);utils.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"}}}]);utils.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 co(e){return Se(e?.type)}n(co,"isTokenSrcValueInfoSingular");function uo(e){return q(e?.type)}n(uo,"isTokenSrcValueInfoComposite");utils.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 Ot(e){return utils.isObject(e)&&utils.isObjKey("cloud.knapsack",e)}n(Ot,"isTokenSrcExtensions");utils.expectType(["#ddd",true,[83,1,1,1],{color:"#000",style:"solid",width:"1px"},{inset:true,color:"#000",offsetX:"0px",offsetY:"{spacing.medium}",spread:"0px",blur:"0px"},{timingFunction:"{timing.ease}",duration:"{timing.duration.medium}",delay:"7ms",color:"#000"}]);function yo(e){return !!(utils.isObject(e)&&utils.isObjKey("$value",e))}n(yo,"isTokenSrc");function Bt(e){return utils.isObject(e)&&!Ot(e)&&!utils.isObjKey("$value",e)&&!utils.isObjKey("cloud.knapsack",e)}n(Bt,"isTokenGroup");function To(e){if(Bt(e)){let r=e.$extensions["cloud.knapsack"].group.collectionInfo;if(utils.isObjKey("type",r)&&utils.isObjKey("referenceId",r))return true}return false}n(To,"isTokenTypeVarRef");function Co(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(Co,"getPrimitiveValue");var xo=n(e=>e.includes("px")||e.includes("rem")||e.includes("em")||e.includes("%"),"isDimensionString");function ho(e){let{value:r,unit:a}=utils.parseNumberWithUnit(e);if(!a)return {value:r};if(a!=="px"&&a!=="rem"&&a!=="em"&&a!=="%")throw new Error(`Invalid unit "${a}" for value: ${r}`);return {value:r,unit:a}}n(ho,"parseTokenDimensionValue");function Po(e){return e?.type==="data"||e?.type==="data-w-template-info"}n(Po,"isDemoWithData");function Vo(e){return e?.type==="data"}n(Vo,"isDataDemo");function Ro(e){return e?.type==="template"}n(Ro,"isTemplateDemo");var he=["removeHtmlAttributes","removeClassName","removeStyle","removeAria","removeEventHandlers"],Eo={removeHtmlAttributes:false,removeClassName:false,removeStyle:false,removeAria:false,removeEventHandlers:false};function vo(e){if(e)return he.filter(r=>e[r]===true).join(",")}n(vo,"encodeInferSpecFilters");function No(e){let r=new Set(e.split(",").map(a=>a.trim()).filter(Boolean));return Object.fromEntries(he.map(a=>[a,r.has(a)]))}n(No,"decodeInferSpecFilters");function wo(e){return typeof e=="object"&&!e.isInferred}n(wo,"isSpecNotInferred");var Ao={designSrc:"Design Source",subPage:"Subpage",template:"Template"};var De=(T=>(T.auto="auto",T.small="small",T.medium="medium",T.large="large",T.full="full",T))(De||{});var zo={patternsState:{patterns:{},renderers:{},statusSets:[]},customPagesState:{pages:{}},assetSetsState:{},navsState:{byId:{},order:[]},tokensSrc:{},filesState:{files:{}},db:{blocks:{byId:{},settings:{tokens:{rootFontSize:"16px"}}},demos:{byId:{},settings:{}},tabs:{byId:{},settings:{}},blockCollections:{byId:{},settings:{}},settings:{title:"",logoUrl:""}}};function Ft(e){return !utils.isObject(e)||!["assetSetsState","customPagesState","navsState","patternsState","tokensSrc","db"].every(a=>utils.isObjKey(a,e))?false:!utils.isObjKey("metaState",e)}n(Ft,"isKsAppClientDataNoMeta");var Wo=t.define("KsAppClientDataNoMeta",Ft),Mt=v4Mini.z.strictObject({assetSetsState:v4Mini.z.object({}),customPagesState:v4Mini.z.object({pages:v4Mini.z.object({})}),navsState:v4Mini.z.object({byId:v4Mini.z.object(),order:v4Mini.z.array(v4Mini.z.string())}),patternsState:v4Mini.z.object({patterns:v4Mini.z.object({}),renderers:v4Mini.z.object({}),statusSets:v4Mini.z.array(v4Mini.z.object())}),tokensSrc:v4Mini.z.object({}),filesState:v4Mini.z.object({files:v4Mini.z.object({})}),db:v4Mini.z.object({blocks:v4Mini.z.object({byId:v4Mini.z.object({}),settings:v4Mini.z.object({})}),demos:v4Mini.z.object({byId:v4Mini.z.object({}),settings:v4Mini.z.object({})}),tabs:v4Mini.z.optional(v4Mini.z.object({byId:v4Mini.z.object({}),settings:v4Mini.z.object({})})),blockCollections:v4Mini.z.optional(v4Mini.z.object({byId:v4Mini.z.object({}),settings:v4Mini.z.object({})})),templatesConfig:v4Mini.z.optional(v4Mini.z.object({})),settings:v4Mini.z.object({title:v4Mini.z.optional(v4Mini.z.string()),hideTitleInNavigation:v4Mini.z.optional(v4Mini.z.boolean()),logoUrl:v4Mini.z.optional(v4Mini.z.string())})})}),Lo=v4Mini.z.custom().check(e=>{let{error:r}=Mt.safeParse(e.value);r&&e.issues.push(...r.issues);});function Ut(e){return utils.isObject(e)?["assetSetsState","customPagesState","navsState","patternsState","tokensSrc","metaState","db"].every(a=>utils.isObjKey(a,e)):false}n(Ut,"isKsAppClientDataAndMeta");var _o=t.define("KsAppClientDataAndMeta",Ut),jt=t.type({isLocalDev:t.boolean(),plugins:t.array(t.type({id:t.string(),hasContent:t.boolean(),clientPluginPath:t.optional(t.string()),cssPath:t.optional(t.string())})),meta:t.optional(t.type({version:t.optional(t.string()),hasKnapsackCloud:t.boolean(),knapsackCloudSiteId:t.optional(t.string()),serverPort:t.optional(t.number()),websocketsPort:t.optional(t.number()),https:t.optional(t.boolean()),cacheDir:t.optional(t.string()),ksVersions:t.type({app:t.string()})}))}),Go=jt.is;function Wt(e){return !utils.isObject(e)||!["assetSetsState","customPagesState","navsState","patternsState","settingsState","tokensState"].every(a=>utils.isObjKey(a,e))?false:!utils.isObjKey("metaState",e)}n(Wt,"isKsAppClientDataNoMetaV3");var pr=t.define("KsAppClientDataNoMeta",Wt);function Lt(e){return utils.isObject(e)?["assetSetsState","customPagesState","navsState","patternsState","settingsState","tokensState","metaState"].every(a=>utils.isObjKey(a,e)):false}n(Lt,"isKsAppClientDataAndMetaV3");var lr=t.define("KsAppClientDataAndMeta",Lt),_t=t.type({isLocalDev:t.boolean(),plugins:t.array(t.type({id:t.string(),hasContent:t.boolean(),clientPluginPath:t.optional(t.string()),cssPath:t.optional(t.string())})),meta:t.optional(t.type({version:t.optional(t.string()),hasKnapsackCloud:t.boolean(),knapsackCloudSiteId:t.optional(t.string()),serverPort:t.optional(t.number()),websocketsPort:t.optional(t.number()),https:t.optional(t.boolean()),cacheDir:t.optional(t.string()),ksVersions:t.type({app:t.string()})}))}),cr=_t.is;var Ee={version:"4.1.7",checkIfNeeded:n(e=>true,"checkIfNeeded"),migrate:n(e=>{if(!immer.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(([a,u])=>{r.data.slots[a]=u.map(g=>typeof g=="string"?{type:"text",text:g}:(g.type==="template-reference"||g.type==="text"||(g.type="template-demo"),g));}),!(r.patternId&&r.templateId)&&(()=>{for(let{id:a,templates:u=[]}of Object.values(e.patternsState.patterns))for(let{id:g,demoIds:T=[]}of u)if(T.includes(r.id)){r.patternId=a,r.templateId=g;return}})());});},"migrate")};var Tr=[Ee];var $t={ROOT:"ROOT",DESIGN:"Design",DEVELOP:"Develop",DOCUMENT:"Documentation",MCP:"MCP",PROTOTYPE:"Prototype",SETTINGS:"Settings"},Sr=Object.values($t);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||{}),Cr=n(e=>"type"in e&&e.type==="string"&&!("enum"in e),"isStringProp"),xr=n(e=>"type"in e&&e.type==="number","isNumberProp"),hr=n(e=>"type"in e&&e.type==="boolean","isBooleanProp"),Dr=n(e=>"enum"in e,"isOptionsProp"),Ir=n(e=>"typeof"in e&&e?.typeof==="function","isFunctionProp"),Pr=n(e=>!("typeof"in e)&&"tsType"in e,"isCustomTypeScriptProp"),Vr=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="object","isArrayOfObjectsProp"),Rr=n(e=>"type"in e&&e.type==="object"&&"properties"in e&&Object.keys(e.properties).length>0,"isObjectProp"),Er=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="string","isArrayOfStringsProp"),vr=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="number","isArrayOfNumbersProp");var ve=t__namespace.object({op:t__namespace.union([t__namespace.literal("replace"),t__namespace.literal("remove"),t__namespace.literal("add")]),path:t__namespace.array(t__namespace.union([t__namespace.string(),t__namespace.number()])),value:t__namespace.optional(t__namespace.any())}),Yt=ve,Or=n(e=>Yt.is(e),"isPatch"),de=t__namespace.array(ve),qt=de,Br=n(e=>qt.is(e),"isPatches"),Jt=t__namespace.union([t__namespace.object({kind:t__namespace.literal("page"),id:t__namespace.string()}),t__namespace.object({kind:t__namespace.literal("pattern"),id:t__namespace.string()})]),Ne=t__namespace.type({patches:de,inversePatches:t__namespace.optional(de),event:t__namespace.optional(t__namespace.object({type:t__namespace.string()})),entityRefs:t__namespace.optional(t__namespace.array(Jt)),id:t__namespace.string(),date:t__namespace.string(),userId:t__namespace.optional(t__namespace.string())}),Xt=Ne,Ar=n(e=>Xt.is(e),"isKsRemoteChange"),Zt=t__namespace.array(Ne),Qt=Zt,Kr=n(e=>Qt.is(e),"isKsRemoteChanges");var oe={react:"react",vue:"vue","web-components":"web-components",twig:"twig",hbs:"hbs",angular:"angular",html:"html",ios:"ios",android:"android"},jr=zod.z.strictObject({path:zod.z.string().describe("Can contain glob patterns, relative paths, absolute paths, package paths, or package sub-paths"),filter:zod.z.custom(e=>typeof e=="function").optional().describe("A function that takes a path and returns a boolean")});function zr(e){return "codeSrcPath"in e}n(zr,"isTemplateInfoWithCodeSrcPath");function en(e){switch(e.rendererId){case "angular":case "react":return `${e.rendererId}---${e.codeSrcPath}---${e.exportName||"default"}`;case "web-components":return `${e.rendererId}---${e.elementName}`;case "twig":return `${e.rendererId}---${e.namespacePath}`;case "vue":case "hbs":case "html":return `${e.rendererId}---${e.codeSrcPath}`;case "ios":return `${e.rendererId}---${e.moduleName}---${e.symbolName}`;case "android":return `${e.rendererId}---${e.packageName}---${e.componentName}`;default:{throw new Error(`Invalid template info: ${JSON.stringify(e)}`)}}}n(en,"createTemplateInfoId");function Wr(e){return {...e,id:en(e)}}n(Wr,"addIdToTemplateInfo");function Lr({rendererId:e,alias:r,path:a}){return (()=>{switch(e){case "react":case "angular":return {rendererId:e,codeSrcPath:a,exportName:r||"default"};case "vue":case "hbs":case "html":return {rendererId:e,codeSrcPath:a};case "twig":return {rendererId:e,namespacePath:r};case "web-components":return {rendererId:e,elementName:r};case "ios":return {rendererId:e,moduleName:a,symbolName:r};case "android":return {rendererId:e,packageName:a,componentName:r};default:{throw new Error(`Invalid renderer ID: ${e}`)}}})()}n(Lr,"normalizeTemplateInfo");function _r(e){switch(e.rendererId){case "react":case "angular":return {path:e.codeSrcPath,alias:e.exportName};case "hbs":case "html":case "vue":return {path:e.codeSrcPath};case "twig":return {alias:e.namespacePath};case "web-components":return {alias:e.elementName};case "ios":return {path:e.moduleName,alias:e.symbolName};case "android":return {path:e.packageName,alias:e.componentName};default:{throw new Error(`Invalid template info: ${JSON.stringify(e)}`)}}}n(_r,"convertTemplateInfoToOldWay");var Gr={id:oe.ios,title:"iOS",aliasUse:"required",aliasTitle:"Symbol Name",aliasDescription:"The synchronized name of the iOS symbol.",enableDataDemos:true,enableTemplateDemos:false,hasTemplateImgSupport:true,hasSlotsSupport:false,hasSlotOptionsSupport:false,hasInferSpecSupport:true,hasTemplateSuggestionsSupport:true},$r={id:oe.android,title:"Android",aliasUse:"required",aliasTitle:"Component Name",aliasDescription:"The synchronized name of the Android component.",enableDataDemos:true,enableTemplateDemos:false,hasSlotsSupport:false,hasSlotOptionsSupport:false,hasTemplateImgSupport:true,hasInferSpecSupport:true,hasTemplateSuggestionsSupport:true},tn=[oe.ios,oe.android];function nn(e){return tn.includes(e)}n(nn,"isRendererIdForNativeMobile");function Hr(e){return nn(e.rendererId)}n(Hr,"isTemplateInfoForNativeMobile");var on=(r=>(r.ready="ready",r))(on||{}),Jr="ks-meta";var Zr={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 rn=(T=>(T.GitHub="GitHub",T.GitLab="GitLab",T.GitLabRest="GitLabRest",T.Bitbucket="Bitbucket",T.Azure="Azure",T))(rn||{}),an=(u=>(u.Conflicting="CONFLICTING",u.Mergeable="MERGEABLE",u.Unknown="UNKNOWN",u))(an||{}),sn=(g=>(g.Create="CREATE",g.Move="MOVE",g.Update="UPDATE",g.Chmod="CHMOD",g))(sn||{}),pn=(a=>(a.Base64="BASE64",a.Text="TEXT",a))(pn||{});var ln={ADMIN:{id:"ADMIN",title:"Admin",description:"Full access. Can manage users, publish changes, and configure all settings.",hierarchy:4,permissions:{canManageUsers:true,canDelete:true,canEdit:true,canPublish:true,canView:true},sectionAccess:{ROOT:{canEdit:false,canView:true},DOCUMENT:{canEdit:true,canView:true},DESIGN:{canEdit:true,canView:true},DEVELOP:{canEdit:true,canView:true},PROTOTYPE:{canEdit:true,canView:true},SETTINGS:{canEdit:true,canView:true},MCP:{canEdit:true,canView:true}}},CONTRIBUTOR:{id:"CONTRIBUTOR",title:"Contributor",description:"Can view and edit content across Design, Develop, and Prototype. Cannot publish or manage users.",hierarchy:3,permissions:{canManageUsers:false,canDelete:false,canEdit:true,canPublish:false,canView:true},sectionAccess:{ROOT:{canEdit:false,canView:true},DOCUMENT:{canEdit:true,canView:true},DESIGN:{canEdit:true,canView:true},DEVELOP:{canEdit:true,canView:true},PROTOTYPE:{canEdit:true,canView:true},SETTINGS:{canEdit:true,canView:true},MCP:{canEdit:false,canView:false}}},CONSUMER:{id:"CONSUMER",title:"Consumer",description:"Can view documentation and edit prototypes. Cannot access Design or Develop sections.",hierarchy:2,permissions:{canManageUsers:false,canDelete:false,canEdit:true,canPublish:false,canView:true},sectionAccess:{ROOT:{canEdit:false,canView:true},DOCUMENT:{canEdit:false,canView:true},DESIGN:{canEdit:false,canView:false},DEVELOP:{canEdit:false,canView:false},PROTOTYPE:{canEdit:true,canView:true},SETTINGS:{canEdit:false,canView:false},MCP:{canEdit:false,canView:false}}},VIEWER:{id:"VIEWER",title:"Viewer",description:"Read-only access to documentation. Cannot edit anything.",hierarchy:1,permissions:{canManageUsers:false,canDelete:false,canEdit:false,canPublish:false,canView:true},sectionAccess:{ROOT:{canEdit:false,canView:true},DOCUMENT:{canEdit:false,canView:true},DESIGN:{canEdit:false,canView:false},DEVELOP:{canEdit:false,canView:false},PROTOTYPE:{canEdit:false,canView:false},SETTINGS:{canEdit:false,canView:false},MCP:{canEdit:false,canView:false}}},ANONYMOUS:{id:"ANONYMOUS",title:"Anonymous",description:"",hierarchy:0,permissions:{canManageUsers:false,canDelete:false,canEdit:false,canPublish:false,canView:true},sectionAccess:{ROOT:{canEdit:false,canView:true},DOCUMENT:{canEdit:false,canView:true},DESIGN:{canEdit:false,canView:false},DEVELOP:{canEdit:false,canView:false},PROTOTYPE:{canEdit:false,canView:false},SETTINGS:{canEdit:false,canView:false},MCP:{canEdit:false,canView:false}}},EDITOR:{id:"EDITOR",title:"Editor",description:"",hierarchy:0,permissions:{canManageUsers:false,canDelete:false,canEdit:false,canPublish:false,canView:false},sectionAccess:{ROOT:{canEdit:false,canView:false},DOCUMENT:{canEdit:false,canView:false},DESIGN:{canEdit:false,canView:false},DEVELOP:{canEdit:false,canView:false},PROTOTYPE:{canEdit:false,canView:false},SETTINGS:{canEdit:false,canView:false},MCP:{canEdit:false,canView:false}}},MANAGER:{id:"MANAGER",title:"Manager",description:"",hierarchy:0,permissions:{canManageUsers:false,canDelete:false,canEdit:false,canPublish:false,canView:false},sectionAccess:{ROOT:{canEdit:false,canView:false},DOCUMENT:{canEdit:false,canView:false},DESIGN:{canEdit:false,canView:false},DEVELOP:{canEdit:false,canView:false},PROTOTYPE:{canEdit:false,canView:false},SETTINGS:{canEdit:false,canView:false},MCP:{canEdit:false,canView:false}}}},ta=Object.values(ln);function ra({path:e,queryParams:r,origin:a}){return urls.createUrlWithParams({url:e,queryParams:r,origin:a})}n(ra,"createUrlForRoute");function dn(e){return Object.fromEntries(e.entries())}n(dn,"getParams");function aa(e){return dn(e)}n(aa,"getParamsForRoute");Object.defineProperty(exports,"isObjKey",{enumerable:true,get:function(){return utils.isObjKey}});Object.defineProperty(exports,"isObject",{enumerable:true,get:function(){return utils.isObject}});exports.ALL_INFER_SPEC_FILTER_KEYS=he;exports.BlockSizes=$n;exports.BlockSpacings=Hn;exports.CodeSrcUserConfigSchema=jr;exports.ColorConfigStruct=l;exports.ColorStringStruct=M;exports.ColorTokenConfigStruct=mn;exports.DEFAULT_INFER_SPEC_FILTERS=Eo;exports.FontFaceConfigStruct=w;exports.FontFaceFormatsEnumStruct=We;exports.FontFaceSourceFormats=ze;exports.FontFaceSourceStruct=Le;exports.FontFaceWeightStruct=ye;exports.FontSizeConfigStruct=$e;exports.FontSizeConfigValStruct=me;exports.FontStretches=Ge;exports.GitProviderType=rn;exports.HeadingLevels=bn;exports.KsAppClientDataAndMetaStruct=_o;exports.KsAppClientDataAndMetaStructV3=lr;exports.KsAppClientDataNoMetaStruct=Wo;exports.KsAppClientDataNoMetaStructV3=pr;exports.KsAppClientDataNoMetaZod=Lo;exports.KsMetaStateStruct=jt;exports.KsMetaStateStructV3=_t;exports.KsRemoteChangesStruct=Qt;exports.KsRendererClientEvents=on;exports.MergeableState=an;exports.NavCustomizationConfigStruct=R;exports.PageHeaderSizes=De;exports.PrimaryNavCustomizationConfigStruct=W;exports.PropTypeNames=Ht;exports.RestActions=sn;exports.SecondaryNavCustomizationConfigStruct=L;exports.TextEncoding=pn;exports.TextTransforms=_e;exports.TokenReferenceStruct=c;exports.TokenValueColorStruct=A;exports.TokenValueCubicBezierStruct=G;exports.TokenValueDimensionStruct=h;exports.TokenValueDurationStruct=E;exports.TokenValueFontWeightStruct=pe;exports.TokenValueStrokeStyleStruct=K;exports.TypographyConfigStruct=p;exports.TypographyLinkConfigStruct=O;exports.UiConfigStruct=Wn;exports.UiConfigV10Struct=Je;exports.UiConfigV1Struct=On;exports.UiConfigV2Struct=Bn;exports.UiConfigV3Struct=An;exports.UiConfigV4Struct=Kn;exports.UiConfigV5Struct=Fn;exports.UiConfigV6Struct=Mn;exports.UiConfigV7Struct=Un;exports.UiConfigV8Struct=jn;exports.UiConfigV9Struct=zn;exports.WS_EVENTS=Zr;exports.addIdToTemplateInfo=Wr;exports.appSections=Sr;exports.appSectionsById=$t;exports.assertTokenData=ao;exports.convertTemplateInfoToOldWay=_r;exports.createTemplateInfoId=en;exports.createUrlForRoute=ra;exports.customizableNavElements=Vn;exports.decodeInferSpecFilters=No;exports.emptyAppClientData=zo;exports.encodeInferSpecFilters=vo;exports.getParams=dn;exports.getParamsForRoute=aa;exports.getPrimitiveValue=Co;exports.hasTokenReferences=x;exports.isArrayOfNumbersProp=vr;exports.isArrayOfObjectsProp=Vr;exports.isArrayOfStringsProp=Er;exports.isBooleanProp=hr;exports.isCustomTypeScriptProp=Pr;exports.isDataDemo=Vo;exports.isDemoWithData=Po;exports.isDimensionString=xo;exports.isFunctionProp=Ir;exports.isKsAppClientDataAndMeta=Ut;exports.isKsAppClientDataAndMetaV3=Lt;exports.isKsAppClientDataNoMeta=Ft;exports.isKsAppClientDataNoMetaV3=Wt;exports.isKsMetaState=Go;exports.isKsMetaStateV3=cr;exports.isKsRemoteChange=Ar;exports.isKsRemoteChanges=Kr;exports.isNotTokenReference=Ze;exports.isNumberProp=xr;exports.isObjectProp=Rr;exports.isOptionsProp=Dr;exports.isPatch=Or;exports.isPatches=Br;exports.isRendererIdForNativeMobile=nn;exports.isSpecNotInferred=wo;exports.isStringProp=Cr;exports.isTemplateDemo=Ro;exports.isTemplateInfoForNativeMobile=Hr;exports.isTemplateInfoWithCodeSrcPath=zr;exports.isTokenDataComposite=no;exports.isTokenGroup=Bt;exports.isTokenReference=Xe;exports.isTokenSrc=yo;exports.isTokenSrcExtensions=Ot;exports.isTokenSrcValueInfoComposite=uo;exports.isTokenSrcValueInfoSingular=co;exports.isTokenTypeComposite=q;exports.isTokenTypeSingular=Se;exports.isTokenTypeVarRef=To;exports.isTokenValueBorder=kt;exports.isTokenValueColor=rt;exports.isTokenValueDimension=J;exports.isTokenValueDuration=oo;exports.isTokenValueFontWeight=ro;exports.isTokenValueShadow=mt;exports.isTokenValueTransition=Ct;exports.ksRendererClientMetaId=Jr;exports.metaForAndroidRenderer=$r;exports.metaForIosRenderer=Gr;exports.migrations=Tr;exports.normalizeTemplateInfo=Lr;exports.pageElements=Cn;exports.pageElementsV2=xn;exports.parseTokenDimensionValue=ho;exports.patternTabTypes=Ao;exports.rendererIds=oe;exports.rendererIdsForNativeMobile=tn;exports.roles=ta;exports.rolesById=ln;exports.strokeStyleValues=Xn;exports.tokenNameDisplayFormats=qn;exports.tokenTypeComposites=et;exports.tokenTypeSingulars=nt;//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map