{"version":3,"file":"CMSItemCount.CfrSLiFN.mjs","names":["_Fragment"],"sources":["https:/framer.com/m/CMSLibrary-vH7O.js","https:/framerusercontent.com/modules/gd3dcT3w5rYoRy7ZcKte/sH6FZizM8jJ11j2dQOhQ/Shared.js","https:/framerusercontent.com/modules/IcI9nNOiSa6q1sDwZPZr/N0Hn9j1C4SwwQc3ASo4C/CMSItemCount.js"],"sourcesContent":["/*\n * CMSLibrary\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/PNm0aYRdp2Urx1MCseUn/jWeh7GKvm3RetCKspgqG/CMSLibrary.js\"\n","import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{cloneElement,useMemo,useId}from\"react\";import CurrencySymbols from\"https://framerusercontent.com/modules/pJIZxaEdKo1uS87sS4xM/4PSl3AVmNoISomoZ0s7m/CurrencySymbols.js\";const VERSION=1;export const UPGRADE_LINK=\"https://buy.stripe.com/cN29CT5gi1spb5e9AN\";export var ShopifyDataType;(function(ShopifyDataType){ShopifyDataType[\"Product\"]=\"gid://shopify/Product/\";ShopifyDataType[\"ProductVariant\"]=\"gid://shopify/ProductVariant/\";ShopifyDataType[\"ProductOption\"]=\"gid://shopify/ProductOption/\";})(ShopifyDataType||(ShopifyDataType={}));export const SHOPIFY_ID_ATTRIBUTE=\"frameship-shopify-id\";export const OPEN_CART_EVENT=\"frameship-open-cart\";export const DEFAULT_TRANSITION={type:\"spring\",duration:.2,bounce:0};const CHARACTERS=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";const EMPTY_SHOPIFY_DATA={shopifyId:\"\",tracksInventory:false,variants:[]};const shopifyDataCache={};export function parseShopifyId(id,type){if(typeof id!==\"string\"){return\"\";}if(id.startsWith(type)){return id;}return`${type}${id}`;}export function parseShopifyData(shopifyData){if(!shopifyData){return EMPTY_SHOPIFY_DATA;}const cachedData=shopifyDataCache[shopifyData];if(cachedData){return cachedData;}try{const data=JSON.parse(shopifyData);const parsedData={shopifyId:parseShopifyId(data.id,\"gid://shopify/Product/\"),tracksInventory:data.tracksInventory?true:false,variants:Array.isArray(data.variants)?data.variants.map(variant=>({...variant,id:parseShopifyId(variant.id,\"gid://shopify/ProductVariant/\")})):[]};shopifyDataCache[shopifyData]=parsedData;return parsedData;}catch(error){console.error(\"Error parsing Shopify data:\",error);return EMPTY_SHOPIFY_DATA;}}export const generateInstanceId=()=>{const id=useMemo(()=>{let result=\"\";for(let i=0;i<13;i++){result+=CHARACTERS.charAt(Math.floor(Math.random()*CHARACTERS.length));}return result;},[]);return id;};export const useInstanceId=()=>{const id=useId();const cleanId=id.replace(/:/g,\"\");const instanceId=`superfields-${cleanId}`;return instanceId;};export function styleLayer(layer,style){layer=Array.isArray(layer)?layer[0]:layer;let newLayer=layer;const width=style?.width;const height=style?.height;if(layer&&layer.props&&style&&(width||height)){if(typeof layer.type===\"function\"&&typeof layer.props.children===\"object\"){newLayer=/*#__PURE__*/cloneElement(layer,{children:{...layer.props.children,props:{...layer.props.children.props,style:{...layer.props.children.props.style,...width&&{width},...height&&{height}}}}});}else{newLayer=/*#__PURE__*/cloneElement(layer,{style:{...layer.props.style,...width&&{width},...height&&{height}}});}}return newLayer;}export function Message({title,subtitle}){return /*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",width:\"100%\",height:\"100%\",placeContent:\"center\",placeItems:\"center\",flexDirection:\"column\",gap:16,backgroundColor:\"rgba(136, 85, 255, 0.1)\",borderRadius:6,border:\"1px dashed rgb(136, 85, 255)\",color:\"rgb(136, 85, 255)\",fontSize:16,padding:20,minHeight:200,textWrap:\"balance\"},children:[/*#__PURE__*/_jsx(\"p\",{style:{margin:0,fontWeight:600,textAlign:\"center\"},children:title}),/*#__PURE__*/_jsx(\"p\",{style:{margin:0,opacity:.7,lineHeight:1.5,textAlign:\"center\"},children:subtitle})]});}Message.displayName=\"Frameship/Message\";export function currencyFormatProp({title=\"Format\",startProps={},hidden=null}={}){return{type:ControlType.Object,title,hidden,controls:{...startProps,style:{type:ControlType.Enum,defaultValue:\"symbol\",options:[\"symbol\",\"code\"],optionTitles:[\"Symbol ($)\",\"Code (USD)\"],displaySegmentedControl:true,segmentedControlDirection:\"vertical\"},location:{type:ControlType.Enum,defaultValue:\"after\",options:[\"before\",\"after\"],optionTitles:[\"Before\",\"After\"],displaySegmentedControl:true,hidden:props=>props.style!==\"code\"},decimals:{type:ControlType.Enum,defaultValue:\"auto\",options:[\"auto\",\"always\",\"never\"],optionTitles:[\"Auto\",\"Show (10.00)\",\"Hide (10)\"],displaySegmentedControl:true,segmentedControlDirection:\"vertical\"},formatted:{type:ControlType.Boolean,defaultValue:true},locale:{type:ControlType.String,defaultValue:\"\",placeholder:`Auto (${typeof navigator!==\"undefined\"?navigator.language:\"\"})`,description:\"Formatting examples:\\n*1,000* | *1.000* | *1 000*\",hidden:props=>!props.formatted}}};}export function formatCurrency(amount,currencyCode,options){amount=amount||0;const showDecimals=options.decimals==\"auto\"?amount%1!==0:options.decimals==\"always\";const decimals=showDecimals?2:0;let formattedAmount=\"\";if(options.formatted&&typeof Intl!==\"undefined\"){const locale=options.locale||(typeof navigator!==\"undefined\"?navigator.language:\"en-us\");const formatter=new Intl.NumberFormat(locale,{minimumFractionDigits:decimals,maximumFractionDigits:decimals});formattedAmount=formatter.format(amount);}else{formattedAmount=amount.toFixed(decimals);}if(!currencyCode||currencyCode===\"XXX\"){return formattedAmount;}const symbol=CurrencySymbols[currencyCode];if(options.style===\"code\"){return options.location===\"before\"?`${currencyCode} ${formattedAmount}`:`${formattedAmount} ${currencyCode}`;}else{return`${symbol}${formattedAmount}`;}}export function generateVariantTitle(variant,labelOptions){if(!variant||!Array.isArray(variant.selectedOptions)||!variant.selectedOptions.length||variant.title===\"Default Title\"){return\"\";}if(!labelOptions){return variant.title;}switch(labelOptions.style){case\"default\":return variant.selectedOptions.map(option=>option.value).join(labelOptions.separator);case\"multiline\":return variant.selectedOptions.map(option=>option.name+labelOptions.multilineSeparator+option.value).join(\"\\n\");}return variant.title||\"\";}export function addPropertyControlsFrameship(component,propertyControls,options=null){const shopifyData=options?.shopifyData;addPropertyControls(component,{...shopifyData?{shopifyData:{type:ControlType.String,defaultValue:\"\",placeholder:\"Shopify Data\",preventLocalization:true}}:{},...propertyControls,[`_frameship_version_${VERSION}`]:{type:ControlType.String,title:\" \",defaultValue:\"\",preventLocalization:true,hidden:props=>true}});}\nexport const __FramerMetadata__ = {\"exports\":{\"parseShopifyData\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useInstanceId\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"parseShopifyId\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"formatCurrency\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ShopifyDataType\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"DEFAULT_TRANSITION\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"UPGRADE_LINK\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"generateInstanceId\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"SHOPIFY_ID_ATTRIBUTE\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"addPropertyControlsFrameship\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"generateVariantTitle\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"OPEN_CART_EVENT\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"Message\":{\"type\":\"reactComponent\",\"name\":\"Message\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"currencyFormatProp\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"styleLayer\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Shared.map","// @ts-ignore\nimport{jsx as _jsx,Fragment as _Fragment}from\"react/jsx-runtime\";import{ControlType,useQueryData}from\"framer\";import{getCollectionData}from\"https://framer.com/m/CMSLibrary-vH7O.js\";import{addPropertyControlsFrameship}from\"https://framerusercontent.com/modules/gd3dcT3w5rYoRy7ZcKte/sH6FZizM8jJ11j2dQOhQ/Shared.js\";const DEFAULT_TRANSFORM={mode:\"basic\",prefix:\"Items: \",suffix:\"\",singularPrefix:\"\",singularSuffix:\" item\",pluralPrefix:\"\",pluralSuffix:\" items\"};/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * @framerDisableUnlink\n */export default function CMSItemCount(props){const{textOptions,transform}=props;const Tag=textOptions.tag||\"span\";const collectionList=props.collectionList?.[0];const{query}=getCollectionData(collectionList);return /*#__PURE__*/_jsx(Tag,{\"data-frameship\":true,style:{color:props.color,userSelect:textOptions.userSelect?\"inherit\":\"none\",margin:0,whiteSpace:props.style?.width?undefined:\"nowrap\",textDecoration:textOptions.decoration,fontWeight:400,textAlign:\"center\",...props.font,...props.style},children:query?/*#__PURE__*/_jsx(QueryComponent,{query:query,transform:transform,commas:textOptions.commas}):generateText(0,transform,textOptions.commas)});}CMSItemCount.displayName=\"CMS Item Count\";addPropertyControlsFrameship(CMSItemCount,{collectionList:{type:ControlType.ComponentInstance,description:\"Connect to a collection list outside the page breakpoint.\"},font:{type:\"font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:16,lineHeight:1.4}},color:{type:ControlType.Color,defaultValue:\"#999\"},transform:{type:ControlType.Object,optional:true,defaultValue:DEFAULT_TRANSFORM,controls:{mode:{type:ControlType.Enum,defaultValue:DEFAULT_TRANSFORM.mode,options:[\"basic\",\"plural\"],optionTitles:[\"Basic\",\"Plural\"],displaySegmentedControl:true},prefix:{type:ControlType.String,defaultValue:DEFAULT_TRANSFORM.prefix,hidden:props=>props.mode!==\"basic\"},suffix:{type:ControlType.String,defaultValue:DEFAULT_TRANSFORM.suffix,hidden:props=>props.mode!==\"basic\"},singularPrefix:{type:ControlType.String,defaultValue:DEFAULT_TRANSFORM.singularPrefix,placeholder:\"Singular Prefix\",hidden:props=>props.mode!==\"plural\"},singularSuffix:{type:ControlType.String,defaultValue:DEFAULT_TRANSFORM.singularSuffix,placeholder:\"Singular Suffix\",description:\"Shown when count is 1\",hidden:props=>props.mode!==\"plural\"},pluralPrefix:{type:ControlType.String,defaultValue:DEFAULT_TRANSFORM.pluralPrefix,placeholder:\"Plural Prefix\",hidden:props=>props.mode!==\"plural\"},pluralSuffix:{type:ControlType.String,defaultValue:DEFAULT_TRANSFORM.pluralSuffix,placeholder:\"Plural Suffix\",description:\"Shown when count is not 1\",hidden:props=>props.mode!==\"plural\"}}},textOptions:{type:ControlType.Object,title:\"Options\",controls:{commas:{type:ControlType.Boolean,defaultValue:true,description:\"Yes: *1,000* | No: *1000*\"},decoration:{type:ControlType.Enum,defaultValue:\"none\",options:[\"none\",\"line-through\",\"underline\"],optionTitles:[\"None\",\"Strikethrough\",\"Underline\"]},userSelect:{type:ControlType.Boolean,defaultValue:true},htmlTag:{type:ControlType.Enum,defaultValue:\"p\",options:[\"p\",\"span\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"],title:\"Tag\"}},description:\"This component displays the number of items in a collection list, including filters, offsets and limits.\"}});function QueryComponent({query,transform,commas}){const items=useQueryData(query).length;return /*#__PURE__*/_jsx(_Fragment,{children:generateText(items,transform,commas)});}function generateText(items,transform,commas){let prefix=\"\";let suffix=\"\";if(transform){if(transform.mode===\"plural\"){prefix=items==1?transform.singularPrefix:transform.pluralPrefix;suffix=items==1?transform.singularSuffix:transform.pluralSuffix;}else{prefix=transform.prefix;suffix=transform.suffix;}}return[prefix,formatNumber(items,commas),suffix];}function formatNumber(value,commas){let numberString=value.toFixed(0);if(commas){numberString=numberString.replace(/\\B(?=(\\d{3})+(?!\\d))/g,\",\");}return numberString;}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CMSItemCount\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerDisableUnlink\":\"\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"4QCA4pF,SAAgB,EAAQ,CAAC,QAAM,YAAU,CAAC,OAAoB,EAAM,MAAM,CAAC,MAAM,CAAC,QAAQ,OAAO,MAAM,OAAO,OAAO,OAAO,aAAa,SAAS,WAAW,SAAS,cAAc,SAAS,IAAI,GAAG,gBAAgB,0BAA0B,aAAa,EAAE,OAAO,+BAA+B,MAAM,oBAAoB,SAAS,GAAG,QAAQ,GAAG,UAAU,IAAI,SAAS,UAAU,CAAC,SAAS,CAAc,EAAK,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,IAAI,UAAU,SAAS,CAAC,SAAS,EAAM,CAAC,CAAc,EAAK,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,GAAG,WAAW,IAAI,UAAU,SAAS,CAAC,SAAS,EAAS,CAAC,CAAC,CAAC,CAAC,CAAk1E,SAAgB,EAA6B,EAAU,EAAiB,EAAQ,KAAK,CAAC,IAAM,EAAY,GAAS,YAAY,EAAoB,EAAU,CAAC,GAAG,EAAY,CAAC,YAAY,CAAC,KAAK,EAAY,OAAO,aAAa,GAAG,YAAY,eAAe,oBAAoB,GAAK,CAAC,CAAC,EAAE,CAAC,GAAG,GAAkB,sBAAsB,KAAW,CAAC,KAAK,EAAY,OAAO,MAAM,IAAI,aAAa,GAAG,oBAAoB,GAAK,OAAO,GAAO,GAAK,CAAC,CAAC,0BAA56L,IAAoD,IAA8C,CAAsI,EAAQ,GAAoG,SAAS,EAAgB,CAAC,EAAgB,QAAW,yBAAyB,EAAgB,eAAkB,gCAAgC,EAAgB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