Viewing File: /usr/local/cpanel/base/frontend/jupiter/domains/index.cmb.min.js
define("app/views/ROUTES",["cjt/util/locale"],(function(e){"use strict";return[{id:"listDomains",route:"/",hideTitle:!1,controller:"listDomains",templateUrl:"views/listDomains.phtml",title:e.maketext("List Domains"),breadcrumb:{id:"listDomains",name:e.maketext("List Domains"),path:"/"},resolve:{currentDomains:["domains",function(e){return e.get()}]}},{id:"createDomain",route:"/create",controller:"createDomain",templateUrl:"views/createDomain.ptt",title:e.maketext("Create a New Domain"),breadcrumb:{id:"createDomain",name:e.maketext("Create a New Domain"),path:"/create/",parentID:"listDomains"},resolve:{domainTypes:["domains",function(e){return e.getTypes()}],currentDomains:["domains",function(e){return e.get()}]}},{id:"manageDomain",route:"/manage",controller:"manageDomain",templateUrl:"views/manageDomain.ptt",hideTitle:!0,title:e.maketext("Manage the Domain"),breadcrumb:{id:"manageDomain",name:e.maketext("Manage the Domain"),path:"/manage/",parentID:"listDomains"},resolve:{domainTypes:["domains",function(e){return e.getTypes()}],currentDomains:["domains",function(e){return e.get()}]}}]})),define("app/services/domains",["angular","lodash","cjt/util/locale","cjt/io/uapi-request","cjt/io/api2-request","cjt/io/uapi","cjt/io/api2","cjt/modules","cjt/services/APICatcher","cjt/services/cpanel/nvDataService"],(function(e,t,i,n,o){"use strict";var a=e.module("cpanel.domains.domains.service",["cjt2.services.apicatcher","cjt2.services.cpanel.nvdata"]),r="domain_recommendations_prioritized_tlds";a.value("PAGE",PAGE),a.value("DOMAIN_TYPE_CONSTANTS",{SUBDOMAIN:"subdomain",ADDON:"addon",ALIAS:"alias",MAIN:"main_domain"});var s={documentRoot:!0};a.factory("domains",["$q","$timeout","APICatcher","DOMAIN_TYPE_CONSTANTS","PAGE","nvDataService",function(a,c,l,d,u,m){var h,p,f,_,g,v,D={},y=null;function b(e){window.mixpanel&&"function"==typeof window.mixpanel.track&&window.mixpanel.track(e,{})}var w,S=function(e){var t=this;Object.keys(e).forEach((function(i){t[i]=e[i]})),t.protocol=t.isHttpsRedirecting?"https":"http",t.isWildcard=t.domain&&"*"===t.domain.substr(0,1),t.canBeSuggested=!t.isWildcard},T=[{label:i.maketext("Subdomain"),value:d.SUBDOMAIN,requiresCustomDocumentRoot:!0,stat:"subdomains"},{label:i.maketext("Addon"),value:d.ADDON,requiresCustomDocumentRoot:!0,dependantStat:"subdomains",stat:"addon_domains"},{label:i.maketext("Alias"),value:d.ALIAS,stat:"aliases"}],A=function(){};function k(e,t){for(var i in e)if(e.hasOwnProperty(i)&&e[i].id===t)return e[i]}function x(e){for(var t in T)if(T.hasOwnProperty(t)&&T[t].value===e)return T[t]}function R(e){if(e){var t=null===e.maximum?void 0:Number(e.maximum),i=Number(e.usage);if(!isNaN(t))if(0===t||i/t>=1)return!0;return!1}}function C(e){if(!Array.isArray(e))return null;for(var t=0;t<e.length;t++)if(1===e[t].period&&e[t].register)return{display:e[t].register.display_value,value:parseFloat(e[t].register.value)};return null}function N(e){var t=(e||"").trim().toLowerCase();return t?"."===t.charAt(0)?t:"."+t:""}return(A.prototype=l)._cacheDomain=function(t){h||(h=[]);var i=new S(t);if(D[i.domain]){var n=D[i.domain];e.extend(n,i)}else D[i.domain]=i,h.push(i);return t},A.prototype._uncacheDomain=function(e){if(!h)return!1;for(var t=this._getDomainObject(e),i=h.length-1;i>=0;i--)h[i].domain===t.domain&&h.splice(i,1);delete D[t.domain]},A.prototype.getCurrentDomains=function(){return h},A.prototype.invalidate=function(){h=null,D={}},A.prototype._getDomainObject=function(e){return"string"==typeof e?this.findDomainByName(e):e},A.prototype._getSubDomainObject=function(e){return"string"==typeof e?this.findDomainByName(e+"."+this.getMainDomain().domain):e},A.prototype._associateAddonDomains=function(){var t=this;e.forEach(_,(function(e){var i=t._getSubDomainObject(e.subdomain);i&&(i.associatedAddonDomain=e.domain)}))},A.prototype.addSubdomain=function(t){var i=this,n=new o.Class;n.initialize("SubDomain","addsubdomain");var a=t.subdomain.substr(0,t.subdomain.length-(t.domain.length+1));return n.addArgument("domain",a),n.addArgument("rootdomain",t.domain),n.addArgument("canoff","1"),n.addArgument("disallowdot","0"),n.addArgument("dir",t.fullDocumentRoot),i.promise(n).then((function(n){var o=t.newDomainName;return i.fetchSingleDomainData(o).then((function(n){return n=e.extend(n,{subdomain:n.subdomain,rootDomain:t.domain,type:d.SUBDOMAIN,canEdit:u.hasWebServerRole&&s,canRemove:!0}),i._cacheDomain(n)}))}))},A.prototype.addAddonDomain=function(t){var i=this,n=new o.Class;return n.initialize("AddonDomain","addaddondomain"),n.addArgument("subdomain",t.subdomain),n.addArgument("newdomain",t.newDomainName),n.addArgument("ftp_is_optional","1"),n.addArgument("dir",t.documentRoot),n.addArgument("create_temporary_domain",t.createTemporaryDomain),i.promise(n).then((function(n){const o=n.data?n.data[0].domain:null;return i.fetchSingleDomainData(t.newDomainName||o).then((function(n){var o=e.extend(e.copy(n),{type:d.ADDON,subdomain:n.subdomain,canEdit:u.hasWebServerRole&&s,canRemove:!0,canRename:!0,is_temporary:"1"===String(n.is_temporary)||"1"===String(t.createTemporaryDomain)});return i._cacheDomain(e.extend(e.copy(n),{domain:n.rootDomain,subdomain:n.subdomain,type:d.SUBDOMAIN,associatedAddonDomain:o,canEdit:u.hasWebServerRole&&s,canRemove:!0,is_temporary:"1"===String(n.is_temporary)||"1"===String(t.createTemporaryDomain)})),"1"===String(t.createTemporaryDomain)&&b("CP_USR:DOMAINS-TEMP_DOMAIN-CREATED"),i._cacheDomain(o)}))}))},A.prototype.addAliasDomain=function(t){var i=this,n=new o.Class;return n.initialize("Park","park"),n.addArgument("domain",t.newDomainName),i.promise(n).then((function(){var n=e.copy(i.getMainDomain());return n.domain=t.newDomainName,n.type=d.ALIAS,n.canRemove=!0,n.canRename=!0,i._cacheDomain(n)}))},A.prototype.add=function(e){var t,i=this;return e.domainType===d.SUBDOMAIN?t=i.addSubdomain(e):e.domainType===d.ADDON?t=i.addAddonDomain(e):e.domainType===d.ALIAS&&(t=i.addAliasDomain(e)),t.then((function(t){var n=x(e.domainType),o=k(i.getUsageStats(),n.stat);return o&&o.usage++,i.updateDomainTypeLimits(),t})),t},A.prototype.generateFullDocumentRoot=function(e){var t="1"===u.requirePublicHTMLSubs.toString(),i=this.getMainDomain().homedir+"/";return t&&(i+="public_html/"),i+=e?e.replace(/^\//,""):""},A.prototype.getMainDomain=function(){return p},A.prototype.findDomainByName=function(e){return D[e]},A.prototype.fetchSingleDomainData=function(e){var t=this,i=new n.Class;return i.initialize("DomainInfo","single_domain_data"),i.addArgument("domain",e),i.addArgument("return_https_redirect_status",1),t.promise(i).then((function(e){var i=0;return"addon_domain"===e.data.type?i=d.ADDON:"sub_domain"===e.data.type&&(i=d.SUBDOMAIN),t.formatSingleDomain(e.data,i)}))},A.prototype.fetchDomains=function(){var e=this,i=new n.Class;return i.initialize("DomainInfo","domains_data"),i.addArgument("return_https_redirect_status",1),e.promise(i).then((function(i){var n=e.formatSingleDomain(i.data.main_domain);n.type=d.MAIN,n.canRemove=!1,n.canRename=!(!u.features||!u.features.primarydomain_rename),p=n,e._cacheDomain(p),g=[];var o=i.data.sub_domains||[];return o.forEach((function(t){var i=e.formatSingleDomain(t,d.SUBDOMAIN);this.push(i),e._cacheDomain(i)}),g),_=[],(o=i.data.addon_domains||[]).forEach((function(i){var n=e.formatSingleDomain(i,d.ADDON);n.canRename=!0,this.push(n),e._cacheDomain(n);var o=t.assign({},n);o.domain=o.rootDomain,o.type=d.SUBDOMAIN,g.push(o),e._cacheDomain(o)}),_),f=[],i.data.parked_domains.forEach((function(t){var n=e.formatSingleDomain(i.data.main_domain,d.ALIAS);n.domain=t,n.canRename=!0,this.push(n),e._cacheDomain(n)}),f),p}))},A.prototype.formatSingleDomain=function(e,t){var i={domain:e.domain,homedir:e.homedir,documentRoot:e.documentroot||e.dir,rootDomain:e.servername,isHttpsRedirecting:parseInt(e.is_https_redirecting),hasValidHTTPSAliases:parseInt(e.all_aliases_valid),nonHTTPS:!parseInt(e.can_https_redirect),redirectsTo:"not redirected"===e.status?null:e.status,type:e.type,realRootDomain:u.mainDomain,is_temporary:"1"===String(e.is_temporary)};if(t){i.type=t,i.homedir=this.getMainDomain().homedir;var n=this.getMainDomain().domain;if(t===d.SUBDOMAIN){var o=e.domain.match(/.*\.(.+\..+)$/);n=o?o[1]:n}var a=i.rootDomain?i.rootDomain.substr(0,i.rootDomain.lastIndexOf("."+n)):null;i.canRemove=!0,t!==d.ALIAS&&(i.canEdit=u.hasWebServerRole&&s,i.subdomain=a),t===d.SUBDOMAIN?i.rootDomain=n:t===d.ALIAS&&(i.rootDomain=u.mainDomain)}return i},A.prototype.get=function(){var e=this;return w||(h?a.resolve(h):(h=[],w=e.fetchDomains().then((function(){return e._associateAddonDomains(),h})).finally((function(){w=null}))))},A.prototype.getResourceUsageStats=function(){var e=new n.Class;return e.initialize("ResourceUsage","get_usages"),this.promise(e).then((function(e){return e.data}))},A.prototype.getDomainTypes=function(){return T},A.prototype.getUsageStats=function(){return v},A.prototype.updateDomainTypeLimits=function(){var e=this,t=e.getUsageStats();return e.getDomainTypes().forEach((function(e){var i=k(t,e.stat);e.overLimit=R(i),"1"!==u.hasWebServerRole&&e.requiresCustomDocumentRoot?e.overLimit=!0:!e.overLimit&&e.dependantStat&&(e.overLimit=e.overLimit||R(k(t,e.dependantStat)))})),e.getDomainTypes()},A.prototype.getTypes=function(){var e=this;return e.getUsageStats()?a.resolve(e.getDomainTypes()):e.getResourceUsageStats().then((function(t){return v=t,e.updateDomainTypeLimits(),e.getDomainTypes()}))},A.prototype.updateDocumentRoot=function(e,t){var i=this,n=i._getDomainObject(e);["subdomain","rootDomain"].forEach((function(e){if(!n[e])throw new Error(e+" is required but undefined on "+n.domain)}));var a=n.rootDomain;n.type===d.ADDON&&(a=n.realRootDomain);var r=new o.Class;return r.initialize("SubDomain","changedocroot"),r.addArgument("subdomain",n.subdomain),r.addArgument("rootdomain",a),r.addArgument("dir",t),i.promise(r).then((function(e){return n.documentRoot=t,i.fetchSingleDomainData(n.domain).then((function(e){var t=e.documentRoot;if(n.type===d.ADDON){var o=i._getSubDomainObject(n.subdomain);o&&(o.documentRoot=t)}else if(n.associatedAddonDomain){i._getDomainObject(n.associatedAddonDomain).documentRoot=t}return n.documentRoot=t,n}))}))},A.prototype.removeSubdomain=function(e){var t,i=this._getDomainObject(e),n=new RegExp("."+i.rootDomain+"$");t=i.domain.match(n)?i.subdomain+"_"+i.rootDomain:i.domain;var a=new o.Class;return a.initialize("SubDomain","delsubdomain"),a.addArgument("domain",t),this.promise(a)},A.prototype.removeAddonDomain=function(e){var t=this,i=t._getDomainObject(e),n=new o.Class;return n.initialize("AddonDomain","deladdondomain"),n.addArgument("domain",i.domain),n.addArgument("subdomain",i.subdomain+"_"+t.getMainDomain().domain),t.promise(n)},A.prototype.removeAliasDomain=function(e){var t=this._getDomainObject(e),i=new o.Class;return i.initialize("Park","unpark"),i.addArgument("domain",t.domain),this.promise(i)},A.prototype.removeRedirect=function(e){var t=this._getDomainObject(e),i=new n.Class;return i.initialize("Mime","delete_redirect"),i.addArgument("domain",t.domain),i.addArgument("src",t.redirectTo),i.addArgument("redirect",t.documentRoot),this.promise(i).then((function(){t.redirectTo=""}))},A.prototype._removeDomainAdjustStats=function(e){var t=this,i=t._getDomainObject(e);if(i){i.type===d.ADDON&&t._removeDomainAdjustStats(i.subdomain+"."+t.getMainDomain().domain),t._uncacheDomain(i);var n=x(i.type),o=k(t.getUsageStats(),n.stat);o&&o.usage--,t.updateDomainTypeLimits()}},A.prototype.remove=function(e){var i=this,n=i._getDomainObject(e),o=!1,r=[];return n.type===d.SUBDOMAIN?r.push(i.removeSubdomain(n)):n.type===d.ADDON?r.push(i.removeAddonDomain(n)):n.type===d.ALIAS&&(n.redirectTo&&r.push(i.removeRedirect(n)),r.push(i.removeAliasDomain(n))),a.all(r).then((function(e){i._removeDomainAdjustStats(n)}),(function(e){if(t.isArray(e))e.forEach((function(e){if(e&&e.error)throw o=!0,e.error}));else if(e&&e.error)throw o=!0,e.error})).finally((function(){o||i._uncacheDomain(n)}))},A.prototype.getDocumentRootPattern=function(){return new RegExp("^[^"+t.escapeRegExp('%?* :|"<>\\')+"]+$")},A.prototype.canRedirectHTTPS=function(){return"1"===u.canRedirectHTTPS},A.prototype.toggleHTTPSRedirect=function(e,t){var i=new n.Class;if(i.initialize("SSL","toggle_ssl_redirect_for_domains"),i.addArgument("state",e?1:0),t){var o=t;i.addArgument("domains",o)}else{for(var a=[],r=0;r<h.length;r++)h[r].selected&&!h[r].associatedAddonDomain&&void 0===h[r].associatedAddonDomain&&a.push(h[r].domain);var s=a.join(",");i.addArgument("domains",s)}return this.promise(i)},A.prototype.replaceTemporaryDomain=function(t){var i=this,o=new n.Class;return o.initialize("Domain","convert_temporary_to_registered"),o.addArgument("domain",t.domain),o.addArgument("registered",t.newDomainName),o.addArgument("docroot",t.documentRoot),i.promise(o).then((function(){return i.fetchSingleDomainData(t.newDomainName).then((function(n){n.canRename=!0,i._cacheDomain(n),i._cacheDomain(e.extend(e.copy(n),{domain:n.rootDomain,type:d.SUBDOMAIN,associatedAddonDomain:n})),i._uncacheDomain(t);var o=x(n.type),a=k(i.getUsageStats(),o.stat);a&&a.usage++,i.updateDomainTypeLimits(),b("CP_USR:DOMAINS-TEMP_DOMAIN-CONVERTED")}))}))},A.prototype.fetchDomainRecommendations=function(e,t,i){var o=new n.Class;if(o.initialize("DomainRecommendations","domain_suggestions"),o.addArgument("search_field",e),t&&o.addArgument("page_size",t),i&&i.length){var a=i.map((function(e){return(e||"").replace(/^\./,"")})).filter((function(e){return e.length}));if(a.length){o.addArgument("tld",a[0]);for(var r=1;r<a.length;r++)o.addArgument("tld-"+r,a[r])}}return this.promise(o).then((function(e){return e.data}))},A.prototype.fetchDomainPurchaseUrl=function(e,t){var i=new n.Class;return i.initialize("DomainRecommendations","purchase_domain"),i.addArgument("domain",e),i.addArgument("period",t),i.addArgument("skip_backend_track",1),this.promise(i).then((function(e){return e.data}))},A.prototype.fetchRecommendations=function(e,t){var i=a.defer(),n=!1,o=c((function(){n=!0,i.reject(new Error("Domain recommendations request timed out after 10000ms"))}),1e4);return this.fetchDomainRecommendations(e,10,t).then((function(e){if(!n){var t=e&&e.suggestions?e.suggestions:{},o=Object.keys(t),a=o.slice(0,2),r=[],s=null;a.forEach((function(e){r.push({domain:e});var i=C(t[e].pricing);i&&(null===s||i.value<s.value)&&(s=i)}));var c=o.map((function(e){var i=C(t[e].pricing);return{domain:e,price:i?i.display:"",priceValue:i?i.value:0,isPremium:!!t[e].is_premium}}));i.resolve({banner:{recommendations:r,lowestPrice:s?s.display:""},explore:{featured:c.slice(0,2),available:c.slice(2)}})}})).catch((function(e){i.reject(e)})).finally((function(){c.cancel(o)})),i.promise},A.prototype.fetchStoreConfig=function(){var e=new n.Class;return e.initialize("DomainRecommendations","get_store_config"),this.promise(e).then((function(e){return e.data}))},A.prototype.fetchSupportedTlds=function(){var e=new n.Class;return e.initialize("DomainRecommendations","supported_tlds"),this.promise(e).then((function(e){return e.data&&Array.isArray(e.data.tlds)?e.data.tlds:[]}))},A.prototype.getPrioritizedTlds=function(){return m.get(r).then((function(e){var t=Array.isArray(e)?e[0]:null;return(t&&t.value?String(t.value):"").split("|").map(N).filter((function(e){return e.length}))})).catch((function(e){return console.error("Failed to load prioritised TLDs:",e),[]}))},A.prototype.setPrioritizedTlds=function(t){var i=(e.isArray(t)?t:[]).map(N).filter((function(e){return e.length})).join("|");return m.set(r,i,{nocache:!0}).then((function(e){e&&e.error&&console.error("Failed to save prioritised TLDs:",e.error)})).catch((function(e){console.error("Failed to save prioritised TLDs:",e)}))},A.prototype.renameDomain=function(e){var t=this,i=new n.Class;return i.initialize("Domain","rename_domain"),i.addArgument("domain",e.domain),i.addArgument("new_domain",e.newDomainName),t.promise(i).then((function(){return t.fetchSingleDomainData(e.newDomainName).then((function(i){i.canRename=!0,t._cacheDomain(i),t._uncacheDomain(e)}))}))},A.prototype.setPendingAddDomain=function(e){y=e||null},A.prototype.consumePendingAddDomain=function(){var e=y;return y=null,e},new A}])})),define("app/views/createDomain",["lodash","angular","cjt/util/locale","cjt/services/fuzzy","cjt/modules","ngRoute","cjt/directives/callout","cjt/validator/domain-validators","cjt/validator/username-validators","cjt/directives/actionButtonDirective","app/services/domains","cjt/directives/validationContainerDirective","cjt/directives/validationItemDirective","cjt/directives/toggleSwitchDirective"],(function(e,t,i,n){"use strict";var o=new n,a="cpanel.domains.views.createDomain",r="createDomain";return t.module(a,["cpanel.domains.domains.service","ngRoute","cjt2.services.alert"]).controller(r,["$scope","$log","$location","$routeParams","$timeout","domains","alertService","domainTypes","DOMAIN_TYPE_CONSTANTS","PAGE","ZONE_EDITOR_APP_OBJ",function(n,a,r,s,c,l,d,u,m,h,p){var f={},_={};function g(){l.get().then((function(e){var t=e.filter((function(e){return!!e.canBeSuggested})).map((function(e){return e.domain}));o.loadSet(t)})),h.hasWebServerRole||(n.mustInheritDocumentRoot=!0)}function v(){n.creationDelayed=!0}function D(e){return l.findDomainByName(e)}function y(){if(n.newDomain.newDomainName)if(n.newDomain.domainType===m.ALIAS)n.newDomain.documentRoot=n.mainDomain.documentRoot.replace(n.mainDomain.homedir+"/",""),n.requirePublicHTMLSubs&&(n.newDomain.documentRoot=n.newDomain.documentRoot.replace(/^public_html/,"").replace(/^\//,"")),n.newDomain.fullDocumentRoot=n.mainDomain.documentRoot;else{var e=n.newDomain.newDomainName.replace("*","_wildcard_");n.newDomain.documentRoot=e,n.newDomain.fullDocumentRoot=l.generateFullDocumentRoot(e)}}function b(e){n.newDomain.subdomain=e}function w(){if(n.newDomain.newDomainName){var e=n.newDomain.newDomainName=n.newDomain.newDomainName.toLocaleLowerCase();if(n.newDomain.domainType="",n.newDomain.inheritDocumentRoot)n.newDomain.domainType=m.ALIAS;else{var t=e.split(".");if(t.length>2)for(var i,o=1;o<t.length;o++){if(D(i=t.slice(o).join("."))){n.newDomain.domainType=m.SUBDOMAIN,n.newDomain.domain=i,n.newDomain.subdomain=t.slice(0,o).join(".");break}}}n.newDomain.domainType||(n.newDomain.domainType=m.ADDON,n.newDomain.domain=n.mainDomain.domain)}}function S(e){n.newDomain.newDomainName=e,w(),y(),n.clearSuggestedDomains()}function T(){n.suggestedDomains=[]}t.extend(n,{creationMessages:[],DOMAIN_TYPE_CONSTANTS:m,submittingForm:!1,creationDelayed:!1,upgradeUrl:h.upgradeUrl,domainsConfig:h.domainsConfig||{showDocumentRoot:!0,showSubdomain:!0,showSubmitAnother:!0,returnUrl:"#/",returnText:i.maketext("Return to Domains")},documentRootPattern:l.getDocumentRootPattern(),suggestedDomains:[],domainTypes:u,requirePublicHTMLSubs:"1"===h.requirePublicHTMLSubs.toString(),shareDocrootDefault:"1"===h.shareDocrootDefault.toString(),mainDomain:l.getMainDomain(),newDomain:{},onDomainTypeChange:function(){n.isTemporaryDomain()&&(n.newDomain.newDomainName="")},isTemporaryDomain:function(){return"temporary"===n.newDomain.domainCreationMode},getFormFieldClasses:function(e){return e&&!e.$pristine&&e.$invalid?"col-xs-12 col-md-6":"col-xs-12"},resetForm:function(){n.newDomain.newDomainName="",n.newDomain.documentRoot="",n.newDomain.domainCreationMode="registered",n.shareDocrootDefault&&!n.mainDomainIsTemporary?n.newDomain.inheritDocumentRoot=n.canCreateDomainType(m.ALIAS):n.newDomain.inheritDocumentRoot=!1,w(),y(),b(n.newDomain.newDomainName)},createDomain:function(o,s,u,p){"temporary"===s.domainCreationMode&&(s.domainType=m.ADDON,s.createTemporaryDomain="1",s.newDomainName=null,s.documentRoot=null,s.subdomain=null,s.domain=null,s.fullDocumentRoot=null),n.submittingForm=!0;var f=c(v,1e3),_=t.copy(s);return h.hasWebServerRole||(a.debug("Because there is no webserver role on this system, the domain will be created as an alias domain."),_.domainType=m.ALIAS),l.add(_).then((function(s){var c;if(_.newDomainName=_.newDomainName||s.domain,_.fullDocumentRoot=_.fullDocumentRoot||s.documentRoot,a.debug("submittingDomainObj.fullDocumentRoot",_.fullDocumentRoot),c=h.hasWebServerRole?i.maketext("You have successfully created the new “[_1]” domain with the document root of “[_2]”.",_.newDomainName,e.escape(_.fullDocumentRoot)):i.maketext("You have successfully created the new “[_1]” domain.",_.newDomainName),d.add({type:"success",message:c}),u)g(),n.resetForm(),t.element(document).find("input[autofocus]").focus(),o.$setPristine();else{if(p)return p(_.newDomainName);r.path("/")}})).finally((function(){n.creationDelayed=!1,c.cancel(f),n.submittingForm=!1}))},onUpdateNewDomainName:function(){if(n.subdomain="",n.domain="",n.documentRoot="",n.newDomain.isWildcard=!1,n.newDomain.newDomainName){n.newDomain.newDomainName=n.newDomain.newDomainName.toLowerCase(),"*"===n.newDomain.newDomainName.substr(0,1)&&(n.newDomain.isWildcard=!0),function(e){var t=e.split(".");if(t.shift(),D(t.join(".")))return 1;return 0}(n.newDomain.newDomainName)&&(n.newDomain.inheritDocumentRoot=!1);var e=n.newDomain.newDomainName.split(".");e.length>=3&&function(e){var t=e.slice(e.length-2).join(".");e.pop(),e.pop();var i=!n.canCreateDomainType(m.ALIAS)&&!n.canCreateDomainType(m.ADDON),a=i?10:4,r=o.search(t),s=r.filter((function(e){return e.distance<a}));if(s.length){var c=e.join(".")+"."+r[0].match;n.newDomain.domain=l.getMainDomain().domain,n.clearSuggestedDomains(),c!==n.newDomain.newDomainName&&(n.suggestedDomains=s.slice(0,5).map((function(t){var n=e.join(".")+"."+t.match;return{domain:n,closeable:!i,use:function(){S(n)},cancel:T}})))}}(e),w(),y(),b(n.newDomain.newDomainName)}},useSuggestedDomain:S,clearSuggestedDomains:T,onToggleInheritDocumentRoot:function(){w(),y()},onDocumentRootUpdated:function(){n.newDomain.fullDocumentRoot=l.generateFullDocumentRoot(n.newDomain.documentRoot)},canCreateDomainType:function(e){if(!_[e])return!1;var t=function(e){return f[e]}(e);return("*."!==(n.newDomain.newDomainName||"").substr(0,2)||e!==m.ADDON&&e!==m.ALIAS)&&!t.overLimit},canCreateDomains:function(){return n.canCreateDomainType(m.ALIAS)||n.canCreateDomainType(m.ADDON)||n.canCreateDomainType(m.SUBDOMAIN)},inheritDocRootSelectionDisabled:function(){return!n.canCreateDomainType(m.ALIAS)||!n.canCreateDomainType(m.SUBDOMAIN)&&!n.canCreateDomainType(m.ADDON)}}),function(){if(n.temporaryDomainsDisabled=!!h.isDisabledTempDomains,n.newDomain.domainCreationMode="registered",n.mainDomain=l.getMainDomain(),n.mainDomainIsTemporary=n.mainDomain.is_temporary,u.forEach((function(e){f[e.value]=e,_[e.value]=h.features[e.value]})),n.resetForm(),s.domain&&(n.newDomain.newDomainName=s.domain,w(),y(),b(n.newDomain.newDomainName)),document.addEventListener("cp-alert-message",(function(e){n.$apply((function(){d.add({type:e.detail.type,message:e.detail.message,dismissible:void 0===e.detail.dismissible||e.detail.dismissible,replace:e.detail.replace||!1,id:e.detail.id,autoClose:e.detail.autoClose})}))})),g(),!h.hasWebServerRole&&p&&n.creationMessages.push({type:"info",message:i.maketext("Because this server does not use the “[_1]” role, the system creates new domains as separate zones. If you only need a [asis,DNS] entry, you can add the domain as new record on an existing zone in the [output,url,_2,_3,_4] interface.","WebServer",p.url,p.itemdesc,{_type:"offsite"})}),h.features.domain_recommendation){var e=r.search().mode;"temporary"!==e&&"registered"!==e||(n.newDomain.domainCreationMode=e)}}()}]),{namespace:a,controllerName:r}})),define("app/directives/tldPriorityInputDirective",["angular","cjt/util/locale"],(function(e,t){"use strict";var i="cpanel.domains.tldPriorityInput";function n(e){var t=(e||"").trim().toLowerCase();return t?("."!==t.charAt(0)&&(t="."+t),t):""}return e.module(i,[]).directive("tldPriorityInput",[function(){return{restrict:"E",scope:{priorities:"=",supportedTlds:"=",disabled:"=?",inputId:"@?"},templateUrl:"directives/tldPriorityInput.ptt",link:function(i){e.isArray(i.priorities)||(i.priorities=[]),i.tldForm={input:"",error:null},i.inputId=i.inputId||"tldPriorityInput",i.errorId=i.inputId+"Error",i.strings={heading:t.maketext("Filter TLDs"),description:t.maketext("A Top-Level Domain (TLD) is the last part of a domain name."),enterTldLabel:t.maketext("Enter a TLD"),addLabel:t.maketext("Add"),example:t.maketext("Ex: .com, .net"),selectedTldsLabel:t.maketext("Selected TLDs")},i.removeTldLabel=function(e){return t.maketext("Remove “[_1]”",e)},i.validateTldInput=function(){var e=n(i.tldForm.input);e&&i.supportedTlds&&i.supportedTlds.length?i.tldForm.error=-1===i.supportedTlds.indexOf(e)?t.maketext("“[_1]” is not a supported TLD.",e):null:i.tldForm.error=null},i.addTldPriority=function(){var o=n(i.tldForm.input);o&&(i.supportedTlds&&i.supportedTlds.length&&-1===i.supportedTlds.indexOf(o)?i.tldForm.error=t.maketext("“[_1]” is not a supported TLD.",o):(i.tldForm.error=null,e.isArray(i.priorities)||(i.priorities=[]),-1===i.priorities.indexOf(o)&&i.priorities.push(o),i.tldForm.input=""))},i.removeTldPriority=function(t){if(e.isArray(i.priorities)){var n=i.priorities.indexOf(t);-1!==n&&i.priorities.splice(n,1)}},i.handleTldKeydown=function(e){13===e.keyCode&&(e.preventDefault(),i.addTldPriority())}}}}]),{namespace:i}})),define("app/directives/domainSearchModalDirective",["angular","lodash","cjt/util/locale","uiBootstrap","app/services/domains","app/directives/tldPriorityInputDirective","cjt/services/alertService"],(function(e,t,i){"use strict";var n="cpanel.domains.domainSearchModal",o=e.module(n,["ui.bootstrap","cpanel.domains.domains.service","cpanel.domains.tldPriorityInput","cjt2.services.alert"]),a="directives/domainSearchModal.ptt",r="domain-search-modal-dialog",s=["$scope","$uibModalInstance","$sce","$timeout","$document","domains","alertService","options",function(n,o,a,r,s,c,l,d){var u=(d=d||{}).cachedExploreData||null,m=d.exploreDataPromise||null,h=d.source||"unknown",p="function"==typeof d.onAddDomain?d.onAddDomain:null;n.canAddDomain=!!p,n.loading=!1,n.searching=!1,n.searchQuery=d.initialQuery||"",n.showSearchOptions=!1;var f=Object.prototype.hasOwnProperty.call(d,"initialTldFilters");n.tldFilters=f&&e.isArray(d.initialTldFilters)?d.initialTldFilters.slice():[];var _=null,g=f;f||(_=c.getPrioritizedTlds().then((function(e){e&&e.length&&!n.tldFilters.length&&(n.tldFilters=e)})).finally((function(){g=!0}))),n.searchPerformed=!1,n.noResults=!1,n.featured=u?u.featured:[],n.available=u?u.available:[],!u&&m&&(n.loading=!0,m.then((function(e){n.searchPerformed||(e=e||{},n.featured=e.featured||[],n.available=e.available||[])})).catch((function(){})).finally((function(){n.loading=!1}))),n.matchedDomain=null,n.unavailableDomain=null,n.pendingSearchDomain=null,n.supportedTlds=null;var v=null,D=c.fetchStoreConfig().then((function(e){v=e})).catch((function(){v={}}));function y(){return v&&v.store_type&&"whmcs"===v.store_type.toLowerCase()?"whmcs":"unknown"}function b(e,t){window.mixpanel&&"function"==typeof window.mixpanel.track&&window.mixpanel.track(e,t||{})}c.fetchSupportedTlds().then((function(e){n.supportedTlds=e})).catch((function(){n.supportedTlds=[]})),n.highlightTld=function(e){var i=e.indexOf(".");if(-1===i)return a.trustAsHtml(t.escape(e));var n=e.substring(0,i),o=e.substring(i);return a.trustAsHtml(t.escape(n)+"<strong>"+t.escape(o)+"</strong>")},n.searchDomains=function(){if(n.searchQuery&&!n.searching)if(g||!_){n.searching=!0,n.searchPerformed=!0;var e=n.searchQuery.trim();n.loading=!1,D.finally((function(){b("Domain-Search-Started",{source:h,query:e,mode:y()})}));var t=n.tldFilters.length?n.tldFilters:null;c.setPrioritizedTlds(n.tldFilters);var o=e.toLowerCase(),a=-1!==o.indexOf(".");n.pendingSearchDomain=o,c.fetchRecommendations(e,t).then((function(e){n.matchedDomain=null,n.unavailableDomain=null;var t=e.explore.featured||[],i=e.explore.available||[];if(a){var r=function(e){for(var t=0;t<e.length;t++)if(e[t]&&e[t].domain&&e[t].domain.toLowerCase()===o)return t;return-1},s=r(t);if(-1!==s)n.matchedDomain=t[s],t=t.slice(0,s).concat(t.slice(s+1));else{var c=r(i);-1!==c&&(n.matchedDomain=i[c],i=i.slice(0,c).concat(i.slice(c+1)))}}n.matchedDomain?(i=t.concat(i),t=[]):a&&(n.unavailableDomain=o),n.featured=t,n.available=i})).catch((function(){n.matchedDomain=null,n.unavailableDomain=null,n.featured=[],n.available=[],l.add({type:"danger",message:i.maketext("The domain search failed. Try again.")})})).finally((function(){n.searching=!1,n.pendingSearchDomain=null,n.noResults=!n.featured.length&&!n.available.length}))}else _.finally((function(){n.searchDomains()}))},n.handleSearchKeydown=function(e){"Enter"===e.key&&n.searchDomains()},n.toggleSearchOptions=function(){n.showSearchOptions=!n.showSearchOptions},n.purchasingDomain=null,n.purchaseConfirmation=null,n.redirectFailed=!1,n.blockedPurchaseUrl=null,n.dismissBlockedPurchaseUrl=function(){r((function(){n.blockedPurchaseUrl=null,r((function(){R()}))}))},n.redirectSucceeded=!1;var w=null,S=null,T=0;function A(e,t){if("Tab"===e.key&&t){var i=Array.prototype.slice.call(t.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(i.length){var n=i[0],o=i[i.length-1],a=s[0].activeElement;e.shiftKey&&a===n?(o.focus(),e.preventDefault()):e.shiftKey||a!==o||(n.focus(),e.preventDefault())}else e.preventDefault()}}function k(){var e=w,t=S;w=null,S=null,r((function(){var i,n=null;t&&s[0].contains(t)&&(n=t),n||(n=function(e){if(!e)return null;var t=window.CSS&&"function"==typeof window.CSS.escape?window.CSS.escape(e):/^[A-Za-z0-9.\-]+$/.test(e)?e:null;if(!t)return null;var i='[data-purchase-domain="'+t+'"]';return s[0].querySelector(i)}(e)||((i=s[0]).querySelector("#domainSearchModalTitle")||i.querySelector("#domainSearchModalNoResultsTitle")||i.querySelector("#domainSearchModalPendingTitle")||i.querySelector("#domainSearchModalUnavailableTitle"))),n&&"function"==typeof n.focus&&n.focus()}))}function x(){n.redirectFailed=!0,r((function(){var e=s[0].querySelector("#domainSearchModalFailureTitle");e&&e.focus()}))}function R(){n.redirectSucceeded=!0,r((function(){var e=s[0].querySelector("#domainSearchModalSuccessTitle");e&&e.focus()}))}n.purchaseDomain=function(e,t){w=e&&e.domain?e.domain:null,S=t&&t.currentTarget?t.currentTarget:null,n.purchaseConfirmation=e,D.finally((function(){b("Domain-Purchase-Clicked",{domain:e&&e.domain?e.domain:null,mode:y(),source:h})})),r((function(){var e=s[0].querySelector("#domainSearchModalConfirmationTitle");e&&e.focus()}))},n.cancelPurchaseConfirmation=function(){T++,n.purchasingDomain=null,n.purchaseConfirmation=null,n.redirectFailed=!1,n.redirectSucceeded=!1,n.blockedPurchaseUrl=null,k()},n.handleConfirmationKeydown=function(e){"Escape"===e.key?(n.cancelPurchaseConfirmation(),e.stopPropagation(),e.preventDefault()):A(e,s[0].querySelector(".domain-search-modal__confirmation"))},n.confirmPurchase=function(){if(n.purchaseConfirmation&&!n.purchasingDomain){var e=n.purchaseConfirmation.domain;n.purchasingDomain=e,n.redirectFailed=!1,n.blockedPurchaseUrl=null;var t=++T;c.fetchDomainPurchaseUrl(e,1).then((function(i){if(t===T){var o=i&&i.purchase_url;if(o&&/^https?:\/\//i.test(o)){b("Domain-Retail-Store-Visited",{source:h,mode:y(),domain:e,store_url:o});var a=window.open(o,"_blank");a?(a.opener=null,n.redirectFailed=!1,R()):(n.blockedPurchaseUrl=o,r((function(){var e=s[0].getElementById("domainSearchPopupBlockedLink");e&&e.focus()})))}else x()}})).catch((function(){t===T&&x()})).finally((function(){t===T&&(n.purchasingDomain=null)}))}},n.dismissRedirectFailure=function(){n.cancelPurchaseConfirmation()},n.handleFailureKeydown=function(e){"Escape"===e.key?(n.redirectFailed=!1,e.stopPropagation(),e.preventDefault(),r((function(){var e=s[0].querySelector("#domainSearchModalConfirmationTitle");e&&e.focus()}))):A(e,s[0].querySelector(".domain-search-modal__confirmation"))},n.dismissRedirectSuccess=function(){n.closeModal()},n.addPurchasedDomain=function(){var e=n.purchaseConfirmation&&n.purchaseConfirmation.domain;p&&e&&(b("Domain-Add-After-Purchase-Clicked",{source:h,mode:y(),domain:e}),n.closeModal(),p(e))},n.handleSuccessKeydown=function(e){"Escape"===e.key?(n.dismissRedirectSuccess(),e.stopPropagation(),e.preventDefault()):A(e,s[0].querySelector(".domain-search-modal__confirmation"))},n.closeModal=function(){o.dismiss("cancel")},d.autoSearch&&n.searchQuery&&n.searchDomains()}];return o.factory("domainSearchModalService",["$uibModal","$document",function(e,t){return{TEMPLATE_URL:a,WINDOW_CLASS:r,ModalController:s,open:function(i){var n=e.open({templateUrl:a,windowClass:r,controller:s,resolve:{options:function(){return i||{}}}});return n.rendered.then((function(){var e=t[0].querySelector("."+r+" [role='dialog']");e&&e.setAttribute("aria-labelledby","domainSearchModalTitle domainSearchModalNoResultsTitle domainSearchModalPendingTitle domainSearchModalUnavailableTitle domainSearchModalConfirmationTitle domainSearchModalSuccessTitle domainSearchModalFailureTitle")})),n}}}]),{namespace:n,ModalController:s}})),define("app/views/manageDomain",["angular","lodash","cjt/util/locale","cjt/modules","cjt/directives/callout","cjt/directives/actionButtonDirective","app/services/domains","app/directives/domainSearchModalDirective","cjt/services/cpanel/nvDataService"],(function(e,t,i){"use strict";var n="cpanel.domains.views.manageDomain";e.module(n,["cpanel.domains.domains.service","ngRoute","cjt2.services.alert"]).controller("manageDomain",["$scope","$location","$routeParams","$q","$timeout","$sce","domains","alertService","DOMAIN_TYPE_CONSTANTS","PAGE","nvDataService","domainSearchModalService",function(n,o,a,r,s,c,l,d,u,m,h,p){function f(){var i=e.copy(n.currentDomain);i.fullDocumentRoot=i.documentRoot,i.renameDomainConfirmed=!1;var o=i.documentRoot,a=i.homedir;if(o){var r=new RegExp("^"+t.escapeRegExp(a)+"(/)?");o=o.replace(r,""),n.requirePublicHTMLSubs&&(o=o.replace(/^public_html/,"").replace(/^\//,"")),i.documentRoot=o}return i}function _(){n.deletionDelayed=!0}e.extend(n,{associatedDomains:[],deletionDelayed:!1,temporaryDomainReplacementPending:!1,domainRenamePending:!1,domainRemovePending:!1,renameDomainLinkClicked:!1,currentDomain:l.findDomainByName(a.domain),requirePublicHTMLSubs:"1"===m.requirePublicHTMLSubs.toString(),webserverRoleAvailable:m.hasWebServerRole,mainDomain:l.getMainDomain(),getFormFieldClasses:function(e){return e&&!e.$pristine&&e.$invalid?"col-xs-12 col-md-6":"col-xs-12"},documentRootPattern:l.getDocumentRootPattern(),toggleAdvancedDetailFields:function(){n.showAdvancedDetailFields=!n.showAdvancedDetailFields},update:function(e,o){var a="updating_"+o.domain,s=l.generateFullDocumentRoot(o.documentRoot);if(o.rootDomain){var c=[];return e.newDocumentRoot.$pristine||c.push(l.updateDocumentRoot(o.domain,s).then((function(){d.add({type:"success",id:a,replace:!0,message:i.maketext("You have successfully updated the document root to “[_1]” for the “[_2]” domain.",t.escape(s),o.domain)}),n.workingDomain=f()}),(function(){d.removeById(a)}))),c.length?r.all(c):void 0}d.add({type:"danger",id:a,replace:!0,message:i.maketext("The domain userdata file for the “[_1]” domain appears to be missing.",o.domain)})},replace:function(e){n.temporaryDomainReplacementPending=!0;const a=l.generateFullDocumentRoot(e.documentRoot),r={documentRoot:e.documentRoot,domain:e.domain,newDomainName:e.newDomainName};return l.replaceTemporaryDomain(r).then((function(){d.add({type:"success",message:i.maketext("The domain “[_1]” has been converted to “[_2]”. Its document root is now “[_3]”.",r.domain,r.newDomainName,t.escape(a)),replace:!1});var e=l.findDomainByName(r.newDomainName);e&&(n.currentDomain=e,n.workingDomain=f()),n.replaceDomainLinkClicked=!1,o.search("domain",r.newDomainName),n.temporaryDomainReplacementPending=!1}))},renameDomain:function(e){var t=e.newDomainName;if(t){if(t!==e.domain){n.domainRenamePending=!0;var a={domain:e.domain,newDomainName:t};return l.renameDomain(a).then((function(){var t;t=e.is_temporary?i.maketext("The temporary domain “[_1]” has been replaced with “[_2]”.",a.domain,a.newDomainName):i.maketext("The domain “[_1]” has been renamed to “[_2]”.",a.domain,a.newDomainName),d.add({type:"success",message:t,replace:!1}),n.workingDomain.domain=a.newDomainName,n.workingDomain.is_temporary=!1,n.currentDomain.domain=a.newDomainName,n.currentDomain.is_temporary=!1,n.workingDomain.newDomainName="",n.workingDomain.renameDomainConfirmed=!1,n.renameDomainLinkClicked=!1,n.domainRenamePending=!1;var r=l.findDomainByName(a.newDomainName);r&&(n.currentDomain=r,n.workingDomain=f(),n.workingDomain.newDomainName=""),o.search("domain",a.newDomainName)})).catch((function(e){throw n.domainRenamePending=!1,n.workingDomain.renameDomainConfirmed=!1,e}))}d.add({type:"danger",message:i.maketext("The new domain must differ from the current domain."),replace:!0})}},confirmingRemoval:!1,removeDomain:function(){if(n.currentDomain.rootDomain){var e=s(_,1e3);return n.domainRemovePending=!0,l.remove(n.currentDomain.domain).then((function(){d.add({message:i.maketext("The system removed the “[_1]” domain and any associated redirections.",n.currentDomain.domain),type:"success"}),l.invalidate(),o.path("/").search("")})).finally((function(){n.deletionDelayed=!1,n.domainRemovePending=!1,s.cancel(e)}))}d.add({type:"danger",replace:!0,message:i.maketext("The domain userdata file for the “[_1]” domain appears to be missing.",n.currentDomain.domain)})},startRemovalConfirmation:function(){n.confirmingRemoval=!0},cancelRemoval:function(){n.confirmingRemoval=!1},deleteDependentDomainsError:function(e,t){return i.maketext("The system created the “[_1]” subdomain when it created the “[_2]” domain. To delete this subdomain, you must first delete the following [numerate,_3,domain,domains]:",e,t[0].domain,t.length)},replaceDomainLinkClicked:!1,toggleReplaceDomainSection:function(){n.replaceDomainLinkClicked=!n.replaceDomainLinkClicked},toggleRenameDomainSection:function(){n.renameDomainLinkClicked=!n.renameDomainLinkClicked,n.renameDomainLinkClicked?s((function(){var e=document.getElementById("renameDomainName");e&&e.focus()})):(n.workingDomain.newDomainName="",n.workingDomain.renameDomainConfirmed=!1,s((function(){var e=document.getElementById("rename_domain_link");e&&e.focus()})))},onUpdateNewDomainName:function(){n.workingDomain.newDomainName&&(n.workingDomain.documentRoot=n.workingDomain.newDomainName,n.workingDomain.fullDocumentRoot=l.generateFullDocumentRoot(n.workingDomain.newDomainName),n.workingDomain.subdomain=n.workingDomain.newDomainName)},currentDomainIsTemporaryMainDomain:function(){const e=n.workingDomain.type===u.MAIN;return(!0===n.mainDomain.is_temporary||"1"===String(n.mainDomain.is_temporary))&&e}}),n.domainRecommendationsEnabled=!!m.features.domain_recommendation,n.domainRecommendations=[],n.domainRecommendationPrice="",n.domainRecsLoading=!1;var g=null,v=null;if(n.domainRecsBannerDismissed=!!m.domainRecsBannerDismissed,n.domainRecommendationsEnabled&&!n.domainRecsBannerDismissed&&!n.currentDomain.is_temporary){var D=l.findDomainByName(a.domain);D&&D.domain&&(n.domainRecsLoading=!0,v=l.fetchRecommendations(D.domain).then((function(e){return n.domainRecommendations=e.banner.recommendations,e.banner.lowestPrice&&(n.domainRecommendationPrice=e.banner.lowestPrice+" / "+i.maketext("year")),g=e.explore})).catch((function(e){return console.error("Failed to load domain recommendations:",e),null})).finally((function(){n.domainRecsLoading=!1})))}n.dismissDomainRecommendations=function(){n.domainRecsBannerDismissed=!0,h.set("domain_recs_banner_dismissed","1",{nocache:!0}).catch((function(e){console.error("Failed to save banner dismissal:",e)}))},n.openExploreDomains=function(){p.open({cachedExploreData:g,source:"manage-domain-upsell-banner",exploreDataPromise:v,onAddDomain:function(e){l.setPendingAddDomain(e),o.path("/").search("")}})},n.currentDomain||(d.add({message:i.maketext("You did not specify a domain to manage."),type:"danger"}),o.path("/").search("")),n.showAdvancedDetailFields=!1,n.showSubdomainInDetails=n.currentDomain.type===u.ADDON,u.SUBDOMAIN===n.currentDomain.type&&l.get().then((function(e){e.forEach((function(e){e.subdomain===n.currentDomain.subdomain&&e.type===u.ADDON&&n.associatedDomains.push(e)}))})),n.canUpdateDocumentRoot=n.currentDomain.type!==u.ALIAS,n.workingDomain=f()}]);return{namespace:n}})),define("app/directives/tableShowingDirective",["angular","cjt/util/locale","cjt/core"],(function(e,t,i){"use strict";e.module("cpanel.domains.tableShowing.directive",[]).directive("tableShowing",(function(){var e="directives/tableShowingDirective.phtml",n="domains/"+e;return{templateUrl:i.config.debug?i.buildFullPath(n):e,restrict:"EA",scope:{start:"=",limit:"=",total:"="},transclude:!0,controller:["$scope",function(e){e.getShowingText=function(){return t.maketext("Displaying [numf,_1] through [numf,_2] out of [quant,_3,item,items]",e.start,e.limit,e.total)}}]}}))})),define("app/directives/itemLister",["angular","cjt/util/locale","cjt/core","ngRoute","ngSanitize","cjt/modules","app/directives/tableShowingDirective","cjt/services/cpanel/componentSettingSaverService","app/services/domains","cjt/directives/toggleSortDirective","cjt/directives/searchDirective","cjt/directives/pageSizeDirective","cjt/filters/startFromFilter","cjt/decorators/paginationDecorator"],(function(e,t,i){"use strict";var n=e.module("cpanel.domains.itemLister.directive",["cpanel.domains.tableShowing.directive","ngRoute","ngSanitize","cjt2.filters.startFrom"]);n.value("PAGE",PAGE),n.directive("itemLister",["$window","$log","componentSettingSaverService","PAGE",function(n,o,a,r){var s="domainsItemLister",c="directives/itemLister.ptt",l="domains/"+c;return{templateUrl:i.config.debug?i.buildFullPath(l):c,restrict:"EA",scope:{parentID:"@id",items:"=",headerItems:"=",configurationOptions:"="},transclude:!0,replace:!0,link:function(t,i,n,o){var a,r;function s(i){e.element(i).hasClass("lister-controls")?function(e){a.append(e)}(i):function(e){e.setAttribute("id",t.parentID+"_transcludePoint"),e.setAttribute("ng-if","filteredItems.length"),r.replaceWith(e)}(i)}setTimeout((function(){a=i.find("#"+t.parentID+"_transcludedControls"),r=i.find("#"+t.parentID+"_transcludePoint");var n=i.find("div.transcluded"),o=n.children();e.forEach(o,s),n.remove()}),2)},controller:["$routeParams","$scope","$filter","ITEM_LISTER_CONSTANTS","domains","alertService",function(i,c,l,d,u,m){c.redirectSelection=1,c.viewCallbacks=[],c.webserverRoleAvailable=r.hasWebServerRole;var h={filter:l("filter"),orderBy:l("orderBy"),startFrom:l("startFrom"),limitTo:l("limitTo")};function p(e){if(!c.loadingInitialState){var t={totalItems:c.totalItems,currentPage:c.currentPage,pageSize:c.pageSize,start:c.start,limit:c.limit,lastInteractedItem:e,filterValue:c.filterValue,sort:{sortDirection:c.sort.sortDirection,sortBy:c.sort.sortBy}};a.set(s,t)}}this.registerViewCallback=function(e){c.viewCallbacks.push(e),e(c.filteredItems)},this.getHeaderItems=function(){return c.headerItems},this.deregisterViewCallback=function(e){for(var t=c.viewCallbacks.length-1;t>=0;t--)c.viewCallbacks[t]===e&&c.viewCallbacks.splice(t,1)},c.fetch=function(){var t=[];return t=function(e){return""!==c.filterValue?h.filter(e,c.filterValue,!1):e}(c.items),c.totalItems=t.length,t=function(e){if(c.totalItems>_.min(c.pageSizes)){var t=(c.currentPage-1)*c.pageSize,i=c.pageSize;e=h.startFrom(e,t),e=h.limitTo(e,i),c.showPager=!0,c.start=t+1,c.limit=t+e.length}else c.showPager=!1,0===e.length?c.start=0:c.start=1,c.limit=e.length;return e}(t=function(e){return""!==c.sort.sortDirection&&""!==c.sort.sortBy?("batchSelect"===c.sort.sortBy&&(c.sort.sortBy="domain"),h.orderBy(e,c.sort.sortBy,"asc"!==c.sort.sortDirection)):e}(t)),c.filteredItems=t,p(),e.forEach(c.viewCallbacks,(function(e){e(c.filteredItems)})),c.$emit(d.ITEM_LISTER_UPDATED_EVENT,{meta:{filterValue:c.filterValue}}),t},c.focusSearch=function(){e.element(document).find("#"+c.parentID+"_search_input").focus(),n.scrollTop=0},c.configurationClicked=function(e){c.$emit(e)},c.$on(d.TABLE_ITEM_BUTTON_EVENT,(function(e,t){t.interactionID&&p(t.interactionID)})),c.$on(d.ITEM_SELECT_EVENT,(function(e,t){for(var i=!0,n=u.getCurrentDomains(),o=0;o<n.length;o++)if(!n[o].selected){i=!1;break}c.selectAll=i})),e.extend(c,{maxPages:5,totalItems:c.items.length,filteredItems:[],currentPage:1,pageSize:20,pageSizes:[20,50,100,500],start:0,limit:20,filterValue:"",sort:{sortDirection:"asc",sortBy:c.headerItems.length?c.headerItems[0].field:""}},{filterValue:i.q});var f=a.register(s);f&&(c.loadingInitialState=!0,f.then((function(t){e.extend(c,t,{filterValue:i.q})}),o.error).finally((function(){c.loadingInitialState=!1,c.fetch()}))),this.showConfigColumn=c.showConfigColumn=c.configurationOptions&&c.configurationOptions.length,c.$on("$destroy",(function(){a.unregister(s)})),c.fetch(),c.canRedirectHTTPS=u.canRedirectHTTPS(),c.$watch("items",c.fetch),c.toggleSelectAll=function(){for(var e=u.getCurrentDomains(),t=0;t<e.length;t++)c.canRedirectHTTPS?e[t].nonHTTPS&&!e[t].isHttpsRedirecting||(e[t].selected=c.selectAll):e[t].isHttpsRedirecting&&(e[t].selected=c.selectAll)},c.hasSelected=function(){for(var e=u.getCurrentDomains(),t=0;t<e.length;t++)if(e[t].selected)return!0;return!1},c.applyMultiSecureRedirects=function(e){var i,n,o=u.getCurrentDomains();e?(i=t.maketext("Force [asis,HTTPS] Redirect is enabled for the selected domains."),n=t.maketext("The system failed to enable Force [asis,HTTPS] Redirect.")):(i=t.maketext("Force [asis,HTTPS] Redirect is disabled for the selected domains."),n=t.maketext("The system failed to disable Force [asis,HTTPS] Redirect.")),c.hasSelected()&&u.toggleHTTPSRedirect(e).then((function(t){if(t.status){for(var a=0;a<o.length;a++)if(o[a].selected){o[a].selected=!1,o[a].isHttpsRedirecting=e;var r=document.getElementById(o[a].domain+"_domain_link");if(void 0!==r){var s=o[a].isHttpsRedirecting?"https":"http";r.href=s+"://"+o[a].domain}}c.selectAll=!1,c.toggleSelectAll(),m.add({message:i,type:"success",autoClose:1e4})}else m.add({message:n,type:"danger"})}))}}]}}])})),define("app/directives/docrootDirective",["angular","lodash","cjt/core"],(function(e,t,i){"use strict";var n=e.module("cpanel.domains.docroot.directive",[]);n.value("PAGE",PAGE),n.directive("docroot",(function(){var e="directives/docrootDirective.phtml",n="domains/"+e;return{templateUrl:i.config.debug?i.buildFullPath(n):e,restrict:"E",scope:{parentID:"@id",rawDocroot:"@docroot",homedir:"@"},controller:["$scope","PAGE",function(e,i){function n(i){e.fullDocroot=encodeURIComponent(i);var n=new RegExp("^"+t.escapeRegExp(e.homedir)+"/?");return e.docroot=i.replace(n,""),e.docroot="/"===e.docroot?"":e.docroot,e.docroot}var o="cpanel"===i.APP_NAME;e.fileManager=!1,o&&i.fileManagerAppObj&&(e.fileManager={url:"../"+i.fileManagerAppObj.url,target:i.fileManagerAppObj.target||"_blank"}),e.$watch("rawDocroot",n),n(e.rawDocroot)}]}}))})),define("app/directives/domainListerViewDirective",["lodash","angular","cjt/core","cjt/util/locale","app/directives/docrootDirective","app/services/domains"],(function(e,t,i,n){"use strict";var o=t.module("cpanel.domains.domainListerView.directive",["cpanel.domains.docroot.directive"]);o.value("PAGE",PAGE),o.directive("domainListerView",(function(){var t="directives/domainListerViewDirective.ptt",o="domains/"+t;return{templateUrl:i.config.debug?i.buildFullPath(o):t,restrict:"EA",replace:!0,require:"^itemLister",link:function(e,t,i,n){e.domains=[],e.showConfigColumn=n.showConfigColumn,e.headerItems=n.getHeaderItems(),e.updateView=function(t){e.domains=t},e.scope=e,n.registerViewCallback(e.updateView.bind(e)),e.$on("$destroy",(function(){n.deregisterViewCallback(e.updateView)}))},controller:["$scope","ITEM_LISTER_CONSTANTS","DOMAIN_TYPE_CONSTANTS","PAGE","domains","alertService",function(t,i,o,a,r,s){t.isRTL=a.isRTL,t.DOMAIN_TYPE_CONSTANTS=o,t.EMAIL_ACCOUNTS_APP_EXISTS=a.EMAIL_ACCOUNTS_APP_EXISTS,t.webserverRoleAvailable=a.hasWebServerRole,t.canRedirectHTTPS=r.canRedirectHTTPS(),t.getDomains=function(){for(var i=0;i<t.domains.length;i++)t.domains[i].domain=e.escape(t.domains[i].domain),t.domains[i].homedir=e.escape(t.domains[i].homedir);return t.domains},t.actionButtonClicked=function(e,n){t.$emit(i.TABLE_ITEM_BUTTON_EVENT,{actionType:e,item:n,interactionID:n.domain})},t.itemSelected=function(e){t.$emit(i.ITEM_SELECT_EVENT,e)},t.HTTPSRedirectWarning=n.maketext("You cannot activate [asis,HTTPS] Redirect because [asis,AutoSSL] is not currently active for this domain or the [asis,SSL] certificate is not valid."),t.AliasRowWarning=n.maketext("Addon and parked domains inherit their [asis,HTTPS] redirect status from their associated subdomain."),t.AliasWarning=n.maketext("Some aliases for this domain may not have a working SSL certificate configured."),t.setSingleDomainHTTPSRedirect=function(e){var t,i;e.isHttpsRedirecting=!e.isHttpsRedirecting,e.isHttpsRedirecting?(t=n.maketext("Force [asis,HTTPS] Redirect is enabled for the “[_1]” domain.",e.domain),i=n.maketext("The system failed to enable Force [asis,HTTPS] Redirect.")):(t=n.maketext("Force [asis,HTTPS] Redirect is disabled for the “[_1]” domain.",e.domain),i=n.maketext("The system failed to disable Force [asis,HTTPS] Redirect.")),r.toggleHTTPSRedirect(e.isHttpsRedirecting,e.domain).then((function(n){if(n.status){var o=document.getElementById(e.domain+"_domain_link");if(void 0!==o){var a=e.isHttpsRedirecting?"https":"http";o.href=a+"://"+e.domain}s.add({message:t,type:"success",autoClose:1e4})}else s.add({message:i,type:"danger"})}))},t.onCreateEmailClick=function(e,t){t.is_temporary&&e.preventDefault()}}]}}))})),define("app/validators/subdomain",["angular","cjt/util/locale","cjt/validator/validator-utils","cjt/io/api2-request","cjt/io/api2","cjt/modules","cjt/services/APIService","cjt/validator/validateDirectiveFactory","app/services/domains"],(function(e,t,i,n){"use strict";var o=null,a=null;function r(e){console.error(e)}var s={_pattern:function(){return o},_reservedSubdomains:function(){return a},_processReservedSubdomains:function(e){a=null,e&&e.data&&(a=[],a=e.data.map((function(e){return e})))},_processSubdomainRegex:function(e){if(o=null,e&&e.data){var t=e.data.pop();o=new RegExp(t)}}},c={validSubdomain:function(e){var n=i.initializeValidationResult(),o=s._pattern();return!e||o&&o.test(e)||(n.isValid=!1,n.add("validSubdomain",t.maketext("You must enter a valid subdomain."))),n},notReservedSubdomain:function(e){var n=i.initializeValidationResult(),o=s._reservedSubdomains();return!e||o&&-1===o.indexOf(e)||(n.isValid=!1,n.add("notReservedSubdomain",t.maketext("The server reserves this subdomain for system use only. Enter a different subdomain."))),n}};return e.module("cjt2.validate").run(["validatorFactory","APIService",function(e,t){var i=new n.Class;i.initialize("SubDomain","validregex"),t.promise(i).then(s._processSubdomainRegex,r);var o=new n.Class;o.initialize("SubDomain","getreservedsubdomains"),t.promise(o).then(s._processReservedSubdomains,r),e.generate(c)}]),{methods:c,factoryMethods:s,name:"valid-subdomain",description:"Validation to subdomain is not reserved and matches the proper format.",version:1}})),define("app/validators/domainIsUnique",["angular","cjt/util/locale","cjt/validator/validator-utils","cjt/validator/validateDirectiveFactory","app/services/domains"],(function(e,t,i){"use strict";var n,o={_processLoadedDomains:function(e){return n=null,e&&(n={},e.forEach((function(e){n[e.domain]=e}))),n},_getDomains:function(){return n}},a={domainIsUnique:function(e){var n=i.initializeValidationResult(),a=o._getDomains();return(!a||e&&a[e])&&(n.isValid=!1,n.add("domainIsUnique",t.maketext("This domain already exists on this account."),"domainIsUnique")),n}};return e.module("cjt2.validate").run(["validatorFactory","$q","domains",function(e,t,i){var n={domainIsUnique:function(e){return i.get().then((function(i){o._processLoadedDomains(i);var n=a.domainIsUnique(e);return t.resolve(n)}))}};n.domainIsUnique.async=!0,e.generate(n,t)}]),{methods:a,factoryMethods:o,name:"domain-is-unique",description:"Validation to ensure domain is unique for this account.",version:1}})),function(e){define("jquery-chosen",["jquery"],(function(){return function(){
/*!
Chosen, a Select Box Enhancer for jQuery and Prototype
by Patrick Filler for Harvest, http://getharvest.com
Version 1.5.1
Full source at https://github.com/harvesthq/chosen
Copyright (c) 2011-2016 Harvest http://getharvest.com
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
This file is generated by `grunt build`, do not edit it by hand.
*/
(function(){var e,t,i,n,o={}.hasOwnProperty;n=function(){function e(){this.options_index=0,this.parsed=[]}return e.prototype.add_node=function(e){return"OPTGROUP"===e.nodeName.toUpperCase()?this.add_group(e):this.add_option(e)},e.prototype.add_group=function(e){var t,i,n,o,a,r;for(t=this.parsed.length,this.parsed.push({array_index:t,group:!0,label:this.escapeExpression(e.label),title:e.title?e.title:void 0,children:0,disabled:e.disabled,classes:e.className}),r=[],n=0,o=(a=e.childNodes).length;n<o;n++)i=a[n],r.push(this.add_option(i,t,e.disabled));return r},e.prototype.add_option=function(e,t,i){if("OPTION"===e.nodeName.toUpperCase())return""!==e.text?(null!=t&&(this.parsed[t].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:e.value,text:e.text,html:e.innerHTML,title:e.title?e.title:void 0,selected:e.selected,disabled:!0===i?i:e.disabled,group_array_index:t,group_label:null!=t?this.parsed[t].label:null,classes:e.className,style:e.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},e.prototype.escapeExpression=function(e){var t,i;return null==e||!1===e?"":/[\&\<\>\"\'\`]/.test(e)?(t={"<":"<",">":">",'"':""","'":"'","`":"`"},i=/&(?!\w+;)|[\<\>\"\'\`]/g,e.replace(i,(function(e){return t[e]||"&"}))):e},e}(),n.select_to_array=function(e){var t,i,o,a,r;for(i=new n,o=0,a=(r=e.childNodes).length;o<a;o++)t=r[o],i.add_node(t);return i.parsed},t=function(){function e(t,i){this.form_field=t,this.options=null!=i?i:{},e.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return e.prototype.set_default_values=function(){var e=this;return this.click_test_action=function(t){return e.test_active_click(t)},this.activate_action=function(t){return e.activate_field(t)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text&&this.options.allow_single_deselect,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null==this.options.enable_split_word_search||this.options.enable_split_word_search,this.group_search=null==this.options.group_search||this.options.group_search,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null==this.options.single_backstroke_delete||this.options.single_backstroke_delete,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null==this.options.display_selected_options||this.options.display_selected_options,this.display_disabled_options=null==this.options.display_disabled_options||this.options.display_disabled_options,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY},e.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||e.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||e.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||e.default_no_result_text},e.prototype.choice_label=function(e){return this.include_group_label_in_selected&&null!=e.group_label?"<b class='group-name'>"+e.group_label+"</b>"+e.html:e.html},e.prototype.mouse_enter=function(){return this.mouse_on_container=!0},e.prototype.mouse_leave=function(){return this.mouse_on_container=!1},e.prototype.input_focus=function(e){var t=this;if(this.is_multiple){if(!this.active_field)return setTimeout((function(){return t.container_mousedown()}),50)}else if(!this.active_field)return this.activate_field()},e.prototype.input_blur=function(e){var t=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout((function(){return t.blur_test()}),100)},e.prototype.results_option_build=function(e){var t,i,n,o,a,r,s;for(t="",o=0,a=0,r=(s=this.results_data).length;a<r&&(n="",""!==(n=(i=s[a]).group?this.result_add_group(i):this.result_add_option(i))&&(o++,t+=n),(null!=e?e.first:void 0)&&(i.selected&&this.is_multiple?this.choice_build(i):i.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(i))),!(o>=this.max_shown_results));a++);return t},e.prototype.result_add_option=function(e){var t,i;return e.search_match&&this.include_option_in_results(e)?(t=[],e.disabled||e.selected&&this.is_multiple||t.push("active-result"),!e.disabled||e.selected&&this.is_multiple||t.push("disabled-result"),e.selected&&t.push("result-selected"),null!=e.group_array_index&&t.push("group-option"),""!==e.classes&&t.push(e.classes),(i=document.createElement("li")).className=t.join(" "),i.style.cssText=e.style,i.setAttribute("data-option-array-index",e.array_index),i.innerHTML=e.search_text,e.title&&(i.title=e.title),this.outerHTML(i)):""},e.prototype.result_add_group=function(e){var t,i;return(e.search_match||e.group_match)&&e.active_options>0?((t=[]).push("group-result"),e.classes&&t.push(e.classes),(i=document.createElement("li")).className=t.join(" "),i.innerHTML=e.search_text,e.title&&(i.title=e.title),this.outerHTML(i)):""},e.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},e.prototype.reset_single_select_options=function(){var e,t,i,n,o;for(o=[],t=0,i=(n=this.results_data).length;t<i;t++)(e=n[t]).selected?o.push(e.selected=!1):o.push(void 0);return o},e.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},e.prototype.results_search=function(e){return this.results_showing?this.winnow_results():this.results_show()},e.prototype.winnow_results=function(){var e,t,i,n,o,a,r,s,c,l,d,u;for(this.no_results_clear(),n=0,e=(a=this.get_search_text()).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),c=new RegExp(e,"i"),i=this.get_search_regex(e),l=0,d=(u=this.results_data).length;l<d;l++)(t=u[l]).search_match=!1,o=null,this.include_option_in_results(t)&&(t.group&&(t.group_match=!1,t.active_options=0),null!=t.group_array_index&&this.results_data[t.group_array_index]&&(0===(o=this.results_data[t.group_array_index]).active_options&&o.search_match&&(n+=1),o.active_options+=1),t.search_text=t.group?t.label:t.html,t.group&&!this.group_search||(t.search_match=this.search_string_match(t.search_text,i),t.search_match&&!t.group&&(n+=1),t.search_match?(a.length&&(r=t.search_text.search(c),s=t.search_text.substr(0,r+a.length)+"</em>"+t.search_text.substr(r+a.length),t.search_text=s.substr(0,r)+"<em>"+s.substr(r)),null!=o&&(o.group_match=!0)):null!=t.group_array_index&&this.results_data[t.group_array_index].search_match&&(t.search_match=!0)));return this.result_clear_highlight(),n<1&&a.length?(this.update_results_content(""),this.no_results(a)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},e.prototype.get_search_regex=function(e){var t;return t=this.search_contains?"":"^",new RegExp(t+e,"i")},e.prototype.search_string_match=function(e,t){var i,n,o,a;if(t.test(e))return!0;if(this.enable_split_word_search&&(e.indexOf(" ")>=0||0===e.indexOf("["))&&(n=e.replace(/\[|\]/g,"").split(" ")).length)for(o=0,a=n.length;o<a;o++)if(i=n[o],t.test(i))return!0},e.prototype.choices_count=function(){var e,t,i;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,e=0,t=(i=this.form_field.options).length;e<t;e++)i[e].selected&&(this.selected_option_count+=1);return this.selected_option_count},e.prototype.choices_click=function(e){if(e.preventDefault(),!this.results_showing&&!this.is_disabled)return this.results_show()},e.prototype.keyup_checker=function(e){var t,i;switch(t=null!=(i=e.which)?i:e.keyCode,this.search_field_scale(),t){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(e.preventDefault(),this.results_showing)return this.result_select(e);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:case 18:break;default:return this.results_search()}},e.prototype.clipboard_event_checker=function(e){var t=this;return setTimeout((function(){return t.results_search()}),50)},e.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},e.prototype.include_option_in_results=function(e){return!(this.is_multiple&&!this.display_selected_options&&e.selected)&&(!(!this.display_disabled_options&&e.disabled)&&!e.empty)},e.prototype.search_results_touchstart=function(e){return this.touch_started=!0,this.search_results_mouseover(e)},e.prototype.search_results_touchmove=function(e){return this.touch_started=!1,this.search_results_mouseout(e)},e.prototype.search_results_touchend=function(e){if(this.touch_started)return this.search_results_mouseup(e)},e.prototype.outerHTML=function(e){var t;return e.outerHTML?e.outerHTML:((t=document.createElement("div")).appendChild(e),t.innerHTML)},e.browser_is_supported=function(){return!/iP(od|hone)/i.test(window.navigator.userAgent)&&((!/Android/i.test(window.navigator.userAgent)||!/Mobile/i.test(window.navigator.userAgent))&&(!/IEMobile/i.test(window.navigator.userAgent)&&(!/Windows Phone/i.test(window.navigator.userAgent)&&(!/BlackBerry/i.test(window.navigator.userAgent)&&(!/BB10/i.test(window.navigator.userAgent)&&("Microsoft Internet Explorer"!==window.navigator.appName||document.documentMode>=8))))))},e.default_multiple_text="Select Some Options",e.default_single_text="Select an Option",e.default_no_result_text="No results match",e}(),(e=jQuery).fn.extend({chosen:function(n){return t.browser_is_supported()?this.each((function(t){var o,a;a=(o=e(this)).data("chosen"),"destroy"!==n?a instanceof i||o.data("chosen",new i(this,n)):a instanceof i&&a.destroy()})):this}}),i=function(t){function i(){return i.__super__.constructor.apply(this,arguments)}return function(e,t){for(var i in t)o.call(t,i)&&(e[i]=t[i]);function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype}(i,t),i.prototype.setup=function(){return this.form_field_jq=e(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field_jq.hasClass("chosen-rtl")},i.prototype.set_up_html=function(){var t,i;return(t=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&t.push(this.form_field.className),this.is_rtl&&t.push("chosen-rtl"),i={class:t.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(i.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=e("<div />",i),this.is_multiple?this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'):this.container.html('<a class="chosen-single chosen-default"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},i.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},i.prototype.register_observers=function(){var e=this;return this.container.bind("touchstart.chosen",(function(t){return e.container_mousedown(t),t.preventDefault()})),this.container.bind("touchend.chosen",(function(t){return e.container_mouseup(t),t.preventDefault()})),this.container.bind("mousedown.chosen",(function(t){e.container_mousedown(t)})),this.container.bind("mouseup.chosen",(function(t){e.container_mouseup(t)})),this.container.bind("mouseenter.chosen",(function(t){e.mouse_enter(t)})),this.container.bind("mouseleave.chosen",(function(t){e.mouse_leave(t)})),this.search_results.bind("mouseup.chosen",(function(t){e.search_results_mouseup(t)})),this.search_results.bind("mouseover.chosen",(function(t){e.search_results_mouseover(t)})),this.search_results.bind("mouseout.chosen",(function(t){e.search_results_mouseout(t)})),this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",(function(t){e.search_results_mousewheel(t)})),this.search_results.bind("touchstart.chosen",(function(t){e.search_results_touchstart(t)})),this.search_results.bind("touchmove.chosen",(function(t){e.search_results_touchmove(t)})),this.search_results.bind("touchend.chosen",(function(t){e.search_results_touchend(t)})),this.form_field_jq.bind("chosen:updated.chosen",(function(t){e.results_update_field(t)})),this.form_field_jq.bind("chosen:activate.chosen",(function(t){e.activate_field(t)})),this.form_field_jq.bind("chosen:open.chosen",(function(t){e.container_mousedown(t)})),this.form_field_jq.bind("chosen:close.chosen",(function(t){e.input_blur(t)})),this.search_field.bind("blur.chosen",(function(t){e.input_blur(t)})),this.search_field.bind("keyup.chosen",(function(t){e.keyup_checker(t)})),this.search_field.bind("keydown.chosen",(function(t){e.keydown_checker(t)})),this.search_field.bind("focus.chosen",(function(t){e.input_focus(t)})),this.search_field.bind("cut.chosen",(function(t){e.clipboard_event_checker(t)})),this.search_field.bind("paste.chosen",(function(t){e.clipboard_event_checker(t)})),this.is_multiple?this.search_choices.bind("click.chosen",(function(t){e.choices_click(t)})):this.container.bind("click.chosen",(function(e){e.preventDefault()}))},i.prototype.destroy=function(){return e(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},i.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field_jq[0].disabled,this.is_disabled?(this.container.addClass("chosen-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus.chosen",this.activate_action),this.close_field()):(this.container.removeClass("chosen-disabled"),this.search_field[0].disabled=!1,this.is_multiple?void 0:this.selected_item.bind("focus.chosen",this.activate_action))},i.prototype.container_mousedown=function(t){if(!this.is_disabled&&(t&&"mousedown"===t.type&&!this.results_showing&&t.preventDefault(),null==t||!e(t.target).hasClass("search-choice-close")))return this.active_field?this.is_multiple||!t||e(t.target)[0]!==this.selected_item[0]&&!e(t.target).parents("a.chosen-single").length||(t.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),e(this.container[0].ownerDocument).bind("click.chosen",this.click_test_action),this.results_show()),this.activate_field()},i.prototype.container_mouseup=function(e){if("ABBR"===e.target.nodeName&&!this.is_disabled)return this.results_reset(e)},i.prototype.search_results_mousewheel=function(e){var t;if(e.originalEvent&&(t=e.originalEvent.deltaY||-e.originalEvent.wheelDelta||e.originalEvent.detail),null!=t)return e.preventDefault(),"DOMMouseScroll"===e.type&&(t*=40),this.search_results.scrollTop(t+this.search_results.scrollTop())},i.prototype.blur_test=function(e){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()},i.prototype.close_field=function(){return e(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},i.prototype.activate_field=function(){return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},i.prototype.test_active_click=function(t){var i;return(i=e(t.target).closest(".chosen-container")).length&&this.container[0]===i[0]?this.active_field=!0:this.close_field()},i.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=n.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},i.prototype.result_do_highlight=function(e){var t,i,n,o,a;if(e.length){if(this.result_clear_highlight(),this.result_highlight=e,this.result_highlight.addClass("highlighted"),o=(n=parseInt(this.search_results.css("maxHeight"),10))+(a=this.search_results.scrollTop()),(t=(i=this.result_highlight.position().top+this.search_results.scrollTop())+this.result_highlight.outerHeight())>=o)return this.search_results.scrollTop(t-n>0?t-n:0);if(i<a)return this.search_results.scrollTop(i)}},i.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},i.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},i.prototype.update_results_content=function(e){return this.search_results.html(e)},i.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},i.prototype.set_tab_index=function(e){var t;if(this.form_field.tabIndex)return t=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=t},i.prototype.set_label_behavior=function(){var t=this;if(this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=e("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0)return this.form_field_label.bind("click.chosen",(function(e){return t.is_multiple?t.container_mousedown(e):t.activate_field()}))},i.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},i.prototype.search_results_mouseup=function(t){var i;if((i=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first()).length)return this.result_highlight=i,this.result_select(t),this.search_field.focus()},i.prototype.search_results_mouseover=function(t){var i;if(i=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first())return this.result_do_highlight(i)},i.prototype.search_results_mouseout=function(t){if(e(t.target).hasClass("active-result"))return this.result_clear_highlight()},i.prototype.choice_build=function(t){var i,n,o=this;return i=e("<li />",{class:"search-choice"}).html("<span>"+this.choice_label(t)+"</span>"),t.disabled?i.addClass("search-choice-disabled"):((n=e("<a />",{class:"search-choice-close","data-option-array-index":t.array_index})).bind("click.chosen",(function(e){return o.choice_destroy_link_click(e)})),i.append(n)),this.search_container.before(i)},i.prototype.choice_destroy_link_click=function(t){if(t.preventDefault(),t.stopPropagation(),!this.is_disabled)return this.choice_destroy(e(t.target))},i.prototype.choice_destroy=function(e){if(this.result_deselect(e[0].getAttribute("data-option-array-index")))return this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.val().length<1&&this.results_hide(),e.parents("li").first().remove(),this.search_field_scale()},i.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change"),this.active_field)return this.results_hide()},i.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},i.prototype.result_select=function(e){var t,i;if(this.result_highlight)return t=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?t.removeClass("active-result"):this.reset_single_select_options(),t.addClass("result-selected"),(i=this.results_data[t[0].getAttribute("data-option-array-index")]).selected=!0,this.form_field.options[i.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(i):this.single_set_selected_text(this.choice_label(i)),(e.metaKey||e.ctrlKey)&&this.is_multiple||this.results_hide(),this.show_search_field_default(),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[i.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,e.preventDefault(),this.search_field_scale())},i.prototype.single_set_selected_text=function(e){return null==e&&(e=this.default_text),e===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(e)},i.prototype.result_deselect=function(e){var t;return t=this.results_data[e],!this.form_field.options[t.options_index].disabled&&(t.selected=!1,this.form_field.options[t.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[t.options_index].value}),this.search_field_scale(),!0)},i.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")},i.prototype.get_search_text=function(){return e("<div/>").text(e.trim(this.search_field.val())).html()},i.prototype.winnow_results_set_highlight=function(){var e,t;if(null!=(e=(t=this.is_multiple?[]:this.search_results.find(".result-selected.active-result")).length?t.first():this.search_results.find(".active-result").first()))return this.result_do_highlight(e)},i.prototype.no_results=function(t){var i;return(i=e('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>')).find("span").first().html(t),this.search_results.append(i),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},i.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},i.prototype.keydown_arrow=function(){var e;return this.results_showing&&this.result_highlight?(e=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(e):void 0:this.results_show()},i.prototype.keyup_arrow=function(){var e;return this.results_showing||this.is_multiple?this.result_highlight?(e=this.result_highlight.prevAll("li.active-result")).length?this.result_do_highlight(e.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight()):void 0:this.results_show()},i.prototype.keydown_backstroke=function(){var e;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(e=this.search_container.siblings("li.search-choice").last()).length&&!e.hasClass("search-choice-disabled")?(this.pending_backstroke=e,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0},i.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},i.prototype.keydown_checker=function(e){var t,i;switch(t=null!=(i=e.which)?i:e.keyCode,this.search_field_scale(),8!==t&&this.pending_backstroke&&this.clear_backstroke(),t){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(e),this.mouse_on_container=!1;break;case 13:this.results_showing&&e.preventDefault();break;case 32:this.disable_search&&e.preventDefault();break;case 38:e.preventDefault(),this.keyup_arrow();break;case 40:e.preventDefault(),this.keydown_arrow()}},i.prototype.search_field_scale=function(){var t,i,n,o,a,r,s,c;if(this.is_multiple){for(r=0,o="position:absolute; left: -1000px; top: -1000px; display:none;",s=0,c=(a=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"]).length;s<c;s++)o+=(n=a[s])+":"+this.search_field.css(n)+";";return(t=e("<div />",{style:o})).text(this.search_field.val()),e("body").append(t),r=t.width()+25,t.remove(),r>(i=this.container.outerWidth())-10&&(r=i-10),this.search_field.css({width:r+"px"})}},i}(t)}).call(this)}.apply(e,arguments)}))}(this),function(e){define("angular-chosen",["angular","jquery-chosen"],(function(){return function(){
/**
* angular-chosen-localytics - Angular Chosen directive is an AngularJS Directive that brings the Chosen jQuery in a Angular way
* @version v1.3.0
* @link http://github.com/leocaseiro/angular-chosen
* @license MIT
*/
(function(){var e=[].indexOf||function(e){for(var t=0,i=this.length;t<i;t++)if(t in this&&this[t]===e)return t;return-1};angular.module("localytics.directives",[]),angular.module("localytics.directives").directive("chosen",["$timeout",function(t){var i,n,o,a;return n=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,i=["persistentCreateOption","createOptionText","createOption","skipNoResults","noResultsText","allowSingleDeselect","disableSearchThreshold","disableSearch","enableSplitWordSearch","inheritSelectClasses","maxSelectedOptions","placeholderTextMultiple","placeholderTextSingle","searchContains","singleBackstrokeDelete","displayDisabledOptions","displaySelectedOptions","width","includeGroupLabelInSelected","maxShownResults"],a=function(e){return e.replace(/[A-Z]/g,(function(e){return"_"+e.toLowerCase()}))},o=function(e){var t;if(angular.isArray(e))return 0===e.length;if(angular.isObject(e))for(t in e)if(e.hasOwnProperty(t))return!1;return!0},{restrict:"A",require:"?ngModel",priority:1,link:function(r,s,c,l){var d,u,m,h,p,f,_,g,v,D;if(r.disabledValuesHistory=r.disabledValuesHistory?r.disabledValuesHistory:[],(s=$(s)).addClass("localytics-chosen"),h=r.$eval(c.chosen)||{},angular.forEach(c,(function(t,n){if(e.call(i,n)>=0)return c.$observe(n,(function(e){return h[a(n)]="{{"===String(s.attr(c.$attr[n])).slice(0,2)?e:r.$eval(e),g()}))})),f=function(){return s.addClass("loading").attr("disabled",!0).trigger("chosen:updated")},_=function(){return s.removeClass("loading"),angular.isDefined(c.disabled)?s.attr("disabled",c.disabled):s.attr("disabled",!1),s.trigger("chosen:updated")},d=null,u=!1,m=function(){return d?s.trigger("chosen:updated"):(t((function(){d=s.chosen(h).data("chosen")})),angular.isObject(d)?d.default_text:void 0)},g=function(){return u?s.attr("data-placeholder",d.results_none_found).attr("disabled",!0):s.removeAttr("data-placeholder"),s.trigger("chosen:updated")},l?(p=l.$render,l.$render=function(){return p(),m()},s.on("chosen:hiding_dropdown",(function(){return r.$apply((function(){return l.$setTouched()}))})),c.multiple&&(D=function(){return l.$viewValue},r.$watch(D,l.$render,!0))):m(),c.$observe("disabled",(function(){return s.trigger("chosen:updated")})),c.ngOptions&&l)return v=c.ngOptions.match(n)[7],r.$watchCollection(v,(function(e,i){return t((function(){return angular.isUndefined(e)?f():(u=o(e),_(),g())}))})),r.$on("$destroy",(function(e){if("undefined"!=typeof timer&&null!==timer)return t.cancel(timer)}))}}}])}).call(this)}.apply(e,arguments)}))}(this),define("app/index",["angular","cjt/core","app/views/ROUTES","app/views/createDomain","app/views/manageDomain","cjt/modules","ngRoute","ngAnimate","cjt/services/alertService","app/services/domains","app/directives/itemLister","app/directives/domainListerViewDirective","app/directives/domainSearchModalDirective","app/directives/tldPriorityInputDirective","app/validators/subdomain","app/validators/domainIsUnique","cjt/directives/callout","cjt/directives/loadingPanel","angular-chosen"],(function(e,t,i,n,o){"use strict";return function(){e.module("cpanel.domains",["ngRoute","ngAnimate","cjt2.cpanel","cpanel.domains.domains.service","cpanel.domains.itemLister.directive","cpanel.domains.domainListerView.directive","cpanel.domains.domainSearchModal","cpanel.domains.tldPriorityInput",n.namespace,o.namespace,"cjt2.directives.loadingPanel","cjt2.services.alert","localytics.directives"]);var t=["cjt/bootstrap","cjt/directives/breadcrumbs","app/views/main"];return i.forEach((function(e){t.push("app/views/"+e.controller)})),require(t,(function(t){var n=e.module("cpanel.domains");n.value("PAGE",PAGE),n.value("ZONE_EDITOR_APP_OBJ",PAGE.zoneEditorAppObj),n.value("ITEM_LISTER_CONSTANTS",{TABLE_ITEM_BUTTON_EVENT:"TableItemActionButtonEmitted",ITEM_LISTER_UPDATED_EVENT:"ItemListerUpdatedEvent"}),n.config(["$routeProvider","$animateProvider",function(e,t){t.classNameFilter(/^((?!no-animate).)*$/),i.forEach((function(t){e.when(t.route,{controller:t.controller,templateUrl:t.templateUrl,breadcrumb:t.breadcrumb,resolve:t.resolve})})),e.otherwise({redirectTo:"/"})}]),t("#content","cpanel.domains")}))}}));Back to Directory