text: /**
   * @license
   * Copyright (c) 2014, 2020, Oracle and/or its affiliates.
   * Licensed under The Universal Permissive License (UPL), Version 1.0
   * as shown at https://oss.oracle.com/licenses/upl/
   * @ignore
   */
  define(["ojs/ojcore","ojs/ojcontext","ojs/ojcomponentcore","ojs/ojlogger"],function(n,e,t,r){"use strict";var i={properties:{valid:{type:"string",writeback:!0,enumValues:["invalidHidden","invalidShown","pending","valid"],readOnly:!0}},methods:{setProperty:{},getProperty:{},setProperties:{},showMessages:{},focusOn:{},getNodeBySubId:{},getSubIdByNode:{}},extension:{}};function o(i){var o,a=this,d=i.element,s=[];function l(){s=[],function n(e){var t;var r=[];var i=e.childNodes;var o=i.length;for(t=0;t<o;t++){var a=i[t],d=g(a);d?s.push(a):r.push(a)}o=r.length;for(t=0;t<o;t++)n(r[t])}(d),i.props.valid=h();for(var n=s.length,e=0;e<n;e++)v(s[e])}function v(n){n.addEventListener("validChanged",f.bind(this)),n.addEventListener("disabledChanged",c.bind(this)),n.addEventListener("readonlyChanged",c.bind(this))}function u(n){n.removeEventListener("validChanged",f),n.removeEventListener("disabledChanged",c),n.removeEventListener("readonlyChanged",c)}function f(){i.props.valid=h()}function c(n){var e=n.target,t=e.valid,r=!(e.readonly||e.disabled);"valid"===t||(i.props.valid=r&&"invalidShown"===t?"invalidShown":h())}function h(){for(var n="valid",e=s.length,t=0;t<e&&"invalidShown"!==n;t++){var r=s[t];if(y(r)){var i=r.valid,o=r.disabled,a=r.readonly;o||a||("invalidShown"===i?n="invalidShown":"invalidHidden"===i?n="invalidHidden":"pending"===i&&"valid"===n&&(n="pending"))}}return n}function g(n){if(1===n.nodeType&&-1!==n.tagName.indexOf("-")&&"valid"in n&&(y(n)&&void 0!==n.valid))return!0;return!1}function p(n,e){var t=e.length;if(g(n))return!0;for(var r=0;r<t;r++)if(g(e[r]))return!0;return!1}function m(n){var e=s.length;if(1!==n.nodeType)return!1;for(var t=0;t<e;t++){if(s[t].contains(n))return!0}return!1}function O(n){for(var e=s.length,t=0;t<n.length;t++){var r=n[t];if(1===r.nodeType){if(-1!==s.indexOf(r))return!0;for(var i=0;i<e;i++)if(r.contains(s[i]))return!0}}return!1}function y(e){var r,i=n.BaseCustomElementBridge.getInstance(e)._WIDGET_ELEM;return void 0!==i&&(r=t.__GetWidgetConstructor(i)),!(void 0!==i&&!r)}a._rootElementMutationObserver=new MutationObserver(function(n){if(document.body.contains(d)){for(var e=n.length,t=!1,r=0;r<e&&!t;r++){var i=n[r],o=i.target,a=i.removedNodes,s=i.addedNodes;if(!(t=O(a))&&s.length>0)!m(o)&&p(o,s)&&(t=!0)}t&&(!function(n){for(var e=n.length,t=0;t<e;t++)for(var r=n[t],i=r.removedNodes.length,o=0;o<i;o++){var a=r.removedNodes[o];1===a.nodeType&&u(a)}}(n),l())}else this.disconnect()}),a.createDOM=function(){for(d.classList.add("oj-validation-group"),(o=document.createElement("div")).setAttribute("data-oj-context","");d.firstChild;)o.appendChild(d.firstChild);d.appendChild(o)},a.updateDOM=function(){e.getContext(o).getBusyContext().whenReady().then(function(){for(var n=s.length,e=0;e<n;e++)u(s[e]);l(),a._rootElementMutationObserver.observe(d,{childList:!0,subtree:!0})})},a.handlePropertyChanged=function(n,e){return!0},a.showMessages=function(){for(var n=0;n<s.length;n++){var e=s[n];e.disabled||e.readonly||"showMessages"in e&&e.showMessages()}},a.focusOn=function(n){var e=null,t=null;"@firstInvalidShown"===n?(t=function(){var n=[];if("invalidShown"!==d.valid)return null;for(var e=s.length,t=0;t<e;t++){var r=s[t];r.disabled||r.readonly||"invalidShown"===r.valid&&n.push(r)}if(0===n.length)return null;return n.sort(function(n,e){return n.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}),n[0]}())&&("focusOn"in t?t.focusOn("@firstInvalidShown"):t.focus()):void 0===n?(e=function(){for(var n=null,e=s.length,t=0;t<e;t++)if(!(n=s[t]).readonly&&!n.disabled)return n;return null}())&&("focusOn"in e?e.focusOn():e.focus()):r.info("focusOn's parameter value is not '@firstInvalidShown' or empty, so it's a no-op.")}}i.extension._CONSTRUCTOR=o,Object.freeze(i),n.CustomElementBridge.register("oj-validation-group",{metadata:i})});