{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/eSlbzLBXJ10sKJ49G3B9/ikylEbBVmlAiX2rGrRhS/_utils.js"],
  "sourcesContent": ["import{useEffect,useState}from\"react\";/**\n * Formats the given path string by performing the following steps:\n * 1. Removes the '.md' extension if it exists.\n * 2. Converts camel case to kebab case (replacing uppercase letters with their lowercase equivalent, prefixed by a hyphen).\n * 3. Removes a leading hyphen, if present.\n */export function formatPathString(pathString){return pathString.replace(/\\.md$/,\"\").replace(/[A-Z]/g,match=>`-${match.toLowerCase()}`).replace(/^-/,\"\");}/**\n * Returns the current page URL if it is found in the navigation items.\n * The function iterates through the navigation items and checks if the formatted path includes the current URL.\n */export function getCurrentPageUrl(navigation,currentUrl){navigation.items.map(link=>{const formattedPath=formatPathString(link.path);if(formattedPath.includes(currentUrl)){return currentUrl;}});}/**\n * Updates the page's title with the new title and restores the original title when the component is unmounted.\n * The function re-runs the effect and cleanup when the currentPageTitle changes.\n */export function updatePageMetadata(originalTitle,newTitle,currentPageTitle){useEffect(()=>{document.title=newTitle;return()=>{// Restore the original title when the component is unmounted\ndocument.title=originalTitle;};},[currentPageTitle]);}/**\n * Generates a Markdown file name based on the last segment of the given URL.\n * The function processes the last segment by converting it to camel case and appending the '.md' extension.\n */export function getMdFileName(currentUrl){const segments=currentUrl.split(\"/\");const lastSegment=segments[segments.length-1];const capitalizedLastSegment=lastSegment.charAt(0).toUpperCase()+lastSegment.slice(1);const camelCaseLastSegment=capitalizedLastSegment.split(\"-\").map(word=>word.charAt(0).toUpperCase()+word.slice(1)).join(\"\");const mdFileName=camelCaseLastSegment+\".md\";return mdFileName;}/**\n * Removes all HTML comments from the provided content.\n */export function removeHtmlComments(content){return content.replace(/<!--[\\s\\S]*?-->/g,\"\");}export const formatPageName=pageName=>{return pageName.split(\"-\").map(word=>word.split(/(?=[A-Z])/).join(\" \").charAt(0).toUpperCase()+word.slice(1)).join(\" \");};/**\n * Returns the appropriate repository name based on the platform found in the given URL.\n */export function getRepoName(url){if(!url)return\"storyteller-sdk-kotlin\"// for testing\n;const match=url.match(/documentation\\/(.*?)\\//);if(!match||!match[1])return\"storyteller-sdk-kotlin\"// Return default value if no match found\n;const platform=match[1];switch(platform){case\"ios\":return\"storyteller-sdk-swift\";case\"android\":return\"storyteller-sdk-kotlin\";case\"web\":return\"storyteller-sdk-javascript\";case\"react-native\":return\"storyteller-sdk-react-native-internal\";case\"storyteller-cms\":return\"storyteller-cms\";default:return\"storyteller-sdk-kotlin\";}}/**\n * Returns the appropriate repository name based on the platform.\n */export const getRepoByPlatform=platform=>{switch(platform){case\"ios\":return\"storyteller-sdk-swift\";case\"android\":return\"storyteller-sdk-kotlin\";case\"web\":return\"storyteller-sdk-javascript\";case\"react-native\":return\"storyteller-sdk-react-native-internal\";default:return\"storyteller-sdk-kotlin\";}};/**\n * Returns the appropriate repository owner based on the repository name provided.\n */export function getRepoOwner(repo){switch(repo){case\"storyteller-sdk-swift\":return\"stormideas\";case\"storyteller-sdk-kotlin\":return\"stormideas\";case\"storyteller-sdk-javascript\":return\"stormideas\";case\"storyteller-sdk-react-native-internal\":return\"stormideas\";default:return\"stormideas\";}}export function parseRepoName(repoName){return repoName.replace(\"storyteller-sdk-\",\"\").replace(\"kotlin\",\"android\").replace(\"swift\",\"ios\").replace(\"javascript\",\"web\").replace(\"react-native-internal\",\"react-native\").toLowerCase();}/**\n * Returns formatted documentation url based on the platform and path provided.\n */export const createLinkHref=(section,platform,path)=>{const formattedPath=formatPathString(path);return`/${section}/${platform}/${formattedPath}`;};export const uniqueId=`custom-style-${Date.now()}-${Math.floor(Math.random()*1e5)}`;/**\n * Updates the navigation state based on the parsed content and the current URL.\n * This function sets the previous page URL, previous page title, next page URL,\n * next page title, and current page title.\n *\n */export function updateNavigation(parsedContent,currentUrl,formatPathString,setPreviousPageUrl,setPreviousPageTitle,setNextPageUrl,setNextPageTitle,setCurrentPageTitle){// Find the current, previous, and next pages\nconst currentPageIndex=parsedContent.items.findIndex(link=>currentUrl.includes(formatPathString(link.path)));if(currentPageIndex>=0){if(currentPageIndex>0){setPreviousPageUrl(formatPathString(parsedContent.items[currentPageIndex-1].path));setPreviousPageTitle(parsedContent.items[currentPageIndex-1].text);}if(currentPageIndex<parsedContent.items.length-1){setNextPageUrl(formatPathString(parsedContent.items[currentPageIndex+1].path));setNextPageTitle(parsedContent.items[currentPageIndex+1].text);setCurrentPageTitle(parsedContent.items[currentPageIndex].text);}}}/**\n * Updates the navigation state based on the parsed content and the current URL.\n * This function sets the previous page URL, previous page title, next page URL,\n * next page title, and current page title.\n *\n */export const updateUserGuideNavigation=(parsedContent,currentUrl,formatPathString,setPreviousPageUrl,setPreviousPageTitle,setNextPageUrl,setNextPageTitle,setCurrentPageTitle)=>{const items=Array.isArray(parsedContent)?{items:parsedContent}:parsedContent;const currentSectionIndex=items.items.findIndex(section=>section.items&&section.items.some(link=>currentUrl.includes(formatPathString(link.path))));if(currentSectionIndex>=0){const currentSection=items.items[currentSectionIndex].items;const currentPageIndex=currentSection.findIndex(link=>currentUrl.includes(formatPathString(link.path)));if(currentPageIndex>=0){if(currentPageIndex>0){setPreviousPageUrl(formatPathString(currentSection[currentPageIndex-1].path));setPreviousPageTitle(currentSection[currentPageIndex-1].text);}if(currentPageIndex<currentSection.length-1){setNextPageUrl(formatPathString(currentSection[currentPageIndex+1].path));setNextPageTitle(currentSection[currentPageIndex+1].text);setCurrentPageTitle(currentSection[currentPageIndex].text);}}}};function getWindowDimensions(){//NOTE: Defaults required for initial SSR so use of window doesn't cause error.\nconst defaultWidth=1e3;const defaultHeight=2e3;if(typeof window!==\"undefined\"){const{innerWidth:width,innerHeight:height}=window;return{width,height};}else{return{width:defaultWidth,height:defaultHeight};}}export function useWindowDimensions(){const[windowDimensions,setWindowDimensions]=useState(getWindowDimensions());useEffect(()=>{function handleResize(){setWindowDimensions(getWindowDimensions());}window.addEventListener(\"resize\",handleResize);return()=>window.removeEventListener(\"resize\",handleResize);},[]);return windowDimensions;}// Force smooth scroll between sections as scrollIntoView smooth behavior is not respected from component level\nexport function useSmoothScroll(){useEffect(()=>{const htmlElement=document.querySelector(\"html\");if(htmlElement){htmlElement.style.scrollBehavior=\"smooth\";}return()=>{if(htmlElement){htmlElement.style.scrollBehavior=\"\";}};},[]);}// Returns formatted title from url\nexport function getTitleFromUrl(url){const pathParts=url.split(\"/\");const lastPart=pathParts[pathParts.length-1];const title=lastPart.split(\"-\").map(word=>word.charAt(0).toUpperCase()+word.slice(1)).join(\" \");return title;}const initialState={windowLocation:\"\"};export const windowLocation=(state=initialState,action)=>{if(action.type===\"SET\"){var _window_location_href,_window_location,_window,_window_location1,_window1;return Object.assign({},state,{...state,windowLocation:typeof window!==\"undefined\"&&((_window=window)===null||_window===void 0?void 0:(_window_location=_window.location)===null||_window_location===void 0?void 0:(_window_location_href=_window_location.href)===null||_window_location_href===void 0?void 0:_window_location_href.includes(\"?\"))?(_window1=window)===null||_window1===void 0?void 0:(_window_location1=_window1.location)===null||_window_location1===void 0?void 0:_window_location1.href:state.windowLocation});}return state;};// This function returns UTM params based on window location - used in the SignUp form\nexport const useWindowLocation=()=>{var _window_location,_window;const[utmMedium,setUtmMedium]=useState(\"\");const[utmSource,setUtmSource]=useState(\"\");const[utmCampaign,setUtmCampaign]=useState(\"\");const[gclid,setGclid]=useState(\"\");const windowLocation=(_window=window)===null||_window===void 0?void 0:(_window_location=_window.location)===null||_window_location===void 0?void 0:_window_location.href;useEffect(()=>{const extractData=param=>{var _param_split;return param===null||param===void 0?void 0:(_param_split=param.split(\"=\"))===null||_param_split===void 0?void 0:_param_split.splice(1,1)[0];};if(typeof windowLocation===\"string\"){var _windowLocation_split_splice_,_windowLocation_split;const windowLocationData=windowLocation===null||windowLocation===void 0?void 0:(_windowLocation_split=windowLocation.split(\"?\"))===null||_windowLocation_split===void 0?void 0:(_windowLocation_split_splice_=_windowLocation_split.splice(1,2)[0])===null||_windowLocation_split_splice_===void 0?void 0:_windowLocation_split_splice_.split(\"&\");if(windowLocationData){windowLocationData.forEach(param=>{if(param.includes(\"utm_source\")){setUtmSource(extractData(param));}if(param.includes(\"utm_medium\")){setUtmMedium(extractData(param));}if(param.includes(\"utm_campaign\")){setUtmCampaign(extractData(param));}if(param.includes(\"gclid\")){setGclid(extractData(param));}});}}},[windowLocation]);return{utmCampaign,utmMedium,utmSource,gclid};};// Utility function that finds index by URL - used in the sidebar accordion on doc pages\nexport const findAccordionIndexByUrl=(currentUrl,navigation,isMobile,currentIndex,setCurrentIndex)=>{if(!currentUrl||!navigation)return-1;let foundIndex=isMobile?0:-1;for(let index=0;index<navigation.length;index++){const nav=navigation[index];const isCurrent=currentUrl.includes(nav.platform)&&nav.items.some(item=>currentUrl.endsWith(createLinkHref(\"documentation\",nav.platform,item.path)));if(isCurrent){foundIndex=index;}}if(foundIndex!==currentIndex){localStorage.setItem(\"docSidebarCurrentIndex\",foundIndex);setCurrentIndex(foundIndex);}return foundIndex;};// Returns true if the string does not include http(s): prefix in the URL\nexport function isInternalLink(url){return!url.includes(\"http://\")&&!url.includes(\"https://\");}\nexport const __FramerMetadata__ = {\"exports\":{\"updateUserGuideNavigation\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"isInternalLink\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useWindowDimensions\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"parseRepoName\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getMdFileName\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"removeHtmlComments\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getRepoByPlatform\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"createLinkHref\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"formatPathString\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getRepoOwner\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"updatePageMetadata\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"formatPageName\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"windowLocation\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getCurrentPageUrl\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useSmoothScroll\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"findAccordionIndexByUrl\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"updateNavigation\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useWindowLocation\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"uniqueId\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getTitleFromUrl\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getRepoName\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./_utils.map"],
  "mappings": "yFAKU,SAASA,EAAiBC,EAAW,CAAC,OAAOA,EAAW,QAAQ,QAAQ,EAAE,EAAE,QAAQ,SAASC,GAAO,IAAIA,EAAM,YAAY,CAAC,EAAE,EAAE,QAAQ,KAAK,EAAE,CAAE,CAMhJ,SAASC,EAAmBC,EAAcC,EAASC,EAAiB,CAACC,EAAU,KAAK,SAAS,MAAMF,EAAe,IAAI,CAChI,SAAS,MAAMD,CAAc,GAAI,CAACE,CAAgB,CAAC,CAAE,CAKgD,IAAME,EAAeC,GAAkBA,EAAS,MAAM,GAAG,EAAE,IAAIC,GAAMA,EAAK,MAAM,WAAW,EAAE,KAAK,GAAG,EAAE,OAAO,CAAC,EAAE,YAAY,EAAEA,EAAK,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,EAUjP,IAA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AOL,GAAiB,SAAS,CAAC,IAAIM,EAA8BC,EAAsB,IAAMC,EAAmBR,GAAiB,OAAsCO,EAAsBP,EAAe,MAAM,GAAG,KAAK,MAAMO,IAAwB,SAAeD,EAA8BC,EAAsB,OAAO,EAAE,CAAC,EAAE,CAAC,KAAK,MAAMD,IAAgC,OAApN,OAAkOA,EAA8B,MAAM,GAAG,EAAKE,GAAoBA,EAAmB,QAAQJ,GAAO,CAAIA,EAAM,SAAS,YAAY,GAAGT,EAAaQ,EAAYC,CAAK,CAAC,EAAMA,EAAM,SAAS,YAAY,GAAGZ,EAAaW,EAAYC,CAAK,CAAC,EAAMA,EAAM,SAAS,cAAc,GAAGP,EAAeM,EAAYC,CAAK,CAAC,EAAMA,EAAM,SAAS,OAAO,GAAGL,EAASI,EAAYC,CAAK,CAAC,CAAG,CAAC,CAAG,CAAC,EAAE,CAACJ,CAAc,CAAC,EAAQ,CAAC,YAAAJ,EAAY,UAAAL,EAAU,UAAAG,EAAU,MAAAI,CAAK,CAAE",
  "names": ["formatPathString", "pathString", "match", "updatePageMetadata", "originalTitle", "newTitle", "currentPageTitle", "ue", "formatPageName", "pageName", "word", "createLinkHref", "section", "platform", "path", "formattedPath", "formatPathString", "uniqueId", "updateUserGuideNavigation", "parsedContent", "currentUrl", "formatPathString", "setPreviousPageUrl", "setPreviousPageTitle", "setNextPageUrl", "setNextPageTitle", "setCurrentPageTitle", "items", "currentSectionIndex", "section", "link", "currentSection", "currentPageIndex", "getWindowDimensions", "window", "width", "height", "useWindowDimensions", "windowDimensions", "setWindowDimensions", "ye", "ue", "handleResize", "useSmoothScroll", "htmlElement", "getTitleFromUrl", "url", "pathParts", "word", "useWindowLocation", "_window_location", "_window", "utmMedium", "setUtmMedium", "ye", "utmSource", "setUtmSource", "utmCampaign", "setUtmCampaign", "gclid", "setGclid", "windowLocation", "window", "ue", "extractData", "param", "_param_split", "_windowLocation_split_splice_", "_windowLocation_split", "windowLocationData"]
}
