var WUI_Dialog=new function(){"use strict";var a=this,b={},c=null,d=null,e=null,f=0,g=0,h=0,i=0,j=null,k=[],l={dialog:"wui-dialog",content:"wui-dialog-content",btn:"wui-dialog-btn",btn_close:"wui-dialog-close",detach:"wui-dialog-detach",minimized:"wui-dialog-minimized",minimize:"wui-dialog-minimize",maximize:"wui-dialog-maximize",header:"wui-dialog-header",open:"wui-dialog-open",closed:"wui-dialog-closed",draggable:"wui-dialog-draggable",transition:"wui-dialog-transition",dim_transition:"wui-dialog-dim-transition",modal:"wui-dialog-modal",status_bar:"wui-dialog-status-bar"},m={title:"",width:"80%",height:"40%",open:!0,closable:!0,minimizable:!1,draggable:!1,resizable:!1,detachable:!1,min_width:"title",min_height:32,status_bar:!1,status_bar_content:"",keep_align_when_resized:!1,halign:"left",valign:"top",top:0,left:0,modal:!1,minimized:!1,on_close:null,on_detach:null,on_resize:null};Element.prototype._addEventListener||(Element.prototype._addEventListener=Element.prototype.addEventListener,Element.prototype.addEventListener=function(a,b,c){this._addEventListener(a,b,c),this.eventListenerList||(this.eventListenerList={}),this.eventListenerList[a]||(this.eventListenerList[a]=[]),this.eventListenerList[a].push(b)},Element.prototype._removeEventListener=Element.prototype.removeEventListener,Element.prototype.removeEventListener=function(a,b,c){if(this.eventListenerList){var d,e=this.eventListenerList[a];if(e)for(d=0;e.length>d;d+=1)if(e[d]===b){e.splice(d,1);break}}this._removeEventListener(a,b,c)});var n=function(a){for(var b=0;k.length>b;b+=1)if(k[b]===a.detachable_ref){k.splice(b,1);break}},o=function(a,c,d,e){var f,g,h,i,j=b[a.id];if(j){if(c&&j.detachable_ref&&(j.detachable_ref.closed||j.detachable_ref.close(),n(j)),e&&j.modal_element)for(document.body.removeChild(j.modal_element),g=0;k.length>g;g+=1)for(i=k[g],f=i.document.body.getElementsByClassName(l.modal),h=0;f.length>h;h+=1)i.document.body.removeChild(f[h]);j.dialog.classList.contains(l.open)&&(a.classList.add(l.closed),a.classList.remove(l.open),d&&null!==j.opts.on_close&&j.opts.on_close())}},p=function(a){var c=0,d=null,e=null,f=b[a.id];if(!f.opts.modal){for(var g in b)b.hasOwnProperty(g)&&(d=b[g].dialog,isNaN(d.style.zIndex)||(c=parseInt(d.style.zIndex,10),c>100&&(d.style.zIndex=100)));for(e=f.dialog.parentElement;null!==e;)e.classList.contains(l.dialog)&&(e.style.zIndex=101),e=e.parentElement;a.style.zIndex=101}},q=function(a){var b=document.createElement("div");return b.className="wui-dialog-modal",b.addEventListener("click",function(b){b.preventDefault(),o(a,!0,!0,!0)}),b.style.zIndex=16777270,b},r=function(a){var c=b[a.id],d=c.opts,e=a.parentElement.offsetWidth,f=a.parentElement.offsetHeight,g=a.offsetWidth,h=a.offsetHeight;a.style.left="center"===d.halign?Math.round((e-g)/2+d.left)+"px":"right"===d.halign?e-g+d.left+"px":d.left+"px",a.style.top="center"===d.valign?Math.round((f-h)/2+d.top)+"px":"bottom"===d.valign?f-h+d.top+"px":d.top+"px"},s=function(a,c){var d=b[c.id],e=d.resize_handler;d.dialog!==c&&s(d.header_minimaxi_btn,d.dialog),a.classList.toggle(l.minimize),a.classList.toggle(l.maximize),c.classList.toggle(l.minimized),c.classList.contains(l.minimized)?(c.style.borderStyle="solid",c.style.borderColor="#808080",c.style.borderWidth="1px"):(c.style.borderStyle="",c.style.borderColor="",c.style.borderWidth=""),e&&e.classList.toggle(l.open),d.status_bar&&d.status_bar.classList.toggle(l.open)},t=function(a){null===j&&(j=setTimeout(function(){j=null;var c,d,e,f,g,h,i,k=document;if(a)for(k=a.document,c=k.getElementsByClassName(l.content),i=0;c.length>i;i+=1)e=c[i],f=e.parentElement,d=b[f.id],g=f.getElementsByClassName(l.status_bar),e.style.height=g.length>0?a.innerHeight-32+"px":a.innerHeight+"px",h=e.getBoundingClientRect(),d.opts.on_resize&&d.opts.on_resize(h.width,h.height);else for(c=k.getElementsByClassName(l.content),i=0;c.length>i;i+=1)e=c[i],f=e.parentElement,g=f.getElementsByClassName(l.status_bar),e.style.height=g.length>0?f.offsetHeight-64+"px":f.offsetHeight-32+"px",r(f),h=e.getBoundingClientRect(),d=b[f.id],d.opts.on_resize&&d.opts.on_resize(h.width,h.height)},125))},u=function(a,b){var c,d;do{if(1==a.nodeType&&a.eventListenerList)for(c in a.eventListenerList)if("length"!==c&&a.eventListenerList.hasOwnProperty(c))for(d=0;a.eventListenerList[c].length>d;d+=1)b.addEventListener(c,a.eventListenerList[c][d],!1);a.hasChildNodes()&&u(a.firstChild,b.firstChild),a=a.nextSibling,b=b.nextSibling}while(a&&b)},v=function(a){var c,d,e,f,g,h,i,j=b[a.id],m=a.firstElementChild.firstElementChild.firstElementChild,n=m.textContent||m.innerText||"",p=j.detachable_ref,q=a.getBoundingClientRect();for(a.classList.contains(l.minimized)?(c=parseInt(a.style.width,10),d=parseInt(a.style.height,10)-32):(c=q.width,d=q.height-32),e=void 0!==window.screenLeft?window.screenLeft:screen.left,f=void 0!==window.screenTop?window.screenTop:screen.top,o(a,!0,!1,!1),p=window.open("",n,["toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes","width="+c,"height="+d,"top="+(q.top+f+32),"left="+(q.left+e)].join(",")),j.detachable_ref=p,h="",g=document.head.getElementsByTagName("link"),i=0;g.length>i;i+=1)"text/css"===g[i].type&&"stylesheet"===g[i].rel&&(h+=g[i].outerHTML);for(g=document.head.getElementsByTagName("style"),i=0;g.length>i;i+=1)h+=g[i].outerHTML;p.document.open(),p.document.write("<html><head>"+("<title>"+n+"</title>")+h+"</head>"+('<body id="'+a.id+'" class="wui-dialog-detach-window-body" onload="parent.opener.WUI_Dialog.childWindowLoaded(document.body.id)">')+"</body></html>"),p.document.close(),p.document.body.appendChild(a.children[1].cloneNode(!0));var r=a.getElementsByClassName(l.status_bar);if(r.length>0){var s=r[0].cloneNode(!0);s.classList.add(l.open),p.document.body.appendChild(s)}p.addEventListener("keyup",function(b){27===b.keyCode&&o(a,!0,!0,!0)},!1),p.addEventListener("resize",function(){t(p)},!1),p.addEventListener("beforeunload",function(){o(a,!0,!0,!0)},!1),k.push(p)},w=function(a){a.preventDefault();var b=a.target,c=null;b.classList.contains(l.btn_close)?(c=b.parentElement.parentElement,o(c,!1,!0,!0)):b.classList.contains(l.maximize)||b.classList.contains(l.minimize)?(c=b.parentElement.parentElement,s(b,c)):b.classList.contains(l.detach)&&(c=b.parentElement.parentElement,v(c))},x=function(c){if(27===c.keyCode){var d,e;for(d in b)if(b.hasOwnProperty(d)&&(e=b[d],e.opts.closable&&"101"===e.dialog.style.zIndex&&e.dialog.classList.contains(l.open)))return void a.close(d,!0)}},y=function(a){if(c){a.preventDefault();var d,h,i,j=b[c.id],k=a.clientX,l=a.clientY,m=a.changedTouches,n=null;if(m)for(d=0;m.length>d;d+=1)if(n=m[d],n.identifier===e){k=m[d].clientX,l=m[d].clientY;break}h=k-f,i=l-g,c.style.left=h+"px",c.style.top=i+"px",j.dialog!==c&&(j.dialog.style.left=h+"px",j.dialog.style.top=i+"px")}},z=function(a){if(c){var b,d=a.changedTouches,f=null,g=c.ownerDocument,h=g.defaultView||g.parentWindow;if(d){for(b=0;d.length>b;b+=1)if(f=d[b],f.identifier===e){c=null,g.body.style.cursor="default",h.removeEventListener("touchmove",y,!1),h.removeEventListener("touchend",z,!1);break}}else c=null,g.body.style.cursor="default",h.removeEventListener("mousemove",y,!1),h.removeEventListener("mouseup",z,!1)}},A=function(a){var b,d,h,i=a.clientX,j=a.clientY,k=0,m=0,n=a.changedTouches;if(a.preventDefault(),null===c)if(n)e=n[0].identifier,i=n[0].clientX,j=n[0].clientY;else if(0!==a.button)return;h=a.target.parentElement,!h.classList.contains(l.maximize)&&h.classList.contains(l.draggable)&&(c=h,b=c.ownerDocument,d=b.defaultView||b.parentWindow,p(c),b.body.style.cursor="move",k=parseInt(c.style.left,10),m=parseInt(c.style.top,10),f=i-k,g=j-m,d.addEventListener("mousemove",y,!1),d.addEventListener("touchmove",y,!1),d.addEventListener("mouseup",z,!1),d.addEventListener("touchend",z,!1))},B=function(a){a.preventDefault(),a.stopPropagation();var b=a.target.parentElement,c=b.offsetLeft,f=b.offsetTop,g=a.changedTouches,j=b.ownerDocument,k=j.defaultView||j.parentWindow;g&&(e=g[0].identifier),h=c,i=f,b.classList.remove(l.dim_transition),k.addEventListener("mousemove",C,!1),k.addEventListener("touchmove",C,!1),k.addEventListener("mouseup",D,!1),k.addEventListener("touchend",D,!1),d=b},C=function(a){a.preventDefault();var c,f,g=a.clientX,j=a.clientY,k=a.changedTouches,m=null,n=b[d.id],o=null,p=null,q=0,s=0,t=0;if(k)for(s=0;k.length>s;s+=1)if(m=k[s],m.identifier===e){g=k[s].clientX,j=k[s].clientY;break}for(c=g-h,f=j-i,p=d.firstElementChild.firstElementChild.firstElementChild,q=p.offsetWidth+148,"title"===n.opts.min_width&&q>c?c=q:n.opts.min_width>c&&(c=n.opts.min_width),n.opts.status_bar&&(t=32),n.opts.min_height+t>f&&(f=n.opts.min_height+t),d.style.width=c+"px",d.classList.contains(l.minimized)||(d.style.height=f+"px"),o=d.getElementsByClassName(l.content),s=0;o.length>s;s+=1){var u,v=o[s],w=b[v.parentElement.id];v.style.height=d.offsetHeight-32-t+"px",u=v.getBoundingClientRect(),w.opts.on_resize&&w.opts.on_resize(u.width,u.height),n.opts.keep_align_when_resized&&r(d)}},D=function(a){var b=d.ownerDocument,c=b.defaultView||b.parentWindow;a.preventDefault(),d.classList.add(l.dim_transition),c.removeEventListener("mousemove",C,!1),c.removeEventListener("touchmove",C,!1),c.removeEventListener("mouseup",D,!1),c.removeEventListener("touchend",D,!1),d=null},E=function(){for(var a in b)b.hasOwnProperty(a)&&o(b[a].dialog,!0,!1,!0)};this.create=function(a,c){var d,e={};if(void 0!==b[a])return void console.log("WUI_Dialog id '"+a+"' already created, aborting.");for(d in m)m.hasOwnProperty(d)&&(e[d]=m[d]);if(void 0!==c)for(d in c)c.hasOwnProperty(d)&&void 0!==m[d]&&(e[d]=c[d]);var f=document.getElementById(a),g=document.createElement("div"),h=null,i=null,j=null,k=null,n=null,o=null,q=null;if(null===f)return void("undefined"!=typeof console&&console.log('WUI dialog create, unknow element with id "'+a+'".'));var u=f.firstElementChild;return null===u&&(u=document.createElement("div"),f.appendChild(u)),f.style.width=e.width,f.style.height=e.height,f.classList.add(l.dialog),u.classList.add(l.content),g.className=l.header,u.style.height=e.status_bar?f.offsetHeight-64+"px":f.offsetHeight-32+"px",o=document.createElement("div"),n=document.createElement("div"),o.style.display="inline-block",n.className="wui-dialog-title",o.innerHTML=e.title,n.appendChild(o),g.appendChild(n),f.classList.add(e.open?l.open:l.closed),e.draggable&&(f.classList.toggle(l.draggable),g.addEventListener("mousedown",A,!1),g.addEventListener("touchstart",A,!1)),e.closable&&(j=document.createElement("div"),j.className=l.btn+" "+l.btn_close,j.title="Close",g.appendChild(j)),e.minimizable&&(k=document.createElement("div"),k.className=l.btn+" "+l.minimize,e.minimized&&s(k,f),g.appendChild(k)),e.detachable&&(i=document.createElement("div"),i.className=l.btn+" "+l.detach,i.title="Detach",g.appendChild(i)),e.status_bar&&(q=document.createElement("div"),q.classList.add(l.status_bar),q.classList.add(l.transition),q.classList.add(l.open),q.innerHTML=e.status_bar_content,f.appendChild(q)),g.addEventListener("click",w,!1),g.addEventListener("touchstart",w,!1),window.addEventListener("resize",function(){t(!1)},!1),window.addEventListener("beforeunload",E,!1),f.classList.add(l.transition),f.classList.add(l.dim_transition),f.insertBefore(g,u),e.resizable&&(h=document.createElement("div"),h.addEventListener("mousedown",B,!1),h.addEventListener("touchstart",B,!1),h.classList.add("wui-dialog-resize"),h.classList.add(l.transition),h.classList.add(l.open),f.appendChild(h)),b[a]={dialog:f,minimized_id:-1,resize_handler:h,header_minimaxi_btn:k,opts:e,detachable_ref:null,modal_element:null,status_bar:q},r(f),p(f),a},this.setStatusBarContent=function(a,c){var d,e,f=b[a];return void 0===f?void("undefined"!=typeof console&&console.log('Cannot setStatusBarContent of WUI dialog "'+a+'".')):void(f.status_bar&&(f.status_bar.innerHTML=c,e=f.detachable_ref,e&&(e.closed||(d=e.document.body.getElementsByClassName(l.status_bar),d.length>0&&(d[0].innerHTML=c)))))},this.open=function(a,c){var d,e,f,g=b[a];if(void 0===g)return void("undefined"!=typeof console&&console.log('Cannot open WUI dialog "'+a+'".'));if(g.detachable_ref&&!g.detachable_ref.closed)return void g.detachable_ref.focus();if(f=g.dialog,g.opts.modal)for(d=q(f),g.dialog.style.zIndex=16777271,g.modal_element=d,document.body.appendChild(d),e=0;k.length>e;e+=1)d=q(f),k[e].document.body.appendChild(d);return c?void v(f):(f.classList.remove(l.closed),f.classList.add(l.open),void p(f))},this.focus=function(a){var c=b[a];return void 0===c?void("undefined"!=typeof console&&console.log('Cannot focus WUI dialog "'+a+'".')):void p(c.dialog)},this.close=function(a,c){var d=b[a];return void 0===d?void("undefined"!=typeof console&&console.log('Cannot close WUI dialog "'+a+'".')):void o(d.dialog,!0,c,!0)},this.destroy=function(a){var c,d=b[a];return void 0===d?void console.log("Element id '"+a+"' is not a WUI_Dialog, destroying aborted."):(o(d.dialog,!0,!1,!0),c=d.dialog,c.parentElement.removeChild(c),void delete b[a])},this.childWindowLoaded=function(a){var c=b[a],d=c.detachable_ref;d&&(d.document.body.firstElementChild?(u(c.dialog.children[1],d.document.body.firstElementChild),c.opts.on_detach&&c.opts.on_detach(d)):window.setTimeout(function(){WUI_Dialog.childWindowLoaded(a)},500))},document.addEventListener("keyup",x,!1)},WUI_DropDown=new function(){"use strict";var a={},b={dropdown:"wui-dropdown",item:"wui-dropdown-item",content:"wui-dropdown-content",selected:"wui-dropdown-selected",open:"wui-dropdown-open",on:"wui-dropdown-on"},c={width:"auto",height:24,ms_before_hiding:2e3,vertical:!1,vspacing:0,selected_id:0,on_item_selected:null},d=function(a){var b=a.ownerDocument,c=a.getBoundingClientRect(),d=b.body,e=b.documentElement,f=b.defaultView||b.parentWindow,g=f.pageYOffset||e.scrollTop||d.scrollTop,h=f.pageXOffset||e.scrollLeft||d.scrollLeft,i=e.clientTop||d.clientTop||0,j=e.clientLeft||d.clientLeft||0,k=c.top+g-i,l=c.left+h-j;return{top:Math.round(k),left:Math.round(l)}},e=function(a,c){var d,e=a.createElement("div"),f=null,g="";for(d=0;c.content_array.length>d;d+=1)g=c.content_array[d],f=a.createElement("div"),c.opts.vertical||f.classList.add("wui-dropdown-horizontal"),f.classList.add(b.item),f.innerHTML=g,f.dataset.index=d,e.appendChild(f),f.addEventListener("click",h,!1),g===c.content_array[c.selected_id]&&f.classList.add(b.selected);e.addEventListener("mouseover",i,!1),e.classList.add(b.content),e.dataset.linkedto=c.element.id,a.body.appendChild(e),c.floating_content=e},f=function(a,c,d){c.classList.remove(b.on),d.floating_content&&d.floating_content.parentElement===a.body&&a.body.removeChild(d.floating_content),d.floating_content=null,d.close_timeout=null},g=function(c){c.preventDefault(),c.stopPropagation();var d=c.target,e=null,g=null;d.classList.contains(b.dropdown)&&(e=a[d.id],g=e.floating_content,g?g.classList.contains(b.open)&&f(c.target.ownerDocument,d,e):i(c))},h=function(c){c.preventDefault(),c.stopPropagation();var d,e,g=c.target,h=null,i=null;if(g.classList.contains(b.item)){for(h=g.parentElement,d=a[h.dataset.linkedto],i=h.getElementsByTagName("div"),e=0;i.length>e;e+=1)i[e].classList.remove(b.selected);g.classList.add(b.selected),d.selected_id=parseInt(g.dataset.index,10),d.target_element.lastElementChild.innerHTML=g.textContent,d.element!==d.target_element&&(d.element.lastElementChild.innerHTML=g.textContent),void 0!==d.opts.on_item_selected&&d.opts.on_item_selected(g.dataset.index),f(g.ownerDocument,d.target_element,d)}},i=function(c){c.preventDefault(),c.stopPropagation();var f=c.target,g=null,h=null,i=null,k=f.ownerDocument,l=k.defaultView||k.parentWindow;if(f.classList.contains(b.dropdown))g=a[f.id],null===g.floating_content&&(f.classList.add(b.on),e(k,g),i=g.floating_content,h=d(f),i.style.top=h.top-i.offsetHeight-g.opts.vspacing+"px",i.style.left=h.left+"px",i.classList.add(b.open),g.target_element=f);else if(f.classList.contains(b.content))g=a[f.dataset.linkedto];else{if(!f.classList.contains(b.item))return;g=a[f.parentElement.dataset.linkedto]}l.clearTimeout(g.close_timeout),f.addEventListener("mouseleave",j,!1)},j=function(c){c.preventDefault();var d=c.target,e=null,g=d.ownerDocument,h=g.defaultView||g.parentWindow;e=d.classList.contains(b.content)?a[d.dataset.linkedto]:d.classList.contains(b.item)?a[d.parentElement.dataset.linkedto]:a[d.id],e.close_timeout=h.setTimeout(f,e.opts.ms_before_hiding,g,e.target_element,e),d.removeEventListener("mouseleave",j,!1)};this.create=function(d,e,f){var h,j=document.getElementById(d),k={};if(void 0!==a[d])return void console.log("WUI_DropDown id '"+d+"' already created, aborting.");for(h in c)c.hasOwnProperty(h)&&(k[h]=c[h]);if(void 0!==e)for(h in e)e.hasOwnProperty(h)&&void 0!==c[h]&&(k[h]=e[h]);j.classList.add(b.dropdown),j.style.width=k.width,j.style.height=k.height;var l=document.createElement("div");l.classList.add("wui-dropdown-icon"),j.appendChild(l);var m=document.createElement("div");m.classList.add("wui-dropdown-text"),0!==f.length&&(m.innerHTML=f[k.selected_id]),j.appendChild(m),j.addEventListener("click",g,!1),j.addEventListener("mouseover",i,!1);var n={element:j,floating_content:null,selected_id:k.selected_id,content_array:f,opts:k,button_item:m,hover_count:0,target_element:null,close_timeout:null};return a[d]=n,d},this.destroy=function(b){var c,d=a[b];return void 0===d?void console.log("Element id '"+b+"' is not a WUI_DropDown, destroying aborted."):(c=d.element,f(document,c,d),c.parentElement.removeChild(c),void delete a[b])}},WUI_RangeSlider=new function(){"use strict";var a={},b=null,c=null,d=null,e=null,f="_wui_container",g={hook:"wui-rangeslider-hook",bar:"wui-rangeslider-bar",filler:"wui-rangeslider-filler",hook_focus:"wui-rangeslider-hook-focus",value_input:"wui-rangeslider-input"},h={width:148,height:8,title:"",title_min_width:0,value_min_width:0,min:0,max:1,step:.01,scroll_step:.01,vertical:!1,title_on_top:!1,on_change:null,default_value:.5,configurable:null},i={min:0,max:0,step:0,scroll_step:0},j=function(a){var b=a.ownerDocument,c=a.getBoundingClientRect(),d=b.body,e=b.documentElement,f=b.defaultView||b.parentWindow,g=f.pageYOffset||e.scrollTop||d.scrollTop,h=f.pageXOffset||e.scrollLeft||d.scrollLeft,i=e.clientTop||d.clientTop||0,j=e.clientLeft||d.clientLeft||0,k=c.top+g-i,l=c.left+h-j;return{top:Math.round(k),left:Math.round(l)}},k=function(a,b){null!==a&&a(b)},l=function(a,b){var c=""+a,d=c.indexOf("."),e=-1==d?c.length:1+d+b,f=c.substr(0,e),g=isNaN(f)?0:f;return parseFloat(g)},m=function(a){return a.classList.contains(g.hook)?a:a.classList.contains(g.filler)?a.firstElementChild:a.firstElementChild.firstElementChild},n=function(b,c,d){var e=b,f=a[e.id],h=e.getElementsByClassName(g.bar)[0],i=h.firstElementChild,j=i.firstElementChild,k=h.nextElementSibling,m=c.opts.width,n=c.opts.height,o=Math.abs((d-c.opts.min)/c.opts.range);d=l(d,4),c.opts.vertical?(o=Math.round(o*h.offsetHeight),i.style.position="absolute",i.style.bottom="0",i.style.width="100%",i.style.height=o+"px",j.style.marginTop=-m+"px",j.style.marginLeft=-m/2-1+"px",j.style.width=2*m+"px",j.style.height=2*m+"px",k.style.marginTop="13px",f.element!==e&&(f.filler.style.position="absolute",f.filler.style.bottom="0",f.filler.style.width="100%",f.filler.style.height=o+"px",f.hook.style.marginTop=-m+"px",f.hook.style.marginLeft=-m/2-1+"px",f.hook.style.width=2*m+"px",f.hook.style.height=2*m+"px",f.value_input.style.marginTop="13px")):(o=Math.round(o*m),i.style.width=o+"px",i.style.height="100%",j.style.left=o+"px",j.style.marginTop=-n/2+"px",j.style.marginLeft=-n+"px",j.style.width=2*n+"px",j.style.height=2*n+"px",f.element!==e&&(f.filler.style.width=o+"px",f.filler.style.height="100%",f.hook.style.left=o+"px",f.hook.style.marginTop=-n/2+"px",f.hook.style.marginLeft=-n+"px",f.hook.style.width=2*n+"px",f.hook.style.height=2*n+"px")),f.value_input.value=d,k.value=d,c.value=d},o=function(a){if(a.preventDefault(),null!==d){var f,g,h=d.parentElement,i=h.parentElement,m=i.nextElementSibling,n=j(i),o=i.offsetWidth,p=0,q=a.clientX,r=a.clientY,s=a.changedTouches,t=null;if(s)for(f=0;s.length>f;f+=1)if(t=s[f],t.identifier===e){q=s[f].clientX,r=s[f].clientY;break}if(c.opts.vertical?(o=i.offsetHeight,p=Math.round((n.top+i.offsetHeight-r)/c.opts.step)*c.opts.step):p=Math.round((q-n.left)/c.opts.step)*c.opts.step,p>o?(p=o,b=c.opts.max):0>p?(p=0,b=c.opts.min):b=Math.round((c.opts.min+p/o*c.opts.range)/c.opts.step)*c.opts.step,c.value===b)return;c.value=b,g=l(b,4),m.value=g,c.value_input.value=g,c.opts.vertical?(h.style.height=p+"px",c.filler.style.height=p+"px"):(h.style.width=p+"px",c.filler.style.width=p+"px",d.style.left=p+"px",c.hook.style.left=p+"px"),k(c.opts.on_change,b)}},p=function(a){if(d){a.preventDefault();var b,f=a.changedTouches,h=null,i=!1,j=d.ownerDocument,k=j.defaultView||j.parentWindow;if(f){for(b=0;f.length>b;b+=1)if(h=f[b],h.identifier===e){i=!0,k.removeEventListener("touchend",p,!1),k.removeEventListener("touchmove",o,!1);break}}else i=!0,k.removeEventListener("mouseup",p,!1),k.removeEventListener("mousemove",o,!1);i&&(d.classList.remove(g.hook_focus),d=null,c=null,j.body.style.cursor="default")}},q=function(b){b.preventDefault(),b.stopPropagation();var f,h,i=null,j=!1,k=b.changedTouches;null===c&&k&&(e=k[0].identifier,j=!0),0===b.button&&(j=!0),j&&(d=m(b.target),d.classList.add(g.hook_focus),i=d.parentElement.parentElement.parentElement,c=a[i.id],f=i.ownerDocument,h=f.defaultView||f.parentWindow,f.body.style.cursor="pointer",o(b),h.addEventListener("mousemove",o,!1),h.addEventListener("touchmove",o,!1),h.addEventListener("mouseup",p,!1),h.addEventListener("touchend",p,!1))},r=function(b){b.preventDefault(),b.stopPropagation();var c=b.target,d=c.parentElement.parentElement.parentElement,e=a[d.id],f=e.opts.default_value;n(d,e,f),k(e.opts.on_change,f)},s=function(b){b.preventDefault(),b.stopPropagation();var c=m(b.target),d=c.parentElement.parentElement.parentElement,e=a[d.id],f=b.wheelDelta?b.wheelDelta/40:b.detail?-b.detail:0,g=e.value;f>=0?g+=e.opts.scroll_step:g-=e.opts.scroll_step,g>e.opts.max?g=e.opts.max:e.opts.min>g&&(g=e.opts.min),n(d,e,g),k(e.opts.on_change,g)},t=function(b){if(!b.target.validity||b.target.validity.valid){var c=b.target.parentElement.childNodes[1];if(void 0!==c){var d=m(c),e=d.parentElement.parentElement.parentElement,f=a[e.id];n(e,f,b.target.value),k(f.opts.on_change,b.target.value)}}},u=function(a,b,c){return function(a){var d=a.target,e=b.opts;(!d.validity||d.validity.valid)&&("min"===c?(e.min=l(d.value,4),b.value_input.min=e.min,e.range=e.max-e.min):"max"===c?(e.max=l(d.value,4),b.value_input.max=e.max,e.range=e.max-e.min):"step"===c?(e.step=l(d.value,4),b.value_input.step=e.step):"scroll_step"===c&&(e.scroll_step=l(d.value,4)),void 0!==e.configurable[c]&&(e.configurable[c].val=d.value))}},v=function(b){b.preventDefault(),b.stopPropagation();var c,d,e,h,k,l,m,n,o=b.target,p=o.parentElement,q=a[p.id],r=q.opts,s=o.ownerDocument,t=q.element.id+f,v=1;if(document.getElementById(t)||(q.configure_panel_open=!1),q.configure_panel_open!==!0){k=s.createElement("div"),k.className="wui-rangeslider-configure-container",n=s.createElement("div"),n.className="wui-rangeslider-configure-close",c=function(a){q.configure_panel_open=!1;var b=document.getElementById(t),c=a.target.ownerDocument.getElementById(t);b&&b.parentElement&&b.parentElement.removeChild(b),c&&c.parentElement&&c.parentElement.removeChild(c)},n.addEventListener("click",c,!1),n.addEventListener("touchstart",c,!1),k.id=t,k.appendChild(n);for(e in r.configurable)r.configurable.hasOwnProperty(e)&&void 0!==i[e]&&(h=r.configurable[e],l=s.createElement("div"),l.style.display="inline-block",l.style.marginRight="8px",l.style.width="80px",l.style.textAlign="right",l.innerHTML=e.replace("_"," ")+" : ",m=s.createElement("input"),m.className=g.value_input,k.appendChild(l),k.appendChild(m),v%2===0&&k.appendChild(s.createElement("div")),m.setAttribute("type","number"),void 0!==h&&(void 0!==h.min&&(m.setAttribute("min",h.min),m.title=m.title+" min: "+h.min),void 0!==h.max&&(m.setAttribute("max",h.max),m.title=m.title+" max: "+h.max),void 0!==h.val?m.setAttribute("value",h.val):"min"===e?m.setAttribute("value",r.min):"max"===e?m.setAttribute("value",r.max):"step"===e?m.setAttribute("value",r.step):"scroll_step"===e&&m.setAttribute("value",r.scroll_step)),m.addEventListener("input",u(b,q,e),!1),v+=1);d=j(o),p.insertBefore(k,o),q.configure_panel_open=!0}};this.create=function(b,c){var d,e=document.getElementById(b),f={};if(void 0!==a[b])return void console.log("WUI_RangeSlider id '"+b+"' already created, aborting.");for(d in h)h.hasOwnProperty(d)&&(f[d]=h[d]);if(void 0!==c){for(d in c)c.hasOwnProperty(d)&&void 0!==h[d]&&(f[d]=c[d]);void 0!==c.max&&(f.range=c.max),void 0!==c.step&&(f.step=c.step,void 0===c.scroll_step&&(f.scroll_step=f.step)),void 0!==c.title_on_top?f.title_on_top=c.title_on_top:f.vertical&&(f.title_on_top=!0),void 0!==c.default_value?f.default_value=c.default_value:void 0!==c.min&&void 0!==c.max&&(f.default_value=f.min+f.max/2)}0>f.min&&(f.range=f.max-f.min),a[b]=null,e.classList.add("wui-rangeslider"),f.title_on_top&&e.classList.add("wui-rangeslider-title-ontop");var j=document.createElement("div"),k=document.createElement("div"),l=document.createElement("div"),m=document.createElement("div"),o=document.createElement("div"),p=document.createElement("input"),u={element:e,opts:f,bar:k,filler:l,hook:m,value_input:p,value:f.default_value};if(j.innerHTML=f.title,p.setAttribute("value",f.default_value),p.setAttribute("type","number"),p.setAttribute("min",f.min),p.setAttribute("max",f.max),p.setAttribute("step",f.step),p.classList.add(g.value_input),o.classList.add("wui-rangeslider-value"),j.classList.add("wui-rangeslider-title"),k.classList.add(g.bar),l.classList.add(g.filler),m.classList.add(g.hook),f.vertical&&(j.style.textAlign="center"),j.style.minWidth=f.title_min_width+"px",o.style.minWidth=f.value_min_width+"px",p.style.minWidth=f.value_min_width+"px",k.style.width=f.width+"px",k.style.height=f.height+"px",k.appendChild(l),l.appendChild(m),e.appendChild(j),e.appendChild(k),e.appendChild(p),f.configurable){var w=0;for(d in f.configurable)f.configurable.hasOwnProperty(d)&&void 0!==i[d]&&(w+=1);if(w>0){var x=document.createElement("div");x.classList.add("wui-rangeslider-configurable-btn"),x.addEventListener("click",v,!1),x.addEventListener("touchstart",v,!1),f.title_on_top&&!f.vertical?(x.style.bottom="0",j.style.marginBottom="4px"):f.title_on_top&&f.vertical?(j.style.marginLeft="16px",j.style.marginRight="16px",x.style.top="0"):(j.style.marginLeft="16px",x.style.top="0"),f.vertical?e.appendChild(x):e.insertBefore(x,j)}}return k.addEventListener("mousedown",q,!1),k.addEventListener("touchstart",q,!1),m.addEventListener("dblclick",r,!1),p.addEventListener("input",t,!1),k.addEventListener("mousewheel",s,!1),k.addEventListener("DOMMouseScroll",s,!1),a[b]=u,n(e,u,f.default_value),b},this.destroy=function(b){var c,d,e,g=a[b];return void 0===g?void console.log("Element id '"+b+"' is not a WUI_RangeSlider, destroying aborted."):(c=g.element,c.parentElement.removeChild(c),d=c.ownerDocument,e=d.getElementById(b+f),e&&d.removeChild(e),void delete a[b])}},WUI_Tabs=new function(){"use strict";var a={},b={enabled:"wui-tab-enabled",disabled:"wui-tab-disabled",display_none:"wui-tab-display-none",tabs:"wui-tabs",tab:"wui-tab",tabs_content:"wui-tabs-content",tab_content:"wui-tab-content",underline:"wui-tabs-underline"},c={on_tab_click:null,height:"calc(100% - 30px)"},d=function(c){c.preventDefault(),c.stopPropagation();var d=c.target,e=d.parentElement,f=e.nextElementSibling.nextElementSibling,g=e.parentElement.id,h=a[g],i=0,j=null,k=0;for(k=0;e.childElementCount>k;k+=1)j=e.children[k],j.classList.remove(b.enabled),j.classList.add(b.disabled),h.tabs[k].classList.remove(b.enabled),h.tabs[k].classList.add(b.disabled),j===d&&(i=k);for(k=0;f.childElementCount>k;k+=1)j=f.children[k],j.classList.remove(b.display_none),h.contents[k].classList.remove(b.display_none),i!==k&&(j.classList.add(b.display_none),h.contents[k].classList.add(b.display_none));h.tabs[i].classList.remove(b.disabled),h.tabs[i].classList.add(b.enabled),c.target.classList.remove(b.disabled),c.target.classList.add(b.enabled),h.opts.on_tab_click&&h.opts.on_tab_click(i)};this.create=function(e,f){var g,h=document.getElementById(e),i=h.firstElementChild,j=document.createElement("div"),k=i.nextElementSibling,l=i.children[0],m={},n=0;if(void 0!==a[e])return void console.log("WUI_Tabs id '"+e+"' already created, aborting.");for(g in c)c.hasOwnProperty(g)&&(m[g]=c[g]);if(void 0!==f)for(g in f)f.hasOwnProperty(g)&&void 0!==c[g]&&(m[g]=f[g]);h.style.overflow="hidden",j.className="wui-tabs-underline",h.insertBefore(j,k),i.classList.add(b.tabs);var o=i.childElementCount,p=[];for(n=0;o>n;n+=1){var q=i.children[n];q.classList.add("wui-tab"),q!==l&&q.classList.add(b.disabled),q.addEventListener("click",d,!1),q.addEventListener("touchstart",d,!1),p.push(q)}l.classList.add(b.enabled),l.classList.add("wui-first-tab"),k.classList.add("wui-tabs-content");var r=k.childElementCount,s=[k.children[0]];for(k.style.height=m.height,k.children[0].classList.add(b.tab_content),n=1;r>n;n+=1){var t=k.children[n];t.classList.add(b.tab_content),t.classList.add(b.display_none),s.push(t)}return a[e]={element:h,tabs:p,contents:s,opts:m},e},this.getContentElement=function(a,b){var c=document.getElementById(a),d=c.firstElementChild.nextElementSibling.nextElementSibling;return d.children[b]},this.getTabName=function(a,b){var c=this.getContentElement(a,b);return c.getAttribute("data-group-name")},this.destroy=function(c){var d,e,f,g,h,i=a[c];if(void 0===i)return void console.log("Element id '"+c+"' is not a WUI_Tabs, destroying aborted.");if(d=i.element,d.classList.contains("wui-dialog-content"))for(e=d.getElementsByClassName(b.tabs),f=d.getElementsByClassName(b.underline),g=d.getElementsByClassName(b.tabs_content),h=0;e.length>h;h+=1)d.removeChild(e[h]),d.removeChild(f[h]),d.removeChild(g[h]);else d.parentElement.removeChild(d);delete a[c]}},WUI_ToolBar=new function(){"use strict";var a={},b={minimize_icon:"wui-toolbar-minimize-icon",maximize_icon:"wui-toolbar-maximize-icon",button:"wui-toolbar-button",minimize_group:"wui-toolbar-minimize-group",minimize_gr_v:"wui-toolbar-minimize-group-vertical",toggle:"wui-toolbar-toggle",toggle_on:"wui-toolbar-toggle-on",item:"wui-toolbar-item",group:"wui-toolbar-group",vertical_group:"wui-toolbar-group-vertical",tb:"wui-toolbar",dd_content:"wui-toolbar-dropdown-content",dd_item:"wui-toolbar-dropdown-item",dd_open:"wui-toolbar-dropdown-open"},c={item_hmargin:null,item_vmargin:null,item_width:32,item_height:32,icon_width:32,icon_height:32,allow_groups_minimize:!1,vertical:!1},d=function(b){var c=a[b];return void 0===c?("undefined"!=typeof console&&console.log('_getWidget failed, the element id "'+b+'" is not a WUI_ToolBar.'),null):c},e=function(a){var b=a.ownerDocument,c=a.getBoundingClientRect(),d=b.body,e=b.documentElement,f=b.defaultView||b.parentWindow,g=f.pageYOffset||e.scrollTop||d.scrollTop,h=f.pageXOffset||e.scrollLeft||d.scrollLeft,i=e.clientTop||d.clientTop||0,j=e.clientLeft||d.clientLeft||0,k=c.top+g-i,l=c.left+h-j;return{top:Math.round(k),left:Math.round(l)}},f=function(c,d){return void 0!==d?a[d]:c.classList.contains(b.tb)?a[c.id]:c.classList.contains(b.minimize_icon)||c.classList.contains(b.maximize_icon)||c.classList.contains(b.vertical_group)||c.classList.contains(b.group)?a[c.parentElement.id]:a[c.parentElement.parentElement.id]},g=function(a,b,c){if(void 0!==a.on_click&&null!==a.on_click){var d={id:a.id,type:b};void 0!==c&&(d.state=c),a.on_click(d)}},h=function(a,c,d){var e,f=a.createElement("div");if(void 0!==c.items)for(e=0;c.items.length>e;e+=1){var g=c.items[e],h=a.createElement("div");c.vertical||h.classList.add("wui-toolbar-dropdown-horizontal"),h.classList.add(b.dd_item),h.innerHTML=g.title,h.dataset.index=e,f.appendChild(h)}return f.addEventListener("click",j,!1),f.style.width=d.dd_items_width+"px",f.classList.add(b.dd_content),f.dataset.linkedto_tb=d.element.id,f.dataset.linkedto_tool_index=c.id,
a.body.appendChild(f),f},i=function(a,c,d){var e,h,i,j=null,k=!1,l=0;j=f(a,c),h=j.element,a.parentElement&&a.parentElement.parentElement&&(h=a.parentElement.parentElement);var m=j.tools[parseInt(a.dataset.tool_id,10)];if("1"===m.element.dataset.on?(m.element.dataset.on=0,a.dataset.on=0,m.element.title=m.tooltip,a.title=m.tooltip,void 0!==m.icon&&(m.element.classList.add(m.icon),m.element.classList.remove(m.toggled_icon),a.classList.add(m.icon),a.classList.remove(m.toggled_icon))):(m.element.dataset.on=1,a.dataset.on=1,void 0!==m.tooltip_toggled&&(m.element.title=m.tooltip_toggled,a.title=m.tooltip_toggled),void 0!==m.toggled_icon&&(m.element.classList.add(m.toggled_icon),m.element.classList.remove(m.icon),a.classList.add(m.toggled_icon),a.classList.remove(m.icon)),k=!0),"none"!==m.toggled_style&&(a.classList.contains(b.toggle_on)?(m.element.classList.remove(b.toggle_on),a.classList.remove(b.toggle_on)):(m.element.classList.add(b.toggle_on),a.classList.add(b.toggle_on))),e=a.dataset.toggle_group,void 0!==e)for(i=h.getElementsByClassName(b.item),l=0;i.length>l;l+=1){var n=i[l],o=j.tools[parseInt(n.dataset.tool_id,10)];if(e===n.dataset.toggle_group&&n.dataset.tool_id!==a.dataset.tool_id){if("0"===n.dataset.on)continue;n.dataset.on="0",o.element.dataset.on="0",n.classList.remove(b.toggle_on),o.element.classList.remove(b.toggle_on),void 0!==m.toggled_icon&&(n.classList.remove(o.toggled_icon),o.element.classList.remove(o.toggled_icon)),void 0!==m.icon&&(n.classList.add(o.icon),o.element.classList.add(o.icon)),(d||void 0===d)&&g(o,"toggle",!1)}}(d===!0||void 0===d)&&g(m,"toggle",k)},j=function(c){c.preventDefault(),c.stopPropagation();var d=c.target,e=d.ownerDocument,f=d.parentElement,g=a[f.dataset.linkedto_tb],h=parseInt(f.dataset.linkedto_tool_index,10),i=g.tools[h],j=parseInt(d.dataset.index,10),l=i.items[j],m=e.getElementById(f.dataset.linkedto_tb),n=m.getElementsByClassName(b.item),o=n[h];void 0!==l.on_click&&(l.on_click(),o.classList.remove(b.toggle_on),i.element.classList.remove(b.toggle_on),k(i,o))},k=function(a,c){var d,e,f=c.ownerDocument,g=f.body.getElementsByClassName(b.dd_content);for(e=0;g.length>e;e+=1)d=g[e],d.removeEventListener("click",j,!1),d.parentElement.removeChild(d);a.element.classList.remove(b.toggle_on),c.classList.remove(b.toggle_on)},l=function(a,b){var c=function(){var d=b.ownerDocument,e=d.defaultView||d.parentWindow;k(a,b),e.removeEventListener("click",c)};return c},m=function(a){a.preventDefault(),a.stopPropagation();var c=a.target;if(c.classList.contains(b.minimize_group)||c.classList.contains(b.minimize_gr_v))return void n(c);if(c.classList.contains(b.toggle))return void i(c);if(!(c.classList.contains(b.tb)||c.classList.contains(b.group)||c.classList.contains(b.vertical_group))){var d=null,j=null,m=null,o=null,p=c.ownerDocument,q=p.defaultView||p.parentWindow;if(o=f(c),d=o.tools[c.dataset.tool_id],"dropdown"===d.type){if(c.classList.contains(b.toggle_on))return void k(d,c);j=h(p,d,o);var r=d.element;c.classList.add(b.toggle_on),r.classList.add(b.toggle_on),m=e(c),"tb_item"===d.dd_items_width&&(j.style.width=c.offsetWidth+"px"),"s"===d.orientation?(j.style.top=m.top+c.offsetHeight+"px",j.style.left=m.left+"px"):"sw"===d.orientation?(j.style.top=m.top+c.offsetHeight+"px",j.style.left=m.left-j.offsetWidth+"px"):"nw"===d.orientation?(j.style.top=m.top-j.offsetHeight+c.offsetHeight+"px",j.style.left=m.left-j.offsetWidth+"px"):"se"===d.orientation?(j.style.top=m.top+c.offsetHeight+"px",j.style.left=m.left+c.offsetWidth+"px"):"ne"===d.orientation?(j.style.top=m.top-j.offsetHeight+c.offsetHeight+"px",j.style.left=m.left+c.offsetWidth+"px"):(j.style.top=m.top-j.offsetHeight+"px",j.style.left=m.left+"px"),j.classList.add(b.dd_open),a.stopPropagation&&a.stopPropagation(),q.addEventListener("click",l(d,c),!1)}else g(d,"click")}},n=function(a){var c=a.nextSibling;a.classList.contains(b.minimize_icon)?(a.classList.add(b.maximize_icon),a.classList.remove(b.minimize_icon),a.title="Maximize group",c.style.display="none"):(a.classList.add(b.minimize_icon),a.classList.remove(b.maximize_icon),a.title="Minimize group",c.style.display="")};this.create=function(d,e,f){var g,h=document.getElementById(d),j=null,k=null,l=null,n=null,o={};if(void 0!==a[d])return void console.log("WUI_Toolbar id '"+d+"' already created, aborting.");for(g in c)c.hasOwnProperty(g)&&(o[g]=c[g]);if(void 0!==e)for(g in e)e.hasOwnProperty(g)&&void 0!==c[g]&&(o[g]=e[g]);a[d]={element:h,tools:[],opts:o},h.classList.add(b.tb);var p=b.group,q=b.item,r="wui-toolbar-spacer",s=b.minimize_group;o.vertical?(h.classList.add("wui-toolbar-vertical"),p=b.vertical_group,q+=" wui-toolbar-item-vertical",r="wui-toolbar-spacer-vertical",s=b.minimize_gr_v,h.style.maxWidth=o.item_width+4+"px",null===o.item_hmargin&&(o.item_hmargin=3),null===o.item_vmargin&&(o.item_vmargin=8)):(h.style.maxHeight=o.item_height+4+"px",null===o.item_hmargin&&(o.item_hmargin=3),null===o.item_vmargin&&(o.item_vmargin=0)),s=b.button+" "+b.minimize_icon+" "+s,h.addEventListener("click",m,!1);var t;for(l in f)if(f.hasOwnProperty(l)){null!==n&&(k=document.createElement("div"),k.className=r,h.appendChild(k)),o.allow_groups_minimize&&(k=document.createElement("div"),k.className=s,k.title="Minimize group",h.appendChild(k)),j=f[l];var u=document.createElement("div");for(u.className=p,o.vertical?u.style.maxWidth=o.item_width+"px":u.style.maxHeight=o.item_height+"px",t=0;j.length>t;t+=1){var v,w=j[t],x=document.createElement("div"),y=a[d].tools.length,z={element:x,on_click:w.on_click,icon:w.icon,items:[],tooltip:"",type:w.type,dd_items_width:w.dropdown_items_width,orientation:w.orientation,id:y};if(x.className=q,x.style.minWidth=o.item_width+"px",x.style.minHeight=o.item_height+"px",x.style.marginLeft=o.item_hmargin+"px",x.style.marginRight=o.item_hmargin+"px",x.style.marginTop=o.item_vmargin+"px",x.style.marginBottom=o.item_vmargin+"px",x.style.backgroundSize=o.icon_width-4+"px "+(o.icon_height-4)+"px",u.appendChild(x),a[d].tools.push(z),x.dataset.tool_id=y,z.tooltip=w.tooltip,void 0!==w.tooltip&&(x.title=w.tooltip),void 0!==w.text&&(x.innerHTML=w.text,x.style.lineHeight=o.item_height+"px",x.classList.add("wui-toolbar-text"),void 0!==w.icon&&(x.style.paddingLeft=o.icon_width+2+"px",x.style.backgroundPosition="left center")),void 0!==w.icon&&x.classList.add(w.icon),"toggle"===w.type)x.classList.add(b.toggle),z.toggled_icon=w.toggled_icon,z.tooltip_toggled=w.tooltip_toggled,z.toggled_style=w.toggled_style,void 0!==w.toggle_group&&(x.dataset.toggle_group=w.toggle_group),w.toggle_state&&(x.dataset.on="1");else if("dropdown"===w.type){if(x.classList.add(b.button),void 0!==w.items)for(v=0;w.items.length>v;v+=1){var A=w.items[v];z.items.push({title:A.title,on_click:A.on_click})}}else x.classList.add(b.button)}h.appendChild(u),n=j}var B=h.getElementsByClassName(b.item);for(t=0;B.length>t;t+=1){var C=B[t];"1"===C.dataset.on&&(C.dataset.on="0",i(C,d,!0))}return d},this.hideGroup=function(a,c){var e,f,g,h=d(a);if(h){if(e=h.element.getElementsByClassName(h.opts.vertical?b.vertical_group:b.group),0===e.length)return;f=e[c],g=f.previousElementSibling,(g.classList.contains(b.minimize_group)||g.classList.contains(b.minimize_gr_v))&&(g.style.display="none"),f.style.display="none"}},this.showGroup=function(a,c){var e,f,g,h=d(a);if(h){if(e=h.element.getElementsByClassName(h.opts.vertical?b.vertical_group:b.group),0===e.length)return;f=e[c],g=f.previousElementSibling,(g.classList.contains(b.minimize_group)||g.classList.contains(b.minimize_gr_v))&&(g.style.display=""),e[c].style.display=""}},this.toggle=function(a,b,c){var e=d(a);e&&i(e.tools[b].element,a,c)},this.getItemElement=function(a,b){var c=d(a);return c?c.tools[b].element:void 0},this.destroy=function(b){var c,d,e,f,g,h,i,j=a[b];if(void 0===j)return void console.log("Element id '"+b+"' is not a WUI_ToolBar, destroying aborted.");for(c=j.toolbar,d=j.tools,c.parentElement.removeChild(c),i=0;d.length>i;i+=1)e=d[i],"dropdown"===e.type&&(f=e.items,f.length>0&&(g=f[0],h=g.element,h.parentElement.removeChild(h)));delete a[b]}},WUI_CircularMenu=new function(){"use strict";var a=[],b=0,c={item:"wui-circularmenu-item",show:"wui-circularmenu-show"},d={x:null,y:null,rx:64,ry:48,item_width:32,item_height:32,window:null,element:null},e=function(b){var c,d;for(d=0;a.length>d;d+=1)c=a[d],b.body.removeChild(c);a=[]},f=function(a,b,c){var d=function(a){a.preventDefault(),c(),e(b)};return d},g=function(a,d){var f=function(g){g.preventDefault();var h=(new Date).getTime();500>=h-b||g.target.classList.contains(c.item)||(e(d),a.removeEventListener("click",f),a.removeEventListener("mousedown",f))};return f},h=function(d,h,i,j,k,l){e(j);var m,n,o,p=-(Math.PI/2),q=h.length,r=2*Math.PI/q;for(o=0;q>o;o+=1)n=h[o],m=document.createElement("div"),m.classList.add(c.item),m.style.width=d.item_width+"px",m.style.height=d.item_height+"px",m.style.backgroundSize=d.item_width-4+"px "+(d.item_height-4)+"px",m.style.left=k+d.rx*Math.cos(p)+"px",m.style.top=l+d.ry*Math.sin(p)+"px",m.classList.add(n.icon),n.tooltip&&(m.title=n.tooltip),j.body.appendChild(m),i.getComputedStyle(m).width,a.push(m),n.on_click&&m.addEventListener("click",f(i,j,n.on_click)),m.classList.add(c.show),p+=r;var s=g(i,j);i.addEventListener("click",s),b=(new Date).getTime(),i.addEventListener("mousedown",s)};this.create=function(a,b){var c,e,f,g,i,j={},k=document,l=window;for(c in d)d.hasOwnProperty(c)&&(j[c]=d[c]);if(void 0!==a)for(c in a)a.hasOwnProperty(c)&&void 0!==d[c]&&(j[c]=a[c]);g=j.element,null!==g?(i=g.getBoundingClientRect(),k=g.ownerDocument,l=k.defaultView||k.parentWindow,e=i.left+(i.width-j.item_width)/2,f=i.top+(i.height-j.item_height)/2,h(j,b,l,k,e,f)):null!==e&&null!==f&&(null!==j.window&&(l=j.window,k=l.document),e=j.x-j.item_width/2,f=j.y-j.item_height/2,h(j,b,l,k,e,f))}},WUI=new function(){"use strict";var a={display_none:"wui-display-none",hide_fi_500:"wui-hide-fi-500",hide_show_500:"wui-show-fi-500",draggable:"wui-draggable"},b=[],c=null,d=null,e=0,f=0,g=function(b,c,d){var e=function(){d&&b.classList.add(a.display_none),c&&c(),b.removeEventListener("transitionend",e)};return e},h=function(b){b.preventDefault();var g=b.clientX,h=b.clientY,k=b.changedTouches;if(b.target.classList.contains(a.draggable)){if(null===c)if(k)d=k[0].identifier,g=k[0].clientX,h=k[0].clientY;else if(0!==b.button)return;c=b.target,document.body.style.cursor="move",e=g-parseInt(c.style.left,10),f=h-parseInt(c.style.top,10),window.addEventListener("mousemove",i,!1),window.addEventListener("touchmove",i,!1),window.addEventListener("mouseup",j,!1),window.addEventListener("touchend",j,!1)}},i=function(a){a.preventDefault();var g,h=a.clientX,i=a.clientY,j=a.changedTouches,k=null,l=b[parseInt(c.dataset.wui_draggable_id,10)],m=l.x,n=l.y;if(j)for(g=0;j.length>g;g+=1)if(k=j[g],k.identifier===d){h=j[g].clientX,i=j[g].clientY;break}0!==l.axisLock&&(m=h-e,c.style.left=m+"px",l.x=m),1!==l.axisLock&&(n=i-f,c.style.top=n+"px",l.y=n),l&&void 0!==l.cb&&l.cb(c,m,n)},j=function(a){a.preventDefault();var e,f=a.changedTouches,g=null;if(0!==b.length)if(f){for(e=0;f.length>e;e+=1)if(g=f[e],g.identifier===d){c=null,document.body.style.cursor="default",window.removeEventListener("touchmove",i,!1),window.removeEventListener("touchend",j,!1);break}}else c=null,document.body.style.cursor="default",window.removeEventListener("mousemove",i,!1),window.removeEventListener("mouseup",j,!1)};this.fadeOut=function(b,c,d,e){(void 0===c||null===c)&&(c=500),void 0===b.style.WebkitTransition?b.style.transition="visibility 0s ease-in-out "+c+"ms, opacity "+c+"ms ease-in-out":b.style.WebkitTransition="visibility 0s ease-in-out "+c+"ms, opacity "+c+"ms ease-in-out",b.addEventListener("transitionend",g(b,d,e),!1),b.classList.add(a.hide_fi_500),b.classList.remove(a.hide_show_500)},this.fadeIn=function(b,c){(void 0===c||null===c)&&(c=500),void 0===b.style.WebkitTransition?b.style.transition="visibility 0s ease-in-out 0s, opacity "+c+"ms ease-in-out":b.style.WebkitTransition="visibility 0s ease-in-out 0s, opacity "+c+"ms ease-in-out",b.classList.remove(a.hide_fi_500),b.classList.add(a.hide_show_500),b.classList.remove(a.display_none)},this.draggable=function(c,d,e){if(d){if(c.classList.contains(a.draggable))return;c.classList.add(a.draggable),c.addEventListener("mousedown",h,!1),c.addEventListener("touchstart",h,!1),c.dataset.wui_draggable_id=b.length,b.push({cb:e,element:c,axisLock:null,x:parseInt(c.style.left,10),y:parseInt(c.style.top,10)})}else{if(!c.classList.contains(a.draggable))return;c.classList.remove(a.draggable),c.removeEventListener("mousedown",h,!1),c.removeEventListener("touchstart",h,!1);var f,g=parseInt(c.dataset.wui_draggable_id,10);for(b.splice(g,1),f=0;b.length>f;f+=1){var i=b[f];i.element.dataset.wui_draggable_id=f}}},this.lockDraggable=function(c,d){if(c.classList.contains(a.draggable)){var e=b[parseInt(c.dataset.wui_draggable_id,10)];e.axisLock="x"===d?0:"y"===d?1:null}}};