/*
 * Copyright (c) 2018, 2026, Oracle and/or its affiliates.
 * Licensed under The Universal Permissive License (UPL), Version 1.0
 * as shown at https://oss.oracle.com/licenses/upl/
 */
const TEMPLATE="template";const OJ_BIND="oj-bind";const OJ_DEFER="oj-defer";const BODY="body";module.exports=function(ruleCtx,tsxComp,slotName){return _getSlotParent(ruleCtx,tsxComp,slotName)};function _getSlotParent(ruleCtx,tsxComp,slotName){var parent,isOjDefer=false,ret=null;parent=tsxComp.parent;isOjDefer=tsxComp.name==="oj-defer";if(parent?.name){if(parent.name!==BODY){if(ruleCtx.utils.tsxUtils.isSelfClosingTag(parent.name)){ret=_continueUpwards(ruleCtx,parent,slotName)}else{if(ruleCtx.utils.metaLib.isTagSlotName(parent.name,slotName)){ret=parent}}if(!ret){if(isOjDefer&&parent.name===TEMPLATE||parent.name==="oj-switcher"){ret=parent}else if(parent.name===TEMPLATE||parent.name.startsWith(OJ_BIND)||parent.name===OJ_DEFER){ret=_continueUpwards(ruleCtx,parent,slotName)}}}}return ret};function _continueUpwards(ruleCtx,tag,slotName){var ret=null,parent;parent=tag.parent;while(parent?.name){if(parent.name===TEMPLATE||parent.name.startsWith(OJ_BIND)||parent.name===OJ_DEFER||ruleCtx.utils.tsxUtils.isSelfClosingTag(parent.name)){parent=parent.parent;continue}if(parent.name!==BODY){if(ruleCtx.utils.metaLib.isTagSlotName(parent.name,slotName)){ret=parent}}break}return ret};