"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i=0&&matches.item(i)!==el){}}while(i<0&&(el=el.parentElement));return el}}if(window.NodeList&&!NodeList.prototype.forEach){NodeList.prototype.forEach=function(callback,thisArg){thisArg=thisArg||window;for(var i=0;i]*>([\s\S]*?)<\/script>/gi);if(scripttags){scripttags.forEach(function(tag){var js=tag.replace(/]*>/i,"").replace(/<\/script>/i,"").trim();eval(js)})}}}else{if(config.fail){config.fail.call(xhr,obj)}}if(config.always){config.always.call(xhr,obj)}var oContentSize=obj.options.contentSize;if(typeof oContentSize==="string"&&oContentSize.match(/auto/i)){var parts=oContentSize.split(" ");var sizes=Object.assign({},{width:parts[0],height:parts[1]});if(config.autoresize){obj.resize(sizes)}if(!obj.classList.contains("jsPanel-contextmenu")){if(config.autoreposition){obj.reposition()}}}else if((typeof oContentSize==="undefined"?"undefined":_typeof(oContentSize))==="object"&&(oContentSize.width==="auto"||oContentSize.height==="auto")){var _sizes=Object.assign({},oContentSize);if(config.autoresize){obj.resize(_sizes)}if(!obj.classList.contains("jsPanel-contextmenu")){if(config.autoreposition){obj.reposition()}}}if(jsPanel.ajaxAlwaysCallbacks.length){jsPanel.ajaxAlwaysCallbacks.forEach(function(item){item.call(obj,obj)})}}};xhr.open(config.method,config.url,config.async,config.user,config.pwd);xhr.timeout=config.timeout||0;if(config.withCredentials){xhr.withCredentials=config.withCredentials}if(config.responseType){xhr.responseType=config.responseType}if(config.beforeSend){config.beforeSend.call(xhr)}if(config.data){xhr.send(config.data)}else{xhr.send(null)}return obj},calcColors:function calcColors(primaryColor){var primeColor=this.color(primaryColor),secondColor=this.lighten(primaryColor,.81),thirdColor=this.darken(primaryColor,.5),fontColorForPrimary=this.perceivedBrightness(primaryColor)<=.556?"#ffffff":"#000000",fontColorForSecond=this.perceivedBrightness(secondColor)<=.556?"#ffffff":"#000000",fontColorForThird=this.perceivedBrightness(thirdColor)<=.556?"#000000":"#ffffff";return[primeColor.hsl.css,secondColor,thirdColor,fontColorForPrimary,fontColorForSecond,fontColorForThird]},color:function color(val){var color=val.toLowerCase(),r=void 0,g=void 0,b=void 0,h=void 0,s=void 0,l=void 0,match=void 0,channels=void 0,hsl=void 0,result={};var hexPattern=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/gi,RGBAPattern=/^rgba?\(([0-9]{1,3}),([0-9]{1,3}),([0-9]{1,3}),?(0|1|0\.[0-9]{1,2}|\.[0-9]{1,2})?\)$/gi,HSLAPattern=/^hsla?\(([0-9]{1,3}),([0-9]{1,3}%),([0-9]{1,3}%),?(0|1|0\.[0-9]{1,2}|\.[0-9]{1,2})?\)$/gi,namedColors={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgrey:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",grey:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};if(namedColors[color]){color=namedColors[color]}if(color.match(hexPattern)!==null){color=color.replace("#","");if(color.length%2===1){r=String(color.substr(0,1))+color.substr(0,1);g=String(color.substr(1,1))+color.substr(1,1);b=String(color.substr(2,1))+color.substr(2,1);result.rgb={r:parseInt(r,16),g:parseInt(g,16),b:parseInt(b,16)};result.hex="#"+r+g+b}else{result.rgb={r:parseInt(color.substr(0,2),16),g:parseInt(color.substr(2,2),16),b:parseInt(color.substr(4,2),16)};result.hex="#"+color}hsl=this.rgbToHsl(result.rgb.r,result.rgb.g,result.rgb.b);result.hsl=hsl;result.rgb.css="rgb("+result.rgb.r+","+result.rgb.g+","+result.rgb.b+")"}else if(color.match(RGBAPattern)){match=RGBAPattern.exec(color);result.rgb={css:color,r:match[1],g:match[2],b:match[3]};result.hex=this.rgbToHex(match[1],match[2],match[3]);hsl=this.rgbToHsl(match[1],match[2],match[3]);result.hsl=hsl}else if(color.match(HSLAPattern)){match=HSLAPattern.exec(color);h=match[1]/360;s=match[2].substr(0,match[2].length-1)/100;l=match[3].substr(0,match[3].length-1)/100;channels=this.hslToRgb(h,s,l);result.rgb={css:"rgb("+channels[0]+","+channels[1]+","+channels[2]+")",r:channels[0],g:channels[1],b:channels[2]};result.hex=this.rgbToHex(result.rgb.r,result.rgb.g,result.rgb.b);result.hsl={css:"hsl("+match[1]+","+match[2]+","+match[3]+")",h:match[1],s:match[2],l:match[3]}}else{result.hex="#f5f5f5";result.rgb={css:"rgb(245,245,245)",r:245,g:245,b:245};result.hsl={css:"hsl(0,0%,96.08%)",h:0,s:"0%",l:"96.08%"}}return result},createPanelTemplate:function createPanelTemplate(){var dataAttr=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;var panel=document.createElement("div");panel.className="jsPanel";if(dataAttr){["close","maximize","normalize","minimize","smallify","smallifyrev"].forEach(function(item){panel.setAttribute("data-btn"+item,"enabled")})}panel.innerHTML='
\n
\n \n
\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
';return panel},createMinimizedTemplate:function createMinimizedTemplate(){var panel=document.createElement("div");panel.className="jsPanel-replacement";panel.innerHTML='
\n
\n \n
\n

