{"size": 2169, "ext": "js", "max_stars_repo_path": "public/admin/node_modules/next/dist/client/head-manager.js", "max_stars_repo_name": "mukhan350192/smscenter", "max_stars_repo_stars_event_min_datetime": "2021-12-07T19:35:34.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-07T19:35:34.000Z", "max_issues_repo_path": "public/admin/node_modules/next/dist/client/head-manager.js", "max_issues_repo_name": "mukhan350192/smscenter", "max_issues_repo_issues_event_min_datetime": "2020-11-27T16:32:40.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-13T19:22:26.000Z", "max_forks_repo_path": "public/admin/node_modules/next/dist/client/head-manager.js", "max_forks_repo_name": "mukhan350192/smscenter", "max_forks_repo_forks_event_min_datetime": "2020-11-13T04:39:53.000Z", "max_forks_repo_forks_event_max_datetime": "2020-11-13T04:39:53.000Z"}
{"max_stars_count": 1, "max_issues_count": 9, "max_forks_count": 1, "avg_line_length": 542.25, "max_line_length": 896, "alphanum_fraction": 0.7929921623}
"use strict";exports.__esModule=true;exports.default=initHeadManager;var _react=require("react");const DOMAttributeNames={acceptCharset:'accept-charset',className:'class',htmlFor:'for',httpEquiv:'http-equiv'};function reactElementToDOM({type,props}){const el=document.createElement(type);for(const p in props){if(!props.hasOwnProperty(p))continue;if(p==='children'||p==='dangerouslySetInnerHTML')continue;// we don't render undefined props to the DOM
if(props[p]===undefined)continue;const attr=DOMAttributeNames[p]||p.toLowerCase();el.setAttribute(attr,props[p]);}const{children,dangerouslySetInnerHTML}=props;if(dangerouslySetInnerHTML){el.innerHTML=dangerouslySetInnerHTML.__html||'';}else if(children){el.textContent=typeof children==='string'?children:Array.isArray(children)?children.join(''):'';}return el;}function updateElements(elements,components,removeOldTags){const headEl=document.getElementsByTagName('head')[0];const oldTags=new Set(elements);components.forEach(tag=>{if(tag.type==='title'){let title='';if(tag){const{children}=tag.props;title=typeof children==='string'?children:Array.isArray(children)?children.join(''):'';}if(title!==document.title)document.title=title;return;}const newTag=reactElementToDOM(tag);const elementIter=elements.values();while(true){// Note: We don't use for-of here to avoid needing to polyfill it.
const{done,value}=elementIter.next();if(value==null?void 0:value.isEqualNode(newTag)){oldTags.delete(value);return;}if(done){break;}}elements.add(newTag);headEl.appendChild(newTag);});oldTags.forEach(oldTag=>{if(removeOldTags){oldTag.parentNode.removeChild(oldTag);}elements.delete(oldTag);});}function initHeadManager(initialHeadEntries){const headEl=document.getElementsByTagName('head')[0];const elements=new Set(headEl.children);updateElements(elements,initialHeadEntries.map(([type,props])=>/*#__PURE__*/(0,_react.createElement)(type,props)),false);let updatePromise=null;return{mountedInstances:new Set(),updateHead:head=>{const promise=updatePromise=Promise.resolve().then(()=>{if(promise!==updatePromise)return;updatePromise=null;updateElements(elements,head,true);});}};}
//# sourceMappingURL=head-manager.js.map