/*
 Eloquence WEBDLG v2
 (C) Copyright Marxmeier Software AG, 2020-2025
 Version: 2.0.20
 $Id: 00-base.js,v 28.146 2025/07/09 09:18:17 mike Exp $
 $Id: 05-const.js,v 28.84 2025/07/09 09:16:36 mike Exp $
 $Id: 05-util.js,v 28.68 2024/05/23 09:45:35 mike Exp $
 $Id: 05-window.js,v 28.21 2025/03/13 14:28:12 mike Exp $
 $Id: 10-dlg.js,v 28.46 2025/03/13 14:28:12 mike Exp $
 $Id: 10-login.js,v 28.7 2022/11/23 10:11:28 mike Exp $
 $Id: 10-message.js,v 28.10 2022/11/23 10:11:28 mike Exp $
 $Id: 10-popup.js,v 28.31 2022/11/23 10:11:28 mike Exp $
 $Id: 10-strings.js,v 28.4 2022/10/07 12:44:58 mike Exp $
 $Id: 20-checkbox.js,v 28.9 2022/10/19 13:06:30 mike Exp $
 $Id: 20-combobox.js,v 28.26 2025/04/02 13:55:48 mike Exp $
 $Id: 20-dialog.js,v 28.1 2022/10/27 11:49:55 mike Exp $
 $Id: 20-edittext.js,v 28.16 2023/12/18 12:42:29 mike Exp $
 $Id: 20-groupbox.js,v 28.17 2025/01/29 10:32:06 mike Exp $
 $Id: 20-htmlview.js,v 28.15 2024/01/23 09:13:08 mike Exp $
 $Id: 20-listbox.js,v 28.50 2025/03/18 15:21:55 mike Exp $
 $Id: 20-menuitem.js,v 28.14 2025/09/16 10:01:57 mike Exp $
 $Id: 20-menu.js,v 28.13 2025/07/09 07:39:19 mike Exp $
 $Id: 20-plugin.js,v 28.16 2025/01/28 12:12:52 mike Exp $
 $Id: 20-poptext.js,v 28.20 2024/07/11 11:21:05 mike Exp $
 $Id: 20-progressbar.js,v 28.7 2022/03/01 17:15:27 mike Exp $
 $Id: 20-pushbutton.js,v 28.9 2023/10/18 14:36:09 mike Exp $
 $Id: 20-radiobutton.js,v 28.10 2022/10/19 13:06:30 mike Exp $
 $Id: 20-splitter.js,v 28.12 2022/11/01 12:08:33 mike Exp $
 $Id: 20-statictext.js,v 28.3 2022/11/09 10:41:48 mike Exp $
 $Id: 20-statusbar.js,v 28.1 2022/10/27 11:49:55 mike Exp $
 $Id: 20-tabbox.js,v 28.23 2025/07/09 07:49:43 mike Exp $
 $Id: 20-toolbar.js,v 28.1 2022/10/27 11:49:55 mike Exp $
 $Id: 20-tree.js,v 28.16 2024/07/11 11:21:05 mike Exp $
 $Id: 20-windowmenu.js,v 28.9 2022/09/26 08:59:53 mike Exp $
 $Id: 99-main.js,v 28.143 2025/09/16 10:27:56 mike Exp $
*/
var eq=eq||{};eq.c=eq.c||{};eq.p=eq.p||{};eq.p.version=20020;eq.c.Obj=function(){};(eq.c.Obj.setClassName=function(a,b){var c=Object.getOwnPropertyDescriptor(b.prototype.constructor,"name");void 0!==c?c.value=a:c={value:a,configurable:!0,enumerable:!1,writable:!1};Object.defineProperty(b.prototype.constructor,"name",c)})("Obj",eq.c.Obj);
eq.c.Obj.subClass=function(a,b){var c=this;b.prototype=Object.create(c.prototype);Object.defineProperty(b.prototype,"constructor",{value:b,configurable:!1,enumerable:!1,writable:!0});eq.c.Obj.setClassName(a,b);b.subClass=function(d,e){return c.subClass.call(this,d,e)};return eq.c[a]=b};
eq.MainOp={apiThreadStarted:1,ssnNewOrResume:2,inject:3,message:4,login:5,applicationStopped:6,applicationFailed:7,popupPos:8,warnLeavingPage:9,windowFeature:10,windowFeatures:11,grid:12,layout:13,notifyBusy:14,typeAhead:15,cancelCurrentCall:16,update:17,updated:18,synced:19,openUrl:20,beep:21,playSound:22,startApp:23,activate:24,resume:25,addControl:26,modifyControl:27,deleteControl:28,invalidate:29,dlg_DRAW:30,dlg_DO:31,dlg_POPUP_BOX:32};
eq.ApiOp={documentComplete:1,installPlugins:2,injectDone:3,openWebSocket:4,closeWebSocket:5,onLoginEvent:6,onEvent:7,onPopupEvent:8,onSynced:9,onDo:10,onHelp:11,invalidate:12,update:13,updated:14,canceled:15,grid:16};eq.UpdateTag={changed:1,dialogDo:2,mouseButton2:3,ctxMenuOpen:4,ctxMenuAct:5,tabOrder:6,colResized:7,colMoved:8,sortSequence:9,lineOrder:10,plgUpdate:11,plgGetVal:12};
eq.RqTag={child:1,cssid:2,cssclsDel:3,cssclsAdd:4,font:5,raster:6,posSize:7,size:8,border:9,rule:10,ruleMode:11,tabOnEnter:12,visible:13,sensitive:14,inactive:15,tabStop:16,bgColor:17,fgColor:18,focusColor:19,btnMask:20,contextMenu:21,url:22,help:23,toolTip:24,dndMode:27,dropRule:28,globalDropRule:29,dialogState:30,dialogPosSize:31,logoIcon:32,fKey:33,dialogTimer:34,ruleButton2:35,dialogDo:36,margin:37,bgImage:38,vx:39,vy:40,vWidth:41,vHeight:42,accel:43,text:45,textPos:46,align:47,active:48,radioGroup:49,
icon:50,iconActive:51,type:52,itemId:53,objId:54,scrollable:55,multiline:56,readonly:57,wrapmode:58,maxchars:59,content:60,ispassword:61,fitfont:62,autocomplete:63,autotab:64,vcRule:65,columns:66,colOrder:67,colState:68,colTitle:69,lineOrder:70,activeLine:71,vActiveLine:72,topItem:73,rowHeight:74,status:75,bgColor2:76,fgColor2:77,gridColor:78,colToolTip:79,lineToolTip:80,emptyNode:81,separator:82,tabs:83,selectedTab:84,panes:85,vertical:86,position:87,quickExpand:88,value:89,items:94,boxSize:95,open:96,
scaling:97,plgInt:98,plgString:99,plgBinary:100,popupPos:101,baseUrl:102,helpBaseUrl:103,windowFeature:104,layout:105,notifyBusy:106,typeAhead:107,openUrl:108,openHelpUrl:109,startApp:110,activate:111,beep:112,soundUrl:113};
eq.RsValType={idFocus:1,ruleOnce:2,textValue:3,buttonChecked:4,caretPos:5,activeLine:6,activeLineCol:7,topItem:8,selectedTab:9,splitterPos:10,scrollPos:11,status:12,colOrder:13,colWidth:14,lineOrder:15,emptyNode:16,ruleKey:17,mouseBtns:18,mouseCnt:19,mouseMods:20,dialogMax:21,dialogPos:22,dialogSize:23,dragFrom:24,dragContent:25,dropContent:26,dropAction:27,dropPos:28,dropColumn:29,dropLine:30,dropElement:31,plgVoid:32,plgInt:33,plgString:34,plgBinary:35};
eq.PopupPos={top:1,left:2,login:4,message:8,box:16};eq.DlgCall={set:6};eq.DlgValType={tInt:1,tString:2};eq.LayoutMode={inline:1,maximized:2,dialog:4};eq.DialogMode={none:0,layout:1,scale:2,inline:3,modeMask:3,stateShift:2};eq.DialogState={maximized:1};eq.DialogRaster={pos:1,size:2};eq.Margin={top:1,right:2,bottom:4,left:8};eq.BgFill={tile:0,topLeft:1,center:2,scale:3};eq.FontStyle={bold:1,italic:2};eq.TextPos={right:1,left:2,bottom:3,top:4};
eq.ColState={alignMask:3,visible:4,raster:8,movable:16,sizable:32,sortable:64,userHide:128};eq.ColType={colAlphaNofold:0,colNumeric:1,colBoolean:2,colBarGraph:3,colAlphaFold:5,colDate:6};eq.MenuType={item:0,sep:1,radio:2,check:3};eq.TabState={visible:1,sensitive:2};eq.RuleType={bgColor:1,bgColor2:2,bgImage:3,childFont:4,fgColor:5,fgColor2:6,focusColor:7,font:8,gridColor:9,height:10,width:11};eq.atrGET=1;eq.atrSET=2;eq.atrIDX=4;eq.atrINT=8;eq.atrSTR=16;eq.atrBIN=32;eq.atrPRI=64;eq.atrNOC=128;
eq.atrLST=256;eq.atrSYN=512;eq.PluginFlags={focusable:4,tabOnEnter:8};eq.KeyMod={shift:1,ctrl:2,alt:4,meta:8};eq.Dnd={local:1,global:2,move:4,copy:8,link:16,all:28,dropExact:32};eq.Dom={};eq.Dom.viewRect=function(){return{x:window.pageXOffset,y:window.pageYOffset,w:document.documentElement.clientWidth,h:document.documentElement.clientHeight}};
eq.Dom.scrollIntoView=function(a,b){for(var c=b,d,e,f,g,h,k,l,n,m,p,q,r;(d=c.parentNode)&&d!==document;){if(e=d.classList){if(e.contains("eq-dialog"))break;e.contains("eq-pane")&&f&&f.contains("eq-view")&&(c=d.getBoundingClientRect(),void 0===g&&(g=b.getBoundingClientRect()),f=!1,(l=g.top)<(n=c.top)?(void 0===h&&(h=2*a.grid.hr),d.scrollTop=Math.floor(d.scrollTop-n+l-h),f=!0):(m=g.bottom)>(p=c.bottom)&&(void 0===h&&(h=2*a.grid.hr),m=m-p+h,l-m>=n&&(d.scrollTop=Math.ceil(d.scrollTop+m),f=!0)),(l=g.left)<
(n=c.left)?(void 0===k&&(k=2*a.grid.wr),d.scrollLeft=Math.floor(d.scrollLeft-n+l-k),f=!0):(m=g.right)>(p=c.right)&&(void 0===k&&(k=2*a.grid.wr),m=m-p+k,l-m>=n&&(d.scrollLeft=Math.ceil(d.scrollLeft+m),f=!0)),f&&(g=void 0))}c=d;f=e}void 0===g&&(g=b.getBoundingClientRect());f=!1;0>(l=g.top)?(void 0===h&&(h=2*a.grid.hr),r=Math.floor(window.pageYOffset+l-h),f=!0):(m=g.bottom)>(p=document.documentElement.clientHeight)&&(void 0===h&&(h=2*a.grid.hr),m=m-p+h,0<=l-m&&(r=Math.ceil(window.pageYOffset+m),f=!0));
0>(l=g.left)?(void 0===k&&(k=2*a.grid.wr),q=Math.floor(window.pageXOffset+l-k),f=!0):(m=g.right)>(p=document.documentElement.clientWidth)&&(void 0===k&&(k=2*a.grid.wr),m=m-p+k,0<=l-m&&(q=Math.ceil(window.pageXOffset+m),f=!0));f&&window.scrollTo(void 0!==q?q:window.pageXOffset,void 0!==r?r:window.pageYOffset)};
eq.Dom.setContent=function(a,b,c,d){var e=this.reIsHtml.exec(b);if(e){if(a.textContent="",this.setHtmlContent(e[1],a),c){a=a.getElementsByTagName("U");c=this.reCharOrDigit;var f=0;for(b=a.length;f<b;f++){e=a[f];var g=e.childNodes,h,k;if(1===g.length&&(h=g[0]).nodeType===Node.TEXT_NODE&&c.test(k=h.nodeValue)){if(d){e.parentNode.replaceChild(document.createTextNode(k),e);break}return k}}}}else{if(c)for(h=this.reAccel,c=this.reCharOrDigit;e=h.exec(b);)if(void 0!==(k=e[1])&&c.test(k)){if(d)return k=((f=
e.index)?b.substring(0,f):"")+k,b.length>(f+=2)&&(k+=b.substring(f)),a.textContent=k,h.lastIndex=0,null;a.textContent="";(f=e.index)&&a.appendChild(document.createTextNode(b.substring(0,f)));(e=document.createElement("U")).textContent=k;a.appendChild(e);b.length>(f+=2)&&a.appendChild(document.createTextNode(b.substring(f)));h.lastIndex=0;return k}a.textContent=b}return null};eq.Dom.setTextContent=function(a,b){this.reIsHtml.exec(b)?a.textContent=b.replace(this.reUnHtml,""):a.textContent=b};
eq.Dom.setHtmlContent=function(a,b,c){a=this.ParseHtml.parseFromString(a,"text/html");var d,e;if(c&&(d=a.head))for(;e=d.firstChild;)c.appendChild(e);if(b&&(d=a.body)){if("BODY"===b.tagName)for(a=(c=d.getAttributeNames()).length,e=0;e<a;e++){var f=c[e];b.setAttribute(f,d.getAttribute(f))}for(;e=d.firstChild;)b.appendChild(e)}};eq.Dom.isHtmlContent=function(a){return this.reIsHtml.test(a)};eq.Dom.ParseHtml=new DOMParser;eq.Dom.reIsHtml=/^<html>(.*?)(<\/html>)?$/i;eq.Dom.reUnHtml=/<[^>]*>/g;
eq.Dom.reAccel=/&(.)?/g;eq.Dom.reCharOrDigit=/^[A-Z0-9]$/i;
eq.Dom.decodeAccelKey=function(a,b,c){if(0===a.length)return null;if(1===a.length)b&&!this.reCharOrDigit.test(a)&&(a=c.code,a=void 0!==a?a.replace(this.reAccelCode,""):String.fromCharCode(c.keyCode));else switch(a){case "Add":a="+";break;case "ArrowDown":a="Down";break;case "ArrowLeft":a="Left";break;case "ArrowRight":a="Right";break;case "ArrowUp":a="Up";break;case "Del":a="Delete";break;case "Divide":a="/";break;case "Esc":a="Escape";break;case "Multiply":a="*";break;case "Spacebar":a="Space";break;
case "Subtract":a="-";break;case "Unidentified":switch(c.code){case "NumpadDecimal":a=",";break;default:return null}}return a};eq.Dom.reAccelCode=/^(Digit|Key|Numpad)/;
eq.Dom.decodeAccelAttr=function(a,b){for(var c=a.split(" "),d=eq.KeyMod,e=0,f=0,g=c.length;f<g;f++)switch(a=c[f].toUpperCase()){case "SHIFT":e|=d.shift;break;case "CTRL":e|=d.ctrl;break;case "ALT":case "ALTGRAPH":e|=d.alt;break;case "META":e|=d.meta;break;default:a=a.replace(this.reAccelAttr,"");e===d.shift&&1===a.length&&(e=0);if(b){switch(a){case "ADD":c="+";break;case "BACKSPACE":c="\u232b";break;case "DELETE":c="\u2326";break;case "DIVIDE":c="/";break;case "DOWN":c="\u21e3";break;case "END":c=
"\u21f2";break;case "ENTER":c="\u23ce";break;case "ESCAPE":c="\u238b";break;case "HOME":c="\u21f1";break;case "LEFT":c="\u21e0";break;case "MULTIPLY":c="*";break;case "PAGEDOWN":c="\u21df";break;case "PAGEUP":c="\u21de";break;case "RIGHT":c="\u2192";break;case "SPACE":c="\u2423";break;case "SUBTRACT":c="-";break;case "TAB":c="\u21e5";break;case " ":case "UP":c="\u21e1";break;default:c=a}e?(f="",e&d.shift&&(f+="\u21e7"),e&d.ctrl&&(f+="\u2303"),e&d.alt&&(f+="\u2325"),e&d.meta&&(f+="\u2318"),b.tag=f+
c):b.tag=c}return e?String.fromCharCode(e+48)+a:a}return null};eq.Dom.reAccelAttr=/(^KP)|(^NUMPAD)|_/ig;eq.Dom.copyContent=function(a,b){a.textContent="";if(b)for(b=b.firstChild;b;)a.appendChild(b.cloneNode(!0)),b=b.nextSibling};eq.Dom.copyFont=function(a,b){b=window.getComputedStyle(b);a=a.style;a.fontFamily=b.fontFamily;a.fontSize=b.fontSize;a.fontStyle=b.fontStyle;a.fontWeight=b.fontWeight};
eq.Dom.copyColors=function(a,b){b=window.getComputedStyle(b);a=a.style;a.color=b.color;a.backgroundColor=b.backgroundColor};eq.Dom.setFont=function(a,b){a=a.style;var c=eq.FontStyle,d;if(d=b.fc){a.fontFamily=d;var e=!0}else a.fontFamily="";(d=b.sz)?(a.fontSize=d,e=!0):a.fontSize="";if((b=b.st)&c.italic){a.fontStyle="italic";var f=e=!0}b&c.bold&&(a.fontWeight="bold",f=e=!0);f||(a.fontStyle="");return e};
eq.Dom.adjustElementFontSize=function(a){var b=eq.app.fnSizeFactor;if(b&&1!==b){a=a.style;var c=a.fontSize,d;c&&(d=this.reFontSize.exec(c))&&(c=Number(d[1]),c===c&&(a.fontSize=Math.round(c*b*1E3)/1E3+d[2]))}};eq.Dom.reFontSize=/^([0-9.]+)(.+)$/;
eq.Dom.resolveWindowFeatures=function(a){for(var b=this.resolveWindowFeatures.re,c=window.screen,d="",e=0,f,g,h;f=b.exec(a);){switch(g=f[1]){case "left":case "screenX":case "width":case "innerWidth":h=c.availWidth*f[7]/100;break;case "top":case "screenY":case "height":case "innerHeight":h=c.availHeight*f[7]/100;break;default:continue}f[2]&&h<f[3]&&(h=f[3]);f[4]&&h>f[5]&&(h=f[5]);d+=a.substring(e,f.index)+g+"="+Math.round(h);e=f.index+f[0].length}return d+a.substring(e)};
eq.Dom.resolveWindowFeatures.re=/([a-z]+)=(([0-9]+)<)?(([0-9]+)>)?(([0-9]+)%)/ig;eq.Dom.updateQueryString=function(a,b,c){var d=this.updateQueryString.re.exec(a),e=d[2];e?(a=new RegExp("([?&])"+b+"=[^&#]*","i"),e.match(a)?void 0!==c?e=e.replace(a,"$1"+b+"="+c):(e=e.replace(a,""),e.length&&"&"===e.charAt(0)&&(e=e.replace("&","?"))):void 0!==c&&(e=e+"&"+b+"="+c)):void 0!==c&&(e="?"+b+"="+c);a=d[1];e&&(a+=e);d[3]&&(a+=d[3]);return a};eq.Dom.updateQueryString.re=/^([^?#]+)([?][^#]*)?(#.*)?$/;
eq.Dom.zIndex=function(a){a=window.getComputedStyle(a).zIndex;return+a===+a?+a:0};eq.Dom.zIndexMax=function(a){a=a.children;for(var b=0,c=a.length;0<=--c;){var d=window.getComputedStyle(a[c]).zIndex;+d===+d&&+d>b&&(b=+d)}return b};eq.Dom.eqControl=function(a){for(var b;a&&a!==document;){if((b=a.classList)&&b.contains("eq-control"))return a;a=a.parentNode}return null};eq.Dom.eqDialog=function(a){for(var b;a&&a!==document;){if((b=a.classList)&&b.contains("eq-dialog"))return a;a=a.parentNode}return null};
eq.Dom.eqOverlay=function(a){for(var b;a&&a!==document;){if((b=a.classList)&&b.contains("eq-overlay"))return a;a=a.parentNode}return null};eq.Dom.isRootChild=function(a){for(var b;a&&a!==document;){if((b=a.classList)&&b.contains("eq-root"))return!0;a=a.parentNode}return!1};eq.Dom.isMenu=function(a){for(var b;a&&a!==document;){if(b=a.classList)if(b.contains("eq-menubar")||b.contains("eq-menu"))return!0;a=a.parentNode}return!1};
eq.Dom.closeMenu=function(){var a=eq.app,b=a.menuOpen;if(b){if((b=document.getElementById(b))&&b.classList.contains("eq-open")){b.classList.remove("eq-open");b=b.getElementsByClassName("eq-open");for(var c=b.length;0<=--c;)b[c].classList.remove("eq-open")}a.menuOpen=void 0;a.constructor.ttClose()}};eq.Dom.parentIndex=function(a){for(var b=0;a=a.previousElementSibling;)b++;return b};eq.Dom.firstChildByTagName=function(a,b){for(a=a.firstElementChild;a&&a.tagName!==b;)a=a.nextElementSibling;return a};
eq.Dom.inputElement=function(a){var b=a.getElementsByTagName("INPUT");if(1!==b.length)throw Error("BUG: InputElement id:"+a.id+" elements:"+b.length+", expected: 1");return b[0]};eq.Dom.consumeEvent=function(a){a.preventDefault();a.stopImmediatePropagation()};eq.Dom.fireEvent=function(a,b){var c=document.createEvent("Event");c.initEvent(b,!0,!0);a.dispatchEvent(c)};eq.Dom.fireMouseEvent=function(a,b,c){var d=document.createEvent("MouseEvent");d.initEvent(b,!0,!0);void 0!==c&&(d.eq=c);a.dispatchEvent(d)};
eq.Dom.fireClick=function(a,b){this.fireMouseEvent(a,"mousedown",b);this.fireMouseEvent(a,"mouseup",b);this.fireMouseEvent(a,"click",b)};eq.Dom.isEnterOrSpace=function(a){switch(a){case "Enter":return 10;case " ":case "Spacebar":return 32}return 0};eq.Dom.onNextCycle=function(a,b){var c=this.onNextCycle,d=c.queue;d.push({cb:a,arg:b});1===d.length&&window.setTimeout(c.exec)};eq.Dom.onNextCycle.queue=[];
eq.Dom.onNextCycle.exec=function(){for(var a=eq.Dom.onNextCycle,b=a.queue,c=0,d=b.length;c<d;c++){var e=b[c],f=e.arg;void 0!==f?e.cb(f):e.cb()}d&&b.splice(0,d);b.length&&window.setTimeout(a.exec)};eq.Dom.cancelNextCycle=function(a){for(var b=this.onNextCycle.queue,c=b.length;0<=--c;)if(b[c].cb===a){b.splice(c,1);break}};
eq.Dom.onNextFrame=function(a,b){var c=this.onNextFrame,d=c.queue[c.queue_i],e=d.get(a);if(void 0===e)d.set(a,[b]),1===d.size&&window.requestAnimationFrame(c.exec);else{a=b.cb;c=0;for(d=e.length;c<d;c++)if(e[c].cb===a){e[c]=b;return}e.push(b)}};eq.Dom.onNextFrame.queue=[new Map,new Map];eq.Dom.onNextFrame.queue_i=0;eq.Dom.onNextFrame.exec=function(){var a=eq.Dom.onNextFrame,b=a.queue[a.queue_i];++a.queue_i===a.queue.length&&(a.queue_i=0);b.forEach(a.commit);b.clear()};
eq.Dom.onNextFrame.commit=function(a,b){for(var c=0,d=a.length;c<d;c++){var e=a[c];e.cb(b,e)}};eq.c.Obj.subClass("Timers",function(){eq.c.Obj.call(this);this.m=new Map});eq.c.Timers.prototype.dispose=function(){this.m.forEach(eq.c.Timers.cbDispose);this.m.clear()};eq.c.Timers.cbDispose=function(a){window.clearTimeout(a.id)};eq.c.Timers.prototype.add=function(a,b,c,d){b={elapsed:b,canceled:c,arg:d};b.id=window.setTimeout(eq.c.Timers.cbElapsed,a,this,b);this.m.set(b.id,b);return b.id};
eq.c.Timers.prototype.cancel=function(a){var b=this.m.get(a),c;b&&(window.clearTimeout(a),this.m.delete(a),(c=b.canceled)&&c(b.arg))};eq.c.Timers.prototype.cancelAll=function(){this.m.forEach(eq.c.Timers.cbCancel);this.m.clear()};eq.c.Timers.cbCancel=function(a){window.clearTimeout(a.id);var b=a.canceled;b&&b(a.arg)};eq.c.Timers.cbElapsed=function(a,b){a.m.delete(b.id);(a=b.elapsed)&&a(b.arg)};
eq.c.Obj.subClass("Window",function(a,b,c){eq.c.Obj.call(this);var d=a.classList;if(!d.contains("eq-window")&&!d.contains("eq-dialog"))throw Error("BUG: Invalid window root");c&&d.add("eq-d"+c.id);var e=eq.app,f,g;d=a.style;void 0===(f=e.wl)?e.wl=[]:0===f.length&&(f=void 0);b||(b=document.body);if(void 0===f)f=e.wl,d.zIndex=eq.Dom.zIndex(b)+1;else{var h=0;for(g=f.length;;){if(void 0===(e=f[h].root))throw Error("BUG: Window root undefined");if(++h===g){e.classList.remove("eq-active");d.zIndex=eq.Dom.zIndex(e)+
1;break}}}this.root=a;this.dlg=c;this.modified={};f.push(this);d.visibility="hidden";b.appendChild(a)});
eq.c.Window.prototype.close=function(){var a,b,c,d,e;if(void 0===(a=this.root))throw Error("BUG: Window root undefined");if(void 0===(b=eq.app.wl))throw Error("BUG: Window list undefined");for(c=b.length;0<=--c;)if(b[c]===this){b.splice(c,1);var f=eq.Dom.zIndex(a);for(d=b.length;c<d;c++){if(void 0===(e=b[c].root))throw Error("BUG: Window root undefined");e.style.zIndex=f++}break}if(-1===c)throw Error("BUG: Window not in list");a.parentNode.removeChild(a);this.forcedInline=this.whenVisible=this.pos=
this.modified=this.dlg=this.root=void 0;return(d=b.length)?b[d-1]:null};
eq.c.Window.setupFrame=function(a){var b=a.classList;if(!(b.contains("eq-dialog")||b.contains("eq-popup-box")||b.contains("eq-message-dialog")||b.contains("eq-login-dialog")))throw Error("BUG: Invalid window frame child");b=document.createElement("DIV");var c=document.createElement("DIV"),d=document.createElement("DIV"),e=document.createElement("DIV"),f=document.createElement("DIV"),g=document.createElement("DIV"),h=document.createElement("DIV");b.className="eq-window";c.className="eq-pane";d.className=
"eq-caption";e.className="eq-logo eq-move";d.appendChild(e);f.className="eq-title eq-move";f.appendChild(document.createTextNode("\u00a0"));f.appendChild(document.createElement("SPAN"));d.appendChild(f);g.className="eq-max";d.appendChild(g);h.className="eq-close";d.appendChild(h);c.appendChild(d);c.appendChild(a);b.appendChild(c);for(a=0;8>a;a++){switch(a){case 0:var k="eq-top";break;case 1:k="eq-top eq-right";break;case 2:k="eq-right";break;case 3:k="eq-bottom eq-right";break;case 4:k="eq-bottom";
break;case 5:k="eq-bottom eq-left";break;case 6:k="eq-left";break;case 7:k="eq-top eq-left"}c=document.createElement("DIV");c.className=k+" eq-resize";b.appendChild(c);b.onmousedown=eq.c.App.onGlobalMouseDownOrClick}return b};eq.c.Window.prototype.setPos=function(a,b){if(-1===a||-1===b)eq.Dom.onNextFrame(this,{cb:eq.c.Window.setPos.center,x:a,y:b});else{var c;if(void 0===(c=this.root))throw Error("BUG: Window root undefined");eq.c.Window.setPos(this,c,a,b)}};
eq.c.Window.setPos=function(a,b,c,d){b=b.style;b.left=+c===+c?0<c?c+"px":0:c;b.top=+d===+d?0<d?d+"px":0:d;eq.Dom.onNextFrame(a,{cb:eq.c.Window.setPos.makeVisible})};
eq.c.Window.setPos.center=function(a,b){var c=eq.c.Window,d,e,f,g,h;if(void 0===(d=a.root))c.setPos.makeVisible(a);else{var k=d.getBoundingClientRect();var l=b.x;b=b.y;if(void 0!==(e=eq.app.wl))for(f=e.length;0<=--f;)if(e[f]===a){if(0<f){if(void 0===(e=e[f-1].root))throw Error("BUG: Window root undefined");(g=d.offsetParent)!==document.body&&(h=g.getBoundingClientRect());g=e.getBoundingClientRect();if(0===g.width||0===g.height)break;-1===l&&(l=(g.width-k.width)/2+g.left,void 0!==h&&(l-=h.left));-1===
b&&(b=(g.height-k.height)/2+g.top,void 0!==h&&(b-=h.top));c.setPos(a,d,l,b);return}break}(g=d.offsetParent)===document.body?(h=eq.Dom.viewRect(),-1===l&&(l=(h.w-k.width)/2+h.x),-1===b&&(b=(h.h-k.height)/2+h.y)):(h=g.getBoundingClientRect(),-1===l&&(l=(h.width-k.width)/2),-1===b&&(b=(h.height-k.height)/2));c.setPos(a,d,l,b)}};
eq.c.Window.setPos.makeVisible=function(a){var b;void 0===(b=a.root)||a.makeBaseDialogInline()||(b.style.visibility="");void 0!==(b=a.whenVisible)&&(a.whenVisible=void 0,eq.Dom.onNextFrame(a,b))};eq.c.Window.prototype.setTitle=function(a){var b,c,d;if(void 0===(b=this.root))throw Error("BUG: Window root undefined");(c=this.forcedInline)?c.t=a:(d=b.querySelector(".eq-window>.eq-pane>.eq-caption>.eq-title>span"))&&eq.Dom.setTextContent(d,a)};
eq.c.Window.prototype.setIcon=function(a){var b,c;a=a?"url('"+a+"')":"";if(void 0===(b=this.root))throw Error("BUG: Window root undefined");if(c=this.forcedInline)c.ic=a;else if(b=b.querySelector(".eq-window>.eq-pane>.eq-caption>.eq-logo"))b.style.backgroundImage=a};
eq.c.Window.prototype.canClose=function(){var a,b,c;if(void 0===(a=this.root))throw Error("BUG: Window root undefined");return(b=this.forcedInline)?b.c:(c=a.querySelector(".eq-window>.eq-pane>.eq-caption>.eq-close"))?null!==c.offsetParent:!1};
eq.c.Window.prototype.activate=function(){var a,b,c,d,e;if(void 0===(a=this.root))throw Error("BUG: Window root undefined");if(void 0===(b=eq.app.wl))throw Error("BUG: Window list undefined");for(c=d=b.length;0<=--c;)if(b[c]===this){a.classList.add("eq-active");if(c!==d-1){b.splice(c,1);var f=eq.Dom.zIndex(a);for(d=b.length;c<d;){if(void 0===(e=b[c].root))throw Error("BUG: Window root undefined");e.style.zIndex=f++;++c===d&&e.classList.remove("eq-active")}a.style.zIndex=f;b.push(this);return!0}return!1}throw Error("BUG: Window not in list");
};
eq.c.Window.prototype.makeInline=function(a){var b,c,d;if(void 0===(b=this.root))throw Error("BUG: Window root undefined");if(b.classList.contains("eq-window")){if(!(c=b.querySelector(".eq-window>.eq-pane>.eq-dialog")))throw Error("BUG: no Dialog in Window");var e=b.classList;if(a){a=c.querySelector(".eq-dialog>.eq-pane>.eq-view");var f=b.querySelector(".eq-window>.eq-pane>.eq-caption>.eq-title>span");var g=b.querySelector(".eq-window>.eq-pane>.eq-caption>.eq-logo");this.forcedInline={x:b.offsetLeft,y:b.offsetTop,
w:a.offsetWidth,h:a.offsetHeight,t:f?f.textContent:void 0,l:g?g.style.backgroundImage:void 0,r:e.contains("eq-resize"),c:e.contains("eq-close"),m:e.contains("eq-max")}}(e=c.style).visibility="hidden";e.zIndex=eq.Dom.zIndex(b);(e=c.classList).add("eq-inline");(d=this.dlg)&&e.add("eq-d"+d.id);b.parentNode.replaceChild(c,b);return this.root=c}return null};
eq.c.Window.prototype.makeFramed=function(a){var b=eq.c.Window,c=this.forcedInline,d,e,f;if(void 0===(d=this.root))throw Error("BUG: Window root undefined");if(d.classList.contains("eq-dialog")&&(!a||void 0!==c)){var g=eq.Dom.zIndex(d);var h=b.setupFrame((b=d.parentNode).removeChild(d));(f=h.style).visibility="hidden";f.zIndex=g;d.style.zIndex="";(g=d.classList).remove("eq-inline");g.remove("eq-max");(e=this.dlg)&&g.remove("eq-d"+e.id);g=h.classList;e&&g.add("eq-d"+e.id);a&&(this.forcedInline=void 0,
a=d.querySelector(".eq-dialog>.eq-pane>.eq-view"),f.left=0<c.x?c.x+"px":0,f.top=0<c.y?c.y+"px":0,(f=a.style).width=0<c.w?c.w+"px":0,f.height=0<c.h?c.h+"px":0,c.t&&(a=h.querySelector(".eq-window>.eq-pane>.eq-caption>.eq-title>span"),a.textContent=c.t),c.l&&(a=h.querySelector(".eq-window>.eq-pane>.eq-caption>.eq-logo"),a.style.backgroundImage=c.l),c.r?g.add("eq-resize"):g.remove("eq-resize"),c.c?g.add("eq-close"):g.remove("eq-close"),c.m?g.add("eq-max"):g.remove("eq-max"));b.appendChild(h);return this.root=
h}return null};eq.c.Window.prototype.makeBaseDialogInline=function(){var a=eq.app,b,c;if(void 0!==(b=a.wl)&&1===b.length&&b[0]===this&&void 0!==(c=a.layoutMode)&&c&eq.LayoutMode.inline&&c&eq.LayoutMode.dialog){if(void 0===this.root)throw Error("BUG: Window root undefined");if(a=this.makeInline(!0))return c&eq.LayoutMode.maximized?a.classList.add("eq-max"):a.classList.remove("eq-max"),a.style.visibility="",!0}return!1};
eq.c.Window.zOrderModified=function(){var a=eq.app,b,c,d,e;if(void 0!==(b=a.wl)){void 0===(c=a.layoutMode)||c&eq.LayoutMode.inline&&c&eq.LayoutMode.dialog||(c=void 0);var f=!0;for(a=b.length;0<=--a;){var g=b[a];if(void 0===g.root)throw Error("BUG: Window root undefined");if(void 0!==c&&void 0!==g.dlg)if(0===a){if(d=g.makeInline(!0))c&eq.LayoutMode.maximized?d.classList.add("eq-max"):d.classList.remove("eq-max"),d.style.visibility=""}else if(d=g.makeFramed(!0))d.style.visibility="";if(void 0===(d=
g.root))throw Error("BUG: Window root undefined");g=d.classList;void 0===f?g.remove("eq-active"):(f=void 0,g.add("eq-active"));e?g.add("eq-hidden"):(g.remove("eq-hidden"),g.contains("eq-window")||(e=!0))}}};eq.c.Window.fromTarget=function(a){var b,c,d;if(void 0!==(b=eq.app.wl))for(;a&&a!==document;){if(c=a.classList){if(c.contains("eq-dialog")||c.contains("eq-popup-box"))break;if(c.contains("eq-window")){for(c=b.length;0<=--c;)if((d=b[c]).root===a)return d;break}}a=a.parentNode}return null};
eq.c.Window.moveMode={left:1,top:2,right:4,bottom:8,size:16};
eq.c.Window.prototype.onMouseDownOrClick=function(a){if("mousedown"===a.type){var b=eq.c.Window,c=this.root,d=a.target,e=d.parentNode,f=d.classList,g;if(e&&f){var h=eq.app;var k=b.moveMode;if(f.contains("eq-resize")&&e===c)if(f.contains("eq-top")){var l=k.top+k.size;f.contains("eq-left")?l+=k.left:f.contains("eq-right")&&(l+=k.right)}else f.contains("eq-bottom")?(l=k.bottom,f.contains("eq-left")?l+=k.left+k.size:f.contains("eq-right")&&(l+=k.right)):f.contains("eq-left")?l=k.left+k.size:f.contains("eq-right")&&
(l=k.right);else{for(;e&&e!==c&&(!(g=e.classList)||!g.contains("eq-caption"));)f=g,d=e,e=d.parentNode;if(e&&(g=e.classList)&&g.contains("eq-caption")&&(e=e.parentNode)&&(g=e.classList)&&g.contains("eq-pane")&&(e=e.parentNode)&&e===c){if(f.contains("eq-close")){f.add("eq-click");var n;void 0!==(n=this.dlg)?n===h.currDlg?h.submit(document.body,{type:"close"}):n.pendingClose=!0:this.close();return!0}if(f.contains("eq-max"))return(f=e.classList).contains("eq-max")?(f.remove("eq-max"),h=this.pos,void 0!==
h&&(this.pos=void 0,b.setPos(this,c,h.x,h.y))):(this.pos={x:c.offsetLeft,y:c.offsetTop},f.add("eq-max")),this.modified.maximized=!0;f.contains("eq-move")&&(e.classList.contains("eq-max")||(l=k.left+k.top))}}if(void 0!==l)return a={w:this,x:a.clientX,y:a.clientY,mode:l},(e=c.offsetParent)===document.body?a.px=a.py=0:(c=e.getBoundingClientRect(),a.px=c.left,a.py=c.top),h.moveCapture(a,b.onMove),!0}}return!1};
eq.c.Window.onMove=function(a,b){b.busy||(b.busy=!0,eq.Dom.onNextFrame(b.w,{cb:eq.c.Window.onMove.exec,x:a.clientX,y:a.clientY,m:b}))};
eq.c.Window.onMove.exec=function(a,b){var c=eq.c.Window,d=c.moveMode,e=b.x,f=b.y;b=b.m;var g=b.mode,h=g&d.size,k=a.root;if(void 0===k)b.busy=void 0;else{var l=k.getBoundingClientRect();if(g&d.left&&e!==b.x&&(void 0===b.maxX||e<=b.maxX)){var n=l.left+window.pageXOffset-b.px,m=n+e-b.x;0>m&&(m=0,e=b.x-n);k.style.left=m?m+"px":0;a.modified.pos=!0;if(h){if(void 0===p){var p=k.querySelector(".eq-dialog>.eq-pane>.eq-view");p={rc:l,dv:p,drc:p.getBoundingClientRect()}}p.dv.style.width=n+p.drc.width-m+"px";
p.cx=e;p.cw=l.width}else b.x=e}g&d.top&&f!==b.y&&(void 0===b.maxY||f<=b.maxY)&&(n=l.top+window.pageYOffset-b.py,m=n+f-b.y,0>m&&(m=0,f=b.y-n),k.style.top=m?m+"px":0,a.modified.pos=!0,h?(void 0===p&&(p=k.querySelector(".eq-dialog>.eq-pane>.eq-view"),p={rc:l,dv:p,drc:p.getBoundingClientRect()}),p.dv.style.height=n+p.drc.height-m+"px",p.cy=f,p.cw=l.height):b.y=f);g&d.right&&e!==b.x&&(void 0===b.minX||e>=b.minX)&&(void 0===p&&(p=k.querySelector(".eq-dialog>.eq-pane>.eq-view"),p={rc:l,dv:p,drc:p.getBoundingClientRect()}),
p.dv.style.width=p.drc.width+e-b.x+"px",p.cx=e,p.cw=l.width);g&d.bottom&&f!==b.y&&(void 0===b.minY||f>=b.minY)&&(void 0===p&&(p=k.querySelector(".eq-dialog>.eq-pane>.eq-view"),p={rc:l,dv:p,drc:p.getBoundingClientRect()}),p.dv.style.height=p.drc.height+f-b.y+"px",p.cy=f,p.ch=l.height);if(void 0===p)b.busy=void 0;else eq.Dom.onNextFrame(a,{cb:c.onMove.chk,m:b,chk:p})}};
eq.c.Window.onMove.chk=function(a,b){var c=b.m,d=a.root,e=b.chk,f=d.getBoundingClientRect();if(void 0!==e.cw&&e.cw!==f.width||void 0!==e.ch&&e.ch!==f.height)void 0!==e.cw&&(e.cw=f.width),void 0!==e.ch&&(e.ch=f.height);else{if(e.done){c.busy=void 0;return}void 0!==e.cx&&(f.width!==e.rc.width?(c.x=e.cx,c.minX=c.maxX=void 0,a.modified.size=!0):(d.style.left=e.rc.left+window.pageXOffset-c.px+"px",e.dv.style.width=e.drc.width+"px",void 0===c.minX&&void 0===c.maxX&&(e.cx<c.x?(c.minX=c.x,c.maxX=void 0):
(c.maxX=c.x,c.minX=void 0))));void 0!==e.cy&&(f.height!==e.rc.height?(c.y=e.cy,c.minY=c.maxY=void 0,a.modified.size=!0):(d.style.top=e.rc.top+window.pageYOffset-c.py+"px",e.dv.style.height=e.drc.height+"px",void 0===c.minY&&void 0===c.maxY&&(e.cy<c.y?(c.minY=c.y,c.maxY=void 0):(c.maxY=c.y,c.minY=void 0))));e.done=!0}eq.Dom.onNextFrame(a,b)};eq.d=eq.d||new Map;eq.c.Obj.subClass("DlgElement",function(a,b){eq.c.Obj.call(this);this.toolTip=this.accel=this.tvNodes=this.cssRules=null;this.ddi=void 0});
eq.c.DlgElement.prototype.sensitive=!0;eq.c.DlgElement.addClass=function(a,b){this.subClass(a,b);eq.d.set(a,b);return b};
eq.c.DlgElement.prototype.dispose=function(a,b){var c=this.cssRules,d=c?c.length:0;if(d){var e=eq.app.stl,f=e.sheet,g=e.owner,h=g.length;e=0;var k,l;if(-1===(k=l=g.indexOf(b)))throw Error(this.constructor.name+".dispose("+b+") "+d+" stale CSS rules");do f.deleteRule(l),e++;while(++k<h&&g[k]===b);g.splice(l,e);c.length=0;this.cssRules=null;if(e!==d)throw Error(this.constructor.name+".dispose("+b+") CSS rules inconsistent:"+d+"/"+e);}if(c=this.tvNodes){f=eq.c.DlgElement;g=f.triggerVisible;h=g.wh;e=
0;for(d=c.length;e<d;e++)if(l=h.get(k=c[e]))l.forEach(f.disposeTvNodes,this),0===l.size&&(h.delete(k),0===h.size&&g.ob.disconnect());c.length=0;this.tvNodes=null}d=this.accel;null!==d&&(a=a.accel,a.get(d)===b&&a.delete(d),this.accel=null);this.toolTip=null;this.ddi=void 0};eq.c.DlgElement.disposeTvNodes=function(a,b,c){for(var d=0;d<a.length;)a[d].self===this?a.splice(d,1):d++;0===a.length&&c.delete(b)};
eq.c.DlgElement.prototype.updateId=function(a,b,c){var d=this.cssRules,e=d?d.length:0;if(e){var f=eq.c.DlgElement,g=eq.app.stl,h=g.sheet;g=g.owner;var k=g.length,l=0,n;if(-1===(n=g.indexOf(c)))throw Error(this.constructor.name+".updateId("+c+") "+e+" stale CSS rules");do h.deleteRule(n),f.insertCssRule(h,n,b,d[l++].rule),g[n]=b;while(++n<k&&g[n]===c);if(l!==e)throw Error(this.constructor.name+".updateId("+c+") CSS rules inconsistent:"+e+"/"+l);}else if(-1!==(e=eq.app.stl.owner.indexOf(c)))throw Error(this.constructor.name+
".updateId("+c+") CSS rules inconsistent:"+e);d=this.accel;null!==d&&(a=a.accel,a.get(d)===c&&a.set(d,b))};
eq.c.DlgElement.prototype.setAttr=function(a,b,c,d){for(var e=eq.RqTag,f=0,g=d.length;f<g;f++){var h=d[f],k=h.t;switch(k){case e.sensitive:k=!!(h.v&1);h=h.v>>1;var l,n,m,p,q;if(h)this.sensitive=k,this.parentDisabled=h,this.setSensitive(a,b,c,!1);else if(this.sensitive!==k&&(this.sensitive=k,this.parentDisabled||this.setSensitive(a,b,c,k),l=(h=c.querySelectorAll(".eq-control")).length))for(n=a.eds;0<=--l;){if(void 0===(m=n.get(q=(p=h[l]).id)))throw Error(this.constructor.name+".setAttr("+b+") sensitive BUG: child "+
q+" not registered");k?m.parentDisabled&&0>=--m.parentDisabled&&(m.parentDisabled=void 0,m.sensitive&&m.setSensitive(a,q,p,!0)):m.parentDisabled?m.parentDisabled++:(m.parentDisabled=1,m.sensitive&&m.setSensitive(a,q,p,!1))}break;case e.toolTip:(this.toolTip=h.v)?eq.app.ttAttach(c):(eq.app.ttDetach(c),this.toolTip=null);break;default:throw Error(this.constructor.name+".setAttr("+b+") failed: tag "+k);}}};eq.c.DlgElement.setAttr=function(a){a.t.setAttr(a.d,a.i,a.e,a.r)};
eq.c.DlgElement.setFont=function(a,b){eq.Dom.setFont(a,b)?a.classList.add("eq-font"):a.classList.remove("eq-font")};eq.c.DlgElement.prototype.setSensitive=function(a,b,c,d){a=c.classList;d?a.remove("eq-disabled"):a.add("eq-disabled")};
eq.c.DlgElement.prototype.setAccel=function(a,b,c,d){var e=this.accel;c=void 0===c||null===c?null:d?String.fromCharCode(d+48)+c.toUpperCase():c.toUpperCase();c!==e&&(a=a.accel,null!==e&&a.get(e)===b&&a.delete(e),null===c||a.has(c)?this.accel=null:a.set(this.accel=c,b))};eq.c.DlgElement.prototype.onEvent=function(a,b,c,d){return!0};eq.c.DlgElement.prototype.onKey=function(a,b,c,d,e,f){return!1};eq.c.DlgElement.prototype.onAccel=function(a,b,c){eq.Dom.fireClick(this.focusElement(a,c))};
eq.c.DlgElement.prototype.onTypeAhead=function(a,b,c,d){switch(d){case "ShiftTab":var e=-1;break;case "Tab":e=1;break;case "ShiftEnter":e=-1;case "Enter":d=c.classList;if(d.contains("eq-enter"))return!1;a.fkey&&0<a.fkey.length&&a.fkey[0]||void 0!==e||d.contains("eq-noenter")||(e=1)}if(e){d=eq.app;var f=a.nextTab(b,-1===e);f?(d.pendingTabMode=e,d.pendingTabModeId=a=f.id,d.setFocus(a,f)):d.processEvent(a,{type:"blur",target:this.focusElement(a,c)},b,c,this);return!0}return!1};
eq.c.DlgElement.prototype.onSubmit=function(a,b,c,d){};eq.c.DlgElement.prototype.onChange=function(a,b,c,d){return!0};eq.c.DlgElement.prototype.onToolTip=function(a){return this.toolTip};eq.c.DlgElement.prototype.onDragStart=function(a,b,c,d,e,f){return!1};eq.c.DlgElement.setDropModes=function(a,b){var c=eq.Dnd;a.dataTransfer.effectAllowed=b&c.move?b&c.copy?b&c.link?"all":"copyMove":b&c.link?"linkMove":"move":b&c.copy?b&c.link?"copyLink":"copy":b&c.link?"link ":"none"};
eq.c.DlgElement.prototype.onDragOver=function(a,b,c,d){return null};eq.c.DlgElement.prototype.onDrop=function(a,b,c,d,e){return 0};eq.c.DlgElement.prototype.focusElement=function(a,b){return b};eq.c.DlgElement.prototype.focusGained=function(a,b){};eq.c.DlgElement.prototype.focusLost=function(a,b){};eq.c.DlgElement.prototype.changed=function(a,b,c,d){return null};eq.c.DlgElement.prototype.onUpdate=function(a,b,c,d,e,f){throw Error("BUG: "+this.constructor.name+".onUpdate("+b+") not implemented");};
eq.c.DlgElement.prototype.onUpdateReturn=function(a,b,c){var d=this.ddi,e=eq.app;if(!d)throw Error("BUG: "+this.constructor.name+".onUpdate("+b+") undefined context");this.ddi=void 0;d.o=eq.ApiOp.updated;d.d=c;e.api.postMessage(d);a.temp&&e.closeDialog(a)};eq.c.DlgElement.prototype.onMessage=function(a,b,c,d){};
eq.c.DlgElement.prototype.updated=function(a,b,c,d,e){var f=eq.UpdateTag;switch(d){case f.mouseButton2:a=eq.app;a.onceRule=e.rule;a.onceId=b;a.submit(c,{id:b,type:"click"});break;case f.ctxMenuOpen:b=eq.Dom;c=e.y;var g,h,k;d=a.addControl(e.et);(f=d.style).left=e.x+window.pageXOffset+"px";f.top=c+window.pageYOffset+"px";f=eq.app.fnDefault;for(var l=a.root.length;0<=--l;)if((h=(g=a.root[l]).classList).contains("eq-dialog")){(k=g.firstElementChild).classList.contains("eq-menubar")?g=k:h.contains("eq-root-font")||
(g=null);g&&(b.copyFont(d,g),b.adjustElementFontSize(d),d.classList.add("eq-root-font"),f=null);break}f&&(b.setFont(d,f)?(b.adjustElementFontSize(d),d.classList.add("eq-root-font")):d.classList.add("eq-default-font"));a.eds.get(d.id).contextMenuId=e.id;b.onNextFrame(d,{cb:eq.c.DlgElement.showContextMenu,y:c});break;default:throw Error(this.constructor.name+".updated("+b+") invalid tag "+d);}};
eq.c.DlgElement.showContextMenu=function(a,b){eq.app.makeOverlay(a,a,eq.c.Menu.closeContextMenu);a.classList.contains("eq-scroll")&&(a.style.maxHeight=document.documentElement.clientHeight-b.y-2+"px")};
eq.c.DlgElement.prototype.setCssRule=function(a,b,c){var d=eq.c.DlgElement,e=this.cssRules,f=eq.app.stl,g=f.sheet;f=f.owner;var h=f.length,k,l,n,m;e||(e=this.cssRules=[]);var p=0;for(k=e.length;p<k;p++)if(b===(l=e[p]).type){if(-1!==(n=f.indexOf(a)))for(m=p;0<p--;)if(++n>=h||f[n]!==a){n=-1;break}if(-1===n)throw Error(this.constructor.name+".setCssRule("+a+") not found, type:"+b);g.deleteRule(n);c?(l.rule=c,d.insertCssRule(g,n,a,c)):(e.splice(m,1),f.splice(n,1),0===e.length&&(this.cssRules=null));return}if(-1!==
(n=f.indexOf(a))){for(p=1;++n<h&&f[n]===a;)p++;if(p!==k)throw Error(this.constructor.name+".setCssRule("+a+") inconsistent:"+k+"/"+p+", type:"+b);}else{if(k)throw Error(this.constructor.name+".setCssRule("+a+") inconsistent:"+k+", type:"+b);n=h}c&&(e.push({rule:c,type:b}),d.insertCssRule(g,n,a,c),f.splice(n,0,a))};eq.c.DlgElement.insertCssRule=function(a,b,c,d){if(Array.isArray(d)){var e="";for(var f=0,g=d.length;f<g;f++)e+="#"+c+d[f]}else e="#"+c+d;a.insertRule(e,b)};
eq.c.DlgElement.prototype.duplicateCssRules=function(a){var b=this.cssRules,c=b?b.length:null;if(c){var d=eq.c.DlgElement,e=eq.app.stl,f=e.sheet;e=e.owner;var g=e.length,h,k;for(h=1;-1!==e.indexOf(k=a+"-"+h);h++);for(h=0;h<c;h++,g++)d.insertCssRule(f,g,k,b[h].rule),e.push(k);return k}return""};
eq.c.DlgElement.prototype.whenVisible=function(a,b,c,d){if(null!==c.offsetParent)d.call(this,a,b,c);else{var e=eq.c.DlgElement,f=this.tvNodes,g,h,k;for(g=c;(h=g.parentNode)&&null===h.offsetParent;g=h);if(g){null===f?this.tvNodes=[g]:-1===f.indexOf(g)&&f.push(g);void 0===(f=(k=(h=e.triggerVisible).wh).get(g))&&(k.set(g,f=new Map),h.ob.observe(g,e.onTriggerVisibleMode));void 0===(e=f.get(b))&&f.set(b,e=[]);b=0;for(g=e.length;b<g;b++)if(e[b].cb===d)return;e.push({cb:d,self:this,dlg:a,el:c})}else console.error("DlgElement.whenVisible: No parent to watch for '"+
b+"'")}};eq.c.DlgElement.onTriggerVisibleMode={attributes:!0,attributeFilter:["class","style"]};eq.c.DlgElement.onTriggerVisible=function(a,b){b=eq.c.DlgElement;for(var c=b.triggerVisible,d=c.wh,e=0,f=a.length;e<f;e++){var g=a[e].target,h=d.get(g);h&&"none"!==window.getComputedStyle(g).display&&(h.forEach(b.onTriggerVisibleExec,g),h.clear(),d.delete(g),0===d.size&&c.ob.disconnect())}};
eq.c.DlgElement.onTriggerVisibleExec=function(a,b){for(var c=0,d=a.length;c<d;c++){var e=a[c],f=e.self,g=f.tvNodes;e.cb.call(f,e.dlg,b,e.el);g&&-1!==(c=g.indexOf(this))&&(g.splice(c,1),0===g.length&&(f.tvNodes=null))}a.length=0};eq.c.DlgElement.triggerVisible={ob:new MutationObserver(eq.c.DlgElement.onTriggerVisible),wh:new Map};eq.c.Obj.subClass("Dlg",function(a){eq.c.Obj.call(this);this.id=a;this.grid={};this.w=null;this.root=[];this.eds=new Map;this.tabOrder=null;this.accel=new Map});delete eq.c.Dlg.subClass;
eq.c.Dlg.prototype.close=function(){var a=this.constructor,b=eq.c.App;this.resetCurrDlg();b.ttClose();if(document.title===this.title){var c=b.title;c!==document.title&&(document.title=c,eq.app.updateSessionList())}for(c=this.root.length;0<=--c;){var d=this.root[c];b.removeRootListeners(d);if(d.classList.contains("eq-dialog")){if(null===this.w)throw Error("Dlg.close("+this.id+") BUG: no Window");this.w.close();this.w=null}else d.parentNode.removeChild(d)}this.root.length=0;if(null!==this.w)throw Error("Dlg.close("+
this.id+") BUG: Window not closed");this.accel.clear();this.eds.forEach(a.cbDisposeDlgElement,this);this.eds.clear();this.tabOrder=null;this.ddo=this.timer=this.fkey=this.icon=this.title=this.layout=this.whenReadyArg=this.whenReady=this.pendingClose=void 0;this.temp&&(a=document.getElementById("eq-temp"))&&a.parentNode.removeChild(a)};eq.c.Dlg.cbDisposeDlgElement=function(a,b){a.dispose(this,b)};
eq.c.Dlg.prototype.resetCurrDlg=function(){var a=eq.app;if(this===a.currDlg)this.whenReady&&this.callWhenReady(),a.currDlg=null,a.focus=null,a.changed.clear(),a.setIdle(this);else if(this.whenReady&&this.ddo)throw Error("Dlg.resetCurrDlg BUG: whenReady pending");this.whenReadyArg=this.whenReady=this.ddo=void 0};eq.c.Dlg.prototype.callWhenReady=function(){var a=this.whenReady,b=this.whenReadyArg;this.whenReadyArg=this.whenReady=void 0;a(this,b)};
eq.c.Dlg.prototype.addRoot=function(a){var b=a.classList,c,d;a.style.display="none";b.add("eq-root");if(b.contains("eq-dialog")){if(null!==this.w)throw Error("Dlg.addRoot("+this.id+") BUG: Window exists");var e=eq.c.Window;var f=eq.LayoutMode;if(void 0!==(c=eq.app.layoutMode)&&c&f.inline&&!(c&f.dialog))var g=a;else c=void 0,g=void 0===(d=this.layout)||d.mode===eq.DialogMode.inline?a:e.setupFrame(a);this.w=new e(g,document.getElementById("eq-dialog"),this);void 0!==c&&(b.add("eq-inline"),c&f.maximized?
b.add("eq-max"):b.remove("eq-max"))}else throw Error("Dlg.addRoot("+this.id+") BUG: not a Dialog");this.root.push(a);eq.c.App.addRootListeners(a)};
eq.c.Dlg.prototype.removeElement=function(a){var b=this.root,c=this.eds,d,e,f;if(-1!==(d=b.indexOf(a))){b.splice(d,1);var g=0===b.length}if(!g){b=a.querySelectorAll("[id]");for(d=b.length;0<=--d;)void 0!==(f=c.get(e=b[d].id))&&(f.dispose(this,e),c.delete(e));void 0!==(f=c.get(e=a.id))&&(f.dispose(this,e),c.delete(e))}if(void 0===g)a.parentNode.removeChild(a);else if(eq.c.App.removeRootListeners(a),a.classList.contains("eq-dialog")){if(null===this.w)throw Error("Dlg.removeElement("+this.id+") BUG: no Window");
this.w.close();this.w=null}else a.parentNode.removeChild(a);return g};
eq.c.Dlg.prototype.visible=function(){for(var a=this.constructor,b=!0,c=this.root.length;0<=--c;){var d=this.root[c];if(d.classList.contains("eq-dialog")){if(null===this.w)throw Error("Dlg.visible("+this.id+") BUG: no Window");"none"===(b=d.style).display&&(b.visibility="hidden",b.display="");d!==this.w.root&&"none"===(b=this.w.root.style).display&&(b.visibility="hidden",b.display="");for(var e=d.querySelector(".eq-dialog>.eq-pane>.eq-view>.eq-container"),f=e.parentNode.parentNode,g=d.firstElementChild,
h="eq-top",k;g;){if((b=g.classList).contains("eq-panel")){if(b.contains("eq-hidden")||b.contains("eq-toolbar")&&!b.contains(h)){var l=g.nextElementSibling;e.appendChild(g);b.remove("eq-rt");b.remove("eq-panel");b.remove("eq-horz");g=l;continue}}else if(b.contains("eq-pane")){k=g.firstElementChild;for(h="eq-left";k;){if((b=k.classList).contains("eq-panel")){if(b.contains("eq-hidden")||b.contains("eq-toolbar")&&!b.contains(h)){l=k.nextElementSibling;e.appendChild(k);b.remove("eq-rt");b.remove("eq-panel");
b.remove("eq-vert");k=l;continue}}else b.contains("eq-view")&&(h="eq-right");k=k.nextElementSibling}h="eq-bottom"}g=g.nextElementSibling}(b=(g=d.firstElementChild).classList).contains("eq-idle")&&(b=(g=g.nextElementSibling).classList);!b.contains("eq-menubar")&&(k=e.querySelector(".eq-menubar:not(.eq-hidden)"))&&((b=k.classList).add("eq-rt"),b.add("eq-panel"),d.insertBefore(k,g));(b=(g=d.lastElementChild).classList).contains("eq-idle")&&(b=g.previousElementSibling.classList);!b.contains("eq-statusbar")&&
(k=e.querySelector(".eq-statusbar:not(.eq-hidden)"))&&((b=k.classList).add("eq-rt"),b.add("eq-panel"),d.appendChild(k));e=e.querySelectorAll(".eq-toolbar:not(.eq-hidden)");h=0;for(l=e.length;h<l;h++)(b=(g=e[h]).classList).contains("eq-top")?(b.add("eq-rt"),b.add("eq-panel"),b.add("eq-horz"),(k=d.firstElementChild).classList.contains("eq-idle")&&(k=k.nextElementSibling),k.classList.contains("eq-menubar")?d.insertBefore(g,k.nextElementSibling):d.insertBefore(g,k)):b.contains("eq-bottom")?(b.add("eq-rt"),
b.add("eq-panel"),b.add("eq-horz"),(k=d.lastElementChild).classList.contains("eq-idle")&&(k=k.previousElementSibling),k.classList.contains("eq-statusbar")?d.insertBefore(g,k):d.appendChild(g)):b.contains("eq-left")?(b.add("eq-rt"),b.add("eq-panel"),b.add("eq-vert"),f.insertBefore(g,f.firstElementChild)):b.contains("eq-right")&&(b.add("eq-rt"),b.add("eq-panel"),b.add("eq-vert"),f.appendChild(g));if(void 0!==(l=this.fn)){f=d.id;g=this.eds.get(f);b=eq.FontStyle;e=l.fc;h=l.sz;var n=l.st;l=eq.app.fnSizeFactor;
this.fn=void 0;if(void 0===g)throw Error("Dlg.visible("+this.id+") BUG: not registered");if(e||h||n&(b.bold|b.italic)){var m=",.eq-d"+this.id+"{";e&&(m+="font-family:"+e+";");h&&(m+="font-size:"+h+";");n&b.bold&&(m+="font-weight:bold;");n&b.italic&&(m+="font-style:italic;");m+="}";(b=d.classList).add("eq-root-font");b.remove("eq-default-font")}else(b=d.classList).add("eq-default-font"),b.remove("eq-root-font");g.setCssRule(f,eq.RuleType.font,m);m=l&&1!==l?" .eq-fn,.eq-d"+this.id+" .eq-fn{font-size:"+
Math.round(1E3*l)/10+"%}":void 0;g.setCssRule(f,eq.RuleType.childFont,m)}eq.Dom.onNextFrame(this,{cb:a.commitVisible,rl:d,rc:d.getBoundingClientRect()});b=!1}else d.style.display=""}b&&this.whenReady&&this.callWhenReady()};
eq.c.Dlg.commitVisible=function(a,b){var c=eq.app,d=eq.LayoutMode,e=eq.DialogMode,f=a.w,g=b.rl,h=!0,k,l;if(null===f)a.whenReady&&a.callWhenReady();else{if(void 0===(k=f.root))throw Error("Dlg.commitVisible("+a.id+") BUG: Window root undefined");if(b=b.rc){var n=g.getBoundingClientRect();if(b.width!==n.width||b.height!==n.height){eq.Dom.onNextFrame(a,{cb:eq.c.Dlg.commitVisible,rl:g});return}}void 0===(b=a.layout)?g!==k&&(g.style.visibility=""):void 0!==(l=c.layoutMode)&&l&d.inline&&!(l&d.dialog)?(a.layout=
void 0,g!==k&&(g.style.visibility="")):(a.layout=void 0,void 0!==b.mode&&(b.mode===e.inline?f.makeInline()&&(k=f.root):f.makeFramed()&&(k=f.root)),(d=k.classList).contains("eq-dialog")?g!==k&&(g.style.visibility=""):(f.setTitle(a.title||c.title),f.setIcon(a.icon),void 0!==b.mode&&(b.mode===e.layout?(d.add("eq-resize"),void 0!==b.state&&(b.state&eq.DialogState.maximized?d.add("eq-max"):d.remove("eq-max"))):(d.remove("eq-resize"),d.remove("eq-max"))),g.classList.contains("eq-rule")?d.add("eq-close"):
(d.remove("eq-close"),a.pendingClose=void 0),g!==k&&(g.style.visibility=""),void 0!==b.x&&void 0!==b.y&&(f.whenVisible={cb:eq.c.Dlg.whenVisible,d:a},h=!1,f.setPos(b.x,b.y))));if(h)eq.Dom.onNextFrame(a,{cb:eq.c.Dlg.makeVisible})}};
eq.c.Dlg.makeVisible=function(a){var b=a.w,c;if(null===b)a.whenReady&&a.callWhenReady();else{if(void 0===(c=b.root))throw Error("Dlg.makeVisible("+a.id+") BUG: Window root undefined");b.makeBaseDialogInline()||(c.style.visibility="");eq.Dom.onNextFrame(b,{cb:eq.c.Dlg.whenVisible,d:a})}};
eq.c.Dlg.whenVisible=function(a,b){b=b.d;var c,d,e,f;b.whenReady&&b.callWhenReady();eq.c.Window.zOrderModified();if((b=a.dlg)&&b===(c=eq.app).currDlg&&null!==(d=c.focus)&&(e=document.getElementById(d))&&e.classList.contains("eq-focused")&&void 0!==(f=b.eds.get(d)))eq.Dom.onNextCycle(eq.c.App.setElementFocus,{d:b,e:e,f:f.focusElement(b,e)})};
eq.c.Dlg.prototype.addControl=function(a,b,c){var d;if(void 0===c&&!(c=a.id))throw Error("addControl: root id not set");for(;;){var e=a.tg;e=document.createElement(void 0!==e?e:"DIV");this.updateControl(c,e,a);void 0===d&&(d=e);void 0!==b&&b.appendChild(e);b=e;if(void 0===a.et)break;a=a.et}a=a.ch;if(void 0!==a){e=0;for(var f=a.length;e<f;e++){var g=a[e],h=g.id;"*"===h&&(g.id=(h=c)+"-"+(e+1));this.addControl(g,b,h||c)}}return d};
eq.c.Dlg.prototype.modifyControl=function(a,b,c){for(;;){var d=c.tg;if(void 0!==d&&d!==b.tagName){d=document.createElement(d);var e=b.classList;e&&e.contains("eq-event")&&d.classList.add("eq-event");b.parentNode.replaceChild(d,b);b=d}this.updateControl(a,b,c);if(void 0===c.et)break;e=b.children;b=void 0;c=c.et;for(var f=0,g=e.length;f<g;f++){var h=e[f];if(!h.classList.contains("eq-rt")){b=h;break}}if(void 0===b)throw Error("modifyControl: id '"+a+"' nested template, no child");}c=c.ch;if(void 0!==
c){e=b.children;f=0;for(g=c.length;f<g;f++)h=c[f],f>=e.length&&(d=h.tg,b.appendChild(document.createElement(void 0!==d?d:"DIV"))),this.modifyControl(a,e[f],h);for(;e.length>g;)b.removeChild(e[g])}};
eq.c.Dlg.prototype.updateControl=function(a,b,c){var d,e,f;for(l in c)switch(l){case "id":var g=b.id,h=c.id;if(g!==h){if(g){if(void 0===e&&void 0===(e=(d=this.eds).get(g)))throw Error("BUG: updateControl id:"+g+" not registered");d.delete(g);d.set(h,e);e.updateId(this,h,g)}b.id=h}break;case "dcn":g=b.id;if(!g)throw Error("BUG: updateControl '"+c.dcn+"' id undefined");if(void 0!==e||void 0!==(e=(d=this.eds).get(g)))throw Error("BUG: updateControl id:"+g+"already registered as '"+e.constructor.name+
"'");void 0===(h=eq.d.get(c.dcn))&&(h=eq.c.DlgElement);d.set(g,new h(this,b));break;case "hc":eq.Dom.setContent(b,c.hc);break;case "hca":if(void 0===f&&void 0===(f=(d||(d=this.eds)).get(a)))throw Error("BUG: updateControl id:"+a+" not registered");g=eq.Dom.setContent(b,c.hca,!0);f.setAccel(this,a,g,eq.KeyMod.alt);break;case "ec":b.value=c.ec;"TEXTAREA"===b.tagName&&(b.textContent=c.ec);break;case "at":for(var k in c.at){var l=c.at[k];null!==l?k in b?b[k]=l:b.setAttribute(k,l):b.removeAttribute(k)}break;
case "clr":var n=c.clr;g=0;for(h=n.length;g<h;g++)b.classList.remove(n[g]);break;case "cla":n=c.cla;g=0;for(h=n.length;g<h;g++)b.classList.add(n[g]);break;case "st":for(var m in c.st)g=c.st[m],b.style.setProperty(m,null!==g?g:"");break;case "ds":for(var p in c.ds)g=c.ds[p],null!==g?b.dataset[p]=g:delete b.dataset[p];break;case "rt":case "rtd":if(void 0===f&&void 0===(f=(d||(d=this.eds)).get(a)))throw Error("BUG: updateControl id:"+a+" not registered");if("rt"===l)f.setAttr(this,a,b,c.rt);else eq.Dom.onNextCycle(eq.c.DlgElement.setAttr,
{t:f,d:this,i:a,e:b,r:c.rtd});break;case "cr":if(void 0===f&&void 0===(f=(d||(d=this.eds)).get(a)))throw Error("BUG: updateControl id:"+a+" not registered");n=c.cr;g=0;for(h=n.length;g<h;g++){var q=n[g];f.setCssRule(a,q.ty,q.rl)}break;case "ev":g=c.ev;if(void 0===f&&void 0===(f=(d||(d=this.eds)).get(a)))throw Error("BUG: updateControl id:"+a+" not registered");void 0!==g.a&&(f.a=null!==g.a?g.a:void 0);void 0!==g.c&&(f.c=null!==g.c?g.c:void 0);void 0!==g.m&&(f.m=null!==g.m?g.m:void 0);void 0!==g.f&&
(f.f=null!==g.f?g.f:void 0);void 0!==f.a||void 0!==f.c?b.classList.add("eq-event"):b.classList.remove("eq-event");break;case "dlg":g=c.dlg;var r;void 0!==g.l&&(this.layout=g.l?g.l:void 0);void 0!==g.t&&(this.title=g.t?g.t:void 0,(r=this.w)&&r.root&&r.setTitle(this.title||eq.c.App.title));void 0!==g.ic&&(this.icon=g.ic?g.ic:void 0,(r=this.w)&&r.root&&r.setIcon(this.icon));void 0!==g.f&&(this.fkey=g.f?g.f:void 0);void 0!==g.tm&&(this.timer=g.tm?g.tm:void 0);void 0!==g.d&&(g.d?this.ddo=g.d:this.ddo&&
(this.ddo=void 0,this.resetCurrDlg()))}};
eq.c.Dlg.prototype.calcGrid=function(a){for(var b=this.constructor,c=this.grid,d=document.body,e,f,g=0;2>g;g++){var h=b.getGridTemplate(),k=h.style,l=h.firstElementChild,n=eq.FontStyle,m;if(m=a.fc)k.fontFamily=m;if(m=a.sz)k.fontSize=m;(m=a.st)&n.bold&&(k.fontWeight="bold");m&n.italic&&(k.fontStyle="italic");0===g?((k=l.style).width="1ch",k.height="1em",d.appendChild(h),k=l.getBoundingClientRect(),c.wr=e=k.width,c.hr=f=k.height):(l.textContent="X",d.appendChild(h),k=l.getBoundingClientRect(),c.wf=
(c.wp=Math.ceil(k.width))/e,c.hf=(c.hp=Math.ceil(k.height))/f);d.removeChild(h)}};eq.c.Dlg.getGridTemplate=function(){var a=this.gridTemplate;void 0===a&&(this.gridTemplate=a=document.createElement("DIV"),a.className="eq-grid",a.style.zIndex=eq.Dom.zIndex(document.body)-1,a.appendChild(document.createElement("P")));return a.cloneNode(!0)};
eq.c.Dlg.prototype.copyFontToElement=function(a){for(var b=eq.Dom,c,d,e,f=this.root.length;0<=--f;)if((d=(c=this.root[f]).classList).contains("eq-dialog")&&d.contains("eq-root-font"))return b.copyFont(a,c),b.adjustElementFontSize(a),!0;return(e=eq.app.fnDefault)&&b.setFont(a,e)?(b.adjustElementFontSize(a),!0):!1};
eq.c.Dlg.prototype.nextTab=function(a,b){var c=this.tabOrder,d;if(null!==c&&(d=c.length)){a=c.indexOf(a);for(var e=-1===a?0:b?a-1:a+1,f;;){b?-1===e&&(e=d-1):e===d&&(e=0);if(e===a)break;-1===a&&(a=0);if((f=document.getElementById(c[e]))&&!f.classList.contains("eq-notab"))return f;b?e--:e++}}return null};
eq.c.Dlg.prototype.isAccel=function(a,b,c){if(null===(a=eq.Dom.decodeAccelKey(a,b,c)))return!1;a=this.accel.get(b?String.fromCharCode(b+48)+a.toUpperCase():a.toUpperCase());if(void 0!==a){b=this.eds.get(a);var d;if(void 0!==b&&(d=document.getElementById(a))&&!d.classList.contains("eq-disabled"))return eq.app.cancelUserAction(),b.onAccel(this,a,d),!0}return!1};eq.c.Dlg.dndType="application/com.eloquence.webdlg2";
eq.c.Dlg.onDragStart=function(a){var b=eq.Dom,c,d,e,f,g;if(!(c=eq.app).idle&&(d=c.currDlg)){c.pendingMouseDown=void 0;c.pendingClick=void 0;c.stopPendingClickTimer();if("Window"===this.constructor.name)(e=document.getElementById(f=this.name))||(f=void 0);else if(e=b.eqControl(this))f=e.id;if(f&&!e.classList.contains("eq-disabled")){if(!(g=d.eds.get(f)))throw Error("Dlg.onDragStart BUG: "+f+" not registered");var h={serial:++c.dndSerial,ch:[]};if(g.onDragStart(d,f,e,this,a,h)){h.drag&&(a.dataTransfer.setData(d.constructor.dndType,
h.serial.toString()),c.dnd=h);return}}}a.dataTransfer.clearData();b.consumeEvent(a)};eq.c.Dlg.onDragOver=function(a){a.preventDefault();var b=eq.app,c,d,e,f,g,h;if((c=b.dnd)&&(d=c.drag))if(b.idle||!(e=b.currDlg)){if(f=d.over)f.classList.remove("eq-dragover"),d.over=null}else(f=eq.Dom.eqControl(a=a.target))&&!f.classList.contains("eq-disabled")&&(h=e.eds.get(g=f.id))&&(a=h.onDragOver(e,g,f,a),(f=d.over)&&f.classList.remove("eq-dragover"),a&&a.classList.add("eq-dragover"),d.over=a)};
eq.c.Dlg.onDrop=function(a){var b=eq.Dom,c=eq.app,d,e,f,g,h,k,l;b.consumeEvent(a);if(!c.idle&&(d=c.currDlg)){if((f=(e=a.dataTransfer).getData(eq.c.Dlg.dndType)).length){if(!(h=c.dnd)||h.serial!==Number(f)){c.dnd=null;return}h.drop=k={}}else if((f=e.getData("text/plain")).length)k={content:f},h={ch:[],drop:k};else if((g=e.files)&&(l=g.length)){f="";for(k=0;k<l;k++)f+=g.item(k).name+"\n";k={content:f};h={ch:[],drop:k}}else{c.dnd=null;return}switch(e.dropEffect){case "move":k.action=1;break;case "copy":k.action=
2;break;case "link":k.action=4}e=0;k=a.target;var n,m;for(a="Window"===this.constructor.name?document.getElementById(m=this.name):k;a=b.eqControl(a);){if(a.classList.contains("eq-disabled")){a=null;break}a.classList.contains("eq-dialog")&&(n=a);if(!(l=d.eds.get(m=a.id)))throw Error("Dlg.onDrop BUG: "+m+" not registered");if((e=l.onDrop(d,m,a,k,h))||n)break;a=a.parentNode}if(a&&e){if(!n){if(!(n=b.eqDialog(a)))throw Error("Dlg.onDrop BUG: "+m+" no Dialog");if(!(l=d.eds.get(n.id)))throw Error("Dlg.onDrop BUG: Dialog "+
n.id+" not registered");l.onDrop(d,n.id,n,n,h)}k=0;for(l=(b=h.ch).length;k<l;k++)c.setChanged(b[k],"dnd");c.onceRule=e;c.onceId=m;c.submit(a,{id:m,type:"dnd"});return}}c.dnd=null};
eq.c.Window.subClass("LoginDialog",function(a,b){var c=this.constructor,d=eq.c.Window,e=eq.strings,f=eq.app,g=eq.Dom,h,k,l,n;if(c.singleton)throw Error("BUG: login dialog singleton exists");c.singleton=this;this.accel=new Map;if(h=document.getElementById("eq-login-dialog"))h=h.cloneNode(!0),h.removeAttribute("id"),h.classList.add("eq-login-dialog"),h.style.display="";else{h=document.createElement("DIV");h.className="eq-login-dialog";var m=document.createElement("DIV");g.setContent(m,e.get("login.prompt"));
h.appendChild(m);m=document.createElement("DIV");m.className="eq-title";h.appendChild(m);var p=document.createElement("LABEL");var q=document.createElement("SPAN");q.className="eq-label";var r=g.setContent(q,e.get("login.label.name"),!0);p.appendChild(q);m=document.createElement("INPUT");m.type="text";m.className="eq-login";p.appendChild(m);h.appendChild(p);null!==r&&this.accel.set(r.toUpperCase(),m);p=document.createElement("LABEL");q=document.createElement("SPAN");q.className="eq-label";r=g.setContent(q,
e.get("login.label.pass"),!0);p.appendChild(q);m=document.createElement("INPUT");m.type="password";m.className="eq-password";p.appendChild(m);h.appendChild(p);null!==r&&this.accel.set(r.toUpperCase(),m);var t=document.createElement("DIV");t.className="eq-button";void 0!==b?(p=document.createElement("LABEL"),p.className="eq-save",m=document.createElement("INPUT"),m.type="checkbox",p.appendChild(m),q=document.createElement("SPAN"),r=g.setContent(q,e.get("login.save"),!0),p.appendChild(q),t.appendChild(p),
null!==r&&this.accel.set(r.toUpperCase(),m)):t.appendChild(document.createElement("DIV"));m=document.createElement("BUTTON");m.type="button";m.className="eq-ok";r=g.setContent(m,e.get("login.ok"),!0);t.appendChild(m);null!==r&&this.accel.set(r.toUpperCase(),m);m=document.createElement("BUTTON");m.type="button";m.className="eq-cancel";r=g.setContent(m,e.get("login.cancel"),!0);t.appendChild(m);null!==r&&this.accel.set(r.toUpperCase(),m);h.appendChild(t)}e=h.getElementsByClassName("eq-title");r=0;for(m=
e.length;r<m;r++)g.setContent(e[r],f.title);e=h.getElementsByClassName("eq-login");if(1!==e.length)throw Error("LoginDialog: "+e.length+" Login fields, expected: 1");(m=this.elLogin=e[0]).oninput=c.onInput;a?m.value=a:m.classList.add("eq-focused");e=h.getElementsByClassName("eq-password");if(1!==e.length)throw Error("LoginDialog: "+e.length+" Password fields, expected: 1");(m=this.elPswd=e[0]).oninput=c.onInput;a&&m.classList.add("eq-focused");e=h.getElementsByClassName("eq-ok");if(1!==e.length)throw Error("LoginDialog: "+
e.length+" OK buttons, expected: 1");(m=this.elOk=e[0]).onclick=c.onOk;m.disabled=!0;a=h.querySelectorAll(".eq-save input");if(a.length){if(1<a.length)throw Error("LoginDialog: "+a.length+" Save buttons, expected: 1");(m=this.elSave=a[0]).checked=!!b}e=h.getElementsByClassName("eq-cancel");if(e.length){if(1<e.length)throw Error("LoginDialog: "+e.length+" Cancel buttons, expected: 1");(m=this.elCancel=e[0]).onclick=c.onCancel}h.onfocus=c.onFocus;d.call(this,d.setupFrame(h));(b=this.root).classList.add("eq-close");
this.notifyOnClose=!0;(k=f.fnDefault)&&g.setFont(b,k)&&g.adjustElementFontSize(b);this.whenVisible={cb:c.setFocus};this.setTitle(f.title);this.setIcon(f.logoIcon);g=0;e=h.getElementsByClassName("eq-label");r=0;for(m=e.length;r<m;r++)(h=Number(window.getComputedStyle(e[r]).width.replace(/px$/,"")))&&h>g&&(g=h);if(g)for(r=0,m=e.length;r<m;r++)e[r].style.width=g+"px";void 0!==(l=f.popupPos)&&l&(n=eq.PopupPos).login?this.setPos(l&n.left?0:-1,l&n.top?0:-1):this.setPos(-1,-1);this.activate();window.addEventListener("keydown",
c.onKey,!0)});delete eq.c.LoginDialog.subClass;eq.c.LoginDialog.singleton=null;eq.c.LoginDialog.prototype.close=function(){var a=this.constructor,b=eq.c.Window;if(this!==a.singleton)throw Error("BUG: unexpected login dialog invocation");window.removeEventListener("keydown",a.onKey,!0);this.accel.clear();this.accel=null;this.notifyOnClose&&eq.app.api.postMessage({o:eq.ApiOp.onLoginEvent});b.prototype.close.call(this);a.singleton=null};eq.c.LoginDialog.close=function(){this.singleton&&this.singleton.close()};
eq.c.LoginDialog.setFocus=function(a){var b=eq.c.LoginDialog;if(b.singleton){if(!b.onFocus(a))eq.Dom.onNextCycle(b.commitFocus);return!0}return!1};eq.c.LoginDialog.commitFocus=function(){var a=eq.c.LoginDialog.singleton,b;a&&(b=a.root.querySelector(".eq-focused"))&&b.focus()};eq.c.LoginDialog.prototype.setFocusElement=function(a){for(var b=this.root.querySelectorAll(".eq-focused"),c=b.length;0<=--c;)b[c].classList.remove("eq-focused");a.classList.add("eq-focused");a.focus()};
eq.c.LoginDialog.prototype.focusable=function(){var a=[this.elLogin,this.elPswd];this.elSave&&a.push(this.elSave);a.push(this.elOk);this.elCancel&&a.push(this.elCancel);return a};eq.c.LoginDialog.onFocus=function(a){var b=eq.c.LoginDialog.singleton;if(a&&a.target)for(var c=b.focusable(),d,e=c.length;0<=--e;)if((d=c[e])===a.target)return d.classList.contains("eq-focused")||b.setFocusElement(d),!0;return!1};
eq.c.LoginDialog.onOk=function(a){a=eq.c.LoginDialog.singleton;var b=a.elLogin.value,c=a.elPswd.value;b&&c&&(eq.app.api.postMessage({o:eq.ApiOp.onLoginEvent,l:b,p:c,s:a.elSave?a.elSave.checked:!0}),a.notifyOnClose=!1,a.close())};eq.c.LoginDialog.onCancel=function(a){eq.c.LoginDialog.singleton.close()};
eq.c.LoginDialog.onKey=function(a){var b=eq.c.LoginDialog.singleton,c=a.key,d=eq.Dom,e,f;if(1===c.length&&a.altKey&&null!==(f=d.decodeAccelKey(c,eq.KeyMod.alt,a))&&(e=b.accel.get(f.toUpperCase())))"INPUT"!==e.tagName||"text"!==e.type&&"password"!==e.type?d.fireClick(e):e.focus(),d.consumeEvent(a);else{f=b.focusable();var g;for(e=document.activeElement;e&&e!==document&&e!==b.root&&-1===(g=f.indexOf(e));)e=e.parentNode;if(-1!==g)switch(c){case "Escape":case "Esc":b.close();d.consumeEvent(a);break;case " ":case "Spacebar":switch(e){case b.elOk:case b.elCancel:case b.elSave:d.fireClick(e),
d.consumeEvent(a)}break;case "Enter":switch(e){case b.elOk:case b.elCancel:case b.elSave:d.fireClick(e);d.consumeEvent(a);return;case b.elPswd:if(c=b.elLogin.value,e=b.elPswd.value,c&&e){eq.app.api.postMessage({o:eq.ApiOp.onLoginEvent,l:c,p:e,s:b.elSave?b.elSave.checked:!0});b.notifyOnClose=!1;b.close();d.consumeEvent(a);return}}case "Tab":do a.shiftKey?0>--g&&(g=f.length-1):++g==f.length&&(g=0);while((e=f[g]).disabled);b.setFocusElement(e);d.consumeEvent(a)}}};
eq.c.LoginDialog.onInput=function(a){a=eq.c.LoginDialog.singleton;var b=a.elPswd.value;a.elOk.disabled=!(a.elLogin.value&&b)};
eq.c.Window.subClass("MessageDialog",function(a,b,c){var d=this.constructor,e=eq.c.Window,f=eq.app,g=eq.Dom,h,k,l,n;d.singleton&&d.singleton.close();d.singleton=this;this.accel=new Map;var m=document.createElement("DIV");m.className="eq-message-dialog";var p=document.createElement("SPAN");g.setContent(p,a);m.appendChild(p);a=document.createElement("DIV");p=document.createElement("BUTTON");p.className="eq-focused";p.type="button";c?(this.onCancel=c,c=g.setContent(p,eq.strings.get("message.cancel"),
!0)):c=g.setContent(p,eq.strings.get("message.ok"),!0);null!==c&&this.accel.set(c.toUpperCase(),p);p.onclick=d.close;a.appendChild(p);m.appendChild(a);e.call(this,e.setupFrame(m));(e=this.root).classList.add("eq-close");(h=f.topDialog())&&h.copyFontToElement(e)||(k=f.fnDefault)&&g.setFont(e,k)&&g.adjustElementFontSize(e);this.whenVisible={cb:d.setFocus};this.setTitle(f.title);this.setIcon(f.logoIcon);void 0!==(l=f.popupPos)&&l&(n=eq.PopupPos).message?this.setPos(l&n.left?0:-1,l&n.top?0:-1):this.setPos(-1,
-1);this.activate();window.addEventListener("keydown",d.onKey,!0);b&&(this.closeTimeout=window.setTimeout(d.close,b))});delete eq.c.MessageDialog.subClass;eq.c.MessageDialog.setFocus=function(){var a=eq.c.MessageDialog.singleton,b;return a&&(b=a.root.querySelector(".eq-focused"))?(b.focus(),!0):!1};eq.c.MessageDialog.singleton=null;
eq.c.MessageDialog.prototype.close=function(){var a=this.constructor,b=eq.c.Window;if(this!==a.singleton)throw Error("BUG: unexpected message dialog invocation");void 0!==this.closeTimeout&&(window.clearTimeout(this.closeTimeout),this.closeTimeout=void 0);window.removeEventListener("keydown",a.onKey,!0);this.accel.clear();this.accel=null;b.prototype.close.call(this);if(this.onCancel)this.onCancel();a.singleton=null};eq.c.MessageDialog.close=function(){var a=eq.c.MessageDialog;a.singleton&&a.singleton.close()};
eq.c.MessageDialog.onKey=function(a){var b=eq.c.MessageDialog.singleton,c=a.key,d=eq.Dom,e,f;if(1===c.length&&a.altKey&&null!==(f=d.decodeAccelKey(c,eq.KeyMod.alt,a))&&(e=b.accel.get(f.toUpperCase())))d.fireClick(e),d.consumeEvent(a);else switch(c){case "Escape":case "Esc":case " ":case "Spacebar":case "Enter":eq.c.MessageDialog.singleton.close(),d.consumeEvent(a)}};
eq.c.Window.subClass("PopupBox",function(a){var b=this.constructor,c=eq.c.Window,d=eq.Dom,e=eq.app,f,g,h,k,l,n;if(b.singleton)throw Error("BUG: POPUP BOX singleton exists");b.singleton=this;this.accel=new Map;var m=document.createElement("DIV");m.className="eq-popup-box";var p=a.msg.split("\n");for(var q=0,r=p.length;q<r;q++){var t=document.createElement("P");d.setContent(t,p[q]);m.appendChild(t)}p=document.createElement("DIV");p.className="eq-pushbutton";var u=0<(u=a.btnDefault)?u-1:0;q=0;for(r=
a.btn.length;q<r;q++){t=document.createElement("BUTTON");t.type="button";if(d.isHtmlContent(f=a.btn[q])||-1!==f.indexOf("&"))null===(g=d.setContent(t,f,!0))||this.accel.has(g=g.toUpperCase())||this.accel.set(g,t);else{for(var v=0,y=f.length;v<y;v++){var w=v?f.substring(0,v)+"&"+f.substring(v):"&"+f.substring(v);if(null===(g=d.setContent(t,w,!0)))break;if(!this.accel.has(g=g.toUpperCase())){this.accel.set(g,t);break}}w="&"+w}q===u&&t.classList.add("eq-focused");p.appendChild(t)}m.appendChild(p);c.call(this,
c.setupFrame(m));c=this.root;(h=e.topDialog())&&h.copyFontToElement(c)||(k=e.fnDefault)&&d.setFont(c,k)&&d.adjustElementFontSize(c);this.whenVisible={cb:b.setFocus};this.setTitle(a.title||e.title);this.setIcon(e.logoIcon);void 0!==(l=e.popupPos)&&l&(n=eq.PopupPos).box?this.setPos(l&n.left?0:-1,l&n.top?0:-1):this.setPos(-1,-1);this.activate()});delete eq.c.PopupBox.subClass;
eq.c.PopupBox.setFocus=function(){var a=eq.c.PopupBox.singleton,b;return a&&(b=a.root.querySelector(".eq-focused"))?(b.focus(),!0):!1};eq.c.PopupBox.singleton=null;
eq.c.PopupBox.prototype.close=function(a){var b=this.constructor,c=eq.c.Window;if(this!==b.singleton)throw Error("BUG: unexpected POPUP BOX invocation");if(void 0!==a){var d=a.target;if(c.fromTarget(d)===this&&this.onMouseDownOrClick(a))return a.stopPropagation(),!1;if("click"!==a.type)return!1;d=this.buttonIndex(d);if(-1===d)return!1;eq.app.api.postMessage({o:eq.ApiOp.onPopupEvent,d:d+1});a.stopPropagation()}this.accel.clear();this.accel=null;c.prototype.close.call(this);b.singleton=null;return!0};
eq.c.PopupBox.prototype.onKey=function(a){var b=a.key,c=eq.Dom,d;if(this!==this.constructor.singleton)throw Error("BUG: unexpected POPUP BOX invocation");if(1===b.length&&null!==c.decodeAccelKey(b,a.ctrlKey||a.altKey||a.metaKey?eq.KeyMod.alt:0,a)&&(d=this.accel.get(b.toUpperCase())))return c.fireClick(d),!0;if(-1!==(d=this.buttonIndex(document.activeElement))){var e=this.root.querySelector(".eq-popup-box>.eq-pushbutton").children;switch(b){case "Enter":case " ":case "Spacebar":return c.fireClick(e[d]),
!0;case "Tab":var f=a.shiftKey?-1:1;break;case "Home":d=f=0;break;case "End":d=0;f=-1;break;case "PageUp":case "ArrowUp":case "Up":case "ArrowLeft":case "Left":f=-1;break;case "PageDown":case "ArrowDown":case "Down":case "ArrowRight":case "Right":f=1}if(void 0!==f){a=e.length;0>(d+=f)?d=a-1:d>=a&&(d=0);for(f=0;f<a;f++)e[f].classList.remove("eq-focused");(d=e[d]).classList.add("eq-focused");d.focus();return!0}}return!1};
eq.c.PopupBox.prototype.isEvent=function(a){a=a.target;for(var b=this.root;a&&a!==document&&a!==b;)a=a.parentNode;return a===b};eq.c.PopupBox.prototype.buttonIndex=function(a){if(a)for(var b;(b=a.parentNode)&&b!==document&&b!==this.root;){var c=b.classList;if(c&&c.contains("eq-pushbutton")){b=this.root.querySelector(".eq-popup-box>.eq-pushbutton").children;c=0;for(var d=b.length;c<d;c++)if(a===b[c])return c;break}a=b}return-1};
eq.strings.get=function(a){a=a.split(".");var b=this.m,c,d,e;if(void 0!==b){if((c=eq.app.locale.tag)&&(d=b.get(c))&&(e=this.fromPath(d,a)))return e;if(d=b.get("default"))if(e=this.fromPath(d,a))return e}return this.fromPath(this.default,a)};eq.strings.fromPath=function(a,b){for(var c=0,d=b.length;c<d&&(a=a[b[c]]);c++);return a};
eq.strings.default={login:{prompt:"Please enter your login and password to start:",label:{name:"&Login:",pass:"&Password:"},ok:"L&ogin",cancel:"&Cancel",save:"&Save login"},message:{ok:"&Dismiss",cancel:"&Cancel",dlgListen:"<html>Waiting for DLG connection on port"}};eq.c.DlgElement.addClass("CheckBox",function(a,b){eq.c.DlgElement.call(this,a,b)});delete eq.c.CheckBox.subClass;
eq.c.CheckBox.prototype.setSensitive=function(a,b,c,d){eq.Dom.inputElement(c).disabled=!d;eq.c.DlgElement.prototype.setSensitive.call(this,a,b,c,d)};eq.c.CheckBox.prototype.onKey=function(a,b,c,d,e,f){if(e)return!1;a=eq.Dom;return(d=a.isEnterOrSpace(d))&&(10!==d||c.classList.contains("eq-noenter"))?(a.fireClick(a.inputElement(c),{key:d}),a.consumeEvent(f),!0):!1};
eq.c.CheckBox.prototype.onTypeAhead=function(a,b,c,d){var e;switch(d){case "Enter":case "ShiftEnter":c.classList.contains("eq-noenter")&&(e=10);break;case " ":e=32}return void 0!==e?(a=eq.Dom,a.fireClick(a.inputElement(c),{key:e}),!0):eq.c.DlgElement.prototype.onTypeAhead.call(this,a,b,c,d)};eq.c.CheckBox.prototype.onSubmit=function(a,b,c,d){a=eq.app;a.changed.has(b)||a.changed.set(b,"input")};eq.c.CheckBox.prototype.focusElement=function(a,b){return eq.Dom.inputElement(b)};
eq.c.CheckBox.prototype.changed=function(a,b,c,d){return{id:b,ty:eq.RsValType.buttonChecked,iv:c.checked?1:0}};eq.c.DlgElement.addClass("ComboBox",function(a,b){eq.c.DlgElement.call(this,a,b);this.dnd=this.tc=null;this.globalDropRule=this.dropRule=this.dndMode=0});delete eq.c.ComboBox.subClass;eq.c.ComboBox.prototype.dispose=function(a,b){this.dnd=this.tc=null;eq.c.DlgElement.prototype.dispose.call(this,a,b)};
eq.c.ComboBox.line=function(a,b){for(var c,d;a&&(c=a.parentNode);){if(d=c.classList){if(d.contains("eq-column"))return void 0!==b&&(b.c=c),a;if(d.contains("eq-combobox")){void 0!==b&&(b.ct=c);break}}a=a.parentNode}};
eq.c.ComboBox.select=function(a,b,c){void 0===b&&((b=a.querySelector(".eq-combobox>.eq-column"))||(b=document.body.querySelector("body>.eq-combobox.eq-column")));a=b.querySelectorAll(".eq-column>.eq-selected");for(var d=0,e=a.length;d<e;d++)a[d].classList.remove("eq-selected");c&&b===c.parentNode&&(c.classList.add("eq-selected"),1<b.children.length&&this.scrollIntoView(c,{cb:this.scrollIntoView}))};
eq.c.ComboBox.scrollIntoView=function(a,b){var c=a.parentNode,d=c.children,e,f;if(1<d.length)if(eq.app.idle||0>=(e=c.getBoundingClientRect().height)||0>=(f=d[0].getBoundingClientRect().height))eq.Dom.onNextFrame(a,b);else b=c.scrollTop,a=a.offsetTop,a<b?c.scrollTop=a:a+f>b+e&&(c.scrollTop=Math.ceil(a+f-e+2))};
eq.c.ComboBox.open=function(a,b){var c=eq.c.ComboBox,d=a.classList;c.open.ctx=null;if(!d.contains("eq-open")){void 0===b&&(b=a.querySelector(".eq-combobox>.eq-column"));var e=a.firstElementChild,f=e.value,g=f.length,h=a.getBoundingClientRect(),k=b.style,l=b.classList,n;if(g)for(var m=b.children,p,q,r=0,t=m.length;r<t;r++){q=(p=m[r]).textContent;if(g<q.length){if(f!==q.substring(0,g))continue}else if(f!==q)continue;var u=p;break}k.left=h.left+window.pageXOffset+"px";k.top=h.bottom+window.pageYOffset+
"px";(n=k.maxWidth)?k.width=n:k.width=h.width+"px";eq.Dom.copyFont(b,e);eq.Dom.copyColors(b,a);l.add("eq-combobox");d.contains("eq-border")?l.add("eq-border"):l.remove("eq-border");eq.app.makeOverlay(a,b,c.close);d.add("eq-open");d.add("eq-enter");(e=b.getBoundingClientRect()).bottom>window.pageYOffset+document.documentElement.clientHeight?(k.top=h.top+window.pageYOffset-e.height+"px",d.remove("eq-dn"),l.remove("eq-dn"),d.add("eq-up"),l.add("eq-up")):(d.remove("eq-up"),l.remove("eq-up"),d.add("eq-dn"),
l.add("eq-dn"));c.select(a,b,u)}};eq.c.ComboBox.open.ctx=null;eq.c.ComboBox.autoOpen=function(a){eq.c.ComboBox.open(a)};eq.c.ComboBox.onFocus=function(){var a=this.parentNode,b;if(a&&(b=a.classList)&&b.contains("eq-auto")&&!b.contains("eq-disabled")&&!b.contains("eq-open"))eq.Dom.onNextCycle(eq.c.ComboBox.autoOpen,a)};
eq.c.ComboBox.preSelectIfOpen=function(a){var b,c,d,e,f;if(a.classList.contains("eq-open")&&(b=a.firstElementChild)&&(d=(c=b.value).length)){b=document.body.querySelector("body>.eq-combobox.eq-column");for(var g=0,h=(e=b.children).length;g<h;g++){var k=(f=e[g]).textContent;if(d<k.length){if(c!==k.substring(0,d))continue}else if(c!==k)continue;eq.c.ComboBox.select(a,b,f);break}}};
eq.c.ComboBox.close=function(a,b,c){var d=a.classList,e=b.classList,f;if(!d.contains("eq-open"))throw Error("ComboBox.close BUG: not open, id:"+a.id);a.appendChild(b);e.remove("eq-combobox");e.remove("eq-border");d.remove("eq-open");d.remove("eq-enter");e=(d=eq.c.ComboBox.open).ctx;c&&(f=b.querySelector(".eq-column>.eq-selected"))&&(b=a.firstElementChild,c=b.maxLength,b.value=c&&0<c?f.textContent.substring(0,c):f.textContent,b.select(),eq.Dom.fireEvent(a,"input"),e&&e.el===a&&1<e.cnt&&eq.app.submit(a,
{id:a.id,type:"input"}));e&&(window.clearTimeout(e.t),d.ctx=null)};eq.c.ComboBox.close.ctx=function(){var a=eq.c.ComboBox.open.ctx,b,c;a&&(c=(b=a.el).classList)&&c.contains("eq-open")&&eq.app.closeOverlay(b,!0)};eq.c.ComboBox.move=function(a,b){var c=b.c;if(c){var d=eq.c.ComboBox,e=b.el,f={};a=d.line(a.target,f);e!==f.ct&&(d.select(e,c,a),a&&(b.close=!0))}};
eq.c.ComboBox.move.done=function(a){var b=a.el,c=a.a,d;if(a.close)if(b.classList.contains("eq-auto")&&(d=document.body.querySelector("body>.eq-combobox.eq-column>.eq-selected"))){a=b.firstElementChild;var e=a.maxLength;a.value=e&&0<e?d.textContent.substring(0,e):d.textContent;a.select();eq.Dom.fireEvent(b,"input")}else eq.app.closeOverlay(b,!0);void 0!==c&&c.classList.remove("eq-click");return!0};
eq.c.ComboBox.onInput=function(a){var b,c,d,e;"INPUT"===(a=a.target).tagName&&(b=eq.app.currDlg)&&(c=b.eds.get(this.id))&&(d=c.tc)&&((e=a.parentNode).classList.contains("eq-open")&&eq.c.ComboBox.select(e,document.body.querySelector("body>.eq-combobox.eq-column")),c.textChanged(this,a,d))};
eq.c.ComboBox.prototype.textChanged=function(a,b,c){b=b.value.length;var d=c.llast;if(b<d||b>d&&b>=c.lmin)d=eq.app,c.tid&&d.dialogTimers.cancel(c.tid),c.tid=d.dialogTimers.add(c.delay,this.constructor.onAutoComplete,null,{self:this,el:a});c.llast=b};eq.c.ComboBox.onAutoComplete=function(a){var b=a.el.id,c=eq.app;c.onceRule=a.self.tc.rule;c.onceId=b;c.submit(a.el,{id:b,type:"timer"})};
eq.c.ComboBox.prototype.setAttr=function(a,b,c,d){for(var e=eq.RqTag,f,g=0,h=d.length;g<h;g++){var k=d[g];switch(k.t){case e.content:var l=this.tc;if(l&&(l.llast=k.l))eq.Dom.onNextCycle(this.constructor.preSelectIfOpen,c);break;case e.items:var n=eq.Dom;k=k.v;var m=k.length;l=c.classList;var p;m?l.remove("eq-empty"):l.add("eq-empty");if(l.contains("eq-open")){l=document.body.querySelector("body>.eq-combobox.eq-column");if(!l)throw Error("ComboBox.setAttr BUG: open, no column");if(m&&this.tc)n.onNextCycle(this.constructor.preSelectIfOpen,
c)}else c.querySelector(".eq-combobox>.eq-button")||(l=document.createElement("DIV"),l.className="eq-rt eq-button",c.appendChild(l)),(l=c.querySelector(".eq-combobox>.eq-column"))||(l=document.createElement("DIV"),l.className="eq-rt eq-column",c.appendChild(l));if(m)var q=(p=l.children).length;else l.textContent="",p=l.children,q=0;for(var r=0;r<m;r++){if(r<q)var t=p[r];else t=document.createElement("DIV"),l.appendChild(t);n.setContent(t,k[r])}for(;p.length>m;)l.removeChild(l.lastElementChild);break;
case e.boxSize:n=k.w;k=k.h;l=c.classList.contains("eq-open")?document.body.querySelector("body>.eq-combobox.eq-column"):c.querySelector(".eq-combobox>.eq-column");if(!l)throw Error("ComboBox.setAttr BUG: boxSize, no column");(l=l.style).maxWidth=n?n:"";l.maxHeight=k?k:"";break;case e.autocomplete:(k=k.v)?(this.tc={rule:k.r,delay:k.d,lmin:k.m,llast:eq.Dom.inputElement(c).value.length,tid:0},c.oninput=this.constructor.onInput):(this.tc=null,c.oninput=null);break;case e.dndMode:l=eq.Dom.inputElement(c);
(this.dndMode=k.i)?l.ondragstart=a.constructor.onDragStart:l.ondragstart=null;break;case e.dropRule:l=eq.Dom.inputElement(c);n=this.constructor;(this.dropRule=k.i)||this.globalDropRule?(k=a.constructor,l.ondragover=n.onDragOver,l.ondrop=k.onDrop):(l.ondragover=null,l.ondrop=null);break;case e.globalDropRule:l=eq.Dom.inputElement(c);n=this.constructor;(this.globalDropRule=k.i)||this.dropRule?(k=a.constructor,l.ondragover=n.onDragOver,l.ondrop=k.onDrop):(l.ondragover=null,l.ondrop=null);break;default:f?
f.push(k):f=[k]}}f&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,f)};eq.c.ComboBox.prototype.setSensitive=function(a,b,c,d){eq.Dom.inputElement(c).disabled=!d;eq.c.DlgElement.prototype.setSensitive.call(this,a,b,c,d)};
eq.c.ComboBox.prototype.onKey=function(a,b,c,d,e,f){if(e)return!1;a=this.constructor;b=eq.Dom;var g=c.querySelector(".eq-combobox>.eq-column");switch(d){case "Enter":return!g&&(eq.app.closeOverlay(c,!0),c.classList.contains("eq-noenter"))?(b.consumeEvent(f),!0):!1;case "Escape":case "Esc":return g||eq.app.closeOverlay(c,!1),b.consumeEvent(f),!0;case "PageUp":case "PageDown":case "ArrowUp":case "Up":case "ArrowDown":case "Down":if(g){a.open(c,g);var h=0}break;case "ArrowLeft":case "Left":case "ArrowRight":case "Right":return!0;
default:return!e&&1===d.length}var k;if((g=document.body.querySelector("body>.eq-combobox.eq-column"))&&(k=g.children).length){if(void 0===h)switch(d){case "PageUp":var l=k[0];break;case "PageDown":l=k[k.length-1];break;case "ArrowUp":case "Up":h=-1;break;case "ArrowDown":case "Down":h=1}void 0!==h&&((l=g.querySelector(".eq-column>.eq-selected"))?(d=b.parentIndex(l),e=k.length,-1===(d+=h)?d=0:d>=e&&(d=e-1),l=k[d]):l=k[0]);void 0!==l&&a.select(c,g,l)}b.consumeEvent(f);return!0};
eq.c.ComboBox.prototype.onTypeAhead=function(a,b,c,d){if(1===d.length){a=eq.Dom.inputElement(c);var e=a.maxLength,f=a.value,g=f.length,h;if(e&&0<e&&g>=e)return!0;e=a.selectionStart;var k=a.selectionEnd;f=0<e?k<g?f.substring(0,e)+d+f.substring(k):f.substring(0,e)+d:k<g?d+f.substring(k):d;a.value=f;(h=this.tc)&&this.textChanged(c,a,h);eq.app.setChanged(b,"input");return!0}return eq.c.DlgElement.prototype.onTypeAhead.call(this,a,b,c,d)};
eq.c.ComboBox.prototype.onChange=function(a,b,c,d){if("mousedown"===d.type){a=this.constructor;var e=eq.app,f=d.target,g;if(f&&f.classList.contains("eq-button")){if((g=c.classList).contains("eq-disabled"))return!1;if(g.contains("eq-focus")&&e.setFocus(b,c))return e.pendingFocus={id:b,act:a.open},!1;if(g.contains("eq-empty"))return!1;g=c.querySelector(".eq-combobox>.eq-column");b={el:c,a:f};f.classList.add("eq-click");g?a.open(c,b.c=g):b.close=!0;e.moveCapture(b,a.move,a.move.done);eq.Dom.consumeEvent(d);
return!1}if((g=c.classList).contains("eq-open")){b={el:c};var h={};f=a.line(f,h);if(h.c){a.select(c,b.c=h.c,f);if(g.contains("eq-rule"))return(f=(d=a.open).ctx)?(f.cnt++,e.closeOverlay(c,!0)):d.ctx={el:c,cnt:1,t:window.setTimeout(a.close.ctx,eq.c.App.doubleClick.tv)},!0;b.close=!0}e.moveCapture(b,a.move,a.move.done);if(c!==h.ct)return eq.Dom.consumeEvent(d),!1}}return!0};
eq.c.ComboBox.prototype.onDragStart=function(a,b,c,d,e,f){a=this.dndMode;c=eq.Dnd;var g;if(a&c.local){if((g=d.selectionEnd)<=(c=d.selectionStart))return!1;f.drag={id:b,content:d.value.substring(c,g)};(this.dnd=f).ch.push(b);eq.c.DlgElement.setDropModes(e,a);return!0}return a&c.global?(eq.c.DlgElement.setDropModes(e,c.all),!0):!1};eq.c.ComboBox.onDragOver=function(a){a.preventDefault();var b,c,d;(b=eq.app.dnd)&&(c=b.drag)&&(d=c.over)&&(c.over=null,d.classList.remove("eq-dragover"))};
eq.c.ComboBox.prototype.onDrop=function(a,b,c,d,e){e.drop.pos=eq.Dom.inputElement(c).selectionStart;(this.dnd=e).ch.push(e.drop.id=b);return e.drag?this.dropRule:this.globalDropRule};eq.c.ComboBox.prototype.focusElement=function(a,b){a=eq.Dom.inputElement(b);a.onfocus=b.classList.contains("eq-auto")?this.constructor.onFocus:null;return a};eq.c.ComboBox.prototype.focusGained=function(a,b){void 0===eq.app.pendingMouseDown&&b!==document.activeElement&&(b.select(),b.scrollLeft=b.scrollWidth)};
eq.c.ComboBox.prototype.focusLost=function(a,b){b.classList.contains("eq-open")&&eq.app.closeOverlay(b);a=eq.Dom.inputElement(b);a.selectionStart=a.selectionEnd=0;a.blur()};
eq.c.ComboBox.prototype.changed=function(a,b,c,d){a=[];for(var e=0,f=d.length;e<f;e++)switch(d[e]){case "input":a.push({ty:eq.RsValType.textValue,sv:c.value});break;case "dnd":var g=this.dnd,h,k,l,n;g&&((h=g.drag)&&h.id===b&&void 0!==(l=h.content)&&(h.content=null,a.push({ty:eq.RsValType.dragContent,sv:l})),(k=g.drop)&&k.id===b&&void 0!==(n=k.pos)&&a.push({ty:eq.RsValType.dropPos,iv:n}))}this.dnd=null;switch(a.length){case 0:return null;case 1:return a[0].id=b,a[0];default:return{id:b,v:a}}};
eq.c.DlgElement.addClass("Dialog",function(a,b){eq.c.DlgElement.call(this,a,b);this.dnd=null;this.globalDropRule=this.dropRule=0});delete eq.c.Dialog.subClass;eq.c.Dialog.prototype.dispose=function(a,b){this.dnd=null;eq.c.DlgElement.prototype.dispose.call(this,a,b)};
eq.c.Dialog.prototype.setAttr=function(a,b,c,d){for(var e=eq.RqTag,f,g=a.constructor,h=0,k=d.length;h<k;h++){var l=d[h];switch(l.t){case e.dropRule:(this.dropRule=l.i)||this.globalDropRule?(c.ondragover=g.onDragOver,c.ondrop=g.onDrop):(c.ondragover=null,c.ondrop=null);break;case e.globalDropRule:(this.globalDropRule=l.i)||this.dropRule?(c.ondragover=g.onDragOver,c.ondrop=g.onDrop):(c.ondragover=null,c.ondrop=null);break;default:f?f.push(l):f=[l]}}f&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,
c,f)};eq.c.Dialog.prototype.onDrop=function(a,b,c,d,e){(this.dnd=e).ch.push(b);return e.drag?this.dropRule:this.globalDropRule};
eq.c.Dialog.prototype.changed=function(a,b,c,d){a=[];c=0;for(var e=d.length;c<e;c++)switch(d[c]){case "dnd":var f=this.dnd,g,h,k;f&&((g=f.drag)&&void 0!==(h=g.id)&&(g.id=null,a.push({ty:eq.RsValType.dragFrom,sv:h})),f=f.drop)&&(void 0!==(h=f.content)&&(f.content=null,a.push({ty:eq.RsValType.dropContent,sv:h})),void 0!==(k=f.action)&&a.push({ty:eq.RsValType.dropAction,iv:k}))}this.dnd=null;switch(a.length){case 0:return null;case 1:return a[0].id=b,a[0];default:return{id:b,v:a}}};
eq.c.DlgElement.addClass("EditText",function(a,b){eq.c.DlgElement.call(this,a,b);this.hardWrap=!1;this.autoTab=0;this.dnd=this.tc=this.ff=null;this.globalDropRule=this.dropRule=this.dndMode=0;this.ignoreNextBlur=!1});delete eq.c.EditText.subClass;eq.c.EditText.prototype.dispose=function(a,b){this.dnd=this.tc=this.ff=null;eq.c.DlgElement.prototype.dispose.call(this,a,b)};
eq.c.EditText.onInput=function(a){var b,c,d,e,f,g,h;"INPUT"===(a=a.target).tagName&&(c=(b=eq.app).currDlg)&&(e=c.eds.get(d=this.id))&&((f=e.tc)&&e.textChanged(this,a,f),(f=e.autoTab)&1&&0<(g=a.maxLength)&&a.value.length>=g&&(h=c.nextTab(d,!1))&&(f&4&&(e.ignoreNextBlur=!0,eq.Dom.onNextCycle(e.constructor.nextEventCycle,this)),b.setFocus(h.id,h)))};
eq.c.EditText.prototype.textChanged=function(a,b,c){b=b.value.length;var d=c.llast;if(b<d||b>d&&b>=c.lmin)d=eq.app,c.tid&&d.dialogTimers.cancel(c.tid),c.tid=d.dialogTimers.add(c.delay,this.constructor.onAutoComplete,null,{self:this,el:a});c.llast=b};eq.c.EditText.onAutoComplete=function(a){var b=a.el.id,c=eq.app;c.onceRule=a.self.tc.rule;c.onceId=b;c.submit(a.el,{id:b,type:"timer"})};
eq.c.EditText.prototype.wrapCols=function(a,b,c){if(this.hardWrap){a=c.firstElementChild;var d;if(b=a.getBoundingClientRect().width){c=this.constructor.getFontSizeTemplate();eq.Dom.copyFont(c,a);(d=document.body).appendChild(c);var e=c.getBoundingClientRect();if(e=e.width)a.cols=Math.floor(b/e);d.removeChild(c)}}};
eq.c.EditText.prototype.fitFont=function(a,b,c){if(a=this.ff){b=document.body;var d=this.constructor.getFontSizeTemplate(),e=c.firstElementChild,f=e.style;c=c.style;var g,h;eq.Dom.copyFont(d,e);b.appendChild(d);e=d.getBoundingClientRect();(g=e.width)&&(h=a.w)&&(f.width=h*g+"px",c.width="");(g=e.height)&&(h=a.h)&&(f.height=h*g+"px",c.height="");b.removeChild(d)}};
eq.c.EditText.getFontSizeTemplate=function(){var a=this.fontSizeTemplate;void 0===a&&(this.fontSizeTemplate=a=document.createElement("DIV"),a.className="eq-grid",a.textContent="X",a.style.zIndex=eq.Dom.zIndex(document.body)-1);return a.cloneNode(!0)};
eq.c.EditText.prototype.setAttr=function(a,b,c,d){for(var e=eq.RqTag,f,g=0,h=d.length;g<h;g++){var k=d[g];switch(k.t){case e.multiline:this.hardWrap=!1;this.autoTab=0;this.tc=this.ff=null;break;case e.content:var l=this.tc;l&&(l.llast=k.l);break;case e.wrapmode:(this.hardWrap=!!k.b)?this.whenVisible(a,b,c,this.wrapCols):c.firstElementChild.removeAttribute("cols");break;case e.fitfont:(k=k.ff)?(this.ff=k,this.whenVisible(a,b,c,this.fitFont)):(k=c.firstElementChild.style,k.width=k.height="",this.ff=
null);break;case e.autocomplete:k=k.v;var n;k&&"INPUT"===(n=c.firstElementChild).tagName?(this.tc={rule:k.r,delay:k.d,lmin:k.m,llast:n.value.length,tid:0},c.oninput=this.constructor.onInput):(this.tc=null,c.oninput=null);break;case e.autotab:(this.autoTab=k.i)?c.oninput=this.constructor.onInput:c.oninput=null;break;case e.dndMode:n=c.firstElementChild;(this.dndMode=k.i)?n.ondragstart=a.constructor.onDragStart:n.ondragstart=null;break;case e.dropRule:n=c.firstElementChild;l=this.constructor;(this.dropRule=
k.i)||this.globalDropRule?(k=a.constructor,n.ondragover=l.onDragOver,n.ondrop=k.onDrop):(n.ondragover=null,n.ondrop=null);break;case e.globalDropRule:n=c.firstElementChild;l=this.constructor;(this.globalDropRule=k.i)||this.dropRule?(k=a.constructor,n.ondragover=l.onDragOver,n.ondrop=k.onDrop):(n.ondragover=null,n.ondrop=null);break;default:f?f.push(k):f=[k]}}f&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,f)};
eq.c.EditText.prototype.setSensitive=function(a,b,c,d){var e=c.getElementsByTagName("INPUT");0===e.length&&(e=c.getElementsByTagName("TEXTAREA"));if(1!==e.length)throw Error("BUG: EditText.setSensitive id:"+c.id+" elements:"+e.length+", expected: 1");e[0].disabled=!d;eq.c.DlgElement.prototype.setSensitive.call(this,a,b,c,d)};eq.c.EditText.prototype.onEvent=function(a,b,c,d){return"blur"!==d.type||!this.ignoreNextBlur};eq.c.EditText.nextEventCycle=function(a){a.ignoreNextBlur=!1};
eq.c.EditText.prototype.onKey=function(a,b,c,d,e,f){if(e)return!1;switch(d){case "ArrowUp":case "Up":case "ArrowDown":case "Down":return 0!=c.getElementsByTagName("TEXTAREA").length;case "Backspace":case "ArrowLeft":case "Left":d=this.autoTab;var g,h;d&2&&(g=c.firstElementChild)&&0===g.selectionStart&&(h=a.nextTab(b,!0))&&(a=eq.Dom,d&4&&(this.ignoreNextBlur=!0,a.onNextCycle(this.constructor.nextEventCycle,this)),eq.app.setFocus(h.id,h),a.consumeEvent(f));return!0;case "ArrowRight":case "Right":return d=
this.autoTab,d&1&&(g=c.firstElementChild)&&g.selectionStart>=g.maxLength&&g.value.length&&(h=a.nextTab(b,!1))&&(a=eq.Dom,d&4&&(this.ignoreNextBlur=!0,a.onNextCycle(this.constructor.nextEventCycle,this)),eq.app.setFocus(h.id,h),a.consumeEvent(f)),!0}return!e&&1===d.length};
eq.c.EditText.prototype.onTypeAhead=function(a,b,c,d){var e=c.firstElementChild,f;switch(d){case "Enter":"TEXTAREA"===e.tagName&&(f="\n");break;default:1===d.length&&(f=d)}if(void 0!==f){var g=e.maxLength;a=e.value;d=a.length;var h;if(g&&0<g&&d>=g)return!0;g=e.selectionStart;var k=e.selectionEnd;a=0<g?k<d?a.substring(0,g)+f+a.substring(k):a.substring(0,g)+f:k<d?f+a.substring(k):f;e.value=a;"TEXTAREA"===e.tagName?e.textContent=a:(h=this.tc)&&this.textChanged(c,e,h);eq.app.setChanged(b,"input");return!0}return eq.c.DlgElement.prototype.onTypeAhead.call(this,
a,b,c,d)};eq.c.EditText.prototype.onDragStart=function(a,b,c,d,e,f){a=this.dndMode;c=eq.Dnd;var g;if(a&c.local){if((g=d.selectionEnd)<=(c=d.selectionStart))return!1;f.drag={id:b,content:d.value.substring(c,g)};(this.dnd=f).ch.push(b);eq.c.DlgElement.setDropModes(e,a);return!0}return a&c.global?(eq.c.DlgElement.setDropModes(e,c.all),!0):!1};eq.c.EditText.onDragOver=function(a){a.preventDefault();var b,c,d;(b=eq.app.dnd)&&(c=b.drag)&&(d=c.over)&&(c.over=null,d.classList.remove("eq-dragover"))};
eq.c.EditText.prototype.onDrop=function(a,b,c,d,e){e.drop.pos=c.firstElementChild.selectionStart;(this.dnd=e).ch.push(e.drop.id=b);return e.drag?this.dropRule:this.globalDropRule};eq.c.EditText.prototype.focusElement=function(a,b){a=b.getElementsByTagName("INPUT");0===a.length&&(a=b.getElementsByTagName("TEXTAREA"));if(1!==a.length)throw Error("BUG: EditText.focusElement id:"+b.id+" elements:"+a.length+", expected: 1");return a[0]};
eq.c.EditText.prototype.focusGained=function(a,b){void 0===eq.app.pendingMouseDown&&b!==document.activeElement&&("INPUT"===b.tagName?(b.select(),b.scrollLeft=b.scrollWidth):b.selectionStart=b.selectionEnd=0)};eq.c.EditText.prototype.focusLost=function(a,b){a=b.firstElementChild;"INPUT"===a.tagName&&(a.selectionStart=a.selectionEnd=0);a.blur()};
eq.c.EditText.prototype.changed=function(a,b,c,d){a=[];for(var e=0,f=d.length;e<f;e++)switch(d[e]){case "input":a.push({ty:eq.RsValType.textValue,sv:c.value});break;case "blur":var g=c.selectionStart;0<=g&&a.push({ty:eq.RsValType.caretPos,iv:g});break;case "dnd":var h=this.dnd,k,l,n;h&&((k=h.drag)&&k.id===b&&void 0!==(n=k.content)&&(k.content=null,a.push({ty:eq.RsValType.dragContent,sv:n})),(l=h.drop)&&l.id===b&&void 0!==(g=l.pos)&&a.push({ty:eq.RsValType.dropPos,iv:g}))}this.dnd=null;switch(a.length){case 0:return null;
case 1:return a[0].id=b,a[0];default:return{id:b,v:a}}};eq.c.DlgElement.addClass("GroupBox",function(a,b){eq.c.DlgElement.call(this,a,b);this.attrAccel=null;this.globalDropRule=this.dropRule=0;this.scrl=null});delete eq.c.GroupBox.subClass;eq.c.GroupBox.prototype.dispose=function(a,b){var c=this.attrAccel;if(null!==c){var d=a.accel;d.get(c)===b&&d.delete(c);this.attrAccel=null}eq.c.DlgElement.prototype.dispose.call(this,a,b)};
eq.c.GroupBox.prototype.updateId=function(a,b,c){var d=this.attrAccel;if(null!==d){var e=a.accel;e.get(d)===c&&e.set(d,b)}eq.c.DlgElement.prototype.updateId.call(this,a,b,c)};eq.c.GroupBox.scroll=function(a,b){if(!eq.app.idle&&a.offsetWidth&&a.offsetHeight&&a.getClientRects().length){b.self.scrl=null;a.dataset.scroll="ignore";var c;0<=(c=b.left)&&(a.scrollLeft=c);0<=(c=b.top)&&(a.scrollTop=c)}else eq.Dom.onNextFrame(a,b)};
eq.c.GroupBox.onScroll=function(a){if("scroll"in this.dataset)delete this.dataset.scroll;else{a=this.parentNode;var b;a&&(b=a.classList)&&b.contains("eq-groupbox")&&eq.app.setChanged(a.id,"scroll")}};
eq.c.GroupBox.prototype.setAttr=function(a,b,c,d){for(var e=eq.RqTag,f,g=0,h=d.length;g<h;g++){var k=d[g];switch(k.t){case e.vx:var l=this.scrl,n=this.constructor;l?l.left=k.i:l=this.scrl={cb:n.scroll,self:this,left:k.i,top:-1};n.scroll(c.lastElementChild,l);break;case e.vy:l=this.scrl;n=this.constructor;l?l.top=k.i:l=this.scrl={cb:n.scroll,self:this,left:-1,top:k.i};n.scroll(c.lastElementChild,l);break;case e.vWidth:case e.vHeight:k.s?(c.classList.add("eq-scroll"),c.lastElementChild.onscroll=eq.c.GroupBox.onScroll):
(c.classList.remove("eq-scroll"),c.lastElementChild.onscroll=null);break;case e.text:l=k.v;n=c.firstElementChild;k=c.classList;if(l){if(!n||!n.classList.contains("eq-title")){n=document.createElement("DIV");n.className="eq-rt eq-title";n.appendChild(document.createElement("DIV"));var m=document.createElement("SPAN");m.className="eq-fn";n.appendChild(m);n.appendChild(document.createElement("DIV"));c.insertBefore(n,c.firstElementChild)}l=eq.Dom.setContent(n.children[1],l,!0);this.setAccel(a,b,l,eq.KeyMod.alt);
k.add("eq-title")}else n&&n.classList.contains("eq-title")&&(c.removeChild(n),k.remove("eq-title"));break;case e.accel:n=this.attrAccel;l=eq.Dom.decodeAccelAttr(k.v);l!==n&&(k=a.accel,null!==n&&k.get(n)===b&&k.delete(n),null===l||k.has(l)?this.attrAccel=null:k.set(this.attrAccel=l,b));break;case e.dropRule:l=c.lastElementChild;(this.dropRule=k.i)||this.globalDropRule?(k=a.constructor,l.ondragover=k.onDragOver,l.ondrop=k.onDrop):(l.ondragover=null,l.ondrop=null);break;case e.globalDropRule:l=c.lastElementChild;
(this.globalDropRule=k.i)||this.dropRule?(k=a.constructor,l.ondragover=k.onDragOver,l.ondrop=k.onDrop):(l.ondragover=null,l.ondrop=null);break;default:f?f.push(k):f=[k]}}f&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,f)};
eq.c.GroupBox.prototype.onAccel=function(a,b,c){if((b=eq.Dom.eqControl(c.parentNode))&&b.classList.contains("eq-tabbox")){a=a.eds.get(b.id);if(void 0===a)throw Error("GroupBox.onAccel("+c.id+") BUG: TabBox "+b.id+" not registered");a.onTabAccel(b,c)}else(c=c.querySelector(".eq-focus:not(.eq-disabled)"))&&eq.app.setFocus(c.id,c)};eq.c.GroupBox.prototype.onDrop=function(a,b,c,d,e){return e.drag?this.dropRule:this.globalDropRule};
eq.c.GroupBox.prototype.changed=function(a,b,c,d){return{id:b,ty:eq.RsValType.scrollPos,x:c.scrollLeft,y:c.scrollTop}};eq.c.DlgElement.addClass("HtmlView",function(a,b){eq.c.DlgElement.call(this,a,b);this.dnd=null;this.globalDropRule=this.dropRule=this.dndMode=0});delete eq.c.HtmlView.subClass;eq.c.HtmlView.re=/^eloq:([0-9]*)(\/(.*))?$/i;eq.c.HtmlView.ctx=new Map;eq.c.HtmlView.timeout=void 0;
eq.c.HtmlView.prototype.dispose=function(a,b){this.dnd=null;eq.c.DlgElement.prototype.dispose.call(this,a,b)};eq.c.HtmlView.startTimeout=function(){void 0!==this.timeout&&window.clearTimeout(this.timeout);this.timeout=window.setTimeout(this.timeoutElapsed,1E4)};eq.c.HtmlView.timeoutElapsed=function(){var a=eq.c.HtmlView;a.timeout=void 0;a.ctx.clear()};
eq.c.HtmlView.ready=function(){var a=eq.c.HtmlView,b=this.name,c=a.ctx.get(b);if(c){var d=c.self;var e=c.url;var f=c.cn;a.ctx.delete(b)}try{var g=this.contentWindow,h=g.document,k=h.body;g.name=b;f&&(k.style.margin="0",eq.Dom.setHtmlContent(f,k,h.head));var l=k.querySelectorAll('a[href^="eloq:"]');c=0;for(var n=l.length;c<n;c++){var m=l[c];m.dataset.eqLink=m.href;m.href="#";m.addEventListener("click",a.clicked)}d&&d.dndUpdate(b,this)}catch(p){console.warn("HtmlView:"+b+(e?" '"+e+"' ":" ")+p.name+
": "+p.message)}};eq.c.HtmlView.clicked=function(a){var b=a.view.name,c,d;b&&(c=document.getElementById(b))&&(d=this.dataset.eqLink)&&eq.c.HtmlView.submit(b,c,d);a.preventDefault();a.stopImmediatePropagation()};
eq.c.HtmlView.submit=function(a,b,c){if(!b.classList.contains("eq-disabled")){var d=eq.app;c=this.re.exec(c);var e;if(c&&(0<c.length&&c[1].length&&(e=c[1]),2<c.length&&c[3]))try{b.dataset.eqLink=decodeURIComponent(c[3])}catch(f){delete b.dataset.eqLink}d.setChanged(a,"change");if(void 0!==e||b.classList.contains("eq-rule"))void 0!==e&&(d.onceRule=e,d.onceId=a),d.submit(b,{id:a,type:"change"})}};eq.c.HtmlView.prototype.onMessage=function(a,b,c,d){this.constructor.submit(b,c,d)};
eq.c.HtmlView.createFrame=function(a){var b=document.createElement("IFRAME");b.name=a;b.onload=this.ready;return b};
eq.c.HtmlView.prototype.setAttr=function(a,b,c,d){for(var e=this.constructor,f=eq.RqTag,g,h=0,k=d.length;h<k;h++){var l=d[h];switch(l.t){case f.url:var n=c.firstElementChild;n&&"IFRAME"!==n.tagName&&(c.removeChild(n),n=null);n||c.appendChild(n=e.createFrame(b));n.src=l.v;e.startTimeout();e.ctx.set(b,{self:this,dlg:a,url:l.v});break;case f.content:n=c.firstElementChild;switch(l.ty){case 0:n&&"IFRAME"!==n.tagName&&(c.removeChild(n),n=null);n||c.appendChild(n=e.createFrame(b));n.src="about:blank";e.startTimeout();
e.ctx.set(b,{self:this,dlg:a,cn:l.v});break;case 1:n&&"TEXTAREA"!==n.tagName&&(c.removeChild(n),n=null);n||(n=document.createElement("TEXTAREA"),n.className="eq-fn",n.readOnly=!0,n.wrap="off",n.autocapitalize="none",n.autocomplete="off",n.autocorrect="off",n.spellcheck=!1,c.appendChild(n));n.value=n.textContent=l.v;e.ctx.delete(b);this.dndUpdate(b,n);break;default:throw Error("HtmlView.setAttr: tag "+l.t+" invalid type "+l.ty);}break;case f.dndMode:this.dndMode=l.i;this.dndUpdate(b,c.firstElementChild);
break;case f.dropRule:this.dropRule=l.i;this.dndUpdate(b,c.firstElementChild);break;case f.globalDropRule:this.globalDropRule=l.i;this.dndUpdate(b,c.firstElementChild);break;default:g?g.push(l):g=[l]}}g&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,g)};
eq.c.HtmlView.prototype.dndUpdate=function(a,b){if(b)try{if("IFRAME"===b.tagName)b=b.contentWindow;else if("TEXTAREA"!==b.tagName)throw Error("HtmlView.dndUpdate "+a+" invalid tagName:"+b.tagName);var c;b.ondragstart=this.dndMode?(c||(c=eq.c.Dlg)).onDragStart:null;this.dropRule||this.globalDropRule?(b.ondragover=this.constructor.onDragOver,b.ondrop=(c||eq.c.Dlg).onDrop):(b.ondragover=null,b.ondrop=null)}catch(d){}};
eq.c.HtmlView.prototype.onDragStart=function(a,b,c,d,e,f){if(a=c.firstElementChild)try{if("IFRAME"===a.tagName){a=a.contentWindow;var g=a.getSelection().toString()}else{if("TEXTAREA"!==a.tagName)throw Error("HtmlView.onDragStart "+b+" invalid tagName:"+a.tagName);var h,k;(k=a.selectionEnd)>(h=a.selectionStart)&&(g=a.value.substring(h,k))}if(g){var l=this.dndMode,n=eq.Dnd;if(l&n.local)return f.drag={id:b,content:g},(this.dnd=f).ch.push(b),eq.c.DlgElement.setDropModes(e,l),!0;if(l&n.global)return eq.c.DlgElement.setDropModes(e,
n.all),!0}}catch(m){}return!1};eq.c.HtmlView.onDragOver=function(a){a.preventDefault();var b,c,d;(b=eq.app.dnd)&&(c=b.drag)&&(d=c.over)&&(c.over=null,d.classList.remove("eq-dragover"))};
eq.c.HtmlView.prototype.onDrop=function(a,b,c,d,e){if(a=c.firstElementChild)try{if("IFRAME"===a.tagName){for(;d&&!d.id;)d=d.parentNode;d&&(e.drop.element=d.id);e.drop.pos=0}else{if("TEXTAREA"!==a.tagName)throw Error("HtmlView.onDrop "+b+" invalid tagName:"+a.tagName);e.drop.pos=a.selectionStart}(this.dnd=e).ch.push(e.drop.id=b);return e.drag?this.dropRule:this.globalDropRule}catch(f){}return 0};
eq.c.HtmlView.prototype.changed=function(a,b,c,d){a=[];for(var e=0,f=d.length;e<f;e++)switch(d[e]){case "change":var g=c.dataset.eqLink;g&&delete c.dataset.eqLink;a.push({ty:eq.RsValType.textValue,sv:g||""});break;case "dnd":var h=this.dnd,k,l,n;h&&((k=h.drag)&&k.id===b&&void 0!==(g=k.content)&&(k.content=null,a.push({ty:eq.RsValType.dragContent,sv:g})),(l=h.drop)&&l.id===b&&(void 0!==(n=l.pos)&&a.push({ty:eq.RsValType.dropPos,iv:n}),void 0!==(g=l.element)&&(l.element=null,a.push({ty:eq.RsValType.dropElement,
sv:g}))))}this.dnd=null;switch(a.length){case 0:return null;case 1:return a[0].id=b,a[0];default:return{id:b,v:a}}};eq.c.DlgElement.addClass("ListBox",function(a,b){eq.c.DlgElement.call(this,a,b);this.activeCol=0;this.dnd=this.ttLine=this.ttHeader=this.lineOrder=null;this.globalDropRule=this.dropRule=this.dndMode=0});delete eq.c.ListBox.subClass;
eq.c.ListBox.prototype.dispose=function(a,b){var c;null!==(c=this.lineOrder)&&(c.length=0,this.lineOrder=null);null!==(c=this.ttHeader)&&(c.length=0,this.ttHeader=null);null!==(c=this.ttLine)&&(c.length=0,this.ttLine=null);this.dnd=null;eq.c.DlgElement.prototype.dispose.call(this,a,b)};
eq.c.ListBox.select=function(a,b){for(var c=a.querySelectorAll(".eq-column>.eq-selected"),d=0,e=c.length;d<e;d++)c[d].classList.remove("eq-selected");if(void 0!==b)for(c=a.querySelectorAll(".eq-column"),d=0,e=c.length;d<e;d++)a=c[d].children,b<a.length&&a[b].classList.add("eq-selected")};
eq.c.ListBox.scrollIntoView=function(a,b){var c=a.querySelector(".eq-column").children;if(b<c.length){var d=c[0].parentNode.parentNode;var e=d.getBoundingClientRect().height;var f=c[0].getBoundingClientRect().height;if(0<e&&0<f){var g=d.scrollTop;b=c[b].offsetTop;if(b<g){d.scrollTop=b;var h=eq.app}else b+f>g+e&&(d.scrollTop=Math.ceil(b+f-e+2),h=eq.app);h&&h.setChanged(a.id,"scroll")}}};
eq.c.ListBox.onScroll=function(){if("scroll"in this.dataset)delete this.dataset.scroll;else eq.Dom.onNextFrame(this,{cb:eq.c.ListBox.onScroll.exec})};eq.c.ListBox.onScroll.exec=function(a){var b=a.classList,c;b&&b.contains("eq-pane")&&(c=a.parentNode)&&(b=c.classList)&&b.contains("eq-listbox")&&(eq.app.setChanged(c.id,"scroll"),b.contains("eq-multi")&&(b=a.previousElementSibling))&&(b.style.marginLeft="-"+a.scrollLeft+"px")};
eq.c.ListBox.setTopItem=function(a,b){var c=a.querySelector(".eq-column"),d=c.children,e=c.parentNode,f=0;if(1<d.length){var g,h,k;if(eq.app.idle||0>=(g=c.getBoundingClientRect().height)||0>=(h=e.getBoundingClientRect().height)||0>=(k=d[0].getBoundingClientRect().height)){eq.Dom.onNextFrame(a,b);return}if(0<(a=g-h)){c=b.li;var l,n;null!==(l=b.self.lineOrder)&&(c=-1===(n=l.indexOf(c))?0:n);0<k&&(f=c*k)>a&&(f=Math.ceil(a+2))}}e.dataset.scroll="ignore";e.scrollTop=f};
eq.c.ListBox.prototype.setAutoWidth=function(a,b,c){eq.Dom.onNextFrame(c,{cb:this.constructor.execAutoWidth,dlg:a})};
eq.c.ListBox.execAutoWidth=function(a,b){for(var c=a.firstElementChild.children,d=a.lastElementChild.children,e=2*b.dlg.grid.wr,f=0,g=0,h=d.length;f<h;f++){var k;if((k=d[f]).classList.contains("eq-auto")){var l=Number(window.getComputedStyle(k).width.replace(/px$/,""));if(isNaN(l)){if(0!==g)throw Error("ListBox.execAutoWidth BUG: column["+f+"] width NaN, autowidth:"+g);eq.Dom.onNextFrame(a,b);break}var n=c[f];var m=Number(window.getComputedStyle(n).width.replace(/px$/,""));if(isNaN(m))throw Error("ListBox.execAutoWidth BUG: header["+
f+"] width NaN, autowidth:"+g);m>l&&(l=m);l<e&&(l=e);n.style.width=k.style.width=l+"px";g++}}};eq.c.ListBox.colResize=function(a,b){b.busy||(b.busy=!0,eq.Dom.onNextFrame(b.el,{cb:eq.c.ListBox.colResize.exec,x:a.clientX,m:b}))};eq.c.ListBox.colResize.exec=function(a,b){a=b.x;b=b.m;if(a!==b.x){var c=b.h,d=b.c,e=b.w+a-b.x,f=2*b.dlg.grid.wr;e>=f?(c.style.width=d.style.width=e+"px",b.x=a,b.w=e):(c.style.width=d.style.width=f+"px",b.x-=b.w-f,b.w=f);b.modified=!0}b.busy=void 0};
eq.c.ListBox.colResize.done=function(a){if(a.modified){var b=eq.app,c=a.el.id;b.setChanged(c,"resize");b.apiUpdate(c,eq.UpdateTag.colResized,{col:eq.Dom.parentIndex(a.h),width:a.w})}return!1};eq.c.ListBox.colMove=function(a,b){b.busy||(b.busy=!0,eq.Dom.onNextFrame(b.el,{cb:eq.c.ListBox.colMove.exec,x:a.clientX,m:b}))};
eq.c.ListBox.colMove.exec=function(a,b){a=b.m;var c=a.el.getElementsByClassName("eq-space");b=b.x;var d=a.cw,e=a.x,f=a.lx,g=a.f,h=a.t,k,l,n;if(2===c.length){0>(k=f+b-e)&&(k=0,b=e-f);if(k>f)var m=a.ow;else if(k<f)m=0;else{a.busy=void 0;return}m+=k;e=l=0;for(f=d.length;e<f;e++){var p=e===h?d[g]:e>=g&&e<h?d[e+1]:d[e];l+=p;if(m<l-p/2)break}for(d=0;2>d;d++)g=(n=c[d]).parentNode,e<f?g.insertBefore(n,g.children[e]):g.appendChild(n);a.t=eq.Dom.parentIndex(n);a.ob.style.left=(a.lx=k)+"px";a.x=b}a.busy=void 0};
eq.c.ListBox.colMove.done=function(a){var b=eq.app,c=a.el,d=a.f,e=a.t,f;b.closeOverlay(c);e!==d&&(c=c.id,b.setChanged(c,"move"),b.apiUpdate(c,eq.UpdateTag.colMoved,{from:d,to:e}),null!==(f=a.self.ttHeader)&&f.splice(e,0,f.splice(d,1)[0]));return!1};
eq.c.ListBox.colMove.closeOverlay=function(a,b){a=a.getElementsByClassName("eq-space");var c=b.firstElementChild,d;if(2!==a.length)throw Error("ListBox.colMove.closeOverlay BUG: "+a.length+" eq-space elements");var e=a[0];e.parentNode.replaceChild(c.firstElementChild.firstElementChild,e);e=a[0];e.parentNode.replaceChild(c.lastElementChild.firstElementChild,e);(d=c.id)&&eq.app.removeStyles(d);b.parentNode.removeChild(b)};
eq.c.ListBox.prototype.setAttr=function(a,b,c,d){for(var e=this.constructor,f=eq.app,g=eq.Dom,h=eq.RqTag,k,l=0,n=d.length;l<n;l++){var m=d[l];switch(m.t){case h.columns:var p,q=c.classList;null!==(p=this.lineOrder)&&(p.length=0,this.lineOrder=null);null!==(p=this.ttHeader)&&(p.length=0,this.ttHeader=null);if(0===m.l)if(q.contains("eq-single"))c.firstElementChild.firstElementChild.textContent="";else{c.textContent="";q.remove("eq-multi");q.add("eq-single");var r=document.createElement("DIV");r.className=
"eq-pane";r.onscroll=e.onScroll;p=document.createElement("DIV");p.className="eq-column";r.appendChild(p);c.appendChild(r)}else if(q.contains("eq-multi"))c.firstElementChild.textContent="",c.lastElementChild.textContent="";else{c.textContent="";q.remove("eq-single");q.add("eq-multi");var t=document.createElement("DIV");t.className="eq-caption";r=document.createElement("DIV");r.className="eq-pane";r.onscroll=e.onScroll;c.appendChild(t);c.appendChild(r)}break;case h.colOrder:m=m.m;var u=m.length;t=c.firstElementChild;
var v=t.children;r=c.lastElementChild;var y=r.children,w=this.ttHeader;for(q=0;q<u;q++)(p=m[q])!==q&&(t.insertBefore(v[p],v[q]),r.insertBefore(y[p],y[q]),null!==w&&w.splice(q,0,w.splice(p,1)[0]));break;case h.colState:w=eq.c.DlgElement;var B=m.s,x=m.uh;u=B.length;t=c.firstElementChild;v=t.children;r=c.lastElementChild;y=r.children;var E=eq.ColType,z,A,C,O;for(m=z=A=0;m<u;m++)if(null===(C=B[m]))z<v.length&&t.removeChild(v[z]),A<y.length&&r.removeChild(y[A]);else{z<v.length?q=(p=v[z]).firstElementChild:
(f.ttAttach(p=document.createElement("DIV")),p.appendChild(q=document.createElement("SPAN")),t.appendChild(p));z++;if(null!==C.w)p.style.width=C.w;else{p.style.width="";var L=!0}var F=q.style;w.setFont(q,C.fn);null!==C.bc&&(F.backgroundColor=C.bc);null!==C.fc&&(F.color=C.fc);p.className="";q=p.classList;C.movable&&q.add("eq-move");C.sizable&&q.add("eq-resize");C.sortable&&q.add("eq-sort");x&&q.add("eq-cmc");A<y.length?(p=y[A]).firstElementChild&&(O=!0):(p=document.createElement("DIV"),r.appendChild(p));
A++;p.className="eq-column";q=p.classList;switch(C.type){case E.colBoolean:q.add("eq-bool");break;case E.colBarGraph:q.add("eq-bar")}F=p.style;null!==C.w?F.width=C.w:(q.add("eq-auto"),F.width="");switch(C.align){case 0:F.textAlign="";break;case 1:F.textAlign="center";break;case 2:F.textAlign="right"}}L&&O&&this.whenVisible(a,b,c,this.setAutoWidth);break;case h.colTitle:q=m.ct;u=q.length;v=c.firstElementChild.children;var G;for(m=0;m<u;m++)void 0!==(G=q[m])&&G.length?g.setContent(v[m].firstElementChild,
G):v[m].firstElementChild.textContent=" ";break;case h.lineOrder:q=c.querySelector(".eq-selected");u=this.lineOrder;p=m.s;if(q){var D=g.parentIndex(q);if(null!==u){if(D>=u.length)throw Error("ListBox.setAttr lineOrder: selection "+D+" >= lineOrder "+u.length);D=u[D]}}null!==u&&(u.length=0);null!==(u=m.o)&&0===u.length&&(u=null);this.lineOrder=u;q&&(null!==u&&-1===(D=u.indexOf(D))&&q.classList.remove("eq-selected"),-1!==D&&(e.select(c,D),e.scrollIntoView(c,D)));if((t=c.firstElementChild).classList.contains("eq-caption")){y=
t.querySelectorAll(".eq-caption>.eq-up,.eq-caption>.eq-dn");u=y.length;for(m=0;m<u;m++)q=y[m].classList,q.remove("eq-up"),q.remove("eq-dn"),q.remove("eq-first"),q.remove("eq-second");if(u=p.length)for(r=t.children,v=r.length,m=0;m<u;m++)w=p[m],t=w.i,t<v&&(q=r[t].classList,w.d?q.add("eq-dn"):q.add("eq-up"),0===m?q.add("eq-first"):1===m&&q.add("eq-second"))}break;case h.toolTip:(this.toolTip=m.v)?f.ttAttach(c.lastElementChild):(f.ttDetach(c.lastElementChild),this.toolTip=null);break;case h.colToolTip:w=
this.ttHeader;null!==w&&(w.length=0);this.ttHeader=m.ctt;break;case h.content:y=c.querySelectorAll(".eq-column");B=y.length;p=m.c;u=this.lineOrder;D=(q=c.querySelector(".eq-selected"))?g.parentIndex(q):-1;w=this.ttLine;r=null!==w?w.length:0;E=this.dndMode;var M,I;if(B!==p.length)throw Error("ListBox.setAttr content: column count "+p.length+", expected: "+B);if(E)var H=eq.c.Dlg;(t=c.firstElementChild).classList.contains("eq-caption")||(t=null);for(z=0;z<B;z++){var J=(M=p[z])?M.length:0;if(null!==u&&
u.length<J)throw Error("ListBox.setAttr content: lineOrder "+u.length+", min. expected: "+J);A=y[z];J?F=(C=A.children).length:(A.textContent="",C=A.children,F=0);q=A.classList;q.contains("eq-auto")&&(L=!0,A.style.width="",t&&(t.children[z].style.width=""));for(v=0;v<J;v++){m=null!==u?u[v]:v;v<F?(x=C[v],(I=x.classList).remove("eq-active"),v===D?I.add("eq-selected"):I.remove("eq-selected"),E?(x.draggable=!0,x.ondragstart=H.onDragStart):(x.draggable=!1,x.ondragstart=null),null!==w&&m<r&&w[m]&&f.ttAttach(x)):
(x=document.createElement("DIV"),x.className=v===D?"eq-fn eq-selected":"eq-fn",I=x.classList,E&&(x.draggable=!0,x.ondragstart=H.onDragStart),A.appendChild(x),null!==w&&(m<r&&w[m]?f.ttAttach(x):f.ttDetach(x)));var N=x.style;G=M[m];q.contains("eq-bool")?("1"===G&&I.add("eq-active"),x.textContent=" ",N.backgroundSize=""):q.contains("eq-bar")?(N.backgroundSize=void 0!==G&&G.length?G+"% 100%":"0",x.textContent=" "):(void 0!==G&&G.length?g.setContent(x,G):x.textContent=" ",N.backgroundSize="")}for(;C.length>
J;)A.removeChild(A.lastElementChild)}L&&this.whenVisible(a,b,c,this.setAutoWidth);break;case h.lineToolTip:w=this.ttLine;r=null!==w?w.length:0;y=m.ltt;B=null!==y?y.length:0;u=this.lineOrder;x=null!==u?u.length:0;p=c.querySelectorAll(".eq-column");E=(q=p.length)?p[0].children.length:0;var K;for(v=0;v<E;v++){if(null===u)m=v;else{if(v>=x)continue;m=u[v]}if(z=null!==y&&m<B&&y[m])z=null===w||m>=r||!w[m];else if(null!==w&&m<r&&w[m])for(t=0;t<q;t++)v<(K=p[t].children).length&&f.ttDetach(K[v]);if(z)for(t=
0;t<q;t++)v<(K=p[t].children).length&&f.ttAttach(K[v])}null!==w&&(w.length=0);this.ttLine=y;break;case h.activeLine:w=m.i;if(0<w){w--;if(null!==(u=this.lineOrder)){if(-1===(v=u.indexOf(w))){e.select(c);break}w=v}e.select(c,w);e.scrollIntoView(c,w)}else e.select(c);break;case h.vActiveLine:w=m.i;0<w?(e.select(c,--w),e.scrollIntoView(c,w)):e.select(c);break;case h.topItem:e.setTopItem(c,{cb:e.setTopItem,self:this,li:m.i});break;case h.dndMode:y=c.querySelectorAll(".eq-column>div");if(this.dndMode=m.i)for(q=
a.constructor.onDragStart,m=0,u=y.length;m<u;m++)(x=y[m]).draggable=!0,x.ondragstart=q;else for(m=0,u=y.length;m<u;m++)(x=y[m]).draggable=!1,x.ondragstart=null;break;case h.dropRule:r=c.lastElementChild;(this.dropRule=m.i)||this.globalDropRule?(H=a.constructor,r.ondragover=H.onDragOver,r.ondrop=H.onDrop):(r.ondragover=null,r.ondrop=null);break;case h.globalDropRule:r=c.lastElementChild;(this.globalDropRule=m.i)||this.dropRule?(H=a.constructor,r.ondragover=H.onDragOver,r.ondrop=H.onDrop):(r.ondragover=
null,r.ondrop=null);break;default:k?k.push(m):k=[m]}}k&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,k)};eq.c.ListBox.prototype.onEvent=function(a,b,c,d){if("keydown"===d.type)return!0;a=d.target;for(var e,f;!(!a||(e=a.classList)&&e.contains("eq-listbox")||e&&e.contains("eq-column"));){if((f=a.parentNode)&&(e=f.classList)&&e.contains("eq-column"))return!0;a=f}return!1};
eq.c.ListBox.prototype.onKey=function(a,b,c,d,e,f){if(e)return!1;e=this.constructor;var g=eq.app,h=eq.Dom,k=h.isEnterOrSpace(d);if(k){var l=c.querySelector(".eq-column>.eq-selected");l&&(f.eq={key:k},g.processEvent(a,f,b,c,this));h.consumeEvent(f);return!0}switch(d){case "Escape":case "Esc":return e.select(c),h.consumeEvent(f),!0;case "Home":case "End":case "PageUp":case "PageDown":case "ArrowUp":case "Up":case "ArrowDown":case "Down":break;default:return!1}var n=c.querySelector(".eq-listbox .eq-column").children,
m=0;l=-1;if(n.length){switch(d){case "Home":l=0;k=36;break;case "End":l=n.length-1;k=35;break;case "PageUp":m=-10;k=33;break;case "PageDown":m=10;k=34;break;case "ArrowUp":case "Up":m=-1;k=38;break;case "ArrowDown":case "Down":m=1,k=40}d=null;if(-1!==l)d=n[l];else if(0!==m){if((-1>m||1<m)&&1<n.length){l=n[0].parentNode.parentNode;l=l.getBoundingClientRect().height;var p=n[0].getBoundingClientRect().height;0<l&&0<p&&(m=0<m?Math.floor(l/p):Math.ceil(-(l/p)))}(l=c.querySelector(".eq-column>.eq-selected"))?
(l=h.parentIndex(l),0>(l+=m)?l=0:l>=n.length&&(l=n.length-1),d=n[l]):0<m&&(d=n[0])}null===d||d.classList.contains("eq-selected")||(g.setChanged(b,"mousedown"),e.select(c,n=h.parentIndex(d)),this.activeCol=0,e.scrollIntoView(c,n),this.f&&(f.eq={key:k},g.processEvent(a,f,b,c,this)))}h.consumeEvent(f);return!0};
eq.c.ListBox.prototype.onChange=function(a,b,c,d){for(var e=this.constructor,f=eq.Dom,g=d.target,h="mousedown"===d.type,k,l;g&&(!(k=g.classList)||!k.contains("eq-listbox"));){if(k){if(k.contains("eq-column"))break;if(h&&k.contains("eq-resize")&&g===d.target){b=f.parentIndex(g);for(h=g.parentNode.nextElementSibling.firstElementChild;b--;)h=h.nextElementSibling;eq.app.moveCapture({dlg:a,el:c,h:g,c:h,x:d.clientX,w:Number(window.getComputedStyle(g).width.replace(/px$/,""))},e.colResize,e.colResize.done);
f.consumeEvent(d);return!1}}if((l=g.parentNode)&&(k=l.classList)){if(k.contains("eq-column")){e.select(c,f.parentIndex(g));this.activeCol=f.parentIndex(l)+1;break}if(h&&k.contains("eq-caption")){if(g===d.target)break;eq.app.mouseDownTimers.add(150,e.beginColMove,e.colHeaderClicked,{self:this,id:b,el:c,e:d,hd:g});f.consumeEvent(d);return!1}}g=l}return!0};
eq.c.ListBox.colHeaderClicked=function(a){var b=a.hd;if(b.classList.contains("eq-sort")){var c=a.self,d=eq.app,e=a.id,f=a.e,g=c.ttLine;d.setChanged(e,"sort");if(null!==g){var h=g.length;c=c.lineOrder;var k=null!==c?c.length:0;a=a.el.querySelectorAll(".eq-column");var l=a.length,n=l?a[0].children.length:0,m,p;for(m=0;m<n;m++){if(null===c)var q=m;else{if(m>=k)throw Error("ListBox.colMove.done: line "+m+" >= lineOrder "+k);q=c[m]}if(q<h&&g[q])for(q=0;q<l;q++)m<(p=a[q].children).length&&d.ttDetach(p[m])}}d.apiUpdate(e,
eq.UpdateTag.sortSequence,{col:eq.Dom.parentIndex(b),add:f.ctrlKey||f.shiftKey})}};
eq.c.ListBox.beginColMove=function(a){var b=a.self,c=a.id,d=a.el,e=a.e;a=a.hd;if(a.classList.contains("eq-move")){var f=b.constructor,g=eq.app,h=eq.Dom.parentIndex(a),k=a.parentNode,l=k.getBoundingClientRect(),n=[],m,p,q,r;var t=document.createElement("DIV");(m=t.style).position="absolute";m.overflow="hidden";d.parentNode.querySelector(".eq-root-font #"+c)?(t.className="eq-root-font",eq.Dom.copyFont(t,d)):t.className="eq-default-font";var u=document.createElement("DIV");u.className="eq-listbox eq-multi";
d.classList.contains("eq-focused")&&(u.className+=" eq-focused");t.appendChild(u);var v=document.createElement("DIV");v.className="eq-caption";v.style.height=l.height+"px";u.appendChild(v);var y=document.createElement("DIV");y.className="eq-pane";u.appendChild(y);m.left=(r=l.left)+window.pageXOffset+"px";m.top=l.top+window.pageYOffset+"px";m.width=l.width+"px";var w=l.height;l=(q=k.nextElementSibling).getBoundingClientRect();m.height=(m=u.style).height=l.height+w+"px";w=q.children;for(var B=0,x=n.length=
w.length;B<x;B++)l=w[B].getBoundingClientRect(),n[B]=l.width,B===h&&(m.left=(r=l.left-r)+"px",m.width=(p=l.width)+"px",q=w[B]);l=document.createElement("DIV");l.className="eq-space";l.style.width=a.style.width;l.appendChild(document.createElement("DIV"));v.appendChild(k.replaceChild(l,a));l=document.createElement("DIV");l.className="eq-column eq-space";l.style.width=q.style.width;l.appendChild(document.createElement("DIV"));y.appendChild((k=k.nextElementSibling).replaceChild(l,q));u.id=b.duplicateCssRules(c);
g.makeOverlay(d,t,f.colMove.closeOverlay);y.scrollTop=k.scrollTop;g.moveCapture({self:b,el:d,ob:u,ow:p,cw:n,lx:r,x:e.clientX,f:h,t:h},f.colMove,f.colMove.done)}};
eq.c.ListBox.prototype.onToolTip=function(a){for(var b,c,d,e;a&&(!(b=a.classList)||!b.contains("eq-listbox"));){if(b){if(b.contains("eq-caption"))return null;if(b.contains("eq-column"))break}if((c=a.parentNode)&&(b=c.classList)){if(b.contains("eq-caption"))return null!==(b=this.ttHeader)&&(c=eq.Dom.parentIndex(a),c<b.length&&(e=b[c]))?e:(e=a.textContent)?e:null;if(b.contains("eq-column")){if(null!==(b=this.ttLine)){c=eq.Dom.parentIndex(a);if(null!==(d=this.lineOrder)){if(c>=d.length)break;c=d[c]}if(c<
b.length&&(e=b[c]))return e}break}}a=c}return eq.c.DlgElement.prototype.onToolTip.call(this,a)};
eq.c.ListBox.prototype.onDragStart=function(a,b,c,d,e,f){var g=this.dndMode;a=eq.Dnd;if(g&a.local)return f.drag={id:b},eq.c.DlgElement.setDropModes(e,g),!0;if(g&a.global){if(c.classList.contains("eq-multi"))for(b=eq.Dom.parentIndex(d),c=d.parentNode.parentNode.children,d="",f=0,g=c.length;f<g;f++)f&&(d+="\t"),d+=c[f].children[b].textContent;else d=d.textContent;e.dataTransfer.setData("text/plain",d);eq.c.DlgElement.setDropModes(e,a.all);return!0}return!1};
eq.c.ListBox.prototype.onDragOver=function(a,b,c,d){for(var e,f;d&&(e=d.parentNode);){if((f=e.classList)&&f.contains("eq-column"))return d;if(e===c||f&&f.contains("eq-pane"))break;d=e}return null};
eq.c.ListBox.prototype.onDrop=function(a,b,c,d,e){for(var f,g;d&&(f=d.parentNode)&&(!(g=f.classList)||!g.contains("eq-column"));){if(f===c||g&&g.contains("eq-pane"))return this.dndMode&eq.Dnd.dropExact?0:(e.drop.column=-1,e.drop.line=0,(this.dnd=e).ch.push(e.drop.id=b),e.drag?this.dropRule:this.globalDropRule);d=f}if(d&&f){d=(a=eq.Dom).parentIndex(d);if(null!==(c=this.lineOrder)){if(d>=c.length)throw Error("ListBox.onDrop: dropLine "+d+" >= lineOrder "+c.length);d=c[d]}e.drop.line=d+1;e.drop.column=
a.parentIndex(f);(this.dnd=e).ch.push(e.drop.id=b);return e.drag?this.dropRule:this.globalDropRule}return 0};
eq.c.ListBox.prototype.changed=function(a,b,c,d){a=[];for(var e=0,f=d.length;e<f;e++)switch(d[e]){case "mousedown":var g=c.querySelector(".eq-selected");if(g){var h=this.lineOrder;g=eq.Dom.parentIndex(g);if(null!==h){if(g>=h.length)throw Error("ListBox.changed: activeLine "+g+" >= lineOrder "+h.length);g=h[g]}a.push({ty:eq.RsValType.activeLineCol,i1:g+1,i2:this.activeCol})}else a.push({ty:eq.RsValType.activeLineCol,i1:0,i2:0});break;case "scroll":var k=c.querySelector(".eq-column").children;h=this.lineOrder;
g=0;var l;1<k.length&&0<(l=k[0].getBoundingClientRect().height)&&(g=Math.round(k[0].parentNode.parentNode.scrollTop/l));if(null!==h){if(g>=h.length)throw Error("ListBox.changed: topItem "+g+" >= lineOrder "+h.length);g=h[g]}a.push({ty:eq.RsValType.topItem,iv:g});break;case "resize":a.push({ty:eq.RsValType.colWidth});break;case "move":a.push({ty:eq.RsValType.colOrder});break;case "sort":a.push({ty:eq.RsValType.lineOrder});break;case "dnd":h=this.dnd;var n,m;h&&(n=h.drop)&&n.id===b&&(void 0!==(m=n.column)&&
a.push({ty:eq.RsValType.dropColumn,iv:m}),void 0!==(m=n.line)&&a.push({ty:eq.RsValType.dropLine,iv:m}))}this.dnd=null;switch(a.length){case 0:return null;case 1:return a[0].id=b,a[0];default:return{id:b,v:a}}};
eq.c.ListBox.prototype.updated=function(a,b,c,d,e){var f=eq.UpdateTag;switch(d){case f.sortSequence:case f.ctxMenuAct:this.setAttr(a,b,c,e.rt);case f.colResized:case f.colMoved:"rule"in c.dataset&&(a=eq.app,d=c.dataset.rule,+d===+d&&(a.onceRule=d,a.onceId=b,a.submit(c,{id:b,type:"change"})));break;default:eq.c.DlgElement.prototype.updated.call(this,a,b,c,d,e)}};
eq.c.DlgElement.addClass("MenuItem",function(a,b){eq.c.DlgElement.call(this,a,b);this.textPos=0;this.type=eq.MenuType.item;this.menuAccel=this.attrAccel=null});delete eq.c.MenuItem.subClass;
eq.c.MenuItem.prototype.dispose=function(a,b){var c=this.attrAccel;if(null!==c){var d=a.accel;d.get(c)===b&&d.delete(c);this.attrAccel=null}c=this.menuAccel;if(null!==c){var e=document.getElementById(b),f;if(e&&(e=eq.Dom.eqControl(e.parentNode))&&e.classList.contains("eq-menu")&&void 0!==(f=a.eds.get(e.id))){if("Menu"!==f.constructor.name)throw Error("MenuItem.dispose("+b+") BUG: parent "+e.id+" not Menu");null!==(d=f.accelMap)&&d.get(c)===b&&d.delete(c)}this.menuAccel=null}eq.c.DlgElement.prototype.dispose.call(this,
a,b)};eq.c.MenuItem.prototype.updateId=function(a,b,c){var d=this.attrAccel;if(null!==d){var e=a.accel;e.get(d)===c&&e.set(d,b)}d=this.menuAccel;if(null!==d){var f=eq.Dom,g=document.getElementById(b),h;if(g&&(g=f.eqControl(g.parentNode))&&g.classList.contains("eq-menu")&&void 0!==(h=a.eds.get(g.id))){if("Menu"!==h.constructor.name)throw Error("MenuItem.dispose("+b+") BUG: parent "+g.id+" not Menu");null!==(e=h.accelMap)&&e.get(d)===c&&e.set(d,b)}}eq.c.DlgElement.prototype.updateId.call(this,a,b,c)};
eq.c.MenuItem.prototype.setAttr=function(a,b,c,d){for(var e=eq.Dom,f=eq.RqTag,g,h=0,k=d.length;h<k;h++){var l=d[h];switch(l.t){case f.textPos:this.textPos=l.v;break;case f.type:l=this.type=l.v;var n=c.classList,m=eq.MenuType;if(l===m.sep)n.add("eq-sep"),c.textContent="";else{n.remove("eq-sep");var p=eq.TextPos,q;switch(this.textPos){case p.right:n.remove("eq-vert");n.add("eq-horz");var r=["IMG","SPAN"];break;case p.left:n.remove("eq-vert");n.add("eq-horz");r=["SPAN","IMG"];break;case p.bottom:n.remove("eq-horz");
n.add("eq-vert");r=["IMG","SPAN"];break;case p.top:n.remove("eq-horz");n.add("eq-vert");r=["SPAN","IMG"];break;default:n.remove("eq-horz"),n.remove("eq-vert")}(p=e.firstChildByTagName(c,"LABEL"))?n=(q=p.children).length:(p=document.createElement("LABEL"),p.className="eq-rt eq-fn",c.insertBefore(p,c.firstElementChild),n=0);if(r){if(2!==n||q[0].tagName!==r[0]||q[1].tagName!==r[1])n&&(p.textContent=""),p.appendChild(document.createElement(r[0])),p.appendChild(document.createElement(r[1]))}else n&&(p.textContent=
"");n=e.firstChildByTagName(c,"INPUT");switch(l){case m.radio:case m.check:if(n)var t=n.id;else n=document.createElement("INPUT"),n.id=t=c.id+"-1",n.className="eq-rt",c.insertBefore(n,c.firstElementChild);p.htmlFor=t;if(l===m.radio)for(n.type="radio",p=c;p=p.parentNode;){if(t=p.id){n.name=t;break}}else n.type="checkbox",n.removeAttribute("name");break;default:p.removeAttribute("for"),n&&c.removeChild(n)}}break;case f.text:if(p=e.firstChildByTagName(c,"LABEL")){t=e.firstChildByTagName(p,"SPAN");m=
c;for(var u;m=e.eqControl(m.parentNode);){if((n=m.classList).contains("eq-menubar")){n.contains("eq-overlay")&&(m=null);break}n.contains("eq-menu")&&!u&&(u=m)}p=e.setContent(t||p,l.v,!0,!m);if(m&&u){if(void 0===(l=a.eds.get(u.id)))throw Error("MenuItem.setAttr("+b+") text BUG: parent "+u.id+" not registered");if("Menu"!==l.constructor.name)throw Error("MenuItem.setAttr("+b+") text BUG: parent "+u.id+" not Menu");this.menuAccel=l.setMenuAccel(b,this.menuAccel,p)}}break;case f.accel:n=this.attrAccel;
m={};p=e.decodeAccelAttr(l.v,m);p!==n&&(l=a.accel,t=c.querySelector(".eq-acc"),null!==n&&l.get(n)===b&&l.delete(n),null===p||l.has(p)?(this.attrAccel=null,t&&t.parentNode.removeChild(t)):(l.set(this.attrAccel=p,b),t||(t=document.createElement("DIV"),t.className="eq-acc",c.appendChild(t)),t.textContent=m.tag));break;case f.icon:p=e.firstChildByTagName(c,"LABEL");var v;p&&(v=e.firstChildByTagName(p,"IMG"))&&(v.src=l.v);break;case f.active:(q=c.firstElementChild)&&"INPUT"===q.tagName&&(q.checked=0!==
l.v);break;default:g?g.push(l):g=[l]}}g&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,g)};eq.c.MenuItem.prototype.setSensitive=function(a,b,c,d){var e=c.firstElementChild;e&&"INPUT"===e.tagName&&(e.disabled=!d);eq.c.DlgElement.prototype.setSensitive.call(this,a,b,c,d)};
eq.c.MenuItem.prototype.onEvent=function(a,b,c,d){b=eq.Dom;var e=eq.app,f;if(f=b.eqOverlay(c)){b.consumeEvent(d);if("rule"in c.dataset&&(d=c.dataset.rule,(c=(b=a.eds.get(f.id).contextMenuId)?document.getElementById(b):null)&&+d===+d))return e.onceRule=d,e.onceId=b,e.submit(c,{id:b,type:"contextmenu"}),!1;e.closeOverlay(f);return!1}return!0};
eq.c.MenuItem.prototype.onAccel=function(a,b,c){var d=eq.Dom,e,f,g,h;if((e=c.firstElementChild)&&"INPUT"===e.tagName&&void 0!==(f=e.checked))if(g=e.name){if(!f&&(h=c.parentNode)){h=h.querySelectorAll('li>input[name="'+g+'"]');for(g=h.length;0<=--g;)(f=h[g])!==e&&(f.checked=!1);e.checked=!0}}else e.checked=!f;h=c;e=!0;for(f=null;(h=d.eqControl(h.parentNode))&&!(g=h.classList).contains("eq-menubar");)g.contains("eq-menu")&&(f=h,g.contains("eq-open")||(e=!1));d.closeMenu();f&&!e&&(f.classList.add("eq-flash"),
window.setTimeout(this.constructor.flashMenu,100,f));eq.app.processEvent(a,{type:"click",target:c},b,c,this)};eq.c.MenuItem.flashMenu=function(a){a.classList.remove("eq-flash")};eq.c.MenuItem.prototype.onSubmit=function(a,b,c,d){a=eq.MenuType;var e;switch(this.type){case a.radio:case a.check:(e=eq.app).changed.has(b)||e.changed.set(b,"input")}};
eq.c.MenuItem.prototype.onChange=function(a,b,c,d){var e=eq.Dom;if(a=e.eqOverlay(c)){(d=eq.app).changed.delete(b);if("obj"in c.dataset)b=c.dataset.obj,d.apiUpdate(b,eq.UpdateTag.ctxMenuAct,{c:e.parentIndex(c)});else if("item"in c.dataset){b=c.dataset.item;d.apiUpdate(null,eq.UpdateTag.ctxMenuAct,{i:b});b=document.getElementById(b);var f,g;if(b&&(f=b.firstElementChild)&&"INPUT"===f.tagName&&void 0!==(g=f.checked))if(e=f.name){if(!g&&(b=b.parentNode)){g=b.querySelectorAll('li>input[name="'+e+'"]');
for(e=g.length;0<=--e;)(b=g[e])!==f&&(b.checked=!1);f.checked=!0}}else f.checked=!g}"rule"in c.dataset||d.closeOverlay(a)}else if(d.menuMouseUp&&(f=c.firstElementChild)&&"INPUT"===f.tagName&&void 0!==(g=f.checked))if(e=f.name){if(!g&&(c=c.parentNode)){g=c.querySelectorAll('li>input[name="'+e+'"]');for(e=g.length;0<=--e;)(c=g[e])!==f&&(c.checked=!1);f.checked=!0}}else f.checked=!g;return!0};
eq.c.MenuItem.prototype.changed=function(a,b,c,d){a=eq.MenuType;switch(this.type){case a.radio:case a.check:if(c=eq.Dom.inputElement(c))return{id:b,ty:eq.RsValType.buttonChecked,iv:c.checked?1:0}}return null};eq.c.DlgElement.addClass("Menu",function(a,b){eq.c.DlgElement.call(this,a,b);this.accelMap=this.menuAccel=null;this.textPos=0});
eq.c.Menu.prototype.dispose=function(a,b){null!==this.accelMap&&(this.accelMap.clear(),this.accelMap=null);var c=this.menuAccel;if(null!==c){var d=document.getElementById(b),e,f;if(d&&(d=eq.Dom.eqControl(d.parentNode))&&d.classList.contains("eq-menu")&&void 0!==(e=a.eds.get(d.id))){if("Menu"!==e.constructor.name)throw Error("Menu.dispose("+b+") BUG: parent "+d.id+" not Menu");null!==(f=e.accelMap)&&f.get(c)===b&&f.delete(c)}this.menuAccel=null}eq.c.DlgElement.prototype.dispose.call(this,a,b)};
eq.c.Menu.prototype.updateId=function(a,b,c){var d=this.menuAccel;if(null!==d){var e=eq.Dom,f=document.getElementById(b),g,h;if(f&&(f=e.eqControl(f.parentNode))&&f.classList.contains("eq-menu")&&void 0!==(g=a.eds.get(f.id))){if("Menu"!==g.constructor.name)throw Error("Menu.dispose("+b+") BUG: parent "+f.id+" not Menu");null!==(h=g.accelMap)&&h.get(d)===c&&h.set(d,b)}}eq.c.DlgElement.prototype.updateId.call(this,a,b,c)};eq.c.Menu.addClass=function(a,b){this.subClass(a,b);eq.d.set(a,b);return b};
eq.c.Menu.openMenu=function(a,b){for(var c=b,d,e;(c=c.parentNode)&&c!==document;)if((d=c.classList)&&d.contains("eq-menubar")){d=b.classList;d.remove("eq-rtl");d.add("eq-ltr");d.add("eq-open");if(b=(c=b).lastElementChild)e=".eq-d"+a.id,(a=document.querySelector(".eq-dialog"+e))||(a=document.querySelector(".eq-window"+e+" .eq-dialog")),a&&(b=b.getBoundingClientRect(),a=a.getBoundingClientRect(),b.right>a.right&&(c=c.getBoundingClientRect(),c.right-b.width>=a.left&&(d.remove("eq-ltr"),d.add("eq-rtl"))));
break}};eq.c.Menu.closeContextMenu=function(a){var b=eq.app.currDlg;if(!b)throw Error("BUG: Menu.closeContextMenu no current dialog");b.removeElement(a)};
eq.c.Menu.prototype.setAttr=function(a,b,c,d){for(var e=eq.Dom,f=eq.RqTag,g,h=0,k=d.length;h<k;h++){var l=d[h];switch(l.t){case f.textPos:var n=c.classList,m=eq.TextPos,p;switch(this.textPos=l.v){case m.right:n.remove("eq-vert");n.add("eq-horz");var q=["IMG","SPAN"];break;case m.left:n.remove("eq-vert");n.add("eq-horz");q=["SPAN","IMG"];break;case m.bottom:n.remove("eq-horz");n.add("eq-vert");q=["IMG","SPAN"];break;case m.top:n.remove("eq-horz");n.add("eq-vert");q=["SPAN","IMG"];break;default:n.remove("eq-horz"),
n.remove("eq-vert")}(m=e.firstChildByTagName(c,"LABEL"))?l=(p=m.children).length:(m=document.createElement("LABEL"),m.className="eq-rt eq-fn",c.insertBefore(m,c.firstElementChild),l=0);if(q){if(2!==l||p[0].tagName!==q[0]||p[1].tagName!==q[1])l&&(m.textContent=""),m.appendChild(document.createElement(q[0])),m.appendChild(document.createElement(q[1]))}else l&&(m.textContent="");break;case f.text:if(m=e.firstChildByTagName(c,"LABEL")){for(var r=e.firstChildByTagName(m,"SPAN"),t=c,u;t=e.eqControl(t.parentNode);){if((n=
t.classList).contains("eq-menubar")){n.contains("eq-overlay")&&(t=null);break}n.contains("eq-menu")&&!u&&(u=t)}l=e.setContent(r||m,l.v,!0,!t);if(t)if(u){if(void 0===(n=a.eds.get(u.id)))throw Error("Menu.setAttr("+b+") text BUG: parent "+u.id+" not registered");if("Menu"!==n.constructor.name)throw Error("Menu.setAttr("+b+") text BUG: parent "+u.id+" not Menu");this.menuAccel=n.setMenuAccel(b,this.menuAccel,l)}else this.setAccel(a,b,l,eq.KeyMod.alt)}break;case f.icon:m=e.firstChildByTagName(c,"LABEL");
var v;m&&(v=e.firstChildByTagName(m,"IMG"))&&(v.src=l.v);break;case f.align:n=c.classList;l.v?n.contains("eq-right")||(n.add("eq-right"),r=document.createElement("LI"),r.className="eq-sep",c.parentNode.insertBefore(r,c)):n.contains("eq-right")&&(n.remove("eq-right"),c.parentNode.removeChild(c.previousElementSibling));break;default:g?g.push(l):g=[l]}}g&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,g)};
eq.c.Menu.prototype.setMenuAccel=function(a,b,c){c=null!==c?c.toUpperCase():null;if(c!==b){var d=this.accelMap;null===d&&(this.accelMap=d=new Map);null!==b&&d.get(b)===a&&d.delete(b);if(null===c||d.has(c))return null;d.set(c,a)}return c};
eq.c.Menu.prototype.onKey=function(a,b,c,d,e,f){if(!e)switch(d){case "Escape":case "Esc":var g,h;(g=c.parentNode)&&(h=g.classList)&&h.contains("eq-menubar")?eq.Dom.closeMenu():c.classList.remove("eq-open");return!0;default:if(1===d.length){b=this.accelMap;var k,l;if(null!==b&&(k=b.get(d.toUpperCase()))&&(c=document.getElementById(k))&&void 0!==(l=a.eds.get(k)))l.onAccel(a,k,c);return!0}}return!1};eq.c.Menu.prototype.onAccel=function(a,b,c){this.onChange(a,b,c,null)};
eq.c.Menu.prototype.onChange=function(a,b,c,d){var e=eq.app,f=eq.Dom;d=c.parentNode;var g,h=d&&(g=d.classList)&&g.contains("eq-menubar"),k=(g=c.classList).contains("eq-open");f.eqOverlay(c)&&(e.changed.delete(b),h=!1);if(h)f.closeMenu(),k||(this.constructor.openMenu(a,c),e.menuOpen=b,e.constructor.ttClose());else if(k)g.remove("eq-open");else{b=this.constructor;e=[c];for(var l;d;){if("UL"!==(l=(c=d).tagName)||"LI"!==l||(d=d.parentNode)&&(g=d.classList)&&g.contains("eq-menubar")){c=c.getElementsByClassName("eq-open");
for(g=c.length;0<=--g;)c[g].classList.remove("eq-open");break}(g=d.classList)&&g.contains("eq-menu")&&e.push(d)}for(g=e.length;0<=--g;)b.openMenu(a,e[g])}return!1};eq.p.pluginApiVersion=3;eq.c.DlgElement.subClass("DlgPlugin",function(a,b){eq.c.DlgElement.call(this,a,b);this.values=new Map;var c=this.constructor;(c=c.instanceMethods?this.apiInit:c.init)&&c.call(this,a,b)});eq.c.DlgPlugin.instanceMethods=!1;
eq.c.DlgPlugin.prototype.dispose=function(a,b){var c=this.constructor;c=c.instanceMethods?this.apiDispose:c.dispose;var d;null!==(d=this.values)&&(d.clear(),this.values=null);c&&c.call(this,a,b);eq.c.DlgElement.prototype.dispose.call(this,a,b)};eq.c.DlgPlugin.addClass=function(a,b){this.subClass(a,b);eq.d.set(a,b);return b};eq.c.DlgPlugin.prototype.intAttrChanged=function(a,b,c,d,e){eq.app.setChanged(a,b);this.values.set(void 0!==d&&null!==d?c+" "+d:c,{ty:eq.RsValType.plgInt,a:c,i:d,iv:e})};
eq.c.DlgPlugin.prototype.stringAttrChanged=function(a,b,c,d,e){eq.app.setChanged(a,b);this.values.set(void 0!==d&&null!==d?c+"["+d+"]":c,{ty:eq.RsValType.plgString,a:c,i:d,sv:e})};eq.c.DlgPlugin.prototype.binaryAttrChanged=function(a,b,c,d,e){eq.app.setChanged(a,b);this.values.set(void 0!==d&&null!==d?c+"["+d+"]":c,{ty:eq.RsValType.plgBinary,a:c,i:d,bv:e})};eq.c.DlgPlugin.prototype.submit=function(a,b,c,d){var e=eq.app;void 0!==d&&(e.onceRule=d,e.onceId=a);e.submit(b,{id:a,type:c})};
eq.c.DlgPlugin.prototype.setAttr=function(a,b,c,d){for(var e=eq.RqTag,f,g=0,h=d.length;g<h;g++){var k=d[g];switch(k.t){case e.plgInt:case e.plgString:case e.plgBinary:case e.font:var l=this.constructor;(l=l.instanceMethods?this.apiSetAttr:l.setAttr)&&l.call(this,a,b,c,k.a,k.i,k.v);break;default:f?f.push(k):f=[k]}}f&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,f)};
eq.c.DlgPlugin.prototype.setSensitive=function(a,b,c,d){var e=this.constructor;(e=e.instanceMethods?this.apiSetSensitive:e.setSensitive)&&e.call(this,a,b,c,d);eq.c.DlgElement.prototype.setSensitive.call(this,a,b,c,d)};eq.c.DlgPlugin.prototype.onEvent=function(a,b,c,d){var e=this.constructor;return(e=e.instanceMethods?this.apiOnEvent:e.onEvent)?e.call(this,a,b,c,d):!0};
eq.c.DlgPlugin.prototype.onKey=function(a,b,c,d,e,f){d=this.constructor;d=d.instanceMethods?this.apiOnKey:d.onKey;var g;return d&&!1!==(g=d.call(this,a,b,c,f))?(g&&eq.Dom.consumeEvent(f),!0):!1};eq.c.DlgPlugin.prototype.onTypeAhead=function(a,b,c,d){var e=this.constructor;return(e=e.instanceMethods?this.apiOnTypeAhead:e.onTypeAhead)&&e.call(this,a,b,c,d)?!0:eq.c.DlgElement.prototype.onTypeAhead.call(this,a,b,c,d)};
eq.c.DlgPlugin.prototype.onSubmit=function(a,b,c,d){var e=this.constructor;(e=e.instanceMethods?this.apiOnSubmit:e.onSubmit)&&e.call(this,a,b,c,d)};eq.c.DlgPlugin.prototype.onChange=function(a,b,c,d){var e=this.constructor;return(e=e.instanceMethods?this.apiOnChange:e.onChange)?e.call(this,a,b,c,d):!0};eq.c.DlgPlugin.prototype.focusElement=function(a,b){var c=this.constructor;return(c=c.instanceMethods?this.apiFocusElement:c.focusElement)?c.call(this,a,b):b};
eq.c.DlgPlugin.prototype.focusGained=function(a,b){var c=this.constructor;if(c=c.instanceMethods?this.apiFocusGained:c.focusGained)return c.call(this,a,b)};eq.c.DlgPlugin.prototype.focusLost=function(a,b){var c=this.constructor;if(c=c.instanceMethods?this.apiFocusLost:c.focusLost)return c.call(this,a,b)};
eq.c.DlgPlugin.prototype.changed=function(a,b,c,d){var e=this.constructor;e=e.instanceMethods?this.apiChanged:e.changed;var f=[];e&&e.call(this,a,b,c,d);this.values.forEach(eq.c.DlgPlugin.cbChanged,f);this.values.clear();switch(f.length){case 0:return null;case 1:return f[0].id=b,f[0];default:return{id:b,v:f}}};eq.c.DlgPlugin.cbChanged=function(a){this.push(a)};
eq.c.DlgPlugin.prototype.onUpdate=function(a,b,c,d,e,f){var g=this.constructor,h=eq.UpdateTag;if(0>e||e>=g.atr.length)throw Error(g.name+".onUpdate("+b+") failed: attribute index "+e+" out of range");switch(d){case h.plgUpdate:var k=g.instanceMethods?this.apiOnUpdate:g.onUpdate;k&&k.call(this,a,b,c,g.atr[e][0],f);break;case h.plgGetVal:if((d=g.instanceMethods?this.apiGetAttr:g.getAttr)&&void 0!==(k=d.call(this,a,b,c,g.atr[e][0],f)))return null===k?null:k instanceof Uint8Array?{b:k}:"number"===typeof k?
{i:k}:{s:k};break;default:throw Error(g.name+".onUpdate("+b+") failed: tag "+d);}};eq.c.DlgPlugin.prototype.onUpdateReturn=function(a,b,c){if(void 0===c)c=void 0;else{if(null===c)throw Error("BUG: "+this.constructor.name+".onUpdate("+b+") null value");c=c instanceof Uint8Array?{b:c}:"number"===typeof c?{i:c}:{s:c}}eq.c.DlgElement.prototype.onUpdateReturn.call(this,a,b,c)};eq.plugin.install=function(){var a=this.m,b=[];void 0!==a&&(a.forEach(this.cb,b),a.clear());return b};
eq.plugin.cb=function(a,b){var c=a.prp.minVersion;if(void 0!==c&&c>eq.p.pluginApiVersion)console.error("Insufficient API version "+eq.p.pluginApiVersion+" for plugin '"+b+"', expected: "+c+" or newer");else if(!("plg"+b in eq.c)){var d={n:b},e=eq.c.DlgPlugin.addClass("plg"+b,function(m,p){eq.c.DlgPlugin.call(this,m,p)}),f,g;delete e.subClass;if(f=1<=c){e.instanceMethods=!0;var h=e.prototype}for(var k in a)switch(k){case "atr":d.a=e.atr=a.atr;break;case "prp":d.p=a.prp;break;case "static":var l=a.static,
n;for(n in l)n in e&&console.warn("Plugin '"+b+"' overrides static method: "+n),e[n]=l[n];break;default:f?(k in h&&console.warn("Plugin '"+b+"' overrides instance method: "+k),h[k]=a[k]):(k in e&&console.warn("Plugin '"+b+"' overrides method: "+k),e[k]=a[k])}if(void 0===c)for(a=d.a,b=0,c=a.length;b<c;b++)a[b][1]|=eq.atrPRI;this.push(d);(g=e.install)&&g.call(e)}};eq.c.DlgElement.addClass("PopText",function(a,b){eq.c.DlgElement.call(this,a,b)});delete eq.c.PopText.subClass;
eq.c.PopText.line=function(a,b){for(var c,d;a&&(c=a.parentNode);){if(d=c.classList){if(d.contains("eq-column"))return void 0!==b&&(b.c=c),a;if(d.contains("eq-poptext")){void 0!==b&&(b.ct=c);break}}a=a.parentNode}};
eq.c.PopText.select=function(a,b,c){void 0===b&&((b=a.querySelector(".eq-poptext>.eq-column"))||(b=document.body.querySelector("body>.eq-poptext.eq-column")));a=b.querySelectorAll(".eq-column>.eq-selected");for(var d=0,e=a.length;d<e;d++)a[d].classList.remove("eq-selected");c&&b===c.parentNode&&(c.classList.add("eq-selected"),1<b.children.length&&this.scrollIntoView(c,{cb:this.scrollIntoView}))};
eq.c.PopText.scrollIntoView=function(a,b){var c=a.parentNode,d=c.children,e,f;if(1<d.length)if(eq.app.idle||0>=(e=c.getBoundingClientRect().height)||0>=(f=d[0].getBoundingClientRect().height))eq.Dom.onNextFrame(a,b);else b=c.scrollTop,a=a.offsetTop,a<b?c.scrollTop=a:a+f>b+e&&(c.scrollTop=Math.ceil(a+f-e+2))};
eq.c.PopText.open=function(a,b){var c=a.classList;if(!c.contains("eq-open")){void 0===b&&(b=a.querySelector(".eq-poptext>.eq-column"));var d=eq.c.PopText,e=a.firstElementChild,f=e.textContent,g=a.getBoundingClientRect(),h=b.style,k=b.classList,l;if(f.length)for(var n=b.children,m=0,p=n.length;m<p;m++)if(f===n[m].textContent){var q=n[m];break}h.left=g.left+window.pageXOffset+"px";h.top=g.bottom+window.pageYOffset+"px";(l=h.maxWidth)?h.width=l:h.width=g.width+"px";eq.Dom.copyFont(b,e);eq.Dom.copyColors(b,
a);k.add("eq-poptext");c.contains("eq-border")?k.add("eq-border"):k.remove("eq-border");eq.app.makeOverlay(a,b,d.close);c.add("eq-open");c.add("eq-enter");(e=b.getBoundingClientRect()).bottom>window.pageYOffset+document.documentElement.clientHeight?(h.top=g.top+window.pageYOffset-e.height+"px",c.remove("eq-dn"),k.remove("eq-dn"),c.add("eq-up"),k.add("eq-up")):(c.remove("eq-up"),k.remove("eq-up"),c.add("eq-dn"),k.add("eq-dn"));d.select(a,b,q)}};
eq.c.PopText.close=function(a,b,c){var d=a.classList,e=b.classList,f;if(!d.contains("eq-open"))throw Error("PopText.close BUG: not open, id:"+a.id);a.appendChild(b);e.remove("eq-poptext");e.remove("eq-border");d.remove("eq-open");d.remove("eq-enter");c&&(f=b.querySelector(".eq-column>.eq-selected"))&&(b=eq.Dom,b.copyContent(a.firstElementChild,f),b.fireEvent(a,"input"))};
eq.c.PopText.move=function(a,b){var c=b.c;if(c){var d=eq.c.PopText,e=b.el,f={};a=d.line(a.target,f);e!==f.ct&&(d.select(e,c,a),a&&(b.close=b.commit=!0))}};eq.c.PopText.move.done=function(a){a.close&&eq.app.closeOverlay(a.el,a.commit);a=a.a;void 0!==a&&a.classList.remove("eq-click");return!0};
eq.c.PopText.prototype.setAttr=function(a,b,c,d){for(var e=eq.Dom,f=eq.RqTag,g,h=0,k=d.length;h<k;h++){var l=d[h];switch(l.t){case f.content:var n=l.v;l=n.length;var m=c.classList,p;l?m.remove("eq-empty"):m.add("eq-empty");if(m.contains("eq-open")){if(m=document.body.querySelector("body>.eq-poptext.eq-column"),!m)throw Error("PopText.setAttr BUG: open, no column");}else c.querySelector(".eq-poptext>.eq-button")||(m=document.createElement("DIV"),m.className="eq-rt eq-button",c.appendChild(m)),(m=c.querySelector(".eq-poptext>.eq-column"))||
(m=document.createElement("DIV"),m.className="eq-rt eq-column",c.appendChild(m));if(l)var q=(p=m.children).length;else m.textContent="",p=m.children,q=0;for(var r=0;r<l;r++){if(r<q)var t=p[r];else t=document.createElement("DIV"),m.appendChild(t);e.setContent(t,n[r])}for(;p.length>l;)m.removeChild(m.lastElementChild);e.copyContent(c.firstElementChild,m.querySelector(".eq-selected"));break;case f.activeLine:m=c.querySelector(".eq-poptext>.eq-column");p=m.children;n=l.v;var u;0<n&&n<=p.length&&(u=p[n-
1]);e.copyContent(c.firstElementChild,u);break;case f.boxSize:n=l.w;l=l.h;m=c.classList.contains("eq-open")?document.body.querySelector("body>.eq-poptext.eq-column"):c.querySelector(".eq-poptext>.eq-column");if(!m)throw Error("PopText.setAttr BUG: boxSize, no column");(m=m.style).maxWidth=n?n:"";m.maxHeight=l?l:"";break;default:g?g.push(l):g=[l]}}g&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,g)};
eq.c.PopText.prototype.onKey=function(a,b,c,d,e,f){if(e)return!1;a=this.constructor;b=eq.Dom;e=c.querySelector(".eq-poptext>.eq-column");switch(d){case "Enter":return!e&&(eq.app.closeOverlay(c,!0),c.classList.contains("eq-noenter"))?(b.consumeEvent(f),!0):!1;case "Escape":case "Esc":return e||eq.app.closeOverlay(c,!1),b.consumeEvent(f),!0;case "PageUp":case "PageDown":case "ArrowUp":case "Up":case "ArrowDown":case "Down":if(e){a.open(c,e);var g=0}break;default:return!1}var h;if((e=document.body.querySelector("body>.eq-poptext.eq-column"))&&
(h=e.children).length){if(void 0===g)switch(d){case "PageUp":var k=h[0];break;case "PageDown":k=h[h.length-1];break;case "ArrowUp":case "Up":g=-1;break;case "ArrowDown":case "Down":g=1}void 0!==g&&((k=e.querySelector(".eq-column>.eq-selected"))?(d=eq.Dom.parentIndex(k),k=h.length,-1===(d+=g)?d=0:d>=k&&(d=k-1),k=h[d]):k=h[0]);void 0!==k&&a.select(c,e,k)}b.consumeEvent(f);return!0};
eq.c.PopText.prototype.onChange=function(a,b,c,d){if("mousedown"===d.type){a=this.constructor;var e=eq.app,f=eq.Dom,g=d.target,h=g&&g.classList.contains("eq-button");if(!h&&(h=c===f.eqControl(g)&&(g=c.querySelector(".eq-poptext>.eq-button")),c.classList.contains("eq-open"))){b={el:c};h={};var k=a.line(g,h);h.c?(a.select(c,b.c=h.c,k),b.close=b.commit=!0):c===h.ct&&(b.a=g,b.close=!0,g.classList.add("eq-click"));e.moveCapture(b,a.move,a.move.done);return c!==h.ct?(f.consumeEvent(d),!1):!0}if(h){h=c.classList;
if(h.contains("eq-disabled")||h.contains("eq-empty"))return!1;if(h.contains("eq-focus")&&e.setFocus(b,c))return e.pendingFocus={id:b,act:a.open},!1;h=c.querySelector(".eq-poptext>.eq-column");b={el:c,a:g};g.classList.add("eq-click");h?a.open(c,b.c=h):b.close=!0;e.moveCapture(b,a.move,a.move.done);f.consumeEvent(d);return!1}}return!0};eq.c.PopText.prototype.focusLost=function(a,b){b.classList.contains("eq-open")&&eq.app.closeOverlay(b)};
eq.c.PopText.prototype.changed=function(a,b,c,d){a=0;for(var e=d.length;a<e;a++)if("input"===d[a])return c=c.querySelector(".eq-poptext>.eq-column>.eq-selected"),{id:b,ty:eq.RsValType.activeLine,iv:c?eq.Dom.parentIndex(c)+1:0};return null};eq.c.DlgElement.addClass("ProgressBar",function(a,b){eq.c.DlgElement.call(this,a,b)});delete eq.c.ProgressBar.subClass;
eq.c.ProgressBar.prototype.setAttr=function(a,b,c,d){for(var e=eq.RqTag,f,g=0,h=d.length;g<h;g++){var k=d[g];switch(k.t){case e.vertical:if(!c.firstElementChild){var l=document.createElement("DIV"),n=document.createElement("SPAN"),m=document.createElement("SPAN");n.className=m.className="eq-fn";l.appendChild(m);c.appendChild(n);c.appendChild(l)}n=c.classList;k.v?(n.remove("eq-horz"),n.add("eq-vert")):(n.remove("eq-vert"),n.add("eq-horz"));break;case e.value:n=c.classList;l=c.querySelector(".eq-progressbar>div");
(k=k.v)?(n.remove("eq-noval"),n.add("eq-val"),n.contains("eq-horz")?l.style.width=k:l.style.height=k):(n.remove("eq-val"),n.add("eq-noval"),l.style.width="");break;case e.text:l=eq.Dom;n=c.getElementsByTagName("SPAN");l.setContent(n[0],k.v);l.setContent(n[1],k.v);break;default:f?f.push(k):f=[k]}}f&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,f)};eq.c.DlgElement.addClass("PushButton",function(a,b){eq.c.DlgElement.call(this,a,b)});delete eq.c.PushButton.subClass;
eq.c.PushButton.prototype.setSensitive=function(a,b,c,d){var e=c.getElementsByTagName("BUTTON");if(1!==e.length)throw Error("BUG: PushButton.setSensitive id:"+c.id+" elements:"+e.length+", expected: 1");e[0].disabled=!d;eq.c.DlgElement.prototype.setSensitive.call(this,a,b,c,d)};eq.c.PushButton.prototype.onKey=function(a,b,c,d,e,f){if(e)return!1;a=eq.Dom;return(d=a.isEnterOrSpace(d))&&(10!==d||c.classList.contains("eq-noenter"))?(a.fireClick(c,{key:d}),a.consumeEvent(f),!0):!1};
eq.c.PushButton.prototype.onTypeAhead=function(a,b,c,d){var e;switch(d){case "Enter":case "ShiftEnter":c.classList.contains("eq-noenter")&&(e=10);break;case " ":e=32}return void 0!==e?(eq.Dom.fireClick(c,{key:e}),!0):eq.c.DlgElement.prototype.onTypeAhead.call(this,a,b,c,d)};eq.c.PushButton.prototype.focusElement=function(a,b){a=b.getElementsByTagName("BUTTON");if(1!==a.length)throw Error("BUG: PushButton.focusElement id:"+b.id+" elements:"+a.length+", expected: 1");return a[0]};
eq.c.DlgElement.addClass("RadioButton",function(a,b){eq.c.DlgElement.call(this,a,b)});delete eq.c.RadioButton.subClass;eq.c.RadioButton.prototype.setSensitive=function(a,b,c,d){eq.Dom.inputElement(c).disabled=!d;eq.c.DlgElement.prototype.setSensitive.call(this,a,b,c,d)};eq.c.RadioButton.prototype.onEvent=function(a,b,c,d){return!eq.Dom.inputElement(c).checked};
eq.c.RadioButton.prototype.onKey=function(a,b,c,d,e,f){if(e)return!1;a=eq.Dom;if(b=a.isEnterOrSpace(d))return 10!==b||c.classList.contains("eq-noenter")?(a.fireClick(a.inputElement(c),{key:b}),a.consumeEvent(f),!0):!1;e=f.target;var g=c.parentNode.querySelectorAll('input[name="'+e.name+'"]'),h=0;if(g.length){switch(d){case "Home":c=g[0];b=36;break;case "End":c=g[g.length-1];b=35;break;case "PageUp":h=-1;b=33;break;case "PageDown":h=1;b=34;break;default:return!1}if(0!==h){c=null;d=0;for(var k=g.length;d<
k;d++)if(e===g[d]){-1===(d+=h)?d=k-1:d>=k&&(d=0);c=g[d];break}}if(null!==c)return a.fireClick(c,{key:b}),a.consumeEvent(f),!0}return!1};eq.c.RadioButton.prototype.onTypeAhead=function(a,b,c,d){var e;switch(d){case "Enter":case "ShiftEnter":c.classList.contains("eq-noenter")&&(e=10);break;case " ":e=32}return void 0!==e?(a=eq.Dom,a.fireClick(a.inputElement(c),{key:e}),!0):eq.c.DlgElement.prototype.onTypeAhead.call(this,a,b,c,d)};
eq.c.RadioButton.prototype.onSubmit=function(a,b,c,d){a=eq.app;a.changed.has(b)||a.changed.set(b,"input")};eq.c.RadioButton.prototype.focusElement=function(a,b){return eq.Dom.inputElement(b)};eq.c.RadioButton.prototype.changed=function(a,b,c,d){return c.checked?{id:b,ty:eq.RsValType.buttonChecked,iv:1}:null};eq.c.DlgElement.addClass("Splitter",function(a,b){eq.c.DlgElement.call(this,a,b);this.panes=[];this.lastPos=null});delete eq.c.Splitter.subClass;
eq.c.Splitter.prototype.dispose=function(a,b){var c;null!==(c=this.panes)&&(c.length=0,this.panes=null);eq.c.DlgElement.prototype.dispose.call(this,a,b)};eq.c.Splitter.move=function(a,b){b.busy||(b.busy=!0,eq.Dom.onNextFrame(b.el,{cb:eq.c.Splitter.move.exec,x:a.clientX,y:a.clientY,m:b}))};
eq.c.Splitter.move.exec=function(a,b){a=b.x;var c=b.y;b=b.m;var d=b.pa,e=d.getBoundingClientRect(),f;void 0!==b.x?2<Math.abs(f=a-b.x)&&(c=e.width+f,0<=c&&(d.style.width=c+"px",d.getBoundingClientRect().width!==e.width&&(b.x=a,b.modified=!0))):2<Math.abs(f=c-b.y)&&(a=e.height+f,0<=a&&(d.style.height=a+"px",d.getBoundingClientRect().height!==e.height&&(b.y=c,b.modified=!0)));b.busy=void 0};
eq.c.Splitter.move.done=function(a,b){var c=a.el,d=c.classList,e;if(a.modified)(e=eq.app).setChanged(a=a.id,"change"),d.contains("eq-rule")&&e.submit(c,{id:a,type:"change"});else if(void 0!==b&&d.contains("eq-quick")){e=!1;var f=a.pa,g=f.style;if(void 0!==a.x){var h=g.width;"0%"===h||"100%"===h?null!==(b=a.self).lastPos&&(g.width=b.lastPos+"px",b.lastPos=null,e=!0):64<=(f=f.getBoundingClientRect()).height&&(b=b.clientY,b<=f.top+28&&b>=f.top?((b=a.self).lastPos=f.width,g.width="0%",e=!0):b>=f.bottom-
28&&b<=f.bottom&&((b=a.self).lastPos=f.width,g.width="100%",e=!0))}else h=g.height,"0%"===h||"100%"===h?null!==(b=a.self).lastPos&&(g.height=b.lastPos+"px",b.lastPos=null,e=!0):64<=(f=f.getBoundingClientRect()).width&&(b=b.clientX,b<=f.left+28&&b>=f.left?((b=a.self).lastPos=f.height,g.height="0%",e=!0):b>=f.right-28&&b<=f.right&&((b=a.self).lastPos=f.height,g.height="100%",e=!0));e&&((e=eq.app).setChanged(a=a.id,"change"),d.contains("eq-rule")&&e.submit(c,{id:a,type:"change"}))}return!0};
eq.c.Splitter.prototype.setAttr=function(a,b,c,d){for(var e=eq.RqTag,f,g=0,h=d.length;g<h;g++){var k=d[g];switch(k.t){case e.panes:var l=this.panes,n=c.querySelector("#"+b+">.eq-pane");if(n){k=n.querySelectorAll("#"+b+">.eq-pane>*>:only-child");for(var m=0,p=k.length;m<p;m++){n.removeChild(k[m].parentNode);var q=!0}q&&(l.length=0);k=n.querySelectorAll("#"+b+">.eq-pane>*>:first-child");m=0;for(p=k.length;m<p;m++){var r=k[m];r.classList.contains("eq-hidden")&&(n.removeChild(r.parentNode),c.appendChild(r));
q&&l.push(r.id)}}else n=document.createElement("DIV"),n.className="eq-rt eq-pane",c.appendChild(n);k=c.querySelectorAll("#"+b+">:not(.eq-pane)");m=0;for(p=k.length;m<p;m++)if(r=k[m],!r.classList.contains("eq-hidden")){var t=document.createElement("DIV"),u=document.createElement("DIV"),v=l.indexOf(r.id);n.insertBefore(t,0===v?n.firstElementChild:null);t.appendChild(r);u.className="eq-caption";t.appendChild(u);-1===v&&l.push(r.id)}break;case e.position:l=k.v;k=c.querySelectorAll("#"+b+">.eq-pane>*");
0<=l&&2===k.length?(k=(n=k[0]).style,c.classList.contains("eq-vert")?(m=n.parentNode.getBoundingClientRect().height,k.width="",0==l?(0<m?(l=n.getBoundingClientRect().height,this.lastPos=0<l?l:m/2):this.lastPos=null,k.height="0%"):0<m&&l>=m?(l=n.getBoundingClientRect().height,this.lastPos=0<l?l:m/2,k.height="100%"):(this.lastPos=null,k.height=l+"px")):(m=n.parentNode.getBoundingClientRect().width,k.height="",0==l?(0<m?(l=n.getBoundingClientRect().width,this.lastPos=0<l?l:m/2):this.lastPos=null,k.width=
"0%"):0<m&&l>=m?(l=n.getBoundingClientRect().width,this.lastPos=0<l?l:m/2,k.width="100%"):(this.lastPos=null,k.width=l+"px"))):k.length&&(k=k[0].style,k.width=k.height="");break;default:f?f.push(k):f=[k]}}f&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,f)};
eq.c.Splitter.prototype.onChange=function(a,b,c,d){var e=d.target;e&&e.classList.contains("eq-caption")&&(a=this.constructor,b={self:this,id:b,el:c,pa:e.parentNode},c.classList.contains("eq-vert")?b.y=d.clientY:b.x=d.clientX,eq.app.moveCapture(b,a.move,a.move.done),d.stopPropagation());return!1};
eq.c.Splitter.prototype.changed=function(a,b,c,d){return-1!==d.indexOf("change")&&(a=c.querySelectorAll("#"+b+">.eq-pane>*"),2===a.length)?(a=a[0].getBoundingClientRect(),{id:b,ty:eq.RsValType.splitterPos,iv:c.classList.contains("eq-vert")?a.height:a.width}):null};eq.c.DlgElement.addClass("StaticText",function(a,b){eq.c.DlgElement.call(this,a,b)});delete eq.c.StaticText.subClass;
eq.c.StaticText.prototype.onAccel=function(a,b,c){for(;c=c.nextElementSibling;)if(!(a=c.classList).contains("eq-disabled")&&(a=a.contains("eq-focus")?c:c.querySelector(".eq-focus:not(.eq-disabled)"))){eq.app.setFocus(a.id,a);break}};eq.c.DlgElement.addClass("StatusBar",function(a,b){eq.c.DlgElement.call(this,a,b);this.globalDropRule=this.dropRule=0});delete eq.c.StatusBar.subClass;
eq.c.StatusBar.prototype.setAttr=function(a,b,c,d){for(var e=eq.RqTag,f,g=a.constructor,h=0,k=d.length;h<k;h++){var l=d[h];switch(l.t){case e.dropRule:(this.dropRule=l.i)||this.globalDropRule?(c.ondragover=g.onDragOver,c.ondrop=g.onDrop):(c.ondragover=null,c.ondrop=null);break;case e.globalDropRule:(this.globalDropRule=l.i)||this.dropRule?(c.ondragover=g.onDragOver,c.ondrop=g.onDrop):(c.ondragover=null,c.ondrop=null);break;default:f?f.push(l):f=[l]}}f&&eq.c.DlgElement.prototype.setAttr.call(this,
a,b,c,f)};eq.c.StatusBar.prototype.onDrop=function(a,b,c,d,e){return e.drag?this.dropRule:this.globalDropRule};eq.c.DlgElement.addClass("TabBox",function(a,b){eq.c.DlgElement.call(this,a,b);this.ttTabs=null});delete eq.c.TabBox.subClass;eq.c.TabBox.prototype.dispose=function(a,b){var c;null!==(c=this.ttTabs)&&(c.length=0,this.ttTabs=null);eq.c.DlgElement.prototype.dispose.call(this,a,b)};
eq.c.TabBox.select=function(a,b,c,d){var e,f;if(c)if((e=c.parentNode)&&(f=e.classList)&&f.contains("eq-tabs")&&(f=c.classList)){if(f.contains("eq-selected")||f.contains("eq-hidden")||!d&&f.contains("eq-disabled"))return null}else e=void 0;a=b.children;e=void 0===e?-1:eq.Dom.parentIndex(c);b=null;d=0;for(var g=a.length;d<g;d++)for(var h=a[d].children,k=0,l=h.length;k<l;k++)f=(c=h[k]).classList,k!==e||f.contains("eq-hidden")?f.remove("eq-selected"):(f.add("eq-selected"),b=c);return b};
eq.c.TabBox.prototype.setAttr=function(a,b,c,d){for(var e=this.constructor,f=eq.app,g=eq.Dom,h=eq.RqTag,k,l=0,n=d.length;l<n;l++){var m=d[l];switch(m.t){case h.tabs:var p=eq.c.DlgElement,q=eq.TabState;m=m.v;var r=c.firstElementChild,t=[],u,v,y,w,B;if(!r||!r.classList.contains("eq-tabs")){var x=document.createElement("DIV");x.className="eq-rt eq-tabs";r=c.insertBefore(x,r)}null!==(u=this.ttTabs)&&(u.length=0);(v=m.length)?(this.ttTabs=u=[],u.length=v):this.ttTabs=u=null;if(v)var E=(y=r.children).length;
else r.textContent="",y=r.children,E=0;t.length=v;for(var z=0;z<v;z++){z<E?x=y[z]:(x=document.createElement("DIV"),x.className="eq-fn",r.appendChild(x));var A=x.classList;if((w=(B=m[z]).s)&q.visible){A.remove("eq-hidden");w&q.sensitive?A.remove("eq-disabled"):A.add("eq-disabled");(u[z]=B.tt)?f.ttAttach(x):f.ttDetach(x);p.setFont(x,B.f);if(A=B.i){x.textContent="";w=document.createElement("IMG");var C=document.createElement("SPAN");w.src=A;x.appendChild(w);x=x.appendChild(C)}t[z]=g.setContent(x,B.t||
" ",!0)}else A.add("eq-hidden"),f.ttDetach(x),u[z]=t[z]=null}for(;y.length>v;)r.removeChild(r.lastElementChild);e.select(a,c,null,!1);if(v)g.onNextCycle(e.setTabAccel,{dlg:a,el:c,ac:t});break;case h.selectedTab:(m=m.v)&&m<=(y=c.firstElementChild.children).length&&(x=y[m-1]);e.select(a,c,x,!0);break;default:k?k.push(m):k=[m]}}k&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,k)};
eq.c.TabBox.setTabAccel=function(a){var b=a.dlg,c=b.eds,d=a.el;a=a.ac;for(var e=d.lastElementChild.children,f,g,h=0,k=e.length;h<k;h++){if(void 0===(g=c.get(f=e[h].id)))throw Error("TabBox.setTabAccel("+d.id+") BUG: child "+f+" not registered");g.setAccel(b,f,a[h],eq.KeyMod.alt)}};
eq.c.TabBox.prototype.onEvent=function(a,b,c,d){a=d.target;for(var e,f;a&&(!(e=a.classList)||!e.contains("eq-tabbox"));){if((f=a.parentNode)&&(e=f.classList)&&e.contains("eq-tabs"))return c.classList.contains("eq-rule")||c.lastElementChild.children[eq.Dom.parentIndex(a)].classList.contains("eq-rule");a=f}return!1};
eq.c.TabBox.prototype.onKey=function(a,b,c,d,e,f){if(e)return!1;a=c.parentNode.querySelectorAll(".eq-tabs > :not(.eq-hidden):not(.eq-disabled)");b=0;if(a.length){switch(d){case "Home":c=a[0];d=36;break;case "End":c=a[a.length-1];d=35;break;case "PageUp":b=-1;d=33;break;case "PageDown":b=1;d=34;break;default:return!1}if(0!==b){c=null;e=0;for(var g=a.length;e<g;e++)if(a[e].classList.contains("eq-selected")){-1===(e+=b)?e=g-1:e>=g&&(e=0);c=a[e];break}}if(null!==c)return a=eq.Dom,a.fireClick(c,{key:d}),
a.consumeEvent(f),!0}return!1};eq.c.TabBox.prototype.onTabAccel=function(a,b){for(var c=a.lastElementChild.children,d=0,e=c.length;d<e;d++)if(b===c[d]){a=(b=a.firstElementChild.children[d]).classList;a.contains("eq-hidden")||a.contains("eq-disabled")||(eq.Dom.fireClick(b),b.classList.add("eq-flash"),window.setTimeout(this.constructor.flashTab,100,b));break}};eq.c.TabBox.flashTab=function(a){a.classList.remove("eq-flash")};
eq.c.TabBox.prototype.onSubmit=function(a,b,c,d){a=c.lastElementChild.children;for(var e=0,f=a.length;e<f;e++)if((c=(b=a[e]).classList).contains("eq-selected")){c.contains("eq-rule")&&(d.id=b.id);break}};
eq.c.TabBox.prototype.onChange=function(a,b,c,d){if("mousedown"===d.type){var e=eq.Dom;d=d.target;for(var f,g;d&&(!(f=d.classList)||!f.contains("eq-tabbox"));){if((g=d.parentNode)&&(f=g.classList)&&f.contains("eq-tabs")){if(f=this.constructor.select(a,c,d,!1)){if(f.classList.contains("eq-rule")||c.classList.contains("eq-rule"))return void 0===this.a&&a.updateControl(b,c,{ev:{a:["mousedown"]}}),!0;void 0!==this.a&&a.updateControl(b,c,{ev:{a:null}});eq.app.apiUpdate(b,eq.UpdateTag.tabOrder,e.parentIndex(d))}break}d=
g}}return!1};eq.c.TabBox.prototype.onToolTip=function(a){for(var b,c,d;a&&(!(b=a.classList)||!b.contains("eq-tabbox"));){if((c=a.parentNode)&&(b=c.classList)&&b.contains("eq-tabs")){if(null!==(b=this.ttTabs)&&(a=eq.Dom.parentIndex(a),a<b.length&&(d=b[a])))return d;break}a=c}return null};
eq.c.TabBox.prototype.changed=function(a,b,c,d){return(c=c.firstElementChild)&&c.classList.contains("eq-tabs")&&(c=c.querySelector(".eq-tabs>.eq-selected"))?{id:b,ty:eq.RsValType.selectedTab,iv:eq.Dom.parentIndex(c)}:null};eq.c.TabBox.prototype.updated=function(a,b,c,d,e){var f=eq.UpdateTag;switch(d){case f.tabOrder:a.tabOrder=e;break;default:eq.c.DlgElement.prototype.updated.call(this,a,b,c,d,e)}};
eq.c.DlgElement.addClass("ToolBar",function(a,b){eq.c.DlgElement.call(this,a,b);this.globalDropRule=this.dropRule=0});delete eq.c.ToolBar.subClass;
eq.c.ToolBar.prototype.setAttr=function(a,b,c,d){for(var e=eq.RqTag,f,g=a.constructor,h=0,k=d.length;h<k;h++){var l=d[h];switch(l.t){case e.dropRule:(this.dropRule=l.i)||this.globalDropRule?(c.ondragover=g.onDragOver,c.ondrop=g.onDrop):(c.ondragover=null,c.ondrop=null);break;case e.globalDropRule:(this.globalDropRule=l.i)||this.dropRule?(c.ondragover=g.onDragOver,c.ondrop=g.onDrop):(c.ondragover=null,c.ondrop=null);break;default:f?f.push(l):f=[l]}}f&&eq.c.DlgElement.prototype.setAttr.call(this,a,
b,c,f)};eq.c.ToolBar.prototype.onDrop=function(a,b,c,d,e){return e.drag?this.dropRule:this.globalDropRule};eq.c.DlgElement.addClass("Tree",function(a,b){eq.c.DlgElement.call(this,a,b);this.emptyNode=0;this.dnd=null;this.globalDropRule=this.dropRule=this.dndMode=0});delete eq.c.Tree.subClass;eq.c.Tree.itemFlags={node:1,open:2,auto:4};eq.c.Tree.prototype.dispose=function(a,b){this.dnd=null;eq.c.DlgElement.prototype.dispose.call(this,a,b)};
eq.c.Tree.select=function(a,b){var c;if(void 0!==b){var d=a.querySelectorAll(".eq-tree .eq-item");if(0<=b&&b<d.length)var e=(c=d[b]).classList}if(c){d=c;for(var f;(d=d.parentNode)&&(f=d.classList)&&!f.contains("eq-tree");)f.contains("eq-node")&&f.add("eq-open");this.scrollIntoView(a,{cb:this.scrollIntoView,ti:c})}d=a.querySelectorAll(".eq-tree .eq-selected");a=0;for(f=d.length;a<f;a++)d[a].classList.remove("eq-selected");return c?(e.add("eq-selected"),!0):!1};
eq.c.Tree.scrollIntoView=function(a,b){var c=b.ti,d,e;if(eq.app.idle||0>=(d=a.getBoundingClientRect().height)||0>=(e=c.querySelector(".eq-item>span").getBoundingClientRect().height))eq.Dom.onNextFrame(a,b);else b=a.scrollTop,c=c.offsetTop,c<b?a.scrollTop=Math.floor(c-e/2):c+e>b+d&&(a.scrollTop=Math.ceil(c+1.5*e-d))};eq.c.Tree.selectedIndex=function(a,b){void 0===b&&(b=a.querySelector(".eq-tree .eq-selected"));if(b){a=a.querySelectorAll(".eq-tree .eq-item");for(var c=0,d=a.length;c<d;c++)if(b===a[c])return c}return-1};
eq.c.Tree.itemIndex=function(a,b){a=a.querySelectorAll(".eq-tree .eq-item");for(var c=0,d=a.length;c<d;c++)if(b===a[c])return c;return-1};eq.c.Tree.itemExpanded=function(a){for(var b;a&&(!(b=a.classList)||!b.contains("eq-tree"));){if(b&&(b.contains("eq-node")||b.contains("eq-leaf"))){for(;(a=a.parentNode)&&(b=a.classList)&&!b.contains("eq-tree");)if(b.contains("eq-node")&&!b.contains("eq-open"))return!1;return!0}a=a.parentNode}return!1};
eq.c.Tree.moveDone=function(a){a.ti.classList.remove("eq-click");eq.app.setChanged(a.id,"status");return!0};
eq.c.Tree.prototype.setAttr=function(a,b,c,d){for(var e=this.constructor,f=eq.RqTag,g,h=0,k=d.length;h<k;h++){var l=d[h];switch(l.t){case f.content:this.setContent(c.querySelector(".eq-tree>.eq-pane"),l.v);break;case f.activeLine:var n=l.v;0<n?e.select(c,n-1):e.select(c);break;case f.status:var m=c.querySelectorAll(".eq-tree .eq-node");n=l.v;var p=0,q=n.length;l=0;for(var r=m.length;l<r;l++){var t=m[l].classList;p<q&&l===n[p]&&!t.contains("eq-empty")?(t.add("eq-open"),p++):t.remove("eq-open")}break;
case f.dndMode:m=c.querySelectorAll(".eq-tree .eq-item>span");if(this.dndMode=l.i)for(n=a.constructor.onDragStart,l=0,r=m.length;l<r;l++)(p=m[l]).draggable=!0,p.ondragstart=n;else for(l=0,r=m.length;l<r;l++)(p=m[l]).draggable=!1,p.ondragstart=null;break;case f.dropRule:(this.dropRule=l.i)||this.globalDropRule?(m=a.constructor,c.ondragover=m.onDragOver,c.ondrop=m.onDrop):(c.ondragover=null,c.ondrop=null);break;case f.globalDropRule:(this.globalDropRule=l.i)||this.dropRule?(m=a.constructor,c.ondragover=
m.onDragOver,c.ondrop=m.onDrop):(c.ondragover=null,c.ondrop=null);break;default:g?g.push(l):g=[l]}}g&&eq.c.DlgElement.prototype.setAttr.call(this,a,b,c,g)};
eq.c.Tree.prototype.setContent=function(a,b,c){var d=this.constructor.itemFlags,e=eq.Dom,f=b.length,g=this.dndMode;if(g)var h=eq.c.Dlg;a.textContent="";f||void 0===c||(c=c.classList,c.add("eq-empty"),c.remove("eq-open"),c.remove("eq-auto"));for(var k=0;k<f;k++){var l=b[k],n=document.createElement("DIV"),m=document.createElement("SPAN");if("object"===typeof l){var p=document.createElement("DIV"),q=document.createElement("DIV");c=n.classList;n.className="eq-item eq-node";l.f&d.open&&c.add("eq-open");
l.f&d.auto&&c.add("eq-auto");p.className="eq-button";n.appendChild(p);e.setContent(m,l.hc);g&&(m.draggable=!0,m.ondragstart=h.onDragStart);n.appendChild(m);q.className="eq-pane";this.setContent(q,l.ch,n);n.appendChild(q)}else n.className="eq-item eq-leaf",e.setContent(m,l),g&&(m.draggable=!0,m.ondragstart=h.onDragStart),n.appendChild(m);a.appendChild(n)}};
eq.c.Tree.prototype.onEvent=function(a,b,c,d){if("keydown"===d.type)return!0;a=d.target;for(var e;a&&(!(e=a.classList)||!e.contains("eq-tree"));){if("SPAN"===a.tagName){for(;(a=a.parentNode)&&(!(e=a.classList)||!e.contains("eq-tree"));)if(e&&(e.contains("eq-node")||e.contains("eq-leaf")))return!0;break}a=a.parentNode}return!1};
eq.c.Tree.prototype.onKey=function(a,b,c,d,e,f){if(e)return!1;var g=this.constructor;e=eq.app;var h=eq.Dom,k=h.isEnterOrSpace(d);if(k){if(d=c.querySelector(".eq-tree .eq-selected>span"))f.eq={key:k},e.processEvent(a,f,b,c,this);h.consumeEvent(f);return!0}switch(d){case "Escape":case "Esc":return g.select(c),h.consumeEvent(f),!0;case "Home":case "PageUp":case "End":case "PageDown":case "ArrowUp":case "Up":case "ArrowDown":case "Down":break;case "ArrowLeft":case "Left":var l=-1;break;case "ArrowRight":case "Right":l=
1;break;default:return!1}if(void 0!==l){if(d=c.querySelector(".eq-tree .eq-node.eq-selected")){a=d.classList;var n;if(1===l){if(!a.contains("eq-open"))if(a.contains("eq-empty")){var m;"rule"in c.dataset&&-1!==(m=g.itemIndex(c,d))&&(l=c.dataset.rule,+l===+l&&(this.emptyNode=m+1,e.setChanged(b,"emptynode"),e.onceRule=l,e.onceId=b,e.submit(c,{id:b,type:"click"})))}else a.add("eq-open"),e.setChanged(b,"status")}else a.contains("eq-open")&&(a.remove("eq-open"),e.setChanged(b,"status"),c.classList.contains("eq-auto")&&
a.contains("eq-auto")&&(n=d.querySelector(".eq-pane"))&&(n.textContent="",a.remove("eq-auto"),a.add("eq-empty")))}h.consumeEvent(f);return!0}n=c.querySelectorAll(".eq-tree .eq-item");var p=n.length;if(p){switch(d){case "Home":m=0;k=36;break;case "End":m=p-1;k=35;break;case "PageUp":m=0;k=33;break;case "PageDown":m=p-1;k=34;break;case "ArrowUp":case "Up":l=-1;k=38;break;case "ArrowDown":case "Down":l=1,k=40}d=g.selectedIndex(c);void 0!==l&&(-1===(m=d)?m=0:-1===(m+=l)?m=0:m>=p&&(m=p-1));for(var q=m;!g.itemExpanded(n[q]);)if(0>
l){if(-1===--q){for(q=m;!g.itemExpanded(n[++q]););break}}else if(++q===p){for(q=m;!g.itemExpanded(n[--q]););break}if(q!==d&&(g.select(c,q)&&e.setChanged(b,"change"),this.f))return f.eq={key:k},e.processEvent(a,f,b,c,this),h.consumeEvent(f),!0}h.consumeEvent(f);return!0};
eq.c.Tree.prototype.onChange=function(a,b,c,d){if("mousedown"===d.type){a=this.constructor;var e=eq.app;if(d=d.target)if(d.classList.contains("eq-button")){d=d.parentNode;var f;if(d&&(f=d.classList)&&f.contains("eq-node")){var g=!0,h,k;f.contains("eq-open")?(f.remove("eq-open"),c.classList.contains("eq-auto")&&f.contains("eq-auto")&&(h=d.querySelector(".eq-pane"))&&(h.textContent="",f.remove("eq-auto"),f.add("eq-empty"))):f.contains("eq-empty")?(g=!1,"rule"in c.dataset&&-1!==(k=a.itemIndex(c,d))&&
(h=c.dataset.rule,+h===+h&&(this.emptyNode=k+1,e.setChanged(b,"emptynode"),e.onceRule=h,e.onceId=b,e.submit(c,{id:b,type:"click"})))):f.add("eq-open");g&&(f.add("eq-click"),e.moveCapture({id:b,ti:d},null,a.moveDone))}}else for(;d&&(!(f=d.classList)||!f.contains("eq-tree"));){if(f&&f.contains("eq-item")){k=a.selectedIndex(c,d);if(a.select(c,k))return e.setChanged(b,"change"),!0;break}d=d.parentNode}}return!1};
eq.c.Tree.prototype.onDragStart=function(a,b,c,d,e,f){a=this.dndMode;c=eq.Dnd;return a&c.local?(f.drag={id:b},eq.c.DlgElement.setDropModes(e,a),!0):a&c.global?(e.dataTransfer.setData("text/plain",d.textContent),eq.c.DlgElement.setDropModes(e,c.all),!0):!1};eq.c.Tree.prototype.onDragOver=function(a,b,c,d){for(var e,f;d&&(e=d.parentNode);){if((f=e.classList)&&f.contains("eq-item"))return d;if(e===c||f&&f.contains("eq-pane"))break;d=e}return null};
eq.c.Tree.prototype.onDrop=function(a,b,c,d,e){for(;d&&(d=d.parentNode)&&(!(a=d.classList)||!a.contains("eq-item"));)if(d===c||a&&a.contains("eq-pane"))return this.dndMode&eq.Dnd.dropExact?0:(e.drop.line=0,(this.dnd=e).ch.push(e.drop.id=b),e.drag?this.dropRule:this.globalDropRule);if(d){c=c.querySelectorAll(".eq-tree .eq-item");a=0;for(var f=c.length;a<f;a++)if(d===c[a])return e.drop.line=a+1,(this.dnd=e).ch.push(e.drop.id=b),e.drag?this.dropRule:this.globalDropRule}return 0};
eq.c.Tree.prototype.changed=function(a,b,c,d){a=[];for(var e=0,f=d.length;e<f;e++)switch(d[e]){case "change":a.push({ty:eq.RsValType.activeLine,iv:eq.c.Tree.selectedIndex(c)+1});break;case "emptynode":0<this.emptyNode&&(a.push({ty:eq.RsValType.emptyNode,iv:this.emptyNode}),this.emptyNode=0);break;case "status":for(var g=c.querySelectorAll(".eq-tree .eq-node"),h=[],k=0,l=g.length;k<l;k++)g[k].classList.contains("eq-open")&&h.push(k);a.splice(0,0,{ty:eq.RsValType.status,vv:h});break;case "dnd":g=this.dnd;
var n,m;g&&(n=g.drop)&&n.id===b&&void 0!==(m=n.line)&&a.push({ty:eq.RsValType.dropLine,iv:m})}this.dnd=null;switch(a.length){case 0:return null;case 1:return a[0].id=b,a[0];default:return{id:b,v:a}}};eq.c.Menu.addClass("WindowMenu",function(a,b){eq.c.Menu.call(this,a,b)});delete eq.c.WindowMenu.subClass;
eq.c.WindowMenu.prototype.onChange=function(a,b,c,d){a=eq.Dom;var e=c.classList.contains("eq-open");a.closeMenu();if(e)for(b=d.target;(b=b.parentNode)&&b!==c;){if(b.classList.contains("eq-item")){eq.c.App.activateSession(eq.app.sessionByIndex(a.parentIndex(b)));break}}else{d=eq.app;e=c.lastElementChild;var f=d.sessionTitles();e.textContent="";for(var g=0,h=f.length;g<h;g++){var k=document.createElement("LI"),l=document.createElement("LABEL");k.className="eq-item";l.className="eq-fn";a.setContent(l,
f[g]);k.appendChild(l);e.appendChild(k)}c.classList.add("eq-open");d.menuOpen=b;d.constructor.ttClose()}return!0};
eq.c.Obj.subClass("App",function(){eq.c.Obj.call(this);this.initSessionList();this.cssClasses=this.title=null;this.dlg=new Map;this.currDlg=null;this.pendingSync=this.pendingCurrDlgId=0;this.pendingFocus=this.focus=null;this.dlgFocus=!1;this.changed=new Map;this.dialogTimers=new eq.c.Timers;this.mouseDownTimers=new eq.c.Timers;this.idle=!0;this.fnDefault=this.locale=null;this.fnSizeFactor=void 0;this.dnd=this.logoIcon=null;this.dndSerial=0;var a=/^(http[s]?:\/\/)([^/]+)(\/[^?#]+\/)?[^?#]*[?#]?.*$/i;
try{var b=a.exec(document.querySelector("script#eq-webdlg").src);this.scriptBase=b[1]+b[2]+(b[3]||"/")}catch(e){throw Error('WEBDLG: <script id="eq-webdlg"> not found');}try{this.app=/[?&]app=([^&#]+)/i.exec(b[0])[1]}catch(e){}try{var c=/[?&]host=([^&#]+)/i.exec(b[0])[1]}catch(e){}try{var d=/[?&]port=([^&#]+)/i.exec(b[0])[1]}catch(e){}b=a.exec(location.href);c=c?c:b[2];if(d)try{c=/^(.+?:)[^:]*$/.exec(c)[1]+d}catch(e){c+=":"+d}this.appBase=b[1]+c+"/";this.appWS="ws"+b[1].substring(4).toLowerCase()+
c+"/"});delete eq.c.App.subClass;eq.c.App.doubleClick={tv:200,md:[0,0],mu:[0,0]};eq.c.App.toolTipTimeout={show:750,hide:5E3,update:75};eq.c.App.timeout={pagehide:300,debounceKey:500,showIdle:2E3,typeAhead:1E4};
eq.c.App.start=function(a){var b=eq.app,c=b.constructor,d=window.sessionStorage;eq.c.MessageDialog.close();var e=document.body.getElementsByClassName("eq-start");for(var f=0,g=e.length;f<g;f++){if(void 0!==a&&a.target===e[f]&&"app"in e[f].dataset)var h=e[f].dataset.app;e[f].removeEventListener("click",c.start);e[f].classList.add("eq-disabled");"disabled"in e[f]&&(e[f].disabled=!0)}if(void 0===b.currApp)if(void 0!==h)b.currApp=h;else{if(!b.app)throw Error("Cannot start, application name undefined");
b.currApp=b.app}d.setItem("eq-webdlg.app",b.currApp);a=b.args||c.args;b.args=void 0;b.api.postMessage({o:eq.ApiOp.openWebSocket,v:eq.p.version,app:b.currApp,url:b.appWS,sid:d.getItem("eq-webdlg.sid"),args:a});(e=document.documentElement).classList.add("eq-webdlg");e.classList.contains("eq-restart")&&(b.restart=!0,e.classList.remove("eq-restart"))};
eq.c.App.prepareStart=function(a){var b=eq.app;if(void 0===a&&(b.currApp=window.sessionStorage.getItem("eq-webdlg.app")))return this.start(),!1;if(a&&void 0!==b.currApp&&document.documentElement.classList.contains("eq-restart")){a=window.sessionStorage;var c=a.getItem("eq-webdlg.sid"),d=a.getItem("eq-webdlg.opn");b.updateSessionList(!0);a.removeItem("eq-webdlg.app");a.removeItem("eq-webdlg.uat");a.removeItem("eq-webdlg.sid");d&&d===c&&a.removeItem("eq-webdlg.opn");this.start();return!1}b.currApp=
void 0;b=document.body.getElementsByClassName("eq-start");a=b.length;if(!a)return!0;for(c=0;c<a;c++)b[c].addEventListener("click",this.start),b[c].classList.remove("eq-disabled"),"disabled"in b[c]&&(b[c].disabled=!1);return!1};
eq.c.App.stopped=function(){var a=eq.app,b=a.constructor,c,d,e,f,g;a.stopped=window.setTimeout(b.onStopped,b.timeout.pagehide);a.ttDispose();a.mouseDownTimers.dispose();a.dialogTimers.dispose();void 0!==a.typeAhead&&(b.cancelTypeAhead(),a.typeAhead=void 0);a.cancelUserAction();eq.c.LoginDialog.close();void 0!==a.popupBox&&(a.popupBox.close(),a.popupBox=void 0);a.dndSerial=0;if(c=a.dnd)(d=c.drag)&&(e=d.over)&&e.classList.remove("eq-dragover"),a.dnd=null;a.dlg.forEach(b.cbCloseDlg);a.dlg.clear();a.currDlg=
null;a.pendingCurrDlgId=0;a.pendingSync=0;a.cleanupStyles();a.focus=null;a.pendingFocus=null;a.dlgFocus=!1;a.changed.clear();a.pendingMouseDown=void 0;a.pendingClick=void 0;a.pendingTabMode=void 0;a.pendingTabModeId=void 0;a.onceRule=void 0;a.onceId=void 0;a.layoutMode=void 0;a.notifyBusy=void 0;a.idle=!0;for(f in eq.c)(g=eq.c[f]).dispose&&g.dispose();a.fnDefault=null;a.fnSizeFactor=void 0;a.logoIcon=null;a.title=null;a.popupPos=void 0;if(c=a.wfs)c.clear(),a.wfs=void 0;c=document.documentElement.classList;
c.remove("eq-webdlg");b.warnWhenLeavingPage(!1);a.warnLeavingPage=0;if(null!==a.cssClasses){d=0;for(e=(b=a.cssClasses).length;d<e;d++)c.remove(b[d]);a.cssClasses=null}a.restart&&(a.restart=void 0)};eq.c.App.onStopped=function(){var a=eq.app,b=window.sessionStorage,c=b.getItem("eq-webdlg.sid"),d=b.getItem("eq-webdlg.opn");a.stopped=void 0;a.updateSessionList(!0);b.removeItem("eq-webdlg.app");b.removeItem("eq-webdlg.uat");b.removeItem("eq-webdlg.sid");d&&(d===c?b.removeItem("eq-webdlg.opn"):c&&window.close())};
eq.c.App.cbCloseDlg=function(a){a.close()};
eq.c.App.domReady=function(a){var b=eq.app,c=b.constructor;c.title=document.title;var d=document.getElementById("eq-style");d||(d=document.createElement("STYLE"),d.id="eq-style",document.head.appendChild(d));b.stl={sheet:d.sheet,owner:[]};if(!b.stl.sheet)throw Error('WEBDLG: <style id="eq-style"> StyleSheet undefined');b.cleanupStyles();void 0!==window.onhelp&&(window.addEventListener("help",c.onHelp,!0),c.onHelpInstalled=!0);void 0!==document.onhelp&&(document.addEventListener("help",c.onHelp,!0),
c.onHelpInstalled=!0);"complete"===document.readyState?c.documentComplete():window.addEventListener("load",c.documentComplete);c.prepareStart()&&c.start();void 0!==a&&window.removeEventListener("DOMContentLoaded",c.domReady);delete c.domReady};
eq.c.App.documentComplete=function(a){var b=eq.app,c=b.constructor,d,e;b.api.postMessage({o:eq.ApiOp.documentComplete,v:eq.p.version,b:b.appBase});void 0!==(d=eq.plugin)&&(e=d.install()).length&&b.api.postMessage({o:eq.ApiOp.installPlugins,p:e});void 0!==a&&window.removeEventListener("load",c.documentComplete);delete c.documentComplete};
eq.c.App.apiStart=function(){var a=eq.app,b=a.constructor,c=/^(http[s]?:\/\/[^/]+)/i;c.exec(location.href)[1]===c.exec(a.scriptBase)[1]?a.api=new Worker(a.scriptBase+"eq-webdlg-api.js"):(a.apiUrl=(window.URL||window.webkitURL).createObjectURL(new Blob(["importScripts('"+a.scriptBase+"eq-webdlg-api.js');"],{type:"application/javascript"})),a.api=new Worker(a.apiUrl));a.api.onmessage=b.apiReceived;a.api.onerror=b.apiError};
eq.c.App.apiReceived=function(a){var b=eq.app,c=b.constructor,d=eq.MainOp,e=!1;b.dlgListen&&c.dlgListener.close();for(var f=0,g=a.data.length;f<g;f++){var h=a.data[f],k=h.o,l=h.d;switch(k){case d.apiThreadStarted:void 0!==b.apiUrl&&((window.URL||window.webkitURL).revokeObjectURL(b.apiUrl),b.apiUrl=void 0);continue;case d.ssnNewOrResume:var n=window.sessionStorage,m=n.getItem("eq-webdlg.sid");h=n.getItem("eq-webdlg.opn");if(!l.uat)throw Error("apiReceived ssnNewOrResume: invalid, user agent tag undefined");
n.setItem("eq-webdlg.uat",l.uat);if(!l.sid)throw Error("apiReceived ssnNewOrResume: invalid, session id undefined");n.setItem("eq-webdlg.sid",l.sid);m&&m===h&&(m=h=null);h||n.setItem("eq-webdlg.opn",l.sid);window.name="eq-webdlg."+l.sid;b.updateSessionList();b.title=l.title;b.locale=l.locale;b.fnDefault=l.fn;b.fnSizeFactor=l.sf;b.logoIcon=l.icon;b.cssClasses=l=l.css;n=document.documentElement.classList;h=0;for(k=l.length;h<k;h++)n.add(l[h]);c.warnWhenLeavingPage(!0);m||c.dlgListener.message();continue;
case d.inject:l=h.inj;m=!0;h=0;for(k=l.length;h<k;h++)c.inject(l[h])&&(m=!1);m&&b.api.postMessage({o:eq.ApiOp.injectDone});continue;case d.message:new eq.c.MessageDialog(h.s,1E4,null);continue;case d.login:new eq.c.LoginDialog(h.login,h.save);continue;case d.applicationStopped:c.stopped();l&&c.prepareStart(!0);continue;case d.applicationFailed:c.stopped();b.currApp=void 0;c.prepareStart(!1);continue;case d.popupPos:b.popupPos=l;continue;case d.warnLeavingPage:b.warnLeavingPage=1<l?l:c.dlgListener()?
0:l;continue;case d.windowFeature:var p=b.wfs;l=h.k.toUpperCase();h=h.v;p||(p=new Map);h.length?p.set(l,h):p.delete(l);b.wfs=p;continue;case d.windowFeatures:(p=b.wfs)?p.clear():p=new Map;h=0;for(k=l.length;h<k;h++)m=l[h],p.set(m.k.toUpperCase(),m.v);b.wfs=p;continue;case d.layout:b.layoutMode=l;continue;case d.notifyBusy:b.notifyBusy=0!==l;continue;case d.typeAhead:l?void 0===b.typeAhead&&(b.typeAhead={active:!1,dlg:null,focus:null,buf:[],timer:0}):void 0!==b.typeAhead&&(c.cancelTypeAhead(),b.typeAhead=
void 0);continue;case d.cancelCurrentCall:k=h.i;if(!k)var q=b.currDlg;else if(void 0===(q=b.dlg.get(k))||k!==b.pendingCurrDlgId&&q!==b.currDlg)continue;null!==q?(b.mouseDownTimers.dispose(),b.dialogTimers.dispose(),b.cancelUserAction(),b.startTypeAhead(),(q=b.currDlg)&&q.resetCurrDlg(),b.pendingSync=0,b.pendingCurrDlgId=0):void 0!==b.popupBox&&(b.popupBox.close(),b.popupBox=void 0);k&&b.api.postMessage({o:eq.ApiOp.canceled,i:k});continue;case d.update:k=h.i;q=b.dlg.get(k);var r,t;if(void 0===q)throw Error("apiReceived update: DLG "+
k+" does not exist");if(void 0===(t=q.eds.get(r=h.c)))throw Error("apiReceived update: id "+r+" not registered");var u=document.getElementById(r);l=t.onUpdate(q,r,u,h.t,h.a,h.x);if(null===l){t.ddi=h;continue}h.o=eq.ApiOp.updated;h.d=l;b.api.postMessage(h);q.temp&&b.closeDialog(q);continue;case d.updated:q=b.currDlg;null!==q&&l===q.id&&(u=document.getElementById(r=h.i))&&void 0!==(t=q.eds.get(r))&&t.updated(q,r,u,h.t,h.a);continue;case d.synced:if(2!==b.pendingSync)throw Error("apiReceived synced BUG: pendingSync="+
b.pendingSync);b.pendingSync=0;continue;case d.openUrl:k=l.t;m=l.k;(h=(p=b.wfs)?p.get(m.toUpperCase()):void 0)&&(h=eq.Dom.resolveWindowFeatures(h));window.open(l.u,0===k.lastIndexOf("_",0)?k:"eq-webdlg."+k,h)||console.error("Failed to open window '"+m+"' for URL '"+l.u+"'");continue;case d.beep:c.beep();continue;case d.playSound:c.playSound(l.url);continue;case d.startApp:k=l.app;h=l.wf;h||(h=(p=b.wfs)?p.get(k.toUpperCase()):void 0);h&&(h=eq.Dom.resolveWindowFeatures(h));window.open(eq.Dom.updateQueryString(window.location.href,
"app",k),"_blank",h)||console.error("Failed to open window for application '"+k+"'");continue;case d.activate:c.activateSession(b.sessionByTitle(l));continue;case d.invalidate:for(h=l.length;0<=--h;)q=b.dlg.get(l[h]),void 0!==q&&b.closeDialog(q);continue}if(null===b.currDlg||!b.currDlg.ddo){if(!b.idle)throw Error("apiReceived op "+k+": invalid, not idle");if(null!==b.currDlg)throw Error("apiReceived op "+k+": invalid, current Dialog pending");if(null!==b.focus)throw Error("apiReceived op "+k+": invalid, focus pending");
if(b.changed.size)throw Error("apiReceived op "+k+": invalid, "+b.changed.size+" changed elements pending");}if(void 0!==b.popupBox)throw Error("apiReceived op "+k+": invalid, POPUP BOX open");if(0!==b.pendingSync)throw Error("apiReceived op "+k+": invalid, pendingSync="+b.pendingSync);if(0!==b.pendingCurrDlgId)throw Error("apiReceived op "+k+": invalid, pendingCurrDlgId="+b.pendingCurrDlgId);switch(k){case d.resume:e=!0;break;case d.grid:k=h.i;l=h.f;q=b.dlg.get(k);void 0===q&&(q=b.newDialog(k));
q.calcGrid(q.fn=l);b.api.postMessage({o:eq.ApiOp.grid,d:k,g:q.grid});break;case d.addControl:k=h.i;q=b.dlg.get(k);if(void 0===q){if("eq-temp"!==l.pa)throw Error("apiReceived addControl: DLG "+k+" does not exist");q=b.newTempDialog(k)}if(void 0!==l.pa){u=document.getElementById(l.pa);if(!u)throw Error("apiReceived addControl: parent '"+l.pa+"' does not exist");(n=u.classList).contains("eq-container")||(u=n.contains("eq-dialog")?u.querySelector(".eq-dialog>.eq-pane>.eq-view>.eq-container"):u.querySelector(".eq-container"));
if(!u)throw Error("apiReceived addControl: parent '"+l.pa+"' container not found");u=q.addControl(l,u)}else q.close(),q.addRoot(q.addControl(l)),b.setIdle(q);break;case d.modifyControl:k=h.i;q=b.dlg.get(k);if(void 0===q)throw Error("apiReceived modifyControl: DLG "+k+" does not exist");if(!l.id)throw Error("apiReceived modifyControl: id not set");if(!(u=document.getElementById(l.id)))throw Error("apiReceived modifyControl: id '"+l.id+"' does not exist");q.modifyControl(l.id,u,l);break;case d.deleteControl:k=
h.i;q=b.dlg.get(k);u=document.getElementById(l);if(void 0===q)throw Error("apiReceived deleteControl: DLG "+k+" does not exist");if(!u)throw Error("apiReceived deleteControl: id '"+l+"' does not exist");q.removeElement(u)&&b.closeDialog(q);break;case d.dlg_DRAW:e&&(e=!1,b.dialogsVisible());b.pendingSync=1;eq.Dom.onNextCycle(c.dlg_DRAW,h);break;case d.dlg_DO:e&&(e=!1,b.dialogsVisible());b.restart&&(b.restart=void 0,document.documentElement.classList.add("eq-restart"));k=h.i;q=b.dlg.get(k);if(void 0===
q)throw Error("apiReceived dlg_DO: DLG "+k+" does not exist");q.ddo&&(b.pendingSync=1);b.pendingCurrDlgId=k;eq.Dom.onNextCycle(c.dlg_DO,h);break;case d.dlg_POPUP_BOX:e&&(e=!1,b.dialogsVisible());b.restart&&(b.restart=void 0,document.documentElement.classList.add("eq-restart"));b.popupBox=new eq.c.PopupBox(l);b.dlgFocus=!0;break;default:throw Error("apiReceived invalid op: "+k);}}if(e&&(b.dialogsVisible(),(q=b.topDialog())&&q.ddo)){if(null!==b.currDlg)throw Error("apiReceived resume: invalid, current Dialog pending");
b.setCurrDialog(q);q.ddo.f&&b.setFocus(q.ddo.f);q.ddo.t&&(q.tabOrder=q.ddo.t);b.setIdle()}};
eq.c.App.dlg_DO=function(a){var b=eq.app,c=b.constructor,d=a.i,e=b.pendingCurrDlgId,f=b.dlg.get(d);b.pendingCurrDlgId=0;if(void 0===f)throw Error("App.dlg_DO: DLG "+d+" does not exist");if(f.whenReady&&f.ddo)throw Error("App.dlg_DO BUG: whenReady pending");if(e!==d){if(0!==e)throw Error("App.dlg_DO: unexpected pending DLG "+e+", expected: "+d+" or zero");}else f.whenReady=c.dlg_DO.ready,f.whenReadyArg=a.d.f,b.setCurrDialog(f),void 0!==(a=a.d.t)&&(f.tabOrder=a)};
eq.c.App.dlg_DO.ready=function(a,b){var c=eq.app,d=c.constructor;if(a!==c.currDlg){if(c.currDlg)throw Error("App.dlg_DO.ready: unexpected DLG "+c.currDlg.id+", expected: "+a.id);if(a.ddo){if(1!==c.pendingSync)throw Error("App.dlg_DO.ready BUG: Dialog.do pendingSync="+c.pendingSync);c.pendingSync=2;c.api.postMessage({o:eq.ApiOp.onSynced})}}else{b?c.setFocus(b):d.resetFocus();c.setIdle();if(null!==c.pendingFocus){b=c.pendingFocus;var e,f;c.pendingFocus=null;b.id===c.focus&&(e=b.act)&&(f=document.getElementById(b.id))&&
e(f)}if(a.ddo){if(1!==c.pendingSync)throw Error("App.dlg_DO.ready BUG: Dialog.do pendingSync="+c.pendingSync);c.pendingSync=2;c.api.postMessage({o:eq.ApiOp.onSynced})}else{e=a.w;if(null!==e){var g;(f=e.root.querySelector(".eq-window>.eq-pane>.eq-caption>.eq-close"))&&(g=f.classList).contains("eq-click")&&g.remove("eq-click");if(a.pendingClose){eq.Dom.onNextCycle(d.submitWindowClose);return}d.warnWhenLeavingPage(1<c.warnLeavingPage||!e.canClose())}c.dlgFocus=!0;void 0!==a.timer&&c.dialogTimers.add(a.timer.delay,
d.submitDialogTimer,null,a.timer.rule)}}};eq.c.App.dlg_DRAW=function(a){var b=eq.app;a=a.i;var c=b.dlg.get(a);if(void 0===c)throw Error("App.dlg_DRAW: DLG "+a+" does not exist");if(c.whenReady)throw Error("App.dlg_DRAW BUG: whenReady pending");c.whenReady=b.constructor.dlg_DRAW.ready;b.setCurrDialog(c)};
eq.c.App.dlg_DRAW.ready=function(a){var b=eq.app;if(a!==b.currDlg){if(b.currDlg)throw Error("App.dlg_DRAW.ready: unexpected DLG "+b.currDlg.id+", expected: "+a.id);}else a.ddo||(b.currDlg=null);if(1!==b.pendingSync)throw Error("App.dlg_DRAW.ready BUG: Dialog.do pendingSync="+b.pendingSync);b.pendingSync=2;b.api.postMessage({o:eq.ApiOp.onSynced})};eq.c.App.submitWindowClose=function(){var a=eq.app,b;!a.idle&&null!==(b=a.currDlg)&&b.pendingClose&&(b.pendingClose=void 0,a.submit(document.body,{type:"close"}))};
eq.c.App.submitDialogTimer=function(a){var b=eq.app;b.idle||null===b.currDlg||(b.onceRule=a,b.submit(document.body,{type:"timer"}))};eq.c.App.prototype.apiUpdate=function(a,b,c){var d=this.currDlg;if(!d)throw Error("BUG: apiUpdate no current Dialog");this.api.postMessage({o:eq.ApiOp.update,d:d.id,i:a,t:b,a:c})};eq.c.App.apiError=function(){var a=eq.app;void 0!==a.apiUrl&&((window.URL||window.webkitURL).revokeObjectURL(a.apiUrl),a.apiUrl=void 0)};
eq.c.App.onEvent=function(a){var b=eq.app,c=eq.Dom,d=a.target;switch(a.type){case "focusin":var e=!0;break;case "mousedown":if(0!==a.button)return;var f=!0}b.dlgFocus=!0;if(d.classList.contains("eq-idle"))c.consumeEvent(a),f&&(d.style.cursor="wait",b.notifyBusy&&b.constructor.beep());else if(!b.idle){var g=c.eqControl(d),h;if(g){if((h=g.classList).contains("eq-disabled")){f&&h.contains("eq-md")||c.consumeEvent(a);if(b.menuOpen)c.onNextCycle(c.closeMenu);return}var k=g.id,l=b.currDlg,n;if(!l)throw Error("BUG: onEvent no current Dialog");
if(void 0!==(n=l.eds.get(k))){if(f){var m=h.contains("eq-focus")||h.contains("eq-md");b.pendingMouseDown={id:k,t:d}}else if(e){h.contains("eq-focus")?k!==b.focus&&b.setFocus(k,g):c.consumeEvent(a);return}b.processEvent(l,a,k,g,n)}h=b.menuOpen&&c.isMenu(g)}if(f&&(m||c.consumeEvent(a),b.menuOpen&&!h))c.onNextCycle(c.closeMenu)}};
eq.c.App.prototype.processEvent=function(a,b,c,d,e){var f=b.type;if(void 0!==e.c&&-1!==e.c.indexOf(f)){var g=this.changed.get(c);void 0===g?this.changed.set(c,[f]):-1===g.indexOf(f)&&g.push(f);if(!e.onChange(a,c,d,b))return!1}if(void 0!==e.a&&-1!==e.a.indexOf(f)){if(!e.onEvent(a,c,d,b))return!1;if("mousedown"===f){if(void 0!==(a=this.pendingClick)){this.stopPendingClickTimer();if(void 0===e.m)return!1;c!==a.id&&eq.c.App.commitPendingClick();return!0}d={btn:b.buttons};if(void 0===d.btn)switch(b.button){case 0:d.btn=
1;break;case 1:d.btn=4;break;case 2:d.btn=2;break;default:d.btn=0}this.pendingClick={id:c,type:"click",cnt:0,ea:d}}else if(void 0!==(a=this.pendingClick)){if(void 0!==a.ev)throw Error("BUG: onEvent pending click id:"+a.id+" and id:"+a.ev.id+" type:"+a.ev.type);a.ev={id:c,type:f,ea:b.eq}}else this.submit(d,{id:c,type:f,ea:b.eq});return!0}return!1};eq.c.App.prototype.cancelUserAction=function(){void 0!==this.capture&&this.endCapture();this.closeOverlay();eq.Dom.closeMenu()};
eq.c.App.onCancelUserAction=function(a){if("focus"==a.type)eq.Dom.isRootChild(a.target)||eq.c.PopupBox.setFocus()?eq.app.dlgFocus=!0:eq.c.LoginDialog.setFocus(a)||eq.c.MessageDialog.setFocus();else if(a.target===window){var b=eq.app;b.cancelUserAction();"blur"==a.type&&(b.dlgFocus=!1)}};
eq.c.App.prototype.setChanged=function(a,b){if(!this.idle){var c=this.currDlg,d;if(!c)throw Error("BUG: setChanged no current Dialog");void 0!==(d=c.eds.get(a))&&void 0!==d.c&&-1!==d.c.indexOf(b)&&(c=this.changed.get(a),void 0===c?this.changed.set(a,[b]):-1===c.indexOf(b)&&c.push(b))}};
eq.c.App.prototype.elementsChanged=function(a){var b=this.constructor,c=this.currDlg,d,e,f,g=[{ty:eq.RsValType.idFocus,sv:this.focus||""}];if(!c)throw Error("BUG: elementsChanged no current Dialog");void 0!==a&&(void 0!==a.key?g.push({ty:eq.RsValType.ruleKey,iv:a.key}):(void 0!==a.btn&&g.push({ty:eq.RsValType.mouseBtns,iv:a.btn}),void 0!==a.cnt&&g.push({ty:eq.RsValType.mouseCnt,iv:a.cnt}),void 0!==a.mod&&g.push({ty:eq.RsValType.mouseMods,iv:a.mod})));null!==(d=c.w)&&(f=(e=d.root).querySelector(".eq-window>.eq-pane>.eq-dialog>.eq-pane>.eq-view"))&&
((a=d.modified).maximized&&(a.maximized=void 0,g.push({ty:eq.RsValType.dialogMax,iv:e.classList.contains("eq-max")?1:0})),a.pos&&(a.pos=void 0,g.push({ty:eq.RsValType.dialogPos,x:e.offsetLeft,y:e.offsetTop})),a.size&&(a.size=void 0,g.push({ty:eq.RsValType.dialogSize,w:f.offsetWidth,h:f.offsetHeight})));void 0!==this.onceRule&&(g.push({id:this.onceId,ty:eq.RsValType.ruleOnce,iv:this.onceRule}),this.onceId=this.onceRule=void 0);this.changed.forEach(b.cbElementsChanged,{d:c,c:g});this.changed.clear();
return g};eq.c.App.prototype.updateElementsChanged=function(){var a=this.constructor,b=this.currDlg,c=[];if(!b)throw Error("BUG: updateElementsChanged no current Dialog");this.changed.forEach(a.cbElementsChanged,{d:b,c:c});this.changed.clear();return c};
eq.c.App.cbElementsChanged=function(a,b){var c=this.d,d,e;if(void 0===(d=c.eds.get(b)))throw Error("BUG: elementsChanged id:"+b+" not registered, type:"+a);var f=document.getElementById(b);f.classList.contains("eq-event")||(f=f.querySelector(".eq-event"));if(!f)throw Error("BUG: cbElementsChanged id:"+b+" event element not found");null!==(e=d.changed(c,b,f,a))&&this.c.push(e)};
eq.c.App.prototype.submit=function(a,b){if(-1===this.onceRule||void 0===this.onceRule&&a.classList.contains("eq-help"))this.api.postMessage({o:eq.ApiOp.onHelp,d:-1===this.onceRule&&void 0!==this.onceId?this.onceId:a.id});else{var c,d,e,f;this.mouseDownTimers.dispose();this.dialogTimers.dispose();"timer"!==b.type&&this.cancelUserAction();if(d=(c=this.currDlg).ddo){b=this.focus||"";var g;if(d.hide||d.show)d.hide&&(a=document.getElementById(d.hide))&&(a.style.display="none"),d.show&&(a=document.getElementById(d.show))&&
(a.style.display="");else for(a=c.root.length;0<=--a;)(g=c.root[a]).classList.contains("eq-dialog")?c.w.root.style.display="none":g.style.display="none";this.focus=this.currDlg=null;this.changed.clear();this.setIdle(c);this.api.postMessage({o:eq.ApiOp.onDo,i:c.id,f:b})}else{c.whenReady&&c.callWhenReady();if(void 0===this.onceRule&&a!==document.body&&void 0!==(f=c.eds.get(e=a.id)))f.onSubmit(c,e,a,b);this.setIdle(c);eq.Dom.onNextCycle(this.constructor.apiSubmit,b)}}};
eq.c.App.apiSubmit=function(a){var b=eq.app,c,d;null!==b.currDlg&&(a.changed=b.elementsChanged(a.ea),b.api.postMessage({o:eq.ApiOp.onEvent,d:a}),b.startTypeAhead(),b.currDlg=null,b.focus=null,a=b.dnd)&&((c=a.drag)&&(d=c.over)&&d.classList.remove("eq-dragover"),b.dnd=null)};
eq.c.App.onGlobalKeyDown=function(a){var b=a.key;switch(b){case "Alt":case "AltGraph":case "CapsLock":case "Control":case "Fn":case "FnLock":case "Hyper":case "Meta":case "NumLock":case "OS":case "Scroll":case "ScrollLock":case "Shift":case "Super":case "Symbol":case "SymbolLock":return}var c=eq.app,d=c.constructor,e=eq.Dom;if(c.dlgFocus)if(b===c.debounceKey)d.debounceKey(b),e.consumeEvent(a);else if(void 0!==c.popupBox)c.popupBox.onKey(a)&&e.consumeEvent(a);else if(c.addTypeAhead(a))e.consumeEvent(a);
else if(c.idle)e.consumeEvent(a),c.notifyBusy&&d.beep();else{var f=c.currDlg;if(f){var g=eq.KeyMod,h=a.shiftKey?g.shift:0;a.ctrlKey&&(h|=g.ctrl);a.altKey&&(h|=g.alt);a.metaKey&&(h|=g.meta);h===g.shift&&1===b.length&&(h=0);var k=c.menuOpen,l,n,m;if(k&&(l=document.getElementById(k))){if(m=(n=l.getElementsByClassName("eq-open")).length)l=n[m-1];if(void 0!==(m=f.eds.get(n=l.id))){if(m.onKey(f,k,l,b,h,a))return;l=n=m=void 0}}var p,q=a.target;void 0!==c.overlay?l=c.overlay.el:null===c.focus||q!==document.body&&
!e.eqControl(q)||(l=document.getElementById(c.focus));if(l){if((p=l.classList).contains("eq-disabled")){e.consumeEvent(a);return}if(void 0===(m=f.eds.get(n=l.id)))return}var r;switch(b){case "Enter":!(h||p&&p.contains("eq-enter"))&&f.fkey&&0<f.fkey.length&&f.fkey[0]&&(r=0);break;case "F1":r=1;d.onHelpInstalled&&(c.onHelpIgnore=!0);break;case "F2":r=2;break;case "F3":r=3;break;case "F4":r=4;break;case "F5":r=5;break;case "F6":r=6;break;case "F7":r=7;break;case "F8":r=8;break;case "F9":r=9;break;case "F10":r=
10;break;case "F11":r=11;break;case "F12":r=12}if(void 0!==r){if(f.isAccel(b,h,a)){e.consumeEvent(a);k===c.menuOpen&&e.closeMenu();return}if(!h&&f.fkey&&r<f.fkey.length&&(f=f.fkey[r])){e.consumeEvent(a);0<f?(c.onceRule=f,null!==c.focus&&(l=document.getElementById(c.focus))?(c.onceId=c.focus,c.submit(l,{id:c.onceId,type:"key"})):c.submit(document.body,{type:"key"})):-1===f&&c.api.postMessage({o:eq.ApiOp.onHelp,d:l?l.id:null});k===c.menuOpen&&e.closeMenu();return}c.onHelpIgnore=void 0}else if(l){if(m.onKey(f,
n,l,b,h,a)){k===c.menuOpen&&e.closeMenu();return}if(f.isAccel(b,h,a)){e.consumeEvent(a);k===c.menuOpen&&e.closeMenu();return}if(h<=g.shift)switch(b){case "Enter":if(p.contains("eq-enter")||p.contains("eq-noenter"))break;case "Tab":var t=h?-1:1;break;case "ArrowUp":case "Up":case "ArrowLeft":case "Left":h||(t=-1);break;case "ArrowDown":case "Down":case "ArrowRight":case "Right":h||(t=1)}t&&(e.consumeEvent(a),c.inSetFocus||((a=f.nextTab(n,-1===t))?(c.pendingTabMode=t,c.pendingTabModeId=l=a.id,c.setFocus(l,
a)):c.processEvent(f,{type:"blur",target:m.focusElement(f,l)},n,l,m)))}else f.isAccel(b,h,a)&&e.consumeEvent(a);k===c.menuOpen&&e.closeMenu()}}else void 0!==c.debounceKeyTimer&&(window.clearTimeout(c.debounceKeyTimer),c.debounceKeyTimer=void 0,c.debounceKey=void 0)};eq.c.App.onGlobalKeyUp=function(a){var b=eq.app;a.key===b.debounceKey&&(window.clearTimeout(b.debounceKeyTimer),b.debounceKeyTimer=void 0,b.debounceKey=void 0,eq.Dom.consumeEvent(a))};
eq.c.App.debounceKey=function(a){var b=eq.app;b.debounceKey=a;void 0!==b.debounceKeyTimer&&window.clearTimeout(b.debounceKeyTimer);b.debounceKeyTimer=window.setTimeout(this.onDebounceKeyTimer,this.timeout.debounceKey)};eq.c.App.onDebounceKeyTimer=function(){var a=eq.app;a.debounceKeyTimer=void 0;a.debounceKey=void 0};eq.c.App.onHelp=function(a){var b=eq.app;return b.onHelpIgnore?(b.onHelpIgnore=void 0,eq.Dom.consumeEvent(a),!1):!0};
eq.c.App.onGlobalMouseDownOrClick=function(a){var b=a.eq;if(void 0!==b){if(b.onGlobalMouseDownOrClick)return;b.onGlobalMouseDownOrClick=!0}else a.eq={onGlobalMouseDownOrClick:!0};b=eq.app;var c=a.target,d=c,e="mousedown"===a.type,f,g,h,k;e&&(f=performance.now());for(b.toolTip&&b.toolTip.tt&&b.constructor.ttClose();d&&d!==document;){if(g=d.classList){if(!g.contains("eq-disabled")&&g.contains("eq-control")&&(k=d.id))break;!h&&g.contains("eq-cmc")&&(h=d)}d=d.parentNode}if(k){var l=a.buttons,n=d.dataset.mask||
2;if(void 0===l)switch(a.button){case 0:l=1;break;case 1:l=4;break;case 2:l=2;break;default:l=0}if(l&n){for(;d&&d!==document;){if(g=d.classList)if((e=g.contains("eq-idle")||g.contains("eq-overlay"))||g.contains("eq-root")||g.contains("eq-window")){b.cancelUserAction();a.preventDefault();a.stopImmediatePropagation();!e&&b.currDlg&&(d=b.updateElementsChanged(),d.length&&b.apiUpdate(null,eq.UpdateTag.changed,{c:d}),b.apiUpdate(k,eq.UpdateTag.mouseButton2,{x:a.clientX,y:a.clientY,c:h?eq.Dom.parentIndex(h)+
1:0}));break}d=d.parentNode}return}}if(0!==a.button)b.cancelUserAction();else{e&&(k=eq.c.App.doubleClick,k.md[1]=k.md[0],k.md[0]=Math.ceil(f));void 0!==b.capture&&(a.stopPropagation(),b.endCapture());h=eq.Dom;e&&void 0!==b.overlay&&(h.eqOverlay(c)?(f=b.currDlg)&&(d=h.eqControl(c)||b.overlay.el)&&((g=d.classList)&&g.contains("eq-disabled")?(b.closeOverlay(),h.consumeEvent(a)):void 0!==(g=f.eds.get(k=d.id))&&(b.processEvent(f,a,k,d,g),h.consumeEvent(a))):h.eqControl(c)!==b.overlay.el&&(b.closeOverlay(),
h.consumeEvent(a)));if(b.menuOpen){for(d=c;d&&d!==document;){if(g=d.classList)if(g.contains("eq-dialog")||g.contains("eq-menubar")){var m=!0;break}d=d.parentNode}if(!m)h.onNextCycle(h.closeMenu)}if(b.idle&&void 0!==b.popupBox){if(b.popupBox.isEvent(a)){if(b.popupBox.close(a)){b.popupBox=void 0;h.consumeEvent(a);return}}else if(!c.classList.contains("eq-idle"))return;e&&a.preventDefault()}else(b=eq.c.Window.fromTarget(c))&&b.onMouseDownOrClick(a)&&e&&h.consumeEvent(a)}};
eq.c.App.onGlobalMouseDoubleClick=function(a){a=eq.c.App.doubleClick;var b=a.md[0]-a.mu[0];b>a.tv&&(a.tv=b)};
eq.c.App.onGlobalMouseUp=function(a){var b=eq.app;if(0===a.button){var c=performance.now(),d=eq.c.App.doubleClick;d.mu[0]=d.mu[1];d.mu[1]=Math.ceil(c)}b.mouseDownTimers.cancelAll();if(void 0!==b.capture&&(a.stopPropagation(),!b.endCapture(a))){b.pendingMouseDown=void 0;b.pendingClick=void 0;b.stopPendingClickTimer();return}if(b.idle)b.pendingMouseDown=void 0,b.pendingClick=void 0,b.stopPendingClickTimer();else{var e=eq.Dom;if(void 0!==(c=b.pendingMouseDown)){var f=c.t;if(f===a.target){var g=c.id;
d=b.currDlg;var h=e.eqControl(f);if(!d)throw Error("BUG: onGlobalMouseUp no current Dialog");b.processEvent(d,{type:"click",target:f},g,h,d.eds.get(g));h.classList.contains("eq-focus")&&b.setFocus(g,h)}else if(b.menuOpen&&e.isMenu(f=a.target)){d=b.currDlg;h=e.eqControl(f);g=h.id;if(!d)throw Error("BUG: onGlobalMouseUp no current Dialog");b.processEvent(d,{type:"click",target:f,menuMouseUp:!0},g,h,d.eds.get(g))}b.pendingMouseDown=void 0;if(b.menuOpen&&e.isMenu(f=a.target)&&(h=e.eqControl(f))&&h.classList.contains("eq-item"))e.onNextCycle(e.closeMenu)}if(void 0!==
(c=b.pendingClick)){b.stopPendingClickTimer();d=b.currDlg;h=e.eqControl(a.target);var k;if(!d)throw Error("BUG: onGlobalMouseUp pendingClick no current Dialog");if(h&&(g=h.id)===c.id){void 0!==a.eq?c.ea=a.eq:(e=c.ea=c.ea||{},f=0,e.cnt=c.cnt?c.cnt+1:1,a.shiftKey&&(f+=1),a.ctrlKey&&(f+=2),a.metaKey&&(f+=4),a.altKey&&(f+=8),f&&(e.mod=f));if(void 0!==(k=d.eds.get(g))&&void 0!==k.m&&0===c.cnt){c.cnt=1;a=b.constructor;b.commitPendingClickTimer=window.setTimeout(a.commitPendingClick,a.doubleClick.tv);return}b.submit(h,
c)}else void 0!==(c=c.ev)&&(h=document.getElementById(c.id))&&b.submit(h,c);b.pendingClick=void 0}}};eq.c.App.commitPendingClick=function(){var a=eq.app,b;a.commitPendingClickTimer=void 0;if(void 0!==(b=a.pendingClick)){var c=b.id,d,e,f;(d=a.currDlg)&&void 0!==(e=d.eds.get(c))&&void 0!==e.m&&(b.cnt>=e.m?(f=document.getElementById(c))&&a.submit(f,b):void 0!==(b=b.ev)&&(f=document.getElementById(b.id))&&a.submit(f,b));a.pendingClick=void 0}};
eq.c.App.prototype.stopPendingClickTimer=function(){void 0!==this.commitPendingClickTimer&&(window.clearTimeout(this.commitPendingClickTimer),this.commitPendingClickTimer=void 0)};eq.c.App.prototype.moveCapture=function(a,b,c){var d=this.constructor;void 0!==this.capture&&this.endCapture();d.ttClose();this.capture={arg:a,cb:b,done:c};window.addEventListener("mousemove",d.onCapture)};
eq.c.App.prototype.endCapture=function(a){var b=this.capture;window.removeEventListener("mousemove",this.constructor.onCapture);this.capture=void 0;return b.done?b.done(b.arg,a):!0};eq.c.App.onCapture=function(a){a.stopPropagation();var b=eq.app,c=b.constructor;(b=b.capture)?b.cb&&b.cb(a,b.arg):window.removeEventListener("mousemove",c.onCapture)};
eq.c.App.onGlobalContextMenu=function(a){for(var b=a.target,c;b&&b!==document;){if(c=b.classList)if(c.contains("eq-idle")||c.contains("eq-overlay")||c.contains("eq-tip")||c.contains("eq-root")||c.contains("eq-window"))return a.preventDefault(),a.stopImmediatePropagation(),!1;b=b.parentNode}return!0};eq.c.App.onGlobalPageHide=function(a){a=eq.app;void 0!==a.stopped&&(window.clearTimeout(a.stopped),a.stopped=void 0);a.updateSessionList(!0)};
eq.c.App.onGlobalDragEnd=function(a){var b,c,d;(b=eq.app.dnd)&&(c=b.drag)&&(d=c.over)&&(c.over=null,d.classList.remove("eq-dragover"))};
eq.c.App.onStorageModified=function(a){if(a.storageArea===window.localStorage)switch(a.key){case "eq-webdlg.sls":var b=eq.app;if(a.newValue)try{var c=JSON.parse(a.newValue),d=b.sls;if(!d||c.ts>=d.ts)b.sls=c}catch(e){console.log("Failed to parse session list, "+e.message),b.sls=void 0,window.localStorage.removeItem("eq-webdlg.sls")}else b.sls=void 0;b.updateSessionList();break;case "eq-webdlg.act":a.newValue&&(b=window.sessionStorage.getItem("eq-webdlg.sid"))&&a.newValue===b&&(window.focus(),window.localStorage.removeItem("eq-webdlg.act"))}};
eq.c.App.activateSession=function(a){var b,c;a&&(b=window.sessionStorage.getItem("eq-webdlg.sid"))&&a!==b&&(c=window.open("","eq-webdlg."+a))&&(c.focus(),window.localStorage.setItem("eq-webdlg.act",a))};eq.c.App.prototype.sessionTitles=function(){var a=[],b=this.sls,c=window.sessionStorage,d,e,f;if(void 0!==b&&(d=c.getItem("eq-webdlg.uat"))&&b.ua==d&&(e=c.getItem("eq-webdlg.opn")))for(c=0,d=(b=b.sn).length;c<d;c++)e===(f=b[c]).o&&f.t&&a.push(f.t);return a};
eq.c.App.prototype.sessionByIndex=function(a){var b=this.sls,c=window.sessionStorage,d,e,f;if(void 0!==b&&(d=c.getItem("eq-webdlg.uat"))&&b.ua==d&&(e=c.getItem("eq-webdlg.opn")))for(c=0,d=(b=b.sn).length;c<d;c++)if(e===(f=b[c]).o&&f.t&&0===a--)return f.s;return null};
eq.c.App.prototype.sessionByTitle=function(a){var b=this.sls,c=window.sessionStorage,d,e,f,g;if(void 0!==b&&(d=c.getItem("eq-webdlg.uat"))&&b.ua==d&&(e=c.getItem("eq-webdlg.sid"))&&(f=c.getItem("eq-webdlg.opn")))for(c=0,d=(b=b.sn).length;c<d;c++)if(f===(g=b[c]).o&&e!==g.s&&a===g.t)return g.s;return null};
eq.c.App.prototype.initSessionList=function(){var a=window.sessionStorage,b,c;if(b=a.getItem("eq-webdlg.opn")){if(void 0===(c=this.sls))try{if(c=JSON.parse(window.localStorage.getItem("eq-webdlg.sls")))this.sls=c}catch(f){}if(c){for(var d=0,e=(c=c.sn).length;d<e;d++)if(c[d].o===b)return;a.removeItem("eq-webdlg.opn")}}};
eq.c.App.prototype.updateSessionList=function(a){var b=window.sessionStorage,c,d,e,f,g;if(!a&&(c=b.getItem("eq-webdlg.uat"))&&(d=b.getItem("eq-webdlg.sid"))&&(e=b.getItem("eq-webdlg.opn"))){if(void 0===(f=this.sls))try{if(f=JSON.parse(window.localStorage.getItem("eq-webdlg.sls")))this.sls=f}catch(n){}f&&f.ua===c||(this.sls=f={ua:c,sn:[]});var h,k=(g=f.sn).length;a=document.title;for(h=0;h<k;h++)if(d===(b=g[h]).s){if(b.o!==e||b.t!==a){b.o=e;b.t=a;var l=!0}break}h===k&&(g.push({s:d,o:e,t:a}),l=!0);
l&&(f.ts=Date.now(),window.localStorage.setItem("eq-webdlg.sls",JSON.stringify(f)))}else if(this.sls=void 0,(c=b.getItem("eq-webdlg.uat"))&&(d=b.getItem("eq-webdlg.sid")))try{if(f=JSON.parse(window.localStorage.getItem("eq-webdlg.sls")),f.ua===c)for(h=0,k=(g=f.sn).length;h<k;h++)if(d===g[h].s){g.splice(h,1);f.ts=Date.now();window.localStorage.setItem("eq-webdlg.sls",JSON.stringify(f));break}}catch(n){}};eq.c.App.rootEventTypes=["change","focusin","input","mousedown"];
eq.c.App.addRootListeners=function(a){for(var b=this.onEvent,c=this.rootEventTypes,d=0,e=c.length;d<e;d++)a.addEventListener(c[d],b,!0)};eq.c.App.removeRootListeners=function(a){for(var b=this.onEvent,c=this.rootEventTypes,d=0,e=c.length;d<e;d++)a.removeEventListener(c[d],b,!0)};
eq.c.App.prototype.setFocus=function(a,b){if(a!==this.focus){var c=this.constructor,d=this.currDlg;if(!d)throw Error("BUG: setFocus no current Dialog");var e=document.body.getElementsByClassName("eq-focused");var f=0;for(var g=e.length;f<g;f++)e[f].classList.remove("eq-focused");if(null!==(e=this.focus)){if(void 0===(f=d.eds.get(e)))throw Error("setFocus: from '"+e+"' not registered");g=document.getElementById(e);if(!g)throw Error("setFocus: from '"+e+"' does not exist");this.pendingTabModeId===e&&
(this.pendingTabModeId=this.pendingTabMode=void 0);f.focusLost(d,g);if(this.processEvent(d,{type:"blur",target:f.focusElement(d,g)},e,g,f))return this.focus=a,!0}if(void 0===(f=d.eds.get(a)))throw Error("setFocus: to '"+a+"' not registered");if(void 0===b&&!(b=document.getElementById(a)))throw Error("setFocus: to '"+a+"' does not exist");this.focus=a;b.classList.add("eq-focused");this.pendingTabModeId!==a&&(this.pendingTabModeId=this.pendingTabMode=void 0);f.focusGained(d,a=f.focusElement(d,b));this.pendingTabModeId=
this.pendingTabMode=void 0;this.inSetFocus=!0;eq.Dom.onNextCycle(c.setElementFocus,{d:d,e:b,f:a})}return!1};eq.c.App.setElementFocus=function(a){a.f.focus();var b=eq.Dom;b.scrollIntoView(a.d,a.e);b.onNextCycle(eq.c.App.verifyElementFocus)};
eq.c.App.verifyElementFocus=function(){var a=eq.app,b=a.focus,c=a.typeAhead,d;!b||(d=eq.Dom.eqControl(document.activeElement))&&d.id===b||(d=document.activeElement)&&d!==document.body&&d.blur();a.inSetFocus=void 0;if(void 0!==c&&c.active){var e=a.constructor,f=a.currDlg,g,h;if(null!==f&&!f.ddo&&f===c.dlg&&b===c.focus){d=document.getElementById(b);for(var k=0,l=c.buf,n=l.length;k<n&&(g=f.eds.get(b))&&!(("Enter"===(h=l[k++])||"ShiftEnter"===h)&&f.fkey&&0<f.fkey.length&&f.fkey[0])&&g.onTypeAhead(f,b,
d,h);)if(a.focus!==b){if(null!==(c.focus=a.focus)){l.splice(0,k);return}break}}e.cancelTypeAhead()}};eq.c.App.resetFocus=function(a){a=document.body.getElementsByClassName("eq-focused");for(var b=0,c=a.length;b<c;b++)a[b].classList.remove("eq-focused");document.documentElement.focus()};
eq.c.App.prototype.setIdle=function(a){var b=this.constructor,c=eq.Dom;if(void 0===a)c.onNextCycle(b.setActive);else{this.idle=!0;c.cancelNextCycle(b.setActive);for(var d,e=0,f=a.root.length;e<f;e++){var g=a.root[e];g.querySelector(".eq-root>.eq-idle")||(d=document.createElement("DIV"),d.className="eq-idle",d.style.zIndex=c.zIndex(g)+2,g.appendChild(d))}d&&(void 0!==this.idleTimer&&window.clearTimeout(this.idleTimer),this.idleTimer=window.setTimeout(b.showIdle,b.timeout.showIdle));b.warnWhenLeavingPage(!0)}};
eq.c.App.setActive=function(){var a=eq.app,b=a.currDlg,c;if(null!==b){a.idle=!1;a=0;for(var d=b.root.length;a<d;a++)(c=b.root[a].querySelector(".eq-root>.eq-idle"))&&c.parentNode.removeChild(c);void 0!==this.idleTimer&&(window.clearTimeout(this.idleTimer),this.idleTimer=void 0)}};eq.c.App.showIdle=function(){eq.app.idleTimer=void 0;for(var a=document.body.getElementsByClassName("eq-idle"),b=0,c=a.length;b<c;b++)a[b].classList.add("eq-fog")};
eq.c.App.prototype.makeOverlay=function(a,b,c){if(void 0!==this.overlay)throw Error("makeOverlay BUG: pending overlay id:"+this.overlay.el.id);if(document.body.querySelector("body>.eq-overlay"))throw Error("makeOverlay BUG: orphaned overlay");this.overlay={el:a,overlay:b,onClose:c};a=document.body;c=this.constructor;b.classList.add("eq-overlay");b.style.zIndex=eq.Dom.zIndexMax(a)+1;a.appendChild(b);b.onmousedown=this.constructor.onGlobalMouseDownOrClick;c.ttClose()};
eq.c.App.prototype.closeOverlay=function(a,b){var c=this.overlay;if(void 0===c){if(document.body.querySelector("body>.eq-overlay"))throw Error("closeOverlay BUG: orphaned overlay");}else{var d=c.overlay;if(void 0!==a&&a!==c.el)throw Error("closeOverlay BUG: wrong id:"+a.id+", expected:"+c.el.id);if(!d.classList.contains("eq-overlay"))throw Error("closeOverlay BUG: no overlay id:"+c.el.id);d.onmousedown=null;this.overlay=void 0;c.onClose(c.el,d,b);d.style.zIndex="";d.classList.remove("eq-overlay")}};
eq.c.App.prototype.cleanupStyles=function(){var a=this.stl,b=a.sheet,c=b.cssRules,d;if(d=c.length){if(d!==a.owner.length)throw Error("cleanupStyles BUG: "+d+" stale rules, inconsistent owner.length:"+a.owner.length);console.warn("cleanupStyles: "+d+" stale rules");do b.deleteRule(d-1);while(d=c.length);a.owner.length=0}else if(a.owner.length)throw Error("cleanupStyles BUG: inconsistent owner.length:"+a.owner.length);};
eq.c.App.prototype.removeStyles=function(a){var b=this.stl,c=b.sheet;b=b.owner;var d=b.length,e=0,f,g;if(-1!==(f=g=b.indexOf(a))){do c.deleteRule(g),e++;while(++f<d&&b[f]===a);b.splice(g,e)}};eq.c.App.prototype.newDialog=function(a){var b=eq.LayoutMode,c=this.layoutMode;void 0!==c&&c&b.inline&&!(c&b.dialog)&&(this.dlg.forEach(eq.c.App.cbInvalidateCloseDlg,this),this.dlg.clear());b=new eq.c.Dlg(a);this.dlg.set(a,b);return b};
eq.c.App.cbInvalidateCloseDlg=function(a){this.api.postMessage({o:eq.ApiOp.invalidate,d:a.id});a.close()};eq.c.App.prototype.newTempDialog=function(a){var b=document.getElementById("eq-temp");if(b)throw Error("newTempDialog BUG: 'eq-temp' already exists");b=document.createElement("DIV");b.id="eq-temp";b.className="eq-dialog eq-hidden eq-container";document.body.appendChild(b);b=new eq.c.Dlg(a);this.dlg.set(a,b);b.temp=!0;return b};eq.c.App.prototype.closeDialog=function(a){this.dlg.delete(a.id);a.close()};
eq.c.App.prototype.topDialog=function(){var a,b,c;if(void 0!==(a=this.wl))for(b=a.length;0<=--b;)if(void 0!==(c=a[b].dlg))return c;return null};eq.c.App.prototype.setCurrDialog=function(a){var b=this.constructor,c=this.currDlg;null!==c&&c!==a&&c.ddo&&(this.focus=this.currDlg=null,this.changed.clear(),this.setIdle(c),c.ddo=void 0);null!==a.w&&a.w.activate()&&b.ttClose();a.visible();this.currDlg=a;(a=a.title||b.title)!==document.title&&(document.title=a,this.updateSessionList())};
eq.c.App.prototype.dialogsVisible=function(){this.dlg.forEach(this.constructor.cbDialogsVisible)};eq.c.App.cbDialogsVisible=function(a){a.visible()};eq.c.App.prototype.startTypeAhead=function(){var a=this.typeAhead,b,c;if(void 0!==a&&!a.active&&null!==(b=this.focus)){if(null===(c=this.currDlg))throw Error("App.startTypeAhead BUG: no current Dialog");a.active=!0;a.dlg=c;a.focus=b}};
eq.c.App.prototype.addTypeAhead=function(a){var b=this.constructor,c=this.typeAhead,d;if(void 0!==c&&c.active){switch(d=a.key){case "Tab":case "Enter":a.shiftKey&&(d="Shift"+d);break;case " ":case "Spacebar":d=" ";break;case "Shift":case "CapsLock":return!1;default:if(1!==d.length||a.ctrlKey||a.altKey||a.metaKey)return b.cancelTypeAhead(),!1}c.buf.push(d);0!==c.timer&&window.clearTimeout(c.timer);c.timer=window.setTimeout(b.cancelTypeAhead,b.timeout.typeAhead);return!0}return!1};
eq.c.App.cancelTypeAhead=function(){var a=eq.app.typeAhead;void 0!==a&&(a.active=!1,a.dlg=null,a.focus=null,a.buf.length=0,0!==a.timer&&(window.clearTimeout(a.timer),a.timer=0))};
eq.c.App.prototype.ttAttach=function(a){if(!a.onmouseenter){var b=this.constructor;if(a.onmouseleave)throw Error("BUG: App.ttAttach id:"+eq.Dom.eqControl(a).id+" event handler in use");a.onmouseenter=b.ttOnMouseEnter;a.onmouseleave=b.ttOnMouseLeave;void 0===this.toolTip&&(this.toolTip={dlg:null,el:null,ed:null,dd:!1,tt:null,ti:0,x:0,y:0,upd:!1})}else if(!a.onmouseleave)throw Error("BUG: App.ttAttach id:"+eq.Dom.eqControl(a).id+" event handler not set");};
eq.c.App.prototype.ttDetach=function(a){if(a.onmouseenter){var b=this.toolTip;if(!a.onmouseleave)throw Error("BUG: App.ttDetach id:"+eq.Dom.eqControl(a).id+" event handler not set");a.onmouseenter=null;a.onmouseleave=null;a.onmousemove=null;b&&b.el===a&&this.constructor.ttClose()}else if(a.onmouseleave)throw Error("BUG: App.ttDetach id:"+eq.Dom.eqControl(a).id+" event handler in use");};
eq.c.App.ttShow=function(){var a=eq.app,b,c,d,e,f,g,h;if(c=a.toolTip){var k=a.constructor;if((g=c.dlg)&&(d=c.ed)&&(b=d.onToolTip(c.el))){var l=eq.Dom;(e=c.tt)?(d=e.style,c.dd?e.classList.add("eq-disabled"):e.classList.remove("eq-disabled")):(c.tt=e=document.createElement("DIV"),e.className="eq-tip",c.dd&&e.classList.add("eq-disabled"),(d=e.style).zIndex=l.zIndexMax(f=document.body)+1,g.copyFontToElement(e)||(h=a.fnDefault)&&l.setFont(e,h)&&l.adjustElementFontSize(e),f.appendChild(e));e.onmouseenter=
k.ttOnMouseEnter;e.onmouseleave=k.ttOnMouseLeave;e.onmousemove=k.ttOnMouseMove;l.setContent(e,b);a=l.viewRect();b=e.getBoundingClientRect();d.maxWidth="";d.maxHeight="";(e=c.x+12)+b.width>=a.x+a.w&&(e=a.x+a.w-b.width-1)<a.x&&(e=a.x+1,d.maxWidth=a.w-2+"px");(g=c.y+12)+b.height>=a.y+a.h&&(g=a.y+a.h-b.height-1)<a.y&&(g=a.y+1,d.maxHeight=a.h-2+"px");d.left=e+"px";d.top=g+"px";c.ti=window.setTimeout(k.ttHide,k.toolTipTimeout.hide);c.upd=!1}else k.ttHide()}};
eq.c.App.ttHide=function(){var a,b;if(a=eq.app.toolTip){if(b=a.el)b.onmousemove=null;if(b=a.tt)b.parentNode.removeChild(b),a.tt=null;if(b=a.ti)window.clearTimeout(b),a.ti=0,a.upd=!1}};eq.c.App.ttClose=function(){var a,b;if(a=eq.app.toolTip){a.dlg=null;a.ed=null;if(b=a.el)b.classList.remove("eq-tt"),b.onmousemove=null,a.el=null;if(b=a.tt)b.parentNode.removeChild(b),a.tt=null;if(b=a.ti)window.clearTimeout(b),a.ti=0,a.upd=!1}};
eq.c.App.prototype.ttDispose=function(){this.constructor.ttClose();this.toolTip=void 0};
eq.c.App.prototype.ttMouseEnter=function(a,b,c,d){var e,f;if(a.classList.contains("eq-tip")){if(!(e=this.toolTip))throw Error("BUG: App.ttOnMouseEnter no current tooltip");if(a!==e.tt)throw Error("BUG: App.ttOnMouseEnter tooltip element mismatch");if(f=e.ti)window.clearTimeout(f),e.ti=0,e.upd=!1;e.x=b;e.y=c}else if(e=this.toolTip){var g=this.constructor;e.x=b;e.y=c;if(b=this.currDlg){if(f=e.ti)window.clearTimeout(f),e.ti=0,e.upd=!1;if(a!==e.el){if(!(f=eq.Dom.eqControl(a))){g.ttClose();return}e.dlg=
b;e.el=a;if(void 0===(e.ed=b.eds.get(b=f.id)))throw Error("BUG: App.ttOnMouseEnter id:"+b+" not registered");e.dd=f.classList.contains("eq-disabled");a.classList.add("eq-tt")}a.onmousemove=g.ttOnMouseMove;0===d&&(a=e.upd=!!e.tt,e.ti=window.setTimeout(g.ttShow,a?g.toolTipTimeout.update:g.toolTipTimeout.show))}}};eq.c.App.ttOnMouseEnter=function(a){var b=eq.app;void 0===b.capture&&(a.stopImmediatePropagation(),b.ttMouseEnter(a.target,a.pageX,a.pageY,void 0!==a.buttons?a.buttons:a.button))};
eq.c.App.ttOnMouseLeave=function(a){var b=eq.app,c=a.target,d,e,f;c.classList.remove("eq-tt");if(void 0===b.capture){a.stopImmediatePropagation();if(d=b.toolTip){d.x=a.pageX;d.y=a.pageY;if(e=d.ti)window.clearTimeout(e),d.ti=0,d.upd=!1;if(d.tt){e=b.constructor;var g=d.upd=!b.idle;d.ti=window.setTimeout(e.ttClose,g?e.toolTipTimeout.update:e.toolTipTimeout.hide)}}for(;(c=c.parentNode)&&c!==document;)if((f=c.classList)&&f.contains("eq-tt")){b.ttMouseEnter(c,d.x,d.y,void 0!==a.buttons?a.buttons:a.button);
break}}};eq.c.App.ttOnMouseMove=function(a){var b=eq.app,c,d;if(void 0===b.capture&&(a.stopImmediatePropagation(),c=b.toolTip))if(c.x=a.pageX,c.y=a.pageY,c.tt){if(!c.upd){if(d=c.ti)window.clearTimeout(d),c.ti=0,c.upd=!1;b.idle||(a=b.constructor,c.ti=window.setTimeout(a.ttHide,a.toolTipTimeout.hide))}}else{if(d=c.ti)window.clearTimeout(d),c.ti=0,c.upd=!1;0===(void 0!==a.buttons?a.buttons:a.button)&&(a=b.constructor,c.ti=window.setTimeout(a.ttShow,a.toolTipTimeout.show))}};
eq.c.App.inject=function(a){var b=a.length;if(!b)return console.error("App.inject() failed, empty URL."),!1;for(var c=this.inject,d=document.head,e=d.getElementsByClassName("eq-inject"),f=0,g=e.length;f<g;f++){var h=e[f];if("SCRIPT"===h.tagName)var k=h.src;else"LINK"===h.tagName&&(k=h.href);if(!((h=k.length)<b)&&(h>b&&(k=k.substring(h-b)),k.toLowerCase()===a.toLowerCase()))return!1}if(/\.js$/i.test(a))return b=document.createElement("SCRIPT"),b.src=a,b.className="eq-inject",c.pending++,b.onload=c.ready,
b.onerror=c.failed,d.appendChild(b),!0;if(/\.css$/i.test(a))return b=document.createElement("LINK"),b.href=a,b.className="eq-inject",b.rel="stylesheet",b.type="text/css",c.pending++,b.onload=c.ready,b.onerror=c.failed,d.appendChild(b),!0;console.error("App.inject("+a+") failed, unknown type.");return!1};eq.c.App.inject.pending=0;
eq.c.App.inject.ready=function(a){a=a.target;var b=--eq.c.App.inject.pending,c,d;a.onload=a.onerror=null;if(0===b)a=eq.app.api,b=eq.ApiOp,void 0!==(c=eq.plugin)&&(d=c.install()).length&&a.postMessage({o:b.installPlugins,p:d}),a.postMessage({o:b.injectDone});else if(0>b)throw Error("BUG App.inject.ready pending:"+b);};eq.c.App.inject.failed=function(a){var b=a.target;b.parentNode.removeChild(b);eq.c.App.inject.ready(a)};
eq.c.App.dlgListener=function(){var a=eq.app.currApp,b;return a&&(b=/^.+?:([0-9]+)$/.exec(a))?b[1]:null};eq.c.App.dlgListener.message=function(){var a=this();a?(eq.app.dlgListen=!0,new eq.c.MessageDialog(eq.strings.get("message.dlgListen")+" <b>"+a+"</b>",0,this.canceled)):eq.app.dlgListen=!0};eq.c.App.dlgListener.close=function(){var a=eq.app;a.dlgListen&&(a.dlgListen=!1,eq.c.MessageDialog.close())};eq.c.App.dlgListener.canceled=function(){var a=eq.app;a.dlgListen&&a.api.postMessage({o:eq.ApiOp.closeWebSocket})};
eq.c.App.beep=function(){try{var a=document.getElementById("eq-beep");a||(a=document.createElement("AUDIO"),a.id="eq-beep",a.src="eq-webdlg-beep.mp3",document.body.appendChild(a));a.play()}catch(b){console.error("beep "+b.name+": "+b.message)}};eq.c.App.playSound=function(a){try{var b=document.getElementById("eq-sound");b||(b=document.createElement("AUDIO"),b.id="eq-sound",document.body.appendChild(b));b.src=a;b.play()}catch(c){console.error("playSound '"+a+"' "+c.name+": "+c.message)}};
eq.c.App.warnWhenLeavingPage=function(a){a&&eq.app.warnLeavingPage?window.addEventListener("beforeunload",this.onBeforeUnload,!0):window.removeEventListener("beforeunload",this.onBeforeUnload,!0)};eq.c.App.onBeforeUnload=function(a){a.preventDefault();return a.returnValue="Do you want to leave this page? This will terminate the running program."};
eq.c.App.onWindowMessage=function(a){var b=eq.app,c,d,e,f,g,h;if(!b.idle&&(c=b.currDlg)&&Array.isArray(d=a.data)&&2===d.length&&(e=d[0])&&(f=d[1])&&(g=document.getElementById(e))&&void 0!==(h=c.eds.get(e)))h.onMessage(c,e,g,f)};
eq.redirected||function(){var a=eq.c.App;eq.app=new a;try{var b=/(\?[^#]+)/.exec(window.location.href)[1];if(b){for(var c=/[?&]([^=]+)=([^&]*)/g,d,e;d=c.exec(b);)void 0===e&&(e={}),e[d[1]]=d[2];a.args=e}}catch(f){}window.addEventListener("blur",a.onCancelUserAction,!0);window.addEventListener("click",a.onGlobalMouseDownOrClick,!0);window.addEventListener("contextmenu",a.onGlobalContextMenu,!0);window.addEventListener("dblclick",a.onGlobalMouseDoubleClick,!0);window.addEventListener("dragend",a.onGlobalDragEnd,
!0);window.addEventListener("focus",a.onCancelUserAction,!0);window.addEventListener("keydown",a.onGlobalKeyDown,!0);window.addEventListener("keyup",a.onGlobalKeyUp,!0);window.addEventListener("message",a.onWindowMessage,!0);window.addEventListener("mousedown",a.onGlobalMouseDownOrClick,!0);window.addEventListener("mouseup",a.onGlobalMouseUp,!0);window.addEventListener("pagehide",a.onGlobalPageHide,!0);window.addEventListener("resize",a.onCancelUserAction,!0);window.addEventListener("storage",a.onStorageModified);
a.apiStart();"loading"===document.readyState?window.addEventListener("DOMContentLoaded",a.domReady):a.domReady()}();eq.start=function(a,b){if(document.documentElement.classList.contains("eq-webdlg"))return!1;var c=eq.c.App,d;if(c.documentComplete)return!1;(d=eq.app).currApp=a;d.args=b;c.start();return!0};
//# sourceMappingURL=eq-webdlg-ui.src.map