\n
\n
\n
\n
\n
\n
\n
\n
';return panel},createSnapArea:function createSnapArea(panel,pos,snapsens){var el=document.createElement("div"),parent=panel.parentNode;el.className="jsPanel-snap-area jsPanel-snap-area-"+pos;if(pos==="lt"||pos==="rt"||pos==="rb"||pos==="lb"){el.style.width=snapsens+"px";el.style.height=snapsens+"px"}else if(pos==="ct"||pos==="cb"){el.style.height=snapsens+"px"}else if(pos==="lc"||pos==="rc"){el.style.width=snapsens+"px"}if(parent!==document.body){el.style.position="absolute"}if(!document.querySelector(".jsPanel-snap-area.jsPanel-snap-area-"+pos)){panel.parentNode.appendChild(el)}},darken:function darken(val,amount){var hsl=this.color(val).hsl,l=parseFloat(hsl.l),lnew=l-l*amount+"%";return"hsl("+hsl.h+","+hsl.s+","+lnew+")"},dragit:function dragit(elmt){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var dragstarted=void 0,opts=Object.assign({},this.defaults.dragit,options),dragElmt=void 0,containment=void 0,frames=[];var dragstart=new CustomEvent("dragstart",{detail:elmt.id}),drag=new CustomEvent("drag",{detail:elmt.id}),dragstop=new CustomEvent("dragstop",{detail:elmt.id});if(opts.grid&&Array.isArray(opts.grid)){if(opts.grid.length===1){opts.grid[1]=opts.grid[0]}}containment=this.pOcontainment(opts.containment);elmt.querySelectorAll(opts.handles).forEach(function(handle){handle.style.touchAction="none";handle.style.cursor=opts.cursor;handle.classList.add("jsPanel-dragit-handle");jsPanel.pointerdown.forEach(function(item){handle.addEventListener(item,function(e){e.preventDefault();if(e.target.closest(".jsPanel-ftr-btn")){return}elmt.controlbar.style.pointerEvents="none";frames=document.querySelectorAll("iframe");if(frames.length){frames.forEach(function(item){item.style.pointerEvents="none"})}var startStyles=window.getComputedStyle(elmt),startLeft=parseFloat(startStyles.left),startTop=parseFloat(startStyles.top),psx=e.touches?e.touches[0].clientX:e.clientX,psy=e.touches?e.touches[0].clientY:e.clientY,parent=elmt.parentNode,parentRect=parent.getBoundingClientRect(),parentStyles=window.getComputedStyle(parent);var startLeftCorrection=0;dragElmt=function dragElmt(e){e.preventDefault();if(!dragstarted){document.dispatchEvent(dragstart);elmt.style.opacity=opts.opacity;if(elmt.snapped&&opts.snap.resizeToPreSnap&&elmt.currentData.beforeSnap){elmt.resize(elmt.currentData.beforeSnap.width+" "+elmt.currentData.beforeSnap.height);var intermediateStyles=elmt.getBoundingClientRect(),delta=psx-(intermediateStyles.left+intermediateStyles.width),wHalf=intermediateStyles.width/2;if(delta>-wHalf){startLeftCorrection=delta+wHalf}}if(typeof opts.start==="function"){opts.start.call(elmt,elmt,{left:startLeft,top:startTop})}jsPanel.front(elmt);elmt.snapped=false}dragstarted=1;if(opts.disableOnMaximized&&elmt.status==="maximized"){return false}var elmtL=void 0,elmtL2=void 0,elmtT=void 0,elmtT2=void 0,elmtR=void 0,elmtR2=void 0,elmtB=void 0,elmtB2=void 0;var pmx=e.touches?e.touches[0].clientX:e.clientX,pmy=e.touches?e.touches[0].clientY:e.clientY,dragStyles=window.getComputedStyle(elmt);if(opts.snap){if(opts.snap.trigger==="panel"){elmtL=parseFloat(dragStyles.left);elmtL2=Math.pow(elmtL,2);elmtT=parseFloat(dragStyles.top);elmtT2=Math.pow(elmtT,2);elmtR=parseFloat(dragStyles.right);elmtR2=Math.pow(elmtR,2);elmtB=parseFloat(dragStyles.bottom);elmtB2=Math.pow(elmtB,2)}else if(opts.snap.trigger==="pointer"){elmtL=pmx;elmtL2=Math.pow(pmx,2);elmtT=pmy;elmtT2=Math.pow(elmtT,2);elmtR=window.innerWidth-pmx;elmtR2=Math.pow(elmtR,2);elmtB=window.innerHeight-pmy;elmtB2=Math.pow(elmtB,2)}}var lefttopVectorDrag=Math.sqrt(elmtL2+elmtT2),leftbottomVectorDrag=Math.sqrt(elmtL2+elmtB2),righttopVectorDrag=Math.sqrt(elmtR2+elmtT2),rightbottomVectorDrag=Math.sqrt(elmtR2+elmtB2),horizontalDeltaDrag=Math.abs(elmtL-elmtR)/2,verticalDeltaDrag=Math.abs(elmtT-elmtB)/2,leftVectorDrag=Math.sqrt(elmtL2+Math.pow(verticalDeltaDrag,2)),topVectorDrag=Math.sqrt(elmtT2+Math.pow(horizontalDeltaDrag,2)),rightVectorDrag=Math.sqrt(elmtR2+Math.pow(verticalDeltaDrag,2)),bottomVectorDrag=Math.sqrt(elmtB2+Math.pow(horizontalDeltaDrag,2));window.getSelection().removeAllRanges();document.dispatchEvent(drag);if(!opts.axis||opts.axis==="x"){elmt.style.left=startLeft+(pmx-psx)+startLeftCorrection+"px"}if(!opts.axis||opts.axis==="y"){elmt.style.top=startTop+(pmy-psy)+"px"}if(opts.grid){var cx=parseFloat(dragStyles.left),cy=parseFloat(dragStyles.top),modX=cx%opts.grid[0],modY=cy%opts.grid[1];if(modX=maxLeft){elmt.style.left=maxLeft+"px"}if(parseFloat(elmt.style.top)>=maxTop){elmt.style.top=maxTop+"px"}}if(typeof opts.drag==="function"){opts.drag.call(elmt,elmt,{left:elmtL,top:elmtT,right:elmtR,bottom:elmtB})}if(opts.snap){var snapSens=opts.snap.sensitivity,topSensAreaLength=parent===document.body?window.innerWidth/8:parentRect.width/8,sideSensAreaLength=parent===document.body?window.innerHeight/8:parentRect.height/8;elmt.snappableTo=false;jsPanel.removeSnapAreas(elmt);if(lefttopVectorDrag]*>([\s\S]*?)<\/script>/gi);if(scripttags){scripttags.forEach(function(tag){var js=tag.replace(/]*>/i,"").replace(/<\/script>/i,"").trim();eval(js)})}}var oContentSize=obj.options.contentSize;if(conf.autoresize||conf.autoreposition){if(typeof oContentSize==="string"&&oContentSize.match(/auto/i)){var parts=oContentSize.split(" ");var sizes=Object.assign({},{width:parts[0],height:parts[1]});if(conf.autoresize){obj.resize(sizes)}if(!obj.classList.contains("jsPanel-contextmenu")){if(conf.autoreposition){obj.reposition()}}}else if((typeof oContentSize==="undefined"?"undefined":_typeof(oContentSize))==="object"&&(oContentSize.width==="auto"||oContentSize.height==="auto")){var _sizes2=Object.assign({},oContentSize);if(conf.autoresize){obj.resize(_sizes2)}if(!obj.classList.contains("jsPanel-contextmenu")){if(conf.autoreposition){obj.reposition()}}}}}).catch(function(error){console.error("There has been a problem with your fetch operation: "+error.message)})}),front:function front(obj){if(obj.status==="minimized"){if(obj.statusBefore==="maximized"){obj.maximize()}else{obj.normalize()}}else{var newArr=Array.prototype.slice.call(document.querySelectorAll(".jsPanel-standard")).map(function(panel){return panel.style.zIndex});if(Math.max.apply(Math,_toConsumableArray(newArr))>obj.style.zIndex){obj.style.zIndex=jsPanel.zi.next()}this.resetZi()}},getPanels:function getPanels(){var condition=arguments.length>0&&arguments[0]!==undefined?arguments[0]:function(){return this.classList.contains("jsPanel-standard")};return Array.prototype.slice.call(document.querySelectorAll(".jsPanel")).filter(function(value){return condition.call(value,value)}).sort(function(a,b){return b.style.zIndex-a.style.zIndex})},hslToRgb:function hslToRgb(h,s,l){var r=void 0,g=void 0,b=void 0;if(s===0){r=g=b=l}else{var hue2rgb=function hue2rgb(p,q,t){if(t<0){t+=1}if(t>1){t-=1}if(t<1/6){return p+(q-p)*6*t}if(t<1/2){return q}if(t<2/3){return p+(q-p)*(2/3-t)*6}return p};var q=l<.5?l*(1+s):l+s-l*s,p=2*l-q;r=hue2rgb(p,q,h+1/3);g=hue2rgb(p,q,h);b=hue2rgb(p,q,h-1/3)}return[Math.round(r*255),Math.round(g*255),Math.round(b*255)]},lighten:function lighten(val,amount){var hsl=this.color(val).hsl,l=parseFloat(hsl.l),lnew=l+(100-l)*amount+"%";return"hsl("+hsl.h+","+hsl.s+","+lnew+")"},perceivedBrightness:function perceivedBrightness(val){var rgb=this.color(val).rgb;return rgb.r/255*.2627+rgb.g/255*.678+rgb.b/255*.0593},pOcontainer:function pOcontainer(container,cb){if(container){var box=void 0;if(typeof container==="string"){box=document.querySelector(container)}else if(container.nodeType===1){box=container}else if(container.length){box=container[0]}if(box&&box.nodeType===1){return box}}var error=new jsPanelError("\nNO NEW PANEL CREATED!\nThe container to append the panel to does not exist or a container was not specified!");try{throw error}catch(e){if(cb){cb.call(e,e)}}return error},pOcontainment:function pOcontainment(arg){if(typeof arg==="number"){return[arg,arg,arg,arg]}else if(Array.isArray(arg)){if(arg.length===1){return[arg[0],arg[0],arg[0],arg[0]]}else if(arg.length===2){return arg.concat(arg)}else if(arg.length===3){arg[3]=arg[1]}}return arg},pOsize:function pOsize(panel,size){var values=size||this.defaults.contentSize,parent=panel.parentNode;if(typeof values==="string"){var nums=values.trim().split(" ");values={};values.width=nums[0];nums.length===2?values.height=nums[1]:values.height=nums[0]}else{if(values.width&&!values.height){values.height=values.width}else if(values.height&&!values.width){values.width=values.height}}if(String(values.width).match(/^[0-9]+$/gi)){values.width+="px"}else if(typeof values.width==="string"&&values.width.endsWith("%")){if(parent===document.body){values.width=window.innerWidth*(parseFloat(values.width)/100)+"px"}else{var prtStyles=window.getComputedStyle(parent),border=parseFloat(prtStyles.borderLeftWidth)+parseFloat(prtStyles.borderRightWidth);values.width=(parseFloat(prtStyles.width)-border)*(parseFloat(values.width)/100)+"px"}}else if(typeof values.width==="function"){values.width=values.width();if(typeof values.width==="number"){values.width+="px"}else if(typeof values.width==="string"&&values.width.match(/^[0-9]+$/gi)){values.width+="px"}}if(String(values.height).match(/^[0-9]+$/gi)){values.height+="px"}else if(typeof values.height==="string"&&values.height.endsWith("%")){if(parent===document.body){values.height=window.innerHeight*(parseFloat(values.height)/100)+"px"}else{var _prtStyles=window.getComputedStyle(parent),_border=parseFloat(_prtStyles.borderTopWidth)+parseFloat(_prtStyles.borderBottomWidth);values.height=(parseFloat(_prtStyles.height)-_border)*(parseFloat(values.height)/100)+"px"}}else if(typeof values.height==="function"){values.height=values.height();if(typeof values.height==="number"){values.height+="px"}else if(typeof values.height==="string"&&values.height.match(/^[0-9]+$/gi)){values.height+="px"}}return values},position:function position(elmt,_position){var elmtToPosition=void 0,posSettings=void 0,elmtToPositionAgainst=void 0,calculatedPosition={left:0,top:0},myXcorrection=0,myYcorrection=0,atXcorrection=0,atYcorrection=0;var defaults={my:"center",at:"center",of:"window",offsetX:"0px",offsetY:"0px"},windowRect={width:document.documentElement.clientWidth,height:window.innerHeight},scrollX=pageXOffset,scrollY=pageYOffset;if(typeof elmt==="string"){elmtToPosition=document.querySelector(elmt)}else{elmtToPosition=elmt}if(!_position){elmtToPosition.style.opacity=1;return elmtToPosition}var elmtToPositionRect=elmtToPosition.getBoundingClientRect();if(typeof _position==="string"){var posValue=_position.match(/\b[a-z]{4,6}-{1}[a-z]{3,6}\b/i),autoposValue=_position.match(/down|up|right([^-]|$)|left([^-]|$)/i),offsetValue=_position.match(/[+-]?\d?\.?\d+([a-z%]{2,4}\b|%?)/gi);var settings=void 0;if(posValue){settings={my:posValue[0].toLowerCase(),at:posValue[0].toLowerCase()}}else{settings={my:"center",at:"center"}}if(autoposValue){settings.autoposition=autoposValue[0].toLowerCase()}if(offsetValue){offsetValue.forEach(function(item,index){if(item.match(/^[+-]?[0-9]*$/)){offsetValue[index]+="px"}offsetValue[index]=offsetValue[index].toLowerCase()});if(offsetValue.length===1){settings.offsetX=offsetValue[0];settings.offsetY=offsetValue[0]}else{settings.offsetX=offsetValue[0];settings.offsetY=offsetValue[1]}}posSettings=Object.assign({},defaults,settings)}else{posSettings=Object.assign({},defaults,_position)}var parentContainer=elmtToPosition.parentElement;var parentContainerStyles=window.getComputedStyle(parentContainer);var parentContainerRect=parentContainer.getBoundingClientRect();var parentContainerTagName=parentContainer.tagName.toLowerCase();if(posSettings.of&&posSettings.of!=="window"){if(typeof posSettings.of==="string"){elmtToPositionAgainst=document.querySelector(posSettings.of)}else{elmtToPositionAgainst=posSettings.of}}if(posSettings.my.match(/^center-top$|^center$|^center-bottom$/i)){myXcorrection=elmtToPositionRect.width/2}else if(posSettings.my.match(/right/i)){myXcorrection=elmtToPositionRect.width}if(posSettings.my.match(/^left-center$|^center$|^right-center$/i)){myYcorrection=elmtToPositionRect.height/2}else if(posSettings.my.match(/bottom/i)){myYcorrection=elmtToPositionRect.height}if(parentContainerTagName==="body"&&posSettings.of==="window"){if(posSettings.at.match(/^center-top$|^center$|^center-bottom$/i)){atXcorrection=windowRect.width/2}else if(posSettings.at.match(/right/i)){atXcorrection=windowRect.width}if(posSettings.at.match(/^left-center$|^center$|^right-center$/i)){atYcorrection=windowRect.height/2}else if(posSettings.at.match(/bottom/i)){atYcorrection=windowRect.height}calculatedPosition.left=atXcorrection-myXcorrection-parseFloat(parentContainerStyles.borderLeftWidth);calculatedPosition.top=atYcorrection-myYcorrection-parseFloat(parentContainerStyles.borderTopWidth);elmtToPosition.style.position="fixed"}else if(parentContainerTagName==="body"&&posSettings.of!=="window"){var elmtToPositionAgainstRect=elmtToPositionAgainst.getBoundingClientRect();if(posSettings.at.match(/^center-top$|^center$|^center-bottom$/i)){atXcorrection=elmtToPositionAgainstRect.width/2+elmtToPositionAgainstRect.left+scrollX}else if(posSettings.at.match(/right/i)){atXcorrection=elmtToPositionAgainstRect.width+elmtToPositionAgainstRect.left+scrollX}else{atXcorrection=elmtToPositionAgainstRect.left+scrollX}if(posSettings.at.match(/^left-center$|^center$|^right-center$/i)){atYcorrection=elmtToPositionAgainstRect.height/2+elmtToPositionAgainstRect.top+scrollY}else if(posSettings.at.match(/bottom/i)){atYcorrection=elmtToPositionAgainstRect.height+elmtToPositionAgainstRect.top+scrollY}else{atYcorrection=elmtToPositionAgainstRect.top+scrollY}calculatedPosition.left=atXcorrection-myXcorrection-parseFloat(parentContainerStyles.borderLeftWidth);calculatedPosition.top=atYcorrection-myYcorrection-parseFloat(parentContainerStyles.borderTopWidth)}else if(parentContainerTagName!=="body"&&(posSettings.of==="window"||!posSettings.of)){var pContainerLRBorderWidth=parseFloat(parentContainerStyles.borderLeftWidth)+parseFloat(parentContainerStyles.borderRightWidth),pContainerTBBorderWidth=parseFloat(parentContainerStyles.borderTopWidth)+parseFloat(parentContainerStyles.borderBottomWidth);if(posSettings.at.match(/^center-top$|^center$|^center-bottom$/i)){atXcorrection=parentContainerRect.width/2-pContainerLRBorderWidth/2}else if(posSettings.at.match(/right/i)){atXcorrection=parentContainerRect.width-pContainerLRBorderWidth}if(posSettings.at.match(/^left-center$|^center$|^right-center$/i)){atYcorrection=parentContainerRect.height/2-pContainerTBBorderWidth/2}else if(posSettings.at.match(/bottom/i)){atYcorrection=parentContainerRect.height-pContainerTBBorderWidth}calculatedPosition.left=atXcorrection-myXcorrection;calculatedPosition.top=atYcorrection-myYcorrection}else if(parentContainerTagName!=="body"&&parentContainer.contains(elmtToPositionAgainst)){var _elmtToPositionAgainstRect=elmtToPositionAgainst.getBoundingClientRect();if(posSettings.at.match(/^center-top$|^center$|^center-bottom$/i)){atXcorrection=_elmtToPositionAgainstRect.left-parentContainerRect.left+_elmtToPositionAgainstRect.width/2}else if(posSettings.at.match(/right/i)){atXcorrection=_elmtToPositionAgainstRect.left-parentContainerRect.left+_elmtToPositionAgainstRect.width}else{atXcorrection=_elmtToPositionAgainstRect.left-parentContainerRect.left}if(posSettings.at.match(/^left-center$|^center$|^right-center$/i)){atYcorrection=_elmtToPositionAgainstRect.top-parentContainerRect.top+_elmtToPositionAgainstRect.height/2}else if(posSettings.at.match(/bottom/i)){atYcorrection=_elmtToPositionAgainstRect.top-parentContainerRect.top+_elmtToPositionAgainstRect.height}else{atYcorrection=_elmtToPositionAgainstRect.top-parentContainerRect.top}calculatedPosition.left=atXcorrection-myXcorrection-parseFloat(parentContainerStyles.borderLeftWidth);calculatedPosition.top=atYcorrection-myYcorrection-parseFloat(parentContainerStyles.borderTopWidth)}if(posSettings.autoposition&&posSettings.my===posSettings.at&&["left-top","center-top","right-top","left-bottom","center-bottom","right-bottom"].indexOf(posSettings.my)>=0){var newClass=posSettings.my+"-"+posSettings.autoposition.toLowerCase();elmtToPosition.classList.add(newClass);var newClassAll=Array.prototype.slice.call(document.querySelectorAll("."+newClass)),ownIndex=newClassAll.indexOf(elmtToPosition);if(newClassAll.length>1){if(posSettings.autoposition==="down"){newClassAll.forEach(function(item,index){if(index>0&&index<=ownIndex){calculatedPosition.top+=newClassAll[--index].getBoundingClientRect().height+jsPanel.autopositionSpacing}})}else if(posSettings.autoposition==="up"){newClassAll.forEach(function(item,index){if(index>0&&index<=ownIndex){calculatedPosition.top-=newClassAll[--index].getBoundingClientRect().height+jsPanel.autopositionSpacing}})}else if(posSettings.autoposition==="right"){newClassAll.forEach(function(item,index){if(index>0&&index<=ownIndex){calculatedPosition.left+=newClassAll[--index].getBoundingClientRect().width+jsPanel.autopositionSpacing}})}else if(posSettings.autoposition==="left"){newClassAll.forEach(function(item,index){if(index>0&&index<=ownIndex){calculatedPosition.left-=newClassAll[--index].getBoundingClientRect().width+jsPanel.autopositionSpacing}})}}}if((posSettings.minLeft||posSettings.minLeft===0)&&typeof posSettings.minLeft==="number"&&calculatedPosition.leftposSettings.maxLeft){calculatedPosition.left=posSettings.maxLeft}if((posSettings.minTop||posSettings.minTop===0)&&typeof posSettings.minTop==="number"&&calculatedPosition.topposSettings.maxTop){calculatedPosition.top=posSettings.maxTop}if(typeof posSettings.modify==="function"){calculatedPosition=posSettings.modify.call(calculatedPosition,calculatedPosition)}if(typeof posSettings.offsetX==="number"){posSettings.offsetX+="px"}if(typeof posSettings.offsetY==="number"){posSettings.offsetY+="px"}elmtToPosition.style.left="calc("+calculatedPosition.left+"px + "+posSettings.offsetX+")";elmtToPosition.style.top="calc("+calculatedPosition.top+"px + "+posSettings.offsetY+")";elmtToPosition.style.opacity=1;elmtToPosition.style.left=window.getComputedStyle(elmtToPosition).left;elmtToPosition.style.top=window.getComputedStyle(elmtToPosition).top;return elmtToPosition},rgbToHsl:function rgbToHsl(r,g,b){r/=255,g/=255,b/=255;var max=Math.max(r,g,b),min=Math.min(r,g,b),h=void 0,s=void 0,l=(max+min)/2;if(max===min){h=s=0}else{var d=max-min;s=l>.5?d/(2-max-min):d/(max+min);switch(max){case r:h=(g-b)/d+(g0&&arguments[0]!==undefined?arguments[0]:jsPanel.ziBase;var val=startValue;return{next:function next(){return val++}}}();Array.prototype.slice.call(document.querySelectorAll(".jsPanel-standard")).sort(function(a,b){return a.style.zIndex-b.style.zIndex}).forEach(function(panel){panel.style.zIndex=jsPanel.zi.next()})},resizeit:function resizeit(elmt){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var opts=Object.assign({},this.defaults.resizeit,options),elmtParent=elmt.parentElement,elmtParentTagName=elmtParent.tagName.toLowerCase(),maxWidth=typeof opts.maxWidth==="function"?opts.maxWidth():opts.maxWidth||1e4,maxHeight=typeof opts.maxHeight==="function"?opts.maxHeight():opts.maxHeight||1e4,minWidth=typeof opts.minWidth==="function"?opts.minWidth():opts.minWidth,minHeight=typeof opts.minHeight==="function"?opts.minHeight():opts.minHeight,resizestart=new CustomEvent("resizestart",{detail:elmt.id}),resize=new CustomEvent("resize",{detail:elmt.id}),resizestop=new CustomEvent("resizestop",{detail:elmt.id});var containment=void 0,resizePanel=void 0,resizestarted=void 0,w=void 0,h=void 0,frames=[];containment=this.pOcontainment(opts.containment);opts.handles.split(",").forEach(function(item){var node=document.createElement("DIV");node.className="jsPanel-resizeit-handle jsPanel-resizeit-"+item.trim();node.style.zIndex=90;elmt.append(node)});Array.prototype.slice.call(elmt.getElementsByClassName("jsPanel-resizeit-handle")).forEach(function(handle){jsPanel.pointerdown.forEach(function(item){handle.addEventListener(item,function(e){e.preventDefault();frames=document.querySelectorAll("iframe");if(frames.length){frames.forEach(function(item){item.style.pointerEvents="none"})}var elmtRect=elmt.getBoundingClientRect(),elmtParentRect=elmtParent.getBoundingClientRect(),elmtParentStyles=window.getComputedStyle(elmtParent,null),elmtParentBLW=parseInt(elmtParentStyles.borderLeftWidth,10),elmtParentBTW=parseInt(elmtParentStyles.borderTopWidth,10),elmtParentPosition=elmtParentStyles.getPropertyValue("position"),startX=e.clientX||e.touches[0].clientX,startY=e.clientY||e.touches[0].clientY,startWidth=elmtRect.width,startHeight=elmtRect.height,resizeHandleClassList=e.target.classList;var startLeft=elmtRect.left,startTop=elmtRect.top,maxWidthEast=1e4,maxWidthWest=1e4,maxHeightSouth=1e4,maxHeightNorth=1e4;elmt.content.style.pointerEvents="none";if(elmtParentTagName!=="body"){startLeft=elmtRect.left-elmtParentRect.left+elmtParent.scrollLeft;startTop=elmtRect.top-elmtParentRect.top+elmtParent.scrollTop}if(elmtParentTagName==="body"&&containment){maxWidthEast=document.documentElement.clientWidth-elmtRect.left;maxHeightSouth=document.documentElement.clientHeight-elmtRect.top;maxWidthWest=elmtRect.width+elmtRect.left;maxHeightNorth=elmtRect.height+elmtRect.top}else{if(containment){if(elmtParentPosition==="static"){maxWidthEast=elmtParentRect.width-elmtRect.left+elmtParentBLW;maxHeightSouth=elmtParentRect.height+elmtParentRect.top-elmtRect.top+elmtParentBTW;maxWidthWest=elmtRect.width+(elmtRect.left-elmtParentRect.left)-elmtParentBLW;maxHeightNorth=elmtRect.height+(elmtRect.top-elmtParentRect.top)-elmtParentBTW}else{maxWidthEast=elmtParent.clientWidth-(elmtRect.left-elmtParentRect.left)+elmtParentBLW;maxHeightSouth=elmtParent.clientHeight-(elmtRect.top-elmtParentRect.top)+elmtParentBTW;maxWidthWest=elmtRect.width+(elmtRect.left-elmtParentRect.left)-elmtParentBLW;maxHeightNorth=elmt.clientHeight+(elmtRect.top-elmtParentRect.top)-elmtParentBTW}}}if(containment){maxWidthWest-=containment[3];maxHeightNorth-=containment[0];maxWidthEast-=containment[1];maxHeightSouth-=containment[2]}var computedStyle=window.getComputedStyle(elmt);var wDif=parseFloat(computedStyle.width)-elmtRect.width,hDif=parseFloat(computedStyle.height)-elmtRect.height,xDif=parseFloat(computedStyle.left)-elmtRect.left,yDif=parseFloat(computedStyle.top)-elmtRect.top;if(elmtParent!==document.body){xDif+=elmtParentRect.left;yDif+=elmtParentRect.top}resizePanel=function resizePanel(evt){if(!resizestarted){document.dispatchEvent(resizestart);if(typeof opts.start==="function"){opts.start.call(elmt,elmt,{width:startWidth,height:startHeight})}jsPanel.front(elmt)}resizestarted=1;document.dispatchEvent(resize);if(resizeHandleClassList.contains("jsPanel-resizeit-e")||resizeHandleClassList.contains("jsPanel-resizeit-se")||resizeHandleClassList.contains("jsPanel-resizeit-ne")){w=startWidth+(evt.clientX||evt.touches[0].clientX)-startX+wDif;if(w>=maxWidthEast){w=maxWidthEast}if(w>=maxWidth){w=maxWidth}else if(w<=minWidth){w=minWidth}elmt.style.width=w+"px"}if(resizeHandleClassList.contains("jsPanel-resizeit-s")||resizeHandleClassList.contains("jsPanel-resizeit-se")||resizeHandleClassList.contains("jsPanel-resizeit-sw")){h=startHeight+(evt.clientY||evt.touches[0].clientY)-startY+hDif;if(h>=maxHeightSouth){h=maxHeightSouth}if(h>=maxHeight){h=maxHeight}else if(h<=minHeight){h=minHeight}elmt.style.height=h+"px"}if(resizeHandleClassList.contains("jsPanel-resizeit-w")||resizeHandleClassList.contains("jsPanel-resizeit-nw")||resizeHandleClassList.contains("jsPanel-resizeit-sw")){w=startWidth+startX-(evt.clientX||evt.touches[0].clientX)+wDif;if(w<=maxWidth&&w>=minWidth&&w<=maxWidthWest){elmt.style.left=startLeft+(evt.clientX||evt.touches[0].clientX)-startX+xDif+"px"}if(w>=maxWidthWest){w=maxWidthWest}if(w>=maxWidth){w=maxWidth}else if(w<=minWidth){w=minWidth}elmt.style.width=w+"px"}if(resizeHandleClassList.contains("jsPanel-resizeit-n")||resizeHandleClassList.contains("jsPanel-resizeit-nw")||resizeHandleClassList.contains("jsPanel-resizeit-ne")){h=startHeight+startY-(evt.clientY||evt.touches[0].clientY)+hDif;if(h<=maxHeight&&h>=minHeight&&h<=maxHeightNorth){elmt.style.top=startTop+(evt.clientY||evt.touches[0].clientY)-startY+yDif+"px"}if(h>=maxHeightNorth){h=maxHeightNorth}if(h>=maxHeight){h=maxHeight}else if(h<=minHeight){h=minHeight}elmt.style.height=h+"px"}if(elmt){elmt.contentResize()}window.getSelection().removeAllRanges();var styles=window.getComputedStyle(elmt),values={left:parseFloat(styles.left),top:parseFloat(styles.top),right:parseFloat(styles.right),bottom:parseFloat(styles.bottom),width:parseFloat(styles.width),height:parseFloat(styles.height)};if(typeof opts.resize==="function"){opts.resize.call(elmt,elmt,values)}};jsPanel.pointermove.forEach(function(item){document.addEventListener(item,resizePanel,false)});window.addEventListener("mouseout",function(e){if(e.relatedTarget===null){jsPanel.pointermove.forEach(function(item){document.removeEventListener(item,resizePanel,false)})}},false)})})});jsPanel.pointerup.forEach(function(item){document.addEventListener(item,function(e){jsPanel.pointermove.forEach(function(item){document.removeEventListener(item,resizePanel,false)});if(e.target.classList&&e.target.classList.contains("jsPanel-resizeit-handle")){var isLeftChange=void 0,isTopChange=void 0;var cl=e.target.className;if(cl.match(/jsPanel-resizeit-nw|jsPanel-resizeit-w|jsPanel-resizeit-sw/i)){isLeftChange=true}if(cl.match(/jsPanel-resizeit-nw|jsPanel-resizeit-n|jsPanel-resizeit-ne/i)){isTopChange=true}if(opts.grid&&Array.isArray(opts.grid)){if(opts.grid.length===1){opts.grid[1]=opts.grid[0]}var cw=parseFloat(elmt.style.width),ch=parseFloat(elmt.style.height),modW=cw%opts.grid[0],modH=ch%opts.grid[1],cx=parseFloat(elmt.style.left),cy=parseFloat(elmt.style.top),modX=cx%opts.grid[0],modY=cy%opts.grid[1];if(modW0&&arguments[0]!==undefined?arguments[0]:{};var cb=arguments[1];var opts=void 0,closetimer=void 0;if(options.config){opts=Object.assign({},this.defaults,options.config,options);delete opts.config}else{opts=Object.assign({},this.defaults,options)}if(!opts.id){opts.id="jsPanel-"+(jsPanel.idCounter+=1)}else if(typeof opts.id==="function"){opts.id=opts.id()}var p=document.getElementById(opts.id);if(p!==null){if(p.classList.contains("jsPanel")){p.front()}var error=new jsPanelError("\nNO NEW PANEL CREATED!\nAn element with the ID <"+opts.id+"> already exists in the document.");try{throw error}catch(e){if(cb){cb.call(e,e)}}return console.error(error.name+":",error.message)}var panelContainer=this.pOcontainer(opts.container,cb);if(panelContainer&&panelContainer.message){return console.error(panelContainer.name+":",panelContainer.message)}opts.maximizedMargin=this.pOcontainment(opts.maximizedMargin);if(opts.dragit&&opts.dragit.snap){if(_typeof(opts.dragit.snap)==="object"){opts.dragit.snap=Object.assign({},this.defaultSnapConfig,opts.dragit.snap)}else{opts.dragit.snap=this.defaultSnapConfig}}opts.template=opts.template||false;var self=opts.template?opts.template:this.createPanelTemplate();self.options=opts;self.status="initialized";self.currentData={};self.header=self.querySelector(".jsPanel-hdr");self.headerbar=self.header.querySelector(".jsPanel-headerbar");self.titlebar=self.header.querySelector(".jsPanel-titlebar");self.headerlogo=self.headerbar.querySelector(".jsPanel-headerlogo");self.headertitle=self.headerbar.querySelector(".jsPanel-title");self.controlbar=self.headerbar.querySelector(".jsPanel-controlbar");self.headertoolbar=self.header.querySelector(".jsPanel-hdr-toolbar");self.content=self.querySelector(".jsPanel-content");self.footer=self.querySelector(".jsPanel-ftr");self.snappableTo=false;self.snapped=false;var jspanelloaded=new CustomEvent("jspanelloaded",{detail:opts.id}),jspanelbeforeclose=new CustomEvent("jspanelbeforeclose",{detail:opts.id}),jspanelclosed=new CustomEvent("jspanelclosed",{detail:opts.id}),jspanelstatuschange=new CustomEvent("jspanelstatuschange",{detail:opts.id}),jspanelbeforenormalize=new CustomEvent("jspanelbeforenormalize",{detail:opts.id}),jspanelnormalized=new CustomEvent("jspanelnormalized",{detail:opts.id}),jspanelbeforemaximize=new CustomEvent("jspanelbeforemaximize",{detail:opts.id}),jspanelmaximized=new CustomEvent("jspanelmaximized",{detail:opts.id}),jspanelbeforeminimize=new CustomEvent("jspanelbeforeminimize",{detail:opts.id}),jspanelminimized=new CustomEvent("jspanelminimized",{detail:opts.id}),jspanelbeforesmallify=new CustomEvent("jspanelbeforesmallify",{detail:opts.id}),jspanelsmallified=new CustomEvent("jspanelsmallified",{detail:opts.id}),jspanelsmallifiedmax=new CustomEvent("jspanelsmallifiedmax",{detail:opts.id}),jspanelbeforeunsmallify=new CustomEvent("jspanelbeforeunsmallify",{detail:opts.id}),jspanelfronted=new CustomEvent("jspanelfronted",{detail:opts.id});var hasCloseBtn=self.querySelector(".jsPanel-btn-close"),hasMaxBtn=self.querySelector(".jsPanel-btn-maximize"),hasNormBtn=self.querySelector(".jsPanel-btn-normalize"),hasSmallBtn=self.querySelector(".jsPanel-btn-smallify"),hasSmallrevBtn=self.querySelector(".jsPanel-btn-smallifyrev"),hasMinBtn=self.querySelector(".jsPanel-btn-minimize");if(hasCloseBtn){jsPanel.pointerup.forEach(function(item){hasCloseBtn.addEventListener(item,function(e){e.preventDefault();self.close()})})}if(hasMaxBtn){jsPanel.pointerup.forEach(function(item){hasMaxBtn.addEventListener(item,function(e){e.preventDefault();self.maximize()})})}if(hasNormBtn){jsPanel.pointerup.forEach(function(item){hasNormBtn.addEventListener(item,function(e){e.preventDefault();self.normalize()})})}if(hasSmallBtn){jsPanel.pointerup.forEach(function(item){hasSmallBtn.addEventListener(item,function(e){e.preventDefault();self.smallify()})})}if(hasSmallrevBtn){jsPanel.pointerup.forEach(function(item){hasSmallrevBtn.addEventListener(item,function(e){e.preventDefault();self.unsmallify()})})}if(hasMinBtn){jsPanel.pointerup.forEach(function(item){hasMinBtn.addEventListener(item,function(e){e.preventDefault();self.minimize()})})}var extensions=jsPanel.extensions;for(var ext in extensions){if(extensions.hasOwnProperty(ext)){self[ext]=extensions[ext]}}self.addToolbar=function(place,tb,callback){if(place==="header"){place=self.headertoolbar}else if(place==="footer"){place=self.footer}if(typeof tb==="string"){place.innerHTML=tb}else if(Array.isArray(tb)){tb.forEach(function(item){if(typeof item==="string"){place.innerHTML+=item}else{place.append(item)}})}else if(typeof tb==="function"){var tool=tb.call(self,self);if(typeof tool==="string"){place.innerHTML=tool}else{place.append(tool)}}else{place.append(tb)}place.classList.add("active");if(place===self.footer){self.content.classList.remove("jsPanel-content-nofooter")}self.contentResize();if(callback){callback.call(self,self)}return self};self.applyBuiltInTheme=function(themeDetails){self.classList.add("jsPanel-theme-"+themeDetails.color);self.header.classList.add("jsPanel-theme-"+themeDetails.color);if(themeDetails.filling){self.content.style.background="";self.content.classList.add("jsPanel-content-"+themeDetails.filling)}if(!opts.headerToolbar){self.content.style.background="";self.content.style.borderTop="1px solid "+self.headertitle.style.color}return self};self.applyArbitraryTheme=function(themeDetails){self.header.style.backgroundColor=themeDetails.colors[0];[".jsPanel-headerlogo",".jsPanel-title",".jsPanel-hdr-toolbar"].forEach(function(item){self.querySelector(item).style.color=themeDetails.colors[3]},self);self.querySelectorAll(".jsPanel-controlbar .jsPanel-btn .jsglyph").forEach(function(item){item.style.color=themeDetails.colors[3]});if(opts.headerToolbar){jsPanel.setStyle(self.headertoolbar,{boxShadow:"0 0 1px "+themeDetails.colors[3]+" inset",width:"calc(100% + 4px)",marginLeft:"-1px"})}else{self.content.style.borderTop="1px solid "+themeDetails.colors[3]}if(themeDetails.filling==="filled"){self.content.style.backgroundColor=themeDetails.colors[0];self.content.style.color=themeDetails.colors[3]}else if(themeDetails.filling==="filledlight"){self.content.style.backgroundColor=themeDetails.colors[1]}return self};self.applyBootstrapTheme=function(themeDetails){var bsTheme=themeDetails.bstheme,bsVersion=$.fn.button.Constructor.VERSION[0];if(bsVersion==="4"){self.classList.add("bg-"+bsTheme)}else{["panel","panel-"+bsTheme].forEach(function(item){self.classList.add(item)});self.header.classList.add("panel-heading")}if(themeDetails.bs==="mdb"){var mdbColor=bsTheme+"-color";if(themeDetails.mdbStyle){mdbColor=mdbColor+"-dark"}self.classList.add(mdbColor)}var pColor=void 0;if(bsVersion==="4"){pColor=window.getComputedStyle(self).backgroundColor.replace(/\s+/g,"")}else{pColor=window.getComputedStyle(self.header).backgroundColor.replace(/\s+/g,"")}if(themeDetails.filling){self.setTheme(pColor+" "+themeDetails.filling)}else{self.setTheme(pColor)}return self};self.applyThemeBorder=function(themeDetails){var bordervalues=opts.border.split(" ");self.style.borderWidth=bordervalues[0];self.style.borderStyle=bordervalues[1];self.style.borderColor=bordervalues[2];self.header.style.borderTopLeftRadius="1px";self.header.style.borderTopRightRadius="1px";if(!themeDetails.bs){if(jsPanel.themes.indexOf(themeDetails.color)===-1){bordervalues[2]?self.style.borderColor=bordervalues[2]:self.style.borderColor=themeDetails.colors[0]}}else{var pColor=void 0;if(window.getComputedStyle(self.header).backgroundColor==="transparent"){pColor=window.getComputedStyle(self).backgroundColor.replace(/\s+/g,"")}else{pColor=window.getComputedStyle(self.header).backgroundColor.replace(/\s+/g,"")}bordervalues[2]?self.style.borderColor=bordervalues[2]:self.style.borderColor=pColor}return self};self.autopositionRemaining=function(){var autoPos=void 0;["left-top-down","left-top-right","center-top-down","right-top-down","right-top-left","left-bottom-up","left-bottom-right","center-bottom-up","right-bottom-up","right-bottom-left"].forEach(function(item){if(self.classList.contains(item)){autoPos=item}});if(autoPos){opts.container.querySelectorAll("."+autoPos).forEach(function(item){item.reposition()})}};self.calcSizeFactors=function(){var styles=window.getComputedStyle(self);if(opts.container===document.body){self.hf=parseFloat(self.style.left)/(document.body.clientWidth-parseFloat(self.style.width));self.vf=parseFloat(self.style.top)/(window.innerHeight-parseFloat(styles.height))}else{var parentStyles=window.getComputedStyle(self.parentElement);self.hf=parseFloat(self.style.left)/(parseFloat(parentStyles.width)-parseFloat(self.style.width));self.vf=parseFloat(self.style.top)/(parseFloat(parentStyles.height)-parseFloat(styles.height))}};self.clearTheme=function(callback){jsPanel.themes.concat(jsPanel.mdbthemes).forEach(function(value){["panel","jsPanel-theme-"+value,"panel-"+value,value+"-color"].forEach(function(item){self.classList.remove(item)});self.header.classList.remove("panel-heading","jsPanel-theme-"+value)},self);self.headertitle.classList.remove("panel-title");self.content.classList.remove("panel-body","jsPanel-content-filled","jsPanel-content-filledlight");self.footer.classList.remove("panel-footer");jsPanel.setStyle(self,{backgroundColor:"",borderWidth:"",borderStyle:"",borderColor:""});jsPanel.setStyle(self.content,{background:"",border:""});jsPanel.setStyle(self.headertoolbar,{boxShadow:"",width:"",marginLeft:""});self.header.style.background="";Array.prototype.slice.call(self.controlbar.querySelectorAll(".jsglyph")).concat([self.headerlogo,self.headertitle,self.headertoolbar,self.content]).forEach(function(item){item.style.color=""});if(callback){callback.call(self,self)}return self};self.close=function(callback){var doClose=function doClose(){var panelId=opts.id;if(closetimer){window.clearTimeout(closetimer)}self.closeChildpanels();if(self.parentNode){self.parentNode.removeChild(self)}if(document.getElementById(panelId)){return false}self.removeMinimizedReplacement();document.dispatchEvent(jspanelclosed);if(callback){callback.call(panelId,panelId)}if(opts.onclosed){opts.onclosed.call(panelId,panelId)}self.autopositionRemaining()};document.dispatchEvent(jspanelbeforeclose);if(opts.onbeforeclose&&opts.onbeforeclose.call(self,self)===false){return self}if(opts.animateOut){if(opts.animateIn){jsPanel.remClass(self,opts.animateIn)}jsPanel.setClass(self,opts.animateOut);self.addEventListener("animationend",function(){doClose()})}else{doClose()}};self.closeChildpanels=function(callback){self.getChildpanels().forEach(function(item){return item.close()});if(callback){callback.call(self,self)}return self};self.contentRemove=function(callback){jsPanel.emptyNode(self.content);if(callback){callback.call(self,self)}return self};self.contentResize=function(callback){var panelStyles=window.getComputedStyle(self),hdrStyles=window.getComputedStyle(self.header),ftrStyles=window.getComputedStyle(self.footer),hdrHeight=!opts.headerRemove?hdrStyles.height:0,ftrHeight=ftrStyles.display==="none"?0:ftrStyles.height;var contentHeight=parseFloat(panelStyles.height)-parseFloat(hdrHeight)-parseFloat(ftrHeight)-parseFloat(panelStyles.borderTopWidth)-parseFloat(panelStyles.borderBottomWidth);self.content.style.height=contentHeight+"px";if(callback){callback.call(self,self)}return self};self.createMinimizedReplacement=function(){var tpl=jsPanel.createMinimizedTemplate(),color=window.getComputedStyle(self.headertitle).color,font=opts.iconfont,controlbar=tpl.querySelector(".jsPanel-controlbar");tpl.style.backgroundColor=window.getComputedStyle(self.header).backgroundColor==="transparent"?window.getComputedStyle(self).backgroundColor:window.getComputedStyle(self.header).backgroundColor;tpl.id=self.id+"-min";tpl.querySelector(".jsPanel-headerbar").replaceChild(self.headerlogo.cloneNode(true),tpl.querySelector(".jsPanel-headerlogo"));tpl.querySelector(".jsPanel-titlebar").replaceChild(self.headertitle.cloneNode(true),tpl.querySelector(".jsPanel-title"));tpl.querySelector(".jsPanel-title").style.color=color;controlbar.style.color=color;self.setIconfont(font,tpl);if(self.dataset.btnnormalize==="enabled"){jsPanel.pointerup.forEach(function(evt){tpl.querySelector(".jsPanel-btn-normalize").addEventListener(evt,function(){self.normalize().removeMinimizedReplacement()})})}else{controlbar.querySelector(".jsPanel-btn-normalize").style.display="none"}if(self.dataset.btnmaximize==="enabled"){jsPanel.pointerup.forEach(function(evt){tpl.querySelector(".jsPanel-btn-maximize").addEventListener(evt,function(){self.maximize().removeMinimizedReplacement()})})}else{controlbar.querySelector(".jsPanel-btn-maximize").style.display="none"}if(self.dataset.btnclose==="enabled"){jsPanel.pointerup.forEach(function(evt){tpl.querySelector(".jsPanel-btn-close").addEventListener(evt,function(){self.removeMinimizedReplacement().close()})})}else{controlbar.querySelector(".jsPanel-btn-close").style.display="none"}return tpl};self.front=function(callback){jsPanel.front(self);document.dispatchEvent(jspanelfronted);if(callback){callback.call(self,self)}if(opts.onfronted){opts.onfronted.call(self,self)}return self};self.getChildpanels=function(){return Array.prototype.slice.call(self.content.querySelectorAll(".jsPanel"))};self.getThemeDetails=function(th){var passedTheme=th.toLowerCase().replace(/ /g,""),theme={color:false,colors:false,filling:false,bs:false,bstheme:false};if(passedTheme.substr(-6,6)==="filled"){theme.filling="filled";theme.color=passedTheme.substr(0,passedTheme.length-6)}else if(passedTheme.substr(-11,11)==="filledlight"){theme.filling="filledlight";theme.color=passedTheme.substr(0,passedTheme.length-11)}else{theme.filling="";theme.color=passedTheme}theme.colors=jsPanel.calcColors(theme.color);if(theme.color.match("-")){var bsVariant=theme.color.split("-");theme.bs=bsVariant[0];theme.bstheme=bsVariant[1];theme.mdbStyle=bsVariant[2]||undefined}return theme};self.isChildpanel=function(){var pp=self.closest(".jsPanel-content");return pp?pp.parentNode:false};self.maximize=function(callback){if(opts.onbeforemaximize&&opts.onbeforemaximize.call(self,self)===false){return self}document.dispatchEvent(jspanelbeforemaximize);var parent=self.parentNode,margins=opts.maximizedMargin;if(parent===document.body){self.style.width=document.documentElement.clientWidth-margins[1]-margins[3]+"px";self.style.height=document.documentElement.clientHeight-margins[0]-margins[2]+"px";self.style.left=margins[3]+"px";self.style.top=margins[0]+"px";if(!opts.position.fixed){self.style.left=window.pageXOffset+margins[3]+"px";self.style.top=window.pageYOffset+margins[0]+"px"}}else{self.style.width=parent.clientWidth-margins[1]-margins[3]+"px";self.style.height=parent.clientHeight-margins[0]-margins[2]+"px";self.style.left=margins[3]+"px";self.style.top=margins[0]+"px"}self.contentResize();self.removeMinimizedReplacement();self.status="maximized";self.setControls([".jsPanel-btn-maximize",".jsPanel-btn-smallifyrev"]);jsPanel.front(self);document.dispatchEvent(jspanelmaximized);document.dispatchEvent(jspanelstatuschange);if(opts.onstatuschange&&opts.onstatuschange.call(self,self)===false){return self}if(callback){callback.call(self,self)}if(opts.onmaximized){opts.onmaximized.call(self,self)}return self};self.minimize=function(callback){if(self.status==="minimized"){return self}if(opts.onbeforeminimize&&opts.onbeforeminimize.call(self,self)===false){return self}document.dispatchEvent(jspanelbeforeminimize);if(!document.getElementById("jsPanel-replacement-container")){var replacementContainer=document.createElement("div");replacementContainer.id="jsPanel-replacement-container";document.body.append(replacementContainer)}self.style.left="-9999px";self.statusBefore=self.status;self.status="minimized";document.dispatchEvent(jspanelminimized);document.dispatchEvent(jspanelstatuschange);if(opts.onstatuschange&&opts.onstatuschange.call(self,self)===false){return self}if(opts.minimizeTo){var replacement=self.createMinimizedReplacement();if(opts.minimizeTo==="default"){document.getElementById("jsPanel-replacement-container").append(replacement)}else{var container=void 0;if(typeof opts.minimizeTo==="string"){if(opts.minimizeTo==="parentpanel"){var parent=self.closest(".jsPanel-content").parentNode,list=parent.querySelectorAll(".jsPanel-minimized-box");container=list[list.length-1]}else{container=document.querySelector(opts.minimizeTo)}}else{container=opts.minimizeTo}container.append(replacement)}}if(callback){callback.call(self,self)}if(opts.onminimized){opts.onminimized.call(self,self)}return self};self.normalize=function(callback){if(self.status==="normalized"){return self}if(opts.onbeforenormalize&&opts.onbeforenormalize.call(self,self)===false){return self}document.dispatchEvent(jspanelbeforenormalize);self.style.width=self.currentData.width;self.style.height=self.currentData.height;self.contentResize();self.style.left=self.currentData.left;self.style.top=self.currentData.top;self.removeMinimizedReplacement();self.status="normalized";self.setControls([".jsPanel-btn-normalize",".jsPanel-btn-smallifyrev"]);jsPanel.front(self);document.dispatchEvent(jspanelnormalized);document.dispatchEvent(jspanelstatuschange);if(opts.onstatuschange&&opts.onstatuschange.call(self,self)===false){return self}if(callback){callback.call(self,self)}if(opts.onnormalized){opts.onnormalized.call(self,self)}return self};self.removeMinimizedReplacement=function(){var elmt=document.getElementById(self.id+"-min");if(elmt){elmt.parentNode.removeChild(elmt)}return self};self.reposition=function(){for(var _len=arguments.length,params=Array(_len),_key=0;_key<_len;_key++){params[_key]=arguments[_key]}var pos=opts.position,updateCache=true,callback=void 0;params.forEach(function(value){if(typeof value==="string"||(typeof value==="undefined"?"undefined":_typeof(value))==="object"){pos=value}else if(typeof value==="boolean"){updateCache=value}else if(typeof value==="function"){callback=value}});jsPanel.position(self,pos);if(updateCache){self.saveCurrentPosition()}if(callback){callback.call(self,self)}return self};self.repositionOnSnap=function(pos){var offsetX="0",offsetY="0";var margins=jsPanel.pOcontainment(opts.dragit.containment);if(opts.dragit.snap.containment){if(pos==="left-top"){offsetX=margins[3];offsetY=margins[0]}else if(pos==="right-top"){offsetX=-margins[1];offsetY=margins[0]}else if(pos==="right-bottom"){offsetX=-margins[1];offsetY=-margins[2]}else if(pos==="left-bottom"){offsetX=margins[3];offsetY=-margins[2]}else if(pos==="center-top"){offsetX=margins[3]/2-margins[1]/2;offsetY=margins[0]}else if(pos==="center-bottom"){offsetX=margins[3]/2-margins[1]/2;offsetY=-margins[2]}else if(pos==="left-center"){offsetX=margins[3];offsetY=margins[0]/2-margins[2]/2}else if(pos==="right-center"){offsetX=-margins[1];offsetY=margins[0]/2-margins[2]/2}}jsPanel.position(self,pos);jsPanel.setStyle(self,{left:"calc("+self.style.left+" + "+offsetX+"px)",top:"calc("+self.style.top+" + "+offsetY+"px)"})};self.resize=function(){for(var _len2=arguments.length,params=Array(_len2),_key2=0;_key2<_len2;_key2++){params[_key2]=arguments[_key2]}var dimensions=window.getComputedStyle(self);var size={width:dimensions.width,height:dimensions.height},updateCache=true,callback=void 0;params.forEach(function(value){if(typeof value==="string"){size=value}else if((typeof value==="undefined"?"undefined":_typeof(value))==="object"){size=Object.assign(size,value)}else if(typeof value==="boolean"){updateCache=value}else if(typeof value==="function"){callback=value}});var values=jsPanel.pOsize(self,size);self.style.width=values.width;self.style.height=values.height;self.contentResize();if(updateCache){self.saveCurrentDimensions()}if(callback){callback.call(self,self)}return self};self.saveCurrentDimensions=function(){var normData=window.getComputedStyle(self);self.currentData.width=normData.width;if(self.status==="normalized"){self.currentData.height=normData.height}};self.saveCurrentPosition=function(){var normData=window.getComputedStyle(self);self.currentData.left=normData.left;self.currentData.top=normData.top};self.setControls=function(sel,callback){self.header.querySelectorAll(".jsPanel-btn").forEach(function(item){item.style.display="block"});sel.forEach(function(item){var btn=self.controlbar.querySelector(item);if(btn){btn.style.display="none"}});if(callback){callback.call(self,self)}return self};self.setControlStatus=function(ctrl){var action=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"enable";var callback=arguments[2];if(action==="disable"){if(self.getAttribute("data-btn"+ctrl)!=="removed"){self.setAttribute("data-btn"+ctrl,"disabled");var btn=self.controlbar.querySelector(".jsPanel-btn-"+ctrl);btn.style.pointerEvents="none";btn.style.opacity=.4;btn.style.cursor="default"}}else if(action==="enable"){if(self.getAttribute("data-btn"+ctrl)!=="removed"){self.setAttribute("data-btn"+ctrl,"enabled");var _btn=self.controlbar.querySelector(".jsPanel-btn-"+ctrl);_btn.style.pointerEvents="auto";_btn.style.opacity=1;_btn.style.cursor="pointer"}}else if(action==="remove"){var _btn2=self.controlbar.querySelector(".jsPanel-btn-"+ctrl);self.controlbar.removeChild(_btn2);self.setAttribute("data-btn"+ctrl,"removed")}if(callback){callback.call(self,self)}return self};self.setHeaderControls=function(callback){var controls=["close","maximize","normalize","minimize","smallify","smallifyrev"],option=opts.headerControls;if(typeof option==="string"){if(option==="none"){controls.forEach(function(item){self.setControlStatus(item,"remove")})}else if(option==="closeonly"){controls.forEach(function(item){if(item!=="close"){self.setControlStatus(item,"remove")}})}}else{controls.forEach(function(item){if(option[item]){self.setControlStatus(item,option[item])}})}if(callback){callback.call(self,self)}return self};self.setHeaderLogo=function(hdrLogo,callback){if(typeof hdrLogo==="string"){if(hdrLogo.substr(0,1)!=="<"){var img=document.createElement("img");img.style.maxHeight=getComputedStyle(self.headerbar).height;img.src=hdrLogo;jsPanel.emptyNode(self.headerlogo);self.headerlogo.append(img)}else{self.headerlogo.innerHTML=hdrLogo}}else{jsPanel.emptyNode(self.headerlogo);self.headerlogo.append(hdrLogo)}if(callback){callback.call(self,self)}return self};self.setHeaderRemove=function(callback){self.removeChild(self.header);self.content.classList.add("jsPanel-content-noheader");["close","maximize","normalize","minimize","smallify","smallifyrev"].forEach(function(item){self.setAttribute("data-btn"+item,"removed")});if(callback){callback.call(self,self)}return self};self.setHeaderTitle=function(hdrTitle,callback){if(typeof hdrTitle==="string"){self.headertitle.innerHTML=hdrTitle}else if(typeof hdrTitle==="function"){jsPanel.emptyNode(self.headertitle);self.headertitle.innerHTML=hdrTitle()}else{jsPanel.emptyNode(self.headertitle);self.headertitle.append(hdrTitle)}if(callback){callback.call(self,self)}return self};self.setIconfont=function(){var font=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"jsglyph";var panel=arguments.length>1&&arguments[1]!==undefined?arguments[1]:self;var callback=arguments[2];if(font!=="jsglyph"){var classArray=void 0,textArray=void 0;if(font==="bootstrap"||font==="glyphicon"){classArray=["glyphicon glyphicon-remove","glyphicon glyphicon-fullscreen","glyphicon glyphicon-resize-full","glyphicon glyphicon-minus","glyphicon glyphicon-chevron-down","glyphicon glyphicon-chevron-up"]}else if(font==="fa"||font==="far"||font==="fal"||font==="fas"){classArray=[font+" fa-window-close",font+" fa-window-maximize",font+" fa-window-restore",font+" fa-window-minimize",font+" fa-chevron-down",font+" fa-chevron-up"]}else if(font==="material-icons"){classArray=[font,font,font,font,font,font];textArray=["close","fullscreen","fullscreen_exit","call_received","expand_more","expand_less"]}else if(Array.isArray(font)){classArray=["custom-control-icon "+font[5],"custom-control-icon "+font[4],"custom-control-icon "+font[3],"custom-control-icon "+font[2],"custom-control-icon "+font[1],"custom-control-icon "+font[0]]}else{return panel}Array.prototype.slice.call(panel.querySelectorAll(".jsPanel-controlbar .jsPanel-btn > span")).reverse().forEach(function(item,i){item.className=classArray[i];if(font==="material-icons"){item.textContent=textArray[i]}})}if(callback){callback.call(panel,panel)}return panel};self.setRtl=function(){[self.header,self.headerbar,self.titlebar,self.controlbar,self.headertoolbar,self.footer].forEach(function(item){item.classList.add("jsPanel-rtl")});[self.headertitle,self.headertoolbar,self.content,self.footer].forEach(function(item){item.dir="rtl";if(opts.rtl.lang){item.lang=opts.rtl.lang}})};self.setSize=function(){if(opts.panelSize){var values=jsPanel.pOsize(self,opts.panelSize);self.style.width=values.width;self.style.height=values.height;self.contentResize()}else if(opts.contentSize){var _values=jsPanel.pOsize(self,opts.contentSize);self.content.style.width=_values.width;self.content.style.height=_values.height;self.style.width=_values.width;self.content.style.width="100%"}return self};self.setTheme=function(){var theme=arguments.length>0&&arguments[0]!==undefined?arguments[0]:opts.theme;var callback=arguments[1];self.clearTheme();if(theme==="none"){self.style.backgroundColor="#fff";return self}var themeDetails=self.getThemeDetails(theme);if(!themeDetails.bs){if(jsPanel.themes.indexOf(themeDetails.color)!==-1){self.applyBuiltInTheme(themeDetails)}else{self.applyArbitraryTheme(themeDetails)}}else{self.applyBootstrapTheme(themeDetails)}if(opts.border){self.applyThemeBorder(themeDetails)}else{self.style.borderWidth="";self.style.borderStyle="";self.style.borderColor=""}if(callback){callback.call(self,self)}return self};self.smallify=function(callback){if(self.status==="smallified"||self.status==="smallifiedmax"){return self}if(opts.onbeforesmallify&&opts.onbeforesmallify.call(self,self)===false){return self}document.dispatchEvent(jspanelbeforesmallify);if(self.status==="normalized"){self.saveCurrentDimensions()}self.style.overflow="hidden";self.style.height=window.getComputedStyle(self.headerbar).height;if(self.status==="normalized"){self.setControls([".jsPanel-btn-normalize",".jsPanel-btn-smallify"]);self.status="smallified";document.dispatchEvent(jspanelsmallified);document.dispatchEvent(jspanelstatuschange);if(opts.onstatuschange&&opts.onstatuschange.call(self,self)===false){return self}}else if(self.status==="maximized"){self.setControls([".jsPanel-btn-maximize",".jsPanel-btn-smallify"]);self.status="smallifiedmax";document.dispatchEvent(jspanelsmallifiedmax);document.dispatchEvent(jspanelstatuschange);if(opts.onstatuschange&&opts.onstatuschange.call(self,self)===false){return self}}if(callback){callback.call(self,self)}if(opts.onsmallified){opts.onsmallified.call(self,self)}return self};self.unsmallify=function(callback){if(self.status==="smallified"||self.status==="smallifiedmax"){if(opts.onbeforeunsmallify&&opts.onbeforeunsmallify.call(self,self)===false){return self}document.dispatchEvent(jspanelbeforeunsmallify);self.style.overflow="visible";jsPanel.front(self);if(self.status==="smallified"){self.style.height=self.currentData.height;self.setControls([".jsPanel-btn-normalize",".jsPanel-btn-smallifyrev"]);self.status="normalized";document.dispatchEvent(jspanelnormalized);document.dispatchEvent(jspanelstatuschange);if(opts.onstatuschange&&opts.onstatuschange.call(self,self)===false){return self}}else if(self.status==="smallifiedmax"){self.maximize()}else if(self.status==="minimized"){self.normalize()}if(callback){callback.call(self,self)}if(opts.onunsmallified){opts.onunsmallified.call(self,self)}}return self};self.dragit=function(string){var dragitOptions=Object.assign({},jsPanel.defaults.dragit,opts.dragit),handles=self.querySelectorAll(dragitOptions.handles);if(string==="disable"){handles.forEach(function(handle){handle.style.pointerEvents="none"})}else{handles.forEach(function(handle){handle.style.pointerEvents="auto"})}return self};self.resizeit=function(string){var handles=self.querySelectorAll(".jsPanel-resizeit-handle");if(string==="disable"){handles.forEach(function(handle){handle.style.pointerEvents="none"})}else{handles.forEach(function(handle){handle.style.pointerEvents="auto"})}return self};self.id=opts.id;self.classList.add("jsPanel-"+opts.paneltype);if(opts.paneltype==="standard"){self.style.zIndex=this.zi.next()}panelContainer.append(self);self.setTheme(opts.theme);if(opts.boxShadow){self.classList.add("jsPanel-depth-"+opts.boxShadow)}if(!opts.headerRemove){if(opts.headerLogo){self.setHeaderLogo(opts.headerLogo)}self.setIconfont(opts.iconfont);self.setHeaderTitle(opts.headerTitle);self.setHeaderControls()}else{self.setHeaderRemove()}if(opts.headerToolbar){self.addToolbar(self.headertoolbar,opts.headerToolbar)}if(opts.footerToolbar){self.addToolbar(self.footer,opts.footerToolbar)}if(opts.content){if(typeof opts.content==="function"){opts.content.call(self,self)}else if(typeof opts.content==="string"){self.content.innerHTML=opts.content}else{self.content.append(opts.content)}}if(opts.contentAjax){this.ajax(self)}if(opts.contentFetch){this.fetch(self)}if(opts.rtl){self.setRtl()}self.setSize();self.status="normalized";if(opts.position||opts.position!=="cursor"){this.position(self,opts.position)}else{self.style.opacity=1}document.dispatchEvent(jspanelnormalized);document.dispatchEvent(jspanelstatuschange);if(opts.onstatuschange&&opts.onstatuschange.call(self,self)===false){return self}self.calcSizeFactors();if(opts.animateIn){self.addEventListener("animationend",function(){_this.remClass(self,opts.animateIn)});this.setClass(self,opts.animateIn)}if(opts.syncMargins){var containment=this.pOcontainment(opts.maximizedMargin);if(opts.dragit){opts.dragit.containment=containment;if(opts.dragit.snap){opts.dragit.snap.containment=true}}if(opts.resizeit){opts.resizeit.containment=containment}}if(opts.dragit){this.dragit(self,opts.dragit);document.addEventListener("dragstop",function(e){if(e.detail===self.id){self.calcSizeFactors()}},false)}else{self.titlebar.style.cursor="default"}if(opts.resizeit){this.resizeit(self,opts.resizeit);var startstatus=void 0;document.addEventListener("resizestart",function(e){if(e.detail===self.id){startstatus=self.status}},false);document.addEventListener("resizestop",function(e){if(e.detail===self.id){if((startstatus==="smallified"||startstatus==="smallifiedmax"||startstatus==="maximized")&&parseFloat(self.style.height)>parseFloat(window.getComputedStyle(self.header).height)){self.setControls([".jsPanel-btn-normalize",".jsPanel-btn-smallifyrev"]);self.status="normalized";document.dispatchEvent(jspanelnormalized);document.dispatchEvent(jspanelstatuschange);if(opts.onstatuschange&&opts.onstatuschange.call(self,self)===false){return self}self.calcSizeFactors()}}},false)}self.saveCurrentDimensions();self.saveCurrentPosition();if(opts.setStatus){var newStatus=opts.setStatus;if(newStatus==="smallifiedmax"){self.maximize().smallify()}else if(newStatus==="smallified"){self.smallify()}else{var func=newStatus.substr(0,newStatus.length-1);self[func]()}}if(opts.autoclose){closetimer=window.setTimeout(function(){if(self)self.close()},opts.autoclose)}this.pointerdown.forEach(function(item){self.addEventListener(item,function(e){if(!e.target.closest(".jsPanel-btn-close")&&!e.target.closest(".jsPanel-btn-minimize")&&opts.paneltype==="standard"){self.front()}},false)});if(opts.onwindowresize){window.addEventListener("resize",function(e){if(e.target===window){var param=opts.onwindowresize,status=self.status,parentStyles=window.getComputedStyle(self.parentNode);if(status==="maximized"&¶m===true){self.maximize()}else if(status==="normalized"||status==="smallified"||status==="maximized"){if(typeof param==="function"){param.call(self,e,self)}else{self.style.left=function(){var l=void 0;if(opts.container===document.body){l=(document.body.clientWidth-parseFloat(self.style.width))*self.hf}else{l=(parseFloat(parentStyles.width)-parseFloat(self.style.width))*self.hf}return l<=0?0:l+"px"}();self.style.top=function(){var t=void 0;if(opts.container===document.body){t=(window.innerHeight-parseFloat(self.currentData.height))*self.vf}else{t=(parseFloat(parentStyles.height)-parseFloat(self.currentData.height))*self.vf}return t<=0?0:t+"px"}()}}}},false)}this.pointerup.forEach(function(item){self.addEventListener(item,function(){self.content.style.pointerEvents="inherit"})});if(opts.callback&&Array.isArray(opts.callback)){opts.callback.forEach(function(item){item.call(self,self)})}else if(opts.callback){opts.callback.call(self,self)}if(cb){cb.call(self,self)}document.dispatchEvent(jspanelloaded);return self}};jsPanel.zi=function(){var startValue=arguments.length>0&&arguments[0]!==undefined?arguments[0]:jsPanel.ziBase;var val=startValue;return{next:function next(){return val++}}}();if(window.PointerEvent){jsPanel.pointerdown=["pointerdown"];jsPanel.pointermove=["pointermove"];jsPanel.pointerup=["pointerup"]}else{if("ontouchend"in window){jsPanel.pointerdown=["touchstart","mousedown"];jsPanel.pointermove=["touchmove","mousemove"];jsPanel.pointerup=["touchend","mouseup"]}else{jsPanel.pointerdown=["mousedown"];jsPanel.pointermove=["mousemove"];jsPanel.pointerup=["mouseup"]}}document.addEventListener("keydown",function(e){if(e.key==="Escape"||e.code==="Esc"||e.keyCode===27){jsPanel.getPanels(function(){return this.classList.contains("jsPanel")}).some(function(item){if(item.options.closeOnEscape){item.close();return true}return false})}},false);