/**
 * Minified by jsDelivr using Terser v5.48.0.
 * Original file: /npm/@uniformdev/canvas@20.74.3/dist/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__typeError=e=>{throw TypeError(e)},__export=(e,t)=>{for(var n in t)__defProp(e,n,{get:t[n],enumerable:!0})},__copyProps=(e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of __getOwnPropNames(t))__hasOwnProp.call(e,i)||i===n||__defProp(e,i,{get:()=>t[i],enumerable:!(r=__getOwnPropDesc(t,i))||r.enumerable});return e},__toESM=(e,t,n)=>(n=null!=e?__create(__getProtoOf(e)):{},__copyProps(!t&&e&&e.__esModule?n:__defProp(n,"default",{value:e,enumerable:!0}),e)),__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),__accessCheck=(e,t,n)=>t.has(e)||__typeError("Cannot "+n),__privateGet=(e,t,n)=>(__accessCheck(e,t,"read from private field"),n?n.call(e):t.get(e)),__privateAdd=(e,t,n)=>t.has(e)?__typeError("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),index_exports={};__export(index_exports,{ASSETS_SOURCE_CUSTOM_URL:()=>ASSETS_SOURCE_CUSTOM_URL,ASSETS_SOURCE_UNIFORM:()=>ASSETS_SOURCE_UNIFORM,ASSET_PARAMETER_TYPE:()=>ASSET_PARAMETER_TYPE,ATTRIBUTE_COMPONENT_ID:()=>ATTRIBUTE_COMPONENT_ID,ATTRIBUTE_MULTILINE:()=>ATTRIBUTE_MULTILINE,ATTRIBUTE_PARAMETER_ID:()=>ATTRIBUTE_PARAMETER_ID,ATTRIBUTE_PARAMETER_TYPE:()=>ATTRIBUTE_PARAMETER_TYPE,ATTRIBUTE_PARAMETER_VALUE:()=>ATTRIBUTE_PARAMETER_VALUE,ATTRIBUTE_PLACEHOLDER:()=>ATTRIBUTE_PLACEHOLDER,ApiClientError:()=>import_api19.ApiClientError,BatchEntry:()=>BatchEntry,BlockFormatError:()=>BlockFormatError,CANVAS_BLOCK_PARAM_TYPE:()=>CANVAS_BLOCK_PARAM_TYPE,CANVAS_COMPONENT_DISPLAY_NAME_PARAM:()=>CANVAS_COMPONENT_DISPLAY_NAME_PARAM,CANVAS_CONTEXTUAL_EDITING_PARAM:()=>CANVAS_CONTEXTUAL_EDITING_PARAM,CANVAS_DRAFT_STATE:()=>CANVAS_DRAFT_STATE,CANVAS_EDITOR_STATE:()=>CANVAS_EDITOR_STATE,CANVAS_ENRICHMENT_TAG_PARAM:()=>CANVAS_ENRICHMENT_TAG_PARAM,CANVAS_HYPOTHESIS_PARAM:()=>CANVAS_HYPOTHESIS_PARAM,CANVAS_INTENT_TAG_PARAM:()=>CANVAS_INTENT_TAG_PARAM,CANVAS_INTERNAL_PARAM_PREFIX:()=>CANVAS_INTERNAL_PARAM_PREFIX,CANVAS_LOCALE_TAG_PARAM:()=>CANVAS_LOCALE_TAG_PARAM,CANVAS_LOCALIZATION_SLOT:()=>CANVAS_LOCALIZATION_SLOT,CANVAS_LOCALIZATION_TYPE:()=>CANVAS_LOCALIZATION_TYPE,CANVAS_PERSONALIZATION_ALGORITHM_PARAM:()=>CANVAS_PERSONALIZATION_ALGORITHM_PARAM,CANVAS_PERSONALIZATION_ALGORITHM_TYPE:()=>CANVAS_PERSONALIZATION_ALGORITHM_TYPE,CANVAS_PERSONALIZATION_EVENT_NAME_PARAM:()=>CANVAS_PERSONALIZATION_EVENT_NAME_PARAM,CANVAS_PERSONALIZATION_PARAM:()=>CANVAS_PERSONALIZATION_PARAM,CANVAS_PERSONALIZATION_TAKE_PARAM:()=>CANVAS_PERSONALIZATION_TAKE_PARAM,CANVAS_PERSONALIZE_SLOT:()=>CANVAS_PERSONALIZE_SLOT,CANVAS_PERSONALIZE_TYPE:()=>CANVAS_PERSONALIZE_TYPE,CANVAS_PUBLISHED_STATE:()=>CANVAS_PUBLISHED_STATE,CANVAS_SLOT_SECTION_GROUP_TYPE_PARAM:()=>CANVAS_SLOT_SECTION_GROUP_TYPE_PARAM,CANVAS_SLOT_SECTION_MAX_PARAM:()=>CANVAS_SLOT_SECTION_MAX_PARAM,CANVAS_SLOT_SECTION_MIN_PARAM:()=>CANVAS_SLOT_SECTION_MIN_PARAM,CANVAS_SLOT_SECTION_NAME_PARAM:()=>CANVAS_SLOT_SECTION_NAME_PARAM,CANVAS_SLOT_SECTION_SLOT:()=>CANVAS_SLOT_SECTION_SLOT,CANVAS_SLOT_SECTION_SPECIFIC_PARAM:()=>CANVAS_SLOT_SECTION_SPECIFIC_PARAM,CANVAS_SLOT_SECTION_TYPE:()=>CANVAS_SLOT_SECTION_TYPE,CANVAS_TEST_SLOT:()=>CANVAS_TEST_SLOT,CANVAS_TEST_TYPE:()=>CANVAS_TEST_TYPE,CANVAS_TEST_VARIANT_PARAM:()=>CANVAS_TEST_VARIANT_PARAM,CANVAS_VIZ_CONTROL_PARAM:()=>CANVAS_VIZ_CONTROL_PARAM,CANVAS_VIZ_DI_RULE:()=>CANVAS_VIZ_DI_RULE,CANVAS_VIZ_DYNAMIC_TOKEN_RULE:()=>CANVAS_VIZ_DYNAMIC_TOKEN_RULE,CANVAS_VIZ_LOCALE_RULE:()=>CANVAS_VIZ_LOCALE_RULE,CANVAS_VIZ_QUIRKS_RULE:()=>CANVAS_VIZ_QUIRKS_RULE,CanvasClient:()=>CanvasClient,CanvasClientError:()=>CanvasClientError,CategoryClient:()=>CategoryClient,ChildEnhancerBuilder:()=>ChildEnhancerBuilder,ContentClient:()=>ContentClient,DataSourceClient:()=>DataSourceClient,DataTypeClient:()=>DataTypeClient,EDGE_CACHE_DISABLED:()=>EDGE_CACHE_DISABLED,EDGE_DEFAULT_CACHE_TTL:()=>EDGE_DEFAULT_CACHE_TTL,EDGE_MAX_CACHE_TTL:()=>EDGE_MAX_CACHE_TTL,EDGE_MIN_CACHE_TTL:()=>EDGE_MIN_CACHE_TTL,EMPTY_COMPOSITION:()=>EMPTY_COMPOSITION,EnhancerBuilder:()=>EnhancerBuilder,EntityReleasesClient:()=>EntityReleasesClient,IN_CONTEXT_EDITOR_COMPONENT_END_ROLE:()=>IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,IN_CONTEXT_EDITOR_COMPONENT_START_ROLE:()=>IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM:()=>IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM,IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID:()=>IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID,IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM:()=>IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM,IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM:()=>IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM,IN_CONTEXT_EDITOR_QUERY_STRING_PARAM:()=>IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,IS_RENDERED_BY_UNIFORM_ATTRIBUTE:()=>IS_RENDERED_BY_UNIFORM_ATTRIBUTE,IntegrationPropertyEditorsClient:()=>IntegrationPropertyEditorsClient,LOCALE_DYNAMIC_INPUT_NAME:()=>LOCALE_DYNAMIC_INPUT_NAME,LabelClient:()=>LabelClient,LocaleClient:()=>LocaleClient,PLACEHOLDER_ID:()=>PLACEHOLDER_ID,PreviewClient:()=>PreviewClient,ProjectClient:()=>ProjectClient,PromptClient:()=>PromptClient,REFERENCE_DATA_TYPE_ID:()=>REFERENCE_DATA_TYPE_ID,RelationshipClient:()=>RelationshipClient,ReleaseClient:()=>ReleaseClient,ReleaseContentsClient:()=>ReleaseContentsClient,RouteClient:()=>RouteClient,SECRET_QUERY_STRING_PARAM:()=>SECRET_QUERY_STRING_PARAM,SELECT_QUERY_PREFIX:()=>SELECT_QUERY_PREFIX,UncachedCanvasClient:()=>UncachedCanvasClient,UncachedCategoryClient:()=>UncachedCategoryClient,UncachedContentClient:()=>UncachedContentClient,UncachedLabelClient:()=>UncachedLabelClient,UniqueBatchEntries:()=>UniqueBatchEntries,WorkflowClient:()=>WorkflowClient,autoFixParameterGroups:()=>autoFixParameterGroups,bindExpressionEscapeChars:()=>bindExpressionEscapeChars,bindExpressionPrefix:()=>bindExpressionPrefix,bindVariables:()=>bindVariables,bindVariablesToObject:()=>bindVariablesToObject,compose:()=>compose,convertEntryToPutEntry:()=>convertEntryToPutEntry,convertToBindExpression:()=>convertToBindExpression,createBatchEnhancer:()=>createBatchEnhancer,createCanvasChannel:()=>createCanvasChannel,createDynamicInputVisibilityRule:()=>createDynamicInputVisibilityRule,createDynamicTokenVisibilityRule:()=>createDynamicTokenVisibilityRule,createLimitPolicy:()=>createLimitPolicy,createLocaleVisibilityRule:()=>createLocaleVisibilityRule,createQuirksVisibilityRule:()=>createQuirksVisibilityRule,createUniformApiEnhancer:()=>createUniformApiEnhancer,createVariableReference:()=>createVariableReference,enhance:()=>enhance,escapeBindExpressionDefaultValue:()=>escapeBindExpressionDefaultValue,evaluateNodeVisibilityParameter:()=>evaluateNodeVisibilityParameter,evaluatePropertyCriteria:()=>evaluatePropertyCriteria,evaluateVisibilityCriteriaGroup:()=>evaluateVisibilityCriteriaGroup,evaluateWalkTreeNodeVisibility:()=>evaluateWalkTreeNodeVisibility,evaluateWalkTreePropertyCriteria:()=>evaluateWalkTreePropertyCriteria,extractLocales:()=>extractLocales,findParameterInNodeTree:()=>findParameterInNodeTree,flattenValues:()=>flattenValues,generateComponentPlaceholderId:()=>generateComponentPlaceholderId,generateHash:()=>generateHash,getBlockValue:()=>getBlockValue,getComponentJsonPointer:()=>getComponentJsonPointer,getComponentPath:()=>getComponentPath,getDataSourceVariantFromRouteGetParams:()=>getDataSourceVariantFromRouteGetParams,getEffectivePropertyValue:()=>getEffectivePropertyValue,getLocalizedPropertyValues:()=>getLocalizedPropertyValues,getNounForLocation:()=>getNounForLocation,getNounForNode:()=>getNounForNode,getParameterAttributes:()=>getParameterAttributes,getPropertiesValue:()=>getPropertiesValue,hasReferencedVariables:()=>hasReferencedVariables,isAddComponentMessage:()=>isAddComponentMessage,isAllowedReferrer:()=>isAllowedReferrer,isAssetParamValue:()=>isAssetParamValue,isAssetParamValueItem:()=>isAssetParamValueItem,isAwaitingReadyMessage:()=>isAwaitingReadyMessage,isComponentActionMessage:()=>isComponentActionMessage,isComponentPlaceholderId:()=>isComponentPlaceholderId,isContextStorageUpdatedMessage:()=>isContextStorageUpdatedMessage,isDismissPlaceholderMessage:()=>isDismissPlaceholderMessage,isEntryData:()=>isEntryData,isLinkParamValue:()=>isLinkParamValue,isMovingComponentMessage:()=>isMovingComponentMessage,isNestedNodeType:()=>isNestedNodeType,isOpenParameterEditorMessage:()=>isOpenParameterEditorMessage,isReadyMessage:()=>isReadyMessage,isReportRenderedCompositionsMessage:()=>isReportRenderedCompositionsMessage,isRequestComponentSuggestionMessage:()=>isRequestComponentSuggestionMessage,isRootEntryReference:()=>isRootEntryReference,isSelectComponentMessage:()=>isSelectComponentMessage,isSelectParameterMessage:()=>isSelectParameterMessage,isSessionPendingMessage:()=>isSessionPendingMessage,isSuggestComponentMessage:()=>isSuggestComponentMessage,isSystemComponentDefinition:()=>isSystemComponentDefinition,isTriggerCompositionActionMessage:()=>isTriggerCompositionActionMessage,isUpdateAiActionsMessage:()=>isUpdateAiActionsMessage,isUpdateComponentParameterMessage:()=>isUpdateComponentParameterMessage,isUpdateComponentReferencesMessage:()=>isUpdateComponentReferencesMessage,isUpdateCompositionInternalMessage:()=>isUpdateCompositionInternalMessage,isUpdateCompositionMessage:()=>isUpdateCompositionMessage,isUpdateContextualEditingStateInternalMessage:()=>isUpdateContextualEditingStateInternalMessage,isUpdateFeatureFlagsMessage:()=>isUpdateFeatureFlagsMessage,isUpdatePreviewSettingsMessage:()=>isUpdatePreviewSettingsMessage,localize:()=>localize,mapSlotToPersonalizedVariations:()=>mapSlotToPersonalizedVariations,mapSlotToTestVariations:()=>mapSlotToTestVariations,matchesProjectionPattern:()=>matchesProjectionPattern,mergeAssetConfigWithDefaults:()=>mergeAssetConfigWithDefaults,nullLimitPolicy:()=>nullLimitPolicy,parseComponentPlaceholderId:()=>parseComponentPlaceholderId,parseVariableExpression:()=>parseVariableExpression,projectionToQuery:()=>projectionToQuery,queryToProjection:()=>queryToProjection,version:()=>version,walkNodeTree:()=>walkNodeTree,walkPropertyValues:()=>walkPropertyValues}),module.exports=__toCommonJS(index_exports);var import_api2=require("@uniformdev/context/api"),import_api=require("@uniformdev/context/api"),import_p_limit=__toESM(require("p-limit")),import_p_retry=__toESM(require("p-retry")),import_p_throttle=__toESM(require("p-throttle"));function createLimitPolicy({throttle:e={interval:1e3,limit:10},retry:t={retries:1,factor:1.66},limit:n=10}){const r=e?(0,import_p_throttle.default)(e):null,i=n?(0,import_p_limit.default)(n):null;return function(e){let n=async()=>await e();if(r){n=r(n)}if(i){const e=n;n=()=>i(e)}if(t){const e=n;n=()=>(0,import_p_retry.default)(e,{...t,onFailedAttempt:async e=>{if(t.onFailedAttempt&&await t.onFailedAttempt(e),e instanceof import_api.ApiClientError&&"number"==typeof e.statusCode&&e.statusCode>=400&&e.statusCode<500&&429!==e.statusCode&&408!==e.statusCode)throw e}})}return n()}}var nullLimitPolicy=async e=>await e(),SELECT_QUERY_PREFIX="select.";function appendCsv(e,t,n){void 0!==n&&(e[t]=n.join(","))}function projectionToQuery(e){const t={};if(!e)return t;const{fields:n,fieldTypes:r,slots:i}=e,o=SELECT_QUERY_PREFIX;if(n&&(appendCsv(t,`${o}fields[only]`,n.only),appendCsv(t,`${o}fields[except]`,n.except),appendCsv(t,`${o}fields[locales]`,n.locales),"preserveAll"!==n.blockDepth&&"number"!=typeof n.blockDepth||(t[`${o}fields[blockDepth]`]=String(n.blockDepth))),r&&(appendCsv(t,`${o}fieldTypes[only]`,r.only),appendCsv(t,`${o}fieldTypes[except]`,r.except)),i&&(appendCsv(t,`${o}slots[only]`,i.only),appendCsv(t,`${o}slots[except]`,i.except),"number"==typeof i.depth&&(t[`${o}slots[depth]`]=String(i.depth)),i.named)){const e=Object.keys(i.named).sort();for(const n of e){const e=i.named[n];e&&"number"==typeof e.depth&&(t[`${o}slots.${n}[depth]`]=String(e.depth))}}return t}var _contentTypesUrl,_entriesUrl,CANVAS_URL="/api/v1/canvas",CanvasClient=class extends import_api2.ApiClient{constructor(e){var t;e.limitPolicy||(e.limitPolicy=createLimitPolicy({})),super(e),this.edgeApiHost=null!=(t=e.edgeApiHost)?t:"https://uniform.global",this.edgeApiRequestInit=e.disableSWR?{headers:{"x-disable-swr":"true"}}:void 0}async getCompositionList(e={}){const{projectId:t}=this.options,{resolveData:n,filters:r,select:i,...o}=e,s=(0,import_api2.rewriteFiltersForApi)(r),a=projectionToQuery(i);if(!n){const e=this.createUrl(CANVAS_URL,{...o,projectId:t,...s,...a});return this.apiClient(e)}const l={...o,projectId:t,diagnostics:"boolean"==typeof e.diagnostics?e.diagnostics:"no-data"===e.diagnostics?"no-data":void 0,...s,...a},c=this.createUrl("/api/v1/compositions",l,this.edgeApiHost);return this.apiClient(c,this.edgeApiRequestInit)}getCompositionByNodePath(e){return this.getOneComposition(e)}getCompositionByNodeId(e){return this.getOneComposition(e)}getCompositionBySlug(e){return this.getOneComposition(e)}getCompositionById(e){return this.getOneComposition(e)}getCompositionDefaults(e){return this.getOneComposition(e)}async getCompositionHistory(e){const t=this.createUrl("/api/v1/canvas-history",{...e,projectId:this.options.projectId});return this.apiClient(t)}getOneComposition({skipDataResolution:e,diagnostics:t,...n}){const{projectId:r}=this.options;if(e)return this.apiClient(this.createUrl(CANVAS_URL,{...n,projectId:r}));const i={...n,projectId:r,diagnostics:"boolean"==typeof t?t:"no-data"===t?"no-data":void 0},o=this.createUrl("/api/v1/composition",i,this.edgeApiHost);return this.apiClient(o,this.edgeApiRequestInit)}async updateComposition(e,t){const n=this.createUrl(CANVAS_URL),r={};(null==t?void 0:t.ifUnmodifiedSince)&&(r["x-if-unmodified-since"]=t.ifUnmodifiedSince);const{response:i}=await this.apiClientWithResponse(n,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0,headers:r});return{modified:i.headers.get("x-modified-at")}}async removeComposition(e){const t=this.createUrl(CANVAS_URL),{projectId:n}=this.options;await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:n}),expectNoContent:!0})}async getComponentDefinitions(e){const{projectId:t}=this.options,n=this.createUrl("/api/v1/canvas-definitions",{...e,projectId:t});return this.apiClient(n)}async updateComponentDefinition(e){const t=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async removeComponentDefinition(e){const t=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},UncachedCanvasClient=class extends CanvasClient{constructor(e){super({...e,bypassCache:!0})}},import_api3=require("@uniformdev/context/api"),CATEGORIES_URL="/api/v1/categories",CategoryClient=class extends import_api3.ApiClient{constructor(e){e.limitPolicy||(e.limitPolicy=createLimitPolicy({})),super(e)}async getCategories(e){const{projectId:t}=this.options,n=this.createUrl("/api/v1/categories",{...e,projectId:t});return await this.apiClient(n)}async upsertCategories(e){const{projectId:t}=this.options,n=this.createUrl(CATEGORIES_URL);return await this.apiClient(n,{method:"PUT",body:JSON.stringify({categories:e,projectId:t}),expectNoContent:!0})}async removeCategory(e){const{projectId:t}=this.options,n=this.createUrl(CATEGORIES_URL);return await this.apiClient(n,{method:"DELETE",body:JSON.stringify({projectId:t,categoryId:e.categoryId}),expectNoContent:!0})}},UncachedCategoryClient=class extends CategoryClient{constructor(e){super({...e,bypassCache:!0})}},import_api4=require("@uniformdev/context/api"),_ContentClient=class e extends import_api4.ApiClient{constructor(e){var t;super(e),this.edgeApiHost=null!=(t=e.edgeApiHost)?t:"https://uniform.global"}getContentTypes(t){const{projectId:n}=this.options,r=this.createUrl(__privateGet(e,_contentTypesUrl),{...t,projectId:n});return this.apiClient(r)}getEntries(t){const{projectId:n}=this.options,{skipDataResolution:r,filters:i,select:o,...s}=t,a=(0,import_api4.rewriteFiltersForApi)(i),l=projectionToQuery(o);if(r){const t=this.createUrl(__privateGet(e,_entriesUrl),{...s,...a,...l,projectId:n});return this.apiClient(t)}const c=this.createUrl(__privateGet(e,_entriesUrl),{...this.getEdgeOptions(s),...a,...l},this.edgeApiHost);return this.apiClient(c,this.options.disableSWR?{headers:{"x-disable-swr":"true"}}:void 0)}async getEntryHistory(e){const t=this.createUrl("/api/v1/entries-history",{...e,projectId:this.options.projectId});return this.apiClient(t)}async upsertContentType(t,n={}){const r=this.createUrl(__privateGet(e,_contentTypesUrl));"object"==typeof t.contentType.slugSettings&&null!==t.contentType.slugSettings&&0===Object.keys(t.contentType.slugSettings).length&&delete t.contentType.slugSettings,await this.apiClient(r,{method:"PUT",body:JSON.stringify({...t,projectId:this.options.projectId}),expectNoContent:!0,headers:n.autogenerateDataTypes?{"x-uniform-autogenerate-data-types":"true"}:{}})}async upsertEntry(t,n){const r=this.createUrl(__privateGet(e,_entriesUrl)),i={};(null==n?void 0:n.ifUnmodifiedSince)&&(i["x-if-unmodified-since"]=n.ifUnmodifiedSince);const{response:o}=await this.apiClientWithResponse(r,{method:"PUT",body:JSON.stringify({...t,projectId:this.options.projectId}),expectNoContent:!0,headers:i});return{modified:o.headers.get("x-modified-at")}}async deleteContentType(t){const n=this.createUrl(__privateGet(e,_contentTypesUrl));await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...t,projectId:this.options.projectId}),expectNoContent:!0})}async deleteEntry(t){const n=this.createUrl(__privateGet(e,_entriesUrl));await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...t,projectId:this.options.projectId}),expectNoContent:!0})}getEdgeOptions(e){const{projectId:t}=this.options,{skipDataResolution:n,...r}=e;return{projectId:t,...r,diagnostics:"boolean"==typeof e.diagnostics?e.diagnostics:"no-data"===e.diagnostics?"no-data":void 0}}};_contentTypesUrl=new WeakMap,_entriesUrl=new WeakMap,__privateAdd(_ContentClient,_contentTypesUrl,"/api/v1/content-types"),__privateAdd(_ContentClient,_entriesUrl,"/api/v1/entries");var _url,ContentClient=_ContentClient,UncachedContentClient=class extends ContentClient{constructor(e){super({...e,bypassCache:!0})}},import_api5=require("@uniformdev/context/api"),dataSourceUrl="/api/v1/data-source",dataSourcesUrl="/api/v1/data-sources",DataSourceClient=class extends import_api5.ApiClient{constructor(e){super(e)}async get(e){const{projectId:t}=this.options,n=this.createUrl(dataSourceUrl,{...e,projectId:t});return await this.apiClient(n)}async getList(e){const{projectId:t}=this.options,n=this.createUrl(dataSourcesUrl,{...e,projectId:t});return await this.apiClient(n)}async upsert(e){const t=this.createUrl(dataSourceUrl);await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){const t=this.createUrl(dataSourceUrl);await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},import_api6=require("@uniformdev/context/api"),_DataTypeClient=class e extends import_api6.ApiClient{constructor(e){super(e)}async get(t){const{projectId:n}=this.options,r=this.createUrl(__privateGet(e,_url),{...t,projectId:n});return await this.apiClient(r)}async upsert(t){const n=this.createUrl(__privateGet(e,_url));await this.apiClient(n,{method:"PUT",body:JSON.stringify({...t,projectId:this.options.projectId}),expectNoContent:!0})}async remove(t){const n=this.createUrl(__privateGet(e,_url));await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...t,projectId:this.options.projectId}),expectNoContent:!0})}};__privateAdd(_DataTypeClient,_url=new WeakMap,"/api/v1/data-types");var DataTypeClient=_DataTypeClient,BatchEntry=class{constructor(e,t,n){this._resolve=e,this._reject=t,this.args=n,this._isCompleted=!1}resolve(e){this._resolve(e),this._isCompleted=!0}reject(e){this._reject(e),this._isCompleted=!0}get isCompleted(){return this._isCompleted}};function createBatchEnhancer({handleBatch:e,shouldQueue:t,limitPolicy:n}){let r=[];return{enhanceOne:async e=>!t||t(e)?new Promise((t,n)=>{r.push(new BatchEntry(t,n,e))}):void 0,completeAll:async()=>{if(r.length>0){try{await e(r)}catch(e){r.forEach(t=>t.reject(e))}if(r.some(e=>!e.isCompleted))throw new Error("The completeAll() function failed to resolve or reject all promises in the batch!")}const t=r.length;return r=[],t},limitPolicy:n}}var compose=(e,...t)=>({enhanceOne:n=>{let r="enhanceOne"in e?e.enhanceOne(n):e(n);for(const e of t){const t=isPromise(r)?r:Promise.resolve(r),i="enhanceOne"in e?e.enhanceOne:e;r=t.then(e=>i({...n,parameter:{type:n.parameter.type,value:e}}))}return r},completeAll:async()=>{var n,r;for(const e of t)if("completeAll"in e)throw new Error("Only the first enhancer in a compose chain can use the completeAll function (batching)");return null!=(r="completeAll"in e?null==(n=e.completeAll)?void 0:n.call(e):0)?r:0}});function isPromise(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}function getComponentPath(e){const t=[];for(let n=e.length-1;n>=0;n--){const r=e[n],i=e[n+1];if("type"in r&&"slot"!==r.type){if("block"===r.type){const{fieldName:e,blockIndexFn:n}=r,o=n();if(e&&void 0!==o){const n=i&&"type"in i&&"block"===i.type?"fields":"parameters";t.push(`${n}.${e}.value[${o}]`)}}continue}const o=r.parentSlotIndexFn(),{parentSlot:s}=r;s&&void 0!==o&&t.push(`${s}[${o}]`)}return`.${t.join(".")}`}var CANVAS_PERSONALIZE_TYPE="$personalization",CANVAS_TEST_TYPE="$test",CANVAS_LOCALIZATION_TYPE="$localization",CANVAS_SLOT_SECTION_TYPE="$slotSection",CANVAS_INTENT_TAG_PARAM="intentTag",CANVAS_LOCALE_TAG_PARAM="locale",CANVAS_BLOCK_PARAM_TYPE="$block",CANVAS_PERSONALIZE_SLOT="pz",CANVAS_TEST_SLOT="test",CANVAS_LOCALIZATION_SLOT="localized",CANVAS_SLOT_SECTION_SLOT="$slotSectionItems",CANVAS_SLOT_SECTION_NAME_PARAM="name",CANVAS_SLOT_SECTION_MIN_PARAM="min",CANVAS_SLOT_SECTION_MAX_PARAM="max",CANVAS_SLOT_SECTION_GROUP_TYPE_PARAM="groupType",CANVAS_SLOT_SECTION_SPECIFIC_PARAM="specific",CANVAS_DRAFT_STATE=0,CANVAS_PUBLISHED_STATE=64,CANVAS_EDITOR_STATE=63,CANVAS_PERSONALIZATION_PARAM="$pzCrit",CANVAS_PERSONALIZATION_EVENT_NAME_PARAM="trackingEventName",CANVAS_PERSONALIZATION_ALGORITHM_PARAM="algorithm",CANVAS_PERSONALIZATION_ALGORITHM_TYPE="pzAlgorithm",CANVAS_PERSONALIZATION_TAKE_PARAM="count",CANVAS_TEST_VARIANT_PARAM="$tstVrnt",CANVAS_ENRICHMENT_TAG_PARAM="$enr",CANVAS_INTERNAL_PARAM_PREFIX="$internal_",CANVAS_COMPONENT_DISPLAY_NAME_PARAM=`${CANVAS_INTERNAL_PARAM_PREFIX}displayName`,CANVAS_HYPOTHESIS_PARAM=`${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`,CANVAS_CONTEXTUAL_EDITING_PARAM="$contextualEditing",SECRET_QUERY_STRING_PARAM="secret",IN_CONTEXT_EDITOR_QUERY_STRING_PARAM="is_incontext_editing_mode",IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM="is_incontext_editing_playground",IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM="is_incontext_editing_forced_settings",IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM="is_config_check",IN_CONTEXT_EDITOR_COMPONENT_START_ROLE="uniform-component-start",IN_CONTEXT_EDITOR_COMPONENT_END_ROLE="uniform-component-end",IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID="uniform-canvas-preview-script",IS_RENDERED_BY_UNIFORM_ATTRIBUTE="data-is-rendered-by-uniform",PLACEHOLDER_ID="placeholder",EMPTY_COMPOSITION={_id:"_empty_composition_id",_name:"An empty composition used for contextual editing",type:"_empty_composition_type"},EDGE_MIN_CACHE_TTL=10,EDGE_MAX_CACHE_TTL=86400,EDGE_DEFAULT_CACHE_TTL=30,EDGE_CACHE_DISABLED=-1,ASSET_PARAMETER_TYPE="asset",ASSETS_SOURCE_UNIFORM="uniform-assets",ASSETS_SOURCE_CUSTOM_URL="custom-url",REFERENCE_DATA_TYPE_ID="uniformContentInternalReference";function isRootEntryReference(e){return"root"===e.type&&isEntryData(e.node)}function isEntryData(e){return Boolean(e&&"object"==typeof e&&"fields"in e)}function isAssetParamValue(e){return Array.isArray(e)&&(!(e.length>0)||isAssetParamValueItem(e[0]))}function isAssetParamValueItem(e){return Boolean(e instanceof Object&&"_source"in e&&"fields"in e&&e.fields instanceof Object&&"url"in e.fields&&e.fields.url instanceof Object)}function isLinkParamValue(e){return"object"==typeof e&&null!==e&&"type"in e&&"path"in e}function getPropertiesValue(e){return"parameters"in e&&e.parameters?e.parameters:"fields"in e&&e.fields?e.fields:void 0}function getLocalizedPropertyValues(e){if(!e)return e;const t=new Map;if(void 0!==e.value&&t.set(void 0,e.value),void 0!==e.locales)for(const[n,r]of Object.entries(e.locales))t.set(n,r);return t}function flattenValues(e,t={}){return e?Array.isArray(e)&&t.toSingle?e.length>0?flattenSingleNodeValues(e[0]):void 0:Array.isArray(e)?e.map(e=>flattenSingleNodeValues(e,t)):flattenSingleNodeValues(e,t):e}function flattenSingleNodeValues(e,t={}){const{levels:n=1}=t,r=getPropertiesValue(e);return r?Object.fromEntries(Object.entries(r).map(([e,r])=>{const i=r?r.value:r;if(n>0&&Array.isArray(i)&&(isNestedNodeType(r.type)||r.type===ASSET_PARAMETER_TYPE)){const r={...t,levels:n-1};return[e,i.map(e=>flattenValues(e,r))]}return[e,i]})):r}var escapeCharacter="\\",variablePrefix="${",variableSuffix="}";function parseVariableExpression(e,t){if("string"!=typeof e)throw new TypeError("Variable expression must be a string");let n=0,r=0,i=0;const o=(e,n,r)=>(i++,null==t?void 0:t(e,n,r));let s="text";for(let t=0;t<e.length;t++){const a=e[t];if(n>r&&(r=n),a!==variablePrefix[0]||e[t+1]!==variablePrefix[1])if(a!==variableSuffix||"variable"!==s)r++;else{if(e[t-1]===escapeCharacter){r++;continue}if(s="text",r>n){if(!1===o(e.substring(n,r).replace(/\\([${}])/g,"$1"),"variable",n))return i;n=r+variableSuffix.length}}else{if(e[t-1]===escapeCharacter){if(r-=escapeCharacter.length,!1===o(e.substring(n,r),"text",n))return i;n=t,r=t+1;continue}if("variable"===s){const t=n-variablePrefix.length;if(!1===o(e.substring(t,r),"text",t))return i;n=r}else if(r>n){if(!1===o(e.substring(n,r),"text",n))return i;n=r}s="variable",t+=variablePrefix.length-1,n+=variablePrefix.length}}return"variable"===s&&(s="text",n-=variablePrefix.length),n<e.length&&o(e.substring(n),s,n),i}function hasReferencedVariables(e){if(void 0===e)return 0;let t=0;return parseVariableExpression(e,(e,n)=>{"variable"===n&&t++}),t}function walkNodeTree(e,t,n){var r,i,o;const s=[{ancestorsAndSelf:Array.isArray(e)?e:[{node:e,type:"root"}],context:null==n?void 0:n.initialContext}],a=new Map,l=null!=(r=null==n?void 0:n.order)?r:"dfs",c=()=>"bfs"===l?s.shift():s.pop();do{const e=c();if(!e)continue;const r=e.ancestorsAndSelf[0];let p,d=!0,u=null!=(i=a.get(r.node))?i:e.context;if(p="root"===r.type&&isRootEntryReference(r)||"block"===r.type?{type:"entry",node:r.node,ancestorsAndSelf:e.ancestorsAndSelf,actions:{replace:e=>{Object.assign(r.node,e);["fields","_dataResources","_author"].forEach(t=>{e[t]||delete r.node[t]})},remove:()=>{const t=e.ancestorsAndSelf[0],n=e.ancestorsAndSelf[1];if("block"!==t.type)throw new Error("Unknown node type");{const{fieldName:e,blockIndexFn:r}=t,i=r(),o=getBlockValue(n.node,e);if(o.splice(i,1),0===o.length){delete getPropertiesValue(n.node)[e]}}d=!1},insertAfter:t=>{const n=e.ancestorsAndSelf[0];if("block"!==n.type)throw new Error("Unknown type");const{fieldName:r,blockIndexFn:i}=n,o=i(),a=e.ancestorsAndSelf[1],l=Array.isArray(t)?t:[t];r&&void 0!==o&&(getPropertiesValue(a.node)[r].value.splice(o+1,0,...l),s.unshift(...l.map(t=>({ancestorsAndSelf:[{type:"block",node:t,fieldName:r,blockIndexFn:()=>getPropertiesValue(a.node)[r].value.findIndex(e=>e===t)},...e.ancestorsAndSelf.slice(1)],context:u}))))},stopProcessingDescendants(){d=!1},setDescendantsContext(e){u=e},setChildContext(e,t){a.set(e,t)}},context:u}:{type:"component",node:r.node,ancestorsAndSelf:e.ancestorsAndSelf,actions:{replace:e=>{Object.assign(r.node,e);["parameters","variant","slots","data","_pattern","_patternError","_dataResources","_overridability","_overrides","_patternDataResources"].forEach(t=>{e[t]||delete r.node[t]})},remove:()=>{const t=e.ancestorsAndSelf[0],n=e.ancestorsAndSelf[1];if("root"===t.type)throw new Error("Unable to delete root node.");if("slot"!==t.type)throw new Error("Unknown node type");{const{parentSlot:e,parentSlotIndexFn:r}=t,i=r();n.node.slots[e].splice(i,1)}d=!1},insertAfter:t=>{const n=Array.isArray(t)?t:[t],r=e.ancestorsAndSelf[0];if("root"===r.type)throw new Error("Unable to insert after root node.");if("slot"!==r.type)throw new Error("Unknown type");{const{parentSlot:t,parentSlotIndexFn:i}=r,o=i(),a=e.ancestorsAndSelf[1];t&&void 0!==o&&(a.node.slots[t].splice(o+1,0,...n),s.unshift(...n.map(n=>({type:"slot",ancestorsAndSelf:[{type:"slot",node:n,parentSlot:t,parentSlotIndexFn:()=>a.node.slots[t].findIndex(e=>e===n)},...e.ancestorsAndSelf.slice(1)],context:u}))))}},stopProcessingDescendants(){d=!1},setDescendantsContext(e){u=e},setChildContext(e,t){a.set(e,t)}},context:u},t(p),!d)continue;const _="slots"in r.node&&r.node.slots,A=[],C=getPropertiesValue(r.node);if(C){const t=Object.entries(C);for(const[i,s]of t){if(!isNestedNodeType(s.type))continue;if("string"==typeof s.value&&hasReferencedVariables(s.value)>0)continue;if(!Array.isArray(s.value)){const t=new BlockFormatError(`${getComponentPath(e.ancestorsAndSelf)}`,i,s.value);if(null==n?void 0:n.throwForInvalidBlockValues)throw t;console.warn(`Skipped invalid block value: ${t.message}}`);continue}const t=null!=(o=s.value)?o:[];for(const n of t){const t=()=>getBlockValue(r.node,i).findIndex(e=>e===n);A.push({ancestorsAndSelf:[{type:"block",node:n,fieldName:i,blockIndexFn:t},...e.ancestorsAndSelf],context:u})}}}if(_){const t=Object.keys(_);for(const n of t){const t=_[n];for(const i of t){const t=()=>r.node.slots[n].findIndex(e=>e===i);A.push({ancestorsAndSelf:[{type:"slot",node:i,parentSlot:n,parentSlotIndexFn:t},...e.ancestorsAndSelf],context:u})}}}"dfs"===l&&A.reverse(),s.push(...A)}while(s.length>0)}function isNestedNodeType(e){return e===CANVAS_BLOCK_PARAM_TYPE}function getBlockValue(e,t){var n;const r=null==(n=getPropertiesValue(e))?void 0:n[t];return(null==r?void 0:r.value)&&r.type===CANVAS_BLOCK_PARAM_TYPE&&Array.isArray(r.value)?r.value:[]}var BlockFormatError=class e extends Error{constructor(t,n,r){super(`${t} has an invalid block property value on ${n}. Block values must be arrays of blocks (BlockValue type), but received ${null===r?"null":typeof r}`),this.componentPath=t,this.propertyId=n,this.blockValue=r,Object.setPrototypeOf(this,e.prototype)}};async function enhance({composition:e,enhancers:t,context:n,onErrors:r=e=>{throw new Error(e.map(e=>`${e.message}\n ${"object"==typeof e.error&&"stack"in e.error?e.error.stack:e.error}`).join("\n\n"))}}){const i=[],o=new Set,s=new Set;walkNodeTree(e,({type:e,node:r,ancestorsAndSelf:a,actions:l})=>{var c;if("component"!==e)return void l.stopProcessingDescendants();Object.entries(null!=(c=r.parameters)?c:{}).forEach(([e,o])=>{const l=t.resolveParameterEnhancer(r,e,o);l&&(s.add(l),i.push(enhanceParameter(r,a,e,o,l,n)))});const p=t.resolveComponentEnhancers(r);i.push(enhanceComponent(r,a,p,n)),o.add(p)}),i.push(...Array.from(o).flatMap(e=>Array.from(e).map(async([,e])=>{var t;try{if(e.completeAll){const n=null!=(t=e.limitPolicy)?t:nullLimitPolicy;await n(()=>e.completeAll())}}catch(e){return{error:e,message:"Batch component enhancer failed. Individual failed components should receive their own rejections."}}}))),i.push(...Array.from(s).map(async e=>{var t;try{if(e.completeAll){const n=null!=(t=e.limitPolicy)?t:nullLimitPolicy;await n(()=>e.completeAll())}}catch(e){return{error:e,message:"Batch parameter enhancer failed. Individual failed parameters should receive their own rejections."}}}));const a=(await Promise.all(i)).flatMap(e=>Array.isArray(e)?e:[e]).filter(e=>e);a.length&&r(a)}async function enhanceComponent(e,t,n,r){return n.size&&(e.data={}),await Promise.all(Array.from(n).map(async([n,i])=>{var o;try{const t=i.completeAll?nullLimitPolicy:null!=(o=i.limitPolicy)?o:nullLimitPolicy,s=await t(async()=>i.enhanceOne({component:e,context:r}));null!=s&&(e.data[n]=s)}catch(r){const i=`Component ${getComponentPath(t)} (type: ${e.type}): data.${n} enhancer threw exception. Data key will not be present.`;return delete e.data[n],{message:i,error:r}}}))}async function enhanceParameter(e,t,n,r,i,o){var s;try{const t=i.completeAll?nullLimitPolicy:null!=(s=i.limitPolicy)?s:nullLimitPolicy,a=await t(async()=>i.enhanceOne({parameter:r,parameterName:n,component:e,context:o}));null===a?delete e.parameters[n]:e.parameters[n]=void 0===a?{...r,value:r.value}:{...r,value:a}}catch(i){const o=`Component ${getComponentPath(t)} (type: ${e.type}): enhancing parameter ${n} (type: ${r.type}) threw exception. Parameter will be removed.`;return delete e.parameters[n],{message:o,error:i}}}var ChildEnhancerBuilder=class{constructor(){this._paramMatches=Array(),this._dataMatches=new Map}parameter(e){return this._paramMatches.push({enhancer:this._resolveParameterEnhancer(e)}),this}parameterName(e,t){return(Array.isArray(e)?e:[e]).forEach(e=>this._paramMatches.push({name:e,enhancer:this._resolveParameterEnhancer(t)})),this}parameterType(e,t){return(Array.isArray(e)?e:[e]).forEach(e=>this._paramMatches.push({type:e,enhancer:this._resolveParameterEnhancer(t)})),this}data(e,t){if(this._dataMatches.has(e))throw new Error(`${e} enhancer data key has been used more than once. This will cause data loss.`);return this._dataMatches.set(e,"function"==typeof t?{enhanceOne:t}:t),this}resolveParameterEnhancer(e,t){var n;return null==(n=this._paramMatches.find(n=>n.name&&n.name===e||n.type&&n.type===t.type||!n.type&&!n.name))?void 0:n.enhancer}resolveComponentEnhancers(){return this._dataMatches}_resolveParameterEnhancer(e){return"function"==typeof e?{enhanceOne:e}:e}},EnhancerBuilder=class{constructor(){this._componentIndex={},this._rootBuilder=new ChildEnhancerBuilder}parameter(e){return this._rootBuilder.parameter(e),this}parameterName(e,t){return this._rootBuilder.parameterName(e,t),this}parameterType(e,t){return this._rootBuilder.parameterType(e,t),this}data(e,t){return this._rootBuilder.data(e,t),this}component(e,t){return(Array.isArray(e)?e:[e]).forEach(e=>{this._componentIndex[e]=this._componentIndex[e]||new ChildEnhancerBuilder,t(this._componentIndex[e])}),this}resolveParameterEnhancer(e,t,n){const r=this._componentIndex[e.type];if(r){const e=r.resolveParameterEnhancer(t,n);if(e)return e}return this._rootBuilder.resolveParameterEnhancer(t,n)}resolveComponentEnhancers(e){let t=this._rootBuilder.resolveComponentEnhancers();const n=this._componentIndex[e.type];if(n){t=new Map(t);for(const[e,r]of n.resolveComponentEnhancers())t.set(e,r)}return t}};function getComponentJsonPointer(e){const t=[];for(let n=e.length-1;n>=0;n--){const r=e[n],i=e[n+1];if("type"in r&&"slot"!==r.type){if("block"===r.type){const{fieldName:e,blockIndexFn:n}=r,o=n();if(e&&void 0!==o){const n=getNounForLocation(i);t.push(`${n}/${e}/value/${o}`)}}continue}const o=r.parentSlotIndexFn(),{parentSlot:s}=r;s&&void 0!==o&&t.push(`slots/${s}/${o}`)}return`/${t.join("/")}`}function getNounForLocation(e){let t="parameters";return e&&"type"in e&&("block"===e.type||isRootEntryReference(e))&&(t="fields"),t}function getNounForNode(e){let t="parameters";return isEntryData(e)&&(t="fields"),t}function findParameterInNodeTree(e,t){const n=[];return walkNodeTree(e,({node:e,ancestorsAndSelf:r})=>{const i=getPropertiesValue(e);i&&Object.entries(i).filter(([n,r])=>t(r,n,e)).forEach(([t,i])=>{n.push({key:t,pointer:(1===r.length?"":getComponentJsonPointer(r))+`/${getNounForNode(e)}/${t}`,parameter:i})})}),n}var bindExpressionPrefix="#",bindExpressionEscapeChars=new Set(["#","\\","[","]",":"]);function convertToBindExpression(e){if("jptr"===e.syntax){const t=[`${bindExpressionPrefix}${e.syntax}:${escapeNestedVariableExpressions(escapeBindExpressionReservedChars(e.pointer))}`];return e.failureAction&&"t"!==e.failureAction&&t.push(`fa=${e.failureAction}`),e.failureLogLevel&&"w"!==e.failureLogLevel&&t.push(`fl=${e.failureLogLevel}`),e.failureDefault&&t.push(`fd=${escapeBindExpressionDefaultValue(e.failureDefault)}`),t.join(":")}throw new Error(`Unsupported dynamic token binding syntax '${e.syntax}'`)}function escapeNestedVariableExpressions(e){return e.replace(/\$\{([^}]+)\}/g,"$[$1]")}function escapeBindExpressionReservedChars(e){return e.split("").map(e=>bindExpressionEscapeChars.has(e)?`\\${":"===e?";":e}`:e).join("")}function escapeBindExpressionDefaultValue(e){return escapeBindExpressionReservedChars(e).replace("=","\\+")}function createVariableReference(e){return`\${${e.replace(/([${}])/g,"\\$1")}}`}function getEffectivePropertyValue({property:e,conditionIndex:t,locale:n,strict:r,greedyLocaleMatching:i}){var o,s,a,l;if(!e)return;let c=e.value;if(t>=0){const n=null==(s=null==(o=e.conditions)?void 0:o[t])?void 0:s.value;if(null===n)return;(void 0!==n||r)&&(c=n)}if(n){const o=getLocaleMatch(e.locales,n,i);if((void 0!==o||r)&&(c=o),t>=0){const o=null==(l=null==(a=getLocaleMatch(e.localesConditions,n,i))?void 0:a[t])?void 0:l.value;if(null===o)return;(void 0!==o||r)&&(c=o)}}return e.connectedData&&(c=createVariableReference(convertToBindExpression(e.connectedData))),c}function getLocaleMatch(e,t,n){if(!e)return;const r=e[t];return void 0===r&&n?Object.values(e).find(e=>void 0!==e):r}function evaluateVisibilityCriteriaGroup(e){const{criteriaGroup:t,simplifyCriteria:n}=e,r=!("&"===t.op||!t.op);let i=!1;for(let o=t.clauses.length-1;o>=0;o--){const s=evaluateCriterion(t.clauses[o],e);if(null===s)i=!0;else{if(s===r)return r;null!==s&&n&&t.clauses.splice(o,1)}}return i?null:!r}function evaluateCriterion(e,t){var n;if("clauses"in e)return evaluateVisibilityCriteriaGroup({...t,criteriaGroup:e});const r=null!=(n=e.source)?n:e.rule,i=Array.isArray(e.value)?e.value:void 0!==e.value?[e.value]:void 0;if("string"==typeof r&&hasReferencedVariables(r)>0||(null==i?void 0:i.some(e=>"string"==typeof e&&hasReferencedVariables(e)>0)))return null;const o=t.rules[e.rule];return o?o(e):null}function evaluateNodeVisibilityParameter({parameter:e,...t}){if(null==e?void 0:e.explicitlyHidden)return!1;if(!(null==e?void 0:e.criteria))return!0;return evaluateVisibilityCriteriaGroup({...t,criteriaGroup:e.criteria})}function evaluatePropertyCriteria({baseValue:e,conditionalValues:t,keepIndeterminate:n,...r}){let i=!0;const o={currentValue:e,remainingConditionalValues:r.simplifyCriteria&&t?[...t]:t,currentConditionIndex:-1};if(!t)return o;const s=[];for(let e=0;e<t.length;e++){const a=t[e];if(o.matched){s.push(e);continue}const l=evaluateVisibilityCriteriaGroup({...r,criteriaGroup:a.when});null===l?n?i=!1:s.push(e):!0===l?(o.matched=a,o.currentValue=a.value,o.currentConditionIndex=e,s.push(e)):s.push(e)}if(r.simplifyCriteria)for(let e=s.length-1;e>=0;e--)o.remainingConditionalValues.splice(s[e],1);return i&&(o.remainingConditionalValues=void 0),o}var CANVAS_VIZ_CONTROL_PARAM="$viz";function evaluateNodeVisibility({node:e,...t}){var n;const r=getPropertiesValue(e),i=null==(n=null==r?void 0:r[CANVAS_VIZ_CONTROL_PARAM])?void 0:n.value,o=evaluateNodeVisibilityParameter({...t,parameter:i});return(null==i?void 0:i.criteria)&&0===i.criteria.clauses.length&&t.simplifyCriteria&&(null==r||delete r[CANVAS_VIZ_CONTROL_PARAM]),o}function evaluateWalkTreeNodeVisibility({rules:e,showIndeterminate:t,rootNodeInvisibleHandling:n="throw",context:r}){const{type:i,node:o,actions:s,ancestorsAndSelf:a}=r;if("component"!==i)return!0;const l=evaluateNodeVisibility({node:o,rules:e,simplifyCriteria:!0});return!(null===l&&!t||!1===l)||(1===a.length&&"ignore"===n||s.remove(),!1)}function evaluateWalkTreePropertyCriteria({rules:e,node:t,keepIndeterminate:n}){const r=getPropertiesValue(t);r&&Object.entries(r).forEach(([t,i])=>{var o,s,a;if(i.locales||i.localesConditions){[...Object.keys(null!=(o=i.locales)?o:{}),...Object.keys(null!=(s=i.localesConditions)?s:{})].forEach(t=>{var r,o,s,a;const{currentValue:l,remainingConditionalValues:c}=evaluatePropertyCriteria({baseValue:null==(r=i.locales)?void 0:r[t],conditionalValues:null==(o=i.localesConditions)?void 0:o[t],rules:e,simplifyCriteria:!0,keepIndeterminate:n});null==l?null==(s=i.locales)||delete s[t]:(null!=i.locales||(i.locales={}),i.locales[t]=l),(null==c?void 0:c.length)?(null!=i.localesConditions||(i.localesConditions={}),i.localesConditions[t]=c):null==(a=i.localesConditions)||delete a[t]}),Object.keys(null!=(a=i.localesConditions)?a:{}).length||delete i.localesConditions,i.locales||i.localesConditions||delete r[t]}else{const{currentValue:o,remainingConditionalValues:s}=evaluatePropertyCriteria({baseValue:i.value,conditionalValues:i.conditions,rules:e,simplifyCriteria:!0,keepIndeterminate:n});null===o?delete r[t]:void 0!==o?i.value=o:delete i.value,void 0===s?delete i.conditions:i.conditions=s}})}var isEvaluator=(e,t)=>Array.isArray(e)?e.includes(t):e===t,containsEvaluator=(e,t)=>Array.isArray(e)?e.some(e=>t.includes(e)):t.includes(e),startsWithEvaluator=(e,t)=>Array.isArray(e)?e.some(e=>t.startsWith(e)):t.startsWith(e),endsWithEvaluator=(e,t)=>Array.isArray(e)?e.some(e=>t.endsWith(e)):t.endsWith(e),emptyEvaluator=(e,t)=>""===t,stringOperatorEvaluators={is:isEvaluator,has:containsEvaluator,startswith:startsWithEvaluator,endswith:endsWithEvaluator,empty:emptyEvaluator},numericOperatorEvaluators={gt:(e,t)=>e>t,lt:(e,t)=>e<t};function evaluateNumericOperator(e,t){const{op:n,value:r}=e,i=numericOperatorEvaluators[n];if(!i)return null;if("string"==typeof t&&""===t.trim()||"string"==typeof r&&""===r.trim())return!1;const o=Number(t),s=Number(r);return!isNaN(o)&&!isNaN(s)&&i(o,s)}function evaluateStringMatch(e,t,n){const{op:r,value:i}=e;if(n&&!n.has(r))return null;if(r in numericOperatorEvaluators)return evaluateNumericOperator(e,t);let o=r;const s=r.startsWith("!");s&&(o=o.slice(1));const a=stringOperatorEvaluators[o];if(!a)return null;const l=a(i,t);return s?!l:l}var dynamicInputVisibilityOperators=new Set(["is","!is","has","!has","startswith","!startswith","endswith","!endswith","empty","!empty"]),CANVAS_VIZ_DI_RULE="$di";function createDynamicInputVisibilityRule(e){return{[CANVAS_VIZ_DI_RULE]:t=>{const{source:n}=t,r=n?e[n]:void 0;return evaluateStringMatch(t,null!=r?r:"",dynamicInputVisibilityOperators)}}}var dynamicTokenVisibilityOperators=new Set(["is","!is","has","!has","startswith","!startswith","endswith","!endswith","empty","!empty","gt","lt"]),CANVAS_VIZ_DYNAMIC_TOKEN_RULE="$dt";function toStringValue(e){return"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):""}function toStringCriteriaValue(e){return Array.isArray(e)?e.map(e=>toStringValue(e)):toStringValue(e)}function isUnbound(e){return null==e||"string"==typeof e&&hasReferencedVariables(e)>0}function createDynamicTokenVisibilityRule(){return{[CANVAS_VIZ_DYNAMIC_TOKEN_RULE]:e=>{const{source:t,value:n}=e;if(isUnbound(t))return null;const r=toStringValue(t),i=toStringCriteriaValue(n);return evaluateStringMatch({...e,value:i},r,dynamicTokenVisibilityOperators)}}}var localeVisibilityOperators=new Set(["is","!is"]),CANVAS_VIZ_LOCALE_RULE="$locale";function createLocaleVisibilityRule(e){return{[CANVAS_VIZ_LOCALE_RULE]:t=>!!e&&evaluateStringMatch(t,e,localeVisibilityOperators)}}var quirksVisibilityOperators=new Set(["is","!is","has","!has","startswith","!startswith","endswith","!endswith","empty","!empty"]),CANVAS_VIZ_QUIRKS_RULE="$qk";function createQuirksVisibilityRule(e){return{[CANVAS_VIZ_QUIRKS_RULE]:t=>{const{source:n}=t,r=n?e[n]:void 0;return evaluateStringMatch(t,null!=r?r:"",quirksVisibilityOperators)}}}function extractLocales({component:e}){var t;const n={},r=null==(t=e.slots)?void 0:t[CANVAS_LOCALIZATION_SLOT];return null==r||r.forEach(e=>{var t;const r=null==(t=e.parameters)?void 0:t[CANVAS_LOCALE_TAG_PARAM];(null==r?void 0:r.value)&&"string"==typeof r.value&&(n[r.value]=n[r.value]||[],n[r.value].push(e))}),n}function localize(e){const{nodes:t,locale:n,keepLocalesFor:r}=e;if(!n)return;const i=createLocaleVisibilityRule(n);walkNodeTree(t,e=>{const{type:t,node:o,actions:s}=e;if("component"!==t)return void localizeProperties(o,n,i,r);if(evaluateWalkTreeNodeVisibility({context:e,rules:i,showIndeterminate:!0,rootNodeInvisibleHandling:"ignore"}))if(o.type===CANVAS_LOCALIZATION_TYPE){const e=extractLocales({component:o});let t;if(n&&(t=e[n]),null==t?void 0:t.length){t.forEach(e=>{removeLocaleProperty(e),localizeProperties(e,n,i,r)});const[e,...o]=t;s.replace(e),o.length&&s.insertAfter(o)}else s.remove()}else localizeProperties(o,n,i,r)})}function removeLocaleProperty(e){const t=getPropertiesValue(e);(null==t?void 0:t[CANVAS_LOCALE_TAG_PARAM])&&delete t[CANVAS_LOCALE_TAG_PARAM],t&&0===Object.keys(t).length&&("fields"in e&&delete e.fields,"parameters"in e&&delete e.parameters)}function localizeProperties(e,t,n,r){const i=getPropertiesValue(e);i&&(Object.entries(i).forEach(([e,n])=>{var o,s;t||(delete n.locales,delete n.localesConditions);const a=t?null==(o=n.locales)?void 0:o[t]:void 0;void 0!==a&&(n.value=a);const l=t?null==(s=n.localesConditions)?void 0:s[t]:void 0;void 0!==l&&(n.conditions=l);const c=!0===(null==r?void 0:r(e));if(c||(delete n.locales,delete n.localesConditions),void 0===n.value&&void 0===n.conditions){c&&(n.locales||n.localesConditions)||delete i[e]}}),evaluateWalkTreePropertyCriteria({node:e,rules:n,keepIndeterminate:!0}))}var UniqueBatchEntries=class{constructor(e,t){this.groups=e.reduce((e,n)=>{var r;const i=t(n.args);return e[i]=null!=(r=e[i])?r:[],e[i].push(n),e},{})}resolveKey(e,t){this.groups[e].forEach(e=>e.resolve(t))}resolveRemaining(e){Object.keys(this.groups).forEach(t=>{this.groups[t].forEach(t=>{t.isCompleted||t.resolve(e)})})}};function walkPropertyValues(e,t){var n,r;[void 0,...new Set([...Object.keys(null!=(n=e.locales)?n:{}),...Object.keys(null!=(r=e.localesConditions)?r:{})])].forEach(n=>{var r,i;for(let o=(null!=(i=void 0===n?e.conditions:null==(r=e.localesConditions)?void 0:r[n])?i:[]).length-1;o>=-1;o--){const r=getEffectivePropertyValue({property:e,locale:n,conditionIndex:o,strict:!0});t({locale:n,conditionIndex:o,value:r})}})}var _baseUrl,import_api7=require("@uniformdev/context/api"),releaseContentsUrl="/api/v1/entity-releases",EntityReleasesClient=class extends import_api7.ApiClient{constructor(e){super(e)}async get(e){const{projectId:t}=this.options,n=this.createUrl(releaseContentsUrl,{...e,projectId:t});return await this.apiClient(n)}},import_api8=require("@uniformdev/context/api"),_IntegrationPropertyEditorsClient=class e extends import_api8.ApiClient{constructor(e){super(e),this.teamId=e.teamId}get(t){const n=this.createUrl(__privateGet(e,_baseUrl),{...t,teamId:this.teamId});return this.apiClient(n)}async deploy(t){const n=this.createUrl(__privateGet(e,_baseUrl));await this.apiClient(n,{method:"PUT",body:JSON.stringify({...t,teamId:this.teamId}),expectNoContent:!0})}async delete(t){const n=this.createUrl(__privateGet(e,_baseUrl));await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...t,teamId:this.teamId}),expectNoContent:!0})}};__privateAdd(_IntegrationPropertyEditorsClient,_baseUrl=new WeakMap,"/api/v1/integration-property-editors");var _url2,_projectsUrl,IntegrationPropertyEditorsClient=_IntegrationPropertyEditorsClient,import_api9=require("@uniformdev/context/api"),LABELS_URL="/api/v1/labels",LabelClient=class extends import_api9.ApiClient{async getLabels(e){const{projectId:t}=this.options,n=this.createUrl(LABELS_URL,{...e,projectId:t});return await this.apiClient(n)}async upsertLabel(e){const{projectId:t}=this.options,n=this.createUrl(LABELS_URL);await this.apiClient(n,{method:"PUT",body:JSON.stringify({...e,projectId:t}),expectNoContent:!0})}async removeLabel(e){const{projectId:t}=this.options,n=this.createUrl(LABELS_URL);await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...e,projectId:t}),expectNoContent:!0})}},UncachedLabelClient=class extends LabelClient{constructor(e){super({...e,bypassCache:!0})}},import_api10=require("@uniformdev/context/api"),localesUrl="/api/v1/locales",LocaleClient=class extends import_api10.ApiClient{constructor(e){super(e)}async get(e){const{projectId:t}=this.options,n=this.createUrl(localesUrl,{...e,projectId:t});return await this.apiClient(n)}async upsert(e){const t=this.createUrl(localesUrl);await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){const t=this.createUrl(localesUrl);await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},generateHash=({composition:e,secret:t})=>{if(!t)return;const n=`${JSON.stringify(e)}-${t}`;let r=0;for(let e=0;e<n.length;e++){r=(r<<5)-r+n.charCodeAt(e),r|=0}return r},isSelectComponentMessage=e=>"select-component"===e.type&&void 0!==e.id,isReadyMessage=e=>"ready"===e.type,isSessionPendingMessage=e=>"session-pending"===e.type,isAwaitingReadyMessage=e=>"awaiting-ready"===e.type,isComponentActionMessage=e=>"trigger-component-action"===e.type,isUpdateCompositionMessage=e=>"update-composition"===e.type,isUpdateCompositionInternalMessage=e=>"update-composition-internal"===e.type,isAddComponentMessage=e=>"add-component"===e.type,isMovingComponentMessage=e=>"move-component"===e.type,isUpdateComponentParameterMessage=e=>"update-component-parameter"===e.type,isDismissPlaceholderMessage=e=>"dismiss-placeholder"===e.type,isTriggerCompositionActionMessage=e=>"trigger-composition-action"===e.type,isUpdatePreviewSettingsMessage=e=>"update-preview-settings"===e.type,isUpdateFeatureFlagsMessage=e=>"update-feature-flags"===e.type,isUpdateAiActionsMessage=e=>"update-ai-actions"===e.type,isUpdateContextualEditingStateInternalMessage=e=>"update-contextual-editing-state-internal"===e.type,isReportRenderedCompositionsMessage=e=>"report-rendered-compositions"===e.type,isSelectParameterMessage=e=>"select-parameter"===e.type,isOpenParameterEditorMessage=e=>"open-parameter-editor"===e.type,isUpdateComponentReferencesMessage=e=>"update-component-references"===e.type,isRequestComponentSuggestionMessage=e=>"request-component-suggestion"===e.type,isSuggestComponentMessage=e=>"suggest-component"===e.type,isContextStorageUpdatedMessage=e=>"context-storage-command-executed"===e.type,createCanvasChannel=({listenTo:e,broadcastTo:t})=>{let n=0;const r={},i=[...t],o=e=>{i.forEach(t=>null==t?void 0:t.postMessage(JSON.stringify(e),"*"));for(const t in r){const n=r[t];n.types.includes(e.type)&&n.handler(e,new MessageEvent(e.type))}},s=e=>{if("string"!=typeof e.data)return;let t=null;try{const n=JSON.parse(e.data);Object.hasOwn(n,"type")&&(t=n)}catch(e){}if(t)for(const n in r){const i=r[n];i.types.includes(t.type)&&i.handler(t,e)}};e.forEach(e=>e.addEventListener("message",s));return{broadcastTo:i,ready:e=>{var t,n,r;if("undefined"==typeof window)return;const i=null==(t=window.__UNIFORM_CONTEXTUAL_EDITING__)?void 0:t.framework,s=null==(n=window.__UNIFORM_CONTEXTUAL_EDITING__)?void 0:n.version,a=null==(r=window.__UNIFORM_CONTEXTUAL_EDITING__)?void 0:r.canvasPackageVersion,l={type:"ready",framework:i,version:s,rsc:null==e?void 0:e.rsc,canvasPackageVersion:a};o(l)},sessionPending:()=>{o({type:"session-pending"})},awaitingReady:()=>{o({type:"awaiting-ready"})},destroy:()=>{e.forEach(e=>e.removeEventListener("message",s))},addBroadcastTarget:e=>{i.includes(e)||i.push(e)},triggerComponentAction:e=>{const t={...e,type:"trigger-component-action"};o(t)},selectComponent:e=>{o({type:"select-component",id:e})},updateComposition:(e,t)=>{const n={type:"update-composition",composition:e,hash:generateHash({composition:e,secret:t}),eventTimestamp:Date.now()};o(n)},updateCompositionInternal:(e,t,n)=>{const r={type:"update-composition-internal",composition:e,hash:t,eventTimestamp:null!=n?n:Date.now()};o(r)},on:(e,t)=>{const i=++n;return r[i]={types:Array.isArray(e)?e:[e],handler:t},()=>{delete r[i]}},addComponent:e=>{const t={...e,type:"add-component"};o(t)},moveComponent:e=>{const t={...e,type:"move-component"};o(t)},updateComponentParameter:e=>{const t={...e,type:"update-component-parameter"};o(t)},dismissPlaceholder:e=>{const t={...e,type:"dismiss-placeholder"};o(t)},triggerCompositionAction:e=>{const t={...e,type:"trigger-composition-action"};o(t)},updatePreviewSettings:e=>{const t={...e,type:"update-preview-settings"};o(t)},updateFeatureFlags:e=>{const t={...e,type:"update-feature-flags"};o(t)},updateAiActions:e=>{const t={...e,type:"update-ai-actions"};o(t)},updateContextualEditingStateInternal:e=>{const t={...e,type:"update-contextual-editing-state-internal"};o(t)},selectParameter:e=>{const t={...e,type:"select-parameter"};o(t)},openParameterEditor:e=>{const t={...e,type:"open-parameter-editor"};o(t)},reportRenderedCompositions:e=>{const t={...e,type:"report-rendered-compositions"};o(t)},editorStateUpdated:()=>{o({type:"editor-state-updated"})},updateComponentReferences:e=>{const t={...e,type:"update-component-references"};o(t)},requestComponentSuggestion:e=>{const t={...e,type:"request-component-suggestion"};o(t)},suggestComponent:e=>{const t={...e,type:"suggest-component"};o(t)},requestPageHtml:e=>{const t={...e,type:"request-page-html"};o(t)},sendPageHtml:e=>{const t={...e,type:"send-page-html"};o(t)},contextStorageUpdated:e=>{const t={...e,type:"context-storage-command-executed"};o(t)}}},import_api11=require("@uniformdev/context/api"),previewUrlsUrl="/api/v1/preview-urls",previewViewportsUrl="/api/v1/preview-viewports",PreviewClient=class extends import_api11.ApiClient{constructor(e){super(e)}async getPreviewUrl({id:e}){var t;return null!=(t=(await this.getPreviewUrls({id:e})).previewUrls[0])?t:null}async getPreviewUrls(e){const{projectId:t}=this.options,n=this.createUrl(previewUrlsUrl,{...e,projectId:t});return await this.apiClient(n)}async upsertPreviewUrl(e){const t=this.createUrl(previewUrlsUrl);return await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId})})}async deletePreviewUrl(e){const t=this.createUrl(previewUrlsUrl);return await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId})})}async getPreviewViewport({id:e}){var t;return null!=(t=(await this.getPreviewViewports({id:e})).previewViewports[0])?t:null}async getPreviewViewports(e){const{projectId:t}=this.options,n=this.createUrl(previewViewportsUrl,{...e,projectId:t});return await this.apiClient(n)}async upsertPreviewViewport(e){const t=this.createUrl(previewViewportsUrl);return await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId})})}async deletePreviewViewport(e){const t=this.createUrl(previewViewportsUrl);return await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId})})}},import_api12=require("@uniformdev/context/api"),_ProjectClient=class e extends import_api12.ApiClient{constructor(e){super({...e,bypassCache:!0})}async get(t){const n=this.createUrl(__privateGet(e,_url2),{...t});return await this.apiClient(n)}async getProjects(t){const n=this.createUrl(__privateGet(e,_projectsUrl),t?{...t}:{});return await this.apiClient(n)}async upsert(t){const n=this.createUrl(__privateGet(e,_url2));return await this.apiClient(n,{method:"PUT",body:JSON.stringify({...t})})}async delete(t){const n=this.createUrl(__privateGet(e,_url2));await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...t}),expectNoContent:!0})}};_url2=new WeakMap,_projectsUrl=new WeakMap,__privateAdd(_ProjectClient,_url2,"/api/v1/project"),__privateAdd(_ProjectClient,_projectsUrl,"/api/v1/projects");var ProjectClient=_ProjectClient,DISALLOWED_PATTERN_CHARS=/[,&=?#[\]\s]/,REGEX_METACHAR=/[\\^$.|?*+()[\]{}]/g;function isValidProjectionPattern(e){return"string"==typeof e&&0!==e.length&&!DISALLOWED_PATTERN_CHARS.test(e)}function compilePattern(e){let t="^";for(const n of e)t+="*"===n?".*":n.replace(REGEX_METACHAR,"\\$&");return t+="$",new RegExp(t)}var PATTERN_CACHE_MAX=1024,patternRegexCache=new Map;function matchesProjectionPattern(e,t){let n=patternRegexCache.get(e);if(void 0===n){if(!isValidProjectionPattern(e))throw new Error(`Invalid projection pattern: ${JSON.stringify(e)}`);if(n=compilePattern(e),patternRegexCache.size>=PATTERN_CACHE_MAX){const e=patternRegexCache.keys().next().value;void 0!==e&&patternRegexCache.delete(e)}patternRegexCache.set(e,n)}return n.test(t)}var TOP_LEVEL_OPERATOR_KEY=/^(fields|fieldTypes|slots)\[([A-Za-z]+)\]$/,SLOTS_NAMED_KEY=/^slots\.([A-Za-z0-9_-]+)\[([A-Za-z]+)\]$/;function toStringValue2(e){return Array.isArray(e)?e.join(","):e}function parseCsv(e){const t=toStringValue2(e);return t?t.split(",").map(e=>e.trim()).filter(e=>e.length>0):[]}function parseDepth(e,t){const n=toStringValue2(e);if(void 0===n||""===n)throw new Error(`Invalid select projection: '${t}' requires a non-negative integer value`);if(!/^\d+$/.test(n))throw new Error(`Invalid select projection: '${t}' must be a non-negative integer (got ${JSON.stringify(n)})`);return Number(n)}function parseBlockDepth(e,t){const n=toStringValue2(e);if("preserveAll"===n)return"preserveAll";if(void 0===n||""===n||!/^\d+$/.test(n))throw new Error(`Invalid select projection: '${t}' must be a non-negative integer or 'preserveAll' (got ${JSON.stringify(n)})`);return Number(n)}function extractSelectKeys(e){if(e instanceof URLSearchParams){let t;for(const[n,r]of e.entries())n.startsWith(SELECT_QUERY_PREFIX)&&(null!=t||(t={}),t[n]=void 0===t[n]?r:`${t[n]},${r}`);return t}let t;for(const n in e)n.startsWith(SELECT_QUERY_PREFIX)&&(null!=t||(t={}),t[n]=e[n]);return t}function queryToProjection(e){var t,n,r,i,o;if(!e)return;const s=extractSelectKeys(e);if(!s)return;const a={};for(const[e,l]of Object.entries(s)){const s=e.slice(SELECT_QUERY_PREFIX.length),c=SLOTS_NAMED_KEY.exec(s);if(c){const[,r,i]=c;if("depth"!==i)throw new Error(`Invalid select projection: unsupported operator '${i}' for slots.${r}`);const o=null!=(t=a.slots)?t:a.slots={},s=null!=(n=o.named)?n:o.named={};s[r]={...s[r],depth:parseDepth(l,e)};continue}const p=TOP_LEVEL_OPERATOR_KEY.exec(s);if(!p)throw new Error(`Invalid select projection key: ${JSON.stringify(e)}`);const[,d,u]=p;if("fields"===d){const t=null!=(r=a.fields)?r:a.fields={};switch(u){case"only":t.only=parseCsv(l);break;case"except":t.except=parseCsv(l);break;case"locales":t.locales=parseCsv(l);break;case"blockDepth":t.blockDepth=parseBlockDepth(l,e);break;default:throw new Error(`Invalid select projection: unsupported operator 'fields[${u}]'`)}}else if("fieldTypes"===d){const e=null!=(i=a.fieldTypes)?i:a.fieldTypes={};switch(u){case"only":e.only=parseCsv(l);break;case"except":e.except=parseCsv(l);break;default:throw new Error(`Invalid select projection: unsupported operator 'fieldTypes[${u}]'`)}}else{if("slots"!==d)throw new Error(`Invalid select projection key: ${JSON.stringify(e)}`);{const t=null!=(o=a.slots)?o:a.slots={};switch(u){case"only":t.only=parseCsv(l);break;case"except":t.except=parseCsv(l);break;case"depth":t.depth=parseDepth(l,e);break;default:throw new Error(`Invalid select projection: unsupported operator 'slots[${u}]'`)}}}}return a}var import_api13=require("@uniformdev/context/api"),PromptsUrl="/api/v1/prompts",PromptClient=class extends import_api13.ApiClient{constructor(e){super(e)}async get(e){const{projectId:t}=this.options,n=this.createUrl(PromptsUrl,{...e,projectId:t});return await this.apiClient(n)}async upsert(e){const t=this.createUrl(PromptsUrl);await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){const t=this.createUrl(PromptsUrl);await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},import_api14=require("@uniformdev/context/api"),RELATIONSHIPS_URL="/api/v1/relationships",RelationshipClient=class extends import_api14.ApiClient{constructor(e){super(e),this.get=async e=>{const{projectId:t}=this.options,n=this.createUrl(RELATIONSHIPS_URL,{...e,projectId:t});return this.apiClient(n)}}},import_api15=require("@uniformdev/context/api"),releasesUrl="/api/v1/releases",ReleaseClient=class extends import_api15.ApiClient{constructor(e){super(e)}async get(e){const{projectId:t}=this.options,n=this.createUrl(releasesUrl,{...e,projectId:t});return await this.apiClient(n)}async upsert(e){const t=this.createUrl(releasesUrl);await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){const t=this.createUrl(releasesUrl);await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async ready(e){const t=this.createUrl(releasesUrl);await this.apiClient(t,{method:"PATCH",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},import_api16=require("@uniformdev/context/api"),releaseContentsUrl2="/api/v1/release-contents",ReleaseContentsClient=class extends import_api16.ApiClient{constructor(e){super(e)}async get(e){const{projectId:t}=this.options,n=this.createUrl(releaseContentsUrl2,{...e,projectId:t});return await this.apiClient(n)}async remove(e){const t=this.createUrl(releaseContentsUrl2);await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},import_api17=require("@uniformdev/context/api"),ROUTE_URL="/api/v1/route",RouteClient=class extends import_api17.ApiClient{constructor(e){var t;e.limitPolicy||(e.limitPolicy=createLimitPolicy({})),super(e),this.edgeApiHost=null!=(t=e.edgeApiHost)?t:"https://uniform.global"}async getRoute(e){const{projectId:t}=this.options,{select:n,...r}=null!=e?e:{},i=projectionToQuery(n),o=this.createUrl(ROUTE_URL,{...r,projectId:t,...i},this.edgeApiHost);return await this.apiClient(o,this.options.disableSWR?{headers:{"x-disable-swr":"true"}}:void 0)}},LOCALE_DYNAMIC_INPUT_NAME="locale",mergeAssetConfigWithDefaults=e=>{var t;return{...e,allowedTypes:null!=(t=e.allowedTypes)?t:["image"]}};function autoFixParameterGroups(e){var t;const n=null!=(t=e.filter(e=>"group"===e.type))?t:[];if(0===n.length)return!1;let r=!1;for(;n.length>0;){const t=n.shift(),i=t.typeConfig&&"object"==typeof t.typeConfig&&"childrenParams"in t.typeConfig&&Array.isArray(t.typeConfig.childrenParams)?t.typeConfig.childrenParams:[],o=new Set(i),s=e.findIndex(e=>e.id===t.id),a=o.size;for(let t=s+1;t<=s+a;t++){const n=e[t];if(n){if(!o.has(n.id))break;o.delete(n.id)}}if(o.size>0){const t=Array.from(o);let n=s+a-o.size;for(const r of t){const t=e.findIndex(e=>e.id===r);if(-1!==t){const[r]=e.splice(t,1);t>n&&n++,e.splice(n,0,r)}else i.splice(i.indexOf(r),1)}r=!0}}return r}var createUniformApiEnhancer=({apiUrl:e})=>async t=>{const n=await fetch(e,{method:"post",body:JSON.stringify({composition:t.composition,hash:t.hash}),headers:{"Content-Type":"application/json"}}),r=await n.json();if(!n.ok)throw new Error("Error reading enhanced composition");return r.composition};function convertEntryToPutEntry(e){return{entry:{type:e.entry.type,_dataResources:e.entry._dataResources,_id:e.entry._id,_name:e.entry._name,_slug:e.entry._slug,_pattern:e.entry._pattern,_overridability:e.entry._overridability,_overrides:e.entry._overrides,fields:e.entry.fields,_locales:e.entry._locales,_thumbnail:e.entry._thumbnail,_patternDataResources:e.entry._patternDataResources},pattern:e.pattern,state:e.state,projectId:e.projectId,releaseId:e.releaseId,workflowId:e.workflowId,workflowStageId:e.workflowStageId,editionId:e.editionId,editionName:e.editionName,editionPriority:e.editionPriority}}var getDataSourceVariantFromRouteGetParams=(e,t)=>{var n,r;return"dataSourceVariant"in e?e.dataSourceVariant:(null!=(r=null!=(n=null==e?void 0:e.state)?n:t)?r:CANVAS_PUBLISHED_STATE)!==CANVAS_PUBLISHED_STATE?"unpublished":void 0},ATTRIBUTE_COMPONENT_ID="data-uniform-component-id",ATTRIBUTE_PARAMETER_ID="data-uniform-parameter-id",ATTRIBUTE_PARAMETER_VALUE="data-uniform-parameter-value",ATTRIBUTE_PARAMETER_TYPE="data-uniform-parameter-type",ATTRIBUTE_PLACEHOLDER="data-uniform-placeholder",ATTRIBUTE_MULTILINE="data-uniform-is-multiline",getParameterAttributes=({id:e,component:t,placeholder:n,isMultiline:r=!1})=>{var i,o,s;const a=null==t?void 0:t._id,l=null==(i=null==t?void 0:t.parameters)?void 0:i[e],c=null==l?void 0:l.value,p=null==l?void 0:l.type,d=null!=(s=null==(o=null==l?void 0:l._contextualEditing)?void 0:o.isEditable)&&s;return{[ATTRIBUTE_COMPONENT_ID]:a,[ATTRIBUTE_PARAMETER_ID]:e,[ATTRIBUTE_PARAMETER_VALUE]:String(null!=c?c:""),[ATTRIBUTE_PARAMETER_TYPE]:p,[ATTRIBUTE_PLACEHOLDER]:n,[ATTRIBUTE_MULTILINE]:r,contentEditable:d}},isAllowedReferrer=e=>Boolean(null==e?void 0:e.match(/(^https:\/\/|\.)(uniform.app|uniform.wtf|uniformcode.ai|localhost:\d{4})\//)),isSystemComponentDefinition=e=>e.startsWith("$");function mapSlotToPersonalizedVariations(e){return e?e.map((e,t)=>{var n,r;const i=null==(r=null==(n=e.parameters)?void 0:n[CANVAS_PERSONALIZATION_PARAM])?void 0:r.value,o=(null==i?void 0:i.name)||`pz-${t}-${e.type}`;return{...e,id:o,pz:i}}):[]}function mapSlotToTestVariations(e){return e?e.map((e,t)=>{var n,r,i;const o=null==(r=null==(n=e.parameters)?void 0:n[CANVAS_TEST_VARIANT_PARAM])?void 0:r.value,s=null!=(i=null==o?void 0:o.id)?i:"testId"in e?e.testId:`ab-${t}-${e.type}`;return{...e,id:s,testDistribution:null==o?void 0:o.testDistribution,control:null==o?void 0:o.control}}):[]}var SEPARATOR="_",isComponentPlaceholderId=e=>e===PLACEHOLDER_ID||"string"==typeof e&&(null==e?void 0:e.startsWith(PLACEHOLDER_ID)),generateComponentPlaceholderId=(e,t,n)=>{if(1===t)return PLACEHOLDER_ID;let r=[PLACEHOLDER_ID,e];return n&&(r=[...r,n.nodeId,n.slotId]),r.join(SEPARATOR)},parseComponentPlaceholderId=e=>{if(!isComponentPlaceholderId(e))return;const t=e.split(SEPARATOR),n={id:t[1]};return t[2]&&(n.parent={nodeId:t[2],slotId:t[3]}),n};function bindVariables({variables:e,value:t,errorPrefix:n="Variable",handleBinding:r}){let i=0,o=0;const s=[],a=(e,t,r)=>{const i=t[e];return void 0===i?(r.push(`${n} "${e}" is not defined`),""):i},l=[];return parseVariableExpression(t,(t,n)=>{if(o++,"text"===n)return void l.push(t);const c=(null!=r?r:a)(t,e,s);i++,l.push(c)}),{result:1===o?l[0]:l.join(""),boundCount:i,errors:s.length>0?s:void 0}}var import_immer=require("immer");function bindVariablesToObject(e){return bindVariablesToObjectRecursive(e)}function bindVariablesToObjectRecursive({value:e,recursivePath:t,...n}){let r=0;const i=[];if("string"==typeof e)return bindVariables({...n,value:e});if("object"!=typeof e||null===e)return{boundCount:0,result:e};const o=handleRichTextNodeBinding(e,n);if(void 0!==o)return o;const s=((0,import_immer.isDraft)(e)?(e,t)=>(t(e),e):import_immer.produce)(e,e=>{Object.entries(e).forEach(([o,s])=>{const a=t?`${t}.${o}`:o;if("string"==typeof s){const t=bindVariables({...n,value:s});return void((s!==t.result||t.errors)&&(r+=t.boundCount,e[o]=t.result,t.errors&&i.push(...t.errors.map(e=>"string"==typeof e?`${a}: ${e}`:(e.message=`${a}: ${e.message}`,e)))))}const l=bindVariablesToObjectRecursive({...n,value:s,recursivePath:a});(l.boundCount||l.errors)&&(r+=l.boundCount,e[o]=l.result,l.errors&&i.push(...l.errors))})});return{boundCount:r,result:s,errors:i.length>0?i:void 0}}function handleRichTextNodeBinding(e,t){if("type"in e&&"variable"===e.type&&"reference"in e&&"string"==typeof e.reference&&"version"in e&&1===e.version){const n=bindVariables({...t,value:createVariableReference(e.reference)}),r={detail:0,format:0,mode:"normal",style:"",text:n.result,type:"text",version:1};return{...n,result:r}}}var import_api19=require("@uniformdev/context/api"),version="20.74.3",import_api18=require("@uniformdev/context/api"),workflowsUrl="/api/v1/workflows",WorkflowClient=class extends import_api18.ApiClient{constructor(e){super(e)}async get(e){const{projectId:t}=this.options,n=this.createUrl(workflowsUrl,{...e,projectId:t});return await this.apiClient(n)}async upsert(e){const t=this.createUrl(workflowsUrl);await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){const t=this.createUrl(workflowsUrl);await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},CanvasClientError=import_api19.ApiClientError;
//# sourceMappingURL=/sm/92afffec710c19911581c65f758c2e7c6a712e3a253182022f53b1557f8ced56.map