{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/j3C7bfLtfNLDSTKe4iIP/Yscu837xXgKie9eOqm9q/CMSItemCountLabel.js"],
  "sourcesContent": ["import{jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget,// @ts-ignore\nuseQueryData}from\"framer\";import{superfieldsId}from\"https://framerusercontent.com/modules/FZjYlw33eNo8pxLbSFLX/SsR3sa3zv8QyYQXijsM2/SuperfieldsShared.js\";import{getCollectionData}from\"https://framerusercontent.com/modules/PNm0aYRdp2Urx1MCseUn/hHGBHX8s87f6NoAiRVtq/CMSLibrary.js\";import useSuperfieldsStore from\"https://framerusercontent.com/modules/OoGHZMzWDzm2mNN7bmeR/k4C7UfmQGxDkrenxbsZo/Store.js\";import{useState,useEffect}from\"react\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * @framerDisableUnlink\n */export default function CMSItemCountLabel(props){const{superfieldsId,transform}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const collectionList=props.collectionList?.[0];const[initialized,setInitialized]=useState(false);const{query}=getCollectionData(collectionList);const totalItems=useSuperfieldsStore(superfieldsId,state=>state.totalItems);useEffect(()=>{setInitialized(true);},[]);let items=0;// Only display number of CMS items in the preview and live website.\nif(!isCanvas){if(props.type===\"cms\"){if(query){items=useQueryData(query).length;}}else if(initialized){items=totalItems;}}let prefix=\"\";let suffix=\"\";if(transform){if(transform.plural){prefix=items==1?transform.singularPrefix:transform.pluralPrefix;suffix=items==1?transform.singularSuffix:transform.pluralSuffix;}else{prefix=transform.prefix;suffix=transform.suffix;}}return /*#__PURE__*/_jsxs(\"div\",{\"data-superfields\":true,style:{color:props.color,userSelect:props.selectable?\"auto\":\"none\",margin:0,whiteSpace:props.style?.width?undefined:\"nowrap\",...props.font,...props.style},children:[prefix,formatNumber(items,props.commas),suffix]});}CMSItemCountLabel.displayName=\"CMS Item Count Label\";addPropertyControls(CMSItemCountLabel,{type:{type:ControlType.Enum,defaultValue:\"cms\",options:[\"cms\",\"superfields\"],optionTitles:[\"CMS Collection List\",\"Superfields\"],displaySegmentedControl:true,segmentedControlDirection:\"vertical\"},collectionList:{type:ControlType.ComponentInstance,hidden:props=>props.type!==\"cms\"},...superfieldsId({hidden:props=>props.type!==\"superfields\"}),font:{type:\"font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:14,lineHeight:1}},color:{type:ControlType.Color,defaultValue:\"#000\"},commas:{type:ControlType.Boolean,defaultValue:true},transform:{type:ControlType.Object,optional:true,controls:{plural:{type:ControlType.Boolean,defaultValue:false},prefix:{type:ControlType.String,hidden:props=>props.plural},suffix:{type:ControlType.String,hidden:props=>props.plural},singularPrefix:{type:ControlType.String,placeholder:\"Singular Prefix\",hidden:props=>!props.plural},singularSuffix:{type:ControlType.String,placeholder:\"Singular Suffix\",hidden:props=>!props.plural},pluralPrefix:{type:ControlType.String,placeholder:\"Plural Prefix\",hidden:props=>!props.plural},pluralSuffix:{type:ControlType.String,placeholder:\"Plural Suffix\",hidden:props=>!props.plural}}},selectable:{type:ControlType.Boolean,defaultValue:true,title:\"Text Select\"}});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\":\"CMSItemCountLabel\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerDisableUnlink\":\"\",\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],
  "mappings": "6KAKkB,SAARA,EAAmCC,EAAM,CAAC,GAAK,CAAC,cAAAC,EAAc,UAAAC,CAAS,EAAEF,EAAYG,EAASC,EAAa,QAAQ,IAAIA,EAAa,OAAaC,EAAeL,EAAM,iBAAiB,CAAC,EAAO,CAACM,EAAYC,CAAc,EAAEC,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MAAM,EAAE,OAAO,CAAC,KAAKA,EAAY,QAAQ,aAAa,EAAI,EAAE,UAAU,CAAC,KAAKA,EAAY,OAAO,SAAS,GAAK,SAAS,CAAC,OAAO,CAAC,KAAKA,EAAY,QAAQ,aAAa,EAAK,EAAE,OAAO,CAAC,KAAKA,EAAY,OAAO,OAAOtB,GAAOA,EAAM,MAAM,EAAE,OAAO,CAAC,KAAKsB,EAAY,OAAO,OAAOtB,GAAOA,EAAM,MAAM,EAAE,eAAe,CAAC,KAAKsB,EAAY,OAAO,YAAY,kBAAkB,OAAOtB,GAAO,CAACA,EAAM,MAAM,EAAE,eAAe,CAAC,KAAKsB,EAAY,OAAO,YAAY,kBAAkB,OAAOtB,GAAO,CAACA,EAAM,MAAM,EAAE,aAAa,CAAC,KAAKsB,EAAY,OAAO,YAAY,gBAAgB,OAAOtB,GAAO,CAACA,EAAM,MAAM,EAAE,aAAa,CAAC,KAAKsB,EAAY,OAAO,YAAY,gBAAgB,OAAOtB,GAAO,CAACA,EAAM,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,KAAKsB,EAAY,QAAQ,aAAa,GAAK,MAAM,aAAa,CAAC,CAAC,EAAE,SAASF,EAAaG,EAAMC,EAAO,CAAC,IAAIC,EAAaF,EAAM,QAAQ,CAAC,EAAE,OAAGC,IAAQC,EAAaA,EAAa,QAAQ,wBAAwB,GAAG,GAAUA,CAAa",
  "names": ["CMSItemCountLabel", "props", "superfieldsId", "transform", "isCanvas", "RenderTarget", "collectionList", "initialized", "setInitialized", "ye", "query", "getCollectionData", "totalItems", "Store_default", "state", "ue", "items", "useQueryData", "prefix", "suffix", "u", "formatNumber", "addPropertyControls", "ControlType", "value", "commas", "numberString"]
}
