define(["jquery"],function(__WEBPACK_EXTERNAL_MODULE_1__){return function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.i=function(value){return value},__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{configurable:!1,enumerable:!0,get:getter})},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="/intranet/pages/build/js/",__webpack_require__(__webpack_require__.s=26)}({"./assets/js/edit_site.js":function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__;__WEBPACK_AMD_DEFINE_ARRAY__=[__webpack_require__(1)],void 0!==(__WEBPACK_AMD_DEFINE_RESULT__=function($){var EditSite=function(existingSiteUrls,siteId){this.addressFixed=!1,this.existingUrls=[],this.isValidUrl=!0,this.invalidUrlDeleted=!1,this.siteId=parseInt(siteId),this.init(existingSiteUrls)};return EditSite.prototype.generateSlug=function(title){var rus={"а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ё":"jo","ж":"zh","з":"z","и":"i","й":"j","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"c","ч":"ch","ш":"sh","щ":"sch","ъ":"","ы":"y","ь":"","э":"e","ю":"ju","я":"ja"},pattern=/[^a-zA-Z0-9_]/g;title=title.toLowerCase();for(var slug="",i=0;i<title.length;i++){var charact=title.substring(i,i+1);slug+=rus[charact]?rus[charact]:charact}return slug.match(pattern)&&(slug=slug.replace(pattern,"_")),slug.length>40&&(slug=slug.substring(0,40)),slug},EditSite.prototype.checkUrl=function(url){this.isValidUrl=!0;for(var i=0;i<this.existingUrls.length;i++)this.existingUrls[i].url===url&&(this.isValidUrl=!1,this.invalidUrlDeleted=this.existingUrls[i].is_deleted);this.isValidUrl?($("#site_url").removeClass("is-invalid"),$("#url_in_use, #url_in_use_deleted").addClass("d-none"),$("#edit_site_submit").prop("disabled","")):($("#site_url").addClass("is-invalid"),this.invalidUrlDeleted?$("#url_in_use_deleted").removeClass("d-none"):$("#url_in_use").removeClass("d-none"),$("#edit_site_submit").prop("disabled","disabled"))},EditSite.prototype.init=function(existing_site_urls){var self=this;self.existingUrls=existing_site_urls,0===self.siteId&&$("#site_title").on("keyup",function(){if(!self.addressFixed){var slug=self.generateSlug($(this).val());$("#site_url").val(slug),self.checkUrl(slug)}}),$("#site_url").on("keyup",function(){self.addressFixed=!0,self.checkUrl($(this).val())})},EditSite}.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__))&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)},1:function(module,exports){module.exports=__WEBPACK_EXTERNAL_MODULE_1__},26:function(module,exports,__webpack_require__){module.exports=__webpack_require__("./assets/js/edit_site.js")}})});
//# sourceMappingURL=edit_site.js.map