/*
 Copyright 2015-2021 The MathWorks, Inc.
*/
function webviewToCodeInit(){var r=setInterval(function(){if(top.slwebview||window.slwebview||document.getElementById("rtw_webview").contentWindow.slwebview)document.getElementById("rtw_webview").contentWindow.require(["dojo/dom-style","dojo/topic","dojo/window","dijit/registry"],function(l,p,h,q){var d=q.byId("slwebview"),f=!0,g={traceableColor:"#00cfcf",untraceableColor:"#e8d152",getColor:function(a){return a?this.traceableColor:this.untraceableColor},getStyle:function(a,b){a=this.getColor(b);return"fill:"+
a+"; fill-opacity:0.5; stroke:"+a+";"}},k,m=function(a,b,c){d.open(a).then(function(){var e;if(e=d.getElementViewer())if(k&&l.set(k,"background",""),e=e.getLineNode(b))l.set(e,"background",c),h.scrollIntoView(e),k=e})};void 0!==h.webviewSelectHandle&&h.webviewSelectHandle.remove();h.webviewSelectHandle=p.subscribe("slwebview/select",function(a,b){if(d.isElement(a)&&f){d.unhighlightAll();var c=a.backing.sid;b=b&&b.line?b.line:-1;0<=b&&(c=a.backing.obj_viewer.code_sid+":"+b.toString());"undefined"!==
typeof cr?(cr.highlightor.bySids([c]),(a=cr.highlightor.getCurrent())?(cr.show(a.file,void 0,parseInt(a.line)),cr.refresh(),postMessage({message:"jumpToCode",location:a.file+":"+a.line})):(cr.refresh(),postMessage({message:"showCodeView"}))):(c=top.rtwChangeSysCallback(c),d.highlight(a,g.getStyle(a,c)),0<=b&&m(a,b,g.getColor(c)))}});top.codeToWebView=function(a,b){var c=d.getElement(a);if(!c){var e=a.lastIndexOf(":");var n=a.substring(e+1);c=d.getElement(b)}if(c){f=!1;try{d.open(c.diagram,{nohash:!0}).then(function(){try{d.unhighlightAll(),
d.moveToView(c),d.highlight(c,g.getStyle(c,!0)),0<=n?(m(c,n,g.getColor(!0)),d.select(c)):d.select(c.diagram)}finally{f=!0}},function(){f=!0})}catch(t){f=!0}}else return-1;return 0};top.codeToWebViewArray=function(a,b){d.unhighlightAll();if(1>=a.length)return-1;for(b=1;b<a.length;b++){var c=a[b-1],e=d.getElement(a[b]);if(!e)return-1===top.codeToWebView(c,c)?-1:0}for(b=0;b<a.length;b++)e=d.getElement(a[b]),d.open(e.diagram,{nohash:!0}).then(function(){d.highlight(e,g.getStyle(e,!0))});return 0}}),clearInterval(r)},
1E3)};
