/* @license Copyright (C) Exontrol. All rights reserved. */ !function(t,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):(t="undefined"!=typeof globalThis?globalThis:t||self,o(t.exontrol||{}))}(this,function(t){"use strict";function o(t){return function(t,o,e){for(;~t.indexOf(o);)t=t.repAll(o,e);return t}(t,y,d).trim()}function e(t){return Math.round(t)}function n(){return Math.max.apply(0,arguments)}function i(){return Math.min.apply(null,arguments)}function r(t,e){return o(s(t,e)+d+e)}function s(t,e){return o(t.repAll(e,""))}function h(t,o,e){e=e||this;var n=u.CC.c2CC(t);return n&&n.rgC.forEachU(function(t){if(t=function(t){return t.oT||t}(t))return o.call(e,t)})}function l(t){return t.oB&&t.oB.oHE||t.oHE}function c(t){return h(l(t),function(t){return t})}var u=u||window.exontrol,p=u.G,a="exd2-hide",f="exd2-show",d=" ",y=" ",C=1234;u.Def.ComboBox={},u.Shapes.ComboBox={},u.Mrg(u,function(){function t(t,o){this.init(t,o)}return t.version="3.0",t.type="ComboBox",t.XML=function(){function t(t){return null!=t?t.toLowerCase():t}function o(e){var n,i,r="^"==e.charAt(0);r&&(e=e.substr(1)),~(n=e.indexOf("/"))&&(i=e.substr(n+1),e=e.substr(0,n));for(var s,h=function(o){o=t(o);for(var e,n=[],i=0,r=this.getElementsByTagName("*"),s=r.length;i>=8))+",",n+=(255&(t>>=8))+")"),n||o}}}(),t.allowRurPart=function(t,o,e){return!e||!o||o.indexOf(t)>=0&&(!function(t){return t.split(",").forEachU(function(t){return this.has(t)},this)}.call(e,o)||e.has(t))},t.Options={tfi:null,locked:null,readOnly:null,readOnly:!1,shapes:null,cursors:null,zoom:null,formatText:null,pad:null,allowActions:null,toolTipDelay:null,toolTipPopDelay:null,toolTipWidth:null,label:null,host:null,allowDrop:null,align:null,dropDown:null,allowResize:null,showClearButton:null},t.bSCTX=function(t,o,e,n){var i;return o&&(t.drawShape(e,o,n),i=u.TFI.bCTX(t,o.tfi),null!=o.opacity&&((i=i||{}).opacity=t.globalAlpha,t.globalAlpha=o.opacity)),i},t.eSCTX=function(t,o){null!=o.opacity&&(t.globalAlpha=o.opacity),o instanceof u.TFI&&u.TFI.eCTX(t,o)},t.prototype.init=function(o,e){this.lnt=this.lnt||0,this.lnt++,this.oD2B=null,this.oCB=null,this.oCV=null,this.rgCV=[],this.iLts(),this.oCW=new u.CW(o,{AllowXChg:0}),this.oCW.oT=this,this.Shortcuts=this.oCW.oSts,this.initCW(),this.import(),u.expO(t.Options,this,this.oCV),this.cwbU(),this.SetOptions(e,!0),this.cweU(),u.DPR.Reg(this),--this.lnt},t.prototype.GetCanvas=function(){return this.oCW.GetCanvas()},t.prototype.defAA=function(){return"d2,d2(double)"},t.prototype.roAA=function(){return""},t.prototype.allP=function(){return"view(ComboBox.CV)"},t.prototype.lRA=function(t){this.oCW.lRA(t)},t.prototype.feCV=function(t,o){u.ComboBox.CV.prototype[t]?this.rgCV.forEach(function(o){o[t].call(o)},this):this.rgCV.forEach(t,o)},t.prototype.feCVU=function(t,o){return u.ComboBox.CV.prototype[t]?this.rgCV.forEachU(function(o){o[t].call(o)},this):this.rgCV.forEachU(t,o)},t.prototype.BeginUpdate=function(){this.oCW.CWs().forEach(function(t){t.bU()})},t.prototype.bU=t.prototype.cwbU=t.prototype.BeginUpdate,t.prototype.EndUpdate=function(){1==this.oCW.lR&&this.fU(),this.oCW.CWs().forEach(function(t){t.eU()})},t.prototype.eU=t.prototype.cweU=t.prototype.EndUpdate,t.prototype.Update=function(t,o){this.bU(),t&&t.call(o||this),this.eU()},t.prototype.fU=function(){},t.prototype.Refresh=function(){this.bU(),this.onRL(),this.eU()},t.prototype.onRL=function(){},t.prototype.iLts=function(){this.Listeners=this.oLts=new u.Lts,this.oLts.add("onclick"),this.oLts.add("onanchorclick"),this.oLts.add("ond2"),this.oLts.add("onclear")},t.prototype.addCV=function(t,o){var e=null;if(null!=t&&t.trim().length||(t="combobox"+this.rgCV.length),!this.oCW.W(t)){var n=!this.rgCV.length,i=(this.oCW.W("main")||this.oCW).Add(t,u.Mrg({Dock:n?5:4,Size:256},o));e=new u.ComboBox.CV(this),this.rgCV.push(e),this.oCV=this.oCV||e,!(i.GetDock()%2)&&i.SetPosition(this.oCW.W("combobox").GetPosition()+1),i.Add("client",{Dock:5,Control:e})}return e},t.prototype.delCV=function(t){null!=t&&t.trim().length||(t=this.rgCV[this.rgCV.length-1].oW.opW.GetName());var o=!1,e=this.oCW.W(t);if(e){var n=null,i=this.oCW.W(e.GetName()+".client");if(i&&(n=i.GetC())instanceof u.ComboBox.CV&&n!=this.oCV){var r=this.rgCV.indexOf(n);(o=r>=0)&&(this.rgCV.splice(r,1),this.oCW.Remove(e))}}return o},t.prototype.initCW=function(){var t,o=this,e=this.oCW;this.oCW.canvas.addEventListener("dragover",this.localdragover=function(t){return o.ondragover(t)}),this.oCW.canvas.addEventListener("drop",this.localdrop=function(t){return o.ondrop(t)}),this.oCW.SetClientRect=function(t){return function(){t.apply(this,arguments)}}(this.oCW.SetClientRect),(e=e.Add("control",{Dock:5})).Add("d2b",{Dock:4,Size:24,Resizable:!1,DrawWindowFrame:!1,Control:this.oD2B=new u.ComboBox.D2B(this)}),t=e.Add("cb",{Dock:4,Size:24,Resizable:!1,DrawWindowFrame:!1,Control:this.oCB=new u.ComboBox.CB(this)}),e.Add("main",{Dock:5,HoverExtends:"control,cb"}),this.addCV("combobox"),t.GetVisible=this.oCV.showCB.bind(this.oCV),this.oD2B.import(),this.oCB.import()},t.prototype.w2P=function(t){function o(){function t(t){var o=[];return u.B.split(t).forEach(function(t){t.caption&&t.subText&&o.push({n:t.caption,p:function(t){var o=u;return t.split(".").forEach(function(t){o=o[t]}),o.prototype}(t.subText)})}),o}return this._allP||(this._allP=t.call(this,this.allP()))}var e,n=t&&t.oC&&Object.getPrototypeOf(t.oC);if(n)for(var i,r=o.call(this),s=0,h=r.length;!e&&se?0:(o[3]-c)/2),~~(l+1),c]||null})}.call(this),onpaint:function(t,o){this.ctxTfi(function(t){n(i,t,o,r)},this,t)},thisArg:this}},{thisArg:this,ttO:i.o,ttD:this.getToolTipDelay(),ttP:this.getToolTipPopDelay()})}},t.prototype.xA=function(){u.A.Cancel("ss*")},t.prototype.ondown=function(t){return this.isSelectable()&&(this.xA(),this.gAA().Do(this,t),!u.RUR.Rng()&&this.doRUR(t,function(t){switch(t.drag.status){case 4:case 5:this.rurActionClick(null,t)}},this)),!0},t.prototype.doRUR=function(t,o,e,n){var i,r,s=this.gAA(),h=this.oT.lRA.bind(this.oT);return u.RUR.Do(t,function(t){switch(r=t.drag.status){case 1:h(7),i=this.oT.oRUR=this.e2RUR(t),this.lRURLong&&t.drag.setCursor(u.GP.Get("long",this.getCursors()));break;case 3:s.CanDo(t,1)&&(u.RUR.Cancel(),this.norurAction(t,1)||(this.lRURLong=(this.lRURLong||0)+1,s.Do(this,t,1),--this.lRURLong));break;case 5:this.norurAction(t,2);break;case 2:case 6:h(4)}!(i&&i.c&&i.c.bRUR&&i.c.bRUR(t))&&o.call(e,t),i&&i.c&&i.c.eRUR&&i.c.eRUR(t),7==r&&(i&&(i=this.oT.oRUR=null),h(t.drag.click||t.drag.long?46:62))},this,n)},t.toClick=function(t){return{dblClick:t.drag&&(t.drag.long||1!=t.drag.click)||!1,button:u.e2B(t),modifiers:u.ModK(t)}},t.prototype.toClick=function(t,o){},t.prototype.onA=function(t,o){if(t){u.H.VisitA(this,t),this.inv();var e=c(this.getHost());e&&e.Refresh&&e.Refresh(),this.onanchorclick(t)}},t.prototype.onClick=function(o){var e=t.toClick(o),n=this.e2V(o),i=this.gPtr(o);n&&(e.view=n,n.toClick&&n.toClick(o,e)),this.onA(this.p2A(i),e),this.onclick(e)},t.prototype.onclick=function(t){this.oLts.onclick.do(t)},t.prototype.onanchorclick=function(t){this.oLts.onanchorclick.do(t)},t.prototype.onDblClk=function(t){this.gAA().CanDo(t,2,"d2")&&this.setTimeout(function(){this.d2(!0)})},t.prototype.ond2=function(){this.oLts.ond2.do()},t.prototype.isD2V=function(){var t=this.getHost().oHE;return t&&~t.className.indexOf(f)||!1},t.prototype.d2=function(t){function o(t){for(var o=u.CSSzom(t),e=u.Ert(t),n=0;n<4;n++)e[n]*=o;return e}function e(t){var e,n,i,h,l=this.getHost(),c=l.oHE;c&&(t=!!t,!!this.isD2V(t)!=t&&(this.grtD2(l),c.className=t?function(t){return r(s(t,a),f)}(c.className):function(t){return r(s(t,f),a)}(c.className),t&&(e=o(this.GetCanvas()),n=o(c),i=this.getAlign(),n=u.G.C2R(u.G.R2C(e,i[0]),n[2],n[3],i[1]),u.FRt(n,u.pgrt()),(h=c.style).left=u.toU(n[0]),h.top=u.toU(n[1]))))}!t||!(C?0:C=1+u.Tick()%3321)&&!function(){var t="pmgi",o=u[t+="rwi"].call(u);return!(u.iL()&&(!o||!o.k))}()||(C+=C>>2)%4||(t=!1),e.call(this,t)},t.prototype.onclear=function(){this.d2(!1),this.oLts.onclear.do()},t.prototype.clear=function(){var t=this.getHost();this.bU(),this.SetLabel(""),t.sCB&&t.sCB(!0,this),this.eU()},t.prototype.e2RUR=function(t){var o=this.gPtr(t),e=this.e2W(t)||this.oW,n=e.GetClientRect();return{w:e,c:e.oC,x:p.X(o)-n[0],y:p.Y(o)-n[1]}},t.prototype.allowRur=function(t,o){return null!=t},t.prototype.rurAction=function(t,o,e){var n={rurName:t,rurFlags:o,rurOnlyW:this.e2W(e),rurStatus:function(o){this.rurActionClick(t,o)}};if(this.allowRur(e,n)){var i="rur"+u.getP(function(t){for(var o,e="",n=0,i=t.length;n=o[e])for(;t>=o[e+1]&&e"+t+":"+(e(this.gCtx().fontHeight())+2)+" "+o),o},t.prototype.isDef=function(){return this==this.oT.oCV},t.prototype.GetAllowDrop=function(){return this.oO.allowDrop},t.prototype.SetAllowDrop=function(t){this.oO.allowDrop=t},t.prototype.getAllowDrop=function(){return this.opt("allowDrop",!1)},t.prototype.GetTfi=function(){return this.oO.tfi},t.prototype.SetTfi=function(t){this.cwbU(),this.oO.tfi=t||null,this.nFH=0,this.onRL(),this.cweU()},t.prototype.getTfi=function(){return this.opt("tfi")},t.prototype.getFH=function(){return this.nFH||(this.nFH=function(){return this.ctxTfi(function(t){return t.fontHeight()})}.call(this))},t.prototype.ctxTfi=function(t,o,e){var n,i;return(e=e||this.gCtx())&&(n=u.TFI.bCTX(e,this.getTfi()),i=t.call(o||this,e),u.TFI.eCTX(e,n)),i},t.prototype.getFont=function(){return this.ctxTfi(function(t){return u.GetFont(t)})},t.prototype.GetLocked=function(){return this.oO.locked},t.prototype.SetLocked=function(t){this.cwbU(),this.oO.locked=t,this.onRL(),this.cweU()},t.prototype.getLocked=function(){return this.opt("locked",!1)},t.prototype.GetReadOnly=function(){return this.oO.readOnly},t.prototype.SetReadOnly=function(t){this.cwbU(),this.oAA=null,this.oO.readOnly=t,this.onRL(),this.uH(),this.cweU()},t.prototype.isReadOnly=function(){return this.opt("readOnly",!1)},t.prototype.GetShapes=function(){return this.oO.shapes},t.prototype.SetShapes=function(t){this.cwbU(),this.sShs=null,this.oO.shapes=t,this.onRL(),this.cweU()},t.prototype.defShp=function(){return'Button(button),{"normal":{"text":"▼"},"hover":{"fillColor":"#B2B2B2"}}(button),{"normal":{"text":"✖"}}(clear)'},t.prototype.getShapes=function(){var t=this.sShs;return null==t&&(null==(t=this.GetShapes())&&(t=u.Def.ComboBox.shapes),t=u.ToS(t,this.defShp()),this.sShs=t),t},t.prototype.toShapes=function(o){return o&&u.S.GetOf(o.GetShape&&o.GetShape()||t.typeOf(o),this.getShapes(),"ComboBox")||null},t.prototype.toShape=function(t,o){var e=this.toShapes(t),n=e&&e.normal||e;return n&&o&&e&&e.disabled&&(n=u.Inh(e.disabled,n)),n},t.prototype.GetCursors=function(){return this.oO.cursors},t.prototype.SetCursors=function(t){this.cwbU(),this.sCrs=null,this.oO.cursors=t,this.onRL(),this.cweU()},t.prototype.defCrs=function(){return"pointer(drag-drop,button,clear,anchor)"},t.prototype.getCursors=function(){var t=this.sCrs;return null==t&&(null==(t=this.GetCursors())&&(t=u.Def.ComboBox.cursors),t=u.ToS(t,this.defCrs()),this.sCrs=t),t},t.prototype.GetFormatText=function(){return this.oO.formatText},t.prototype.SetFormatText=function(t){this.cwbU(),this.nFT=null,this.oO.formatText=t,this.onRL(),this.cweU()},t.prototype.getFormatText=function(){return null==this.nFT&&(this.nFT=function(t,o,e){return null==t?~~e:u.s2F(t,o)}(this.opt("formatText"),u.DrawTextFormatEnum,u.DrawTextFormatEnum.exTextAlignLeft|u.DrawTextFormatEnum.exTextAlignVCenter|u.DrawTextFormatEnum.exTextWordBreak|u.DrawTextFormatEnum.exTextWordEllipsis)),this.nFT},t.prototype.GetPad=function(){return this.oO.pad},t.prototype.SetPad=function(t){this.cwbU(),this.rgPad=null,this.oO.pad=t,this.onRL(),this.cweU()},t.prototype.getPad=function(){return null==this.rgPad&&(this.rgPad=u.pad2A(this.opt("pad",[2,2]))),this.rgPad},t.prototype.GetAllowActions=function(){return this.oO.allowActions},t.prototype.SetAllowActions=function(t){this.cwbU(),this.oAA=null,this.oO.allowActions=t,this.cweU()},t.prototype.gAA=function(){return this.oAA||(this.oAA=new u.AA(this.opt("allowActions",this.oT.defAA()),this.isReadOnly()?this.oT.roAA():"")),this.oAA},t.prototype.GetToolTipDelay=function(){return this.oO.toolTipDelay},t.prototype.SetToolTipDelay=function(t){this.oO.toolTipDelay=t},t.prototype.getToolTipDelay=function(){return this.opt("toolTipDelay",500)},t.prototype.GetToolTipPopDelay=function(){return this.oO.toolTipPopDelay},t.prototype.SetToolTipPopDelay=function(t){this.oO.toolTipPopDelay=t},t.prototype.getToolTipPopDelay=function(){return this.opt("toolTipPopDelay",5e3)},t.prototype.GetToolTipWidth=function(){return this.oO.toolTipWidth},t.prototype.SetToolTipWidth=function(t){this.oO.toolTipWidth=t},t.prototype.getToolTipWidth=function(){return this.opt("toolTipWidth",-1)},t.prototype.allowTT=function(){return u.TT&&this.getToolTipWidth()&&this.getToolTipPopDelay()},t.prototype.GetLabel=function(){return this.oO.label},t.prototype.SetLabel=function(t){this.bU(),this.oO.label=t,this.eU()},t.prototype.getLabel=function(){var t=this.getHost().oHE;return u.ToS(this.opt("label"))||!t&&"no host is set"||""},t.prototype.GetHost=function(){return this.oO.host},t.prototype.SetHost=function(t){function o(){var t,o,s,c=this.getHost();(t=c.oHE)&&(this.grtD2(c,!0),o=l(c),c.hed=function(t){n=e.call(this,t)}.bind(this),u.win.addEventListener("pointerdown",c.hed),u.win.addEventListener("mousedown",c.hed),c.heu=function(t){if(this.isD2V()){var o,r=e.call(this,t),s=this.getHost();(o=(!n||2!=n.h)&&r.h<0)||(o=!n||n.h<1)||(o=!n||2==n.h&&!u.ModK(t)&&n.x==r.x&&n.y==r.y&&r.s0&&1&this.getShowClearButton()},t.prototype.sCBh=function(){return this.getShowClearButton()>0&&2&this.getShowClearButton()},t.prototype.showCB=function(){var t,o=this.getShowClearButton();return this.isCBr()&&(o=(t=this.getHost()).sCB&&t.sCB(!1,this)),!!o},o.prototype.init=function(t){this.oT=t,this.oLts=t.oLts,this.lI=0},u.SB.addProto(o.prototype),u.SB.addProto(o.prototype,t.prototype,"import,GetClientRect,SetClientRect,onmousemove"),o.prototype.n={s:"button",c:"button"},o.prototype.onSetAO=function(t){if(this.isSelectable()&&!t.hasOf(this)){function o(t,o){return u.PInR(t,o,e.rtB())&&e.isAP(t,o)}var e=this,n=u.Def.ScrollBar.SmoothScroll,i=n.duration,r=n.transition,s=e.toShapes(this.n.s);s&&(!u.EyO(s.hover)&&t.set({owner:e,id:this.idAOH||(this.idAOH={}),inv:e.inv,hitTest:o,duration:i,transition:r}),!u.EyO(s.click)&&t.set({owner:e,id:this.idAOC||(this.idAOC={}),inv:e.inv,hitTest:o,actOn:4,duration:i,transition:r}))}},o.prototype.draw=function(t,o,e){this.drawB(t,this.rtB(),this.gAO())},o.prototype.drawB=function(t,o,e){var n,i=this.toShapes(this.n.s)||{},r=i.normal||i;!this.isSelectable()?u.EyO(i.disabled)||(r=u.Inh(i.disabled,r)):e&&(u.EyO(i.hover)||(n=e.get(this,this.idAOH))&&(r=u.R.Shape(n.state,n.range,{from:r,to:i.hover})),u.EyO(i.click)||(n=e.get(this,this.idAOC))&&(r=u.R.Shape(n.state,n.range,{from:r,to:i.click})));var s=u.ComboBox.bSCTX(t,r,o);s&&u.ComboBox.eSCTX(t,s)},o.prototype.rtB=function(){var t=this.GetClientRect(),o=i(t[2],t[3])-2;return u.G.C2R(u.G.R2C(t),o,o)},o.prototype.isSelectable=function(){return u.SB.prototype.isSelectable.call(this)&&this.gAA().Has("d2")},o.prototype.getCursor=function(t){return this.isSelectable()&&u.PInR(p.X(t),p.Y(t),this.rtB())&&u.GP.Get(this.n.c,this.getCursors())||null},o.prototype.allowTT=function(){},o.prototype.dCV=function(){return this.oT.oCV},o.prototype.ondown=function(t){return this.dCV().ondown(t)},o.prototype.rurD2=function(t,o){var e,n,i=this.gPtr(t);u.PInR(p.X(i),p.Y(i),this.rtB())&&u.RUC(t,function(t){t.drag.click&&(n=this.dCV(),e=!n.isD2V(),n.d2(e),e&&n.ond2())},this)},Object.addPrototypeOf(d.prototype,o.prototype),d.prototype.n={s:"clear",c:"clear"},d.prototype.isSelectable=function(){return u.SB.prototype.isSelectable.call(this)},d.prototype.ondown=function(t){var o,e=this.gPtr(t);u.PInR(p.X(e),p.Y(e),this.rtB())&&u.RUC(t,function(t){t.drag.click&&((o=this.dCV()).clear(),o.getHost().sel=-1,o.Refresh(),o.onclear())},this)},{CV:t,D2B:o,CB:d}}()),t.ComboBox=u.ComboBox});