LeafletWidget.methods.addWMSLegend=function(e){(function(){var t=this,o=new L.Control.WMSLegend(e.options);const a=document.createElement("div");if(a.className=e.titleClass,a.textContent=e.title,a.style=e.titleStyle,!e.layerId){const t=o.options.uri.match(/layer=([^&]+)/);t&&t[1]?e.layerId=t[1]:e.layerId=L.Util.stamp(o)}t.on("layeradd",(function(l){const n=t.layerManager.getLayer("tile",e.layerId);n&&n.options&&l.layer.options.layers==n.options.layers&&(t.controls.add(o,e.layerId),t.controls._controlsById[e.layerId].container.prepend(a))})),t.on("layerremove",(function(o){const a=t.layerManager.getLayer("tile",e.layerId);a&&a.options&&o.layer.options.layers==t.layerManager.getLayer("tile",e.layerId).options.layers&&t.controls.remove(e.layerId)})),t.controls.add(o,e.layerId),t.controls._controlsById[e.layerId].container.prepend(a)}).call(this)};