@enonic/page-editor 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/LICENSE.txt +674 -0
  2. package/dist/fonts/OpenSans.woff2 +0 -0
  3. package/dist/fonts/icomoon.woff +0 -0
  4. package/dist/fonts/icomoon.woff2 +0 -0
  5. package/dist/index.cjs +14 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +37611 -0
  9. package/dist/main.css +1 -0
  10. package/dist/page-editor/ComponentItemType.d.ts +6 -0
  11. package/dist/page-editor/ComponentItemType.d.ts.map +1 -0
  12. package/dist/page-editor/ComponentView.d.ts +84 -0
  13. package/dist/page-editor/ComponentView.d.ts.map +1 -0
  14. package/dist/page-editor/ComponentViewContextMenuTitle.d.ts +7 -0
  15. package/dist/page-editor/ComponentViewContextMenuTitle.d.ts.map +1 -0
  16. package/dist/page-editor/ContentBasedComponentView.d.ts +10 -0
  17. package/dist/page-editor/ContentBasedComponentView.d.ts.map +1 -0
  18. package/dist/page-editor/CreateItemViewConfig.d.ts +28 -0
  19. package/dist/page-editor/CreateItemViewConfig.d.ts.map +1 -0
  20. package/dist/page-editor/CreateTextComponentViewConfig.d.ts +8 -0
  21. package/dist/page-editor/CreateTextComponentViewConfig.d.ts.map +1 -0
  22. package/dist/page-editor/Cursor.d.ts +11 -0
  23. package/dist/page-editor/Cursor.d.ts.map +1 -0
  24. package/dist/page-editor/DescriptorBasedComponentView.d.ts +18 -0
  25. package/dist/page-editor/DescriptorBasedComponentView.d.ts.map +1 -0
  26. package/dist/page-editor/DescriptorBasedComponentViewPlaceholder.d.ts +6 -0
  27. package/dist/page-editor/DescriptorBasedComponentViewPlaceholder.d.ts.map +1 -0
  28. package/dist/page-editor/DragAndDrop.d.ts +74 -0
  29. package/dist/page-editor/DragAndDrop.d.ts.map +1 -0
  30. package/dist/page-editor/DragPlaceholder.d.ts +20 -0
  31. package/dist/page-editor/DragPlaceholder.d.ts.map +1 -0
  32. package/dist/page-editor/Highlighter.d.ts +27 -0
  33. package/dist/page-editor/Highlighter.d.ts.map +1 -0
  34. package/dist/page-editor/ItemView.d.ts +166 -0
  35. package/dist/page-editor/ItemView.d.ts.map +1 -0
  36. package/dist/page-editor/ItemViewContextMenuPosition.d.ts +6 -0
  37. package/dist/page-editor/ItemViewContextMenuPosition.d.ts.map +1 -0
  38. package/dist/page-editor/ItemViewFactory.d.ts +15 -0
  39. package/dist/page-editor/ItemViewFactory.d.ts.map +1 -0
  40. package/dist/page-editor/ItemViewId.d.ts +12 -0
  41. package/dist/page-editor/ItemViewId.d.ts.map +1 -0
  42. package/dist/page-editor/ItemViewIdProducer.d.ts +6 -0
  43. package/dist/page-editor/ItemViewIdProducer.d.ts.map +1 -0
  44. package/dist/page-editor/ItemViewPlaceholder.d.ts +10 -0
  45. package/dist/page-editor/ItemViewPlaceholder.d.ts.map +1 -0
  46. package/dist/page-editor/LiveEditPage.d.ts +42 -0
  47. package/dist/page-editor/LiveEditPage.d.ts.map +1 -0
  48. package/dist/page-editor/PageEditor.d.ts +5 -0
  49. package/dist/page-editor/PageEditor.d.ts.map +1 -0
  50. package/dist/page-editor/PagePlaceholder.d.ts +16 -0
  51. package/dist/page-editor/PagePlaceholder.d.ts.map +1 -0
  52. package/dist/page-editor/PagePlaceholderInfoBlock.d.ts +12 -0
  53. package/dist/page-editor/PagePlaceholderInfoBlock.d.ts.map +1 -0
  54. package/dist/page-editor/PageView.d.ts +94 -0
  55. package/dist/page-editor/PageView.d.ts.map +1 -0
  56. package/dist/page-editor/RegionPlaceholder.d.ts +5 -0
  57. package/dist/page-editor/RegionPlaceholder.d.ts.map +1 -0
  58. package/dist/page-editor/RegionView.d.ts +77 -0
  59. package/dist/page-editor/RegionView.d.ts.map +1 -0
  60. package/dist/page-editor/RegionViewContextMenuTitle.d.ts +5 -0
  61. package/dist/page-editor/RegionViewContextMenuTitle.d.ts.map +1 -0
  62. package/dist/page-editor/SelectedHighlighter.d.ts +9 -0
  63. package/dist/page-editor/SelectedHighlighter.d.ts.map +1 -0
  64. package/dist/page-editor/Shader.d.ts +42 -0
  65. package/dist/page-editor/Shader.d.ts.map +1 -0
  66. package/dist/page-editor/fragment/FragmentComponentView.d.ts +21 -0
  67. package/dist/page-editor/fragment/FragmentComponentView.d.ts.map +1 -0
  68. package/dist/page-editor/fragment/FragmentItemType.d.ts +8 -0
  69. package/dist/page-editor/fragment/FragmentItemType.d.ts.map +1 -0
  70. package/dist/page-editor/fragment/FragmentPlaceholder.d.ts +18 -0
  71. package/dist/page-editor/fragment/FragmentPlaceholder.d.ts.map +1 -0
  72. package/dist/page-editor/layout/LayoutComponentView.d.ts +25 -0
  73. package/dist/page-editor/layout/LayoutComponentView.d.ts.map +1 -0
  74. package/dist/page-editor/layout/LayoutItemType.d.ts +8 -0
  75. package/dist/page-editor/layout/LayoutItemType.d.ts.map +1 -0
  76. package/dist/page-editor/layout/LayoutPlaceholder.d.ts +7 -0
  77. package/dist/page-editor/layout/LayoutPlaceholder.d.ts.map +1 -0
  78. package/dist/page-editor/part/PartComponentView.d.ts +12 -0
  79. package/dist/page-editor/part/PartComponentView.d.ts.map +1 -0
  80. package/dist/page-editor/part/PartItemType.d.ts +8 -0
  81. package/dist/page-editor/part/PartItemType.d.ts.map +1 -0
  82. package/dist/page-editor/part/PartPlaceholder.d.ts +7 -0
  83. package/dist/page-editor/part/PartPlaceholder.d.ts.map +1 -0
  84. package/dist/page-editor/text/TextComponentView.d.ts +33 -0
  85. package/dist/page-editor/text/TextComponentView.d.ts.map +1 -0
  86. package/dist/page-editor/text/TextItemType.d.ts +10 -0
  87. package/dist/page-editor/text/TextItemType.d.ts.map +1 -0
  88. package/dist/page-editor/text/TextPlaceholder.d.ts +5 -0
  89. package/dist/page-editor/text/TextPlaceholder.d.ts.map +1 -0
  90. package/package.json +96 -0
package/dist/index.cjs ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});const $=require("jquery");function getDefaultExportFromCjs(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x.default:x}__name(getDefaultExportFromCjs,"getDefaultExportFromCjs");var jqueryUi={},hasRequiredJqueryUi;function requireJqueryUi(){return hasRequiredJqueryUi||(hasRequiredJqueryUi=1,(function(factory){factory($)})(function($2){$2.ui=$2.ui||{},$2.ui.version="1.14.1";var widgetUuid=0,widgetHasOwnProperty=Array.prototype.hasOwnProperty,widgetSlice=Array.prototype.slice;$2.cleanData=(function(orig){return function(elems){var events,elem,i;for(i=0;(elem=elems[i])!=null;i++)events=$2._data(elem,"events"),events&&events.remove&&$2(elem).triggerHandler("remove");orig(elems)}})($2.cleanData),$2.widget=function(name,base,prototype){var existingConstructor,constructor,basePrototype,proxiedPrototype={},namespace=name.split(".")[0];if(name=name.split(".")[1],name==="__proto__"||name==="constructor")return $2.error("Invalid widget name: "+name);var fullName=namespace+"-"+name;return prototype||(prototype=base,base=$2.Widget),Array.isArray(prototype)&&(prototype=$2.extend.apply(null,[{}].concat(prototype))),$2.expr.pseudos[fullName.toLowerCase()]=function(elem){return!!$2.data(elem,fullName)},$2[namespace]=$2[namespace]||{},existingConstructor=$2[namespace][name],constructor=$2[namespace][name]=function(options,element){if(!this||!this._createWidget)return new constructor(options,element);arguments.length&&this._createWidget(options,element)},$2.extend(constructor,existingConstructor,{version:prototype.version,_proto:$2.extend({},prototype),_childConstructors:[]}),basePrototype=new base,basePrototype.options=$2.widget.extend({},basePrototype.options),$2.each(prototype,function(prop,value){if(typeof value!="function"){proxiedPrototype[prop]=value;return}proxiedPrototype[prop]=(function(){function _super(){return base.prototype[prop].apply(this,arguments)}__name(_super,"_super");function _superApply(args){return base.prototype[prop].apply(this,args)}return __name(_superApply,"_superApply"),function(){var __super=this._super,__superApply=this._superApply,returnValue;return this._super=_super,this._superApply=_superApply,returnValue=value.apply(this,arguments),this._super=__super,this._superApply=__superApply,returnValue}})()}),constructor.prototype=$2.widget.extend(basePrototype,{widgetEventPrefix:existingConstructor&&basePrototype.widgetEventPrefix||name},proxiedPrototype,{constructor,namespace,widgetName:name,widgetFullName:fullName}),existingConstructor?($2.each(existingConstructor._childConstructors,function(i,child){var childPrototype=child.prototype;$2.widget(childPrototype.namespace+"."+childPrototype.widgetName,constructor,child._proto)}),delete existingConstructor._childConstructors):base._childConstructors.push(constructor),$2.widget.bridge(name,constructor),constructor},$2.widget.extend=function(target){for(var input=widgetSlice.call(arguments,1),inputIndex=0,inputLength=input.length,key,value;inputIndex<inputLength;inputIndex++)for(key in input[inputIndex])value=input[inputIndex][key],widgetHasOwnProperty.call(input[inputIndex],key)&&value!==void 0&&($2.isPlainObject(value)?target[key]=$2.isPlainObject(target[key])?$2.widget.extend({},target[key],value):$2.widget.extend({},value):target[key]=value);return target},$2.widget.bridge=function(name,object){var fullName=object.prototype.widgetFullName||name;$2.fn[name]=function(options){var isMethodCall=typeof options=="string",args=widgetSlice.call(arguments,1),returnValue=this;return isMethodCall?!this.length&&options==="instance"?returnValue=void 0:this.each(function(){var methodValue,instance=$2.data(this,fullName);if(options==="instance")return returnValue=instance,!1;if(!instance)return $2.error("cannot call methods on "+name+" prior to initialization; attempted to call method '"+options+"'");if(typeof instance[options]!="function"||options.charAt(0)==="_")return $2.error("no such method '"+options+"' for "+name+" widget instance");if(methodValue=instance[options].apply(instance,args),methodValue!==instance&&methodValue!==void 0)return returnValue=methodValue&&methodValue.jquery?returnValue.pushStack(methodValue.get()):methodValue,!1}):(args.length&&(options=$2.widget.extend.apply(null,[options].concat(args))),this.each(function(){var instance=$2.data(this,fullName);instance?(instance.option(options||{}),instance._init&&instance._init()):$2.data(this,fullName,new object(options,this))})),returnValue}},$2.Widget=function(){},$2.Widget._childConstructors=[],$2.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:__name(function(options,element){element=$2(element||this.defaultElement||this)[0],this.element=$2(element),this.uuid=widgetUuid++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=$2(),this.hoverable=$2(),this.focusable=$2(),this.classesElementLookup={},element!==this&&($2.data(element,this.widgetFullName,this),this._on(!0,this.element,{remove:__name(function(event){event.target===element&&this.destroy()},"remove")}),this.document=$2(element.style?element.ownerDocument:element.document||element),this.window=$2(this.document[0].defaultView||this.document[0].parentWindow)),this.options=$2.widget.extend({},this.options,this._getCreateOptions(),options),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},"_createWidget"),_getCreateOptions:__name(function(){return{}},"_getCreateOptions"),_getCreateEventData:$2.noop,_create:$2.noop,_init:$2.noop,destroy:__name(function(){var that=this;this._destroy(),$2.each(this.classesElementLookup,function(key,value){that._removeClass(value,key)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},"destroy"),_destroy:$2.noop,widget:__name(function(){return this.element},"widget"),option:__name(function(key,value){var options=key,parts,curOption,i;if(arguments.length===0)return $2.widget.extend({},this.options);if(typeof key=="string")if(options={},parts=key.split("."),key=parts.shift(),parts.length){for(curOption=options[key]=$2.widget.extend({},this.options[key]),i=0;i<parts.length-1;i++)curOption[parts[i]]=curOption[parts[i]]||{},curOption=curOption[parts[i]];if(key=parts.pop(),arguments.length===1)return curOption[key]===void 0?null:curOption[key];curOption[key]=value}else{if(arguments.length===1)return this.options[key]===void 0?null:this.options[key];options[key]=value}return this._setOptions(options),this},"option"),_setOptions:__name(function(options){var key;for(key in options)this._setOption(key,options[key]);return this},"_setOptions"),_setOption:__name(function(key,value){return key==="classes"&&this._setOptionClasses(value),this.options[key]=value,key==="disabled"&&this._setOptionDisabled(value),this},"_setOption"),_setOptionClasses:__name(function(value){var classKey,elements,currentElements;for(classKey in value)currentElements=this.classesElementLookup[classKey],!(value[classKey]===this.options.classes[classKey]||!currentElements||!currentElements.length)&&(elements=$2(currentElements.get()),this._removeClass(currentElements,classKey),elements.addClass(this._classes({element:elements,keys:classKey,classes:value,add:!0})))},"_setOptionClasses"),_setOptionDisabled:__name(function(value){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!value),value&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},"_setOptionDisabled"),enable:__name(function(){return this._setOptions({disabled:!1})},"enable"),disable:__name(function(){return this._setOptions({disabled:!0})},"disable"),_classes:__name(function(options){var full=[],that=this;options=$2.extend({element:this.element,classes:this.options.classes||{}},options);function bindRemoveEvent(){var nodesToBind=[];options.element.each(function(_,element){var isTracked=$2.map(that.classesElementLookup,function(elements){return elements}).some(function(elements){return elements.is(element)});isTracked||nodesToBind.push(element)}),that._on($2(nodesToBind),{remove:"_untrackClassesElement"})}__name(bindRemoveEvent,"bindRemoveEvent");function processClassString(classes,checkOption){var current,i;for(i=0;i<classes.length;i++)current=that.classesElementLookup[classes[i]]||$2(),options.add?(bindRemoveEvent(),current=$2($2.uniqueSort(current.get().concat(options.element.get())))):current=$2(current.not(options.element).get()),that.classesElementLookup[classes[i]]=current,full.push(classes[i]),checkOption&&options.classes[classes[i]]&&full.push(options.classes[classes[i]])}return __name(processClassString,"processClassString"),options.keys&&processClassString(options.keys.match(/\S+/g)||[],!0),options.extra&&processClassString(options.extra.match(/\S+/g)||[]),full.join(" ")},"_classes"),_untrackClassesElement:__name(function(event){var that=this;$2.each(that.classesElementLookup,function(key,value){$2.inArray(event.target,value)!==-1&&(that.classesElementLookup[key]=$2(value.not(event.target).get()))}),this._off($2(event.target))},"_untrackClassesElement"),_removeClass:__name(function(element,keys,extra){return this._toggleClass(element,keys,extra,!1)},"_removeClass"),_addClass:__name(function(element,keys,extra){return this._toggleClass(element,keys,extra,!0)},"_addClass"),_toggleClass:__name(function(element,keys,extra,add){add=typeof add=="boolean"?add:extra;var shift=typeof element=="string"||element===null,options={extra:shift?keys:extra,keys:shift?element:keys,element:shift?this.element:element,add};return options.element.toggleClass(this._classes(options),add),this},"_toggleClass"),_on:__name(function(suppressDisabledCheck,element,handlers){var delegateElement,instance=this;typeof suppressDisabledCheck!="boolean"&&(handlers=element,element=suppressDisabledCheck,suppressDisabledCheck=!1),handlers?(element=delegateElement=$2(element),this.bindings=this.bindings.add(element)):(handlers=element,element=this.element,delegateElement=this.widget()),$2.each(handlers,function(event,handler){function handlerProxy(){if(!(!suppressDisabledCheck&&(instance.options.disabled===!0||$2(this).hasClass("ui-state-disabled"))))return(typeof handler=="string"?instance[handler]:handler).apply(instance,arguments)}__name(handlerProxy,"handlerProxy"),typeof handler!="string"&&(handlerProxy.guid=handler.guid=handler.guid||handlerProxy.guid||$2.guid++);var match=event.match(/^([\w:-]*)\s*(.*)$/),eventName=match[1]+instance.eventNamespace,selector=match[2];selector?delegateElement.on(eventName,selector,handlerProxy):element.on(eventName,handlerProxy)})},"_on"),_off:__name(function(element,eventName){eventName=(eventName||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,element.off(eventName),this.bindings=$2(this.bindings.not(element).get()),this.focusable=$2(this.focusable.not(element).get()),this.hoverable=$2(this.hoverable.not(element).get())},"_off"),_delay:__name(function(handler,delay){function handlerProxy(){return(typeof handler=="string"?instance[handler]:handler).apply(instance,arguments)}__name(handlerProxy,"handlerProxy");var instance=this;return setTimeout(handlerProxy,delay||0)},"_delay"),_hoverable:__name(function(element){this.hoverable=this.hoverable.add(element),this._on(element,{mouseenter:__name(function(event){this._addClass($2(event.currentTarget),null,"ui-state-hover")},"mouseenter"),mouseleave:__name(function(event){this._removeClass($2(event.currentTarget),null,"ui-state-hover")},"mouseleave")})},"_hoverable"),_focusable:__name(function(element){this.focusable=this.focusable.add(element),this._on(element,{focusin:__name(function(event){this._addClass($2(event.currentTarget),null,"ui-state-focus")},"focusin"),focusout:__name(function(event){this._removeClass($2(event.currentTarget),null,"ui-state-focus")},"focusout")})},"_focusable"),_trigger:__name(function(type,event,data){var prop,orig,callback=this.options[type];if(data=data||{},event=$2.Event(event),event.type=(type===this.widgetEventPrefix?type:this.widgetEventPrefix+type).toLowerCase(),event.target=this.element[0],orig=event.originalEvent,orig)for(prop in orig)prop in event||(event[prop]=orig[prop]);return this.element.trigger(event,data),!(typeof callback=="function"&&callback.apply(this.element[0],[event].concat(data))===!1||event.isDefaultPrevented())},"_trigger")},$2.each({show:"fadeIn",hide:"fadeOut"},function(method,defaultEffect){$2.Widget.prototype["_"+method]=function(element,options,callback){typeof options=="string"&&(options={effect:options});var hasOptions,effectName=options?options===!0||typeof options=="number"?defaultEffect:options.effect||defaultEffect:method;options=options||{},typeof options=="number"?options={duration:options}:options===!0&&(options={}),hasOptions=!$2.isEmptyObject(options),options.complete=callback,options.delay&&element.delay(options.delay),hasOptions&&$2.effects&&$2.effects.effect[effectName]?element[method](options):effectName!==method&&element[effectName]?element[effectName](options.duration,options.easing,callback):element.queue(function(next){$2(this)[method](),callback&&callback.call(element[0]),next()})}}),$2.widget;(function(){var cachedScrollbarWidth,max=Math.max,abs=Math.abs,rhorizontal=/left|center|right/,rvertical=/top|center|bottom/,roffset=/[\+\-]\d+(\.[\d]+)?%?/,rposition=/^\w+/,rpercent=/%$/,_position=$2.fn.position;function getOffsets(offsets,width,height){return[parseFloat(offsets[0])*(rpercent.test(offsets[0])?width/100:1),parseFloat(offsets[1])*(rpercent.test(offsets[1])?height/100:1)]}__name(getOffsets,"getOffsets");function parseCss(element,property){return parseInt($2.css(element,property),10)||0}__name(parseCss,"parseCss");function isWindow(obj){return obj!=null&&obj===obj.window}__name(isWindow,"isWindow");function getDimensions(elem){var raw=elem[0];return raw.nodeType===9?{width:elem.width(),height:elem.height(),offset:{top:0,left:0}}:isWindow(raw)?{width:elem.width(),height:elem.height(),offset:{top:elem.scrollTop(),left:elem.scrollLeft()}}:raw.preventDefault?{width:0,height:0,offset:{top:raw.pageY,left:raw.pageX}}:{width:elem.outerWidth(),height:elem.outerHeight(),offset:elem.offset()}}__name(getDimensions,"getDimensions"),$2.position={scrollbarWidth:__name(function(){if(cachedScrollbarWidth!==void 0)return cachedScrollbarWidth;var w1,w2,div=$2("<div style='display:block;position:absolute;width:200px;height:200px;overflow:hidden;'><div style='height:300px;width:auto;'></div></div>"),innerDiv=div.children()[0];return $2("body").append(div),w1=innerDiv.offsetWidth,div.css("overflow","scroll"),w2=innerDiv.offsetWidth,w1===w2&&(w2=div[0].clientWidth),div.remove(),cachedScrollbarWidth=w1-w2},"scrollbarWidth"),getScrollInfo:__name(function(within){var overflowX=within.isWindow||within.isDocument?"":within.element.css("overflow-x"),overflowY=within.isWindow||within.isDocument?"":within.element.css("overflow-y"),hasOverflowX=overflowX==="scroll"||overflowX==="auto"&&within.width<within.element[0].scrollWidth,hasOverflowY=overflowY==="scroll"||overflowY==="auto"&&within.height<within.element[0].scrollHeight;return{width:hasOverflowY?$2.position.scrollbarWidth():0,height:hasOverflowX?$2.position.scrollbarWidth():0}},"getScrollInfo"),getWithinInfo:__name(function(element){var withinElement=$2(element||window),isElemWindow=isWindow(withinElement[0]),isDocument=!!withinElement[0]&&withinElement[0].nodeType===9,hasOffset=!isElemWindow&&!isDocument;return{element:withinElement,isWindow:isElemWindow,isDocument,offset:hasOffset?$2(element).offset():{left:0,top:0},scrollLeft:withinElement.scrollLeft(),scrollTop:withinElement.scrollTop(),width:withinElement.outerWidth(),height:withinElement.outerHeight()}},"getWithinInfo")},$2.fn.position=function(options){if(!options||!options.of)return _position.apply(this,arguments);options=$2.extend({},options);var atOffset,targetWidth,targetHeight,targetOffset,basePosition,dimensions,target=typeof options.of=="string"?$2(document).find(options.of):$2(options.of),within=$2.position.getWithinInfo(options.within),scrollInfo=$2.position.getScrollInfo(within),collision=(options.collision||"flip").split(" "),offsets={};return dimensions=getDimensions(target),target[0].preventDefault&&(options.at="left top"),targetWidth=dimensions.width,targetHeight=dimensions.height,targetOffset=dimensions.offset,basePosition=$2.extend({},targetOffset),$2.each(["my","at"],function(){var pos=(options[this]||"").split(" "),horizontalOffset,verticalOffset;pos.length===1&&(pos=rhorizontal.test(pos[0])?pos.concat(["center"]):rvertical.test(pos[0])?["center"].concat(pos):["center","center"]),pos[0]=rhorizontal.test(pos[0])?pos[0]:"center",pos[1]=rvertical.test(pos[1])?pos[1]:"center",horizontalOffset=roffset.exec(pos[0]),verticalOffset=roffset.exec(pos[1]),offsets[this]=[horizontalOffset?horizontalOffset[0]:0,verticalOffset?verticalOffset[0]:0],options[this]=[rposition.exec(pos[0])[0],rposition.exec(pos[1])[0]]}),collision.length===1&&(collision[1]=collision[0]),options.at[0]==="right"?basePosition.left+=targetWidth:options.at[0]==="center"&&(basePosition.left+=targetWidth/2),options.at[1]==="bottom"?basePosition.top+=targetHeight:options.at[1]==="center"&&(basePosition.top+=targetHeight/2),atOffset=getOffsets(offsets.at,targetWidth,targetHeight),basePosition.left+=atOffset[0],basePosition.top+=atOffset[1],this.each(function(){var collisionPosition,using,elem=$2(this),elemWidth=elem.outerWidth(),elemHeight=elem.outerHeight(),marginLeft=parseCss(this,"marginLeft"),marginTop=parseCss(this,"marginTop"),collisionWidth=elemWidth+marginLeft+parseCss(this,"marginRight")+scrollInfo.width,collisionHeight=elemHeight+marginTop+parseCss(this,"marginBottom")+scrollInfo.height,position=$2.extend({},basePosition),myOffset=getOffsets(offsets.my,elem.outerWidth(),elem.outerHeight());options.my[0]==="right"?position.left-=elemWidth:options.my[0]==="center"&&(position.left-=elemWidth/2),options.my[1]==="bottom"?position.top-=elemHeight:options.my[1]==="center"&&(position.top-=elemHeight/2),position.left+=myOffset[0],position.top+=myOffset[1],collisionPosition={marginLeft,marginTop},$2.each(["left","top"],function(i,dir){$2.ui.position[collision[i]]&&$2.ui.position[collision[i]][dir](position,{targetWidth,targetHeight,elemWidth,elemHeight,collisionPosition,collisionWidth,collisionHeight,offset:[atOffset[0]+myOffset[0],atOffset[1]+myOffset[1]],my:options.my,at:options.at,within,elem})}),options.using&&(using=__name(function(props){var left=targetOffset.left-position.left,right=left+targetWidth-elemWidth,top=targetOffset.top-position.top,bottom=top+targetHeight-elemHeight,feedback={target:{element:target,left:targetOffset.left,top:targetOffset.top,width:targetWidth,height:targetHeight},element:{element:elem,left:position.left,top:position.top,width:elemWidth,height:elemHeight},horizontal:right<0?"left":left>0?"right":"center",vertical:bottom<0?"top":top>0?"bottom":"middle"};targetWidth<elemWidth&&abs(left+right)<targetWidth&&(feedback.horizontal="center"),targetHeight<elemHeight&&abs(top+bottom)<targetHeight&&(feedback.vertical="middle"),max(abs(left),abs(right))>max(abs(top),abs(bottom))?feedback.important="horizontal":feedback.important="vertical",options.using.call(this,props,feedback)},"using")),elem.offset($2.extend(position,{using}))})},$2.ui.position={fit:{left:__name(function(position,data){var within=data.within,withinOffset=within.isWindow?within.scrollLeft:within.offset.left,outerWidth=within.width,collisionPosLeft=position.left-data.collisionPosition.marginLeft,overLeft=withinOffset-collisionPosLeft,overRight=collisionPosLeft+data.collisionWidth-outerWidth-withinOffset,newOverRight;data.collisionWidth>outerWidth?overLeft>0&&overRight<=0?(newOverRight=position.left+overLeft+data.collisionWidth-outerWidth-withinOffset,position.left+=overLeft-newOverRight):overRight>0&&overLeft<=0?position.left=withinOffset:overLeft>overRight?position.left=withinOffset+outerWidth-data.collisionWidth:position.left=withinOffset:overLeft>0?position.left+=overLeft:overRight>0?position.left-=overRight:position.left=max(position.left-collisionPosLeft,position.left)},"left"),top:__name(function(position,data){var within=data.within,withinOffset=within.isWindow?within.scrollTop:within.offset.top,outerHeight=data.within.height,collisionPosTop=position.top-data.collisionPosition.marginTop,overTop=withinOffset-collisionPosTop,overBottom=collisionPosTop+data.collisionHeight-outerHeight-withinOffset,newOverBottom;data.collisionHeight>outerHeight?overTop>0&&overBottom<=0?(newOverBottom=position.top+overTop+data.collisionHeight-outerHeight-withinOffset,position.top+=overTop-newOverBottom):overBottom>0&&overTop<=0?position.top=withinOffset:overTop>overBottom?position.top=withinOffset+outerHeight-data.collisionHeight:position.top=withinOffset:overTop>0?position.top+=overTop:overBottom>0?position.top-=overBottom:position.top=max(position.top-collisionPosTop,position.top)},"top")},flip:{left:__name(function(position,data){var within=data.within,withinOffset=within.offset.left+within.scrollLeft,outerWidth=within.width,offsetLeft=within.isWindow?within.scrollLeft:within.offset.left,collisionPosLeft=position.left-data.collisionPosition.marginLeft,overLeft=collisionPosLeft-offsetLeft,overRight=collisionPosLeft+data.collisionWidth-outerWidth-offsetLeft,myOffset=data.my[0]==="left"?-data.elemWidth:data.my[0]==="right"?data.elemWidth:0,atOffset=data.at[0]==="left"?data.targetWidth:data.at[0]==="right"?-data.targetWidth:0,offset=-2*data.offset[0],newOverRight,newOverLeft;overLeft<0?(newOverRight=position.left+myOffset+atOffset+offset+data.collisionWidth-outerWidth-withinOffset,(newOverRight<0||newOverRight<abs(overLeft))&&(position.left+=myOffset+atOffset+offset)):overRight>0&&(newOverLeft=position.left-data.collisionPosition.marginLeft+myOffset+atOffset+offset-offsetLeft,(newOverLeft>0||abs(newOverLeft)<overRight)&&(position.left+=myOffset+atOffset+offset))},"left"),top:__name(function(position,data){var within=data.within,withinOffset=within.offset.top+within.scrollTop,outerHeight=within.height,offsetTop=within.isWindow?within.scrollTop:within.offset.top,collisionPosTop=position.top-data.collisionPosition.marginTop,overTop=collisionPosTop-offsetTop,overBottom=collisionPosTop+data.collisionHeight-outerHeight-offsetTop,top=data.my[1]==="top",myOffset=top?-data.elemHeight:data.my[1]==="bottom"?data.elemHeight:0,atOffset=data.at[1]==="top"?data.targetHeight:data.at[1]==="bottom"?-data.targetHeight:0,offset=-2*data.offset[1],newOverTop,newOverBottom;overTop<0?(newOverBottom=position.top+myOffset+atOffset+offset+data.collisionHeight-outerHeight-withinOffset,(newOverBottom<0||newOverBottom<abs(overTop))&&(position.top+=myOffset+atOffset+offset)):overBottom>0&&(newOverTop=position.top-data.collisionPosition.marginTop+myOffset+atOffset+offset-offsetTop,(newOverTop>0||abs(newOverTop)<overBottom)&&(position.top+=myOffset+atOffset+offset))},"top")},flipfit:{left:__name(function(){$2.ui.position.flip.left.apply(this,arguments),$2.ui.position.fit.left.apply(this,arguments)},"left"),top:__name(function(){$2.ui.position.flip.top.apply(this,arguments),$2.ui.position.fit.top.apply(this,arguments)},"top")}}})(),$2.ui.position;$2.extend($2.expr.pseudos,{data:$2.expr.createPseudo(function(dataName){return function(elem){return!!$2.data(elem,dataName)}})});$2.fn.extend({disableSelection:(function(){var eventType="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(eventType+".ui-disableSelection",function(event){event.preventDefault()})}})(),enableSelection:__name(function(){return this.off(".ui-disableSelection")},"enableSelection")});var jQuery=$2;var stepHooks="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",class2type={},toString=class2type.toString,rplusequals=/^([\-+])=\s*(\d+\.?\d*)/,stringParsers=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:__name(function(execResult){return[execResult[1],execResult[2],execResult[3],execResult[4]]},"parse")},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:__name(function(execResult){return[execResult[1]*2.55,execResult[2]*2.55,execResult[3]*2.55,execResult[4]]},"parse")},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/,parse:__name(function(execResult){return[parseInt(execResult[1],16),parseInt(execResult[2],16),parseInt(execResult[3],16),execResult[4]?(parseInt(execResult[4],16)/255).toFixed(2):1]},"parse")},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/,parse:__name(function(execResult){return[parseInt(execResult[1]+execResult[1],16),parseInt(execResult[2]+execResult[2],16),parseInt(execResult[3]+execResult[3],16),execResult[4]?(parseInt(execResult[4]+execResult[4],16)/255).toFixed(2):1]},"parse")},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:__name(function(execResult){return[execResult[1],execResult[2]/100,execResult[3]/100,execResult[4]]},"parse")}],color=jQuery.Color=function(color2,green,blue,alpha){return new jQuery.Color.fn.parse(color2,green,blue,alpha)},spaces={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},propTypes={byte:{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},colors,each=jQuery.each;each(spaces,function(spaceName,space){space.cache="_"+spaceName,space.props.alpha={idx:3,type:"percent",def:1}}),jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(_i,name){class2type["[object "+name+"]"]=name.toLowerCase()});function getType(obj){return obj==null?obj+"":typeof obj=="object"?class2type[toString.call(obj)]||"object":typeof obj}__name(getType,"getType");function clamp(value,prop,allowEmpty){var type=propTypes[prop.type]||{};return value==null?allowEmpty||!prop.def?null:prop.def:(value=type.floor?~~value:parseFloat(value),type.mod?(value+type.mod)%type.mod:Math.min(type.max,Math.max(0,value)))}__name(clamp,"clamp");function stringParse(string){var inst=color(),rgba=inst._rgba=[];return string=string.toLowerCase(),each(stringParsers,function(_i,parser){var parsed,match=parser.re.exec(string),values=match&&parser.parse(match),spaceName=parser.space||"rgba";if(values)return parsed=inst[spaceName](values),inst[spaces[spaceName].cache]=parsed[spaces[spaceName].cache],rgba=inst._rgba=parsed._rgba,!1}),rgba.length?(rgba.join()==="0,0,0,0"&&jQuery.extend(rgba,colors.transparent),inst):colors[string]}__name(stringParse,"stringParse"),color.fn=jQuery.extend(color.prototype,{parse:__name(function(red,green,blue,alpha){if(red===void 0)return this._rgba=[null,null,null,null],this;(red.jquery||red.nodeType)&&(red=jQuery(red).css(green),green=void 0);var inst=this,type=getType(red),rgba=this._rgba=[];if(green!==void 0&&(red=[red,green,blue,alpha],type="array"),type==="string")return this.parse(stringParse(red)||colors._default);if(type==="array")return each(spaces.rgba.props,function(_key,prop){rgba[prop.idx]=clamp(red[prop.idx],prop)}),this;if(type==="object")return red instanceof color?each(spaces,function(_spaceName,space){red[space.cache]&&(inst[space.cache]=red[space.cache].slice())}):each(spaces,function(_spaceName,space){var cache=space.cache;each(space.props,function(key,prop){if(!inst[cache]&&space.to){if(key==="alpha"||red[key]==null)return;inst[cache]=space.to(inst._rgba)}inst[cache][prop.idx]=clamp(red[key],prop,!0)}),inst[cache]&&jQuery.inArray(null,inst[cache].slice(0,3))<0&&(inst[cache][3]==null&&(inst[cache][3]=1),space.from&&(inst._rgba=space.from(inst[cache])))}),this},"parse"),is:__name(function(compare){var is=color(compare),same=!0,inst=this;return each(spaces,function(_,space){var localCache,isCache=is[space.cache];return isCache&&(localCache=inst[space.cache]||space.to&&space.to(inst._rgba)||[],each(space.props,function(_2,prop){if(isCache[prop.idx]!=null)return same=isCache[prop.idx]===localCache[prop.idx],same})),same}),same},"is"),_space:__name(function(){var used=[],inst=this;return each(spaces,function(spaceName,space){inst[space.cache]&&used.push(spaceName)}),used.pop()},"_space"),transition:__name(function(other,distance){var end=color(other),spaceName=end._space(),space=spaces[spaceName],startColor=this.alpha()===0?color("transparent"):this,start=startColor[space.cache]||space.to(startColor._rgba),result=start.slice();return end=end[space.cache],each(space.props,function(_key,prop){var index=prop.idx,startValue=start[index],endValue=end[index],type=propTypes[prop.type]||{};endValue!==null&&(startValue===null?result[index]=endValue:(type.mod&&(endValue-startValue>type.mod/2?startValue+=type.mod:startValue-endValue>type.mod/2&&(startValue-=type.mod)),result[index]=clamp((endValue-startValue)*distance+startValue,prop)))}),this[spaceName](result)},"transition"),blend:__name(function(opaque){if(this._rgba[3]===1)return this;var rgb=this._rgba.slice(),a=rgb.pop(),blend=color(opaque)._rgba;return color(jQuery.map(rgb,function(v,i){return(1-a)*blend[i]+a*v}))},"blend"),toRgbaString:__name(function(){var prefix="rgba(",rgba=jQuery.map(this._rgba,function(v,i){return v??(i>2?1:0)});return rgba[3]===1&&(rgba.pop(),prefix="rgb("),prefix+rgba.join(", ")+")"},"toRgbaString"),toHslaString:__name(function(){var prefix="hsla(",hsla=jQuery.map(this.hsla(),function(v,i){return v==null&&(v=i>2?1:0),i&&i<3&&(v=Math.round(v*100)+"%"),v});return hsla[3]===1&&(hsla.pop(),prefix="hsl("),prefix+hsla.join(", ")+")"},"toHslaString"),toHexString:__name(function(includeAlpha){var rgba=this._rgba.slice(),alpha=rgba.pop();return includeAlpha&&rgba.push(~~(alpha*255)),"#"+jQuery.map(rgba,function(v){return("0"+(v||0).toString(16)).substr(-2)}).join("")},"toHexString"),toString:__name(function(){return this.toRgbaString()},"toString")}),color.fn.parse.prototype=color.fn;function hue2rgb(p,q2,h){return h=(h+1)%1,h*6<1?p+(q2-p)*h*6:h*2<1?q2:h*3<2?p+(q2-p)*(2/3-h)*6:p}__name(hue2rgb,"hue2rgb"),spaces.hsla.to=function(rgba){if(rgba[0]==null||rgba[1]==null||rgba[2]==null)return[null,null,null,rgba[3]];var r=rgba[0]/255,g=rgba[1]/255,b=rgba[2]/255,a=rgba[3],max=Math.max(r,g,b),min=Math.min(r,g,b),diff=max-min,add=max+min,l=add*.5,h,s;return min===max?h=0:r===max?h=60*(g-b)/diff+360:g===max?h=60*(b-r)/diff+120:h=60*(r-g)/diff+240,diff===0?s=0:l<=.5?s=diff/add:s=diff/(2-add),[Math.round(h)%360,s,l,a??1]},spaces.hsla.from=function(hsla){if(hsla[0]==null||hsla[1]==null||hsla[2]==null)return[null,null,null,hsla[3]];var h=hsla[0]/360,s=hsla[1],l=hsla[2],a=hsla[3],q2=l<=.5?l*(1+s):l+s-l*s,p=2*l-q2;return[Math.round(hue2rgb(p,q2,h+1/3)*255),Math.round(hue2rgb(p,q2,h)*255),Math.round(hue2rgb(p,q2,h-1/3)*255),a]},each(spaces,function(spaceName,space){var props=space.props,cache=space.cache,to=space.to,from=space.from;color.fn[spaceName]=function(value){if(to&&!this[cache]&&(this[cache]=to(this._rgba)),value===void 0)return this[cache].slice();var ret,type=getType(value),arr=type==="array"||type==="object"?value:arguments,local=this[cache].slice();return each(props,function(key,prop){var val=arr[type==="object"?key:prop.idx];val==null&&(val=local[prop.idx]),local[prop.idx]=clamp(val,prop)}),from?(ret=color(from(local)),ret[cache]=local,ret):color(local)},each(props,function(key,prop){color.fn[key]||(color.fn[key]=function(value){var local,cur,match,fn,vtype=getType(value);return key==="alpha"?fn=this._hsla?"hsla":"rgba":fn=spaceName,local=this[fn](),cur=local[prop.idx],vtype==="undefined"?cur:(vtype==="function"&&(value=value.call(this,cur),vtype=getType(value)),value==null&&prop.empty?this:(vtype==="string"&&(match=rplusequals.exec(value),match&&(value=cur+parseFloat(match[2])*(match[1]==="+"?1:-1))),local[prop.idx]=value,this[fn](local)))})})}),color.hook=function(hook){var hooks=hook.split(" ");each(hooks,function(_i,hook2){jQuery.cssHooks[hook2]={set:__name(function(elem,value){var parsed;value!=="transparent"&&(getType(value)!=="string"||(parsed=stringParse(value)))&&(value=color(parsed||value),value=value.toRgbaString()),elem.style[hook2]=value},"set")},jQuery.fx.step[hook2]=function(fx){fx.colorInit||(fx.start=color(fx.elem,hook2),fx.end=color(fx.end),fx.colorInit=!0),jQuery.cssHooks[hook2].set(fx.elem,fx.start.transition(fx.end,fx.pos))}})},color.hook(stepHooks),jQuery.cssHooks.borderColor={expand:__name(function(value){var expanded={};return each(["Top","Right","Bottom","Left"],function(_i,part){expanded["border"+part+"Color"]=value}),expanded},"expand")},colors=jQuery.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"};var dataSpace="ui-effects-",dataSpaceStyle="ui-effects-style",dataSpaceAnimated="ui-effects-animated";$2.effects={effect:{}},(function(){var classAnimationActions=["add","remove","toggle"],shorthandStyles={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};$2.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(_,prop){$2.fx.step[prop]=function(fx){(fx.end!=="none"&&!fx.setAttr||fx.pos===1&&!fx.setAttr)&&(jQuery.style(fx.elem,prop,fx.end),fx.setAttr=!0)}});function camelCase(string){return string.replace(/-([\da-z])/gi,function(all,letter){return letter.toUpperCase()})}__name(camelCase,"camelCase");function getElementStyles(elem){var key,len,style=elem.ownerDocument.defaultView.getComputedStyle(elem),styles={};for(len=style.length;len--;)key=style[len],typeof style[key]=="string"&&(styles[camelCase(key)]=style[key]);return styles}__name(getElementStyles,"getElementStyles");function styleDifference(oldStyle,newStyle){var diff={},name,value;for(name in newStyle)value=newStyle[name],oldStyle[name]!==value&&(shorthandStyles[name]||($2.fx.step[name]||!isNaN(parseFloat(value)))&&(diff[name]=value));return diff}__name(styleDifference,"styleDifference"),$2.effects.animateClass=function(value,duration,easing,callback){var o=$2.speed(duration,easing,callback);return this.queue(function(){var animated=$2(this),baseClass=animated.attr("class")||"",applyClassChange,allAnimations=o.children?animated.find("*").addBack():animated;allAnimations=allAnimations.map(function(){var el=$2(this);return{el,start:getElementStyles(this)}}),applyClassChange=__name(function(){$2.each(classAnimationActions,function(i,action){value[action]&&animated[action+"Class"](value[action])})},"applyClassChange"),applyClassChange(),allAnimations=allAnimations.map(function(){return this.end=getElementStyles(this.el[0]),this.diff=styleDifference(this.start,this.end),this}),animated.attr("class",baseClass),allAnimations=allAnimations.map(function(){var styleInfo=this,dfd=$2.Deferred(),opts=$2.extend({},o,{queue:!1,complete:__name(function(){dfd.resolve(styleInfo)},"complete")});return this.el.animate(this.diff,opts),dfd.promise()}),$2.when.apply($2,allAnimations.get()).done(function(){applyClassChange(),$2.each(arguments,function(){var el=this.el;$2.each(this.diff,function(key){el.css(key,"")})}),o.complete.call(animated[0])})})},$2.fn.extend({addClass:(function(orig){return function(classNames,speed,easing,callback){return speed?$2.effects.animateClass.call(this,{add:classNames},speed,easing,callback):orig.apply(this,arguments)}})($2.fn.addClass),removeClass:(function(orig){return function(classNames,speed,easing,callback){return arguments.length>1?$2.effects.animateClass.call(this,{remove:classNames},speed,easing,callback):orig.apply(this,arguments)}})($2.fn.removeClass),toggleClass:(function(orig){return function(classNames,force,speed,easing,callback){return typeof force=="boolean"||force===void 0?speed?$2.effects.animateClass.call(this,force?{add:classNames}:{remove:classNames},speed,easing,callback):orig.apply(this,arguments):$2.effects.animateClass.call(this,{toggle:classNames},force,speed,easing)}})($2.fn.toggleClass),switchClass:__name(function(remove,add,speed,easing,callback){return $2.effects.animateClass.call(this,{add,remove},speed,easing,callback)},"switchClass")})})(),(function(){$2.expr&&$2.expr.pseudos&&$2.expr.pseudos.animated&&($2.expr.pseudos.animated=(function(orig){return function(elem){return!!$2(elem).data(dataSpaceAnimated)||orig(elem)}})($2.expr.pseudos.animated)),$2.uiBackCompat===!0&&$2.extend($2.effects,{save:__name(function(element,set){for(var i=0,length=set.length;i<length;i++)set[i]!==null&&element.data(dataSpace+set[i],element[0].style[set[i]])},"save"),restore:__name(function(element,set){for(var val,i=0,length=set.length;i<length;i++)set[i]!==null&&(val=element.data(dataSpace+set[i]),element.css(set[i],val))},"restore"),setMode:__name(function(el,mode){return mode==="toggle"&&(mode=el.is(":hidden")?"show":"hide"),mode},"setMode"),createWrapper:__name(function(element){if(element.parent().is(".ui-effects-wrapper"))return element.parent();var props={width:element.outerWidth(!0),height:element.outerHeight(!0),float:element.css("float")},wrapper=$2("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),size={width:element.width(),height:element.height()},active=document.activeElement;try{active.id}catch{active=document.body}return element.wrap(wrapper),(element[0]===active||$2.contains(element[0],active))&&$2(active).trigger("focus"),wrapper=element.parent(),element.css("position")==="static"?(wrapper.css({position:"relative"}),element.css({position:"relative"})):($2.extend(props,{position:element.css("position"),zIndex:element.css("z-index")}),$2.each(["top","left","bottom","right"],function(i,pos){props[pos]=element.css(pos),isNaN(parseInt(props[pos],10))&&(props[pos]="auto")}),element.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),element.css(size),wrapper.css(props).show()},"createWrapper"),removeWrapper:__name(function(element){var active=document.activeElement;return element.parent().is(".ui-effects-wrapper")&&(element.parent().replaceWith(element),(element[0]===active||$2.contains(element[0],active))&&$2(active).trigger("focus")),element},"removeWrapper")}),$2.extend($2.effects,{version:"1.14.1",define:__name(function(name,mode,effect){return effect||(effect=mode,mode="effect"),$2.effects.effect[name]=effect,$2.effects.effect[name].mode=mode,effect},"define"),scaledDimensions:__name(function(element,percent,direction){if(percent===0)return{height:0,width:0,outerHeight:0,outerWidth:0};var x=direction!=="horizontal"?(percent||100)/100:1,y=direction!=="vertical"?(percent||100)/100:1;return{height:element.height()*y,width:element.width()*x,outerHeight:element.outerHeight()*y,outerWidth:element.outerWidth()*x}},"scaledDimensions"),clipToBox:__name(function(animation){return{width:animation.clip.right-animation.clip.left,height:animation.clip.bottom-animation.clip.top,left:animation.clip.left,top:animation.clip.top}},"clipToBox"),unshift:__name(function(element,queueLength,count){var queue=element.queue();queueLength>1&&queue.splice.apply(queue,[1,0].concat(queue.splice(queueLength,count))),element.dequeue()},"unshift"),saveStyle:__name(function(element){element.data(dataSpaceStyle,element[0].style.cssText)},"saveStyle"),restoreStyle:__name(function(element){element[0].style.cssText=element.data(dataSpaceStyle)||"",element.removeData(dataSpaceStyle)},"restoreStyle"),mode:__name(function(element,mode){var hidden=element.is(":hidden");return mode==="toggle"&&(mode=hidden?"show":"hide"),(hidden?mode==="hide":mode==="show")&&(mode="none"),mode},"mode"),getBaseline:__name(function(origin,original){var y,x;switch(origin[0]){case"top":y=0;break;case"middle":y=.5;break;case"bottom":y=1;break;default:y=origin[0]/original.height}switch(origin[1]){case"left":x=0;break;case"center":x=.5;break;case"right":x=1;break;default:x=origin[1]/original.width}return{x,y}},"getBaseline"),createPlaceholder:__name(function(element){var placeholder,cssPosition=element.css("position"),position=element.position();return element.css({marginTop:element.css("marginTop"),marginBottom:element.css("marginBottom"),marginLeft:element.css("marginLeft"),marginRight:element.css("marginRight")}).outerWidth(element.outerWidth()).outerHeight(element.outerHeight()),/^(static|relative)/.test(cssPosition)&&(cssPosition="absolute",placeholder=$2("<"+element[0].nodeName+">").insertAfter(element).css({display:/^(inline|ruby)/.test(element.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:element.css("marginTop"),marginBottom:element.css("marginBottom"),marginLeft:element.css("marginLeft"),marginRight:element.css("marginRight"),float:element.css("float")}).outerWidth(element.outerWidth()).outerHeight(element.outerHeight()).addClass("ui-effects-placeholder"),element.data(dataSpace+"placeholder",placeholder)),element.css({position:cssPosition,left:position.left,top:position.top}),placeholder},"createPlaceholder"),removePlaceholder:__name(function(element){var dataKey=dataSpace+"placeholder",placeholder=element.data(dataKey);placeholder&&(placeholder.remove(),element.removeData(dataKey))},"removePlaceholder"),cleanUp:__name(function(element){$2.effects.restoreStyle(element),$2.effects.removePlaceholder(element)},"cleanUp"),setTransition:__name(function(element,list,factor,value){return value=value||{},$2.each(list,function(i,x){var unit=element.cssUnit(x);unit[0]>0&&(value[x]=unit[0]*factor+unit[1])}),value},"setTransition")});function _normalizeArguments(effect,options,speed,callback){return $2.isPlainObject(effect)&&(options=effect,effect=effect.effect),effect={effect},options==null&&(options={}),typeof options=="function"&&(callback=options,speed=null,options={}),(typeof options=="number"||$2.fx.speeds[options])&&(callback=speed,speed=options,options={}),typeof speed=="function"&&(callback=speed,speed=null),options&&$2.extend(effect,options),speed=speed||options.duration,effect.duration=$2.fx.off?0:typeof speed=="number"?speed:speed in $2.fx.speeds?$2.fx.speeds[speed]:$2.fx.speeds._default,effect.complete=callback||options.complete,effect}__name(_normalizeArguments,"_normalizeArguments");function standardAnimationOption(option){return!!(!option||typeof option=="number"||$2.fx.speeds[option]||typeof option=="string"&&!$2.effects.effect[option]||typeof option=="function"||typeof option=="object"&&!option.effect)}__name(standardAnimationOption,"standardAnimationOption"),$2.fn.extend({effect:__name(function(){var args=_normalizeArguments.apply(this,arguments),effectMethod=$2.effects.effect[args.effect],defaultMode=effectMethod.mode,queue=args.queue,queueName=queue||"fx",complete=args.complete,mode=args.mode,modes=[],prefilter=__name(function(next){var el=$2(this),normalizedMode=$2.effects.mode(el,mode)||defaultMode;el.data(dataSpaceAnimated,!0),modes.push(normalizedMode),defaultMode&&(normalizedMode==="show"||normalizedMode===defaultMode&&normalizedMode==="hide")&&el.show(),(!defaultMode||normalizedMode!=="none")&&$2.effects.saveStyle(el),typeof next=="function"&&next()},"prefilter");if($2.fx.off||!effectMethod)return mode?this[mode](args.duration,complete):this.each(function(){complete&&complete.call(this)});function run(next){var elem=$2(this);function cleanup(){elem.removeData(dataSpaceAnimated),$2.effects.cleanUp(elem),args.mode==="hide"&&elem.hide(),done()}__name(cleanup,"cleanup");function done(){typeof complete=="function"&&complete.call(elem[0]),typeof next=="function"&&next()}__name(done,"done"),args.mode=modes.shift(),$2.uiBackCompat===!0&&!defaultMode?(elem.is(":hidden")?mode==="hide":mode==="show")?(elem[mode](),done()):effectMethod.call(elem[0],args,done):args.mode==="none"?(elem[mode](),done()):effectMethod.call(elem[0],args,cleanup)}return __name(run,"run"),queue===!1?this.each(prefilter).each(run):this.queue(queueName,prefilter).queue(queueName,run)},"effect"),show:(function(orig){return function(option){if(standardAnimationOption(option))return orig.apply(this,arguments);var args=_normalizeArguments.apply(this,arguments);return args.mode="show",this.effect.call(this,args)}})($2.fn.show),hide:(function(orig){return function(option){if(standardAnimationOption(option))return orig.apply(this,arguments);var args=_normalizeArguments.apply(this,arguments);return args.mode="hide",this.effect.call(this,args)}})($2.fn.hide),toggle:(function(orig){return function(option){if(standardAnimationOption(option)||typeof option=="boolean")return orig.apply(this,arguments);var args=_normalizeArguments.apply(this,arguments);return args.mode="toggle",this.effect.call(this,args)}})($2.fn.toggle),cssUnit:__name(function(key){var style=this.css(key),val=[];return $2.each(["em","px","%","pt"],function(i,unit){style.indexOf(unit)>0&&(val=[parseFloat(style),unit])}),val},"cssUnit"),cssClip:__name(function(clipObj){return clipObj?this.css("clip","rect("+clipObj.top+"px "+clipObj.right+"px "+clipObj.bottom+"px "+clipObj.left+"px)"):parseClip(this.css("clip"),this)},"cssClip"),transfer:__name(function(options,done){var element=$2(this),target=$2(options.to),targetFixed=target.css("position")==="fixed",body=$2("body"),fixTop=targetFixed?body.scrollTop():0,fixLeft=targetFixed?body.scrollLeft():0,endPosition=target.offset(),animation={top:endPosition.top-fixTop,left:endPosition.left-fixLeft,height:target.innerHeight(),width:target.innerWidth()},startPosition=element.offset(),transfer=$2("<div class='ui-effects-transfer'></div>");transfer.appendTo("body").addClass(options.className).css({top:startPosition.top-fixTop,left:startPosition.left-fixLeft,height:element.innerHeight(),width:element.innerWidth(),position:targetFixed?"fixed":"absolute"}).animate(animation,options.duration,options.easing,function(){transfer.remove(),typeof done=="function"&&done()})},"transfer")});function parseClip(str,element){var outerWidth=element.outerWidth(),outerHeight=element.outerHeight(),clipRegex=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,values=clipRegex.exec(str)||["",0,outerWidth,outerHeight,0];return{top:parseFloat(values[1])||0,right:values[2]==="auto"?outerWidth:parseFloat(values[2]),bottom:values[3]==="auto"?outerHeight:parseFloat(values[3]),left:parseFloat(values[4])||0}}__name(parseClip,"parseClip"),$2.fx.step.clip=function(fx){fx.clipInit||(fx.start=$2(fx.elem).cssClip(),typeof fx.end=="string"&&(fx.end=parseClip(fx.end,fx.elem)),fx.clipInit=!0),$2(fx.elem).cssClip({top:fx.pos*(fx.end.top-fx.start.top)+fx.start.top,right:fx.pos*(fx.end.right-fx.start.right)+fx.start.right,bottom:fx.pos*(fx.end.bottom-fx.start.bottom)+fx.start.bottom,left:fx.pos*(fx.end.left-fx.start.left)+fx.start.left})}})(),(function(){var baseEasings={};$2.each(["Quad","Cubic","Quart","Quint","Expo"],function(i,name){baseEasings[name]=function(p){return Math.pow(p,i+2)}}),$2.extend(baseEasings,{Sine:__name(function(p){return 1-Math.cos(p*Math.PI/2)},"Sine"),Circ:__name(function(p){return 1-Math.sqrt(1-p*p)},"Circ"),Elastic:__name(function(p){return p===0||p===1?p:-Math.pow(2,8*(p-1))*Math.sin(((p-1)*80-7.5)*Math.PI/15)},"Elastic"),Back:__name(function(p){return p*p*(3*p-2)},"Back"),Bounce:__name(function(p){for(var pow2,bounce=4;p<((pow2=Math.pow(2,--bounce))-1)/11;);return 1/Math.pow(4,3-bounce)-7.5625*Math.pow((pow2*3-2)/22-p,2)},"Bounce")}),$2.each(baseEasings,function(name,easeIn){$2.easing["easeIn"+name]=easeIn,$2.easing["easeOut"+name]=function(p){return 1-easeIn(1-p)},$2.easing["easeInOut"+name]=function(p){return p<.5?easeIn(p*2)/2:1-easeIn(p*-2+2)/2}})})(),$2.effects;$2.effects.define("blind","hide",function(options,done){var map={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},element=$2(this),direction=options.direction||"up",start=element.cssClip(),animate={clip:$2.extend({},start)},placeholder=$2.effects.createPlaceholder(element);animate.clip[map[direction][0]]=animate.clip[map[direction][1]],options.mode==="show"&&(element.cssClip(animate.clip),placeholder&&placeholder.css($2.effects.clipToBox(animate)),animate.clip=start),placeholder&&placeholder.animate($2.effects.clipToBox(animate),options.duration,options.easing),element.animate(animate,{queue:!1,duration:options.duration,easing:options.easing,complete:done})});$2.effects.define("bounce",function(options,done){var upAnim,downAnim,refValue,element=$2(this),mode=options.mode,hide=mode==="hide",show=mode==="show",direction=options.direction||"up",distance=options.distance,times=options.times||5,anims=times*2+(show||hide?1:0),speed=options.duration/anims,easing=options.easing,ref=direction==="up"||direction==="down"?"top":"left",motion=direction==="up"||direction==="left",i=0,queuelen=element.queue().length;for($2.effects.createPlaceholder(element),refValue=element.css(ref),distance||(distance=element[ref==="top"?"outerHeight":"outerWidth"]()/3),show&&(downAnim={opacity:1},downAnim[ref]=refValue,element.css("opacity",0).css(ref,motion?-distance*2:distance*2).animate(downAnim,speed,easing)),hide&&(distance=distance/Math.pow(2,times-1)),downAnim={},downAnim[ref]=refValue;i<times;i++)upAnim={},upAnim[ref]=(motion?"-=":"+=")+distance,element.animate(upAnim,speed,easing).animate(downAnim,speed,easing),distance=hide?distance*2:distance/2;hide&&(upAnim={opacity:0},upAnim[ref]=(motion?"-=":"+=")+distance,element.animate(upAnim,speed,easing)),element.queue(done),$2.effects.unshift(element,queuelen,anims+1)});$2.effects.define("clip","hide",function(options,done){var start,animate={},element=$2(this),direction=options.direction||"vertical",both=direction==="both",horizontal=both||direction==="horizontal",vertical=both||direction==="vertical";start=element.cssClip(),animate.clip={top:vertical?(start.bottom-start.top)/2:start.top,right:horizontal?(start.right-start.left)/2:start.right,bottom:vertical?(start.bottom-start.top)/2:start.bottom,left:horizontal?(start.right-start.left)/2:start.left},$2.effects.createPlaceholder(element),options.mode==="show"&&(element.cssClip(animate.clip),animate.clip=start),element.animate(animate,{queue:!1,duration:options.duration,easing:options.easing,complete:done})});$2.effects.define("drop","hide",function(options,done){var distance,element=$2(this),mode=options.mode,show=mode==="show",direction=options.direction||"left",ref=direction==="up"||direction==="down"?"top":"left",motion=direction==="up"||direction==="left"?"-=":"+=",oppositeMotion=motion==="+="?"-=":"+=",animation={opacity:0};$2.effects.createPlaceholder(element),distance=options.distance||element[ref==="top"?"outerHeight":"outerWidth"](!0)/2,animation[ref]=motion+distance,show&&(element.css(animation),animation[ref]=oppositeMotion+distance,animation.opacity=1),element.animate(animation,{queue:!1,duration:options.duration,easing:options.easing,complete:done})});$2.effects.define("explode","hide",function(options,done){var i,j,left,top,mx,my,rows=options.pieces?Math.round(Math.sqrt(options.pieces)):3,cells=rows,element=$2(this),mode=options.mode,show=mode==="show",offset=element.show().css("visibility","hidden").offset(),width=Math.ceil(element.outerWidth()/cells),height=Math.ceil(element.outerHeight()/rows),pieces=[];function childComplete(){pieces.push(this),pieces.length===rows*cells&&animComplete()}for(__name(childComplete,"childComplete"),i=0;i<rows;i++)for(top=offset.top+i*height,my=i-(rows-1)/2,j=0;j<cells;j++)left=offset.left+j*width,mx=j-(cells-1)/2,element.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-j*width,top:-i*height}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width,height,left:left+(show?mx*width:0),top:top+(show?my*height:0),opacity:show?0:1}).animate({left:left+(show?0:mx*width),top:top+(show?0:my*height),opacity:show?1:0},options.duration||500,options.easing,childComplete);function animComplete(){element.css({visibility:"visible"}),$2(pieces).remove(),done()}__name(animComplete,"animComplete")});$2.effects.define("fade","toggle",function(options,done){var show=options.mode==="show";$2(this).css("opacity",show?0:1).animate({opacity:show?1:0},{queue:!1,duration:options.duration,easing:options.easing,complete:done})});$2.effects.define("fold","hide",function(options,done){var element=$2(this),mode=options.mode,show=mode==="show",hide=mode==="hide",size=options.size||15,percent=/([0-9]+)%/.exec(size),horizFirst=!!options.horizFirst,ref=horizFirst?["right","bottom"]:["bottom","right"],duration=options.duration/2,placeholder=$2.effects.createPlaceholder(element),start=element.cssClip(),animation1={clip:$2.extend({},start)},animation2={clip:$2.extend({},start)},distance=[start[ref[0]],start[ref[1]]],queuelen=element.queue().length;percent&&(size=parseInt(percent[1],10)/100*distance[hide?0:1]),animation1.clip[ref[0]]=size,animation2.clip[ref[0]]=size,animation2.clip[ref[1]]=0,show&&(element.cssClip(animation2.clip),placeholder&&placeholder.css($2.effects.clipToBox(animation2)),animation2.clip=start),element.queue(function(next){placeholder&&placeholder.animate($2.effects.clipToBox(animation1),duration,options.easing).animate($2.effects.clipToBox(animation2),duration,options.easing),next()}).animate(animation1,duration,options.easing).animate(animation2,duration,options.easing).queue(done),$2.effects.unshift(element,queuelen,4)});$2.effects.define("highlight","show",function(options,done){var element=$2(this),animation={backgroundColor:element.css("backgroundColor")};options.mode==="hide"&&(animation.opacity=0),$2.effects.saveStyle(element),element.css({backgroundImage:"none",backgroundColor:options.color||"#ffff99"}).animate(animation,{queue:!1,duration:options.duration,easing:options.easing,complete:done})});$2.effects.define("size",function(options,done){var baseline,factor,temp,element=$2(this),cProps=["fontSize"],vProps=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],hProps=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],mode=options.mode,restore=mode!=="effect",scale=options.scale||"both",origin=options.origin||["middle","center"],position=element.css("position"),pos=element.position(),original=$2.effects.scaledDimensions(element),from=options.from||original,to=options.to||$2.effects.scaledDimensions(element,0);$2.effects.createPlaceholder(element),mode==="show"&&(temp=from,from=to,to=temp),factor={from:{y:from.height/original.height,x:from.width/original.width},to:{y:to.height/original.height,x:to.width/original.width}},(scale==="box"||scale==="both")&&(factor.from.y!==factor.to.y&&(from=$2.effects.setTransition(element,vProps,factor.from.y,from),to=$2.effects.setTransition(element,vProps,factor.to.y,to)),factor.from.x!==factor.to.x&&(from=$2.effects.setTransition(element,hProps,factor.from.x,from),to=$2.effects.setTransition(element,hProps,factor.to.x,to))),(scale==="content"||scale==="both")&&factor.from.y!==factor.to.y&&(from=$2.effects.setTransition(element,cProps,factor.from.y,from),to=$2.effects.setTransition(element,cProps,factor.to.y,to)),origin&&(baseline=$2.effects.getBaseline(origin,original),from.top=(original.outerHeight-from.outerHeight)*baseline.y+pos.top,from.left=(original.outerWidth-from.outerWidth)*baseline.x+pos.left,to.top=(original.outerHeight-to.outerHeight)*baseline.y+pos.top,to.left=(original.outerWidth-to.outerWidth)*baseline.x+pos.left),delete from.outerHeight,delete from.outerWidth,element.css(from),(scale==="content"||scale==="both")&&(vProps=vProps.concat(["marginTop","marginBottom"]).concat(cProps),hProps=hProps.concat(["marginLeft","marginRight"]),element.find("*[width]").each(function(){var child=$2(this),childOriginal=$2.effects.scaledDimensions(child),childFrom={height:childOriginal.height*factor.from.y,width:childOriginal.width*factor.from.x,outerHeight:childOriginal.outerHeight*factor.from.y,outerWidth:childOriginal.outerWidth*factor.from.x},childTo={height:childOriginal.height*factor.to.y,width:childOriginal.width*factor.to.x,outerHeight:childOriginal.height*factor.to.y,outerWidth:childOriginal.width*factor.to.x};factor.from.y!==factor.to.y&&(childFrom=$2.effects.setTransition(child,vProps,factor.from.y,childFrom),childTo=$2.effects.setTransition(child,vProps,factor.to.y,childTo)),factor.from.x!==factor.to.x&&(childFrom=$2.effects.setTransition(child,hProps,factor.from.x,childFrom),childTo=$2.effects.setTransition(child,hProps,factor.to.x,childTo)),restore&&$2.effects.saveStyle(child),child.css(childFrom),child.animate(childTo,options.duration,options.easing,function(){restore&&$2.effects.restoreStyle(child)})})),element.animate(to,{queue:!1,duration:options.duration,easing:options.easing,complete:__name(function(){var offset=element.offset();to.opacity===0&&element.css("opacity",from.opacity),restore||(element.css("position",position==="static"?"relative":position).offset(offset),$2.effects.saveStyle(element)),done()},"complete")})});$2.effects.define("scale",function(options,done){var el=$2(this),mode=options.mode,percent=parseInt(options.percent,10)||(parseInt(options.percent,10)===0||mode!=="effect"?0:100),newOptions=$2.extend(!0,{from:$2.effects.scaledDimensions(el),to:$2.effects.scaledDimensions(el,percent,options.direction||"both"),origin:options.origin||["middle","center"]},options);options.fade&&(newOptions.from.opacity=1,newOptions.to.opacity=0),$2.effects.effect.size.call(this,newOptions,done)});$2.effects.define("puff","hide",function(options,done){var newOptions=$2.extend(!0,{},options,{fade:!0,percent:parseInt(options.percent,10)||150});$2.effects.effect.scale.call(this,newOptions,done)});$2.effects.define("pulsate","show",function(options,done){var element=$2(this),mode=options.mode,show=mode==="show",hide=mode==="hide",showhide=show||hide,anims=(options.times||5)*2+(showhide?1:0),duration=options.duration/anims,animateTo=0,i=1,queuelen=element.queue().length;for((show||!element.is(":visible"))&&(element.css("opacity",0).show(),animateTo=1);i<anims;i++)element.animate({opacity:animateTo},duration,options.easing),animateTo=1-animateTo;element.animate({opacity:animateTo},duration,options.easing),element.queue(done),$2.effects.unshift(element,queuelen,anims+1)});$2.effects.define("shake",function(options,done){var i=1,element=$2(this),direction=options.direction||"left",distance=options.distance||20,times=options.times||3,anims=times*2+1,speed=Math.round(options.duration/anims),ref=direction==="up"||direction==="down"?"top":"left",positiveMotion=direction==="up"||direction==="left",animation={},animation1={},animation2={},queuelen=element.queue().length;for($2.effects.createPlaceholder(element),animation[ref]=(positiveMotion?"-=":"+=")+distance,animation1[ref]=(positiveMotion?"+=":"-=")+distance*2,animation2[ref]=(positiveMotion?"-=":"+=")+distance*2,element.animate(animation,speed,options.easing);i<times;i++)element.animate(animation1,speed,options.easing).animate(animation2,speed,options.easing);element.animate(animation1,speed,options.easing).animate(animation,speed/2,options.easing).queue(done),$2.effects.unshift(element,queuelen,anims+1)});$2.effects.define("slide","show",function(options,done){var startClip,startRef,element=$2(this),map={up:["bottom","top"],down:["top","bottom"],left:["right","left"],right:["left","right"]},mode=options.mode,direction=options.direction||"left",ref=direction==="up"||direction==="down"?"top":"left",positiveMotion=direction==="up"||direction==="left",distance=options.distance||element[ref==="top"?"outerHeight":"outerWidth"](!0),animation={};$2.effects.createPlaceholder(element),startClip=element.cssClip(),startRef=element.position()[ref],animation[ref]=(positiveMotion?-1:1)*distance+startRef,animation.clip=element.cssClip(),animation.clip[map[direction][1]]=animation.clip[map[direction][0]],mode==="show"&&(element.cssClip(animation.clip),element.css(ref,animation[ref]),animation.clip=startClip,animation[ref]=startRef),element.animate(animation,{queue:!1,duration:options.duration,easing:options.easing,complete:done})}),$2.uiBackCompat===!0&&$2.effects.define("transfer",function(options,done){$2(this).transfer(options,done)});$2.ui.focusable=function(element,hasTabindex){var map,mapName,img,focusableIfVisible,fieldset,nodeName=element.nodeName.toLowerCase();return nodeName==="area"?(map=element.parentNode,mapName=map.name,!element.href||!mapName||map.nodeName.toLowerCase()!=="map"?!1:(img=$2("img[usemap='#"+mapName+"']"),img.length>0&&img.is(":visible"))):(/^(input|select|textarea|button|object)$/.test(nodeName)?(focusableIfVisible=!element.disabled,focusableIfVisible&&(fieldset=$2(element).closest("fieldset")[0],fieldset&&(focusableIfVisible=!fieldset.disabled))):nodeName==="a"?focusableIfVisible=element.href||hasTabindex:focusableIfVisible=hasTabindex,focusableIfVisible&&$2(element).is(":visible")&&$2(element).css("visibility")==="visible")},$2.extend($2.expr.pseudos,{focusable:__name(function(element){return $2.ui.focusable(element,$2.attr(element,"tabindex")!=null)},"focusable")}),$2.ui.focusable;$2.ui.formResetMixin={_formResetHandler:__name(function(){var form=$2(this);setTimeout(function(){var instances=form.data("ui-form-reset-instances");$2.each(instances,function(){this.refresh()})})},"_formResetHandler"),_bindFormResetHandler:__name(function(){if(this.form=$2(this.element.prop("form")),!!this.form.length){var instances=this.form.data("ui-form-reset-instances")||[];instances.length||this.form.on("reset.ui-form-reset",this._formResetHandler),instances.push(this),this.form.data("ui-form-reset-instances",instances)}},"_bindFormResetHandler"),_unbindFormResetHandler:__name(function(){if(this.form.length){var instances=this.form.data("ui-form-reset-instances");instances.splice($2.inArray(this,instances),1),instances.length?this.form.data("ui-form-reset-instances",instances):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}},"_unbindFormResetHandler")};$2.escapeSelector||($2.escapeSelector=function(id){return CSS.escape(id+"")}),(!$2.fn.even||!$2.fn.odd)&&$2.fn.extend({even:__name(function(){return this.filter(function(i){return i%2===0})},"even"),odd:__name(function(){return this.filter(function(i){return i%2===1})},"odd")});$2.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38};$2.fn.labels=function(){var ancestor,selector,id,labels,ancestors;return this.length?this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(labels=this.eq(0).parents("label"),id=this.attr("id"),id&&(ancestor=this.eq(0).parents().last(),ancestors=ancestor.add(ancestor.length?ancestor.siblings():this.siblings()),selector="label[for='"+CSS.escape(id)+"']",labels=labels.add(ancestors.find(selector).addBack(selector))),this.pushStack(labels)):this.pushStack([])};$2.fn.scrollParent=function(includeHidden){var position=this.css("position"),excludeStaticParent=position==="absolute",overflowRegex=includeHidden?/(auto|scroll|hidden)/:/(auto|scroll)/,scrollParent=this.parents().filter(function(){var parent2=$2(this);return excludeStaticParent&&parent2.css("position")==="static"?!1:overflowRegex.test(parent2.css("overflow")+parent2.css("overflow-y")+parent2.css("overflow-x"))}).eq(0);return position==="fixed"||!scrollParent.length?$2(this[0].ownerDocument||document):scrollParent};$2.extend($2.expr.pseudos,{tabbable:__name(function(element){var tabIndex=$2.attr(element,"tabindex"),hasTabindex=tabIndex!=null;return(!hasTabindex||tabIndex>=0)&&$2.ui.focusable(element,hasTabindex)},"tabbable")});$2.fn.extend({uniqueId:(function(){var uuid=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++uuid)})}})(),removeUniqueId:__name(function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&$2(this).removeAttr("id")})},"removeUniqueId")});$2.widget("ui.accordion",{version:"1.14.1",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:!1,event:"click",header:__name(function(elem){return elem.find("> li > :first-child").add(elem.find("> :not(li)").filter(function(i){return i%2===0}))},"header"),heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:__name(function(){var options=this.options;this.prevShow=this.prevHide=$2(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),!options.collapsible&&(options.active===!1||options.active==null)&&(options.active=0),this._processPanels(),options.active<0&&(options.active+=this.headers.length),this._refresh()},"_create"),_getCreateEventData:__name(function(){return{header:this.active,panel:this.active.length?this.active.next():$2()}},"_getCreateEventData"),_createIcons:__name(function(){var icon,children,icons=this.options.icons;icons&&(icon=$2("<span>"),this._addClass(icon,"ui-accordion-header-icon","ui-icon "+icons.header),icon.prependTo(this.headers),children=this.active.children(".ui-accordion-header-icon"),this._removeClass(children,icons.header)._addClass(children,null,icons.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},"_createIcons"),_destroyIcons:__name(function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},"_destroyIcons"),_destroy:__name(function(){var contents;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),contents=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),this.options.heightStyle!=="content"&&contents.css("height","")},"_destroy"),_setOption:__name(function(key,value){if(key==="active"){this._activate(value);return}key==="event"&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(value)),this._super(key,value),key==="collapsible"&&!value&&this.options.active===!1&&this._activate(0),key==="icons"&&(this._destroyIcons(),value&&this._createIcons())},"_setOption"),_setOptionDisabled:__name(function(value){this._super(value),this.element.attr("aria-disabled",value),this._toggleClass(null,"ui-state-disabled",!!value)},"_setOptionDisabled"),_keydown:__name(function(event){if(!(event.altKey||event.ctrlKey)){var keyCode=$2.ui.keyCode,length=this.headers.length,currentIndex=this.headers.index(event.target),toFocus=!1;switch(event.keyCode){case keyCode.RIGHT:case keyCode.DOWN:toFocus=this.headers[(currentIndex+1)%length];break;case keyCode.LEFT:case keyCode.UP:toFocus=this.headers[(currentIndex-1+length)%length];break;case keyCode.SPACE:case keyCode.ENTER:this._eventHandler(event);break;case keyCode.HOME:toFocus=this.headers[0];break;case keyCode.END:toFocus=this.headers[length-1];break}toFocus&&($2(event.target).attr("tabIndex",-1),$2(toFocus).attr("tabIndex",0),$2(toFocus).trigger("focus"),event.preventDefault())}},"_keydown"),_panelKeyDown:__name(function(event){event.keyCode===$2.ui.keyCode.UP&&event.ctrlKey&&$2(event.currentTarget).prev().trigger("focus")},"_panelKeyDown"),refresh:__name(function(){var options=this.options;this._processPanels(),options.active===!1&&options.collapsible===!0||!this.headers.length?(options.active=!1,this.active=$2()):options.active===!1?this._activate(0):this.active.length&&!$2.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(options.active=!1,this.active=$2()):this._activate(Math.max(0,options.active-1)):options.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},"refresh"),_processPanels:__name(function(){var prevHeaders=this.headers,prevPanels=this.panels;typeof this.options.header=="function"?this.headers=this.options.header(this.element):this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),prevPanels&&(this._off(prevHeaders.not(this.headers)),this._off(prevPanels.not(this.panels)))},"_processPanels"),_refresh:__name(function(){var maxHeight,options=this.options,heightStyle=options.heightStyle,parent2=this.element.parent();this.active=this._findActive(options.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var header=$2(this),headerId=header.uniqueId().attr("id"),panel=header.next(),panelId=panel.uniqueId().attr("id");header.attr("aria-controls",panelId),panel.attr("aria-labelledby",headerId)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(options.event),heightStyle==="fill"?(maxHeight=parent2.height(),this.element.siblings(":visible").each(function(){var elem=$2(this),position=elem.css("position");position==="absolute"||position==="fixed"||(maxHeight-=elem.outerHeight(!0))}),this.headers.each(function(){maxHeight-=$2(this).outerHeight(!0)}),this.headers.next().each(function(){$2(this).height(Math.max(0,maxHeight-$2(this).innerHeight()+$2(this).height()))}).css("overflow","auto")):heightStyle==="auto"&&(maxHeight=0,this.headers.next().each(function(){var isVisible=$2(this).is(":visible");isVisible||$2(this).show(),maxHeight=Math.max(maxHeight,$2(this).css("height","").height()),isVisible||$2(this).hide()}).height(maxHeight))},"_refresh"),_activate:__name(function(index){var active=this._findActive(index)[0];active!==this.active[0]&&(active=active||this.active[0],this._eventHandler({target:active,currentTarget:active,preventDefault:$2.noop}))},"_activate"),_findActive:__name(function(selector){return typeof selector=="number"?this.headers.eq(selector):$2()},"_findActive"),_setupEvents:__name(function(event){var events={keydown:"_keydown"};event&&$2.each(event.split(" "),function(index,eventName){events[eventName]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,events),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},"_setupEvents"),_eventHandler:__name(function(event){var activeChildren,clickedChildren,options=this.options,active=this.active,clicked=$2(event.currentTarget),clickedIsActive=clicked[0]===active[0],collapsing=clickedIsActive&&options.collapsible,toShow=collapsing?$2():clicked.next(),toHide=active.next(),eventData={oldHeader:active,oldPanel:toHide,newHeader:collapsing?$2():clicked,newPanel:toShow};event.preventDefault(),!(clickedIsActive&&!options.collapsible||this._trigger("beforeActivate",event,eventData)===!1)&&(options.active=collapsing?!1:this.headers.index(clicked),this.active=clickedIsActive?$2():clicked,this._toggle(eventData),this._removeClass(active,"ui-accordion-header-active","ui-state-active"),options.icons&&(activeChildren=active.children(".ui-accordion-header-icon"),this._removeClass(activeChildren,null,options.icons.activeHeader)._addClass(activeChildren,null,options.icons.header)),clickedIsActive||(this._removeClass(clicked,"ui-accordion-header-collapsed")._addClass(clicked,"ui-accordion-header-active","ui-state-active"),options.icons&&(clickedChildren=clicked.children(".ui-accordion-header-icon"),this._removeClass(clickedChildren,null,options.icons.header)._addClass(clickedChildren,null,options.icons.activeHeader)),this._addClass(clicked.next(),"ui-accordion-content-active")))},"_eventHandler"),_toggle:__name(function(data){var toShow=data.newPanel,toHide=this.prevShow.length?this.prevShow:data.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=toShow,this.prevHide=toHide,this.options.animate?this._animate(toShow,toHide,data):(toHide.hide(),toShow.show(),this._toggleComplete(data)),toHide.attr({"aria-hidden":"true"}),toHide.prev().attr({"aria-selected":"false","aria-expanded":"false"}),toShow.length&&toHide.length?toHide.prev().attr({tabIndex:-1,"aria-expanded":"false"}):toShow.length&&this.headers.filter(function(){return parseInt($2(this).attr("tabIndex"),10)===0}).attr("tabIndex",-1),toShow.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},"_toggle"),_animate:__name(function(toShow,toHide,data){var total,easing,duration,that=this,adjust=0,boxSizing=toShow.css("box-sizing"),down=toShow.length&&(!toHide.length||toShow.index()<toHide.index()),animate=this.options.animate||{},options=down&&animate.down||animate,complete=__name(function(){that._toggleComplete(data)},"complete");if(typeof options=="number"&&(duration=options),typeof options=="string"&&(easing=options),easing=easing||options.easing||animate.easing,duration=duration||options.duration||animate.duration,!toHide.length)return toShow.animate(this.showProps,duration,easing,complete);if(!toShow.length)return toHide.animate(this.hideProps,duration,easing,complete);total=toShow.show().outerHeight(),toHide.animate(this.hideProps,{duration,easing,step:__name(function(now,fx){fx.now=Math.round(now)},"step")}),toShow.hide().animate(this.showProps,{duration,easing,complete,step:__name(function(now,fx){fx.now=Math.round(now),fx.prop!=="height"?boxSizing==="content-box"&&(adjust+=fx.now):that.options.heightStyle!=="content"&&(fx.now=Math.round(total-toHide.outerHeight()-adjust),adjust=0)},"step")})},"_animate"),_toggleComplete:__name(function(data){var toHide=data.oldPanel,prev=toHide.prev();this._removeClass(toHide,"ui-accordion-content-active"),this._removeClass(prev,"ui-accordion-header-active")._addClass(prev,"ui-accordion-header-collapsed"),this._trigger("activate",null,data)},"_toggleComplete")});$2.widget("ui.menu",{version:"1.14.1",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:__name(function(){this.activeMenu=this.element,this.mouseHandled=!1,this.lastMousePosition={x:null,y:null},this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":__name(function(event){event.preventDefault(),this._activateItem(event)},"mousedown .ui-menu-item"),"click .ui-menu-item":__name(function(event){var target=$2(event.target),active=$2(this.document[0].activeElement);!this.mouseHandled&&target.not(".ui-state-disabled").length&&(this.select(event),event.isPropagationStopped()||(this.mouseHandled=!0),target.has(".ui-menu").length?this.expand(event):!this.element.is(":focus")&&active.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&this.active.parents(".ui-menu").length===1&&clearTimeout(this.timer)))},"click .ui-menu-item"),"mouseenter .ui-menu-item":"_activateItem","mousemove .ui-menu-item":"_activateItem",mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:__name(function(event,keepActiveItem){var item=this.active||this._menuItems().first();keepActiveItem||this.focus(event,item)},"focus"),blur:__name(function(event){this._delay(function(){var notContained=!$2.contains(this.element[0],this.document[0].activeElement);notContained&&this.collapseAll(event)})},"blur"),keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:__name(function(event){this._closeOnDocumentClick(event)&&this.collapseAll(event,!0),this.mouseHandled=!1},"click")})},"_create"),_activateItem:__name(function(event){if(!this.previousFilter&&!(event.clientX===this.lastMousePosition.x&&event.clientY===this.lastMousePosition.y)){this.lastMousePosition={x:event.clientX,y:event.clientY};var actualTarget=$2(event.target).closest(".ui-menu-item"),target=$2(event.currentTarget);actualTarget[0]===target[0]&&(target.is(".ui-state-active")||(this._removeClass(target.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(event,target)))}},"_activateItem"),_destroy:__name(function(){var items=this.element.find(".ui-menu-item").removeAttr("role aria-disabled"),submenus=items.children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),submenus.children().each(function(){var elem=$2(this);elem.data("ui-menu-submenu-caret")&&elem.remove()})},"_destroy"),_keydown:__name(function(event){var match,prev,character,skip,preventDefault=!0;switch(event.keyCode){case $2.ui.keyCode.PAGE_UP:this.previousPage(event);break;case $2.ui.keyCode.PAGE_DOWN:this.nextPage(event);break;case $2.ui.keyCode.HOME:this._move("first","first",event);break;case $2.ui.keyCode.END:this._move("last","last",event);break;case $2.ui.keyCode.UP:this.previous(event);break;case $2.ui.keyCode.DOWN:this.next(event);break;case $2.ui.keyCode.LEFT:this.collapse(event);break;case $2.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(event);break;case $2.ui.keyCode.ENTER:case $2.ui.keyCode.SPACE:this._activate(event);break;case $2.ui.keyCode.ESCAPE:this.collapse(event);break;default:preventDefault=!1,prev=this.previousFilter||"",skip=!1,character=event.keyCode>=96&&event.keyCode<=105?(event.keyCode-96).toString():String.fromCharCode(event.keyCode),clearTimeout(this.filterTimer),character===prev?skip=!0:character=prev+character,match=this._filterMenuItems(character),match=skip&&match.index(this.active.next())!==-1?this.active.nextAll(".ui-menu-item"):match,match.length||(character=String.fromCharCode(event.keyCode),match=this._filterMenuItems(character)),match.length?(this.focus(event,match),this.previousFilter=character,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}preventDefault&&event.preventDefault()},"_keydown"),_activate:__name(function(event){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(event):this.select(event))},"_activate"),refresh:__name(function(){var menus,items,newSubmenus,newItems,newWrappers,that=this,icon=this.options.icons.submenu,submenus=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),newSubmenus=submenus.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var menu=$2(this),item=menu.prev(),submenuCaret=$2("<span>").data("ui-menu-submenu-caret",!0);that._addClass(submenuCaret,"ui-menu-icon","ui-icon "+icon),item.attr("aria-haspopup","true").prepend(submenuCaret),menu.attr("aria-labelledby",item.attr("id"))}),this._addClass(newSubmenus,"ui-menu","ui-widget ui-widget-content ui-front"),menus=submenus.add(this.element),items=menus.find(this.options.items),items.not(".ui-menu-item").each(function(){var item=$2(this);that._isDivider(item)&&that._addClass(item,"ui-menu-divider","ui-widget-content")}),newItems=items.not(".ui-menu-item, .ui-menu-divider"),newWrappers=newItems.children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(newItems,"ui-menu-item")._addClass(newWrappers,"ui-menu-item-wrapper"),items.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!$2.contains(this.element[0],this.active[0])&&this.blur()},"refresh"),_itemRole:__name(function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},"_itemRole"),_setOption:__name(function(key,value){if(key==="icons"){var icons=this.element.find(".ui-menu-icon");this._removeClass(icons,null,this.options.icons.submenu)._addClass(icons,null,value.submenu)}this._super(key,value)},"_setOption"),_setOptionDisabled:__name(function(value){this._super(value),this.element.attr("aria-disabled",String(value)),this._toggleClass(null,"ui-state-disabled",!!value)},"_setOptionDisabled"),focus:__name(function(event,item){var nested,focused,activeParent;this.blur(event,event&&event.type==="focus"),this._scrollIntoView(item),this.active=item.first(),focused=this.active.children(".ui-menu-item-wrapper"),this._addClass(focused,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",focused.attr("id")),activeParent=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(activeParent,null,"ui-state-active"),event&&event.type==="keydown"?this._close():this.timer=this._delay(function(){this._close()},this.delay),nested=item.children(".ui-menu"),nested.length&&event&&/^mouse/.test(event.type)&&this._startOpening(nested),this.activeMenu=item.parent(),this._trigger("focus",event,{item})},"focus"),_scrollIntoView:__name(function(item){var borderTop,paddingTop,offset,scroll,elementHeight,itemHeight;this._hasScroll()&&(borderTop=parseFloat($2.css(this.activeMenu[0],"borderTopWidth"))||0,paddingTop=parseFloat($2.css(this.activeMenu[0],"paddingTop"))||0,offset=item.offset().top-this.activeMenu.offset().top-borderTop-paddingTop,scroll=this.activeMenu.scrollTop(),elementHeight=this.activeMenu.height(),itemHeight=item.outerHeight(),offset<0?this.activeMenu.scrollTop(scroll+offset):offset+itemHeight>elementHeight&&this.activeMenu.scrollTop(scroll+offset-elementHeight+itemHeight))},"_scrollIntoView"),blur:__name(function(event,fromFocus){fromFocus||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",event,{item:this.active}),this.active=null)},"blur"),_startOpening:__name(function(submenu){clearTimeout(this.timer),submenu.attr("aria-hidden")==="true"&&(this.timer=this._delay(function(){this._close(),this._open(submenu)},this.delay))},"_startOpening"),_open:__name(function(submenu){var position=$2.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(submenu.parents(".ui-menu")).hide().attr("aria-hidden","true"),submenu.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(position)},"_open"),collapseAll:__name(function(event,all){clearTimeout(this.timer),this.timer=this._delay(function(){var currentMenu=all?this.element:$2(event&&event.target).closest(this.element.find(".ui-menu"));currentMenu.length||(currentMenu=this.element),this._close(currentMenu),this.blur(event),this._removeClass(currentMenu.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=currentMenu},all?0:this.delay)},"collapseAll"),_close:__name(function(startMenu){startMenu||(startMenu=this.active?this.active.parent():this.element),startMenu.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},"_close"),_closeOnDocumentClick:__name(function(event){return!$2(event.target).closest(".ui-menu").length},"_closeOnDocumentClick"),_isDivider:__name(function(item){return!/[^\-\u2014\u2013\s]/.test(item.text())},"_isDivider"),collapse:__name(function(event){var newItem=this.active&&this.active.parent().closest(".ui-menu-item",this.element);newItem&&newItem.length&&(this._close(),this.focus(event,newItem))},"collapse"),expand:__name(function(event){var newItem=this.active&&this._menuItems(this.active.children(".ui-menu")).first();newItem&&newItem.length&&(this._open(newItem.parent()),this._delay(function(){this.focus(event,newItem)}))},"expand"),next:__name(function(event){this._move("next","first",event)},"next"),previous:__name(function(event){this._move("prev","last",event)},"previous"),isFirstItem:__name(function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},"isFirstItem"),isLastItem:__name(function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},"isLastItem"),_menuItems:__name(function(menu){return(menu||this.element).find(this.options.items).filter(".ui-menu-item")},"_menuItems"),_move:__name(function(direction,filter,event){var next;this.active&&(direction==="first"||direction==="last"?next=this.active[direction==="first"?"prevAll":"nextAll"](".ui-menu-item").last():next=this.active[direction+"All"](".ui-menu-item").first()),(!next||!next.length||!this.active)&&(next=this._menuItems(this.activeMenu)[filter]()),this.focus(event,next)},"_move"),nextPage:__name(function(event){var item,base,height;if(!this.active){this.next(event);return}this.isLastItem()||(this._hasScroll()?(base=this.active.offset().top,height=this.element.innerHeight(),$2.fn.jquery.indexOf("3.2.")===0&&(height+=this.element[0].offsetHeight-this.element.outerHeight()),this.active.nextAll(".ui-menu-item").each(function(){return item=$2(this),item.offset().top-base-height<0}),this.focus(event,item)):this.focus(event,this._menuItems(this.activeMenu)[this.active?"last":"first"]()))},"nextPage"),previousPage:__name(function(event){var item,base,height;if(!this.active){this.next(event);return}this.isFirstItem()||(this._hasScroll()?(base=this.active.offset().top,height=this.element.innerHeight(),$2.fn.jquery.indexOf("3.2.")===0&&(height+=this.element[0].offsetHeight-this.element.outerHeight()),this.active.prevAll(".ui-menu-item").each(function(){return item=$2(this),item.offset().top-base+height>0}),this.focus(event,item)):this.focus(event,this._menuItems(this.activeMenu).first()))},"previousPage"),_hasScroll:__name(function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},"_hasScroll"),select:__name(function(event){this.active=this.active||$2(event.target).closest(".ui-menu-item");var ui={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(event,!0),this._trigger("select",event,ui)},"select"),_filterMenuItems:__name(function(character){var escapedCharacter=character.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),regex=new RegExp("^"+escapedCharacter,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return regex.test(String.prototype.trim.call($2(this).children(".ui-menu-item-wrapper").text()))})},"_filterMenuItems")});$2.widget("ui.autocomplete",{version:"1.14.1",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,liveRegionTimer:null,_create:__name(function(){var suppressKeyPress,suppressKeyPressRepeat,suppressInput,nodeName=this.element[0].nodeName.toLowerCase(),isTextarea=nodeName==="textarea",isInput=nodeName==="input";this.isMultiLine=isTextarea||!isInput&&this.element.prop("contentEditable")==="true",this.valueMethod=this.element[isTextarea||isInput?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:__name(function(event){if(this.element.prop("readOnly")){suppressKeyPress=!0,suppressInput=!0,suppressKeyPressRepeat=!0;return}suppressKeyPress=!1,suppressInput=!1,suppressKeyPressRepeat=!1;var keyCode=$2.ui.keyCode;switch(event.keyCode){case keyCode.PAGE_UP:suppressKeyPress=!0,this._move("previousPage",event);break;case keyCode.PAGE_DOWN:suppressKeyPress=!0,this._move("nextPage",event);break;case keyCode.UP:suppressKeyPress=!0,this._keyEvent("previous",event);break;case keyCode.DOWN:suppressKeyPress=!0,this._keyEvent("next",event);break;case keyCode.ENTER:this.menu.active&&(suppressKeyPress=!0,event.preventDefault(),this.menu.select(event));break;case keyCode.TAB:this.menu.active&&this.menu.select(event);break;case keyCode.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(event),event.preventDefault());break;default:suppressKeyPressRepeat=!0,this._searchTimeout(event);break}},"keydown"),keypress:__name(function(event){if(suppressKeyPress){suppressKeyPress=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&event.preventDefault();return}if(!suppressKeyPressRepeat){var keyCode=$2.ui.keyCode;switch(event.keyCode){case keyCode.PAGE_UP:this._move("previousPage",event);break;case keyCode.PAGE_DOWN:this._move("nextPage",event);break;case keyCode.UP:this._keyEvent("previous",event);break;case keyCode.DOWN:this._keyEvent("next",event);break}}},"keypress"),input:__name(function(event){if(suppressInput){suppressInput=!1,event.preventDefault();return}this._searchTimeout(event)},"input"),focus:__name(function(){this.selectedItem=null,this.previous=this._value()},"focus"),blur:__name(function(event){clearTimeout(this.searching),this.close(event),this._change(event)},"blur")}),this._initSource(),this.menu=$2("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:__name(function(event){event.preventDefault()},"mousedown"),menufocus:__name(function(event,ui){var label,item;if(this.isNewMenu&&(this.isNewMenu=!1,event.originalEvent&&/^mouse/.test(event.originalEvent.type))){this.menu.blur(),this.document.one("mousemove",function(){$2(event.target).trigger(event.originalEvent)});return}item=ui.item.data("ui-autocomplete-item"),this._trigger("focus",event,{item})!==!1&&event.originalEvent&&/^key/.test(event.originalEvent.type)&&this._value(item.value),label=ui.item.attr("aria-label")||item.value,label&&String.prototype.trim.call(label).length&&(clearTimeout(this.liveRegionTimer),this.liveRegionTimer=this._delay(function(){this.liveRegion.html($2("<div>").text(label))},100))},"menufocus"),menuselect:__name(function(event,ui){var item=ui.item.data("ui-autocomplete-item"),previous=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.trigger("focus"),this.previous=previous),this._trigger("select",event,{item})!==!1&&this._value(item.value),this.term=this._value(),this.close(event),this.selectedItem=item},"menuselect")}),this.liveRegion=$2("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:__name(function(){this.element.removeAttr("autocomplete")},"beforeunload")})},"_create"),_destroy:__name(function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},"_destroy"),_setOption:__name(function(key,value){this._super(key,value),key==="source"&&this._initSource(),key==="appendTo"&&this.menu.element.appendTo(this._appendTo()),key==="disabled"&&value&&this.xhr&&this.xhr.abort()},"_setOption"),_isEventTargetInWidget:__name(function(event){var menuElement=this.menu.element[0];return event.target===this.element[0]||event.target===menuElement||$2.contains(menuElement,event.target)},"_isEventTargetInWidget"),_closeOnClickOutside:__name(function(event){this._isEventTargetInWidget(event)||this.close()},"_closeOnClickOutside"),_appendTo:__name(function(){var element=this.options.appendTo;return element&&(element=element.jquery||element.nodeType?$2(element):this.document.find(element).eq(0)),(!element||!element[0])&&(element=this.element.closest(".ui-front, dialog")),element.length||(element=this.document[0].body),element},"_appendTo"),_initSource:__name(function(){var array,url,that=this;Array.isArray(this.options.source)?(array=this.options.source,this.source=function(request,response){response($2.ui.autocomplete.filter(array,request.term))}):typeof this.options.source=="string"?(url=this.options.source,this.source=function(request,response){that.xhr&&that.xhr.abort(),that.xhr=$2.ajax({url,data:request,dataType:"json",success:__name(function(data){response(data)},"success"),error:__name(function(){response([])},"error")})}):this.source=this.options.source},"_initSource"),_searchTimeout:__name(function(event){clearTimeout(this.searching),this.searching=this._delay(function(){var equalValues=this.term===this._value(),menuVisible=this.menu.element.is(":visible"),modifierKey=event.altKey||event.ctrlKey||event.metaKey||event.shiftKey;(!equalValues||equalValues&&!menuVisible&&!modifierKey)&&(this.selectedItem=null,this.search(null,event))},this.options.delay)},"_searchTimeout"),search:__name(function(value,event){if(value=value??this._value(),this.term=this._value(),value.length<this.options.minLength)return this.close(event);if(this._trigger("search",event)!==!1)return this._search(value)},"search"),_search:__name(function(value){this.pending++,this._addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:value},this._response())},"_search"),_response:__name(function(){var index=++this.requestIndex;return function(content){index===this.requestIndex&&this.__response(content),this.pending--,this.pending||this._removeClass("ui-autocomplete-loading")}.bind(this)},"_response"),__response:__name(function(content){content&&(content=this._normalize(content)),this._trigger("response",null,{content}),!this.options.disabled&&content&&content.length&&!this.cancelSearch?(this._suggest(content),this._trigger("open")):this._close()},"__response"),close:__name(function(event){this.cancelSearch=!0,this._close(event)},"close"),_close:__name(function(event){this._off(this.document,"mousedown"),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",event))},"_close"),_change:__name(function(event){this.previous!==this._value()&&this._trigger("change",event,{item:this.selectedItem})},"_change"),_normalize:__name(function(items){return items.length&&items[0].label&&items[0].value?items:$2.map(items,function(item){return typeof item=="string"?{label:item,value:item}:$2.extend({},item,{label:item.label||item.value,value:item.value||item.label})})},"_normalize"),_suggest:__name(function(items){var ul=this.menu.element.empty();this._renderMenu(ul,items),this.isNewMenu=!0,this.menu.refresh(),ul.show(),this._resizeMenu(),ul.position($2.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(),this._on(this.document,{mousedown:"_closeOnClickOutside"})},"_suggest"),_resizeMenu:__name(function(){var ul=this.menu.element;ul.outerWidth(Math.max(ul.width("").outerWidth()+1,this.element.outerWidth()))},"_resizeMenu"),_renderMenu:__name(function(ul,items){var that=this;$2.each(items,function(index,item){that._renderItemData(ul,item)})},"_renderMenu"),_renderItemData:__name(function(ul,item){return this._renderItem(ul,item).data("ui-autocomplete-item",item)},"_renderItemData"),_renderItem:__name(function(ul,item){return $2("<li>").append($2("<div>").text(item.label)).appendTo(ul)},"_renderItem"),_move:__name(function(direction,event){if(!this.menu.element.is(":visible")){this.search(null,event);return}if(this.menu.isFirstItem()&&/^previous/.test(direction)||this.menu.isLastItem()&&/^next/.test(direction)){this.isMultiLine||this._value(this.term),this.menu.blur();return}this.menu[direction](event)},"_move"),widget:__name(function(){return this.menu.element},"widget"),_value:__name(function(){return this.valueMethod.apply(this.element,arguments)},"_value"),_keyEvent:__name(function(keyEvent,event){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(keyEvent,event),event.preventDefault())},"_keyEvent")}),$2.extend($2.ui.autocomplete,{escapeRegex:__name(function(value){return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},"escapeRegex"),filter:__name(function(array,term){var matcher=new RegExp($2.ui.autocomplete.escapeRegex(term),"i");return $2.grep(array,function(value){return matcher.test(value.label||value.value||value)})},"filter")}),$2.widget("ui.autocomplete",$2.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:__name(function(amount){return amount+(amount>1?" results are":" result is")+" available, use up and down arrow keys to navigate."},"results")}},__response:__name(function(content){var message;this._superApply(arguments),!(this.options.disabled||this.cancelSearch)&&(content&&content.length?message=this.options.messages.results(content.length):message=this.options.messages.noResults,clearTimeout(this.liveRegionTimer),this.liveRegionTimer=this._delay(function(){this.liveRegion.html($2("<div>").text(message))},100))},"__response")}),$2.ui.autocomplete;var controlgroupCornerRegex=/ui-corner-([a-z]){2,6}/g;$2.widget("ui.controlgroup",{version:"1.14.1",defaultElement:"<div>",options:{direction:"horizontal",disabled:null,onlyVisible:!0,items:{button:"input[type=button], input[type=submit], input[type=reset], button, a",controlgroupLabel:".ui-controlgroup-label",checkboxradio:"input[type='checkbox'], input[type='radio']",selectmenu:"select",spinner:".ui-spinner-input"}},_create:__name(function(){this._enhance()},"_create"),_enhance:__name(function(){this.element.attr("role","toolbar"),this.refresh()},"_enhance"),_destroy:__name(function(){this._callChildMethod("destroy"),this.childWidgets.removeData("ui-controlgroup-data"),this.element.removeAttr("role"),this.options.items.controlgroupLabel&&this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap()},"_destroy"),_initWidgets:__name(function(){var that=this,childWidgets=[];$2.each(this.options.items,function(widget,selector){var labels,options={};if(selector){if(widget==="controlgroupLabel"){labels=that.element.find(selector),labels.each(function(){var element=$2(this);element.children(".ui-controlgroup-label-contents").length||element.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>")}),that._addClass(labels,null,"ui-widget ui-widget-content ui-state-default"),childWidgets=childWidgets.concat(labels.get());return}$2.fn[widget]&&(that["_"+widget+"Options"]?options=that["_"+widget+"Options"]("middle"):options={classes:{}},that.element.find(selector).each(function(){var element=$2(this),instance=element[widget]("instance"),instanceOptions=$2.widget.extend({},options);if(!(widget==="button"&&element.parent(".ui-spinner").length)){instance||(instance=element[widget]()[widget]("instance")),instance&&(instanceOptions.classes=that._resolveClassesValues(instanceOptions.classes,instance)),element[widget](instanceOptions);var widgetElement=element[widget]("widget");$2.data(widgetElement[0],"ui-controlgroup-data",instance||element[widget]("instance")),childWidgets.push(widgetElement[0])}}))}}),this.childWidgets=$2($2.uniqueSort(childWidgets)),this._addClass(this.childWidgets,"ui-controlgroup-item")},"_initWidgets"),_callChildMethod:__name(function(method){this.childWidgets.each(function(){var element=$2(this),data=element.data("ui-controlgroup-data");data&&data[method]&&data[method]()})},"_callChildMethod"),_updateCornerClass:__name(function(element,position){var remove="ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all",add=this._buildSimpleOptions(position,"label").classes.label;this._removeClass(element,null,remove),this._addClass(element,null,add)},"_updateCornerClass"),_buildSimpleOptions:__name(function(position,key){var direction=this.options.direction==="vertical",result={classes:{}};return result.classes[key]={middle:"",first:"ui-corner-"+(direction?"top":"left"),last:"ui-corner-"+(direction?"bottom":"right"),only:"ui-corner-all"}[position],result},"_buildSimpleOptions"),_spinnerOptions:__name(function(position){var options=this._buildSimpleOptions(position,"ui-spinner");return options.classes["ui-spinner-up"]="",options.classes["ui-spinner-down"]="",options},"_spinnerOptions"),_buttonOptions:__name(function(position){return this._buildSimpleOptions(position,"ui-button")},"_buttonOptions"),_checkboxradioOptions:__name(function(position){return this._buildSimpleOptions(position,"ui-checkboxradio-label")},"_checkboxradioOptions"),_selectmenuOptions:__name(function(position){var direction=this.options.direction==="vertical";return{width:direction?"auto":!1,classes:{middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(direction?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(direction?"top":"left")},last:{"ui-selectmenu-button-open":direction?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(direction?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}}[position]}},"_selectmenuOptions"),_resolveClassesValues:__name(function(classes,instance){var result={};return $2.each(classes,function(key){var current=instance.options.classes[key]||"";current=String.prototype.trim.call(current.replace(controlgroupCornerRegex,"")),result[key]=(current+" "+classes[key]).replace(/\s+/g," ")}),result},"_resolveClassesValues"),_setOption:__name(function(key,value){if(key==="direction"&&this._removeClass("ui-controlgroup-"+this.options.direction),this._super(key,value),key==="disabled"){this._callChildMethod(value?"disable":"enable");return}this.refresh()},"_setOption"),refresh:__name(function(){var children,that=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction),this.options.direction==="horizontal"&&this._addClass(null,"ui-helper-clearfix"),this._initWidgets(),children=this.childWidgets,this.options.onlyVisible&&(children=children.filter(":visible")),children.length&&($2.each(["first","last"],function(index,value){var instance=children[value]().data("ui-controlgroup-data");if(instance&&that["_"+instance.widgetName+"Options"]){var options=that["_"+instance.widgetName+"Options"](children.length===1?"only":value);options.classes=that._resolveClassesValues(options.classes,instance),instance.element[instance.widgetName](options)}else that._updateCornerClass(children[value](),value)}),this._callChildMethod("refresh"))},"refresh")});$2.widget("ui.checkboxradio",[$2.ui.formResetMixin,{version:"1.14.1",options:{disabled:null,label:null,icon:!0,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:__name(function(){var disabled,labels,labelContents,options=this._super()||{};return this._readType(),labels=this.element.labels(),this.label=$2(labels[labels.length-1]),this.label.length||$2.error("No label found for checkboxradio widget"),this.originalLabel="",labelContents=this.label.contents().not(this.element[0]),labelContents.length&&(this.originalLabel+=labelContents.clone().wrapAll("<div></div>").parent().html()),this.originalLabel&&(options.label=this.originalLabel),disabled=this.element[0].disabled,disabled!=null&&(options.disabled=disabled),options},"_getCreateOptions"),_create:__name(function(){var checked=this.element[0].checked;this._bindFormResetHandler(),this.options.disabled==null&&(this.options.disabled=this.element[0].disabled),this._setOption("disabled",this.options.disabled),this._addClass("ui-checkboxradio","ui-helper-hidden-accessible"),this._addClass(this.label,"ui-checkboxradio-label","ui-button ui-widget"),this.type==="radio"&&this._addClass(this.label,"ui-checkboxradio-radio-label"),this.options.label&&this.options.label!==this.originalLabel?this._updateLabel():this.originalLabel&&(this.options.label=this.originalLabel),this._enhance(),checked&&this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active"),this._on({change:"_toggleClasses",focus:__name(function(){this._addClass(this.label,null,"ui-state-focus ui-visual-focus")},"focus"),blur:__name(function(){this._removeClass(this.label,null,"ui-state-focus ui-visual-focus")},"blur")})},"_create"),_readType:__name(function(){var nodeName=this.element[0].nodeName.toLowerCase();this.type=this.element[0].type,(nodeName!=="input"||!/radio|checkbox/.test(this.type))&&$2.error("Can't create checkboxradio on element.nodeName="+nodeName+" and element.type="+this.type)},"_readType"),_enhance:__name(function(){this._updateIcon(this.element[0].checked)},"_enhance"),widget:__name(function(){return this.label},"widget"),_getRadioGroup:__name(function(){var group,name=this.element[0].name,nameSelector="input[name='"+CSS.escape(name)+"']";return name?(this.form.length?group=$2(this.form[0].elements).filter(nameSelector):group=$2(nameSelector).filter(function(){return $2($2(this).prop("form")).length===0}),group.not(this.element)):$2([])},"_getRadioGroup"),_toggleClasses:__name(function(){var checked=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",checked),this.options.icon&&this.type==="checkbox"&&this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",checked)._toggleClass(this.icon,null,"ui-icon-blank",!checked),this.type==="radio"&&this._getRadioGroup().each(function(){var instance=$2(this).checkboxradio("instance");instance&&instance._removeClass(instance.label,"ui-checkboxradio-checked","ui-state-active")})},"_toggleClasses"),_destroy:__name(function(){this._unbindFormResetHandler(),this.icon&&(this.icon.remove(),this.iconSpace.remove())},"_destroy"),_setOption:__name(function(key,value){if(!(key==="label"&&!value)){if(this._super(key,value),key==="disabled"){this._toggleClass(this.label,null,"ui-state-disabled",value),this.element[0].disabled=value;return}this.refresh()}},"_setOption"),_updateIcon:__name(function(checked){var toAdd="ui-icon ui-icon-background ";this.options.icon?(this.icon||(this.icon=$2("<span>"),this.iconSpace=$2("<span> </span>"),this._addClass(this.iconSpace,"ui-checkboxradio-icon-space")),this.type==="checkbox"?(toAdd+=checked?"ui-icon-check ui-state-checked":"ui-icon-blank",this._removeClass(this.icon,null,checked?"ui-icon-blank":"ui-icon-check")):toAdd+="ui-icon-blank",this._addClass(this.icon,"ui-checkboxradio-icon",toAdd),checked||this._removeClass(this.icon,null,"ui-icon-check ui-state-checked"),this.icon.prependTo(this.label).after(this.iconSpace)):this.icon!==void 0&&(this.icon.remove(),this.iconSpace.remove(),delete this.icon)},"_updateIcon"),_updateLabel:__name(function(){var contents=this.label.contents().not(this.element[0]);this.icon&&(contents=contents.not(this.icon[0])),this.iconSpace&&(contents=contents.not(this.iconSpace[0])),contents.remove(),this.label.append(this.options.label)},"_updateLabel"),refresh:__name(function(){var checked=this.element[0].checked,isDisabled=this.element[0].disabled;this._updateIcon(checked),this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",checked),this.options.label!==null&&this._updateLabel(),isDisabled!==this.options.disabled&&this._setOptions({disabled:isDisabled})},"refresh")}]),$2.ui.checkboxradio;$2.widget("ui.button",{version:"1.14.1",defaultElement:"<button>",options:{classes:{"ui-button":"ui-corner-all"},disabled:null,icon:null,iconPosition:"beginning",label:null,showLabel:!0},_getCreateOptions:__name(function(){var disabled,options=this._super()||{};return this.isInput=this.element.is("input"),disabled=this.element[0].disabled,disabled!=null&&(options.disabled=disabled),this.originalLabel=this.isInput?this.element.val():this.element.html(),this.originalLabel&&(options.label=this.originalLabel),options},"_getCreateOptions"),_create:__name(function(){!this.option.showLabel&!this.options.icon&&(this.options.showLabel=!0),this.options.disabled==null&&(this.options.disabled=this.element[0].disabled||!1),this.hasTitle=!!this.element.attr("title"),this.options.label&&this.options.label!==this.originalLabel&&(this.isInput?this.element.val(this.options.label):this.element.html(this.options.label)),this._addClass("ui-button","ui-widget"),this._setOption("disabled",this.options.disabled),this._enhance(),this.element.is("a")&&this._on({keyup:__name(function(event){event.keyCode===$2.ui.keyCode.SPACE&&(event.preventDefault(),this.element[0].click?this.element[0].click():this.element.trigger("click"))},"keyup")})},"_create"),_enhance:__name(function(){this.element.is("button")||this.element.attr("role","button"),this.options.icon&&(this._updateIcon("icon",this.options.icon),this._updateTooltip())},"_enhance"),_updateTooltip:__name(function(){this.title=this.element.attr("title"),!this.options.showLabel&&!this.title&&this.element.attr("title",this.options.label)},"_updateTooltip"),_updateIcon:__name(function(option,value){var icon=option!=="iconPosition",position=icon?this.options.iconPosition:value,displayBlock=position==="top"||position==="bottom";this.icon?icon&&this._removeClass(this.icon,null,this.options.icon):(this.icon=$2("<span>"),this._addClass(this.icon,"ui-button-icon","ui-icon"),this.options.showLabel||this._addClass("ui-button-icon-only")),icon&&this._addClass(this.icon,null,value),this._attachIcon(position),displayBlock?(this._addClass(this.icon,null,"ui-widget-icon-block"),this.iconSpace&&this.iconSpace.remove()):(this.iconSpace||(this.iconSpace=$2("<span> </span>"),this._addClass(this.iconSpace,"ui-button-icon-space")),this._removeClass(this.icon,null,"ui-wiget-icon-block"),this._attachIconSpace(position))},"_updateIcon"),_destroy:__name(function(){this.element.removeAttr("role"),this.icon&&this.icon.remove(),this.iconSpace&&this.iconSpace.remove(),this.hasTitle||this.element.removeAttr("title")},"_destroy"),_attachIconSpace:__name(function(iconPosition){this.icon[/^(?:end|bottom)/.test(iconPosition)?"before":"after"](this.iconSpace)},"_attachIconSpace"),_attachIcon:__name(function(iconPosition){this.element[/^(?:end|bottom)/.test(iconPosition)?"append":"prepend"](this.icon)},"_attachIcon"),_setOptions:__name(function(options){var newShowLabel=options.showLabel===void 0?this.options.showLabel:options.showLabel,newIcon=options.icon===void 0?this.options.icon:options.icon;!newShowLabel&&!newIcon&&(options.showLabel=!0),this._super(options)},"_setOptions"),_setOption:__name(function(key,value){key==="icon"&&(value?this._updateIcon(key,value):this.icon&&(this.icon.remove(),this.iconSpace&&this.iconSpace.remove())),key==="iconPosition"&&this._updateIcon(key,value),key==="showLabel"&&(this._toggleClass("ui-button-icon-only",null,!value),this._updateTooltip()),key==="label"&&(this.isInput?this.element.val(value):(this.element.html(value),this.icon&&(this._attachIcon(this.options.iconPosition),this._attachIconSpace(this.options.iconPosition)))),this._super(key,value),key==="disabled"&&(this._toggleClass(null,"ui-state-disabled",value),this.element[0].disabled=value,value&&this.element.trigger("blur"))},"_setOption"),refresh:__name(function(){var isDisabled=this.element.is("input, button")?this.element[0].disabled:this.element.hasClass("ui-button-disabled");isDisabled!==this.options.disabled&&this._setOptions({disabled:isDisabled}),this._updateTooltip()},"refresh")}),$2.uiBackCompat===!0&&($2.widget("ui.button",$2.ui.button,{options:{text:!0,icons:{primary:null,secondary:null}},_create:__name(function(){this.options.showLabel&&!this.options.text&&(this.options.showLabel=this.options.text),!this.options.showLabel&&this.options.text&&(this.options.text=this.options.showLabel),!this.options.icon&&(this.options.icons.primary||this.options.icons.secondary)?this.options.icons.primary?this.options.icon=this.options.icons.primary:(this.options.icon=this.options.icons.secondary,this.options.iconPosition="end"):this.options.icon&&(this.options.icons.primary=this.options.icon),this._super()},"_create"),_setOption:__name(function(key,value){if(key==="text"){this._super("showLabel",value);return}key==="showLabel"&&(this.options.text=value),key==="icon"&&(this.options.icons.primary=value),key==="icons"&&(value.primary?(this._super("icon",value.primary),this._super("iconPosition","beginning")):value.secondary&&(this._super("icon",value.secondary),this._super("iconPosition","end"))),this._superApply(arguments)},"_setOption")}),$2.fn.button=(function(orig){return function(options){var isMethodCall=typeof options=="string",args=Array.prototype.slice.call(arguments,1),returnValue=this;return isMethodCall?!this.length&&options==="instance"?returnValue=void 0:this.each(function(){var methodValue,type=$2(this).attr("type"),name=type!=="checkbox"&&type!=="radio"?"button":"checkboxradio",instance=$2.data(this,"ui-"+name);if(options==="instance")return returnValue=instance,!1;if(!instance)return $2.error("cannot call methods on button prior to initialization; attempted to call method '"+options+"'");if(typeof instance[options]!="function"||options.charAt(0)==="_")return $2.error("no such method '"+options+"' for button widget instance");if(methodValue=instance[options].apply(instance,args),methodValue!==instance&&methodValue!==void 0)return returnValue=methodValue&&methodValue.jquery?returnValue.pushStack(methodValue.get()):methodValue,!1}):(args.length&&(options=$2.widget.extend.apply(null,[options].concat(args))),this.each(function(){var type=$2(this).attr("type"),name=type!=="checkbox"&&type!=="radio"?"button":"checkboxradio",instance=$2.data(this,"ui-"+name);if(instance)instance.option(options||{}),instance._init&&instance._init();else{if(name==="button"){orig.call($2(this),options);return}$2(this).checkboxradio($2.extend({icon:!1},options))}})),returnValue}})($2.fn.button),$2.fn.buttonset=function(){return $2.ui.controlgroup||$2.error("Controlgroup widget missing"),arguments[0]==="option"&&arguments[1]==="items"&&arguments[2]?this.controlgroup.apply(this,[arguments[0],"items.button",arguments[2]]):arguments[0]==="option"&&arguments[1]==="items"?this.controlgroup.apply(this,[arguments[0],"items.button"]):(typeof arguments[0]=="object"&&arguments[0].items&&(arguments[0].items={button:arguments[0].items}),this.controlgroup.apply(this,arguments))}),$2.ui.button;$2.extend($2.ui,{datepicker:{version:"1.14.1"}});var datepicker_instActive;function datepicker_getZindex(elem){for(var position,value;elem.length&&elem[0]!==document;){if(position=elem.css("position"),(position==="absolute"||position==="relative"||position==="fixed")&&(value=parseInt(elem.css("zIndex"),10),!isNaN(value)&&value!==0))return value;elem=elem.parent()}return 0}__name(datepicker_getZindex,"datepicker_getZindex");function Datepicker(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:"",selectMonthLabel:"Select month",selectYearLabel:"Select year"},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,onUpdateDatepicker:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},$2.extend(this._defaults,this.regional[""]),this.regional.en=$2.extend(!0,{},this.regional[""]),this.regional["en-US"]=$2.extend(!0,{},this.regional.en),this.dpDiv=datepicker_bindHover($2("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}__name(Datepicker,"Datepicker"),$2.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:__name(function(){return this.dpDiv},"_widgetDatepicker"),setDefaults:__name(function(settings){return datepicker_extendRemove(this._defaults,settings||{}),this},"setDefaults"),_attachDatepicker:__name(function(target,settings){var nodeName,inline,inst;nodeName=target.nodeName.toLowerCase(),inline=nodeName==="div"||nodeName==="span",target.id||(this.uuid+=1,target.id="dp"+this.uuid),inst=this._newInst($2(target),inline),inst.settings=$2.extend({},settings||{}),nodeName==="input"?this._connectDatepicker(target,inst):inline&&this._inlineDatepicker(target,inst)},"_attachDatepicker"),_newInst:__name(function(target,inline){var id=target[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline,dpDiv:inline?datepicker_bindHover($2("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},"_newInst"),_connectDatepicker:__name(function(target,inst){var input=$2(target);inst.append=$2([]),inst.trigger=$2([]),!input.hasClass(this.markerClassName)&&(this._attachments(input,inst),input.addClass(this.markerClassName).on("keydown",this._doKeyDown).on("keypress",this._doKeyPress).on("keyup",this._doKeyUp),this._autoSize(inst),$2.data(target,"datepicker",inst),inst.settings.disabled&&this._disableDatepicker(target))},"_connectDatepicker"),_attachments:__name(function(input,inst){var showOn,buttonText,buttonImage,appendText=this._get(inst,"appendText"),isRTL=this._get(inst,"isRTL");inst.append&&inst.append.remove(),appendText&&(inst.append=$2("<span>").addClass(this._appendClass).text(appendText),input[isRTL?"before":"after"](inst.append)),input.off("focus",this._showDatepicker),inst.trigger&&inst.trigger.remove(),showOn=this._get(inst,"showOn"),(showOn==="focus"||showOn==="both")&&input.on("focus",this._showDatepicker),(showOn==="button"||showOn==="both")&&(buttonText=this._get(inst,"buttonText"),buttonImage=this._get(inst,"buttonImage"),this._get(inst,"buttonImageOnly")?inst.trigger=$2("<img>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):(inst.trigger=$2("<button type='button'>").addClass(this._triggerClass),buttonImage?inst.trigger.html($2("<img>").attr({src:buttonImage,alt:buttonText,title:buttonText})):inst.trigger.text(buttonText)),input[isRTL?"before":"after"](inst.trigger),inst.trigger.on("click",function(){return $2.datepicker._datepickerShowing&&$2.datepicker._lastInput===input[0]?$2.datepicker._hideDatepicker():($2.datepicker._datepickerShowing&&$2.datepicker._lastInput!==input[0]&&$2.datepicker._hideDatepicker(),$2.datepicker._showDatepicker(input[0])),!1}))},"_attachments"),_autoSize:__name(function(inst){if(this._get(inst,"autoSize")&&!inst.inline){var findMax,max,maxI,i,date=new Date(2009,11,20),dateFormat=this._get(inst,"dateFormat");dateFormat.match(/[DM]/)&&(findMax=__name(function(names){for(max=0,maxI=0,i=0;i<names.length;i++)names[i].length>max&&(max=names[i].length,maxI=i);return maxI},"findMax"),date.setMonth(findMax(this._get(inst,dateFormat.match(/MM/)?"monthNames":"monthNamesShort"))),date.setDate(findMax(this._get(inst,dateFormat.match(/DD/)?"dayNames":"dayNamesShort"))+20-date.getDay())),inst.input.attr("size",this._formatDate(inst,date).length)}},"_autoSize"),_inlineDatepicker:__name(function(target,inst){var divSpan=$2(target);divSpan.hasClass(this.markerClassName)||(divSpan.addClass(this.markerClassName).append(inst.dpDiv),$2.data(target,"datepicker",inst),this._setDate(inst,this._getDefaultDate(inst),!0),this._updateDatepicker(inst),this._updateAlternate(inst),inst.settings.disabled&&this._disableDatepicker(target),inst.dpDiv.css("display","block"))},"_inlineDatepicker"),_dialogDatepicker:__name(function(input,date,onSelect,settings,pos){var id,browserWidth,browserHeight,scrollX,scrollY,inst=this._dialogInst;return inst||(this.uuid+=1,id="dp"+this.uuid,this._dialogInput=$2("<input type='text' id='"+id+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.on("keydown",this._doKeyDown),$2("body").append(this._dialogInput),inst=this._dialogInst=this._newInst(this._dialogInput,!1),inst.settings={},$2.data(this._dialogInput[0],"datepicker",inst)),datepicker_extendRemove(inst.settings,settings||{}),date=date&&date.constructor===Date?this._formatDate(inst,date):date,this._dialogInput.val(date),this._pos=pos?pos.length?pos:[pos.pageX,pos.pageY]:null,this._pos||(browserWidth=document.documentElement.clientWidth,browserHeight=document.documentElement.clientHeight,scrollX=document.documentElement.scrollLeft||document.body.scrollLeft,scrollY=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[browserWidth/2-100+scrollX,browserHeight/2-150+scrollY]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),inst.settings.onSelect=onSelect,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),$2.blockUI&&$2.blockUI(this.dpDiv),$2.data(this._dialogInput[0],"datepicker",inst),this},"_dialogDatepicker"),_destroyDatepicker:__name(function(target){var nodeName,$target=$2(target),inst=$2.data(target,"datepicker");$target.hasClass(this.markerClassName)&&(nodeName=target.nodeName.toLowerCase(),$2.removeData(target,"datepicker"),nodeName==="input"?(inst.append.remove(),inst.trigger.remove(),$target.removeClass(this.markerClassName).off("focus",this._showDatepicker).off("keydown",this._doKeyDown).off("keypress",this._doKeyPress).off("keyup",this._doKeyUp)):(nodeName==="div"||nodeName==="span")&&$target.removeClass(this.markerClassName).empty(),$2.datepicker._hideDatepicker(),datepicker_instActive===inst&&(datepicker_instActive=null,this._curInst=null))},"_destroyDatepicker"),_enableDatepicker:__name(function(target){var nodeName,inline,$target=$2(target),inst=$2.data(target,"datepicker");$target.hasClass(this.markerClassName)&&(nodeName=target.nodeName.toLowerCase(),nodeName==="input"?(target.disabled=!1,inst.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):(nodeName==="div"||nodeName==="span")&&(inline=$target.children("."+this._inlineClass),inline.children().removeClass("ui-state-disabled"),inline.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=$2.map(this._disabledInputs,function(value){return value===target?null:value}))},"_enableDatepicker"),_disableDatepicker:__name(function(target){var nodeName,inline,$target=$2(target),inst=$2.data(target,"datepicker");$target.hasClass(this.markerClassName)&&(nodeName=target.nodeName.toLowerCase(),nodeName==="input"?(target.disabled=!0,inst.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):(nodeName==="div"||nodeName==="span")&&(inline=$target.children("."+this._inlineClass),inline.children().addClass("ui-state-disabled"),inline.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=$2.map(this._disabledInputs,function(value){return value===target?null:value}),this._disabledInputs[this._disabledInputs.length]=target)},"_disableDatepicker"),_isDisabledDatepicker:__name(function(target){if(!target)return!1;for(var i=0;i<this._disabledInputs.length;i++)if(this._disabledInputs[i]===target)return!0;return!1},"_isDisabledDatepicker"),_getInst:__name(function(target){try{return $2.data(target,"datepicker")}catch{throw"Missing instance data for this datepicker"}},"_getInst"),_optionDatepicker:__name(function(target,name,value){var settings,date,minDate,maxDate,inst=this._getInst(target);if(arguments.length===2&&typeof name=="string")return name==="defaults"?$2.extend({},$2.datepicker._defaults):inst?name==="all"?$2.extend({},inst.settings):this._get(inst,name):null;settings=name||{},typeof name=="string"&&(settings={},settings[name]=value),inst&&(this._curInst===inst&&this._hideDatepicker(),date=this._getDateDatepicker(target,!0),minDate=this._getMinMaxDate(inst,"min"),maxDate=this._getMinMaxDate(inst,"max"),datepicker_extendRemove(inst.settings,settings),minDate!==null&&settings.dateFormat!==void 0&&settings.minDate===void 0&&(inst.settings.minDate=this._formatDate(inst,minDate)),maxDate!==null&&settings.dateFormat!==void 0&&settings.maxDate===void 0&&(inst.settings.maxDate=this._formatDate(inst,maxDate)),"disabled"in settings&&(settings.disabled?this._disableDatepicker(target):this._enableDatepicker(target)),this._attachments($2(target),inst),this._autoSize(inst),this._setDate(inst,date),this._updateAlternate(inst),this._updateDatepicker(inst))},"_optionDatepicker"),_changeDatepicker:__name(function(target,name,value){this._optionDatepicker(target,name,value)},"_changeDatepicker"),_refreshDatepicker:__name(function(target){var inst=this._getInst(target);inst&&this._updateDatepicker(inst)},"_refreshDatepicker"),_setDateDatepicker:__name(function(target,date){var inst=this._getInst(target);inst&&(this._setDate(inst,date),this._updateDatepicker(inst),this._updateAlternate(inst))},"_setDateDatepicker"),_getDateDatepicker:__name(function(target,noDefault){var inst=this._getInst(target);return inst&&!inst.inline&&this._setDateFromField(inst,noDefault),inst?this._getDate(inst):null},"_getDateDatepicker"),_doKeyDown:__name(function(event){var onSelect,dateStr,sel,inst=$2.datepicker._getInst(event.target),handled=!0,isRTL=inst.dpDiv.is(".ui-datepicker-rtl");if(inst._keyEvent=!0,$2.datepicker._datepickerShowing)switch(event.keyCode){case 9:$2.datepicker._hideDatepicker(),handled=!1;break;case 13:return sel=$2("td."+$2.datepicker._dayOverClass+":not(."+$2.datepicker._currentClass+")",inst.dpDiv),sel[0]&&$2.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0]),onSelect=$2.datepicker._get(inst,"onSelect"),onSelect?(dateStr=$2.datepicker._formatDate(inst),onSelect.apply(inst.input?inst.input[0]:null,[dateStr,inst])):$2.datepicker._hideDatepicker(),!1;case 27:$2.datepicker._hideDatepicker();break;case 33:$2.datepicker._adjustDate(event.target,event.ctrlKey?-$2.datepicker._get(inst,"stepBigMonths"):-$2.datepicker._get(inst,"stepMonths"),"M");break;case 34:$2.datepicker._adjustDate(event.target,event.ctrlKey?+$2.datepicker._get(inst,"stepBigMonths"):+$2.datepicker._get(inst,"stepMonths"),"M");break;case 35:(event.ctrlKey||event.metaKey)&&$2.datepicker._clearDate(event.target),handled=event.ctrlKey||event.metaKey;break;case 36:(event.ctrlKey||event.metaKey)&&$2.datepicker._gotoToday(event.target),handled=event.ctrlKey||event.metaKey;break;case 37:(event.ctrlKey||event.metaKey)&&$2.datepicker._adjustDate(event.target,isRTL?1:-1,"D"),handled=event.ctrlKey||event.metaKey,event.originalEvent.altKey&&$2.datepicker._adjustDate(event.target,event.ctrlKey?-$2.datepicker._get(inst,"stepBigMonths"):-$2.datepicker._get(inst,"stepMonths"),"M");break;case 38:(event.ctrlKey||event.metaKey)&&$2.datepicker._adjustDate(event.target,-7,"D"),handled=event.ctrlKey||event.metaKey;break;case 39:(event.ctrlKey||event.metaKey)&&$2.datepicker._adjustDate(event.target,isRTL?-1:1,"D"),handled=event.ctrlKey||event.metaKey,event.originalEvent.altKey&&$2.datepicker._adjustDate(event.target,event.ctrlKey?+$2.datepicker._get(inst,"stepBigMonths"):+$2.datepicker._get(inst,"stepMonths"),"M");break;case 40:(event.ctrlKey||event.metaKey)&&$2.datepicker._adjustDate(event.target,7,"D"),handled=event.ctrlKey||event.metaKey;break;default:handled=!1}else event.keyCode===36&&event.ctrlKey?$2.datepicker._showDatepicker(this):handled=!1;handled&&(event.preventDefault(),event.stopPropagation())},"_doKeyDown"),_doKeyPress:__name(function(event){var chars,chr,inst=$2.datepicker._getInst(event.target);if($2.datepicker._get(inst,"constrainInput"))return chars=$2.datepicker._possibleChars($2.datepicker._get(inst,"dateFormat")),chr=String.fromCharCode(event.charCode==null?event.keyCode:event.charCode),event.ctrlKey||event.metaKey||chr<" "||!chars||chars.indexOf(chr)>-1},"_doKeyPress"),_doKeyUp:__name(function(event){var date,inst=$2.datepicker._getInst(event.target);if(inst.input.val()!==inst.lastVal)try{date=$2.datepicker.parseDate($2.datepicker._get(inst,"dateFormat"),inst.input?inst.input.val():null,$2.datepicker._getFormatConfig(inst)),date&&($2.datepicker._setDateFromField(inst),$2.datepicker._updateAlternate(inst),$2.datepicker._updateDatepicker(inst))}catch{}return!0},"_doKeyUp"),_showDatepicker:__name(function(input){if(input=input.target||input,input.nodeName.toLowerCase()!=="input"&&(input=$2("input",input.parentNode)[0]),!($2.datepicker._isDisabledDatepicker(input)||$2.datepicker._lastInput===input)){var inst,beforeShow,beforeShowSettings,isFixed,offset,showAnim,duration;inst=$2.datepicker._getInst(input),$2.datepicker._curInst&&$2.datepicker._curInst!==inst&&($2.datepicker._curInst.dpDiv.stop(!0,!0),inst&&$2.datepicker._datepickerShowing&&$2.datepicker._hideDatepicker($2.datepicker._curInst.input[0])),beforeShow=$2.datepicker._get(inst,"beforeShow"),beforeShowSettings=beforeShow?beforeShow.apply(input,[input,inst]):{},beforeShowSettings!==!1&&(datepicker_extendRemove(inst.settings,beforeShowSettings),inst.lastVal=null,$2.datepicker._lastInput=input,$2.datepicker._setDateFromField(inst),$2.datepicker._inDialog&&(input.value=""),$2.datepicker._pos||($2.datepicker._pos=$2.datepicker._findPos(input),$2.datepicker._pos[1]+=input.offsetHeight),isFixed=!1,$2(input).parents().each(function(){return isFixed|=$2(this).css("position")==="fixed",!isFixed}),offset={left:$2.datepicker._pos[0],top:$2.datepicker._pos[1]},$2.datepicker._pos=null,inst.dpDiv.empty(),inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),$2.datepicker._updateDatepicker(inst),offset=$2.datepicker._checkOffset(inst,offset,isFixed),inst.dpDiv.css({position:$2.datepicker._inDialog&&$2.blockUI?"static":isFixed?"fixed":"absolute",display:"none",left:offset.left+"px",top:offset.top+"px"}),inst.inline||(showAnim=$2.datepicker._get(inst,"showAnim"),duration=$2.datepicker._get(inst,"duration"),inst.dpDiv.css("z-index",datepicker_getZindex($2(input))+1),$2.datepicker._datepickerShowing=!0,$2.effects&&$2.effects.effect[showAnim]?inst.dpDiv.show(showAnim,$2.datepicker._get(inst,"showOptions"),duration):inst.dpDiv[showAnim||"show"](showAnim?duration:null),$2.datepicker._shouldFocusInput(inst)&&inst.input.trigger("focus"),$2.datepicker._curInst=inst))}},"_showDatepicker"),_updateDatepicker:__name(function(inst){this.maxRows=4,datepicker_instActive=inst,inst.dpDiv.empty().append(this._generateHTML(inst)),this._attachHandlers(inst);var origyearshtml,numMonths=this._getNumberOfMonths(inst),cols=numMonths[1],width=17,activeCell=inst.dpDiv.find("."+this._dayOverClass+" a"),onUpdateDatepicker=$2.datepicker._get(inst,"onUpdateDatepicker");activeCell.length>0&&datepicker_handleMouseover.apply(activeCell.get(0)),inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),cols>1&&inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",width*cols+"em"),inst.dpDiv[(numMonths[0]!==1||numMonths[1]!==1?"add":"remove")+"Class"]("ui-datepicker-multi"),inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),inst===$2.datepicker._curInst&&$2.datepicker._datepickerShowing&&$2.datepicker._shouldFocusInput(inst)&&inst.input.trigger("focus"),inst.yearshtml&&(origyearshtml=inst.yearshtml,setTimeout(function(){origyearshtml===inst.yearshtml&&inst.yearshtml&&inst.dpDiv.find("select.ui-datepicker-year").first().replaceWith(inst.yearshtml),origyearshtml=inst.yearshtml=null},0)),onUpdateDatepicker&&onUpdateDatepicker.apply(inst.input?inst.input[0]:null,[inst])},"_updateDatepicker"),_shouldFocusInput:__name(function(inst){return inst.input&&inst.input.is(":visible")&&!inst.input.is(":disabled")},"_shouldFocusInput"),_checkOffset:__name(function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth(),dpHeight=inst.dpDiv.outerHeight(),inputWidth=inst.input?inst.input.outerWidth():0,inputHeight=inst.input?inst.input.outerHeight():0,viewWidth=document.documentElement.clientWidth+(isFixed?0:$2(document).scrollLeft()),viewHeight=document.documentElement.clientHeight+(isFixed?0:$2(document).scrollTop());return offset.left-=this._get(inst,"isRTL")?dpWidth-inputWidth:0,offset.left-=isFixed&&offset.left===inst.input.offset().left?$2(document).scrollLeft():0,offset.top-=isFixed&&offset.top===inst.input.offset().top+inputHeight?$2(document).scrollTop():0,offset.left-=Math.min(offset.left,offset.left+dpWidth>viewWidth&&viewWidth>dpWidth?Math.abs(offset.left+dpWidth-viewWidth):0),offset.top-=Math.min(offset.top,offset.top+dpHeight>viewHeight&&viewHeight>dpHeight?Math.abs(dpHeight+inputHeight):0),offset},"_checkOffset"),_findPos:__name(function(obj){for(var position,inst=this._getInst(obj),isRTL=this._get(inst,"isRTL");obj&&(obj.type==="hidden"||obj.nodeType!==1||$2.expr.pseudos.hidden(obj));)obj=obj[isRTL?"previousSibling":"nextSibling"];return position=$2(obj).offset(),[position.left,position.top]},"_findPos"),_hideDatepicker:__name(function(input){var showAnim,duration,postProcess,onClose,inst=this._curInst;!inst||input&&inst!==$2.data(input,"datepicker")||this._datepickerShowing&&(showAnim=this._get(inst,"showAnim"),duration=this._get(inst,"duration"),postProcess=__name(function(){$2.datepicker._tidyDialog(inst)},"postProcess"),$2.effects&&$2.effects.effect[showAnim]?inst.dpDiv.hide(showAnim,$2.datepicker._get(inst,"showOptions"),duration,postProcess):inst.dpDiv[showAnim==="slideDown"?"slideUp":showAnim==="fadeIn"?"fadeOut":"hide"](showAnim?duration:null,postProcess),showAnim||postProcess(),this._datepickerShowing=!1,onClose=this._get(inst,"onClose"),onClose&&onClose.apply(inst.input?inst.input[0]:null,[inst.input?inst.input.val():"",inst]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),$2.blockUI&&($2.unblockUI(),$2("body").append(this.dpDiv))),this._inDialog=!1)},"_hideDatepicker"),_tidyDialog:__name(function(inst){inst.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar")},"_tidyDialog"),_checkExternalClick:__name(function(event){if($2.datepicker._curInst){var $target=$2(event.target),inst=$2.datepicker._getInst($target[0]);($target[0].id!==$2.datepicker._mainDivId&&$target.parents("#"+$2.datepicker._mainDivId).length===0&&!$target.hasClass($2.datepicker.markerClassName)&&!$target.closest("."+$2.datepicker._triggerClass).length&&$2.datepicker._datepickerShowing&&!($2.datepicker._inDialog&&$2.blockUI)||$target.hasClass($2.datepicker.markerClassName)&&$2.datepicker._curInst!==inst)&&$2.datepicker._hideDatepicker()}},"_checkExternalClick"),_adjustDate:__name(function(id,offset,period){var target=$2(id),inst=this._getInst(target[0]);this._isDisabledDatepicker(target[0])||(this._adjustInstDate(inst,offset,period),this._updateDatepicker(inst))},"_adjustDate"),_gotoToday:__name(function(id){var date,target=$2(id),inst=this._getInst(target[0]);this._get(inst,"gotoCurrent")&&inst.currentDay?(inst.selectedDay=inst.currentDay,inst.drawMonth=inst.selectedMonth=inst.currentMonth,inst.drawYear=inst.selectedYear=inst.currentYear):(date=new Date,inst.selectedDay=date.getDate(),inst.drawMonth=inst.selectedMonth=date.getMonth(),inst.drawYear=inst.selectedYear=date.getFullYear()),this._notifyChange(inst),this._adjustDate(target)},"_gotoToday"),_selectMonthYear:__name(function(id,select,period){var target=$2(id),inst=this._getInst(target[0]);inst["selected"+(period==="M"?"Month":"Year")]=inst["draw"+(period==="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10),this._notifyChange(inst),this._adjustDate(target)},"_selectMonthYear"),_selectDay:__name(function(id,month,year,td){var inst,target=$2(id);$2(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])||(inst=this._getInst(target[0]),inst.selectedDay=inst.currentDay=parseInt($2("a",td).attr("data-date")),inst.selectedMonth=inst.currentMonth=month,inst.selectedYear=inst.currentYear=year,this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear)))},"_selectDay"),_clearDate:__name(function(id){var target=$2(id);this._selectDate(target,"")},"_clearDate"),_selectDate:__name(function(id,dateStr){var onSelect,target=$2(id),inst=this._getInst(target[0]);dateStr=dateStr??this._formatDate(inst),inst.input&&inst.input.val(dateStr),this._updateAlternate(inst),onSelect=this._get(inst,"onSelect"),onSelect?onSelect.apply(inst.input?inst.input[0]:null,[dateStr,inst]):inst.input&&inst.input.trigger("change"),inst.inline?this._updateDatepicker(inst):(this._hideDatepicker(),this._lastInput=inst.input[0],typeof inst.input[0]!="object"&&inst.input.trigger("focus"),this._lastInput=null)},"_selectDate"),_updateAlternate:__name(function(inst){var altFormat,date,dateStr,altField=this._get(inst,"altField");altField&&(altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat"),date=this._getDate(inst),dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst)),$2(document).find(altField).val(dateStr))},"_updateAlternate"),noWeekends:__name(function(date){var day=date.getDay();return[day>0&&day<6,""]},"noWeekends"),iso8601Week:__name(function(date){var time,checkDate=new Date(date.getTime());return checkDate.setDate(checkDate.getDate()+4-(checkDate.getDay()||7)),time=checkDate.getTime(),checkDate.setMonth(0),checkDate.setDate(1),Math.floor(Math.round((time-checkDate)/864e5)/7)+1},"iso8601Week"),parseDate:__name(function(format,value,settings){if(format==null||value==null)throw"Invalid arguments";if(value=typeof value=="object"?value.toString():value+"",value==="")return null;var iFormat,dim,extra,iValue=0,shortYearCutoffTemp=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff,shortYearCutoff=typeof shortYearCutoffTemp!="string"?shortYearCutoffTemp:new Date().getFullYear()%100+parseInt(shortYearCutoffTemp,10),dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort,dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames,monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort,monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames,year=-1,month=-1,day=-1,doy=-1,literal=!1,date,lookAhead=__name(function(match){var matches=iFormat+1<format.length&&format.charAt(iFormat+1)===match;return matches&&iFormat++,matches},"lookAhead"),getNumber=__name(function(match){var isDoubled=lookAhead(match),size=match==="@"?14:match==="!"?20:match==="y"&&isDoubled?4:match==="o"?3:2,minSize=match==="y"?size:1,digits=new RegExp("^\\d{"+minSize+","+size+"}"),num=value.substring(iValue).match(digits);if(!num)throw"Missing number at position "+iValue;return iValue+=num[0].length,parseInt(num[0],10)},"getNumber"),getName=__name(function(match,shortNames,longNames){var index=-1,names=$2.map(lookAhead(match)?longNames:shortNames,function(v,k){return[[k,v]]}).sort(function(a,b){return-(a[1].length-b[1].length)});if($2.each(names,function(i,pair){var name=pair[1];if(value.substr(iValue,name.length).toLowerCase()===name.toLowerCase())return index=pair[0],iValue+=name.length,!1}),index!==-1)return index+1;throw"Unknown name at position "+iValue},"getName"),checkLiteral=__name(function(){if(value.charAt(iValue)!==format.charAt(iFormat))throw"Unexpected literal at position "+iValue;iValue++},"checkLiteral");for(iFormat=0;iFormat<format.length;iFormat++)if(literal)format.charAt(iFormat)==="'"&&!lookAhead("'")?literal=!1:checkLiteral();else switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":date=new Date(getNumber("@")),year=date.getFullYear(),month=date.getMonth()+1,day=date.getDate();break;case"!":date=new Date((getNumber("!")-this._ticksTo1970)/1e4),year=date.getFullYear(),month=date.getMonth()+1,day=date.getDate();break;case"'":lookAhead("'")?checkLiteral():literal=!0;break;default:checkLiteral()}if(iValue<value.length&&(extra=value.substr(iValue),!/^\s+/.test(extra)))throw"Extra/unparsed characters found in date: "+extra;if(year===-1?year=new Date().getFullYear():year<100&&(year+=new Date().getFullYear()-new Date().getFullYear()%100+(year<=shortYearCutoff?0:-100)),doy>-1){month=1,day=doy;do{if(dim=this._getDaysInMonth(year,month-1),day<=dim)break;month++,day-=dim}while(!0)}if(date=this._daylightSavingAdjust(new Date(year,month-1,day)),date.getFullYear()!==year||date.getMonth()+1!==month||date.getDate()!==day)throw"Invalid date";return date},"parseDate"),ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(1969*365+Math.floor(1970/4)-Math.floor(1970/100)+Math.floor(1970/400))*24*60*60*1e7,formatDate:__name(function(format,date,settings){if(!date)return"";var iFormat,dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort,dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames,monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort,monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames,lookAhead=__name(function(match){var matches=iFormat+1<format.length&&format.charAt(iFormat+1)===match;return matches&&iFormat++,matches},"lookAhead"),formatNumber=__name(function(match,value,len){var num=""+value;if(lookAhead(match))for(;num.length<len;)num="0"+num;return num},"formatNumber"),formatName=__name(function(match,value,shortNames,longNames){return lookAhead(match)?longNames[value]:shortNames[value]},"formatName"),output="",literal=!1;if(date)for(iFormat=0;iFormat<format.length;iFormat++)if(literal)format.charAt(iFormat)==="'"&&!lookAhead("'")?literal=!1:output+=format.charAt(iFormat);else switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":output+=formatNumber("o",Math.round((new Date(date.getFullYear(),date.getMonth(),date.getDate()).getTime()-new Date(date.getFullYear(),0,0).getTime())/864e5),3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=lookAhead("y")?date.getFullYear():(date.getFullYear()%100<10?"0":"")+date.getFullYear()%100;break;case"@":output+=date.getTime();break;case"!":output+=date.getTime()*1e4+this._ticksTo1970;break;case"'":lookAhead("'")?output+="'":literal=!0;break;default:output+=format.charAt(iFormat)}return output},"formatDate"),_possibleChars:__name(function(format){var iFormat,chars="",literal=!1,lookAhead=__name(function(match){var matches=iFormat+1<format.length&&format.charAt(iFormat+1)===match;return matches&&iFormat++,matches},"lookAhead");for(iFormat=0;iFormat<format.length;iFormat++)if(literal)format.charAt(iFormat)==="'"&&!lookAhead("'")?literal=!1:chars+=format.charAt(iFormat);else switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":lookAhead("'")?chars+="'":literal=!0;break;default:chars+=format.charAt(iFormat)}return chars},"_possibleChars"),_get:__name(function(inst,name){return inst.settings[name]!==void 0?inst.settings[name]:this._defaults[name]},"_get"),_setDateFromField:__name(function(inst,noDefault){if(inst.input.val()!==inst.lastVal){var dateFormat=this._get(inst,"dateFormat"),dates=inst.lastVal=inst.input?inst.input.val():null,defaultDate=this._getDefaultDate(inst),date=defaultDate,settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate}catch{dates=noDefault?"":dates}inst.selectedDay=date.getDate(),inst.drawMonth=inst.selectedMonth=date.getMonth(),inst.drawYear=inst.selectedYear=date.getFullYear(),inst.currentDay=dates?date.getDate():0,inst.currentMonth=dates?date.getMonth():0,inst.currentYear=dates?date.getFullYear():0,this._adjustInstDate(inst)}},"_setDateFromField"),_getDefaultDate:__name(function(inst){return this._restrictMinMax(inst,this._determineDate(inst,this._get(inst,"defaultDate"),new Date))},"_getDefaultDate"),_determineDate:__name(function(inst,date,defaultDate){var offsetNumeric=__name(function(offset){var date2=new Date;return date2.setDate(date2.getDate()+offset),date2},"offsetNumeric"),offsetString=__name(function(offset){try{return $2.datepicker.parseDate($2.datepicker._get(inst,"dateFormat"),offset,$2.datepicker._getFormatConfig(inst))}catch{}for(var date2=(offset.toLowerCase().match(/^c/)?$2.datepicker._getDate(inst):null)||new Date,year=date2.getFullYear(),month=date2.getMonth(),day=date2.getDate(),pattern=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,matches=pattern.exec(offset);matches;){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10),day=Math.min(day,$2.datepicker._getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10),day=Math.min(day,$2.datepicker._getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)},"offsetString"),newDate=date==null||date===""?defaultDate:typeof date=="string"?offsetString(date):typeof date=="number"?isNaN(date)?defaultDate:offsetNumeric(date):new Date(date.getTime());return newDate=newDate&&newDate.toString()==="Invalid Date"?defaultDate:newDate,newDate&&(newDate.setHours(0),newDate.setMinutes(0),newDate.setSeconds(0),newDate.setMilliseconds(0)),this._daylightSavingAdjust(newDate)},"_determineDate"),_daylightSavingAdjust:__name(function(date){return date?(date.setHours(date.getHours()>12?date.getHours()+2:0),date):null},"_daylightSavingAdjust"),_setDate:__name(function(inst,date,noChange){var clear=!date,origMonth=inst.selectedMonth,origYear=inst.selectedYear,newDate=this._restrictMinMax(inst,this._determineDate(inst,date,new Date));inst.selectedDay=inst.currentDay=newDate.getDate(),inst.drawMonth=inst.selectedMonth=inst.currentMonth=newDate.getMonth(),inst.drawYear=inst.selectedYear=inst.currentYear=newDate.getFullYear(),(origMonth!==inst.selectedMonth||origYear!==inst.selectedYear)&&!noChange&&this._notifyChange(inst),this._adjustInstDate(inst),inst.input&&inst.input.val(clear?"":this._formatDate(inst))},"_setDate"),_getDate:__name(function(inst){var startDate=!inst.currentYear||inst.input&&inst.input.val()===""?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));return startDate},"_getDate"),_attachHandlers:__name(function(inst){var stepMonths=this._get(inst,"stepMonths"),id="#"+inst.id.replace(/\\\\/g,"\\");inst.dpDiv.find("[data-handler]").map(function(){var handler={prev:__name(function(){$2.datepicker._adjustDate(id,-stepMonths,"M")},"prev"),next:__name(function(){$2.datepicker._adjustDate(id,+stepMonths,"M")},"next"),hide:__name(function(){$2.datepicker._hideDatepicker()},"hide"),today:__name(function(){$2.datepicker._gotoToday(id)},"today"),selectDay:__name(function(){return $2.datepicker._selectDay(id,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},"selectDay"),selectMonth:__name(function(){return $2.datepicker._selectMonthYear(id,this,"M"),!1},"selectMonth"),selectYear:__name(function(){return $2.datepicker._selectMonthYear(id,this,"Y"),!1},"selectYear")};$2(this).on(this.getAttribute("data-event"),handler[this.getAttribute("data-handler")])})},"_attachHandlers"),_generateHTML:__name(function(inst){var maxDraw,prevText,prev,nextText,next,currentText,gotoDate,controls,buttonPanel,firstDay,showWeek,dayNames,dayNamesMin,monthNames,monthNamesShort,beforeShowDay,showOtherMonths,selectOtherMonths,defaultDate,html2,dow,row,group,col,selectedDate,cornerClass,calender,thead,day,daysInMonth,leadDays,curRows,numRows,printDate,dRow,tbody,daySettings,otherMonth,unselectable,tempDate=new Date,today=this._daylightSavingAdjust(new Date(tempDate.getFullYear(),tempDate.getMonth(),tempDate.getDate())),isRTL=this._get(inst,"isRTL"),showButtonPanel=this._get(inst,"showButtonPanel"),hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext"),navigationAsDateFormat=this._get(inst,"navigationAsDateFormat"),numMonths=this._getNumberOfMonths(inst),showCurrentAtPos=this._get(inst,"showCurrentAtPos"),stepMonths=this._get(inst,"stepMonths"),isMultiMonth=numMonths[0]!==1||numMonths[1]!==1,currentDate=this._daylightSavingAdjust(inst.currentDay?new Date(inst.currentYear,inst.currentMonth,inst.currentDay):new Date(9999,9,9)),minDate=this._getMinMaxDate(inst,"min"),maxDate=this._getMinMaxDate(inst,"max"),drawMonth=inst.drawMonth-showCurrentAtPos,drawYear=inst.drawYear;if(drawMonth<0&&(drawMonth+=12,drawYear--),maxDate)for(maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[0]*numMonths[1]+1,maxDate.getDate())),maxDraw=minDate&&maxDraw<minDate?minDate:maxDraw;this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw;)drawMonth--,drawMonth<0&&(drawMonth=11,drawYear--);for(inst.drawMonth=drawMonth,inst.drawYear=drawYear,prevText=this._get(inst,"prevText"),prevText=navigationAsDateFormat?this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)):prevText,this._canAdjustMonth(inst,-1,drawYear,drawMonth)?prev=$2("<a>").attr({class:"ui-datepicker-prev ui-corner-all","data-handler":"prev","data-event":"click",title:prevText}).append($2("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(isRTL?"e":"w")).text(prevText))[0].outerHTML:hideIfNoPrevNext?prev="":prev=$2("<a>").attr({class:"ui-datepicker-prev ui-corner-all ui-state-disabled",title:prevText}).append($2("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(isRTL?"e":"w")).text(prevText))[0].outerHTML,nextText=this._get(inst,"nextText"),nextText=navigationAsDateFormat?this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)):nextText,this._canAdjustMonth(inst,1,drawYear,drawMonth)?next=$2("<a>").attr({class:"ui-datepicker-next ui-corner-all","data-handler":"next","data-event":"click",title:nextText}).append($2("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(isRTL?"w":"e")).text(nextText))[0].outerHTML:hideIfNoPrevNext?next="":next=$2("<a>").attr({class:"ui-datepicker-next ui-corner-all ui-state-disabled",title:nextText}).append($2("<span>").attr("class","ui-icon ui-icon-circle-triangle-"+(isRTL?"w":"e")).text(nextText))[0].outerHTML,currentText=this._get(inst,"currentText"),gotoDate=this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today,currentText=navigationAsDateFormat?this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)):currentText,controls="",inst.inline||(controls=$2("<button>").attr({type:"button",class:"ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all","data-handler":"hide","data-event":"click"}).text(this._get(inst,"closeText"))[0].outerHTML),buttonPanel="",showButtonPanel&&(buttonPanel=$2("<div class='ui-datepicker-buttonpane ui-widget-content'>").append(isRTL?controls:"").append(this._isInRange(inst,gotoDate)?$2("<button>").attr({type:"button",class:"ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all","data-handler":"today","data-event":"click"}).text(currentText):"").append(isRTL?"":controls)[0].outerHTML),firstDay=parseInt(this._get(inst,"firstDay"),10),firstDay=isNaN(firstDay)?0:firstDay,showWeek=this._get(inst,"showWeek"),dayNames=this._get(inst,"dayNames"),dayNamesMin=this._get(inst,"dayNamesMin"),monthNames=this._get(inst,"monthNames"),monthNamesShort=this._get(inst,"monthNamesShort"),beforeShowDay=this._get(inst,"beforeShowDay"),showOtherMonths=this._get(inst,"showOtherMonths"),selectOtherMonths=this._get(inst,"selectOtherMonths"),defaultDate=this._getDefaultDate(inst),html2="",row=0;row<numMonths[0];row++){for(group="",this.maxRows=4,col=0;col<numMonths[1];col++){if(selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay)),cornerClass=" ui-corner-all",calender="",isMultiMonth){if(calender+="<div class='ui-datepicker-group",numMonths[1]>1)switch(col){case 0:calender+=" ui-datepicker-group-first",cornerClass=" ui-corner-"+(isRTL?"right":"left");break;case numMonths[1]-1:calender+=" ui-datepicker-group-last",cornerClass=" ui-corner-"+(isRTL?"left":"right");break;default:calender+=" ui-datepicker-group-middle",cornerClass="";break}calender+="'>"}for(calender+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+cornerClass+"'>"+(/all|left/.test(cornerClass)&&row===0?isRTL?next:prev:"")+(/all|right/.test(cornerClass)&&row===0?isRTL?prev:next:"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,row>0||col>0,monthNames,monthNamesShort)+"</div><table class='ui-datepicker-calendar'><thead><tr>",thead=showWeek?"<th class='ui-datepicker-week-col'>"+this._get(inst,"weekHeader")+"</th>":"",dow=0;dow<7;dow++)day=(dow+firstDay)%7,thead+="<th scope='col'"+((dow+firstDay+6)%7>=5?" class='ui-datepicker-week-end'":"")+"><span title='"+dayNames[day]+"'>"+dayNamesMin[day]+"</span></th>";for(calender+=thead+"</tr></thead><tbody>",daysInMonth=this._getDaysInMonth(drawYear,drawMonth),drawYear===inst.selectedYear&&drawMonth===inst.selectedMonth&&(inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)),leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7,curRows=Math.ceil((leadDays+daysInMonth)/7),numRows=isMultiMonth&&this.maxRows>curRows?this.maxRows:curRows,this.maxRows=numRows,printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays)),dRow=0;dRow<numRows;dRow++){for(calender+="<tr>",tbody=showWeek?"<td class='ui-datepicker-week-col'>"+this._get(inst,"calculateWeek")(printDate)+"</td>":"",dow=0;dow<7;dow++)daySettings=beforeShowDay?beforeShowDay.apply(inst.input?inst.input[0]:null,[printDate]):[!0,""],otherMonth=printDate.getMonth()!==drawMonth,unselectable=otherMonth&&!selectOtherMonths||!daySettings[0]||minDate&&printDate<minDate||maxDate&&printDate>maxDate,tbody+="<td class='"+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end":"")+(otherMonth?" ui-datepicker-other-month":"")+(printDate.getTime()===selectedDate.getTime()&&drawMonth===inst.selectedMonth&&inst._keyEvent||defaultDate.getTime()===printDate.getTime()&&defaultDate.getTime()===selectedDate.getTime()?" "+this._dayOverClass:"")+(unselectable?" "+this._unselectableClass+" ui-state-disabled":"")+(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(printDate.getTime()===currentDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()===today.getTime()?" ui-datepicker-today":""))+"'"+((!otherMonth||showOtherMonths)&&daySettings[2]?" title='"+daySettings[2].replace(/'/g,"&#39;")+"'":"")+(unselectable?"":" data-handler='selectDay' data-event='click' data-month='"+printDate.getMonth()+"' data-year='"+printDate.getFullYear()+"'")+">"+(otherMonth&&!showOtherMonths?"&#xa0;":unselectable?"<span class='ui-state-default'>"+printDate.getDate()+"</span>":"<a class='ui-state-default"+(printDate.getTime()===today.getTime()?" ui-state-highlight":"")+(printDate.getTime()===currentDate.getTime()?" ui-state-active":"")+(otherMonth?" ui-priority-secondary":"")+"' href='#' aria-current='"+(printDate.getTime()===currentDate.getTime()?"true":"false")+"' data-date='"+printDate.getDate()+"'>"+printDate.getDate()+"</a>")+"</td>",printDate.setDate(printDate.getDate()+1),printDate=this._daylightSavingAdjust(printDate);calender+=tbody+"</tr>"}drawMonth++,drawMonth>11&&(drawMonth=0,drawYear++),calender+="</tbody></table>"+(isMultiMonth?"</div>"+(numMonths[0]>0&&col===numMonths[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),group+=calender}html2+=group}return html2+=buttonPanel,inst._keyEvent=!1,html2},"_generateHTML"),_generateMonthYearHeader:__name(function(inst,drawMonth,drawYear,minDate,maxDate,secondary,monthNames,monthNamesShort){var inMinYear,inMaxYear,month,years,thisYear,determineYear,year,endYear,changeMonth=this._get(inst,"changeMonth"),changeYear=this._get(inst,"changeYear"),showMonthAfterYear=this._get(inst,"showMonthAfterYear"),selectMonthLabel=this._get(inst,"selectMonthLabel"),selectYearLabel=this._get(inst,"selectYearLabel"),html2="<div class='ui-datepicker-title'>",monthHtml="";if(secondary||!changeMonth)monthHtml+="<span class='ui-datepicker-month'>"+monthNames[drawMonth]+"</span>";else{for(inMinYear=minDate&&minDate.getFullYear()===drawYear,inMaxYear=maxDate&&maxDate.getFullYear()===drawYear,monthHtml+="<select class='ui-datepicker-month' aria-label='"+selectMonthLabel+"' data-handler='selectMonth' data-event='change'>",month=0;month<12;month++)(!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())&&(monthHtml+="<option value='"+month+"'"+(month===drawMonth?" selected='selected'":"")+">"+monthNamesShort[month]+"</option>");monthHtml+="</select>"}if(showMonthAfterYear||(html2+=monthHtml+(secondary||!(changeMonth&&changeYear)?"&#xa0;":"")),!inst.yearshtml)if(inst.yearshtml="",secondary||!changeYear)html2+="<span class='ui-datepicker-year'>"+drawYear+"</span>";else{for(years=this._get(inst,"yearRange").split(":"),thisYear=new Date().getFullYear(),determineYear=__name(function(value){var year2=value.match(/c[+\-].*/)?drawYear+parseInt(value.substring(1),10):value.match(/[+\-].*/)?thisYear+parseInt(value,10):parseInt(value,10);return isNaN(year2)?thisYear:year2},"determineYear"),year=determineYear(years[0]),endYear=Math.max(year,determineYear(years[1]||"")),year=minDate?Math.max(year,minDate.getFullYear()):year,endYear=maxDate?Math.min(endYear,maxDate.getFullYear()):endYear,inst.yearshtml+="<select class='ui-datepicker-year' aria-label='"+selectYearLabel+"' data-handler='selectYear' data-event='change'>";year<=endYear;year++)inst.yearshtml+="<option value='"+year+"'"+(year===drawYear?" selected='selected'":"")+">"+year+"</option>";inst.yearshtml+="</select>",html2+=inst.yearshtml,inst.yearshtml=null}return html2+=this._get(inst,"yearSuffix"),showMonthAfterYear&&(html2+=(secondary||!(changeMonth&&changeYear)?"&#xa0;":"")+monthHtml),html2+="</div>",html2},"_generateMonthYearHeader"),_adjustInstDate:__name(function(inst,offset,period){var year=inst.selectedYear+(period==="Y"?offset:0),month=inst.selectedMonth+(period==="M"?offset:0),day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period==="D"?offset:0),date=this._restrictMinMax(inst,this._daylightSavingAdjust(new Date(year,month,day)));inst.selectedDay=date.getDate(),inst.drawMonth=inst.selectedMonth=date.getMonth(),inst.drawYear=inst.selectedYear=date.getFullYear(),(period==="M"||period==="Y")&&this._notifyChange(inst)},"_adjustInstDate"),_restrictMinMax:__name(function(inst,date){var minDate=this._getMinMaxDate(inst,"min"),maxDate=this._getMinMaxDate(inst,"max"),newDate=minDate&&date<minDate?minDate:date;return maxDate&&newDate>maxDate?maxDate:newDate},"_restrictMinMax"),_notifyChange:__name(function(inst){var onChange=this._get(inst,"onChangeMonthYear");onChange&&onChange.apply(inst.input?inst.input[0]:null,[inst.selectedYear,inst.selectedMonth+1,inst])},"_notifyChange"),_getNumberOfMonths:__name(function(inst){var numMonths=this._get(inst,"numberOfMonths");return numMonths==null?[1,1]:typeof numMonths=="number"?[1,numMonths]:numMonths},"_getNumberOfMonths"),_getMinMaxDate:__name(function(inst,minMax){return this._determineDate(inst,this._get(inst,minMax+"Date"),null)},"_getMinMaxDate"),_getDaysInMonth:__name(function(year,month){return 32-this._daylightSavingAdjust(new Date(year,month,32)).getDate()},"_getDaysInMonth"),_getFirstDayOfMonth:__name(function(year,month){return new Date(year,month,1).getDay()},"_getFirstDayOfMonth"),_canAdjustMonth:__name(function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst),date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[0]*numMonths[1]),1));return offset<0&&date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth())),this._isInRange(inst,date)},"_canAdjustMonth"),_isInRange:__name(function(inst,date){var yearSplit,currentYear,minDate=this._getMinMaxDate(inst,"min"),maxDate=this._getMinMaxDate(inst,"max"),minYear=null,maxYear=null,years=this._get(inst,"yearRange");return years&&(yearSplit=years.split(":"),currentYear=new Date().getFullYear(),minYear=parseInt(yearSplit[0],10),maxYear=parseInt(yearSplit[1],10),yearSplit[0].match(/[+\-].*/)&&(minYear+=currentYear),yearSplit[1].match(/[+\-].*/)&&(maxYear+=currentYear)),(!minDate||date.getTime()>=minDate.getTime())&&(!maxDate||date.getTime()<=maxDate.getTime())&&(!minYear||date.getFullYear()>=minYear)&&(!maxYear||date.getFullYear()<=maxYear)},"_isInRange"),_getFormatConfig:__name(function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");return shortYearCutoff=typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10),{shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},"_getFormatConfig"),_formatDate:__name(function(inst,day,month,year){day||(inst.currentDay=inst.selectedDay,inst.currentMonth=inst.selectedMonth,inst.currentYear=inst.selectedYear);var date=day?typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day)):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))},"_formatDate")});function datepicker_bindHover(dpDiv){var selector="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return dpDiv.on("mouseout",selector,function(){$2(this).removeClass("ui-state-hover"),this.className.indexOf("ui-datepicker-prev")!==-1&&$2(this).removeClass("ui-datepicker-prev-hover"),this.className.indexOf("ui-datepicker-next")!==-1&&$2(this).removeClass("ui-datepicker-next-hover")}).on("mouseover",selector,datepicker_handleMouseover)}__name(datepicker_bindHover,"datepicker_bindHover");function datepicker_handleMouseover(){$2.datepicker._isDisabledDatepicker(datepicker_instActive.inline?datepicker_instActive.dpDiv.parent()[0]:datepicker_instActive.input[0])||($2(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),$2(this).addClass("ui-state-hover"),this.className.indexOf("ui-datepicker-prev")!==-1&&$2(this).addClass("ui-datepicker-prev-hover"),this.className.indexOf("ui-datepicker-next")!==-1&&$2(this).addClass("ui-datepicker-next-hover"))}__name(datepicker_handleMouseover,"datepicker_handleMouseover");function datepicker_extendRemove(target,props){$2.extend(target,props);for(var name in props)props[name]==null&&(target[name]=props[name]);return target}__name(datepicker_extendRemove,"datepicker_extendRemove"),$2.fn.datepicker=function(options){if(!this.length)return this;$2.datepicker.initialized||($2(document).on("mousedown",$2.datepicker._checkExternalClick),$2.datepicker.initialized=!0),$2("#"+$2.datepicker._mainDivId).length===0&&$2("body").append($2.datepicker.dpDiv);var otherArgs=Array.prototype.slice.call(arguments,1);return typeof options=="string"&&(options==="isDisabled"||options==="getDate"||options==="widget")?$2.datepicker["_"+options+"Datepicker"].apply($2.datepicker,[this[0]].concat(otherArgs)):options==="option"&&arguments.length===2&&typeof arguments[1]=="string"?$2.datepicker["_"+options+"Datepicker"].apply($2.datepicker,[this[0]].concat(otherArgs)):this.each(function(){typeof options=="string"?$2.datepicker["_"+options+"Datepicker"].apply($2.datepicker,[this].concat(otherArgs)):$2.datepicker._attachDatepicker(this,options)})},$2.datepicker=new Datepicker,$2.datepicker.initialized=!1,$2.datepicker.uuid=new Date().getTime(),$2.datepicker.version="1.14.1",$2.datepicker;var mouseHandled=!1;$2(document).on("mouseup",function(){mouseHandled=!1}),$2.widget("ui.mouse",{version:"1.14.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:__name(function(){var that=this;this.element.on("mousedown."+this.widgetName,function(event){return that._mouseDown(event)}).on("click."+this.widgetName,function(event){if($2.data(event.target,that.widgetName+".preventClickEvent")===!0)return $2.removeData(event.target,that.widgetName+".preventClickEvent"),event.stopImmediatePropagation(),!1}),this.started=!1},"_mouseInit"),_mouseDestroy:__name(function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},"_mouseDestroy"),_mouseDown:__name(function(event){if(!mouseHandled){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(event),this._mouseDownEvent=event;var that=this,btnIsLeft=event.which===1,elIsCancel=typeof this.options.cancel=="string"?$2(event.target).closest(this.options.cancel).length:!1;return!btnIsLeft||elIsCancel||!this._mouseCapture(event)?!0:(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){that.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(event)&&this._mouseDelayMet(event)&&(this._mouseStarted=this._mouseStart(event)!==!1,!this._mouseStarted)?(event.preventDefault(),!0):($2.data(event.target,this.widgetName+".preventClickEvent")===!0&&$2.removeData(event.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(event2){return that._mouseMove(event2)},this._mouseUpDelegate=function(event2){return that._mouseUp(event2)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),event.preventDefault(),mouseHandled=!0,!0))}},"_mouseDown"),_mouseMove:__name(function(event){if(this._mouseMoved&&!event.which){if(event.originalEvent.altKey||event.originalEvent.ctrlKey||event.originalEvent.metaKey||event.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(event)}return(event.which||event.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(event),event.preventDefault()):(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,event)!==!1,this._mouseStarted?this._mouseDrag(event):this._mouseUp(event)),!this._mouseStarted)},"_mouseMove"),_mouseUp:__name(function(event){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,event.target===this._mouseDownEvent.target&&$2.data(event.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(event)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,mouseHandled=!1,event.preventDefault()},"_mouseUp"),_mouseDistanceMet:__name(function(event){return Math.max(Math.abs(this._mouseDownEvent.pageX-event.pageX),Math.abs(this._mouseDownEvent.pageY-event.pageY))>=this.options.distance},"_mouseDistanceMet"),_mouseDelayMet:__name(function(){return this.mouseDelayMet},"_mouseDelayMet"),_mouseStart:__name(function(){},"_mouseStart"),_mouseDrag:__name(function(){},"_mouseDrag"),_mouseStop:__name(function(){},"_mouseStop"),_mouseCapture:__name(function(){return!0},"_mouseCapture")}),$2.ui.plugin={add:__name(function(module2,option,set){var i,proto=$2.ui[module2].prototype;for(i in set)proto.plugins[i]=proto.plugins[i]||[],proto.plugins[i].push([option,set[i]])},"add"),call:__name(function(instance,name,args,allowDisconnected){var i,set=instance.plugins[name];if(set&&!(!allowDisconnected&&(!instance.element[0].parentNode||instance.element[0].parentNode.nodeType===11)))for(i=0;i<set.length;i++)instance.options[set[i][0]]&&set[i][1].apply(instance.element,args)},"call")};$2.widget("ui.draggable",$2.ui.mouse,{version:"1.14.1",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:__name(function(){this.options.helper==="original"&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},"_create"),_setOption:__name(function(key,value){this._super(key,value),key==="handle"&&(this._removeHandleClassName(),this._setHandleClassName())},"_setOption"),_destroy:__name(function(){if((this.helper||this.element).is(".ui-draggable-dragging")){this.destroyOnClear=!0;return}this._removeHandleClassName(),this._mouseDestroy()},"_destroy"),_mouseCapture:__name(function(event){var o=this.options;return this.helper||o.disabled||$2(event.target).closest(".ui-resizable-handle").length>0||(this.handle=this._getHandle(event),!this.handle)?!1:(this._blurActiveElement(event),this._blockFrames(o.iframeFix===!0?"iframe":o.iframeFix),!0)},"_mouseCapture"),_blockFrames:__name(function(selector){this.iframeBlocks=this.document.find(selector).map(function(){var iframe=$2(this);return $2("<div>").css("position","absolute").appendTo(iframe.parent()).outerWidth(iframe.outerWidth()).outerHeight(iframe.outerHeight()).offset(iframe.offset())[0]})},"_blockFrames"),_unblockFrames:__name(function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},"_unblockFrames"),_blurActiveElement:__name(function(event){var activeElement=this.document[0].activeElement,target=$2(event.target);target.closest(activeElement).length||$2(activeElement).trigger("blur")},"_blurActiveElement"),_mouseStart:__name(function(event){var o=this.options;return this.helper=this._createHelper(event),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),$2.ui.ddmanager&&($2.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return $2(this).css("position")==="fixed"}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(event),this.originalPosition=this.position=this._generatePosition(event,!1),this.originalPageX=event.pageX,this.originalPageY=event.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this._setContainment(),this._trigger("start",event)===!1?(this._clear(),!1):(this._cacheHelperProportions(),$2.ui.ddmanager&&!o.dropBehaviour&&$2.ui.ddmanager.prepareOffsets(this,event),this._mouseDrag(event,!0),$2.ui.ddmanager&&$2.ui.ddmanager.dragStart(this,event),!0)},"_mouseStart"),_refreshOffsets:__name(function(event){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:event.pageX-this.offset.left,top:event.pageY-this.offset.top}},"_refreshOffsets"),_mouseDrag:__name(function(event,noPropagation){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(event,!0),this.positionAbs=this._convertPositionTo("absolute"),!noPropagation){var ui=this._uiHash();if(this._trigger("drag",event,ui)===!1)return this._mouseUp(new $2.Event("mouseup",event)),!1;this.position=ui.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",$2.ui.ddmanager&&$2.ui.ddmanager.drag(this,event),!1},"_mouseDrag"),_mouseStop:__name(function(event){var that=this,dropped=!1;return $2.ui.ddmanager&&!this.options.dropBehaviour&&(dropped=$2.ui.ddmanager.drop(this,event)),this.dropped&&(dropped=this.dropped,this.dropped=!1),this.options.revert==="invalid"&&!dropped||this.options.revert==="valid"&&dropped||this.options.revert===!0||typeof this.options.revert=="function"&&this.options.revert.call(this.element,dropped)?$2(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){that._trigger("stop",event)!==!1&&that._clear()}):this._trigger("stop",event)!==!1&&this._clear(),!1},"_mouseStop"),_mouseUp:__name(function(event){return this._unblockFrames(),$2.ui.ddmanager&&$2.ui.ddmanager.dragStop(this,event),this.handleElement.is(event.target)&&this.element.trigger("focus"),$2.ui.mouse.prototype._mouseUp.call(this,event)},"_mouseUp"),cancel:__name(function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new $2.Event("mouseup",{target:this.element[0]})):this._clear(),this},"cancel"),_getHandle:__name(function(event){return this.options.handle?!!$2(event.target).closest(this.element.find(this.options.handle)).length:!0},"_getHandle"),_setHandleClassName:__name(function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},"_setHandleClassName"),_removeHandleClassName:__name(function(){this._removeClass(this.handleElement,"ui-draggable-handle")},"_removeHandleClassName"),_createHelper:__name(function(event){var o=this.options,helperIsFunction=typeof o.helper=="function",helper=helperIsFunction?$2(o.helper.apply(this.element[0],[event])):o.helper==="clone"?this.element.clone().removeAttr("id"):this.element;return helper.parents("body").length||helper.appendTo(o.appendTo==="parent"?this.element[0].parentNode:o.appendTo),helperIsFunction&&helper[0]===this.element[0]&&this._setPositionRelative(),helper[0]!==this.element[0]&&!/(fixed|absolute)/.test(helper.css("position"))&&helper.css("position","absolute"),helper},"_createHelper"),_setPositionRelative:__name(function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},"_setPositionRelative"),_adjustOffsetFromHelper:__name(function(obj){typeof obj=="string"&&(obj=obj.split(" ")),Array.isArray(obj)&&(obj={left:+obj[0],top:+obj[1]||0}),"left"in obj&&(this.offset.click.left=obj.left+this.margins.left),"right"in obj&&(this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left),"top"in obj&&(this.offset.click.top=obj.top+this.margins.top),"bottom"in obj&&(this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top)},"_adjustOffsetFromHelper"),_isRootNode:__name(function(element){return/(html|body)/i.test(element.tagName)||element===this.document[0]},"_isRootNode"),_getParentOffset:__name(function(){var po=this.offsetParent.offset(),document2=this.document[0];return this.cssPosition==="absolute"&&this.scrollParent[0]!==document2&&$2.contains(this.scrollParent[0],this.offsetParent[0])&&(po.left+=this.scrollParent.scrollLeft(),po.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(po={top:0,left:0}),{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},"_getParentOffset"),_getRelativeOffset:__name(function(){if(this.cssPosition!=="relative")return{top:0,left:0};var p=this.element.position(),scrollIsRootNode=this._isRootNode(this.scrollParent[0]);return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+(scrollIsRootNode?0:this.scrollParent.scrollTop()),left:p.left-(parseInt(this.helper.css("left"),10)||0)+(scrollIsRootNode?0:this.scrollParent.scrollLeft())}},"_getRelativeOffset"),_cacheMargins:__name(function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},"_cacheMargins"),_cacheHelperProportions:__name(function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},"_cacheHelperProportions"),_setContainment:__name(function(){var isUserScrollable,c,ce,o=this.options,document2=this.document[0];if(this.relativeContainer=null,!o.containment){this.containment=null;return}if(o.containment==="window"){this.containment=[$2(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,$2(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,$2(window).scrollLeft()+$2(window).width()-this.helperProportions.width-this.margins.left,$2(window).scrollTop()+($2(window).height()||document2.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];return}if(o.containment==="document"){this.containment=[0,0,$2(document2).width()-this.helperProportions.width-this.margins.left,($2(document2).height()||document2.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];return}if(o.containment.constructor===Array){this.containment=o.containment;return}o.containment==="parent"&&(o.containment=this.helper[0].parentNode),c=$2(o.containment),ce=c[0],ce&&(isUserScrollable=/(scroll|auto)/.test(c.css("overflow")),this.containment=[(parseInt(c.css("borderLeftWidth"),10)||0)+(parseInt(c.css("paddingLeft"),10)||0),(parseInt(c.css("borderTopWidth"),10)||0)+(parseInt(c.css("paddingTop"),10)||0),(isUserScrollable?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt(c.css("borderRightWidth"),10)||0)-(parseInt(c.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(isUserScrollable?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt(c.css("borderBottomWidth"),10)||0)-(parseInt(c.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=c)},"_setContainment"),_convertPositionTo:__name(function(d,pos){pos||(pos=this.position);var mod=d==="absolute"?1:-1,scrollIsRootNode=this._isRootNode(this.scrollParent[0]);return{top:pos.top+this.offset.relative.top*mod+this.offset.parent.top*mod-(this.cssPosition==="fixed"?-this.offset.scroll.top:scrollIsRootNode?0:this.offset.scroll.top)*mod,left:pos.left+this.offset.relative.left*mod+this.offset.parent.left*mod-(this.cssPosition==="fixed"?-this.offset.scroll.left:scrollIsRootNode?0:this.offset.scroll.left)*mod}},"_convertPositionTo"),_generatePosition:__name(function(event,constrainPosition){var containment,co,top,left,o=this.options,scrollIsRootNode=this._isRootNode(this.scrollParent[0]),pageX=event.pageX,pageY=event.pageY;return(!scrollIsRootNode||!this.offset.scroll)&&(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),constrainPosition&&(this.containment&&(this.relativeContainer?(co=this.relativeContainer.offset(),containment=[this.containment[0]+co.left,this.containment[1]+co.top,this.containment[2]+co.left,this.containment[3]+co.top]):containment=this.containment,event.pageX-this.offset.click.left<containment[0]&&(pageX=containment[0]+this.offset.click.left),event.pageY-this.offset.click.top<containment[1]&&(pageY=containment[1]+this.offset.click.top),event.pageX-this.offset.click.left>containment[2]&&(pageX=containment[2]+this.offset.click.left),event.pageY-this.offset.click.top>containment[3]&&(pageY=containment[3]+this.offset.click.top)),o.grid&&(top=o.grid[1]?this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,pageY=containment?top-this.offset.click.top>=containment[1]||top-this.offset.click.top>containment[3]?top:top-this.offset.click.top>=containment[1]?top-o.grid[1]:top+o.grid[1]:top,left=o.grid[0]?this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,pageX=containment?left-this.offset.click.left>=containment[0]||left-this.offset.click.left>containment[2]?left:left-this.offset.click.left>=containment[0]?left-o.grid[0]:left+o.grid[0]:left),o.axis==="y"&&(pageX=this.originalPageX),o.axis==="x"&&(pageY=this.originalPageY)),{top:pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition==="fixed"?-this.offset.scroll.top:scrollIsRootNode?0:this.offset.scroll.top),left:pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition==="fixed"?-this.offset.scroll.left:scrollIsRootNode?0:this.offset.scroll.left)}},"_generatePosition"),_clear:__name(function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]!==this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},"_clear"),_trigger:__name(function(type,event,ui){return ui=ui||this._uiHash(),$2.ui.plugin.call(this,type,[event,ui,this],!0),/^(drag|start|stop)/.test(type)&&(this.positionAbs=this._convertPositionTo("absolute"),ui.offset=this.positionAbs),$2.Widget.prototype._trigger.call(this,type,event,ui)},"_trigger"),plugins:{},_uiHash:__name(function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}},"_uiHash")}),$2.ui.plugin.add("draggable","connectToSortable",{start:__name(function(event,ui,draggable2){var uiSortable=$2.extend({},ui,{item:draggable2.element});draggable2.sortables=[],$2(draggable2.options.connectToSortable).each(function(){var sortable2=$2(this).sortable("instance");sortable2&&!sortable2.options.disabled&&(draggable2.sortables.push(sortable2),sortable2.refreshPositions(),sortable2._trigger("activate",event,uiSortable))})},"start"),stop:__name(function(event,ui,draggable2){var uiSortable=$2.extend({},ui,{item:draggable2.element});draggable2.cancelHelperRemoval=!1,$2.each(draggable2.sortables,function(){var sortable2=this;sortable2.isOver?(sortable2.isOver=0,draggable2.cancelHelperRemoval=!0,sortable2.cancelHelperRemoval=!1,sortable2._storedCSS={position:sortable2.placeholder.css("position"),top:sortable2.placeholder.css("top"),left:sortable2.placeholder.css("left")},sortable2._mouseStop(event),sortable2.options.helper=sortable2.options._helper):(sortable2.cancelHelperRemoval=!0,sortable2._trigger("deactivate",event,uiSortable))})},"stop"),drag:__name(function(event,ui,draggable2){$2.each(draggable2.sortables,function(){var innermostIntersecting=!1,sortable2=this;sortable2.positionAbs=draggable2.positionAbs,sortable2.helperProportions=draggable2.helperProportions,sortable2.offset.click=draggable2.offset.click,sortable2._intersectsWith(sortable2.containerCache)&&(innermostIntersecting=!0,$2.each(draggable2.sortables,function(){return this.positionAbs=draggable2.positionAbs,this.helperProportions=draggable2.helperProportions,this.offset.click=draggable2.offset.click,this!==sortable2&&this._intersectsWith(this.containerCache)&&$2.contains(sortable2.element[0],this.element[0])&&(innermostIntersecting=!1),innermostIntersecting})),innermostIntersecting?(sortable2.isOver||(sortable2.isOver=1,draggable2._parent=ui.helper.parent(),sortable2.currentItem=ui.helper.appendTo(sortable2.element).data("ui-sortable-item",!0),sortable2.options._helper=sortable2.options.helper,sortable2.options.helper=function(){return ui.helper[0]},event.target=sortable2.currentItem[0],sortable2._mouseCapture(event,!0),sortable2._mouseStart(event,!0,!0),sortable2.offset.click.top=draggable2.offset.click.top,sortable2.offset.click.left=draggable2.offset.click.left,sortable2.offset.parent.left-=draggable2.offset.parent.left-sortable2.offset.parent.left,sortable2.offset.parent.top-=draggable2.offset.parent.top-sortable2.offset.parent.top,draggable2._trigger("toSortable",event),draggable2.dropped=sortable2.element,$2.each(draggable2.sortables,function(){this.refreshPositions()}),draggable2.currentItem=draggable2.element,sortable2.fromOutside=draggable2),sortable2.currentItem&&(sortable2._mouseDrag(event),ui.position=sortable2.position)):sortable2.isOver&&(sortable2.isOver=0,sortable2.cancelHelperRemoval=!0,sortable2.options._revert=sortable2.options.revert,sortable2.options.revert=!1,sortable2._trigger("out",event,sortable2._uiHash(sortable2)),sortable2._mouseStop(event,!0),sortable2.options.revert=sortable2.options._revert,sortable2.options.helper=sortable2.options._helper,sortable2.placeholder&&sortable2.placeholder.remove(),ui.helper.appendTo(draggable2._parent),draggable2._refreshOffsets(event),ui.position=draggable2._generatePosition(event,!0),draggable2._trigger("fromSortable",event),draggable2.dropped=!1,$2.each(draggable2.sortables,function(){this.refreshPositions()}))})},"drag")}),$2.ui.plugin.add("draggable","cursor",{start:__name(function(event,ui,instance){var t=$2("body"),o=instance.options;t.css("cursor")&&(o._cursor=t.css("cursor")),t.css("cursor",o.cursor)},"start"),stop:__name(function(event,ui,instance){var o=instance.options;o._cursor&&$2("body").css("cursor",o._cursor)},"stop")}),$2.ui.plugin.add("draggable","opacity",{start:__name(function(event,ui,instance){var t=$2(ui.helper),o=instance.options;t.css("opacity")&&(o._opacity=t.css("opacity")),t.css("opacity",o.opacity)},"start"),stop:__name(function(event,ui,instance){var o=instance.options;o._opacity&&$2(ui.helper).css("opacity",o._opacity)},"stop")}),$2.ui.plugin.add("draggable","scroll",{start:__name(function(event,ui,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&i.scrollParentNotHidden[0].tagName!=="HTML"&&(i.overflowOffset=i.scrollParentNotHidden.offset())},"start"),drag:__name(function(event,ui,i){var o=i.options,scrolled=!1,scrollParent=i.scrollParentNotHidden[0],document2=i.document[0];scrollParent!==document2&&scrollParent.tagName!=="HTML"?((!o.axis||o.axis!=="x")&&(i.overflowOffset.top+scrollParent.offsetHeight-event.pageY<o.scrollSensitivity?scrollParent.scrollTop=scrolled=scrollParent.scrollTop+o.scrollSpeed:event.pageY-i.overflowOffset.top<o.scrollSensitivity&&(scrollParent.scrollTop=scrolled=scrollParent.scrollTop-o.scrollSpeed)),(!o.axis||o.axis!=="y")&&(i.overflowOffset.left+scrollParent.offsetWidth-event.pageX<o.scrollSensitivity?scrollParent.scrollLeft=scrolled=scrollParent.scrollLeft+o.scrollSpeed:event.pageX-i.overflowOffset.left<o.scrollSensitivity&&(scrollParent.scrollLeft=scrolled=scrollParent.scrollLeft-o.scrollSpeed))):((!o.axis||o.axis!=="x")&&(event.pageY-$2(document2).scrollTop()<o.scrollSensitivity?scrolled=$2(document2).scrollTop($2(document2).scrollTop()-o.scrollSpeed):$2(window).height()-(event.pageY-$2(document2).scrollTop())<o.scrollSensitivity&&(scrolled=$2(document2).scrollTop($2(document2).scrollTop()+o.scrollSpeed))),(!o.axis||o.axis!=="y")&&(event.pageX-$2(document2).scrollLeft()<o.scrollSensitivity?scrolled=$2(document2).scrollLeft($2(document2).scrollLeft()-o.scrollSpeed):$2(window).width()-(event.pageX-$2(document2).scrollLeft())<o.scrollSensitivity&&(scrolled=$2(document2).scrollLeft($2(document2).scrollLeft()+o.scrollSpeed)))),scrolled!==!1&&$2.ui.ddmanager&&!o.dropBehaviour&&$2.ui.ddmanager.prepareOffsets(i,event)},"drag")}),$2.ui.plugin.add("draggable","snap",{start:__name(function(event,ui,i){var o=i.options;i.snapElements=[],$2(o.snap.constructor!==String?o.snap.items||":data(ui-draggable)":o.snap).each(function(){var $t=$2(this),$o=$t.offset();this!==i.element[0]&&i.snapElements.push({item:this,width:$t.outerWidth(),height:$t.outerHeight(),top:$o.top,left:$o.left})})},"start"),drag:__name(function(event,ui,inst){var ts,bs,ls,rs,l,r,t,b,i,first,o=inst.options,d=o.snapTolerance,x1=ui.offset.left,x2=x1+inst.helperProportions.width,y1=ui.offset.top,y2=y1+inst.helperProportions.height;for(i=inst.snapElements.length-1;i>=0;i--){if(l=inst.snapElements[i].left-inst.margins.left,r=l+inst.snapElements[i].width,t=inst.snapElements[i].top-inst.margins.top,b=t+inst.snapElements[i].height,x2<l-d||x1>r+d||y2<t-d||y1>b+d||!$2.contains(inst.snapElements[i].item.ownerDocument,inst.snapElements[i].item)){inst.snapElements[i].snapping&&inst.options.snap.release&&inst.options.snap.release.call(inst.element,event,$2.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item})),inst.snapElements[i].snapping=!1;continue}o.snapMode!=="inner"&&(ts=Math.abs(t-y2)<=d,bs=Math.abs(b-y1)<=d,ls=Math.abs(l-x2)<=d,rs=Math.abs(r-x1)<=d,ts&&(ui.position.top=inst._convertPositionTo("relative",{top:t-inst.helperProportions.height,left:0}).top),bs&&(ui.position.top=inst._convertPositionTo("relative",{top:b,left:0}).top),ls&&(ui.position.left=inst._convertPositionTo("relative",{top:0,left:l-inst.helperProportions.width}).left),rs&&(ui.position.left=inst._convertPositionTo("relative",{top:0,left:r}).left)),first=ts||bs||ls||rs,o.snapMode!=="outer"&&(ts=Math.abs(t-y1)<=d,bs=Math.abs(b-y2)<=d,ls=Math.abs(l-x1)<=d,rs=Math.abs(r-x2)<=d,ts&&(ui.position.top=inst._convertPositionTo("relative",{top:t,left:0}).top),bs&&(ui.position.top=inst._convertPositionTo("relative",{top:b-inst.helperProportions.height,left:0}).top),ls&&(ui.position.left=inst._convertPositionTo("relative",{top:0,left:l}).left),rs&&(ui.position.left=inst._convertPositionTo("relative",{top:0,left:r-inst.helperProportions.width}).left)),!inst.snapElements[i].snapping&&(ts||bs||ls||rs||first)&&inst.options.snap.snap&&inst.options.snap.snap.call(inst.element,event,$2.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item})),inst.snapElements[i].snapping=ts||bs||ls||rs||first}},"drag")}),$2.ui.plugin.add("draggable","stack",{start:__name(function(event,ui,instance){var min,o=instance.options,group=$2.makeArray($2(o.stack)).sort(function(a,b){return(parseInt($2(a).css("zIndex"),10)||0)-(parseInt($2(b).css("zIndex"),10)||0)});group.length&&(min=parseInt($2(group[0]).css("zIndex"),10)||0,$2(group).each(function(i){$2(this).css("zIndex",min+i)}),this.css("zIndex",min+group.length))},"start")}),$2.ui.plugin.add("draggable","zIndex",{start:__name(function(event,ui,instance){var t=$2(ui.helper),o=instance.options;t.css("zIndex")&&(o._zIndex=t.css("zIndex")),t.css("zIndex",o.zIndex)},"start"),stop:__name(function(event,ui,instance){var o=instance.options;o._zIndex&&$2(ui.helper).css("zIndex",o._zIndex)},"stop")}),$2.ui.draggable;$2.widget("ui.resizable",$2.ui.mouse,{version:"1.14.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:__name(function(value){return parseFloat(value)||0},"_num"),_isNumber:__name(function(value){return!isNaN(parseFloat(value))},"_isNumber"),_hasScroll:__name(function(el,a){var scroll,has=!1,overflow=$2(el).css("overflow");if(overflow==="hidden")return!1;if(overflow==="scroll"||(scroll=a&&a==="left"?"scrollLeft":"scrollTop",el[scroll]>0))return!0;try{el[scroll]=1,has=el[scroll]>0,el[scroll]=0}catch{}return has},"_hasScroll"),_create:__name(function(){var margins,o=this.options,that=this;this._addClass("ui-resizable"),$2.extend(this,{_aspectRatio:!!o.aspectRatio,aspectRatio:o.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:o.helper||o.ghost||o.animate?o.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap($2("<div class='ui-wrapper'></div>").css({overflow:"hidden",position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,margins={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(margins),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this._proportionallyResize()),this._setupHandles(),o.autoHide&&$2(this.element).on("mouseenter",function(){o.disabled||(that._removeClass("ui-resizable-autohide"),that._handles.show())}).on("mouseleave",function(){o.disabled||that.resizing||(that._addClass("ui-resizable-autohide"),that._handles.hide())}),this._mouseInit()},"_create"),_destroy:__name(function(){this._mouseDestroy(),this._addedHandles.remove();var wrapper,_destroy=__name(function(exp){$2(exp).removeData("resizable").removeData("ui-resizable").off(".resizable")},"_destroy");return this.elementIsWrapper&&(_destroy(this.element),wrapper=this.element,this.originalElement.css({position:wrapper.css("position"),width:wrapper.outerWidth(),height:wrapper.outerHeight(),top:wrapper.css("top"),left:wrapper.css("left")}).insertAfter(wrapper),wrapper.remove()),this.originalElement.css("resize",this.originalResizeStyle),_destroy(this.originalElement),this},"_destroy"),_setOption:__name(function(key,value){switch(this._super(key,value),key){case"handles":this._removeHandles(),this._setupHandles();break;case"aspectRatio":this._aspectRatio=!!value;break}},"_setOption"),_setupHandles:__name(function(){var o=this.options,handle,i,n,hname,axis,that=this;if(this.handles=o.handles||($2(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=$2(),this._addedHandles=$2(),this.handles.constructor===String)for(this.handles==="all"&&(this.handles="n,e,s,w,se,sw,ne,nw"),n=this.handles.split(","),this.handles={},i=0;i<n.length;i++)handle=String.prototype.trim.call(n[i]),hname="ui-resizable-"+handle,axis=$2("<div>"),this._addClass(axis,"ui-resizable-handle "+hname),axis.css({zIndex:o.zIndex}),this.handles[handle]=".ui-resizable-"+handle,this.element.children(this.handles[handle]).length||(this.element.append(axis),this._addedHandles=this._addedHandles.add(axis));this._renderAxis=function(target){var i2,axis2,padPos,padWrapper;target=target||this.element;for(i2 in this.handles)this.handles[i2].constructor===String?this.handles[i2]=this.element.children(this.handles[i2]).first().show():(this.handles[i2].jquery||this.handles[i2].nodeType)&&(this.handles[i2]=$2(this.handles[i2]),this._on(this.handles[i2],{mousedown:that._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(axis2=$2(this.handles[i2],this.element),padWrapper=/sw|ne|nw|se|n|s/.test(i2)?axis2.outerHeight():axis2.outerWidth(),padPos=["padding",/ne|nw|n/.test(i2)?"Top":/se|sw|s/.test(i2)?"Bottom":/^e$/.test(i2)?"Right":"Left"].join(""),target.css(padPos,padWrapper),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i2])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){that.resizing||(this.className&&(axis=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),that.axis=axis&&axis[1]?axis[1]:"se")}),o.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},"_setupHandles"),_removeHandles:__name(function(){this._addedHandles.remove()},"_removeHandles"),_mouseCapture:__name(function(event){var i,handle,capture=!1;for(i in this.handles)handle=$2(this.handles[i])[0],(handle===event.target||$2.contains(handle,event.target))&&(capture=!0);return!this.options.disabled&&capture},"_mouseCapture"),_mouseStart:__name(function(event){var curleft,curtop,cursor,calculatedSize,o=this.options,el=this.element;return this.resizing=!0,this._renderProxy(),curleft=this._num(this.helper.css("left")),curtop=this._num(this.helper.css("top")),o.containment&&(curleft+=$2(o.containment).scrollLeft()||0,curtop+=$2(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:curleft,top:curtop},this._helper||(calculatedSize=this._calculateAdjustedElementDimensions(el)),this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:calculatedSize.width,height:calculatedSize.height},this.originalSize=this._helper?{width:el.outerWidth(),height:el.outerHeight()}:{width:calculatedSize.width,height:calculatedSize.height},this.sizeDiff={width:el.outerWidth()-el.width(),height:el.outerHeight()-el.height()},this.originalPosition={left:curleft,top:curtop},this.originalMousePosition={left:event.pageX,top:event.pageY},this.aspectRatio=typeof o.aspectRatio=="number"?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,cursor=$2(".ui-resizable-"+this.axis).css("cursor"),$2("body").css("cursor",cursor==="auto"?this.axis+"-resize":cursor),this._addClass("ui-resizable-resizing"),this._propagate("start",event),!0},"_mouseStart"),_mouseDrag:__name(function(event){var data,props,smp=this.originalMousePosition,a=this.axis,dx=event.pageX-smp.left||0,dy=event.pageY-smp.top||0,trigger=this._change[a];return this._updatePrevProperties(),trigger&&(data=trigger.apply(this,[event,dx,dy]),this._updateVirtualBoundaries(event.shiftKey),(this._aspectRatio||event.shiftKey)&&(data=this._updateRatio(data,event)),data=this._respectSize(data,event),this._updateCache(data),this._propagate("resize",event),props=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),$2.isEmptyObject(props)||(this._updatePrevProperties(),this._trigger("resize",event,this.ui()),this._applyChanges())),!1},"_mouseDrag"),_mouseStop:__name(function(event){this.resizing=!1;var pr,ista,soffseth,soffsetw,s,left,top,o=this.options,that=this;return this._helper&&(pr=this._proportionallyResizeElements,ista=pr.length&&/textarea/i.test(pr[0].nodeName),soffseth=ista&&this._hasScroll(pr[0],"left")?0:that.sizeDiff.height,soffsetw=ista?0:that.sizeDiff.width,s={width:that.helper.width()-soffsetw,height:that.helper.height()-soffseth},left=parseFloat(that.element.css("left"))+(that.position.left-that.originalPosition.left)||null,top=parseFloat(that.element.css("top"))+(that.position.top-that.originalPosition.top)||null,o.animate||this.element.css($2.extend(s,{top,left})),that.helper.height(that.size.height),that.helper.width(that.size.width),this._helper&&!o.animate&&this._proportionallyResize()),$2("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",event),this._helper&&this.helper.remove(),!1},"_mouseStop"),_updatePrevProperties:__name(function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},"_updatePrevProperties"),_applyChanges:__name(function(){var props={};return this.position.top!==this.prevPosition.top&&(props.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(props.left=this.position.left+"px"),this.helper.css(props),this.size.width!==this.prevSize.width&&(props.width=this.size.width+"px",this.helper.width(props.width)),this.size.height!==this.prevSize.height&&(props.height=this.size.height+"px",this.helper.height(props.height)),props},"_applyChanges"),_updateVirtualBoundaries:__name(function(forceAspectRatio){var pMinWidth,pMaxWidth,pMinHeight,pMaxHeight,b,o=this.options;b={minWidth:this._isNumber(o.minWidth)?o.minWidth:0,maxWidth:this._isNumber(o.maxWidth)?o.maxWidth:1/0,minHeight:this._isNumber(o.minHeight)?o.minHeight:0,maxHeight:this._isNumber(o.maxHeight)?o.maxHeight:1/0},(this._aspectRatio||forceAspectRatio)&&(pMinWidth=b.minHeight*this.aspectRatio,pMinHeight=b.minWidth/this.aspectRatio,pMaxWidth=b.maxHeight*this.aspectRatio,pMaxHeight=b.maxWidth/this.aspectRatio,pMinWidth>b.minWidth&&(b.minWidth=pMinWidth),pMinHeight>b.minHeight&&(b.minHeight=pMinHeight),pMaxWidth<b.maxWidth&&(b.maxWidth=pMaxWidth),pMaxHeight<b.maxHeight&&(b.maxHeight=pMaxHeight)),this._vBoundaries=b},"_updateVirtualBoundaries"),_updateCache:__name(function(data){this.offset=this.helper.offset(),this._isNumber(data.left)&&(this.position.left=data.left),this._isNumber(data.top)&&(this.position.top=data.top),this._isNumber(data.height)&&(this.size.height=data.height),this._isNumber(data.width)&&(this.size.width=data.width)},"_updateCache"),_updateRatio:__name(function(data){var cpos=this.position,csize=this.size,a=this.axis;return this._isNumber(data.height)?data.width=data.height*this.aspectRatio:this._isNumber(data.width)&&(data.height=data.width/this.aspectRatio),a==="sw"&&(data.left=cpos.left+(csize.width-data.width),data.top=null),a==="nw"&&(data.top=cpos.top+(csize.height-data.height),data.left=cpos.left+(csize.width-data.width)),data},"_updateRatio"),_respectSize:__name(function(data){var o=this._vBoundaries,a=this.axis,ismaxw=this._isNumber(data.width)&&o.maxWidth&&o.maxWidth<data.width,ismaxh=this._isNumber(data.height)&&o.maxHeight&&o.maxHeight<data.height,isminw=this._isNumber(data.width)&&o.minWidth&&o.minWidth>data.width,isminh=this._isNumber(data.height)&&o.minHeight&&o.minHeight>data.height,dw=this.originalPosition.left+this.originalSize.width,dh=this.originalPosition.top+this.originalSize.height,cw=/sw|nw|w/.test(a),ch=/nw|ne|n/.test(a);return isminw&&(data.width=o.minWidth),isminh&&(data.height=o.minHeight),ismaxw&&(data.width=o.maxWidth),ismaxh&&(data.height=o.maxHeight),isminw&&cw&&(data.left=dw-o.minWidth),ismaxw&&cw&&(data.left=dw-o.maxWidth),isminh&&ch&&(data.top=dh-o.minHeight),ismaxh&&ch&&(data.top=dh-o.maxHeight),!data.width&&!data.height&&!data.left&&data.top?data.top=null:!data.width&&!data.height&&!data.top&&data.left&&(data.left=null),data},"_respectSize"),_getPaddingPlusBorderDimensions:__name(function(element){for(var i=0,widths=[],borders=[element.css("borderTopWidth"),element.css("borderRightWidth"),element.css("borderBottomWidth"),element.css("borderLeftWidth")],paddings=[element.css("paddingTop"),element.css("paddingRight"),element.css("paddingBottom"),element.css("paddingLeft")];i<4;i++)widths[i]=parseFloat(borders[i])||0,widths[i]+=parseFloat(paddings[i])||0;return{height:widths[0]+widths[2],width:widths[1]+widths[3]}},"_getPaddingPlusBorderDimensions"),_calculateAdjustedElementDimensions:__name(function(element){var elWidth,elHeight,paddingBorder,ce=element.get(0);return element.css("box-sizing")!=="content-box"||!this._hasScroll(ce)&&!this._hasScroll(ce,"left")?{height:parseFloat(element.css("height")),width:parseFloat(element.css("width"))}:(elWidth=parseFloat(ce.style.width),elHeight=parseFloat(ce.style.height),paddingBorder=this._getPaddingPlusBorderDimensions(element),elWidth=isNaN(elWidth)?this._getElementTheoreticalSize(element,paddingBorder,"width"):elWidth,elHeight=isNaN(elHeight)?this._getElementTheoreticalSize(element,paddingBorder,"height"):elHeight,{height:elHeight,width:elWidth})},"_calculateAdjustedElementDimensions"),_getElementTheoreticalSize:__name(function(element,extraSize,dimension){var size=Math.max(0,Math.ceil(element.get(0)["offset"+dimension[0].toUpperCase()+dimension.slice(1)]-extraSize[dimension]-.5))||0;return size},"_getElementTheoreticalSize"),_proportionallyResize:__name(function(){if(this._proportionallyResizeElements.length)for(var prel,i=0,element=this.helper||this.element;i<this._proportionallyResizeElements.length;i++)prel=this._proportionallyResizeElements[i],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(prel)),prel.css({height:element.height()-this.outerDimensions.height||0,width:element.width()-this.outerDimensions.width||0})},"_proportionallyResize"),_renderProxy:__name(function(){var el=this.element,o=this.options;this.elementOffset=el.offset(),this._helper?(this.helper=this.helper||$2("<div></div>").css({overflow:"hidden"}),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++o.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},"_renderProxy"),_change:{e:__name(function(event,dx){return{width:this.originalSize.width+dx}},"e"),w:__name(function(event,dx){var cs=this.originalSize,sp=this.originalPosition;return{left:sp.left+dx,width:cs.width-dx}},"w"),n:__name(function(event,dx,dy){var cs=this.originalSize,sp=this.originalPosition;return{top:sp.top+dy,height:cs.height-dy}},"n"),s:__name(function(event,dx,dy){return{height:this.originalSize.height+dy}},"s"),se:__name(function(event,dx,dy){return $2.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[event,dx,dy]))},"se"),sw:__name(function(event,dx,dy){return $2.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[event,dx,dy]))},"sw"),ne:__name(function(event,dx,dy){return $2.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[event,dx,dy]))},"ne"),nw:__name(function(event,dx,dy){return $2.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[event,dx,dy]))},"nw")},_propagate:__name(function(n,event){$2.ui.plugin.call(this,n,[event,this.ui()]),n!=="resize"&&this._trigger(n,event,this.ui())},"_propagate"),plugins:{},ui:__name(function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}},"ui")}),$2.ui.plugin.add("resizable","animate",{stop:__name(function(event){var that=$2(this).resizable("instance"),o=that.options,pr=that._proportionallyResizeElements,ista=pr.length&&/textarea/i.test(pr[0].nodeName),soffseth=ista&&that._hasScroll(pr[0],"left")?0:that.sizeDiff.height,soffsetw=ista?0:that.sizeDiff.width,style={width:that.size.width-soffsetw,height:that.size.height-soffseth},left=parseFloat(that.element.css("left"))+(that.position.left-that.originalPosition.left)||null,top=parseFloat(that.element.css("top"))+(that.position.top-that.originalPosition.top)||null;that.element.animate($2.extend(style,top&&left?{top,left}:{}),{duration:o.animateDuration,easing:o.animateEasing,step:__name(function(){var data={width:parseFloat(that.element.css("width")),height:parseFloat(that.element.css("height")),top:parseFloat(that.element.css("top")),left:parseFloat(that.element.css("left"))};pr&&pr.length&&$2(pr[0]).css({width:data.width,height:data.height}),that._updateCache(data),that._propagate("resize",event)},"step")})},"stop")}),$2.ui.plugin.add("resizable","containment",{start:__name(function(){var element,p,co,ch,cw,width,height,that=$2(this).resizable("instance"),o=that.options,el=that.element,oc=o.containment,ce=oc instanceof $2?oc.get(0):/parent/.test(oc)?el.parent().get(0):oc;ce&&(that.containerElement=$2(ce),/document/.test(oc)||oc===document?(that.containerOffset={left:0,top:0},that.containerPosition={left:0,top:0},that.parentData={element:$2(document),left:0,top:0,width:$2(document).width(),height:$2(document).height()||document.body.parentNode.scrollHeight}):(element=$2(ce),p=[],$2(["Top","Right","Left","Bottom"]).each(function(i,name){p[i]=that._num(element.css("padding"+name))}),that.containerOffset=element.offset(),that.containerPosition=element.position(),that.containerSize={height:element.innerHeight()-p[3],width:element.innerWidth()-p[1]},co=that.containerOffset,ch=that.containerSize.height,cw=that.containerSize.width,width=that._hasScroll(ce,"left")?ce.scrollWidth:cw,height=that._hasScroll(ce)?ce.scrollHeight:ch,that.parentData={element:ce,left:co.left,top:co.top,width,height}))},"start"),resize:__name(function(event){var woset,hoset,isParent,isOffsetRelative,that=$2(this).resizable("instance"),o=that.options,co=that.containerOffset,cp=that.position,pRatio=that._aspectRatio||event.shiftKey,cop={top:0,left:0},ce=that.containerElement,continueResize=!0;ce[0]!==document&&/static/.test(ce.css("position"))&&(cop=co),cp.left<(that._helper?co.left:0)&&(that.size.width=that.size.width+(that._helper?that.position.left-co.left:that.position.left-cop.left),pRatio&&(that.size.height=that.size.width/that.aspectRatio,continueResize=!1),that.position.left=o.helper?co.left:0),cp.top<(that._helper?co.top:0)&&(that.size.height=that.size.height+(that._helper?that.position.top-co.top:that.position.top),pRatio&&(that.size.width=that.size.height*that.aspectRatio,continueResize=!1),that.position.top=that._helper?co.top:0),isParent=that.containerElement.get(0)===that.element.parent().get(0),isOffsetRelative=/relative|absolute/.test(that.containerElement.css("position")),isParent&&isOffsetRelative?(that.offset.left=that.parentData.left+that.position.left,that.offset.top=that.parentData.top+that.position.top):(that.offset.left=that.element.offset().left,that.offset.top=that.element.offset().top),woset=Math.abs(that.sizeDiff.width+(that._helper?that.offset.left-cop.left:that.offset.left-co.left)),hoset=Math.abs(that.sizeDiff.height+(that._helper?that.offset.top-cop.top:that.offset.top-co.top)),woset+that.size.width>=that.parentData.width&&(that.size.width=that.parentData.width-woset,pRatio&&(that.size.height=that.size.width/that.aspectRatio,continueResize=!1)),hoset+that.size.height>=that.parentData.height&&(that.size.height=that.parentData.height-hoset,pRatio&&(that.size.width=that.size.height*that.aspectRatio,continueResize=!1)),continueResize||(that.position.left=that.prevPosition.left,that.position.top=that.prevPosition.top,that.size.width=that.prevSize.width,that.size.height=that.prevSize.height)},"resize"),stop:__name(function(){var that=$2(this).resizable("instance"),o=that.options,co=that.containerOffset,cop=that.containerPosition,ce=that.containerElement,helper=$2(that.helper),ho=helper.offset(),w=helper.outerWidth()-that.sizeDiff.width,h=helper.outerHeight()-that.sizeDiff.height;that._helper&&!o.animate&&/relative/.test(ce.css("position"))&&$2(this).css({left:ho.left-cop.left-co.left,width:w,height:h}),that._helper&&!o.animate&&/static/.test(ce.css("position"))&&$2(this).css({left:ho.left-cop.left-co.left,width:w,height:h})},"stop")}),$2.ui.plugin.add("resizable","alsoResize",{start:__name(function(){var that=$2(this).resizable("instance"),o=that.options;$2(o.alsoResize).each(function(){var el=$2(this),elSize=that._calculateAdjustedElementDimensions(el);el.data("ui-resizable-alsoresize",{width:elSize.width,height:elSize.height,left:parseFloat(el.css("left")),top:parseFloat(el.css("top"))})})},"start"),resize:__name(function(event,ui){var that=$2(this).resizable("instance"),o=that.options,os=that.originalSize,op=that.originalPosition,delta={height:that.size.height-os.height||0,width:that.size.width-os.width||0,top:that.position.top-op.top||0,left:that.position.left-op.left||0};$2(o.alsoResize).each(function(){var el=$2(this),start=$2(this).data("ui-resizable-alsoresize"),style={},css=el.parents(ui.originalElement[0]).length?["width","height"]:["width","height","top","left"];$2.each(css,function(i,prop){var sum=(start[prop]||0)+(delta[prop]||0);sum&&sum>=0&&(style[prop]=sum||null)}),el.css(style)})},"resize"),stop:__name(function(){$2(this).removeData("ui-resizable-alsoresize")},"stop")}),$2.ui.plugin.add("resizable","ghost",{start:__name(function(){var that=$2(this).resizable("instance"),cs=that.size;that.ghost=that.originalElement.clone(),that.ghost.css({opacity:.25,display:"block",position:"relative",height:cs.height,width:cs.width,margin:0,left:0,top:0}),that._addClass(that.ghost,"ui-resizable-ghost"),$2.uiBackCompat===!0&&typeof that.options.ghost=="string"&&that.ghost.addClass(this.options.ghost),that.ghost.appendTo(that.helper)},"start"),resize:__name(function(){var that=$2(this).resizable("instance");that.ghost&&that.ghost.css({position:"relative",height:that.size.height,width:that.size.width})},"resize"),stop:__name(function(){var that=$2(this).resizable("instance");that.ghost&&that.helper&&that.helper.get(0).removeChild(that.ghost.get(0))},"stop")}),$2.ui.plugin.add("resizable","grid",{resize:__name(function(){var outerDimensions,that=$2(this).resizable("instance"),o=that.options,cs=that.size,os=that.originalSize,op=that.originalPosition,a=that.axis,grid=typeof o.grid=="number"?[o.grid,o.grid]:o.grid,gridX=grid[0]||1,gridY=grid[1]||1,ox=Math.round((cs.width-os.width)/gridX)*gridX,oy=Math.round((cs.height-os.height)/gridY)*gridY,newWidth=os.width+ox,newHeight=os.height+oy,isMaxWidth=o.maxWidth&&o.maxWidth<newWidth,isMaxHeight=o.maxHeight&&o.maxHeight<newHeight,isMinWidth=o.minWidth&&o.minWidth>newWidth,isMinHeight=o.minHeight&&o.minHeight>newHeight;o.grid=grid,isMinWidth&&(newWidth+=gridX),isMinHeight&&(newHeight+=gridY),isMaxWidth&&(newWidth-=gridX),isMaxHeight&&(newHeight-=gridY),/^(se|s|e)$/.test(a)?(that.size.width=newWidth,that.size.height=newHeight):/^(ne)$/.test(a)?(that.size.width=newWidth,that.size.height=newHeight,that.position.top=op.top-oy):/^(sw)$/.test(a)?(that.size.width=newWidth,that.size.height=newHeight,that.position.left=op.left-ox):((newHeight-gridY<=0||newWidth-gridX<=0)&&(outerDimensions=that._getPaddingPlusBorderDimensions(this)),newHeight-gridY>0?(that.size.height=newHeight,that.position.top=op.top-oy):(newHeight=gridY-outerDimensions.height,that.size.height=newHeight,that.position.top=op.top+os.height-newHeight),newWidth-gridX>0?(that.size.width=newWidth,that.position.left=op.left-ox):(newWidth=gridX-outerDimensions.width,that.size.width=newWidth,that.position.left=op.left+os.width-newWidth))},"resize")}),$2.ui.resizable;$2.widget("ui.dialog",{version:"1.14.1",options:{appendTo:"body",autoOpen:!0,buttons:[],classes:{"ui-dialog":"ui-corner-all","ui-dialog-titlebar":"ui-corner-all"},closeOnEscape:!0,closeText:"Close",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:__name(function(pos){var topOffset=$2(this).css(pos).offset().top;topOffset<0&&$2(this).css("top",pos.top-topOffset)},"using")},resizable:!0,show:null,title:null,uiDialogTitleHeadingLevel:0,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:__name(function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title==null&&this.originalTitle!=null&&(this.options.title=this.originalTitle),this.options.disabled&&(this.options.disabled=!1),this._createWrapper(),this.element.show().removeAttr("title").appendTo(this.uiDialog),this._addClass("ui-dialog-content","ui-widget-content"),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&$2.fn.draggable&&this._makeDraggable(),this.options.resizable&&$2.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},"_create"),_init:__name(function(){this.options.autoOpen&&this.open()},"_init"),_appendTo:__name(function(){var element=this.options.appendTo;return element&&(element.jquery||element.nodeType)?$2(element):this.document.find(element||"body").eq(0)},"_appendTo"),_destroy:__name(function(){var next,originalPosition=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().css(this.originalCss).detach(),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),next=originalPosition.parent.children().eq(originalPosition.index),next.length&&next[0]!==this.element[0]?next.before(this.element):originalPosition.parent.append(this.element)},"_destroy"),widget:__name(function(){return this.uiDialog},"widget"),disable:$2.noop,enable:$2.noop,close:__name(function(event){var that=this;!this._isOpen||this._trigger("beforeClose",event)===!1||(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),this.opener.filter(":focusable").trigger("focus").length||$2(this.document[0].activeElement).trigger("blur"),this._hide(this.uiDialog,this.options.hide,function(){that._trigger("close",event)}))},"close"),isOpen:__name(function(){return this._isOpen},"isOpen"),moveToTop:__name(function(){this._moveToTop()},"moveToTop"),_moveToTop:__name(function(event,silent){var moved=!1,zIndices=this.uiDialog.siblings(".ui-front:visible").map(function(){return+$2(this).css("z-index")}).get(),zIndexMax=Math.max.apply(null,zIndices);return zIndexMax>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",zIndexMax+1),moved=!0),moved&&!silent&&this._trigger("focus",event),moved},"_moveToTop"),open:__name(function(){var that=this;if(this._isOpen){this._moveToTop()&&this._focusTabbable();return}this._isOpen=!0,this.opener=$2(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){that._focusTabbable(),that._trigger("focus")}),this._makeFocusTarget(),this._trigger("open")},"open"),_focusTabbable:__name(function(){var hasFocus=this._focusedElement;hasFocus||(hasFocus=this.element.find("[autofocus]")),hasFocus.length||(hasFocus=this.element.find(":tabbable")),hasFocus.length||(hasFocus=this.uiDialogButtonPane.find(":tabbable")),hasFocus.length||(hasFocus=this.uiDialogTitlebarClose.filter(":tabbable")),hasFocus.length||(hasFocus=this.uiDialog),hasFocus.eq(0).trigger("focus")},"_focusTabbable"),_restoreTabbableFocus:__name(function(){var activeElement=this.document[0].activeElement,isActive=this.uiDialog[0]===activeElement||$2.contains(this.uiDialog[0],activeElement);isActive||this._focusTabbable()},"_restoreTabbableFocus"),_keepFocus:__name(function(event){event.preventDefault(),this._restoreTabbableFocus()},"_keepFocus"),_createWrapper:__name(function(){this.uiDialog=$2("<div>").hide().attr({tabIndex:-1,role:"dialog","aria-modal":this.options.modal?"true":null}).appendTo(this._appendTo()),this._addClass(this.uiDialog,"ui-dialog","ui-widget ui-widget-content ui-front"),this._on(this.uiDialog,{keydown:__name(function(event){if(this.options.closeOnEscape&&!event.isDefaultPrevented()&&event.keyCode&&event.keyCode===$2.ui.keyCode.ESCAPE){event.preventDefault(),this.close(event);return}if(!(event.keyCode!==$2.ui.keyCode.TAB||event.isDefaultPrevented())){var tabbables=this.uiDialog.find(":tabbable"),first=tabbables.first(),last=tabbables.last();(event.target===last[0]||event.target===this.uiDialog[0])&&!event.shiftKey?(this._delay(function(){first.trigger("focus")}),event.preventDefault()):(event.target===first[0]||event.target===this.uiDialog[0])&&event.shiftKey&&(this._delay(function(){last.trigger("focus")}),event.preventDefault())}},"keydown"),mousedown:__name(function(event){this._moveToTop(event)&&this._focusTabbable()},"mousedown")}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},"_createWrapper"),_createTitlebar:__name(function(){var uiDialogTitle;this.uiDialogTitlebar=$2("<div>"),this._addClass(this.uiDialogTitlebar,"ui-dialog-titlebar","ui-widget-header ui-helper-clearfix"),this._on(this.uiDialogTitlebar,{mousedown:__name(function(event){$2(event.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.trigger("focus")},"mousedown")}),this.uiDialogTitlebarClose=$2("<button type='button'></button>").button({label:$2("<a>").text(this.options.closeText).html(),icon:"ui-icon-closethick",showLabel:!1}).appendTo(this.uiDialogTitlebar),this._addClass(this.uiDialogTitlebarClose,"ui-dialog-titlebar-close"),this._on(this.uiDialogTitlebarClose,{click:__name(function(event){event.preventDefault(),this.close(event)},"click")});var uiDialogHeadingLevel=Number.isInteger(this.options.uiDialogTitleHeadingLevel)&&this.options.uiDialogTitleHeadingLevel>0&&this.options.uiDialogTitleHeadingLevel<=6?"h"+this.options.uiDialogTitleHeadingLevel:"span";uiDialogTitle=$2("<"+uiDialogHeadingLevel+">").uniqueId().prependTo(this.uiDialogTitlebar),this._addClass(uiDialogTitle,"ui-dialog-title"),this._title(uiDialogTitle),this.uiDialogTitlebar.prependTo(this.uiDialog),this.uiDialog.attr({"aria-labelledby":uiDialogTitle.attr("id")})},"_createTitlebar"),_title:__name(function(title){this.options.title?title.text(this.options.title):title.html("&#160;")},"_title"),_createButtonPane:__name(function(){this.uiDialogButtonPane=$2("<div>"),this._addClass(this.uiDialogButtonPane,"ui-dialog-buttonpane","ui-widget-content ui-helper-clearfix"),this.uiButtonSet=$2("<div>").appendTo(this.uiDialogButtonPane),this._addClass(this.uiButtonSet,"ui-dialog-buttonset"),this._createButtons()},"_createButtonPane"),_createButtons:__name(function(){var that=this,buttons=this.options.buttons;if(this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),$2.isEmptyObject(buttons)||Array.isArray(buttons)&&!buttons.length){this._removeClass(this.uiDialog,"ui-dialog-buttons");return}$2.each(buttons,function(name,props){var click,buttonOptions;props=typeof props=="function"?{click:props,text:name}:props,props=$2.extend({type:"button"},props),click=props.click,buttonOptions={icon:props.icon,iconPosition:props.iconPosition,showLabel:props.showLabel,icons:props.icons,text:props.text},delete props.click,delete props.icon,delete props.iconPosition,delete props.showLabel,delete props.icons,typeof props.text=="boolean"&&delete props.text,$2("<button></button>",props).button(buttonOptions).appendTo(that.uiButtonSet).on("click",function(){click.apply(that.element[0],arguments)})}),this._addClass(this.uiDialog,"ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog)},"_createButtons"),_makeDraggable:__name(function(){var that=this,options=this.options;function filteredUi(ui){return{position:ui.position,offset:ui.offset}}__name(filteredUi,"filteredUi"),this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:__name(function(event,ui){that._addClass($2(this),"ui-dialog-dragging"),that._blockFrames(),that._trigger("dragStart",event,filteredUi(ui))},"start"),drag:__name(function(event,ui){that._trigger("drag",event,filteredUi(ui))},"drag"),stop:__name(function(event,ui){var left=ui.offset.left-that.document.scrollLeft(),top=ui.offset.top-that.document.scrollTop();options.position={my:"left top",at:"left"+(left>=0?"+":"")+left+" top"+(top>=0?"+":"")+top,of:that.window},that._removeClass($2(this),"ui-dialog-dragging"),that._unblockFrames(),that._trigger("dragStop",event,filteredUi(ui))},"stop")})},"_makeDraggable"),_makeResizable:__name(function(){var that=this,options=this.options,handles=options.resizable,position=this.uiDialog.css("position"),resizeHandles=typeof handles=="string"?handles:"n,e,s,w,se,sw,ne,nw";function filteredUi(ui){return{originalPosition:ui.originalPosition,originalSize:ui.originalSize,position:ui.position,size:ui.size}}__name(filteredUi,"filteredUi"),this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:options.maxWidth,maxHeight:options.maxHeight,minWidth:options.minWidth,minHeight:this._minHeight(),handles:resizeHandles,start:__name(function(event,ui){that._addClass($2(this),"ui-dialog-resizing"),that._blockFrames(),that._trigger("resizeStart",event,filteredUi(ui))},"start"),resize:__name(function(event,ui){that._trigger("resize",event,filteredUi(ui))},"resize"),stop:__name(function(event,ui){var offset=that.uiDialog.offset(),left=offset.left-that.document.scrollLeft(),top=offset.top-that.document.scrollTop();options.height=that.uiDialog.height(),options.width=that.uiDialog.width(),options.position={my:"left top",at:"left"+(left>=0?"+":"")+left+" top"+(top>=0?"+":"")+top,of:that.window},that._removeClass($2(this),"ui-dialog-resizing"),that._unblockFrames(),that._trigger("resizeStop",event,filteredUi(ui))},"stop")}).css("position",position)},"_makeResizable"),_trackFocus:__name(function(){this._on(this.widget(),{focusin:__name(function(event){this._makeFocusTarget(),this._focusedElement=$2(event.target)},"focusin")})},"_trackFocus"),_makeFocusTarget:__name(function(){this._untrackInstance(),this._trackingInstances().unshift(this)},"_makeFocusTarget"),_untrackInstance:__name(function(){var instances=this._trackingInstances(),exists=$2.inArray(this,instances);exists!==-1&&instances.splice(exists,1)},"_untrackInstance"),_trackingInstances:__name(function(){var instances=this.document.data("ui-dialog-instances");return instances||(instances=[],this.document.data("ui-dialog-instances",instances)),instances},"_trackingInstances"),_minHeight:__name(function(){var options=this.options;return options.height==="auto"?options.minHeight:Math.min(options.minHeight,options.height)},"_minHeight"),_position:__name(function(){var isVisible=this.uiDialog.is(":visible");isVisible||this.uiDialog.show(),this.uiDialog.position(this.options.position),isVisible||this.uiDialog.hide()},"_position"),_setOptions:__name(function(options){var that=this,resize=!1,resizableOptions={};$2.each(options,function(key,value){that._setOption(key,value),key in that.sizeRelatedOptions&&(resize=!0),key in that.resizableRelatedOptions&&(resizableOptions[key]=value)}),resize&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",resizableOptions)},"_setOptions"),_setOption:__name(function(key,value){var isDraggable,isResizable,uiDialog=this.uiDialog;key!=="disabled"&&(this._super(key,value),key==="appendTo"&&this.uiDialog.appendTo(this._appendTo()),key==="buttons"&&this._createButtons(),key==="closeText"&&this.uiDialogTitlebarClose.button({label:$2("<a>").text(""+this.options.closeText).html()}),key==="draggable"&&(isDraggable=uiDialog.is(":data(ui-draggable)"),isDraggable&&!value&&uiDialog.draggable("destroy"),!isDraggable&&value&&this._makeDraggable()),key==="position"&&this._position(),key==="resizable"&&(isResizable=uiDialog.is(":data(ui-resizable)"),isResizable&&!value&&uiDialog.resizable("destroy"),isResizable&&typeof value=="string"&&uiDialog.resizable("option","handles",value),!isResizable&&value!==!1&&this._makeResizable()),key==="title"&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")),key==="modal"&&uiDialog.attr("aria-modal",value?"true":null))},"_setOption"),_size:__name(function(){var nonContentHeight,minContentHeight,maxContentHeight,options=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),options.minWidth>options.width&&(options.width=options.minWidth),nonContentHeight=this.uiDialog.css({height:"auto",width:options.width}).outerHeight(),minContentHeight=Math.max(0,options.minHeight-nonContentHeight),maxContentHeight=typeof options.maxHeight=="number"?Math.max(0,options.maxHeight-nonContentHeight):"none",options.height==="auto"?this.element.css({minHeight:minContentHeight,maxHeight:maxContentHeight,height:"auto"}):this.element.height(Math.max(0,options.height-nonContentHeight)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},"_size"),_blockFrames:__name(function(){this.iframeBlocks=this.document.find("iframe").map(function(){var iframe=$2(this);return $2("<div>").css({position:"absolute",width:iframe.outerWidth(),height:iframe.outerHeight()}).appendTo(iframe.parent()).offset(iframe.offset())[0]})},"_blockFrames"),_unblockFrames:__name(function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},"_unblockFrames"),_allowInteraction:__name(function(event){return $2(event.target).closest(".ui-dialog").length?!0:!!$2(event.target).closest(".ui-datepicker").length},"_allowInteraction"),_createOverlay:__name(function(){if(this.options.modal){var isOpening=!0;this._delay(function(){isOpening=!1}),this.document.data("ui-dialog-overlays")||this.document.on("focusin.ui-dialog",function(event){if(!isOpening){var instance=this._trackingInstances()[0];instance._allowInteraction(event)||(event.preventDefault(),instance._focusTabbable())}}.bind(this)),this.overlay=$2("<div>").appendTo(this._appendTo()),this._addClass(this.overlay,null,"ui-widget-overlay ui-front"),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},"_createOverlay"),_destroyOverlay:__name(function(){if(this.options.modal&&this.overlay){var overlays=this.document.data("ui-dialog-overlays")-1;overlays?this.document.data("ui-dialog-overlays",overlays):(this.document.off("focusin.ui-dialog"),this.document.removeData("ui-dialog-overlays")),this.overlay.remove(),this.overlay=null}},"_destroyOverlay")}),$2.uiBackCompat===!0&&$2.widget("ui.dialog",$2.ui.dialog,{options:{dialogClass:""},_createWrapper:__name(function(){this._super(),this.uiDialog.addClass(this.options.dialogClass)},"_createWrapper"),_setOption:__name(function(key,value){key==="dialogClass"&&this.uiDialog.removeClass(this.options.dialogClass).addClass(value),this._superApply(arguments)},"_setOption")}),$2.ui.dialog;$2.widget("ui.droppable",{version:"1.14.1",widgetEventPrefix:"drop",options:{accept:"*",addClasses:!0,greedy:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:__name(function(){var proportions,o=this.options,accept=o.accept;this.isover=!1,this.isout=!0,this.accept=typeof accept=="function"?accept:function(d){return d.is(accept)},this.proportions=function(){if(arguments.length)proportions=arguments[0];else return proportions||(proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight})},this._addToManager(o.scope),o.addClasses&&this._addClass("ui-droppable")},"_create"),_addToManager:__name(function(scope){$2.ui.ddmanager.droppables[scope]=$2.ui.ddmanager.droppables[scope]||[],$2.ui.ddmanager.droppables[scope].push(this)},"_addToManager"),_splice:__name(function(drop){for(var i=0;i<drop.length;i++)drop[i]===this&&drop.splice(i,1)},"_splice"),_destroy:__name(function(){var drop=$2.ui.ddmanager.droppables[this.options.scope];this._splice(drop)},"_destroy"),_setOption:__name(function(key,value){if(key==="accept")this.accept=typeof value=="function"?value:function(d){return d.is(value)};else if(key==="scope"){var drop=$2.ui.ddmanager.droppables[this.options.scope];this._splice(drop),this._addToManager(value)}this._super(key,value)},"_setOption"),_activate:__name(function(event){var draggable2=$2.ui.ddmanager.current;this._addActiveClass(),draggable2&&this._trigger("activate",event,this.ui(draggable2))},"_activate"),_deactivate:__name(function(event){var draggable2=$2.ui.ddmanager.current;this._removeActiveClass(),draggable2&&this._trigger("deactivate",event,this.ui(draggable2))},"_deactivate"),_over:__name(function(event){var draggable2=$2.ui.ddmanager.current;!draggable2||(draggable2.currentItem||draggable2.element)[0]===this.element[0]||this.accept.call(this.element[0],draggable2.currentItem||draggable2.element)&&(this._addHoverClass(),this._trigger("over",event,this.ui(draggable2)))},"_over"),_out:__name(function(event){var draggable2=$2.ui.ddmanager.current;!draggable2||(draggable2.currentItem||draggable2.element)[0]===this.element[0]||this.accept.call(this.element[0],draggable2.currentItem||draggable2.element)&&(this._removeHoverClass(),this._trigger("out",event,this.ui(draggable2)))},"_out"),_drop:__name(function(event,custom){var draggable2=custom||$2.ui.ddmanager.current,childrenIntersection=!1;return!draggable2||(draggable2.currentItem||draggable2.element)[0]===this.element[0]||(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var inst=$2(this).droppable("instance");if(inst.options.greedy&&!inst.options.disabled&&inst.options.scope===draggable2.options.scope&&inst.accept.call(inst.element[0],draggable2.currentItem||draggable2.element)&&$2.ui.intersect(draggable2,$2.extend(inst,{offset:inst.element.offset()}),inst.options.tolerance,event))return childrenIntersection=!0,!1}),childrenIntersection)?!1:this.accept.call(this.element[0],draggable2.currentItem||draggable2.element)?(this._removeActiveClass(),this._removeHoverClass(),this._trigger("drop",event,this.ui(draggable2)),this.element):!1},"_drop"),ui:__name(function(c){return{draggable:c.currentItem||c.element,helper:c.helper,position:c.position,offset:c.positionAbs}},"ui"),_addHoverClass:__name(function(){this._addClass("ui-droppable-hover")},"_addHoverClass"),_removeHoverClass:__name(function(){this._removeClass("ui-droppable-hover")},"_removeHoverClass"),_addActiveClass:__name(function(){this._addClass("ui-droppable-active")},"_addActiveClass"),_removeActiveClass:__name(function(){this._removeClass("ui-droppable-active")},"_removeActiveClass")}),$2.ui.intersect=(function(){function isOverAxis(x,reference,size){return x>=reference&&x<reference+size}return __name(isOverAxis,"isOverAxis"),function(draggable2,droppable2,toleranceMode,event){if(!droppable2.offset)return!1;var x1=(draggable2.positionAbs||draggable2.position.absolute).left+draggable2.margins.left,y1=(draggable2.positionAbs||draggable2.position.absolute).top+draggable2.margins.top,x2=x1+draggable2.helperProportions.width,y2=y1+draggable2.helperProportions.height,l=droppable2.offset.left,t=droppable2.offset.top,r=l+droppable2.proportions().width,b=t+droppable2.proportions().height;switch(toleranceMode){case"fit":return l<=x1&&x2<=r&&t<=y1&&y2<=b;case"intersect":return l<x1+draggable2.helperProportions.width/2&&x2-draggable2.helperProportions.width/2<r&&t<y1+draggable2.helperProportions.height/2&&y2-draggable2.helperProportions.height/2<b;case"pointer":return isOverAxis(event.pageY,t,droppable2.proportions().height)&&isOverAxis(event.pageX,l,droppable2.proportions().width);case"touch":return(y1>=t&&y1<=b||y2>=t&&y2<=b||y1<t&&y2>b)&&(x1>=l&&x1<=r||x2>=l&&x2<=r||x1<l&&x2>r);default:return!1}}})(),$2.ui.ddmanager={current:null,droppables:{default:[]},prepareOffsets:__name(function(t,event){var i,j,m=$2.ui.ddmanager.droppables[t.options.scope]||[],type=event?event.type:null,list=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();droppablesLoop:for(i=0;i<m.length;i++)if(!(m[i].options.disabled||t&&!m[i].accept.call(m[i].element[0],t.currentItem||t.element))){for(j=0;j<list.length;j++)if(list[j]===m[i].element[0]){m[i].proportions().height=0;continue droppablesLoop}m[i].visible=m[i].element.css("display")!=="none",m[i].visible&&(type==="mousedown"&&m[i]._activate.call(m[i],event),m[i].offset=m[i].element.offset(),m[i].proportions({width:m[i].element[0].offsetWidth,height:m[i].element[0].offsetHeight}))}},"prepareOffsets"),drop:__name(function(draggable2,event){var dropped=!1;return $2.each(($2.ui.ddmanager.droppables[draggable2.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&$2.ui.intersect(draggable2,this,this.options.tolerance,event)&&(dropped=this._drop.call(this,event)||dropped),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],draggable2.currentItem||draggable2.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,event)))}),dropped},"drop"),dragStart:__name(function(draggable2,event){draggable2.element.parentsUntil("body").on("scroll.droppable",function(){draggable2.options.refreshPositions||$2.ui.ddmanager.prepareOffsets(draggable2,event)})},"dragStart"),drag:__name(function(draggable2,event){draggable2.options.refreshPositions&&$2.ui.ddmanager.prepareOffsets(draggable2,event),$2.each($2.ui.ddmanager.droppables[draggable2.options.scope]||[],function(){if(!(this.options.disabled||this.greedyChild||!this.visible)){var parentInstance,scope,parent2,intersects=$2.ui.intersect(draggable2,this,this.options.tolerance,event),c=!intersects&&this.isover?"isout":intersects&&!this.isover?"isover":null;c&&(this.options.greedy&&(scope=this.options.scope,parent2=this.element.parents(":data(ui-droppable)").filter(function(){return $2(this).droppable("instance").options.scope===scope}),parent2.length&&(parentInstance=$2(parent2[0]).droppable("instance"),parentInstance.greedyChild=c==="isover")),parentInstance&&c==="isover"&&(parentInstance.isover=!1,parentInstance.isout=!0,parentInstance._out.call(parentInstance,event)),this[c]=!0,this[c==="isout"?"isover":"isout"]=!1,this[c==="isover"?"_over":"_out"].call(this,event),parentInstance&&c==="isout"&&(parentInstance.isout=!1,parentInstance.isover=!0,parentInstance._over.call(parentInstance,event)))}})},"drag"),dragStop:__name(function(draggable2,event){draggable2.element.parentsUntil("body").off("scroll.droppable"),draggable2.options.refreshPositions||$2.ui.ddmanager.prepareOffsets(draggable2,event)},"dragStop")},$2.uiBackCompat===!0&&$2.widget("ui.droppable",$2.ui.droppable,{options:{hoverClass:!1,activeClass:!1},_addActiveClass:__name(function(){this._super(),this.options.activeClass&&this.element.addClass(this.options.activeClass)},"_addActiveClass"),_removeActiveClass:__name(function(){this._super(),this.options.activeClass&&this.element.removeClass(this.options.activeClass)},"_removeActiveClass"),_addHoverClass:__name(function(){this._super(),this.options.hoverClass&&this.element.addClass(this.options.hoverClass)},"_addHoverClass"),_removeHoverClass:__name(function(){this._super(),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass)},"_removeHoverClass")}),$2.ui.droppable;$2.widget("ui.progressbar",{version:"1.14.1",options:{classes:{"ui-progressbar":"ui-corner-all","ui-progressbar-value":"ui-corner-left","ui-progressbar-complete":"ui-corner-right"},max:100,value:0,change:null,complete:null},min:0,_create:__name(function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.attr({role:"progressbar","aria-valuemin":this.min}),this._addClass("ui-progressbar","ui-widget ui-widget-content"),this.valueDiv=$2("<div>").appendTo(this.element),this._addClass(this.valueDiv,"ui-progressbar-value","ui-widget-header"),this._refreshValue()},"_create"),_destroy:__name(function(){this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"),this.valueDiv.remove()},"_destroy"),value:__name(function(newValue){if(newValue===void 0)return this.options.value;this.options.value=this._constrainedValue(newValue),this._refreshValue()},"value"),_constrainedValue:__name(function(newValue){return newValue===void 0&&(newValue=this.options.value),this.indeterminate=newValue===!1,typeof newValue!="number"&&(newValue=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,newValue))},"_constrainedValue"),_setOptions:__name(function(options){var value=options.value;delete options.value,this._super(options),this.options.value=this._constrainedValue(value),this._refreshValue()},"_setOptions"),_setOption:__name(function(key,value){key==="max"&&(value=Math.max(this.min,value)),this._super(key,value)},"_setOption"),_setOptionDisabled:__name(function(value){this._super(value),this.element.attr("aria-disabled",value),this._toggleClass(null,"ui-state-disabled",!!value)},"_setOptionDisabled"),_percentage:__name(function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},"_percentage"),_refreshValue:__name(function(){var value=this.options.value,percentage=this._percentage();this.valueDiv.toggle(this.indeterminate||value>this.min).width(percentage.toFixed(0)+"%"),this._toggleClass(this.valueDiv,"ui-progressbar-complete",null,value===this.options.max)._toggleClass("ui-progressbar-indeterminate",null,this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=$2("<div>").appendTo(this.valueDiv),this._addClass(this.overlayDiv,"ui-progressbar-overlay"))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":value}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==value&&(this.oldValue=value,this._trigger("change")),value===this.options.max&&this._trigger("complete")},"_refreshValue")});$2.widget("ui.selectable",$2.ui.mouse,{version:"1.14.1",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:__name(function(){var that=this;this._addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){that.elementPos=$2(that.element[0]).offset(),that.selectees=$2(that.options.filter,that.element[0]),that._addClass(that.selectees,"ui-selectee"),that.selectees.each(function(){var $this=$2(this),selecteeOffset=$this.offset(),pos={left:selecteeOffset.left-that.elementPos.left,top:selecteeOffset.top-that.elementPos.top};$2.data(this,"selectable-item",{element:this,$element:$this,left:pos.left,top:pos.top,right:pos.left+$this.outerWidth(),bottom:pos.top+$this.outerHeight(),startselected:!1,selected:$this.hasClass("ui-selected"),selecting:$this.hasClass("ui-selecting"),unselecting:$this.hasClass("ui-unselecting")})})},this.refresh(),this._mouseInit(),this.helper=$2("<div>"),this._addClass(this.helper,"ui-selectable-helper")},"_create"),_destroy:__name(function(){this.selectees.removeData("selectable-item"),this._mouseDestroy()},"_destroy"),_mouseStart:__name(function(event){var that=this,options=this.options;this.opos=[event.pageX,event.pageY],this.elementPos=$2(this.element[0]).offset(),!this.options.disabled&&(this.selectees=$2(options.filter,this.element[0]),this._trigger("start",event),$2(options.appendTo).append(this.helper),this.helper.css({left:event.pageX,top:event.pageY,width:0,height:0}),options.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var selectee=$2.data(this,"selectable-item");selectee.startselected=!0,!event.metaKey&&!event.ctrlKey&&(that._removeClass(selectee.$element,"ui-selected"),selectee.selected=!1,that._addClass(selectee.$element,"ui-unselecting"),selectee.unselecting=!0,that._trigger("unselecting",event,{unselecting:selectee.element}))}),$2(event.target).parents().addBack().each(function(){var doSelect,selectee=$2.data(this,"selectable-item");if(selectee)return doSelect=!event.metaKey&&!event.ctrlKey||!selectee.$element.hasClass("ui-selected"),that._removeClass(selectee.$element,doSelect?"ui-unselecting":"ui-selected")._addClass(selectee.$element,doSelect?"ui-selecting":"ui-unselecting"),selectee.unselecting=!doSelect,selectee.selecting=doSelect,selectee.selected=doSelect,doSelect?that._trigger("selecting",event,{selecting:selectee.element}):that._trigger("unselecting",event,{unselecting:selectee.element}),!1}))},"_mouseStart"),_mouseDrag:__name(function(event){if(this.dragged=!0,!this.options.disabled){var tmp,that=this,options=this.options,x1=this.opos[0],y1=this.opos[1],x2=event.pageX,y2=event.pageY;return x1>x2&&(tmp=x2,x2=x1,x1=tmp),y1>y2&&(tmp=y2,y2=y1,y1=tmp),this.helper.css({left:x1,top:y1,width:x2-x1,height:y2-y1}),this.selectees.each(function(){var selectee=$2.data(this,"selectable-item"),hit=!1,offset={};!selectee||selectee.element===that.element[0]||(offset.left=selectee.left+that.elementPos.left,offset.right=selectee.right+that.elementPos.left,offset.top=selectee.top+that.elementPos.top,offset.bottom=selectee.bottom+that.elementPos.top,options.tolerance==="touch"?hit=!(offset.left>x2||offset.right<x1||offset.top>y2||offset.bottom<y1):options.tolerance==="fit"&&(hit=offset.left>x1&&offset.right<x2&&offset.top>y1&&offset.bottom<y2),hit?(selectee.selected&&(that._removeClass(selectee.$element,"ui-selected"),selectee.selected=!1),selectee.unselecting&&(that._removeClass(selectee.$element,"ui-unselecting"),selectee.unselecting=!1),selectee.selecting||(that._addClass(selectee.$element,"ui-selecting"),selectee.selecting=!0,that._trigger("selecting",event,{selecting:selectee.element}))):(selectee.selecting&&((event.metaKey||event.ctrlKey)&&selectee.startselected?(that._removeClass(selectee.$element,"ui-selecting"),selectee.selecting=!1,that._addClass(selectee.$element,"ui-selected"),selectee.selected=!0):(that._removeClass(selectee.$element,"ui-selecting"),selectee.selecting=!1,selectee.startselected&&(that._addClass(selectee.$element,"ui-unselecting"),selectee.unselecting=!0),that._trigger("unselecting",event,{unselecting:selectee.element}))),selectee.selected&&!event.metaKey&&!event.ctrlKey&&!selectee.startselected&&(that._removeClass(selectee.$element,"ui-selected"),selectee.selected=!1,that._addClass(selectee.$element,"ui-unselecting"),selectee.unselecting=!0,that._trigger("unselecting",event,{unselecting:selectee.element}))))}),!1}},"_mouseDrag"),_mouseStop:__name(function(event){var that=this;return this.dragged=!1,$2(".ui-unselecting",this.element[0]).each(function(){var selectee=$2.data(this,"selectable-item");that._removeClass(selectee.$element,"ui-unselecting"),selectee.unselecting=!1,selectee.startselected=!1,that._trigger("unselected",event,{unselected:selectee.element})}),$2(".ui-selecting",this.element[0]).each(function(){var selectee=$2.data(this,"selectable-item");that._removeClass(selectee.$element,"ui-selecting")._addClass(selectee.$element,"ui-selected"),selectee.selecting=!1,selectee.selected=!0,selectee.startselected=!0,that._trigger("selected",event,{selected:selectee.element})}),this._trigger("stop",event),this.helper.remove(),!1},"_mouseStop")});$2.widget("ui.selectmenu",[$2.ui.formResetMixin,{version:"1.14.1",defaultElement:"<select>",options:{appendTo:null,classes:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"},disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:!1,change:null,close:null,focus:null,open:null,select:null},_create:__name(function(){var selectmenuId=this.element.uniqueId().attr("id");this.ids={element:selectmenuId,button:selectmenuId+"-button",menu:selectmenuId+"-menu"},this._drawButton(),this._drawMenu(),this._bindFormResetHandler(),this._rendered=!1,this.menuItems=$2()},"_create"),_drawButton:__name(function(){var icon,that=this,item=this._parseOption(this.element.find("option:selected"),this.element[0].selectedIndex);this.labels=this.element.labels().attr("for",this.ids.button),this._on(this.labels,{click:__name(function(event){this.button.trigger("focus"),event.preventDefault()},"click")}),this.element.hide(),this.button=$2("<span>",{tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true",title:this.element.attr("title")}).insertAfter(this.element),this._addClass(this.button,"ui-selectmenu-button ui-selectmenu-button-closed","ui-button ui-widget"),icon=$2("<span>").appendTo(this.button),this._addClass(icon,"ui-selectmenu-icon","ui-icon "+this.options.icons.button),this.buttonItem=this._renderButtonItem(item).appendTo(this.button),this.options.width!==!1&&this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){that._rendered||that._refreshMenu()})},"_drawButton"),_drawMenu:__name(function(){var that=this;this.menu=$2("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=$2("<div>").append(this.menu),this._addClass(this.menuWrap,"ui-selectmenu-menu","ui-front"),this.menuWrap.appendTo(this._appendTo()),this.menuInstance=this.menu.menu({classes:{"ui-menu":"ui-corner-bottom"},role:"listbox",select:__name(function(event,ui){event.preventDefault(),that._select(ui.item.data("ui-selectmenu-item"),event)},"select"),focus:__name(function(event,ui){var item=ui.item.data("ui-selectmenu-item");that.focusIndex!=null&&item.index!==that.focusIndex&&(that._trigger("focus",event,{item}),that.isOpen||that._select(item,event)),that.focusIndex=item.index,that.button.attr("aria-activedescendant",that.menuItems.eq(item.index).attr("id"))},"focus")}).menu("instance"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},"_drawMenu"),refresh:__name(function(){this._refreshMenu(),this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(this._getSelectedItem().data("ui-selectmenu-item")||{})),this.options.width===null&&this._resizeButton()},"refresh"),_refreshMenu:__name(function(){var item,options=this.element.find("option");this.menu.empty(),this._parseOptions(options),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup").find(".ui-menu-item-wrapper"),this._rendered=!0,options.length&&(item=this._getSelectedItem(),this.menuInstance.focus(null,item),this._setAria(item.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},"_refreshMenu"),open:__name(function(event){this.options.disabled||(this._rendered?(this._removeClass(this.menu.find(".ui-state-active"),null,"ui-state-active"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.menuItems.length&&(this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",event)))},"open"),_position:__name(function(){this.menuWrap.position($2.extend({of:this.button},this.options.position))},"_position"),close:__name(function(event){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",event))},"close"),widget:__name(function(){return this.button},"widget"),menuWidget:__name(function(){return this.menu},"menuWidget"),_renderButtonItem:__name(function(item){var buttonItem=$2("<span>");return this._setText(buttonItem,item.label),this._addClass(buttonItem,"ui-selectmenu-text"),buttonItem},"_renderButtonItem"),_renderMenu:__name(function(ul,items){var that=this,currentOptgroup="";$2.each(items,function(index,item){var li;item.optgroup!==currentOptgroup&&(li=$2("<li>",{text:item.optgroup}),that._addClass(li,"ui-selectmenu-optgroup","ui-menu-divider"+(item.element.parent("optgroup").prop("disabled")?" ui-state-disabled":"")),li.appendTo(ul),currentOptgroup=item.optgroup),that._renderItemData(ul,item)})},"_renderMenu"),_renderItemData:__name(function(ul,item){return this._renderItem(ul,item).data("ui-selectmenu-item",item)},"_renderItemData"),_renderItem:__name(function(ul,item){var li=$2("<li>"),wrapper=$2("<div>",{title:item.element.attr("title")});return item.disabled&&this._addClass(li,null,"ui-state-disabled"),item.hidden?li.prop("hidden",!0):this._setText(wrapper,item.label),li.append(wrapper).appendTo(ul)},"_renderItem"),_setText:__name(function(element,value){value?element.text(value):element.html("&#160;")},"_setText"),_move:__name(function(direction,event){var item,next,filter=".ui-menu-item";this.isOpen?item=this.menuItems.eq(this.focusIndex).parent("li"):(item=this.menuItems.eq(this.element[0].selectedIndex).parent("li"),filter+=":not(.ui-state-disabled)"),direction==="first"||direction==="last"?next=item[direction==="first"?"prevAll":"nextAll"](filter).eq(-1):next=item[direction+"All"](filter).eq(0),next.length&&this.menuInstance.focus(event,next)},"_move"),_getSelectedItem:__name(function(){return this.menuItems.eq(this.element[0].selectedIndex).parent("li")},"_getSelectedItem"),_toggle:__name(function(event){this[this.isOpen?"close":"open"](event)},"_toggle"),_setSelection:__name(function(){var selection;this.range&&(selection=window.getSelection(),selection.removeAllRanges(),selection.addRange(this.range))},"_setSelection"),_documentClick:{mousedown:__name(function(event){this.isOpen&&($2(event.target).closest(".ui-selectmenu-menu, #"+CSS.escape(this.ids.button)).length||this.close(event))},"mousedown")},_buttonEvents:{mousedown:__name(function(){var selection=window.getSelection();selection.rangeCount&&(this.range=selection.getRangeAt(0))},"mousedown"),click:__name(function(event){this._setSelection(),this._toggle(event)},"click"),keydown:__name(function(event){var preventDefault=!0;switch(event.keyCode){case $2.ui.keyCode.TAB:case $2.ui.keyCode.ESCAPE:this.close(event),preventDefault=!1;break;case $2.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(event);break;case $2.ui.keyCode.UP:event.altKey?this._toggle(event):this._move("prev",event);break;case $2.ui.keyCode.DOWN:event.altKey?this._toggle(event):this._move("next",event);break;case $2.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(event):this._toggle(event);break;case $2.ui.keyCode.LEFT:this._move("prev",event);break;case $2.ui.keyCode.RIGHT:this._move("next",event);break;case $2.ui.keyCode.HOME:case $2.ui.keyCode.PAGE_UP:this._move("first",event);break;case $2.ui.keyCode.END:case $2.ui.keyCode.PAGE_DOWN:this._move("last",event);break;default:this.menu.trigger(event),preventDefault=!1}preventDefault&&event.preventDefault()},"keydown")},_selectFocusedItem:__name(function(event){var item=this.menuItems.eq(this.focusIndex).parent("li");item.hasClass("ui-state-disabled")||this._select(item.data("ui-selectmenu-item"),event)},"_selectFocusedItem"),_select:__name(function(item,event){var oldIndex=this.element[0].selectedIndex;this.element[0].selectedIndex=item.index,this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(item)),this._setAria(item),this._trigger("select",event,{item}),item.index!==oldIndex&&this._trigger("change",event,{item}),this.close(event)},"_select"),_setAria:__name(function(item){var id=this.menuItems.eq(item.index).attr("id");this.button.attr({"aria-labelledby":id,"aria-activedescendant":id}),this.menu.attr("aria-activedescendant",id)},"_setAria"),_setOption:__name(function(key,value){if(key==="icons"){var icon=this.button.find("span.ui-icon");this._removeClass(icon,null,this.options.icons.button)._addClass(icon,null,value.button)}this._super(key,value),key==="appendTo"&&this.menuWrap.appendTo(this._appendTo()),key==="width"&&this._resizeButton()},"_setOption"),_setOptionDisabled:__name(function(value){this._super(value),this.menuInstance.option("disabled",value),this.button.attr("aria-disabled",value),this._toggleClass(this.button,null,"ui-state-disabled",value),this.element.prop("disabled",value),value?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)},"_setOptionDisabled"),_appendTo:__name(function(){var element=this.options.appendTo;return element&&(element=element.jquery||element.nodeType?$2(element):this.document.find(element).eq(0)),(!element||!element[0])&&(element=this.element.closest(".ui-front, dialog")),element.length||(element=this.document[0].body),element},"_appendTo"),_toggleAttr:__name(function(){this.button.attr("aria-expanded",this.isOpen),this._removeClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"closed":"open"))._addClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"open":"closed"))._toggleClass(this.menuWrap,"ui-selectmenu-open",null,this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},"_toggleAttr"),_resizeButton:__name(function(){var width=this.options.width;if(width===!1){this.button.css("width","");return}width===null&&(width=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(width)},"_resizeButton"),_resizeMenu:__name(function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()))},"_resizeMenu"),_getCreateOptions:__name(function(){var options=this._super();return options.disabled=this.element.prop("disabled"),options},"_getCreateOptions"),_parseOptions:__name(function(options){var that=this,data=[];options.each(function(index,item){data.push(that._parseOption($2(item),index))}),this.items=data},"_parseOptions"),_parseOption:__name(function(option,index){var optgroup=option.parent("optgroup");return{element:option,index,value:option.val(),label:option.text(),hidden:optgroup.prop("hidden")||option.prop("hidden"),optgroup:optgroup.attr("label")||"",disabled:optgroup.prop("disabled")||option.prop("disabled")}},"_parseOption"),_destroy:__name(function(){this._unbindFormResetHandler(),this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.labels.attr("for",this.ids.element)},"_destroy")}]);$2.widget("ui.slider",$2.ui.mouse,{version:"1.14.1",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:__name(function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1},"_create"),_refresh:__name(function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},"_refresh"),_createHandles:__name(function(){var i,handleCount,options=this.options,existingHandles=this.element.find(".ui-slider-handle"),handle="<span tabindex='0'></span>",handles=[];for(handleCount=options.values&&options.values.length||1,existingHandles.length>handleCount&&(existingHandles.slice(handleCount).remove(),existingHandles=existingHandles.slice(0,handleCount)),i=existingHandles.length;i<handleCount;i++)handles.push(handle);this.handles=existingHandles.add($2(handles.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(i2){$2(this).data("ui-slider-handle-index",i2).attr("tabIndex",0)})},"_createHandles"),_createRange:__name(function(){var options=this.options;options.range?(options.range===!0&&(options.values?options.values.length&&options.values.length!==2?options.values=[options.values[0],options.values[0]]:Array.isArray(options.values)&&(options.values=options.values.slice(0)):options.values=[this._valueMin(),this._valueMin()]),!this.range||!this.range.length?(this.range=$2("<div>").appendTo(this.element),this._addClass(this.range,"ui-slider-range")):(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})),(options.range==="min"||options.range==="max")&&this._addClass(this.range,"ui-slider-range-"+options.range)):(this.range&&this.range.remove(),this.range=null)},"_createRange"),_setupEvents:__name(function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},"_setupEvents"),_destroy:__name(function(){this.handles.remove(),this.range&&this.range.remove(),this._mouseDestroy()},"_destroy"),_mouseCapture:__name(function(event){var position,normValue,distance,closestHandle,index,allowed,offset,mouseOverHandle,that=this,o=this.options;return o.disabled||(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),position={x:event.pageX,y:event.pageY},normValue=this._normValueFromMouse(position),distance=this._valueMax()-this._valueMin()+1,this.handles.each(function(i){var thisDistance=Math.abs(normValue-that.values(i));(distance>thisDistance||distance===thisDistance&&(i===that._lastChangedValue||that.values(i)===o.min))&&(distance=thisDistance,closestHandle=$2(this),index=i)}),allowed=this._start(event,index),allowed===!1)?!1:(this._mouseSliding=!0,this._handleIndex=index,this._addClass(closestHandle,null,"ui-state-active"),closestHandle.trigger("focus"),offset=closestHandle.offset(),mouseOverHandle=!$2(event.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=mouseOverHandle?{left:0,top:0}:{left:event.pageX-offset.left-closestHandle.width()/2,top:event.pageY-offset.top-closestHandle.height()/2-(parseInt(closestHandle.css("borderTopWidth"),10)||0)-(parseInt(closestHandle.css("borderBottomWidth"),10)||0)+(parseInt(closestHandle.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(event,index,normValue),this._animateOff=!0,!0)},"_mouseCapture"),_mouseStart:__name(function(){return!0},"_mouseStart"),_mouseDrag:__name(function(event){var position={x:event.pageX,y:event.pageY},normValue=this._normValueFromMouse(position);return this._slide(event,this._handleIndex,normValue),!1},"_mouseDrag"),_mouseStop:__name(function(event){return this._removeClass(this.handles,null,"ui-state-active"),this._mouseSliding=!1,this._stop(event,this._handleIndex),this._change(event,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},"_mouseStop"),_detectOrientation:__name(function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},"_detectOrientation"),_normValueFromMouse:__name(function(position){var pixelTotal,pixelMouse,percentMouse,valueTotal,valueMouse;return this.orientation==="horizontal"?(pixelTotal=this.elementSize.width,pixelMouse=position.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(pixelTotal=this.elementSize.height,pixelMouse=position.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),percentMouse=pixelMouse/pixelTotal,percentMouse>1&&(percentMouse=1),percentMouse<0&&(percentMouse=0),this.orientation==="vertical"&&(percentMouse=1-percentMouse),valueTotal=this._valueMax()-this._valueMin(),valueMouse=this._valueMin()+percentMouse*valueTotal,this._trimAlignValue(valueMouse)},"_normValueFromMouse"),_uiHash:__name(function(index,value,values){var uiHash={handle:this.handles[index],handleIndex:index,value:value!==void 0?value:this.value()};return this._hasMultipleValues()&&(uiHash.value=value!==void 0?value:this.values(index),uiHash.values=values||this.values()),uiHash},"_uiHash"),_hasMultipleValues:__name(function(){return this.options.values&&this.options.values.length},"_hasMultipleValues"),_start:__name(function(event,index){return this._trigger("start",event,this._uiHash(index))},"_start"),_slide:__name(function(event,index,newVal){var allowed,otherVal,currentValue=this.value(),newValues=this.values();this._hasMultipleValues()&&(otherVal=this.values(index?0:1),currentValue=this.values(index),this.options.values.length===2&&this.options.range===!0&&(newVal=index===0?Math.min(otherVal,newVal):Math.max(otherVal,newVal)),newValues[index]=newVal),newVal!==currentValue&&(allowed=this._trigger("slide",event,this._uiHash(index,newVal,newValues)),allowed!==!1&&(this._hasMultipleValues()?this.values(index,newVal):this.value(newVal)))},"_slide"),_stop:__name(function(event,index){this._trigger("stop",event,this._uiHash(index))},"_stop"),_change:__name(function(event,index){!this._keySliding&&!this._mouseSliding&&(this._lastChangedValue=index,this._trigger("change",event,this._uiHash(index)))},"_change"),value:__name(function(newValue){if(arguments.length){this.options.value=this._trimAlignValue(newValue),this._refreshValue(),this._change(null,0);return}return this._value()},"value"),values:__name(function(index,newValue){var vals,newValues,i;if(arguments.length>1){this.options.values[index]=this._trimAlignValue(newValue),this._refreshValue(),this._change(null,index);return}if(arguments.length)if(Array.isArray(arguments[0])){for(vals=this.options.values,newValues=arguments[0],i=0;i<vals.length;i+=1)vals[i]=this._trimAlignValue(newValues[i]),this._change(null,i);this._refreshValue()}else return this._hasMultipleValues()?this._values(index):this.value();else return this._values()},"values"),_setOption:__name(function(key,value){var i,valsLength=0;switch(key==="range"&&this.options.range===!0&&(value==="min"?(this.options.value=this._values(0),this.options.values=null):value==="max"&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),Array.isArray(this.options.values)&&(valsLength=this.options.values.length),this._super(key,value),key){case"orientation":this._detectOrientation(),this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation),this._refreshValue(),this.options.range&&this._refreshRange(value),this.handles.css(value==="horizontal"?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),i=valsLength-1;i>=0;i--)this._change(null,i);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1;break}},"_setOption"),_setOptionDisabled:__name(function(value){this._super(value),this._toggleClass(null,"ui-state-disabled",!!value)},"_setOptionDisabled"),_value:__name(function(){var val=this.options.value;return val=this._trimAlignValue(val),val},"_value"),_values:__name(function(index){var val,vals,i;if(arguments.length)return val=this.options.values[index],val=this._trimAlignValue(val),val;if(this._hasMultipleValues()){for(vals=this.options.values.slice(),i=0;i<vals.length;i+=1)vals[i]=this._trimAlignValue(vals[i]);return vals}else return[]},"_values"),_trimAlignValue:__name(function(val){if(val<=this._valueMin())return this._valueMin();if(val>=this._valueMax())return this._valueMax();var step=this.options.step>0?this.options.step:1,valModStep=(val-this._valueMin())%step,alignValue=val-valModStep;return Math.abs(valModStep)*2>=step&&(alignValue+=valModStep>0?step:-step),parseFloat(alignValue.toFixed(5))},"_trimAlignValue"),_calculateNewMax:__name(function(){var max=this.options.max,min=this._valueMin(),step=this.options.step,aboveMin=Math.round((max-min)/step)*step;max=aboveMin+min,max>this.options.max&&(max-=step),this.max=parseFloat(max.toFixed(this._precision()))},"_calculateNewMax"),_precision:__name(function(){var precision=this._precisionOf(this.options.step);return this.options.min!==null&&(precision=Math.max(precision,this._precisionOf(this.options.min))),precision},"_precision"),_precisionOf:__name(function(num){var str=num.toString(),decimal=str.indexOf(".");return decimal===-1?0:str.length-decimal-1},"_precisionOf"),_valueMin:__name(function(){return this.options.min},"_valueMin"),_valueMax:__name(function(){return this.max},"_valueMax"),_refreshRange:__name(function(orientation){orientation==="vertical"&&this.range.css({width:"",left:""}),orientation==="horizontal"&&this.range.css({height:"",bottom:""})},"_refreshRange"),_refreshValue:__name(function(){var lastValPercent,valPercent,value,valueMin,valueMax,oRange=this.options.range,o=this.options,that=this,animate=this._animateOff?!1:o.animate,_set={};this._hasMultipleValues()?this.handles.each(function(i){valPercent=(that.values(i)-that._valueMin())/(that._valueMax()-that._valueMin())*100,_set[that.orientation==="horizontal"?"left":"bottom"]=valPercent+"%",$2(this).stop(1,1)[animate?"animate":"css"](_set,o.animate),that.options.range===!0&&(that.orientation==="horizontal"?(i===0&&that.range.stop(1,1)[animate?"animate":"css"]({left:valPercent+"%"},o.animate),i===1&&that.range[animate?"animate":"css"]({width:valPercent-lastValPercent+"%"},{queue:!1,duration:o.animate})):(i===0&&that.range.stop(1,1)[animate?"animate":"css"]({bottom:valPercent+"%"},o.animate),i===1&&that.range[animate?"animate":"css"]({height:valPercent-lastValPercent+"%"},{queue:!1,duration:o.animate}))),lastValPercent=valPercent}):(value=this.value(),valueMin=this._valueMin(),valueMax=this._valueMax(),valPercent=valueMax!==valueMin?(value-valueMin)/(valueMax-valueMin)*100:0,_set[this.orientation==="horizontal"?"left":"bottom"]=valPercent+"%",this.handle.stop(1,1)[animate?"animate":"css"](_set,o.animate),oRange==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[animate?"animate":"css"]({width:valPercent+"%"},o.animate),oRange==="max"&&this.orientation==="horizontal"&&this.range.stop(1,1)[animate?"animate":"css"]({width:100-valPercent+"%"},o.animate),oRange==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[animate?"animate":"css"]({height:valPercent+"%"},o.animate),oRange==="max"&&this.orientation==="vertical"&&this.range.stop(1,1)[animate?"animate":"css"]({height:100-valPercent+"%"},o.animate))},"_refreshValue"),_handleEvents:{keydown:__name(function(event){var allowed,curVal,newVal,step,index=$2(event.target).data("ui-slider-handle-index");switch(event.keyCode){case $2.ui.keyCode.HOME:case $2.ui.keyCode.END:case $2.ui.keyCode.PAGE_UP:case $2.ui.keyCode.PAGE_DOWN:case $2.ui.keyCode.UP:case $2.ui.keyCode.RIGHT:case $2.ui.keyCode.DOWN:case $2.ui.keyCode.LEFT:if(event.preventDefault(),!this._keySliding&&(this._keySliding=!0,this._addClass($2(event.target),null,"ui-state-active"),allowed=this._start(event,index),allowed===!1))return;break}switch(step=this.options.step,this._hasMultipleValues()?curVal=newVal=this.values(index):curVal=newVal=this.value(),event.keyCode){case $2.ui.keyCode.HOME:newVal=this._valueMin();break;case $2.ui.keyCode.END:newVal=this._valueMax();break;case $2.ui.keyCode.PAGE_UP:newVal=this._trimAlignValue(curVal+(this._valueMax()-this._valueMin())/this.numPages);break;case $2.ui.keyCode.PAGE_DOWN:newVal=this._trimAlignValue(curVal-(this._valueMax()-this._valueMin())/this.numPages);break;case $2.ui.keyCode.UP:case $2.ui.keyCode.RIGHT:if(curVal===this._valueMax())return;newVal=this._trimAlignValue(curVal+step);break;case $2.ui.keyCode.DOWN:case $2.ui.keyCode.LEFT:if(curVal===this._valueMin())return;newVal=this._trimAlignValue(curVal-step);break}this._slide(event,index,newVal)},"keydown"),keyup:__name(function(event){var index=$2(event.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(event,index),this._change(event,index),this._removeClass($2(event.target),null,"ui-state-active"))},"keyup")}});$2.widget("ui.sortable",$2.ui.mouse,{version:"1.14.1",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:__name(function(x,reference,size){return x>=reference&&x<reference+size},"_isOverAxis"),_isFloating:__name(function(item){return/left|right/.test(item.css("float"))||/inline|table-cell/.test(item.css("display"))},"_isFloating"),_create:__name(function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},"_create"),_setOption:__name(function(key,value){this._super(key,value),key==="handle"&&this._setHandleClassName()},"_setOption"),_setHandleClassName:__name(function(){var that=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),$2.each(this.items,function(){that._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},"_setHandleClassName"),_destroy:__name(function(){this._mouseDestroy();for(var i=this.items.length-1;i>=0;i--)this.items[i].item.removeData(this.widgetName+"-item");return this},"_destroy"),_mouseCapture:__name(function(event,overrideHandle){var currentItem=null,validHandle=!1,that=this;return this.reverting||this.options.disabled||this.options.type==="static"||(this._refreshItems(event),$2(event.target).parents().each(function(){if($2.data(this,that.widgetName+"-item")===that)return currentItem=$2(this),!1}),$2.data(event.target,that.widgetName+"-item")===that&&(currentItem=$2(event.target)),!currentItem)||this.options.handle&&!overrideHandle&&($2(this.options.handle,currentItem).find("*").addBack().each(function(){this===event.target&&(validHandle=!0)}),!validHandle)?!1:(this.currentItem=currentItem,this._removeCurrentsFromItems(),!0)},"_mouseCapture"),_mouseStart:__name(function(event,overrideHandle,noActivation){var i,body,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.appendTo=$2(o.appendTo!=="parent"?o.appendTo:this.currentItem.parent()),this.helper=this._createHelper(event),this._cacheHelperProportions(),this._cacheMargins(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},$2.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),this.scrollParent=this.placeholder.scrollParent(),$2.extend(this.offset,{parent:this._getParentOffset()}),o.containment&&this._setContainment(),o.cursor&&o.cursor!=="auto"&&(body=this.document.find("body"),this._storedStylesheet=$2("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(body)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),this.scrollParent[0]!==this.document[0]&&this.scrollParent[0].tagName!=="HTML"&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",event,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!noActivation)for(i=this.containers.length-1;i>=0;i--)this.containers[i]._trigger("activate",event,this._uiHash(this));return $2.ui.ddmanager&&($2.ui.ddmanager.current=this),$2.ui.ddmanager&&!o.dropBehaviour&&$2.ui.ddmanager.prepareOffsets(this,event),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this.helper.parent().is(this.appendTo)||(this.helper.detach().appendTo(this.appendTo),this.offset.parent=this._getParentOffset()),this.position=this.originalPosition=this._generatePosition(event),this.originalPageX=event.pageX,this.originalPageY=event.pageY,this.lastPositionAbs=this.positionAbs=this._convertPositionTo("absolute"),this._mouseDrag(event),!0},"_mouseStart"),_scroll:__name(function(event){var o=this.options,scrolled=!1;return this.scrollParent[0]!==this.document[0]&&this.scrollParent[0].tagName!=="HTML"?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-event.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop+o.scrollSpeed:event.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-event.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft+o.scrollSpeed:event.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(event.pageY-this.document.scrollTop()<o.scrollSensitivity?scrolled=this.document.scrollTop(this.document.scrollTop()-o.scrollSpeed):this.window.height()-(event.pageY-this.document.scrollTop())<o.scrollSensitivity&&(scrolled=this.document.scrollTop(this.document.scrollTop()+o.scrollSpeed)),event.pageX-this.document.scrollLeft()<o.scrollSensitivity?scrolled=this.document.scrollLeft(this.document.scrollLeft()-o.scrollSpeed):this.window.width()-(event.pageX-this.document.scrollLeft())<o.scrollSensitivity&&(scrolled=this.document.scrollLeft(this.document.scrollLeft()+o.scrollSpeed))),scrolled},"_scroll"),_mouseDrag:__name(function(event){var i,item,itemElement,intersection,o=this.options;for(this.position=this._generatePosition(event),this.positionAbs=this._convertPositionTo("absolute"),(!this.options.axis||this.options.axis!=="y")&&(this.helper[0].style.left=this.position.left+"px"),(!this.options.axis||this.options.axis!=="x")&&(this.helper[0].style.top=this.position.top+"px"),o.scroll&&this._scroll(event)!==!1&&(this._refreshItemPositions(!0),$2.ui.ddmanager&&!o.dropBehaviour&&$2.ui.ddmanager.prepareOffsets(this,event)),this.dragDirection={vertical:this._getDragVerticalDirection(),horizontal:this._getDragHorizontalDirection()},i=this.items.length-1;i>=0;i--)if(item=this.items[i],itemElement=item.item[0],intersection=this._intersectsWithPointer(item),!!intersection&&item.instance===this.currentContainer&&itemElement!==this.currentItem[0]&&this.placeholder[intersection===1?"next":"prev"]()[0]!==itemElement&&!$2.contains(this.placeholder[0],itemElement)&&(this.options.type!=="semi-dynamic"||!$2.contains(this.element[0],itemElement))){if(this.direction=intersection===1?"down":"up",this.options.tolerance==="pointer"||this._intersectsWithSides(item))this._rearrange(event,item);else break;this._trigger("change",event,this._uiHash());break}return this._contactContainers(event),$2.ui.ddmanager&&$2.ui.ddmanager.drag(this,event),this._trigger("sort",event,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},"_mouseDrag"),_mouseStop:__name(function(event,noPropagation){if(event){if($2.ui.ddmanager&&!this.options.dropBehaviour&&$2.ui.ddmanager.drop(this,event),this.options.revert){var that=this,cur=this.placeholder.offset(),axis=this.options.axis,animation={};(!axis||axis==="x")&&(animation.left=cur.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),(!axis||axis==="y")&&(animation.top=cur.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,$2(this.helper).animate(animation,parseInt(this.options.revert,10)||500,function(){that._clear(event)})}else this._clear(event,noPropagation);return!1}},"_mouseStop"),cancel:__name(function(){if(this.dragging){this._mouseUp(new $2.Event("mouseup",{target:null})),this.options.helper==="original"?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var i=this.containers.length-1;i>=0;i--)this.containers[i]._trigger("deactivate",null,this._uiHash(this)),this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",null,this._uiHash(this)),this.containers[i].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.options.helper!=="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),$2.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?$2(this.domPosition.prev).after(this.currentItem):$2(this.domPosition.parent).prepend(this.currentItem)),this},"cancel"),serialize:__name(function(o){var items=this._getItemsAsjQuery(o&&o.connected),str=[];return o=o||{},$2(items).each(function(){var res=($2(o.item||this).attr(o.attribute||"id")||"").match(o.expression||/(.+)[\-=_](.+)/);res&&str.push((o.key||res[1]+"[]")+"="+(o.key&&o.expression?res[1]:res[2]))}),!str.length&&o.key&&str.push(o.key+"="),str.join("&")},"serialize"),toArray:__name(function(o){var items=this._getItemsAsjQuery(o&&o.connected),ret=[];return o=o||{},items.each(function(){ret.push($2(o.item||this).attr(o.attribute||"id")||"")}),ret},"toArray"),_intersectsWith:__name(function(item){var x1=this.positionAbs.left,x2=x1+this.helperProportions.width,y1=this.positionAbs.top,y2=y1+this.helperProportions.height,l=item.left,r=l+item.width,t=item.top,b=t+item.height,dyClick=this.offset.click.top,dxClick=this.offset.click.left,isOverElementHeight=this.options.axis==="x"||y1+dyClick>t&&y1+dyClick<b,isOverElementWidth=this.options.axis==="y"||x1+dxClick>l&&x1+dxClick<r,isOverElement=isOverElementHeight&&isOverElementWidth;return this.options.tolerance==="pointer"||this.options.forcePointerForContainers||this.options.tolerance!=="pointer"&&this.helperProportions[this.floating?"width":"height"]>item[this.floating?"width":"height"]?isOverElement:l<x1+this.helperProportions.width/2&&x2-this.helperProportions.width/2<r&&t<y1+this.helperProportions.height/2&&y2-this.helperProportions.height/2<b},"_intersectsWith"),_intersectsWithPointer:__name(function(item){var verticalDirection,horizontalDirection,isOverElementHeight=this.options.axis==="x"||this._isOverAxis(this.positionAbs.top+this.offset.click.top,item.top,item.height),isOverElementWidth=this.options.axis==="y"||this._isOverAxis(this.positionAbs.left+this.offset.click.left,item.left,item.width),isOverElement=isOverElementHeight&&isOverElementWidth;return isOverElement?(verticalDirection=this.dragDirection.vertical,horizontalDirection=this.dragDirection.horizontal,this.floating?horizontalDirection==="right"||verticalDirection==="down"?2:1:verticalDirection&&(verticalDirection==="down"?2:1)):!1},"_intersectsWithPointer"),_intersectsWithSides:__name(function(item){var isOverBottomHalf=this._isOverAxis(this.positionAbs.top+this.offset.click.top,item.top+item.height/2,item.height),isOverRightHalf=this._isOverAxis(this.positionAbs.left+this.offset.click.left,item.left+item.width/2,item.width),verticalDirection=this.dragDirection.vertical,horizontalDirection=this.dragDirection.horizontal;return this.floating&&horizontalDirection?horizontalDirection==="right"&&isOverRightHalf||horizontalDirection==="left"&&!isOverRightHalf:verticalDirection&&(verticalDirection==="down"&&isOverBottomHalf||verticalDirection==="up"&&!isOverBottomHalf)},"_intersectsWithSides"),_getDragVerticalDirection:__name(function(){var delta=this.positionAbs.top-this.lastPositionAbs.top;return delta!==0&&(delta>0?"down":"up")},"_getDragVerticalDirection"),_getDragHorizontalDirection:__name(function(){var delta=this.positionAbs.left-this.lastPositionAbs.left;return delta!==0&&(delta>0?"right":"left")},"_getDragHorizontalDirection"),refresh:__name(function(event){return this._refreshItems(event),this._setHandleClassName(),this.refreshPositions(),this},"refresh"),_connectWith:__name(function(){var options=this.options;return options.connectWith.constructor===String?[options.connectWith]:options.connectWith},"_connectWith"),_getItemsAsjQuery:__name(function(connected){var i,j,cur,inst,items=[],queries=[],connectWith=this._connectWith();if(connectWith&&connected)for(i=connectWith.length-1;i>=0;i--)for(cur=$2(connectWith[i],this.document[0]),j=cur.length-1;j>=0;j--)inst=$2.data(cur[j],this.widgetFullName),inst&&inst!==this&&!inst.options.disabled&&queries.push([typeof inst.options.items=="function"?inst.options.items.call(inst.element):$2(inst.options.items,inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),inst]);queries.push([typeof this.options.items=="function"?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):$2(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);function addItems(){items.push(this)}for(__name(addItems,"addItems"),i=queries.length-1;i>=0;i--)queries[i][0].each(addItems);return $2(items)},"_getItemsAsjQuery"),_removeCurrentsFromItems:__name(function(){var list=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=$2.grep(this.items,function(item){for(var j=0;j<list.length;j++)if(list[j]===item.item[0])return!1;return!0})},"_removeCurrentsFromItems"),_refreshItems:__name(function(event){this.items=[],this.containers=[this];var i,j,cur,inst,targetData,_queries,item,queriesLength,items=this.items,queries=[[typeof this.options.items=="function"?this.options.items.call(this.element[0],event,{item:this.currentItem}):$2(this.options.items,this.element),this]],connectWith=this._connectWith();if(connectWith&&this.ready)for(i=connectWith.length-1;i>=0;i--)for(cur=$2(connectWith[i],this.document[0]),j=cur.length-1;j>=0;j--)inst=$2.data(cur[j],this.widgetFullName),inst&&inst!==this&&!inst.options.disabled&&(queries.push([typeof inst.options.items=="function"?inst.options.items.call(inst.element[0],event,{item:this.currentItem}):$2(inst.options.items,inst.element),inst]),this.containers.push(inst));for(i=queries.length-1;i>=0;i--)for(targetData=queries[i][1],_queries=queries[i][0],j=0,queriesLength=_queries.length;j<queriesLength;j++)item=$2(_queries[j]),item.data(this.widgetName+"-item",targetData),items.push({item,instance:targetData,width:0,height:0,left:0,top:0})},"_refreshItems"),_refreshItemPositions:__name(function(fast){var i,item,t,p;for(i=this.items.length-1;i>=0;i--)item=this.items[i],!(this.currentContainer&&item.instance!==this.currentContainer&&item.item[0]!==this.currentItem[0])&&(t=this.options.toleranceElement?$2(this.options.toleranceElement,item.item):item.item,fast||(item.width=t.outerWidth(),item.height=t.outerHeight()),p=t.offset(),item.left=p.left,item.top=p.top)},"_refreshItemPositions"),refreshPositions:__name(function(fast){this.floating=this.items.length?this.options.axis==="x"||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset()),this._refreshItemPositions(fast);var i,p;if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)p=this.containers[i].element.offset(),this.containers[i].containerCache.left=p.left,this.containers[i].containerCache.top=p.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},"refreshPositions"),_createPlaceholder:__name(function(that){that=that||this;var className,nodeName,o=that.options;(!o.placeholder||o.placeholder.constructor===String)&&(className=o.placeholder,nodeName=that.currentItem[0].nodeName.toLowerCase(),o.placeholder={element:__name(function(){var element=$2("<"+nodeName+">",that.document[0]);return that._addClass(element,"ui-sortable-placeholder",className||that.currentItem[0].className)._removeClass(element,"ui-sortable-helper"),nodeName==="tbody"?that._createTrPlaceholder(that.currentItem.find("tr").eq(0),$2("<tr>",that.document[0]).appendTo(element)):nodeName==="tr"?that._createTrPlaceholder(that.currentItem,element):nodeName==="img"&&element.attr("src",that.currentItem.attr("src")),className||element.css("visibility","hidden"),element},"element"),update:__name(function(container,p){className&&!o.forcePlaceholderSize||((!p.height()||o.forcePlaceholderSize&&(nodeName==="tbody"||nodeName==="tr"))&&p.height(that.currentItem.innerHeight()-parseInt(that.currentItem.css("paddingTop")||0,10)-parseInt(that.currentItem.css("paddingBottom")||0,10)),p.width()||p.width(that.currentItem.innerWidth()-parseInt(that.currentItem.css("paddingLeft")||0,10)-parseInt(that.currentItem.css("paddingRight")||0,10)))},"update")}),that.placeholder=$2(o.placeholder.element.call(that.element,that.currentItem)),that.currentItem.after(that.placeholder),o.placeholder.update(that,that.placeholder)},"_createPlaceholder"),_createTrPlaceholder:__name(function(sourceTr,targetTr){var that=this;sourceTr.children().each(function(){$2("<td>&#160;</td>",that.document[0]).attr("colspan",$2(this).attr("colspan")||1).appendTo(targetTr)})},"_createTrPlaceholder"),_contactContainers:__name(function(event){var i,j,dist,itemWithLeastDistance,posProperty,sizeProperty,cur,nearBottom,floating,axis,innermostContainer=null,innermostIndex=null;for(i=this.containers.length-1;i>=0;i--)if(!$2.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(innermostContainer&&$2.contains(this.containers[i].element[0],innermostContainer.element[0]))continue;innermostContainer=this.containers[i],innermostIndex=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",event,this._uiHash(this)),this.containers[i].containerCache.over=0);if(innermostContainer)if(this.containers.length===1)this.containers[innermostIndex].containerCache.over||(this.containers[innermostIndex]._trigger("over",event,this._uiHash(this)),this.containers[innermostIndex].containerCache.over=1);else{for(dist=1e4,itemWithLeastDistance=null,floating=innermostContainer.floating||this._isFloating(this.currentItem),posProperty=floating?"left":"top",sizeProperty=floating?"width":"height",axis=floating?"pageX":"pageY",j=this.items.length-1;j>=0;j--)$2.contains(this.containers[innermostIndex].element[0],this.items[j].item[0])&&this.items[j].item[0]!==this.currentItem[0]&&(cur=this.items[j].item.offset()[posProperty],nearBottom=!1,event[axis]-cur>this.items[j][sizeProperty]/2&&(nearBottom=!0),Math.abs(event[axis]-cur)<dist&&(dist=Math.abs(event[axis]-cur),itemWithLeastDistance=this.items[j],this.direction=nearBottom?"up":"down"));if(!itemWithLeastDistance&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[innermostIndex]){this.currentContainer.containerCache.over||(this.containers[innermostIndex]._trigger("over",event,this._uiHash()),this.currentContainer.containerCache.over=1);return}itemWithLeastDistance?this._rearrange(event,itemWithLeastDistance,null,!0):this._rearrange(event,null,this.containers[innermostIndex].element,!0),this._trigger("change",event,this._uiHash()),this.containers[innermostIndex]._trigger("change",event,this._uiHash(this)),this.currentContainer=this.containers[innermostIndex],this.options.placeholder.update(this.currentContainer,this.placeholder),this.scrollParent=this.placeholder.scrollParent(),this.scrollParent[0]!==this.document[0]&&this.scrollParent[0].tagName!=="HTML"&&(this.overflowOffset=this.scrollParent.offset()),this.containers[innermostIndex]._trigger("over",event,this._uiHash(this)),this.containers[innermostIndex].containerCache.over=1}},"_contactContainers"),_createHelper:__name(function(event){var o=this.options,helper=typeof o.helper=="function"?$2(o.helper.apply(this.element[0],[event,this.currentItem])):o.helper==="clone"?this.currentItem.clone():this.currentItem;return helper.parents("body").length||this.appendTo[0].appendChild(helper[0]),helper[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!helper[0].style.width||o.forceHelperSize)&&helper.width(this.currentItem.width()),(!helper[0].style.height||o.forceHelperSize)&&helper.height(this.currentItem.height()),helper},"_createHelper"),_adjustOffsetFromHelper:__name(function(obj){typeof obj=="string"&&(obj=obj.split(" ")),Array.isArray(obj)&&(obj={left:+obj[0],top:+obj[1]||0}),"left"in obj&&(this.offset.click.left=obj.left+this.margins.left),"right"in obj&&(this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left),"top"in obj&&(this.offset.click.top=obj.top+this.margins.top),"bottom"in obj&&(this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top)},"_adjustOffsetFromHelper"),_getParentOffset:__name(function(){this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();return this.cssPosition==="absolute"&&this.scrollParent[0]!==this.document[0]&&$2.contains(this.scrollParent[0],this.offsetParent[0])&&(po.left+=this.scrollParent.scrollLeft(),po.top+=this.scrollParent.scrollTop()),this.offsetParent[0]===this.document[0].body&&(po={top:0,left:0}),{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},"_getParentOffset"),_getRelativeOffset:__name(function(){if(this.cssPosition==="relative"){var p=this.currentItem.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},"_getRelativeOffset"),_cacheMargins:__name(function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},"_cacheMargins"),_cacheHelperProportions:__name(function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},"_cacheHelperProportions"),_setContainment:__name(function(){var ce,co,over,o=this.options;o.containment==="parent"&&(o.containment=this.helper[0].parentNode),(o.containment==="document"||o.containment==="window")&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,o.containment==="document"?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,(o.containment==="document"?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(o.containment)||(ce=$2(o.containment)[0],co=$2(o.containment).offset(),over=$2(ce).css("overflow")!=="hidden",this.containment=[co.left+(parseInt($2(ce).css("borderLeftWidth"),10)||0)+(parseInt($2(ce).css("paddingLeft"),10)||0)-this.margins.left,co.top+(parseInt($2(ce).css("borderTopWidth"),10)||0)+(parseInt($2(ce).css("paddingTop"),10)||0)-this.margins.top,co.left+(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt($2(ce).css("borderLeftWidth"),10)||0)-(parseInt($2(ce).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,co.top+(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt($2(ce).css("borderTopWidth"),10)||0)-(parseInt($2(ce).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},"_setContainment"),_convertPositionTo:__name(function(d,pos){pos||(pos=this.position);var mod=d==="absolute"?1:-1,scroll=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==this.document[0]&&$2.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=/(html|body)/i.test(scroll[0].tagName);return{top:pos.top+this.offset.relative.top*mod+this.offset.parent.top*mod-(this.cssPosition==="fixed"?-this.scrollParent.scrollTop():scrollIsRootNode?0:scroll.scrollTop())*mod,left:pos.left+this.offset.relative.left*mod+this.offset.parent.left*mod-(this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())*mod}},"_convertPositionTo"),_generatePosition:__name(function(event){var top,left,o=this.options,pageX=event.pageX,pageY=event.pageY,scroll=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==this.document[0]&&$2.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=/(html|body)/i.test(scroll[0].tagName);return this.cssPosition==="relative"&&!(this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0])&&(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(event.pageX-this.offset.click.left<this.containment[0]&&(pageX=this.containment[0]+this.offset.click.left),event.pageY-this.offset.click.top<this.containment[1]&&(pageY=this.containment[1]+this.offset.click.top),event.pageX-this.offset.click.left>this.containment[2]&&(pageX=this.containment[2]+this.offset.click.left),event.pageY-this.offset.click.top>this.containment[3]&&(pageY=this.containment[3]+this.offset.click.top)),o.grid&&(top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1],pageY=this.containment?top-this.offset.click.top>=this.containment[1]&&top-this.offset.click.top<=this.containment[3]?top:top-this.offset.click.top>=this.containment[1]?top-o.grid[1]:top+o.grid[1]:top,left=this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0],pageX=this.containment?left-this.offset.click.left>=this.containment[0]&&left-this.offset.click.left<=this.containment[2]?left:left-this.offset.click.left>=this.containment[0]?left-o.grid[0]:left+o.grid[0]:left)),{top:pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition==="fixed"?-this.scrollParent.scrollTop():scrollIsRootNode?0:scroll.scrollTop()),left:pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())}},"_generatePosition"),_rearrange:__name(function(event,i,a,hardRefresh){a?a[0].appendChild(this.placeholder[0]):i.item[0].parentNode.insertBefore(this.placeholder[0],this.direction==="down"?i.item[0]:i.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var counter=this.counter;this._delay(function(){counter===this.counter&&this.refreshPositions(!hardRefresh)})},"_rearrange"),_clear:__name(function(event,noPropagation){this.reverting=!1;var i,delayedTriggers=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)(this._storedCSS[i]==="auto"||this._storedCSS[i]==="static")&&(this._storedCSS[i]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!noPropagation&&delayedTriggers.push(function(event2){this._trigger("receive",event2,this._uiHash(this.fromOutside))}),(this.fromOutside||this.domPosition.prev!==this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!==this.currentItem.parent()[0])&&!noPropagation&&delayedTriggers.push(function(event2){this._trigger("update",event2,this._uiHash())}),this!==this.currentContainer&&(noPropagation||(delayedTriggers.push(function(event2){this._trigger("remove",event2,this._uiHash())}),delayedTriggers.push((function(c){return function(event2){c._trigger("receive",event2,this._uiHash(this))}}).call(this,this.currentContainer)),delayedTriggers.push((function(c){return function(event2){c._trigger("update",event2,this._uiHash(this))}}).call(this,this.currentContainer))));function delayEvent(type,instance,container){return function(event2){container._trigger(type,event2,instance._uiHash(instance))}}for(__name(delayEvent,"delayEvent"),i=this.containers.length-1;i>=0;i--)noPropagation||delayedTriggers.push(delayEvent("deactivate",this,this.containers[i])),this.containers[i].containerCache.over&&(delayedTriggers.push(delayEvent("out",this,this.containers[i])),this.containers[i].containerCache.over=0);if(this._storedStylesheet&&(this._storedStylesheet.remove(),this._storedStylesheet=null),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex",this._storedZIndex==="auto"?"":this._storedZIndex),this.dragging=!1,noPropagation||this._trigger("beforeStop",event,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!noPropagation){for(i=0;i<delayedTriggers.length;i++)delayedTriggers[i].call(this,event);this._trigger("stop",event,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},"_clear"),_trigger:__name(function(){$2.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},"_trigger"),_uiHash:__name(function(_inst){var inst=_inst||this;return{helper:inst.helper,placeholder:inst.placeholder||$2([]),position:inst.position,originalPosition:inst.originalPosition,offset:inst.positionAbs,item:inst.currentItem,sender:_inst?_inst.element:null}},"_uiHash")});function spinnerModifier(fn){return function(){var previous=this.element.val();fn.apply(this,arguments),this._refresh(),previous!==this.element.val()&&this._trigger("change")}}__name(spinnerModifier,"spinnerModifier"),$2.widget("ui.spinner",{version:"1.14.1",defaultElement:"<input>",widgetEventPrefix:"spin",options:{classes:{"ui-spinner":"ui-corner-all","ui-spinner-down":"ui-corner-br","ui-spinner-up":"ui-corner-tr"},culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:__name(function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),this.value()!==""&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:__name(function(){this.element.removeAttr("autocomplete")},"beforeunload")})},"_create"),_getCreateOptions:__name(function(){var options=this._super(),element=this.element;return $2.each(["min","max","step"],function(i,option){var value=element.attr(option);value!=null&&value.length&&(options[option]=value)}),options},"_getCreateOptions"),_events:{keydown:__name(function(event){this._start(event)&&this._keydown(event)&&event.preventDefault()},"keydown"),keyup:"_stop",focus:__name(function(){this.previous=this.element.val()},"focus"),blur:__name(function(event){this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",event)},"blur"),mousewheel:__name(function(event,delta){var activeElement=this.document[0].activeElement,isActive=this.element[0]===activeElement;if(!(!isActive||!delta)){if(!this.spinning&&!this._start(event))return!1;this._spin((delta>0?1:-1)*this.options.step,event),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(event)},100),event.preventDefault()}},"mousewheel"),"mousedown .ui-spinner-button":__name(function(event){var previous;previous=this.element[0]===this.document[0].activeElement?this.previous:this.element.val();function checkFocus(){var isActive=this.element[0]===this.document[0].activeElement;isActive||(this.element.trigger("focus"),this.previous=previous)}__name(checkFocus,"checkFocus"),event.preventDefault(),checkFocus.call(this),this._start(event)!==!1&&this._repeat(null,$2(event.currentTarget).hasClass("ui-spinner-up")?1:-1,event)},"mousedown .ui-spinner-button"),"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":__name(function(event){if($2(event.currentTarget).hasClass("ui-state-active")){if(this._start(event)===!1)return!1;this._repeat(null,$2(event.currentTarget).hasClass("ui-spinner-up")?1:-1,event)}},"mouseenter .ui-spinner-button"),"mouseleave .ui-spinner-button":"_stop"},_enhance:__name(function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap("<span>").parent().append("<a></a><a></a>")},"_enhance"),_draw:__name(function(){this._enhance(),this._addClass(this.uiSpinner,"ui-spinner","ui-widget ui-widget-content"),this._addClass("ui-spinner-input"),this.element.attr("role","spinbutton"),this.buttons=this.uiSpinner.children("a").attr("tabIndex",-1).attr("aria-hidden",!0).button({classes:{"ui-button":""}}),this._removeClass(this.buttons,"ui-corner-all"),this._addClass(this.buttons.first(),"ui-spinner-button ui-spinner-up"),this._addClass(this.buttons.last(),"ui-spinner-button ui-spinner-down"),this.buttons.first().button({icon:this.options.icons.up,showLabel:!1}),this.buttons.last().button({icon:this.options.icons.down,showLabel:!1}),this.buttons.height()>Math.ceil(this.uiSpinner.height()*.5)&&this.uiSpinner.height()>0&&this.uiSpinner.height(this.uiSpinner.height())},"_draw"),_keydown:__name(function(event){var options=this.options,keyCode=$2.ui.keyCode;switch(event.keyCode){case keyCode.UP:return this._repeat(null,1,event),!0;case keyCode.DOWN:return this._repeat(null,-1,event),!0;case keyCode.PAGE_UP:return this._repeat(null,options.page,event),!0;case keyCode.PAGE_DOWN:return this._repeat(null,-options.page,event),!0}return!1},"_keydown"),_start:__name(function(event){return!this.spinning&&this._trigger("start",event)===!1?!1:(this.counter||(this.counter=1),this.spinning=!0,!0)},"_start"),_repeat:__name(function(i,steps,event){i=i||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,steps,event)},i),this._spin(steps*this.options.step,event)},"_repeat"),_spin:__name(function(step,event){var value=this.value()||0;this.counter||(this.counter=1),value=this._adjustValue(value+step*this._increment(this.counter)),(!this.spinning||this._trigger("spin",event,{value})!==!1)&&(this._value(value),this.counter++)},"_spin"),_increment:__name(function(i){var incremental=this.options.incremental;return incremental?typeof incremental=="function"?incremental(i):Math.floor(i*i*i/5e4-i*i/500+17*i/200+1):1},"_increment"),_precision:__name(function(){var precision=this._precisionOf(this.options.step);return this.options.min!==null&&(precision=Math.max(precision,this._precisionOf(this.options.min))),precision},"_precision"),_precisionOf:__name(function(num){var str=num.toString(),decimal=str.indexOf(".");return decimal===-1?0:str.length-decimal-1},"_precisionOf"),_adjustValue:__name(function(value){var base,aboveMin,options=this.options;return base=options.min!==null?options.min:0,aboveMin=value-base,aboveMin=Math.round(aboveMin/options.step)*options.step,value=base+aboveMin,value=parseFloat(value.toFixed(this._precision())),options.max!==null&&value>options.max?options.max:options.min!==null&&value<options.min?options.min:value},"_adjustValue"),_stop:__name(function(event){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",event))},"_stop"),_setOption:__name(function(key,value){var prevValue,first,last;if(key==="culture"||key==="numberFormat"){prevValue=this._parse(this.element.val()),this.options[key]=value,this.element.val(this._format(prevValue));return}(key==="max"||key==="min"||key==="step")&&typeof value=="string"&&(value=this._parse(value)),key==="icons"&&(first=this.buttons.first().find(".ui-icon"),this._removeClass(first,null,this.options.icons.up),this._addClass(first,null,value.up),last=this.buttons.last().find(".ui-icon"),this._removeClass(last,null,this.options.icons.down),this._addClass(last,null,value.down)),this._super(key,value)},"_setOption"),_setOptionDisabled:__name(function(value){this._super(value),this._toggleClass(this.uiSpinner,null,"ui-state-disabled",!!value),this.element.prop("disabled",!!value),this.buttons.button(value?"disable":"enable")},"_setOptionDisabled"),_setOptions:spinnerModifier(function(options){this._super(options)}),_parse:__name(function(val){return typeof val=="string"&&val!==""&&(val=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(val,10,this.options.culture):+val),val===""||isNaN(val)?null:val},"_parse"),_format:__name(function(value){return value===""?"":window.Globalize&&this.options.numberFormat?Globalize.format(value,this.options.numberFormat,this.options.culture):value},"_format"),_refresh:__name(function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},"_refresh"),isValid:__name(function(){var value=this.value();return value===null?!1:value===this._adjustValue(value)},"isValid"),_value:__name(function(value,allowAny){var parsed;value!==""&&(parsed=this._parse(value),parsed!==null&&(allowAny||(parsed=this._adjustValue(parsed)),value=this._format(parsed))),this.element.val(value),this._refresh()},"_value"),_destroy:__name(function(){this.element.prop("disabled",!1).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"),this.uiSpinner.replaceWith(this.element)},"_destroy"),stepUp:spinnerModifier(function(steps){this._stepUp(steps)}),_stepUp:__name(function(steps){this._start()&&(this._spin((steps||1)*this.options.step),this._stop())},"_stepUp"),stepDown:spinnerModifier(function(steps){this._stepDown(steps)}),_stepDown:__name(function(steps){this._start()&&(this._spin((steps||1)*-this.options.step),this._stop())},"_stepDown"),pageUp:spinnerModifier(function(pages){this._stepUp((pages||1)*this.options.page)}),pageDown:spinnerModifier(function(pages){this._stepDown((pages||1)*this.options.page)}),value:__name(function(newVal){if(!arguments.length)return this._parse(this.element.val());spinnerModifier(this._value).call(this,newVal)},"value"),widget:__name(function(){return this.uiSpinner},"widget")}),$2.uiBackCompat===!0&&$2.widget("ui.spinner",$2.ui.spinner,{_enhance:__name(function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml())},"_enhance"),_uiSpinnerHtml:__name(function(){return"<span>"},"_uiSpinnerHtml"),_buttonHtml:__name(function(){return"<a></a><a></a>"},"_buttonHtml")}),$2.ui.spinner;$2.widget("ui.tabs",{version:"1.14.1",delay:300,options:{active:null,classes:{"ui-tabs":"ui-corner-all","ui-tabs-nav":"ui-corner-all","ui-tabs-panel":"ui-corner-bottom","ui-tabs-tab":"ui-corner-top"},collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:(function(){var rhash=/#.*$/;return function(anchor){var anchorUrl,locationUrl;anchorUrl=anchor.href.replace(rhash,""),locationUrl=location.href.replace(rhash,"");try{anchorUrl=decodeURIComponent(anchorUrl)}catch{}try{locationUrl=decodeURIComponent(locationUrl)}catch{}return anchor.hash.length>1&&anchorUrl===locationUrl}})(),_create:__name(function(){var that=this,options=this.options;this.running=!1,this._addClass("ui-tabs","ui-widget ui-widget-content"),this._toggleClass("ui-tabs-collapsible",null,options.collapsible),this._processTabs(),options.active=this._initialActive(),Array.isArray(options.disabled)&&(options.disabled=$2.uniqueSort(options.disabled.concat($2.map(this.tabs.filter(".ui-state-disabled"),function(li){return that.tabs.index(li)}))).sort()),this.options.active!==!1&&this.anchors.length?this.active=this._findActive(options.active):this.active=$2(),this._refresh(),this.active.length&&this.load(options.active)},"_create"),_initialActive:__name(function(){var active=this.options.active,collapsible=this.options.collapsible,locationHashDecoded=decodeURIComponent(location.hash.substring(1));return active===null&&(locationHashDecoded&&this.tabs.each(function(i,tab){if($2(tab).attr("aria-controls")===locationHashDecoded)return active=i,!1}),active===null&&(active=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(active===null||active===-1)&&(active=this.tabs.length?0:!1)),active!==!1&&(active=this.tabs.index(this.tabs.eq(active)),active===-1&&(active=collapsible?!1:0)),!collapsible&&active===!1&&this.anchors.length&&(active=0),active},"_initialActive"),_getCreateEventData:__name(function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):$2()}},"_getCreateEventData"),_tabKeydown:__name(function(event){var focusedTab=$2(this.document[0].activeElement).closest("li"),selectedIndex=this.tabs.index(focusedTab),goingForward=!0;if(!this._handlePageNav(event)){switch(event.keyCode){case $2.ui.keyCode.RIGHT:case $2.ui.keyCode.DOWN:selectedIndex++;break;case $2.ui.keyCode.UP:case $2.ui.keyCode.LEFT:goingForward=!1,selectedIndex--;break;case $2.ui.keyCode.END:selectedIndex=this.anchors.length-1;break;case $2.ui.keyCode.HOME:selectedIndex=0;break;case $2.ui.keyCode.SPACE:event.preventDefault(),clearTimeout(this.activating),this._activate(selectedIndex);return;case $2.ui.keyCode.ENTER:event.preventDefault(),clearTimeout(this.activating),this._activate(selectedIndex===this.options.active?!1:selectedIndex);return;default:return}event.preventDefault(),clearTimeout(this.activating),selectedIndex=this._focusNextTab(selectedIndex,goingForward),!event.ctrlKey&&!event.metaKey&&(focusedTab.attr("aria-selected","false"),this.tabs.eq(selectedIndex).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",selectedIndex)},this.delay))}},"_tabKeydown"),_panelKeydown:__name(function(event){this._handlePageNav(event)||event.ctrlKey&&event.keyCode===$2.ui.keyCode.UP&&(event.preventDefault(),this.active.trigger("focus"))},"_panelKeydown"),_handlePageNav:__name(function(event){if(event.altKey&&event.keyCode===$2.ui.keyCode.PAGE_UP)return this._activate(this._focusNextTab(this.options.active-1,!1)),!0;if(event.altKey&&event.keyCode===$2.ui.keyCode.PAGE_DOWN)return this._activate(this._focusNextTab(this.options.active+1,!0)),!0},"_handlePageNav"),_findNextTab:__name(function(index,goingForward){var lastTabIndex=this.tabs.length-1;function constrain(){return index>lastTabIndex&&(index=0),index<0&&(index=lastTabIndex),index}for(__name(constrain,"constrain");$2.inArray(constrain(),this.options.disabled)!==-1;)index=goingForward?index+1:index-1;return index},"_findNextTab"),_focusNextTab:__name(function(index,goingForward){return index=this._findNextTab(index,goingForward),this.tabs.eq(index).trigger("focus"),index},"_focusNextTab"),_setOption:__name(function(key,value){if(key==="active"){this._activate(value);return}this._super(key,value),key==="collapsible"&&(this._toggleClass("ui-tabs-collapsible",null,value),!value&&this.options.active===!1&&this._activate(0)),key==="event"&&this._setupEvents(value),key==="heightStyle"&&this._setupHeightStyle(value)},"_setOption"),refresh:__name(function(){var options=this.options,lis=this.tablist.children(":has(a[href])");options.disabled=$2.map(lis.filter(".ui-state-disabled"),function(tab){return lis.index(tab)}),this._processTabs(),options.active===!1||!this.anchors.length?(options.active=!1,this.active=$2()):this.active.length&&!$2.contains(this.tablist[0],this.active[0])?this.tabs.length===options.disabled.length?(options.active=!1,this.active=$2()):this._activate(this._findNextTab(Math.max(0,options.active-1),!1)):options.active=this.tabs.index(this.active),this._refresh()},"refresh"),_refresh:__name(function(){this._setOptionDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._addClass(this.active,"ui-tabs-active","ui-state-active"),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},"_refresh"),_processTabs:__name(function(){var that=this,prevTabs=this.tabs,prevAnchors=this.anchors,prevPanels=this.panels;this.tablist=this._getList().attr("role","tablist"),this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header"),this.tablist.on("mousedown"+this.eventNamespace,"> li",function(event){$2(this).is(".ui-state-disabled")&&event.preventDefault()}),this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1}),this._addClass(this.tabs,"ui-tabs-tab","ui-state-default"),this.anchors=this.tabs.map(function(){return $2("a",this)[0]}).attr({tabIndex:-1}),this._addClass(this.anchors,"ui-tabs-anchor"),this.panels=$2(),this.anchors.each(function(i,anchor){var selector,panel,panelId,anchorId=$2(anchor).uniqueId().attr("id"),tab=$2(anchor).closest("li"),originalAriaControls=tab.attr("aria-controls");that._isLocal(anchor)?(selector=decodeURIComponent(anchor.hash),panelId=selector.substring(1),panel=that.element.find("#"+CSS.escape(panelId))):(panelId=tab.attr("aria-controls")||$2({}).uniqueId()[0].id,selector="#"+panelId,panel=that.element.find(selector),panel.length||(panel=that._createPanel(panelId),panel.insertAfter(that.panels[i-1]||that.tablist)),panel.attr("aria-live","polite")),panel.length&&(that.panels=that.panels.add(panel)),originalAriaControls&&tab.data("ui-tabs-aria-controls",originalAriaControls),tab.attr({"aria-controls":panelId,"aria-labelledby":anchorId}),panel.attr("aria-labelledby",anchorId)}),this.panels.attr("role","tabpanel"),this._addClass(this.panels,"ui-tabs-panel","ui-widget-content"),prevTabs&&(this._off(prevTabs.not(this.tabs)),this._off(prevAnchors.not(this.anchors)),this._off(prevPanels.not(this.panels)))},"_processTabs"),_getList:__name(function(){return this.tablist||this.element.find("ol, ul").eq(0)},"_getList"),_createPanel:__name(function(id){return $2("<div>").attr("id",id).data("ui-tabs-destroy",!0)},"_createPanel"),_setOptionDisabled:__name(function(disabled){var currentItem,li,i;for(Array.isArray(disabled)&&(disabled.length?disabled.length===this.anchors.length&&(disabled=!0):disabled=!1),i=0;li=this.tabs[i];i++)currentItem=$2(li),disabled===!0||$2.inArray(i,disabled)!==-1?(currentItem.attr("aria-disabled","true"),this._addClass(currentItem,null,"ui-state-disabled")):(currentItem.removeAttr("aria-disabled"),this._removeClass(currentItem,null,"ui-state-disabled"));this.options.disabled=disabled,this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,disabled===!0)},"_setOptionDisabled"),_setupEvents:__name(function(event){var events={};event&&$2.each(event.split(" "),function(index,eventName){events[eventName]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:__name(function(event2){event2.preventDefault()},"click")}),this._on(this.anchors,events),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},"_setupEvents"),_setupHeightStyle:__name(function(heightStyle){var maxHeight,parent2=this.element.parent();heightStyle==="fill"?(maxHeight=parent2.height(),maxHeight-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var elem=$2(this),position=elem.css("position");position==="absolute"||position==="fixed"||(maxHeight-=elem.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){maxHeight-=$2(this).outerHeight(!0)}),this.panels.each(function(){$2(this).height(Math.max(0,maxHeight-$2(this).innerHeight()+$2(this).height()))}).css("overflow","auto")):heightStyle==="auto"&&(maxHeight=0,this.panels.each(function(){maxHeight=Math.max(maxHeight,$2(this).height("").height())}).height(maxHeight))},"_setupHeightStyle"),_eventHandler:__name(function(event){var options=this.options,active=this.active,anchor=$2(event.currentTarget),tab=anchor.closest("li"),clickedIsActive=tab[0]===active[0],collapsing=clickedIsActive&&options.collapsible,toShow=collapsing?$2():this._getPanelForTab(tab),toHide=active.length?this._getPanelForTab(active):$2(),eventData={oldTab:active,oldPanel:toHide,newTab:collapsing?$2():tab,newPanel:toShow};event.preventDefault(),!(tab.hasClass("ui-state-disabled")||tab.hasClass("ui-tabs-loading")||this.running||clickedIsActive&&!options.collapsible||this._trigger("beforeActivate",event,eventData)===!1)&&(options.active=collapsing?!1:this.tabs.index(tab),this.active=clickedIsActive?$2():tab,this.xhr&&this.xhr.abort(),!toHide.length&&!toShow.length&&$2.error("jQuery UI Tabs: Mismatching fragment identifier."),toShow.length&&this.load(this.tabs.index(tab),event),this._toggle(event,eventData))},"_eventHandler"),_toggle:__name(function(event,eventData){var that=this,toShow=eventData.newPanel,toHide=eventData.oldPanel;this.running=!0;function complete(){that.running=!1,that._trigger("activate",event,eventData)}__name(complete,"complete");function show(){that._addClass(eventData.newTab.closest("li"),"ui-tabs-active","ui-state-active"),toShow.length&&that.options.show?that._show(toShow,that.options.show,complete):(toShow.show(),complete())}__name(show,"show"),toHide.length&&this.options.hide?this._hide(toHide,this.options.hide,function(){that._removeClass(eventData.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),show()}):(this._removeClass(eventData.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),toHide.hide(),show()),toHide.attr("aria-hidden","true"),eventData.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),toShow.length&&toHide.length?eventData.oldTab.attr("tabIndex",-1):toShow.length&&this.tabs.filter(function(){return $2(this).attr("tabIndex")===0}).attr("tabIndex",-1),toShow.attr("aria-hidden","false"),eventData.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},"_toggle"),_activate:__name(function(index){var anchor,active=this._findActive(index);active[0]!==this.active[0]&&(active.length||(active=this.active),anchor=active.find(".ui-tabs-anchor")[0],this._eventHandler({target:anchor,currentTarget:anchor,preventDefault:$2.noop}))},"_activate"),_findActive:__name(function(index){return index===!1?$2():this.tabs.eq(index)},"_findActive"),_getIndex:__name(function(index){return typeof index=="string"&&(index=this.anchors.index(this.anchors.filter("[href$='"+CSS.escape(index)+"']"))),index},"_getIndex"),_destroy:__name(function(){this.xhr&&this.xhr.abort(),this.tablist.removeAttr("role").off(this.eventNamespace),this.anchors.removeAttr("role tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){$2.data(this,"ui-tabs-destroy")?$2(this).remove():$2(this).removeAttr("role tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")}),this.tabs.each(function(){var li=$2(this),prev=li.data("ui-tabs-aria-controls");prev?li.attr("aria-controls",prev).removeData("ui-tabs-aria-controls"):li.removeAttr("aria-controls")}),this.panels.show(),this.options.heightStyle!=="content"&&this.panels.css("height","")},"_destroy"),enable:__name(function(index){var disabled=this.options.disabled;disabled!==!1&&(index===void 0?disabled=!1:(index=this._getIndex(index),Array.isArray(disabled)?disabled=$2.map(disabled,function(num){return num!==index?num:null}):disabled=$2.map(this.tabs,function(li,num){return num!==index?num:null})),this._setOptionDisabled(disabled))},"enable"),disable:__name(function(index){var disabled=this.options.disabled;if(disabled!==!0){if(index===void 0)disabled=!0;else{if(index=this._getIndex(index),$2.inArray(index,disabled)!==-1)return;Array.isArray(disabled)?disabled=$2.merge([index],disabled).sort():disabled=[index]}this._setOptionDisabled(disabled)}},"disable"),load:__name(function(index,event){index=this._getIndex(index);var that=this,tab=this.tabs.eq(index),anchor=tab.find(".ui-tabs-anchor"),panel=this._getPanelForTab(tab),eventData={tab,panel},complete=__name(function(jqXHR,status){status==="abort"&&that.panels.stop(!1,!0),that._removeClass(tab,"ui-tabs-loading"),panel.removeAttr("aria-busy"),jqXHR===that.xhr&&delete that.xhr},"complete");this._isLocal(anchor[0])||(this.xhr=$2.ajax(this._ajaxSettings(anchor,event,eventData)),this.xhr.statusText!=="canceled"&&(this._addClass(tab,"ui-tabs-loading"),panel.attr("aria-busy","true"),this.xhr.done(function(response,status,jqXHR){panel.html(response),that._trigger("load",event,eventData),complete(jqXHR,status)}).fail(function(jqXHR,status){complete(jqXHR,status)})))},"load"),_ajaxSettings:__name(function(anchor,event,eventData){var that=this;return{url:anchor.attr("href"),beforeSend:__name(function(jqXHR,settings){return that._trigger("beforeLoad",event,$2.extend({jqXHR,ajaxSettings:settings},eventData))},"beforeSend")}},"_ajaxSettings"),_getPanelForTab:__name(function(tab){var id=$2(tab).attr("aria-controls");return this.element.find("#"+CSS.escape(id))},"_getPanelForTab")}),$2.uiBackCompat===!0&&$2.widget("ui.tabs",$2.ui.tabs,{_processTabs:__name(function(){this._superApply(arguments),this._addClass(this.tabs,"ui-tab")},"_processTabs")}),$2.ui.tabs;$2.widget("ui.tooltip",{version:"1.14.1",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:__name(function(){var title=$2(this).attr("title");return $2("<a>").text(title).html()},"content"),hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,track:!1,close:null,open:null},_addDescribedBy:__name(function(elem,id){var describedby=(elem.attr("aria-describedby")||"").split(/\s+/);describedby.push(id),elem.data("ui-tooltip-id",id).attr("aria-describedby",String.prototype.trim.call(describedby.join(" ")))},"_addDescribedBy"),_removeDescribedBy:__name(function(elem){var id=elem.data("ui-tooltip-id"),describedby=(elem.attr("aria-describedby")||"").split(/\s+/),index=$2.inArray(id,describedby);index!==-1&&describedby.splice(index,1),elem.removeData("ui-tooltip-id"),describedby=String.prototype.trim.call(describedby.join(" ")),describedby?elem.attr("aria-describedby",describedby):elem.removeAttr("aria-describedby")},"_removeDescribedBy"),_create:__name(function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.liveRegion=$2("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this.disabledTitles=$2([])},"_create"),_setOption:__name(function(key,value){var that=this;this._super(key,value),key==="content"&&$2.each(this.tooltips,function(id,tooltipData){that._updateContent(tooltipData.element)})},"_setOption"),_setOptionDisabled:__name(function(value){this[value?"_disable":"_enable"]()},"_setOptionDisabled"),_disable:__name(function(){var that=this;$2.each(this.tooltips,function(id,tooltipData){var event=$2.Event("blur");event.target=event.currentTarget=tooltipData.element[0],that.close(event,!0)}),this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var element=$2(this);if(element.is("[title]"))return element.data("ui-tooltip-title",element.attr("title")).removeAttr("title")}))},"_disable"),_enable:__name(function(){this.disabledTitles.each(function(){var element=$2(this);element.data("ui-tooltip-title")&&element.attr("title",element.data("ui-tooltip-title"))}),this.disabledTitles=$2([])},"_enable"),open:__name(function(event){var that=this,target=$2(event?event.target:this.element).closest(this.options.items);!target.length||target.data("ui-tooltip-id")||(target.attr("title")&&target.data("ui-tooltip-title",target.attr("title")),target.data("ui-tooltip-open",!0),event&&event.type==="mouseover"&&target.parents().each(function(){var parent2=$2(this),blurEvent;parent2.data("ui-tooltip-open")&&(blurEvent=$2.Event("blur"),blurEvent.target=blurEvent.currentTarget=this,that.close(blurEvent,!0)),parent2.attr("title")&&(parent2.uniqueId(),that.parents[this.id]={element:this,title:parent2.attr("title")},parent2.attr("title",""))}),this._registerCloseHandlers(event,target),this._updateContent(target,event))},"open"),_updateContent:__name(function(target,event){var content,contentOption=this.options.content,that=this,eventType=event?event.type:null;if(typeof contentOption=="string"||contentOption.nodeType||contentOption.jquery)return this._open(event,target,contentOption);content=contentOption.call(target[0],function(response){target.data("ui-tooltip-open")&&(event&&(event.type=eventType),that._open(event,target,response))}),content&&this._open(event,target,content)},"_updateContent"),_open:__name(function(event,target,content){var tooltipData,tooltip,delayedShow,a11yContent,positionOption=$2.extend({},this.options.position);if(!content)return;if(tooltipData=this._find(target),tooltipData){tooltipData.tooltip.find(".ui-tooltip-content").html(content);return}target.is("[title]")&&(event&&event.type==="mouseover"?target.attr("title",""):target.removeAttr("title")),tooltipData=this._tooltip(target),tooltip=tooltipData.tooltip,this._addDescribedBy(target,tooltip.attr("id")),tooltip.find(".ui-tooltip-content").html(content),this.liveRegion.children().hide(),a11yContent=$2("<div>").html(tooltip.find(".ui-tooltip-content").html()),a11yContent.removeAttr("name").find("[name]").removeAttr("name"),a11yContent.removeAttr("id").find("[id]").removeAttr("id"),a11yContent.appendTo(this.liveRegion);function position(event2){positionOption.of=event2,!tooltip.is(":hidden")&&tooltip.position(positionOption)}__name(position,"position"),this.options.track&&event&&/^mouse/.test(event.type)?(this._on(this.document,{mousemove:position}),position(event)):tooltip.position($2.extend({of:target},this.options.position)),tooltip.hide(),this._show(tooltip,this.options.show),this.options.track&&this.options.show&&this.options.show.delay&&(delayedShow=this.delayedShow=setInterval(function(){tooltip.is(":visible")&&(position(positionOption.of),clearInterval(delayedShow))},13)),this._trigger("open",event,{tooltip})},"_open"),_registerCloseHandlers:__name(function(event,target){var events={keyup:__name(function(event2){if(event2.keyCode===$2.ui.keyCode.ESCAPE){var fakeEvent=$2.Event(event2);fakeEvent.currentTarget=target[0],this.close(fakeEvent,!0)}},"keyup")};target[0]!==this.element[0]&&(events.remove=function(){var targetElement=this._find(target);targetElement&&this._removeTooltip(targetElement.tooltip)}),(!event||event.type==="mouseover")&&(events.mouseleave="close"),(!event||event.type==="focusin")&&(events.focusout="close"),this._on(!0,target,events)},"_registerCloseHandlers"),close:__name(function(event){var tooltip,that=this,target=$2(event?event.currentTarget:this.element),tooltipData=this._find(target);if(!tooltipData){target.removeData("ui-tooltip-open");return}tooltip=tooltipData.tooltip,!tooltipData.closing&&(clearInterval(this.delayedShow),target.data("ui-tooltip-title")&&!target.attr("title")&&target.attr("title",target.data("ui-tooltip-title")),this._removeDescribedBy(target),tooltipData.hiding=!0,tooltip.stop(!0),this._hide(tooltip,this.options.hide,function(){that._removeTooltip($2(this))}),target.removeData("ui-tooltip-open"),this._off(target,"mouseleave focusout keyup"),target[0]!==this.element[0]&&this._off(target,"remove"),this._off(this.document,"mousemove"),event&&event.type==="mouseleave"&&$2.each(this.parents,function(id,parent2){$2(parent2.element).attr("title",parent2.title),delete that.parents[id]}),tooltipData.closing=!0,this._trigger("close",event,{tooltip}),tooltipData.hiding||(tooltipData.closing=!1))},"close"),_tooltip:__name(function(element){var tooltip=$2("<div>").attr("role","tooltip"),content=$2("<div>").appendTo(tooltip),id=tooltip.uniqueId().attr("id");return this._addClass(content,"ui-tooltip-content"),this._addClass(tooltip,"ui-tooltip","ui-widget ui-widget-content"),tooltip.appendTo(this._appendTo(element)),this.tooltips[id]={element,tooltip}},"_tooltip"),_find:__name(function(target){var id=target.data("ui-tooltip-id");return id?this.tooltips[id]:null},"_find"),_removeTooltip:__name(function(tooltip){clearInterval(this.delayedShow),tooltip.remove(),delete this.tooltips[tooltip.attr("id")]},"_removeTooltip"),_appendTo:__name(function(target){var element=target.closest(".ui-front, dialog");return element.length||(element=this.document[0].body),element},"_appendTo"),_destroy:__name(function(){var that=this;$2.each(this.tooltips,function(id,tooltipData){var event=$2.Event("blur"),element=tooltipData.element;event.target=event.currentTarget=element[0],that.close(event,!0),$2("#"+id).remove(),element.data("ui-tooltip-title")&&(element.attr("title")||element.attr("title",element.data("ui-tooltip-title")),element.removeData("ui-tooltip-title"))}),this.liveRegion.remove()},"_destroy")}),$2.uiBackCompat===!0&&$2.widget("ui.tooltip",$2.ui.tooltip,{options:{tooltipClass:null},_tooltip:__name(function(){var tooltipData=this._superApply(arguments);return this.options.tooltipClass&&tooltipData.tooltip.addClass(this.options.tooltipClass),tooltipData},"_tooltip")}),$2.ui.tooltip})),jqueryUi}__name(requireJqueryUi,"requireJqueryUi");requireJqueryUi();(function($2,undefined$1){var rkeyEvent=/^key/,rmouseEvent=/^(?:mouse|contextmenu)|click/;$2.fn.simulate=function(type,options){return this.each(function(){new $2.simulate(this,type,options)})},$2.simulate=function(elem,type,options){var method=$2.camelCase("simulate-"+type);this.target=elem,this.options=options,this[method]?this[method]():this.simulateEvent(elem,type,options)},$2.extend($2.simulate,{keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},buttonCode:{LEFT:0,MIDDLE:1,RIGHT:2}}),$2.extend($2.simulate.prototype,{simulateEvent:__name(function(elem,type,options){var event=this.createEvent(type,options);this.dispatchEvent(elem,type,event,options)},"simulateEvent"),createEvent:__name(function(type,options){if(rkeyEvent.test(type))return this.keyEvent(type,options);if(rmouseEvent.test(type))return this.mouseEvent(type,options)},"createEvent"),mouseEvent:__name(function(type,options){var event,eventDoc,doc,body;return options=$2.extend({bubbles:!0,cancelable:type!=="mousemove",view:window,detail:0,screenX:0,screenY:0,clientX:1,clientY:1,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:undefined$1},options),document.createEvent?(event=document.createEvent("MouseEvents"),event.initMouseEvent(type,options.bubbles,options.cancelable,options.view,options.detail,options.screenX,options.screenY,options.clientX,options.clientY,options.ctrlKey,options.altKey,options.shiftKey,options.metaKey,options.button,options.relatedTarget||document.body.parentNode),event.pageX===0&&event.pageY===0&&Object.defineProperty&&(eventDoc=event.relatedTarget.ownerDocument||document,doc=eventDoc.documentElement,body=eventDoc.body,Object.defineProperty(event,"pageX",{get:__name(function(){return options.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc&&doc.clientLeft||body&&body.clientLeft||0)},"get")}),Object.defineProperty(event,"pageY",{get:__name(function(){return options.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc&&doc.clientTop||body&&body.clientTop||0)},"get")}))):document.createEventObject&&(event=document.createEventObject(),$2.extend(event,options),event.button={0:1,1:4,2:2}[event.button]||(event.button===-1?0:event.button)),event},"mouseEvent"),keyEvent:__name(function(type,options){var event;if(options=$2.extend({bubbles:!0,cancelable:!0,view:window,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:0,charCode:undefined$1},options),document.createEvent)try{event=document.createEvent("KeyEvents"),event.initKeyEvent(type,options.bubbles,options.cancelable,options.view,options.ctrlKey,options.altKey,options.shiftKey,options.metaKey,options.keyCode,options.charCode)}catch{event=document.createEvent("Events"),event.initEvent(type,options.bubbles,options.cancelable),$2.extend(event,{view:options.view,ctrlKey:options.ctrlKey,altKey:options.altKey,shiftKey:options.shiftKey,metaKey:options.metaKey,keyCode:options.keyCode,charCode:options.charCode})}else document.createEventObject&&(event=document.createEventObject(),$2.extend(event,options));return(/msie [\w.]+/.exec(navigator.userAgent.toLowerCase())||{}.toString.call(window.opera)==="[object Opera]")&&(event.keyCode=options.charCode>0?options.charCode:options.keyCode,event.charCode=undefined$1),event},"keyEvent"),dispatchEvent:__name(function(elem,type,event){elem.dispatchEvent?elem.dispatchEvent(event):type==="click"&&elem.click&&elem.nodeName.toLowerCase()==="input"?elem.click():elem.fireEvent&&elem.fireEvent("on"+type,event)},"dispatchEvent"),simulateFocus:__name(function(){var focusinEvent,triggered=!1,element=$2(this.target);function trigger(){triggered=!0}__name(trigger,"trigger"),element.bind("focus",trigger),element[0].focus(),triggered||(focusinEvent=$2.Event("focusin"),focusinEvent.preventDefault(),element.trigger(focusinEvent),element.triggerHandler("focus")),element.unbind("focus",trigger)},"simulateFocus"),simulateBlur:__name(function(){var focusoutEvent,triggered=!1,element=$2(this.target);function trigger(){triggered=!0}__name(trigger,"trigger"),element.bind("blur",trigger),element[0].blur(),setTimeout(function(){element[0].ownerDocument.activeElement===element[0]&&element[0].ownerDocument.body.focus(),triggered||(focusoutEvent=$2.Event("focusout"),focusoutEvent.preventDefault(),element.trigger(focusoutEvent),element.triggerHandler("blur")),element.unbind("blur",trigger)},1)},"simulateBlur")});function findCenter(elem){var offset,document2=$2(elem.ownerDocument);return elem=$2(elem),offset=elem.offset(),{x:offset.left+elem.outerWidth()/2-document2.scrollLeft(),y:offset.top+elem.outerHeight()/2-document2.scrollTop()}}__name(findCenter,"findCenter");function findCorner(elem){var offset,document2=$2(elem.ownerDocument);return elem=$2(elem),offset=elem.offset(),{x:offset.left-document2.scrollLeft(),y:offset.top-document2.scrollTop()}}__name(findCorner,"findCorner"),$2.extend($2.simulate.prototype,{simulateDrag:__name(function(){var i=0,target=this.target,eventDoc=target.ownerDocument,options=this.options,center=options.handle==="corner"?findCorner(target):findCenter(target),x=Math.floor(center.x),y=Math.floor(center.y),coord={clientX:x,clientY:y},dx=options.dx||(options.x!==undefined$1?options.x-x:0),dy=options.dy||(options.y!==undefined$1?options.y-y:0),moves=options.moves||3;for(this.simulateEvent(target,"mousedown",coord);i<moves;i++)x+=dx/moves,y+=dy/moves,coord={clientX:Math.round(x),clientY:Math.round(y)},this.simulateEvent(eventDoc,"mousemove",coord);$2.contains(eventDoc,target)?(this.simulateEvent(target,"mouseup",coord),this.simulateEvent(target,"click",coord)):this.simulateEvent(eventDoc,"mouseup",coord)},"simulateDrag")})})($);const GLOBAL="libAdmin";class Store{static{__name(this,"Store")}constructor(){this.map=new Map}static getGlobal(windowObject=window){let libAdmin=windowObject[GLOBAL];return libAdmin==null&&(libAdmin=Store.createGlobal(),windowObject[GLOBAL]=libAdmin),libAdmin}static createGlobal(){return{}}static instanceInWindow(windowObject){const libAdmin=Store.getGlobal(windowObject);return libAdmin.store||(libAdmin.store=new Store),libAdmin.store}static instance(){return Store.instanceInWindow()}static parentInstance(){return Store.instance()}set(key,value){return this.map.set(key,value),this}get(key){return this.map.get(key)}delete(key){return this.map.delete(key)}has(key){return this.map.has(key)}}let StyleHelper$1=class StyleHelper{static{__name(this,"StyleHelper")}static{this.COMMON_PREFIX="xp-admin-common-"}static{this.ADMIN_PREFIX="xp-admin-"}static{this.ICON_PREFIX="icon-"}static getCurrentPrefix(){const prefix=Store.instance().get("prefix");return prefix??""}static setCurrentPrefix(prefix){Store.instance().set("prefix",prefix)}static getCls(cls,prefix){const currentPrefix=prefix??StyleHelper.getCurrentPrefix();if(!currentPrefix)return cls;const clsArr=cls.trim().split(" ");return clsArr.forEach((clsEl,index,arr)=>{StyleHelper.isPrefixed(clsEl,currentPrefix)||(arr[index]=currentPrefix+clsEl)}),clsArr.join(" ")}static getIconCls(iconCls){return StyleHelper.getCls(StyleHelper.ICON_PREFIX+iconCls)}static getCommonIconCls(iconCls){return StyleHelper.getCls(StyleHelper.ICON_PREFIX+iconCls,StyleHelper.COMMON_PREFIX)}static isPrefixed(cls,prefix){return cls.indexOf(prefix)===0}};class AbstractEventBus{static{__name(this,"AbstractEventBus")}static{this.debug=!1}constructor(contextWindow=window){this.handlersMap={},this.receivers=[],this.id=new Date().getTime(),contextWindow&&this.addReceiver(contextWindow)}setId(id){return this.id=id,this}addReceiver(receiver){return this.hasReceiver(receiver)||(AbstractEventBus.debug,this.receivers.push(receiver)),this}removeReceiver(receiver){return AbstractEventBus.debug,this.receivers=this.receivers.filter(r=>r!==receiver),this}hasReceiver(receiver){return this.receivers.includes(receiver)}onEvent(eventName,handler){this.handlersMap[eventName]||(this.handlersMap[eventName]=[]);const entry={handler};return this.handlersMap[eventName].push(entry),entry}unEvent(eventName,handler){const removedEntries=[];return handler?this.handlersMap[eventName]=(this.handlersMap[eventName]||[]).filter(entry=>entry.handler===handler?(removedEntries.push(entry),!1):!0):(removedEntries.push(...this.handlersMap[eventName]||[]),this.handlersMap[eventName]=[]),removedEntries}}class ClassHelper{static{__name(this,"ClassHelper")}static{this.MAX_NEST_LEVEL=7}static{this.ALLOWED_PACKAGES=["api","app","LiveEdit"]}static getFunctionName(func){if(func.name)return func.name;{let results=/function (.+)\(/.exec(func.toString());return results&&results.length>1?results[1]:""}}static getClassName(instance){return ClassHelper.getFunctionName(instance.constructor)}static getClass(instance){return instance.constructor}static getModuleName(instance){let fullName=ClassHelper.getFullName(instance);return fullName?fullName.substr(0,fullName.lastIndexOf(".")):""}static getFullName(instance){let constructor=typeof instance=="function"?instance:instance.constructor;return ClassHelper.findPath(window,constructor)||constructor.name||constructor.toString().match(/^function\s*([^\s(]+)/)[1]}static findPath(obj,constructor,nestLevel=1){let value,path;if(nestLevel>ClassHelper.MAX_NEST_LEVEL)return null;for(let key in obj)if("hasOwnProperty"in obj&&obj.hasOwnProperty(key)){if(nestLevel===1&&ClassHelper.ALLOWED_PACKAGES.indexOf(key)<0||(value=obj[key],!value||value===obj))continue;if(typeof value=="object"){if(path=ClassHelper.findPath(value,constructor,nestLevel+1),path)return`${key}.${path}`}else if(typeof value=="function"&&value===constructor)return ClassHelper.getFunctionName(constructor)}return path}static distanceTo(instance,clazz){if(ClassHelper.getClassName(instance)===ClassHelper.getFunctionName(clazz))return 0;let distance=0,prototype=Object.getPrototypeOf(instance);do{if(prototype=Object.getPrototypeOf(prototype),!prototype)return distance;distance++}while(ClassHelper.getClassName(prototype)!==ClassHelper.getFunctionName(clazz));return distance}}class IframeEventBus extends AbstractEventBus{static{__name(this,"IframeEventBus")}static{this.debug=!1}constructor(contextWindow=window){super(contextWindow),this.isListening=!1,this.classRegistry={},this.handleMessageEvent=event=>{const{eventName,detail}=event.data||{};if(!eventName)return;const data=JSON.parse(detail,this.reviver.bind(this));IframeEventBus.debug,(this.handlersMap[eventName]||[]).forEach(entry=>entry.handler(data))},this.isListening||(window.addEventListener("message",this.handleMessageEvent),this.isListening=!0)}static get(receiver){return IframeEventBus.instance?receiver&&IframeEventBus.instance.hasReceiver(receiver):IframeEventBus.instance=new IframeEventBus(receiver),IframeEventBus.instance}fireEvent(event){if(IframeEventBus.debug,!this.receivers.length)throw new Error(`[${this.id}] No receivers set for IframeEventBus, use addReceiver(window) to set one.`);this.receivers.forEach(receiver=>{const detail=JSON.stringify(event,this.replacer.bind(this,receiver));receiver.postMessage({eventName:event.getName(),detail},"*")})}registerClass(fullName,instance){const constructor=typeof instance=="function"?instance:instance.constructor;IframeEventBus.debug,this.classRegistry[fullName]=constructor}onEvent(eventName,handler){return super.onEvent(eventName,handler)}unEvent(eventName,handler){return super.unEvent(eventName,handler)}replacer(receiver,key,value){if(value===null||typeof value!="object")return value;let fullName=this.getFullName(value,receiver);if(fullName==="Object"||fullName==="Array")return value;this.classRegistry[fullName]||this.registerClass(fullName,value);let str;return typeof value.toString=="function"&&(str=value.toString(),(str==="[object Object]"||str==="[object Array]")&&(str=void 0)),{__typename:fullName,__stringvalue:str,...value}}reviver(key,value){if(value&&typeof value=="object"&&value.__typename){const typeName=value.__typename;delete value.__typename;const ClassConstructor=this.classRegistry[typeName];if(ClassConstructor)if(typeof ClassConstructor.fromString=="function"){const stringValue=value.__stringvalue;if(stringValue!==void 0)return delete value.__stringvalue,IframeEventBus.debug,ClassConstructor.fromString(stringValue)}else{if(typeof ClassConstructor.fromObject=="function")return IframeEventBus.debug,ClassConstructor.fromObject(value);{const newInstance=new ClassConstructor;return IframeEventBus.debug,Object.assign(newInstance,value),newInstance}}else IframeEventBus.debug}return value}getFullName(instance,receiver){let constructor=typeof instance=="function"?instance:instance.constructor;return ClassHelper.findPath(receiver,constructor)||constructor.name||constructor.toString().match(/^function\s*([^\s(]+)/)[1]}}class NumberHelper{static{__name(this,"NumberHelper")}static{this.MAX_SAFE_INTEGER=9007199254740991}static{this.MIN_SAFE_INTEGER=-9007199254740991}static isWholeNumber(value){return NumberHelper.isNumber(value)&&value%1===0}static isNumber(value){return typeof value=="number"&&!isNaN(value)&&isFinite(value)&&value>=NumberHelper.MIN_SAFE_INTEGER&&value<=NumberHelper.MAX_SAFE_INTEGER}static randomBetween(from,to){return from+Math.round(Math.random()*(to-from))}static toNumber(value){if(value!=null&&value.trim().length>0){const result=Number(value);return isNaN(result)?null:result}return null}}class ObjectHelper{static{__name(this,"ObjectHelper")}static create(constructor,..._args){let factory=constructor.bind.apply(constructor,arguments);return new factory}static iFrameSafeInstanceOf(obj,objType){if(!objType||!obj)return!1;if(obj instanceof objType||ClassHelper.getClassName(obj)===ClassHelper.getFunctionName(objType))return!0;if(typeof obj!="object")return!1;let prototype=Object.getPrototypeOf(obj);do if(prototype=Object.getPrototypeOf(prototype),!prototype)return!1;while(ClassHelper.getClassName(prototype)!==ClassHelper.getFunctionName(objType));return!0}static isDefined(val){return val!=null}static bothDefined(val1,val2){return ObjectHelper.isDefined(val1)&&ObjectHelper.isDefined(val2)}static noneDefined(val1,val2){return!ObjectHelper.isDefined(val1)&&!ObjectHelper.isDefined(val2)}static equallyDefined(a,b){return!!(ObjectHelper.noneDefined(a,b)||ObjectHelper.bothDefined(a,b))}static equals(a,b){return ObjectHelper.bothDefined(a,b)?a.equals(b):ObjectHelper.equallyDefined(a,b)}static arrayEquals(arrayA,arrayB){return ObjectHelper.bothDefined(arrayA,arrayB)?arrayA.length!==arrayB.length?!1:arrayA.every((val,index)=>ObjectHelper.equals(val,arrayB[index])):ObjectHelper.equallyDefined(arrayA,arrayB)}static anyArrayEquals(arrayA,arrayB){return ObjectHelper.bothDefined(arrayA,arrayB)?arrayA.length!==arrayB.length?!1:arrayA.every((val,index)=>ObjectHelper.objectEquals(val,arrayB[index])):ObjectHelper.equallyDefined(arrayA,arrayB)}static getObjectProperties(obj){const keys=[];for(const key in obj)obj.hasOwnProperty(key)&&keys.push(key);return keys}static objectMapEquals(mapA,mapB){if(ObjectHelper.bothDefined(mapA,mapB)){const keysA=ObjectHelper.getObjectProperties(mapA),keysB=ObjectHelper.getObjectProperties(mapB);return ObjectHelper.stringArrayEquals(keysA.sort(),keysB.sort())?keysA.every(curKeyA=>{const valueA=mapA[curKeyA],valueB=mapB[curKeyA];return ObjectHelper.equals(valueA,valueB)}):!1}return ObjectHelper.equallyDefined(mapA,mapB)}static stringEquals(a,b){return ObjectHelper.bothDefined(a,b)?a.toString()===b.toString():ObjectHelper.equallyDefined(a,b)}static stringArrayEquals(arrayA,arrayB){return ObjectHelper.anyArrayEquals(arrayA,arrayB)}static booleanEquals(a,b){return ObjectHelper.bothDefined(a,b)?a===b:ObjectHelper.equallyDefined(a,b)}static numberEquals(a,b){return ObjectHelper.bothDefined(a,b)?NumberHelper.isNumber(a)&&NumberHelper.isNumber(b)&&a===b:ObjectHelper.equallyDefined(a,b)}static dateEquals(a,b){return ObjectHelper.bothDefined(a,b)?a.toISOString()===b.toISOString():ObjectHelper.equallyDefined(a,b)}static dateEqualsUpToMinutes(a,b){if(ObjectHelper.bothDefined(a,b)){const clonedA=new Date(a.getTime());clonedA.setSeconds(0,0);const clonedB=new Date(b.getTime());return clonedB.setSeconds(0,0),ObjectHelper.dateEquals(clonedA,clonedB)}return ObjectHelper.equallyDefined(a,b)}static anyEquals(a,b){return ObjectHelper.bothDefined(a,b)?JSON.stringify(a)===JSON.stringify(b):ObjectHelper.equallyDefined(a,b)}static objectEquals(a,b){if(ObjectHelper.bothDefined(a,b)){if(a===b)return!0;if(ClassHelper.getClassName(a)!==ClassHelper.getClassName(b))return!1;let aString=JSON.stringify(a,(key,value)=>key&&a===value?void 0:value),bString=JSON.stringify(b,(key,value)=>key&&b===value?void 0:value);return aString===bString}return ObjectHelper.equallyDefined(a,b)}static objectPropertyIterator(object,callback){let index=0;for(let name in object)if(object.hasOwnProperty(name)){let property=object[name];callback(name,property,index++)}}static propertyExists(object,key){return!!object&&object.hasOwnProperty(key)&&!!object[key]}}const WINDOW_KEY="WindowDOM";class WindowDOM{static{__name(this,"WindowDOM")}constructor(element=window){this.onBeforeUnloadListeners=[],this.onUnloadListeners=[],this.el=element;const handle=__name(function(event,listeners){listeners.forEach(l=>l(event))},"handle");this.el.onbeforeunload=event=>{handle(event,this.onBeforeUnloadListeners)},this.el.onunload=event=>{handle(event,this.onUnloadListeners)},Store.instance().set(WINDOW_KEY,this)}static get(){let instance=Store.instance().get(WINDOW_KEY);return instance==null&&(instance=new WindowDOM),instance}asWindow(){return this.el}getTopParent(){let parent2=this.getParent();if(!parent2)return null;let i=0;do{let next=parent2.getParent();if(!next)return parent2;parent2=next,i++}while(i<10);return null}getParent(){let parent2=this.el.parent;if(parent2===this.el)return null;const libAdmin=parent2[GLOBAL];let dom;return libAdmin.store&&(dom=libAdmin.store.get(WINDOW_KEY)),dom||new WindowDOM(parent2)}isInIFrame(){return this.el.self!==this.el.top}getFrameElement(){return this.el.frameElement}getHTMLElement(){return this.el}getScrollTop(){return $(this.el).scrollTop()}onResized(listener,element){this.el.addEventListener("resize",listener),element&&element.onRemoved(()=>this.unResized(listener))}unResized(listener){this.el.removeEventListener("resize",listener)}getWidth(){return $(this.el).innerWidth()}getHeight(){return $(this.el).innerHeight()}onScroll(listener,element){this.el.addEventListener("scroll",listener),element&&element.onRemoved(()=>this.unScroll(listener))}unScroll(listener){this.el.removeEventListener("scroll",listener)}onBeforeUnload(listener){this.onBeforeUnloadListeners.push(listener)}unBeforeUnload(listener){return this.onBeforeUnloadListeners=this.onBeforeUnloadListeners.filter(curr=>curr!==listener),this}onUnload(listener){this.onUnloadListeners.push(listener)}unUnload(listener){return this.onUnloadListeners=this.onUnloadListeners.filter(curr=>curr!==listener),this}onFocus(listener){this.el.addEventListener("focus",listener)}unFocus(listener){this.el.removeEventListener("focus",listener)}onBlur(listener){this.el.addEventListener("blur",listener)}unBlur(listener){this.el.removeEventListener("blur",listener)}}class ResponsiveListener{static{__name(this,"ResponsiveListener")}constructor(item,listener){this.item=item,this.listener=listener}getItem(){return this.item}getListener(){return this.listener}}class ResponsiveRange{static{__name(this,"ResponsiveRange")}constructor(minRange,maxRange,rangeClass){this.minRange=minRange,this.maxRange=maxRange||0,this.rangeClass=rangeClass||"_"+(minRange===375?360:minRange)+"-"+(maxRange===375?360:maxRange)}getMinimumRange(){return this.minRange}getMaximumRange(){return this.maxRange}getRangeClass(){return this.rangeClass}isFit(size){return this.minRange<=size&&size<=this.maxRange}isFitOrSmaller(size){return size<=this.maxRange}isFitOrBigger(size){return size>this.minRange}}class ResponsiveRanges{static{__name(this,"ResponsiveRanges")}static{this._0_240=new ResponsiveRange(0,240)}static{this._240_360=new ResponsiveRange(240,375)}static{this._360_540=new ResponsiveRange(375,540)}static{this._540_720=new ResponsiveRange(540,720)}static{this._720_960=new ResponsiveRange(720,960)}static{this._960_1200=new ResponsiveRange(960,1200)}static{this._1200_1380=new ResponsiveRange(1200,1380)}static{this._1380_1620=new ResponsiveRange(1380,1620)}static{this._1620_1920=new ResponsiveRange(1620,1920)}static{this._1920_UP=new ResponsiveRange(1920,1/0)}}class ResponsiveItem{static{__name(this,"ResponsiveItem")}constructor(element,handler){this.element=element,this.rangeValue=this.element.getEl().getWidthWithBorder(),this.oldRangeValue=this.rangeValue,this.handler=handler,this.fitToRange(),this.element.getEl().addClass(this.rangeSize.getRangeClass())}getElement(){return this.element}update(){let newRangeValue=this.element.getEl().getWidthWithBorder();this.oldRangeValue=this.rangeValue,this.oldRangeSize=this.rangeSize,newRangeValue!==this.rangeValue&&(this.rangeValue=newRangeValue,this.element.getEl().removeClass(this.rangeSize.getRangeClass()),this.fitToRange(),this.element.getEl().addClass(this.rangeSize.getRangeClass())),this.handler&&this.handler.call(this,this)}isRangeSizeChanged(){return this.rangeSize!==this.oldRangeSize}setHandler(handler){this.handler=handler}getRangeValue(){return this.rangeValue}getOldRangeValue(){return this.oldRangeValue}getRangeSize(){return this.rangeSize}getOldRangeSize(){return this.oldRangeSize}isInRange(range){return range.isFit(this.rangeValue)}isInRangeOrSmaller(range){return range.isFitOrSmaller(this.rangeValue)}isInRangeOrBigger(range){return range.isFitOrBigger(this.rangeValue)}fitToRange(){for(const name in ResponsiveRanges)if(ResponsiveRanges.hasOwnProperty(name)){const range=ResponsiveRanges[name];if(range&&ObjectHelper.iFrameSafeInstanceOf(range,ResponsiveRange)&&range.isFit(this.rangeValue)){this.rangeSize=range;break}}}}class ResponsiveManager{static{__name(this,"ResponsiveManager")}static{this.window=WindowDOM.get()}static{this.responsiveListeners=[]}static onAvailableSizeChanged(el,handler){const responsiveItem=new ResponsiveItem(el,handler);let listener=__name(()=>{el.isVisible()&&responsiveItem.update()},"listener"),responsiveListener=new ResponsiveListener(responsiveItem,listener);return this.updateItemOnShown(el,responsiveItem),ResponsiveManager.responsiveListeners.push(responsiveListener),ResponsiveManager.window.getHTMLElement().addEventListener("availablesizechange",listener),ResponsiveManager.window.onResized(listener),responsiveItem}static unAvailableSizeChanged(el){ResponsiveManager.responsiveListeners=ResponsiveManager.responsiveListeners.filter(curr=>curr.getItem().getElement()===el?(ResponsiveManager.window.getHTMLElement().removeEventListener("availablesizechange",curr.getListener()),ResponsiveManager.window.unResized(curr.getListener()),!1):!0)}static unAvailableSizeChangedByItem(item){ResponsiveManager.responsiveListeners=ResponsiveManager.responsiveListeners.filter(curr=>curr.getItem()===item?(ResponsiveManager.window.getHTMLElement().removeEventListener("availablesizechange",curr.getListener()),ResponsiveManager.window.unResized(curr.getListener()),!1):!0)}static fireResizeEvent(){const customEvent=new Event("availablesizechange",{bubbles:!1,cancelable:!0});ResponsiveManager.window.getHTMLElement().dispatchEvent(customEvent)}static getWindow(){return ResponsiveManager.window}static updateItemOnShown(el,responsiveItem){el.whenShown(()=>responsiveItem.update())}}var q={exports:{}},hasRequiredQ;function requireQ(){return hasRequiredQ||(hasRequiredQ=1,(function(module2,exports$1){(function(definition){typeof bootstrap=="function"?bootstrap("promise",definition):module2.exports=definition()})(function(){var hasStacks=!1;try{throw new Error}catch(e){hasStacks=!!e.stack}var qStartingLine=captureLine(),qFileName,noop=__name(function(){},"noop"),nextTick=(function(){var head={task:void 0,next:null},tail=head,flushing=!1,requestTick=void 0,isNodeJS=!1,laterQueue=[];function flush(){for(var task,domain;head.next;)head=head.next,task=head.task,head.task=void 0,domain=head.domain,domain&&(head.domain=void 0,domain.enter()),runSingle(task,domain);for(;laterQueue.length;)task=laterQueue.pop(),runSingle(task);flushing=!1}__name(flush,"flush");function runSingle(task,domain){try{task()}catch(e){if(isNodeJS)throw domain&&domain.exit(),setTimeout(flush,0),domain&&domain.enter(),e;setTimeout(function(){throw e},0)}domain&&domain.exit()}if(__name(runSingle,"runSingle"),nextTick=__name(function(task){tail=tail.next={task,domain:isNodeJS&&process.domain,next:null},flushing||(flushing=!0,requestTick())},"nextTick"),typeof process=="object"&&process.toString()==="[object process]"&&process.nextTick)isNodeJS=!0,requestTick=__name(function(){process.nextTick(flush)},"requestTick");else if(typeof setImmediate=="function")typeof window<"u"?requestTick=setImmediate.bind(window,flush):requestTick=__name(function(){setImmediate(flush)},"requestTick");else if(typeof MessageChannel<"u"){var channel=new MessageChannel;channel.port1.onmessage=function(){requestTick=requestPortTick,channel.port1.onmessage=flush,flush()};var requestPortTick=__name(function(){channel.port2.postMessage(0)},"requestPortTick");requestTick=__name(function(){setTimeout(flush,0),requestPortTick()},"requestTick")}else requestTick=__name(function(){setTimeout(flush,0)},"requestTick");return nextTick.runAfter=function(task){laterQueue.push(task),flushing||(flushing=!0,requestTick())},nextTick})(),call=Function.call;function uncurryThis(f){return function(){return call.apply(f,arguments)}}__name(uncurryThis,"uncurryThis");var array_slice=uncurryThis(Array.prototype.slice),array_reduce=uncurryThis(Array.prototype.reduce||function(callback,basis){var index=0,length=this.length;if(arguments.length===1)do{if(index in this){basis=this[index++];break}if(++index>=length)throw new TypeError}while(!0);for(;index<length;index++)index in this&&(basis=callback(basis,this[index],index));return basis}),array_indexOf=uncurryThis(Array.prototype.indexOf||function(value){for(var i=0;i<this.length;i++)if(this[i]===value)return i;return-1}),array_map=uncurryThis(Array.prototype.map||function(callback,thisp){var self=this,collect=[];return array_reduce(self,function(undefined$1,value,index){collect.push(callback.call(thisp,value,index,self))},void 0),collect}),object_create=Object.create||function(prototype){function Type(){}return __name(Type,"Type"),Type.prototype=prototype,new Type},object_defineProperty=Object.defineProperty||function(obj,prop,descriptor){return obj[prop]=descriptor.value,obj},object_hasOwnProperty=uncurryThis(Object.prototype.hasOwnProperty),object_keys=Object.keys||function(object){var keys=[];for(var key in object)object_hasOwnProperty(object,key)&&keys.push(key);return keys},object_toString=uncurryThis(Object.prototype.toString);function isObject(value){return value===Object(value)}__name(isObject,"isObject");function isStopIteration(exception){return object_toString(exception)==="[object StopIteration]"||exception instanceof QReturnValue}__name(isStopIteration,"isStopIteration");var QReturnValue;typeof ReturnValue<"u"?QReturnValue=ReturnValue:QReturnValue=__name(function(value){this.value=value},"QReturnValue");var STACK_JUMP_SEPARATOR="From previous event:";function makeStackTraceLong(error,promise2){if(hasStacks&&promise2.stack&&typeof error=="object"&&error!==null&&error.stack){for(var stacks=[],p=promise2;p;p=p.source)p.stack&&(!error.__minimumStackCounter__||error.__minimumStackCounter__>p.stackCounter)&&(object_defineProperty(error,"__minimumStackCounter__",{value:p.stackCounter,configurable:!0}),stacks.unshift(p.stack));stacks.unshift(error.stack);var concatedStacks=stacks.join(`
2
+ `+STACK_JUMP_SEPARATOR+`
3
+ `),stack=filterStackString(concatedStacks);object_defineProperty(error,"stack",{value:stack,configurable:!0})}}__name(makeStackTraceLong,"makeStackTraceLong");function filterStackString(stackString){for(var lines=stackString.split(`
4
+ `),desiredLines=[],i=0;i<lines.length;++i){var line=lines[i];!isInternalFrame(line)&&!isNodeFrame(line)&&line&&desiredLines.push(line)}return desiredLines.join(`
5
+ `)}__name(filterStackString,"filterStackString");function isNodeFrame(stackLine){return stackLine.indexOf("(module.js:")!==-1||stackLine.indexOf("(node.js:")!==-1}__name(isNodeFrame,"isNodeFrame");function getFileNameAndLineNumber(stackLine){var attempt1=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine);if(attempt1)return[attempt1[1],Number(attempt1[2])];var attempt2=/at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine);if(attempt2)return[attempt2[1],Number(attempt2[2])];var attempt3=/.*@(.+):(\d+)$/.exec(stackLine);if(attempt3)return[attempt3[1],Number(attempt3[2])]}__name(getFileNameAndLineNumber,"getFileNameAndLineNumber");function isInternalFrame(stackLine){var fileNameAndLineNumber=getFileNameAndLineNumber(stackLine);if(!fileNameAndLineNumber)return!1;var fileName=fileNameAndLineNumber[0],lineNumber=fileNameAndLineNumber[1];return fileName===qFileName&&lineNumber>=qStartingLine&&lineNumber<=qEndingLine}__name(isInternalFrame,"isInternalFrame");function captureLine(){if(hasStacks)try{throw new Error}catch(e){var lines=e.stack.split(`
6
+ `),firstLine=lines[0].indexOf("@")>0?lines[1]:lines[2],fileNameAndLineNumber=getFileNameAndLineNumber(firstLine);return fileNameAndLineNumber?(qFileName=fileNameAndLineNumber[0],fileNameAndLineNumber[1]):void 0}}__name(captureLine,"captureLine");function deprecate(callback,name,alternative){return function(){return callback.apply(callback,arguments)}}__name(deprecate,"deprecate");function Q2(value){return value instanceof Promise2?value:isPromiseAlike(value)?coerce(value):fulfill(value)}__name(Q2,"Q"),Q2.resolve=Q2,Q2.nextTick=nextTick,Q2.longStackSupport=!1;var longStackCounter=1;typeof process=="object"&&process&&process.env&&process.env.Q_DEBUG&&(Q2.longStackSupport=!0),Q2.defer=defer;function defer(){var messages=[],progressListeners=[],resolvedPromise,deferred=object_create(defer.prototype),promise2=object_create(Promise2.prototype);if(promise2.promiseDispatch=function(resolve,op,operands){var args=array_slice(arguments);messages?(messages.push(args),op==="when"&&operands[1]&&progressListeners.push(operands[1])):Q2.nextTick(function(){resolvedPromise.promiseDispatch.apply(resolvedPromise,args)})},promise2.valueOf=function(){if(messages)return promise2;var nearerValue=nearer(resolvedPromise);return isPromise(nearerValue)&&(resolvedPromise=nearerValue),nearerValue},promise2.inspect=function(){return resolvedPromise?resolvedPromise.inspect():{state:"pending"}},Q2.longStackSupport&&hasStacks)try{throw new Error}catch(e){promise2.stack=e.stack.substring(e.stack.indexOf(`
7
+ `)+1),promise2.stackCounter=longStackCounter++}function become(newPromise){resolvedPromise=newPromise,Q2.longStackSupport&&hasStacks&&(promise2.source=newPromise),array_reduce(messages,function(undefined$1,message){Q2.nextTick(function(){newPromise.promiseDispatch.apply(newPromise,message)})},void 0),messages=void 0,progressListeners=void 0}return __name(become,"become"),deferred.promise=promise2,deferred.resolve=function(value){resolvedPromise||become(Q2(value))},deferred.fulfill=function(value){resolvedPromise||become(fulfill(value))},deferred.reject=function(reason){resolvedPromise||become(reject(reason))},deferred.notify=function(progress2){resolvedPromise||array_reduce(progressListeners,function(undefined$1,progressListener){Q2.nextTick(function(){progressListener(progress2)})},void 0)},deferred}__name(defer,"defer"),defer.prototype.makeNodeResolver=function(){var self=this;return function(error,value){error?self.reject(error):arguments.length>2?self.resolve(array_slice(arguments,1)):self.resolve(value)}},Q2.Promise=promise,Q2.promise=promise;function promise(resolver){if(typeof resolver!="function")throw new TypeError("resolver must be a function.");var deferred=defer();try{resolver(deferred.resolve,deferred.reject,deferred.notify)}catch(reason){deferred.reject(reason)}return deferred.promise}__name(promise,"promise"),promise.race=race,promise.all=all,promise.reject=reject,promise.resolve=Q2,Q2.passByCopy=function(object){return object},Promise2.prototype.passByCopy=function(){return this},Q2.join=function(x,y){return Q2(x).join(y)},Promise2.prototype.join=function(that){return Q2([this,that]).spread(function(x,y){if(x===y)return x;throw new Error("Q can't join: not the same: "+x+" "+y)})},Q2.race=race;function race(answerPs){return promise(function(resolve,reject2){for(var i=0,len=answerPs.length;i<len;i++)Q2(answerPs[i]).then(resolve,reject2)})}__name(race,"race"),Promise2.prototype.race=function(){return this.then(Q2.race)},Q2.makePromise=Promise2;function Promise2(descriptor,fallback,inspect){fallback===void 0&&(fallback=__name(function(op){return reject(new Error("Promise does not support operation: "+op))},"fallback")),inspect===void 0&&(inspect=__name(function(){return{state:"unknown"}},"inspect"));var promise2=object_create(Promise2.prototype);if(promise2.promiseDispatch=function(resolve,op,args){var result;try{descriptor[op]?result=descriptor[op].apply(promise2,args):result=fallback.call(promise2,op,args)}catch(exception){result=reject(exception)}resolve&&resolve(result)},promise2.inspect=inspect,inspect){var inspected=inspect();inspected.state==="rejected"&&(promise2.exception=inspected.reason),promise2.valueOf=function(){var inspected2=inspect();return inspected2.state==="pending"||inspected2.state==="rejected"?promise2:inspected2.value}}return promise2}__name(Promise2,"Promise"),Promise2.prototype.toString=function(){return"[object Promise]"},Promise2.prototype.then=function(fulfilled,rejected,progressed){var self=this,deferred=defer(),done=!1;function _fulfilled(value){try{return typeof fulfilled=="function"?fulfilled(value):value}catch(exception){return reject(exception)}}__name(_fulfilled,"_fulfilled");function _rejected(exception){if(typeof rejected=="function"){makeStackTraceLong(exception,self);try{return rejected(exception)}catch(newException){return reject(newException)}}return reject(exception)}__name(_rejected,"_rejected");function _progressed(value){return typeof progressed=="function"?progressed(value):value}return __name(_progressed,"_progressed"),Q2.nextTick(function(){self.promiseDispatch(function(value){done||(done=!0,deferred.resolve(_fulfilled(value)))},"when",[function(exception){done||(done=!0,deferred.resolve(_rejected(exception)))}])}),self.promiseDispatch(void 0,"when",[void 0,function(value){var newValue,threw=!1;try{newValue=_progressed(value)}catch(e){if(threw=!0,Q2.onerror)Q2.onerror(e);else throw e}threw||deferred.notify(newValue)}]),deferred.promise},Q2.tap=function(promise2,callback){return Q2(promise2).tap(callback)},Promise2.prototype.tap=function(callback){return callback=Q2(callback),this.then(function(value){return callback.fcall(value).thenResolve(value)})},Q2.when=when;function when(value,fulfilled,rejected,progressed){return Q2(value).then(fulfilled,rejected,progressed)}__name(when,"when"),Promise2.prototype.thenResolve=function(value){return this.then(function(){return value})},Q2.thenResolve=function(promise2,value){return Q2(promise2).thenResolve(value)},Promise2.prototype.thenReject=function(reason){return this.then(function(){throw reason})},Q2.thenReject=function(promise2,reason){return Q2(promise2).thenReject(reason)},Q2.nearer=nearer;function nearer(value){if(isPromise(value)){var inspected=value.inspect();if(inspected.state==="fulfilled")return inspected.value}return value}__name(nearer,"nearer"),Q2.isPromise=isPromise;function isPromise(object){return object instanceof Promise2}__name(isPromise,"isPromise"),Q2.isPromiseAlike=isPromiseAlike;function isPromiseAlike(object){return isObject(object)&&typeof object.then=="function"}__name(isPromiseAlike,"isPromiseAlike"),Q2.isPending=isPending;function isPending(object){return isPromise(object)&&object.inspect().state==="pending"}__name(isPending,"isPending"),Promise2.prototype.isPending=function(){return this.inspect().state==="pending"},Q2.isFulfilled=isFulfilled;function isFulfilled(object){return!isPromise(object)||object.inspect().state==="fulfilled"}__name(isFulfilled,"isFulfilled"),Promise2.prototype.isFulfilled=function(){return this.inspect().state==="fulfilled"},Q2.isRejected=isRejected;function isRejected(object){return isPromise(object)&&object.inspect().state==="rejected"}__name(isRejected,"isRejected"),Promise2.prototype.isRejected=function(){return this.inspect().state==="rejected"};var unhandledReasons=[],unhandledRejections=[],reportedUnhandledRejections=[],trackUnhandledRejections=!0;function resetUnhandledRejections(){unhandledReasons.length=0,unhandledRejections.length=0,trackUnhandledRejections||(trackUnhandledRejections=!0)}__name(resetUnhandledRejections,"resetUnhandledRejections");function trackRejection(promise2,reason){trackUnhandledRejections&&(typeof process=="object"&&typeof process.emit=="function"&&Q2.nextTick.runAfter(function(){array_indexOf(unhandledRejections,promise2)!==-1&&(process.emit("unhandledRejection",reason,promise2),reportedUnhandledRejections.push(promise2))}),unhandledRejections.push(promise2),reason&&typeof reason.stack<"u"?unhandledReasons.push(reason.stack):unhandledReasons.push("(no stack) "+reason))}__name(trackRejection,"trackRejection");function untrackRejection(promise2){if(trackUnhandledRejections){var at=array_indexOf(unhandledRejections,promise2);at!==-1&&(typeof process=="object"&&typeof process.emit=="function"&&Q2.nextTick.runAfter(function(){var atReport=array_indexOf(reportedUnhandledRejections,promise2);atReport!==-1&&(process.emit("rejectionHandled",unhandledReasons[at],promise2),reportedUnhandledRejections.splice(atReport,1))}),unhandledRejections.splice(at,1),unhandledReasons.splice(at,1))}}__name(untrackRejection,"untrackRejection"),Q2.resetUnhandledRejections=resetUnhandledRejections,Q2.getUnhandledReasons=function(){return unhandledReasons.slice()},Q2.stopUnhandledRejectionTracking=function(){resetUnhandledRejections(),trackUnhandledRejections=!1},resetUnhandledRejections(),Q2.reject=reject;function reject(reason){var rejection=Promise2({when:__name(function(rejected){return rejected&&untrackRejection(this),rejected?rejected(reason):this},"when")},__name(function(){return this},"fallback"),__name(function(){return{state:"rejected",reason}},"inspect"));return trackRejection(rejection,reason),rejection}__name(reject,"reject"),Q2.fulfill=fulfill;function fulfill(value){return Promise2({when:__name(function(){return value},"when"),get:__name(function(name){return value[name]},"get"),set:__name(function(name,rhs){value[name]=rhs},"set"),delete:__name(function(name){delete value[name]},"delete"),post:__name(function(name,args){return name==null?value.apply(void 0,args):value[name].apply(value,args)},"post"),apply:__name(function(thisp,args){return value.apply(thisp,args)},"apply"),keys:__name(function(){return object_keys(value)},"keys")},void 0,__name(function(){return{state:"fulfilled",value}},"inspect"))}__name(fulfill,"fulfill");function coerce(promise2){var deferred=defer();return Q2.nextTick(function(){try{promise2.then(deferred.resolve,deferred.reject,deferred.notify)}catch(exception){deferred.reject(exception)}}),deferred.promise}__name(coerce,"coerce"),Q2.master=master;function master(object){return Promise2({isDef:__name(function(){},"isDef")},__name(function(op,args){return dispatch(object,op,args)},"fallback"),function(){return Q2(object).inspect()})}__name(master,"master"),Q2.spread=spread;function spread(value,fulfilled,rejected){return Q2(value).spread(fulfilled,rejected)}__name(spread,"spread"),Promise2.prototype.spread=function(fulfilled,rejected){return this.all().then(function(array){return fulfilled.apply(void 0,array)},rejected)},Q2.async=async;function async(makeGenerator){return function(){function continuer(verb,arg){var result;if(typeof StopIteration>"u"){try{result=generator[verb](arg)}catch(exception){return reject(exception)}return result.done?Q2(result.value):when(result.value,callback,errback)}else{try{result=generator[verb](arg)}catch(exception){return isStopIteration(exception)?Q2(exception.value):reject(exception)}return when(result,callback,errback)}}__name(continuer,"continuer");var generator=makeGenerator.apply(this,arguments),callback=continuer.bind(continuer,"next"),errback=continuer.bind(continuer,"throw");return callback()}}__name(async,"async"),Q2.spawn=spawn;function spawn(makeGenerator){Q2.done(Q2.async(makeGenerator)())}__name(spawn,"spawn"),Q2.return=_return;function _return(value){throw new QReturnValue(value)}__name(_return,"_return"),Q2.promised=promised;function promised(callback){return function(){return spread([this,all(arguments)],function(self,args){return callback.apply(self,args)})}}__name(promised,"promised"),Q2.dispatch=dispatch;function dispatch(object,op,args){return Q2(object).dispatch(op,args)}__name(dispatch,"dispatch"),Promise2.prototype.dispatch=function(op,args){var self=this,deferred=defer();return Q2.nextTick(function(){self.promiseDispatch(deferred.resolve,op,args)}),deferred.promise},Q2.get=function(object,key){return Q2(object).dispatch("get",[key])},Promise2.prototype.get=function(key){return this.dispatch("get",[key])},Q2.set=function(object,key,value){return Q2(object).dispatch("set",[key,value])},Promise2.prototype.set=function(key,value){return this.dispatch("set",[key,value])},Q2.del=Q2.delete=function(object,key){return Q2(object).dispatch("delete",[key])},Promise2.prototype.del=Promise2.prototype.delete=function(key){return this.dispatch("delete",[key])},Q2.mapply=Q2.post=function(object,name,args){return Q2(object).dispatch("post",[name,args])},Promise2.prototype.mapply=Promise2.prototype.post=function(name,args){return this.dispatch("post",[name,args])},Q2.send=Q2.mcall=Q2.invoke=function(object,name){return Q2(object).dispatch("post",[name,array_slice(arguments,2)])},Promise2.prototype.send=Promise2.prototype.mcall=Promise2.prototype.invoke=function(name){return this.dispatch("post",[name,array_slice(arguments,1)])},Q2.fapply=function(object,args){return Q2(object).dispatch("apply",[void 0,args])},Promise2.prototype.fapply=function(args){return this.dispatch("apply",[void 0,args])},Q2.try=Q2.fcall=function(object){return Q2(object).dispatch("apply",[void 0,array_slice(arguments,1)])},Promise2.prototype.fcall=function(){return this.dispatch("apply",[void 0,array_slice(arguments)])},Q2.fbind=function(object){var promise2=Q2(object),args=array_slice(arguments,1);return __name(function(){return promise2.dispatch("apply",[this,args.concat(array_slice(arguments))])},"fbound")},Promise2.prototype.fbind=function(){var promise2=this,args=array_slice(arguments);return __name(function(){return promise2.dispatch("apply",[this,args.concat(array_slice(arguments))])},"fbound")},Q2.keys=function(object){return Q2(object).dispatch("keys",[])},Promise2.prototype.keys=function(){return this.dispatch("keys",[])},Q2.all=all;function all(promises){return when(promises,function(promises2){var pendingCount=0,deferred=defer();return array_reduce(promises2,function(undefined$1,promise2,index){var snapshot;isPromise(promise2)&&(snapshot=promise2.inspect()).state==="fulfilled"?promises2[index]=snapshot.value:(++pendingCount,when(promise2,function(value){promises2[index]=value,--pendingCount===0&&deferred.resolve(promises2)},deferred.reject,function(progress2){deferred.notify({index,value:progress2})}))},void 0),pendingCount===0&&deferred.resolve(promises2),deferred.promise})}__name(all,"all"),Promise2.prototype.all=function(){return all(this)},Q2.any=any;function any(promises){if(promises.length===0)return Q2.resolve();var deferred=Q2.defer(),pendingCount=0;return array_reduce(promises,function(prev,current,index){var promise2=promises[index];pendingCount++,when(promise2,onFulfilled,onRejected,onProgress);function onFulfilled(result){deferred.resolve(result)}__name(onFulfilled,"onFulfilled");function onRejected(err){if(pendingCount--,pendingCount===0){var rejection=err||new Error(""+err);rejection.message="Q can't get fulfillment value from any promise, all promises were rejected. Last error message: "+rejection.message,deferred.reject(rejection)}}__name(onRejected,"onRejected");function onProgress(progress2){deferred.notify({index,value:progress2})}__name(onProgress,"onProgress")},void 0),deferred.promise}__name(any,"any"),Promise2.prototype.any=function(){return any(this)},Q2.allResolved=deprecate(allResolved,"allResolved","allSettled");function allResolved(promises){return when(promises,function(promises2){return promises2=array_map(promises2,Q2),when(all(array_map(promises2,function(promise2){return when(promise2,noop,noop)})),function(){return promises2})})}__name(allResolved,"allResolved"),Promise2.prototype.allResolved=function(){return allResolved(this)},Q2.allSettled=allSettled;function allSettled(promises){return Q2(promises).allSettled()}__name(allSettled,"allSettled"),Promise2.prototype.allSettled=function(){return this.then(function(promises){return all(array_map(promises,function(promise2){promise2=Q2(promise2);function regardless(){return promise2.inspect()}return __name(regardless,"regardless"),promise2.then(regardless,regardless)}))})},Q2.fail=Q2.catch=function(object,rejected){return Q2(object).then(void 0,rejected)},Promise2.prototype.fail=Promise2.prototype.catch=function(rejected){return this.then(void 0,rejected)},Q2.progress=progress;function progress(object,progressed){return Q2(object).then(void 0,void 0,progressed)}__name(progress,"progress"),Promise2.prototype.progress=function(progressed){return this.then(void 0,void 0,progressed)},Q2.fin=Q2.finally=function(object,callback){return Q2(object).finally(callback)},Promise2.prototype.fin=Promise2.prototype.finally=function(callback){if(!callback||typeof callback.apply!="function")throw new Error("Q can't apply finally callback");return callback=Q2(callback),this.then(function(value){return callback.fcall().then(function(){return value})},function(reason){return callback.fcall().then(function(){throw reason})})},Q2.done=function(object,fulfilled,rejected,progress2){return Q2(object).done(fulfilled,rejected,progress2)},Promise2.prototype.done=function(fulfilled,rejected,progress2){var onUnhandledError=__name(function(error){Q2.nextTick(function(){if(makeStackTraceLong(error,promise2),Q2.onerror)Q2.onerror(error);else throw error})},"onUnhandledError"),promise2=fulfilled||rejected||progress2?this.then(fulfilled,rejected,progress2):this;typeof process=="object"&&process&&process.domain&&(onUnhandledError=process.domain.bind(onUnhandledError)),promise2.then(void 0,onUnhandledError)},Q2.timeout=function(object,ms,error){return Q2(object).timeout(ms,error)},Promise2.prototype.timeout=function(ms,error){var deferred=defer(),timeoutId=setTimeout(function(){(!error||typeof error=="string")&&(error=new Error(error||"Timed out after "+ms+" ms"),error.code="ETIMEDOUT"),deferred.reject(error)},ms);return this.then(function(value){clearTimeout(timeoutId),deferred.resolve(value)},function(exception){clearTimeout(timeoutId),deferred.reject(exception)},deferred.notify),deferred.promise},Q2.delay=function(object,timeout){return timeout===void 0&&(timeout=object,object=void 0),Q2(object).delay(timeout)},Promise2.prototype.delay=function(timeout){return this.then(function(value){var deferred=defer();return setTimeout(function(){deferred.resolve(value)},timeout),deferred.promise})},Q2.nfapply=function(callback,args){return Q2(callback).nfapply(args)},Promise2.prototype.nfapply=function(args){var deferred=defer(),nodeArgs=array_slice(args);return nodeArgs.push(deferred.makeNodeResolver()),this.fapply(nodeArgs).fail(deferred.reject),deferred.promise},Q2.nfcall=function(callback){var args=array_slice(arguments,1);return Q2(callback).nfapply(args)},Promise2.prototype.nfcall=function(){var nodeArgs=array_slice(arguments),deferred=defer();return nodeArgs.push(deferred.makeNodeResolver()),this.fapply(nodeArgs).fail(deferred.reject),deferred.promise},Q2.nfbind=Q2.denodeify=function(callback){if(callback===void 0)throw new Error("Q can't wrap an undefined function");var baseArgs=array_slice(arguments,1);return function(){var nodeArgs=baseArgs.concat(array_slice(arguments)),deferred=defer();return nodeArgs.push(deferred.makeNodeResolver()),Q2(callback).fapply(nodeArgs).fail(deferred.reject),deferred.promise}},Promise2.prototype.nfbind=Promise2.prototype.denodeify=function(){var args=array_slice(arguments);return args.unshift(this),Q2.denodeify.apply(void 0,args)},Q2.nbind=function(callback,thisp){var baseArgs=array_slice(arguments,2);return function(){var nodeArgs=baseArgs.concat(array_slice(arguments)),deferred=defer();nodeArgs.push(deferred.makeNodeResolver());function bound(){return callback.apply(thisp,arguments)}return __name(bound,"bound"),Q2(bound).fapply(nodeArgs).fail(deferred.reject),deferred.promise}},Promise2.prototype.nbind=function(){var args=array_slice(arguments,0);return args.unshift(this),Q2.nbind.apply(void 0,args)},Q2.nmapply=Q2.npost=function(object,name,args){return Q2(object).npost(name,args)},Promise2.prototype.nmapply=Promise2.prototype.npost=function(name,args){var nodeArgs=array_slice(args||[]),deferred=defer();return nodeArgs.push(deferred.makeNodeResolver()),this.dispatch("post",[name,nodeArgs]).fail(deferred.reject),deferred.promise},Q2.nsend=Q2.nmcall=Q2.ninvoke=function(object,name){var nodeArgs=array_slice(arguments,2),deferred=defer();return nodeArgs.push(deferred.makeNodeResolver()),Q2(object).dispatch("post",[name,nodeArgs]).fail(deferred.reject),deferred.promise},Promise2.prototype.nsend=Promise2.prototype.nmcall=Promise2.prototype.ninvoke=function(name){var nodeArgs=array_slice(arguments,1),deferred=defer();return nodeArgs.push(deferred.makeNodeResolver()),this.dispatch("post",[name,nodeArgs]).fail(deferred.reject),deferred.promise},Q2.nodeify=nodeify;function nodeify(object,nodeback){return Q2(object).nodeify(nodeback)}__name(nodeify,"nodeify"),Promise2.prototype.nodeify=function(nodeback){if(nodeback)this.then(function(value){Q2.nextTick(function(){nodeback(null,value)})},function(error){Q2.nextTick(function(){nodeback(error)})});else return this},Q2.noConflict=function(){throw new Error("Q.noConflict only works when Q is used as a global")};var qEndingLine=captureLine();return Q2})})(q)),q.exports}__name(requireQ,"requireQ");var qExports=requireQ();const Q=getDefaultExportFromCjs(qExports);class Path{static{__name(this,"Path")}static{this.DEFAULT_ELEMENT_DIVIDER="/"}constructor(builder){this.elementDivider=builder.elementDivider!=null?builder.elementDivider:Path.DEFAULT_ELEMENT_DIVIDER,this.absolute=builder.absolute==null?!0:builder.absolute,builder.elements.forEach((element,index)=>{if(element==null)throw new Error("Path element was null at index: "+index);if(element.length===0)throw new Error("Path element was empty string at index: "+index)}),this.elements=builder.elements,this.refString=(this.absolute?this.elementDivider:"")+this.elements.join(this.elementDivider)}static removeEmptyElements(elements){return elements.filter(element=>element.length>0)}getElements(){return this.elements.slice(0)}getElement(index){return this.elements[index]}hasParent(){return this.elements.length>1}getDivider(){return this.elementDivider}getParentPath(){if(this.elements.length<1)return null;const parentElements=[];return this.elements.forEach((element,index)=>{index<this.elements.length-1&&parentElements.push(element)}),this.newBuilder().setElements(parentElements).build()}getLevel(){return this.elements.length}toString(){return this.refString}isAbsolute(){return this.absolute}newBuilder(){return new PathBuilder(this)}static create(){return new PathBuilder}static fromString(s,elementDivider=Path.DEFAULT_ELEMENT_DIVIDER){return Path.create().fromString(s,elementDivider).build()}}class PathBuilder{static{__name(this,"PathBuilder")}constructor(source){source&&(this.elements=source.getElements(),this.elementDivider=source.getDivider(),this.absolute=source.isAbsolute())}fromString(s,elementDivider=Path.DEFAULT_ELEMENT_DIVIDER){return this.elementDivider=elementDivider,this.absolute=s.indexOf(elementDivider)===0,this.elements=Path.removeEmptyElements(s.split(elementDivider)),this}fromParent(parent2,...childElements){const elements=parent2.getElements();return childElements.forEach(element=>element&&elements.push(element)),this.elements=elements,this.elementDivider=parent2.getDivider(),this.absolute=parent2.isAbsolute(),this}setElements(value){return this.elements=value,this}setElementDivider(value){return this.elementDivider=value,this}setAbsolute(value){return this.absolute=value,this}build(){return new Path(this)}}class StringHelper{static{__name(this,"StringHelper")}static{this.EMPTY_STRING=""}static{this.SAVE_CHAR_CODES={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"}}static limit(str,length,ending="…"){return StringHelper.isEmpty(str)?StringHelper.EMPTY_STRING:str.substring(0,length)+ending}static capitalize(str){return StringHelper.isEmpty(str)?StringHelper.EMPTY_STRING:str.charAt(0).toUpperCase()+str.slice(1)}static capitalizeAll(str){return StringHelper.isEmpty(str)?StringHelper.EMPTY_STRING:str.replace(/(?:^|\s)\S/g,function(ch){return ch.toUpperCase()})}static escapeHtml(str){return StringHelper.isEmpty(str)?StringHelper.EMPTY_STRING:str.replace(/[&<>"'\/]/g,(char=>StringHelper.SAVE_CHAR_CODES[char]))}static htmlToString(html2){const htmlEl=$.parseHTML(html2);return $(htmlEl).text()}static isUpperCase(str){return StringHelper.isEmpty(str)?!1:str.toUpperCase()===str}static isLowerCase(str){return StringHelper.isEmpty(str)?!1:str.toLowerCase()===str}static isMixedCase(str){return StringHelper.isEmpty(str)?!1:!StringHelper.isLowerCase(str)&&!StringHelper.isUpperCase(str)}static isEmpty(str){return!str||str.length===0}static isBlank(str){return StringHelper.isEmpty(str)||str.trim().length===0}static removeCarriageChars(str){return StringHelper.isEmpty(str)?StringHelper.EMPTY_STRING:str.replace(/\r/g,"")}static removeWhitespaces(str){return StringHelper.isEmpty(str)?StringHelper.EMPTY_STRING:str.replace(/\s/g,"")}static removeEmptyStrings(elements){return elements?elements.filter(element=>!StringHelper.isEmpty(element)):[]}static substringBetween(str,left,right){if(StringHelper.isEmpty(str)||StringHelper.isEmpty(left)||StringHelper.isEmpty(right))return StringHelper.EMPTY_STRING;const start=str.indexOf(left);if(start!==-1){const end=str.indexOf(right,start+left.length);return end!==-1?str.substring(start+left.length,end):str.slice(start+left.length)}return StringHelper.EMPTY_STRING}static testRegex(regex,target){return new RegExp(regex).test(target)}static format(str,...tokens){const regex=/\{\{|\}\}|\{(\d+)\}/g;return StringHelper.isEmpty(str)?StringHelper.EMPTY_STRING:str.replace(regex,function(m,n){return m==="{{"?"{":m==="}}"?"}":tokens[n]})}static hashCode(str){let h=0;const l=str.length;let i=0;if(l>0)for(;i<l;)h=(h<<5)-h+str.charCodeAt(i++)|0;return h}static cleanVersion(version2){const versionArr=version2.split(".");for(;versionArr.length<3;)versionArr.push("0");return versionArr.slice(0,3).join(".")}}class UriHelper{static{__name(this,"UriHelper")}static{this.DEFAULT_URI="/"}static{this.DEFAULT_ADMIN_URI="/admin"}static setDomain(domain){UriHelper.domain=domain?.replace(/\/+$/,"")||void 0}static getUri(path,absolute){let uri=UriHelper.joinPath(UriHelper.DEFAULT_URI,UriHelper.relativePath(path));return absolute&&UriHelper.domain&&(uri=UriHelper.joinPath(UriHelper.domain,uri)),uri}static getAdminUri(path){const adminUri=UriHelper.getAdminUriPrefix();return UriHelper.getUri(UriHelper.joinPath(adminUri,UriHelper.relativePath(path)))}static getAdminUriPrefix(){return UriHelper.ADMIN_URI??UriHelper.DEFAULT_ADMIN_URI}static setAdminUri(value){UriHelper.ADMIN_URI=value}static getRestUri(path){return UriHelper.getAdminUri(UriHelper.joinPath("rest",UriHelper.relativePath(path)))}static addSitePrefix(path){return UriHelper.getAdminUri(UriHelper.joinPath("site",UriHelper.relativePath(path)))}static relativePath(path){return StringHelper.isBlank(path)?StringHelper.EMPTY_STRING:path.charAt(0)==="/"?path.substring(1):path}static isNavigatingOutsideOfXP(href,contentWindow){return href.charAt(0)==="/"?!1:UriHelper.trimWindowProtocolAndPortFromHref(href,contentWindow)===href}static trimWindowProtocolAndPortFromHref(href,contentWindow){let location2=contentWindow.location;return UriHelper.relativePath(href.replace(location2.protocol+"//"+location2.host,""))}static trimAnchor(trimMe){let index=trimMe.lastIndexOf("#");return index>=0?UriHelper.relativePath(trimMe.substring(0,index)):UriHelper.relativePath(trimMe)}static trimUrlParams(trimMe){let index=trimMe.lastIndexOf("?");return index>=0?trimMe.substring(0,index):trimMe}static joinPath(...paths){return StringHelper.removeEmptyStrings(paths).join("/").replace(/(^|[^:])\/{2,}/g,"$1/")}static getUrlLocation(url){return StringHelper.isBlank(url)?StringHelper.EMPTY_STRING:url.split(/\?|&/i)[0]}static decodeUrlParams(url){if(StringHelper.isBlank(url))return{};let array=url.split(/\?|&/i),params={},param;if(array.length>1)for(let i=1;i<array.length;i++)param=array[i].split("="),params[param[0]]=param.length>1?decodeURIComponent(param[1]):void 0;return params}static encodeUrlParams(params,prefix,encode=!0){if(!params)return StringHelper.EMPTY_STRING;let urlArray=[];for(let key in params)if(params.hasOwnProperty(key)&&params[key]!=null){let value=params[key],prefixedKey=prefix?prefix+"["+key+"]":key;typeof value=="object"?urlArray.push(this.encodeUrlParams(value,prefixedKey)):encode?urlArray.push(encodeURIComponent(prefixedKey)+"="+encodeURIComponent(value)):urlArray.push(prefixedKey+"="+value)}return urlArray.join("&")}static appendUrlParams(url,params,encode=!0){if(!params||Object.keys(params).length===0)return url;let urlParams=UriHelper.decodeUrlParams(url),hasParams=Object.keys(urlParams).length>0;return url+(hasParams?"&":"?")+UriHelper.encodeUrlParams(params,"",encode)}static isNavigatingWithinSamePage(url,contentWindow){const href=contentWindow.location.href;return url===UriHelper.trimAnchor(UriHelper.trimWindowProtocolAndPortFromHref(href,contentWindow))}static isDownloadLink(url){return url.indexOf("attachment/download")>0}}var HttpMethod;(function(HttpMethod2){HttpMethod2.GET="GET",HttpMethod2.POST="POST",HttpMethod2.PUT="PUT",HttpMethod2.DELETE="DELETE",HttpMethod2.HEAD="HEAD",HttpMethod2.CONNECT="CONNECT",HttpMethod2.OPTIONS="OPTIONS",HttpMethod2.TRACE="TRACE",HttpMethod2.PATCH="PATCH"})(HttpMethod||(HttpMethod={}));var ExceptionType;(function(ExceptionType2){ExceptionType2[ExceptionType2.INFO=0]="INFO",ExceptionType2[ExceptionType2.ERROR=1]="ERROR",ExceptionType2[ExceptionType2.WARNING=2]="WARNING"})(ExceptionType||(ExceptionType={}));class Exception{static{__name(this,"Exception")}constructor(message,type=ExceptionType.ERROR){this.message=message,this.type=type}getMessage(){return this.message}getType(){return this.type}}class StatusCode{static{__name(this,"StatusCode")}static{this.OK=200}static{this.NO_CONTENT=204}static{this.MULTIPLE_OPTIONS=300}static{this.REDIRECT=307}static{this.FORBIDDEN=403}static{this.NOT_FOUND=404}static{this.I_AM_A_TEAPOT=418}}class Messages{static{__name(this,"Messages")}static getMessages(){let messages=Store.instance().get("messages");return messages==null&&(messages=new Map,Store.instance().set("messages",messages)),messages}static setMessages(messages){messages&&(Messages.getMessages().clear(),Messages.addMessages(messages))}static addMessages(messages){if(messages)for(let key in messages)messages.hasOwnProperty(key)&&Messages.getMessages().set(key,messages[key])}static isEmpty(){return Messages.getMessages().size===0}static getMessage(key){return Messages.getMessages().get(key)}static hasMessage(key){return Messages.getMessages().has(key)}}function i18n(key,...args){return(Messages.hasMessage(key)?Messages.getMessage(key):`#${key}#`).replace(/{(\d+)}/g,function(_substring,...replaceArgs){return args[replaceArgs[0]]}).trim()}__name(i18n,"i18n");class RequestError extends Exception{static{__name(this,"RequestError")}constructor(statusCode,errorMsg){const notifyMsg=statusCode>0?errorMsg:i18n("notify.no_connection"),type=statusCode>=400&&statusCode<500?ExceptionType.WARNING:ExceptionType.ERROR;super(notifyMsg,type),this.statusCode=statusCode}getStatusCode(){return this.statusCode}isNotFound(){return this.statusCode===StatusCode.NOT_FOUND}}class Request{static{__name(this,"Request")}static{this.headers={}}constructor(method){this.method=HttpMethod.GET,this.timeoutMillis=1e4,this.request=new XMLHttpRequest,this.method=method}static setHeader(header,value){Request.headers[header]=value}setPath(value){return this.path=value,this}setParams(params){return this.params=params,this}setTimeout(timeoutMillis){return this.timeoutMillis=timeoutMillis,this}bindRequestEventsHandlers(){const deferred=Q.defer();return this.request.onreadystatechange=()=>{if(this.request.readyState===4){let errorJson=null;if(this.request.status===StatusCode.NO_CONTENT)deferred.resolve(null);else if(this.request.status>=StatusCode.OK&&this.request.status<StatusCode.MULTIPLE_OPTIONS)deferred.resolve(this.request.response);else if(this.request.status===StatusCode.FORBIDDEN)deferred.reject(new RequestError(StatusCode.FORBIDDEN,"Access denied"));else{try{errorJson=this.request.response?JSON.parse(this.request.response):null}catch(error){deferred.reject(error)}deferred.reject(new RequestError(this.request.status,errorJson?errorJson.message:""))}}},deferred}sendRequest(){const deferred=this.bindRequestEventsHandlers();return this.request.send(this.createRequestData()),deferred.promise}send(){return this.prepareRequest(),this.sendRequest()}getStatus(){return this.request.status}createRequestData(){return null}prepareRequest(){this.request.open(this.method,this.createRequestURI(),!0);for(const header in Request.headers)this.request.setRequestHeader(header,Request.headers[header]);this.request.timeout=this.timeoutMillis}}var BrowserName;(function(BrowserName2){BrowserName2[BrowserName2.CHROME=0]="CHROME",BrowserName2[BrowserName2.FIREFOX=1]="FIREFOX",BrowserName2[BrowserName2.OPERA=2]="OPERA",BrowserName2[BrowserName2.SAFARI=3]="SAFARI",BrowserName2[BrowserName2.MSIE=4]="MSIE",BrowserName2[BrowserName2.TRIDENT=5]="TRIDENT"})(BrowserName||(BrowserName={}));class BrowserHelper{static{__name(this,"BrowserHelper")}static{this.AVAILABLE_VERSIONS={}}static{this.IS_IE=!1}static isAvailableBrowser(){switch(BrowserHelper.BROWSER_NAME||this.init(),BrowserHelper.BROWSER_NAME){case BrowserName.CHROME:if(BrowserHelper.BROWSER_VERSION>=BrowserHelper.AVAILABLE_VERSIONS[BrowserHelper.BROWSER_NAME])return!0;break;case BrowserName.FIREFOX:if(BrowserHelper.BROWSER_VERSION>=BrowserHelper.AVAILABLE_VERSIONS[BrowserHelper.BROWSER_NAME])return!0;break}return!1}static isOldBrowser(){return BrowserHelper.BROWSER_NAME||this.init(),BrowserHelper.AVAILABLE_VERSIONS[BrowserHelper.BROWSER_NAME]>BrowserHelper.BROWSER_VERSION}static isIE(){return BrowserHelper.BROWSER_NAME||this.init(),BrowserHelper.IS_IE}static isOSX(){return/Mac/.test(navigator.platform)}static isIOS(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream}static isFirefox(){return navigator.userAgent.toLowerCase().indexOf("firefox")>-1}static isSafari(){return navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&!/CriOS/.exec(navigator.userAgent)}static isAndroid(){return/(android)/i.test(navigator.userAgent)}static isMobile(){return BrowserHelper.isIOS()||BrowserHelper.isAndroid()}static init(){let M=/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i.exec(navigator.userAgent)||[];BrowserHelper.BROWSER_NAME=BrowserName[M[1].toLocaleUpperCase()],BrowserHelper.BROWSER_VERSION=M[2],BrowserHelper.AVAILABLE_VERSIONS[BrowserName.CHROME]="39",BrowserHelper.AVAILABLE_VERSIONS[BrowserName.FIREFOX]="27",BrowserHelper.IS_IE=BrowserHelper.BROWSER_NAME===BrowserName.TRIDENT||BrowserHelper.BROWSER_NAME===BrowserName.MSIE||navigator.userAgent.indexOf("Edge/")>0}}class GetRequest extends Request{static{__name(this,"GetRequest")}constructor(){super(HttpMethod.GET)}prepareRequest(){super.prepareRequest(),this.request.setRequestHeader("Accept","application/json"),BrowserHelper.isIE()&&(this.request.setRequestHeader("Pragma","no-cache"),this.request.setRequestHeader("Cache-Control","no-cache"))}createRequestURI(){const uriString=UriHelper.appendUrlParams(this.path.toString(),this.params);return UriHelper.getUri(uriString,!0)}}class HeadRequest extends Request{static{__name(this,"HeadRequest")}constructor(){super(HttpMethod.HEAD)}prepareRequest(){super.prepareRequest(),BrowserHelper.isIE()&&(this.request.setRequestHeader("Pragma","no-cache"),this.request.setRequestHeader("Cache-Control","no-cache"))}createRequestURI(){const uriString=UriHelper.appendUrlParams(this.path.toString(),this.params);return UriHelper.getUri(uriString,!0)}}class Response{static{__name(this,"Response")}constructor(data,status){this.data=data,this.status=status}isBlank(){return!this.data}hasResult(){return!(this.data===null||this.data===void 0)}getResult(){return this.data}getStatus(){return this.status}}class JsonResponse extends Response{static{__name(this,"JsonResponse")}constructor(data,status){super(data,status),this.json=JSON.parse(data)}isBlank(){return!this.json}getJson(){return this.json}hasResult(){return!(this.json===null||this.json===void 0)}getResult(){return this.hasResult()?this.json.result?this.json.result:this.json:null}}class PostRequest extends Request{static{__name(this,"PostRequest")}constructor(){super(HttpMethod.POST),this.isFormRequest=!1}setIsFormRequest(value){this.isFormRequest=value}prepareRequest(){super.prepareRequest(),this.request.setRequestHeader("Accept","application/json"),this.isFormRequest||this.request.setRequestHeader("Content-Type","application/json;charset=UTF-8")}createRequestURI(){return UriHelper.getUri(this.path.toString(),!0)}createRequestData(){return this.isFormRequest?this.createFormData():JSON.stringify(this.params)}createFormData(){const formData=new FormData;for(const key of Object.keys(this.params))formData.append(key,this.params[key]);return formData}}class ResourceRequest{static{__name(this,"ResourceRequest")}constructor(){this.method=HttpMethod.GET,this.isFormRequest=!1,this.isJsonResponse=!0,this.pathElements=[]}getPostfixUri(){return this.postfixUri??UriHelper.getRestUri("")}addRequestPathElements(...items){this.pathElements.push(...items)}setMethod(value){if(typeof value=="string"){this.method=HttpMethod[value.toUpperCase()];return}this.method=value}setPostfixUri(value){return this.postfixUri=value,this}getRestPath(){return this.restPath||(this.restPath=Path.create().fromString(this.getPostfixUri()).build()),this.restPath}getRequestPath(){return Path.create().fromParent(this.getRestPath(),...this.pathElements).build()}getParams(){return{}}setTimeout(timeoutMillis){this.timeoutMillis=timeoutMillis}setHeavyOperation(value){this.heavyOperation=value}setIsFormRequest(value){this.isFormRequest=value}setIsJsonResponse(value){this.isJsonResponse=value}validate(){}send(){this.validate();const request=this.createRequest().setParams(this.getParams()).setPath(this.getRequestPath()).setTimeout(this.heavyOperation?0:this.timeoutMillis);return request.send().then(rawResponse=>this.isJsonResponse?new JsonResponse(rawResponse,request.getStatus()):new Response(rawResponse,request.getStatus()))}createRequest(){if(HttpMethod.GET===this.method)return new GetRequest;if(HttpMethod.POST===this.method){const request=new PostRequest;return request.setIsFormRequest(this.isFormRequest),request}if(HttpMethod.HEAD===this.method)return new HeadRequest;throw new Error(`Request for "${this.method}" HTTP method Not Implemented`)}sendAndParse(){return this.send().then(response=>this.parseResponse(response))}parseResponse(response){return response.getResult()}}class CONFIG{static{__name(this,"CONFIG")}static init(url){return CONFIG.loadAndCache(url)}static isTrue(property){return CONFIG.has(property)?CONFIG.getString(property)==="true":!1}static getConfig(){return CONFIG.CACHE}static has(property){return CONFIG.CACHE?.[property]!==void 0}static getString(property){return String(CONFIG.get(property))}static getNumber(property){const propertyValue=CONFIG.get(property);if(isNaN(propertyValue))throw Error(`Property ${property} is not a number`);return parseInt(String(propertyValue))}static getLocale(){return CONFIG.has("locale")?CONFIG.getString("locale"):"en"}static get(property){return CONFIG.getPropertyValue(property)}static getPropertyValue(property){if(property.indexOf(".")>0)return CONFIG.getNested(property);if(!CONFIG.has(property))throw Error(`Config property ${property} not found`);return CONFIG.CACHE[property]}static setConfig(config){CONFIG.CACHE=Object.freeze(Object.assign({},config));try{const adminUrl=CONFIG.getString("adminUrl");UriHelper.setAdminUri(adminUrl)}catch{}}static getNested(property){const propertyPaths=property.split(".");if(!CONFIG.has(propertyPaths[0]))throw Error(`Config property ${propertyPaths[0]} not found`);let result=CONFIG.getPropertyValue(propertyPaths[0]);for(let i=1;i<propertyPaths.length;i++)if(result=result[propertyPaths[i]],result===void 0)throw Error(`Incorrect property path: ${property}`);return result}static load(url){return new GetConfigRequest(url).send().then(response=>response.getResult())}static loadAndCache(url){return CONFIG.load(url).then(configJson=>(CONFIG.setConfig(configJson),Q(configJson)))}}class GetConfigRequest extends ResourceRequest{static{__name(this,"GetConfigRequest")}constructor(url){super(),this.url=url}getRequestPath(){return Path.create().fromString(this.url).build()}}const{entries,setPrototypeOf,isFrozen,getPrototypeOf,getOwnPropertyDescriptor}=Object;let{freeze,seal,create}=Object,{apply,construct}=typeof Reflect<"u"&&Reflect;freeze||(freeze=__name(function(x){return x},"freeze"));seal||(seal=__name(function(x){return x},"seal"));apply||(apply=__name(function(func,thisArg){for(var _len=arguments.length,args=new Array(_len>2?_len-2:0),_key=2;_key<_len;_key++)args[_key-2]=arguments[_key];return func.apply(thisArg,args)},"apply"));construct||(construct=__name(function(Func){for(var _len2=arguments.length,args=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++)args[_key2-1]=arguments[_key2];return new Func(...args)},"construct"));const arrayForEach=unapply(Array.prototype.forEach),arrayLastIndexOf=unapply(Array.prototype.lastIndexOf),arrayPop=unapply(Array.prototype.pop),arrayPush=unapply(Array.prototype.push),arraySplice=unapply(Array.prototype.splice),stringToLowerCase=unapply(String.prototype.toLowerCase),stringToString=unapply(String.prototype.toString),stringMatch=unapply(String.prototype.match),stringReplace=unapply(String.prototype.replace),stringIndexOf=unapply(String.prototype.indexOf),stringTrim=unapply(String.prototype.trim),objectHasOwnProperty=unapply(Object.prototype.hasOwnProperty),regExpTest=unapply(RegExp.prototype.test),typeErrorCreate=unconstruct(TypeError);function unapply(func){return function(thisArg){thisArg instanceof RegExp&&(thisArg.lastIndex=0);for(var _len3=arguments.length,args=new Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++)args[_key3-1]=arguments[_key3];return apply(func,thisArg,args)}}__name(unapply,"unapply");function unconstruct(Func){return function(){for(var _len4=arguments.length,args=new Array(_len4),_key4=0;_key4<_len4;_key4++)args[_key4]=arguments[_key4];return construct(Func,args)}}__name(unconstruct,"unconstruct");function addToSet(set,array){let transformCaseFunc=arguments.length>2&&arguments[2]!==void 0?arguments[2]:stringToLowerCase;setPrototypeOf&&setPrototypeOf(set,null);let l=array.length;for(;l--;){let element=array[l];if(typeof element=="string"){const lcElement=transformCaseFunc(element);lcElement!==element&&(isFrozen(array)||(array[l]=lcElement),element=lcElement)}set[element]=!0}return set}__name(addToSet,"addToSet");function cleanArray(array){for(let index=0;index<array.length;index++)objectHasOwnProperty(array,index)||(array[index]=null);return array}__name(cleanArray,"cleanArray");function clone(object){const newObject=create(null);for(const[property,value]of entries(object))objectHasOwnProperty(object,property)&&(Array.isArray(value)?newObject[property]=cleanArray(value):value&&typeof value=="object"&&value.constructor===Object?newObject[property]=clone(value):newObject[property]=value);return newObject}__name(clone,"clone");function lookupGetter(object,prop){for(;object!==null;){const desc=getOwnPropertyDescriptor(object,prop);if(desc){if(desc.get)return unapply(desc.get);if(typeof desc.value=="function")return unapply(desc.value)}object=getPrototypeOf(object)}function fallbackValue(){return null}return __name(fallbackValue,"fallbackValue"),fallbackValue}__name(lookupGetter,"lookupGetter");const html$1=freeze(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),svg$1=freeze(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),svgFilters=freeze(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),svgDisallowed=freeze(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),mathMl$1=freeze(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),mathMlDisallowed=freeze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),text=freeze(["#text"]),html=freeze(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),svg=freeze(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),mathMl=freeze(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),xml=freeze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),MUSTACHE_EXPR=seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ERB_EXPR=seal(/<%[\w\W]*|[\w\W]*%>/gm),TMPLIT_EXPR=seal(/\$\{[\w\W]*/gm),DATA_ATTR=seal(/^data-[\-\w.\u00B7-\uFFFF]+$/),ARIA_ATTR=seal(/^aria-[\-\w]+$/),IS_ALLOWED_URI=seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),IS_SCRIPT_OR_DATA=seal(/^(?:\w+script|data):/i),ATTR_WHITESPACE=seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),DOCTYPE_NAME=seal(/^html$/i),CUSTOM_ELEMENT=seal(/^[a-z][.\w]*(-[.\w]+)+$/i);var EXPRESSIONS=Object.freeze({__proto__:null,ARIA_ATTR,ATTR_WHITESPACE,CUSTOM_ELEMENT,DATA_ATTR,DOCTYPE_NAME,ERB_EXPR,IS_ALLOWED_URI,IS_SCRIPT_OR_DATA,MUSTACHE_EXPR,TMPLIT_EXPR});const NODE_TYPE={element:1,text:3,progressingInstruction:7,comment:8,document:9},getGlobal=__name(function(){return typeof window>"u"?null:window},"getGlobal"),_createTrustedTypesPolicy=__name(function(trustedTypes,purifyHostElement){if(typeof trustedTypes!="object"||typeof trustedTypes.createPolicy!="function")return null;let suffix=null;const ATTR_NAME="data-tt-policy-suffix";purifyHostElement&&purifyHostElement.hasAttribute(ATTR_NAME)&&(suffix=purifyHostElement.getAttribute(ATTR_NAME));const policyName="dompurify"+(suffix?"#"+suffix:"");try{return trustedTypes.createPolicy(policyName,{createHTML(html2){return html2},createScriptURL(scriptUrl){return scriptUrl}})}catch{return null}},"_createTrustedTypesPolicy"),_createHooksMap=__name(function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},"_createHooksMap");function createDOMPurify(){let window2=arguments.length>0&&arguments[0]!==void 0?arguments[0]:getGlobal();const DOMPurify=__name(root=>createDOMPurify(root),"DOMPurify");if(DOMPurify.version="3.3.1",DOMPurify.removed=[],!window2||!window2.document||window2.document.nodeType!==NODE_TYPE.document||!window2.Element)return DOMPurify.isSupported=!1,DOMPurify;let{document:document2}=window2;const originalDocument=document2,currentScript=originalDocument.currentScript,{DocumentFragment,HTMLTemplateElement,Node:Node2,Element:Element2,NodeFilter,NamedNodeMap=window2.NamedNodeMap||window2.MozNamedAttrMap,HTMLFormElement,DOMParser:DOMParser2,trustedTypes}=window2,ElementPrototype=Element2.prototype,cloneNode=lookupGetter(ElementPrototype,"cloneNode"),remove=lookupGetter(ElementPrototype,"remove"),getNextSibling=lookupGetter(ElementPrototype,"nextSibling"),getChildNodes=lookupGetter(ElementPrototype,"childNodes"),getParentNode=lookupGetter(ElementPrototype,"parentNode");if(typeof HTMLTemplateElement=="function"){const template=document2.createElement("template");template.content&&template.content.ownerDocument&&(document2=template.content.ownerDocument)}let trustedTypesPolicy,emptyHTML="";const{implementation,createNodeIterator,createDocumentFragment,getElementsByTagName}=document2,{importNode}=originalDocument;let hooks=_createHooksMap();DOMPurify.isSupported=typeof entries=="function"&&typeof getParentNode=="function"&&implementation&&implementation.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:MUSTACHE_EXPR2,ERB_EXPR:ERB_EXPR2,TMPLIT_EXPR:TMPLIT_EXPR2,DATA_ATTR:DATA_ATTR2,ARIA_ATTR:ARIA_ATTR2,IS_SCRIPT_OR_DATA:IS_SCRIPT_OR_DATA2,ATTR_WHITESPACE:ATTR_WHITESPACE2,CUSTOM_ELEMENT:CUSTOM_ELEMENT2}=EXPRESSIONS;let{IS_ALLOWED_URI:IS_ALLOWED_URI$1}=EXPRESSIONS,ALLOWED_TAGS=null;const DEFAULT_ALLOWED_TAGS=addToSet({},[...html$1,...svg$1,...svgFilters,...mathMl$1,...text]);let ALLOWED_ATTR=null;const DEFAULT_ALLOWED_ATTR=addToSet({},[...html,...svg,...mathMl,...xml]);let CUSTOM_ELEMENT_HANDLING=Object.seal(create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),FORBID_TAGS=null,FORBID_ATTR=null;const EXTRA_ELEMENT_HANDLING=Object.seal(create(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ALLOW_ARIA_ATTR=!0,ALLOW_DATA_ATTR=!0,ALLOW_UNKNOWN_PROTOCOLS=!1,ALLOW_SELF_CLOSE_IN_ATTR=!0,SAFE_FOR_TEMPLATES=!1,SAFE_FOR_XML=!0,WHOLE_DOCUMENT=!1,SET_CONFIG=!1,FORCE_BODY=!1,RETURN_DOM=!1,RETURN_DOM_FRAGMENT=!1,RETURN_TRUSTED_TYPE=!1,SANITIZE_DOM=!0,SANITIZE_NAMED_PROPS=!1;const SANITIZE_NAMED_PROPS_PREFIX="user-content-";let KEEP_CONTENT=!0,IN_PLACE=!1,USE_PROFILES={},FORBID_CONTENTS=null;const DEFAULT_FORBID_CONTENTS=addToSet({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let DATA_URI_TAGS=null;const DEFAULT_DATA_URI_TAGS=addToSet({},["audio","video","img","source","image","track"]);let URI_SAFE_ATTRIBUTES=null;const DEFAULT_URI_SAFE_ATTRIBUTES=addToSet({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),MATHML_NAMESPACE="http://www.w3.org/1998/Math/MathML",SVG_NAMESPACE="http://www.w3.org/2000/svg",HTML_NAMESPACE="http://www.w3.org/1999/xhtml";let NAMESPACE=HTML_NAMESPACE,IS_EMPTY_INPUT=!1,ALLOWED_NAMESPACES=null;const DEFAULT_ALLOWED_NAMESPACES=addToSet({},[MATHML_NAMESPACE,SVG_NAMESPACE,HTML_NAMESPACE],stringToString);let MATHML_TEXT_INTEGRATION_POINTS=addToSet({},["mi","mo","mn","ms","mtext"]),HTML_INTEGRATION_POINTS=addToSet({},["annotation-xml"]);const COMMON_SVG_AND_HTML_ELEMENTS=addToSet({},["title","style","font","a","script"]);let PARSER_MEDIA_TYPE=null;const SUPPORTED_PARSER_MEDIA_TYPES=["application/xhtml+xml","text/html"],DEFAULT_PARSER_MEDIA_TYPE="text/html";let transformCaseFunc=null,CONFIG2=null;const formElement=document2.createElement("form"),isRegexOrFunction=__name(function(testValue){return testValue instanceof RegExp||testValue instanceof Function},"isRegexOrFunction"),_parseConfig=__name(function(){let cfg=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(CONFIG2&&CONFIG2===cfg)){if((!cfg||typeof cfg!="object")&&(cfg={}),cfg=clone(cfg),PARSER_MEDIA_TYPE=SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE)===-1?DEFAULT_PARSER_MEDIA_TYPE:cfg.PARSER_MEDIA_TYPE,transformCaseFunc=PARSER_MEDIA_TYPE==="application/xhtml+xml"?stringToString:stringToLowerCase,ALLOWED_TAGS=objectHasOwnProperty(cfg,"ALLOWED_TAGS")?addToSet({},cfg.ALLOWED_TAGS,transformCaseFunc):DEFAULT_ALLOWED_TAGS,ALLOWED_ATTR=objectHasOwnProperty(cfg,"ALLOWED_ATTR")?addToSet({},cfg.ALLOWED_ATTR,transformCaseFunc):DEFAULT_ALLOWED_ATTR,ALLOWED_NAMESPACES=objectHasOwnProperty(cfg,"ALLOWED_NAMESPACES")?addToSet({},cfg.ALLOWED_NAMESPACES,stringToString):DEFAULT_ALLOWED_NAMESPACES,URI_SAFE_ATTRIBUTES=objectHasOwnProperty(cfg,"ADD_URI_SAFE_ATTR")?addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES),cfg.ADD_URI_SAFE_ATTR,transformCaseFunc):DEFAULT_URI_SAFE_ATTRIBUTES,DATA_URI_TAGS=objectHasOwnProperty(cfg,"ADD_DATA_URI_TAGS")?addToSet(clone(DEFAULT_DATA_URI_TAGS),cfg.ADD_DATA_URI_TAGS,transformCaseFunc):DEFAULT_DATA_URI_TAGS,FORBID_CONTENTS=objectHasOwnProperty(cfg,"FORBID_CONTENTS")?addToSet({},cfg.FORBID_CONTENTS,transformCaseFunc):DEFAULT_FORBID_CONTENTS,FORBID_TAGS=objectHasOwnProperty(cfg,"FORBID_TAGS")?addToSet({},cfg.FORBID_TAGS,transformCaseFunc):clone({}),FORBID_ATTR=objectHasOwnProperty(cfg,"FORBID_ATTR")?addToSet({},cfg.FORBID_ATTR,transformCaseFunc):clone({}),USE_PROFILES=objectHasOwnProperty(cfg,"USE_PROFILES")?cfg.USE_PROFILES:!1,ALLOW_ARIA_ATTR=cfg.ALLOW_ARIA_ATTR!==!1,ALLOW_DATA_ATTR=cfg.ALLOW_DATA_ATTR!==!1,ALLOW_UNKNOWN_PROTOCOLS=cfg.ALLOW_UNKNOWN_PROTOCOLS||!1,ALLOW_SELF_CLOSE_IN_ATTR=cfg.ALLOW_SELF_CLOSE_IN_ATTR!==!1,SAFE_FOR_TEMPLATES=cfg.SAFE_FOR_TEMPLATES||!1,SAFE_FOR_XML=cfg.SAFE_FOR_XML!==!1,WHOLE_DOCUMENT=cfg.WHOLE_DOCUMENT||!1,RETURN_DOM=cfg.RETURN_DOM||!1,RETURN_DOM_FRAGMENT=cfg.RETURN_DOM_FRAGMENT||!1,RETURN_TRUSTED_TYPE=cfg.RETURN_TRUSTED_TYPE||!1,FORCE_BODY=cfg.FORCE_BODY||!1,SANITIZE_DOM=cfg.SANITIZE_DOM!==!1,SANITIZE_NAMED_PROPS=cfg.SANITIZE_NAMED_PROPS||!1,KEEP_CONTENT=cfg.KEEP_CONTENT!==!1,IN_PLACE=cfg.IN_PLACE||!1,IS_ALLOWED_URI$1=cfg.ALLOWED_URI_REGEXP||IS_ALLOWED_URI,NAMESPACE=cfg.NAMESPACE||HTML_NAMESPACE,MATHML_TEXT_INTEGRATION_POINTS=cfg.MATHML_TEXT_INTEGRATION_POINTS||MATHML_TEXT_INTEGRATION_POINTS,HTML_INTEGRATION_POINTS=cfg.HTML_INTEGRATION_POINTS||HTML_INTEGRATION_POINTS,CUSTOM_ELEMENT_HANDLING=cfg.CUSTOM_ELEMENT_HANDLING||{},cfg.CUSTOM_ELEMENT_HANDLING&&isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(CUSTOM_ELEMENT_HANDLING.tagNameCheck=cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck),cfg.CUSTOM_ELEMENT_HANDLING&&isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(CUSTOM_ELEMENT_HANDLING.attributeNameCheck=cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),cfg.CUSTOM_ELEMENT_HANDLING&&typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),SAFE_FOR_TEMPLATES&&(ALLOW_DATA_ATTR=!1),RETURN_DOM_FRAGMENT&&(RETURN_DOM=!0),USE_PROFILES&&(ALLOWED_TAGS=addToSet({},text),ALLOWED_ATTR=[],USE_PROFILES.html===!0&&(addToSet(ALLOWED_TAGS,html$1),addToSet(ALLOWED_ATTR,html)),USE_PROFILES.svg===!0&&(addToSet(ALLOWED_TAGS,svg$1),addToSet(ALLOWED_ATTR,svg),addToSet(ALLOWED_ATTR,xml)),USE_PROFILES.svgFilters===!0&&(addToSet(ALLOWED_TAGS,svgFilters),addToSet(ALLOWED_ATTR,svg),addToSet(ALLOWED_ATTR,xml)),USE_PROFILES.mathMl===!0&&(addToSet(ALLOWED_TAGS,mathMl$1),addToSet(ALLOWED_ATTR,mathMl),addToSet(ALLOWED_ATTR,xml))),cfg.ADD_TAGS&&(typeof cfg.ADD_TAGS=="function"?EXTRA_ELEMENT_HANDLING.tagCheck=cfg.ADD_TAGS:(ALLOWED_TAGS===DEFAULT_ALLOWED_TAGS&&(ALLOWED_TAGS=clone(ALLOWED_TAGS)),addToSet(ALLOWED_TAGS,cfg.ADD_TAGS,transformCaseFunc))),cfg.ADD_ATTR&&(typeof cfg.ADD_ATTR=="function"?EXTRA_ELEMENT_HANDLING.attributeCheck=cfg.ADD_ATTR:(ALLOWED_ATTR===DEFAULT_ALLOWED_ATTR&&(ALLOWED_ATTR=clone(ALLOWED_ATTR)),addToSet(ALLOWED_ATTR,cfg.ADD_ATTR,transformCaseFunc))),cfg.ADD_URI_SAFE_ATTR&&addToSet(URI_SAFE_ATTRIBUTES,cfg.ADD_URI_SAFE_ATTR,transformCaseFunc),cfg.FORBID_CONTENTS&&(FORBID_CONTENTS===DEFAULT_FORBID_CONTENTS&&(FORBID_CONTENTS=clone(FORBID_CONTENTS)),addToSet(FORBID_CONTENTS,cfg.FORBID_CONTENTS,transformCaseFunc)),cfg.ADD_FORBID_CONTENTS&&(FORBID_CONTENTS===DEFAULT_FORBID_CONTENTS&&(FORBID_CONTENTS=clone(FORBID_CONTENTS)),addToSet(FORBID_CONTENTS,cfg.ADD_FORBID_CONTENTS,transformCaseFunc)),KEEP_CONTENT&&(ALLOWED_TAGS["#text"]=!0),WHOLE_DOCUMENT&&addToSet(ALLOWED_TAGS,["html","head","body"]),ALLOWED_TAGS.table&&(addToSet(ALLOWED_TAGS,["tbody"]),delete FORBID_TAGS.tbody),cfg.TRUSTED_TYPES_POLICY){if(typeof cfg.TRUSTED_TYPES_POLICY.createHTML!="function")throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');trustedTypesPolicy=cfg.TRUSTED_TYPES_POLICY,emptyHTML=trustedTypesPolicy.createHTML("")}else trustedTypesPolicy===void 0&&(trustedTypesPolicy=_createTrustedTypesPolicy(trustedTypes,currentScript)),trustedTypesPolicy!==null&&typeof emptyHTML=="string"&&(emptyHTML=trustedTypesPolicy.createHTML(""));freeze&&freeze(cfg),CONFIG2=cfg}},"_parseConfig"),ALL_SVG_TAGS=addToSet({},[...svg$1,...svgFilters,...svgDisallowed]),ALL_MATHML_TAGS=addToSet({},[...mathMl$1,...mathMlDisallowed]),_checkValidNamespace=__name(function(element){let parent2=getParentNode(element);(!parent2||!parent2.tagName)&&(parent2={namespaceURI:NAMESPACE,tagName:"template"});const tagName=stringToLowerCase(element.tagName),parentTagName=stringToLowerCase(parent2.tagName);return ALLOWED_NAMESPACES[element.namespaceURI]?element.namespaceURI===SVG_NAMESPACE?parent2.namespaceURI===HTML_NAMESPACE?tagName==="svg":parent2.namespaceURI===MATHML_NAMESPACE?tagName==="svg"&&(parentTagName==="annotation-xml"||MATHML_TEXT_INTEGRATION_POINTS[parentTagName]):!!ALL_SVG_TAGS[tagName]:element.namespaceURI===MATHML_NAMESPACE?parent2.namespaceURI===HTML_NAMESPACE?tagName==="math":parent2.namespaceURI===SVG_NAMESPACE?tagName==="math"&&HTML_INTEGRATION_POINTS[parentTagName]:!!ALL_MATHML_TAGS[tagName]:element.namespaceURI===HTML_NAMESPACE?parent2.namespaceURI===SVG_NAMESPACE&&!HTML_INTEGRATION_POINTS[parentTagName]||parent2.namespaceURI===MATHML_NAMESPACE&&!MATHML_TEXT_INTEGRATION_POINTS[parentTagName]?!1:!ALL_MATHML_TAGS[tagName]&&(COMMON_SVG_AND_HTML_ELEMENTS[tagName]||!ALL_SVG_TAGS[tagName]):!!(PARSER_MEDIA_TYPE==="application/xhtml+xml"&&ALLOWED_NAMESPACES[element.namespaceURI]):!1},"_checkValidNamespace"),_forceRemove=__name(function(node){arrayPush(DOMPurify.removed,{element:node});try{getParentNode(node).removeChild(node)}catch{remove(node)}},"_forceRemove"),_removeAttribute=__name(function(name,element){try{arrayPush(DOMPurify.removed,{attribute:element.getAttributeNode(name),from:element})}catch{arrayPush(DOMPurify.removed,{attribute:null,from:element})}if(element.removeAttribute(name),name==="is")if(RETURN_DOM||RETURN_DOM_FRAGMENT)try{_forceRemove(element)}catch{}else try{element.setAttribute(name,"")}catch{}},"_removeAttribute"),_initDocument=__name(function(dirty){let doc=null,leadingWhitespace=null;if(FORCE_BODY)dirty="<remove></remove>"+dirty;else{const matches=stringMatch(dirty,/^[\r\n\t ]+/);leadingWhitespace=matches&&matches[0]}PARSER_MEDIA_TYPE==="application/xhtml+xml"&&NAMESPACE===HTML_NAMESPACE&&(dirty='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+dirty+"</body></html>");const dirtyPayload=trustedTypesPolicy?trustedTypesPolicy.createHTML(dirty):dirty;if(NAMESPACE===HTML_NAMESPACE)try{doc=new DOMParser2().parseFromString(dirtyPayload,PARSER_MEDIA_TYPE)}catch{}if(!doc||!doc.documentElement){doc=implementation.createDocument(NAMESPACE,"template",null);try{doc.documentElement.innerHTML=IS_EMPTY_INPUT?emptyHTML:dirtyPayload}catch{}}const body=doc.body||doc.documentElement;return dirty&&leadingWhitespace&&body.insertBefore(document2.createTextNode(leadingWhitespace),body.childNodes[0]||null),NAMESPACE===HTML_NAMESPACE?getElementsByTagName.call(doc,WHOLE_DOCUMENT?"html":"body")[0]:WHOLE_DOCUMENT?doc.documentElement:body},"_initDocument"),_createNodeIterator=__name(function(root){return createNodeIterator.call(root.ownerDocument||root,root,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_PROCESSING_INSTRUCTION|NodeFilter.SHOW_CDATA_SECTION,null)},"_createNodeIterator"),_isClobbered=__name(function(element){return element instanceof HTMLFormElement&&(typeof element.nodeName!="string"||typeof element.textContent!="string"||typeof element.removeChild!="function"||!(element.attributes instanceof NamedNodeMap)||typeof element.removeAttribute!="function"||typeof element.setAttribute!="function"||typeof element.namespaceURI!="string"||typeof element.insertBefore!="function"||typeof element.hasChildNodes!="function")},"_isClobbered"),_isNode=__name(function(value){return typeof Node2=="function"&&value instanceof Node2},"_isNode");function _executeHooks(hooks2,currentNode,data){arrayForEach(hooks2,hook=>{hook.call(DOMPurify,currentNode,data,CONFIG2)})}__name(_executeHooks,"_executeHooks");const _sanitizeElements=__name(function(currentNode){let content=null;if(_executeHooks(hooks.beforeSanitizeElements,currentNode,null),_isClobbered(currentNode))return _forceRemove(currentNode),!0;const tagName=transformCaseFunc(currentNode.nodeName);if(_executeHooks(hooks.uponSanitizeElement,currentNode,{tagName,allowedTags:ALLOWED_TAGS}),SAFE_FOR_XML&&currentNode.hasChildNodes()&&!_isNode(currentNode.firstElementChild)&&regExpTest(/<[/\w!]/g,currentNode.innerHTML)&&regExpTest(/<[/\w!]/g,currentNode.textContent)||currentNode.nodeType===NODE_TYPE.progressingInstruction||SAFE_FOR_XML&&currentNode.nodeType===NODE_TYPE.comment&&regExpTest(/<[/\w]/g,currentNode.data))return _forceRemove(currentNode),!0;if(!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function&&EXTRA_ELEMENT_HANDLING.tagCheck(tagName))&&(!ALLOWED_TAGS[tagName]||FORBID_TAGS[tagName])){if(!FORBID_TAGS[tagName]&&_isBasicCustomElement(tagName)&&(CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp&&regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck,tagName)||CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function&&CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)))return!1;if(KEEP_CONTENT&&!FORBID_CONTENTS[tagName]){const parentNode=getParentNode(currentNode)||currentNode.parentNode,childNodes=getChildNodes(currentNode)||currentNode.childNodes;if(childNodes&&parentNode){const childCount=childNodes.length;for(let i=childCount-1;i>=0;--i){const childClone=cloneNode(childNodes[i],!0);childClone.__removalCount=(currentNode.__removalCount||0)+1,parentNode.insertBefore(childClone,getNextSibling(currentNode))}}}return _forceRemove(currentNode),!0}return currentNode instanceof Element2&&!_checkValidNamespace(currentNode)||(tagName==="noscript"||tagName==="noembed"||tagName==="noframes")&&regExpTest(/<\/no(script|embed|frames)/i,currentNode.innerHTML)?(_forceRemove(currentNode),!0):(SAFE_FOR_TEMPLATES&&currentNode.nodeType===NODE_TYPE.text&&(content=currentNode.textContent,arrayForEach([MUSTACHE_EXPR2,ERB_EXPR2,TMPLIT_EXPR2],expr=>{content=stringReplace(content,expr," ")}),currentNode.textContent!==content&&(arrayPush(DOMPurify.removed,{element:currentNode.cloneNode()}),currentNode.textContent=content)),_executeHooks(hooks.afterSanitizeElements,currentNode,null),!1)},"_sanitizeElements"),_isValidAttribute=__name(function(lcTag,lcName,value){if(SANITIZE_DOM&&(lcName==="id"||lcName==="name")&&(value in document2||value in formElement))return!1;if(!(ALLOW_DATA_ATTR&&!FORBID_ATTR[lcName]&&regExpTest(DATA_ATTR2,lcName))){if(!(ALLOW_ARIA_ATTR&&regExpTest(ARIA_ATTR2,lcName))){if(!(EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function&&EXTRA_ELEMENT_HANDLING.attributeCheck(lcName,lcTag))){if(!ALLOWED_ATTR[lcName]||FORBID_ATTR[lcName]){if(!(_isBasicCustomElement(lcTag)&&(CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp&&regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck,lcTag)||CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function&&CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag))&&(CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp&&regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck,lcName)||CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function&&CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName,lcTag))||lcName==="is"&&CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp&&regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck,value)||CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function&&CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))))return!1}else if(!URI_SAFE_ATTRIBUTES[lcName]){if(!regExpTest(IS_ALLOWED_URI$1,stringReplace(value,ATTR_WHITESPACE2,""))){if(!((lcName==="src"||lcName==="xlink:href"||lcName==="href")&&lcTag!=="script"&&stringIndexOf(value,"data:")===0&&DATA_URI_TAGS[lcTag])){if(!(ALLOW_UNKNOWN_PROTOCOLS&&!regExpTest(IS_SCRIPT_OR_DATA2,stringReplace(value,ATTR_WHITESPACE2,"")))){if(value)return!1}}}}}}}return!0},"_isValidAttribute"),_isBasicCustomElement=__name(function(tagName){return tagName!=="annotation-xml"&&stringMatch(tagName,CUSTOM_ELEMENT2)},"_isBasicCustomElement"),_sanitizeAttributes=__name(function(currentNode){_executeHooks(hooks.beforeSanitizeAttributes,currentNode,null);const{attributes}=currentNode;if(!attributes||_isClobbered(currentNode))return;const hookEvent={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ALLOWED_ATTR,forceKeepAttr:void 0};let l=attributes.length;for(;l--;){const attr=attributes[l],{name,namespaceURI,value:attrValue}=attr,lcName=transformCaseFunc(name),initValue=attrValue;let value=name==="value"?initValue:stringTrim(initValue);if(hookEvent.attrName=lcName,hookEvent.attrValue=value,hookEvent.keepAttr=!0,hookEvent.forceKeepAttr=void 0,_executeHooks(hooks.uponSanitizeAttribute,currentNode,hookEvent),value=hookEvent.attrValue,SANITIZE_NAMED_PROPS&&(lcName==="id"||lcName==="name")&&(_removeAttribute(name,currentNode),value=SANITIZE_NAMED_PROPS_PREFIX+value),SAFE_FOR_XML&&regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i,value)){_removeAttribute(name,currentNode);continue}if(lcName==="attributename"&&stringMatch(value,"href")){_removeAttribute(name,currentNode);continue}if(hookEvent.forceKeepAttr)continue;if(!hookEvent.keepAttr){_removeAttribute(name,currentNode);continue}if(!ALLOW_SELF_CLOSE_IN_ATTR&&regExpTest(/\/>/i,value)){_removeAttribute(name,currentNode);continue}SAFE_FOR_TEMPLATES&&arrayForEach([MUSTACHE_EXPR2,ERB_EXPR2,TMPLIT_EXPR2],expr=>{value=stringReplace(value,expr," ")});const lcTag=transformCaseFunc(currentNode.nodeName);if(!_isValidAttribute(lcTag,lcName,value)){_removeAttribute(name,currentNode);continue}if(trustedTypesPolicy&&typeof trustedTypes=="object"&&typeof trustedTypes.getAttributeType=="function"&&!namespaceURI)switch(trustedTypes.getAttributeType(lcTag,lcName)){case"TrustedHTML":{value=trustedTypesPolicy.createHTML(value);break}case"TrustedScriptURL":{value=trustedTypesPolicy.createScriptURL(value);break}}if(value!==initValue)try{namespaceURI?currentNode.setAttributeNS(namespaceURI,name,value):currentNode.setAttribute(name,value),_isClobbered(currentNode)?_forceRemove(currentNode):arrayPop(DOMPurify.removed)}catch{_removeAttribute(name,currentNode)}}_executeHooks(hooks.afterSanitizeAttributes,currentNode,null)},"_sanitizeAttributes"),_sanitizeShadowDOM=__name(function _sanitizeShadowDOM2(fragment){let shadowNode=null;const shadowIterator=_createNodeIterator(fragment);for(_executeHooks(hooks.beforeSanitizeShadowDOM,fragment,null);shadowNode=shadowIterator.nextNode();)_executeHooks(hooks.uponSanitizeShadowNode,shadowNode,null),_sanitizeElements(shadowNode),_sanitizeAttributes(shadowNode),shadowNode.content instanceof DocumentFragment&&_sanitizeShadowDOM2(shadowNode.content);_executeHooks(hooks.afterSanitizeShadowDOM,fragment,null)},"_sanitizeShadowDOM");return DOMPurify.sanitize=function(dirty){let cfg=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},body=null,importedNode=null,currentNode=null,returnNode=null;if(IS_EMPTY_INPUT=!dirty,IS_EMPTY_INPUT&&(dirty="<!-->"),typeof dirty!="string"&&!_isNode(dirty))if(typeof dirty.toString=="function"){if(dirty=dirty.toString(),typeof dirty!="string")throw typeErrorCreate("dirty is not a string, aborting")}else throw typeErrorCreate("toString is not a function");if(!DOMPurify.isSupported)return dirty;if(SET_CONFIG||_parseConfig(cfg),DOMPurify.removed=[],typeof dirty=="string"&&(IN_PLACE=!1),IN_PLACE){if(dirty.nodeName){const tagName=transformCaseFunc(dirty.nodeName);if(!ALLOWED_TAGS[tagName]||FORBID_TAGS[tagName])throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place")}}else if(dirty instanceof Node2)body=_initDocument("<!---->"),importedNode=body.ownerDocument.importNode(dirty,!0),importedNode.nodeType===NODE_TYPE.element&&importedNode.nodeName==="BODY"||importedNode.nodeName==="HTML"?body=importedNode:body.appendChild(importedNode);else{if(!RETURN_DOM&&!SAFE_FOR_TEMPLATES&&!WHOLE_DOCUMENT&&dirty.indexOf("<")===-1)return trustedTypesPolicy&&RETURN_TRUSTED_TYPE?trustedTypesPolicy.createHTML(dirty):dirty;if(body=_initDocument(dirty),!body)return RETURN_DOM?null:RETURN_TRUSTED_TYPE?emptyHTML:""}body&&FORCE_BODY&&_forceRemove(body.firstChild);const nodeIterator=_createNodeIterator(IN_PLACE?dirty:body);for(;currentNode=nodeIterator.nextNode();)_sanitizeElements(currentNode),_sanitizeAttributes(currentNode),currentNode.content instanceof DocumentFragment&&_sanitizeShadowDOM(currentNode.content);if(IN_PLACE)return dirty;if(RETURN_DOM){if(RETURN_DOM_FRAGMENT)for(returnNode=createDocumentFragment.call(body.ownerDocument);body.firstChild;)returnNode.appendChild(body.firstChild);else returnNode=body;return(ALLOWED_ATTR.shadowroot||ALLOWED_ATTR.shadowrootmode)&&(returnNode=importNode.call(originalDocument,returnNode,!0)),returnNode}let serializedHTML=WHOLE_DOCUMENT?body.outerHTML:body.innerHTML;return WHOLE_DOCUMENT&&ALLOWED_TAGS["!doctype"]&&body.ownerDocument&&body.ownerDocument.doctype&&body.ownerDocument.doctype.name&&regExpTest(DOCTYPE_NAME,body.ownerDocument.doctype.name)&&(serializedHTML="<!DOCTYPE "+body.ownerDocument.doctype.name+`>
8
+ `+serializedHTML),SAFE_FOR_TEMPLATES&&arrayForEach([MUSTACHE_EXPR2,ERB_EXPR2,TMPLIT_EXPR2],expr=>{serializedHTML=stringReplace(serializedHTML,expr," ")}),trustedTypesPolicy&&RETURN_TRUSTED_TYPE?trustedTypesPolicy.createHTML(serializedHTML):serializedHTML},DOMPurify.setConfig=function(){let cfg=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_parseConfig(cfg),SET_CONFIG=!0},DOMPurify.clearConfig=function(){CONFIG2=null,SET_CONFIG=!1},DOMPurify.isValidAttribute=function(tag,attr,value){CONFIG2||_parseConfig({});const lcTag=transformCaseFunc(tag),lcName=transformCaseFunc(attr);return _isValidAttribute(lcTag,lcName,value)},DOMPurify.addHook=function(entryPoint,hookFunction){typeof hookFunction=="function"&&arrayPush(hooks[entryPoint],hookFunction)},DOMPurify.removeHook=function(entryPoint,hookFunction){if(hookFunction!==void 0){const index=arrayLastIndexOf(hooks[entryPoint],hookFunction);return index===-1?void 0:arraySplice(hooks[entryPoint],index,1)[0]}return arrayPop(hooks[entryPoint])},DOMPurify.removeHooks=function(entryPoint){hooks[entryPoint]=[]},DOMPurify.removeAllHooks=function(){hooks=_createHooksMap()},DOMPurify}__name(createDOMPurify,"createDOMPurify");var purify=createDOMPurify(),version={},hasRequiredVersion;function requireVersion(){return hasRequiredVersion||(hasRequiredVersion=1,(function(factory){factory($)})(function($2){return $2.ui=$2.ui||{},$2.ui.version="1.14.1"})),version}__name(requireVersion,"requireVersion");requireVersion();var focusable={},hasRequiredFocusable;function requireFocusable(){return hasRequiredFocusable||(hasRequiredFocusable=1,(function(factory){factory($)})(function($2){return $2.ui.focusable=function(element,hasTabindex){var map,mapName,img,focusableIfVisible,fieldset,nodeName=element.nodeName.toLowerCase();return nodeName==="area"?(map=element.parentNode,mapName=map.name,!element.href||!mapName||map.nodeName.toLowerCase()!=="map"?!1:(img=$2("img[usemap='#"+mapName+"']"),img.length>0&&img.is(":visible"))):(/^(input|select|textarea|button|object)$/.test(nodeName)?(focusableIfVisible=!element.disabled,focusableIfVisible&&(fieldset=$2(element).closest("fieldset")[0],fieldset&&(focusableIfVisible=!fieldset.disabled))):nodeName==="a"?focusableIfVisible=element.href||hasTabindex:focusableIfVisible=hasTabindex,focusableIfVisible&&$2(element).is(":visible")&&$2(element).css("visibility")==="visible")},$2.extend($2.expr.pseudos,{focusable:__name(function(element){return $2.ui.focusable(element,$2.attr(element,"tabindex")!=null)},"focusable")}),$2.ui.focusable})),focusable}__name(requireFocusable,"requireFocusable");requireFocusable();var tabbable={},hasRequiredTabbable;function requireTabbable(){return hasRequiredTabbable||(hasRequiredTabbable=1,(function(factory){factory($)})(function($2){return $2.extend($2.expr.pseudos,{tabbable:__name(function(element){var tabIndex=$2.attr(element,"tabindex"),hasTabindex=tabIndex!=null;return(!hasTabindex||tabIndex>=0)&&$2.ui.focusable(element,hasTabindex)},"tabbable")})})),tabbable}__name(requireTabbable,"requireTabbable");requireTabbable();class KeyHelper{static{__name(this,"KeyHelper")}static isNumber(event){return/^[0-9]$/i.test(event.key)}static isLetter(event){return/^[a-z]$/i.test(event.key)}static isAlphaNumeric(event){return/^[a-z0-9]$/i.test(event.key)}static isDash(event){return event.key==="-"}static isDel(event){return event.key==="Delete"||event.key==="Del"}static isSpace(event){return event.key===" "||event.key==="Spacebar"}static isBackspace(event){return event.key==="Backspace"}static isSemiColon(event){return event.key===";"}static isComma(event){return event.key===","}static isDot(event){return event.key==="."}static isArrowKey(event){return KeyHelper.isArrowLeftKey(event)||KeyHelper.isArrowUpKey(event)||KeyHelper.isArrowRightKey(event)||KeyHelper.isArrowDownKey(event)}static isArrowLeftKey(event){return event.key==="ArrowLeft"||event.key==="Left"}static isArrowUpKey(event){return event.key==="ArrowUp"||event.key==="Up"}static isArrowRightKey(event){return event.key==="ArrowRight"||event.key==="Right"}static isArrowDownKey(event){return event.key==="ArrowDown"||event.key==="Down"}static isControlKey(event){return event.key==="Control"}static isControlKeyPressed(event){return event.ctrlKey}static isShiftKey(event){return event.key==="Shift"}static isShiftKeyPressed(event){return event.shiftKey}static isAltKey(event){return event.key==="Alt"}static isAltKeyPressed(event){return event.altKey}static isMetaKey(event){return event.metaKey}static isTabKey(event){return event.key==="Tab"}static isModifierKey(event){return KeyHelper.isControlKeyPressed(event)||KeyHelper.isShiftKeyPressed(event)||KeyHelper.isAltKeyPressed(event)||KeyHelper.isMetaKey(event)}static isSystemKey(event){return KeyHelper.isControlKey(event)||KeyHelper.isShiftKey(event)||KeyHelper.isAltKey(event)}static isEscKey(event){return event.key==="Escape"||event.key==="Esc"}static isEnterKey(event){return event.key==="Enter"}static isApplyKey(event){return KeyHelper.isEnterKey(event)||KeyHelper.isSpace(event)}}const WCAG=Symbol("WCAG");var AriaRole;(function(AriaRole2){AriaRole2.NONE="presentation",AriaRole2.BANNER="banner",AriaRole2.BUTTON="button",AriaRole2.TOOLBAR="toolbar",AriaRole2.MENU="menu",AriaRole2.COMBOBOX="combobox",AriaRole2.LISTBOX="listbox",AriaRole2.OPTION="option"})(AriaRole||(AriaRole={}));var AriaHasPopup;(function(AriaHasPopup2){AriaHasPopup2.TRUE="true",AriaHasPopup2.MENU="menu",AriaHasPopup2.LISTBOX="listbox",AriaHasPopup2.TREE="tree",AriaHasPopup2.GRID="grid",AriaHasPopup2.DIALOG="dialog"})(AriaHasPopup||(AriaHasPopup={}));function assert(expression,message){if(!expression)throw new Error(message||"Assertion failed")}__name(assert,"assert");function assertState(expression,message){assert(expression,"Illegal state: "+message)}__name(assertState,"assertState");function assertNotNull(value,message){return assert(value!=null,message||"Value may not be null"),value}__name(assertNotNull,"assertNotNull");class EventBus extends AbstractEventBus{static{__name(this,"EventBus")}static get(receiver){return EventBus.instance?receiver&&EventBus.instance.hasReceiver(receiver):EventBus.instance=new EventBus(receiver),EventBus.instance}onEvent(eventName,handler){const entry=super.onEvent(eventName,handler);return entry.customHandler=e=>handler(e.detail),this.receivers[0].addEventListener(eventName,entry.customHandler),entry}unEvent(eventName,handler){const entries2=super.unEvent(eventName,handler);return entries2.forEach(entry=>{this.receivers[0].removeEventListener(eventName,entry.customHandler)}),entries2}fireEvent(event){const customEvent=new CustomEvent(event.getName(),{bubbles:!0,detail:event});if(!this.receivers.length)throw new Error("No receivers set for EventBus, use addReceiver(window) to set one.");this.receivers.forEach(receiver=>receiver.dispatchEvent(customEvent))}}class AbstractEvent{static{__name(this,"AbstractEvent")}constructor(name){this.name=name||ClassHelper.getFullName(this)}static bind(name,handler,contextWindow=window){this.getEventBus(contextWindow).onEvent(name,handler)}static unbind(name,handler,contextWindow=window){this.getEventBus(contextWindow).unEvent(name,handler)}getName(){return this.name}static getEventBus(contextWindow){throw new Error("Method not implemented.")}}let Event$1=class extends AbstractEvent{static{__name(this,"Event")}fire(contextWindow){EventBus.get(contextWindow).fireEvent(this)}static getEventBus(contextWindow){return EventBus.get(contextWindow)}};class ElementEvent extends Event$1{static{__name(this,"ElementEvent")}constructor(name,element,target){super(name),this.element=element,this.target=target||element}getElement(){return this.element}getTarget(){return this.target}}class ElementAddedEvent extends ElementEvent{static{__name(this,"ElementAddedEvent")}constructor(element,target){super("added",element,target)}}class ElementHelper{static{__name(this,"ElementHelper")}constructor(element){assertNotNull(element,"Element cannot be null"),this.el=element}static fromName(name){return assert(!StringHelper.isEmpty(name),"Tag name cannot be empty"),new ElementHelper(document.createElement(name))}getHTMLElement(){return this.el}insertBefore(newEl,existingEl){assertNotNull(newEl,"New element cannot be null"),assertNotNull(existingEl,"Existing element cannot be null"),this.el.insertBefore(newEl.getHTMLElement(),existingEl?existingEl.getHTMLElement():null)}insertBeforeEl(existingEl){existingEl.el.parentElement.insertBefore(this.el,existingEl.el)}insertAfterEl(existingEl){assertNotNull(existingEl,"Existing element cannot be null"),assertNotNull(existingEl.el.parentElement,"Existing element's parentElement cannot be null"),existingEl.el.parentElement.insertBefore(this.el,existingEl.el.nextElementSibling)}insertAfterThisEl(toInsert){assertNotNull(toInsert,"Existing element cannot be null"),this.el.parentElement.insertBefore(toInsert.el,this.el.nextElementSibling)}getPrevious(){let previous=this.el.previousSibling;for(;previous&&previous.nodeType!==Node.ELEMENT_NODE;)previous=previous.previousSibling;return previous?new ElementHelper(previous):null}getNext(){let next=this.el.nextSibling;for(;next&&next.nodeType!==Node.ELEMENT_NODE;)next=next.nextSibling;return next?new ElementHelper(next):null}getParent(){let parent2=this.el.parentElement;return parent2?new ElementHelper(parent2):null}setDisabled(value){return this.el.disabled=value,this}isDisabled(){return this.el.disabled}setAutocomplete(value){return this.el.autocomplete=value?"on":"off",this}hasAutocomplete(){return this.el.autocomplete==="on"}getId(){return this.el.id}setId(value){return this.el.id=value,this}setInnerHtml(value,escapeHtml=!0){return $(this.el).html(escapeHtml?StringHelper.escapeHtml(value):value),this}getInnerHtml(){return this.el.innerHTML}setText(value){return $(this.el).text(value),this}getText(){return this.el.innerText||this.el.textContent}setAttribute(name,value){return this.el.setAttribute(name,value),this}getAttribute(name){return this.el.getAttribute(name)}hasAttribute(name){return this.el.hasAttribute(name)}removeAttribute(name){return this.el.removeAttribute(name),this}setData(name,value){return assert(!StringHelper.isEmpty(name),"Name cannot be empty"),assert(!StringHelper.isEmpty(value),"Value cannot be empty"),this.setAttribute("data-"+name,value),$(this.el).data(name,value),this}getData(name){let data=$(this.el).data(name);return data?data.toString():void 0}getValue(){return this.el.value}setValue(value){return this.el.value=value||"",this}toggleClass(className,condition){return condition===!1||condition==null&&this.hasClass(className)?this.removeClass(className):this.addClass(className),this}addClass(className){const trimmedClassName=className?.trim();return assert(!StringHelper.isEmpty(trimmedClassName),"Class name cannot be empty"),StringHelper.removeEmptyStrings(trimmedClassName.split(" ")).forEach(classItem=>{this.el.classList&&!this.hasClass(classItem)&&this.el.classList.add(classItem)}),this}setClass(value){return this.el.className=value,this}getClass(){return this.el.className}setTitle(value){return this.el.title=value,this}getTitle(){return this.el.title}hasAnyParentClass(clsName){let parent2=this.getParent();return parent2?parent2.hasClass(clsName)||parent2.hasAnyParentClass(clsName):!1}hasClass(clsName){assert(!StringHelper.isEmpty(clsName),"Class name cannot be empty");const classList=clsName.split(" ");for(const classItem of classList)if(this.el.classList&&this.el.classList.contains(classItem))return!0;return!1}removeClass(clsName){return assert(!StringHelper.isEmpty(clsName),"Class name cannot be empty"),clsName.split(" ").forEach(classItem=>{this.el.classList&&this.el.classList.remove(classItem)}),this}addEventListener(eventName,f,isPassive){return isPassive?this.addPassiveEventListener(eventName,f):(this.el.addEventListener(eventName,f,{passive:!1}),this)}removeEventListener(eventName,f){return this.el.removeEventListener(eventName,f),this}dispatchEvent(eventName){const event=new Event(eventName,{bubbles:!0,cancelable:!0});this.el.dispatchEvent(event)}appendChild(child){return this.insertChild(child,this.countChildren())}appendChildren(children){return children.forEach(child=>{this.el.appendChild(child)}),this}insertChild(child,index){return index>this.countChildren()-1?this.el.appendChild(child):this.el.insertBefore(child,this.getChild(index)),this}getTagName(){return this.el.tagName}getDisplay(){return this.el.style.display}setDisplay(value){return this.el.style.display=value,this}getOpacity(){return parseFloat(this.el.style.opacity)}setOpacity(value){return this.el.style.opacity=String(value),this}getVisibility(){return this.el.style.visibility}setVisibility(value){return this.el.style.visibility=value,this}getPosition(){return this.getComputedProperty("position")}setPosition(value){return this.el.style.position=value,this}setWidth(value){return this.el.style.width=value,this}setWidthPx(value){return this.setWidth(value+"px"),this}setMaxWidth(value){return this.el.style.maxWidth=value,this}setMinWidth(value){return this.el.style.minWidth=value,this}setMaxWidthPx(value){return this.setMaxWidth(value+"px"),this}getWidth(){return $(this.el).innerWidth()}getWidthWithoutPadding(){return $(this.el).width()}getWidthWithBorder(){return $(this.el).outerWidth()}getWidthWithMargin(){return $(this.el).outerWidth(!0)}getMinWidth(){return parseFloat(this.getComputedProperty("min-width"))||0}getMaxWidth(){return parseFloat(this.getComputedProperty("max-width"))||0}setHeight(value){return this.el.style.height=value,this}setHeightPx(value){return this.setHeight(value+"px"),this}getHeight(){return $(this.el).innerHeight()}setMaxHeight(value){return this.el.style.maxHeight=value,this}setMaxHeightPx(value){return this.setMaxHeight(value+"px"),this}getMaxHeight(){return parseFloat(this.getComputedProperty("max-height"))||0}setMinHeight(value){return this.el.style.minHeight=value,this}setMinHeightPx(value){return this.setMinHeight(value+"px"),this}getMinHeight(){return parseFloat(this.getComputedProperty("min-height"))||0}getHeightWithoutPadding(){return $(this.el).height()}getHeightWithBorder(){return $(this.el).outerHeight()}getHeightWithMargin(){return $(this.el).outerHeight(!0)}setTop(value){return this.el.style.top=value,this}setTopPx(value){return this.setTop(value+"px")}getTopPx(){return parseFloat(this.getTop())}getTop(){return this.el.style.top}setBottom(value){return this.el.style.bottom=value,this}setBottomPx(value){return this.setBottom(value+"px")}getLeft(){return this.el.style.left}getLeftPx(){return parseFloat(this.getLeft())}setLeftPx(value){return this.setLeft(value+"px")}setLeft(value){return this.el.style.left=value,this}setRight(value){return this.el.style.right=value,this}setRightPx(value){return this.setRight(value+"px")}getMarginLeft(){return parseFloat(this.getComputedProperty("margin-left"))||0}setMarginLeft(value){return this.el.style.marginLeft=value,this}getMarginRight(){return parseFloat(this.getComputedProperty("margin-right"))||0}setMarginRight(value){return this.el.style.marginRight=value,this}getMarginTop(){return parseFloat(this.getComputedProperty("margin-top"))||0}setMarginTop(value){return this.el.style.marginTop=value,this}getMarginBottom(){return parseFloat(this.getComputedProperty("margin-bottom"))||0}setMarginBottom(value){return this.el.style.marginBottom=value,this}setStroke(value){return this.el.style.stroke=value,this}getStroke(){return this.getComputedProperty("stroke")}setStrokeDasharray(value){return this.el.style.strokeDasharray=value,this}getStrokeDasharray(){return this.getComputedProperty("stroke-dasharray")}setFill(value){return this.el.style.fill=value,this}getFill(){return this.getComputedProperty("fill")}getPaddingLeft(){return parseFloat(this.getComputedProperty("padding-left"))||0}setPaddingLeft(value){return this.el.style.paddingLeft=value,this}getPaddingRight(){return parseFloat(this.getComputedProperty("padding-right"))||0}setPaddingRight(value){return this.el.style.paddingRight=value,this}getPaddingTop(){return parseFloat(this.getComputedProperty("padding-top"))||0}setPaddingTop(value){return this.el.style.paddingTop=value,this}getPaddingBottom(){return parseFloat(this.getComputedProperty("padding-bottom"))}setPaddingBottom(value){return this.el.style.paddingBottom=value,this}getBorderTopWidth(){return parseFloat(this.getComputedProperty("border-top-width"))||0}getBorderBottomWidth(){return parseFloat(this.getComputedProperty("border-bottom-width"))||0}getBorderRightWidth(){return parseFloat(this.getComputedProperty("border-right-width"))||0}getBorderLeftWidth(){return parseFloat(this.getComputedProperty("border-left-width"))||0}setZindex(value){return this.el.style.zIndex=value.toString(),this}getBoundingClientRect(){return this.el.getBoundingClientRect()}scrollIntoView(top){return this.el.scrollIntoView(top),this}getScrollTop(){return this.el.scrollTop}setScrollTop(top){return this.el.scrollTop=top,this}getTabIndex(){return this.el.tabIndex}setTabIndex(tabIndex){return this.el.tabIndex=tabIndex,this}getFontSize(){return this.getComputedProperty("font-size")}setFontSize(value){return this.el.style.fontSize=value,this}setBackgroundImage(value){return this.el.style.backgroundImage=value,this}setCursor(value){return this.el.style.cursor=value,this}getCursor(){return this.el.style.cursor}getElementsByClassName(className){let items=[];if(className){let nodeList=this.el.getElementsByClassName(className);for(let i=0;i<nodeList.length;i++)items.push(new ElementHelper(nodeList.item(i)))}return items}remove(){let parent2=this.el.parentElement;parent2&&parent2.removeChild(this.el)}contains(element){return this.el.contains?this.el.contains(element):!!(this.el.compareDocumentPosition(element)&16)}getOffset(){return $(this.el).offset()}setOffset(offset){return $(this.el).offset(offset),this}getDimensions(){let offset=this.getOffset();return{top:offset.top,left:offset.left,width:this.getWidthWithBorder(),height:this.getHeightWithBorder()}}getDimensionsTopRelativeToParent(){let offsetToParent=this.getOffsetToParent(),offsetToDocument=this.getOffset();return{top:offsetToParent.top,left:offsetToDocument.left,width:this.getWidthWithBorder(),height:this.getHeightWithBorder()}}getOffsetParent(){return $(this.el).offsetParent()[0]}getOffsetToParent(){return $(this.el).position()}getOffsetTop(){return this.getOffset().top}getOffsetTopRelativeToParent(){return this.el.offsetTop}getOffsetLeft(){return this.getOffset().left}getOffsetLeftRelativeToParent(){return this.el.offsetLeft}isScrollable(){return this.getComputedProperty("overflow")==="auto"||this.getComputedProperty("overflow-y")==="auto"||this.hasClass("slimScrollDiv")}getComputedProperty(name,pseudoElement=null){return window.getComputedStyle(this.el,pseudoElement).getPropertyValue(name)}focus(){this.el.focus()}blur(){this.el.blur()}getSiblingIndex(){const getPrevSibling=__name(elem=>elem.previousElementSibling,"getPrevSibling");let prev,index;for(index=0,prev=getPrevSibling(this.el);prev;index++)prev=getPrevSibling(prev);return index}isVisible(){return $(this.el).is(":visible")&&$(this.el).css("visibility")!=="hidden"}countChildren(){return this.getChildren().length}getChild(index){return this.getChildren()[index]}getChildren(){return this.el.children?[].slice.call(this.el.children):Array.prototype.slice.call(this.el.childNodes).filter(childNode=>childNode.nodeType===Node.ELEMENT_NODE)}isOverflown(){return this.el.offsetWidth<this.el.scrollWidth}addPassiveEventListener(eventName,f){try{return this.el.addEventListener(eventName,f,{passive:!0}),this}catch{return this.addEventListener(eventName,f)}}scrollParent(includeHidden){let style=getComputedStyle(this.el);const excludeStaticParent=style.position==="absolute",overflowRegex=includeHidden?/(auto|scroll|hidden)/:/(auto|scroll)/;if(style.position==="fixed")return document.body;for(let parent2=this.el;parent2!=null;parent2=parent2.parentElement){if(style=getComputedStyle(parent2),excludeStaticParent&&style.position==="static")continue;const overflow=style.overflow+style.overflowY+style.overflowX;if(overflowRegex.test(overflow))return parent2}return document.body}}class ElementHiddenEvent extends ElementEvent{static{__name(this,"ElementHiddenEvent")}constructor(element,target){super("hidden",element,target)}}const ELEMENT_REGISTRY_KEY="ElementRegistry";class ElementRegistry{static{__name(this,"ElementRegistry")}constructor(){this.counters=new Map,this.elements=new Map}static get(){let instance=Store.instance().get(ELEMENT_REGISTRY_KEY);return instance==null&&(instance=new ElementRegistry,Store.instance().set(ELEMENT_REGISTRY_KEY,instance)),instance}static getCounters(){return ElementRegistry.get().counters}static getElements(){return ElementRegistry.get().elements}static registerElement(el){let fullName,id=el.getId();id?fullName=id:id=fullName=ClassHelper.getFullName(el);let count=ElementRegistry.getCounters().get(fullName);return count>=0&&(id+=`-${++count}`),ElementRegistry.getCounters().set(fullName,count||0),ElementRegistry.getElements().set(id,el),id}static reRegisterElement(el){const id=el.getId();ElementRegistry.getElements().set(id,el)}static unregisterElement(el){el&&ElementRegistry.getElements().delete(el.getId())}static getElementById(id){return ElementRegistry.getElements().get(id)}static getElementCountById(id){return parseInt(id.slice(id.lastIndexOf("-")+1),10)||0}}class ElementRemovedEvent extends ElementEvent{static{__name(this,"ElementRemovedEvent")}constructor(element,parent2,target){super("removed",element,target),this.parent=parent2}getParent(){return this.parent}}class ElementRenderedEvent extends ElementEvent{static{__name(this,"ElementRenderedEvent")}constructor(element,target){super("rendered",element,target)}}class ElementShownEvent extends ElementEvent{static{__name(this,"ElementShownEvent")}constructor(element,target){super("shown",element,target)}}class ElementBuilder{static{__name(this,"ElementBuilder")}setGenerateId(value){return this.generateId=value,this}setClassName(cls,prefix){return cls&&(cls=this.getParsedClass(cls),prefix&&(cls=StyleHelper$1.getCls(cls,prefix))),this.className=cls,this}setParentElement(element){return this.parentElement=element,this}getParsedClass(cls){return cls.trim().split(/\s+/).filter((elem,index,arr)=>arr.indexOf(elem)===index).join(" ")}}class ElementFromElementBuilder extends ElementBuilder{static{__name(this,"ElementFromElementBuilder")}setElement(element){return this.element=element,this}}class ElementFromHelperBuilder extends ElementBuilder{static{__name(this,"ElementFromHelperBuilder")}setHelper(helper){return this.helper=helper,this}setLoadExistingChildren(value){return this.loadExistingChildren=value,this}static fromHtmlElement(element,loadExistingChildren=!1,parent2){return new ElementFromHelperBuilder().setHelper(new ElementHelper(element)).setLoadExistingChildren(loadExistingChildren).setParentElement(parent2)}static fromString(s,loadExistingChildren=!0){let htmlEl=$(s).get(0),parentEl;return htmlEl&&htmlEl.parentElement&&(parentEl=Element.fromHtmlElement(htmlEl.parentElement)),this.fromHtmlElement(htmlEl,loadExistingChildren,parentEl)}}class NewElementBuilder extends ElementBuilder{static{__name(this,"NewElementBuilder")}setTagName(name){return assert(!StringHelper.isEmpty(name),"Tag name cannot be empty"),this.tagName=name,this}setHelper(helper){return this.helper=helper,this}}var LangDirection;(function(LangDirection2){LangDirection2.AUTO="",LangDirection2.LTR="ltr",LangDirection2.RTL="rtl"})(LangDirection||(LangDirection={}));class Element{static{__name(this,"Element")}static{this.debug=!1}constructor(builder){if(this.lazyRenderer=!1,this.addedListeners=[],this.descendantAddedListeners=[],this.removedListeners=[],this.renderedListeners=[],this.shownListeners=[],this.hiddenListeners=[],this.lazyRenderListeners=[],this.lazyRenderedListeners=[],this.mouseEnterByHandler={},this.mouseLeaveByHandler={},this.children=[],this.rendered=!1,ObjectHelper.iFrameSafeInstanceOf(builder,ElementFromElementBuilder)){let fromElementBuilder=builder,sourceElement=fromElementBuilder.element;sourceElement&&(this.parentElement=fromElementBuilder.parentElement?fromElementBuilder.parentElement:sourceElement.parentElement,this.parentElement&&this.parentElement.replaceChildElement(this,sourceElement),this.children=sourceElement.children,this.el=sourceElement.el)}else if(ObjectHelper.iFrameSafeInstanceOf(builder,ElementFromHelperBuilder)){let fromHelperBuilder=builder;this.el=fromHelperBuilder.helper,fromHelperBuilder.loadExistingChildren&&this.loadExistingChildren(),fromHelperBuilder.parentElement&&(this.parentElement=fromHelperBuilder.parentElement)}else if(ObjectHelper.iFrameSafeInstanceOf(builder,NewElementBuilder)){let newElementBuilder=builder;if(!newElementBuilder.tagName)throw new Error("tagName cannot be null");newElementBuilder.helper?this.el=newElementBuilder.helper:this.el=ElementHelper.fromName(newElementBuilder.tagName),newElementBuilder.parentElement&&(this.parentElement=newElementBuilder.parentElement)}else throw new Error("Unsupported builder: "+ClassHelper.getClassName(builder));if(this.parentElement&&this.el.getHTMLElement().parentElement&&this.parentElement.getHTMLElement()!==this.el.getHTMLElement().parentElement)throw new Error("Illegal state: HTMLElement in parent Element is not the as the HTMLElement parent to this HTMLElement");const distance=ClassHelper.distanceTo(this,Element);if(builder.generateId||distance>1){const id=ElementRegistry.registerElement(this);this.setId(id),this.onAdded(()=>{ElementRegistry.getElementById(id)||ElementRegistry.reRegisterElement(this)}),this.onRemoved(()=>{ElementRegistry.unregisterElement(this)})}builder.className&&this.setClass(builder.className)}applyWCAGAttributes(attr){!ObjectHelper.isDefined(attr)&&!this.implementsWCAG()||(ObjectHelper.isDefined(attr)&&(this[WCAG]=!0,ObjectHelper.isDefined(attr.tabbable)&&(this.tabbable=attr.tabbable),ObjectHelper.isDefined(attr.role)&&(this.role=attr.role),ObjectHelper.isDefined(attr.ariaLabel)&&(this.ariaLabel=attr.ariaLabel),ObjectHelper.isDefined(attr.ariaHasPopup)&&(this.ariaHasPopup=attr.ariaHasPopup),ObjectHelper.isDefined(attr.ariaExpanded)&&(this.ariaExpanded=attr.ariaExpanded),ObjectHelper.isDefined(attr.ariaHidden)&&(this.ariaHidden=attr.ariaHidden)),ObjectHelper.isDefined(this.tabbable)&&this.tabbable?this.getEl().getTabIndex()!==-1&&this.makeTabbable():this.removeTabbable(),ObjectHelper.isDefined(this.role)&&this.setRole(this.role),ObjectHelper.isDefined(this.ariaLabel)&&this.setAriaLabel(this.ariaLabel),ObjectHelper.isDefined(this.ariaHasPopup)&&this.setAriaHasPopup(this.ariaHasPopup),ObjectHelper.isDefined(this.ariaExpanded)&&this.setAriaExpanded(this.ariaExpanded),ObjectHelper.isDefined(this.ariaHidden)&&this.setAriaHidden(this.ariaHidden))}implementsWCAG(){return this[WCAG]===!0}static fromHtmlElement(element,loadExistingChildren=!1,parent2){return new Element(new ElementFromHelperBuilder().setHelper(new ElementHelper(element)).setLoadExistingChildren(loadExistingChildren).setParentElement(parent2))}static fromString(s,loadExistingChildren=!0){const sanitizedHtml=purify.sanitize(s);return Element.fromHtml(sanitizedHtml,loadExistingChildren)}static fromCustomarilySanitizedString(s,loadExistingChildren=!0,sanitizeConfig){const sanitizedHtml=purify.sanitize(s,Element.createDOMPurifyConfig(sanitizeConfig));return Element.fromHtml(sanitizedHtml,loadExistingChildren)}static createDOMPurifyConfig(purifyConfig){const config={};return purifyConfig.addTags&&(config.ADD_TAGS=purifyConfig.addTags.slice()),purifyConfig.addAttributes&&(config.ADD_ATTR=purifyConfig.addAttributes.slice()),config}static fromHtml(html2,loadExistingChildren=!0){const htmlEl=$(html2).get(0);if(!htmlEl)return null;let parentEl;return htmlEl&&htmlEl.parentElement&&(parentEl=Element.fromHtmlElement(htmlEl.parentElement)),this.fromHtmlElement(htmlEl,loadExistingChildren,parentEl)}static fromSelector(s,loadExistingChildren=!0){return $(s).map((_index,elem)=>{let htmlEl=elem,parentEl;return htmlEl&&htmlEl.parentElement&&(parentEl=Element.fromHtmlElement(htmlEl.parentElement)),Element.fromHtmlElement(htmlEl,loadExistingChildren,parentEl)}).get()}loadExistingChildren(){let children=this.el.getChildren();for(const child of children){const childAsElement=Element.fromHtmlElement(child,!0,this);this.children.push(childAsElement)}return this}findChildById(id,deep=!1){for(const child of this.children){if(child.getId()===id)return child;if(deep){let found=child.findChildById(id,deep);if(found)return found}}return null}render(deep=!0){return Element.debug,this.rendering=!0,this.doRender().then(rendered=>{let childPromises=[];return deep&&this.children.forEach(child=>{childPromises.push(child.render(deep))}),Q.all(childPromises).then(()=>(Element.debug,this.rendering=!1,this.rendered=rendered,this.notifyRendered(),rendered)).catch(reason=>!1)})}isRendering(){return this.rendering}isRendered(){return this.rendered}isAdded(){return!!this.getHTMLElement().parentNode}doRender(){return Q(!0)}show(){$(this.el.getHTMLElement()).show(),this.notifyShown(this,!0)}hide(skipAnimation=!1){skipAnimation?$(this.el.getHTMLElement()).hide(null):$(this.el.getHTMLElement()).hide(),this.notifyHidden(this)}setVisible(value){return value?this.show():this.hide(),this}isVisible(){return this.el.isVisible()}isFocusable(){return this.isVisible()&&!this.el.isDisabled()}getNextFocusable(){const focusableElements=$(":focusable"),lastIndex=focusableElements.toArray().indexOf(this.getHTMLElement());if(lastIndex!==-1)return focusableElements.get((lastIndex+1)%focusableElements.length)}setTitle(title){const trimmedTitle=title.trim();return trimmedTitle?(this.el.setTitle(trimmedTitle),this.setAriaLabel(trimmedTitle)):(this.el.removeAttribute("title"),this.setAriaLabel("")),this}setClass(className){return assert(!StringHelper.isEmpty(className),"Class name cannot be empty"),this.el.setClass(className),this}setClassEx(className){let cls=StyleHelper$1.getCls(className);return this.setClass(cls)}addClass(className){return assert(!StringHelper.isEmpty(className),"Class name cannot be empty"),this.el.addClass(className),this}addClassEx(className,prefix){let cls=StyleHelper$1.getCls(className,prefix);return this.addClass(cls)}toggleClass(className,condition){return this.el.toggleClass(className,condition),this}toggleClassEx(className,condition){let cls=StyleHelper$1.getCls(className);return this.toggleClass(cls,condition)}hasClass(className){return this.el.hasClass(className)}hasClassEx(className){let cls=StyleHelper$1.getCls(className);return this.hasClass(cls)}removeClass(className){return assert(!StringHelper.isEmpty(className),"Class name cannot be empty"),this.el.removeClass(className),this}removeClassEx(className){let cls=StyleHelper$1.getCls(className);return this.removeClass(cls)}getClass(){return this.el.getClass()}getId(){return this.el.getId()}setId(value){return this.el.setId(value),this}getEl(){return this.el}traverse(handler){this.getChildren().forEach(el=>{handler(el),el.traverse(handler)})}setDraggable(value){typeof value=="string"?this.getEl().setAttribute("draggable",value):value===!0?this.getEl().setAttribute("draggable","true"):this.getEl().removeAttribute("draggable")}isDraggable(){return this.getEl().getAttribute("draggable")==="true"}setContentEditable(flag){return this.getEl().setAttribute("contenteditable",flag?"true":"false"),this}isContentEditable(){return this.getEl().getAttribute("contenteditable")==="true"}setSpellcheck(value){return value?this.getEl().setAttribute("spellcheck","true"):this.getEl().removeAttribute("spellcheck"),this}hasSpellcheck(){return this.getEl().hasAttribute("spellcheck")}makeTabbable(){return this.setTabIndex(0),this}removeTabbable(){return this.setTabIndex(-1),this}setTabIndex(tabIndex){return this.getEl().setTabIndex(tabIndex),this}setLang(value){return this.getEl().setAttribute("lang",value),this}getLang(){return this.getEl().getAttribute("lang")}setAriaAttribute(name,value){return this.getEl().setAttribute(`aria-${name}`,value),this}removeAriaAttribute(name){return this.getEl().removeAttribute(`aria-${name}`),this}setAriaLabel(label){return StringHelper.isBlank(label)?(this.removeAriaAttribute("label"),this):this.setAriaAttribute("label",label)}setAriaDisabled(disabled){return disabled?this.setAriaAttribute("disabled","true"):this.removeAriaAttribute("disabled")}isAriaRole(value){return Object.keys(AriaRole).some(key=>AriaRole[key]===value)}isAriaHasPopup(value){return Object.keys(AriaHasPopup).some(key=>AriaHasPopup[key]===value)}setRole(value){let role=AriaRole.NONE;return this.isAriaRole(value)&&(role=value),StringHelper.isBlank(role.toLowerCase())?this.getEl().removeAttribute("role"):this.getEl().setAttribute("role",role.toLowerCase()),this}setAriaHasPopup(value){let hasPopup=value??AriaHasPopup.TRUE;return this.isAriaHasPopup(value)&&(hasPopup=value),StringHelper.isBlank(hasPopup.toLowerCase())?this.removeAriaAttribute("haspopup"):this.setAriaAttribute("haspopup",hasPopup.toLowerCase()),this}setAriaExpanded(value){return ObjectHelper.isDefined(value)||this.removeAriaAttribute("expanded"),this.setAriaAttribute("expanded",String(value)),this}setAriaHidden(value){return ObjectHelper.isDefined(value)||this.removeAriaAttribute("hidden"),this.setAriaAttribute("hidden",String(value)),this}setAriaSelected(){return this.setAriaAttribute("selected","true"),this}removeAriaSelected(){return this.removeAriaAttribute("selected"),this}setDir(value){return this.getEl().setAttribute("dir",value),this}getDir(){return this.getEl().getAttribute("dir")}giveFocus(){if(!this.isVisible()||this.el.isDisabled())return!1;this.el.focus();let gotFocus=this.hasFocus();return!gotFocus&&Element.debug,gotFocus}hasFocus(){return document.activeElement===this.el.getHTMLElement()}giveBlur(){if(!this.isVisible()||this.el.isDisabled())return!1;this.el.blur();let gotBlur=document.activeElement!==this.el.getHTMLElement();return!gotBlur&&Element.debug,gotBlur}getHTMLElement(){return this.el.getHTMLElement()}insertChild(child,index){return assertNotNull(child,"Child cannot be null"),this.el.insertChild(child.getEl().getHTMLElement(),index),this.insertChildElement(child,this,index),this}appendChild(child,lazyRender=!1){return lazyRender?this.lazyRender(child):this.insertChild(child,this.children.length)}appendChildren(...children){return children.forEach(child=>{this.appendChild(child)}),this}prependChild(child){return this.insertChild(child,0)}insertAfterEl(existing){assertNotNull(existing,"Existing element cannot be null");let existingIndex=existing.getSiblingIndex();return this.el.insertAfterEl(existing.el),this.insertChildElement(this,existing.parentElement,existingIndex+1)}insertBeforeEl(existing){assertNotNull(existing,"Existing element cannot be null");let existingIndex=existing.getSiblingIndex();return this.el.insertBeforeEl(existing.el),this.insertChildElement(this,existing.getParentElement(),existingIndex)}hasChild(child){return this.children.indexOf(child)>-1}hasParent(){return!!this.parentElement}removeChild(child){return assertNotNull(child,"Child element to remove cannot be null"),child.getEl().remove(),this.removeChildElement(child),this}removeChildren(){return this.children.slice(0).forEach(child=>{child.remove()}),this.el.setInnerHtml(""),this}contains(element){return this.getEl().contains(element.getHTMLElement())}remove(){return this.parentElement?this.parentElement.removeChild(this):(this.getEl().remove(),this.notifyRemoved(null)),this.unDescendantAdded(),this}replaceWith(replacement){assertNotNull(replacement,"replacement element cannot be null"),replacement.el.insertAfterEl(this.el),replacement.notifyAdded();const parent2=this.parentElement.getParentOf(this);if(!parent2)throw new Error("Source element is missing parent");const childIndex=parent2.children.indexOf(this);parent2.unregisterChildElement(this),parent2.registerChildElement(replacement,childIndex),parent2.isRendered()?replacement.init():parent2.isRendering()&&(this.childrenAddedDuringInit=!0),this.getEl().remove(),this.notifyRemoved(parent2,this)}wrapWithElement(wrapperElement){assertNotNull(wrapperElement,"wrapperElement cannot be null"),this.parentElement&&(this.replaceWith(wrapperElement),wrapperElement.appendChild(this))}getParentElement(){return this.parentElement}getChildren(){return this.children}getLastChild(){return this.children[this.children.length-1]}getFirstChild(){return this.children[0]}getNextElement(){let nextSiblingHtmlElement=this.getHTMLElement().nextElementSibling;return nextSiblingHtmlElement?Element.fromHtmlElement(nextSiblingHtmlElement):null}getPreviousElement(){let previousSiblingHtmlElement=this.getHTMLElement().previousElementSibling;return previousSiblingHtmlElement?Element.fromHtmlElement(previousSiblingHtmlElement):null}getSiblingIndex(){let indexFromDOM=this.el.getSiblingIndex();if(this.parentElement){let indexFromElement=this.parentElement.children.indexOf(this);assertState(indexFromElement===indexFromDOM,"index of Element in parentElement.children ["+indexFromElement+"] does not correspond with the actual index ["+indexFromDOM+"] of the HTMLElement in DOM")}return indexFromDOM}getTabbableElements(){const selected=$(this.getHTMLElement()).find(":tabbable"),elements=[];for(const element of selected.toArray())elements.push(Element.fromHtmlElement(element));return elements}toString(){return $("<div>").append($(this.getHTMLElement()).clone()).html()}getHtml(){return this.getEl().getInnerHtml()}setHtml(value,escapeHtml=!0){return this.getEl().setInnerHtml(value,escapeHtml),this}isLazyRenderer(){return this.lazyRenderer}notifyLazyRendered(){this.lazyRenderedListeners.forEach(listener=>{listener()}),this.lazyRenderedListeners=[],this.parentElement&&this.parentElement.notifyLazyRendered()}onLazyRendered(listener){this.containsLazyRenderers()?this.lazyRenderedListeners.push(listener):listener()}containsLazyRenderers(){if(this.isLazyRenderer())return!0;let result=!1;return this.traverse(el=>{el.isLazyRenderer()&&(result=!0)}),result}forceRender(){this.traverse(el=>{el.isLazyRenderer()&&el.notifyForceRender()})}notifyForceRender(){this.lazyRenderListeners.forEach(listener=>{listener()})}onMouseEnter(handler){typeof this.getHTMLElement().onmouseenter<"u"?this.getEl().addEventListener("mouseenter",handler):(this.mouseEnterByHandler[handler]=e=>{this.getEl().contains(e.relatedTarget||e.fromElement)||handler(e)},this.getEl().addEventListener("mouseover",this.mouseEnterByHandler[handler]))}unMouseEnter(handler){typeof this.getHTMLElement().onmouseenter<"u"?this.getEl().removeEventListener("mouseenter",handler):this.getEl().removeEventListener("mouseover",this.mouseEnterByHandler[handler])}onMouseLeave(handler){typeof this.getHTMLElement().onmouseleave<"u"?this.getEl().addEventListener("mouseleave",handler):(this.mouseLeaveByHandler[handler]=e=>{this.getEl().contains(e.relatedTarget||e.toElement)||handler(e)},this.getEl().addEventListener("mouseout",this.mouseLeaveByHandler[handler]))}unMouseLeave(handler){typeof this.getHTMLElement().onmouseleave<"u"?this.getEl().removeEventListener("mouseleave",handler):this.getEl().removeEventListener("mouseout",this.mouseLeaveByHandler[handler])}onMouseOver(listener){this.getEl().addEventListener("mouseover",listener)}unMouseOver(listener){this.getEl().removeEventListener("mouseover",listener)}onMouseOut(listener){this.getEl().addEventListener("mouseout",listener)}unMouseOut(listener){this.getEl().removeEventListener("mouseout",listener)}onDescendantAdded(listener){this.descendantAddedListeners.push(listener)}unDescendantAdded(){this.descendantAddedListeners=[]}onAdded(listener){this.addedListeners.push(listener)}unAdded(listener){this.addedListeners=this.addedListeners.filter(curr=>curr!==listener)}onRemoved(listener){this.removedListeners.push(listener)}unRemoved(listener){this.removedListeners=this.removedListeners.filter(curr=>curr!==listener)}whenRendered(callback){if(this.isRendered())callback();else{const listener=__name(()=>{callback(),this.unRendered(listener)},"listener");this.onRendered(listener)}}whenShown(callback){if(this.isVisible())callback();else{const listener=__name(()=>{callback(),this.unShown(listener)},"listener");this.onShown(listener)}}onRendered(listener){this.renderedListeners.push(listener)}unRendered(listener){this.renderedListeners=this.renderedListeners.filter(curr=>curr!==listener)}onShown(listener){this.shownListeners.push(listener)}unShown(listener){this.shownListeners=this.shownListeners.filter(curr=>curr!==listener)}onHidden(listener){this.hiddenListeners.push(listener)}unHidden(listener){this.hiddenListeners=this.hiddenListeners.filter(curr=>curr!==listener)}onScrolled(listener){this.onMouseWheel(listener),this.getEl().addEventListener("DOMMouseScroll",listener)}unScrolled(listener){this.unMouseWheel(listener),this.getEl().removeEventListener("DOMMouseScroll",listener)}onApplyKeyPressed(callback){const callbackWrapper=__name(event=>{callback(),event.stopPropagation(),event.preventDefault()},"callbackWrapper");this.onKeyDown(event=>{KeyHelper.isEnterKey(event)&&callbackWrapper(event)}),this.onKeyUp(event=>{KeyHelper.isSpace(event)&&callbackWrapper(event)})}onEscPressed(callback){this.onKeyDown(event=>{KeyHelper.isEscKey(event)&&(callback(),event.stopPropagation(),event.preventDefault())})}onClicked(listener){this.getEl().addEventListener("click",listener)}unClicked(listener){this.getEl().removeEventListener("click",listener)}onDblClicked(listener){this.getEl().addEventListener("dblclick",listener)}unDblClicked(listener){this.getEl().removeEventListener("dblclick",listener)}onContextMenu(listener){this.getEl().addEventListener("contextmenu",listener)}unContextMenu(listener){this.getEl().removeEventListener("contextmenu",listener)}onMouseDown(listener){this.getEl().addEventListener("mousedown",listener)}unMouseDown(listener){this.getEl().removeEventListener("mousedown",listener)}onMouseUp(listener){this.getEl().addEventListener("mouseup",listener)}unMouseUp(listener){this.getEl().removeEventListener("mouseup",listener)}onMouseMove(listener){this.getEl().addEventListener("mousemove",listener)}unMouseMove(listener){this.getEl().removeEventListener("mousemove",listener)}onMouseWheel(listener){let eventName=/Firefox/i.test(navigator.userAgent)?"wheel":"mousewheel";this.getEl().addEventListener(eventName,listener,!0)}unMouseWheel(listener){let eventName=/Firefox/i.test(navigator.userAgent)?"wheel":"mousewheel";this.getEl().removeEventListener(eventName,listener)}onTouchStart(listener,isPassive=!0){this.getEl().addEventListener("touchstart",listener,isPassive)}unTouchStart(listener){this.getEl().removeEventListener("touchstart",listener)}onTouchMove(listener,isPassive=!0){this.getEl().addEventListener("touchmove",listener,isPassive)}unTouchMove(listener){this.getEl().removeEventListener("touchmove",listener)}onTouchEnd(listener,isPassive=!0){this.getEl().addEventListener("touchend",listener,isPassive)}unTouchEnd(listener){this.getEl().removeEventListener("touchend",listener)}onKeyUp(listener){this.getEl().addEventListener("keyup",listener)}unKeyUp(listener){this.getEl().removeEventListener("keyup",listener)}onKeyDown(listener){this.getEl().addEventListener("keydown",listener)}unKeyDown(listener){this.getEl().removeEventListener("keydown",listener)}onKeyPressed(listener){this.getEl().addEventListener("keypress",listener)}unKeyPressed(listener){this.getEl().removeEventListener("keypress",listener)}onFocus(listener){this.getEl().addEventListener("focus",listener)}unFocus(listener){this.getEl().removeEventListener("focus",listener)}onBlur(listener){this.getEl().addEventListener("blur",listener)}unBlur(listener){this.getEl().removeEventListener("blur",listener)}onFocusIn(listener){this.getEl().addEventListener("focusin",listener)}unFocusIn(listener){this.getEl().removeEventListener("focusin",listener)}onFocusOut(listener){this.getEl().addEventListener("focusout",listener)}unFocusOut(listener){this.getEl().removeEventListener("focusout",listener)}onScroll(listener){this.getEl().addEventListener("scroll",listener)}unScroll(listener){this.getEl().removeEventListener("scroll",listener)}onDrag(listener){this.getEl().addEventListener("drag",listener)}unDrag(listener){this.getEl().removeEventListener("drag",listener)}onDragStart(listener){this.getEl().addEventListener("dragstart",listener)}unDragStart(listener){this.getEl().removeEventListener("dragstart",listener)}onDragEnter(listener){this.getEl().addEventListener("dragenter",listener)}unDragEnter(listener){this.getEl().removeEventListener("dragenter",listener)}onDragOver(listener){this.getEl().addEventListener("dragover",listener)}unDragOver(listener){this.getEl().removeEventListener("dragover",listener)}onDragOut(listener){this.getEl().addEventListener("dragout",listener)}unDragOut(listener){this.getEl().removeEventListener("dragout",listener)}onDragLeave(listener){this.getEl().addEventListener("dragleave",listener)}unDragLeave(listener){this.getEl().removeEventListener("dragleave",listener)}onDrop(listener){this.getEl().addEventListener("drop",listener)}unDrop(listener){this.getEl().removeEventListener("drop",listener)}onDragEnd(listener){this.getEl().addEventListener("dragend",listener)}unDragEnd(listener){this.getEl().removeEventListener("dragend",listener)}init(){Element.debug,this.isVisible()&&this.notifyShown(this);let renderPromise;return this.isRendered()||this.isRendering()?renderPromise=Q(!0):(this.applyWCAGAttributes(),renderPromise=this.doRender()),this.rendering=!0,renderPromise.then(rendered=>this.initChildren(rendered)).catch(reason=>!1)}replaceChildElement(replacementChild,existingChild){let index=this.children.indexOf(existingChild);this.children[index]=replacementChild}initChildren(rendered){this.childrenAddedDuringInit=!1;let childPromises=[];return this.children.forEach(child=>{child.isRendered()||childPromises.push(child.init())}),Q.all(childPromises).then(()=>this.childrenAddedDuringInit?(Element.debug,this.initChildren(rendered)):(Element.debug,this.rendering=!1,this.rendered=rendered,this.notifyRendered(),rendered)).catch(reason=>!1)}insertChildElement(child,parent2,index){return assertNotNull(child,"Child element to insert cannot be null"),assertNotNull(parent2,"Parent element cannot be null"),parent2.registerChildElement(child,index),parent2.isRendered()?child.init():parent2.isRendering()&&(this.childrenAddedDuringInit=!0),this.isAdded()&&child.notifyAdded(),this}removeChildElement(child){assertNotNull(child,"Child element to insert cannot be null");const parent2=this.unregisterChildElement(child);return child.notifyRemoved(parent2),this}registerChildElement(child,index){if(child.parentElement){if(child.parentElement!==this)child.parentElement.unregisterChildElement(child);else if(this.children.indexOf(child)>-1)return}let parentNode=child.getHTMLElement().parentNode;if(parentNode&&parentNode!==this.getHTMLElement())throw new Error("Given child must be a child of this Element in DOM before it can be registered");index||(index=child.el.getSiblingIndex()),this.children.splice(index,0,child),child.parentElement=this}getParentOf(targetChild){if(this.children.indexOf(targetChild)>-1)return this;for(const child of this.children){const parent2=child.getParentOf(targetChild);if(parent2)return parent2}return null}unregisterChildElement(child){if(!this.children?.length||!child.parentElement)return null;const parentElement=this.getParentOf(child);if(!parentElement)return null;const childIndex=parentElement.children.indexOf(child);return parentElement.children.splice(childIndex,1),child.parentElement=null,parentElement}notifyDescendantAdded(e){this.descendantAddedListeners.forEach(listener=>{listener(e)}),this.parentElement&&this.parentElement.notifyDescendantAdded(e)}isEmptyElement(){const rect=this.getEl().getBoundingClientRect();return rect.height===0&&rect.width===0}getFirstNonEmptyAncestor(){let el=this;for(;el&&el.isEmptyElement();)el=el.getParentElement();return el}isInViewport(){const container=this.getFirstNonEmptyAncestor();if(!container||container.isEmptyElement())return!1;const rect=container.getEl().getBoundingClientRect();return rect.top>=0&&rect.left>=0&&rect.top<=2*(window.innerHeight||document.documentElement.clientHeight)&&rect.right-(window.innerWidth||document.documentElement.clientWidth)<=1}onForceRender(listener){this.lazyRenderListeners.push(listener)}unForceRender(listener){this.lazyRenderListeners=this.lazyRenderListeners.filter(curr=>curr!==listener)}getScrollableParent(el){const parent2=(el||this).getParentElement();return parent2?parent2.getEl().isScrollable()?parent2:this.getScrollableParent(parent2):this}resolveDropdownPosition(){const container=this.getParentElement().getEl().getBoundingClientRect(),height=this.getEl().getHeightWithBorder(),parentHeight=this.getParentElement().getEl().getHeightWithBorder(),spaceToBottom=window.innerHeight-container.top-parentHeight,spaceToTop=container.top;height>spaceToBottom&&height<=spaceToTop?this.getEl().setTop("auto").setBottomPx(parentHeight):this.getEl().setBottom("auto").setTopPx(parentHeight)}lazyRender(childEl){const scrollableParent=this.getEl().scrollParent(),scrollableParentEl=Element.fromHtmlElement(scrollableParent),$scrollableParent=$(scrollableParent);if(scrollableParent.nodeName.indexOf("document")>-1||this.isInViewport())return this.appendChild(childEl);this.lazyRenderer=!0;const render=__name(()=>{const onAdded=__name(()=>{childEl.unAdded(onAdded),scrollableParentEl.unScroll(renderOnScroll),this.unForceRender(render),this.lazyRenderListeners.length===0&&(this.lazyRenderer=!1,this.notifyLazyRendered())},"onAdded");childEl.onAdded(onAdded),this.appendChild(childEl)},"render"),renderOnScroll=__name(()=>{if(this.isInViewport()){const lastScrollHeight=$scrollableParent.scrollTop();render(),lastScrollHeight!==$scrollableParent.scrollTop()&&$scrollableParent.scrollTop(lastScrollHeight)}},"renderOnScroll");return scrollableParentEl.onScroll(renderOnScroll),this.onForceRender(render),this}notifyAdded(){let addedEvent=new ElementAddedEvent(this);if(this.addedListeners.forEach(listener=>{listener(addedEvent)}),this.parentElement){const e=new ElementEvent("descendant-added",this,this.parentElement);this.parentElement.notifyDescendantAdded(e)}this.children.forEach(child=>{child.notifyAdded()})}notifyRemoved(parent2,target){let removedEvent=new ElementRemovedEvent(this,parent2,target);this.children.forEach(child=>{child.notifyRemoved(removedEvent.getParent(),removedEvent.getTarget())}),this.removedListeners.forEach(listener=>{listener(removedEvent)})}notifyRendered(){let renderedEvent=new ElementRenderedEvent(this);this.renderedListeners.forEach(listener=>{listener(renderedEvent)})}notifyShown(target,deep){let shownEvent=new ElementShownEvent(this,target);this.shownListeners.forEach(listener=>{listener(shownEvent)}),deep&&this.children.forEach(child=>{child.isVisible()&&child.notifyShown(shownEvent.getTarget(),deep)})}notifyHidden(target){let hiddenEvent=new ElementHiddenEvent(this,target);this.hiddenListeners.forEach(listener=>{listener(hiddenEvent)}),this.children.forEach(child=>{child.notifyHidden(hiddenEvent.getTarget())})}}const BODY_KEY="Body";class Body extends Element{static{__name(this,"Body")}constructor(loadExistingChildren=!1,body){body||(body=document.body);const html2=Element.fromHtmlElement(body.parentElement);html2.setLang(CONFIG.getLocale()),super(new ElementFromHelperBuilder().setHelper(new ElementHelper(body)).setLoadExistingChildren(loadExistingChildren)),html2.appendChild(this);const visibilityHandler=__name(()=>{this.init().then(()=>{this.childrenLoaded=loadExistingChildren})},"visibilityHandler");if(!document.hidden)visibilityHandler();else{const visibilityListener=__name(()=>{!document.hidden&&!this.isRendered()&&!this.isRendering()&&(visibilityHandler(),document.removeEventListener("visibilitychange",visibilityListener))},"visibilityListener");document.addEventListener("visibilitychange",visibilityListener)}}reapplyFocus(){this.focusedElement&&setTimeout(()=>{this.focusedElement?.giveFocus(),this.focusedElement=null},100)}setFocusedElement(element){this.focusedElement=element}getFocusedElement(){return this.focusedElement}static get(){let instance=Store.instance().get(BODY_KEY);return instance==null&&document.body&&(instance=new Body,Store.instance().set(BODY_KEY,instance),ResponsiveManager.onAvailableSizeChanged(instance)),instance}isChildrenLoaded(){return this.childrenLoaded}loadExistingChildren(){return this.isChildrenLoaded()||(super.loadExistingChildren(),this.childrenLoaded=!0),this}isShowingModalDialog(){return Body.get().hasClass("modal-dialog")}}class DivEl extends Element{static{__name(this,"DivEl")}constructor(className,prefix){super(new NewElementBuilder().setTagName("div").setClassName(className,prefix))}}const TOOLTIPS_KEY="tooltips";class Tooltip{static{__name(this,"Tooltip")}static{this.SIDE_TOP="top"}static{this.SIDE_RIGHT="right"}static{this.SIDE_BOTTOM="bottom"}static{this.SIDE_LEFT="left"}static{this.TRIGGER_HOVER="hover"}static{this.TRIGGER_FOCUS="focus"}static{this.TRIGGER_NONE="none"}static{this.MODE_STATIC="static"}static{this.MODE_GLOBAL_STATIC="global_static"}static{this.MODE_FOLLOW="follow"}static{this.multipleAllowed=!0}constructor(target,text2,showDelay=0,hideTimeout=0){this.active=!0,this.targetEl=target,this.text=text2,this.showDelay=showDelay,this.hideTimeout=hideTimeout,this.side=Tooltip.SIDE_BOTTOM,this.overListener=()=>this.startShowDelay(),this.outListener=()=>this.startHideTimeout(),this.moveListener=event=>{this.tooltipEl&&this.tooltipEl.isVisible()&&this.positionAtMouse(event)},this.setTrigger(Tooltip.TRIGGER_HOVER),this.setMode(Tooltip.MODE_STATIC),Tooltip.getTooltips().push(this)}static getTooltips(){let instance=Store.parentInstance().get(TOOLTIPS_KEY);return instance==null&&(instance=[],Store.parentInstance().set(TOOLTIPS_KEY,instance)),instance}static hideOtherInstances(thisToolTip){Tooltip.getTooltips().forEach(tooltip=>{tooltip.isVisible()&&(!thisToolTip||tooltip!==thisToolTip)&&tooltip.hide()})}static allowMultipleInstances(allow){Tooltip.multipleAllowed=allow}static isMultipleInstancesAllowed(){return Tooltip.multipleAllowed}setActive(value){this.active=value}show(){if(this.stopTimeout(),!!this.active&&!this.tooltipEl){this.tooltipEl=new DivEl("tooltip",StyleHelper$1.COMMON_PREFIX),this.tooltipEl.addClass(this.side),this.contentEl?this.tooltipEl.appendChild(this.contentEl):this.tooltipEl.getEl().setInnerHtml(this.text);let appendTo;this.mode===Tooltip.MODE_STATIC?appendTo=this.targetEl.getParentElement()||this.targetEl:appendTo=Body.get(),appendTo.appendChild(this.tooltipEl),Tooltip.multipleAllowed||Tooltip.hideOtherInstances(this),this.tooltipEl.show(),(this.mode===Tooltip.MODE_STATIC||this.mode===Tooltip.MODE_GLOBAL_STATIC)&&this.positionByTarget()}}hide(){this.stopTimeout(),this.tooltipEl&&(this.tooltipEl.remove(),this.tooltipEl=null)}isVisible(){return!!this.tooltipEl&&this.tooltipEl.isVisible()}showAfter(ms){return this.startShowDelay(ms),this}showFor(ms){return this.show(),this.startHideTimeout(ms),this}setText(text2){return this.text=text2,this.contentEl=void 0,this}getText(){return this.text}setContent(content){return this.contentEl=content,this.text=void 0,this}getContent(){return this.contentEl}setHideTimeout(timeout){return this.hideTimeout=timeout,this}getHideTimeout(){return this.hideTimeout}setShowDelay(delay){return this.showDelay=delay,this}getShowDelay(){return this.showDelay}setTrigger(trigger){return trigger===this.trigger?this:(this.targetEl.getEl().removeEventListener(this.getEventName(!0),this.overListener).removeEventListener(this.getEventName(!1),this.outListener),this.targetEl.unRemoved(this.outListener),this.targetEl.unHidden(this.outListener),this.trigger=trigger,trigger!==Tooltip.TRIGGER_NONE&&(this.targetEl.getEl().addEventListener(this.getEventName(!0),this.overListener).addEventListener(this.getEventName(!1),this.outListener),this.targetEl.onRemoved(this.outListener),this.targetEl.onHidden(this.outListener)),this)}getTrigger(){return this.trigger}setSide(side){return this.side=side,this}getSide(){return this.side}setMode(mode){return mode===this.mode?this:(mode===Tooltip.MODE_STATIC||mode===Tooltip.MODE_GLOBAL_STATIC?Body.get().unMouseMove(this.moveListener):mode===Tooltip.MODE_FOLLOW&&Body.get().onMouseMove(this.moveListener),this.mode=mode,this)}getMode(){return this.mode}positionAtMouse(event){let left,top,x=event.clientX,y=event.clientY,el=this.tooltipEl.getEl(),windowEl=WindowDOM.get().getHTMLElement(),elProps={height:el.getHeightWithMargin(),width:el.getWidthWithMargin(),scrollLeft:this.mode===Tooltip.MODE_FOLLOW?windowEl.scrollX:0,scrollTop:this.mode===Tooltip.MODE_FOLLOW?windowEl.scrollY:0};switch(this.side){case Tooltip.SIDE_TOP:left=x-elProps.width/2+elProps.scrollLeft,top=y-elProps.height+elProps.scrollTop;break;case Tooltip.SIDE_BOTTOM:left=x-elProps.width/2+elProps.scrollLeft,top=y+elProps.scrollTop;break;case Tooltip.SIDE_LEFT:left=x-elProps.width+elProps.scrollLeft,top=y-elProps.height/2+elProps.scrollTop;break;case Tooltip.SIDE_RIGHT:left=x+elProps.scrollLeft,top=y-elProps.height/2+elProps.scrollTop;break}this.tooltipEl.getEl().setLeftPx(left),this.tooltipEl.getEl().setTopPx(top)}positionByTarget(){let targetEl=this.targetEl.getHTMLElement(),targetOffset=this.targetEl.getEl().getOffset(),el=this.tooltipEl.getEl(),elProps={left:el.getMarginLeft()||0,top:el.getMarginTop()||0,height:el.getHeight(),width:el.getWidth()},offsetLeft,offsetTop;switch(this.side){case Tooltip.SIDE_TOP:offsetLeft=targetOffset.left+(targetEl.offsetWidth-elProps.width)/2+elProps.left,offsetTop=targetOffset.top-elProps.height+elProps.top;break;case Tooltip.SIDE_BOTTOM:offsetLeft=targetOffset.left+(targetEl.offsetWidth-elProps.width)/2+elProps.left,offsetTop=targetOffset.top+targetEl.offsetHeight+elProps.top;break;case Tooltip.SIDE_LEFT:offsetLeft=targetOffset.left-elProps.width+elProps.left,offsetTop=targetOffset.top+(targetEl.offsetHeight-elProps.height)/2+elProps.top;break;case Tooltip.SIDE_RIGHT:offsetLeft=targetOffset.left+targetEl.offsetWidth+elProps.left,offsetTop=targetOffset.top+(targetEl.offsetHeight-elProps.height)/2+elProps.top;break}offsetLeft<0&&(offsetLeft=0),offsetTop<0&&(offsetTop=0),el.setLeftPx(Math.floor(offsetLeft)).setTopPx(Math.floor(offsetTop))}startHideTimeout(ms){this.stopTimeout();let t=ms||this.hideTimeout;t>0?this.timeoutTimer=window.setTimeout(()=>{this.hide()},t):this.hide()}startShowDelay(ms){this.stopTimeout();let t=ms||this.showDelay;t>0?(this.trigger,Tooltip.TRIGGER_HOVER,this.timeoutTimer=window.setTimeout(()=>{this.show()},t)):this.show()}stopTimeout(){this.timeoutTimer&&(clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0)}getEventName(enter){switch(this.trigger){case Tooltip.TRIGGER_FOCUS:return enter?"focus":"blur";case Tooltip.TRIGGER_HOVER:default:return enter?"mouseenter":"mouseleave"}}}class AuthContext{static{__name(this,"AuthContext")}constructor(user,principals){this.user=user,this.principals=principals}static get(){if(!AuthContext.INSTANCE)throw new Error("AuthContext not initialized");return AuthContext.INSTANCE}static init(user,principals){AuthContext.INSTANCE=new AuthContext(user,principals)}getPrincipals(){return this.principals.slice()}getUser(){return this.user}}class UserItem{static{__name(this,"UserItem")}constructor(builder){this.key=builder.key,this.displayName=builder.displayName||"",this.description=builder.description}getDisplayName(){return this.displayName}getDescription(){return this.description}getKey(){return this.key}clone(){return this.newBuilder().build()}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,UserItem))return!1;let other=o;return!(!ObjectHelper.equals(this.key,other.key)||!ObjectHelper.stringEquals(this.displayName,other.displayName)||!ObjectHelper.stringEquals(this.description,other.description))}}class UserItemBuilder{static{__name(this,"UserItemBuilder")}constructor(source){source&&(this.key=source.getKey(),this.displayName=source.getDisplayName(),this.description=source.getDescription())}fromJson(json){return this.displayName=json.displayName,this.description=json.description||"",this}setDisplayName(displayName){return this.displayName=displayName,this}setDescription(description){return this.description=description,this}}var PrincipalType;(function(PrincipalType2){PrincipalType2[PrincipalType2.USER=0]="USER",PrincipalType2[PrincipalType2.GROUP=1]="GROUP",PrincipalType2[PrincipalType2.ROLE=2]="ROLE"})(PrincipalType||(PrincipalType={}));class UserItemKey{static{__name(this,"UserItemKey")}constructor(id){assert(!StringHelper.isBlank(id),"Id cannot be null or empty"),this.id=id}static fromString(_str){throw Error("Override me")}isSystem(){throw Error("Must be overridden by inheritors")}getId(){return this.id}toString(){return this.id}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,UserItemKey))return!1;let other=o;return this.id===other.id}}class IdProviderKey extends UserItemKey{static{__name(this,"IdProviderKey")}static{this.SYSTEM=new IdProviderKey("system")}constructor(id){super(id)}static fromString(value){return new IdProviderKey(value)}isSystem(){return this.getId()===IdProviderKey.SYSTEM.getId()}equals(o){return ObjectHelper.iFrameSafeInstanceOf(o,IdProviderKey)?super.equals(o):!1}static fromObject(o){return o instanceof IdProviderKey?o:new IdProviderKey(o.id)}}class PrincipalKey extends UserItemKey{static{__name(this,"PrincipalKey")}static{this.SEPARATOR=":"}static{this.ANONYMOUS_PRINCIPAL=PrincipalKey.ofUser(IdProviderKey.SYSTEM,"anonymous")}static{this.SU_PRINCIPAL=PrincipalKey.ofUser(IdProviderKey.SYSTEM,"su")}static{this.SYSTEM_ROLE_PREFIX="system."}static{this.PROJECT_ROLE_PREFIX="cms.project."}constructor(idProvider,type,principalId){super(principalId),assert(type===PrincipalType.ROLE||!!idProvider,"Principal id provider cannot be null"),assertNotNull(type,"Principal type cannot be null"),this.idProvider=idProvider,this.type=type,type===PrincipalType.ROLE?this.refString=PrincipalType[type].toLowerCase()+PrincipalKey.SEPARATOR+principalId:this.refString=PrincipalType[type].toLowerCase()+PrincipalKey.SEPARATOR+idProvider.toString()+PrincipalKey.SEPARATOR+principalId}static fromString(str){if(str===PrincipalKey.ANONYMOUS_PRINCIPAL.refString)return PrincipalKey.ANONYMOUS_PRINCIPAL;const sepIndex=str.indexOf(PrincipalKey.SEPARATOR);if(sepIndex===-1)throw new Error("Not a valid principal key ["+str+"]");const sepIndex2=str.indexOf(PrincipalKey.SEPARATOR,sepIndex+1),typeStr=str.substring(0,sepIndex),type=PrincipalType[typeStr.toUpperCase()];if(type===PrincipalType.ROLE){const principalId=str.substring(sepIndex+1,str.length)||"";return new PrincipalKey(null,type,principalId)}else{if(sepIndex2===-1)throw new Error("Not a valid principal key ["+str+"]");const idProvider=str.substring(sepIndex+1,sepIndex2)||"",principalId=str.substring(sepIndex2+1,str.length);return new PrincipalKey(new IdProviderKey(idProvider),type,principalId)}}static ofUser(idProvider,userId){return new PrincipalKey(idProvider,PrincipalType.USER,userId)}static ofGroup(idProvider,groupId){return new PrincipalKey(idProvider,PrincipalType.GROUP,groupId)}static ofAnonymous(){return PrincipalKey.ANONYMOUS_PRINCIPAL}static ofSU(){return PrincipalKey.SU_PRINCIPAL}static ofRole(roleId){return new PrincipalKey(IdProviderKey.SYSTEM,PrincipalType.ROLE,roleId)}getType(){return this.type}isUser(){return this.type===PrincipalType.USER}isGroup(){return this.type===PrincipalType.GROUP}isRole(){return this.type===PrincipalType.ROLE}isAnonymous(){return this.refString===PrincipalKey.ANONYMOUS_PRINCIPAL.refString}toString(){return this.refString}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,PrincipalKey))return!1;let other=o;return!!ObjectHelper.stringEquals(this.refString,other.refString)}isSystem(){return this.isSystemUser()||this.isSystemRole()||this.isProjectRole()}isSystemUser(){return this.equals(PrincipalKey.ofAnonymous())||this.equals(PrincipalKey.ofSU())}isSystemRole(){return this.isRole()&&this.getId().indexOf(PrincipalKey.SYSTEM_ROLE_PREFIX)===0}isProjectRole(){return this.isRole()&&this.getId().indexOf(PrincipalKey.PROJECT_ROLE_PREFIX)===0}getIdProvider(){return this.idProvider}toPath(toParent=!1){let path=this.isRole()?"/roles/":StringHelper.format("/{0}/{1}/",this.getIdProvider().toString(),PrincipalType[this.getType()].toLowerCase().replace(/(group|user)/g,"$&s"));return toParent||(path+=this.getId()),path}static fromObject(o){return o instanceof PrincipalKey?o:PrincipalKey.fromString(o.refString)}}class Principal extends UserItem{static{__name(this,"Principal")}constructor(builder){super(builder),this.type=builder.key.getType(),this.modifiedTime=builder.modifiedTime}static fromPrincipal(principal){return new PrincipalBuilder(principal).build()}static create(){return new PrincipalBuilder}static fromJson(json){return new PrincipalBuilder().fromJson(json).build()}toJson(){return{displayName:this.getDisplayName(),key:this.getKey().toString()}}getType(){return this.type}getKey(){return super.getKey()}getTypeName(){switch(this.type){case PrincipalType.GROUP:return"Group";case PrincipalType.USER:return"User";case PrincipalType.ROLE:return"Role";default:return""}}isUser(){return this.type===PrincipalType.USER}isGroup(){return this.type===PrincipalType.GROUP}isRole(){return this.type===PrincipalType.ROLE}getModifiedTime(){return this.modifiedTime}isSystem(){return this.getKey().isSystem()}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,Principal))return!1;let other=o;return!(!super.equals(o)||!ObjectHelper.dateEquals(this.modifiedTime,other.modifiedTime))}clone(){return this.newBuilder().build()}newBuilder(){return new PrincipalBuilder(this)}}class PrincipalBuilder extends UserItemBuilder{static{__name(this,"PrincipalBuilder")}constructor(source){super(source),source&&(this.modifiedTime=source.getModifiedTime())}fromJson(json){return super.fromJson(json),this.key=this.getKeyFromJson(json),this.modifiedTime=json.modifiedTime?new Date(Date.parse(json.modifiedTime)):null,this}setKey(key){return this.key=key,this}setModifiedTime(modifiedTime){return this.modifiedTime=modifiedTime,this}setDisplayName(displayName){return super.setDisplayName(displayName),this}setDescription(description){return super.setDescription(description),this}build(){return new Principal(this)}getKeyFromJson(json){return json.key?PrincipalKey.fromString(json.key):null}}class ItemViewId{static{__name(this,"ItemViewId")}static DATA_ATTRIBUTE="live-edit-id";value;refString;constructor(value){assert(value>=1,i18n("live.view.itemviewid.istooshort")),this.value=value,this.refString=""+value}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ItemViewId))return!1;const other=o;return!!ObjectHelper.numberEquals(this.value,other.value)}toNumber(){return this.value}toString(){return this.refString}static fromString(s){return new ItemViewId(+s)}}class ItemViewIdProducer{static{__name(this,"ItemViewIdProducer")}itemViewCounter=0;next(){return new ItemViewId(++this.itemViewCounter)}}var KeyBindingAction;(function(KeyBindingAction2){KeyBindingAction2[KeyBindingAction2.KEYDOWN=0]="KEYDOWN",KeyBindingAction2[KeyBindingAction2.KEYUP=1]="KEYUP",KeyBindingAction2[KeyBindingAction2.KEYPRESS=2]="KEYPRESS"})(KeyBindingAction||(KeyBindingAction={}));class KeyBinding{static{__name(this,"KeyBinding")}constructor(combination,callback,action,global){this.combination=combination,this.callback=callback,this.action=action,this.global=global}static newKeyBinding(combination){return new KeyBinding(combination)}static createMultiple(callback,...combinations){let bindings=[];return combinations.forEach(combination=>{bindings.push(new KeyBinding(combination,callback))}),bindings}setCallback(func){return this.callback=func,this}setAction(value){return this.action=value,this}setGlobal(global){return this.global=global,this}getCombination(){return this.combination}getCallback(){return this.callback}getAction(){return this.action}isGlobal(){return this.global}}class Mnemonic{static{__name(this,"Mnemonic")}constructor(value){this.value=value}getValue(){return this.value}toKeyBinding(callback){return new KeyBinding("alt+"+this.getValue(),callback)}underlineMnemonic(text2){let mStart=text2.indexOf(this.value);mStart===-1&&(mStart=text2.indexOf(this.value.toLowerCase()),mStart===-1&&(mStart=text2.indexOf(this.value.toUpperCase())));let result="";return mStart>0&&(result=text2.substr(0,mStart)),result+="<u>"+text2.charAt(mStart)+"</u>",mStart<text2.length-1&&(result+=text2.substr(mStart+1,text2.length)),result}}class Action{static{__name(this,"Action")}constructor(label,shortcut,global){this.forceExecute=!1,this.enabled=!0,this.visible=!0,this.foldable=!0,this.executionListeners=[],this.propertyChangedListeners=[],this.childActions=[],this.sortOrder=10,this.beforeExecuteListeners=[],this.afterExecuteListeners=[],this.label=label,shortcut&&(this.shortcut=new KeyBinding(shortcut).setGlobal(global).setCallback(e=>(e.preventDefault?e.preventDefault():e.returnValue=!1,this.execute(),!1)))}static getKeyBindings(actions){let bindings=[];return actions.forEach(action=>{action.getKeyBindings().forEach(keyBinding=>{bindings.push(keyBinding)})}),bindings}setTitle(title){this.title=title}getTitle(){return this.title}setSortOrder(sortOrder){this.sortOrder=sortOrder}getSortOrder(){return this.sortOrder}setChildActions(actions){return actions.forEach(action=>{action.parentAction=this}),this.childActions=actions,this}hasChildActions(){return this.childActions.length>0}hasParentAction(){return!!this.parentAction}getParentAction(){return this.parentAction}getChildActions(){return this.childActions}getLabel(){return this.label}setLabel(value){value!==this.label&&(this.label=value,this.notifyPropertyChanged())}isEnabled(){return this.enabled}setEnabled(value){return value!==this.enabled&&(this.enabled=value,this.notifyPropertyChanged()),this}isVisible(){return this.visible}setVisible(value){return value!==this.visible&&(this.visible=value,this.notifyPropertyChanged()),this}setWcagAttributes(wcag){return this.wcag=wcag,this}hasWcagAttributes(){return ObjectHelper.isDefined(this.wcag)}getWcagAttributes(){return this.wcag}getIconClass(){return this.iconClass}setIconClass(value){return value!==this.iconClass&&(this.iconClass=value,this.notifyPropertyChanged()),this}toggleIconClass(className,condition){return condition===!1||condition==null&&this.iconClass===className?this.setIconClass(""):this.setIconClass(className),this}getClass(){return this.cls}setClass(value){return value!==`${this.cls}-action`&&(this.cls=`${value}-action`,this.notifyPropertyChanged()),this}hasClass(){return this.cls!=null}hasShortcut(){return this.shortcut!=null}getShortcut(){return this.shortcut}setMnemonic(value){this.mnemonic=new Mnemonic(value)}hasMnemonic(){return this.mnemonic!=null}getMnemonic(){return this.mnemonic}isFoldable(){return this.foldable}setFoldable(value){return this.foldable=value,this}execute(forceExecute=!1){if(this.enabled){this.notifyBeforeExecute(),this.forceExecute=forceExecute;const promises=this.executionListeners.map(listener=>listener(this));Q.all(promises).then(()=>{this.forceExecute=!1,this.notifyAfterExecute()})}}onExecuted(listener){return this.executionListeners.push(listener),this}unExecuted(listener){return this.executionListeners=this.executionListeners.filter(curr=>curr!==listener),this}onPropertyChanged(listener){this.propertyChangedListeners.push(listener)}unPropertyChanged(listener){this.propertyChangedListeners=this.propertyChangedListeners.filter(currentListener=>listener!==currentListener)}onBeforeExecute(listener){this.beforeExecuteListeners.push(listener)}unBeforeExecute(listener){this.beforeExecuteListeners=this.beforeExecuteListeners.filter(currentListener=>listener!==currentListener)}onAfterExecute(listener){this.afterExecuteListeners.push(listener)}unAfterExecute(listener){this.afterExecuteListeners=this.afterExecuteListeners.filter(currentListener=>listener!==currentListener)}clearListeners(){this.beforeExecuteListeners=[],this.afterExecuteListeners=[]}getKeyBindings(){let bindings=[];return this.hasShortcut()&&bindings.push(this.getShortcut()),this.hasMnemonic()&&bindings.push(this.getMnemonic().toKeyBinding(()=>{this.execute()})),bindings}notifyPropertyChanged(){this.propertyChangedListeners.forEach(listener=>listener(this))}notifyBeforeExecute(){this.beforeExecuteListeners.forEach(listener=>{listener(this)})}notifyAfterExecute(){this.afterExecuteListeners.forEach(listener=>{listener(this)})}}class SpanEl extends Element{static{__name(this,"SpanEl")}constructor(className,prefix){super(new NewElementBuilder().setTagName("span").setClassName(className,prefix))}static fromText(text2,className){const span=new SpanEl(className);return span.setHtml(text2),span}}class Mask extends DivEl{static{__name(this,"Mask")}constructor(itemToMask){super("mask",StyleHelper$1.COMMON_PREFIX),this.visible=!1,this.masked=itemToMask||Body.get(),this.removeWhenMaskedRemoved=!0,this.masked&&(this.masked.onHidden(event=>{event.getTarget()===this.masked&&this.hide()}),this.masked.onRemoved(()=>{this.removeWhenMaskedRemoved&&this.remove()}),ResponsiveManager.onAvailableSizeChanged(Body.get(),()=>{this.isVisible()&&this.positionOverMaskedEl()}))}setRemoveWhenMaskedRemoved(value){this.removeWhenMaskedRemoved=value}hide(){this.visible&&(super.hide(),this.visible=!1,Body.get().contains(this)&&this.remove())}show(){this.visible||(Body.get().appendChild(this),super.show(),this.visible=!0,this.masked&&this.masked.whenRendered(()=>this.positionOverMaskedEl()))}getWrapperEl(){let wrapperEl=$(this.getEl().getHTMLElement()).closest(".mask-wrapper");if(wrapperEl.length)return wrapperEl;if(!this.masked)return $(this.getEl().getOffsetParent());const maskedEl=$(this.masked.getHTMLElement());for(wrapperEl=maskedEl;wrapperEl.length&&$(wrapperEl).innerHeight()===0;)wrapperEl=$(wrapperEl).parent();return wrapperEl.length?wrapperEl:maskedEl}maskAndWrapperHaveEqualOffset(wrapperEl){const offsetParentOfMask=this.getEl().getOffsetParent(),offsetParentOfMaskWrapper=wrapperEl.offsetParent()[0];return offsetParentOfMask===offsetParentOfMaskWrapper}positionOverMaskedEl(){const maskedEl=this.getWrapperEl(),maskDimensions={width:maskedEl.outerWidth()+"px",height:maskedEl.outerHeight()+"px"};let maskOffset=maskedEl.position();this.maskAndWrapperHaveEqualOffset(maskedEl)||(maskOffset=maskedEl.offset()),this.getEl().setTopPx(maskOffset.top).setLeftPx(maskOffset.left).setWidth(maskDimensions.width).setHeight(maskDimensions.height)}}class LoadMask extends Mask{static{__name(this,"LoadMask")}constructor(el){super(el),this.addClass("load-mask"),this.splash=new DivEl("mask-splash"),this.spinner=new DivEl("spinner"),this.splash.appendChild(this.spinner),this.appendChild(this.splash)}show(){super.show(),this.splash.show()}hide(){this.splash.hide(),super.hide()}setText(text2){text2?(this.text||(this.text=new SpanEl("text"),this.splash.appendChild(this.text)),this.text.getEl().setInnerHtml(text2)):this.text&&this.text.hide()}getText(){return this.text.getEl().getInnerHtml()}}var ItemViewContextMenuPosition=(ItemViewContextMenuPosition2=>(ItemViewContextMenuPosition2[ItemViewContextMenuPosition2.TOP=0]="TOP",ItemViewContextMenuPosition2[ItemViewContextMenuPosition2.BOTTOM=1]="BOTTOM",ItemViewContextMenuPosition2[ItemViewContextMenuPosition2.NONE=2]="NONE",ItemViewContextMenuPosition2))(ItemViewContextMenuPosition||{});class ComponentName{static{__name(this,"ComponentName")}static{this.COUNT_DELIMITER="-"}constructor(value){assertNotNull(value,"ComponentName value cannot be null"),this.value=value}hasCountPostfix(){const countDelimiterIndex=this.value.lastIndexOf(ComponentName.COUNT_DELIMITER);return countDelimiterIndex>0&&countDelimiterIndex<=this.value.length-2}removeCountPostfix(){if(!this.hasCountPostfix())return this;const nameWithoutCountPostfix=this.value.substring(0,this.value.lastIndexOf(ComponentName.COUNT_DELIMITER));return new ComponentName(nameWithoutCountPostfix)}isDuplicateOf(other){return this.value===other.value?!0:this.hasCountPostfix()?this.removeCountPostfix().equals(other):!1}createDuplicate(count){const newValue=this.value+ComponentName.COUNT_DELIMITER+""+count;return new ComponentName(newValue)}toString(){return this.value}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ComponentName))return!1;const other=o;return!!ObjectHelper.stringEquals(this.value,other.value)}}class ComponentType{static{__name(this,"ComponentType")}static{this.shortNameToInstance={}}constructor(shortName){ComponentType.shortNameToInstance[shortName]=this,this.shortName=shortName}getShortName(){return this.shortName}static byShortName(shortName){return ComponentType.shortNameToInstance[shortName]}getDefaultName(){return new ComponentName(StringHelper.capitalize(StringHelper.removeWhitespaces(this.shortName)))}getIconCls(){return""}toString(){return this.shortName}}class ItemType{static{__name(this,"ItemType")}static{this.ATTRIBUTE_TYPE="portal-component-type"}static{this.ATTRIBUTE_REGION_NAME="portal-region"}static{this.shortNameToInstance={}}constructor(shortName){ItemType.shortNameToInstance[shortName]=this,this.shortName=shortName,this.config=this.getItemTypeConfig(shortName)}getItemTypeConfig(_itemType){return null}getShortName(){return this.shortName}getConfig(){return this.config}isComponentType(){return!1}toComponentType(){return assert(this.isComponentType(),i18n("live.view.itemtype.error.isnotcomponenttype")),ComponentType.byShortName(this.shortName)}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ItemType))return!1;const other=o;return ObjectHelper.stringEquals(this.shortName,other.shortName)}static getDraggables(){const draggables=[];for(const shortName in ItemType.shortNameToInstance)if(ItemType.shortNameToInstance.hasOwnProperty(shortName)){const itemType=ItemType.shortNameToInstance[shortName];itemType.getConfig().isDraggable()&&draggables.push(itemType)}return draggables}static fromComponentType(componentType){return ItemType.byShortName(componentType.getShortName())}static byShortName(shortName){return ItemType.shortNameToInstance[shortName]}static fromHTMLElement(element){let typeAsString=element.getAttribute("data-"+ItemType.ATTRIBUTE_TYPE);if(StringHelper.isBlank(typeAsString)){const regionName=element.getAttribute("data-"+ItemType.ATTRIBUTE_REGION_NAME);StringHelper.isBlank(regionName)||(typeAsString="region")}return ItemType.byShortName(typeAsString)}static fromElement(element){return ItemType.fromHTMLElement(element.getHTMLElement())}}class ImgHelper extends ElementHelper{static{__name(this,"ImgHelper")}constructor(element){super(element),this.imgEl=element}static create(){return new ImgHelper(document.createElement("img"))}getHTMLElement(){return this.imgEl}setSrc(value){return this.imgEl.src=value,this}getSrc(){return this.imgEl.src}getCurrentSrc(){return this.imgEl.currentSrc}getNaturalWidth(){return this.imgEl.naturalWidth}getNaturalHeight(){return this.imgEl.naturalHeight}}class ImgEl extends Element{static{__name(this,"ImgEl")}static{this.debug=!1}static{this.PLACEHOLDER="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}constructor(src,className,usePlaceholder=!1){super(new NewElementBuilder().setTagName("img").setHelper(ImgHelper.create()).setClassName(className)),this.loadedListeners=[],this.errorListeners=[],(src||usePlaceholder)&&this.getEl().setSrc(src||ImgEl.PLACEHOLDER),this.onImgElLoaded(event=>{this.loaded=!0,ImgEl.debug,this.notifyLoaded(event)}),this.onImgElError(event=>{this.loaded=!1,this.notifyError(event)})}refresh(){this.setSrc(this.getSrc())}getSrc(){return this.getEl().getSrc()}getCurrentSrc(){return this.getEl().getCurrentSrc()}setSrc(source){this.loaded=!1,ImgEl.debug,this.getEl().setSrc(source)}getEl(){return super.getEl()}onLoaded(listener){this.loadedListeners.push(listener)}onError(listener){this.errorListeners.push(listener)}unLoaded(listener){this.loadedListeners=this.loadedListeners.filter(curr=>curr!==listener)}unError(listener){this.errorListeners=this.errorListeners.filter(curr=>curr!==listener)}isLoaded(){return this.loaded}isPlaceholder(){return this.getCurrentSrc()===ImgEl.PLACEHOLDER}getHTMLElement(){return super.getHTMLElement()}notifyLoaded(event){this.loadedListeners.forEach(listener=>listener(event))}notifyError(event){this.errorListeners.forEach(listener=>listener(event))}onImgElLoaded(listener){this.getEl().addEventListener("load",listener)}onImgElError(listener){this.getEl().addEventListener("error",listener)}}class H6El extends Element{static{__name(this,"H6El")}constructor(className,prefix){super(new NewElementBuilder().setTagName("h6").setClassName(className,prefix))}}class PEl extends Element{static{__name(this,"PEl")}constructor(className,prefix){super(new NewElementBuilder().setTagName("p").setClassName(className,prefix))}}class NamesView extends DivEl{static{__name(this,"NamesView")}constructor(addTitleAttribute=!0){super("names-view",StyleHelper$1.COMMON_PREFIX),this.addTitleAttribute=addTitleAttribute,this.mainNameEl=new H6El("main-name",StyleHelper$1.COMMON_PREFIX),this.appendChild(this.mainNameEl),this.subNameEl=new PEl("sub-name",StyleHelper$1.COMMON_PREFIX),this.appendChild(this.subNameEl)}setMainName(value,escapeHtml=!0){return this.mainNameEl.setHtml(value,escapeHtml),this.addTitleAttribute&&this.mainNameEl.getEl().setAttribute("title",value),this}setMainNameElements(elements){return this.mainNameEl.removeChildren(),elements.forEach(element=>{this.mainNameEl.appendChild(element)}),this}setSubName(value,title){return this.subNameEl.setHtml(value),this.addTitleAttribute&&this.subNameEl.getEl().setAttribute("title",title||value),this}setSubNameElements(elements){return this.subNameEl.removeChildren(),elements.forEach(element=>{this.subNameEl.appendChild(element)}),this}}var NamesAndIconViewSize;(function(NamesAndIconViewSize2){NamesAndIconViewSize2[NamesAndIconViewSize2.large=0]="large",NamesAndIconViewSize2[NamesAndIconViewSize2.medium=1]="medium",NamesAndIconViewSize2[NamesAndIconViewSize2.small=2]="small",NamesAndIconViewSize2[NamesAndIconViewSize2.compact=3]="compact"})(NamesAndIconViewSize||(NamesAndIconViewSize={}));class NamesAndIconViewBuilder{static{__name(this,"NamesAndIconViewBuilder")}constructor(){this.addTitleAttribute=!1,this.appendIcon=!0}setSize(size){return this.size=size,this}setAddTitleAttribute(addTitleAttribute){return this.addTitleAttribute=addTitleAttribute,this}setAppendIcon(appendIcon){return this.appendIcon=appendIcon,this}build(){return new NamesAndIconView(this)}}class NamesAndIconView extends DivEl{static{__name(this,"NamesAndIconView")}constructor(builder){super("names-and-icon-view");const sizeClassName=NamesAndIconViewSize[builder.size];sizeClassName&&this.addClass(sizeClassName),builder.appendIcon&&(this.wrapperDivEl=new DivEl("wrapper",StyleHelper$1.COMMON_PREFIX),this.appendChild(this.wrapperDivEl),this.iconImageEl=new ImgEl(null,"font-icon-default"),this.iconImageEl.setDraggable("false"),this.wrapperDivEl.appendChild(this.iconImageEl),this.iconDivEl=new DivEl("font-icon-default"),this.wrapperDivEl.appendChild(this.iconDivEl),this.iconDivEl.hide()),this.namesView=new NamesView(builder.addTitleAttribute),this.appendChild(this.namesView),this.iconLabelEl=new SpanEl("icon-label",StyleHelper$1.COMMON_PREFIX),this.iconLabelEl.hide(),this.appendChild(this.iconLabelEl)}static create(){return new NamesAndIconViewBuilder}setMainName(value,escapeHtml=!0){return this.namesView.setMainName(value,escapeHtml),this}setSubName(value,title){return this.namesView.setSubName(value,title),this}setSubNameElements(elements){return this.namesView.setSubNameElements(elements),this}setIconClass(value){const cls=value.toLowerCase().trim();return cls?(this.iconDivEl.setClass(`font-icon-default ${cls}`).removeChildren().show(),this.iconImageEl.hide()):this.iconDivEl.setClass("font-icon-default").removeChildren(),this}setIconUrl(value){return this.iconImageEl.setSrc(value),this.iconDivEl.hide(),this.iconImageEl.show(),this}setIconEl(value){return this.iconEl&&this.iconEl.remove(),this.iconEl=value,this.iconDivEl.appendChild(value).show(),this.iconImageEl.hide(),this}setDisplayIconLabel(display){return display?this.iconLabelEl.show():this.iconLabelEl.hide(),this}getNamesView(){return this.namesView}getIconImageEl(){return this.iconImageEl}setIconToolTip(toolTip){this.wrapperDivEl.getEl().setTitle(toolTip)}getWrapperDivEl(){return this.wrapperDivEl}}class ItemViewContextMenuTitle extends NamesAndIconView{static{__name(this,"ItemViewContextMenuTitle")}constructor(name,icon){super(new NamesAndIconViewBuilder().setAddTitleAttribute(!1)),this.setMainName(name),this.setIconClass(StyleHelper$1.COMMON_PREFIX+icon),this.addClass("item-view-context-menu-title")}}class AEl extends Element{static{__name(this,"AEl")}constructor(className){super(new NewElementBuilder().setTagName("a").setClassName(className)),this.setUrl("#")}setUrl(value,target){return this.getEl().setAttribute("href",value),target&&this.getEl().setAttribute("target",target),this}getTitle(){return this.getEl().getTitle()}getHref(){return this.getEl().getAttribute("href")}getTarget(){return this.getEl().getAttribute("target")}getText(){return this.getEl().getText()}static fromText(text2){const a=new AEl;return a.setHtml(text2),a}}class ItemViewPlaceholder extends DivEl{static{__name(this,"ItemViewPlaceholder")}static PAGE_EDITOR_PREFIX="xp-page-editor-";constructor(){super("item-placeholder",ItemViewPlaceholder.PAGE_EDITOR_PREFIX)}showRenderingError(url,errorMessage=i18n("live.view.component.render.error")){this.removeChildren(),this.addClass("rendering-error");const errorTitle=new PEl().setHtml(errorMessage),urlAnchor=new AEl().setUrl(url,"_blank").setHtml(i18n("live.view.component.render.error.urltext"));this.appendChildren(errorTitle,urlAnchor)}select(){}deselect(){}focus(){}}class DlEl extends Element{static{__name(this,"DlEl")}constructor(className){super(new NewElementBuilder().setTagName("dl").setClassName(className))}}class DdDtEl extends Element{static{__name(this,"DdDtEl")}constructor(tag,className){let builder=new NewElementBuilder;className&&builder.setClassName(className),(tag==="dt"||tag==="dd")&&builder.setTagName(tag),super(builder)}}class TreeMenuItem extends DdDtEl{static{__name(this,"TreeMenuItem")}constructor(action,cls="",expanded=!1){super(action.hasParentAction()?"dd":"dt"),this.action=action,cls=this.getCls(action,cls,expanded),cls&&this.setClass(cls),this.getEl().setInnerHtml(action.getLabel()),this.onClicked(()=>{action.isEnabled()&&(action.hasChildActions()?this.toggleExpand():action.execute())}),this.setEnabled(action.isEnabled()),this.setVisible(action.isVisible()),action.onPropertyChanged(changedAction=>{this.setEnabled(changedAction.isEnabled()),this.setVisible(changedAction.isVisible())})}toggleExpand(){this.toggleClass("expanded")}getAction(){return this.action}setVisible(value){return this.toggleClass("expanded",value),this}setEnabled(value){this.getEl().setDisabled(!value).toggleClass("disabled",!value)}getCls(action,cls="",expanded=!1){let fullCls=action.hasChildActions()?"collapsible ":"";return fullCls+=expanded?"expanded ":"",fullCls+cls}}class TreeContextMenu extends DlEl{static{__name(this,"TreeContextMenu")}constructor(actions,appendToBody=!0){super("context-menu"),this.itemClickListeners=[],this.itemExpandedListeners=[],this.actions=[],actions&&actions.sort(function(action1,action2){return action1.getSortOrder()-action2.getSortOrder()}).forEach(action=>{this.addAction(action)}),appendToBody&&(Body.get().appendChild(this),Body.get().onClicked(event=>this.hideMenuOnOutsideClick(event))),this.onClicked(e=>{e.preventDefault()})}addActions(actions){return actions.forEach(action=>{this.addAction(action)}),this}setActions(actions){return this.removeChildren(),this.actions=[],this.addActions(actions),this}onItemClicked(listener){this.itemClickListeners.push(listener)}unItemClicked(listener){this.itemClickListeners=this.itemClickListeners.filter(currentListener=>listener!==currentListener)}onItemExpanded(listener){this.itemExpandedListeners.push(listener)}unItemExpanded(listener){this.itemExpandedListeners=this.itemExpandedListeners.filter(currentListener=>listener!==currentListener)}onBeforeAction(listener){this.actions.forEach(action=>{action.onBeforeExecute(listener)})}unBeforeAction(listener){this.actions.forEach(action=>{action.unBeforeExecute(listener)})}onAfterAction(listener){this.actions.forEach(action=>{action.onAfterExecute(listener)})}unAfterAction(listener){this.actions.forEach(action=>{action.unAfterExecute(listener)})}showAt(x,y){TreeContextMenu.prototype.doMoveTo(this,x,y),this.show()}moveBy(dx,dy){let offset=this.getEl().getOffsetToParent();TreeContextMenu.prototype.doMoveTo(this,offset.left+dx,offset.top+dy)}addAction(action){const childActions=action.getChildActions(),menuItem=this.createMenuItem(action);if(this.appendChild(menuItem),this.actions.push(action),childActions.length>0){const subItems=action.getChildActions().map(a=>this.addAction(a));menuItem.onClicked(()=>{const oldHeight=this.getEl().getHeightWithBorder();subItems.forEach(item=>item.toggleExpand());const heightChange=this.getEl().getHeightWithBorder()-oldHeight;heightChange!==0&&this.notifyItemExpanded(heightChange)})}else menuItem.onClicked(event=>{this.notifyItemClicked(),event.preventDefault(),event.stopPropagation()});return action.onPropertyChanged(changedAction=>{menuItem.setEnabled(changedAction.isEnabled()),menuItem.setVisible(changedAction.isVisible())}),menuItem}notifyItemClicked(){this.itemClickListeners.forEach(listener=>{listener()})}notifyItemExpanded(heightChange){this.itemExpandedListeners.forEach(listener=>{listener(heightChange)})}doMoveTo(menu,x,y){menu.getEl().setLeftPx(x).setTopPx(y)}createMenuItem(action){return new TreeMenuItem(action,action.getIconClass())}hideMenuOnOutsideClick(evt){this.getEl().contains(evt.target)||this.hide()}}var ItemViewContextMenuOrientation;(function(ItemViewContextMenuOrientation2){ItemViewContextMenuOrientation2[ItemViewContextMenuOrientation2.UP=0]="UP",ItemViewContextMenuOrientation2[ItemViewContextMenuOrientation2.DOWN=1]="DOWN"})(ItemViewContextMenuOrientation||(ItemViewContextMenuOrientation={}));class ItemViewContextMenu extends DivEl{static{__name(this,"ItemViewContextMenu")}constructor(title,actions,showArrow=!0){super("menu item-view-context-menu"),this.orientation=ItemViewContextMenuOrientation.DOWN,this.orientationListeners=[],showArrow&&this.createArrow(),this.createTitle(title),this.createMenu(actions),this.initListeners(),Body.get().appendChild(this)}createArrow(){this.arrow=new ItemViewContextMenuArrow,this.appendChild(this.arrow)}createTitle(title){if(this.title=title,this.title){let lastPosition;const dragListener=__name(e=>{e.preventDefault(),e.stopPropagation();const x=e.pageX,y=e.pageY;this.moveBy(x-lastPosition.x,y-lastPosition.y),lastPosition={x,y}},"dragListener"),upListener=__name(e=>{e.preventDefault(),e.stopPropagation(),this.stopDrag(dragListener,upListener)},"upListener");this.title.onMouseDown(e=>{e.preventDefault(),e.stopPropagation(),lastPosition={x:e.pageX,y:e.pageY},this.startDrag(dragListener,upListener)}),this.onHidden(()=>{this.stopDrag(dragListener,upListener)}),this.appendChild(this.title)}}createMenu(actions){this.menu=new TreeContextMenu(actions,!1),this.menu.onItemClicked(()=>{this.hide()}),this.menu.onItemExpanded(heightChange=>{const isDown=this.orientation===ItemViewContextMenuOrientation.DOWN,el=this.getEl(),arrowHeight=this.arrow?this.arrow.getHeight():0,y=isDown?el.getTopPx()-arrowHeight-1:el.getTopPx()+el.getHeightWithBorder()-heightChange+arrowHeight+1,x=el.getLeftPx()+el.getWidth()/2;this.showAt(x,y,!1,!0)}),this.appendChild(this.menu)}initListeners(){this.onClicked(e=>{e.stopPropagation(),e.preventDefault()}),this.outsideClickListener=event=>{this.getEl().contains(event.target)||this.hide()}}showAt(x,y,notClicked=!1,keepOrientation=!1){this.menu.showAt.call(this,this.restrainX(x),this.restrainY(y,notClicked,keepOrientation)),Body.get().onClicked(this.outsideClickListener)}show(){super.show(),Body.get()?.onClicked(this.outsideClickListener)}hide(){super.hide(),Body.get()?.unClicked(this.outsideClickListener)}moveBy(dx,dy){this.menu.moveBy.call(this,dx,dy)}setActions(actions){this.menu.setActions(actions)}getMenu(){return this.menu}setOrientation(orientation){this.orientation!==orientation&&(this.orientation=orientation,this.arrow&&this.arrow.toggleVerticalPosition(orientation===ItemViewContextMenuOrientation.DOWN),this.notifyOrientationChanged(orientation))}notifyOrientationChanged(orientation){this.orientationListeners.forEach(listener=>{listener(orientation)})}onOrientationChanged(listener){this.orientationListeners.push(listener)}unOrientationChanged(listener){this.orientationListeners=this.orientationListeners.filter(curr=>curr!==listener)}startDrag(dragListener,upListener){Body.get()?.onMouseMove(dragListener),Body.get()?.onMouseUp(upListener)}stopDrag(dragListener,upListener){Body.get()?.unMouseMove(dragListener),Body.get()?.unMouseUp(upListener)}restrainX(x){const parentEl=this.getParentElement().getEl(),width=this.getEl().getWidth(),halfWidth=width/2,arrowHalfWidth=this.arrow?this.arrow.getWidth()/2:0,desiredX=x-halfWidth;let resultX=desiredX,deltaX,arrowPos;const minX=parentEl.getMarginLeft(),maxX=parentEl.getWidthWithMargin()-parentEl.getMarginRight()-width;return desiredX<minX&&(deltaX=minX-desiredX,arrowPos=Math.max(arrowHalfWidth,halfWidth-deltaX),resultX=minX),desiredX>maxX&&(deltaX=maxX-desiredX,arrowPos=Math.min(halfWidth-deltaX,width-arrowHalfWidth),resultX=maxX),this.arrow&&arrowPos&&this.arrow.getEl().setLeftPx(arrowPos),resultX}restrainY(y,notClicked,keepOrientation){let orientation=keepOrientation?this.orientation:ItemViewContextMenuOrientation.DOWN;const arrowHeight=this.arrow?this.arrow.getHeight():0,height=this.getEl().getHeight(),minY=0;let maxY,desiredY;return notClicked?maxY=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight):maxY=Math.max(document.body.scrollTop,document.documentElement.scrollTop)+window.innerHeight,orientation===ItemViewContextMenuOrientation.DOWN&&(desiredY=y+arrowHeight+(notClicked?0:1),desiredY+height>maxY&&(orientation=ItemViewContextMenuOrientation.UP)),orientation===ItemViewContextMenuOrientation.UP&&(desiredY=y-arrowHeight-height-(notClicked?0:1),desiredY<minY&&(orientation=ItemViewContextMenuOrientation.DOWN)),this.setOrientation(orientation),desiredY}}class ItemViewContextMenuArrow extends DivEl{static{__name(this,"ItemViewContextMenuArrow")}static{this.clsBottom="bottom"}static{this.clsTop="top"}static{this.clsLeft="left"}static{this.clsRight="right"}constructor(){super("item-view-context-menu-arrow "+ItemViewContextMenuArrow.clsBottom)}toggleVerticalPosition(bottom){this.toggleClass(ItemViewContextMenuArrow.clsBottom,bottom),this.toggleClass(ItemViewContextMenuArrow.clsTop,!bottom)}getWidth(){if(this.hasClass(ItemViewContextMenuArrow.clsTop)||this.hasClass(ItemViewContextMenuArrow.clsBottom))return 14;if(this.hasClass(ItemViewContextMenuArrow.clsLeft)||this.hasClass(ItemViewContextMenuArrow.clsRight))return 7}getHeight(){if(this.hasClass(ItemViewContextMenuArrow.clsTop)||this.hasClass(ItemViewContextMenuArrow.clsBottom))return 7;if(this.hasClass(ItemViewContextMenuArrow.clsLeft)||this.hasClass(ItemViewContextMenuArrow.clsRight))return 14}}class Shader{static{__name(this,"Shader")}static CLS_NAME="shader";target;scrollEnabled=!0;pageShader;northShader;eastShader;southShader;westShader;shaders;clickListeners=[];mouseEnterListeners=[];mouseLeaveListeners=[];mouseMoveListeners=[];static INSTANCE;static debug=!1;constructor(){this.pageShader=this.createShaderDiv("page"),this.northShader=this.createShaderDiv("north"),this.eastShader=this.createShaderDiv("east"),this.southShader=this.createShaderDiv("south"),this.westShader=this.createShaderDiv("west"),this.shaders=[this.pageShader,this.northShader,this.eastShader,this.southShader,this.westShader];const body=Body.get();body.appendChildren(...this.shaders),body.onMouseWheel(event=>{this.target&&this.isVisible()&&(this.scrollEnabled?setTimeout(()=>this.resizeToElement(this.target),5):(event.preventDefault(),event.stopPropagation()))}),this.shaders.forEach(shader=>{shader.onClicked(event=>this.handleClick(event)),shader.onContextMenu(event=>this.handleClick(event)),shader.onMouseEnter(event=>this.notifyMouseEntered(event)),shader.onMouseLeave(event=>this.notifyMouseLeft(event)),shader.onMouseMove(event=>this.notifyMouseMove(event))})}createShaderDiv(cls){return new DivEl(Shader.CLS_NAME+" "+cls,StyleHelper$1.getCurrentPrefix())}static get(){return Shader.INSTANCE||(Shader.INSTANCE=new Shader),Shader.INSTANCE}setScrollEnabled(enabled){return this.scrollEnabled=enabled,this}shade(element){if(!element){this.hide();return}ClassHelper.getClassName(element)==="PageView"?this.resizeToPage():this.resizeToElement(element)}hide(){this.target=void 0,this.shaders.forEach(shader=>shader.hide())}isVisible(){return this.shaders.some(shader=>shader.isVisible())}onMouseEnter(listener){this.mouseEnterListeners.push(listener)}unMouseEnter(listener){this.mouseEnterListeners=this.mouseEnterListeners.filter(curr=>listener!==curr)}notifyMouseEntered(event){this.mouseEnterListeners.forEach(listener=>{listener(event)})}onMouseLeave(listener){this.mouseLeaveListeners.push(listener)}unMouseLeave(listener){this.mouseLeaveListeners=this.mouseLeaveListeners.filter(curr=>listener!==curr)}notifyMouseLeft(event){this.mouseLeaveListeners.forEach(listener=>{listener(event)})}onMouseMove(listener){this.mouseMoveListeners.push(listener)}unMouseMove(listener){this.mouseMoveListeners=this.mouseMoveListeners.filter(curr=>listener!==curr)}notifyMouseMove(event){this.mouseMoveListeners.forEach(listener=>{listener(event)})}onClicked(listener){this.clickListeners.push(listener)}unClicked(listener){this.clickListeners=this.clickListeners.filter(curr=>listener!==curr)}notifyClicked(event){this.clickListeners.forEach(listener=>{listener(event)})}handleClick(event){event.stopPropagation(),event.preventDefault(),this.notifyClicked(event)}showShaderIfNecessary(shader,x,y,width,height){shader.getEl().setTopPx(y).setLeftPx(x).setWidthPx(width).setHeightPx(height),shader.setVisible(width>0&&height>0)}resizeToPage(){this.target=void 0,this.pageShader.getEl().setTopPx(0).setRightPx(0).setBottomPx(0).setLeftPx(0),this.pageShader.show()}resizeToElement(element){this.target=element;const win=WindowDOM.get(),bodyEl=Body.get().getEl(),documentWidth=Math.max(win.getWidth(),bodyEl.getWidth()),documentHeight=Math.max(win.getHeight(),bodyEl.getHeight()),dimensions=element.getEl().getDimensions(),x1=Math.max(0,dimensions.left),y1=Math.max(0,dimensions.top),x2=Math.min(documentWidth,dimensions.left+dimensions.width),y2=Math.min(documentHeight,dimensions.top+dimensions.height);this.showShaderIfNecessary(this.northShader,0,0,documentWidth,y1),this.showShaderIfNecessary(this.eastShader,x2,y1,documentWidth-x2,y2-y1),this.showShaderIfNecessary(this.southShader,0,y2,documentWidth,documentHeight-y2),this.showShaderIfNecessary(this.westShader,0,y1,x1,y2-y1)}}var HighlighterMode=(HighlighterMode2=>(HighlighterMode2[HighlighterMode2.RECTANGLE=0]="RECTANGLE",HighlighterMode2[HighlighterMode2.CROSSHAIR=1]="CROSSHAIR",HighlighterMode2))(HighlighterMode||{});class Highlighter extends Element{static{__name(this,"Highlighter")}rectangle;path;static INSTANCE;lastHighlightedItemView;mode;constructor(type){const html2=`<svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="${StyleHelper$1.getCls("highlighter")}" style="top:-5000px;left:-5000px">
9
+ <rect width="150" height="150"/>
10
+ <path d=""/>
11
+ </svg>`;super(ElementFromHelperBuilder.fromString(html2)),this.setMode(type||0),this.rectangle=this.getChildren()[0],this.path=this.getChildren()[1],Body.get().appendChild(this)}static get(){return Highlighter.INSTANCE||(Highlighter.INSTANCE=new Highlighter),Highlighter.INSTANCE}highlightItemView(itemView){if(!itemView){this.hide();return}const dimensions=itemView.getEl().getDimensions(),style=itemView.getType().getConfig().getHighlighterStyle();this.resize(dimensions,this.preProcessStyle(style,itemView.isEmpty())),this.show(),this.lastHighlightedItemView=itemView}highlightElement(dimensions,style){this.resize(dimensions,style),this.show()}updateLastHighlightedItemView(){this.highlightItemView(this.lastHighlightedItemView)}setMode(mode){return this.mode!=null&&this.getEl().removeClass(HighlighterMode[this.mode].toLowerCase()),this.mode=mode,mode!=null&&this.getEl().addClass(HighlighterMode[mode].toLowerCase()),this}isViewInsideSelectedContainer(itemView){return this.lastHighlightedItemView?this.lastHighlightedItemView.isContainer()&&itemView.isChildOfItemView(this.lastHighlightedItemView):!1}getSelectedView(){return this.lastHighlightedItemView}unselect(){this.hide(),this.lastHighlightedItemView=null}preProcessStyle(style,_isEmptyView){return{stroke:"rgba(0, 0, 0, 1)",strokeDasharray:style.strokeDasharray,fill:"transparent"}}resize(dimensions,style){const w=Math.round(dimensions.width),h=Math.round(dimensions.height);let strokeW;const top=Math.round(dimensions.top),left=Math.round(dimensions.left);switch(this.mode){case 0:this.rectangle.getEl().setAttribute("width",w+"").setAttribute("height",h+"").setStroke(style.stroke).setStrokeDasharray(style.strokeDasharray).setFill(style.fill),this.getEl().setWidthPx(w).setHeightPx(h).setTopPx(top).setLeftPx(left);break;case 1:{const bodyEl=Body.get().getEl(),screenH=bodyEl.getHeight(),screenW=bodyEl.getWidth();strokeW=parseInt(window.getComputedStyle(this.path.getHTMLElement(),null).getPropertyValue("stroke-width"),10),this.path.getEl().setAttribute("d",this.generatePath(strokeW/2,top+strokeW/2,w-strokeW,h-strokeW,screenW-strokeW,screenH-strokeW,left)).setStroke(style.stroke).setStrokeDasharray(style.strokeDasharray).setFill("transparent"),this.rectangle.getEl().setAttribute("width",w+"").setAttribute("height",h+"").setAttribute("x","0").setAttribute("y",top+"").setStroke(style.stroke).setFill(style.fill),this.getEl().setWidthPx(screenW).setHeightPx(screenH).setTopPx(0).setLeftPx(left);break}}}generatePath(x,y,w,h,screenW,screenH,left){return`M ${x} 0 v ${screenH} m ${w} 0 v -${screenH} M ${screenW+left} ${y} h -${screenW+2*left} m 0 ${h} h ${screenW+2*left}`}}class SelectedHighlighter extends Highlighter{static{__name(this,"SelectedHighlighter")}static SELECT_INSTANCE;constructor(){super(HighlighterMode.CROSSHAIR)}static get(){return SelectedHighlighter.SELECT_INSTANCE||(SelectedHighlighter.SELECT_INSTANCE=new SelectedHighlighter),SelectedHighlighter.SELECT_INSTANCE}preProcessStyle(style,isEmptyView){return{stroke:"rgba(11, 104, 249, 1)",strokeDasharray:style.strokeDasharray,fill:isEmptyView?"transparent":"rgba(90, 148, 238, .2)"}}}class Cursor{static{__name(this,"Cursor")}defaultBodyCursor;static INSTANCE;constructor(){this.defaultBodyCursor=Body.get().getEl().getCursor()}static get(){return Cursor.INSTANCE||(Cursor.INSTANCE=new Cursor),Cursor.INSTANCE}displayItemViewCursor(itemView){itemView&&Body.get().getEl().setCursor(itemView.getType().getConfig().getCursor())}hide(){Body.get().getEl().setCursor("none")}reset(){Body.get().getEl().setCursor(this.defaultBodyCursor||"")}}class IframeEvent extends AbstractEvent{static{__name(this,"IframeEvent")}setData(data){return this.data=data,this}getData(){return this.data}fire(){IframeEventBus.get().fireEvent(this)}static getEventBus(){return IframeEventBus.get()}}class SelectedByClickEvent extends IframeEvent{static{__name(this,"SelectedByClickEvent")}constructor(rightClicked=!1){super(),this.rightClicked=rightClicked}isRightClicked(){return this.rightClicked}}class SelectComponentEvent extends SelectedByClickEvent{static{__name(this,"SelectComponentEvent")}constructor(config){super(config?.rightClicked),this.path=config?.path,this.position=config?.position}getPath(){return this.path}getPosition(){return this.position}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class DeselectComponentEvent extends IframeEvent{static{__name(this,"DeselectComponentEvent")}constructor(path){super(),this.path=path}getPath(){return this.path}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class ItemViewIconClassResolver{static{__name(this,"ItemViewIconClassResolver")}static resolveByView(itemView){return itemView?ItemViewIconClassResolver.resolveByType(itemView.getType().getShortName()):""}static resolveByType(itemType,size){return StyleHelper$1.getCommonIconCls(itemType.toLowerCase())+(size?" "+size:"")}}class ComponentPath{static{__name(this,"ComponentPath")}static{this.DIVIDER="/"}constructor(path,parentPath){this.path=path,this.parentPath=parentPath}getPath(){return this.path}getParentPath(){return this.parentPath}toString(){return this.isRoot()?this.path.toString():this.parentPath?.isRoot()?`${this.parentPath.toString()}${this.path}`:`${this.parentPath.toString()}${ComponentPath.DIVIDER}${this.path}`}equals(o){return o instanceof ComponentPath?ObjectHelper.stringEquals(this.toString(),o.toString()):!1}isRoot(){return!this.parentPath&&this.path===ComponentPath.DIVIDER}static root(){return new ComponentPath(ComponentPath.DIVIDER)}static fromString(path){if(StringHelper.isBlank(path)||path===ComponentPath.DIVIDER)return ComponentPath.root();const pathParts=path.split(ComponentPath.DIVIDER);let parentPath,pathPart=pathParts[0]||ComponentPath.DIVIDER;for(let i=1;i<pathParts.length;i++)parentPath=new ComponentPath(pathPart,parentPath),pathPart=pathParts[i];return new ComponentPath(pathPart,parentPath)}}class FragmentComponentType extends ComponentType{static{__name(this,"FragmentComponentType")}static{this.INSTANCE=new FragmentComponentType}constructor(){super("fragment")}static get(){return FragmentComponentType.INSTANCE}}class Value{static{__name(this,"Value")}constructor(value,type){if(this.value=null,this.value=value,this.type=type,value){let isValid=this.type.isValid(value);if(isValid==null)throw new Error(ClassHelper.getClassName(this.type)+".isValid() did not return any value: "+isValid);if(isValid===!1)throw new Error(`Invalid value for type ${type.toString()}: ${JSON.stringify(value)}`)}}getType(){return this.type}isNotNull(){return!this.isNull()}isNull(){return this.value==null}getObject(){return this.value}getString(){return this.isNull()?null:this.type.valueToString(this)}getPropertySet(){return this.isNull()?null:this.value}getBoolean(){return this.isNull()?null:this.type.valueToBoolean(this)}getLong(){return this.isNull()?null:this.type.valueToNumber(this)}getDouble(){return this.isNull()?null:this.type.valueToNumber(this)}getDateTime(){return this.isNull()?null:this.value}getLocalDate(){return this.isNull()?null:this.value}getLocalDateTime(){return this.isNull()?null:this.value}getLocalTime(){return this.isNull()?null:this.value}getGeoPoint(){return this.isNull()?null:this.value}getBinaryReference(){return this.isNull()?null:this.value}getReference(){return this.isNull()?null:this.value}getLink(){return this.isNull()?null:this.value}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,Value))return!1;let other=o;return ObjectHelper.equals(this.type,other.type)?this.type.valueEquals(this.value,other.value):!1}clone(){return new Value(this.value,this.type)}}class ValueType{static{__name(this,"ValueType")}constructor(name){this.name=name}toString(){return this.name}valueToString(value){return String(value.getObject())}valueToBoolean(value){return value.getString()==="true"}valueToNumber(value){return Number(value.getObject())}isValid(_value){return!0}isConvertible(_value){return!0}newValue(value){return new Value(value,this)}newNullValue(){return new Value(null,this)}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ValueType))return!1;let other=o;return!!ObjectHelper.stringEquals(this.name,other.name)}valueEquals(_a2,_b){throw new Error("Must be implemented by inheritor: "+ClassHelper.getClassName(this))}toJsonValue(value){return value.getObject()}fromJsonValue(jsonValue){return jsonValue?this.newValue(jsonValue.toString()):jsonValue===""?this.newValue(jsonValue):this.newNullValue()}}class ValueTypePropertySet extends ValueType{static{__name(this,"ValueTypePropertySet")}constructor(){super("PropertySet")}isValid(value){return typeof value!="object"?!1:this.isPropertySet(value)}isPropertySet(value){return this.toString()===value.getType().toString()}isConvertible(){return!1}newValue(){throw new Error("A value of type Data cannot be created from a string")}toJsonValue(value){return value.isNull()?null:value.getObject().toJson()}fromJsonValue(){throw new Error("Method not supported!")}valueToString(){throw new Error("A value of type Data cannot be made into a string")}valueEquals(a,b){return ObjectHelper.equals(a,b)}}class ValueTypeString extends ValueType{static{__name(this,"ValueTypeString")}constructor(){super("String")}isValid(value){return typeof value=="string"}valueEquals(a,b){return ObjectHelper.stringEquals(a,b)}newValue(value){return value?new Value(value,this):this.newNullValue()}toJsonValue(value){return value.getString()?value.getObject():null}}class ValueTypeXml extends ValueType{static{__name(this,"ValueTypeXml")}constructor(){super("Xml")}isValid(value){return typeof value=="string"}valueEquals(a,b){return ObjectHelper.stringEquals(a,b)}newValue(value){return value?new Value(value,this):this.newNullValue()}toJsonValue(value){return value.getString()?value.getObject():null}}class ValueTypeLong extends ValueType{static{__name(this,"ValueTypeLong")}constructor(){super("Long")}isValid(value){return NumberHelper.isWholeNumber(value)}isConvertible(value){if(StringHelper.isBlank(value))return!1;let convertedValue=Number(value);return this.isValid(convertedValue)}newValue(value){return value?this.isConvertible(value)?new Value(this.convertFromString(value),this):this.newNullValue():this.newNullValue()}fromJsonValue(jsonValue){return new Value(jsonValue,this)}valueToString(value){return value.getObject().toString()}valueEquals(a,b){return ObjectHelper.numberEquals(a,b)||a==null&&b==null}convertFromString(value){return Number(value)}}class ValueTypeBoolean extends ValueType{static{__name(this,"ValueTypeBoolean")}constructor(){super("Boolean")}isValid(value){return typeof value=="boolean"}isConvertible(value){if(StringHelper.isBlank(value)||!(value==="true"||value==="false"))return!1;let convertedValue=!!value;return this.isValid(convertedValue)}newValue(value){return this.isConvertible(value)?new Value(this.convertFromString(value),this):this.newBoolean(!1)}fromJsonValue(jsonValue){return new Value(jsonValue,this)}valueToString(value){return String(value.getObject())}valueEquals(a,b){return ObjectHelper.booleanEquals(a,b)}newBoolean(value){return new Value(value,this)}convertFromString(value){if(value==="true")return!0;if(value==="false")return!1;throw new Error("given string cannot be converted to a Boolean Value: "+value)}}class ValueTypeDouble extends ValueType{static{__name(this,"ValueTypeDouble")}constructor(){super("Double")}isValid(value){return NumberHelper.isNumber(value)}isConvertible(value){if(StringHelper.isBlank(value))return!1;let convertedValue=Number(value);return this.isValid(convertedValue)}newValue(value){return value?this.isConvertible(value)?new Value(this.convertFromString(value),this):this.newNullValue():this.newNullValue()}fromJsonValue(jsonValue){return new Value(jsonValue,this)}valueToString(value){return value.getObject().toString()}valueEquals(a,b){return ObjectHelper.numberEquals(a,b)||a==null&&b==null}convertFromString(value){return Number(value)}}class TimeHM{static{__name(this,"TimeHM")}constructor(hours,minutes){this.hours=hours,this.minutes=minutes}}class TimeHMS extends TimeHM{static{__name(this,"TimeHMS")}constructor(hours,minutes,seconds){super(hours,minutes),this.seconds=seconds}}class LongTimeHMS extends TimeHMS{static{__name(this,"LongTimeHMS")}constructor(hours,minutes,seconds,fractions){super(hours,minutes,seconds),this.fractions=fractions}}class DateHelper{static{__name(this,"DateHelper")}static{this.DATE_SEPARATOR="-"}static isInvalidDate(value){return isNaN(value.getTime())}static getTZOffset(){return DateHelper.getTZOffsetForDate(new Date)}static getTZOffsetForDate(date){return date.getTimezoneOffset()/-60}static isDST(date){return Math.abs(date.getTimezoneOffset()/60)>DateHelper.getTZOffset()}static makeDateFromUTCString(value){let parsedYear=Number(value.substring(0,4)),parsedMonth=Number(value.substring(5,7)),parsedDayOfMonth=Number(value.substring(8,10)),parsedHours=Number(value.substring(11,13)),parsedMinutes=Number(value.substring(14,16)),parsedSeconds=Number(value.substring(17,19));return new Date(Date.UTC(parsedYear,parsedMonth-1,parsedDayOfMonth,parsedHours,parsedMinutes,parsedSeconds))}static formatDate(date){return""+date.getFullYear()+"-"+this.padNumber(date.getMonth()+1)+"-"+this.padNumber(date.getDate())}static formatDateTime(date,includeSeconds=!0){return`${DateHelper.formatDate(date)} ${DateHelper.getFormattedTimeFromDate(date,includeSeconds)}`}static getFormattedTimeFromDate(date,includeSeconds=!0){return DateHelper.padNumber(date.getHours())+":"+DateHelper.padNumber(date.getMinutes())+(includeSeconds?":"+DateHelper.padNumber(date.getSeconds()):"")}static dateFromTime(hours,minutes,seconds){const now=new Date;return!DateHelper.isHoursValid(hours)||!DateHelper.isMinutesValid(minutes)||seconds&&!DateHelper.isMinutesValid(seconds)?now:new Date(now.getFullYear(),now.getMonth(),now.getDate(),hours,minutes,seconds||0)}static formatTime(hours,minutes,seconds){return!DateHelper.isHoursValid(hours)||!DateHelper.isMinutesValid(minutes)||seconds&&!DateHelper.isMinutesValid(seconds)?"":DateHelper.padNumber(hours)+":"+DateHelper.padNumber(minutes)+(seconds?":"+DateHelper.padNumber(seconds):"")}static isHoursValid(hours){return hours>=0&&hours<24}static isMinutesValid(minutes){return minutes>=0&&minutes<60}static padNumber(num){return((num||0)<10?"0":"")+(num||0)}static parseLocalDate(value){return DateHelper.parseDate(value,DateHelper.DATE_SEPARATOR,!0)}static parseDate(value,dateSeparator="-",forceDaysBeOfTwoChars=!1){const dateStr=(value||"").trim();if(dateStr.length<8||dateStr.length>10)return null;const parts=dateStr.split(dateSeparator);if(parts.length!==3||parts[0].length!==4||forceDaysBeOfTwoChars&&parts[2].length!==2)return null;const parsedYear=Number(parts[0]),parsedMonth=Number(parts[1]),parsedDayOfMonth=Number(parts[2]);let date=new Date(parsedYear,parsedMonth-1,parsedDayOfMonth);return date.getFullYear()===parsedYear&&date.getMonth()===parsedMonth-1&&date.getDate()===parsedDayOfMonth?date:null}static parseDateTime(value){const dateStr=(value||"").trim();if(dateStr.length<14||dateStr.length>16)return null;const parts=dateStr.split(" ");if(parts.length!==2)return null;const datePart=parts[0],timePart=parts[1],date=DateHelper.parseDate(datePart);if(!date)return null;const time=DateHelper.parseTime(timePart);return time?(date.setHours(time.hours,time.minutes,0,0),date):null}static parseLongDateTime(value,dateTimeSeparator="-",dateSeparator="-",timeSeparator=":",fractionSeparator="."){const parts=(value||"").trim().split(dateTimeSeparator);if(parts.length!==2)return null;const datePart=parts[0],timePart=parts[1],date=DateHelper.parseDate(datePart,dateSeparator);if(!date)return null;const time=DateHelper.parseLongTime(timePart,timeSeparator,fractionSeparator);return time?(date.setHours(time.hours,time.minutes,time.seconds,time.fractions),date):null}static isUTCdate(value){return value!=null&&(value[value.length-1]==="Z"||value[value.length-1]==="z")}static numDaysInMonth(year,month){return new Date(year,month+1,0).getDate()}static getModifiedString(modified){const timeDiff=Math.abs(Date.now()-modified.getTime()),minInMs=1e3*60,hrInMs=minInMs*60,dayInMs=hrInMs*24,monInMs=dayInMs*31,yrInMs=dayInMs*365;return timeDiff<minInMs?i18n("field.lessthanminuteago"):timeDiff<2*minInMs?i18n("field.minuteago"):timeDiff<hrInMs?i18n("field.minutesago",~~(timeDiff/minInMs)):timeDiff<2*hrInMs?i18n("field.overhourago"):timeDiff<dayInMs?i18n("field.overhoursago",~~(timeDiff/hrInMs)):timeDiff<2*dayInMs?i18n("field.overdayago"):timeDiff<monInMs?i18n("field.overdayssago",~~(timeDiff/dayInMs)):timeDiff<2*monInMs?i18n("field.overmonthago"):timeDiff<yrInMs?i18n("field.overmonthsago",~~(timeDiff/monInMs)):timeDiff<2*yrInMs?i18n("field.overyearago"):i18n("field.overyearsago",~~(timeDiff/yrInMs))}static parseTime(value){const dateStr=(value||"").trim();if(dateStr.length!==5)return null;const parts=dateStr.split(":");if(parts.length!==2)return null;const hour=Number(parts[0]),minute=Number(parts[1]);return isNaN(hour)||isNaN(minute)||hour<0||hour>23||minute<0||minute>59?null:new TimeHM(hour,minute)}static parseLongTime(value,timeSeparator=":",fractionSeparator="."){const timeStr=(value||"").trim();if(timeStr.length<5||timeStr.length>12)return null;const time=timeStr.split(timeSeparator);if(time.length<2||time.length>3)return null;const hours=Number(time[0]),minutes=Number(time[1]);let seconds=0,fractions=0;if(time[2]){let secondArr=time[2].split(fractionSeparator);seconds=Number(secondArr[0]),secondArr[1]&&(fractions=Number(secondArr[1]))}return isNaN(hours)||isNaN(minutes)||isNaN(seconds)||isNaN(fractions)||hours<0||hours>23||minutes<0||minutes>59||seconds<0||seconds>59||fractions<0?null:new LongTimeHMS(hours,minutes,seconds,fractions)}}class LocalDate{static{__name(this,"LocalDate")}constructor(builder){this.year=builder.year,this.month=builder.month,this.day=builder.day}static isValidISODateString(s){return StringHelper.isBlank(s)?!1:/^([12]\d{3})(\-)([0]{1}\d{1}|[1]{1}[0-2]{1})(\-)([0-2]{1}\d{1}|[3]{1}[0-1]{1})$/.test(s)}static fromDate(date){return date?LocalDate.create().setYear(date.getFullYear()).setMonth(date.getMonth()).setDay(date.getDate()).build():null}static fromISOString(s){if(!LocalDate.isValidISODateString(s))throw new Error("Cannot parse LocalDate from string: "+s);let date=s.split(DateHelper.DATE_SEPARATOR);return LocalDate.create().setYear(Number(date[0])).setMonth(Number(date[1])-1).setDay(Number(date[2])).build()}static create(){return new LocalDateBuilder}getYear(){return this.year}getMonth(){return this.month}getDay(){return this.day}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,LocalDate))return!1;let other=o;return!!ObjectHelper.stringEquals(this.toString(),other.toString())}toString(){return this.year+DateHelper.DATE_SEPARATOR+this.padNumber(this.month+1)+DateHelper.DATE_SEPARATOR+this.padNumber(this.day)}toDate(){return DateHelper.parseDate(this.toString(),DateHelper.DATE_SEPARATOR)}padNumber(num,length=2){let numAsString=String(num);for(;numAsString.length<length;)numAsString="0"+numAsString;return numAsString}}class LocalDateBuilder{static{__name(this,"LocalDateBuilder")}setYear(value){return this.year=value,this}setMonth(value){return this.month=value,this}setDay(value){return this.day=value,this}validate(){if(this.year){if(this.month==null)throw new Error("Invalid parameter. Month should be set");if(!this.day)throw new Error("Invalid parameter. Day should be set")}else throw new Error("Invalid parameter. Year should be set")}build(){return this.validate(),new LocalDate(this)}}class ValueTypeLocalDate extends ValueType{static{__name(this,"ValueTypeLocalDate")}constructor(){super("LocalDate")}isValid(value){return ObjectHelper.iFrameSafeInstanceOf(value,LocalDate)?!0:LocalDate.isValidISODateString(value)}isConvertible(value){return StringHelper.isBlank(value)||value.length!==10||!(value.charAt(4)==="-"&&value.charAt(7)==="-")?!1:this.isValid(value)}newValue(value){if(!value||!this.isConvertible(value))return this.newNullValue();let date=LocalDate.fromISOString(value);return new Value(date,this)}toJsonValue(value){return value.isNull()?null:value.getLocalDate().toString()}valueToString(value){return value.getLocalDate().toString()}valueEquals(a,b){return ObjectHelper.equals(a,b)}}class LocalTime{static{__name(this,"LocalTime")}static{this.TIME_SEPARATOR=":"}constructor(builder){this.timeData=new TimeHMS(builder.hours,builder.minutes,builder.seconds)}static isValidString(s){return StringHelper.isBlank(s)?!1:/^(\d{1}|[0-1]{1}\d{1}|[2]{1}[0-3]{1})((?::)(\d{1}|[0-5]{1}\d{1}))?((?::)(\d{1}|[0-5]{1}\d{1}))?$/.test(s)}static fromString(s){if(!LocalTime.isValidString(s))throw new Error("Cannot parse LocalTime from string: "+s);let localTime=s.split(":"),hours=Number(localTime[0]),minutes=Number(localTime[1])||0,seconds=localTime.length>2?Number(localTime[2]):0;return LocalTime.create().setHours(hours).setMinutes(minutes).setSeconds(seconds).build()}static fromDate(date){return LocalTime.create().setHours(date.getHours()).setMinutes(date.getMinutes()).setSeconds(date.getSeconds()).build()}static create(){return new LocalTimeBuilder}getHours(){return this.timeData.hours}getMinutes(){return this.timeData.minutes}getSeconds(){return this.timeData.seconds||0}toString(){const strSeconds=this.timeData.seconds?LocalTime.TIME_SEPARATOR+this.padNumber(this.timeData.seconds):StringHelper.EMPTY_STRING;return this.padNumber(this.timeData.hours)+LocalTime.TIME_SEPARATOR+this.padNumber(this.timeData.minutes)+strSeconds}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,LocalTime))return!1;let other=o;return!(!ObjectHelper.numberEquals(this.getHours(),other.getHours())||!ObjectHelper.numberEquals(this.getMinutes(),other.getMinutes())||!ObjectHelper.numberEquals(this.getSeconds(),other.getSeconds()))}getAdjustedTime(){const date=new Date;return date.setHours(this.getHours(),this.getMinutes(),this.getSeconds()),new TimeHMS(date.getHours(),date.getMinutes(),date.getTime())}padNumber(num){return(num<10?"0":"")+num}}class LocalTimeBuilder{static{__name(this,"LocalTimeBuilder")}setHours(value){return this.hours=value,this}setMinutes(value){return this.minutes=value,this}setSeconds(value){return this.seconds=value,this}build(){return new LocalTime(this)}}class ValueTypeLocalTime extends ValueType{static{__name(this,"ValueTypeLocalTime")}constructor(){super("LocalTime")}isValid(value){return!(typeof value!="object"||!ObjectHelper.iFrameSafeInstanceOf(value,LocalTime))}isConvertible(value){return StringHelper.isBlank(value)?!1:LocalTime.isValidString(value)}newValue(value){return value?this.isConvertible(value)?new Value(LocalTime.fromString(value),this):this.newNullValue():this.newNullValue()}valueToString(value){return value.isNotNull()?value.getLocalTime().toString():null}valueEquals(a,b){return ObjectHelper.equals(a,b)}toJsonValue(value){return value.isNull()?null:value.getLocalTime().toString()}}class LocalDateTime{static{__name(this,"LocalDateTime")}static{this.DATE_TIME_SEPARATOR="T"}static{this.DATE_SEPARATOR="-"}static{this.TIME_SEPARATOR=":"}static{this.FRACTION_SEPARATOR="."}constructor(builder){this.year=builder.year,this.month=builder.month,this.day=builder.day,this.hours=builder.hours,this.minutes=builder.minutes,this.seconds=builder.seconds,this.fractions=builder.fractions}static isValidDateTime(s){return StringHelper.isBlank(s)?!1:/^(\d{2}|([12]\d{3}))(?:\-)?([0]{1}\d{1}|[1]{1}[0-2]{1})(?:\-)?([0-2]{1}\d{1}|[3]{1}[0-1]{1})(T)([0-1]{1}\d{1}|[2]{1}[0-3]{1})(?::)?([0-5]{1}\d{1})(?::)?([0-5]{1}\d{1})?(?:.)?(\d{3})?/.test(s)}static fromString(s){if(!LocalDateTime.isValidDateTime(s))throw new Error("Cannot parse LocalDateTime from string: "+s);const date=DateHelper.parseLongDateTime(s,LocalDateTime.DATE_TIME_SEPARATOR,LocalDateTime.DATE_SEPARATOR,LocalDateTime.TIME_SEPARATOR,LocalDateTime.FRACTION_SEPARATOR);if(!date)throw new Error("Cannot parse LocalDateTime from string: "+s);return LocalDateTime.create().setYear(date.getFullYear()).setMonth(date.getMonth()).setDay(date.getDate()).setHours(date.getHours()).setMinutes(date.getMinutes()).setSeconds(date.getSeconds()).setFractions(date.getMilliseconds()).build()}static fromDate(s){return LocalDateTime.create().setYear(s.getFullYear()).setMonth(s.getMonth()).setDay(s.getDate()).setHours(s.getHours()).setMinutes(s.getMinutes()).setSeconds(s.getSeconds()).setFractions(s.getMilliseconds()).build()}static create(){return new LocalDateTimeBuilder}getYear(){return this.year}getMonth(){return this.month}getDay(){return this.day}getHours(){return this.hours}getMinutes(){return this.minutes}getSeconds(){return this.seconds||0}getFractions(){return this.fractions||0}dateToString(){return this.year+LocalDateTime.DATE_SEPARATOR+this.padNumber(this.month+1)+LocalDateTime.DATE_SEPARATOR+this.padNumber(this.day)}timeToString(){let fractions=this.fractions?LocalDateTime.FRACTION_SEPARATOR+this.padNumber(this.fractions,3):StringHelper.EMPTY_STRING;return this.padNumber(this.hours)+LocalDateTime.TIME_SEPARATOR+this.padNumber(this.minutes)+LocalDateTime.TIME_SEPARATOR+this.padNumber(this.seconds?this.seconds:0)+fractions}toString(){return this.dateToString()+LocalDateTime.DATE_TIME_SEPARATOR+this.timeToString()}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,LocalDateTime))return!1;let other=o;return!!ObjectHelper.stringEquals(this.toString(),other.toString())}toDate(){return DateHelper.parseLongDateTime(this.toString(),LocalDateTime.DATE_TIME_SEPARATOR,LocalDateTime.DATE_SEPARATOR,LocalDateTime.TIME_SEPARATOR,LocalDateTime.FRACTION_SEPARATOR)}padNumber(num,length=2){let numAsString=String(num);for(;numAsString.length<length;)numAsString="0"+numAsString;return numAsString}}class LocalDateTimeBuilder{static{__name(this,"LocalDateTimeBuilder")}setYear(value){return this.year=value,this}setMonth(value){return this.month=value,this}setDay(value){return this.day=value,this}setHours(value){return this.hours=value,this}setMinutes(value){return this.minutes=value,this}setSeconds(value){return this.seconds=value,this}setFractions(value){return this.seconds&&value>0&&(this.fractions=value),this}build(){return new LocalDateTime(this)}}class ValueTypeLocalDateTime extends ValueType{static{__name(this,"ValueTypeLocalDateTime")}constructor(){super("LocalDateTime")}isValid(value){return ObjectHelper.iFrameSafeInstanceOf(value,LocalDateTime)?!0:LocalDateTime.isValidDateTime(value)}isConvertible(value){return StringHelper.isBlank(value)||value.length!==19?!1:this.isValid(value)}newValue(value){if(!value||!this.isConvertible(value))return this.newNullValue();let date=LocalDateTime.fromString(value);return new Value(date,this)}toJsonValue(value){return value.isNull()?null:value.getLocalDateTime().toString()}valueToString(value){return value.getLocalDateTime().toString()}valueEquals(a,b){return ObjectHelper.equals(a,b)}}class Timezone{static{__name(this,"Timezone")}constructor(builder){this.offset=builder.offset,this.location=builder.location}static isValidTimezone(s){return!StringHelper.isBlank(s)}static isValidOffset(s){return s>-13&&s<13}static fromOffset(s){if(!Timezone.isValidOffset(s))throw new Error("Passed Timezone ofsset is invalid: "+s);return Timezone.create().setOffset(s).build()}static getLocalTimezone(){return Timezone.fromOffset(DateHelper.getTZOffset())}static getDateTimezone(date){return Timezone.fromOffset(DateHelper.getTZOffsetForDate(date))}static getZeroOffsetTimezone(){return Timezone.create().setOffset(0).build()}static create(){return new TimezoneBuilder}getOffset(){return this.offset}getLocation(){return this.location}offsetToString(){return this.offset<0?"-"+this.padOffset(Math.abs(this.offset)):"+"+this.padOffset(Math.abs(this.offset))}toString(){return this.offsetToString()}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,Timezone))return!1;let other=o;return!!ObjectHelper.stringEquals(this.toString(),other.toString())}padOffset(num,length=2){let numAsString=String(num);for(;numAsString.length<length;)numAsString="0"+numAsString;return numAsString+":00"}}class TimezoneBuilder{static{__name(this,"TimezoneBuilder")}setOffset(value){return this.offset=value,this}setLocation(value){return this.location=value,this}build(){return new Timezone(this)}buildDefault(){return this.offset=0,new Timezone(this)}}class DateTime{static{__name(this,"DateTime")}static{this.DATE_TIME_SEPARATOR="T"}static{this.DATE_SEPARATOR="-"}static{this.TIME_SEPARATOR=":"}static{this.FRACTION_SEPARATOR="."}constructor(builder){this.year=builder.year,this.month=builder.month,this.day=builder.day,this.hours=builder.hours,this.minutes=builder.minutes,this.seconds=builder.seconds,this.fractions=builder.fractions,this.timezone=builder.timezone||Timezone.getZeroOffsetTimezone()}static isValidDateTime(s){return StringHelper.isBlank(s)?!1:/^(\d{2}|\d{4})(?:\-)?([0]{1}\d{1}|[1]{1}[0-2]{1})(?:\-)?([0-2]{1}\d{1}|[3]{1}[0-1]{1})(T)([0-1]{1}\d{1}|[2]{1}[0-3]{1})(?::)?([0-5]{1}\d{1})((:[0-5]{1}\d{1})(\.\d{3})?)?((\+|\-)([0-1]{1}\d{1}|[2]{1}[0-3]{1})(:)([0-5]{1}\d{1})|(z|Z)|$)$/.test(s)}static fromString(s){if(!DateTime.isValidDateTime(s))throw new Error("Cannot parse DateTime from string: "+s);let date,timezone;if(DateHelper.isUTCdate(s))date=DateHelper.makeDateFromUTCString(s),timezone=Timezone.getDateTimezone(date),DateHelper.isDST(date)&&date.setHours(date.getHours()-1);else{date=DateHelper.parseLongDateTime(DateTime.trimTZ(s),DateTime.DATE_TIME_SEPARATOR,DateTime.DATE_SEPARATOR,DateTime.TIME_SEPARATOR,DateTime.FRACTION_SEPARATOR);let offset=DateTime.parseOffset(s);offset!=null?timezone=Timezone.fromOffset(offset):timezone=Timezone.getZeroOffsetTimezone()}if(!date)throw new Error("Cannot parse DateTime from string: "+s);return DateTime.create().setYear(date.getFullYear()).setMonth(date.getMonth()).setDay(date.getDate()).setHours(date.getHours()).setMinutes(date.getMinutes()).setSeconds(date.getSeconds()).setFractions(date.getMilliseconds()).setTimezone(timezone).build()}static fromDate(s){return DateTime.create().setYear(s.getFullYear()).setMonth(s.getMonth()).setDay(s.getDate()).setHours(s.getHours()).setMinutes(s.getMinutes()).setSeconds(s.getSeconds()).setFractions(s.getMilliseconds()).setTimezone(Timezone.getDateTimezone(s)).build()}static create(){return new DateTimeBuilder}static parseOffset(value){if(DateHelper.isUTCdate(value))return 0;{const dateStr=(value||"").trim();if(dateStr.indexOf("+")>0){const parts=dateStr.split("+");if(parts.length===2){const offsetPart=parts[1],offset=parseFloat(offsetPart);return isNaN(offset)?0:offset}else return 0}else if(dateStr.split("-").length===4){const offsetPart=dateStr.split("-")[3],offset=parseFloat(offsetPart);return isNaN(offset)?0:-offset}else return 0}}static trimTZ(dateString){let tzStartIndex=dateString.indexOf("+");return tzStartIndex>0?dateString.substr(0,tzStartIndex):dateString.split("-").length===4?(tzStartIndex=dateString.lastIndexOf("-"),dateString.substr(0,tzStartIndex)):(tzStartIndex=dateString.toLowerCase().indexOf("z"),tzStartIndex>0?dateString.substr(0,tzStartIndex):dateString)}getYear(){return this.year}getMonth(){return this.month}getDay(){return this.day}getHours(){return this.hours}getMinutes(){return this.minutes}getSeconds(){return this.seconds||0}getFractions(){return this.fractions||0}getTimezone(){return this.timezone}dateToString(){return this.year+DateTime.DATE_SEPARATOR+this.padNumber(this.month+1)+DateTime.DATE_SEPARATOR+this.padNumber(this.day)}timeToString(){let fractions=this.fractions?DateTime.FRACTION_SEPARATOR+this.padNumber(this.fractions,3):StringHelper.EMPTY_STRING;return this.padNumber(this.hours)+DateTime.TIME_SEPARATOR+this.padNumber(this.minutes)+DateTime.TIME_SEPARATOR+this.padNumber(this.seconds?this.seconds:0)+fractions}toString(){return this.dateToString()+DateTime.DATE_TIME_SEPARATOR+this.timeToString()+this.timezone.toString()}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,DateTime))return!1;let other=o;return!!ObjectHelper.stringEquals(this.toString(),other.toString())}toDate(){return DateHelper.parseLongDateTime(DateTime.trimTZ(this.toString()),DateTime.DATE_TIME_SEPARATOR,DateTime.DATE_SEPARATOR,DateTime.TIME_SEPARATOR,DateTime.FRACTION_SEPARATOR)}padNumber(num,length=2){let numAsString=String(num);for(;numAsString.length<length;)numAsString="0"+numAsString;return numAsString}}class DateTimeBuilder{static{__name(this,"DateTimeBuilder")}setYear(value){return this.year=value,this}setMonth(value){return this.month=value,this}setDay(value){return this.day=value,this}setHours(value){return this.hours=value,this}setMinutes(value){return this.minutes=value,this}setSeconds(value){return this.seconds=value,this}setFractions(value){return this.seconds&&value>0&&(this.fractions=value),this}setTimezone(value){return this.timezone=value,this}build(){return new DateTime(this)}}class ValueTypeDateTime extends ValueType{static{__name(this,"ValueTypeDateTime")}constructor(){super("DateTime")}isValid(value){return ObjectHelper.iFrameSafeInstanceOf(value,DateTime)?!0:DateTime.isValidDateTime(value)}isConvertible(value){return StringHelper.isBlank(value)||value.length<19?!1:this.isValid(value)}newValue(value){if(!value)return this.newNullValue();if(!this.isConvertible(value))return this.newNullValue();let date=DateTime.fromString(value);return new Value(date,this)}toJsonValue(value){return value.isNull()?null:value.getDateTime().toString()}valueToString(value){return value.getDateTime().toString()}valueEquals(a,b){return ObjectHelper.equals(a,b)}}class GeoPoint{static{__name(this,"GeoPoint")}constructor(latitude,longitude){this.latitude=latitude,this.longitude=longitude}static isValidString(s){if(StringHelper.isBlank(s))return!1;let indexOfComma=s.indexOf(",");if(indexOfComma<1||s.split(",").length!==2)return!1;if(indexOfComma===s.length-1)return!1;let coordinates=s.split(","),latitude=Number(coordinates[0]),longitude=Number(coordinates[1]);return typeof latitude=="number"&&!isNaN(latitude)&&typeof longitude=="number"&&!isNaN(longitude)?-90<=latitude&&latitude<=90&&-180<=longitude&&longitude<=180:!1}static fromString(s){if(!GeoPoint.isValidString(s))throw new Error("Cannot parse GeoPoint from string: "+s);let coordinates=s.split(","),latitude=Number(coordinates[0]),longitude=Number(coordinates[1]);return new GeoPoint(latitude,longitude)}getLatitude(){return this.latitude}getLongitude(){return this.longitude}toString(){return""+this.latitude+","+this.longitude}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,GeoPoint))return!1;let other=o;return!(!ObjectHelper.numberEquals(this.latitude,other.latitude)||!ObjectHelper.numberEquals(this.longitude,other.longitude))}}class ValueTypeGeoPoint extends ValueType{static{__name(this,"ValueTypeGeoPoint")}constructor(){super("GeoPoint")}isValid(value){return!(typeof value!="object"||!ObjectHelper.iFrameSafeInstanceOf(value,GeoPoint))}isConvertible(value){return StringHelper.isBlank(value)?!1:GeoPoint.isValidString(value)}newValue(value){return value?this.isConvertible(value)?new Value(GeoPoint.fromString(value),this):this.newNullValue():this.newNullValue()}valueToString(value){return value.isNotNull()?value.getGeoPoint().toString():null}toJsonValue(value){return value.isNull()?null:value.getGeoPoint().toString()}valueEquals(a,b){return ObjectHelper.equals(a,b)}}class Reference{static{__name(this,"Reference")}constructor(value){this.referenceId=value}getNodeId(){return this.referenceId}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,Reference))return!1;let other=o;return!!ObjectHelper.stringEquals(this.referenceId,other.referenceId)}toString(){return this.referenceId}}class ValueTypeReference extends ValueType{static{__name(this,"ValueTypeReference")}constructor(){super("Reference")}isValid(value){return!(typeof value!="object"||!ObjectHelper.iFrameSafeInstanceOf(value,Reference))}isConvertible(value){return!StringHelper.isBlank(value)}newValue(value){return this.isConvertible(value)?new Value(new Reference(value),this):this.newNullValue()}valueToString(value){return value.isNotNull()?value.getReference().toString():null}toJsonValue(value){return value.isNull()?null:value.getReference().toString()}valueEquals(a,b){return ObjectHelper.equals(a,b)}}class BinaryReference{static{__name(this,"BinaryReference")}constructor(value){this.value=value}getValue(){return this.value}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,BinaryReference))return!1;let other=o;return!!ObjectHelper.stringEquals(this.value,other.value)}toString(){return this.value}}class ValueTypeBinaryReference extends ValueType{static{__name(this,"ValueTypeBinaryReference")}constructor(){super("BinaryReference")}isValid(value){return!(typeof value!="object"||!ObjectHelper.iFrameSafeInstanceOf(value,BinaryReference))}isConvertible(value){return!StringHelper.isBlank(value)}newValue(value){return this.isConvertible(value)?new Value(new BinaryReference(value),this):this.newNullValue()}valueToString(value){return value.isNotNull()?value.getBinaryReference().toString():null}toJsonValue(value){return value.isNull()?null:value.getBinaryReference().toString()}valueEquals(a,b){return ObjectHelper.equals(a,b)}}class ValueTypes{static{__name(this,"ValueTypes")}static{this.DATA=new ValueTypePropertySet}static{this.STRING=new ValueTypeString}static{this.XML=new ValueTypeXml}static{this.LOCAL_DATE=new ValueTypeLocalDate}static{this.LOCAL_TIME=new ValueTypeLocalTime}static{this.LOCAL_DATE_TIME=new ValueTypeLocalDateTime}static{this.DATE_TIME=new ValueTypeDateTime}static{this.LONG=new ValueTypeLong}static{this.BOOLEAN=new ValueTypeBoolean}static{this.DOUBLE=new ValueTypeDouble}static{this.GEO_POINT=new ValueTypeGeoPoint}static{this.REFERENCE=new ValueTypeReference}static{this.BINARY_REFERENCE=new ValueTypeBinaryReference}static{this.ALL=[ValueTypes.DATA,ValueTypes.STRING,ValueTypes.XML,ValueTypes.LOCAL_DATE,ValueTypes.LOCAL_TIME,ValueTypes.LOCAL_DATE_TIME,ValueTypes.DATE_TIME,ValueTypes.LONG,ValueTypes.BOOLEAN,ValueTypes.DOUBLE,ValueTypes.GEO_POINT,ValueTypes.REFERENCE,ValueTypes.BINARY_REFERENCE]}static fromName(name){for(const valueType of ValueTypes.ALL)if(valueType.toString()===name)return valueType;throw Error(`Unknown ValueType: ${name}`)}}var PropertyEventType;(function(PropertyEventType2){PropertyEventType2[PropertyEventType2.ADDED=0]="ADDED",PropertyEventType2[PropertyEventType2.MOVED=1]="MOVED",PropertyEventType2[PropertyEventType2.VALUE_CHANGED=2]="VALUE_CHANGED",PropertyEventType2[PropertyEventType2.REMOVED=3]="REMOVED"})(PropertyEventType||(PropertyEventType={}));class PropertyEvent{static{__name(this,"PropertyEvent")}constructor(type,property){this.type=type,this.property=property}getType(){return this.type}getProperty(){return this.property}getPath(){return this.property.getPath()}toString(){return this.getPath().toString()}}class PropertyAddedEvent extends PropertyEvent{static{__name(this,"PropertyAddedEvent")}constructor(property){super(PropertyEventType.ADDED,property)}toString(){let value=this.getProperty().getValue();return`${this.getPath().toString()} = ${String(value?.getObject()||"")}`}}class ArrayHelper{static{__name(this,"ArrayHelper")}static moveElement(oldIndex,newIndex,array){let element=array.splice(oldIndex,1)[0];newIndex>=array.length?array[newIndex]=element:array.splice(newIndex,0,element)}static addUnique(value,array){array.indexOf(value)===-1&&array.push(value)}static removeValue(value,array){let index=array.indexOf(value);index>-1&&array.splice(index,1)}static removeDuplicates(array,keyFunction){let seen={};return array.filter(item=>{let key=keyFunction(item);return seen.hasOwnProperty(key)?!1:(seen[key]=!0,!0)})}static uniqueCount(array,keyFunction){return array.map(keyFunction).sort().reduce((prev,curr,i,arr)=>curr===arr[i+1]?prev:prev+1,0)}static difference(leftValues,rightValues,equals){return leftValues.filter(leftValue=>{for(const rightValue of rightValues)if(equals(leftValue,rightValue))return!1;return!0})}static intersection(leftValues,rightValues,equals){return leftValues.filter(leftValue=>{for(const rightValue of rightValues)if(equals(leftValue,rightValue))return!0;return!1})}static findElementByFieldValue(array,field,value){let result=null;return array.every(element=>element[field]===value?(result=element,!1):!0),result}static contains(array,el){return array&&array.length>0?array.some(curEl=>curEl.equals(el)):!1}static filter(array,el){return array.filter(curEl=>!curEl.equals(el))}static flatten(array){return array.reduce((flatArray,toFlattenArray)=>flatArray.concat(Array.isArray(toFlattenArray)?ArrayHelper.flatten(toFlattenArray):toFlattenArray),[])}static filterFn(array,fn){return array.filter(fn)}}class PropertyRemovedEvent extends PropertyEvent{static{__name(this,"PropertyRemovedEvent")}constructor(property){super(PropertyEventType.REMOVED,property)}toString(){let value=this.getProperty().getValue();return`${this.getPath().toString()} = ${String(value?.getObject()||"")}`}}class PropertyPath{static{__name(this,"PropertyPath")}static{this.ROOT=new PropertyPath([],!0)}static{this.ELEMENT_DIVIDER="."}constructor(elements,absolute=!0){this.absolute=absolute,elements.forEach((element,index)=>{if(element==null)throw new Error("Path element was null at index: "+index);if(element.getName().length===0)throw new Error("Path element was empty string at index: "+index)}),this.elements=elements,this.refString=(this.absolute?PropertyPath.ELEMENT_DIVIDER:"")+this.elements.join(PropertyPath.ELEMENT_DIVIDER)}static fromString(s){let absolute=s.charAt(0)===PropertyPath.ELEMENT_DIVIDER,dataPathElements=s.split(PropertyPath.ELEMENT_DIVIDER).filter(element=>!!element).map(element=>PropertyPathElement.fromString(element));return new PropertyPath(dataPathElements,absolute)}static fromParent(parent2,...childElements){let elements=parent2.elements.slice(0).concat(childElements);return new PropertyPath(elements,parent2.isAbsolute())}static fromPathElement(element){return new PropertyPath([element],!0)}removeFirstPathElement(){return assert(this.elements.length>1,"Cannot create new path without first path element when path does not contain more than one element"),new PropertyPath(this.elements.slice(1),this.absolute)}elementCount(){return this.getElements().length}getElements(){return this.elements}getElement(index){return this.elements[index]}getFirstElement(){return this.elements[0]}getLastElement(){return this.elements[this.elements.length-1]}hasParent(){return this.elements.length>0}getParentPath(){return this.elements.length<1?null:new PropertyPath(this.elements.slice(0,-1))}toString(){return this.refString}isAbsolute(){return this.absolute}asRelative(){return new PropertyPath(this.elements,!1)}isRoot(){return this.elementCount()===0}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,PropertyPath))return!1;let other=o;return!!ObjectHelper.stringEquals(this.refString,other.refString)}}class PropertyPathElement{static{__name(this,"PropertyPathElement")}constructor(name,index){this.name=name,this.index=index}static fromString(str){if(str.indexOf("[")===-1)return new PropertyPathElement(str,0);let name=str.substring(0,str.indexOf("[")),index=parseInt(str.substring(str.indexOf("[")+1,str.indexOf("]")),10);return new PropertyPathElement(name,index)}getName(){return this.name}getIndex(){return this.index}toString(){return this.index===0?this.name:this.name+"["+this.index+"]"}}class PropertyValueChangedEvent extends PropertyEvent{static{__name(this,"PropertyValueChangedEvent")}constructor(property,previousValue,newValue,force=!1){super(PropertyEventType.VALUE_CHANGED,property),this.previousValue=previousValue,this.newValue=newValue,this.force=force}getPreviousValue(){return this.previousValue}getNewValue(){return this.newValue}isForce(){return this.force}toString(){return`[${String(this.previousValue?.getObject()||"")}] ->
12
+ [${String(this.newValue?.getString()||"")}]`}}class Property{static{__name(this,"Property")}static{this.debug=!1}constructor(builder){this.propertyValueChangedListeners=[],assertNotNull(builder.array,"array of a Property cannot be null"),assertNotNull(builder.name,"name of a Property cannot be null"),assertNotNull(builder.index,"index of a Property cannot be null"),assertNotNull(builder.value,"value of a Property cannot be null"),this.array=builder.array,this.parent=builder.array.getParent(),this.name=builder.name,this.index=builder.index,this.value=builder.value,this.value.getType().equals(ValueTypes.DATA)&&this.value.isNotNull()&&this.value.getPropertySet().setContainerProperty(this)}static checkName(name){if(name==null)throw new Error("Property name cannot be null");if(StringHelper.isBlank(name))throw new Error("Property name cannot be blank");if(name.indexOf(".")>=0)throw new Error("Property name cannot contain .");if(name.indexOf("[")>=0||name.indexOf("]")>=0)throw new Error("Property name cannot contain [ or ]")}static create(){return new PropertyBuilder}setIndex(newIndex){this.index=newIndex}setValue(value,force=!1){assertNotNull(value,"value of a Property cannot be null");let oldValue=this.value;if(this.value=value,this.value.getType().equals(ValueTypes.DATA)&&this.value.isNotNull()){let propertySet=this.value.getPropertySet();propertySet.setContainerProperty(this),this.array.registerPropertySetListeners(propertySet)}if(oldValue.getType().equals(ValueTypes.DATA)&&oldValue.isNotNull()){let removedPropertySet=oldValue.getPropertySet();removedPropertySet.setContainerProperty(null),this.array.unregisterPropertySetListeners(removedPropertySet)}value.equals(oldValue)||this.notifyPropertyValueChangedEvent(oldValue,value,force)}convertValueType(type,converter){this.array.convertValues(type,converter)}detach(){this.getType().equals(ValueTypes.DATA)&&(this.getPropertySet().setContainerProperty(null),this.array.unregisterPropertySetListeners(this.getPropertySet())),this.array=null,this.parent=null,this.propertyValueChangedListeners=[]}reset(){this.hasNullValue()||(this.getType().equals(ValueTypes.DATA)?this.getPropertySet().reset():this.setValue(this.getType().newNullValue()))}getParent(){return this.parent}hasParentProperty(){return!!this.getParentProperty()}getParentProperty(){return this.parent.getProperty()}getPath(){return this.hasParentProperty()?PropertyPath.fromParent(this.getParentProperty().getPath(),new PropertyPathElement(this.name,this.index)):PropertyPath.fromPathElement(new PropertyPathElement(this.name,this.index))}getName(){return this.name}getIndex(){return this.index}getType(){return this.value.getType()}getValue(){return this.value}hasNullValue(){return this.value.isNull()}hasNonNullValue(){return!this.value.isNull()}getPropertySet(){return this.value.getPropertySet()}getString(){return this.value.getString()}getLong(){return this.value.getLong()}getDouble(){return this.value.getDouble()}getBoolean(){return this.value.getBoolean()}getDateTime(){return this.value.getDateTime()}getLocalDate(){return this.value.getLocalDate()}getLocalDateTime(){return this.value.getLocalDateTime()}getLocalTime(){return this.value.getLocalTime()}getGeoPoint(){return this.value.getGeoPoint()}getReference(){return this.value.getReference()}getBinaryReference(){return this.value.getBinaryReference()}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,Property))return!1;let other=o;return!(!ObjectHelper.stringEquals(this.name,other.name)||!ObjectHelper.numberEquals(this.index,other.index)||!ObjectHelper.equals(this.value,other.value))}copy(destinationPropertyArray){let value;if(ValueTypes.DATA.isPropertySet(this.value)&&this.value.isNotNull()){let destinationTree=destinationPropertyArray.getTree(),copiedPropertySet=this.value.getPropertySet().copy(destinationTree);value=new Value(copiedPropertySet,ValueTypes.DATA)}else value=this.value;return Property.create().setName(this.name).setValue(value).setIndex(this.index).setArray(destinationPropertyArray).build()}onPropertyValueChanged(listener){this.propertyValueChangedListeners.push(listener)}unPropertyValueChanged(listener){this.propertyValueChangedListeners=this.propertyValueChangedListeners.filter(curr=>curr!==listener)}notifyPropertyValueChangedEvent(previousValue,newValue,force=!1){let event=new PropertyValueChangedEvent(this,previousValue,newValue,force);Property.debug,this.propertyValueChangedListeners.forEach(listener=>listener(event))}}class PropertyBuilder{static{__name(this,"PropertyBuilder")}setArray(value){return this.array=value,this}setName(value){return this.name=value,this}setIndex(value){return this.index=value,this}setValue(value){return this.value=value,this}build(){return new Property(this)}}class PropertyMovedEvent extends PropertyEvent{static{__name(this,"PropertyMovedEvent")}constructor(property,from,to){super(PropertyEventType.MOVED,property),this.from=from,this.to=to}getFrom(){return this.from}getTo(){return this.to}toString(){return"["+this.from+"] -> ["+this.to+"]"}}class PropertyArray{static{__name(this,"PropertyArray")}static{this.debug=!1}constructor(builder){this.propertyAddedListeners=[],this.propertyRemovedListeners=[],this.propertyMovedListeners=[],this.propertyValueChangedListeners=[],this.ignoreChange=!1,this.tree=builder.parent.getTree(),this.parent=builder.parent,this.name=builder.name,this.type=builder.type,this.array=[],this.propertyAddedEventHandler=event=>{this.forwardPropertyAddedEvent(event)},this.propertyRemovedEventHandler=event=>{this.forwardPropertyRemovedEvent(event)},this.propertyMovedEventHandler=event=>{this.forwardPropertyMovedEvent(event)},this.propertyValueChangedEventHandler=event=>{this.forwardPropertyValueChangedEvent(event)}}setIgnoreChange(value){this.ignoreChange=value}getIgnoreChange(){return this.ignoreChange}static create(){return new PropertyArrayBuilder}static fromJson(json,parentPropertySet,tree){let type=ValueTypes.fromName(json.type),array=new PropertyArrayBuilder().setName(json.name).setType(type).setParent(parentPropertySet).build();return json.values.forEach((propertyValueJson,index)=>{let value;if(type.equals(ValueTypes.DATA)){let valueAsPropertySet=tree.newPropertySet();propertyValueJson.set.forEach(propertyArrayJson=>{valueAsPropertySet.addPropertyArray(PropertyArray.fromJson(propertyArrayJson,valueAsPropertySet,tree))}),value=new Value(valueAsPropertySet,ValueTypes.DATA)}else value=type.fromJsonValue(propertyValueJson.v);let property=Property.create().setArray(array).setName(json.name).setIndex(index).setValue(value).build();array.addProperty(property)}),array}forEach(callBack){this.array.forEach((property,index)=>{callBack(property,index)})}map(callBack){return this.array.map(callBack)}some(callBack){return this.array.some(callBack)}containsValue(value){let result=!1;return this.forEach(property=>{ObjectHelper.equals(property.getValue(),value)&&(result=!0)}),result}getTree(){return this.tree}getParent(){return this.parent}getParentPropertyPath(){return this.parent.getProperty()==null?PropertyPath.ROOT:this.parent.getProperty().getPath()}getName(){return this.name}getType(){return this.type}convertValues(newType,converter){this.type=newType,this.array.forEach(property=>{const source=property.getValue();if(!newType.equals(source.getType())){const converted=converter(source,newType);property.setValue(converted)}})}newSet(){return this.parent.newSet()}addProperty(property){assert(property.getName()===this.name,"Expected name of added Property to be ["+this.name+"], got: "+property.getName()),assert(property.getType().equals(this.getType()),"Expected type of added Property to be ["+this.type.toString()+"], got: "+property.getType().toString()),assert(property.getIndex()===this.array.length,"Expected index of added Property to be ["+this.array.length+"], got: "+property.getIndex()),this.array.push(property),this.registerPropertyListeners(property)}add(value){this.checkType(value.getType());let property=Property.create().setArray(this).setName(this.name).setIndex(this.array.length).setValue(value).build();if(this.array.push(property),this.tree&&this.type.equals(ValueTypes.DATA)&&value.isNotNull()){let addedPropertySet=value.getPropertySet();addedPropertySet&&addedPropertySet.isDetached()&&addedPropertySet.attachToTree(this.tree)}return this.notifyPropertyAdded(property),this.registerPropertyListeners(property),property}addSet(){let newSet=this.parent.newSet();return this.add(new Value(newSet,ValueTypes.DATA)),newSet}set(index,value){this.checkType(value.getType()),this.checkIndex(index);let property;return this.get(index)!=null?(property=this.array[index],property.setValue(value)):(property=Property.create().setArray(this).setName(this.name).setIndex(this.array.length).setValue(value).build(),this.array[index]=property,this.notifyPropertyAdded(property),this.registerPropertyListeners(property)),property}move(from,to){const property=this.get(from);ArrayHelper.moveElement(from,to,this.array),this.forEach((property2,i)=>{property2.setIndex(i)}),this.notifyPropertyMoved(property,from,to)}removeAll(silent){for(let property of this.array)silent?(this.unregisterPropertyListeners(property),property.detach()):this.remove(property.getIndex());this.array=[]}remove(index){let propertyToRemove=this.get(index);if(!propertyToRemove)throw new Error("Property not found: "+PropertyPath.fromParent(this.getParentPropertyPath(),new PropertyPathElement(this.name,index)));this.array.splice(index,1),this.forEach((property,i)=>{property.setIndex(i)}),this.notifyPropertyRemoved(propertyToRemove),this.unregisterPropertyListeners(propertyToRemove),propertyToRemove.detach()}exists(index){return!!this.get(index)}get(index){return index>=this.array.length?null:this.array[index]}getValue(index){let property=this.get(index);return property?property.getValue():null}getSet(index){let property=this.get(index);return property?property.getPropertySet():null}getSize(){return this.array.length}isEmpty(){return this.array.length===0}getProperties(){return this.array.slice(0)}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,PropertyArray))return!1;let other=o;return!(!ObjectHelper.stringEquals(this.name,other.name)||!ObjectHelper.equals(this.type,other.type)||!ObjectHelper.arrayEquals(this.array,other.array))}copy(destinationPropertySet){let copy=PropertyArray.create().setName(this.name).setType(this.type).setParent(destinationPropertySet).build();return this.array.forEach(sourceProperty=>{copy.addProperty(sourceProperty.copy(copy))}),copy}registerPropertySetListeners(propertySet){PropertyArray.debug,propertySet.onPropertyAdded(this.propertyAddedEventHandler),propertySet.onPropertyRemoved(this.propertyRemovedEventHandler),propertySet.onPropertyMoved(this.propertyMovedEventHandler),propertySet.onPropertyValueChanged(this.propertyValueChangedEventHandler)}unregisterPropertySetListeners(propertySet){propertySet.unPropertyAdded(this.propertyAddedEventHandler),propertySet.unPropertyRemoved(this.propertyRemovedEventHandler),propertySet.unPropertyMoved(this.propertyMovedEventHandler),propertySet.unPropertyValueChanged(this.propertyValueChangedEventHandler)}onPropertyAdded(listener){this.propertyAddedListeners.push(listener)}unPropertyAdded(listener){this.propertyAddedListeners=this.propertyAddedListeners.filter(curr=>curr!==listener)}onPropertyRemoved(listener){this.propertyRemovedListeners.push(listener)}unPropertyRemoved(listener){this.propertyRemovedListeners=this.propertyRemovedListeners.filter(curr=>curr!==listener)}onPropertyMoved(listener){this.propertyMovedListeners.push(listener)}unPropertyMoved(listener){this.propertyMovedListeners=this.propertyMovedListeners.filter(curr=>curr!==listener)}onPropertyValueChanged(listener){this.propertyValueChangedListeners.push(listener)}unPropertyValueChanged(listener){this.propertyValueChangedListeners=this.propertyValueChangedListeners.filter(curr=>curr!==listener)}toJson(){let valuesJson=[];return this.array.forEach(property=>{if(this.type.equals(ValueTypes.DATA)){let valueSetJson=property.hasNullValue()?null:property.getPropertySet().toJson();valuesJson.push({set:valueSetJson})}else{let valueJson=this.type.toJsonValue(property.getValue());valuesJson.push({v:valueJson})}}),{name:this.name,type:this.type.toString(),values:valuesJson}}checkType(type){if(!this.type.equals(type)){const msg=`This PropertyArray expects only properties with value of type '${this.type.toString()}', got: ${type.toString()}`;throw new Error(msg)}}checkIndex(index){if(!(index<=this.array.length))throw new Error("Index out of bounds: index: "+index+", size: "+this.array.length)}registerPropertyListeners(property){PropertyArray.debug,this.type.equals(ValueTypes.DATA)&&property.hasNonNullValue()&&this.registerPropertySetListeners(property.getPropertySet()),property.onPropertyValueChanged(this.propertyValueChangedEventHandler)}unregisterPropertyListeners(property){if(PropertyArray.debug,property.unPropertyValueChanged(this.propertyValueChangedEventHandler),property.hasNonNullValue()&&property.getType().equals(ValueTypes.DATA)){let propertySet=property.getPropertySet();this.unregisterPropertySetListeners(propertySet)}}notifyPropertyAdded(property){let event=new PropertyAddedEvent(property);PropertyArray.debug,this.propertyAddedListeners.forEach(listener=>listener(event))}forwardPropertyAddedEvent(event){PropertyArray.debug,this.propertyAddedListeners.forEach(listener=>listener(event))}notifyPropertyRemoved(property){let event=new PropertyRemovedEvent(property);PropertyArray.debug,this.propertyRemovedListeners.forEach(listener=>listener(event))}forwardPropertyRemovedEvent(event){PropertyArray.debug,this.propertyRemovedListeners.forEach(listener=>listener(event))}notifyPropertyMoved(property,from,to){const event=new PropertyMovedEvent(property,from,to);PropertyArray.debug,this.propertyMovedListeners.forEach(listener=>listener(event))}forwardPropertyMovedEvent(event){PropertyArray.debug,this.propertyMovedListeners.forEach(listener=>listener(event))}forwardPropertyValueChangedEvent(event){PropertyArray.debug,this.propertyValueChangedListeners.forEach(listener=>listener(event))}idForDebug(){return this.getParentPropertyPath().toString()+"."+this.getName()}}class PropertyArrayBuilder{static{__name(this,"PropertyArrayBuilder")}setParent(value){return this.parent=value,this}setName(value){return this.name=value,this}setType(value){return this.type=value,this}build(){return new PropertyArray(this)}}class PropertySet{static{__name(this,"PropertySet")}static{this.debug=!1}constructor(tree){this.tree=null,this.hashCode=0,this.property=null,this.propertyArrayByName={},this.skipNulls=!1,this.changedListeners=[],this.propertyAddedListeners=[],this.propertyRemovedListeners=[],this.propertyMovedListeners=[],this.propertyValueChangedListeners=[],this.tree=tree,this.propertyAddedEventHandler=event=>{this.forwardPropertyAddedEvent(event)},this.propertyRemovedEventHandler=event=>{this.forwardPropertyRemovedEvent(event)},this.propertyMovedEventHandler=event=>{this.forwardPropertyMovedEvent(event)},this.propertyValueChangedEventHandler=event=>{this.forwardPropertyValueChangedEvent(event)},this.hashCode=StringHelper.hashCode(String(Date.now()))}toString(){return`PropertySet[${this.hashCode}][${this.getPropertyPath().toString()}]`}setContainerProperty(value){this.property=value}isDetached(){return!this.tree}getTree(){return this.tree}getType(){return ValueTypes.DATA}attachToTree(tree){this.tree=tree,this.forEach(property=>{property.hasNonNullValue()&&property.getType().equals(ValueTypes.DATA)&&property.getPropertySet().attachToTree(tree)})}addPropertyArray(array){assertState(this.tree===array.getTree(),"Added PropertyArray must be attached to the same PropertyTree as this PropertySet"),assert(this===array.getParent(),"propertyArray must have this PropertySet as parent"),this.propertyArrayByName[array.getName()]=array,this.registerPropertyArrayListeners(array),array.getProperties().forEach(property=>{this.forwardPropertyAddedEvent(new PropertyAddedEvent(property))})}addProperty(name,value){return this.skipNulls&&value.isNull()?(this.skipNulls=!1,null):this.getOrCreatePropertyArray(name,value.getType()).add(value)}setPropertyByPath(path,value){return ObjectHelper.iFrameSafeInstanceOf(path,PropertyPath)?this.doSetProperty(path,value):this.doSetProperty(PropertyPath.fromString(path.toString()),value)}setProperty(name,index,value){return this.getOrCreatePropertyArray(name,value.getType()).set(index,value)}removeProperties(properties){properties.forEach(property=>{this.removeProperty(property.getName(),property.getIndex())})}removeProperty(name,index){let array=this.propertyArrayByName[name];array&&array.remove(index),(!array||array.isEmpty())&&delete this.propertyArrayByName[name]}removeAllProperties(){for(const name in this.propertyArrayByName)if(this.propertyArrayByName.hasOwnProperty(name)){let propertyArray=this.propertyArrayByName[name];for(let i=0;i<propertyArray.getSize();i++)propertyArray.remove(i);delete this.propertyArrayByName[name]}}isEmpty(){let isEmpty=!0;for(const name in this.propertyArrayByName)if(this.propertyArrayByName.hasOwnProperty(name)&&(this.propertyArrayByName[name].forEach(property=>{if(!isEmpty)return;let type=property.getType();property.hasNullValue()||type.equals(ValueTypes.STRING)&&property.getValue().getString()===""||type.equals(ValueTypes.BOOLEAN)&&property.getValue().getBoolean()===!1||type.equals(ValueTypes.DATA)&&property.getValue().getPropertySet().isEmpty()||(isEmpty=!1)}),!isEmpty))return!1;return!0}removeEmptyValues(){this.doRemoveEmptyValues(this)}removeEmptySets(){this.doRemoveEmptyArrays(this)}getSize(){let size=0;return ObjectHelper.objectPropertyIterator(this.propertyArrayByName,(_name,propertyArray)=>{size+=propertyArray.getSize()}),size}countProperties(name){let array=this.propertyArrayByName[name];return array?array.getSize():0}getPropertyPath(){return this.property?this.property.getPath():PropertyPath.ROOT}getProperty(identifier,index){if(identifier==null&&index==null)return this.property;if(index!=null){Property.checkName(identifier);let array=this.propertyArrayByName[identifier];return array?array.get(index):null}else return this.getPropertyByPath(identifier)}getPropertyArray(name){return this.propertyArrayByName[name]}getPropertyArrays(){const arrays=[];for(const name in this.propertyArrayByName)if(this.propertyArrayByName.hasOwnProperty(name)){const array=this.getPropertyArray(name);array&&arrays.push(array)}return arrays}forEach(callback){ObjectHelper.objectPropertyIterator(this.propertyArrayByName,(_name,propertyArray)=>{propertyArray.forEach((property,index)=>{callback(property,index)})})}reset(){this.forEach(property=>{property.reset()})}forEachProperty(propertyName,callback){let array=this.getPropertyArray(propertyName);array&&array.forEach(callback)}isNotNull(identifier,index){let property=this.getProperty(identifier,index);return property==null?!1:!property.hasNullValue()}isNull(identifier,index){return!this.isNotNull(identifier,index)}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,PropertySet))return!1;let other=o;return!!ObjectHelper.objectMapEquals(this.propertyArrayByName,other.propertyArrayByName)}syncEmptyArrays(target){target&&target.getPropertyArrays().forEach(propertyArray=>{this.getPropertyArray(propertyArray.getName())||this.addPropertyArray(propertyArray.copy(this));const thisPropertyArray=this.getPropertyArray(propertyArray.getName());propertyArray.forEach(((property,index)=>{if(property.getType().equals(ValueTypes.DATA)){const targetPropertySet=property.getPropertySet(),thisPropertySet=thisPropertyArray.getSet(index);thisPropertySet&&thisPropertySet.syncEmptyArrays(targetPropertySet)}}))})}diff(other){let checkedProperties=[],diff=this.doDiff(other,checkedProperties),inverseDiff=other.doDiff(this,checkedProperties);return diff.added=diff.added.concat(inverseDiff.removed),diff}copy(destinationTree){let copy=new PropertySet(destinationTree);return ObjectHelper.objectPropertyIterator(this.propertyArrayByName,(_name,sourcePropertyArray)=>{let propertyArrayCopy=sourcePropertyArray.copy(copy);copy.addPropertyArray(propertyArrayCopy)}),copy}addPropertiesFromSet(sourceSet){return ObjectHelper.objectPropertyIterator(sourceSet.propertyArrayByName,(_name,sourcePropertyArray)=>{let propertyArrayCopy=sourcePropertyArray.copy(this);this.addPropertyArray(propertyArrayCopy)}),this}toJson(){let jsonArray=[];return ObjectHelper.objectPropertyIterator(this.propertyArrayByName,(_name,propertyArray)=>{jsonArray.push(propertyArray.toJson())}),jsonArray}getValuesAsString(){let result=[];return ObjectHelper.objectPropertyIterator(this.propertyArrayByName,(name,propertyArray)=>{if(name!=="_selected"){if(propertyArray.getType().equals(ValueTypes.DATA))propertyArray.forEach(property=>{result=result.concat(property.getValue().getPropertySet().getValuesAsString())});else if(!propertyArray.isEmpty()){const property=propertyArray.get(0),value=property.getValue()||ValueTypes.STRING.newNullValue();result.push({name,value:value.isNull()?"":value.getString(),path:property.getPath().toString().substr(1)})}}}),result}onChanged(listener){this.changedListeners.push(listener)}unChanged(listener){this.changedListeners=this.changedListeners.filter(curr=>curr!==listener)}onPropertyAdded(listener){this.propertyAddedListeners.push(listener)}unPropertyAdded(listener){this.propertyAddedListeners=this.propertyAddedListeners.filter(curr=>curr!==listener)}onPropertyRemoved(listener){this.propertyRemovedListeners.push(listener)}unPropertyRemoved(listener){this.propertyRemovedListeners=this.propertyRemovedListeners.filter(curr=>curr!==listener)}onPropertyMoved(listener){this.propertyMovedListeners.push(listener)}unPropertyMoved(listener){this.propertyMovedListeners=this.propertyMovedListeners.filter(curr=>curr!==listener)}onPropertyValueChanged(listener){this.propertyValueChangedListeners.push(listener)}unPropertyValueChanged(listener){this.propertyValueChangedListeners=this.propertyValueChangedListeners.filter(curr=>curr!==listener)}newSet(){if(!this.tree)throw new Error(`The PropertySet must be attached to a PropertyTree before this method can be invoked.
13
+ Use PropertySet constructor with no arguments instead.`);return this.tree.newPropertySet()}addPropertySet(name,value){if(!value){if(!this.tree)throw new Error(`The PropertySet must be attached to a PropertyTree before this method can be invoked.
14
+ Use PropertySet constructor with no arguments instead.`);value=this.tree.newPropertySet()}return this.addProperty(name,new Value(value,ValueTypes.DATA)),value}setPropertySet(name,index,value){return this.setProperty(name,index,new Value(value,ValueTypes.DATA))}setPropertySetByPath(path,value){return this.setPropertyByPath(path,new Value(value,ValueTypes.DATA))}getPropertySet(identifier,index){let property=this.getProperty(identifier,index);return property?property.getPropertySet():null}getPropertySets(name){let values=[],array=this.getPropertyArray(name);return array&&array.forEach(property=>{values.push(property.getPropertySet())}),values}addString(name,value){return this.addProperty(name,new Value(value,ValueTypes.STRING))}addStrings(name,values){let properties=[];return values.forEach(value=>{properties.push(this.addString(name,value))}),properties}setString(name,index,value){return this.setProperty(name,index,new Value(value,ValueTypes.STRING))}setStringByPath(path,value){return this.setPropertyByPath(path,new Value(value,ValueTypes.STRING))}getString(identifier,index){let property=this.getProperty(identifier,index);return property?property.getString():null}getStrings(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getString())}),values}addLong(name,value){return this.addProperty(name,new Value(value,ValueTypes.LONG))}addLongs(name,values){let properties=[];return values.forEach(value=>{properties.push(this.addLong(name,value))}),properties}setLong(name,index,value){return this.setProperty(name,index,new Value(value,ValueTypes.LONG))}setLongByPath(path,value){return this.setPropertyByPath(path,new Value(value,ValueTypes.LONG))}getLong(identifier,index){let property=this.getProperty(identifier,index);return property?property.getLong():null}getLongs(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getLong())}),values}addDouble(name,value){return this.addProperty(name,new Value(value,ValueTypes.DOUBLE))}addDoubles(name,values){let properties=[];return values.forEach(value=>{properties.push(this.addDouble(name,value))}),properties}setDouble(name,index,value){return this.setProperty(name,index,new Value(value,ValueTypes.DOUBLE))}setDoubleByPath(path,value){return this.setPropertyByPath(path,new Value(value,ValueTypes.DOUBLE))}getDouble(identifier,index){let property=this.getProperty(identifier,index);return property?property.getDouble():null}getDoubles(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getDouble())}),values}addBoolean(name,value){return this.addProperty(name,new Value(value,ValueTypes.BOOLEAN))}addBooleans(name,values){let properties=[];return values.forEach(value=>{properties.push(this.addBoolean(name,value))}),properties}setBoolean(name,index,value){return this.setProperty(name,index,new Value(value,ValueTypes.BOOLEAN))}setBooleanByPath(path,value){return this.setPropertyByPath(path,new Value(value,ValueTypes.BOOLEAN))}getBoolean(identifier,index){let property=this.getProperty(identifier,index);return property?property.getBoolean():null}getBooleans(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getBoolean())}),values}addReference(name,value){return this.addProperty(name,new Value(value,ValueTypes.REFERENCE))}addReferences(name,values){let properties=[];return values.forEach(value=>{properties.push(this.addReference(name,value))}),properties}setReference(name,index,value){return this.setProperty(name,index,new Value(value,ValueTypes.REFERENCE))}setReferenceByPath(path,value){return this.setPropertyByPath(path,new Value(value,ValueTypes.REFERENCE))}getReference(identifier,index){let property=this.getProperty(identifier,index);return property?property.getReference():null}getReferences(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getReference())}),values}addBinaryReference(name,value){return this.addProperty(name,new Value(value,ValueTypes.BINARY_REFERENCE))}addBinaryReferences(name,values){let properties=[];return values.forEach(value=>{properties.push(this.addBinaryReference(name,value))}),properties}setBinaryReference(name,index,value){return this.setProperty(name,index,new Value(value,ValueTypes.BINARY_REFERENCE))}setBinaryReferenceByPath(path,value){return this.setPropertyByPath(path,new Value(value,ValueTypes.BINARY_REFERENCE))}getBinaryReference(identifier,index){let property=this.getProperty(identifier,index);return property?property.getBinaryReference():null}getBinaryReferences(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getBinaryReference())}),values}addGeoPoint(name,value){return this.addProperty(name,new Value(value,ValueTypes.GEO_POINT))}addGeoPoints(name,values){let properties=[];return values.forEach(value=>{properties.push(this.addGeoPoint(name,value))}),properties}setGeoPoint(name,index,value){return this.setProperty(name,index,new Value(value,ValueTypes.GEO_POINT))}setGeoPointByPath(path,value){return this.setPropertyByPath(path,new Value(value,ValueTypes.GEO_POINT))}getGeoPoint(identifier,index){let property=this.getProperty(identifier,index);return property?property.getGeoPoint():null}getGeoPoints(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getGeoPoint())}),values}addLocalDate(name,value){return this.addProperty(name,new Value(value,ValueTypes.LOCAL_DATE))}addLocalDates(name,values){let properties=[];return values.forEach(value=>{properties.push(this.addLocalDate(name,value))}),properties}setLocalDate(name,index,value){return this.setProperty(name,index,new Value(value,ValueTypes.LOCAL_DATE))}setLocalDateByPath(path,value){return this.setPropertyByPath(path,new Value(value,ValueTypes.LOCAL_DATE))}getLocalDate(identifier,index){let property=this.getProperty(identifier,index);return property?property.getLocalDate():null}getLocalDates(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getLocalDate())}),values}addLocalDateTime(name,value){return this.addProperty(name,new Value(value,ValueTypes.LOCAL_DATE_TIME))}addLocalDateTimes(name,values){let properties=[];return values.forEach(value=>{properties.push(this.addLocalDateTime(name,value))}),properties}setLocalDateTime(name,index,value){return this.setProperty(name,index,new Value(value,ValueTypes.LOCAL_DATE_TIME))}setLocalDateTimeByPath(path,value){return this.setPropertyByPath(path,new Value(value,ValueTypes.LOCAL_DATE_TIME))}getLocalDateTime(identifier,index){let property=this.getProperty(identifier,index);return property?property.getLocalDateTime():null}getLocalDateTimes(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getLocalDateTime())}),values}addLocalTime(name,value){return this.addProperty(name,new Value(value,ValueTypes.LOCAL_TIME))}addLocalTimes(name,values){let properties=[];return values.forEach(value=>{properties.push(this.addLocalTime(name,value))}),properties}setLocalTime(name,index,value){return this.setProperty(name,index,new Value(value,ValueTypes.LOCAL_TIME))}setLocalTimeByPath(path,value){return this.setPropertyByPath(path,new Value(value,ValueTypes.LOCAL_TIME))}getLocalTime(identifier,index){let property=this.getProperty(identifier,index);return property?property.getLocalTime():null}getLocalTimes(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getLocalTime())}),values}addDateTime(name,value){return this.addProperty(name,new Value(value,ValueTypes.DATE_TIME))}addDateTimes(name,values){let properties=[];return values.forEach(value=>{properties.push(this.addDateTime(name,value))}),properties}setDateTime(name,index,value){return this.setProperty(name,index,new Value(value,ValueTypes.DATE_TIME))}setDateTimeByPath(path,value){return this.setPropertyByPath(path,new Value(value,ValueTypes.DATE_TIME))}getDateTime(identifier,index){let property=this.getProperty(identifier,index);return property?property.getDateTime():null}getDateTimes(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getDateTime())}),values}doSetProperty(path,value){let firstPathElement=path.getFirstElement();return path.elementCount()>1?this.getOrCreateSet(firstPathElement.getName(),firstPathElement.getIndex()).setPropertyByPath(path.removeFirstPathElement(),value):this.setProperty(firstPathElement.getName(),firstPathElement.getIndex(),value)}getOrCreateSet(name,index){let existingProperty=this.getProperty(name,index);if(existingProperty)return existingProperty.getPropertySet();{let newSet=this.tree?new PropertySet(this.tree):new PropertySet;return this.setProperty(name,index,new Value(newSet,ValueTypes.DATA)),newSet}}getOrCreatePropertyArray(name,type){let array=this.propertyArrayByName[name];return array||(array=PropertyArray.create().setParent(this).setName(name).setType(type).build(),this.propertyArrayByName[name]=array,this.registerPropertyArrayListeners(array)),array}doRemoveEmptyValues(propertySet){let toRemove=[];propertySet.forEach(property=>{let type=property.getType();if(property.hasNullValue())toRemove.push(property);else if(type.equals(ValueTypes.STRING)&&property.getValue().getString()==="")toRemove.push(property);else if(type.equals(ValueTypes.DATA)){let propertySetValue=property.getValue().getPropertySet();this.doRemoveEmptyValues(propertySetValue),propertySetValue.isEmpty()&&toRemove.push(property)}else type.equals(ValueTypes.BOOLEAN)&&property.getValue().getBoolean()===!1&&toRemove.push(property)}),propertySet.removeProperties(toRemove),propertySet.removeEmptyArrays(propertySet)}doRemoveEmptyArrays(propertySet){propertySet.forEach(property=>{if(property.getType().equals(ValueTypes.DATA)){const propertySetValue=property.getValue().getPropertySet();this.removeEmptyArrays(propertySetValue)}}),this.removeEmptyArrays(propertySet)}removeEmptyArrays(propertySet){ObjectHelper.objectPropertyIterator(propertySet.propertyArrayByName,(name,propertyArray)=>{propertyArray.isEmpty()&&delete propertySet.propertyArrayByName[name]})}getPropertyByPath(path){return ObjectHelper.iFrameSafeInstanceOf(path,PropertyPath)?this.doGetPropertyByPath(path):this.doGetPropertyByPath(PropertyPath.fromString(path.toString()))}doGetPropertyByPath(path){let firstElement=path.getFirstElement();if(path.elementCount()>1){let property=this.getProperty(firstElement.getName(),firstElement.getIndex());return property?property.getPropertySet().getPropertyByPath(path.removeFirstPathElement()):null}else return this.getProperty(firstElement.getName(),firstElement.getIndex())}doDiff(other,checkedProperties=[]){let added=[],removed=[],modified=[];return this.forEach(property=>{if(checkedProperties.indexOf(property.getPath().toString())===-1){let type=property.getType(),otherProperty=other.getProperty(property.getName(),property.getIndex());if(!otherProperty)removed.push(property);else if(!type.equals(ValueTypes.DATA))property.equals(otherProperty)||modified.push({oldValue:property,newValue:otherProperty}),checkedProperties.push(property.getPath().toString());else{let diff=property.getValue().getPropertySet().doDiff(otherProperty.getValue().getPropertySet(),checkedProperties);added=added.concat(diff.added),removed=removed.concat(diff.removed),modified=modified.concat(diff.modified)}}}),{added,removed,modified}}registerPropertyArrayListeners(array){PropertySet.debug,array.onPropertyAdded(this.propertyAddedEventHandler),array.onPropertyRemoved(this.propertyRemovedEventHandler),array.onPropertyMoved(this.propertyMovedEventHandler),array.onPropertyValueChanged(this.propertyValueChangedEventHandler)}notifyChangedListeners(event){PropertySet.debug,this.changedListeners.forEach(listener=>listener(event))}forwardPropertyAddedEvent(event){this.propertyAddedListeners.forEach(listener=>listener(event)),PropertySet.debug,this.notifyChangedListeners(event)}forwardPropertyRemovedEvent(event){PropertySet.debug,this.propertyRemovedListeners.forEach(listener=>listener(event)),this.notifyChangedListeners(event)}forwardPropertyMovedEvent(event){PropertySet.debug,this.propertyMovedListeners.forEach(listener=>listener(event)),this.notifyChangedListeners(event)}forwardPropertyValueChangedEvent(event){PropertySet.debug,this.propertyValueChangedListeners.forEach(listener=>listener(event)),this.notifyChangedListeners(event)}}class PropertyTree{static{__name(this,"PropertyTree")}constructor(sourceRoot){sourceRoot?this.root=sourceRoot.copy(this):this.root=new PropertySet(this)}static fromJson(json){assertNotNull(json,"a json is required");let tree=new PropertyTree;return json.forEach(propertyArrayJson=>{tree.root.addPropertyArray(PropertyArray.fromJson(propertyArrayJson,tree.root,tree))}),tree}getRoot(){return this.root}addProperty(name,value){return this.root.addProperty(name,value)}setPropertyByPath(path,value){return this.root.setPropertyByPath(path,value)}setProperty(name,index,value){return this.root.setProperty(name,index,value)}removeProperties(properties){this.root.removeProperties(properties)}removeProperty(name,index){this.root.removeProperty(name,index)}getProperty(identifier,index){return this.root.getProperty(identifier,index)}getPropertyArray(name){return this.root.getPropertyArray(name)}forEachProperty(name,callback){this.root.forEachProperty(name,callback)}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,PropertyTree))return!1;let other=o;return!!ObjectHelper.equals(this.root,other.root)}removeEmptyValues(){this.root.removeEmptyValues()}diff(other){return this.root.diff(other.root)}copy(){return new PropertyTree(this.getRoot())}toJson(){return this.getRoot().toJson()}onChanged(listener){this.root.onChanged(listener)}unChanged(listener){this.root.unChanged(listener)}onPropertyAdded(listener){this.root.onPropertyAdded(listener)}unPropertyAdded(listener){this.root.unPropertyAdded(listener)}onPropertyRemoved(listener){this.root.onPropertyRemoved(listener)}unPropertyRemoved(listener){this.root.unPropertyRemoved(listener)}onPropertyMoved(listener){this.root.onPropertyMoved(listener)}unPropertyMoved(listener){this.root.unPropertyMoved(listener)}onPropertyValueChanged(listener){this.root.onPropertyValueChanged(listener)}unPropertyValueChanged(listener){this.root.unPropertyValueChanged(listener)}newPropertySet(){return new PropertySet(this)}addPropertySet(name,value){return this.root.addPropertySet(name,value)}setPropertySet(name,index,value){return this.root.setPropertySet(name,index,value)}setPropertySetByPath(path,value){return this.root.setPropertySetByPath(path,value)}getPropertySet(identifier,index){return this.root.getPropertySet(identifier,index)}getPropertySets(name){return this.root.getPropertySets(name)}addString(name,value){return this.root.addString(name,value)}addStrings(name,values){return this.root.addStrings(name,values)}setString(name,index,value){return this.root.setString(name,index,value)}setStringByPath(path,value){return this.root.setStringByPath(path,value)}getString(identifier,index){return this.root.getString(identifier,index)}getStrings(name){return this.root.getStrings(name)}addLong(name,value){return this.root.addLong(name,value)}addLongs(name,values){return this.root.addLongs(name,values)}setLong(name,index,value){return this.root.setLong(name,index,value)}setLongByPath(path,value){return this.root.setLongByPath(path,value)}getLong(identifier,index){let property=this.getProperty(identifier,index);return property?property.getLong():null}getLongs(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getLong())}),values}addDouble(name,value){return this.root.addDouble(name,value)}addDoubles(name,values){return this.root.addDoubles(name,values)}setDouble(name,index,value){return this.root.setDouble(name,index,value)}setDoubleByPath(path,value){return this.root.setDoubleByPath(path,value)}getDouble(identifier,index){let property=this.getProperty(identifier,index);return property?property.getDouble():null}getDoubles(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getDouble())}),values}addBoolean(name,value){return this.root.addBoolean(name,value)}addBooleans(name,values){return this.root.addBooleans(name,values)}setBoolean(name,index,value){return this.root.setBoolean(name,index,value)}setBooleanByPath(path,value){return this.root.setBooleanByPath(path,value)}getBoolean(identifier,index){let property=this.getProperty(identifier,index);return property?property.getBoolean():null}getBooleans(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getBoolean())}),values}addReference(name,value){return this.root.addReference(name,value)}addReferences(name,values){return this.root.addReferences(name,values)}setReference(name,index,value){return this.root.setReference(name,index,value)}setReferenceByPath(path,value){return this.root.setReferenceByPath(path,value)}getReference(identifier,index){let property=this.getProperty(identifier,index);return property?property.getReference():null}getReferences(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getReference())}),values}addBinaryReference(name,value){return this.root.addBinaryReference(name,value)}addBinaryReferences(name,values){return this.root.addBinaryReferences(name,values)}setBinaryReference(name,index,value){return this.root.setBinaryReference(name,index,value)}setBinaryReferenceByPath(path,value){return this.root.setBinaryReferenceByPath(path,value)}getBinaryReference(identifier,index){let property=this.getProperty(identifier,index);return property?property.getBinaryReference():null}getBinaryReferences(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getBinaryReference())}),values}addGeoPoint(name,value){return this.root.addGeoPoint(name,value)}addGeoPoints(name,values){return this.root.addGeoPoints(name,values)}setGeoPoint(name,index,value){return this.root.setGeoPoint(name,index,value)}setGeoPointByPath(path,value){return this.root.setGeoPointByPath(path,value)}getGeoPoint(identifier,index){let property=this.getProperty(identifier,index);return property?property.getGeoPoint():null}getGeoPoints(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getGeoPoint())}),values}addLocalDate(name,value){return this.root.addLocalDate(name,value)}addLocalDates(name,values){return this.root.addLocalDates(name,values)}setLocalDate(name,index,value){return this.root.setLocalDate(name,index,value)}setLocalDateByPath(path,value){return this.root.setLocalDateByPath(path,value)}getLocalDate(identifier,index){let property=this.getProperty(identifier,index);return property?property.getLocalDate():null}getLocalDates(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getLocalDate())}),values}addLocalDateTime(name,value){return this.root.addLocalDateTime(name,value)}addLocalDateTimes(name,values){return this.root.addLocalDateTimes(name,values)}setLocalDateTime(name,index,value){return this.root.setLocalDateTime(name,index,value)}setLocalDateTimeByPath(path,value){return this.root.setLocalDateTimeByPath(path,value)}getLocalDateTime(identifier,index){let property=this.getProperty(identifier,index);return property?property.getLocalDateTime():null}getLocalDateTimes(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getLocalDateTime())}),values}addLocalTime(name,value){return this.root.addLocalTime(name,value)}addLocalTimes(name,values){return this.root.addLocalTimes(name,values)}setLocalTime(name,index,value){return this.root.setLocalTime(name,index,value)}setLocalTimeByPath(path,value){return this.root.setLocalTimeByPath(path,value)}getLocalTime(identifier,index){let property=this.getProperty(identifier,index);return property?property.getLocalTime():null}getLocalTimes(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getLocalTime())}),values}addDateTime(name,value){return this.root.addDateTime(name,value)}addDateTimes(name,values){return this.root.addDateTimes(name,values)}setDateTime(name,index,value){return this.root.setDateTime(name,index,value)}setDateTimeByPath(path,value){return this.root.setDateTimeByPath(path,value)}getDateTime(identifier,index){let property=this.getProperty(identifier,index);return property?property.getDateTime():null}getDateTimes(name){let values=[];return this.getPropertyArray(name).forEach(property=>{values.push(property.getDateTime())}),values}isEmpty(){return this.root.isEmpty()}}class PropertyTreeHelper{static{__name(this,"PropertyTreeHelper")}static trimPropertyTree(data){const copy=data.copy();return copy.removeEmptyValues(),copy}static propertyTreesEqual(config,otherConfig,ignoreEmptyValues=!0){return ignoreEmptyValues?PropertyTreeHelper.propertyTreesEqualIgnoreEmptyValues(config,otherConfig):ObjectHelper.equals(config,otherConfig)}static propertyTreesEqualIgnoreEmptyValues(config,otherConfig){if(PropertyTreeHelper.bothEmpty(config,otherConfig))return!0;const data=config&&PropertyTreeHelper.trimPropertyTree(config),otherData=otherConfig&&PropertyTreeHelper.trimPropertyTree(otherConfig);return ObjectHelper.equals(data,otherData)}static bothEmpty(config,otherConfig){return!!(PropertyTreeHelper.isEmpty(config)&&PropertyTreeHelper.isEmpty(otherConfig))}static isEmpty(config){return!config||config.isEmpty()}}class Component{static{__name(this,"Component")}constructor(builder){this.componentUpdatedListeners=[],this.name=builder.name,this.parent=builder.parent,this.type=builder.type}setParent(parent2){this.parent=parent2}getIndex(){return this.parent?.getComponentIndex(this)??-1}getType(){return this.type}getPath(){return this.parent?new ComponentPath(this.getIndex(),this.parent.getPath()):ComponentPath.root()}getName(){return this.name}setName(newValue){this.name=newValue}doReset(){throw new Error("Must be implemented by inheritors")}reset(){this.doReset()}isEmpty(){throw new Error("Must be implemented by inheritors")}getParent(){return this.parent}duplicate(){const duplicateName=this.getName(),duplicatedComponent=this.clone();return duplicatedComponent.setName(duplicateName),duplicatedComponent}remove(){this.parent.removeComponent(this)}toJson(){throw new Error("Must be implemented by inheritor: "+ClassHelper.getClassName(this))}toString(){return"Component["+(this.name?this.name.toString():"")+"]"}equals(o){return o instanceof Component}getComponentByPath(path){return null}clone(){throw new Error("Must be implemented by inheritors")}onComponentUpdated(listener){this.componentUpdatedListeners.push(listener)}unComponentUpdated(listener){this.componentUpdatedListeners=this.componentUpdatedListeners.filter(l=>l!==listener)}notifyComponentUpdated(event){this.componentUpdatedListeners.forEach(listener=>listener(event))}}class ComponentBuilder{static{__name(this,"ComponentBuilder")}constructor(source){source&&(this.name=source.getName(),this.parent=source.getParent(),this.index=source.getIndex(),this.type=source.getType())}setIndex(value){return this.index=value,this}setName(value){return this.name=value,this}setParent(value){return this.parent=value,this}setType(value){return this.type=value,this}fromJson(json){return this.setName(json.name?new ComponentName(json.name):null),this}}class BaseRegionChangedEvent{static{__name(this,"BaseRegionChangedEvent")}constructor(path){this.path=path}getPath(){return this.path}}class ComponentUpdatedEvent extends BaseRegionChangedEvent{static{__name(this,"ComponentUpdatedEvent")}constructor(componentPath){super(componentPath)}}class ComponentConfigUpdatedEvent extends ComponentUpdatedEvent{static{__name(this,"ComponentConfigUpdatedEvent")}constructor(componentPath,config){super(componentPath),this.config=config.copy()}getConfig(){return this.config}}class ConfigBasedComponent extends Component{static{__name(this,"ConfigBasedComponent")}static{this.PROPERTY_CONFIG="config"}static{this.debug=!1}constructor(builder){super(builder),this.config=builder.config,this.configChangedHandler=event=>{ConfigBasedComponent.debug,this.disableEventForwarding||this.notifyComponentUpdated(new ComponentConfigUpdatedEvent(this.getPath(),this.config))},this.config.onChanged(this.configChangedHandler)}setDisableEventForwarding(value){this.disableEventForwarding=value}getConfig(){return this.config}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ConfigBasedComponent)||!super.equals(o))return!1;const other=o;return PropertyTreeHelper.propertyTreesEqual(this.config,other.config,!1)}}class ConfigBasedComponentBuilder extends ComponentBuilder{static{__name(this,"ConfigBasedComponentBuilder")}constructor(source){super(source),source?this.config=source.getConfig()?source.getConfig().copy():null:this.config=new PropertyTree}setConfig(value){return this.config=value,this}fromJson(json){return super.fromJson(json),json.config&&this.setConfig(PropertyTree.fromJson(json.config)),this}}class ContentId{static{__name(this,"ContentId")}constructor(value){if(!ContentId.isValidContentId(value))throw new Error("Invalid content id: "+value);this.value=value}static isValidContentId(id){return!StringHelper.isEmpty(id)&&!StringHelper.isBlank(id)}static fromReference(reference){return new ContentId(reference.getNodeId())}toString(){return this.value}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ContentId))return!1;const other=o;return!!ObjectHelper.stringEquals(this.value,other.value)}static fromString(str){return new ContentId(str)}}class ComponentFragmentUpdatedEvent extends ComponentUpdatedEvent{static{__name(this,"ComponentFragmentUpdatedEvent")}constructor(componentPath,value){super(componentPath),this.fragmentId=value}getFragmentId(){return this.fragmentId}}class FragmentComponent extends ConfigBasedComponent{static{__name(this,"FragmentComponent")}static{this.PROPERTY_FRAGMENT="fragment"}constructor(builder){super(builder),this.fragment=builder.fragment}getFragment(){return this.fragment}setFragment(contentId,name){const oldValue=this.fragment;this.fragment=contentId,this.setName(name?new ComponentName(name):this.getType().getDefaultName()),ObjectHelper.equals(oldValue,contentId)||this.notifyComponentUpdated(new ComponentFragmentUpdatedEvent(this.getPath(),contentId))}hasFragment(){return!!this.fragment}doReset(){this.setFragment(null,null)}isEmpty(){return!this.fragment}toJson(){const json={};return json.fragment=this.fragment!=null?this.fragment.toString():null,json.config=this.config!=null?this.config.toJson():null,{FragmentComponent:json}}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,FragmentComponent))return!1;const other=o;return ObjectHelper.equals(this.fragment,other.fragment)?super.equals(o):!1}clone(){return new FragmentComponentBuilder(this).build()}}class FragmentComponentBuilder extends ConfigBasedComponentBuilder{static{__name(this,"FragmentComponentBuilder")}constructor(source){super(source),source&&(this.fragment=source.getFragment()),this.setType(FragmentComponentType.get())}setFragment(value){return this.fragment=value,this}fromJson(json){return super.fromJson(json),json.fragment&&this.setFragment(new ContentId(json.fragment)),this}build(){return new FragmentComponent(this)}}class PageTemplateKey extends ContentId{static{__name(this,"PageTemplateKey")}static fromContentId(id){return new PageTemplateKey(id.toString())}static fromString(s){return new PageTemplateKey(s)}constructor(s){super(s)}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,PageTemplateKey))return!1;const other=o;return super.equals(other)}}class ComponentRemovedEvent extends BaseRegionChangedEvent{static{__name(this,"ComponentRemovedEvent")}constructor(componentPath){super(componentPath)}}class ComponentAddedEvent extends BaseRegionChangedEvent{static{__name(this,"ComponentAddedEvent")}constructor(component,index){super(component.getPath()),this.component=component,this.index=index}getPath(){return this.component.getPath()}getComponent(){return this.component}getIndex(){return this.index}}class ComponentEventsHolder{static{__name(this,"ComponentEventsHolder")}constructor(){this.componentAddedListeners=[],this.componentRemovedListeners=[],this.componentUpdatedListeners=[]}onComponentAdded(listener){this.componentAddedListeners.push(listener)}unComponentAdded(listener){this.componentAddedListeners=this.componentAddedListeners.filter(l=>l!==listener)}notifyComponentAdded(event){this.componentAddedListeners.forEach(listener=>listener(event))}onComponentRemoved(listener){this.componentRemovedListeners.push(listener)}unComponentRemoved(listener){this.componentRemovedListeners=this.componentRemovedListeners.filter(l=>l!==listener)}notifyComponentRemoved(event){this.componentRemovedListeners.forEach(listener=>listener(event))}onComponentUpdated(listener){this.componentUpdatedListeners.push(listener)}unComponentUpdated(listener){this.componentUpdatedListeners=this.componentUpdatedListeners.filter(l=>l!==listener)}notifyComponentUpdated(event){this.componentUpdatedListeners.forEach(listener=>listener(event))}}class ComponentEventsWrapper{static{__name(this,"ComponentEventsWrapper")}constructor(events){this.eventsHolder=events}onComponentAdded(listener){this.eventsHolder.onComponentAdded(listener)}unComponentAdded(listener){this.eventsHolder.unComponentAdded(listener)}onComponentRemoved(listener){this.eventsHolder.onComponentRemoved(listener)}unComponentRemoved(listener){this.eventsHolder.unComponentRemoved(listener)}onComponentUpdated(listener){this.eventsHolder.onComponentUpdated(listener)}unComponentUpdated(listener){this.eventsHolder.unComponentUpdated(listener)}}class Region{static{__name(this,"Region")}static{this.debug=!1}constructor(builder){this.components=[],this.componentEventsHolder=new ComponentEventsHolder,this.name=builder.name,this.parent=builder.parent,this.componentUpdatedEventHandler=event=>{this.notifyComponentUpdatedEvent(event)},builder.components.forEach(component=>{this.registerComponent(component)})}setParent(parent2){this.parent=parent2}getName(){return this.name}getType(){return"region"}getParent(){return this.parent}getPath(){return new ComponentPath(this.name,this.parent?.getPath())}isEmpty(){return!this.components||this.components.length===0}empty(){for(Region.debug;this.components.length>0;)this.removeComponent(this.components[this.components.length-1])}addComponent(component,index){return this.addComponentViaEvent(new ComponentAddedEvent(component,index))}addComponentViaEvent(addEvent){return Region.debug,this.registerComponent(addEvent.getComponent(),addEvent.getIndex()),this.componentEventsHolder.notifyComponentAdded(addEvent||new ComponentAddedEvent(addEvent.getComponent())),addEvent.getComponent()}removeComponent(component){return this.removeComponentViaEvent(new ComponentRemovedEvent(component.getPath()))}removeComponentViaEvent(removeEvent){const componentToRemove=this.components.find(component=>component.getPath().equals(removeEvent.getPath()));return componentToRemove?(this.unregisterComponent(componentToRemove),this.componentEventsHolder.notifyComponentRemoved(removeEvent),componentToRemove):null}getComponents(){return this.components}getComponentByIndex(index){const component=this.components[index];if(!component){const message=`The rendered page is not consistent with the page components structure. Expected component with index ${index} was not found in region '${this.getName()}'.`;throw Error(message)}return assertState(component.getIndex()===index,"Index of Component is not as expected. Expected ["+index+"], was: "+component.getIndex()),component}getComponentIndex(component){return this.components.indexOf(component)}getComponentByPath(path){let result=null;return this.components.some(component=>component.getPath().equals(path)?(result=component,!0):(result=component.getComponentByPath(path),!!result)),result}getEventsManager(){return new ComponentEventsWrapper(this.componentEventsHolder)}toJson(){const componentJsons=[];return this.components.forEach(component=>{componentJsons.push(component.toJson())}),{name:this.name,components:componentJsons}}toString(){return"Region["+this.getPath().toString()+"]"}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,Region))return!1;const other=o;return!(!ObjectHelper.stringEquals(this.name,other.name)||!ObjectHelper.arrayEquals(this.components,other.components))}clone(){return new RegionBuilder(this).build()}registerComponent(component,index){Region.debug,index>=0&&index<this.components.length?this.components.splice(index,0,component):this.components.push(component),component.setParent(this),component.onComponentUpdated(this.componentUpdatedEventHandler)}unregisterComponent(component){Region.debug,component.unComponentUpdated(this.componentUpdatedEventHandler);const index=component.getIndex();if(index===-1)throw new Error(component.toString()+" to remove does not exist in "+this.toString());this.components.splice(index,1)}notifyComponentAddedEvent(event){this.componentEventsHolder.notifyComponentAdded(event)}notifyComponentRemovedEvent(event){this.componentEventsHolder.notifyComponentRemoved(event)}notifyComponentUpdatedEvent(event){this.componentEventsHolder.notifyComponentUpdated(event)}static create(source){return new RegionBuilder(source)}}class RegionBuilder{static{__name(this,"RegionBuilder")}constructor(source){this.components=[],source&&(this.name=source.getName(),this.parent=source.getParent(),source.getComponents().forEach(component=>{this.components.push(component.clone())}))}setName(value){return this.name=value,this}setParent(value){return this.parent=value,this}addComponent(value){return this.components.push(value),this}setComponents(value){return this.components=value,this}build(){return new Region(this)}}var MessageType;(function(MessageType2){MessageType2[MessageType2.INFO=0]="INFO",MessageType2[MessageType2.ERROR=1]="ERROR",MessageType2[MessageType2.WARNING=2]="WARNING",MessageType2[MessageType2.ACTION=3]="ACTION",MessageType2[MessageType2.SUCCESS=4]="SUCCESS"})(MessageType||(MessageType={}));class MessageAction{static{__name(this,"MessageAction")}constructor(name,handler){this.name=name,this.handler=handler}getName(){return this.name}getHandler(){return this.handler}}class Message{static{__name(this,"Message")}static{this.shortLifeTime=5e3}static{this.longLifeTime=3e4}constructor(type,text2,autoHide=!0,lifeTime){this.type=type,this.text=text2,this.actions=[],this.autoHide=autoHide,this.lifeTime=lifeTime}getLifeTime(){return this.lifeTime}static newSuccess(text2,autoHide=!0,lifeTime=Message.shortLifeTime){return new Message(MessageType.SUCCESS,text2,autoHide,autoHide?lifeTime:0)}static newInfo(text2,autoHide=!0,lifeTime=Message.shortLifeTime){return new Message(MessageType.INFO,text2,autoHide,autoHide?lifeTime:0)}static newError(text2,autoHide=!0,lifeTime=Message.longLifeTime){return new Message(MessageType.ERROR,text2,autoHide,autoHide?lifeTime:0)}static newWarning(text2,autoHide=!0,lifeTime=Message.longLifeTime){return new Message(MessageType.WARNING,text2,autoHide,autoHide?lifeTime:0)}static newAction(text2,autoHide=!0,lifeTime){return new Message(MessageType.ACTION,text2,autoHide,autoHide?lifeTime:0)}getType(){return this.type}isError(){return this.type===MessageType.ERROR}isWarning(){return this.type===MessageType.WARNING}getText(){return this.text}getActions(){return this.actions}getAutoHide(){return this.autoHide}addAction(name,handler){this.actions.push(new MessageAction(name,handler))}}class NotificationContainer extends DivEl{static{__name(this,"NotificationContainer")}constructor(){super("notification-container"),this.wrapper=new DivEl("notification-wrapper"),this.appendChild(this.wrapper)}getWrapper(){return this.wrapper}}class NotificationMessage extends DivEl{static{__name(this,"NotificationMessage")}constructor(message){super("notification"),message.getType()&&this.addClass(MessageType[message.getType()].toLowerCase()),this.message=message;const notificationInner=new DivEl("notification-inner");this.removeEl=new SpanEl("notification-remove icon-close"),this.notificationText=new DivEl("notification-text"),this.actionList=new DivEl("notification-actions"),this.notificationText.setHtml(message.getText()),notificationInner.appendChildren(this.notificationText,this.actionList),this.appendChildren(notificationInner,this.removeEl)}getMessage(){return this.message}isAutoHide(){return this.message.getAutoHide()}setText(text2){return this.notificationText.getEl().setInnerHtml(text2),this}addAction(action){return this.actionList.appendChild(NotificationMessage.createAction(action)),this}getRemoveEl(){return this.removeEl}static createAction(action){const aEl=new AEl("action");return aEl.setHtml(action.getName()),aEl.onClicked(action.getHandler()),aEl}}const NOTIFY_MANAGER_KEY="NotifyManager";class NotifyManager{static{__name(this,"NotifyManager")}constructor(){this.notificationLimit=3,this.queue=[],this.slideDuration=500,this.timers=new Map,this.registry=new Map,this.el=new NotificationContainer,Body.get().appendChild(this.el),this.el.getEl().setBottomPx(0)}static get(){let instance=Store.parentInstance().get(NOTIFY_MANAGER_KEY);return instance==null&&(instance=new NotifyManager,Store.parentInstance().set(NOTIFY_MANAGER_KEY,instance)),instance}showFeedback(message,autoHide=!0){let feedback=Message.newInfo(message,autoHide);return this.notify(feedback)}showSuccess(message,autoHide=!0){let feedback=Message.newSuccess(message,autoHide);return this.notify(feedback)}showError(message,autoHide=!0){let error=Message.newError(message,autoHide);return this.notify(error)}showWarning(message,autoHide=!0){let warning=Message.newWarning(message,autoHide);return this.notify(warning)}notify(message){if(this.messageExistsInRegistry(message))return null;const limitReached=this.queue.length>0||this.el.getWrapper().getChildren().length>=this.notificationLimit,notification=this.createNotification(message);return limitReached?this.queue.push(notification):this.renderNotification(notification),notification.getEl().getId()}getNotification(messageId){return messageId&&this.registry.has(messageId)?this.registry.get(messageId).el:null}hide(messageId){messageId&&this.registry.has(messageId)&&this.remove(this.registry.get(messageId).el)}messageExistsInRegistry(message){return this.registry.size===0?!1:Array.from(this.registry.values()).map(entry=>entry.opts).some(registryEntry=>registryEntry.getText()===message.getText()&&registryEntry.getType()===message.getType())}createNotification(message){const notificationEl=new NotificationMessage(message);return this.registry.set(notificationEl.getEl().getId(),{opts:message,el:notificationEl}),this.setListeners(notificationEl),this.setActions(notificationEl,message.getActions()),notificationEl}renderNotification(notification){return this.el.getWrapper().appendChild(notification),notification.hide(),$(notification.getHTMLElement()).animate({height:"toggle"},this.slideDuration,()=>{notification.isAutoHide()&&(this.timers.set(notification.getEl().getId(),{remainingTime:notification.getMessage().getLifeTime()}),this.startTimer(notification))}),notification}setListeners(notificationMessage){notificationMessage.getRemoveEl().onClicked(()=>this.remove(notificationMessage)),notificationMessage.onMouseEnter(()=>this.stopTimer(notificationMessage)),notificationMessage.onMouseLeave(()=>this.startTimer(notificationMessage)),notificationMessage.onRemoved(()=>this.handleNotificationRemoved())}setActions(notificationEl,actions){actions.forEach(action=>notificationEl.addAction(action))}handleNotificationRemoved(){if(this.queue.length>0){const notification=this.queue.shift();this.renderNotification(notification)}}remove(el){el&&($(el.getHTMLElement()).animate({height:"hide"},this.slideDuration,"linear",()=>{this.el.getWrapper().hasChild(el)?this.el.getWrapper().removeChild(el):this.queue=this.queue.filter(q2=>q2!==el)}),this.registry.delete(el.getEl().getId()),this.timers.delete(el.getEl().getId()))}startTimer(el){const timer=this.timers.get(el.getEl().getId());timer&&(timer.id=setTimeout(()=>this.remove(el),timer.remainingTime),timer.startTime=Date.now())}stopTimer(el){const timer=this.timers.get(el.getEl().getId());!timer||!timer.id||(clearTimeout(timer.id),timer.id=null,timer.remainingTime-=Date.now()-timer.startTime)}}function showFeedback(message,autoHide=!0){return NotifyManager.get().showFeedback(message,autoHide)}__name(showFeedback,"showFeedback");function showError(message,autoHide=!0){return NotifyManager.get().showError(message,autoHide)}__name(showError,"showError");function showWarning(message,autoHide=!0){return NotifyManager.get().showWarning(message,autoHide)}__name(showWarning,"showWarning");class DefaultErrorHandler{static{__name(this,"DefaultErrorHandler")}static handle(error){if(ObjectHelper.iFrameSafeInstanceOf(error,Exception)){const message=error.getMessage();switch(error.getType()){case ExceptionType.ERROR:showError(message);break;case ExceptionType.WARNING:showWarning(message);break;case ExceptionType.INFO:showFeedback(message);break}}else throw showError(error.toString().replace(/^Error: /,"")),error}}class Panel extends DivEl{static{__name(this,"Panel")}constructor(className){super("panel"+(className?" "+className:"")),this.doOffset=!0,this.onAdded(()=>{this.doOffset&&this.calculateOffset()})}setDoOffset(value){this.doOffset=value,value&&this.isRendered()&&this.calculateOffset()}doRender(){return super.doRender().then(rendered=>(this.doOffset&&this.calculateOffset(),rendered))}setOuterHeader(header){this.outerHeader=header}showOuterHeader(){this.outerHeader&&this.outerHeader.show()}hideOuterHeader(){this.outerHeader&&this.outerHeader.hide()}calculateOffset(){let previous=this.getEl().getPrevious(),top=previous?previous.getOffsetTopRelativeToParent()+previous.getHeightWithMargin():0;this.getEl().setTopPx(top)}getActions(){return[]}}class WizardClosedEvent{static{__name(this,"WizardClosedEvent")}constructor(wizard,checkCanClose){this.wizard=wizard,this.checkCanClose=checkCanClose}getWizard(){return this.wizard}isCheckCanClose(){return this.checkCanClose}}var mousetrap={exports:{}},hasRequiredMousetrap;function requireMousetrap(){return hasRequiredMousetrap||(hasRequiredMousetrap=1,(function(module2){(function(window2,document2,undefined$1){if(!window2)return;for(var _MAP={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},_KEYCODE_MAP={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},_SHIFT_MAP={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},_SPECIAL_ALIASES={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},_REVERSE_MAP,i=1;i<20;++i)_MAP[111+i]="f"+i;for(i=0;i<=9;++i)_MAP[i+96]=i.toString();function _addEvent(object,type,callback){if(object.addEventListener){object.addEventListener(type,callback,!1);return}object.attachEvent("on"+type,callback)}__name(_addEvent,"_addEvent");function _characterFromEvent(e){if(e.type=="keypress"){var character=String.fromCharCode(e.which);return e.shiftKey||(character=character.toLowerCase()),character}return _MAP[e.which]?_MAP[e.which]:_KEYCODE_MAP[e.which]?_KEYCODE_MAP[e.which]:String.fromCharCode(e.which).toLowerCase()}__name(_characterFromEvent,"_characterFromEvent");function _modifiersMatch(modifiers1,modifiers2){return modifiers1.sort().join(",")===modifiers2.sort().join(",")}__name(_modifiersMatch,"_modifiersMatch");function _eventModifiers(e){var modifiers=[];return e.shiftKey&&modifiers.push("shift"),e.altKey&&modifiers.push("alt"),e.ctrlKey&&modifiers.push("ctrl"),e.metaKey&&modifiers.push("meta"),modifiers}__name(_eventModifiers,"_eventModifiers");function _preventDefault(e){if(e.preventDefault){e.preventDefault();return}e.returnValue=!1}__name(_preventDefault,"_preventDefault");function _stopPropagation(e){if(e.stopPropagation){e.stopPropagation();return}e.cancelBubble=!0}__name(_stopPropagation,"_stopPropagation");function _isModifier(key){return key=="shift"||key=="ctrl"||key=="alt"||key=="meta"}__name(_isModifier,"_isModifier");function _getReverseMap(){if(!_REVERSE_MAP){_REVERSE_MAP={};for(var key in _MAP)key>95&&key<112||_MAP.hasOwnProperty(key)&&(_REVERSE_MAP[_MAP[key]]=key)}return _REVERSE_MAP}__name(_getReverseMap,"_getReverseMap");function _pickBestAction(key,modifiers,action){return action||(action=_getReverseMap()[key]?"keydown":"keypress"),action=="keypress"&&modifiers.length&&(action="keydown"),action}__name(_pickBestAction,"_pickBestAction");function _keysFromString(combination){return combination==="+"?["+"]:(combination=combination.replace(/\+{2}/g,"+plus"),combination.split("+"))}__name(_keysFromString,"_keysFromString");function _getKeyInfo(combination,action){var keys,key,i2,modifiers=[];for(keys=_keysFromString(combination),i2=0;i2<keys.length;++i2)key=keys[i2],_SPECIAL_ALIASES[key]&&(key=_SPECIAL_ALIASES[key]),action&&action!="keypress"&&_SHIFT_MAP[key]&&(key=_SHIFT_MAP[key],modifiers.push("shift")),_isModifier(key)&&modifiers.push(key);return action=_pickBestAction(key,modifiers,action),{key,modifiers,action}}__name(_getKeyInfo,"_getKeyInfo");function _belongsTo(element,ancestor){return element===null||element===document2?!1:element===ancestor?!0:_belongsTo(element.parentNode,ancestor)}__name(_belongsTo,"_belongsTo");function Mousetrap2(targetElement){var self=this;if(targetElement=targetElement||document2,!(self instanceof Mousetrap2))return new Mousetrap2(targetElement);self.target=targetElement,self._callbacks={},self._directMap={};var _sequenceLevels={},_resetTimer,_ignoreNextKeyup=!1,_ignoreNextKeypress=!1,_nextExpectedAction=!1;function _resetSequences(doNotReset){doNotReset=doNotReset||{};var activeSequences=!1,key;for(key in _sequenceLevels){if(doNotReset[key]){activeSequences=!0;continue}_sequenceLevels[key]=0}activeSequences||(_nextExpectedAction=!1)}__name(_resetSequences,"_resetSequences");function _getMatches(character,modifiers,e,sequenceName,combination,level){var i2,callback,matches=[],action=e.type;if(!self._callbacks[character])return[];for(action=="keyup"&&_isModifier(character)&&(modifiers=[character]),i2=0;i2<self._callbacks[character].length;++i2)if(callback=self._callbacks[character][i2],!(!sequenceName&&callback.seq&&_sequenceLevels[callback.seq]!=callback.level)&&action==callback.action&&(action=="keypress"&&!e.metaKey&&!e.ctrlKey||_modifiersMatch(modifiers,callback.modifiers))){var deleteCombo=!sequenceName&&callback.combo==combination,deleteSequence=sequenceName&&callback.seq==sequenceName&&callback.level==level;(deleteCombo||deleteSequence)&&self._callbacks[character].splice(i2,1),matches.push(callback)}return matches}__name(_getMatches,"_getMatches");function _fireCallback(callback,e,combo,sequence){self.stopCallback(e,e.target||e.srcElement,combo,sequence)||callback(e,combo)===!1&&(_preventDefault(e),_stopPropagation(e))}__name(_fireCallback,"_fireCallback"),self._handleKey=function(character,modifiers,e){var callbacks=_getMatches(character,modifiers,e),i2,doNotReset={},maxLevel=0,processedSequenceCallback=!1;for(i2=0;i2<callbacks.length;++i2)callbacks[i2].seq&&(maxLevel=Math.max(maxLevel,callbacks[i2].level));for(i2=0;i2<callbacks.length;++i2){if(callbacks[i2].seq){if(callbacks[i2].level!=maxLevel)continue;processedSequenceCallback=!0,doNotReset[callbacks[i2].seq]=1,_fireCallback(callbacks[i2].callback,e,callbacks[i2].combo,callbacks[i2].seq);continue}processedSequenceCallback||_fireCallback(callbacks[i2].callback,e,callbacks[i2].combo)}var ignoreThisKeypress=e.type=="keypress"&&_ignoreNextKeypress;e.type==_nextExpectedAction&&!_isModifier(character)&&!ignoreThisKeypress&&_resetSequences(doNotReset),_ignoreNextKeypress=processedSequenceCallback&&e.type=="keydown"};function _handleKeyEvent(e){typeof e.which!="number"&&(e.which=e.keyCode);var character=_characterFromEvent(e);if(character){if(e.type=="keyup"&&_ignoreNextKeyup===character){_ignoreNextKeyup=!1;return}self.handleKey(character,_eventModifiers(e),e)}}__name(_handleKeyEvent,"_handleKeyEvent");function _resetSequenceTimer(){clearTimeout(_resetTimer),_resetTimer=setTimeout(_resetSequences,1e3)}__name(_resetSequenceTimer,"_resetSequenceTimer");function _bindSequence(combo,keys,callback,action){_sequenceLevels[combo]=0;function _increaseSequence(nextAction){return function(){_nextExpectedAction=nextAction,++_sequenceLevels[combo],_resetSequenceTimer()}}__name(_increaseSequence,"_increaseSequence");function _callbackAndReset(e){_fireCallback(callback,e,combo),action!=="keyup"&&(_ignoreNextKeyup=_characterFromEvent(e)),setTimeout(_resetSequences,10)}__name(_callbackAndReset,"_callbackAndReset");for(var i2=0;i2<keys.length;++i2){var isFinal=i2+1===keys.length,wrappedCallback=isFinal?_callbackAndReset:_increaseSequence(action||_getKeyInfo(keys[i2+1]).action);_bindSingle(keys[i2],wrappedCallback,action,combo,i2)}}__name(_bindSequence,"_bindSequence");function _bindSingle(combination,callback,action,sequenceName,level){self._directMap[combination+":"+action]=callback,combination=combination.replace(/\s+/g," ");var sequence=combination.split(" "),info;if(sequence.length>1){_bindSequence(combination,sequence,callback,action);return}info=_getKeyInfo(combination,action),self._callbacks[info.key]=self._callbacks[info.key]||[],_getMatches(info.key,info.modifiers,{type:info.action},sequenceName,combination,level),self._callbacks[info.key][sequenceName?"unshift":"push"]({callback,modifiers:info.modifiers,action:info.action,seq:sequenceName,level,combo:combination})}__name(_bindSingle,"_bindSingle"),self._bindMultiple=function(combinations,callback,action){for(var i2=0;i2<combinations.length;++i2)_bindSingle(combinations[i2],callback,action)},_addEvent(targetElement,"keypress",_handleKeyEvent),_addEvent(targetElement,"keydown",_handleKeyEvent),_addEvent(targetElement,"keyup",_handleKeyEvent)}__name(Mousetrap2,"Mousetrap"),Mousetrap2.prototype.bind=function(keys,callback,action){var self=this;return keys=keys instanceof Array?keys:[keys],self._bindMultiple.call(self,keys,callback,action),self},Mousetrap2.prototype.unbind=function(keys,action){var self=this;return self.bind.call(self,keys,function(){},action)},Mousetrap2.prototype.trigger=function(keys,action){var self=this;return self._directMap[keys+":"+action]&&self._directMap[keys+":"+action]({},keys),self},Mousetrap2.prototype.reset=function(){var self=this;return self._callbacks={},self._directMap={},self},Mousetrap2.prototype.stopCallback=function(e,element){var self=this;if((" "+element.className+" ").indexOf(" mousetrap ")>-1||_belongsTo(element,self.target))return!1;if("composedPath"in e&&typeof e.composedPath=="function"){var initialEventTarget=e.composedPath()[0];initialEventTarget!==e.target&&(element=initialEventTarget)}return element.tagName=="INPUT"||element.tagName=="SELECT"||element.tagName=="TEXTAREA"||element.isContentEditable},Mousetrap2.prototype.handleKey=function(){var self=this;return self._handleKey.apply(self,arguments)},Mousetrap2.addKeycodes=function(object){for(var key in object)object.hasOwnProperty(key)&&(_MAP[key]=object[key]);_REVERSE_MAP=null},Mousetrap2.init=function(){var documentMousetrap=Mousetrap2(document2);for(var method in documentMousetrap)method.charAt(0)!=="_"&&(Mousetrap2[method]=(function(method2){return function(){return documentMousetrap[method2].apply(documentMousetrap,arguments)}})(method))},Mousetrap2.init(),window2.Mousetrap=Mousetrap2,module2.exports&&(module2.exports=Mousetrap2)})(typeof window<"u"?window:null,typeof window<"u"?document:null)})(mousetrap)),mousetrap.exports}__name(requireMousetrap,"requireMousetrap");var mousetrapExports=requireMousetrap(),mousetrapGlobalBind={},hasRequiredMousetrapGlobalBind;function requireMousetrapGlobalBind(){return hasRequiredMousetrapGlobalBind||(hasRequiredMousetrapGlobalBind=1,(function(Mousetrap2){if(Mousetrap2){var _globalCallbacks={},_originalStopCallback=Mousetrap2.prototype.stopCallback;Mousetrap2.prototype.stopCallback=function(e,element,combo,sequence){var self=this;return self.paused?!0:_globalCallbacks[combo]||_globalCallbacks[sequence]?!1:_originalStopCallback.call(self,e,element,combo)},Mousetrap2.prototype.bindGlobal=function(keys,callback,action){var self=this;if(self.bind(keys,callback,action),keys instanceof Array){for(var i=0;i<keys.length;i++)_globalCallbacks[keys[i]]=!0;return}_globalCallbacks[keys]=!0},Mousetrap2.init()}})(typeof Mousetrap<"u"?Mousetrap:void 0)),mousetrapGlobalBind}__name(requireMousetrapGlobalBind,"requireMousetrapGlobalBind");requireMousetrapGlobalBind();const KEY_BINDINGS_KEY="keyBindings";class KeyBindings{static{__name(this,"KeyBindings")}constructor(){this.debug=!1,this.debug,this.activeBindings=new Map,this.shelves=[],this.helpKeyPressedListeners=[],this.initializeHelpKey()}static get(){let instance=Store.instance().get(KEY_BINDINGS_KEY);return instance==null&&(instance=new KeyBindings,Store.instance().set(KEY_BINDINGS_KEY,instance)),instance}bindKeys(bindings){let logMessage="Binded keys: [";bindings.forEach(binding=>{this.bindKey(binding),logMessage+=`'${binding.getCombination()}' ,`}),logMessage+="]",this.debug}bindKey(binding){binding.isGlobal()?mousetrapExports.bindGlobal(binding.getCombination(),binding.getCallback(),binding.getAction()?KeyBindingAction[binding.getAction()].toLowerCase():""):mousetrapExports.bind(binding.getCombination(),binding.getCallback(),binding.getAction()?KeyBindingAction[binding.getAction()].toLowerCase():"");let bindingKey=this.getBindingKey(binding);this.activeBindings.set(bindingKey,binding)}unbindKeys(bindings){let logMessage="Binded keys: [";bindings.forEach(binding=>{this.unbindKey(binding),logMessage+=`'${binding.getCombination()}' ,`}),this.debug}unbindKey(binding){mousetrapExports.unbind(binding.getCombination()),this.activeBindings.delete(this.getBindingKey(binding))}trigger(combination,action){mousetrapExports.trigger(combination,action)}reset(){this.debug,mousetrapExports.reset(),this.activeBindings.clear(),this.shelves=[]}getActiveBindings(){return this.toArray(this.activeBindings)}shelveBindings(keyBindings=[]){if(this.debug,keyBindings.length===0)mousetrapExports.reset(),this.shelves.push(this.activeBindings),this.activeBindings=new Map;else{let curBindings=new Map;keyBindings.forEach(binding=>{this.activeBindings.get(this.getBindingKey(binding))&&curBindings.set(this.getBindingKey(binding),this.activeBindings.get(this.getBindingKey(binding)))}),curBindings.size>0&&(this.unbindKeys(this.toArray(curBindings)),this.shelves.push(curBindings))}}unshelveBindings(keyBindings=[]){if(this.shelves.length===0){this.debug;return}const previousMousetraps=this.shelves[this.shelves.length-1];if(this.debug,keyBindings.length===0)this.activeBindings.clear(),mousetrapExports.reset(),this.toArray(previousMousetraps).forEach(previousBinding=>{this.bindKey(previousBinding)}),this.shelves.pop();else{const keys=keyBindings.map(binding=>this.getBindingKey(binding)),previousKeys=[];previousMousetraps.forEach((_value,key)=>{previousKeys.push(key)}),previousKeys.forEach(previousKey=>{keys.indexOf(previousKey)>=0&&(this.bindKey(previousMousetraps.get(previousKey)),previousMousetraps.delete(previousKey))}),previousMousetraps.size===0&&this.shelves.pop()}}isActive(keyBinding){return this.toArray(this.activeBindings).some(curBinding=>curBinding===keyBinding)}onHelpKeyPressed(listener){this.helpKeyPressedListeners.push(listener)}unHelpKeyPressed(listener){this.helpKeyPressedListeners=this.helpKeyPressedListeners.filter(currentListener=>listener!==currentListener)}getBindingKey(binding){return binding.getAction()?binding.getCombination()+"-"+binding.getAction():binding.getCombination()}initializeHelpKey(){this.bindKey(new KeyBinding("f2",e=>{this.notifyHelpKeyPressed(e)}).setGlobal(!0).setAction(KeyBindingAction.KEYDOWN)),this.bindKey(new KeyBinding("f2",e=>{this.notifyHelpKeyPressed(e)}).setGlobal(!0).setAction(KeyBindingAction.KEYUP))}notifyHelpKeyPressed(e){this.helpKeyPressedListeners.forEach(listener=>{listener.call(this,e)})}toArray(bindings){const result=[];return bindings.forEach(value=>{result.push(value)}),result}}class UlEl extends Element{static{__name(this,"UlEl")}constructor(className){super(new NewElementBuilder().setTagName("ul").setClassName(className))}}class NavigatorEvent{static{__name(this,"NavigatorEvent")}constructor(tab){this.tab=tab}getItem(){return this.tab}}class ActivatedEvent{static{__name(this,"ActivatedEvent")}constructor(index){this.index=index}getIndex(){return this.index}}class TabBar extends UlEl{static{__name(this,"TabBar")}constructor(classes){super("tab-bar"+(classes?" "+classes:"")),this.scrollEnabled=!0,this.tabs=[],this.selectedIndex=-1,this.navigationItemAddedListeners=[],this.navigationItemRemovedListeners=[],this.navigationItemSelectedListeners=[],this.navigationItemActivatedListeners=[]}setScrollEnabled(enabled){this.scrollEnabled=enabled}insertNavigationItem(tab,index,silent){this.tabs.splice(index,0,tab),tab.setIndex(index),this.tabs.slice(index+1).forEach(slicedTab=>{slicedTab.setIndex(slicedTab.getIndex()+1)}),this.insertChild(tab,index),tab.onSelected(event=>{this.selectNavigationItem(event.getTab().getIndex())}),silent||this.notifyTabAddedListeners(tab)}addNavigationItem(tab,silent){this.insertNavigationItem(tab,this.tabs.length,silent)}removeNavigationItem(tab){let tabIndex=tab.getIndex();this.tabs.splice(tabIndex,1);for(let i=tabIndex;i<this.tabs.length;i++)this.tabs[i].setIndex(i);this.isEmpty()?this.selectedIndex=-1:this.getSize()-1<this.selectedIndex?this.selectedIndex=this.getSize()-1:tabIndex<this.selectedIndex&&this.selectedIndex--,tab.remove(),this.notifyTabRemovedListeners(tabIndex)}selectNavigationItem(index,silent,forced){if(index<0||index>=this.getSize()||(this.notifyTabActivatedListeners(index),!forced&&this.selectedIndex===index))return;this.deselectNavigationItem(),this.selectedIndex=index;let selectedTab=this.getSelectedNavigationItem();selectedTab.setActive(!0),!silent&&this.scrollEnabled&&this.notifyTabSelectedListeners(selectedTab)}deselectNavigationItem(){this.selectedIndex!==-1&&this.getSelectedNavigationItem()&&this.getSelectedNavigationItem().setActive(!1),this.selectedIndex=-1}getNavigationItem(index){return this.tabs[index]}getSelectedNavigationItem(){return this.tabs[this.selectedIndex]}getSelectedIndex(){return this.selectedIndex}getSize(){return this.tabs.length}isEmpty(){return this.tabs.length===0}getNavigationItems(){return this.tabs}onNavigationItemAdded(listener){this.navigationItemAddedListeners.push(listener)}onNavigationItemRemoved(listener){this.navigationItemRemovedListeners.push(listener)}onNavigationItemSelected(listener){this.navigationItemSelectedListeners.push(listener)}onNavigationItemDeselected(_listener){}onNavigationItemActivated(listener){this.navigationItemActivatedListeners.push(listener)}unNavigationItemAdded(listener){this.navigationItemAddedListeners=this.navigationItemAddedListeners.filter(currentListener=>listener!==currentListener)}unNavigationItemRemoved(listener){this.navigationItemRemovedListeners=this.navigationItemRemovedListeners.filter(currentListener=>listener!==currentListener)}unNavigationItemSelected(listener){this.navigationItemSelectedListeners=this.navigationItemSelectedListeners.filter(currentListener=>listener!==currentListener)}unNavigationItemDeselected(_listener){}unNavigationItemActivated(listener){this.navigationItemActivatedListeners=this.navigationItemActivatedListeners.filter(currentListener=>listener!==currentListener)}notifyTabAddedListeners(tab){this.navigationItemAddedListeners.forEach(listener=>{listener.call(this,new NavigatorEvent(tab))})}notifyTabRemovedListeners(index){this.navigationItemRemovedListeners.forEach(listener=>{listener.call(this,index)})}notifyTabSelectedListeners(tab){this.navigationItemSelectedListeners.forEach(listener=>{listener.call(this,new NavigatorEvent(tab))})}notifyTabActivatedListeners(index){this.navigationItemActivatedListeners.forEach(listener=>{listener.call(this,new ActivatedEvent(index))})}}class WizardStepNavigator extends TabBar{static{__name(this,"WizardStepNavigator")}constructor(){super("wizard-step-navigator")}insertNavigationItem(tab,index,silent){super.insertNavigationItem(tab,index,silent),this.addKeyNavigation(tab)}addNavigationItem(step){super.addNavigationItem(step),this.getSize()===1&&step.addClass("first")}nextStep(){let nextIndex=Math.min(this.getSelectedIndex()+1,this.getSize()-1);this.selectNavigationItem(nextIndex)}previousStep(){let previousIndex=Math.max(this.getSelectedIndex()-1,0);this.selectNavigationItem(previousIndex)}hasNext(){return this.getSelectedIndex()<this.getSize()-1}hasPrevious(){return this.getSelectedIndex()>0}addKeyNavigation(tab){const combination="alt+"+this.getSize(),keyBinding=new KeyBinding(combination,()=>{const tabIndexToShow=tab.getHTMLElement().style.display!=="none"?tab.getIndex():tab.getIndex()+1;this.selectNavigationItem(tabIndexToShow)});KeyBindings.get().bindKey(keyBinding)}}var _a$1;class FoldButton extends DivEl{static{__name(this,"FoldButton")}static{_a$1=WCAG}static{this.expandedCls="expanded"}constructor(caption=i18n("action.actions"),hostElement){super(),this[_a$1]=!0,this.ariaLabel=i18n("wcag.toolbar.foldButton"),this.role=AriaRole.BUTTON,this.tabbable=!0,this.widthCache=[],this.addClass("fold-button"),this.dropdown=new DivEl("dropdown",StyleHelper$1.COMMON_PREFIX),this.appendChild(this.dropdown),this.span=new SpanEl("fold-label"),this.span.setHtml(caption),this.appendChild(this.span),hostElement&&(this.hostElement=hostElement),this.initListeners()}initListeners(){(this.hostElement||this).onClicked(this.toggleMenu.bind(this)),this.dropdown.onClicked(this.onMenuClicked.bind(this)),this.onApplyKeyPressed(this.toggleMenu.bind(this)),this.onEscPressed(this.collapse.bind(this))}collapse(){this.removeClass(FoldButton.expandedCls),this.hostElement&&this.hostElement.removeClass(FoldButton.expandedCls)}push(element,width){this.dropdown.prependChild(element),this.widthCache.unshift(width)}pop(){let top=this.dropdown.getFirstChild();return this.dropdown.removeChild(top),this.widthCache.shift(),top}setLabel(label){this.span.setHtml(label)}getDropdown(){return this.dropdown}getNextButtonWidth(){return this.widthCache[0]}getButtonsCount(){return this.dropdown.getChildren().length}isEmpty(){return this.dropdown.getChildren().length===0}toggle(){this.toggleClass(FoldButton.expandedCls),this.hostElement&&this.hostElement.toggleClass(FoldButton.expandedCls)}toggleMenu(event){if(this.toggle(),this.hasClass(FoldButton.expandedCls)){const onBodyClicked=__name(ev=>{ev.target!==(this.hostElement||this).getHTMLElement()&&(this.collapse(),Body.get().unClicked(onBodyClicked))},"onBodyClicked");Body.get().onClicked(onBodyClicked)}event?.stopPropagation()}onMenuClicked(event){this.collapse(),event.stopPropagation()}}class WizardStepNavigatorAndToolbar extends DivEl{static{__name(this,"WizardStepNavigatorAndToolbar")}static{this.maxFittingWidth=675}static{this.FOLDED="folded"}constructor(stepNavigator,stepToolbar){super("wizard-step-navigator-and-toolbar"),this.stepNavigator=stepNavigator,this.stepToolbar=stepToolbar,this.foldButton=new FoldButton,this.initListeners()}renumerateSteps(){this.isFolded()&&this.addNumbersToStepLabels()}doRender(){return super.doRender().then(rendered=>(this.stepToolbar&&this.appendChild(this.stepToolbar),this.appendChild(this.foldButton),this.appendChild(this.stepNavigator),this.checkAndMinimize(),rendered))}setupHelpTextToggleButton(){return this.helpTextToggleButton=new DivEl("help-text-button"),this.appendChild(this.helpTextToggleButton).addClass("has-help-text-button"),this.checkAndMinimize(),this.helpTextToggleButton}checkAndMinimize(){if(!this.isRendered())return;const isMinimized=this.isFolded();this.isStepNavigatorFit()===isMinimized&&(isMinimized?this.maximize():this.minimize())}changeOrientation(horizontal){horizontal&&this.isFolded()?this.fold():this.unfold(),this.checkAndMinimize()}initListeners(){this.foldButton.getDropdown().onClicked(()=>{this.addClass("no-dropdown-hover"),window.setTimeout(this.removeClass.bind(this,"no-dropdown-hover"))}),this.stepNavigator.onNavigationItemActivated(event=>{const tabBarItem=this.stepNavigator.getNavigationItem(event.getIndex());tabBarItem&&this.foldButton.setLabel(tabBarItem.getFullLabel())}),this.stepNavigator.onNavigationItemRemoved(()=>this.renumerateSteps()),this.stepNavigator.onNavigationItemAdded(()=>this.renumerateSteps())}calculateStepsWidth(){const steps=this.stepNavigator.getChildren().filter(step=>step.isVisible()),stepMargin=__name(step=>step.getEl().getWidthWithMargin(),"stepMargin");return steps.reduce((totalStepWidth,step)=>totalStepWidth+stepMargin(step),0)}isVisibleStepNavigatorFit(){const width=this.stepNavigator.getEl().getWidthWithoutPadding(),stepsWidth=this.calculateStepsWidth();return Math.ceil(width)-Math.ceil(stepsWidth)>=-1}isStepNavigatorFit(){if(!this.stepNavigator.getChildren())return!0;if(this.foldButton.isRendered()){if(this.stepNavigator.isVisible())return this.isVisibleStepNavigatorFit();this.maximize();const value=this.isVisibleStepNavigatorFit();return this.minimize(),value}const help=this.helpTextToggleButton,width=help&&help.isVisible()?this.getEl().getWidthWithoutPadding()-help.getEl().getWidthWithMargin():this.getEl().getWidthWithoutPadding(),calculated=this.calculateStepsWidth(),fittingWidth=Math.min(calculated,WizardStepNavigatorAndToolbar.maxFittingWidth)+2;return Math.ceil(width)>=Math.ceil(fittingWidth)}isFolded(){return this.hasClass(WizardStepNavigatorAndToolbar.FOLDED)}isMinimized(){return!!this.foldButton&&this.foldButton.getDropdown().hasChild(this.stepNavigator)}minimize(){this.addClass(WizardStepNavigatorAndToolbar.FOLDED),this.fold(),this.addNumbersToStepLabels(),this.stepNavigator.getSelectedNavigationItem()&&this.foldButton.setLabel(this.stepNavigator.getSelectedNavigationItem().getFullLabel())}maximize(){this.removeClass(WizardStepNavigatorAndToolbar.FOLDED),this.unfold(),this.removeNumbersFromStepLabels()}fold(){this.isMinimized()||(this.removeChild(this.stepNavigator),this.foldButton.push(this.stepNavigator,300))}unfold(){this.isMinimized()&&(this.foldButton.pop(),this.stepNavigator.insertAfterEl(this.foldButton))}addNumbersToStepLabels(){this.stepNavigator.getNavigationItems().filter(tab=>this.isTabVisible(tab)).forEach((tab,index)=>tab.numerate(index+1))}isTabVisible(tab){return tab.getHTMLElement().style.display!=="none"}removeNumbersFromStepLabels(){this.stepNavigator.getNavigationItems().forEach(tab=>tab.unnumerate())}}class PanelShownEvent{static{__name(this,"PanelShownEvent")}constructor(panel,index,previousPanel){this.panel=panel,this.index=index,this.previousPanel=previousPanel}getPanel(){return this.panel}getIndex(){return this.index}getPreviousPanel(){return this.previousPanel}}class PanelStripHeader extends DivEl{static{__name(this,"PanelStripHeader")}constructor(config){super(),this.config=config,this.initElements(),this.initListeners()}initElements(){this.textEl=new SpanEl().setHtml(this.config.text)}initListeners(){}doRender(){return this.addClass("panel-strip-panel-header"),this.appendChild(this.textEl),Q(!0)}}class PanelStrip extends Panel{static{__name(this,"PanelStrip")}constructor(scrollable,className){super("panel-strip"+(className?" "+className:"")),this.panels=[],this.headers=[],this.offset=0,this.panelShown=null,this.panelShownListeners=[],scrollable?(this.scrollable=scrollable,this.scrollable.addClass("panel-strip-scrollable")):this.scrollable=this,this.onShown(()=>{this.updateLastPanelHeight()})}insertPanel(panel,index,header){panel.setDoOffset(!1);const previousChildrenIndex=this.countExistingChildren(index);let headerEl;return header&&(headerEl=this.createHeader(header,panel),panel.setOuterHeader(headerEl),this.insertChild(headerEl,previousChildrenIndex)),this.panels.splice(index,0,panel),this.headers.splice(index,0,headerEl),header?this.insertChild(panel,previousChildrenIndex+1):this.insertChild(panel,previousChildrenIndex),this.isVisible()&&this.updateLastPanelHeight(),index}getPanels(){return this.panels}getScrollable(){return this.scrollable}setScrollOffset(offset){return this.offset=offset,this}getScrollOffset(){return this.offset}removePanel(panelToRemove,checkCanRemovePanel=!0){let index=this.getPanelIndex(panelToRemove);return index<0||checkCanRemovePanel&&!this.canRemovePanel(panelToRemove)?-1:(this.removeChild(panelToRemove),this.removeChild(this.getHeader(index)),this.panels.splice(index,1),this.headers.splice(index,1),this.isEmpty()?this.panelShown=null:panelToRemove===this.getPanelShown()&&this.showPanelByIndex(Math.min(index,this.getSize()-1)),this.isVisible()&&index===this.getSize()&&!this.isEmpty()&&this.updateLastPanelHeight(),index)}canRemovePanel(_panel){return!0}isEmpty(){return this.panels.length===0}getSize(){return this.panels.length}getPanel(index){return this.panels[index]}getHeader(index){return this.headers[index]}getPanelShown(){return this.panelShown}getPanelShownIndex(){return this.getPanelIndex(this.panelShown)}getPanelIndex(panel){let size=this.getSize();for(let i=0;i<size;i++)if(this.panels[i]===panel)return i;return-1}showPanel(panel){let index=this.getPanelIndex(panel);index>-1&&this.showPanelByIndex(index)}showPanelByIndex(index){const deferred=Q.defer();if(!this.getHeader(index)&&index>0)return deferred.resolve(null),deferred.promise;const onScrolled=__name(()=>{const panelToShow=this.getPanel(index);this.notifyPanelShown(panelToShow,index,this.getPanelShown()),this.panelShown=panelToShow,deferred.resolve(null)},"onScrolled");if(!this.panels.slice(0,index).some(panel=>panel.containsLazyRenderers()))return this.scrollToPanel(index,onScrolled),deferred.promise;const formMask=new LoadMask(this.getScrollable());formMask.show(),deferred.promise.then(()=>formMask.hide()),this.getPanel(index).onLazyRendered(()=>setTimeout(()=>this.scrollToPanel(index,onScrolled),500));for(let i=0;i<=index;i++)this.getPanel(i).forceRender();return deferred.promise}getScroll(){return this.scrollable.getHTMLElement().scrollTop}setScroll(scrollTop){this.scrollable.getHTMLElement().scrollTop=scrollTop}onPanelShown(listener){this.panelShownListeners.push(listener)}unPanelShown(listener){this.panelShownListeners=this.panelShownListeners.filter(currentListener=>listener!==currentListener)}countExistingChildren(index){let count=Math.min(this.panels.length,index);for(let i=0;i<Math.min(this.headers.length,index);i++)this.headers[i]&&count++;return count}updateLastPanelHeight(){if(this.getSize()===0)return;if(this.getSize()>1){let beforeLastEl=this.getPanel(this.getSize()-2).getEl(),originalHeight=beforeLastEl.getData("originalHeight");originalHeight&&beforeLastEl.setHeight(originalHeight)}let lastEl=this.getPanel(this.getSize()-1).getEl();lastEl.getData("originalHeight")||lastEl.setData("originalHeight",lastEl.getHTMLElement().style.height||"auto")}scrollToPanel(index,callback){const headerToShow=this.getHeader(index),scrollTop=index===0?0:this.getScroll()-this.offset+headerToShow.getEl().getPaddingTop()/2+headerToShow.getEl().getOffsetToParent().top;$(this.getScrollable().getHTMLElement()).animate({scrollTop},{duration:500,complete:callback})}notifyPanelShown(panel,panelIndex,previousPanel){this.panelShownListeners.forEach(listener=>{listener.call(this,new PanelShownEvent(panel,panelIndex,previousPanel))})}createHeader(header,panel){return new PanelStripHeader({text:header})}}class NavigatedPanelStrip extends PanelStrip{static{__name(this,"NavigatedPanelStrip")}constructor(navigator2,scrollable,className){super(scrollable,className),this.scrollIndex=-1,this.focusIndex=-1,this.focusVisible=!1,this.listenToScroll=!0,this.navigator=navigator2,navigator2.onNavigationItemSelected(event=>{this.listenToScroll=!1,this.showPanelByIndex(event.getItem().getIndex())}),this.onPanelShown(()=>this.listenToScroll=!0),this.getScrollable().onScroll(()=>{!this.listenToScroll||navigator2.getSize()<2||this.updateScrolledNavigationItem()})}setListenToScroll(listen=!0){this.listenToScroll=listen}getSelectedNavigationItem(){return this.navigator.getSelectedNavigationItem()}insertNavigablePanel(item,panel,header,index,select){let panelHeader=select?null:header;return super.insertPanel(panel,index,panelHeader),this.navigator.insertNavigationItem(item,index),panel.onFocus(()=>{this.navigator.selectNavigationItem(item.getIndex(),!0),this.focusIndex=item.getIndex()}),panel.onBlur(()=>{this.focusIndex=-1,this.updateScrolledNavigationItem()}),select&&this.selectPanel(item),index}addNavigablePanel(item,panel,header,select){return this.insertNavigablePanel(item,panel,header,this.getPanels().length,select)}selectPanel(item){this.selectPanelByIndex(item.getIndex())}selectPanelByIndex(index){this.navigator.selectNavigationItem(index)}removeNavigablePanel(panel,checkCanRemovePanel=!0){let removedPanelIndex=super.removePanel(panel,checkCanRemovePanel);if(removedPanelIndex>-1){let navigationItem=this.navigator.getNavigationItem(removedPanelIndex);this.navigator.removeNavigationItem(navigationItem)}return removedPanelIndex}updateScrolledNavigationItem(){let scrollTop=this.getScrollable().getHTMLElement().scrollTop,focusVisible=this.isFocusedPanelVisible(),scrollIndex=this.getScrolledPanelIndex(scrollTop);(this.scrollIndex!==scrollIndex||this.focusVisible!==focusVisible)&&(focusVisible?this.navigator.selectNavigationItem(this.focusIndex,!0):this.navigator.selectNavigationItem(scrollIndex,!0),this.focusVisible=focusVisible,this.scrollIndex=scrollIndex)}isFocusedPanelVisible(){if(this.focusIndex<0)return!1;let totalHeight=this.getScrollable().getEl().getHeight(),headerHeight=this.getFocusedHeaderHeight(this.focusIndex),panelEl=this.getPanel(this.focusIndex).getEl(),panelTop=panelEl.getOffsetToParent().top-this.getScrollOffset()-headerHeight,panelBottom=panelTop+panelEl.getHeight()-headerHeight;return panelEl.isVisible()&&(panelTop<=0&&panelBottom>0||panelTop<=totalHeight&&panelBottom>totalHeight)}getScrolledPanelIndex(scrollTop){let panelEl,panelTop,panelBottom;if(scrollTop===0)return 0;for(let i=0;i<this.getSize();i++){panelEl=this.getPanel(i).getEl();let headerHeight=this.getFocusedHeaderHeight(i);if(panelEl.isVisible()&&(panelTop=scrollTop+panelEl.getOffsetToParent().top-this.getScrollOffset()-headerHeight,panelBottom=panelTop+panelEl.getHeight(),scrollTop>=panelTop&&scrollTop<panelBottom))return i}return-1}getFocusedHeaderHeight(curStrip){return curStrip===0?0:this.getHeader(curStrip+1)?this.getHeader(curStrip+1).getEl().getHeightWithBorder():this.getHeader(curStrip).getEl().getHeightWithBorder()}}class WizardStepsPanel extends NavigatedPanelStrip{static{__name(this,"WizardStepsPanel")}constructor(navigator2,scrollable){super(navigator2,scrollable,"wizard-steps-panel")}}class ValidityChangedEvent{static{__name(this,"ValidityChangedEvent")}constructor(valid){this.valid=valid}isValid(){return this.valid}}class WizardValidityManager{static{__name(this,"WizardValidityManager")}constructor(){this.validityChangedListeners=[],this.steps=[],this.validityChangedListeners=[]}clearItems(){this.steps=[]}getSteps(){return this.steps}addItem(step){this.steps.push(step),step.getStepForm().onValidityChanged(event=>{this.notifyValidityChanged(event.isValid())})}removeItem(step){let index=this.steps.indexOf(step);index>=0&&(this.steps.splice(index,1),this.prevValue||this.isAllValid()&&this.notifyValidityChanged(!0))}setHeader(header){this.header=header,this.header.onPropertyChanged(()=>{this.header.isRendered()&&this.notifyValidityChanged(this.header.isValid())})}isAllValid(){if(this.header&&!this.header.isValid())return!1;for(const step of this.steps)if(!step.getStepForm().isValid())return!1;return!0}onValidityChanged(listener){this.validityChangedListeners.push(listener)}unValidityChanged(listener){this.validityChangedListeners=this.validityChangedListeners.filter(curr=>curr!==listener)}notifyValidityChanged(valid){this.prevValue=valid,this.validityChangedListeners.forEach(listener=>{listener.call(this,new ValidityChangedEvent(valid))})}}class WizardPanel extends Panel{static{__name(this,"WizardPanel")}static{this.debug=!1}constructor(params){super("wizard-panel"),this.formState=new FormState(!0),this.canModify=!1,this.steps=[],this.dataLoaded=!1,this.closedListeners=[],this.dataLoadedListeners=[],this.helpTextShown=!1,this.wizardHeaderCreatedListeners=[],this.setParams(params),params.persistedItem&&(this.setPersistedItem(params.persistedItem),this.formState.setIsNew(!1)),this.initElements(),this.initEventsListeners(),this.mainToolbar=this.createMainToolbar()}initElements(){this.wizardActions=this.createWizardActions(),this.validityManager=new WizardValidityManager,this.formPanel=new Panel("form-panel rendering"),this.formIcon=this.createFormIcon().addClassEx("form-icon",StyleHelper$1.COMMON_PREFIX),this.wizardHeader=this.createWizardHeader(),this.stepNavigator=new WizardStepNavigator,this.stepNavigatorAndToolbarContainer=new WizardStepNavigatorAndToolbar(this.stepNavigator),this.stepsPanel=this.createWizardStepsPanel(),this.leftPanelAndToolbar=new Panel}initEventsListeners(){this.onRendered(event=>{WizardPanel.debug,ResponsiveManager.onAvailableSizeChanged(this.stepNavigatorAndToolbarContainer,item=>{this.isVisible()&&(this.updateStickyToolbar(),this.stepsPanel.setScrollOffset(item.getElement().getEl().getHeight()),this.stepNavigatorAndToolbarContainer.checkAndMinimize())})}),this.onShown(event=>{WizardPanel.debug,this.formPanel&&!this.formPanel.isRendered()&&this.formMask?.show()}),this.onHidden(event=>{WizardPanel.debug,this.formMask?.isVisible()&&this.formMask.hide(),this.liveMask?.isVisible()&&this.liveMask.hide()}),this.formPanel.onScroll(()=>this.updateStickyToolbar()),this.formPanel.onAdded(()=>this.onFormPanelAdded());let firstShow;this.formPanel.onRendered(()=>{WizardPanel.debug,firstShow=!0,this.formMask?.hide(),this.formPanel.removeClass("rendering"),this.mainToolbar&&this.mainToolbar.removeClass("rendering"),firstShow&&(firstShow=!1,this.checkIfEditIsAllowed().then(editIsAllowed=>editIsAllowed&&this.giveInitialFocus())),this.lastFocusedElement&&this.lastFocusedElement.focus(),this.notifyValidityChanged(this.isValid())}),ResponsiveManager.onAvailableSizeChanged(this.formPanel),this.stepNavigatorAndToolbarContainer.onShown(event=>{this.stepsPanel.setScrollOffset(event.getElement().getEl().getHeight())})}doRender(){return WizardPanel.debug,super.doRender().then(rendered=>{let doRenderOnDataLoadedAndShown=__name(()=>{let deferred=Q.defer(),doRenderOnShown=__name(()=>{this.doRenderOnDataLoaded(rendered).then(nextRendered=>{this.doLayout(this.getPersistedItem()).then(()=>{this.checkIfEditIsAllowed().then(canModify=>{this.handleCanModify(canModify)}).catch(DefaultErrorHandler.handle).finally(()=>{deferred.resolve(nextRendered)}),this.hasHelpText()&&this.setupHelpTextToggleButton()}).catch(reason=>{deferred.reject(reason),DefaultErrorHandler.handle(reason)}).done()})},"doRenderOnShown");if(this.isVisible())doRenderOnShown();else{WizardPanel.debug;let shownHandler=__name(()=>{WizardPanel.debug,this.unShown(shownHandler),doRenderOnShown()},"shownHandler");this.onShown(shownHandler)}return deferred.promise},"doRenderOnDataLoadedAndShown");if(this.isDataLoaded())return doRenderOnDataLoadedAndShown();{WizardPanel.debug;let deferred=Q.defer();return this.onDataLoaded(()=>{WizardPanel.debug,doRenderOnDataLoadedAndShown().then(nextRendered=>deferred.resolve(nextRendered)).catch(reason=>deferred.reject(reason))}),deferred.promise}})}getMainToolbar(){return this.mainToolbar}getWizardHeader(){return this.wizardHeader}getFormIcon(){return this.formIcon}onDataLoaded(listener){this.dataLoadedListeners.push(listener)}unDataLoaded(listener){this.dataLoadedListeners=this.dataLoadedListeners.filter(current=>listener!==current)}updateStickyToolbar(){const scrollTop=this.formPanel.getHTMLElement().scrollTop,wizardNavigatorHeight=this.stepNavigatorAndToolbarContainer.getEl().getHeightWithBorder(),stickyHeight=this.getWizardHeader().getEl().getHeightWithMargin(),preStickyHeight=stickyHeight-wizardNavigatorHeight,mainToolbar=this.getMainToolbar();if(scrollTop>stickyHeight){if(mainToolbar.removeClass("scroll-shadow"),this.stepNavigatorAndToolbarContainer.addClass("scroll-stick"),!this.stepNavigatorPlaceholder){const stepNavigatorEl=this.stepNavigatorAndToolbarContainer.getEl();this.stepNavigatorPlaceholder=new DivEl("toolbar-placeholder"),this.stepNavigatorPlaceholder.insertAfterEl(this.stepNavigatorAndToolbarContainer),this.stepNavigatorPlaceholder.getEl().setWidthPx(stepNavigatorEl.getWidth()).setHeightPx(stepNavigatorEl.getHeight())}}else scrollTop<stickyHeight&&(mainToolbar.addClass("scroll-shadow"),this.stepNavigatorAndToolbarContainer.removeClass("scroll-stick"),this.stepNavigatorPlaceholder&&(this.stepNavigatorPlaceholder.remove(),this.stepNavigatorPlaceholder=null));scrollTop>preStickyHeight?this.stepNavigatorAndToolbarContainer.addClass("pre-scroll-stick"):scrollTop<preStickyHeight&&this.stepNavigatorAndToolbarContainer.removeClass("pre-scroll-stick"),scrollTop===0&&mainToolbar.removeClass("scroll-shadow"),this.stepNavigatorAndToolbarContainer.getEl().setWidthPx(this.calcNavigationWidth())}calcNavigationWidth(){return this.stepsPanel.getEl().getWidth()-this.stepNavigatorAndToolbarContainer.getEl().getPaddingLeft()}updateToolbarActions(){WizardPanel.debug,this.formState.isNew()?this.wizardActions.enableActionsForNew():this.wizardActions.enableActionsForExisting(this.getPersistedItem())}hasHelpText(){return this.steps.some(step=>step.hasHelpText())}giveInitialFocus(){this.whenRendered(()=>{this.getWizardHeader().giveFocus(),this.startRememberFocus()})}startRememberFocus(){this.steps.forEach(step=>{step.getStepForm().onFocus(el=>{this.lastFocusedElement=el.target})})}resetLastFocusedElement(){this.lastFocusedElement=null}getTabId(){return this.params.tabId}setTabId(tabId){this.params.tabId=tabId}getIconUrl(){return null}getActions(){return this.wizardActions.getActions()}getWizardActions(){return this.wizardActions}getSteps(){return this.steps}getStepNavigator(){return this.stepNavigator}getStepNavigatorContainer(){return this.stepNavigatorAndToolbarContainer}setSteps(steps){steps.forEach((step,index)=>{this.addStep(step,index===0)}),this.steps=steps}addStep(step,select){this.steps.push(step),this.stepsPanel.addNavigablePanel(step.getTabBarItem(),step.getStepForm(),step.getTabBarItem().getLabel(),select),this.validityManager.addItem(step)}insertStepBefore(stepToInsert,beforeStep,select){let indexOfBeforeStep=this.steps.indexOf(beforeStep);this.steps.splice(indexOfBeforeStep,0,stepToInsert),this.stepsPanel.insertNavigablePanel(stepToInsert.getTabBarItem(),stepToInsert.getStepForm(),stepToInsert.getTabBarItem().getLabel(),indexOfBeforeStep,select),this.validityManager.addItem(stepToInsert)}removeStepWithForm(form){return this.steps=this.steps.filter(step=>{let remove=step.getStepForm()===form;return remove&&this.validityManager.removeItem(step),!remove}),this.stepsPanel.removeNavigablePanel(form)}doLayout(persistedItem){return WizardPanel.debug,Q(null)}getPersistedItem(){return this.persistedItem}isItemPersisted(){return this.persistedItem!=null}getCurrentItem(){return this.currentItem}convertToCurrentItem(persistedItem){return Object.create(persistedItem)}hasUnsavedChanges(){return!1}isSaving(){return this.saving}saveChanges(){return this.saving=!0,this.isItemPersisted()?this.updatePersistedItem().then(persistedItem=>(this.setPersistedItem(persistedItem),this.formState.setIsNew(!1),this.updateToolbarActions(),this.postUpdatePersistedItem(persistedItem))).finally(()=>{this.saving=!1}):this.persistNewItem().then(persistedItem=>(this.setPersistedItem(persistedItem),this.isRendered()&&(this.formState.setIsNew(!1),this.updateToolbarActions()),this.postPersistNewItem(persistedItem))).finally(()=>{this.saving=!1})}persistNewItem(){throw new Error("Must be overriden by inheritor")}postPersistNewItem(persistedItem){return Q(persistedItem)}updatePersistedItem(){throw new Error("Must be overriden by inheritor")}postUpdatePersistedItem(persistedItem){return Q(persistedItem)}close(checkCanClose=!1){this.notifyClosed(checkCanClose)}canClose(){return!this.hasUnsavedChanges()}onClosed(listener){this.closedListeners.push(listener)}unClosed(listener){this.closedListeners=this.closedListeners.filter(currentListener=>currentListener!==listener)}showMinimizeEditButton(){this.addClass("wizard-panel--live")}hideMinimizeEditButton(){this.removeClass("wizard-panel--live")}onValidityChanged(listener){this.validityManager.onValidityChanged(listener)}unValidityChanged(listener){this.validityManager.unValidityChanged(listener)}notifyValidityChanged(valid){this.validityManager.notifyValidityChanged(valid)}onWizardHeaderCreated(listener){this.wizardHeaderCreatedListeners.push(listener)}unWizardHeaderCreated(listener){this.wizardHeaderCreatedListeners=this.wizardHeaderCreatedListeners.filter(curr=>curr!==listener)}notifyWizardHeaderCreated(){this.wizardHeaderCreatedListeners.forEach(listener=>{listener.call(this)})}isValid(){return this.validityManager.isAllValid()}setParams(params){this.params=params}getParams(){return this.params}createWizardActions(){throw Error("Override me")}loadData(){WizardPanel.debug,this.dataLoaded=!1,this.doLoadData().done(item=>{this.dataLoaded=!0,WizardPanel.debug,this.notifyDataLoaded(item)},reason=>{DefaultErrorHandler.handle(reason)})}doLoadData(){WizardPanel.debug;let deferred=Q.defer();if(!this.getPersistedItem())WizardPanel.debug,this.saveChanges().then(equitable=>{WizardPanel.debug,deferred.resolve(equitable)}).catch(reason=>{deferred.reject(reason)}).done();else{let equitable=this.getPersistedItem();WizardPanel.debug,deferred.resolve(equitable)}return deferred.promise}isDataLoaded(){return this.dataLoaded}createMainToolbar(){return null}createWizardHeader(){return null}createWizardStepsPanel(){return new WizardStepsPanel(this.stepNavigator,this.formPanel)}createFormIcon(){return null}onFormPanelAdded(skipMask=!1){WizardPanel.debug,this.formMask=new LoadMask(this.formPanel),skipMask||this.formMask.show()}doRenderOnDataLoaded(rendered){WizardPanel.debug,this.updateToolbarActions(),this.mainToolbar&&this.mainToolbar.addClass("rendering");const headerAndNavigatorContainer=new DivEl("header-and-navigator-container"),headerContainer=new DivEl("header-container");return this.formIcon&&headerContainer.appendChild(this.formIcon),this.wizardHeader&&(headerContainer.appendChild(this.wizardHeader),this.notifyWizardHeaderCreated(),this.validityManager.setHeader(this.wizardHeader)),headerAndNavigatorContainer.appendChild(headerContainer),headerAndNavigatorContainer.appendChild(this.stepNavigatorAndToolbarContainer),this.formPanel.appendChildren(headerAndNavigatorContainer,this.stepsPanel),this.mainToolbar&&this.leftPanelAndToolbar.prependChild(this.mainToolbar),this.leftPanelAndToolbar.appendChild(this.prepareMainPanel()),this.appendChild(this.leftPanelAndToolbar),Q(rendered)}prepareMainPanel(){return this.formPanel}checkIfEditIsAllowed(){return Q.resolve(!0)}getWizardStepsPanel(){return this.stepsPanel}getHeader(index){return this.stepsPanel.getHeader(index)}setPersistedItem(newPersistedItem){WizardPanel.debug,this.persistedItem=newPersistedItem,this.currentItem=this.convertToCurrentItem(newPersistedItem)}notifyDataLoaded(item){this.dataLoadedListeners.forEach(listener=>{listener(item)})}toggleHelpTextShown(){this.helpTextShown=!this.helpTextShown,this.helpTextToggleButton.toggleClass("on",this.helpTextShown),this.helpTextToggleButton.setTitle(this.helpTextShown?i18n("tooltip.helptexts.hide"):i18n("tooltip.helptexts.show")),this.steps.forEach(step=>{step.toggleHelpText(this.helpTextShown)})}setupHelpTextToggleButton(){this.helpTextToggleButton=this.stepNavigatorAndToolbarContainer.setupHelpTextToggleButton(),this.helpTextToggleButton.setTitle(i18n("tooltip.helptexts.show")),this.helpTextToggleButton.onClicked(()=>{this.toggleHelpTextShown()})}notifyClosed(checkCanClose){this.closedListeners.forEach(listener=>{listener(new WizardClosedEvent(this,checkCanClose))})}handleCanModify(canModify){this.canModify=canModify,this.setEnabled(canModify)}setEnabled(enable){this.toggleClass("no-modify-permissions",!enable),this.formIcon&&this.formIcon.getEl().setDisabled(!enable),this.wizardHeader&&this.wizardHeader.toggleEnabled(enable),this.steps.forEach(step=>{step.getStepForm().setEnabled(enable)})}}class FormState{static{__name(this,"FormState")}constructor(isNew){this.formIsNew=isNew}setIsNew(value){this.formIsNew=value}isNew(){return this.formIsNew}}class FormContext{static{__name(this,"FormContext")}constructor(builder){this.name=builder.name,this.showEmptyFormItemSetOccurrences=builder.showEmptyFormItemSetOccurrences,this.formState=builder.formState,this.language=builder.language,this.validationErrors=builder.validationErrors||[],this.aiTools=builder.aiTools}static create(){return new FormContextBuilder}getShowEmptyFormItemSetOccurrences(){return this.showEmptyFormItemSetOccurrences}setShowEmptyFormItemSetOccurrences(value){this.showEmptyFormItemSetOccurrences=value}createInputTypeViewContext(inputTypeConfig,parentPropertyPath,input){return{formContext:this,input,inputConfig:inputTypeConfig,parentDataPath:parentPropertyPath}}getFormState(){return this.formState}setFormState(formState){this.formState=formState}getLanguage(){return this.language}hasValidationErrors(){return this.validationErrors?.length>0}setValidationErrors(validationErrors){this.validationErrors=validationErrors}getValidationErrors(){return this.validationErrors.slice(0)}setLanguage(lang){this.language=lang}getName(){return this.name}getAiTools(){return this.aiTools}}class FormContextBuilder{static{__name(this,"FormContextBuilder")}constructor(){this.aiTools=new Set}setShowEmptyFormItemSetOccurrences(value){return this.showEmptyFormItemSetOccurrences=value,this}setName(value){return this.name=value,this}setFormState(value){return this.formState=value,this}setLanguage(lang){return this.language=lang,this}setValidationErrors(value){return this.validationErrors=value,this}addAiTools(value){return(Array.isArray(value)?value:[value]).forEach(v=>this.aiTools.add(v)),this}build(){return new FormContext(this)}}class FocusSwitchEvent extends Event$1{static{__name(this,"FocusSwitchEvent")}constructor(inputTypeView){super(),this.inputTypeView=inputTypeView}static on(handler,contextWindow=window){Event$1.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){Event$1.unbind(ClassHelper.getFullName(this),handler,contextWindow)}getInputTypeView(){return this.inputTypeView}}class InputTypeName{static{__name(this,"InputTypeName")}static{this.CUSTOM_PREFIX="custom:"}constructor(name,custom){this.name=name,this.custom=custom,this.custom?this.refString=InputTypeName.CUSTOM_PREFIX+name:this.refString=name}static parseInputTypeName(str){return str.substr(0,InputTypeName.CUSTOM_PREFIX.length)===InputTypeName.CUSTOM_PREFIX?new InputTypeName(str.substr(InputTypeName.CUSTOM_PREFIX.length,str.length),!0):new InputTypeName(str,!1)}getName(){return this.name}isBuiltIn(){return!this.custom}toString(){return this.refString}toJson(){return this.toString()}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,InputTypeName))return!1;let other=o;return!(!ObjectHelper.booleanEquals(this.custom,other.custom)||!ObjectHelper.stringEquals(this.name,other.name))}}class OccurrencesBuilder{static{__name(this,"OccurrencesBuilder")}setMinimum(value){return this.minimum=value,this}setMaximum(value){return this.maximum=value,this}fromJson(json){return this.minimum=json.minimum,this.maximum=json.maximum,this}build(){return new Occurrences(this)}}class Occurrences{static{__name(this,"Occurrences")}constructor(builder){this.minimum=builder.minimum,this.maximum=builder.maximum}static fromJson(json){return new OccurrencesBuilder().fromJson(json).build()}static min(min){return Occurrences.minmax(min,0)}static max(max){return Occurrences.minmax(0,max)}static minmax(min,max){const builder=new OccurrencesBuilder;return builder.setMinimum(min),builder.setMaximum(max),builder.build()}getMaximum(){return this.maximum}getMinimum(){return this.minimum}required(){return this.minimum>0}multiple(){return this.maximum>1||this.maximum===0}minimumReached(occurrenceCount){return occurrenceCount>=this.minimum}minimumBreached(occurrenceCount){return this.minimum===0?!1:occurrenceCount<this.minimum}maximumReached(occurrenceCount){return this.maximum===0?!1:occurrenceCount>=this.maximum}maximumBreached(occurrenceCount){return this.maximum===0?!1:occurrenceCount>this.maximum}toJson(){return{maximum:this.getMaximum(),minimum:this.getMinimum()}}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,Occurrences))return!1;let other=o;return!(!ObjectHelper.numberEquals(this.minimum,other.minimum)||!ObjectHelper.numberEquals(this.maximum,other.maximum))}}class FormItemPath{static{__name(this,"FormItemPath")}static{this.DEFAULT_ELEMENT_DIVIDER="."}static{this.ROOT=new FormItemPath([],FormItemPath.DEFAULT_ELEMENT_DIVIDER,!0)}constructor(elements,elementDivider,absolute){this.elementDivider=elementDivider??FormItemPath.DEFAULT_ELEMENT_DIVIDER,this.absolute=absolute??!0,elements.forEach((element,index)=>{if(element==null)throw new Error("Path element was null at index: "+index);if(element.getName().length===0)throw new Error("Path element was empty string at index: "+index)}),this.elements=elements,this.refString=(this.absolute?this.elementDivider:"")+this.elements.join(this.elementDivider)}static fromString(s,elementDivider){elementDivider==null&&(elementDivider=FormItemPath.DEFAULT_ELEMENT_DIVIDER);let absolute=s.charAt(0)===elementDivider,elements=s.split(elementDivider);elements=FormItemPath.removeEmptyElements(elements);let pathElements=[];return elements.forEach(str=>{pathElements.push(FormItemPathElement.fromString(str))}),new FormItemPath(pathElements,elementDivider,absolute)}static fromParent(parent2,...childElements){let elements=parent2.elements.slice(0);return childElements.forEach(element=>{elements.push(element)}),new FormItemPath(elements,parent2.elementDivider,parent2.isAbsolute())}static removeEmptyElements(elements){let filteredElements=[];return elements.forEach(element=>{element.length>0&&filteredElements.push(element)}),filteredElements}newWithoutFirstElement(){let arr=this.elements;return arr.shift(),new FormItemPath(arr)}elementCount(){return this.getElements().length}getElements(){return this.elements}getElement(index){return this.elements[index]}getFirstElement(){return this.elements[0]}getLastElement(){return this.elements[this.elements.length-1]}hasParent(){return this.elements.length>0}getParentPath(){if(this.elements.length<1)return null;let parentElemements=[];return this.elements.forEach((element,index)=>{index<this.elements.length-1&&parentElemements.push(element)}),new FormItemPath(parentElemements)}toString(){return this.refString}isAbsolute(){return this.absolute}}class FormItemPathElement{static{__name(this,"FormItemPathElement")}constructor(name){this.name=name}static fromString(str){return new FormItemPathElement(str)}getName(){return this.name}toString(){return this.name}}class FormItem{static{__name(this,"FormItem")}constructor(name){this.formItems=[],this.name=name}getFormItems(){return this.formItems}setApplicationKey(value){return this.applicationKey=value,this}getApplicationKey(){return this.applicationKey}setParent(parent2){this.parent=parent2}getName(){return this.name}getPath(){return this.resolvePath()}getParent(){return this.parent}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,FormItem))return!1;let other=o;return!!ObjectHelper.stringEquals(this.name,other.name)}resolvePath(){return FormItemPath.fromParent(this.resolveParentPath(),FormItemPathElement.fromString(this.name))}resolveParentPath(){return this.parent==null?FormItemPath.ROOT:this.parent.getPath()}}class InputBuilder{static{__name(this,"InputBuilder")}constructor(){this.immutable=!1,this.indexed=!0}setName(value){return this.name=value,this}setInputType(value){return this.inputType=value,this}setLabel(value){return this.label=value,this}setImmutable(value){return this.immutable=value,this}setOccurrences(value){return this.occurrences=value,this}setIndexed(value){return this.indexed=value,this}setValidationRegex(value){return this.validationRegex=value,this}setHelpText(value){return this.helpText=value,this}setInputTypeConfig(value){return this.inputTypeConfig=value,this}setMaximizeUIInputWidth(value){return this.maximizeUIInputWidth=value,this}fromJson(json){if(this.name=json.name,this.inputType=InputTypeName.parseInputTypeName(json.inputType),this.label=json.label,this.immutable=json.immutable,this.occurrences=Occurrences.fromJson(json.occurrences),this.indexed=json.indexed,this.validationRegex=json.validationRegexp,this.helpText=json.helpText,this.inputTypeConfig=json.config,this.maximizeUIInputWidth=json.maximizeUIInputWidth,json.defaultValue){let type=ValueTypes.fromName(json.defaultValue.type);this.defaultValue=type.fromJsonValue(json.defaultValue.value)}return this}build(){return new Input(this)}}class Input extends FormItem{static{__name(this,"Input")}constructor(builder){super(builder.name),this.inputType=builder.inputType,this.inputTypeConfig=builder.inputTypeConfig,this.label=builder.label,this.immutable=builder.immutable,this.occurrences=builder.occurrences,this.indexed=builder.indexed,this.validationRegex=builder.validationRegex,this.helpText=builder.helpText,this.maximizeUIInputWidth=builder.maximizeUIInputWidth,this.defaultValue=builder.defaultValue}static fromJson(json){let builder=new InputBuilder;return builder.fromJson(json),builder.build()}getInputType(){return this.inputType}getLabel(){return this.label}isImmutable(){return this.immutable}getOccurrences(){return this.occurrences}isIndexed(){return this.indexed}isMaximizeUIInputWidth(){return this.maximizeUIInputWidth}getValidationRegex(){return this.validationRegex}getHelpText(){return this.helpText}getInputTypeConfig(){return this.inputTypeConfig}getDefaultValue(){return this.defaultValue}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,Input)||!super.equals(o))return!1;let other=o;return!ObjectHelper.equals(this.inputType,other.inputType)||!ObjectHelper.stringEquals(this.label,other.label)||!ObjectHelper.booleanEquals(this.immutable,other.immutable)||!ObjectHelper.equals(this.occurrences,other.occurrences)||!ObjectHelper.booleanEquals(this.indexed,other.indexed)||!ObjectHelper.stringEquals(this.validationRegex,other.validationRegex)||!ObjectHelper.stringEquals(this.helpText,other.helpText)?!1:ObjectHelper.objectEquals(this.inputTypeConfig,other.inputTypeConfig)}toJson(){return{Input:{name:this.getName(),helpText:this.getHelpText(),immutable:this.isImmutable(),indexed:this.isIndexed(),label:this.getLabel(),occurrences:this.getOccurrences().toJson(),validationRegexp:this.getValidationRegex(),inputType:this.getInputType().toJson(),config:this.getInputTypeConfig(),maximizeUIInputWidth:this.isMaximizeUIInputWidth()}}}}var AiToolType;(function(AiToolType2){AiToolType2.DIALOG="aiOpenDialog",AiToolType2.STATE="aiState",AiToolType2.ANIMATE="aiAnimate"})(AiToolType||(AiToolType={}));class FormItemEl extends Element{static{__name(this,"FormItemEl")}constructor(tagName,className,prefix){super(new NewElementBuilder().setTagName(tagName).setClassName(className,prefix)),this.enabled=!0,this.validityChangedListeners=[]}getName(){return this.getEl().getAttribute("name")}setName(name){return this.getEl().setAttribute("name",name),this}onValidityChanged(listener){this.validityChangedListeners.push(listener)}unValidityChanged(listener){this.validityChangedListeners=this.validityChangedListeners.filter(curr=>curr!==listener)}notifyValidityChanged(valid){this.validityChangedListeners.forEach(listener=>{listener.call(this,new ValidityChangedEvent(valid))})}setEnabled(enable){this.enabled=enable,this.toggleClass("disabled",!enable)}isEnabled(){return this.enabled}}class ButtonEl extends FormItemEl{static{__name(this,"ButtonEl")}constructor(className,stylePrefix=StyleHelper$1.COMMON_PREFIX){super("button",className,stylePrefix),this.getEl().setAttribute("type","button");const triggerAction=__name(()=>{Body.get().setFocusedElement(this),$(this.getHTMLElement()).simulate("click")},"triggerAction");this.onApplyKeyPressed(triggerAction)}setEnabled(value){return super.setEnabled(value),this.getEl().setDisabled(!value),this.setAriaDisabled(!value),this}}class Button extends ButtonEl{static{__name(this,"Button")}constructor(label){super("button"),this.setLabel(label)}createLabelEl(){this.labelEl=new SpanEl,this.prependChild(this.labelEl)}setLabel(label,escapeHtml=!0){return!this.labelEl&&label&&this.createLabelEl(),this.labelEl?.setHtml(label,escapeHtml),this}getLabel(){return this.labelEl?.getEl().getInnerHtml()||""}setTitle(title,forceAction=!0){return BrowserHelper.isIOS()||(title?(this.getEl().setAttribute("title",title),forceAction&&$(this.getEl().getHTMLElement()).trigger("mouseenter")):(forceAction&&$(this.getEl().getHTMLElement()).trigger("mouseleave"),this.getEl().removeAttribute("title"))),this}}class TogglerButton extends Button{static{__name(this,"TogglerButton")}constructor(className,title){super(),this.activeListeners=[],this.addClass("toggle-button icon-medium"),className&&this.addClass(className),this.setActive(!1),this.setEnabled(!1),title&&this.setTitle(title),this.onClicked(event=>{this.isEnabled()&&this.setActive(!this.isActive())})}setActive(value,silent=!1){this.toggleClass("active",value),silent||this.notifyActiveChanged(value)}setVisible(value){return value||this.setActive(value),super.setVisible(value)}isActive(){return this.hasClass("active")}onActiveChanged(listener){this.activeListeners.push(listener)}unActiveChanged(listener){this.activeListeners=this.activeListeners.filter(curr=>curr!==listener)}notifyActiveChanged(isActive){this.activeListeners.forEach(listener=>{listener(isActive)})}}class ValidationRecording{static{__name(this,"ValidationRecording")}constructor(){this.breaksMinimumOccurrencesArray=[],this.breaksMaximumOccurrencesArray=[],this.validationErrors=new Map,this.hideValidationErrors=!1}setHideValidationErrors(value){return this.hideValidationErrors=value,this}breaksMinimumOccurrences(path){this.exists(path,this.breaksMinimumOccurrencesArray)||this.breaksMinimumOccurrencesArray.push(path)}breaksMaximumOccurrences(path){this.exists(path,this.breaksMaximumOccurrencesArray)||this.breaksMaximumOccurrencesArray.push(path)}addValidationError(id,errorMessage){this.validationErrors.set(id,errorMessage)}isValid(){return!this.hasError()&&this.breaksMinimumOccurrencesArray.length===0&&this.breaksMaximumOccurrencesArray.length===0}isInvalid(){return!this.isValid()}hasError(){return this.validationErrors.size>0}isMinimumOccurrencesValid(){return this.breaksMinimumOccurrencesArray.length===0}isMaximumOccurrencesValid(){return this.breaksMaximumOccurrencesArray.length===0}isValidationErrorsHidden(){return this.hideValidationErrors}getBreakMinimumOccurrences(){return this.breaksMinimumOccurrencesArray}getBreakMaximumOccurrences(){return this.breaksMaximumOccurrencesArray}flatten(recording){recording.breaksMinimumOccurrencesArray.forEach(path=>{this.breaksMinimumOccurrences(path)}),recording.breaksMaximumOccurrencesArray.forEach(path=>{this.breaksMaximumOccurrences(path)}),recording.validationErrors.forEach((value,key)=>{this.addValidationError(key,value)})}removeByPath(path,strict,includeChildren){this.removeUnreachedMinimumOccurrencesByPath(path,strict,includeChildren),this.removeBreachedMaximumOccurrencesByPath(path,strict,includeChildren),this.validationErrors.delete(path.toString())}removeUnreachedMinimumOccurrencesByPath(path,strict,includeChildren){for(let i=this.breaksMinimumOccurrencesArray.length-1;i>=0;i--){let currentPath=this.breaksMinimumOccurrencesArray[i];if((currentPath.equals(path)||includeChildren&&(strict&&currentPath.contains(path)||!strict&&currentPath.toString().indexOf(path.toString())===0))&&(this.breaksMinimumOccurrencesArray.splice(i,1),!includeChildren))break}}removeBreachedMaximumOccurrencesByPath(path,strict,includeChildren){for(let i=this.breaksMaximumOccurrencesArray.length-1;i>=0;i--){let currentPath=this.breaksMaximumOccurrencesArray[0];if((currentPath.equals(path)||includeChildren&&(strict&&currentPath.contains(path)||!strict&&currentPath.toString().indexOf(path.toString())===0))&&(this.breaksMaximumOccurrencesArray.splice(i,1),!includeChildren))break}}equals(other){if(this.breaksMinimumOccurrencesArray.length!==other.breaksMinimumOccurrencesArray.length)return!1;if(this.breaksMaximumOccurrencesArray.length!==other.breaksMaximumOccurrencesArray.length)return!1;for(let i=0;i<this.breaksMinimumOccurrencesArray.length;i++)if(this.breaksMinimumOccurrencesArray[i].toString()!==other.breaksMinimumOccurrencesArray[i].toString())return!1;for(let i=0;i<this.breaksMaximumOccurrencesArray.length;i++)if(this.breaksMaximumOccurrencesArray[i].toString()!==other.breaksMaximumOccurrencesArray[i].toString())return!1;return this.validationErrors.size===other.validationErrors.size}validityChanged(previous){return!!previous&&!previous.equals(this)}containsPathInBreaksMin(path){return this.exists(path,this.breaksMinimumOccurrencesArray)}containsPathInBreaksMax(path){return this.exists(path,this.breaksMaximumOccurrencesArray)}exists(targetPath,paths){for(const path of paths)if(targetPath.toString()===path.toString())return!0;return!1}}class FormItemView extends DivEl{static{__name(this,"FormItemView")}constructor(config){super(config.className),assertNotNull(config.context,"context cannot be null"),assertNotNull(config.formItem,"formItem cannot be null"),this.context=config.context,this.formItem=config.formItem,this.parent=config.parent,this.highlightOnValidityChanged=!1}setHighlightOnValidityChange(highlight){this.highlightOnValidityChanged=highlight}broadcastFormSizeChanged(){throw new Error("Must be implemented by inheritors")}layout(validate=!0){throw new Error("Must be implemented by inheritors")}update(_propertyArray,_unchangedOnly){throw new Error("Must be implemented by inheritors")}reset(){throw new Error("Must be implemented by inheritors")}clean(){}clear(){}refresh(){}isExpandable(){return!1}hasNonDefaultValues(){return!1}hasNonDefaultNumberOfOccurrences(){return!1}isEmpty(){throw new Error("Must be implemented by inheritor")}getContext(){return this.context}getFormItem(){return this.formItem}getParent(){return this.parent}displayValidationErrors(_value){throw new Error("Must be implemented by inheritor")}hasValidUserInput(){throw new Error("Must be implemented by inheritor")}validate(_silent=!0){return new ValidationRecording}giveFocus(){return!1}highlightOnValidityChange(){return this.highlightOnValidityChanged}onValidityChanged(_listener){}unValidityChanged(_listener){}toggleHelpText(_show){}hasHelpText(){return!1}setEnabled(enable){}doRender(){return super.doRender().then(rendered=>(this.addClass("form-item-view"),rendered))}}class HelpTextContainer{static{__name(this,"HelpTextContainer")}constructor(value){this.toggleListeners=[],this.initHelpTextToggler(),this.initHelpTextDiv(value)}initHelpTextToggler(){this.helpTextToggler=new DivEl("help-text-toggler"),this.helpTextToggler.setHtml("?").setTitle(i18n("tooltip.helptext.show")),this.helpTextToggler.onClicked(event=>{const isOn=this.helpTextToggler.hasClass("on");this.toggleHelpText(!isOn),this.notifyHelpTextToggled(!isOn),event.stopPropagation()})}initHelpTextDiv(value){if(!StringHelper.isBlank(value)){this.helpTextDiv=new DivEl("help-text");const pEl=new PEl;pEl.getEl().setText(value),this.helpTextDiv.appendChild(pEl)}}toggleHelpText(show){this.helpTextDiv?.toggleClass("visible",show),this.helpTextToggler.toggleClass("on",show),this.helpTextToggler.setTitle(i18n(show?"tooltip.helptext.hide":"tooltip.helptext.show"))}getToggler(){return this.helpTextToggler}getHelpText(){return this.helpTextDiv}onHelpTextToggled(listener){this.toggleListeners.push(listener)}unHelpTextToggled(listener){this.toggleListeners=this.toggleListeners.filter(curr=>curr!==listener)}notifyHelpTextToggled(show){this.toggleListeners.forEach(listener=>listener(show))}}class InputLabel extends DivEl{static{__name(this,"InputLabel")}constructor(input){super("input-label");let wrapper=new DivEl("wrapper",StyleHelper$1.COMMON_PREFIX),label=new DivEl("label");label.getEl().setInnerHtml(input.getLabel()),wrapper.getEl().appendChild(label.getHTMLElement()),input.getOccurrences().required()&&wrapper.addClass("required"),this.getEl().appendChild(wrapper.getHTMLElement())}}const INPUT_TYPES_KEY="inputTypes";class InputTypeManager{static{__name(this,"InputTypeManager")}static getInputTypes(){let inputTypes=Store.instance().get(INPUT_TYPES_KEY);return inputTypes==null&&(inputTypes=new Map,Store.instance().set(INPUT_TYPES_KEY,inputTypes)),inputTypes}static isRegistered(inputTypeName){const name=InputTypeManager.normalize(inputTypeName);return InputTypeManager.getInputTypes().has(name)}static register(inputTypeClass,silent){const name=InputTypeManager.normalize(inputTypeClass.getName());if(!InputTypeManager.isRegistered(name))InputTypeManager.getInputTypes().set(name,inputTypeClass);else if(!silent)throw new Error("Input type ["+name+"] is already registered, unregister it first.")}static unregister(inputTypeName){let name=InputTypeManager.normalize(inputTypeName);if(InputTypeManager.isRegistered(name))InputTypeManager.getInputTypes().delete(name);else throw new Error("Input type ["+name+"] is not registered.")}static createView(inputTypeName,context){let name=InputTypeManager.normalize(inputTypeName);if(InputTypeManager.isRegistered(name))return InputTypeManager.getInputTypes().get(name).newInstance(context);throw new Error("Input type ["+name+"] need to be registered first.")}static normalize(inputTypeName){return(inputTypeName||"").toLowerCase()}}class Viewer extends Element{static{__name(this,"Viewer")}constructor(className){super(new NewElementBuilder().setTagName("div").setClassName("viewer "+(className||"")).setGenerateId(!1)),this.editable=!0,this.removeClickedListeners=[],this.className=className}doRender(){return super.doRender().then(rendered=>(this.doLayout(this.getObject()),rendered))}setObject(object){if(this.object=object,this.isRendered())return this.doLayout(object)}getObject(){return this.object}clone(){return new this.constructor(...this.getCloneArgs())}getCloneArgs(){return[this.className]}toString(){return this.isRendered()||this.doLayout(this.getObject()),super.toString()}setReadonly(readonly){this.setEditable(!readonly),this.toggleClass("readonly",readonly)}setEditable(editable){this.editable=editable}isEditable(){return this.editable}appendRemoveButton(){!this.editable||this.removeButton||(this.removeButton=new AEl("remove"),this.removeButton.onClicked(event=>(this.editable&&this.notifyRemoveClicked(event),event.stopPropagation(),event.preventDefault(),!1)),this.appendChild(this.removeButton))}onRemoveClicked(listener){this.removeClickedListeners.push(listener)}unRemoveClicked(listener){this.removeClickedListeners=this.removeClickedListeners.filter(current=>current!==listener)}doLayout(_object){}notifyRemoveClicked(event){this.removeClickedListeners.forEach(listener=>{listener(event)})}}class InputViewValidationViewer extends Viewer{static{__name(this,"InputViewValidationViewer")}constructor(){super("validation-viewer")}doLayout(recording){super.doLayout(recording),recording&&this.setHtml(this.getText())}getText(){const record=this.getObject();if(record.isValid())return"";const max=record.getOccurrences().getMaximum();if(record.isMinimumOccurrencesBreached()){const min=record.getOccurrences().getMinimum();return min>=1&&max!==1?i18n("field.occurrence.breaks.min",min):i18n("field.value.required")}return record.isMaximumOccurrencesBreached()?max>1?i18n("field.occurrence.breaks.max.many",max):i18n("field.occurrence.breaks.max.one"):record.getErrorMessage()}}class RecordingValidityChangedEvent{static{__name(this,"RecordingValidityChangedEvent")}constructor(recording,origin){this.includeChildren=!1,this.recording=recording,this.origin=origin}getOrigin(){return this.origin}isValid(){return this.recording.isValid()}getRecording(){return this.recording}setIncludeChildren(include){return this.includeChildren=include,this}isIncludeChildren(){return this.includeChildren}}class ValidationRecordingPath{static{__name(this,"ValidationRecordingPath")}constructor(parentPropertySet,dataName,min,max){this.parentDataSet=parentPropertySet!=null?parentPropertySet.asRelative():null,this.dataName=dataName,this.refString=this.resolveRefString(),this.min=min,this.max=max}getParentDataSet(){return this.parentDataSet}getDataName(){return this.dataName}getMin(){return this.min}getMax(){return this.max}toString(){return this.refString}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ValidationRecordingPath))return!1;let other=o;return ObjectHelper.stringEquals(this.refString,other.refString)}contains(other){let fullPath=PropertyPath.fromString(this.refString),otherPath=PropertyPath.fromString(other.refString);return fullPath.elementCount()<=otherPath.elementCount()?!1:otherPath.getElements().every((whatEl,whatIdx)=>fullPath.getElement(whatIdx).toString()===whatEl.toString())}resolveRefString(){let s="";return this.parentDataSet&&!this.parentDataSet.isRoot()?(s+=this.parentDataSet.toString(),this.dataName&&(s+="."+this.dataName)):this.dataName&&(s+=this.dataName),s}}class InputView extends FormItemView{static{__name(this,"InputView")}static{this.debug=!1}static{this.ERROR_DETAILS_HIDDEN_CLS="error-details-hidden"}constructor(config){super({className:"input-view",context:config.context,formItem:config.input,parent:config.parent}),this.validityChangedListeners=[],assertNotNull(config.parentDataSet,"parentDataSet not expected to be null"),assertNotNull(config.input,"input not expected to be null"),this.input=config.input,this.parentPropertySet=config.parentDataSet}layout(validate=!0){if(this.input.getInputType().getName().toLowerCase()!=="checkbox")if(this.input.getLabel()){let label=new InputLabel(this.input);this.appendChild(label)}else this.addClass("no-label");this.inputTypeView=this.createInputTypeView();const hasAiIcon=this.inputTypeView.getAiConfig()?.aiTools.has(AiToolType.DIALOG);return this.toggleClass("ai-editable",hasAiIcon),this.input.getHelpText()&&(this.helpText=new HelpTextContainer(this.input.getHelpText()),hasAiIcon||this.appendChild(this.helpText.getToggler())),this.input.isMaximizeUIInputWidth()===!1&&this.addClass("label-inline"),this.propertyArray=this.getPropertyArray(this.parentPropertySet),this.inputTypeView.layout(this.input,this.propertyArray).then(()=>{if(this.appendChild(this.inputTypeView.getElement()),this.helpText&&this.appendChild(this.helpText.getHelpText()),this.inputTypeView.isManagingAdd())this.inputTypeView.onValidityChanged(()=>{this.toggleHasInvalidInputClass(this.inputTypeView)}),this.inputTypeView.onValueChanged(()=>{this.toggleHasInvalidInputClass(this.inputTypeView)});else{const inputTypeViewNotManagingAdd=this.inputTypeView;inputTypeViewNotManagingAdd.onOccurrenceAdded(()=>{this.refreshButtonsState()}),inputTypeViewNotManagingAdd.onOccurrenceRemoved(event=>{this.refreshButtonsState()}),this.addButton=new Button(i18n("action.add")),this.addButton.onClicked(()=>inputTypeViewNotManagingAdd.createAndAddOccurrence()),this.bottomButtonRow=new DivEl("bottom-button-row"),this.appendChild(this.bottomButtonRow),this.bottomButtonRow.appendChild(this.addButton),this.toggleClass("single-occurrence",this.isSingleOccurrence()),inputTypeViewNotManagingAdd.onOccurrenceValueChanged(()=>{this.toggleHasInvalidInputClass(inputTypeViewNotManagingAdd)}),inputTypeViewNotManagingAdd.onValidityChanged(event=>{this.toggleHasInvalidInputClass(inputTypeViewNotManagingAdd)}),this.toggleHasInvalidInputClass(inputTypeViewNotManagingAdd)}this.validationViewer=new InputViewValidationViewer,this.validationDetailsToggler=new TogglerButton("validation-toggler"),this.validationDetailsToggler.setLabel(i18n("field.validation.hideDetails")),this.validationDetailsToggler.setEnabled(!0);const validationBlock=new DivEl("validation-block");return validationBlock.appendChild(this.validationViewer),validationBlock.appendChild(this.validationDetailsToggler),this.appendChild(validationBlock),this.inputTypeView.onValidityChanged(event=>{this.handleInputValidationRecording(event.getRecording(),!1)}),this.validationDetailsToggler.onActiveChanged(isActive=>{this.toggleClass(InputView.ERROR_DETAILS_HIDDEN_CLS,isActive),this.validationDetailsToggler.setLabel(i18n(isActive?"field.validation.showDetails":"field.validation.hideDetails"))}),this.inputTypeView.hideValidationDetailsByDefault()&&!this.isFormStateNew()&&this.input.getOccurrences().getMinimum()>0&&this.input.getOccurrences().getMaximum()>1&&this.validationDetailsToggler.setActive(!0),this.refreshButtonsState(),Q(null)})}isSingleOccurrence(){return this.input.getOccurrences().getMinimum()===1&&this.input.getOccurrences().getMaximum()===1}toggleHasInvalidInputClass(inputTypeView){this.toggleClass("has-invalid-user-input",!inputTypeView.hasValidUserInput())}update(propertySet,unchangedOnly){return InputView.debug,this.parentPropertySet=propertySet,this.propertyArray=this.getPropertyArray(propertySet),this.inputTypeView.update(this.propertyArray,unchangedOnly)}reset(){this.inputTypeView.reset()}clear(){super.clear(),this.previousValidityRecording=null,this.inputTypeView.clear()}refresh(){this.inputTypeView.refresh()}hasNonDefaultValues(){return this.propertyArray.some(property=>!StringHelper.isEmpty(property.getValue().getString())&&!property.getValue().equals(this.input.getDefaultValue()))}hasNonDefaultNumberOfOccurrences(){return this.input.getOccurrences().required()&&this.propertyArray.getSize()!==this.input.getOccurrences().getMinimum()}isEmpty(){return!this.propertyArray.some(property=>!StringHelper.isEmpty(property.getValue().getString()))}setEnabled(enable){this.inputTypeView.setEnabled(enable),this.addButton&&this.addButton.setEnabled(enable)}getInputTypeView(){return this.inputTypeView}broadcastFormSizeChanged(){this.isVisible()&&this.inputTypeView.availableSizeChanged()}displayValidationErrors(value){this.inputTypeView.displayValidationErrors()}hasValidUserInput(){return this.inputTypeView.hasValidUserInput()}validate(silent=!0){return this.inputTypeView.validate(silent),this.handleInputValidationRecording(this.inputTypeView.getInputValidationRecording(),silent)}giveFocus(){return this.inputTypeView.giveFocus()}onValidityChanged(listener){this.validityChangedListeners.push(listener)}unValidityChanged(listener){this.validityChangedListeners.filter(currentListener=>listener===currentListener)}onFocus(listener){this.inputTypeView.onFocus(listener)}unFocus(listener){this.inputTypeView.unFocus(listener)}onBlur(listener){this.inputTypeView.onBlur(listener)}unBlur(listener){this.inputTypeView.unBlur(listener)}toggleHelpText(show){this.helpText?.toggleHelpText(show)}hasHelpText(){return!!this.input.getHelpText()}getPropertyArray(propertySet){let array=propertySet.getPropertyArray(this.input.getName());if(!array){array=PropertyArray.create().setType(this.inputTypeView.getValueType()).setName(this.input.getName()).setParent(this.parentPropertySet).build(),propertySet.addPropertyArray(array);let initialValue=this.input.getDefaultValue();initialValue||(initialValue=this.inputTypeView.newInitialValue()),initialValue&&array.add(initialValue)}return array}createInputTypeView(){let inputType=this.input.getInputType(),inputTypeViewContext=this.getContext().createInputTypeViewContext(this.input.getInputTypeConfig()||{},this.parentPropertySet.getPropertyPath(),this.input);return InputTypeManager.isRegistered(inputType.getName())?InputTypeManager.createView(inputType.getName(),inputTypeViewContext):InputTypeManager.createView("NoInputTypeFound",inputTypeViewContext)}refreshButtonsState(){if(!this.inputTypeView.isManagingAdd()){const isMaxOccurrencesReached=this.inputTypeView.maximumOccurrencesReached();this.bottomButtonRow.toggleClass("visible",!isMaxOccurrencesReached),this.addButton.setVisible(!isMaxOccurrencesReached)}}resolveValidationRecordingPath(){return new ValidationRecordingPath(this.propertyArray.getParentPropertyPath(),this.input.getName(),this.input.getOccurrences().getMinimum(),this.input.getOccurrences().getMaximum())}handleInputValidationRecording(inputRecording,silent=!0){const recording=new ValidationRecording,validationRecordingPath=this.resolveValidationRecordingPath();return inputRecording?.isMinimumOccurrencesBreached()&&recording.breaksMinimumOccurrences(validationRecordingPath),inputRecording?.isMaximumOccurrencesBreached()&&recording.breaksMaximumOccurrences(validationRecordingPath),inputRecording?.hasErrorMessage()&&recording.addValidationError(validationRecordingPath.toString(),inputRecording.getErrorMessage()),recording.validityChanged(this.previousValidityRecording)&&(silent||this.notifyValidityChanged(new RecordingValidityChangedEvent(recording,validationRecordingPath)),this.toggleClass("highlight-validity-change",this.highlightOnValidityChange())),this.previousValidityRecording=recording,inputRecording&&this.inputTypeView.isValidationErrorToBeRendered()&&!this.isFormStateNew()&&this.renderValidationErrors(inputRecording),recording}notifyValidityChanged(event){this.validityChangedListeners.forEach(listener=>{listener(event)})}renderValidationErrors(recording){this.toggleClass("valid",recording.isValid()),this.toggleClass("invalid",!recording.isValid()),this.validationViewer.setObject(recording)}isFormStateNew(){return this.getContext()?.getFormState()?.isNew()}}class FieldSet extends FormItem{static{__name(this,"FieldSet")}constructor(fieldSetJson,factory,applicationKey){super(fieldSetJson.name),this.label=fieldSetJson.label,fieldSetJson.items!=null&&fieldSetJson.items.forEach(formItemJson=>{let formItem=factory.createFormItem(formItemJson,applicationKey);formItem&&this.addFormItem(formItem)})}addFormItem(formItem){this.formItems.push(formItem)}getLabel(){return this.label}toJson(){return{FieldSet:{name:this.getName(),items:this.getFormItems().map(formItem=>formItem.toJson()),label:this.getLabel()}}}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,FieldSet)||!super.equals(o))return!1;let other=o;return!(!ObjectHelper.stringEquals(this.label,other.label)||!ObjectHelper.arrayEquals(this.formItems,other.formItems))}}class FieldSetLabel extends DivEl{static{__name(this,"FieldSetLabel")}constructor(fieldSet){super("field-set-label"),this.fieldSet=fieldSet,this.getEl().setInnerHtml(this.fieldSet.getLabel())}}class FieldSetView extends FormItemView{static{__name(this,"FieldSetView")}constructor(config){super({context:config.context,formItem:config.fieldSet,parent:config.parent,className:"field-set-view"}),this.formItemViews=[],this.formItemLayer=config.layerFactory.createLayer(config),this.fieldSet=config.fieldSet,this.propertySet=config.dataSet}broadcastFormSizeChanged(){this.formItemViews.forEach(formItemView=>{formItemView.broadcastFormSizeChanged()})}layout(){return this.doLayout()}getFormItemViews(){return this.formItemViews}update(propertySet,unchangedOnly){return InputView.debug,this.propertySet=propertySet,this.formItemLayer.update(propertySet,unchangedOnly)}reset(){this.formItemLayer.reset()}clear(){super.clear(),this.formItemViews.forEach(view=>view.clear())}setEnabled(enable){this.formItemLayer.setEnabled(enable)}giveFocus(){let focusGiven=!1;if(this.formItemViews.length>0){for(const formItemView of this.formItemViews)if(formItemView.giveFocus()){focusGiven=!0;break}}return focusGiven}displayValidationErrors(value){this.formItemViews.forEach(view=>{view.displayValidationErrors(value)})}setHighlightOnValidityChange(highlight){this.formItemViews.forEach(view=>{view.setHighlightOnValidityChange(highlight)})}hasValidUserInput(){let result=!0;return this.formItemViews.forEach(formItemView=>{formItemView.hasValidUserInput()||(result=!1)}),result}validate(silent=!0){let recording=new ValidationRecording;return this.formItemViews.forEach(formItemView=>{recording.flatten(formItemView.validate(silent))}),recording}isEmpty(){return this.formItemViews.every(formItemView=>formItemView.isEmpty())}toggleHelpText(show){this.formItemLayer.toggleHelpText(show)}hasHelpText(){return this.formItemViews.some(formItemView=>formItemView.hasHelpText())}onValidityChanged(listener){this.formItemViews.forEach(formItemView=>{formItemView.onValidityChanged(listener)})}unValidityChanged(listener){this.formItemViews.forEach(formItemView=>{formItemView.unValidityChanged(listener)})}onFocus(listener){this.formItemViews.forEach(formItemView=>{formItemView.onFocus(listener)})}unFocus(listener){this.formItemViews.forEach(formItemView=>{formItemView.unFocus(listener)})}onBlur(listener){this.formItemViews.forEach(formItemView=>{formItemView.onBlur(listener)})}unBlur(listener){this.formItemViews.forEach(formItemView=>{formItemView.unBlur(listener)})}doLayout(){let deferred=Q.defer(),label=new FieldSetLabel(this.fieldSet);this.appendChild(label);let wrappingDiv=new DivEl("field-set-container");return this.appendChild(wrappingDiv),this.formItemLayer.setFormItems(this.fieldSet.getFormItems()).setParentElement(wrappingDiv).setParent(this.getParent()).layout(this.propertySet).then(formItemViews=>{this.formItemViews=formItemViews,deferred.resolve(null)}).catch(reason=>{let fieldSetValue=this.fieldSet?this.fieldSet.toJson():{};DefaultErrorHandler.handle(reason)}).done(),deferred.promise}}class FormSet extends FormItem{static{__name(this,"FormSet")}constructor(formSetJson){super(formSetJson.name),this.helpTextIsOn=!1,this.label=formSetJson.label,this.occurrences=Occurrences.fromJson(formSetJson.occurrences),this.helpText=formSetJson.helpText}getLabel(){return this.label}getHelpText(){return this.helpText}getOccurrences(){return this.occurrences}isHelpTextOn(){return this.helpTextIsOn}toggleHelpText(show){this.helpTextIsOn=show}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,FormSet)||!super.equals(o))return!1;let other=o;return!(!ObjectHelper.stringEquals(this.label,other.label)||!ObjectHelper.equals(this.occurrences,other.occurrences)||!ObjectHelper.stringEquals(this.helpText,other.helpText))}toJson(){return{}}}class FormItemSet extends FormSet{static{__name(this,"FormItemSet")}constructor(formItemSetJson,factory,applicationKey){super(formItemSetJson),this.formItemByName={},this.immutable=formItemSetJson.immutable,formItemSetJson.items!=null&&formItemSetJson.items.forEach(formItemJson=>{let formItem=factory.createFormItem(formItemJson,applicationKey);formItem&&this.addFormItem(formItem)})}addFormItem(formItem){const name=formItem.getName();if(this.formItemByName[name])throw new Error("FormItem already added: "+name);formItem.setParent(this),this.formItemByName[formItem.getName()]=formItem,this.formItems.push(formItem)}getFormItemByName(name){return this.formItemByName[name]}getInputByName(name){return this.formItemByName[name]}isImmutable(){return this.immutable}toJson(){return{FormItemSet:{name:this.getName(),helpText:this.getHelpText(),immutable:this.isImmutable(),items:this.getFormItems().map(formItem=>formItem.toJson()),label:this.getLabel(),occurrences:this.getOccurrences().toJson()}}}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,FormItemSet)||!super.equals(o))return!1;let other=o;return!(!ObjectHelper.booleanEquals(this.immutable,other.immutable)||!ObjectHelper.arrayEquals(this.formItems,other.formItems))}}const DRAG_HELPER_KEY="DragHelper";class DragHelper extends DivEl{static{__name(this,"DragHelper")}static{this.CURSOR_AT={left:-10,top:-15}}constructor(){super("drag-helper"),this.debug=!1,this.setId("drag-helper")}static get(){let instance=Store.instance().get(DRAG_HELPER_KEY);return instance==null&&(instance=new DragHelper,Store.instance().set(DRAG_HELPER_KEY,instance)),instance}setDropAllowed(allowed){return this.debug,this.toggleClass("drop-allowed",allowed),this}setItemName(itemName){let p=new PEl;p.setClass("drag-item-name"),p.setHtml(itemName),this.removeChildren(),this.appendChild(p)}isDropAllowed(){return this.hasClass("drop-allowed")}reset(){return this.setDropAllowed(!1),this}}class H5El extends Element{static{__name(this,"H5El")}constructor(className){super(new NewElementBuilder().setTagName("h5").setClassName(className))}}class FormSetHeader extends DivEl{static{__name(this,"FormSetHeader")}constructor(formSet,forceHelpToggle){if(super("form-set-header"),this.title=new H5El,this.title.setHtml(formSet.getLabel()||""),formSet.getOccurrences().required()){const requiredMarker=new SpanEl("required");this.title.appendChild(requiredMarker)}(formSet.getHelpText()||forceHelpToggle)&&(this.helpTextContainer=new HelpTextContainer(formSet.getHelpText()))}doRender(){return super.doRender().then(rendered=>{if(this.appendChild(this.title),this.helpTextContainer){const helpTextDiv=this.helpTextContainer.getHelpText();this.prependChild(this.helpTextContainer.getToggler()),helpTextDiv&&this.appendChild(helpTextDiv)}return rendered})}onHelpTextToggled(listener){this.helpTextContainer?.onHelpTextToggled(listener)}toggleHelpText(show){this.helpTextContainer?.toggleHelpText(show)}}var FormItemState;(function(FormItemState2){FormItemState2.NEW="new",FormItemState2.EXISTING="existing"})(FormItemState||(FormItemState={}));class OccurrenceAddedEvent{static{__name(this,"OccurrenceAddedEvent")}constructor(occurrence,occurrenceView){this.occurrence=occurrence,this.occurrenceView=occurrenceView}getOccurrence(){return this.occurrence}getOccurrenceView(){return this.occurrenceView}}class OccurrenceRemovedEvent{static{__name(this,"OccurrenceRemovedEvent")}constructor(occurrence,occurrenceView){this.occurrence=occurrence,this.occurrenceView=occurrenceView}getOccurrence(){return this.occurrence}getOccurrenceView(){return this.occurrenceView}}class OccurrenceRenderedEvent{static{__name(this,"OccurrenceRenderedEvent")}constructor(occurrence,occurrenceView,validateViewOnRender=!0){this.occurrence=occurrence,this.occurrenceView=occurrenceView,this.validateOnRender=validateViewOnRender}getOccurrence(){return this.occurrence}getOccurrenceView(){return this.occurrenceView}validateViewOnRender(){return this.validateOnRender}}class FormItemOccurrences{static{__name(this,"FormItemOccurrences")}static{this.debug=!1}constructor(config){this.occurrenceViews=[],this.occurrences=[],this.occurrenceAddedListeners=[],this.occurrenceRenderedListeners=[],this.occurrenceRemovedListeners=[],this.occurrenceChangedListeners=[],this.focusListeners=[],this.blurListeners=[],this.formItem=config.formItem,this.propertyArray=config.propertyArray,this.occurrenceViewContainer=config.occurrenceViewContainer,this.allowedOccurrences=config.allowedOccurrences,this.focusListener=event=>this.notifyFocused(event),this.blurListener=event=>this.notifyBlurred(event),this.occurrenceChangedListener=(view=>this.notifyOccurrenceChanged(view))}hasHelpText(){return this.getOccurrenceViews().some(view=>view.hasHelpText())}getAllowedOccurrences(){throw new Error("Must be implemented by inheritor")}onOccurrenceRendered(listener){this.occurrenceRenderedListeners.push(listener)}refreshOccurence(_index){}unOccurrenceRendered(listener){this.occurrenceRenderedListeners=this.occurrenceRenderedListeners.filter(currentListener=>listener!==currentListener)}onOccurrenceAdded(listener){this.occurrenceAddedListeners.push(listener)}unOccurrenceAdded(listener){this.occurrenceAddedListeners=this.occurrenceAddedListeners.filter(currentListener=>listener!==currentListener)}onOccurrenceRemoved(listener){this.occurrenceRemovedListeners.push(listener)}unOccurrenceRemoved(listener){this.occurrenceRemovedListeners=this.occurrenceRemovedListeners.filter(currentListener=>listener!==currentListener)}onOccurrenceChanged(listener){this.occurrenceChangedListeners.push(listener)}unOccurrenceChanged(listener){this.occurrenceChangedListeners=this.occurrenceChangedListeners.filter(currentListener=>listener!==currentListener)}notifyOccurrenceChanged(view){this.occurrenceChangedListeners.forEach(listener=>listener(view))}getFormItem(){return this.formItem}maximumOccurrencesReached(){return this.allowedOccurrences.maximumReached(this.countOccurrences())}layout(validate=!0){const occurrences=this.constructOccurrences();return this.layoutOccurrences(occurrences,validate,FormItemState.EXISTING)}update(propertyArray,unchangedOnly){return FormItemOccurrences.debug,this.propertyArray=propertyArray,this.updateExistingOccurrences(unchangedOnly)}reset(){this.propertyArray.forEach((_property,i)=>{let occurrenceView=this.occurrenceViews[i],occurrence=this.occurrences[i];occurrenceView&&occurrence&&this.resetOccurrenceView(occurrenceView)})}clean(){this.occurrenceViews.forEach(view=>view.clean())}clear(){this.occurrenceViews.forEach(view=>view.clear())}setEnabled(enable){this.occurrenceViews.forEach(view=>{view.setEnabled(enable)})}createOccurrenceView(_occurrence,state){throw new Error("Must be implemented by inheritor")}updateOccurrenceView(_occurrenceView,_unchangedOnly){throw new Error("Must be implemented by inheritor")}resetOccurrenceView(_occurrenceView){_occurrenceView.reset()}createOccurrence(_formItemOccurrences,_insertAtIndex){throw new Error("Must be implemented by inheritor")}addNewOccurrence(insertAtIndex=this.countOccurrences(),validate=!0){const occurrence=this.createOccurrence(this,insertAtIndex),occurrenceView=this.addOccurrenceView(occurrence,validate,FormItemState.NEW);return this.notifyOccurrenceAdded(occurrence,occurrenceView),this.layoutOccurrence(occurrence,occurrenceView,validate).then(()=>(occurrenceView.addClass("hide-validation-errors"),occurrenceView.giveFocus(),occurrenceView))}onFocus(listener){this.focusListeners.push(listener)}unFocus(listener){this.focusListeners=this.focusListeners.filter(curr=>curr!==listener)}onBlur(listener){this.blurListeners.push(listener)}unBlur(listener){this.blurListeners=this.blurListeners.filter(curr=>curr!==listener)}resetOccurrenceIndexes(){this.occurrences.forEach((currOccurrence,index)=>{currOccurrence.setIndex(index)})}refreshOccurrenceViews(){this.occurrenceViews.forEach(currOccurrenceView=>{currOccurrenceView.refresh()})}hasNonDefaultValues(){return this.occurrenceViews.some(currOccurrenceView=>currOccurrenceView.hasNonDefaultValues())}hasNonDefaultNumberOfOccurrences(){return this.allowedOccurrences.required()&&this.allowedOccurrences.getMinimum()!==this.occurrenceViews.length||this.occurrenceViews.some(currOccurrenceView=>currOccurrenceView.hasNonDefaultNumberOfOccurrences())}isEmpty(){return this.occurrenceViews.every(currOccurrenceView=>currOccurrenceView.isEmpty())}isExpandable(){return this.occurrenceViews.some(view=>view.isExpandable())}getOccurrenceViewElementBefore(index){return index<1?null:this.occurrenceViews.filter(occurrenceView=>occurrenceView.getIndex()===index-1)[0]}countOccurrences(){return this.occurrences.length}moveOccurrence(fromIndex,toIndex){ArrayHelper.moveElement(fromIndex,toIndex,this.occurrences),this.occurrences.forEach((occurrence,index)=>{occurrence.setIndex(index)}),ArrayHelper.moveElement(fromIndex,toIndex,this.occurrenceViews),this.propertyArray.move(fromIndex,toIndex)}getOccurrences(){return this.occurrences}getOccurrenceViews(){return this.occurrenceViews}showEmptyFormItemOccurrences(){return!0}getTotalOccurrencesNeeded(){const minimumOccurrences=this.getAllowedOccurrences().getMinimum();return this.propertyArray.getSize()>0?Math.max(this.propertyArray.getSize(),minimumOccurrences):minimumOccurrences>0?minimumOccurrences:this.showEmptyFormItemOccurrences()?1:0}addOccurrenceView(occurrence,validate=!0,state){FormItemOccurrences.debug;const countOccurrences=this.countOccurrences();if(this.allowedOccurrences.maximumReached(countOccurrences))return null;const occurrenceView=this.createOccurrenceView(occurrence,state);occurrenceView.onFocus(this.focusListener),occurrenceView.onBlur(this.blurListener),occurrenceView.onOccurrenceChanged(this.occurrenceChangedListener);let insertAtIndex=occurrence.getIndex();if(this.occurrences.splice(insertAtIndex,0,occurrence),insertAtIndex===0)this.occurrenceViewContainer.prependChild(occurrenceView);else{let occurrenceViewBefore=this.getOccurrenceViewElementBefore(insertAtIndex);insertAtIndex===countOccurrences||!occurrenceViewBefore?this.occurrenceViewContainer.appendChild(occurrenceView):occurrenceView.insertAfterEl(occurrenceViewBefore)}return this.occurrenceViews.splice(insertAtIndex,0,occurrenceView),occurrenceView}layoutOccurrence(occurrence,occurrenceView,validate=!0){return occurrenceView.layout(validate).then(()=>(this.resetOccurrenceIndexes(),this.refreshOccurrenceViews(),this.notifyOccurrenceRendered(occurrence,occurrenceView,validate),Q.resolve())).catch(reason=>(DefaultErrorHandler.handle(reason),null))}removeOccurrenceView(occurrenceViewToRemove){FormItemOccurrences.debug;const indexToRemove=occurrenceViewToRemove.getIndex();occurrenceViewToRemove.unFocus(this.focusListener),occurrenceViewToRemove.unBlur(this.blurListener),occurrenceViewToRemove.unOccurrenceChanged(this.occurrenceChangedListener),occurrenceViewToRemove.remove(),this.occurrenceViews=this.occurrenceViews.filter(curr=>curr!==occurrenceViewToRemove);let occurrenceToRemove=this.occurrences[indexToRemove];this.occurrences=this.occurrences.filter(curr=>curr.getIndex()!==indexToRemove),this.resetOccurrenceIndexes(),this.refreshOccurrenceViews(),this.propertyArray.get(indexToRemove)&&this.propertyArray.remove(indexToRemove),this.notifyOccurrenceRemoved(occurrenceToRemove,occurrenceViewToRemove)}notifyOccurrenceRendered(occurrence,occurrenceView,validate){this.occurrenceRenderedListeners.forEach(listener=>{listener.call(this,new OccurrenceRenderedEvent(occurrence,occurrenceView,validate))})}notifyOccurrenceAdded(occurrence,occurrenceView){this.occurrenceAddedListeners.forEach(listener=>{listener.call(this,new OccurrenceAddedEvent(occurrence,occurrenceView))})}notifyOccurrenceRemoved(occurrence,occurrenceView){this.occurrenceRemovedListeners.forEach(listener=>{listener.call(this,new OccurrenceRemovedEvent(occurrence,occurrenceView))})}constructOccurrences(){const occurrences=[],totalItemsToCreate=this.getTotalOccurrencesNeeded();for(let index=0;index<totalItemsToCreate;index++)occurrences.push(this.createOccurrence(this,index));return occurrences}layoutOccurrences(occurrences,validate,state){const layoutPromises=[];return occurrences.forEach(occurrence=>{const occurrenceView=this.addOccurrenceView(occurrence,validate,state);this.notifyOccurrenceAdded(occurrence,occurrenceView),occurrenceView&&layoutPromises.push(this.layoutOccurrence(occurrence,occurrenceView,validate))}),Q.all(layoutPromises).spread(()=>Q(null))}updateExistingOccurrences(unchangedOnly){const promises=[],totalItemsNeeded=this.getTotalOccurrencesNeeded();for(this.occurrenceViews.filter((item,index)=>index>=totalItemsNeeded).forEach(item=>this.removeOccurrenceView(item)),this.occurrenceViews.forEach(view=>{promises.push(this.updateOccurrenceView(view,unchangedOnly))});this.occurrenceViews.length<totalItemsNeeded;)promises.push(this.addNewOccurrence());return Q.all(promises).spread(()=>Q(null))}notifyFocused(event){this.focusListeners.forEach(listener=>{listener(event)})}notifyBlurred(event){this.blurListeners.forEach(listener=>{listener(event)})}}class FormItemOccurrence{static{__name(this,"FormItemOccurrence")}constructor(occurrences,index,allowedOccurrences){this.occurrences=occurrences,this.allowedOccurrences=allowedOccurrences,this.index=index}setIndex(value){this.index=value}getIndex(){return this.index}isRemoveButtonRequired(){return this.moreThanRequiredOccurrences()}isRemoveButtonRequiredStrict(){return this.occurrences.countOccurrences()===1?!1:this.moreThanRequiredOccurrences()}maximumOccurrencesReached(){return this.occurrences.maximumOccurrencesReached()}addOccurrenceAbove(){return this.occurrences.addNewOccurrence(this.index)}addOccurrenceBelow(){return this.occurrences.addNewOccurrence(this.index+1)}showAddButton(){return this.isLastOccurrence()?this.lessOccurrencesThanMaximumAllowed():!1}isMultiple(){return this.allowedOccurrences.multiple()}oneAndOnly(){return this.index===0&&this.occurrences.countOccurrences()===1}moreThanRequiredOccurrences(){return this.occurrences.countOccurrences()>this.allowedOccurrences.getMinimum()}lessOccurrencesThanMaximumAllowed(){return!this.allowedOccurrences.maximumReached(this.occurrences.countOccurrences())}isLastOccurrence(){return this.index===this.occurrences.countOccurrences()-1}}class FormSetOccurrence extends FormItemOccurrence{static{__name(this,"FormSetOccurrence")}constructor(formSetOccurrences,index){super(formSetOccurrences,index,formSetOccurrences.getFormSet().getOccurrences())}}class FormSetOccurrences extends FormItemOccurrences{static{__name(this,"FormSetOccurrences")}constructor(config){super({formItem:config.formSet,propertyArray:config.propertyArray,occurrenceViewContainer:config.occurrenceViewContainer,allowedOccurrences:config.formSet.getOccurrences()}),this.expandRequestedListeners=[],this.context=config.context,this.layerFactory=config.layerFactory,this.formSet=config.formSet,this.parent=config.parent,this.lazyRender=config.lazyRender}getNewOccurrenceConfig(occurrence,state){const dataSet=this.getOrPopulateSetFromArray(occurrence.getIndex()),layer=this.layerFactory.createLayer({context:this.context,lazyRender:this.lazyRender,formItemState:state});return{context:this.context,layer,formItemOccurrence:occurrence,formSet:this.formSet,parent:this.parent,dataSet}}addOccurrenceView(occurrence,validate=!0,state){return occurrence.getIndex()<this.countOccurrences()&&(this.propertyArray.addSet(),this.propertyArray.move(this.propertyArray.getSize()-1,occurrence.getIndex())),super.addOccurrenceView(occurrence,validate,state)}createOccurrenceView(occurrence,state){const occurrenceView=this.createFormSetOccurrenceView(this.getNewOccurrenceConfig(occurrence,state));return occurrenceView.onRemoveButtonClicked(event=>this.removeOccurrenceView(event.getView())),occurrenceView.onExpandRequested(view=>this.notifyExpandRequested(view)),occurrenceView}createFormSetOccurrenceView(_config){throw new Error("Must be implemented by inheritor")}showOccurrences(show,skipInvalid){this.getOccurrenceViews().forEach(formSetOccurrenceView=>{(!skipInvalid||formSetOccurrenceView.isValid())&&formSetOccurrenceView.setContainerVisible(show)})}getFormSet(){return this.formSet}getAllowedOccurrences(){return this.formSet.getOccurrences()}createOccurrence(formItemOccurrences,insertAtIndex){return new FormSetOccurrence(formItemOccurrences,insertAtIndex)}toggleHelpText(show){this.getOccurrenceViews().forEach(view=>{view.toggleHelpText(show)})}isCollapsed(){return this.getOccurrenceViews().every(formSetOccurrenceView=>!formSetOccurrenceView.isContainerVisible())}moveOccurrence(index,destinationIndex){super.moveOccurrence(index,destinationIndex)}updateOccurrenceView(occurrenceView,_unchangedOnly){const propertySet=this.getOrPopulateSetFromArray(occurrenceView.getIndex());return occurrenceView.update(propertySet)}refreshOccurence(index){this.occurrenceViews[index].refreshViews()}onExpandRequested(listener){this.expandRequestedListeners.push(listener)}unExpandRequested(listener){this.expandRequestedListeners.filter(currentListener=>currentListener!==listener)}notifyExpandRequested(view){this.expandRequestedListeners.forEach(listener=>listener(view))}getOrPopulateSetFromArray(index){return this.propertyArray.getSet(index)||this.propertyArray.addSet()}showEmptyFormItemOccurrences(){return this.context.getShowEmptyFormItemSetOccurrences()}}class LiEl extends Element{static{__name(this,"LiEl")}constructor(className){super(new NewElementBuilder().setTagName("li").setClassName(className))}}class MenuItem extends LiEl{static{__name(this,"MenuItem")}constructor(action){super("menu-item"),this.action=action,this.setLabel(this.action.getLabel()),this.action.getTitle()&&this.setTitle(this.action.getTitle()),this.onClicked(()=>{action.isEnabled()&&this.action.execute()}),this.setEnabled(action.isEnabled()),this.updateIconClass(this.action.getIconClass()),action.onPropertyChanged(changedAction=>{this.setEnabled(changedAction.isEnabled()),this.setVisible(changedAction.isVisible()),this.setLabel(changedAction.getLabel()),this.updateIconClass(changedAction.getIconClass())})}updateIconClass(newIconClass){newIconClass!==this.iconClass&&(this.iconClass&&this.removeClass(this.iconClass),this.iconClass=newIconClass,this.iconClass&&this.addClass(this.iconClass))}setLabel(label){this.getEl().setInnerHtml(label)}getAction(){return this.action}setEnabled(value){let el=this.getEl();el.setDisabled(!value),value?el.removeClass("disabled"):el.addClass("disabled")}isEnabled(){return this.action.isEnabled()}}class Menu extends UlEl{static{__name(this,"Menu")}constructor(actions=[]){super("menu"),this.menuItems=[],this.hideOnItemClick=!0,this.itemClickListeners=[],actions.forEach(action=>this.addAction(action))}isHideOnItemClick(){return this.hideOnItemClick}getMenuItems(){return this.menuItems}addAction(action){const menuItem=this.createMenuItem(action);return this.appendChild(menuItem),this}addActions(actions){return actions.forEach(action=>{this.addAction(action)}),this}removeAction(action){let menuItem=this.getMenuItem(action);return menuItem&&(this.removeMenuItem(menuItem),this.removeChild(menuItem)),this}removeActions(actions){return actions.forEach(action=>{this.removeAction(action)}),this}setActions(actions){return this.menuItems.length=0,this.removeChildren(),this.addActions(actions),this}setHideOnItemClick(hide){return this.hideOnItemClick=hide,this}onItemClicked(listener){this.itemClickListeners.push(listener)}unItemClicked(listener){this.itemClickListeners=this.itemClickListeners.filter(currentListener=>listener!==currentListener)}addSeparator(){this.toggleSeparator(!0)}removeSeparator(){this.toggleSeparator(!1)}getMenuItem(action){for(const menuItem of this.menuItems)if(menuItem.getAction()===action)return menuItem;return null}notifyItemClicked(item){this.itemClickListeners.forEach(listener=>{listener(item)})}toggleSeparator(toggle){this.menuItems.length>0&&this.menuItems[this.menuItems.length-1].toggleClass("separated",toggle)}createMenuItem(action){let menuItem=new MenuItem(action);return menuItem.onClicked(event=>{this.notifyItemClicked(menuItem),this.hideOnItemClick&&this.hide(),event.preventDefault(),event.stopPropagation()}),this.menuItems.push(menuItem),menuItem}removeMenuItem(menuItem){this.menuItems=this.menuItems.filter(item=>item!==menuItem)}}class IEl extends Element{static{__name(this,"IEl")}constructor(className){super(new NewElementBuilder().setTagName("i").setClassName(className))}static fromText(text2){const i=new IEl;return i.setHtml(text2),i}}var MenuPosition;(function(MenuPosition2){MenuPosition2[MenuPosition2.LEFT=0]="LEFT",MenuPosition2[MenuPosition2.RIGHT=1]="RIGHT"})(MenuPosition||(MenuPosition={}));class MoreButton extends Button{static{__name(this,"MoreButton")}constructor(actions=[]){super(),this.addClass("more-button transparent"),this.setMenuPosition(MenuPosition.LEFT),this.icon=new IEl("icon icon-more_vert icon-medium"),this.actionPropertyListener=this.updateActionEnabled.bind(this),this.outsideClickListener=this.listenOutsideClick.bind(this),this.actionExecutedListener=_action=>this.collapseMenu(),this.menu=new Menu,this.menu.setHideOnItemClick(!1),this.addMenuActions(actions),this.initListeners(),this.appendChildren(this.icon,this.menu)}setMenuPosition(position){this.position&&this.position!==position&&(this.removeClass("menu-"+MenuPosition[this.position].toLowerCase()),this.position=position),this.addClass("menu-"+MenuPosition[position].toLowerCase())}addMenuActions(actions){this.menu.addActions(actions),this.bindActions(actions)}prependMenuActions(actions){const currentActions=this.menu.getMenuItems().map(i=>i.getAction());this.menu.setActions([].concat(actions,currentActions)),this.bindActions(actions)}getMenuActions(){return this.menu.getMenuItems().map(item=>item.getAction())}removeMenuActions(actions){this.menu.removeActions(actions),this.releaseActions(actions)}addMenuSeparator(){this.menu.addSeparator()}removeMenuSeparator(){this.menu.removeSeparator()}toggleMenu(expand){expand||expand===void 0&&!this.isMenuExpanded()?this.expandMenu():this.collapseMenu()}expandMenu(){this.addClass("expanded"),Body.get().onClicked(this.outsideClickListener)}collapseMenu(){this.removeClass("expanded"),Body.get().unClicked(this.outsideClickListener)}isMenuExpanded(){return this.hasClass("expanded")}setButtonEnabled(enabled=!0){this.setEnabled(enabled)}bindActions(actions){this.setButtonEnabled(this.getMenuActions().length>0),this.updateActionEnabled(),actions.forEach(action=>{action.onPropertyChanged(this.actionPropertyListener),action.onExecuted(this.actionExecutedListener)})}releaseActions(actions){this.setButtonEnabled(this.getMenuActions().length>0),this.updateActionEnabled(),actions.forEach(action=>{action.unPropertyChanged(this.actionPropertyListener),action.unExecuted(this.actionExecutedListener)})}updateActionEnabled(){let allActionsDisabled=this.getMenuActions().every(action=>!action.isEnabled());this.setButtonEnabled(!allActionsDisabled)}listenOutsideClick(event){this.getEl().contains(event.target)||this.collapseMenu()}initListeners(){this.icon.onClicked(_event=>{const flag=!this.isMenuExpanded();this.toggleMenu(flag)})}}class SplashMask extends Mask{static{__name(this,"SplashMask")}constructor(elementToMask){super(elementToMask),this.addClass("splash-mask"),this.shader=new DivEl("mask-shader"),this.splash=new DivEl("mask-splash"),this.appendChildren(this.shader,this.splash),this.initListeners()}initListeners(){const wheelListener=__name(_event=>{this.isVisible()&&this.hide()},"wheelListener"),clickListener=__name(_event=>{this.getEl().contains(_event.target)||this.hide()},"clickListener");this.onShown(_event=>{this.hideOnScroll&&Body.get().onMouseWheel(wheelListener),this.hideOnOutsideClick&&Body.get().onClicked(clickListener)}),this.onHidden(_event=>{this.hideOnScroll&&Body.get().unMouseWheel(wheelListener),this.hideOnOutsideClick&&Body.get().unClicked(clickListener)})}show(){super.show(),this.centerSplash()}hide(){super.hide()}setHideOnScroll(flag){this.hideOnScroll=flag}getHideOnScroll(){return this.hideOnScroll}setHideOnOutsideClick(flag){this.hideOnOutsideClick=flag}getHideOnOutsideClick(){return this.hideOnOutsideClick}setContents(...contents){this.splashContents?.length>0&&this.splash.removeChildren(),this.splashContents=contents,contents?.length>0&&this.splash.appendChildren(...this.splashContents),this.isVisible()&&this.centerSplash()}getContents(){return this.splashContents}centerSplash(){let loaderEl=this.splash.getEl();loaderEl.setMarginLeft("-"+loaderEl.getWidthWithBorder()/2+"px"),loaderEl.setMarginTop("-"+loaderEl.getHeightWithBorder()/2+"px")}}class ActionButton extends Button{static{__name(this,"ActionButton")}constructor(action,wcag){super(),this.addClass("action-button"),this.initListeners(),this.setAction(action)}initListeners(){const executeAction=__name(event=>{event.preventDefault(),event.stopPropagation(),Body.get().setFocusedElement(this),this.getAction().execute()},"executeAction");this.onClicked(executeAction),this.onHelpKeyPressed=this.onHelpKeyPressed.bind(this),this.syncButtonWithAction=this.syncButtonWithAction.bind(this),KeyBindings.get().onHelpKeyPressed(this.onHelpKeyPressed)}getAction(){return this.action}setAction(action){this.action!==action&&(this.action&&(this.action.hasClass()&&this.removeClass(this.action.getClass()),this.action.unPropertyChanged(this.syncButtonWithAction),action.hasShortcut()||KeyBindings.get().unHelpKeyPressed(this.onHelpKeyPressed)),this.doSetAction(action))}getTooltip(){return this.tooltip}createLabel(action){let label;return action.hasMnemonic()?label=action.getMnemonic().underlineMnemonic(action.getLabel()):label=action.getLabel(),label}syncButtonWithAction(){const action=this.getAction(),toggledEnabled=this.isEnabled()!==action.isEnabled(),toggledVisible=this.isVisible()!==action.isVisible(),becameHidden=toggledVisible&&!action.isVisible(),tooltip=this.getTooltip();tooltip&&(toggledEnabled||becameHidden)&&tooltip.hide(),toggledEnabled&&this.setEnabled(action.isEnabled()),toggledVisible&&this.setVisible(action.isVisible()),this.setLabel(this.createLabel(action),!1),this.updateIconClass(action.getIconClass());const actionClass=action.getClass();actionClass&&!this.hasClass(actionClass)&&this.addClass(actionClass),action.hasWcagAttributes()&&this.applyWCAGAttributes(action.getWcagAttributes())}createTooltip(){if(!this.action.hasShortcut())return;let combination=this.action.getShortcut().getCombination();combination&&(combination=combination.replace(/mod\+/i,BrowserHelper.isOSX()||BrowserHelper.isIOS()?"cmd+":"ctrl+")),this.tooltip=new Tooltip(this,combination,1e3)}doSetAction(action){action.onPropertyChanged(this.syncButtonWithAction),this.action=action,this.createTooltip(),this.whenRendered(this.syncButtonWithAction)}onHelpKeyPressed(e){const action=this.getAction();if(!action.hasShortcut())return;const tooltip=this.getTooltip();if(action.isEnabled()&&KeyBindings.get().isActive(action.getShortcut())&&KeyBindingAction[KeyBindingAction.KEYDOWN].toLowerCase()===e.type){tooltip.show();return}tooltip.hide()}updateIconClass(newIconClass){newIconClass!==this.iconClass&&(this.iconClass&&this.removeClass(this.iconClass),this.iconClass=newIconClass,this.iconClass&&this.addClass(this.iconClass))}}class ConfirmationMask extends SplashMask{static{__name(this,"ConfirmationMask")}constructor(builder){super(builder.getElement()),this.addClass("confirmation-mask"),assertState(builder.getActions()?.length>0,"There must be at least one action");const elements=[];if(builder.getQuestion()){const questionEl=new PEl("mask-question");questionEl.setHtml(builder.getQuestion(),!1),elements.push(questionEl)}this.actionsEl=new DivEl("mask-actions"),builder.getActions().forEach(action=>this.actionsEl.appendChild(new ActionButton(action))),elements.push(this.actionsEl),this.setContents(...elements),this.setHideOnScroll(builder.getHideOnScroll()),this.setHideOnOutsideClick(builder.getHideOnOutsideClick())}initListeners(){super.initListeners(),this.tabListener=event=>{const firstChild=this.actionsEl.getFirstChild(),lastChild=this.actionsEl.getLastChild();if(event.key==="Tab"){if(lastChild?.hasFocus()&&!event.shiftKey)return firstChild.giveFocus(),event.preventDefault(),!0;if(firstChild?.hasFocus()&&event.shiftKey)return lastChild.giveFocus(),event.preventDefault(),!0}return!1}}static create(){return new ConfirmationMaskBuilder}show(){super.show(),this.giveFocus(),Body.get().onKeyDown(this.tabListener)}hide(){super.hide(),Body.get().unKeyDown(this.tabListener)}giveFocus(){return this.actionsEl.getFirstChild()?.giveFocus()}}class ConfirmationMaskBuilder{static{__name(this,"ConfirmationMaskBuilder")}constructor(){this.actions=[]}setElement(el){return this.el=el,this}setQuestion(question){return this.question=question,this}addAction(action){return this.actions.push(action),this}setHideOnScroll(flag){return this.hideOnScroll=flag,this}setHideOnOutsideClick(flag){return this.hideOnOutsideClick=flag,this}getElement(){return this.el}getQuestion(){return this.question}getActions(){return this.actions}getHideOnScroll(){return this.hideOnScroll}getHideOnOutsideClick(){return this.hideOnOutsideClick}build(){return new ConfirmationMask(this)}}class RemoveButtonClickedEvent{static{__name(this,"RemoveButtonClickedEvent")}constructor(view){this.view=view}getView(){return this.view}}class FormItemOccurrenceView extends DivEl{static{__name(this,"FormItemOccurrenceView")}constructor(config){super(config.className),this.removeButtonClickedListeners=[],this.occurrenceChangedListeners=[],this.config=config,this.initElements(),this.postInitElements(),this.initListeners()}initElements(){this.formItemOccurrence=this.config.formItemOccurrence}initListeners(){}postInitElements(){}isExpandable(){return!1}toggleHelpText(show){this.helpText&&this.helpText.toggleHelpText(show)}hasHelpText(){return!!this.helpText}reset(){throw new Error("Must be implemented by inheritor")}getDataPath(){throw new Error("Must be implemented by inheritor")}layout(_validate=!0){return Q(null)}hasValidUserInput(){throw new Error("Must be implemented by inheritor")}onRemoveButtonClicked(listener){this.removeButtonClickedListeners.push(listener)}unRemoveButtonClicked(listener){this.removeButtonClickedListeners.filter(currentListener=>currentListener!==listener)}notifyRemoveButtonClicked(){this.removeButtonClickedListeners.forEach(listener=>{listener.call(this,new RemoveButtonClickedEvent(this))})}onOccurrenceChanged(listener){this.occurrenceChangedListeners.push(listener)}unOccurrenceChanged(listener){this.occurrenceChangedListeners.filter(currentListener=>currentListener!==listener)}notifyOccurrenceChanged(view){this.occurrenceChangedListeners.forEach(listener=>listener(view||this))}getIndex(){return this.formItemOccurrence.getIndex()}refresh(){throw new Error("Must be implemented by inheritor")}hasNonDefaultValues(){return!1}hasNonDefaultNumberOfOccurrences(){return!1}isEmpty(){throw Error("Must be implemented by inheritor")}clean(){}clear(){}giveFocus(){return!1}setEnabled(enable){}}class FormOccurrenceDraggableLabel extends DivEl{static{__name(this,"FormOccurrenceDraggableLabel")}static{this.MAX_LABEL_LENGTH=255}constructor(label,subTitle){super("form-occurrence-draggable-label");const dragHandle=new DivEl("drag-control");this.title=document.createTextNode(label||""),this.subTitle=new PEl("note"),subTitle&&this.setSubTitle(subTitle),this.getEl().appendChildren([dragHandle.getHTMLElement(),this.title,this.subTitle.getHTMLElement()])}setText(value){this.title.textContent=this.getPrettifiedText(value)}setExpandable(expandable){this.toggleClass("expandable",expandable),expandable?super.setTitle(this.titleText):super.setTitle("")}setTitle(title){return this.titleText=title,super.setTitle(title)}setSubTitle(value){const prettifiedText=this.getPrettifiedText(value);this.subTitleText=prettifiedText,this.subTitle.setHtml(prettifiedText),this.refreshCustomClass()}getText(){return this.title.nodeValue}refreshCustomClass(){this.toggleClass("custom-label",!StringHelper.isBlank(this.subTitleText))}getPrettifiedText(value){return value.trim().substring(0,FormOccurrenceDraggableLabel.MAX_LABEL_LENGTH)}}class FormOptionSetOption extends FormItem{static{__name(this,"FormOptionSetOption")}constructor(optionJson,factory,applicationKey){super(optionJson.name),this.helpTextIsOn=!1,this.formItemByName={},this.label=optionJson.label,this.defaultOption=optionJson.defaultOption,this.helpText=optionJson.helpText,optionJson.items!=null&&optionJson.items.forEach(formItemJson=>{let formItem=factory.createFormItem(formItemJson,applicationKey);formItem&&this.addFormItem(formItem)})}static optionsToJson(options){let jsonArray=[];return options.forEach(option=>{jsonArray.push(option.toJson().FormOptionSetOption)}),jsonArray}addFormItem(formItem){const name=formItem.getName();if(this.formItemByName[name])throw new Error(`FormItem already added: ${name}`);formItem.setParent(this),this.formItemByName[formItem.getName()]=formItem,this.formItems.push(formItem)}toString(){return this.label}getLabel(){return this.label}isDefaultOption(){return this.defaultOption}getHelpText(){return this.helpText}isHelpTextOn(){return this.helpTextIsOn}toJson(){return{FormOptionSetOption:{name:this.getName(),label:this.getLabel(),helpText:this.getHelpText(),defaultOption:this.isDefaultOption(),items:this.getFormItems().map(formItem=>formItem.toJson())}}}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,FormOptionSetOption)||!super.equals(o))return!1;const other=o;return!(!ObjectHelper.stringEquals(this.label,other.label)||!ObjectHelper.booleanEquals(this.defaultOption,other.defaultOption)||!ObjectHelper.arrayEquals(this.formItems,other.formItems))}}class FormOptionSet extends FormSet{static{__name(this,"FormOptionSet")}constructor(formOptionSetJson,factory,applicationKey){super(formOptionSetJson),this.options=[],this.expanded=formOptionSetJson.expanded,this.multiselection=Occurrences.fromJson(formOptionSetJson.multiselection),formOptionSetJson.options!=null&&formOptionSetJson.options.forEach(formOptionSetOptionJson=>{const json={FormOptionSetOption:formOptionSetOptionJson},option=factory.createFormItem(json,applicationKey);option&&this.addSetOption(option)})}addSetOption(option){this.options.push(option),option.setParent(this)}getFormItems(){return this.options}getOptions(){return this.options}isExpanded(){return this.expanded}getMultiselection(){return this.multiselection}isRadioSelection(){return this.multiselection.getMinimum()===1&&this.multiselection.getMaximum()===1}toJson(){return{FormOptionSet:{name:this.getName(),expanded:this.isExpanded(),options:FormOptionSetOption.optionsToJson(this.getOptions()),label:this.getLabel(),helpText:this.getHelpText(),occurrences:this.getOccurrences().toJson(),multiselection:this.getMultiselection().toJson()}}}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,FormOptionSet)||!super.equals(o))return!1;let other=o;return!(!ObjectHelper.booleanEquals(this.expanded,other.expanded)||!ObjectHelper.equals(this.multiselection,other.multiselection)||!ObjectHelper.arrayEquals(this.options,other.options))}}class FormSetOccurrenceView extends FormItemOccurrenceView{static{__name(this,"FormSetOccurrenceView")}constructor(classPrefix,config){super({...config,className:`${classPrefix}occurrence-view`,classPrefix}),this.validityChangedListeners=[],this.dirtyFormItemViewsMap={},this.expandRequestedListeners=[],this.layoutElements()}hasHelpText(){return super.hasHelpText()||this.getFormItemViews().some(view=>view.hasHelpText())}isExpandable(){return this.formItemViews.length>0}layout(validate=!0){return this.formItemLayer.setFormItems(this.getFormItems()).setParent(this).layout(this.propertySet,validate).then(formItemViews=>(this.formItemViews=formItemViews,this.postLayout(validate),Q(null)))}postLayout(validate=!0){validate&&this.validate(!0),this.bindPropertySet(this.propertySet),this.label.setText(this.getLabelText()),this.label.setSubTitle(this.getLabelSubTitle()),this.subscribeOnItemEvents(),this.refresh()}initElements(){super.initElements(),this.addClass("collapsed"),this.formItemViews=[],this.occurrenceContainerClassName=`${this.config.classPrefix}occurrences-container`,this.formSetOccurrencesContainer=new DivEl(this.occurrenceContainerClassName),this.formSet=this.config.formSet,this.propertySet=this.config.dataSet,this.formItemLayer=this.config.layer,this.moreButton=this.createMoreButton(),this.label=new FormOccurrenceDraggableLabel,this.formSetOccurrencesContainer.setVisible(!1),this.confirmDeleteAction=new Action(i18n("action.delete")).setClass("red large delete-button"),this.noAction=new Action(i18n("action.cancel")).setClass("black large"),this.deleteConfirmationMask=ConfirmationMask.create().setElement(this).setHideOnScroll(!0).setHideOnOutsideClick(!0).addAction(this.confirmDeleteAction).addAction(this.noAction).build()}postInitElements(){super.postInitElements(),this.label.setExpandable(this.isExpandable()),this.isExpandable()||this.label.setTitle(i18n("tooltip.header.collapse"))}initListeners(){super.initListeners(),this.label.onClicked(()=>this.setContainerVisible(!this.isContainerVisible())),this.confirmDeleteAction.onExecuted(()=>{this.notifyRemoveButtonClicked(),this.deleteConfirmationMask.hide()}),this.noAction.onExecuted(()=>{this.deleteConfirmationMask.hide()});const bindings=KeyBindings.get(),maskBindings=[new KeyBinding("esc",()=>this.noAction.execute()).setGlobal(!0)];let shelvedBindings;this.deleteConfirmationMask.onShown(()=>{shelvedBindings=bindings.getActiveBindings(),bindings.shelveBindings(shelvedBindings),bindings.bindKeys(maskBindings)}),this.deleteConfirmationMask.onHidden(()=>{bindings.unbindKeys(maskBindings),bindings.unshelveBindings(shelvedBindings),shelvedBindings=null}),this.formDataChangedListener=event=>{const newValue=event.getNewValue(),propertyPathAsString=event.getPath().toString();this.dirtyFormItemViewsMap[propertyPathAsString]?newValue.equals(this.dirtyFormItemViewsMap[propertyPathAsString].originalValue)?delete this.dirtyFormItemViewsMap[propertyPathAsString]:this.dirtyFormItemViewsMap[propertyPathAsString].currentValue=newValue:this.dirtyFormItemViewsMap[propertyPathAsString]={originalValue:event.getPreviousValue(),currentValue:newValue},this.updateLabel()},this.formDataAddedOrRemovedListener=_event=>this.updateLabel(),this.onRemoved(()=>{this.propertySet&&this.releasePropertySet(this.propertySet)})}initOccurrencesContainer(){this.formItemLayer.setParentElement(this.formSetOccurrencesContainer)}layoutElements(){this.appendChildren(this.label,this.moreButton,this.formSetOccurrencesContainer)}hasNonDefaultValues(){return this.formItemViews.some(formItemView=>formItemView.hasNonDefaultValues())}hasNonDefaultNumberOfOccurrences(){return this.formItemViews.some(formItemView=>formItemView.hasNonDefaultNumberOfOccurrences())}isEmpty(){return this.formItemViews.every(formItemView=>formItemView.isEmpty())}getDataPath(){return this.propertySet.getProperty().getPath()}validate(silent=!0){const allRecordings=new ValidationRecording;let hideValidationErrors=!0;return this.formItemViews.forEach(formItemView=>{const currRecording=formItemView.validate(silent);hideValidationErrors=hideValidationErrors&&(currRecording.isValid()||currRecording.isValidationErrorsHidden()),allRecordings.flatten(currRecording)}),hideValidationErrors=allRecordings.isInvalid()&&hideValidationErrors,this.extraValidation(allRecordings),silent||allRecordings.validityChanged(this.currentValidationState)&&this.notifyValidityChanged(new RecordingValidityChangedEvent(allRecordings,this.resolveValidationRecordingPath())),this.currentValidationState=allRecordings,this.toggleClass("invalid",!this.isValid()),this.toggleClass("hide-validation-errors",hideValidationErrors),allRecordings}toggleHelpText(show){return this.formItemLayer.toggleHelpText(show),super.toggleHelpText(show)}update(dataSet,unchangedOnly){return this.updatePropertySet(dataSet),this.formItemLayer.update(this.propertySet,unchangedOnly)}updatePropertySet(dataSet){this.dirtyFormItemViewsMap={},this.releasePropertySet(this.propertySet),this.propertySet=dataSet,this.bindPropertySet(this.propertySet)}hasValidUserInput(){let result=!0;return this.formItemViews.forEach(formItemView=>{formItemView.hasValidUserInput()||(result=!1)}),result}getContainer(){return this.formSetOccurrencesContainer}setContainerVisible(visible){this.isExpandable()&&(visible&&!this.formItemLayer.hasParentElement()&&this.initOccurrencesContainer(),this.formSetOccurrencesContainer.setVisible(visible),this.toggleClass("collapsed",!visible),this.label.setTitle(i18n(visible?"tooltip.header.collapse":"tooltip.header.expand")))}isContainerVisible(){return this.formSetOccurrencesContainer?this.formSetOccurrencesContainer.getEl().getDisplay()!=="none":!1}refresh(){this.moreButton.getMenuActions().forEach(action=>{switch(action.getLabel()){case i18n("action.reset"):break;case i18n("action.addAbove"):case i18n("action.addBelow"):action.setEnabled(!this.formItemOccurrence.maximumOccurrencesReached());break;case i18n("action.delete"):action.setEnabled(this.formItemOccurrence.isRemoveButtonRequired());break}}),this.label.setExpandable(this.isExpandable()),this.refreshViews()}refreshViews(){this.formItemViews.forEach(itemView=>{itemView.refresh()})}reset(){this.dirtyFormItemViewsMap={},this.formItemLayer.reset(),this.validate()}setEnabled(enable){this.formItemViews.forEach(itemView=>{itemView.setEnabled(enable)})}isValid(){return this.currentValidationState?this.currentValidationState.isValid():!0}getValidationRecording(){return this.currentValidationState}getFormItemViews(){return this.formItemViews}giveFocus(){let focusGiven=!1;return this.getFormItemViews().forEach(formItemView=>{!focusGiven&&formItemView.giveFocus()&&(focusGiven=!0)}),focusGiven}displayValidationErrors(value){this.formItemViews.forEach(view=>{view.displayValidationErrors(value)})}setHighlightOnValidityChange(highlight){this.formItemViews.forEach(view=>{view.setHighlightOnValidityChange(highlight)})}onValidityChanged(listener){this.validityChangedListeners.push(listener)}unValidityChanged(listener){this.validityChangedListeners.filter(currentListener=>listener===currentListener)}onFocus(listener){this.formItemViews.forEach(formItemView=>{formItemView.onFocus(listener)})}unFocus(listener){this.formItemViews.forEach(formItemView=>{formItemView.unFocus(listener)})}onBlur(listener){this.formItemViews.forEach(formItemView=>{formItemView.onBlur(listener)})}unBlur(listener){this.formItemViews.forEach(formItemView=>{formItemView.unBlur(listener)})}clean(){super.clean(),this.formItemViews.forEach(view=>view.clean())}clear(){super.clear(),this.formItemViews.forEach(view=>view.clear())}onExpandRequested(listener){this.expandRequestedListeners.push(listener)}unExpandRequested(listener){this.expandRequestedListeners.filter(currentListener=>currentListener!==listener)}notifyExpandRequested(view){this.expandRequestedListeners.forEach(listener=>listener(view||this))}updateLabel(){this.label.setText(this.getLabelText()),this.label.setSubTitle(this.getLabelSubTitle())}extraValidation(_validationRecording){}subscribeOnItemEvents(){this.formItemViews.forEach(formItemView=>{formItemView.onValidityChanged(event=>{if(!this.currentValidationState)return;let previousValidState=this.currentValidationState.isValid();event.isValid()?this.currentValidationState.removeByPath(event.getOrigin(),!1,event.isIncludeChildren()):this.currentValidationState.flatten(event.getRecording()),previousValidState!==this.currentValidationState.isValid()&&this.notifyValidityChanged(new RecordingValidityChangedEvent(this.currentValidationState,this.resolveValidationRecordingPath()).setIncludeChildren(!0))})})}getFormSet(){throw new Error("Must be implemented by inheritor")}getFormItems(){throw new Error("Must be implemented by inheritor")}resolveValidationRecordingPath(){return new ValidationRecordingPath(this.getDataPath(),null)}notifyValidityChanged(event){this.validityChangedListeners.forEach(listener=>{listener(event)})}isAllowedValueAndType(property){if(property.getValue().isNull())return!1;const propertyType=property.getType();return ValueTypes.LOCAL_TIME.equals(propertyType)&&property.getString()==="00:00"?!1:[ValueTypes.STRING,ValueTypes.DOUBLE,ValueTypes.LONG,ValueTypes.LOCAL_DATE,ValueTypes.LOCAL_TIME].some(valueType=>valueType.equals(propertyType))&&property.getString().length>0}getRadioButtonTextByValue(radioGroup,selectedValue){const radioButtons=radioGroup.getInputTypeConfig().option;return radioButtons?radioButtons.find(option=>option["@value"]===selectedValue).value:""}isRadioButtonInput(formItem){return ObjectHelper.iFrameSafeInstanceOf(formItem,Input)&&formItem.getInputType().toString()==="RadioButton"}getPropertyValue(prop,formItem){return formItem?this.isRadioButtonInput(formItem)?this.getRadioButtonTextByValue(formItem,prop.getString()):prop.getString():""}fetchPropertyValues(propArray,propValues,firstOnly){propArray.some(prop=>{const formItem=this.getFormItemByProperty(prop);if(!formItem)return!1;if(this.isAllowedValueAndType(prop)){const propValue=this.sanitizeValue(this.getPropertyValue(prop,formItem));propValue.length>0&&propValues.push(propValue)}else if(ValueTypes.DATA.equals(prop.getType())){const propertySet=prop.getPropertySet();formItem instanceof FormOptionSet?this.fetchPropertyValuesFromOptionSet(propertySet,formItem,propValues,firstOnly):this.fetchPropertyValuesFromSet(propertySet,propValues,firstOnly)}return firstOnly&&propValues.length>0})}fetchPropertyValuesFromSet(propertySet,propValues,firstOnly){propertySet.getPropertyArrays().some(array=>array.getName()==="_selected"?!1:(this.fetchPropertyValues(array,propValues,firstOnly),firstOnly&&propValues.length>0))}fetchPropertyValuesFromOptionSet(propertySet,formItem,propValues,firstOnly){const selectionArray=propertySet.getPropertyArray("_selected");selectionArray&&!selectionArray.isEmpty()&&(this.fetchPropertyValuesFromOptions(formItem,selectionArray,propValues),propValues.length===0&&selectionArray.some(selectedProp=>{const selectedOptionArray=propertySet.getPropertyArray(selectedProp.getString());return selectedOptionArray&&!selectedOptionArray.isEmpty()&&this.fetchPropertyValues(selectedOptionArray,propValues,firstOnly),firstOnly&&propValues.length>0}))}fetchPropertyValuesFromOptions(formItem,selectionArray,propValues){const nameLabelMap=new Map(formItem.getFormItems().filter(fi=>fi instanceof FormOptionSetOption).map((fo,index)=>[fo.getName(),{label:fo.getLabel(),index}])),selectedLabels=selectionArray.getProperties().sort((one,two)=>nameLabelMap.get(one.getString()).index-nameLabelMap.get(two.getString()).index).map(selectedProp=>nameLabelMap.get(selectedProp.getString()).label);propValues.push(...selectedLabels)}getFormItemByProperty(prop,formItems){let formItem;const propertyName=prop.getName(),parentPropertyName=prop.getParentProperty().getName();return(formItems||this.getFormItems()).find(item=>(item.getName()===propertyName&&item.getParent().getName()===parentPropertyName?formItem=item:(item instanceof FormOptionSetOption||item instanceof FormItemSet)&&(formItem=this.getFormItemByProperty(prop,item.getFormItems())),!!formItem)),formItem}sanitizeValue(label){return label.replace(/<\/?[^>]+(>|$)/g,"").replace(/&nbsp;/g,"").replace(/\s{2,}/g," ").replace(/\n/g," ").trim()}releasePropertySet(set){set.unPropertyValueChanged(this.formDataChangedListener),set.unPropertyAdded(this.formDataAddedOrRemovedListener),set.unPropertyRemoved(this.formDataAddedOrRemovedListener)}bindPropertySet(set){set.onPropertyValueChanged(this.formDataChangedListener),set.onPropertyAdded(this.formDataAddedOrRemovedListener),set.onPropertyRemoved(this.formDataAddedOrRemovedListener)}isDirty(){return Object.keys(this.dirtyFormItemViewsMap).length>0}createMoreButton(){const addAboveAction=new Action(i18n("action.addAbove")).onExecuted(_action=>{this.formItemOccurrence.addOccurrenceAbove().then(view=>{const setView=view;this.notifyExpandRequested(setView)})}),addBelowAction=new Action(i18n("action.addBelow")).onExecuted(_action=>{this.formItemOccurrence.addOccurrenceBelow().then(view=>{const setView=view;this.notifyExpandRequested(setView)})}),removeAction=new Action(i18n("action.delete")).onExecuted(_action=>{if(this.isDirty()||this.hasNonDefaultValues()){this.setContainerVisible(!0),this.notifyExpandRequested();const label=this.formSet.getLabel();label&&this.confirmDeleteAction.setLabel(i18n("dialog.confirm.occurrences.delete",label)),this.deleteConfirmationMask.show()}else this.notifyRemoveButtonClicked()});return new MoreButton([addAboveAction,addBelowAction,removeAction])}getLabelEl(){return this.label}}class FormEl extends Element{static{__name(this,"FormEl")}constructor(className){super(new NewElementBuilder().setTagName("form").setClassName(className))}static getNextFocusable(input,focusableSelector,ignoreTabIndex){const focusableElements=document.querySelectorAll(focusableSelector||"input, button, select"),index=FormEl.getIndexOfInput(focusableElements,input);if(index<0)return null;for(let i=index+1;i<focusableElements.length;i++){let nextFocusable=Element.fromHtmlElement(focusableElements[i]);if(nextFocusable.isVisible()&&!(!ignoreTabIndex&&nextFocusable.getEl().getTabIndex()&&nextFocusable.getEl().getTabIndex()<0))return nextFocusable}return null}static moveFocusToNextFocusable(input,focusableSelector){let nextFocusable=FormEl.getNextFocusable(input,focusableSelector);nextFocusable&&nextFocusable.giveFocus()}static getPrevFocusable(input,focusableSelector){const focusableElements=document.querySelectorAll(focusableSelector||"input, button, select");let index=FormEl.getIndexOfInput(focusableElements,input),nextFocusable;do index=index-1,0<=index&&(nextFocusable=Element.fromHtmlElement(focusableElements[index]));while(nextFocusable.getEl().getTabIndex()&&nextFocusable.getEl().getTabIndex()<0);return nextFocusable}static moveFocusToPrevFocusable(input,focusableSelector){const prevFocusable=FormEl.getPrevFocusable(input,focusableSelector);prevFocusable&&prevFocusable.giveFocus()}static getIndexOfInput(elements,el){let index=-1,inputHTMLElement=el.getHTMLElement();for(let i=0;i<elements.length;i++)if(inputHTMLElement===elements[i]){index=i;break}return index}preventSubmit(){this.onSubmit(event=>{event.preventDefault()})}onSubmit(listener){this.getEl().addEventListener("submit",listener)}unSubmit(listener){this.getEl().removeEventListener("submit",listener)}setName(name){return this.getEl().setAttribute("name",name),this}setAction(url){return this.getEl().setAttribute("action",url),this}setTarget(target){return this.getEl().setAttribute("target",target),this}setMethod(method){return this.getEl().setAttribute("method",method),this}}class ValueChangedEvent{static{__name(this,"ValueChangedEvent")}constructor(oldValue="",newValue=""){this.oldValue=oldValue,this.newValue=newValue}getOldValue(){return this.oldValue}getNewValue(){return this.newValue}valuesAreEqual(){return this.oldValue===this.newValue}}class FormInputEl extends FormItemEl{static{__name(this,"FormInputEl")}static{this.debug=!1}constructor(tagName,className,prefix,originalValue=""){super(tagName,className,prefix),this.dirtyChangedListeners=[],this.valueChangedListeners=[],this.addClass("form-input"),this.originalValue=originalValue,this.oldValue="",this.dirty=!1,FormInputEl.debug;const initListenersOnce=__name(()=>{this.onChange(()=>{this.refreshDirtyState(),this.refreshValueChanged()}),StringHelper.isBlank(this.originalValue)||(FormInputEl.debug,FormInputEl.prototype.setValue.call(this,this.originalValue,!0)),this.unAdded(initListenersOnce)},"initListenersOnce");this.onAdded(initListenersOnce),FormInputEl.debug}getValue(){return this.doGetValue()}setValue(value,silent,userInput){return FormInputEl.debug,this.oldValue!==value||this.isSameValueUpdateAllowed()||userInput?(FormInputEl.debug,this.doSetValue(value),this.refreshValueChanged(silent),!userInput&&!this.dirty&&this.originalValue!==value?(FormInputEl.debug,this.originalValue=value?String(value):""):this.refreshDirtyState(silent)):FormInputEl.debug,FormInputEl.debug,this}forceChangedEvent(){this.notifyValueChanged(new ValueChangedEvent(this.oldValue,this.getValue()))}isDirty(){return this.dirty}toString(){return ClassHelper.getClassName(this)+"["+this.getId()+"]"}resetBaseValues(){this.originalValue=this.getValue(),this.oldValue=this.originalValue,this.dirty=!1}clear(){this.setValue("")}onChange(listener){this.getEl().addEventListener("change",listener)}unChange(listener){this.getEl().removeEventListener("change",listener)}onInput(listener){this.getEl().addEventListener("input",listener)}unInput(listener){this.getEl().removeEventListener("input",listener)}onDirtyChanged(listener){this.dirtyChangedListeners.push(listener)}unDirtyChanged(listener){this.dirtyChangedListeners=this.dirtyChangedListeners.filter(curr=>listener!==curr)}onValueChanged(listener){this.valueChangedListeners.push(listener)}unValueChanged(listener){this.valueChangedListeners=this.valueChangedListeners.filter(curr=>listener!==curr)}getOriginalValue(){return this.originalValue}doGetValue(){return this.getEl().getValue()}doSetValue(value){this.getEl().setValue(value)}isSameValueUpdateAllowed(){return!1}refreshDirtyState(silent){this.setDirty(this.calculateDirty(),silent)}refreshValueChanged(silent){let value=this.doGetValue();this.oldValue!==value?(FormInputEl.debug,silent||this.notifyValueChanged(new ValueChangedEvent(this.oldValue,value)),this.oldValue=""+value):FormInputEl.debug}calculateDirty(){return!ObjectHelper.stringEquals(this.originalValue,this.doGetValue())}setDirty(dirty,silent){this.dirty!==dirty&&(this.dirty=dirty,FormInputEl.debug,silent||this.notifyDirtyChanged(dirty))}notifyDirtyChanged(dirty){this.dirtyChangedListeners.forEach(listener=>{listener(dirty)})}notifyValueChanged(event){this.valueChangedListeners.forEach(listener=>{listener(event)})}}class InputEl extends FormInputEl{static{__name(this,"InputEl")}constructor(className,type,prefix,originalValue){super("input",className,prefix,originalValue),this.setType(type||"text"),this.setAutocomplete(!1),this.onInput(this.handleInput.bind(this))}getName(){return this.getEl().getAttribute("name")}setName(value){return this.getEl().setAttribute("name",value),this}getType(){return this.getEl().getAttribute("type")}setType(type){return this.getEl().setAttribute("type",type),this}setPlaceholder(value){return this.getEl().setAttribute("placeholder",value),this}getPlaceholder(){return this.getEl().getAttribute("placeholder")}setAutocomplete(value){return this.getEl().setAutocomplete(value),this}hasAutocomplete(){return this.getEl().hasAutocomplete()}getPattern(){return this.getEl().getAttribute("pattern")}setPattern(pattern){return this.getEl().setAttribute("pattern",pattern),this}reset(){this.getEl().setValue("")}isValid(){let validity=this.getHTMLElement().validity;return validity&&validity.valid}validate(){return this.getHTMLElement().checkValidity()}setRequired(required){return required?this.getEl().setAttribute("required","required"):this.getEl().removeAttribute("required"),this}isRequired(){return this.getEl().hasAttribute("required")}handleInput(){this.refreshDirtyState(),this.refreshValueChanged()}setEnabled(enable){super.setEnabled(enable),this.getEl().setDisabled(!enable),enable?this.getEl().removeAttribute("disabled"):this.getEl().setAttribute("disabled","disabled")}}class LabelEl extends Element{static{__name(this,"LabelEl")}constructor(value,forElement,className){super(new NewElementBuilder().setTagName("label").setClassName(className)),StringHelper.isBlank(value)||this.setValue(value),forElement&&this.setForElement(forElement)}appendTextContainer(){this.textContainer||(this.textContainer=new SpanEl("label-text"),this.appendChild(this.textContainer))}setForElement(forElement){this.getEl().setAttribute("for",forElement.getId())}setValue(value){this.textContainer||this.appendTextContainer(),this.textContainer.getEl().setInnerHtml(value)}getValue(){return this.textContainer?this.textContainer.getEl().getInnerHtml():""}}class Checkbox extends FormInputEl{static{__name(this,"Checkbox")}static{this.debug=!1}constructor(builder){const{name,inputAlignment,text:text2,tooltip,checked}=builder;super("div","checkbox",void 0,String(checked||!1)),this.initCheckbox(inputAlignment),this.initLabel(text2,tooltip),this.onApplyKeyPressed(()=>{this.toggleChecked(),this.getEl().dispatchEvent("change")}),name&&this.setName(name),this.appendChild(this.checkbox),this.appendChild(this.label),this.setChecked(checked||!1,!0)}static create(){return new CheckboxBuilder}isDisabled(){return this.checkbox.getEl().isDisabled()}setChecked(newValue,silent){return super.setValue(String(newValue),silent),this}clear(){this.setChecked(!1)}isChecked(){return super.getValue()==="true"}toggleChecked(){this.setChecked(!this.isChecked())}setValue(value){return Checkbox.debug,super.setValue(value),this}getValue(){return Checkbox.debug,super.getValue()}giveFocus(){return this.checkbox.giveFocus()}giveBlur(){return this.checkbox.giveBlur()}setPartial(value){this.checkbox.toggleClass("partial",value)}isPartial(){return this.checkbox.hasClass("partial")}setEnabled(enable){super.setEnabled(enable),this.checkbox.getEl().setDisabled(!enable)}setLabel(text2){return this.label.setValue(text2),this}getLabel(){return this.label.getValue()}setPlaceholder(value){return this.checkbox.setPlaceholder(value),this}getPlaceholder(){return this.checkbox.getPlaceholder()}onFocus(listener){this.checkbox.onFocus(listener)}unFocus(listener){this.checkbox.unFocus(listener)}onBlur(listener){this.checkbox.onBlur(listener)}unBlur(listener){this.checkbox.unBlur(listener)}doSetValue(value){Checkbox.debug,this.checkbox.getHTMLElement().checked=value==="true"}doGetValue(){return String(this.checkbox.getHTMLElement().checked)}initCheckbox(inputAlignment){this.checkbox=new InputEl("","checkbox"),this.addClass(this.getInputAlignmentAsString(inputAlignment))}initLabel(text2,tooltip){this.label=new LabelEl(text2,this.checkbox),tooltip&&this.label.setTitle(tooltip)}getInputAlignmentAsString(inputAlignment=InputAlignment.LEFT){return InputAlignment[inputAlignment].toLowerCase()}}var InputAlignment;(function(InputAlignment2){InputAlignment2[InputAlignment2.TOP=0]="TOP",InputAlignment2[InputAlignment2.RIGHT=1]="RIGHT",InputAlignment2[InputAlignment2.LEFT=2]="LEFT",InputAlignment2[InputAlignment2.BOTTOM=3]="BOTTOM"})(InputAlignment||(InputAlignment={}));class CheckboxBuilder{static{__name(this,"CheckboxBuilder")}setName(name){return this.name=name,this}setLabelText(value){return this.text=value,this}setTooltip(value){return this.tooltip=value,this}setChecked(value){return this.checked=value,this}setInputAlignment(value){return this.inputAlignment=value,this}build(){return new Checkbox(this)}}class AppHelper{static{__name(this,"AppHelper")}static debounce(func,wait,immediate=!1){let timeout;return function(..._anyArgs){const context=this,later=__name(()=>{timeout=null,immediate||func.apply(context,_anyArgs)},"later"),callNow=immediate&&!timeout;clearTimeout(timeout),timeout=window.setTimeout(later,wait),callNow&&func.apply(context,_anyArgs)}}static debounceWithInterrupt(func,wait,immediate=!1){let timeout;return function(_anyArgs,interrupt){const context=this,later=__name(()=>{timeout=null,immediate||func.apply(context,_anyArgs)},"later"),callNow=immediate&&!timeout||interrupt;clearTimeout(timeout),timeout=window.setTimeout(later,wait),callNow&&func.apply(context,_anyArgs)}}static runOnceAndDebounce(func,wait){let timeout,trailing=!1;return function(..._anyArgs){const context=this,later=__name(()=>{timeout=null,trailing&&func.apply(context,_anyArgs),trailing=!1},"later"),callNow=!trailing&&!timeout;clearTimeout(timeout),timeout=window.setTimeout(later,wait),callNow?func.apply(context,_anyArgs):trailing=!0}}static executeWithRetry(func,intervalMs=1e3,maxAttempts=5,stopCondition){return new Promise((resolve,reject)=>{let attempts=0,hasStopped=!1;const cleanupAndStop=__name((interval,reason)=>{hasStopped||(hasStopped=!0,interval&&clearInterval(interval),reason&&reject(reason))},"cleanupAndStop"),executeFunc=__name(async()=>{if(hasStopped)return!1;if(attempts++,attempts>maxAttempts)return cleanupAndStop(void 0,new Error(`Max attempts (${maxAttempts}) reached without success.`)),!1;try{const result=await func();if(stopCondition(result))return cleanupAndStop(),resolve(result),!0}catch{}return!1},"executeFunc");executeFunc().then(shouldStop=>{if(shouldStop)return;const interval=setInterval(async()=>{await executeFunc()&&cleanupAndStop(interval),attempts>=maxAttempts&&cleanupAndStop(interval,new Error(`Max attempts (${maxAttempts}) reached without success.`))},intervalMs)})})}static whileTruthy(initializer,callback){let result;for(result=initializer();result;result=initializer())callback(result)}static preventDragRedirect(message="",element){element=element||Body.get();let window2=WindowDOM.get(),timeout=null,beforeUnloadHandler=__name(event=>((event||window2.asWindow().event).returnValue=message,event.preventDefault(),message),"beforeUnloadHandler"),unBeforeUnload=__name(()=>{timeout=null,window2.unBeforeUnload(beforeUnloadHandler)},"unBeforeUnload");element.onDragOver(()=>{timeout||window2.onBeforeUnload(beforeUnloadHandler),clearTimeout(timeout),timeout=setTimeout(unBeforeUnload,100)})}static dispatchCustomEvent(name,element){$(element.getHTMLElement()).trigger(name)}static focusInOut(element,onFocusOut,wait=50,preventMouseDown=!0){let focusOutTimeout=0,target;element.onFocusOut(event=>{target===event.target&&(focusOutTimeout=window.setTimeout(()=>onFocusOut(target),wait))}),element.onFocusIn(event=>{target=event.target,clearTimeout(focusOutTimeout)}),preventMouseDown&&element.onMouseDown(e=>{e.target.tagName.toLowerCase()!=="input"&&e.preventDefault()})}static lockEvent(event){event.stopPropagation(),event.preventDefault()}static isDirty(element){const checkDirty=__name(el=>el!==element&&"isDirty"in el&&typeof el.isDirty=="function"?el.isDirty():el.getChildren().some(checkDirty),"checkDirty");return checkDirty(element)}}class H2El extends Element{static{__name(this,"H2El")}constructor(className){super(new NewElementBuilder().setTagName("h2").setClassName(className))}}class DialogButton extends ActionButton{static{__name(this,"DialogButton")}constructor(action){super(action),this.addClass("dialog-button")}}var DialogState;(function(DialogState2){DialogState2[DialogState2.OPEN=0]="OPEN",DialogState2[DialogState2.CLOSED=1]="CLOSED"})(DialogState||(DialogState={}));class ModalDialog extends DivEl{static{__name(this,"ModalDialog")}static{this.THRESHOLD=80}static{this.debug=!1}constructor(config={}){super("modal-dialog",StyleHelper$1.COMMON_PREFIX),this.onClosedListeners=[],this.resizeListeners=[],this.pendingMasks=0,this.config=config,this.initElements(),this.postInitElements(),this.initListeners()}initElements(){this.buttonRow=this.config.buttonRow||new ButtonRow,this.dialogContainer=new DivEl("dialog-container"),this.skipTabbable=this.config.skipTabbable||!1,this.cancelAction=this.createDefaultCancelAction(),this.closeIcon=new DivEl("cancel-button-top"),this.header=this.createHeader(this.config.title||""),this.contentPanel=new ModalDialogContentPanel,this.body=new DivEl("modal-dialog-body"),this.footer=new DivEl("modal-dialog-footer"),this.loadMask=new LoadMask(this.body),this.state=DialogState.CLOSED,this.listOfClickIgnoredElements=[]}createDefaultCancelAction(){const cancelAction=new Action(i18n("action.cancel"),"esc",!0);return cancelAction.setIconClass("cancel-button-top"),cancelAction.setLabel(""),cancelAction.onExecuted(()=>{this.close()}),this.buttonRow.addToActions(cancelAction),cancelAction}createHeader(title){return new DefaultModalDialogHeader(title)}postInitElements(){}initListeners(){this.responsiveItem=new ResponsiveItem(this),this.initFocusInOutEventsHandlers(),this.config.allowFullscreen!==!1&&this.config.alwaysFullscreen!==!0&&this.initResizeHandler(),this.onRendered(()=>{this.config.alwaysFullscreen&&(this.addClass("always-fullscreen"),this.toggleFullscreen(!0))});const closeIconCallback=this.config.closeIconCallback||(()=>{this.cancelAction?this.cancelAction.execute():this.close()});this.closeIcon.onClicked(closeIconCallback);const descendantsAddedHandler=AppHelper.debounce(()=>{this.updateTabbable()},200);this.onDescendantAdded(descendantsAddedHandler),this.initClickOutsideListeners()}getClickTarget(event){const path=event.composedPath();return path?path[0]:event.target}initClickOutsideListeners(){if(!this.getConfig().keepOpenOnClickOutside){const mouseClickListener=__name(event=>{if(this.canHandleOutsideClick()){const clickTarget=this.getClickTarget(event);for(let element=clickTarget;element;element=element.parentNode)if(element===this.getHTMLElement()||element instanceof HTMLElement&&this.isIgnoredElementClicked(element))return;this.handleClickOutside(),event.stopPropagation(),event.preventDefault()}},"mouseClickListener");this.onRemoved(()=>{Body.get().unMouseDown(mouseClickListener)}),this.onAdded(()=>{Body.get().onMouseDown(mouseClickListener)})}}isIgnoredElementClicked(element){let ignoredElementClicked=!1;return element&&element.className&&element.className.indexOf&&(ignoredElementClicked=element.className.indexOf("mce-")>-1||element.className.indexOf("html-area-modal-dialog")>-1||element.className.indexOf("cke_")>-1||element.className.indexOf("confirmation-mask")>-1),ignoredElementClicked=ignoredElementClicked||this.listOfClickIgnoredElements.some(elem=>elem.getHTMLElement()===element||elem.getEl().contains(element)),ignoredElementClicked}canHandleOutsideClick(){return this.isActive()}handleClickOutside(){this.close()}getConfig(){return this.config}isActive(){return this.isOpen()&&!this.isMasked()}isMasked(){return this.hasClass("masked")}initFocusInOutEventsHandlers(){AppHelper.focusInOut(this,lastFocused=>{this.isFocusOutEventToBeProcessed(lastFocused)&&this.bringFocusBackToDialog(lastFocused)},10,!1)}isFocusOutEventToBeProcessed(lastFocused){return this.isOpen()&&this.hasTabbable()&&!this.hasSubDialog()&&!this.isMasked()&&!this.isIframeWithinDialogHavingFocus()&&!this.isValidFocusedElement()}isIframeWithinDialogHavingFocus(){return this.isIframeFocused()&&this.hasModalDialogAsParent(document.activeElement)}isIframeFocused(){return document.activeElement?.tagName.toLowerCase()==="iframe"}hasModalDialogAsParent(el){const thisHtmlEl=this.getHTMLElement();let parentEl=el.parentElement;for(;parentEl;){if(parentEl===thisHtmlEl)return!0;parentEl=parentEl.parentElement}return!1}isValidFocusedElement(){return this.isIframeFocused()&&document.activeElement?.className?.indexOf("cke_")>-1}bringFocusBackToDialog(lastFocused){const lastTabbable=this.getLastTabbable();lastTabbable?lastFocused===lastTabbable.getHTMLElement()?this.focusFirstTabbable():lastTabbable.giveFocus():(this.updateTabbable(),this.focusFirstTabbable())}getLastTabbable(){return this.tabbable.slice().reverse().find(el=>el.isVisible()&&!el.getEl().isDisabled())}hasTabbable(){return!!this.tabbable&&this.tabbable.length>0}hasSubDialog(){return!1}focusFirstTabbable(){return this.tabbable?.some(el=>el.giveFocus())}createResizeObserver(){window.ResizeObserver&&(this.resizeObserver=new window.ResizeObserver(()=>{this.executeResizeHandlers()}))}initResizeHandler(){this.handleResize=AppHelper.debounce(()=>{this.isOpen()&&this.resizeHandler()},200),ResponsiveManager.onAvailableSizeChanged(Body.get(),this.handleResize),this.createResizeObserver()}resizeHandler(){this.adjustHeight(),this.responsiveItem.update()}getDialogHeight(){const headerHeight=this.header.getEl().getHeight(),bodyHeight=this.body.getEl().getHeight(),footerHeight=this.footer.getEl().getHeight();return headerHeight+bodyHeight+footerHeight+ModalDialog.THRESHOLD}adjustHeight(){const dialogHeight=this.getEl().getHeightWithBorder(),containerHeight=Body.get().getEl().getHeight();if(containerHeight===0||dialogHeight===0)return;const calculatedDialogHeight=this.getDialogHeight();this.toggleFullscreen(calculatedDialogHeight>=containerHeight)}toggleFullscreen(value){value&&this.config.allowFullscreen===!1||!value&&this.config.alwaysFullscreen===!0||this.toggleClass("fullscreen",value)}getBody(){return this.body}updateTabbable(){this.tabbable=this.getTabbableElements()}isDirty(){return!1}isSingleDialogGroup(){return DialogManagerInner.get().getTotalOpen()===1}isBlurredBackgroundNeeded(){return!0}close(){this.hide(),KeyBindings.get().unshelveBindings(),this.state=DialogState.CLOSED,DialogManagerInner.get().handleClosedDialog(this),this.notifyClosed(),Body.get().reapplyFocus()}getContainer(){return this.config.container||Body.get()}hide(){this.unResize(this.handleResize),super.hide(!0),this.toggleFullscreen(!1),this.dialogContainer.getParentElement()&&this.getContainer().removeChild(this.dialogContainer)}doRender(){return super.doRender().then(rendered=>{this.config.class&&this.addClass(this.config.class),this.body.appendChild(this.contentPanel),this.footer.appendChild(this.buttonRow);const wrapper=new DivEl("modal-dialog-wrapper");return wrapper.appendChildren(this.closeIcon,this.header,this.body,this.footer),this.appendChild(wrapper),this.appendChildToContentPanel(this.loadMask),rendered})}onCloseButtonClicked(listener){return this.closeIcon.onClicked(listener)}unCloseButtonClicked(listener){return this.closeIcon.unClicked(listener)}addClickIgnoredElement(elem){this.listOfClickIgnoredElements.push(elem)}removeClickIgnoredElement(elem){const elementIndex=this.listOfClickIgnoredElements.indexOf(elem);elementIndex>-1&&this.listOfClickIgnoredElements.splice(elementIndex,1)}mask(){this.addClass("masked")}unmask(){this.removeClass("masked")}getCancelAction(){return this.cancelAction}getCancelButton(){return this.cancelButton}addCancelButtonToBottom(buttonLabel,useDefault){const cancelAction=new Action(buttonLabel||i18n("action.cancel"));return cancelAction.setIconClass("cancel-button-bottom force-enabled"),cancelAction.onExecuted(()=>this.cancelAction.execute()),this.cancelButton=this.buttonRow.addAction(cancelAction,useDefault),this.cancelButton.getEl().setAttribute("data-button-text",i18n("action.ok")),this.cancelButton}setHeading(value){this.header.setHeading(value)}appendChildToContentPanel(child){this.contentPanel.appendChild(child)}prependChildToContentPanel(child){this.contentPanel.prependChild(child)}appendChildToHeader(child){this.header.appendChild(child)}prependChildToHeader(child){this.header.prependChild(child)}appendChildToFooter(child){this.footer.appendChild(child)}prependChildToFooter(child){this.footer.prependChild(child)}removeChildFromContentPanel(child){this.contentPanel.removeChild(child)}addAction(action,useDefault,prepend){return this.buttonRow.addAction(action,useDefault,prepend)}removeAction(actionButton){if(!actionButton)return;const action=actionButton.getAction();this.buttonRow.removeAction(action)}open(){Body.get().getFocusedElement()?.giveBlur(),KeyBindings.get().shelveBindings(),this.show();const keyBindings=Action.getKeyBindings(this.buttonRow.getActions()).concat(this.addKeyBindings());KeyBindings.get().bindKeys(keyBindings),this.state=DialogState.OPEN,DialogManagerInner.get().handleOpenDialog(this)}addKeyBindings(){return[]}show(){this.dialogContainer.hasChild(this)||this.dialogContainer.appendChild(this),this.getContainer().appendChild(this.dialogContainer),super.show(),this.whenRendered(()=>{this.updateTabbable(),this.elementToFocusOnShow?.giveFocus()||this.focusFirstTabbable()||this.buttonRow.focusDefaultAction()}),this.resizeObserver&&this.resizeObserver.observe(this.body.getHTMLElement()),this.onResize(this.handleResize)}getButtonRow(){return this.buttonRow}getContentPanel(){return this.contentPanel}onClosed(onCloseCallback){this.onClosedListeners.push(onCloseCallback)}unClosed(listener){this.onClosedListeners=this.onClosedListeners.filter(function(curr){return curr!==listener})}onResize(listener){this.resizeListeners.push(listener)}unResize(listener){this.resizeListeners=this.resizeListeners.filter(curr=>curr!==listener),this.resizeListeners.length===0&&this.resizeObserver&&this.resizeObserver.disconnect()}notifyResize(){this.resizeObserver||this.executeResizeHandlers()}executeResizeHandlers(){this.resizeListeners.forEach(listener=>{listener()})}setElementToFocusOnShow(element){this.elementToFocusOnShow=element}showLoadMask(){this.pendingMasks++,this.whenRendered(()=>{this.pendingMasks!==0&&this.loadMask.show()})}hideLoadMask(){this.pendingMasks!==0&&(this.pendingMasks--,this.loadMask.hide())}isOpen(){return this.state===DialogState.OPEN}isClosed(){return this.state===DialogState.CLOSED}notifyClosed(){this.onClosedListeners.forEach(listener=>{listener()})}}class DefaultModalDialogHeader extends DivEl{static{__name(this,"DefaultModalDialogHeader")}constructor(title){super("modal-dialog-header"),this.titleEl=new H2El("title"),this.setHeading(title),this.appendChild(this.titleEl)}setHeading(value){this.titleEl.setHtml(value)}getHeading(){return this.titleEl.getHtml()}}class ModalDialogContentPanel extends DivEl{static{__name(this,"ModalDialogContentPanel")}constructor(){super("dialog-content")}}class ButtonRow extends DivEl{static{__name(this,"ButtonRow")}constructor(){super("dialog-buttons"),this.actions=[],this.buttonContainer=new DivEl("button-container"),this.appendChild(this.buttonContainer)}addElement(element,prepend){prepend?this.buttonContainer.prependChild(element):this.buttonContainer.appendChild(element)}getActions(){return this.actions}addToActions(action){this.actions.push(action)}addAction(action,useDefault,prepend){const button=new DialogButton(action);return useDefault&&this.setDefaultElement(button),this.addElement(button,prepend),action.onPropertyChanged(()=>{button.setLabel(action.getLabel()),button.setEnabled(action.isEnabled())}),this.actions.push(action),button}removeAction(action){const index=this.actions.indexOf(action);index>=0&&this.actions.splice(index,1),this.buttonContainer.getChildren().filter(button=>button.getAction()===action).forEach(button=>{this.defaultElement===button&&this.resetDefaultElement(),this.buttonContainer.removeChild(button)})}setDefaultElement(element){this.defaultElement=element}resetDefaultElement(){this.defaultElement=null}focusDefaultAction(){return this.defaultElement?.giveFocus()}}const DIALOG_MANAGER_KEY="DialogManagerInner";class DialogManagerInner{static{__name(this,"DialogManagerInner")}constructor(){this.openDialogs=[],this.dialogOpenListeners=[],this.maskedBy=new Map}static get(){let instance=Store.instance().get(DIALOG_MANAGER_KEY);return instance==null&&(instance=new DialogManagerInner,Store.instance().set(DIALOG_MANAGER_KEY,instance)),instance}handleOpenDialog(dialog){if(this.isOpen(dialog))return;const dialogId=dialog.getId(),dialogsToMask=[];this.maskedBy.set(dialogId,dialogsToMask),this.openDialogs.filter(openDialog=>!openDialog.isMasked()).forEach(notMaskedDialog=>{dialogsToMask.push(notMaskedDialog),notMaskedDialog.mask()}),this.openDialogs.push(dialog),this.notifyDialogOpen(dialog)}handleClosedDialog(dialog){if(!this.isOpen(dialog))return;this.openDialogs=this.openDialogs.filter(openDialog=>openDialog!==dialog);const dialogId=dialog.getId();this.maskedBy.get(dialogId).forEach(maskedDialog=>{maskedDialog.unmask()}),this.maskedBy.delete(dialogId)}getTotalOpen(){return this.openDialogs.length}onDialogOpen(listener){this.dialogOpenListeners.push(listener)}unDialogOpen(listener){this.dialogOpenListeners=this.dialogOpenListeners.filter(curr=>curr!==listener)}isOpen(dialog){return this.openDialogs.some(openDialog=>openDialog===dialog)}notifyDialogOpen(dialog){this.dialogOpenListeners.forEach(listener=>{listener(dialog)})}}class NotificationDialog extends ModalDialog{static{__name(this,"NotificationDialog")}constructor(text2){super({title:i18n("dialog.notification.title"),class:"notification-dialog"}),this.text=text2}doRender(){return super.doRender().then(rendered=>{const notificationEl=new H6El("notification-dialog-text").setHtml(this.text);return this.appendChildToContentPanel(notificationEl),this.addCancelButtonToBottom(i18n("action.ok")),rendered})}}class FormOptionSetOptionView extends FormItemView{static{__name(this,"FormOptionSetOptionView")}constructor(config){super({className:"form-option-set-option-view",context:config.context,formItem:config.formOptionSetOption,parent:config.parent}),this.formItemViews=[],this.selectionChangedListeners=[],this.initElements(config)}initElements(config){this.formOptionSetOption=config.formOptionSetOption,this.isOptionSetExpandedByDefault=config.formOptionSetOption.getParent().isExpanded(),this.formItemState=config.formItemState,this.addClass(this.formOptionSetOption.getPath().getElements().length%2?"even":"odd"),this.formItemLayer=config.layerFactory.createLayer(config),this.notificationDialog=new NotificationDialog(i18n("notify.optionset.notempty"))}toggleHelpText(show){this.formItemLayer.toggleHelpText(show),this.helpText?.toggleHelpText(show)}refresh(){this.formItemViews.forEach(formItemView=>{formItemView.refresh()})}layout(validate=!0){const deferred=Q.defer(),isSingleSelection=this.parent.isSingleSelection();this.formOptionSetOption.getHelpText()&&!isSingleSelection&&(this.helpText=new HelpTextContainer(this.formOptionSetOption.getHelpText()),this.appendChild(this.helpText.getHelpText()),this.toggleHelpText(this.formOptionSetOption.isHelpTextOn()));const isDefaultAndNew=this.formOptionSetOption.isDefaultOption()&&!this.isSelected()&&(this.getContext().getFormState().isNew()||this.formItemState===FormItemState.NEW),optionItemsPropertySet=this.parent.getOrPopulateOptionItemsPropertySet(this.getName());return isDefaultAndNew&&this.parent.handleOptionSelected(this),this.optionItemsContainer=new DivEl("option-items-container"),(this.isOptionSetExpandedByDefault||isSingleSelection||this.isSelected())&&this.appendChild(this.optionItemsContainer),this.formItemLayer.setFormItems(this.formOptionSetOption.getFormItems()).setParentElement(this.optionItemsContainer).setParent(this.getParent()).layout(optionItemsPropertySet,validate&&this.isSelected()).then(formItemViews=>{this.formItemState=FormItemState.EXISTING,this.isSelectedInitially=this.isSelected(),this.updateViewState(),this.formOptionSetOption.getFormItems().length>0&&this.addClass("expandable"),isSingleSelection||this.prependChild(this.makeSelectionCheckbox()),this.formItemViews=formItemViews,this.onValidityChanged(event=>{this.toggleClass("invalid",!event.isValid())}),validate&&this.validate(!0),deferred.resolve(null)}).catch(reason=>{DefaultErrorHandler.handle(reason)}).done(),deferred.promise}clean(){super.clean(),this.isSelected()?this.formItemViews.forEach(view=>view.clean()):this.clear()}clear(){super.clear(),this.formItemViews.forEach(view=>view.clear())}getName(){return this.formOptionSetOption.getName()}reset(){this.isSelectedInitially=this.isSelected(),this.formItemViews.forEach(formItemView=>{formItemView.reset()})}update(parentSet,unchangedOnly){const propertySet=this.parent.getOrPopulateOptionItemsPropertySet(this.getName());return this.formItemLayer.update(propertySet,unchangedOnly).then(()=>{this.isSelectedInitially=this.isSelected(),this.updateViewState(),this.checkbox?.setChecked(this.isSelected(),!0)})}broadcastFormSizeChanged(){this.formItemViews.forEach(formItemView=>{formItemView.broadcastFormSizeChanged()})}displayValidationErrors(value){this.formItemViews.forEach(view=>{view.displayValidationErrors(value)})}setHighlightOnValidityChange(highlight){this.formItemViews.forEach(view=>{view.setHighlightOnValidityChange(highlight)})}hasValidUserInput(){let result=!0;return this.formItemViews.forEach(formItemView=>{formItemView.hasValidUserInput()||(result=!1)}),result}validate(silent=!0){if(!this.isSelected())return this.toggleClass("hide-validation-errors",!0),new ValidationRecording;const recording=new ValidationRecording;this.formItemViews.forEach(formItemView=>{recording.flatten(formItemView.validate(silent))});const hideValidationErrors=recording.isInvalid()&&!this.isSelectedInitially;return recording.setHideValidationErrors(hideValidationErrors),this.toggleClass("hide-validation-errors",hideValidationErrors),recording}hasHelpText(){return!!this.helpText}isEmpty(){return this.formItemViews.every(formItemView=>formItemView.isEmpty())}isExpandable(){return this.formItemViews.length>0}getFormItemViews(){return this.formItemViews}onValidityChanged(listener){this.formItemViews.forEach(formItemView=>{formItemView.onValidityChanged(listener)})}unValidityChanged(listener){this.formItemViews.forEach(formItemView=>{formItemView.unValidityChanged(listener)})}onSelectionChanged(listener){this.selectionChangedListeners.push(listener)}unSelectionChanged(listener){this.selectionChangedListeners.filter(currentListener=>listener===currentListener)}giveFocus(){let focusGiven=!1;if(this.formItemViews.length>0){for(const formItemView of this.formItemViews)if(formItemView.giveFocus()){focusGiven=!0;break}}return focusGiven}onFocus(listener){this.formItemViews.forEach(formItemView=>{formItemView.onFocus(listener)})}unFocus(listener){this.formItemViews.forEach(formItemView=>{formItemView.unFocus(listener)})}onBlur(listener){this.formItemViews.forEach(formItemView=>{formItemView.onBlur(listener)})}unBlur(listener){this.formItemViews.forEach(formItemView=>{formItemView.unBlur(listener)})}isSelected(){return this.parent.isSelected(this.getName())}makeSelectionCheckbox(){const checked=this.isSelected(),labelText=this.formOptionSetOption.getLabel(),button=Checkbox.create().setLabelText(labelText).setTooltip(labelText).setChecked(checked).build();return this.checkbox=button,button.onChange(()=>{button.isChecked()?(this.select(),this.moveFocusToNextElement(button.getFirstChild())):(this.deselectHandle(),this.notifySelectionChanged(!1))}),button}select(){this.checkbox?.setChecked(!0,!0),this.selectHandle(),this.isSelected()||this.notifySelectionChanged(!0)}moveFocusToNextElement(input){const thisElSelector=`div[id='${this.getEl().getId()}']`;FormEl.moveFocusToNextFocusable(input,thisElSelector+" input, "+thisElSelector+" select, "+thisElSelector+" textarea")}updateCheckBoxDisabled(){const checkBoxShouldBeDisabled=!this.isSelected()&&this.isSelectionLimitReached();this.checkbox.isDisabled()!==checkBoxShouldBeDisabled&&this.checkbox.setEnabled(!checkBoxShouldBeDisabled)}enableAndExpand(){this.select(),this.moveFocusToNextElement(this.getChildren()[0])}disableAndCollapse(){this.deselectHandle()}doSelect(){this.expand(),this.enableFormItems(),this.optionItemsContainer.show(),this.addClass("selected")}selectHandle(){this.optionItemsContainer.isRendered()||this.appendChild(this.optionItemsContainer),this.doSelect()}deselectHandle(){this.disableFormItems(),this.isOptionSetExpandedByDefault||(this.collapse(),this.optionItemsContainer.hide()),this.cleanValidationForThisOption(),this.cleanSelectionMessageForThisOption(),this.removeClass("selected"),this.isEmpty()||this.notificationDialog.open()}hasNonDefaultValues(){return this.formItemViews.some(v=>v.hasNonDefaultValues())}hasNonDefaultNumberOfOccurrences(){return this.formItemViews.some(v=>v.hasNonDefaultNumberOfOccurrences())}cleanValidationForThisOption(){const regExp=/-view(\s|$)/;$(this.getEl().getHTMLElement()).find(".invalid").filter(function(){return regExp.test(this.className)}).each((_index,elem)=>{$(elem).removeClass("invalid"),$(elem).find(".validation-viewer ul").html("")}),this.removeClass("invalid")}cleanSelectionMessageForThisOption(){$(this.getEl().getHTMLElement()).find(".selection-message").addClass("empty")}expand(){this.addClass("expanded")}collapse(){this.removeClass("expanded")}enableFormItems(){this.formItemLayer.setEnabled(!0)}disableFormItems(){this.formItemLayer.setEnabled(!1)}isSelectionLimitReached(){return this.getMultiselection().getMaximum()!==0&&this.getMultiselection().getMaximum()<=this.parent.getTotalSelectedOptions()}getMultiselection(){return this.formOptionSetOption.getParent().getMultiselection()}updateViewState(){const isSelected=this.isSelected();this.isOptionSetExpandedByDefault||isSelected?this.expand():this.collapse(),isSelected||(this.isOptionSetExpandedByDefault&&this.disableFormItems(),this.cleanValidationForThisOption()),this.toggleClass("selected",isSelected),this.whenRendered(()=>{this.isSelected()?this.enableFormItems():this.disableFormItems()})}notifySelectionChanged(isSelected){this.selectionChangedListeners.forEach(listener=>listener(isSelected))}setEnabled(enable){this.checkbox&&this.toggleCheckboxState(enable),this.formItemLayer.setEnabled(enable)}toggleCheckboxState(enable){enable?this.isSelectionLimitReached()||this.checkbox.setEnabled(!0):this.checkbox.setEnabled(!1)}}class FormSetView extends FormItemView{static{__name(this,"FormSetView")}constructor(config,classPrefix){super({className:`${classPrefix}-view`,context:config.context,formItem:config.formSet,parent:config.parent}),this.collapseButtons=[],this.validityChangedListeners=[],this.classPrefix="",this.layerFactory=config.layerFactory,this.parentDataSet=config.parentDataSet,this.formSet=config.formSet,this.classPrefix=classPrefix,this.helpText=this.formSet.getHelpText(),this.occurrencesLazyRender=config.occurrencesLazyRender,this.addClass(this.formSet.getPath().getElements().length%2?"even":"odd"),this.formSet.getOccurrences().getMaximum()===1&&this.addClass("max-1-occurrence")}getParent(){return this.parent}createOccurrences(config){return new FormSetOccurrences(config)}initOccurrences(){return this.formItemOccurrences=this.createOccurrences({context:this.getContext(),layerFactory:this.layerFactory,occurrenceViewContainer:this.occurrenceViewsContainer,formSet:this.formSet,parent:this.getParent(),propertyArray:this.getPropertyArray(this.parentDataSet),lazyRender:this.occurrencesLazyRender}),this.formItemOccurrences}layout(validate=!0){const deferred=Q.defer();this.occurrenceViewsContainer=new DivEl("occurrence-views-container"),$(this.occurrenceViewsContainer.getHTMLElement()).sortable({revert:!1,containment:this.getHTMLElement(),cursor:"move",cursorAt:{left:14,top:14},distance:20,tolerance:"pointer",handle:".drag-control",placeholder:this.classPrefix+"-drop-target-placeholder",cancel:".input-type-view.ui-sortable",helper:__name(()=>DragHelper.get().getHTMLElement(),"helper"),start:__name((_event,ui)=>this.handleDnDStart(ui),"start"),update:__name((_event,ui)=>this.handleDnDUpdate(ui),"update"),stop:__name((_event,ui)=>this.handleDnDStop(ui),"stop")});const topCollapseButton=this.makeCollapseButton(),topButtonRow=new DivEl("top-button-row");return topButtonRow.appendChild(topCollapseButton),this.appendChildren(topButtonRow,this.occurrenceViewsContainer),this.initOccurrences().layout(validate).then(()=>{this.header=new FormSetHeader(this.formSet,this.hasHelpText()),this.header.onHelpTextToggled(show=>this.toggleHelpText(show)),this.prependChild(this.header),this.subscribeFormSetOccurrencesOnEvents(),this.toggleHelpText(this.formSet.isHelpTextOn()),this.bottomButtonRow=new DivEl("bottom-button-row"),this.appendChild(this.bottomButtonRow),this.addButton=this.makeAddButton();const bottomCollapseButton=this.makeCollapseButton();this.bottomButtonRow.appendChildren(this.addButton,bottomCollapseButton),this.refreshButtonsState(),validate&&this.validate(!0),this.shouldExpandOccurrences()&&this.toggleOccurrencesVisibility(!0),deferred.resolve(null)}),deferred.promise}shouldExpandOccurrences(){return!!(this.getContext().getFormState().isNew()||this.formItemOccurrences.getOccurrences().length===1)}validate(silent=!0,viewToSkipValidation=null){if(!this.formItemOccurrences)throw new Error("Can't validate before layout is done");const validationRecordingPath=this.resolveValidationRecordingPath(),wholeRecording=new ValidationRecording,occurrenceViews=this.formItemOccurrences.getOccurrenceViews().filter(view=>view!==viewToSkipValidation);let numberOfValids=0;if(occurrenceViews.forEach(occurrenceView=>{let recordingForOccurrence=occurrenceView.validate(silent);recordingForOccurrence.isValid()&&numberOfValids++,wholeRecording.flatten(recordingForOccurrence)}),numberOfValids<this.getOccurrences().getMinimum()&&wholeRecording.breaksMinimumOccurrences(validationRecordingPath),this.getOccurrences().maximumBreached(numberOfValids)&&wholeRecording.breaksMaximumOccurrences(validationRecordingPath),!silent&&wholeRecording.validityChanged(this.previousValidationRecording)){const event=new RecordingValidityChangedEvent(wholeRecording,validationRecordingPath);event.setIncludeChildren(!0),this.notifyValidityChanged(event)}return this.renderValidationErrors(wholeRecording),this.previousValidationRecording=wholeRecording,wholeRecording}refresh(){this.formItemOccurrences.refreshOccurrenceViews()}hasNonDefaultValues(){return this.formItemOccurrences.hasNonDefaultValues()}hasNonDefaultNumberOfOccurrences(){return this.formItemOccurrences.hasNonDefaultNumberOfOccurrences()}isEmpty(){return this.formItemOccurrences.isEmpty()}isExpandable(){return this.formItemOccurrences.isExpandable()}broadcastFormSizeChanged(){this.formItemOccurrences.getOccurrenceViews().forEach(occurrenceView=>{occurrenceView.getFormItemViews().forEach(formItemView=>{formItemView.broadcastFormSizeChanged()})})}update(propertySet,unchangedOnly){this.parentDataSet=propertySet;const propertyArray=this.getPropertyArray(propertySet);return this.formItemOccurrences.update(propertyArray,unchangedOnly)}displayValidationErrors(value){this.formItemOccurrences.getOccurrenceViews().forEach(view=>{view.displayValidationErrors(value)})}setHighlightOnValidityChange(highlight){this.formItemOccurrences.getOccurrenceViews().forEach(view=>{view.setHighlightOnValidityChange(highlight)})}hasValidUserInput(){let result=!0;return this.formItemOccurrences.getOccurrenceViews().forEach(formItemOccurrenceView=>{formItemOccurrenceView.hasValidUserInput()||(result=!1)}),result}onValidityChanged(listener){this.validityChangedListeners.push(listener)}unValidityChanged(listener){this.validityChangedListeners.filter(currentListener=>listener===currentListener)}toggleHelpText(show){this.formItemOccurrences.toggleHelpText(show),this.header.toggleHelpText(show)}hasHelpText(){return!!this.helpText||this.formItemOccurrences.hasHelpText()}giveFocus(){let focusGiven=!1;if(this.formItemOccurrences.getOccurrenceViews().length>0){const views=this.formItemOccurrences.getOccurrenceViews();for(const view of views)if(view.giveFocus()){focusGiven=!0;break}}return focusGiven}clean(){super.clean(),this.formItemOccurrences.clean()}clear(){super.clear(),this.formItemOccurrences.clear()}reset(){this.formItemOccurrences.reset()}setEnabled(enable){this.formItemOccurrences.setEnabled(enable),this.addButton.setEnabled(enable)}onFocus(listener){this.formItemOccurrences.onFocus(listener)}unFocus(listener){this.formItemOccurrences.unFocus(listener)}onBlur(listener){this.formItemOccurrences.onBlur(listener)}unBlur(listener){this.formItemOccurrences.unBlur(listener)}handleFormSetOccurrenceViewValidityChanged(event){if(!this.previousValidationRecording)return;const previousValidState=this.previousValidationRecording.isValid();event.isValid()?this.previousValidationRecording.removeByPath(event.getOrigin(),!0,event.isIncludeChildren()):this.previousValidationRecording.flatten(event.getRecording());const validationRecordingPath=this.resolveValidationRecordingPath(),occurrenceViews=this.formItemOccurrences.getOccurrenceViews(),occurrenceRecording=new ValidationRecording;let numberOfValids=0;occurrenceViews.forEach(occurrenceView=>{const recordingForOccurrence=occurrenceView.getValidationRecording();recordingForOccurrence&&(recordingForOccurrence.isValid()?numberOfValids++:occurrenceRecording.flatten(recordingForOccurrence))}),numberOfValids<this.getOccurrences().getMinimum()?this.previousValidationRecording.breaksMinimumOccurrences(validationRecordingPath):occurrenceRecording.containsPathInBreaksMin(validationRecordingPath)||this.previousValidationRecording.removeUnreachedMinimumOccurrencesByPath(validationRecordingPath,!1),this.getOccurrences().maximumBreached(numberOfValids)?this.previousValidationRecording.breaksMaximumOccurrences(validationRecordingPath):occurrenceRecording.containsPathInBreaksMax(validationRecordingPath)||this.previousValidationRecording.removeBreachedMaximumOccurrencesByPath(validationRecordingPath,!1),this.renderValidationErrors(this.previousValidationRecording),previousValidState!==this.previousValidationRecording.isValid()&&this.notifyValidityChanged(new RecordingValidityChangedEvent(this.previousValidationRecording,validationRecordingPath).setIncludeChildren(!0))}getPropertyArray(propertySet){let propertyArray=propertySet.getPropertyArray(this.formSet.getName());return propertyArray||(propertyArray=PropertyArray.create().setType(ValueTypes.DATA).setName(this.formSet.getName()).setParent(this.parentDataSet).build(),propertySet.addPropertyArray(propertyArray)),propertyArray}notifyValidityChanged(event){this.validityChangedListeners.forEach(listener=>{listener(event)})}renderValidationErrors(recording){recording.isValid()?(this.removeClass("invalid"),this.addClass("valid")):(this.removeClass("valid"),this.addClass("invalid"))}handleDnDStart(ui){const draggedElement=Element.fromHtmlElement(ui.item[0]);assert(draggedElement.hasClass(this.classPrefix+"-occurrence-view")),this.draggingIndex=draggedElement.getSiblingIndex(),DragHelper.get().setDropAllowed(!0),ui.placeholder.text("Drop form item set here")}handleDnDUpdate(ui){if(this.draggingIndex>=0){const draggedElement=Element.fromHtmlElement(ui.item[0]);assert(draggedElement.hasClass(this.classPrefix+"-occurrence-view"));const draggedToIndex=draggedElement.getSiblingIndex();this.formItemOccurrences.moveOccurrence(this.draggingIndex,draggedToIndex),this.formItemOccurrences.refreshOccurence(draggedToIndex)}this.draggingIndex=-1}handleDnDStop(ui){if(this.draggingIndex===-1)return;const draggedElement=Element.fromHtmlElement(ui.item[0]);assert(draggedElement.hasClass(this.classPrefix+"-occurrence-view"));const draggedToIndex=draggedElement.getSiblingIndex();this.formItemOccurrences.refreshOccurence(draggedToIndex)}getOccurrences(){return this.formSet.getOccurrences()}resolveValidationRecordingPath(){return new ValidationRecordingPath(this.parentDataSet.getPropertyPath(),this.formSet.getName(),this.getOccurrences().getMinimum(),this.getOccurrences().getMaximum())}subscribeFormSetOccurrencesOnEvents(){this.formItemOccurrences.onExpandRequested(view=>this.expandOccurrenceView(view)),this.formItemOccurrences.onOccurrenceChanged(view=>this.refreshButtonsState()),this.formItemOccurrences.onOccurrenceRendered(event=>{const occurrenceView=event.getOccurrenceView();this.validate(!1,event.validateViewOnRender()?null:occurrenceView),ObjectHelper.iFrameSafeInstanceOf(occurrenceView,FormSetOccurrenceView)&&this.onFormSetOccurrenceContainerVisibilityToggle(occurrenceView.getContainer())}),this.formItemOccurrences.onOccurrenceAdded(event=>{this.refreshButtonsState(),$(this.occurrenceViewsContainer.getHTMLElement()).sortable("refresh"),ObjectHelper.iFrameSafeInstanceOf(event.getOccurrenceView(),FormSetOccurrenceView)&&event.getOccurrenceView().onValidityChanged(addedEvent=>{this.handleFormSetOccurrenceViewValidityChanged(addedEvent)})}),this.formItemOccurrences.onOccurrenceRemoved(event=>{this.refreshButtonsState(),event.getOccurrenceView().hasClass("form-item-set-occurrence-view")&&this.validate(!1)}),this.formItemOccurrences.getOccurrenceViews().forEach(formSetOccurrenceView=>{formSetOccurrenceView.onValidityChanged(event=>{this.handleFormSetOccurrenceViewValidityChanged(event)}),ObjectHelper.iFrameSafeInstanceOf(formSetOccurrenceView,FormSetOccurrenceView)&&this.onFormSetOccurrenceContainerVisibilityToggle(formSetOccurrenceView.getContainer())})}onFormSetOccurrenceContainerVisibilityToggle(container){container.onShown(event=>{container===event.getTarget()&&this.updateCollapseButtons()}),container.onHidden(event=>{container===event.getTarget()&&this.updateCollapseButtons()})}updateCollapseButtons(){const views=this.formItemOccurrences.getOccurrenceViews(),occurrenceCount=views.length,anyExpandable=occurrenceCount>0&&views.some(view=>view.isExpandable()),isCollapsed=this.formItemOccurrences.isCollapsed(),caption=occurrenceCount>1?i18n(isCollapsed?"button.expandall":"button.collapseall"):i18n(isCollapsed?"button.expand":"button.collapse");this.collapseButtons.forEach(b=>b.setHtml(caption).setVisible(anyExpandable))}makeCollapseButton(){const collapseButton=new AEl("collapse-button");return collapseButton.onClicked(event=>{const isCollapsed=this.formItemOccurrences.isCollapsed();return this.toggleOccurrencesVisibility(isCollapsed),!1}),this.collapseButtons.push(collapseButton),collapseButton}toggleOccurrencesVisibility(value,skipInvalid){this.formItemOccurrences.showOccurrences(value,skipInvalid),this.updateCollapseButtons()}makeAddButton(){const addButton=new Button(i18n("action.add"));return addButton.setTitle(i18n("button.add",this.formSet.getLabel())).onClicked(()=>{this.formItemOccurrences.addNewOccurrence(this.formItemOccurrences.countOccurrences()).then(item=>this.expandOccurrenceView(item))}),addButton}expandRecursively(){this.toggleOccurrencesVisibility(!0),this.formItemOccurrences.getOccurrenceViews().forEach(item=>this.expandOccurrenceView(item))}expandOccurrenceView(item){item.setContainerVisible(!0);const processFormItemView=__name(formItemView=>{formItemView instanceof FormSetView?formItemView.expandRecursively():formItemView instanceof FormOptionSetOptionView&&formItemView.getFormItemViews().forEach(processFormItemView)},"processFormItemView");item.getFormItemViews().forEach(processFormItemView)}refreshButtonsState(){const occurrenceCount=this.formItemOccurrences.getOccurrences().length;this.updateCollapseButtons(),this.addButton.setVisible(!this.formItemOccurrences.maximumOccurrencesReached()),this.toggleClass("multiple-occurrence",occurrenceCount>1)}}class FormItemSetOccurrenceView extends FormSetOccurrenceView{static{__name(this,"FormItemSetOccurrenceView")}constructor(config){super("form-item-set-",config)}getLabelText(){return this.getFirstPropertyValue()||this.getFormSet().getLabel()}getLabelSubTitle(){return this.getFirstPropertyValue()?this.getFormSet().getLabel():""}getFirstPropertyValue(){const formItemNames=this.getFormItems().map(formItem=>formItem.getName()),propArrays=this.propertySet.getPropertyArrays().sort((prop1,prop2)=>formItemNames.indexOf(prop1.getName())-formItemNames.indexOf(prop2.getName())),propValues=[];return propArrays&&propArrays.length>0&&propArrays.some(propArray=>propArray.getName()==="_selected"?!1:(this.fetchPropertyValues(propArray,propValues,!0),propValues.length>0)),propValues.length?propValues.join(", "):""}getFormSet(){return this.formSet}getFormItems(){return this.getFormSet().getFormItems()}}class FormItemSetOccurrences extends FormSetOccurrences{static{__name(this,"FormItemSetOccurrences")}createFormSetOccurrenceView(config){return new FormItemSetOccurrenceView(config)}}class FormItemSetView extends FormSetView{static{__name(this,"FormItemSetView")}constructor(config){super(config,"form-item-set")}createOccurrences(config){return new FormItemSetOccurrences(config)}}var TextInputSize;(function(TextInputSize2){TextInputSize2.MIDDLE="middle",TextInputSize2.LARGE="large"})(TextInputSize||(TextInputSize={}));class TextInput extends InputEl{static{__name(this,"TextInput")}constructor(className,size,originalValue){super("text-input","text",StyleHelper$1.COMMON_PREFIX,originalValue),this.allowedKeyCodes=[8,9,46,39,37],this.autoTrim=!1,className&&this.addClass(className),size&&this.addClassEx(size),this.previousValue=this.getValue(),this.onKeyUp(event=>{KeyHelper.isEscKey(event)&&this.setPreviousValue()}),this.onKeyPressed(event=>{if(!this.stripCharsRe)return null;let symbol=String.fromCharCode(event.charCode);return this.containsForbiddenChars(symbol)&&!this.keyCodeAllowed(event.keyCode)?(event.preventDefault(),!1):null});const updatePreviousValue=__name(()=>{this.previousValue=this.autoTrim?this.updateValue():this.doGetValue()},"updatePreviousValue");this.onFocus(updatePreviousValue),this.onBlur(updatePreviousValue)}static large(className,originalValue){return new TextInput(className,TextInputSize.LARGE,originalValue)}static middle(className,originalValue){return new TextInput(className,TextInputSize.MIDDLE,originalValue)}updateValue(){return this.doSetValue(this.doGetValue()),this.refreshValueChanged(),this.doGetValue()}setAutoTrim(autoTrim){this.autoTrim=autoTrim}setForbiddenCharsRe(re){return this.stripCharsRe=re,this}selectText(from,to){let htmlEl=this.getHTMLElement();if(from?to||(to=this.getValue().length):htmlEl.select(),htmlEl.hasOwnProperty("createTextRange")){let selRange=htmlEl.createTextRange;selRange.collapse(!0),selRange.moveStart("character",from),selRange.moveEnd("character",to),selRange.select()}else htmlEl.setSelectionRange?htmlEl.setSelectionRange(from,to):htmlEl.selectionStart&&(htmlEl.selectionStart=from,htmlEl.selectionEnd=to);htmlEl.focus()}disableAutocomplete(){return this.getEl().setAttribute("autocomplete","off"),this}moveCaretTo(pos){this.selectText(pos,pos)}updateValidationStatusOnUserInput(isValid){this.toggleClass("valid",isValid&&!StringHelper.isEmpty(this.getValue())),this.toggleClass("invalid",!isValid)}setEnabled(enable){super.setEnabled(enable),this.getEl().setDisabled(!enable)}doSetValue(value){let newValue=this.removeForbiddenChars(value);super.doSetValue(newValue)}setPreviousValue(){this.setValue(this.previousValue)}removeForbiddenChars(rawValue=""){const value=this.autoTrim?rawValue.trim():rawValue;return this.stripCharsRe?value.replace(this.stripCharsRe,""):value}containsForbiddenChars(value){return new RegExp(this.stripCharsRe).test(value)}keyCodeAllowed(keyCode){for(const allowedKeyCode of this.allowedKeyCodes)if(keyCode===allowedKeyCode)return!0;return!1}}class OptionFilterInput extends TextInput{static{__name(this,"OptionFilterInput")}constructor(placeholderText){super("option-filter-input"),this.placeholderText=placeholderText||i18n("field.option.placeholder"),this.setPlaceholder(this.placeholderText)}openForTypingAndFocus(){this.openForTyping(),this.getHTMLElement().focus()}openForTyping(){this.setPlaceholder(this.placeholderText),this.getEl().setDisabled(!1)}}var _a;class DropdownHandle extends ButtonEl{static{__name(this,"DropdownHandle")}static{_a=WCAG}static{this.CLASS_DOWN="down"}constructor(){super("dropdown-handle"),this[_a]=!0,this.role=AriaRole.BUTTON,this.tabbable=!0,this.setEnabled(!0),this.up(),this.addClass("icon-arrow_drop_down")}down(){this.addClass(DropdownHandle.CLASS_DOWN)}up(){this.removeClass(DropdownHandle.CLASS_DOWN)}isDown(){return this.hasClass(DropdownHandle.CLASS_DOWN)}toggle(){this.isDown()?this.up():this.down()}isUp(){return!this.isDown()}}var DataChangedType;(function(DataChangedType2){DataChangedType2[DataChangedType2.ADDED=0]="ADDED",DataChangedType2[DataChangedType2.UPDATED=1]="UPDATED",DataChangedType2[DataChangedType2.DELETED=2]="DELETED"})(DataChangedType||(DataChangedType={}));class DataChangedEvent{static{__name(this,"DataChangedEvent")}constructor(dataItems,action){this.items=dataItems,this.type=action}getItems(){return this.items}getType(){return this.type}}class ListBox extends UlEl{static{__name(this,"ListBox")}constructor(className){super(className),this.items=[],this.itemViews=new Map,this.itemsAddedListeners=[],this.itemsRemovedListeners=[],this.itemsChangedListeners=[]}setReadOnly(value){this.toggleClass("readonly",value)}setEmptyText(text2){this.emptyText=text2,this.emptyView&&this.emptyView.setHtml(text2)}setItems(items,silent){this.clearItems(silent),this.items=items;const itemViews=this.layoutList();items.length>0&&!silent&&this.notifyItemsAdded(items,itemViews)}getItems(){return this.items.slice()}getItem(id){return this.items.find(item=>this.getItemId(item)===id)}clearItems(silent){const removedItems=this.items.slice();this.items=[],this.itemViews=new Map,removedItems.length>0&&!silent&&this.notifyItemsRemoved(removedItems),this.removeChildren(),this.showEmptyView()}addItems(toAdd,silent=!1,index=-1){const items=Array.isArray(toAdd)?toAdd:[toAdd];this.doAddItem(!1,items,silent,index)}removeItems(toRemove,silent){const itemsToRemove=Array.isArray(toRemove)?toRemove:[toRemove],itemsRemoved=this.doRemoveItems(itemsToRemove);return itemsRemoved.length>0&&(silent||this.notifyItemsRemoved(itemsRemoved),this.getItemCount()===0&&this.showEmptyView()),itemsRemoved}doRemoveItems(itemsToRemove){const itemsLeft=[],itemsRemoved=[];return this.items.forEach(item=>{const itemId=this.getItemId(item);itemsToRemove.some(itemToRemove=>itemId===this.getItemId(itemToRemove))?(this.removeItemView(item),itemsRemoved.push(item)):itemsLeft.push(item)}),this.items=itemsLeft,itemsRemoved}replaceItems(toReplace,append=!1,silent){const items=Array.isArray(toReplace)?toReplace:[toReplace],indexes=this.items.map(value=>this.getItemId(value));items.forEach(item=>{const index=indexes.indexOf(this.getItemId(item));if(index>-1){append?(this.items.splice(index,1),this.items.unshift(item)):this.items[index]=item;const itemView=this.getItemView(item);itemView&&this.updateItemView(itemView,item)}else append&&this.items.unshift(item)}),silent||this.notifyItemsChanged(items)}getItemCount(){return this.items.length}getItemView(item){return this.itemViews.get(this.getItemId(item))}getItemViews(){return Array.from(this.itemViews.values())}refreshList(){this.removeChildren(),this.layoutList()}findItemIndex(item){const itemId=this.getItemId(item);return this.items.findIndex(it=>this.getItemId(it)===itemId)}onItemsAdded(listener){this.itemsAddedListeners.push(listener)}unItemsAdded(listener){this.itemsAddedListeners=this.itemsAddedListeners.filter(current=>current!==listener)}onItemsRemoved(listener){this.itemsRemovedListeners.push(listener)}unItemsRemoved(listener){this.itemsRemovedListeners=this.itemsRemovedListeners.filter(current=>current!==listener)}onItemsChanged(listener){this.itemsChangedListeners.push(listener)}unItemsChanged(listener){this.itemsChangedListeners=this.itemsChangedListeners.filter(current=>current!==listener)}updateItemView(_itemView,_item){}getIdOfItem(item){return this.getItemId(item)}createEmptyView(text2){const view=new H5El("empty-list-item");return view.setHtml(text2),view}doAddItem(readOnly,items,silent=!1,index=-1){this.getItemCount()===0&&this.removeEmptyView(),index>-1?this.items.splice(index,0,...items):this.items=this.items.concat(items);const itemViews=items.map(item=>this.addItemView(item,readOnly,index));items.length>0&&!silent&&this.notifyItemsAdded(items,itemViews)}layoutList(){return this.items.length>0?(this.removeEmptyView(),this.items.map(item=>this.addItemView(item))):(this.showEmptyView(),[])}removeItemView(item){const id=this.getItemId(item),itemView=this.itemViews.get(id);itemView&&(this.removeChild(itemView),this.itemViews.delete(id))}addItemView(item,readOnly=!1,index=-1){const itemView=this.createItemView(item,readOnly);return this.itemViews.set(this.getItemId(item),itemView),this.insertItemView(itemView,index),itemView}insertItemView(itemView,index=-1){index>-1?this.insertChild(itemView,index):this.appendChild(itemView)}showEmptyView(){this.emptyText&&(this.emptyView||(this.emptyView=this.createEmptyView(this.emptyText)),this.hasChild(this.emptyView)||this.appendChild(this.emptyView))}removeEmptyView(){this.emptyView&&this.removeChild(this.emptyView)}notifyItemsAdded(items,itemViews){this.itemsAddedListeners.forEach(listener=>{listener(items,itemViews)})}notifyItemsRemoved(items){this.itemsRemovedListeners.forEach(listener=>{listener(items)})}notifyItemsChanged(items){this.itemsChangedListeners.forEach(listener=>{listener(items)})}}class LazyListBox extends ListBox{static{__name(this,"LazyListBox")}initIntersectionObserver(){this.observer=new IntersectionObserver(entries2=>{entries2.forEach(entry=>{entry.isIntersecting&&this.handleLastItemIsVisible()})},this.initObserverOptions())}initObserverOptions(){return{root:this.getScrollContainer().getHTMLElement(),rootMargin:this.getRootMargin(),threshold:this.getThreshold()}}getRootMargin(){return"100px"}getThreshold(){return 0}getScrollContainer(){return this.getScrollableParent()}handleLastItemIsVisible(){this.observer.unobserve(this.observedItem.getHTMLElement()),this.handleLazyLoad()}handleLazyLoad(){}setItems(items,silent){super.setItems(items,silent),items.length>0&&this.addLazyLoad()}addItems(toAdd,silent=!1,index=-1){const items=Array.isArray(toAdd)?toAdd:[toAdd];if(items.length>0){const isInsert=index>-1&&index<this.getItemCount();super.addItems(items,silent,index),isInsert||this.addLazyLoad()}}addLazyLoad(){const lastVisibleChild=this.getLastVisibleChild();lastVisibleChild&&(this.observer||this.initIntersectionObserver(),this.addLazyLoadWhenLastIsVisible(lastVisibleChild))}getLastVisibleChild(){return this.isVisible()?[...this.getChildren()].reverse().find(item=>item.isVisible()):void 0}addLazyLoadWhenLastIsVisible(itemView){this.observedItem!==itemView&&(this.observedItem&&this.observer.unobserve(this.observedItem.getHTMLElement()),this.observedItem=itemView,this.observer.observe(itemView.getHTMLElement()))}}class TreeListBox extends LazyListBox{static{__name(this,"TreeListBox")}constructor(params){super("tree-list "+(params?.className||"")),this.options=params||{},this.initElements(),this.initListeners()}initElements(){this.scrollParent=this.options?.scrollParent||this}initListeners(){}updateItemView(itemView,item){itemView.setItem(item)}addItemView(item,readOnly=!1,index=-1){const itemView=super.addItemView(item,readOnly,index);return itemView.onItemsAdded((items,itemViews)=>this.notifyItemsAdded(items,itemViews)),itemView.onItemsRemoved(items=>this.notifyItemsRemoved(items)),itemView.onItemsChanged(items=>this.notifyItemsChanged(items)),itemView}getItemView(item){return super.getItemView(item)||this.findItemView(item)}findItemView(item){let result=null;return this.itemViews.forEach(itemView=>{const value=itemView.findItemView(item);value&&(result=value)}),result}getItem(id){return super.getItem(id)||this.findItem(id)}load(){this.handleLazyLoad()}findItem(id){let result=null;return this.itemViews.forEach(itemView=>{const item=itemView.findItem(id);item&&(result=item)}),result}getItems(deep){return deep?this.getAllItems():super.getItems()}getAllItems(){const items=super.getItems();return this.itemViews.forEach(itemView=>{items.push(...itemView.getItems(!0))}),items}getDataView(item){return this.getItemView(item)?.getDataView()}getParentList(){return this.getParentListElement()?.getParentList()}getParentItem(){return this.getParentListElement()?.getItem()}getParentListElement(){return this.options.parentListElement}getScrollContainer(){return this.scrollParent}getLevel(){const parent2=this.getParentList();return parent2?parent2.getLevel()+1:0}doRender(){return super.doRender().then(rendered=>{const level=this.getLevel();return level===0&&ResponsiveManager.onAvailableSizeChanged(this),this.getEl().setData("level",level.toString()),rendered})}}var SelectionMode;(function(SelectionMode2){SelectionMode2[SelectionMode2.SELECT=0]="SELECT",SelectionMode2[SelectionMode2.HIGHLIGHT=1]="HIGHLIGHT"})(SelectionMode||(SelectionMode={}));class SelectableListBoxWrapper extends DivEl{static{__name(this,"SelectableListBoxWrapper")}static{this.LIMIT_REACHED_CLASS="selection-limit-reached"}constructor(listBox,options){super("selectable-listbox-wrapper "+(options?.className||"")),this.selectedItems=new Map,this.selectionMode=SelectionMode.SELECT,this.itemsWrappers=new Map,this.selectionLimitReached=!1,this.skipNextClick=!1,this.isSkipNextClickEnabled=!1,this.listBox=listBox,this.options=options||{},this.initElements(),this.initListeners()}initElements(){this.selectionChangedListeners=[]}initListeners(){this.addListBoxListeners(),this.onMouseDown(()=>{this.isSkipNextClickEnabled&&!this.getHTMLElement().contains(document.activeElement)&&(this.skipNextClick=!0)})}addListBoxListeners(){this.listBox.onItemsAdded((items,itemViews)=>{items.forEach((item,index)=>this.handleItemAdded(item,itemViews[index]))}),this.listBox.onItemsRemoved(items=>{this.handleItemsRemoved(items)}),this.listBox.onItemsChanged(items=>{items.forEach(item=>this.handleItemUpdated(item))})}handleItemAdded(item,itemView){const view=this.listBox instanceof TreeListBox?itemView.getDataView():itemView,wrapper=this.listBox instanceof TreeListBox?new DivEl("item-view-wrapper"):new LiEl("item-view-wrapper"),id=this.listBox.getIdOfItem(item);this.addItemWrapper(id,wrapper),view.replaceWith(wrapper),view.addClass("item-view"),this.isMultiSelect()&&(wrapper.appendChild(this.createCheckbox(item)),wrapper.addClass(this.options.checkboxPosition==="left"?"checkbox-left":"checkbox-right"));const clickHandler=__name(event=>{this.isIntractableViewElement(event.target)&&(this.options.highlightMode&&(event.ctrlKey||event.metaKey?(this.selectionMode===SelectionMode.HIGHLIGHT&&this.deselectAll(),this.selectionMode=SelectionMode.SELECT):event.shiftKey?this.selectedItems.size===0?this.selectionMode=SelectionMode.SELECT:this.selectedItems.size===1&&this.isSelected(id)||(this.selectionMode=SelectionMode.SELECT,this.selectItemsBetweenHandler?.(this.getSelectedItems().pop(),item),this.deselect(item,!0)):(this.selectionMode===SelectionMode.SELECT&&this.deselectAll(),this.selectionMode=SelectionMode.HIGHLIGHT)),this.handleUserToggleAction(item))},"clickHandler");wrapper.onClicked(event=>{if(event.detail===2){event.stopPropagation(),event.preventDefault(),this.skipNextClick=!1;return}this.skipNextClick&&(this.skipNextClick=!1,this.isSelected(id))||clickHandler(event)}),wrapper.onContextMenu(event=>{this.isSelected(id)||clickHandler(event)}),wrapper.onMouseDown(event=>{event.shiftKey&&event.preventDefault()}),this.isSelected(id)&&this.toggleItemWrapperSelected(id,!0),wrapper.appendChild(view)}addItemWrapper(id,wrapper){wrapper.setRole(AriaRole.OPTION);const idWrappersList=this.itemsWrappers.get(id)||[];idWrappersList.push(wrapper),this.itemsWrappers.set(id,idWrappersList)}handleUserToggleAction(item){const itemId=this.listBox.getIdOfItem(item),actualItem=this.listBox.getItem(itemId)||item;this.unSelectOtherItems(itemId),this.isSelected(itemId)?this.handleUserDeselected(actualItem):this.handleUserSelected(actualItem)}unSelectOtherItems(itemId){(!this.isMultiSelect()||this.selectionMode===SelectionMode.HIGHLIGHT)&&this.getCurrentlySelectedItems().filter(selectedItem=>this.listBox.getIdOfItem(selectedItem)!==itemId).forEach(selectedItem=>{this.handleUserDeselected(selectedItem)})}getCurrentlySelectedItems(){return Array.from(this.selectedItems.values())}getSelectedItems(){return Array.from(this.selectedItems.values())}getSelectionMode(){return this.selectionMode}setSelectionMode(selectionMode){this.selectionMode=selectionMode}handleUserDeselected(item){this.deselect(item)}handleUserSelected(item){this.select(item)}handleItemsRemoved(items){items.forEach(item=>this.handleItemRemoved(item))}handleItemRemoved(item){const id=this.listBox.getIdOfItem(item);this.itemsWrappers.get(id)?.forEach(wrapper=>wrapper.remove()),this.itemsWrappers.delete(id)}toggleItemWrapperSelected(itemId,isSelected){this.itemsWrappers.get(itemId)?.forEach(itemWrapper=>{if(itemWrapper?.toggleClass("selected",isSelected),isSelected?itemWrapper?.setAriaSelected():itemWrapper?.removeAriaSelected(),this.isMultiSelect()){const isToBeChecked=isSelected&&this.selectionMode===SelectionMode.SELECT;itemWrapper.toggleClass("checked",isToBeChecked),itemWrapper?.getFirstChild()?.setChecked(isToBeChecked,!0)}})}createCheckbox(item){const checkbox=Checkbox.create().build();return checkbox.onClicked(event=>{this.selectionMode==SelectionMode.HIGHLIGHT&&this.deselectAll(!0),this.selectionMode=SelectionMode.SELECT,event.stopPropagation()}),checkbox.onValueChanged(()=>{this.handleUserToggleAction(item)}),checkbox}isItemSelected(item){const id=this.listBox.getIdOfItem(item);return this.isSelected(id)}isSelected(id){return this.selectedItems.has(id)}isIntractableViewElement(element){return!element?.classList.contains("icon-arrow_drop_up")}doRender(){return super.doRender().then(rendered=>(this.listBox.addClass("selectable-listbox"),this.appendChild(this.listBox),rendered))}select(item,silent){if(!item||Array.isArray(item)&&item.length===0)return;const items=Array.isArray(item)?item:[item];items.forEach(itemToSelect=>{this.doSelect(itemToSelect)}),silent||this.notifySelectionChanged({selected:items})}doSelect(itemToSelect){const id=this.listBox.getIdOfItem(itemToSelect);id&&(this.selectedItems.set(id,itemToSelect),this.toggleItemWrapperSelected(id,!0),this.checkSelectionLimitReached())}deselect(item,silent){if(!item||Array.isArray(item)&&item.length===0)return;const items=Array.isArray(item)?item:[item];items.forEach(itemToDeselect=>{this.doDeselect(itemToDeselect)}),silent||this.notifySelectionChanged({deselected:items})}selectAll(silent){this.select(this.listBox instanceof TreeListBox?this.listBox.getItems(!0):this.listBox.getItems(),silent)}setSkipFirstClickOnFocus(enabled){this.isSkipNextClickEnabled=enabled}doDeselect(itemToDeselect){const id=this.listBox.getIdOfItem(itemToDeselect);id&&(this.selectedItems.delete(id),this.toggleItemWrapperSelected(id,!1),this.checkSelectionLimitReached())}deselectAll(silent){this.deselect(this.getCurrentlySelectedItems(),silent)}updateItem(item){this.listBox.replaceItems(item)}getTotalItems(){return this.listBox instanceof TreeListBox?this.listBox.getItems(!0).length:this.listBox.getItems().length}checkSelectionLimitReached(){const isMaxOccurrencesReached=this.maximumOccurrencesReached();this.selectionLimitReached&&!isMaxOccurrencesReached?(this.selectionLimitReached=!1,this.handleSelectionLimitIsNoLongerReached()):!this.selectionLimitReached&&isMaxOccurrencesReached&&(this.selectionLimitReached=!0,this.handleSelectionLimitReached())}maximumOccurrencesReached(){return this.options.maxSelected===0?!1:this.options.maxSelected>0&&this.selectedItems.size>=this.options.maxSelected}handleSelectionLimitReached(){this.toggleClass(SelectableListBoxWrapper.LIMIT_REACHED_CLASS,!0)}handleSelectionLimitIsNoLongerReached(){this.toggleClass(SelectableListBoxWrapper.LIMIT_REACHED_CLASS,!1)}onSelectionChanged(listener){this.selectionChangedListeners.push(listener)}unSelectionChanged(listener){this.selectionChangedListeners=this.selectionChangedListeners.filter(currentListener=>currentListener!==listener)}notifySelectionChanged(selectionChange){this.selectionChangedListeners.forEach(listener=>listener(selectionChange))}isMultiSelect(){return this.options.maxSelected===0||this.options.maxSelected>1}onDataChanged(handler){this.listBox.onItemsAdded(items=>{handler(new DataChangedEvent(items,DataChangedType.ADDED))}),this.listBox.onItemsRemoved(items=>{handler(new DataChangedEvent(items,DataChangedType.DELETED))}),this.listBox.onItemsChanged(items=>{handler(new DataChangedEvent(items,DataChangedType.UPDATED))})}getList(){return this.listBox}handleItemUpdated(item){this.updateItemIfSelected(item)}updateItemIfSelected(item){const itemId=this.listBox.getIdOfItem(item);this.selectedItems.has(itemId)&&this.selectedItems.set(itemId,item)}setSelectAllItemsBetweenHandler(handler){this.selectItemsBetweenHandler=handler}hasHighlightMode(){return this.options.highlightMode}}class SelectableListBoxNavigator{static{__name(this,"SelectableListBoxNavigator")}constructor(listBox,itemsWrappers){this.itemsWrappers=new Map,this.listBox=listBox,this.itemsWrappers=itemsWrappers,this.addKeyboardNavigation()}getFocusedView(){let focusedView=null;return this.itemsWrappers.forEach((itemWrappers,key)=>{itemWrappers.forEach(itemWrapper=>{itemWrapper.getHTMLElement()===document.activeElement&&(focusedView=itemWrapper)})}),focusedView}addTabIndexesToWrappers(){this.itemsWrappers.forEach((itemWrappers,key)=>{itemWrappers.forEach(itemWrapper=>{itemWrapper.setTabIndex(0)})})}removeTabIndexesFromWrappers(){this.itemsWrappers.forEach((itemWrappers,key)=>{itemWrappers.forEach(itemWrapper=>{itemWrapper.getEl().removeAttribute("tabindex")})})}addKeyboardNavigation(){this.isShowListBoxEvent=!1;const navigationKeyBindings=[new KeyBinding("esc").setGlobal(!0).setCallback(e=>this.clickOutsideHandler?this.clickOutsideHandler(e):!0),new KeyBinding("up").setGlobal(!0).setCallback(e=>this.upKeyHandler?this.upKeyHandler(e):this.handleUpKeyDefault(e)),new KeyBinding("down").setGlobal(!0).setCallback(e=>this.downKeyHandler?this.downKeyHandler(e):this.handleDownKeyDefault(e)),new KeyBinding("enter").setGlobal(!0).setCallback(e=>this.enterKeyHandler?this.enterKeyHandler(e):!0),new KeyBinding("space").setGlobal(!0).setCallback(e=>this.spaceKeyHandler?this.spaceKeyHandler(e):!0),new KeyBinding("left").setGlobal(!0).setCallback(e=>this.leftKeyHandler?this.leftKeyHandler(e):!0),new KeyBinding("right").setGlobal(!0).setCallback(e=>this.rightKeyHandler?this.rightKeyHandler(e):!0)];this.listBox.onShown(()=>{this.isShowListBoxEvent=!0,this.keysBound||(KeyBindings.get().shelveBindings(),KeyBindings.get().bindKeys(navigationKeyBindings),this.addTabIndexesToWrappers()),this.keysBound=!0,setTimeout(()=>{this.isShowListBoxEvent=!1},1)}),this.listBox.onHidden(()=>{this.keysBound&&(KeyBindings.get().unbindKeys(navigationKeyBindings),KeyBindings.get().unshelveBindings(),this.removeTabIndexesFromWrappers()),this.keysBound=!1})}getFocusedItem(){let focusedItem=null;return this.itemsWrappers.forEach((itemWrappers,key)=>{itemWrappers.forEach(itemWrapper=>{itemWrapper.getHTMLElement()===document.activeElement&&(focusedItem=this.listBox.getItem(key))})}),focusedItem}handleDownKeyDefault(e){if(!this.isShowListBoxEvent){const focusedView=this.getFocusedView();if(focusedView){const tabbable2=this.listBox.getTabbableElements().map(tabbable3=>tabbable3.getHTMLElement()),index=tabbable2.indexOf(focusedView.getHTMLElement());if(index>=0){const next=tabbable2[index+1];next?next?.focus():tabbable2[0]?.focus()}}else this.listBox.getTabbableElements()[0]?.getHTMLElement().focus()}return!1}handleUpKeyDefault(e){e.stopPropagation();const focusedView=this.getFocusedView();if(focusedView){const tabbable2=this.listBox.getTabbableElements().map(tabbable3=>tabbable3.getHTMLElement()),index=tabbable2.indexOf(focusedView.getHTMLElement());index>=0&&(index===0?tabbable2[tabbable2.length-1]?.focus():tabbable2[index-1]?.focus())}return!1}notifyItemWrapperAdded(itemWrapper){this.keysBound&&itemWrapper.setTabIndex(0)}setClickOutsideHandler(handler){return this.clickOutsideHandler=handler,this}setEnterKeyHandler(handler){return this.enterKeyHandler=handler,this}setLeftKeyHandler(handler){return this.leftKeyHandler=handler,this}setRightKeyHandler(handler){return this.rightKeyHandler=handler,this}setSpaceHandler(handler){return this.spaceKeyHandler=handler,this}setKeyDownHandler(handler){return this.downKeyHandler=handler,this}setKeyUpHandler(handler){return this.upKeyHandler=handler,this}}class FilterableListBoxWrapper extends SelectableListBoxWrapper{static{__name(this,"FilterableListBoxWrapper")}constructor(listBox,options){super(listBox,options),this.selectionDelta=new Map,this.dropdownShown=!1,this.applyWCAGAttributes({role:AriaRole.COMBOBOX,ariaHasPopup:AriaHasPopup.LISTBOX,ariaExpanded:!1})}initElements(){super.initElements(),this.loadWhenListShown=this.options.loadWhenListShown??!0,this.loadMask=new LoadMask(this),this.listBox.applyWCAGAttributes({role:AriaRole.LISTBOX,ariaHidden:!0}),this.listBox.hide(),this.filterContainer=new DivEl("filter-container"),this.filterAndListContainer=new DivEl("filter-and-list-container"),this.dropdownVisibilityChangedListeners=[],this.optionFilterInput=new OptionFilterInput,this.dropdownHandle=new DropdownHandle,this.applyButton=new Button(i18n("action.apply")),this.applyButton.hide(),this.handleEmptyList()}handleEmptyList(){this.listBox.setEmptyText(i18n("field.option.noitems"))}initListeners(){super.initListeners(),this.listBox.onShown(()=>{this.selectionDelta=new Map,this.setAriaExpanded(!0),this.listBox.setAriaHidden(!1)}),this.listBox.onHidden(()=>{this.resetSelection(),this.selectionDelta=new Map,this.setAriaExpanded(!1),this.listBox.setAriaHidden(!0)}),this.applyButton.onClicked(this.applySelection.bind(this)),this.dropdownHandle.onClicked(()=>{this.handleDropdownHandleClicked()}),this.optionFilterInput.onValueChanged(event=>{this.handleValueChange(event)}),this.optionFilterInput.onKeyDown(event=>{this.handleKeyDown(event)}),this.listenClickOutside(),this.addKeyNavigation()}showDropdown(){this.dropdownHandle.down(),this.dropdownShown=!0,this.doShowDropdown(),this.notifyDropdownVisibilityChanged(!0)}doShowDropdown(){this.filterAndListContainer.hasChild(this.listBox)||this.attachListBoxOnShown(),this.listBox.show(),this.loadWhenListShown&&(this.loadListOnShown(),this.loadWhenListShown=!1)}attachListBoxOnShown(){this.filterAndListContainer.appendChild(this.listBox)}loadListOnShown(){}hideDropdown(){this.dropdownHandle.up(),this.applyButton.hide(),this.dropdownShown=!1,this.doHideDropdown(),this.notifyDropdownVisibilityChanged(!1)}doHideDropdown(){this.listBox.hide(),this.listBox.remove()}listenClickOutside(){const mouseClickListener=__name(event=>{for(let element=event.target;element;element=element.parentNode)if(element===this.getHTMLElement())return;this.hideDropdown()},"mouseClickListener");this.onDropdownVisibilityChanged(isVisible=>{isVisible?Body.get().onMouseDown(mouseClickListener):Body.get().unMouseDown(mouseClickListener)})}resetSelection(){this.selectionDelta.forEach((value,id)=>{this.toggleItemWrapperSelected(id,!value.selected)}),this.selectionDelta=new Map}handleValueChange(event){this.showDropdown(),this.options.filter&&this.filterItems(event.getNewValue())}handleDropdownHandleClicked(){this.dropdownHandle.toggle(),this.dropdownHandle.isDown()?this.showDropdown():this.hideDropdown()}filterItems(searchString){this.listBox.getItems().forEach(item=>{this.filterItem(item,searchString)});let visible=0;this.itemsWrappers.forEach(itemWrappers=>{itemWrappers.some(itemWrapper=>itemWrapper.isVisible())&&visible++}),visible>0?this.listBox.removeEmptyView():this.listBox.showEmptyView()}filterItem(item,searchString){this.itemsWrappers.get(this.listBox.getIdOfItem(item))?.forEach(itemView=>itemView.setVisible(this.options.filter(item,searchString)))}handleKeyDown(event){!this.dropdownShown&&KeyHelper.isArrowDownKey(event)&&this.showDropdown()}handlerEnterPressed(){if(this.applyButton.hasFocus())return this.applySelection(),!0;const focusedItem=this.selectionNavigator?.getFocusedItem();return focusedItem&&(this.selectionDelta.size===0&&this.handleUserToggleAction(focusedItem),this.selectionDelta.size!==0&&this.applySelection()),!0}handleClickOutside(){return this.hideDropdown(),!0}handleUserSelected(item){const id=this.listBox.getIdOfItem(item);this.toggleItemWrapperSelected(id,!0),super.isSelected(id)?this.selectionDelta.delete(id):this.selectionDelta.set(id,{item,selected:!0}),this.isMultiSelect()?this.applyButton.setVisible(this.selectionDelta.size>0):this.applySelection()}handleUserDeselected(item){const id=this.listBox.getIdOfItem(item);this.toggleItemWrapperSelected(id,!1),super.isSelected(id)?this.selectionDelta.set(id,{item,selected:!1}):this.selectionDelta.delete(id),this.applyButton.setVisible(this.selectionDelta.size>0)}isSelected(id){return this.selectionDelta.has(id)?this.selectionDelta.get(id).selected:super.isSelected(id)}getCurrentlySelectedItems(){return super.getCurrentlySelectedItems().filter(savedItem=>this.isItemSelected(savedItem)).concat(this.getSelectedDeltaItems())||[]}getSelectedDeltaItems(){const result=[];return this.selectionDelta.forEach(value=>{value.selected&&result.push(value.item)}),result}applySelection(){const selectionChange={selected:[],deselected:[]};this.selectionDelta.forEach(value=>{value.selected||(selectionChange.deselected.push(value.item),this.doDeselect(value.item))}),this.selectionDelta.forEach((value,id)=>{value.selected&&(this.selectionLimitReached?this.toggleItemWrapperSelected(id,!1):(selectionChange.selected.push(value.item),this.doSelect(value.item)))}),this.selectionDelta=new Map,this.doHideDropdown(),this.dropdownHandle.up(),Array.from(this.itemsWrappers.values()).forEach(itemWrappers=>itemWrappers.forEach(itemWrapper=>itemWrapper.setVisible(!0))),(selectionChange.selected.length>0||selectionChange.deselected.length>0)&&this.notifySelectionChanged(selectionChange),this.applyButton.hide()}getItemById(id){return this.listBox.getItem(id)}setLoadWhenListShown(){this.dropdownShown?this.loadListOnShown():this.loadWhenListShown=!0}doRender(){return super.doRender().then(rendered=>(this.addClass("filterable-listbox-wrapper"),this.listBox.addClass("filterable-listbox"),this.filterContainer.appendChildren(this.optionFilterInput,this.dropdownHandle),this.filterAndListContainer.appendChildren(this.filterContainer,this.listBox),this.appendChild(this.filterAndListContainer),this.applyButton.addClass("apply-selection-button"),this.applyButton.insertAfterEl(this.optionFilterInput),rendered))}setEnabled(enable){this.optionFilterInput.setEnabled(enable),this.dropdownHandle.setEnabled(enable)}cleanInput(){this.optionFilterInput.clear()}onFocus(listener){this.optionFilterInput.onFocus(listener)}unFocus(listener){this.optionFilterInput.unFocus(listener)}onBlur(listener){this.optionFilterInput.onBlur(listener)}unBlur(listener){this.optionFilterInput.unBlur(listener)}giveFocus(){return this.optionFilterInput.giveFocus()}notifyDropdownVisibilityChanged(isVisible){this.dropdownVisibilityChangedListeners.forEach(listener=>{listener(isVisible)})}onDropdownVisibilityChanged(listener){this.dropdownVisibilityChangedListeners.push(listener)}unDropdownVisibilityChanged(listener){this.dropdownVisibilityChangedListeners=this.dropdownVisibilityChangedListeners.filter(currentListener=>currentListener!==listener)}isDropdownShown(){return this.dropdownShown}createSelectionNavigator(){return new SelectableListBoxNavigator(this.listBox,this.itemsWrappers).setClickOutsideHandler(this.handleClickOutside.bind(this)).setEnterKeyHandler(this.handlerEnterPressed.bind(this)).setSpaceHandler(this.handleSpacePressed.bind(this))}addKeyNavigation(){this.selectionNavigator=this.createSelectionNavigator()}addItemWrapper(id,wrapper){super.addItemWrapper(id,wrapper),this.selectionNavigator?.notifyItemWrapperAdded(wrapper)}handleSpacePressed(){const focusedItem=this.selectionNavigator.getFocusedItem();return focusedItem?(this.handleUserToggleAction(focusedItem),!1):!0}}class OptionSetArrayHelper{static{__name(this,"OptionSetArrayHelper")}constructor(propertyArray){this.propertyArray=propertyArray}add(name,isSingleSelection){isSingleSelection?this.overwriteOrAddNew(name):this.addNewAndSort(name)}overwriteOrAddNew(name){const value=new Value(name,new ValueTypeString),existingProperty=this.propertyArray.get(0);existingProperty?existingProperty.setValue(value):this.propertyArray.set(0,value)}addNewAndSort(name){const value=new Value(name,new ValueTypeString);this.propertyArray.containsValue(value)||(this.propertyArray.add(value),this.propertyArray.getSize()>1&&this.sortByName())}sortByName(){this.propertyArray.getProperties().sort((a,b)=>a.getValue().getString().localeCompare(b.getValue().getString())).forEach((sortedProperty,to)=>{this.propertyArray.some((existingProperty,from)=>sortedProperty.equals(existingProperty)?(from!==to&&this.propertyArray.move(from,to),!0):!1)})}remove(name){const selectionArrayPropertyToRemove=this.getPropertyByName(name);selectionArrayPropertyToRemove&&this.propertyArray.remove(selectionArrayPropertyToRemove.getIndex())}getPropertyByName(name){let result=null;return this.propertyArray?.forEach(property=>{property.getString()===name&&(result=property)}),result}}class FormOptionSetOccurrenceView extends FormSetOccurrenceView{static{__name(this,"FormOptionSetOccurrenceView")}static{this.SELECTED_NAME="_selected"}constructor(config){super("form-option-set-",config),this.stashedPropertySets=new Map}initElements(){super.initElements(),this.selectionValidationMessage=new DivEl("selection-message"),this.formOptionsByNameMap=new Map(this.getFormItems().filter(formItem=>formItem instanceof FormOptionSetOption).map((formItem,index)=>[formItem.getName(),{label:formItem.getLabel(),index}])),this.checkboxEnabledStatusHandler=(()=>{this.formItemViews.forEach(formItemView=>formItemView.updateCheckBoxDisabled())})}clean(){super.clean();const selectedOptionsArray=this.getSelectedOptionsArray();(!selectedOptionsArray||selectedOptionsArray.isEmpty())&&this.propertySet.removeAllProperties()}subscribeOnItemEvents(){super.subscribeOnItemEvents(),this.formItemViews.forEach(formItemView=>{formItemView.onSelectionChanged(isSelected=>this.handleSelectionChanged(formItemView,isSelected))})}postLayout(validate=!0){super.postLayout(validate),this.removeNotSelectedEntriesFromPropertySet(),this.isSingleSelection()||this.checkboxEnabledStatusHandler(),this.subscribeOnSelectedOptionsArray()}removeNotSelectedEntriesFromPropertySet(){this.formItemViews.forEach(formItemView=>{this.isSelected(formItemView.getName())||this.handleOptionDeselected(formItemView)})}update(dataSet,unchangedOnly){return this.stashedPropertySets.clear(),super.update(dataSet,unchangedOnly).then(()=>(this.removeNotSelectedEntriesFromPropertySet(),Q.resolve()))}updatePropertySet(dataSet){this.unSubscribeOnSelectedOptionsArray(),super.updatePropertySet(dataSet),this.subscribeOnSelectedOptionsArray()}ensureSelectionArrayExists(){this.getSelectedOptionsArray()||(this.stashedPropertySets.has(FormOptionSetOccurrenceView.SELECTED_NAME)?this.propertySet.addPropertyArray(this.stashedPropertySets.get(FormOptionSetOccurrenceView.SELECTED_NAME)):(this.createSelectionArray(),this.subscribeOnSelectedOptionsArray()))}createSelectionArray(){const selectionPropertyArray=PropertyArray.create().setType(ValueTypes.STRING).setName(FormOptionSetOccurrenceView.SELECTED_NAME).setParent(this.propertySet).build();this.propertySet.addPropertyArray(selectionPropertyArray)}getSelectedOptionsArray(){return this.propertySet?.getPropertyArray(FormOptionSetOccurrenceView.SELECTED_NAME)}extraValidation(validationRecording){const multiSelectionState=this.validateMultiSelection();validationRecording.flatten(multiSelectionState),this.renderSelectionValidationMessage(multiSelectionState)}getFormSet(){return this.formSet}getFormItems(){return this.getFormSet().getFormItems()}getSortedSelectedOptionsArrayProperties(){const selectionArray=this.getSelectedOptionsArray();return selectionArray?selectionArray.getProperties().sort((one,two)=>this.formOptionsByNameMap.get(one.getString())?.index-this.formOptionsByNameMap.get(two.getString())?.index):[]}getLabelSubTitle(){let selectedLabels=[];return this.getSortedSelectedOptionsArrayProperties().some(selectedProp=>{const selectedOptionArray=this.propertySet?.getPropertyArray(selectedProp.getString());return selectedOptionArray&&!selectedOptionArray.isEmpty()&&this.fetchPropertyValues(selectedOptionArray,selectedLabels,!0),selectedLabels.length>0}),selectedLabels.length?selectedLabels.join(", "):""}getLabelText(){const selectedLabels=this.getSortedSelectedOptionsArrayProperties().map(selectedProp=>this.formOptionsByNameMap.get(selectedProp.getString())?.label).filter(label=>!!label);return selectedLabels.length?selectedLabels.join(", "):this.getFormSet().getLabel()}renderSelectionValidationMessage(selectionValidationRecording){if(selectionValidationRecording.isValid())this.selectionValidationMessage.addClass("empty");else{let selection=this.getFormSet().getMultiselection(),message;selectionValidationRecording.isMinimumOccurrencesValid()||(selection.getMinimum()===1?message=i18n("field.optionset.breaks.min.one"):selection.getMinimum()>1&&(message=i18n("field.optionset.breaks.min.many",selection.getMinimum()))),selectionValidationRecording.isMaximumOccurrencesValid()||(selection.getMaximum()===1?message=i18n("field.optionset.breaks.max.one"):selection.getMaximum()>1&&(message=i18n("field.optionset.breaks.max.many",selection.getMaximum()))),message&&(this.selectionValidationMessage.setHtml(message),this.selectionValidationMessage.removeClass("empty"))}}validateMultiSelection(){const multiSelectionRecording=new ValidationRecording,validationRecordingPath=this.resolveValidationRecordingPath(),totalSelected=this.getTotalSelectedOptions();return totalSelected<this.getFormSet().getMultiselection().getMinimum()&&multiSelectionRecording.breaksMinimumOccurrences(validationRecordingPath),this.getFormSet().getMultiselection().maximumBreached(totalSelected)&&multiSelectionRecording.breaksMaximumOccurrences(validationRecordingPath),this.currentValidationState&&(totalSelected<this.getFormSet().getMultiselection().getMinimum()?this.currentValidationState.breaksMinimumOccurrences(validationRecordingPath):this.currentValidationState.removeUnreachedMinimumOccurrencesByPath(validationRecordingPath,!1),this.getFormSet().getMultiselection().maximumBreached(totalSelected)?this.currentValidationState.breaksMaximumOccurrences(validationRecordingPath):this.currentValidationState.removeBreachedMaximumOccurrencesByPath(validationRecordingPath,!1)),multiSelectionRecording}getTotalSelectedOptions(){const selectedOptionsArray=this.getSelectedOptionsArray();if(!selectedOptionsArray||selectedOptionsArray.isEmpty())return 0;const existingOptionsNames=this.getFormSet().getOptions().map(option=>option.getName());return selectedOptionsArray.map(property=>property.getString()).filter(name=>existingOptionsNames.indexOf(name)>-1).length}handleSelectionChanged(optionView,isSelected){this.updateSelectionAndOptionArrays(optionView,isSelected),this.currentValidationState&&this.updateValidation(optionView)}updateSelectionAndOptionArrays(optionView,isSelected){isSelected?this.handleOptionSelected(optionView):this.handleOptionDeselected(optionView)}handleOptionSelected(optionView){const name=optionView.getName();this.stashedPropertySets.has(name)&&(this.addPropertySet(name,this.stashedPropertySets.get(name)),this.stashedPropertySets.delete(name)),this.ensureSelectionArrayExists(),new OptionSetArrayHelper(this.getSelectedOptionsArray()).add(name,this.isSingleSelection())}handleOptionDeselected(optionView){const name=optionView.getName();this.stashAndRemoveExistingSetFromParent(name);const selectedOptionsArray=this.getSelectedOptionsArray();selectedOptionsArray&&(new OptionSetArrayHelper(selectedOptionsArray).remove(name),selectedOptionsArray.isEmpty()&&(this.stashedPropertySets.set(FormOptionSetOccurrenceView.SELECTED_NAME,selectedOptionsArray),this.propertySet.removeEmptySets()))}updateValidation(optionView){const previousValidationValid=this.currentValidationState.isValid(),multiSelectionState=this.validateMultiSelection();multiSelectionState.isValid()?this.getFormSet().isRadioSelection()?this.currentValidationState.removeByPath(new ValidationRecordingPath(this.getDataPath(),null),!0,!0):this.currentValidationState.removeByPath(new ValidationRecordingPath(this.getDataPath(),optionView.getFormItem().getName()),!0,!0):this.currentValidationState.flatten(this.currentValidationState),this.renderSelectionValidationMessage(multiSelectionState),this.currentValidationState.isValid()!==previousValidationValid&&this.notifyValidityChanged(new RecordingValidityChangedEvent(this.currentValidationState,this.resolveValidationRecordingPath()).setIncludeChildren(!0)),this.validate(!1)}layoutElements(){super.layoutElements(),this.appendChild(this.selectionValidationMessage)}getOrPopulateOptionItemsPropertySet(name){return this.getPropertySetByName(name)||this.populateOptionItemsPropertySet(name)}getPropertySetByName(name){return this.propertySet?.getPropertyArray(name)?.getSet(0)}populateOptionItemsPropertySet(name){const propertyArray=PropertyArray.create().setType(ValueTypes.DATA).setName(name).setParent(this.propertySet).build();return propertyArray.addSet(),this.propertySet.addPropertyArray(propertyArray),propertyArray.getSet(0)}removeProperty(name){this.propertySet.removeProperty(name,0)}addPropertySet(name,propertySet){this.propertySet.addPropertySet(name,propertySet)}isSelected(name){return!!this.getSelectedOptionsArray()?.some(property=>property.getString()===name)}stashAndRemoveExistingSetFromParent(name){this.getPropertySetByName(name)&&(this.stashedPropertySets.set(name,this.getPropertySetByName(name)),this.removeProperty(name))}subscribeOnSelectedOptionsArray(){this.isSingleSelection()||(this.getSelectedOptionsArray()?.onPropertyAdded(this.checkboxEnabledStatusHandler),this.getSelectedOptionsArray()?.onPropertyRemoved(this.checkboxEnabledStatusHandler))}unSubscribeOnSelectedOptionsArray(){this.isSingleSelection()||(this.getSelectedOptionsArray()?.unPropertyAdded(this.checkboxEnabledStatusHandler),this.getSelectedOptionsArray()?.unPropertyRemoved(this.checkboxEnabledStatusHandler))}isSingleSelection(){const multiSelection=this.getMultiSelection();return multiSelection.getMinimum()===1&&multiSelection.getMaximum()===1}getMultiSelection(){return this.formSet.getMultiselection()}}class NamePrettyfier{static{__name(this,"NamePrettyfier")}static{this.STRIP_BEGINNING_PATTERN=/^([\.|\-|_]+)(.*)$/g}static{this.STRIP_ENDING_PATTERN=/(.*[^\.|\-|_])([\.|\-|_]+)$/g}static{this.NOT_ASCII=/[^\x00-\x7F]/g}static{this.DEFAULT_REPLACE=""}static{this.REPLACE_WITH_HYPHEN_CHARS=NamePrettyfier.buildReplaceWithHyphenMap()}static{this.DIACRITICS=NamePrettyfier.buildDiacriticsMap()}static{this.NON_DIACRITICS=NamePrettyfier.buildNonDiacriticsMap()}static prettify(notPretty){if(StringHelper.isBlank(notPretty))return"";let prettifiedPathName=notPretty;return prettifiedPathName=this.makeLowerCase(prettifiedPathName),prettifiedPathName=this.replaceWithHyphens(prettifiedPathName),prettifiedPathName=this.replaceBlankSpaces(prettifiedPathName),prettifiedPathName=this.replaceTrailingHyphens(prettifiedPathName),prettifiedPathName=this.replaceHyphensAroundDot(prettifiedPathName),prettifiedPathName=this.ensureNiceBeginningAndEnding(prettifiedPathName),BrowserHelper.isIE()||(prettifiedPathName=this.transcribe(prettifiedPathName)),StringHelper.isBlank(prettifiedPathName)?"":prettifiedPathName}static makeLowerCase(prettifiedName){return StringHelper.isEmpty(prettifiedName)?"":prettifiedName.toLowerCase()}static replaceWithHyphens(prettifiedName){if(StringHelper.isEmpty(prettifiedName))return"";let result="";for(const character of prettifiedName){const replace=this.REPLACE_WITH_HYPHEN_CHARS[character];result+=replace??character}return result}static replaceBlankSpaces(prettifiedName){return StringHelper.isEmpty(prettifiedName)?"":prettifiedName.trim().replace(/\s+/g,"-")}static replaceTrailingHyphens(prettifiedName){return StringHelper.isBlank(prettifiedName)?"":prettifiedName.replace(/-[-]+/g,"-")}static replaceHyphensAroundDot(prettifiedName){return StringHelper.isBlank(prettifiedName)?"":prettifiedName.replace(/-?\.-?/g,".")}static ensureNiceBeginningAndEnding(prettifiedName){if(StringHelper.isBlank(prettifiedName))return"";this.STRIP_BEGINNING_PATTERN.lastIndex=this.STRIP_ENDING_PATTERN.lastIndex=0;let match=this.STRIP_BEGINNING_PATTERN.exec(prettifiedName);return match&&(prettifiedName=prettifiedName.replace(match[0],match[2])),match=this.STRIP_ENDING_PATTERN.exec(prettifiedName),match&&(prettifiedName=prettifiedName.replace(match[0],match[1])),prettifiedName}static transcribe(transcribeMe){if(!transcribeMe)return"";let result="";for(const character of transcribeMe){let replace=this.NON_DIACRITICS[character];replace=replace??this.DIACRITICS[character],result+=replace??character}let normalized=result;return result.normalize&&(normalized=result.normalize("NFD")),normalized.replace(this.NOT_ASCII,this.DEFAULT_REPLACE).toLowerCase()}static buildDiacriticsMap(){const defaultDiacriticsRemovalMapArray=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"OE",letters:"ŒŒ"},{base:"oe",letters:"œœ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}];let diacriticsMap={};for(const defaultDiacriticsRemovalMap of defaultDiacriticsRemovalMapArray){const letters=defaultDiacriticsRemovalMap.letters;for(const letter of letters)diacriticsMap[letter]=defaultDiacriticsRemovalMap.base}return diacriticsMap}static buildReplaceWithHyphenMap(){return{$:"-","&":"-","|":"-",":":"-",";":"-","#":"-","/":"-","\\":"-","<":"-",">":"-",'"':"-","*":"-","+":"-",",":"-","=":"-","@":"-","%":"-","{":"-"," }":"-","[":"-","]":"-","`":"-","~":"-","^":"-",_:"-","'":"-","?":"-"}}static buildNonDiacriticsMap(){let nonDiacriticsObject={};return nonDiacriticsObject['"']=this.DEFAULT_REPLACE,nonDiacriticsObject["'"]=this.DEFAULT_REPLACE,nonDiacriticsObject[" "]=this.DEFAULT_REPLACE,nonDiacriticsObject["]"]=this.DEFAULT_REPLACE,nonDiacriticsObject["["]=this.DEFAULT_REPLACE,nonDiacriticsObject[")"]=this.DEFAULT_REPLACE,nonDiacriticsObject["("]=this.DEFAULT_REPLACE,nonDiacriticsObject["="]=this.DEFAULT_REPLACE,nonDiacriticsObject["!"]=this.DEFAULT_REPLACE,nonDiacriticsObject["/"]=this.DEFAULT_REPLACE,nonDiacriticsObject["\\"]=this.DEFAULT_REPLACE,nonDiacriticsObject["&"]=this.DEFAULT_REPLACE,nonDiacriticsObject[","]=this.DEFAULT_REPLACE,nonDiacriticsObject["?"]=this.DEFAULT_REPLACE,nonDiacriticsObject["°"]=this.DEFAULT_REPLACE,nonDiacriticsObject["|"]=this.DEFAULT_REPLACE,nonDiacriticsObject["<"]=this.DEFAULT_REPLACE,nonDiacriticsObject[">"]=this.DEFAULT_REPLACE,nonDiacriticsObject[";"]=this.DEFAULT_REPLACE,nonDiacriticsObject[":"]=this.DEFAULT_REPLACE,nonDiacriticsObject["#"]=this.DEFAULT_REPLACE,nonDiacriticsObject["~"]=this.DEFAULT_REPLACE,nonDiacriticsObject["+"]=this.DEFAULT_REPLACE,nonDiacriticsObject["*"]=this.DEFAULT_REPLACE,nonDiacriticsObject.Ł="l",nonDiacriticsObject.ł="l",nonDiacriticsObject.ß="ss",nonDiacriticsObject.æ="ae",nonDiacriticsObject.ø="o",nonDiacriticsObject["©"]="c",nonDiacriticsObject.Ð="d",nonDiacriticsObject.ð="d",nonDiacriticsObject.Đ="d",nonDiacriticsObject.đ="d",nonDiacriticsObject.Ɖ="d",nonDiacriticsObject.ɖ="d",nonDiacriticsObject.Þ="th",nonDiacriticsObject.þ="th",nonDiacriticsObject.А="a",nonDiacriticsObject.Б="b",nonDiacriticsObject.В="v",nonDiacriticsObject.Г="g",nonDiacriticsObject.Д="d",nonDiacriticsObject.Е="e",nonDiacriticsObject.Ё="jo",nonDiacriticsObject.Ж="zh",nonDiacriticsObject.З="z",nonDiacriticsObject.И="i",nonDiacriticsObject.Й="j",nonDiacriticsObject.К="k",nonDiacriticsObject.Л="l",nonDiacriticsObject.М="m",nonDiacriticsObject.Н="n",nonDiacriticsObject.О="o",nonDiacriticsObject.П="p",nonDiacriticsObject.Р="r",nonDiacriticsObject.С="s",nonDiacriticsObject.Т="t",nonDiacriticsObject.У="u",nonDiacriticsObject.Ф="f",nonDiacriticsObject.Х="h",nonDiacriticsObject.Ц="c",nonDiacriticsObject.Ч="ch",nonDiacriticsObject.Ш="sh",nonDiacriticsObject.Щ="sch",nonDiacriticsObject.Ъ="",nonDiacriticsObject.Ы="y",nonDiacriticsObject.Ь="",nonDiacriticsObject.Э="eh",nonDiacriticsObject.Ю="ju",nonDiacriticsObject.Я="ja",nonDiacriticsObject.а="a",nonDiacriticsObject.б="b",nonDiacriticsObject.в="v",nonDiacriticsObject.г="g",nonDiacriticsObject.д="d",nonDiacriticsObject.е="e",nonDiacriticsObject.ё="jo",nonDiacriticsObject.ж="zh",nonDiacriticsObject.з="z",nonDiacriticsObject.и="i",nonDiacriticsObject.й="j",nonDiacriticsObject.к="k",nonDiacriticsObject.л="l",nonDiacriticsObject.м="m",nonDiacriticsObject.н="n",nonDiacriticsObject.о="o",nonDiacriticsObject.п="p",nonDiacriticsObject.р="r",nonDiacriticsObject.с="s",nonDiacriticsObject.т="t",nonDiacriticsObject.у="u",nonDiacriticsObject.ф="f",nonDiacriticsObject.х="h",nonDiacriticsObject.ц="c",nonDiacriticsObject.ч="ch",nonDiacriticsObject.ш="sh",nonDiacriticsObject.щ="sch",nonDiacriticsObject.ъ="",nonDiacriticsObject.ы="y",nonDiacriticsObject.ь="",nonDiacriticsObject.э="eh",nonDiacriticsObject.ю="ju",nonDiacriticsObject.я="ja",nonDiacriticsObject.І="i",nonDiacriticsObject.Ѳ="fh",nonDiacriticsObject.Ѣ="je",nonDiacriticsObject.Ѵ="yh",nonDiacriticsObject.Ґ="gj",nonDiacriticsObject.Ѓ="gj",nonDiacriticsObject.Є="ye",nonDiacriticsObject.Ї="yi",nonDiacriticsObject.Ѕ="dz",nonDiacriticsObject.Ј="jj",nonDiacriticsObject.Љ="lj",nonDiacriticsObject.Њ="nj",nonDiacriticsObject.Ќ="kj",nonDiacriticsObject.Џ="dj",nonDiacriticsObject.Ў="uj",nonDiacriticsObject.і="i",nonDiacriticsObject.ѳ="fh",nonDiacriticsObject.ѣ="je",nonDiacriticsObject.ѵ="yh",nonDiacriticsObject.ґ="gj",nonDiacriticsObject.ѓ="gj",nonDiacriticsObject.є="ye",nonDiacriticsObject.ї="yi",nonDiacriticsObject.ѕ="dz",nonDiacriticsObject.ј="jj",nonDiacriticsObject.љ="lj",nonDiacriticsObject.њ="nj",nonDiacriticsObject.ќ="kj",nonDiacriticsObject.џ="dj",nonDiacriticsObject.ў="uj",nonDiacriticsObject.α="a",nonDiacriticsObject.β="b",nonDiacriticsObject.γ="g",nonDiacriticsObject.δ="d",nonDiacriticsObject.ε="e",nonDiacriticsObject.ζ="z",nonDiacriticsObject.η="e",nonDiacriticsObject.θ="th",nonDiacriticsObject.ι="i",nonDiacriticsObject.κ="c",nonDiacriticsObject.λ="l",nonDiacriticsObject.μ="m",nonDiacriticsObject.ν="n",nonDiacriticsObject.ξ="x",nonDiacriticsObject.ο="o",nonDiacriticsObject.π="p",nonDiacriticsObject.ρ="r",nonDiacriticsObject.σ="s",nonDiacriticsObject.τ="t",nonDiacriticsObject.υ="y",nonDiacriticsObject.φ="ph",nonDiacriticsObject.χ="ch",nonDiacriticsObject.ψ="ps",nonDiacriticsObject.ω="o",nonDiacriticsObject.Α="a",nonDiacriticsObject.Β="b",nonDiacriticsObject.Γ="g",nonDiacriticsObject.Δ="d",nonDiacriticsObject.Ε="e",nonDiacriticsObject.Ζ="z",nonDiacriticsObject.Η="e",nonDiacriticsObject.Θ="th",nonDiacriticsObject.Ι="i",nonDiacriticsObject.Κ="c",nonDiacriticsObject.Λ="l",nonDiacriticsObject.Μ="m",nonDiacriticsObject.Ν="n",nonDiacriticsObject.Ξ="x",nonDiacriticsObject.Ο="o",nonDiacriticsObject.Π="p",nonDiacriticsObject.Ρ="r",nonDiacriticsObject.Σ="s",nonDiacriticsObject.Τ="t",nonDiacriticsObject.Υ="y",nonDiacriticsObject.Φ="ph",nonDiacriticsObject.Χ="ch",nonDiacriticsObject.Ψ="ps",nonDiacriticsObject.Ω="o",nonDiacriticsObject}static getPrettyUnnamed(){return i18n("field.unnamed")}static prettifyUnnamed(name){if(!name)return`<${NamePrettyfier.getPrettyUnnamed()}>`;let prettifiedName=name.replace(/-/g," ").trim();return prettifiedName=StringHelper.capitalizeAll(`${NamePrettyfier.getPrettyUnnamed()} ${prettifiedName}`),`<${prettifiedName}>`}}class NamesAndIconViewer extends Viewer{static{__name(this,"NamesAndIconViewer")}static{this.debug=!1}constructor(className,size=NamesAndIconViewSize.small){super("names-and-icon-viewer "+(className||"")),this.emptyDisplayName="<"+i18n("field.displayName")+">",this.isRelativePath=!1,this.size=size}getCloneArgs(){return[this.className,this.size]}setObject(object){return super.setObject(object)}setIsRelativePath(value){this.isRelativePath=value}doLayout(object){if(super.doLayout(object),NamesAndIconViewer.debug,this.namesAndIconView?this.namesAndIconView.setIconClass(""):(this.namesAndIconView=new NamesAndIconViewBuilder().setSize(this.size).build(),this.appendChild(this.namesAndIconView)),object){const displayName=this.resolveDisplayName(object)||this.normalizeDisplayName(this.resolveUnnamedDisplayName(object)),subName=this.resolveSubName(object)||NamePrettyfier.prettifyUnnamed(),subTitle=this.resolveSubTitle(object),hint=this.resolveHint(object);StringHelper.isBlank(hint)||this.getHintTargetEl().setAttribute("title",hint);let iconUrl,iconClass,iconEl=this.resolveIconEl(object),hideIcon=!1;iconEl?this.namesAndIconView.setIconEl(iconEl):(iconUrl=this.resolveIconUrl(object),StringHelper.isBlank(iconUrl)?(iconClass=this.resolveIconClass(object),StringHelper.isBlank(iconClass)?hideIcon=!0:this.namesAndIconView.setIconClass(iconClass)):this.namesAndIconView.setIconUrl(iconUrl)),this.namesAndIconView.toggleClass("no-icon",hideIcon),this.namesAndIconView.setMainName(displayName).setSubName(subName,subTitle)}}resolveHint(_object){return""}resolveDisplayName(_object){return""}resolveUnnamedDisplayName(_object){return""}resolveSubName(_object){return""}resolveSubTitle(_object){return""}resolveIconClass(_object){return""}resolveIconUrl(_object){return""}resolveIconEl(_object){return null}getNamesAndIconView(){return this.namesAndIconView}getHintTargetEl(){return this.getEl()}normalizeDisplayName(displayName){return StringHelper.isEmpty(displayName)?this.emptyDisplayName:NamePrettyfier.prettifyUnnamed(displayName)}}class FormOptionSetOptionViewer extends NamesAndIconViewer{static{__name(this,"FormOptionSetOptionViewer")}constructor(){super("optionset-option-viewer")}resolveDisplayName(_object){return _object.getLabel()}resolveSubName(_object){return _object.getHelpText()||i18n("text.noDescription")}}class FormOptionSetOccurrenceViewSingleOption extends FormOptionSetOccurrenceView{static{__name(this,"FormOptionSetOccurrenceViewSingleOption")}update(dataSet,unchangedOnly){return super.update(dataSet,unchangedOnly).then(()=>(this.layoutSingleSelection(),Q(null)))}layout(validate=!0){return super.layout(validate).then(rendered=>(this.addClass("single-selection"),this.moreButton.prependMenuActions([this.resetAction]),this.layoutSingleSelection(),rendered))}initElements(){super.initElements(),this.resetAction=new Action(i18n("action.reset")).setEnabled(!1),this.singleSelectionHeader=new DivEl("single-selection-header"),this.singleSelectionDropdown=new FormOptionSetOptionDropdown,this.selectionValidationMessage=new DivEl("selection-message"),this.selectionWrapper=new FilterableListBoxWrapper(this.singleSelectionDropdown,{className:"single-selection-dropdown-wrapper",filter:this.filter})}postInitElements(){super.postInitElements(),this.singleSelectionDropdown.setItems(this.formSet.getOptions())}layoutSingleSelection(){const selectedOptionName=this.getSelectedOptionsArray()?.get(0)?.getString(),selectedOption=this.singleSelectionDropdown.getItems().find(option=>option.getName()===selectedOptionName);selectedOption?(this.selectionWrapper.select(selectedOption),this.expandSelectedOptionView()):(this.formSetOccurrencesContainer.hide(),this.selectionWrapper.deselectAll(),this.resetAction.setEnabled(!1))}hideAllOptionViews(){this.getFormItemViews().forEach(view=>view.hide())}initListeners(){super.initListeners(),this.resetAction.onExecuted(()=>{this.selectionWrapper.deselectAll(),this.singleSelectionDropdown.giveFocus()}),this.selectionWrapper.onSelectionChanged(selectionChange=>{selectionChange.selected?.length>0&&(this.expandSelectedOptionView(),this.notifyOccurrenceChanged()),selectionChange.deselected?.forEach(option=>{const idx=this.singleSelectionDropdown.findItemIndex(option),optionView=this.getFormItemViews()[idx];optionView&&optionView.disableAndCollapse(),this.singleSelectionHeader.removeClass("selected"),this.refresh(),this.handleSelectionChanged(optionView,!1)})})}setEnabled(enable){super.setEnabled(enable),this.selectionWrapper.setEnabled(enable)}refresh(){super.refresh(),this.resetAction.setEnabled(this.selectionWrapper.getSelectedItems().length>0)}handleSelectionChanged(optionView,isSelected){optionView.setVisible(isSelected),this.setContainerVisible(this.isContainerExpansionRequired(optionView)),super.handleSelectionChanged(optionView,isSelected)}isExpandable(){const selectedOption=this.selectionWrapper.getSelectedItems()[0];if(!selectedOption)return!1;const idx=this.singleSelectionDropdown.findItemIndex(selectedOption);return this.formItemViews[idx]?.isExpandable()}layoutElements(){this.singleSelectionHeader.appendChildren(new DivEl("drag-control"),this.selectionWrapper,this.label,this.moreButton),this.appendChildren(this.singleSelectionHeader,this.selectionValidationMessage,this.formSetOccurrencesContainer)}getSelectedOptionView(){const selectedOptionName=this.selectionWrapper.getSelectedItems()[0]?.getName();return this.getFormItemViews().find(view=>view.getFormItem().getName()===selectedOptionName)}expandSelectedOptionView(){this.hideAllOptionViews();const selectedOptionView=this.getSelectedOptionView();selectedOptionView?.enableAndExpand(),this.singleSelectionHeader.addClass("selected"),this.refresh(),this.handleSelectionChanged(selectedOptionView,!0)}isContainerExpansionRequired(optionView){return this.selectionWrapper.getSelectedItems().length>0&&optionView.getFormItemViews().length>0}filter(item,searchString){return item.getName()?.toLowerCase().indexOf(searchString.toLowerCase())>-1||item.getLabel()?.toLowerCase().indexOf(searchString.toLowerCase())>-1||item.getHelpText()?.toLowerCase().indexOf(searchString.toLowerCase())>-1}}class FormOptionSetOptionDropdown extends ListBox{static{__name(this,"FormOptionSetOptionDropdown")}constructor(){super("single-selection-dropdown")}createItemView(item,readOnly){const viewer=new FormOptionSetOptionViewer;return viewer.setObject(item),viewer}getItemId(item){return item.getName()}}class FormOptionSetOccurrenceViewMultiOptions extends FormOptionSetOccurrenceView{static{__name(this,"FormOptionSetOccurrenceViewMultiOptions")}layout(validate=!0){return super.layout(validate).then(rendered=>(this.addClass("multi-selection"),rendered))}}class FormOptionSetOccurrences extends FormSetOccurrences{static{__name(this,"FormOptionSetOccurrences")}createFormSetOccurrenceView(config){return this.isSingleSelection()?new FormOptionSetOccurrenceViewSingleOption(config):new FormOptionSetOccurrenceViewMultiOptions(config)}isSingleSelection(){const multi=this.getFormSet().getMultiselection();return multi.getMinimum()===1&&multi.getMaximum()===1}}class FormOptionSetView extends FormSetView{static{__name(this,"FormOptionSetView")}constructor(config){super(config,"form-option-set")}createOccurrences(config){return new FormOptionSetOccurrences(config)}}class FormItemLayer{static{__name(this,"FormItemLayer")}static{this.debug=!1}constructor(context,layerFactory){this.formItemViews=[],this.lazyRender=!0,this.context=context,this.formItemLayerFactory=layerFactory}setFormItems(formItems){return this.formItems=formItems,this}hasParentElement(){return!!this.parentEl}setParentElement(parentEl){return this.parentEl=parentEl,this.appendFormItemViews(),this}setParent(value){return this.parent=value,this}setFormItemState(formItemState){return this.formItemState=formItemState,this}appendFormItemViews(){this.parentEl&&this.parentEl.appendChildren(...this.formItemViews)}layout(propertySet,validate=!0){return this.formItemViews=[],this.doLayoutPropertySet(propertySet,validate).then(()=>(this.parentEl?.whenRendered(()=>this.appendFormItemViews()),Q(this.formItemViews)))}update(propertySet,unchangedOnly){FormItemLayer.debug;const updatePromises=this.formItemViews.map(formItemView=>((ObjectHelper.iFrameSafeInstanceOf(formItemView,FormItemSetView)||ObjectHelper.iFrameSafeInstanceOf(formItemView,FormOptionSetView))&&this.setShowEmptyFormItemSetOccurrences(propertySet,formItemView.getFormItem().getName()),formItemView.update(propertySet,unchangedOnly)));return Q.all(updatePromises).spread(()=>Q(null)).catch(DefaultErrorHandler.handle)}reset(){this.formItemViews.forEach(formItemView=>{formItemView.reset()})}toggleHelpText(show){this.formItemViews.forEach(formItemView=>{formItemView.toggleHelpText(show)})}hasHelpText(){return this.formItemViews.some(formItemView=>formItemView.hasHelpText())}setEnabled(enable){this.formItemViews.forEach(formItemView=>{formItemView.setEnabled(enable)})}setLazyRender(value){this.lazyRender=value}setShowEmptyFormItemSetOccurrences(propertySet,name){const propertyArray=propertySet.getPropertyArray(name);(!propertyArray||propertyArray.getSize()===0)&&(this.context?this.context.setShowEmptyFormItemSetOccurrences(!1):this.context=FormContext.create().setShowEmptyFormItemSetOccurrences(!1).build())}doLayoutPropertySet(propertySet,validate=!0){const inputs=[],layoutPromises=this.formItems.map(formItem=>{let formItemView;if(ObjectHelper.iFrameSafeInstanceOf(formItem,FormItemSet)){const formItemSet=formItem;this.setShowEmptyFormItemSetOccurrences(propertySet,formItemSet.getName()),formItemView=new FormItemSetView({context:this.context,layerFactory:this.formItemLayerFactory,formSet:formItemSet,parent:this.parent,parentDataSet:propertySet,occurrencesLazyRender:this.lazyRender})}if(ObjectHelper.iFrameSafeInstanceOf(formItem,FieldSet)){const fieldSet=formItem;formItemView=new FieldSetView({context:this.context,layerFactory:this.formItemLayerFactory,fieldSet,parent:this.parent,dataSet:propertySet,lazyRender:this.lazyRender})}if(ObjectHelper.iFrameSafeInstanceOf(formItem,Input)){const input=formItem;formItemView=new InputView({context:this.context,input,parent:this.parent,parentDataSet:propertySet}),inputs.push(formItemView)}if(ObjectHelper.iFrameSafeInstanceOf(formItem,FormOptionSet)){const formOptionSet=formItem;this.setShowEmptyFormItemSetOccurrences(propertySet,formOptionSet.getName()),formItemView=new FormOptionSetView({layerFactory:this.formItemLayerFactory,context:this.context,formSet:formOptionSet,parent:this.parent,parentDataSet:propertySet,occurrencesLazyRender:this.lazyRender})}if(ObjectHelper.iFrameSafeInstanceOf(formItem,FormOptionSetOption)){const formOptionSetOption=formItem;formItemView=new FormOptionSetOptionView({context:this.context,layerFactory:this.formItemLayerFactory,formOptionSetOption,parent:this.parent,lazyRender:this.lazyRender,formItemState:this.formItemState})}return this.formItemViews.push(formItemView),formItemView.layout(validate)});return inputs.length>1&&FocusSwitchEvent.on(event=>{const inputTypeView=event.getInputTypeView(),lastIndex=inputs.length-1;let currentIndex=-1;if(inputs.map(input=>input.getInputTypeView()).some((input,index)=>input.getElement()===inputTypeView.getElement()?(currentIndex=index,!0):!1),currentIndex>=0){const nextIndex=currentIndex===lastIndex?0:currentIndex+1;inputs[nextIndex].giveFocus()}}),Q.all(layoutPromises).spread(()=>Q(null))}}const FORM_ITEM_LAYER_FACTORY_KEY="FormItemLayerFactory";class FormItemLayerFactoryImpl{static{__name(this,"FormItemLayerFactoryImpl")}constructor(){}static get(){let instance=Store.parentInstance().get(FORM_ITEM_LAYER_FACTORY_KEY);return instance==null&&(instance=new FormItemLayerFactoryImpl,Store.parentInstance().set(FORM_ITEM_LAYER_FACTORY_KEY,instance)),instance}createLayer(config){const layer=new FormItemLayer(config.context,FormItemLayerFactoryImpl.get());config.lazyRender!=null&&layer.setLazyRender(config.lazyRender);const state=config.formItemState||FormItemState.EXISTING;return layer.setFormItemState(state),layer}}class FormValidityChangedEvent{static{__name(this,"FormValidityChangedEvent")}constructor(recording,atLeastOneInputValueBroken=!1){this.recording=recording,this.atLeastOneInputValueBroken=atLeastOneInputValueBroken}isValid(){return this.recording.isValid()&&!this.atLeastOneInputValueBroken}getRecording(){return this.recording}}class FormView extends DivEl{static{__name(this,"FormView")}static{this.debug=!1}static{this.VALIDATION_CLASS="display-validation-errors"}constructor(context,form,data){super("form-view"),this.formItemViews=[],this.formValidityChangedListeners=[],this.focusListeners=[],this.blurListeners=[],this.layoutFinishedListeners=[],this.form=form,this.data=data,this.formItemLayer=FormItemLayerFactoryImpl.get().createLayer({context})}layout(validate=!0){const deferred=Q.defer();if(this.layoutFinished=!1,!this.form)return deferred.resolve(null),deferred.promise;const formItems=this.form.getFormItems();return this.formItemLayer.setFormItems(formItems).setParentElement(this).layout(this.data,validate).then(formItemViews=>(this.formItemViews=formItemViews,assert(this.formItemViews.length===formItems.length,"Not all FormItemView-s was created. Expected "+formItems.length+", was: "+formItemViews.length),deferred.resolve(null),this.formItemViews.forEach(formItemView=>{this.initFormItemViewListeners(formItemView)}),WindowDOM.get().onResized(()=>this.checkSizeChanges(),this),this.onShown(()=>this.checkSizeChanges()),Q(null))).catch(reason=>{DefaultErrorHandler.handle(reason)}).done(()=>{this.layoutFinished=!0,this.notifyLayoutFinished()}),deferred.promise}initFormItemViewListeners(formItemView){formItemView.onFocus(event=>{this.notifyFocused(event)}),formItemView.onBlur(event=>{this.notifyBlurred(event)}),formItemView.onValidityChanged(event=>{this.previousValidationRecording?(event.isValid()?this.previousValidationRecording.removeByPath(event.getOrigin(),!1,event.isIncludeChildren()):this.previousValidationRecording.flatten(event.getRecording()),this.notifyValidityChanged(new FormValidityChangedEvent(this.previousValidationRecording))):(this.previousValidationRecording=event.getRecording(),this.notifyValidityChanged(new FormValidityChangedEvent(this.previousValidationRecording)))})}clean(){this.formItemViews.forEach(view=>view.clean())}update(propertySet,unchangedOnly){return FormView.debug,this.data=propertySet,this.formItemLayer.update(propertySet,unchangedOnly)}reset(){return this.formItemLayer.reset()}highlightInputsOnValidityChange(highlight){this.formItemViews.forEach(formItemView=>{formItemView.setHighlightOnValidityChange(highlight)})}hasValidUserInput(){let result=!0;return this.formItemViews.forEach(formItemView=>{formItemView.hasValidUserInput()||(result=!1)}),result}validate(silent,forceNotify=!1){let recording=new ValidationRecording;return this.formItemViews.forEach(formItemView=>{recording.flatten(formItemView.validate(silent))}),!silent&&(recording.validityChanged(this.previousValidationRecording)||forceNotify)&&this.notifyValidityChanged(new FormValidityChangedEvent(recording)),this.previousValidationRecording=recording,recording}isValid(){return this.previousValidationRecording||(this.previousValidationRecording=this.validate(!0)),this.previousValidationRecording.isValid()}displayValidationErrors(value){value?this.addClass(FormView.VALIDATION_CLASS):this.removeClass(FormView.VALIDATION_CLASS);for(const formItemView of this.formItemViews)formItemView.displayValidationErrors(value)}getData(){return this.data}getForm(){return this.form}giveFocus(){let focusGiven=!1;if(this.formItemViews.length>0){for(const formItemView of this.formItemViews)if(formItemView.giveFocus()){focusGiven=!0;break}}return focusGiven}onValidityChanged(listener){this.formValidityChangedListeners.push(listener)}unValidityChanged(listener){this.formValidityChangedListeners=this.formValidityChangedListeners.filter(currentListener=>listener!==currentListener)}onFocus(listener){this.focusListeners.push(listener)}unFocus(listener){this.focusListeners=this.focusListeners.filter(curr=>curr!==listener)}onBlur(listener){this.blurListeners.push(listener)}unBlur(listener){this.blurListeners=this.blurListeners.filter(curr=>curr!==listener)}onLayoutFinished(listener){this.layoutFinishedListeners.push(listener)}unLayoutFinished(listener){this.layoutFinishedListeners=this.layoutFinishedListeners.filter(curr=>curr!==listener)}whenLayoutFinished(callback){if(this.isLayoutFinished())callback();else{const listener=__name(()=>{callback(),this.unLayoutFinished(listener)},"listener");this.onLayoutFinished(listener)}}isLayoutFinished(){return this.layoutFinished}toggleHelpText(show){this.formItemLayer.toggleHelpText(show)}hasHelpText(){return this.formItemLayer.hasHelpText()}setLazyRender(value){this.formItemLayer.setLazyRender(value)}checkSizeChanges(){this.isVisible()&&this.isSizeChanged()&&(this.preserveCurrentSize(),this.broadcastFormSizeChanged())}preserveCurrentSize(){this.width=this.getEl().getWidth()}isSizeChanged(){return this.width!==this.getEl().getWidth()}broadcastFormSizeChanged(){this.formItemViews.forEach(formItemView=>{formItemView.broadcastFormSizeChanged()})}notifyValidityChanged(event){this.formValidityChangedListeners.forEach(listener=>{listener.call(this,event)})}notifyFocused(event){this.focusListeners.forEach(listener=>{listener(event)})}notifyBlurred(event){this.blurListeners.forEach(listener=>{listener(event)})}notifyLayoutFinished(){this.layoutFinishedListeners.forEach(listener=>{listener()})}setEnabled(enable){this.formItemLayer.setEnabled(enable)}}class ApplicationKey{static{__name(this,"ApplicationKey")}static{this.SYSTEM=ApplicationKey.fromString("system")}static{this.BASE=ApplicationKey.fromString("base")}static{this.PORTAL=ApplicationKey.fromString("portal")}static{this.MEDIA=ApplicationKey.fromString("media")}static{this.SYSTEM_RESERVED_APPLICATION_KEYS=[ApplicationKey.SYSTEM,ApplicationKey.BASE,ApplicationKey.PORTAL,ApplicationKey.MEDIA]}constructor(applicationName){this.name=applicationName}static fromString(applicationName){return new ApplicationKey(applicationName)}static toStringArray(keys){return keys.map(key=>key.toString())}static fromApplications(applications){return applications.map(mod=>mod.getApplicationKey())}static fromClusterApplications(applications){return applications.filter(mod=>!mod.isLocal()).map(mod=>mod.getApplicationKey())}getName(){return this.name}isSystemReserved(){return ApplicationKey.SYSTEM_RESERVED_APPLICATION_KEYS.some(key=>key.equals(this))}toString(){return this.name}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ApplicationKey))return!1;let other=o;return ObjectHelper.stringEquals(this.name,other.name)}}class DescriptorName{static{__name(this,"DescriptorName")}constructor(name){if(name==null)throw new Error("name cannot be null");this.name=name}toString(){return this.name}}class DescriptorKey{static{__name(this,"DescriptorKey")}static{this.SEPARATOR=":"}constructor(applicationKey,name){this.applicationKey=applicationKey,this.name=name,this.refString=applicationKey.toString()+DescriptorKey.SEPARATOR+name.toString()}static fromString(str){const sepIndex=str.indexOf(DescriptorKey.SEPARATOR);if(sepIndex===-1)throw new Error(`DescriptorKey must contain separator '${DescriptorKey.SEPARATOR}':${str}`);const applicationKey=str.substring(0,sepIndex),name=str.substring(sepIndex+1,str.length);return new DescriptorKey(ApplicationKey.fromString(applicationKey),new DescriptorName(name))}getApplicationKey(){return this.applicationKey}getName(){return this.name}toString(){return this.refString}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,DescriptorKey))return!1;const other=o;return!!ObjectHelper.stringEquals(this.refString,other.refString)}}class ComponentDescriptorUpdatedEvent extends ComponentUpdatedEvent{static{__name(this,"ComponentDescriptorUpdatedEvent")}constructor(componentPath,value){super(componentPath),this.descriptorKey=value}getDescriptorKey(){return this.descriptorKey}}class DescriptorBasedComponent extends ConfigBasedComponent{static{__name(this,"DescriptorBasedComponent")}constructor(builder){super(builder),this.descriptorKey=builder.descriptor}hasDescriptor(){return!!this.descriptorKey}getDescriptorKey(){return this.descriptorKey}setDescriptor(descriptor){this.setName(descriptor?new ComponentName(descriptor.getDisplayName()):this.getType().getDefaultName());const oldDescriptorKeyValue=this.descriptorKey;if(ObjectHelper.equals(oldDescriptorKeyValue,descriptor?.getKey()))return Q.resolve();this.descriptorKey=descriptor?.getKey();const propertyTree=new PropertyTree;return(descriptor?new FormView(FormContext.create().setFormState(new FormState(!0)).build(),descriptor.getConfig(),propertyTree.getRoot()).layout(!1):Q.resolve(null)).catch(DefaultErrorHandler.handle).finally(()=>(this.config?.unChanged(this.configChangedHandler),this.config=propertyTree,this.config.onChanged(this.configChangedHandler),this.notifyComponentUpdated(new ComponentDescriptorUpdatedEvent(this.getPath(),this.descriptorKey)),Q.resolve()))}doReset(){this.setDescriptor(null).catch(DefaultErrorHandler.handle)}toComponentJson(){return{descriptor:this.descriptorKey!=null?this.descriptorKey.toString():null,config:this.config!=null?this.config.toJson():null,name:this.getName()?.toString()}}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,DescriptorBasedComponent))return!1;const other=o;return ObjectHelper.equals(this.descriptorKey,other.descriptorKey)?super.equals(o):!1}clone(){throw new Error("Must be implemented by inheritors")}}class DescriptorBasedComponentBuilder extends ConfigBasedComponentBuilder{static{__name(this,"DescriptorBasedComponentBuilder")}constructor(source){super(source),source&&(this.descriptor=source.getDescriptorKey())}fromJson(json){return super.fromJson(json),json.descriptor&&this.setDescriptor(DescriptorKey.fromString(json.descriptor)),this}setDescriptor(value){return this.descriptor=value,this}setDescription(value){return this.description=value,this}setIcon(value){return this.icon=value,this}}class PartComponentType extends ComponentType{static{__name(this,"PartComponentType")}static{this.INSTANCE=new PartComponentType}constructor(){super("part")}static get(){return PartComponentType.INSTANCE}getIconCls(){return"part"}}class PartComponent extends DescriptorBasedComponent{static{__name(this,"PartComponent")}constructor(builder){super(builder)}toJson(){return{PartComponent:super.toComponentJson()}}isEmpty(){return!this.hasDescriptor()}equals(o){return ObjectHelper.iFrameSafeInstanceOf(o,PartComponent)?super.equals(o):!1}clone(){return new PartComponentBuilder(this).build()}}class PartComponentBuilder extends DescriptorBasedComponentBuilder{static{__name(this,"PartComponentBuilder")}constructor(source){super(source),this.setType(PartComponentType.get())}build(){return new PartComponent(this)}}const FORM_ITEM_FACTORY_KEY="FormItemFactory";class FormItemFactoryImpl{static{__name(this,"FormItemFactoryImpl")}constructor(){}static get(){let instance=Store.parentInstance().get(FORM_ITEM_FACTORY_KEY);return instance==null&&(instance=new FormItemFactoryImpl,Store.parentInstance().set(FORM_ITEM_FACTORY_KEY,instance)),instance}createFormItem(formItemTypeWrapperJson,applicationKey){return formItemTypeWrapperJson.Input?this.createInput(formItemTypeWrapperJson.Input).setApplicationKey(applicationKey):formItemTypeWrapperJson.FormItemSet?this.createFormItemSet(formItemTypeWrapperJson.FormItemSet,applicationKey):formItemTypeWrapperJson.FieldSet?this.createFieldSetLayout(formItemTypeWrapperJson.FieldSet,applicationKey):formItemTypeWrapperJson.FormOptionSet?this.createFormOptionSet(formItemTypeWrapperJson.FormOptionSet,applicationKey):formItemTypeWrapperJson.FormOptionSetOption?this.createFormOptionSetOption(formItemTypeWrapperJson.FormOptionSetOption,applicationKey):null}createInput(inputJson){return Input.fromJson(inputJson)}createFormItemSet(formItemSetJson,applicationKey){return new FormItemSet(formItemSetJson,this,applicationKey)}createFieldSetLayout(fieldSetJson,applicationKey){return new FieldSet(fieldSetJson,this,applicationKey)}createFormOptionSet(optionSetJson,applicationKey){return new FormOptionSet(optionSetJson,this,applicationKey)}createFormOptionSetOption(optionSetOptionJson,applicationKey){return new FormOptionSetOption(optionSetOptionJson,this,applicationKey)}}class FormBuilder{static{__name(this,"FormBuilder")}constructor(){this.formItems=[]}addFormItem(formItem){return this.formItems.push(formItem),this}addFormItems(formItems){return formItems.forEach(formItem=>{this.addFormItem(formItem)}),this}createFormItem(formItemJson,applicationKey){return FormItemFactoryImpl.get().createFormItem(formItemJson,applicationKey)}fromJson(json,applicationKey){return json.formItems.forEach(formItemJson=>{const formItem=this.createFormItem(formItemJson,applicationKey);formItem&&this.addFormItem(formItem)}),this}build(){return new Form(this)}}class Form{static{__name(this,"Form")}constructor(builder){this.formItems=[],this.formItemByName={},builder.formItems.forEach(formItem=>{this.addFormItem(formItem)})}static fromJson(json,applicationKey){let builder=new FormBuilder;return builder.fromJson(json,applicationKey),builder.build()}addFormItem(formItem){const name=formItem.getName();if(this.formItemByName[name]&&!(formItem instanceof FieldSet))throw new Error("FormItem already added: "+name);this.formItemByName[formItem.getName()]=formItem,this.formItems.push(formItem)}getFormItems(){return this.formItems}getFormItemByName(name){return this.formItemByName[name]}getInputByName(name){return this.formItemByName[name]}toJson(){return{formItems:this.getFormItems().map(formItem=>formItem.toJson())}}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,Form))return!1;let other=o;if(this.formItems.length!==other.formItems.length)return!1;for(let i=0;i<this.formItems.length;i++)if(!this.formItems[i].equals(other.formItems[i]))return!1;return!0}}let TextArea$1=class extends FormInputEl{static{__name(this,"TextArea")}constructor(name,originalValue){super("textarea","text-area",void 0,originalValue),this.getEl().setAttribute("name",name),this.onInput(()=>{this.refreshDirtyState(),this.refreshValueChanged()}),this.clone=new DivEl("autosize-clone").addClass(this.getEl().getAttribute("class")),this.attendant=new DivEl("autosize-attendant"),this.attendant.appendChild(this.clone),this.onAdded(()=>this.attendant.insertAfterEl(this)),this.onRendered(()=>this.updateSize()),this.onShown(()=>this.updateSize()),this.onFocus(()=>this.updateSize()),this.onValueChanged(()=>this.updateSize()),WindowDOM.get().onResized(()=>this.updateSize(),this)}setRows(rows){this.getEl().setAttribute("rows",rows.toString())}setColumns(columns){this.getEl().setAttribute("cols",columns.toString())}updateSize(){this.isRendered()&&(this.clone.getEl().setInnerHtml(this.getValue()+" "),this.getEl().setHeightPx(this.clone.getEl().getHeightWithBorder()))}updateValidationStatusOnUserInput(isValid){this.toggleClass("valid",isValid&&!StringHelper.isEmpty(this.getValue())),this.toggleClass("invalid",!isValid)}setEnabled(enable){super.setEnabled(enable),this.getEl().setDisabled(!enable)}};class Class{static{__name(this,"Class")}constructor(name,fn){this.name=name,this.fn=fn}getName(){return this.name}newInstance(constructorParams){try{return new this.fn(constructorParams)}catch{const newInstance=Object.create(this.fn.prototype);return newInstance.constructor.call(newInstance,constructorParams),newInstance}}}class ValueTypeConverter{static{__name(this,"ValueTypeConverter")}static{this.VALID_REFERENCE_ID_PATTERN=/^([a-z0-9A-Z_\-\.:])*$/}static convertTo(value,toType){if(value.getType()===toType)return value;if(toType===ValueTypes.DATA)return ValueTypeConverter.convertToData(value);if(toType===ValueTypes.STRING)return ValueTypeConverter.convertToString(value);if(toType===ValueTypes.XML)return ValueTypeConverter.convertToXml(value);if(toType===ValueTypes.LOCAL_DATE)return ValueTypeConverter.convertToLocalDate(value);if(toType===ValueTypes.LOCAL_TIME)return ValueTypeConverter.convertToLocalTime(value);if(toType===ValueTypes.LOCAL_DATE_TIME)return ValueTypeConverter.convertToLocalDateTime(value);if(toType===ValueTypes.DATE_TIME)return ValueTypeConverter.convertToDateTime(value);if(toType===ValueTypes.LONG)return ValueTypeConverter.convertToLong(value);if(toType===ValueTypes.BOOLEAN)return ValueTypeConverter.convertToBoolean(value.getObject());if(toType===ValueTypes.DOUBLE)return ValueTypeConverter.convertToDouble(value);if(toType===ValueTypes.GEO_POINT)return ValueTypeConverter.convertToGeoPoint(value);if(toType===ValueTypes.REFERENCE)return ValueTypeConverter.convertToReference(value);if(toType===ValueTypes.BINARY_REFERENCE)return ValueTypeConverter.convertToBinaryReference(value);throw Error(`Unknown ValueType: ${toType.toString()}`)}static convertToString(value){return value.getType()===ValueTypes.DATA?ValueTypes.STRING.newNullValue():ValueTypes.STRING.newValue(value.getString())}static convertToBoolean(value){return typeof value=="boolean"?ValueTypes.BOOLEAN.newBoolean(value):typeof value=="string"?ValueTypes.BOOLEAN.newValue(value):ValueTypes.BOOLEAN.newNullValue()}static convertToLong(value){return value.getType()===ValueTypes.STRING?ValueTypes.LONG.newValue(value.getString()):value.getType()===ValueTypes.DOUBLE?new Value(Math.floor(value.getDouble()),ValueTypes.LONG):value.getType()===ValueTypes.BOOLEAN?value.getBoolean()?ValueTypes.LONG.newValue("1"):ValueTypes.LONG.newValue("0"):ValueTypes.LONG.newNullValue()}static convertToDouble(value){return value.getType()===ValueTypes.STRING?ValueTypes.DOUBLE.newValue(value.getString()):value.getType()===ValueTypes.LONG?new Value(value.getLong(),ValueTypes.LONG):value.getType()===ValueTypes.BOOLEAN?value.getBoolean()?ValueTypes.DOUBLE.newValue("1"):ValueTypes.DOUBLE.newValue("0"):ValueTypes.DOUBLE.newNullValue()}static convertToGeoPoint(value){return value.getType()===ValueTypes.STRING?ValueTypes.GEO_POINT.newValue(value.getString()):ValueTypes.GEO_POINT.newNullValue()}static convertToReference(value){let str=value.getString();return str&&ValueTypeConverter.VALID_REFERENCE_ID_PATTERN.test(str)?ValueTypes.REFERENCE.newValue(value.getString()):ValueTypes.REFERENCE.newNullValue()}static convertToBinaryReference(value){return ValueTypes.BINARY_REFERENCE.newValue(value.getString())}static convertToXml(value){return ValueTypes.XML.newValue(value.getString())}static convertToData(value){return ValueTypes.DATA.isPropertySet(value)?new Value(value.getObject(),ValueTypes.DATA):new Value(new PropertySet,ValueTypes.DATA)}static convertToLocalDate(value){if(value.getType()===ValueTypes.STRING&&ValueTypes.LOCAL_DATE.isConvertible(value.getString()))return ValueTypes.LOCAL_DATE.newValue(value.getString());if(value.getType()===ValueTypes.LOCAL_DATE_TIME&&value.isNotNull()){let localDateTime=value.getString();return ValueTypes.LOCAL_DATE.newValue(localDateTime.substr(0,10))}else if(value.getType()===ValueTypes.DATE_TIME&&value.isNotNull()){let localDate=value.getString();return ValueTypes.LOCAL_DATE.newValue(localDate.substr(0,10))}return ValueTypes.LOCAL_DATE.newNullValue()}static convertToLocalDateTime(value){if(value.getType()===ValueTypes.STRING&&ValueTypes.LOCAL_DATE_TIME.isConvertible(value.getString()))return ValueTypes.LOCAL_DATE_TIME.newValue(value.getString());if(value.getType()===ValueTypes.LOCAL_DATE&&value.isNotNull()){let localDate=value.getObject();return new Value(LocalDateTime.fromString(localDate.toString()+"T00:00:00"),ValueTypes.LOCAL_DATE_TIME)}else if(value.getType()===ValueTypes.DATE_TIME&&value.isNotNull()){let dateTime=value.getString();return ValueTypes.LOCAL_DATE_TIME.newValue(dateTime.substr(0,19))}return ValueTypes.LOCAL_DATE_TIME.newNullValue()}static convertToDateTime(value){if(value.getType()===ValueTypes.STRING&&ValueTypes.DATE_TIME.isConvertible(value.getString()))return ValueTypes.DATE_TIME.newValue(value.getString());if(value.getType()===ValueTypes.LOCAL_DATE&&value.isNotNull())return ValueTypes.DATE_TIME.newValue(value.getString()+"T00:00:00+00:00");if(value.getType()===ValueTypes.LOCAL_DATE_TIME&&value.isNotNull()){let dateTime=value.getString();return ValueTypes.DATE_TIME.newValue(dateTime)}return ValueTypes.DATE_TIME.newNullValue()}static convertToLocalTime(value){if(value.getType()===ValueTypes.STRING&&ValueTypes.LOCAL_TIME.isConvertible(value.getString()))return ValueTypes.LOCAL_TIME.newValue(value.getString());if(value.getType()===ValueTypes.LOCAL_DATE_TIME&&value.isNotNull()){let localDateTime=value.getObject();return ValueTypes.LOCAL_TIME.newValue(localDateTime.getHours()+":"+localDateTime.getMinutes()+":"+localDateTime.getSeconds())}else if(value.getType()===ValueTypes.DATE_TIME&&value.isNotNull()){let dateTime=value.getObject();return ValueTypes.LOCAL_TIME.newValue(dateTime.getHours()+":"+dateTime.getMinutes()+":"+dateTime.getSeconds())}return ValueTypes.LOCAL_TIME.newNullValue()}static convertArrayValues(propertyArray,newType){propertyArray.convertValues(newType,ValueTypeConverter.convertTo)}static convertPropertyValueType(property,newType){property.convertValueType(newType,ValueTypeConverter.convertTo)}}class Locale{static{__name(this,"Locale")}static{this.TH="th-TH-u-nu-thai-x-lvariant-TH"}static{this.TH_TAG="th-TH-TH"}static{this.JP="ja-JP-u-ca-japanese-x-lvariant-JP"}static{this.JP_TAG="ja-JP-JP"}static{this.NO="nn-NO-x-lvariant-NY"}static{this.NO_TAG="nn-NO-NY"}static{this.RTL_CODES=["ar","dv","fa","ha","he","ks","ku","ps","sd","ur","yi"]}static supportsRtl(code){return ObjectHelper.isDefined(code)&&(Locale.RTL_CODES.indexOf(Locale.extractLanguage(code))>-1||Locale.isSubsetOf(code,"arab"))}static isSubsetOf(code,langFamily){return code.split("-")[1]?.toLowerCase()===langFamily.toLowerCase()}static extractLanguage(value){return value.split("-")[0]}static fromJson(json){let l=new Locale;return l.tag=json.tag,l.displayName=json.displayName,l.country=json.country,l.displayCountry=json.displayCountry,l.variant=json.variant,l.displayVariant=json.displayVariant,l.language=json.language,l.displayLanguage=json.displayLanguage,l}equals(other){if(!ObjectHelper.iFrameSafeInstanceOf(other,Locale))return!1;let o=other;return this.tag===o.tag&&this.displayName===o.displayName&&this.language===o.language&&this.displayLanguage===o.displayLanguage&&this.variant===o.variant&&this.displayVariant===o.displayVariant&&this.country===o.displayCountry&&this.displayCountry===o.displayCountry}getTag(){return this.tag}getId(){return this.tag==="nn-NO"&&this.variant==="NY"?Locale.NO:this.tag}getProcessedTag(){return this.tag===Locale.JP?Locale.JP_TAG:this.tag===Locale.TH?Locale.TH_TAG:this.tag==="nn-NO"&&this.variant==="NY"?Locale.NO_TAG:this.tag}getDisplayName(){return this.displayName}getLanguage(){return this.language}getDisplayLanguage(){return this.displayLanguage}getVariant(){return this.variant}getDisplayVariant(){return this.displayVariant}getCountry(){return this.country}getDisplayCountry(){return this.displayCountry}}class AdditionalValidationRecord{static{__name(this,"AdditionalValidationRecord")}constructor(builder){this.message=builder.message,this.custom=builder.custom||!1}static create(){return new Builder}getMessage(){return this.message}isCustom(){return this.custom}equals(that){return this.message===that.message&&this.custom===that.custom}}class Builder{static{__name(this,"Builder")}setMessage(value){return this.message=value,this}setCustom(value){return this.custom=value,this}build(){return new AdditionalValidationRecord(this)}}class InputValidationRecording{static{__name(this,"InputValidationRecording")}constructor(occurrences,totalValid){this.occurrences=occurrences,this.totalValid=totalValid}isValid(){return!this.errorMessage&&this.totalValid>=this.occurrences.getMinimum()&&!this.occurrences.maximumBreached(this.totalValid)}getOccurrences(){return this.occurrences}isMinimumOccurrencesBreached(){return this.totalValid<this.occurrences.getMinimum()}isMaximumOccurrencesBreached(){return this.occurrences.maximumBreached(this.totalValid)}setErrorMessage(value){this.errorMessage=value}hasErrorMessage(){return!StringHelper.isBlank(this.errorMessage)}getErrorMessage(){return this.errorMessage}equals(that){return this.isValid()===that.isValid()&&this.errorMessage==that.errorMessage}validityChanged(other){return other==null||other==null||!other.equals(this)}}class InputValidityChangedEvent{static{__name(this,"InputValidityChangedEvent")}constructor(recording){this.recording=recording}isValid(){return this.recording.isValid()}getRecording(){return this.recording}}class BaseInputType extends DivEl{static{__name(this,"BaseInputType")}constructor(context,className){super("input-type-view"+(className?" "+className:"")),this.inputValidityChangedListeners=[],this.context=context,this.readInputConfig()}readInputConfig(){}availableSizeChanged(){}displayValidationErrors(){}getElement(){return this}isValidationErrorToBeRendered(){return!0}getInputValidationRecording(){return this.previousValidationRecording}getInput(){return this.input}hasValidUserInput(){return!0}isManagingAdd(){return!1}layout(input,propertyArray){return this.input=input,Q(null)}newInitialValue(){throw new Error("Must be overridden by inheritor: "+ClassHelper.getClassName(this))}onValidityChanged(listener){this.inputValidityChangedListeners.push(listener)}unValidityChanged(listener){this.inputValidityChangedListeners.filter(currentListener=>listener===currentListener)}notifyValidityChanged(event){this.inputValidityChangedListeners.forEach(listener=>{listener(event)})}hideValidationDetailsByDefault(){return!1}refresh(){}reset(){throw Error("Must be implemented in inheritors")}clear(){this.previousValidationRecording=null}setEnabled(enable){}validate(silent){}getAiConfig(){return{aiTools:new Set}}}class InputOccurrence extends FormItemOccurrence{static{__name(this,"InputOccurrence")}constructor(inputOccurrences,index){super(inputOccurrences,index,inputOccurrences.getInput().getOccurrences())}}const AI_TOOL_REGISTRY_KEY="AiHelper";class AiToolsRegistry{static{__name(this,"AiToolsRegistry")}constructor(){this.tools=new Set}static get(){return Store.instance().has(AI_TOOL_REGISTRY_KEY)||Store.instance().set(AI_TOOL_REGISTRY_KEY,new AiToolsRegistry),Store.instance().get(AI_TOOL_REGISTRY_KEY)}getTools(){return this.tools}add(tool){this.tools.add(tool)}remove(tool){this.tools.delete(tool)}}class AiTool{static{__name(this,"AiTool")}constructor(type,config){this.type=type,this.config=config,AiToolsRegistry.get().add(this),this.initListeners()}getPropertyPath(){return this.config.getPath()}getDataPath(){return this.getPropertyPath()?.toString().replace(/\./g,"/")??""}getGroup(){return this.config.group}getType(){return this.type}initListeners(){this.config.pathElement.onRemoved(()=>{this.cleanup()})}cleanup(){AiToolsRegistry.get().remove(this)}}var RGBColor;(function(RGBColor2){RGBColor2.BLUE="147 197 253",RGBColor2.GREEN="22 163 74"})(RGBColor||(RGBColor={}));class AiAnimationHandler{static{__name(this,"AiAnimationHandler")}static glow(element,color=RGBColor.BLUE){element.getHTMLElement().animate([{boxShadow:`0 0 0px rgb(${color})`,offset:0},{boxShadow:`0 0 12px rgb(${color})`,offset:.33},{boxShadow:`0 0 18px rgb(${color} / 30%)`,offset:.66},{boxShadow:`0 0 24px rgb(${color} / 0%)`,offset:1}],{duration:300})}static innerGlow(element,color=RGBColor.BLUE){element.getHTMLElement().animate([{boxShadow:`inset 0 0 0px rgb(${color})`,offset:0},{boxShadow:`inset 0 0 4px rgb(${color})`,offset:.33},{boxShadow:`inset 0 0 8px rgb(${color} / 30%)`,offset:.66},{boxShadow:`inset 0 0 12px rgb(${color} / 0%)`,offset:1}],{duration:300})}static scroll(element){element.getHTMLElement().scrollIntoView({behavior:"instant",block:"center"})}}class AiAnimationTool extends AiTool{static{__name(this,"AiAnimationTool")}constructor(config){super(AiToolType.ANIMATE,config)}animate(animationEffects,color){(Array.isArray(animationEffects)?animationEffects:[animationEffects]).forEach(effect=>{effect==="glow"?AiAnimationHandler.glow(this.config.pathElement,color):effect==="innerGlow"?AiAnimationHandler.innerGlow(this.config.pathElement,color):effect==="scroll"&&AiAnimationHandler.scroll(this.config.pathElement)})}}class AiContentOperatorOpenDialogEvent extends Event$1{static{__name(this,"AiContentOperatorOpenDialogEvent")}constructor(dataPath){super(),this.sourceDataPath=dataPath}getSourceDataPath(){return this.sourceDataPath}static on(handler){Event$1.bind(ClassHelper.getFullName(this),handler)}static un(handler){Event$1.unbind(ClassHelper.getFullName(this),handler)}}class AiDialogControl extends Button{static{__name(this,"AiDialogControl")}constructor(dataPath){super(),this.dataPath=dataPath,this.initListeners()}setDataPath(dataPath){return this.dataPath=dataPath,this}setActive(active){return this.toggleClass("active",!!active),this}setHasActiveDescendant(hasActiveDescendant){return this.toggleClass("has-active-descendant",!!hasActiveDescendant),this}getDataPath(){return this.dataPath}initListeners(){this.onClicked(event=>{this.dataPath&&(event.stopPropagation(),new AiContentOperatorOpenDialogEvent(this.dataPath).fire())})}doRender(){return super.doRender().then(rendered=>(this.addClass("ai-dialog-control").setTitle(i18n("ai.action.contentOperator.use"),!1),rendered))}}class AiContentOperatorSetContextEvent extends Event$1{static{__name(this,"AiContentOperatorSetContextEvent")}constructor(dataPath){super(),this.sourceDataPath=dataPath}getSourceDataPath(){return this.sourceDataPath}static on(handler){Event$1.bind(ClassHelper.getFullName(this),handler)}static un(handler){Event$1.unbind(ClassHelper.getFullName(this),handler)}}const AI_ICONS_REGISTRY_KEY="AiIcons";class AiDialogIconTool extends AiTool{static{__name(this,"AiDialogIconTool")}constructor(config){super(AiToolType.DIALOG,config)}initListeners(){super.initListeners(),this.setupAiIcon()}setupAiIcon(){const aiIcon=this.getOrCreateAiIcon(),isContextToBeSetOnFocus=!!this.config.setContextOnFocus;return this.config.pathElement.onFocusIn(()=>{const dataPath=this.getDataPath();aiIcon.setDataPath(this.getDataPath()).addClass("input-focused"),isContextToBeSetOnFocus&&new AiContentOperatorSetContextEvent(dataPath).fire()}),this.config.pathElement.onFocusOut(()=>aiIcon.removeClass("input-focused")),aiIcon}getOrCreateAiIcon(){if(AiDialogIconTool.getOrCreateIconsRegistry().has(this.config.aiButtonContainer))return AiDialogIconTool.getOrCreateIconsRegistry().get(this.config.aiButtonContainer);const aiIcon=new AiDialogControl(this.getDataPath());return this.config.aiButtonContainer.appendChild(aiIcon),AiDialogIconTool.getOrCreateIconsRegistry().set(this.config.aiButtonContainer,aiIcon),aiIcon}static getOrCreateIconsRegistry(){return Store.instance().has(AI_ICONS_REGISTRY_KEY)||Store.instance().set(AI_ICONS_REGISTRY_KEY,new WeakMap),Store.instance().get(AI_ICONS_REGISTRY_KEY)}setActiveContext(context){const icon=AiDialogIconTool.getOrCreateIconsRegistry().get(this.config.aiButtonContainer),thisPath=this.getDataPath();icon?.setActive(!!context&&(icon.getDataPath()===context||thisPath===context)),icon?.setHasActiveDescendant(context?.startsWith(icon.getDataPath())&&thisPath!==context)}}var AiHelperState;(function(AiHelperState2){AiHelperState2.DEFAULT="default",AiHelperState2.PROCESSING="processing",AiHelperState2.COMPLETED="completed",AiHelperState2.FAILED="failed"})(AiHelperState||(AiHelperState={}));class AiStateControl extends DivEl{static{__name(this,"AiStateControl")}constructor(){super(),this.setState(AiHelperState.DEFAULT)}setState(state){return this.setClass(`ai-state-control ${state}`),this}}class AiStateTool extends AiTool{static{__name(this,"AiStateTool")}constructor(config){super(AiToolType.STATE,config),this.state=AiHelperState.DEFAULT,this.aiStateControl=new AiStateControl,config.stateContainer.appendChild(this.aiStateControl)}setState(state,data){return state===this.state?this:(this.state=state,this.aiStateControl?.setState(state),state===AiHelperState.COMPLETED?(this.resetToDefaultAfterDelay(1e3),this.toggleProcessing(!1)):state===AiHelperState.PROCESSING?this.toggleProcessing(!0):state===AiHelperState.FAILED&&(this.toggleProcessing(!1),this.handleStateClick(),this.aiStateControl?.setTitle(data?.text||"")),this)}resetToDefaultAfterDelay(delay){setTimeout(()=>{this.state===AiHelperState.COMPLETED&&this.setState(AiHelperState.DEFAULT)},delay)}toggleProcessing(isProcessing){this.config.pathElement.getEl().setDisabled(isProcessing),this.config.pathElement.toggleClass("ai-helper-mask",isProcessing),this.aiStateControl?.getEl().removeAttribute("title"),isProcessing?this.updateTitle():this.resetTitle()}handleStateClick(){const clickHandler=__name(()=>{this.aiStateControl?.unClicked(clickHandler),this.setState(AiHelperState.DEFAULT)},"clickHandler");this.aiStateControl?.onClicked(clickHandler)}updateTitle(){const parent2=this.config.pathElement.getEl().getParent();parent2.hasAttribute("title")&&!parent2.hasAttribute("data-title")&&parent2.setAttribute("data-title",parent2.getTitle()),parent2.setTitle(i18n("ai.field.processing",this.config.label))}resetTitle(){const parent2=this.config.pathElement.getEl().getParent();parent2.removeAttribute("title"),parent2.hasAttribute("data-title")&&parent2.setTitle(parent2.getAttribute("data-title"))}}class InputOccurrenceView extends FormItemOccurrenceView{static{__name(this,"InputOccurrenceView")}static{this.debug=!1}constructor(inputOccurrence,baseInputTypeView,property){super({className:"input-occurrence-view",formItemOccurrence:inputOccurrence,inputTypeView:baseInputTypeView,property}),this.refresh()}initElements(){super.initElements(),this.inputTypeView=this.config.inputTypeView,this.property=this.config.property,this.inputWrapper=new DivEl("input-wrapper"),this.inputElement=this.inputTypeView.createInputOccurrenceElement(this.formItemOccurrence.getIndex(),this.property),this.dragControl=new DivEl("drag-control"),this.validationErrorBlock=new DivEl("error-block"),this.removeButtonEl=new ButtonEl}layout(_validate=!0){return super.layout(_validate).then(()=>{const dataBlock=new DivEl("data-block");return this.appendChild(dataBlock),dataBlock.appendChild(this.dragControl),dataBlock.appendChild(this.inputWrapper),this.inputWrapper.prependChild(this.inputElement),dataBlock.appendChild(this.removeButtonEl),this.appendChild(this.validationErrorBlock),this.removeButtonEl.addClass("remove-button"),Q(null)})}update(property,unchangedOnly){return this.registerProperty(property),this.inputTypeView.updateInputOccurrenceElement(this.inputElement,property,unchangedOnly),Q(null)}reset(){this.inputTypeView.resetInputOccurrenceElement(this.inputElement)}clear(){super.clear(),this.inputTypeView.clearInputOccurrenceElement(this.inputElement)}setEnabled(enable){this.inputTypeView.setEnabledInputOccurrenceElement(this.inputElement,enable),this.removeButtonEl.setEnabled(enable)}refresh(){this.formItemOccurrence.oneAndOnly()?(this.addClass("single-occurrence").removeClass("multiple-occurrence"),this.inputTypeView.removeClass("has-multiple-occurrence")):(this.addClass("multiple-occurrence").removeClass("single-occurrence"),this.inputTypeView.addClass("has-multiple-occurrence")),this.removeButtonEl.setVisible(this.formItemOccurrence.isRemoveButtonRequiredStrict())}getDataPath(){return this.property.getPath()}getIndex(){return this.formItemOccurrence.getIndex()}getInputElement(){return this.inputElement}hasValidUserInput(){return this.inputTypeView.isUserInputValid(this.inputElement)}giveFocus(){return this.inputElement.giveFocus()}onFocus(listener){this.inputElement.onFocus(listener)}unFocus(listener){this.inputElement.unFocus(listener)}onBlur(listener){this.inputElement.onBlur(listener)}unBlur(listener){this.inputElement.unBlur(listener)}initListeners(){super.initListeners();let ignorePropertyChange=!1;this.occurrenceValueChangedHandler=(occurrence,value)=>{this.inputElement===occurrence&&(InputOccurrenceView.debug,ignorePropertyChange=!0,this.property.setValue(value),ignorePropertyChange=!1)},this.onAdded(()=>{this.inputTypeView.onOccurrenceValueChanged(this.occurrenceValueChangedHandler)}),this.propertyValueChangedHandler=event=>{const changedProperty=event.getProperty();ignorePropertyChange||(InputOccurrenceView.debug,this.inputTypeView.updateInputOccurrenceElement(this.inputElement,changedProperty,!event.isForce()))},this.onRemoved(()=>{this.property&&this.property.unPropertyValueChanged(this.propertyValueChangedHandler),this.inputTypeView&&this.inputTypeView.unOccurrenceValueChanged(this.occurrenceValueChangedHandler)}),this.removeButtonEl.onClicked(event=>(this.notifyRemoveButtonClicked(),event.stopPropagation(),event.preventDefault(),!1)),this.property.onPropertyValueChanged(this.propertyValueChangedHandler),this.initAiFunctionality()}initAiFunctionality(){this.inputTypeView.getAiConfig().aiTools.forEach(aiTool=>this.addAiTool(aiTool))}addAiTool(aiTool){if(aiTool===AiToolType.STATE){new AiStateTool({stateContainer:this.inputWrapper,label:this.inputTypeView.getInput().getLabel(),pathElement:this.inputElement,getPath:__name(()=>this.getDataPath(),"getPath"),group:this.inputTypeView.getAiConfig().group});return}if(aiTool===AiToolType.DIALOG){new AiDialogIconTool({group:this.inputTypeView.getAiConfig().group,getPath:__name(()=>this.getDataPath(),"getPath"),pathElement:this.inputElement,aiButtonContainer:this.inputTypeView,setContextOnFocus:!0});return}if(aiTool===AiToolType.ANIMATE){new AiAnimationTool({group:this.inputTypeView.getAiConfig().group,getPath:__name(()=>this.getDataPath(),"getPath"),pathElement:this.inputElement});return}}registerProperty(property){this.property&&(InputOccurrenceView.debug,this.property.unPropertyValueChanged(this.propertyValueChangedHandler)),property&&(InputOccurrenceView.debug,property.onPropertyValueChanged(this.propertyValueChangedHandler)),this.property=property}displayValidationError(occurrenceValidationRecord){const errorMessage=occurrenceValidationRecord?.getAdditionalValidationRecords()[0]?.getMessage()||"";this.validationErrorBlock.setHtml(errorMessage),this.toggleClass("invalid",!!errorMessage)}}class InputOccurrencesBuilder{static{__name(this,"InputOccurrencesBuilder")}setBaseInputTypeView(value){return this.baseInputTypeView=value,this}setInput(value){return this.input=value,this}setPropertyArray(value){return this.propertyArray=value,this}build(){return new InputOccurrences(this)}}class InputOccurrences extends FormItemOccurrences{static{__name(this,"InputOccurrences")}constructor(config){super({formItem:config.input,propertyArray:config.propertyArray,occurrenceViewContainer:config.baseInputTypeView,allowedOccurrences:config.input.getOccurrences()}),this.baseInputTypeView=config.baseInputTypeView,this.input=config.input}static create(){return new InputOccurrencesBuilder}hasValidUserInput(){return this.getOccurrenceViews().every(occurrenceView=>occurrenceView.hasValidUserInput())}moveOccurrence(fromIndex,toIndex){super.moveOccurrence(fromIndex,toIndex)}getInput(){return this.input}getAllowedOccurrences(){return this.input.getOccurrences()}createOccurrence(formItemOccurrences,insertAtIndex){return new InputOccurrence(formItemOccurrences,insertAtIndex)}createOccurrenceView(occurrence){const property=this.getOrPopulatePropertyFromArray(occurrence.getIndex()),inputOccurrenceView=new InputOccurrenceView(occurrence,this.baseInputTypeView,property);return inputOccurrenceView.onRemoveButtonClicked(event=>{this.removeOccurrenceView(event.getView())}),inputOccurrenceView}updateOccurrenceView(occurrenceView,unchangedOnly){const property=this.getOrPopulatePropertyFromArray(occurrenceView.getIndex());return occurrenceView.update(property,unchangedOnly)}giveFocus(){return this.getOccurrenceViews().some(view=>view.giveFocus())}getOrPopulatePropertyFromArray(index){let property=this.propertyArray.get(index);if(!property){const newInitialValue=this.baseInputTypeView.newInitialValue();assertNotNull(newInitialValue,"InputTypeView-s extending BaseInputTypeNotManagingAdd must must return a Value from newInitialValue"),property=this.propertyArray.add(newInitialValue)}return property}}class OccurrenceValidationRecord{static{__name(this,"OccurrenceValidationRecord")}constructor(){this.breaksRequiredContract=!1,this.additionalValidation=[]}setBreaksRequiredContract(value){this.breaksRequiredContract=value}isRequiredContractBroken(){return this.breaksRequiredContract}isValueValid(){return this.additionalValidation.length===0}isValid(){return!this.isRequiredContractBroken()&&this.isValueValid()}getAdditionalValidationRecords(){return this.additionalValidation}addAdditionalValidation(record){this.additionalValidation.push(record)}}class BaseInputTypeNotManagingAdd extends BaseInputType{static{__name(this,"BaseInputTypeNotManagingAdd")}static{this.debug=!1}constructor(context,className){super(context,className),this.occurrenceValidationState=new Map,this.occurrenceValueChangedListeners=[],assertNotNull(context,"context cannot be null"),$(this.getHTMLElement()).sortable({axis:"y",containment:"parent",handle:".drag-control",tolerance:"pointer",start:__name((_event,ui)=>this.handleDnDStart(ui),"start"),stop:__name((_event,ui)=>this.handleDnDStop(ui),"stop"),update:__name((_event,ui)=>this.handleDnDUpdate(ui),"update")})}handleDnDStart(ui){let draggedElement=Element.fromHtmlElement(ui.item[0]);this.draggingIndex=draggedElement.getSiblingIndex(),ui.placeholder.text("Drop form item set here")}handleDnDStop(_ui){}handleDnDUpdate(ui){if(this.draggingIndex>=0){let draggedToIndex=Element.fromHtmlElement(ui.item[0]).getSiblingIndex();this.inputOccurrences.moveOccurrence(this.draggingIndex,draggedToIndex)}this.draggingIndex=-1}getContext(){return this.context}isManagingAdd(){return!1}onOccurrenceAdded(listener){this.inputOccurrences.onOccurrenceAdded(listener)}onOccurrenceRendered(listener){this.inputOccurrences.onOccurrenceRendered(listener)}onOccurrenceRemoved(listener){this.inputOccurrences.onOccurrenceRemoved(listener)}unOccurrenceAdded(listener){this.inputOccurrences.unOccurrenceAdded(listener)}unOccurrenceRendered(listener){this.inputOccurrences.onOccurrenceRendered(listener)}unOccurrenceRemoved(listener){this.inputOccurrences.unOccurrenceRemoved(listener)}onOccurrenceValueChanged(listener){this.occurrenceValueChangedListeners.push(listener)}unOccurrenceValueChanged(listener){this.occurrenceValueChangedListeners=this.occurrenceValueChangedListeners.filter(curr=>curr!==listener)}onValueChanged(_listener){throw new Error("User onOccurrenceValueChanged instead")}unValueChanged(_listener){throw new Error("User onOccurrenceValueChanged instead")}maximumOccurrencesReached(){return this.inputOccurrences.maximumOccurrencesReached()}createAndAddOccurrence(){this.inputOccurrences.addNewOccurrence()}layout(input,propertyArray){return super.layout(input,propertyArray).then(()=>(this.propertyArray=propertyArray,this.inputOccurrences=InputOccurrences.create().setBaseInputTypeView(this).setInput(this.input).setPropertyArray(propertyArray).build(),this.onAdded(()=>{this.onOccurrenceAdded(event=>{$(this.getHTMLElement()).sortable("refresh"),this.validateOccurrence(event.getOccurrenceView()),this.updateValidationRecordAndNotifyIfChanged()}),this.onOccurrenceRemoved(event=>{this.occurrenceValidationState.delete(event.getOccurrenceView().getInputElement().getId()),this.updateValidationRecordAndNotifyIfChanged()})}),this.inputOccurrences.layout().then(()=>{$(this.getHTMLElement()).sortable("refresh")})))}update(propertyArray,unchangedOnly){return this.propertyArray=propertyArray,this.inputOccurrences?.update(propertyArray,unchangedOnly)}reset(){this.inputOccurrences.reset()}clear(){super.clear(),this.inputOccurrences.clear()}setEnabled(enable){this.inputOccurrences.setEnabled(enable)}hasValidUserInput(){return this.inputOccurrences.hasValidUserInput()}handleOccurrenceInputValueChanged(inputEl,data){this.validateUserInput(inputEl);const value=this.getValue(inputEl,data);this.validateRequiredContract(inputEl,value),this.notifyOccurrenceValueChanged(inputEl,value),this.displayValidationErrors(),this.updateValidationRecordAndNotifyIfChanged()}isUserInputValid(_inputElement){return this.occurrenceValidationState.has(_inputElement.getId())?this.occurrenceValidationState.get(_inputElement.getId()).isValueValid():!0}validateUserInput(inputEl){this.occurrenceValidationState.set(inputEl.getId(),new OccurrenceValidationRecord),this.doValidateUserInput(inputEl)}doValidateUserInput(inputEl){}validateRequiredContract(inputEl,value){this.occurrenceValidationState.get(inputEl.getId()).setBreaksRequiredContract(this.valueBreaksRequiredContract(value))}onFocus(listener){this.inputOccurrences.onFocus(listener)}unFocus(listener){this.inputOccurrences.unFocus(listener)}onBlur(listener){this.inputOccurrences.onBlur(listener)}unBlur(listener){this.inputOccurrences.unBlur(listener)}displayValidationErrors(){this.inputOccurrences.getOccurrenceViews().forEach(view=>view.displayValidationError(this.occurrenceValidationState.get(view.getInputElement().getId())))}validate(silent=!0){this.validateOccurrences(),silent?this.updateValidationRecord():this.updateValidationRecordAndNotifyIfChanged()}getTotalValidOccurrences(){let totalValid=0;return this.occurrenceValidationState.forEach(occurrenceValidationRecord=>{occurrenceValidationRecord.isValid()&&totalValid++}),totalValid}updateValidationRecordAndNotifyIfChanged(){const totalValid=this.getTotalValidOccurrences(),hasCustomError=this.hasCustomError(),newValidationRecord=new InputValidationRecording(this.input.getOccurrences(),totalValid);hasCustomError&&newValidationRecord.setErrorMessage(i18n("field.occurrence.invalid")),newValidationRecord.validityChanged(this.previousValidationRecording)&&this.notifyValidityChanged(new InputValidityChangedEvent(newValidationRecord)),this.previousValidationRecording=newValidationRecord}hasCustomError(){let hasCustomError=!1;return this.occurrenceValidationState.forEach(occurrenceValidationRecord=>{occurrenceValidationRecord.getAdditionalValidationRecords().some(rec=>rec.isCustom())&&(hasCustomError=!0)}),hasCustomError}updateValidationRecord(){const newValidationRecord=new InputValidationRecording(this.input.getOccurrences(),this.getTotalValidOccurrences());this.previousValidationRecording=newValidationRecord}valueBreaksRequiredContract(value){return value.isNull()||!value.getType().equals(this.getValueType())}updateInputOccurrenceElement(_occurrence,_property,_unchangedOnly){const formInputEl=ObjectHelper.iFrameSafeInstanceOf(_occurrence,FormInputEl)?_occurrence:ObjectHelper.iFrameSafeInstanceOf(_occurrence.getFirstChild(),FormInputEl)?_occurrence.getFirstChild():null;formInputEl&&(!_unchangedOnly||!formInputEl.isDirty()?this.updateFormInputElValue(formInputEl,_property):formInputEl.isDirty()&&formInputEl.forceChangedEvent())}resetInputOccurrenceElement(_occurrence){this.occurrenceValidationState.delete(_occurrence.getId())}clearInputOccurrenceElement(_occurrence){this.occurrenceValidationState.delete(_occurrence.getId())}newInitialValue(){return this.input?.getDefaultValue()||this.newValueTypeInitialValue()}newValueTypeInitialValue(){return this.getValueType().newNullValue()}giveFocus(){return this.inputOccurrences?this.inputOccurrences.giveFocus():!1}notifyOccurrenceValueChanged(occurrence,value){this.occurrenceValueChangedListeners.forEach(listener=>{listener(occurrence,value)})}getPropertyValue(property){return property.hasNonNullValue()?property.getString():""}updateFormInputElValue(_occurrence,_property){throw new Error("Must be implemented by inheritor: "+ClassHelper.getClassName(this))}hideValidationDetailsByDefault(){return!0}validateOccurrences(){this.inputOccurrences.getOccurrenceViews().forEach(occurrenceView=>{this.validateOccurrence(occurrenceView)})}validateOccurrence(occurrenceView){const value=this.propertyArray.getValue(occurrenceView.getIndex());if(value){const inputEl=occurrenceView.getInputElement();this.validateUserInput(inputEl),this.validateRequiredContract(inputEl,value),this.validateCustomErrors(occurrenceView)}}validateCustomErrors(occurrenceView){if(this.context.formContext?.getFormState()?.isNew())return;const occurrenceDataPath=occurrenceView.getDataPath().asRelative().toString(),occurrenceId=occurrenceView.getInputElement().getId();this.getContext().formContext.getValidationErrors().forEach(error=>{occurrenceDataPath===error.getPropertyPath()&&(occurrenceView.getInputElement().addClass("invalid"),occurrenceView.getInputElement().removeClass("valid"),this.occurrenceValidationState.get(occurrenceId).addAdditionalValidation(AdditionalValidationRecord.create().setMessage(error.getMessage()).setCustom(!0).build()))})}}class InputValueLengthCounterEl extends DivEl{static{__name(this,"InputValueLengthCounterEl")}constructor(inputEl,maxLength,showCounter){super("length-counter"),this.inputEl=inputEl,this.maxLength=maxLength,this.showTotalCounter=showCounter,this.totalCounter=new SpanEl("total-counter"),this.leftCounter=new SpanEl("left-counter"),this.initListeners()}initListeners(){this.inputEl.onValueChanged(()=>{this.updateLengthCountersValues()}),this.inputEl.onRendered(()=>{this.inputEl.getParentElement().appendChild(this),this.updateLengthCountersValues()})}updateLengthCountersValues(){const value=this.inputEl.getValue();if(this.showTotalCounter&&this.totalCounter.setHtml(i18n("field.value.chars.total",value.length)),this.hasMaxLengthSet()){const charsAllowed=this.maxLength-value.length;this.leftCounter.toggleClass("chars-left",charsAllowed>-1);const textVersion=this.showTotalCounter?"short":"long";this.leftCounter.setHtml(i18n(`field.value.chars.left.${textVersion}`,charsAllowed))}}hasMaxLengthSet(){return this.maxLength>-1}doRender(){return super.doRender().then(rendered=>{const separator=new SpanEl("separator").setHtml("/");return this.appendChildren(this.totalCounter,separator,this.leftCounter),rendered})}}class TextInputType extends BaseInputTypeNotManagingAdd{static{__name(this,"TextInputType")}constructor(config){super(config),this.readConfig(config.inputConfig)}getValueType(){return ValueTypes.STRING}readConfig(inputConfig){const maxLengthConfig=inputConfig.maxLength?inputConfig.maxLength[0]:{},maxLength=NumberHelper.toNumber(maxLengthConfig.value);this.maxLength=maxLength>0?maxLength:-1;const value=(inputConfig.showCounter?inputConfig.showCounter[0]:{}).value||"";this.showTotalCounter=value.toLowerCase()==="true"}updateFormInputElValue(occurrence,property){occurrence.setValue(property.getString())}resetInputOccurrenceElement(occurrence){super.resetInputOccurrenceElement(occurrence),occurrence.resetBaseValues()}clearInputOccurrenceElement(occurrence){super.clearInputOccurrenceElement(occurrence),this.hasDefaultValue(occurrence)||occurrence.clear()}hasDefaultValue(occurrence){const value=occurrence.getValue();return value&&value===this.newInitialValue().getString()}initOccurrenceListeners(inputEl){(this.hasMaxLengthSet()||this.showTotalCounter)&&new InputValueLengthCounterEl(inputEl,this.maxLength,this.showTotalCounter),inputEl.onValueChanged(event=>{this.handleOccurrenceInputValueChanged(inputEl)})}createInputOccurrenceElement(index,property){this.getValueType().equals(property.getType())||ValueTypeConverter.convertPropertyValueType(property,this.getValueType());const inputEl=this.createInput(index,property).setSpellcheck(!0);return this.updateInputLangParams(inputEl),this.initOccurrenceListeners(inputEl),inputEl}updateInputLangParams(inputEl){const locale=this.getContext().formContext.getLanguage();if(!StringHelper.isEmpty(locale)){const language=Locale.extractLanguage(locale);inputEl.setLang(language),Locale.supportsRtl(language)&&inputEl.setDir(LangDirection.RTL)}}getValue(inputEl){return this.isUserInputValid(inputEl)?this.getValueType().newValue(inputEl.getValue()):this.newInitialValue()}valueBreaksRequiredContract(value){return super.valueBreaksRequiredContract(value)||StringHelper.isBlank(value.getString())}doValidateUserInput(inputEl){super.doValidateUserInput(inputEl),this.validateInputLength(inputEl),this.validateTextInput(inputEl),this.updateValidationStatusOnUserInput(inputEl,this.occurrenceValidationState.get(inputEl.getId()).isValueValid())}validateTextInput(inputEl){}validateInputLength(inputEl){if(!this.isValidMaxLength(inputEl.getValue())){const record=AdditionalValidationRecord.create().setMessage(i18n("field.value.breaks.maxlength",this.maxLength)).build();this.occurrenceValidationState.get(inputEl.getId()).addAdditionalValidation(record)}}isValidMaxLength(value){return this.hasMaxLengthSet()?value.length<=this.maxLength:!0}hasMaxLengthSet(){return this.maxLength>-1}doRender(){return super.doRender().then(rendered=>(this.addClass("text-input-type"),this.hasMaxLengthSet()&&this.addClass("max-length-limited"),this.showTotalCounter&&this.addClass("show-counter"),rendered))}getAiConfig(){const formContext=this.getContext().formContext;return formContext?{group:formContext.getName(),aiTools:formContext.getAiTools()}:super.getAiConfig()}}class TextArea2 extends TextInputType{static{__name(this,"TextArea")}constructor(config){super(config),this.readConfig(config.inputConfig)}static getName(){return new InputTypeName("TextArea",!1)}createInput(index,property){const value=property.hasNonNullValue()?property.getString():void 0,inputEl=new TextArea$1(this.getInput().getName()+"-"+index,value);return inputEl.setSpellcheck(!0),inputEl}updateValidationStatusOnUserInput(inputEl,isValid){inputEl.updateValidationStatusOnUserInput(isValid)}setEnabledInputOccurrenceElement(occurrence,enable){occurrence.setEnabled(enable)}}InputTypeManager.register(new Class(TextArea2.getName().getName(),TextArea2),!0);class ImageComponentType extends ComponentType{static{__name(this,"ImageComponentType")}static{this.INSTANCE=new ImageComponentType}constructor(){super("image")}static get(){return ImageComponentType.INSTANCE}}class ApplicationBasedName{static{__name(this,"ApplicationBasedName")}static{this.SEPARATOR=":"}constructor(applicationKey,localName){this.applicationKey=applicationKey,this.localName=localName,this.refString=applicationKey.toString()?applicationKey.toString()+ApplicationBasedName.SEPARATOR+localName:localName}getLocalName(){return this.localName}getApplicationKey(){return this.applicationKey}toString(){return this.refString}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ClassHelper.getClass(this)))return!1;let other=o;return!!ObjectHelper.stringEquals(this.refString,other.refString)}}class XDataName extends ApplicationBasedName{static{__name(this,"XDataName")}constructor(name){assertNotNull(name,"XData name can't be null");const parts=name.split(ApplicationBasedName.SEPARATOR);super(ApplicationKey.fromString(parts[0]),parts[1])}equals(o){return ObjectHelper.iFrameSafeInstanceOf(o,XDataName)?super.equals(o):!1}}class ImageHelper{static{__name(this,"ImageHelper")}static getImageCaption(imageContent){const captionProperty=imageContent.getProperty("caption");if(captionProperty){const caption=captionProperty.getString();if(caption)return caption}return ImageHelper.getImageDescription(imageContent)}static getImageDescription(imageContent){const imageInfoMixin=new XDataName("media:imageInfo"),imageInfoData=imageContent.getExtraDataByName(imageInfoMixin);if(!imageInfoData||!imageInfoData.getData())return null;const descriptionProperty=imageInfoData.getData().getProperty("description");if(descriptionProperty){const description=descriptionProperty.getString();if(description)return description}return null}static getImageAltText(imageContent){const altTextProperty=imageContent.getProperty("altText");if(altTextProperty){const altText=altTextProperty.getString();if(altText)return altText}return""}}class ComponentImageUpdatedEvent extends ComponentUpdatedEvent{static{__name(this,"ComponentImageUpdatedEvent")}constructor(componentPath,value){super(componentPath),this.imageId=value}getImageId(){return this.imageId}}class ImageComponent extends ConfigBasedComponent{static{__name(this,"ImageComponent")}static{this.PROPERTY_IMAGE="image"}constructor(builder){super(builder),this.image=builder.image,this.form=this.createForm()}createForm(){const formBuilder=new FormBuilder;return formBuilder.addFormItem(new InputBuilder().setName("caption").setInputType(TextArea2.getName()).setLabel(i18n("field.caption")).setOccurrences(new OccurrencesBuilder().setMinimum(0).setMaximum(1).build()).build()),formBuilder.build()}getImage(){return this.image}getForm(){return this.form}setImage(imageContent){const oldValue=this.image;this.image=imageContent.getContentId(),this.setName(new ComponentName(imageContent.getDisplayName())),this.updateConfigImageCaption(ImageHelper.getImageCaption(imageContent)),ObjectHelper.equals(oldValue,this.image)||this.notifyComponentUpdated(new ComponentImageUpdatedEvent(this.getPath(),this.image))}updateConfigImageCaption(caption){this.config.setString("caption",0,caption)}resetImage(){const hadImageBeforeReset=this.hasImage();this.image=null,this.setName(this.getType().getDefaultName()),hadImageBeforeReset&&this.notifyComponentUpdated(new ComponentImageUpdatedEvent(this.getPath(),this.image))}hasImage(){return!!this.image}doReset(){this.resetImage(),this.config=new PropertyTree}isEmpty(){return!this.image}toJson(){const json={};return json.image=this.image!=null?this.image.toString():null,json.config=this.config!=null?this.config.toJson():null,{ImageComponent:json}}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ImageComponent))return!1;const other=o;return ObjectHelper.equals(this.image,other.image)?super.equals(o):!1}clone(){return new ImageComponentBuilder(this).build()}}class ImageComponentBuilder extends ConfigBasedComponentBuilder{static{__name(this,"ImageComponentBuilder")}constructor(source){super(source),source&&(this.image=source.getImage()),this.setType(ImageComponentType.get())}setImage(value){return this.image=value,this}fromJson(json){return super.fromJson(json),json.image&&this.setImage(new ContentId(json.image)),this}build(){return new ImageComponent(this)}}class RegionsChangedEvent{static{__name(this,"RegionsChangedEvent")}}class RegionAddedEvent extends RegionsChangedEvent{static{__name(this,"RegionAddedEvent")}constructor(regionPath){super(),this.regionPath=regionPath}getRegionPath(){return this.regionPath}}class RegionRemovedEvent extends RegionsChangedEvent{static{__name(this,"RegionRemovedEvent")}constructor(regionPath){super(),this.regionPath=regionPath}getRegionPath(){return this.regionPath}}class Regions{static{__name(this,"Regions")}static{this.debug=!1}constructor(builder){this.regionByName=new Map,this.componentEventsHolder=new ComponentEventsHolder,this.componentAddedHandler=event=>this.notifyComponentAdded(event),this.componentRemovedHandler=event=>this.notifyComponentRemoved(event),this.componentUpdatedHandler=event=>this.notifyComponentUpdated(event),builder.regions.forEach(region=>{if(this.regionByName.has(region.getName()))throw new Error("Regions must be unique by name, duplicate found: "+region.getName());this.addRegion(region)})}addRegion(region){this.regionByName.set(region.getName(),region),this.notifyRegionAdded(region.getPath()),this.registerRegionListeners(region)}registerRegionListeners(region){region.getEventsManager().onComponentAdded(this.componentAddedHandler),region.getEventsManager().onComponentRemoved(this.componentRemovedHandler),region.getEventsManager().onComponentUpdated(this.componentUpdatedHandler)}unregisterRegionListeners(region){region.getEventsManager().unComponentAdded(this.componentAddedHandler),region.getEventsManager().unComponentRemoved(this.componentRemovedHandler),region.getEventsManager().unComponentUpdated(this.componentUpdatedHandler)}removeRegions(regions){regions.forEach(region=>{this.regionByName.delete(region.getName()),this.notifyComponentRemoved(new ComponentRemovedEvent(region.getPath())),this.unregisterRegionListeners(region)})}removeAllRegions(){this.removeRegions(this.getRegions())}getRegions(){const regions=[];return this.regionByName.forEach(region=>{regions.push(region)}),regions}getRegionByName(name){return this.regionByName.get(name)}changeRegionsTo(regionDescriptors){const regionsToRemove=this.getRegions().filter(region=>!regionDescriptors.some(regionDescriptor=>regionDescriptor.getName()===region.getName()));this.removeRegions(regionsToRemove),regionDescriptors.forEach(regionDescriptor=>{let region=this.getRegionByName(regionDescriptor.getName());region||(region=Region.create().setName(regionDescriptor.getName()).build(),this.addRegion(region))})}getEventsManager(){return new ComponentEventsWrapper(this.componentEventsHolder)}toJson(){const regionJsons=[];return this.getRegions().forEach(region=>{regionJsons.push(region.toJson())}),regionJsons}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,Regions))return!1;const other=o,thisRegions=this.getRegions()?.filter(region=>!region.isEmpty()),otherRegions=other.getRegions()?.filter(region=>!region.isEmpty());return!!ObjectHelper.arrayEquals(thisRegions,otherRegions)}isEmpty(){return this.getRegions().length===0}clone(){return new RegionsBuilder(this).build()}notifyRegionAdded(regionPath){const event=new RegionAddedEvent(regionPath);Regions.debug}notifyRegionRemoved(regionPath){const event=new RegionRemovedEvent(regionPath);Regions.debug}notifyComponentAdded(event){this.componentEventsHolder.notifyComponentAdded(event)}notifyComponentRemoved(event){this.componentEventsHolder.notifyComponentRemoved(event)}notifyComponentUpdated(event){this.componentEventsHolder.notifyComponentUpdated(event)}static create(){return new RegionsBuilder}}class RegionsBuilder{static{__name(this,"RegionsBuilder")}constructor(source){this.regions=[],source&&source.getRegions().forEach(region=>{this.regions.push(region.clone())})}addRegion(value){return this.regions.push(value),this}setRegions(value){return this.regions=value,this}build(){return new Regions(this)}}class LayoutComponentType extends ComponentType{static{__name(this,"LayoutComponentType")}static{this.INSTANCE=new LayoutComponentType}constructor(){super("layout")}static get(){return LayoutComponentType.INSTANCE}getIconCls(){return"layout"}}class LayoutRegionsMerger{static{__name(this,"LayoutRegionsMerger")}merge(regions,layoutDescriptorRegions,parent2){this.layoutComponentRegions=regions.getRegions(),this.initLookupTables(layoutDescriptorRegions,parent2),this.mergeExistingRegions(),this.mergeMissingRegions(layoutDescriptorRegions);const layoutRegionsBuilder=Regions.create();return layoutDescriptorRegions.forEach(regionDescriptor=>{const layoutRegion=this.targetRegionsByName[regionDescriptor.getName()];layoutRegionsBuilder.addRegion(layoutRegion)}),layoutRegionsBuilder.build()}mergeExistingRegions(){this.layoutComponentRegions.forEach(region=>{const regionName=region.getName();if(this.targetRegionsByName[regionName]){const targetRegion=this.targetRegionsByName[regionName],updatedRegion=this.addComponents(region,targetRegion);this.targetRegionsByName[regionName]=updatedRegion}})}mergeMissingRegions(layoutDescriptorRegions){const lastRegionName=layoutDescriptorRegions[layoutDescriptorRegions.length-1].getName();this.layoutComponentRegions.forEach(region=>{const regionName=region.getName();if(!this.targetRegionsByName[regionName]){const sourceRegionPos=this.sourceRegionsPositionByName[regionName],targetRegionName=this.targetRegionsNameByPosition[sourceRegionPos]||lastRegionName,targetRegion=this.targetRegionsByName[targetRegionName],updatedRegion=this.addComponents(region,targetRegion);this.targetRegionsByName[targetRegionName]=updatedRegion}})}initLookupTables(layoutDescriptorRegions,parent2){this.targetRegionsByName={},this.targetRegionsNameByPosition={},this.sourceRegionsPositionByName={},layoutDescriptorRegions.forEach((regionDescriptor,idx)=>{const regionName=regionDescriptor.getName(),layoutRegion=Region.create().setName(regionName).setParent(parent2).build();this.targetRegionsByName[regionName]=layoutRegion,this.targetRegionsNameByPosition[idx]=regionName}),this.layoutComponentRegions.forEach((region,idx)=>{this.sourceRegionsPositionByName[region.getName()]=idx})}addComponents(fromRegion,toRegion){if(fromRegion.getComponents().length===0)return toRegion;const result=Region.create(toRegion);return fromRegion.getComponents().forEach(component=>{result.addComponent(component)}),result.build()}}class LayoutComponent extends DescriptorBasedComponent{static{__name(this,"LayoutComponent")}constructor(builder){super(builder),this.regions=builder.regions||Regions.create().build(),this.updateRegionsParent(),this.initRegionsListeners(),this.registerRegionsListeners()}initRegionsListeners(){this.componentAddedEventHandler=event=>this.getParent()?.notifyComponentAddedEvent(event),this.componentRemovedEventHandler=event=>this.getParent()?.notifyComponentRemovedEvent(event),this.componentUpdatedEventHandler=event=>this.getParent()?.notifyComponentUpdatedEvent(event)}getRegions(){return this.regions}setDescriptor(descriptor){return descriptor?.getRegions().length>0?this.mergeDescriptorRegions(descriptor):this.getRegions().removeAllRegions(),super.setDescriptor(descriptor)}mergeDescriptorRegions(descriptor){const mergedRegions=new LayoutRegionsMerger().merge(this.regions,descriptor.getRegions(),this);this.getRegions().removeAllRegions(),mergedRegions.getRegions().forEach(region=>{this.getRegions().addRegion(region),region.setParent(this)})}isEmpty(){return!this.hasDescriptor()}toJson(){const json=super.toComponentJson();return json.regions=this.regions.toJson(),{LayoutComponent:json}}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,LayoutComponent))return!1;const other=o;return ObjectHelper.equals(this.regions,other.regions)?super.equals(o):!1}getComponentByPath(path){let result=null;return this.regions.getRegions().some(region=>region.getPath().equals(path)?(result=region,!0):(result=region.getComponentByPath(path),!!result)),result}clone(){return new LayoutComponentBuilder(this).build()}updateRegionsParent(){this.regions.getRegions().forEach(region=>region.setParent(this))}registerRegionsListeners(){this.regions.getEventsManager().onComponentAdded(this.componentAddedEventHandler),this.regions.getEventsManager().onComponentRemoved(this.componentRemovedEventHandler),this.regions.getEventsManager().onComponentUpdated(this.componentUpdatedEventHandler)}}class LayoutComponentBuilder extends DescriptorBasedComponentBuilder{static{__name(this,"LayoutComponentBuilder")}constructor(source){super(source),source&&(this.regions=source.getRegions().clone()),this.setType(LayoutComponentType.get())}setRegions(value){return this.regions=value,this}build(){return new LayoutComponent(this)}}class TextComponentType extends ComponentType{static{__name(this,"TextComponentType")}static{this.INSTANCE=new TextComponentType}constructor(){super("text")}static get(){return TextComponentType.INSTANCE}}class ComponentTextUpdatedEvent extends ComponentUpdatedEvent{static{__name(this,"ComponentTextUpdatedEvent")}constructor(componentPath,value,origin){super(componentPath),this.text=value,this.origin=origin||"unknown"}getText(){return this.text}getOrigin(){return this.origin}}class TextComponent extends Component{static{__name(this,"TextComponent")}static{this.PROPERTY_TEXT="text"}constructor(builder){super(builder),builder&&this.setText(builder.text,!0)}getText(){return this.text}setText(value,silent,origin){this.text=StringHelper.isBlank(value)?void 0:value,silent||this.notifyComponentUpdated(new ComponentTextUpdatedEvent(this.getPath(),value,origin))}doReset(){this.setText()}isEmpty(){return StringHelper.isBlank(this.text)}toJson(){const json={};return json.text=this.text!=null?this.text:null,{TextComponent:json}}equals(o){return!(o instanceof TextComponent)||!super.equals(o)?!1:ObjectHelper.stringEquals(this.text,o.text)}clone(){return new TextComponentBuilder(this).build()}}class TextComponentBuilder extends ComponentBuilder{static{__name(this,"TextComponentBuilder")}constructor(source){super(source),source&&(this.text=source.getText()),this.setType(TextComponentType.get())}fromJson(json){return json.text&&this.setText(json.text),this.setName(json.name?new ComponentName(json.name):null),this}setText(value){return this.text=value,this}build(){return new TextComponent(this)}}class ComponentFactory{static{__name(this,"ComponentFactory")}static createFromJson(json,componentIndex,region){if(json.PartComponent)return new PartComponentBuilder().fromJson(json.PartComponent).setParent(region).build();if(json.ImageComponent)return new ImageComponentBuilder().fromJson(json.ImageComponent).setParent(region).build();if(json.LayoutComponent){const regions=ComponentFactory.createRegionsFromJson(json.LayoutComponent.regions);return new LayoutComponentBuilder().fromJson(json.LayoutComponent).setParent(region).setIndex(componentIndex).setRegions(regions).build()}else{if(json.TextComponent)return new TextComponentBuilder().fromJson(json.TextComponent).setParent(region).setIndex(componentIndex).build();if(json.FragmentComponent)return new FragmentComponentBuilder().fromJson(json.FragmentComponent).setParent(region).setIndex(componentIndex).build();throw new Error("Not a component that can be placed in a Region: "+JSON.stringify(json))}}static createRegionsFromJson(regionsJson,parent2){return Regions.create().setRegions(regionsJson.map(regionJson=>{const region=Region.create().setName(regionJson.name).setParent(parent2).build();return regionJson.components.forEach((componentJson,componentIndex)=>{const component=ComponentFactory.createFromJson(componentJson,componentIndex,region);region.addComponent(component)}),region})).build()}static createByType(parentRegion,type){if(type instanceof FragmentComponentType)return new FragmentComponentBuilder().setParent(parentRegion).setName(type.getDefaultName()).build();if(type instanceof LayoutComponentType)return new LayoutComponentBuilder().setParent(parentRegion).setName(type.getDefaultName()).build();if(type instanceof PartComponentType)return new PartComponentBuilder().setParent(parentRegion).setName(type.getDefaultName()).build();if(type instanceof TextComponentType)return new TextComponentBuilder().setParent(parentRegion).setName(type.getDefaultName()).build();if(type instanceof ImageComponentType)return new ImageComponentBuilder().setParent(parentRegion).setName(type.getDefaultName()).build();throw new Error("Unable to create component with type: "+type?.getShortName())}}class Page{static{__name(this,"Page")}constructor(builder){this.controller=builder.controller,this.template=builder.template,this.regions=builder.regions,this.fragment=builder.fragment,this.config=builder.config,this.regions?.getRegions().forEach(region=>region.setParent(this))}hasController(){return this.controller!=null}getController(){return this.controller}hasTemplate(){return this.template!=null}getTemplate(){return this.template}hasNonEmptyRegions(){return this.regions!=null&&!this.getRegions().isEmpty()}getRegions(){return this.regions}hasConfig(){return this.config!=null}hasNonEmptyConfig(){return this.hasConfig()&&!this.getConfig().isEmpty()}getConfig(){return this.config}getFragment(){return this.fragment}isFragment(){return this.fragment!=null}getPath(){return ComponentPath.root()}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,Page))return!1;const other=o;return!ObjectHelper.equals(this.controller,other.controller)||!ObjectHelper.equals(this.template,other.template)||!this.regionsEquals(other.regions)||!ObjectHelper.equals(this.fragment,other.fragment)?!1:PropertyTreeHelper.propertyTreesEqual(this.config,other.config)}toJson(){return{controller:this.controller?this.controller.toString():void 0,template:this.template?this.template.toString():void 0,regions:this.regions?this.regions.toJson():void 0,fragment:this.fragment?.toJson()||null,config:this.config?this.config.toJson():void 0}}regionsEquals(otherRegions){return!this.regions&&(!otherRegions||otherRegions.isEmpty())||!otherRegions&&(!this.regions||this.regions.isEmpty())?!0:ObjectHelper.equals(this.regions,otherRegions)}clone(){return new PageBuilder(this).build()}getType(){return"page"}getComponentByPath(path){if(path.isRoot())return this.isFragment()?this.getFragment():this;let result=null;return this.getActiveRegions()?.getRegions().some(region=>region.getPath().equals(path)?(result=region,!0):(result=region.getComponentByPath(path),!!result)),result}getActiveRegions(){return this.fragment instanceof LayoutComponent?this.fragment.getRegions():this.regions}getParent(){return null}onComponentAdded(listener){this.getActiveRegions()?.getEventsManager().onComponentAdded(listener)}unComponentAdded(listener){this.getActiveRegions()?.getEventsManager().unComponentAdded(listener)}onComponentRemoved(listener){this.getActiveRegions()?.getEventsManager().onComponentRemoved(listener)}unComponentRemoved(listener){this.getActiveRegions()?.getEventsManager().unComponentRemoved(listener)}onComponentUpdated(listener){this.getActiveRegions()?.getEventsManager().onComponentUpdated(listener),this.fragment?.onComponentUpdated(listener)}unComponentUpdated(listener){this.getActiveRegions()?.getEventsManager().onComponentUpdated(listener),this.fragment?.unComponentUpdated(listener)}}class PageBuilder{static{__name(this,"PageBuilder")}constructor(source){source&&(this.controller=source.getController(),this.template=source.getTemplate(),this.regions=source.getRegions()?.clone(),this.config=source.getConfig()?source.getConfig().copy():null,this.fragment=source.isFragment()?source.getFragment().clone():null)}fromJson(json){if(this.setController(json.controller?DescriptorKey.fromString(json.controller):null),this.setTemplate(json.template?PageTemplateKey.fromString(json.template):null),this.setRegions(json.regions!=null?ComponentFactory.createRegionsFromJson(json.regions):null),this.setConfig(json.config!=null?PropertyTree.fromJson(json.config):null),json.fragment){const component=ComponentFactory.createFromJson(json.fragment,0,null);this.setFragment(component)}return this}setController(value){return this.controller=value,this}setTemplate(value){return this.template=value,this}setRegions(value){return this.regions=value,this}setConfig(value){return this.config=value,this}setFragment(value){return this.fragment=value,this}build(){return new Page(this)}}class RegionDescriptor{static{__name(this,"RegionDescriptor")}constructor(builder){this.name=builder.name}static create(){return new RegionDescriptorBuilder}static fromJson(json){return RegionDescriptor.create().setName(json.name).build()}getName(){return this.name}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,RegionDescriptor))return!1;const other=o;return this.name===other.getName()}}class RegionDescriptorBuilder{static{__name(this,"RegionDescriptorBuilder")}setName(value){return this.name=value,this}build(){return new RegionDescriptor(this)}}class Descriptor{static{__name(this,"Descriptor")}constructor(builder){this.name=builder.name,this.key=builder.key,this.displayName=builder.displayName,this.description=builder.description,this.config=builder.config,this.icon=builder.icon,this.iconCls=builder.iconCls,this.regions=builder.regions,this.autoGenerated=builder.autoGenerated}static fromJson(json){return DescriptorBuilder.fromJson(json).build()}getKey(){return this.key}getName(){return this.name}getDisplayName(){return this.displayName}getDescription(){return this.description}getConfig(){return this.config}setComponentType(componentType){return this.componentType=componentType,this}getComponentType(){return this.componentType}getIconCls(){return this.iconCls?this.iconCls:this.componentType?.getIconCls()||""}getIcon(){return this.icon}getRegions(){return this.regions}isAutoGenerated(){return this.autoGenerated}clone(){return new DescriptorBuilder(this).build()}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,Descriptor))return!1;const other=o;return this.name.toString()===other.getName().toString()&&this.componentType===other.getComponentType()&&this.key.equals(other.getKey())&&this.displayName===other.getDisplayName()&&this.description===other.getDescription()&&this.autoGenerated===other.isAutoGenerated()&&this.config.equals(other.getConfig())&&ObjectHelper.arrayEquals(this.regions,other.getRegions())}}class DescriptorBuilder{static{__name(this,"DescriptorBuilder")}constructor(source){this.regions=[],source&&(this.key=source.getKey(),this.name=source.getName(),this.displayName=source.getDisplayName(),this.description=source.getDescription(),this.config=source.getConfig(),this.icon=source.getIcon(),this.regions=source.getRegions())}static fromJson(json){const descriptorKey=DescriptorKey.fromString(json.key);return new DescriptorBuilder().setName(new DescriptorName(json.name)).setDisplayName(json.displayName).setDescription(json.description).setConfig(json.config!=null?Form.fromJson(json.config,descriptorKey.getApplicationKey()):null).setIcon(json.icon).setKey(descriptorKey).setAutoGenerated(json.autoGenerated).setRegions(json.regions?.map(regionJson=>RegionDescriptor.fromJson(regionJson)))}setKey(value){return this.key=value,this}setName(value){return this.name=value,this}setDisplayName(value){return this.displayName=value,this}setDescription(value){return this.description=value,this}setConfig(value){return this.config=value,this}setIcon(value){return this.icon=value,this}setIconCls(iconCls){return this.iconCls=iconCls,this}setRegions(value){return this.regions=value,this}setAutoGenerated(value){return this.autoGenerated=value,this}build(){return new Descriptor(this)}}class PageComponentType extends ComponentType{static{__name(this,"PageComponentType")}static{this.INSTANCE=new PageComponentType}constructor(){super("page")}static get(){return PageComponentType.INSTANCE}getIconCls(){return"file"}}class ProjectContext{static{__name(this,"ProjectContext")}static{this.LOCAL_STORAGE_KEY="contentstudio:defaultProject"}constructor(){this.state=State.NOT_INITIALIZED,this.projectChangedEventListeners=[],this.noProjectsAvailableListeners=[]}static get(){let instance=Store.instance().get("projectContext");return instance==null&&document.body&&(instance=new ProjectContext,Store.instance().set("projectContext",instance)),instance}getProject(){return this.currentProject}setProject(project){this.currentProject=project,this.state=State.INITIALIZED,localStorage.setItem(ProjectContext.LOCAL_STORAGE_KEY,project.getName()),this.notifyProjectChanged()}setNotAvailable(){this.currentProject=null,this.state=State.NOT_AVAILABLE,localStorage.removeItem(ProjectContext.LOCAL_STORAGE_KEY),this.notifyNoProjectsAvailable()}isInitialized(){return this.state===State.INITIALIZED}whenInitialized(callback){if(this.isInitialized())callback();else{const projectInitializedHandler=__name(()=>{callback(),this.unProjectChanged(projectInitializedHandler)},"projectInitializedHandler");this.onProjectChanged(projectInitializedHandler)}}onProjectChanged(handler){this.projectChangedEventListeners.push(handler)}unProjectChanged(handler){this.projectChangedEventListeners=this.projectChangedEventListeners.filter(curr=>handler!==curr)}notifyProjectChanged(){this.projectChangedEventListeners.forEach(handler=>{handler(this.currentProject)})}onNoProjectsAvailable(handler){this.noProjectsAvailableListeners.push(handler)}unNoProjectsAvailable(handler){this.noProjectsAvailableListeners=this.noProjectsAvailableListeners.filter(curr=>handler!==curr)}notifyNoProjectsAvailable(){this.noProjectsAvailableListeners.forEach(handler=>{handler()})}}var State;(function(State2){State2[State2.INITIALIZED=0]="INITIALIZED",State2[State2.NOT_INITIALIZED=1]="NOT_INITIALIZED",State2[State2.NOT_AVAILABLE=2]="NOT_AVAILABLE"})(State||(State={}));var UrlAction;(function(UrlAction2){UrlAction2.BROWSE="browse",UrlAction2.NEW="new",UrlAction2.EDIT="edit",UrlAction2.ISSUE="issue",UrlAction2.OUTBOUND="outbound",UrlAction2.INBOUND="inbound",UrlAction2.CUSTOM="custom"})(UrlAction||(UrlAction={}));class UrlHelper{static{__name(this,"UrlHelper")}static{this.toolUriPropertyName="toolUri"}static getCmsRestUri(path){return UriHelper.getAdminUri(UriHelper.joinPath("rest-v2","cs",UriHelper.relativePath(path)))}static getCMSPath(contentRootPath,project){return`cms/${(project||ProjectContext.get().getProject()).getName()}${contentRootPath?`/${contentRootPath}`:""}`}static getCMSPathForContentRoot(project){return UrlHelper.getCMSPath("content",project)}static getCMSPathWithProject(projectName,contentRootPath){return`cms/${projectName||ProjectContext.get().getProject().getName()}${contentRootPath?`/${contentRootPath}`:""}`}static createContentBrowseUrl(project){return project?UrlHelper.getPrefixedUrl(`${project}/${UrlAction.BROWSE}`):UrlHelper.getProjectContextUrl(`${UrlAction.BROWSE}`)}static createContentEditUrl(contentId,action=UrlAction.EDIT){return UrlHelper.getProjectContextUrl(`${action}/${contentId}`,"")}static getProjectContextUrl(path,separator="#"){const project=ProjectContext.get().getProject().getName();return UrlHelper.getPrefixedUrl(`${project}/${path}`,separator)}static getPrefixedUrl(url,separator="#"){return`${CONFIG.getString(UrlHelper.toolUriPropertyName)}${separator}/${url}`}static isContentBrowseUrlMatch(){return window.location.hash.endsWith(UrlAction.BROWSE)}}class CmsResourceRequest extends ResourceRequest{static{__name(this,"CmsResourceRequest")}getPostfixUri(){return UrlHelper.getCmsRestUri("")}}class AttachmentName{static{__name(this,"AttachmentName")}constructor(fileName){this.fileName=fileName}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,AttachmentName))return!1;const other=o;return!!ObjectHelper.stringEquals(this.fileName,other.fileName)}toString(){return this.fileName}}class Attachment{static{__name(this,"Attachment")}constructor(builder){this.name=builder.name,this.label=builder.label,this.mimeType=builder.mimeType,this.size=builder.size}getBinaryReference(){return new BinaryReference(this.name.toString())}getName(){return this.name}getLabel(){return this.label}getMimeType(){return this.mimeType}getSize(){return this.size}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,Attachment))return!1;const other=o;return!(!ObjectHelper.equals(this.name,other.name)||!ObjectHelper.stringEquals(this.label,other.label)||!ObjectHelper.stringEquals(this.mimeType,other.mimeType)||!ObjectHelper.numberEquals(this.size,other.size))}toJson(){return{name:this.getName().toString(),label:this.getLabel(),mimeType:this.getMimeType(),size:this.getSize()}}static create(){return new AttachmentBuilder}static getUrl(contentId,attachmentName,contentRootPath,project){const uri=`${contentRootPath==null?UrlHelper.getCMSPathForContentRoot():UrlHelper.getCMSPath(contentRootPath,project)}/content/media/${contentId}/${encodeURIComponent(attachmentName)}`;return UrlHelper.getCmsRestUri(uri)}}class AttachmentBuilder{static{__name(this,"AttachmentBuilder")}fromJson(json){return this.setName(new AttachmentName(json.name)).setLabel(json.label).setSize(json.size).setMimeType(json.mimeType),this}setName(value){return this.name=value,this}setLabel(value){return this.label=value,this}setMimeType(value){return this.mimeType=value,this}setSize(value){return this.size=value,this}build(){return new Attachment(this)}}class Attachments{static{__name(this,"Attachments")}constructor(builder){this.attachmentByName={},this.attachmentByLabel={},this.attachments=[];let count=0;builder.attachments.forEach(attachment=>{this.attachmentByName[attachment.getName().toString()]=attachment,this.attachmentByLabel[attachment.getLabel()]=attachment,count++,this.attachments.push(attachment)}),this.size=count}forEach(callBack){this.attachments.forEach((attachment,index)=>{callBack(attachment,index)})}getAttachmentByName(name){return this.attachmentByName[name]}getAttachmentByLabel(label){return this.attachmentByLabel[label]}getAttachment(index){return this.attachments[index]}getSize(){return this.size}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,Attachments))return!1;const other=o;return ObjectHelper.arrayEquals(this.attachments,other.attachments)}static create(){return new AttachmentsBuilder}}class AttachmentsBuilder{static{__name(this,"AttachmentsBuilder")}constructor(){this.attachments=[]}fromJson(jsons){return jsons.forEach(json=>{this.attachments.push(new AttachmentBuilder().fromJson(json).build())}),this}add(value){return this.attachments.push(value),this}addAll(value){return value.forEach(attachment=>{this.attachments.push(attachment)}),this}build(){return new Attachments(this)}}class ExtraData{static{__name(this,"ExtraData")}constructor(name,data){this.name=name,this.data=data}static fromJson(metadataJson){return new ExtraData(new XDataName(metadataJson.name),PropertyTree.fromJson(metadataJson.data))}getData(){return this.data}clone(){return new ExtraData(this.name,this.data.copy())}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ExtraData))return!1;const other=o;return!(!ObjectHelper.equals(this.name,other.name)||!ObjectHelper.equals(this.data,other.data))}toJson(){return{name:this.name.toString(),data:this.data.toJson()}}getName(){return this.name}}var Permission;(function(Permission2){Permission2[Permission2.READ=0]="READ",Permission2[Permission2.CREATE=1]="CREATE",Permission2[Permission2.MODIFY=2]="MODIFY",Permission2[Permission2.DELETE=3]="DELETE",Permission2[Permission2.PUBLISH=4]="PUBLISH",Permission2[Permission2.READ_PERMISSIONS=5]="READ_PERMISSIONS",Permission2[Permission2.WRITE_PERMISSIONS=6]="WRITE_PERMISSIONS"})(Permission||(Permission={}));var PermissionState;(function(PermissionState2){PermissionState2[PermissionState2.ALLOW=0]="ALLOW",PermissionState2[PermissionState2.INHERIT=1]="INHERIT"})(PermissionState||(PermissionState={}));class PrincipalContainer{static{__name(this,"PrincipalContainer")}constructor(principal){this.principal=principal}getPrincipal(){return this.principal}getPrincipalKey(){return this.principal.getKey()}getPrincipalDisplayName(){return this.principal.getDisplayName()}getPrincipalTypeName(){return this.principal.getTypeName()}}class RoleKeys{static{__name(this,"RoleKeys")}static{this.ROLE_ADMIN="system.admin"}static{this.ADMIN=PrincipalKey.ofRole(RoleKeys.ROLE_ADMIN)}static{this.ROLE_CMS_ADMIN="cms.admin"}static{this.CMS_ADMIN=PrincipalKey.ofRole(RoleKeys.ROLE_CMS_ADMIN)}static{this.ROLE_USER_ADMIN="system.user.admin"}static{this.USER_ADMIN=PrincipalKey.ofRole(RoleKeys.ROLE_USER_ADMIN)}static{this.ROLE_EVERYONE="system.everyone"}static{this.EVERYONE=PrincipalKey.ofRole(RoleKeys.ROLE_EVERYONE)}static{this.ROLE_AUTHENTICATED="system.authenticated"}static{this.AUTHENTICATED=PrincipalKey.ofRole(RoleKeys.ROLE_AUTHENTICATED)}static{this.ROLE_CMS_EXPERT="cms.expert"}static{this.CMS_EXPERT=PrincipalKey.ofRole(RoleKeys.ROLE_CMS_EXPERT)}static{this.contentAdminRoles=[RoleKeys.ROLE_ADMIN,RoleKeys.ROLE_CMS_ADMIN]}static{this.userAdminRoles=[RoleKeys.ROLE_ADMIN,RoleKeys.ROLE_USER_ADMIN]}static{this.contentExpertRoles=[RoleKeys.ROLE_ADMIN,RoleKeys.ROLE_CMS_ADMIN,RoleKeys.ROLE_CMS_EXPERT]}static isContentAdmin(principalKey){return!!principalKey&&RoleKeys.contentAdminRoles.some(roleId=>principalKey.getId()===roleId)}static isUserAdmin(principalKey){return!!principalKey&&RoleKeys.userAdminRoles.some(roleId=>principalKey.getId()===roleId)}static isContentExpert(principalKey){return!!principalKey&&RoleKeys.contentExpertRoles.some(roleId=>principalKey.getId()===roleId)}static isAdmin(principalKey){return!!principalKey&&RoleKeys.ROLE_ADMIN===principalKey.getId()}static isEveryone(principalKey){return!!principalKey&&RoleKeys.ROLE_EVERYONE===principalKey.getId()}}class AuthHelper{static{__name(this,"AuthHelper")}static isContentAdmin(){return AuthContext.get().getPrincipals().some(principal=>RoleKeys.isContentAdmin(principal.getKey()))}static isUserAdmin(){return AuthContext.get().getPrincipals().some(principal=>RoleKeys.isUserAdmin(principal.getKey()))}static isContentExpert(){return AuthContext.get().getPrincipals().some(principal=>RoleKeys.isContentExpert(principal.getKey()))}static isAdmin(){return AuthContext.get().getPrincipals().some(principal=>RoleKeys.isAdmin(principal.getKey()))}static getPrincipalsKeys(){return AuthContext.get().getPrincipals().map(principal=>principal.getKey())}}class PermissionsHelper{static{__name(this,"PermissionsHelper")}static getAllPermissions(){return[Permission.READ,Permission.CREATE,Permission.MODIFY,Permission.DELETE,Permission.PUBLISH,Permission.WRITE_PERMISSIONS]}static hasAdminPermissions(){return AuthHelper.isAdmin()||AuthHelper.isContentAdmin()}}class AccessControlEntry extends PrincipalContainer{static{__name(this,"AccessControlEntry")}constructor(principal){super(principal),this.allowedPermissions=[],this.deniedPermissions=[]}getAllowedPermissions(){return this.allowedPermissions}getDeniedPermissions(){return this.deniedPermissions}setAllowedPermissions(permissions){this.allowedPermissions=permissions}setDeniedPermissions(permissions){this.deniedPermissions=permissions}isAllowed(permission){return this.allowedPermissions.indexOf(permission)>-1&&this.deniedPermissions.indexOf(permission)===-1}isDenied(permission){return!this.isAllowed(permission)}isSet(permission){return this.allowedPermissions.indexOf(permission)>-1||this.deniedPermissions.indexOf(permission)>-1}allow(permission){return ArrayHelper.addUnique(permission,this.allowedPermissions),ArrayHelper.removeValue(permission,this.deniedPermissions),this}deny(permission){return ArrayHelper.addUnique(permission,this.deniedPermissions),ArrayHelper.removeValue(permission,this.allowedPermissions),this}remove(permission){return ArrayHelper.removeValue(permission,this.allowedPermissions),ArrayHelper.removeValue(permission,this.deniedPermissions),this}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,AccessControlEntry))return!1;const other=o;return!(!ObjectHelper.equals(this.getPrincipalKey(),other.getPrincipalKey())||!ObjectHelper.anyArrayEquals(this.allowedPermissions,other.allowedPermissions)||!ObjectHelper.anyArrayEquals(this.deniedPermissions,other.deniedPermissions))}toString(){let values="";return PermissionsHelper.getAllPermissions().forEach(permission=>{this.isSet(permission)&&(values!==""&&(values+=", "),values+=this.isAllowed(permission)?"+":"-",values+=Permission[permission].toUpperCase())}),this.getPrincipalKey().toString()+"["+values+"]"}clone(){const ace=new AccessControlEntry(this.principal.clone());return ace.allowedPermissions=this.allowedPermissions.slice(0),ace.deniedPermissions=this.deniedPermissions.slice(0),ace}toJson(){return{principal:this.principal.toJson(),allow:this.allowedPermissions.map(perm=>Permission[perm]),deny:this.deniedPermissions.map(perm=>Permission[perm])}}static fromJson(json){const ace=new AccessControlEntry(Principal.fromJson(json.principal)),allow=json.allow.map(permStr=>Permission[permStr.toUpperCase()]),deny=json.deny.map(permStr=>Permission[permStr.toUpperCase()]);return ace.setAllowedPermissions(allow),ace.setDeniedPermissions(deny),ace}}class AccessControlList{static{__name(this,"AccessControlList")}constructor(entries2){this.entries={},entries2&&this.addAll(entries2)}getEntries(){const values=[];for(const key in this.entries)this.entries.hasOwnProperty(key)&&values.push(this.entries[key]);return values}getEntry(principalKey){return this.entries[principalKey.toString()]}add(entry){this.entries[entry.getPrincipalKey().toString()]=entry}addAll(entries2){entries2.forEach(entry=>{this.entries[entry.getPrincipalKey().toString()]=entry})}contains(principalKey){return this.entries.hasOwnProperty(principalKey.toString())}remove(principalKey){delete this.entries[principalKey.toString()]}toJson(){const acl=[];return this.getEntries().forEach(entry=>{const entryJson=entry.toJson();acl.push(entryJson)}),acl}toString(){return"["+this.getEntries().map(ace=>ace.toString()).join(", ")+"]"}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,AccessControlList))return!1;const other=o;return ObjectHelper.arrayEquals(this.getEntries().sort(),other.getEntries().sort())}clone(){const entries2=[];for(const key in this.entries)this.entries.hasOwnProperty(key)&&entries2.push(this.entries[key].clone());return new AccessControlList(entries2)}static fromJson(json){const acl=new AccessControlList;return json.permissions.forEach(entryJson=>{const entry=AccessControlEntry.fromJson(entryJson);acl.add(entry)}),acl}}class Thumbnail{static{__name(this,"Thumbnail")}constructor(builder){this.binaryReference=builder.binaryReference,this.mimeType=builder.mimeType,this.size=builder.size}static create(){return new ThumbnailBuilder}getBinaryReference(){return this.binaryReference}getMimeType(){return this.mimeType}getSize(){return this.size}toJson(){return{binaryReference:this.getBinaryReference().toString(),mimeType:this.getMimeType(),size:this.getSize()}}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,Thumbnail))return!1;let other=o;return!(!ObjectHelper.equals(this.binaryReference,other.binaryReference)||!ObjectHelper.stringEquals(this.mimeType,other.mimeType)||!ObjectHelper.numberEquals(this.size,other.size))}}class ThumbnailBuilder{static{__name(this,"ThumbnailBuilder")}fromJson(json){return this.binaryReference=new BinaryReference(json.binaryReference),this.mimeType=json.mimeType,this.size=json.size,this}setBinaryReference(value){return this.binaryReference=value,this}setMimeType(value){return this.mimeType=value,this}setSize(value){return this.size=value,this}build(){return new Thumbnail(this)}}class ContentTypeName extends ApplicationBasedName{static{__name(this,"ContentTypeName")}static{this.UNSTRUCTURED=ContentTypeName.from(ApplicationKey.BASE,"unstructured")}static{this.FOLDER=ContentTypeName.from(ApplicationKey.BASE,"folder")}static{this.SHORTCUT=ContentTypeName.from(ApplicationKey.BASE,"shortcut")}static{this.MEDIA=ContentTypeName.from(ApplicationKey.BASE,"media")}static{this.MEDIA_TEXT=ContentTypeName.from(ApplicationKey.MEDIA,"text")}static{this.MEDIA_DATA=ContentTypeName.from(ApplicationKey.MEDIA,"data")}static{this.MEDIA_AUDIO=ContentTypeName.from(ApplicationKey.MEDIA,"audio")}static{this.MEDIA_VIDEO=ContentTypeName.from(ApplicationKey.MEDIA,"video")}static{this.MEDIA_IMAGE=ContentTypeName.from(ApplicationKey.MEDIA,"image")}static{this.MEDIA_VECTOR=ContentTypeName.from(ApplicationKey.MEDIA,"vector")}static{this.MEDIA_ARCHIVE=ContentTypeName.from(ApplicationKey.MEDIA,"archive")}static{this.MEDIA_DOCUMENT=ContentTypeName.from(ApplicationKey.MEDIA,"document")}static{this.MEDIA_SPREADSHEET=ContentTypeName.from(ApplicationKey.MEDIA,"spreadsheet")}static{this.MEDIA_PRESENTATION=ContentTypeName.from(ApplicationKey.MEDIA,"presentation")}static{this.MEDIA_CODE=ContentTypeName.from(ApplicationKey.MEDIA,"code")}static{this.MEDIA_EXECUTABLE=ContentTypeName.from(ApplicationKey.MEDIA,"executable")}static{this.MEDIA_UNKNOWN=ContentTypeName.from(ApplicationKey.MEDIA,"unknown")}static{this.SITE=ContentTypeName.from(ApplicationKey.PORTAL,"site")}static{this.PAGE_TEMPLATE=ContentTypeName.from(ApplicationKey.PORTAL,"page-template")}static{this.TEMPLATE_FOLDER=ContentTypeName.from(ApplicationKey.PORTAL,"template-folder")}static{this.FRAGMENT=ContentTypeName.from(ApplicationKey.PORTAL,"fragment")}static{this.IMAGE=ContentTypeName.from(ApplicationKey.MEDIA,"image")}constructor(name){assertNotNull(name,"Content type name can't be null");let parts=name.split(ApplicationBasedName.SEPARATOR);super(ApplicationKey.fromString(parts[0]),parts[1])}static from(applicationKey,localName){return new ContentTypeName(applicationKey.toString()+":"+localName)}static getMediaTypes(){return[ContentTypeName.MEDIA_ARCHIVE,ContentTypeName.MEDIA_AUDIO,ContentTypeName.MEDIA_VIDEO,ContentTypeName.MEDIA_CODE,ContentTypeName.MEDIA_DATA,ContentTypeName.MEDIA_DOCUMENT,ContentTypeName.MEDIA_EXECUTABLE,ContentTypeName.MEDIA_IMAGE,ContentTypeName.MEDIA_SPREADSHEET,ContentTypeName.MEDIA_PRESENTATION,ContentTypeName.MEDIA_VECTOR,ContentTypeName.MEDIA_TEXT,ContentTypeName.MEDIA_UNKNOWN]}isFolder(){return ContentTypeName.FOLDER.equals(this)}isSite(){return ContentTypeName.SITE.equals(this)}isPageTemplate(){return ContentTypeName.PAGE_TEMPLATE.equals(this)}isTemplateFolder(){return ContentTypeName.TEMPLATE_FOLDER.equals(this)}isFragment(){return ContentTypeName.FRAGMENT.equals(this)}isImage(){return ContentTypeName.IMAGE.equals(this)}isMedia(){return ContentTypeName.MEDIA.equals(this)}isVectorMedia(){return ContentTypeName.MEDIA_VECTOR.equals(this)}isAudioMedia(){return ContentTypeName.MEDIA_AUDIO.equals(this)}isVideoMedia(){return ContentTypeName.MEDIA_VIDEO.equals(this)}isDocumentMedia(){return ContentTypeName.MEDIA_DOCUMENT.equals(this)}isTextMedia(){return ContentTypeName.MEDIA_TEXT.equals(this)}isShortcut(){return ContentTypeName.SHORTCUT.equals(this)}isUnstructured(){return ContentTypeName.UNSTRUCTURED.equals(this)}isDescendantOfMedia(){return ContentTypeName.getMediaTypes().some(contentTypeName=>contentTypeName.equals(this))}static fromObject(o){return o instanceof ContentTypeName?o:new ContentTypeName(o.refString)}}class Name{static{__name(this,"Name")}static{this.FORBIDDEN_CHARS=/[^a-z0-9\-]+/ig}static{this.SIMPLIFIED_FORBIDDEN_CHARS=/[\/!?\\]/g}constructor(name){assertNotNull(name,"Name cannot be null"),assert(!StringHelper.isEmpty(name),"Name cannot be empty"),this.value=name}getValue(){return this.value}toString(){return this.value}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,Name))return!1;let other=o;return this.value===other.value}}class ContentName extends Name{static{__name(this,"ContentName")}constructor(name){super(name)}isUnnamed(){return!1}equals(o){return!(!ObjectHelper.iFrameSafeInstanceOf(o,ContentName)||!super.equals(o))}static fromString(str){return new ContentName(str)}}class NodePath extends Path{static{__name(this,"NodePath")}static{this.NODE_PATH_DIVIDER=Path.DEFAULT_ELEMENT_DIVIDER}isRoot(){return this.getLevel()===1}isNotRoot(){return!this.isRoot()}getRootElement(){return this.elements[0]}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,NodePath))return!1;let other=o;return!!ObjectHelper.stringEquals(this.refString,other.refString)}isDescendantOf(path){return(path.isRoot()||this.refString.indexOf(path.toString()+this.getDivider())===0)&&this.getLevel()>path.getLevel()}isChildOf(path){return(path.isRoot()||this.refString.indexOf(path.toString()+this.getDivider())===0)&&this.getLevel()===path.getLevel()+1}newBuilder(){return new NodePathBuilder(this)}static create(){return new NodePathBuilder}}class NodePathBuilder extends PathBuilder{static{__name(this,"NodePathBuilder")}constructor(){super(...arguments),this.elementDivider=NodePath.NODE_PATH_DIVIDER}fromString(s,elementDivider=NodePath.NODE_PATH_DIVIDER){return super.fromString(s,elementDivider)}fromParent(parent2,...childElements){return super.fromParent(parent2,...childElements)}setElements(value){return super.setElements(value)}setElementDivider(value){return super.setElementDivider(value)}setAbsolute(value){return super.setAbsolute(value)}build(){return new NodePath(this)}}class ContentPath extends NodePath{static{__name(this,"ContentPath")}static{this.CONTENT_ROOT="content"}static{this.ARCHIVE_ROOT="archive"}constructor(builder){super(builder),this.root=builder.root||ContentPath.CONTENT_ROOT}getPathAtLevel(level){let result="";for(let index=0;index<this.getElements().length;index++)if(result=result+NodePath.NODE_PATH_DIVIDER+this.getElements()[+index],index===level-1)return new ContentPathBuilder().fromString(result).build();return null}getName(){return this.elements[this.elements.length-1]}hasParentContent(){return this.elements.length>1}equals(o){return ObjectHelper.iFrameSafeInstanceOf(o,ContentPath)&&super.equals(o)}getParentPath(){return super.getParentPath()}isInContentRoot(){return this.getRoot()===ContentPath.CONTENT_ROOT}isInArchiveRoot(){return this.getRoot()===ContentPath.ARCHIVE_ROOT}getRoot(){return this.root}isRoot(){return this.getLevel()===0}newBuilder(){return new ContentPathBuilder(this)}static create(){return new ContentPathBuilder}static getRoot(){return ContentPath.ROOT||(ContentPath.ROOT=ContentPath.create().fromString("/").build()),ContentPath.ROOT}static fromObject(o){return o instanceof ContentPath?o:new ContentPathBuilder().fromString(o.refString).setAbsolute(o.absolute).build()}}class ContentPathBuilder extends NodePathBuilder{static{__name(this,"ContentPathBuilder")}constructor(){super(...arguments),this.root=ContentPath.CONTENT_ROOT}setRoot(value){return this.root=value,this}setElements(value){return super.setElements(value)}setAbsolute(value){return super.setAbsolute(value)}setElementDivider(value){return super.setElementDivider(value)}fromParent(parent2,...childElements){return super.fromParent(parent2,...childElements)}fromString(s,elementDivider=NodePath.NODE_PATH_DIVIDER){return super.fromString(s,elementDivider)}build(){return new ContentPath(this)}}class ContentUnnamed extends ContentName{static{__name(this,"ContentUnnamed")}static{this.UNNAMED_PREFIX="__unnamed__"}constructor(name){super(name),assert(name.indexOf(ContentUnnamed.UNNAMED_PREFIX)===0,"An UnnamedContent must start with ["+ContentUnnamed.UNNAMED_PREFIX+"]: "+name)}static newUnnamed(){return new ContentUnnamed(ContentUnnamed.UNNAMED_PREFIX)}isUnnamed(){return!0}toString(){return""}equals(o){return!(!ObjectHelper.iFrameSafeInstanceOf(o,ContentUnnamed)||!super.equals(o))}}var ContentInheritType;(function(ContentInheritType2){ContentInheritType2[ContentInheritType2.CONTENT=0]="CONTENT",ContentInheritType2[ContentInheritType2.PARENT=1]="PARENT",ContentInheritType2[ContentInheritType2.NAME=2]="NAME",ContentInheritType2[ContentInheritType2.SORT=3]="SORT"})(ContentInheritType||(ContentInheritType={}));class QueryField{static{__name(this,"QueryField")}static{this.DISPLAY_NAME="displayName"}static{this.NAME="_name"}static{this.ALL="_alltext"}static{this.CREATED_TIME="createdTime"}static{this.MODIFIED_TIME="modifiedTime"}static{this.TIMESTAMP="_timestamp"}static{this.MANUAL_ORDER_VALUE="_manualOrderValue"}static{this.WEIGHT_SEPARATOR="^"}static{this.CONTENT_TYPE="type"}static{this.REFERENCES="_references"}static{this.ID="_id"}static{this.PUBLISH_FIRST="publish.first"}constructor(name,weight){this.name=name,weight&&(this.weight=weight)}toString(){return this.weight?this.name+QueryField.WEIGHT_SEPARATOR+this.weight:this.name}}let OrderExpr$1=class OrderExpr{static{__name(this,"OrderExpr")}constructor(builder){this.direction=builder.direction}static toArrayJson(expressions){return expressions.map(expr=>expr.toWrappedJson())}getDirection(){return this.direction}toJson(){throw new Error("Must be implemented by inheritors")}toWrappedJson(){throw new Error("Must be implemented by inheritors")}toString(){throw new Error("Must be implemented by inheritors")}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,OrderExpr))return!1;const other=o;return this.direction.toLowerCase()===other.getDirection().toLowerCase()}};class OrderExprBuilder{static{__name(this,"OrderExprBuilder")}constructor(json){json&&(this.direction=json.direction)}setDirection(value){return this.direction=value,this}build(){return new OrderExpr$1(this)}}let FieldOrderExpr$1=class FieldOrderExpr extends OrderExpr$1{static{__name(this,"FieldOrderExpr")}constructor(builder){super(builder),this.fieldName=builder.fieldName}getFieldName(){return this.fieldName}toJson(){return{fieldName:this.fieldName,direction:this.getDirection()}}toWrappedJson(){return{FieldOrderExpr:this.toJson()}}toString(){return this.fieldName+" "+super.getDirection()}static fromString(s){const parts=s.trim().split(" ");return new FieldOrderExprBuilder().setFieldName(parts[0]).setDirection(parts[1]).build()}equals(o){if(!super.equals(o)||!ObjectHelper.iFrameSafeInstanceOf(o,FieldOrderExpr))return!1;const other=o;return this.fieldName.toLowerCase()===other.getFieldName().toLowerCase()}};class FieldOrderExprBuilder extends OrderExprBuilder{static{__name(this,"FieldOrderExprBuilder")}constructor(json){super(json),json&&(this.fieldName=json.fieldName)}setFieldName(value){return this.fieldName=value,this}build(){return new FieldOrderExpr$1(this)}}class DynamicOrderExpr extends OrderExpr$1{static{__name(this,"DynamicOrderExpr")}constructor(builder){super(builder),this.function=builder.function}getFunction(){return this.function}toString(){return this.function+" "+super.getDirection()}static fromString(s){const parts=s.trim().split(" ");return new DynamicOrderExprBuilder().setFunction(parts[0]).setDirection(parts[1]).build()}toJson(){return{function:this.function,direction:this.getDirection()}}toWrappedJson(){return{DynamicOrderExpr:this.toJson()}}}class DynamicOrderExprBuilder extends OrderExprBuilder{static{__name(this,"DynamicOrderExprBuilder")}constructor(json){super(json),this.function=json.function}setFunction(value){return this.function=value,this}build(){return new DynamicOrderExpr(this)}}class ChildOrder{static{__name(this,"ChildOrder")}constructor(){this.DEFAULT_ORDER_DIRECTION_VALUE="DESC",this.orderExpressions=[]}static{this.DEFAULT_ORDER_FIELD_VALUE=QueryField.MODIFIED_TIME}static{this.ASC_ORDER_DIRECTION_VALUE="ASC"}static{this.DESC_ORDER_DIRECTION_VALUE="DESC"}static{this.MANUAL_ORDER_VALUE_KEY=QueryField.MANUAL_ORDER_VALUE}static fromJson(childOrderJson){const childOrder=new ChildOrder;return childOrderJson.orderExpressions.forEach(orderExprJson=>{orderExprJson.FieldOrderExpr?childOrder.orderExpressions.push(new FieldOrderExprBuilder(orderExprJson.FieldOrderExpr).build()):orderExprJson.DynamicOrderExpr&&childOrder.orderExpressions.push(new DynamicOrderExprBuilder(orderExprJson.DynamicOrderExpr).build())}),childOrder}static toSetChildOrderJson(contentId,childOrder){return contentId&&childOrder?{childOrder:childOrder.toJson(),contentId:contentId.toString()}:null}getOrderExpressions(){return this.orderExpressions}addOrderExpr(expr){this.orderExpressions.push(expr)}addOrderExpressions(expressions){expressions.forEach(expr=>{this.orderExpressions.push(expr)})}isManual(){if(this.orderExpressions.length===0)return!1;const order=this.orderExpressions[0];return ObjectHelper.iFrameSafeInstanceOf(order,FieldOrderExpr$1)?ObjectHelper.stringEquals(ChildOrder.MANUAL_ORDER_VALUE_KEY.toLowerCase(),order.getFieldName().toLowerCase()):!1}isDesc(){if(this.orderExpressions.length===0)return this.DEFAULT_ORDER_DIRECTION_VALUE===ChildOrder.DESC_ORDER_DIRECTION_VALUE;const order=this.orderExpressions[0];return ObjectHelper.stringEquals(ChildOrder.DESC_ORDER_DIRECTION_VALUE.toLowerCase(),order.getDirection().toLowerCase())}isAlpha(){if(this.orderExpressions.length===0)return!1;const order=this.orderExpressions[0];return ObjectHelper.stringEquals(QueryField.DISPLAY_NAME.toLowerCase(),order.getFieldName().toLowerCase())}isDefault(){const order=this.orderExpressions[0];if(ObjectHelper.iFrameSafeInstanceOf(order,FieldOrderExpr$1)){const fieldOrder=order;if(ObjectHelper.stringEquals(this.DEFAULT_ORDER_DIRECTION_VALUE.toLowerCase(),fieldOrder.getDirection().toLowerCase())&&ObjectHelper.stringEquals(ChildOrder.DEFAULT_ORDER_FIELD_VALUE.toLowerCase(),fieldOrder.getFieldName().toLowerCase()))return!0}return!1}toJson(){return{orderExpressions:OrderExpr$1.toArrayJson(this.getOrderExpressions())}}toString(){return this.orderExpressions.map(expr=>expr.toString()).join(", ")}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ChildOrder))return!1;const other=o;return this.orderExpressions.length!==other.getOrderExpressions().length?!1:this.orderExpressions.every((orderExpression,index)=>orderExpression.equals(other.getOrderExpressions()[index]))}}var WorkflowState;(function(WorkflowState2){WorkflowState2.READY="ready",WorkflowState2.IN_PROGRESS="in_progress"})(WorkflowState||(WorkflowState={}));class Workflow{static{__name(this,"Workflow")}constructor(builder){this.state=builder.state}static create(){return new WorkflowBuilder}static fromJson(json){return json?new WorkflowBuilder().fromJson(json).build():null}getState(){return this.state}getStateAsString(){return WorkflowState[this.state].toLowerCase()}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,Workflow))return!1;const other=o;return this.state===other.getState()}toJson(){return{state:this.state.toUpperCase(),checks:{}}}newBuilder(){return new WorkflowBuilder(this)}static fromObject(o){return o instanceof Workflow?o:new WorkflowBuilder().fromJson(o).build()}}class WorkflowBuilder{static{__name(this,"WorkflowBuilder")}constructor(source){source&&(this.state=source.getState())}fromJson(json){return this.state=WorkflowState[json.state],this}setState(state){return this.state=state,this}build(){return new Workflow(this)}}class ContentSummaryHelper{static{__name(this,"ContentSummaryHelper")}static diff(item,other){const diff={};if(ObjectHelper.stringEquals(item.getId(),other.getId())||(diff.id=!0),ObjectHelper.equals(item.getContentId(),other.getContentId())||(diff.contentId=!0),ObjectHelper.equals(item.getName(),other.getName())||(diff.name=!0),ObjectHelper.stringEquals(item.getDisplayName(),other.getDisplayName())||(diff.displayName=!0),!ObjectHelper.anyEquals(item.getInherit(),other.getInherit())){const inheritDiff={content:!1,parent:!1,name:!1,sort:!1};item.isDataInherited()!==other.isDataInherited()&&(inheritDiff.content=!0),item.isParentInherited()!==other.isParentInherited()&&(inheritDiff.parent=!0),item.isNameInherited()!==other.isNameInherited()&&(inheritDiff.name=!0),item.isSortInherited()!==other.isSortInherited()&&(inheritDiff.sort=!0),(inheritDiff.content||inheritDiff.parent||inheritDiff.name||inheritDiff.sort)&&(diff.inherit=inheritDiff)}return ObjectHelper.equals(item.getPath(),other.getPath())||(diff.path=!0),ObjectHelper.booleanEquals(item.hasChildren(),other.hasChildren())||(diff.children=!0),ObjectHelper.equals(item.getType(),other.getType())||(diff.type=!0),ObjectHelper.stringEquals(item.getIconUrl(),other.getIconUrl())||(diff.iconUrl=!0),ObjectHelper.equals(item.getThumbnail(),other.getThumbnail())||(diff.thumbnail=!0),ObjectHelper.objectEquals(item.getModifier(),other.getModifier())||(diff.modifier=!0),ObjectHelper.objectEquals(item.getCreator(),other.getCreator())||(diff.creator=!0),ObjectHelper.objectEquals(item.getOwner(),other.getOwner())||(diff.owner=!0),ObjectHelper.booleanEquals(item.isPage(),other.isPage())||(diff.page=!0),ObjectHelper.booleanEquals(item.isValid(),other.isValid())||(diff.valid=!0),ObjectHelper.booleanEquals(item.isRequireValid(),other.isRequireValid())||(diff.requireValid=!0),ObjectHelper.dateEquals(item.getCreatedTime(),other.getCreatedTime())||(diff.createdTime=!0),ObjectHelper.dateEquals(item.getModifiedTime(),other.getModifiedTime())||(diff.modifiedTime=!0),ObjectHelper.dateEquals(item.getArchivedTime(),other.getArchivedTime())||(diff.archivedTime=!0),ObjectHelper.objectEquals(item.getArchivedBy(),other.getArchivedBy())||(diff.archivedBy=!0),ObjectHelper.dateEqualsUpToMinutes(item.getPublishFromTime(),other.getPublishFromTime())||(diff.publishFromTime=!0),ObjectHelper.dateEqualsUpToMinutes(item.getPublishToTime(),other.getPublishToTime())||(diff.publishToTime=!0),ObjectHelper.dateEqualsUpToMinutes(item.getPublishFirstTime(),other.getPublishFirstTime())||(diff.publishFirstTime=!0),ObjectHelper.booleanEquals(item.isDeletable(),other.isDeletable())||(diff.deletable=!0),ObjectHelper.booleanEquals(item.isEditable(),other.isEditable())||(diff.editable=!0),ObjectHelper.equals(item.getChildOrder(),other.getChildOrder())||(diff.childOrder=!0),ObjectHelper.stringEquals(item.getLanguage(),other.getLanguage())||(diff.language=!0),ObjectHelper.equals(item.getWorkflow(),other.getWorkflow())||(diff.workflow=!0),ObjectHelper.stringEquals(item.getOriginalParentPath(),other.getOriginalParentPath())||(diff.originalParentPath=!0),ObjectHelper.stringEquals(item.getOriginalName(),other.getOriginalName())||(diff.originalName=!0),ObjectHelper.stringEquals(item.getVariantOf(),other.getVariantOf())||(diff.variantOf=!0),diff}}const isEqual=__name(diff=>Object.keys(diff).every(key=>{const prop=diff[key];return typeof prop=="boolean"?!prop:isEqual(prop)}),"isEqual");class ContentSummary{static{__name(this,"ContentSummary")}constructor(builder){this.name=builder.name,this.displayName=builder.displayName,this.path=builder.path,this.children=builder.children,this.type=builder.type,this.iconUrl=builder.iconUrl,this.thumbnail=builder.thumbnail,this.modifier=builder.modifier,this.creator=builder.creator,this.owner=builder.owner,this.page=builder.page,this.valid=builder.valid,this.requireValid=builder.requireValid,this.id=builder.id,this.contentId=builder.contentId,this.createdTime=builder.createdTime,this.modifiedTime=builder.modifiedTime,this.archivedTime=builder.archivedTime,this.archivedBy=builder.archivedBy,this.publishFromTime=builder.publishFromTime,this.publishToTime=builder.publishToTime,this.publishFirstTime=builder.publishFirstTime,this.deletable=builder.deletable,this.editable=builder.editable,this.childOrder=builder.childOrder,this.language=builder.language,this.workflow=builder.workflow,this.inherit=builder.inherit,this.originProject=builder.originProject,this.listTitle=builder.listTitle,this.originalParentPath=builder.originalParentPath,this.originalName=builder.originalName,this.variantOf=builder.variantOf,this.readOnly=builder.readOnly}static fromObject(o){return o instanceof ContentSummary?o:new ContentSummaryBuilder().setContentId(o.contentId).setId(o.id).setName(o.name).setDisplayName(o.displayName).setPath(o.path).setHasChildren(o.children).setType(o.type).setIconUrl(o.iconUrl).setCreator(o.owner).setModifier(o.modifier).setValid(o.valid).setRequireValid(o.requireValid).setDeletable(o.deletable).setPublishFromTime(o.publishFromTime?new Date(Date.parse(o.publishFromTime)):null).setPublishToTime(o.publishToTime?new Date(Date.parse(o.publishToTime)):null).setPublishFirstTime(o.publishFirstTime?new Date(Date.parse(o.publishFirstTime)):null).setWorkflow(o.workflow).setInherit(o.inherit).setOriginProject(o.originProject).setOriginalParentPath(o.originalParentPath).setOriginalName(o.originalName).build()}static fromJson(json){return new ContentSummaryBuilder().fromContentSummaryJson(json).build()}static fromJsonArray(jsonArray){return jsonArray.map(json=>ContentSummary.fromJson(json))}getName(){return this.name}getDisplayName(){return this.displayName}hasParent(){return this.path.hasParentContent()}getPath(){return this.path}hasChildren(){return this.children}getType(){return this.type}getIconUrl(){return this.iconUrl}hasThumbnail(){return!!this.thumbnail}getThumbnail(){return this.thumbnail}getOwner(){return this.owner}getModifier(){return this.modifier}isSite(){return this.type.isSite()}isPage(){return this.page}isPageTemplate(){return this.type.isPageTemplate()}isImage(){return this.type.isImage()}isValid(){return this.valid}isRequireValid(){return this.requireValid}getId(){return this.id}getContentId(){return this.contentId}getCreatedTime(){return this.createdTime}getModifiedTime(){return this.modifiedTime}getArchivedTime(){return this.archivedTime}getArchivedBy(){return this.archivedBy}getPublishFirstTime(){return this.publishFirstTime}getPublishFromTime(){return this.publishFromTime}getPublishToTime(){return this.publishToTime}isDeletable(){return this.deletable}isEditable(){return this.editable}getChildOrder(){return this.childOrder}getLanguage(){return this.language}getWorkflow(){return this.workflow}isReady(){return!!this.workflow&&this.workflow.getState()===WorkflowState.READY}isInProgress(){return!!this.workflow&&this.workflow.getState()===WorkflowState.IN_PROGRESS}getInherit(){return this.inherit}isInherited(){return this.inherit&&this.inherit.length>0}isDataInherited(){return this.isInheritedByType(ContentInheritType.CONTENT)}isSortInherited(){return this.isInheritedByType(ContentInheritType.SORT)}isParentInherited(){return this.isInheritedByType(ContentInheritType.PARENT)}isNameInherited(){return this.isInheritedByType(ContentInheritType.NAME)}getOriginProject(){return this.originProject}getListTitle(){return this.listTitle}getOriginalParentPath(){return this.originalParentPath}getOriginalName(){return this.originalName}getVariantOf(){return this.variantOf}isVariant(){return!!this.variantOf}setReadOnly(value){this.readOnly=value}isReadOnly(){return!!this.readOnly}getCreator(){return this.creator}isInheritedByType(type){return this.isInherited()&&this.inherit.some(inheritType=>inheritType===type)}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ContentSummary))return!1;const diff=ContentSummaryHelper.diff(this,o);return isEqual(diff)}}class ContentSummaryBuilder{static{__name(this,"ContentSummaryBuilder")}constructor(source){source&&(this.id=source.getId(),this.contentId=source.getContentId(),this.name=source.getName(),this.displayName=source.getDisplayName(),this.path=source.getPath(),this.children=source.hasChildren(),this.type=source.getType(),this.iconUrl=source.getIconUrl(),this.thumbnail=source.getThumbnail(),this.modifier=source.getModifier(),this.owner=source.getOwner(),this.page=source.isPage(),this.valid=source.isValid(),this.requireValid=source.isRequireValid(),this.createdTime=source.getCreatedTime(),this.modifiedTime=source.getModifiedTime(),this.archivedTime=source.getArchivedTime(),this.archivedBy=source.getArchivedBy(),this.publishFromTime=source.getPublishFromTime(),this.publishToTime=source.getPublishToTime(),this.publishFirstTime=source.getPublishFirstTime(),this.deletable=source.isDeletable(),this.editable=source.isEditable(),this.childOrder=source.getChildOrder(),this.language=source.getLanguage(),this.workflow=source.getWorkflow(),this.inherit=source.getInherit(),this.originProject=source.getOriginProject(),this.listTitle=source.getListTitle(),this.originalParentPath=source.getOriginalParentPath(),this.originalName=source.getOriginalName(),this.variantOf=source.getVariantOf(),this.readOnly=source.isReadOnly(),this.creator=source.getCreator())}fromContentSummaryJson(json){return this.name=ContentSummaryBuilder.createName(json.name),this.displayName=json.displayName,this.path=ContentPath.create().fromString(json.path).build(),this.children=json.hasChildren,this.type=new ContentTypeName(json.type),this.iconUrl=json.iconUrl,this.thumbnail=json.thumbnail?Thumbnail.create().fromJson(json.thumbnail).build():null,this.modifier=json.modifier?PrincipalKey.fromString(json.modifier):null,this.owner=json.owner?PrincipalKey.fromString(json.owner):null,this.page=json.isPage,this.valid=json.isValid,this.requireValid=json.requireValid,this.language=json.language,this.id=json.id,this.contentId=new ContentId(json.id),this.creator=json.creator?PrincipalKey.fromString(json.creator):null,this.createdTime=json.createdTime?new Date(Date.parse(json.createdTime)):null,this.modifiedTime=json.modifiedTime?new Date(Date.parse(json.modifiedTime)):null,this.archivedTime=json.archivedTime?new Date(Date.parse(json.archivedTime)):null,this.archivedBy=json.archivedBy?PrincipalKey.fromString(json.archivedBy):null,this.publishFirstTime=json.publish&&json.publish.first?new Date(Date.parse(json.publish.first)):null,this.publishFromTime=json.publish&&json.publish.from?new Date(Date.parse(json.publish.from)):null,this.publishToTime=json.publish&&json.publish.to?new Date(Date.parse(json.publish.to)):null,this.deletable=json.deletable,this.editable=json.editable,this.childOrder=ChildOrder.fromJson(json.childOrder),this.workflow=Workflow.fromJson(json.workflow),this.inherit=json.inherit&&json.inherit.length>0?json.inherit.map(type=>ContentInheritType[type]):[],this.originProject=json.originProject,this.listTitle=ObjectHelper.isDefined(json.listTitle)?json.listTitle:json.displayName,this.originalParentPath=json.originalParentPath,this.originalName=json.originalName,this.variantOf=json.variantOf,this}static createName(name){return assert(name!=null,"name cannot be null"),name.indexOf(ContentUnnamed.UNNAMED_PREFIX)===0?new ContentUnnamed(name):new ContentName(name)}setId(value){return this.id=value,this}setContentId(value){return this.contentId=value,this}setIconUrl(value){return this.iconUrl=value,this}setValid(value){return this.valid=value,this}setRequireValid(value){return this.valid=value,this}setName(value){return this.name=value,this}setPath(path){return this.path=path,this}setType(value){return this.type=value,this}setDisplayName(value){return this.displayName=value,this}setHasChildren(value){return this.children=value,this}setDeletable(value){return this.deletable=value,this}setPublishFromTime(value){return this.publishFromTime=value,this}setPublishToTime(value){return this.publishToTime=value,this}setPublishFirstTime(value){return this.publishFirstTime=value,this}setWorkflow(value){return this.workflow=value,this}setInherit(value){return this.inherit=value,this}setOriginProject(value){return this.originProject=value,this}setOriginalParentPath(value){return this.originalParentPath=value,this}setOriginalName(value){return this.originalName=value,this}setModifier(value){return this.modifier=value,this}setCreator(value){return this.creator=value,this}build(){return new ContentSummary(this)}}class ValidationError{static{__name(this,"ValidationError")}constructor(builder){this.attachment=builder.attachment,this.errorCode=builder.errorCode,this.message=builder.message,this.propertyPath=builder.propertyPath}getAttachment(){return this.attachment}getErrorCode(){return this.errorCode}getMessage(){return this.message}getPropertyPath(){return this.propertyPath}static create(){return new ValidationErrorBuilder}static fromJson(json){return new ValidationErrorBuilder().fromJson(json).build()}}class ValidationErrorBuilder{static{__name(this,"ValidationErrorBuilder")}fromJson(json){return this.attachment=json.attachment,this.errorCode=json.errorCode,this.message=json.message,this.propertyPath=json.propertyPath,this}setAttachment(value){return this.attachment=value,this}setErrorCode(value){return this.errorCode=value,this}setMessage(value){return this.message=value,this}setPropertyPath(value){return this.propertyPath=value,this}build(){return new ValidationError(this)}}class ExtraDataByMixinNameComparator{static{__name(this,"ExtraDataByMixinNameComparator")}compare(a,b){let firstName,secondName;if(a.getName())firstName=a.getName().getLocalName();else return 1;if(b.getName())secondName=b.getName().getLocalName();else return-1;return firstName.localeCompare(secondName)}}class ContentDiffHelper{static{__name(this,"ContentDiffHelper")}static diff(item,other,ignoreEmptyDataValues=!1){const diff=ContentSummaryHelper.diff(item,other);return ContentDiffHelper.dataEquals(item.getContentData(),other.getContentData(),ignoreEmptyDataValues)||(diff.data=!0),ContentDiffHelper.extraDataEquals(item.getAllExtraData(),other.getAllExtraData(),ignoreEmptyDataValues)||(diff.extraData=!0),ObjectHelper.equals(item.getPage(),other.getPage())||(diff.pageObj=!0),ObjectHelper.equals(item.getPermissions(),other.getPermissions())||(diff.permissions=!0),ObjectHelper.equals(item.getAttachments(),other.getAttachments())||(diff.attachments=!0),diff}static dataEquals(data,other,ignoreEmptyValues=!1){return PropertyTreeHelper.propertyTreesEqual(data,other,ignoreEmptyValues)}static extraDataEquals(extraData,other,ignoreEmptyValues=!1){if(ignoreEmptyValues){const isOtherArrayEmpty=!other||other.length===0||other.every(ed=>!ed.getData()||ed.getData().isEmpty());if((!extraData||extraData.length===0||extraData.every(ed=>!ed.getData()||ed.getData().isEmpty()))&&isOtherArrayEmpty)return!0}const comparator=new ExtraDataByMixinNameComparator,arrayA=extraData.sort(comparator.compare),arrayB=other.sort(comparator.compare);if(arrayA.length!==arrayB.length)return!1;for(let i=0;i<arrayA.length;i++)if(!PropertyTreeHelper.propertyTreesEqual(arrayA[i].getData(),arrayB[i].getData(),ignoreEmptyValues))return!1;return!0}}class Content extends ContentSummary{static{__name(this,"Content")}constructor(builder){super(builder),this.extraData=[],this.validationErrors=[],assertNotNull(builder.data,"data is required for Content"),this.data=builder.data,this.attachments=builder.attachments,this.extraData=builder.extraData||[],this.pageObj=builder.pageObj,this.permissions=builder.permissions||new AccessControlList,this.validationErrors=builder.validationErrors||[]}getContentData(){return this.data}getAttachments(){return this.attachments}getExtraDataByName(name){return this.extraData.filter(item=>item.getName().equals(name))[0]}getAllExtraData(){return this.extraData}getProperty(propertyName){return propertyName?this.data.getProperty(propertyName):null}getPage(){return this.pageObj}getValidationErrors(){return this.validationErrors}getPermissions(){return this.permissions}equals(o,ignoreEmptyValues=!1){if(!ObjectHelper.iFrameSafeInstanceOf(o,Content))return!1;const diff=ContentDiffHelper.diff(this,o,ignoreEmptyValues);return isEqual(diff)}clone(){return this.newBuilder().build()}newBuilder(){return new ContentBuilder(this)}newBuilderWithoutProperties(){return new ContentBuilder(this,!1)}}class ContentBuilder extends ContentSummaryBuilder{static{__name(this,"ContentBuilder")}constructor(source,cloneProperties=!0){super(source),source&&(cloneProperties&&(this.data=source.getContentData()?source.getContentData().copy():null,this.extraData=source.getAllExtraData()?source.getAllExtraData().map(extraData=>extraData.clone()):[],this.pageObj=source.getPage()?source.getPage().clone():null),this.attachments=source.getAttachments(),this.permissions=source.getPermissions(),this.validationErrors=source.getValidationErrors())}fromContentJson(json){return super.fromContentSummaryJson(json),this.data=PropertyTree.fromJson(json.data),this.attachments=new AttachmentsBuilder().fromJson(json.attachments).build(),this.extraData=[],json.meta.forEach(extraDataJson=>{this.extraData.push(ExtraData.fromJson(extraDataJson))}),this.page&&(this.pageObj=new PageBuilder().fromJson(json.page).build(),this.page=!0),json.permissions&&(this.permissions=AccessControlList.fromJson(json)),json.validationErrors&&(this.validationErrors=json.validationErrors.map(ValidationError.fromJson)),this}setData(value){return this.data=value,this}setAttachments(value){return this.attachments=value,this}setPage(value){return this.pageObj=value,this.page=!!value,this}setExtraData(extraData){return this.extraData=extraData,this}setPermissions(value){return this.permissions=value,this}setValidationErrors(value){return this.validationErrors=value,this}build(){return new Content(this)}}class ApplicationConfig{static{__name(this,"ApplicationConfig")}static{this.PROPERTY_CONFIG="config"}static{this.PROPERTY_KEY="applicationKey"}constructor(builder){this.applicationKey=builder.applicationKey,this.config=builder.config}static create(){return new ApplicationConfigBuilder}getApplicationKey(){return this.applicationKey}getConfig(){return this.config}toJson(){return{applicationKey:this.applicationKey.toString(),config:this.config.toJson()}}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ApplicationConfig))return!1;let other=o;return!(!ObjectHelper.equals(this.applicationKey,other.applicationKey)||!ObjectHelper.equals(this.config,other.config))}clone(){return new ApplicationConfigBuilder(this).build()}}class ApplicationConfigBuilder{static{__name(this,"ApplicationConfigBuilder")}constructor(source){if(source&&(this.applicationKey=source.getApplicationKey(),source.getConfig())){let newTree=new PropertyTree(source.getConfig());this.config=newTree.getRoot()}}fromData(propertySet){assertNotNull(propertySet,"data cannot be null");const applicationKey=ApplicationKey.fromString(propertySet.getString(ApplicationConfig.PROPERTY_KEY)),config=propertySet.getPropertySet(ApplicationConfig.PROPERTY_CONFIG);return this.setApplicationKey(applicationKey),this.setConfig(config),this}setApplicationKey(value){return this.applicationKey=value,this}setConfig(value){return this.config=value,this}build(){return new ApplicationConfig(this)}}class Site extends Content{static{__name(this,"Site")}constructor(builder){super(builder)}isSite(){return!0}getDescription(){return this.getContentData().getString("description")}getSiteConfigs(){const siteConfigs=[];return this.getContentData().forEachProperty("siteConfig",applicationProperty=>{const siteConfigData=applicationProperty.getPropertySet();if(siteConfigData){const siteConfig=ApplicationConfig.create().fromData(siteConfigData).build();siteConfigs.push(siteConfig)}}),siteConfigs}getApplicationKeys(){return this.getSiteConfigs().map(config=>config.getApplicationKey())}equals(o,ignoreEmptyValues=!1){return ObjectHelper.iFrameSafeInstanceOf(o,Site)?super.equals(o,ignoreEmptyValues):!1}clone(){return this.newBuilder().build()}newBuilder(){return new SiteBuilder(this)}}class SiteBuilder extends ContentBuilder{static{__name(this,"SiteBuilder")}constructor(source){super(source)}build(){return new Site(this)}}class PageTemplate extends Content{static{__name(this,"PageTemplate")}constructor(builder){super(builder),this.canRender=[],this.getContentData().forEachProperty("supports",property=>{this.canRender.push(new ContentTypeName(property.getString()))})}getKey(){return PageTemplateKey.fromContentId(this.getContentId())}getController(){return this.getPage().getController()}isCanRender(pattern){return this.getCanRender().some(name=>name.equals(pattern))}getCanRender(){return this.canRender}hasRegions(){return this.isPage()?this.getPage().hasNonEmptyRegions():!1}getRegions(){return this.isPage()?this.getPage().getRegions():null}hasConfig(){return this.isPage()?this.getPage().hasConfig():!1}getConfig(){return this.isPage()?this.getPage().getConfig():null}equals(o,ignoreEmptyValues=!1){return ObjectHelper.iFrameSafeInstanceOf(o,PageTemplate)?super.equals(o,ignoreEmptyValues):!1}clone(){return this.newBuilder().build()}newBuilder(){return new PageTemplateBuilder(this)}}class PageTemplateBuilder extends ContentBuilder{static{__name(this,"PageTemplateBuilder")}constructor(source){super(source)}build(){return new PageTemplate(this)}}class ProjectBasedResourceRequest extends ResourceRequest{static{__name(this,"ProjectBasedResourceRequest")}getRestPath(){return Path.create().fromParent(super.getRestPath(),UrlHelper.getCMSPathWithProject(this.projectName)).build()}setRequestProject(value){return this.projectName=value?value.getName():null,this}setRequestProjectName(value){return this.projectName=value,this}}class ContentResourceRequest extends ProjectBasedResourceRequest{static{__name(this,"ContentResourceRequest")}static{this.EXPAND_NONE="none"}static{this.EXPAND_SUMMARY="summary"}static{this.EXPAND_FULL="full"}static{this.CONTENT_PATH="content"}constructor(){super(),this.addRequestPathElements(ContentResourceRequest.CONTENT_PATH)}fromJsonToContentSummary(json){return ContentSummary.fromJson(json)}fromJsonToContentSummaryArray(json){return json.map(itemJson=>this.fromJsonToContentSummary(itemJson))}fromJsonToContentArray(json){return json.map(itemJson=>this.fromJsonToContent(itemJson))}fromJsonToContent(json){const type=new ContentTypeName(json.type);return type.isSite()?new SiteBuilder().fromContentJson(json).build():type.isPageTemplate()?new PageTemplateBuilder().fromContentJson(json).build():new ContentBuilder().fromContentJson(json).build()}}class GetComponentDescriptorRequest extends CmsResourceRequest{static{__name(this,"GetComponentDescriptorRequest")}static{this.CACHE=new Map}constructor(descriptorKey,componentType=PageComponentType.get()){super();const isPage=ObjectHelper.iFrameSafeInstanceOf(componentType,PageComponentType);this.descriptorKey=descriptorKey,this.componentType=componentType,this.addRequestPathElements(ContentResourceRequest.CONTENT_PATH,"page",isPage?"":componentType.getShortName(),"descriptor")}getParams(){return{key:this.descriptorKey}}parseResponse(response){return Descriptor.fromJson(response.getResult()).setComponentType(this.componentType)}getCacheKey(){return`${this.componentType.getShortName()}::${this.descriptorKey}`}sendAndParse(){const cacheKey=this.getCacheKey();if(GetComponentDescriptorRequest.CACHE.has(cacheKey))return GetComponentDescriptorRequest.CACHE.get(cacheKey);const promise=super.sendAndParse();return GetComponentDescriptorRequest.CACHE.set(cacheKey,promise),promise}}class CmsProjectBasedResourceRequest extends CmsResourceRequest{static{__name(this,"CmsProjectBasedResourceRequest")}getRestPath(){return Path.create().fromParent(super.getRestPath(),UrlHelper.getCMSPathWithProject(this.projectName,this.contentRootPath)).build()}setRequestProject(value){return this.projectName=value?.getName(),this}setRequestProjectName(value){return this.projectName=value,this}setContentRootPath(value){return this.contentRootPath=value,this}}class CmsContentResourceRequest extends CmsProjectBasedResourceRequest{static{__name(this,"CmsContentResourceRequest")}static{this.EXPAND_NONE="none"}static{this.EXPAND_SUMMARY="summary"}static{this.EXPAND_FULL="full"}constructor(){super(),this.addRequestPathElements(ContentResourceRequest.CONTENT_PATH),this.setContentRootPath(ContentResourceRequest.CONTENT_PATH)}fromJsonToContentSummary(json){return ContentSummary.fromJson(json)}fromJsonToContentSummaryArray(json){return json.map(itemJson=>this.fromJsonToContentSummary(itemJson))}fromJsonToContentArray(json){return json.map(itemJson=>this.fromJsonToContent(itemJson))}fromJsonToContent(json){const type=new ContentTypeName(json.type);return type.isSite()?new SiteBuilder().fromContentJson(json).build():type.isPageTemplate()?new PageTemplateBuilder().fromContentJson(json).build():new ContentBuilder().fromContentJson(json).build()}}class FragmentResourceRequest extends CmsContentResourceRequest{static{__name(this,"FragmentResourceRequest")}constructor(){super(),this.addRequestPathElements("page","fragment")}}class CreateFragmentRequest extends FragmentResourceRequest{static{__name(this,"CreateFragmentRequest")}constructor(contentId){super(),this.setMethod(HttpMethod.POST),this.contentId=contentId,this.addRequestPathElements("create")}setConfig(config){return this.config=config,this}setComponent(value){return this.component=value,this}setWorkflow(workflow){return this.workflow=workflow,this}getParams(){return{contentId:this.contentId.toString(),config:this.config?this.config.toJson():null,component:this.component!=null?this.component.toJson():null,workflow:this.workflow.toJson()}}parseResponse(response){return response.isBlank()?null:this.fromJsonToContent(response.getResult())}}class ContentContext{static{__name(this,"ContentContext")}constructor(){}static get(){return ContentContext.INSTANCE||(ContentContext.INSTANCE=new ContentContext),ContentContext.INSTANCE}getContent(){return this.content}setContent(content){return this.content=content,this}}class PageHelper{static{__name(this,"PageHelper")}static fetchAndInjectLayoutRegions(layout){return layout?.hasDescriptor()?this.loadDescriptor(layout.getDescriptorKey(),LayoutComponentType.get()).then(descriptor=>layout.setDescriptor(descriptor)):Q()}static loadDescriptor(key,type){return new GetComponentDescriptorRequest(key.toString(),type).sendAndParse().then(pageDescriptor=>pageDescriptor).catch(()=>{throw Error(i18n("live.view.page.error.descriptornotfound",key))})}static injectEmptyRegionsIntoPage(page){if(page.getController())return PageHelper.loadDescriptor(page.getController()).then(pageDescriptor=>{const regionsFetchPromises=pageDescriptor.getRegions().map(regionDesc=>{const existingRegion=page.getRegions()?.getRegionByName(regionDesc.getName())?.clone();return existingRegion?this.updateExistingRegion(existingRegion):Q.resolve(Region.create().setName(regionDesc.getName()).build())});return Q.all(regionsFetchPromises).then(descriptorRegions=>{const fullRegionsBuilder=Regions.create();descriptorRegions&&fullRegionsBuilder.setRegions(descriptorRegions),page.getRegions()?.getRegions().forEach(persistedRegion=>{descriptorRegions.some(d=>d.getName()===persistedRegion.getName())||fullRegionsBuilder.addRegion(persistedRegion)});const fullRegions=fullRegionsBuilder.build(),fullPage=new PageBuilder(page).setRegions(fullRegions).build();return Q.resolve(fullPage)})});const fragment=page.getFragment();return fragment instanceof LayoutComponent&&fragment.hasDescriptor()?this.fetchAndInjectLayoutRegions(page.getFragment()).then(()=>page):Q.resolve(page)}static updateExistingRegion(existingRegion){const layoutsPromises=existingRegion.getComponents().filter(component=>component instanceof LayoutComponent).filter(layout=>layout.getDescriptorKey()).map(layout=>PageHelper.fetchAndInjectLayoutRegions(layout));return Q.all(layoutsPromises).then(()=>existingRegion)}static getPropertyValueUsageCount(container,name,value,startFrom=0){let counter=startFrom;return container.getRegions().getRegions().forEach(region=>{region.getComponents().forEach(component=>{component instanceof ConfigBasedComponent&&component.getConfig().getProperty(name)?.getString()===value&&counter++,component instanceof LayoutComponent&&(counter=this.getPropertyValueUsageCount(component,name,value,counter))})}),counter}static doRegionsContainId(regions,id,fragments=[]){return regions.some(region=>region.getComponents().some(component=>{if(component instanceof FragmentComponent){const contentId=component.getFragment();contentId&&fragments.push(contentId)}return component instanceof ImageComponent?component.getImage().equals(id):component instanceof LayoutComponent?this.doRegionsContainId(component.getRegions().getRegions(),id,fragments):!1}))}static doesFragmentContainId(fragment,id){let containsId=!1;return fragment instanceof ImageComponent&&(containsId=fragment.hasImage()&&fragment.getImage().equals(id)),containsId}static getPageIconClass(page){const largeIconCls=" icon-large";return page?.hasTemplate()?"icon-page-template"+largeIconCls:page?.getController()?"icon-file"+largeIconCls:"icon-wand"+largeIconCls}static createFragmentFromComponent(component){if(!component)throw new Error("Failed to create fragment: no source component");const content=ContentContext.get().getContent();if(!content)throw new Error("Failed to create fragment: contend id is not available");const contentId=content?.getContentId();return new CreateFragmentRequest(contentId).setConfig(null).setComponent(component).setWorkflow(content.getContentSummary().getWorkflow()).sendAndParse()}static findFragmentInRegionsByFragmentId(regions,fragmentId){let result=null;return regions?.some(region=>(result=PageHelper.findFragmentInRegionByFragmentId(region,fragmentId),!!result)),result}static findFragmentInRegionByFragmentId(region,fragmentId){let result=null;return region.getComponents().some(component=>(component instanceof FragmentComponent&&(component.getFragment()?.equals(fragmentId)?result=component:component instanceof LayoutComponent&&(result=PageHelper.findFragmentInRegionsByFragmentId(component.getRegions()?.getRegions(),fragmentId))),!!result)),result}static stringEqualsIgnoreEmpty(a,b){return StringHelper.isEmpty(a)&&StringHelper.isEmpty(b)||ObjectHelper.stringEquals(a,b)}static flattenPageComponents(page,type){if(!page)return[];const result=PageHelper.getFlatPageComponents(page);return type?result.filter(component=>component.getType().getShortName()===type.getShortName()):result}static getFlatPageComponents(page){if(page.isFragment()){const fragmentComponent=page.getFragment();return fragmentComponent instanceof LayoutComponent?[fragmentComponent,...PageHelper.flattenRegionsComponents(fragmentComponent.getRegions())]:[fragmentComponent]}return PageHelper.flattenRegionsComponents(page.getRegions())}static flattenRegionsComponents(regions){const result=[];return regions.getRegions().forEach(region=>{PageHelper.flattenRegion(region).forEach(component=>result.push(component))}),result}static flattenRegion(region){const result=[];return region.getComponents().forEach(component=>{PageHelper.flattenComponent(component).forEach(c=>result.push(c))}),result}static flattenComponent(component){return component instanceof LayoutComponent?[component,...PageHelper.flattenRegionsComponents(component.getRegions())]:[component]}}var PageNavigationEventSource;(function(PageNavigationEventSource2){PageNavigationEventSource2[PageNavigationEventSource2.EDITOR=0]="EDITOR",PageNavigationEventSource2[PageNavigationEventSource2.FORM=1]="FORM"})(PageNavigationEventSource||(PageNavigationEventSource={}));class PageNavigationEventData{static{__name(this,"PageNavigationEventData")}constructor(path,source,focus){this.path=path,this.source=source,this.focus=focus}getPath(){return this.path}getSource(){return this.source}isFocus(){return this.focus}}class PageNavigationEvent{static{__name(this,"PageNavigationEvent")}constructor(type,data){this.type=type,this.data=data||new PageNavigationEventData}getType(){return this.type}getData(){return this.data}}class PageNavigationMediator{static{__name(this,"PageNavigationMediator")}constructor(){this.pageNavigationHandlers=[]}static get(){return PageNavigationMediator.INSTANCE||(PageNavigationMediator.INSTANCE=new PageNavigationMediator),PageNavigationMediator.INSTANCE}notify(event,source){this.pageNavigationHandlers.forEach(item=>{item!==source&&item.handle(event)})}addPageNavigationHandler(item){this.pageNavigationHandlers.push(item)}removePageNavigationItem(item){this.pageNavigationHandlers=this.pageNavigationHandlers.filter(i=>i!==item)}}var PageNavigationEventType;(function(PageNavigationEventType2){PageNavigationEventType2.SELECT="select",PageNavigationEventType2.DESELECT="deselect",PageNavigationEventType2.INSPECT="inspect"})(PageNavigationEventType||(PageNavigationEventType={}));class PageEventsManager{static{__name(this,"PageEventsManager")}constructor(){this.componentViewDragStartedListeners=[],this.componentViewDragStoppedListeners=[],this.componentViewDragCanceledListeners=[],this.componentDragDroppedListeners=[],this.savePageAsTemplateListeners=[],this.pageLockedListeners=[],this.pageUnlockedListeners=[],this.renderableListeners=[],this.beforeLoadListeners=[],this.loadedListeners=[],this.componentLoadedListeners=[],this.componentLoadFailedListeners=[],this.liveEditPageViewReadyListeners=[],this.liveEditPageInitErrorListeners=[],this.fragmentLoadErrorListeners=[],this.showWarningListeners=[],this.editContentListeners=[],this.createHtmlAreaDialogListeners=[],this.dialogCreatedListeners=[],this.pageResetRequestedListeners=[],this.pageReloadRequestedListeners=[],this.customizePageRequestedListeners=[],this.setCustomizedPageRequestedListeners=[],this.pageTemplateSetRequestedListeners=[],this.pageControllerSetRequestedListeners=[],this.componentResetRequestedListeners=[],this.componentRemoveRequestedListeners=[],this.componentDescriptorSetRequestedListeners=[],this.componentDuplicateRequestedListeners=[],this.componentMoveRequestedListeners=[],this.componentCreateFragmentRequestedListeners=[],this.componentDetachFragmentRequestedListeners=[],this.componentAddRequestedListeners=[],this.setFragmentComponentRequestedListeners=[],this.textComponentUpdateRequestedListeners=[],this.textComponentEditRequestedListeners=[],this.setComponentStateListeners=[],this.textComponentEditModeListeners=[]}static get(){return PageEventsManager.INSTANCE||(PageEventsManager.INSTANCE=new PageEventsManager),PageEventsManager.INSTANCE}onComponentDragStarted(listener){this.componentViewDragStartedListeners.push(listener)}unComponentDragStarted(listener){this.componentViewDragStartedListeners=this.componentViewDragStartedListeners.filter(curr=>curr!==listener)}notifyComponentDragStarted(path){this.componentViewDragStartedListeners.forEach(listener=>listener(path))}onComponentDragStopped(listener){this.componentViewDragStoppedListeners.push(listener)}unComponentDragStopped(listener){this.componentViewDragStoppedListeners=this.componentViewDragStoppedListeners.filter(curr=>curr!==listener)}notifyComponentDragStopped(path){this.componentViewDragStoppedListeners.forEach(listener=>listener(path))}onComponentViewDragCanceled(listener){this.componentViewDragCanceledListeners.push(listener)}unComponentViewDragCanceled(listener){this.componentViewDragCanceledListeners=this.componentViewDragCanceledListeners.filter(curr=>curr!==listener)}notifyComponentViewDragCanceled(event){this.componentViewDragCanceledListeners.forEach(listener=>listener(event))}onComponentDragDropped(listener){this.componentDragDroppedListeners.push(listener)}unComponentViewDragDropped(listener){this.componentDragDroppedListeners=this.componentDragDroppedListeners.filter(curr=>curr!==listener)}notifyComponentViewDragDropped(from,to){this.componentDragDroppedListeners.forEach(listener=>listener(from,to))}onPageLocked(listener){this.pageLockedListeners.push(listener)}unPageLocked(listener){this.pageLockedListeners=this.pageLockedListeners.filter(curr=>curr!==listener)}notifyPageLocked(event){this.pageLockedListeners.forEach(listener=>listener(event))}onPageUnlocked(listener){this.pageUnlockedListeners.push(listener)}unPageUnlocked(listener){this.pageUnlockedListeners=this.pageUnlockedListeners.filter(curr=>curr!==listener)}notifyPageUnlocked(event){this.pageUnlockedListeners.forEach(listener=>listener(event))}onPageResetRequested(listener){this.pageResetRequestedListeners.push(listener)}unPageResetRequested(listener){this.pageResetRequestedListeners=this.pageResetRequestedListeners.filter(curr=>curr!==listener)}notifyPageResetRequested(){this.pageResetRequestedListeners.forEach(listener=>listener())}onPageSaveAsTemplate(listener){this.savePageAsTemplateListeners.push(listener)}unPageSaveAsTemplate(listener){this.savePageAsTemplateListeners=this.savePageAsTemplateListeners.filter(curr=>curr!==listener)}notifyPageSaveAsTemplate(){this.savePageAsTemplateListeners.forEach(listener=>listener())}onComponentLoaded(listener){this.componentLoadedListeners.push(listener)}unComponentLoaded(listener){this.componentLoadedListeners=this.componentLoadedListeners.filter(curr=>curr!==listener)}notifyComponentLoaded(path){this.componentLoadedListeners.forEach(listener=>listener(path))}onComponentLoadFailed(listener){this.componentLoadFailedListeners.push(listener)}unComponentLoadFailed(listener){this.componentLoadFailedListeners=this.componentLoadFailedListeners.filter(curr=>curr!==listener)}notifyComponentLoadFailed(path,error){this.componentLoadFailedListeners.forEach(listener=>listener(path,error))}onLiveEditPageViewReady(listener){this.liveEditPageViewReadyListeners.push(listener)}unLiveEditPageViewReady(listener){this.liveEditPageViewReadyListeners=this.liveEditPageViewReadyListeners.filter(curr=>curr!==listener)}notifyLiveEditPageViewReady(event){this.liveEditPageViewReadyListeners.forEach(listener=>listener(event))}onLiveEditPageInitializationError(listener){this.liveEditPageInitErrorListeners.push(listener)}unLiveEditPageInitializationError(listener){this.liveEditPageInitErrorListeners=this.liveEditPageInitErrorListeners.filter(curr=>curr!==listener)}notifyLiveEditPageInitializationError(event){this.liveEditPageInitErrorListeners.forEach(listener=>listener(event))}onLiveEditPageDialogCreate(listener){this.createHtmlAreaDialogListeners.push(listener)}unLiveEditPageDialogCreate(listener){this.createHtmlAreaDialogListeners=this.createHtmlAreaDialogListeners.filter(curr=>curr!==listener)}notifyLiveEditPageDialogCreate(event){this.createHtmlAreaDialogListeners.forEach(listener=>listener(event))}onDialogCreated(listener){this.dialogCreatedListeners.push(listener)}unDialogCreated(listener){this.dialogCreatedListeners=this.dialogCreatedListeners.filter(curr=>curr!==listener)}notifyDialogCreated(modalDialog,config){this.dialogCreatedListeners.forEach(listener=>listener(modalDialog,config))}onFragmentLoadError(listener){this.fragmentLoadErrorListeners.push(listener)}unFragmentLoadError(listener){this.fragmentLoadErrorListeners=this.fragmentLoadErrorListeners.filter(curr=>curr!==listener)}notifyFragmentLoadError(path){this.fragmentLoadErrorListeners.forEach(listener=>listener(path))}onShowWarning(listener){this.showWarningListeners.push(listener)}unShowWarning(listener){this.showWarningListeners=this.showWarningListeners.filter(curr=>curr!==listener)}notifyShowWarning(event){this.showWarningListeners.forEach(listener=>listener(event))}onEditContent(listener){this.editContentListeners.push(listener)}unEditContent(listener){this.editContentListeners=this.editContentListeners.filter(curr=>curr!==listener)}notifyEditContent(event){this.editContentListeners.forEach(listener=>listener(event))}onRenderableChanged(listener){this.renderableListeners.push(listener)}unRenderableChanged(listener){this.renderableListeners=this.renderableListeners.filter(curr=>curr!==listener)}notifyRenderableChanged(value){this.renderableListeners.forEach(listener=>listener(value))}onLoaded(listener){this.loadedListeners.push(listener)}unLoaded(listener){this.loadedListeners=this.loadedListeners.filter(function(curr){return curr!==listener})}notifyLoaded(){this.loadedListeners.forEach(listener=>{listener()})}onBeforeLoad(listener){this.beforeLoadListeners.push(listener)}unBeforeLoad(listener){this.beforeLoadListeners=this.beforeLoadListeners.filter(function(curr){return curr!==listener})}notifyBeforeLoad(){this.beforeLoadListeners.forEach(listener=>{listener()})}onComponentResetRequested(listener){this.componentResetRequestedListeners.push(listener)}unComponentResetRequested(listener){this.componentResetRequestedListeners=this.componentResetRequestedListeners.filter(curr=>curr!==listener)}notifyComponentResetRequested(path){this.componentResetRequestedListeners.forEach(listener=>listener(path))}onComponentRemoveRequested(listener){this.componentRemoveRequestedListeners.push(listener)}unComponentRemoveRequested(listener){this.componentRemoveRequestedListeners=this.componentRemoveRequestedListeners.filter(curr=>curr!==listener)}notifyComponentRemoveRequested(path){this.componentRemoveRequestedListeners.forEach(listener=>listener(path))}onComponentDuplicateRequested(listener){this.componentDuplicateRequestedListeners.push(listener)}unComponentDuplicateRequested(listener){this.componentDuplicateRequestedListeners=this.componentDuplicateRequestedListeners.filter(curr=>curr!==listener)}notifyComponentDuplicateRequested(path){this.componentDuplicateRequestedListeners.forEach(listener=>listener(path))}onComponentCreateFragmentRequested(listener){this.componentCreateFragmentRequestedListeners.push(listener)}unComponentCreateFragmentRequested(listener){this.componentCreateFragmentRequestedListeners=this.componentCreateFragmentRequestedListeners.filter(curr=>curr!==listener)}notifyComponentCreateFragmentRequested(path){this.componentCreateFragmentRequestedListeners.forEach(listener=>listener(path))}onComponentDetachFragmentRequested(listener){this.componentDetachFragmentRequestedListeners.push(listener)}unComponentDetachFragmentRequested(listener){this.componentDetachFragmentRequestedListeners=this.componentDetachFragmentRequestedListeners.filter(curr=>curr!==listener)}notifyComponentDetachFragmentRequested(path){this.componentDetachFragmentRequestedListeners.forEach(listener=>listener(path))}onComponentAddRequested(listener){this.componentAddRequestedListeners.push(listener)}unComponentAddRequested(listener){this.componentAddRequestedListeners=this.componentAddRequestedListeners.filter(curr=>curr!==listener)}notifyComponentAddRequested(path,type){this.componentAddRequestedListeners.forEach(listener=>listener(path,type))}onPageTemplateSetRequested(listener){this.pageTemplateSetRequestedListeners.push(listener)}unPageTemplateSetRequested(listener){this.pageTemplateSetRequestedListeners=this.pageTemplateSetRequestedListeners.filter(curr=>curr!==listener)}notifyPageTemplateSetRequested(pageTemplate){this.pageTemplateSetRequestedListeners.forEach(listener=>listener(pageTemplate))}onPageControllerSetRequested(listener){this.pageControllerSetRequestedListeners.push(listener)}unPageControllerSetRequested(listener){this.pageControllerSetRequestedListeners=this.pageControllerSetRequestedListeners.filter(curr=>curr!==listener)}notifyPageControllerSetRequested(controller){this.pageControllerSetRequestedListeners.forEach(listener=>listener(controller))}onSetFragmentComponentRequested(listener){this.setFragmentComponentRequestedListeners.push(listener)}unSetFragmentComponentRequested(listener){this.setFragmentComponentRequestedListeners=this.setFragmentComponentRequestedListeners.filter(curr=>curr!==listener)}notifySetFragmentComponentRequested(parentPath,id){this.setFragmentComponentRequestedListeners.forEach(listener=>listener(parentPath,id))}onComponentDescriptorSetRequested(listener){this.componentDescriptorSetRequestedListeners.push(listener)}unComponentDescriptorSetRequested(listener){this.componentDescriptorSetRequestedListeners=this.componentDescriptorSetRequestedListeners.filter(curr=>curr!==listener)}notifyComponentDescriptorSetRequested(path,descriptorKey){this.componentDescriptorSetRequestedListeners.forEach(listener=>listener(path,descriptorKey))}onTextComponentUpdateRequested(listener){this.textComponentUpdateRequestedListeners.push(listener)}untTextComponentUpdateRequested(listener){this.textComponentUpdateRequestedListeners=this.textComponentUpdateRequestedListeners.filter(curr=>curr!==listener)}notifyTextComponentUpdateRequested(path,value,origin){this.textComponentUpdateRequestedListeners.forEach(listener=>listener(path,value,origin))}onSetComponentState(listener){this.setComponentStateListeners.push(listener)}unSetComponentState(listener){this.setComponentStateListeners=this.setComponentStateListeners.filter(curr=>curr!==listener)}notifySetComponentState(path,processing){this.setComponentStateListeners.forEach(listener=>listener(path,processing))}onTextComponentEditRequested(listener){this.textComponentEditRequestedListeners.push(listener)}untTextComponentEditRequested(listener){this.textComponentEditRequestedListeners=this.textComponentEditRequestedListeners.filter(curr=>curr!==listener)}notifyTextComponentEditRequested(path){PageNavigationMediator.get().notify(new PageNavigationEvent(PageNavigationEventType.INSPECT,new PageNavigationEventData(path,PageNavigationEventSource.FORM,!0))),this.textComponentEditRequestedListeners.forEach(listener=>listener(path))}onTextComponentEditModeChanged(listener){this.textComponentEditModeListeners.push(listener)}untTextComponentEditModeChanged(listener){this.textComponentEditModeListeners=this.textComponentEditModeListeners.filter(curr=>curr!==listener)}notifyTextComponentEditModeChanged(value){this.textComponentEditModeListeners.forEach(listener=>listener(value))}onCustomizePageRequested(listener){this.customizePageRequestedListeners.push(listener)}unCustomizePageRequested(listener){this.customizePageRequestedListeners=this.customizePageRequestedListeners.filter(curr=>curr!==listener)}notifyCustomizePageRequested(){this.customizePageRequestedListeners.forEach(listener=>listener())}onSetCustomizedPageRequested(listener){this.setCustomizedPageRequestedListeners.push(listener)}unSetCustomizedPageRequested(listener){this.setCustomizedPageRequestedListeners=this.setCustomizedPageRequestedListeners.filter(curr=>curr!==listener)}notifySetCustomizedPageRequested(template){this.setCustomizedPageRequestedListeners.forEach(listener=>listener(template))}onComponentMoveRequested(listener){this.componentMoveRequestedListeners.push(listener)}unComponentMoveRequested(listener){this.componentMoveRequestedListeners=this.componentMoveRequestedListeners.filter(curr=>curr!==listener)}notifyComponentMoveRequested(from,to){this.componentMoveRequestedListeners.forEach(listener=>listener(from,to))}onPageReloadRequested(listener){this.pageReloadRequestedListeners.push(listener)}unPageReloadRequested(listener){this.pageReloadRequestedListeners=this.pageReloadRequestedListeners.filter(curr=>curr!==listener)}notifyPageReloadRequested(){this.pageReloadRequestedListeners.forEach(listener=>listener())}}class PageEventsHolder extends ComponentEventsHolder{static{__name(this,"PageEventsHolder")}constructor(){super(...arguments),this.pageUpdatedListeners=[],this.pageResetListeners=[],this.pageConfigUpdatedListeners=[]}onPageUpdated(listener){this.pageUpdatedListeners.push(listener)}unPageUpdated(listener){this.pageUpdatedListeners=this.pageUpdatedListeners.filter(l=>l!==listener)}notifyPageUpdated(event){this.pageUpdatedListeners.forEach(listener=>listener(event))}onPageReset(listener){this.pageResetListeners.push(listener)}unPageReset(listener){this.pageResetListeners=this.pageResetListeners.filter(l=>l!==listener)}notifyPageReset(){this.pageResetListeners.forEach(listener=>listener())}onPageConfigUpdated(listener){this.pageConfigUpdatedListeners.push(listener)}unPageConfigUpdated(listener){this.pageConfigUpdatedListeners=this.pageConfigUpdatedListeners.filter(l=>l!==listener)}notifyPageConfigUpdated(){this.pageConfigUpdatedListeners.forEach(listener=>listener())}}class PageEventsWrapper extends ComponentEventsWrapper{static{__name(this,"PageEventsWrapper")}constructor(holder){super(holder)}onPageUpdated(listener){this.eventsHolder.onPageUpdated(listener)}unPageUpdated(listener){this.eventsHolder.unPageUpdated(listener)}onPageReset(listener){this.eventsHolder.onPageReset(listener)}unPageReset(listener){this.eventsHolder.unPageReset(listener)}onPageConfigUpdated(listener){this.eventsHolder.onPageConfigUpdated(listener)}unPageConfigUpdated(listener){this.eventsHolder.unPageConfigUpdated(listener)}}class PageUpdatedEvent{static{__name(this,"PageUpdatedEvent")}}class PageControllerUpdatedEvent extends PageUpdatedEvent{static{__name(this,"PageControllerUpdatedEvent")}constructor(newValue,oldValue){super(),this.newValue=newValue,this.oldValue=oldValue}getPageController(){return this.newValue}getOldPageController(){return this.oldValue}}class PageTemplateUpdatedEvent extends PageUpdatedEvent{static{__name(this,"PageTemplateUpdatedEvent")}constructor(newValue,oldValue){super(),this.newValue=newValue,this.oldValue=oldValue}getPageTemplate(){return this.newValue}getOldPageTemplate(){return this.oldValue}}class PageControllerCustomizedEvent extends PageControllerUpdatedEvent{static{__name(this,"PageControllerCustomizedEvent")}}class GetContentByIdRequest extends CmsContentResourceRequest{static{__name(this,"GetContentByIdRequest")}constructor(id){super(),this.id=id}setExpand(expand){return this.expand=expand,this}setVersion(version2){return this.versionId=version2,this}getParams(){return{id:this.id.toString(),versionId:this.versionId,expand:this.expand}}parseResponse(response){return this.fromJsonToContent(response.getResult())}}class ComponentDetachedEvent extends ComponentAddedEvent{static{__name(this,"ComponentDetachedEvent")}constructor(component,name,index){super(component,index),this.name=name}getName(){return this.name}}class ComponentDuplicatedEvent extends ComponentAddedEvent{static{__name(this,"ComponentDuplicatedEvent")}constructor(component,index){super(component,index)}}class ComponentFragmentCreatedEvent extends ComponentAddedEvent{static{__name(this,"ComponentFragmentCreatedEvent")}constructor(component,fragmentContent,index){super(component,index),this.fragmentContent=fragmentContent}getFragmentContent(){return this.fragmentContent}}class ComponentMovedEvent extends ComponentAddedEvent{static{__name(this,"ComponentMovedEvent")}constructor(component,from,to,index){super(component,index),this.from=from,this.to=to}getFrom(){return this.from}getTo(){return this.to}}class ComponentRemovedOnMoveEvent extends ComponentRemovedEvent{static{__name(this,"ComponentRemovedOnMoveEvent")}constructor(path){super(path)}}const BODY_MASK_KEY="BodyMask";class BodyMask extends Mask{static{__name(this,"BodyMask")}constructor(){super(),this.addClass("body-mask")}static get(){let instance=Store.parentInstance().get(BODY_MASK_KEY);return instance==null&&(instance=new BodyMask,Store.parentInstance().set(BODY_MASK_KEY,instance)),instance}}class ConfirmationDialog extends ModalDialog{static{__name(this,"ConfirmationDialog")}constructor(config={}){super({title:config.title||i18n("dialog.confirm.title"),closeIconCallback:config.closeIconCallback||(()=>this.close()),class:"confirmation-dialog"})}doRender(){return super.doRender().then(rendered=>(this.appendChildToContentPanel(this.questionEl),rendered))}setQuestion(question,escapeHtml){return this.questionEl.getEl().setInnerHtml(question,escapeHtml),this}setYesCallback(callback){return this.yesCallback=callback,this}setNoCallback(callback){return this.noCallback=callback,this}open(){BodyMask.get().addClass("confirmation-dialog-mask"),Body.get().appendChild(this),super.open(),this.dialogContainer.addClass("confirmation-dialog-container")}close(){super.close(),BodyMask.get().removeClass("confirmation-dialog-mask"),this.remove()}initElements(){super.initElements(),this.questionEl=new H6El("question");const noActionText=i18n("action.no");this.noAction=new Action(noActionText,noActionText.slice(0,1).toLowerCase()),this.noAction.setMnemonic(noActionText.slice(0,1).toLowerCase());const yesActionText=i18n("action.yes");this.yesAction=new Action(yesActionText,yesActionText.slice(0,1).toLowerCase()),this.yesAction.setMnemonic(yesActionText.slice(0,1).toLowerCase()),this.addAction(this.yesAction,!0).addClass("yes-button"),this.addAction(this.noAction).addClass("no-button")}initListeners(){super.initListeners(),this.noAction.onExecuted(()=>{this.close(),this.noCallback&&this.noCallback()}),this.yesAction.onExecuted(()=>{this.close(),this.yesCallback&&this.yesCallback()})}handleClickOutside(){this.close(),this.noCallback&&this.noCallback()}}class PageStateEvent extends IframeEvent{static{__name(this,"PageStateEvent")}constructor(pageJson){super(),this.pageJson=pageJson}getPageJson(){return this.pageJson}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class PageState{static{__name(this,"PageState")}static{this.INSTANCE=null}constructor(){this.pageEventsHolder=new PageEventsHolder,this.pageStateEventHandler=new PageStateEventHandler(this.pageEventsHolder),this.initListeners()}initListeners(){this.componentAddedNotifier=event=>this.pageEventsHolder.notifyComponentAdded(event),this.componentRemovedNotifier=event=>this.pageEventsHolder.notifyComponentRemoved(event),this.componentUpdatedNotifier=event=>this.pageEventsHolder.notifyComponentUpdated(event),this.pageConfigUpdatedNotifier=()=>this.pageEventsHolder.notifyPageConfigUpdated()}static get(){return PageState.INSTANCE||(PageState.INSTANCE=new PageState),PageState.INSTANCE}static setState(page){this.get().setPage(page)}static getState(){return this.get().state}setPage(page){this.unListenPageComponentsEvents(),this.unListenPageEvents(),this.state=page,this.listenPageComponentsEvents(),this.listenPageEvents()}static getEvents(){return new PageEventsWrapper(this.get().pageEventsHolder)}static getComponentByPath(path){return this.get().state?.getComponentByPath(path)}listenPageComponentsEvents(){this.state?.onComponentAdded(this.componentAddedNotifier),this.state?.onComponentRemoved(this.componentRemovedNotifier),this.state?.onComponentUpdated(this.componentUpdatedNotifier)}unListenPageComponentsEvents(){this.state?.unComponentAdded(this.componentAddedNotifier),this.state?.unComponentRemoved(this.componentRemovedNotifier),this.state?.unComponentUpdated(this.componentUpdatedNotifier)}listenPageEvents(){this.state?.getConfig()?.onChanged(this.pageConfigUpdatedNotifier)}unListenPageEvents(){this.state?.getConfig()?.unChanged(this.pageConfigUpdatedNotifier)}}class PageStateEventHandler{static{__name(this,"PageStateEventHandler")}constructor(pageEventsHolder){this.initListeners(),this.pageEventsHolder=pageEventsHolder}initListeners(){PageEventsManager.get().onComponentAddRequested((path,type)=>{PageState.getState()&&this.addComponent(path,type)}),PageEventsManager.get().onComponentRemoveRequested(path=>{PageState.getState()&&this.removeComponent(path)}),PageEventsManager.get().onComponentDuplicateRequested(path=>{if(!PageState.getState())return;const item=PageState.getState().getComponentByPath(path);if(item instanceof Component){const parentRegion=item.getParent(),index=item.getIndex(),newItem=item.clone(),event=new ComponentDuplicatedEvent(newItem,index+1);parentRegion.addComponentViaEvent(event)}}),PageEventsManager.get().onSetFragmentComponentRequested((path,id)=>{PageState.getState()&&this.setFragmentComponent(path,id)}),PageEventsManager.get().onComponentResetRequested(path=>{PageState.getState()&&this.resetComponent(path)}),PageEventsManager.get().onPageTemplateSetRequested(pageTemplate=>{const oldValue=PageState.getState()?.getTemplate(),newPage=new Page(new PageBuilder().setTemplate(pageTemplate));PageState.setState(newPage),new PageStateEvent(newPage.toJson()).fire(),this.pageEventsHolder.notifyPageUpdated(new PageTemplateUpdatedEvent(pageTemplate,oldValue))}),PageEventsManager.get().onPageControllerSetRequested(controller=>{const oldValue=PageState.getState()?.getController(),newPage=new Page(new PageBuilder().setController(controller).setConfig(new PropertyTree));PageHelper.injectEmptyRegionsIntoPage(newPage).then(fullPage=>{PageState.setState(fullPage),new PageStateEvent(fullPage.toJson()).fire(),this.pageEventsHolder.notifyPageUpdated(new PageControllerUpdatedEvent(controller,oldValue))}).catch(DefaultErrorHandler.handle)}),PageEventsManager.get().onSetCustomizedPageRequested(pageTemplate=>{const oldValue=PageState.getState()?.getController(),newValue=pageTemplate.getController();PageHelper.injectEmptyRegionsIntoPage(pageTemplate.getPage()).then(fullPage=>{PageState.setState(fullPage),new PageStateEvent(fullPage.toJson()).fire(),this.pageEventsHolder.notifyPageUpdated(new PageControllerCustomizedEvent(newValue,oldValue))})}),PageEventsManager.get().onPageResetRequested(()=>{new ConfirmationDialog().setQuestion(i18n("dialog.page.reset.confirmation")).setYesCallback(()=>{PageState.setState(null),new PageStateEvent(null).fire(),this.pageEventsHolder.notifyPageReset()}).open()}),PageEventsManager.get().onComponentDescriptorSetRequested((path,descriptorKey)=>{if(!PageState.getState())return;const item=PageState.getState().getComponentByPath(path);item instanceof DescriptorBasedComponent&&(descriptorKey?new GetComponentDescriptorRequest(descriptorKey.toString(),item.getType()).sendAndParse().then(descriptor=>item.setDescriptor(descriptor)).catch(DefaultErrorHandler.handle):item.setDescriptor(null).catch(DefaultErrorHandler.handle))}),PageEventsManager.get().onTextComponentUpdateRequested((path,text2,origin)=>{if(!PageState.getState())return;const item=PageState.getState().getComponentByPath(path);item instanceof TextComponent&&!PageHelper.stringEqualsIgnoreEmpty(item.getText(),text2)&&item.setText(text2,!1,origin)}),PageEventsManager.get().onComponentMoveRequested((oldPath,newPath)=>{const oldParentItem=PageState.getState().getComponentByPath(oldPath.getParentPath()),newParentItem=PageState.getState().getComponentByPath(newPath.getParentPath());if(oldParentItem instanceof Region&&newParentItem instanceof Region){const item=oldParentItem.removeComponentViaEvent(new ComponentRemovedOnMoveEvent(oldPath));newParentItem.addComponentViaEvent(new ComponentMovedEvent(item,oldPath,newPath,newPath.getPath()))}}),PageEventsManager.get().onComponentCreateFragmentRequested(path=>{if(!PageState.getState())return;const item=PageState.getState().getComponentByPath(path),parentItem=PageState.getState().getComponentByPath(path.getParentPath());item instanceof Component&&parentItem instanceof Region&&PageHelper.createFragmentFromComponent(item).then(fragmentContent=>{this.removeComponent(path);const fragmentComponent=new FragmentComponentBuilder().setParent(parentItem).setFragment(fragmentContent.getContentId()).setName(new ComponentName(fragmentContent.getDisplayName())).build(),event=new ComponentFragmentCreatedEvent(fragmentComponent,fragmentContent,path.getPath());parentItem.addComponentViaEvent(event)}).catch(DefaultErrorHandler.handle)}),PageEventsManager.get().onComponentDetachFragmentRequested(path=>{if(!PageState.getState())return;const item=PageState.getState().getComponentByPath(path),parentItem=PageState.getState().getComponentByPath(path.getParentPath());parentItem instanceof Region&&item instanceof FragmentComponent&&item.getFragment()&&new GetContentByIdRequest(item.getFragment()).sendAndParse().then(content=>{this.removeComponent(path);const detachedComponent=content.getPage()?.getFragment();if(detachedComponent)return(detachedComponent instanceof LayoutComponent?PageHelper.fetchAndInjectLayoutRegions(detachedComponent):Q.resolve()).then(()=>{const event=new ComponentDetachedEvent(detachedComponent,content.getDisplayName(),path.getPath());parentItem.addComponentViaEvent(event)})}).catch(DefaultErrorHandler.handle)})}addComponent(path,type){const parent2=PageState.getState().getComponentByPath(path.getParentPath());return parent2 instanceof Region?parent2.addComponent(ComponentFactory.createByType(parent2,type),path.getPath()):null}removeComponent(path){const item=PageState.getState().getComponentByPath(path);item instanceof Component&&item.remove()}resetComponent(path){const item=PageState.getState().getComponentByPath(path);item instanceof Component?item.reset():item instanceof Region&&item.empty()}setFragmentComponent(path,id){const item=PageState.getState().getComponentByPath(path),contentId=id?new ContentId(id):null;item instanceof FragmentComponent&&item.setFragment(contentId,null)}}class LiveEditParams{static{__name(this,"LiveEditParams")}constructor(builder){this.isFragment=builder.isFragment,this.isFragmentAllowed=builder.isFragmentAllowed,this.isPageTemplate=builder.isPageTemplate,this.displayName=builder.displayName,this.locked=builder.locked,this.isResetEnabled=builder.isResetEnabled,this.pageName=builder.pageName,this.pageIconClass=builder.pageIconClass,this.isPageEmpty=builder.isPageEmpty,this.applicationKeys=builder.applicationKeys,this.contentId=builder.contentId,this.language=builder.language,this.contentType=builder.contentType,this.sitePath=builder.sitePath,this.modifyPermissions=builder.modifyPermissions}static create(){return new LiveEditParamsBuilder}static fromLiveEditModel(liveEditModel,applicationKeys,modifyPermissions){const isPageTemplate=liveEditModel.getContent().isPageTemplate(),isFragment=liveEditModel.getContent().getType().isFragment();return LiveEditParams.create().setIsPageTemplate(isPageTemplate).setIsFragment(isFragment).setDisplayName(liveEditModel.getContent().getDisplayName()).setLocked(!isPageTemplate&&!PageState.getState()?.hasController()&&!isFragment).setIsFragmentAllowed(liveEditModel.isFragmentAllowed()).setIsResetEnabled(PageState.getState()?.hasController()).setPageName(liveEditModel.getContent().getDisplayName()).setPageIconClass(PageHelper.getPageIconClass(PageState.getState())).setIsPageEmpty(isPageTemplate&&!PageState.getState()?.hasController()).setApplicationKeys(applicationKeys).setContentId(liveEditModel.getContent().getId()).setLanguage(liveEditModel.getContent()?.getLanguage()).setContentType(liveEditModel.getContent().getType()?.toString()).setSitePath(liveEditModel.getSiteModel()?.getSite().getPath().toString()).setModifyPermissions(modifyPermissions).build()}static fromObject(obj){return LiveEditParams.create().setIsFragment(obj.isFragment).setIsFragmentAllowed(obj.isFragmentAllowed).setIsPageTemplate(obj.isPageTemplate).setDisplayName(obj.displayName).setLocked(obj.locked).setIsResetEnabled(obj.isResetEnabled).setPageName(obj.pageName).setPageIconClass(obj.pageIconClass).setIsPageEmpty(obj.isPageEmpty).setApplicationKeys(obj.applicationKeys).setContentId(obj.contentId).setLanguage(obj.language).setContentType(obj.contentType).setSitePath(obj.sitePath).setModifyPermissions(obj.modifyPermissions).build()}getFragmentIdByPath(path){const component=this.getComponentByPath(path);if(component instanceof FragmentComponent)return component.getFragment()?.toString()}getTextComponentData(path){const component=this.getComponentByPath(path);if(component instanceof TextComponent)return component.getText()}getComponentByPath(path){const componentPath=ComponentPath.fromString(path);return PageState.getComponentByPath(componentPath)}}class LiveEditParamsBuilder{static{__name(this,"LiveEditParamsBuilder")}setIsFragment(value){return this.isFragment=value,this}setIsFragmentAllowed(value){return this.isFragmentAllowed=value,this}setIsPageTemplate(value){return this.isPageTemplate=value,this}setDisplayName(value){return this.displayName=value,this}setLocked(value){return this.locked=value,this}setIsResetEnabled(value){return this.isResetEnabled=value,this}setPageName(value){return this.pageName=value,this}setPageIconClass(value){return this.pageIconClass=value,this}setIsPageEmpty(value){return this.isPageEmpty=value,this}setApplicationKeys(value){return this.applicationKeys=value,this}setContentId(value){return this.contentId=value,this}setLanguage(value){return this.language=value,this}setContentType(value){return this.contentType=value,this}setSitePath(value){return this.sitePath=value,this}setModifyPermissions(value){return this.modifyPermissions=value,this}build(){return new LiveEditParams(this)}}class CreateItemViewConfig{static{__name(this,"CreateItemViewConfig")}itemViewIdProducer;itemViewFactory;liveEditParams;parentView;parentElement;element;positionIndex=-1;setItemViewIdProducer(value){return this.itemViewIdProducer=value,this}setItemViewFactory(value){return this.itemViewFactory=value,this}setParentView(value){return this.parentView=value,this}setParentElement(value){return this.parentElement=value,this}setElement(value){return this.element=value,this}setPositionIndex(value){return this.positionIndex=value,this}setLiveEditParams(value){return this.liveEditParams=value,this}}class ItemTypeConfig{static{__name(this,"ItemTypeConfig")}constructor(json){this.contextMenuConfig=[],this.typeName=json.typeName,this.draggable=json.draggable,this.cssSelector=json.cssSelector,this.iconCls=json.iconCls,this.cursor=json.cursor,this.highlighterStyle=json.highlighterStyle,this.contextMenuConfig=json.contextMenuConfig}getName(){return this.typeName}isDraggable(){return this.draggable}getCssSelector(){return this.cssSelector}getIconCls(){return this.iconCls}getCursor(){return this.cursor}getHighlighterStyle(){return this.highlighterStyle}getContextMenuConfig(){return this.contextMenuConfig}}class ComponentItemType extends ItemType{static{__name(this,"ComponentItemType")}getItemTypeConfig(itemType){return new ItemTypeConfig({cssSelector:"[data-portal-component-type="+itemType+"]",draggable:!0,cursor:"move",iconCls:"icon-"+itemType,highlighterStyle:{stroke:"rgba(68, 68, 68, 1)",strokeDasharray:"",fill:"rgba(255, 255, 255, 0)"},contextMenuConfig:["parent","remove","clear","duplicate"]})}}class FragmentItemType extends ComponentItemType{static{__name(this,"FragmentItemType")}static INSTANCE=new FragmentItemType;static get(){return FragmentItemType.INSTANCE}constructor(){super("fragment")}isComponentType(){return!0}}class TextItemType extends ComponentItemType{static{__name(this,"TextItemType")}static INSTANCE=new TextItemType;static get(){return TextItemType.INSTANCE}constructor(){super("text")}isComponentType(){return!0}getItemTypeConfig(itemType){const config=super.getItemTypeConfig(itemType);return config.getContextMenuConfig().push("edit"),config}}class LayoutItemType extends ComponentItemType{static{__name(this,"LayoutItemType")}static INSTANCE=new LayoutItemType;static get(){return LayoutItemType.INSTANCE}constructor(){super("layout")}isComponentType(){return!0}}class PartItemType extends ComponentItemType{static{__name(this,"PartItemType")}static INSTANCE=new PartItemType;static get(){return PartItemType.INSTANCE}constructor(){super("part")}isComponentType(){return!0}}class TextEditModeChangedEvent extends IframeEvent{static{__name(this,"TextEditModeChangedEvent")}constructor(value){super(),this.value=value}isEditMode(){return this.value}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class PageViewController{static{__name(this,"PageViewController")}constructor(){this.textEditMode=!1,this.textEditModeListeners=[]}static get(){return this.INSTANCE||(this.INSTANCE=new PageViewController),this.INSTANCE}setTextEditMode(value){const isToBeChanged=!!this.textEditMode!=!!value;this.textEditMode=value,isToBeChanged&&(this.notifyTextEditModeChanged(value),new TextEditModeChangedEvent(value).fire())}notifyTextEditModeChanged(value){this.textEditModeListeners.forEach(listener=>listener(value))}onTextEditModeChanged(listener){this.textEditModeListeners.push(listener)}unTextEditModeChanged(listener){this.textEditModeListeners=this.textEditModeListeners.filter(curr=>curr!==listener)}isTextEditMode(){return this.textEditMode}setLocked(value){this.pageLocked=value,this.setHighlightingDisabled(value)}isLocked(){return this.pageLocked}setContextMenuDisabled(value){this.contextMenuDisabled=value}isContextMenuDisabled(){return this.contextMenuDisabled}setHighlightingDisabled(value){this.highlightingDisabled=value}isHighlightingDisabled(){return this.highlightingDisabled}setNextClickDisabled(value){this.nextClickDisabled=value}isNextClickDisabled(){return this.nextClickDisabled}}class RegionItemType extends ItemType{static{__name(this,"RegionItemType")}static{this.INSTANCE=new RegionItemType}static get(){return RegionItemType.INSTANCE}constructor(){super("region")}static getRegionName(element){return element.getEl().getAttribute("data-"+ItemType.ATTRIBUTE_REGION_NAME)}getItemTypeConfig(_itemType){return new ItemTypeConfig({cssSelector:"[data-portal-region]",draggable:!1,cursor:"pointer",iconCls:"icon-region",highlighterStyle:{stroke:"rgba(20, 20, 20, 1)",strokeDasharray:"4 4",fill:"rgba(255, 255, 255, 0)"},contextMenuConfig:["parent","clearRegion"]})}}RegionItemType.get();class PageItemType extends ItemType{static{__name(this,"PageItemType")}static{this.INSTANCE=new PageItemType}static get(){return PageItemType.INSTANCE}constructor(){super("page")}getItemTypeConfig(_itemType){return new ItemTypeConfig({cssSelector:"[data-portal-component-type=page]",draggable:!1,cursor:"pointer",iconCls:"icon-page",highlighterStyle:{stroke:"rgba(20, 20, 20, 1)",strokeDasharray:"7 7",fill:"rgba(255, 255, 255, 0)"},contextMenuConfig:["reset"]})}}PageItemType.get();class AddComponentEvent extends IframeEvent{static{__name(this,"AddComponentEvent")}constructor(path,type){super(),this.path=path,this.type=type}getComponentPath(){return this.path}getComponentType(){return this.type}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}var sortable={},hasRequiredSortable;function requireSortable(){return hasRequiredSortable||(hasRequiredSortable=1,(function(factory){factory($)})(function($2){return $2.widget("ui.sortable",$2.ui.mouse,{version:"1.14.1",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:__name(function(x,reference,size){return x>=reference&&x<reference+size},"_isOverAxis"),_isFloating:__name(function(item){return/left|right/.test(item.css("float"))||/inline|table-cell/.test(item.css("display"))},"_isFloating"),_create:__name(function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},"_create"),_setOption:__name(function(key,value){this._super(key,value),key==="handle"&&this._setHandleClassName()},"_setOption"),_setHandleClassName:__name(function(){var that=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),$2.each(this.items,function(){that._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},"_setHandleClassName"),_destroy:__name(function(){this._mouseDestroy();for(var i=this.items.length-1;i>=0;i--)this.items[i].item.removeData(this.widgetName+"-item");return this},"_destroy"),_mouseCapture:__name(function(event,overrideHandle){var currentItem=null,validHandle=!1,that=this;return this.reverting||this.options.disabled||this.options.type==="static"||(this._refreshItems(event),$2(event.target).parents().each(function(){if($2.data(this,that.widgetName+"-item")===that)return currentItem=$2(this),!1}),$2.data(event.target,that.widgetName+"-item")===that&&(currentItem=$2(event.target)),!currentItem)||this.options.handle&&!overrideHandle&&($2(this.options.handle,currentItem).find("*").addBack().each(function(){this===event.target&&(validHandle=!0)}),!validHandle)?!1:(this.currentItem=currentItem,this._removeCurrentsFromItems(),!0)},"_mouseCapture"),_mouseStart:__name(function(event,overrideHandle,noActivation){var i,body,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.appendTo=$2(o.appendTo!=="parent"?o.appendTo:this.currentItem.parent()),this.helper=this._createHelper(event),this._cacheHelperProportions(),this._cacheMargins(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},$2.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),this.scrollParent=this.placeholder.scrollParent(),$2.extend(this.offset,{parent:this._getParentOffset()}),o.containment&&this._setContainment(),o.cursor&&o.cursor!=="auto"&&(body=this.document.find("body"),this._storedStylesheet=$2("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(body)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),this.scrollParent[0]!==this.document[0]&&this.scrollParent[0].tagName!=="HTML"&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",event,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!noActivation)for(i=this.containers.length-1;i>=0;i--)this.containers[i]._trigger("activate",event,this._uiHash(this));return $2.ui.ddmanager&&($2.ui.ddmanager.current=this),$2.ui.ddmanager&&!o.dropBehaviour&&$2.ui.ddmanager.prepareOffsets(this,event),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this.helper.parent().is(this.appendTo)||(this.helper.detach().appendTo(this.appendTo),this.offset.parent=this._getParentOffset()),this.position=this.originalPosition=this._generatePosition(event),this.originalPageX=event.pageX,this.originalPageY=event.pageY,this.lastPositionAbs=this.positionAbs=this._convertPositionTo("absolute"),this._mouseDrag(event),!0},"_mouseStart"),_scroll:__name(function(event){var o=this.options,scrolled=!1;return this.scrollParent[0]!==this.document[0]&&this.scrollParent[0].tagName!=="HTML"?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-event.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop+o.scrollSpeed:event.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-event.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft+o.scrollSpeed:event.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(event.pageY-this.document.scrollTop()<o.scrollSensitivity?scrolled=this.document.scrollTop(this.document.scrollTop()-o.scrollSpeed):this.window.height()-(event.pageY-this.document.scrollTop())<o.scrollSensitivity&&(scrolled=this.document.scrollTop(this.document.scrollTop()+o.scrollSpeed)),event.pageX-this.document.scrollLeft()<o.scrollSensitivity?scrolled=this.document.scrollLeft(this.document.scrollLeft()-o.scrollSpeed):this.window.width()-(event.pageX-this.document.scrollLeft())<o.scrollSensitivity&&(scrolled=this.document.scrollLeft(this.document.scrollLeft()+o.scrollSpeed))),scrolled},"_scroll"),_mouseDrag:__name(function(event){var i,item,itemElement,intersection,o=this.options;for(this.position=this._generatePosition(event),this.positionAbs=this._convertPositionTo("absolute"),(!this.options.axis||this.options.axis!=="y")&&(this.helper[0].style.left=this.position.left+"px"),(!this.options.axis||this.options.axis!=="x")&&(this.helper[0].style.top=this.position.top+"px"),o.scroll&&this._scroll(event)!==!1&&(this._refreshItemPositions(!0),$2.ui.ddmanager&&!o.dropBehaviour&&$2.ui.ddmanager.prepareOffsets(this,event)),this.dragDirection={vertical:this._getDragVerticalDirection(),horizontal:this._getDragHorizontalDirection()},i=this.items.length-1;i>=0;i--)if(item=this.items[i],itemElement=item.item[0],intersection=this._intersectsWithPointer(item),!!intersection&&item.instance===this.currentContainer&&itemElement!==this.currentItem[0]&&this.placeholder[intersection===1?"next":"prev"]()[0]!==itemElement&&!$2.contains(this.placeholder[0],itemElement)&&(this.options.type!=="semi-dynamic"||!$2.contains(this.element[0],itemElement))){if(this.direction=intersection===1?"down":"up",this.options.tolerance==="pointer"||this._intersectsWithSides(item))this._rearrange(event,item);else break;this._trigger("change",event,this._uiHash());break}return this._contactContainers(event),$2.ui.ddmanager&&$2.ui.ddmanager.drag(this,event),this._trigger("sort",event,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},"_mouseDrag"),_mouseStop:__name(function(event,noPropagation){if(event){if($2.ui.ddmanager&&!this.options.dropBehaviour&&$2.ui.ddmanager.drop(this,event),this.options.revert){var that=this,cur=this.placeholder.offset(),axis=this.options.axis,animation={};(!axis||axis==="x")&&(animation.left=cur.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),(!axis||axis==="y")&&(animation.top=cur.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,$2(this.helper).animate(animation,parseInt(this.options.revert,10)||500,function(){that._clear(event)})}else this._clear(event,noPropagation);return!1}},"_mouseStop"),cancel:__name(function(){if(this.dragging){this._mouseUp(new $2.Event("mouseup",{target:null})),this.options.helper==="original"?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var i=this.containers.length-1;i>=0;i--)this.containers[i]._trigger("deactivate",null,this._uiHash(this)),this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",null,this._uiHash(this)),this.containers[i].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.options.helper!=="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),$2.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?$2(this.domPosition.prev).after(this.currentItem):$2(this.domPosition.parent).prepend(this.currentItem)),this},"cancel"),serialize:__name(function(o){var items=this._getItemsAsjQuery(o&&o.connected),str=[];return o=o||{},$2(items).each(function(){var res=($2(o.item||this).attr(o.attribute||"id")||"").match(o.expression||/(.+)[\-=_](.+)/);res&&str.push((o.key||res[1]+"[]")+"="+(o.key&&o.expression?res[1]:res[2]))}),!str.length&&o.key&&str.push(o.key+"="),str.join("&")},"serialize"),toArray:__name(function(o){var items=this._getItemsAsjQuery(o&&o.connected),ret=[];return o=o||{},items.each(function(){ret.push($2(o.item||this).attr(o.attribute||"id")||"")}),ret},"toArray"),_intersectsWith:__name(function(item){var x1=this.positionAbs.left,x2=x1+this.helperProportions.width,y1=this.positionAbs.top,y2=y1+this.helperProportions.height,l=item.left,r=l+item.width,t=item.top,b=t+item.height,dyClick=this.offset.click.top,dxClick=this.offset.click.left,isOverElementHeight=this.options.axis==="x"||y1+dyClick>t&&y1+dyClick<b,isOverElementWidth=this.options.axis==="y"||x1+dxClick>l&&x1+dxClick<r,isOverElement=isOverElementHeight&&isOverElementWidth;return this.options.tolerance==="pointer"||this.options.forcePointerForContainers||this.options.tolerance!=="pointer"&&this.helperProportions[this.floating?"width":"height"]>item[this.floating?"width":"height"]?isOverElement:l<x1+this.helperProportions.width/2&&x2-this.helperProportions.width/2<r&&t<y1+this.helperProportions.height/2&&y2-this.helperProportions.height/2<b},"_intersectsWith"),_intersectsWithPointer:__name(function(item){var verticalDirection,horizontalDirection,isOverElementHeight=this.options.axis==="x"||this._isOverAxis(this.positionAbs.top+this.offset.click.top,item.top,item.height),isOverElementWidth=this.options.axis==="y"||this._isOverAxis(this.positionAbs.left+this.offset.click.left,item.left,item.width),isOverElement=isOverElementHeight&&isOverElementWidth;return isOverElement?(verticalDirection=this.dragDirection.vertical,horizontalDirection=this.dragDirection.horizontal,this.floating?horizontalDirection==="right"||verticalDirection==="down"?2:1:verticalDirection&&(verticalDirection==="down"?2:1)):!1},"_intersectsWithPointer"),_intersectsWithSides:__name(function(item){var isOverBottomHalf=this._isOverAxis(this.positionAbs.top+this.offset.click.top,item.top+item.height/2,item.height),isOverRightHalf=this._isOverAxis(this.positionAbs.left+this.offset.click.left,item.left+item.width/2,item.width),verticalDirection=this.dragDirection.vertical,horizontalDirection=this.dragDirection.horizontal;return this.floating&&horizontalDirection?horizontalDirection==="right"&&isOverRightHalf||horizontalDirection==="left"&&!isOverRightHalf:verticalDirection&&(verticalDirection==="down"&&isOverBottomHalf||verticalDirection==="up"&&!isOverBottomHalf)},"_intersectsWithSides"),_getDragVerticalDirection:__name(function(){var delta=this.positionAbs.top-this.lastPositionAbs.top;return delta!==0&&(delta>0?"down":"up")},"_getDragVerticalDirection"),_getDragHorizontalDirection:__name(function(){var delta=this.positionAbs.left-this.lastPositionAbs.left;return delta!==0&&(delta>0?"right":"left")},"_getDragHorizontalDirection"),refresh:__name(function(event){return this._refreshItems(event),this._setHandleClassName(),this.refreshPositions(),this},"refresh"),_connectWith:__name(function(){var options=this.options;return options.connectWith.constructor===String?[options.connectWith]:options.connectWith},"_connectWith"),_getItemsAsjQuery:__name(function(connected){var i,j,cur,inst,items=[],queries=[],connectWith=this._connectWith();if(connectWith&&connected)for(i=connectWith.length-1;i>=0;i--)for(cur=$2(connectWith[i],this.document[0]),j=cur.length-1;j>=0;j--)inst=$2.data(cur[j],this.widgetFullName),inst&&inst!==this&&!inst.options.disabled&&queries.push([typeof inst.options.items=="function"?inst.options.items.call(inst.element):$2(inst.options.items,inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),inst]);queries.push([typeof this.options.items=="function"?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):$2(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);function addItems(){items.push(this)}for(__name(addItems,"addItems"),i=queries.length-1;i>=0;i--)queries[i][0].each(addItems);return $2(items)},"_getItemsAsjQuery"),_removeCurrentsFromItems:__name(function(){var list=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=$2.grep(this.items,function(item){for(var j=0;j<list.length;j++)if(list[j]===item.item[0])return!1;return!0})},"_removeCurrentsFromItems"),_refreshItems:__name(function(event){this.items=[],this.containers=[this];var i,j,cur,inst,targetData,_queries,item,queriesLength,items=this.items,queries=[[typeof this.options.items=="function"?this.options.items.call(this.element[0],event,{item:this.currentItem}):$2(this.options.items,this.element),this]],connectWith=this._connectWith();if(connectWith&&this.ready)for(i=connectWith.length-1;i>=0;i--)for(cur=$2(connectWith[i],this.document[0]),j=cur.length-1;j>=0;j--)inst=$2.data(cur[j],this.widgetFullName),inst&&inst!==this&&!inst.options.disabled&&(queries.push([typeof inst.options.items=="function"?inst.options.items.call(inst.element[0],event,{item:this.currentItem}):$2(inst.options.items,inst.element),inst]),this.containers.push(inst));for(i=queries.length-1;i>=0;i--)for(targetData=queries[i][1],_queries=queries[i][0],j=0,queriesLength=_queries.length;j<queriesLength;j++)item=$2(_queries[j]),item.data(this.widgetName+"-item",targetData),items.push({item,instance:targetData,width:0,height:0,left:0,top:0})},"_refreshItems"),_refreshItemPositions:__name(function(fast){var i,item,t,p;for(i=this.items.length-1;i>=0;i--)item=this.items[i],!(this.currentContainer&&item.instance!==this.currentContainer&&item.item[0]!==this.currentItem[0])&&(t=this.options.toleranceElement?$2(this.options.toleranceElement,item.item):item.item,fast||(item.width=t.outerWidth(),item.height=t.outerHeight()),p=t.offset(),item.left=p.left,item.top=p.top)},"_refreshItemPositions"),refreshPositions:__name(function(fast){this.floating=this.items.length?this.options.axis==="x"||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset()),this._refreshItemPositions(fast);var i,p;if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)p=this.containers[i].element.offset(),this.containers[i].containerCache.left=p.left,this.containers[i].containerCache.top=p.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},"refreshPositions"),_createPlaceholder:__name(function(that){that=that||this;var className,nodeName,o=that.options;(!o.placeholder||o.placeholder.constructor===String)&&(className=o.placeholder,nodeName=that.currentItem[0].nodeName.toLowerCase(),o.placeholder={element:__name(function(){var element=$2("<"+nodeName+">",that.document[0]);return that._addClass(element,"ui-sortable-placeholder",className||that.currentItem[0].className)._removeClass(element,"ui-sortable-helper"),nodeName==="tbody"?that._createTrPlaceholder(that.currentItem.find("tr").eq(0),$2("<tr>",that.document[0]).appendTo(element)):nodeName==="tr"?that._createTrPlaceholder(that.currentItem,element):nodeName==="img"&&element.attr("src",that.currentItem.attr("src")),className||element.css("visibility","hidden"),element},"element"),update:__name(function(container,p){className&&!o.forcePlaceholderSize||((!p.height()||o.forcePlaceholderSize&&(nodeName==="tbody"||nodeName==="tr"))&&p.height(that.currentItem.innerHeight()-parseInt(that.currentItem.css("paddingTop")||0,10)-parseInt(that.currentItem.css("paddingBottom")||0,10)),p.width()||p.width(that.currentItem.innerWidth()-parseInt(that.currentItem.css("paddingLeft")||0,10)-parseInt(that.currentItem.css("paddingRight")||0,10)))},"update")}),that.placeholder=$2(o.placeholder.element.call(that.element,that.currentItem)),that.currentItem.after(that.placeholder),o.placeholder.update(that,that.placeholder)},"_createPlaceholder"),_createTrPlaceholder:__name(function(sourceTr,targetTr){var that=this;sourceTr.children().each(function(){$2("<td>&#160;</td>",that.document[0]).attr("colspan",$2(this).attr("colspan")||1).appendTo(targetTr)})},"_createTrPlaceholder"),_contactContainers:__name(function(event){var i,j,dist,itemWithLeastDistance,posProperty,sizeProperty,cur,nearBottom,floating,axis,innermostContainer=null,innermostIndex=null;for(i=this.containers.length-1;i>=0;i--)if(!$2.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(innermostContainer&&$2.contains(this.containers[i].element[0],innermostContainer.element[0]))continue;innermostContainer=this.containers[i],innermostIndex=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",event,this._uiHash(this)),this.containers[i].containerCache.over=0);if(innermostContainer)if(this.containers.length===1)this.containers[innermostIndex].containerCache.over||(this.containers[innermostIndex]._trigger("over",event,this._uiHash(this)),this.containers[innermostIndex].containerCache.over=1);else{for(dist=1e4,itemWithLeastDistance=null,floating=innermostContainer.floating||this._isFloating(this.currentItem),posProperty=floating?"left":"top",sizeProperty=floating?"width":"height",axis=floating?"pageX":"pageY",j=this.items.length-1;j>=0;j--)$2.contains(this.containers[innermostIndex].element[0],this.items[j].item[0])&&this.items[j].item[0]!==this.currentItem[0]&&(cur=this.items[j].item.offset()[posProperty],nearBottom=!1,event[axis]-cur>this.items[j][sizeProperty]/2&&(nearBottom=!0),Math.abs(event[axis]-cur)<dist&&(dist=Math.abs(event[axis]-cur),itemWithLeastDistance=this.items[j],this.direction=nearBottom?"up":"down"));if(!itemWithLeastDistance&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[innermostIndex]){this.currentContainer.containerCache.over||(this.containers[innermostIndex]._trigger("over",event,this._uiHash()),this.currentContainer.containerCache.over=1);return}itemWithLeastDistance?this._rearrange(event,itemWithLeastDistance,null,!0):this._rearrange(event,null,this.containers[innermostIndex].element,!0),this._trigger("change",event,this._uiHash()),this.containers[innermostIndex]._trigger("change",event,this._uiHash(this)),this.currentContainer=this.containers[innermostIndex],this.options.placeholder.update(this.currentContainer,this.placeholder),this.scrollParent=this.placeholder.scrollParent(),this.scrollParent[0]!==this.document[0]&&this.scrollParent[0].tagName!=="HTML"&&(this.overflowOffset=this.scrollParent.offset()),this.containers[innermostIndex]._trigger("over",event,this._uiHash(this)),this.containers[innermostIndex].containerCache.over=1}},"_contactContainers"),_createHelper:__name(function(event){var o=this.options,helper=typeof o.helper=="function"?$2(o.helper.apply(this.element[0],[event,this.currentItem])):o.helper==="clone"?this.currentItem.clone():this.currentItem;return helper.parents("body").length||this.appendTo[0].appendChild(helper[0]),helper[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!helper[0].style.width||o.forceHelperSize)&&helper.width(this.currentItem.width()),(!helper[0].style.height||o.forceHelperSize)&&helper.height(this.currentItem.height()),helper},"_createHelper"),_adjustOffsetFromHelper:__name(function(obj){typeof obj=="string"&&(obj=obj.split(" ")),Array.isArray(obj)&&(obj={left:+obj[0],top:+obj[1]||0}),"left"in obj&&(this.offset.click.left=obj.left+this.margins.left),"right"in obj&&(this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left),"top"in obj&&(this.offset.click.top=obj.top+this.margins.top),"bottom"in obj&&(this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top)},"_adjustOffsetFromHelper"),_getParentOffset:__name(function(){this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();return this.cssPosition==="absolute"&&this.scrollParent[0]!==this.document[0]&&$2.contains(this.scrollParent[0],this.offsetParent[0])&&(po.left+=this.scrollParent.scrollLeft(),po.top+=this.scrollParent.scrollTop()),this.offsetParent[0]===this.document[0].body&&(po={top:0,left:0}),{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},"_getParentOffset"),_getRelativeOffset:__name(function(){if(this.cssPosition==="relative"){var p=this.currentItem.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},"_getRelativeOffset"),_cacheMargins:__name(function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},"_cacheMargins"),_cacheHelperProportions:__name(function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},"_cacheHelperProportions"),_setContainment:__name(function(){var ce,co,over,o=this.options;o.containment==="parent"&&(o.containment=this.helper[0].parentNode),(o.containment==="document"||o.containment==="window")&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,o.containment==="document"?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,(o.containment==="document"?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(o.containment)||(ce=$2(o.containment)[0],co=$2(o.containment).offset(),over=$2(ce).css("overflow")!=="hidden",this.containment=[co.left+(parseInt($2(ce).css("borderLeftWidth"),10)||0)+(parseInt($2(ce).css("paddingLeft"),10)||0)-this.margins.left,co.top+(parseInt($2(ce).css("borderTopWidth"),10)||0)+(parseInt($2(ce).css("paddingTop"),10)||0)-this.margins.top,co.left+(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt($2(ce).css("borderLeftWidth"),10)||0)-(parseInt($2(ce).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,co.top+(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt($2(ce).css("borderTopWidth"),10)||0)-(parseInt($2(ce).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},"_setContainment"),_convertPositionTo:__name(function(d,pos){pos||(pos=this.position);var mod=d==="absolute"?1:-1,scroll=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==this.document[0]&&$2.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=/(html|body)/i.test(scroll[0].tagName);return{top:pos.top+this.offset.relative.top*mod+this.offset.parent.top*mod-(this.cssPosition==="fixed"?-this.scrollParent.scrollTop():scrollIsRootNode?0:scroll.scrollTop())*mod,left:pos.left+this.offset.relative.left*mod+this.offset.parent.left*mod-(this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())*mod}},"_convertPositionTo"),_generatePosition:__name(function(event){var top,left,o=this.options,pageX=event.pageX,pageY=event.pageY,scroll=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==this.document[0]&&$2.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=/(html|body)/i.test(scroll[0].tagName);return this.cssPosition==="relative"&&!(this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0])&&(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(event.pageX-this.offset.click.left<this.containment[0]&&(pageX=this.containment[0]+this.offset.click.left),event.pageY-this.offset.click.top<this.containment[1]&&(pageY=this.containment[1]+this.offset.click.top),event.pageX-this.offset.click.left>this.containment[2]&&(pageX=this.containment[2]+this.offset.click.left),event.pageY-this.offset.click.top>this.containment[3]&&(pageY=this.containment[3]+this.offset.click.top)),o.grid&&(top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1],pageY=this.containment?top-this.offset.click.top>=this.containment[1]&&top-this.offset.click.top<=this.containment[3]?top:top-this.offset.click.top>=this.containment[1]?top-o.grid[1]:top+o.grid[1]:top,left=this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0],pageX=this.containment?left-this.offset.click.left>=this.containment[0]&&left-this.offset.click.left<=this.containment[2]?left:left-this.offset.click.left>=this.containment[0]?left-o.grid[0]:left+o.grid[0]:left)),{top:pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition==="fixed"?-this.scrollParent.scrollTop():scrollIsRootNode?0:scroll.scrollTop()),left:pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())}},"_generatePosition"),_rearrange:__name(function(event,i,a,hardRefresh){a?a[0].appendChild(this.placeholder[0]):i.item[0].parentNode.insertBefore(this.placeholder[0],this.direction==="down"?i.item[0]:i.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var counter=this.counter;this._delay(function(){counter===this.counter&&this.refreshPositions(!hardRefresh)})},"_rearrange"),_clear:__name(function(event,noPropagation){this.reverting=!1;var i,delayedTriggers=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)(this._storedCSS[i]==="auto"||this._storedCSS[i]==="static")&&(this._storedCSS[i]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!noPropagation&&delayedTriggers.push(function(event2){this._trigger("receive",event2,this._uiHash(this.fromOutside))}),(this.fromOutside||this.domPosition.prev!==this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!==this.currentItem.parent()[0])&&!noPropagation&&delayedTriggers.push(function(event2){this._trigger("update",event2,this._uiHash())}),this!==this.currentContainer&&(noPropagation||(delayedTriggers.push(function(event2){this._trigger("remove",event2,this._uiHash())}),delayedTriggers.push((function(c){return function(event2){c._trigger("receive",event2,this._uiHash(this))}}).call(this,this.currentContainer)),delayedTriggers.push((function(c){return function(event2){c._trigger("update",event2,this._uiHash(this))}}).call(this,this.currentContainer))));function delayEvent(type,instance,container){return function(event2){container._trigger(type,event2,instance._uiHash(instance))}}for(__name(delayEvent,"delayEvent"),i=this.containers.length-1;i>=0;i--)noPropagation||delayedTriggers.push(delayEvent("deactivate",this,this.containers[i])),this.containers[i].containerCache.over&&(delayedTriggers.push(delayEvent("out",this,this.containers[i])),this.containers[i].containerCache.over=0);if(this._storedStylesheet&&(this._storedStylesheet.remove(),this._storedStylesheet=null),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex",this._storedZIndex==="auto"?"":this._storedZIndex),this.dragging=!1,noPropagation||this._trigger("beforeStop",event,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!noPropagation){for(i=0;i<delayedTriggers.length;i++)delayedTriggers[i].call(this,event);this._trigger("stop",event,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},"_clear"),_trigger:__name(function(){$2.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},"_trigger"),_uiHash:__name(function(_inst){var inst=_inst||this;return{helper:inst.helper,placeholder:inst.placeholder||$2([]),position:inst.position,originalPosition:inst.originalPosition,offset:inst.positionAbs,item:inst.currentItem,sender:_inst?_inst.element:null}},"_uiHash")})})),sortable}__name(requireSortable,"requireSortable");requireSortable();var draggable={},hasRequiredDraggable;function requireDraggable(){return hasRequiredDraggable||(hasRequiredDraggable=1,(function(factory){factory($)})(function($2){return $2.widget("ui.draggable",$2.ui.mouse,{version:"1.14.1",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:__name(function(){this.options.helper==="original"&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},"_create"),_setOption:__name(function(key,value){this._super(key,value),key==="handle"&&(this._removeHandleClassName(),this._setHandleClassName())},"_setOption"),_destroy:__name(function(){if((this.helper||this.element).is(".ui-draggable-dragging")){this.destroyOnClear=!0;return}this._removeHandleClassName(),this._mouseDestroy()},"_destroy"),_mouseCapture:__name(function(event){var o=this.options;return this.helper||o.disabled||$2(event.target).closest(".ui-resizable-handle").length>0||(this.handle=this._getHandle(event),!this.handle)?!1:(this._blurActiveElement(event),this._blockFrames(o.iframeFix===!0?"iframe":o.iframeFix),!0)},"_mouseCapture"),_blockFrames:__name(function(selector){this.iframeBlocks=this.document.find(selector).map(function(){var iframe=$2(this);return $2("<div>").css("position","absolute").appendTo(iframe.parent()).outerWidth(iframe.outerWidth()).outerHeight(iframe.outerHeight()).offset(iframe.offset())[0]})},"_blockFrames"),_unblockFrames:__name(function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},"_unblockFrames"),_blurActiveElement:__name(function(event){var activeElement=this.document[0].activeElement,target=$2(event.target);target.closest(activeElement).length||$2(activeElement).trigger("blur")},"_blurActiveElement"),_mouseStart:__name(function(event){var o=this.options;return this.helper=this._createHelper(event),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),$2.ui.ddmanager&&($2.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return $2(this).css("position")==="fixed"}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(event),this.originalPosition=this.position=this._generatePosition(event,!1),this.originalPageX=event.pageX,this.originalPageY=event.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this._setContainment(),this._trigger("start",event)===!1?(this._clear(),!1):(this._cacheHelperProportions(),$2.ui.ddmanager&&!o.dropBehaviour&&$2.ui.ddmanager.prepareOffsets(this,event),this._mouseDrag(event,!0),$2.ui.ddmanager&&$2.ui.ddmanager.dragStart(this,event),!0)},"_mouseStart"),_refreshOffsets:__name(function(event){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:event.pageX-this.offset.left,top:event.pageY-this.offset.top}},"_refreshOffsets"),_mouseDrag:__name(function(event,noPropagation){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(event,!0),this.positionAbs=this._convertPositionTo("absolute"),!noPropagation){var ui=this._uiHash();if(this._trigger("drag",event,ui)===!1)return this._mouseUp(new $2.Event("mouseup",event)),!1;this.position=ui.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",$2.ui.ddmanager&&$2.ui.ddmanager.drag(this,event),!1},"_mouseDrag"),_mouseStop:__name(function(event){var that=this,dropped=!1;return $2.ui.ddmanager&&!this.options.dropBehaviour&&(dropped=$2.ui.ddmanager.drop(this,event)),this.dropped&&(dropped=this.dropped,this.dropped=!1),this.options.revert==="invalid"&&!dropped||this.options.revert==="valid"&&dropped||this.options.revert===!0||typeof this.options.revert=="function"&&this.options.revert.call(this.element,dropped)?$2(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){that._trigger("stop",event)!==!1&&that._clear()}):this._trigger("stop",event)!==!1&&this._clear(),!1},"_mouseStop"),_mouseUp:__name(function(event){return this._unblockFrames(),$2.ui.ddmanager&&$2.ui.ddmanager.dragStop(this,event),this.handleElement.is(event.target)&&this.element.trigger("focus"),$2.ui.mouse.prototype._mouseUp.call(this,event)},"_mouseUp"),cancel:__name(function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new $2.Event("mouseup",{target:this.element[0]})):this._clear(),this},"cancel"),_getHandle:__name(function(event){return this.options.handle?!!$2(event.target).closest(this.element.find(this.options.handle)).length:!0},"_getHandle"),_setHandleClassName:__name(function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},"_setHandleClassName"),_removeHandleClassName:__name(function(){this._removeClass(this.handleElement,"ui-draggable-handle")},"_removeHandleClassName"),_createHelper:__name(function(event){var o=this.options,helperIsFunction=typeof o.helper=="function",helper=helperIsFunction?$2(o.helper.apply(this.element[0],[event])):o.helper==="clone"?this.element.clone().removeAttr("id"):this.element;return helper.parents("body").length||helper.appendTo(o.appendTo==="parent"?this.element[0].parentNode:o.appendTo),helperIsFunction&&helper[0]===this.element[0]&&this._setPositionRelative(),helper[0]!==this.element[0]&&!/(fixed|absolute)/.test(helper.css("position"))&&helper.css("position","absolute"),helper},"_createHelper"),_setPositionRelative:__name(function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},"_setPositionRelative"),_adjustOffsetFromHelper:__name(function(obj){typeof obj=="string"&&(obj=obj.split(" ")),Array.isArray(obj)&&(obj={left:+obj[0],top:+obj[1]||0}),"left"in obj&&(this.offset.click.left=obj.left+this.margins.left),"right"in obj&&(this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left),"top"in obj&&(this.offset.click.top=obj.top+this.margins.top),"bottom"in obj&&(this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top)},"_adjustOffsetFromHelper"),_isRootNode:__name(function(element){return/(html|body)/i.test(element.tagName)||element===this.document[0]},"_isRootNode"),_getParentOffset:__name(function(){var po=this.offsetParent.offset(),document2=this.document[0];return this.cssPosition==="absolute"&&this.scrollParent[0]!==document2&&$2.contains(this.scrollParent[0],this.offsetParent[0])&&(po.left+=this.scrollParent.scrollLeft(),po.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(po={top:0,left:0}),{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},"_getParentOffset"),_getRelativeOffset:__name(function(){if(this.cssPosition!=="relative")return{top:0,left:0};var p=this.element.position(),scrollIsRootNode=this._isRootNode(this.scrollParent[0]);return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+(scrollIsRootNode?0:this.scrollParent.scrollTop()),left:p.left-(parseInt(this.helper.css("left"),10)||0)+(scrollIsRootNode?0:this.scrollParent.scrollLeft())}},"_getRelativeOffset"),_cacheMargins:__name(function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},"_cacheMargins"),_cacheHelperProportions:__name(function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},"_cacheHelperProportions"),_setContainment:__name(function(){var isUserScrollable,c,ce,o=this.options,document2=this.document[0];if(this.relativeContainer=null,!o.containment){this.containment=null;return}if(o.containment==="window"){this.containment=[$2(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,$2(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,$2(window).scrollLeft()+$2(window).width()-this.helperProportions.width-this.margins.left,$2(window).scrollTop()+($2(window).height()||document2.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];return}if(o.containment==="document"){this.containment=[0,0,$2(document2).width()-this.helperProportions.width-this.margins.left,($2(document2).height()||document2.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];return}if(o.containment.constructor===Array){this.containment=o.containment;return}o.containment==="parent"&&(o.containment=this.helper[0].parentNode),c=$2(o.containment),ce=c[0],ce&&(isUserScrollable=/(scroll|auto)/.test(c.css("overflow")),this.containment=[(parseInt(c.css("borderLeftWidth"),10)||0)+(parseInt(c.css("paddingLeft"),10)||0),(parseInt(c.css("borderTopWidth"),10)||0)+(parseInt(c.css("paddingTop"),10)||0),(isUserScrollable?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt(c.css("borderRightWidth"),10)||0)-(parseInt(c.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(isUserScrollable?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt(c.css("borderBottomWidth"),10)||0)-(parseInt(c.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=c)},"_setContainment"),_convertPositionTo:__name(function(d,pos){pos||(pos=this.position);var mod=d==="absolute"?1:-1,scrollIsRootNode=this._isRootNode(this.scrollParent[0]);return{top:pos.top+this.offset.relative.top*mod+this.offset.parent.top*mod-(this.cssPosition==="fixed"?-this.offset.scroll.top:scrollIsRootNode?0:this.offset.scroll.top)*mod,left:pos.left+this.offset.relative.left*mod+this.offset.parent.left*mod-(this.cssPosition==="fixed"?-this.offset.scroll.left:scrollIsRootNode?0:this.offset.scroll.left)*mod}},"_convertPositionTo"),_generatePosition:__name(function(event,constrainPosition){var containment,co,top,left,o=this.options,scrollIsRootNode=this._isRootNode(this.scrollParent[0]),pageX=event.pageX,pageY=event.pageY;return(!scrollIsRootNode||!this.offset.scroll)&&(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),constrainPosition&&(this.containment&&(this.relativeContainer?(co=this.relativeContainer.offset(),containment=[this.containment[0]+co.left,this.containment[1]+co.top,this.containment[2]+co.left,this.containment[3]+co.top]):containment=this.containment,event.pageX-this.offset.click.left<containment[0]&&(pageX=containment[0]+this.offset.click.left),event.pageY-this.offset.click.top<containment[1]&&(pageY=containment[1]+this.offset.click.top),event.pageX-this.offset.click.left>containment[2]&&(pageX=containment[2]+this.offset.click.left),event.pageY-this.offset.click.top>containment[3]&&(pageY=containment[3]+this.offset.click.top)),o.grid&&(top=o.grid[1]?this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,pageY=containment?top-this.offset.click.top>=containment[1]||top-this.offset.click.top>containment[3]?top:top-this.offset.click.top>=containment[1]?top-o.grid[1]:top+o.grid[1]:top,left=o.grid[0]?this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,pageX=containment?left-this.offset.click.left>=containment[0]||left-this.offset.click.left>containment[2]?left:left-this.offset.click.left>=containment[0]?left-o.grid[0]:left+o.grid[0]:left),o.axis==="y"&&(pageX=this.originalPageX),o.axis==="x"&&(pageY=this.originalPageY)),{top:pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition==="fixed"?-this.offset.scroll.top:scrollIsRootNode?0:this.offset.scroll.top),left:pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition==="fixed"?-this.offset.scroll.left:scrollIsRootNode?0:this.offset.scroll.left)}},"_generatePosition"),_clear:__name(function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]!==this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},"_clear"),_trigger:__name(function(type,event,ui){return ui=ui||this._uiHash(),$2.ui.plugin.call(this,type,[event,ui,this],!0),/^(drag|start|stop)/.test(type)&&(this.positionAbs=this._convertPositionTo("absolute"),ui.offset=this.positionAbs),$2.Widget.prototype._trigger.call(this,type,event,ui)},"_trigger"),plugins:{},_uiHash:__name(function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}},"_uiHash")}),$2.ui.plugin.add("draggable","connectToSortable",{start:__name(function(event,ui,draggable2){var uiSortable=$2.extend({},ui,{item:draggable2.element});draggable2.sortables=[],$2(draggable2.options.connectToSortable).each(function(){var sortable2=$2(this).sortable("instance");sortable2&&!sortable2.options.disabled&&(draggable2.sortables.push(sortable2),sortable2.refreshPositions(),sortable2._trigger("activate",event,uiSortable))})},"start"),stop:__name(function(event,ui,draggable2){var uiSortable=$2.extend({},ui,{item:draggable2.element});draggable2.cancelHelperRemoval=!1,$2.each(draggable2.sortables,function(){var sortable2=this;sortable2.isOver?(sortable2.isOver=0,draggable2.cancelHelperRemoval=!0,sortable2.cancelHelperRemoval=!1,sortable2._storedCSS={position:sortable2.placeholder.css("position"),top:sortable2.placeholder.css("top"),left:sortable2.placeholder.css("left")},sortable2._mouseStop(event),sortable2.options.helper=sortable2.options._helper):(sortable2.cancelHelperRemoval=!0,sortable2._trigger("deactivate",event,uiSortable))})},"stop"),drag:__name(function(event,ui,draggable2){$2.each(draggable2.sortables,function(){var innermostIntersecting=!1,sortable2=this;sortable2.positionAbs=draggable2.positionAbs,sortable2.helperProportions=draggable2.helperProportions,sortable2.offset.click=draggable2.offset.click,sortable2._intersectsWith(sortable2.containerCache)&&(innermostIntersecting=!0,$2.each(draggable2.sortables,function(){return this.positionAbs=draggable2.positionAbs,this.helperProportions=draggable2.helperProportions,this.offset.click=draggable2.offset.click,this!==sortable2&&this._intersectsWith(this.containerCache)&&$2.contains(sortable2.element[0],this.element[0])&&(innermostIntersecting=!1),innermostIntersecting})),innermostIntersecting?(sortable2.isOver||(sortable2.isOver=1,draggable2._parent=ui.helper.parent(),sortable2.currentItem=ui.helper.appendTo(sortable2.element).data("ui-sortable-item",!0),sortable2.options._helper=sortable2.options.helper,sortable2.options.helper=function(){return ui.helper[0]},event.target=sortable2.currentItem[0],sortable2._mouseCapture(event,!0),sortable2._mouseStart(event,!0,!0),sortable2.offset.click.top=draggable2.offset.click.top,sortable2.offset.click.left=draggable2.offset.click.left,sortable2.offset.parent.left-=draggable2.offset.parent.left-sortable2.offset.parent.left,sortable2.offset.parent.top-=draggable2.offset.parent.top-sortable2.offset.parent.top,draggable2._trigger("toSortable",event),draggable2.dropped=sortable2.element,$2.each(draggable2.sortables,function(){this.refreshPositions()}),draggable2.currentItem=draggable2.element,sortable2.fromOutside=draggable2),sortable2.currentItem&&(sortable2._mouseDrag(event),ui.position=sortable2.position)):sortable2.isOver&&(sortable2.isOver=0,sortable2.cancelHelperRemoval=!0,sortable2.options._revert=sortable2.options.revert,sortable2.options.revert=!1,sortable2._trigger("out",event,sortable2._uiHash(sortable2)),sortable2._mouseStop(event,!0),sortable2.options.revert=sortable2.options._revert,sortable2.options.helper=sortable2.options._helper,sortable2.placeholder&&sortable2.placeholder.remove(),ui.helper.appendTo(draggable2._parent),draggable2._refreshOffsets(event),ui.position=draggable2._generatePosition(event,!0),draggable2._trigger("fromSortable",event),draggable2.dropped=!1,$2.each(draggable2.sortables,function(){this.refreshPositions()}))})},"drag")}),$2.ui.plugin.add("draggable","cursor",{start:__name(function(event,ui,instance){var t=$2("body"),o=instance.options;t.css("cursor")&&(o._cursor=t.css("cursor")),t.css("cursor",o.cursor)},"start"),stop:__name(function(event,ui,instance){var o=instance.options;o._cursor&&$2("body").css("cursor",o._cursor)},"stop")}),$2.ui.plugin.add("draggable","opacity",{start:__name(function(event,ui,instance){var t=$2(ui.helper),o=instance.options;t.css("opacity")&&(o._opacity=t.css("opacity")),t.css("opacity",o.opacity)},"start"),stop:__name(function(event,ui,instance){var o=instance.options;o._opacity&&$2(ui.helper).css("opacity",o._opacity)},"stop")}),$2.ui.plugin.add("draggable","scroll",{start:__name(function(event,ui,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&i.scrollParentNotHidden[0].tagName!=="HTML"&&(i.overflowOffset=i.scrollParentNotHidden.offset())},"start"),drag:__name(function(event,ui,i){var o=i.options,scrolled=!1,scrollParent=i.scrollParentNotHidden[0],document2=i.document[0];scrollParent!==document2&&scrollParent.tagName!=="HTML"?((!o.axis||o.axis!=="x")&&(i.overflowOffset.top+scrollParent.offsetHeight-event.pageY<o.scrollSensitivity?scrollParent.scrollTop=scrolled=scrollParent.scrollTop+o.scrollSpeed:event.pageY-i.overflowOffset.top<o.scrollSensitivity&&(scrollParent.scrollTop=scrolled=scrollParent.scrollTop-o.scrollSpeed)),(!o.axis||o.axis!=="y")&&(i.overflowOffset.left+scrollParent.offsetWidth-event.pageX<o.scrollSensitivity?scrollParent.scrollLeft=scrolled=scrollParent.scrollLeft+o.scrollSpeed:event.pageX-i.overflowOffset.left<o.scrollSensitivity&&(scrollParent.scrollLeft=scrolled=scrollParent.scrollLeft-o.scrollSpeed))):((!o.axis||o.axis!=="x")&&(event.pageY-$2(document2).scrollTop()<o.scrollSensitivity?scrolled=$2(document2).scrollTop($2(document2).scrollTop()-o.scrollSpeed):$2(window).height()-(event.pageY-$2(document2).scrollTop())<o.scrollSensitivity&&(scrolled=$2(document2).scrollTop($2(document2).scrollTop()+o.scrollSpeed))),(!o.axis||o.axis!=="y")&&(event.pageX-$2(document2).scrollLeft()<o.scrollSensitivity?scrolled=$2(document2).scrollLeft($2(document2).scrollLeft()-o.scrollSpeed):$2(window).width()-(event.pageX-$2(document2).scrollLeft())<o.scrollSensitivity&&(scrolled=$2(document2).scrollLeft($2(document2).scrollLeft()+o.scrollSpeed)))),scrolled!==!1&&$2.ui.ddmanager&&!o.dropBehaviour&&$2.ui.ddmanager.prepareOffsets(i,event)},"drag")}),$2.ui.plugin.add("draggable","snap",{start:__name(function(event,ui,i){var o=i.options;i.snapElements=[],$2(o.snap.constructor!==String?o.snap.items||":data(ui-draggable)":o.snap).each(function(){var $t=$2(this),$o=$t.offset();this!==i.element[0]&&i.snapElements.push({item:this,width:$t.outerWidth(),height:$t.outerHeight(),top:$o.top,left:$o.left})})},"start"),drag:__name(function(event,ui,inst){var ts,bs,ls,rs,l,r,t,b,i,first,o=inst.options,d=o.snapTolerance,x1=ui.offset.left,x2=x1+inst.helperProportions.width,y1=ui.offset.top,y2=y1+inst.helperProportions.height;for(i=inst.snapElements.length-1;i>=0;i--){if(l=inst.snapElements[i].left-inst.margins.left,r=l+inst.snapElements[i].width,t=inst.snapElements[i].top-inst.margins.top,b=t+inst.snapElements[i].height,x2<l-d||x1>r+d||y2<t-d||y1>b+d||!$2.contains(inst.snapElements[i].item.ownerDocument,inst.snapElements[i].item)){inst.snapElements[i].snapping&&inst.options.snap.release&&inst.options.snap.release.call(inst.element,event,$2.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item})),inst.snapElements[i].snapping=!1;continue}o.snapMode!=="inner"&&(ts=Math.abs(t-y2)<=d,bs=Math.abs(b-y1)<=d,ls=Math.abs(l-x2)<=d,rs=Math.abs(r-x1)<=d,ts&&(ui.position.top=inst._convertPositionTo("relative",{top:t-inst.helperProportions.height,left:0}).top),bs&&(ui.position.top=inst._convertPositionTo("relative",{top:b,left:0}).top),ls&&(ui.position.left=inst._convertPositionTo("relative",{top:0,left:l-inst.helperProportions.width}).left),rs&&(ui.position.left=inst._convertPositionTo("relative",{top:0,left:r}).left)),first=ts||bs||ls||rs,o.snapMode!=="outer"&&(ts=Math.abs(t-y1)<=d,bs=Math.abs(b-y2)<=d,ls=Math.abs(l-x1)<=d,rs=Math.abs(r-x2)<=d,ts&&(ui.position.top=inst._convertPositionTo("relative",{top:t,left:0}).top),bs&&(ui.position.top=inst._convertPositionTo("relative",{top:b-inst.helperProportions.height,left:0}).top),ls&&(ui.position.left=inst._convertPositionTo("relative",{top:0,left:l}).left),rs&&(ui.position.left=inst._convertPositionTo("relative",{top:0,left:r-inst.helperProportions.width}).left)),!inst.snapElements[i].snapping&&(ts||bs||ls||rs||first)&&inst.options.snap.snap&&inst.options.snap.snap.call(inst.element,event,$2.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item})),inst.snapElements[i].snapping=ts||bs||ls||rs||first}},"drag")}),$2.ui.plugin.add("draggable","stack",{start:__name(function(event,ui,instance){var min,o=instance.options,group=$2.makeArray($2(o.stack)).sort(function(a,b){return(parseInt($2(a).css("zIndex"),10)||0)-(parseInt($2(b).css("zIndex"),10)||0)});group.length&&(min=parseInt($2(group[0]).css("zIndex"),10)||0,$2(group).each(function(i){$2(this).css("zIndex",min+i)}),this.css("zIndex",min+group.length))},"start")}),$2.ui.plugin.add("draggable","zIndex",{start:__name(function(event,ui,instance){var t=$2(ui.helper),o=instance.options;t.css("zIndex")&&(o._zIndex=t.css("zIndex")),t.css("zIndex",o.zIndex)},"start"),stop:__name(function(event,ui,instance){var o=instance.options;o._zIndex&&$2(ui.helper).css("zIndex",o._zIndex)},"stop")}),$2.ui.draggable})),draggable}__name(requireDraggable,"requireDraggable");requireDraggable();var droppable={},hasRequiredDroppable;function requireDroppable(){return hasRequiredDroppable||(hasRequiredDroppable=1,(function(factory){factory($)})(function($2){return $2.widget("ui.droppable",{version:"1.14.1",widgetEventPrefix:"drop",options:{accept:"*",addClasses:!0,greedy:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:__name(function(){var proportions,o=this.options,accept=o.accept;this.isover=!1,this.isout=!0,this.accept=typeof accept=="function"?accept:function(d){return d.is(accept)},this.proportions=function(){if(arguments.length)proportions=arguments[0];else return proportions||(proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight})},this._addToManager(o.scope),o.addClasses&&this._addClass("ui-droppable")},"_create"),_addToManager:__name(function(scope){$2.ui.ddmanager.droppables[scope]=$2.ui.ddmanager.droppables[scope]||[],$2.ui.ddmanager.droppables[scope].push(this)},"_addToManager"),_splice:__name(function(drop){for(var i=0;i<drop.length;i++)drop[i]===this&&drop.splice(i,1)},"_splice"),_destroy:__name(function(){var drop=$2.ui.ddmanager.droppables[this.options.scope];this._splice(drop)},"_destroy"),_setOption:__name(function(key,value){if(key==="accept")this.accept=typeof value=="function"?value:function(d){return d.is(value)};else if(key==="scope"){var drop=$2.ui.ddmanager.droppables[this.options.scope];this._splice(drop),this._addToManager(value)}this._super(key,value)},"_setOption"),_activate:__name(function(event){var draggable2=$2.ui.ddmanager.current;this._addActiveClass(),draggable2&&this._trigger("activate",event,this.ui(draggable2))},"_activate"),_deactivate:__name(function(event){var draggable2=$2.ui.ddmanager.current;this._removeActiveClass(),draggable2&&this._trigger("deactivate",event,this.ui(draggable2))},"_deactivate"),_over:__name(function(event){var draggable2=$2.ui.ddmanager.current;!draggable2||(draggable2.currentItem||draggable2.element)[0]===this.element[0]||this.accept.call(this.element[0],draggable2.currentItem||draggable2.element)&&(this._addHoverClass(),this._trigger("over",event,this.ui(draggable2)))},"_over"),_out:__name(function(event){var draggable2=$2.ui.ddmanager.current;!draggable2||(draggable2.currentItem||draggable2.element)[0]===this.element[0]||this.accept.call(this.element[0],draggable2.currentItem||draggable2.element)&&(this._removeHoverClass(),this._trigger("out",event,this.ui(draggable2)))},"_out"),_drop:__name(function(event,custom){var draggable2=custom||$2.ui.ddmanager.current,childrenIntersection=!1;return!draggable2||(draggable2.currentItem||draggable2.element)[0]===this.element[0]||(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var inst=$2(this).droppable("instance");if(inst.options.greedy&&!inst.options.disabled&&inst.options.scope===draggable2.options.scope&&inst.accept.call(inst.element[0],draggable2.currentItem||draggable2.element)&&$2.ui.intersect(draggable2,$2.extend(inst,{offset:inst.element.offset()}),inst.options.tolerance,event))return childrenIntersection=!0,!1}),childrenIntersection)?!1:this.accept.call(this.element[0],draggable2.currentItem||draggable2.element)?(this._removeActiveClass(),this._removeHoverClass(),this._trigger("drop",event,this.ui(draggable2)),this.element):!1},"_drop"),ui:__name(function(c){return{draggable:c.currentItem||c.element,helper:c.helper,position:c.position,offset:c.positionAbs}},"ui"),_addHoverClass:__name(function(){this._addClass("ui-droppable-hover")},"_addHoverClass"),_removeHoverClass:__name(function(){this._removeClass("ui-droppable-hover")},"_removeHoverClass"),_addActiveClass:__name(function(){this._addClass("ui-droppable-active")},"_addActiveClass"),_removeActiveClass:__name(function(){this._removeClass("ui-droppable-active")},"_removeActiveClass")}),$2.ui.intersect=(function(){function isOverAxis(x,reference,size){return x>=reference&&x<reference+size}return __name(isOverAxis,"isOverAxis"),function(draggable2,droppable2,toleranceMode,event){if(!droppable2.offset)return!1;var x1=(draggable2.positionAbs||draggable2.position.absolute).left+draggable2.margins.left,y1=(draggable2.positionAbs||draggable2.position.absolute).top+draggable2.margins.top,x2=x1+draggable2.helperProportions.width,y2=y1+draggable2.helperProportions.height,l=droppable2.offset.left,t=droppable2.offset.top,r=l+droppable2.proportions().width,b=t+droppable2.proportions().height;switch(toleranceMode){case"fit":return l<=x1&&x2<=r&&t<=y1&&y2<=b;case"intersect":return l<x1+draggable2.helperProportions.width/2&&x2-draggable2.helperProportions.width/2<r&&t<y1+draggable2.helperProportions.height/2&&y2-draggable2.helperProportions.height/2<b;case"pointer":return isOverAxis(event.pageY,t,droppable2.proportions().height)&&isOverAxis(event.pageX,l,droppable2.proportions().width);case"touch":return(y1>=t&&y1<=b||y2>=t&&y2<=b||y1<t&&y2>b)&&(x1>=l&&x1<=r||x2>=l&&x2<=r||x1<l&&x2>r);default:return!1}}})(),$2.ui.ddmanager={current:null,droppables:{default:[]},prepareOffsets:__name(function(t,event){var i,j,m=$2.ui.ddmanager.droppables[t.options.scope]||[],type=event?event.type:null,list=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();droppablesLoop:for(i=0;i<m.length;i++)if(!(m[i].options.disabled||t&&!m[i].accept.call(m[i].element[0],t.currentItem||t.element))){for(j=0;j<list.length;j++)if(list[j]===m[i].element[0]){m[i].proportions().height=0;continue droppablesLoop}m[i].visible=m[i].element.css("display")!=="none",m[i].visible&&(type==="mousedown"&&m[i]._activate.call(m[i],event),m[i].offset=m[i].element.offset(),m[i].proportions({width:m[i].element[0].offsetWidth,height:m[i].element[0].offsetHeight}))}},"prepareOffsets"),drop:__name(function(draggable2,event){var dropped=!1;return $2.each(($2.ui.ddmanager.droppables[draggable2.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&$2.ui.intersect(draggable2,this,this.options.tolerance,event)&&(dropped=this._drop.call(this,event)||dropped),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],draggable2.currentItem||draggable2.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,event)))}),dropped},"drop"),dragStart:__name(function(draggable2,event){draggable2.element.parentsUntil("body").on("scroll.droppable",function(){draggable2.options.refreshPositions||$2.ui.ddmanager.prepareOffsets(draggable2,event)})},"dragStart"),drag:__name(function(draggable2,event){draggable2.options.refreshPositions&&$2.ui.ddmanager.prepareOffsets(draggable2,event),$2.each($2.ui.ddmanager.droppables[draggable2.options.scope]||[],function(){if(!(this.options.disabled||this.greedyChild||!this.visible)){var parentInstance,scope,parent2,intersects=$2.ui.intersect(draggable2,this,this.options.tolerance,event),c=!intersects&&this.isover?"isout":intersects&&!this.isover?"isover":null;c&&(this.options.greedy&&(scope=this.options.scope,parent2=this.element.parents(":data(ui-droppable)").filter(function(){return $2(this).droppable("instance").options.scope===scope}),parent2.length&&(parentInstance=$2(parent2[0]).droppable("instance"),parentInstance.greedyChild=c==="isover")),parentInstance&&c==="isover"&&(parentInstance.isover=!1,parentInstance.isout=!0,parentInstance._out.call(parentInstance,event)),this[c]=!0,this[c==="isout"?"isover":"isout"]=!1,this[c==="isover"?"_over":"_out"].call(this,event),parentInstance&&c==="isout"&&(parentInstance.isout=!1,parentInstance.isover=!0,parentInstance._over.call(parentInstance,event)))}})},"drag"),dragStop:__name(function(draggable2,event){draggable2.element.parentsUntil("body").off("scroll.droppable"),draggable2.options.refreshPositions||$2.ui.ddmanager.prepareOffsets(draggable2,event)},"dragStop")},$2.uiBackCompat===!0&&$2.widget("ui.droppable",$2.ui.droppable,{options:{hoverClass:!1,activeClass:!1},_addActiveClass:__name(function(){this._super(),this.options.activeClass&&this.element.addClass(this.options.activeClass)},"_addActiveClass"),_removeActiveClass:__name(function(){this._super(),this.options.activeClass&&this.element.removeClass(this.options.activeClass)},"_removeActiveClass"),_addHoverClass:__name(function(){this._super(),this.options.hoverClass&&this.element.addClass(this.options.hoverClass)},"_addHoverClass"),_removeHoverClass:__name(function(){this._super(),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass)},"_removeHoverClass")}),$2.ui.droppable})),droppable}__name(requireDroppable,"requireDroppable");requireDroppable();class DragPlaceholder extends ItemViewPlaceholder{static{__name(this,"DragPlaceholder")}itemType;pattern=i18n("live.view.drag.drophere");regionView;messageEl;static instance;static debug=!1;static get(){return DragPlaceholder.instance||(DragPlaceholder.instance=new DragPlaceholder),DragPlaceholder.instance}constructor(){super(),this.setId("drag-placeholder").addClassEx("drag-placeholder"),this.messageEl=new DivEl("message"),this.appendChild(this.messageEl)}setItemType(type){return this.itemType&&this.removeClass(this.itemType.getShortName()+"-placeholder"),this.itemType=type,type?(this.setText(this.getDefaultText()),this.addClass(type.getShortName()+"-placeholder")):this.setText(""),this}getDefaultText(){return this.pattern}setDropAllowed(allowed){return allowed&&this.itemType&&this.setText(this.getDefaultText()),this.toggleClass("drop-allowed",allowed),this}setText(text2){return this.messageEl.setHtml(text2),this}setRegionView(regionView){return this.regionView=regionView,this.setDropAllowed(!!regionView),this}reset(){return this.setItemType(null),this.setRegionView(null),this}}class ComponentViewDragCanceledEvent extends IframeEvent{static{__name(this,"ComponentViewDragCanceledEvent")}constructor(componentView){super(),this.componentView=componentView}getComponentView(){return this.componentView}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class ComponentViewDragDroppedEvent extends IframeEvent{static{__name(this,"ComponentViewDragDroppedEvent")}constructor(from,to){super(),this.from=from,this.to=to}getFromPath(){return this.from}getToPath(){return this.to}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class ComponentViewDragStoppedEvent extends IframeEvent{static{__name(this,"ComponentViewDragStoppedEvent")}constructor(path){super(),this.path=path}getPath(){return this.path}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class ComponentViewDragStartedEvent extends IframeEvent{static{__name(this,"ComponentViewDragStartedEvent")}constructor(path){super(),this.path=path}getPath(){return this.path}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class MoveComponentEvent extends IframeEvent{static{__name(this,"MoveComponentEvent")}constructor(from,to){super(),this.from=from,this.to=to}getFrom(){return this.from}getTo(){return this.to}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class DragAndDrop{static{__name(this,"DragAndDrop")}static debug=!1;static messageCounter=0;static instance;pageView;REGION_SELECTOR=RegionItemType.get().getConfig().getCssSelector();ITEM_NOT_DRAGGABLE_SELECTOR=".not-draggable";PLACEHOLDER_CONTAINER_SELECTOR="live-edit-drag-placeholder-container";DRAGGED_OVER_CLASS="dragged-over";DRAGGING_ACTIVE_CLASS="dragging";SORTABLE_ITEMS_SELECTOR;dragging=!1;wasDropped=!1;newlyDropped=!1;wasDestroyed=!1;newItemItemType;draggedComponentView;dragStartedListeners=[];dragStoppedListeners=[];droppedListeners=[];canceledListeners=[];static init(pageView){DragAndDrop.instance=new DragAndDrop(pageView)}static get(){if(!DragAndDrop.instance)throw Error("Do DragAndDrop.init(pageView) first");return DragAndDrop.instance}constructor(pageView){this.pageView=pageView,this.SORTABLE_ITEMS_SELECTOR=this.createSortableItemsSelector(),this.createSortable($(this.REGION_SELECTOR))}isDragging(){return this.dragging}createSortableLayout(component){$(component.getHTMLElement()).find(this.REGION_SELECTOR).each((_index,element)=>{this.createSortable($(element))})}refreshSortable(){$(this.REGION_SELECTOR).sortable("refresh")}processMouseOverRegionView(regionView){this.pageView.getItemViewsByType(RegionItemType.get()).forEach(region=>{region.toggleClass(this.DRAGGED_OVER_CLASS,region.getPath().equals(regionView.getPath()))}),regionView.refreshEmptyState()}processMouseOutRegionView(regionView){regionView.refreshEmptyState().removeClass(this.DRAGGED_OVER_CLASS)}createSortable(selector){$(selector).sortable({appendTo:document.body,revert:!1,cancel:this.ITEM_NOT_DRAGGABLE_SELECTOR,connectWith:this.REGION_SELECTOR,items:this.SORTABLE_ITEMS_SELECTOR,distance:20,delay:50,tolerance:"intersect",cursor:"move",cursorAt:DragHelper.CURSOR_AT,scrollSensitivity:this.calculateScrollSensitivity(),placeholder:this.PLACEHOLDER_CONTAINER_SELECTOR,forceHelperSize:!0,helper:__name((_event,_ui)=>DragHelper.get().getHTMLElement(),"helper"),start:__name((event,ui)=>this.handleSortStart(event,ui),"start"),activate:__name((event,ui)=>this.handleActivate(event,ui),"activate"),over:__name((event,ui)=>this.handleDragOver(event,ui),"over"),out:__name((event,ui)=>this.handleDragOut(event,ui),"out"),beforeStop:__name((event,ui)=>this.handleBeforeStop(event,ui),"beforeStop"),receive:__name((event,ui)=>this.handleReceive(event,ui),"receive"),deactivate:__name((event,ui)=>this.handleDeactivate(event,ui),"deactivate"),stop:__name((event,ui)=>this.handleSortStop(event,ui),"stop"),remove:__name((event,ui)=>this.handleRemove(event,ui),"remove")})}createDraggable(jq){this.newItemItemType=ItemType.fromHTMLElement(jq.get(0)),jq.draggable({connectToSortable:this.REGION_SELECTOR,addClasses:!1,cursor:"move",appendTo:"body",cursorAt:DragHelper.CURSOR_AT,helper:__name((_event,_ui)=>DragHelper.get().getHTMLElement(),"helper"),start:__name((event,ui)=>this.handleDraggableStart(event,ui),"start"),stop:__name((event,ui)=>this.handleDraggableStop(event,ui),"stop")})}destroyDraggable(jq){jq.draggable("destroy"),this.wasDestroyed=!0}handleDraggableStart(event,ui){Body.get().appendChild(DragHelper.get()),this.notifyDragStarted(this.draggedComponentView)}handleDraggableStop(event,ui){Body.get().removeChild(DragHelper.get()),this.wasDropped||this.notifyCanceled(this.draggedComponentView),this.notifyDragStopped(this.draggedComponentView)}handleSortStart(event,ui){const regionView=this.getRegionView(ui.item.parent());let itemType;const placeholder=DragPlaceholder.get().setRegionView(regionView);this.isDraggingFromContextWindow()?itemType=this.newItemItemType:(this.draggedComponentView=this.getComponentView(ui.item),this.draggedComponentView.deselect(),this.draggedComponentView.setMoving(!0),itemType=this.draggedComponentView.getType()),ui.placeholder.append(placeholder.setItemType(itemType).getHTMLElement()),ui.helper.show(),this.processMouseOverRegionView(regionView),this.updateHelperAndPlaceholder(regionView),this.updateScrollSensitivity(event.target),this.notifyDragStarted(this.draggedComponentView)}handleBeforeStop(event,ui){ui.helper.hide()}handleSortStop(event,ui){if(this.wasDestroyed){this.cancelDrag(event.target),this.wasDestroyed=!1;return}const regionView=this.getRegionView(ui.item.parent());if(!DragHelper.get().isDropAllowed())this.cancelDrag(event.target);else{const componentIndex=$(">.drag-helper, >."+StyleHelper$1.getCls("item-view"),regionView.getHTMLElement()).index(ui.item);if(this.isDraggingFromContextWindow()){const componentType=this.newItemItemType,path=new ComponentPath(componentIndex,regionView.getPath());new AddComponentEvent(path,componentType.toComponentType()).fire(),this.notifyDropped(null,path,regionView)}else{const from=this.draggedComponentView.getPath(),to=new ComponentPath(componentIndex,regionView.getPath());new MoveComponentEvent(from,to).fire(),this.notifyDropped(from,to,regionView)}}this.isDraggingFromContextWindow()||this.draggedComponentView.setMoving(!1),regionView.refreshEmptyState(),this.notifyDragStopped(this.draggedComponentView),this.isDraggingFromContextWindow()&&ui.item.remove(),this.newItemItemType=null,this.draggedComponentView=null,this.newlyDropped=!0,setTimeout(()=>{this.newlyDropped=!1},100)}isNewlyDropped(){return this.newlyDropped}handleActivate(event,ui){this.getRegionView($(event.target)).addClass(this.DRAGGING_ACTIVE_CLASS)}handleDeactivate(event,ui){this.getRegionView($(event.target)).removeClass(this.DRAGGING_ACTIVE_CLASS)}handleDragOver(event,ui){const regionView=this.getRegionView(ui.placeholder.parent());this.processMouseOverRegionView(regionView),this.updateHelperAndPlaceholder(regionView)}handleDragOut(event,ui){if(!ui.placeholder||!ui.placeholder.parent()[0])return;const regionView=this.getRegionView(ui.placeholder.parent());this.processMouseOutRegionView(regionView),this.updateHelperAndPlaceholder(regionView,!1)}handleSortChange(event,ui){}handleSortUpdate(event,ui){}handleRemove(event,ui){this.getRegionView($(event.target)).refreshEmptyState()}handleReceive(event,ui){this.getRegionView($(event.target)).refreshEmptyState()}cancelDrag(sortable2){$(sortable2).sortable("cancel"),this.notifyCanceled(this.draggedComponentView)}onDragStarted(listener){this.dragStartedListeners.push(listener)}unDragStarted(listener){this.dragStartedListeners=this.dragStartedListeners.filter(curr=>curr!==listener)}notifyDragStarted(componentView){this.dragging=!0,this.wasDropped=!1,this.dragStartedListeners.forEach(curr=>{curr(componentView)}),new ComponentViewDragStartedEvent(componentView?.getPath()).fire()}onDragStopped(listener){this.dragStoppedListeners.push(listener)}unDragStopped(listener){this.dragStoppedListeners=this.dragStoppedListeners.filter(curr=>curr!==listener)}notifyDragStopped(componentView){this.dragging=!1,DragHelper.get().reset(),this.dragStoppedListeners.forEach(curr=>{curr(componentView)}),new ComponentViewDragStoppedEvent(componentView?.getPath()).fire()}onDropped(listener){this.droppedListeners.push(listener)}unDropped(listener){this.droppedListeners=this.droppedListeners.filter(curr=>curr!==listener)}notifyDropped(from,to,regionView){this.wasDropped=!0,new ComponentViewDragDroppedEvent(from,to).fire()}onCanceled(listener){this.canceledListeners.push(listener)}unCanceled(listener){this.canceledListeners=this.canceledListeners.filter(curr=>curr!==listener)}notifyCanceled(componentView){this.canceledListeners.forEach(curr=>{curr(componentView)}),new ComponentViewDragCanceledEvent(componentView).fire()}updateHelperAndPlaceholder(regionView,enter=!0){const helper=DragHelper.get(),placeholder=DragPlaceholder.get().setRegionView(enter?regionView:null);helper.setItemName(this.draggedComponentView?this.draggedComponentView.getName():StringHelper.capitalize(i18n("field."+this.getItemType().getShortName()))),enter?this.isDraggingLayoutOverLayout(regionView,this.getItemType())?(helper.setDropAllowed(!1),placeholder.setText(i18n("notify.nestedLayouts")),placeholder.setDropAllowed(!1)):helper.setDropAllowed(!0):helper.setDropAllowed(!1)}getItemType(){if(this.draggedComponentView)return this.draggedComponentView.getType();if(this.newItemItemType)return this.newItemItemType;throw new Error(i18n("live.view.drag.error.sourceandtargetnull"))}isDraggingFromContextWindow(){return!!this.newItemItemType}isDraggingLayoutOverLayout(regionView,draggingItemType){const isFragment=FragmentItemType.get().equals(draggingItemType),isLayout=!isFragment&&LayoutItemType.get().equals(draggingItemType);return!!((isFragment||isLayout)&&regionView.hasParentLayoutComponentView()&&(isLayout||this.draggedComponentView?.containsLayout()))}getComponentView(jq){const comp=this.pageView.getComponentViewByElement(jq.get(0));return assertState(!!comp,i18n("live.view.drag.error.compviewisnull")),comp}getRegionView(jq){const region=this.pageView.getRegionViewByElement(jq.get(0));return assertState(!!region,i18n("live.view.drag.error.regionviewisnull")),region}createSortableItemsSelector(){const sortableItemsSelector=[];return ItemType.getDraggables().forEach(draggableItemType=>{sortableItemsSelector.push(draggableItemType.getConfig().getCssSelector())}),sortableItemsSelector.toString()}updateScrollSensitivity(selector){const scrollSensitivity=this.calculateScrollSensitivity();$(selector).sortable("option","scrollSensitivity",scrollSensitivity)}calculateScrollSensitivity(){const height=$(window).height();let scrollSensitivity=Math.round(height/8);return scrollSensitivity=Math.max(20,Math.min(scrollSensitivity,100)),scrollSensitivity}}class ItemViewBuilder{static{__name(this,"ItemViewBuilder")}itemViewIdProducer;liveEditParams;itemViewFactory;type;element;parentElement;parentView;contextMenuActions;contextMenuTitle;placeholder;setItemViewIdProducer(value){return this.itemViewIdProducer=value,this}setItemViewFactory(value){return this.itemViewFactory=value,this}setType(value){return this.type=value,this}setElement(value){return this.element=value,this}setPlaceholder(value){return this.placeholder=value,this}setParentView(value){return this.parentView=value,this}setParentElement(value){return this.parentElement=value,this}setContextMenuActions(actions){return this.contextMenuActions=actions,this}setContextMenuTitle(title){return this.contextMenuTitle=title,this}setLiveEditParams(value){return this.liveEditParams=value,this}}class ItemView extends Element{static{__name(this,"ItemView")}placeholder;liveEditParams;itemViewIdProducer;itemViewFactory;type;parentItemView;loadMask;contextMenu;contextMenuTitle;contextMenuActions;mouseOver;shaded;mouseOverViewListeners;mouseOutViewListeners;mouseOverViewListener;mouseLeaveViewListener;shaderClickedListener;mouseEnterListener;mouseLeaveListener;mouseClickedListener;touchStartListener;touchMoveListener;touchEndListener;contextMenuListener;static LIVE_EDIT_SELECTED="live-edit-selected";static debug;constructor(builder){assertNotNull(builder.type,"type cannot be null");let props=null;if(builder.element){const elementFromElementBuilder=new ElementFromElementBuilder;elementFromElementBuilder.setElement(builder.element),elementFromElementBuilder.setParentElement(builder.parentElement),elementFromElementBuilder.setGenerateId(!1),props=elementFromElementBuilder}else{const newElementBuilder=new NewElementBuilder;newElementBuilder.setTagName("div"),newElementBuilder.setParentElement(builder.parentElement),newElementBuilder.setGenerateId(!1),props=newElementBuilder}super(props),this.type=builder.type,this.liveEditParams=builder.liveEditParams,this.parentItemView=builder.parentView,this.itemViewIdProducer=builder.itemViewIdProducer,this.itemViewFactory=builder.itemViewFactory,this.contextMenuTitle=builder.contextMenuTitle,this.addClassEx("item-view"),this.contextMenuActions=[],this.setDraggable(!0),this.mouseOver=!1,this.mouseOverViewListeners=[],this.mouseOutViewListeners=[],this.setItemId(builder.itemViewIdProducer.next()),builder.element||this.getEl().setData(ItemType.ATTRIBUTE_TYPE,builder.type.getShortName());for(const child of this.getChildren())if(ObjectHelper.iFrameSafeInstanceOf(child,ItemViewPlaceholder)){this.removeChild(child);break}builder.placeholder&&this.setPlaceholder(builder.placeholder),this.onRemoved(this.invalidateContextMenu.bind(this)),this.bindMouseListeners()}addContextMenuActions(actions){this.contextMenuActions=this.contextMenuActions.concat(actions)}removeContextMenuAction(action){this.contextMenuActions.indexOf(action)!==-1&&this.contextMenuActions.splice(this.contextMenuActions.indexOf(action),1)}setPlaceholder(placeholder){this.placeholder=placeholder}disableLinks(){$(this.getHTMLElement()).find("a").on("click",e=>e.preventDefault())}setContextMenuTitle(title){this.contextMenuTitle=title}bindMouseListeners(){this.mouseEnterListener=event=>this.handleMouseEnter(event),this.onMouseEnter(this.mouseEnterListener),this.mouseLeaveListener=event=>this.handleMouseLeave(event),this.onMouseLeave(this.mouseLeaveListener),this.mouseClickedListener=event=>this.handleClick(event),this.onClicked(this.mouseClickedListener),this.contextMenuListener=event=>this.handleClick(event),this.onContextMenu(this.contextMenuListener),this.handleTouchEvents(),ResponsiveManager.onAvailableSizeChanged(this,_item=>{this.mouseOver&&this.highlight(),this.isSelected()&&this.highlightSelected()}),this.shaderClickedListener=event=>this.handleShaderClick(event),Shader.get().onClicked(this.shaderClickedListener),this.mouseOverViewListener=()=>{(this.getParentItemView()||PageItemType.get().equals(this.getType()))&&(this.isDragging()||(this.showCursor(),this.highlight()))},this.onMouseOverView(this.mouseOverViewListener),this.mouseLeaveViewListener=()=>{(this.getParentItemView()||PageItemType.get().equals(this.getType()))&&(this.isDragging()||(this.resetCursor(),this.unhighlight()))},this.onMouseLeaveView(this.mouseLeaveViewListener)}handleTouchEvents(){let isMoveEvent=!1,dateOnTouchStart,touchPoint;this.touchStartListener=event=>{event.stopPropagation(),isMoveEvent=!1,dateOnTouchStart=new Date,touchPoint=event.touches[0]},this.touchMoveListener=event=>{event.stopPropagation(),isMoveEvent=!0},this.touchEndListener=event=>{if(event.stopPropagation(),isMoveEvent)return;const isLongTouch=(new Date().getTime()-dateOnTouchStart.getTime())/1e3>1;if(!this.isSelected()||isLongTouch){this.selectItem();const clickPosition=isLongTouch?{x:touchPoint.pageX,y:touchPoint.pageY}:null;isLongTouch&&(this.showContextMenu(clickPosition),event.preventDefault()),new SelectComponentEvent({path:this.getPath(),position:clickPosition}).fire()}else this.contextMenu?.isVisible()?this.hideContextMenu():this.deselect()},this.onTouchStart(this.touchStartListener),this.onTouchMove(this.touchMoveListener),this.onTouchEnd(this.touchEndListener,!1)}isDragging(){throw Error("Should be overridden, typically DragAndDrop.get().isDragging()")}unbindMouseListeners(){this.unMouseEnter(this.mouseEnterListener),this.unMouseLeave(this.mouseLeaveListener),this.unClicked(this.mouseClickedListener),this.unTouchStart(this.touchStartListener),this.unTouchMove(this.touchMoveListener),this.unTouchEnd(this.touchEndListener),this.unContextMenu(this.contextMenuListener),ResponsiveManager.unAvailableSizeChanged(this),Shader.get().unClicked(this.shaderClickedListener),this.unMouseOverView(this.mouseOverViewListener),this.unMouseLeaveView(this.mouseLeaveViewListener)}highlight(){PageViewController.get().isHighlightingDisabled()||this.isViewInsideSelectedContainer()||(Highlighter.get().highlightItemView(this),this.isSelected())}unhighlight(){Highlighter.get().hide(),this.isSelected()}highlightSelected(){PageViewController.get().isHighlightingDisabled()||SelectedHighlighter.get().highlightItemView(this)}unhighlightSelected(){SelectedHighlighter.get().unselect()}shade(){Shader.get().shade(this),this.shaded=!0}unshade(){Shader.get().hide(),this.shaded=!1}showCursor(){const itemView=this.isViewInsideSelectedContainer()?SelectedHighlighter.get().getSelectedView():this;Cursor.get().displayItemViewCursor(itemView)}resetCursor(){Cursor.get().reset()}remove(){return this.contextMenu&&this.contextMenu.remove(),this.loadMask&&this.loadMask.remove(),this.unhighlight(),this.unbindMouseListeners(),super.remove(),this}setDraggable(value){this.toggleClass("not-draggable",!value)}scrollComponentIntoView(){this.getEl().getHTMLElement().scrollIntoView({behavior:"smooth"})}handleMouseEnter(_event){this.mouseOver||(this.manageParentsMouseOver(),this.mouseOver=!0,this.notifyMouseOverView())}manageParentsMouseOver(){const parentsStack=[];for(let parent2=this.parentItemView;parent2&&(parentsStack.push(parent2),!parent2.mouseOver);parent2=parent2.parentItemView);parentsStack.reverse().forEach(view=>{view.mouseOver||(view.mouseOver=!0,view.notifyMouseOverView()),view.notifyMouseLeaveView()})}handleMouseLeave(event){if(this.mouseOver=!1,this.notifyMouseLeaveView(),this.parentItemView){const rect=this.getEl().getBoundingClientRect();event.clientX<rect.left||event.clientX>rect.right||event.clientY<rect.top||event.clientY>rect.bottom?this.parentItemView.notifyMouseOverView():this.parentItemView.notifyMouseLeaveView()}}isEmpty(){throw new Error("Must be implemented by inheritors")}refreshEmptyState(){return this.toggleClass("empty",this.isEmpty()),this.togglePlaceholder(),this.isSelected()&&this.highlightSelected(),this}togglePlaceholder(){this.isPlaceholderNeeded()?this.addPlaceholder():this.removePlaceholder()}isPlaceholderNeeded(){return this.isEmpty()||this.hasRenderingError()}hasRenderingError(){return this.getEl().getAttribute("data-portal-placeholder-error")==="true"}addPlaceholder(){this.placeholder&&!this.contains(this.placeholder)&&this.appendChild(this.placeholder)}removePlaceholder(){this.placeholder&&this.contains(this.placeholder)&&this.removeChild(this.placeholder)}getCurrentContextMenu(){return this.contextMenu}handleClick(event){if(event.stopPropagation(),event instanceof PointerEvent&&event.pointerType==="touch"||DragAndDrop.get().isNewlyDropped())return;if(PageViewController.get().isNextClickDisabled()){PageViewController.get().setNextClickDisabled(!1);return}const rightClicked=event.which===3||event.ctrlKey;rightClicked&&event.preventDefault();const contextMenu=this.getCurrentContextMenu(),targetInContextMenu=!!contextMenu&&contextMenu.getHTMLElement().contains(event.target),placeholderIsTarget=event.target===this.placeholder?.getHTMLElement();if(!this.isSelected()||rightClicked){const selectedView=SelectedHighlighter.get().getSelectedView(),isViewInsideSelectedContainer=this.isViewInsideSelectedContainer(),clickPosition=this.isEmpty()?null:{x:event.pageX,y:event.pageY};if(selectedView&&isViewInsideSelectedContainer&&!rightClicked&&selectedView.deselect(),!selectedView||selectedView===this||!isViewInsideSelectedContainer){const menuPosition=rightClicked?null:ItemViewContextMenuPosition.NONE,config={path:this.getPath(),position:clickPosition,newlyCreated:!1,rightClicked};this.select(config,menuPosition),this.focusPlaceholderIfEmpty()}else isViewInsideSelectedContainer&&rightClicked&&SelectedHighlighter.get().getSelectedView().showContextMenu(clickPosition)}else(!this.isEmpty()&&!targetInContextMenu||placeholderIsTarget)&&this.deselect()}handleShaderClick(event){event.stopPropagation(),!PageViewController.get().isLocked()&&(this.isSelected()&&this.deselect(),event.type&&(event.type==="click"||event.type==="contextmenu")&&this.isEventOverItem(event)&&this.handleClick(event))}isEventOverItem(event){const offset=this.getEl().getDimensions(),x=event.pageX,y=event.pageY;return x>=offset.left&&x<=offset.left+offset.width&&y>=offset.top&&y<=offset.top+offset.height}getItemViewIdProducer(){return this.itemViewIdProducer}getItemViewFactory(){return this.itemViewFactory}getLiveEditParams(){return this.liveEditParams}showContextMenu(clickPosition,menuPosition){if(PageViewController.get().isContextMenuDisabled())return;if(menuPosition&&ItemViewContextMenuPosition.NONE===menuPosition){this.hideContextMenu();return}this.contextMenu||this.initContextMenu();let x,y;if(clickPosition)x=clickPosition.x,y=clickPosition.y;else{const dimensions=this.getEl().getDimensions();x=dimensions.left+dimensions.width/2,y=dimensions.top+(ItemViewContextMenuPosition.TOP===menuPosition?0:dimensions.height)}this.contextMenu.showAt(x,y,!clickPosition)}initContextMenu(){this.contextMenu=new ItemViewContextMenu(this.contextMenuTitle,this.contextMenuActions),this.contextMenu.onOrientationChanged(orientation=>{orientation===ItemViewContextMenuOrientation.UP&&this.isEmpty()?this.contextMenu.getEl().setMarginTop("-"+this.getEl().getDimensions().height+"px"):this.contextMenu.getEl().setMarginTop("0px")}),this.contextMenu.onTouchEnd(event=>{event.stopPropagation()})}hideContextMenu(){this.contextMenu?.hide()}invalidateContextMenu(){this.contextMenu?.remove(),this.contextMenu=null}setItemId(value){this.getEl().setAttribute("data-"+ItemViewId.DATA_ATTRIBUTE,value.toString())}getItemId(){const asString=this.getEl().getAttribute("data-"+ItemViewId.DATA_ATTRIBUTE);return asString?ItemViewId.fromString(asString):null}static parseItemId(element){const attribute=element.getAttribute("data-"+ItemViewId.DATA_ATTRIBUTE);return StringHelper.isEmpty(attribute)?null:ItemViewId.fromString(attribute)}getType(){return this.type}getParentItemView(){return this.parentItemView}setParentItemView(itemView){this.parentItemView=itemView}isSelected(){return this.getEl().hasAttribute("data-live-edit-selected")}select(config,menuPosition,silent){Highlighter.get().hide(),this.selectItem(),!silent&&config&&new SelectComponentEvent(config).fire(),this.showContextMenu(config?.position,menuPosition)}selectWithoutMenu(silent){this.selectItem(),silent||new SelectComponentEvent({path:this.getPath(),position:null}).fire()}selectItem(){const selectedView=SelectedHighlighter.get().getSelectedView();selectedView!==this&&(selectedView&&selectedView.deselect(!0),this.getEl().setData(ItemView.LIVE_EDIT_SELECTED,"true"),this.showCursor(),PageViewController.get().isLocked()||this.highlightSelected(),this.isEmpty()&&this.selectPlaceholder())}deselect(silent){this.getEl().removeAttribute("data-live-edit-selected"),this.hideContextMenu(),this.unhighlightSelected(),this.isEmpty()&&this.deselectPlaceholder(),silent||new DeselectComponentEvent(this.getPath()).fire()}isDraggableView(){return!this.getType().equals(RegionItemType.get())&&!this.getType().equals(PageItemType.get())}selectPlaceholder(){this.placeholder?.select()}focusPlaceholderIfEmpty(){this.isEmpty()&&this.placeholder?.focus()}deselectPlaceholder(){this.placeholder?.deselect()}showRenderingError(url,errorMessage){this.placeholder&&(this.addClass("error"),this.placeholder.showRenderingError(url,errorMessage))}getName(){return i18n("live.view.itemview.noname")}getIconClass(){return ItemViewIconClassResolver.resolveByView(this)}showLoadingSpinner(){this.loadMask||(this.loadMask=new LoadMask(this),this.appendChild(this.loadMask)),this.loadMask.show()}hideLoadingSpinner(){this.loadMask&&this.loadMask.hide()}getContextMenuActions(){return this.contextMenuActions}toItemViewArray(){return[this]}toString(){return this.getItemId().toNumber()+" : "+this.getType().getShortName()}static findParentItemViewAsHTMLElement(htmlElement){let parentHTMLElement=htmlElement.parentElement,parseItemId=ItemView.parseItemId(parentHTMLElement);for(;parseItemId==null;)parentHTMLElement=parentHTMLElement.parentElement,parseItemId=ItemView.parseItemId(parentHTMLElement);return parentHTMLElement}onMouseOverView(listener){this.mouseOverViewListeners.push(listener)}unMouseOverView(listener){this.mouseOverViewListeners=this.mouseOverViewListeners.filter(current=>current!==listener)}notifyMouseOverView(){this.mouseOverViewListeners.forEach(listener=>listener())}onMouseLeaveView(listener){this.mouseOutViewListeners.push(listener)}unMouseLeaveView(listener){this.mouseOutViewListeners=this.mouseOutViewListeners.filter(current=>current!==listener)}notifyMouseLeaveView(){this.mouseOutViewListeners.forEach(listener=>listener())}getContextMenuTitle(){return this.contextMenuTitle}addComponentView(_componentView,_index,_newlyCreated=!1){throw new Error("Must be implemented by inheritors")}getNewItemIndex(){throw new Error("Must be implemented by inheritors")}createView(type,config){if(!config){const regionView=this.getRegionView();config=new CreateItemViewConfig().setParentView(regionView).setParentElement(regionView).setLiveEditParams(regionView.getLiveEditParams())}return this.itemViewFactory.createView(type,config)}getInsertActions(){const isFragmentContent=this.liveEditParams.isFragment,actions=[this.createInsertSubAction("part",PartItemType.get())];return this.getRegionView().getType().equals(RegionItemType.get())&&!this.getRegionView().hasParentLayoutComponentView()&&!isFragmentContent&&actions.push(this.createInsertSubAction("layout",LayoutItemType.get())),actions.push(this.createInsertSubAction("text",TextItemType.get())),actions.push(this.createInsertSubAction("fragment",FragmentItemType.get())),actions}hasParentLayoutComponentView(){const parentView=this.getParentItemView();return!!parentView&&parentView.getType().equals(LayoutItemType.get())}getRegionView(){return this.getParentItemView()}isLayout(){return LayoutItemType.get().equals(this.getType())}isPart(){return PartItemType.get().equals(this.getType())}isText(){return TextItemType.get().equals(this.getType())}getPageView(){let itemView=this;for(;!PageItemType.get().equals(itemView.getType());)itemView=itemView.getParentItemView();return itemView}createInsertAction(){return new Action(i18n("widget.components.insert")).setChildActions(this.getInsertActions()).setVisible(!1)}createSelectParentAction(){const action=new Action(i18n("live.view.selectparent"));return action.setSortOrder(0),action.onExecuted(()=>{const parentView=this.getParentItemView();parentView&&this.selectItemView(parentView)}),action}selectItemView(itemView){this.deselect();const config={path:itemView.getPath(),position:null,newlyCreated:!1,rightClicked:!0};itemView.select(config,ItemViewContextMenuPosition.TOP),itemView.scrollComponentIntoView()}createInsertSubAction(label,componentItemType){const action=new Action(i18n("field."+label)).onExecuted(()=>{new AddComponentEvent(this.makeInsertPathForNewItem(),componentItemType.toComponentType()).fire()});return action.setVisible(!1).setIconClass(StyleHelper$1.getCommonIconCls(label)),action}makeInsertPathForNewItem(){return this.getType()instanceof RegionItemType?new ComponentPath(this.getNewItemIndex(),this.getPath()):new ComponentPath(this.getNewItemIndex(),this.getPath().getParentPath())}isChildOfItemView(itemView){if(this===itemView)return!1;let parentItemView=this.getParentItemView(),result=!1;for(;parentItemView&&!result;)result=parentItemView===itemView,parentItemView=parentItemView.getParentItemView();return result}isContainer(){return this.isDraggableView()||this.isLayout()}isViewInsideSelectedContainer(){return SelectedHighlighter.get().isViewInsideSelectedContainer(this)}}class RegionViewContextMenuTitle extends ItemViewContextMenuTitle{static{__name(this,"RegionViewContextMenuTitle")}constructor(name){super(name,RegionItemType.get().getConfig().getIconCls())}}class RegionPlaceholder extends ItemViewPlaceholder{static{__name(this,"RegionPlaceholder")}constructor(){super(),this.addClassEx("region-placeholder");const dragComponentsHereEl=new PEl;dragComponentsHereEl.setHtml(i18n("live.view.drag.drophere")),this.appendChild(dragComponentsHereEl)}}class ItemViewAddedEvent{static{__name(this,"ItemViewAddedEvent")}constructor(view,newlyCreated=!1){this.view=view,this.newlyCreated=newlyCreated}getView(){return this.view}isNewlyCreated(){return this.newlyCreated}}class ItemViewRemovedEvent{static{__name(this,"ItemViewRemovedEvent")}constructor(view){this.view=view}getView(){return this.view}}class ComponentViewContextMenuTitle extends ItemViewContextMenuTitle{static{__name(this,"ComponentViewContextMenuTitle")}constructor(name,type){super(name||"",type.getConfig().getIconCls())}}class ComponentInspectedEvent extends IframeEvent{static{__name(this,"ComponentInspectedEvent")}constructor(path){super(),this.path=path}getComponentPath(){return this.path}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class CreateFragmentEvent extends IframeEvent{static{__name(this,"CreateFragmentEvent")}constructor(path){super(),this.path=path}getComponentPath(){return this.path}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class RemoveComponentRequest extends IframeEvent{static{__name(this,"RemoveComponentRequest")}constructor(path){super(),this.path=path}getComponentPath(){return this.path}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class DuplicateComponentEvent extends IframeEvent{static{__name(this,"DuplicateComponentEvent")}constructor(path){super(),this.path=path}getComponentPath(){return this.path}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class ResetComponentEvent extends IframeEvent{static{__name(this,"ResetComponentEvent")}constructor(path){super(),this.path=path}getComponentPath(){return this.path}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class ComponentViewBuilder{static{__name(this,"ComponentViewBuilder")}itemViewIdProducer;itemViewFactory;type;parentRegionView;parentElement;element;positionIndex=-1;contextMenuActions;placeholder;inspectActionRequired;liveEditParams;setItemViewIdProducer(value){return this.itemViewIdProducer=value,this}setItemViewFactory(value){return this.itemViewFactory=value,this}setType(value){return this.type=value,this}setParentRegionView(value){return this.parentRegionView=value,this}setParentElement(value){return this.parentElement=value,this}setElement(value){return this.element=value,this}setPositionIndex(value){return this.positionIndex=value,this}setContextMenuActions(actions){return this.contextMenuActions=actions,this}setPlaceholder(value){return this.placeholder=value,this}setInspectActionRequired(value){return this.inspectActionRequired=value,this}setLiveEditParams(value){return this.liveEditParams=value,this}}class ComponentView extends ItemView{static{__name(this,"ComponentView")}empty;moving=!1;itemViewAddedListeners=[];itemViewRemovedListeners=[];initOnAdd=!0;resetAction;static debug=!1;keyBinding;constructor(builder){super(new ItemViewBuilder().setItemViewIdProducer(builder.itemViewIdProducer?builder.itemViewIdProducer:builder.parentRegionView.getItemViewIdProducer()).setItemViewFactory(builder.itemViewFactory?builder.itemViewFactory:builder.parentRegionView.getItemViewFactory()).setPlaceholder(builder.placeholder).setType(builder.type).setElement(builder.element).setParentView(builder.parentRegionView).setParentElement(builder.parentElement).setLiveEditParams(builder.liveEditParams).setContextMenuTitle(new ComponentViewContextMenuTitle(builder.type?.getShortName(),builder.type))),this.getParentItemView()&&builder.positionIndex>=0&&this.getParentItemView().registerComponentViewInParent(this,builder.positionIndex),this.empty=StringHelper.isEmpty(builder.element?.getHtml())||this.getChildren().length===1&&this.getChildren()[0]===this.placeholder,this.initListeners(),this.addComponentContextMenuActions(builder.inspectActionRequired),this.initKeyBoardBindings(),this.refreshEmptyState()}initListeners(){}refreshEmptyState(){return this.resetAction.setVisible(!this.isEmpty()),super.refreshEmptyState()}addComponentContextMenuActions(inspectActionRequired){const isFragmentContent=this.getLiveEditParams().isFragment,isTopFragmentComponent=this.getParentItemView().getType().equals(PageItemType.get())&&isFragmentContent,actions=[];isTopFragmentComponent||(actions.push(this.createSelectParentAction()),actions.push(this.createInsertAction())),inspectActionRequired&&actions.push(new Action(i18n("live.view.inspect")).onExecuted(()=>{new ComponentInspectedEvent(this.getPath()).fire()})),this.resetAction=new Action(i18n("live.view.reset")).onExecuted(()=>{new ResetComponentEvent(this.getPath()).fire()}),actions.push(this.resetAction),isTopFragmentComponent||(actions.push(new Action(i18n("live.view.remove")).onExecuted(()=>{new RemoveComponentRequest(this.getPath()).fire()})),actions.push(new Action(i18n("live.view.duplicate")).onExecuted(()=>{this.deselect(),new DuplicateComponentEvent(this.getPath()).fire()}))),!this.getType().equals(FragmentItemType.get())&&this.getLiveEditParams().isFragmentAllowed&&actions.push(new Action(i18n("action.component.create.fragment")).onExecuted(()=>{this.deselect(),new CreateFragmentEvent(this.getPath()).fire()})),this.addContextMenuActions(actions)}initKeyBoardBindings(){const removeHandler=__name(()=>(new RemoveComponentRequest(this.getPath()).fire(),!0),"removeHandler");this.keyBinding=[new KeyBinding("del",removeHandler),new KeyBinding("backspace",removeHandler)]}select(config,menuPosition){super.select(config,menuPosition),KeyBindings.get().bindKeys(this.keyBinding)}deselect(silent){KeyBindings.get().unbindKeys(this.keyBinding),super.deselect(silent)}remove(){const parentView=this.getParentItemView();return parentView&&parentView.removeComponentView(this),super.remove(),this}getType(){return super.getType()}getName(){return this.getType().getShortName()}getParentItemView(){return super.getParentItemView()}setMoving(value){this.moving=value}isMoving(){return this.moving}getPath(){return this.getType()instanceof ComponentItemType&&this.getParentItemView().getType()instanceof PageItemType?ComponentPath.root():new ComponentPath(this.getParentItemView().getComponentViewIndex(this),this.getParentItemView().getPath())}clone(){const config=new CreateItemViewConfig().setParentView(this.getParentItemView()).setParentElement(this.getParentElement()).setLiveEditParams(this.getLiveEditParams());return this.createView(this.getType(),config)}makeDuplicateConfig(config){return(config||new CreateItemViewConfig).setParentView(this.getParentItemView()).setParentElement(this.getParentElement()).setLiveEditParams(this.getLiveEditParams())}duplicate(){const parentView=this.getParentItemView(),index=parentView.getComponentViewIndex(this),duplicateView=this.createView(this.getType(),this.makeDuplicateConfig());return duplicateView.skipInitOnAdd(),parentView.addComponentView(duplicateView,index+1),duplicateView}toString(){return super.toString()+" : "+this.getPath().toString()}replaceWith(replacement){if(ComponentView.debug,super.replaceWith(replacement),this.unbindMouseListeners(),this.isSelected()&&replacement.selectWithoutMenu(!0),PageItemType.get().equals(this.getParentItemView().getType())){const pageView=this.getPageView();pageView.unregisterFragmentComponentView(this),pageView.registerFragmentComponentView(replacement)}else{const index=this.getParentItemView().getComponentViewIndex(this),parentRegionView=this.getParentItemView();parentRegionView.unregisterComponentView(this),parentRegionView.registerComponentView(replacement,index),parentRegionView.notifyItemViewAdded(replacement)}}moveToRegion(toRegionView,toIndex){const parentRegionView=this.getParentItemView();if(ComponentView.debug,this.moving=!1,parentRegionView.getPath().equals(toRegionView.getPath())&&toIndex===parentRegionView.getComponentViewIndex(this)){ComponentView.debug;return}const parentView=this.getParentItemView();parentView&&parentView.removeComponentView(this),toRegionView.addComponentView(this,toIndex,!1,!0)}onItemViewAdded(listener){this.itemViewAddedListeners.push(listener)}unItemViewAdded(listener){this.itemViewAddedListeners=this.itemViewAddedListeners.filter(curr=>curr!==listener)}notifyItemViewAdded(view,isNew=!1){const event=new ItemViewAddedEvent(view,isNew);this.itemViewAddedListeners.forEach(listener=>{listener(event)})}onItemViewRemoved(listener){this.itemViewRemovedListeners.push(listener)}unItemViewRemoved(listener){this.itemViewRemovedListeners=this.itemViewRemovedListeners.filter(curr=>curr!==listener)}notifyItemViewRemoved(view){const event=new ItemViewRemovedEvent(view);this.itemViewRemovedListeners.forEach(listener=>{listener(event)})}getNewItemIndex(){return this.getParentItemView().getComponentViewIndex(this)+1}addComponentView(componentView,index){this.getParentItemView().addComponentView(componentView,index,!0)}getRegionView(){return super.getRegionView()}isEmpty(){return this.empty}reset(){this.empty=!0;const clone2=this.clone();this.replaceWith(clone2),clone2.select(),clone2.hideContextMenu()}skipInitOnAdd(){this.initOnAdd=!1}isDragging(){return DragAndDrop.get().isDragging()}}class RegionViewBuilder{static{__name(this,"RegionViewBuilder")}parentElement;parentView;element;name;liveEditParams;setParentElement(value){return this.parentElement=value,this}setParentView(value){return this.parentView=value,this}setElement(value){return this.element=value,this}setName(value){return this.name=value,this}setLiveEditParams(value){return this.liveEditParams=value,this}}class RegionView extends ItemView{static{__name(this,"RegionView")}componentViews;name;itemViewAddedListeners;itemViewRemovedListeners;itemViewAddedListener;itemViewRemovedListener;componentAddedListener;componentRemovedListener;mouseDownLastTarget;mouseOverListener;resetAction;textMode=!1;static debug=!1;constructor(builder){super(new ItemViewBuilder().setItemViewIdProducer(builder.parentView.getItemViewIdProducer()).setItemViewFactory(builder.parentView.getItemViewFactory()).setLiveEditParams(builder.liveEditParams||builder.parentView?.getLiveEditParams()).setType(RegionItemType.get()).setElement(builder.element).setPlaceholder(new RegionPlaceholder).setParentElement(builder.parentElement).setParentView(builder.parentView).setContextMenuTitle(new RegionViewContextMenuTitle(builder.name))),this.name=builder.name,this.addClassEx("region-view"),this.componentViews=[],this.itemViewAddedListeners=[],this.itemViewRemovedListeners=[],this.resetAction=new Action(i18n("live.view.reset")).onExecuted(()=>{this.deselect(),this.empty()}),this.initListeners(),this.addRegionContextMenuActions(),this.parseComponentViews(),this.refreshEmptyState()}initListeners(){this.itemViewAddedListener=event=>this.notifyItemViewAdded(event.getView(),event.isNewlyCreated()),this.itemViewRemovedListener=event=>{if(ObjectHelper.iFrameSafeInstanceOf(event.getView(),ComponentView)){const removedComponentView=event.getView(),childIndex=this.getComponentViewIndex(removedComponentView);childIndex>-1&&this.componentViews.splice(childIndex,1)}this.notifyItemViewRemoved(event.getView())},this.componentAddedListener=event=>{RegionView.debug,this.refreshEmptyState(),this.handleResetContextMenuAction()},this.componentRemovedListener=event=>{RegionView.debug,this.refreshEmptyState(),this.handleResetContextMenuAction()},this.onMouseDown(this.memorizeLastMouseDownTarget.bind(this)),this.mouseOverListener=e=>{this.isDragging()&&this.isElementOverRegion(e.target)&&this.highlight()},this.onMouseOver(this.mouseOverListener);const textEditModeListener=__name(value=>this.textMode=value,"textEditModeListener");PageViewController.get().onTextEditModeChanged(textEditModeListener),this.onRemoved(_event=>{PageViewController.get().unTextEditModeChanged(textEditModeListener)})}isElementOverRegion(element){for(;!element.hasAttribute("data-portal-region");)element=element.parentElement;return element===this.getHTMLElement()}memorizeLastMouseDownTarget(event){this.mouseDownLastTarget=event.target}addRegionContextMenuActions(){const actions=[];actions.push(this.createSelectParentAction()),actions.push(this.createInsertAction()),this.addContextMenuActions(actions),this.handleResetContextMenuAction()}handleResetContextMenuAction(){this.isEmpty()?this.removeContextMenuAction(this.resetAction):this.getContextMenuActions().indexOf(this.resetAction)===-1&&this.addContextMenuActions([this.resetAction])}getRegionName(){return this.getPath()?.getPath().toString()}getPath(){return new ComponentPath(this.name,this.getParentItemView()?.getPath())}getName(){return this.getRegionName()?this.getRegionName().toString():i18n("live.view.itemview.noname")}highlightSelected(){!this.textMode&&!this.isDragging()&&super.highlightSelected()}showCursor(){this.textMode||super.showCursor()}select(config,menuPosition){config&&(config.rightClicked=!1),super.select(config,menuPosition)}toString(){let extra="";return this.getPath()&&(extra=" : "+this.getPath().toString()),super.toString()+extra}registerComponentView(componentView,index){this.componentViews.indexOf(componentView)===-1&&(this.registerComponentViewInParent(componentView,index),this.registerComponentViewListeners(componentView))}registerComponentViewInParent(componentView,index){RegionView.debug,index>=0?this.componentViews.splice(index,0,componentView):this.componentViews.push(componentView)}registerComponentViewListeners(componentView){componentView.setParentItemView(this),componentView.onItemViewAdded(this.itemViewAddedListener),componentView.onItemViewRemoved(this.itemViewRemovedListener)}unregisterComponentView(componentView){RegionView.debug;const indexToRemove=this.getComponentViewIndex(componentView);if(indexToRemove>=0)componentView.unItemViewAdded(this.itemViewAddedListener),componentView.unItemViewRemoved(this.itemViewRemovedListener),this.componentViews.splice(indexToRemove,1),componentView.setParentItemView(null),this.notifyItemViewRemoved(componentView);else throw new Error("Did not find ComponentView to remove: "+componentView.getItemId().toString())}getNewItemIndex(){return 0}addComponentView(componentView,index,newlyCreated=!1,_dragged){RegionView.debug,this.insertChild(componentView,index),this.registerComponentView(componentView,index),this.notifyItemViewAdded(componentView,newlyCreated),this.refreshEmptyState()}removeComponentView(componentView,silent=!1){RegionView.debug,this.unregisterComponentView(componentView),silent||this.removeChild(componentView),this.refreshEmptyState()}getComponentViews(){return this.componentViews}getComponentViewIndex(view){return this.componentViews.indexOf(view)}getComponentViewByPath(path){let result=null;return this.componentViews.some(componentView=>(path.equals(componentView.getPath())?result=componentView:componentView.isLayout()&&(result=componentView.getComponentViewByPath(path)),!!result)),result}hasOnlyMovingComponentViews(){return this.componentViews.length>0&&this.componentViews.every(view=>view.isMoving())}isEmpty(){const onlyMoving=this.hasOnlyMovingComponentViews();return!this.componentViews?.length||onlyMoving}empty(){for(RegionView.debug;this.componentViews.length>0;)this.removeComponentView(this.componentViews[0])}getPageView(){return super.getPageView()}remove(){return this.unMouseOver(this.mouseOverListener),super.remove(),this}toItemViewArray(){let array=[];return array.push(this),this.componentViews.forEach(componentView=>{const itemViews=componentView.toItemViewArray();array=array.concat(itemViews)}),array}onItemViewAdded(listener){this.itemViewAddedListeners.push(listener)}unItemViewAdded(listener){this.itemViewAddedListeners=this.itemViewAddedListeners.filter(curr=>curr!==listener)}notifyItemViewAdded(itemView,newlyCreated=!1){const event=new ItemViewAddedEvent(itemView,newlyCreated);this.itemViewAddedListeners.forEach(listener=>{listener(event)})}onItemViewRemoved(listener){this.itemViewRemovedListeners.push(listener)}unItemViewRemoved(listener){this.itemViewRemovedListeners=this.itemViewRemovedListeners.filter(curr=>curr!==listener)}getRegionView(){return this}notifyItemViewRemoved(itemView){const event=new ItemViewRemovedEvent(itemView);this.itemViewRemovedListeners.forEach(listener=>{listener(event)})}parseComponentViews(){this.componentViews.forEach(componentView=>{this.unregisterComponentView(componentView)}),this.componentViews=[],this.doParseComponentViews()}doParseComponentViews(parentElement){(parentElement?parentElement.getChildren():this.getChildren()).forEach(childElement=>{const itemType=ItemType.fromElement(childElement),isComponentView=ObjectHelper.iFrameSafeInstanceOf(childElement,ComponentView);let componentView;isComponentView||(itemType?(assert(itemType.isComponentType(),"Expected ItemView beneath a Region to be a Component: "+itemType.getShortName()),componentView=this.createView(itemType,new CreateItemViewConfig().setParentView(this).setElement(childElement).setLiveEditParams(this.liveEditParams).setPositionIndex(this.getComponentViews().length).setParentElement(parentElement||this)),this.registerComponentViewListeners(componentView)):this.doParseComponentViews(childElement))})}isDragging(){return DragAndDrop.get().isDragging()}}class PageViewContextMenuTitle extends ItemViewContextMenuTitle{static{__name(this,"PageViewContextMenuTitle")}constructor(displayName){super(displayName||NamePrettyfier.prettifyUnnamed(),PageItemType.get().getConfig().getIconCls())}}class BaseItem{static{__name(this,"BaseItem")}constructor(builder){this.id=builder.id,this.createdTime=builder.createdTime,this.modifiedTime=builder.modifiedTime,this.deletable=builder.deletable,this.editable=builder.editable}getId(){return this.id}getCreatedTime(){return this.createdTime}getModifiedTime(){return this.modifiedTime}isDeletable(){return this.deletable}isEditable(){return this.editable}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,BaseItem))return!1;let other=o;return!(!ObjectHelper.stringEquals(this.id,other.id)||!ObjectHelper.dateEquals(this.createdTime,other.createdTime)||!ObjectHelper.dateEquals(this.modifiedTime,other.modifiedTime)||!ObjectHelper.booleanEquals(this.deletable,other.deletable)||!ObjectHelper.booleanEquals(this.editable,other.editable))}}class BaseItemBuilder{static{__name(this,"BaseItemBuilder")}constructor(source){source&&(this.id=source.getId(),this.createdTime=source.getCreatedTime(),this.modifiedTime=source.getModifiedTime(),this.deletable=source.isDeletable(),this.editable=source.isEditable())}fromBaseItemJson(json,idProperty="id"){return this.id=json[idProperty],this.createdTime=json.createdTime?new Date(json.createdTime):null,this.modifiedTime=json.modifiedTime?new Date(json.modifiedTime):null,this.deletable=json.deletable,this.editable=json.editable,this}build(){return new BaseItem(this)}}class Schema extends BaseItem{static{__name(this,"Schema")}constructor(builder){super(builder),this.name=builder.name,this.displayName=builder.displayName,this.description=builder.description,this.iconUrl=builder.iconUrl}static fromJson(json){return new SchemaBuilder().fromSchemaJson(json).build()}getName(){return this.name}getDisplayName(){return this.displayName}getDescription(){return this.description}getIconUrl(){return this.iconUrl}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,Schema)||!super.equals(o))return!1;let other=o;return!(!ObjectHelper.stringEquals(this.name,other.name)||!ObjectHelper.stringEquals(this.displayName,other.displayName)||!ObjectHelper.stringEquals(this.iconUrl,other.iconUrl))}}class SchemaBuilder extends BaseItemBuilder{static{__name(this,"SchemaBuilder")}constructor(source){super(source),source&&(this.name=source.getName(),this.displayName=source.getDisplayName(),this.description=source.getDescription(),this.iconUrl=source.getIconUrl())}fromSchemaJson(json){return super.fromBaseItemJson(json,"name"),this.name=json.name,this.displayName=json.displayName,this.description=json.description,this.iconUrl=json.iconUrl,this}setName(value){return this.name=value,this}setDisplayName(value){return this.displayName=value,this}build(){return new Schema(this)}}class ContentTypeSummary extends Schema{static{__name(this,"ContentTypeSummary")}constructor(builder){super(builder),this.allowChildContent=builder.allowChildContent,this.final=builder.final,this.abstract=builder.abstract,this.superType=builder.superType,this.displayNameExpression=builder.displayNameExpression,this.owner=builder.owner,this.modifier=builder.modifier,this.displayNameLabel=builder.displayNameLabel,this.allowedChildContentTypes=builder.allowedChildContentTypes}static fromJsonArray(jsonArray){let array=[];return jsonArray.forEach(summaryJson=>{array.push(ContentTypeSummary.fromJson(summaryJson))}),array}static fromJson(json){return new ContentTypeSummaryBuilder().fromContentTypeSummaryJson(json).build()}getContentTypeName(){return new ContentTypeName(this.getName())}isSite(){return this.getContentTypeName().isSite()}isPageTemplate(){return this.getContentTypeName().isPageTemplate()}isImage(){return this.getContentTypeName().isImage()}isShortcut(){return this.getContentTypeName().isShortcut()}isUnstructured(){return this.getContentTypeName().isUnstructured()}isFinal(){return this.final}isAbstract(){return this.abstract}isAllowChildContent(){return this.allowChildContent}getSuperType(){return this.superType}hasDisplayNameExpression(){return!StringHelper.isBlank(this.displayNameExpression)}getDisplayNameExpression(){return this.displayNameExpression}getDisplayNameLabel(){return this.displayNameLabel}getOwner(){return this.owner}getModifier(){return this.modifier}getAllowedChildContentTypes(){return this.allowedChildContentTypes}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ContentTypeSummary)||!super.equals(o))return!1;let other=o;return!(!ObjectHelper.booleanEquals(this.allowChildContent,other.allowChildContent)||!ObjectHelper.booleanEquals(this.abstract,other.abstract)||!ObjectHelper.equals(this.superType,other.superType)||!ObjectHelper.stringEquals(this.displayNameExpression,other.displayNameExpression)||!ObjectHelper.stringEquals(this.displayNameLabel,other.displayNameLabel)||!ObjectHelper.stringEquals(this.modifier,other.modifier)||!ObjectHelper.stringEquals(this.owner,other.owner))}}class ContentTypeSummaryBuilder extends SchemaBuilder{static{__name(this,"ContentTypeSummaryBuilder")}constructor(source){super(source),source&&(this.allowChildContent=source.isAllowChildContent(),this.abstract=source.isAbstract(),this.final=source.isFinal(),this.superType=source.getSuperType(),this.displayNameExpression=source.getDisplayNameExpression(),this.displayNameLabel=source.getDisplayNameLabel(),this.modifier=source.getModifier(),this.owner=source.getOwner(),this.allowedChildContentTypes=source.getAllowedChildContentTypes())}fromContentTypeSummaryJson(json){return super.fromSchemaJson(json),this.allowChildContent=json.allowChildContent,this.final=json.final,this.abstract=json.abstract,this.superType=json.superType?new ContentTypeName(json.superType):null,this.displayNameExpression=json.displayNameExpression,this.displayNameLabel=json.displayNameLabel,this.owner=json.owner,this.modifier=json.modifier,this.allowedChildContentTypes=json.allowChildContentType,this}build(){return new ContentTypeSummary(this)}}class ContentType extends ContentTypeSummary{static{__name(this,"ContentType")}constructor(builder){super(builder),this.form=builder.form}getForm(){return this.form}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ContentType)||!super.equals(o))return!1;const other=o;return!!ObjectHelper.equals(this.form,other.form)}static fromJson(json){return new ContentTypeBuilder().fromContentTypeJson(json).build()}}class ContentTypeBuilder extends ContentTypeSummaryBuilder{static{__name(this,"ContentTypeBuilder")}constructor(source){super(source),source&&(this.form=source.getForm())}fromContentTypeJson(json){return super.fromContentTypeSummaryJson(json),this.form=Form.fromJson(json.form),this}setForm(value){return this.form=value,this}build(){return new ContentType(this)}}class PagePlaceholderInfoBlock extends DivEl{static{__name(this,"PagePlaceholderInfoBlock")}line1;line2;constructor(contentType){super("page-placeholder-info"),this.line1=new DivEl("page-placeholder-info-line1"),this.line2=new DivEl("page-placeholder-info-line2"),this.appendChildren(this.line1,this.line2),contentType?this.setTextForContent(contentType.getDisplayName()):this.setEmptyText()}setTextForContent(contentTypeDisplayName){return this.toggleHeader(!0),this.line2.setHtml(i18n("text.notemplates",contentTypeDisplayName)),this}toggleHeader(hasControllers){return this.line1.setHtml(i18n(hasControllers?"text.selectcontroller":"text.nocontrollers")),this}setEmptyText(){return this.toggleHeader(!1),this.line2.setHtml(i18n("text.addapplications")),this}setErrorTexts(message,description){return this.line1.setHtml(message),this.line2.setHtml(description),this}}var ApplicationEventType;(function(ApplicationEventType2){ApplicationEventType2[ApplicationEventType2.INSTALLED=0]="INSTALLED",ApplicationEventType2[ApplicationEventType2.UNINSTALLED=1]="UNINSTALLED",ApplicationEventType2[ApplicationEventType2.RESOLVED=2]="RESOLVED",ApplicationEventType2[ApplicationEventType2.STARTING=3]="STARTING",ApplicationEventType2[ApplicationEventType2.STARTED=4]="STARTED",ApplicationEventType2[ApplicationEventType2.UPDATED=5]="UPDATED",ApplicationEventType2[ApplicationEventType2.STOPPING=6]="STOPPING",ApplicationEventType2[ApplicationEventType2.STOPPED=7]="STOPPED",ApplicationEventType2[ApplicationEventType2.UNRESOLVED=8]="UNRESOLVED",ApplicationEventType2[ApplicationEventType2.PROGRESS=9]="PROGRESS"})(ApplicationEventType||(ApplicationEventType={}));class ApplicationEvent extends Event$1{static{__name(this,"ApplicationEvent")}constructor(applicationKey,eventType,systemApplication,applicationUrl,progress){super(),this.applicationKey=applicationKey,this.applicationUrl=applicationUrl,this.systemApplication=systemApplication,this.eventType=eventType,this.progress=progress}static on(handler){Event$1.bind(ClassHelper.getFullName(this),handler)}static un(handler){Event$1.unbind(ClassHelper.getFullName(this),handler)}static fromJson(applicationEventJson){const applicationKey=applicationEventJson.data.applicationKey?ApplicationKey.fromString(applicationEventJson.data.applicationKey):null,eventType=ApplicationEventType[applicationEventJson.data.eventType],systemApplication=applicationEventJson.data.systemApplication,applicationUrl=applicationEventJson.data.applicationUrl,progress=applicationEventJson.data.progress;return new ApplicationEvent(applicationKey,eventType,systemApplication,applicationUrl,progress)}getApplicationKey(){return this.applicationKey}getEventType(){return this.eventType}getApplicationUrl(){return this.applicationUrl}getProgress(){return this.progress}isSystemApplication(){return this.systemApplication}isNeedToUpdateApplication(){return ApplicationEventType.RESOLVED!==this.eventType&&ApplicationEventType.STARTING!==this.eventType&&ApplicationEventType.UNRESOLVED!==this.eventType&&ApplicationEventType.STOPPING!==this.eventType}}class Cache{static{__name(this,"Cache")}constructor(){this.objectsByKey={},this.loading=[],this.loadedListeners=[]}getAll(){let all=[];for(let key in this.objectsByKey)this.objectsByKey.hasOwnProperty(key)&&all.push(this.objectsByKey[key]);return all}copy(_object){throw new Error("Must be implemented by inheritor")}getKeyFromObject(_object){throw new Error("Must be implemented by inheritor")}getKeyAsString(_object){throw new Error("Must be implemented by inheritor")}isOnLoading(key){return this.loading.indexOf(this.getKeyAsString(key))>=0}addToLoading(key){this.isOnLoading(key)||this.loading.push(this.getKeyAsString(key))}getOnLoaded(key){let deferred=Q.defer(),handler=__name((keyStr,value)=>{if(this.getKeyAsString(key)===keyStr)return this.unLoaded(handler),deferred.resolve(value)},"handler");return this.onLoaded(handler),deferred.promise}put(object){let copy=this.copy(object),keyAsString=this.getKeyAsString(this.getKeyFromObject(object));this.objectsByKey[keyAsString]=copy,this.loading.indexOf(keyAsString)>=0&&this.loading.splice(this.loading.indexOf(keyAsString),1),this.notifyLoaded(keyAsString,copy)}deleteByKey(key){let keyAsString=this.getKeyAsString(key);delete this.objectsByKey[keyAsString]}getByKey(key){let keyAsString=this.getKeyAsString(key),object=this.objectsByKey[keyAsString];return object?this.copy(object):null}notifyLoaded(keyStr,value){this.loadedListeners.forEach(listener=>{listener(keyStr,value)})}onLoaded(listener){return this.loadedListeners.push(listener),this}unLoaded(listener){return this.loadedListeners=this.loadedListeners.filter(curr=>curr!==listener),this}}class ContentTypeCache extends Cache{static{__name(this,"ContentTypeCache")}constructor(){super(),ApplicationEvent.on(event=>{(ApplicationEventType.STARTED===event.getEventType()||ApplicationEventType.STOPPED===event.getEventType()||ApplicationEventType.UPDATED===event.getEventType())&&this.getCachedByApplicationKey(event.getApplicationKey()).forEach(contentType=>{this.deleteByKey(this.getKeyFromObject(contentType))})})}copy(object){return new ContentTypeBuilder(object).build()}getKeyFromObject(object){return new ContentTypeName(object.getName())}getKeyAsString(key){return key.toString()}getCachedByApplicationKey(applicationKey){const result=[];return this.getAll().forEach(contentType=>{applicationKey.equals(this.getKeyFromObject(contentType).getApplicationKey())&&result.push(contentType)}),result}static get(){return ContentTypeCache.instance||(ContentTypeCache.instance=new ContentTypeCache),ContentTypeCache.instance}}class ContentTypeResourceRequest extends CmsResourceRequest{static{__name(this,"ContentTypeResourceRequest")}constructor(){super(),this.addRequestPathElements("schema",ContentResourceRequest.CONTENT_PATH)}fromJsonToContentType(json){return ContentType.fromJson(json)}fromJsonToContentTypeSummary(json){return ContentTypeSummary.fromJson(json)}}class GetContentTypeByNameRequest extends ContentTypeResourceRequest{static{__name(this,"GetContentTypeByNameRequest")}constructor(name){super(),this.inlineMixinsToFormItems=!0,this.name=name}getParams(){return{name:this.name.toString(),inlineMixinsToFormItems:this.inlineMixinsToFormItems}}sendAndParse(){const contentType=ContentTypeCache.get().getByKey(this.name);return contentType?Q(contentType):super.sendAndParse()}parseResponse(response){const contentType=this.fromJsonToContentType(response.getResult());return ContentTypeCache.get().put(contentType),contentType}}class DescriptorByDisplayNameComparator{static{__name(this,"DescriptorByDisplayNameComparator")}compare(a,b){let firstName,secondName;if(a)firstName=a.getDisplayName()||"";else return 1;if(b)secondName=b.getDisplayName()||"";else return-1;return firstName.localeCompare(secondName)}}class LoaderEvent{static{__name(this,"LoaderEvent")}constructor(postLoad){this.postLoad=postLoad}isPostLoad(){return this.postLoad}}class LoadedDataEvent extends LoaderEvent{static{__name(this,"LoadedDataEvent")}constructor(data,postLoad){super(postLoad),this.data=data}getData(){return this.data}}class LoaderErrorEvent extends LoaderEvent{static{__name(this,"LoaderErrorEvent")}constructor(statusCode,textStatus,postLoad=!1){super(postLoad),this.statusCode=statusCode,this.textStatus=textStatus}getStatusCode(){return this.statusCode}getTextStatus(){return this.textStatus}}class LoadingDataEvent extends LoaderEvent{static{__name(this,"LoadingDataEvent")}constructor(postLoad=!1){super(postLoad)}}var LoaderStatus;(function(LoaderStatus2){LoaderStatus2[LoaderStatus2.NOT_STARTED=0]="NOT_STARTED",LoaderStatus2[LoaderStatus2.LOADING=1]="LOADING",LoaderStatus2[LoaderStatus2.LOADED=2]="LOADED",LoaderStatus2[LoaderStatus2.PRE_LOADED=3]="PRE_LOADED"})(LoaderStatus||(LoaderStatus={}));class BaseLoader{static{__name(this,"BaseLoader")}constructor(request){this.status=LoaderStatus.NOT_STARTED,this.loadedDataListeners=[],this.loadingDataListeners=[],this.loaderErrorListeners=[],this.useDataPreLoad=!1,this.request=request||this.createRequest()}sendRequest(){return this.getRequest().sendAndParse()}load(postLoad=!1){return this.notifyLoadingData(postLoad),this.sendRequest().then(this.handleLoadSuccess.bind(this,postLoad)).catch(this.handleLoadError.bind(this,postLoad))}preLoad(searchString=""){this.notifyLoadingData(!1);let promise;return this.useDataPreLoad?promise=this.preLoadData(searchString):promise=this.sendPreLoadRequest(searchString),promise.then(this.handleLoadSuccess.bind(this,!1)).catch(this.handleLoadError.bind(this,!1)).finally(()=>this.status=LoaderStatus.PRE_LOADED)}isLoading(){return this.status===LoaderStatus.LOADING}isLoaded(){return this.status===LoaderStatus.LOADED}isNotStarted(){return this.status===LoaderStatus.NOT_STARTED}isPreLoaded(){return this.status===LoaderStatus.PRE_LOADED}setComparator(comparator){return this.comparator=comparator,this}search(searchString){this.setSearchString(searchString);const searchResults=this.results?this.results.filter(this.filterFn,this):[];return ObjectHelper.anyArrayEquals(searchResults,this.filteredResults)||this.notifyLoadedData(searchResults),Q(searchResults)}getResults(){return this.results}setResults(results){this.results=results}getComparator(){return this.comparator}setSearchString(value){this.searchString=value}getSearchString(){return this.searchString}filterFn(_result){throw Error("must be implemented")}notifyLoadedData(results,postLoad,silent=!1){if(this.filteredResults=results,this.status=LoaderStatus.LOADED,!silent){const evt=new LoadedDataEvent(results,postLoad);this.loadedDataListeners.reduce((prev,curr)=>Q.when(prev,()=>curr(evt)),Q(null)).catch(this.handleLoadError.bind(this,!1))}}notifyLoadingData(postLoad,silent=!1){this.status=LoaderStatus.LOADING,silent||this.loadingDataListeners.forEach(listener=>{listener.call(this,new LoadingDataEvent(postLoad))})}onLoadedData(listener){this.loadedDataListeners.push(listener)}onLoadingData(listener){this.loadingDataListeners.push(listener)}unLoadedData(listener){this.loadedDataListeners=this.loadedDataListeners.filter(currentListener=>currentListener!==listener)}unLoadingData(listener){this.loadingDataListeners=this.loadingDataListeners.filter(currentListener=>currentListener!==listener)}onErrorOccurred(listener){this.loaderErrorListeners.push(listener)}unErrorOccurred(listener){this.loaderErrorListeners=this.loaderErrorListeners.filter(curr=>curr!==listener)}notifyErrorOccurred(statusCode,textStatus,postLoad){let error=new LoaderErrorEvent(statusCode,textStatus,postLoad);this.loaderErrorListeners.forEach(listener=>{listener(error)})}setUseDataPreLoad(bool){return this.useDataPreLoad=bool,this}preLoadData(searchString){throw new Error("Must be implemented in deriving classes!")}createRequest(){throw new Error("Must be implemented in deriving classes!")}getRequest(){return this.request}sendPreLoadRequest(_searchString){return this.sendRequest()}handleLoadSuccess(postLoad=!1,results){if(this.results=results,this.comparator)try{this.results=results.sort(this.comparator.compare)}catch{}return this.notifyLoadedData(results,postLoad),results}handleLoadError(postLoad=!1,error){let isObj=typeof error=="object",textMessage=isObj?error.message||"Unknown error":String(error),statusCode=isObj&&error.statusCode?error.statusCode:500;return this.notifyErrorOccurred(statusCode,"Service error: "+textMessage,postLoad),[]}}class SchemaFilterBasedRequest extends CmsProjectBasedResourceRequest{static{__name(this,"SchemaFilterBasedRequest")}constructor(){super(),this.setContentRootPath(ContentPath.CONTENT_ROOT),this.addRequestPathElements("schema","filter")}getParams(){return{contentId:this.contentId?.toString()}}setContentId(contentId){return this.contentId=contentId,this}}class GetComponentDescriptorsRequest extends SchemaFilterBasedRequest{static{__name(this,"GetComponentDescriptorsRequest")}setComponentType(componentType){this.componentType=componentType,this.addRequestPathElements(`${componentType.getShortName()}s`)}parseResponse(response){return response.getResult().descriptors.map(descJson=>Descriptor.fromJson(descJson).setComponentType(this.componentType))}}class ComponentDescriptorsLoader extends BaseLoader{static{__name(this,"ComponentDescriptorsLoader")}constructor(){super(),this.setComparator(new DescriptorByDisplayNameComparator)}createRequest(){return new GetComponentDescriptorsRequest}setComponentType(componentType){return this.request.setComponentType(componentType),this}setContentId(contentId){return this.request.setContentId(contentId),this}filterFn(descriptor){return descriptor.getDisplayName().toString().toLowerCase().indexOf(this.getSearchString().toLowerCase())!==-1}}class DescriptorViewer extends NamesAndIconViewer{static{__name(this,"DescriptorViewer")}resolveDisplayName(object){return object.getDisplayName()}resolveSubName(object){return object.getDescription()||"<"+i18n("text.noDescription")+">"}resolveIconClass(object){const iconCls=object.getIconCls();return(iconCls?StyleHelper$1.getCommonIconCls(iconCls)+" ":"")+"icon-large"}resolveIconUrl(_object){return _object.getIcon()}}class DescriptorListBox extends ListBox{static{__name(this,"DescriptorListBox")}constructor(){super("common-page-list-box")}createItemView(item,readOnly){const viewer=new DescriptorViewer;return viewer.setObject(item),viewer}getItemId(item){return item.getKey().toString()}}class ComponentDescriptorsDropdown extends FilterableListBoxWrapper{static{__name(this,"ComponentDescriptorsDropdown")}constructor(){super(new DescriptorListBox,{maxSelected:1,className:"common-page-dropdown",filter:ComponentDescriptorsDropdown.filterFunction})}initElements(){super.initElements(),this.selectedViewer=new DescriptorViewer("selected-option"),this.loader=this.createLoader(),this.selectedViewer.hide()}initListeners(){super.initListeners(),this.loader.onLoadedData(event=>(this.listBox.setItems(event.getData()),null)),this.onSelectionChanged(selection=>{selection.selected?.length>0?(this.selectedViewer.setObject(selection.selected[0]),this.selectedViewer.show(),this.optionFilterInput.hide()):(this.selectedViewer.hide(),this.optionFilterInput.show())}),this.optionFilterInput.onClicked(()=>{this.optionFilterInput.hasFocus()||this.optionFilterInput.giveFocus()})}loadListOnShown(){this.loader.load().then(()=>{this.selectedDescriptor&&this.select(this.selectedDescriptor,!0)}).catch(DefaultErrorHandler.handle)}doShowDropdown(){super.doShowDropdown(),this.selectedViewer.hide(),this.optionFilterInput.show()}doHideDropdown(){super.doHideDropdown(),this.selectedDescriptor&&(this.selectedViewer.show(),this.optionFilterInput.hide())}handleUserToggleAction(item){const itemId=this.listBox.getIdOfItem(item);this.isSelected(itemId)||super.handleUserToggleAction(item)}setComponentType(componentType){return this.loader.setComponentType(componentType),this}setContentId(contentId){this.loader.setContentId(contentId)}load(){this.loader.isLoaded()&&this.loader.load()}reset(){this.setDescriptor(null)}hideDropdown(){super.hideDropdown()}createLoader(){return new ComponentDescriptorsLoader}setDescriptor(descriptor){this.selectedDescriptor=descriptor,this.hideDropdown(),this.deselectAll(!0),descriptor?(this.select(descriptor,!0),this.selectedViewer.setObject(descriptor),this.selectedViewer.show()):(this.selectedViewer.hide(),this.optionFilterInput.show())}getItemById(id){return this.selectedDescriptor?.getKey().toString()===id?this.selectedDescriptor:super.getItemById(id)}getDescriptorByKey(descriptorKey){return descriptorKey?this.getItemById(descriptorKey.toString()):null}getSelectedDescriptor(){return this.selectedDescriptor}doRender(){return super.doRender().then(rendered=>(this.filterContainer.appendChild(this.selectedViewer),rendered))}static filterFunction(item,searchString){return!StringHelper.isBlank(searchString)&&item.getDisplayName().toLowerCase().indexOf(searchString.toLowerCase())>=0||item.getName().toString().toLowerCase().indexOf(searchString.toLowerCase())>=0}}class PageDescriptorDropdown extends ComponentDescriptorsDropdown{static{__name(this,"PageDescriptorDropdown")}constructor(contentId){super(),this.setComponentType(PageComponentType.get()),contentId&&this.setContentId(contentId)}onLoadedData(listener){this.loader.onLoadedData(listener)}unLoadedData(listener){this.loader.unLoadedData(listener)}}class SelectPageDescriptorEvent extends IframeEvent{static{__name(this,"SelectPageDescriptorEvent")}constructor(descriptor){super(),this.descriptor=descriptor}getDescriptor(){return this.descriptor}static on(handler,contextWindow=window){Event$1.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){Event$1.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class PagePlaceholder extends ItemViewPlaceholder{static{__name(this,"PagePlaceholder")}pageDescriptorPlaceholder;infoBlock;controllerDropdown;pageView;constructor(pageView){super(),this.pageView=pageView,this.initElements(),this.initListeners(),this.controllerDropdown.hide(),this.controllerDropdown.load()}initListeners(){this.controllerDropdown.onLoadedData(this.dataLoadedHandler),this.controllerDropdown.onClicked(event=>{this.controllerDropdown.giveFocus(),event.stopPropagation()}),this.controllerDropdown.onSelectionChanged(selectionChange=>{if(selectionChange.selected?.length>0){const pageDescriptor=selectionChange.selected[0];new SelectPageDescriptorEvent(pageDescriptor.getKey().toString()).fire()}})}initElements(){this.infoBlock=new PagePlaceholderInfoBlock,this.controllerDropdown=new PageDescriptorDropdown(new ContentId(this.pageView.getLiveEditParams().contentId)),this.pageDescriptorPlaceholder=new DivEl("page-descriptor-placeholder",StyleHelper$1.getCurrentPrefix())}dataLoadedHandler=__name(event=>{if(event.getData().length>0){this.controllerDropdown.show();const type=new ContentTypeName(this.pageView.getLiveEditParams().contentType);if(type.isPageTemplate())this.infoBlock.toggleHeader(!0);else return new GetContentTypeByNameRequest(type).sendAndParse().then(contentType=>{this.infoBlock.setTextForContent(contentType.getDisplayName())}).catch(reason=>{this.infoBlock.setTextForContent(type.toString()),DefaultErrorHandler.handle(reason)});this.infoBlock.removeClass("empty")}else this.controllerDropdown.hide(),this.infoBlock.setEmptyText(),this.infoBlock.addClass("empty")},"dataLoadedHandler");remove(){return this.controllerDropdown.unLoadedData(this.dataLoadedHandler),super.remove()}doRender(){return super.doRender().then(rendered=>(this.addClassEx("page-placeholder"),this.addClass("icon-insert-template"),this.controllerDropdown.addClassEx("page-descriptor-dropdown"),this.pageDescriptorPlaceholder.appendChild(this.infoBlock),this.pageDescriptorPlaceholder.appendChild(this.controllerDropdown),this.appendChild(this.pageDescriptorPlaceholder),rendered))}}class IconUrlResolver{static{__name(this,"IconUrlResolver")}appendParam(paramName,paramValue,url){return url.indexOf("?")===-1?(url+="?"+paramName+"="+paramValue,url):url.charAt(url.length-1)==="?"?(url+=paramName+"="+paramValue,url):(url+="&"+paramName+"="+paramValue,url)}}class StyleHelper2{static{__name(this,"StyleHelper")}static{this.STYLE={ALIGNMENT:{JUSTIFY:{CLASS:"editor-align-justify",WIDTH:""},LEFT:{CLASS:"editor-align-left",WIDTH:"40"},CENTER:{CLASS:"editor-align-center",WIDTH:"60"},RIGHT:{CLASS:"editor-align-right",WIDTH:"40"}},WIDTH:{AUTO:"editor-width-auto",CUSTOM:"editor-width-custom"},PROCESSING:{ORIGINAL:"editor-style-original"}}}static isOriginalImage(style){return style.indexOf(StyleHelper2.STYLE.PROCESSING.ORIGINAL)>-1}static getAlignmentStyles(){return[StyleHelper2.STYLE.ALIGNMENT.JUSTIFY.CLASS,StyleHelper2.STYLE.ALIGNMENT.LEFT.CLASS,StyleHelper2.STYLE.ALIGNMENT.CENTER.CLASS,StyleHelper2.STYLE.ALIGNMENT.RIGHT.CLASS]}}class ImageUrlResolver extends IconUrlResolver{static{__name(this,"ImageUrlResolver")}static{this.URL_PREFIX_PREVIEW="content/image/"}static{this.URL_PREFIX_RENDER="image://"}static{this.URL_PREFIX_RENDER_ORIGINAL="media://"}static{this.DEFAULT_IMAGE_SIZE=768}constructor(contentRootPath,project){super(),this.source=!1,this.crop=!0,this.scaleWidth=!1,this.contentRootPath=contentRootPath||ContentResourceRequest.CONTENT_PATH,this.project=project}setContentId(value){return this.contentId=value,this}setSize(value){return this.size=Math.floor(value),this}setDefaultSize(){return this.size=ImageUrlResolver.DEFAULT_IMAGE_SIZE,this}setTimestamp(value){return this.timeStamp=value,this}disableCropping(){return this.crop=!1,this}disableProcessing(){return this.source=!0,this.scaleWidth=!1,this}setAspectRatio(value){return this.aspectRatio=value,this}setFilter(value){return this.filter=value,this}setScaleWidth(value){return this.scaleWidth=value,this}getBaseUrl(urlPrefix){return`${urlPrefix}${this.contentId.toString()}`}resolveForRender(styleName=""){const isOriginalImageStyle=StyleHelper2.isOriginalImage(styleName),urlPrefix=isOriginalImageStyle?ImageUrlResolver.URL_PREFIX_RENDER_ORIGINAL:ImageUrlResolver.URL_PREFIX_RENDER,url=this.getBaseUrl(urlPrefix);return isOriginalImageStyle||!styleName?url:`${url}?style=${styleName}`}resolveForPreview(){let url=this.getBaseUrl(UrlHelper.getCmsRestUri(`${UrlHelper.getCMSPath(this.contentRootPath,this.project)}/${ImageUrlResolver.URL_PREFIX_PREVIEW}`));return this.timeStamp&&(url=this.appendParam("ts",""+this.timeStamp.getTime(),url)),this.size&&(url=this.appendParam("size",""+Math.floor(this.size),url)),this.source&&(url=this.appendParam("source","true",url)),this.aspectRatio&&(url=this.appendParam("scale",this.aspectRatio,url)),this.filter&&(url=this.appendParam("filter",this.filter,url)),this.crop||(url=this.appendParam("crop","false",url)),this.scaleWidth&&(url=this.appendParam("scaleWidth","true",url)),url}}var StyleType;(function(StyleType2){StyleType2.IMAGE="image"})(StyleType||(StyleType={}));class Style{static{__name(this,"Style")}constructor(json){this.name=json.name,this.displayName=json.displayName,this.element=json.element,this.aspectRatio=json.aspectRatio,this.filter=json.filter}getName(){return this.name}getDisplayName(){return this.displayName}getAspectRatio(){return this.aspectRatio}getFilter(){return this.filter}static getEmpty(element){return new Style({name:"none",displayName:i18n("dialog.style.none"),element})}isEmpty(){return this.getName()==="none"}isForImage(){return this.element===StyleType.IMAGE.toString()}}class Styles{static{__name(this,"Styles")}static{this.INSTANCES={}}constructor(contentId,json){this.css=json.css,this.styles=(json.styles||[]).map(styleJson=>new Style(styleJson)),Styles.INSTANCES[contentId]=this}static getInstance(contentId){return Styles.INSTANCES[contentId]}static getCssPaths(contentId){return Styles.INSTANCES[contentId]?Styles.INSTANCES[contentId].css||[]:[]}static getAll(contentId){return Styles.INSTANCES[contentId]?Styles.INSTANCES[contentId].styles:[]}static getForImage(contentId){return Styles.INSTANCES[contentId]?Styles.INSTANCES[contentId].styles.filter(style=>style.isForImage()):[]}static getForImageAsString(contentId){return Styles.INSTANCES[contentId]?Styles.INSTANCES[contentId].styles.filter(style=>style.isForImage()).map(style=>style.getName()):[]}}class ProjectResourceRequest extends CmsResourceRequest{static{__name(this,"ProjectResourceRequest")}static{this.PROJECT_RESOURCE_PATH="project"}constructor(){super(),this.addRequestPathElements(ProjectResourceRequest.PROJECT_RESOURCE_PATH)}}class ProjectPermissions{static{__name(this,"ProjectPermissions")}constructor(builder){this.owners=[],this.contributors=[],this.editors=[],this.authors=[],this.owners=builder.owners,this.contributors=builder.contributors,this.editors=builder.editors,this.authors=builder.authors}getOwners(){return this.owners}getContributors(){return this.contributors}getEditors(){return this.editors}getAuthors(){return this.authors}isEmpty(){return this.owners.length+this.contributors.length+this.editors.length+this.authors.length===0}toJson(){return{contributor:this.contributors.map(key=>key.toString()),author:this.authors.map(key=>key.toString()),owner:this.owners.map(key=>key.toString()),editor:this.editors.map(key=>key.toString())}}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ProjectPermissions))return!1;const other=o,thisOwners=this.getOwners().map(owner=>owner.toString()).sort(),otherOwners=other.getOwners().map(owner=>owner.toString()).sort();if(!ObjectHelper.stringArrayEquals(thisOwners,otherOwners))return!1;const thisEditors=this.getEditors().map(editor=>editor.toString()).sort(),otherEditors=other.getEditors().map(editor=>editor.toString()).sort();if(!ObjectHelper.stringArrayEquals(thisEditors,otherEditors))return!1;const thisContributors=this.getContributors().map(contributor=>contributor.toString()).sort(),otherContributors=other.getContributors().map(contributor=>contributor.toString()).sort();if(!ObjectHelper.stringArrayEquals(thisContributors,otherContributors))return!1;const thisAuthors=this.getAuthors().map(author=>author.toString()).sort(),otherAuthors=other.getAuthors().map(author=>author.toString()).sort();return!!ObjectHelper.stringArrayEquals(thisAuthors,otherAuthors)}isOwner(principalKey){return this.owners.some(key=>key.equals(principalKey))}isEditor(principalKey){return this.editors.some(key=>key.equals(principalKey))}isContributor(principalKey){return this.contributors.some(key=>key.equals(principalKey))}isAuthor(principalKey){return this.authors.some(key=>key.equals(principalKey))}static fromJson(json){return json?new ProjectItemPermissionsBuilder().setContributors(json.contributor?json.contributor.map(PrincipalKey.fromString):[]).setEditors(json.editor?json.editor.map(PrincipalKey.fromString):[]).setOwners(json.owner?json.owner.map(PrincipalKey.fromString):[]).setAuthors(json.author?json.author.map(PrincipalKey.fromString):[]).build():new ProjectItemPermissionsBuilder().build()}}class ProjectItemPermissionsBuilder{static{__name(this,"ProjectItemPermissionsBuilder")}constructor(){this.owners=[],this.contributors=[],this.editors=[],this.authors=[]}setOwners(value){return this.owners=value,this}setContributors(value){return this.contributors=value,this}setEditors(value){return this.editors=value,this}setAuthors(value){return this.authors=value,this}build(){return new ProjectPermissions(this)}}var ProjectReadAccessType;(function(ProjectReadAccessType2){ProjectReadAccessType2.PRIVATE="private",ProjectReadAccessType2.PUBLIC="public",ProjectReadAccessType2.CUSTOM="custom"})(ProjectReadAccessType||(ProjectReadAccessType={}));class ProjectReadAccess{static{__name(this,"ProjectReadAccess")}constructor(type,principals=[]){this.type=type,this.principalsKeys=principals}getType(){return this.type}getPrincipalsKeys(){return this.principalsKeys.slice(0)}isPublic(){return this.type===ProjectReadAccessType.PUBLIC}isPrivate(){return this.type===ProjectReadAccessType.PRIVATE}isCustom(){return this.type===ProjectReadAccessType.CUSTOM}toJson(){return{type:this.type}}static fromJson(json){const projectType=json&&json.type?ProjectReadAccessType[json.type.toUpperCase()]:null;return projectType?projectType===ProjectReadAccessType.CUSTOM&&json.principals?new ProjectReadAccess(projectType,json.principals.map(PrincipalKey.fromString)):new ProjectReadAccess(projectType):new ProjectReadAccess(ProjectReadAccessType.PRIVATE)}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ProjectReadAccess))return!1;const other=o;return ObjectHelper.objectEquals(this.type,other.type)&&ObjectHelper.arrayEquals(this.principalsKeys,other.getPrincipalsKeys())}}class ApplicationConfigHelper{static{__name(this,"ApplicationConfigHelper")}static siteConfigJsonToAppConfig(json){const propertySet=PropertyTree.fromJson(json.config).getRoot();return ApplicationConfig.create().setApplicationKey(ApplicationKey.fromString(json.key)).setConfig(propertySet).build()}}class Project{static{__name(this,"Project")}constructor(builder){this.name=builder.name,this.displayName=builder.displayName,this.description=builder.description,this.parents=builder.parents,this.icon=builder.icon,this.permissions=builder.permissions,this.readAccess=builder.readAccess,this.language=builder.language,this.siteConfigs=builder.siteConfigs}static fromJson(json){return new ProjectBuilder().fromJson(json).build()}static create(){return new ProjectBuilder}getName(){return this.name}getDisplayName(){return this.displayName}getDescription(){return this.description}getIcon(){return this.icon}getPermissions(){return this.permissions}getReadAccess(){return this.readAccess}getLanguage(){return this.language}getParents(){return this.parents}hasParents(){return this.parents?.length>0}hasMainParentByName(projectName){return this.parents?.indexOf(projectName)===0}hasParentByName(projectName){return this.parents?.indexOf(projectName)>=0}getMainParent(){return this.getParents()?.[0]}getSiteConfigs(){return this.siteConfigs}toJson(){return{name:this.name,displayName:this.displayName,description:this.description,parents:this.parents,language:this.language,icon:this.icon?this.icon.toJson():null,permissions:this.permissions?this.permissions.toJson():null,readAccess:this.readAccess?this.readAccess.toJson():null,siteConfigs:this.siteConfigs?.map(config=>({key:config?.getApplicationKey().toString(),config:config?.getConfig().toJson()}))}}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,Project))return!1;const other=o;return ObjectHelper.objectEquals(this.name,other.name)&&ObjectHelper.objectEquals(this.displayName,other.displayName)&&ObjectHelper.objectEquals(this.description,other.description)&&ObjectHelper.objectEquals(this.icon,other.icon)&&ObjectHelper.objectEquals(this.language,other.language)&&ObjectHelper.equals(this.permissions,other.permissions)&&ObjectHelper.equals(this.readAccess,other.readAccess)&&ObjectHelper.arrayEquals(this.siteConfigs,other.siteConfigs)}}class ProjectBuilder{static{__name(this,"ProjectBuilder")}constructor(source){source&&(this.name=source.getName(),this.displayName=source.getDisplayName(),this.description=source.getDescription(),this.parents=source.getParents(),this.icon=source.getIcon(),this.permissions=source.getPermissions(),this.readAccess=source.getReadAccess(),this.language=source.getLanguage(),this.siteConfigs=source.getSiteConfigs()||[])}setName(value){return this.name=value,this}setDisplayName(value){return this.displayName=value,this}setDescription(value){return this.description=value,this}setParent(value){return this.parents=[value],this}setParents(value){return this.parents=value,this}setIcon(value){return this.icon=value,this}setPermissions(value){return this.permissions=value,this}setReadAccess(value){return this.readAccess=value,this}setLanguage(value){return this.language=value,this}setSiteConfigs(value){return this.siteConfigs=value,this}fromJson(json){return this.name=json.name,this.displayName=json.displayName,this.description=json.description||"",this.parents=json.parents,this.icon=json.icon?new AttachmentBuilder().fromJson(json.icon).build():null,this.permissions=ProjectPermissions.fromJson(json.permissions),this.readAccess=ProjectReadAccess.fromJson(json.readAccess),this.language=json.language,this.siteConfigs=json.siteConfigs?.map(configJson=>ApplicationConfigHelper.siteConfigJsonToAppConfig(configJson)),this}build(){return new Project(this)}}class ProjectGetRequest extends ProjectResourceRequest{static{__name(this,"ProjectGetRequest")}constructor(name){super(),this.name=name,this.addRequestPathElements("get")}getParams(){return{name:this.name}}parseResponse(response){return Project.fromJson(response.getResult())}}class ProjectHelper{static{__name(this,"ProjectHelper")}static isUserProjectOwnerOrEditor(){return new ProjectGetRequest(ProjectContext.get().getProject().getName()).sendAndParse().then(project=>Q(ProjectHelper.isProjectOwnerOrEditor(project)))}static isUserProjectOwner(project){return new ProjectGetRequest(project?.getName()||ProjectContext.get().getProject().getName()).sendAndParse().then(project2=>Q(ProjectHelper.isProjectOwner(project2)))}static isProjectOwnerOrEditor(project){if(ProjectHelper.isProjectOwner(project)||ProjectHelper.isProjectEditor(project))return!0;const userGroups=AuthContext.get().getPrincipals().filter(principal=>principal.isGroup()).map(principal=>principal.getKey()),permissions=project.getPermissions(),ownerGroups=permissions.getOwners().filter(principal=>principal.isGroup()),editorGroups=permissions.getEditors().filter(principal=>principal.isGroup());return userGroups.some(userPrincipal=>ownerGroups.some(owner=>owner.equals(userPrincipal))||editorGroups.some(editor=>editor.equals(userPrincipal)))}static isProjectOwner(project){const owners=project.getPermissions().getOwners(),thisUser=AuthContext.get().getUser().getKey();return owners.some(owner=>owner.equals(thisUser))}static isProjectEditor(project){const editors=project.getPermissions().getEditors(),thisUser=AuthContext.get().getUser().getKey();return editors.some(owner=>owner.equals(thisUser))}static fetchProject(name){return new ProjectGetRequest(name).sendAndParse().then(project=>project)}static sortProjects(item1,item2){return item1.getName().localeCompare(item2.getName())}static isAvailable(project){return!!project&&!!project.getDisplayName()}}class HtmlAreaSanitizer{static{__name(this,"HtmlAreaSanitizer")}sanitize(value){return value&&this.cleanTableFromUnwantedChars(this.replaceNonBreakingSpacesWithUnicode(value))}replaceNonBreakingSpacesWithUnicode(value){return value.replace(/(&nbsp;)+/g," ")}cleanTableFromUnwantedChars(value){return value.replace(/table border="1" cellpadding="1" cellspacing="1" style="width:100%"/g,"table").replace(/<table[^>]*?>[\s\S]*?<\/table>/g,match=>match.replace(/\n/g,"").replace(/\t/g,""))}}class HTMLAreaHelper{static{__name(this,"HTMLAreaHelper")}static getConvertedImageSrc(imgSrc,contentId,project){const imageId=HTMLAreaHelper.extractImageIdFromImgSrc(imgSrc),styleParameter="?style=",imageUrlResolver=new ImageUrlResolver(null,project).setContentId(new ContentId(imageId)).setTimestamp(new Date).setScaleWidth(!0);if(imgSrc.includes(ImageUrlResolver.URL_PREFIX_RENDER_ORIGINAL))imageUrlResolver.disableProcessing();else if(imageUrlResolver.setDefaultSize(),imgSrc.includes(styleParameter)){const styleName=imgSrc.split(styleParameter)[1],style=Styles.getForImage(contentId).find(s=>s.getName()===styleName);style&&imageUrlResolver.setFilter(style.getFilter()).setAspectRatio(style.getAspectRatio())}let imgUrl=imageUrlResolver.resolveForPreview();const src=imgSrc.replace(/&amp;/g,"&"),params=UriHelper.decodeUrlParams(src);return params.scale&&(imgUrl=UriHelper.appendUrlParams(imgUrl,{scale:params.scale},!1)),` src="${imgUrl}" data-src="${imgSrc}"`}static extractImageIdFromImgSrc(imgSrc){const prefix=imgSrc.includes(ImageUrlResolver.URL_PREFIX_RENDER)?ImageUrlResolver.URL_PREFIX_RENDER:ImageUrlResolver.URL_PREFIX_RENDER_ORIGINAL;return imgSrc.includes("?")?StringHelper.substringBetween(imgSrc,prefix,"?"):imgSrc.replace(prefix,StringHelper.EMPTY_STRING)}static convertRenderSrcToPreviewSrc(value,contentId,project){if(!value)return"";let processedContent=value;const regex=/<img.*?src="(.*?)"/g;let imgSrcs=regex.exec(processedContent);for(;imgSrcs;)imgSrcs.forEach(imgSrc=>{(imgSrc.indexOf(ImageUrlResolver.URL_PREFIX_RENDER)===0||imgSrc.indexOf(ImageUrlResolver.URL_PREFIX_RENDER_ORIGINAL)===0)&&(processedContent=processedContent.replace(` src="${imgSrc}"`,HTMLAreaHelper.getConvertedImageSrc(imgSrc,contentId,project)))}),imgSrcs=regex.exec(processedContent);return processedContent}static convertPreviewSrcToRenderSrc(editorContent){const regex=/<img.*?data-src="(.*?)".*?>/g;let processedContent=editorContent;return AppHelper.whileTruthy(()=>regex.exec(editorContent),imgTags=>{const imgTag=imgTags[0];if(imgTag.indexOf("<img ")===0&&(imgTag.includes(ImageUrlResolver.URL_PREFIX_RENDER)||imgTag.includes(ImageUrlResolver.URL_PREFIX_RENDER_ORIGINAL))){const dataSrc=/<img.*?data-src="(.*?)".*?>/.exec(imgTag)[1],src=/<img.*?\ssrc="(.*?)".*?>/.exec(imgTags[0])[1],convertedImg=imgTag.replace(src,dataSrc).replace(` data-src="${dataSrc}"`,StringHelper.EMPTY_STRING);processedContent=processedContent.replace(imgTag,convertedImg)}}),processedContent}static isSourceCodeEditable(){return HTMLAreaHelper.sourceCodeEditablePromise===void 0&&(HTMLAreaHelper.sourceCodeEditablePromise=HTMLAreaHelper.sendIsCodeEditableRequest()),HTMLAreaHelper.sourceCodeEditablePromise}static sendIsCodeEditableRequest(){return AuthHelper.isContentExpert()?Q(!0):ProjectHelper.isUserProjectOwnerOrEditor().catch(reason=>(DefaultErrorHandler.handle(reason),Q(!1)))}static sanitize(value){return new HtmlAreaSanitizer().sanitize(value)}static getAllowedUriRegexp(){return/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|content|media|image):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i}static isNbsp(value){return value===" "}}class CreateTextComponentViewConfig extends CreateItemViewConfig{static{__name(this,"CreateTextComponentViewConfig")}text;constructor(){super()}setText(value){return this.text=value,this}}class TextPlaceholder extends ItemViewPlaceholder{static{__name(this,"TextPlaceholder")}constructor(){super(),this.addClass("icon-font-size"),this.addClassEx("text-placeholder")}}class EditTextComponentViewEvent extends IframeEvent{static{__name(this,"EditTextComponentViewEvent")}constructor(path){super(),this.path=path}getPath(){return this.path}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class TextComponentViewBuilder extends ComponentViewBuilder{static{__name(this,"TextComponentViewBuilder")}text;constructor(){super(),this.setType(TextItemType.get())}setText(value){return this.text=value,this}}class TextComponentView extends ComponentView{static{__name(this,"TextComponentView")}value;static debug=!1;static DEFAULT_TEXT="";editAction;static DBL_CLICK_TIMEOUT=250;singleClickTimer;lastClicked=0;constructor(builder){super(builder.setPlaceholder(new TextPlaceholder));const normalizedValue=this.normalizeInitialValue(builder.text);this.setText(normalizedValue),this.editAction=new Action(i18n("action.edit")).onExecuted(()=>{new EditTextComponentViewEvent(this.getPath()).fire()}),this.addClassEx("text-view"),this.setTextDir(),this.addEditActionToMenu(this.editAction)}addEditActionToMenu(editAction){this.isEmpty()||this.addContextMenuActions([editAction])}normalizeInitialValue(initialText){return ObjectHelper.isDefined(initialText)?initialText:!PageState.getState()||PageState.getState().hasTemplate()?this.getEl().getInnerHtml():this.liveEditParams.getTextComponentData(this.getPath().toString())}setTextDir(){this.getLangDirection()===LangDirection.RTL&&this.setDir(LangDirection.RTL)}refreshEmptyState(){return this.editAction?.setVisible(!this.isEmpty()),super.refreshEmptyState()}highlight(){this.isDragging()||super.highlight()}getText(){return this.value}setText(text2){this.value=text2;let processedText;StringHelper.isBlank(text2)?processedText="":processedText=HTMLAreaHelper.convertRenderSrcToPreviewSrc(text2,this.getLiveEditParams().contentId),this.setHtml(processedText,!1),this.refreshEmptyState()}isEmpty(){return StringHelper.isBlank(this.value)}getLangDirection(){const lang=this.getLiveEditParams().language;return Locale.supportsRtl(lang)?LangDirection.RTL:LangDirection.AUTO}reset(){this.setText(TextComponentView.DEFAULT_TEXT),this.hideContextMenu()}makeDuplicateConfig(){return super.makeDuplicateConfig(new CreateTextComponentViewConfig().setText(this.getText()))}doHandleDbClick(_event){this.isSelected()||this.selectWithoutMenu(),new EditTextComponentViewEvent(this.getPath()).fire()}doHandleClick(event){super.handleClick(event)}handleClick(event){event.stopPropagation(),event.button===2&&event.preventDefault(),new Date().getTime()-this.lastClicked>TextComponentView.DBL_CLICK_TIMEOUT?this.singleClickTimer=window.setTimeout(()=>{this.doHandleClick(event)},TextComponentView.DBL_CLICK_TIMEOUT):(clearTimeout(this.singleClickTimer),this.doHandleDbClick(event)),this.lastClicked=new Date().getTime()}}class PageLockedEvent extends IframeEvent{static{__name(this,"PageLockedEvent")}constructor(){super()}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class PageUnlockedEvent extends IframeEvent{static{__name(this,"PageUnlockedEvent")}constructor(){super()}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class DescriptorBasedComponentViewPlaceholder extends ItemViewPlaceholder{static{__name(this,"DescriptorBasedComponentViewPlaceholder")}}class LayoutPlaceholder extends DescriptorBasedComponentViewPlaceholder{static{__name(this,"LayoutPlaceholder")}constructor(){super(),this.addClassEx("layout-placeholder").addClass(StyleHelper$1.getCommonIconCls("layout"))}getType(){return LayoutComponentType.get()}}class DescriptorBasedComponentView extends ComponentView{static{__name(this,"DescriptorBasedComponentView")}static HAS_DESCRIPTOR_CLASS="has-descriptor";emptyDescriptorBlock;inspectActionRequired;constructor(builder){super(builder),this.inspectActionRequired=builder.inspectActionRequired}refreshEmptyState(){super.refreshEmptyState();const component=this.getComponent(),hasDescriptor=!!component?.hasDescriptor();return this.toggleClass(DescriptorBasedComponentView.HAS_DESCRIPTOR_CLASS,hasDescriptor),this.isEmpty()&&hasDescriptor?this.showEmptyDescriptorBlock(component):this.hideEmptyDescriptorBlock(),this}getComponent(){const component=PageState.getComponentByPath(this.getPath());return!component||!(component instanceof DescriptorBasedComponent)?null:component}hasDescriptor(){return this.hasClass(DescriptorBasedComponentView.HAS_DESCRIPTOR_CLASS)}showEmptyDescriptorBlock(component){this.emptyDescriptorBlock||(this.emptyDescriptorBlock=new DivEl("empty-descriptor-block"),this.emptyDescriptorBlock.setHtml(this.makeEmptyDescriptorText(component)),this.placeholder.appendChild(this.emptyDescriptorBlock)),this.emptyDescriptorBlock.show()}hideEmptyDescriptorBlock(){this.emptyDescriptorBlock?.hide()}}class LayoutComponentViewBuilder extends ComponentViewBuilder{static{__name(this,"LayoutComponentViewBuilder")}constructor(){super(),this.setType(LayoutItemType.get())}}class LayoutComponentView extends DescriptorBasedComponentView{static{__name(this,"LayoutComponentView")}regionViews;itemViewAddedListener;itemViewRemovedListener;static debug=!1;constructor(builder){super(builder.setInspectActionRequired(!0).setPlaceholder(new LayoutPlaceholder)),this.regionViews=[],this.itemViewAddedListener=event=>this.notifyItemViewAdded(event.getView(),event.isNewlyCreated()),this.itemViewRemovedListener=event=>this.notifyItemViewRemoved(event.getView()),this.parseRegions()}getComponentViewByPath(path){let result=null;return this.regionViews.some(regionView=>(regionView.getPath().equals(path)?result=regionView:result=regionView.getComponentViewByPath(path),!!result)),result}getRegions(){return this.regionViews}toItemViewArray(){let array=[];return array.push(this),this.regionViews.forEach(regionView=>{const itemsInRegion=regionView.toItemViewArray();array=array.concat(itemsInRegion)}),array}makeEmptyDescriptorText(component){const descriptorName=component.getName()?.toString()||component.getDescriptorKey().toString();return`${i18n("field.layout")} "${descriptorName}"`}parseRegions(){return this.regionViews.forEach(regionView=>{this.unregisterRegionView(regionView)}),this.regionViews=[],this.doParseRegions()}doParseRegions(parentElement){(parentElement?parentElement.getChildren():this.getChildren()).forEach(childElement=>{const itemType=ItemType.fromElement(childElement);if(!ObjectHelper.iFrameSafeInstanceOf(childElement,RegionView))if(itemType&&RegionItemType.get().equals(itemType)){const regionName=RegionItemType.getRegionName(childElement),builder=new RegionViewBuilder().setParentView(this).setParentElement(parentElement||this).setName(regionName).setLiveEditParams(this.liveEditParams).setElement(childElement);this.registerRegionView(new RegionView(builder))}else this.doParseRegions(childElement)})}registerRegionView(regionView){this.regionViews.push(regionView),this.notifyItemViewAdded(regionView),regionView.onItemViewAdded(this.itemViewAddedListener),regionView.onItemViewRemoved(this.itemViewRemovedListener)}unregisterRegionView(regionView){const index=this.regionViews.indexOf(regionView);index>-1&&(this.regionViews.splice(index,1),this.notifyItemViewRemoved(regionView),regionView.unItemViewAdded(this.itemViewAddedListener),regionView.unItemViewRemoved(this.itemViewRemovedListener))}}class SaveAsTemplateEvent extends IframeEvent{static{__name(this,"SaveAsTemplateEvent")}constructor(){super()}static on(handler,contextWindow=window){Event$1.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){Event$1.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class PageResetEvent extends IframeEvent{static{__name(this,"PageResetEvent")}constructor(){super()}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class PageViewBuilder{static{__name(this,"PageViewBuilder")}itemViewIdProducer;itemViewFactory;liveEditParams;element;setItemViewIdProducer(value){return this.itemViewIdProducer=value,this}setItemViewFactory(value){return this.itemViewFactory=value,this}setElement(value){return this.element=value,this}setLiveEditParams(value){return this.liveEditParams=value,this}build(){return new PageView(this)}}class PageView extends ItemView{static{__name(this,"PageView")}regionViews;fragmentView;viewsById;resetAction;itemViewAddedListener;itemViewRemovedListener;static debug;lockedContextMenu;modifyPermissions;constructor(builder){super(new ItemViewBuilder().setLiveEditParams(builder.liveEditParams).setItemViewIdProducer(builder.itemViewIdProducer).setItemViewFactory(builder.itemViewFactory).setType(PageItemType.get()).setElement(builder.element).setContextMenuTitle(new PageViewContextMenuTitle(builder.liveEditParams.displayName))),this.setPlaceholder(new PagePlaceholder(this)),this.addPageContextMenuActions(),this.regionViews=[],this.viewsById={},this.modifyPermissions=builder.liveEditParams.modifyPermissions,this.addClassEx("page-view"),this.initListeners(),this.parseItemViews(),(builder.liveEditParams.locked||ObjectHelper.isDefined(builder.liveEditParams.modifyPermissions)&&!builder.liveEditParams.modifyPermissions)&&this.setLocked(!0)}isDragging(){return DragAndDrop.get().isDragging()}createDraggable(item){return DragAndDrop.get().createDraggable(item)}destroyDraggable(item){return DragAndDrop.get().destroyDraggable(item)}setModifyPermissions(modifyPermissions){this.modifyPermissions=modifyPermissions,modifyPermissions||this.setLocked(!0)}addPageContextMenuActions(){const actions=[];actions.push(new Action(i18n("live.view.inspect")).onExecuted(()=>{new ComponentInspectedEvent(this.getPath()).fire()})),this.resetAction=new Action(i18n("live.view.reset")).onExecuted(()=>{new PageResetEvent().fire()}),actions.push(this.resetAction),this.getLiveEditParams().isResetEnabled||this.resetAction.setEnabled(!1),this.liveEditParams.isPageTemplate||actions.push(new Action(i18n("action.saveAsTemplate")).onExecuted(()=>{new SaveAsTemplateEvent().fire()})),this.addContextMenuActions(actions)}initListeners(){this.itemViewAddedListener=event=>{const itemView=event.getView();if(itemView.toItemViewArray().forEach(value=>{this.registerItemView(value)}),itemView.getType().equals(TextItemType.get()))event.isNewlyCreated()&&(new SelectComponentEvent({path:itemView.getPath(),position:null,rightClicked:!0}).fire(),itemView.giveFocus());else if(event.isNewlyCreated()){const config={path:itemView.getPath(),position:null,newlyCreated:!0};itemView.select(config,ItemViewContextMenuPosition.NONE),itemView.focusPlaceholderIfEmpty()}},this.itemViewRemovedListener=event=>{event.getView().toItemViewArray().forEach(itemView=>{this.unregisterItemView(itemView)})},this.listenToMouseEvents()}highlightSelected(){!this.isLocked()&&!this.isDragging()&&super.highlightSelected()}showCursor(){this.isLocked()||super.showCursor()}shade(){this.isEmpty()||super.shade()}unshade(){this.isLocked()||super.unshade()}listenToMouseEvents(){this.onMouseOverView(()=>{this.isDragging()&&this.lockedContextMenu&&this.lockedContextMenu.isVisible()&&this.lockedContextMenu.hide()})}getPath(){return ComponentPath.root()}select(config,menuPosition){config&&(config.rightClicked=!1),super.select(config,menuPosition)}showContextMenu(clickPosition,menuPosition){this.isLocked()||super.showContextMenu(clickPosition,menuPosition)}createLockedContextMenu(){return new ItemViewContextMenu(this.getContextMenuTitle(),this.getLockedMenuActions())}getLockedMenuActions(){const unlockAction=new Action(i18n("action.page.settings"));return unlockAction.onExecuted(()=>{new ComponentInspectedEvent(ComponentPath.root()).fire()}),[unlockAction]}selectLocked(position){this.setLockVisible(!0),this.lockedContextMenu.showAt(position.x,position.y)}deselectLocked(){this.setLockVisible(!1),this.lockedContextMenu.hide()}handleShaderClick(event){this.isLocked()&&this.modifyPermissions?(this.lockedContextMenu||(this.lockedContextMenu=this.createLockedContextMenu()),this.lockedContextMenu.isVisible()?this.deselectLocked():this.selectLocked({x:event.pageX,y:event.pageY})):!this.isSelected()||event.which===3?this.handleClick(event):this.deselect()}hideContextMenu(){return this.lockedContextMenu?.hide(),super.hideContextMenu()}isLocked(){return this.hasClass("locked")}setLockVisible(visible){this.toggleClass("lock-visible",visible)}setLocked(locked){locked!==this.isLocked()&&(this.toggleClass("locked",locked),this.hideContextMenu(),locked?(this.shade(),new PageLockedEvent().fire()):(this.unshade(),new PageUnlockedEvent().fire(),new ComponentInspectedEvent(this.getPath()).fire()),PageViewController.get().setLocked(locked))}getPageView(){return this}getPageViewController(){return PageViewController.get()}getCurrentContextMenu(){return this.lockedContextMenu||super.getCurrentContextMenu()}hasTargetWithinTextComponent(target){const textItemViews=this.getItemViewsByType(TextItemType.get());let result=!1,textView;return textItemViews.forEach(view=>{if(textView=view,textView.getEl().contains(target)){result=!0;return}}),result}isEmpty(){return this.getLiveEditParams().isPageEmpty}getName(){return this.getLiveEditParams().pageName}getIconClass(){return this.getLiveEditParams().pageIconClass}getParentItemView(){return null}setParentItemView(_itemView){throw new Error(i18n("live.view.page.error.noparent"))}registerRegionView(regionView){this.regionViews.push(regionView),regionView.onItemViewAdded(this.itemViewAddedListener),regionView.onItemViewRemoved(this.itemViewRemovedListener)}unregisterRegionView(regionView){const index=this.regionViews.indexOf(regionView);index>-1&&(this.regionViews.splice(index,1),regionView.unItemViewAdded(this.itemViewAddedListener),regionView.unItemViewRemoved(this.itemViewRemovedListener))}getRegions(){return this.regionViews}toItemViewArray(){let array=[];return array.push(this),this.regionViews.forEach(regionView=>{const itemViews=regionView.toItemViewArray();array=array.concat(itemViews)}),array}hasSelectedView(){return!!SelectedHighlighter.get().getSelectedView()}getSelectedView(){for(const id in this.viewsById)if(this.viewsById.hasOwnProperty(id)&&this.viewsById[id].isSelected())return this.viewsById[id];return null}getItemViewById(id){return assertNotNull(id,i18n("live.view.itemview.error.idisnull")),this.viewsById[id.toNumber()]}getItemViewsByType(type){const views=[];for(const key in this.viewsById)if(this.viewsById.hasOwnProperty(key)){const view=this.viewsById[key];type.equals(view.getType())&&views.push(view)}return views}getItemViewByElement(element){assertNotNull(element,i18n("live.view.itemview.error.elementisnull"));const itemId=ItemView.parseItemId(element);if(!itemId)return null;const itemView=this.getItemViewById(itemId);return assertNotNull(itemView,i18n("live.view.itemview.error.notfound",itemId.toString())),itemView}getRegionViewByElement(element){const itemView=this.getItemViewByElement(element);return ObjectHelper.iFrameSafeInstanceOf(itemView,RegionView)?itemView:null}getComponentViewByElement(element){const itemView=this.getItemViewByElement(element);return ObjectHelper.iFrameSafeInstanceOf(itemView,ComponentView)?itemView:null}getComponentViewByPath(path){return this.fragmentView?this.getFragmentComponentViewByPath(path):this.getPageComponentViewByPath(path)}getFragmentComponentViewByPath(path){return path.isRoot()?this.fragmentView:this.fragmentView instanceof LayoutComponentView?this.fragmentView.getComponentViewByPath(path):null}getPageComponentViewByPath(path){if(path.isRoot())return this;let result=null;return this.regionViews.some(regionView=>(regionView.getPath().equals(path)?result=regionView:result=regionView.getComponentViewByPath(path),!!result)),result}registerItemView(view){this.viewsById[view.getItemId().toNumber()]=view}unregisterItemView(view){delete this.viewsById[view.getItemId().toNumber()]}parseItemViews(){for(const itemView in this.viewsById)this.viewsById.hasOwnProperty(itemView)&&this.unregisterItemView(this.viewsById[itemView]);this.regionViews.forEach(regionView=>{this.unregisterRegionView(regionView)}),this.regionViews=[],this.viewsById={},this.getLiveEditParams().isFragment?(this.insertChild(new DivEl,0),this.doParseFragmentItemViews()):(this.doParseItemViews(),this.toItemViewArray().forEach(value=>{this.registerItemView(value)}))}doParseItemViews(parentElement){(parentElement?parentElement.getChildren():this.getChildren()).forEach(childElement=>{const itemType=ItemType.fromElement(childElement);let regionView;itemType&&RegionItemType.get().equals(itemType)?(regionView=new RegionView(new RegionViewBuilder().setParentView(this).setName(RegionItemType.getRegionName(childElement)).setElement(childElement)),this.registerRegionView(regionView)):this.doParseItemViews(childElement)})}doParseFragmentItemViews(parentElement){(parentElement?parentElement.getChildren():this.getChildren()).forEach(childElement=>{const itemType=ItemType.fromElement(childElement);if(itemType?.isComponentType()){const itemViewConfig=new CreateItemViewConfig().setParentView(this).setElement(childElement).setLiveEditParams(this.liveEditParams).setParentElement(parentElement||this),componentView=this.createView(itemType,itemViewConfig);this.registerFragmentComponentView(componentView)}else this.doParseFragmentItemViews(childElement)})}unregisterFragmentComponentView(componentView){componentView.unItemViewAdded(this.itemViewAddedListener),componentView.unItemViewRemoved(this.itemViewRemovedListener),componentView.toItemViewArray().forEach(itemView=>{this.unregisterItemView(itemView)})}registerFragmentComponentView(componentView){componentView.onItemViewAdded(this.itemViewAddedListener),componentView.onItemViewRemoved(this.itemViewRemovedListener),componentView.toItemViewArray().forEach(value=>{this.registerItemView(value)}),componentView instanceof LayoutComponentView&&componentView.getRegions().forEach(regionView=>{this.registerRegionView(regionView)}),this.fragmentView=componentView}isRendered(){return!0}}class InitializeLiveEditEvent extends IframeEvent{static{__name(this,"InitializeLiveEditEvent")}constructor(liveEditParams){super(),this.liveEditParams=liveEditParams}getProjectJson(){return this.projectJson}getConfig(){return this.config}getParams(){return this.liveEditParams}getPageJson(){return this.pageJson}getUserJson(){return this.user}getPrincipalsJson(){return this.principals}getContent(){return this.content}setProjectJson(value=ProjectContext?.get().getProject()?.toJson()){return this.projectJson=value,this}setConfig(value=CONFIG?.getConfig()){return this.config=value,this}setPageJson(value=PageState?.getState()?.toJson()){return this.pageJson=value,this}setUser(value=AuthContext?.get().getUser()?.toJson()){return this.user=value,this}setContent(value){return this.content=value,this}setPrincipals(value=AuthContext?.get().getPrincipals().map(principal=>principal.toJson())){return this.principals=value,this}setHostDomain(value){return this.hostDomain=value,this}getHostDomain(){return this.hostDomain}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class SkipLiveEditReloadConfirmationEvent extends IframeEvent{static{__name(this,"SkipLiveEditReloadConfirmationEvent")}constructor(skip){super(),this.skip=skip}isSkip(){return this.skip}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class ComponentLoadedEvent extends IframeEvent{static{__name(this,"ComponentLoadedEvent")}constructor(newComponentPath){super(),this.newComponentPath=newComponentPath}getPath(){return this.newComponentPath}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class LiveEditPageInitializationErrorEvent extends IframeEvent{static{__name(this,"LiveEditPageInitializationErrorEvent")}constructor(message){super(),this.message=message}getMessage(){return this.message}static on(handler,contextWindow=window){Event$1.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){Event$1.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class LiveEditPageViewReadyEvent extends IframeEvent{static{__name(this,"LiveEditPageViewReadyEvent")}constructor(){super()}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class EditContentFromComponentViewEvent extends IframeEvent{static{__name(this,"EditContentFromComponentViewEvent")}constructor(id){super(),this.id=id}getId(){return this.id}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class ContentBasedComponentView extends ComponentView{static{__name(this,"ContentBasedComponentView")}editAction;constructor(builder){super(builder),this.addEditActionToMenu()}addEditActionToMenu(){this.isEmpty()||this.addContextMenuActions([this.createEditAction()])}createEditAction(){return this.editAction=new Action(i18n("action.edit")).onExecuted(()=>{new EditContentFromComponentViewEvent(this.getContentId()).fire()}),this.editAction}getContentId(){return this.liveEditParams.getFragmentIdByPath(this.getPath().toString())}}class ShowWarningLiveEditEvent extends IframeEvent{static{__name(this,"ShowWarningLiveEditEvent")}constructor(message){super(),this.message=message}getMessage(){return this.message}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class SetFragmentComponentEvent extends IframeEvent{static{__name(this,"SetFragmentComponentEvent")}constructor(path,contentId){super(),this.path=path,this.contentId=contentId}getComponentPath(){return this.path}getContentId(){return this.contentId}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}var CompareOperator;(function(CompareOperator2){CompareOperator2[CompareOperator2.EQ=0]="EQ",CompareOperator2[CompareOperator2.NEQ=1]="NEQ",CompareOperator2[CompareOperator2.GT=2]="GT",CompareOperator2[CompareOperator2.GTE=3]="GTE",CompareOperator2[CompareOperator2.LT=4]="LT",CompareOperator2[CompareOperator2.LTE=5]="LTE",CompareOperator2[CompareOperator2.LIKE=6]="LIKE",CompareOperator2[CompareOperator2.NOT_LIKE=7]="NOT_LIKE",CompareOperator2[CompareOperator2.IN=8]="IN",CompareOperator2[CompareOperator2.NOT_IN=9]="NOT_IN"})(CompareOperator||(CompareOperator={}));class CompareExpr{static{__name(this,"CompareExpr")}constructor(field,operator,values){this.values=[],this.field=field,this.operator=operator,this.values=values}static eq(field,value){return CompareExpr.create(field,CompareOperator.EQ,[value])}static neq(field,value){return CompareExpr.create(field,CompareOperator.NEQ,[value])}static gt(field,value){return CompareExpr.create(field,CompareOperator.GT,[value])}static gte(field,value){return CompareExpr.create(field,CompareOperator.GTE,[value])}static lt(field,value){return CompareExpr.create(field,CompareOperator.LT,[value])}static lte(field,value){return CompareExpr.create(field,CompareOperator.LTE,[value])}static like(field,value){return CompareExpr.create(field,CompareOperator.LIKE,[value])}static notLike(field,value){return CompareExpr.create(field,CompareOperator.NOT_LIKE,[value])}static In(field,values){return CompareExpr.create(field,CompareOperator.IN,values)}static notIn(field,values){return CompareExpr.create(field,CompareOperator.NOT_IN,values)}static create(field,operator,values){return new CompareExpr(field,operator,values)}getField(){return this.field}getOperator(){return this.operator}getFirstValue(){return this.values.length>0?this.values[0]:null}getValues(){return this.values}toString(){let result=this.field.toString();if(result=result.concat(" "),result=result.concat(this.operatorAsString()),result=result.concat(" "),this.allowMultipleValues()){result=result.concat("(");let sub=[];this.values.forEach(expr=>{sub.push(expr.toString())}),result=result.concat(sub.join(", ")),result=result.concat(")")}else result=result.concat(this.getFirstValue().toString());return result}operatorAsString(){switch(this.operator){case CompareOperator.EQ:return"=";case CompareOperator.NEQ:return"!=";case CompareOperator.GT:return">";case CompareOperator.GTE:return">=";case CompareOperator.LT:return"<";case CompareOperator.LTE:return"<=";case CompareOperator.LIKE:return"LIKE";case CompareOperator.NOT_LIKE:return"NOT LIKE";case CompareOperator.IN:return"IN";case CompareOperator.NOT_IN:return"NOT IN";default:return""}}allowMultipleValues(){return this.operator===CompareOperator.IN||this.operator===CompareOperator.NOT_IN}}class FieldExpr{static{__name(this,"FieldExpr")}constructor(name){this.name=name}getName(){return this.name}toString(){return this.name}}class ValueExpr{static{__name(this,"ValueExpr")}constructor(value){this.value=value}static stringValue(value){return new ValueExpr(new Value(value,ValueTypes.STRING))}static string(value){return new ValueExpr(new Value(value,ValueTypes.STRING))}static number(value){return new ValueExpr(new Value(value,ValueTypes.DOUBLE))}static dateTime(value){return new ValueExpr(new Value(value,ValueTypes.DATE_TIME))}static geoPoint(value){return new ValueExpr(new Value(value,ValueTypes.GEO_POINT))}getValue(){return this.value}toString(){let type=this.value.getType();return type===ValueTypes.DOUBLE?this.value.getString():type===ValueTypes.DATE_TIME?this.typecastFunction("dateTime",this.value.getString()):type===ValueTypes.GEO_POINT?this.typecastFunction("geoPoint",this.value.getString()):this.quoteString(this.value.getString())}typecastFunction(name,argument){return name+"("+this.quoteString(argument)+")"}quoteString(value){return value.indexOf("'")>-1?`"${value}"`:`'${value}'`}}var LogicalOperator;(function(LogicalOperator2){LogicalOperator2[LogicalOperator2.AND=0]="AND",LogicalOperator2[LogicalOperator2.OR=1]="OR"})(LogicalOperator||(LogicalOperator={}));class LogicalExpr{static{__name(this,"LogicalExpr")}constructor(left,operator,right){this.left=left,this.right=right,this.operator=operator}static and(left,right){return new LogicalExpr(left,LogicalOperator.AND,right)}static or(left,right){return new LogicalExpr(left,LogicalOperator.OR,right)}getLeft(){return this.left}getRight(){return this.right}getOperator(){return this.operator}toString(){return`(${String(this.left)} ${this.operatorAsString()} ${String(this.right)})`}operatorAsString(){switch(this.operator){case LogicalOperator.AND:return"AND";case LogicalOperator.OR:return"OR";default:return""}}}class QueryExpr{static{__name(this,"QueryExpr")}constructor(constraint,orderList){this.orderList=[],this.constraint=constraint,orderList&&(this.orderList=orderList)}getConstraint(){return this.constraint}getOrderList(){return this.orderList}toString(){let result="";if(this.constraint!=null&&(result=result.concat(String(this.constraint))),this.orderList.length>0){result=result.concat(" ORDER BY ");let sub=[];this.orderList.forEach(expr=>{sub.push(String(expr))}),result=result.concat(sub.join(", "))}return result}}var OrderDirection;(function(OrderDirection2){OrderDirection2[OrderDirection2.ASC=0]="ASC",OrderDirection2[OrderDirection2.DESC=1]="DESC"})(OrderDirection||(OrderDirection={}));class OrderExpr2{static{__name(this,"OrderExpr")}constructor(direction){this.direction=direction}getDirection(){return this.direction}directionAsString(){switch(this.direction){case OrderDirection.ASC:return"ASC";case OrderDirection.DESC:return"DESC";default:return""}}}class FieldOrderExpr2 extends OrderExpr2{static{__name(this,"FieldOrderExpr")}constructor(field,direction){super(direction),this.field=field}getField(){return this.field}toString(){return this.field.toString()+" "+super.directionAsString()}}class ContentQueryResult{static{__name(this,"ContentQueryResult")}constructor(contents,aggreations,contentsAsJson,metadata){this.contents=contents,this.aggregations=aggreations,this.contentsAsJson=contentsAsJson,this.metadata=metadata}getContents(){return this.contents}getContentsAsJson(){return this.contentsAsJson}getAggregations(){return this.aggregations}getMetadata(){return this.metadata}}class ResultMetadata{static{__name(this,"ResultMetadata")}constructor(hits,totalHits){this.hits=hits,this.totalHits=totalHits}static fromJson(json){return new ResultMetadata(json.hits,json.totalHits)}getHits(){return this.hits}getTotalHits(){return this.totalHits}setHits(hits){this.hits=hits}setTotalHits(totalHits){this.totalHits=totalHits}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ResultMetadata))return!1;const other=o;return!(this.hits!==other.hits||this.totalHits!==other.totalHits)}}var Expand;(function(Expand2){Expand2[Expand2.NONE=0]="NONE",Expand2[Expand2.SUMMARY=1]="SUMMARY",Expand2[Expand2.FULL=2]="FULL"})(Expand||(Expand={}));class Bucket{static{__name(this,"Bucket")}constructor(key,docCount){this.key=key,this.docCount=docCount}static fromJson(json){return new Bucket(json.key,json.docCount)}getKey(){return this.key}getDocCount(){return this.docCount}setKey(key){this.key=key}setDocCount(docCount){this.docCount=docCount}getDisplayName(){return this.displayName}setDisplayName(displayName){this.displayName=displayName}}class DateRangeBucket extends Bucket{static{__name(this,"DateRangeBucket")}constructor(key,docCount){super(key,docCount)}static fromDateRangeJson(json){let dateRangeBucket=new DateRangeBucket(json.key,json.docCount);return dateRangeBucket.from=json.from,dateRangeBucket.to=json.to,dateRangeBucket}getFrom(){return this.from}getTo(){return this.to}}class BucketFactory{static{__name(this,"BucketFactory")}static createFromJson(json){if(json.DateRangeBucket)return DateRangeBucket.fromDateRangeJson(json.DateRangeBucket);if(json.BucketJson)return Bucket.fromJson(json.BucketJson);throw new Error(`Bucket-type not recognized: ${JSON.stringify(json)}`)}}class Aggregation{static{__name(this,"Aggregation")}constructor(name){this.name=name}getName(){return this.name}}class BucketAggregation extends Aggregation{static{__name(this,"BucketAggregation")}constructor(){super(...arguments),this.buckets=[]}static fromJsonArray(aggregationWrapperJsons){let aggregations=[];return aggregationWrapperJsons.forEach(aggregationJson=>{aggregations.push(BucketAggregation.createFromJson(aggregationJson))}),aggregations}static createFromJson(json){if(json.BucketAggregation)return BucketAggregation.fromJson(json.BucketAggregation);throw new Error(`Aggregation type not recognized: ${JSON.stringify(json)}`)}static fromJson(json){let bucketAggregation=new BucketAggregation(json.name);return json.buckets.forEach(bucketWrapper=>{bucketAggregation.addBucket(BucketFactory.createFromJson(bucketWrapper))}),bucketAggregation}getBucketByName(name){return this.buckets.find(bucket=>bucket.getKey()===name)}getBuckets(){return this.buckets}addBucket(bucket){this.buckets.push(bucket)}setBuckets(buckets){return this.buckets=buckets}}var Branch;(function(Branch2){Branch2.DRAFT="draft",Branch2.MASTER="master"})(Branch||(Branch={}));class ContentQueryRequest extends CmsContentResourceRequest{static{__name(this,"ContentQueryRequest")}constructor(contentQuery){super(),this.expand=Expand.SUMMARY,this.allLoaded=!1,this.results=[],this.setMethod(HttpMethod.POST),this.contentQuery=contentQuery,this.addRequestPathElements("query")}getContentQuery(){return this.contentQuery}setExpand(expand){return this.expand=expand,this}setTargetBranch(value){return this.targetBranch=value,this}isPartiallyLoaded(){return this.results.length>0&&!this.allLoaded}resetParams(){this.allLoaded=!1,this.contentQuery.setFrom(this.contentQuery.getFrom()>=0?0:-1)}getParams(){return{queryExpr:this.contentQuery.getQueryExpr()?.toString(),from:this.contentQuery.getFrom(),size:this.contentQuery.getSize(),contentTypeNames:this.contentTypeNamesAsString(this.contentQuery.getContentTypes()),mustBeReferencedById:this.getMustBereferencedById(),expand:this.expandAsString(),aggregationQueries:this.aggregationQueriesToJson(this.contentQuery.getAggregationQueries()),queryFilters:this.queryFiltersToJson(this.contentQuery.getQueryFilters()),query:this.contentQuery.getQuery(),querySort:this.contentQuery.getQuerySort(),branch:this.targetBranch||Branch.DRAFT}}parseResponse(response){const responseResult=response.getResult(),aggregations=BucketAggregation.fromJsonArray(responseResult.aggregations),contentsAsJson=responseResult.contents,metadata=new ResultMetadata(response.getResult().metadata.hits,response.getResult().metadata.totalHits);let contents;return this.expand===Expand.FULL?contents=this.fromJsonToContentArray(contentsAsJson):this.expand===Expand.SUMMARY?contents=this.fromJsonToContentSummaryArray(contentsAsJson):contents=this.fromJsonToContentIdBaseItemArray(contentsAsJson),this.updateStateAfterLoad(contents,metadata),new ContentQueryResult(this.results,aggregations,contentsAsJson,metadata)}updateStateAfterLoad(contents,metadata){this.contentQuery.getFrom()===0&&(this.results=[]),this.results=this.results.concat(contents),this.allLoaded=this.contentQuery.getFrom()+metadata.getHits()>=metadata.getTotalHits(),this.contentQuery.setFrom(this.contentQuery.getFrom()+metadata.getHits())}getMustBereferencedById(){const contentId=this.contentQuery.getMustBeReferencedById();return contentId?contentId.toString():null}aggregationQueriesToJson(aggregationQueries){const aggregationQueryJsons=[];return aggregationQueries==null||aggregationQueries.forEach(aggregationQuery=>{aggregationQueryJsons.push(aggregationQuery.toJson())}),aggregationQueryJsons}queryFiltersToJson(queryFilters){const queryFilterJsons=[];return queryFilters==null||queryFilters.length===0||queryFilters.forEach(queryFilter=>{queryFilterJsons.push(queryFilter.toJson())}),queryFilterJsons}expandAsString(){switch(this.expand){case Expand.FULL:return"full";case Expand.SUMMARY:return"summary";case Expand.NONE:return"none";default:return"summary"}}contentTypeNamesAsString(names){const result=[];return names.forEach(name=>{result.push(name.toString())}),result}fromJsonToContentIdBaseItem(json){return ContentSummary.fromJson(json)}fromJsonToContentIdBaseItemArray(jsonArray){return jsonArray?.map(json=>new ContentId(json.id))||[]}}class ContentQuery{static{__name(this,"ContentQuery")}constructor(){this.contentTypeNames=[],this.aggregationQueries=[],this.queryFilters=[],this.from=0,this.size=ContentQuery.DEFAULT_SIZE}static{this.POSTLOAD_SIZE=10}static{this.DEFAULT_SIZE=100}setQueryExpr(queryExpr){return this.queryExpr=queryExpr,this}getQueryExpr(){return this.queryExpr}setContentTypeNames(contentTypeNames){return this.contentTypeNames=contentTypeNames,this}getContentTypes(){return this.contentTypeNames}setMustBeReferencedById(id){return this.mustBeReferencedById=id,this}getMustBeReferencedById(){return this.mustBeReferencedById}setQuery(value){return this.query=value,this}getQuery(){return this.query}setQuerySort(value){return this.querySort=value,this}getQuerySort(){return this.querySort}setFrom(from){return this.from=from,this}getFrom(){return this.from}setSize(size){return this.size=size,this}getSize(){return this.size}addAggregationQuery(aggregationQuery){return this.aggregationQueries.push(aggregationQuery),this}setAggregationQueries(aggregationQueries){return this.aggregationQueries=aggregationQueries,this}getAggregationQueries(){return this.aggregationQueries}addQueryFilter(queryFilter){return this.queryFilters.push(queryFilter),this}setQueryFilters(queryFilters){return this.queryFilters=queryFilters,this}getQueryFilters(){return this.queryFilters}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ContentQuery))return!1;const other=o;return!(!ObjectHelper.numberEquals(this.from,other.from)||!ObjectHelper.numberEquals(this.size,other.size)||!ObjectHelper.stringEquals(JSON.stringify(this.query),JSON.stringify(other.query))||!ObjectHelper.stringEquals(JSON.stringify(this.querySort),JSON.stringify(other.querySort))||!ObjectHelper.arrayEquals(this.contentTypeNames,other.contentTypeNames)||!ObjectHelper.anyArrayEquals(this.aggregationQueries,other.aggregationQueries)||!ObjectHelper.anyArrayEquals(this.queryFilters,other.queryFilters)||!ObjectHelper.equals(this.mustBeReferencedById,other.mustBeReferencedById)||!this.queryExpr&&other.queryExpr||this.queryExpr&&!other.queryExpr||this.queryExpr&&other.queryExpr&&!ObjectHelper.stringEquals(this.queryExpr.toString(),other.queryExpr.toString()))}}class FunctionExpr{static{__name(this,"FunctionExpr")}constructor(name,args){this.args=[],this.name=name,this.args=args}getName(){return this.name}getargs(){return this.args}toString(){let result=this.name;result=result.concat("(");let sub=[];return this.args.forEach(expr=>{sub.push(expr.toString())}),result=result.concat(sub.join(", ")),result=result.concat(")"),result}}class DynamicConstraintExpr{static{__name(this,"DynamicConstraintExpr")}constructor(func){this.func=func}getFunction(){return this.func}toString(){return this.func.toString()}}class QueryFields{static{__name(this,"QueryFields")}constructor(){this.queryFields=[]}add(queryField){this.queryFields.push(queryField)}toString(){return this.queryFields?this.queryFields.join():null}}class FulltextSearchExpression{static{__name(this,"FulltextSearchExpression")}static create(searchString,queryFields){if(searchString==null)return null;const args=[],escapedSearchString=FulltextSearchExpression.escapeString(searchString);args.push(ValueExpr.stringValue(queryFields.toString())),args.push(ValueExpr.stringValue(escapedSearchString)),args.push(ValueExpr.stringValue("AND"));const fulltextExp=new FunctionExpr("fulltext",args),fulltextDynamicExpr=new DynamicConstraintExpr(fulltextExp),nGramExpr=new FunctionExpr("ngram",args),nGramDynamicExpr=new DynamicConstraintExpr(nGramExpr);return new LogicalExpr(fulltextDynamicExpr,LogicalOperator.OR,nGramDynamicExpr)}static escapeString(value){return value.replace(/((\&\&)|(\|\|)|[+-=><!(){}\[\]^"~*?:\\/])/g,"\\$1")}}class FulltextSearchExpressionBuilder{static{__name(this,"FulltextSearchExpressionBuilder")}constructor(){this.queryFields=new QueryFields}addField(queryField){return this.queryFields.add(queryField),this}setSearchString(searchString){return this.searchString=searchString,this}build(){return FulltextSearchExpression.create(this.searchString,this.queryFields)}}class PathMatchExpression extends FulltextSearchExpression{static{__name(this,"PathMatchExpression")}static{this.MAX_PATH_LENGTH=80}static createWithPath(searchString,queryFields,path){const fulltextExpr=FulltextSearchExpression.create(searchString,queryFields),args=[];args.push(ValueExpr.stringValue("_path")),args.push(ValueExpr.stringValue("/content"+path));const matchedExpr=new FunctionExpr("pathMatch",args),matchedDynamicExpr=new DynamicConstraintExpr(matchedExpr);if(searchString.length>PathMatchExpression.MAX_PATH_LENGTH)return new LogicalExpr(fulltextExpr,LogicalOperator.AND,matchedDynamicExpr);const pathExpr=this.createPathMatchExpression(searchString),nameOrPathExpr=new LogicalExpr(fulltextExpr,LogicalOperator.OR,pathExpr);return new LogicalExpr(nameOrPathExpr,LogicalOperator.AND,matchedDynamicExpr)}static createPathMatchExpression(searchString){const escapedSearchString=FulltextSearchExpression.escapeString(searchString);return CompareExpr.like(new FieldExpr("_path"),ValueExpr.string(this.createSearchString(escapedSearchString)))}static createSearchString(searchString){return searchString&&searchString.indexOf("/")===0&&(searchString=searchString.slice(1)),searchString=searchString.trim().replace(/\s+/g,"*"),"/content/*"+searchString+"*"}}class PathMatchExpressionBuilder extends FulltextSearchExpressionBuilder{static{__name(this,"PathMatchExpressionBuilder")}addField(queryField){return super.addField(queryField),this}setSearchString(searchString){return super.setSearchString(searchString),this}setPath(path){return this.path=path,this}build(){return PathMatchExpression.createWithPath(this.searchString,this.queryFields,this.path)}}class ContentSummaryRequest extends ResourceRequest{static{__name(this,"ContentSummaryRequest")}static{this.MODIFIED_TIME_DESC=new FieldOrderExpr2(new FieldExpr("modifiedTime"),OrderDirection.DESC)}static{this.SCORE_DESC=new FieldOrderExpr2(new FieldExpr("_score"),OrderDirection.DESC)}static{this.PATH_ASC=new FieldOrderExpr2(new FieldExpr("_path"),OrderDirection.ASC)}static{this.DEFAULT_ORDER=[ContentSummaryRequest.SCORE_DESC,ContentSummaryRequest.MODIFIED_TIME_DESC]}static{this.ROOT_ORDER=[ContentSummaryRequest.SCORE_DESC,ContentSummaryRequest.PATH_ASC]}constructor(){super(),this.searchString="",this.request=new ContentQueryRequest(new ContentQuery).setExpand(Expand.SUMMARY)}getSearchString(){return this.searchString}getRestPath(){return this.request.getRestPath()}getRequestPath(){return this.request.getRequestPath()}getContentPath(){return this.path}getParams(){return this.request.getParams()}send(){return this.buildSearchQueryExpr(),this.request.send()}sendAndParse(){return this.buildSearchQueryExpr(),this.request.sendAndParse().then(queryResult=>queryResult.getContents())}setAllowedContentTypes(contentTypes){this.request.getContentQuery().setContentTypeNames(this.createContentTypeNames(contentTypes))}setAllowedContentTypeNames(contentTypeNames){this.request.getContentQuery().setContentTypeNames(contentTypeNames)}setSize(size){this.request.getContentQuery().setSize(size)}setContentPath(path){this.path=path}setSearchString(value=""){this.searchString=value}isPartiallyLoaded(){return this.request.isPartiallyLoaded()}resetParams(){this.request.resetParams()}buildSearchQueryExpr(){this.request.getContentQuery().setQueryExpr(new QueryExpr(this.createSearchExpression(),this.getDefaultOrder()))}getDefaultOrder(){return ContentSummaryRequest.DEFAULT_ORDER}createSearchExpression(){return new PathMatchExpressionBuilder().setSearchString(this.searchString).setPath(this.path?this.path.toString():"").addField(new QueryField(QueryField.DISPLAY_NAME,5)).addField(new QueryField(QueryField.NAME,3)).addField(new QueryField(QueryField.ALL)).build()}createContentTypeNames(names){return(names||[]).map(name=>new ContentTypeName(name))}}class FragmentContentSummaryRequest extends ContentSummaryRequest{static{__name(this,"FragmentContentSummaryRequest")}createSearchExpression(){if(this.parentSitePath){const searchConstraint=super.createSearchExpression(),nearestSiteConstraint=this.createParentSiteFragmentsOnlyQuery();return new LogicalExpr(searchConstraint,LogicalOperator.AND,nearestSiteConstraint)}else return super.createSearchExpression()}createParentSiteFragmentsOnlyQuery(){return CompareExpr.like(new FieldExpr("_path"),ValueExpr.string("/content"+this.parentSitePath+"/*"))}setParentSitePath(sitePath){this.parentSitePath=sitePath}}class PostLoader extends BaseLoader{static{__name(this,"PostLoader")}constructor(){super(...arguments),this.isPostLoading=!1}load(postLoad=!1){return this.isPostLoading=postLoad,super.load(postLoad)}sendRequest(){return this.isPostLoading||this.resetParams(),super.sendRequest()}resetParams(){}isPartiallyLoaded(){return!0}postLoad(){this.isPartiallyLoaded()&&this.isLoaded()&&this.load(!0).finally(()=>{this.isPostLoading=!1})}}class GetContentSummaryByIds extends CmsContentResourceRequest{static{__name(this,"GetContentSummaryByIds")}constructor(ids){super(),this.setMethod(HttpMethod.POST),this.ids=ids,this.addRequestPathElements("resolveByIds")}getParams(){return{contentIds:this.ids.map(id=>id.toString())}}sendAndParse(){return this.ids&&this.ids.length>0?super.sendAndParse():Q([])}parseResponse(response){return ContentSummary.fromJsonArray(response.getResult().contents)}}class ContentSummaryLoader extends PostLoader{static{__name(this,"ContentSummaryLoader")}constructor(){super(),this.setSearchQueryExpr()}sendPreLoadRequest(ids){const contentIds=ids.split(";").map(id=>new ContentId(id));return new GetContentSummaryByIds(contentIds).sendAndParse()}createRequest(){return new ContentSummaryRequest}getRequest(){return this.request}setAllowedContentTypes(contentTypes){this.getRequest().setAllowedContentTypes(contentTypes)}setAllowedContentTypeNames(contentTypeNames){this.getRequest().setAllowedContentTypeNames(contentTypeNames)}setSize(size){this.getRequest().setSize(size)}setContentPath(path){this.getRequest().setContentPath(path)}isPartiallyLoaded(){return this.getRequest().isPartiallyLoaded()}setSearchQueryExpr(searchString=""){this.getRequest().setSearchString(searchString)}resetParams(){this.getRequest().resetParams()}search(searchString){return this.setSearchQueryExpr(searchString),this.load()}setSearchString(value){super.setSearchString(value),this.setSearchQueryExpr(value)}}class FragmentContentSummaryLoader extends ContentSummaryLoader{static{__name(this,"FragmentContentSummaryLoader")}constructor(){super(),super.setAllowedContentTypeNames([ContentTypeName.FRAGMENT])}createRequest(){return new FragmentContentSummaryRequest}setParentSitePath(parentSitePath){return this.getRequest().setParentSitePath(parentSitePath),this}setAllowedContentTypes(){throw new Error("Only fragments allowed")}setAllowedContentTypeNames(){throw new Error("Only fragments allowed")}}class ContentIconUrlResolver extends IconUrlResolver{static{__name(this,"ContentIconUrlResolver")}static default(){return UriHelper.getAdminUri("common/images/default_content.png")}setContent(value){return this.content=value,this}setSize(value){return this.size=value,this}setCrop(value){return this.crop=value,this}resolve(){const url=this.content.getIconUrl();if(!url)return null;this.crop==null&&(this.crop=!this.content.isImage());const params=UriHelper.decodeUrlParams(url);return this.crop!=null&&(params.crop=String(this.crop)),this.size!=null&&(params.size=String(this.size)),`${UriHelper.trimUrlParams(url)}?${UriHelper.encodeUrlParams(params)}`}}class ContentSummaryViewer extends NamesAndIconViewer{static{__name(this,"ContentSummaryViewer")}constructor(){super("content-summary-viewer")}resolveDisplayName(object){const contentName=object.getName(),invalid=!object.isValid()||!object.getDisplayName()||contentName.isUnnamed();return this.toggleClass("invalid",invalid),object.getDisplayName()}resolveUnnamedDisplayName(object){return object.getType()?object.getType().getLocalName():""}resolveSubName(object){const contentName=object.getName();return this.isRelativePath?contentName.isUnnamed()?NamePrettyfier.prettifyUnnamed():object.getName().toString():contentName.isUnnamed()?ContentPath.create().fromParent(object.getPath().getParentPath(),NamePrettyfier.prettifyUnnamed()).build().toString():object.getPath().toString()}resolveSubTitle(object){return object.getPath().toString()}resolveIconUrl(object){return new ContentIconUrlResolver().setContent(object).resolve()}}class FragmentDropdownList extends LazyListBox{static{__name(this,"FragmentDropdownList")}constructor(){super("common-page-list-box")}setLoader(loader){return this.loader=loader,this}createItemView(item,readOnly){const viewer=new ContentSummaryViewer;return viewer.setObject(item),viewer}getItemId(item){return item.getId()}handleLazyLoad(){this.loader.postLoad()}}class FragmentDropdown extends FilterableListBoxWrapper{static{__name(this,"FragmentDropdown")}constructor(){super(new FragmentDropdownList,{maxSelected:1,className:"common-page-dropdown"})}initElements(){super.initElements(),this.loader=this.createLoader(),this.listBox.setLoader(this.loader),this.selectedViewer=new ContentSummaryViewer,this.selectedViewer.hide()}initListeners(){super.initListeners(),this.listBox.onShown(()=>{this.loader.load().catch(DefaultErrorHandler.handle)}),this.loader.onLoadedData(event=>(event.isPostLoad()?this.listBox.addItems(event.getData().slice(this.listBox.getItemCount())):this.listBox.setItems(event.getData()),this.selectedFragment&&this.toggleItemWrapperSelected(this.selectedFragment.getId(),!0),null)),this.onSelectionChanged(selection=>{selection.selected?.length>0?(this.selectedViewer.setObject(selection.selected[0]),this.selectedViewer.show(),this.optionFilterInput.hide()):(this.selectedViewer.hide(),this.optionFilterInput.show())});let searchValue="";const debouncedSearch=AppHelper.debounce(()=>{this.loader.search(searchValue)},300);this.optionFilterInput.onValueChanged(event=>{searchValue=event.getNewValue(),debouncedSearch()})}setSitePath(sitePath){return this.loader.setParentSitePath(sitePath),this}setContentPath(contentPath){return this.loader.setContentPath(contentPath),this}createLoader(){const loader=new FragmentContentSummaryLoader;return loader.setSize(10),loader}setSelectedFragment(fragment){this.selectedFragment=fragment,this.hideDropdown(),this.deselectAll(!0),fragment?this.select(fragment):(this.selectedViewer.hide(),this.optionFilterInput.show())}updateSelectedFragment(fragment){this.selectedFragment=fragment}getSelectedFragment(){return this.selectedFragment}getLoadedFragmentById(contentId){return contentId?this.getItemById(contentId.toString()):null}doRender(){return super.doRender().then(rendered=>(this.selectedViewer.addClass("selected-option"),this.filterContainer.appendChild(this.selectedViewer),rendered))}doShowDropdown(){super.doShowDropdown(),this.selectedViewer.hide(),this.optionFilterInput.show()}doHideDropdown(){super.doHideDropdown(),this.selectedFragment&&(this.selectedViewer.show(),this.optionFilterInput.hide())}handleUserToggleAction(item){const itemId=this.listBox.getIdOfItem(item);this.isSelected(itemId)||super.handleUserToggleAction(item)}}class FragmentPlaceholder extends ItemViewPlaceholder{static{__name(this,"FragmentPlaceholder")}fragmentComponentView;fragmentDropdown;comboboxWrapper;constructor(){super(),this.initElements(),this.initListeners()}initElements(){this.comboboxWrapper=new DivEl("rich-combobox-wrapper"),this.fragmentDropdown=new FragmentDropdown}initListeners(){this.fragmentDropdown.onSelectionChanged(selectionChange=>{if(selectionChange.selected?.length>0){const contentId=selectionChange.selected[0].getContentId();this.isInsideLayout()?new GetContentByIdRequest(contentId).sendAndParse().done(content=>{const fragmentComponent=content.getPage()?content.getPage().getFragment():null;fragmentComponent&&fragmentComponent.getType()instanceof LayoutComponentType?(this.fragmentDropdown.setSelectedFragment(null),new ShowWarningLiveEditEvent(i18n("notify.nestedLayouts")).fire()):(new SetFragmentComponentEvent(this.fragmentComponentView.getPath(),contentId.toString()).fire(),this.fragmentComponentView.showLoadingSpinner())}):(new SetFragmentComponentEvent(this.fragmentComponentView.getPath(),contentId.toString()).fire(),this.fragmentComponentView.showLoadingSpinner())}})}isInsideLayout(){const parentRegion=this.fragmentComponentView.getParentItemView();if(!parentRegion)return!1;const parent2=parentRegion.getParentItemView();return parent2?parent2.getType()instanceof LayoutItemType:!1}setComponentView(fragmentComponentView){this.fragmentComponentView=fragmentComponentView,this.fragmentDropdown.setSitePath(this.fragmentComponentView.getLiveEditParams().sitePath)}doRender(){return super.doRender().then(rendered=>(this.addClass("icon-pie"),this.addClassEx("fragment-placeholder"),this.comboboxWrapper.appendChild(this.fragmentDropdown),this.appendChild(this.comboboxWrapper),rendered))}select(){this.isRendered()?this.comboboxWrapper.show():this.whenRendered(()=>this.select())}deselect(){this.comboboxWrapper.hide()}focus(){this.isRendered()?this.fragmentDropdown.giveFocus():this.whenRendered(()=>this.focus())}}class DetachFragmentEvent extends IframeEvent{static{__name(this,"DetachFragmentEvent")}constructor(path){super(),this.path=path}getComponentPath(){return this.path}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class FragmentComponentViewBuilder extends ComponentViewBuilder{static{__name(this,"FragmentComponentViewBuilder")}constructor(){super(),this.setType(FragmentItemType.get())}}class FragmentComponentView extends ContentBasedComponentView{static{__name(this,"FragmentComponentView")}static ERROR_ATTRIBUTE="data-portal-placeholder-error";fragmentContainsLayout;detachAction;constructor(builder){super(builder.setInspectActionRequired(!0).setPlaceholder(new FragmentPlaceholder)),this.fragmentContainsLayout=!1,this.placeholder.setComponentView(this),this.disableLinks(),this.parseFragmentComponents(this),this.handleErrors()}containsLayout(){return this.fragmentContainsLayout}addComponentContextMenuActions(inspectActionRequired){super.addComponentContextMenuActions(inspectActionRequired),this.empty||this.addCustomizeAction()}addCustomizeAction(){const actions=[];this.detachAction=new Action(i18n("action.component.detach.fragment")).onExecuted(()=>{this.deselect(),new DetachFragmentEvent(this.getPath()).fire()}),actions.push(this.detachAction),this.addContextMenuActions(actions)}parseFragmentComponents(parentElement){parentElement.getChildren().forEach(childElement=>this.doParseFragmentComponents(childElement))}doParseFragmentComponents(element){const itemType=ItemType.fromElement(element);itemType&&(this.removeComponentTypeAttrs(element),LayoutItemType.get().equals(itemType)&&(this.fragmentContainsLayout=!0)),TextItemType.get().equals(itemType)?this.convertTextComponentImageUrls(element):this.parseFragmentComponents(element)}removeComponentTypeAttrs(element){const htmlElement=element.getHTMLElement();htmlElement.getAttribute(FragmentComponentView.ERROR_ATTRIBUTE)&&this.getEl().setAttribute(FragmentComponentView.ERROR_ATTRIBUTE,"true"),htmlElement.removeAttribute("data-"+ItemType.ATTRIBUTE_TYPE),htmlElement.removeAttribute("data-"+ItemType.ATTRIBUTE_REGION_NAME)}handleErrors(){this.getEl().hasAttribute(FragmentComponentView.ERROR_ATTRIBUTE)&&(this.detachAction?.setEnabled(!1),this.editAction?.setEnabled(!1))}convertTextComponentImageUrls(element){const id=this.getContentId(),contentId=id?new ContentId(id):null;contentId&&this.processTextElement(element,contentId)}processTextElement(element,contentId){const text2=HTMLAreaHelper.convertRenderSrcToPreviewSrc(element.getHtml(),contentId.toString());element.setHtml(text2,!1)}}class PartPlaceholder extends DescriptorBasedComponentViewPlaceholder{static{__name(this,"PartPlaceholder")}constructor(){super(),this.addClassEx("part-placeholder").addClass(StyleHelper$1.getCommonIconCls("part"))}getType(){return PartComponentType.get()}}class PartComponentViewBuilder extends ComponentViewBuilder{static{__name(this,"PartComponentViewBuilder")}constructor(){super(),this.setType(PartItemType.get())}}class PartComponentView extends DescriptorBasedComponentView{static{__name(this,"PartComponentView")}constructor(builder){super(builder.setInspectActionRequired(!0).setPlaceholder(new PartPlaceholder)),this.resetHrefForRootLink(builder),this.disableLinks()}makeEmptyDescriptorText(component){const descriptorName=component.getName()?.toString()||component.getDescriptorKey().toString();return`${i18n("field.part")} "${descriptorName}"`}resetHrefForRootLink(builder){builder.element&&builder.element.getEl().hasAttribute("href")&&builder.element.getEl().setAttribute("href","#")}}class DefaultItemViewFactory{static{__name(this,"DefaultItemViewFactory")}createView(type,config){switch(type.getShortName()){case"fragment":return this.createFragmentView(config);case"layout":return this.createLayoutView(config);case"part":return this.createPartView(config);case"text":return this.createTextView(config);case"region":return this.createRegionView(config);default:throw new Error(i18n("live.view.itemtype.error.createviewnotsupported"))}}createFragmentView(config){return new FragmentComponentView(new FragmentComponentViewBuilder().setItemViewIdProducer(config.itemViewIdProducer).setItemViewFactory(config.itemViewFactory).setParentRegionView(config.parentView).setParentElement(config.parentElement).setElement(config.element).setLiveEditParams(config.liveEditParams).setPositionIndex(config.positionIndex))}createLayoutView(config){return new LayoutComponentView(new LayoutComponentViewBuilder().setItemViewIdProducer(config.itemViewIdProducer).setItemViewFactory(config.itemViewFactory).setParentRegionView(config.parentView).setParentElement(config.parentElement).setElement(config.element).setLiveEditParams(config.liveEditParams).setPositionIndex(config.positionIndex))}createPartView(config){return new PartComponentView(new PartComponentViewBuilder().setItemViewIdProducer(config.itemViewIdProducer).setItemViewFactory(config.itemViewFactory).setParentRegionView(config.parentView).setParentElement(config.parentElement).setElement(config.element).setLiveEditParams(config.liveEditParams).setPositionIndex(config.positionIndex))}createTextView(config){return new TextComponentView(new TextComponentViewBuilder().setText(config instanceof CreateTextComponentViewConfig?config.text:null).setItemViewIdProducer(config.itemViewIdProducer).setItemViewFactory(config.itemViewFactory).setParentRegionView(config.parentView).setParentElement(config.parentElement).setElement(config.element).setLiveEditParams(config.liveEditParams).setPositionIndex(config.positionIndex))}createRegionView(config){return new RegionView(new RegionViewBuilder().setParentView(config.parentView).setParentElement(config.parentElement).setLiveEditParams(config.liveEditParams).setElement(config.element))}}class SelectComponentViewEvent extends IframeEvent{static{__name(this,"SelectComponentViewEvent")}constructor(path,silent=!0){super(),this.path=path,this.silent=silent}getPath(){return this.path}isSilent(){return this.silent}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class DeselectComponentViewEvent extends IframeEvent{static{__name(this,"DeselectComponentViewEvent")}constructor(path,silent=!0){super(),this.path=path,this.silent=silent}getPath(){return this.path}isSilent(){return this.silent}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class AddComponentViewEvent extends IframeEvent{static{__name(this,"AddComponentViewEvent")}constructor(path,type){super(),this.path=path,this.type=type}getComponentPath(){return this.path}getComponentType(){return this.type}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class RemoveComponentViewEvent extends IframeEvent{static{__name(this,"RemoveComponentViewEvent")}constructor(path){super(),this.path=path}getComponentPath(){return this.path}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class LoadComponentViewEvent extends IframeEvent{static{__name(this,"LoadComponentViewEvent")}constructor(path,uri,existing=!1){super(),this.path=path,this.uri=uri,this.existing=existing}getComponentPath(){return this.path}getURI(){return this.uri}isExisting(){return this.existing}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class LoadComponentFailedEvent extends IframeEvent{static{__name(this,"LoadComponentFailedEvent")}constructor(path,error){super(),this.path=path,this.error=error}getComponentPath(){return this.path}getError(){return this.error}toString(){return`${this.path.toString()}:${this.error.message}`}static fromString(value){const separatorIndex=value.indexOf(":"),pathStr=separatorIndex===-1?value:value.substring(0,separatorIndex),errorMessage=separatorIndex===-1?void 0:value.substring(separatorIndex+1);return new LoadComponentFailedEvent(ComponentPath.fromString(pathStr),new Error(errorMessage))}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class DuplicateComponentViewEvent extends IframeEvent{static{__name(this,"DuplicateComponentViewEvent")}constructor(path){super(),this.path=path}getComponentPath(){return this.path}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class MoveComponentViewEvent extends IframeEvent{static{__name(this,"MoveComponentViewEvent")}constructor(from,to){super(),this.from=from,this.to=to}getFrom(){return this.from}getTo(){return this.to}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class SetPageLockStateEvent extends IframeEvent{static{__name(this,"SetPageLockStateEvent")}constructor(lock){super(),this.lock=lock}isToLock(){return this.lock}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class SetModifyAllowedEvent extends IframeEvent{static{__name(this,"SetModifyAllowedEvent")}constructor(canModify){super(),this.canModify=canModify}isModifyAllowed(){return this.canModify}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class CreateOrDestroyDraggableEvent extends IframeEvent{static{__name(this,"CreateOrDestroyDraggableEvent")}constructor(type,create2){super(),this.type=type,this.create=create2}isCreate(){return this.create}getType(){return this.type}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class SetDraggableVisibleEvent extends IframeEvent{static{__name(this,"SetDraggableVisibleEvent")}constructor(type,visible){super(),this.type=type,this.visible=visible}isVisible(){return this.visible}getType(){return this.type}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class ResetComponentViewEvent extends IframeEvent{static{__name(this,"ResetComponentViewEvent")}constructor(path){super(),this.path=path}getComponentPath(){return this.path}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class UpdateTextComponentViewEvent extends IframeEvent{static{__name(this,"UpdateTextComponentViewEvent")}constructor(path,text2,origin){super(),this.path=path,this.text=text2,this.origin=origin||"unknown"}getComponentPath(){return this.path}getText(){return this.text}getOrigin(){return this.origin}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class SetComponentStateEvent extends IframeEvent{static{__name(this,"SetComponentStateEvent")}constructor(path,processing){super(),this.path=path,this.processing=processing}getPath(){return this.path}isProcessing(){return this.processing}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class PageReloadRequestedEvent extends IframeEvent{static{__name(this,"PageReloadRequestedEvent")}constructor(){super()}static on(handler,contextWindow=window){IframeEvent.bind(ClassHelper.getFullName(this),handler,contextWindow)}static un(handler,contextWindow=window){IframeEvent.unbind(ClassHelper.getFullName(this),handler,contextWindow)}}class IframeBeforeContentSavedEvent extends IframeEvent{static{__name(this,"IframeBeforeContentSavedEvent")}static on(handler){IframeEvent.bind(ClassHelper.getFullName(this),handler)}static un(handler){IframeEvent.unbind(ClassHelper.getFullName(this),handler)}}class SessionStorageHelper{static{__name(this,"SessionStorageHelper")}static{this.debug=!1}static{this.SELECTED_PATH_STORAGE_KEY="contentstudio:liveedit:selectedPath"}static{this.SELECTED_TEXT_CURSOR_POS_STORAGE_KEY="contentstudio:liveedit:textCursorPosition"}static updateSelectedPathInStorage(contentId,value){contentId&&(value?sessionStorage.setItem(`${SessionStorageHelper.SELECTED_PATH_STORAGE_KEY}:${contentId}`,value.toString()):SessionStorageHelper.removeSelectedPathInStorage(contentId))}static removeSelectedPathInStorage(contentId){contentId&&sessionStorage.removeItem(`${SessionStorageHelper.SELECTED_PATH_STORAGE_KEY}:${contentId}`)}static updateSelectedTextCursorPosInStorage(contentId,pos){if(!contentId){SessionStorageHelper.debug;return}SessionStorageHelper.debug,pos?sessionStorage.setItem(`${SessionStorageHelper.SELECTED_TEXT_CURSOR_POS_STORAGE_KEY}:${contentId}`,JSON.stringify(pos)):SessionStorageHelper.removeSelectedTextCursorPosInStorage(contentId)}static removeSelectedTextCursorPosInStorage(contentId){if(!contentId){SessionStorageHelper.debug;return}SessionStorageHelper.debug,sessionStorage.removeItem(`${SessionStorageHelper.SELECTED_TEXT_CURSOR_POS_STORAGE_KEY}:${contentId}`)}static getSelectedPathFromStorage(contentId){if(!contentId)return;const entry=sessionStorage.getItem(`${SessionStorageHelper.SELECTED_PATH_STORAGE_KEY}:${contentId}`);return entry?ComponentPath.fromString(entry):null}static getSelectedTextCursorPosInStorage(contentId){if(!contentId){SessionStorageHelper.debug;return}const entry=sessionStorage.getItem(`${SessionStorageHelper.SELECTED_TEXT_CURSOR_POS_STORAGE_KEY}:${contentId}`);return SessionStorageHelper.debug,entry?JSON.parse(entry):null}}class LiveEditPage{static{__name(this,"LiveEditPage")}pageView;skipNextReloadConfirmation=!1;initializeListener;skipConfirmationListener;unloadListener;componentLoadedListener;dragStartedListener;dragStoppedListener;selectComponentRequestedListener;deselectComponentRequestedListener;setComponentStateEventListener;addItemViewRequestListener;removeItemViewRequestListener;loadComponentRequestListener;duplicateComponentViewRequestedListener;moveComponentViewRequestedListener;beforeContentSavedListener;setPageLockStateListener;setModifyAllowedListener;createOrDestroyDraggableListener;resetComponentViewRequestListener;pageStateListener;updateTextComponentViewListener;setDraggableVisibleEventListener;static debug=!1;constructor(){this.skipConfirmationListener=event=>{this.skipNextReloadConfirmation=event.isSkip()},SkipLiveEditReloadConfirmationEvent.on(this.skipConfirmationListener),this.initializeListener=this.init.bind(this),InitializeLiveEditEvent.on(this.initializeListener)}init(event){UriHelper.setDomain(event.getHostDomain()),CONFIG.setConfig(event.getConfig()),Messages.addMessages(JSON.parse(CONFIG.getString("phrasesAsJson"))),AuthContext.init(Principal.fromJson(event.getUserJson()),event.getPrincipalsJson().map(Principal.fromJson)),ProjectContext.get().setProject(Project.fromJson(event.getProjectJson())),PageState.setState(event.getPageJson()?new PageBuilder().fromJson(event.getPageJson()).build():null),ContentContext.get().setContent(event.getContent());const body=Body.get().loadExistingChildren();try{this.pageView=new PageViewBuilder().setItemViewIdProducer(new ItemViewIdProducer).setItemViewFactory(new DefaultItemViewFactory).setLiveEditParams(event.getParams()).setElement(body).build()}catch(error){ObjectHelper.iFrameSafeInstanceOf(error,Exception)?new LiveEditPageInitializationErrorEvent("The Live edit page could not be initialized. "+error.getMessage()).fire():new LiveEditPageInitializationErrorEvent("The Live edit page could not be initialized. "+error).fire();return}DragAndDrop.init(this.pageView),Tooltip.allowMultipleInstances(!1),this.registerGlobalListeners(),this.restoreSelection(event.getParams().contentId),new LiveEditPageViewReadyEvent().fire()}restoreSelection(contentId){const selectedItemViewPath=SessionStorageHelper.getSelectedPathFromStorage(contentId),selected=selectedItemViewPath&&this.pageView.getComponentViewByPath(selectedItemViewPath);selected&&(selected.selectWithoutMenu(),selected.scrollComponentIntoView())}destroy(win=window){SkipLiveEditReloadConfirmationEvent.un(this.skipConfirmationListener,win),InitializeLiveEditEvent.un(this.initializeListener,win),this.unregisterGlobalListeners()}registerGlobalListeners(){this.unloadListener=()=>{this.skipNextReloadConfirmation&&(this.skipNextReloadConfirmation=!1),this.pageView.remove()},WindowDOM.get().onUnload(this.unloadListener),this.componentLoadedListener=event=>{const componentView=this.getItemViewByPath(event.getPath()),componentType=componentView.getType();LayoutItemType.get().equals(componentType)?DragAndDrop.get().createSortableLayout(componentView):DragAndDrop.get().refreshSortable()},ComponentLoadedEvent.on(this.componentLoadedListener),this.dragStartedListener=()=>{Highlighter.get().hide(),SelectedHighlighter.get().hide(),Shader.get().hide(),Cursor.get().hide()},ComponentViewDragStartedEvent.on(this.dragStartedListener),this.dragStoppedListener=()=>{Cursor.get().reset(),this.pageView.isLocked()&&(Highlighter.get().hide(),Shader.get().shade(this.pageView))},ComponentViewDragStoppedEvent.on(this.dragStoppedListener),this.selectComponentRequestedListener=event=>{if(!event.getPath())return;const path=ComponentPath.fromString(event.getPath()),itemView=this.getItemViewByPath(path);itemView&&!itemView.isSelected()&&(itemView.select(null,ItemViewContextMenuPosition.NONE,event.isSilent()),itemView.scrollComponentIntoView())},SelectComponentViewEvent.on(this.selectComponentRequestedListener),this.deselectComponentRequestedListener=event=>{const path=event.getPath()?ComponentPath.fromString(event.getPath()):null;if(path){const itemView=this.getItemViewByPath(path);itemView&&!itemView.isSelected()&&itemView.deselect(!0)}else this.pageView.getSelectedView()?.deselect(!0)},DeselectComponentViewEvent.on(this.deselectComponentRequestedListener),this.setComponentStateEventListener=event=>{const path=event.getPath()?ComponentPath.fromString(event.getPath()):null,itemView=path?this.getItemViewByPath(path):null;itemView?.isText()&&(event.isProcessing()?itemView.showLoadingSpinner():itemView.hideLoadingSpinner())},SetComponentStateEvent.on(this.setComponentStateEventListener),this.addItemViewRequestListener=event=>{const path=ComponentPath.fromString(event.getComponentPath().toString()),type=ComponentType.byShortName(event.getComponentType().getShortName()),viewType=ItemType.fromComponentType(type),parentView=this.getItemViewByPath(path.getParentPath());parentView&&parentView.addComponentView(parentView.createView(viewType),path.getPath(),!0)},AddComponentViewEvent.on(this.addItemViewRequestListener),this.removeItemViewRequestListener=event=>{const path=ComponentPath.fromString(event.getComponentPath().toString()),view=this.getItemViewByPath(path);view&&(view.isSelected()&&view.deselect(!0),view.remove())},RemoveComponentViewEvent.on(this.removeItemViewRequestListener),this.loadComponentRequestListener=event=>{const path=ComponentPath.fromString(event.getComponentPath().toString()),view=this.getItemViewByPath(path);view instanceof ComponentView&&this.loadComponent(view,event.getURI(),event.isExisting()).catch(reason=>{new LoadComponentFailedEvent(path,reason).fire()})},LoadComponentViewEvent.on(this.loadComponentRequestListener),this.duplicateComponentViewRequestedListener=event=>{const newItemPath=ComponentPath.fromString(event.getComponentPath().toString()),sourceItemPath=new ComponentPath(newItemPath.getPath()-1,newItemPath.getParentPath()),view=this.getItemViewByPath(sourceItemPath);view instanceof ComponentView&&view.duplicate()},DuplicateComponentViewEvent.on(this.duplicateComponentViewRequestedListener),this.moveComponentViewRequestedListener=event=>{const from=ComponentPath.fromString(event.getFrom().toString()),to=ComponentPath.fromString(event.getTo().toString()),itemToMove=this.getItemViewByPath(from),regionViewTo=this.getItemViewByPath(to.getParentPath());itemToMove instanceof ComponentView&&regionViewTo instanceof RegionView&&itemToMove.moveToRegion(regionViewTo,to.getPath())},MoveComponentViewEvent.on(this.moveComponentViewRequestedListener);const contentId=this.pageView?.getLiveEditParams().contentId;this.beforeContentSavedListener=()=>{if(SessionStorageHelper.removeSelectedPathInStorage(contentId),SessionStorageHelper.removeSelectedTextCursorPosInStorage(contentId),!this.pageView)return;const selected=this.pageView.getSelectedView();(selected instanceof ComponentView||selected instanceof RegionView)&&SessionStorageHelper.updateSelectedPathInStorage(contentId,selected.getPath())},IframeBeforeContentSavedEvent.on(this.beforeContentSavedListener),this.setPageLockStateListener=event=>{this.pageView?.setLocked(event.isToLock())},SetPageLockStateEvent.on(this.setPageLockStateListener),this.setModifyAllowedListener=event=>{this.pageView?.setModifyPermissions(event.isModifyAllowed())},SetModifyAllowedEvent.on(this.setModifyAllowedListener),this.createOrDestroyDraggableListener=event=>{const idAttr=`drag-helper-${event.getType()}`,dataAttr=`data-${ItemType.ATTRIBUTE_TYPE}="${event.getType()}"`;if(event.isCreate()){const item=$(`<div id="${idAttr}" ${dataAttr}}></div>`).appendTo($("body"));this.pageView?.createDraggable(item),item.simulate("mousedown").hide()}else{const item=$(`div#${idAttr}[${dataAttr}]`);if(item.length===0)return;item.simulate("mouseup"),this.pageView?.destroyDraggable(item),item.remove()}},CreateOrDestroyDraggableEvent.on(this.createOrDestroyDraggableListener),this.setDraggableVisibleEventListener=event=>{const idAttr=`drag-helper-${event.getType()}`,dataAttr=`data-${ItemType.ATTRIBUTE_TYPE}="${event.getType()}"`,item=$(`div#${idAttr}[${dataAttr}]`);item.length!==0&&$(item.draggable("option","helper")()).toggle(event.isVisible())},SetDraggableVisibleEvent.on(this.setDraggableVisibleEventListener),this.resetComponentViewRequestListener=event=>{const path=ComponentPath.fromString(event.getComponentPath().toString()),view=this.getItemViewByPath(path);view instanceof ComponentView&&view.reset()},ResetComponentViewEvent.on(this.resetComponentViewRequestListener),this.pageStateListener=event=>{PageState.setState(event.getPageJson()?new PageBuilder().fromJson(event.getPageJson()).build():null)},PageStateEvent.on(this.pageStateListener),this.updateTextComponentViewListener=event=>{if(event.getOrigin()==="live")return;const path=ComponentPath.fromString(event.getComponentPath().toString()),view=this.getItemViewByPath(path);view instanceof TextComponentView&&view.setText(event.getText())},UpdateTextComponentViewEvent.on(this.updateTextComponentViewListener)}getItemViewByPath(path){if(path)return this.pageView?.getComponentViewByPath(path)}unregisterGlobalListeners(){WindowDOM.get().unUnload(this.unloadListener),ComponentViewDragStartedEvent.un(this.dragStartedListener),ComponentViewDragStoppedEvent.un(this.dragStoppedListener),SelectComponentViewEvent.un(this.selectComponentRequestedListener),DeselectComponentViewEvent.un(this.deselectComponentRequestedListener),SetComponentStateEvent.un(this.setComponentStateEventListener),AddComponentViewEvent.un(this.addItemViewRequestListener),RemoveComponentViewEvent.un(this.removeItemViewRequestListener),LoadComponentViewEvent.un(this.loadComponentRequestListener),DuplicateComponentViewEvent.un(this.duplicateComponentViewRequestedListener),MoveComponentViewEvent.un(this.moveComponentViewRequestedListener),IframeBeforeContentSavedEvent.un(this.beforeContentSavedListener),SetPageLockStateEvent.un(this.setPageLockStateListener),SetModifyAllowedEvent.un(this.setModifyAllowedListener),CreateOrDestroyDraggableEvent.un(this.createOrDestroyDraggableListener),ResetComponentViewEvent.un(this.resetComponentViewRequestListener),PageStateEvent.un(this.pageStateListener),UpdateTextComponentViewEvent.un(this.updateTextComponentViewListener)}loadComponent(componentView,componentUrl,isExisting){return assertNotNull(componentView,"componentView cannot be null"),assertNotNull(componentUrl,"componentUrl cannot be null"),componentView.showLoadingSpinner(),fetch(componentUrl).then(response=>{if(!isExisting&&response.headers.has("X-Has-Contributions")&&!this.hasSameComponentOnPage(componentView.getPath())){new PageReloadRequestedEvent().fire();return}return response.text().then(htmlAsString=>{this.handleComponentHtml(componentView,htmlAsString)})})}hasSameComponentOnPage(path){const component=PageState.getComponentByPath(path);if(component instanceof DescriptorBasedComponent){const key=component.getDescriptorKey();return PageHelper.flattenPageComponents(PageState.getState()).some(c=>!c.getPath().equals(path)&&c instanceof DescriptorBasedComponent&&c.getDescriptorKey()?.equals(key))}return!1}handleComponentHtml(componentView,htmlAsString){const newElement=this.wrapLoadedComponentHtml(htmlAsString,componentView.getType()),itemViewIdProducer=componentView.getItemViewIdProducer(),itemViewFactory=componentView.getItemViewFactory(),createViewConfig=new CreateItemViewConfig().setItemViewIdProducer(itemViewIdProducer).setItemViewFactory(itemViewFactory).setLiveEditParams(this.pageView.getLiveEditParams()).setParentView(componentView.getParentItemView()).setPositionIndex(componentView.getPath().getPath()).setElement(newElement),newComponentView=itemViewFactory.createView(componentView.getType(),createViewConfig);componentView.replaceWith(newComponentView),newComponentView.getParentItemView()instanceof RegionView&&newComponentView.getParentItemView().registerComponentViewListeners(newComponentView),new ComponentLoadedEvent(newComponentView.getPath()).fire()}wrapLoadedComponentHtml(htmlAsString,componentType){return FragmentItemType.get().equals(componentType)?this.wrapLoadedFragmentHtml(htmlAsString):Element.fromString(htmlAsString)}wrapLoadedFragmentHtml(htmlAsString){const sanitized=purify.sanitize(htmlAsString,{ALLOWED_URI_REGEXP:HTMLAreaHelper.getAllowedUriRegexp()}),sanitizedElement=Element.fromHtml(sanitized),fragmentWrapperEl=new DivEl;return fragmentWrapperEl.getEl().setAttribute(`data-${ItemType.ATTRIBUTE_TYPE}`,"fragment"),fragmentWrapperEl.appendChild(sanitizedElement),fragmentWrapperEl}getComponentErrorText(error){return!error||!error.message?"":new DOMParser().parseFromString(error.message,"text/html").title??""}}var CompareStatus;(function(CompareStatus2){CompareStatus2[CompareStatus2.NEW=0]="NEW",CompareStatus2[CompareStatus2.NEWER=1]="NEWER",CompareStatus2[CompareStatus2.OLDER=2]="OLDER",CompareStatus2[CompareStatus2.EQUAL=3]="EQUAL",CompareStatus2[CompareStatus2.MOVED=4]="MOVED",CompareStatus2[CompareStatus2.UNKNOWN=5]="UNKNOWN",CompareStatus2[CompareStatus2.ARCHIVED=6]="ARCHIVED"})(CompareStatus||(CompareStatus={}));class CompareStatusFormatter{static{__name(this,"CompareStatusFormatter")}static formatStatusClass(compareStatus){switch(compareStatus){case CompareStatus.NEW:return"new";case CompareStatus.NEWER:return"modified";case CompareStatus.EQUAL:return"online";case CompareStatus.MOVED:return"moved";case CompareStatus.ARCHIVED:return"archived";default:return"unknown"}}static formatStatusText(compareStatus){let status;switch(compareStatus){case CompareStatus.NEW:status=i18n("status.new");break;case CompareStatus.NEWER:status=i18n("status.modified");break;case CompareStatus.OLDER:status=i18n("status.outofdate");break;case CompareStatus.EQUAL:status=i18n("status.published");break;case CompareStatus.MOVED:status=i18n("status.moved");break;case CompareStatus.ARCHIVED:status=i18n("status.archived");break;default:status=i18n("status.unknown")}return status}}class CompareStatusChecker{static{__name(this,"CompareStatusChecker")}static isPublished(compareStatus){return compareStatus!==CompareStatus.NEW&&compareStatus!==CompareStatus.UNKNOWN}static isOnline(compareStatus){return compareStatus===CompareStatus.EQUAL}static isNew(compareStatus){return compareStatus===CompareStatus.NEW}static isModified(compareStatus){return compareStatus===CompareStatus.NEWER}static isMoved(compareStatus){return compareStatus===CompareStatus.MOVED}}var PublishStatus;(function(PublishStatus2){PublishStatus2.ONLINE="online",PublishStatus2.PENDING="pending",PublishStatus2.EXPIRED="expired"})(PublishStatus||(PublishStatus={}));class PublishStatusChecker{static{__name(this,"PublishStatusChecker")}static isOnline(publishStatus){return publishStatus===PublishStatus.ONLINE}static isScheduled(publishStatus){return publishStatus===PublishStatus.PENDING}static isExpired(publishStatus){return publishStatus===PublishStatus.EXPIRED}}class ContentSummaryAndCompareStatusHelper{static{__name(this,"ContentSummaryAndCompareStatusHelper")}static diff(item1,item2){const diff={};return ObjectHelper.equals(item1.getUploadItem(),item2.getUploadItem())||(diff.uploadItem=!0),ObjectHelper.bothDefined(item1.getContentSummary(),item2.getContentSummary())&&(diff.contentSummary=ContentSummaryHelper.diff(item1.getContentSummary(),item2.getContentSummary())),item1.getCompareStatus()!==item2.getCompareStatus()&&(diff.compareStatus=!0),ObjectHelper.booleanEquals(item1.isRenderable(),item2.isRenderable())||(diff.renderable=!0),diff}}class ContentSummaryAndCompareStatus{static{__name(this,"ContentSummaryAndCompareStatus")}constructor(){this.renderable=!1}static fromContentSummary(contentSummary){return new ContentSummaryAndCompareStatus().setContentSummary(contentSummary)}static fromContentAndCompareStatus(contentSummary,compareStatus){return new ContentSummaryAndCompareStatus().setContentSummary(contentSummary).setCompareStatus(compareStatus)}static fromContentAndCompareAndPublishStatus(contentSummary,compareStatus,publishStatus){const contentSummaryAndCompareStatus=ContentSummaryAndCompareStatus.fromContentAndCompareStatus(contentSummary,compareStatus);return contentSummaryAndCompareStatus.isNew()||contentSummaryAndCompareStatus.setPublishStatus(publishStatus),contentSummaryAndCompareStatus}static fromUploadItem(item){return new ContentSummaryAndCompareStatus().setUploadItem(item)}static fromId(id){const contentId=id instanceof ContentId?id:new ContentId(id);return ContentSummaryAndCompareStatus.fromContentSummary(new ContentSummary(new ContentSummaryBuilder().setId(contentId.toString()).setContentId(contentId)))}static isInArray(contentId,array){return array.some(c=>c.getContentId().equals(contentId))}hasContentSummary(){return!!this.contentSummary}getContentSummary(){return this.contentSummary}setContentSummary(contentSummary){return this.contentSummary=contentSummary,this}getCompareStatus(){return this.compareStatus}setCompareStatus(status){return this.compareStatus=status,this}getPublishStatus(){return this.publishStatus}setPublishStatus(publishStatus){return this.publishStatus=publishStatus,this}hasUploadItem(){return!!this.uploadItem}getUploadItem(){return this.uploadItem}setUploadItem(item){return this.uploadItem=item,item.isUploaded()?this.contentSummary=item.getModel():item.onUploaded(contentSummary=>{this.contentSummary=contentSummary}),this}setRenderable(value){return this.renderable=value,this}isRenderable(){return this.renderable}getContentId(){return this.contentSummary?this.contentSummary.getContentId():null}getId(){return this.contentSummary&&this.contentSummary.getId()||this.uploadItem&&this.uploadItem.getId()||""}getPath(){return this.contentSummary?this.contentSummary.getPath():null}getType(){return this.contentSummary?this.contentSummary.getType():null}getDisplayName(){return this.contentSummary?this.contentSummary.getDisplayName():null}getLanguage(){return this.contentSummary?.getLanguage()}getIconUrl(){return this.contentSummary?new ContentIconUrlResolver().setContent(this.contentSummary).resolve():null}getIconClass(){return""}hasChildren(){return this.contentSummary?this.contentSummary.hasChildren():!1}hasOriginProject(){return!!this.contentSummary&&!!this.contentSummary.getOriginProject()}getOriginProject(){return this.contentSummary?this.contentSummary.getOriginProject():null}isInherited(){return this.contentSummary?this.contentSummary.isInherited():!1}isFullyInherited(){return this.getInherit().length*2===Object.keys(ContentInheritType).length}getInherit(){return this.contentSummary?.getInherit()||[]}isDataInherited(){return!!this.contentSummary?.isDataInherited()}isSortInherited(){return this.contentSummary?this.contentSummary.isSortInherited():!1}isParentInherited(){return this.contentSummary?this.contentSummary.isParentInherited():!1}isNameInherited(){return this.contentSummary?this.contentSummary.isNameInherited():!1}isValid(){return this.contentSummary?this.contentSummary.isValid():!1}isDeletable(){return this.contentSummary?this.contentSummary.isDeletable():!1}isEditable(){return this.contentSummary?this.contentSummary.isEditable():!1}isVariant(){return this.contentSummary?.isVariant()}getStatusText(){if(this.isUnpublished())return i18n("status.unpublished");if(this.isNew())return i18n("status.new");if(this.isPublished()||this.isModified()){if(this.isScheduledPublishing()){let publishStatus=i18n("status.scheduled");return this.isModified()&&(publishStatus=`${publishStatus}, ${i18n("status.modified")}`),publishStatus}if(this.isExpiredPublishing())return i18n("status.expired")}return this.isMovedAndModified()?`${CompareStatusFormatter.formatStatusText(CompareStatus.MOVED)}, ${CompareStatusFormatter.formatStatusText(CompareStatus.NEWER)}`:CompareStatusFormatter.formatStatusText(this.getCompareStatus())}getStatusClass(){if(this.isUnpublished())return"offline";if(this.isNew())return"new";const publishStatus=this.getPublishStatus();if(PublishStatusChecker.isScheduled(publishStatus)||PublishStatusChecker.isExpired(publishStatus))return publishStatus;let statusClass=CompareStatusFormatter.formatStatusClass(this.getCompareStatus());return this.isMovedAndModified()&&(statusClass=CompareStatusFormatter.formatStatusClass(CompareStatus.NEWER)),statusClass.replace("_","-").replace(" ","_")||"unknown"}equals(o){if(!ObjectHelper.iFrameSafeInstanceOf(o,ContentSummaryAndCompareStatus))return!1;const other=o,diff=ContentSummaryAndCompareStatusHelper.diff(this,other);return isEqual(diff)}setReadOnly(value){this.contentSummary?.setReadOnly(value)}isReadOnly(){return this.contentSummary?this.contentSummary.isReadOnly():!1}isPublished(){return!!this.getCompareStatus()&&CompareStatusChecker.isPublished(this.getCompareStatus())}isOnline(){return CompareStatusChecker.isOnline(this.getCompareStatus())}isNew(){return CompareStatusChecker.isNew(this.getCompareStatus())}isUnpublished(){return this.isNew()&&!!this.getContentSummary().getPublishFirstTime()}isModified(){return CompareStatusChecker.isModified(this.getCompareStatus())}isScheduledPublishing(){return PublishStatusChecker.isScheduled(this.getPublishStatus())}isExpiredPublishing(){return PublishStatusChecker.isExpired(this.getPublishStatus())}isMoved(){return CompareStatusChecker.isMoved(this.getCompareStatus())}isMovedAndModified(){return CompareStatusChecker.isMoved(this.getCompareStatus())&&this.contentSummary?.isInProgress()}canBeMarkedAsReady(){return this.contentSummary?!this.isOnline()&&this.contentSummary.isValid()&&!this.contentSummary.isReady():!1}clone(){const contentSummary=new ContentSummaryBuilder(this.getContentSummary()).build(),clone2=ContentSummaryAndCompareStatus.fromContentAndCompareAndPublishStatus(contentSummary,this.compareStatus,this.publishStatus);return clone2.setRenderable(this.renderable),clone2}}class MinimizeWizardPanelEvent extends IframeEvent{static{__name(this,"MinimizeWizardPanelEvent")}static on(handler){IframeEvent.bind(ClassHelper.getFullName(this),handler)}static un(handler){IframeEvent.unbind(ClassHelper.getFullName(this),handler)}}function initEventBus(){IframeEventBus.get().addReceiver(parent).setId("iframe-bus"),IframeEventBus.get().registerClass("ContentSummaryAndCompareStatus",ContentSummaryAndCompareStatus),IframeEventBus.get().registerClass("ContentSummary",ContentSummary),IframeEventBus.get().registerClass("ContentPath",ContentPath),IframeEventBus.get().registerClass("ContentName",ContentName),IframeEventBus.get().registerClass("ContentTypeName",ContentTypeName),IframeEventBus.get().registerClass("ApplicationKey",ApplicationKey),IframeEventBus.get().registerClass("PrincipalKey",PrincipalKey),IframeEventBus.get().registerClass("IdProviderKey",IdProviderKey),IframeEventBus.get().registerClass("ContentId",ContentId),IframeEventBus.get().registerClass("ChildOrder",ChildOrder),IframeEventBus.get().registerClass("FieldOrderExpr",FieldOrderExpr2),IframeEventBus.get().registerClass("Workflow",Workflow),IframeEventBus.get().registerClass("ComponentPath",ComponentPath),IframeEventBus.get().registerClass("PartComponentType",PartComponentType),IframeEventBus.get().registerClass("LayoutComponentType",LayoutComponentType),IframeEventBus.get().registerClass("FragmentComponentType",FragmentComponentType),IframeEventBus.get().registerClass("AddComponentViewEvent",AddComponentViewEvent),IframeEventBus.get().registerClass("MoveComponentViewEvent",MoveComponentViewEvent),IframeEventBus.get().registerClass("RemoveComponentViewEvent",RemoveComponentViewEvent),IframeEventBus.get().registerClass("SelectComponentViewEvent",SelectComponentViewEvent),IframeEventBus.get().registerClass("DeselectComponentViewEvent",DeselectComponentViewEvent),IframeEventBus.get().registerClass("DuplicateComponentViewEvent",DuplicateComponentViewEvent),IframeEventBus.get().registerClass("LoadComponentViewEvent",LoadComponentViewEvent),IframeEventBus.get().registerClass("ResetComponentViewEvent",ResetComponentViewEvent),IframeEventBus.get().registerClass("UpdateTextComponentViewEvent",UpdateTextComponentViewEvent),IframeEventBus.get().registerClass("SkipLiveEditReloadConfirmationEvent",SkipLiveEditReloadConfirmationEvent),IframeEventBus.get().registerClass("LiveEditParams",LiveEditParams),IframeEventBus.get().registerClass("InitializeLiveEditEvent",InitializeLiveEditEvent),IframeEventBus.get().registerClass("PageStateEvent",PageStateEvent),IframeEventBus.get().registerClass("SetPageLockStateEvent",SetPageLockStateEvent),IframeEventBus.get().registerClass("IframeBeforeContentSavedEvent",IframeBeforeContentSavedEvent),IframeEventBus.get().registerClass("CreateOrDestroyDraggableEvent",CreateOrDestroyDraggableEvent),IframeEventBus.get().registerClass("SetDraggableVisibleEvent",SetDraggableVisibleEvent),IframeEventBus.get().registerClass("TextComponentType",TextComponentType),IframeEventBus.get().registerClass("MinimizeWizardPanelEvent",MinimizeWizardPanelEvent)}__name(initEventBus,"initEventBus");function initListeners(){Store.instance().set("$",$),StyleHelper$1.setCurrentPrefix(ItemViewPlaceholder.PAGE_EDITOR_PREFIX),window.onload=function(){IframeEventBus.get().fireEvent(new IframeEvent("editor-iframe-loaded"))},$(document).on("keypress keydown keyup",event=>{if(shouldBubbleEvent(event)){stopBrowserShortcuts(event);const modifierEvent=new IframeEvent("editor-modifier-pressed").setData({type:event.type,config:{bubbles:event.bubbles,cancelable:event.cancelable,ctrlKey:event.ctrlKey,altKey:event.altKey,shiftKey:event.shiftKey,metaKey:event.metaKey,keyCode:event.keyCode,charCode:event.charCode}});IframeEventBus.get().fireEvent(modifierEvent)}});function shouldBubble(event){return(event.metaKey||event.ctrlKey||event.altKey)&&!!event.keyCode}__name(shouldBubble,"shouldBubble");function shouldBubbleEvent(event){return event.keyCode===113?!0:shouldBubble(event)}__name(shouldBubbleEvent,"shouldBubbleEvent");function stopBrowserShortcuts(event){const hasKeyBindings=Store.parentInstance().has(KEY_BINDINGS_KEY),keyBindings=Store.parentInstance().get(KEY_BINDINGS_KEY),activeBindings=hasKeyBindings?keyBindings.getActiveBindings():[];hasMatchingBinding(activeBindings,event)&&event.preventDefault()}__name(stopBrowserShortcuts,"stopBrowserShortcuts");function hasMatchingBinding(keys,event){const isMod=event.ctrlKey||event.metaKey,isAlt=event.altKey,eventKey=event.keyCode||event.which;for(const key of keys){let matches=!1;switch(key.getCombination()){case"backspace":matches=eventKey===8;break;case"del":matches=eventKey===46;case"mod+del":matches=matches&&isMod;break;case"mod+s":matches=eventKey===83&&isMod;break;case"mod+esc":matches=eventKey===83&&isMod;break;case"mod+alt+f4":matches=eventKey===115&&isMod&&isAlt;break}if(matches)return!0}return!1}__name(hasMatchingBinding,"hasMatchingBinding")}__name(initListeners,"initListeners");class PageEditor{static{__name(this,"PageEditor")}static liveEditPage;static init(){initEventBus(),initListeners(),PageEditor.liveEditPage=new LiveEditPage}}exports.PageEditor=PageEditor;