This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
/
app.js
3 lines (3 loc) · 40 KB
/
app.js
1
2
3
!function(){"use strict";angular.module("app",["ngResource","ngAnimate","ui.router","templates","cfp.hotkeys","focusOn","monospaced.elastic","gettext"])}(),function(){"use strict";function t(t,e,n,r){var o=function(t,e){return{request:function(t){return e.$broadcast("loadingStart"),t},requestError:function(n){return e.$broadcast("loadingStop"),console.error("Request error due to ",n),t.reject(n)},response:function(n){return e.$broadcast("loadingStop"),n||t.when(n)},responseError:function(n){return e.$broadcast("loadingStop"),401===n.status?console.error("Unauthorized access. Please login"):404===n.status?console.error("Service end point not found- ",n.config.url):console.error("Error in response ",n),t.reject(n)}}};o.$inject=["$q","$rootScope"],n.interceptors.push(o),e.otherwise("/"),t.state("editor",{url:"/:projectSlug/:versionSlug/translate",templateUrl:"editor/editor.html",controller:"EditorCtrl as editor",resolve:{url:["UrlService",function(t){return t.init()}]}}).state("editor.selectedContext",{url:"/:docId/:localeId",views:{"editor-content":{templateUrl:"editor/editor-content.html",controller:"EditorContentCtrl as editorContent"},"editor-suggestions":{templateUrl:"editor/editor-suggestions.html",controller:"EditorSuggestionsCtrl as editorSuggestions"},"editor-details":{templateUrl:"editor/editor-details.html",controller:"EditorDetailsCtrl as editorDetails"}}}).state("editor.selectedContext.tu",{url:"/?id&selected?states",reloadOnSearch:!1}),r.includeCheatSheet=!1}t.$inject=["$stateProvider","$urlRouterProvider","$httpProvider","hotkeysProvider"],angular.module("app").config(t)}(),function(){"use strict";angular.module("app").constant("_",window._).constant("str",window._.string).constant("Mousetrap",window.Mousetrap).constant("PRODUCTION",!0)}(),function(){"use strict";function t(t,e,n,r,o,a,i,s){function c(){return r.getAllLocales()}function u(){return e.getMyInfo().then(function(t){d.myInfo=t,d.myInfo.locale=r.DEFAULT_LOCALE,d.myInfo.gravatarUrl=n.gravatarUrl(d.myInfo.gravatarHash,72)},function(t){o.displayError("Error loading my info: "+t)})}function l(){r.getUILocaleList().then(function(t){for(var e in t.locales){var n={localeId:t.locales[e],name:""};d.uiLocaleList.push(n)}d.myInfo.locale=r.getLocaleByLocaleId(d.uiLocaleList,r.DEFAULT_LOCALE.localeId),d.myInfo.locale||(d.myInfo.locale=r.DEFAULT_LOCALE)},function(t){o.displayInfo("Error loading UI locale. Default to '"+r.DEFAULT_LOCALE.name+"': "+t),d.myInfo.locale=r.DEFAULT_LOCALE})}var d=this;d.PRODUCTION=s,d.settings=e.settings,d.uiLocaleList=[r.DEFAULT_LOCALE],n.init().then(c).then(u).then(l),d.onChangeUILocale=function(t){d.myInfo.locale=t;var e=d.myInfo.locale.localeId;i.startsWith(e,r.DEFAULT_LOCALE.localeId,!0)?a.setCurrentLanguage(r.DEFAULT_LOCALE.localeId):a.loadRemote(n.uiTranslationURL(e)).then(function(){a.setCurrentLanguage(e)},function(t){o.displayInfo("Error loading UI locale. Default to '"+r.DEFAULT_LOCALE.name+"': "+t),a.setCurrentLanguage(r.DEFAULT_LOCALE),d.myInfo.locale=r.DEFAULT_LOCALE})},d.dashboardPage=function(){return n.DASHBOARD_PAGE}}t.$inject=["$scope","UserService","UrlService","LocaleService","MessageHandler","gettextCatalog","StringUtil","PRODUCTION"],angular.module("app").controller("AppCtrl",t)}(),function(){"use strict";function t(t,e,n,r,o,a,i,s,c,u,l){function d(){I=o.readValue("status"),u.isUndefined(I)||(I=I.split(","),I=u.transform(I,function(t,e){return e=l.getServerId(e),t.push(e)})),h={status:I}}function f(t,e){var n,r,o,c,l=A.phrases;r=u.findIndex(l,function(t){return t.id===e.currentId}),o=Math.min(r+1,l.length-1),c=l[o].id,c!==e.currentId?a.emitEvent(a.EVENT.SELECT_TRANS_UNIT,{id:c,updateURL:!0,focus:!0},null):(n=l[r],a.emitEvent(a.EVENT.SAVE_TRANSLATION,{phrase:n,status:s.getSaveButtonStatus(n),locale:i.localeId,docId:i.docId}))}function p(t,e){var n,r,o,c,l=A.phrases;r=u.findIndex(l,function(t){return t.id===e.currentId}),o=Math.max(r-1,0),c=l[o].id,c!==e.currentId?a.emitEvent(a.EVENT.SELECT_TRANS_UNIT,{id:c,updateURL:!0,focus:!0},null):(n=l[r],a.emitEvent(a.EVENT.SAVE_TRANSLATION,{phrase:n,status:s.getSaveButtonStatus(n),locale:i.localeId,docId:i.docId}))}function E(t,e){var n,r,o=A.phrases,i=l.getStatusInfo(I);n=u.findIndex(o,function(t){return t.id===e.currentId});for(var s=n+1;s<o.length;s++)if(r=l.getStatusInfo(o[s].state),r.ID===i.ID)return void a.emitEvent(a.EVENT.SELECT_TRANS_UNIT,{id:o[s].id,updateURL:!0,focus:!0},null)}function g(t){S(t),a.emitEvent(a.EVENT.CANCEL_EDIT)}function T(){a.emitEvent(a.EVENT.REFRESH_STATISTIC,{projectSlug:e.context.projectSlug,versionSlug:e.context.versionSlug,docId:e.context.docId,localeId:e.context.localeId}),n.getPhraseCount(e.context,h).then(function(t){e.maxPageIndex=parseInt(t/m),t>m&&(e.maxPageIndex=t%m!==0?e.maxPageIndex+=1:e.maxPageIndex),e.maxPageIndex=e.maxPageIndex-1<0?0:e.maxPageIndex-1,S(e.currentPageIndex)})}function S(t){var r=t*m;n.fetchAllPhrase(e.context,h,r,m).then(v)}function v(t){A.phrases=t}var I,h,m=50,A=this;return d(),A.phrases=[],e.updateContext(i.projectSlug,i.versionSlug,r.decodeDocId(i.docId),i.localeId),T(),t.$on(a.EVENT.FILTER_TRANS_UNIT,function(t,e){if(e.status.all===!0)c.search("status",null);else{var n=[];u.forEach(e.status,function(t,e){t&&n.push(e)}),c.search("status",n.join(","))}d(),T()}),t.$on(a.EVENT.GOTO_FIRST_PAGE,function(){e.currentPageIndex>0&&(e.currentPageIndex=0,g(e.currentPageIndex))}),t.$on(a.EVENT.GOTO_PREV_PAGE,function(){e.currentPageIndex>0&&(e.currentPageIndex-=1,g(e.currentPageIndex))}),t.$on(a.EVENT.GOTO_NEXT_PAGE,function(){e.currentPageIndex<e.maxPageIndex&&(e.currentPageIndex+=1,g(e.currentPageIndex))}),t.$on(a.EVENT.GOTO_LAST_PAGE,function(){e.currentPageIndex<e.maxPageIndex&&(e.currentPageIndex=e.maxPageIndex,g(e.currentPageIndex))}),t.$on(a.EVENT.GOTO_NEXT_ROW,f),t.$on(a.EVENT.GOTO_PREVIOUS_ROW,p),t.$on(a.EVENT.GOTO_NEXT_UNTRANSLATED,E),A}t.$inject=["$rootScope","EditorService","PhraseService","DocumentService","UrlService","EventService","$stateParams","PhraseUtil","$location","_","TransStatusService"],angular.module("app").controller("EditorContentCtrl",t)}(),function(){"use strict";function t(t,e,n,r,o,a,i,s,c,u,l,d,f,p,E,g){function T(){var t=s.readValue("status");E.isUndefined(t)||(t=t.split(","),E.forEach(t,function(t){E.isUndefined(O.filter.status[t])||(O.filter.status[t]=!0)}),v())}function S(t){return(" "+t.className+" ").indexOf(" mousetrap ")>-1?!1:"INPUT"===t.tagName||"SELECT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable}function v(t){h(O.filter.status)?I(t):(O.filter.status.all=!1,t&&f.emitEvent(f.EVENT.FILTER_TRANS_UNIT,O.filter))}function I(t){O.filter.status.all=!0,O.filter.status.approved=!1,O.filter.status.translated=!1,O.filter.status.needsWork=!1,O.filter.status.untranslated=!1,t&&f.emitEvent(f.EVENT.FILTER_TRANS_UNIT,O.filter)}function h(t){return t.approved===t.translated&&t.translated===t.needsWork&&t.needsWork===t.untranslated}function m(){A()&&u.go("editor.selectedContext",{docId:O.context.docId,localeId:O.context.localeId})}function A(){return O.context.docId&&O.context.localeId}function N(t,e,r,o){n.getStatistics(t,e,r,o).then(function(t){O.wordStatistic=i.getWordStatistic(t),O.messageStatistic=i.getMsgStatistic(t)},function(t){l.displayError("Error loading statistic: "+t)})}var O=this;O.pageNumber=1,O.showCheatsheet=!1,O.shortcuts=E.mapValues(E.values(p.SHORTCUTS),function(t){var e=E.flatten(t.keyCombos,"combo");return{combos:E.map(e,function(t){return p.symbolizeKey(t)}),description:t.keyCombos[0].description}}),O.filter={status:{all:!0,approved:!1,translated:!1,needsWork:!1,untranslated:!1}},T(),g.bind("?",function(e){var n=e.srcElement;O.showCheatsheet||S(n)||(O.toggleKeyboardShortcutsModal(),t.$digest())},"keyup"),O.context=a.initContext(c.projectSlug,c.versionSlug,n.decodeDocId(c.docId),r.DEFAULT_LOCALE,r.DEFAULT_LOCALE.localeId,"READ_WRITE"),O.toggleKeyboardShortcutsModal=function(){O.showCheatsheet=!O.showCheatsheet},O.versionPage=function(){return s.PROJECT_PAGE(O.context.projectSlug,O.context.versionSlug)},O.encodeDocId=function(t){return n.encodeDocId(t)},o.getProjectInfo(c.projectSlug).then(function(t){O.projectInfo=t},function(t){l.displayError("Error getting project information:"+t)}),r.getSupportedLocales(O.context.projectSlug,O.context.versionSlug).then(function(t){if(O.locales=t,!O.locales||O.locales.length<=0)l.displayError("No supported locales in "+O.context.projectSlug+" : "+O.context.versionSlug);else{var e=u.params.localeId,n=O.context;e?(n.localeId=e,r.containsLocale(O.locales,e)||(n.localeId=O.locales[0].localeId)):(n.localeId=O.locales[0].localeId,m())}},function(t){l.displayError("Error getting locale list: "+t)}),n.findAll(O.context.projectSlug,O.context.versionSlug).then(function(t){if(O.documents=t,!O.documents||O.documents.length<=0)l.displayError("No documents in "+O.context.projectSlug+" : "+O.context.versionSlug);else{var e=u.params.docId,r=O.context;e?(r.docId=n.decodeDocId(e),n.containsDoc(O.documents,r.docId)||(r.docId=O.documents[0].name)):(r.docId=O.documents[0].name,m())}},function(t){l.displayError("Error getting document list: "+t)}),d.$on(f.EVENT.SELECT_TRANS_UNIT,function(t,e){O.unitSelected=e.id,O.focused=e.focus}),d.$on(f.EVENT.CANCEL_EDIT,function(){O.unitSelected=!1,O.focused=!1}),d.$on(f.EVENT.REFRESH_STATISTIC,function(t,e){N(e.projectSlug,e.versionSlug,e.docId,e.localeId),O.context.docId=e.docId,O.context.localeId=e.localeId}),O.pageNumber=function(){return 0===a.maxPageIndex?a.currentPageIndex+1:a.currentPageIndex+1+" of "+(a.maxPageIndex+1)},O.getLocaleName=function(t){return r.getName(t)},O.firstPage=function(){f.emitEvent(f.EVENT.GOTO_FIRST_PAGE)},O.lastPage=function(){f.emitEvent(f.EVENT.GOTO_LAST_PAGE)},O.nextPage=function(){f.emitEvent(f.EVENT.GOTO_NEXT_PAGE)},O.previousPage=function(){f.emitEvent(f.EVENT.GOTO_PREV_PAGE)},O.resetFilter=function(){I(!0)},O.updateFilter=function(){v(!0)},this.settings=e.settings.editor,p.enableEditorKeys()}t.$inject=["$scope","UserService","DocumentService","LocaleService","ProjectService","EditorService","StatisticUtil","UrlService","$stateParams","$state","MessageHandler","$rootScope","EventService","EditorShortcuts","_","Mousetrap"],angular.module("app").controller("EditorCtrl",t)}(),function(){"use strict";function t(){var t=this;return t}angular.module("app").controller("EditorDetailsCtrl",t)}(),function(){"use strict";function t(t,e,n,r,o,a,i,s,c,u){function l(t,e){return i.hasTranslationChanged(t)||t.status!==e}function d(t){var i=n.cloneDeep(p.context),l=E[t],d=e(r.TRANSLATION_URL,{},{update:{method:"PUT",params:{localeId:l.locale}}}),f={id:l.phrase.id,revision:l.phrase.revision||0,content:l.phrase.newTranslations[0],contents:l.phrase.newTranslations,status:u.getServerId(l.status.ID),plural:l.phrase.plural};d.update(f).$promise.then(function(t){var e=l.phrase.status.ID;a.onTransUnitUpdated(i,f.id,l.locale,t.revision,t.status,l.phrase),s.updateStatistic(i.projectSlug,i.versionSlug,l.docId,l.locale,e,u.getId(t.status),l.phrase.wordCount),o.emitEvent(o.EVENT.SAVE_COMPLETED,l.phrase)},function(t){c.displayWarning("Update translation failed for "+f.id+" -"+t),a.onTransUnitUpdateFailed(f.id),o.emitEvent(o.EVENT.SAVE_COMPLETED,l.phrase)}),delete E[t]}function f(t,e){return n.isEmpty(n.compact(t.newTranslations))?u.getStatusInfo("UNTRANSLATED"):e}var p=this,E={};return p.context={},p.currentPageIndex=0,p.maxPageIndex=0,p.initContext=function(t,e,n,r,o,a){return p.context={projectSlug:t,versionSlug:e,docId:n,srcLocale:r,localeId:o,mode:a},p.context},p.updateContext=function(t,e,n,r){p.context.projectSlug!==t&&(p.context.projectSlug=t),p.context.versionSlug!==e&&(p.context.versionSlug=e),p.context.docId!==n&&(p.context.docId=n),p.context.localeId!==r&&(p.context.localeId=r)},t.$on(o.EVENT.SAVE_TRANSLATION,function(t,e){var r=e.phrase,a=e.status;if(l(r,a)){if(n.has(E,r.id)){var i=E[r.id];i.phrase=r,i.status=a}else a=f(r,a),E[r.id]={phrase:r,status:a,locale:e.locale,docId:e.docId};o.emitEvent(o.EVENT.SAVE_INITIATED,e),d(r.id)}}),p}t.$inject=["$rootScope","$resource","_","UrlService","EventService","PhraseService","PhraseUtil","DocumentService","MessageHandler","TransStatusService"],angular.module("app").factory("EditorService",t)}(),function(){"use strict";function t(t,e,n,r,o,a,i,s,c){function u(e){h.selectedTUCtrl&&(e.preventDefault(),t.emitEvent(t.EVENT.COPY_FROM_SOURCE,{phrase:h.selectedTUCtrl.getPhrase()}))}function l(e){h.selectedTUCtrl&&(e.preventDefault(),e.stopPropagation(),t.emitEvent(t.EVENT.GOTO_NEXT_ROW,v()))}function d(e){h.selectedTUCtrl&&(e.preventDefault(),e.stopPropagation(),t.emitEvent(t.EVENT.GOTO_PREVIOUS_ROW,v()))}function f(e){if(e.preventDefault(),e.stopPropagation(),m)h.cancelSaveAsModeIfOn(),h.selectedTUCtrl&&h.selectedTUCtrl.focusTranslation();else if(h.selectedTUCtrl){var n=h.selectedTUCtrl.getPhrase();o.hasTranslationChanged(n)?t.emitEvent(t.EVENT.UNDO_EDIT,n):t.emitEvent(t.EVENT.CANCEL_EDIT,n)}}function p(n){if(h.selectedTUCtrl){n.preventDefault();var r=h.selectedTUCtrl.getPhrase();t.emitEvent(t.EVENT.SAVE_TRANSLATION,{phrase:r,status:o.getSaveButtonStatus(r),locale:e.localeId,docId:e.docId})}}function E(e){e.preventDefault(),h.cancelSaveAsModeIfOn();var n=h.selectedTUCtrl.getPhrase();n&&(t.emitEvent(t.EVENT.TOGGLE_SAVE_OPTIONS,{id:n.id,open:!0}),I(n,"n","needsWork"),I(n,"t","translated"),I(n,"a","approved"))}function g(t,e,n,r,o){return this.defaultKey=t,this.keyCombos=[T(t,n,o,e)],r&&(this.otherKeys=r instanceof Array?r:[r],this.keyCombos.push(T(this.otherKeys,"",o,e))),this}function T(t,e,n,r){var o={allowIn:["TEXTAREA"],callback:r};return o.combo=t,e&&(o.description=e),n&&(o.action=n),o}function S(t){r.get(t.defaultKey)||n.forEach(t.keyCombos,function(t){r.add(t)})}function v(){return{currentId:h.selectedTUCtrl.getPhrase().id}}function I(t,e,n){var o=a.getStatusInfo(n);return r.add({combo:e,description:s.sprintf("Save as %s",n),allowIn:["INPUT","TEXTAREA"],action:"keydown",callback:function(e){h.saveTranslationCallBack(e,t,o)}})}var h=this,m=!1;return h.selectedTUCtrl=null,h.SHORTCUTS={COPY_SOURCE:new g("alt+c",u,"Copy source as translation","alt+g"),CANCEL_EDIT:new g("esc",f,"Cancel edit"),SAVE_AS_CURRENT_BUTTON_OPTION:new g("mod+s",p,"Save"),SAVE_AS_MODE:new g("mod+shift+s",E,"Save as…"),SAVE_AS_NEEDSWORK:{keyCombos:[{combo:"mod+shift+s n",description:"Save as needs work"}]},SAVE_AS_TRANSLATED:{keyCombos:[{combo:"mod+shift+s t",description:"Save as translated"}]},SAVE_AS_APPROVED:{keyCombos:[{combo:"mod+shift+s a",description:"Save as approved"}]},GOTO_NEXT_ROW_FAST:new g("mod+enter",l,"Save (if changed) and go to next string",["alt+k","alt+down"]),GOTO_PREVIOUS_ROW:new g("mod+shift+enter",d,"Save (if changed) and go to previous string",["alt+j","alt+up"])},h.enableEditorKeys=function(){r.get(h.SHORTCUTS.COPY_SOURCE.defaultKey)||n.forOwn(h.SHORTCUTS,function(t){t instanceof g&&S(t)})},h.disableEditorKeys=function(){n.forOwn(h.SHORTCUTS,function(t){n.forEach(t.keyCombos,function(t){h.deleteKeys(t.combo,t.action)})})},h.saveTranslationCallBack=function(n,r,o){m=!0,n.preventDefault(),n.stopPropagation(),t.emitEvent(t.EVENT.SAVE_TRANSLATION,{phrase:r,status:o,locale:e.localeId,docId:e.docId}),h.cancelSaveAsModeIfOn()},h.cancelSaveAsModeIfOn=function(){m&&h.selectedTUCtrl&&(m=!1,h.deleteKeys(["n","t","a"]),t.emitEvent(t.EVENT.TOGGLE_SAVE_OPTIONS,{id:h.selectedTUCtrl.getPhrase().id,open:!1}))},h.deleteKeys=function(t,e){var o=t instanceof Array?t:[t];e=e||"keydown",n.forEach(o,function(t){r.del(t),i.unbind(t,e)})},h.symbolizeKey=function(t){var e={command:"⌘",shift:"⇧",left:"←",right:"→",up:"↑",down:"↓","return":"↩",backspace:"⌫"};t=t.split("+");for(var n=0;n<t.length;n++)"mod"===t[n]&&(t[n]=c.navigator&&c.navigator.platform.indexOf("Mac")>=0?"command":"ctrl"),t[n]=e[t[n]]||t[n];return t.join(" + ")},h}t.$inject=["EventService","$stateParams","_","hotkeys","PhraseUtil","TransStatusService","Mousetrap","str","$window"],angular.module("app").factory("EditorShortcuts",t)}(),function(){"use strict";function t(){var t=this;return t}angular.module("app").controller("EditorSuggestionsCtrl",t)}(),function(){"use strict";function t(){return{restrict:"A",link:function(t,e,n){return t.$on("blurOn",function(t,r){return r===n.blurOn?e[0].blur():void 0})}}}angular.module("app").directive("blurOn",t)}(),function(){"use strict";function t(t){return{restrict:"A",scope:{callback:"&clickElsewhere"},link:function(e,n){var r=function(t){n[0].contains(t.target)||e.$apply(e.callback(t))};t.on("click",r),e.$on("$destroy",function(){t.off("click",r)})}}}t.$inject=["$document"],angular.module("app").directive("clickElsewhere",t)}(),function(){"use strict";function t(t,e,n,r,o,a,i,s){function c(t,e){return t+"-"+e}function u(t,e,n,r){var a=o.getWordStatistic(t),i=o.getMsgStatistic(t);if(a){r=parseInt(r);var s=parseInt(a[e])-r;a[e]=0>s?0:s,a[n]=parseInt(a[n])+r}if(i){var c=parseInt(i[e])-1;i[e]=0>c?0:c,i[n]=parseInt(i[n])+1}}var l=this,d={};return l.findAll=function(t,r){var o=e(n.DOCUMENT_LIST_URL,{},{query:{method:"GET",params:{projectSlug:t,versionSlug:r},isArray:!0}});return o.query().$promise},l.getStatistics=function(r,o,a,u){if(a&&u){var f=c(a,u);if(i.has(d,f))return t.when(d[f]);var p=l.encodeDocId(a),E=e(n.DOC_STATISTIC_URL,{},{query:{method:"GET",params:{projectSlug:r,versionSlug:o,docId:p,localeId:u},isArray:!0}});return E.query().$promise.then(function(t){return i.forEach(t,function(t){t[s.getId("needswork")]=t.needReview||0}),d[f]=t,d[f]})}},l.encodeDocId=function(t){return t?t.replace(/\//g,","):t},l.decodeDocId=function(t){return t?t.replace(/\,/g,"/"):t},l.containsDoc=function(t,e){return i.any(t,function(t){return r.equals(t.name,e,!0)})},l.updateStatistic=function(t,e,n,r,o,s,l){var f=c(n,r);i.has(d,f)&&(u(d[f],o,s,l),a.emitEvent(a.EVENT.REFRESH_STATISTIC,{projectSlug:t,versionSlug:e,docId:n,localeId:r}))},l}t.$inject=["$q","$resource","UrlService","StringUtil","StatisticUtil","EventService","_","TransStatusService"],angular.module("app").factory("DocumentService",t)}(),function(){"use strict";function t(t,e,n,r,o,a,i){var s,c=this,u=t.$new(),l=r.openClass,d=angular.noop,f=e.onToggle?n(e.onToggle):angular.noop;this.init=function(r){c.$element=r,e.isOpen&&(s=n(e.isOpen),d=s.assign,t.$watch(s,function(t){u.isOpen=!!t}))},this.toggle=function(t){return u.isOpen=arguments.length?!!t:!u.isOpen,u.isOpen},this.isOpen=function(){return u.isOpen},u.getToggleElement=function(){return c.toggleElement},u.focusToggleElement=function(){c.toggleElement&&c.toggleElement[0].focus()},u.$watch("isOpen",function(e,n){a[e?"addClass":"removeClass"](c.$element,l),e?(i(function(){u.focusToggleElement()}),o.open(u)):o.close(u),d(t,e),angular.isDefined(e)&&e!==n&&f(t,{open:!!e})}),t.$on("$locationChangeSuccess",function(){u.isOpen=!1}),t.$on("$destroy",function(){u.$destroy()}),t.$on("openDropdown",function(){u.isOpen=!0}),t.$on("closeDropdown",function(){u.isOpen=!1})}t.$inject=["$scope","$attrs","$parse","dropdownConfig","DropdownService","$animate","$timeout"],angular.module("app").controller("DropdownCtrl",t)}(),function(){"use strict";function t(t){var e=null,n=this;n.open=function(n){e||(t.bind("click",r),t.bind("keydown",o)),e&&e!==n&&(e.isOpen=!1),e=n},n.close=function(n){e===n&&(e=null,t.unbind("click",r),t.unbind("keydown",o))};var r=function(t){if(e){var n=e.getToggleElement();t&&n&&n[0].contains(t.target)||e.$apply(function(){e.isOpen=!1})}},o=function(t){27===t.which&&(e.focusToggleElement(),r())}}t.$inject=["$document"],angular.module("app").service("DropdownService",t)}(),function(){"use strict";var t={openClass:"is-active"};angular.module("app").constant("dropdownConfig",t)}(),function(){"use strict";function t(){return{restrict:"EA",controller:"DropdownCtrl",link:function(t,e,n,r){r.init(e)}}}function e(){return{restrict:"A",require:"?^dropdown",scope:{callback:"&onCloseDropdown"},link:function(t,e,n,r){r.onCloseDropdown=t.callback}}}function n(){return{restrict:"EA",require:"?^dropdown",link:function(t,e,n,r){if(r){r.toggleElement=e;var o=function(o){o.preventDefault(),o.stopPropagation(),e.hasClass("disabled")||n.disabled||t.$apply(function(){r.toggle()})};e.bind("click",o),e.attr({"aria-haspopup":!0,"aria-expanded":!1}),t.$watch(r.isOpen,function(n){e.attr("aria-expanded",!!n),r.onCloseDropdown&&!n&&t.$applyAsync(r.onCloseDropdown)}),t.$on("$destroy",function(){e.unbind("click",o)})}}}}angular.module("app").directive("dropdown",t).directive("onCloseDropdown",e).directive("dropdownToggle",n)}(),function(){"use strict";function t(t){var e=this;return e.EVENT={LOADING_START:"loadingStart",LOADING_STOP:"loadingStop",SELECT_TRANS_UNIT:"selectTransUnit",COPY_FROM_SOURCE:"copyFromSource",UNDO_EDIT:"undoEdit",CANCEL_EDIT:"cancelEdit",FOCUS_TRANSLATION:"focusTranslation",SAVE_TRANSLATION:"saveTranslation",SAVE_INITIATED:"saveInitiated",SAVE_COMPLETED:"saveCompleted",TRANSLATION_TEXT_MODIFIED:"translationTextModified",REFRESH_STATISTIC:"refreshStatistic",GOTO_PREV_PAGE:"gotoPreviousPage",GOTO_NEXT_PAGE:"gotoNextPage",GOTO_FIRST_PAGE:"gotoFirstPage",GOTO_LAST_PAGE:"gotoLastPage",GOTO_NEXT_ROW:"gotoNextRow",GOTO_PREVIOUS_ROW:"gotoPreviousRow",GOTO_NEXT_UNTRANSLATED:"gotoNextUntranslated",TOGGLE_SAVE_OPTIONS:"openSaveOptions",FILTER_TRANS_UNIT:"filterTransUnit"},e.broadcastEvent=function(e,n,r){r=r||t,r.$broadcast(e,n)},e.emitEvent=function(e,n,r){r=r||t,r.$emit(e,n)},e}t.$inject=["$rootScope"],angular.module("app").factory("EventService",t)}(),function(){"use strict";function t(t){return{restrict:"E",required:["name"],scope:{name:"@",title:"@",size:"@"},link:function(e,n){var r="",o="";n.addClass("Icon"),e.title&&(o="<title>"+e.title+"</title>"),r='<svg class="Icon-item"><use xlink:href="#Icon-'+e.name+'" />'+o+"</svg>",n.html(t.trustAsHtml(r))}}}t.$inject=["$sce"],angular.module("app").directive("icon",t)}(),function(){"use strict";function t(t,e,n,r,o){function a(e,n){var o=r(t.LOCALE_LIST_URL,{},{query:{method:"GET",params:{projectSlug:e,versionSlug:n},isArray:!0}});return o.query().$promise}function i(){var e=r(t.ALL_LOCALE_URL,{},{query:{method:"GET",isArray:!0}});return e.query().$promise.then(function(t){d=n.cleanResourceList(t)})}function s(){var e=r(t.uiTranslationListURL,{},{query:{method:"GET"}});return e.query().$promise}function c(t,n){return t?o.find(t,function(t){return e.equals(t.localeId,n,!0)}):void 0}function u(t,n){return o.any(t,function(t){return e.equals(t.localeId,n,!0)})}function l(t){var e=c(d,t);return e?e.name:t}var d=[];return{getSupportedLocales:a,getUILocaleList:s,getLocaleByLocaleId:c,getAllLocales:i,containsLocale:u,getName:l,DEFAULT_LOCALE:{localeId:"en-US",name:"English"}}}t.$inject=["UrlService","StringUtil","FilterUtil","$resource","_"],angular.module("app").factory("LocaleService",t)}(),function(){"use strict";function t(t){return{restrict:"EA",scope:{loading:"=",inverted:"="},link:function(e){e.classes="",e.$on(t.EVENT.LOADING_START,function(){e.classes+=" is-loading"}),e.$on(t.EVENT.LOADING_STOP,function(){e.classes=e.classes.replace("is-loading","")}),e.$watch("inverted",function(t){t?e.classes+=" LogoLoader--inverted":e.classes=e.classes.replace("LogoLoader--inverted","")})},templateUrl:"components/logo-loader/logo-loader.html"}}t.$inject=["EventService"],angular.module("app").directive("logoLoader",t)}(),function(){"use strict";function t(){return{displayError:function(t){console.error(t)},displayWarning:function(t){console.warn(t)},displayInfo:function(t){console.info(t)}}}angular.module("app").factory("MessageHandler",t)}(),function(){"use strict";function t(){}angular.module("app").factory("NotificationService",t)}(),function(){"use strict";function t(t,e,n,r,o,a){function i(t,e,n,r){return t+"-"+e+"-"+n+"-"+r}var s=this,c={},u={};return s.getStates=function(s,u,l,d){var f=i(s,u,l,d);if(a.has(c,f))return t.when(c[f]);var p=o.encodeDocId(l),E={query:{method:"GET",params:{projectSlug:s,versionSlug:u,docId:p,localeId:d},isArray:!0}},g=e(r.TRANSLATION_STATUS_URL,{},E);return g.query().$promise.then(function(t){return t=n.cleanResourceList(t),c[f]=t,c[f]})},s.getTransUnits=function(o,i){function s(t){t=n.cleanResourceMap(t);for(var e in t)u[e][i]=t[e][i],l[e]=u[e];return l}function c(t){t=n.cleanResourceMap(t);for(var e in t)u[e]=t[e],l[e]=u[e];return l}var l={},d=[],f=[];if(o.forEach(function(t){a.has(u,t)?u[t][i]?l[t]=u[t]:f.push(t):d.push(t)}),a.isEmpty(d)&&a.isEmpty(f))return t.when(l);var p,E;return a.isEmpty(d)||(p=e(r.TEXT_FLOWS_URL,{},{query:{method:"GET",params:{localeId:i,ids:d.join(",")}}})),a.isEmpty(f)||(E=e(r.TRANSLATION_URL,{},{query:{method:"GET",params:{localeId:i,ids:f.join(",")}}})),p&&E?p.query().$promise.then(c).then(E.query().$promise.then(s)):p?p.query().$promise.then(c):E?E.query().$promise.then(s):void 0},s.onTransUnitUpdated=function(t,e,n,r,o,s){var l=i(t.projectSlug,t.versionSlug,t.docId,n),d=a.find(c[l],function(t){return t.id===e});d&&(d.state=o);var f=u[e][n];f||(f={}),f.revision=parseInt(r),f.state=o,f.contents=s.newTranslations.slice()},s}t.$inject=["$q","$resource","FilterUtil","UrlService","DocumentService","_"],angular.module("app").factory("PhraseCache",t)}(),function(){"use strict";function t(t,e,n,r,o){function a(t,e){return r.find(e,function(e){return e.id===t})}function i(e,n){return n&&(e=t.filterResources(e,["status"],n)),r.map(e,function(t){return t.id})}var s={};return s.phrases=[],s.getPhraseCount=function(t,n){return e.getStates(t.projectSlug,t.versionSlug,t.docId,t.localeId).then(function(t){var e=i(t,n.status);return e.length})},s.fetchAllPhrase=function(t,o,a,c){function u(t){var n=i(t,o.status);return isNaN(a)||(n=isNaN(c)?n.slice(a):n.slice(a,a+c)),e.getTransUnits(n,p).then(l).then(f)}function l(t){return r.map(t,function(t,e){var r=t.source,o=t[p];return{id:parseInt(e),sources:r.plural?r.contents:[r.content],translations:d(r,o),newTranslations:d(r,o),plural:r.plural,status:n.getStatusInfo(o?o.state:"untranslated"),revision:o?parseInt(o.revision):0,wordCount:parseInt(r.wordCount)}})}function d(t,e){return t.plural?e&&e.contents?e.contents.slice():[]:e?[e.content]:[]}function f(n){return e.getStates(t.projectSlug,t.versionSlug,t.docId,p).then(function(t){return s.phrases=r.sortBy(n,function(e){var o=r.findIndex(t,function(t){return t.id===e.id});return o>=0?o:n.length}),s.phrases})}var p=t.localeId;return e.getStates(t.projectSlug,t.versionSlug,t.docId,p).then(u)},s.onTransUnitUpdated=function(t,r,o,i,c,u){e.onTransUnitUpdated(t,r,o,i,c,u);var l=a(r,s.phrases);l&&(l.translations=u.newTranslations.slice(),l.revision=i,l.status=n.getStatusInfo(c))},s.onTransUnitUpdateFailed=function(t){var e=a(t,s.phrases);e&&(e.newTranslations=e.translations.slice())},s.findNextId=function(t){return e.getStates(o.projectSlug,o.versionSlug,o.docId,o.localeId).then(function(e){var n,o;return n=r.findIndex(e,function(e){return e.id===t}),o=n+1<e.length?n+1:e.length-1,e[o].id})},s.findPreviousId=function(t){return e.getStates(o.projectSlug,o.versionSlug,o.docId,o.localeId).then(function(e){var n,o;return n=r.findIndex(e,function(e){return e.id===t}),o=n-1>=0?n-1:0,e[o].id})},s.findNextStatus=function(t,a){return e.getStates(o.projectSlug,o.versionSlug,o.docId,o.localeId).then(function(e){var o,i,s=n.getStatusInfo(a);o=r.findIndex(e,function(e){return e.id===t});for(var c=o+1;c<e.length;c++)if(i=n.getStatusInfo(e[c].state),i.ID===s.ID)return e[c].id;return t})},s}t.$inject=["FilterUtil","PhraseCache","TransStatusService","_","$stateParams"],angular.module("app").factory("PhraseService",t)}(),function(){"use strict";function t(){return{restrict:"E",required:"progressbarStatistic",scope:{statistic:"=progressbarStatistic",size:"@"},templateUrl:"components/progressbar/progressbar.html",controller:["$scope",function(t){t.$watch("statistic",function(n){n&&(t.style=e(n))},!0)}]}}function e(t){var e=t.total,r=n(t.approved,e),o=n(t.translated,e),a=r,i=n(t.needswork,e),s=r+o,c=n(t.untranslated,e),u=r+o+i,l={};return l.approved={width:r+"%",marginLeft:0},l.translated={width:o+"%",marginLeft:a+"%"},l.needsWork={width:i+"%",marginLeft:s+"%"},l.untranslated={width:c+"%",marginLeft:u+"%"},l}function n(t,e){var n=0;return t&&(n=t/e*100),n}angular.module("app").directive("progressbar",t)}(),function(){"use strict";function t(t,e){function n(n){var r={query:{method:"GET",params:{projectSlug:n}}},o=e(t.PROJECT_URL,{},r);return o.query().$promise}return{getProjectInfo:n}}t.$inject=["UrlService","$resource"],angular.module("app").factory("ProjectService",t)}(),function(){"use strict";function t(){function t(t,e){return t.replace(e.regex,e.template)}var e={space:{regex:/ /g,template:'<span class="u-textSpace"> </span>'},newline:{regex:/\n/g,template:'<span class="u-textPilcrow"></span>\n'},tab:{regex:/\t/g,template:'<span class="u-textTab"> </span>'}};return{restrict:"A",required:["ngBind"],scope:{ngBind:"="},link:function(n,r){n.$watch("ngBind",function(n){n=t(n,e.space),n=t(n,e.newline),n=t(n,e.tab),r.html(n)})}}}angular.module("app").directive("renderWhitespaceCharacters",t)}(),function(){"use strict";function t(){var t=this;t.init=function(){var e=t.container[0],n=t.child[0],r=n.offsetWidth-e.offsetWidth;t.width=r/2}}angular.module("app").controller("ScrollbarWidthCtrl",t)}(),function(){"use strict";function t(){return{restrict:"A",controller:"ScrollbarWidthCtrl as scrollbarWidthCtrl",link:function(t,e,n,r){r.init(e)}}}function e(){return{restrict:"A",require:"?^scrollbarWidth",link:function(t,e,n,r){r&&e.css(n.scrollbarWidthElement,r.width)}}}function n(){return{restrict:"A",require:"?^scrollbarWidth",link:function(t,e,n,r){r&&(r.container=e)}}}function r(){return{restrict:"A",require:"?^scrollbarWidth",link:function(t,e,n,r){r&&(r.child=e)}}}angular.module("app").directive("scrollbarWidth",t).directive("scrollbarWidthElement",e).directive("scrollbarWidthContainer",n).directive("scrollbarWidthChild",r)}(),function(){"use strict";function t(){return{restrict:"A",link:function(t,e){e.after('<span class="Toggle-fakeCheckbox"></span>')}}}angular.module("app").directive("toggleCheckbox",t)}(),function(){"use strict";function t(t){function e(t){return t=angular.uppercase(t),t&&"NEW"!==t?"NEEDREVIEW"===t&&(t="NEEDSWORK"):t="UNTRANSLATED",t}function n(t){return t=angular.lowercase(t),t&&"untranslated"!==t?"needswork"===t?"NeedReview":t.charAt(0).toUpperCase()+t.slice(1).toLowerCase():"New"}var r=this,o={UNTRANSLATED:{ID:"untranslated",NAME:"Untranslated",CSSCLASS:"neutral"},NEEDSWORK:{ID:"needswork",NAME:"Needs Work",CSSCLASS:"unsure"},TRANSLATED:{ID:"translated",NAME:"Translated",CSSCLASS:"success"},APPROVED:{ID:"approved",NAME:"Approved",CSSCLASS:"highlight"}};return r.getAll=function(){return o},r.getAllAsArray=function(){return t.values(o)},r.getStatusInfo=function(t){return o[e(t)]},r.getId=function(t){return o[e(t)].ID},r.getServerId=function(t){return n(t)},r.getName=function(t){return o[e(t)].NAME},r.getCSSClass=function(t){return o[e(t)].CSSCLASS},r}t.$inject=["_"],angular.module("app").factory("TransStatusService",t)}(),function(){"use strict";function t(t,e,n,r,o,a,i,s,c,u){function l(){d.selected||t.$apply(function(){a.emitEvent(a.EVENT.SELECT_TRANS_UNIT,{id:t.phrase.id,updateURL:!0,focus:!0},t)})}var d=this;return d.selected=!1,d.focused=!1,d.focusedTranslationIndex=0,d.hasTranslationChanged=u.hasTranslationChanged,d.focusTranslation=function(){d.selected&&s("phrase-"+t.phrase.id+"-"+d.focusedTranslationIndex)},d.onTextAreaFocus=function(e,n){d.focused=!0,r.isUndefined(n)||(d.focusedTranslationIndex=n),d.selected||a.emitEvent(a.EVENT.SELECT_TRANS_UNIT,{id:e.id,updateURL:!0,focus:!0},t)},d.translationTextModified=function(t){a.emitEvent(a.EVENT.TRANSLATION_TEXT_MODIFIED,t)},d.getPhrase=function(){return t.phrase},d.init=function(){o.addController(t.phrase.id,d),n.id&&parseInt(n.id)===t.phrase.id&&a.emitEvent(a.EVENT.SELECT_TRANS_UNIT,{id:n.id,updateURL:!1,focus:n.selected})},d.copySource=function(e,n,r){e.stopPropagation(),a.emitEvent(a.EVENT.COPY_FROM_SOURCE,{phrase:n,sourceIndex:r},t)},d.undoEdit=function(e,n){e.stopPropagation(),a.emitEvent(a.EVENT.UNDO_EDIT,n,t)},d.cancelEdit=function(e,n){e.stopPropagation(),a.emitEvent(a.EVENT.CANCEL_EDIT,n,t)
},d.saveAs=function(t,e,n){c.saveTranslationCallBack(t,e,n)},d.getLocaleName=function(t){return i.getName(t)},d.toggleSaveAsOptions=function(e){a.broadcastEvent(e?"openDropdown":"closeDropdown",{},t),e&&s(t.phrase.id+"-saveAsOption-0")},d.cancelSaveAsMode=function(){c.cancelSaveAsModeIfOn()},t.$on("$destroy",function(){e.unbind("click",l),e.unbind("focus",l)}),d.updateSaveButton=function(e){d.saveButtonStatus=u.getSaveButtonStatus(t.phrase),d.saveButtonOptions=o.getSaveButtonOptions(d.saveButtonStatus,t.phrase),d.saveButtonText=d.saveButtonStatus.NAME,d.saveButtonDisabled=!u.hasTranslationChanged(e),d.loadingClass="",d.savingStatus=""},d.phraseSaving=function(t){d.loadingClass="is-loading",d.saveButtonStatus=d.savingStatus=t.status,d.saveButtonOptions=o.getSaveButtonOptions(d.saveButtonStatus,t.phrase),d.saveButtonText="Saving…",d.saveButtonDisabled=!0},d.saveButtonOptionsAvailable=function(){return!r.isEmpty(d.saveButtonOptions)},d.selectTransUnit=function(e){d.selected||a.emitEvent(a.EVENT.SELECT_TRANS_UNIT,{id:e.id,updateURL:!0,focus:!0},t)},d}t.$inject=["$scope","$element","$stateParams","_","TransUnitService","EventService","LocaleService","focus","EditorShortcuts","PhraseUtil"],angular.module("app").controller("TransUnitCtrl",t)}(),function(){"use strict";function t(t,e,n,r,o,a,i,s,c,u,l,d,f){function p(t,e){var n=0;if(t.plural){var r=A[t.id];n=r.focusedTranslationIndex}t.newTranslations[n]=e,s.emitEvent(s.EVENT.TRANSLATION_TEXT_MODIFIED,t),s.emitEvent(s.EVENT.FOCUS_TRANSLATION,t)}function E(t,e){t.newTranslations=e.slice(),s.emitEvent(s.EVENT.TRANSLATION_TEXT_MODIFIED,t),s.emitEvent(s.EVENT.FOCUS_TRANSLATION,t)}function g(t,e){var n=A[e.id];n.updateSaveButton(e)}function T(t,e){var n=A[e.phrase.id];n.phraseSaving(e),s.emitEvent(s.EVENT.FOCUS_TRANSLATION,e.phrase)}function S(t,e){t.selected!==e&&(t.selected=e||!1)}function v(t,e){var n=A[e.id];n.focusTranslation()}function I(t,e){var n=[];return"untranslated"===t.ID?n:(n=a("filter")(c.getAllAsArray(),{ID:"!untranslated"}),e.plural&&(d.hasNoTranslation(e)?n=a("filter")(n,{ID:"!needswork"}):d.hasEmptyTranslation(e)&&(n=a("filter")(n,{ID:"!translated"}))),u&&(n=a("filter")(n,{ID:"!approved"})),a("filter")(n,{ID:"!"+t.ID}))}var h,m=this,A={};return m.addController=function(t,e){A[t]=e},m.getSaveButtonOptions=function(t,e){return I(t,e)},n.$on(s.EVENT.TOGGLE_SAVE_OPTIONS,function(t,e){var n=A[e.id];n&&n.toggleSaveAsOptions(e.open)}),n.$on(s.EVENT.SELECT_TRANS_UNIT,function(t,n){var a=A[n.id],u=A[h],f=n.updateURL;a?(l.selectedTUCtrl=a,h&&h!==n.id&&(S(u,!1),d.hasTranslationChanged(u.getPhrase())&&s.emitEvent(s.EVENT.SAVE_TRANSLATION,{phrase:u.getPhrase(),status:c.getStatusInfo("TRANSLATED"),locale:o.localeId,docId:o.docId})),g(t,a.getPhrase()),h=n.id,S(a,!0),s.emitEvent(s.EVENT.FOCUS_TRANSLATION,n),f&&("editor.selectedContext.tu"!==r.current.name?r.go("editor.selectedContext.tu",{id:n.id,selected:n.focus.toString()}):(e.search("id",n.id),e.search("selected",n.focus.toString())))):i.displayWarning("Trans-unit not found:"+n.id)}),n.$on(s.EVENT.COPY_FROM_SOURCE,function(e,n){var r=0;if(n.phrase.plural&&(r=n.sourceIndex,t.isUndefined(r))){var o=A[n.phrase.id];r=o.focusedTranslationIndex,n.phrase.sources.length<o.focusedTranslationIndex+1&&(r=n.phrase.sources.length-1)}p(n.phrase,n.phrase.sources[r])}),n.$on(s.EVENT.UNDO_EDIT,function(t,e){d.hasTranslationChanged(e)&&E(e,e.translations)}),n.$on(s.EVENT.CANCEL_EDIT,function(t,r){h&&(S(A[h],!1),h=!1,l.selectedTUCtrl=null),e.search("selected",null),r||e.search("id",null),r&&f(function(){return n.$broadcast("blurOn","phrase-"+r.id)})}),n.$on(s.EVENT.TRANSLATION_TEXT_MODIFIED,g),n.$on(s.EVENT.FOCUS_TRANSLATION,v),n.$on(s.EVENT.SAVE_INITIATED,T),n.$on(s.EVENT.SAVE_COMPLETED,g),m}t.$inject=["_","$location","$rootScope","$state","$stateParams","$filter","MessageHandler","EventService","TransStatusService","PRODUCTION","EditorShortcuts","PhraseUtil","$timeout"],angular.module("app").factory("TransUnitService",t)}(),function(){"use strict";function t(){return{restrict:"E",required:["phrase","editorContext"],scope:{phrase:"=",firstPhrase:"=",editorContext:"="},controller:"TransUnitCtrl as transUnitCtrl",templateUrl:"components/transUnit/trans-unit.html",link:function(t,e,n,r){r.init()}}}angular.module("app").directive("transUnit",t)}(),function(){"use strict";function t(){return{restrict:"E",required:["editor"],scope:{editor:"="},templateUrl:"components/transUnitFilter/trans-unit-filter.html"}}angular.module("app").directive("transUnitFilter",t)}(),function(){"use strict";function t(t,e){function n(n){var r=t(e.USER_INFO_URL,{},{query:{method:"GET",params:{username:n}}});return r.query().$promise}function r(){var n=t(e.MY_INFO_URL,{},{query:{method:"GET"}});return n.query().$promise}return{settings:{editor:{hideMainNav:!1}},getUserInfo:n,getMyInfo:r}}t.$inject=["$resource","UrlService"],angular.module("app").factory("UserService",t)}(),function(){"use strict";function t(t,e){function n(t,n,r){return t&&n&&r?e.filter(t,function(t){return a(t,n,r)}):t}function r(t){var e={},n=Object.keys(t).filter(function(t){return-1===t.indexOf("$")});return n.forEach(function(n){e[n]=t[n]}),e}function o(t){var e=[],n=Object.keys(t).filter(function(t){return-1===t.indexOf("$")});return n.forEach(function(n){e.push(t[n])}),e}function a(n,r,o){return n&&r&&o?e.any(r,function(r){return e.any(o,function(e){return t.equals(n[r],e,!0)})}):!1}return{filterResources:n,cleanResourceList:o,cleanResourceMap:r}}t.$inject=["StringUtil","_"],angular.module("app").factory("FilterUtil",t)}(),function(){"use strict";function t(t,e){function n(e){return o(e)?t.getStatusInfo("untranslated"):a(e)?t.getStatusInfo("needswork"):r(e)?t.getStatusInfo("translated"):e.status}function r(t){var n=e.every(t.translations,function(e,n){return i(e)===i(t.newTranslations[n])});return!n}function o(t){return e.isEmpty(e.compact(t.newTranslations))}function a(t){return e.compact(t.newTranslations).length!==t.newTranslations.length}function i(t){return t||""}return{getSaveButtonStatus:n,hasTranslationChanged:r,hasNoTranslation:o,hasEmptyTranslation:a}}t.$inject=["TransStatusService","_"],angular.module("app").factory("PhraseUtil",t)}(),function(){"use strict";function t(){return{getWordStatistic:function(t){return"WORD"===t[0].unit?t[0]:t[1]},getMsgStatistic:function(t){return"MESSAGE"===t[0].unit?t[0]:t[1]}}}angular.module("app").factory("StatisticUtil",t)}(),function(){"use strict";function t(){function t(t,e,n){return n&&t&&e&&(t=t.toUpperCase(),e=e.toUpperCase()),0===t.lastIndexOf(e,0)}function e(t,e,n){return n&&t&&e&&(t=t.toUpperCase(),e=e.toUpperCase()),-1!==t.indexOf(e,t.length-e.length)}function n(t,e,n){return n&&t&&e&&(t=t.toUpperCase(),e=e.toUpperCase()),t===e}return{startsWith:t,endsWith:e,equals:n}}angular.module("app").factory("StringUtil",t)}(),function(){"use strict";function t(t,e,n,r,o){function a(){return l+Array.prototype.join.call(arguments,"")}function i(t){return function(e){return t(e)}}location.origin||(location.origin=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""));var s=this,c="http://www.gravatar.com/avatar",u="config.json",l="",d={},f=location.origin+location.pathname+"translations";return s.serverContextPath="",s.init=function(){return l?n.when(l):e.get(u).then(function(t){var e=t.data;if(e.baseUrl)l=e.baseUrl;else{var n=e.appPath.replace(/^\//g,""),r=location.href.indexOf(n);s.serverContextPath=location.origin+location.pathname,r>=0&&(s.serverContextPath=location.href.substring(0,r)),s.serverContextPath=s.serverContextPath.replace(/\/?$/,"/"),l=s.serverContextPath+"rest"}d=o.mapValues({project:"/project/:projectSlug",docs:"/project/:projectSlug/version/:versionSlug/docs",locales:"/project/:projectSlug/version/:versionSlug/locales",status:"/project/:projectSlug/version/:versionSlug/doc/:docId/status/:localeId",textFlows:"/source+trans/:localeId",docStats:"/stats/project/:projectSlug/version/:versionSlug/doc/:docId/locale/:localeId",myInfo:"/user",userInfo:"/user/:username",translation:"/trans/:localeId",allLocales:"/locales"},i(a)),s.PROJECT_URL=d.project,s.LOCALE_LIST_URL=d.locales,s.DOCUMENT_LIST_URL=d.docs,s.TRANSLATION_STATUS_URL=d.status,s.TEXT_FLOWS_URL=d.textFlows,s.DOC_STATISTIC_URL=d.docStats,s.MY_INFO_URL=d.myInfo,s.USER_INFO_URL=d.userInfo,s.TRANSLATION_URL=d.translation,s.ALL_LOCALE_URL=d.allLocales,s.PROJECT_PAGE=function(t,e){return s.serverContextPath+"iteration/view/"+t+"/"+e},s.DASHBOARD_PAGE=s.serverContextPath+"dashboard"})},s.readValue=function(e){return t.search()[e]},s.gravatarUrl=function(t,e){return c+"/"+t+"?d=mm&r=g&s="+e},s.uiTranslationURL=function(t){return f+"/"+t+".json"},s.uiTranslationListURL=f+"/locales",s}t.$inject=["$location","$http","$q","$stateParams","_"],angular.module("app").factory("UrlService",t)}();
//# sourceMappingURL=../maps/app.js.map