").addClass("PennController-"+this.type.replace(/[\s_]/g,"")+"-tooltip-frame"),this.jQueryElement.addClass("PennController-"+this.type.replace(/[\s_]/g,"")+"-tooltip"),this.jQueryElement.addClass("PennController-"+this.id.replace(/[\s_]/g,"")),this.jQueryElement.css({background:"floralwhite",position:"relative"}),this.jQueryLabel.css({border:"dotted 1px gray",cursor:"pointer",position:"absolute",bottom:"2px",right:"2px"}),this.wasValidated=!1,this.disabled=!1,this.log=!1,this.validate=()=>{this.delayedPrinting||this.disabled||(this.wasValidated=!0,this.validations.push(["Validate","Validate",Date.now(),"NULL"]),t.apply(this))},e()},this.end=function(){if(this.jQueryElement&&this.jQueryElement instanceof jQuery&&t.apply(this),this.log)for(let t in this.validations)e.controllers.running.save(this.type,this.id,...this.validations[t])},this.value=function(){return this.wasValidated},this.actions={print:async function(t,i,...s){if(i&&i.hasOwnProperty("_element")&&i._element.jQueryElement instanceof jQuery&&(i=i._element.jQueryElement),this.jQueryElement.append(this.jQueryLabel),this.jQueryLabel.click(()=>{this.noClicks||this.validate()}),this.jQueryElement.css("text-align","left"),i instanceof jQuery){i.before(this.jQueryElement);let e=i.width(),s=i.height();this.jQueryElement.css({position:"absolute",display:"inline-block",visibility:"hidden",overflow:"auto",top:"auto",left:"auto","margin-top":1+s,"margin-left":1+e,"z-index":9999,padding:"1px"}),this.frameParent&&i.before(this.frame.css({position:"absolute",display:"inline-block",width:e,height:s,border:this.frameParent,"z-index":100,"pointer-events":"none"}));let n=i.css("top"),l=i.css("left");if("0px"==n&&(n="auto"),"0px"==l&&(l="auto"),this.jQueryElement.css({left:l,top:n}),this.frame.css({left:l,top:n}),this.jQueryElement.addClass("PennController-"+this.type.replace(/[\s_]/g,"")),"none"!=this.jQueryLabel.css("display")&&this.jQueryElement.css("padding-bottom","20px"),this.relativePosition){let e=()=>this.relativePosition.match(/top/i)?-1*this.jQueryElement.outerHeight()-1:this.relativePosition.match(/middle/i)?.5*(i.height()-this.jQueryElement.outerHeight()):i.height()+1,s=()=>this.relativePosition.match(/left/i)?-1*this.jQueryElement.outerWidth()-1:this.relativePosition.match(/center/i)?.5*(i.width()-this.jQueryElement.outerWidth()):i.width()+1;this.delayedPrinting=!0,setTimeout(()=>{this.jQueryElement.css({"margin-top":e(),"margin-left":s()}),setTimeout(()=>{this.jQueryElement.css({"margin-top":e(),"margin-left":s(),visibility:"visible"}),this.delayedPrinting=!1,t()})})}else this.jQueryElement.css("visibility","visible"),t()}else s.length>1?this.jQueryContainer=void 0:this.jQueryContainer=$("
"),await new Promise(t=>e.elements.standardCommands.actions.print.apply(this,[t,i,...s])),this.jQueryElement.css({position:"relative",left:"",top:"",margin:0,display:"inline-block"}),"none"!=this.jQueryLabel.css("display")&&this.jQueryElement.css("padding-bottom","20px"),t()},remove:function(e){t.apply(this),e()},wait:function(e,t){if("first"==t&&this.wasValidated)e();else{let i=!1,s=this.validate;this.validate=()=>{if(s.apply(this),!i)if(t instanceof Object&&t._runPromises&&t.success){let s=this.disabled;this.disabled="tmp",t._runPromises().then(t=>{"success"==t&&(i=!0,e()),"tmp"==this.disabled&&(this.disabled=s)})}else i=!0,e()}}}},this.settings={disable:function(e){this.disabled=!0,this.jQueryContainer.addClass("PennController-disabled"),this.jQueryElement.addClass("PennController-disabled"),e()},enable:function(e){this.disabled=!1,this.jQueryContainer.removeClass("PennController-disabled"),this.jQueryElement.removeClass("PennController-disabled"),e()},frame:function(e,t){"string"==typeof t&&t.length?this.frameParent=t:this.frameParent="dotted 1px gray",e()},key:function(t,i,s){" "==i||isNaN(Number(i))||(i=String.fromCharCode(i)),"string"!=typeof i&&t(e.debug.error("Invalid key(s) passed to Tooltip ""+id+"" (should be a string or a key code number)",i)),i=i.toUpperCase(),e.events.keypress(e=>{if(!this.jQueryElement.parent().length)return;let t=e.key.isSpecialKey(),s=e.key.toUpperCase();(void 0===i||0==i.length||t&&(i==s||i=={0:"",1:"LEFT",2:"RIGHT"}[e.location]+s)||!t&&i.indexOf(s)>-1)&&this.validate()}),s&&(this.noClicks=!0,this.jQueryLabel.css("cursor",""),this.initialLabel||this.resetLabel||this.jQueryLabel.css("display","none")),t()},label:function(e,t){this.label=t,this.resetLabel=!0,"string"!=typeof t||t.match(/^[\s\t]*$/)?this.jQueryLabel.css("display","none"):(this.jQueryLabel.html(t),this.jQueryLabel.css("display","inherit")),e()},log:function(e){this.log=!0,e()},position:function(e,t){this.relativePosition=t,e()},text:function(e,t){this.text=t,this.jQueryElement.html(t),this.jQueryElement.append(this.jQueryLabel),this.jQueryLabel.click(()=>{this.noClicks||this.validate()}),"none"!=this.jQueryLabel.css("display")&&this.jQueryElement.css("padding-bottom","20px"),e()}}}))}});