{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/IGaEBL33jpqzr6Qs5O5F/4kANn9ki8BjdPht4BKzI/TableOfContentRTL.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{useEffect,useState,useRef}from\"react\";import{HEADINGS,formatTableOfContent}from\"https://framer.com/m/Utils-WIyM.js\";// Made with love by Cl\u00E9ment: https://lionneclement.com/\n// Full tutorial: https://framermart.com/tutorial/how-to-create-table-of-contents-cms-collections-framer\n// const HEADING_TO_DISPLAY = [\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"]\nconst HEADING_TO_DISPLAY=[\"h2\",\"h3\"];const SCROLL_MARGIN_TOP=92;const useStore=createStore({headings:[]});export function withTableOfContentRTL(Component){return props=>{const[store]=useStore();const[activeId,setActiveId]=useState(null);const[visibleElements,setVisibleElements]=useState([]);const[showAll,setShowAll]=useState(false);const lastScrollPosition=useRef(0);useEffect(()=>{const sections=store.headings.map(({heading})=>{const id=slugify(heading)// Generate slugified ID\n;return document.getElementById(id);});const handleScroll=()=>{const currentScrollPosition=window.scrollY;const isScrollingDown=currentScrollPosition>lastScrollPosition.current;const updatedVisibleElements=[...visibleElements];let hasChanges=false;sections.forEach(section=>{if(!section)return;const{top,bottom}=section.getBoundingClientRect();if(top>=0&&bottom<=window.innerHeight){const index=updatedVisibleElements.findIndex(el=>el.id===section.id);// Add to list if not already present\nif(index===-1){if(isScrollingDown){// Add to bottom of list\nupdatedVisibleElements.push({id:section.id,top});}else{// Add to top of list\nupdatedVisibleElements.unshift({id:section.id,top});}hasChanges=true;}}else{// Remove from list if it's no longer visible\nconst index=updatedVisibleElements.findIndex(el=>el.id===section.id);if(index>-1){updatedVisibleElements.splice(index,1);hasChanges=true;}}});if(hasChanges){setVisibleElements(updatedVisibleElements);// Always highlight the top item\nif(updatedVisibleElements.length>0){setActiveId(updatedVisibleElements[0].id);}}lastScrollPosition.current=currentScrollPosition;};window.addEventListener(\"scroll\",handleScroll);// Initial state handling\nhandleScroll();return()=>{window.removeEventListener(\"scroll\",handleScroll);};},[store.headings,visibleElements]);const sortedHeadings=store.headings.map(({heading,type,originalIndex})=>({id:slugify(heading),heading,type,originalIndex})).sort((a,b)=>a.originalIndex-b.originalIndex).filter(({type})=>HEADING_TO_DISPLAY.includes(type));const displayedHeadings=showAll?sortedHeadings:sortedHeadings.slice(0,10);return /*#__PURE__*/_jsxs(_Fragment,{children:[store.headings.length>0&&typeof window!==\"undefined\"?/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsxs(\"div\",{className:\"table-of-contents\",children:[/*#__PURE__*/_jsx(\"p\",{className:\"header\",children:\"\u0627\u0646\u062A\u0642\u0644 \u0625\u0644\u0649 \u0627\u0644\u0642\u0633\u0645\"}),displayedHeadings.map(({id,heading,type})=>/*#__PURE__*/_jsx(\"a\",{href:`${window.location.pathname}#${id}`,className:id===activeId?\"active-link\":\"no-link\",children:heading}))]}),sortedHeadings.length>10&&/*#__PURE__*/_jsx(\"button\",{onClick:()=>setShowAll(!showAll),className:\"view-more-btn\",children:showAll?\"\u0639\u0631\u0636 \u0623\u0642\u0644\":\"\u0639\u0631\u0636 \u0627\u0644\u0645\u0632\u064A\u062F\"})]}):/*#__PURE__*/_jsx(_Fragment,{children:/*#__PURE__*/_jsx(Component,{...props})}),/*#__PURE__*/_jsx(\"style\",{children:`\n\n                        .header{\n                            font-size:16px;\n                            font-weight:bold;\n                            color: rgb(0, 46, 93);\n                        }\n                    .active-link {\n                        font-weight: bold;\n                        color: rgb(0, 46, 93);\n                    }\n\n                    .no-link {\n                        color: rgb(82, 82, 91);\n                        font-weight: normal;\n                    }\n\n                    .active-link, .no-link {\n                        font-size:14px;\n                        margin-top:4px;\n                        margin-bottom:5px;\n                        text-decoration:none;\n                          transition: color 0.3s ease, font-weight 0.3s ease;\n                          direction:trl\n                         }\n                        .view-more-btn {\n                        background: none;\n                        border: none;\n                        color: rgb(0, 46, 93);\n                        font-weight: bold;\n                        cursor: pointer;\n                        margin-top: 10px;\n                        font-size: 16px;\n                        padding-left:0;\n                        marging-left:0\n                    }\n\n                    .table-of-contents {\n                        list-style: none;\n                        padding: 0;\n                        margin: 0;\n                        display: flex;\n                        flex-direction: column;\n                \n                        direction:rtl;\n                        align-items: flex-start;\n                    }\n\n                    .toc-item {\n                        margin-bottom: 8px; /* Adjust spacing */\n                    }\n\n                    .toc-item a {\n                        text-decoration: none;\n                        color: black;\n                        font-size: 14px;\n                    }\n\n                    .active-link {\n                        font-weight: bold;\n                        color: rgb(0, 46, 93);\n                        }\n\n                        #tocparent{\n                        width:fit-content\n                    }\n\n                    #toc-parent{\n                        direction: rtl;\n                        display: flex;\n    flex-direction: column;\n    align-items: flex-start;\n    width: 100%;\n}\n\n                    }\n\n                `})]});};}//\n///////////////Mobile table of contents\nexport function withTableOfContentMobile(Component){return props=>{const[store]=useStore();const[activeId,setActiveId]=useState(null);const[visibleElements,setVisibleElements]=useState([]);const[showAll,setShowAll]=useState(false);const lastScrollPosition=useRef(0);useEffect(()=>{const sections=store.headings.map(({id})=>document.getElementById(id));const handleScroll=()=>{const currentScrollPosition=window.scrollY;const isScrollingDown=currentScrollPosition>lastScrollPosition.current;const updatedVisibleElements=[...visibleElements];let hasChanges=false;sections.forEach(section=>{if(!section)return;const{top,bottom}=section.getBoundingClientRect();if(top>=0&&bottom<=window.innerHeight){const index=updatedVisibleElements.findIndex(el=>el.id===section.id);// Add to list if not already present\nif(index===-1){if(isScrollingDown){// Add to bottom of list\nupdatedVisibleElements.push({id:section.id,top});}else{// Add to top of list\nupdatedVisibleElements.unshift({id:section.id,top});}hasChanges=true;}}else{// Remove from list if it's no longer visible\nconst index=updatedVisibleElements.findIndex(el=>el.id===section.id);if(index>-1){updatedVisibleElements.splice(index,1);hasChanges=true;}}});if(hasChanges){setVisibleElements(updatedVisibleElements);// Always highlight the top item\nif(updatedVisibleElements.length>0){setActiveId(updatedVisibleElements[0].id);}}lastScrollPosition.current=currentScrollPosition;};window.addEventListener(\"scroll\",handleScroll);// Initial state handling\nhandleScroll();return()=>{window.removeEventListener(\"scroll\",handleScroll);};},[store.headings,visibleElements]);const sortedHeadings=store.headings.sort((a,b)=>a.originalIndex-b.originalIndex).filter(({type})=>HEADING_TO_DISPLAY.includes(type));const displayedHeadings=showAll?sortedHeadings:sortedHeadings.slice(0,10);return /*#__PURE__*/_jsxs(_Fragment,{children:[store.headings.length>0&&typeof window!==\"undefined\"?/*#__PURE__*/_jsx(_Fragment,{children:/*#__PURE__*/_jsxs(\"select\",{className:\"toc-dropdown\",onChange:e=>{if(e.target.value){window.location.href=e.target.value;}},children:[/*#__PURE__*/_jsx(\"option\",{value:\"\",disabled:true,selected:true,children:\"\u0627\u0646\u062A\u0642\u0644 \u0625\u0644\u0649 \u0627\u0644\u0642\u0633\u0645\"}),displayedHeadings.map(({id,heading})=>/*#__PURE__*/_jsx(\"option\",{value:`${window.location.pathname}#${id}`,children:heading},id))]})}):/*#__PURE__*/_jsx(_Fragment,{children:/*#__PURE__*/_jsx(Component,{...props})}),/*#__PURE__*/_jsx(\"style\",{children:`\n\n//                select{\n//                 border-top:none;\n//                 border-left:none;\n//                 border-right:none;\n//                 font-size:14px;\n//                 border-bottom: 1px solid rgb(0 46 93); \n//                 color:rgb(0 46 93);\n//                 background-color:#fff;\n//                 width: 100%;\n//                 padding: 10px 10px 10px 0;\n//                }\n\n//                option{\n//                   font-size:13px;\n//                }\n\n//                .toc-dropdown-wrapper {\n//     width: 100%;\n//     position: relative;\n// }\n\n          #toc-parent-mobile{\n            width:100%;\n            direction: rtl;\n          }\n\n                        .toc-dropdown {\n                        width: 100%;\n                        border-top: none;\n                        border-left: none;\n                        border-right: none;\n                        font-size: 14px;\n                        border-bottom: 1px solid rgb(0 46 93);\n                        color: rgb(0 46 93);\n                        background-color: #fff;\n                        padding: 10px 10px 10px 0;\n                        border-radius:0 0 !important;\n                        -webkit-border-radius: 0 !important;\n                        // appearance: none;  /* Removes default iOS dropdown styling */\n                        // -webkit-appearance: none;\n                        // -moz-appearance: none;\n                        display: block;\n                    }\n\n                        /* Add a down arrow to the dropdown */\n                        .toc-dropdown-wrapper::after {\n                            content: \"\u25BC\";  /* Unicode down arrow */\n                            font-size: 12px;\n                            color: rgb(0 46 93);\n                            position: absolute;\n                            right: 10px;\n                            top: 50%;\n                            transform: translateY(-50%);\n                            pointer-events: none;\n                        }\n\n                        /* Fix for iPhone option text */\n                        option {\n                            font-size: 13px;\n                            background-color: white;\n                            color: rgb(0 46 93);\n                        }\n                                            .active-link {\n                                                font-weight: bold;\n                                                color: rgb(0, 46, 93);\n                                            }\n\n                                            .no-link {\n                                                color: rgb(82, 82, 91);\n                                                font-weight: normal;\n                                            }\n\n                                            .active-link, .no-link {\n                                                font-size:14px;\n                                                margin-top:4px;\n                                                margin-bottom:5px;\n                                                text-decoration:none;\n                                                transition: color 0.3s ease, font-weight 0.3s ease;\n                                                }\n                                                .view-more-btn {\n                                                background: none;\n                                                border: none;\n                                                color: rgb(0, 46, 93);\n                                                font-weight: bold;\n                                                cursor: pointer;\n                                                margin-top: 10px;\n                                                font-size: 16px;\n                                                padding-left:0;\n                                                marging-left:0\n                                            }\n\n                        .table-of-contents {\n                            list-style: none;\n                            padding: 0;\n                            margin: 0;\n                                display: flex\n                        ;\n                            flex-direction: column;\n                        }\n\n                        .toc-item {\n                            margin-bottom: 8px; /* Adjust spacing */\n                        }\n\n                        .toc-item a {\n                            text-decoration: none;\n                            color: black;\n                            font-size: 14px;\n                        }\n\n                        .active-link {\n                            font-weight: bold;\n                            color: rgb(0, 46, 93);\n                        }\n\n                        #tocparent{\n                            width:fit-content\n                        }\n\n                `})]});};}/////////\nexport function withContentRTL(Component){return props=>{const[store,setStore]=useStore();const[newProps,setNewProps]=useState(props);useEffect(()=>{setStore({headings:formatTableOfContent(newProps.children.props.children).map(heading=>({...heading,id:slugify(heading.heading)}))});},[newProps]);useEffect(()=>{setNewProps(customFormatHeadings(props))// Apply custom formatting with slugify\n;},[props]);// You can now use this inline wherever needed:\n// <span style={{ direction: \"ltr\", unicodeBidi: \"embed\" }}>052 241 4340</span>\nreturn /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{children:`.framer-text {\n                    scroll-margin-top: ${SCROLL_MARGIN_TOP}px;\n                }\n\n                ul.framer-text > li.framer-text::before,\n                ol.framer-text > li.framer-text::before {\n                    right: 0px;\n                }\n\n                ul.framer-text,\n                ol.framer-text {\n                    padding-right: 3ch;\n                }`}),/*#__PURE__*/_jsx(Component,{...newProps})]});};}const customFormatHeadings=props=>{if(!props.children||!props.children.props||!props.children.props.children){return props// Return unchanged props if structure is not as expected\n;}const newChildren=props.children.props.children.map((item,index)=>{if(HEADINGS.includes(item.type)){const headingText=item.props.children||`heading-${index}`;const formattedId=slugify(headingText);return{...item,props:{...item.props,id:formattedId}};}return item;});return{...props,children:{...props.children,props:{...props.children.props,children:newChildren}}};};function slugify(text){return text.toString().toLowerCase().replace(/\\s+/g,\"-\").replace(/[^\\w\\u0621-\\u064A0-9-]+/g,\"\").replace(/\\-\\-+/g,\"-\").replace(/^-+/,\"\").replace(/-+$/,\"\");}\nexport const __FramerMetadata__ = {\"exports\":{\"withTableOfContentRTL\":{\"type\":\"reactHoc\",\"name\":\"withTableOfContentRTL\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withContentRTL\":{\"type\":\"reactHoc\",\"name\":\"withContentRTL\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withTableOfContentMobile\":{\"type\":\"reactHoc\",\"name\":\"withTableOfContentMobile\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TableOfContentRTL.map"],
  "mappings": "uMAAAA,IAGqC,IAAMC,EAAkB,GAASC,EAASC,EAAY,CAAC,SAAS,CAAC,CAAC,CAAC,EAsNjG,SAASC,EA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AQY,EAAK,CAAC,OAAOA,EAAK,SAAS,EAAE,YAAY,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,2BAA2B,EAAE,EAAE,QAAQ,SAAS,GAAG,EAAE,QAAQ,MAAM,EAAE,EAAE,QAAQ,MAAM,EAAE,CAAE",
  "names": ["init_ssg_sandbox_shims", "SCROLL_MARGIN_TOP", "useStore", "createStore", "withContentRTL", "Component", "props", "store", "setStore", "useStore", "newProps", "setNewProps", "ye", "ue", "formatTableOfContent", "heading", "slugify", "customFormatHeadings", "u", "l", "p", "SCROLL_MARGIN_TOP", "newChildren", "item", "index", "HEADINGS", "headingText", "formattedId", "text"]
}
