entcore 4.8.14-develop-pedago.202511061128 → 4.8.14-develop-b2school.202511101438

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bundle/ng-app.js CHANGED
@@ -1,5 +1,5 @@
1
- window.infrafrontVersion="4.8.14-develop-pedago.202511061128";
2
- window.springboardBuildDate="2025-11-06T10:29:59.972Z";
1
+ window.infrafrontVersion="4.8.14-develop-b2school.202511101438";
2
+ window.springboardBuildDate="2025-11-10T13:39:31.257Z";
3
3
  !function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};t.m=e,t.c=n,t.p="",t(0)}([function(module,exports,__webpack_require__){"use strict";function injectIntoSelector(e,t){jquery_1.$(document).ready(function(){var n=angular_1.angular.element(e);n.injector().invoke(["$compile",function(e){var r=n.scope(),i=e(t)(r);n.append(i)}])})}var __awaiter=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(exports,"__esModule",{value:!0});var jquery_1=__webpack_require__(1),idiom_1=__webpack_require__(3),http_1=__webpack_require__(34),modelDefinitions_1=__webpack_require__(37),lib_1=__webpack_require__(385),ui_1=__webpack_require__(6),behaviours_1=__webpack_require__(386),globals_1=__webpack_require__(38),template_1=__webpack_require__(390),moment_1=__webpack_require__(916),underscore_1=__webpack_require__(4),angular_1=__webpack_require__(909),entcore_1=__webpack_require__(388),ng_start_1=__webpack_require__(943),directives=__webpack_require__(960),me_1=__webpack_require__(937),axios_1=__webpack_require__(7),theme_1=__webpack_require__(1050),ui=ui_1.ui,module=angular_1.angular.module("app",["ngSanitize","ngRoute"],["$interpolateProvider",function(e){e.startSymbol("[["),e.endSymbol("]]")}]).config(["$sceDelegateProvider",function(e){e.resourceUrlWhitelist(["self",window.CDN_DOMAIN+"/**"])}]).factory("route",["$rootScope","$route","$routeParams",function(e,t,n){var r={},i=void 0,o=void 0;return e.$on("$routeChangeSuccess",function(e,s){r[t.current.action]instanceof Array&&(i!==t.current.action||o!==t.current.params&&0!==Object.getOwnPropertyNames(t.current.params).length)&&(i=t.current.action,o=t.current.params,r[t.current.action].forEach(function(e){return e(n)}),setTimeout(function(){ui.scrollToId(window.location.hash.split("#")[1])},100))}),function(e){for(var t in e)r[t]||(r[t]=[]),r[t].push(e[t])}}]).factory("model",["$timeout",function(e){var t=modelDefinitions_1.Collection.prototype.trigger;modelDefinitions_1.Collection.prototype.trigger=function(n){e(function(){t.call(this,n)}.bind(this),10)};var n=modelDefinitions_1.Model.prototype.trigger;return modelDefinitions_1.Model.prototype.trigger=function(t,r){e(function(){n.call(this,t,r)}.bind(this),10)},modelDefinitions_1.model}]).factory("xmlHelper",function(){return{xmlToJson:function(e,t,n,r){var i,o=this;return t||(t={}),n||(n=!0),null==r&&(r=!0),i=n&&e.nodeName.indexOf(":")>-1?e.nodeName.split(":")[1]:e.nodeName,jquery_1.$(e).children().length>0?(t[i]=r?{}:[],underscore_1._.each(jquery_1.$(e).children(),function(e){if(r)return o.xmlToJson(e,t[i],n,r);t[i].push(o.xmlToJson(e,{},n,r))})):t[i]=jquery_1.$(e).text(),t}}}).factory("httpWrapper",function(){return{wrap:function(e,t,n){var r=this;if("function"==typeof t&&("object"!=typeof r[e]&&(r[e]={}),!r[e].loading)){r[e].loading=!0;for(var i=[],o=3;o<arguments.length;o++)i.push(arguments[o]);var s,a=function(){r[e].loading=!1,r.$apply()};s=n?t.apply(n,i):t.apply(r,i),s&&s.xhr?s.xhr.complete(a):a()}}}});theme_1.initThemeDirective(module),theme_1.initThemeLegacyDirective(module),globals_1.routes.routing&&module.config(["$routeProvider",globals_1.routes.routing]);for(var directive in directives)ng_start_1.ng.directives.push(directives[directive]);module.directive("container",["$timeout",function(e){return{restrict:"E",scope:!0,template:'<div ng-include="templateContainer"></div>',controller:["$scope","$attrs",function(t,n){t.tpl=template_1.template;var r=n.template;this.template=r;var i=function(){e(function(){t.templateContainer=template_1.template.containers[r],"empty"===t.templateContainer&&(t.templateContainer=void 0)},0)};template_1.template.watch(r,i),t.$on("$destroy",function(){template_1.template.unwatch(r,i)}),r&&(t.templateContainer=template_1.template.containers[r])}]}}]),module.directive("colorSelect",function(){return{restrict:"E",scope:{ngModel:"="},replace:!0,template:'<div class="color-picker" ng-class="{ opened: pickColor }"><button class="colors-opener" type="button"></button><div class="colors-list"><button type="button" ng-repeat="color in colors" class="[[color]]" ng-click="setColor(color)"></button></div></div>',link:function(e,t,n){e.colors=["orange","red","purple","blue","green","black","white","transparent"],e.setColor=function(t){e.ngModel=t},t.find(".colors-opener").on("click",function(t){e.pickColor=!e.pickColor,e.$apply("pickColor"),t.stopPropagation(),jquery_1.$("body, .main").one("click",function(){e.pickColor=!1,e.$apply("pickColor")})})}}}),module.directive("soundSelect",function(){return{restrict:"E",transclude:!0,scope:{ngModel:"=",ngChange:"&",visibility:"@"},template:'<div><audio ng-src="[[ngModel]]" controls ng-if="ngModel" style="cursor: pointer"></audio><button ng-click="display.userSelecting = true"><i18n>audio.pick</i18n></button><lightbox show="display.userSelecting" on-close="userSelecting = false;"><div ng-if="display.userSelecting"><media-library visibility="selectedFile.visibility"ng-change="updateDocument()" ng-model="selectedFile.file" file-format="\'audio\'"></media-library></div></lightbox></div>',link:function(e,t,n){e.display={},e.selectedFile={file:{},visibility:"protected"},e.selectedFile.visibility=e.$parent.$eval(n.visibility),e.selectedFile.visibility||(e.selectedFile.visibility="protected"),e.selectedFile.visibility=e.selectedFile.visibility.toLowerCase(),e.updateDocument=function(){e.display.userSelecting=!1;var t="/workspace/document/";"public"===e.selectedFile.visibility&&(t="/workspace/pub/document/"),e.ngModel=t+e.selectedFile.file._id,e.$apply("ngModel"),e.ngChange()},t.on("click","audio",function(){e.userSelecting=!0,e.$apply("userSelecting")})}}}),module.directive("mediaSelect",function(){return{restrict:"E",transclude:!0,replace:!0,scope:{ngModel:"=",multiple:"=",ngChange:"&",fileFormat:"=",label:"@",class:"@",value:"@",mytooltip:"@"},template:'<div><input type="button" class="pick-file [[class]]" tooltip="[[mytooltip]]" /><lightbox show="userSelecting" on-close="userSelecting = false;"><div ng-if="userSelecting"><media-library ng-change="updateDocument()" ng-model="selectedFile.file" multiple="multiple" file-format="fileFormat" visibility="selectedFile.visibility"></media-library></div></lightbox></div>',compile:function(e,t){return!t.mytooltip&&t.tooltip&&(console.warn("tooltip attribute is deprecated on media-select tag, use mytooltip instead."),e.attr("mytooltip",t.tooltip),e.removeAttr("tooltip"),t.mytooltip=t.tooltip,delete t.tooltip),function(e,t,n){e.selectedFile={file:{},visibility:"protected"},e.selectedFile.visibility=e.$parent.$eval(n.visibility),e.selectedFile.visibility||(e.selectedFile.visibility="protected"),e.selectedFile.visibility=e.selectedFile.visibility.toLowerCase(),e.mytooltip||t.find("input").removeAttr("tooltip"),n.$observe("label",function(e){t.find("[type=button]").attr("value",idiom_1.idiom.translate(e))}),e.$watch("fileFormat",function(t){void 0===t&&(e.fileFormat="img")}),e.updateDocument=function(){e.userSelecting=!1;var t="/workspace/document/";"public"===e.selectedFile.visibility&&(t="/workspace/pub/document/"),e.ngModel=t+e.selectedFile.file._id,e.$apply("ngModel"),e.ngChange()},t.find(".pick-file").on("click",function(){e.userSelecting=!0,e.$apply("userSelecting")})}}}}),module.directive("filesPicker",function(){return{restrict:"E",transclude:!0,replace:!0,template:'<input type="button" ng-transclude />',scope:{ngChange:"&",ngModel:"="},link:function(e,t,n){t.on("click",function(){var t=jquery_1.$("<input />",{type:"file"}).hide().appendTo("body");void 0!==n.multiple&&t.attr("multiple",!0),t.on("change",function(){e.ngModel=t[0].files,e.$apply(),e.$eval(e.ngChange),e.$parent.$apply()}),t.click(),t.trigger("touchstart")})}}}),module.directive("filesInputChange",function(){return{restrict:"A",scope:{filesInputChange:"&",file:"=ngModel"},link:function(e,t){e.$watch("file",function(e,n){e!==n&&(e||(t[0].value=""))}),t.bind("change",function(){e.file=t[0].files,e.$apply(),e.filesInputChange(),e.$apply()})}}}),module.directive("iconsSelect",function(){return{restrict:"E",scope:{options:"=",class:"@",current:"=",change:"&"},link:function(e,t,n){var r;e.separateIcon=n.hasOwnProperty("separateIcon");var i=function(){e.current.id=r.id,e.current.icon=r.icon,e.current.text=r.text};e.$watch("options",function(){e.options&&e.options.length&&(r=underscore_1._.findWhere(e.options,{id:e.current.id}),i(),t.bind("change",function(){r=underscore_1._.findWhere(e.options,{id:t.find(".current").data("selected")}),i(),e.$eval(e.change),e.$apply()}))},!0)},template:'\n\t\t\t<div ng-class="{\'drop-down-block\': !separateIcon}">\n\t\t\t\t<div ng-if="separateIcon" class="current fixed cell twelve" data-selected="[[current.id]]">\n\t\t\t\t\t<i class="[[current.icon]]"></i>\n\t\t\t\t\t<span translate content="[[current.text]]"></span>\n\t\t\t\t</div>\n\t\t\t\t<article ng-if="!separateIcon" class="current cell twelve medium-block-container" data-selected="[[current.id]]">\n\t\t\t\t\t<div class="flex-row drop-down-label no-margin no-border">\n\t\t\t\t\t\t<i class="arrow no-margin right-spacing"></i>\n\t\t\t\t\t\t<i class="[[current.icon]] cell no-2d no-margin right-spacing-twice"></i>\n\t\t\t\t\t\t<i class="[[current.icon === \'default\' ? \'none\' : current.icon]] cell no-1d no-margin right-spacing-twice"></i>\n\t\t\t\t\t\t<h2 class="cell-ellipsis"><a translate content="[[current.text]]"></a></h2>\n\t\t\t\t\t</div>\n\t\t\t\t</article>\n\t\t\t\t<div class="options-list icons-view">\n\t\t\t\t<div class="wrapper">\n\t\t\t\t\t<div class="cell three option" data-value="[[option.id]]" data-ng-repeat="option in options">\n\t\t\t\t\t\t<i class="[[option.icon]] no-2d"></i>\n\t\t\t\t\t\t<i class="[[option.icon === \'default\' ? \'none\' : option.icon]] no-1d"></i>\n\t\t\t\t\t\t<span translate content="[[option.text]]"></span>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t'}}),module.directive("preview",function(){return{restrict:"E",template:'<div class="row content-line"><div class="row fixed-block height-four"><div class="four cell fixed image clip text-container"></div><div class="eight cell fixed-block left-four paragraph text-container"></div></div></div>',replace:!0,scope:{content:"="},link:function(e,t,n){e.$watch("content",function(e){var n=jquery_1.$(e);t.find(".image").html(n.find("img").first());var r=underscore_1._.find(n.find("p"),function(e){return jquery_1.$(e).text().length>0});t.find(".paragraph").text(jquery_1.$(r).text())})}}}),module.service("tracker",["$document","$location","$rootScope",function(){var e=function(e,t,n){this.$document=e,this.$location=t,this.$rootScope=n,this.type="none",this.params={},this.isInitialized=!1,this.hasOptedIn=!1};return e.prototype.init=function(){var e=this;http_1.http().get("/analyticsConf").done(function(t){t&&"string"==typeof t.type&&t.type.trim().length>0&&t[t.type.trim()]&&e.initFromType(t.type,t[t.type])}).error(function(e){})},e.prototype.initFromType=function(e,t){if(!this.isInitialized)switch(this.isInitialized=!0,this.type=e,this.params=t,e){case"matomo":try{var n=window._paq=window._paq||[];n.push(["setRequestMethod","POST"]),t.UserId&&n.push(["setUserId",t.UserId]),t.Profile&&n.push(["setCustomDimension",1,t.Profile]),t.School&&n.push(["setCustomDimension",2,t.School]),t.Project&&n.push(["setCustomDimension",3,t.Project]),n.push(["trackPageView"]),n.push(["enableLinkTracking"]),function(){n.push(["setTrackerUrl",t.url+"matomo.php"]),n.push(["setSiteId",t.siteId]);var e=document,r=e.createElement("script"),i=e.getElementsByTagName("script")[0];r.type="text/javascript",r.async=!0,r.src=t.url+"ode.js",i.parentNode.insertBefore(r,i)}();var r=this;if(n.push([function(){r.hasOptedIn=!this.isUserOptedOut(),r.$rootScope.$digest()}]),t.detailApps&&window.entcore.template){if(angular_1.angular.isArray(t.doNotTrack)&&modelDefinitions_1.model&&modelDefinitions_1.model.me&&angular_1.angular.isArray(modelDefinitions_1.model.me.apps))for(var i=0;i<modelDefinitions_1.model.me.apps.length;i++)if(modelDefinitions_1.model.me.apps[i]&&modelDefinitions_1.model.me.apps[i].address&&modelDefinitions_1.model.me.apps[i].name&&-1!==this.$location.absUrl().indexOf(modelDefinitions_1.model.me.apps[i].address)&&-1!==t.doNotTrack.indexOf(modelDefinitions_1.model.me.apps[i].name))return;var o=this,s=window.entcore.template.open;window.entcore.template.open=function(e,t){var n=s.apply(window.entcore.template,arguments);if("main"===e){t=t||"unknown";var r=o.$location.absUrl().split("#")[0]+"/"+t;o.trackPage(o.$document[0].title+" - "+e,r)}return n}}}catch(e){console.error('Invalid tracker object. Should look like {"siteId": 99999, "url":"http://your.matomo.server.com/"}"',e)}}},e.prototype.trackPage=function(e,t){switch(this.type){case"matomo":var n=window._paq=window._paq||[];n.push(["setDocumentTitle",e]),n.push(["setCustomUrl",t]),n.push(["trackPageView"])}},e.prototype.trackEvent=function(e,t,n,r){switch(this.type){case"matomo":var i=window._paq=window._paq||[],o=["trackEvent",e,t];"string"==typeof n&&(n=n.trim(),n.length>0&&o.push(n)),"number"==typeof r&&o.push(r),i.push(o)}},e.prototype.saveOptIn=function(){switch(this.type){case"matomo":(window._paq=window._paq||[]).push(this.hasOptedIn?["forgetUserOptOut"]:["optUserOut"])}},e}()]);var profileTypes=function(){switch(modelDefinitions_1.model.me.type){case"ENSEIGNANT":return"teacher";case"ELEVE":return"student";case"PERSRELELEVE":return"relative";case"PERSEDUCNAT":return"personnel";default:return modelDefinitions_1.model.me.type}};module.directive("portal",["$compile","tracker",function(e,t){function n(){http_1.http().get("/zendeskGuide/config").done(function(e){if(e&&e.key){var t=document.createElement("script");t.id="ze-snippet",t.src="https://static.zdassets.com/ekr/snippet.js?key="+e.key,document.body.appendChild(t).onload=function(){"es"===window.currentLanguage?window.zE(function(){window.zE.setLocale("es-419")}):window.zE(function(){window.zE.setLocale("fr")});var t=window.location.href;Object.keys(e.module).length>0&&r(e.module,t),window.zE("webWidget","updateSettings",{webWidget:{color:{theme:e.color||"#ffc400"},zIndex:8e3,launcher:{mobile:{labelVisible:!0}},contactForm:{suppress:!modelDefinitions_1.model.me.hasWorkflow("net.atos.entng.support.controllers.DisplayController|view")},helpCenter:{messageButton:{"*":"Assistance ENT","es-419":"Asistencia ENT"},originalArticleButton:null===e.articleRedirectButton||void 0===e.articleRedirectButton||e.articleRedirectButton}}}),window.addEventListener("scroll",function(){window.zE("webWidget","updateSettings",{webWidget:{launcher:{mobile:{labelVisible:window.scrollY<=5}}}})}),window.addEventListener("beforeprint",function(){window.zE("webWidget","hide")}),window.addEventListener("afterprint",function(){window.zE("webWidget","show")}),window.zE("webWidget:on","open",function(){Object.keys(e.module).length>0&&window.location.href!==t&&(r(e.module,window.location.href),t=window.location.href),modelDefinitions_1.model.me.hasWorkflow("net.atos.entng.support.controllers.DisplayController|view")&&window.zE("webWidget","updateSettings",{webWidget:{contactForm:{suppress:!1}}})}),window.zE("webWidget:on","userEvent",function(e){var t=e.category,n=e.action,r=e.properties;"Contact Form Shown"===n&&"Zendesk Web Widget"===t&&r&&"contact-form"===r.name&&modelDefinitions_1.model.me.hasWorkflow("net.atos.entng.support.controllers.DisplayController|view")&&(window.zE("webWidget","updateSettings",{webWidget:{contactForm:{suppress:!0}}}),window.zE("webWidget","close"),window.open("/support","_blank"))})}}})}function r(e,t){var n=t.split("/"),r="",i="";if(e.labels&&Object.keys(e.labels).length>0&&n.length>3){for(var o=3;o<n.length;o++)n[o].length>0&&(null==n[o].match(/\d/)||"viescolaire#"===n[3]&&null!==n[o].match(/\%20/))&&(r=0===r.length?n[o]:r+"/"+n[o]);e.labels.hasOwnProperty(r)?i=e.labels[r]:e.default&&String(e.default).length>0&&(i=e.default)}else e.default&&String(e.default).length>0&&(i=e.default);n&&n.includes("formulaire#")&&window.zE("webWidget","updateSettings",{webWidget:{offset:{mobile:{horizontal:"70px",vertical:"0px"}}}}),i.includes("${adml}")&&(i=me_1.Me.session.functions.ADMIN_LOCAL?i.replace("${adml}","adml"):i.replace("/${adml}","")),i.includes("${profile}")&&(i=i.replace("${profile}",profileTypes())),i.includes("${theme}")&&(i=entcore_1.skin.is1D?i.replace("${theme}","1D"):i.replace("${theme}","2D")),i.length>0&&window.zE("webWidget","helpCenter:setSuggestions",{labels:[i]})}return{restrict:"E",transclude:!0,templateUrl:function(e,t){var n=window.springboardBuildDate||(new Date).getTime();return t.templateUrl?t.templateUrl+"?version="+n:entcore_1.skin.portalTemplate+"?version="+n},compile:function(r,i,o){return t.init(),modelDefinitions_1.model.me.hasWorkflow("fr.openent.chatbot.controller.ChatbotController|view")&&behaviours_1.Behaviours.loadBehaviours("chatbot",function(){behaviours_1.Behaviours.applicationsBehaviours.chatbot.chatbot.init()}),modelDefinitions_1.model.me.hasWorkflow("org.entcore.portal.controllers.PortalController|optionalFeatureCantoo")&&http_1.http().get("/optionalFeature/cantoo").done(function(e){var t=document.createElement("script");t.src=e.scriptPath,t.async=!0,document.body.appendChild(t)}),n(),jquery_1.$("html").addClass("portal-container"),r.find("[logout]").attr("href","/auth/logout?callback="+entcore_1.skin.logoutCallback),i.templateUrl||ui.setStyle(entcore_1.skin.theme),http_1.Http.prototype.bind("disconnected",function(){window.location.href="/"}),function(t,n,r,i,o){t.template=template_1.template,t.$$showInfoTipRgpdCookie=!0,t.goToMyAccount=function(){document.location.href="/userbook/mon-compte",axios_1.default.put("/userbook/preference/rgpdCookies",{showInfoTip:!1})},t.closeBanner=function(){t.$$showInfoTipRgpdCookie=!1,axios_1.default.put("/userbook/preference/rgpdCookies",{showInfoTip:!1})},t.$on("$locationChangeStart",function(e,t,n){window.zE&&window.zE("webWidget","close")});n.prepend(e('\n\t\t\t\t\t<div class="ode-theme-v1">\n\t\t\t\t\t\t<infotip\n\t\t\t\t\t\t\tname="showInfoTip" \n\t\t\t\t\t\t\tclass="info" \n\t\t\t\t\t\t\tstyle="position:fixed; bottom:0; right:20px; width: 400px; z-index: 1000"\n\t\t\t\t\t\t\tsave-preference-under="rgpdCookies"\n\t\t\t\t\t\t\tshow-once="false"\n\t\t\t\t\t\t\tng-show="$$showInfoTipRgpdCookie"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t<i18n>rgpd.cookies.banner.text1</i18n>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<div class="right-magnet">\n\t\t\t\t\t\t\t\t<button type="button" ng-click="goToMyAccount()" class="cancel">\n\t\t\t\t\t\t\t\t\t<i18n>rgpd.cookies.banner.button.consult</i18n>\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<button type="button" ng-click="closeBanner()">\n\t\t\t\t\t\t\t\t\t<i18n>rgpd.cookies.banner.button.close</i18n>\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</infotip>\n\t\t\t\t\t</div>\n\t\t\t\t')(t))}}}}]),module.directive("publicInfotip",["$compile","tracker",function(e,t){return{restrict:"E",transclude:!0,template:'\n\t\t<infotip\n\t\t\tname="showInfoTip"\n\t\t\tclass="info"\n\t\t\tstyle="position:fixed; bottom:0; right:20px; width: 400px; z-index: 1000"\n\t\t\tsave-preference-under="rgpdCookies"\n\t\t\tshow-once="false"\n\t\t\tng-show="$$showPublicInfoTipRgpdCookie">\n\t\t\t<p>\n\t\t\t\t<i18n>rgpd.cookies.banner.text2</i18n>\n\t\t\t</p>\n\t\t\t<div class="right-magnet">\n\t\t\t\t<button type="button" ng-click="closeBanner()">\n\t\t\t\t\t<i18n>rgpd.cookies.banner.button.close</i18n>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</infotip>\n\t\t',link:function(e,t,n){e.template=template_1.template,e.$$showPublicInfoTipRgpdCookie=!1;var r=window.localStorage.getItem("showInfoTip.cookies");modelDefinitions_1.model.me||"false"==r||(e.$$showPublicInfoTipRgpdCookie=!0),e.closeBanner=function(){e.$$showPublicInfoTipRgpdCookie=!1,window.localStorage.setItem("showInfoTip.cookies","false")}}}}]),module.directive("xiti",function(){return{restrict:"E",compile:function(e,t){return function(t){jQuery.getScript("/xiti/public/js/directive.js",function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){switch(n.label){case 0:return e.on("run.script",function(e,t){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return[4,window.xiti.run(t)];case 1:return e.sent(),[2]}})})}),t.$on("$destroy",function(){e.off()}),[4,window.xiti.run()];case 1:return n.sent(),[2]}})})})}}}}),module.directive("adminPortal",function(){return entcore_1.skin.skin="admin",entcore_1.skin.theme="/public/admin/default/",{restrict:"E",transclude:!0,templateUrl:"/public/admin/portal.html",compile:function(e,t,n){jquery_1.$("html").addClass("portal-container"),jquery_1.$("[logout]").attr("href","/auth/logout?callback="+entcore_1.skin.logoutCallback),http_1.http().get("/userbook/preference/admin").done(function(e){var t=e.preference?JSON.parse(e.preference):null;t&&t.path?ui.setStyle("/public/admin/"+t.path+"/"):ui.setStyle(entcore_1.skin.theme)}).error(function(e){ui.setStyle(entcore_1.skin.theme)})}}}),module.directive("portalStyles",function(){return{restrict:"EA",compile:function(e,t){"false"!=t.portalStyles&&jquery_1.$("html").addClass("portal-container"),jquery_1.$("[logout]").attr("href","/auth/logout?callback="+entcore_1.skin.logoutCallback),ui.setStyle(entcore_1.skin.theme)}}}),module.directive("defaultStyles",function(){return{restrict:"EA",link:function(e,t,n){"false"!=n.defaultStyles&&jquery_1.$("html").addClass("portal-container"),ui.setStyle(entcore_1.skin.theme)}}}),module.directive("skinSrc",function(){return{restrict:"A",scope:"&",link:function(e,t,n){if(jquery_1.$("#theme").attr("href")){var r=entcore_1.skin.basePath;n.$observe("skinSrc",function(){-1===n.skinSrc.indexOf("http://")&&-1===n.skinSrc.indexOf("https://")&&-1===n.skinSrc.indexOf("/workspace/")?t.attr("src",r+n.skinSrc):t.attr("src",n.skinSrc)})}}}}),module.directive("defaultSrc",function(){return{restrict:"A",scope:"&",link:function(e,t,n){t.bind("error",function(){void 0!=n.defaultSrc&&(-1===n.defaultSrc.indexOf("http://")&&-1===n.defaultSrc.indexOf("https://")&&-1===n.defaultSrc.indexOf("/workspace/")?t.attr("src",entcore_1.skin.basePath+n.defaultSrc):t.attr("src",n.defaultSrc),n.defaultSrc=void 0)})}}}),module.directive("localizedClass",function(){return{restrict:"A",link:function(e,t,n){n.$addClass(globals_1.currentLanguage)}}}),module.directive("pullDownMenu",function(){return{restrict:"E",transclude:!0,template:'<div class="pull-down-menu hide" ng-transclude></div>',controller:function(e){}}}),module.directive("pullDownOpener",function(){return{restrict:"E",require:"^pullDownMenu",transclude:!0,template:'<div class="pull-down-opener" ng-transclude></div>',link:function(e,t,n){t.find(".pull-down-opener").on("click",function(){var e=t.parents(".pull-down-menu");e.hasClass("hide")?(setTimeout(function(){jquery_1.$("body").on("click.pulldown",function(){e.addClass("hide"),jquery_1.$("body").unbind("click.pulldown")})},0),e.removeClass("hide")):(jquery_1.$("body").unbind("click.pulldown"),e.addClass("hide"))})}}}),module.directive("pullDownContent",function(){return{restrict:"E",require:"^pullDownMenu",transclude:!0,template:'<div class="wrapper"><div class="arrow"></div><div class="pull-down-content" ng-transclude></div></div>',link:function(e,t,n){}}}),module.directive("topNotification",function(){return{restrict:"E",template:'<div class="notify-top"><div class="notify-top-content" ng-bind-html="content"></div><div class="notify-top-actions"><span ng-click="cancel()">[[doConfirm ? labels().cancel : labels().ok]]</span><span ng-click="ok()" ng-show="doConfirm">[[labels().confirm]]</span> </div></div>',scope:{trigger:"=",confirm:"=",content:"=",labels:"&"},link:function(e,t,n){t.css("display","none"),e.doConfirm=!1,e.cancel=function(){e.trigger=!1},e.ok=function(){e.trigger=!1,e.confirm()},e.labels()||(e.labels=function(){return{confirm:idiom_1.idiom.translate("confirm"),cancel:idiom_1.idiom.translate("cancel"),ok:idiom_1.idiom.translate("ok")}}),e.$watch("trigger",function(e){e?t.slideDown():t.slideUp()}),e.$watch("confirm",function(t){e.doConfirm=!!t})}}}),module.directive("dropDownButton",function(){return{restrict:"E",transclude:"true",controller:["$scope",function(e){}],template:'<div class="drop-down-button hidden"><div ng-transclude></div></div>',link:function(e,t,n){t.on("click",".opener",function(){t.find(".drop-down-button").removeClass("hidden"),jquery_1.$(document).one("mousedown",function(e){setTimeout(function(){t.find(".drop-down-button").addClass("hidden")},200)})})}}}),module.directive("opts",function(){return{restrict:"E",require:"^dropDownButton",transclude:!0,template:'<div class="options"><ul ng-transclude></ul></div>',link:function(e,t,n){t.on("click","li",function(){t.parents(".drop-down-button").addClass("hidden")})}}}),module.directive("loadingIcon",function(){return{restrict:"E",link:function(e,t,n){var r=function(){if(0!==jquery_1.$("#theme").length){var e=entcore_1.skin.basePath+"/img/icons/anim_loading_small.gif";jquery_1.$("<img>").attr("src",e).attr("class",n.class).addClass("loading-icon").appendTo(t)}};"loading"===n.default&&r(),http_1.http().bind("request-started."+n.request,function(e){t.find("img").remove(),r()}),void 0===n.onlyLoadingIcon?http_1.http().bind("request-ended."+n.request,function(e){var n=entcore_1.skin.basePath+"/img/icons/checkbox-checked.png";t.find(".loading-icon").remove(),jquery_1.$("<img>").attr("src",n).appendTo(t)}):http_1.http().bind("request-ended."+n.request,function(e){t.find("img").remove()})}}}),module.directive("loadingPanel",function(){return{restrict:"A",link:function(e,t,n){n.$observe("loadingPanel",function(e){http_1.http().bind("request-started."+n.loadingPanel,function(e){var n=entcore_1.skin.basePath+"/img/illustrations/loading.gif";0===t.children(".loading-panel").length&&t.append('<div class="loading-panel"><h1>'+idiom_1.idiom.translate("loading")+'</h1><img src="'+n+'" /></div>')}),http_1.http().bind("request-ended."+n.loadingPanel,function(e){t.find(".loading-panel").remove()})})}}}),module.directive("behaviour",function(){return{restrict:"E",template:"<div ng-transclude></div>",replace:!1,transclude:!0,scope:{resource:"="},link:function(e,t,n){if(console.error('This directive is deprecated. Please use "authorize" instead.'),!n.name)throw"Behaviour name is required";var r=t.children("div");e.$watch("resource",function(t){e.resource instanceof Array&&void 0!==underscore_1._.find(e.resource,function(e){return!e.myRights||void 0===e.myRights[n.name]})||e.resource instanceof modelDefinitions_1.Model&&(!e.resource.myRights||void 0===e.resource.myRights[n.name])?r.hide():r.show()})}}}),module.directive("authorize",function(){return{restrict:"EA",link:function(e,t,n){if(void 0===n.name&&void 0===n.authorize)throw"Right name is required";var r=t.children("div"),i=function(){var i=e.$eval(n.resource),o=n.name||n.authorize;o&&i instanceof Array&&void 0!==underscore_1._.find(i,function(e){return!e.myRights||void 0===e.myRights[o]})||i instanceof modelDefinitions_1.Model&&(!i.myRights||void 0===i.myRights[o])?(r.remove(),t.hide()):(t.append(r),t.show())};n.$observe("name",i),n.$observe("authorize",i),e.$watch(function(){return e.$eval(n.resource)},i)}}}),module.directive("drawingZone",function(){return function(e,t,n){t.addClass("drawing-zone")}}),module.directive("resizable",function(){return{restrict:"A",link:function(e,t,n){ui.extendElement.resizable(t,{lock:{horizontal:t.attr("horizontal-resize-lock"),vertical:t.attr("vertical-resize-lock")},thickness:n.resizeThickness?parseInt(n.resizeThickness):void 0,preserveRatio:n.preserveRatio&&"false"!==n.preserveRatio})}}}),module.directive("draggable",function(){return{restrict:"A",link:function(e,t,n){"false"!=n.draggable&&void 0===n.native&&ui.extendElement.draggable(t,{mouseUp:function(){t.on("click",function(){e.$parent.$eval(n.ngClick)})},noScroll:void 0!==n.draggablePreventScroll})}}}),module.directive("progressBar",function(){return{restrict:"E",scope:{max:"=",filled:"=",unit:"@"},template:'<div class="progress-bar"><div class="filled" ng-style="{width: filledPercent + \'%\'}">[[filled]] <span translate content="[[unit]]"></span></div>[[max]] <span translate content="[[unit]]"></span></div>',link:function(e,t,n){function r(){e.filledPercent=100*e.filled/e.max,e.filledPercent<10?t.find(".filled").addClass("small"):t.find(".filled").removeClass("small")}e.filledPercent=0,e.$watch("filled",function(e){r()}),e.$watch("max",function(e){r()})}}});var getDatePickerFormat=function(){return"datepicker.format"==idiom_1.idiom.translate("datepicker.format")?"dd/mm/yyyy":idiom_1.idiom.translate("datepicker.format")},getDatePickerMomentFormat=function(){return getDatePickerFormat().toUpperCase()},DatepickerController=function(){function e(e){this.element=e,this._started=!1}return e.prototype.init=function(e){if(this.element.datepicker){var t=this.element.datepicker(e);return this._started=!0,t}throw"[DatepickerController.init] datepicker plugin is not ready"},e.prototype.hide=function(){this._started&&this.element.datepicker("hide")},e.prototype.show=function(){this._started&&this.element.datepicker("show")},e.prototype.setValue=function(e){this._started&&this.element.datepicker("setValue",e)},e.prototype.destroy=function(){this._started&&this.element.datepicker("destroy"),this._started=!1},e}();module.directive("datePicker",["$compile","$timeout",function(e,t){return{scope:{minDate:"=",ngModel:"=",ngChange:"&",datePickerDelegate:"="},transclude:!0,replace:!0,restrict:"E",require:"ngModel",template:'<input ng-transclude type="text" ng-readonly="isreadonly"/>',link:function(e,t,n,r){e.modelCtrl=r;var i=function(){return e.datePickerDelegate},o=function(){i()&&i().onValidationChange&&i().onValidationChange({valid:r.$valid})};e.$watch("modelCtrl.$valid",function(){return o()}),e.$on("$destroy",function(){i()&&i().onDestroy&&i().onDestroy({ngModel:r})}),i()&&i().onInit&&i().onInit({ngModel:r});var s=getDatePickerFormat(),a=getDatePickerMomentFormat();e.isreadonly=!!n.readonly;var u=new DatepickerController(t),c=function(e){return moment_1.moment(e,["DD/MM/YYYY","YYYY-MM-DD","YYYY-MM-DD[T]HH:mm:ss.SSS[Z]","YYYY-MM-DD[T]HH:mm:ss.SSS","YYYY-MM-DD[T]HH:mm:ss"],!0)};r.$formatters.push(function(e){var t=function(e){return"string"==typeof e?c(e):e instanceof Date?moment_1.moment(e):"object"==typeof e&&e.isValid?e:null}(e);return t&&t.isValid&&t.isValid()?(d(t),t.format(a)):""});var l=function(e){return e?moment_1.moment(e,[a,"YYYY-MM-DD"],!0):null};r.$parsers.push(function(e){var t=l(e);return t&&t.isValid&&t.isValid()?(d(t),t.toDate()):r.$modelValue}),r.$validators.validDateMoment=function(e,t){var n=l(t);return!n||!n.isValid||n.isValid()};var d=function(e){if(e&&e.isValid&&e.isValid()){var t=e.format(a);u.setValue(t)}};r.$viewChangeListeners.push(function(){var t=e.minDate;t&&t.setHours(0,0,0,0),t&&r.$modelValue<t?setTimeout(function(){r.$setViewValue(moment_1.moment(t).format(a))}):setTimeout(function(){e.$parent.$eval(e.ngChange),e.$parent.$apply()})});var h=function(){r.$setViewValue(t.val())};e.minDate&&e.$watch("minDate",function(e){h()}),http_1.http().loadScript("/"+globals_1.infraPrefix+"/public/js/bootstrap-datepicker.js").then(function(){var e=moment_1.moment.weekdays().indexOf(moment_1.moment.weekdays(!0)[0]);u.init({format:s,weekStart:e,dates:{months:moment_1.moment.months(),monthsShort:moment_1.moment.monthsShort(),days:moment_1.moment.weekdays(),daysShort:moment_1.moment.weekdaysShort(),daysMin:moment_1.moment.weekdaysMin()}}).on("changeDate",function(){h(),u.hide()}),u.hide()});var f=function(e){(!e.originalEvent||t[0]!==e.originalEvent.target&&0===jquery_1.$(".datepicker").find(e.originalEvent.target).length)&&u.hide()};jquery_1.$("body, lightbox").on("click",f),jquery_1.$("body, lightbox").on("focusin",f),t.on("focus",function(){jquery_1.$(this).parents("form").on("submit",function(){u.hide()}),u.show()}),t.on("$destroy",function(){u.hide()})}}}]),module.directive("datePickerIcon",function(){return{scope:{ngModel:"=",ngChange:"&"},replace:!0,restrict:"E",template:'<div class="date-picker-icon"> <input type="text" class="hiddendatepickerform" style="visibility: hidden; width: 0px; height: 0px; float: inherit"/> <a ng-click="openDatepicker()"><i class="calendar"></i></a> </div>',link:function(e,t,n){http_1.http().loadScript("/"+globals_1.infraPrefix+"/public/js/bootstrap-datepicker.js").then(function(){var n=getDatePickerFormat(),r=getDatePickerMomentFormat(),i=t.find(".hiddendatepickerform");i.value=moment_1.moment(new Date).format(r);var o=moment_1.moment.weekdays().indexOf(moment_1.moment.weekdays(!0)[0]);i.datepicker({format:n,weekStart:o,dates:{months:moment_1.moment.months(),monthsShort:moment_1.moment.monthsShort(),days:moment_1.moment.weekdays(),daysShort:moment_1.moment.weekdaysShort(),daysMin:moment_1.moment.weekdaysMin()}}).on("changeDate",function(t){e.ngModel=t.date,e.$apply("ngModel"),jquery_1.$(this).datepicker("hide"),"function"==typeof e.ngChange&&e.ngChange()}),i.datepicker("hide"),e.openDatepicker=function(){i.datepicker("show")}})}}}),module.directive("filters",function(){return{restrict:"E",template:'<div class="row line filters"><div class="filters-icons"><ul ng-transclude></ul></div></div><div class="row"></div> ',transclude:!0,link:function(e,t,n){}}}),module.directive("alphabetical",["$parse",function(e){return{restrict:"E",controller:["$scope",function(e){e.letters=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","#"],e.matchingElements={},e.matching=function(t){return function(n){return n[e.title][0].toUpperCase()===t||"#"===t&&n[e.title][0].toLowerCase()===n[e.title][0].toUpperCase()}},e.updateElements=function(){e.letters.forEach(function(t){e.matchingElements[t]=underscore_1._.filter(e.collection(e),function(n){return n[e.title][0].toUpperCase()===t||"#"===t&&n[e.title][0].toLowerCase()===n[e.title][0].toUpperCase()})})},e.display||(e.display={}),e.display.pickLetter}],compile:function(t,n){var r=n.list,i=t.html();i=i.replace('<div class="item"','<div ng-repeat="'+r+' |filter: matching(letter)" class="item"'),t.html('<lightbox class="letter-picker" show="display.pickLetter" on-close="display.pickLetter = false;"><div ng-repeat="letter in letters"><h2 ng-click="viewLetter(letter)" class="cell" ng-class="{disabled: matchingElements[letter].length <= 0 }">[[letter]]</h2></div></lightbox><div ng-repeat="letter in letters"><div ng-if="matchingElements[letter].length > 0" class="row"><h1 class="letter-picker" ng-click="display.pickLetter = true;" id="alphabetical-[[letter]]">[[letter]]</h1><hr class="line" /><div class="row">'+i+'</div></div><div ng-if="matchingElements[letter].length > 0" class="row"></div></div>'),t.addClass("alphabetical");var o=r.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/),s=o[2];return function(t,n,r){t.title=r.title||"title",n.removeAttr("title"),t.collection=e(s),t.$watchCollection(s,function(e){t.updateElements()}),t.updateElements(),t.viewLetter=function(e){document.getElementById("alphabetical-"+e).scrollIntoView(),t.display.pickLetter=!1}}}}}]),module.directive("completeClick",["$parse",function(e){return{compile:function(t,n){var r=e(n.completeClick);return function(e,t,n){t.on("click",function(t){e.$apply(function(){r(e,{$event:t})})})}}}}]),module.directive("dragstart",["$parse",function(e){return{restrict:"A",link:function(t,n,r){var i=e(r.dragstart),o=e(r.ngModel);if(void 0!==r.dragcondition&&!1===t.$eval(r.dragcondition))return void n.attr("draggable","false");n.attr("draggable","true"),n.attr("native",""),n.on("dragstart",function(e){if(o&&o(t))try{e.originalEvent.dataTransfer.setData("application/json",JSON.stringify(o(t)))}catch(n){e.originalEvent.dataTransfer.setData("Text",JSON.stringify(o(t)))}""!==r.dragstart&&i(t,{$originalEvent:e.originalEvent})}),n.on("$destroy",function(){n.off()})}}}]),module.directive("dragend",["$parse",function(e){return{restrict:"A",link:function(t,n,r){var i=e(r.dragend);n.on("dragend",function(e){""!==r.dragend&&i(t,{$originalEvent:e.originalEvent})}),n.on("$destroy",function(){n.off()})}}}]),module.directive("dragdrop",["$parse",function(e){return{restrict:"A",link:function(t,n,r){var i=e(r.dragdrop),o=e(r.dropcondition);n.on("dragover",function(e){(void 0===r.dropcondition||o(t,{$originalEvent:e.originalEvent}))&&(e.preventDefault(),e.stopPropagation(),t.$eval(r.onDragover),n.addClass("droptarget"))}),n.on("dragleave",function(e){e.preventDefault(),e.stopPropagation(),n.removeClass("droptarget")}),n.on("drop",function(e){e.originalEvent.preventDefault(),n.removeClass("droptarget");var r;try{r=JSON.parse(e.originalEvent.dataTransfer.getData("application/json"))}catch(t){r=JSON.parse(e.originalEvent.dataTransfer.getData("Text"))}i(t,{$originalEvent:e.originalEvent,$item:r})}),t.$on("$destroy",function(){n.off()})}}}]),module.directive("dropFiles",["$parse",function(e){return{link:function(t,n,r){var i=e(r.dropFiles);n.on("dragover",function(e){e.preventDefault(),t.$eval(r.onDrag),n.addClass("droptarget")}),n.on("dragleave",function(e){e.preventDefault(),t.$eval(r.onLeave),n.removeClass("droptarget")}),n.on("drop",function(e){e.preventDefault(),i.assign(t,e.originalEvent.dataTransfer.files),t.$eval(r.onDrop),t.$apply(),n.removeClass("droptarget")})}}}]),module.directive("attachments",["$parse",function(e){return{scope:!0,restrict:"E",templateUrl:"/assets/js/entcore/template/attachments.html",controller:["$scope",function(e){e.linker={resource:{}},e.attachments={me:modelDefinitions_1.model.me,display:{search:{text:"",application:{}},pickFile:!1},addAttachment:function(t){t.provider=e.attachments.display.search.application,e.ngModel(e)instanceof Array?e.ngModel(e).push(t):e.ngModel.assign(e,[t]),e.attachments.display.pickFile=!1},removeAttachment:function(t){e.ngModel.assign(e,underscore_1._.reject(e.ngModel(e),function(e){return e===t}))},attachmentsList:function(){return e.list=e.ngModel(e),e.list}}}],link:function(t,n,r){t.ngModel=e(r.ngModel),t.attachments.onChange=function(){t.$eval(r.onChange)},t.apps=t.$eval(r.apps),t.$watch(function(){return t.attachments.display.pickFile},function(e){e?t.attachments.loadApplicationResources(function(){t.attachments.searchApplication(),t.attachments.display.search.text=" ",t.$apply("attachments")}):t.attachments.display.search.text=""},!0),http_1.http().get("/resources-applications").done(function(e){t.attachments.apps=underscore_1._.filter(modelDefinitions_1.model.me.apps,function(n){return underscore_1._.find(e,function(e){return-1!==n.address.indexOf(e)&&n.icon})&&underscore_1._.find(t.apps,function(e){return-1!==n.address.indexOf(e)})}),t.attachments.display.search.application=t.attachments.apps[0],t.attachments.loadApplicationResources(function(){}),t.$apply("attachments")}),t.attachments.loadApplicationResources=function(e){e||(e=function(){t.attachments.display.searchApplication(),t.$apply("attachments")});var n=t.attachments.display.search.application.address.split("/");t.prefix=n[n.length-1],behaviours_1.Behaviours.loadBehaviours(t.prefix,function(n){n.loadResources(e),t.attachments.addResource=n.create})},t.attachments.searchApplication=function(){var e=t.attachments.display.search.application.address.split("/");t.prefix=e[e.length-1],behaviours_1.Behaviours.loadBehaviours(t.prefix,function(e){t.attachments.resources=underscore_1._.filter(e.resources,function(e){return""!==t.attachments.display.search.text&&(-1!==idiom_1.idiom.removeAccents(e.title.toLowerCase()).indexOf(idiom_1.idiom.removeAccents(t.attachments.display.search.text).toLowerCase())||e._id===t.attachments.display.search.text)})})},t.linker.createResource=function(){var e=t.attachments.display.search.application.address.split("/"),n=e[e.length-1];behaviours_1.Behaviours.loadBehaviours(n,function(e){e.create(t.linker.resource,function(e,n){t.ngModel(t)instanceof Array||t.ngModel.assign(t,[]),t.attachments.display.pickFile=!1;var r=underscore_1._.find(e,function(e){return e._id===n._id});r.provider=t.attachments.display.search.application,t.ngModel(t).push(r),t.$apply()})})}}}}]),module.directive("ngTouchstart",function(){return{restrict:"A",scope:!0,link:function(e,t,n){t.on("touchstart",function(){e.$eval(n.ngTouchstart)}),n.ngTouchend&&jquery_1.$("body").on("touchend",function(){e.$eval(n.ngTouchend)})}}}),module.directive("sidePanel",function(){return{restrict:"E",transclude:!0,template:'<div class="opener"></div><div class="toggle"><div class="content" ng-transclude></div></div>',link:function(e,t,n){t.addClass("hidden"),t.children(".opener").on("click",function(e){t.hasClass("hidden")&&(t.removeClass("hidden"),setTimeout(function(){jquery_1.$("body").on("click.switch-side-panel",function(e){t.children(".toggle").find(e.originalEvent.target).length||(t.addClass("hidden"),jquery_1.$("body").off("click.switch-side-panel"))})},0))})}}}),module.directive("plus",function(){return{restrict:"E",transclude:!0,template:'<div class="opener"><div class="plus"></div><div class="minus"></div></div><section class="toggle-buttons"><div class="toggle" ng-transclude></div></div>',link:function(e,t,n){t.children(".toggle-buttons").addClass("hide"),t.children(".opener").addClass("plus"),t.children(".opener").on("click",function(e){t.children(".toggle-buttons").hasClass("hide")&&(t.children(".toggle-buttons").removeClass("hide"),t.children(".opener").removeClass("plus").addClass("minus"),setTimeout(function(){jquery_1.$("body").on("click.switch-plus-buttons",function(e){t.children(".toggle-buttons").addClass("hide"),t.children(".opener").removeClass("minus").addClass("plus"),jquery_1.$("body").off("click.switch-plus-buttons")})},0))})}}}),module.directive("help",function(){var e;return{restrict:"E",scope:{},template:'<i class="navbar-help ic-help"></i><lightbox show="display.read" on-close="display.read = false"><div></div></lightbox>',link:function(t,n){return __awaiter(this,void 0,void 0,function(){var r,i,o,s,a;return __generator(this,function(u){switch(u.label){case 0:return[4,entcore_1.skin.getHelpPath()];case 1:return r=u.sent(),t.display={},t.helpPath=r+"/application/"+globals_1.appPrefix+"/","."===globals_1.appPrefix&&"/adapter"!==window.location.pathname?t.helpPath=r+"/application/portal/":"/adapter"===window.location.pathname?t.helpPath=r+"/application/"+window.location.search.split("eliot=")[1].split("&")[0]+"/":window.location.pathname.includes("/directory/class-admin")?t.helpPath=r+"/application/parametrage-de-la-classe/":(window.location.pathname.includes("/userbook/mon-compte")||window.location.pathname.includes("/timeline/preferencesView")||window.location.pathname.includes("/timeline/historyView"))&&(t.helpPath=r+"/application/userbook/"),a=function(e){i=jquery_1.$("<div>"+e+"</div>"),i.find("> p").prev().insertAfter(i.find("> p")),i.find("img").each(function(e,n){jquery_1.$(n).attr("src",t.helpPath+"../.."+jquery_1.$(n).attr("src"))}),n.find("div.content > div[ng-transclude]").html(i.html()),n.find("li a").on("click",function(e){n.find(".section").slideUp(),jquery_1.$("div#"+jquery_1.$(e.target).attr("href").split("#")[1]).slideDown()}),n.find("div.paragraph a").on("click",function(e){window.open(jquery_1.$(e.target).closest("a").attr("href"),"_newtab")}),n.find("li a").first().click(),n.find("#TOC").wrap('<div id="burger-menu" class="burger-menu"></div>'),o=n.find("#burger-menu"),o.prepend('<button id="burger-button" class="burger-button"><i class="burger-icon"></i></button>'),s=n.find("#burger-button"),s.click(function(e){o.toggleClass("active")}),n.find("#TOC > ul li a").on("click",function(e){o.removeClass("active")});var r=function(e){0==n.find("#TOC > ul").find(e.target).length&&0==o.find(e.target).length&&o.removeClass("active")};jquery_1.$("body").on("click",r),t.$on("$destroy",function(){jquery_1.$("body").off("click",r)}),t.display.read=!0,t.$apply("display")},n.children("i.navbar-help").on("click",function(){e?a(e):http_1.http().get(t.helpPath).done(function(t){e=t,a(e)}).e404(function(){e="<h2>"+idiom_1.idiom.translate("help.notfound.title")+"</h2><p>"+idiom_1.idiom.translate("help.notfound.text")+"</p>",a(e)})}),[2]}})})}}}),module.directive("stickToTop",function(){return{restrict:"EA",link:function(e,t,n){if(!("noStickMobile"in n&&ui.breakpoints.checkMaxWidth("wideScreen"))){var r=null,i=(jquery_1.$(window).scrollTop(),jquery_1.$(window).scrollTop()),o=function(){t.addClass("scrolling");var e=jquery_1.$(".height-marker").height();null==e&&(e=0);var n=null==i?0:i,r=t.offset().top,s=r+(n+e-r)/20;t.offset({top:s<0?0:s}),requestAnimationFrame(o)},s=!1;jquery_1.$(window).scroll(function(){r||(r=t.offset().top),i=jquery_1.$(window).scrollTop();var e=jquery_1.$(".height-marker").height();null==e&&(e=0),i<=r-e&&(i=r-e),s||o(),s=!0})}}}}),module.directive("floatingNavigation",function(){return{restrict:"E",replace:!0,transclude:!0,scope:{},template:'<nav class="vertical hash-magnet floating" stick-to-top><div class="previous arrow" ng-class="{ visible: step > 0 }"></div><div class="content" ng-transclude></div><div class="next arrow" ng-class="{ visible: step < stepsLength && stepsLength > 0 }"></div></nav>',link:function(e,t,n){var r;e.step=0,setTimeout(function(){r=t.offset(),t.height(jquery_1.$(window).height()-parseInt(t.css("margin-bottom"))-100),e.stepsLength=parseInt(t.find(".content")[0].scrollHeight/t.height())},800),t.find(".arrow.next").on("click",function(){e.step++,e.$apply(),t.find(".content").animate({scrollTop:t.height()*e.step},450)}),t.find(".arrow.previous").on("click",function(){e.step--,e.$apply(),t.find(".content").animate({scrollTop:t.height()*e.step},450)})}}}),module.directive("multiCombo",function(){return{restrict:"E",replace:!1,scope:{title:"@",comboModel:"=",filteredModel:"=",searchOn:"@",orderBy:"@",filterModel:"&",searchPlaceholder:"@",maxSelected:"@",labels:"&",disable:"&",selectionEvent:"&",deselectionEvent:"&"},templateUrl:"/assets/js/entcore/template/multi-combo.html",controller:["$scope","$filter","$timeout",function(e,t,n){e.search={input:"",reset:function(){this.input=""}},e.show=!1,e.toggleVisibility=function(){e.show=!e.show,e.show&&(e.addClickEvent(),e.search.reset(),n(function(){e.setComboPosition()},1))},e.filteredModel&&e.filteredModel instanceof Array||(e.filteredModel=[]),e.isSelected=function(t){return e.filteredModel.indexOf(t)>=0},e.toggleItem=function(t){var n=e.filteredModel.indexOf(t);n>=0?(e.filteredModel.splice(n,1),e.deselectionEvent()instanceof Function&&e.deselectionEvent()()):(!e.maxSelected||e.filteredModel.length<e.maxSelected)&&(e.filteredModel.push(t),e.selectionEvent()instanceof Function&&e.selectionEvent()())},e.selectAll=function(){e.filteredModel.length=0;for(var t=0;t<e.filteredComboModel.length;t++)e.filteredModel.push(e.filteredComboModel[t]);e.selectionEvent()instanceof Function&&e.selectionEvent()()},e.deselectAll=function(){e.filteredModel.length=0,e.deselectionEvent()instanceof Function&&e.deselectionEvent()()},e.fairInclusion=function(e,t){return idiom_1.idiom.removeAccents(e.toLowerCase()).indexOf(idiom_1.idiom.removeAccents(t.toLowerCase()))>=0},e.filteringFun=function(t){var n=!e.filterModel()||e.filterModel()(t);return e.searchOn&&t instanceof Object?n&&e.fairInclusion(t[e.searchOn],e.search.input):n&&e.fairInclusion(t,e.search.input)},e.display=function(e){return e instanceof Object?e.toString():e},e.$watchCollection("comboModel",function(){if(!e.comboModel)return void(e.filteredModel=[]);for(var t=0;t<e.filteredModel.length;t++){var n=e.comboModel.indexOf(e.filteredModel[t]);n<0&&(e.filteredModel.splice(n,1),t--)}})}],link:function(e,t,n){if(!n.comboModel||!n.filteredModel)throw"[<multi-combo> directive] Error: combo-model & filtered-model attributes are required.";if(e.maxSelected=parseInt(e.maxSelected),!isNaN(e.maxSelected)&&e.maxSelected<1)throw"[<multi-combo> directive] Error: max-selected must be an integer greater than 0.";e.addClickEvent=function(){if(e.show){var n=(new Date).getTime();jquery_1.$("body").on("click.multi-combo"+n,function(r){t.find(r.originalEvent.target).length||(e.show=!1,jquery_1.$("body").off("click.multi-combo"+n),e.$apply())})}},e.setComboPosition=function(){t.css("position","relative"),t.find(".multi-combo-root-panel").css("top",t.find(".multi-combo-root-button").outerHeight())},e.setComboPosition()}}}),module.directive("slide",function(){return{restrict:"A",scope:!1,link:function(e,t,n){e.$watch(function(){return e.$eval(n.slide)},function(e){e?t.slideDown():t.slideUp()}),e.$eval(n.slide)||t.hide()}}}),module.directive("sideNav",function(){return{restrict:"AE",link:function(e,t,n){function r(){ui.breakpoints.checkMaxWidth(o)?(t.height(jquery_1.$(window).height()),jquery_1.$(".mobile-nav-opener").hasClass("visible")&&i.find(".application-title").addClass("move-right"),ui.extendElement.touchEvents(i,{exclude:["longclick"],allowDefault:!0}),ui.extendElement.touchEvents(t,{exclude:["longclick"]}),i.on("swipe-right",function(){t.addClass("slide")}),t.on("swipe-left",function(){t.removeClass("slide"),jquery_1.$("body").removeClass("point-out")})):t.height("auto")}var i=jquery_1.$("body");jquery_1.$(".mobile-nav-opener").addClass("visible");var o=ui.breakpoints.tablette;n.targetElement;t.addClass("side-nav"),jquery_1.$("body").addClass("transition"),jquery_1.$(".mobile-nav-opener").on("click",function(){t.hasClass("slide")?(t.removeClass("slide"),jquery_1.$("body").removeClass("point-out")):(t.addClass("slide"),jquery_1.$("body").addClass("point-out"))}),jquery_1.$("body").on("click",function(e){t[0]===e.target||t.find(e.target).length||jquery_1.$(".mobile-nav-opener")[0]===e.target||(t.removeClass("slide"),jquery_1.$("body").removeClass("point-out"))}),n.maxWidth&&(o=parseInt(n.maxWidth)),r(),jquery_1.$(window).on("resize",r),e.$on("$destroy",function(){jquery_1.$(".mobile-nav-opener").removeClass("visible"),i.find(".application-title").removeClass("move-right")})}}}),module.directive("appTitle",["$compile",function(e){return{restrict:"E",link:function(t,n,r){function i(){var n=jquery_1.$("app-title").html(),r=jquery_1.$("header.main .application-title");ui.breakpoints.checkMaxWidth("tablette")?r.length||jquery_1.$("header.main").append(e(n)(t)):r.remove()}n.find("h1").addClass("application-title"),i(),jquery_1.$(window).on("resize",i),t.$on("$destroy",function(){jquery_1.$("body").find("header.main .application-title").remove()})}}}]),module.directive("microbox",["$compile",function(e){return{restrict:"E",compile:function(t,n,r){var i=t.html();return function(t,n,r){function o(r){ui.breakpoints.checkMaxWidth("tablette")?jquery_1.$(".microbox-wrapper").length||(jquery_1.$("body").append('<div class="microbox-wrapper zero"><div class="microbox-content"><i class="close-2x"></i><div class="microbox-material"></div><button class="microbox-close">'+a+"</button></div></div>"),jquery_1.$(".microbox-material").html(e(i)(t)),n.after('<button class="microbox">'+s+"</button>"),jquery_1.$("button.microbox").on("click",function(){jquery_1.$(".microbox-wrapper").hasClass("zero")&&jquery_1.$(".microbox-wrapper").removeClass("zero")}),jquery_1.$("button.microbox-close, .microbox-content i.close-2x").on("click",function(){jquery_1.$(".microbox-wrapper").hasClass("zero")||jquery_1.$(".microbox-wrapper").addClass("zero")}),r&&t.$apply()):(jquery_1.$(".microbox-wrapper").remove(),jquery_1.$("button.microbox").remove())}var s=idiom_1.idiom.translate(r.microtitle),a=idiom_1.idiom.translate(r.close);n.addClass("zero-mobile"),o(),jquery_1.$(window).on("resize",function(){o(!0)}),t.$on("$destroy",function(){jquery_1.$("body").find("button.microbox").remove(),jquery_1.$("body").find(".microbox-content").remove()})}}}}]),module.directive("subtitle",function(){return{restrict:"A",scope:!1,link:function(e,t,n){jquery_1.$("section.main").addClass("subtitle-push"),e.$on("$destroy",function(){jquery_1.$("section.main").removeClass("subtitle-push")})}}}),module.directive("whereami",function(){return{restrict:"A",scope:!1,link:function(e,t,n){t.addClass("whereami");var r=jquery_1.$("nav.side-nav a.selected").html();jquery_1.$("body").on("whereami.update",function(){t.html(jquery_1.$("nav.side-nav a.selected").html())}),t.html(r)}}});var checkToolDelay=function(){var e=!0;return function(t){e&&(e=!1,setTimeout(function(){t.$apply(),e=!0},200))}}();module.directive("checkTool",function(){return{restrict:"E",scope:{ngModel:"=",ngClick:"&",ngChange:"&"},template:'<div class="check-tool"><i class="check-status"></i></div>',link:function(e,t,n){t.on("click",function(){e.ngModel=!e.ngModel,checkToolDelay(e),e.ngModel?t.addClass("selected"):t.removeClass("selected"),e.ngClick&&e.ngClick(),e.ngChange&&e.ngChange(),checkToolDelay(e)}),jquery_1.$("body").on("click",function(n){0!==jquery_1.$(n.target).parents(".check-tool, .toggle, .lightbox").length||jquery_1.$(n.target).is(".lightbox")||"CHECK-TOOL"===n.target.nodeName||0===jquery_1.$("body").find(n.target).length||(e.ngModel=!1,t.removeClass("selected"),checkToolDelay(e),e.ngChange&&(e.ngChange(),checkToolDelay(e)))})}}}),module.directive("subtitle",function(){return{restrict:"A",scope:!1,link:function(e,t,n){jquery_1.$("section.main").addClass("subtitle-push"),e.$on("$destroy",function(){jquery_1.$("section.main").removeClass("subtitle-push")})}}}),module.directive("whereami",function(){return{restrict:"A",scope:!1,link:function(e,t,n){var r=jquery_1.$("nav.side-nav a.selected").text();jquery_1.$("body").on("whereami.update",function(){t.text(jquery_1.$("nav.side-nav a.selected").text())}),t.text(r)}}}),module.controller("Account",["$scope",function(e){e.nbNewMessages=0,e.messagerieLink="/zimbra/zimbra",e.me=modelDefinitions_1.model.me,e.rand=Math.random(),e.skin=entcore_1.skin,e.lang=idiom_1.idiom,e.currentLanguage=globals_1.currentLanguage,e.refreshAvatar=function(){http_1.http().get("/userbook/api/person",{},{requestName:"refreshAvatar"}).done(function(t){e.avatar=t.result[0].photo,e.avatar&&"no-avatar.jpg"!==e.avatar&&"no-avatar.svg"!==e.avatar||(e.avatar=entcore_1.skin.basePath+"/img/illustrations/no-avatar.svg"),e.username=modelDefinitions_1.model.me.firstName,modelDefinitions_1.model.me.profiles=t.result[0].type,e.$apply()})},e.goToMessagerie=function(){console.log(e.messagerieLink),http_1.http().get("/userbook/preference/zimbra").done(function(t){try{t.preference&&(JSON.parse(t.preference).modeExpert&&modelDefinitions_1.model.me.hasWorkflow("fr.openent.zimbra.controllers.ZimbraController|preauth"))?(e.messagerieLink="/zimbra/preauth",window.open(e.messagerieLink)):(e.messagerieLink="/zimbra/zimbra",window.location.href=window.location.origin+e.messagerieLink),console.log(e.messagerieLink)}catch(t){e.messagerieLink="/zimbra/zimbra"}})},e.refreshMails=function(){modelDefinitions_1.model.me.hasWorkflow("fr.openent.zimbra.controllers.ZimbraController|view")?http_1.http().get("/zimbra/count/INBOX",{unread:!0}).done(function(t){e.nbNewMessages=t.count,e.$apply("nbNewMessages")}):http_1.http().get("/conversation/count/INBOX",{unread:!0}).done(function(t){e.nbNewMessages=t.count,e.$apply("nbNewMessages")})},e.openApps=function(e){jquery_1.$(window).width()<=700&&e.preventDefault()},http_1.http().get("/directory/userbook/"+modelDefinitions_1.model.me.userId).done(function(t){modelDefinitions_1.model.me.userbook=t,e.$apply("me")}),entcore_1.skin.listThemes(function(t){e.themes=t,e.$apply("themes")}),e.$root.$on("refreshMails",e.refreshMails),e.refreshMails(),e.refreshAvatar(),e.currentURL=window.location.href}]),module.controller("Admin",["$scope",function(e){e.urls=[],http_1.http().get("/admin-urls").done(function(t){e.urls=t,e.$apply("urls")}),e.getHighlight=function(e){return window.location.href.indexOf(e.url)>=0},e.orderUrls=function(t){return e.getHighlight(t)?0:1},e.filterUrls=function(e){return!(e.allowed&&e.allowed instanceof Array)||underscore_1._.find(modelDefinitions_1.model.me.functions,function(t){return underscore_1._.contains(e.allowed,t.code)})},e.scrollUp=ui.scrollToTop}]),module.config(["$locationProvider",function(e){e.hashPrefix("")}]),jquery_1.$(document).ready(function(){setTimeout(function(){globals_1.routes.routing&&module.config(globals_1.routes.routing),lib_1.bootstrap(function(){function start(){idiom_1.idiom.addBundle("/i18n",function(){idiom_1.idiom.addBundle("/"+globals_1.appPrefix+"/i18n",function(){"fr"===globals_1.currentLanguage?(moment_1.moment.locale(globals_1.currentLanguage),moment_1.moment.updateLocale(globals_1.currentLanguage,moment_1.frLocales)):moment_1.moment.locale(globals_1.currentLanguage),angular_1.angular.bootstrap(jquery_1.$("html"),["app"]),modelDefinitions_1.model.trigger("bootstrap"),modelDefinitions_1.model.bootstrapped=!0,modelDefinitions_1.model.sync()})})}entcore_1.RTE.addDirectives(module),window.entcore.ng.init&&window.entcore.ng.init(module),modelDefinitions_1.model.build(),idiom_1.idiom.addDirectives(module),http_1.http().get(entcore_1.skin.basePath+"js/directives.js").done(function(d){eval(d),"function"==typeof entcore_1.skin.addDirectives?entcore_1.skin.addDirectives(module,start):start()}).error(function(){start()})})},10)}),module.controller("SearchPortal",["$scope",function(e){e.launchSearch=function(t){var n=e.mysearch;"link"!=t&&t.stopPropagation(),"link"!=t&&13!=t.keyCode||(n=n&&""!==n?n:" ",e.mysearch="",window.location.href="/searchengine#/"+n)}}]),exports.injectIntoSelector=injectIntoSelector,module.directive("cguLightbox",[function(){return{restrict:"E",scope:!0,templateUrl:template_1.template.viewPath+"entcore/cgu-lightbox.html",link:function(e,t,n){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(n){switch(n.label){case 0:return e.show=!1,!me_1.Me.session.needRevalidateTerms||me_1.Me.session.deletePending?[3,2]:[4,Promise.all([idiom_1.idiom.addBundlePromise("/i18n"),idiom_1.idiom.addBundlePromise("/auth/i18n")])];case 1:return n.sent(),e.model={accept:!1},t="/auth/logout?callback="+entcore_1.skin.logoutCallback,e.title=idiom_1.idiom.translate("cgu.revalidate.title"),e.content=idiom_1.idiom.translate("cgu.revalidate.content"),e.userChartUrl=idiom_1.idiom.translate("auth.charter"),e.cguUrl=idiom_1.idiom.translate("cgu.file"),e.actionText=idiom_1.idiom.translate("cgu.revalidate.action"),e.show=!0,e.isDisabled=function(){return!e.model.accept},e.logout=function(){window.location.href=t},e.validate=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,me_1.Me.revalidateTerms()];case 1:return t.sent(),e.show=!1,e.$apply(),[2]}})})},e.$apply(),[3,3];case 2:e.show=!1,n.label=3;case 3:return[2]}})})}}}]),module.directive("onEnter",function(){return function(e,t,n){t.bind("keydown keypress",function(t){13===t.which&&(e.$apply(function(){e.$eval(n.onEnter)}),t.preventDefault())})}}),module.service("CounterService",[function(){var e=function(){this.count=1};return e.prototype.increase=function(){return++this.count},e}()])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.$=n(2),window.jQuery=t.$,window.entcore||(window.entcore={}),window.entcore.jQuery=t.$,window.entcore.$=t.$,window.$=t.$},function(e,t,n){var r,i;/*!
4
4
  * jQuery JavaScript Library v3.7.1
5
5
  * https://jquery.com/
@@ -445,7 +445,7 @@ var xn=["جنوری","فروری","مارچ","اپریل","مئی","جون","ج
445
445
  //! moment.js locale configuration
446
446
  //! moment.js locale configuration
447
447
  //! moment.js locale configuration
448
- return e.defineLocale("ur",{months:xn,monthsShort:xn,weekdays:Yn,weekdaysShort:Yn,weekdaysMin:Yn,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd، D MMMM YYYY HH:mm"},meridiemParse:/صبح|شام/,isPM:function(e){return"شام"===e},meridiem:function(e,t,n){return e<12?"صبح":"شام"},calendar:{sameDay:"[آج بوقت] LT",nextDay:"[کل بوقت] LT",nextWeek:"dddd [بوقت] LT",lastDay:"[گذشتہ روز بوقت] LT",lastWeek:"[گذشتہ] dddd [بوقت] LT",sameElse:"L"},relativeTime:{future:"%s بعد",past:"%s قبل",s:"چند سیکنڈ",ss:"%d سیکنڈ",m:"ایک منٹ",mm:"%d منٹ",h:"ایک گھنٹہ",hh:"%d گھنٹے",d:"ایک دن",dd:"%d دن",M:"ایک ماہ",MM:"%d ماہ",y:"ایک سال",yy:"%d سال"},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:1,doy:4}}),e.defineLocale("uz-latn",{months:"Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr".split("_"),monthsShort:"Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek".split("_"),weekdays:"Yakshanba_Dushanba_Seshanba_Chorshanba_Payshanba_Juma_Shanba".split("_"),weekdaysShort:"Yak_Dush_Sesh_Chor_Pay_Jum_Shan".split("_"),weekdaysMin:"Ya_Du_Se_Cho_Pa_Ju_Sha".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"D MMMM YYYY, dddd HH:mm"},calendar:{sameDay:"[Bugun soat] LT [da]",nextDay:"[Ertaga] LT [da]",nextWeek:"dddd [kuni soat] LT [da]",lastDay:"[Kecha soat] LT [da]",lastWeek:"[O'tgan] dddd [kuni soat] LT [da]",sameElse:"L"},relativeTime:{future:"Yaqin %s ichida",past:"Bir necha %s oldin",s:"soniya",ss:"%d soniya",m:"bir daqiqa",mm:"%d daqiqa",h:"bir soat",hh:"%d soat",d:"bir kun",dd:"%d kun",M:"bir oy",MM:"%d oy",y:"bir yil",yy:"%d yil"},week:{dow:1,doy:7}}),e.defineLocale("uz",{months:"январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр".split("_"),monthsShort:"янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),weekdays:"Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба".split("_"),weekdaysShort:"Якш_Душ_Сеш_Чор_Пай_Жум_Шан".split("_"),weekdaysMin:"Як_Ду_Се_Чо_Па_Жу_Ша".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"D MMMM YYYY, dddd HH:mm"},calendar:{sameDay:"[Бугун соат] LT [да]",nextDay:"[Эртага] LT [да]",nextWeek:"dddd [куни соат] LT [да]",lastDay:"[Кеча соат] LT [да]",lastWeek:"[Утган] dddd [куни соат] LT [да]",sameElse:"L"},relativeTime:{future:"Якин %s ичида",past:"Бир неча %s олдин",s:"фурсат",ss:"%d фурсат",m:"бир дакика",mm:"%d дакика",h:"бир соат",hh:"%d соат",d:"бир кун",dd:"%d кун",M:"бир ой",MM:"%d ой",y:"бир йил",yy:"%d йил"},week:{dow:1,doy:7}}),e.defineLocale("vi",{months:"tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12".split("_"),monthsShort:"Thg 01_Thg 02_Thg 03_Thg 04_Thg 05_Thg 06_Thg 07_Thg 08_Thg 09_Thg 10_Thg 11_Thg 12".split("_"),monthsParseExact:!0,weekdays:"chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy".split("_"),weekdaysShort:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysMin:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysParseExact:!0,meridiemParse:/sa|ch/i,isPM:function(e){return/^ch$/i.test(e)},meridiem:function(e,t,n){return e<12?n?"sa":"SA":n?"ch":"CH"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [năm] YYYY",LLL:"D MMMM [năm] YYYY HH:mm",LLLL:"dddd, D MMMM [năm] YYYY HH:mm",l:"DD/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[Hôm nay lúc] LT",nextDay:"[Ngày mai lúc] LT",nextWeek:"dddd [tuần tới lúc] LT",lastDay:"[Hôm qua lúc] LT",lastWeek:"dddd [tuần trước lúc] LT",sameElse:"L"},relativeTime:{future:"%s tới",past:"%s trước",s:"vài giây",ss:"%d giây",m:"một phút",mm:"%d phút",h:"một giờ",hh:"%d giờ",d:"một ngày",dd:"%d ngày",w:"một tuần",ww:"%d tuần",M:"một tháng",MM:"%d tháng",y:"một năm",yy:"%d năm"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(e){return e},week:{dow:1,doy:4}}),e.defineLocale("x-pseudo",{months:"J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér".split("_"),monthsShort:"J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc".split("_"),monthsParseExact:!0,weekdays:"S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý".split("_"),weekdaysShort:"S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát".split("_"),weekdaysMin:"S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[T~ódá~ý át] LT",nextDay:"[T~ómó~rró~w át] LT",nextWeek:"dddd [át] LT",lastDay:"[Ý~ést~érdá~ý át] LT",lastWeek:"[L~ást] dddd [át] LT",sameElse:"L"},relativeTime:{future:"í~ñ %s",past:"%s á~gó",s:"á ~féw ~sécó~ñds",ss:"%d s~écóñ~ds",m:"á ~míñ~úté",mm:"%d m~íñú~tés",h:"á~ñ hó~úr",hh:"%d h~óúrs",d:"á ~dáý",dd:"%d d~áýs",M:"á ~móñ~th",MM:"%d m~óñt~hs",y:"á ~ýéár",yy:"%d ý~éárs"},dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}}),e.defineLocale("yo",{months:"Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀".split("_"),monthsShort:"Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀".split("_"),weekdays:"Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta".split("_"),weekdaysShort:"Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá".split("_"),weekdaysMin:"Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Ònì ni] LT",nextDay:"[Ọ̀la ni] LT",nextWeek:"dddd [Ọsẹ̀ tón'bọ] [ni] LT",lastDay:"[Àna ni] LT",lastWeek:"dddd [Ọsẹ̀ tólọ́] [ni] LT",sameElse:"L"},relativeTime:{future:"ní %s",past:"%s kọjá",s:"ìsẹjú aayá die",ss:"aayá %d",m:"ìsẹjú kan",mm:"ìsẹjú %d",h:"wákati kan",hh:"wákati %d",d:"ọjọ́ kan",dd:"ọjọ́ %d",M:"osù kan",MM:"osù %d",y:"ọdún kan",yy:"ọdún %d"},dayOfMonthOrdinalParse:/ọjọ́\s\d{1,2}/,ordinal:"ọjọ́ %d",week:{dow:1,doy:4}}),e.defineLocale("zh-cn",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"下午"===t||"晚上"===t?e+12:e>=11?e:e+12},meridiem:function(e,t,n){var r=100*e+t;return r<600?"凌晨":r<900?"早上":r<1130?"上午":r<1230?"中午":r<1800?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:function(e){return e.week()!==this.week()?"[下]dddLT":"[本]dddLT"},lastDay:"[昨天]LT",lastWeek:function(e){return this.week()!==e.week()?"[上]dddLT":"[本]dddLT"},sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|周)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"周";default:return e}},relativeTime:{future:"%s后",past:"%s前",s:"几秒",ss:"%d 秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",w:"1 周",ww:"%d 周",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},week:{dow:1,doy:4}}),e.defineLocale("zh-hk",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,n){var r=100*e+t;return r<600?"凌晨":r<900?"早上":r<1200?"上午":1200===r?"中午":r<1800?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:"[下]ddddLT",lastDay:"[昨天]LT",lastWeek:"[上]ddddLT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}}),e.defineLocale("zh-mo",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"D/M/YYYY",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,n){var r=100*e+t;return r<600?"凌晨":r<900?"早上":r<1130?"上午":r<1230?"中午":r<1800?"下午":"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}}),e.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,n){var r=100*e+t;return r<600?"凌晨":r<900?"早上":r<1130?"上午":r<1230?"中午":r<1800?"下午":"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}}),e.locale("en"),e})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ulist={name:"ulist",run:function(e){return{template:'<i tooltip="editor.option.ulist"></i>',link:function(t,n,r){n.on("mousedown",function(){e.editZone.is(":focus")||e.editZone.focus(),0===e.editZone.children("div").length&&(e.editZone.append("<div><br></div>"),e.editZone.focus()),e.execCommand("insertUnorderedList",!1,null),document.queryCommandState("insertUnorderedList")?n.addClass("toggled"):n.removeClass("toggled")}),e.on("selectionchange",function(e){document.queryCommandState("insertUnorderedList")?n.addClass("toggled"):n.removeClass("toggled")})}}}},t.olist={name:"olist",run:function(e){return{template:'<i tooltip="editor.option.olist"></i>',link:function(t,n,r){n.on("mousedown",function(){e.editZone.is(":focus")||e.editZone.focus(),0===e.editZone.children("div").length&&(e.editZone.append("<div><br></div>"),e.editZone.focus()),e.execCommand("insertOrderedList",!1,null),document.queryCommandState("insertOrderedList")?n.addClass("toggled"):n.removeClass("toggled")}),e.on("selectionchange",function(e){document.queryCommandState("insertOrderedList")?n.addClass("toggled"):n.removeClass("toggled")})}}}}},function(module,exports,__webpack_require__){"use strict";function rgb(e,t,n){return"#"+((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)}function setSpectrum(e){0!==jquery_1.$(".sp-replacer").length&&(e.children("i").css({"pointer-events":"none"}),jquery_1.$("input[type=color]").css({position:"absolute",opacity:0,"pointer-events":"none",height:"35px"}),jquery_1.$(".sp-replacer").on("mouseover",function(e){jquery_1.$(e.target).parent().find("input[type=color]").trigger("mouseover",[e])}),jquery_1.$(".sp-replacer").on("mouseout",function(e){jquery_1.$(e.target).parent().find("input[type=color]").trigger("mouseout",[e])}))}Object.defineProperty(exports,"__esModule",{value:!0});var jquery_1=__webpack_require__(1),http_1=__webpack_require__(34),rgba=rgb,transparent="rgba(255, 255, 255, 0)";exports.color={name:"color",run:function(instance){return{template:'<i tooltip="editor.option.color"></i><input tooltip="editor.option.color" type="color" tabindex="-1"/>',link:function(scope,element,attributes){function applyColor(){instance.selection.css({color:scope.foreColor})}if(element.on("click","i",function(){element.find("input").click()}),-1!==navigator.userAgent.indexOf("Edge")&&element.find("input").attr("type","text"),!jquery_1.$.spectrum){jquery_1.$.spectrum={},http_1.http().get("/infra/public/spectrum/spectrum.js").done(function(data){eval(data),setSpectrum(element),jquery_1.$.spectrum&&jquery_1.$.spectrum.palettes&&"text"===element.find("input")[0].type&&(jquery_1.$("body").find(".option.color input, .option.background-color input").spectrum({preferredFormat:"hex"}),setSpectrum(element))});var stylesheet=jquery_1.$('<link rel="stylesheet" type="text/css" href="/infra/public/spectrum/spectrum.css" />').attr("crossorigin","anonymous");jquery_1.$("head").prepend(stylesheet)}jquery_1.$.spectrum&&jquery_1.$.spectrum.palettes&&"text"===element.find("input")[0].type&&(element.find("input").spectrum({preferredFormat:"hex"}),setSpectrum(element)),scope.foreColor="#000000",element.children("input").on("input",function(){scope.foreColor=jquery_1.$(this).val(),scope.$apply("foreColor"),applyColor()}),element.get(0).addEventListener("click",function(){scope.foreColor=element.children("input").val(),scope.$apply("foreColor"),applyColor()},!0)}}}},exports.backgroundColor={name:"backgroundColor",run:function(instance){return{template:'<i></i><input tooltip="editor.option.backgroundcolor" type="color" tabindex="-1" />',link:function(scope,element,attributes){function applyBackgroundColor(){var e={};if("string"==typeof scope.backColor){if("#"===scope.backColor[0])e={r:parseInt(scope.backColor.substring(1,3),16),g:parseInt(scope.backColor.substring(3,5),16),b:parseInt(scope.backColor.substring(5,7),16)};else if(scope.backColor.startsWith("rgb")){var t=scope.backColor.split("(")[1].split(",");e={r:parseInt(t[0]),g:parseInt(t[1]),b:parseInt(t[2]),a:parseInt(t[3])}}e.r>130&&e.g>130&&e.b>130&&0!==e.a?element.find("i").css({color:"#000"}):element.find("i").css({color:"#fff"})}instance.selection.css({"background-color":scope.backColor})}if(element.on("click","i",function(){element.find("input").click()}),-1!==navigator.userAgent.indexOf("Edge")&&element.find("input").attr("type","text"),jquery_1.$.spectrum)jquery_1.$.spectrum&&jquery_1.$.spectrum.palettes&&"text"===element.find("input")[0].type&&(element.find("input[type=color]").spectrum({preferredFormat:"hex"}),setSpectrum(element));else{jquery_1.$.spectrum={},http_1.http().get("/infra/public/spectrum/spectrum.js").done(function(data){eval(data),jquery_1.$.spectrum&&jquery_1.$.spectrum.palettes&&"text"===element.find("input")[0].type&&(jquery_1.$("body").find(".option.color input, .option.background-color input").spectrum({preferredFormat:"hex"}),setSpectrum(element))});var stylesheet=jquery_1.$('<link rel="stylesheet" type="text/css" href="/infra/public/spectrum/spectrum.css" />').attr("crossorigin","anonymous");jquery_1.$("head").prepend(stylesheet)}element.children("input").on("input",function(){jquery_1.$(this).val()&&(scope.backColor=jquery_1.$(this).val(),scope.$apply("backColor"),applyBackgroundColor())}),element.get(0).addEventListener("click",function(){scope.backColor=element.children("input").val(),scope.$apply("backColor"),applyBackgroundColor()},!0)}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),i=n(4);t.font={name:"font",run:function(e){return{mobile:!1,template:'<select-list display="font" display-as="fontFamily" placeholder="editor.font.placeholder" tooltip="editor.option.font"><opt ng-repeat="font in fonts" ng-click="setFontFamily(font)" value="font" ng-style="{ \'font-family\': \'[[font.fontFamily]]\' }">[[font.fontFamily]]</opt></select-list>',link:function(t,n,o){function s(){return i._.map(i._.flatten(i._.map(document.styleSheets,function(e){return i._.filter(e.cssRules,function(e){return e instanceof CSSFontFaceRule&&-1===e.style.cssText.toLowerCase().indexOf("fontello")&&-1===e.style.cssText.toLowerCase().indexOf("glyphicon")&&-1===e.style.cssText.toLowerCase().indexOf("fontawesome")&&-1===e.style.cssText.toLowerCase().indexOf("mathjax")})})),function(e){var t=e.style.cssText.split("font-family:")[1].split(";")[0].trim();return t.startsWith('"')&&(t=t.substring(1)),t.endsWith('"')&&(t=t.substring(0,t.length-1)),{fontFamily:t}})}t.fonts=[],t.font="",setTimeout(function(){var e=s();e=i._.uniq(e,function(e,t,n){return e.fontFamily}),e=i._.reject(e,function(e){return"generic-icons"===e.fontFamily.trim()||"editor"===e.fontFamily.trim()}),t.fonts=t.fonts.concat(e),t.font=i._.find(t.fonts,function(e){return-1!==r.$("p").css("font-family").toLowerCase().indexOf(e.fontFamily.toLowerCase())})},1e3),t.setFontFamily=function(n){t.font=n,e.selection.css({"font-family":'"'+n.fontFamily+'"'})},e.on("selectionchange",function(n){t.font=i._.find(t.fonts,function(t){return t.fontFamily.trim()===e.selection.css("font-family")})})}}}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fontSize={name:"fontSize",run:function(e){return{template:'<select-list placeholder="size" display="font.fontSize.size" tooltip="editor.option.fontSize"><opt ng-repeat="fontSize in font.fontSizes" ng-click="setSize(fontSize)" '+"ng-style=\"{ 'font-size': fontSize.size + 'px', 'line-height': fontSize.size + 'px'}\">[[fontSize.size]]</opt></select-list>",link:function(t,n,r){t.font={fontSizes:[{size:8},{size:10},{size:12},{size:14},{size:16},{size:18},{size:20},{size:24},{size:28},{size:34},{size:42},{size:64},{size:72}],fontSize:{}},t.setSize=function(n){t.font.fontSize={size:n.size},e.selection.css({"font-size":n.size+"px","line-height":n.size+"px"})},e.on("selectionchange",function(n){e.selection.css("font-size")?t.font.fontSize={size:parseInt(e.selection.css("font-size"))}:t.font.fontSize={size:void 0}}),n.children(".options").on("click","opt",function(){n.children(".options").addClass("hidden")})}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);t.format={name:"format",run:function(e){return{template:'<select-list model="format" placeholder="editor.format.paragraph" display-as="label" display="format" tooltip="editor.option.format"><opt ng-repeat="format in formats" value="format" ng-click="wrap(format)"><div bind-html="format.option"></div></opt></select-list>',link:function(t,n,i){t.formats=[{apply:{tag:"p"},option:'<p translate content="[[format.label]]"></p>',label:"editor.format.paragraph"},{apply:{tag:"h1"},option:'<h1 translate content="[[format.label]]"></h1>',label:"editor.format.title1"},{apply:{tag:"h2"},option:'<h2 translate content="[[format.label]]"></h2>',label:"editor.format.title2"},{apply:{tag:"h3"},option:'<h3 translate content="[[format.label]]"></h3>',label:"editor.format.title3"},{apply:{tag:"p",classes:["info"]},option:'<p class="info" translate content="[[format.label]]"></p>',label:"editor.format.info"},{apply:{tag:"p",classes:["warning"]},option:'<p class="warning" translate content="[[format.label]]"></p>',label:"editor.format.warning"}],e.on("selectionchange",function(n){if(n){var r=n.selection.$();e.selection.isEmpty()&&(r=e.selection.elementAtCaret());var i=!1;t.formats.forEach(function(e){var n=!0;e.apply.classes&&e.apply.classes.forEach(function(e){n=n&&r.hasClass(e)}),r.is(e.apply.tag)&&n&&(t.format=e,i=!0)}),i||(t.format=t.formats[0])}}),t.wrap=function(n){t.format=n;var i=r.$("<"+t.format.apply.tag+"></"+t.format.apply.tag+">");t.format.apply.classes&&t.format.apply.classes.forEach(function(e){i.addClass(e)}),e.selection.wrap(i)}}}}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.subscript={name:"subscript",run:function(e){return{template:'<i tooltip="editor.option.subscript"></i>',link:function(t,n,r){n.on("click",function(){e.editZone.is(":focus")||e.focus(),"sub"!==e.selection.css("vertical-align")?(n.addClass("toggled"),e.selection.css({"vertical-align":"sub","font-size":"12px"})):(n.removeClass("toggled"),e.selection.css({"vertical-align":"","font-size":""}))}),e.on("selectionchange",function(t){"sub"===e.selection.css("vertical-align")?n.addClass("toggled"):n.removeClass("toggled")})}}}},t.superscript={name:"superscript",run:function(e){return{template:'<i tooltip="editor.option.superscript"></i>',link:function(t,n,r){n.on("click",function(){e.editZone.is(":focus")||e.focus(),"super"!==e.selection.css("vertical-align")?(n.addClass("toggled"),e.selection.css({"vertical-align":"super","font-size":"12px"})):(n.removeClass("toggled"),e.selection.css({"vertical-align":"","font-size":""}))}),e.on("selectionchange",function(t){"super"===e.selection.css("vertical-align")?n.addClass("toggled"):n.removeClass("toggled")})}}}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.removeFormat={name:"removeFormat",run:function(e){return{template:'<i tooltip="editor.option.removeformat"></i>',link:function(t,n,r){n.on("click",function(){e.editZone.is(":focus")||e.focus();var t={"font-style":"normal","background-color":"transparent","font-weight":"normal","text-decoration":"none",color:"inherit","font-size":"initial","line-height":"initial","font-family":"inherit"};e.selection.css(t),e.execCommand("removeFormat"),e.trigger("selectionchange",{selection:e.selection})}),e.on("selectionchange",function(e){document.queryCommandEnabled("removeFormat")?n.removeClass("disabled"):n.addClass("disabled")})}}}}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},o=this;Object.defineProperty(t,"__esModule",{value:!0});var s=n(6),a=n(1),u=n(3),c=n(550),l=function(e){s.ui.extendElement.resizable(e.editZone.find(".image-container").not(".image-template .image-container"),{moveWithResize:!1,preserveRatio:!0,mouseUp:function(){e.trigger("contentupdated"),e.addState(e.editZone.html())},extendParent:{bottom:!0}})},d=function(e,t){var n={top:e.offset().top+e.height()+20,left:e.offset().left+5};return n.left+t.width()>a.$(window).width()&&(n.left=a.$(window).width()-t.width()),n.top+t.height()>a.$(window).height()+window.scrollY&&(n.top=a.$(window).height()+window.scrollY-t.height()),n.top<e.offset().top&&(n.top=e.offset().top),n},h=function(e,t,n){var s,l=e.find("img");if(e.addClass("has-menu"),s=a.$('\n <div class="image-contextual-menu">\n <button class="edit-image">'+u.idiom.translate("edit.image")+'</button>\n\n <i class="resize-image small"></i>\n <i class="resize-image medium"></i>\n <i class="resize-image large selected"></i>\n </div>\n ').appendTo("body"),-1!==l.attr("src").indexOf("thumbnail")){var h=parseInt(l.attr("src").split("thumbnail=")[1].split("x")[0]);(l[0].naturalWidth<290||l[0].naturalHeight<290)&&h>290&&s.find(".resize-image.medium").remove(),((l[0].naturalWidth<120||l[0].naturalHeight<120)&&h>290||l.parents(".image-template").length>0)&&s.find(".resize-image").remove(),120===h&&(s.find(".selected").removeClass("selected"),s.find(".small").addClass("selected")),290===h&&(s.find(".selected").removeClass("selected"),s.find(".medium").addClass("selected"))}var f=function(t){s.find(".selected").removeClass("selected"),s.find("."+t).addClass("selected");var n={top:e.offset().top+e.height()+20,left:e.offset().left+5};n.left+s.width()>a.$(window).width()&&(n.left=a.$(window).width()-s.width()),l.on("load",function(){s.offset(n)})};a.$(window).on("scroll.imagemenu",function(){s.offset(d(e,s))}),e.on("resizing.imageMenu",function(t){s.offset(d(e,s))}),s.offset(d(e,s)).on("click",".edit-image",function(){return r(o,void 0,void 0,function(){var r,o,s;return i(this,function(i){switch(i.label){case 0:return r=l.attr("src").split("/"),"workspace"!==r[1]?(t.imageOption.display.pickFile=!0,t.$apply(),[2]):(o=r[r.length-1].split("?")[0],[4,c.workspaceService.fetchDocuments({filter:"all",id:o})]);case 1:return s=i.sent(),0==s.length&&console.warn("[imageEditor] could not found document for id: ",o),t.imageOption.display.file=s[0],[4,t.imageOption.display.file.loadProperties()];case 2:return i.sent(),"jpg"===t.imageOption.display.file.metadata.extension?t.imageOption.display.file.metadata["content-type"]="image/jpeg":t.imageOption.display.file.metadata["content-type"]="image/"+t.imageOption.display.file.metadata.extension,t.imageOption.display.editFile=!0,t.$apply(),t.updateImage=function(){var r=l.attr("src");t.imageOption.display.editFile=!1;var i=10*Math.random();-1!==r.indexOf("?")?-1!==r.indexOf("v=")?r=r.replace(/(v=).*?(&|$)/,"$1"+i+"$2"):r+="&v="+i:r+="?v="+i,l.on("load",function(){e.width(l.width()),e.height(l.height())}),l.attr("src",r),t.imageOption.display.file.alt?l.attr("alt",t.imageOption.display.file.alt):l.removeAttr("alt"),n.trigger("contentupdated"),t.$apply()},[2]}})})}).on("click","i.small",function(){l.parent(".image-container").css({width:"120px",height:"auto"}),f("small"),n.trigger("change")}).on("click","i.medium",function(){l.parent(".image-container").css({width:"290px",height:"auto"}),f("medium"),n.trigger("change")}).on("click","i.large",function(){l.parent(".image-container").css({width:"auto",height:"auto"}),f("large"),n.trigger("change")}).on("click",".open-media-library",function(){t.imageOption.display.pickFile=!0,t.$apply()}).on("click",".justify-left",function(){l.parent().css({float:"left"})}).on("click",".justify-center",function(){l.parent().css({float:"none",margin:"auto",display:"block"})}).on("click",".justify-right",function(){l.parent().css({float:"right",margin:"auto"})}),f();var p=function(){s.remove(),e.removeClass("has-menu"),e.off("resizing.imageMenu"),a.$(window).off("scroll.imagemenu")};setTimeout(function(){t.$on("$destroy",function(){p()}),a.$(document).one("selectionchange",function(e){setTimeout(function(){0===s.find(e.target).length&&p()},200)}),a.$(document).one("keyup",function(e){setTimeout(function(){a.$("body").find(l).length||p()},50)}),a.$(document).on("click",".close-focus",function(){p()})},0)};t.image={name:"image",run:function(e){return{template:'<i ng-click="imageOption.display.pickFile = true" tooltip="editor.option.image"></i><div ng-if="imageOption.display.editFile"><image-editor document="imageOption.display.file" on-save="updateImage()" show="imageOption.display.editFile"></image-editor></div><div ng-if="imageOption.display.pickFile"><lightbox show="imageOption.display.pickFile"><media-library ng-change="updateContent()" multiple="true" ng-model="imageOption.display.files" file-format="\'img\'" visibility="imageOption.visibility"></media-library></lightbox></div>',link:function(t,n,r){e.editZone.on("click touchstart","img:not(.smiley)",function(n){if(n.target){if(a.$(n.target).attr("src").startsWith("/assets")){t.imageOption.display.pickFile=!0;var r=window.getSelection();r.removeAllRanges();var i=document.createRange();i.selectNode(n.target),r.addRange(i),e.selection.range=i,t.$apply()}if(a.$(n.target).attr("src").startsWith("/workspace")){var o=a.$('<span contenteditable="false" class="image-container">&#8203;</span>');a.$(n.target).parent().hasClass("image-container")?o=a.$(n.target.parentNode):(n.target.parentNode.insertBefore(o[0],n.target),o.append(n.target));var s=window.getSelection();s.removeAllRanges();var u=document.createRange();u.selectNode(o[0]),s.addRange(u),e.selection.range=u,h(o,t,e)}}}),e.on("contentupdated",function(){s.ui.extendElement.resizable(e.editZone.find(".image-container").not(".image-template .image-container"),{moveWithResize:!1,preserveRatio:!0,mouseUp:function(){e.trigger("contentupdated"),e.addState(e.editZone.html())},extendParent:{bottom:!0}})}),t.imageOption={display:{pickFile:!1},visibility:"protected"},"public"===e.visibility&&(t.imageOption.visibility="public"),e.editZone.addClass("drawing-zone"),t.display={},t.updateContent=function(){var n="/workspace/document/";"public"===t.imageOption.visibility&&(n="/workspace/pub/document/");var r="";t.imageOption.display.files.forEach(function(e){r+='<span contenteditable="false" class="image-container">\n &#8203;<img src="'+n+e._id+'?thumbnail=2600x0"',e.alt&&(r+='alt="'+e.alt+'"'),r+=' class="latest-image" />\n </span>&nbsp;&nbsp;'}),e.selection.replaceHTMLInline(r);e.editZone.find(".latest-image").removeClass("latest-image");e.addState(e.editZone.html()),t.imageOption.display.pickFile=!1,t.imageOption.display.files=[],e.focus(),window.getSelection()&&window.getSelection().removeAllRanges()},e.on("model-updated",function(){return l(e)}),e.editZone.on("drop","img",function(e){return e.stopPropagation(),e.preventDefault(),!1});var i;e.editZone.on("dragover drop",function(e){if(i=void 0,document.caretPositionFromPoint){var t=document.caretPositionFromPoint(e.originalEvent.clientX,e.originalEvent.clientY).offsetNode;1===t.nodeType&&"SPAN"===t.tagName&&a.$(t).find("img").length&&(i=t.find("img")[0])}}),e.editZone.on("drop",function(t){console.log("drop image"),setTimeout(function(){e.editZone.find("img").each(function(e,t){if(a.$(t).attr("src").split(location.protocol+"//"+location.host).length>1){a.$(t).attr("src",a.$(t).attr("src").split(location.protocol+"//"+location.host)[1]);var n=a.$('<span contenteditable="false" class="image-container">&#8203;</span>'),r=t.parentNode;a.$(r).hasClass("image-container")&&(r=r.parentNode),r.insertBefore(n[0],t),n.append(t)}}),e.addState(e.editZone.html()),l(e)},100)}),e.editZone.on("dragstart","img",function(t){a.$("body").one("dragend.dragimage",function(){e.editZone.off("drop.dragimage")}),e.editZone.one("drop.dragimage",function(){setTimeout(function(){i&&0===a.$("body").find(i).length&&(console.log(i),console.log(a.$("body").find(i).length),t.target.parentNode.insertBefore(i,t.target))},250),setTimeout(function(){return a.$(t.target).parent("span").remove()},200)})})}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),i=n(391),o=n(3);t.attachment={name:"attachment",run:function(e){return{template:'<i ng-click="attachmentOption.display.pickFile = true" tooltip="editor.option.attachment"></i><div ng-if="attachmentOption.display.pickFile"><lightbox show="attachmentOption.display.pickFile" on-close="cancel()"><media-library ng-change="updateContent()" multiple="true" ng-model="attachmentOption.display.files" file-format="\'any\'" visibility="attachmentOption.visibility"></media-library></lightbox></div>',link:function(t,n,s){n.on("mousedown","a",function(e){e.stopPropagation(),r.$(e.target).parents(".download-attachments")[0].dispatchEvent(e)}),t.attachmentOption={display:{pickFile:!1},visibility:"protected"},"public"===e.visibility&&(t.attachmentOption.visibility="public"),t.cancel=function(){t.attachmentOption.display.pickFile=!1},e.bindContextualMenu(t,".download-attachments",[{label:"editor.edit.attachment",action:function(n){r.$(n.target).hasClass("download-attachments")||(n.target=r.$(n.target).parents(".download-attachments")[0]),e.selection.selectNode(n.target);var o=[];r.$(n.target).find("a").each(function(e,t){var n=r.$(t).attr("href").split("/");o.push(n[n.length-1])}),i.MediaLibrary.appDocuments.documents.deselectAll(),i.MediaLibrary.appDocuments.documents.all.map(function(e){return-1!==o.indexOf(e._id)&&(e.selected=!0),e}),t.attachmentOption.display.pickFile=!0}},{label:"editor.remove.attachment",action:function(t){r.$(t.target).hasClass("download-attachments")||(t.target=r.$(t.target).parents(".download-attachments")[0]),r.$(t.target).remove(),e.trigger("contentupdated")}}]),t.display={},t.updateContent=function(){var n="/workspace/document/";"public"===t.attachmentOption.visibility&&(n="/workspace/pub/document/");var r='<div class="download-attachments"><h2>'+o.idiom.translate("editor.attachment.title")+'</h2><div class="attachments">';t.attachmentOption.display.files.forEach(function(e){r+='<a href="'+n+e._id+'"><div class="download"></div>'+e.name+"</a>"}),r+="</div></div><div><br /><div><br /></div></div>",e.selection.replaceHTML(r),e.addState(e.editZone.html()),t.attachmentOption.display.pickFile=!1,t.attachmentOption.display.files=[],e.focus(),i.MediaLibrary.appDocuments.documents.deselectAll()}}}}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sound={name:"sound",run:function(e){return e.hiddenShareSoundCode?{template:"",link:function(e,t,n){}}:{template:'<i ng-click="soundOption.display.pickFile = true" tooltip="editor.option.sound"></i><div ng-if="soundOption.display.pickFile"><lightbox show="soundOption.display.pickFile" on-close="soundOption.display.pickFile = false;"><media-library ng-change="updateContent()" ng-model="soundOption.display.file" file-format="\'audio\'" visibility="soundOption.visibility"></media-library></lightbox></div>',link:function(t,n,r){e.editZone.addClass("drawing-zone"),t.soundOption={display:{pickFile:!1},visibility:"protected"},"public"===e.visibility&&(t.soundOption.visibility="public"),t.updateContent=function(){var n="/workspace/document/";"public"===t.soundOption.visibility&&(n="/workspace/pub/document/"),e.selection.replaceHTML('<div><br /></div><div class="audio-wrapper"><audio src="'+n+t.soundOption.display.file._id+'" controls preload="none"></audio></div><div><br /></div>'),t.soundOption.display.pickFile=!1,t.soundOption.display.file=void 0}}}}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.embed={name:"embed",run:function(e){return e.hiddenShareVideoCode?{template:"",link:function(e,t,n){}}:{template:'\n <i ng-click="display.copyEmbed = true" tooltip="editor.option.embed"></i>\n <toast-onboarding\n ng-if="display.toast"\n show="display.copyEmbed" \n confirm="handleOnboardingConfirm()"\n >\n </toast-onboarding>\n <embedder\n file-format="\'video\'" \n hidden-share-video-code=\''+e.hiddenShareVideoCode+'\' \n ng-model="display.htmlCode" \n ng-change="applyHtml()" \n ng-if="display.copyEmbed" \n show="display.copyEmbed"\n selected-header="display.selectedHeader"\n visibility="display.visibility"\n >\n </embedder>\n ',link:function(t,n,r){t.display={htmlCode:"",copyEmbed:!1,selectedHeader:"",toast:e.showOnboardingVideo,visibility:"protected"},"public"===e.visibility&&(t.display.visibility="public"),t.applyHtml=function(n){e.selection.replaceHTML(t.display.htmlCode),t.display.copyEmbed=!1},t.handleOnboardingConfirm=function(){t.display.selectedHeader="video.header.record"}}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);t.mathjax={name:"mathjax",run:function(e){return{template:'<i ng-click="display.fillFormula = true" tooltip="editor.option.mathjax"></i><lightbox show="display.fillFormula" on-close="display.fillFormula = false;"><textarea ng-model="display.formula"></textarea><mathjax formula="[[display.formula]]"></mathjax><div class="row"><button type="button" ng-click="updateContent()" class="right-magnet"><i18n>apply</i18n></button><button type="button" ng-click="cancel()" class="right-magnet cancel"><i18n>cancel</i18n></button></div></lightbox>',link:function(t,n,i){t.display={formula:"\\begin{equation}\n{-b \\pm \\sqrt{b^2-4ac} \\over 2a}\n\\end{equation}"};var o=void 0;t.updateContent=function(){o?(r.$(o).attr("formula",t.display.formula),angular.element(o.firstChild).scope().updateFormula(t.display.formula),e.trigger("change")):e.selection.replaceHTMLInline(e.compile('<span>&nbsp;<mathjax contenteditable="false" formula="'+t.display.formula+'"></mathjax>&nbsp;</span>')(t)),t.display.fillFormula=!1,o=void 0},t.cancel=function(){o=void 0,t.display.fillFormula=!1},e.bindContextualMenu(t,"mathjax",[{label:"editor.edit.mathjax",action:function(n){e.selection.selectNode(n.target),t.display.fillFormula=!0,t.display.formula=r.$(n.target).attr("formula"),o=n.target}},{label:"editor.remove.mathjax",action:function(e){r.$(e.target).remove()}}])}}}}},function(e,t,n){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e};Object.defineProperty(t,"__esModule",{value:!0});var i=n(386),o=n(3),s=n(1),a=n(6),u=n(34),c=n(4),l=n(37),d=n(38),h=n(898);t.linker={name:"linker",run:function(e){return{template:'<i ng-click="linker.openLinker()" tooltip="editor.option.link"></i><div ng-include="\'/infra/public/template/linker.html\'"></div>',link:function(t,n,f){a.ui.extendSelector.touchEvents("[contenteditable] a"),t.linker={display:{},apps:[],search:{application:{},text:""},params:{},resource:{}},e.bindContextualMenu(t,"a",[{label:"editor.edit.link",action:function(n){e.selection.selectNode(n.target),t.linker.display.chooseLink=!0,t.linker.openLinker(s.$(n.target).data("app-prefix"),s.$(n.target).attr("href"),n.target)}},{label:"editor.remove.link",action:function(e){var t=document.createTextNode(s.$(e.target).text());e.target.parentNode.insertBefore(t,e.target),s.$(e.target).remove()}}]),t.linker.openLinker=function(n,r,i){if(i||(e.selection.range=window.getSelection().getRangeAt(0)),this.rangeCount=1,t.linker.display.chooseLink=!0,n)t.linker.search.application.address="/"+n,t.linker.loadApplicationResources(function(){t.linker.searchApplication(function(){var e=c._.findWhere(t.linker.resources,{path:r});t.linker.applyResource(e),t.$apply()})});else if(i||1!==e.selection.selectedElements.length||(i=e.selection.selectedElements[0]),i&&(1!==i.nodeType&&(i=i.parentNode),"A"===i.nodeName)){var o=s.$(i).attr("href");t.linker.params.blank="_blank"===s.$(i).attr("target"),t.linker.params.title=s.$(i).attr("title")||"",""===o.split("http")[0]&&o.split("http").length>1?(t.linker.externalLink=!0,t.linker.params.link=o):(t.linker.externalLink=!1,t.linker.openLinker(o.split("/")[1].split("#")[0],o))}},t.linker.loadApplicationResources=function(e){var n=t.linker.search.application.address.split("/"),r=n[n.length-1];t.linker.params.appPrefix=r,e||(e=function(){t.linker.searchApplication(),t.$apply("linker")}),i.Behaviours.loadBehaviours(t.linker.params.appPrefix,function(n){var o=i.Behaviours.applicationsBehaviours[r];if(t.linker.addResource=o.create,o.loadResourcesWithFilter)e();else{var s=o.loadResources(function(){return e()});s&&s.then&&s.then(function(){e()})}})};var p=function(e,t){var n=null;return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=function(){return e.apply(void 0,r)};clearTimeout(n),n=setTimeout(o,t)}}(function(e,n){t.linker.display.searching=!0,t.$apply("linker"),e.loadResourcesWithFilter(t.linker.search.text,function(e){t.linker.resources=e,t.linker.display.searching=!1,t.$apply("linker"),n&&n()})},400);t.linker.searchApplication=function(e){var n=t.linker.search.application.address.split("/"),r=n[n.length-1];t.linker.params.appPrefix=r,i.Behaviours.loadBehaviours(t.linker.params.appPrefix,function(n){n.loadResourcesWithFilter?t.linker.search.text&&p(n,e):(t.linker.resources=c._.filter(n.resources,function(e){return""!==t.linker.search.text&&(-1!==o.idiom.removeAccents(e.title.toLowerCase()).indexOf(o.idiom.removeAccents(t.linker.search.text).toLowerCase())||e._id===t.linker.search.text)}),"function"==typeof e&&e())})},t.linker.createResource=function(){i.Behaviours.loadBehaviours(t.linker.params.appPrefix,function(e){e.create(t.linker.resource,function(){t.linker.search.text=t.linker.resource.title,t.linker.searchApplication(),t.$apply()})})},t.linker.applyLink=function(e){t.linker.params.link=e},t.linker.applyResource=function(e){t.linker.params.link=e.path,t.linker.params.id=e._id},t.linker.saveLink=function(){t.linker.params.blank&&(t.linker.params.target="_blank");var n,i=e.selection.range.startContainer;if(i&&1!==i.nodeType&&1===i.parentNode.childNodes.length&&0===e.selection.range.startOffset&&e.selection.range.endOffset===i.textContent.length&&(i=i.parentNode),n=i&&"A"===i.nodeName?s.$(i):s.$("<a></a>"),t.linker.params.link){var o=new RegExp("^www"),a=t.linker.params.link.match(o);if(null===a)n.attr("href",t.linker.params.link);else if("www"==a[0]){var u="https://".concat(t.linker.params.link.toString());n.attr("href",u)}if(t.linker.params.appPrefix&&!t.linker.externalLink&&(n.attr("data-app-prefix",t.linker.params.appPrefix),"workspace"===t.linker.params.appPrefix||t.linker.externalLink||n.data("reload",!0)),t.linker.params.id&&n.attr("data-id",t.linker.params.id),t.linker.params.blank&&(t.linker.params.target="_blank",n.attr("target",t.linker.params.target)),t.linker.params.title){var c=/[<]/gi;t.linker.params.title=t.linker.params.title.replace(c,"&lt;"),c=/[>]/gi,t.linker.params.title=t.linker.params.title.replace(c,"&gt;"),n.attr("title",t.linker.params.title)}else n.attr("title")&&(n.removeAttr("title"),n.off("mouseover"));h.editorEvents.onLinkerAdd.next(r({externalLink:t.linker.externalLink},t.linker.params))}if(i&&"A"===i.nodeName)return e.selection.moveCaret(n[0],n.text().length),e.trigger("change"),t.linker.display.chooseLink=!1,t.linker.params={},t.linker.display.search={application:{},text:""},void(t.linker.externalLink=!1);e.selection.isCursor()?(n.text(t.linker.params.link),e.selection.replaceHTMLInline(e.compile(n[0].outerHTML)(t))):e.selection.wrapText(n),e.focus(),t.linker.display.chooseLink=!1,t.linker.params={},t.linker.display.search={application:{},text:""},t.linker.externalLink=!1},t.linker.cancel=function(){t.linker.display.chooseLink=!1,t.linker.params={},t.linker.display.search={application:{},text:""},t.linker.externalLink=!1},u.http().get("/resources-applications").done(function(e){t.linker.apps=c._.filter(l.model.me.apps,function(t){return c._.find(e,function(e){return-1!==t.address.indexOf(e)&&t.icon&&-1===t.address.indexOf("#")})}),t.linker.apps=c._.map(t.linker.apps,function(e){return e.displayName=o.idiom.translate(e.displayName),e}),t.linker.search.application=c._.find(t.linker.apps,function(e){return-1!==e.address.indexOf(d.appPrefix)}),t.linker.search.application?t.linker.loadApplicationResources(function(){}):(t.linker.search.application=t.linker.apps[0],t.linker.searchApplication(function(){t.linker.loadApplicationResources(function(){})})),t.$apply("linker")})}}}},t.unlink={name:"unlink",run:function(e){return{template:'<i tooltip="editor.option.unlink"></i>',link:function(t,n,r){n.addClass("disabled"),n.on("click",function(){var t=e.selection.range.startContainer;if(1!==t.nodeType&&(t=t.parentNode),"A"===t.nodeName){var r=document.createTextNode(s.$(t).text());t.parentNode.insertBefore(r,t),s.$(t).remove(),n.addClass("disabled")}}),e.on("selectionchange",function(e){if(e.selection.range){var t=e.selection.range.startContainer;1!==t.nodeType&&(t=t.parentNode),"A"===t.nodeName?n.removeClass("disabled"):n.addClass("disabled")}})}}}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.smileys={name:"smileys",run:function(e){return{template:'<i tooltip="editor.option.smileys"></i><lightbox show="display.pickSmiley" on-close="display.pickSmiley = false;"><h2>Insérer un smiley</h2><div class="row smileys"><img ng-repeat="smiley in smileys" class="smiley" ng-click="addSmiley(smiley)" skin-src="/img/smileys/[[smiley]].png" /></div></lightbox>',link:function(t,n,r){t.display={},t.smileys=["happy","proud","dreamy","love","tired","angry","worried","sick","joker","sad"],t.addSmiley=function(n){var r=e.compile('<img skin-src="/img/smileys/'+n+'.png" class="smiley" />')(t.$parent);e.selection.replaceHTMLInline(r),window.getSelection().getRangeAt(0).collapse(!1),t.display.pickSmiley=!1,e.focus()},n.children("i").on("click",function(){t.display.pickSmiley=!0})}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),i=n(6);t.table={name:"table",run:function(e){return{template:'<popover mouse-event="click" on-close="resetScroll()"><i popover-opener opening-event="click" tooltip="editor.option.table"></i><popover-content><div class="draw-table"></div></popover-content></popover>',link:function(t,n,o){for(var s=n.find(".draw-table"),a=0;a<12;a++){var u=r.$('<div class="row"></div>');s.append(u);for(var c=0;c<12;c++)u.append('<div class="one cell"></div>')}t.resetScroll=function(){n.parents().css({overflow:""}),n.parents("editor-toolbar").each(function(e,t){r.$(t).css({"margin-top":"","min-height":"",height:""})})},i.ui.extendSelector.touchEvents("[contenteditable] td"),n.find("i").on("click",function(){n.find("popover-content").hasClass("hidden")?setTimeout(function(){n.parents("editor-toolbar").each(function(e,t){r.$(t).css({"margin-top":"-"+t.scrollTop+"px","min-height":"0",height:"auto"})}),n.parents().css({overflow:"visible"})},0):(n.parents().css({overflow:""}),n.parents("editor-toolbar").each(function(e,t){r.$(t).css({"margin-top":"","min-height":"",height:""})}))}),s.find(".cell").on("mouseover",function(){for(var e=r.$(this).parent(),t=0;t<=e.index();t++)for(var n=r.$(s.find(".row")[t]),i=0;i<=r.$(this).index();i++){var o=r.$(n.find(".cell")[i]);o.addClass("match")}}),s.find(".cell").on("mouseout",function(){s.find(".cell").removeClass("match")}),s.find(".cell").on("click",function(){for(var t=document.createElement("table"),n=r.$(this).parent(),i=0;i<=n.index();i++){var o=r.$("<tr></tr>");r.$(t).append(o);for(var s=0;s<=r.$(this).index();s++){var a=r.$("<td></td>");a.html("<br />"),o.append(a)}}e.selection.replaceHTML("<div>"+t.outerHTML+"</div>"),e.trigger("contentupdated")}),e.bindContextualMenu(t,"td",[{label:"editor.add.row",action:function(e){var t=r.$(r.$(e.target).parent()[0].outerHTML);t.find("td").html("<br />"),r.$(e.target).parent().after(t)}},{label:"editor.add.column",action:function(e){var t=r.$(e.target).index();r.$(e.target).parents("table").find("tr").each(function(e,n){r.$(n).children("td").eq(t).after("<td><br /></td>")})}},{label:"editor.remove.row",action:function(e){r.$(e.target).parent().remove()}},{label:"editor.remove.column",action:function(e){var t=r.$(e.target).index();r.$(e.target).parents("table").find("tr").each(function(e,n){r.$(n).children("td").eq(t).remove()})}}])}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=n(33),o=n(4);t.templates={name:"templates",run:function(e){return{template:'<i tooltip="editor.option.templates"></i><lightbox show="display.pickTemplate" on-close="display.pickTemplate = false;"><h2><i18n>editor.option.templates</i18n></h2><ul class="thought-out-actions"><li ng-repeat="template in templates" ng-click="applyTemplate(template)"><img ng-src="[[template.image]]" class="cell" /><div class="cell vertical-spacing horizontal-spacing" translate content="[[template.title]]"></div></li></ul></lightbox>',link:function(t,n,s){var a=i.skin.basePath+"../entcore-css-lib/editor-resources/img/";t.templates=[{title:"editor.templates.emptypage.title",image:a+"templates-preview-emptypage.svg",html:'<div class="twelve cell column"><article></article></div>'},{title:"editor.templates.twocols.title",image:a+"templates-preview-twocols.svg",html:'<div class="row"><div class="six cell column"><article><h2>'+r.idiom.translate("editor.templates.coltitle")+"</h2><p>"+r.idiom.translate("editor.templates.colfiller")+'</p></article></div><div class="six cell column"><article><h2>'+r.idiom.translate("editor.templates.coltitle")+"</h2><p>"+r.idiom.translate("editor.templates.colfiller")+"</p></article></div></div>"},{title:"editor.templates.threecols.title",image:a+"templates-preview-threecols.svg",html:'<div class="row"><div class="four cell column"><article><h2>'+r.idiom.translate("editor.templates.coltitle")+"</h2><p>"+r.idiom.translate("editor.templates.colfiller")+'</p></article></div><div class="four cell column"><article><h2>'+r.idiom.translate("editor.templates.coltitle")+"</h2><p>"+r.idiom.translate("editor.templates.colfiller")+'</p></article></div><div class="four cell column"><article><h2>'+r.idiom.translate("editor.templates.coltitle")+"</h2><p>"+r.idiom.translate("editor.templates.colfiller")+"</p></article></div></div>"},{title:"editor.templates.illustration.title",image:a+"templates-preview-illustration.svg",html:'<div class="row"><div class="three cell image-template column"><article><img src="'+a+'image-default.svg" style="cursor: pointer" /></article></div><div class="nine cell column"><article><h2>'+r.idiom.translate("editor.templates.illustration.titlefiller")+"</h2><p>"+r.idiom.translate("editor.templates.illustration.textfiller")+"</p></article></div></div>"},{title:"editor.templates.dominos.title",image:a+"templates-preview-dominos.svg",html:'<div class="dominos"><div class="item"><section class="domino pink"><div class="top image-template"><img src="'+a+'image-default.svg" style="cursor: pointer" class="fixed twelve cell" /></div><div class="bottom"><div class="content">'+r.idiom.translate("editor.templates.dominos.textfiller")+'</div></div></section></div><div class="item"><section class="domino blue"><div class="top image-template"><img src="'+a+'image-default.svg" style="cursor: pointer" class="fixed twelve cell" /></div><div class="bottom"><div class="content">'+r.idiom.translate("editor.templates.dominos.textfiller")+'</div></div></section></div><div class="item"><section class="domino orange"><div class="top image-template"><img src="'+a+'image-default.svg" style="cursor: pointer" class="fixed twelve cell" /></div><div class="bottom"><div class="content">'+r.idiom.translate("editor.templates.dominos.textfiller")+'</div></div></section></div><div class="item"><section class="domino purple"><div class="top image-template"><img src="'+a+'image-default.svg" style="cursor: pointer" class="fixed twelve cell" /></div><div class="bottom"><div class="content">'+r.idiom.translate("editor.templates.dominos.textfiller")+'</div></div></section></div><div class="item"><section class="domino green"><div class="top image-template"><img src="'+a+'image-default.svg" style="cursor: pointer" class="fixed twelve cell" /></div><div class="bottom"><div class="content">'+r.idiom.translate("editor.templates.dominos.textfiller")+'</div></div></section></div><div class="item"><section class="domino white"><div class="top image-template"><img src="'+a+'image-default.svg" style="cursor: pointer" class="fixed twelve cell" /></div><div class="bottom"><div class="content">'+r.idiom.translate("editor.templates.dominos.textfiller")+"</div></div></section></div></div>"}],t.display={},t.applyTemplate=function(n){t.display.pickTemplate=!1,e.selection.replaceHTML(o._.findWhere(t.templates,{title:n.title}).html)},n.children("i").on("click",function(){t.display.pickTemplate=!0,t.$apply("display")})}}}}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(935),s=n(3);t.edumedia={name:"edumedia",run:function(e){return{template:'\n <i class="ic-edumedia" ng-click="open()" ng-if="isVisible" tooltip="editor.option.edumedia"></i>\n <div ng-if="edumediaOptions.display.pickMedia">\n <lightbox show="edumediaOptions.display.pickMedia" on-close="cancel()">\n <script type="text/ng-template" id="edumedia_explorer">\n <edumedia-explorer on-select-medias="onSelectMedia($selection)"></edumedia-explorer>\n <\/script>\n <media-library delegate="delegate" ng-change="updateContent()" visibility="\'external\'" multiple="true" ng-model="edumediaOptions.display.files"></media-library>\n </lightbox>\n </div>\n ',link:function(t,n,a){var u=this;t.isVisible=!1;!function(){r(u,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return[4,o.edumediaService.isEdumediaEnabled()];case 1:return e=n.sent(),t.isVisible=e,t.$apply(),[2]}})})}();var c={i18Key:"library.header.edumedia",template:"local:edumedia_explorer",visible:function(){return!0},worflowKey:null},l={title:s.idiom.translate("library.title.edumedia"),visit:function(e){e.onSelectMedia=function(e){return t.onSelect(e)},setTimeout(function(){e.showHeader(c)})},augmentHeaders:function(e){var t=e.filter(function(e){return e.i18Key.indexOf("browse")>-1});return[c].concat(t)},filterDocumentRole:function(e){return o.edumediaService.hasEdumediaContentType(e)}};t.delegate=l,t.onSelect=function(n){try{var r="";n.forEach(function(e){r+='<br/><span contenteditable="false" class="edumedia-container">&#8203;'+o.edumediaService.toHtml(e)+"</span><br/>"}),e.selection.replaceHTMLInline(r),e.focus(),window.getSelection().removeAllRanges();var i=n.map(function(e){return o.edumediaService.saveIntoWorkspace(e)});return Promise.all(i)}finally{t.cancel()}},t.edumediaOptions={display:{pickMedia:!1,files:[]},visibility:"protected"},t.open=function(){t.edumediaOptions.display.pickMedia=!0},t.cancel=function(){t.edumediaOptions.display.pickMedia=!1},t.updateContent=function(){return r(this,void 0,void 0,function(){var n,s,a,u=this;return i(this,function(c){switch(c.label){case 0:return c.trys.push([0,,2,3]),n="",s=t.edumediaOptions.display.files,a=s.map(function(e){return r(u,void 0,void 0,function(){var t;return i(this,function(r){switch(r.label){case 0:return[4,o.edumediaService.fetchHtml(e)];case 1:return t=r.sent(),n+='<br/><span contenteditable="false" class="edumedia-container">&#8203;'+t+"</span><br/>",[2]}})})}),[4,Promise.all(a)];case 1:return c.sent(),e.selection.replaceHTMLInline(n),e.focus(),window.getSelection().removeAllRanges(),[3,3];case 2:return t.cancel(),[7];case 3:return[2]}})})}}}}}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),s=n(6),a=n(407),u=n(392),c=n(550),l=n(37),d=n(936),h=n(937),f=n(3),p=n(938),m="edumedia";t.EDU_MEDIA_CONTENT_TYPE="edumedia/html";var _,v;t.edumediaService={cacheBaseUrl:null,cacheConfig:null,isEdumediaEnabled:function(){return r(this,void 0,void 0,function(){var e,n;return i(this,function(r){switch(r.label){case 0:return[4,h.Me.onSessionReady()];case 1:return r.sent(),[4,t.edumediaService.getEdumediaConfig()];case 2:return e=r.sent(),n=l.model.me&&(l.model.me.optionEnabled||[]).indexOf("EDUMEDIA")>-1,[2,!!e&&n]}})})},getEdumediaConfig:function(){return r(this,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return null!=t.edumediaService.cacheConfig?[2,t.edumediaService.cacheConfig]:[4,s.ui.getCurrentThemeConf()];case 1:return(e=n.sent())&&e.edumedia?(t.edumediaService.cacheConfig=e.edumedia,[2,e.edumedia]):(console.warn("Edumedia not configured in theme-conf.js or in current theme",e),[2,null])}})})},fetchHtml:function(e){return r(this,void 0,void 0,function(){var t,n;return i(this,function(r){switch(r.label){case 0:return[4,c.workspaceService.getDocumentBlob(e._id)];case 1:return t=r.sent(),n=new FileReader,[2,new Promise(function(e,r){n.onload=function(){e(n.result)},n.readAsText(t)})]}})})},hasEdumediaContentType:function(e){return e.contentType&&e.contentType.indexOf(t.EDU_MEDIA_CONTENT_TYPE)>-1},getUrl:function(){var e=this;return function(){return r(e,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return t.edumediaService.cacheBaseUrl?[3,2]:[4,t.edumediaService.getEdumediaConfig()];case 1:e=n.sent(),t.edumediaService.cacheBaseUrl=e.uri,t.edumediaService.cacheBaseUrl||(t.edumediaService.cacheBaseUrl="https://www.edumedia-sciences.com"),n.label=2;case 2:return[2,t.edumediaService.cacheBaseUrl+"/"+window.entcore.currentLanguage+"/api/v1"]}})})}()},getToken:function(){var e=this;if(void 0!=v)return v;return v=function(){return r(e,void 0,void 0,function(){var e,n,s,a,u,c,h,f,p,m,v,y,g=this;return i(this,function(b){switch(b.label){case 0:return _=null,[4,t.edumediaService.getEdumediaConfig()];case 1:for(e=b.sent(),n=e.uri,s=e.pattern,a=function(e){return r(g,void 0,void 0,function(){var t,r,a;return i(this,function(i){switch(i.label){case 0:return t=d.MD5(s.replace("[[uai]]",e)),r=new URLSearchParams,r.append("uai",e),r.append("hash",t),[4,o.default.post(n+"/api/one/uai-token",r,{headers:{accept:"application/json","Content-Type":"application/x-www-form-urlencoded"}})];case 1:return a=i.sent(),200==a.status&&a.data.success?[2,a.data.token]:(console.warn("[Edumedia] fetch of token failed for uai failed: ",a.status,a.data,e),[2,null])}})})},u=[],c=0,h=l.model.me.uai;c<h.length;c++)f=h[c],u.push(a(f));return[4,Promise.all(u)];case 2:for(p=b.sent(),m=0,v=p;m<v.length;m++)null!=(y=v[m])&&(_=y);return[2,_]}})})}()},search:function(e,n,s){return void 0===n&&(n=40),r(this,void 0,void 0,function(){var r,a,u;return i(this,function(i){switch(i.label){case 0:return[4,t.edumediaService.getUrl()];case 1:return r=i.sent(),[4,o.default({url:r+"/search?q="+e+"&max="+n+"&"+(s?"tree-item-api-id="+s:""),method:"get"})];case 2:return a=i.sent(),u=a.data,u.medias.forEach(function(e){return e.media=!0}),[2,u]}})})},fetchSubjects:function(){return r(this,void 0,void 0,function(){var e,n,r,s;return i(this,function(i){switch(i.label){case 0:return[4,t.edumediaService.getUrl()];case 1:return e=i.sent(),[4,o.default({url:e+"/tree-item/n-root",method:"get"})];case 2:return n=i.sent(),[4,t.edumediaService.getEdumediaConfig()];case 3:return r=i.sent(),s=n.data,r.ignoreSubjects&&(s.children=s.children.filter(function(e){return-1==r.ignoreSubjects.indexOf(e.id)})),[2,s]}})})},fetchChildren:function(e){return r(this,void 0,void 0,function(){var t,n;return i(this,function(r){switch(r.label){case 0:return[4,o.default({url:e.apiURL,method:"get"})];case 1:return t=r.sent(),n=t.data,n.medias&&n.medias.forEach(function(e){return e.media=!0}),[2,n]}})})},fetchMediaDetail:function(e){return r(this,void 0,void 0,function(){var n,r;return i(this,function(i){switch(i.label){case 0:return[4,t.edumediaService.getToken()];case 1:return n=i.sent(),[4,o.default({url:e.apiURL+"?token="+n,method:"get"})];case 2:return r=i.sent(),[2,r.data]}})})},getContentTypeFor:function(e){return t.EDU_MEDIA_CONTENT_TYPE+"$id="+e.id},getIdFromContentType:function(e){var t=e.split("$").find(function(e){return e.startsWith("id=")});return t&&t.replace("id=","").replace("$","")},getThumbFromContentType:function(e){var n=t.edumediaService.getIdFromContentType(e);return n&&"https://www.edumedia-sciences.com/media/thumbnail/"+n},toHtml:function(e){return'\n <div style="position:relative" edumedia-content-jquery="edumedia_'+e.id+'">\n <div class="edumedia-content-header">\n <a edumedia-fullscreen-jquery="edumedia_'+e.id+'">'+f.idiom.translate("edumedia.fullscreen")+'&nbsp;&nbsp;<i class="fullscreen-on"></i></a>\n <i class="close-2x" edumedia-delete-jquery="edumedia_'+e.id+'"></i>\n </div>\n <iframe id="edumedia_'+e.id+'" title="'+e.title+'" width="'+e.width+'" height="'+e.height+'" src="'+e.frameURL+'">\n </iframe>\n </div>\n '},saveIntoWorkspace:function(e){return r(this,void 0,void 0,function(){var n,r,o,s;return i(this,function(i){return n=t.edumediaService.toHtml(e),r=t.edumediaService.getContentTypeFor(e),o=new File([n],""+e.title,{type:r}),s=new u.Document,[2,c.workspaceService.createExternalDocument(o,s,m,{visibility:"protected",application:m})]})})},removeContent:function(e){var t=jQuery('[edumedia-content-jquery="'+e+'"]');t.parent(".edumedia-container").remove(),t.remove()},closeFullScreen:function(){jQuery("#edumedia-fullscreen-lightbox").remove()},makeFullscreen:function(e){jQuery("#edumedia-fullscreen-lightbox").remove(),jQuery("body").append('\n <section class="lightbox" id="edumedia-fullscreen-lightbox">\n <div class="background"></div>\n <div class="edumedia-fullscreen-content"></div>\n <div class="close-lightbox" onclick="document.querySelectorAll(\'#edumedia-fullscreen-lightbox\').forEach(function(e){ e.remove(e)})">\n <i class="close-2x"></i>\n </div>\n </section>\n ');var t=jQuery("#"+e).clone();t.removeAttr("id");var n=$(window).width()-100,r=$(window).height()-100;t.attr("width",n),t.attr("height",r),jQuery(".edumedia-fullscreen-content").append(t)}},function(){var e=this;try{p.getEditorWhiteListAttributes().push("edumedia-content-jquery"),p.getEditorWhiteListAttributes().push("edumedia-fullscreen-jquery"),p.getEditorWhiteListAttributes().push("edumedia-delete-jquery")}catch(e){console.warn(e)}a.Element.registerContentTypeToRoleMapper(function(e,n){if(e&&e.indexOf(t.EDU_MEDIA_CONTENT_TYPE)>-1)return n?a.ROLES.HTML:a.ROLES.IMG}),a.Element.registerThumbUrlMapper(function(e){if(e.contentType&&e.contentType.indexOf(t.EDU_MEDIA_CONTENT_TYPE)>-1)return t.edumediaService.getThumbFromContentType(e.contentType)}),c.workspaceService.addExternalFolder(function(){return r(e,void 0,void 0,function(){var e,n;return i(this,function(r){switch(r.label){case 0:return[4,t.edumediaService.isEdumediaEnabled()];case 1:return e=r.sent(),e?[4,t.edumediaService.getEdumediaConfig()]:[3,3];case 2:return n=r.sent(),t.edumediaService.cacheBaseUrl=n.uri,[2,{externalId:m,name:"Edumedia"}];case 3:return[2,null]}})})}()),c.workspaceService.registerExternalFullScreenRenderer(function(e){if(e.contentType&&e.contentType.indexOf(t.EDU_MEDIA_CONTENT_TYPE)>-1){var n=t.edumediaService.getIdFromContentType(e.contentType);return t.edumediaService.makeFullscreen("edumedia_"+n),{close:function(){t.edumediaService.closeFullScreen()}}}return!1}),c.workspaceService.registerExternalActionFilter(function(e,n){if(e.contentType&&e.contentType.indexOf(t.EDU_MEDIA_CONTENT_TYPE)>-1)switch(n){case"comment":case"copy":case"download":case"history":case"move":case"share":return!1}return!0})}()},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MD5=function(e){function t(e,t){return e<<t|e>>>32-t}function n(e,t){var n,r,i,o,s;return i=2147483648&e,o=2147483648&t,n=1073741824&e,r=1073741824&t,s=(1073741823&e)+(1073741823&t),n&r?2147483648^s^i^o:n|r?1073741824&s?3221225472^s^i^o:1073741824^s^i^o:s^i^o}function r(e,t,n){return e&t|~e&n}function i(e,t,n){return e&n|t&~n}function o(e,t,n){return e^t^n}function s(e,t,n){return t^(e|~n)}function a(e,i,o,s,a,u,c){return e=n(e,n(n(r(i,o,s),a),c)),n(t(e,u),i)}function u(e,r,o,s,a,u,c){return e=n(e,n(n(i(r,o,s),a),c)),n(t(e,u),r)}function c(e,r,i,s,a,u,c){return e=n(e,n(n(o(r,i,s),a),c)),n(t(e,u),r)}function l(e,r,i,o,a,u,c){return e=n(e,n(n(s(r,i,o),a),c)),n(t(e,u),r)}function d(e){var t,n,r="",i="";for(n=0;n<=3;n++)t=e>>>8*n&255,i="0"+t.toString(16),r+=i.substr(i.length-2,2);return r}var h,f,p,m,_,v,y,g,b,w=Array();for(e=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t+=String.fromCharCode(r):r>127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t}(e),w=function(e){for(var t,n=e.length,r=n+8,i=(r-r%64)/64,o=16*(i+1),s=Array(o-1),a=0,u=0;u<n;)t=(u-u%4)/4,a=u%4*8,s[t]=s[t]|e.charCodeAt(u)<<a,u++;return t=(u-u%4)/4,a=u%4*8,s[t]=s[t]|128<<a,s[o-2]=n<<3,s[o-1]=n>>>29,s}(e),v=1732584193,y=4023233417,g=2562383102,b=271733878,h=0;h<w.length;h+=16)f=v,p=y,m=g,_=b,v=a(v,y,g,b,w[h+0],7,3614090360),b=a(b,v,y,g,w[h+1],12,3905402710),g=a(g,b,v,y,w[h+2],17,606105819),y=a(y,g,b,v,w[h+3],22,3250441966),v=a(v,y,g,b,w[h+4],7,4118548399),b=a(b,v,y,g,w[h+5],12,1200080426),g=a(g,b,v,y,w[h+6],17,2821735955),y=a(y,g,b,v,w[h+7],22,4249261313),v=a(v,y,g,b,w[h+8],7,1770035416),b=a(b,v,y,g,w[h+9],12,2336552879),g=a(g,b,v,y,w[h+10],17,4294925233),y=a(y,g,b,v,w[h+11],22,2304563134),v=a(v,y,g,b,w[h+12],7,1804603682),b=a(b,v,y,g,w[h+13],12,4254626195),g=a(g,b,v,y,w[h+14],17,2792965006),y=a(y,g,b,v,w[h+15],22,1236535329),v=u(v,y,g,b,w[h+1],5,4129170786),b=u(b,v,y,g,w[h+6],9,3225465664),g=u(g,b,v,y,w[h+11],14,643717713),y=u(y,g,b,v,w[h+0],20,3921069994),v=u(v,y,g,b,w[h+5],5,3593408605),b=u(b,v,y,g,w[h+10],9,38016083),g=u(g,b,v,y,w[h+15],14,3634488961),y=u(y,g,b,v,w[h+4],20,3889429448),v=u(v,y,g,b,w[h+9],5,568446438),b=u(b,v,y,g,w[h+14],9,3275163606),g=u(g,b,v,y,w[h+3],14,4107603335),y=u(y,g,b,v,w[h+8],20,1163531501),v=u(v,y,g,b,w[h+13],5,2850285829),b=u(b,v,y,g,w[h+2],9,4243563512),g=u(g,b,v,y,w[h+7],14,1735328473),y=u(y,g,b,v,w[h+12],20,2368359562),v=c(v,y,g,b,w[h+5],4,4294588738),b=c(b,v,y,g,w[h+8],11,2272392833),g=c(g,b,v,y,w[h+11],16,1839030562),y=c(y,g,b,v,w[h+14],23,4259657740),v=c(v,y,g,b,w[h+1],4,2763975236),b=c(b,v,y,g,w[h+4],11,1272893353),g=c(g,b,v,y,w[h+7],16,4139469664),y=c(y,g,b,v,w[h+10],23,3200236656),v=c(v,y,g,b,w[h+13],4,681279174),b=c(b,v,y,g,w[h+0],11,3936430074),g=c(g,b,v,y,w[h+3],16,3572445317),y=c(y,g,b,v,w[h+6],23,76029189),v=c(v,y,g,b,w[h+9],4,3654602809),b=c(b,v,y,g,w[h+12],11,3873151461),g=c(g,b,v,y,w[h+15],16,530742520),y=c(y,g,b,v,w[h+2],23,3299628645),v=l(v,y,g,b,w[h+0],6,4096336452),b=l(b,v,y,g,w[h+7],10,1126891415),g=l(g,b,v,y,w[h+14],15,2878612391),y=l(y,g,b,v,w[h+5],21,4237533241),v=l(v,y,g,b,w[h+12],6,1700485571),b=l(b,v,y,g,w[h+3],10,2399980690),g=l(g,b,v,y,w[h+10],15,4293915773),y=l(y,g,b,v,w[h+1],21,2240044497),v=l(v,y,g,b,w[h+8],6,1873313359),b=l(b,v,y,g,w[h+15],10,4264355552),g=l(g,b,v,y,w[h+6],15,2734768916),y=l(y,g,b,v,w[h+13],21,1309151649),v=l(v,y,g,b,w[h+4],6,4149444226),b=l(b,v,y,g,w[h+11],10,3174756917),g=l(g,b,v,y,w[h+2],15,718787259),y=l(y,g,b,v,w[h+9],21,3951481745),v=n(v,f),y=n(y,p),g=n(g,m),b=n(b,_);return(d(v)+d(y)+d(g)+d(b)).toLowerCase()}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(37),s=n(7),a=n(393),u=n(3),c=n(388),l=n(35),d=n(38),h=function(){function e(){}return e.hasWorkflowRight=function(e){return r(this,void 0,void 0,function(){var t,n,r,s,a;return i(this,function(i){switch(i.label){case 0:return t=e.split("."),o.model.me?[4,o.model.me.workflow.load([t[0]])]:[2,!1];case 1:if(i.sent(),!o.model.me.workflow)return[2,!1];for(n=o.model.me.workflow,r=0,s=t;r<s.length;r++)a=s[r],n=n[a];return[2,n]}})})},Object.defineProperty(e,"session",{get:function(){return o.model.me},enumerable:!0,configurable:!0}),e.savePreference=function(e){return r(this,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,s.default.put("/userbook/preference/"+e,this.preferences[e])];case 1:return t.sent(),[2]}})})},e.preference=function(e){return r(this,void 0,void 0,function(){var t=this;return i(this,function(n){return this.preferences||(this.preferences={}),[2,new Promise(function(n,r){t.preferences[e]||-1!==t.loading.indexOf(e)?t.preferences[e]?n(t.preferences[e]):t.eventer.once(e+"-loaded",function(){return n(t.preferences[e])}):(t.loading.push(e),t.eventer.once(e+"-loaded",function(){return n(t.preferences[e])}),s.default.get("/userbook/preference/"+e).then(function(n){var r={};if(n.data.preference)try{r=JSON.parse(n.data.preference)}catch(e){r={}}r||(r={}),t.preferences[e]=r,t.eventer.trigger(e+"-loaded",t.preferences[e])}))})]})})},e.revalidateTerms=function(){return r(this,void 0,void 0,function(){var t;return i(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,s.default.put("/auth/cgu/revalidate")];case 1:return n.sent(),e.session.needRevalidateTerms=!1,[3,3];case 2:return t=n.sent(),l.notify.error(u.idiom.translate("cgu.revalidate.failed")),[3,3];case 3:return[2]}})})},e.shouldRevalidate=function(){return new Promise(function(t,n){o.model.me&&o.model.me.userId?t(e.session.needRevalidateTerms):o.model.one("userinfo-loaded",function(n){t(e.session.needRevalidateTerms)})})},e.onSessionReady=function(){return new Promise(function(e,t){o.model.me&&o.model.me.userId?e(o.model.me):setTimeout(function(){o.model.one("userinfo-loaded",function(t){e(o.model.me)})})})},e.keepOpenOnLogout=!1,e.loading=[],e.eventer=new a.Eventer,e}();t.Me=h,window.entcore||(window.entcore={}),window.entcore.Me=h,window.newLogin=!1,window.addEventListener("storage",function(e){if("login-event"==e.key){if("RESET"==e.newValue)return;null!=e.newValue&&o.model.me.login!==e.newValue&&(window.newLogin=!0,console.log("login-event"));try{localStorage.setItem(e.key,"RESET")}catch(e){console.warn("[storage] could not remove login-event:",e)}}},!1),XMLHttpRequest.prototype.baseSend||window.pupetterMode||(XMLHttpRequest.prototype.baseSend=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.baseOpen=XMLHttpRequest.prototype.open,XMLHttpRequest.prototype.open=function(){if(window.CDN_DOMAIN){var e=arguments[1];d.appPrefix;e.startsWith("/infra/public")&&(arguments[1]=window.CDN_DOMAIN+e);/^\/([^\/]*)\/public/.test(e)&&(arguments[1]=window.CDN_DOMAIN+e),e.startsWith("/assets")&&(arguments[1]=window.CDN_DOMAIN+e),"/conf/public"==e&&(arguments[1]=e)}return this.baseOpen.apply(this,arguments)},XMLHttpRequest.prototype.send=function(e){if((-1===document.cookie.indexOf("authenticated=true")||!0===window.newLogin)&&-1===window.location.href.indexOf("/auth")&&!window.notLoggedIn){var t=u.idiom.translate("disconnected.redirect.url"),n="disconnected.redirect.url"!=t&&t&&t.length>0?t:"/auth/login",r=c.$('<lightbox class="lightbox-disconnected">\n <section class="lightbox">\n <div class="content">\n <h2>'+u.idiom.translate("disconnected.title")+'</h2>\n <div class="warning">'+u.idiom.translate("disconnected.warning")+'</div>\n <a class="button right-magnet" href="'+n+'" '+(h.keepOpenOnLogout?'target="_blank"':"")+">"+u.idiom.translate("disconnected.redirect")+'</a>\n </div>\n <div class="background"></div>\n </section>\n </lightbox>\n ');throw c.$("body").append(r).addClass("lightbox-opened"),r.find(".lightbox").fadeIn(),jQuery(".lightbox-disconnected a").on("click",function(){jQuery(".lightbox-disconnected").fadeOut(400,function(){jQuery(".lightbox-disconnected").remove()})}),"Disconnected !"}this.baseSend(e)})},function(e,t){"use strict";function n(){return i}function r(){return o}Object.defineProperty(t,"__esModule",{value:!0});var i=["zone-id","accept","accept-charset","accesskey","action","align","alt","async","autocomplete","autofocus","autoplay","bgcolor","border","charset","checked","cite","class","color","cols","colspan","content","contenteditable","controls","controlslist","coords","data","datetime","default","defer","dir","dirname","disabled","download","draggable","dropzone","enctype","for","form","formaction","headers","height","hidden","high","href","hreflang","http-equiv","id","ismap","kind","label","lang","list","loop","low","max","maxlength","media","method","min","multiple","muted","name","novalidate","open","optimum","pattern","placeholder","poster","preload","readonly","rel","required","reversed","rows","rowspan","sandbox","scope","selected","shape","size","sizes","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","tabindex","target","title","translate","type","usemap","value","width","wrap"],o=["aria-","data-"];t.getEditorWhiteListAttributes=n,t.getEditorWhiteListAttributesStartingBy=r},function(e,t,n){"use strict";function r(e){return e.nodeType===Node.ELEMENT_NODE}function i(e,t){return e&&r(e)&&e.nodeName===t}function o(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function s(e,t){var n=document.getSelection();n.removeAllRanges();var r=document.createRange();return r.setStart(e,t),n.addRange(r),r}function a(e){var t=e.nodeType===Node.TEXT_NODE?document.createTextNode(e.nodeValue):e.cloneNode(!1);return u(t,e),t}function u(e,t){for(var n=t.firstChild;n;)e.appendChild(a(n)),n=n.nextSibling}function c(e){for(var t=e.parentNode;t&&t.nodeType!==Node.ELEMENT_NODE;)t=t.parentNode;return t}function l(e,t,n,r,o){n.addState(r.html());var l=t.startContainer;if(l!==r.get(0)){if(i(l,"TD")||i(l.parentNode,"TD"))return;var m=r.get(0),_=void 0;if(i(l,"LI")?_=l:i(f.findClosestBlockElement(l,m),"LI")&&(_=f.findClosestBlockElement(l,m)),_){if(0===_.textContent.replace(/[\u200B-\u200D\uFEFF]/g,"").length&&l!==m){var v=l,y=void 0,g=void 0;do{if(i(v,"LI")&&!g&&(g=v),i(v,"UL")||i(v,"OL")){if(y)return;y=v}}while((v=v.parentNode)&&v!==m);if(!g.nextSibling){var b=document.createElement("div");return b.appendChild(document.createTextNode("​")),y.parentNode.insertBefore(b,y.nextSibling),y.removeChild(y.lastChild),s(b.firstChild,b.textContent.length),void e.preventDefault()}}if(i(l,"LI")||i(l.parentNode,"LI"))return}}else if(t.startContainer===t.endContainer)for(var m=r.get(0);m.firstChild;)m.removeChild(m.firstChild);for(var w=l;w.nodeType!==Node.ELEMENT_NODE||-1!==o.indexOf(w.nodeName);)w=w.parentNode;if(l===r[0]){var M=d.$("<div></div>");d.$(r[0]).append(M),M.html("&#8203;"),w=M[0],l=M[0],t=s(l,1)}if(w===r[0]){for(var k=t.startOffset,L=d.$("<div></div>");r[0].childNodes.length;)d.$(L).append(r[0].childNodes[0]);d.$(w).append(L),w=L[0],t=s(l,k)}e.preventDefault();var x;w.nodeType===Node.ELEMENT_NODE&&p.indexOf(w.tagName)>=0?x=a(w):(x=document.createElement("div"),u(x,w)),x.removeAttribute("class");var Y=t.endOffset;if(l.nodeType===Node.TEXT_NODE){if(l.textContent=l.textContent.substring(0,t.startOffset),0===l.textContent.length){var T=f.findClosestBlockElement(l,r.get(0));T&&0!==T.textContent.length||(l.textContent="​")}}else for(var S=l.childNodes.length-t.startOffset;S>0;S--)l.removeChild(l.lastChild);for(var D,$=l,E=[];$!==w;){for(D=$;D=$.nextSibling;)$.parentNode.removeChild(D);D=$;for(var O=0;D=D.previousSibling;)O++;E.push(O),$=$.parentNode}for(0===$.textContent.length&&($.textContent="​"),D=x;E.length;){for(var j=E.pop(),O=0;O<j;O++)D.removeChild(D.firstChild);D=D.firstChild}var C;if(D.nodeType===Node.TEXT_NODE)Y===D.textContent.length?(D.textContent="​",C=D.textContent.length):(D.textContent=D.textContent.substring(Y,D.textContent.length),C=0);else for(var O=0;O<Y;O++)D.removeChild(D.firstChild);for(var A=D;A=c(A);)if(i(A,"A")){for(var P=document.createElement("span"),H=0,F=A.childNodes;H<F.length;H++){var I=F[H];P.appendChild(I)}A.parentNode.insertBefore(P,A.nextSibling),A.parentNode.removeChild(A)}if(w.parentNode.insertBefore(x,w.nextSibling),D.nodeType!==Node.TEXT_NODE){var N=h.findFirstChildTextNode(D);N?C="​"===N.textContent.charAt(0)?1:0:(N=document.createTextNode("​"),D.insertBefore(N,D.firstChild),C=D.textContent.length),D=N}s(D,C)}Object.defineProperty(t,"__esModule",{value:!0});var d=n(1),h=n(899),f=n(907),p=["DIV","LI"];t.isElementNodeWithName=i,t.toKebabCase=o,t.onPressEnter=l},function(e,t,n){"use strict";function r(e,t,n){var r=this;if(e.originalEvent.dataTransfer){var c="protected";"public"===t.visibility&&(c="public"),n.removeClass("droptarget");var l={},d=e.originalEvent.dataTransfer.files;if(d.length){e.preventDefault();var h,f=window.getSelection();if(document.caretRangeFromPoint)h=document.caretRangeFromPoint(e.originalEvent.clientX,e.originalEvent.clientY);else if(document.caretPositionFromPoint){var p=document.caretPositionFromPoint(e.originalEvent.clientX,e.originalEvent.clientY);h=document.createRange(),h.setStart(p.offsetNode,p.offset)}h&&(f.removeAllRanges(),f.addRange(h),t.selection.range=h,t.selection.rangeCount=1);for(var m="",_=d.length,v=function(e){return i(r,void 0,void 0,function(){var e,n,r;return o(this,function(i){switch(i.label){case 0:return e=d[y].name,n=new s.Document,[4,n.upload(d[y],c)];case 1:return i.sent(),_--,r="/workspace/document/","public"===c&&(r="/workspace/pub/document/"),-1!==e.indexOf(".mp3")||-1!==e.indexOf(".wav")||-1!==e.indexOf(".ogg")?(l=u.$('<audio controls preload="none"></audio>'),l.attr("src",r+n._id)):-1!==e.toLowerCase().indexOf(".png")||-1!==e.toLowerCase().indexOf(".jpg")||-1!==e.toLowerCase().indexOf(".jpeg")||-1!==e.toLowerCase().indexOf(".svg")?(l=u.$('<span contenteditable="false" class="image-container"><img /></span>'),l.children("img").attr("src",r+n._id+"?thumbnail=150x150")):l=u.$('<div class="download-attachments"><h2>'+a.idiom.translate("editor.attachment.title")+'</h2><div class="attachments"><a href="'+r+n._id+'"><div class="download"></div>'+e+"</a></div></div><div><br /><div><br /></div></div>"),m+="<div>"+l[0].outerHTML+"<div><br></div><div><br></div></div>",0===_&&t.selection.replaceHTML(m),[2]}})})},y=0;y<d.length;y++)!function(){v(d[y])}()}}}var i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(391),a=n(3),u=n(1);t.onDropFromDesktop=r},function(e,t,n){"use strict";function r(e){var t=[];return e.forEach(function(e){return t.push(e)}),t}function i(e){var t=[];return e.forEach(function(e,n){return t.push(n)}),t}Object.defineProperty(t,"__esModule",{value:!0});var o=n(551),s=n(3),a=n(390);t.navigationGuardService={debounceMs:1e3,_lastTime:null,_lastResponse:null,_listeners:new Map,_guards:new Map,_id_counter:0,onUserConfirmNavigate:new Array,generateID:function(){return"__auto_guard_id_"+t.navigationGuardService._id_counter++},_getGuardsMapByID:function(e){var n=t.navigationGuardService._guards.get(e);return null!=n?n:new Set},registerGuard:function(e,n){var r=t.navigationGuardService._getGuardsMapByID(e);r.add(n),t.navigationGuardService._guards.set(e,r)},unregisterGuard:function(e,n){var r=t.navigationGuardService._getGuardsMapByID(e);r.delete(n),0==r.size&&t.navigationGuardService.unregisterRoot(e)},unregisterRoot:function(e){t.navigationGuardService._guards.delete(e)},registerIndependantGuard:function(e){var n=t.navigationGuardService.generateID();return t.navigationGuardService.registerGuard(n,e),n},unregisterIndependantGuard:function(e){t.navigationGuardService.unregisterRoot(e)},registerListener:function(e){if(!t.navigationGuardService._listeners.has(e)){e.start();var n=e.onChange.subscribe(function(e){t.navigationGuardService.tryNavigate(e)});t.navigationGuardService._listeners.set(e,n)}},unregisterListener:function(e){var n=t.navigationGuardService._listeners.get(e);n&&(n.unsubscribe(),e.stop(),t.navigationGuardService._listeners.delete(e))},tryNavigate:function(e){var n=t.navigationGuardService._lastTime||0,o=(new Date).getTime(),a=o-n,u=t.navigationGuardService._lastResponse;if(null!=u&&a<t.navigationGuardService.debounceMs)return void(u?e.accept():e.reject());for(var c=e.confirmMessageKey||"navigation.guard.text",l=0,d=i(t.navigationGuardService._guards);l<d.length;l++){var h=d[l],f=t.navigationGuardService._guards.get(h);if(!e.checkGuardId||"*"===e.checkGuardId||e.checkGuardId===h)for(var p=0,m=r(f);p<m.length;p++){var _=m[p];if(!_.canNavigate()){for(var v=confirm(s.idiom.translate(c)),y=0,g=t.navigationGuardService.onUserConfirmNavigate;y<g.length;y++){var b=g[y];b(v)}return _.onUserConfirmNavigate&&_.onUserConfirmNavigate(v),t.navigationGuardService._lastTime=(new Date).getTime(),t.navigationGuardService._lastResponse=v,void(v?(e.accept(),t.navigationGuardService.resetAll()):e.reject())}}}e.accept()},reset:function(e){for(var n=r(t.navigationGuardService._getGuardsMapByID(e)),i=0,o=n;i<o.length;i++){o[i].reset()}},resetAll:function(){for(var e=0,n=i(t.navigationGuardService._guards);e<n.length;e++){var r=n[e];t.navigationGuardService.reset(r)}}};var u=function(){function e(e,t,n){void 0===n&&(n=function(e,t){return e==t}),this.currentValue=e,this.resetter=t,this.comparator=n,this.reset()}return e.prototype.unNaN=function(e){return"number"==typeof e&&1==isNaN(e)?null:e},e.prototype.reset=function(){this.reference=this.resetter()},e.prototype.canNavigate=function(){return this.comparator(this.unNaN(this.reference),this.unNaN(this.currentValue()))},e}();t.InputGuard=u;var c=function(){function e(e){this.currentValue=e}return e.prototype.reset=function(){this.currentValue().guardObjectReset()},e.prototype.canNavigate=function(){return!this.currentValue().guardObjectIsDirty()},e.prototype.onUserConfirmNavigate=function(e){var t=this.currentValue();t.guardOnUserConfirmNavigate&&t.guardOnUserConfirmNavigate(e)},e}();t.ObjectGuard=c;var l=function(){function e(e){this.$rootScope=e,this.subscription=null,this.onChange=new o.Subject;var n=this;e.$on("$destroy",function(){t.navigationGuardService.unregisterListener(n)})}return e.prototype.start=function(){var e=this;this.subscription||(this.subscription=this.$rootScope.$on("$locationChangeStart",function(t,n,r){e.onChange.next({accept:function(){},reject:function(){t.preventDefault()}})}))},e.prototype.stop=function(){this.subscription&&this.subscription(),this.subscription=null},e.getInstance=function(t){return null==e._instance&&(e._instance=new e(t)),e._instance},e._instance=null,e}();t.AngularJSRouteChangeListener=l;var d=function(){function e(){this.onChange=new o.Subject,this.boundCallback=null}return e.prototype.callback=function(){var e=null;return this.onChange.next({accept:function(){e=!0},reject:function(){event.preventDefault(),event.returnValue=!1,e=!1}}),e},e.prototype.start=function(){this.boundCallback=this.callback.bind(this),window.addEventListener("beforeunload",this.boundCallback,!1)},e.prototype.stop=function(){window.removeEventListener("beforeunload",this.boundCallback)},e.getInstance=function(){return null==e._instance&&(e._instance=new e),e._instance},e._instance=null,e}();t.DOMRouteChangeListener=d;var h=function(){function e(){this.onChange=new o.Subject,this.defaultTrigger=!0,this.containerNotTriggering=[],this.containerTriggering=[]}return e.prototype.start=function(){var e=this;a.template.setDelegate({tryOpen:function(t){e.tryOpen(t.name,t.success,t.reject)}})},e.prototype.stop=function(){a.template.removeDelegate()},e.prototype.setTriggerByDefault=function(e){this.defaultTrigger=e},e.prototype.triggerNavigation=function(e){for(var t=this.containerTriggering.length;t-- >0;)if(this.containerTriggering[t]==e)return!0;for(var t=this.containerNotTriggering.length;t-- >0;)if(this.containerNotTriggering[t]==e)return!1;return this.defaultTrigger},e.prototype.tryOpen=function(e,t,n){this.triggerNavigation(e)?this.onChange.next({accept:t,reject:n}):t()},e.prototype.addIgnoreContainer=function(e){this.containerNotTriggering.push(e)},e.prototype.removeIgnoreContainer=function(e){this.containerNotTriggering=this.containerNotTriggering.filter(function(t){return t!=e})},e.prototype.addTriggerContainer=function(e){this.containerTriggering.push(e)},e.prototype.removeTriggerContainer=function(e){this.containerTriggering=this.containerTriggering.filter(function(t){return t!=e})},e.getInstance=function(){return null==e._instance&&(e._instance=new e),e._instance},e._instance=null,e}();t.TemplateRouteChangeListener=h;var f=function(){function e(){this.onChange=new o.Subject}return e.prototype.start=function(){},e.prototype.stop=function(){this.onChange.unsubscribe()},e}();t.ManualChangeListener=f;var p=function(){function e(){this.onChange=new o.Subject}return e.prototype.start=function(){},e.prototype.stop=function(){this.onChange.unsubscribe()},e.prototype.stayOpen=function(){var e=this;return new Promise(function(t,n){e.onChange.next({accept:function(){t(!1)},reject:function(){t(!0)}})})},e}();t.LightboxChangeListener=p,window.entcore||(window.entcore={}),window.entcore.navigationGuardService=t.navigationGuardService,window.entcore.ObjectGuard=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(386),i=n(37),o=n(38),s=n(34),a=n(3),u=n(4);t.sniplets={load:function(){var e=this;return new Promise(function(t,n){if(e.sniplets.length)return void t(e.sniplets);var c=e;s.http().get("/resources-applications").done(function(e){i.model.me?(e=i.model.me.apps.filter(function(t){return u._.find(e,function(e){return-1!==t.address.indexOf(e)&&-1===t.icon.indexOf("/")})}),e.push({displayName:"directory",address:"/directory"})):e=[o.appPrefix,"workspace"];var n=e.length;e.forEach(function(e){var i=setTimeout(function(){0===--n&&t()},1e3),o=e.address?e.address.split("/")[1]:e;r.Behaviours.loadBehaviours(o,function(e){e.sniplets&&(c.sniplets=c.sniplets.concat(u._.map(e.sniplets,function(e,t){return{application:o,template:t,sniplet:e}})),a.idiom.addBundle("/"+o+"/i18n")),n--,clearTimeout(i),0===n&&t()}).error(function(){n--,0===n&&t(),clearTimeout(i)})})})})},sniplets:[]},window.entcore||(window.entcore={}),window.entcore.sniplets=t.sniplets},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this.name=e,this.contents=t}return e}();t.Controller=n;var r=function(){function e(e,t){if(this.name=e,this.contents=t,this.contents.templateUrl){var n=document.getElementById("context").getAttribute("src").split("-"),r=n[n.length-1].split(".")[0];this.contents.templateUrl+="?hash="+r}}return e}();t.Directive=r;var i=function(){function e(e,t){this.name=e,this.contents=t}return e}();t.Filter=i;var o=function(){function e(e,t){this.name=e,this.contents=t}return e}();t.Service=o;var s=function(){function e(e,t){this.name=e,this.contents=t}return e}();t.Provider=s;var a=function(){function e(e){this.contents=e}return e}();t.Config=a;var u=function(){function e(){this.controllers=[],this.directives=[],this.filters=[],this.services=[],this.providers=[],this.configs=[],this.requiredModules=[],this.cb=[]}return e.prototype.init=function(e){this.directives.forEach(function(t){e.directive(t.name,t.contents)}),this.controllers.forEach(function(t){e.controller(t.name,t.contents)}),this.filters.forEach(function(t){e.filter(t.name,t.contents)}),this.services.forEach(function(t){e.service(t.name,t.contents)}),this.providers.forEach(function(t){e.provider(t.name,t.contents)}),this.configs.forEach(function(t){e.config(t.contents)}),this.requiredModules.forEach(function(t){e.requires.push(t)}),this.cb.forEach(function(t){return t(e)})},e.prototype.directive=function(e,t){return new r(e,t)},e.prototype.service=function(e,t){return new o(e,t)},e.prototype.provider=function(e,t){return new s(e,t)},e.prototype.controller=function(e,t){return new n(e,t)},e.prototype.filter=function(e,t){return new i(e,t)},e.prototype.config=function(e){return new a(e)},e.prototype.addRequiredModule=function(e){this.requiredModules.push(e)},e.prototype.onInit=function(e){this.cb.push(e)},e}();t.Ng=u,t.ng=new u,window.entcore||(window.entcore={}),window.entcore.ng=t.ng},function(e,t,n){"use strict";function r(){s.model.makeModels(t.widgets),s.model.collection(t.widgets.Widget,{preferences:{},savePreferences:function(){var e=this;this.forEach(function(t){e.preferences[t.name].hide=t.hide,e.preferences[t.name].index=t.index}),c.http().putJson("/userbook/preference/widgets",this.preferences)},sync:function(){var e=this,t=s.model.me.widgets;c.http().get("/userbook/preference/widgets").done(function(n){return i(this,void 0,void 0,function(){var r,i;return o(this,function(o){switch(o.label){case 0:return n.preference?this.preferences=JSON.parse(n.preference):this.preferences={},[4,a.skin.listSkins().then(function(){var n="panda"==a.skin.skins.find(function(e){return e.child==a.skin.skin}).parent?h:d;t=t.filter(function(e){return!n.find(function(t){return t==e.name})}),t=t.map(function(t,n){return e.preferences[t.name]||(e.preferences[t.name]={index:n,show:!0}),t.index=e.preferences[t.name].index,t.hide=!t.mandatory&&e.preferences[t.name].hide,t}),t=t.sort(function(e,t){var n=l.idiom.translate("timeline.settings."+e.name).toLowerCase(),r=l.idiom.translate("timeline.settings."+t.name).toLowerCase();return n<r?-1:n>r?1:0})})];case 1:for(o.sent(),r=0;r<t.length;r++)i=t[r],function(t){t.i18n?l.idiom.addTranslations(t.i18n,function(){e.push(t),c.http().loadScript(t.js,void 0,{disableNotifications:!0})}):(e.push(t),c.http().loadScript(t.js,void 0,{disableNotifications:!0}))}(i);return[2]}})})}.bind(this))},findWidget:function(e){return this.findWhere({name:e})},apply:function(){s.model.trigger("widgets.change")}})}var i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(37),a=n(388),u=n(943),c=n(34),l=n(3),d=["birthday","mood","calendar-widget","notes"],h=["carnet-de-bord","my-apps","rss-widget","bookmark-widget","cursus-widget","maxicours-widget","school-widget"];t.widgets={Widget:function(){}},t.widgets.Widget.prototype.switchHide=function(){this.mandatory||(this.hide||(this.hide=!1),this.hide=!this.hide,this.trigger("change"),s.model.widgets.trigger("change"),s.model.widgets.savePreferences())};var f=u.ng.controller("Widgets",["$scope","model",function(e,t){t.widgets||(r(),t.widgets.sync()),e.widgets=t.widgets,e.allowedWidget=function(t){return!(e.list&&-1===e.list.indexOf(t.name)||t.hide)},t.on("widgets.change",function(){e.$$phase||e.$apply("widgets")}),e.translate=l.idiom.translate,e.switchHide=function(e,t){e.switchHide(),t.stopPropagation()}}]);u.ng.controllers.push(f)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=n(388);t.toasts={message:function(e,t){i.$(".toasts")[0]||i.$("body").append('<div class="toasts"></div>'),t=r.idiom.translate(t);var n=i.$(".toasts")[0],o='\n <div class="show vertical-spacing horizontal-spacing '+e+' toast-content">\n <div class="content">\n '+t+'\n </div>\n <div class="timer animate"></div>\n </div>\n ',s=i.$(o),a=s.appendTo(n);setTimeout(function(){return i.$(s).find(".timer").addClass("animation")},100),setTimeout(function(){return a.remove()},3100)},warning:function(e){this.message("warning",e)},info:function(e){this.message("info",e)},confirm:function(e){this.message("confirm",e)}},window.entcore||(window.entcore={}),window.entcore.toasts=t.toasts,window.toasts=t.toasts},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(7);t.embedderService={_providers:null,getProviders:function(){return r(this,void 0,void 0,function(){var e,n,r,s,a;return i(this,function(i){switch(i.label){case 0:return null!=t.embedderService._providers?[2,t.embedderService._providers]:[4,o.default.get("/infra/embed/default")];case 1:return e=i.sent().data,[4,o.default.get("/infra/embed/custom")];case 2:for(n=i.sent().data,r=0,s=n;r<s.length;r++)a=s[r],a.name=(a.name||"").toLowerCase().replace(/\ |\:|\?|#|%|\$|£|\^|\*|€|°|\(|\)|\[|\]|§|'|"|&|ç|ù|`|=|\+|<|@/g,"");return t.embedderService._providers=e.concat(n),[2,t.embedderService._providers]}})})},getHtmlForVideoStream:function(e,t){var n=e.metadata,r=void 0!==n.captation?'data-document-is-captation="'+n.captation+'"':"",i="number"==typeof n.width&&"number"==typeof n.height?n.width+"x"+n.height:null,o=i?'data-video-resolution="'+i+'"':"";return'<span contenteditable="false" class="image-container">\n &#8203;<video playsinline="true" controls controlsList="nodownload" class="render" src="/workspace'+("public"==t?"/pub":"")+"/document/"+e._id+'" data-document-id="'+e._id+'" '+r+" "+o+"></video>\n </span>&nbsp;&nbsp;"},getHtmlForVideoStreams:function(e,n){return e.map(function(e){return t.embedderService.getHtmlForVideoStream(e,n)}).join(" ")},getHtmlForUrl:function(e,n){return void 0===n&&(n=!1),r(this,void 0,void 0,function(){var r,o,s,a,u;return i(this,function(i){switch(i.label){case 0:return e&&e.trim().startsWith("<iframe")?[2,e]:[4,t.embedderService.getProviders()];case 1:for(r=i.sent(),o=0,s=r;o<s.length;o++)if(a=s[o],(u=t.embedderService.getHtmlForProvider(a,e))&&u.length>0)return[2,u];return n?[2,'<iframe width="560" height="315" src="'+e+'" frameborder="0" allowfullscreen></iframe>']:[2,""]}})})},getHtmlForProvider:function(e,t){for(var n=0,r=e.url;n<r.length;n++){var i=r[n],o=new RegExp("{[a-zA-Z0-9_.]+}","g"),s=i.match(o)||[],a=e.embed;s.splice(1,s.length);for(var u=0,c=s;u<c.length;u++){var l=c[u],d=i.split(l)[0],h=d.split("}");h.length>1&&(d=h[h.length-1]);var f=t.split(d)[1];if(f){var p=i.split(l)[1].split("{")[0];p&&(f=f.split(p)[0]);var m=new RegExp("\\"+l.replace(/}/,"\\}"),"g");return a.replace(m,f)}}}return""}},window.entcore||(window.entcore={}),window.entcore.embedderService=t.embedderService},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(948),i=function(){function e(){}return e.removeDiacritics=r.removeDiacritics,e}();t.StrUtils=i,window.entcore||(window.entcore={}),window.entcore.StrUtils=i},function(e,t){"use strict";function n(e){return e.replace(/[^\u0000-\u007E]/g,function(e){return i[e]||e})}Object.defineProperty(t,"__esModule",{value:!0});for(var r=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹÐ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"OE",letters:"ŒŒ"},{base:"oe",letters:"œœ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],i={},o=0;o<r.length;o++)for(var s=r[o].letters,a=0;a<s.length;a++)i[s[a]]=r[o].base;t.removeDiacritics=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(950),i=n(951),o=n(952);!function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(950));var s=n(951);t.Tracking=s.Tracking;var a=n(952);t.EditTrackingEvent=a.EditTrackingEvent,window.entcore||(window.entcore={}),window.entcore.tracking=r,window.entcore.trackingService=r.trackingService,window.entcore.Tracking=i.Tracking,window.entcore.EditTrackingEvent=o.EditTrackingEvent},function(e,t,n){"use strict";var r=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(7),a=n(951),u=n(953),c=n(954),l=function(e){function t(){var t=e.call(this)||this;return t.trackings=[],t}return r(t,e),t.prototype.doInit=function(e){return i(this,void 0,void 0,function(){var e,t,n,r,i,a,l;return o(this,function(o){switch(o.label){case 0:return[4,s.default.get("/analyticsConf")];case 1:for(e=o.sent(),t=e.data,n=[],t&&(t.matomo&&n.push({params:t.matomo,tracker:new u.TrackingMatomo}),t.internal&&n.push({params:t.internal,tracker:new c.TrackingInternal})),r=[],i=0,a=n;i<a.length;i++)l=a[i],r.push(l.tracker.init(l.params)),this.trackings.push(l.tracker);return[4,Promise.all(r)];case 2:return o.sent(),[2]}})})},t.prototype.trackPage=function(e,t){var n=this;this.onReady&&this.onReady.then(function(){for(var r=0,i=n.trackings;r<i.length;r++){i[r].trackPage(e,t)}})},t.prototype.saveOptIn=function(){var e=this;this.onReady&&this.onReady.then(function(){for(var t=0,n=e.trackings;t<n.length;t++){n[t].saveOptIn()}})},t.prototype.trackEvent=function(e){var t=this;this.onReady&&this.onReady.then(function(){for(var n=0,r=t.trackings;n<r.length;n++){r[n].trackEvent(e)}})},t.prototype.doTrackEvent=function(e){},t}(a.Tracking);t.TrackingDefault=l,t.trackingService=new l,t.trackingService.init(null)},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(37),s=n(952),a=function(){function e(){this.initStatus="void",this.disabled=!1}return Object.defineProperty(e.prototype,"isReady",{get:function(){return"ready"==this.initStatus},enumerable:!0,configurable:!0}),e.prototype.init=function(e){return r(this,void 0,void 0,function(){var t;return i(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),this.params=e||{trackOnly:[],detailApps:!1,doNotTrack:[]},this.onReady=this.doInit(e),this.initStatus="pending",[4,this.onReady];case 1:return n.sent(),this.initStatus="ready",[3,3];case 2:return t=n.sent(),this.initStatus="failed",console.debug("["+this.constructor.name+"] could not init ",t),[3,3];case 3:return[2]}})})},e.prototype.shouldTrackCurrentApp=function(){var e=this.params;if(e.doNotTrack)for(var t=this.getCurrentMatchingApps(),n=0,r=t;n<r.length;n++){var i=r[n];if(-1!==e.doNotTrack.indexOf(i.name))return!1}return!0},e.prototype.shouldTrackEvent=function(e){if(this.disabled)return!1;var t=this.params,n=this.getCurrentMatchingApps();if(t.trackOnly&&t.trackOnly.length>0){for(var r=0,i=n;r<i.length;r++){var o=i[r];if(-1!==t.trackOnly.indexOf(o.name+"."+e)||-1!==t.trackOnly.indexOf("*."+e))return!0}return!1}if(t.doNotTrack instanceof Array&&t.doNotTrack.length>0)for(var s=0,a=n;s<a.length;s++){var o=a[s];if(-1!==t.doNotTrack.indexOf(o.name+"."+e)||-1!==t.doNotTrack.indexOf("*."+e))return!1}return!0},e.prototype.trackEvent=function(e){var t=this;e.disabled||this.onReady&&this.onReady.then(function(){t.shouldTrackEvent(e.type)&&t.doTrackEvent(e)})},e.prototype.trackEdition=function(e){var t=this;return new s.EditTrackingEvent(e,function(e){t.trackEvent(e)})},e.prototype.getCurrentMatchingApps=function(){var e=[];if(o.model&&o.model.me&&o.model.me.apps instanceof Array)for(var t=0;t<o.model.me.apps.length;t++){var n=o.model.me.apps[t];n&&n.address&&n.name&&-1!==location.href.indexOf(n.address)&&e.push(n)}return e},e}();t.Tracking=a},function(e,t,n){"use strict";function r(){return"__new__"+o++}Object.defineProperty(t,"__esModule",{value:!0});var i=n(941),o=0,s=function(){function e(e,t){var n=this;this.pushEvent=t,this.status="void",this.disabled=!1;var o=window.location.pathname+window.location.hash;this.id=e.resourceId||r(),this.resourceUri=e.resourceUri||o,this.matomoResourceUri=window.location.pathname+"/"+this.id,i.navigationGuardService.onUserConfirmNavigate.push(function(e){e||n.onCancel()})}return e.prototype.onStart=function(e){if(e){if(["editing"].includes(this.status))return}this.startedAt=new Date,this.stoppedAt=null,this.pushEvent({type:"edit",matomo:{action:"start",resourceUri:this.matomoResourceUri},internal:{"event-type":"EDIT_START",resource_uri:this.resourceUri,resource_id:this.id}}),this.status="editing"},e.prototype.onStop=function(){if(!["saving"].includes(this.status)){this.stoppedAt=new Date,this.finishedAt=null;var e=this.startedAt?this.stoppedAt.getTime()-this.startedAt.getTime():null;this.pushEvent({type:"edit",matomo:{action:"stop",resourceUri:this.matomoResourceUri},internal:{"event-type":"EDIT_STOP",resource_uri:this.resourceUri,resource_id:this.id,duration:e}}),this.status="saving"}},e.prototype.onFinish=function(e,t){if(!["success","fail"].includes(this.status)){this.finishedAt=new Date,this.status=e?"success":"fail";var n=this.stoppedAt?this.finishedAt.getTime()-this.stoppedAt.getTime():null;this.pushEvent({type:"edit",matomo:{action:e?"success":"fail",resourceUri:this.matomoResourceUri},internal:{"event-type":"EDIT_FINISH",resource_uri:this.resourceUri,resource_id:this.id,duration:n,status:e?"success":"fail",status_code:t?t.code:null}})}},e.prototype.onCancel=function(){if(!["void","success","fail","cancel"].includes(this.status)){this.finishedAt=new Date,this.status="cancel";var e=this.stoppedAt?this.finishedAt.getTime()-this.stoppedAt.getTime():null;this.pushEvent({type:"edit",matomo:{action:"cancel",resourceUri:this.matomoResourceUri},internal:{"event-type":"EDIT_FINISH",resource_uri:this.resourceUri,resource_id:this.id,duration:e,status:"cancel",status_code:null}})}},e}();t.EditTrackingEvent=s},function(e,t,n){"use strict";var r=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(951),a=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.hasOptedIn=!1,t}return r(t,e),t.prototype.doInit=function(e){return i(this,void 0,void 0,function(){return o(this,function(e){try{return[2]}catch(e){throw console.error('[TrackingMatomo] Invalid tracker object. Should look like {"siteId": 99999, "url":"http://your.matomo.server.com/"}"',e),e}return[2]})})},t.prototype.trackPage=function(e,t){this.onReady&&this.onReady.then(function(){var n=window._paq||[];n.push(["setDocumentTitle",e]),n.push(["setCustomUrl",t]),n.push(["trackPageView"])})},t.prototype.saveOptIn=function(){var e=this;this.onReady&&this.onReady.then(function(){try{(window._paq||[]).push(e.hasOptedIn?["forgetUserOptOut"]:["optUserOut"])}catch(e){console.debug("[TrackingMatomo] could not saveOptIn: ",e)}})},t.prototype.doTrackEvent=function(e){try{var t=["trackEvent",e.type];if(e.matomo){var n=e.matomo;n.action&&t.push(n.action),n.resourceUri&&t.push(n.resourceUri),n.value&&t.push(n.value)}(window._paq||[]).push(t)}catch(e){console.debug("[TrackingMatomo] could not trackEvent: ",e)}},t}(s.Tracking);t.TrackingMatomo=a},function(e,t,n){"use strict";var r=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(7),a=n(37),u=n(951),c={ENSEIGNANT:"Teacher",ELEVE:"Student",PERSRELELEVE:"Relative",SUPERADMIN:"SuperAdmin",PERSEDUCNAT:"Personnel"},l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.doInit=function(){return i(this,void 0,void 0,function(){return o(this,function(e){return[2]})})},t.prototype.trackPage=function(e,t){},t.prototype.saveOptIn=function(){},t.prototype.doTrackEvent=function(e){try{var t=this.getCurrentMatchingApps(),n=c[a.model.me.type]||a.model.me.type,r={"event-type":e.type,userId:a.model.me.userId,profil:n,"resource-type":e.resourceType,date:(e.date||new Date).getTime(),ua:navigator.userAgent};if(t.length&&(r.module=t[0].name),e.internal)for(var i in e.internal)r[i]=e.internal[i];s.default.post("/infra/event/web/store",r).catch(function(e){console.debug("[TrackingInternal] failed to trackEvent: ",e)})}catch(e){console.debug("[TrackingInternal] failed to trackEvent: ",e)}},t}(u.Tracking);t.TrackingInternal=l},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(956)),r(n(958)),r(n(957)),r(n(959))},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},o=this;Object.defineProperty(t,"__esModule",{value:!0});var s=n(390),a=n(35),u=n(943),c=n(957),l=n(38),d=n(937),h=n(34),f=n(3),p=function(){function e(){this.hasRecorded=!1}return e.prototype.guardObjectIsDirty=function(){return this.hasRecorded},e.prototype.guardObjectReset=function(){this.hasRecorded=!1},e}();t.VideoRecordGuardModel=p,u.ng.controllers.push(u.ng.controller("VideoController",["$scope","model","route","$element","VideoUploadService",function(e,t,n,u,m){e.hasRight=!0,e.recordGuard=new p,e.recordMaxTime=3,m.initialize().then(function(){e.recordMaxTime=m.maxDuration}),e.template=s.template,e.me=t.me,e.recorder=new c.VideoRecorder(function(){return jQuery(u).find("video")[0]},function(e){k(e)});var _=!1,v=e.recorder.onPlayChanged.subscribe(function(e){_="play"==e.type,b()});e.display={},e.authorized=!1,e.videoState="idle",e.videofile={},e.action="videorecorder",e.notFound=!1,e.currentDuration=0,e.recordStartTime=0,e.recordTime="00:00",e.recordTimeInMs=0;var y={deviceId:"environment",label:f.idiom.translate("video.back.camera"),groupId:"",kind:"videoinput"},g={deviceId:"user",label:f.idiom.translate("video.front.camera"),groupId:"",kind:"videoinput"};Promise.resolve().then(function(){return navigator.mediaDevices.enumerateDevices()}).then(function(e){return e.filter(function(e){return"videoinput"===e.kind})}).then(function(t){switch(l.deviceType){case"Mobile":case"Tablet":t&&t.length>1?e.videoInputDevices=[y,g]:e.videoInputDevices=[y];break;default:e.videoInputDevices=t}e.selectedVid=e.videoInputDevices[0],D()}).catch(function(){console.error("[VideoController.videoInputDevices] An error occured while detecting cameras."),e.videoInputDevices=[y],e.selectedVid=e.videoInputDevices[0],D()}),e.switchCamera=function(t){e.recorder.switchCamera(t.deviceId)},e.$on("$destroy",function(){T()}),e.$on("releaseVideo",function(){T()}),e.$on("displayVideoRecorder",function(){D()}),s.template.open("video","videorecorder");var b=function(t){try{var n=e.$root&&e.$root.$$phase;"$apply"==n||"$digest"==n?t&&"function"==typeof t&&t():e.$apply(t)}catch(e){}},w=0,M=0,k=function(t){if(e.currentDuration=t.timeStamp,"recording"==e.videoState){var n=t.timeStamp-e.recordStartTime;M=n,x(n+w)}},L=function(e,t){var n=new Date;n.setTime(n.getTime()+24*t*60*60*1e3);var r="expires="+n.toUTCString();document.cookie="camera-auth="+e+";"+r},x=function(t){t>6e4*e.recordMaxTime?e.stopRecord():(e.recordTime=Y(t),e.recordTimeInMs=t,b())},Y=function(t){t=(t-t%1e3)/1e3;var n=t%60;t=(t-n)/60;var r=t%60;return e.pad(r)+":"+e.pad(n)},T=function(){v.unsubscribe(),e.recorder.stopStreaming(),e.videoState="idle"},S=function(t){return r(o,void 0,void 0,function(){var n;return i(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),e.recordTime=Y(0),e.recordTimeInMs=0,e.videoState="starting",b(),[4,e.recorder.startStreaming(t)];case 1:return r.sent(),[4,e.switchCamera(e.selectedVid)];case 2:return r.sent(),e.videoState="ready",[3,4];case 3:return n=r.sent(),console.error("[VideoController.showCamera] Failed to start:",n),e.videoState="idle",[3,4];case 4:return b(),[2]}})})},D=function(){return r(o,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,d.Me.hasWorkflowRight("video.capture")];case 1:return t.sent()?e.isIncompatibleBrowser()||e.isIncompatibleDevice()?(e.videoState="incompatible",b(),console.warn("[VideoController.tryStartStreaming] browser incompatible:",browser),[2]):"idle"!=e.videoState?(console.warn("[VideoController.tryStartStreaming] already start"),[2]):(S(function(){e.videoState="idle"}),[2]):(console.warn("[VideoController] missing workflow right video.capture"),e.hasRight=!1,b(),[2])}})})};e.startCamera=function(){L(!0,30),S()},e.canPlay=function(){return!e.isPlaying()&&e.isRecorded()},e.isUploading=function(){return"uploading"==e.videoState},e.isPlaying=function(){return _},e.isIncompatibleDevice=function(){var e=l.devices.getOSInfo();return!(e&&"iOS"===e.name&&e.version>="14.3")&&(l.devices.isIphone()||l.devices.isIpad()||l.devices.isIpod())},e.isIncompatibleBrowser=function(){if(!window.MediaRecorder)return!0;var e=l.devices.getBrowserInfo();return-1===["Firefox","Chrome","Edge","Opera","Safari","CriOS","FxiOS"].findIndex(function(t){return e.name==t})},e.isReplayAllowed=function(){var e=l.devices.getOSInfo();return!(e&&("iOS"===e.name||"Mac OS"===e.name))},e.isIncompatible=function(){return"incompatible"==e.videoState},e.isReady=function(){return"ready"==e.videoState},e.isCameraVisible=function(){return"ready"==e.videoState||"recording"==e.videoState||"recorded"==e.videoState||"uploading"==e.videoState},e.showActions=function(){return"recording"==e.videoState||"recorded"==e.videoState||"uploading"==e.videoState},e.isRecording=function(){return"recording"==e.videoState},e.isRecorded=function(){return"recorded"==e.videoState},e.startRecord=function(t){return void 0===t&&(t=!1),r(o,void 0,void 0,function(){return i(this,function(n){return e.recorder.canStartRecording(function(n){n?(e.recordStartTime=e.currentDuration,w=t?M:0,M=0,e.videoState="recording",t?e.recorder.resume():(e.recorder.startRecording(),e.recordGuard.hasRecorded=!0)):a.notify.error("video.file.too.large"),b()}),[2]})})},e.stopRecord=function(t){void 0===t&&(t=!1),e.videoState="recorded",t?e.recorder.pause(!0):e.recorder.stopRecording(!0),b()},e.switchVideoRecord=function(){e.isRecording()?e.stopRecord():e.startRecord(),e.isRecorded()&&e.redo()},e.switchRecording=function(){"recorded"==e.videoState?e.startRecord(!1):e.stopRecord(!1)},e.play=function(){e.recorder.play()},e.redo=function(){e.recordGuard.guardObjectReset(),e.videoState="ready",_=!1,e.currentDuration=0,e.recordTime="00:00",e.recordTimeInMs=0,e.recorder.clearBuffer(!0),b(),e.$emit("video-redo")},e.upload=function(){e.videoState="uploading",e.videofile={},e.videofile.name="Capture Vidéo "+(new Date).toLocaleDateString("fr-FR"),b(),Promise.resolve().then(function(){var t=e.videofile.name,n=Math.round(e.recordTimeInMs);return t||(t="video-"+e.recorder.generateVideoId()),m.upload(e.recorder.getBuffer(),t,!0,n)}).then(function(e){if(!e||e.data&&"error"===e.data.state)throw e&&e.data&&e.data.code||null;return e}).then(function(t){e.recordGuard.guardObjectReset(),a.notify.success("video.file.saved"),t.data&&e.$emit("video-upload",t.data.videoid);var n=l.devices.getBrowserInfo(),r={videoId:t.data.videoworkspaceid,userId:e.me.userId,userProfile:e.me.profiles[0],device:l.deviceType,browser:n.name+" "+n.version,structure:e.me.structureNames[0],level:e.me.level,duration:Math.round(e.recordTimeInMs),weight:t.data.videosize,captation:!0,url:window.location.hostname,app:l.appPrefix};h.http().postJson("/video/event/save",r).done(function(e){}),e.videoState="recorded",e.recorder.turnOffCamera(),b()}).catch(function(t){t=t||"video.file.error",a.notify.error(t),e.videoState="recorded",e.recorder.turnOffCamera(),b()})},e.pad=function(e){return(""+e).length>=2?e+"":("0"+new Array(2).join("0")+e).slice(-2)},e.openMainPage=function(){delete e.website,delete e.selectedWebsite,e.action="videorecorder",s.template.open("video","videorecorder"),window.location.hash=""}}]))},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(34),s=n(551),a=n(37),u=function(){function e(e,t){var n=this;this.videoFactory=e,this.handleDuration=t,this.mode="idle",this.constraints={audio:!0,video:{width:640,height:360,facingMode:"environment"}},this.onPlayChanged=new s.Subject,this.videoPausePlayHandler=function(e){n.onPlayChanged.next(e)}}return e.isCompatible=function(){if(navigator.mediaDevices&&"function"==typeof navigator.mediaDevices.getSupportedConstraints){return navigator.mediaDevices.getSupportedConstraints().deviceId||!1}return!1},e.prototype.bindPlayEvents=function(){this.gumVideo&&(this.unbindPlayEvents(),this.gumVideo.addEventListener("play",this.videoPausePlayHandler,!1),this.gumVideo.addEventListener("pause",this.videoPausePlayHandler,!1))},e.prototype.unbindPlayEvents=function(){this.gumVideo&&(this.gumVideo.removeEventListener("play",this.videoPausePlayHandler,!1),this.gumVideo.removeEventListener("pause",this.videoPausePlayHandler,!1))},e.prototype.unbindRecordEvent=function(){this.gumVideo&&this.gumVideo.removeEventListener("timeupdate",this.handleDuration)},e.prototype.bindRecordEvent=function(){this.gumVideo&&(this.unbindRecordEvent(),this.gumVideo.addEventListener("timeupdate",this.handleDuration))},e.prototype.switchCamera=function(e){return r(this,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return"environment"===e||"user"===e?(delete this.constraints.video.deviceId,this.constraints.video.facingMode=e):e&&(delete this.constraints.video.facingMode,this.constraints.video.deviceId=e),this.stopStreaming(),[4,this.startStreaming()];case 1:return t.sent(),[2]}})})},e.prototype.play=function(){if(!this.gumVideo)return void console.warn("[VideoRecorder.play] stream not init");"playing"==this.mode?(this.gumVideo.pause(),this.mode="play"):(this.preparePlay(),this.gumVideo.play(),this.mode="playing")},e.prototype.preparePlay=function(){if("play"!=this.mode){this.unbindRecordEvent(),this.bindPlayEvents();var e=this.getBuffer();this.gumVideo.muted=!1,this.gumVideo.src=null,this.gumVideo.srcObject=null,this.gumVideo.autoplay=!1,this.gumVideo.src=window.URL.createObjectURL(e),this.gumVideo.controls=!0,this.mode="play"}},e.prototype.prepareRecord=function(){if(!this.stream)return void console.warn("[VideoRecorder.prepareRecord] stream not init");"record"!=this.mode&&(this.gumVideo.muted=!0,this.gumVideo.volume=1,this.gumVideo.src=null,this.gumVideo.srcObject=null,this.gumVideo.autoplay=!0,this.gumVideo.srcObject=this.stream,this.gumVideo.controls=!1,this.unbindPlayEvents(),this.bindRecordEvent(),this.mode="record")},e.prototype.stopStreaming=function(){if(this.gumVideo&&(this.unbindPlayEvents(),this.unbindRecordEvent()),this.stream){try{this.stopRecording(!1)}catch(e){}this.turnOffCamera(),this.stream=void 0}this.gumVideo=void 0,this.mode="idle"},e.prototype.startStreaming=function(e){return r(this,void 0,void 0,function(){var t,n,t,r;return i(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,10]),this.stream?[2]:[4,navigator.mediaDevices.getUserMedia(this.constraints)];case 1:return t=i.sent(),this.gumVideo||(this.gumVideo=this.videoFactory()),this.stream=t,this.prepareRecord(),[3,10];case 2:return n=i.sent(),n?"NotAllowedError"!=n.name?[3,3]:e?[2,e()]:[3,8]:[3,9];case 3:if("NotReadableError"!=n.name)return[3,8];i.label=4;case 4:return i.trys.push([4,6,,7]),[4,navigator.mediaDevices.getUserMedia({})];case 5:return t=i.sent(),this.gumVideo||(this.gumVideo=this.videoFactory()),this.stream=t,this.prepareRecord(),[3,7];case 6:return r=i.sent(),alert(r),[3,7];case 7:return[2];case 8:alert(n),i.label=9;case 9:return[3,10];case 10:return[2]}})})},e.prototype.generateVideoId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})},e.prototype.resume=function(){this.prepareRecord(),this.mediaRecorder.resume()},e.prototype.canStartRecording=function(e){return r(this,void 0,void 0,function(){return i(this,function(t){return o.http().get("/workspace/quota/user/"+a.model.me.userId).done(function(t){var n=t.quota>t.storage;e(n)}).error(function(t){e(!1)}),[2]})})},e.prototype.startRecording=function(){return r(this,void 0,void 0,function(){var e,t;return i(this,function(n){switch(n.label){case 0:return[4,this.startStreaming()];case 1:n.sent(),this.prepareRecord(),this.recorded=new Array,e=this,t={mimeType:"video/webm;codecs=vp9"},MediaRecorder.isTypeSupported?MediaRecorder.isTypeSupported(t.mimeType)||(console.error("[VideoRecorder.startRecording] "+t.mimeType+" is not Supported"),t={mimeType:'video/mp4; codecs="avc1.424028, mp4a.40.2"'},MediaRecorder.isTypeSupported(t.mimeType)||(console.error("[VideoRecorder.startRecording] "+t.mimeType+" is not Supported"),t={mimeType:"video/webm;codecs=vp8,opus"},MediaRecorder.isTypeSupported(t.mimeType)||(console.error("[VideoRecorder.startRecording] "+t.mimeType+" is not Supported"),t={mimeType:"video/webm"},MediaRecorder.isTypeSupported(t.mimeType)||(console.error("[VideoRecorder.startRecording] "+t.mimeType+" is not Supported"),t={mimeType:"video/ogg"})))):t={mimeType:"video/webm;codecs=vp8,opus"};try{this.mediaRecorder=new MediaRecorder(this.stream,t),this.recordMimeType=t.mimeType}catch(e){return console.error("[VideoRecorder.startRecording] Exception while creating MediaRecorder:",e),[2]}return this.mediaRecorder.onstop=function(e){},this.mediaRecorder.ondataavailable=function(t){t.data&&t.data.size>0&&e.recorded.push(t.data)},this.mediaRecorder.start(1e3),[2]}})})},e.prototype.pause=function(e){this.mediaRecorder.pause(),e&&this.preparePlay()},e.prototype.stopRecording=function(e){var t=this;this.mediaRecorder.requestData(),this.mediaRecorder.stop(),e&&setTimeout(function(){return t.preparePlay()},0)},e.prototype.turnOffCamera=function(){if(this.stream)for(var e=this.stream.getTracks(),t=0,n=e;t<n.length;t++){var r=n[t];try{r.stop()}catch(e){}}},e.prototype.getBuffer=function(){return new Blob(this.recorded,{type:this.recordMimeType})},e.prototype.clearBuffer=function(e){this.recorded=null,e&&this.prepareRecord()},e}();t.VideoRecorder=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(38),i=n(34),o=n(943),s=function(){function e(){this.cleanup=[]}return e.asFormData=function(){var e=new FormData,t=r.devices.getBrowserInfo();return e.append("device",r.deviceType),e.append("browser",t.name+" "+t.version),e.append("url",window.location.hostname),e.append("app",r.appPrefix),e},e.prototype.generateEvent=function(e,t,n){var o=r.devices.getBrowserInfo(),s={videoId:t,device:r.deviceType,browser:o.name+" "+o.version,session:"",source:n,duration:0,url:window.location.hostname,app:r.appPrefix};i.http().postJson("/video/event/"+e,s).done(function(e){console.log(e)})},e.prototype.onPlay=function(e){var t=e.target,n=this.cleanup.find(function(e){return e.elem===t&&!e.wasPlayed});if(n&&!n.wasPlayed){n.wasPlayed=!0;var r=t.dataset.documentId||"",i="true"==(t.dataset.documentIsCaptation||"false")?"CAPTURED":"UPLOADED";this.generateEvent("play",r,i)}},e.prototype.generateViewEventFor=function(e){var t=e.dataset.documentId||"",n="true"==(e.dataset.documentIsCaptation||"false")?"CAPTURED":"UPLOADED";this.generateEvent("view",t,n)},e.prototype.trackOne=function(e){var t=this;if(e){var n=function(e){t.onPlay(e)};e.addEventListener("play",n),this.cleanup.push({elem:e,wasPlayed:!1,cb:n}),e.setAttribute("controlsList","nodownload"),this.generateViewEventFor(e)}},e.prototype.untrackOne=function(e){if(e)for(var t=this.cleanup.length-1;t>=0;t--){var n=this.cleanup[t];n&&n.elem===e&&n.cb&&(n.elem.removeEventListener("play",n.cb),this.cleanup.splice(t,1))}},e.prototype.trackAll=function(e){for(var t=this,n=document.querySelectorAll("video[data-document-is-captation]"),r=0;n&&r<n.length;r++){var i=n[r];this.trackOne(i)}e&&e.$on("$destroy",function(){t.untrackAll()})},e.prototype.untrackAll=function(){this.cleanup.forEach(function(e){e&&e.elem&&e.cb&&e.elem.removeEventListener("play",e.cb)}),this.cleanup=[]},e}();t.VideoEventTrackerService=s,o.ng.services.push(o.ng.service("VideoEventTrackerService",[s]))},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),s=n(943),a=n(958),u=function(){function e(){this._maxWeight=50,this._maxDuration=3,this._acceptVideoUploadExtensions=["MP4","MOV","AVI"],this._initialized=!1}return Object.defineProperty(e.prototype,"maxWeight",{get:function(){return this._maxWeight},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxDuration",{get:function(){return this._maxDuration},enumerable:!0,configurable:!0}),e.prototype.safeValueOf=function(e,t,n){try{var r=parseInt(e[t]);return"number"!=typeof r||isNaN(r)?n:r}catch(e){return n}},e.prototype.initialize=function(){return r(this,void 0,void 0,function(){var e=this;return i(this,function(t){switch(t.label){case 0:if(this._initialized)return[2];t.label=1;case 1:return t.trys.push([1,,3,4]),[4,o.default.get("/video/conf/public").then(function(t){e._maxWeight=e.safeValueOf(t.data,"max-videosize-mbytes",e._maxWeight),e._maxDuration=e.safeValueOf(t.data,"max-videoduration-minutes",e._maxDuration);var n=t.data["accept-videoupload-extensions"];n&&("string"==typeof n&&(n=[n]),e._acceptVideoUploadExtensions=n||e._acceptVideoUploadExtensions,e._acceptVideoUploadExtensions=e._acceptVideoUploadExtensions.map(function(e){return e.toUpperCase()}))})];case 2:return t.sent(),[3,4];case 3:return this._initialized=!0,[7];case 4:return[2]}})})},e.prototype.getValidExtensions=function(){return this._acceptVideoUploadExtensions},e.prototype.checkValidExtension=function(e){return e=e.toUpperCase(),-1!==this._acceptVideoUploadExtensions.findIndex(function(t){return e===t})},e.prototype.upload=function(e,t,n,s){return r(this,void 0,void 0,function(){var r,u,c,l,d,h,f;return i(this,function(i){switch(i.label){case 0:if(!e)throw new Error("Invalid video file.");if(!t)throw new Error("Invalid video filename.");return r="/video/encode?captation="+n,u=a.VideoEventTrackerService.asFormData(),u.append("file",e,t),u.append("weight",""+e.size),u.append("captation",""+n),s&&(u.append("duration",""+s),r+="&duration="+s),[4,o.default.post(r,u)];case 1:if(c=i.sent(),202!=c.status)return[3,6];l=c.data.processid,console.log("[VideoUploadService] start fetching status for :",l,c.data),d=c.status,h=null,f=1,i.label=2;case 2:return 202!=d?[3,5]:[4,o.default.get("/video/status/"+l)];case 3:return h=i.sent(),d=h.status,[4,new Promise(function(e){return setTimeout(e,1e3*f)})];case 4:return i.sent(),f=Math.min(15,2*f),[3,2];case 5:if(201==d)return[2,h];i.label=6;case 6:throw new Error("Video cannot be uploaded.")}})})},e}();t.VideoUploadService=u,s.ng.services.push(s.ng.service("VideoUploadService",[u]))},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(961)),r(n(963)),r(n(964)),r(n(965)),r(n(966)),r(n(967)),r(n(968)),r(n(969)),r(n(970)),r(n(971)),r(n(972)),r(n(973)),r(n(974)),r(n(975)),r(n(976)),r(n(977)),r(n(978)),r(n(979)),r(n(980)),r(n(981)),r(n(982)),r(n(983)),r(n(984)),r(n(985)),r(n(986)),r(n(987)),r(n(996)),r(n(997)),r(n(998)),r(n(999)),r(n(1e3)),r(n(1001)),r(n(1002)),r(n(1003)),r(n(1004)),r(n(1005)),r(n(1006)),r(n(1007)),r(n(1008)),r(n(1009)),r(n(1010)),r(n(1011)),r(n(1013)),r(n(1014)),r(n(1015)),r(n(1016)),r(n(1017)),r(n(1018)),r(n(1019)),r(n(1020)),r(n(1021)),r(n(1022)),r(n(1023)),r(n(1024)),r(n(1025)),r(n(1026)),r(n(1027)),r(n(1028)),r(n(1029)),r(n(1030)),r(n(1031)),r(n(1034)),r(n(1038)),r(n(1040)),r(n(1041)),r(n(1044)),r(n(1045)),r(n(1046))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(962),o=n(6),s=n(1);t.assistant=r.ng.directive("assistant",function(){return{restrict:"E",scope:{app:"="},templateUrl:"/infra/public/template/assistant.html",link:function(e,t,n){if(!(s.$(window).width()<=o.ui.breakpoints.fatMobile)){e.show={assistant:!1};var r,a=function(){s.$(".pulsar-button").addClass("hidden"),r=setTimeout(a,50)};e.app&&(i.quickstart.app=e.app,i.quickstart.prefName+=e.app.charAt(0).toUpperCase()+e.app.slice(1)),i.quickstart.load(function(){-1!==i.quickstart.state.assistant&&0!==i.quickstart.mySteps.length&&(a(),e.show.assistant=!0,e.currentStep=i.quickstart.assistantIndex,e.steps=i.quickstart.mySteps,e.$apply())}),e.goTo=function(t){i.quickstart.goTo(t.index),e.currentStep=i.quickstart.assistantIndex},e.next=function(){i.quickstart.nextAssistantStep(),e.currentStep=i.quickstart.assistantIndex,i.quickstart.assistantIndex||(e.show.assistant=!1,s.$(".pulsar-button").removeClass("hidden"),clearTimeout(r))},e.previous=function(){i.quickstart.previousAssistantStep(),e.currentStep=i.quickstart.assistantIndex},e.seeLater=function(){e.show.assistant=!1,s.$(".pulsar-button").removeClass("hidden"),clearTimeout(r),i.quickstart.seeAssistantLater()},e.closeAssistant=function(){e.show.assistant=!1,s.$(".pulsar-button").removeClass("hidden"),clearTimeout(r),i.quickstart.state.assistant=-1,i.quickstart.save()}}}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(37),i=n(33),o=n(34),s=n(916);t.quickstart={steps:{},state:{},types:{ENSEIGNANT:"teacher",ELEVE:"student",PERSEDUCNAT:"personnel",PERSRELELEVE:"relative"},mySteps:[],assistantIndex:{},app:"",prefName:"quickstart",assistantStep:function(e){return i.skin.basePath+"template/assistant/"+(this.app?this.app+"/":"")+this.types[r.model.me.type]+"/"+e+".html"},nextAssistantStep:function(){this.state.assistant++,this.state.assistant===this.steps[this.types[r.model.me.type]]?(this.state.assistant=-1,this.assistantIndex=void 0):this.assistantIndex=this.mySteps[this.state.assistant],this.save()},seeAssistantLater:function(){this.state.assistantTimer=s.moment().format("MM/DD/YYYY HH:mm"),this.save()},nextAppStep:function(){return this.state[i.skin.skin][this.app]++,this.save(),this.state[i.skin.skin][this.app]},previousAppStep:function(){return this.state[i.skin.skin][this.app]--,this.save(),this.state[i.skin.skin][this.app]},goToAppStep:function(e){return this.state[i.skin.skin][this.app]=e,this.save(),e},closeApp:function(){this.state[i.skin.skin][this.app]=-1,this.save()},appIndex:function(){return this.app=window.location.href.split("//")[1].split("/").slice(1).join("/"),this.state[i.skin.skin]||(this.state[i.skin.skin]={}),this.state[i.skin.skin][this.app]||(this.state[i.skin.skin][this.app]=0),this.state[i.skin.skin][this.app]},previousAssistantStep:function(){this.state.assistant--,this.state.assistant<0&&(this.state.assistant=0),this.assistantIndex=this.mySteps[this.state.assistant],this.save()},save:function(e){o.http().putJson("/userbook/preference/"+this.prefName,this.state).done(function(){"function"==typeof e&&e()})},goTo:function(e){e>this.mySteps.length&&(e=-1),this.state.assistant=e,-1!==e&&(this.assistantIndex=this.mySteps[e]),this.save()},loaded:!1,awaiters:[],load:function(e){if(this.loaded)return void("function"==typeof e&&e());this.awaiters.push(e),this.loading||(this.loading=!0,o.http().get("/userbook/preference/"+this.prefName).done(function(e){var t;if(e.preference)try{t=JSON.parse(e.preference)}catch(e){console.log("Error parsing quickstart preferences")}t||(t={}),t.assistant||(t.assistant=0),t[i.skin.skin]||(t[i.skin.skin]={}),this.state=t,-1===t.assistant||t.assistantTimer&&s.moment(t.assistantTimer).year()===s.moment().year()&&s.moment(t.assistantTimer).dayOfYear()===s.moment().dayOfYear()&&s.moment(t.assistantTimer).hour()===s.moment().hour()?(this.loaded=!0,this.awaiters.forEach(function(e){"function"==typeof e&&e()})):o.http().get(i.skin.basePath+"template/assistant/"+(this.app?this.app+"/":"")+"steps.json").done(function(e){this.steps=e;for(var t=this.steps[this.types[r.model.me.type]],n=0;n<t;n++)this.mySteps.push({index:n,path:this.assistantStep(n)}),this.assistantIndex=this.mySteps[this.state.assistant];this.loaded=!0,this.awaiters.forEach(function(e){"function"==typeof e&&e()})}.bind(this))}.bind(this)))}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(1),o=n(4),s=n(3);t.autocomplete=r.ng.directive("autocomplete",["$timeout",function(e){return{restrict:"E",replace:!0,scope:{options:"&",ngModel:"=",ngChange:"&",search:"=?",placeholder:"@?"},template:'\n <div class="row">\n <input type="text" class="twelve cell" ng-model="search" i18n-placeholder="{{placeholder||\'search\'}}" autocomplete="off" />\n <div data-drop-down class="drop-down">\n <div>\n <ul class="ten cell right-magnet">\n <li class="block-container" ng-repeat="option in match | limitTo:limit" ng-model="option">\n <a class="cell right-spacing" ng-class="{\'sharebookmark\': option.type === \'sharebookmark\'}">\n <i class="add-favorite cell" ng-if="option.type === \'sharebookmark\'"></i>\n [[option.toString()]]\n </a>\n <em ng-if="option.structureName" class="top-spacing-twice low-importance">[[option.structureName]]</em>\n <em class="top-spacing-twice low-importance">[[translate(option.profile)]] </em>\n </li>\n <li class="display-more block-container" ng-show="limit < match.length" ng-click="increaseLimit()">[[translate(\'seemore\')]]</li>\n </ul>\n </div>\n </div>\n </div>\n ',link:function(t,n,r){var a;if("off"!==r.autocomplete){var u=n.find("[data-drop-down]"),c=n.find("input");t.search="",t.translate=s.idiom.translate,t.limit=6,t.match=[],t.increaseLimit=function(){t.limit+=5,e(function(){t.setDropDownHeight()})},t.setDropDownHeight=function(){var e=0,n=Math.min(t.limit,t.match.length);u.find("li").each(function(t,r){return e+=i.$(r).offsetHeight,t<n}),u.height(e)};var l=function(){if(!t.match||0===t.match.length)return u.height(),u.addClass("hidden"),t.limit=6,void u.attr("style","");var e=c.offset(),n=c.width()+parseInt(c.css("padding-right"))+parseInt(c.css("padding-left"))+2*parseInt(c.css("border-width")||1),r=c.height()+parseInt(c.css("padding-top"))+parseInt(c.css("padding-bottom"))+2*parseInt(c.css("border-height")||1);e.top=e.top+r,u.offset(e),u.width(n),t.setDropDownHeight(),setTimeout(function(){t.setDropDownHeight()},100),a=requestAnimationFrame(l)};t.$watch("search",function(e){return e?(t.match=o._.filter(t.options(),function(t){var n=e.split(" ");return void 0===o._.find(n,function(e){var n=s.idiom.removeAccents(t.toString()).toLowerCase(),r=s.idiom.removeAccents(e).toLowerCase();return-1===n.indexOf(r)})}),t.match&&0!==t.match.length?(u.removeClass("hidden"),cancelAnimationFrame(a),void l()):(u.height(""),t.limit=6,void u.addClass("hidden"))):(t.match=[],u.height(""),void u.addClass("hidden"))}),n.parent().on("remove",function(){cancelAnimationFrame(a),u.remove()}),t.$on("$destroy",function(){cancelAnimationFrame(a),u.remove()}),u.detach().appendTo("body"),u.on("click","li",function(e){i.$(e.target).hasClass("display-more")||(t.limit=6,u.attr("style",""),t.ngModel=i.$(this).scope().option,t.search="",t.$apply("ngModel"),t.$eval(t.ngChange),t.$apply("ngModel"),u.addClass("hidden"),cancelAnimationFrame(a))});var d=function(e){n.find(e.target).length>0||u.find(e.target).length>0||(t.match=[],t.$apply())};i.$("body").on("click",d),u.attr("data-opened-drop-down",!0)}}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943);t.autosize=r.ng.directive("autosize",["$compile",function(e){return{restrict:"A",link:function(e,t,n){var r=function(e){return jQuery(e).css({height:"auto","overflow-y":"hidden"}).css({height:e[0].scrollHeight})};r(t).on("input",function(){r(t)})}}}])},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(943),s=n(7),a=n(1);t.bindHtml=o.ng.directive("bindHtml",["$compile",function(e){return{restrict:"A",scope:{bindHtml:"="},link:function(t,n){t.$watch("bindHtml",function(o){var u=this,c=a.$("<div>"+(o||"")+"</div>");c.find("[resizable]").removeAttr("resizable").css("cursor","initial"),c.find("[bind-html]").removeAttr("bind-html"),c.find("[ng-include]").removeAttr("ng-include"),c.find("[ng-transclude]").removeAttr("ng-transclude"),c.find("[draggable]").removeAttr("draggable").css("cursor","initial"),c.find("[contenteditable]").removeAttr("contenteditable"),c.find("script").remove(),c.find("*").each(function(e,t){for(var n=t.attributes,r=n.length-1;r>=0;r--)(n[r].name.startsWith("on")||n[r].value.includes("javascript:"))&&t.removeAttribute(n[r].name)});var l=c[0].outerHTML;window.MathJax||window.MathJaxLoading||(window.MathJaxLoading=!0,a.$.getScript(window.CDN_DOMAIN+"/infra/public/mathjax/MathJax.js",function(){window.MathJax.Ajax.config.root=window.CDN_DOMAIN+"/infra/public/mathjax/",window.MathJax.Hub.Config({messageStyle:"none",tex2jax:{preview:"none"},jax:["input/TeX","output/CommonHTML"],extensions:["tex2jax.js","MathMenu.js","MathZoom.js"],TeX:{extensions:["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]}}),window.MathJax.Hub.Queue(["Typeset",window.MathJax.Hub]),t.$apply()})),n.html(e(l)(t.$parent)),n.find("audio").each(function(e,t){var n=a.$(t).parent();a.$(t).attr("src",t.src).attr("preload","none").detach().appendTo(n)}),n.find("img").css({cursor:""}),n.on("mouseover","img",function(e){return r(u,void 0,void 0,function(){var t,n,r,o,u;return i(this,function(i){switch(i.label){case 0:return t=a.$(e.target).attr("src"),t.startsWith("/workspace/document")?(n=void 0,a.$(e.target).data("legend")?(n=a.$(e.target).data("legend"),[3,3]):[3,1]):[3,4];case 1:return r=t.split("/workspace/document/")[1].split("?")[0],[4,s.default.get("/workspace/document/properties/"+r)];case 2:o=i.sent(),n=o.data.legend,i.label=3;case 3:if(!n)return[2];a.$(e.target).data("legend",n),u=a.$('<legend class="user-image"><div class="text">'+n+"</div></legend>"),u.height(a.$(e.target).height()),u.width(a.$(e.target).width()),u.css("position","absolute"),u.offset({top:a.$(e.target).offset().top,left:a.$(e.target).offset().left}),u.appendTo("body"),setTimeout(function(){var t=function(e){u.find(".text").addClass("hidden"),setTimeout(function(){return u.remove()},250),a.$(e.target).off("mouseout")};a.$(e.target).on("mouseout",t)},10),i.label=4;case 4:return[2]}})})}),window.MathJax&&window.MathJax.Hub&&window.MathJax.Hub.Queue(["Typeset",window.MathJax.Hub])})}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(1);t.bottomScroll=r.ng.directive("bottomScroll",function(){return{restrict:"A",link:function(e,t,n){var r=t,o=function(){return t[0].scrollHeight};"auto"!==t.css("overflow")&&void 0===n.scrollable&&(r=i.$(window),o=function(){return i.$(document).height()}),r.scroll(function(){var t=r[0].scrollY||r[0].scrollTop||r[0].pageYOffset;t+=100,o()-r.height()<t&&(e.$eval(n.bottomScroll),e.$$phase||e.$apply())})}}}),t.onBottomScroll=r.ng.directive("onBottomScroll",function(){return{restrict:"A",link:function(e,t,n){var r=parseInt(n.onBottomScrollOffset)||100;t.scroll(function(){var i=t.outerHeight(),o=t.scrollTop();t.prop("scrollHeight")-(i+o)<r&&(e.$eval(n.onBottomScroll),e.$$phase||e.$apply())})}}})},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(943),s=n(38),a=n(37),u=n(916),c=n(4),l=n(387),d=n(390),h=n(1),f=n(937);t.calendarComponent=o.ng.directive("calendar",function(){return{restrict:"E",scope:!0,templateUrl:"/assets/js/entcore/template/calendar.html",controller:["$scope","$timeout",function(e,t){e.timeOfDay={start:0,end:24};var n=function(){a.model.calendar.clearScheduleItems(),e.items=c._.where(c._.map(e.items,function(e){return e.beginning=e.startMoment,e.end=e.endMoment,e}),{is_periodic:!1}),a.model.calendar.addScheduleItems(e.items),a.model.calendar.display=e.display,e.calendar=a.model.calendar,window.currentLanguage&&e.calendar.firstDay.locale(window.currentLanguage),e.moment=u.moment,e.display.editItem=!1,e.display.createItem=!1,e.appPrefix=s.appPrefix;var t={displayQuarterHours:!1,displaySaturday:!1,displaySunday:!1};e.toogleDisplayOptions=function(){f.Me&&f.Me.preferences&&(f.Me.preferences.calendarOptions||(f.Me.preferences.calendarOptions={}),f.Me.preferences.calendarOptions.displayQuarterHours=e.display.quarterHours,f.Me.preferences.calendarOptions.displaySaturday=e.display.saturday,f.Me.preferences.calendarOptions.displaySunday=e.display.sunday,f.Me.savePreference("calendarOptions"))},e.display.options&&function(){r(this,void 0,void 0,function(){return i(this,function(n){switch(n.label){case 0:return[4,f.Me.preference("calendarOptions")];case 1:return t=n.sent(),e.display.quarterHours=t.displayQuarterHours,e.display.saturday=t.displaySaturday,e.display.sunday=t.displaySunday,[2]}})})}(),d.template.open("calendarDefaultDisplayOptionsTemplate","entcore/calendar-default-display-options-template"),e.editItem=function(t){e.calendarEditItem=t,e.display.editItem=!0},e.createItem=function(t,n){e.newItem={};var r=a.model.calendar.firstDay.year()||t.date&&t.date.year();t.index<a.model.calendar.firstDay.dayOfYear()&&r++,n||(n={start:l.calendar.startOfDay,end:l.calendar.endOfDay}),e.newItem.beginning=u.moment().utc().year(r).dayOfYear(t.index).hour(n.start).minute(n.startMinutes),e.newItem.end=u.moment().utc().year(r).dayOfYear(t.index).hour(n.end).minute(n.endMinutes),a.model.calendar.newItem=e.newItem,a.model.calendar.eventer.trigger("calendar.create-item",n),e.onCreateOpen()},e.closeCreateWindow=function(){e.display.createItem=!1,e.onCreateClose()},e.updateCalendarDate=function(){a.model.calendar.setDate(a.model.calendar.firstDay)},e.previousTimeslots=function(){l.calendar.startOfDay!==l.calendar.firstHour&&(l.calendar.startOfDay--,l.calendar.endOfDay--,a.model.calendar.initTimeSlots(),a.model.calendar.days.sync(),n())},e.nextTimeslots=function(){l.calendar.endOfDay!==l.calendar.lastHour&&(l.calendar.startOfDay++,l.calendar.endOfDay++,a.model.calendar.initTimeSlots(),a.model.calendar.days.sync(),n())}};e.optionalDisplay=function(t){return!(!e.display.saturday&&"saturday"==t.name||!e.display.sunday&&"sunday"==t.name)},e.getMonthDayOffset=function(e){return(e.date.day()||7)-1},l.calendar.setCalendar=function(e){a.model.calendar=e,n()},t(function(){n(),e.$watchCollection("items",n)},0),e.refreshCalendar=n,e.$watch("display.mode",function(){a.model.calendar.setIncrement(e.display.mode),n()}),e.$watchCollection("slots",function(t,n){t!==n&&(a.model.calendar.setTimeslots(t),e.timeOfDay={start:l.calendar.firstHour,end:l.calendar.lastHour},e.$apply())})}],link:function(e,t,n){var r;n.itemTooltipTemplate&&(e.itemTooltipTemplate=n.itemTooltipTemplate),e.display={readonly:!1,mode:"week",enableModes:"true"===n.enableDisplayModes,quarterHours:!1,sunday:!1,saturday:!1,options:"true"===n.displayOptions,lightboxOptions:!1,showNextPreviousButton:"true"===n.showNextPreviousButton},n.$observe("createTemplate",function(){n.createTemplate&&(d.template.open("schedule-create-template",n.createTemplate),r=!0)}),n.$observe("displayTemplate",function(){n.displayTemplate&&d.template.open("schedule-display-template",n.displayTemplate)}),n.$observe("displayMonthTemplate",function(){n.displayMonthTemplate&&d.template.open("schedule-display-month-template",n.displayMonthTemplate),n.moreItemsTemplate&&d.template.open("schedule-more-items-template",n.moreItemsTemplate)}),e.items=e.$eval(n.items),e.slots=e.$eval(n.slots),e.onCreateOpen=function(){r&&(e.$eval(n.onCreateOpen),e.display.createItem=!0)},e.onCreateClose=function(){e.$eval(n.onCreateClose)},e.$watch(function(){return e.$eval(n.items)},function(t){e.items=t}),e.$watch(function(){return e.$eval(n.slots)},function(t){return e.slots=t})}}}),t.scheduleItem=o.ng.directive("scheduleItem",function(){return{restrict:"E",require:"^calendar",template:'<div class="schedule-item" resizable horizontal-resize-lock draggable><container template="schedule-display-template" class="absolute"></container></div>',controller:["$scope",function(e){}],link:function(e,t,n){var r=t.parents(".schedule"),i=t.children(".schedule-item");(e.item.beginning.dayOfYear()!==e.item.end.dayOfYear()||u.moment().diff(u.moment(e.item.end_date))>0||e.item.locked)&&(i.removeAttr("resizable"),i.removeAttr("draggable"),i.unbind("mouseover"),i.unbind("click"),i.data("lock",!0));var o=function(){var e=i.position().top+l.calendar.dayHeight*l.calendar.startOfDay,n=u.moment().utc();n.hour(Math.floor(e/l.calendar.dayHeight)),n.minute(e%l.calendar.dayHeight*60/l.calendar.dayHeight);var r=u.moment().utc();r.hour(Math.floor((e+i.height())/l.calendar.dayHeight)),r.minute((e+i.height())%l.calendar.dayHeight*60/l.calendar.dayHeight),n.year(a.model.calendar.firstDay.year()),r.year(a.model.calendar.firstDay.year());var o=t.parents(".schedule").find(".day"),s=i.offset().left+i.width()/2,c=o.first().width();return o.each(function(e,t){var i=h.$(t).offset().left;if(i<s&&i+c>s){var o=a.model.calendar.firstDay.clone().add(e,"days");r.year(o.year()),r.month(o.month()),r.date(o.date()),n.year(o.year()),n.month(o.month()),n.date(o.date())}}),{startTime:n,endTime:r}};i.on("stopResize",function(){var t=o();e.item.beginning=t.startTime,e.item.end=t.endTime,a.model.calendar.eventer.trigger("calendar.resize-item",e.item),"function"==typeof e.item.calendarUpdate&&(e.item.calendarUpdate(),a.model.calendar.clearScheduleItems(),a.model.calendar.addScheduleItems(e.$parent.items),e.$parent.$apply("items"))}),i.on("stopDrag",function(){var t=o();e.item.beginning=t.startTime,e.item.end=t.endTime,a.model.calendar.eventer.trigger("calendar.drop-item",e.item),"function"==typeof e.item.calendarUpdate&&(e.item.calendarUpdate(),a.model.calendar.clearScheduleItems(),a.model.calendar.addScheduleItems(e.$parent.items),e.$parent.$apply("items"),r.find("schedule-item").each(function(e,t){angular.element(t).scope().placeItem()}))});var s=function(){var n=r.find(".day").width(),o=(t.parent().width(),e.item.beginning.dayOfYear(),e.item.end.dayOfYear(),l.calendar.getHours(e.item,e.day),a.model.calendar.getSlotsIndex(e.item.beginning,e.item.end));if(0!==o.length){var s=e.day.scheduleItems.scheduleItemWidth(e.item);i.css({width:s+"%"});for(var u=0,c=!0;c;)c=!1,e.day.scheduleItems.forEach(function(t){t!==e.item&&t.beginning<e.item.end&&t.end>e.item.beginning&&t.calendarGutter===u&&(u++,c=!0)});e.item.calendarGutter=u;var d=o.length>0?l.calendar.slotsDuration[o[0]]:0,h=o.length>0?l.calendar.slotsDuration[o[o.length-1]]:0,f=a.model.calendar.timeSlots.all[o[0]],p=e.item.beginning.diff(e.item.beginning.clone().hours(f.start).minutes(f.startMinutes),"minutes"),m=p/d*l.calendar.dayHeight,_=a.model.calendar.timeSlots.all[o[o.length-1]],v=e.item.end.diff(e.item.end.clone().hours(_.end).minutes(_.endMinutes),"minutes"),y=v/h*l.calendar.dayHeight;i.height(o.length*l.calendar.dayHeight-m+y+"px");var g=a.model.calendar.getFirstSlotIndex(),b=o[0]-g,w=b*l.calendar.dayHeight+m;i.css({top:w+"px",left:e.item.calendarGutter*(s*n/100)+"px"});var M=t.find("container");w<0?(M.css({top:Math.abs(w)-5+"px"}),M.height(t.children(".schedule-item").height()+w+5)):(M.css({top:"0px"}),M.css({height:"100%"}))}};e.$parent.$watch("items",s),e.$parent.$watchCollection("items",s),e.$watch("item",s),e.placeItem=s}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943);t.carousel=r.ng.directive("carousel",function(){return{scope:{items:"="},restrict:"E",templateUrl:"/assets/js/entcore/template/carousel.html",link:function(e,t,n){var r=0;n.transition&&t.addClass(e.$parent.$eval(n.transition)),n.buttons&&t.addClass(e.$parent.$eval(n.buttons)),e.current={image:e.items[0],index:0},e.images=e.items.filter(function(e){return void 0!==e.icon}),e.$watchCollection("items",function(t){e.images=e.items.filter(function(e){return void 0!==e.icon}),e.current={image:e.items[0],index:0}}),e.openCurrentImage=function(){window.location.href=e.current.image.link},e.openSelectImage=function(t,n){e.current.image===t?e.openCurrentImage():(e.current.image=t,e.current.index=n),cancelAnimationFrame(i),o(),r--,setTimeout(s,5e3)},e.getPilePosition=function(t){return t<e.current.index?100+t:100-t};var i,o=function(){t.find(".current img").height(t.find(".current .image-container").height()),i=requestAnimationFrame(o)},s=function(){if(cancelAnimationFrame(i),r<0)return void r++;e.current.index++,e.current.index===e.items.length&&(e.current.index=0),e.current.image=e.items[e.current.index],e.$apply("current"),o(),setTimeout(s,4e3)};setTimeout(function(){s()},1)}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(38);t.completeChange=r.ng.directive("completeChange",function(){return{restrict:"A",scope:{exec:"&completeChange",field:"=ngModel"},link:function(e,t,n){e.$watch("field",function(e){t.is(":focus")||(t.val(e),"textarea"===t[0].type&&t.hasClass("inline-editing")&&setTimeout(function(){t.height(1),t.height(t[0].scrollHeight-1)},100))});var r="change";i.devices.isIE&&(r="blur"),t.on(r,function(){e.field=t.val(),e.$$phase||e.$apply("field"),e.$parent.$eval(e.exec),e.$$phase||e.$apply("field")})}}})},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},o=this;Object.defineProperty(t,"__esModule",{value:!0});var s=n(34),a=n(943),u=n(551),c=void 0,l=function(){return r(o,void 0,void 0,function(){var e,t;return i(this,function(n){switch(n.label){case 0:if(c)return[2,c];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,s.httpPromisy().get("/userbook/preference/authenticatedConnectorsAccessed")];case 2:return e=n.sent(),e.preference&&(c=JSON.parse(e.preference)),[3,4];case 3:return t=n.sent(),console.log("Error parsing authenticatedConnectorsAccessed preferences"),c={},[3,4];case 4:return[2,c]}})})},d=new u.Subject;t.connectorLightboxTrigger=a.ng.directive("connectorLightboxTrigger",["$timeout","$filter",function(e,t){return{restrict:"A",scope:{connectorLightboxTrigger:"="},link:function(e,t,n){var o=this;!function(){r(o,void 0,void 0,function(){return i(this,function(n){return t.on("click",function(n){var r={app:e.connectorLightboxTrigger,element:t,$mutex:!1,ctrlKey:!!n.ctrlKey,metaKey:!!n.metaKey};d.next(r)}),e.$on("$destroy",function(){t.off("click")}),[2]})})}()}}}]),t.connectorLightbox=a.ng.directive("connectorLightbox",["$timeout","$filter",function(e,t){return{restrict:"E",scope:{},template:'\n <lightbox show="display.showAuthenticatedConnectorLightbox" on-close="onClose()">\n <h3><i18n>apps.authenticatedConnector.lightbox.title</i18n></h3>\n <div class="info vertical-spacing-twice"><i18n>apps.authenticatedConnector.lightbox.content</i18n></div>\n \n <div>\n <button class="horizontal-spacing" \n ng-click="onConfirm(authenticatedConnectorClicked)">\n <i18n>confirm</i18n>\n </button>\n <button class="horizontal-spacing" \n ng-click="onClose()">\n <i18n>cancel</i18n>\n </button>\n </div>\n </lightbox>\n\n ',link:function(e,t,n){var o=this;e.display={showAuthenticatedConnectorLightbox:!1};var a=null,u=function(e){return!!e.casType||e.scope&&e.scope.length>0&&!!e.scope[0]},c=function(t){return!e.authenticatedConnectorsAccessed||e.authenticatedConnectorsAccessed&&!e.authenticatedConnectorsAccessed.includes(t.name)};e.onClose=function(){e.display.showAuthenticatedConnectorLightbox=!1};var h=function(e,t){a.app.isExternal&&window.xiti&&window.xiti.click?"_self"==t?window.xiti.click(a.app.name,a.element[0]).then(function(){window.open(e,t)}).catch(function(n){window.open(e,t)}):(window.xiti.click(a.app.name,a.element[0]),window.open(e,t)):window.open(e,t)};e.onConfirm=function(){var t=a.app;e.onClose(),e.authenticatedConnectorsAccessed?e.authenticatedConnectorsAccessed.push(t.name):e.authenticatedConnectorsAccessed=[t.name];var n=a.ctrlKey||a.metaKey?"_blank":t.target?t.target:"_self";"_self"!==n?(s.http().putJson("/userbook/preference/authenticatedConnectorsAccessed",e.authenticatedConnectorsAccessed),h(t.address,n)):function(){r(this,void 0,void 0,function(){return i(this,function(r){switch(r.label){case 0:return[4,s.httpPromisy().putJson("/userbook/preference/authenticatedConnectorsAccessed",e.authenticatedConnectorsAccessed)];case 1:return r.sent(),h(t.address,n),[2]}})})}()};var f=function(t){if(!t.$mutex){t.$mutex=!0;var n=t.app;if(void 0===n)throw"ConnectorLightboxScope.openAppWithCheck failed : target app is undefined";var r=a.ctrlKey||a.metaKey?"_blank":n.target?n.target:"_self";if(e.skipCheck)return void h(n.address,r);u(n)&&c(n)?(e.authenticatedConnectorClicked=n,e.display.showAuthenticatedConnectorLightbox=!0,e.$apply()):h(n.address,r)}};!function(){r(o,void 0,void 0,function(){var t,n,r,o;return i(this,function(i){switch(i.label){case 0:return t=d.subscribe(function(e){a=e,f(a)}),e.$on("$destroy",function(){t.unsubscribe()}),n=e,[4,l()];case 1:n.authenticatedConnectorsAccessed=i.sent(),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,s.httpPromisy().get("/cas/conf/public")];case 3:return r=i.sent(),e.skipCheck=!!r.skip,[3,5];case 4:return o=i.sent(),console.warn("Failed to get public conf: ",o),[3,5];case 5:return[2]}})})}()}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388),i=n(6);t.contactChip=r.ng.directive("contactChip",function(){return{restrict:"E",template:'\n <span class="cell round bg-white square-small" ng-class="{ group: isChipGroup() }">\n <img ng-if="isChipGroup()" skin-src="/img/illustrations/group-avatar.svg"/>\n <img ng-if="!isChipGroup()" ng-src="/userbook/avatar/[[id]]?thumbnail=100x100"/>\n </span>\n\n <span ng-if="!isChipGroup()" class="cell circle square-mini" ng-class="profile()"></span>\n\n <span ng-if="!isChipGroup() && !isNotLinked" class="cell-ellipsis block left-text">\n <a ng-click="$event.stopPropagation();" href="/userbook/annuaire#[[id]]" target="_blank">[[ ngModel.name ]][[ ngModel.displayName ]]</a>\n </span>\n <span ng-if="!isChipGroup() && isNotLinked" class="cell-ellipsis block left-text">\n [[ ngModel.name ]][[ ngModel.displayName ]]\n </span>\n <span ng-if="isChipGroup() && !isNotLinked" class="cell-ellipsis block left-text">\n <a ng-if="!isNotLinked" ng-click="$event.stopPropagation();" href="/userbook/annuaire#/group-view/[[id]]" target="_blank">[[ ngModel.name ]]</a>\n </span>\n <span ng-if="isChipGroup() && isNotLinked" class="cell-ellipsis block left-text">\n [[ ngModel.name ]]\n </span>\n\n <i class="absolute-magnet" \n ng-if="(stickernotselected || !ngModel.selected) && (isMovable() || isRemovable())" \n ng-class="{ \'right-arrow\':isMovable(), \'close\':isRemovable() }"\n ng-click="iconActionExists ? actionIcon({item:ngModel}) : action({item:ngModel}); $event.stopPropagation();">\n </i>\n ',scope:{ngModel:"=",action:"&",actionIcon:"&"},link:function(e,t,n){e.stickernotselected=n.hasOwnProperty("stickernotselected"),e.isGroup=n.hasOwnProperty("isgroup"),e.iconActionExists=!angular.isUndefined(n.actionIcon),e.isNotLinked=n.hasOwnProperty("isnotlinked"),e.id=e.ngModel.id?e.ngModel.id:e.ngModel._id,e.profile=function(){return i.ui.profileColors.match(e.ngModel.profile)},e.isMovable=function(){return t.hasClass("movable")},e.isRemovable=function(){return t.hasClass("removable")},e.isChipHover=function(){return t.hasClass("chip-hover")},e.isChipGroup=function(){return e.isGroup||e.ngModel.groupType||e.ngModel.isGroup||"group"===e.ngModel.type},e.onGeneralClick=function(){e.action({item:e.ngModel})},t.on("click",function(){(e.isChipHover()||e.iconActionExists)&&e.onGeneralClick()}),t.on("mouseenter",function(){for(var n=t.find(".cell-ellipsis"),r=0,i=n.length;r<i;r++)n[r].offsetWidth<n[r].scrollWidth?n.eq(r).attr("title",e.isChipGroup()?e.ngModel.name:(e.ngModel.name?e.ngModel.name:"")+(e.ngModel.displayName?e.ngModel.displayName:"")):n.eq(r).attr("title",null)})}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388);t.contentDivider=r.ng.directive("contentDivider",function(){return{restrict:"E",template:function(e,t){return'\n <div class="zero-mobile-fat-mobile flex-row reduce-block-eight scroll-x">\n <div class="flex-row" ng-repeat="content in getModel() track by $index">'+e.children()[0].outerHTML+'<div class="horizontal-margin-twice divider-border" ng-if="$index < ngModel.length - 1"></div>\n </div>\n </div>\n <div class="mobile-fat-mobile flex-row f-column reduce-block-eight">\n <div class="flex-row f-column" ng-repeat="content in getModel() track by $index">'+e.children()[0].outerHTML+'<div class="vertical-spacing-six divider-border-horizontal" ng-if="$index < ngModel.length - 1"></div>\n </div>\n </div>\n '},scope:{callback:"="},require:"ngModel",link:function(e,t,n,r,i){e.order=n.order,e.getModel=function(){var e=r.$viewValue;return null==e?[]:"string"==typeof e?JSON.parse(e):e}}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943);t.documentIsCaptation=r.ng.directive("documentIsCaptation",["VideoEventTracker",function(e){return{restrict:"A",link:function(t,n,r){if(n&&!(n.length<1)){var i=n.get(0);i&&HTMLVideoElement.prototype.isPrototypeOf(i)&&(e.trackOne(i),t.$on("$destroy",function(){e.untrackOne(i)}))}}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(1);t.dotsMenu=r.ng.directive("dotsMenu",function(){return{restrict:"E",transclude:!0,template:'\n <i class="opener"></i>\n <div class="options" ng-transclude></div>\n ',link:function(e,t,n){t.children(".opener").on("click",function(){t.offset().left<400&&t.addClass("right"),setTimeout(function(){t.hasClass("opened")?t.removeClass("opened"):t.addClass("opened")},10)}),i.$("body, lightbox").on("click",function(e){i.$(t).hasClass("opener")||t.removeClass("opened")})}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(1),o=n(6),s={height:300,width:300};t.dragItem=r.ng.directive("dragItem",function(){return{restrict:"A",link:function(e,t,n){var r=e.$eval(n.dragItem),a=void 0,u=!0;e.$watch(function(){return e.$eval(n.dragItem)},function(e){r=e}),o.ui.extendElement.draggable(t,{mouseUp:function(n){i.$(".droppable").off("mouseout"),i.$("body").removeClass("dragging"),a&&a.trigger("drop",[r]),e.$apply(),u=!0,t.attr("style",""),t.trigger("stopdrag"),t.removeClass("dragging")},startDrag:function(e){if(t.addClass("dragging"),t[0].hasAttribute("drag-crop")){var n={};if(t.height()>s.height){var r=s.height,i=s.height/2-window.scrollY;e.elementDistance.y>i?e.elementDistance.y=i:r=e.elementDistance.y+s.height/2,n.height=r,t.css({overflow:"hidden"})}if(t.width()>s.width){var o=s.width,i=s.width/2;e.elementDistance.x>i?e.elementDistance.x=i:o=e.elementDistance.x+s.width/2,n.width=o,t.css({overflow:"hidden"})}(n.height||n.width)&&t.animate(n)}return{elementDistance:e.elementDistance}},dragOver:function(e){e.addClass("dragover"),a=e},dragOut:function(e){a&&e===a&&(a=void 0),e.removeClass("dragover")},tick:function(){u&&(i.$(".droppable").removeClass("drag-over"),t.css({"pointer-events":"none"}),t.trigger("startdrag"),i.$("body").addClass("dragging"),e.$apply(),u=!1)}})}}}),t.dropItem=r.ng.directive("dropItem",["$parse",function(e){return{restrict:"A",link:function(t,n,r){n.addClass("droppable");var i=e(r.dropcondition);n.on("dragover",function(e){(void 0===r.dropcondition||i(t,{$originalEvent:e.originalEvent}))&&(e.preventDefault(),e.stopPropagation(),n.addClass("droptarget"))}),n.on("dragout",function(e){n.removeClass("droptarget")}),n.on("drop",function(e,n){t.$eval(r.dropItem,{$item:n}),t.$apply()})}}}])},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(943),s=n(3),a=n(908);t.dropDown=o.ng.directive("dropDown",["$compile","$timeout",function(e,t){return{restrict:"E",scope:{listId:"=?",options:"=",ngChange:"&",onClose:"&",ngModel:"="},template:'\n\t\t\t<div data-drop-down class="drop-down">\n\t\t\t\t<div role="listbox">\n\t\t\t\t\t<ul class="ten cell right-magnet">\n\t\t\t\t\t\t<li class="block-container" ng-repeat="option in options | limitTo:limit" ng-model="option" ng-class="{alert: option === ngModel}">\n\t\t\t\t\t\t\t<a class="cell right-spacing" ng-class="{\'sharebookmark\': option.type === \'sharebookmark\'}">\n\t\t\t\t\t\t\t\t<i class="add-favorite cell" ng-if="option.type === \'sharebookmark\'"></i>\n\t\t\t\t\t\t\t\t[[option.toString()]]\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t<em ng-if="option.structureName" class="low-importance">[[option.structureName]]</em>\n\t\t\t\t\t\t\t<em class="low-importance">[[translate(option.profile)]] </em>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li class="display-more block-container" ng-show="limit < options.length" ng-click="increaseLimit()">[[translate(\'seemore\')]]</li>\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t',link:function(e,n,o){e.translate=s.idiom.translate,e.limit=6;var u=n.find("[data-drop-down]"),c=n.find("[data-drop-down] ul");c&&e.listId&&c.attr("id",e.listId),e.setDropDownHeight=function(){var t=0,n=Math.min(e.limit,e.options.length);u.find("li").each(function(e,r){return t+=a.$(r).offsetHeight,e<n}),u.height(t)},e.increaseLimit=function(){e.limit+=5,t(function(){e.setDropDownHeight()})},e.positionOptions=function(){if(!e.options||0===e.options.length)return u.height(),u.addClass("hidden"),e.limit=6,void u.attr("style","");u.removeClass("hidden");var t=o.for?a.$("#"+o.for):n.parent(),r=t.offset(),i=t.width()+parseInt(t.css("padding-right"))+parseInt(t.css("padding-left"))+2*parseInt(t.css("border-width")||1),s=t.height()+parseInt(t.css("padding-top"))+parseInt(t.css("padding-bottom"))+2*parseInt(t.css("border-height")||1);r.top=r.top+s,u.offset(r),u.width(i),e.setDropDownHeight(),setTimeout(function(){e.setDropDownHeight()},100)},e.$watchCollection("options",function(t){e.positionOptions()}),u.detach().appendTo("body"),u.on("click","li",function(t){return r(this,void 0,void 0,function(){return i(this,function(n){switch(n.label){case 0:return a.$(t.target).hasClass("display-more")?[2]:(e.limit=6,o.for?u.attr("style",""):e.positionOptions(),e.current=a.$(this).scope().option,e.ngModel=a.$(this).scope().option,e.$apply("ngModel"),[4,e.ngChange()]);case 1:return n.sent(),e.$eval(e.onClose),e.$apply("ngModel"),[2]}})})});var l=function(t){u.find(t.target).length>0||(e.$eval(e.onClose),e.$apply())};a.$("body").on("click",l),u.attr("data-opened-drop-down",!0),n.on("$destroy",function(){a.$("body").unbind("click",l),u.remove()})}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(1);t.dropdownButtons=r.ng.directive("dropdownButtons",function(){return{restrict:"E",link:function(e,t,n){var r=function(){t.offset().left>i.$(window).width()/2?t.addClass("right"):t.removeClass("right"),t.offset().top>i.$(window).height()/2?t.addClass("bottom"):t.removeClass("bottom"),"static"===t.css("position")&&setTimeout(function(){return r()},500)};r(),i.$(window).on("resize",r),t.find("open").on("click",function(){t.hasClass("opened")?t.removeClass("opened"):t.addClass("opened")}),i.$("body").on("click",function(e){e.target===t.children("open")[0]||t.children("open").find(e.target).length>0||t.removeClass("opened")})}}})},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(exports,"__esModule",{value:!0});var ng_start_1=__webpack_require__(943),globals_1=__webpack_require__(38),http_1=__webpack_require__(34),jquery_1=__webpack_require__(1),template_1=__webpack_require__(390),workspace_1=__webpack_require__(391),idiom_1=__webpack_require__(3),modelDefinitions_1=__webpack_require__(37),embedder_1=__webpack_require__(946),me_1=__webpack_require__(937),model_1=__webpack_require__(407),notify_1=__webpack_require__(35),VideoUploadGuardModel=function(){function e(){this.hasUploaded=!1}return e.prototype.guardObjectIsDirty=function(){return this.hasUploaded},e.prototype.guardObjectReset=function(){this.hasUploaded=!1},e}();exports.embedder=ng_start_1.ng.directive("embedder",["$timeout","$filter","VideoUploadService",function($timeout,$filter,VideoUploadService){return{restrict:"E",scope:{delegate:"=",ngModel:"=",ngChange:"&",multiple:"=",fileFormat:"=",show:"=",hiddenShareVideoCode:"=",selectedHeader:"="},require:"?ngModel",templateUrl:"/assets/js/entcore/template/video/main.html",link:function(scope,element,attributes,lnkNgModel){function matchSearch(e){return!(scope.display.search&&scope.display.search.trim().length>0)||-1!==idiom_1.idiom.removeAccents((e||"").toLowerCase()).indexOf(idiom_1.idiom.removeAccents(scope.display.search.toLowerCase()))}function filteredDocuments(e){return e.documents.filter(function(e){var t=scope.delegate&&scope.delegate.filterDocumentRole,n=e.role()===scope.fileFormat||"any"===scope.fileFormat,r=t?scope.delegate.filterDocumentRole(e):n,i=matchSearch(e.metadata.filename),o=matchSearch(e.name);return r&&(i||o)})}function filterFolders(e){return e&&e.folders?e.folders.filter(function(e){return matchSearch(e.name)}):[]}function logVideoEvent_AddToContent(e){if(void 0!==e.metadata.captation){var t=globals_1.devices.getBrowserInfo(),n={videoId:e._id,userId:modelDefinitions_1.model.me.userId,userProfile:modelDefinitions_1.model.me.profiles[0],device:globals_1.deviceType,browser:t.name+" "+t.version,structure:modelDefinitions_1.model.me.structureNames[0],level:modelDefinitions_1.model.me.level,duration:e.metadata.duration,weight:e.metadata.size,url:window.location.hostname,app:globals_1.appPrefix};http_1.http().postJson("/video/event/embed",n).done(function(e){console.log(e)})}}var _this=this;scope.documentList=new model_1.DocumentsListModel($filter,!0),scope.documentList.watch(scope),scope.delegate&&scope.delegate.visit&&scope.delegate.visit(scope),scope.display={search:"",limit:24,provider:{name:"none"},isUploading:!1},scope.upload={documents:[],highlights:[]},scope.providers=[],scope.uploadGuard=new VideoUploadGuardModel;var MAIN_CONTAINER="entcore/video/main",HEADER_INTEGRATION={i18Key:"video.header.integration",template:"entcore/video/integration",visible:function(){return!0},worflowKey:null},hasVideoUpload=!1,HEADER_UPLOAD={i18Key:"video.header.upload",template:"entcore/video/upload",visible:function(){return hasVideoUpload},worflowKey:"video.upload"};me_1.Me.hasWorkflowRight("video.upload").then(function(e){hasVideoUpload=e});var hasVideoCapture=!1,HEADER_RECORD={i18Key:"video.header.record",template:"entcore/video/record",onDisplay:function(){emitDisplayEvent()},visible:function(){return hasVideoCapture},worflowKey:"video.capture"};me_1.Me.hasWorkflowRight("video.capture").then(function(e){hasVideoCapture=e});var HEADER_BROWSE={i18Key:"video.header.browse",template:"entcore/media-library/browse",visible:function(){return hasVideoCapture||hasVideoUpload},worflowKey:null};scope.maxWeight=VideoUploadService.maxWeight,VideoUploadService.initialize().then(function(){scope.maxWeight=VideoUploadService.maxWeight});var emitDisplayEvent=function(){console.log("Broadcast display event displayVideoRecorder..."),scope.$broadcast("displayVideoRecorder",{})};scope.template=template_1.template;var header=HEADER_BROWSE,hack=!0,showTemplate=function(e){return __awaiter(_this,void 0,void 0,function(){var t;return __generator(this,function(n){switch(n.label){case 0:return header=e,[4,template_1.template.open(MAIN_CONTAINER,e.template)];case 1:return n.sent(),e.onDisplay&&setTimeout(function(){e.onDisplay()}),navigator.userAgent.match(/iPhone/i)&&hack&&(hack=!1,t=jquery_1.$("editor").css("display"),jquery_1.$("editor").css("display","none"),setTimeout(function(){hack=!0,jquery_1.$("editor").css("display",t)},500)),[2]}})})};scope.headers=function(){var e=[HEADER_INTEGRATION,HEADER_RECORD,HEADER_UPLOAD,HEADER_BROWSE];return scope.delegate&&scope.delegate.augmentHeaders?scope.delegate.augmentHeaders(e):e},scope.isSelectedHeader=function(e){return header&&e&&header.i18Key==e.i18Key},scope.getClassOf=function(e){return{"beta-feature":e===HEADER_RECORD||e===HEADER_UPLOAD}},scope.$on("video-upload",function(e,t){scope.insertRecord(t)}),scope.title=function(){return scope.delegate&&scope.delegate.title?scope.delegate.title:idiom_1.idiom.translate("editor.option.embed")},window.toBlobPolyfillLoaded||http_1.http().get("/infra/public/js/toBlob-polyfill.js").done(function(response){eval(response.data),window.toBlobPolyfillLoaded=!0}),scope.$watch(function(){return scope.$parent.$eval(attributes.visibility)},function(e){scope.visibility=e,scope.visibility||(scope.visibility="protected"),scope.visibility=scope.visibility.toLowerCase()}),scope.openCompression=function(e){},scope.closeCompression=function(){},element.on("dragenter",function(e){e.preventDefault()}),element.on("dragover",function(e){element.find(".drop-zone").addClass("dragover"),e.preventDefault()}),element.on("dragleave",function(){element.find(".drop-zone").removeClass("dragover")}),element.on("drop",function(e){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(t){return element.find(".drop-zone").removeClass("dragover"),e.preventDefault(),hasVideoUpload&&(showTemplate(HEADER_UPLOAD),cancelAll(),scope.$apply(),scope.importFiles(e.originalEvent.dataTransfer.files)),[2]})})}),scope.$watch("ngModel",function(e){scope.upload.documents=[]}),jquery_1.$("body").on("click",".lightbox-backdrop",function(){scope.upload.documents=[]}),showTemplate(HEADER_INTEGRATION),scope.myDocuments=workspace_1.MediaLibrary.myDocuments,scope.sharedDocuments=workspace_1.MediaLibrary.sharedDocuments;var previousImage=function(){for(var e=scope.upload.documents.indexOf(scope.display.editedDocument)-1,t=e;t>=0;t--)if(scope.upload.documents[t].isEditableImage)return scope.upload.documents[t]},nextImage=function(){for(var e=scope.upload.documents.indexOf(scope.display.editedDocument)+1,t=e;t<scope.upload.documents.length;t++)if(scope.upload.documents[t].isEditableImage)return scope.upload.documents[t]};scope.isEditedFirst=function(){return!previousImage()},scope.isEditedLast=function(){return!nextImage()},scope.nextImage=function(){return scope.display.editedDocument=nextImage()},scope.previousImage=function(){return scope.display.editedDocument=previousImage()};var displayHighLights=function(){setTimeout(function(){scope.upload.highlights.forEach(function(e){element.find("explorer").each(function(t,n){if(-1!==jquery_1.$(n).attr("doc-id").indexOf(e._id)){var r=jquery_1.$('<div class="highlight"></div>'),i=jquery_1.$(n).children(".explorer");i.append(r),i.scope().ngModel=!0,i.scope().$apply()}})}),setTimeout(function(){jquery_1.$(".highlight").addClass("show"),setTimeout(function(){jquery_1.$(".highlight").removeClass("show"),setTimeout(function(){jquery_1.$(".highlight").remove(),scope.upload.highlights=[]},720)},720)},30)},100)};scope.getHeaderByI18NKey=function(e){return scope.headers().find(function(t){return t.i18Key==e})},scope.showHeaderByI18Key=function(e){var t=scope.headers().find(function(t){return t.i18Key==e});t&&scope.showHeader(t)},scope.showHeader=function(e){if(scope.delegate&&scope.delegate.handleShow){if(scope.delegate.handleShow(scope,{cancelAll:cancelAll,displayHighLights:displayHighLights,showTemplate:showTemplate}))return}showTemplate(e),cancelAll(),displayHighLights()},scope.isExternalVisible=function(){return"external"==scope.visibility},scope.isViewMode=function(e){return scope.viewMode==e},scope.changeViewMode=function(e){e&&scope.viewMode!=e&&(template_1.template.open("documents-view","entcore/media-library/"+e),scope.viewMode=e)},scope.changeViewMode("icons"),scope.videoThumbUrl=function(e){var t=e.thumbnails;if(e._id&&"object"==typeof t){var n=Object.getOwnPropertyNames(t);if(n&&n.length>0)return"url('/workspace/document/"+e._id+"?thumbnail="+n[0]+"')"}return null},scope.orderByField=function(e){if(1==scope.isOrderedAsc(e))scope.orderFieldDocument="-"+e;else{if(scope.isOrderedDesc(e))return scope.orderByDefault();scope.orderFieldDocument=e}scope.orderFieldFolder=scope.orderFieldDocument},scope.orderByDefault=function(){scope.orderFieldDocument="-created",scope.orderFieldFolder="name"},scope.orderByDefault(),scope.isOrderedAsc=function(e){return scope.orderFieldDocument==e},scope.isOrderedDesc=function(e){return scope.orderFieldDocument=="-"+e},scope.isListFrom=function(e){return scope.display.listFrom==e},scope.listFrom=function(e){return __awaiter(_this,void 0,void 0,function(){var t;return __generator(this,function(n){switch(n.label){case 0:return scope.display.listFrom=e,t=workspace_1.MediaLibrary[scope.display.listFrom],[4,scope.openFolder(t)];case 1:return n.sent(),[2]}})})};var refresh=function(){scope.documents=filteredDocuments(workspace_1.MediaLibrary[scope.display.listFrom]),scope.folders=filterFolders(scope.openedFolder),scope.$apply()};workspace_1.MediaLibrary.eventer.on("sync",refresh),workspace_1.MediaLibrary.eventer.on("ready",function(){scope.folder=workspace_1.MediaLibrary[scope.display.listFrom],scope.openedFolder=scope.folder,scope.documents=filteredDocuments(workspace_1.MediaLibrary[scope.display.listFrom]),scope.folders=filterFolders(scope.openedFolder),scope.$apply()}),workspace_1.MediaLibrary.sync(),scope.openFolder=function(e){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return scope.openedFolder=e,[4,e.sync()];case 1:return t.sent(),scope.documents=filteredDocuments(e),scope.folders=filterFolders(scope.openedFolder),scope.$apply(),[2]}})})},scope.$watch("visibility",function(e){var t=this;"external"==scope.visibility?scope.listFrom("externalDocuments"):modelDefinitions_1.model.me&&modelDefinitions_1.model.me.workflow.workspace.create?"public"===scope.visibility?scope.listFrom("publicDocuments"):scope.listFrom("appDocuments"):modelDefinitions_1.model.me&&modelDefinitions_1.model.me.workflow.workspace.list&&scope.listFrom("sharedDocuments"),scope.$watch("fileFormat",function(e){return __awaiter(t,void 0,void 0,function(){var t;return __generator(this,function(n){return e?("video"===e?(t=HEADER_INTEGRATION,scope.selectedHeader&&(t=scope.getHeaderByI18NKey(scope.selectedHeader)),showTemplate(t),element.parents("lightbox").on("lightboxvisible",function(){showTemplate(t),scope.safeApply()})):(showTemplate(HEADER_BROWSE),element.parents("lightbox").on("lightboxvisible",function(){showTemplate(HEADER_BROWSE),scope.safeApply()})),0===workspace_1.MediaLibrary[scope.display.listFrom].documents.length&&workspace_1.MediaLibrary[scope.display.listFrom].sync(),[2]):[2]})})})}),scope.insertRecord=function(e){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,workspace_1.MediaLibrary.appDocuments.sync()];case 1:return t.sent(),workspace_1.MediaLibrary.appDocuments.documents.all.forEach(function(t){t.file==e&&scope.upload.documents.push(t)}),scope.listFrom("appDocuments"),scope.upload.documents.forEach(function(e){e.selected=!0}),scope.documents=scope.upload.documents,scope.documents&&scope.selectDocuments(),scope.upload.documents=[],scope.documents=[],scope.$apply(),[2]}})})},scope.selectedDocuments=function(){return scope.documents?scope.documents.filter(function(e){return e.selected}):[]},scope.selectDocument=function(e){scope.documents.forEach(function(e){return e.selected=!1}),e.selected=!0,scope.selectDocuments()},scope.safeApply=function(e){var t=this.$root.$$phase;"$apply"==t||"$digest"==t?e&&"function"==typeof e&&e():this.$apply(e)},scope.selectDocuments=function(){return __awaiter(_this,void 0,void 0,function(){var e,t,n,r;return __generator(this,function(i){switch(i.label){case 0:return e=scope.selectedDocuments(),"external"===scope.visibility||"protected"==scope.openedFolder.filter&&"protected"===scope.visibility||"public"==scope.openedFolder.filter&&"public"===scope.visibility?(scope.multiple?scope.ngModel=embedder_1.embedderService.getHtmlForVideoStreams(e,scope.visibility):scope.ngModel=embedder_1.embedderService.getHtmlForVideoStream(e[0],scope.visibility),[3,9]):[3,1];case 1:t=[],scope.display.loading=e,n=0,i.label=2;case 2:return n<e.length?(r=void 0,"public"!==scope.visibility?[3,4]:[4,e[n].publicDuplicate()]):[3,8];case 3:return r=i.sent(),[3,6];case 4:return[4,e[n].protectedDuplicate()];case 5:r=i.sent(),i.label=6;case 6:t.push(r),i.label=7;case 7:return n++,[3,2];case 8:scope.display.loading=void 0,scope.multiple?scope.ngModel=embedder_1.embedderService.getHtmlForVideoStreams(t,scope.visibility):scope.ngModel=embedder_1.embedderService.getHtmlForVideoStream(t[0],scope.visibility),i.label=9;case 9:return scope.safeApply(),scope.ngModel&&setTimeout(function(){scope.ngChange&&scope.ngChange(),e.forEach(function(e){return logVideoEvent_AddToContent(e)})}),[2]}})})},scope.updateSelection=function(e){scope.multiple||(scope.documents.forEach(function(e){return e.selected=!1}),e.selected=!0)};var cancelAll=function(){scope.display.editedDocument=void 0,scope.display.isUploading=!1,scope.upload.documents.forEach(function(e){cancelDoc(e)}),scope.upload.documents=[],scope.upload.loading=[]},cancelDoc=function(e){return"loaded"===e.uploadStatus?e.delete():(e.uploadStatus,Promise.resolve())};scope.abortOrDelete=function(e){cancelDoc(e);var t=scope.upload.documents.indexOf(e);scope.upload.documents.splice(t,1),scope.upload.documents.length||(scope.display.isUploading=!1,scope.uploadGuard.guardObjectReset(),showTemplate(HEADER_UPLOAD)),e===scope.display.editedDocument&&(scope.display.editedDocument=void 0)},scope.canConfirmImport=function(){return scope.upload.documents.map(function(e){return"loaded"==e.uploadStatus}).reduce(function(e,t){return e&&t},!0)},scope.confirmImport=function(){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return scope.upload.documents.forEach(function(e){e.applyBlob(),e.selected=!0}),[4,scope.listFrom("appDocuments")];case 1:return e.sent(),scope.documents=scope.upload.documents,scope.documents&&scope.selectDocuments(),scope.upload.documents=[],scope.documents=[],scope.$apply(),scope.uploadGuard.guardObjectReset(),notify_1.notify.success("video.file.saved"),[2]}})})},scope.cancelUpload=function(){scope.uploadGuard.guardObjectReset(),showTemplate(HEADER_UPLOAD),cancelAll()},scope.acceptedFileList=function(){return VideoUploadService.getValidExtensions().join(", ")},scope.importFiles=function(e){e||(e=scope.upload.files);for(var t=0;t<e.length;t++){if(Math.round(e[t].size/1048576)>scope.maxWeight)return notify_1.notify.error("video.upload.error.weight"),void(scope.upload.files=void 0);var n=e[t].name.lastIndexOf("."),r=e[t].name.substring(n<0?0:n+1);if(console.debug("File ext="+r),!VideoUploadService.checkValidExtension(r))return notify_1.notify.error("video.upload.error.format"),void(scope.upload.files=void 0)}for(var t=0;t<e.length;t++)!function(){var n=new workspace_1.Document;scope.upload.documents.push(n),n.fromFile(e[t]),n.uploadStatus="loading",scope.uploadGuard.hasUploaded=!0,VideoUploadService.upload(e[t],n.name,!1).then(function(e){if(e.data)if("error"===e.data.state)n.uploadStatus="failed",scope.uploadGuard.guardObjectReset(),notify_1.notify.error(e.data.code?e.data.code:"video.file.error");else{n.uploadStatus="loaded",n._id=e.data.videoworkspaceid,n.metadata&&(n.metadata.size=e.data.videosize);var t=globals_1.devices.getBrowserInfo(),r={videoId:e.data.videoworkspaceid,userId:modelDefinitions_1.model.me.userId,userProfile:modelDefinitions_1.model.me.profiles[0],device:globals_1.deviceType,browser:t.name+" "+t.version,structure:modelDefinitions_1.model.me.structureNames[0],level:modelDefinitions_1.model.me.level,duration:0,weight:e.data.videosize,captation:!1,url:window.location.hostname,app:globals_1.appPrefix};http_1.http().postJson("/video/event/save",r).done(function(e){console.log(e)})}}).catch(function(e){n.uploadStatus="failed",console.warn(e)}).finally(function(){scope.$apply()})}();scope.upload.files=void 0,scope.display.isUploading=!0},scope.updateSearch=function(){scope.documents=filteredDocuments(scope.openedFolder),scope.folders=filterFolders(scope.openedFolder)},scope.editImage=function(){return scope.display.editDocument=!0},scope.$on("$destroy",function(){cancelAll(),workspace_1.MediaLibrary.deselectAll()}),element.on("focus","textarea",function(e){jquery_1.$(e.target).next().addClass("focus"),jquery_1.$(e.target).next().addClass("move"),jquery_1.$(e.target).prev().addClass("focus")}),element.on("blur","textarea",function(e){jquery_1.$(e.target).val()||jquery_1.$(e.target).next().removeClass("move"),jquery_1.$(e.target).next().removeClass("focus"),jquery_1.$(e.target).prev().removeClass("focus")}),scope.$watch("show",function(e){scope.unselectProvider(),e&&showTemplate(HEADER_INTEGRATION)}),http_1.http().get("/infra/embed/default").done(function(e){e.forEach(function(e){scope.providers.push(e)})}),http_1.http().get("/infra/embed/custom").done(function(e){e.forEach(function(e){e.name=e.name.toLowerCase().replace(/\ |\:|\?|#|%|\$|£|\^|\*|€|°|\(|\)|\[|\]|§|'|"|&|ç|ù|`|=|\+|<|@/g,""),scope.providers.push(e)})}),scope.applyHtml=function(){scope.show=!1,lnkNgModel.$setViewValue(scope.display.htmlCode),scope.unselectProvider()},scope.cancel=function(){scope.show=!1,template_1.template.close(MAIN_CONTAINER),scope.unselectProvider(),scope.$broadcast("releaseVideo",{})},scope.unselectProvider=function(){element.find("."+scope.display.provider.name+" .preview").html(""),scope.display.provider={name:"none"},scope.display.url="",scope.display.htmlCode="",scope.display.invalidPath=!1},scope.$watch(function(){return scope.display.htmlCode},function(e){setTimeout(function(){scope.updatePreview()},20)}),scope.$watch(function(){return scope.display.url},function(e){setTimeout(function(){scope.updatePreview()},20)}),scope.updatePreview=function(){if("other"===scope.display.provider.name){return void element.find("."+scope.display.provider.name+" .preview").html(scope.display.htmlCode)}if(scope.display.url){e:for(var e=0,t=scope.display.provider.url;e<t.length;e++)for(var n=t[e],r=new RegExp("{[a-zA-Z0-9_.]+}","g"),i=n.match(r),o=scope.display.provider.embed,s=0,a=i;s<a.length;s++){var u=a[s];scope.display.invalidPath=!1;var c=n.split(u)[0],l=c.split("}");l.length>1&&(c=l[l.length-1]);var d=n.split(u)[1].split("{")[0],h=scope.display.url.split(c)[1];if(!h&&"{ignore}"!==u){scope.display.invalidPath=!0;continue e}d&&(h=h.split(d)[0]);var f=new RegExp("\\"+u.replace(/}/,"\\}"),"g");if(o=o.replace(f,h),scope.display.htmlCode=o,u===i[i.length-1])break e}element.find("."+scope.display.provider.name+" .preview").html(scope.display.htmlCode)}},scope.triggerIpnutFileClick=function(e){e.preventDefault(),e.stopPropagation(),jquery_1.$(".upload-input").trigger("click",[scope.$id])},element.on("click",".upload-input",function(e,t){t!=scope.$id&&e.preventDefault(),e.stopPropagation()})}}}])},function(e,t,n){"use strict";function r(){try{return"ontouchstart"in window||navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0}catch(e){return!1}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(943),o=n(6),s=n(1);t.explorer=i.ng.directive("explorer",function(){return{restrict:"EA",transclude:!0,scope:{ngModel:"=",ngClick:"&",ngChange:"&",onOpen:"&",shouldSelect:"&?"},template:'<div class="explorer" ng-transclude></div>',link:function(e,t,n){function i(t){n.shouldSelect&&!e.shouldSelect({$event:t})||(e.ngModel=!e.ngModel,e.$apply("ngModel"),e.ngClick&&e.ngClick({$event:t}),e.ngChange&&e.ngChange({$event:t}),e.$apply())}function a(n){o.ui.breakpoints.checkMaxWidth("tablette")?(t.off("click dblclick"),o.ui.extendElement.touchEvents(t),t.on("contextmenu",function(e){e.preventDefault()}),t.on("click",function(t,n){i(t),e.$apply("ngModel")}),t.on("doubletap dblclick",function(t){e.ngModel=!1,e.onOpen({$event:t}),e.$apply("ngModel")})):(t.off("click dblclick doubletap contextmenu"),t.on("click",function(t){i(t),e.$apply("ngModel")}),t.on("dblclick",function(t){e.onOpen({$event:t}),e.ngModel=!1,e.$apply("ngModel")}))}r()&&t.bind("touchstart",function(e){var n=e.timeStamp,r=t.data("lastTouch")||n,i=n-r,o=e.originalEvent.touches.length;t.data("lastTouch",n),!i||i>500||o>1||(e.preventDefault(),t.trigger("dblclick"))}),s.$("body").on("click.explorer",function(n){if(0===s.$(n.target).parents("explorer, .explorer, .toggle, .lightbox").length&&!s.$(n.target).is(".lightbox")&&"EXPLORER"!==n.target.nodeName&&(s.$(n.target).parents("body").length||"BODY"===n.target.nodeName)){var r=e.ngModel;e.ngModel=!1,e.$apply("ngModel"),e.ngChange&&1==r&&e.ngChange({$event:n}),e.$apply(),t.removeClass("selected")}}),a(),s.$(window).on("resize",function(){a(!0)}),e.$watch("ngModel",function(e){e?t.addClass("selected"):t.removeClass("selected")}),e.$on("$destroy",function(){s.$("body").off("click.explorer")})}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388);t.filePickerList=r.ng.directive("filePickerList",function(){return{restrict:"E",scope:{files:"=",multiple:"@",hideList:"@?"},template:'\n\t\t\t<div class="file-picker-list" show="display.listFiles">\n\t\t\t\t<div class="row media-library">\n <container template="pick"></container>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t',link:function(e,t,n){r.template.open("pick","entcore/file-picker-list/pick"),e.display||(e.display={}),e.picked={},e.filesArray=[],r.$("body").on("dragenter",".icons-view",function(e){return e.preventDefault()}),r.$("body").on("dragover",".icons-view",function(e){return e.preventDefault()}),t.on("dragenter",function(e){return e.preventDefault()}),t.on("dragover",function(e){t.find(".drop-zone").addClass("dragover"),e.preventDefault()}),t.on("dragleave",function(){t.find(".drop-zone").removeClass("dragover")});var i=function(n){n.originalEvent.dataTransfer.files.length&&(t.find(".drop-zone").removeClass("dragover"),n.preventDefault(),e.listFiles(n.originalEvent.dataTransfer.files),e.hideList||(e.display.listFiles=!0),e.$apply())};e.listFiles=function(t){t||(t=e.picked.files),e.filesArray=Array.from(t),e.files=e.filesArray,e.hideList?e.$apply():r.template.open("pick","entcore/file-picker-list/list")},r.$("body").on("drop",".icons-view",i),t.on("drop",i),e.delete=function(t){e.filesArray=e.filesArray.filter(function(e){return e!=t}),e.filesArray&&0==e.filesArray.length&&r.template.open("pick","entcore/file-picker-list/pick")},e.getIconClass=function(e){return r.Document.role(e)},e.getSizeHumanReadable=function(e){var t=e/1024;return t>1024?parseInt(t/1024*10)/10+" Mo":Math.ceil(t)+" Ko"}}}})},function(e,t,n){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},s=this;Object.defineProperty(t,"__esModule",{value:!0});var a=n(943),u=n(391),c=u.workspace.v2.models,l=n(3),d=u.workspace.v2.service;t.folderPicker=a.ng.directive("folderPicker",["$timeout",function(e){return{restrict:"E",scope:{folderProps:"="},template:'\n <div class="horizontal-spacing-twice">\n <h2 translate content="[[folderProps.i18.title]]"></h2>\n <div ng-if="isStateNormal()">\n <div class="row" ng-if="folderProps.i18.info">\n <div class="info" translate content="[[folderProps.i18.info]]"></div>\n </div>\n <div class="row">\n <div class="search-pagination ">\n <a ng-class="{\'show-close\':canResetSearch()}" ng-show="canResetSearch()" ng-click="resetSearch()"><i class="blue-1d close horizontal-spacing cell-ellipsis"></i></a>\n <input class="twelve" type="text" ng-model="search.value" ng-keyup="searchKeyUp($event)"\n i18n-placeholder="search">\n <i class="search"></i>\n </div>\n </div>\n <div class="row top-spacing-twice">\n <folder-tree tree-props="treeProps"></folder-tree>\n <hr />\n </div>\n <a ng-if="canOpenEditView()" ng-click="openEditView()" class="twelve cell vertical-spacing"><i18n>folderpicker.folder.edit</i18n></a>\n <div class="row vertical-spacing input-block" ng-if="isEditVew()">\n <div class="six flex-row">\n <input type="text" required ng-model="newFolder.name" class="flex-one" />\n <button ng-click="submitNewFolder()" ng-disabled="!newFolder.name" translate content="create" class="left-spacing-twice"></button>\n </div>\n </div>\n <div class="lightbox-buttons fluid">\n <button class="right-magnet" ng-disabled="cannotSubmit()" ng-click="onSubmit()" translate content="[[folderProps.i18.actionTitle]]"></button>\n <button class="cancel right-magnet" ng-click="onCancel()"><i18n>cancel</i18n></button>\n </div>\n </div>\n <div ng-if="isStateLoading()">\n <div class="flex-row vertical-spacing-four">\n <div class="centered vertical-spacing-four">\n <div class="vertical-spacing-four primary-color">\n <h2 translate content="[[folderProps.i18.actionProcessing]]"></h2><i class="loading loadingCopy"></i>\n </div>\n </div>\n </div>\n </div>\n <div ng-if="isStateLoaded()">\n <div class="flex-row vertical-spacing-four">\n <div class="centered vertical-spacing-four">\n <div class="vertical-spacing-four valid-color">\n <h2 translate content="[[folderProps.i18.actionFinished]]" class="valid-color"></h2>\n </div>\n </div>\n </div>\n </div>\n <div ng-if="isStateEmpty()">\n <div class="flex-row vertical-spacing-four">\n <div class="centered vertical-spacing-four">\n <div class="vertical-spacing-four warning-color">\n <h2 translate content="[[folderProps.i18.actionEmpty]]" class="warning-color"></h2>\n </div>\n </div>\n </div>\n </div>\n </div>\n ',link:function(t,n,a){return i(s,void 0,void 0,function(){var n,s,a,h,f,p,m,_,v,y,g,b,w,M,k,L;return o(this,function(x){switch(x.label){case 0:return t.search={value:""},(t.newFolder=c.emptyFolder(),t.safeApply=function(e){var t=this.$root.$$phase;"$apply"==t||"$digest"==t?e&&"function"==typeof e&&e():this.$apply(e)},t.folderProps.treeProvider)?(n=t,[4,t.folderProps.treeProvider()]):[3,2];case 1:return n.trees=x.sent(),[3,4];case 2:return[4,d.fetchTrees({filter:"all",hierarchical:!0})];case 3:for(s=x.sent(),t.trees=[],a=0,h=s;a<h.length;a++)switch(f=h[a],f.filter){case"owner":t.trees[0]=f,f.name=l.idiom.translate("workspace.myDocuments");break;case"shared":t.trees[1]=f,f.name=l.idiom.translate("workspace.sharedDocuments");break;case"protected":t.trees[2]=f,f.name=l.idiom.translate("workspace.appDocuments");break;case"public":t.trees[3]=f,f.name=l.idiom.translate("workspace.publicDocuments")}x.label=4;case 4:return p=function(e){if(e.filter)return"owner"==e.filter;var t=L();return e.canCopyFileIdsInto(t)},m=t.trees=t.trees.filter(function(e){return"owner"==e.filter||"shared"==e.filter}),_=function(e){if(!t.search.value||0==t.search.value.trim().length)return!0;var n=t.search.value.toLowerCase();return(e.name?e.name.toLowerCase():"").startsWith(n)},v=function(e){for(var t=[],n=0,r=e;n<r.length;n++){var i=r[n],o=v(i.children||[]);if(o.length||_(i)){var s=new c.Element;Object.assign(s,i),s.children=o,t.push(s)}}return t},y=function(){if(t.search.value&&t.search.value.trim().length>0){for(var e=[],n=0,i=m;n<i.length;n++){var o=i[n],s=r({},o);s.children=v(o.children),e.push(s)}t.trees=e}else t.trees=m;g=null,t.safeApply()},g=null,b=null,t.treeProps={cssTree:"maxheight-half-vh",get trees(){return t.trees},isDisabled:function(e){return!p(e)},isOpenedFolder:function(e){return b===e||(!(!e.filter||d.isLazyMode())||b&&d.findFolderInTreeByRefOrId(e,b))},isSelectedFolder:function(e){return g===e},openFolder:function(e){b=p(e)?g=e:e}},t.canResetSearch=function(){return t.search.value&&t.search.value.trim().length>0},t.resetSearch=function(){t.search.value="",y()},t.searchKeyUp=function(){y()},w=!1,t.openEditView=function(){t.newFolder=c.emptyFolder(),w=!0},t.canOpenEditView=function(){return!!g&&!w},t.isEditVew=function(){return w},t.submitNewFolder=function(){return i(this,void 0,void 0,function(){var e;return o(this,function(n){switch(n.label){case 0:return[4,d.createFolder(t.newFolder,g)];case 1:return e=n.sent(),w=!1,e instanceof c.Element&&(g.children.push(e),g=t.newFolder),t.newFolder=c.emptyFolder(),t.safeApply(),[2]}})})},M="normal",t.isStateNormal=function(){return"normal"==M},t.isStateLoading=function(){return"loading"==M},t.isStateLoaded=function(){return"loaded"==M},t.isStateEmpty=function(){return"empty"==M},k=function(e){M=e,t.safeApply()},t.onCancel=function(){t.folderProps.onCancel(),k("normal")},t.cannotSubmit=function(){return!g},L=function(){var e=t.folderProps.sources.filter(function(e){return"copy-from-file"==e.action}),n=t.folderProps.sources.filter(function(e){return"move-from-file"==e.action}),r=e.map(function(e){return e.fileId}),i=n.map(function(e){return e.fileId});return r.concat(i)},t.onSubmit=function(){return i(this,void 0,void 0,function(){var n,r,i,s,a,c,l,c,h,f,p;return o(this,function(o){switch(o.label){case 0:if(t.folderProps.manageSubmit&&t.folderProps.manageSubmit(g)&&t.folderProps.submit)return t.folderProps.submit(g),[2];o.label=1;case 1:return o.trys.push([1,8,,9]),(k("loading"),n=t.folderProps.sources.length,r=t.folderProps.sources.filter(function(e){return"copy-from-file"==e.action}),i=t.folderProps.sources.filter(function(e){return"move-from-file"==e.action}),s=t.folderProps.sources.filter(function(e){return"create-from-blob"==e.action}),a="loaded",r.length)?(c=r.map(function(e){return e.fileId}),[4,d.copyAllFromIds(c,g)]):[3,3];case 2:l=o.sent(),0==l.copies.length&&(t.folderProps.i18.actionEmpty=t.folderProps.i18.actionEmpty||"folderpicker.copy.empty.text",a="empty"),o.label=3;case 3:return i.length?(c=i.map(function(e){return e.fileId}),[4,d.moveAllFromIds(c,g)]):[3,5];case 4:o.sent(),o.label=5;case 5:return s.length?(h=s.map(function(e){var t=new u.Document;return e.title&&(t.name=e.title),d.createDocument(e.content,t,g)}),[4,Promise.all(h)]):[3,7];case 6:o.sent(),o.label=7;case 7:return k(a),e(function(){k("normal"),t.folderProps.onSubmitSuccess(g,n)},1e3),[3,9];case 8:return f=o.sent(),console.error(f),p=f.responseJSON,t.folderProps.onError&&t.folderProps.onError(p),[3,9];case 9:return[2]}})})},t.safeApply(),[2]}})})}}}])},function(e,t,n){"use strict";function r(e,t,n){angular.isFunction(n)&&(n={post:n});var r,i=t.contents().remove();return{pre:n&&n.pre?n.pre:null,post:function(t,o){r||(r=e(i)),r(t,function(e){o.append(e)}),n&&n.post&&n.post.apply(null,arguments)}}}var i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},s=this;Object.defineProperty(t,"__esModule",{value:!0});var a=n(943),u=n(391),c=u.workspace.v2.models,l=n(550);t.folderTreeInner=a.ng.directive("folderTreeInner",["$compile",function(e){return{restrict:"E",scope:{treeProps:"=",folder:"="},template:' \n <a ng-class="{ selected: isSelectedFolder(), opened: isOpenedFolder(),\'disabled-color\':isDisabled() }" ng-click="openFolder()" ng-if="folder.name !== undefined"\n class="folder-list-item">\n <i class="arrow" ng-if="canExpendTree()" ng-class="{\'disabled-color\':isDisabled() }"></i> [[translate()]] <i class="loading" ng-if="folder.isChildrenLoading"></i>\n </a>\n <ul data-ng-class="{ selected: isOpenedFolder(), closed: !isOpenedFolder() }" ng-if="isOpenedFolder()">\n <li data-ng-repeat="child in folder.children">\n <folder-tree-inner folder="child" tree-props="treeProps"></folder-tree-inner>\n </li>\n </ul>',compile:function(t){return r(e,t,function(e){e.safeApply=function(e){var t=this.$root.$$phase;"$apply"==t||"$digest"==t?e&&"function"==typeof e&&e():this.$apply(e)},e.canExpendTree=function(){return l.workspaceService.isLazyMode()?e.folder.children.length>0||e.folder.cacheChildren.isEmpty:e.folder.children.length>0},e.isSelectedFolder=function(){return e.treeProps.isSelectedFolder(e.folder)},e.isOpenedFolder=function(){return e.treeProps.isOpenedFolder(e.folder)},e.openFolder=function(){return i(this,void 0,void 0,function(){var t,n;return o(this,function(r){switch(r.label){case 0:return l.workspaceService.isLazyMode()?e.folder instanceof c.ElementTree?(t=e.folder,[4,l.workspaceService.fetchChildrenForRoot(t,{filter:t.filter,hierarchical:!1},null,{onlyFolders:!0})]):[3,2]:[3,4];case 1:return r.sent(),[3,4];case 2:return[4,l.workspaceService.fetchChildren(e.folder,{filter:"all",hierarchical:!1},null,{onlyFolders:!0})];case 3:r.sent(),r.label=4;case 4:return n=e.treeProps.openFolder(e.folder),e.safeApply(),[2,n]}})})},e.translate=function(){return e.folder.name},e.isDisabled=function(){return e.treeProps.isDisabled(e.folder)}})}}}]),t.folderTree=a.ng.directive("folderTree",["$templateCache",function(e){return{restrict:"E",scope:{treeProps:"="},template:'\n <nav class="vertical mobile-navigation" ng-class="treeProps.cssTree">\n <ul>\n <li data-ng-repeat="folder in trees()">\n <folder-tree-inner folder="folder" tree-props="treeProps"></folder-tree-inner>\n </li>\n </ul> \n </nav>\n ',link:function(e,t,n){return i(s,void 0,void 0,function(){return o(this,function(t){return e.trees=function(){return e.treeProps?e.treeProps.trees:[]},[2]})})}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388);t.foldingList=r.ng.directive("foldingList",function(){return{restrict:"E",template:function(e,t){for(var n="",r=e.children(),i=0,o=r.length;i<o;i++)n+=r[i].outerHTML;return'\n <span ng-repeat="content in (contents = (filtered = (ngModel | filter: filter)) | limitTo: localLimit)">'+n+'</span>\n <label ng-if="filtered.length > limit && opened" class="chip selected no-margin initial-line-height" ng-click="close()">\n <span class="cell"><i18n>portal.refold</i18n><i class="up-open left-spacing"></i></span>\n </label>\n <label ng-if="filtered.length > limit && !opened" class="chip selected no-margin initial-line-height" ng-click="open()">\n <span class="cell">... <i18n>chip.more1</i18n> [[filtered.length - limit]] <i18n>chip.more2</i18n><i class="down-open left-spacing"></i></span>\n </label>\n '},scope:{ngModel:"=",limit:"=",filter:"&"},link:function(e,t,n){e.opened=!1,e.localLimit=e.limit,e.open=function(){e.localLimit=e.ngModel.length,e.opened=!0},e.close=function(){e.localLimit=e.limit,e.opened=!1}}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388);t.groupsUsersSelector=r.ng.directive("groupsUsersSelector",function(){return{restrict:"E",template:'\n <div class="flex-row align-start vertical-spacing-twice">\n <div class="cell six horizontal-spacing">\n <h4><i18n>portal.group.added</i18n></h4>\n <div style="overflow-y: auto; max-height: 210px;">\n <contact-chip class="block relative removable" ng-class="{selected: group.selected}"\n ng-model="group"\n action="selectGroupItem(item)"\n action-icon="removeItem(item)"\n ng-repeat="group in groupsList"\n isgroup stickernotselected isnotlinked>\n </contact-chip>\n <div class="small-text" ng-if="groupsList.length === 0 && !selector.loading">\n <i18n>portal.group.none.added</i18n>\n </div>\n </div>\n <div class="row centered-text reduce-block-six" ng-if="selector.loading">\n <img skin-src="/img/illustrations/loading.gif" width="30px" heigh="30px"/>\n </div>\n </div>\n <div class="cell six horizontal-spacing">\n <h4><i18n>portal.user.added</i18n></h4>\n <div class="small-text row" ng-if="usersList.length > 0">\n <input type="text" class="six cell" autocomplete="off" ng-model="selector.search" i18n-placeholder="portal.search" /><span class="one cell">&nbsp;</span><label>[[getTotalUser().ok]] <i18n>portal.users</i18n></label>\n </div>\n <div id="userScroll" style="overflow-y: auto; max-height: 170px;">\n <contact-chip id=\'user-[[id(user)]]\' class="block relative removable" ng-class="{selected: user.selected}"\n ng-if="!user.exclude"\n ng-model="user"\n action="removeItem(item)"\n ng-repeat="user in usersList | filter:filterAllUser()"\n stickernotselected>\n </contact-chip>\n <div class="small-text" ng-if="usersList.length === 0 && !selector.loading">\n <i18n>portal.user.none.added</i18n>\n </div>\n </div>\n <div class="row centered-text reduce-block-six" ng-if="selector.loading">\n <img skin-src="/img/illustrations/loading.gif" width="30px" heigh="30px"/>\n </div>\n </div>\n </div>\n ',scope:{groupsList:"=",usersList:"=",selector:"="},link:function(e,t,n){function i(t){r._.forEach(e.groupsList,function(n){t&&e.id(t)===e.id(n)||(n.selected=!1)}),r._.forEach(e.usersList,function(e){e.selected=!1})}e.id=function(e){return e.id?e.id:e._id},e.selectGroupItem=function(t){i(t),t.selected=!t.selected,e.selector.selectedGroup=t.selected,r._.forEach(e.usersList,function(n){n.groupId===e.id(t)&&(n.selected=t.selected)})},e.removeItem=function(t){var n="group"==t.groupOrUser?e.groupsList:e.usersList;if("group"===t.groupOrUser)e.usersList=r._.reject(e.usersList,function(n){return n&&n.groupId&&e.id(t)===n.groupId});else{if(t.groupId){t.exclude=!0;var i=!0;r._.forEach(e.usersList,function(e){if(t.groupId===e.groupId&&!e.exclude)return i=!1,!1}),i?(e.groupsList=r._.reject(e.groupsList,function(n){return n&&t.groupId===e.id(n)}),e.usersList=r._.reject(e.usersList,function(e){return e&&e.groupId&&t.groupId===e.groupId})):e.selector.selectedGroup=!0,e.usersList=r._.reject(e.usersList,function(e){return e&&!e.exclude&&t.name===e.name})}r._.forEach(e.usersList,function(e){e&&e.groupId&&t.name===e.name&&(e.exclude=!0)})}if(!t.exclude){var o=n.indexOf(t);-1!==o&&n.splice(o,1)}},e.getTotalUser=function(){return e.usersList&&e.usersList.length>0?r._.countBy(e.usersList,function(e){return e&&!0===e.exclude?"exclude":"ok"}):{ok:0}},e.filterAllUser=function(){return function(t){var n=r.idiom.removeAccents(e.selector.search).toLowerCase();return!n||-1!==r.idiom.removeAccents(t.name).toLowerCase().indexOf(n)}}}}})},function(e,t,n){"use strict";function r(e,t,n){var r=null,o=null,s=null,a=null;switch(e){case"left":s=t.left-25,o=t.top;break;case"right":r=t.right+25,o=t.top;break;case"top":r=t.left,a=t.top-25;break;case"bottom":r=t.left,o=t.bottom+25}var u=function(e){return null!=e&&e+"px"};return o=i(o,n),{position:"fixed",top:u(o),left:u(r),bottom:u(a),right:u(s)}}function i(e,t){if(e<0)return 0;var n=jQuery(window).height(),r=n-(e+t);return r<0?e+r:e}function o(e,t){var n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return{}.bottom=n.bottom-r.bottom,n.top<r.top?n.top-r.top:n.bottom>r.bottom?n.bottom-r.bottom:0}function s(e,t,n){var r=window.getComputedStyle?window.getComputedStyle(e):{};if(t.setAttribute("style",r.cssText),n)for(var i=jQuery(e).find("*"),o=jQuery(t).find("*"),s=i.length;s--;){var a=i[s],u=o[s],c=window.getComputedStyle?window.getComputedStyle(a):{};jQuery(u).removeClass(),u.setAttribute("style",c.cssText)}}function a(e,t){var n=jQuery(e);return"vertical"==t?e.scrollHeight>n.innerHeight():"horizontal"==t&&e.scrollWidth>n.innerWidth()}function u(e){for(var t=jQuery(e),n=t.parents(),r=0;r<n.length;r++){var i=n[r];if(a(i,"vertical")){var s=o(e,i);if(0!=s){var u=jQuery(i),c=u.scrollTop()+s;u.animate({scrollTop:c},{duration:"medium",easing:"swing"})}}}}Object.defineProperty(t,"__esModule",{value:!0});var c=n(388),l=n(551),d=null,h={steps:[],onAdd:new l.Subject,onCurrentChange:new l.Subject,setCurrentStep:function(e){d=e,h.onCurrentChange.next()},getCurrentStep:function(){return d},isCurrentContent:function(e){return h.hasCurrentStep()&&d.content==e},hasCurrentStep:function(){return!!d},addStep:function(e){var t=h.steps.find(function(t){return t.content==e.content});t?Object.assign(t,e):(h.steps.push(e),h.steps=h.steps.sort(function(e,t){return e.priority-t.priority}),h.onAdd.next())},getNextStep:function(e){var t=h.steps.findIndex(function(t){return t===e});return h.steps[t+1]},hasNextStep:function(e){return!!h.getNextStep(e)},hightlight:function(e){for(var t=0,n=h.steps;t<n.length;t++){var r=n[t];r===d?r.highlight(e):r.unhighlight()}}};t.helpBox=c.ng.directive("helpBox",["$timeout","$sce",function(e,t){return{restrict:"E",scope:{onFinished:"&",canClose:"@",display:"@",title:"@",direction:"@"},template:' \n <section class="helpbox-highlight-message" ng-if="visible()">\n <div style="display:none" class="content no-margin message-box block-container four minwidth-400">\n <div class="twelve cell">\n <div class="reduce-block-eight">\n <div class="block-container flex-row center-component ">\n <h3 class="eleven left-text">\n <span class="no-style">[[getTitle()]]</span>\n </h3>\n <p class="eleven justified-text">\n <span class="no-style" ng-bind-html="getContent()"></span>\n </p>\n </div>\n <div class="flex-row align-center">\n <nav class="dots flex-all-remains align-center">\n <ul>\n <li ng-repeat="step in steps" class="dot active" ng-click="goTo(step)" ng-class="{ active: isCurrentStep(step) }"></li>\n </ul>\n </nav>\n <div class="right-magnet align-center">\n <button class="right-magnet no-margin-bottom" ng-click="next()" ng-if="hasNextStep()">\n <span class="no-style"><i18n>helpbox.next</i18n></span>\n </button>\n <button class="right-magnet no-margin-bottom" ng-click="close()" ng-if="!hasNextStep()">\n <span class="no-style"><i18n>helpbox.finish</i18n></span>\n </button>\n </div>\n </div>\n </div>\n </div>\n <div class="close-lightbox" ng-if="!hasNextStep()" ng-click="close()"><i class="close-2x"></i></div></div>\n </section>\n ',compile:function(n,i){return{pre:function(n,i,o,s,a){var u=!1,l=function(){return!0===n.display||"true"===n.display};n.start=function(){!u&&l()&&h.steps.length&&(u=!0,n.goTo(h.steps[0]))},n.close=function(){n.display=!1,h.setCurrentStep(null),h.hightlight(function(){}),n.onFinished&&n.onFinished(),u=!1};var d=!0;n.goTo=function(e){h.setCurrentStep(e),h.hightlight(function(){var e=h.getCurrentStep().getHtml(),t=e.getBoundingClientRect(),o=n.direction||"right",s=i.find(".content"),a=s.height(),u=r(o,t,a);s.css(u),d&&(s.css({display:"block"}),d=!1)}),h.hasCurrentStep()&&(h.getCurrentStep().title=h.getCurrentStep().title||c.idiom.translate(n.title))},h.onAdd.debounceTime(600).subscribe(function(t){e(function(){n.start()})}),h.onAdd.next(),n.$watch("display",function(){h.onAdd.next()}),n.getTitle=function(){return h.hasCurrentStep()&&h.getCurrentStep().title},n.getContent=function(){var e=h.hasCurrentStep()&&h.getCurrentStep().content;return t.trustAsHtml(e)},n.hasNextStep=function(){return h.hasNextStep(h.getCurrentStep())},n.next=function(){var e=h.getNextStep(h.getCurrentStep());n.goTo(e)},n.isCurrentStep=function(e){return h.getCurrentStep()===e},n.visible=function(){return l()&&!!h.getCurrentStep()}},post:function(e,t,n,r,i){}}}}}]),t.helpBoxStep=c.ng.directive("helpBoxStep",["$timeout",function(e){return{restrict:"A",scope:{helpBoxStepTitle:"@",helpBoxStepPriority:"@",helpBoxStep:"@"},link:function(e,t,n){t.removeClass("helpbox-highlight");var r=null;e.helpBoxStep&&h.addStep({content:c.idiom.translate(e.helpBoxStep),title:e.helpBoxStepTitle?c.idiom.translate(e.helpBoxStepTitle):null,priority:e.helpBoxStepPriority||0,getHtml:function(){return t[0]},highlight:function(e){var n=this;r&&jQuery(r).remove();var i=t[0];u(i),setTimeout(function(){r=jQuery(i).clone(),jQuery("body").append(r),r.removeClass(),r.addClass("helpbox-highlight"),s(i,r[0],!0);var t=function(){var t=i.getBoundingClientRect();r.css({position:"fixed",top:t.top,left:t.left,width:t.width,height:t.height,margin:0}),e()};n.reposition=t,jQuery(window).scroll(n.reposition),jQuery(window).on("resize",n.reposition),t()},300)},unhighlight:function(){r&&jQuery(r).remove(),jQuery(window).off("scroll",this.reposition),jQuery(window).off("resize",this.reposition)}})}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943);t.imageCompression=r.ng.directive("imageCompression",function(){return{restrict:"E",templateUrl:"/assets/js/entcore/template/compression.html",scope:{document:"="},link:function(e,t,n){var r=document.createElement("canvas"),i=t.find("canvas")[0];i.height=280,i.width=468;var o,s=t.find("canvas")[0].getContext("2d"),a=r.getContext("2d"),u=new Image,c=(new Image,new Image),l=function(e){s.clearRect(0,0,i.width,i.height);var t=0,n=0,r=e.width,o=1;e.width>468&&(r=468,o=r/e.width),t=140-e.height/2*o,e.width<468&&(n=234-e.width/2*o),s.drawImage(e,n,t,r,r*e.height/e.width)},d=function(t){u.naturalWidth&&(t<0&&(t=.001,e.document.currentQuality=.001),l(u),i.toBlob(function(e){console.log(i.width),o=e;var t=URL.createObjectURL(o);c.onload=function(){return l(c)},c.src=t},"image/jpeg",e.document.currentQuality),r.width=u.width,r.height=u.height,a.drawImage(u,0,0),r.toBlob(function(t){(e.document.hiddenBlob||1!==e.document.currentQuality)&&t.size<=e.document.metadata.size?e.document.hiddenBlob=t:e.document.hiddenBlob=void 0,e.$apply()},"image/jpeg",e.document.currentQuality))},h=function(){e.document.currentQuality||(e.document.currentQuality=1),u.src="/workspace/document/"+e.document._id+"?v="+parseInt(100*Math.random()),u.onload=function(){l(u),d(e.document.currentQuality)}};e.document&&h();var f="Ko";e.blobSize=function(){if(!e.document.hiddenBlob)return f=e.document.size.split(" ")[1],parseInt(e.document.size);f="Ko";var t=e.document.hiddenBlob.size/1024,n=t/1024;return n>=1?(f="Mo",Math.round(10*n)/10):Math.round(t)},e.blobUnit=function(){return f},e.$watch(function(){return e.document.currentQuality},function(){return d(e.document.currentQuality)}),e.$watch("document",function(){return h()}),e.document.eventer.on("save",function(){return h()})}}})},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},o=this;Object.defineProperty(t,"__esModule",{value:!0});var s=n(943),a=n(38),u=n(988),c=n(390),l=n(994);t.imageEditor=s.ng.directive("imageEditor",function(){return{restrict:"E",scope:{document:"=",onSave:"&",show:"=",inline:"@"},template:'\n <div ng-if="show && inline && ready">\n <i ng-if="display.isImageLoading" class="loading image-loading"></i>\n <container template="entcore/image-editor/main" guard-ignore-template></container>\n </div>\n <div ng-if="show && !inline && ready">\n <lightbox show="show" on-close="hide()">\n <i ng-if="display.isImageLoading" class="loading image-loading"></i>\n <container template="entcore/image-editor/main" guard-ignore-template></container>\n </lightbox>\n </div>\n ',link:function(e,t,n){e.display||(e.display={}),void 0!==n.inline&&(n.inline=!0),a.devices.isIE()&&0===t.find("style").length&&t.append("<style>image-editor .output { display: block }</style>"),e.template=c.template,c.template.open("entcore/image-editor/main");var s=new u.ImageEditor,d=function(){return r(o,void 0,void 0,function(){var n=this;return i(this,function(o){return e.ready=!0,e.display.isImageLoading=!0,setTimeout(function(){return r(n,void 0,void 0,function(){return i(this,function(n){switch(n.label){case 0:return[4,u.ImageEditor.init()];case 1:return n.sent(),s.draw(t.find("section").last()),[4,s.drawDocument(e.document)];case 2:return n.sent(),e.openTool("Rotate"),e.display.isImageLoading=!1,s.imageView.backup(),e.$apply(),[2]}})})},300),[2]})})};e.scale=function(){return s.tool?Math.ceil(1/s.tool.scale*10)/10:1},e.setWidth=function(){s.tool instanceof l.Resize&&s.tool.setWidth(e.document.width)},e.setHeight=function(){s.tool instanceof l.Resize&&s.tool.setHeight(e.document.height)},e.openTool=function(n){return r(o,void 0,void 0,function(){return i(this,function(r){switch(r.label){case 0:return c.template.open("entcore/image-editor/tool","entcore/image-editor/"+n.toLowerCase()),t.find(".output, .tools-background").show(),[4,s.useTool(n)];case 1:return r.sent(),e.$apply(),[2]}})})},e.openProperties=function(){return r(o,void 0,void 0,function(){return i(this,function(e){return s.tool.stop(),s.tool=void 0,c.template.open("entcore/image-editor/tool","entcore/image-editor/properties"),t.find(".output, .tools-background").hide(),[2]})})},e.apply=function(){return r(o,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,s.applyChanges()];case 1:return t.sent(),e.$apply(),[2]}})})},e.restoreOriginal=function(){return r(o,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,s.restoreOriginal()];case 1:return t.sent(),e.$apply(),[2]}})})},e.hasHistory=function(){return s.hasHistory},e.canApply=function(){return s.canApply},e.undo=function(){return r(o,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,s.undo()];case 1:return t.sent(),e.$apply(),[2]}})})},e.cancel=function(){return r(o,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,s.cancel(!0)];case 1:return t.sent(),e.$apply(),[2]}})})},e.save=function(){return r(o,void 0,void 0,function(){var t;return i(this,function(n){switch(n.label){case 0:return e.loading=!0,t=/[\/\\<>|]/g,s.document.name=s.document.name.trim().replace(t,""),s.canApply?[4,s.applyChanges()]:[3,2];case 1:n.sent(),n.label=2;case 2:return[4,s.saveChanges()];case 3:return n.sent(),"function"==typeof e.onSave&&(e.onSave(),e.loading=!1),e.show=!1,e.loading=!1,e.$apply(),[2]}})})},e.hide=function(){e.document.resetNewProperties(),e.show=!1,e.$$phase||e.$parent.$apply()},e.$watch(function(){return e.show},function(){e.show&&d()}),e.$on("destroy",function(){return s.destroy()}),e.preventForbiddenChars=function(e){var t=/[\/\\<>|]/,n=e.key;t.test(n)&&e.preventDefault()}}}})},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(exports,"__esModule",{value:!0});var axios_1=__webpack_require__(7),entcore_toolkit_1=__webpack_require__(393),ImageView_1=__webpack_require__(989),imageTools=__webpack_require__(991),jquery_1=__webpack_require__(1),eventer=new entcore_toolkit_1.Eventer,editorWidth=680,editorHeight=400,ImageEditor=function(){function ImageEditor(){this.imageView=new ImageView_1.ImageView}return ImageEditor.prototype.destroy=function(){this.imageView.renderer.destroy()},ImageEditor.prototype.cancel=function(e){return void 0===e&&(e=!1),__awaiter(this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return jquery_1.$(this.imageView.renderer.view).css({opacity:0}),this.imageView.appliedIndex||this.imageView.pendingChanges?(this.document.hiddenBlob=this.imageView.history[this.imageView.appliedIndex],[4,this.imageView.loadBlob(this.imageView.history[this.imageView.appliedIndex])]):[3,2];case 1:t.sent(),t.label=2;case 2:return e||this.imageView.resetHistory(),[4,this.imageView.backup()];case 3:return t.sent(),e?this.imageView.historyIndex=this.imageView.appliedIndex:(this.imageView.historyIndex=0,this.imageView.appliedIndex=0),jquery_1.$(this.imageView.renderer.view).css({opacity:1}),[2]}})})},ImageEditor.prototype.useTool=function(e,t){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(n){switch(n.label){case 0:return this.tool&&this.tool.stop(),this.imageView.historyIndex>0?[4,this.cancel()]:[3,2];case 1:return n.sent(),[3,3];case 2:this.imageView.historyIndex=0,this.imageView.appliedIndex=0,n.label=3;case 3:return this.renderer&&this.renderer.destroy(),"Blur"!==e?this.drawCanvas():this.drawGl(),t=new imageTools[e],this.imageView.setStage(),this.tool=t,t.start(this.imageView,this.editingElement),[2]}})})},ImageEditor.prototype.applyChanges=function(e){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return this.tool?[4,this.tool.apply(e)]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.imageView.appliedIndex=this.imageView.historyIndex,this.imageView.pendingChanges=!1,[2]}})})},ImageEditor.prototype.saveChanges=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return this.imageView.history.length&&(this.document.hiddenBlob=this.imageView.history[this.imageView.appliedIndex]),[4,this.document.saveChanges()];case 1:return e.sent(),[2]}})})},Object.defineProperty(ImageEditor.prototype,"hasHistory",{get:function(){return this.imageView.hasHistory},enumerable:!0,configurable:!0}),Object.defineProperty(ImageEditor.prototype,"canApply",{get:function(){return this.imageView.pendingChanges},enumerable:!0,configurable:!0}),ImageEditor.init=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,new Promise(function(resolve,reject){return ImageEditor.loaded?void resolve():ImageEditor.loading?void eventer.on("loaded",function(){return resolve()}):(ImageEditor.loading=!0,window.toBlobPolyfillLoaded||axios_1.default.get("/infra/public/js/toBlob-polyfill.js").then(function(response){eval(response.data),window.toBlobPolyfillLoaded=!0}),void axios_1.default.get("/infra/public/js/pixi.min.js").then(function(response){eval(response.data),ImageEditor.loaded=!0,ImageEditor.loading=!1,resolve(),eventer.trigger("loaded")}))})]})})},ImageEditor.prototype.drawGl=function(){this.editingElement.find("canvas").remove(),this.renderer=PIXI.autoDetectRenderer(editorWidth,editorHeight,{preserveDrawingBuffer:!0,transparent:!0}),this.imageView.renderer=this.renderer,this.editingElement.find(".output").append(this.renderer.view),this.imageView.setStage()},ImageEditor.prototype.drawCanvas=function(){this.editingElement.find("canvas").remove(),this.renderer=new PIXI.CanvasRenderer(editorWidth,editorHeight,{preserveDrawingBuffer:!0,transparent:!0}),this.imageView.renderer=this.renderer,this.editingElement.find(".output").append(this.renderer.view),this.imageView.setStage()},ImageEditor.prototype.draw=function(e){this.editingElement=e},ImageEditor.prototype.drawDocument=function(e){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(n){switch(n.label){case 0:return e.hiddenBlob?(t=URL.createObjectURL(e.hiddenBlob),[4,this.imageView.load(t,this.editingElement,e.metadata["content-type"])]):[3,2];case 1:return n.sent(),[3,4];case 2:return[4,this.imageView.load("/workspace/document/"+e._id+"?v="+parseInt(100*Math.random()),this.editingElement,e.metadata["content-type"])];case 3:n.sent(),n.label=4;case 4:return this.document=e,[2]}})})},ImageEditor.prototype.restoreOriginal=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return this.imageView.resetHistory(),[4,this.imageView.loadBlob(this.imageView.originalImage)];case 1:return e.sent(),this.document.hiddenBlob=this.imageView.originalImage,this.tool.placeTools(),[2]}})})},ImageEditor.prototype.undo=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return[4,this.imageView.undo()];case 1:return e.sent(),this.tool.placeTools(),[2]}})})},ImageEditor}();exports.ImageEditor=ImageEditor},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(393),s=n(990),a=function(){function e(){this.history=[],this.eventer=new o.Eventer}return e.prototype.paint=function(e){var t=this;return new Promise(function(n,o){t.stage=new PIXI.Container,t.sprite=new PIXI.Sprite(PIXI.loader.resources[e].texture),t.stage.addChild(t.sprite),setTimeout(function(){return r(t,void 0,void 0,function(){var e=this;return i(this,function(t){return this.sprite.pivot.set(this.sprite.width/2,this.sprite.height/2),this.sprite.position={x:this.sprite.width/2,y:this.sprite.height/2},this.historyIndex=0,requestAnimationFrame(function(){return e.editingElement.find(".tools-background").height(e.editingElement.find(".output").height())}),n(),[2]})})},100)})},e.prototype.render=function(){this.renderer.render(this.stage)},e.prototype.resetHistory=function(){this.appliedIndex=0,this.historyIndex=0,this.history=[],this.pendingChanges=!1},Object.defineProperty(e.prototype,"hasHistory",{get:function(){return this.appliedIndex>0||this.pendingChanges&&this.historyIndex>0},enumerable:!0,configurable:!0}),e.prototype.loadImage=function(e,t){var n=this;return void 0===t&&(t=!0),new Promise(function(r,i){if(n.stage.removeChildren(),n.sprite=new PIXI.Sprite(PIXI.Texture.from(e)),n.stage.addChild(n.sprite),n.renderer.render(n.stage),!t)return void r();setTimeout(function(){n.sprite.pivot.set(n.sprite.width/2,n.sprite.height/2),s.$(n.renderer).attr("data-locked-size")||n.renderer.resize(n.sprite.width,n.sprite.height),n.sprite.position={x:n.sprite.width/2,y:n.sprite.height/2},n.render(),n.eventer.trigger("image-loaded"),r()},100)})},e.prototype.setOverlay=function(){this.editingElement.find(".overlay").width(s.$(this.editingElement.find(".output")).width()),this.editingElement.find(".overlay").height(s.$(this.editingElement.find(".output")).height())},e.prototype.load=function(e,t,n){var r=this;return this.format=n,new Promise(function(n,i){r.editingElement=t;var o=function(){r.paint(e).then(function(){return n()}),r.eventer.trigger("loaded-"+e)};if(PIXI.loader.resources[e])return PIXI.loader.resources[e].isLoading?void r.eventer.once("loaded-"+e,o):void o();var s={loadType:PIXI.loaders.Resource.LOAD_TYPE.IMAGE,xhrType:PIXI.loaders.Resource.XHR_RESPONSE_TYPE.BLOB};PIXI.loader.add(e,e,s).load(o)})},e.prototype.loadBlob=function(e,t){var n=this;return void 0===t&&(t=!0),new Promise(function(r,i){var o=URL.createObjectURL(e),s=new Image;s.src=o,s.onload=function(){n.loadImage(s,t).then(function(){return r()})}})},e.prototype.setStage=function(){this.renderer.render(this.stage),this.renderer.resize(this.sprite.width,this.sprite.height),this.renderer.render(this.stage)},e.prototype.undo=function(){var e=this;return s.$(this.renderer.view).css({opacity:0}),new Promise(function(t,n){setTimeout(function(){return r(e,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return this.historyIndex--,this.appliedIndex>this.historyIndex&&(this.appliedIndex=this.historyIndex),[4,this.loadBlob(this.history[this.historyIndex])];case 1:return e.sent(),s.$(this.renderer.view).css({opacity:1}),t(),[2]}})})},150)})},e.prototype.backup=function(e,t){var n=this;return void 0===e&&(e=!0),void 0===t&&(t=!0),new Promise(function(t,r){n.renderer.view.toBlob(function(r){n.render(),n.historyIndex++,angular.element(n.editingElement).scope().$apply(),n.history.splice(n.historyIndex),n.history.push(r),n.historyIndex>n.history.length-1&&(n.historyIndex=n.history.length-1),n.originalImage||(n.originalImage=r),n.loadBlob(r,e).then(function(){t()})},n.format)})},e}();t.ImageView=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),window.CDN_DOMAIN="",function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(388))},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(992)),r(n(993)),r(n(994)),r(n(995))},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(990),s=function(){function e(){this.mouse={x:0,y:0}}return e.prototype.drawBrush=function(){var e=new PIXI.Graphics;return e.beginFill(16777215,1),e.drawCircle(20*this.widthRatio,20*this.heightRatio,20*this.heightRatio),e.lineStyle(0),e.endFill(),e},Object.defineProperty(e.prototype,"outputLeft",{get:function(){return parseInt(o.$(this.imageView.renderer.view).offset().left)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputTop",{get:function(){return parseInt(o.$(this.imageView.renderer.view).offset().top)},enumerable:!0,configurable:!0}),e.prototype.apply=function(e){return r(this,void 0,void 0,function(){return i(this,function(e){return[2]})})},e.prototype.blurAt=function(){var e=PIXI.Texture.fromImage(this.imageView.sprite.texture.baseTexture.imageUrl),t=new PIXI.Rectangle(this.mouse.x-20*this.widthRatio,this.mouse.y-20*this.heightRatio,20*this.widthRatio*2,20*this.heightRatio*2);t.x<0&&(t.x=0),t.y<0&&(t.y=0),t.x+t.width>this.imageView.sprite.width&&(t.width-=t.x+t.width-(this.imageView.sprite.width-10)),t.y+t.height>this.imageView.sprite.height&&(t.height-=t.y+t.height-(this.imageView.sprite.height-10));var n=new PIXI.Texture(e.baseTexture,t),r=new PIXI.Sprite(n);r.filters=[new PIXI.filters.BlurFilter(3*this.widthRatio)],r.width=20*this.widthRatio*2,r.height=20*this.heightRatio*2,r.position={x:this.mouse.x-20*this.widthRatio,y:this.mouse.y-20*this.heightRatio},r.mask=this.drawBrush(),this.imageView.stage.addChild(r),r.addChild(r.mask),this.imageView.render()},e.prototype.placeTools=function(){},e.prototype.stop=function(){this.editingElement.off("mousedown.blur touchstart.blur"),this.editingElement.find(".output").css({cursor:""})},e.prototype.start=function(e,t){var n=this;this.imageView=e,this.editingElement=t;var r,i=function(){n.isBlurring&&(n.blurAt(),r=requestAnimationFrame(i))};t.find(".output").css({cursor:"url(/assets/themes/entcore-css-lib/images/blur.cur) 30 30, pointer"}),t.on("mousedown.blur touchstart.blur",function(e){"CANVAS"===e.target.tagName&&(n.widthRatio=n.imageView.renderer.width/t.find("canvas").width(),n.heightRatio=n.imageView.renderer.height/t.find("canvas").height(),n.drawBrush(),n.mouse={x:((e.pageX||e.originalEvent.touches[0].pageX)-n.outputLeft)*n.widthRatio,y:((e.pageY||e.originalEvent.touches[0].pageY)-n.outputTop)*n.heightRatio},n.isBlurring=!0,i(),o.$(window).on("mousemove.blur touchmove.blur",function(e){n.mouse={x:((e.pageX||e.originalEvent.touches[0].pageX)-n.outputLeft)*n.widthRatio,y:((e.pageY||e.originalEvent.touches[0].pageY)-n.outputTop)*n.heightRatio}}),o.$(window).on("mouseup.blur touchend.blur",function(){o.$(window).off("mousemove.blur mouseup.blur touchend.blur touchmove.blur"),cancelAnimationFrame(r),n.imageView.backup(!0),n.isBlurring=!1,n.imageView.pendingChanges=!0,angular.element(t).scope().$apply()}))})},e}();t.Blur=s},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(990),s=function(){function e(){}return Object.defineProperty(e.prototype,"outputWidth",{get:function(){return parseInt(o.$(this.imageView.renderer.view).width())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputHeight",{get:function(){return parseInt(o.$(this.imageView.renderer.view).height())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputLeft",{get:function(){return parseInt(o.$(this.imageView.renderer.view).position().left)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputTop",{get:function(){return parseInt(o.$(this.imageView.renderer.view).position().top)},enumerable:!0,configurable:!0}),e.prototype.stop=function(){},e.prototype.apply=function(e){var t=this,n=this.editingElement.find(".handle"),o=n.width();n.width()>this.outputWidth&&(o=n.width()-(this.outputLeft-n.position().left));var s=n.height();n.height()>this.outputHeight&&(s=n.height()-(this.outputHeight-n.position().top));var a=n.position().left-this.outputLeft,u=n.position().top-this.outputTop;if(!(a>this.outputWidth||u>this.outputHeight)){a<0&&(a=0),u<0&&(u=0),o+a>this.outputWidth&&(o=this.outputWidth-a),s+u>this.outputHeight&&(s=this.outputHeight-u);var c=PIXI.Texture.fromImage(this.imageView.sprite.texture.baseTexture.imageUrl);this.imageView.stage.removeChildren();var l=new PIXI.Texture(c.baseTexture,new PIXI.Rectangle(parseInt(a*(this.imageView.renderer.width/this.outputWidth)),parseInt(u*(this.imageView.renderer.height/this.outputHeight)),parseInt(o*(this.imageView.renderer.width/this.outputWidth)),parseInt(s*(this.imageView.renderer.height/this.outputHeight))));return this.imageView.sprite=new PIXI.Sprite(l),this.imageView.stage.addChild(this.imageView.sprite),this.imageView.renderer.resize(this.imageView.sprite.width,this.imageView.sprite.height),this.imageView.render(),new Promise(function(e,n){requestAnimationFrame(function(){return r(t,void 0,void 0,function(){var t=this;return i(this,function(n){switch(n.label){case 0:return[4,this.imageView.backup()];case 1:return n.sent(),this.imageView.render(),requestAnimationFrame(function(){t.placeTools(),e()}),[2]}})})})})}},e.prototype.placeTools=function(){this.editingElement.find(".tools-background").height(this.editingElement.find(".output").height()),this.imageView.setOverlay(),this.setHandle()},e.prototype.setHandle=function(){this.handle=this.editingElement.find(".handle"),this.handle.addClass("show"),this.handle.width(o.$(this.imageView.renderer.view).width()-4),this.handle.height(o.$(this.imageView.renderer.view).height()-4),this.handle.css({top:o.$(this.imageView.renderer.view).position().top+"px",left:o.$(this.imageView.renderer.view).position().left+"px"})},e.prototype.start=function(e,t){var n=this;this.imageView=e,this.editingElement=t,this.imageView.render(),setTimeout(function(){n.imageView.setOverlay(),n.setHandle(),n.handle.on("stopResize stopDrag",function(){n.imageView.pendingChanges=!0,angular.element(n.editingElement).scope().$apply()})},200)},e}();t.Crop=s},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(990),s=n(6),a=function(){function e(){}return Object.defineProperty(e.prototype,"ratio",{get:function(){return this.initialSize.width/this.initialSize.height},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scale",{get:function(){if(this._scale)return this._scale;if(!this.imageView||this.isInSetup)return console.log("still in setup, scale is 1"),1;if(this.imageView.sprite.width>this.imageView.sprite.height){var e=this.outputWidth/this.imageView.sprite.width;return console.log(e),console.log(this.imageView.sprite.width),this._scale=e,e>1?(console.log("scale is higher than 1"),this._scale=1,1):e}if(this.imageView.sprite.height<parseInt(this.editingElement.find(".output").css("min-height")))return console.log("small sprite height"),1;var t=this.outputHeight/this.imageView.sprite.height;return this._scale=t,console.log("calc scale from height"),t>1?(console.log("scale is higher than one"),1):t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputWidth",{get:function(){return this.editingElement.find(".output").width()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputHeight",{get:function(){return this.editingElement.find(".output").height()},enumerable:!0,configurable:!0}),e.prototype.stopResizing=function(){this.isResizing=!1,cancelAnimationFrame(this.token),this.imageView.pendingChanges=!0,angular.element(this.editingElement).scope().$apply()},e.prototype.setWidth=function(e){var t=this,n=e/this.ratio*this.scale;this.handle.width(e*this.scale),this.handle.height(n),this.isResizing=!0,this.animate(),setTimeout(function(){return t.stopResizing()},400)},e.prototype.setHeight=function(e){var t=this,n=e*this.ratio*this.scale;this.handle.height(e*this.scale),this.handle.width(n),this.isResizing=!0,this.animate(),setTimeout(function(){return t.stopResizing()},400)},e.prototype.apply=function(e){var t=this;return o.$(this.imageView.renderer.view).css({opacity:0}),new Promise(function(e,n){setTimeout(function(){t.imageView.sprite.scale=new PIXI.Point(1,1),t.imageView.render(),requestAnimationFrame(function(){t.imageView.renderer.resize(t.handle.width()/t.scale,t.handle.height()/t.scale),requestAnimationFrame(function(){t.imageView.sprite.width=t.handle.width()/t.scale,t.imageView.sprite.height=t.handle.height()/t.scale,t.initialSize={width:t.imageView.sprite.width,height:t.imageView.sprite.height},t.imageView.sprite.position={x:t.imageView.sprite.width/2,y:t.imageView.sprite.height/2},t.imageView.render(),requestAnimationFrame(function(){t.imageView.render(),o.$(t.imageView.renderer.view).css({opacity:1}),setTimeout(function(){return r(t,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,this.imageView.backup(!1)];case 1:return t.sent(),e(),this.setup(),[2]}})})},100)})})})},180)})},e.prototype.placeTools=function(){this.initialSize={height:this.imageView.sprite.height,width:this.imageView.sprite.width},this.setup()},e.prototype.resize=function(){this.imageView.sprite.width=parseInt(this.handle.width()),this.imageView.sprite.height=parseInt(this.handle.height()),this.editingElement.find("input[type=text]").first().val(parseInt(this.handle.width()/this.scale)),this.editingElement.find("input[type=text]").last().val(parseInt(this.handle.height()/this.scale)),this.imageView.sprite.position.x=this.handle.position().left+2+this.imageView.sprite.width/2,this.imageView.sprite.position.y=this.handle.position().top+2+this.imageView.sprite.height/2,this.imageView.render()},e.prototype.setHandle=function(){this.handle=this.editingElement.find(".handle"),this.handle.addClass("show"),this.handle.width(this.imageView.sprite.width-4),this.handle.height(this.imageView.sprite.height-4),this.handle.css({top:this.imageView.sprite.position.y-this.imageView.sprite.height/2+"px",left:this.imageView.sprite.position.x-this.imageView.sprite.width/2+"px"}),s.ui.extendElement.resizable(this.handle,{preserveRatio:!0})},e.prototype.lockOutput=function(){this.editingElement.find(".output").height(this.editingElement.find(".output").height())},e.prototype.reset=function(){this.imageView.sprite.width=this.initialSize.width,this.imageView.sprite.height=this.initialSize.height,this.imageView.sprite.pivot.set(this.initialSize.width/2,this.initialSize.height/2),this.imageView.renderer.resize(this.imageView.sprite.width,this.imageView.sprite.height),this.imageView.render(),this._scale=void 0},e.prototype.setup=function(){var e=this;o.$(this.imageView.renderer.view).css({opacity:0}),this.reset(),this.isInSetup=!0,setTimeout(function(){e.imageView.sprite.scale=new PIXI.Point(1,1),o.$(e.imageView.renderer).attr("data-locked-size",!0),e.outputHeight>e.imageView.sprite.height?(e.editingElement.find(".output").height(e.imageView.sprite.height),setTimeout(function(){return e.editingElement.find(".tools-background").height(e.editingElement.find(".output").height())},50)):e.imageView.sprite.height<600?(e.editingElement.find(".output").height(e.imageView.sprite.height),setTimeout(function(){return e.editingElement.find(".tools-background").height(e.editingElement.find(".output").height())},50)):(e.editingElement.find(".output").height(600),setTimeout(function(){return e.editingElement.find(".tools-background").height(e.editingElement.find(".output").height())},50)),requestAnimationFrame(function(){e.imageView.setOverlay(),e.imageView.renderer.resize(e.outputWidth,e.outputHeight),setTimeout(function(){e.isInSetup=!1,e.imageView.sprite.pivot.set(e.imageView.sprite.width/2,e.imageView.sprite.height/2),e.imageView.sprite.scale=new PIXI.Point(e.scale,e.scale),console.log("setting sprite scale "+e.scale),e.imageView.sprite.position={x:e.imageView.renderer.width/2,y:e.imageView.renderer.height/2},setTimeout(function(){console.log("finish setup"),e.lockOutput(),e.setHandle(),setTimeout(function(){return o.$(e.imageView.renderer.view).css({opacity:1})},100),e.editingElement.find("input[type=text]").first().val(parseInt(e.imageView.sprite.width/e.scale)),e.editingElement.find("input[type=text]").last().val(parseInt(e.imageView.sprite.height/e.scale)),angular.element(e.editingElement).scope().$apply()},50),e.imageView.render()},200),e.imageView.render()})},180)},e.prototype.stop=function(){var e=this;this.editingElement.find(".output").removeAttr("style"),setTimeout(function(){return e.editingElement.find(".tools-background").height(e.editingElement.find(".output").height())},200),this.reset(),this.imageView.sprite.position={x:this.initialSize.width/2,y:this.initialSize.height/2},this.editingElement.off("startResize stopResize startDrag stopDrag")},e.prototype.animate=function(){var e=this;this.isResizing&&(this.resize(),this.token=requestAnimationFrame(function(){return e.animate()}))},e.prototype.start=function(e,t){var n=this;this.imageView=e,this.editingElement=t,this.initialSize={height:this.imageView.sprite.height,width:this.imageView.sprite.width},t.on("startResize",".handle",function(){n.isResizing=!0,n.animate()}),t.on("stopResize",".handle",function(){return n.stopResizing()}),t.on("startDrag",".handle",function(){n.isResizing=!0,n.animate()}),t.on("stopDrag",".handle",function(){return n.stopResizing()}),setTimeout(function(){return n.setup()},150)},e}();t.Resize=a},function(e,t){"use strict";var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e.prototype.apply=function(e){var t=this;return this.editingElement.find(".tools button").attr("disabled",!0),this.imageView.sprite.rotation+=Math.PI/180*90,this.imageView.renderer.resize(this.imageView.sprite.height,this.imageView.sprite.width),this.imageView.sprite.position={x:this.imageView.sprite.height/2,y:this.imageView.sprite.width/2},this.imageView.render(),this.placeTools(),new Promise(function(e,i){requestAnimationFrame(function(){return n(t,void 0,void 0,function(){var t=this;return r(this,function(n){return this.imageView.backup().then(function(){t.editingElement.find(".tools button").attr("disabled",!1),e()}),[2]})})})})},e.prototype.placeTools=function(){this.imageView.editingElement.find(".tools-background").height(this.editingElement.find(".output").height())},e.prototype.stop=function(){},e.prototype.start=function(e,t){this.imageView=e,this.editingElement=t,this.imageView.sprite.pivot.set(this.imageView.sprite.width/2,this.imageView.sprite.height/2),this.imageView.renderer.resize(this.imageView.sprite.width,this.imageView.sprite.height),this.imageView.sprite.position={x:this.imageView.sprite.width/2,y:this.imageView.sprite.height/2},this.imageView.render(),this.placeTools()},e}();t.Rotate=i},function(e,t,n){"use strict";function r(){return{restrict:"A",scope:{imageLazyLoad:"="},link:function(e,t,n){var r=window;if(r.IntersectionObserver&&r.IntersectionObserverEntry&&r.IntersectionObserverEntry.prototype){o||console.info("lazy load is enabled"),o=!0;var i=function(t){t.forEach(function(t){t.intersectionRatio>0&&(t.target.src&&-1!=t.target.src.indexOf(e.imageLazyLoad)||(t.target.src=e.imageLazyLoad+(e.imageLazyLoad.indexOf("?")>-1?"&":"?")+"t="+(new Date).valueOf()))})},s=new IntersectionObserver(i),a=angular.element(t)[0];s.observe(a)}else{o||console.warn("lazy load is disabled"),o=!0;var a=angular.element(t)[0];a.src=e.imageLazyLoad}}}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(943),o=!1;t.imageLazyLoad=i.ng.directive("imageLazyLoad",r)},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(943),s=n(391),a=n(1),u=n(35);t.imageSelect=o.ng.directive("imageSelect",function(){return{restrict:"E",transclude:!0,scope:{ngModel:"=",thumbnails:"&",ngChange:"&",default:"@"},template:'<div><img ng-src="[[ngModel + \'?\' + getThumbnails()]]" class="pick-file" draggable="false" ng-if="ngModel" style="cursor: pointer" /><i class="trash" ng-click="restoreDefault()"></i><i class="edit pick-file"></i><img skin-src="[[default]]" class="pick-file" draggable="false" ng-if="!ngModel" style="cursor: pointer" /><lightbox show="userSelecting"><div ng-if="userSelecting"><media-library visibility="selectedFile.visibility"ng-change="updateDocument()" ng-model="selectedFile.file" file-format="\'img\'"></media-library></div></lightbox></div>',link:function(e,t,n){var o=this;e.selectedFile={file:{},visibility:"protected"},e.selectedFile.visibility=e.$parent.$eval(n.visibility),e.selectedFile.visibility||(e.selectedFile.visibility="protected"),e.selectedFile.visibility=e.selectedFile.visibility.toLowerCase(),e.restoreDefault=function(){e.ngModel="",setTimeout(function(){e.ngChange(),e.$apply()},10)},t.on("dragenter",function(e){e.preventDefault()}),t.on("dragstart","img",function(e){e.preventDefault()}),t.on("dragover",function(e){t.addClass("droptarget"),e.preventDefault()}),t.on("dragleave",function(){t.removeClass("droptarget")}),t.on("drop",function(n){return r(o,void 0,void 0,function(){var r,o;return i(this,function(i){switch(i.label){case 0:return t.find(a.$(n.target).parents("lightbox").first()).length>0?[2]:(n.preventDefault(),r=n.originalEvent.dataTransfer.files[0],-1===r.type.indexOf("image")||n.originalEvent.dataTransfer.files.length>1?(u.notify.error("medialibrary.unsupported"),[2]):(t.removeClass("droptarget"),t.addClass("loading-panel"),o=new s.Document,[4,o.upload(r,e.selectedFile.visibility)]));case 1:return i.sent(),e.selectedFile.file=o,e.updateDocument(),t.removeClass("loading-panel"),s.MediaLibrary.appDocuments.sync(),[2]}})})}),e.$watch("thumbnails",function(t){var n=e.$eval(t);n&&(e.getThumbnails=function(){var e="";return n.forEach(function(t){e+="thumbnail="+t.width+"x"+t.height+"&"}),e})}),e.updateDocument=function(){e.userSelecting=!1;var t="/workspace/document/";"public"===e.selectedFile.visibility&&(t="/workspace/pub/document/"),e.ngModel=t+e.selectedFile.file._id,setTimeout(function(){e.ngChange()})},t.on("click",".pick-file",function(){e.userSelecting=!0,e.$apply()})}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943);t.imgOnError=r.ng.directive("imgOnError",function(){return{restrict:"A",link:function(e,t,n){t.on("error",function(){t.off("error"),t.attr("src",n.imgOnError)})}}})},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},o=this;Object.defineProperty(t,"__esModule",{value:!0});var s=n(937),a=n(943);t.infotip=a.ng.directive("infotip",function(){return{restrict:"E",template:'\n <i class="close"></i>\n <div ng-transclude></div>\n ',scope:{name:"@",onChange:"&",savePreferenceUnder:"@",showOnce:"="},transclude:!0,link:function(e,t,n){return r(o,void 0,void 0,function(){var n,r,o,a,u,c;return i(this,function(i){switch(i.label){case 0:n="infotip",angular.isString(e.savePreferenceUnder)&&e.savePreferenceUnder.trim().length>0&&(n=e.savePreferenceUnder.trim()),t.css({display:"block"}),e.$$showPublicInfoTipRgpdCookie=!1,r=window.localStorage.getItem("showInfoTip.cookies"),"false"!=r&&(e.$$showPublicInfoTipRgpdCookie=!0),o=function(){e.$$showPublicInfoTipRgpdCookie=!1,window.localStorage.setItem("showInfoTip.cookies","false")},t.children("i").on("click",function(){t.slideUp(),o()}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,s.Me.preference(n)];case 2:return i.sent(),a=function(t){if(arguments.length<=0)return!1!==s.Me.preferences[n][e.name];s.Me.preferences[n][e.name]=t},u=function(){e.onChange&&e.onChange({$visible:a()})},u(),a()?(t.css({display:"block"}),e.showOnce&&(a(!1),s.Me.savePreference(n))):t.remove(),t.children("i").on("click",function(){t.slideUp(),a(!1),u(),s.Me.savePreference(n)}),[3,4];case 3:return c=i.sent(),console.error(c),[3,4];case 4:return[2]}})})}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388),i=n(551);t.inputdate=r.ng.directive("inputdate",["$timeout",function(e){return{restrict:"E",template:'\n <input type="date" class="[[class]]" \n ng-model="current.model" \n ng-model-options="ngModelOptions || {}" \n ng-model-extend="ngModelExtend"\n ng-required="ngRequired" />\n ',scope:{ngRequired:"=",ngChange:"=",ngModel:"=",ngModelOptions:"=",ngMax:"@",ngMin:"@",class:"@",onSuccess:"&"},compile:function(e,t){var n=function(){var e=document.createElement("input");return e.setAttribute("type","date"),e.setAttribute("value","a"),"a"!==e.value}(),o=e.find("input"),s=n?r.moment().creationData().locale._longDateFormat.L:"DD/MM/YYYY";return n||(o[0].setAttribute("type","text"),o[0].setAttribute("placeholder","[[dateFormatI18]]")),{pre:function(e,t,o){var a=null,u=new i.Subject;e.isDateSupported=n,e.dateFormat=s,e.dateFormatI18=r.idiom.translate("date."+s);var c=u.debounceTime(400).subscribe(function(t){o.onSuccess&&t&&e.onSuccess()});e.$on("destroy",function(){setTimeout(function(){c.unsubscribe()},500)});var l=function(e){return e instanceof Date?r.moment(e):"string"==typeof e?r.moment(e,"YYYY-MM-DD",!0):null},d=function(e){return"string"==typeof e?r.moment(e,["YYYY-MM-DD",s],!0):null};e.ngModelExtend={clearParsers:!0,clearFormatters:!0,formatters:[function(e){var t=l(e);return t&&t.isValid()?n?t.format("YYYY-MM-DD"):t.format(s):""}],parsers:[function(e){var t=d(e);return t&&t.isValid()?t.format("YYYY-MM-DD"):e},function(t){return setTimeout(function(){return e.onChange()}),t}],validators:[{key:"dateFormat",validator:function(e,t){if(!t)return!0;var n=d(t);return n&&n.isValid()}},{key:"dateMax",validator:function(t,n){if(e.ngMax){var r=l(t),i=l(e.ngMax);if(r&&r.isValid()&&i&&i.isValid())return r.toDate().getTime()<=i.toDate().getTime()}return!0}},{key:"dateMin",validator:function(t,n){if(e.ngMin){var r=l(t),i=l(e.ngMin);if(r&&r.isValid()&&i&&i.isValid())return r.toDate().getTime()>=i.toDate().getTime()}return!0}}],onInit:function(e){a=e}},e.current={get model(){return e.ngModel},set model(t){e.ngModel=t}},e.onChange=function(){u.next(a.$valid),o.ngChange&&e.ngChange()}}}}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943);t.inputPassword=r.ng.directive("inputPassword",function(){return{restrict:"E",replace:!1,template:'<input type="password"/><button type="button" \t\t\t\t\tng-mousedown="show(true)" \t\t\t\t\tng-touchstart="show(true)" \t\t\t\t\tng-touchend="show(false)" \t\t\t\t\tng-mouseup="show(false)" \t\t\t\t\tng-mouseleave="show(false)"></button>',scope:!0,compile:function(e,t){e.addClass("toggleable-password");var n=e.children("input[type=password]");for(var r in t.$attr)n.attr(t.$attr[r],t[r]),e.removeAttr(t.$attr[r]);return function(e){e.show=function(e){n[0].type=e?"text":"password"}}}}})},function(module,exports,__webpack_require__){"use strict";function safeApply(e,t){var n=e.$root.$$phase;"$apply"==n||"$digest"==n?t&&"function"==typeof t&&t():e.$apply(t)}var __awaiter=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(exports,"__esModule",{value:!0});var ng_start_1=__webpack_require__(943),jquery_1=__webpack_require__(1),workspace_v1_1=__webpack_require__(392),template_1=__webpack_require__(390),modelDefinitions_1=__webpack_require__(37),idiom_1=__webpack_require__(3),axios_1=__webpack_require__(7),model_1=__webpack_require__(407),services_1=__webpack_require__(550),notify_1=__webpack_require__(35),ui_1=__webpack_require__(6);exports.mediaLibrary=ng_start_1.ng.directive("mediaLibrary",["$timeout","$filter",function($timeout,$filter){return{restrict:"E",scope:{delegate:"=",ngModel:"=",ngChange:"&",multiple:"=",fileFormat:"=",accept:"="},templateUrl:"/assets/js/entcore/template/media-library/main.html",link:function(scope,element,attributes){function matchSearch(e){return!(scope.display.search&&scope.display.search.trim().length>0)||-1!==idiom_1.idiom.removeAccents((e||"").toLowerCase()).indexOf(idiom_1.idiom.removeAccents(scope.display.search.toLowerCase()))}function filteredDocuments(e){return e?e.documents.filter(function(e){var t=scope.delegate&&scope.delegate.filterDocumentRole,n=e.role()===scope.fileFormat||"any"===scope.fileFormat,r=t?scope.delegate.filterDocumentRole(e):n,i=matchSearch(e.metadata.filename),o=matchSearch(e.name);return r&&(i||o)}):[]}function filterFolders(e){return e&&e.folders?e.folders.filter(function(e){return matchSearch(e.name)}):[]}var _this=this;scope.documentList=new model_1.DocumentsListModel($filter,!0),scope.documentList.watch(scope),scope.delegate&&scope.delegate.visit&&scope.delegate.visit(scope);var MAIN_CONTAINER="entcore/media-library/main",TEMPLATE_LOADING="entcore/media-library/loading",HEADER_BROWSE={i18Key:jquery_1.$(window).width()<=ui_1.ui.breakpoints.tablette?"library.header.browse.mobile":"library.header.browse",template:"entcore/media-library/browse",visible:function(){return!0},worflowKey:null},HEADER_UPLOAD={i18Key:jquery_1.$(window).width()<=ui_1.ui.breakpoints.tablette?"library.header.upload.mobile":"library.header.upload",template:"entcore/media-library/upload",visible:function(){return!0},worflowKey:"workspace.create"},HEADER_RECORD={i18Key:jquery_1.$(window).width()<=ui_1.ui.breakpoints.tablette?"library.header.record.mobile":"library.header.record",template:"entcore/media-library/record",visible:function(){return"audio"===scope.fileFormat},worflowKey:"workspace.create"};scope.template=template_1.template;var header=HEADER_BROWSE,hack=!0,showTemplate=function(e){if(header=e,template_1.template.open(MAIN_CONTAINER,e.template),e.onDisplay&&e.onDisplay(),navigator.userAgent.match(/iPhone/i)&&hack){hack=!1;var t=jquery_1.$("editor").css("display");jquery_1.$("editor").css("display","none"),setTimeout(function(){hack=!0,jquery_1.$("editor").css("display",t)},500)}};scope.headers=function(){var e=[HEADER_RECORD,HEADER_UPLOAD,HEADER_BROWSE];return scope.delegate&&scope.delegate.augmentHeaders?scope.delegate.augmentHeaders(e):e},scope.title=function(){return scope.delegate&&scope.delegate.title?scope.delegate.title:idiom_1.idiom.translate("medialibrary.title")},template_1.template.open("entcore/media-library/cache",TEMPLATE_LOADING),window.toBlobPolyfillLoaded||axios_1.default.get("/infra/public/js/toBlob-polyfill.js").then(function(response){eval(response.data),window.toBlobPolyfillLoaded=!0}),scope.$watch(function(){return scope.$parent.$eval(attributes.visibility)},function(e){scope.visibility=e,scope.visibility||(scope.visibility="protected"),scope.visibility=scope.visibility.toLowerCase()}),scope.canExpand=function(e){return e.canExpand()},scope.openCompression=function(e){e.isEditableImage&&(scope.display.editedDocument=e,setTimeout(function(){scope.display.compressionReady=!0,scope.$apply()},350))},scope.closeCompression=function(){scope.display.editedDocument=void 0,scope.display.compressionReady=!1},scope.upload={documents:[],highlights:[]},element.on("dragenter",function(e){e.preventDefault()}),element.on("dragover",function(e){element.find(".drop-zone").addClass("dragover"),e.preventDefault()}),element.on("dragleave",function(){element.find(".drop-zone").removeClass("dragover")}),element.on("drop",function(e){return __awaiter(_this,void 0,void 0,function(){var t;return __generator(this,function(n){return element.find(".drop-zone").removeClass("dragover"),e.preventDefault(),template_1.template.open(MAIN_CONTAINER,TEMPLATE_LOADING),t=e.originalEvent.dataTransfer.files,scope.importFiles(e.originalEvent.dataTransfer.files),[2]})})}),scope.$watch("ngModel",function(e){scope.upload.documents=[]}),jquery_1.$("body").on("click",".lightbox-backdrop",function(){scope.upload.documents=[]}),showTemplate(HEADER_BROWSE),scope.myDocuments=workspace_v1_1.MediaLibrary.myDocuments,scope.sharedDocuments=workspace_v1_1.MediaLibrary.sharedDocuments,scope.display={search:""};var previousImage=function(){for(var e=scope.upload.documents.indexOf(scope.display.editedDocument)-1,t=e;t>=0;t--)if(scope.upload.documents[t].isEditableImage)return scope.upload.documents[t]},nextImage=function(){for(var e=scope.upload.documents.indexOf(scope.display.editedDocument)+1,t=e;t<scope.upload.documents.length;t++)if(scope.upload.documents[t].isEditableImage)return scope.upload.documents[t]};scope.isEditedFirst=function(){return!previousImage()},scope.isEditedLast=function(){return!nextImage()},scope.nextImage=function(){return scope.display.editedDocument=nextImage()},scope.previousImage=function(){return scope.display.editedDocument=previousImage()};var displayHighLights=function(){setTimeout(function(){scope.upload.highlights.forEach(function(e){element.find("explorer").each(function(t,n){if(-1!==jquery_1.$(n).attr("doc-id").indexOf(e._id)){var r=jquery_1.$('<div class="highlight"></div>'),i=jquery_1.$(n).children(".explorer");i.append(r),i.scope().ngModel=!0,i.scope().$apply()}})}),setTimeout(function(){jquery_1.$(".highlight").addClass("show"),setTimeout(function(){jquery_1.$(".highlight").removeClass("show"),setTimeout(function(){jquery_1.$(".highlight").remove(),scope.upload.highlights=[]},720)},720)},30)},100)};scope.showHeaderByI18Key=function(e){var t=scope.headers().find(function(t){return t.i18Key==e});t&&scope.showHeader(t)},scope.showHeader=function(e){if(scope.delegate&&scope.delegate.handleShow){if(scope.delegate.handleShow(scope,{cancelAll:cancelAll,displayHighLights:displayHighLights,showTemplate:showTemplate}))return}showTemplate(e),cancelAll(),displayHighLights()},scope.isExternalVisible=function(){return"external"==scope.visibility},scope.isSelectedHeader=function(e){return header&&e&&header.i18Key==e.i18Key},scope.isViewMode=function(e){return scope.viewMode==e},scope.changeViewMode=function(e){e&&scope.viewMode!=e&&(template_1.template.open("documents-view","entcore/media-library/"+e),scope.viewMode=e,services_1.workspaceService.savePreference({bbmView:e}))},services_1.workspaceService.getPreference().then(function(e){scope.changeViewMode(e.bbmView||"icons")}),scope.orderByField=function(e){if(1==scope.isOrderedAsc(e))scope.orderFieldDocument="-"+e;else{if(scope.isOrderedDesc(e))return scope.orderByDefault();scope.orderFieldDocument=e}scope.orderFieldFolder=scope.orderFieldDocument},scope.orderByDefault=function(){scope.orderFieldDocument="-created",scope.orderFieldFolder="name"},scope.orderByDefault(),scope.isOrderedAsc=function(e){return scope.orderFieldDocument==e},scope.isOrderedDesc=function(e){return scope.orderFieldDocument=="-"+e},scope.isListFrom=function(e){return scope.display.listFrom==e},scope.listFrom=function(e){return __awaiter(_this,void 0,void 0,function(){var t;return __generator(this,function(n){switch(n.label){case 0:return scope.display.listFrom=e,t=workspace_v1_1.MediaLibrary[scope.display.listFrom],[4,scope.openFolder(t)];case 1:return n.sent(),[2]}})})};var refresh=function(){scope.documents=filteredDocuments(workspace_v1_1.MediaLibrary[scope.display.listFrom]),scope.folders=filterFolders(scope.openedFolder),safeApply(scope)};workspace_v1_1.MediaLibrary.eventer.on("sync",refresh),workspace_v1_1.MediaLibrary.eventer.on("ready",function(){scope.folder=workspace_v1_1.MediaLibrary[scope.display.listFrom],scope.openedFolder=scope.folder,scope.documents=filteredDocuments(workspace_v1_1.MediaLibrary[scope.display.listFrom]),scope.folders=filterFolders(scope.openedFolder)}),workspace_v1_1.MediaLibrary.sync(),scope.openFolder=function(e){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return scope.openedFolder=e,[4,e.sync()];case 1:return t.sent(),scope.documents=filteredDocuments(e),scope.folders=filterFolders(scope.openedFolder),safeApply(scope),[2]}})})},scope.$watch("visibility",function(e){var t=this;"external"==scope.visibility?scope.listFrom("externalDocuments"):modelDefinitions_1.model.me&&modelDefinitions_1.model.me.workflow.workspace.create?"public"===scope.visibility?scope.listFrom("publicDocuments"):scope.listFrom("appDocuments"):modelDefinitions_1.model.me&&modelDefinitions_1.model.me.workflow.workspace.list&&scope.listFrom("sharedDocuments"),scope.$watch("fileFormat",function(e){return __awaiter(t,void 0,void 0,function(){return __generator(this,function(t){return e?("audio"===e?(showTemplate(HEADER_RECORD),scope.display.acceptType="audio/*",element.parents("lightbox").on("lightboxvisible",function(){showTemplate(HEADER_RECORD)})):"img"===e?scope.display.acceptType="image/*":(showTemplate(HEADER_BROWSE),element.parents("lightbox").on("lightboxvisible",function(){showTemplate(HEADER_BROWSE)})),0===workspace_v1_1.MediaLibrary[scope.display.listFrom].documents.length&&workspace_v1_1.MediaLibrary[scope.display.listFrom].sync(),[2]):[2]})})})}),scope.insertRecord=function(e){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,workspace_v1_1.MediaLibrary.appDocuments.sync()];case 1:return t.sent(),workspace_v1_1.MediaLibrary.appDocuments.documents.all.forEach(function(t){t._id==e&&scope.selectDocument(t)}),[2]}})})},scope.selectedDocuments=function(){return scope.documents?scope.documents.filter(function(e){return e.selected}):[]},scope.selectDocument=function(e){scope.documents.forEach(function(e){return e.selected=!1}),e.selected=!0,scope.selectDocuments()},scope.selectDocuments=function(){return __awaiter(_this,void 0,void 0,function(){var e,t,n,r;return __generator(this,function(i){switch(i.label){case 0:return e=scope.selectedDocuments(),"external"===scope.visibility||"protected"==scope.openedFolder.filter&&"protected"===scope.visibility||"public"==scope.openedFolder.filter&&"public"===scope.visibility?(scope.multiple?scope.ngModel=e:scope.ngModel=e[0],[3,9]):[3,1];case 1:t=[],scope.display.loading=e,n=0,i.label=2;case 2:return n<e.length?(r=void 0,"public"!==scope.visibility?[3,4]:[4,e[n].publicDuplicate()]):[3,8];case 3:return r=i.sent(),[3,6];case 4:return[4,e[n].protectedDuplicate()];case 5:r=i.sent(),i.label=6;case 6:t.push(r),i.label=7;case 7:return n++,[3,2];case 8:scope.display.loading=void 0,scope.multiple?scope.ngModel=t:scope.ngModel=t[0],i.label=9;case 9:return(scope.ngModel&&scope.ngModel._id||scope.ngModel&&scope.multiple&&scope.ngModel.length)&&$timeout(function(){scope.ngChange()}),scope.$apply(),[2]}})})},scope.updateSelection=function(e){scope.multiple||(scope.documents.forEach(function(e){return e.selected=!1}),e.selected=!0)};var cancelAll=function(){scope.display.editedDocument=void 0,scope.upload.documents.forEach(function(e){"loaded"===e.uploadStatus&&e.delete(),"loading"===e.uploadStatus&&e.abort()}),scope.upload.documents=[],scope.upload.loading=[]};scope.abortOrDelete=function(e){"loaded"===e.uploadStatus&&e.delete(),"loading"===e.uploadStatus&&e.abort();var t=scope.upload.documents.indexOf(e);scope.upload.documents.splice(t,1),scope.upload.documents.length||showTemplate(HEADER_UPLOAD),e===scope.display.editedDocument&&(scope.display.editedDocument=void 0)},scope.canConfirmImport=function(){return scope.upload.documents.map(function(e){return"loaded"==e.uploadStatus}).reduce(function(e,t){return e&&t},!0)},scope.confirmImport=function(){return __awaiter(_this,void 0,void 0,function(){var e;return __generator(this,function(t){switch(t.label){case 0:return scope.upload.documents.forEach(function(e){e.applyBlob(),e.selected=!0}),"public"!=scope.visibility?[3,2]:[4,scope.listFrom("publicDocuments")];case 1:return t.sent(),e=workspace_v1_1.MediaLibrary.publicDocuments.documents.all.length-1,e>-1&&(workspace_v1_1.MediaLibrary.publicDocuments.documents.all[e].selected=!0),[3,4];case 2:return[4,scope.listFrom("appDocuments")];case 3:t.sent(),t.label=4;case 4:return scope.documents=scope.upload.documents,scope.documents&&(scope.selectDocuments(),scope.documents.length,notify_1.notify.success("workspace.add.document.success")),scope.upload.documents=[],scope.documents=[],[2]}})})},scope.cancelUpload=function(){showTemplate(HEADER_UPLOAD),cancelAll()},scope.importFiles=function(e){e||(e=scope.upload.files);for(var t=0;t<e.length;t++){var n=new workspace_v1_1.Document;scope.upload.documents.push(n);var r="external"==scope.visibility?"protected":scope.visibility;n.upload(e[t],r).then(function(){return scope.$apply()})}scope.upload.files=void 0,template_1.template.open(MAIN_CONTAINER,TEMPLATE_LOADING)},scope.updateSearch=function(){scope.documents=filteredDocuments(scope.openedFolder),scope.folders=filterFolders(scope.openedFolder)},scope.editImage=function(){return scope.display.editDocument=!0},scope.$on("$destroy",function(){cancelAll(),workspace_v1_1.MediaLibrary.deselectAll()}),scope.triggerIpnutFileClick=function(e){e.preventDefault(),e.stopPropagation(),jquery_1.$(".upload-input").trigger("click",[scope.$id])},element.on("click",".upload-input",function(e,t){t!=scope.$id&&e.preventDefault(),e.stopPropagation()}),scope.resetRegularDisplay=function(){scope.display.listFrom=null,scope.openedFolder=new workspace_v1_1.Folder("owner"),scope.documents=[],scope.folders=[]}}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388);t.multiComboboxes=r.ng.directive("multiComboboxes",function(){return{restrict:"E",template:'\n <div class="fluid row">\n <button type="button" class="select-button left-text low-text row" ng-class="{ selected : showOptions }" ng-disabled="ngDisabled">\n <span ng-if="!ngModel && !ngDisabled" class="block cell-ellipsis right-spacing">[[ titleAll ]]</span>\n <span ng-if="ngModel.length >= 0 && !ngDisabled && title" class="block cell-ellipsis right-spacing active">[[ title ]]: [[ ngModel.length ]] <i18n>portal.selected</i18n></span> <i class="sort horizontal-margin top-spacing absolute-magnet"></i>\n <span ng-if="ngModel.length >= 0 && !ngDisabled && !title" class="block cell-ellipsis right-spacing active">[[ ngModel.length ]] <i18n>portal.selected</i18n></span> <i class="sort horizontal-margin top-spacing absolute-magnet"></i>\n <span ng-if="ngDisabled" class="block cell-ellipsis right-spacing">[[ titleDisabled || title ]]</span>\n </button>\n <article class="absolute-w">\n <div class="search-pagination flex-row align-center" ng-if="disableSearch != \'true\'">\n <div class="cell twelve">\n <input class="twelve" name="searchFieldValue" type="text" ng-model="searchField.value"\n i18n-placeholder="{{searchPlaceholder}}" autocomplete="off"/>\n <i class="search"></i>\n </div>\n </div>\n <div class="top-spacing-twice left-text smaller-text">\n <a class="text-underline-hover" ng-click="selectNone()"><i18n>portal.none</i18n></a> <span class="horizontal-margin-small">|</span> <a class="text-underline-hover" ng-click="selectAll()"><i18n>portal.all</i18n></a>\n </div>\n <div class="top-spacing-twice left-text scroll-seven-checks" bottom-scroll="updatingMaxItems()">\n <div class="flex-row top-spacing" ng-repeat="option in options | orderBy:order | filter:filterByLabel" \n ng-click="onCheck(option, !option.checked)"\n ng-disabled="option.available ? !option.available() : false">\n <label class="cell wrapping-checkbox" ng-disabled="option.available ? !option.available() : false">\n <input type="checkbox" ng-model="option.checked" disabled="disabled" />\n <i18n></i18n>\n </label>\n <i18n class="cell multiline-ellipsis-two top-spacing size-auto left-text low-importance">\n [[ option.label ]]\n </i18n>\n </div>\n </div>\n </article>\n </div>\n ',scope:{ngModel:"=",ngDisabled:"=",options:"=",check:"&",disableSearch:"@?",searchPlaceholder:"@?",order:"=?",titleDisabled:"@?"},link:function(e,t,n){e.searchField={value:""},e.titleAll=n.titleAll,e.title=n.title,e.titleDisabled=n.titleDisabled,e.order||(e.order="label"),null==e.searchPlaceholder&&(e.searchPlaceholder="portal.searching"),e.maxItems=20,e.showOptions=!1,e.firstShow=!0,t.find("article").hide(),e.updatingMaxItems=function(){e.maxItems+=20},e.$watchCollection("options",function(t){e.options&&e.options.forEach(function(t){t.checked=!e.ngModel||-1!==e.ngModel.indexOf(t.type),e.$watch(function(){return t},function(t,n){if(t!==n&&t.checked!==n.checked){if(t.checked&&e.ngModel.find(function(e){return e==t.type}))return;t.checked?e.ngModel.push(t.type):e.ngModel=e.ngModel.filter(function(e){return e!=t.type})}},!0)})});var i=function(){t.find("article").css("opacity",0),t.find("article").css("z-index",-1),e.searchField.value=""};t.find("button").on("click",function(){e.showOptions?i():(e.firstShow&&(t.find("article").show(),e.firstShow=!1),t.find("article").css("opacity",1),t.find("article").css("z-index",1e3)),e.showOptions=!e.showOptions,e.$apply()});var o=function(n){t.find(n.target).length>0||(i(),e.showOptions=!1,e.$apply())};r.$("body").on("click",o),e.filterByLabel=function(t){return t.label||(t.label=""),t.label.toLowerCase().includes(e.searchField.value.toLowerCase())},e.onCheck=function(t,n){t.available&&!t.available()||(t.checked=n),e.check({option:t,checked:n})},e.select=function(t){e.options.forEach(function(n){e.onCheck(n,t)}),e.searchField.value=""},e.selectNone=function(){e.select(!1)},e.selectAll=function(){e.select(!0)},e.$watch(function(){return t.find("button")[0].offsetHeight},function(e){var n=t.find("article").eq(0);n.css("top",t.find("button")[0].offsetHeight+1+"px"),n.css("left","2px")})}}})},function(e,t,n){"use strict";function r(e,t){return s.ng.directive(e,function(){return{require:["?ngModel","?^^guardRoot"],restrict:"A",link:function(e,n,r,i){var o=i[0],s=i[1],u=t(e,n,r,o),c=0;if(null!=u)if(o?o.$formatters.push(function(e){return 0==c&&(setTimeout(function(){return u.reset()}),c++),e}):setTimeout(function(){return u.reset()}),null!=s)s.registerGuard(u),e.$on("$destroy",function(){s.unregisterGuard(u)});else{var l=a.navigationGuardService.registerIndependantGuard(u);e.$on("$destroy",function(){a.navigationGuardService.unregisterIndependantGuard(l)})}}}})}var i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(943),a=n(941);t.guardRootDirective=s.ng.directive("guardRoot",function(){return{restrict:"A",controller:["$scope","$attrs",function(e,t){var n;n=null!=t.guardRoot&&""!=t.guardRoot?t.guardRoot:a.navigationGuardService.generateID();var r=a.AngularJSRouteChangeListener.getInstance(e.$root);a.navigationGuardService.registerListener(r),a.navigationGuardService.registerListener(a.DOMRouteChangeListener.getInstance()),a.navigationGuardService.registerListener(a.TemplateRouteChangeListener.getInstance()),e.$on("$destroy",function(){a.navigationGuardService.unregisterListener(r),a.navigationGuardService.unregisterListener(a.DOMRouteChangeListener.getInstance()),a.navigationGuardService.unregisterListener(a.TemplateRouteChangeListener.getInstance()),a.navigationGuardService.unregisterRoot(n)}),this.registerGuard=function(e){a.navigationGuardService.registerGuard(n,e)},this.unregisterGuard=function(e){a.navigationGuardService.unregisterGuard(n,e)},this.reset=function(){a.navigationGuardService.reset(n)}}]}}),t.resetGuardDirective=s.ng.directive("resetGuard",function(){return{require:"?^guardRoot",restrict:"A",link:function(e,t,n,r){var s=this,u=n.resetGuardId,c=function(){return i(s,void 0,void 0,function(){var t;return o(this,function(i){switch(i.label){case 0:return t=e.$eval(n.resetGuard),t instanceof Promise?[4,t]:[3,2];case 1:return i.sent(),[3,3];case 2:console.warn("[resetGuard] result is not instance of Promise"),i.label=3;case 3:return null!=u&&""!=u?a.navigationGuardService.reset(u):null!=r?r.reset():(console.warn("[resetGuard] A reset directive has no root, resetting all guards..."),a.navigationGuardService.resetAll()),[2]}})})},l=function(){var e=n.resetGuardEvent;if("string"!=typeof e||!e.trim()){var r=(t.prop("tagName")||"").toLowerCase();e="form"==r?"submit":"click"}return t.on(e,c),function(){return t.off(e,c)}}();e.$on("$destroy",function(){l()})}}}),t.guardIgnoreTemplate=s.ng.directive("guardIgnoreTemplate",function(){return{require:["?container","?guardRoot"],restrict:"A",link:function(e,t,n,r){var i=r[0],o=r[1],s=a.TemplateRouteChangeListener.getInstance();if(o)return void s.setTriggerByDefault(!1);var u=i.template;null==u?console.error("Container directive doesn't have a template attribute. Did its implementation change ?"):(s.addIgnoreContainer(u),e.$on("$destroy",function(){s.removeIgnoreContainer(u)}))}}}),t.guardTriggerTemplate=s.ng.directive("guardTriggerTemplate",function(){return{require:["?container","?guardRoot"],restrict:"A",link:function(e,t,n,r){var i=r[0],o=r[1],s=a.TemplateRouteChangeListener.getInstance();if(o)return void s.setTriggerByDefault(!0);var u=i.template;null==u?console.error("Container directive doesn't have a template attribute. Did its implementation change ?"):(s.addTriggerContainer(u),e.$on("$destroy",function(){s.removeTriggerContainer(u)}))}}}),t.inputGuardDirective=r("inputGuard",function(e,t,n,r){return new a.InputGuard(function(){return r.$viewValue||""},function(){return r.$viewValue||""})}),t.dirtyGuardDirective=r("dirtyGuard",function(e,t,n,r){return new a.InputGuard(function(){return r.$dirty},function(){return!1})}),t.documentGuardDirective=r("documentGuard",function(e,t,n,r){return new a.InputGuard(function(){return"object"==typeof r.$modelValue?r.$modelValue.id||"":""},function(){return"object"==typeof r.$modelValue?r.$modelValue.id||"":""},function(e,t){return e&&t?e._id==t._id:!e&&!t})}),t.customGuardDirective=r("customGuard",function(e,t,n){var r=new a.ObjectGuard(function(){return e.$eval(n.customGuard)});return e.$watch(function(){return e.$eval(n.customGuard)},function(){r.reset()}),r});var u=function(){function e(){}return e.prototype.link=function(e,t,n){var r=e.$eval(n.navigationTriggerParam||"{onEvent:'click'}");r.rootGuardId=r.rootGuardId||"*";var i=new a.ManualChangeListener;a.navigationGuardService.registerListener(i);var o=[],s=function(t){t&&t.preventDefault(),i.onChange.next({checkGuardId:r.rootGuardId,confirmMessageKey:r.guardMessageKey,accept:function(){e.$eval(n.navigationTrigger)},reject:function(){}})},u=function(e,t,n){e.on(t,n),o.push(function(){return e.off(t,n)})},c=function(){for(var e=0,t=o;e<t.length;e++){(0,t[e])()}o=[]};angular.isString(r.onEvent)?u(t,r.onEvent,s):angular.isArray(r.onEvent)&&r.onEvent.forEach(function(e,n,r){angular.isString(e)&&r.lastIndexOf(e)===n&&u(t,e,s)}),e.$on("$destroy",function(){c(),a.navigationGuardService.unregisterListener(i)})},e}();t.navigationTrigger=s.ng.directive("navigationTrigger",function(){return new u})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943);t.ngModelExtend=r.ng.directive("ngModelExtend",["$timeout",function(e){return{restrict:"A",require:"ngModel",scope:{ngModelExtend:"="},compile:function(e,t){return function(e,t,n,r){e.input=r;!function(){var t=e.ngModelExtend||{},n=t.formatters,i=void 0===n?[]:n,o=t.parsers,s=void 0===o?[]:o,a=t.validators,u=void 0===a?[]:a,c=t.clearFormatters,l=void 0!==c&&c,d=t.clearParsers,h=void 0!==d&&d,f=t.onValidationChanged,p=void 0===f?function(e){}:f,m=t.onInit,_=void 0===m?function(e){}:m;e.$watch("input.$valid",function(){return p(r)});var v=!1;l&&(r.$formatters=[],v=!0),h&&(r.$parsers=[],v=!0),s.forEach(function(e){r.$parsers.push(e),v=!0}),i.forEach(function(e){r.$formatters.push(e),v=!0}),u.forEach(function(e){r.$validators[e.key]=e.validator,v=!0}),v&&r.$render(),_(r)}()}}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388),i=n(3);t.pastilles=r.ng.directive("pastilles",["$window",function(e){return{restrict:"E",template:'\n <div class="pastilles-container">\n <a ng-if="image.visible" class="pastilles-item inactive" ng-click="" ng-repeat="image in images track by $index">\n <svg class="pastilles-icon" width="32" height="32">\n <title>[[translate(image.img)]]</title>\n <use href="/directory/public/assets/icons/icons.svg#[[image.img]]"></use>\n </svg>\n <span>[[translate(image.i18n)]]</span>\n </a>\n </div>\n ',scope:{ngModel:"=",images:"="},link:function(e,t,n){e.translate=i.idiom.translate,setTimeout(function(){var n,r;e.index=e.ngModel;var i=function(){n=t.find("div").children(),r=n.length};i();var o=function(){e.index<r&&(n.eq(e.index).removeClass("inactive"),n.eq(e.index).addClass("active")),t.find(".pastilles-item").on("click",function(){if(i(),0!==r){t.find(".active").addClass("inactive"),t.find(".active").removeClass("active"),this.classList.remove("inactive"),this.classList.add("active"),e.index=Array.prototype.slice.call(t.find("div")[0].children).indexOf(this);for(var n=0,o=0,s=e.images.length;o<s;o++)if(e.images[o].visible){if(e.index===n){e.ngModel=o;break}n++}e.$apply()}})};e.$watch("images",function(e){setTimeout(function(){o()},0)},!0),o(),e.setActive(n[e.index]),n.eq(e.index).removeClass("inactive"),n.eq(e.index).addClass("active"),t.find("div").removeClass("invisible-content")},250)}}}])},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},o=this;Object.defineProperty(t,"__esModule",{value:!0});var s=n(943),a=n(937);t.searchUser=s.ng.directive("searchUser",["$timeout",function(e){return{restrict:"E",template:'\n <form class="input-help" ng-submit="update(true)">\n <label ng-class="{ hide: ngModel.length >= 3 }" user-role="ADMIN_LOCAL">\n <i18n>share.search.help</i18n>\n </label>\n <label user-missing-role="ADMIN_LOCAL" ng-if="ngModel.length < 1">\n <i18n>share.search.placeholder</i18n>\n </label>\n <input type="text" ng-model="ngModel" ng-change="update()" autocomplete="off" ng-class="{ move: ngModel.length > 0 }" />\n </form>\n ',scope:{ngModel:"=",searchTrack:"=",onSend:"&",clearList:"&"},link:function(t,n,s){return r(o,void 0,void 0,function(){return i(this,function(r){return s.id&&(n.find("input").attr("id",s.id),n.attr("id","")),n.find("input").on("focus",function(){n.addClass("focus"),n.find("label").addClass("move")}),n.find("input").on("blur",function(){setTimeout(function(){n.removeClass("focus"),t.ngModel||n.find("label").removeClass("move")},200)}),t.update=function(n){a.Me.session.functions.ADMIN_LOCAL||(n=!0),t.searchTrack&&(t.searchTrack.processing=!0),e(function(){if(t.ngModel.length<3&&!n||t.ngModel.length<1)return void t.clearList();(n||t.ngModel.length>=3)&&t.onSend()})},[2]})})}}}])},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(943),s=n(1),a=n(4),u=function(){function e(e){this.all=e}return e.prototype.stayOpen=function(){return r(this,void 0,void 0,function(){var e,t,n,r;return i(this,function(i){switch(i.label){case 0:e=0,t=this.all,i.label=1;case 1:return e<t.length?(n=t[e],n?[4,n.stayOpen()]:[3,3]):[3,4];case 2:if(r=i.sent())return[2,!0];i.label=3;case 3:return e++,[3,1];case 4:return[2,!1]}})})},e}();t.lightbox=o.ng.directive("lightbox",function(){return{restrict:"E",transclude:!0,scope:{show:"=",tiny:"=",onShow:"&?",onClose:"&",delegate:"=",delegateClose:"&?"},template:'<section class="lightbox" ng-class="{\'lightbox\': !tiny, \'tiny-lightbox\': tiny}"><div class="background"></div><div class="content"><div class="twelve cell" ng-transclude></div><div class="close-lightbox"><i class="close-2x"></i></div></div></section></div>',link:function(e,t,o){return r(this,void 0,void 0,function(){var c,l,d;return i(this,function(h){switch(h.label){case 0:return c=e.delegate,o.navigationGuard?[4,Promise.resolve().then(function(){return n(941)})]:[3,2];case 1:l=h.sent(),d=new l.LightboxChangeListener,c=new u([c,d]),l.navigationGuardService.registerListener(d),e.$on("$destroy",function(){l.navigationGuardService.unregisterListener(d)}),h.label=2;case 2:return t.children(".lightbox").find("> .background").on("click",function(n){return r(this,void 0,void 0,function(){var n,n;return i(this,function(r){switch(r.label){case 0:return 0!==t.children(".lightbox").find("image-editor, share-panel, .import-files, .split-screen, [template=entcore\\/image-editor\\/main]").length?[3,3]:c?[4,c.stayOpen()]:[3,2];case 1:if(!0===(n=r.sent()))return[2];r.label=2;case 2:if(o.delegateClose&&!0===(n=e.delegateClose({$element:t})))return[2];t.children(".lightbox").first().fadeOut(),s.$("body").css({overflow:"auto"}),s.$("body").removeClass("lightbox-opened"),e.$eval(e.onClose),e.$apply(),e.show=!1,e.$$phase||e.$parent.$apply(),r.label=3;case 3:return[2]}})})}),t.children(".lightbox").find("> .content > .close-lightbox > i.close-2x").on("click",function(n){return r(this,void 0,void 0,function(){var n,n;return i(this,function(r){switch(r.label){case 0:return 0!==t.children(".lightbox").find("share-panel").length?[3,3]:c?[4,c.stayOpen()]:[3,2];case 1:if(!0===(n=r.sent()))return[2];r.label=2;case 2:if(o.delegateClose&&!0===(n=e.delegateClose({$element:t})))return[2];t.children(".lightbox").first().fadeOut(),s.$("body").css({overflow:"auto"}),s.$("body").removeClass("lightbox-opened"),e.$eval(e.onClose),e.$apply(),e.show=!1,e.$$phase||e.$parent.$apply(),r.label=3;case 3:return[2]}})})}),t.children(".lightbox").on("mousedown",function(e){e.stopPropagation()}),e.$watch("show",function(n){if(n){o.onShow&&e.onShow({$element:t}),t.trigger("lightboxvisible");var r=t.children(".lightbox"),i=t.parents();e.backup={overflow:a._.filter(i,function(e){return"visible"!==s.$(e).css("overflow-x")||"visible"!==s.$(e).css("overflow-y")}),zIndex:a._.map(i,function(e){var t="";return s.$(e).attr("style")&&-1!==s.$(e).attr("style").indexOf("z-index")&&(t=s.$(e).css("z-index")),{element:s.$(e),index:t}})},e.backup.overflow.forEach(function(e){s.$(e).css({overflow:"visible"})}),e.backup.zIndex.forEach(function(e){e.element.css("z-index",99999)}),setTimeout(function(){0===t.parents("header.main").length&&s.$("body").addClass("lightbox-opened"),r.fadeIn()},100),s.$("body").css({overflow:"hidden"})}else{var u=!0;s.$("lightbox .lightbox").each(function(e,n){n!==t.children(".lightbox")[0]&&"block"===s.$(n).css("display")&&(u=!1)}),u&&(s.$("body").removeClass("lightbox-opened"),s.$("body").css({overflow:"auto"})),e.backup&&(e.backup.overflow.forEach(function(e){s.$(e).css("overflow","")}),e.backup.zIndex.forEach(function(e){e.element.css("z-index",e.index)})),t.children(".lightbox").fadeOut(),s.$("body").css({overflow:"auto"}),s.$("body").removeClass("lightbox-opened")}}),e.$on("$destroy",function(){t.parents("lightbox").length||(s.$("body").removeClass("lightbox-opened"),s.$("body").css({overflow:"auto"}),e.backup&&(a._.forEach(e.backup.overflow,function(e){s.$(e).css("overflow","")}),a._.forEach(e.backup.zIndex,function(e){e.element.css("z-index",e.index)})))}),[2]}})})}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(1);t.placedBlock=r.ng.directive("placedBlock",function(){return{restrict:"E",replace:!0,transclude:!0,scope:{x:"=",y:"=",z:"=",h:"=",w:"=",transformX:"=?",transformY:"=?",transformZ:"=?",ratio:"@"},template:"<article ng-transclude ng-style=\"{'z-index': z }\"></article>",link:function(e,t){e.$safeApply=function(e){var t=this.$root&&this.$root.$$phase;"$apply"==t||"$digest"==t?e&&"function"==typeof e&&e():this.$apply(e)},t.css({position:"absolute"});var n=function(r){var i=null!=e.transformX?e.transformX(parseInt(r),!1):parseInt(r);null==i?window.setTimeout(function(){n(r)}):t.offset({top:t.offset().top,left:i+t.parents(".drawing-zone").offset().left},0)};e.$watch("x",n);var r=function(n){var i=null!=e.transformY?e.transformY(parseInt(n),!1):parseInt(n);null==i?window.setTimeout(function(){r(n)},0):t.offset({left:t.offset().left,top:i+t.parents(".drawing-zone").offset().top})};e.$watch("y",r),e.$watch("z",function(n){t.css({"z-index":null!=e.transformZ?e.transformZ(e.z):e.z})});var o=function(){i.$(":focus").blur(),void 0!==e.z&&(t.parents(".drawing-zone").find("article[draggable]").each(function(t,n){var r=i.$(n).css("z-index");e.z||(e.z=1),parseInt(r)&&parseInt(r)>=e.z&&(e.z=parseInt(r)+1)}),e.z&&e.$apply("z"))};t.on("startDrag",function(){o(),t.addClass("placed-block--dragging")}),t.on("startResize",function(){e.w=t.width(),e.$apply("w"),e.h=t.height(),e.$apply("h"),o()});var s=function(){e.x=t.position().left,e.y=t.position().top,null!=e.transformX&&(e.x=e.transformX(e.x,!0)),null!=e.transformY&&(e.y=e.transformY(e.y,!0)),e.$apply()};t.on("stopDrag",function(){s(),t.removeClass("placed-block--dragging")}),t.on("resizing",function(n){e.$emit("resizing",{target:t.get(0),w:t.width(),h:t.height()})}),t.on("stopResize",function(){e.w=t.width(),e.$apply("w"),e.h=t.height(),e.$apply("h"),s()}),e.$watch("w",function(n){t.width(n),e.ratio&&(e.h=e.w/e.ratio,e.$safeApply("h"))}),e.$watch("h",function(n){t.height(n),e.ratio&&(e.w=e.h*e.ratio,e.$safeApply("w"))}),e.$watch("ratio",function(t){t&&(console.log("new ratio",t),e.h=e.w/t,e.$safeApply("h"))})}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(1),o=n(37),s=n(6),a=n(3),u=n(34),c=n(962),l=n(4);t.pulsar=r.ng.directive("pulsar",["$compile",function(e){return{restrict:"A",scope:!0,link:function(t,n,r){function d(){m.find("button").css("pointer-events","none"),i.$(window).off("resize.placeLayers"),p.fadeOut("slow",function(){p.remove()}),m.fadeOut("slow",function(){m.remove()}),i.$(".pulsar-layer").remove(),i.$("body").off("scroll touchmove mousewheel"),i.$("body").css("pointer-events","");p.data("active",!1)}if(!(i.$(window).width()<=s.ui.breakpoints.tablette)&&o.model.me.hasWorkflow("org.entcore.portal.controllers.PortalController|quickstart")){var h=t.$eval(r.pulsar);if(!o.model.me.hasWorkflow(h.workflow))return void n.removeAttr("pulsar");if(h.workflow&&!o.model.me.hasWorkflow(h.workflow))return void n.data("skip-pulsar","true");t.pulsarInfos=h,t.pulsarInfos.steps=[];var f=i.$("[pulsar]");f.each(function(e,n){var r=angular.element(n).scope().$eval(i.$(n).attr("pulsar"));r.el=n,t.pulsarInfos.steps.push(r)}),"object"==typeof h&&void 0!==h.index||console.error("Invalid pulsar object. Should look like pulsar=\"{ index: 0, i18n: 'my.key', position: 'top bottom'}\"");var p,m,_=function(){h.position||(h.position="center center");var r="center";-1!==h.position.indexOf("left")&&(r="left"),-1!==h.position.indexOf("right")&&(r="right");var o="center";-1!==h.position.indexOf("top")&&(o="top"),-1!==h.position.indexOf("bottom")&&(o="bottom"),p=i.$('<div class="pulsar-button"><div class="pulse"></div><div class="pulse2"></div><div class="pulse-spot"></div></div>').appendTo("body"),h.className&&h.className.split(" ").forEach(function(e){p.addClass(e)}),p.data("active",!0);var s=!0,c=function(){var e=0,t=0;h.delta&&(h.delta=a.idiom.translate(h.delta),e=parseInt(h.delta.split(" ")[0]),t=parseInt(h.delta.split(" ")[1]));var u={left:n.offset().left-45,right:n.offset().left+n.width()+5,center:n.offset().left+n.width()/2-20},l={top:n.offset().top,bottom:n.offset().top+n.height()+5,center:n.offset().top+n.height()/2-20};if("top center"===h.position&&(l.top=n.offset().top-40-5),"none"!==p.css("display")&&p.offset({left:parseInt(u[r]+e),top:parseInt(l[o]+t)}),m&&m.find(".arrow").length){var d=u[r]-m.children(".content").width()-20,f=l[o]-10;"top"===o&&"center"===r&&(f=l[o]-m.children(".content").height()-20),"center"===o&&(f=l[o]-m.children(".content").height()/2),"center"===r&&(d=u[r]-m.children(".content").width()/2-2),"center"===o&&"center"===r&&(m.addClass("middle"),o="bottom"),"right"===r&&(d=u[r]+10+10),"bottom"===o&&(f="center"===r?l[o]+10+10:l[o]-15);var _=f,v=d,y=v+m.width()+15,g=_+m.height()+15,b=i.$(window).width()-(m.width()+15),w=i.$(window).height()-(m.height()+15),M=v-b,k=15-v,L=_-w,x=15-_,Y=m.find(".arrow"),T=Y.position().left,S=Y.position().top;y>i.$(window).width()&&(d=i.$(window).width()-(m.width()+15),"center"===r&&s&&(Y.css({left:T+M,right:"auto"}),s=!1)),d<=15&&(d=15,"center"===r&&s&&(Y.css({left:k+10,right:"auto"}),s=!1)),g>i.$(window).height()&&(f=w,"bottom"===o&&s&&(Y.css({top:L+5,bottom:"auto"}),s=!1)),f<15&&(f=15,"center"===o&&"center"!==r&&s&&(Y.css({top:S-x,bottom:"auto"}),s=!1)),m.offset({left:parseInt(d+e),top:parseInt(f+t)})}setTimeout(c,100)};c();var l=function(){i.$(".pulsar-layer").remove();var e="[pulsar-highlight="+h.index+"]",t=i.$("body").find(e);if(0!==t.length)var r=t;if(!r)var r=n;i.$('<div class="pulsar-layer"></div>').width(r.outerWidth()+20).height(r.outerHeight()+20).offset({top:r.offset().top-10,left:r.offset().left-10}).css({position:"absolute"}).hide().appendTo("body").fadeIn("slow")};p.on("click",function(){i.$("body").css("pointer-events","none"),i.$("body").on("scroll touchmove mousewheel",function(e){return e.preventDefault(),e.stopPropagation(),!1}),t.pulsarInfos.steps=[],f=i.$("[pulsar]"),f.each(function(e,n){var r=angular.element(n).scope().$eval(i.$(n).attr("pulsar"));r.el=n,t.pulsarInfos.steps.push(r)}),m=i.$("<pulsar></pulsar>").addClass(r).addClass(o),h.className&&h.className.split(" ").forEach(function(e){m.addClass(e)}),p.hide(),l(),i.$(window).on("resize.placeLayers",l),u.http().get("/infra/public/template/pulsar.html").done(function(n){m.html(e(n)(t))}),i.$("body").append(m)})};i.$(window).on("resize",function(){p&&(i.$(window).width()<=s.ui.breakpoints.tablette?p.hide():p.data("active")&&p.show())}),t.closePulsar=function(){if(m&&p){m.fadeOut(0,function(){m.remove()}),p.removeClass("hidden"),i.$(".pulsar-layer").fadeOut(0,function(){i.$(".pulsar-layer").remove()}),i.$("body").off("scroll touchmove mousewheel"),i.$("body").css("pointer-events","");p.data("active",!1)}},i.$(document).on("click",function(e){i.$(e.target).parents("pulsar").length>0||i.$(e.target).parents(".pulsar-button").length>0||i.$(e.target).hasClass("pulsar-button")||t.closePulsar()}),t.paintPulsar=function(){_(),p.trigger("click")},t.isLastStep=function(){return void 0===l._.find(t.pulsarInfos.steps,function(e){return e.index>t.pulsarInfos.index})},t.goTo=function(e){d(),c.quickstart.goToAppStep(e.index),angular.element(e.el).scope().paintPulsar()},t.next=function(){d();var e=c.quickstart.nextAppStep();if(void 0===l._.findWhere(t.pulsarInfos.steps,{index:e}))return void(void 0!==l._.find(t.pulsarInfos.steps,function(t){return t.index>e})&&t.next());for(var n=0;n<t.pulsarInfos.steps.length;n++){var r=t.pulsarInfos.steps[n];if(r.index===e){if(i.$(r.el).data("skip-pulsar"))return void t.next();angular.element(r.el).scope().paintPulsar()}}},t.previous=function(){d();var e=c.quickstart.previousAppStep();if(void 0===l._.findWhere(t.pulsarInfos.steps,{index:e}))return void(void 0!==l._.find(t.pulsarInfos.steps,function(t){return t.index<e})&&t.previous());for(var n=0;n<t.pulsarInfos.steps.length;n++){var r=t.pulsarInfos.steps[n];if(r.index===e){if(i.$(r.el).data("skip-pulsar"))return void t.previous();angular.element(r.el).scope().paintPulsar()}}},c.quickstart.load(function(){c.quickstart.appIndex()===h.index&&_()})}}}}])},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(37),s=n(943),a=n(1012),u=n(390),c=n(955);t.recorderComponent=s.ng.directive("recorder",function(){function e(e,t){var n=e.$root.$$phase;"$apply"==n||"$digest"==n?t&&"function"==typeof t&&t():e.$apply(t)}return{restrict:"E",scope:{format:"@",onUpload:"&"},templateUrl:function(e,t){return t.templateUrl||"/assets/js/entcore/template/recorder.html"},link:function(t,n,s){var l=this;t.showCamera=!1,t.isVideoCompatible=function(){return c.VideoRecorder.isCompatible()&&o.model.me.hasWorkflow("com.opendigitaleducation.video.controllers.VideoController|capture")},t.isVideoCompatible()&&(t.onShowCamera=function(){return r(l,void 0,void 0,function(){function n(e){void 0===e&&(e=null);try{r.forEach(function(e){return"function"==typeof e&&e()})}finally{t.showCamera=!1}}var r;return i(this,function(i){switch(i.label){case 0:return r=[t.$on("video-upload",function(e,t){return n(t)}),t.$on("video-redo",function(e){return n()})],[4,u.template.open("entcore/video/record")];case 1:return i.sent(),t.showCamera=!0,e(t),[2]}})})}),t.recorder=a.recorder;var d=a.recorder.state(function(n){if(n.startsWith("saved-")){var r=n.substring(6);t.onUpload&&t.onUpload()(r)}e(t)});t.$on("$destroy",function(){d()}),t.switchRecord=function(){"recording"===a.recorder.status?a.recorder.suspend():a.recorder.record()},t.time=function(){var e=parseInt(a.recorder.elapsedTime/60);e<10&&(e="0"+e);var t=parseInt(a.recorder.elapsedTime%60);return t<10&&(t="0"+t),e+":"+t},t.switchPlay=function(){"playing"===a.recorder.status?a.recorder.pause():a.recorder.play()},t.saveRecord=function(){a.recorder.save()},t.redo=function(){a.recorder.flush(),a.recorder.record()},t.isIdle=function(){return"idle"===a.recorder.status},t.isPreparing=function(){return"preparing"===a.recorder.status},t.isRecording=function(){return"recording"===a.recorder.status},t.isSuspended=function(){return"suspended"===a.recorder.status},t.isPaused=function(){return"paused"===a.recorder.status},t.isPlaying=function(){return"playing"===a.recorder.status},t.isStopped=function(){return"stop"===a.recorder.status},t.isEncoding=function(){return"encoding"===a.recorder.status},t.isUploading=function(){return"uploading"===a.recorder.status},t.showActionButtons=function(){return a.recorder.elapsedTime>0&&"stop"!==a.recorder.status&&!t.showCamera}}}})},function(e,t,n){"use strict";function r(){return i(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return l?[3,2]:[4,u.httpPromisy().get("/infra/public/js/zlib.min.js")];case 1:l=e.sent(),e.label=2;case 2:return[2,l]}})})}var i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(916),a=n(3),u=n(34),c=n(35),l=null,d={getUserMediaLegacy:navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,getUserMedia:navigator.mediaDevices&&navigator.mediaDevices.getUserMedia,AudioContext:window.AudioContext||window.webkitAudioContext};t.recorder=function(){function e(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})}function t(t){var n="https:"===window.location.protocol?"wss":"ws",r=window.location.host;return"localhost:8090"===window.location.host&&(r="localhost:6502"),n+"://"+r+"/audio/"+e()+"?sampleRate="+t}function n(){var e=b.length;e>L&&(x.postMessage(["init",f.sampleRate]),x.postMessage(["chunk",g.slice(L,e),b.slice(L,e),(e-L)*w]),x.onmessage=function(e){if(!v)return void _.send(e.data);var t=parseInt(performance.now()),n=new Zlib.Deflate(e.data);_.send(n.compress()),parseInt(performance.now())-t>50&&(v=!1,_.send("rawdata"))},L=e)}function u(){_&&1===_.readyState&&_.close(),l()}function l(){_=null,g=[],b=[],L=0}function h(e,t){Y.forEach(function(n){"function"==typeof n&&n(e,t)})}var f,p,m,_=null,v=!0,y=new Audio,g=[],b=[],w=4096,M=!1,k=0,L=0,x=new Worker("/infra/public/js/audioEncoder.js"),Y=[];return{elapsedTime:0,loadComponents:function(){var e=this;this.title=a.idiom.translate("recorder.filename")+s.moment().format("DD/MM/YYYY"),M=!0;var t=function(t){f=new d.AudioContext,x.postMessage(["init",f.sampleRate]);var r=f.createMediaStreamSource(t);p=f.createGain(),r.connect(p),m=f.createScriptProcessor(w,2,2),m.onaudioprocess=function(e){if("recording"===this.status){var t=new Float32Array(e.inputBuffer.getChannelData(0));g.push(t);var r=new Float32Array(e.inputBuffer.getChannelData(1));b.push(r),k+=w,this.elapsedTime+=e.inputBuffer.duration,n(),h(this.status)}}.bind(e),p.connect(m),m.connect(f.destination)};void 0!==d.getUserMedia?d.getUserMedia.call(navigator.mediaDevices,{audio:!0}).then(t).catch(function(e){console.log("err:",e)}):void 0!==d.getUserMediaLegacy&&d.getUserMediaLegacy({audio:!0},t,function(e){console.log("err:",e)})},isCompatible:function(){return void 0!==d.AudioContext&&(void 0!==d.getUserMedia||void 0!==d.getUserMediaLegacy)},stop:function(){_&&_.send("cancel"),this.status="idle",y.pause(),y.currentTime>0&&(y.currentTime=0),g=[],b=[],h(this.status)},flush:function(){this.stop(),this.elapsedTime=0,g=[],b=[],h(this.status)},record:function(){return i(this,void 0,void 0,function(){var e,n=this;return o(this,function(s){switch(s.label){case 0:return y.pause(),(e=this,"preparing"==e.status)?[2]:(e.status="preparing",[4,r()]);case 1:return s.sent(),_?(e.status="recording",h(e.status),M||e.loadComponents()):(_=new WebSocket(t((new d.AudioContext).sampleRate)),_.onopen=function(){y.currentTime>0&&(y.currentTime=0),e.status="recording",h(e.status),v||_.send("rawdata"),M||e.loadComponents()},_.onerror=function(t){console.log(t),e.status="stop",h(e.status),u(),c.notify.error(t.error)},_.onmessage=function(e){return i(n,void 0,void 0,function(){var t,n,r,i;return o(this,function(o){switch(o.label){case 0:return e.data&&e.data.indexOf&&"function"==typeof e.data.indexOf&&-1!==e.data.indexOf("error")?(console.log(e.data),u(),c.notify.error(e.data),[3,3]):[3,1];case 1:return e.data&&e.data.text&&"function"==typeof e.data.text&&"encoding"===this.status?(r=(n=JSON).parse,[4,e.data.text()]):[3,3];case 2:t=r.apply(n,[o.sent()]),"ok"===t.status?(u(),c.notify.info("recorder.saved"),i=t.docId,h("saved-"+i),this.elapsedTime=0):(console.log(e.data),u(),c.notify.error(e.data)),o.label=3;case 3:return[2]}})})},_.onclose=function(t){e.status="stop",e.elapsedTime=0,h(e.status),l()}),[2]}})})},suspend:function(){this.status="suspended",y.pause(),h(this.status)},pause:function(){this.status="paused",y.pause(),h(this.status)},play:function(){this.pause(),this.status="playing";var e=new Worker("/infra/public/js/audioEncoder.js");e.postMessage(["init",f.sampleRate]),e.postMessage(["wav",b,g,k]),e.onmessage=function(e){y.src=window.URL.createObjectURL(e.data),y.play()},h(this.status)},state:function(e){return Y.push(e),function(){Y=Y.filter(function(t){return t!==e})}},title:"",status:"idle",save:function(){n(),_.send("save-"+this.title),this.status="encoding",h(this.status)},mute:function(e){p.gain.value=e?0:1}}}(),window.entcore||(window.entcore={}),window.entcore.recorder=t.recorder},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388);t.removableList=r.ng.directive("removableList",function(){return{restrict:"E",template:'\n <div class="row info" ng-if="ngModel.length === 0"><i18n>[[ noitems ]]</i18n></div>\n <div ng-show="ngModel.length > 0">\n <div class="search-pagination flex-row align-center">\n <div class="cell twelve">\n <input class="twelve" \n type="text" \n ng-model="searchText"\n placeholder="[[ placeholder ]]"\n ng-keypress="preventKeyEnter($event)"/>\n <i class="search"></i>\n </div>\n </div>\n <div class="spacer-small"></div>\n <nav class="removable-list wrapper left-text" ng-show="filteredItems.length > 0">\n <div class="row big-block-container" \n ng-repeat="item in filteredItems = (ngModel | filter:filterByName)" \n ng-click="selectItem({item: item})"\n ng-class="{ \'active\': item.id === selectedItem.id }">\n <span class="block cell-ellipsis right-spacing-twice">[[ item.name ]]</span>\n <i class="trash right-spacing-twice vertical-spacing-four absolute-magnet only-desktop" \n ng-click="deleteItem({item: item}); $event.stopPropagation();" \n ng-if="removable"></i>\n </div>\n </nav>\n <div ng-show="filteredItems.length === 0"><span class="medium-importance"><i18n>[[ noresult ]]</i18n></span></div>\n </div>\n ',scope:{ngModel:"=",selectedItem:"=",selectItem:"&",deleteItem:"&"},link:function(e,t,n){e.placeholder=n.placeholder,e.noitems=n.noitems,e.noresult=n.noresult,e.removable=!r.angular.isUndefined(n.deleteItem),e.searchText="",e.filterByName=function(t){return t.name||(t.name=""),t.name.toLowerCase().includes(e.searchText.toLowerCase())},e.preventKeyEnter=function(e){13===e.which&&e.preventDefault()}}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(37);t.resourceRight=r.ng.directive("resourceRight",["$parse",function(e){return{restrict:"EA",template:"<div ng-transclude></div>",replace:!1,transclude:!0,compile:function(t,n,r){return function(t,n,r){var o=e(r.resource);if(void 0===r.name)throw"Right name is required";var s=(n.children("div"),function(){var e=!0;void 0!==o(t)&&(e=r.name&&(o(t)instanceof Array&&void 0!==o(t).find(function(e){return!e.myRights||!0!==e.myRights[r.name]&&!(e.myRights[r.name]&&e.myRights[r.name].right)})||o(t)instanceof i.Model&&(!o(t).myRights||void 0===o(t).myRights[r.name])||void 0!==o(t).myRights&&void 0===o(t).myRights[r.name])),e?n.hide():n.show()});r.$observe("name",function(){return s()}),t.$watch(function(){return o(t)},function(){return s()}),t.$watch(function(){return o(t)&&o(t).myRights},function(){return s()})}}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388);t.searchModule=r.ng.directive("searchModule",["$window",function(e){return{restrict:"E",transclude:!0,template:'\n <form name="searchForm" ng-submit="search()" novalidate>\n <article class="twelve cell reduce-block-six">\n <pastilles \n ng-model="ngModel"\n images="images">\n </pastilles>\n <ng-transclude></ng-transclude>\n </article>\n </form>\n ',scope:{ngModel:"=",ngChange:"&",search:"&"},link:function(t,n,i){var o="string"==typeof i.images?JSON.parse(i.images):i.images,s="string"==typeof i.i18n?JSON.parse(i.i18n):i.i18n;Array.isArray(s)||(s=[s]);var a,u=n.find("ng-transclude").children(),c=u.length;for(t.images=[],a=0;a<c;a++)t.images[a]={img:o[a],visible:!0,i18n:s[a]};var l=function(){for(a=0;a<c;a++)u.eq(a).hide()};l();var d=function(){for(a=0;a<c;a++)t.images[a].visible="none"!==u.eq(a).children().eq(0).css("display");t.$apply()};t.$watch("ngModel",function(e){l(),u.eq(e).show(),t.ngChange({index:e})}),r.angular.element(e).bind("resize",function(){d()}),setTimeout(function(){d()},0)}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(3),o=n(1);t.selectList=r.ng.directive("selectList",function(){return{restrict:"E",transclude:!0,scope:{displayAs:"@",placeholder:"@",display:"="},template:'<div class="selected-value">[[showValue()]]</div><div class="options hidden" ng-transclude></div>',link:function(e,t,n){e.showValue=function(){return e.display?e.displayAs?i.idiom.translate(e.display[e.displayAs]):i.idiom.translate(e.display):i.idiom.translate(e.placeholder)},t.children(".options").on("mouseover",function(e){e.stopPropagation()}),t.children(".selected-value").on("click",function(){t.children(".options").hasClass("hidden")?(setTimeout(function(){t.parent().css({"z-index":9999}),t.parents("editor-toolbar").each(function(e,t){o.$(t).css({"margin-top":"-"+t.scrollTop+"px","min-height":"0",height:"auto"})}),t.parents().css({overflow:"visible"})},0),t.children(".options").removeClass("hidden"),t.children(".options").height(t.children(".options")[0].scrollHeight)):(t.parent().css({"z-index":""}),t.parents().css({overflow:""}),t.parents("editor-toolbar").each(function(e,t){o.$(t).css({"margin-top":"","min-height":"",height:""})}),t.children(".options").addClass("hidden"))}),o.$("body").click(function(e){e.target===t.find(".selected-value")[0]||t.children(".options").hasClass("hidden")||(0===t.parents("lightbox").length&&(t.parent().css({"z-index":""}),t.parents().css({overflow:""})),t.parents("editor-toolbar").each(function(e,t){o.$(t).css({"margin-top":"","min-height":"",height:""})}),t.children(".options").addClass("hidden"))})}}})},function(e,t,n){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(2),a=n(943),u=n(38),c=n(34),l=n(3),d=n(4),h=n(37),f=n(37),p=n(937),m=n(35),_=n(6),v=n(386);t.sharePanel=a.ng.directive("sharePanel",["$rootScope",function(e){return{scope:{resources:"=",appPrefix:"=",onCancel:"&?",onSubmit:"&?",onValidate:"&?",onFailure:"&?",onFeed:"&?",closeDelegate:"&?",confirmationCloseDelegate:"&?",canEditDelegate:"&?",autoClose:"="},restrict:"E",templateUrl:"/assets/js/entcore/template/share-panel.html",link:function(t,n,a){function y(){v.Behaviours.loadBehaviours(u.appPrefix,function(){v.Behaviours.applicationsBehaviours[u.appPrefix]&&v.Behaviours.applicationsBehaviours[u.appPrefix].share&&"function"==typeof v.Behaviours.applicationsBehaviours[u.appPrefix].share&&(t.shareOverrideDefaultActions=v.Behaviours.applicationsBehaviours[u.appPrefix].share().overrideDefaultActions)})}function g(e){var n=[];return d._.where(t.actions,{displayName:e}).forEach(function(e){e.name.forEach(function(e){n.push(e)})}),n}function b(e,n){var r={};return e.forEach(function(e){var n=d._.find(t.actions,function(t){return-1!==t.name.indexOf(e)});n&&(r[n.displayName]||(r[n.displayName]=!0))}),r}function w(e){t.actions=e,t.actions.forEach(function(e){var t=e.displayName.split(".")[1];Y[t]&&(e.priority=Y[t].priority,e.requires=Y[t].requires)})}function M(e,t){function n(n){for(var i in e[n].checked){if(!t[n].checked[i])return!0;e[n].checked[i].forEach(function(e){r=r||-1===t[n].checked[i].indexOf(e)})}return r}var r=!1;return n("users")||n("groups")}var k=u.appPrefix,L={},x=function(e,n,r){a.onFeed&&t.onFeed({$data:e,$resource:n,$actions:r})};if(t.display={showSaveSharebookmarkInput:!1,sharebookmarkSaved:!1,workflowAllowSharebookmarks:!1,showCloseConfirmation:!1,showBookmarkMembers:!1,search:{processing:!1}},function(){i(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,f.model.me.workflow.load(["directory"])];case 1:return e.sent(),t.display.workflowAllowSharebookmarks=f.model.me.workflow.directory.allowSharebookmarks,t.$apply(),[2]}})})}(),t.appPrefix&&(k=t.appPrefix),c.http().get(u.appPrefix+"/config/share").done(function(e){e&&e.overrideDefaultActions?t.shareOverrideDefaultActions=e.overrideDefaultActions:y()}).e404(function(e){y()}),t.shareTable="/assets/js/entcore/template/share-panel-table.html",!(t.resources instanceof Array||t.resources.myRights||t.resources instanceof h.Model))throw new TypeError("Resources in share panel must be instance of Array or implement Rights interface");t.resources instanceof Array||(t.resources=[t.resources]),t.sharing={},t.found=[],t.maxResults=5,t.editResources=[],t.sharingModel={edited:[],changed:!1},t.canEdit=function(e){return!a.canEditDelegate||t.canEditDelegate({$item:e})},t.addResults=function(){t.maxResults+=5};var Y={};c.http().get("/"+u.infraPrefix+"/public/json/sharing-rights.json").done(function(e){Y=e,t.actions&&w(t.actions)}),t.translate=l.idiom.translate;var T=!1,S=function(){if(!T){T=!0;var e=!0;t.resources.length||(T=!1),t.resources.forEach(function(n){var i=n._id;c.http().get("/"+k+"/share/json/"+i+"?search=").done(function(i){function o(n){for(var i in s[n].checked){var o=s[n].checked[i],a=b(o),u=d._.findWhere(s[n].visibles,{id:i});if(u){var c=r({},u);c.actions=a,e&&t.sharingModel.edited.push(c),c.index=t.sharingModel.edited.length}}if(s[n].checkedInherited){var l=s[n].checkedInherited;for(var i in l){var o=l[i],a=b(o),u=d._.findWhere(s[n].visibles,{id:i});if(u){var c=r({},u);c.actions=a,e&&t.sharingModel.editedInherited.push(c),c.index=t.sharingModel.editedInherited.length}}}}x(i,n,i.actions),e&&(i.users.visibles.map(function(e){return e.type="user"}),i.groups.visibles.map(function(e){return e.type="group"}),t.sharingModel=i,t.sharingModel.edited=[],t.sharingModel.editedInherited=[]),i._id=n._id,t.editResources.push(i);var s=t.editResources[t.editResources.length-1];t.sharing.actions||w(i.actions),o("groups"),o("users"),e||(M(s,t.sharingModel)||M(t.sharingModel,s))&&(t.varyingRights=!0,t.sharingModel.edited=[],t.varyingRightsI18nKey=l.idiom.translate(k+".share.varyingrights")===k+".share.varyingrights"?"share.varyingrights":k+".share.varyingrights"),e=!1,t.$apply("sharingModel.edited"),T=!1})})}};t.canShowMore=function(){var e=0;return t.sharingModel.edited&&t.sharingModel.edited.length&&(e+=t.sharingModel.edited.length),t.sharingModel.editedInherited&&t.sharingModel.editedInherited.length&&(e+=t.sharingModel.editedInherited.length),e>t.maxEdit},t.isSubmitDisabled=function(){for(var e=!1,n=0,r=t.sharingModel.edited;n<r.length;n++){for(var i=r[n],o=!0,s=0,a=t.actions;s<a.length;s++){var u=a[s];i.actions[u.displayName]&&(o=!1)}o&&(e=!0)}return!t.sharingModel.changed||e},t.$watch("resources",function(){t.actions=[],t.sharingModel.edited=[],t.search="",t.found=[],t.varyingRights=!1,t.sharingModel.changed=!1,t.display.showSaveSharebookmarkInput=!1,t.display.sharebookmarkSaved=!1,t.maxEdit=3,t.maxResults=5,S()}),t.$watchCollection("resources",function(){t.actions=[],t.sharingModel.edited=[],t.search="",t.found=[],t.varyingRights=!1,t.sharingModel.changed=!1,t.display.showSaveSharebookmarkInput=!1,t.display.sharebookmarkSaved=!1,t.maxEdit=3,t.maxResults=5,S()}),t.addEdit=function(e){e.actions={},t.sharingModel.edited.push(e),e.index=t.sharingModel.edited.length;var n=t.found.indexOf(e);t.found.splice(n,1);var r=[];t.actions.forEach(function(n){var i=n.displayName.split(".")[1];t.shareOverrideDefaultActions?(t.shareOverrideDefaultActions.forEach(function(t){return e.actions[t]=!0}),r=t.shareOverrideDefaultActions):Y[i].default&&(e.actions[n.displayName]=!0,r.push(n))}),"sharebookmark"==e.type&&c.http().get("/directory/sharebookmark/"+e.id).done(function(n){e.users=n.users,e.groups=n.groups,e.users&&e.users.forEach(function(e){e.type="sharebookmark-user",e.actions={},r.forEach(function(t){e.actions[t]=!0})}),e.groups&&e.groups.forEach(function(e){e.type="sharebookmark-group",e.actions={},r.forEach(function(t){e.actions[t]=!0})}),t.$apply()}),t.sharingModel.changed=!0,t.display.showSaveSharebookmarkInput=!1,t.display.sharebookmarkSaved=!1},t.clearSearch=function(){t.sharingModel.groups=[],t.sharingModel.users=[],t.found=[]},t.findUserOrGroup=function(){var e=l.idiom.removeAccents(t.search).toLowerCase(),n=p.Me.session.functions.ADMIN_LOCAL?e.substr(0,3):"";if(!(L[n]||L[n]&&L[n].loading)){L[n]={loading:!0};var r=t.resources[0]._id,i="/"+k+"/share/json/"+r+"?search="+n;return n||(i="/"+k+"/share/json/"+r),void c.http().get(i).done(function(e){e.users.visibles.map(function(e){return e.type="user"}),e.groups.visibles.map(function(e){return e.type="group"}),L[n]={groups:e.groups,users:e.users},t.sharingModel.groups=L[n].groups,t.sharingModel.users=L[n].users,1==f.model.me.workflow.directory.allowSharebookmarks?c.http().get("/directory/sharebookmark/all").done(function(e){var r=d._.map(e,function(e){return e.type="sharebookmark",e});L[n].sharebookmarks=r,t.findUserOrGroup(),t.$apply()}):(t.findUserOrGroup(),t.$apply())})}t.sharingModel.groups=L[n].groups,t.sharingModel.users=L[n].users,t.sharingModel.sharebookmarks=L[n].sharebookmarks,t.found=d._.union(d._.filter(t.sharingModel.sharebookmarks,function(n){return-1!==l.idiom.removeAccents(n.name).toLowerCase().indexOf(e)&&void 0===t.sharingModel.edited.find(function(e){return e.id===n.id})}),d._.filter(null==t.sharingModel.groups?[]:t.sharingModel.groups.visibles,function(n){return-1!==l.idiom.removeAccents(n.name).toLowerCase().indexOf(e)&&void 0===t.sharingModel.edited.find(function(e){return e.id===n.id})}),d._.filter(null==t.sharingModel.users?[]:t.sharingModel.users.visibles,function(n){var r=l.idiom.removeAccents(n.lastName+" "+n.firstName).toLowerCase(),i=l.idiom.removeAccents(n.firstName+" "+n.lastName).toLowerCase(),o=l.idiom.removeAccents(n.username).toLowerCase();return-1!==r.indexOf(e)||-1!==i.indexOf(e)||-1!==o.indexOf(e)&&void 0===t.sharingModel.edited.find(function(e){return e.id===n.id})})),t.found=d._.filter(t.found,function(e){return-1===t.sharingModel.edited.findIndex(function(t){return t.id===e.id})}),t.display.search.processing=!1,t.$apply()},t.remove=function(e){t.sharingModel.edited=d._.reject(t.sharingModel.edited,function(t){return t.id===e.id}),t.sharingModel.changed=!0,t.display.showSaveSharebookmarkInput=!1,t.display.sharebookmarkSaved=!1},t.maxEdit=3,t.displayMore=function(){t.maxEdit+=5},t.changeAction=function(e,n){function r(e,n){e.actions[n.displayName]?n.requires.forEach(function(n){var r=d._.find(t.actions,function(e){return-1!==e.displayName.split(".")[1].indexOf(n)});r&&(e.actions[r.displayName]=!0)}):d._.filter(t.actions,function(e){return void 0!==d._.find(e.requires,function(e){return-1!==n.displayName.split(".")[1].indexOf(e)})}).forEach(function(t){t&&(e.actions[t.displayName]=!1)})}if("sharebookmark"==e.type&&(e.users.forEach(function(t){t.actions[n.displayName]=e.actions[n.displayName],r(t,n)}),e.groups.forEach(function(t){t.actions[n.displayName]=e.actions[n.displayName],r(t,n)})),"sharebookmark-user"==e.type||"sharebookmark-group"==e.type){var i=t.sharingModel.edited.find(function(t){return t.id==e.id});i?(i.actions=e.actions,i.hide=!0):(e.hide=!0,t.sharingModel.edited.push(e))}r(e,n),t.sharingModel.changed=!0},t.share=function(){return i(this,void 0,void 0,function(){var n,r,s,u,l,d;return o(this,function(h){switch(h.label){case 0:t.sharingModel.changed=!1,n={},r={},s={},u={},t.sharingModel.edited.forEach(function(e){var t=[];for(var n in e.actions)e.actions.hasOwnProperty(n)&&1==e.actions[n]&&(t=t.concat(g(n)));"sharebookmark"==e.type?u[e.id]=t:"user"==e.type||"sharebookmark-user"==e.type?r[e.id]=t:s[e.id]=t}),n.users=r,n.groups=s,n.bookmarks=u,l=t.resources.map(function(s){return i(this,void 0,void 0,function(){var i,u,l;return o(this,function(o){switch(o.label){case 0:if(s.myRights&&(void 0!=s.myRights.share||void 0!=s.myRights.manage||void 0!=s.myRights.manager)&&s.shared&&(i=[],(u=s.shared.find(function(e){return e.userId==f.model.me.userId}))&&(Object.keys(u).forEach(function(e){1==u[e]&&"userId"!=e&&i.push(e)}),r[f.model.me.userId]=i,n.users=r)),!a.onValidate)return[3,4];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,t.onValidate({$data:n,$resource:s,$actions:t.actions})];case 2:return o.sent(),[3,4];case 3:return l=o.sent(),[2,Promise.reject(l)];case 4:return[2,new Promise(function(t,r){c.http().putJson("/"+k+"/share/resource/"+s._id,n).done(function(n){e.$broadcast("share-updated",n["notify-timeline-array"]),t()}).error(function(e){r(e)})})]}})})}),h.label=1;case 1:return h.trys.push([1,3,,4]),[4,Promise.all(l)];case 2:return h.sent(),m.notify.success("share.notify.success"),[3,4];case 3:return d=h.sent(),a.onFailure?t.onFailure({$error:d}):m.notify.error("share.notify.error"),[3,4];case 4:return t.autoClose?[4,t.closePanel(!1)]:[3,6];case 5:h.sent(),h.label=6;case 6:return a.onSubmit&&t.onSubmit({$shared:n}),[2]}})})},t.createSharebookmark=function(e){if(1==f.model.me.workflow.directory.allowSharebookmarks){var n=[];t.sharingModel.edited.forEach(function(e){"user"==e.type||"group"==e.type?n.push(e.id):(e.users&&e.users.forEach(function(e){return n.push(e.id)}),e.groups&&e.groups.forEach(function(e){return n.push(e.id)}))});var r={name:e,members:n};c.http().postJson("/directory/sharebookmark",r).done(function(e){t.display.sharebookmarkSaved=!0,t.$apply()})}},t.typeSort=function(e){return"sharebookmark"==e.type?0:"group"==e.type?1:2};var D=function(){n.closest(".lightbox").first().fadeOut(function(){t.display.showCloseConfirmation=!1}),s("body").css({overflow:"auto"}),s("body").removeClass("lightbox-opened"),n.closest(".lightbox").find(".content > .close-lightbox").css({visibility:"visible"});var e=n.closest("lightbox").isolateScope();e&&(e.$eval(e.onClose),e.show=!1),S(),t.clearSearch(),t.search=""};t.closePanel=function(e){return void 0===e&&(e=!0),i(this,void 0,void 0,function(){return o(this,function(n){return a.closeDelegate?t.closeDelegate({$canceled:e,$close:D}):D(),e&&a.onCancel&&t.onCancel(),[2]})})},t.revertClose=function(){n.closest(".lightbox").find(".content > .close-lightbox").css({visibility:"visible"}),t.display.showCloseConfirmation=!1};var $=function(e){if(e.stopPropagation(),t.sharingModel.changed){if(!t.display.showCloseConfirmation){if(a.confirmationCloseDelegate)return void t.confirmationCloseDelegate({$canceled:!0,$close:D});t.display.showCloseConfirmation=!0,n.closest(".lightbox").find(".content > .close-lightbox").css({visibility:"hidden"}),t.$apply()}}else t.closePanel(!0);t.$apply()};n.closest(".lightbox").find(".background, .content > .close-lightbox").on("click",$),t.getColor=function(e){return _.ui.profileColors.match(e)},t.$on("$destroy",function(){n.closest(".lightbox").find(".background, .content > .close-lightbox").off("click",$)})}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(3),o=n(1),s=n(6);t.slider=r.ng.directive("slider",["$compile","$parse",function(e,t){return{restrict:"E",scope:!0,template:'<div class="label"></div><div class="bar"></div><div class="filled"></div><div class="cursor"></div><legend class="min"></legend><legend class="max"></legend>',link:function(e,n,r){n.addClass("drawing-zone");var a=n.children(".cursor"),u=parseFloat(r.max),c=parseFloat(r.min),l=t(r.ngModel),d=function(e){var t=parseInt((e-c)*n.children(".bar").width()/(u-c));a.css({left:t+"px",position:"absolute"}),n.children(".filled").width(a.position().left),n.children(".label").css({left:t+"px"}),(r.label.indexOf("Mo")>-1||r.label.indexOf("Ko")>-1&&parseInt(r.label.split(" ")[0],10)>500)&&n.children(".label").css({color:"orange"})};o.$(window).on("resize",function(){d(l(e))}),e.$watch(function(){return l(e)},d),r.$observe("label",function(){return n.find(".label").text(r.label)}),"number"!=typeof l(e)&&(l.assign(e,parseInt(r.default)),d(l(e))),n.children("legend.min").html(i.idiom.translate(r.minLegend)),n.children("legend.max").html(i.idiom.translate(r.maxLegend)),n.children(".bar, .filled").on("click",function(t){var r=t.clientX-n.children(".bar").offset().left,i=r*(u-c)/n.children(".bar").width()+c;l.assign(e,i),e.$apply()}),s.ui.extendElement.draggable(a,{lock:{vertical:!0},mouseUp:function(){var t=a.position().left,r=t*(u-c)/n.children(".bar").width()+c;l.assign(e,r),e.$apply()},tick:function(){var e=parseInt(a.position().left);n.children(".filled").width(e),n.children(".label").css({left:e+"px"})}})}}}])},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(388),s=n(7),a=n(37);t.smartBanner=o.ng.directive("smartBanner",function(){return{restrict:"E",template:'\n <div ng-if="showBanner" class="smartbanner">\n <style>\n .smartbanner {\n left:0;\n bottom:0;\n width:100%;\n height:78px;\n background:#fff;\n z-index: 1000000;\n overflow:hidden;\n position: fixed;\n border: 1px solid #ccc;\n margin-bottom: 5px;\n }\n .smartbanner-close {\n position:absolute;\n left:7px;top:7px;\n display:block;\n font-family:\'ArialRoundedMTBold\',Arial;\n font-size:15px;\n text-align:center;\n text-decoration:none;\n border-radius:14px;\n border:0;\n width:17px;\n height:17px;\n line-height:17px;\n color:#b1b1b3;\n background:#efefef;\n }\n .smartbanner-close:active,.smartbanner-close:hover {\n color:#333;\n }\n .smartbanner-icon{\n position:absolute;\n left:30px;\n top:10px;\n display:block;\n width:60px;\n height:60px;\n background-color: #fff;\n background-size:cover;\n }\n .smartbanner-info{\n position:absolute;\n left:98px;\n top:15px;\n width:44%;\n font-size:12px;\n line-height:1.2em;\n font-weight:bold;\n color:#999;\n }\n .smartbanner-title {\n font-size:15px;\n line-height:17px;\n color:#000;\n font-weight:bold;\n }\n .smartbanner-button{\n position:absolute;\n right:20px;\n top:24px;\n padding:0 10px;\n min-width:12%;\n height:24px;\n font-size:14px;\n line-height:24px;\n text-align:center;\n font-weight:bold;\n color:#fff;\n background-color:#b3c833;\n text-decoration:none;\n border-radius:5px;\n }\n \n </style>\n <div class="smartbanner-container">\n <a ng-click="closeBanner()" class="smartbanner-close">&times;</a>\n <img class="smartbanner-icon" ng-src="[[icon]]">\n <div class="smartbanner-info">\n <div class="smartbanner-title"><i18n>smartbanner.name</i18n></div>\n <div><i18n>smartbanner.description</i18n></div>\n </div>\n <a href="[[appRef]]" target="_blank" class="smartbanner-button">\n <span class="smartbanner-button-text"><i18n>smartbanner.action</i18n></span>\n </a>\n </div>\n </div>\n ',scope:{},link:function(e,t,n){e.closeBanner=function(){e.setCookie("test",30),e.showBanner=!1},e.getCookie=function(){for(var e=decodeURIComponent(document.cookie),t=e.split(";"),n=0;n<t.length;n++){for(var r=t[n];" "==r.charAt(0);)r=r.substring(1);if(0==r.indexOf("smartBanner="))return r.substring("smartBanner=".length,r.length)}return null},e.setCookie=function(e,t){var n=new Date;n.setTime(n.getTime()+24*t*60*60*1e3);var r="expires="+n.toUTCString();document.cookie="smartBanner="+e+";"+r},e.showBanner=!1,e.init=function(){return r(this,void 0,void 0,function(){var t,n,r;return i(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,s.default.get("/conf/smartBanner")];case 1:if(t=i.sent(),null!=t.data){if(e.banner=t.data,n=e.banner["excludeUserTypes-"+o.skin.skin]||[],-1!=n.indexOf(a.model.me.type))return[2];e.showBanner=null==e.getCookie(),e.icon=o.idiom.translate("smartbanner.icon.uri"),e.showBanner&&(/Android/i.test(navigator.userAgent)?(e.store=o.idiom.translate("smartbanner.android.store"),e.appRef=o.idiom.translate("smartbanner.android.uri")):/iPhone|iPad|iPod/i.test(navigator.userAgent)?(e.store=o.idiom.translate("smartbanner.ios.store"),e.appRef=o.idiom.translate("smartbanner.ios.uri")):e.showBanner=!1)}return[3,3];case 2:return r=i.sent(),[3,3];case 3:return[2]}})})},e.init()}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(386);t.sniplet=r.ng.directive("sniplet",["$timeout",function(e){return{restrict:"E",scope:!0,template:"<div ng-include=\"'/' + application + '/public/template/behaviours/sniplet-' + template + '.html'\"></div>",link:function(t,n,r){var o=function(){e(function(){i.Behaviours.loadBehaviours(t.application,function(e){var n=(e.sniplets[t.template],e.sniplets[t.template].controller);for(var r in n)t[r]=n[r];"function"==typeof t.init&&t.init()})},10)};r.$observe("application",function(){t.application=r.application,t.source=t.$eval(r.source),o()}),r.$observe("template",function(){t.template=r.template})}}}]),t.snipletSource=r.ng.directive("snipletSource",["$parse","$timeout",function(e,t){return{restrict:"E",scope:!0,template:"<div ng-include=\"'/' + application + '/public/template/behaviours/sniplet-source-' + template + '.html'\"></div>",controller:["$scope","$timeout",function(e,t){e.setSnipletSource=function(t){e.ngModel.assign(e,t),e.ngChange(),e.snipletResource.save()}}],link:function(n,r,o){var s=function(){t(function(){i.Behaviours.loadBehaviours(n.application,function(e){if(e.sniplets[n.template]){var t=e.sniplets[n.template].controller;for(var r in t)n[r]=t[r];"function"==typeof n.initSource&&n.initSource()}})},10)};o.$observe("application",function(){n.application=o.application,s()}),o.$observe("template",function(){n.template=o.template}),n.template=o.template,n.ngModel=e(o.ngModel),n.ngChange=function(){n.$eval(o.ngChange)}}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(6),o=n(1);t.sortableList=r.ng.directive("sortableList",["$compile",function(e){return{restrict:"A",controller:function(){},compile:function(t,n,r){var i=t.html();return function(t,n,r){t.updateElementsOrder=function(o){var s=n.find("[sortable-element]");s.removeClass("animated");var a=!0;s.filter("[sortable-order='after']").first().each(function(e,t){o.detach().insertBefore(t),a=!1}),a&&n.append(o.detach()),s=n.find("[sortable-element] > div"),s.each(function(e,t){var n=angular.element(t).scope();e!==n.ngModel&&(n.ngModel=e,n.$apply())}),r.onChange&&t.$eval(r.onChange),s.attr("style",""),n.html(e(i)(t)),t.$apply()}}}}}]),t.sortableElement=r.ng.directive("sortableElement",["$parse",function(e){return{scope:{ngModel:"=",ngChange:"&"},require:"^sortableList",template:"<div ng-transclude></div>",transclude:!0,link:function(e,t,n){var r,s=0,a=0;e.$watch("ngModel",function(t,n){t!==n&&"function"==typeof e.ngChange&&e.ngChange()}),i.ui.extendElement.draggable(t,{lock:{horizontal:!0},delayOnTouchOnly:400,mouseUp:function(){e.$parent.updateElementsOrder(t),t.on("click",function(){e.$parent.$eval(n.ngClick)})},startDrag:function(){r=t.parents("[sortable-list]").find("[sortable-element]"),r.attr("style",""),setTimeout(function(){r.addClass("animated")},20),t.css({"z-index":1e3}),s=parseInt(t.css("margin-top"))||0,a=parseInt(t.css("margin-bottom"))||0},tick:function(){var e=t.outerHeight(),n=e/2,i=t.offset().top+n+s,u=null,c=0;r.each(function(r,l){if(t[0]!==l){var d=c;c=o.$(l).offset().top+n,(!u||d<i)&&i<=c?(o.$(l).attr("sortable-order","after"),u&&o.$(u).css({"margin-bottom":a+n+"px"}),o.$(l).css({"margin-top":s+(u?n:e)+"px"})):(i>c?o.$(l).attr("sortable-order","before"):o.$(l).attr("sortable-order","after"),u&&o.$(u).css({"margin-bottom":a+"px"}),o.$(l).css({"margin-top":s+"px"})),u=l}}),u&&(i>c?o.$(u).css({"margin-bottom":a+e+"px"}):o.$(u).css({"margin-bottom":a+"px"}))}})}}}])},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},o=this;Object.defineProperty(t,"__esModule",{value:!0});var s,a,u=n(943),c=n(6),l=n(1),d=!0,h=function(e){d&&(s=e.offset().top-parseInt(e.css("margin-top")),a=l.$(".height-marker").height(),d=!1);var t=s-l.$(window)[0].scrollY;t<=a?(t=a,e.addClass("floating")):e.removeClass("floating"),e.css({top:t+"px"})};t.stickyRow=u.ng.directive("stickyRow",function(){return{restrict:"E",template:'\n <div class="row" ng-transclude></div>\n ',scope:{name:"@"},transclude:!0,link:function(e,t,n){return r(o,void 0,void 0,function(){var e;return i(this,function(n){return e=function(){l.$(window).width()>c.ui.breakpoints.tablette?l.$(window).on("scroll.stickyRow",function(){return h(t)}):(l.$(window).off("scroll.stickyRow"),t.removeClass("floating"))},l.$(window).on("resize",e()),e(),[2]})})}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943);t.Switch=r.ng.directive("switch",function(){return{restrict:"E",scope:{ngModel:"=",ngChange:"&",ngDisabled:"@"},template:'<label class="switch"><input type="checkbox" ng-model="ngModel" ng-change="valueChange()" ng-disabled="ngDisabled"/><span class="tick cell"></span></label>',link:function(e,t,n,r){e.valueChange=function(){setTimeout(function(){n.ngChange&&e.$parent.$eval(n.ngChange)},0)}}}})},function(e,t,n){"use strict";var r=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=n(551),o=n(3),s=n(1),a=n(943),u=n(390),c=n(6),l=function(){function e(e,t,n,r,o,s,a){var u=this;this.$compile=e,this.scope=t,this.element=n,this.attributes=r,this.tooltipDisplayCondition=o,this.tooltipType=s,this.sourceElement=a,this.onChange=new i.Subject,this.isBinded=!1,this.tooltipCheck=!1,this.subscription=new i.Subscription,this.destroy=function(){u.unbind(),u.doRemove()},this.tryMoveTip=function(){u.isReady()&&u.moveTip()},this.show=function(e){if(!u.isReady())return!1;u.onChange.next("show")},this.hide=function(e){if(!u.isReady())return!1;u.onChange.next("hide")},this.targetElement=n,r.tooltipTargetSelector&&(this.targetElement=n.find(r.tooltipTargetSelector)),r.tooltipRestrictSelector&&this.targetElement&&(this.restrictToElement=this.targetElement.parents(r.tooltipRestrictSelector),1!==this.restrictToElement.length&&(this.restrictToElement=void 0)),this.tooltipCheck=!0,n[0].hasAttribute("tooltip-check")&&this.scope.$watch(function(){return t.$eval(r.tooltipCheck)},function(e){return u.tooltipCheck=!!e}),n[0].hasAttribute("tooltip-check-content")&&t.$watch(function(){return n[0].offsetHeight},function(){u.tooltipCheck=n[0].offsetHeight<n[0].scrollHeight}),this.bind(),this.scope.$on("$destroy",this.destroy)}return e.create=function(e){var t=e.$compile,n=e.attributes,r=e.element,i=e.scope,o=e.sourceElement,s=e.tooltipDisplayCondition,a=e.tooltipType;return n.tooltipTemplate?new d(t,i,r,n,s,a,o):new h(t,i,r,n,s,a,o)},e.prototype.isReady=function(){return!!this.targetElement},e.prototype.doShow=function(){this.tooltipDisplayCondition(this.element)&&(this.tip||this.createTip(),this.moveTip(),this.tip.fadeIn())},e.prototype.doRemove=function(){var e=this;this.tip&&this.tip.fadeOut(200,function(){e.tip.remove(),e.tip=void 0})},e.prototype.bind=function(){var e=this;if(!this.isBinded&&this.isReady()){this.subscription.add(this.onChange.debounceTime(400).subscribe(function(t){"hide"==t?e.doRemove():e.doShow()})),this.targetElement.on("mouseenter",this.show),this.targetElement.on("mouseleave",this.hide),s.$(window).on("scroll",this.tryMoveTip);try{this.observer=new MutationObserver(function(t){t.forEach(function(t){"disabled"===t.attributeName&&e.hide()})});var t={attributes:!0};this.observer.observe(this.targetElement[0],t)}catch(e){console.warn("[Tooltip] Could not listen attributes:",e)}this.isBinded=!0}},e.prototype.unbind=function(){this.subscription.unsubscribe(),this.targetElement.off("mouseenter",this.show),this.element.off("mouseout",this.hide),this.element.off("mouseleave",this.hide),s.$(window).off("scroll",this.tryMoveTip);try{this.observer&&this.observer.disconnect()}catch(e){console.warn("[Tooltip] Could not stop listen attributes:",e)}this.isBinded=!1},e}(),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.createTip=function(){var e=u.template.getPath(this.attributes.tooltipTemplate);this.tip=s.$("<div />").addClass("tooltip").html(this.$compile("<div ng-include='\""+e+"\"'></div>")(this.scope)).appendTo("body"),this.tip.css("position","absolute")},t.prototype.moveTip=function(){if(this.tip&&this.isReady()){var e=this.targetElement,t=this.tip,n=this.restrictToElement,r=e.offset().top,i=parseInt(e.offset().left-s.$(t).width()-5);n&&(i<n.offset().left&&(i=parseInt(e.offset().left+s.$(e).width()+5)),i+s.$(e).width()>n.offset().left+s.$(n).width()&&(i=n.offset().left+5,r+=30),r>n.height()+150&&(r-=130)),t.css("left",document.body.clientWidth>=i+t.outerWidth()?i:document.body.clientWidth-t.outerWidth()-1),t.css("top",r)}},t}(l),h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.isReady=function(){return!(s.$(window).width()<c.ui.breakpoints.tablette||!this.attributes[this.tooltipType]||!this.tooltipCheck||"undefined"===this.attributes[this.tooltipType])&&e.prototype.isReady.call(this)},t.prototype.createTip=function(){this.tip=s.$("<div />").addClass("tooltip").html(this.$compile('<div class="arrow"></div><div class="content">'+o.idiom.translate(this.attributes[this.tooltipType])+"</div> ")(this.scope)).appendTo("body")},t.prototype.moveTip=function(){if(this.tip&&this.isReady()){var e=s.$(this.sourceElement).get(0).getBoundingClientRect(),t=parseInt(e.top+window.scrollY+document.documentElement.clientTop+e.height),n=parseInt(e.left+window.scrollX+document.documentElement.clientLeft+e.width/2-s.$(this.tip).outerWidth()/2);t<5&&(t=5),n<5&&(n=5),this.tip.offset({top:t,left:document.body.clientWidth>=n+this.tip.outerWidth()?n:document.body.clientWidth-this.tip.outerWidth()-1})}},t}(l);t.tooltip=a.ng.directive("tooltip",["$compile",function(e){return{restrict:"A",link:function(t,n,r){l.create({$compile:e,scope:t,element:n,attributes:r,tooltipDisplayCondition:function(){return!0},tooltipType:"tooltip",sourceElement:n})}}}]),t.tooltipOnEllipsis=a.ng.directive("tooltipOnEllipsis",["$compile",function(e){return{restrict:"A",link:function(t,n,r){l.create({$compile:e,scope:t,element:n,attributes:r,tooltipDisplayCondition:function(e){var t=e.parent("a").get(0);return t.offsetWidth<t.scrollWidth},tooltipType:"tooltipOnEllipsis",sourceElement:n.parent("a")})}}}]),t.odebtTooltip=a.ng.directive("odebtTooltip",["$compile",function(e){return{restrict:"A",link:function(e,t,n){n.odebtTooltip&&jQuery(t).attr("title",n.odebtTooltip),jQuery(t).tooltip()}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388);t.transferColumns=r.ng.directive("transferColumns",function(){return{restrict:"E",template:'\n <div class="flex-row bottom-spacing">\n <div class="six">\n <div class="right-magnet right-spacing-three"\n ng-click="addAllItems()" \n ng-if="searchedItems.length > 0">\n <a><i18n class="small-text">portal.all.add</i18n> <i class="right-arrow horizontal-margin-small"></i></a>\n </div>\n </div>\n <div class="six">\n <div class="right-magnet right-spacing"\n ng-click="removeAllItems()" \n ng-if="ngModel.length > 0">\n <a><i18n class="small-text">portal.all.remove</i18n> <i class="close-icon horizontal-margin-small"></i></a>\n </div>\n </div>\n </div>\n <div class="flex-row">\n <div class="six scroll-nine-chips" bottom-scroll="updatingMaxLeftItems()">\n <div class="row info" ng-if="searchedItems.length === 0 && !loading"><i18n>portal.enter.criterias.search</i18n></div>\n <div class="row centered-text reduce-block-six" ng-if="loading">\n <img skin-src="/img/illustrations/loading.gif" width="30px" heigh="30px"/>\n </div>\n <contact-chip class="block relative movable" \n ng-model="item"\n action="addItem(item)"\n ng-class="{ \'divide-opacity\': item.selected, \'chip-hover\': !item.selected }"\n ng-repeat="item in searchedItems | limitTo:maxLeftItems">\n </contact-chip>\n </div>\n <div class="horizontal-margin-twice divider-border"></div>\n <div class="six scroll-nine-chips" bottom-scroll="updatingMaxRightItems()">\n <div class="flex-row warning" ng-if="textRightWarningTitle && ngModel.length === 0">\n <div><i class="warning"></i></div>\n <div>\n <div>[[ textRightWarningTitle ]]</div>\n <div>[[ textRightWarningDescription ]]</div>\n </div>\n </div>\n <contact-chip class="block relative removable chip-hover" stickerNotSelected\n ng-model="item"\n action="removeItem(item)"\n ng-repeat="item in ngModel | limitTo:maxRightItems">\n </contact-chip>\n </div>\n </div>\n ',scope:{ngModel:"=",searchedItems:"=",loading:"="},link:function(e,t,n){e.textTitle=n.textTitle,e.textRightWarningTitle=n.textRightWarningTitle,e.textRightWarningDescription=n.textRightWarningDescription,e.initMaxLeftItems=function(){e.maxLeftItems=50},e.initMaxRightItems=function(){e.maxRightItems=50},e.updatingMaxLeftItems=function(){e.maxLeftItems+=50},e.updatingMaxRightItems=function(){e.maxRightItems+=50},e.addItem=function(t){t.selected||(t.selected=!0,e.ngModel.push(t))},e.addAllItems=function(){e.searchedItems.forEach(function(t){e.addItem(t)})},e.removeItem=function(t){t.selected=!1,e.ngModel.splice(e.ngModel.indexOf(t),1),e.searchedItems.forEach(function(e){e.id===t.id&&(e.selected=!1)})},e.removeAllItems=function(){for(var t=e.ngModel.length-1;t>=0;t--)e.removeItem(e.ngModel[t])},e.$watchCollection("searchedItems",function(){e.initMaxLeftItems(),e.searchedItems.forEach(function(t){e.ngModel.forEach(function(e){t.id===e.id&&(t.selected=!0)})})}),e.$watchCollection("ngModel",function(){e.initMaxRightItems()}),e.initMaxLeftItems(),e.initMaxRightItems()}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943);t.trackInputEventDirective=r.ng.directive("trackInputEvent",["$parse",function(e){return{restrict:"A",require:["?ngModel"],link:function(t,n,r,i){var o=i[0],s=e(r.trackInputEvent)(t);if("EDITOR"==n[0].tagName){var a;o&&o.$formatters.push(function(e){if(a||(a=e),null!=e){var t=e.replace('/ class="ng-scope"/g',"");e!=a&&t!=a&&(s.onStart(!0),a=e)}return e})}else if("IMAGE-SELECT"==n[0].tagName){var u=-1;o&&o.$formatters.push(function(e){return-1==u&&(u=e),e!=u&&(s.onStart(!0),u=e),e})}else o&&o.$parsers.push(function(e){return s.onStart(!0),e})}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(37),i=n(943);t.userRole=i.ng.directive("userRole",function(){return{restrict:"A",link:function(e,t,n){var i=n.userRole;r.model.me.functions[i]?t.show():t.hide()}}}),t.userMissingRole=i.ng.directive("userMissingRole",function(){return{restrict:"A",link:function(e,t,n){var i=n.userMissingRole;r.model.me.functions[i]?t.hide():t.show()}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(37),o=n(1);t.widgets=r.ng.directive("widgets",["$compile",function(e){return{scope:{list:"="},restrict:"E",templateUrl:"/assets/js/entcore/template/widgets.html",link:function(e,t,n){t.on("index-changed",".widget-container",function(n){var r=angular.element(n.target).scope().widget;t.find(".widget-container").each(function(i,s){n.target!==s&&(o.$(n.target).offset().top+o.$(n.target).height()/2>o.$(s).offset().top&&o.$(n.target).offset().top+o.$(n.target).height()/2<o.$(s).offset().top+o.$(s).height()&&(r.setIndex(i),e.$apply("widgets")),o.$(n.target).offset().top>o.$(s).offset().top+o.$(s).height()&&i===t.find(".widget-container").length-1&&(r.setIndex(i),e.$apply("widgets")),o.$(n.target).offset().top+o.$(n.target).height()>o.$(s).offset().top&&0===i&&(r.setIndex(i),e.$apply("widgets")))}),t.find(".widget-container").css({position:"relative",top:"0px",left:"0px"})}),i.model.widgets.on("change",function(){0===t.find(".widget-container").length?(t.parents(".widgets").next(".widgets-friend").addClass("widgets-enemy"),t.parents(".widgets").addClass("hidden")):(t.parents(".widgets").next(".widgets-friend").removeClass("widgets-enemy"),t.parents(".widgets").removeClass("hidden"))})}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(1),o=n(37),s=n(4);t.wizard=r.ng.directive("wizard",function(){return{restrict:"E",templateUrl:"/assets/js/entcore/template/wizard.html",scope:{gotoStep:"=",onCancel:"&",onFinish:"&",finishCondition:"&"},transclude:!0,compile:function(e,t,n){return function(e,t,r){function a(){n(e.$parent.$new(),function(n){u=s._.filter(n,function(e){return"STEP"===e.tagName})[e.currentStep],e.internalNext=void 0!==i.$(u).attr("internal-next"),u=i.$(u),t.find(".current-step .step-content").html("").append(u)}),t.find(".current-step .step-content step [internal-next]").on("click",function(){e.nextStep()}),i.$("nav.steps li").removeClass("active"),i.$(t.find("nav.steps li")[e.currentStep]).addClass("active")}t.find("div.steps step").each(function(e,t){if(i.$(t).attr("workflow")){var n=i.$(t).attr("workflow").split("."),r=o.model.me.workflow;n.forEach(function(e){r=r[e]}),r||i.$(t).remove()}}),e.$watch("gotoStep",function(){e.gotoStep&&e.currentStep!=e.gotoStep&&(e.currentStep=e.gotoStep,a())}),t.find("div.steps").hide(),e.currentStep=0;var u,c=t.find("div.steps step");e.nbSteps=c.length;var l=t.find("nav.steps");l.append("<ul></ul>"),c.each(function(e,t){l.children("ul").append("<li>"+i.$(t).find("h1").html()+"</li>")}),e.nextCondition=function(){var e=angular.element(u[0]).scope();return!u[0].getAttribute("next-condition")||e.$eval(u[0].getAttribute("next-condition"))},e.nextStep=function(){if(e.nextCondition()){angular.element(u[0]).scope().$eval(u[0].getAttribute("on-next")),e.currentStep++,a()}},e.previousStep=function(){angular.element(u[0]).scope().$eval(u[0].getAttribute("on-previous")),e.currentStep--,a()},e.cancel=function(){e.currentStep=0,a(),e.onCancel()},e.checkFinishCondition=function(){return void 0===e.finishCondition()||e.finishCondition()},e.finish=function(){e.checkFinishCondition()&&(e.currentStep=0,a(),e.onFinish())},a()}}}}),t.wizardStep=r.ng.directive("step",function(){return{restrict:"E",transclude:!0,scope:{onNext:"&",onPrevious:"&",nextCondition:"&"},template:'<div class="step" ng-transclude></div>'}})},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(943),s=n(37),a=n(386),u=function(e){return function(t){return function(n,o,u){var c=this;u.$observe(e,function(){return r(c,void 0,void 0,function(){var n,r,c,l,d;return i(this,function(i){switch(i.label){case 0:n=o.children(),i.label=1;case 1:if(i.trys.push([1,4,,5]),!u[e])return t(!0,n,o),[2];if(r=u[e].split("."),!a.Behaviours.applicationsBehaviours[r[0]])throw"Behaviours from application "+r[0]+" missing";return a.Behaviours.applicationsBehaviours[r[0]].callbacks?[4,a.Behaviours.load(r[0])]:[3,3];case 2:i.sent(),i.label=3;case 3:return c=s.model.me&&s.model.me.workflow,(l=!(!c||!c[r[0]]),s.model.me.functions.SUPER_ADMIN)?(t(!0,n,o),[2]):c&&l?(r.forEach(function(e){c=c[e]}),t(c,n,o),[3,5]):(t(!1,n,o),[2]);case 4:throw d=i.sent(),t(!1,n,o),d;case 5:return[2]}})})})}}};t.workflow=o.ng.directive("workflow",["$compile",function(e){return{restrict:"A",link:u("workflow")(function(e,t,n){e?(n.show(),n.append(t)):(t.remove(),n.hide())})}}]),t.workflowNot=o.ng.directive("workflowNot",["$compile",function(e){return{restrict:"A",link:u("workflowNot")(function(e,t,n){e?(t.remove(),n.hide()):(n.show(),n.append(t))})}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1032);t.edumediaExplorerElement=r.edumediaExplorerElement,t.edumediaExplorer=r.edumediaExplorer,t.edumediaExplorerMedia=r.edumediaExplorerMedia,t.edumediaFullscreen=r.edumediaFullscreen;var i=n(1033);t.edumediaHeader=i.edumediaHeader},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(943),s=n(935);t.edumediaExplorerElement=o.ng.directive("edumediaExplorerElement",[function(){return{restrict:"E",scope:{selected:"=",item:"=",open:"&",select:"&"},template:'\n <div ng-click="select()" ng-dblClick="open()">\n <img ng-if="isImg()" ng-src="{{srcImg()}}" alt="{{title()}}" />\n <p>[[title()]]</p>\n </div>\n ',link:function(e,t,n){e.title=function(){return e.item.title},e.isImg=function(){return!!e.item.thumbnail},e.srcImg=function(){return e.item.thumbnail},e.toggleSelect=function(){e.item.selected=!e.item.selected}}}}]),t.edumediaExplorerMedia=o.ng.directive("edumediaExplorerMedia",[function(){return{restrict:"E",scope:{media:"=",notifyAdd:"&",notifyBack:"&"},template:'\n <div ng-if="media">\n <div class="edumedia-header-title">\n <h2 ng-click="back()"><span>&lsaquo;</span>[[title()]]</h2>\n <button type="button" class="right-magnet" ng-click="add()">\n <i18n>add</i18n>\n </button>\n </div>\n <div bind-html="iframe()"></div>\n </div>\n <div ng-if="!media">\n <i18n>edumedia.loading</i18n>\n </div>\n ',link:function(e,t,n){e.iframe=function(){return s.edumediaService.toHtml(e.media)},e.title=function(){return e.media.title},e.add=function(){e.notifyAdd()},e.back=function(){e.notifyBack()}}}}]),t.edumediaFullscreen=o.ng.directive("edumediaFullscreen",["$timeout",function(e){return{restrict:"A",scope:{edumediaFullscreen:"@"},link:function(e,t,n){t.on("click",function(){s.edumediaService.makeFullscreen(e.edumediaFullscreen)})}}}]);!function(){jQuery(document).on("click","*[edumedia-fullscreen-jquery]",function(e){var t=jQuery(e.target).attr("edumedia-fullscreen-jquery");s.edumediaService.makeFullscreen(t)}),jQuery(document).on("click","*[edumedia-delete-jquery]",function(e){var t=jQuery(e.target).attr("edumedia-delete-jquery");s.edumediaService.removeContent(t)})}(),t.edumediaExplorer=o.ng.directive("edumediaExplorer",["$timeout",function(e){return{restrict:"E",scope:{onSelectMedias:"&"},template:'\n <div class="edumedia-explorer-container">\n <edumedia-explorer-media ng-if="displayMedia()" media="currentMedia" notify-add="onAdd(currentMedia)" notify-back="onMediaBack()"></edumedia-explorer-media>\n <edumedia-header ng-if="displayExplorer()" can-add="canAdd()" notify-search="onSearch($text)" notify-add="onAdd()" notify-go-to="onGoTo($stack)" stack="stack" class="row"></edumedia-header>\n <div ng-if="displayExplorer()" class="edumedia-scrollable-area" ng-class="{\'edumedia-search\':isSearching()}">\n <edumedia-explorer-element ng-class="getCss(item)" ng-repeat="item in items" item="item" open="onOpen(item)" select="onSelect(item)" selected="isSelected(item)"></edumedia-explorer-element>\n </div>\n </div>\n ',link:function(t,n,o){return r(this,void 0,void 0,function(){var n,o,a,u,c,l,d,h,f,p,m,_,v=this;return i(this,function(y){switch(y.label){case 0:return n="explorer",[4,s.edumediaService.fetchSubjects()];case 1:return o=y.sent(),a=[],t.stack=[],u=null,c=!1,l="root",d=function(){e(function(){l="root",n="explorer",t.items=o.children})},d(),h=function(o){return r(v,void 0,void 0,function(){var r;return i(this,function(i){switch(i.label){case 0:return[4,s.edumediaService.fetchChildren(o)];case 1:return r=i.sent(),u=o,e(function(){l=r.children?"folder":"media",n="explorer",t.items=r.children||r.medias}),[2]}})})},f=function(){if(0==t.stack.length)d();else{var e=t.stack[t.stack.length-1];h({apiURL:e.link,title:e.title,href:null,id:e.id,leaf:e.leaf})}},t.getCss=function(e){return(e.media?"media":l)+" "+(t.isSelected(e)?"selected":"")},t.displayMedia=function(){return"media"==n},t.displayExplorer=function(){return"explorer"==n},t.canAdd=function(){return a.length>0&&!t.addProcessing},t.isSearching=function(){return c},t.onSearch=function(n){return r(this,void 0,void 0,function(){var r;return i(this,function(i){switch(i.label){case 0:return e(function(){a=[]}),n?(c=!0,[4,s.edumediaService.search(n,40,u?u.id:void 0)]):[3,2];case 1:return r=i.sent(),e(function(){t.items=r.medias}),[3,3];case 2:c&&e(function(){f(),c=!1}),i.label=3;case 3:return[2]}})})},t.onGoTo=function(e){t.stack=e,f()},t.onAdd=function(e){return r(this,void 0,void 0,function(){var n,r,o;return i(this,function(i){switch(i.label){case 0:return n=e?[e]:a.slice(),[4,Promise.all(n.map(function(e){return s.edumediaService.fetchMediaDetail(e)}))];case 1:if(r=i.sent(),!((o=t.onSelectMedias({$selection:r}))&&o instanceof Promise))return[3,5];i.label=2;case 2:return i.trys.push([2,,4,5]),t.addProcessing=!0,[4,o];case 3:return i.sent(),[3,5];case 4:return t.addProcessing=!1,[7];case 5:return[2]}})})},p=function(e){return!e.media},m=function(e){return function(t){return t===e}},_=function(e){return function(t){return t!==e}},t.isSelected=function(e){return!!a.find(m(e))},t.onSelect=function(n){p(n)?t.onOpen(n):e(function(){a.find(m(n))?a=a.filter(_(n)):a.push(n)})},t.onOpen=function(o){return r(this,void 0,void 0,function(){var r;return i(this,function(i){switch(i.label){case 0:return p(o)?(t.stack.push({title:o.title,link:o.apiURL,id:o.id,leaf:o.leaf}),h(o),[3,3]):[3,1];case 1:return n="media",[4,s.edumediaService.fetchMediaDetail(o)];case 2:r=i.sent(),e(function(){return t.currentMedia=r}),i.label=3;case 3:return[2]}})})},t.onMediaBack=function(){n="explorer",e(function(){return t.currentMedia=null})},[2]}})})}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(551),o=n(3);t.edumediaHeader=r.ng.directive("edumediaHeader",[function(){return{restrict:"E",scope:{stack:"=",canAdd:"=",notifySearch:"&",notifyAdd:"&",notifyGoTo:"&"},template:'\n <div class="edumedia-header-stack" ng-if="isNotEmptyStack() || canShowAdd()">\t\n <nav ng-style="{\'visibility\': isNotEmptyStack() ? \'visible\' : \'hidden\'}">\n <header><span ng-click="goTo(null)"><i18n>edumedia.theme</i18n></span></header>\n <header ng-repeat="item in stack"><span ng-click="goTo(item)">[[item.title]]</span></header>\n </nav>\n </div>\n <div class="edumedia-header-title">\n <h2>[[currentTitle()]]</h2>\n </div>\n <div class="edumedia-header-actions">\n <input type="search" ng-model="display.search" i18n-placeholder="search" ng-change="onSearchChange()">\n <button type="button" class="right-magnet" ng-disabled="!canAdd" ng-click="add()" ng-if="canShowAdd()">\n <i18n>add</i18n>\n </button>\n </div>\n ',link:function(e,t,n){e.display={search:""};var r=new i.Subject,s=r.debounceTime(300).distinctUntilChanged(),a=s.subscribe(function(){e.notifySearch({$text:e.display.search})});e.$on("destroy",function(){a.unsubscribe()}),e.isNotEmptyStack=function(){return e.stack&&e.stack.length>0},e.currentTitle=function(){return e.isNotEmptyStack()?e.stack[e.stack.length-1].title:o.idiom.translate("edumedia.choose")},e.canShowAdd=function(){return e.isNotEmptyStack()||e.canAdd},e.onSearchChange=function(){r.next(e.display.search)},e.add=function(){e.notifyAdd()},e.goTo=function(t){e.display.search="",e.onSearchChange();var n=e.stack.findIndex(function(e){return e===t});e.stack=-1==n?[]:e.stack.slice(0,n+1),setTimeout(function(){return e.notifyGoTo({$stack:e.stack})})}}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1035);t.libraryPublishDirective=r.libraryPublishDirective,t.libraryRootDirective=r.libraryRootDirective,t.libraryResourceDirective=r.libraryResourceDirective},function(e,t,n){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e};Object.defineProperty(t,"__esModule",{value:!0});var i=n(943),o=n(1036),s=n(1037),a=n(3),u=n(35),c=n(37);i.ng.providers.push(o.libraryServiceProvider),t.libraryResourceDirective=i.ng.directive("libraryResource",function(){return{restrict:"A",require:"^^libraryRoot",scope:{libraryResource:"="},link:function(e,t,n,r){t.on("click",function(){r.openPublishControllerWithResource(e.libraryResource)})}}});var l=function(){function e(e){this.libraryService=e,e.registerLibraryRootController(this)}return e.prototype.registerPublishController=function(e){this.publishController=e},e.prototype.openPublishControllerWithResource=function(e){var t=this.libraryService.getResourceInformationFromResource(e);return this.publishController.open(t.id,t.resourceInformation)},e.$inject=["libraryService"],e}();t.LibraryRootController=l,t.libraryRootDirective=i.ng.directive("libraryRoot",function(){return{restrict:"A",controller:l}});var d=function(){function e(e,t,n,r,i){var o=this;this.$scope=e,this.$q=t,this.$http=n,this.$location=r,this.libraryService=i,this.show=!1,this.allActivityTypes=s.allActivityTypes.map(function(e){return{label:a.idiom.translate(e),customSort:"bpr.other"==e?"~":a.idiom.translate(e).normalize("NFD"),type:e}}),this.allSubjectAreas=s.allSubjectAreas.map(function(e){return{label:a.idiom.translate(e),customSort:"bpr.other"==e?"~":a.idiom.translate(e).normalize("NFD"),type:e}}),this.allLanguages=s.allLangages,this.revocableUrl=null,this.loading=!1,this.licence="none",this.sliderOptions={connect:!0,range:{min:1,max:20},step:1,tooltips:[!0,!0],format:{to:function(e){return Math.floor(e).toString()},from:function(e){return parseInt(e)}}},this.userStructureNames=c.model.me.structureNames,this.multiStructureUser=c.model.me.structureNames&&c.model.me.structureNames.length>1,this.$http({url:"/directory/user/"+c.model.me.userId+"/attachment-school",responseType:"json",method:"GET"}).then(function(e){e.data&&(o.userAttachmentStructureName=e.data.name)}),e.$watch(function(){return o.publication?o.publication.cover:void 0},function(){o.revocableUrl&&(URL.revokeObjectURL(o.revocableUrl),o.revocableUrl=void 0),o.publication&&o.publication.cover&&(o.publication.cover.length&&(o.publication.cover=o.publication.cover[0]),o.revocableUrl=URL.createObjectURL(o.publication.cover))})}return e.prototype.open=function(e,t){var n=this,i=this.$q.defer(),o=window.location.protocol+"//"+window.location.host,s=""+o+t.pdfUri;return t.cover?this.$http({url:t.cover,responseType:"blob",method:"GET"}).then(function(e){i.resolve(e.data)},function(e){i.reject(e)}):i.resolve(null),i.promise.then(function(i){n.show=!0,n.id=e;var o={title:"",activityType:[],age:[3,16],cover:null,description:"",keyWords:"",language:"fr_FR",subjectArea:[],application:"",pdfUri:"",licence:"",teacherAvatar:null,resourceId:n.id,userStructureName:n.userAttachmentStructureName?n.userAttachmentStructureName:n.userStructureNames&&n.userStructureNames[0]};n.publication=Object.assign({},o,r({},t,{cover:i,pdfUri:s}))}).catch(function(e){u.notify.error("bpr.cover.notfound")})},e.prototype.closePublishLightbox=function(){this.show=!1,this.publication=void 0,this.id=void 0},e.prototype.closePublishLightboxAndApply=function(){this.closePublishLightbox(),this.$scope.$apply()},e.prototype.invalidFormFields=function(){return!(this.publication.title&&this.publication.cover&&this.publication.description&&0!=this.publication.activityType.length&&0!=this.publication.subjectArea.length&&this.publication.language)},e.prototype.publish=function(){var e=this;if(!this.loading)return this.loading=!0,this.publicationResponse={},this.libraryService.publish(this.id,this.publication).then(function(t){e.loading=!1,e.closePublishLightbox(),e.publicationResponse=t.data,e.responseBprFullURL=e.publicationResponse.details.front_url+"?platformURL="+encodeURIComponent(e.$location.host()),e.showLightboxResponse=!0,e.$scope.$apply()},function(t){e.loading=!1,e.closePublishLightbox(),e.publicationResponse.success=!1,e.publicationResponse.message=t.data.message,e.showLightboxResponse=!0,e.$scope.$apply()})},e.$inject=["$scope","$q","$http","$location","libraryService"],e}();t.LibraryPublishController=d,t.libraryPublishDirective=i.ng.directive("libraryPublish",function(){return{restrict:"E",scope:{},require:["^^libraryRoot","libraryPublish"],controller:d,controllerAs:"libraryPublishController",bindToController:!0,link:function(e,t,n,r){var i=r[0],o=r[1];i.registerPublishController(o),e.translate=a.idiom.translate,e.orderAllSubjectAreas="customSort",e.orderAllActivity="customSort",e.warning=n.warning},template:'\n <div ng-if="libraryPublishController.show">\n <lightbox class="bpr" show="libraryPublishController.show">\n <div class="flex-row align-center">\n <h2><i18n>bpr.form.header</i18n></h2>\n <span class="tipbox">\n <div class="tipbox-content bot">\n <span class="small-text">\n <i18n>bpr.form.tip</i18n>\n </span>\n </div>\n <div>\n <i class="help sticker square-medium"></i>\n </div>\n </span>\n </div>\n <div ng-if="warning">\n <p class="warning">[[warning]]</p>\n </div>\n <div class="row">\n <form ng-submit="libraryPublishController.publish()"\n name="libraryPublishController.publishForm"\n novalidate>\n <div class="row top-spacing-four">\n <label class="cell three bold" for="">\n <i18n>bpr.form.publication.title</i18n> * :\n </label>\n <input class="cell nine"\n type="text"\n name="title"\n ng-model="libraryPublishController.publication.title"\n placeholder="[[translate(\'bpr.form.publication.title.placeholder\')]]" />\n </div>\n <div class="row top-spacing-twice">\n <label class="cell three bold" for="">\n <i18n>bpr.form.publication.cover.upload</i18n> * :\n <small><i18n>bpr.form.publication.format</i18n> JPG, PNG</small>\n </label>\n <file-picker-list\n class="cell seven"\n files="libraryPublishController.publication.cover"\n multiple="false"\n hide-list="true">\n </file-picker-list>\n <img\n class="cell two file-picker_preview"\n ng-if="libraryPublishController.revocableUrl"\n ng-src="[[libraryPublishController.revocableUrl]]"\n alt="" />\n <i class="file-image cell two"\n ng-if="libraryPublishController.revocableUrl == null"></i>\n </div>\n <div class="row top-spacing-twice">\n <label class="cell three bold" for="">\n <i18n>bpr.form.publication.description</i18n> * :\n </label>\n <textarea class="cell nine description"\n ng-model="libraryPublishController.publication.description"\n name="description"\n rows="8"\n cols="80"\n placeholder="[[translate(\'bpr.form.publication.description.placeholder\')]]">\n </textarea>\n </div>\n <div class="row top-spacing-twice">\n <label class="cell three bold" for="">\n <i18n>bpr.form.publication.type</i18n> * :\n </label>\n <div class="cell nine">\n <multi-comboboxes\n ng-model="libraryPublishController.publication.activityType"\n name="activityType" order="orderAllActivity"\n options="libraryPublishController.allActivityTypes">\n </multi-comboboxes>\n </div>\n </div>\n <div class="row top-spacing-twice">\n <label class="cell three bold"for="">\n <i18n>bpr.form.publication.discipline</i18n> * :\n </label>\n <div class="cell nine">\n <multi-comboboxes\n ng-model="libraryPublishController.publication.subjectArea"\n name="subjectArea" order="orderAllSubjectAreas"\n options="libraryPublishController.allSubjectAreas">\n </multi-comboboxes>\n </div>\n </div>\n <div class="row top-spacing-twice">\n <label class="cell three bold" for="">\n <i18n>bpr.form.publication.language</i18n> * :\n </label>\n <select ng-model="libraryPublishController.publication.language"\n name="language"\n ng-options="translate(language) for language in libraryPublishController.allLanguages"\n class="cell nine language">\n </select>\n </div>\n <div class="row top-spacing-four">\n <label class="cell three bold" for="">\n <i18n>bpr.form.publication.age</i18n> * :\n </label>\n <div class="cell four top-spacing-twice">\n <div no-ui-slider\n slider-options="libraryPublishController.sliderOptions"\n ng-model="libraryPublishController.publication.age"\n name="age">\n </div>\n </div>\n </div>\n <div class="row top-spacing-twice">\n <label class="cell three bold" for="">\n <i18n>bpr.form.publication.keywords</i18n> :\n <br /><small><i18n>bpr.form.publication.keywords.separate</i18n></small>\n </label>\n <input class="cell nine"\n type="text"\n name="title"\n ng-model="libraryPublishController.publication.keyWords"\n placeholder="[[ translate(\'bpr.form.publication.keywords.placeholder\') ]]" />\n </div>\n <div ng-if="libraryPublishController.multiStructureUser && !libraryPublishController.userAttachmentStructureName" \n class="row top-spacing-twice">\n <label class="cell three bold" for="">\n <i18n>bpr.form.publication.structure</i18n> * :\n </label>\n <select ng-model="libraryPublishController.publication.userStructureName"\n class="cell nine language">\n <option ng-repeat="structureName in libraryPublishController.userStructureNames | orderBy:\'toString()\'">[[ structureName ]]</option>\n </select>\n </div>\n <div class="row top-spacing-twice">\n <div class="licence-condition">\n <h3 class="top-spacing-four">\n <i class="info-pic right-spacing bottom-spacing"></i>\n <i18n>bpr.form.publication.licence.text</i18n>\n </h3>\n <ul>\n <li class="small-text">\n <i18n>bpr.form.publication.licence.text.1</i18n>\n <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/"\n target="_blank"\n class="left-spacing top-spacing">\n <img class="licence_image"\n src="assets/themes/entcore-css-lib/images/cc-by-nc-sa.svg"\n alt="[[translate(\'bpr.form.publication.licence.image.alt\')]]" />\n </a>\n </li>\n <li class="small-text"><i18n>bpr.form.publication.licence.text.2</i18n></li>\n <li class="small-text"><i18n>bpr.form.publication.licence.text.3</i18n></li>\n </ul>\n </div>\n </div>\n <div class="row top-spacing-four">\n <div class="cell twelve">\n <button type="submit"\n class="right-magnet"\n ng-disabled="libraryPublishController.invalidFormFields()">\n <i18n ng-if="!libraryPublishController.loading">publish</i18n>\n <i ng-if="libraryPublishController.loading" class="loading" style="margin: 0"></i>\n </button>\n <button type="button" \n ng-click="libraryPublishController.closePublishLightboxAndApply()" \n ng-if="!libraryPublishController.loading" \n class="cancel right-magnet">\n <i18n>cancel</i18n>\n </button>\n </div>\n </div>\n </form>\n </div>\n </lightbox>\n </div>\n <div ng-if="libraryPublishController.showLightboxResponse">\n <lightbox class="bpr" show="libraryPublishController.showLightboxResponse" tiny="true">\n <div ng-if="libraryPublishController.publicationResponse.success">\n <h2><i18n>bpr.form.publication.response.success.title</i18n></h2>\n <i class="congrats"></i>\n <p>\n <i18n>bpr.form.publication.response.success.content.1</i18n>\n </p>\n <p>\n <i18n>bpr.form.publication.response.success.content.2</i18n>\n </p>\n <a ng-if="libraryPublishController.publicationResponse.details && libraryPublishController.publicationResponse.details.front_url" \n class="button right-magnet" \n ng-href="[[libraryPublishController.responseBprFullURL]]"\n target="_blank">\n <i18n>bpr.form.publication.response.success.button</i18n>\n </a>\n </div>\n\n <div ng-if="!libraryPublishController.publicationResponse.success">\n <h2><i18n>bpr.form.publication.response.error.title</i18n></h2>\n <p><strong><i18n>bpr.form.publication.response.error.content</i18n></strong></p>\n </div>\n </lightbox>\n </div>'}})},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(943),s=n(37),a=function(){function e(){var e=this;this.publishUrlGetterFromId=function(e){throw new Error("publishUrlGetterFromId not defined")},this.invokableResourceInformationGetterFromResource=function(){return function(e){throw new Error("invokableResourceInformationGetterFromResource not defined")}},this.$get=["$http","$injector",function(t,n){var o,a=function(n,o){return r(e,void 0,void 0,function(){var e,n,r,a;return i(this,function(i){switch(i.label){case 0:return[4,t.get("/userbook/avatar/"+s.model.me.userId+"?thumbnail=48x48",{responseType:"blob"})];case 1:return e=i.sent(),n=e.data,r=new FormData,r.append("title",o.title),r.append("cover",o.cover),r.append("coverName",o.cover.name),r.append("coverType",o.cover.type),r.append("teacherAvatar",n),r.append("teacherAvatarName",n.name||"teacherAvatar_"+s.model.me.userId),r.append("teacherAvatarType",n.type),r.append("language",o.language),o.activityType.forEach(function(e){r.append("activityType[]",e)}),o.subjectArea.forEach(function(e){r.append("subjectArea[]",e)}),o.age.forEach(function(e){r.append("age[]",e.toString())}),r.append("description",o.description),a=o.keyWords.split(","),a.forEach(function(e){r.append("keyWords[]",e.trim())}),r.append("licence","CC-BY"),r.append("pdfUri",o.pdfUri),r.append("application",o.application),r.append("resourceId",o.resourceId),r.append("teacherSchool",o.userStructureName),r.append("teacherCity","test"),[2,t.post("/appregistry/library/resource",r,{transformRequest:angular.identity,headers:{"Content-Type":void 0}})]}})})},u=function(t){return n.invoke(e.invokableResourceInformationGetterFromResource)(t)};return{publish:a,registerLibraryRootController:function(e){o=e},openPublishControllerWithResource:function(e){return o.openPublishControllerWithResource(e)},getResourceInformationFromResource:u}}]}return e.prototype.setInvokableResourceInformationGetterFromResource=function(e){this.invokableResourceInformationGetterFromResource=e},e}();t.LibraryServiceProvider=a,t.libraryServiceProvider=o.ng.provider("libraryService",a)},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.allSubjectAreas=["bpr.subjectArea.artActivity","bpr.subjectArea.readLearning","bpr.subjectArea.chemistry","bpr.subjectArea.law","bpr.subjectArea.worldDiscovery","bpr.subjectArea.economy","bpr.subjectArea.mediaEducation","bpr.subjectArea.musicEducation","bpr.subjectArea.sportEducation","bpr.subjectArea.citizenshipEducation","bpr.subjectArea.geography","bpr.subjectArea.history","bpr.subjectArea.artHistory","bpr.subjectArea.ComputerScience","bpr.subjectArea.languages","bpr.subjectArea.italian","bpr.subjectArea.spanish","bpr.subjectArea.french","bpr.subjectArea.german","bpr.subjectArea.english","bpr.subjectArea.ancientLanguages","bpr.subjectArea.literature","bpr.subjectArea.mathematics","bpr.subjectArea.vocationalGuidance","bpr.subjectArea.philosohppy","bpr.subjectArea.physics","bpr.subjectArea.politicalSscience","bpr.subjectArea.sociology","bpr.subjectArea.biology","bpr.subjectArea.geology","bpr.subjectArea.technology","bpr.other"],t.allActivityTypes=["bpr.other","bpr.activityType.classroomActivity","bpr.activityType.groupActivity","bpr.activityType.personalActivity","bpr.activityType.homework","bpr.activityType.exercize","bpr.activityType.learningPath","bpr.activityType.courseElement"],t.allLangages=["de_DE","en_EN","ar_DZ","es_ES","fr_FR","it_IT","ja_JP","zh_CN","pt_PT","ru_RU","bpr.other"]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(1039);t.noUiSliderDirective=r.ng.directive("noUiSlider",["$timeout","$q","$log",function(e,t,n){return{restrict:"AE",require:"?ngModel",scope:{created:"&?sliderCreated",options:"=?sliderOptions"},link:function(r,o,s,a){function u(t){return t.$on=function(n,r){var i=function(){e(function(){r(t.get())})};return t.on(n,i),function(){t.off(n,i)}},t}function c(e){r.$watch("created",function(t){angular.isFunction(t)&&t({api:e})})}function l(e){r.$watch("options",function(t,n){angular.equals(t,n)||(p=angular.copy(r.options),e.updateOptions(p))})}function d(e){a.$render=function(){e.set(a.$modelValue)},e.on("update",function(){var t=e.get();a.$setViewValue(t)})}function h(){var e=u(i.create(f,p));c(e),l(e),null!==a&&d(e)}var f=o[0],p=angular.copy(r.options);(function(){return null===a?t.resolve(null):t(function(t){e(function(){if(!angular.isArray(a.$modelValue)&&!angular.isNumber(a.$modelValue))throw new Error("Value provided in ngModel is not a valid noUislider start position. Expected a Number or an Array of Numbers, found: "+a.$modelValue);t(a.$modelValue)})})})().then(function(e){null!==e&&(p.start=e),h()}).catch(n.error)}}}])},function(e,t,n){var r,i,o;/*! nouislider - 14.6.3 - 11/19/2020 */
448
+ return e.defineLocale("ur",{months:xn,monthsShort:xn,weekdays:Yn,weekdaysShort:Yn,weekdaysMin:Yn,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd، D MMMM YYYY HH:mm"},meridiemParse:/صبح|شام/,isPM:function(e){return"شام"===e},meridiem:function(e,t,n){return e<12?"صبح":"شام"},calendar:{sameDay:"[آج بوقت] LT",nextDay:"[کل بوقت] LT",nextWeek:"dddd [بوقت] LT",lastDay:"[گذشتہ روز بوقت] LT",lastWeek:"[گذشتہ] dddd [بوقت] LT",sameElse:"L"},relativeTime:{future:"%s بعد",past:"%s قبل",s:"چند سیکنڈ",ss:"%d سیکنڈ",m:"ایک منٹ",mm:"%d منٹ",h:"ایک گھنٹہ",hh:"%d گھنٹے",d:"ایک دن",dd:"%d دن",M:"ایک ماہ",MM:"%d ماہ",y:"ایک سال",yy:"%d سال"},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:1,doy:4}}),e.defineLocale("uz-latn",{months:"Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr".split("_"),monthsShort:"Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek".split("_"),weekdays:"Yakshanba_Dushanba_Seshanba_Chorshanba_Payshanba_Juma_Shanba".split("_"),weekdaysShort:"Yak_Dush_Sesh_Chor_Pay_Jum_Shan".split("_"),weekdaysMin:"Ya_Du_Se_Cho_Pa_Ju_Sha".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"D MMMM YYYY, dddd HH:mm"},calendar:{sameDay:"[Bugun soat] LT [da]",nextDay:"[Ertaga] LT [da]",nextWeek:"dddd [kuni soat] LT [da]",lastDay:"[Kecha soat] LT [da]",lastWeek:"[O'tgan] dddd [kuni soat] LT [da]",sameElse:"L"},relativeTime:{future:"Yaqin %s ichida",past:"Bir necha %s oldin",s:"soniya",ss:"%d soniya",m:"bir daqiqa",mm:"%d daqiqa",h:"bir soat",hh:"%d soat",d:"bir kun",dd:"%d kun",M:"bir oy",MM:"%d oy",y:"bir yil",yy:"%d yil"},week:{dow:1,doy:7}}),e.defineLocale("uz",{months:"январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр".split("_"),monthsShort:"янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),weekdays:"Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба".split("_"),weekdaysShort:"Якш_Душ_Сеш_Чор_Пай_Жум_Шан".split("_"),weekdaysMin:"Як_Ду_Се_Чо_Па_Жу_Ша".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"D MMMM YYYY, dddd HH:mm"},calendar:{sameDay:"[Бугун соат] LT [да]",nextDay:"[Эртага] LT [да]",nextWeek:"dddd [куни соат] LT [да]",lastDay:"[Кеча соат] LT [да]",lastWeek:"[Утган] dddd [куни соат] LT [да]",sameElse:"L"},relativeTime:{future:"Якин %s ичида",past:"Бир неча %s олдин",s:"фурсат",ss:"%d фурсат",m:"бир дакика",mm:"%d дакика",h:"бир соат",hh:"%d соат",d:"бир кун",dd:"%d кун",M:"бир ой",MM:"%d ой",y:"бир йил",yy:"%d йил"},week:{dow:1,doy:7}}),e.defineLocale("vi",{months:"tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12".split("_"),monthsShort:"Thg 01_Thg 02_Thg 03_Thg 04_Thg 05_Thg 06_Thg 07_Thg 08_Thg 09_Thg 10_Thg 11_Thg 12".split("_"),monthsParseExact:!0,weekdays:"chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy".split("_"),weekdaysShort:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysMin:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysParseExact:!0,meridiemParse:/sa|ch/i,isPM:function(e){return/^ch$/i.test(e)},meridiem:function(e,t,n){return e<12?n?"sa":"SA":n?"ch":"CH"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [năm] YYYY",LLL:"D MMMM [năm] YYYY HH:mm",LLLL:"dddd, D MMMM [năm] YYYY HH:mm",l:"DD/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[Hôm nay lúc] LT",nextDay:"[Ngày mai lúc] LT",nextWeek:"dddd [tuần tới lúc] LT",lastDay:"[Hôm qua lúc] LT",lastWeek:"dddd [tuần trước lúc] LT",sameElse:"L"},relativeTime:{future:"%s tới",past:"%s trước",s:"vài giây",ss:"%d giây",m:"một phút",mm:"%d phút",h:"một giờ",hh:"%d giờ",d:"một ngày",dd:"%d ngày",w:"một tuần",ww:"%d tuần",M:"một tháng",MM:"%d tháng",y:"một năm",yy:"%d năm"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(e){return e},week:{dow:1,doy:4}}),e.defineLocale("x-pseudo",{months:"J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér".split("_"),monthsShort:"J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc".split("_"),monthsParseExact:!0,weekdays:"S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý".split("_"),weekdaysShort:"S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát".split("_"),weekdaysMin:"S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[T~ódá~ý át] LT",nextDay:"[T~ómó~rró~w át] LT",nextWeek:"dddd [át] LT",lastDay:"[Ý~ést~érdá~ý át] LT",lastWeek:"[L~ást] dddd [át] LT",sameElse:"L"},relativeTime:{future:"í~ñ %s",past:"%s á~gó",s:"á ~féw ~sécó~ñds",ss:"%d s~écóñ~ds",m:"á ~míñ~úté",mm:"%d m~íñú~tés",h:"á~ñ hó~úr",hh:"%d h~óúrs",d:"á ~dáý",dd:"%d d~áýs",M:"á ~móñ~th",MM:"%d m~óñt~hs",y:"á ~ýéár",yy:"%d ý~éárs"},dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}}),e.defineLocale("yo",{months:"Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀".split("_"),monthsShort:"Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀".split("_"),weekdays:"Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta".split("_"),weekdaysShort:"Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá".split("_"),weekdaysMin:"Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Ònì ni] LT",nextDay:"[Ọ̀la ni] LT",nextWeek:"dddd [Ọsẹ̀ tón'bọ] [ni] LT",lastDay:"[Àna ni] LT",lastWeek:"dddd [Ọsẹ̀ tólọ́] [ni] LT",sameElse:"L"},relativeTime:{future:"ní %s",past:"%s kọjá",s:"ìsẹjú aayá die",ss:"aayá %d",m:"ìsẹjú kan",mm:"ìsẹjú %d",h:"wákati kan",hh:"wákati %d",d:"ọjọ́ kan",dd:"ọjọ́ %d",M:"osù kan",MM:"osù %d",y:"ọdún kan",yy:"ọdún %d"},dayOfMonthOrdinalParse:/ọjọ́\s\d{1,2}/,ordinal:"ọjọ́ %d",week:{dow:1,doy:4}}),e.defineLocale("zh-cn",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"下午"===t||"晚上"===t?e+12:e>=11?e:e+12},meridiem:function(e,t,n){var r=100*e+t;return r<600?"凌晨":r<900?"早上":r<1130?"上午":r<1230?"中午":r<1800?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:function(e){return e.week()!==this.week()?"[下]dddLT":"[本]dddLT"},lastDay:"[昨天]LT",lastWeek:function(e){return this.week()!==e.week()?"[上]dddLT":"[本]dddLT"},sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|周)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"周";default:return e}},relativeTime:{future:"%s后",past:"%s前",s:"几秒",ss:"%d 秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",w:"1 周",ww:"%d 周",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},week:{dow:1,doy:4}}),e.defineLocale("zh-hk",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,n){var r=100*e+t;return r<600?"凌晨":r<900?"早上":r<1200?"上午":1200===r?"中午":r<1800?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:"[下]ddddLT",lastDay:"[昨天]LT",lastWeek:"[上]ddddLT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}}),e.defineLocale("zh-mo",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"D/M/YYYY",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,n){var r=100*e+t;return r<600?"凌晨":r<900?"早上":r<1130?"上午":r<1230?"中午":r<1800?"下午":"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}}),e.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,n){var r=100*e+t;return r<600?"凌晨":r<900?"早上":r<1130?"上午":r<1230?"中午":r<1800?"下午":"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}}),e.locale("en"),e})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ulist={name:"ulist",run:function(e){return{template:'<i tooltip="editor.option.ulist"></i>',link:function(t,n,r){n.on("mousedown",function(){e.editZone.is(":focus")||e.editZone.focus(),0===e.editZone.children("div").length&&(e.editZone.append("<div><br></div>"),e.editZone.focus()),e.execCommand("insertUnorderedList",!1,null),document.queryCommandState("insertUnorderedList")?n.addClass("toggled"):n.removeClass("toggled")}),e.on("selectionchange",function(e){document.queryCommandState("insertUnorderedList")?n.addClass("toggled"):n.removeClass("toggled")})}}}},t.olist={name:"olist",run:function(e){return{template:'<i tooltip="editor.option.olist"></i>',link:function(t,n,r){n.on("mousedown",function(){e.editZone.is(":focus")||e.editZone.focus(),0===e.editZone.children("div").length&&(e.editZone.append("<div><br></div>"),e.editZone.focus()),e.execCommand("insertOrderedList",!1,null),document.queryCommandState("insertOrderedList")?n.addClass("toggled"):n.removeClass("toggled")}),e.on("selectionchange",function(e){document.queryCommandState("insertOrderedList")?n.addClass("toggled"):n.removeClass("toggled")})}}}}},function(module,exports,__webpack_require__){"use strict";function rgb(e,t,n){return"#"+((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)}function setSpectrum(e){0!==jquery_1.$(".sp-replacer").length&&(e.children("i").css({"pointer-events":"none"}),jquery_1.$("input[type=color]").css({position:"absolute",opacity:0,"pointer-events":"none",height:"35px"}),jquery_1.$(".sp-replacer").on("mouseover",function(e){jquery_1.$(e.target).parent().find("input[type=color]").trigger("mouseover",[e])}),jquery_1.$(".sp-replacer").on("mouseout",function(e){jquery_1.$(e.target).parent().find("input[type=color]").trigger("mouseout",[e])}))}Object.defineProperty(exports,"__esModule",{value:!0});var jquery_1=__webpack_require__(1),http_1=__webpack_require__(34),rgba=rgb,transparent="rgba(255, 255, 255, 0)";exports.color={name:"color",run:function(instance){return{template:'<i tooltip="editor.option.color"></i><input tooltip="editor.option.color" type="color" tabindex="-1"/>',link:function(scope,element,attributes){function applyColor(){instance.selection.css({color:scope.foreColor})}if(element.on("click","i",function(){element.find("input").click()}),-1!==navigator.userAgent.indexOf("Edge")&&element.find("input").attr("type","text"),!jquery_1.$.spectrum){jquery_1.$.spectrum={},http_1.http().get("/infra/public/spectrum/spectrum.js").done(function(data){eval(data),setSpectrum(element),jquery_1.$.spectrum&&jquery_1.$.spectrum.palettes&&"text"===element.find("input")[0].type&&(jquery_1.$("body").find(".option.color input, .option.background-color input").spectrum({preferredFormat:"hex"}),setSpectrum(element))});var stylesheet=jquery_1.$('<link rel="stylesheet" type="text/css" href="/infra/public/spectrum/spectrum.css" />').attr("crossorigin","anonymous");jquery_1.$("head").prepend(stylesheet)}jquery_1.$.spectrum&&jquery_1.$.spectrum.palettes&&"text"===element.find("input")[0].type&&(element.find("input").spectrum({preferredFormat:"hex"}),setSpectrum(element)),scope.foreColor="#000000",element.children("input").on("input",function(){scope.foreColor=jquery_1.$(this).val(),scope.$apply("foreColor"),applyColor()}),element.get(0).addEventListener("click",function(){scope.foreColor=element.children("input").val(),scope.$apply("foreColor"),applyColor()},!0)}}}},exports.backgroundColor={name:"backgroundColor",run:function(instance){return{template:'<i></i><input tooltip="editor.option.backgroundcolor" type="color" tabindex="-1" />',link:function(scope,element,attributes){function applyBackgroundColor(){var e={};if("string"==typeof scope.backColor){if("#"===scope.backColor[0])e={r:parseInt(scope.backColor.substring(1,3),16),g:parseInt(scope.backColor.substring(3,5),16),b:parseInt(scope.backColor.substring(5,7),16)};else if(scope.backColor.startsWith("rgb")){var t=scope.backColor.split("(")[1].split(",");e={r:parseInt(t[0]),g:parseInt(t[1]),b:parseInt(t[2]),a:parseInt(t[3])}}e.r>130&&e.g>130&&e.b>130&&0!==e.a?element.find("i").css({color:"#000"}):element.find("i").css({color:"#fff"})}instance.selection.css({"background-color":scope.backColor})}if(element.on("click","i",function(){element.find("input").click()}),-1!==navigator.userAgent.indexOf("Edge")&&element.find("input").attr("type","text"),jquery_1.$.spectrum)jquery_1.$.spectrum&&jquery_1.$.spectrum.palettes&&"text"===element.find("input")[0].type&&(element.find("input[type=color]").spectrum({preferredFormat:"hex"}),setSpectrum(element));else{jquery_1.$.spectrum={},http_1.http().get("/infra/public/spectrum/spectrum.js").done(function(data){eval(data),jquery_1.$.spectrum&&jquery_1.$.spectrum.palettes&&"text"===element.find("input")[0].type&&(jquery_1.$("body").find(".option.color input, .option.background-color input").spectrum({preferredFormat:"hex"}),setSpectrum(element))});var stylesheet=jquery_1.$('<link rel="stylesheet" type="text/css" href="/infra/public/spectrum/spectrum.css" />').attr("crossorigin","anonymous");jquery_1.$("head").prepend(stylesheet)}element.children("input").on("input",function(){jquery_1.$(this).val()&&(scope.backColor=jquery_1.$(this).val(),scope.$apply("backColor"),applyBackgroundColor())}),element.get(0).addEventListener("click",function(){scope.backColor=element.children("input").val(),scope.$apply("backColor"),applyBackgroundColor()},!0)}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),i=n(4);t.font={name:"font",run:function(e){return{mobile:!1,template:'<select-list display="font" display-as="fontFamily" placeholder="editor.font.placeholder" tooltip="editor.option.font"><opt ng-repeat="font in fonts" ng-click="setFontFamily(font)" value="font" ng-style="{ \'font-family\': \'[[font.fontFamily]]\' }">[[font.fontFamily]]</opt></select-list>',link:function(t,n,o){function s(){return i._.map(i._.flatten(i._.map(document.styleSheets,function(e){return i._.filter(e.cssRules,function(e){return e instanceof CSSFontFaceRule&&-1===e.style.cssText.toLowerCase().indexOf("fontello")&&-1===e.style.cssText.toLowerCase().indexOf("glyphicon")&&-1===e.style.cssText.toLowerCase().indexOf("fontawesome")&&-1===e.style.cssText.toLowerCase().indexOf("mathjax")})})),function(e){var t=e.style.cssText.split("font-family:")[1].split(";")[0].trim();return t.startsWith('"')&&(t=t.substring(1)),t.endsWith('"')&&(t=t.substring(0,t.length-1)),{fontFamily:t}})}t.fonts=[],t.font="",setTimeout(function(){var e=s();e=i._.uniq(e,function(e,t,n){return e.fontFamily}),e=i._.reject(e,function(e){return"generic-icons"===e.fontFamily.trim()||"editor"===e.fontFamily.trim()}),t.fonts=t.fonts.concat(e),t.font=i._.find(t.fonts,function(e){return-1!==r.$("p").css("font-family").toLowerCase().indexOf(e.fontFamily.toLowerCase())})},1e3),t.setFontFamily=function(n){t.font=n,e.selection.css({"font-family":'"'+n.fontFamily+'"'})},e.on("selectionchange",function(n){t.font=i._.find(t.fonts,function(t){return t.fontFamily.trim()===e.selection.css("font-family")})})}}}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fontSize={name:"fontSize",run:function(e){return{template:'<select-list placeholder="size" display="font.fontSize.size" tooltip="editor.option.fontSize"><opt ng-repeat="fontSize in font.fontSizes" ng-click="setSize(fontSize)" '+"ng-style=\"{ 'font-size': fontSize.size + 'px', 'line-height': fontSize.size + 'px'}\">[[fontSize.size]]</opt></select-list>",link:function(t,n,r){t.font={fontSizes:[{size:8},{size:10},{size:12},{size:14},{size:16},{size:18},{size:20},{size:24},{size:28},{size:34},{size:42},{size:64},{size:72}],fontSize:{}},t.setSize=function(n){t.font.fontSize={size:n.size},e.selection.css({"font-size":n.size+"px","line-height":n.size+"px"})},e.on("selectionchange",function(n){e.selection.css("font-size")?t.font.fontSize={size:parseInt(e.selection.css("font-size"))}:t.font.fontSize={size:void 0}}),n.children(".options").on("click","opt",function(){n.children(".options").addClass("hidden")})}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);t.format={name:"format",run:function(e){return{template:'<select-list model="format" placeholder="editor.format.paragraph" display-as="label" display="format" tooltip="editor.option.format"><opt ng-repeat="format in formats" value="format" ng-click="wrap(format)"><div bind-html="format.option"></div></opt></select-list>',link:function(t,n,i){t.formats=[{apply:{tag:"p"},option:'<p translate content="[[format.label]]"></p>',label:"editor.format.paragraph"},{apply:{tag:"h1"},option:'<h1 translate content="[[format.label]]"></h1>',label:"editor.format.title1"},{apply:{tag:"h2"},option:'<h2 translate content="[[format.label]]"></h2>',label:"editor.format.title2"},{apply:{tag:"h3"},option:'<h3 translate content="[[format.label]]"></h3>',label:"editor.format.title3"},{apply:{tag:"p",classes:["info"]},option:'<p class="info" translate content="[[format.label]]"></p>',label:"editor.format.info"},{apply:{tag:"p",classes:["warning"]},option:'<p class="warning" translate content="[[format.label]]"></p>',label:"editor.format.warning"}],e.on("selectionchange",function(n){if(n){var r=n.selection.$();e.selection.isEmpty()&&(r=e.selection.elementAtCaret());var i=!1;t.formats.forEach(function(e){var n=!0;e.apply.classes&&e.apply.classes.forEach(function(e){n=n&&r.hasClass(e)}),r.is(e.apply.tag)&&n&&(t.format=e,i=!0)}),i||(t.format=t.formats[0])}}),t.wrap=function(n){t.format=n;var i=r.$("<"+t.format.apply.tag+"></"+t.format.apply.tag+">");t.format.apply.classes&&t.format.apply.classes.forEach(function(e){i.addClass(e)}),e.selection.wrap(i)}}}}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.subscript={name:"subscript",run:function(e){return{template:'<i tooltip="editor.option.subscript"></i>',link:function(t,n,r){n.on("click",function(){e.editZone.is(":focus")||e.focus(),"sub"!==e.selection.css("vertical-align")?(n.addClass("toggled"),e.selection.css({"vertical-align":"sub","font-size":"12px"})):(n.removeClass("toggled"),e.selection.css({"vertical-align":"","font-size":""}))}),e.on("selectionchange",function(t){"sub"===e.selection.css("vertical-align")?n.addClass("toggled"):n.removeClass("toggled")})}}}},t.superscript={name:"superscript",run:function(e){return{template:'<i tooltip="editor.option.superscript"></i>',link:function(t,n,r){n.on("click",function(){e.editZone.is(":focus")||e.focus(),"super"!==e.selection.css("vertical-align")?(n.addClass("toggled"),e.selection.css({"vertical-align":"super","font-size":"12px"})):(n.removeClass("toggled"),e.selection.css({"vertical-align":"","font-size":""}))}),e.on("selectionchange",function(t){"super"===e.selection.css("vertical-align")?n.addClass("toggled"):n.removeClass("toggled")})}}}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.removeFormat={name:"removeFormat",run:function(e){return{template:'<i tooltip="editor.option.removeformat"></i>',link:function(t,n,r){n.on("click",function(){e.editZone.is(":focus")||e.focus();var t={"font-style":"normal","background-color":"transparent","font-weight":"normal","text-decoration":"none",color:"inherit","font-size":"initial","line-height":"initial","font-family":"inherit"};e.selection.css(t),e.execCommand("removeFormat"),e.trigger("selectionchange",{selection:e.selection})}),e.on("selectionchange",function(e){document.queryCommandEnabled("removeFormat")?n.removeClass("disabled"):n.addClass("disabled")})}}}}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},o=this;Object.defineProperty(t,"__esModule",{value:!0});var s=n(6),a=n(1),u=n(3),c=n(550),l=function(e){s.ui.extendElement.resizable(e.editZone.find(".image-container").not(".image-template .image-container"),{moveWithResize:!1,preserveRatio:!0,mouseUp:function(){e.trigger("contentupdated"),e.addState(e.editZone.html())},extendParent:{bottom:!0}})},d=function(e,t){var n={top:e.offset().top+e.height()+20,left:e.offset().left+5};return n.left+t.width()>a.$(window).width()&&(n.left=a.$(window).width()-t.width()),n.top+t.height()>a.$(window).height()+window.scrollY&&(n.top=a.$(window).height()+window.scrollY-t.height()),n.top<e.offset().top&&(n.top=e.offset().top),n},h=function(e,t,n){var s,l=e.find("img");if(e.addClass("has-menu"),s=a.$('\n <div class="image-contextual-menu">\n <button class="edit-image">'+u.idiom.translate("edit.image")+'</button>\n\n <i class="resize-image small"></i>\n <i class="resize-image medium"></i>\n <i class="resize-image large selected"></i>\n </div>\n ').appendTo("body"),-1!==l.attr("src").indexOf("thumbnail")){var h=parseInt(l.attr("src").split("thumbnail=")[1].split("x")[0]);(l[0].naturalWidth<290||l[0].naturalHeight<290)&&h>290&&s.find(".resize-image.medium").remove(),((l[0].naturalWidth<120||l[0].naturalHeight<120)&&h>290||l.parents(".image-template").length>0)&&s.find(".resize-image").remove(),120===h&&(s.find(".selected").removeClass("selected"),s.find(".small").addClass("selected")),290===h&&(s.find(".selected").removeClass("selected"),s.find(".medium").addClass("selected"))}var f=function(t){s.find(".selected").removeClass("selected"),s.find("."+t).addClass("selected");var n={top:e.offset().top+e.height()+20,left:e.offset().left+5};n.left+s.width()>a.$(window).width()&&(n.left=a.$(window).width()-s.width()),l.on("load",function(){s.offset(n)})};a.$(window).on("scroll.imagemenu",function(){s.offset(d(e,s))}),e.on("resizing.imageMenu",function(t){s.offset(d(e,s))}),s.offset(d(e,s)).on("click",".edit-image",function(){return r(o,void 0,void 0,function(){var r,o,s;return i(this,function(i){switch(i.label){case 0:return r=l.attr("src").split("/"),"workspace"!==r[1]?(t.imageOption.display.pickFile=!0,t.$apply(),[2]):(o=r[r.length-1].split("?")[0],[4,c.workspaceService.fetchDocuments({filter:"all",id:o})]);case 1:return s=i.sent(),0==s.length&&console.warn("[imageEditor] could not found document for id: ",o),t.imageOption.display.file=s[0],[4,t.imageOption.display.file.loadProperties()];case 2:return i.sent(),"jpg"===t.imageOption.display.file.metadata.extension?t.imageOption.display.file.metadata["content-type"]="image/jpeg":t.imageOption.display.file.metadata["content-type"]="image/"+t.imageOption.display.file.metadata.extension,t.imageOption.display.editFile=!0,t.$apply(),t.updateImage=function(){var r=l.attr("src");t.imageOption.display.editFile=!1;var i=10*Math.random();-1!==r.indexOf("?")?-1!==r.indexOf("v=")?r=r.replace(/(v=).*?(&|$)/,"$1"+i+"$2"):r+="&v="+i:r+="?v="+i,l.on("load",function(){e.width(l.width()),e.height(l.height())}),l.attr("src",r),t.imageOption.display.file.alt?l.attr("alt",t.imageOption.display.file.alt):l.removeAttr("alt"),n.trigger("contentupdated"),t.$apply()},[2]}})})}).on("click","i.small",function(){l.parent(".image-container").css({width:"120px",height:"auto"}),f("small"),n.trigger("change")}).on("click","i.medium",function(){l.parent(".image-container").css({width:"290px",height:"auto"}),f("medium"),n.trigger("change")}).on("click","i.large",function(){l.parent(".image-container").css({width:"auto",height:"auto"}),f("large"),n.trigger("change")}).on("click",".open-media-library",function(){t.imageOption.display.pickFile=!0,t.$apply()}).on("click",".justify-left",function(){l.parent().css({float:"left"})}).on("click",".justify-center",function(){l.parent().css({float:"none",margin:"auto",display:"block"})}).on("click",".justify-right",function(){l.parent().css({float:"right",margin:"auto"})}),f();var p=function(){s.remove(),e.removeClass("has-menu"),e.off("resizing.imageMenu"),a.$(window).off("scroll.imagemenu")};setTimeout(function(){t.$on("$destroy",function(){p()}),a.$(document).one("selectionchange",function(e){setTimeout(function(){0===s.find(e.target).length&&p()},200)}),a.$(document).one("keyup",function(e){setTimeout(function(){a.$("body").find(l).length||p()},50)}),a.$(document).on("click",".close-focus",function(){p()})},0)};t.image={name:"image",run:function(e){return{template:'<i ng-click="imageOption.display.pickFile = true" tooltip="editor.option.image"></i><div ng-if="imageOption.display.editFile"><image-editor document="imageOption.display.file" on-save="updateImage()" show="imageOption.display.editFile"></image-editor></div><div ng-if="imageOption.display.pickFile"><lightbox show="imageOption.display.pickFile"><media-library ng-change="updateContent()" multiple="true" ng-model="imageOption.display.files" file-format="\'img\'" visibility="imageOption.visibility"></media-library></lightbox></div>',link:function(t,n,r){e.editZone.on("click touchstart","img:not(.smiley)",function(n){if(n.target){if(a.$(n.target).attr("src").startsWith("/assets")){t.imageOption.display.pickFile=!0;var r=window.getSelection();r.removeAllRanges();var i=document.createRange();i.selectNode(n.target),r.addRange(i),e.selection.range=i,t.$apply()}if(a.$(n.target).attr("src").startsWith("/workspace")){var o=a.$('<span contenteditable="false" class="image-container">&#8203;</span>');a.$(n.target).parent().hasClass("image-container")?o=a.$(n.target.parentNode):(n.target.parentNode.insertBefore(o[0],n.target),o.append(n.target));var s=window.getSelection();s.removeAllRanges();var u=document.createRange();u.selectNode(o[0]),s.addRange(u),e.selection.range=u,h(o,t,e)}}}),e.on("contentupdated",function(){s.ui.extendElement.resizable(e.editZone.find(".image-container").not(".image-template .image-container"),{moveWithResize:!1,preserveRatio:!0,mouseUp:function(){e.trigger("contentupdated"),e.addState(e.editZone.html())},extendParent:{bottom:!0}})}),t.imageOption={display:{pickFile:!1},visibility:"protected"},"public"===e.visibility&&(t.imageOption.visibility="public"),e.editZone.addClass("drawing-zone"),t.display={},t.updateContent=function(){var n="/workspace/document/";"public"===t.imageOption.visibility&&(n="/workspace/pub/document/");var r="";t.imageOption.display.files.forEach(function(e){r+='<span contenteditable="false" class="image-container">\n &#8203;<img src="'+n+e._id+'?thumbnail=2600x0"',e.alt&&(r+='alt="'+e.alt+'"'),r+=' class="latest-image" />\n </span>&nbsp;&nbsp;'}),e.selection.replaceHTMLInline(r);e.editZone.find(".latest-image").removeClass("latest-image");e.addState(e.editZone.html()),t.imageOption.display.pickFile=!1,t.imageOption.display.files=[],e.focus(),window.getSelection()&&window.getSelection().removeAllRanges()},e.on("model-updated",function(){return l(e)}),e.editZone.on("drop","img",function(e){return e.stopPropagation(),e.preventDefault(),!1});var i;e.editZone.on("dragover drop",function(e){if(i=void 0,document.caretPositionFromPoint){var t=document.caretPositionFromPoint(e.originalEvent.clientX,e.originalEvent.clientY).offsetNode;1===t.nodeType&&"SPAN"===t.tagName&&a.$(t).find("img").length&&(i=t.find("img")[0])}}),e.editZone.on("drop",function(t){console.log("drop image"),setTimeout(function(){e.editZone.find("img").each(function(e,t){if(a.$(t).attr("src").split(location.protocol+"//"+location.host).length>1){a.$(t).attr("src",a.$(t).attr("src").split(location.protocol+"//"+location.host)[1]);var n=a.$('<span contenteditable="false" class="image-container">&#8203;</span>'),r=t.parentNode;a.$(r).hasClass("image-container")&&(r=r.parentNode),r.insertBefore(n[0],t),n.append(t)}}),e.addState(e.editZone.html()),l(e)},100)}),e.editZone.on("dragstart","img",function(t){a.$("body").one("dragend.dragimage",function(){e.editZone.off("drop.dragimage")}),e.editZone.one("drop.dragimage",function(){setTimeout(function(){i&&0===a.$("body").find(i).length&&(console.log(i),console.log(a.$("body").find(i).length),t.target.parentNode.insertBefore(i,t.target))},250),setTimeout(function(){return a.$(t.target).parent("span").remove()},200)})})}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),i=n(391),o=n(3);t.attachment={name:"attachment",run:function(e){return{template:'<i ng-click="attachmentOption.display.pickFile = true" tooltip="editor.option.attachment"></i><div ng-if="attachmentOption.display.pickFile"><lightbox show="attachmentOption.display.pickFile" on-close="cancel()"><media-library ng-change="updateContent()" multiple="true" ng-model="attachmentOption.display.files" file-format="\'any\'" visibility="attachmentOption.visibility"></media-library></lightbox></div>',link:function(t,n,s){n.on("mousedown","a",function(e){e.stopPropagation(),r.$(e.target).parents(".download-attachments")[0].dispatchEvent(e)}),t.attachmentOption={display:{pickFile:!1},visibility:"protected"},"public"===e.visibility&&(t.attachmentOption.visibility="public"),t.cancel=function(){t.attachmentOption.display.pickFile=!1},e.bindContextualMenu(t,".download-attachments",[{label:"editor.edit.attachment",action:function(n){r.$(n.target).hasClass("download-attachments")||(n.target=r.$(n.target).parents(".download-attachments")[0]),e.selection.selectNode(n.target);var o=[];r.$(n.target).find("a").each(function(e,t){var n=r.$(t).attr("href").split("/");o.push(n[n.length-1])}),i.MediaLibrary.appDocuments.documents.deselectAll(),i.MediaLibrary.appDocuments.documents.all.map(function(e){return-1!==o.indexOf(e._id)&&(e.selected=!0),e}),t.attachmentOption.display.pickFile=!0}},{label:"editor.remove.attachment",action:function(t){r.$(t.target).hasClass("download-attachments")||(t.target=r.$(t.target).parents(".download-attachments")[0]),r.$(t.target).remove(),e.trigger("contentupdated")}}]),t.display={},t.updateContent=function(){var n="/workspace/document/";"public"===t.attachmentOption.visibility&&(n="/workspace/pub/document/");var r='<div class="download-attachments"><h2>'+o.idiom.translate("editor.attachment.title")+'</h2><div class="attachments">';t.attachmentOption.display.files.forEach(function(e){r+='<a href="'+n+e._id+'"><div class="download"></div>'+e.name+"</a>"}),r+="</div></div><div><br /><div><br /></div></div>",e.selection.replaceHTML(r),e.addState(e.editZone.html()),t.attachmentOption.display.pickFile=!1,t.attachmentOption.display.files=[],e.focus(),i.MediaLibrary.appDocuments.documents.deselectAll()}}}}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sound={name:"sound",run:function(e){return e.hiddenShareSoundCode?{template:"",link:function(e,t,n){}}:{template:'<i ng-click="soundOption.display.pickFile = true" tooltip="editor.option.sound"></i><div ng-if="soundOption.display.pickFile"><lightbox show="soundOption.display.pickFile" on-close="soundOption.display.pickFile = false;"><media-library ng-change="updateContent()" ng-model="soundOption.display.file" file-format="\'audio\'" visibility="soundOption.visibility"></media-library></lightbox></div>',link:function(t,n,r){e.editZone.addClass("drawing-zone"),t.soundOption={display:{pickFile:!1},visibility:"protected"},"public"===e.visibility&&(t.soundOption.visibility="public"),t.updateContent=function(){var n="/workspace/document/";"public"===t.soundOption.visibility&&(n="/workspace/pub/document/"),e.selection.replaceHTML('<div><br /></div><div class="audio-wrapper"><audio src="'+n+t.soundOption.display.file._id+'" controls preload="none"></audio></div><div><br /></div>'),t.soundOption.display.pickFile=!1,t.soundOption.display.file=void 0}}}}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.embed={name:"embed",run:function(e){return e.hiddenShareVideoCode?{template:"",link:function(e,t,n){}}:{template:'\n <i ng-click="display.copyEmbed = true" tooltip="editor.option.embed"></i>\n <toast-onboarding\n ng-if="display.toast"\n show="display.copyEmbed" \n confirm="handleOnboardingConfirm()"\n >\n </toast-onboarding>\n <embedder\n file-format="\'video\'" \n hidden-share-video-code=\''+e.hiddenShareVideoCode+'\' \n ng-model="display.htmlCode" \n ng-change="applyHtml()" \n ng-if="display.copyEmbed" \n show="display.copyEmbed"\n selected-header="display.selectedHeader"\n visibility="display.visibility"\n >\n </embedder>\n ',link:function(t,n,r){t.display={htmlCode:"",copyEmbed:!1,selectedHeader:"",toast:e.showOnboardingVideo,visibility:"protected"},"public"===e.visibility&&(t.display.visibility="public"),t.applyHtml=function(n){e.selection.replaceHTML(t.display.htmlCode),t.display.copyEmbed=!1},t.handleOnboardingConfirm=function(){t.display.selectedHeader="video.header.record"}}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);t.mathjax={name:"mathjax",run:function(e){return{template:'<i ng-click="display.fillFormula = true" tooltip="editor.option.mathjax"></i><lightbox show="display.fillFormula" on-close="display.fillFormula = false;"><textarea ng-model="display.formula"></textarea><mathjax formula="[[display.formula]]"></mathjax><div class="row"><button type="button" ng-click="updateContent()" class="right-magnet"><i18n>apply</i18n></button><button type="button" ng-click="cancel()" class="right-magnet cancel"><i18n>cancel</i18n></button></div></lightbox>',link:function(t,n,i){t.display={formula:"\\begin{equation}\n{-b \\pm \\sqrt{b^2-4ac} \\over 2a}\n\\end{equation}"};var o=void 0;t.updateContent=function(){o?(r.$(o).attr("formula",t.display.formula),angular.element(o.firstChild).scope().updateFormula(t.display.formula),e.trigger("change")):e.selection.replaceHTMLInline(e.compile('<span>&nbsp;<mathjax contenteditable="false" formula="'+t.display.formula+'"></mathjax>&nbsp;</span>')(t)),t.display.fillFormula=!1,o=void 0},t.cancel=function(){o=void 0,t.display.fillFormula=!1},e.bindContextualMenu(t,"mathjax",[{label:"editor.edit.mathjax",action:function(n){e.selection.selectNode(n.target),t.display.fillFormula=!0,t.display.formula=r.$(n.target).attr("formula"),o=n.target}},{label:"editor.remove.mathjax",action:function(e){r.$(e.target).remove()}}])}}}}},function(e,t,n){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e};Object.defineProperty(t,"__esModule",{value:!0});var i=n(386),o=n(3),s=n(1),a=n(6),u=n(34),c=n(4),l=n(37),d=n(38),h=n(898);t.linker={name:"linker",run:function(e){return{template:'<i ng-click="linker.openLinker()" tooltip="editor.option.link"></i><div ng-include="\'/infra/public/template/linker.html\'"></div>',link:function(t,n,f){a.ui.extendSelector.touchEvents("[contenteditable] a"),t.linker={display:{},apps:[],search:{application:{},text:""},params:{},resource:{}},e.bindContextualMenu(t,"a",[{label:"editor.edit.link",action:function(n){e.selection.selectNode(n.target),t.linker.display.chooseLink=!0,t.linker.openLinker(s.$(n.target).data("app-prefix"),s.$(n.target).attr("href"),n.target)}},{label:"editor.remove.link",action:function(e){var t=document.createTextNode(s.$(e.target).text());e.target.parentNode.insertBefore(t,e.target),s.$(e.target).remove()}}]),t.linker.openLinker=function(n,r,i){if(i||(e.selection.range=window.getSelection().getRangeAt(0)),this.rangeCount=1,t.linker.display.chooseLink=!0,n)t.linker.search.application.address="/"+n,t.linker.loadApplicationResources(function(){t.linker.searchApplication(function(){var e=c._.findWhere(t.linker.resources,{path:r});t.linker.applyResource(e),t.$apply()})});else if(i||1!==e.selection.selectedElements.length||(i=e.selection.selectedElements[0]),i&&(1!==i.nodeType&&(i=i.parentNode),"A"===i.nodeName)){var o=s.$(i).attr("href");t.linker.params.blank="_blank"===s.$(i).attr("target"),t.linker.params.title=s.$(i).attr("title")||"",""===o.split("http")[0]&&o.split("http").length>1?(t.linker.externalLink=!0,t.linker.params.link=o):(t.linker.externalLink=!1,t.linker.openLinker(o.split("/")[1].split("#")[0],o))}},t.linker.loadApplicationResources=function(e){var n=t.linker.search.application.address.split("/"),r=n[n.length-1];t.linker.params.appPrefix=r,e||(e=function(){t.linker.searchApplication(),t.$apply("linker")}),i.Behaviours.loadBehaviours(t.linker.params.appPrefix,function(n){var o=i.Behaviours.applicationsBehaviours[r];if(t.linker.addResource=o.create,o.loadResourcesWithFilter)e();else{var s=o.loadResources(function(){return e()});s&&s.then&&s.then(function(){e()})}})};var p=function(e,t){var n=null;return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=function(){return e.apply(void 0,r)};clearTimeout(n),n=setTimeout(o,t)}}(function(e,n){t.linker.display.searching=!0,t.$apply("linker"),e.loadResourcesWithFilter(t.linker.search.text,function(e){t.linker.resources=e,t.linker.display.searching=!1,t.$apply("linker"),n&&n()})},400);t.linker.searchApplication=function(e){var n=t.linker.search.application.address.split("/"),r=n[n.length-1];t.linker.params.appPrefix=r,i.Behaviours.loadBehaviours(t.linker.params.appPrefix,function(n){n.loadResourcesWithFilter?t.linker.search.text&&p(n,e):(t.linker.resources=c._.filter(n.resources,function(e){return""!==t.linker.search.text&&(-1!==o.idiom.removeAccents(e.title.toLowerCase()).indexOf(o.idiom.removeAccents(t.linker.search.text).toLowerCase())||e._id===t.linker.search.text)}),"function"==typeof e&&e())})},t.linker.createResource=function(){i.Behaviours.loadBehaviours(t.linker.params.appPrefix,function(e){e.create(t.linker.resource,function(){t.linker.search.text=t.linker.resource.title,t.linker.searchApplication(),t.$apply()})})},t.linker.applyLink=function(e){t.linker.params.link=e},t.linker.applyResource=function(e){t.linker.params.link=e.path,t.linker.params.id=e._id},t.linker.saveLink=function(){t.linker.params.blank&&(t.linker.params.target="_blank");var n,i=e.selection.range.startContainer;if(i&&1!==i.nodeType&&1===i.parentNode.childNodes.length&&0===e.selection.range.startOffset&&e.selection.range.endOffset===i.textContent.length&&(i=i.parentNode),n=i&&"A"===i.nodeName?s.$(i):s.$("<a></a>"),t.linker.params.link){var o=new RegExp("^www"),a=t.linker.params.link.match(o);if(null===a)n.attr("href",t.linker.params.link);else if("www"==a[0]){var u="https://".concat(t.linker.params.link.toString());n.attr("href",u)}if(t.linker.params.appPrefix&&!t.linker.externalLink&&(n.attr("data-app-prefix",t.linker.params.appPrefix),"workspace"===t.linker.params.appPrefix||t.linker.externalLink||n.data("reload",!0)),t.linker.params.id&&n.attr("data-id",t.linker.params.id),t.linker.params.blank&&(t.linker.params.target="_blank",n.attr("target",t.linker.params.target)),t.linker.params.title){var c=/[<]/gi;t.linker.params.title=t.linker.params.title.replace(c,"&lt;"),c=/[>]/gi,t.linker.params.title=t.linker.params.title.replace(c,"&gt;"),n.attr("title",t.linker.params.title)}else n.attr("title")&&(n.removeAttr("title"),n.off("mouseover"));h.editorEvents.onLinkerAdd.next(r({externalLink:t.linker.externalLink},t.linker.params))}if(i&&"A"===i.nodeName)return e.selection.moveCaret(n[0],n.text().length),e.trigger("change"),t.linker.display.chooseLink=!1,t.linker.params={},t.linker.display.search={application:{},text:""},void(t.linker.externalLink=!1);e.selection.isCursor()?(n.text(t.linker.params.link),e.selection.replaceHTMLInline(e.compile(n[0].outerHTML)(t))):e.selection.wrapText(n),e.focus(),t.linker.display.chooseLink=!1,t.linker.params={},t.linker.display.search={application:{},text:""},t.linker.externalLink=!1},t.linker.cancel=function(){t.linker.display.chooseLink=!1,t.linker.params={},t.linker.display.search={application:{},text:""},t.linker.externalLink=!1},u.http().get("/resources-applications").done(function(e){t.linker.apps=c._.filter(l.model.me.apps,function(t){return c._.find(e,function(e){return-1!==t.address.indexOf(e)&&t.icon&&-1===t.address.indexOf("#")})}),t.linker.apps=c._.map(t.linker.apps,function(e){return e.displayName=o.idiom.translate(e.displayName),e}),t.linker.search.application=c._.find(t.linker.apps,function(e){return-1!==e.address.indexOf(d.appPrefix)}),t.linker.search.application?t.linker.loadApplicationResources(function(){}):(t.linker.search.application=t.linker.apps[0],t.linker.searchApplication(function(){t.linker.loadApplicationResources(function(){})})),t.$apply("linker")})}}}},t.unlink={name:"unlink",run:function(e){return{template:'<i tooltip="editor.option.unlink"></i>',link:function(t,n,r){n.addClass("disabled"),n.on("click",function(){var t=e.selection.range.startContainer;if(1!==t.nodeType&&(t=t.parentNode),"A"===t.nodeName){var r=document.createTextNode(s.$(t).text());t.parentNode.insertBefore(r,t),s.$(t).remove(),n.addClass("disabled")}}),e.on("selectionchange",function(e){if(e.selection.range){var t=e.selection.range.startContainer;1!==t.nodeType&&(t=t.parentNode),"A"===t.nodeName?n.removeClass("disabled"):n.addClass("disabled")}})}}}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.smileys={name:"smileys",run:function(e){return{template:'<i tooltip="editor.option.smileys"></i><lightbox show="display.pickSmiley" on-close="display.pickSmiley = false;"><h2>Insérer un smiley</h2><div class="row smileys"><img ng-repeat="smiley in smileys" class="smiley" ng-click="addSmiley(smiley)" skin-src="/img/smileys/[[smiley]].png" /></div></lightbox>',link:function(t,n,r){t.display={},t.smileys=["happy","proud","dreamy","love","tired","angry","worried","sick","joker","sad"],t.addSmiley=function(n){var r=e.compile('<img skin-src="/img/smileys/'+n+'.png" class="smiley" />')(t.$parent);e.selection.replaceHTMLInline(r),window.getSelection().getRangeAt(0).collapse(!1),t.display.pickSmiley=!1,e.focus()},n.children("i").on("click",function(){t.display.pickSmiley=!0})}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),i=n(6);t.table={name:"table",run:function(e){return{template:'<popover mouse-event="click" on-close="resetScroll()"><i popover-opener opening-event="click" tooltip="editor.option.table"></i><popover-content><div class="draw-table"></div></popover-content></popover>',link:function(t,n,o){for(var s=n.find(".draw-table"),a=0;a<12;a++){var u=r.$('<div class="row"></div>');s.append(u);for(var c=0;c<12;c++)u.append('<div class="one cell"></div>')}t.resetScroll=function(){n.parents().css({overflow:""}),n.parents("editor-toolbar").each(function(e,t){r.$(t).css({"margin-top":"","min-height":"",height:""})})},i.ui.extendSelector.touchEvents("[contenteditable] td"),n.find("i").on("click",function(){n.find("popover-content").hasClass("hidden")?setTimeout(function(){n.parents("editor-toolbar").each(function(e,t){r.$(t).css({"margin-top":"-"+t.scrollTop+"px","min-height":"0",height:"auto"})}),n.parents().css({overflow:"visible"})},0):(n.parents().css({overflow:""}),n.parents("editor-toolbar").each(function(e,t){r.$(t).css({"margin-top":"","min-height":"",height:""})}))}),s.find(".cell").on("mouseover",function(){for(var e=r.$(this).parent(),t=0;t<=e.index();t++)for(var n=r.$(s.find(".row")[t]),i=0;i<=r.$(this).index();i++){var o=r.$(n.find(".cell")[i]);o.addClass("match")}}),s.find(".cell").on("mouseout",function(){s.find(".cell").removeClass("match")}),s.find(".cell").on("click",function(){for(var t=document.createElement("table"),n=r.$(this).parent(),i=0;i<=n.index();i++){var o=r.$("<tr></tr>");r.$(t).append(o);for(var s=0;s<=r.$(this).index();s++){var a=r.$("<td></td>");a.html("<br />"),o.append(a)}}e.selection.replaceHTML("<div>"+t.outerHTML+"</div>"),e.trigger("contentupdated")}),e.bindContextualMenu(t,"td",[{label:"editor.add.row",action:function(e){var t=r.$(r.$(e.target).parent()[0].outerHTML);t.find("td").html("<br />"),r.$(e.target).parent().after(t)}},{label:"editor.add.column",action:function(e){var t=r.$(e.target).index();r.$(e.target).parents("table").find("tr").each(function(e,n){r.$(n).children("td").eq(t).after("<td><br /></td>")})}},{label:"editor.remove.row",action:function(e){r.$(e.target).parent().remove()}},{label:"editor.remove.column",action:function(e){var t=r.$(e.target).index();r.$(e.target).parents("table").find("tr").each(function(e,n){r.$(n).children("td").eq(t).remove()})}}])}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=n(33),o=n(4);t.templates={name:"templates",run:function(e){return{template:'<i tooltip="editor.option.templates"></i><lightbox show="display.pickTemplate" on-close="display.pickTemplate = false;"><h2><i18n>editor.option.templates</i18n></h2><ul class="thought-out-actions"><li ng-repeat="template in templates" ng-click="applyTemplate(template)"><img ng-src="[[template.image]]" class="cell" /><div class="cell vertical-spacing horizontal-spacing" translate content="[[template.title]]"></div></li></ul></lightbox>',link:function(t,n,s){var a=i.skin.basePath+"../entcore-css-lib/editor-resources/img/";t.templates=[{title:"editor.templates.emptypage.title",image:a+"templates-preview-emptypage.svg",html:'<div class="twelve cell column"><article></article></div>'},{title:"editor.templates.twocols.title",image:a+"templates-preview-twocols.svg",html:'<div class="row"><div class="six cell column"><article><h2>'+r.idiom.translate("editor.templates.coltitle")+"</h2><p>"+r.idiom.translate("editor.templates.colfiller")+'</p></article></div><div class="six cell column"><article><h2>'+r.idiom.translate("editor.templates.coltitle")+"</h2><p>"+r.idiom.translate("editor.templates.colfiller")+"</p></article></div></div>"},{title:"editor.templates.threecols.title",image:a+"templates-preview-threecols.svg",html:'<div class="row"><div class="four cell column"><article><h2>'+r.idiom.translate("editor.templates.coltitle")+"</h2><p>"+r.idiom.translate("editor.templates.colfiller")+'</p></article></div><div class="four cell column"><article><h2>'+r.idiom.translate("editor.templates.coltitle")+"</h2><p>"+r.idiom.translate("editor.templates.colfiller")+'</p></article></div><div class="four cell column"><article><h2>'+r.idiom.translate("editor.templates.coltitle")+"</h2><p>"+r.idiom.translate("editor.templates.colfiller")+"</p></article></div></div>"},{title:"editor.templates.illustration.title",image:a+"templates-preview-illustration.svg",html:'<div class="row"><div class="three cell image-template column"><article><img src="'+a+'image-default.svg" style="cursor: pointer" /></article></div><div class="nine cell column"><article><h2>'+r.idiom.translate("editor.templates.illustration.titlefiller")+"</h2><p>"+r.idiom.translate("editor.templates.illustration.textfiller")+"</p></article></div></div>"},{title:"editor.templates.dominos.title",image:a+"templates-preview-dominos.svg",html:'<div class="dominos"><div class="item"><section class="domino pink"><div class="top image-template"><img src="'+a+'image-default.svg" style="cursor: pointer" class="fixed twelve cell" /></div><div class="bottom"><div class="content">'+r.idiom.translate("editor.templates.dominos.textfiller")+'</div></div></section></div><div class="item"><section class="domino blue"><div class="top image-template"><img src="'+a+'image-default.svg" style="cursor: pointer" class="fixed twelve cell" /></div><div class="bottom"><div class="content">'+r.idiom.translate("editor.templates.dominos.textfiller")+'</div></div></section></div><div class="item"><section class="domino orange"><div class="top image-template"><img src="'+a+'image-default.svg" style="cursor: pointer" class="fixed twelve cell" /></div><div class="bottom"><div class="content">'+r.idiom.translate("editor.templates.dominos.textfiller")+'</div></div></section></div><div class="item"><section class="domino purple"><div class="top image-template"><img src="'+a+'image-default.svg" style="cursor: pointer" class="fixed twelve cell" /></div><div class="bottom"><div class="content">'+r.idiom.translate("editor.templates.dominos.textfiller")+'</div></div></section></div><div class="item"><section class="domino green"><div class="top image-template"><img src="'+a+'image-default.svg" style="cursor: pointer" class="fixed twelve cell" /></div><div class="bottom"><div class="content">'+r.idiom.translate("editor.templates.dominos.textfiller")+'</div></div></section></div><div class="item"><section class="domino white"><div class="top image-template"><img src="'+a+'image-default.svg" style="cursor: pointer" class="fixed twelve cell" /></div><div class="bottom"><div class="content">'+r.idiom.translate("editor.templates.dominos.textfiller")+"</div></div></section></div></div>"}],t.display={},t.applyTemplate=function(n){t.display.pickTemplate=!1,e.selection.replaceHTML(o._.findWhere(t.templates,{title:n.title}).html)},n.children("i").on("click",function(){t.display.pickTemplate=!0,t.$apply("display")})}}}}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(935),s=n(3);t.edumedia={name:"edumedia",run:function(e){return{template:'\n <i class="ic-edumedia" ng-click="open()" ng-if="isVisible" tooltip="editor.option.edumedia"></i>\n <div ng-if="edumediaOptions.display.pickMedia">\n <lightbox show="edumediaOptions.display.pickMedia" on-close="cancel()">\n <script type="text/ng-template" id="edumedia_explorer">\n <edumedia-explorer on-select-medias="onSelectMedia($selection)"></edumedia-explorer>\n <\/script>\n <media-library delegate="delegate" ng-change="updateContent()" visibility="\'external\'" multiple="true" ng-model="edumediaOptions.display.files"></media-library>\n </lightbox>\n </div>\n ',link:function(t,n,a){var u=this;t.isVisible=!1;!function(){r(u,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return[4,o.edumediaService.isEdumediaEnabled()];case 1:return e=n.sent(),t.isVisible=e,t.$apply(),[2]}})})}();var c={i18Key:"library.header.edumedia",template:"local:edumedia_explorer",visible:function(){return!0},worflowKey:null},l={title:s.idiom.translate("library.title.edumedia"),visit:function(e){e.onSelectMedia=function(e){return t.onSelect(e)},setTimeout(function(){e.showHeader(c)})},augmentHeaders:function(e){var t=e.filter(function(e){return e.i18Key.indexOf("browse")>-1});return[c].concat(t)},filterDocumentRole:function(e){return o.edumediaService.hasEdumediaContentType(e)}};t.delegate=l,t.onSelect=function(n){try{var r="";n.forEach(function(e){r+='<br/><span contenteditable="false" class="edumedia-container">&#8203;'+o.edumediaService.toHtml(e)+"</span><br/>"}),e.selection.replaceHTMLInline(r),e.focus(),window.getSelection().removeAllRanges();var i=n.map(function(e){return o.edumediaService.saveIntoWorkspace(e)});return Promise.all(i)}finally{t.cancel()}},t.edumediaOptions={display:{pickMedia:!1,files:[]},visibility:"protected"},t.open=function(){t.edumediaOptions.display.pickMedia=!0},t.cancel=function(){t.edumediaOptions.display.pickMedia=!1},t.updateContent=function(){return r(this,void 0,void 0,function(){var n,s,a,u=this;return i(this,function(c){switch(c.label){case 0:return c.trys.push([0,,2,3]),n="",s=t.edumediaOptions.display.files,a=s.map(function(e){return r(u,void 0,void 0,function(){var t;return i(this,function(r){switch(r.label){case 0:return[4,o.edumediaService.fetchHtml(e)];case 1:return t=r.sent(),n+='<br/><span contenteditable="false" class="edumedia-container">&#8203;'+t+"</span><br/>",[2]}})})}),[4,Promise.all(a)];case 1:return c.sent(),e.selection.replaceHTMLInline(n),e.focus(),window.getSelection().removeAllRanges(),[3,3];case 2:return t.cancel(),[7];case 3:return[2]}})})}}}}}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),s=n(6),a=n(407),u=n(392),c=n(550),l=n(37),d=n(936),h=n(937),f=n(3),p=n(938),m="edumedia";t.EDU_MEDIA_CONTENT_TYPE="edumedia/html";var _,v;t.edumediaService={cacheBaseUrl:null,cacheConfig:null,isEdumediaEnabled:function(){return r(this,void 0,void 0,function(){var e,n;return i(this,function(r){switch(r.label){case 0:return[4,h.Me.onSessionReady()];case 1:return r.sent(),[4,t.edumediaService.getEdumediaConfig()];case 2:return e=r.sent(),n=l.model.me&&(l.model.me.optionEnabled||[]).indexOf("EDUMEDIA")>-1,[2,!!e&&n]}})})},getEdumediaConfig:function(){return r(this,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return null!=t.edumediaService.cacheConfig?[2,t.edumediaService.cacheConfig]:[4,s.ui.getCurrentThemeConf()];case 1:return(e=n.sent())&&e.edumedia?(t.edumediaService.cacheConfig=e.edumedia,[2,e.edumedia]):(console.warn("Edumedia not configured in theme-conf.js or in current theme",e),[2,null])}})})},fetchHtml:function(e){return r(this,void 0,void 0,function(){var t,n;return i(this,function(r){switch(r.label){case 0:return[4,c.workspaceService.getDocumentBlob(e._id)];case 1:return t=r.sent(),n=new FileReader,[2,new Promise(function(e,r){n.onload=function(){e(n.result)},n.readAsText(t)})]}})})},hasEdumediaContentType:function(e){return e.contentType&&e.contentType.indexOf(t.EDU_MEDIA_CONTENT_TYPE)>-1},getUrl:function(){var e=this;return function(){return r(e,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return t.edumediaService.cacheBaseUrl?[3,2]:[4,t.edumediaService.getEdumediaConfig()];case 1:e=n.sent(),t.edumediaService.cacheBaseUrl=e.uri,t.edumediaService.cacheBaseUrl||(t.edumediaService.cacheBaseUrl="https://www.edumedia-sciences.com"),n.label=2;case 2:return[2,t.edumediaService.cacheBaseUrl+"/"+window.entcore.currentLanguage+"/api/v1"]}})})}()},getToken:function(){var e=this;if(void 0!=v)return v;return v=function(){return r(e,void 0,void 0,function(){var e,n,s,a,u,c,h,f,p,m,v,y,g=this;return i(this,function(b){switch(b.label){case 0:return _=null,[4,t.edumediaService.getEdumediaConfig()];case 1:for(e=b.sent(),n=e.uri,s=e.pattern,a=function(e){return r(g,void 0,void 0,function(){var t,r,a;return i(this,function(i){switch(i.label){case 0:return t=d.MD5(s.replace("[[uai]]",e)),r=new URLSearchParams,r.append("uai",e),r.append("hash",t),[4,o.default.post(n+"/api/one/uai-token",r,{headers:{accept:"application/json","Content-Type":"application/x-www-form-urlencoded"}})];case 1:return a=i.sent(),200==a.status&&a.data.success?[2,a.data.token]:(console.warn("[Edumedia] fetch of token failed for uai failed: ",a.status,a.data,e),[2,null])}})})},u=[],c=0,h=l.model.me.uai;c<h.length;c++)f=h[c],u.push(a(f));return[4,Promise.all(u)];case 2:for(p=b.sent(),m=0,v=p;m<v.length;m++)null!=(y=v[m])&&(_=y);return[2,_]}})})}()},search:function(e,n,s){return void 0===n&&(n=40),r(this,void 0,void 0,function(){var r,a,u;return i(this,function(i){switch(i.label){case 0:return[4,t.edumediaService.getUrl()];case 1:return r=i.sent(),[4,o.default({url:r+"/search?q="+e+"&max="+n+"&"+(s?"tree-item-api-id="+s:""),method:"get"})];case 2:return a=i.sent(),u=a.data,u.medias.forEach(function(e){return e.media=!0}),[2,u]}})})},fetchSubjects:function(){return r(this,void 0,void 0,function(){var e,n,r,s;return i(this,function(i){switch(i.label){case 0:return[4,t.edumediaService.getUrl()];case 1:return e=i.sent(),[4,o.default({url:e+"/tree-item/n-root",method:"get"})];case 2:return n=i.sent(),[4,t.edumediaService.getEdumediaConfig()];case 3:return r=i.sent(),s=n.data,r.ignoreSubjects&&(s.children=s.children.filter(function(e){return-1==r.ignoreSubjects.indexOf(e.id)})),[2,s]}})})},fetchChildren:function(e){return r(this,void 0,void 0,function(){var t,n;return i(this,function(r){switch(r.label){case 0:return[4,o.default({url:e.apiURL,method:"get"})];case 1:return t=r.sent(),n=t.data,n.medias&&n.medias.forEach(function(e){return e.media=!0}),[2,n]}})})},fetchMediaDetail:function(e){return r(this,void 0,void 0,function(){var n,r;return i(this,function(i){switch(i.label){case 0:return[4,t.edumediaService.getToken()];case 1:return n=i.sent(),[4,o.default({url:e.apiURL+"?token="+n,method:"get"})];case 2:return r=i.sent(),[2,r.data]}})})},getContentTypeFor:function(e){return t.EDU_MEDIA_CONTENT_TYPE+"$id="+e.id},getIdFromContentType:function(e){var t=e.split("$").find(function(e){return e.startsWith("id=")});return t&&t.replace("id=","").replace("$","")},getThumbFromContentType:function(e){var n=t.edumediaService.getIdFromContentType(e);return n&&"https://www.edumedia-sciences.com/media/thumbnail/"+n},toHtml:function(e){return'\n <div style="position:relative" edumedia-content-jquery="edumedia_'+e.id+'">\n <div class="edumedia-content-header">\n <a edumedia-fullscreen-jquery="edumedia_'+e.id+'">'+f.idiom.translate("edumedia.fullscreen")+'&nbsp;&nbsp;<i class="fullscreen-on"></i></a>\n <i class="close-2x" edumedia-delete-jquery="edumedia_'+e.id+'"></i>\n </div>\n <iframe id="edumedia_'+e.id+'" title="'+e.title+'" width="'+e.width+'" height="'+e.height+'" src="'+e.frameURL+'">\n </iframe>\n </div>\n '},saveIntoWorkspace:function(e){return r(this,void 0,void 0,function(){var n,r,o,s;return i(this,function(i){return n=t.edumediaService.toHtml(e),r=t.edumediaService.getContentTypeFor(e),o=new File([n],""+e.title,{type:r}),s=new u.Document,[2,c.workspaceService.createExternalDocument(o,s,m,{visibility:"protected",application:m})]})})},removeContent:function(e){var t=jQuery('[edumedia-content-jquery="'+e+'"]');t.parent(".edumedia-container").remove(),t.remove()},closeFullScreen:function(){jQuery("#edumedia-fullscreen-lightbox").remove()},makeFullscreen:function(e){jQuery("#edumedia-fullscreen-lightbox").remove(),jQuery("body").append('\n <section class="lightbox" id="edumedia-fullscreen-lightbox">\n <div class="background"></div>\n <div class="edumedia-fullscreen-content"></div>\n <div class="close-lightbox" onclick="document.querySelectorAll(\'#edumedia-fullscreen-lightbox\').forEach(function(e){ e.remove(e)})">\n <i class="close-2x"></i>\n </div>\n </section>\n ');var t=jQuery("#"+e).clone();t.removeAttr("id");var n=$(window).width()-100,r=$(window).height()-100;t.attr("width",n),t.attr("height",r),jQuery(".edumedia-fullscreen-content").append(t)}},function(){var e=this;try{p.getEditorWhiteListAttributes().push("edumedia-content-jquery"),p.getEditorWhiteListAttributes().push("edumedia-fullscreen-jquery"),p.getEditorWhiteListAttributes().push("edumedia-delete-jquery")}catch(e){console.warn(e)}a.Element.registerContentTypeToRoleMapper(function(e,n){if(e&&e.indexOf(t.EDU_MEDIA_CONTENT_TYPE)>-1)return n?a.ROLES.HTML:a.ROLES.IMG}),a.Element.registerThumbUrlMapper(function(e){if(e.contentType&&e.contentType.indexOf(t.EDU_MEDIA_CONTENT_TYPE)>-1)return t.edumediaService.getThumbFromContentType(e.contentType)}),c.workspaceService.addExternalFolder(function(){return r(e,void 0,void 0,function(){var e,n;return i(this,function(r){switch(r.label){case 0:return[4,t.edumediaService.isEdumediaEnabled()];case 1:return e=r.sent(),e?[4,t.edumediaService.getEdumediaConfig()]:[3,3];case 2:return n=r.sent(),t.edumediaService.cacheBaseUrl=n.uri,[2,{externalId:m,name:"Edumedia"}];case 3:return[2,null]}})})}()),c.workspaceService.registerExternalFullScreenRenderer(function(e){if(e.contentType&&e.contentType.indexOf(t.EDU_MEDIA_CONTENT_TYPE)>-1){var n=t.edumediaService.getIdFromContentType(e.contentType);return t.edumediaService.makeFullscreen("edumedia_"+n),{close:function(){t.edumediaService.closeFullScreen()}}}return!1}),c.workspaceService.registerExternalActionFilter(function(e,n){if(e.contentType&&e.contentType.indexOf(t.EDU_MEDIA_CONTENT_TYPE)>-1)switch(n){case"comment":case"copy":case"download":case"history":case"move":case"share":return!1}return!0})}()},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MD5=function(e){function t(e,t){return e<<t|e>>>32-t}function n(e,t){var n,r,i,o,s;return i=2147483648&e,o=2147483648&t,n=1073741824&e,r=1073741824&t,s=(1073741823&e)+(1073741823&t),n&r?2147483648^s^i^o:n|r?1073741824&s?3221225472^s^i^o:1073741824^s^i^o:s^i^o}function r(e,t,n){return e&t|~e&n}function i(e,t,n){return e&n|t&~n}function o(e,t,n){return e^t^n}function s(e,t,n){return t^(e|~n)}function a(e,i,o,s,a,u,c){return e=n(e,n(n(r(i,o,s),a),c)),n(t(e,u),i)}function u(e,r,o,s,a,u,c){return e=n(e,n(n(i(r,o,s),a),c)),n(t(e,u),r)}function c(e,r,i,s,a,u,c){return e=n(e,n(n(o(r,i,s),a),c)),n(t(e,u),r)}function l(e,r,i,o,a,u,c){return e=n(e,n(n(s(r,i,o),a),c)),n(t(e,u),r)}function d(e){var t,n,r="",i="";for(n=0;n<=3;n++)t=e>>>8*n&255,i="0"+t.toString(16),r+=i.substr(i.length-2,2);return r}var h,f,p,m,_,v,y,g,b,w=Array();for(e=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t+=String.fromCharCode(r):r>127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t}(e),w=function(e){for(var t,n=e.length,r=n+8,i=(r-r%64)/64,o=16*(i+1),s=Array(o-1),a=0,u=0;u<n;)t=(u-u%4)/4,a=u%4*8,s[t]=s[t]|e.charCodeAt(u)<<a,u++;return t=(u-u%4)/4,a=u%4*8,s[t]=s[t]|128<<a,s[o-2]=n<<3,s[o-1]=n>>>29,s}(e),v=1732584193,y=4023233417,g=2562383102,b=271733878,h=0;h<w.length;h+=16)f=v,p=y,m=g,_=b,v=a(v,y,g,b,w[h+0],7,3614090360),b=a(b,v,y,g,w[h+1],12,3905402710),g=a(g,b,v,y,w[h+2],17,606105819),y=a(y,g,b,v,w[h+3],22,3250441966),v=a(v,y,g,b,w[h+4],7,4118548399),b=a(b,v,y,g,w[h+5],12,1200080426),g=a(g,b,v,y,w[h+6],17,2821735955),y=a(y,g,b,v,w[h+7],22,4249261313),v=a(v,y,g,b,w[h+8],7,1770035416),b=a(b,v,y,g,w[h+9],12,2336552879),g=a(g,b,v,y,w[h+10],17,4294925233),y=a(y,g,b,v,w[h+11],22,2304563134),v=a(v,y,g,b,w[h+12],7,1804603682),b=a(b,v,y,g,w[h+13],12,4254626195),g=a(g,b,v,y,w[h+14],17,2792965006),y=a(y,g,b,v,w[h+15],22,1236535329),v=u(v,y,g,b,w[h+1],5,4129170786),b=u(b,v,y,g,w[h+6],9,3225465664),g=u(g,b,v,y,w[h+11],14,643717713),y=u(y,g,b,v,w[h+0],20,3921069994),v=u(v,y,g,b,w[h+5],5,3593408605),b=u(b,v,y,g,w[h+10],9,38016083),g=u(g,b,v,y,w[h+15],14,3634488961),y=u(y,g,b,v,w[h+4],20,3889429448),v=u(v,y,g,b,w[h+9],5,568446438),b=u(b,v,y,g,w[h+14],9,3275163606),g=u(g,b,v,y,w[h+3],14,4107603335),y=u(y,g,b,v,w[h+8],20,1163531501),v=u(v,y,g,b,w[h+13],5,2850285829),b=u(b,v,y,g,w[h+2],9,4243563512),g=u(g,b,v,y,w[h+7],14,1735328473),y=u(y,g,b,v,w[h+12],20,2368359562),v=c(v,y,g,b,w[h+5],4,4294588738),b=c(b,v,y,g,w[h+8],11,2272392833),g=c(g,b,v,y,w[h+11],16,1839030562),y=c(y,g,b,v,w[h+14],23,4259657740),v=c(v,y,g,b,w[h+1],4,2763975236),b=c(b,v,y,g,w[h+4],11,1272893353),g=c(g,b,v,y,w[h+7],16,4139469664),y=c(y,g,b,v,w[h+10],23,3200236656),v=c(v,y,g,b,w[h+13],4,681279174),b=c(b,v,y,g,w[h+0],11,3936430074),g=c(g,b,v,y,w[h+3],16,3572445317),y=c(y,g,b,v,w[h+6],23,76029189),v=c(v,y,g,b,w[h+9],4,3654602809),b=c(b,v,y,g,w[h+12],11,3873151461),g=c(g,b,v,y,w[h+15],16,530742520),y=c(y,g,b,v,w[h+2],23,3299628645),v=l(v,y,g,b,w[h+0],6,4096336452),b=l(b,v,y,g,w[h+7],10,1126891415),g=l(g,b,v,y,w[h+14],15,2878612391),y=l(y,g,b,v,w[h+5],21,4237533241),v=l(v,y,g,b,w[h+12],6,1700485571),b=l(b,v,y,g,w[h+3],10,2399980690),g=l(g,b,v,y,w[h+10],15,4293915773),y=l(y,g,b,v,w[h+1],21,2240044497),v=l(v,y,g,b,w[h+8],6,1873313359),b=l(b,v,y,g,w[h+15],10,4264355552),g=l(g,b,v,y,w[h+6],15,2734768916),y=l(y,g,b,v,w[h+13],21,1309151649),v=l(v,y,g,b,w[h+4],6,4149444226),b=l(b,v,y,g,w[h+11],10,3174756917),g=l(g,b,v,y,w[h+2],15,718787259),y=l(y,g,b,v,w[h+9],21,3951481745),v=n(v,f),y=n(y,p),g=n(g,m),b=n(b,_);return(d(v)+d(y)+d(g)+d(b)).toLowerCase()}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(37),s=n(7),a=n(393),u=n(3),c=n(388),l=n(35),d=n(38),h=function(){function e(){}return e.hasWorkflowRight=function(e){return r(this,void 0,void 0,function(){var t,n,r,s,a;return i(this,function(i){switch(i.label){case 0:return t=e.split("."),o.model.me?[4,o.model.me.workflow.load([t[0]])]:[2,!1];case 1:if(i.sent(),!o.model.me.workflow)return[2,!1];for(n=o.model.me.workflow,r=0,s=t;r<s.length;r++)a=s[r],n=n[a];return[2,n]}})})},Object.defineProperty(e,"session",{get:function(){return o.model.me},enumerable:!0,configurable:!0}),e.savePreference=function(e){return r(this,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,s.default.put("/userbook/preference/"+e,this.preferences[e])];case 1:return t.sent(),[2]}})})},e.preference=function(e){return r(this,void 0,void 0,function(){var t=this;return i(this,function(n){return this.preferences||(this.preferences={}),[2,new Promise(function(n,r){t.preferences[e]||-1!==t.loading.indexOf(e)?t.preferences[e]?n(t.preferences[e]):t.eventer.once(e+"-loaded",function(){return n(t.preferences[e])}):(t.loading.push(e),t.eventer.once(e+"-loaded",function(){return n(t.preferences[e])}),s.default.get("/userbook/preference/"+e).then(function(n){var r={};if(n.data.preference)try{r=JSON.parse(n.data.preference)}catch(e){r={}}r||(r={}),t.preferences[e]=r,t.eventer.trigger(e+"-loaded",t.preferences[e])}))})]})})},e.revalidateTerms=function(){return r(this,void 0,void 0,function(){var t;return i(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,s.default.put("/auth/cgu/revalidate")];case 1:return n.sent(),e.session.needRevalidateTerms=!1,[3,3];case 2:return t=n.sent(),l.notify.error(u.idiom.translate("cgu.revalidate.failed")),[3,3];case 3:return[2]}})})},e.shouldRevalidate=function(){return new Promise(function(t,n){o.model.me&&o.model.me.userId?t(e.session.needRevalidateTerms):o.model.one("userinfo-loaded",function(n){t(e.session.needRevalidateTerms)})})},e.onSessionReady=function(){return new Promise(function(e,t){o.model.me&&o.model.me.userId?e(o.model.me):setTimeout(function(){o.model.one("userinfo-loaded",function(t){e(o.model.me)})})})},e.keepOpenOnLogout=!1,e.loading=[],e.eventer=new a.Eventer,e}();t.Me=h,window.entcore||(window.entcore={}),window.entcore.Me=h,window.newLogin=!1,window.addEventListener("storage",function(e){if("login-event"==e.key){if("RESET"==e.newValue)return;null!=e.newValue&&o.model.me.login!==e.newValue&&(window.newLogin=!0,console.log("login-event"));try{localStorage.setItem(e.key,"RESET")}catch(e){console.warn("[storage] could not remove login-event:",e)}}},!1),XMLHttpRequest.prototype.baseSend||window.pupetterMode||(XMLHttpRequest.prototype.baseSend=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.baseOpen=XMLHttpRequest.prototype.open,XMLHttpRequest.prototype.open=function(){if(window.CDN_DOMAIN){var e=arguments[1];d.appPrefix;e.startsWith("/infra/public")&&(arguments[1]=window.CDN_DOMAIN+e);/^\/([^\/]*)\/public/.test(e)&&(arguments[1]=window.CDN_DOMAIN+e),e.startsWith("/assets")&&(arguments[1]=window.CDN_DOMAIN+e),"/conf/public"==e&&(arguments[1]=e)}return this.baseOpen.apply(this,arguments)},XMLHttpRequest.prototype.send=function(e){if((-1===document.cookie.indexOf("authenticated=true")||!0===window.newLogin)&&-1===window.location.href.indexOf("/auth")&&!window.notLoggedIn){var t=u.idiom.translate("disconnected.redirect.url"),n="disconnected.redirect.url"!=t&&t&&t.length>0?t:"/auth/login",r=c.$('<lightbox class="lightbox-disconnected">\n <section class="lightbox">\n <div class="content">\n <h2>'+u.idiom.translate("disconnected.title")+'</h2>\n <div class="warning">'+u.idiom.translate("disconnected.warning")+'</div>\n <a class="button right-magnet" href="'+n+'" '+(h.keepOpenOnLogout?'target="_blank"':"")+">"+u.idiom.translate("disconnected.redirect")+'</a>\n </div>\n <div class="background"></div>\n </section>\n </lightbox>\n ');throw c.$("body").append(r).addClass("lightbox-opened"),r.find(".lightbox").fadeIn(),jQuery(".lightbox-disconnected a").on("click",function(){jQuery(".lightbox-disconnected").fadeOut(400,function(){jQuery(".lightbox-disconnected").remove()})}),"Disconnected !"}this.baseSend(e)})},function(e,t){"use strict";function n(){return i}function r(){return o}Object.defineProperty(t,"__esModule",{value:!0});var i=["zone-id","accept","accept-charset","accesskey","action","align","alt","async","autocomplete","autofocus","autoplay","bgcolor","border","charset","checked","cite","class","color","cols","colspan","content","contenteditable","controls","controlslist","coords","data","datetime","default","defer","dir","dirname","disabled","download","draggable","dropzone","enctype","for","form","formaction","headers","height","hidden","high","href","hreflang","http-equiv","id","ismap","kind","label","lang","list","loop","low","max","maxlength","media","method","min","multiple","muted","name","novalidate","open","optimum","pattern","placeholder","poster","preload","readonly","rel","required","reversed","rows","rowspan","sandbox","scope","selected","shape","size","sizes","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","tabindex","target","title","translate","type","usemap","value","width","wrap"],o=["aria-","data-"];t.getEditorWhiteListAttributes=n,t.getEditorWhiteListAttributesStartingBy=r},function(e,t,n){"use strict";function r(e){return e.nodeType===Node.ELEMENT_NODE}function i(e,t){return e&&r(e)&&e.nodeName===t}function o(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function s(e,t){var n=document.getSelection();n.removeAllRanges();var r=document.createRange();return r.setStart(e,t),n.addRange(r),r}function a(e){var t=e.nodeType===Node.TEXT_NODE?document.createTextNode(e.nodeValue):e.cloneNode(!1);return u(t,e),t}function u(e,t){for(var n=t.firstChild;n;)e.appendChild(a(n)),n=n.nextSibling}function c(e){for(var t=e.parentNode;t&&t.nodeType!==Node.ELEMENT_NODE;)t=t.parentNode;return t}function l(e,t,n,r,o){n.addState(r.html());var l=t.startContainer;if(l!==r.get(0)){if(i(l,"TD")||i(l.parentNode,"TD"))return;var m=r.get(0),_=void 0;if(i(l,"LI")?_=l:i(f.findClosestBlockElement(l,m),"LI")&&(_=f.findClosestBlockElement(l,m)),_){if(0===_.textContent.replace(/[\u200B-\u200D\uFEFF]/g,"").length&&l!==m){var v=l,y=void 0,g=void 0;do{if(i(v,"LI")&&!g&&(g=v),i(v,"UL")||i(v,"OL")){if(y)return;y=v}}while((v=v.parentNode)&&v!==m);if(!g.nextSibling){var b=document.createElement("div");return b.appendChild(document.createTextNode("​")),y.parentNode.insertBefore(b,y.nextSibling),y.removeChild(y.lastChild),s(b.firstChild,b.textContent.length),void e.preventDefault()}}if(i(l,"LI")||i(l.parentNode,"LI"))return}}else if(t.startContainer===t.endContainer)for(var m=r.get(0);m.firstChild;)m.removeChild(m.firstChild);for(var w=l;w.nodeType!==Node.ELEMENT_NODE||-1!==o.indexOf(w.nodeName);)w=w.parentNode;if(l===r[0]){var M=d.$("<div></div>");d.$(r[0]).append(M),M.html("&#8203;"),w=M[0],l=M[0],t=s(l,1)}if(w===r[0]){for(var k=t.startOffset,L=d.$("<div></div>");r[0].childNodes.length;)d.$(L).append(r[0].childNodes[0]);d.$(w).append(L),w=L[0],t=s(l,k)}e.preventDefault();var x;w.nodeType===Node.ELEMENT_NODE&&p.indexOf(w.tagName)>=0?x=a(w):(x=document.createElement("div"),u(x,w)),x.removeAttribute("class");var Y=t.endOffset;if(l.nodeType===Node.TEXT_NODE){if(l.textContent=l.textContent.substring(0,t.startOffset),0===l.textContent.length){var T=f.findClosestBlockElement(l,r.get(0));T&&0!==T.textContent.length||(l.textContent="​")}}else for(var S=l.childNodes.length-t.startOffset;S>0;S--)l.removeChild(l.lastChild);for(var D,$=l,E=[];$!==w;){for(D=$;D=$.nextSibling;)$.parentNode.removeChild(D);D=$;for(var O=0;D=D.previousSibling;)O++;E.push(O),$=$.parentNode}for(0===$.textContent.length&&($.textContent="​"),D=x;E.length;){for(var j=E.pop(),O=0;O<j;O++)D.removeChild(D.firstChild);D=D.firstChild}var C;if(D.nodeType===Node.TEXT_NODE)Y===D.textContent.length?(D.textContent="​",C=D.textContent.length):(D.textContent=D.textContent.substring(Y,D.textContent.length),C=0);else for(var O=0;O<Y;O++)D.removeChild(D.firstChild);for(var A=D;A=c(A);)if(i(A,"A")){for(var P=document.createElement("span"),H=0,F=A.childNodes;H<F.length;H++){var I=F[H];P.appendChild(I)}A.parentNode.insertBefore(P,A.nextSibling),A.parentNode.removeChild(A)}if(w.parentNode.insertBefore(x,w.nextSibling),D.nodeType!==Node.TEXT_NODE){var N=h.findFirstChildTextNode(D);N?C="​"===N.textContent.charAt(0)?1:0:(N=document.createTextNode("​"),D.insertBefore(N,D.firstChild),C=D.textContent.length),D=N}s(D,C)}Object.defineProperty(t,"__esModule",{value:!0});var d=n(1),h=n(899),f=n(907),p=["DIV","LI"];t.isElementNodeWithName=i,t.toKebabCase=o,t.onPressEnter=l},function(e,t,n){"use strict";function r(e,t,n){var r=this;if(e.originalEvent.dataTransfer){var c="protected";"public"===t.visibility&&(c="public"),n.removeClass("droptarget");var l={},d=e.originalEvent.dataTransfer.files;if(d.length){e.preventDefault();var h,f=window.getSelection();if(document.caretRangeFromPoint)h=document.caretRangeFromPoint(e.originalEvent.clientX,e.originalEvent.clientY);else if(document.caretPositionFromPoint){var p=document.caretPositionFromPoint(e.originalEvent.clientX,e.originalEvent.clientY);h=document.createRange(),h.setStart(p.offsetNode,p.offset)}h&&(f.removeAllRanges(),f.addRange(h),t.selection.range=h,t.selection.rangeCount=1);for(var m="",_=d.length,v=function(e){return i(r,void 0,void 0,function(){var e,n,r;return o(this,function(i){switch(i.label){case 0:return e=d[y].name,n=new s.Document,[4,n.upload(d[y],c)];case 1:return i.sent(),_--,r="/workspace/document/","public"===c&&(r="/workspace/pub/document/"),-1!==e.indexOf(".mp3")||-1!==e.indexOf(".wav")||-1!==e.indexOf(".ogg")?(l=u.$('<audio controls preload="none"></audio>'),l.attr("src",r+n._id)):-1!==e.toLowerCase().indexOf(".png")||-1!==e.toLowerCase().indexOf(".jpg")||-1!==e.toLowerCase().indexOf(".jpeg")||-1!==e.toLowerCase().indexOf(".svg")?(l=u.$('<span contenteditable="false" class="image-container"><img /></span>'),l.children("img").attr("src",r+n._id+"?thumbnail=150x150")):l=u.$('<div class="download-attachments"><h2>'+a.idiom.translate("editor.attachment.title")+'</h2><div class="attachments"><a href="'+r+n._id+'"><div class="download"></div>'+e+"</a></div></div><div><br /><div><br /></div></div>"),m+="<div>"+l[0].outerHTML+"<div><br></div><div><br></div></div>",0===_&&t.selection.replaceHTML(m),[2]}})})},y=0;y<d.length;y++)!function(){v(d[y])}()}}}var i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(391),a=n(3),u=n(1);t.onDropFromDesktop=r},function(e,t,n){"use strict";function r(e){var t=[];return e.forEach(function(e){return t.push(e)}),t}function i(e){var t=[];return e.forEach(function(e,n){return t.push(n)}),t}Object.defineProperty(t,"__esModule",{value:!0});var o=n(551),s=n(3),a=n(390);t.navigationGuardService={debounceMs:1e3,_lastTime:null,_lastResponse:null,_listeners:new Map,_guards:new Map,_id_counter:0,onUserConfirmNavigate:new Array,generateID:function(){return"__auto_guard_id_"+t.navigationGuardService._id_counter++},_getGuardsMapByID:function(e){var n=t.navigationGuardService._guards.get(e);return null!=n?n:new Set},registerGuard:function(e,n){var r=t.navigationGuardService._getGuardsMapByID(e);r.add(n),t.navigationGuardService._guards.set(e,r)},unregisterGuard:function(e,n){var r=t.navigationGuardService._getGuardsMapByID(e);r.delete(n),0==r.size&&t.navigationGuardService.unregisterRoot(e)},unregisterRoot:function(e){t.navigationGuardService._guards.delete(e)},registerIndependantGuard:function(e){var n=t.navigationGuardService.generateID();return t.navigationGuardService.registerGuard(n,e),n},unregisterIndependantGuard:function(e){t.navigationGuardService.unregisterRoot(e)},registerListener:function(e){if(!t.navigationGuardService._listeners.has(e)){e.start();var n=e.onChange.subscribe(function(e){t.navigationGuardService.tryNavigate(e)});t.navigationGuardService._listeners.set(e,n)}},unregisterListener:function(e){var n=t.navigationGuardService._listeners.get(e);n&&(n.unsubscribe(),e.stop(),t.navigationGuardService._listeners.delete(e))},tryNavigate:function(e){var n=t.navigationGuardService._lastTime||0,o=(new Date).getTime(),a=o-n,u=t.navigationGuardService._lastResponse;if(null!=u&&a<t.navigationGuardService.debounceMs)return void(u?e.accept():e.reject());for(var c=e.confirmMessageKey||"navigation.guard.text",l=0,d=i(t.navigationGuardService._guards);l<d.length;l++){var h=d[l],f=t.navigationGuardService._guards.get(h);if(!e.checkGuardId||"*"===e.checkGuardId||e.checkGuardId===h)for(var p=0,m=r(f);p<m.length;p++){var _=m[p];if(!_.canNavigate()){for(var v=confirm(s.idiom.translate(c)),y=0,g=t.navigationGuardService.onUserConfirmNavigate;y<g.length;y++){var b=g[y];b(v)}return _.onUserConfirmNavigate&&_.onUserConfirmNavigate(v),t.navigationGuardService._lastTime=(new Date).getTime(),t.navigationGuardService._lastResponse=v,void(v?(e.accept(),t.navigationGuardService.resetAll()):e.reject())}}}e.accept()},reset:function(e){for(var n=r(t.navigationGuardService._getGuardsMapByID(e)),i=0,o=n;i<o.length;i++){o[i].reset()}},resetAll:function(){for(var e=0,n=i(t.navigationGuardService._guards);e<n.length;e++){var r=n[e];t.navigationGuardService.reset(r)}}};var u=function(){function e(e,t,n){void 0===n&&(n=function(e,t){return e==t}),this.currentValue=e,this.resetter=t,this.comparator=n,this.reset()}return e.prototype.unNaN=function(e){return"number"==typeof e&&1==isNaN(e)?null:e},e.prototype.reset=function(){this.reference=this.resetter()},e.prototype.canNavigate=function(){return this.comparator(this.unNaN(this.reference),this.unNaN(this.currentValue()))},e}();t.InputGuard=u;var c=function(){function e(e){this.currentValue=e}return e.prototype.reset=function(){this.currentValue().guardObjectReset()},e.prototype.canNavigate=function(){return!this.currentValue().guardObjectIsDirty()},e.prototype.onUserConfirmNavigate=function(e){var t=this.currentValue();t.guardOnUserConfirmNavigate&&t.guardOnUserConfirmNavigate(e)},e}();t.ObjectGuard=c;var l=function(){function e(e){this.$rootScope=e,this.subscription=null,this.onChange=new o.Subject;var n=this;e.$on("$destroy",function(){t.navigationGuardService.unregisterListener(n)})}return e.prototype.start=function(){var e=this;this.subscription||(this.subscription=this.$rootScope.$on("$locationChangeStart",function(t,n,r){e.onChange.next({accept:function(){},reject:function(){t.preventDefault()}})}))},e.prototype.stop=function(){this.subscription&&this.subscription(),this.subscription=null},e.getInstance=function(t){return null==e._instance&&(e._instance=new e(t)),e._instance},e._instance=null,e}();t.AngularJSRouteChangeListener=l;var d=function(){function e(){this.onChange=new o.Subject,this.boundCallback=null}return e.prototype.callback=function(){var e=null;return this.onChange.next({accept:function(){e=!0},reject:function(){event.preventDefault(),event.returnValue=!1,e=!1}}),e},e.prototype.start=function(){this.boundCallback=this.callback.bind(this),window.addEventListener("beforeunload",this.boundCallback,!1)},e.prototype.stop=function(){window.removeEventListener("beforeunload",this.boundCallback)},e.getInstance=function(){return null==e._instance&&(e._instance=new e),e._instance},e._instance=null,e}();t.DOMRouteChangeListener=d;var h=function(){function e(){this.onChange=new o.Subject,this.defaultTrigger=!0,this.containerNotTriggering=[],this.containerTriggering=[]}return e.prototype.start=function(){var e=this;a.template.setDelegate({tryOpen:function(t){e.tryOpen(t.name,t.success,t.reject)}})},e.prototype.stop=function(){a.template.removeDelegate()},e.prototype.setTriggerByDefault=function(e){this.defaultTrigger=e},e.prototype.triggerNavigation=function(e){for(var t=this.containerTriggering.length;t-- >0;)if(this.containerTriggering[t]==e)return!0;for(var t=this.containerNotTriggering.length;t-- >0;)if(this.containerNotTriggering[t]==e)return!1;return this.defaultTrigger},e.prototype.tryOpen=function(e,t,n){this.triggerNavigation(e)?this.onChange.next({accept:t,reject:n}):t()},e.prototype.addIgnoreContainer=function(e){this.containerNotTriggering.push(e)},e.prototype.removeIgnoreContainer=function(e){this.containerNotTriggering=this.containerNotTriggering.filter(function(t){return t!=e})},e.prototype.addTriggerContainer=function(e){this.containerTriggering.push(e)},e.prototype.removeTriggerContainer=function(e){this.containerTriggering=this.containerTriggering.filter(function(t){return t!=e})},e.getInstance=function(){return null==e._instance&&(e._instance=new e),e._instance},e._instance=null,e}();t.TemplateRouteChangeListener=h;var f=function(){function e(){this.onChange=new o.Subject}return e.prototype.start=function(){},e.prototype.stop=function(){this.onChange.unsubscribe()},e}();t.ManualChangeListener=f;var p=function(){function e(){this.onChange=new o.Subject}return e.prototype.start=function(){},e.prototype.stop=function(){this.onChange.unsubscribe()},e.prototype.stayOpen=function(){var e=this;return new Promise(function(t,n){e.onChange.next({accept:function(){t(!1)},reject:function(){t(!0)}})})},e}();t.LightboxChangeListener=p,window.entcore||(window.entcore={}),window.entcore.navigationGuardService=t.navigationGuardService,window.entcore.ObjectGuard=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(386),i=n(37),o=n(38),s=n(34),a=n(3),u=n(4);t.sniplets={load:function(){var e=this;return new Promise(function(t,n){if(e.sniplets.length)return void t(e.sniplets);var c=e;s.http().get("/resources-applications").done(function(e){i.model.me?(e=i.model.me.apps.filter(function(t){return u._.find(e,function(e){return-1!==t.address.indexOf(e)&&-1===t.icon.indexOf("/")})}),e.push({displayName:"directory",address:"/directory"})):e=[o.appPrefix,"workspace"];var n=e.length;e.forEach(function(e){var i=setTimeout(function(){0===--n&&t()},1e3),o=e.address?e.address.split("/")[1]:e;r.Behaviours.loadBehaviours(o,function(e){e.sniplets&&(c.sniplets=c.sniplets.concat(u._.map(e.sniplets,function(e,t){return{application:o,template:t,sniplet:e}})),a.idiom.addBundle("/"+o+"/i18n")),n--,clearTimeout(i),0===n&&t()}).error(function(){n--,0===n&&t(),clearTimeout(i)})})})})},sniplets:[]},window.entcore||(window.entcore={}),window.entcore.sniplets=t.sniplets},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this.name=e,this.contents=t}return e}();t.Controller=n;var r=function(){function e(e,t){if(this.name=e,this.contents=t,this.contents.templateUrl){var n=document.getElementById("context").getAttribute("src").split("-"),r=n[n.length-1].split(".")[0];this.contents.templateUrl+="?hash="+r}}return e}();t.Directive=r;var i=function(){function e(e,t){this.name=e,this.contents=t}return e}();t.Filter=i;var o=function(){function e(e,t){this.name=e,this.contents=t}return e}();t.Service=o;var s=function(){function e(e,t){this.name=e,this.contents=t}return e}();t.Provider=s;var a=function(){function e(e){this.contents=e}return e}();t.Config=a;var u=function(){function e(){this.controllers=[],this.directives=[],this.filters=[],this.services=[],this.providers=[],this.configs=[],this.requiredModules=[],this.cb=[]}return e.prototype.init=function(e){this.directives.forEach(function(t){e.directive(t.name,t.contents)}),this.controllers.forEach(function(t){e.controller(t.name,t.contents)}),this.filters.forEach(function(t){e.filter(t.name,t.contents)}),this.services.forEach(function(t){e.service(t.name,t.contents)}),this.providers.forEach(function(t){e.provider(t.name,t.contents)}),this.configs.forEach(function(t){e.config(t.contents)}),this.requiredModules.forEach(function(t){e.requires.push(t)}),this.cb.forEach(function(t){return t(e)})},e.prototype.directive=function(e,t){return new r(e,t)},e.prototype.service=function(e,t){return new o(e,t)},e.prototype.provider=function(e,t){return new s(e,t)},e.prototype.controller=function(e,t){return new n(e,t)},e.prototype.filter=function(e,t){return new i(e,t)},e.prototype.config=function(e){return new a(e)},e.prototype.addRequiredModule=function(e){this.requiredModules.push(e)},e.prototype.onInit=function(e){this.cb.push(e)},e}();t.Ng=u,t.ng=new u,window.entcore||(window.entcore={}),window.entcore.ng=t.ng},function(e,t,n){"use strict";function r(){s.model.makeModels(t.widgets),s.model.collection(t.widgets.Widget,{preferences:{},savePreferences:function(){var e=this;this.forEach(function(t){e.preferences[t.name].hide=t.hide,e.preferences[t.name].index=t.index}),c.http().putJson("/userbook/preference/widgets",this.preferences)},sync:function(){var e=this,t=s.model.me.widgets;c.http().get("/userbook/preference/widgets").done(function(n){return i(this,void 0,void 0,function(){var r,i;return o(this,function(o){switch(o.label){case 0:return n.preference?this.preferences=JSON.parse(n.preference):this.preferences={},[4,a.skin.listSkins().then(function(){var n="panda"==a.skin.skins.find(function(e){return e.child==a.skin.skin}).parent?h:d;t=t.filter(function(e){return!n.find(function(t){return t==e.name})}),t=t.map(function(t,n){return e.preferences[t.name]||(e.preferences[t.name]={index:n,show:!0}),t.index=e.preferences[t.name].index,t.hide=!t.mandatory&&e.preferences[t.name].hide,t}),t=t.sort(function(e,t){var n=l.idiom.translate("timeline.settings."+e.name).toLowerCase(),r=l.idiom.translate("timeline.settings."+t.name).toLowerCase();return n<r?-1:n>r?1:0})})];case 1:for(o.sent(),r=0;r<t.length;r++)i=t[r],function(t){t.i18n?l.idiom.addTranslations(t.i18n,function(){e.push(t),c.http().loadScript(t.js,void 0,{disableNotifications:!0})}):(e.push(t),c.http().loadScript(t.js,void 0,{disableNotifications:!0}))}(i);return[2]}})})}.bind(this))},findWidget:function(e){return this.findWhere({name:e})},apply:function(){s.model.trigger("widgets.change")}})}var i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(37),a=n(388),u=n(943),c=n(34),l=n(3),d=["birthday","mood","calendar-widget","notes"],h=["carnet-de-bord","my-apps","rss-widget","bookmark-widget","cursus-widget","maxicours-widget","school-widget"];t.widgets={Widget:function(){}},t.widgets.Widget.prototype.switchHide=function(){this.mandatory||(this.hide||(this.hide=!1),this.hide=!this.hide,this.trigger("change"),s.model.widgets.trigger("change"),s.model.widgets.savePreferences())};var f=u.ng.controller("Widgets",["$scope","model",function(e,t){t.widgets||(r(),t.widgets.sync()),e.widgets=t.widgets,e.allowedWidget=function(t){return!(e.list&&-1===e.list.indexOf(t.name)||t.hide)},t.on("widgets.change",function(){e.$$phase||e.$apply("widgets")}),e.translate=l.idiom.translate,e.switchHide=function(e,t){e.switchHide(),t.stopPropagation()}}]);u.ng.controllers.push(f)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=n(388);t.toasts={message:function(e,t){i.$(".toasts")[0]||i.$("body").append('<div class="toasts"></div>'),t=r.idiom.translate(t);var n=i.$(".toasts")[0],o='\n <div class="show vertical-spacing horizontal-spacing '+e+' toast-content">\n <div class="content">\n '+t+'\n </div>\n <div class="timer animate"></div>\n </div>\n ',s=i.$(o),a=s.appendTo(n);setTimeout(function(){return i.$(s).find(".timer").addClass("animation")},100),setTimeout(function(){return a.remove()},3100)},warning:function(e){this.message("warning",e)},info:function(e){this.message("info",e)},confirm:function(e){this.message("confirm",e)}},window.entcore||(window.entcore={}),window.entcore.toasts=t.toasts,window.toasts=t.toasts},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(7);t.embedderService={_providers:null,getProviders:function(){return r(this,void 0,void 0,function(){var e,n,r,s,a;return i(this,function(i){switch(i.label){case 0:return null!=t.embedderService._providers?[2,t.embedderService._providers]:[4,o.default.get("/infra/embed/default")];case 1:return e=i.sent().data,[4,o.default.get("/infra/embed/custom")];case 2:for(n=i.sent().data,r=0,s=n;r<s.length;r++)a=s[r],a.name=(a.name||"").toLowerCase().replace(/\ |\:|\?|#|%|\$|£|\^|\*|€|°|\(|\)|\[|\]|§|'|"|&|ç|ù|`|=|\+|<|@/g,"");return t.embedderService._providers=e.concat(n),[2,t.embedderService._providers]}})})},getHtmlForVideoStream:function(e,t){var n=e.metadata,r=void 0!==n.captation?'data-document-is-captation="'+n.captation+'"':"",i="number"==typeof n.width&&"number"==typeof n.height?n.width+"x"+n.height:null,o=i?'data-video-resolution="'+i+'"':"";return'<span contenteditable="false" class="image-container">\n &#8203;<video playsinline="true" controls controlsList="nodownload" class="render" src="/workspace'+("public"==t?"/pub":"")+"/document/"+e._id+'" data-document-id="'+e._id+'" '+r+" "+o+"></video>\n </span>&nbsp;&nbsp;"},getHtmlForVideoStreams:function(e,n){return e.map(function(e){return t.embedderService.getHtmlForVideoStream(e,n)}).join(" ")},getHtmlForUrl:function(e,n){return void 0===n&&(n=!1),r(this,void 0,void 0,function(){var r,o,s,a,u;return i(this,function(i){switch(i.label){case 0:return e&&e.trim().startsWith("<iframe")?[2,e]:[4,t.embedderService.getProviders()];case 1:for(r=i.sent(),o=0,s=r;o<s.length;o++)if(a=s[o],(u=t.embedderService.getHtmlForProvider(a,e))&&u.length>0)return[2,u];return n?[2,'<iframe width="560" height="315" src="'+e+'" frameborder="0" allowfullscreen></iframe>']:[2,""]}})})},getHtmlForProvider:function(e,t){for(var n=0,r=e.url;n<r.length;n++){var i=r[n],o=new RegExp("{[a-zA-Z0-9_.]+}","g"),s=i.match(o)||[],a=e.embed;s.splice(1,s.length);for(var u=0,c=s;u<c.length;u++){var l=c[u],d=i.split(l)[0],h=d.split("}");h.length>1&&(d=h[h.length-1]);var f=t.split(d)[1];if(f){var p=i.split(l)[1].split("{")[0];p&&(f=f.split(p)[0]);var m=new RegExp("\\"+l.replace(/}/,"\\}"),"g");return a.replace(m,f)}}}return""}},window.entcore||(window.entcore={}),window.entcore.embedderService=t.embedderService},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(948),i=function(){function e(){}return e.removeDiacritics=r.removeDiacritics,e}();t.StrUtils=i,window.entcore||(window.entcore={}),window.entcore.StrUtils=i},function(e,t){"use strict";function n(e){return e.replace(/[^\u0000-\u007E]/g,function(e){return i[e]||e})}Object.defineProperty(t,"__esModule",{value:!0});for(var r=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹÐ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"OE",letters:"ŒŒ"},{base:"oe",letters:"œœ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],i={},o=0;o<r.length;o++)for(var s=r[o].letters,a=0;a<s.length;a++)i[s[a]]=r[o].base;t.removeDiacritics=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(950),i=n(951),o=n(952);!function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(950));var s=n(951);t.Tracking=s.Tracking;var a=n(952);t.EditTrackingEvent=a.EditTrackingEvent,window.entcore||(window.entcore={}),window.entcore.tracking=r,window.entcore.trackingService=r.trackingService,window.entcore.Tracking=i.Tracking,window.entcore.EditTrackingEvent=o.EditTrackingEvent},function(e,t,n){"use strict";var r=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(7),a=n(951),u=n(953),c=n(954),l=function(e){function t(){var t=e.call(this)||this;return t.trackings=[],t}return r(t,e),t.prototype.doInit=function(e){return i(this,void 0,void 0,function(){var e,t,n,r,i,a,l;return o(this,function(o){switch(o.label){case 0:return[4,s.default.get("/analyticsConf")];case 1:for(e=o.sent(),t=e.data,n=[],t&&(t.matomo&&n.push({params:t.matomo,tracker:new u.TrackingMatomo}),t.internal&&n.push({params:t.internal,tracker:new c.TrackingInternal})),r=[],i=0,a=n;i<a.length;i++)l=a[i],r.push(l.tracker.init(l.params)),this.trackings.push(l.tracker);return[4,Promise.all(r)];case 2:return o.sent(),[2]}})})},t.prototype.trackPage=function(e,t){var n=this;this.onReady&&this.onReady.then(function(){for(var r=0,i=n.trackings;r<i.length;r++){i[r].trackPage(e,t)}})},t.prototype.saveOptIn=function(){var e=this;this.onReady&&this.onReady.then(function(){for(var t=0,n=e.trackings;t<n.length;t++){n[t].saveOptIn()}})},t.prototype.trackEvent=function(e){var t=this;this.onReady&&this.onReady.then(function(){for(var n=0,r=t.trackings;n<r.length;n++){r[n].trackEvent(e)}})},t.prototype.doTrackEvent=function(e){},t}(a.Tracking);t.TrackingDefault=l,t.trackingService=new l,t.trackingService.init(null)},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(37),s=n(952),a=function(){function e(){this.initStatus="void",this.disabled=!1}return Object.defineProperty(e.prototype,"isReady",{get:function(){return"ready"==this.initStatus},enumerable:!0,configurable:!0}),e.prototype.init=function(e){return r(this,void 0,void 0,function(){var t;return i(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),this.params=e||{trackOnly:[],detailApps:!1,doNotTrack:[]},this.onReady=this.doInit(e),this.initStatus="pending",[4,this.onReady];case 1:return n.sent(),this.initStatus="ready",[3,3];case 2:return t=n.sent(),this.initStatus="failed",console.debug("["+this.constructor.name+"] could not init ",t),[3,3];case 3:return[2]}})})},e.prototype.shouldTrackCurrentApp=function(){var e=this.params;if(e.doNotTrack)for(var t=this.getCurrentMatchingApps(),n=0,r=t;n<r.length;n++){var i=r[n];if(-1!==e.doNotTrack.indexOf(i.name))return!1}return!0},e.prototype.shouldTrackEvent=function(e){if(this.disabled)return!1;var t=this.params,n=this.getCurrentMatchingApps();if(t.trackOnly&&t.trackOnly.length>0){for(var r=0,i=n;r<i.length;r++){var o=i[r];if(-1!==t.trackOnly.indexOf(o.name+"."+e)||-1!==t.trackOnly.indexOf("*."+e))return!0}return!1}if(t.doNotTrack instanceof Array&&t.doNotTrack.length>0)for(var s=0,a=n;s<a.length;s++){var o=a[s];if(-1!==t.doNotTrack.indexOf(o.name+"."+e)||-1!==t.doNotTrack.indexOf("*."+e))return!1}return!0},e.prototype.trackEvent=function(e){var t=this;e.disabled||this.onReady&&this.onReady.then(function(){t.shouldTrackEvent(e.type)&&t.doTrackEvent(e)})},e.prototype.trackEdition=function(e){var t=this;return new s.EditTrackingEvent(e,function(e){t.trackEvent(e)})},e.prototype.getCurrentMatchingApps=function(){var e=[];if(o.model&&o.model.me&&o.model.me.apps instanceof Array)for(var t=0;t<o.model.me.apps.length;t++){var n=o.model.me.apps[t];n&&n.address&&n.name&&-1!==location.href.indexOf(n.address)&&e.push(n)}return e},e}();t.Tracking=a},function(e,t,n){"use strict";function r(){return"__new__"+o++}Object.defineProperty(t,"__esModule",{value:!0});var i=n(941),o=0,s=function(){function e(e,t){var n=this;this.pushEvent=t,this.status="void",this.disabled=!1;var o=window.location.pathname+window.location.hash;this.id=e.resourceId||r(),this.resourceUri=e.resourceUri||o,this.matomoResourceUri=window.location.pathname+"/"+this.id,i.navigationGuardService.onUserConfirmNavigate.push(function(e){e||n.onCancel()})}return e.prototype.onStart=function(e){if(e){if(["editing"].includes(this.status))return}this.startedAt=new Date,this.stoppedAt=null,this.pushEvent({type:"edit",matomo:{action:"start",resourceUri:this.matomoResourceUri},internal:{"event-type":"EDIT_START",resource_uri:this.resourceUri,resource_id:this.id}}),this.status="editing"},e.prototype.onStop=function(){if(!["saving"].includes(this.status)){this.stoppedAt=new Date,this.finishedAt=null;var e=this.startedAt?this.stoppedAt.getTime()-this.startedAt.getTime():null;this.pushEvent({type:"edit",matomo:{action:"stop",resourceUri:this.matomoResourceUri},internal:{"event-type":"EDIT_STOP",resource_uri:this.resourceUri,resource_id:this.id,duration:e}}),this.status="saving"}},e.prototype.onFinish=function(e,t){if(!["success","fail"].includes(this.status)){this.finishedAt=new Date,this.status=e?"success":"fail";var n=this.stoppedAt?this.finishedAt.getTime()-this.stoppedAt.getTime():null;this.pushEvent({type:"edit",matomo:{action:e?"success":"fail",resourceUri:this.matomoResourceUri},internal:{"event-type":"EDIT_FINISH",resource_uri:this.resourceUri,resource_id:this.id,duration:n,status:e?"success":"fail",status_code:t?t.code:null}})}},e.prototype.onCancel=function(){if(!["void","success","fail","cancel"].includes(this.status)){this.finishedAt=new Date,this.status="cancel";var e=this.stoppedAt?this.finishedAt.getTime()-this.stoppedAt.getTime():null;this.pushEvent({type:"edit",matomo:{action:"cancel",resourceUri:this.matomoResourceUri},internal:{"event-type":"EDIT_FINISH",resource_uri:this.resourceUri,resource_id:this.id,duration:e,status:"cancel",status_code:null}})}},e}();t.EditTrackingEvent=s},function(e,t,n){"use strict";var r=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(951),a=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.hasOptedIn=!1,t}return r(t,e),t.prototype.doInit=function(e){return i(this,void 0,void 0,function(){return o(this,function(e){try{return[2]}catch(e){throw console.error('[TrackingMatomo] Invalid tracker object. Should look like {"siteId": 99999, "url":"http://your.matomo.server.com/"}"',e),e}return[2]})})},t.prototype.trackPage=function(e,t){this.onReady&&this.onReady.then(function(){var n=window._paq||[];n.push(["setDocumentTitle",e]),n.push(["setCustomUrl",t]),n.push(["trackPageView"])})},t.prototype.saveOptIn=function(){var e=this;this.onReady&&this.onReady.then(function(){try{(window._paq||[]).push(e.hasOptedIn?["forgetUserOptOut"]:["optUserOut"])}catch(e){console.debug("[TrackingMatomo] could not saveOptIn: ",e)}})},t.prototype.doTrackEvent=function(e){try{var t=["trackEvent",e.type];if(e.matomo){var n=e.matomo;n.action&&t.push(n.action),n.resourceUri&&t.push(n.resourceUri),n.value&&t.push(n.value)}(window._paq||[]).push(t)}catch(e){console.debug("[TrackingMatomo] could not trackEvent: ",e)}},t}(s.Tracking);t.TrackingMatomo=a},function(e,t,n){"use strict";var r=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(7),a=n(37),u=n(951),c={ENSEIGNANT:"Teacher",ELEVE:"Student",PERSRELELEVE:"Relative",SUPERADMIN:"SuperAdmin",PERSEDUCNAT:"Personnel"},l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.doInit=function(){return i(this,void 0,void 0,function(){return o(this,function(e){return[2]})})},t.prototype.trackPage=function(e,t){},t.prototype.saveOptIn=function(){},t.prototype.doTrackEvent=function(e){try{var t=this.getCurrentMatchingApps(),n=c[a.model.me.type]||a.model.me.type,r={"event-type":e.type,userId:a.model.me.userId,profil:n,"resource-type":e.resourceType,date:(e.date||new Date).getTime(),ua:navigator.userAgent};if(t.length&&(r.module=t[0].name),e.internal)for(var i in e.internal)r[i]=e.internal[i];s.default.post("/infra/event/web/store",r).catch(function(e){console.debug("[TrackingInternal] failed to trackEvent: ",e)})}catch(e){console.debug("[TrackingInternal] failed to trackEvent: ",e)}},t}(u.Tracking);t.TrackingInternal=l},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(956)),r(n(958)),r(n(957)),r(n(959))},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},o=this;Object.defineProperty(t,"__esModule",{value:!0});var s=n(390),a=n(35),u=n(943),c=n(957),l=n(38),d=n(937),h=n(34),f=n(3),p=function(){function e(){this.hasRecorded=!1}return e.prototype.guardObjectIsDirty=function(){return this.hasRecorded},e.prototype.guardObjectReset=function(){this.hasRecorded=!1},e}();t.VideoRecordGuardModel=p,u.ng.controllers.push(u.ng.controller("VideoController",["$scope","model","route","$element","VideoUploadService",function(e,t,n,u,m){e.hasRight=!0,e.recordGuard=new p,e.recordMaxTime=3,m.initialize().then(function(){e.recordMaxTime=m.maxDuration}),e.template=s.template,e.me=t.me,e.recorder=new c.VideoRecorder(function(){return jQuery(u).find("video")[0]},function(e){k(e)});var _=!1,v=e.recorder.onPlayChanged.subscribe(function(e){_="play"==e.type,b()});e.display={},e.authorized=!1,e.videoState="idle",e.videofile={},e.action="videorecorder",e.notFound=!1,e.currentDuration=0,e.recordStartTime=0,e.recordTime="00:00",e.recordTimeInMs=0;var y={deviceId:"environment",label:f.idiom.translate("video.back.camera"),groupId:"",kind:"videoinput"},g={deviceId:"user",label:f.idiom.translate("video.front.camera"),groupId:"",kind:"videoinput"};Promise.resolve().then(function(){return navigator.mediaDevices.enumerateDevices()}).then(function(e){return e.filter(function(e){return"videoinput"===e.kind})}).then(function(t){switch(l.deviceType){case"Mobile":case"Tablet":t&&t.length>1?e.videoInputDevices=[y,g]:e.videoInputDevices=[y];break;default:e.videoInputDevices=t}e.selectedVid=e.videoInputDevices[0],D()}).catch(function(){console.error("[VideoController.videoInputDevices] An error occured while detecting cameras."),e.videoInputDevices=[y],e.selectedVid=e.videoInputDevices[0],D()}),e.switchCamera=function(t){e.recorder.switchCamera(t.deviceId)},e.$on("$destroy",function(){T()}),e.$on("releaseVideo",function(){T()}),e.$on("displayVideoRecorder",function(){D()}),s.template.open("video","videorecorder");var b=function(t){try{var n=e.$root&&e.$root.$$phase;"$apply"==n||"$digest"==n?t&&"function"==typeof t&&t():e.$apply(t)}catch(e){}},w=0,M=0,k=function(t){if(e.currentDuration=t.timeStamp,"recording"==e.videoState){var n=t.timeStamp-e.recordStartTime;M=n,x(n+w)}},L=function(e,t){var n=new Date;n.setTime(n.getTime()+24*t*60*60*1e3);var r="expires="+n.toUTCString();document.cookie="camera-auth="+e+";"+r},x=function(t){t>6e4*e.recordMaxTime?e.stopRecord():(e.recordTime=Y(t),e.recordTimeInMs=t,b())},Y=function(t){t=(t-t%1e3)/1e3;var n=t%60;t=(t-n)/60;var r=t%60;return e.pad(r)+":"+e.pad(n)},T=function(){v.unsubscribe(),e.recorder.stopStreaming(),e.videoState="idle"},S=function(t){return r(o,void 0,void 0,function(){var n;return i(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),e.recordTime=Y(0),e.recordTimeInMs=0,e.videoState="starting",b(),[4,e.recorder.startStreaming(t)];case 1:return r.sent(),[4,e.switchCamera(e.selectedVid)];case 2:return r.sent(),e.videoState="ready",[3,4];case 3:return n=r.sent(),console.error("[VideoController.showCamera] Failed to start:",n),e.videoState="idle",[3,4];case 4:return b(),[2]}})})},D=function(){return r(o,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,d.Me.hasWorkflowRight("video.capture")];case 1:return t.sent()?e.isIncompatibleBrowser()||e.isIncompatibleDevice()?(e.videoState="incompatible",b(),console.warn("[VideoController.tryStartStreaming] browser incompatible:",browser),[2]):"idle"!=e.videoState?(console.warn("[VideoController.tryStartStreaming] already start"),[2]):(S(function(){e.videoState="idle"}),[2]):(console.warn("[VideoController] missing workflow right video.capture"),e.hasRight=!1,b(),[2])}})})};e.startCamera=function(){L(!0,30),S()},e.canPlay=function(){return!e.isPlaying()&&e.isRecorded()},e.isUploading=function(){return"uploading"==e.videoState},e.isPlaying=function(){return _},e.isIncompatibleDevice=function(){var e=l.devices.getOSInfo();return!(e&&"iOS"===e.name&&e.version>="14.3")&&(l.devices.isIphone()||l.devices.isIpad()||l.devices.isIpod())},e.isIncompatibleBrowser=function(){if(!window.MediaRecorder)return!0;var e=l.devices.getBrowserInfo();return-1===["Firefox","Chrome","Edge","Opera","Safari","CriOS","FxiOS"].findIndex(function(t){return e.name==t})},e.isReplayAllowed=function(){var e=l.devices.getOSInfo();return!(e&&("iOS"===e.name||"Mac OS"===e.name))},e.isIncompatible=function(){return"incompatible"==e.videoState},e.isReady=function(){return"ready"==e.videoState},e.isCameraVisible=function(){return"ready"==e.videoState||"recording"==e.videoState||"recorded"==e.videoState||"uploading"==e.videoState},e.showActions=function(){return"recording"==e.videoState||"recorded"==e.videoState||"uploading"==e.videoState},e.isRecording=function(){return"recording"==e.videoState},e.isRecorded=function(){return"recorded"==e.videoState},e.startRecord=function(t){return void 0===t&&(t=!1),r(o,void 0,void 0,function(){return i(this,function(n){return e.recorder.canStartRecording(function(n){n?(e.recordStartTime=e.currentDuration,w=t?M:0,M=0,e.videoState="recording",t?e.recorder.resume():(e.recorder.startRecording(),e.recordGuard.hasRecorded=!0)):a.notify.error("video.file.too.large"),b()}),[2]})})},e.stopRecord=function(t){void 0===t&&(t=!1),e.videoState="recorded",t?e.recorder.pause(!0):e.recorder.stopRecording(!0),b()},e.switchVideoRecord=function(){e.isRecording()?e.stopRecord():e.startRecord(),e.isRecorded()&&e.redo()},e.switchRecording=function(){"recorded"==e.videoState?e.startRecord(!1):e.stopRecord(!1)},e.play=function(){e.recorder.play()},e.redo=function(){e.recordGuard.guardObjectReset(),e.videoState="ready",_=!1,e.currentDuration=0,e.recordTime="00:00",e.recordTimeInMs=0,e.recorder.clearBuffer(!0),b(),e.$emit("video-redo")},e.upload=function(){e.videoState="uploading",e.videofile={},e.videofile.name="Capture Vidéo "+(new Date).toLocaleDateString("fr-FR"),b(),Promise.resolve().then(function(){var t=e.videofile.name,n=Math.round(e.recordTimeInMs);return t||(t="video-"+e.recorder.generateVideoId()),m.upload(e.recorder.getBuffer(),t,!0,n)}).then(function(e){if(!e||e.data&&"error"===e.data.state)throw e&&e.data&&e.data.code||null;return e}).then(function(t){e.recordGuard.guardObjectReset(),a.notify.success("video.file.saved"),t.data&&e.$emit("video-upload",t.data.videoid);var n=l.devices.getBrowserInfo(),r={videoId:t.data.videoworkspaceid,userId:e.me.userId,userProfile:e.me.profiles[0],device:l.deviceType,browser:n.name+" "+n.version,structure:e.me.structureNames[0],level:e.me.level,duration:Math.round(e.recordTimeInMs),weight:t.data.videosize,captation:!0,url:window.location.hostname,app:l.appPrefix};h.http().postJson("/video/event/save",r).done(function(e){}),e.videoState="recorded",e.recorder.turnOffCamera(),b()}).catch(function(t){t=t||"video.file.error",a.notify.error(t),e.videoState="recorded",e.recorder.turnOffCamera(),b()})},e.pad=function(e){return(""+e).length>=2?e+"":("0"+new Array(2).join("0")+e).slice(-2)},e.openMainPage=function(){delete e.website,delete e.selectedWebsite,e.action="videorecorder",s.template.open("video","videorecorder"),window.location.hash=""}}]))},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(34),s=n(551),a=n(37),u=function(){function e(e,t){var n=this;this.videoFactory=e,this.handleDuration=t,this.mode="idle",this.constraints={audio:!0,video:{width:640,height:360,facingMode:"environment"}},this.onPlayChanged=new s.Subject,this.videoPausePlayHandler=function(e){n.onPlayChanged.next(e)}}return e.isCompatible=function(){if(navigator.mediaDevices&&"function"==typeof navigator.mediaDevices.getSupportedConstraints){return navigator.mediaDevices.getSupportedConstraints().deviceId||!1}return!1},e.prototype.bindPlayEvents=function(){this.gumVideo&&(this.unbindPlayEvents(),this.gumVideo.addEventListener("play",this.videoPausePlayHandler,!1),this.gumVideo.addEventListener("pause",this.videoPausePlayHandler,!1))},e.prototype.unbindPlayEvents=function(){this.gumVideo&&(this.gumVideo.removeEventListener("play",this.videoPausePlayHandler,!1),this.gumVideo.removeEventListener("pause",this.videoPausePlayHandler,!1))},e.prototype.unbindRecordEvent=function(){this.gumVideo&&this.gumVideo.removeEventListener("timeupdate",this.handleDuration)},e.prototype.bindRecordEvent=function(){this.gumVideo&&(this.unbindRecordEvent(),this.gumVideo.addEventListener("timeupdate",this.handleDuration))},e.prototype.switchCamera=function(e){return r(this,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return"environment"===e||"user"===e?(delete this.constraints.video.deviceId,this.constraints.video.facingMode=e):e&&(delete this.constraints.video.facingMode,this.constraints.video.deviceId=e),this.stopStreaming(),[4,this.startStreaming()];case 1:return t.sent(),[2]}})})},e.prototype.play=function(){if(!this.gumVideo)return void console.warn("[VideoRecorder.play] stream not init");"playing"==this.mode?(this.gumVideo.pause(),this.mode="play"):(this.preparePlay(),this.gumVideo.play(),this.mode="playing")},e.prototype.preparePlay=function(){if("play"!=this.mode){this.unbindRecordEvent(),this.bindPlayEvents();var e=this.getBuffer();this.gumVideo.muted=!1,this.gumVideo.src=null,this.gumVideo.srcObject=null,this.gumVideo.autoplay=!1,this.gumVideo.src=window.URL.createObjectURL(e),this.gumVideo.controls=!0,this.mode="play"}},e.prototype.prepareRecord=function(){if(!this.stream)return void console.warn("[VideoRecorder.prepareRecord] stream not init");"record"!=this.mode&&(this.gumVideo.muted=!0,this.gumVideo.volume=1,this.gumVideo.src=null,this.gumVideo.srcObject=null,this.gumVideo.autoplay=!0,this.gumVideo.srcObject=this.stream,this.gumVideo.controls=!1,this.unbindPlayEvents(),this.bindRecordEvent(),this.mode="record")},e.prototype.stopStreaming=function(){if(this.gumVideo&&(this.unbindPlayEvents(),this.unbindRecordEvent()),this.stream){try{this.stopRecording(!1)}catch(e){}this.turnOffCamera(),this.stream=void 0}this.gumVideo=void 0,this.mode="idle"},e.prototype.startStreaming=function(e){return r(this,void 0,void 0,function(){var t,n,t,r;return i(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,10]),this.stream?[2]:[4,navigator.mediaDevices.getUserMedia(this.constraints)];case 1:return t=i.sent(),this.gumVideo||(this.gumVideo=this.videoFactory()),this.stream=t,this.prepareRecord(),[3,10];case 2:return n=i.sent(),n?"NotAllowedError"!=n.name?[3,3]:e?[2,e()]:[3,8]:[3,9];case 3:if("NotReadableError"!=n.name)return[3,8];i.label=4;case 4:return i.trys.push([4,6,,7]),[4,navigator.mediaDevices.getUserMedia({})];case 5:return t=i.sent(),this.gumVideo||(this.gumVideo=this.videoFactory()),this.stream=t,this.prepareRecord(),[3,7];case 6:return r=i.sent(),alert(r),[3,7];case 7:return[2];case 8:alert(n),i.label=9;case 9:return[3,10];case 10:return[2]}})})},e.prototype.generateVideoId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})},e.prototype.resume=function(){this.prepareRecord(),this.mediaRecorder.resume()},e.prototype.canStartRecording=function(e){return r(this,void 0,void 0,function(){return i(this,function(t){return o.http().get("/workspace/quota/user/"+a.model.me.userId).done(function(t){var n=t.quota>t.storage;e(n)}).error(function(t){e(!1)}),[2]})})},e.prototype.startRecording=function(){return r(this,void 0,void 0,function(){var e,t;return i(this,function(n){switch(n.label){case 0:return[4,this.startStreaming()];case 1:n.sent(),this.prepareRecord(),this.recorded=new Array,e=this,t={mimeType:"video/webm;codecs=vp9"},MediaRecorder.isTypeSupported?MediaRecorder.isTypeSupported(t.mimeType)||(console.error("[VideoRecorder.startRecording] "+t.mimeType+" is not Supported"),t={mimeType:'video/mp4; codecs="avc1.424028, mp4a.40.2"'},MediaRecorder.isTypeSupported(t.mimeType)||(console.error("[VideoRecorder.startRecording] "+t.mimeType+" is not Supported"),t={mimeType:"video/webm;codecs=vp8,opus"},MediaRecorder.isTypeSupported(t.mimeType)||(console.error("[VideoRecorder.startRecording] "+t.mimeType+" is not Supported"),t={mimeType:"video/webm"},MediaRecorder.isTypeSupported(t.mimeType)||(console.error("[VideoRecorder.startRecording] "+t.mimeType+" is not Supported"),t={mimeType:"video/ogg"})))):t={mimeType:"video/webm;codecs=vp8,opus"};try{this.mediaRecorder=new MediaRecorder(this.stream,t),this.recordMimeType=t.mimeType}catch(e){return console.error("[VideoRecorder.startRecording] Exception while creating MediaRecorder:",e),[2]}return this.mediaRecorder.onstop=function(e){},this.mediaRecorder.ondataavailable=function(t){t.data&&t.data.size>0&&e.recorded.push(t.data)},this.mediaRecorder.start(1e3),[2]}})})},e.prototype.pause=function(e){this.mediaRecorder.pause(),e&&this.preparePlay()},e.prototype.stopRecording=function(e){var t=this;this.mediaRecorder.requestData(),this.mediaRecorder.stop(),e&&setTimeout(function(){return t.preparePlay()},0)},e.prototype.turnOffCamera=function(){if(this.stream)for(var e=this.stream.getTracks(),t=0,n=e;t<n.length;t++){var r=n[t];try{r.stop()}catch(e){}}},e.prototype.getBuffer=function(){return new Blob(this.recorded,{type:this.recordMimeType})},e.prototype.clearBuffer=function(e){this.recorded=null,e&&this.prepareRecord()},e}();t.VideoRecorder=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(38),i=n(34),o=n(943),s=function(){function e(){this.cleanup=[]}return e.asFormData=function(){var e=new FormData,t=r.devices.getBrowserInfo();return e.append("device",r.deviceType),e.append("browser",t.name+" "+t.version),e.append("url",window.location.hostname),e.append("app",r.appPrefix),e},e.prototype.generateEvent=function(e,t,n){var o=r.devices.getBrowserInfo(),s={videoId:t,device:r.deviceType,browser:o.name+" "+o.version,session:"",source:n,duration:0,url:window.location.hostname,app:r.appPrefix};i.http().postJson("/video/event/"+e,s).done(function(e){console.log(e)})},e.prototype.onPlay=function(e){var t=e.target,n=this.cleanup.find(function(e){return e.elem===t&&!e.wasPlayed});if(n&&!n.wasPlayed){n.wasPlayed=!0;var r=t.dataset.documentId||"",i="true"==(t.dataset.documentIsCaptation||"false")?"CAPTURED":"UPLOADED";this.generateEvent("play",r,i)}},e.prototype.generateViewEventFor=function(e){var t=e.dataset.documentId||"",n="true"==(e.dataset.documentIsCaptation||"false")?"CAPTURED":"UPLOADED";this.generateEvent("view",t,n)},e.prototype.trackOne=function(e){var t=this;if(e){var n=function(e){t.onPlay(e)};e.addEventListener("play",n),this.cleanup.push({elem:e,wasPlayed:!1,cb:n}),e.setAttribute("controlsList","nodownload"),this.generateViewEventFor(e)}},e.prototype.untrackOne=function(e){if(e)for(var t=this.cleanup.length-1;t>=0;t--){var n=this.cleanup[t];n&&n.elem===e&&n.cb&&(n.elem.removeEventListener("play",n.cb),this.cleanup.splice(t,1))}},e.prototype.trackAll=function(e){for(var t=this,n=document.querySelectorAll("video[data-document-is-captation]"),r=0;n&&r<n.length;r++){var i=n[r];this.trackOne(i)}e&&e.$on("$destroy",function(){t.untrackAll()})},e.prototype.untrackAll=function(){this.cleanup.forEach(function(e){e&&e.elem&&e.cb&&e.elem.removeEventListener("play",e.cb)}),this.cleanup=[]},e}();t.VideoEventTrackerService=s,o.ng.services.push(o.ng.service("VideoEventTrackerService",[s]))},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),s=n(943),a=n(958),u=function(){function e(){this._maxWeight=50,this._maxDuration=3,this._acceptVideoUploadExtensions=["MP4","MOV","AVI"],this._initialized=!1}return Object.defineProperty(e.prototype,"maxWeight",{get:function(){return this._maxWeight},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxDuration",{get:function(){return this._maxDuration},enumerable:!0,configurable:!0}),e.prototype.safeValueOf=function(e,t,n){try{var r=parseInt(e[t]);return"number"!=typeof r||isNaN(r)?n:r}catch(e){return n}},e.prototype.initialize=function(){return r(this,void 0,void 0,function(){var e=this;return i(this,function(t){switch(t.label){case 0:if(this._initialized)return[2];t.label=1;case 1:return t.trys.push([1,,3,4]),[4,o.default.get("/video/conf/public").then(function(t){e._maxWeight=e.safeValueOf(t.data,"max-videosize-mbytes",e._maxWeight),e._maxDuration=e.safeValueOf(t.data,"max-videoduration-minutes",e._maxDuration);var n=t.data["accept-videoupload-extensions"];n&&("string"==typeof n&&(n=[n]),e._acceptVideoUploadExtensions=n||e._acceptVideoUploadExtensions,e._acceptVideoUploadExtensions=e._acceptVideoUploadExtensions.map(function(e){return e.toUpperCase()}))})];case 2:return t.sent(),[3,4];case 3:return this._initialized=!0,[7];case 4:return[2]}})})},e.prototype.getValidExtensions=function(){return this._acceptVideoUploadExtensions},e.prototype.checkValidExtension=function(e){return e=e.toUpperCase(),-1!==this._acceptVideoUploadExtensions.findIndex(function(t){return e===t})},e.prototype.upload=function(e,t,n,s){return r(this,void 0,void 0,function(){var r,u,c,l,d,h,f;return i(this,function(i){switch(i.label){case 0:if(!e)throw new Error("Invalid video file.");if(!t)throw new Error("Invalid video filename.");return r="/video/encode?captation="+n,u=a.VideoEventTrackerService.asFormData(),u.append("file",e,t),u.append("weight",""+e.size),u.append("captation",""+n),s&&(u.append("duration",""+s),r+="&duration="+s),[4,o.default.post(r,u)];case 1:if(c=i.sent(),202!=c.status)return[3,6];l=c.data.processid,console.log("[VideoUploadService] start fetching status for :",l,c.data),d=c.status,h=null,f=1,i.label=2;case 2:return 202!=d?[3,5]:[4,o.default.get("/video/status/"+l)];case 3:return h=i.sent(),d=h.status,[4,new Promise(function(e){return setTimeout(e,1e3*f)})];case 4:return i.sent(),f=Math.min(15,2*f),[3,2];case 5:if(201==d)return[2,h];i.label=6;case 6:throw new Error("Video cannot be uploaded.")}})})},e}();t.VideoUploadService=u,s.ng.services.push(s.ng.service("VideoUploadService",[u]))},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(961)),r(n(963)),r(n(964)),r(n(965)),r(n(966)),r(n(967)),r(n(968)),r(n(969)),r(n(970)),r(n(971)),r(n(972)),r(n(973)),r(n(974)),r(n(975)),r(n(976)),r(n(977)),r(n(978)),r(n(979)),r(n(980)),r(n(981)),r(n(982)),r(n(983)),r(n(984)),r(n(985)),r(n(986)),r(n(987)),r(n(996)),r(n(997)),r(n(998)),r(n(999)),r(n(1e3)),r(n(1001)),r(n(1002)),r(n(1003)),r(n(1004)),r(n(1005)),r(n(1006)),r(n(1007)),r(n(1008)),r(n(1009)),r(n(1010)),r(n(1011)),r(n(1013)),r(n(1014)),r(n(1015)),r(n(1016)),r(n(1017)),r(n(1018)),r(n(1019)),r(n(1020)),r(n(1021)),r(n(1022)),r(n(1023)),r(n(1024)),r(n(1025)),r(n(1026)),r(n(1027)),r(n(1028)),r(n(1029)),r(n(1030)),r(n(1031)),r(n(1034)),r(n(1038)),r(n(1040)),r(n(1041)),r(n(1044)),r(n(1045)),r(n(1046))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(962),o=n(6),s=n(1);t.assistant=r.ng.directive("assistant",function(){return{restrict:"E",scope:{app:"="},templateUrl:"/infra/public/template/assistant.html",link:function(e,t,n){if(!(s.$(window).width()<=o.ui.breakpoints.fatMobile)){e.show={assistant:!1};var r,a=function(){s.$(".pulsar-button").addClass("hidden"),r=setTimeout(a,50)};e.app&&(i.quickstart.app=e.app,i.quickstart.prefName+=e.app.charAt(0).toUpperCase()+e.app.slice(1)),i.quickstart.load(function(){-1!==i.quickstart.state.assistant&&0!==i.quickstart.mySteps.length&&(a(),e.show.assistant=!0,e.currentStep=i.quickstart.assistantIndex,e.steps=i.quickstart.mySteps,e.$apply())}),e.goTo=function(t){i.quickstart.goTo(t.index),e.currentStep=i.quickstart.assistantIndex},e.next=function(){i.quickstart.nextAssistantStep(),e.currentStep=i.quickstart.assistantIndex,i.quickstart.assistantIndex||(e.show.assistant=!1,s.$(".pulsar-button").removeClass("hidden"),clearTimeout(r))},e.previous=function(){i.quickstart.previousAssistantStep(),e.currentStep=i.quickstart.assistantIndex},e.seeLater=function(){e.show.assistant=!1,s.$(".pulsar-button").removeClass("hidden"),clearTimeout(r),i.quickstart.seeAssistantLater()},e.closeAssistant=function(){e.show.assistant=!1,s.$(".pulsar-button").removeClass("hidden"),clearTimeout(r),i.quickstart.state.assistant=-1,i.quickstart.save()}}}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(37),i=n(33),o=n(34),s=n(916);t.quickstart={steps:{},state:{},types:{ENSEIGNANT:"teacher",ELEVE:"student",PERSEDUCNAT:"personnel",PERSRELELEVE:"relative"},mySteps:[],assistantIndex:{},app:"",prefName:"quickstart",assistantStep:function(e){return i.skin.basePath+"template/assistant/"+(this.app?this.app+"/":"")+this.types[r.model.me.type]+"/"+e+".html"},nextAssistantStep:function(){this.state.assistant++,this.state.assistant===this.steps[this.types[r.model.me.type]]?(this.state.assistant=-1,this.assistantIndex=void 0):this.assistantIndex=this.mySteps[this.state.assistant],this.save()},seeAssistantLater:function(){this.state.assistantTimer=s.moment().format("MM/DD/YYYY HH:mm"),this.save()},nextAppStep:function(){return this.state[i.skin.skin][this.app]++,this.save(),this.state[i.skin.skin][this.app]},previousAppStep:function(){return this.state[i.skin.skin][this.app]--,this.save(),this.state[i.skin.skin][this.app]},goToAppStep:function(e){return this.state[i.skin.skin][this.app]=e,this.save(),e},closeApp:function(){this.state[i.skin.skin][this.app]=-1,this.save()},appIndex:function(){return this.app=window.location.href.split("//")[1].split("/").slice(1).join("/"),this.state[i.skin.skin]||(this.state[i.skin.skin]={}),this.state[i.skin.skin][this.app]||(this.state[i.skin.skin][this.app]=0),this.state[i.skin.skin][this.app]},previousAssistantStep:function(){this.state.assistant--,this.state.assistant<0&&(this.state.assistant=0),this.assistantIndex=this.mySteps[this.state.assistant],this.save()},save:function(e){o.http().putJson("/userbook/preference/"+this.prefName,this.state).done(function(){"function"==typeof e&&e()})},goTo:function(e){e>this.mySteps.length&&(e=-1),this.state.assistant=e,-1!==e&&(this.assistantIndex=this.mySteps[e]),this.save()},loaded:!1,awaiters:[],load:function(e){if(this.loaded)return void("function"==typeof e&&e());this.awaiters.push(e),this.loading||(this.loading=!0,o.http().get("/userbook/preference/"+this.prefName).done(function(e){var t;if(e.preference)try{t=JSON.parse(e.preference)}catch(e){console.log("Error parsing quickstart preferences")}t||(t={}),t.assistant||(t.assistant=0),t[i.skin.skin]||(t[i.skin.skin]={}),this.state=t,-1===t.assistant||t.assistantTimer&&s.moment(t.assistantTimer).year()===s.moment().year()&&s.moment(t.assistantTimer).dayOfYear()===s.moment().dayOfYear()&&s.moment(t.assistantTimer).hour()===s.moment().hour()?(this.loaded=!0,this.awaiters.forEach(function(e){"function"==typeof e&&e()})):o.http().get(i.skin.basePath+"template/assistant/"+(this.app?this.app+"/":"")+"steps.json").done(function(e){this.steps=e;for(var t=this.steps[this.types[r.model.me.type]],n=0;n<t;n++)this.mySteps.push({index:n,path:this.assistantStep(n)}),this.assistantIndex=this.mySteps[this.state.assistant];this.loaded=!0,this.awaiters.forEach(function(e){"function"==typeof e&&e()})}.bind(this))}.bind(this)))}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(1),o=n(4),s=n(3);t.autocomplete=r.ng.directive("autocomplete",["$timeout",function(e){return{restrict:"E",replace:!0,scope:{options:"&",ngModel:"=",ngChange:"&",search:"=?",placeholder:"@?"},template:'\n <div class="row">\n <input type="text" class="twelve cell" ng-model="search" i18n-placeholder="{{placeholder||\'search\'}}" autocomplete="off" />\n <div data-drop-down class="drop-down">\n <div>\n <ul class="ten cell right-magnet">\n <li class="block-container" ng-repeat="option in match | limitTo:limit" ng-model="option">\n <a class="cell right-spacing" ng-class="{\'sharebookmark\': option.type === \'sharebookmark\'}">\n <i class="add-favorite cell" ng-if="option.type === \'sharebookmark\'"></i>\n [[option.toString()]]\n </a>\n <em ng-if="option.structureName" class="top-spacing-twice low-importance">[[option.structureName]]</em>\n <em class="top-spacing-twice low-importance">[[translate(option.profile)]] </em>\n </li>\n <li class="display-more block-container" ng-show="limit < match.length" ng-click="increaseLimit()">[[translate(\'seemore\')]]</li>\n </ul>\n </div>\n </div>\n </div>\n ',link:function(t,n,r){var a;if("off"!==r.autocomplete){var u=n.find("[data-drop-down]"),c=n.find("input");t.search="",t.translate=s.idiom.translate,t.limit=6,t.match=[],t.increaseLimit=function(){t.limit+=5,e(function(){t.setDropDownHeight()})},t.setDropDownHeight=function(){var e=0,n=Math.min(t.limit,t.match.length);u.find("li").each(function(t,r){return e+=i.$(r).offsetHeight,t<n}),u.height(e)};var l=function(){if(!t.match||0===t.match.length)return u.height(),u.addClass("hidden"),t.limit=6,void u.attr("style","");var e=c.offset(),n=c.width()+parseInt(c.css("padding-right"))+parseInt(c.css("padding-left"))+2*parseInt(c.css("border-width")||1),r=c.height()+parseInt(c.css("padding-top"))+parseInt(c.css("padding-bottom"))+2*parseInt(c.css("border-height")||1);e.top=e.top+r,u.offset(e),u.width(n),t.setDropDownHeight(),setTimeout(function(){t.setDropDownHeight()},100),a=requestAnimationFrame(l)};t.$watch("search",function(e){return e?(t.match=o._.filter(t.options(),function(t){var n=e.split(" ");return void 0===o._.find(n,function(e){var n=s.idiom.removeAccents(t.toString()).toLowerCase(),r=s.idiom.removeAccents(e).toLowerCase();return-1===n.indexOf(r)})}),t.match&&0!==t.match.length?(u.removeClass("hidden"),cancelAnimationFrame(a),void l()):(u.height(""),t.limit=6,void u.addClass("hidden"))):(t.match=[],u.height(""),void u.addClass("hidden"))}),n.parent().on("remove",function(){cancelAnimationFrame(a),u.remove()}),t.$on("$destroy",function(){cancelAnimationFrame(a),u.remove()}),u.detach().appendTo("body"),u.on("click","li",function(e){i.$(e.target).hasClass("display-more")||(t.limit=6,u.attr("style",""),t.ngModel=i.$(this).scope().option,t.search="",t.$apply("ngModel"),t.$eval(t.ngChange),t.$apply("ngModel"),u.addClass("hidden"),cancelAnimationFrame(a))});var d=function(e){n.find(e.target).length>0||u.find(e.target).length>0||(t.match=[],t.$apply())};i.$("body").on("click",d),u.attr("data-opened-drop-down",!0)}}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943);t.autosize=r.ng.directive("autosize",["$compile",function(e){return{restrict:"A",link:function(e,t,n){var r=function(e){return jQuery(e).css({height:"auto","overflow-y":"hidden"}).css({height:e[0].scrollHeight})};r(t).on("input",function(){r(t)})}}}])},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(943),s=n(7),a=n(1);t.bindHtml=o.ng.directive("bindHtml",["$compile",function(e){return{restrict:"A",scope:{bindHtml:"="},link:function(t,n){t.$watch("bindHtml",function(o){var u=this,c=a.$("<div>"+(o||"")+"</div>");c.find("[resizable]").removeAttr("resizable").css("cursor","initial"),c.find("[bind-html]").removeAttr("bind-html"),c.find("[ng-include]").removeAttr("ng-include"),c.find("[ng-transclude]").removeAttr("ng-transclude"),c.find("[draggable]").removeAttr("draggable").css("cursor","initial"),c.find("[contenteditable]").removeAttr("contenteditable"),c.find("script").remove(),c.find("*").each(function(e,t){for(var n=t.attributes,r=n.length-1;r>=0;r--)(n[r].name.startsWith("on")||n[r].value.includes("javascript:"))&&t.removeAttribute(n[r].name)});var l=c[0].outerHTML;window.MathJax||window.MathJaxLoading||(window.MathJaxLoading=!0,a.$.getScript(window.CDN_DOMAIN+"/infra/public/mathjax/MathJax.js",function(){window.MathJax.Ajax.config.root=window.CDN_DOMAIN+"/infra/public/mathjax/",window.MathJax.Hub.Config({messageStyle:"none",tex2jax:{preview:"none"},jax:["input/TeX","output/CommonHTML"],extensions:["tex2jax.js","MathMenu.js","MathZoom.js"],TeX:{extensions:["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]}}),window.MathJax.Hub.Queue(["Typeset",window.MathJax.Hub]),t.$apply()})),n.html(e(l)(t.$parent)),n.find("audio").each(function(e,t){var n=a.$(t).parent();a.$(t).attr("src",t.src).attr("preload","none").detach().appendTo(n)}),n.find("img").css({cursor:""}),n.on("mouseover","img",function(e){return r(u,void 0,void 0,function(){var t,n,r,o,u;return i(this,function(i){switch(i.label){case 0:return t=a.$(e.target).attr("src"),t.startsWith("/workspace/document")?(n=void 0,a.$(e.target).data("legend")?(n=a.$(e.target).data("legend"),[3,3]):[3,1]):[3,4];case 1:return r=t.split("/workspace/document/")[1].split("?")[0],[4,s.default.get("/workspace/document/properties/"+r)];case 2:o=i.sent(),n=o.data.legend,i.label=3;case 3:if(!n)return[2];a.$(e.target).data("legend",n),u=a.$('<legend class="user-image"><div class="text">'+n+"</div></legend>"),u.height(a.$(e.target).height()),u.width(a.$(e.target).width()),u.css("position","absolute"),u.offset({top:a.$(e.target).offset().top,left:a.$(e.target).offset().left}),u.appendTo("body"),setTimeout(function(){var t=function(e){u.find(".text").addClass("hidden"),setTimeout(function(){return u.remove()},250),a.$(e.target).off("mouseout")};a.$(e.target).on("mouseout",t)},10),i.label=4;case 4:return[2]}})})}),window.MathJax&&window.MathJax.Hub&&window.MathJax.Hub.Queue(["Typeset",window.MathJax.Hub])})}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(1);t.bottomScroll=r.ng.directive("bottomScroll",function(){return{restrict:"A",link:function(e,t,n){var r=t,o=function(){return t[0].scrollHeight};"auto"!==t.css("overflow")&&void 0===n.scrollable&&(r=i.$(window),o=function(){return i.$(document).height()}),r.scroll(function(){var t=r[0].scrollY||r[0].scrollTop||r[0].pageYOffset;t+=100,o()-r.height()<t&&(e.$eval(n.bottomScroll),e.$$phase||e.$apply())})}}}),t.onBottomScroll=r.ng.directive("onBottomScroll",function(){return{restrict:"A",link:function(e,t,n){var r=parseInt(n.onBottomScrollOffset)||100;t.scroll(function(){var i=t.outerHeight(),o=t.scrollTop();t.prop("scrollHeight")-(i+o)<r&&(e.$eval(n.onBottomScroll),e.$$phase||e.$apply())})}}})},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(943),s=n(38),a=n(37),u=n(916),c=n(4),l=n(387),d=n(390),h=n(1),f=n(937);t.calendarComponent=o.ng.directive("calendar",function(){return{restrict:"E",scope:!0,templateUrl:"/assets/js/entcore/template/calendar.html",controller:["$scope","$timeout",function(e,t){e.timeOfDay={start:0,end:24};var n=function(){a.model.calendar.clearScheduleItems(),e.items=c._.where(c._.map(e.items,function(e){return e.beginning=e.startMoment,e.end=e.endMoment,e}),{is_periodic:!1}),a.model.calendar.addScheduleItems(e.items),a.model.calendar.display=e.display,e.calendar=a.model.calendar,window.currentLanguage&&e.calendar.firstDay.locale(window.currentLanguage),e.moment=u.moment,e.display.editItem=!1,e.display.createItem=!1,e.appPrefix=s.appPrefix;var t={displayQuarterHours:!1,displaySaturday:!1,displaySunday:!1};e.toogleDisplayOptions=function(){f.Me&&f.Me.preferences&&(f.Me.preferences.calendarOptions||(f.Me.preferences.calendarOptions={}),f.Me.preferences.calendarOptions.displayQuarterHours=e.display.quarterHours,f.Me.preferences.calendarOptions.displaySaturday=e.display.saturday,f.Me.preferences.calendarOptions.displaySunday=e.display.sunday,f.Me.savePreference("calendarOptions"))},e.display.options&&function(){r(this,void 0,void 0,function(){return i(this,function(n){switch(n.label){case 0:return[4,f.Me.preference("calendarOptions")];case 1:return t=n.sent(),e.display.quarterHours=t.displayQuarterHours,e.display.saturday=t.displaySaturday,e.display.sunday=t.displaySunday,[2]}})})}(),d.template.open("calendarDefaultDisplayOptionsTemplate","entcore/calendar-default-display-options-template"),e.editItem=function(t){e.calendarEditItem=t,e.display.editItem=!0},e.createItem=function(t,n){e.newItem={};var r=a.model.calendar.firstDay.year()||t.date&&t.date.year();t.index<a.model.calendar.firstDay.dayOfYear()&&r++,n||(n={start:l.calendar.startOfDay,end:l.calendar.endOfDay}),e.newItem.beginning=u.moment().utc().year(r).dayOfYear(t.index).hour(n.start).minute(n.startMinutes),e.newItem.end=u.moment().utc().year(r).dayOfYear(t.index).hour(n.end).minute(n.endMinutes),a.model.calendar.newItem=e.newItem,a.model.calendar.eventer.trigger("calendar.create-item",n),e.onCreateOpen()},e.closeCreateWindow=function(){e.display.createItem=!1,e.onCreateClose()},e.updateCalendarDate=function(){a.model.calendar.setDate(a.model.calendar.firstDay)},e.previousTimeslots=function(){l.calendar.startOfDay!==l.calendar.firstHour&&(l.calendar.startOfDay--,l.calendar.endOfDay--,a.model.calendar.initTimeSlots(),a.model.calendar.days.sync(),n())},e.nextTimeslots=function(){l.calendar.endOfDay!==l.calendar.lastHour&&(l.calendar.startOfDay++,l.calendar.endOfDay++,a.model.calendar.initTimeSlots(),a.model.calendar.days.sync(),n())}};e.optionalDisplay=function(t){return!(!e.display.saturday&&"saturday"==t.name||!e.display.sunday&&"sunday"==t.name)},e.getMonthDayOffset=function(e){return(e.date.day()||7)-1},l.calendar.setCalendar=function(e){a.model.calendar=e,n()},t(function(){n(),e.$watchCollection("items",n)},0),e.refreshCalendar=n,e.$watch("display.mode",function(){a.model.calendar.setIncrement(e.display.mode),n()}),e.$watchCollection("slots",function(t,n){t!==n&&(a.model.calendar.setTimeslots(t),e.timeOfDay={start:l.calendar.firstHour,end:l.calendar.lastHour},e.$apply())})}],link:function(e,t,n){var r;n.itemTooltipTemplate&&(e.itemTooltipTemplate=n.itemTooltipTemplate),e.display={readonly:!1,mode:"week",enableModes:"true"===n.enableDisplayModes,quarterHours:!1,sunday:!1,saturday:!1,options:"true"===n.displayOptions,lightboxOptions:!1,showNextPreviousButton:"true"===n.showNextPreviousButton},n.$observe("createTemplate",function(){n.createTemplate&&(d.template.open("schedule-create-template",n.createTemplate),r=!0)}),n.$observe("displayTemplate",function(){n.displayTemplate&&d.template.open("schedule-display-template",n.displayTemplate)}),n.$observe("displayMonthTemplate",function(){n.displayMonthTemplate&&d.template.open("schedule-display-month-template",n.displayMonthTemplate),n.moreItemsTemplate&&d.template.open("schedule-more-items-template",n.moreItemsTemplate)}),e.items=e.$eval(n.items),e.slots=e.$eval(n.slots),e.onCreateOpen=function(){r&&(e.$eval(n.onCreateOpen),e.display.createItem=!0)},e.onCreateClose=function(){e.$eval(n.onCreateClose)},e.$watch(function(){return e.$eval(n.items)},function(t){e.items=t}),e.$watch(function(){return e.$eval(n.slots)},function(t){return e.slots=t})}}}),t.scheduleItem=o.ng.directive("scheduleItem",function(){return{restrict:"E",require:"^calendar",template:'<div class="schedule-item" resizable horizontal-resize-lock draggable><container template="schedule-display-template" class="absolute"></container></div>',controller:["$scope",function(e){}],link:function(e,t,n){var r=t.parents(".schedule"),i=t.children(".schedule-item");(e.item.beginning.dayOfYear()!==e.item.end.dayOfYear()||u.moment().diff(u.moment(e.item.end_date))>0||e.item.locked)&&(i.removeAttr("resizable"),i.removeAttr("draggable"),i.unbind("mouseover"),i.unbind("click"),i.data("lock",!0));var o=function(){var e=i.position().top+l.calendar.dayHeight*l.calendar.startOfDay,n=u.moment().utc();n.hour(Math.floor(e/l.calendar.dayHeight)),n.minute(e%l.calendar.dayHeight*60/l.calendar.dayHeight);var r=u.moment().utc();r.hour(Math.floor((e+i.height())/l.calendar.dayHeight)),r.minute((e+i.height())%l.calendar.dayHeight*60/l.calendar.dayHeight),n.year(a.model.calendar.firstDay.year()),r.year(a.model.calendar.firstDay.year());var o=t.parents(".schedule").find(".day"),s=i.offset().left+i.width()/2,c=o.first().width();return o.each(function(e,t){var i=h.$(t).offset().left;if(i<s&&i+c>s){var o=a.model.calendar.firstDay.clone().add(e,"days");r.year(o.year()),r.month(o.month()),r.date(o.date()),n.year(o.year()),n.month(o.month()),n.date(o.date())}}),{startTime:n,endTime:r}};i.on("stopResize",function(){var t=o();e.item.beginning=t.startTime,e.item.end=t.endTime,a.model.calendar.eventer.trigger("calendar.resize-item",e.item),"function"==typeof e.item.calendarUpdate&&(e.item.calendarUpdate(),a.model.calendar.clearScheduleItems(),a.model.calendar.addScheduleItems(e.$parent.items),e.$parent.$apply("items"))}),i.on("stopDrag",function(){var t=o();e.item.beginning=t.startTime,e.item.end=t.endTime,a.model.calendar.eventer.trigger("calendar.drop-item",e.item),"function"==typeof e.item.calendarUpdate&&(e.item.calendarUpdate(),a.model.calendar.clearScheduleItems(),a.model.calendar.addScheduleItems(e.$parent.items),e.$parent.$apply("items"),r.find("schedule-item").each(function(e,t){angular.element(t).scope().placeItem()}))});var s=function(){var n=r.find(".day").width(),o=(t.parent().width(),e.item.beginning.dayOfYear(),e.item.end.dayOfYear(),l.calendar.getHours(e.item,e.day),a.model.calendar.getSlotsIndex(e.item.beginning,e.item.end));if(0!==o.length){var s=e.day.scheduleItems.scheduleItemWidth(e.item);i.css({width:s+"%"});for(var u=0,c=!0;c;)c=!1,e.day.scheduleItems.forEach(function(t){t!==e.item&&t.beginning<e.item.end&&t.end>e.item.beginning&&t.calendarGutter===u&&(u++,c=!0)});e.item.calendarGutter=u;var d=o.length>0?l.calendar.slotsDuration[o[0]]:0,h=o.length>0?l.calendar.slotsDuration[o[o.length-1]]:0,f=a.model.calendar.timeSlots.all[o[0]],p=e.item.beginning.diff(e.item.beginning.clone().hours(f.start).minutes(f.startMinutes),"minutes"),m=p/d*l.calendar.dayHeight,_=a.model.calendar.timeSlots.all[o[o.length-1]],v=e.item.end.diff(e.item.end.clone().hours(_.end).minutes(_.endMinutes),"minutes"),y=v/h*l.calendar.dayHeight;i.height(o.length*l.calendar.dayHeight-m+y+"px");var g=a.model.calendar.getFirstSlotIndex(),b=o[0]-g,w=b*l.calendar.dayHeight+m;i.css({top:w+"px",left:e.item.calendarGutter*(s*n/100)+"px"});var M=t.find("container");w<0?(M.css({top:Math.abs(w)-5+"px"}),M.height(t.children(".schedule-item").height()+w+5)):(M.css({top:"0px"}),M.css({height:"100%"}))}};e.$parent.$watch("items",s),e.$parent.$watchCollection("items",s),e.$watch("item",s),e.placeItem=s}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943);t.carousel=r.ng.directive("carousel",function(){return{scope:{items:"="},restrict:"E",templateUrl:"/assets/js/entcore/template/carousel.html",link:function(e,t,n){var r=0;n.transition&&t.addClass(e.$parent.$eval(n.transition)),n.buttons&&t.addClass(e.$parent.$eval(n.buttons)),e.current={image:e.items[0],index:0},e.images=e.items.filter(function(e){return void 0!==e.icon}),e.$watchCollection("items",function(t){e.images=e.items.filter(function(e){return void 0!==e.icon}),e.current={image:e.items[0],index:0}}),e.openCurrentImage=function(){window.location.href=e.current.image.link},e.openSelectImage=function(t,n){e.current.image===t?e.openCurrentImage():(e.current.image=t,e.current.index=n),cancelAnimationFrame(i),o(),r--,setTimeout(s,5e3)},e.getPilePosition=function(t){return t<e.current.index?100+t:100-t};var i,o=function(){t.find(".current img").height(t.find(".current .image-container").height()),i=requestAnimationFrame(o)},s=function(){if(cancelAnimationFrame(i),r<0)return void r++;e.current.index++,e.current.index===e.items.length&&(e.current.index=0),e.current.image=e.items[e.current.index],e.$apply("current"),o(),setTimeout(s,4e3)};setTimeout(function(){s()},1)}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(38);t.completeChange=r.ng.directive("completeChange",function(){return{restrict:"A",scope:{exec:"&completeChange",field:"=ngModel"},link:function(e,t,n){e.$watch("field",function(e){t.is(":focus")||(t.val(e),"textarea"===t[0].type&&t.hasClass("inline-editing")&&setTimeout(function(){t.height(1),t.height(t[0].scrollHeight-1)},100))});var r="change";i.devices.isIE&&(r="blur"),t.on(r,function(){e.field=t.val(),e.$$phase||e.$apply("field"),e.$parent.$eval(e.exec),e.$$phase||e.$apply("field")})}}})},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},o=this;Object.defineProperty(t,"__esModule",{value:!0});var s=n(34),a=n(943),u=n(551),c=void 0,l=function(){return r(o,void 0,void 0,function(){var e,t;return i(this,function(n){switch(n.label){case 0:if(c)return[2,c];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,s.httpPromisy().get("/userbook/preference/authenticatedConnectorsAccessed")];case 2:return e=n.sent(),e.preference&&(c=JSON.parse(e.preference)),[3,4];case 3:return t=n.sent(),console.log("Error parsing authenticatedConnectorsAccessed preferences"),c={},[3,4];case 4:return[2,c]}})})},d=new u.Subject;t.connectorLightboxTrigger=a.ng.directive("connectorLightboxTrigger",["$timeout","$filter",function(e,t){return{restrict:"A",scope:{connectorLightboxTrigger:"="},link:function(e,t,n){var o=this;!function(){r(o,void 0,void 0,function(){return i(this,function(n){return t.on("click",function(n){var r={app:e.connectorLightboxTrigger,element:t,$mutex:!1,ctrlKey:!!n.ctrlKey,metaKey:!!n.metaKey};d.next(r)}),e.$on("$destroy",function(){t.off("click")}),[2]})})}()}}}]),t.connectorLightbox=a.ng.directive("connectorLightbox",["$timeout","$filter",function(e,t){return{restrict:"E",scope:{},template:'\n <lightbox show="display.showAuthenticatedConnectorLightbox" on-close="onClose()">\n <h3><i18n>apps.authenticatedConnector.lightbox.title</i18n></h3>\n <div class="info vertical-spacing-twice"><i18n>apps.authenticatedConnector.lightbox.content</i18n></div>\n \n <div>\n <button class="horizontal-spacing" \n ng-click="onConfirm(authenticatedConnectorClicked)">\n <i18n>confirm</i18n>\n </button>\n <button class="horizontal-spacing" \n ng-click="onClose()">\n <i18n>cancel</i18n>\n </button>\n </div>\n </lightbox>\n\n ',link:function(e,t,n){var o=this;e.display={showAuthenticatedConnectorLightbox:!1};var a=null,u=function(e){return!!e.casType||e.scope&&e.scope.length>0&&!!e.scope[0]},c=function(t){return!e.authenticatedConnectorsAccessed||e.authenticatedConnectorsAccessed&&!e.authenticatedConnectorsAccessed.includes(t.name)};e.onClose=function(){e.display.showAuthenticatedConnectorLightbox=!1};var h=function(e,t){a.app.isExternal&&window.xiti&&window.xiti.click?"_self"==t?window.xiti.click(a.app.name,a.element[0]).then(function(){window.open(e,t)}).catch(function(n){window.open(e,t)}):(window.xiti.click(a.app.name,a.element[0]),window.open(e,t)):window.open(e,t)};e.onConfirm=function(){var t=a.app;e.onClose(),e.authenticatedConnectorsAccessed?e.authenticatedConnectorsAccessed.push(t.name):e.authenticatedConnectorsAccessed=[t.name];var n=a.ctrlKey||a.metaKey?"_blank":t.target?t.target:"_self";"_self"!==n?(s.http().putJson("/userbook/preference/authenticatedConnectorsAccessed",e.authenticatedConnectorsAccessed),h(t.address,n)):function(){r(this,void 0,void 0,function(){return i(this,function(r){switch(r.label){case 0:return[4,s.httpPromisy().putJson("/userbook/preference/authenticatedConnectorsAccessed",e.authenticatedConnectorsAccessed)];case 1:return r.sent(),h(t.address,n),[2]}})})}()};var f=function(t){if(!t.$mutex){t.$mutex=!0;var n=t.app;if(void 0===n)throw"ConnectorLightboxScope.openAppWithCheck failed : target app is undefined";var r=a.ctrlKey||a.metaKey?"_blank":n.target?n.target:"_self";if(e.skipCheck)return void h(n.address,r);u(n)&&c(n)?(e.authenticatedConnectorClicked=n,e.display.showAuthenticatedConnectorLightbox=!0,e.$apply()):h(n.address,r)}};!function(){r(o,void 0,void 0,function(){var t,n,r,o;return i(this,function(i){switch(i.label){case 0:return t=d.subscribe(function(e){a=e,f(a)}),e.$on("$destroy",function(){t.unsubscribe()}),n=e,[4,l()];case 1:n.authenticatedConnectorsAccessed=i.sent(),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,s.httpPromisy().get("/cas/conf/public")];case 3:return r=i.sent(),e.skipCheck=!!r.skip,[3,5];case 4:return o=i.sent(),console.warn("Failed to get public conf: ",o),[3,5];case 5:return[2]}})})}()}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388),i=n(6);t.contactChip=r.ng.directive("contactChip",function(){return{restrict:"E",template:'\n <span class="cell round bg-white square-small" ng-class="{ group: isChipGroup() }">\n <img ng-if="isChipGroup()" skin-src="/img/illustrations/group-avatar.svg"/>\n <img ng-if="!isChipGroup()" ng-src="/userbook/avatar/[[id]]?thumbnail=100x100"/>\n </span>\n\n <span ng-if="!isChipGroup()" class="cell circle square-mini" ng-class="profile()"></span>\n\n <span ng-if="!isChipGroup() && !isNotLinked" class="cell-ellipsis block left-text">\n <a ng-click="$event.stopPropagation();" href="/userbook/annuaire#[[id]]" target="_blank">[[ ngModel.name ]][[ ngModel.displayName ]]</a>\n </span>\n <span ng-if="!isChipGroup() && isNotLinked" class="cell-ellipsis block left-text">\n [[ ngModel.name ]][[ ngModel.displayName ]]\n </span>\n <span ng-if="isChipGroup() && !isNotLinked" class="cell-ellipsis block left-text">\n <a ng-if="!isNotLinked" ng-click="$event.stopPropagation();" href="/userbook/annuaire#/group-view/[[id]]" target="_blank">[[ ngModel.name ]]</a>\n </span>\n <span ng-if="isChipGroup() && isNotLinked" class="cell-ellipsis block left-text">\n [[ ngModel.name ]]\n </span>\n\n <i class="absolute-magnet" \n ng-if="(stickernotselected || !ngModel.selected) && (isMovable() || isRemovable())" \n ng-class="{ \'right-arrow\':isMovable(), \'close\':isRemovable() }"\n ng-click="iconActionExists ? actionIcon({item:ngModel}) : action({item:ngModel}); $event.stopPropagation();">\n </i>\n ',scope:{ngModel:"=",action:"&",actionIcon:"&"},link:function(e,t,n){e.stickernotselected=n.hasOwnProperty("stickernotselected"),e.isGroup=n.hasOwnProperty("isgroup"),e.iconActionExists=!angular.isUndefined(n.actionIcon),e.isNotLinked=n.hasOwnProperty("isnotlinked"),e.id=e.ngModel.id?e.ngModel.id:e.ngModel._id,e.profile=function(){return i.ui.profileColors.match(e.ngModel.profile)},e.isMovable=function(){return t.hasClass("movable")},e.isRemovable=function(){return t.hasClass("removable")},e.isChipHover=function(){return t.hasClass("chip-hover")},e.isChipGroup=function(){return e.isGroup||e.ngModel.groupType||e.ngModel.isGroup||"group"===e.ngModel.type},e.onGeneralClick=function(){e.action({item:e.ngModel})},t.on("click",function(){(e.isChipHover()||e.iconActionExists)&&e.onGeneralClick()}),t.on("mouseenter",function(){for(var n=t.find(".cell-ellipsis"),r=0,i=n.length;r<i;r++)n[r].offsetWidth<n[r].scrollWidth?n.eq(r).attr("title",e.isChipGroup()?e.ngModel.name:(e.ngModel.name?e.ngModel.name:"")+(e.ngModel.displayName?e.ngModel.displayName:"")):n.eq(r).attr("title",null)})}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388);t.contentDivider=r.ng.directive("contentDivider",function(){return{restrict:"E",template:function(e,t){return'\n <div class="zero-mobile-fat-mobile flex-row reduce-block-eight scroll-x">\n <div class="flex-row" ng-repeat="content in getModel() track by $index">'+e.children()[0].outerHTML+'<div class="horizontal-margin-twice divider-border" ng-if="$index < ngModel.length - 1"></div>\n </div>\n </div>\n <div class="mobile-fat-mobile flex-row f-column reduce-block-eight">\n <div class="flex-row f-column" ng-repeat="content in getModel() track by $index">'+e.children()[0].outerHTML+'<div class="vertical-spacing-six divider-border-horizontal" ng-if="$index < ngModel.length - 1"></div>\n </div>\n </div>\n '},scope:{callback:"="},require:"ngModel",link:function(e,t,n,r,i){e.order=n.order,e.getModel=function(){var e=r.$viewValue;return null==e?[]:"string"==typeof e?JSON.parse(e):e}}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943);t.documentIsCaptation=r.ng.directive("documentIsCaptation",["VideoEventTracker",function(e){return{restrict:"A",link:function(t,n,r){if(n&&!(n.length<1)){var i=n.get(0);i&&HTMLVideoElement.prototype.isPrototypeOf(i)&&(e.trackOne(i),t.$on("$destroy",function(){e.untrackOne(i)}))}}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(1);t.dotsMenu=r.ng.directive("dotsMenu",function(){return{restrict:"E",transclude:!0,template:'\n <i class="opener"></i>\n <div class="options" ng-transclude></div>\n ',link:function(e,t,n){t.children(".opener").on("click",function(){t.offset().left<400&&t.addClass("right"),setTimeout(function(){t.hasClass("opened")?t.removeClass("opened"):t.addClass("opened")},10)}),i.$("body, lightbox").on("click",function(e){i.$(t).hasClass("opener")||t.removeClass("opened")})}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(1),o=n(6),s={height:300,width:300};t.dragItem=r.ng.directive("dragItem",function(){return{restrict:"A",link:function(e,t,n){var r=e.$eval(n.dragItem),a=void 0,u=!0;e.$watch(function(){return e.$eval(n.dragItem)},function(e){r=e}),o.ui.extendElement.draggable(t,{mouseUp:function(n){i.$(".droppable").off("mouseout"),i.$("body").removeClass("dragging"),a&&a.trigger("drop",[r]),e.$apply(),u=!0,t.attr("style",""),t.trigger("stopdrag"),t.removeClass("dragging")},startDrag:function(e){if(t.addClass("dragging"),t[0].hasAttribute("drag-crop")){var n={};if(t.height()>s.height){var r=s.height,i=s.height/2-window.scrollY;e.elementDistance.y>i?e.elementDistance.y=i:r=e.elementDistance.y+s.height/2,n.height=r,t.css({overflow:"hidden"})}if(t.width()>s.width){var o=s.width,i=s.width/2;e.elementDistance.x>i?e.elementDistance.x=i:o=e.elementDistance.x+s.width/2,n.width=o,t.css({overflow:"hidden"})}(n.height||n.width)&&t.animate(n)}return{elementDistance:e.elementDistance}},dragOver:function(e){e.addClass("dragover"),a=e},dragOut:function(e){a&&e===a&&(a=void 0),e.removeClass("dragover")},tick:function(){u&&(i.$(".droppable").removeClass("drag-over"),t.css({"pointer-events":"none"}),t.trigger("startdrag"),i.$("body").addClass("dragging"),e.$apply(),u=!1)}})}}}),t.dropItem=r.ng.directive("dropItem",["$parse",function(e){return{restrict:"A",link:function(t,n,r){n.addClass("droppable");var i=e(r.dropcondition);n.on("dragover",function(e){(void 0===r.dropcondition||i(t,{$originalEvent:e.originalEvent}))&&(e.preventDefault(),e.stopPropagation(),n.addClass("droptarget"))}),n.on("dragout",function(e){n.removeClass("droptarget")}),n.on("drop",function(e,n){t.$eval(r.dropItem,{$item:n}),t.$apply()})}}}])},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(943),s=n(3),a=n(908);t.dropDown=o.ng.directive("dropDown",["$compile","$timeout",function(e,t){return{restrict:"E",scope:{listId:"=?",options:"=",ngChange:"&",onClose:"&",ngModel:"="},template:'\n\t\t\t<div data-drop-down class="drop-down">\n\t\t\t\t<div role="listbox">\n\t\t\t\t\t<ul class="ten cell right-magnet">\n\t\t\t\t\t\t<li class="block-container" ng-repeat="option in options | limitTo:limit" ng-model="option" ng-class="{alert: option === ngModel}">\n\t\t\t\t\t\t\t<a class="cell right-spacing" ng-class="{\'sharebookmark\': option.type === \'sharebookmark\'}">\n\t\t\t\t\t\t\t\t<i class="add-favorite cell" ng-if="option.type === \'sharebookmark\'"></i>\n\t\t\t\t\t\t\t\t[[option.toString()]]\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t<em ng-if="option.structureName" class="low-importance">[[option.structureName]]</em>\n\t\t\t\t\t\t\t<em class="low-importance">[[translate(option.profile)]] </em>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li class="display-more block-container" ng-show="limit < options.length" ng-click="increaseLimit()">[[translate(\'seemore\')]]</li>\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t',link:function(e,n,o){e.translate=s.idiom.translate,e.limit=6;var u=n.find("[data-drop-down]"),c=n.find("[data-drop-down] ul");c&&e.listId&&c.attr("id",e.listId),e.setDropDownHeight=function(){var t=0,n=Math.min(e.limit,e.options.length);u.find("li").each(function(e,r){return t+=a.$(r).offsetHeight,e<n}),u.height(t)},e.increaseLimit=function(){e.limit+=5,t(function(){e.setDropDownHeight()})},e.positionOptions=function(){if(!e.options||0===e.options.length)return u.height(),u.addClass("hidden"),e.limit=6,void u.attr("style","");u.removeClass("hidden");var t=o.for?a.$("#"+o.for):n.parent(),r=t.offset(),i=t.width()+parseInt(t.css("padding-right"))+parseInt(t.css("padding-left"))+2*parseInt(t.css("border-width")||1),s=t.height()+parseInt(t.css("padding-top"))+parseInt(t.css("padding-bottom"))+2*parseInt(t.css("border-height")||1);r.top=r.top+s,u.offset(r),u.width(i),e.setDropDownHeight(),setTimeout(function(){e.setDropDownHeight()},100)},e.$watchCollection("options",function(t){e.positionOptions()}),u.detach().appendTo("body"),u.on("click","li",function(t){return r(this,void 0,void 0,function(){return i(this,function(n){switch(n.label){case 0:return a.$(t.target).hasClass("display-more")?[2]:(e.limit=6,o.for?u.attr("style",""):e.positionOptions(),e.current=a.$(this).scope().option,e.ngModel=a.$(this).scope().option,e.$apply("ngModel"),[4,e.ngChange()]);case 1:return n.sent(),e.$eval(e.onClose),e.$apply("ngModel"),[2]}})})});var l=function(t){u.find(t.target).length>0||(e.$eval(e.onClose),e.$apply())};a.$("body").on("click",l),u.attr("data-opened-drop-down",!0),n.on("$destroy",function(){a.$("body").unbind("click",l),u.remove()})}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(1);t.dropdownButtons=r.ng.directive("dropdownButtons",function(){return{restrict:"E",link:function(e,t,n){var r=function(){t.offset().left>i.$(window).width()/2?t.addClass("right"):t.removeClass("right"),t.offset().top>i.$(window).height()/2?t.addClass("bottom"):t.removeClass("bottom"),"static"===t.css("position")&&setTimeout(function(){return r()},500)};r(),i.$(window).on("resize",r),t.find("open").on("click",function(){t.hasClass("opened")?t.removeClass("opened"):t.addClass("opened")}),i.$("body").on("click",function(e){e.target===t.children("open")[0]||t.children("open").find(e.target).length>0||t.removeClass("opened")})}}})},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(exports,"__esModule",{value:!0});var ng_start_1=__webpack_require__(943),globals_1=__webpack_require__(38),http_1=__webpack_require__(34),jquery_1=__webpack_require__(1),template_1=__webpack_require__(390),workspace_1=__webpack_require__(391),idiom_1=__webpack_require__(3),modelDefinitions_1=__webpack_require__(37),embedder_1=__webpack_require__(946),me_1=__webpack_require__(937),model_1=__webpack_require__(407),notify_1=__webpack_require__(35),VideoUploadGuardModel=function(){function e(){this.hasUploaded=!1}return e.prototype.guardObjectIsDirty=function(){return this.hasUploaded},e.prototype.guardObjectReset=function(){this.hasUploaded=!1},e}();exports.embedder=ng_start_1.ng.directive("embedder",["$timeout","$filter","VideoUploadService",function($timeout,$filter,VideoUploadService){return{restrict:"E",scope:{delegate:"=",ngModel:"=",ngChange:"&",multiple:"=",fileFormat:"=",show:"=",hiddenShareVideoCode:"=",selectedHeader:"="},require:"?ngModel",templateUrl:"/assets/js/entcore/template/video/main.html",link:function(scope,element,attributes,lnkNgModel){function matchSearch(e){return!(scope.display.search&&scope.display.search.trim().length>0)||-1!==idiom_1.idiom.removeAccents((e||"").toLowerCase()).indexOf(idiom_1.idiom.removeAccents(scope.display.search.toLowerCase()))}function filteredDocuments(e){return e.documents.filter(function(e){var t=scope.delegate&&scope.delegate.filterDocumentRole,n=e.role()===scope.fileFormat||"any"===scope.fileFormat,r=t?scope.delegate.filterDocumentRole(e):n,i=matchSearch(e.metadata.filename),o=matchSearch(e.name);return r&&(i||o)})}function filterFolders(e){return e&&e.folders?e.folders.filter(function(e){return matchSearch(e.name)}):[]}function logVideoEvent_AddToContent(e){if(void 0!==e.metadata.captation){var t=globals_1.devices.getBrowserInfo(),n={videoId:e._id,userId:modelDefinitions_1.model.me.userId,userProfile:modelDefinitions_1.model.me.profiles[0],device:globals_1.deviceType,browser:t.name+" "+t.version,structure:modelDefinitions_1.model.me.structureNames[0],level:modelDefinitions_1.model.me.level,duration:e.metadata.duration,weight:e.metadata.size,url:window.location.hostname,app:globals_1.appPrefix};http_1.http().postJson("/video/event/embed",n).done(function(e){console.log(e)})}}var _this=this;scope.documentList=new model_1.DocumentsListModel($filter,!0),scope.documentList.watch(scope),scope.delegate&&scope.delegate.visit&&scope.delegate.visit(scope),scope.display={search:"",limit:24,provider:{name:"none"},isUploading:!1},scope.upload={documents:[],highlights:[]},scope.providers=[],scope.uploadGuard=new VideoUploadGuardModel;var MAIN_CONTAINER="entcore/video/main",HEADER_INTEGRATION={i18Key:"video.header.integration",template:"entcore/video/integration",visible:function(){return!0},worflowKey:null},hasVideoUpload=!1,HEADER_UPLOAD={i18Key:"video.header.upload",template:"entcore/video/upload",visible:function(){return hasVideoUpload},worflowKey:"video.upload"};me_1.Me.hasWorkflowRight("video.upload").then(function(e){hasVideoUpload=e});var hasVideoCapture=!1,HEADER_RECORD={i18Key:"video.header.record",template:"entcore/video/record",onDisplay:function(){emitDisplayEvent()},visible:function(){return hasVideoCapture},worflowKey:"video.capture"};me_1.Me.hasWorkflowRight("video.capture").then(function(e){hasVideoCapture=e});var HEADER_BROWSE={i18Key:"video.header.browse",template:"entcore/media-library/browse",visible:function(){return hasVideoCapture||hasVideoUpload},worflowKey:null};scope.maxWeight=VideoUploadService.maxWeight,VideoUploadService.initialize().then(function(){scope.maxWeight=VideoUploadService.maxWeight});var emitDisplayEvent=function(){console.log("Broadcast display event displayVideoRecorder..."),scope.$broadcast("displayVideoRecorder",{})};scope.template=template_1.template;var header=HEADER_BROWSE,hack=!0,showTemplate=function(e){return __awaiter(_this,void 0,void 0,function(){var t;return __generator(this,function(n){switch(n.label){case 0:return header=e,[4,template_1.template.open(MAIN_CONTAINER,e.template)];case 1:return n.sent(),e.onDisplay&&setTimeout(function(){e.onDisplay()}),navigator.userAgent.match(/iPhone/i)&&hack&&(hack=!1,t=jquery_1.$("editor").css("display"),jquery_1.$("editor").css("display","none"),setTimeout(function(){hack=!0,jquery_1.$("editor").css("display",t)},500)),[2]}})})};scope.headers=function(){var e=[HEADER_INTEGRATION,HEADER_RECORD,HEADER_UPLOAD,HEADER_BROWSE];return scope.delegate&&scope.delegate.augmentHeaders?scope.delegate.augmentHeaders(e):e},scope.isSelectedHeader=function(e){return header&&e&&header.i18Key==e.i18Key},scope.getClassOf=function(e){return{"beta-feature":e===HEADER_RECORD||e===HEADER_UPLOAD}},scope.$on("video-upload",function(e,t){scope.insertRecord(t)}),scope.title=function(){return scope.delegate&&scope.delegate.title?scope.delegate.title:idiom_1.idiom.translate("editor.option.embed")},window.toBlobPolyfillLoaded||http_1.http().get("/infra/public/js/toBlob-polyfill.js").done(function(response){eval(response.data),window.toBlobPolyfillLoaded=!0}),scope.$watch(function(){return scope.$parent.$eval(attributes.visibility)},function(e){scope.visibility=e,scope.visibility||(scope.visibility="protected"),scope.visibility=scope.visibility.toLowerCase()}),scope.openCompression=function(e){},scope.closeCompression=function(){},element.on("dragenter",function(e){e.preventDefault()}),element.on("dragover",function(e){element.find(".drop-zone").addClass("dragover"),e.preventDefault()}),element.on("dragleave",function(){element.find(".drop-zone").removeClass("dragover")}),element.on("drop",function(e){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(t){return element.find(".drop-zone").removeClass("dragover"),e.preventDefault(),hasVideoUpload&&(showTemplate(HEADER_UPLOAD),cancelAll(),scope.$apply(),scope.importFiles(e.originalEvent.dataTransfer.files)),[2]})})}),scope.$watch("ngModel",function(e){scope.upload.documents=[]}),jquery_1.$("body").on("click",".lightbox-backdrop",function(){scope.upload.documents=[]}),showTemplate(HEADER_INTEGRATION),scope.myDocuments=workspace_1.MediaLibrary.myDocuments,scope.sharedDocuments=workspace_1.MediaLibrary.sharedDocuments;var previousImage=function(){for(var e=scope.upload.documents.indexOf(scope.display.editedDocument)-1,t=e;t>=0;t--)if(scope.upload.documents[t].isEditableImage)return scope.upload.documents[t]},nextImage=function(){for(var e=scope.upload.documents.indexOf(scope.display.editedDocument)+1,t=e;t<scope.upload.documents.length;t++)if(scope.upload.documents[t].isEditableImage)return scope.upload.documents[t]};scope.isEditedFirst=function(){return!previousImage()},scope.isEditedLast=function(){return!nextImage()},scope.nextImage=function(){return scope.display.editedDocument=nextImage()},scope.previousImage=function(){return scope.display.editedDocument=previousImage()};var displayHighLights=function(){setTimeout(function(){scope.upload.highlights.forEach(function(e){element.find("explorer").each(function(t,n){if(-1!==jquery_1.$(n).attr("doc-id").indexOf(e._id)){var r=jquery_1.$('<div class="highlight"></div>'),i=jquery_1.$(n).children(".explorer");i.append(r),i.scope().ngModel=!0,i.scope().$apply()}})}),setTimeout(function(){jquery_1.$(".highlight").addClass("show"),setTimeout(function(){jquery_1.$(".highlight").removeClass("show"),setTimeout(function(){jquery_1.$(".highlight").remove(),scope.upload.highlights=[]},720)},720)},30)},100)};scope.getHeaderByI18NKey=function(e){return scope.headers().find(function(t){return t.i18Key==e})},scope.showHeaderByI18Key=function(e){var t=scope.headers().find(function(t){return t.i18Key==e});t&&scope.showHeader(t)},scope.showHeader=function(e){if(scope.delegate&&scope.delegate.handleShow){if(scope.delegate.handleShow(scope,{cancelAll:cancelAll,displayHighLights:displayHighLights,showTemplate:showTemplate}))return}showTemplate(e),cancelAll(),displayHighLights()},scope.isExternalVisible=function(){return"external"==scope.visibility},scope.isViewMode=function(e){return scope.viewMode==e},scope.changeViewMode=function(e){e&&scope.viewMode!=e&&(template_1.template.open("documents-view","entcore/media-library/"+e),scope.viewMode=e)},scope.changeViewMode("icons"),scope.videoThumbUrl=function(e){var t=e.thumbnails;if(e._id&&"object"==typeof t){var n=Object.getOwnPropertyNames(t);if(n&&n.length>0)return"url('/workspace/document/"+e._id+"?thumbnail="+n[0]+"')"}return null},scope.orderByField=function(e){if(1==scope.isOrderedAsc(e))scope.orderFieldDocument="-"+e;else{if(scope.isOrderedDesc(e))return scope.orderByDefault();scope.orderFieldDocument=e}scope.orderFieldFolder=scope.orderFieldDocument},scope.orderByDefault=function(){scope.orderFieldDocument="-created",scope.orderFieldFolder="name"},scope.orderByDefault(),scope.isOrderedAsc=function(e){return scope.orderFieldDocument==e},scope.isOrderedDesc=function(e){return scope.orderFieldDocument=="-"+e},scope.isListFrom=function(e){return scope.display.listFrom==e},scope.listFrom=function(e){return __awaiter(_this,void 0,void 0,function(){var t;return __generator(this,function(n){switch(n.label){case 0:return scope.display.listFrom=e,t=workspace_1.MediaLibrary[scope.display.listFrom],[4,scope.openFolder(t)];case 1:return n.sent(),[2]}})})};var refresh=function(){scope.documents=filteredDocuments(workspace_1.MediaLibrary[scope.display.listFrom]),scope.folders=filterFolders(scope.openedFolder),scope.$apply()};workspace_1.MediaLibrary.eventer.on("sync",refresh),workspace_1.MediaLibrary.eventer.on("ready",function(){scope.folder=workspace_1.MediaLibrary[scope.display.listFrom],scope.openedFolder=scope.folder,scope.documents=filteredDocuments(workspace_1.MediaLibrary[scope.display.listFrom]),scope.folders=filterFolders(scope.openedFolder),scope.$apply()}),workspace_1.MediaLibrary.sync(),scope.openFolder=function(e){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return scope.openedFolder=e,[4,e.sync()];case 1:return t.sent(),scope.documents=filteredDocuments(e),scope.folders=filterFolders(scope.openedFolder),scope.$apply(),[2]}})})},scope.$watch("visibility",function(e){var t=this;"external"==scope.visibility?scope.listFrom("externalDocuments"):modelDefinitions_1.model.me&&modelDefinitions_1.model.me.workflow.workspace.create?"public"===scope.visibility?scope.listFrom("publicDocuments"):scope.listFrom("appDocuments"):modelDefinitions_1.model.me&&modelDefinitions_1.model.me.workflow.workspace.list&&scope.listFrom("sharedDocuments"),scope.$watch("fileFormat",function(e){return __awaiter(t,void 0,void 0,function(){var t;return __generator(this,function(n){return e?("video"===e?(t=HEADER_INTEGRATION,scope.selectedHeader&&(t=scope.getHeaderByI18NKey(scope.selectedHeader)),showTemplate(t),element.parents("lightbox").on("lightboxvisible",function(){showTemplate(t),scope.safeApply()})):(showTemplate(HEADER_BROWSE),element.parents("lightbox").on("lightboxvisible",function(){showTemplate(HEADER_BROWSE),scope.safeApply()})),0===workspace_1.MediaLibrary[scope.display.listFrom].documents.length&&workspace_1.MediaLibrary[scope.display.listFrom].sync(),[2]):[2]})})})}),scope.insertRecord=function(e){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,workspace_1.MediaLibrary.appDocuments.sync()];case 1:return t.sent(),workspace_1.MediaLibrary.appDocuments.documents.all.forEach(function(t){t.file==e&&scope.upload.documents.push(t)}),scope.listFrom("appDocuments"),scope.upload.documents.forEach(function(e){e.selected=!0}),scope.documents=scope.upload.documents,scope.documents&&scope.selectDocuments(),scope.upload.documents=[],scope.documents=[],scope.$apply(),[2]}})})},scope.selectedDocuments=function(){return scope.documents?scope.documents.filter(function(e){return e.selected}):[]},scope.selectDocument=function(e){scope.documents.forEach(function(e){return e.selected=!1}),e.selected=!0,scope.selectDocuments()},scope.safeApply=function(e){var t=this.$root.$$phase;"$apply"==t||"$digest"==t?e&&"function"==typeof e&&e():this.$apply(e)},scope.selectDocuments=function(){return __awaiter(_this,void 0,void 0,function(){var e,t,n,r;return __generator(this,function(i){switch(i.label){case 0:return e=scope.selectedDocuments(),"external"===scope.visibility||"protected"==scope.openedFolder.filter&&"protected"===scope.visibility||"public"==scope.openedFolder.filter&&"public"===scope.visibility?(scope.multiple?scope.ngModel=embedder_1.embedderService.getHtmlForVideoStreams(e,scope.visibility):scope.ngModel=embedder_1.embedderService.getHtmlForVideoStream(e[0],scope.visibility),[3,9]):[3,1];case 1:t=[],scope.display.loading=e,n=0,i.label=2;case 2:return n<e.length?(r=void 0,"public"!==scope.visibility?[3,4]:[4,e[n].publicDuplicate()]):[3,8];case 3:return r=i.sent(),[3,6];case 4:return[4,e[n].protectedDuplicate()];case 5:r=i.sent(),i.label=6;case 6:t.push(r),i.label=7;case 7:return n++,[3,2];case 8:scope.display.loading=void 0,scope.multiple?scope.ngModel=embedder_1.embedderService.getHtmlForVideoStreams(t,scope.visibility):scope.ngModel=embedder_1.embedderService.getHtmlForVideoStream(t[0],scope.visibility),i.label=9;case 9:return scope.safeApply(),scope.ngModel&&setTimeout(function(){scope.ngChange&&scope.ngChange(),e.forEach(function(e){return logVideoEvent_AddToContent(e)})}),[2]}})})},scope.updateSelection=function(e){scope.multiple||(scope.documents.forEach(function(e){return e.selected=!1}),e.selected=!0)};var cancelAll=function(){scope.display.editedDocument=void 0,scope.display.isUploading=!1,scope.upload.documents.forEach(function(e){cancelDoc(e)}),scope.upload.documents=[],scope.upload.loading=[]},cancelDoc=function(e){return"loaded"===e.uploadStatus?e.delete():(e.uploadStatus,Promise.resolve())};scope.abortOrDelete=function(e){cancelDoc(e);var t=scope.upload.documents.indexOf(e);scope.upload.documents.splice(t,1),scope.upload.documents.length||(scope.display.isUploading=!1,scope.uploadGuard.guardObjectReset(),showTemplate(HEADER_UPLOAD)),e===scope.display.editedDocument&&(scope.display.editedDocument=void 0)},scope.canConfirmImport=function(){return scope.upload.documents.map(function(e){return"loaded"==e.uploadStatus}).reduce(function(e,t){return e&&t},!0)},scope.confirmImport=function(){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return scope.upload.documents.forEach(function(e){e.applyBlob(),e.selected=!0}),[4,scope.listFrom("appDocuments")];case 1:return e.sent(),scope.documents=scope.upload.documents,scope.documents&&scope.selectDocuments(),scope.upload.documents=[],scope.documents=[],scope.$apply(),scope.uploadGuard.guardObjectReset(),notify_1.notify.success("video.file.saved"),[2]}})})},scope.cancelUpload=function(){scope.uploadGuard.guardObjectReset(),showTemplate(HEADER_UPLOAD),cancelAll()},scope.acceptedFileList=function(){return VideoUploadService.getValidExtensions().join(", ")},scope.importFiles=function(e){e||(e=scope.upload.files);for(var t=0;t<e.length;t++){if(Math.round(e[t].size/1048576)>scope.maxWeight)return notify_1.notify.error("video.upload.error.weight"),void(scope.upload.files=void 0);var n=e[t].name.lastIndexOf("."),r=e[t].name.substring(n<0?0:n+1);if(console.debug("File ext="+r),!VideoUploadService.checkValidExtension(r))return notify_1.notify.error("video.upload.error.format"),void(scope.upload.files=void 0)}for(var t=0;t<e.length;t++)!function(){var n=new workspace_1.Document;scope.upload.documents.push(n),n.fromFile(e[t]),n.uploadStatus="loading",scope.uploadGuard.hasUploaded=!0,VideoUploadService.upload(e[t],n.name,!1).then(function(e){if(e.data)if("error"===e.data.state)n.uploadStatus="failed",scope.uploadGuard.guardObjectReset(),notify_1.notify.error(e.data.code?e.data.code:"video.file.error");else{n.uploadStatus="loaded",n._id=e.data.videoworkspaceid,n.metadata&&(n.metadata.size=e.data.videosize);var t=globals_1.devices.getBrowserInfo(),r={videoId:e.data.videoworkspaceid,userId:modelDefinitions_1.model.me.userId,userProfile:modelDefinitions_1.model.me.profiles[0],device:globals_1.deviceType,browser:t.name+" "+t.version,structure:modelDefinitions_1.model.me.structureNames[0],level:modelDefinitions_1.model.me.level,duration:0,weight:e.data.videosize,captation:!1,url:window.location.hostname,app:globals_1.appPrefix};http_1.http().postJson("/video/event/save",r).done(function(e){console.log(e)})}}).catch(function(e){n.uploadStatus="failed",console.warn(e)}).finally(function(){scope.$apply()})}();scope.upload.files=void 0,scope.display.isUploading=!0},scope.updateSearch=function(){scope.documents=filteredDocuments(scope.openedFolder),scope.folders=filterFolders(scope.openedFolder)},scope.editImage=function(){return scope.display.editDocument=!0},scope.$on("$destroy",function(){cancelAll(),workspace_1.MediaLibrary.deselectAll()}),element.on("focus","textarea",function(e){jquery_1.$(e.target).next().addClass("focus"),jquery_1.$(e.target).next().addClass("move"),jquery_1.$(e.target).prev().addClass("focus")}),element.on("blur","textarea",function(e){jquery_1.$(e.target).val()||jquery_1.$(e.target).next().removeClass("move"),jquery_1.$(e.target).next().removeClass("focus"),jquery_1.$(e.target).prev().removeClass("focus")}),scope.$watch("show",function(e){scope.unselectProvider(),e&&showTemplate(HEADER_INTEGRATION)}),http_1.http().get("/infra/embed/default").done(function(e){e.forEach(function(e){scope.providers.push(e)})}),http_1.http().get("/infra/embed/custom").done(function(e){e.forEach(function(e){e.name=e.name.toLowerCase().replace(/\ |\:|\?|#|%|\$|£|\^|\*|€|°|\(|\)|\[|\]|§|'|"|&|ç|ù|`|=|\+|<|@/g,""),scope.providers.push(e)})}),scope.applyHtml=function(){scope.show=!1,lnkNgModel.$setViewValue(scope.display.htmlCode),scope.unselectProvider()},scope.cancel=function(){scope.show=!1,template_1.template.close(MAIN_CONTAINER),scope.unselectProvider(),scope.$broadcast("releaseVideo",{})},scope.unselectProvider=function(){element.find("."+scope.display.provider.name+" .preview").html(""),scope.display.provider={name:"none"},scope.display.url="",scope.display.htmlCode="",scope.display.invalidPath=!1},scope.$watch(function(){return scope.display.htmlCode},function(e){setTimeout(function(){scope.updatePreview()},20)}),scope.$watch(function(){return scope.display.url},function(e){setTimeout(function(){scope.updatePreview()},20)}),scope.updatePreview=function(){if("other"===scope.display.provider.name){return void element.find("."+scope.display.provider.name+" .preview").html(scope.display.htmlCode)}if(scope.display.url){e:for(var e=0,t=scope.display.provider.url;e<t.length;e++)for(var n=t[e],r=new RegExp("{[a-zA-Z0-9_.]+}","g"),i=n.match(r),o=scope.display.provider.embed,s=0,a=i;s<a.length;s++){var u=a[s];scope.display.invalidPath=!1;var c=n.split(u)[0],l=c.split("}");l.length>1&&(c=l[l.length-1]);var d=n.split(u)[1].split("{")[0],h=scope.display.url.split(c)[1];if(!h&&"{ignore}"!==u){scope.display.invalidPath=!0;continue e}d&&(h=h.split(d)[0]);var f=new RegExp("\\"+u.replace(/}/,"\\}"),"g");if(o=o.replace(f,h),scope.display.htmlCode=o,u===i[i.length-1])break e}element.find("."+scope.display.provider.name+" .preview").html(scope.display.htmlCode)}},scope.triggerIpnutFileClick=function(e){e.preventDefault(),e.stopPropagation(),jquery_1.$(".upload-input").trigger("click",[scope.$id])},element.on("click",".upload-input",function(e,t){t!=scope.$id&&e.preventDefault(),e.stopPropagation()})}}}])},function(e,t,n){"use strict";function r(){try{return"ontouchstart"in window||navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0}catch(e){return!1}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(943),o=n(6),s=n(1);t.explorer=i.ng.directive("explorer",function(){return{restrict:"EA",transclude:!0,scope:{ngModel:"=",ngClick:"&",ngChange:"&",onOpen:"&",shouldSelect:"&?"},template:'<div class="explorer" ng-transclude></div>',link:function(e,t,n){function i(t){n.shouldSelect&&!e.shouldSelect({$event:t})||(e.ngModel=!e.ngModel,e.$apply("ngModel"),e.ngClick&&e.ngClick({$event:t}),e.ngChange&&e.ngChange({$event:t}),e.$apply())}function a(n){o.ui.breakpoints.checkMaxWidth("tablette")?(t.off("click dblclick"),o.ui.extendElement.touchEvents(t),t.on("contextmenu",function(e){e.preventDefault()}),t.on("click",function(t,n){i(t),e.$apply("ngModel")}),t.on("doubletap dblclick",function(t){e.ngModel=!1,e.onOpen({$event:t}),e.$apply("ngModel")})):(t.off("click dblclick doubletap contextmenu"),t.on("click",function(t){i(t),e.$apply("ngModel")}),t.on("dblclick",function(t){e.onOpen({$event:t}),e.ngModel=!1,e.$apply("ngModel")}))}r()&&t.bind("touchstart",function(e){var n=e.timeStamp,r=t.data("lastTouch")||n,i=n-r,o=e.originalEvent.touches.length;t.data("lastTouch",n),!i||i>500||o>1||(e.preventDefault(),t.trigger("dblclick"))}),s.$("body").on("click.explorer",function(n){if(0===s.$(n.target).parents("explorer, .explorer, .toggle, .lightbox").length&&!s.$(n.target).is(".lightbox")&&"EXPLORER"!==n.target.nodeName&&(s.$(n.target).parents("body").length||"BODY"===n.target.nodeName)){var r=e.ngModel;e.ngModel=!1,e.$apply("ngModel"),e.ngChange&&1==r&&e.ngChange({$event:n}),e.$apply(),t.removeClass("selected")}}),a(),s.$(window).on("resize",function(){a(!0)}),e.$watch("ngModel",function(e){e?t.addClass("selected"):t.removeClass("selected")}),e.$on("$destroy",function(){s.$("body").off("click.explorer")})}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388);t.filePickerList=r.ng.directive("filePickerList",function(){return{restrict:"E",scope:{files:"=",multiple:"@",hideList:"@?"},template:'\n\t\t\t<div class="file-picker-list" show="display.listFiles">\n\t\t\t\t<div class="row media-library">\n <container template="pick"></container>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t',link:function(e,t,n){r.template.open("pick","entcore/file-picker-list/pick"),e.display||(e.display={}),e.picked={},e.filesArray=[],r.$("body").on("dragenter",".icons-view",function(e){return e.preventDefault()}),r.$("body").on("dragover",".icons-view",function(e){return e.preventDefault()}),t.on("dragenter",function(e){return e.preventDefault()}),t.on("dragover",function(e){t.find(".drop-zone").addClass("dragover"),e.preventDefault()}),t.on("dragleave",function(){t.find(".drop-zone").removeClass("dragover")});var i=function(n){n.originalEvent.dataTransfer.files.length&&(t.find(".drop-zone").removeClass("dragover"),n.preventDefault(),e.listFiles(n.originalEvent.dataTransfer.files),e.hideList||(e.display.listFiles=!0),e.$apply())};e.listFiles=function(t){t||(t=e.picked.files),e.filesArray=Array.from(t),e.files=e.filesArray,e.hideList?e.$apply():r.template.open("pick","entcore/file-picker-list/list")},r.$("body").on("drop",".icons-view",i),t.on("drop",i),e.delete=function(t){e.filesArray=e.filesArray.filter(function(e){return e!=t}),e.filesArray&&0==e.filesArray.length&&r.template.open("pick","entcore/file-picker-list/pick")},e.getIconClass=function(e){return r.Document.role(e)},e.getSizeHumanReadable=function(e){var t=e/1024;return t>1024?parseInt(t/1024*10)/10+" Mo":Math.ceil(t)+" Ko"}}}})},function(e,t,n){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},s=this;Object.defineProperty(t,"__esModule",{value:!0});var a=n(943),u=n(391),c=u.workspace.v2.models,l=n(3),d=u.workspace.v2.service;t.folderPicker=a.ng.directive("folderPicker",["$timeout",function(e){return{restrict:"E",scope:{folderProps:"="},template:'\n <div class="horizontal-spacing-twice">\n <h2 translate content="[[folderProps.i18.title]]"></h2>\n <div ng-if="isStateNormal()">\n <div class="row" ng-if="folderProps.i18.info">\n <div class="info" translate content="[[folderProps.i18.info]]"></div>\n </div>\n <div class="row">\n <div class="search-pagination ">\n <a ng-class="{\'show-close\':canResetSearch()}" ng-show="canResetSearch()" ng-click="resetSearch()"><i class="blue-1d close horizontal-spacing cell-ellipsis"></i></a>\n <input class="twelve" type="text" ng-model="search.value" ng-keyup="searchKeyUp($event)"\n i18n-placeholder="search">\n <i class="search"></i>\n </div>\n </div>\n <div class="row top-spacing-twice">\n <folder-tree tree-props="treeProps"></folder-tree>\n <hr />\n </div>\n <a ng-if="canOpenEditView()" ng-click="openEditView()" class="twelve cell vertical-spacing"><i18n>folderpicker.folder.edit</i18n></a>\n <div class="row vertical-spacing input-block" ng-if="isEditVew()">\n <div class="six flex-row">\n <input type="text" required ng-model="newFolder.name" class="flex-one" />\n <button ng-click="submitNewFolder()" ng-disabled="!newFolder.name" translate content="create" class="left-spacing-twice"></button>\n </div>\n </div>\n <div class="lightbox-buttons fluid">\n <button class="right-magnet" ng-disabled="cannotSubmit()" ng-click="onSubmit()" translate content="[[folderProps.i18.actionTitle]]"></button>\n <button class="cancel right-magnet" ng-click="onCancel()"><i18n>cancel</i18n></button>\n </div>\n </div>\n <div ng-if="isStateLoading()">\n <div class="flex-row vertical-spacing-four">\n <div class="centered vertical-spacing-four">\n <div class="vertical-spacing-four primary-color">\n <h2 translate content="[[folderProps.i18.actionProcessing]]"></h2><i class="loading loadingCopy"></i>\n </div>\n </div>\n </div>\n </div>\n <div ng-if="isStateLoaded()">\n <div class="flex-row vertical-spacing-four">\n <div class="centered vertical-spacing-four">\n <div class="vertical-spacing-four valid-color">\n <h2 translate content="[[folderProps.i18.actionFinished]]" class="valid-color"></h2>\n </div>\n </div>\n </div>\n </div>\n <div ng-if="isStateEmpty()">\n <div class="flex-row vertical-spacing-four">\n <div class="centered vertical-spacing-four">\n <div class="vertical-spacing-four warning-color">\n <h2 translate content="[[folderProps.i18.actionEmpty]]" class="warning-color"></h2>\n </div>\n </div>\n </div>\n </div>\n </div>\n ',link:function(t,n,a){return i(s,void 0,void 0,function(){var n,s,a,h,f,p,m,_,v,y,g,b,w,M,k,L;return o(this,function(x){switch(x.label){case 0:return t.search={value:""},(t.newFolder=c.emptyFolder(),t.safeApply=function(e){var t=this.$root.$$phase;"$apply"==t||"$digest"==t?e&&"function"==typeof e&&e():this.$apply(e)},t.folderProps.treeProvider)?(n=t,[4,t.folderProps.treeProvider()]):[3,2];case 1:return n.trees=x.sent(),[3,4];case 2:return[4,d.fetchTrees({filter:"all",hierarchical:!0})];case 3:for(s=x.sent(),t.trees=[],a=0,h=s;a<h.length;a++)switch(f=h[a],f.filter){case"owner":t.trees[0]=f,f.name=l.idiom.translate("workspace.myDocuments");break;case"shared":t.trees[1]=f,f.name=l.idiom.translate("workspace.sharedDocuments");break;case"protected":t.trees[2]=f,f.name=l.idiom.translate("workspace.appDocuments");break;case"public":t.trees[3]=f,f.name=l.idiom.translate("workspace.publicDocuments")}x.label=4;case 4:return p=function(e){if(e.filter)return"owner"==e.filter;var t=L();return e.canCopyFileIdsInto(t)},m=t.trees=t.trees.filter(function(e){return"owner"==e.filter||"shared"==e.filter}),_=function(e){if(!t.search.value||0==t.search.value.trim().length)return!0;var n=t.search.value.toLowerCase();return(e.name?e.name.toLowerCase():"").startsWith(n)},v=function(e){for(var t=[],n=0,r=e;n<r.length;n++){var i=r[n],o=v(i.children||[]);if(o.length||_(i)){var s=new c.Element;Object.assign(s,i),s.children=o,t.push(s)}}return t},y=function(){if(t.search.value&&t.search.value.trim().length>0){for(var e=[],n=0,i=m;n<i.length;n++){var o=i[n],s=r({},o);s.children=v(o.children),e.push(s)}t.trees=e}else t.trees=m;g=null,t.safeApply()},g=null,b=null,t.treeProps={cssTree:"maxheight-half-vh",get trees(){return t.trees},isDisabled:function(e){return!p(e)},isOpenedFolder:function(e){return b===e||(!(!e.filter||d.isLazyMode())||b&&d.findFolderInTreeByRefOrId(e,b))},isSelectedFolder:function(e){return g===e},openFolder:function(e){b=p(e)?g=e:e}},t.canResetSearch=function(){return t.search.value&&t.search.value.trim().length>0},t.resetSearch=function(){t.search.value="",y()},t.searchKeyUp=function(){y()},w=!1,t.openEditView=function(){t.newFolder=c.emptyFolder(),w=!0},t.canOpenEditView=function(){return!!g&&!w},t.isEditVew=function(){return w},t.submitNewFolder=function(){return i(this,void 0,void 0,function(){var e;return o(this,function(n){switch(n.label){case 0:return[4,d.createFolder(t.newFolder,g)];case 1:return e=n.sent(),w=!1,e instanceof c.Element&&(g.children.push(e),g=t.newFolder),t.newFolder=c.emptyFolder(),t.safeApply(),[2]}})})},M="normal",t.isStateNormal=function(){return"normal"==M},t.isStateLoading=function(){return"loading"==M},t.isStateLoaded=function(){return"loaded"==M},t.isStateEmpty=function(){return"empty"==M},k=function(e){M=e,t.safeApply()},t.onCancel=function(){t.folderProps.onCancel(),k("normal")},t.cannotSubmit=function(){return!g},L=function(){var e=t.folderProps.sources.filter(function(e){return"copy-from-file"==e.action}),n=t.folderProps.sources.filter(function(e){return"move-from-file"==e.action}),r=e.map(function(e){return e.fileId}),i=n.map(function(e){return e.fileId});return r.concat(i)},t.onSubmit=function(){return i(this,void 0,void 0,function(){var n,r,i,s,a,c,l,c,h,f,p;return o(this,function(o){switch(o.label){case 0:if(t.folderProps.manageSubmit&&t.folderProps.manageSubmit(g)&&t.folderProps.submit)return t.folderProps.submit(g),[2];o.label=1;case 1:return o.trys.push([1,8,,9]),(k("loading"),n=t.folderProps.sources.length,r=t.folderProps.sources.filter(function(e){return"copy-from-file"==e.action}),i=t.folderProps.sources.filter(function(e){return"move-from-file"==e.action}),s=t.folderProps.sources.filter(function(e){return"create-from-blob"==e.action}),a="loaded",r.length)?(c=r.map(function(e){return e.fileId}),[4,d.copyAllFromIds(c,g)]):[3,3];case 2:l=o.sent(),0==l.copies.length&&(t.folderProps.i18.actionEmpty=t.folderProps.i18.actionEmpty||"folderpicker.copy.empty.text",a="empty"),o.label=3;case 3:return i.length?(c=i.map(function(e){return e.fileId}),[4,d.moveAllFromIds(c,g)]):[3,5];case 4:o.sent(),o.label=5;case 5:return s.length?(h=s.map(function(e){var t=new u.Document;return e.title&&(t.name=e.title),d.createDocument(e.content,t,g)}),[4,Promise.all(h)]):[3,7];case 6:o.sent(),o.label=7;case 7:return k(a),e(function(){k("normal"),t.folderProps.onSubmitSuccess(g,n)},1e3),[3,9];case 8:return f=o.sent(),console.error(f),p=f.responseJSON,t.folderProps.onError&&t.folderProps.onError(p),[3,9];case 9:return[2]}})})},t.safeApply(),[2]}})})}}}])},function(e,t,n){"use strict";function r(e,t,n){angular.isFunction(n)&&(n={post:n});var r,i=t.contents().remove();return{pre:n&&n.pre?n.pre:null,post:function(t,o){r||(r=e(i)),r(t,function(e){o.append(e)}),n&&n.post&&n.post.apply(null,arguments)}}}var i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},s=this;Object.defineProperty(t,"__esModule",{value:!0});var a=n(943),u=n(391),c=u.workspace.v2.models,l=n(550);t.folderTreeInner=a.ng.directive("folderTreeInner",["$compile",function(e){return{restrict:"E",scope:{treeProps:"=",folder:"="},template:' \n <a ng-class="{ selected: isSelectedFolder(), opened: isOpenedFolder(),\'disabled-color\':isDisabled() }" ng-click="openFolder()" ng-if="folder.name !== undefined"\n class="folder-list-item">\n <i class="arrow" ng-if="canExpendTree()" ng-class="{\'disabled-color\':isDisabled() }"></i> [[translate()]] <i class="loading" ng-if="folder.isChildrenLoading"></i>\n </a>\n <ul data-ng-class="{ selected: isOpenedFolder(), closed: !isOpenedFolder() }" ng-if="isOpenedFolder()">\n <li data-ng-repeat="child in folder.children">\n <folder-tree-inner folder="child" tree-props="treeProps"></folder-tree-inner>\n </li>\n </ul>',compile:function(t){return r(e,t,function(e){e.safeApply=function(e){var t=this.$root.$$phase;"$apply"==t||"$digest"==t?e&&"function"==typeof e&&e():this.$apply(e)},e.canExpendTree=function(){return l.workspaceService.isLazyMode()?e.folder.children.length>0||e.folder.cacheChildren.isEmpty:e.folder.children.length>0},e.isSelectedFolder=function(){return e.treeProps.isSelectedFolder(e.folder)},e.isOpenedFolder=function(){return e.treeProps.isOpenedFolder(e.folder)},e.openFolder=function(){return i(this,void 0,void 0,function(){var t,n;return o(this,function(r){switch(r.label){case 0:return l.workspaceService.isLazyMode()?e.folder instanceof c.ElementTree?(t=e.folder,[4,l.workspaceService.fetchChildrenForRoot(t,{filter:t.filter,hierarchical:!1},null,{onlyFolders:!0})]):[3,2]:[3,4];case 1:return r.sent(),[3,4];case 2:return[4,l.workspaceService.fetchChildren(e.folder,{filter:"all",hierarchical:!1},null,{onlyFolders:!0})];case 3:r.sent(),r.label=4;case 4:return n=e.treeProps.openFolder(e.folder),e.safeApply(),[2,n]}})})},e.translate=function(){return e.folder.name},e.isDisabled=function(){return e.treeProps.isDisabled(e.folder)}})}}}]),t.folderTree=a.ng.directive("folderTree",["$templateCache",function(e){return{restrict:"E",scope:{treeProps:"="},template:'\n <nav class="vertical mobile-navigation" ng-class="treeProps.cssTree">\n <ul>\n <li data-ng-repeat="folder in trees()">\n <folder-tree-inner folder="folder" tree-props="treeProps"></folder-tree-inner>\n </li>\n </ul> \n </nav>\n ',link:function(e,t,n){return i(s,void 0,void 0,function(){return o(this,function(t){return e.trees=function(){return e.treeProps?e.treeProps.trees:[]},[2]})})}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388);t.foldingList=r.ng.directive("foldingList",function(){return{restrict:"E",template:function(e,t){for(var n="",r=e.children(),i=0,o=r.length;i<o;i++)n+=r[i].outerHTML;return'\n <span ng-repeat="content in (contents = (filtered = (ngModel | filter: filter)) | limitTo: localLimit)">'+n+'</span>\n <label ng-if="filtered.length > limit && opened" class="chip selected no-margin initial-line-height" ng-click="close()">\n <span class="cell"><i18n>portal.refold</i18n><i class="up-open left-spacing"></i></span>\n </label>\n <label ng-if="filtered.length > limit && !opened" class="chip selected no-margin initial-line-height" ng-click="open()">\n <span class="cell">... <i18n>chip.more1</i18n> [[filtered.length - limit]] <i18n>chip.more2</i18n><i class="down-open left-spacing"></i></span>\n </label>\n '},scope:{ngModel:"=",limit:"=",filter:"&"},link:function(e,t,n){e.opened=!1,e.localLimit=e.limit,e.open=function(){e.localLimit=e.ngModel.length,e.opened=!0},e.close=function(){e.localLimit=e.limit,e.opened=!1}}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388);t.groupsUsersSelector=r.ng.directive("groupsUsersSelector",function(){return{restrict:"E",template:'\n <div class="flex-row align-start vertical-spacing-twice">\n <div class="cell six horizontal-spacing">\n <h4><i18n>portal.group.added</i18n></h4>\n <div style="overflow-y: auto; max-height: 210px;">\n <contact-chip class="block relative removable" ng-class="{selected: group.selected}"\n ng-model="group"\n action="selectGroupItem(item)"\n action-icon="removeItem(item)"\n ng-repeat="group in groupsList"\n isgroup stickernotselected isnotlinked>\n </contact-chip>\n <div class="small-text" ng-if="groupsList.length === 0 && !selector.loading">\n <i18n>portal.group.none.added</i18n>\n </div>\n </div>\n <div class="row centered-text reduce-block-six" ng-if="selector.loading">\n <img skin-src="/img/illustrations/loading.gif" width="30px" heigh="30px"/>\n </div>\n </div>\n <div class="cell six horizontal-spacing">\n <h4><i18n>portal.user.added</i18n></h4>\n <div class="small-text row" ng-if="usersList.length > 0">\n <input type="text" class="six cell" autocomplete="off" ng-model="selector.search" i18n-placeholder="portal.search" /><span class="one cell">&nbsp;</span><label>[[getTotalUser().ok]] <i18n>portal.users</i18n></label>\n </div>\n <div id="userScroll" style="overflow-y: auto; max-height: 170px;">\n <contact-chip id=\'user-[[id(user)]]\' class="block relative removable" ng-class="{selected: user.selected}"\n ng-if="!user.exclude"\n ng-model="user"\n action="removeItem(item)"\n ng-repeat="user in usersList | filter:filterAllUser()"\n stickernotselected>\n </contact-chip>\n <div class="small-text" ng-if="usersList.length === 0 && !selector.loading">\n <i18n>portal.user.none.added</i18n>\n </div>\n </div>\n <div class="row centered-text reduce-block-six" ng-if="selector.loading">\n <img skin-src="/img/illustrations/loading.gif" width="30px" heigh="30px"/>\n </div>\n </div>\n </div>\n ',scope:{groupsList:"=",usersList:"=",selector:"="},link:function(e,t,n){function i(t){r._.forEach(e.groupsList,function(n){t&&e.id(t)===e.id(n)||(n.selected=!1)}),r._.forEach(e.usersList,function(e){e.selected=!1})}e.id=function(e){return e.id?e.id:e._id},e.selectGroupItem=function(t){i(t),t.selected=!t.selected,e.selector.selectedGroup=t.selected,r._.forEach(e.usersList,function(n){n.groupId===e.id(t)&&(n.selected=t.selected)})},e.removeItem=function(t){var n="group"==t.groupOrUser?e.groupsList:e.usersList;if("group"===t.groupOrUser)e.usersList=r._.reject(e.usersList,function(n){return n&&n.groupId&&e.id(t)===n.groupId});else{if(t.groupId){t.exclude=!0;var i=!0;r._.forEach(e.usersList,function(e){if(t.groupId===e.groupId&&!e.exclude)return i=!1,!1}),i?(e.groupsList=r._.reject(e.groupsList,function(n){return n&&t.groupId===e.id(n)}),e.usersList=r._.reject(e.usersList,function(e){return e&&e.groupId&&t.groupId===e.groupId})):e.selector.selectedGroup=!0,e.usersList=r._.reject(e.usersList,function(e){return e&&!e.exclude&&t.name===e.name})}r._.forEach(e.usersList,function(e){e&&e.groupId&&t.name===e.name&&(e.exclude=!0)})}if(!t.exclude){var o=n.indexOf(t);-1!==o&&n.splice(o,1)}},e.getTotalUser=function(){return e.usersList&&e.usersList.length>0?r._.countBy(e.usersList,function(e){return e&&!0===e.exclude?"exclude":"ok"}):{ok:0}},e.filterAllUser=function(){return function(t){var n=r.idiom.removeAccents(e.selector.search).toLowerCase();return!n||-1!==r.idiom.removeAccents(t.name).toLowerCase().indexOf(n)}}}}})},function(e,t,n){"use strict";function r(e,t,n){var r=null,o=null,s=null,a=null;switch(e){case"left":s=t.left-25,o=t.top;break;case"right":r=t.right+25,o=t.top;break;case"top":r=t.left,a=t.top-25;break;case"bottom":r=t.left,o=t.bottom+25}var u=function(e){return null!=e&&e+"px"};return o=i(o,n),{position:"fixed",top:u(o),left:u(r),bottom:u(a),right:u(s)}}function i(e,t){if(e<0)return 0;var n=jQuery(window).height(),r=n-(e+t);return r<0?e+r:e}function o(e,t){var n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return{}.bottom=n.bottom-r.bottom,n.top<r.top?n.top-r.top:n.bottom>r.bottom?n.bottom-r.bottom:0}function s(e,t,n){var r=window.getComputedStyle?window.getComputedStyle(e):{};if(t.setAttribute("style",r.cssText),n)for(var i=jQuery(e).find("*"),o=jQuery(t).find("*"),s=i.length;s--;){var a=i[s],u=o[s],c=window.getComputedStyle?window.getComputedStyle(a):{};jQuery(u).removeClass(),u.setAttribute("style",c.cssText)}}function a(e,t){var n=jQuery(e);return"vertical"==t?e.scrollHeight>n.innerHeight():"horizontal"==t&&e.scrollWidth>n.innerWidth()}function u(e){for(var t=jQuery(e),n=t.parents(),r=0;r<n.length;r++){var i=n[r];if(a(i,"vertical")){var s=o(e,i);if(0!=s){var u=jQuery(i),c=u.scrollTop()+s;u.animate({scrollTop:c},{duration:"medium",easing:"swing"})}}}}Object.defineProperty(t,"__esModule",{value:!0});var c=n(388),l=n(551),d=null,h={steps:[],onAdd:new l.Subject,onCurrentChange:new l.Subject,setCurrentStep:function(e){d=e,h.onCurrentChange.next()},getCurrentStep:function(){return d},isCurrentContent:function(e){return h.hasCurrentStep()&&d.content==e},hasCurrentStep:function(){return!!d},addStep:function(e){var t=h.steps.find(function(t){return t.content==e.content});t?Object.assign(t,e):(h.steps.push(e),h.steps=h.steps.sort(function(e,t){return e.priority-t.priority}),h.onAdd.next())},getNextStep:function(e){var t=h.steps.findIndex(function(t){return t===e});return h.steps[t+1]},hasNextStep:function(e){return!!h.getNextStep(e)},hightlight:function(e){for(var t=0,n=h.steps;t<n.length;t++){var r=n[t];r===d?r.highlight(e):r.unhighlight()}}};t.helpBox=c.ng.directive("helpBox",["$timeout","$sce",function(e,t){return{restrict:"E",scope:{onFinished:"&",canClose:"@",display:"@",title:"@",direction:"@"},template:' \n <section class="helpbox-highlight-message" ng-if="visible()">\n <div style="display:none" class="content no-margin message-box block-container four minwidth-400">\n <div class="twelve cell">\n <div class="reduce-block-eight">\n <div class="block-container flex-row center-component ">\n <h3 class="eleven left-text">\n <span class="no-style">[[getTitle()]]</span>\n </h3>\n <p class="eleven justified-text">\n <span class="no-style" ng-bind-html="getContent()"></span>\n </p>\n </div>\n <div class="flex-row align-center">\n <nav class="dots flex-all-remains align-center">\n <ul>\n <li ng-repeat="step in steps" class="dot active" ng-click="goTo(step)" ng-class="{ active: isCurrentStep(step) }"></li>\n </ul>\n </nav>\n <div class="right-magnet align-center">\n <button class="right-magnet no-margin-bottom" ng-click="next()" ng-if="hasNextStep()">\n <span class="no-style"><i18n>helpbox.next</i18n></span>\n </button>\n <button class="right-magnet no-margin-bottom" ng-click="close()" ng-if="!hasNextStep()">\n <span class="no-style"><i18n>helpbox.finish</i18n></span>\n </button>\n </div>\n </div>\n </div>\n </div>\n <div class="close-lightbox" ng-if="!hasNextStep()" ng-click="close()"><i class="close-2x"></i></div></div>\n </section>\n ',compile:function(n,i){return{pre:function(n,i,o,s,a){var u=!1,l=function(){return!0===n.display||"true"===n.display};n.start=function(){!u&&l()&&h.steps.length&&(u=!0,n.goTo(h.steps[0]))},n.close=function(){n.display=!1,h.setCurrentStep(null),h.hightlight(function(){}),n.onFinished&&n.onFinished(),u=!1};var d=!0;n.goTo=function(e){h.setCurrentStep(e),h.hightlight(function(){var e=h.getCurrentStep().getHtml(),t=e.getBoundingClientRect(),o=n.direction||"right",s=i.find(".content"),a=s.height(),u=r(o,t,a);s.css(u),d&&(s.css({display:"block"}),d=!1)}),h.hasCurrentStep()&&(h.getCurrentStep().title=h.getCurrentStep().title||c.idiom.translate(n.title))},h.onAdd.debounceTime(600).subscribe(function(t){e(function(){n.start()})}),h.onAdd.next(),n.$watch("display",function(){h.onAdd.next()}),n.getTitle=function(){return h.hasCurrentStep()&&h.getCurrentStep().title},n.getContent=function(){var e=h.hasCurrentStep()&&h.getCurrentStep().content;return t.trustAsHtml(e)},n.hasNextStep=function(){return h.hasNextStep(h.getCurrentStep())},n.next=function(){var e=h.getNextStep(h.getCurrentStep());n.goTo(e)},n.isCurrentStep=function(e){return h.getCurrentStep()===e},n.visible=function(){return l()&&!!h.getCurrentStep()}},post:function(e,t,n,r,i){}}}}}]),t.helpBoxStep=c.ng.directive("helpBoxStep",["$timeout",function(e){return{restrict:"A",scope:{helpBoxStepTitle:"@",helpBoxStepPriority:"@",helpBoxStep:"@"},link:function(e,t,n){t.removeClass("helpbox-highlight");var r=null;e.helpBoxStep&&h.addStep({content:c.idiom.translate(e.helpBoxStep),title:e.helpBoxStepTitle?c.idiom.translate(e.helpBoxStepTitle):null,priority:e.helpBoxStepPriority||0,getHtml:function(){return t[0]},highlight:function(e){var n=this;r&&jQuery(r).remove();var i=t[0];u(i),setTimeout(function(){r=jQuery(i).clone(),jQuery("body").append(r),r.removeClass(),r.addClass("helpbox-highlight"),s(i,r[0],!0);var t=function(){var t=i.getBoundingClientRect();r.css({position:"fixed",top:t.top,left:t.left,width:t.width,height:t.height,margin:0}),e()};n.reposition=t,jQuery(window).scroll(n.reposition),jQuery(window).on("resize",n.reposition),t()},300)},unhighlight:function(){r&&jQuery(r).remove(),jQuery(window).off("scroll",this.reposition),jQuery(window).off("resize",this.reposition)}})}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943);t.imageCompression=r.ng.directive("imageCompression",function(){return{restrict:"E",templateUrl:"/assets/js/entcore/template/compression.html",scope:{document:"="},link:function(e,t,n){var r=document.createElement("canvas"),i=t.find("canvas")[0];i.height=280,i.width=468;var o,s=t.find("canvas")[0].getContext("2d"),a=r.getContext("2d"),u=new Image,c=(new Image,new Image),l=function(e){s.clearRect(0,0,i.width,i.height);var t=0,n=0,r=e.width,o=1;e.width>468&&(r=468,o=r/e.width),t=140-e.height/2*o,e.width<468&&(n=234-e.width/2*o),s.drawImage(e,n,t,r,r*e.height/e.width)},d=function(t){u.naturalWidth&&(t<0&&(t=.001,e.document.currentQuality=.001),l(u),i.toBlob(function(e){console.log(i.width),o=e;var t=URL.createObjectURL(o);c.onload=function(){return l(c)},c.src=t},"image/jpeg",e.document.currentQuality),r.width=u.width,r.height=u.height,a.drawImage(u,0,0),r.toBlob(function(t){(e.document.hiddenBlob||1!==e.document.currentQuality)&&t.size<=e.document.metadata.size?e.document.hiddenBlob=t:e.document.hiddenBlob=void 0,e.$apply()},"image/jpeg",e.document.currentQuality))},h=function(){e.document.currentQuality||(e.document.currentQuality=1),u.src="/workspace/document/"+e.document._id+"?v="+parseInt(100*Math.random()),u.onload=function(){l(u),d(e.document.currentQuality)}};e.document&&h();var f="Ko";e.blobSize=function(){if(!e.document.hiddenBlob)return f=e.document.size.split(" ")[1],parseInt(e.document.size);f="Ko";var t=e.document.hiddenBlob.size/1024,n=t/1024;return n>=1?(f="Mo",Math.round(10*n)/10):Math.round(t)},e.blobUnit=function(){return f},e.$watch(function(){return e.document.currentQuality},function(){return d(e.document.currentQuality)}),e.$watch("document",function(){return h()}),e.document.eventer.on("save",function(){return h()})}}})},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},o=this;Object.defineProperty(t,"__esModule",{value:!0});var s=n(943),a=n(38),u=n(988),c=n(390),l=n(994);t.imageEditor=s.ng.directive("imageEditor",function(){return{restrict:"E",scope:{document:"=",onSave:"&",show:"=",inline:"@"},template:'\n <div ng-if="show && inline && ready">\n <i ng-if="display.isImageLoading" class="loading image-loading"></i>\n <container template="entcore/image-editor/main" guard-ignore-template></container>\n </div>\n <div ng-if="show && !inline && ready">\n <lightbox show="show" on-close="hide()">\n <i ng-if="display.isImageLoading" class="loading image-loading"></i>\n <container template="entcore/image-editor/main" guard-ignore-template></container>\n </lightbox>\n </div>\n ',link:function(e,t,n){e.display||(e.display={}),void 0!==n.inline&&(n.inline=!0),a.devices.isIE()&&0===t.find("style").length&&t.append("<style>image-editor .output { display: block }</style>"),e.template=c.template,c.template.open("entcore/image-editor/main");var s=new u.ImageEditor,d=function(){return r(o,void 0,void 0,function(){var n=this;return i(this,function(o){return e.ready=!0,e.display.isImageLoading=!0,setTimeout(function(){return r(n,void 0,void 0,function(){return i(this,function(n){switch(n.label){case 0:return[4,u.ImageEditor.init()];case 1:return n.sent(),s.draw(t.find("section").last()),[4,s.drawDocument(e.document)];case 2:return n.sent(),e.openTool("Rotate"),e.display.isImageLoading=!1,s.imageView.backup(),e.$apply(),[2]}})})},300),[2]})})};e.scale=function(){return s.tool?Math.ceil(1/s.tool.scale*10)/10:1},e.setWidth=function(){s.tool instanceof l.Resize&&s.tool.setWidth(e.document.width)},e.setHeight=function(){s.tool instanceof l.Resize&&s.tool.setHeight(e.document.height)},e.openTool=function(n){return r(o,void 0,void 0,function(){return i(this,function(r){switch(r.label){case 0:return c.template.open("entcore/image-editor/tool","entcore/image-editor/"+n.toLowerCase()),t.find(".output, .tools-background").show(),[4,s.useTool(n)];case 1:return r.sent(),e.$apply(),[2]}})})},e.openProperties=function(){return r(o,void 0,void 0,function(){return i(this,function(e){return s.tool.stop(),s.tool=void 0,c.template.open("entcore/image-editor/tool","entcore/image-editor/properties"),t.find(".output, .tools-background").hide(),[2]})})},e.apply=function(){return r(o,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,s.applyChanges()];case 1:return t.sent(),e.$apply(),[2]}})})},e.restoreOriginal=function(){return r(o,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,s.restoreOriginal()];case 1:return t.sent(),e.$apply(),[2]}})})},e.hasHistory=function(){return s.hasHistory},e.canApply=function(){return s.canApply},e.undo=function(){return r(o,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,s.undo()];case 1:return t.sent(),e.$apply(),[2]}})})},e.cancel=function(){return r(o,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,s.cancel(!0)];case 1:return t.sent(),e.$apply(),[2]}})})},e.save=function(){return r(o,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return e.loading=!0,s.canApply?[4,s.applyChanges()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[4,s.saveChanges()];case 3:return t.sent(),"function"==typeof e.onSave&&(e.onSave(),e.loading=!1),e.show=!1,e.loading=!1,e.$apply(),[2]}})})},e.hide=function(){e.document.resetNewProperties(),e.show=!1,e.$$phase||e.$parent.$apply()},e.$watch(function(){return e.show},function(){e.show&&d()}),e.$on("destroy",function(){return s.destroy()})}}})},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(exports,"__esModule",{value:!0});var axios_1=__webpack_require__(7),entcore_toolkit_1=__webpack_require__(393),ImageView_1=__webpack_require__(989),imageTools=__webpack_require__(991),jquery_1=__webpack_require__(1),eventer=new entcore_toolkit_1.Eventer,editorWidth=680,editorHeight=400,ImageEditor=function(){function ImageEditor(){this.imageView=new ImageView_1.ImageView}return ImageEditor.prototype.destroy=function(){this.imageView.renderer.destroy()},ImageEditor.prototype.cancel=function(e){return void 0===e&&(e=!1),__awaiter(this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return jquery_1.$(this.imageView.renderer.view).css({opacity:0}),this.imageView.appliedIndex||this.imageView.pendingChanges?(this.document.hiddenBlob=this.imageView.history[this.imageView.appliedIndex],[4,this.imageView.loadBlob(this.imageView.history[this.imageView.appliedIndex])]):[3,2];case 1:t.sent(),t.label=2;case 2:return e||this.imageView.resetHistory(),[4,this.imageView.backup()];case 3:return t.sent(),e?this.imageView.historyIndex=this.imageView.appliedIndex:(this.imageView.historyIndex=0,this.imageView.appliedIndex=0),jquery_1.$(this.imageView.renderer.view).css({opacity:1}),[2]}})})},ImageEditor.prototype.useTool=function(e,t){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(n){switch(n.label){case 0:return this.tool&&this.tool.stop(),this.imageView.historyIndex>0?[4,this.cancel()]:[3,2];case 1:return n.sent(),[3,3];case 2:this.imageView.historyIndex=0,this.imageView.appliedIndex=0,n.label=3;case 3:return this.renderer&&this.renderer.destroy(),"Blur"!==e?this.drawCanvas():this.drawGl(),t=new imageTools[e],this.imageView.setStage(),this.tool=t,t.start(this.imageView,this.editingElement),[2]}})})},ImageEditor.prototype.applyChanges=function(e){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return this.tool?[4,this.tool.apply(e)]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.imageView.appliedIndex=this.imageView.historyIndex,this.imageView.pendingChanges=!1,[2]}})})},ImageEditor.prototype.saveChanges=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return this.imageView.history.length&&(this.document.hiddenBlob=this.imageView.history[this.imageView.appliedIndex]),[4,this.document.saveChanges()];case 1:return e.sent(),[2]}})})},Object.defineProperty(ImageEditor.prototype,"hasHistory",{get:function(){return this.imageView.hasHistory},enumerable:!0,configurable:!0}),Object.defineProperty(ImageEditor.prototype,"canApply",{get:function(){return this.imageView.pendingChanges},enumerable:!0,configurable:!0}),ImageEditor.init=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,new Promise(function(resolve,reject){return ImageEditor.loaded?void resolve():ImageEditor.loading?void eventer.on("loaded",function(){return resolve()}):(ImageEditor.loading=!0,window.toBlobPolyfillLoaded||axios_1.default.get("/infra/public/js/toBlob-polyfill.js").then(function(response){eval(response.data),window.toBlobPolyfillLoaded=!0}),void axios_1.default.get("/infra/public/js/pixi.min.js").then(function(response){eval(response.data),ImageEditor.loaded=!0,ImageEditor.loading=!1,resolve(),eventer.trigger("loaded")}))})]})})},ImageEditor.prototype.drawGl=function(){this.editingElement.find("canvas").remove(),this.renderer=PIXI.autoDetectRenderer(editorWidth,editorHeight,{preserveDrawingBuffer:!0,transparent:!0}),this.imageView.renderer=this.renderer,this.editingElement.find(".output").append(this.renderer.view),this.imageView.setStage()},ImageEditor.prototype.drawCanvas=function(){this.editingElement.find("canvas").remove(),this.renderer=new PIXI.CanvasRenderer(editorWidth,editorHeight,{preserveDrawingBuffer:!0,transparent:!0}),this.imageView.renderer=this.renderer,this.editingElement.find(".output").append(this.renderer.view),this.imageView.setStage()},ImageEditor.prototype.draw=function(e){this.editingElement=e},ImageEditor.prototype.drawDocument=function(e){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(n){switch(n.label){case 0:return e.hiddenBlob?(t=URL.createObjectURL(e.hiddenBlob),[4,this.imageView.load(t,this.editingElement,e.metadata["content-type"])]):[3,2];case 1:return n.sent(),[3,4];case 2:return[4,this.imageView.load("/workspace/document/"+e._id+"?v="+parseInt(100*Math.random()),this.editingElement,e.metadata["content-type"])];case 3:n.sent(),n.label=4;case 4:return this.document=e,[2]}})})},ImageEditor.prototype.restoreOriginal=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return this.imageView.resetHistory(),[4,this.imageView.loadBlob(this.imageView.originalImage)];case 1:return e.sent(),this.document.hiddenBlob=this.imageView.originalImage,this.tool.placeTools(),[2]}})})},ImageEditor.prototype.undo=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return[4,this.imageView.undo()];case 1:return e.sent(),this.tool.placeTools(),[2]}})})},ImageEditor}();exports.ImageEditor=ImageEditor},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(393),s=n(990),a=function(){function e(){this.history=[],this.eventer=new o.Eventer}return e.prototype.paint=function(e){var t=this;return new Promise(function(n,o){t.stage=new PIXI.Container,t.sprite=new PIXI.Sprite(PIXI.loader.resources[e].texture),t.stage.addChild(t.sprite),setTimeout(function(){return r(t,void 0,void 0,function(){var e=this;return i(this,function(t){return this.sprite.pivot.set(this.sprite.width/2,this.sprite.height/2),this.sprite.position={x:this.sprite.width/2,y:this.sprite.height/2},this.historyIndex=0,requestAnimationFrame(function(){return e.editingElement.find(".tools-background").height(e.editingElement.find(".output").height())}),n(),[2]})})},100)})},e.prototype.render=function(){this.renderer.render(this.stage)},e.prototype.resetHistory=function(){this.appliedIndex=0,this.historyIndex=0,this.history=[],this.pendingChanges=!1},Object.defineProperty(e.prototype,"hasHistory",{get:function(){return this.appliedIndex>0||this.pendingChanges&&this.historyIndex>0},enumerable:!0,configurable:!0}),e.prototype.loadImage=function(e,t){var n=this;return void 0===t&&(t=!0),new Promise(function(r,i){if(n.stage.removeChildren(),n.sprite=new PIXI.Sprite(PIXI.Texture.from(e)),n.stage.addChild(n.sprite),n.renderer.render(n.stage),!t)return void r();setTimeout(function(){n.sprite.pivot.set(n.sprite.width/2,n.sprite.height/2),s.$(n.renderer).attr("data-locked-size")||n.renderer.resize(n.sprite.width,n.sprite.height),n.sprite.position={x:n.sprite.width/2,y:n.sprite.height/2},n.render(),n.eventer.trigger("image-loaded"),r()},100)})},e.prototype.setOverlay=function(){this.editingElement.find(".overlay").width(s.$(this.editingElement.find(".output")).width()),this.editingElement.find(".overlay").height(s.$(this.editingElement.find(".output")).height())},e.prototype.load=function(e,t,n){var r=this;return this.format=n,new Promise(function(n,i){r.editingElement=t;var o=function(){r.paint(e).then(function(){return n()}),r.eventer.trigger("loaded-"+e)};if(PIXI.loader.resources[e])return PIXI.loader.resources[e].isLoading?void r.eventer.once("loaded-"+e,o):void o();var s={loadType:PIXI.loaders.Resource.LOAD_TYPE.IMAGE,xhrType:PIXI.loaders.Resource.XHR_RESPONSE_TYPE.BLOB};PIXI.loader.add(e,e,s).load(o)})},e.prototype.loadBlob=function(e,t){var n=this;return void 0===t&&(t=!0),new Promise(function(r,i){var o=URL.createObjectURL(e),s=new Image;s.src=o,s.onload=function(){n.loadImage(s,t).then(function(){return r()})}})},e.prototype.setStage=function(){this.renderer.render(this.stage),this.renderer.resize(this.sprite.width,this.sprite.height),this.renderer.render(this.stage)},e.prototype.undo=function(){var e=this;return s.$(this.renderer.view).css({opacity:0}),new Promise(function(t,n){setTimeout(function(){return r(e,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return this.historyIndex--,this.appliedIndex>this.historyIndex&&(this.appliedIndex=this.historyIndex),[4,this.loadBlob(this.history[this.historyIndex])];case 1:return e.sent(),s.$(this.renderer.view).css({opacity:1}),t(),[2]}})})},150)})},e.prototype.backup=function(e,t){var n=this;return void 0===e&&(e=!0),void 0===t&&(t=!0),new Promise(function(t,r){n.renderer.view.toBlob(function(r){n.render(),n.historyIndex++,angular.element(n.editingElement).scope().$apply(),n.history.splice(n.historyIndex),n.history.push(r),n.historyIndex>n.history.length-1&&(n.historyIndex=n.history.length-1),n.originalImage||(n.originalImage=r),n.loadBlob(r,e).then(function(){t()})},n.format)})},e}();t.ImageView=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),window.CDN_DOMAIN="",function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(388))},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(992)),r(n(993)),r(n(994)),r(n(995))},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(990),s=function(){function e(){this.mouse={x:0,y:0}}return e.prototype.drawBrush=function(){var e=new PIXI.Graphics;return e.beginFill(16777215,1),e.drawCircle(20*this.widthRatio,20*this.heightRatio,20*this.heightRatio),e.lineStyle(0),e.endFill(),e},Object.defineProperty(e.prototype,"outputLeft",{get:function(){return parseInt(o.$(this.imageView.renderer.view).offset().left)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputTop",{get:function(){return parseInt(o.$(this.imageView.renderer.view).offset().top)},enumerable:!0,configurable:!0}),e.prototype.apply=function(e){return r(this,void 0,void 0,function(){return i(this,function(e){return[2]})})},e.prototype.blurAt=function(){var e=PIXI.Texture.fromImage(this.imageView.sprite.texture.baseTexture.imageUrl),t=new PIXI.Rectangle(this.mouse.x-20*this.widthRatio,this.mouse.y-20*this.heightRatio,20*this.widthRatio*2,20*this.heightRatio*2);t.x<0&&(t.x=0),t.y<0&&(t.y=0),t.x+t.width>this.imageView.sprite.width&&(t.width-=t.x+t.width-(this.imageView.sprite.width-10)),t.y+t.height>this.imageView.sprite.height&&(t.height-=t.y+t.height-(this.imageView.sprite.height-10));var n=new PIXI.Texture(e.baseTexture,t),r=new PIXI.Sprite(n);r.filters=[new PIXI.filters.BlurFilter(3*this.widthRatio)],r.width=20*this.widthRatio*2,r.height=20*this.heightRatio*2,r.position={x:this.mouse.x-20*this.widthRatio,y:this.mouse.y-20*this.heightRatio},r.mask=this.drawBrush(),this.imageView.stage.addChild(r),r.addChild(r.mask),this.imageView.render()},e.prototype.placeTools=function(){},e.prototype.stop=function(){this.editingElement.off("mousedown.blur touchstart.blur"),this.editingElement.find(".output").css({cursor:""})},e.prototype.start=function(e,t){var n=this;this.imageView=e,this.editingElement=t;var r,i=function(){n.isBlurring&&(n.blurAt(),r=requestAnimationFrame(i))};t.find(".output").css({cursor:"url(/assets/themes/entcore-css-lib/images/blur.cur) 30 30, pointer"}),t.on("mousedown.blur touchstart.blur",function(e){"CANVAS"===e.target.tagName&&(n.widthRatio=n.imageView.renderer.width/t.find("canvas").width(),n.heightRatio=n.imageView.renderer.height/t.find("canvas").height(),n.drawBrush(),n.mouse={x:((e.pageX||e.originalEvent.touches[0].pageX)-n.outputLeft)*n.widthRatio,y:((e.pageY||e.originalEvent.touches[0].pageY)-n.outputTop)*n.heightRatio},n.isBlurring=!0,i(),o.$(window).on("mousemove.blur touchmove.blur",function(e){n.mouse={x:((e.pageX||e.originalEvent.touches[0].pageX)-n.outputLeft)*n.widthRatio,y:((e.pageY||e.originalEvent.touches[0].pageY)-n.outputTop)*n.heightRatio}}),o.$(window).on("mouseup.blur touchend.blur",function(){o.$(window).off("mousemove.blur mouseup.blur touchend.blur touchmove.blur"),cancelAnimationFrame(r),n.imageView.backup(!0),n.isBlurring=!1,n.imageView.pendingChanges=!0,angular.element(t).scope().$apply()}))})},e}();t.Blur=s},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(990),s=function(){function e(){}return Object.defineProperty(e.prototype,"outputWidth",{get:function(){return parseInt(o.$(this.imageView.renderer.view).width())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputHeight",{get:function(){return parseInt(o.$(this.imageView.renderer.view).height())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputLeft",{get:function(){return parseInt(o.$(this.imageView.renderer.view).position().left)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputTop",{get:function(){return parseInt(o.$(this.imageView.renderer.view).position().top)},enumerable:!0,configurable:!0}),e.prototype.stop=function(){},e.prototype.apply=function(e){var t=this,n=this.editingElement.find(".handle"),o=n.width();n.width()>this.outputWidth&&(o=n.width()-(this.outputLeft-n.position().left));var s=n.height();n.height()>this.outputHeight&&(s=n.height()-(this.outputHeight-n.position().top));var a=n.position().left-this.outputLeft,u=n.position().top-this.outputTop;if(!(a>this.outputWidth||u>this.outputHeight)){a<0&&(a=0),u<0&&(u=0),o+a>this.outputWidth&&(o=this.outputWidth-a),s+u>this.outputHeight&&(s=this.outputHeight-u);var c=PIXI.Texture.fromImage(this.imageView.sprite.texture.baseTexture.imageUrl);this.imageView.stage.removeChildren();var l=new PIXI.Texture(c.baseTexture,new PIXI.Rectangle(parseInt(a*(this.imageView.renderer.width/this.outputWidth)),parseInt(u*(this.imageView.renderer.height/this.outputHeight)),parseInt(o*(this.imageView.renderer.width/this.outputWidth)),parseInt(s*(this.imageView.renderer.height/this.outputHeight))));return this.imageView.sprite=new PIXI.Sprite(l),this.imageView.stage.addChild(this.imageView.sprite),this.imageView.renderer.resize(this.imageView.sprite.width,this.imageView.sprite.height),this.imageView.render(),new Promise(function(e,n){requestAnimationFrame(function(){return r(t,void 0,void 0,function(){var t=this;return i(this,function(n){switch(n.label){case 0:return[4,this.imageView.backup()];case 1:return n.sent(),this.imageView.render(),requestAnimationFrame(function(){t.placeTools(),e()}),[2]}})})})})}},e.prototype.placeTools=function(){this.editingElement.find(".tools-background").height(this.editingElement.find(".output").height()),this.imageView.setOverlay(),this.setHandle()},e.prototype.setHandle=function(){this.handle=this.editingElement.find(".handle"),this.handle.addClass("show"),this.handle.width(o.$(this.imageView.renderer.view).width()-4),this.handle.height(o.$(this.imageView.renderer.view).height()-4),this.handle.css({top:o.$(this.imageView.renderer.view).position().top+"px",left:o.$(this.imageView.renderer.view).position().left+"px"})},e.prototype.start=function(e,t){var n=this;this.imageView=e,this.editingElement=t,this.imageView.render(),setTimeout(function(){n.imageView.setOverlay(),n.setHandle(),n.handle.on("stopResize stopDrag",function(){n.imageView.pendingChanges=!0,angular.element(n.editingElement).scope().$apply()})},200)},e}();t.Crop=s},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(990),s=n(6),a=function(){function e(){}return Object.defineProperty(e.prototype,"ratio",{get:function(){return this.initialSize.width/this.initialSize.height},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scale",{get:function(){if(this._scale)return this._scale;if(!this.imageView||this.isInSetup)return console.log("still in setup, scale is 1"),1;if(this.imageView.sprite.width>this.imageView.sprite.height){var e=this.outputWidth/this.imageView.sprite.width;return console.log(e),console.log(this.imageView.sprite.width),this._scale=e,e>1?(console.log("scale is higher than 1"),this._scale=1,1):e}if(this.imageView.sprite.height<parseInt(this.editingElement.find(".output").css("min-height")))return console.log("small sprite height"),1;var t=this.outputHeight/this.imageView.sprite.height;return this._scale=t,console.log("calc scale from height"),t>1?(console.log("scale is higher than one"),1):t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputWidth",{get:function(){return this.editingElement.find(".output").width()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputHeight",{get:function(){return this.editingElement.find(".output").height()},enumerable:!0,configurable:!0}),e.prototype.stopResizing=function(){this.isResizing=!1,cancelAnimationFrame(this.token),this.imageView.pendingChanges=!0,angular.element(this.editingElement).scope().$apply()},e.prototype.setWidth=function(e){var t=this,n=e/this.ratio*this.scale;this.handle.width(e*this.scale),this.handle.height(n),this.isResizing=!0,this.animate(),setTimeout(function(){return t.stopResizing()},400)},e.prototype.setHeight=function(e){var t=this,n=e*this.ratio*this.scale;this.handle.height(e*this.scale),this.handle.width(n),this.isResizing=!0,this.animate(),setTimeout(function(){return t.stopResizing()},400)},e.prototype.apply=function(e){var t=this;return o.$(this.imageView.renderer.view).css({opacity:0}),new Promise(function(e,n){setTimeout(function(){t.imageView.sprite.scale=new PIXI.Point(1,1),t.imageView.render(),requestAnimationFrame(function(){t.imageView.renderer.resize(t.handle.width()/t.scale,t.handle.height()/t.scale),requestAnimationFrame(function(){t.imageView.sprite.width=t.handle.width()/t.scale,t.imageView.sprite.height=t.handle.height()/t.scale,t.initialSize={width:t.imageView.sprite.width,height:t.imageView.sprite.height},t.imageView.sprite.position={x:t.imageView.sprite.width/2,y:t.imageView.sprite.height/2},t.imageView.render(),requestAnimationFrame(function(){t.imageView.render(),o.$(t.imageView.renderer.view).css({opacity:1}),setTimeout(function(){return r(t,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,this.imageView.backup(!1)];case 1:return t.sent(),e(),this.setup(),[2]}})})},100)})})})},180)})},e.prototype.placeTools=function(){this.initialSize={height:this.imageView.sprite.height,width:this.imageView.sprite.width},this.setup()},e.prototype.resize=function(){this.imageView.sprite.width=parseInt(this.handle.width()),this.imageView.sprite.height=parseInt(this.handle.height()),this.editingElement.find("input[type=text]").first().val(parseInt(this.handle.width()/this.scale)),this.editingElement.find("input[type=text]").last().val(parseInt(this.handle.height()/this.scale)),this.imageView.sprite.position.x=this.handle.position().left+2+this.imageView.sprite.width/2,this.imageView.sprite.position.y=this.handle.position().top+2+this.imageView.sprite.height/2,this.imageView.render()},e.prototype.setHandle=function(){this.handle=this.editingElement.find(".handle"),this.handle.addClass("show"),this.handle.width(this.imageView.sprite.width-4),this.handle.height(this.imageView.sprite.height-4),this.handle.css({top:this.imageView.sprite.position.y-this.imageView.sprite.height/2+"px",left:this.imageView.sprite.position.x-this.imageView.sprite.width/2+"px"}),s.ui.extendElement.resizable(this.handle,{preserveRatio:!0})},e.prototype.lockOutput=function(){this.editingElement.find(".output").height(this.editingElement.find(".output").height())},e.prototype.reset=function(){this.imageView.sprite.width=this.initialSize.width,this.imageView.sprite.height=this.initialSize.height,this.imageView.sprite.pivot.set(this.initialSize.width/2,this.initialSize.height/2),this.imageView.renderer.resize(this.imageView.sprite.width,this.imageView.sprite.height),this.imageView.render(),this._scale=void 0},e.prototype.setup=function(){var e=this;o.$(this.imageView.renderer.view).css({opacity:0}),this.reset(),this.isInSetup=!0,setTimeout(function(){e.imageView.sprite.scale=new PIXI.Point(1,1),o.$(e.imageView.renderer).attr("data-locked-size",!0),e.outputHeight>e.imageView.sprite.height?(e.editingElement.find(".output").height(e.imageView.sprite.height),setTimeout(function(){return e.editingElement.find(".tools-background").height(e.editingElement.find(".output").height())},50)):e.imageView.sprite.height<600?(e.editingElement.find(".output").height(e.imageView.sprite.height),setTimeout(function(){return e.editingElement.find(".tools-background").height(e.editingElement.find(".output").height())},50)):(e.editingElement.find(".output").height(600),setTimeout(function(){return e.editingElement.find(".tools-background").height(e.editingElement.find(".output").height())},50)),requestAnimationFrame(function(){e.imageView.setOverlay(),e.imageView.renderer.resize(e.outputWidth,e.outputHeight),setTimeout(function(){e.isInSetup=!1,e.imageView.sprite.pivot.set(e.imageView.sprite.width/2,e.imageView.sprite.height/2),e.imageView.sprite.scale=new PIXI.Point(e.scale,e.scale),console.log("setting sprite scale "+e.scale),e.imageView.sprite.position={x:e.imageView.renderer.width/2,y:e.imageView.renderer.height/2},setTimeout(function(){console.log("finish setup"),e.lockOutput(),e.setHandle(),setTimeout(function(){return o.$(e.imageView.renderer.view).css({opacity:1})},100),e.editingElement.find("input[type=text]").first().val(parseInt(e.imageView.sprite.width/e.scale)),e.editingElement.find("input[type=text]").last().val(parseInt(e.imageView.sprite.height/e.scale)),angular.element(e.editingElement).scope().$apply()},50),e.imageView.render()},200),e.imageView.render()})},180)},e.prototype.stop=function(){var e=this;this.editingElement.find(".output").removeAttr("style"),setTimeout(function(){return e.editingElement.find(".tools-background").height(e.editingElement.find(".output").height())},200),this.reset(),this.imageView.sprite.position={x:this.initialSize.width/2,y:this.initialSize.height/2},this.editingElement.off("startResize stopResize startDrag stopDrag")},e.prototype.animate=function(){var e=this;this.isResizing&&(this.resize(),this.token=requestAnimationFrame(function(){return e.animate()}))},e.prototype.start=function(e,t){var n=this;this.imageView=e,this.editingElement=t,this.initialSize={height:this.imageView.sprite.height,width:this.imageView.sprite.width},t.on("startResize",".handle",function(){n.isResizing=!0,n.animate()}),t.on("stopResize",".handle",function(){return n.stopResizing()}),t.on("startDrag",".handle",function(){n.isResizing=!0,n.animate()}),t.on("stopDrag",".handle",function(){return n.stopResizing()}),setTimeout(function(){return n.setup()},150)},e}();t.Resize=a},function(e,t){"use strict";var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e.prototype.apply=function(e){var t=this;return this.editingElement.find(".tools button").attr("disabled",!0),this.imageView.sprite.rotation+=Math.PI/180*90,this.imageView.renderer.resize(this.imageView.sprite.height,this.imageView.sprite.width),this.imageView.sprite.position={x:this.imageView.sprite.height/2,y:this.imageView.sprite.width/2},this.imageView.render(),this.placeTools(),new Promise(function(e,i){requestAnimationFrame(function(){return n(t,void 0,void 0,function(){var t=this;return r(this,function(n){return this.imageView.backup().then(function(){t.editingElement.find(".tools button").attr("disabled",!1),e()}),[2]})})})})},e.prototype.placeTools=function(){this.imageView.editingElement.find(".tools-background").height(this.editingElement.find(".output").height())},e.prototype.stop=function(){},e.prototype.start=function(e,t){this.imageView=e,this.editingElement=t,this.imageView.sprite.pivot.set(this.imageView.sprite.width/2,this.imageView.sprite.height/2),this.imageView.renderer.resize(this.imageView.sprite.width,this.imageView.sprite.height),this.imageView.sprite.position={x:this.imageView.sprite.width/2,y:this.imageView.sprite.height/2},this.imageView.render(),this.placeTools()},e}();t.Rotate=i},function(e,t,n){"use strict";function r(){return{restrict:"A",scope:{imageLazyLoad:"="},link:function(e,t,n){var r=window;if(r.IntersectionObserver&&r.IntersectionObserverEntry&&r.IntersectionObserverEntry.prototype){o||console.info("lazy load is enabled"),o=!0;var i=function(t){t.forEach(function(t){t.intersectionRatio>0&&(t.target.src&&-1!=t.target.src.indexOf(e.imageLazyLoad)||(t.target.src=e.imageLazyLoad+(e.imageLazyLoad.indexOf("?")>-1?"&":"?")+"t="+(new Date).valueOf()))})},s=new IntersectionObserver(i),a=angular.element(t)[0];s.observe(a)}else{o||console.warn("lazy load is disabled"),o=!0;var a=angular.element(t)[0];a.src=e.imageLazyLoad}}}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(943),o=!1;t.imageLazyLoad=i.ng.directive("imageLazyLoad",r)},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(943),s=n(391),a=n(1),u=n(35);t.imageSelect=o.ng.directive("imageSelect",function(){return{restrict:"E",transclude:!0,scope:{ngModel:"=",thumbnails:"&",ngChange:"&",default:"@"},template:'<div><img ng-src="[[ngModel + \'?\' + getThumbnails()]]" class="pick-file" draggable="false" ng-if="ngModel" style="cursor: pointer" /><i class="trash" ng-click="restoreDefault()"></i><i class="edit pick-file"></i><img skin-src="[[default]]" class="pick-file" draggable="false" ng-if="!ngModel" style="cursor: pointer" /><lightbox show="userSelecting"><div ng-if="userSelecting"><media-library visibility="selectedFile.visibility"ng-change="updateDocument()" ng-model="selectedFile.file" file-format="\'img\'"></media-library></div></lightbox></div>',link:function(e,t,n){var o=this;e.selectedFile={file:{},visibility:"protected"},e.selectedFile.visibility=e.$parent.$eval(n.visibility),e.selectedFile.visibility||(e.selectedFile.visibility="protected"),e.selectedFile.visibility=e.selectedFile.visibility.toLowerCase(),e.restoreDefault=function(){e.ngModel="",setTimeout(function(){e.ngChange(),e.$apply()},10)},t.on("dragenter",function(e){e.preventDefault()}),t.on("dragstart","img",function(e){e.preventDefault()}),t.on("dragover",function(e){t.addClass("droptarget"),e.preventDefault()}),t.on("dragleave",function(){t.removeClass("droptarget")}),t.on("drop",function(n){return r(o,void 0,void 0,function(){var r,o;return i(this,function(i){switch(i.label){case 0:return t.find(a.$(n.target).parents("lightbox").first()).length>0?[2]:(n.preventDefault(),r=n.originalEvent.dataTransfer.files[0],-1===r.type.indexOf("image")||n.originalEvent.dataTransfer.files.length>1?(u.notify.error("medialibrary.unsupported"),[2]):(t.removeClass("droptarget"),t.addClass("loading-panel"),o=new s.Document,[4,o.upload(r,e.selectedFile.visibility)]));case 1:return i.sent(),e.selectedFile.file=o,e.updateDocument(),t.removeClass("loading-panel"),s.MediaLibrary.appDocuments.sync(),[2]}})})}),e.$watch("thumbnails",function(t){var n=e.$eval(t);n&&(e.getThumbnails=function(){var e="";return n.forEach(function(t){e+="thumbnail="+t.width+"x"+t.height+"&"}),e})}),e.updateDocument=function(){e.userSelecting=!1;var t="/workspace/document/";"public"===e.selectedFile.visibility&&(t="/workspace/pub/document/"),e.ngModel=t+e.selectedFile.file._id,setTimeout(function(){e.ngChange()})},t.on("click",".pick-file",function(){e.userSelecting=!0,e.$apply()})}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943);t.imgOnError=r.ng.directive("imgOnError",function(){return{restrict:"A",link:function(e,t,n){t.on("error",function(){t.off("error"),t.attr("src",n.imgOnError)})}}})},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},o=this;Object.defineProperty(t,"__esModule",{value:!0});var s=n(937),a=n(943);t.infotip=a.ng.directive("infotip",function(){return{restrict:"E",template:'\n <i class="close"></i>\n <div ng-transclude></div>\n ',scope:{name:"@",onChange:"&",savePreferenceUnder:"@",showOnce:"="},transclude:!0,link:function(e,t,n){return r(o,void 0,void 0,function(){var n,r,o,a,u,c;return i(this,function(i){switch(i.label){case 0:n="infotip",angular.isString(e.savePreferenceUnder)&&e.savePreferenceUnder.trim().length>0&&(n=e.savePreferenceUnder.trim()),t.css({display:"block"}),e.$$showPublicInfoTipRgpdCookie=!1,r=window.localStorage.getItem("showInfoTip.cookies"),"false"!=r&&(e.$$showPublicInfoTipRgpdCookie=!0),o=function(){e.$$showPublicInfoTipRgpdCookie=!1,window.localStorage.setItem("showInfoTip.cookies","false")},t.children("i").on("click",function(){t.slideUp(),o()}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,s.Me.preference(n)];case 2:return i.sent(),a=function(t){if(arguments.length<=0)return!1!==s.Me.preferences[n][e.name];s.Me.preferences[n][e.name]=t},u=function(){e.onChange&&e.onChange({$visible:a()})},u(),a()?(t.css({display:"block"}),e.showOnce&&(a(!1),s.Me.savePreference(n))):t.remove(),t.children("i").on("click",function(){t.slideUp(),a(!1),u(),s.Me.savePreference(n)}),[3,4];case 3:return c=i.sent(),console.error(c),[3,4];case 4:return[2]}})})}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388),i=n(551);t.inputdate=r.ng.directive("inputdate",["$timeout",function(e){return{restrict:"E",template:'\n <input type="date" class="[[class]]" \n ng-model="current.model" \n ng-model-options="ngModelOptions || {}" \n ng-model-extend="ngModelExtend"\n ng-required="ngRequired" />\n ',scope:{ngRequired:"=",ngChange:"=",ngModel:"=",ngModelOptions:"=",ngMax:"@",ngMin:"@",class:"@",onSuccess:"&"},compile:function(e,t){var n=function(){var e=document.createElement("input");return e.setAttribute("type","date"),e.setAttribute("value","a"),"a"!==e.value}(),o=e.find("input"),s=n?r.moment().creationData().locale._longDateFormat.L:"DD/MM/YYYY";return n||(o[0].setAttribute("type","text"),o[0].setAttribute("placeholder","[[dateFormatI18]]")),{pre:function(e,t,o){var a=null,u=new i.Subject;e.isDateSupported=n,e.dateFormat=s,e.dateFormatI18=r.idiom.translate("date."+s);var c=u.debounceTime(400).subscribe(function(t){o.onSuccess&&t&&e.onSuccess()});e.$on("destroy",function(){setTimeout(function(){c.unsubscribe()},500)});var l=function(e){return e instanceof Date?r.moment(e):"string"==typeof e?r.moment(e,"YYYY-MM-DD",!0):null},d=function(e){return"string"==typeof e?r.moment(e,["YYYY-MM-DD",s],!0):null};e.ngModelExtend={clearParsers:!0,clearFormatters:!0,formatters:[function(e){var t=l(e);return t&&t.isValid()?n?t.format("YYYY-MM-DD"):t.format(s):""}],parsers:[function(e){var t=d(e);return t&&t.isValid()?t.format("YYYY-MM-DD"):e},function(t){return setTimeout(function(){return e.onChange()}),t}],validators:[{key:"dateFormat",validator:function(e,t){if(!t)return!0;var n=d(t);return n&&n.isValid()}},{key:"dateMax",validator:function(t,n){if(e.ngMax){var r=l(t),i=l(e.ngMax);if(r&&r.isValid()&&i&&i.isValid())return r.toDate().getTime()<=i.toDate().getTime()}return!0}},{key:"dateMin",validator:function(t,n){if(e.ngMin){var r=l(t),i=l(e.ngMin);if(r&&r.isValid()&&i&&i.isValid())return r.toDate().getTime()>=i.toDate().getTime()}return!0}}],onInit:function(e){a=e}},e.current={get model(){return e.ngModel},set model(t){e.ngModel=t}},e.onChange=function(){u.next(a.$valid),o.ngChange&&e.ngChange()}}}}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943);t.inputPassword=r.ng.directive("inputPassword",function(){return{restrict:"E",replace:!1,template:'<input type="password"/><button type="button" \t\t\t\t\tng-mousedown="show(true)" \t\t\t\t\tng-touchstart="show(true)" \t\t\t\t\tng-touchend="show(false)" \t\t\t\t\tng-mouseup="show(false)" \t\t\t\t\tng-mouseleave="show(false)"></button>',scope:!0,compile:function(e,t){e.addClass("toggleable-password");var n=e.children("input[type=password]");for(var r in t.$attr)n.attr(t.$attr[r],t[r]),e.removeAttr(t.$attr[r]);return function(e){e.show=function(e){n[0].type=e?"text":"password"}}}}})},function(module,exports,__webpack_require__){"use strict";function safeApply(e,t){var n=e.$root.$$phase;"$apply"==n||"$digest"==n?t&&"function"==typeof t&&t():e.$apply(t)}var __awaiter=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(exports,"__esModule",{value:!0});var ng_start_1=__webpack_require__(943),jquery_1=__webpack_require__(1),workspace_v1_1=__webpack_require__(392),template_1=__webpack_require__(390),modelDefinitions_1=__webpack_require__(37),idiom_1=__webpack_require__(3),axios_1=__webpack_require__(7),model_1=__webpack_require__(407),services_1=__webpack_require__(550),notify_1=__webpack_require__(35),ui_1=__webpack_require__(6);exports.mediaLibrary=ng_start_1.ng.directive("mediaLibrary",["$timeout","$filter",function($timeout,$filter){return{restrict:"E",scope:{delegate:"=",ngModel:"=",ngChange:"&",multiple:"=",fileFormat:"=",accept:"="},templateUrl:"/assets/js/entcore/template/media-library/main.html",link:function(scope,element,attributes){function matchSearch(e){return!(scope.display.search&&scope.display.search.trim().length>0)||-1!==idiom_1.idiom.removeAccents((e||"").toLowerCase()).indexOf(idiom_1.idiom.removeAccents(scope.display.search.toLowerCase()))}function filteredDocuments(e){return e?e.documents.filter(function(e){var t=scope.delegate&&scope.delegate.filterDocumentRole,n=e.role()===scope.fileFormat||"any"===scope.fileFormat,r=t?scope.delegate.filterDocumentRole(e):n,i=matchSearch(e.metadata.filename),o=matchSearch(e.name);return r&&(i||o)}):[]}function filterFolders(e){return e&&e.folders?e.folders.filter(function(e){return matchSearch(e.name)}):[]}var _this=this;scope.documentList=new model_1.DocumentsListModel($filter,!0),scope.documentList.watch(scope),scope.delegate&&scope.delegate.visit&&scope.delegate.visit(scope);var MAIN_CONTAINER="entcore/media-library/main",TEMPLATE_LOADING="entcore/media-library/loading",HEADER_BROWSE={i18Key:jquery_1.$(window).width()<=ui_1.ui.breakpoints.tablette?"library.header.browse.mobile":"library.header.browse",template:"entcore/media-library/browse",visible:function(){return!0},worflowKey:null},HEADER_UPLOAD={i18Key:jquery_1.$(window).width()<=ui_1.ui.breakpoints.tablette?"library.header.upload.mobile":"library.header.upload",template:"entcore/media-library/upload",visible:function(){return!0},worflowKey:"workspace.create"},HEADER_RECORD={i18Key:jquery_1.$(window).width()<=ui_1.ui.breakpoints.tablette?"library.header.record.mobile":"library.header.record",template:"entcore/media-library/record",visible:function(){return"audio"===scope.fileFormat},worflowKey:"workspace.create"};scope.template=template_1.template;var header=HEADER_BROWSE,hack=!0,showTemplate=function(e){if(header=e,template_1.template.open(MAIN_CONTAINER,e.template),e.onDisplay&&e.onDisplay(),navigator.userAgent.match(/iPhone/i)&&hack){hack=!1;var t=jquery_1.$("editor").css("display");jquery_1.$("editor").css("display","none"),setTimeout(function(){hack=!0,jquery_1.$("editor").css("display",t)},500)}};scope.headers=function(){var e=[HEADER_RECORD,HEADER_UPLOAD,HEADER_BROWSE];return scope.delegate&&scope.delegate.augmentHeaders?scope.delegate.augmentHeaders(e):e},scope.title=function(){return scope.delegate&&scope.delegate.title?scope.delegate.title:idiom_1.idiom.translate("medialibrary.title")},template_1.template.open("entcore/media-library/cache",TEMPLATE_LOADING),window.toBlobPolyfillLoaded||axios_1.default.get("/infra/public/js/toBlob-polyfill.js").then(function(response){eval(response.data),window.toBlobPolyfillLoaded=!0}),scope.$watch(function(){return scope.$parent.$eval(attributes.visibility)},function(e){scope.visibility=e,scope.visibility||(scope.visibility="protected"),scope.visibility=scope.visibility.toLowerCase()}),scope.canExpand=function(e){return e.canExpand()},scope.openCompression=function(e){e.isEditableImage&&(scope.display.editedDocument=e,setTimeout(function(){scope.display.compressionReady=!0,scope.$apply()},350))},scope.closeCompression=function(){scope.display.editedDocument=void 0,scope.display.compressionReady=!1},scope.upload={documents:[],highlights:[]},element.on("dragenter",function(e){e.preventDefault()}),element.on("dragover",function(e){element.find(".drop-zone").addClass("dragover"),e.preventDefault()}),element.on("dragleave",function(){element.find(".drop-zone").removeClass("dragover")}),element.on("drop",function(e){return __awaiter(_this,void 0,void 0,function(){var t;return __generator(this,function(n){return element.find(".drop-zone").removeClass("dragover"),e.preventDefault(),template_1.template.open(MAIN_CONTAINER,TEMPLATE_LOADING),t=e.originalEvent.dataTransfer.files,scope.importFiles(e.originalEvent.dataTransfer.files),[2]})})}),scope.$watch("ngModel",function(e){scope.upload.documents=[]}),jquery_1.$("body").on("click",".lightbox-backdrop",function(){scope.upload.documents=[]}),showTemplate(HEADER_BROWSE),scope.myDocuments=workspace_v1_1.MediaLibrary.myDocuments,scope.sharedDocuments=workspace_v1_1.MediaLibrary.sharedDocuments,scope.display={search:""};var previousImage=function(){for(var e=scope.upload.documents.indexOf(scope.display.editedDocument)-1,t=e;t>=0;t--)if(scope.upload.documents[t].isEditableImage)return scope.upload.documents[t]},nextImage=function(){for(var e=scope.upload.documents.indexOf(scope.display.editedDocument)+1,t=e;t<scope.upload.documents.length;t++)if(scope.upload.documents[t].isEditableImage)return scope.upload.documents[t]};scope.isEditedFirst=function(){return!previousImage()},scope.isEditedLast=function(){return!nextImage()},scope.nextImage=function(){return scope.display.editedDocument=nextImage()},scope.previousImage=function(){return scope.display.editedDocument=previousImage()};var displayHighLights=function(){setTimeout(function(){scope.upload.highlights.forEach(function(e){element.find("explorer").each(function(t,n){if(-1!==jquery_1.$(n).attr("doc-id").indexOf(e._id)){var r=jquery_1.$('<div class="highlight"></div>'),i=jquery_1.$(n).children(".explorer");i.append(r),i.scope().ngModel=!0,i.scope().$apply()}})}),setTimeout(function(){jquery_1.$(".highlight").addClass("show"),setTimeout(function(){jquery_1.$(".highlight").removeClass("show"),setTimeout(function(){jquery_1.$(".highlight").remove(),scope.upload.highlights=[]},720)},720)},30)},100)};scope.showHeaderByI18Key=function(e){var t=scope.headers().find(function(t){return t.i18Key==e});t&&scope.showHeader(t)},scope.showHeader=function(e){if(scope.delegate&&scope.delegate.handleShow){if(scope.delegate.handleShow(scope,{cancelAll:cancelAll,displayHighLights:displayHighLights,showTemplate:showTemplate}))return}showTemplate(e),cancelAll(),displayHighLights()},scope.isExternalVisible=function(){return"external"==scope.visibility},scope.isSelectedHeader=function(e){return header&&e&&header.i18Key==e.i18Key},scope.isViewMode=function(e){return scope.viewMode==e},scope.changeViewMode=function(e){e&&scope.viewMode!=e&&(template_1.template.open("documents-view","entcore/media-library/"+e),scope.viewMode=e,services_1.workspaceService.savePreference({bbmView:e}))},services_1.workspaceService.getPreference().then(function(e){scope.changeViewMode(e.bbmView||"icons")}),scope.orderByField=function(e){if(1==scope.isOrderedAsc(e))scope.orderFieldDocument="-"+e;else{if(scope.isOrderedDesc(e))return scope.orderByDefault();scope.orderFieldDocument=e}scope.orderFieldFolder=scope.orderFieldDocument},scope.orderByDefault=function(){scope.orderFieldDocument="-created",scope.orderFieldFolder="name"},scope.orderByDefault(),scope.isOrderedAsc=function(e){return scope.orderFieldDocument==e},scope.isOrderedDesc=function(e){return scope.orderFieldDocument=="-"+e},scope.isListFrom=function(e){return scope.display.listFrom==e},scope.listFrom=function(e){return __awaiter(_this,void 0,void 0,function(){var t;return __generator(this,function(n){switch(n.label){case 0:return scope.display.listFrom=e,t=workspace_v1_1.MediaLibrary[scope.display.listFrom],[4,scope.openFolder(t)];case 1:return n.sent(),[2]}})})};var refresh=function(){scope.documents=filteredDocuments(workspace_v1_1.MediaLibrary[scope.display.listFrom]),scope.folders=filterFolders(scope.openedFolder),safeApply(scope)};workspace_v1_1.MediaLibrary.eventer.on("sync",refresh),workspace_v1_1.MediaLibrary.eventer.on("ready",function(){scope.folder=workspace_v1_1.MediaLibrary[scope.display.listFrom],scope.openedFolder=scope.folder,scope.documents=filteredDocuments(workspace_v1_1.MediaLibrary[scope.display.listFrom]),scope.folders=filterFolders(scope.openedFolder)}),workspace_v1_1.MediaLibrary.sync(),scope.openFolder=function(e){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return scope.openedFolder=e,[4,e.sync()];case 1:return t.sent(),scope.documents=filteredDocuments(e),scope.folders=filterFolders(scope.openedFolder),safeApply(scope),[2]}})})},scope.$watch("visibility",function(e){var t=this;"external"==scope.visibility?scope.listFrom("externalDocuments"):modelDefinitions_1.model.me&&modelDefinitions_1.model.me.workflow.workspace.create?"public"===scope.visibility?scope.listFrom("publicDocuments"):scope.listFrom("appDocuments"):modelDefinitions_1.model.me&&modelDefinitions_1.model.me.workflow.workspace.list&&scope.listFrom("sharedDocuments"),scope.$watch("fileFormat",function(e){return __awaiter(t,void 0,void 0,function(){return __generator(this,function(t){return e?("audio"===e?(showTemplate(HEADER_RECORD),scope.display.acceptType="audio/*",element.parents("lightbox").on("lightboxvisible",function(){showTemplate(HEADER_RECORD)})):"img"===e?scope.display.acceptType="image/*":(showTemplate(HEADER_BROWSE),element.parents("lightbox").on("lightboxvisible",function(){showTemplate(HEADER_BROWSE)})),0===workspace_v1_1.MediaLibrary[scope.display.listFrom].documents.length&&workspace_v1_1.MediaLibrary[scope.display.listFrom].sync(),[2]):[2]})})})}),scope.insertRecord=function(e){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,workspace_v1_1.MediaLibrary.appDocuments.sync()];case 1:return t.sent(),workspace_v1_1.MediaLibrary.appDocuments.documents.all.forEach(function(t){t._id==e&&scope.selectDocument(t)}),[2]}})})},scope.selectedDocuments=function(){return scope.documents?scope.documents.filter(function(e){return e.selected}):[]},scope.selectDocument=function(e){scope.documents.forEach(function(e){return e.selected=!1}),e.selected=!0,scope.selectDocuments()},scope.selectDocuments=function(){return __awaiter(_this,void 0,void 0,function(){var e,t,n,r;return __generator(this,function(i){switch(i.label){case 0:return e=scope.selectedDocuments(),"external"===scope.visibility||"protected"==scope.openedFolder.filter&&"protected"===scope.visibility||"public"==scope.openedFolder.filter&&"public"===scope.visibility?(scope.multiple?scope.ngModel=e:scope.ngModel=e[0],[3,9]):[3,1];case 1:t=[],scope.display.loading=e,n=0,i.label=2;case 2:return n<e.length?(r=void 0,"public"!==scope.visibility?[3,4]:[4,e[n].publicDuplicate()]):[3,8];case 3:return r=i.sent(),[3,6];case 4:return[4,e[n].protectedDuplicate()];case 5:r=i.sent(),i.label=6;case 6:t.push(r),i.label=7;case 7:return n++,[3,2];case 8:scope.display.loading=void 0,scope.multiple?scope.ngModel=t:scope.ngModel=t[0],i.label=9;case 9:return(scope.ngModel&&scope.ngModel._id||scope.ngModel&&scope.multiple&&scope.ngModel.length)&&$timeout(function(){scope.ngChange()}),scope.$apply(),[2]}})})},scope.updateSelection=function(e){scope.multiple||(scope.documents.forEach(function(e){return e.selected=!1}),e.selected=!0)};var cancelAll=function(){scope.display.editedDocument=void 0,scope.upload.documents.forEach(function(e){"loaded"===e.uploadStatus&&e.delete(),"loading"===e.uploadStatus&&e.abort()}),scope.upload.documents=[],scope.upload.loading=[]};scope.abortOrDelete=function(e){"loaded"===e.uploadStatus&&e.delete(),"loading"===e.uploadStatus&&e.abort();var t=scope.upload.documents.indexOf(e);scope.upload.documents.splice(t,1),scope.upload.documents.length||showTemplate(HEADER_UPLOAD),e===scope.display.editedDocument&&(scope.display.editedDocument=void 0)},scope.canConfirmImport=function(){return scope.upload.documents.map(function(e){return"loaded"==e.uploadStatus}).reduce(function(e,t){return e&&t},!0)},scope.confirmImport=function(){return __awaiter(_this,void 0,void 0,function(){var e;return __generator(this,function(t){switch(t.label){case 0:return scope.upload.documents.forEach(function(e){e.applyBlob(),e.selected=!0}),"public"!=scope.visibility?[3,2]:[4,scope.listFrom("publicDocuments")];case 1:return t.sent(),e=workspace_v1_1.MediaLibrary.publicDocuments.documents.all.length-1,e>-1&&(workspace_v1_1.MediaLibrary.publicDocuments.documents.all[e].selected=!0),[3,4];case 2:return[4,scope.listFrom("appDocuments")];case 3:t.sent(),t.label=4;case 4:return scope.documents=scope.upload.documents,scope.documents&&(scope.selectDocuments(),scope.documents.length,notify_1.notify.success("workspace.add.document.success")),scope.upload.documents=[],scope.documents=[],[2]}})})},scope.cancelUpload=function(){showTemplate(HEADER_UPLOAD),cancelAll()},scope.importFiles=function(e){e||(e=scope.upload.files);for(var t=0;t<e.length;t++){var n=new workspace_v1_1.Document;scope.upload.documents.push(n);var r="external"==scope.visibility?"protected":scope.visibility;n.upload(e[t],r).then(function(){return scope.$apply()})}scope.upload.files=void 0,template_1.template.open(MAIN_CONTAINER,TEMPLATE_LOADING)},scope.updateSearch=function(){scope.documents=filteredDocuments(scope.openedFolder),scope.folders=filterFolders(scope.openedFolder)},scope.editImage=function(){return scope.display.editDocument=!0},scope.$on("$destroy",function(){cancelAll(),workspace_v1_1.MediaLibrary.deselectAll()}),scope.triggerIpnutFileClick=function(e){e.preventDefault(),e.stopPropagation(),jquery_1.$(".upload-input").trigger("click",[scope.$id])},element.on("click",".upload-input",function(e,t){t!=scope.$id&&e.preventDefault(),e.stopPropagation()}),scope.resetRegularDisplay=function(){scope.display.listFrom=null,scope.openedFolder=new workspace_v1_1.Folder("owner"),scope.documents=[],scope.folders=[]}}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388);t.multiComboboxes=r.ng.directive("multiComboboxes",function(){return{restrict:"E",template:'\n <div class="fluid row">\n <button type="button" class="select-button left-text low-text row" ng-class="{ selected : showOptions }" ng-disabled="ngDisabled">\n <span ng-if="!ngModel && !ngDisabled" class="block cell-ellipsis right-spacing">[[ titleAll ]]</span>\n <span ng-if="ngModel.length >= 0 && !ngDisabled && title" class="block cell-ellipsis right-spacing active">[[ title ]]: [[ ngModel.length ]] <i18n>portal.selected</i18n></span> <i class="sort horizontal-margin top-spacing absolute-magnet"></i>\n <span ng-if="ngModel.length >= 0 && !ngDisabled && !title" class="block cell-ellipsis right-spacing active">[[ ngModel.length ]] <i18n>portal.selected</i18n></span> <i class="sort horizontal-margin top-spacing absolute-magnet"></i>\n <span ng-if="ngDisabled" class="block cell-ellipsis right-spacing">[[ titleDisabled || title ]]</span>\n </button>\n <article class="absolute-w">\n <div class="search-pagination flex-row align-center" ng-if="disableSearch != \'true\'">\n <div class="cell twelve">\n <input class="twelve" name="searchFieldValue" type="text" ng-model="searchField.value"\n i18n-placeholder="{{searchPlaceholder}}" autocomplete="off"/>\n <i class="search"></i>\n </div>\n </div>\n <div class="top-spacing-twice left-text smaller-text">\n <a class="text-underline-hover" ng-click="selectNone()"><i18n>portal.none</i18n></a> <span class="horizontal-margin-small">|</span> <a class="text-underline-hover" ng-click="selectAll()"><i18n>portal.all</i18n></a>\n </div>\n <div class="top-spacing-twice left-text scroll-seven-checks" bottom-scroll="updatingMaxItems()">\n <div class="flex-row top-spacing" ng-repeat="option in options | orderBy:order | filter:filterByLabel" \n ng-click="onCheck(option, !option.checked)"\n ng-disabled="option.available ? !option.available() : false">\n <label class="cell wrapping-checkbox" ng-disabled="option.available ? !option.available() : false">\n <input type="checkbox" ng-model="option.checked" disabled="disabled" />\n <i18n></i18n>\n </label>\n <i18n class="cell multiline-ellipsis-two top-spacing size-auto left-text low-importance">\n [[ option.label ]]\n </i18n>\n </div>\n </div>\n </article>\n </div>\n ',scope:{ngModel:"=",ngDisabled:"=",options:"=",check:"&",disableSearch:"@?",searchPlaceholder:"@?",order:"=?",titleDisabled:"@?"},link:function(e,t,n){e.searchField={value:""},e.titleAll=n.titleAll,e.title=n.title,e.titleDisabled=n.titleDisabled,e.order||(e.order="label"),null==e.searchPlaceholder&&(e.searchPlaceholder="portal.searching"),e.maxItems=20,e.showOptions=!1,e.firstShow=!0,t.find("article").hide(),e.updatingMaxItems=function(){e.maxItems+=20},e.$watchCollection("options",function(t){e.options&&e.options.forEach(function(t){t.checked=!e.ngModel||-1!==e.ngModel.indexOf(t.type),e.$watch(function(){return t},function(t,n){if(t!==n&&t.checked!==n.checked){if(t.checked&&e.ngModel.find(function(e){return e==t.type}))return;t.checked?e.ngModel.push(t.type):e.ngModel=e.ngModel.filter(function(e){return e!=t.type})}},!0)})});var i=function(){t.find("article").css("opacity",0),t.find("article").css("z-index",-1),e.searchField.value=""};t.find("button").on("click",function(){e.showOptions?i():(e.firstShow&&(t.find("article").show(),e.firstShow=!1),t.find("article").css("opacity",1),t.find("article").css("z-index",1e3)),e.showOptions=!e.showOptions,e.$apply()});var o=function(n){t.find(n.target).length>0||(i(),e.showOptions=!1,e.$apply())};r.$("body").on("click",o),e.filterByLabel=function(t){return t.label||(t.label=""),t.label.toLowerCase().includes(e.searchField.value.toLowerCase())},e.onCheck=function(t,n){t.available&&!t.available()||(t.checked=n),e.check({option:t,checked:n})},e.select=function(t){e.options.forEach(function(n){e.onCheck(n,t)}),e.searchField.value=""},e.selectNone=function(){e.select(!1)},e.selectAll=function(){e.select(!0)},e.$watch(function(){return t.find("button")[0].offsetHeight},function(e){var n=t.find("article").eq(0);n.css("top",t.find("button")[0].offsetHeight+1+"px"),n.css("left","2px")})}}})},function(e,t,n){"use strict";function r(e,t){return s.ng.directive(e,function(){return{require:["?ngModel","?^^guardRoot"],restrict:"A",link:function(e,n,r,i){var o=i[0],s=i[1],u=t(e,n,r,o),c=0;if(null!=u)if(o?o.$formatters.push(function(e){return 0==c&&(setTimeout(function(){return u.reset()}),c++),e}):setTimeout(function(){return u.reset()}),null!=s)s.registerGuard(u),e.$on("$destroy",function(){s.unregisterGuard(u)});else{var l=a.navigationGuardService.registerIndependantGuard(u);e.$on("$destroy",function(){a.navigationGuardService.unregisterIndependantGuard(l)})}}}})}var i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(943),a=n(941);t.guardRootDirective=s.ng.directive("guardRoot",function(){return{restrict:"A",controller:["$scope","$attrs",function(e,t){var n;n=null!=t.guardRoot&&""!=t.guardRoot?t.guardRoot:a.navigationGuardService.generateID();var r=a.AngularJSRouteChangeListener.getInstance(e.$root);a.navigationGuardService.registerListener(r),a.navigationGuardService.registerListener(a.DOMRouteChangeListener.getInstance()),a.navigationGuardService.registerListener(a.TemplateRouteChangeListener.getInstance()),e.$on("$destroy",function(){a.navigationGuardService.unregisterListener(r),a.navigationGuardService.unregisterListener(a.DOMRouteChangeListener.getInstance()),a.navigationGuardService.unregisterListener(a.TemplateRouteChangeListener.getInstance()),a.navigationGuardService.unregisterRoot(n)}),this.registerGuard=function(e){a.navigationGuardService.registerGuard(n,e)},this.unregisterGuard=function(e){a.navigationGuardService.unregisterGuard(n,e)},this.reset=function(){a.navigationGuardService.reset(n)}}]}}),t.resetGuardDirective=s.ng.directive("resetGuard",function(){return{require:"?^guardRoot",restrict:"A",link:function(e,t,n,r){var s=this,u=n.resetGuardId,c=function(){return i(s,void 0,void 0,function(){var t;return o(this,function(i){switch(i.label){case 0:return t=e.$eval(n.resetGuard),t instanceof Promise?[4,t]:[3,2];case 1:return i.sent(),[3,3];case 2:console.warn("[resetGuard] result is not instance of Promise"),i.label=3;case 3:return null!=u&&""!=u?a.navigationGuardService.reset(u):null!=r?r.reset():(console.warn("[resetGuard] A reset directive has no root, resetting all guards..."),a.navigationGuardService.resetAll()),[2]}})})},l=function(){var e=n.resetGuardEvent;if("string"!=typeof e||!e.trim()){var r=(t.prop("tagName")||"").toLowerCase();e="form"==r?"submit":"click"}return t.on(e,c),function(){return t.off(e,c)}}();e.$on("$destroy",function(){l()})}}}),t.guardIgnoreTemplate=s.ng.directive("guardIgnoreTemplate",function(){return{require:["?container","?guardRoot"],restrict:"A",link:function(e,t,n,r){var i=r[0],o=r[1],s=a.TemplateRouteChangeListener.getInstance();if(o)return void s.setTriggerByDefault(!1);var u=i.template;null==u?console.error("Container directive doesn't have a template attribute. Did its implementation change ?"):(s.addIgnoreContainer(u),e.$on("$destroy",function(){s.removeIgnoreContainer(u)}))}}}),t.guardTriggerTemplate=s.ng.directive("guardTriggerTemplate",function(){return{require:["?container","?guardRoot"],restrict:"A",link:function(e,t,n,r){var i=r[0],o=r[1],s=a.TemplateRouteChangeListener.getInstance();if(o)return void s.setTriggerByDefault(!0);var u=i.template;null==u?console.error("Container directive doesn't have a template attribute. Did its implementation change ?"):(s.addTriggerContainer(u),e.$on("$destroy",function(){s.removeTriggerContainer(u)}))}}}),t.inputGuardDirective=r("inputGuard",function(e,t,n,r){return new a.InputGuard(function(){return r.$viewValue||""},function(){return r.$viewValue||""})}),t.dirtyGuardDirective=r("dirtyGuard",function(e,t,n,r){return new a.InputGuard(function(){return r.$dirty},function(){return!1})}),t.documentGuardDirective=r("documentGuard",function(e,t,n,r){return new a.InputGuard(function(){return"object"==typeof r.$modelValue?r.$modelValue.id||"":""},function(){return"object"==typeof r.$modelValue?r.$modelValue.id||"":""},function(e,t){return e&&t?e._id==t._id:!e&&!t})}),t.customGuardDirective=r("customGuard",function(e,t,n){var r=new a.ObjectGuard(function(){return e.$eval(n.customGuard)});return e.$watch(function(){return e.$eval(n.customGuard)},function(){r.reset()}),r});var u=function(){function e(){}return e.prototype.link=function(e,t,n){var r=e.$eval(n.navigationTriggerParam||"{onEvent:'click'}");r.rootGuardId=r.rootGuardId||"*";var i=new a.ManualChangeListener;a.navigationGuardService.registerListener(i);var o=[],s=function(t){t&&t.preventDefault(),i.onChange.next({checkGuardId:r.rootGuardId,confirmMessageKey:r.guardMessageKey,accept:function(){e.$eval(n.navigationTrigger)},reject:function(){}})},u=function(e,t,n){e.on(t,n),o.push(function(){return e.off(t,n)})},c=function(){for(var e=0,t=o;e<t.length;e++){(0,t[e])()}o=[]};angular.isString(r.onEvent)?u(t,r.onEvent,s):angular.isArray(r.onEvent)&&r.onEvent.forEach(function(e,n,r){angular.isString(e)&&r.lastIndexOf(e)===n&&u(t,e,s)}),e.$on("$destroy",function(){c(),a.navigationGuardService.unregisterListener(i)})},e}();t.navigationTrigger=s.ng.directive("navigationTrigger",function(){return new u})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943);t.ngModelExtend=r.ng.directive("ngModelExtend",["$timeout",function(e){return{restrict:"A",require:"ngModel",scope:{ngModelExtend:"="},compile:function(e,t){return function(e,t,n,r){e.input=r;!function(){var t=e.ngModelExtend||{},n=t.formatters,i=void 0===n?[]:n,o=t.parsers,s=void 0===o?[]:o,a=t.validators,u=void 0===a?[]:a,c=t.clearFormatters,l=void 0!==c&&c,d=t.clearParsers,h=void 0!==d&&d,f=t.onValidationChanged,p=void 0===f?function(e){}:f,m=t.onInit,_=void 0===m?function(e){}:m;e.$watch("input.$valid",function(){return p(r)});var v=!1;l&&(r.$formatters=[],v=!0),h&&(r.$parsers=[],v=!0),s.forEach(function(e){r.$parsers.push(e),v=!0}),i.forEach(function(e){r.$formatters.push(e),v=!0}),u.forEach(function(e){r.$validators[e.key]=e.validator,v=!0}),v&&r.$render(),_(r)}()}}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388),i=n(3);t.pastilles=r.ng.directive("pastilles",["$window",function(e){return{restrict:"E",template:'\n <div class="pastilles-container">\n <a ng-if="image.visible" class="pastilles-item inactive" ng-click="" ng-repeat="image in images track by $index">\n <svg class="pastilles-icon" width="32" height="32">\n <title>[[translate(image.img)]]</title>\n <use href="/directory/public/assets/icons/icons.svg#[[image.img]]"></use>\n </svg>\n <span>[[translate(image.i18n)]]</span>\n </a>\n </div>\n ',scope:{ngModel:"=",images:"="},link:function(e,t,n){e.translate=i.idiom.translate,setTimeout(function(){var n,r;e.index=e.ngModel;var i=function(){n=t.find("div").children(),r=n.length};i();var o=function(){e.index<r&&(n.eq(e.index).removeClass("inactive"),n.eq(e.index).addClass("active")),t.find(".pastilles-item").on("click",function(){if(i(),0!==r){t.find(".active").addClass("inactive"),t.find(".active").removeClass("active"),this.classList.remove("inactive"),this.classList.add("active"),e.index=Array.prototype.slice.call(t.find("div")[0].children).indexOf(this);for(var n=0,o=0,s=e.images.length;o<s;o++)if(e.images[o].visible){if(e.index===n){e.ngModel=o;break}n++}e.$apply()}})};e.$watch("images",function(e){setTimeout(function(){o()},0)},!0),o(),e.setActive(n[e.index]),n.eq(e.index).removeClass("inactive"),n.eq(e.index).addClass("active"),t.find("div").removeClass("invisible-content")},250)}}}])},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},o=this;Object.defineProperty(t,"__esModule",{value:!0});var s=n(943),a=n(937);t.searchUser=s.ng.directive("searchUser",["$timeout",function(e){return{restrict:"E",template:'\n <form class="input-help" ng-submit="update(true)">\n <label ng-class="{ hide: ngModel.length >= 3 }" user-role="ADMIN_LOCAL">\n <i18n>share.search.help</i18n>\n </label>\n <label user-missing-role="ADMIN_LOCAL" ng-if="ngModel.length < 1">\n <i18n>share.search.placeholder</i18n>\n </label>\n <input type="text" ng-model="ngModel" ng-change="update()" autocomplete="off" ng-class="{ move: ngModel.length > 0 }" />\n </form>\n ',scope:{ngModel:"=",searchTrack:"=",onSend:"&",clearList:"&"},link:function(t,n,s){return r(o,void 0,void 0,function(){return i(this,function(r){return s.id&&(n.find("input").attr("id",s.id),n.attr("id","")),n.find("input").on("focus",function(){n.addClass("focus"),n.find("label").addClass("move")}),n.find("input").on("blur",function(){setTimeout(function(){n.removeClass("focus"),t.ngModel||n.find("label").removeClass("move")},200)}),t.update=function(n){a.Me.session.functions.ADMIN_LOCAL||(n=!0),t.searchTrack&&(t.searchTrack.processing=!0),e(function(){if(t.ngModel.length<3&&!n||t.ngModel.length<1)return void t.clearList();(n||t.ngModel.length>=3)&&t.onSend()})},[2]})})}}}])},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(943),s=n(1),a=n(4),u=function(){function e(e){this.all=e}return e.prototype.stayOpen=function(){return r(this,void 0,void 0,function(){var e,t,n,r;return i(this,function(i){switch(i.label){case 0:e=0,t=this.all,i.label=1;case 1:return e<t.length?(n=t[e],n?[4,n.stayOpen()]:[3,3]):[3,4];case 2:if(r=i.sent())return[2,!0];i.label=3;case 3:return e++,[3,1];case 4:return[2,!1]}})})},e}();t.lightbox=o.ng.directive("lightbox",function(){return{restrict:"E",transclude:!0,scope:{show:"=",tiny:"=",onShow:"&?",onClose:"&",delegate:"=",delegateClose:"&?"},template:'<section class="lightbox" ng-class="{\'lightbox\': !tiny, \'tiny-lightbox\': tiny}"><div class="background"></div><div class="content"><div class="twelve cell" ng-transclude></div><div class="close-lightbox"><i class="close-2x"></i></div></div></section></div>',link:function(e,t,o){return r(this,void 0,void 0,function(){var c,l,d;return i(this,function(h){switch(h.label){case 0:return c=e.delegate,o.navigationGuard?[4,Promise.resolve().then(function(){return n(941)})]:[3,2];case 1:l=h.sent(),d=new l.LightboxChangeListener,c=new u([c,d]),l.navigationGuardService.registerListener(d),e.$on("$destroy",function(){l.navigationGuardService.unregisterListener(d)}),h.label=2;case 2:return t.children(".lightbox").find("> .background").on("click",function(n){return r(this,void 0,void 0,function(){var n,n;return i(this,function(r){switch(r.label){case 0:return 0!==t.children(".lightbox").find("image-editor, share-panel, .import-files, .split-screen, [template=entcore\\/image-editor\\/main]").length?[3,3]:c?[4,c.stayOpen()]:[3,2];case 1:if(!0===(n=r.sent()))return[2];r.label=2;case 2:if(o.delegateClose&&!0===(n=e.delegateClose({$element:t})))return[2];t.children(".lightbox").first().fadeOut(),s.$("body").css({overflow:"auto"}),s.$("body").removeClass("lightbox-opened"),e.$eval(e.onClose),e.$apply(),e.show=!1,e.$$phase||e.$parent.$apply(),r.label=3;case 3:return[2]}})})}),t.children(".lightbox").find("> .content > .close-lightbox > i.close-2x").on("click",function(n){return r(this,void 0,void 0,function(){var n,n;return i(this,function(r){switch(r.label){case 0:return 0!==t.children(".lightbox").find("share-panel").length?[3,3]:c?[4,c.stayOpen()]:[3,2];case 1:if(!0===(n=r.sent()))return[2];r.label=2;case 2:if(o.delegateClose&&!0===(n=e.delegateClose({$element:t})))return[2];t.children(".lightbox").first().fadeOut(),s.$("body").css({overflow:"auto"}),s.$("body").removeClass("lightbox-opened"),e.$eval(e.onClose),e.$apply(),e.show=!1,e.$$phase||e.$parent.$apply(),r.label=3;case 3:return[2]}})})}),t.children(".lightbox").on("mousedown",function(e){e.stopPropagation()}),e.$watch("show",function(n){if(n){o.onShow&&e.onShow({$element:t}),t.trigger("lightboxvisible");var r=t.children(".lightbox"),i=t.parents();e.backup={overflow:a._.filter(i,function(e){return"visible"!==s.$(e).css("overflow-x")||"visible"!==s.$(e).css("overflow-y")}),zIndex:a._.map(i,function(e){var t="";return s.$(e).attr("style")&&-1!==s.$(e).attr("style").indexOf("z-index")&&(t=s.$(e).css("z-index")),{element:s.$(e),index:t}})},e.backup.overflow.forEach(function(e){s.$(e).css({overflow:"visible"})}),e.backup.zIndex.forEach(function(e){e.element.css("z-index",99999)}),setTimeout(function(){0===t.parents("header.main").length&&s.$("body").addClass("lightbox-opened"),r.fadeIn()},100),s.$("body").css({overflow:"hidden"})}else{var u=!0;s.$("lightbox .lightbox").each(function(e,n){n!==t.children(".lightbox")[0]&&"block"===s.$(n).css("display")&&(u=!1)}),u&&(s.$("body").removeClass("lightbox-opened"),s.$("body").css({overflow:"auto"})),e.backup&&(e.backup.overflow.forEach(function(e){s.$(e).css("overflow","")}),e.backup.zIndex.forEach(function(e){e.element.css("z-index",e.index)})),t.children(".lightbox").fadeOut(),s.$("body").css({overflow:"auto"}),s.$("body").removeClass("lightbox-opened")}}),e.$on("$destroy",function(){t.parents("lightbox").length||(s.$("body").removeClass("lightbox-opened"),s.$("body").css({overflow:"auto"}),e.backup&&(a._.forEach(e.backup.overflow,function(e){s.$(e).css("overflow","")}),a._.forEach(e.backup.zIndex,function(e){e.element.css("z-index",e.index)})))}),[2]}})})}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(1);t.placedBlock=r.ng.directive("placedBlock",function(){return{restrict:"E",replace:!0,transclude:!0,scope:{x:"=",y:"=",z:"=",h:"=",w:"=",transformX:"=?",transformY:"=?",transformZ:"=?",ratio:"@"},template:"<article ng-transclude ng-style=\"{'z-index': z }\"></article>",link:function(e,t){e.$safeApply=function(e){var t=this.$root&&this.$root.$$phase;"$apply"==t||"$digest"==t?e&&"function"==typeof e&&e():this.$apply(e)},t.css({position:"absolute"});var n=function(r){var i=null!=e.transformX?e.transformX(parseInt(r),!1):parseInt(r);null==i?window.setTimeout(function(){n(r)}):t.offset({top:t.offset().top,left:i+t.parents(".drawing-zone").offset().left},0)};e.$watch("x",n);var r=function(n){var i=null!=e.transformY?e.transformY(parseInt(n),!1):parseInt(n);null==i?window.setTimeout(function(){r(n)},0):t.offset({left:t.offset().left,top:i+t.parents(".drawing-zone").offset().top})};e.$watch("y",r),e.$watch("z",function(n){t.css({"z-index":null!=e.transformZ?e.transformZ(e.z):e.z})});var o=function(){i.$(":focus").blur(),void 0!==e.z&&(t.parents(".drawing-zone").find("article[draggable]").each(function(t,n){var r=i.$(n).css("z-index");e.z||(e.z=1),parseInt(r)&&parseInt(r)>=e.z&&(e.z=parseInt(r)+1)}),e.z&&e.$apply("z"))};t.on("startDrag",function(){o(),t.addClass("placed-block--dragging")}),t.on("startResize",function(){e.w=t.width(),e.$apply("w"),e.h=t.height(),e.$apply("h"),o()});var s=function(){e.x=t.position().left,e.y=t.position().top,null!=e.transformX&&(e.x=e.transformX(e.x,!0)),null!=e.transformY&&(e.y=e.transformY(e.y,!0)),e.$apply()};t.on("stopDrag",function(){s(),t.removeClass("placed-block--dragging")}),t.on("resizing",function(n){e.$emit("resizing",{target:t.get(0),w:t.width(),h:t.height()})}),t.on("stopResize",function(){e.w=t.width(),e.$apply("w"),e.h=t.height(),e.$apply("h"),s()}),e.$watch("w",function(n){t.width(n),e.ratio&&(e.h=e.w/e.ratio,e.$safeApply("h"))}),e.$watch("h",function(n){t.height(n),e.ratio&&(e.w=e.h*e.ratio,e.$safeApply("w"))}),e.$watch("ratio",function(t){t&&(console.log("new ratio",t),e.h=e.w/t,e.$safeApply("h"))})}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(1),o=n(37),s=n(6),a=n(3),u=n(34),c=n(962),l=n(4);t.pulsar=r.ng.directive("pulsar",["$compile",function(e){return{restrict:"A",scope:!0,link:function(t,n,r){function d(){m.find("button").css("pointer-events","none"),i.$(window).off("resize.placeLayers"),p.fadeOut("slow",function(){p.remove()}),m.fadeOut("slow",function(){m.remove()}),i.$(".pulsar-layer").remove(),i.$("body").off("scroll touchmove mousewheel"),i.$("body").css("pointer-events","");p.data("active",!1)}if(!(i.$(window).width()<=s.ui.breakpoints.tablette)&&o.model.me.hasWorkflow("org.entcore.portal.controllers.PortalController|quickstart")){var h=t.$eval(r.pulsar);if(!o.model.me.hasWorkflow(h.workflow))return void n.removeAttr("pulsar");if(h.workflow&&!o.model.me.hasWorkflow(h.workflow))return void n.data("skip-pulsar","true");t.pulsarInfos=h,t.pulsarInfos.steps=[];var f=i.$("[pulsar]");f.each(function(e,n){var r=angular.element(n).scope().$eval(i.$(n).attr("pulsar"));r.el=n,t.pulsarInfos.steps.push(r)}),"object"==typeof h&&void 0!==h.index||console.error("Invalid pulsar object. Should look like pulsar=\"{ index: 0, i18n: 'my.key', position: 'top bottom'}\"");var p,m,_=function(){h.position||(h.position="center center");var r="center";-1!==h.position.indexOf("left")&&(r="left"),-1!==h.position.indexOf("right")&&(r="right");var o="center";-1!==h.position.indexOf("top")&&(o="top"),-1!==h.position.indexOf("bottom")&&(o="bottom"),p=i.$('<div class="pulsar-button"><div class="pulse"></div><div class="pulse2"></div><div class="pulse-spot"></div></div>').appendTo("body"),h.className&&h.className.split(" ").forEach(function(e){p.addClass(e)}),p.data("active",!0);var s=!0,c=function(){var e=0,t=0;h.delta&&(h.delta=a.idiom.translate(h.delta),e=parseInt(h.delta.split(" ")[0]),t=parseInt(h.delta.split(" ")[1]));var u={left:n.offset().left-45,right:n.offset().left+n.width()+5,center:n.offset().left+n.width()/2-20},l={top:n.offset().top,bottom:n.offset().top+n.height()+5,center:n.offset().top+n.height()/2-20};if("top center"===h.position&&(l.top=n.offset().top-40-5),"none"!==p.css("display")&&p.offset({left:parseInt(u[r]+e),top:parseInt(l[o]+t)}),m&&m.find(".arrow").length){var d=u[r]-m.children(".content").width()-20,f=l[o]-10;"top"===o&&"center"===r&&(f=l[o]-m.children(".content").height()-20),"center"===o&&(f=l[o]-m.children(".content").height()/2),"center"===r&&(d=u[r]-m.children(".content").width()/2-2),"center"===o&&"center"===r&&(m.addClass("middle"),o="bottom"),"right"===r&&(d=u[r]+10+10),"bottom"===o&&(f="center"===r?l[o]+10+10:l[o]-15);var _=f,v=d,y=v+m.width()+15,g=_+m.height()+15,b=i.$(window).width()-(m.width()+15),w=i.$(window).height()-(m.height()+15),M=v-b,k=15-v,L=_-w,x=15-_,Y=m.find(".arrow"),T=Y.position().left,S=Y.position().top;y>i.$(window).width()&&(d=i.$(window).width()-(m.width()+15),"center"===r&&s&&(Y.css({left:T+M,right:"auto"}),s=!1)),d<=15&&(d=15,"center"===r&&s&&(Y.css({left:k+10,right:"auto"}),s=!1)),g>i.$(window).height()&&(f=w,"bottom"===o&&s&&(Y.css({top:L+5,bottom:"auto"}),s=!1)),f<15&&(f=15,"center"===o&&"center"!==r&&s&&(Y.css({top:S-x,bottom:"auto"}),s=!1)),m.offset({left:parseInt(d+e),top:parseInt(f+t)})}setTimeout(c,100)};c();var l=function(){i.$(".pulsar-layer").remove();var e="[pulsar-highlight="+h.index+"]",t=i.$("body").find(e);if(0!==t.length)var r=t;if(!r)var r=n;i.$('<div class="pulsar-layer"></div>').width(r.outerWidth()+20).height(r.outerHeight()+20).offset({top:r.offset().top-10,left:r.offset().left-10}).css({position:"absolute"}).hide().appendTo("body").fadeIn("slow")};p.on("click",function(){i.$("body").css("pointer-events","none"),i.$("body").on("scroll touchmove mousewheel",function(e){return e.preventDefault(),e.stopPropagation(),!1}),t.pulsarInfos.steps=[],f=i.$("[pulsar]"),f.each(function(e,n){var r=angular.element(n).scope().$eval(i.$(n).attr("pulsar"));r.el=n,t.pulsarInfos.steps.push(r)}),m=i.$("<pulsar></pulsar>").addClass(r).addClass(o),h.className&&h.className.split(" ").forEach(function(e){m.addClass(e)}),p.hide(),l(),i.$(window).on("resize.placeLayers",l),u.http().get("/infra/public/template/pulsar.html").done(function(n){m.html(e(n)(t))}),i.$("body").append(m)})};i.$(window).on("resize",function(){p&&(i.$(window).width()<=s.ui.breakpoints.tablette?p.hide():p.data("active")&&p.show())}),t.closePulsar=function(){if(m&&p){m.fadeOut(0,function(){m.remove()}),p.removeClass("hidden"),i.$(".pulsar-layer").fadeOut(0,function(){i.$(".pulsar-layer").remove()}),i.$("body").off("scroll touchmove mousewheel"),i.$("body").css("pointer-events","");p.data("active",!1)}},i.$(document).on("click",function(e){i.$(e.target).parents("pulsar").length>0||i.$(e.target).parents(".pulsar-button").length>0||i.$(e.target).hasClass("pulsar-button")||t.closePulsar()}),t.paintPulsar=function(){_(),p.trigger("click")},t.isLastStep=function(){return void 0===l._.find(t.pulsarInfos.steps,function(e){return e.index>t.pulsarInfos.index})},t.goTo=function(e){d(),c.quickstart.goToAppStep(e.index),angular.element(e.el).scope().paintPulsar()},t.next=function(){d();var e=c.quickstart.nextAppStep();if(void 0===l._.findWhere(t.pulsarInfos.steps,{index:e}))return void(void 0!==l._.find(t.pulsarInfos.steps,function(t){return t.index>e})&&t.next());for(var n=0;n<t.pulsarInfos.steps.length;n++){var r=t.pulsarInfos.steps[n];if(r.index===e){if(i.$(r.el).data("skip-pulsar"))return void t.next();angular.element(r.el).scope().paintPulsar()}}},t.previous=function(){d();var e=c.quickstart.previousAppStep();if(void 0===l._.findWhere(t.pulsarInfos.steps,{index:e}))return void(void 0!==l._.find(t.pulsarInfos.steps,function(t){return t.index<e})&&t.previous());for(var n=0;n<t.pulsarInfos.steps.length;n++){var r=t.pulsarInfos.steps[n];if(r.index===e){if(i.$(r.el).data("skip-pulsar"))return void t.previous();angular.element(r.el).scope().paintPulsar()}}},c.quickstart.load(function(){c.quickstart.appIndex()===h.index&&_()})}}}}])},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(37),s=n(943),a=n(1012),u=n(390),c=n(955);t.recorderComponent=s.ng.directive("recorder",function(){function e(e,t){var n=e.$root.$$phase;"$apply"==n||"$digest"==n?t&&"function"==typeof t&&t():e.$apply(t)}return{restrict:"E",scope:{format:"@",onUpload:"&"},templateUrl:function(e,t){return t.templateUrl||"/assets/js/entcore/template/recorder.html"},link:function(t,n,s){var l=this;t.showCamera=!1,t.isVideoCompatible=function(){return c.VideoRecorder.isCompatible()&&o.model.me.hasWorkflow("com.opendigitaleducation.video.controllers.VideoController|capture")},t.isVideoCompatible()&&(t.onShowCamera=function(){return r(l,void 0,void 0,function(){function n(e){void 0===e&&(e=null);try{r.forEach(function(e){return"function"==typeof e&&e()})}finally{t.showCamera=!1}}var r;return i(this,function(i){switch(i.label){case 0:return r=[t.$on("video-upload",function(e,t){return n(t)}),t.$on("video-redo",function(e){return n()})],[4,u.template.open("entcore/video/record")];case 1:return i.sent(),t.showCamera=!0,e(t),[2]}})})}),t.recorder=a.recorder;var d=a.recorder.state(function(n){if(n.startsWith("saved-")){var r=n.substring(6);t.onUpload&&t.onUpload()(r)}e(t)});t.$on("$destroy",function(){d()}),t.switchRecord=function(){"recording"===a.recorder.status?a.recorder.suspend():a.recorder.record()},t.time=function(){var e=parseInt(a.recorder.elapsedTime/60);e<10&&(e="0"+e);var t=parseInt(a.recorder.elapsedTime%60);return t<10&&(t="0"+t),e+":"+t},t.switchPlay=function(){"playing"===a.recorder.status?a.recorder.pause():a.recorder.play()},t.saveRecord=function(){a.recorder.save()},t.redo=function(){a.recorder.flush(),a.recorder.record()},t.isIdle=function(){return"idle"===a.recorder.status},t.isPreparing=function(){return"preparing"===a.recorder.status},t.isRecording=function(){return"recording"===a.recorder.status},t.isSuspended=function(){return"suspended"===a.recorder.status},t.isPaused=function(){return"paused"===a.recorder.status},t.isPlaying=function(){return"playing"===a.recorder.status},t.isStopped=function(){return"stop"===a.recorder.status},t.isEncoding=function(){return"encoding"===a.recorder.status},t.isUploading=function(){return"uploading"===a.recorder.status},t.showActionButtons=function(){return a.recorder.elapsedTime>0&&"stop"!==a.recorder.status&&!t.showCamera}}}})},function(e,t,n){"use strict";function r(){return i(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return l?[3,2]:[4,u.httpPromisy().get("/infra/public/js/zlib.min.js")];case 1:l=e.sent(),e.label=2;case 2:return[2,l]}})})}var i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(916),a=n(3),u=n(34),c=n(35),l=null,d={getUserMediaLegacy:navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,getUserMedia:navigator.mediaDevices&&navigator.mediaDevices.getUserMedia,AudioContext:window.AudioContext||window.webkitAudioContext};t.recorder=function(){function e(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})}function t(t){var n="https:"===window.location.protocol?"wss":"ws",r=window.location.host;return"localhost:8090"===window.location.host&&(r="localhost:6502"),n+"://"+r+"/audio/"+e()+"?sampleRate="+t}function n(){var e=b.length;e>L&&(x.postMessage(["init",f.sampleRate]),x.postMessage(["chunk",g.slice(L,e),b.slice(L,e),(e-L)*w]),x.onmessage=function(e){if(!v)return void _.send(e.data);var t=parseInt(performance.now()),n=new Zlib.Deflate(e.data);_.send(n.compress()),parseInt(performance.now())-t>50&&(v=!1,_.send("rawdata"))},L=e)}function u(){_&&1===_.readyState&&_.close(),l()}function l(){_=null,g=[],b=[],L=0}function h(e,t){Y.forEach(function(n){"function"==typeof n&&n(e,t)})}var f,p,m,_=null,v=!0,y=new Audio,g=[],b=[],w=4096,M=!1,k=0,L=0,x=new Worker("/infra/public/js/audioEncoder.js"),Y=[];return{elapsedTime:0,loadComponents:function(){var e=this;this.title=a.idiom.translate("recorder.filename")+s.moment().format("DD/MM/YYYY"),M=!0;var t=function(t){f=new d.AudioContext,x.postMessage(["init",f.sampleRate]);var r=f.createMediaStreamSource(t);p=f.createGain(),r.connect(p),m=f.createScriptProcessor(w,2,2),m.onaudioprocess=function(e){if("recording"===this.status){var t=new Float32Array(e.inputBuffer.getChannelData(0));g.push(t);var r=new Float32Array(e.inputBuffer.getChannelData(1));b.push(r),k+=w,this.elapsedTime+=e.inputBuffer.duration,n(),h(this.status)}}.bind(e),p.connect(m),m.connect(f.destination)};void 0!==d.getUserMedia?d.getUserMedia.call(navigator.mediaDevices,{audio:!0}).then(t).catch(function(e){console.log("err:",e)}):void 0!==d.getUserMediaLegacy&&d.getUserMediaLegacy({audio:!0},t,function(e){console.log("err:",e)})},isCompatible:function(){return void 0!==d.AudioContext&&(void 0!==d.getUserMedia||void 0!==d.getUserMediaLegacy)},stop:function(){_&&_.send("cancel"),this.status="idle",y.pause(),y.currentTime>0&&(y.currentTime=0),g=[],b=[],h(this.status)},flush:function(){this.stop(),this.elapsedTime=0,g=[],b=[],h(this.status)},record:function(){return i(this,void 0,void 0,function(){var e,n=this;return o(this,function(s){switch(s.label){case 0:return y.pause(),(e=this,"preparing"==e.status)?[2]:(e.status="preparing",[4,r()]);case 1:return s.sent(),_?(e.status="recording",h(e.status),M||e.loadComponents()):(_=new WebSocket(t((new d.AudioContext).sampleRate)),_.onopen=function(){y.currentTime>0&&(y.currentTime=0),e.status="recording",h(e.status),v||_.send("rawdata"),M||e.loadComponents()},_.onerror=function(t){console.log(t),e.status="stop",h(e.status),u(),c.notify.error(t.error)},_.onmessage=function(e){return i(n,void 0,void 0,function(){var t,n,r,i;return o(this,function(o){switch(o.label){case 0:return e.data&&e.data.indexOf&&"function"==typeof e.data.indexOf&&-1!==e.data.indexOf("error")?(console.log(e.data),u(),c.notify.error(e.data),[3,3]):[3,1];case 1:return e.data&&e.data.text&&"function"==typeof e.data.text&&"encoding"===this.status?(r=(n=JSON).parse,[4,e.data.text()]):[3,3];case 2:t=r.apply(n,[o.sent()]),"ok"===t.status?(u(),c.notify.info("recorder.saved"),i=t.docId,h("saved-"+i),this.elapsedTime=0):(console.log(e.data),u(),c.notify.error(e.data)),o.label=3;case 3:return[2]}})})},_.onclose=function(t){e.status="stop",e.elapsedTime=0,h(e.status),l()}),[2]}})})},suspend:function(){this.status="suspended",y.pause(),h(this.status)},pause:function(){this.status="paused",y.pause(),h(this.status)},play:function(){this.pause(),this.status="playing";var e=new Worker("/infra/public/js/audioEncoder.js");e.postMessage(["init",f.sampleRate]),e.postMessage(["wav",b,g,k]),e.onmessage=function(e){y.src=window.URL.createObjectURL(e.data),y.play()},h(this.status)},state:function(e){return Y.push(e),function(){Y=Y.filter(function(t){return t!==e})}},title:"",status:"idle",save:function(){n(),_.send("save-"+this.title),this.status="encoding",h(this.status)},mute:function(e){p.gain.value=e?0:1}}}(),window.entcore||(window.entcore={}),window.entcore.recorder=t.recorder},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388);t.removableList=r.ng.directive("removableList",function(){return{restrict:"E",template:'\n <div class="row info" ng-if="ngModel.length === 0"><i18n>[[ noitems ]]</i18n></div>\n <div ng-show="ngModel.length > 0">\n <div class="search-pagination flex-row align-center">\n <div class="cell twelve">\n <input class="twelve" \n type="text" \n ng-model="searchText"\n placeholder="[[ placeholder ]]"\n ng-keypress="preventKeyEnter($event)"/>\n <i class="search"></i>\n </div>\n </div>\n <div class="spacer-small"></div>\n <nav class="removable-list wrapper left-text" ng-show="filteredItems.length > 0">\n <div class="row big-block-container" \n ng-repeat="item in filteredItems = (ngModel | filter:filterByName)" \n ng-click="selectItem({item: item})"\n ng-class="{ \'active\': item.id === selectedItem.id }">\n <span class="block cell-ellipsis right-spacing-twice">[[ item.name ]]</span>\n <i class="trash right-spacing-twice vertical-spacing-four absolute-magnet only-desktop" \n ng-click="deleteItem({item: item}); $event.stopPropagation();" \n ng-if="removable"></i>\n </div>\n </nav>\n <div ng-show="filteredItems.length === 0"><span class="medium-importance"><i18n>[[ noresult ]]</i18n></span></div>\n </div>\n ',scope:{ngModel:"=",selectedItem:"=",selectItem:"&",deleteItem:"&"},link:function(e,t,n){e.placeholder=n.placeholder,e.noitems=n.noitems,e.noresult=n.noresult,e.removable=!r.angular.isUndefined(n.deleteItem),e.searchText="",e.filterByName=function(t){return t.name||(t.name=""),t.name.toLowerCase().includes(e.searchText.toLowerCase())},e.preventKeyEnter=function(e){13===e.which&&e.preventDefault()}}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(37);t.resourceRight=r.ng.directive("resourceRight",["$parse",function(e){return{restrict:"EA",template:"<div ng-transclude></div>",replace:!1,transclude:!0,compile:function(t,n,r){return function(t,n,r){var o=e(r.resource);if(void 0===r.name)throw"Right name is required";var s=(n.children("div"),function(){var e=!0;void 0!==o(t)&&(e=r.name&&(o(t)instanceof Array&&void 0!==o(t).find(function(e){return!e.myRights||!0!==e.myRights[r.name]&&!(e.myRights[r.name]&&e.myRights[r.name].right)})||o(t)instanceof i.Model&&(!o(t).myRights||void 0===o(t).myRights[r.name])||void 0!==o(t).myRights&&void 0===o(t).myRights[r.name])),e?n.hide():n.show()});r.$observe("name",function(){return s()}),t.$watch(function(){return o(t)},function(){return s()}),t.$watch(function(){return o(t)&&o(t).myRights},function(){return s()})}}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388);t.searchModule=r.ng.directive("searchModule",["$window",function(e){return{restrict:"E",transclude:!0,template:'\n <form name="searchForm" ng-submit="search()" novalidate>\n <article class="twelve cell reduce-block-six">\n <pastilles \n ng-model="ngModel"\n images="images">\n </pastilles>\n <ng-transclude></ng-transclude>\n </article>\n </form>\n ',scope:{ngModel:"=",ngChange:"&",search:"&"},link:function(t,n,i){var o="string"==typeof i.images?JSON.parse(i.images):i.images,s="string"==typeof i.i18n?JSON.parse(i.i18n):i.i18n;Array.isArray(s)||(s=[s]);var a,u=n.find("ng-transclude").children(),c=u.length;for(t.images=[],a=0;a<c;a++)t.images[a]={img:o[a],visible:!0,i18n:s[a]};var l=function(){for(a=0;a<c;a++)u.eq(a).hide()};l();var d=function(){for(a=0;a<c;a++)t.images[a].visible="none"!==u.eq(a).children().eq(0).css("display");t.$apply()};t.$watch("ngModel",function(e){l(),u.eq(e).show(),t.ngChange({index:e})}),r.angular.element(e).bind("resize",function(){d()}),setTimeout(function(){d()},0)}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(3),o=n(1);t.selectList=r.ng.directive("selectList",function(){return{restrict:"E",transclude:!0,scope:{displayAs:"@",placeholder:"@",display:"="},template:'<div class="selected-value">[[showValue()]]</div><div class="options hidden" ng-transclude></div>',link:function(e,t,n){e.showValue=function(){return e.display?e.displayAs?i.idiom.translate(e.display[e.displayAs]):i.idiom.translate(e.display):i.idiom.translate(e.placeholder)},t.children(".options").on("mouseover",function(e){e.stopPropagation()}),t.children(".selected-value").on("click",function(){t.children(".options").hasClass("hidden")?(setTimeout(function(){t.parent().css({"z-index":9999}),t.parents("editor-toolbar").each(function(e,t){o.$(t).css({"margin-top":"-"+t.scrollTop+"px","min-height":"0",height:"auto"})}),t.parents().css({overflow:"visible"})},0),t.children(".options").removeClass("hidden"),t.children(".options").height(t.children(".options")[0].scrollHeight)):(t.parent().css({"z-index":""}),t.parents().css({overflow:""}),t.parents("editor-toolbar").each(function(e,t){o.$(t).css({"margin-top":"","min-height":"",height:""})}),t.children(".options").addClass("hidden"))}),o.$("body").click(function(e){e.target===t.find(".selected-value")[0]||t.children(".options").hasClass("hidden")||(0===t.parents("lightbox").length&&(t.parent().css({"z-index":""}),t.parents().css({overflow:""})),t.parents("editor-toolbar").each(function(e,t){o.$(t).css({"margin-top":"","min-height":"",height:""})}),t.children(".options").addClass("hidden"))})}}})},function(e,t,n){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(2),a=n(943),u=n(38),c=n(34),l=n(3),d=n(4),h=n(37),f=n(37),p=n(937),m=n(35),_=n(6),v=n(386);t.sharePanel=a.ng.directive("sharePanel",["$rootScope",function(e){return{scope:{resources:"=",appPrefix:"=",onCancel:"&?",onSubmit:"&?",onValidate:"&?",onFailure:"&?",onFeed:"&?",closeDelegate:"&?",confirmationCloseDelegate:"&?",canEditDelegate:"&?",autoClose:"="},restrict:"E",templateUrl:"/assets/js/entcore/template/share-panel.html",link:function(t,n,a){function y(){v.Behaviours.loadBehaviours(u.appPrefix,function(){v.Behaviours.applicationsBehaviours[u.appPrefix]&&v.Behaviours.applicationsBehaviours[u.appPrefix].share&&"function"==typeof v.Behaviours.applicationsBehaviours[u.appPrefix].share&&(t.shareOverrideDefaultActions=v.Behaviours.applicationsBehaviours[u.appPrefix].share().overrideDefaultActions)})}function g(e){var n=[];return d._.where(t.actions,{displayName:e}).forEach(function(e){e.name.forEach(function(e){n.push(e)})}),n}function b(e,n){var r={};return e.forEach(function(e){var n=d._.find(t.actions,function(t){return-1!==t.name.indexOf(e)});n&&(r[n.displayName]||(r[n.displayName]=!0))}),r}function w(e){t.actions=e,t.actions.forEach(function(e){var t=e.displayName.split(".")[1];Y[t]&&(e.priority=Y[t].priority,e.requires=Y[t].requires)})}function M(e,t){function n(n){for(var i in e[n].checked){if(!t[n].checked[i])return!0;e[n].checked[i].forEach(function(e){r=r||-1===t[n].checked[i].indexOf(e)})}return r}var r=!1;return n("users")||n("groups")}var k=u.appPrefix,L={},x=function(e,n,r){a.onFeed&&t.onFeed({$data:e,$resource:n,$actions:r})};if(t.display={showSaveSharebookmarkInput:!1,sharebookmarkSaved:!1,workflowAllowSharebookmarks:!1,showCloseConfirmation:!1,showBookmarkMembers:!1,search:{processing:!1}},function(){i(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,f.model.me.workflow.load(["directory"])];case 1:return e.sent(),t.display.workflowAllowSharebookmarks=f.model.me.workflow.directory.allowSharebookmarks,t.$apply(),[2]}})})}(),t.appPrefix&&(k=t.appPrefix),c.http().get(u.appPrefix+"/config/share").done(function(e){e&&e.overrideDefaultActions?t.shareOverrideDefaultActions=e.overrideDefaultActions:y()}).e404(function(e){y()}),t.shareTable="/assets/js/entcore/template/share-panel-table.html",!(t.resources instanceof Array||t.resources.myRights||t.resources instanceof h.Model))throw new TypeError("Resources in share panel must be instance of Array or implement Rights interface");t.resources instanceof Array||(t.resources=[t.resources]),t.sharing={},t.found=[],t.maxResults=5,t.editResources=[],t.sharingModel={edited:[],changed:!1},t.canEdit=function(e){return!a.canEditDelegate||t.canEditDelegate({$item:e})},t.addResults=function(){t.maxResults+=5};var Y={};c.http().get("/"+u.infraPrefix+"/public/json/sharing-rights.json").done(function(e){Y=e,t.actions&&w(t.actions)}),t.translate=l.idiom.translate;var T=!1,S=function(){if(!T){T=!0;var e=!0;t.resources.length||(T=!1),t.resources.forEach(function(n){var i=n._id;c.http().get("/"+k+"/share/json/"+i+"?search=").done(function(i){function o(n){for(var i in s[n].checked){var o=s[n].checked[i],a=b(o),u=d._.findWhere(s[n].visibles,{id:i});if(u){var c=r({},u);c.actions=a,e&&t.sharingModel.edited.push(c),c.index=t.sharingModel.edited.length}}if(s[n].checkedInherited){var l=s[n].checkedInherited;for(var i in l){var o=l[i],a=b(o),u=d._.findWhere(s[n].visibles,{id:i});if(u){var c=r({},u);c.actions=a,e&&t.sharingModel.editedInherited.push(c),c.index=t.sharingModel.editedInherited.length}}}}x(i,n,i.actions),e&&(i.users.visibles.map(function(e){return e.type="user"}),i.groups.visibles.map(function(e){return e.type="group"}),t.sharingModel=i,t.sharingModel.edited=[],t.sharingModel.editedInherited=[]),i._id=n._id,t.editResources.push(i);var s=t.editResources[t.editResources.length-1];t.sharing.actions||w(i.actions),o("groups"),o("users"),e||(M(s,t.sharingModel)||M(t.sharingModel,s))&&(t.varyingRights=!0,t.sharingModel.edited=[],t.varyingRightsI18nKey=l.idiom.translate(k+".share.varyingrights")===k+".share.varyingrights"?"share.varyingrights":k+".share.varyingrights"),e=!1,t.$apply("sharingModel.edited"),T=!1})})}};t.canShowMore=function(){var e=0;return t.sharingModel.edited&&t.sharingModel.edited.length&&(e+=t.sharingModel.edited.length),t.sharingModel.editedInherited&&t.sharingModel.editedInherited.length&&(e+=t.sharingModel.editedInherited.length),e>t.maxEdit},t.isSubmitDisabled=function(){for(var e=!1,n=0,r=t.sharingModel.edited;n<r.length;n++){for(var i=r[n],o=!0,s=0,a=t.actions;s<a.length;s++){var u=a[s];i.actions[u.displayName]&&(o=!1)}o&&(e=!0)}return!t.sharingModel.changed||e},t.$watch("resources",function(){t.actions=[],t.sharingModel.edited=[],t.search="",t.found=[],t.varyingRights=!1,t.sharingModel.changed=!1,t.display.showSaveSharebookmarkInput=!1,t.display.sharebookmarkSaved=!1,t.maxEdit=3,t.maxResults=5,S()}),t.$watchCollection("resources",function(){t.actions=[],t.sharingModel.edited=[],t.search="",t.found=[],t.varyingRights=!1,t.sharingModel.changed=!1,t.display.showSaveSharebookmarkInput=!1,t.display.sharebookmarkSaved=!1,t.maxEdit=3,t.maxResults=5,S()}),t.addEdit=function(e){e.actions={},t.sharingModel.edited.push(e),e.index=t.sharingModel.edited.length;var n=t.found.indexOf(e);t.found.splice(n,1);var r=[];t.actions.forEach(function(n){var i=n.displayName.split(".")[1];t.shareOverrideDefaultActions?(t.shareOverrideDefaultActions.forEach(function(t){return e.actions[t]=!0}),r=t.shareOverrideDefaultActions):Y[i].default&&(e.actions[n.displayName]=!0,r.push(n))}),"sharebookmark"==e.type&&c.http().get("/directory/sharebookmark/"+e.id).done(function(n){e.users=n.users,e.groups=n.groups,e.users&&e.users.forEach(function(e){e.type="sharebookmark-user",e.actions={},r.forEach(function(t){e.actions[t]=!0})}),e.groups&&e.groups.forEach(function(e){e.type="sharebookmark-group",e.actions={},r.forEach(function(t){e.actions[t]=!0})}),t.$apply()}),t.sharingModel.changed=!0,t.display.showSaveSharebookmarkInput=!1,t.display.sharebookmarkSaved=!1},t.clearSearch=function(){t.sharingModel.groups=[],t.sharingModel.users=[],t.found=[]},t.findUserOrGroup=function(){var e=l.idiom.removeAccents(t.search).toLowerCase(),n=p.Me.session.functions.ADMIN_LOCAL?e.substr(0,3):"";if(!(L[n]||L[n]&&L[n].loading)){L[n]={loading:!0};var r=t.resources[0]._id,i="/"+k+"/share/json/"+r+"?search="+n;return n||(i="/"+k+"/share/json/"+r),void c.http().get(i).done(function(e){e.users.visibles.map(function(e){return e.type="user"}),e.groups.visibles.map(function(e){return e.type="group"}),L[n]={groups:e.groups,users:e.users},t.sharingModel.groups=L[n].groups,t.sharingModel.users=L[n].users,1==f.model.me.workflow.directory.allowSharebookmarks?c.http().get("/directory/sharebookmark/all").done(function(e){var r=d._.map(e,function(e){return e.type="sharebookmark",e});L[n].sharebookmarks=r,t.findUserOrGroup(),t.$apply()}):(t.findUserOrGroup(),t.$apply())})}t.sharingModel.groups=L[n].groups,t.sharingModel.users=L[n].users,t.sharingModel.sharebookmarks=L[n].sharebookmarks,t.found=d._.union(d._.filter(t.sharingModel.sharebookmarks,function(n){return-1!==l.idiom.removeAccents(n.name).toLowerCase().indexOf(e)&&void 0===t.sharingModel.edited.find(function(e){return e.id===n.id})}),d._.filter(null==t.sharingModel.groups?[]:t.sharingModel.groups.visibles,function(n){return-1!==l.idiom.removeAccents(n.name).toLowerCase().indexOf(e)&&void 0===t.sharingModel.edited.find(function(e){return e.id===n.id})}),d._.filter(null==t.sharingModel.users?[]:t.sharingModel.users.visibles,function(n){var r=l.idiom.removeAccents(n.lastName+" "+n.firstName).toLowerCase(),i=l.idiom.removeAccents(n.firstName+" "+n.lastName).toLowerCase(),o=l.idiom.removeAccents(n.username).toLowerCase();return-1!==r.indexOf(e)||-1!==i.indexOf(e)||-1!==o.indexOf(e)&&void 0===t.sharingModel.edited.find(function(e){return e.id===n.id})})),t.found=d._.filter(t.found,function(e){return-1===t.sharingModel.edited.findIndex(function(t){return t.id===e.id})}),t.display.search.processing=!1,t.$apply()},t.remove=function(e){t.sharingModel.edited=d._.reject(t.sharingModel.edited,function(t){return t.id===e.id}),t.sharingModel.changed=!0,t.display.showSaveSharebookmarkInput=!1,t.display.sharebookmarkSaved=!1},t.maxEdit=3,t.displayMore=function(){t.maxEdit+=5},t.changeAction=function(e,n){function r(e,n){e.actions[n.displayName]?n.requires.forEach(function(n){var r=d._.find(t.actions,function(e){return-1!==e.displayName.split(".")[1].indexOf(n)});r&&(e.actions[r.displayName]=!0)}):d._.filter(t.actions,function(e){return void 0!==d._.find(e.requires,function(e){return-1!==n.displayName.split(".")[1].indexOf(e)})}).forEach(function(t){t&&(e.actions[t.displayName]=!1)})}if("sharebookmark"==e.type&&(e.users.forEach(function(t){t.actions[n.displayName]=e.actions[n.displayName],r(t,n)}),e.groups.forEach(function(t){t.actions[n.displayName]=e.actions[n.displayName],r(t,n)})),"sharebookmark-user"==e.type||"sharebookmark-group"==e.type){var i=t.sharingModel.edited.find(function(t){return t.id==e.id});i?(i.actions=e.actions,i.hide=!0):(e.hide=!0,t.sharingModel.edited.push(e))}r(e,n),t.sharingModel.changed=!0},t.share=function(){return i(this,void 0,void 0,function(){var n,r,s,u,l,d;return o(this,function(h){switch(h.label){case 0:t.sharingModel.changed=!1,n={},r={},s={},u={},t.sharingModel.edited.forEach(function(e){var t=[];for(var n in e.actions)e.actions.hasOwnProperty(n)&&1==e.actions[n]&&(t=t.concat(g(n)));"sharebookmark"==e.type?u[e.id]=t:"user"==e.type||"sharebookmark-user"==e.type?r[e.id]=t:s[e.id]=t}),n.users=r,n.groups=s,n.bookmarks=u,l=t.resources.map(function(s){return i(this,void 0,void 0,function(){var i,u,l;return o(this,function(o){switch(o.label){case 0:if(s.myRights&&(void 0!=s.myRights.share||void 0!=s.myRights.manage||void 0!=s.myRights.manager)&&s.shared&&(i=[],(u=s.shared.find(function(e){return e.userId==f.model.me.userId}))&&(Object.keys(u).forEach(function(e){1==u[e]&&"userId"!=e&&i.push(e)}),r[f.model.me.userId]=i,n.users=r)),!a.onValidate)return[3,4];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,t.onValidate({$data:n,$resource:s,$actions:t.actions})];case 2:return o.sent(),[3,4];case 3:return l=o.sent(),[2,Promise.reject(l)];case 4:return[2,new Promise(function(t,r){c.http().putJson("/"+k+"/share/resource/"+s._id,n).done(function(n){e.$broadcast("share-updated",n["notify-timeline-array"]),t()}).error(function(e){r(e)})})]}})})}),h.label=1;case 1:return h.trys.push([1,3,,4]),[4,Promise.all(l)];case 2:return h.sent(),m.notify.success("share.notify.success"),[3,4];case 3:return d=h.sent(),a.onFailure?t.onFailure({$error:d}):m.notify.error("share.notify.error"),[3,4];case 4:return t.autoClose?[4,t.closePanel(!1)]:[3,6];case 5:h.sent(),h.label=6;case 6:return a.onSubmit&&t.onSubmit({$shared:n}),[2]}})})},t.createSharebookmark=function(e){if(1==f.model.me.workflow.directory.allowSharebookmarks){var n=[];t.sharingModel.edited.forEach(function(e){"user"==e.type||"group"==e.type?n.push(e.id):(e.users&&e.users.forEach(function(e){return n.push(e.id)}),e.groups&&e.groups.forEach(function(e){return n.push(e.id)}))});var r={name:e,members:n};c.http().postJson("/directory/sharebookmark",r).done(function(e){t.display.sharebookmarkSaved=!0,t.$apply()})}},t.typeSort=function(e){return"sharebookmark"==e.type?0:"group"==e.type?1:2};var D=function(){n.closest(".lightbox").first().fadeOut(function(){t.display.showCloseConfirmation=!1}),s("body").css({overflow:"auto"}),s("body").removeClass("lightbox-opened"),n.closest(".lightbox").find(".content > .close-lightbox").css({visibility:"visible"});var e=n.closest("lightbox").isolateScope();e&&(e.$eval(e.onClose),e.show=!1),S(),t.clearSearch(),t.search=""};t.closePanel=function(e){return void 0===e&&(e=!0),i(this,void 0,void 0,function(){return o(this,function(n){return a.closeDelegate?t.closeDelegate({$canceled:e,$close:D}):D(),e&&a.onCancel&&t.onCancel(),[2]})})},t.revertClose=function(){n.closest(".lightbox").find(".content > .close-lightbox").css({visibility:"visible"}),t.display.showCloseConfirmation=!1};var $=function(e){if(e.stopPropagation(),t.sharingModel.changed){if(!t.display.showCloseConfirmation){if(a.confirmationCloseDelegate)return void t.confirmationCloseDelegate({$canceled:!0,$close:D});t.display.showCloseConfirmation=!0,n.closest(".lightbox").find(".content > .close-lightbox").css({visibility:"hidden"}),t.$apply()}}else t.closePanel(!0);t.$apply()};n.closest(".lightbox").find(".background, .content > .close-lightbox").on("click",$),t.getColor=function(e){return _.ui.profileColors.match(e)},t.$on("$destroy",function(){n.closest(".lightbox").find(".background, .content > .close-lightbox").off("click",$)})}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(3),o=n(1),s=n(6);t.slider=r.ng.directive("slider",["$compile","$parse",function(e,t){return{restrict:"E",scope:!0,template:'<div class="label"></div><div class="bar"></div><div class="filled"></div><div class="cursor"></div><legend class="min"></legend><legend class="max"></legend>',link:function(e,n,r){n.addClass("drawing-zone");var a=n.children(".cursor"),u=parseFloat(r.max),c=parseFloat(r.min),l=t(r.ngModel),d=function(e){var t=parseInt((e-c)*n.children(".bar").width()/(u-c));a.css({left:t+"px",position:"absolute"}),n.children(".filled").width(a.position().left),n.children(".label").css({left:t+"px"}),(r.label.indexOf("Mo")>-1||r.label.indexOf("Ko")>-1&&parseInt(r.label.split(" ")[0],10)>500)&&n.children(".label").css({color:"orange"})};o.$(window).on("resize",function(){d(l(e))}),e.$watch(function(){return l(e)},d),r.$observe("label",function(){return n.find(".label").text(r.label)}),"number"!=typeof l(e)&&(l.assign(e,parseInt(r.default)),d(l(e))),n.children("legend.min").html(i.idiom.translate(r.minLegend)),n.children("legend.max").html(i.idiom.translate(r.maxLegend)),n.children(".bar, .filled").on("click",function(t){var r=t.clientX-n.children(".bar").offset().left,i=r*(u-c)/n.children(".bar").width()+c;l.assign(e,i),e.$apply()}),s.ui.extendElement.draggable(a,{lock:{vertical:!0},mouseUp:function(){var t=a.position().left,r=t*(u-c)/n.children(".bar").width()+c;l.assign(e,r),e.$apply()},tick:function(){var e=parseInt(a.position().left);n.children(".filled").width(e),n.children(".label").css({left:e+"px"})}})}}}])},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(388),s=n(7),a=n(37);t.smartBanner=o.ng.directive("smartBanner",function(){return{restrict:"E",template:'\n <div ng-if="showBanner" class="smartbanner">\n <style>\n .smartbanner {\n left:0;\n bottom:0;\n width:100%;\n height:78px;\n background:#fff;\n z-index: 1000000;\n overflow:hidden;\n position: fixed;\n border: 1px solid #ccc;\n margin-bottom: 5px;\n }\n .smartbanner-close {\n position:absolute;\n left:7px;top:7px;\n display:block;\n font-family:\'ArialRoundedMTBold\',Arial;\n font-size:15px;\n text-align:center;\n text-decoration:none;\n border-radius:14px;\n border:0;\n width:17px;\n height:17px;\n line-height:17px;\n color:#b1b1b3;\n background:#efefef;\n }\n .smartbanner-close:active,.smartbanner-close:hover {\n color:#333;\n }\n .smartbanner-icon{\n position:absolute;\n left:30px;\n top:10px;\n display:block;\n width:60px;\n height:60px;\n background-color: #fff;\n background-size:cover;\n }\n .smartbanner-info{\n position:absolute;\n left:98px;\n top:15px;\n width:44%;\n font-size:12px;\n line-height:1.2em;\n font-weight:bold;\n color:#999;\n }\n .smartbanner-title {\n font-size:15px;\n line-height:17px;\n color:#000;\n font-weight:bold;\n }\n .smartbanner-button{\n position:absolute;\n right:20px;\n top:24px;\n padding:0 10px;\n min-width:12%;\n height:24px;\n font-size:14px;\n line-height:24px;\n text-align:center;\n font-weight:bold;\n color:#fff;\n background-color:#b3c833;\n text-decoration:none;\n border-radius:5px;\n }\n \n </style>\n <div class="smartbanner-container">\n <a ng-click="closeBanner()" class="smartbanner-close">&times;</a>\n <img class="smartbanner-icon" ng-src="[[icon]]">\n <div class="smartbanner-info">\n <div class="smartbanner-title"><i18n>smartbanner.name</i18n></div>\n <div><i18n>smartbanner.description</i18n></div>\n </div>\n <a href="[[appRef]]" target="_blank" class="smartbanner-button">\n <span class="smartbanner-button-text"><i18n>smartbanner.action</i18n></span>\n </a>\n </div>\n </div>\n ',scope:{},link:function(e,t,n){e.closeBanner=function(){e.setCookie("test",30),e.showBanner=!1},e.getCookie=function(){for(var e=decodeURIComponent(document.cookie),t=e.split(";"),n=0;n<t.length;n++){for(var r=t[n];" "==r.charAt(0);)r=r.substring(1);if(0==r.indexOf("smartBanner="))return r.substring("smartBanner=".length,r.length)}return null},e.setCookie=function(e,t){var n=new Date;n.setTime(n.getTime()+24*t*60*60*1e3);var r="expires="+n.toUTCString();document.cookie="smartBanner="+e+";"+r},e.showBanner=!1,e.init=function(){return r(this,void 0,void 0,function(){var t,n,r;return i(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,s.default.get("/conf/smartBanner")];case 1:if(t=i.sent(),null!=t.data){if(e.banner=t.data,n=e.banner["excludeUserTypes-"+o.skin.skin]||[],-1!=n.indexOf(a.model.me.type))return[2];e.showBanner=null==e.getCookie(),e.icon=o.idiom.translate("smartbanner.icon.uri"),e.showBanner&&(/Android/i.test(navigator.userAgent)?(e.store=o.idiom.translate("smartbanner.android.store"),e.appRef=o.idiom.translate("smartbanner.android.uri")):/iPhone|iPad|iPod/i.test(navigator.userAgent)?(e.store=o.idiom.translate("smartbanner.ios.store"),e.appRef=o.idiom.translate("smartbanner.ios.uri")):e.showBanner=!1)}return[3,3];case 2:return r=i.sent(),[3,3];case 3:return[2]}})})},e.init()}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(386);t.sniplet=r.ng.directive("sniplet",["$timeout",function(e){return{restrict:"E",scope:!0,template:"<div ng-include=\"'/' + application + '/public/template/behaviours/sniplet-' + template + '.html'\"></div>",link:function(t,n,r){var o=function(){e(function(){i.Behaviours.loadBehaviours(t.application,function(e){var n=(e.sniplets[t.template],e.sniplets[t.template].controller);for(var r in n)t[r]=n[r];"function"==typeof t.init&&t.init()})},10)};r.$observe("application",function(){t.application=r.application,t.source=t.$eval(r.source),o()}),r.$observe("template",function(){t.template=r.template})}}}]),t.snipletSource=r.ng.directive("snipletSource",["$parse","$timeout",function(e,t){return{restrict:"E",scope:!0,template:"<div ng-include=\"'/' + application + '/public/template/behaviours/sniplet-source-' + template + '.html'\"></div>",controller:["$scope","$timeout",function(e,t){e.setSnipletSource=function(t){e.ngModel.assign(e,t),e.ngChange(),e.snipletResource.save()}}],link:function(n,r,o){var s=function(){t(function(){i.Behaviours.loadBehaviours(n.application,function(e){if(e.sniplets[n.template]){var t=e.sniplets[n.template].controller;for(var r in t)n[r]=t[r];"function"==typeof n.initSource&&n.initSource()}})},10)};o.$observe("application",function(){n.application=o.application,s()}),o.$observe("template",function(){n.template=o.template}),n.template=o.template,n.ngModel=e(o.ngModel),n.ngChange=function(){n.$eval(o.ngChange)}}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(6),o=n(1);t.sortableList=r.ng.directive("sortableList",["$compile",function(e){return{restrict:"A",controller:function(){},compile:function(t,n,r){var i=t.html();return function(t,n,r){t.updateElementsOrder=function(o){var s=n.find("[sortable-element]");s.removeClass("animated");var a=!0;s.filter("[sortable-order='after']").first().each(function(e,t){o.detach().insertBefore(t),a=!1}),a&&n.append(o.detach()),s=n.find("[sortable-element] > div"),s.each(function(e,t){var n=angular.element(t).scope();e!==n.ngModel&&(n.ngModel=e,n.$apply())}),r.onChange&&t.$eval(r.onChange),s.attr("style",""),n.html(e(i)(t)),t.$apply()}}}}}]),t.sortableElement=r.ng.directive("sortableElement",["$parse",function(e){return{scope:{ngModel:"=",ngChange:"&"},require:"^sortableList",template:"<div ng-transclude></div>",transclude:!0,link:function(e,t,n){var r,s=0,a=0;e.$watch("ngModel",function(t,n){t!==n&&"function"==typeof e.ngChange&&e.ngChange()}),i.ui.extendElement.draggable(t,{lock:{horizontal:!0},delayOnTouchOnly:400,mouseUp:function(){e.$parent.updateElementsOrder(t),t.on("click",function(){e.$parent.$eval(n.ngClick)})},startDrag:function(){r=t.parents("[sortable-list]").find("[sortable-element]"),r.attr("style",""),setTimeout(function(){r.addClass("animated")},20),t.css({"z-index":1e3}),s=parseInt(t.css("margin-top"))||0,a=parseInt(t.css("margin-bottom"))||0},tick:function(){var e=t.outerHeight(),n=e/2,i=t.offset().top+n+s,u=null,c=0;r.each(function(r,l){if(t[0]!==l){var d=c;c=o.$(l).offset().top+n,(!u||d<i)&&i<=c?(o.$(l).attr("sortable-order","after"),u&&o.$(u).css({"margin-bottom":a+n+"px"}),o.$(l).css({"margin-top":s+(u?n:e)+"px"})):(i>c?o.$(l).attr("sortable-order","before"):o.$(l).attr("sortable-order","after"),u&&o.$(u).css({"margin-bottom":a+"px"}),o.$(l).css({"margin-top":s+"px"})),u=l}}),u&&(i>c?o.$(u).css({"margin-bottom":a+e+"px"}):o.$(u).css({"margin-bottom":a+"px"}))}})}}}])},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},o=this;Object.defineProperty(t,"__esModule",{value:!0});var s,a,u=n(943),c=n(6),l=n(1),d=!0,h=function(e){d&&(s=e.offset().top-parseInt(e.css("margin-top")),a=l.$(".height-marker").height(),d=!1);var t=s-l.$(window)[0].scrollY;t<=a?(t=a,e.addClass("floating")):e.removeClass("floating"),e.css({top:t+"px"})};t.stickyRow=u.ng.directive("stickyRow",function(){return{restrict:"E",template:'\n <div class="row" ng-transclude></div>\n ',scope:{name:"@"},transclude:!0,link:function(e,t,n){return r(o,void 0,void 0,function(){var e;return i(this,function(n){return e=function(){l.$(window).width()>c.ui.breakpoints.tablette?l.$(window).on("scroll.stickyRow",function(){return h(t)}):(l.$(window).off("scroll.stickyRow"),t.removeClass("floating"))},l.$(window).on("resize",e()),e(),[2]})})}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943);t.Switch=r.ng.directive("switch",function(){return{restrict:"E",scope:{ngModel:"=",ngChange:"&",ngDisabled:"@"},template:'<label class="switch"><input type="checkbox" ng-model="ngModel" ng-change="valueChange()" ng-disabled="ngDisabled"/><span class="tick cell"></span></label>',link:function(e,t,n,r){e.valueChange=function(){setTimeout(function(){n.ngChange&&e.$parent.$eval(n.ngChange)},0)}}}})},function(e,t,n){"use strict";var r=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=n(551),o=n(3),s=n(1),a=n(943),u=n(390),c=n(6),l=function(){function e(e,t,n,r,o,s,a){var u=this;this.$compile=e,this.scope=t,this.element=n,this.attributes=r,this.tooltipDisplayCondition=o,this.tooltipType=s,this.sourceElement=a,this.onChange=new i.Subject,this.isBinded=!1,this.tooltipCheck=!1,this.subscription=new i.Subscription,this.destroy=function(){u.unbind(),u.doRemove()},this.tryMoveTip=function(){u.isReady()&&u.moveTip()},this.show=function(e){if(!u.isReady())return!1;u.onChange.next("show")},this.hide=function(e){if(!u.isReady())return!1;u.onChange.next("hide")},this.targetElement=n,r.tooltipTargetSelector&&(this.targetElement=n.find(r.tooltipTargetSelector)),r.tooltipRestrictSelector&&this.targetElement&&(this.restrictToElement=this.targetElement.parents(r.tooltipRestrictSelector),1!==this.restrictToElement.length&&(this.restrictToElement=void 0)),this.tooltipCheck=!0,n[0].hasAttribute("tooltip-check")&&this.scope.$watch(function(){return t.$eval(r.tooltipCheck)},function(e){return u.tooltipCheck=!!e}),n[0].hasAttribute("tooltip-check-content")&&t.$watch(function(){return n[0].offsetHeight},function(){u.tooltipCheck=n[0].offsetHeight<n[0].scrollHeight}),this.bind(),this.scope.$on("$destroy",this.destroy)}return e.create=function(e){var t=e.$compile,n=e.attributes,r=e.element,i=e.scope,o=e.sourceElement,s=e.tooltipDisplayCondition,a=e.tooltipType;return n.tooltipTemplate?new d(t,i,r,n,s,a,o):new h(t,i,r,n,s,a,o)},e.prototype.isReady=function(){return!!this.targetElement},e.prototype.doShow=function(){this.tooltipDisplayCondition(this.element)&&(this.tip||this.createTip(),this.moveTip(),this.tip.fadeIn())},e.prototype.doRemove=function(){var e=this;this.tip&&this.tip.fadeOut(200,function(){e.tip.remove(),e.tip=void 0})},e.prototype.bind=function(){var e=this;if(!this.isBinded&&this.isReady()){this.subscription.add(this.onChange.debounceTime(400).subscribe(function(t){"hide"==t?e.doRemove():e.doShow()})),this.targetElement.on("mouseenter",this.show),this.targetElement.on("mouseleave",this.hide),s.$(window).on("scroll",this.tryMoveTip);try{this.observer=new MutationObserver(function(t){t.forEach(function(t){"disabled"===t.attributeName&&e.hide()})});var t={attributes:!0};this.observer.observe(this.targetElement[0],t)}catch(e){console.warn("[Tooltip] Could not listen attributes:",e)}this.isBinded=!0}},e.prototype.unbind=function(){this.subscription.unsubscribe(),this.targetElement.off("mouseenter",this.show),this.element.off("mouseout",this.hide),this.element.off("mouseleave",this.hide),s.$(window).off("scroll",this.tryMoveTip);try{this.observer&&this.observer.disconnect()}catch(e){console.warn("[Tooltip] Could not stop listen attributes:",e)}this.isBinded=!1},e}(),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.createTip=function(){var e=u.template.getPath(this.attributes.tooltipTemplate);this.tip=s.$("<div />").addClass("tooltip").html(this.$compile("<div ng-include='\""+e+"\"'></div>")(this.scope)).appendTo("body"),this.tip.css("position","absolute")},t.prototype.moveTip=function(){if(this.tip&&this.isReady()){var e=this.targetElement,t=this.tip,n=this.restrictToElement,r=e.offset().top,i=parseInt(e.offset().left-s.$(t).width()-5);n&&(i<n.offset().left&&(i=parseInt(e.offset().left+s.$(e).width()+5)),i+s.$(e).width()>n.offset().left+s.$(n).width()&&(i=n.offset().left+5,r+=30),r>n.height()+150&&(r-=130)),t.css("left",document.body.clientWidth>=i+t.outerWidth()?i:document.body.clientWidth-t.outerWidth()-1),t.css("top",r)}},t}(l),h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.isReady=function(){return!(s.$(window).width()<c.ui.breakpoints.tablette||!this.attributes[this.tooltipType]||!this.tooltipCheck||"undefined"===this.attributes[this.tooltipType])&&e.prototype.isReady.call(this)},t.prototype.createTip=function(){this.tip=s.$("<div />").addClass("tooltip").html(this.$compile('<div class="arrow"></div><div class="content">'+o.idiom.translate(this.attributes[this.tooltipType])+"</div> ")(this.scope)).appendTo("body")},t.prototype.moveTip=function(){if(this.tip&&this.isReady()){var e=s.$(this.sourceElement).get(0).getBoundingClientRect(),t=parseInt(e.top+window.scrollY+document.documentElement.clientTop+e.height),n=parseInt(e.left+window.scrollX+document.documentElement.clientLeft+e.width/2-s.$(this.tip).outerWidth()/2);t<5&&(t=5),n<5&&(n=5),this.tip.offset({top:t,left:document.body.clientWidth>=n+this.tip.outerWidth()?n:document.body.clientWidth-this.tip.outerWidth()-1})}},t}(l);t.tooltip=a.ng.directive("tooltip",["$compile",function(e){return{restrict:"A",link:function(t,n,r){l.create({$compile:e,scope:t,element:n,attributes:r,tooltipDisplayCondition:function(){return!0},tooltipType:"tooltip",sourceElement:n})}}}]),t.tooltipOnEllipsis=a.ng.directive("tooltipOnEllipsis",["$compile",function(e){return{restrict:"A",link:function(t,n,r){l.create({$compile:e,scope:t,element:n,attributes:r,tooltipDisplayCondition:function(e){var t=e.parent("a").get(0);return t.offsetWidth<t.scrollWidth},tooltipType:"tooltipOnEllipsis",sourceElement:n.parent("a")})}}}]),t.odebtTooltip=a.ng.directive("odebtTooltip",["$compile",function(e){return{restrict:"A",link:function(e,t,n){n.odebtTooltip&&jQuery(t).attr("title",n.odebtTooltip),jQuery(t).tooltip()}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(388);t.transferColumns=r.ng.directive("transferColumns",function(){return{restrict:"E",template:'\n <div class="flex-row bottom-spacing">\n <div class="six">\n <div class="right-magnet right-spacing-three"\n ng-click="addAllItems()" \n ng-if="searchedItems.length > 0">\n <a><i18n class="small-text">portal.all.add</i18n> <i class="right-arrow horizontal-margin-small"></i></a>\n </div>\n </div>\n <div class="six">\n <div class="right-magnet right-spacing"\n ng-click="removeAllItems()" \n ng-if="ngModel.length > 0">\n <a><i18n class="small-text">portal.all.remove</i18n> <i class="close-icon horizontal-margin-small"></i></a>\n </div>\n </div>\n </div>\n <div class="flex-row">\n <div class="six scroll-nine-chips" bottom-scroll="updatingMaxLeftItems()">\n <div class="row info" ng-if="searchedItems.length === 0 && !loading"><i18n>portal.enter.criterias.search</i18n></div>\n <div class="row centered-text reduce-block-six" ng-if="loading">\n <img skin-src="/img/illustrations/loading.gif" width="30px" heigh="30px"/>\n </div>\n <contact-chip class="block relative movable" \n ng-model="item"\n action="addItem(item)"\n ng-class="{ \'divide-opacity\': item.selected, \'chip-hover\': !item.selected }"\n ng-repeat="item in searchedItems | limitTo:maxLeftItems">\n </contact-chip>\n </div>\n <div class="horizontal-margin-twice divider-border"></div>\n <div class="six scroll-nine-chips" bottom-scroll="updatingMaxRightItems()">\n <div class="flex-row warning" ng-if="textRightWarningTitle && ngModel.length === 0">\n <div><i class="warning"></i></div>\n <div>\n <div>[[ textRightWarningTitle ]]</div>\n <div>[[ textRightWarningDescription ]]</div>\n </div>\n </div>\n <contact-chip class="block relative removable chip-hover" stickerNotSelected\n ng-model="item"\n action="removeItem(item)"\n ng-repeat="item in ngModel | limitTo:maxRightItems">\n </contact-chip>\n </div>\n </div>\n ',scope:{ngModel:"=",searchedItems:"=",loading:"="},link:function(e,t,n){e.textTitle=n.textTitle,e.textRightWarningTitle=n.textRightWarningTitle,e.textRightWarningDescription=n.textRightWarningDescription,e.initMaxLeftItems=function(){e.maxLeftItems=50},e.initMaxRightItems=function(){e.maxRightItems=50},e.updatingMaxLeftItems=function(){e.maxLeftItems+=50},e.updatingMaxRightItems=function(){e.maxRightItems+=50},e.addItem=function(t){t.selected||(t.selected=!0,e.ngModel.push(t))},e.addAllItems=function(){e.searchedItems.forEach(function(t){e.addItem(t)})},e.removeItem=function(t){t.selected=!1,e.ngModel.splice(e.ngModel.indexOf(t),1),e.searchedItems.forEach(function(e){e.id===t.id&&(e.selected=!1)})},e.removeAllItems=function(){for(var t=e.ngModel.length-1;t>=0;t--)e.removeItem(e.ngModel[t])},e.$watchCollection("searchedItems",function(){e.initMaxLeftItems(),e.searchedItems.forEach(function(t){e.ngModel.forEach(function(e){t.id===e.id&&(t.selected=!0)})})}),e.$watchCollection("ngModel",function(){e.initMaxRightItems()}),e.initMaxLeftItems(),e.initMaxRightItems()}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943);t.trackInputEventDirective=r.ng.directive("trackInputEvent",["$parse",function(e){return{restrict:"A",require:["?ngModel"],link:function(t,n,r,i){var o=i[0],s=e(r.trackInputEvent)(t);if("EDITOR"==n[0].tagName){var a;o&&o.$formatters.push(function(e){if(a||(a=e),null!=e){var t=e.replace('/ class="ng-scope"/g',"");e!=a&&t!=a&&(s.onStart(!0),a=e)}return e})}else if("IMAGE-SELECT"==n[0].tagName){var u=-1;o&&o.$formatters.push(function(e){return-1==u&&(u=e),e!=u&&(s.onStart(!0),u=e),e})}else o&&o.$parsers.push(function(e){return s.onStart(!0),e})}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(37),i=n(943);t.userRole=i.ng.directive("userRole",function(){return{restrict:"A",link:function(e,t,n){var i=n.userRole;r.model.me.functions[i]?t.show():t.hide()}}}),t.userMissingRole=i.ng.directive("userMissingRole",function(){return{restrict:"A",link:function(e,t,n){var i=n.userMissingRole;r.model.me.functions[i]?t.hide():t.show()}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(37),o=n(1);t.widgets=r.ng.directive("widgets",["$compile",function(e){return{scope:{list:"="},restrict:"E",templateUrl:"/assets/js/entcore/template/widgets.html",link:function(e,t,n){t.on("index-changed",".widget-container",function(n){var r=angular.element(n.target).scope().widget;t.find(".widget-container").each(function(i,s){n.target!==s&&(o.$(n.target).offset().top+o.$(n.target).height()/2>o.$(s).offset().top&&o.$(n.target).offset().top+o.$(n.target).height()/2<o.$(s).offset().top+o.$(s).height()&&(r.setIndex(i),e.$apply("widgets")),o.$(n.target).offset().top>o.$(s).offset().top+o.$(s).height()&&i===t.find(".widget-container").length-1&&(r.setIndex(i),e.$apply("widgets")),o.$(n.target).offset().top+o.$(n.target).height()>o.$(s).offset().top&&0===i&&(r.setIndex(i),e.$apply("widgets")))}),t.find(".widget-container").css({position:"relative",top:"0px",left:"0px"})}),i.model.widgets.on("change",function(){0===t.find(".widget-container").length?(t.parents(".widgets").next(".widgets-friend").addClass("widgets-enemy"),t.parents(".widgets").addClass("hidden")):(t.parents(".widgets").next(".widgets-friend").removeClass("widgets-enemy"),t.parents(".widgets").removeClass("hidden"))})}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(1),o=n(37),s=n(4);t.wizard=r.ng.directive("wizard",function(){return{restrict:"E",templateUrl:"/assets/js/entcore/template/wizard.html",scope:{gotoStep:"=",onCancel:"&",onFinish:"&",finishCondition:"&"},transclude:!0,compile:function(e,t,n){return function(e,t,r){function a(){n(e.$parent.$new(),function(n){u=s._.filter(n,function(e){return"STEP"===e.tagName})[e.currentStep],e.internalNext=void 0!==i.$(u).attr("internal-next"),u=i.$(u),t.find(".current-step .step-content").html("").append(u)}),t.find(".current-step .step-content step [internal-next]").on("click",function(){e.nextStep()}),i.$("nav.steps li").removeClass("active"),i.$(t.find("nav.steps li")[e.currentStep]).addClass("active")}t.find("div.steps step").each(function(e,t){if(i.$(t).attr("workflow")){var n=i.$(t).attr("workflow").split("."),r=o.model.me.workflow;n.forEach(function(e){r=r[e]}),r||i.$(t).remove()}}),e.$watch("gotoStep",function(){e.gotoStep&&e.currentStep!=e.gotoStep&&(e.currentStep=e.gotoStep,a())}),t.find("div.steps").hide(),e.currentStep=0;var u,c=t.find("div.steps step");e.nbSteps=c.length;var l=t.find("nav.steps");l.append("<ul></ul>"),c.each(function(e,t){l.children("ul").append("<li>"+i.$(t).find("h1").html()+"</li>")}),e.nextCondition=function(){var e=angular.element(u[0]).scope();return!u[0].getAttribute("next-condition")||e.$eval(u[0].getAttribute("next-condition"))},e.nextStep=function(){if(e.nextCondition()){angular.element(u[0]).scope().$eval(u[0].getAttribute("on-next")),e.currentStep++,a()}},e.previousStep=function(){angular.element(u[0]).scope().$eval(u[0].getAttribute("on-previous")),e.currentStep--,a()},e.cancel=function(){e.currentStep=0,a(),e.onCancel()},e.checkFinishCondition=function(){return void 0===e.finishCondition()||e.finishCondition()},e.finish=function(){e.checkFinishCondition()&&(e.currentStep=0,a(),e.onFinish())},a()}}}}),t.wizardStep=r.ng.directive("step",function(){return{restrict:"E",transclude:!0,scope:{onNext:"&",onPrevious:"&",nextCondition:"&"},template:'<div class="step" ng-transclude></div>'}})},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(943),s=n(37),a=n(386),u=function(e){return function(t){return function(n,o,u){var c=this;u.$observe(e,function(){return r(c,void 0,void 0,function(){var n,r,c,l,d;return i(this,function(i){switch(i.label){case 0:n=o.children(),i.label=1;case 1:if(i.trys.push([1,4,,5]),!u[e])return t(!0,n,o),[2];if(r=u[e].split("."),!a.Behaviours.applicationsBehaviours[r[0]])throw"Behaviours from application "+r[0]+" missing";return a.Behaviours.applicationsBehaviours[r[0]].callbacks?[4,a.Behaviours.load(r[0])]:[3,3];case 2:i.sent(),i.label=3;case 3:return c=s.model.me&&s.model.me.workflow,(l=!(!c||!c[r[0]]),s.model.me.functions.SUPER_ADMIN)?(t(!0,n,o),[2]):c&&l?(r.forEach(function(e){c=c[e]}),t(c,n,o),[3,5]):(t(!1,n,o),[2]);case 4:throw d=i.sent(),t(!1,n,o),d;case 5:return[2]}})})})}}};t.workflow=o.ng.directive("workflow",["$compile",function(e){return{restrict:"A",link:u("workflow")(function(e,t,n){e?(n.show(),n.append(t)):(t.remove(),n.hide())})}}]),t.workflowNot=o.ng.directive("workflowNot",["$compile",function(e){return{restrict:"A",link:u("workflowNot")(function(e,t,n){e?(t.remove(),n.hide()):(n.show(),n.append(t))})}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1032);t.edumediaExplorerElement=r.edumediaExplorerElement,t.edumediaExplorer=r.edumediaExplorer,t.edumediaExplorerMedia=r.edumediaExplorerMedia,t.edumediaFullscreen=r.edumediaFullscreen;var i=n(1033);t.edumediaHeader=i.edumediaHeader},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(943),s=n(935);t.edumediaExplorerElement=o.ng.directive("edumediaExplorerElement",[function(){return{restrict:"E",scope:{selected:"=",item:"=",open:"&",select:"&"},template:'\n <div ng-click="select()" ng-dblClick="open()">\n <img ng-if="isImg()" ng-src="{{srcImg()}}" alt="{{title()}}" />\n <p>[[title()]]</p>\n </div>\n ',link:function(e,t,n){e.title=function(){return e.item.title},e.isImg=function(){return!!e.item.thumbnail},e.srcImg=function(){return e.item.thumbnail},e.toggleSelect=function(){e.item.selected=!e.item.selected}}}}]),t.edumediaExplorerMedia=o.ng.directive("edumediaExplorerMedia",[function(){return{restrict:"E",scope:{media:"=",notifyAdd:"&",notifyBack:"&"},template:'\n <div ng-if="media">\n <div class="edumedia-header-title">\n <h2 ng-click="back()"><span>&lsaquo;</span>[[title()]]</h2>\n <button type="button" class="right-magnet" ng-click="add()">\n <i18n>add</i18n>\n </button>\n </div>\n <div bind-html="iframe()"></div>\n </div>\n <div ng-if="!media">\n <i18n>edumedia.loading</i18n>\n </div>\n ',link:function(e,t,n){e.iframe=function(){return s.edumediaService.toHtml(e.media)},e.title=function(){return e.media.title},e.add=function(){e.notifyAdd()},e.back=function(){e.notifyBack()}}}}]),t.edumediaFullscreen=o.ng.directive("edumediaFullscreen",["$timeout",function(e){return{restrict:"A",scope:{edumediaFullscreen:"@"},link:function(e,t,n){t.on("click",function(){s.edumediaService.makeFullscreen(e.edumediaFullscreen)})}}}]);!function(){jQuery(document).on("click","*[edumedia-fullscreen-jquery]",function(e){var t=jQuery(e.target).attr("edumedia-fullscreen-jquery");s.edumediaService.makeFullscreen(t)}),jQuery(document).on("click","*[edumedia-delete-jquery]",function(e){var t=jQuery(e.target).attr("edumedia-delete-jquery");s.edumediaService.removeContent(t)})}(),t.edumediaExplorer=o.ng.directive("edumediaExplorer",["$timeout",function(e){return{restrict:"E",scope:{onSelectMedias:"&"},template:'\n <div class="edumedia-explorer-container">\n <edumedia-explorer-media ng-if="displayMedia()" media="currentMedia" notify-add="onAdd(currentMedia)" notify-back="onMediaBack()"></edumedia-explorer-media>\n <edumedia-header ng-if="displayExplorer()" can-add="canAdd()" notify-search="onSearch($text)" notify-add="onAdd()" notify-go-to="onGoTo($stack)" stack="stack" class="row"></edumedia-header>\n <div ng-if="displayExplorer()" class="edumedia-scrollable-area" ng-class="{\'edumedia-search\':isSearching()}">\n <edumedia-explorer-element ng-class="getCss(item)" ng-repeat="item in items" item="item" open="onOpen(item)" select="onSelect(item)" selected="isSelected(item)"></edumedia-explorer-element>\n </div>\n </div>\n ',link:function(t,n,o){return r(this,void 0,void 0,function(){var n,o,a,u,c,l,d,h,f,p,m,_,v=this;return i(this,function(y){switch(y.label){case 0:return n="explorer",[4,s.edumediaService.fetchSubjects()];case 1:return o=y.sent(),a=[],t.stack=[],u=null,c=!1,l="root",d=function(){e(function(){l="root",n="explorer",t.items=o.children})},d(),h=function(o){return r(v,void 0,void 0,function(){var r;return i(this,function(i){switch(i.label){case 0:return[4,s.edumediaService.fetchChildren(o)];case 1:return r=i.sent(),u=o,e(function(){l=r.children?"folder":"media",n="explorer",t.items=r.children||r.medias}),[2]}})})},f=function(){if(0==t.stack.length)d();else{var e=t.stack[t.stack.length-1];h({apiURL:e.link,title:e.title,href:null,id:e.id,leaf:e.leaf})}},t.getCss=function(e){return(e.media?"media":l)+" "+(t.isSelected(e)?"selected":"")},t.displayMedia=function(){return"media"==n},t.displayExplorer=function(){return"explorer"==n},t.canAdd=function(){return a.length>0&&!t.addProcessing},t.isSearching=function(){return c},t.onSearch=function(n){return r(this,void 0,void 0,function(){var r;return i(this,function(i){switch(i.label){case 0:return e(function(){a=[]}),n?(c=!0,[4,s.edumediaService.search(n,40,u?u.id:void 0)]):[3,2];case 1:return r=i.sent(),e(function(){t.items=r.medias}),[3,3];case 2:c&&e(function(){f(),c=!1}),i.label=3;case 3:return[2]}})})},t.onGoTo=function(e){t.stack=e,f()},t.onAdd=function(e){return r(this,void 0,void 0,function(){var n,r,o;return i(this,function(i){switch(i.label){case 0:return n=e?[e]:a.slice(),[4,Promise.all(n.map(function(e){return s.edumediaService.fetchMediaDetail(e)}))];case 1:if(r=i.sent(),!((o=t.onSelectMedias({$selection:r}))&&o instanceof Promise))return[3,5];i.label=2;case 2:return i.trys.push([2,,4,5]),t.addProcessing=!0,[4,o];case 3:return i.sent(),[3,5];case 4:return t.addProcessing=!1,[7];case 5:return[2]}})})},p=function(e){return!e.media},m=function(e){return function(t){return t===e}},_=function(e){return function(t){return t!==e}},t.isSelected=function(e){return!!a.find(m(e))},t.onSelect=function(n){p(n)?t.onOpen(n):e(function(){a.find(m(n))?a=a.filter(_(n)):a.push(n)})},t.onOpen=function(o){return r(this,void 0,void 0,function(){var r;return i(this,function(i){switch(i.label){case 0:return p(o)?(t.stack.push({title:o.title,link:o.apiURL,id:o.id,leaf:o.leaf}),h(o),[3,3]):[3,1];case 1:return n="media",[4,s.edumediaService.fetchMediaDetail(o)];case 2:r=i.sent(),e(function(){return t.currentMedia=r}),i.label=3;case 3:return[2]}})})},t.onMediaBack=function(){n="explorer",e(function(){return t.currentMedia=null})},[2]}})})}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(551),o=n(3);t.edumediaHeader=r.ng.directive("edumediaHeader",[function(){return{restrict:"E",scope:{stack:"=",canAdd:"=",notifySearch:"&",notifyAdd:"&",notifyGoTo:"&"},template:'\n <div class="edumedia-header-stack" ng-if="isNotEmptyStack() || canShowAdd()">\t\n <nav ng-style="{\'visibility\': isNotEmptyStack() ? \'visible\' : \'hidden\'}">\n <header><span ng-click="goTo(null)"><i18n>edumedia.theme</i18n></span></header>\n <header ng-repeat="item in stack"><span ng-click="goTo(item)">[[item.title]]</span></header>\n </nav>\n </div>\n <div class="edumedia-header-title">\n <h2>[[currentTitle()]]</h2>\n </div>\n <div class="edumedia-header-actions">\n <input type="search" ng-model="display.search" i18n-placeholder="search" ng-change="onSearchChange()">\n <button type="button" class="right-magnet" ng-disabled="!canAdd" ng-click="add()" ng-if="canShowAdd()">\n <i18n>add</i18n>\n </button>\n </div>\n ',link:function(e,t,n){e.display={search:""};var r=new i.Subject,s=r.debounceTime(300).distinctUntilChanged(),a=s.subscribe(function(){e.notifySearch({$text:e.display.search})});e.$on("destroy",function(){a.unsubscribe()}),e.isNotEmptyStack=function(){return e.stack&&e.stack.length>0},e.currentTitle=function(){return e.isNotEmptyStack()?e.stack[e.stack.length-1].title:o.idiom.translate("edumedia.choose")},e.canShowAdd=function(){return e.isNotEmptyStack()||e.canAdd},e.onSearchChange=function(){r.next(e.display.search)},e.add=function(){e.notifyAdd()},e.goTo=function(t){e.display.search="",e.onSearchChange();var n=e.stack.findIndex(function(e){return e===t});e.stack=-1==n?[]:e.stack.slice(0,n+1),setTimeout(function(){return e.notifyGoTo({$stack:e.stack})})}}}}])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1035);t.libraryPublishDirective=r.libraryPublishDirective,t.libraryRootDirective=r.libraryRootDirective,t.libraryResourceDirective=r.libraryResourceDirective},function(e,t,n){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e};Object.defineProperty(t,"__esModule",{value:!0});var i=n(943),o=n(1036),s=n(1037),a=n(3),u=n(35),c=n(37);i.ng.providers.push(o.libraryServiceProvider),t.libraryResourceDirective=i.ng.directive("libraryResource",function(){return{restrict:"A",require:"^^libraryRoot",scope:{libraryResource:"="},link:function(e,t,n,r){t.on("click",function(){r.openPublishControllerWithResource(e.libraryResource)})}}});var l=function(){function e(e){this.libraryService=e,e.registerLibraryRootController(this)}return e.prototype.registerPublishController=function(e){this.publishController=e},e.prototype.openPublishControllerWithResource=function(e){var t=this.libraryService.getResourceInformationFromResource(e);return this.publishController.open(t.id,t.resourceInformation)},e.$inject=["libraryService"],e}();t.LibraryRootController=l,t.libraryRootDirective=i.ng.directive("libraryRoot",function(){return{restrict:"A",controller:l}});var d=function(){function e(e,t,n,r,i){var o=this;this.$scope=e,this.$q=t,this.$http=n,this.$location=r,this.libraryService=i,this.show=!1,this.allActivityTypes=s.allActivityTypes.map(function(e){return{label:a.idiom.translate(e),customSort:"bpr.other"==e?"~":a.idiom.translate(e).normalize("NFD"),type:e}}),this.allSubjectAreas=s.allSubjectAreas.map(function(e){return{label:a.idiom.translate(e),customSort:"bpr.other"==e?"~":a.idiom.translate(e).normalize("NFD"),type:e}}),this.allLanguages=s.allLangages,this.revocableUrl=null,this.loading=!1,this.licence="none",this.sliderOptions={connect:!0,range:{min:1,max:20},step:1,tooltips:[!0,!0],format:{to:function(e){return Math.floor(e).toString()},from:function(e){return parseInt(e)}}},this.userStructureNames=c.model.me.structureNames,this.multiStructureUser=c.model.me.structureNames&&c.model.me.structureNames.length>1,this.$http({url:"/directory/user/"+c.model.me.userId+"/attachment-school",responseType:"json",method:"GET"}).then(function(e){e.data&&(o.userAttachmentStructureName=e.data.name)}),e.$watch(function(){return o.publication?o.publication.cover:void 0},function(){o.revocableUrl&&(URL.revokeObjectURL(o.revocableUrl),o.revocableUrl=void 0),o.publication&&o.publication.cover&&(o.publication.cover.length&&(o.publication.cover=o.publication.cover[0]),o.revocableUrl=URL.createObjectURL(o.publication.cover))})}return e.prototype.open=function(e,t){var n=this,i=this.$q.defer(),o=window.location.protocol+"//"+window.location.host,s=""+o+t.pdfUri;return t.cover?this.$http({url:t.cover,responseType:"blob",method:"GET"}).then(function(e){i.resolve(e.data)},function(e){i.reject(e)}):i.resolve(null),i.promise.then(function(i){n.show=!0,n.id=e;var o={title:"",activityType:[],age:[3,16],cover:null,description:"",keyWords:"",language:"fr_FR",subjectArea:[],application:"",pdfUri:"",licence:"",teacherAvatar:null,resourceId:n.id,userStructureName:n.userAttachmentStructureName?n.userAttachmentStructureName:n.userStructureNames&&n.userStructureNames[0]};n.publication=Object.assign({},o,r({},t,{cover:i,pdfUri:s}))}).catch(function(e){u.notify.error("bpr.cover.notfound")})},e.prototype.closePublishLightbox=function(){this.show=!1,this.publication=void 0,this.id=void 0},e.prototype.closePublishLightboxAndApply=function(){this.closePublishLightbox(),this.$scope.$apply()},e.prototype.invalidFormFields=function(){return!(this.publication.title&&this.publication.cover&&this.publication.description&&0!=this.publication.activityType.length&&0!=this.publication.subjectArea.length&&this.publication.language)},e.prototype.publish=function(){var e=this;if(!this.loading)return this.loading=!0,this.publicationResponse={},this.libraryService.publish(this.id,this.publication).then(function(t){e.loading=!1,e.closePublishLightbox(),e.publicationResponse=t.data,e.responseBprFullURL=e.publicationResponse.details.front_url+"?platformURL="+encodeURIComponent(e.$location.host()),e.showLightboxResponse=!0,e.$scope.$apply()},function(t){e.loading=!1,e.closePublishLightbox(),e.publicationResponse.success=!1,e.publicationResponse.message=t.data.message,e.showLightboxResponse=!0,e.$scope.$apply()})},e.$inject=["$scope","$q","$http","$location","libraryService"],e}();t.LibraryPublishController=d,t.libraryPublishDirective=i.ng.directive("libraryPublish",function(){return{restrict:"E",scope:{},require:["^^libraryRoot","libraryPublish"],controller:d,controllerAs:"libraryPublishController",bindToController:!0,link:function(e,t,n,r){var i=r[0],o=r[1];i.registerPublishController(o),e.translate=a.idiom.translate,e.orderAllSubjectAreas="customSort",e.orderAllActivity="customSort",e.warning=n.warning},template:'\n <div ng-if="libraryPublishController.show">\n <lightbox class="bpr" show="libraryPublishController.show">\n <div class="flex-row align-center">\n <h2><i18n>bpr.form.header</i18n></h2>\n <span class="tipbox">\n <div class="tipbox-content bot">\n <span class="small-text">\n <i18n>bpr.form.tip</i18n>\n </span>\n </div>\n <div>\n <i class="help sticker square-medium"></i>\n </div>\n </span>\n </div>\n <div ng-if="warning">\n <p class="warning">[[warning]]</p>\n </div>\n <div class="row">\n <form ng-submit="libraryPublishController.publish()"\n name="libraryPublishController.publishForm"\n novalidate>\n <div class="row top-spacing-four">\n <label class="cell three bold" for="">\n <i18n>bpr.form.publication.title</i18n> * :\n </label>\n <input class="cell nine"\n type="text"\n name="title"\n ng-model="libraryPublishController.publication.title"\n placeholder="[[translate(\'bpr.form.publication.title.placeholder\')]]" />\n </div>\n <div class="row top-spacing-twice">\n <label class="cell three bold" for="">\n <i18n>bpr.form.publication.cover.upload</i18n> * :\n <small><i18n>bpr.form.publication.format</i18n> JPG, PNG</small>\n </label>\n <file-picker-list\n class="cell seven"\n files="libraryPublishController.publication.cover"\n multiple="false"\n hide-list="true">\n </file-picker-list>\n <img\n class="cell two file-picker_preview"\n ng-if="libraryPublishController.revocableUrl"\n ng-src="[[libraryPublishController.revocableUrl]]"\n alt="" />\n <i class="file-image cell two"\n ng-if="libraryPublishController.revocableUrl == null"></i>\n </div>\n <div class="row top-spacing-twice">\n <label class="cell three bold" for="">\n <i18n>bpr.form.publication.description</i18n> * :\n </label>\n <textarea class="cell nine description"\n ng-model="libraryPublishController.publication.description"\n name="description"\n rows="8"\n cols="80"\n placeholder="[[translate(\'bpr.form.publication.description.placeholder\')]]">\n </textarea>\n </div>\n <div class="row top-spacing-twice">\n <label class="cell three bold" for="">\n <i18n>bpr.form.publication.type</i18n> * :\n </label>\n <div class="cell nine">\n <multi-comboboxes\n ng-model="libraryPublishController.publication.activityType"\n name="activityType" order="orderAllActivity"\n options="libraryPublishController.allActivityTypes">\n </multi-comboboxes>\n </div>\n </div>\n <div class="row top-spacing-twice">\n <label class="cell three bold"for="">\n <i18n>bpr.form.publication.discipline</i18n> * :\n </label>\n <div class="cell nine">\n <multi-comboboxes\n ng-model="libraryPublishController.publication.subjectArea"\n name="subjectArea" order="orderAllSubjectAreas"\n options="libraryPublishController.allSubjectAreas">\n </multi-comboboxes>\n </div>\n </div>\n <div class="row top-spacing-twice">\n <label class="cell three bold" for="">\n <i18n>bpr.form.publication.language</i18n> * :\n </label>\n <select ng-model="libraryPublishController.publication.language"\n name="language"\n ng-options="translate(language) for language in libraryPublishController.allLanguages"\n class="cell nine language">\n </select>\n </div>\n <div class="row top-spacing-four">\n <label class="cell three bold" for="">\n <i18n>bpr.form.publication.age</i18n> * :\n </label>\n <div class="cell four top-spacing-twice">\n <div no-ui-slider\n slider-options="libraryPublishController.sliderOptions"\n ng-model="libraryPublishController.publication.age"\n name="age">\n </div>\n </div>\n </div>\n <div class="row top-spacing-twice">\n <label class="cell three bold" for="">\n <i18n>bpr.form.publication.keywords</i18n> :\n <br /><small><i18n>bpr.form.publication.keywords.separate</i18n></small>\n </label>\n <input class="cell nine"\n type="text"\n name="title"\n ng-model="libraryPublishController.publication.keyWords"\n placeholder="[[ translate(\'bpr.form.publication.keywords.placeholder\') ]]" />\n </div>\n <div ng-if="libraryPublishController.multiStructureUser && !libraryPublishController.userAttachmentStructureName" \n class="row top-spacing-twice">\n <label class="cell three bold" for="">\n <i18n>bpr.form.publication.structure</i18n> * :\n </label>\n <select ng-model="libraryPublishController.publication.userStructureName"\n class="cell nine language">\n <option ng-repeat="structureName in libraryPublishController.userStructureNames | orderBy:\'toString()\'">[[ structureName ]]</option>\n </select>\n </div>\n <div class="row top-spacing-twice">\n <div class="licence-condition">\n <h3 class="top-spacing-four">\n <i class="info-pic right-spacing bottom-spacing"></i>\n <i18n>bpr.form.publication.licence.text</i18n>\n </h3>\n <ul>\n <li class="small-text">\n <i18n>bpr.form.publication.licence.text.1</i18n>\n <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/"\n target="_blank"\n class="left-spacing top-spacing">\n <img class="licence_image"\n src="assets/themes/entcore-css-lib/images/cc-by-nc-sa.svg"\n alt="[[translate(\'bpr.form.publication.licence.image.alt\')]]" />\n </a>\n </li>\n <li class="small-text"><i18n>bpr.form.publication.licence.text.2</i18n></li>\n <li class="small-text"><i18n>bpr.form.publication.licence.text.3</i18n></li>\n </ul>\n </div>\n </div>\n <div class="row top-spacing-four">\n <div class="cell twelve">\n <button type="submit"\n class="right-magnet"\n ng-disabled="libraryPublishController.invalidFormFields()">\n <i18n ng-if="!libraryPublishController.loading">publish</i18n>\n <i ng-if="libraryPublishController.loading" class="loading" style="margin: 0"></i>\n </button>\n <button type="button" \n ng-click="libraryPublishController.closePublishLightboxAndApply()" \n ng-if="!libraryPublishController.loading" \n class="cancel right-magnet">\n <i18n>cancel</i18n>\n </button>\n </div>\n </div>\n </form>\n </div>\n </lightbox>\n </div>\n <div ng-if="libraryPublishController.showLightboxResponse">\n <lightbox class="bpr" show="libraryPublishController.showLightboxResponse" tiny="true">\n <div ng-if="libraryPublishController.publicationResponse.success">\n <h2><i18n>bpr.form.publication.response.success.title</i18n></h2>\n <i class="congrats"></i>\n <p>\n <i18n>bpr.form.publication.response.success.content.1</i18n>\n </p>\n <p>\n <i18n>bpr.form.publication.response.success.content.2</i18n>\n </p>\n <a ng-if="libraryPublishController.publicationResponse.details && libraryPublishController.publicationResponse.details.front_url" \n class="button right-magnet" \n ng-href="[[libraryPublishController.responseBprFullURL]]"\n target="_blank">\n <i18n>bpr.form.publication.response.success.button</i18n>\n </a>\n </div>\n\n <div ng-if="!libraryPublishController.publicationResponse.success">\n <h2><i18n>bpr.form.publication.response.error.title</i18n></h2>\n <p><strong><i18n>bpr.form.publication.response.error.content</i18n></strong></p>\n </div>\n </lightbox>\n </div>'}})},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(943),s=n(37),a=function(){function e(){var e=this;this.publishUrlGetterFromId=function(e){throw new Error("publishUrlGetterFromId not defined")},this.invokableResourceInformationGetterFromResource=function(){return function(e){throw new Error("invokableResourceInformationGetterFromResource not defined")}},this.$get=["$http","$injector",function(t,n){var o,a=function(n,o){return r(e,void 0,void 0,function(){var e,n,r,a;return i(this,function(i){switch(i.label){case 0:return[4,t.get("/userbook/avatar/"+s.model.me.userId+"?thumbnail=48x48",{responseType:"blob"})];case 1:return e=i.sent(),n=e.data,r=new FormData,r.append("title",o.title),r.append("cover",o.cover),r.append("coverName",o.cover.name),r.append("coverType",o.cover.type),r.append("teacherAvatar",n),r.append("teacherAvatarName",n.name||"teacherAvatar_"+s.model.me.userId),r.append("teacherAvatarType",n.type),r.append("language",o.language),o.activityType.forEach(function(e){r.append("activityType[]",e)}),o.subjectArea.forEach(function(e){r.append("subjectArea[]",e)}),o.age.forEach(function(e){r.append("age[]",e.toString())}),r.append("description",o.description),a=o.keyWords.split(","),a.forEach(function(e){r.append("keyWords[]",e.trim())}),r.append("licence","CC-BY"),r.append("pdfUri",o.pdfUri),r.append("application",o.application),r.append("resourceId",o.resourceId),r.append("teacherSchool",o.userStructureName),r.append("teacherCity","test"),[2,t.post("/appregistry/library/resource",r,{transformRequest:angular.identity,headers:{"Content-Type":void 0}})]}})})},u=function(t){return n.invoke(e.invokableResourceInformationGetterFromResource)(t)};return{publish:a,registerLibraryRootController:function(e){o=e},openPublishControllerWithResource:function(e){return o.openPublishControllerWithResource(e)},getResourceInformationFromResource:u}}]}return e.prototype.setInvokableResourceInformationGetterFromResource=function(e){this.invokableResourceInformationGetterFromResource=e},e}();t.LibraryServiceProvider=a,t.libraryServiceProvider=o.ng.provider("libraryService",a)},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.allSubjectAreas=["bpr.subjectArea.artActivity","bpr.subjectArea.readLearning","bpr.subjectArea.chemistry","bpr.subjectArea.law","bpr.subjectArea.worldDiscovery","bpr.subjectArea.economy","bpr.subjectArea.mediaEducation","bpr.subjectArea.musicEducation","bpr.subjectArea.sportEducation","bpr.subjectArea.citizenshipEducation","bpr.subjectArea.geography","bpr.subjectArea.history","bpr.subjectArea.artHistory","bpr.subjectArea.ComputerScience","bpr.subjectArea.languages","bpr.subjectArea.italian","bpr.subjectArea.spanish","bpr.subjectArea.french","bpr.subjectArea.german","bpr.subjectArea.english","bpr.subjectArea.ancientLanguages","bpr.subjectArea.literature","bpr.subjectArea.mathematics","bpr.subjectArea.vocationalGuidance","bpr.subjectArea.philosohppy","bpr.subjectArea.physics","bpr.subjectArea.politicalSscience","bpr.subjectArea.sociology","bpr.subjectArea.biology","bpr.subjectArea.geology","bpr.subjectArea.technology","bpr.other"],t.allActivityTypes=["bpr.other","bpr.activityType.classroomActivity","bpr.activityType.groupActivity","bpr.activityType.personalActivity","bpr.activityType.homework","bpr.activityType.exercize","bpr.activityType.learningPath","bpr.activityType.courseElement"],t.allLangages=["de_DE","en_EN","ar_DZ","es_ES","fr_FR","it_IT","ja_JP","zh_CN","pt_PT","ru_RU","bpr.other"]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(1039);t.noUiSliderDirective=r.ng.directive("noUiSlider",["$timeout","$q","$log",function(e,t,n){return{restrict:"AE",require:"?ngModel",scope:{created:"&?sliderCreated",options:"=?sliderOptions"},link:function(r,o,s,a){function u(t){return t.$on=function(n,r){var i=function(){e(function(){r(t.get())})};return t.on(n,i),function(){t.off(n,i)}},t}function c(e){r.$watch("created",function(t){angular.isFunction(t)&&t({api:e})})}function l(e){r.$watch("options",function(t,n){angular.equals(t,n)||(p=angular.copy(r.options),e.updateOptions(p))})}function d(e){a.$render=function(){e.set(a.$modelValue)},e.on("update",function(){var t=e.get();a.$setViewValue(t)})}function h(){var e=u(i.create(f,p));c(e),l(e),null!==a&&d(e)}var f=o[0],p=angular.copy(r.options);(function(){return null===a?t.resolve(null):t(function(t){e(function(){if(!angular.isArray(a.$modelValue)&&!angular.isNumber(a.$modelValue))throw new Error("Value provided in ngModel is not a valid noUislider start position. Expected a Number or an Array of Numbers, found: "+a.$modelValue);t(a.$modelValue)})})})().then(function(e){null!==e&&(p.start=e),h()}).catch(n.error)}}}])},function(e,t,n){var r,i,o;/*! nouislider - 14.6.3 - 11/19/2020 */
449
449
  !function(n){i=[],r=n,void 0!==(o="function"==typeof r?r.apply(t,i):r)&&(e.exports=o)}(function(){"use strict";function e(e){return"object"==typeof e&&"function"==typeof e.to&&"function"==typeof e.from}function t(e){e.parentElement.removeChild(e)}function n(e){return null!==e&&void 0!==e}function r(e){e.preventDefault()}function i(e){return e.filter(function(e){return!this[e]&&(this[e]=!0)},{})}function o(e,t){return Math.round(e/t)*t}function s(e,t){var n=e.getBoundingClientRect(),r=e.ownerDocument,i=r.documentElement,o=m(r);return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(o.x=0),t?n.top+o.y-i.clientTop:n.left+o.x-i.clientLeft}function a(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}function u(e,t,n){n>0&&(h(e,t),setTimeout(function(){f(e,t)},n))}function c(e){return Math.max(Math.min(e,100),0)}function l(e){return Array.isArray(e)?e:[e]}function d(e){e=String(e);var t=e.split(".");return t.length>1?t[1].length:0}function h(e,t){e.classList&&!/\s/.test(t)?e.classList.add(t):e.className+=" "+t}function f(e,t){e.classList&&!/\s/.test(t)?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")}function p(e,t){return e.classList?e.classList.contains(t):new RegExp("\\b"+t+"\\b").test(e.className)}function m(e){var t=void 0!==window.pageXOffset,n="CSS1Compat"===(e.compatMode||"");return{x:t?window.pageXOffset:n?e.documentElement.scrollLeft:e.body.scrollLeft,y:t?window.pageYOffset:n?e.documentElement.scrollTop:e.body.scrollTop}}function _(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function v(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("test",null,t)}catch(e){}return e}function y(){return window.CSS&&CSS.supports&&CSS.supports("touch-action","none")}function g(e,t){return 100/(t-e)}function b(e,t,n){return 100*t/(e[n+1]-e[n])}function w(e,t){return b(e,e[0]<0?t+Math.abs(e[0]):t-e[0],0)}function M(e,t){return t*(e[1]-e[0])/100+e[0]}function k(e,t){for(var n=1;e>=t[n];)n+=1;return n}function L(e,t,n){if(n>=e.slice(-1)[0])return 100;var r=k(n,e),i=e[r-1],o=e[r],s=t[r-1],a=t[r];return s+w([i,o],n)/g(s,a)}function x(e,t,n){if(n>=100)return e.slice(-1)[0];var r=k(n,t),i=e[r-1],o=e[r],s=t[r-1];return M([i,o],(n-s)*g(s,t[r]))}function Y(e,t,n,r){if(100===r)return r;var i=k(r,e),s=e[i-1],a=e[i];return n?r-s>(a-s)/2?a:s:t[i-1]?e[i-1]+o(r-e[i-1],t[i-1]):r}function T(e,t,n){var r;if("number"==typeof t&&(t=[t]),!Array.isArray(t))throw new Error("noUiSlider ("+ne+"): 'range' contains invalid value.");if(r="min"===e?0:"max"===e?100:parseFloat(e),!a(r)||!a(t[0]))throw new Error("noUiSlider ("+ne+"): 'range' value isn't numeric.");n.xPct.push(r),n.xVal.push(t[0]),r?n.xSteps.push(!isNaN(t[1])&&t[1]):isNaN(t[1])||(n.xSteps[0]=t[1]),n.xHighestCompleteStep.push(0)}function S(e,t,n){if(t){if(n.xVal[e]===n.xVal[e+1])return void(n.xSteps[e]=n.xHighestCompleteStep[e]=n.xVal[e]);n.xSteps[e]=b([n.xVal[e],n.xVal[e+1]],t,0)/g(n.xPct[e],n.xPct[e+1]);var r=(n.xVal[e+1]-n.xVal[e])/n.xNumSteps[e],i=Math.ceil(Number(r.toFixed(3))-1),o=n.xVal[e]+n.xNumSteps[e]*i;n.xHighestCompleteStep[e]=o}}function D(e,t,n){this.xPct=[],this.xVal=[],this.xSteps=[n||!1],this.xNumSteps=[!1],this.xHighestCompleteStep=[],this.snap=t;var r,i=[];for(r in e)e.hasOwnProperty(r)&&i.push([e[r],r]);for(i.length&&"object"==typeof i[0][0]?i.sort(function(e,t){return e[0][0]-t[0][0]}):i.sort(function(e,t){return e[0]-t[0]}),r=0;r<i.length;r++)T(i[r][1],i[r][0],this);for(this.xNumSteps=this.xSteps.slice(0),r=0;r<this.xNumSteps.length;r++)S(r,this.xNumSteps[r],this)}function $(t){if(e(t))return!0;throw new Error("noUiSlider ("+ne+"): 'format' requires 'to' and 'from' methods.")}function E(e,t){if(!a(t))throw new Error("noUiSlider ("+ne+"): 'step' is not numeric.");e.singleStep=t}function O(e,t){if(!a(t))throw new Error("noUiSlider ("+ne+"): 'keyboardPageMultiplier' is not numeric.");e.keyboardPageMultiplier=t}function j(e,t){if(!a(t))throw new Error("noUiSlider ("+ne+"): 'keyboardDefaultStep' is not numeric.");e.keyboardDefaultStep=t}function C(e,t){if("object"!=typeof t||Array.isArray(t))throw new Error("noUiSlider ("+ne+"): 'range' is not an object.");if(void 0===t.min||void 0===t.max)throw new Error("noUiSlider ("+ne+"): Missing 'min' or 'max' in 'range'.");if(t.min===t.max)throw new Error("noUiSlider ("+ne+"): 'range' 'min' and 'max' cannot be equal.");e.spectrum=new D(t,e.snap,e.singleStep)}function A(e,t){if(t=l(t),!Array.isArray(t)||!t.length)throw new Error("noUiSlider ("+ne+"): 'start' option is incorrect.");e.handles=t.length,e.start=t}function P(e,t){if(e.snap=t,"boolean"!=typeof t)throw new Error("noUiSlider ("+ne+"): 'snap' option must be a boolean.")}function H(e,t){if(e.animate=t,"boolean"!=typeof t)throw new Error("noUiSlider ("+ne+"): 'animate' option must be a boolean.")}function F(e,t){if(e.animationDuration=t,"number"!=typeof t)throw new Error("noUiSlider ("+ne+"): 'animationDuration' option must be a number.")}function I(e,t){var n,r=[!1];if("lower"===t?t=[!0,!1]:"upper"===t&&(t=[!1,!0]),!0===t||!1===t){for(n=1;n<e.handles;n++)r.push(t);r.push(!1)}else{if(!Array.isArray(t)||!t.length||t.length!==e.handles+1)throw new Error("noUiSlider ("+ne+"): 'connect' option doesn't match handle count.");r=t}e.connect=r}function N(e,t){switch(t){case"horizontal":e.ort=0;break;case"vertical":e.ort=1;break;default:throw new Error("noUiSlider ("+ne+"): 'orientation' option is invalid.")}}function R(e,t){if(!a(t))throw new Error("noUiSlider ("+ne+"): 'margin' option must be numeric.");0!==t&&(e.margin=e.spectrum.getDistance(t))}function W(e,t){if(!a(t))throw new Error("noUiSlider ("+ne+"): 'limit' option must be numeric.");if(e.limit=e.spectrum.getDistance(t),!e.limit||e.handles<2)throw new Error("noUiSlider ("+ne+"): 'limit' option is only supported on linear sliders with 2 or more handles.")}function z(e,t){var n;if(!a(t)&&!Array.isArray(t))throw new Error("noUiSlider ("+ne+"): 'padding' option must be numeric or array of exactly 2 numbers.");if(Array.isArray(t)&&2!==t.length&&!a(t[0])&&!a(t[1]))throw new Error("noUiSlider ("+ne+"): 'padding' option must be numeric or array of exactly 2 numbers.");if(0!==t){for(Array.isArray(t)||(t=[t,t]),e.padding=[e.spectrum.getDistance(t[0]),e.spectrum.getDistance(t[1])],n=0;n<e.spectrum.xNumSteps.length-1;n++)if(e.padding[0][n]<0||e.padding[1][n]<0)throw new Error("noUiSlider ("+ne+"): 'padding' option must be a positive number(s).");var r=t[0]+t[1],i=e.spectrum.xVal[0];if(r/(e.spectrum.xVal[e.spectrum.xVal.length-1]-i)>1)throw new Error("noUiSlider ("+ne+"): 'padding' option must not exceed 100% of the range.")}}function V(e,t){switch(t){case"ltr":e.dir=0;break;case"rtl":e.dir=1;break;default:throw new Error("noUiSlider ("+ne+"): 'direction' option was not recognized.")}}function q(e,t){if("string"!=typeof t)throw new Error("noUiSlider ("+ne+"): 'behaviour' must be a string containing options.");var n=t.indexOf("tap")>=0,r=t.indexOf("drag")>=0,i=t.indexOf("fixed")>=0,o=t.indexOf("snap")>=0,s=t.indexOf("hover")>=0,a=t.indexOf("unconstrained")>=0;if(i){if(2!==e.handles)throw new Error("noUiSlider ("+ne+"): 'fixed' behaviour must be used with 2 handles");R(e,e.start[1]-e.start[0])}if(a&&(e.margin||e.limit))throw new Error("noUiSlider ("+ne+"): 'unconstrained' behaviour cannot be used with margin or limit");e.events={tap:n||o,drag:r,fixed:i,snap:o,hover:s,unconstrained:a}}function B(e,t){if(!1!==t)if(!0===t){e.tooltips=[];for(var n=0;n<e.handles;n++)e.tooltips.push(!0)}else{if(e.tooltips=l(t),e.tooltips.length!==e.handles)throw new Error("noUiSlider ("+ne+"): must pass a formatter for all handles.");e.tooltips.forEach(function(e){if("boolean"!=typeof e&&("object"!=typeof e||"function"!=typeof e.to))throw new Error("noUiSlider ("+ne+"): 'tooltips' must be passed a formatter or 'false'.")})}}function U(e,t){e.ariaFormat=t,$(t)}function J(e,t){e.format=t,$(t)}function G(e,t){if(e.keyboardSupport=t,"boolean"!=typeof t)throw new Error("noUiSlider ("+ne+"): 'keyboardSupport' option must be a boolean.")}function Z(e,t){e.documentElement=t}function X(e,t){if("string"!=typeof t&&!1!==t)throw new Error("noUiSlider ("+ne+"): 'cssPrefix' must be a string or `false`.");e.cssPrefix=t}function K(e,t){if("object"!=typeof t)throw new Error("noUiSlider ("+ne+"): 'cssClasses' must be an object.");if("string"==typeof e.cssPrefix){e.cssClasses={};for(var n in t)t.hasOwnProperty(n)&&(e.cssClasses[n]=e.cssPrefix+t[n])}else e.cssClasses=t}function Q(e){var t={margin:0,limit:0,padding:0,animate:!0,animationDuration:300,ariaFormat:re,format:re},r={step:{r:!1,t:E},keyboardPageMultiplier:{r:!1,t:O},keyboardDefaultStep:{r:!1,t:j},start:{r:!0,t:A},connect:{r:!0,t:I},direction:{r:!0,t:V},snap:{r:!1,t:P},animate:{r:!1,t:H},animationDuration:{r:!1,t:F},range:{r:!0,t:C},orientation:{r:!1,t:N},margin:{r:!1,t:R},limit:{r:!1,t:W},padding:{r:!1,t:z},behaviour:{r:!0,t:q},ariaFormat:{r:!1,t:U},format:{r:!1,t:J},tooltips:{r:!1,t:B},keyboardSupport:{r:!0,t:G},documentElement:{r:!1,t:Z},cssPrefix:{r:!0,t:X},cssClasses:{r:!0,t:K}},i={connect:!1,direction:"ltr",behaviour:"tap",orientation:"horizontal",keyboardSupport:!0,cssPrefix:"noUi-",cssClasses:ie,keyboardPageMultiplier:5,keyboardDefaultStep:10};e.format&&!e.ariaFormat&&(e.ariaFormat=e.format),Object.keys(r).forEach(function(o){if(!n(e[o])&&void 0===i[o]){if(r[o].r)throw new Error("noUiSlider ("+ne+"): '"+o+"' is required.");return!0}r[o].t(t,n(e[o])?e[o]:i[o])}),t.pips=e.pips;var o=document.createElement("div"),s=void 0!==o.style.msTransform,a=void 0!==o.style.transform;t.transformRule=a?"transform":s?"msTransform":"webkitTransform";var u=[["left","top"],["right","bottom"]];return t.style=u[t.dir][t.ort],t}function ee(e,n,o){function a(e,t){var n=Oe.createElement("div");return t&&h(n,t),e.appendChild(n),n}function d(e,t){var r=a(e,n.cssClasses.origin),i=a(r,n.cssClasses.handle);return a(i,n.cssClasses.touchArea),i.setAttribute("data-handle",t),n.keyboardSupport&&(i.setAttribute("tabindex","0"),i.addEventListener("keydown",function(e){return V(e,t)})),i.setAttribute("role","slider"),i.setAttribute("aria-orientation",n.ort?"vertical":"horizontal"),0===t?h(i,n.cssClasses.handleLower):t===n.handles-1&&h(i,n.cssClasses.handleUpper),r}function g(e,t){return!!t&&a(e,n.cssClasses.connect)}function b(e,t){var r=a(t,n.cssClasses.connects);ve=[],ye=[],ye.push(g(r,e[0]));for(var i=0;i<n.handles;i++)ve.push(d(t,i)),De[i]=i,ye.push(g(r,e[i+1]))}function w(e){return h(e,n.cssClasses.target),0===n.dir?h(e,n.cssClasses.ltr):h(e,n.cssClasses.rtl),0===n.ort?h(e,n.cssClasses.horizontal):h(e,n.cssClasses.vertical),"rtl"===getComputedStyle(e).direction?h(e,n.cssClasses.textDirectionRtl):h(e,n.cssClasses.textDirectionLtr),a(e,n.cssClasses.base)}function M(e,t){return!!n.tooltips[t]&&a(e.firstChild,n.cssClasses.tooltip)}function k(){return xe.hasAttribute("disabled")}function L(e){return ve[e].hasAttribute("disabled")}function x(){be&&(J("update"+oe.tooltips),be.forEach(function(e){e&&t(e)}),be=null)}function Y(){x(),be=ve.map(M),B("update"+oe.tooltips,function(e,t,r){if(be[t]){var i=e[t];!0!==n.tooltips[t]&&(i=n.tooltips[t].to(r[t])),be[t].innerHTML=i}})}function T(){J("update"+oe.aria),B("update"+oe.aria,function(e,t,r,i,o){De.forEach(function(e){var t=ve[e],i=Z(Se,e,0,!0,!0,!0),s=Z(Se,e,100,!0,!0,!0),a=o[e],u=n.ariaFormat.to(r[e]);i=Ye.fromStepping(i).toFixed(1),s=Ye.fromStepping(s).toFixed(1),a=Ye.fromStepping(a).toFixed(1),t.children[0].setAttribute("aria-valuemin",i),t.children[0].setAttribute("aria-valuemax",s),t.children[0].setAttribute("aria-valuenow",a),t.children[0].setAttribute("aria-valuetext",u)})})}function S(e,t,n){if("range"===e||"steps"===e)return Ye.xVal;if("count"===e){if(t<2)throw new Error("noUiSlider ("+ne+"): 'values' (>= 2) required for mode 'count'.");var r=t-1,i=100/r;for(t=[];r--;)t[r]=r*i;t.push(100),e="positions"}return"positions"===e?t.map(function(e){return Ye.fromStepping(n?Ye.getStep(e):e)}):"values"===e?n?t.map(function(e){return Ye.fromStepping(Ye.getStep(Ye.toStepping(e)))}):t:void 0}function D(e,t,n){function r(e,t){return(e+t).toFixed(7)/1}var o={},s=Ye.xVal[0],a=Ye.xVal[Ye.xVal.length-1],u=!1,c=!1,l=0;return n=i(n.slice().sort(function(e,t){return e-t})),n[0]!==s&&(n.unshift(s),u=!0),n[n.length-1]!==a&&(n.push(a),c=!0),n.forEach(function(i,s){var a,d,h,f,p,m,_,v,y,g,b=i,w=n[s+1],M="steps"===t;if(M&&(a=Ye.xNumSteps[s]),a||(a=w-b),!1!==b)for(void 0===w&&(w=b),a=Math.max(a,1e-7),d=b;d<=w;d=r(d,a)){for(f=Ye.toStepping(d),p=f-l,v=p/e,y=Math.round(v),g=p/y,h=1;h<=y;h+=1)m=l+h*g,o[m.toFixed(5)]=[Ye.fromStepping(m),0];_=n.indexOf(d)>-1?He:M?Fe:Pe,!s&&u&&d!==w&&(_=0),d===w&&c||(o[f.toFixed(5)]=[d,_]),l=f}}),o}function $(e,t,r){function i(e,t){var r=t===n.cssClasses.value,i=r?l:d,o=r?u:c;return t+" "+i[n.ort]+" "+o[e]}function o(e,o,u){if((u=t?t(o,u):u)!==Ae){var c=a(s,!1);c.className=i(u,n.cssClasses.marker),c.style[n.style]=e+"%",u>Pe&&(c=a(s,!1),c.className=i(u,n.cssClasses.value),c.setAttribute("data-value",o),c.style[n.style]=e+"%",c.innerHTML=r.to(o))}}var s=Oe.createElement("div"),u=[];u[Pe]=n.cssClasses.valueNormal,u[He]=n.cssClasses.valueLarge,u[Fe]=n.cssClasses.valueSub;var c=[];c[Pe]=n.cssClasses.markerNormal,c[He]=n.cssClasses.markerLarge,c[Fe]=n.cssClasses.markerSub;var l=[n.cssClasses.valueHorizontal,n.cssClasses.valueVertical],d=[n.cssClasses.markerHorizontal,n.cssClasses.markerVertical];return h(s,n.cssClasses.pips),h(s,0===n.ort?n.cssClasses.pipsHorizontal:n.cssClasses.pipsVertical),Object.keys(e).forEach(function(t){o(t,e[t][0],e[t][1])}),s}function E(){ge&&(t(ge),ge=null)}function O(e){E();var t=e.mode,n=e.density||1,r=e.filter||!1,i=e.values||!1,o=e.stepped||!1,s=S(t,i,o),a=D(n,t,s),u=e.format||{to:Math.round};return ge=xe.appendChild($(a,r,u))}function j(){var e=_e.getBoundingClientRect(),t="offset"+["Width","Height"][n.ort];return 0===n.ort?e.width||_e[t]:e.height||_e[t]}function C(e,t,r,i){var o=function(o){return!!(o=A(o,i.pageOffset,i.target||t))&&(!(k()&&!i.doNotReject)&&(!(p(xe,n.cssClasses.tap)&&!i.doNotReject)&&(!(e===Me.start&&void 0!==o.buttons&&o.buttons>1)&&((!i.hover||!o.buttons)&&(Le||o.preventDefault(),o.calcPoint=o.points[n.ort],void r(o,i))))))},s=[];return e.split(" ").forEach(function(e){t.addEventListener(e,o,!!Le&&{passive:!0}),s.push([e,o])}),s}function A(e,t,n){var r,i,o=0===e.type.indexOf("touch"),s=0===e.type.indexOf("mouse"),a=0===e.type.indexOf("pointer");if(0===e.type.indexOf("MSPointer")&&(a=!0),"mousedown"===e.type&&!e.buttons&&!e.touches)return!1;if(o){var u=function(e){return e.target===n||n.contains(e.target)||e.target.shadowRoot&&e.target.shadowRoot.contains(n)};if("touchstart"===e.type){var c=Array.prototype.filter.call(e.touches,u);if(c.length>1)return!1;r=c[0].pageX,i=c[0].pageY}else{var l=Array.prototype.find.call(e.changedTouches,u);if(!l)return!1;r=l.pageX,i=l.pageY}}return t=t||m(Oe),(s||a)&&(r=e.clientX+t.x,i=e.clientY+t.y),e.pageOffset=t,e.points=[r,i],e.cursor=s||a,e}function P(e){var t=e-s(_e,n.ort),r=100*t/j();return r=c(r),n.dir?100-r:r}function H(e){var t=100,n=!1;return ve.forEach(function(r,i){if(!L(i)){var o=Se[i],s=Math.abs(o-e),a=100===s&&100===t,u=s<t,c=s<=t&&e>o;(u||c||a)&&(n=i,t=s)}}),n}function F(e,t){"mouseout"===e.type&&"HTML"===e.target.nodeName&&null===e.relatedTarget&&N(e,t)}function I(e,t){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===e.buttons&&0!==t.buttonsProperty)return N(e,t);var r=(n.dir?-1:1)*(e.calcPoint-t.startCalcPoint);K(r>0,100*r/t.baseSize,t.locations,t.handleNumbers)}function N(e,t){t.handle&&(f(t.handle,n.cssClasses.active),$e-=1),t.listeners.forEach(function(e){je.removeEventListener(e[0],e[1])}),0===$e&&(f(xe,n.cssClasses.drag),re(),e.cursor&&(Ce.style.cursor="",Ce.removeEventListener("selectstart",r))),t.handleNumbers.forEach(function(e){G("change",e),G("set",e),G("end",e)})}function R(e,t){if(t.handleNumbers.some(L))return!1;var i;if(1===t.handleNumbers.length){i=ve[t.handleNumbers[0]].children[0],$e+=1,h(i,n.cssClasses.active)}e.stopPropagation();var o=[],s=C(Me.move,je,I,{target:e.target,handle:i,listeners:o,startCalcPoint:e.calcPoint,baseSize:j(),pageOffset:e.pageOffset,handleNumbers:t.handleNumbers,buttonsProperty:e.buttons,locations:Se.slice()}),a=C(Me.end,je,N,{target:e.target,handle:i,listeners:o,doNotReject:!0,handleNumbers:t.handleNumbers}),u=C("mouseout",je,F,{target:e.target,handle:i,listeners:o,doNotReject:!0,handleNumbers:t.handleNumbers});o.push.apply(o,s.concat(a,u)),e.cursor&&(Ce.style.cursor=getComputedStyle(e.target).cursor,ve.length>1&&h(xe,n.cssClasses.drag),Ce.addEventListener("selectstart",r,!1)),t.handleNumbers.forEach(function(e){G("start",e)})}function W(e){e.stopPropagation();var t=P(e.calcPoint),r=H(t);if(!1===r)return!1;n.events.snap||u(xe,n.cssClasses.tap,n.animationDuration),ie(r,t,!0,!0),re(),G("slide",r,!0),G("update",r,!0),G("change",r,!0),G("set",r,!0),n.events.snap&&R(e,{handleNumbers:[r]})}function z(e){var t=P(e.calcPoint),n=Ye.getStep(t),r=Ye.fromStepping(n);Object.keys(Ee).forEach(function(e){"hover"===e.split(".")[0]&&Ee[e].forEach(function(e){e.call(we,r)})})}function V(e,t){if(k()||L(t))return!1;var r=["Left","Right"],i=["Down","Up"],o=["PageDown","PageUp"],s=["Home","End"];n.dir&&!n.ort?r.reverse():n.ort&&!n.dir&&(i.reverse(),o.reverse());var a=e.key.replace("Arrow",""),u=a===o[0],c=a===o[1],l=a===i[0]||a===r[0]||u,d=a===i[1]||a===r[1]||c,h=a===s[0],f=a===s[1];if(!(l||d||h||f))return!0;e.preventDefault();var p;if(d||l){var m=n.keyboardPageMultiplier,_=l?0:1,v=fe(t),y=v[_];if(null===y)return!1;!1===y&&(y=Ye.getDefaultStep(Se[t],l,n.keyboardDefaultStep)),(c||u)&&(y*=m),y=Math.max(y,1e-7),y*=l?-1:1,p=Te[t]+y}else p=f?n.spectrum.xVal[n.spectrum.xVal.length-1]:n.spectrum.xVal[0];return ie(t,Ye.toStepping(p),!0,!0),G("slide",t),G("update",t),G("change",t),G("set",t),!1}function q(e){e.fixed||ve.forEach(function(e,t){C(Me.start,e.children[0],R,{handleNumbers:[t]})}),e.tap&&C(Me.start,_e,W,{}),e.hover&&C(Me.move,_e,z,{hover:!0}),e.drag&&ye.forEach(function(t,r){if(!1!==t&&0!==r&&r!==ye.length-1){var i=ve[r-1],o=ve[r],s=[t];h(t,n.cssClasses.draggable),e.fixed&&(s.push(i.children[0]),s.push(o.children[0])),s.forEach(function(e){C(Me.start,e,R,{handles:[i,o],handleNumbers:[r-1,r]})})}})}function B(e,t){Ee[e]=Ee[e]||[],Ee[e].push(t),"update"===e.split(".")[0]&&ve.forEach(function(e,t){G("update",t)})}function U(e){return e===oe.aria||e===oe.tooltips}function J(e){var t=e&&e.split(".")[0],n=t?e.substring(t.length):e;Object.keys(Ee).forEach(function(e){var r=e.split(".")[0],i=e.substring(r.length);t&&t!==r||n&&n!==i||U(i)&&n!==i||delete Ee[e]})}function G(e,t,r){Object.keys(Ee).forEach(function(i){var o=i.split(".")[0];e===o&&Ee[i].forEach(function(e){e.call(we,Te.map(n.format.to),t,Te.slice(),r||!1,Se.slice(),we)})})}function Z(e,t,r,i,o,s){var a;return ve.length>1&&!n.events.unconstrained&&(i&&t>0&&(a=Ye.getAbsoluteDistance(e[t-1],n.margin,0),r=Math.max(r,a)),o&&t<ve.length-1&&(a=Ye.getAbsoluteDistance(e[t+1],n.margin,1),r=Math.min(r,a))),ve.length>1&&n.limit&&(i&&t>0&&(a=Ye.getAbsoluteDistance(e[t-1],n.limit,0),r=Math.min(r,a)),o&&t<ve.length-1&&(a=Ye.getAbsoluteDistance(e[t+1],n.limit,1),r=Math.max(r,a))),n.padding&&(0===t&&(a=Ye.getAbsoluteDistance(0,n.padding[0],0),r=Math.max(r,a)),t===ve.length-1&&(a=Ye.getAbsoluteDistance(100,n.padding[1],1),r=Math.min(r,a))),r=Ye.getStep(r),!((r=c(r))===e[t]&&!s)&&r}function X(e,t){var r=n.ort;return(r?t:e)+", "+(r?e:t)}function K(e,t,n,r){var i=n.slice(),o=[!e,e],s=[e,!e];r=r.slice(),e&&r.reverse(),r.length>1?r.forEach(function(e,n){var r=Z(i,e,i[e]+t,o[n],s[n],!1);!1===r?t=0:(t=r-i[e],i[e]=r)}):o=s=[!0];var a=!1;r.forEach(function(e,r){a=ie(e,n[e]+t,o[r],s[r])||a}),a&&r.forEach(function(e){G("update",e),G("slide",e)})}function ee(e,t){return n.dir?100-e-t:e}function te(e,t){Se[e]=t,Te[e]=Ye.fromStepping(t);var r=10*(ee(t,0)-Ie),i="translate("+X(r+"%","0")+")";ve[e].style[n.transformRule]=i,se(e),se(e+1)}function re(){De.forEach(function(e){var t=Se[e]>50?-1:1,n=3+(ve.length+t*e);ve[e].style.zIndex=n})}function ie(e,t,n,r,i){return i||(t=Z(Se,e,t,n,r,!1)),!1!==t&&(te(e,t),!0)}function se(e){if(ye[e]){var t=0,r=100;0!==e&&(t=Se[e-1]),e!==ye.length-1&&(r=Se[e]);var i=r-t,o="translate("+X(ee(t,i)+"%","0")+")",s="scale("+X(i/100,"1")+")";ye[e].style[n.transformRule]=o+" "+s}}function ae(e,t){return null===e||!1===e||void 0===e?Se[t]:("number"==typeof e&&(e=String(e)),e=n.format.from(e),e=Ye.toStepping(e),!1===e||isNaN(e)?Se[t]:e)}function ue(e,t,r){var i=l(e),o=void 0===Se[0];t=void 0===t||!!t,n.animate&&!o&&u(xe,n.cssClasses.tap,n.animationDuration),De.forEach(function(e){ie(e,ae(i[e],e),!0,!1,r)});for(var s=1===De.length?0:1;s<De.length;++s)De.forEach(function(e){ie(e,Se[e],!0,!0,r)});re(),De.forEach(function(e){G("update",e),null!==i[e]&&t&&G("set",e)})}function ce(e){ue(n.start,e)}function le(e,t,n,r){if(!((e=Number(e))>=0&&e<De.length))throw new Error("noUiSlider ("+ne+"): invalid handle number, got: "+e);ie(e,ae(t,e),!0,!0,r),G("update",e),n&&G("set",e)}function de(){var e=Te.map(n.format.to);return 1===e.length?e[0]:e}function he(){J(oe.aria),J(oe.tooltips);for(var e in n.cssClasses)n.cssClasses.hasOwnProperty(e)&&f(xe,n.cssClasses[e]);for(;xe.firstChild;)xe.removeChild(xe.firstChild);delete xe.noUiSlider}function fe(e){var t=Se[e],r=Ye.getNearbySteps(t),i=Te[e],o=r.thisStep.step,s=null;if(n.snap)return[i-r.stepBefore.startValue||null,r.stepAfter.startValue-i||null];!1!==o&&i+o>r.stepAfter.startValue&&(o=r.stepAfter.startValue-i),s=i>r.thisStep.startValue?r.thisStep.step:!1!==r.stepBefore.step&&i-r.stepBefore.highestStep,100===t?o=null:0===t&&(s=null);var a=Ye.countStepDecimals();return null!==o&&!1!==o&&(o=Number(o.toFixed(a))),null!==s&&!1!==s&&(s=Number(s.toFixed(a))),[s,o]}function pe(){return De.map(fe)}function me(e,t){var r=de(),i=["margin","limit","padding","range","animate","snap","step","format","pips","tooltips"];i.forEach(function(t){void 0!==e[t]&&(o[t]=e[t])});var s=Q(o);i.forEach(function(t){void 0!==e[t]&&(n[t]=s[t])}),Ye=s.spectrum,n.margin=s.margin,n.limit=s.limit,n.padding=s.padding,n.pips?O(n.pips):E(),n.tooltips?Y():x(),Se=[],ue(e.start||r,t)}var _e,ve,ye,ge,be,we,Me=_(),ke=y(),Le=ke&&v(),xe=e,Ye=n.spectrum,Te=[],Se=[],De=[],$e=0,Ee={},Oe=e.ownerDocument,je=n.documentElement||Oe.documentElement,Ce=Oe.body,Ae=-1,Pe=0,He=1,Fe=2,Ie="rtl"===Oe.dir||1===n.ort?0:100;return function(){_e=w(xe),b(n.connect,_e),q(n.events),ue(n.start),n.pips&&O(n.pips),n.tooltips&&Y(),T()}(),we={destroy:he,steps:pe,on:B,off:J,get:de,set:ue,setHandle:le,reset:ce,__moveHandles:function(e,t,n){K(e,t,Se,n)},options:o,updateOptions:me,target:xe,removePips:E,removeTooltips:x,getTooltips:function(){return be},getOrigins:function(){return ve},pips:O}}function te(e,t){if(!e||!e.nodeName)throw new Error("noUiSlider ("+ne+"): create requires a single element, got: "+e);if(e.noUiSlider)throw new Error("noUiSlider ("+ne+"): Slider was already initialized.");var n=Q(t,e),r=ee(e,n,t);return e.noUiSlider=r,r}var ne="14.6.3";D.prototype.getDistance=function(e){var t,n=[];for(t=0;t<this.xNumSteps.length-1;t++){var r=this.xNumSteps[t];if(r&&e/r%1!=0)throw new Error("noUiSlider ("+ne+"): 'limit', 'margin' and 'padding' of "+this.xPct[t]+"% range must be divisible by step.");n[t]=b(this.xVal,e,t)}return n},D.prototype.getAbsoluteDistance=function(e,t,n){var r=0;if(e<this.xPct[this.xPct.length-1])for(;e>this.xPct[r+1];)r++;else e===this.xPct[this.xPct.length-1]&&(r=this.xPct.length-2);n||e!==this.xPct[r+1]||r++;var i,o=1,s=t[r],a=0,u=0,c=0,l=0;for(i=n?(e-this.xPct[r])/(this.xPct[r+1]-this.xPct[r]):(this.xPct[r+1]-e)/(this.xPct[r+1]-this.xPct[r]);s>0;)a=this.xPct[r+1+l]-this.xPct[r+l],t[r+l]*o+100-100*i>100?(u=a*i,o=(s-100*i)/t[r+l],i=1):(u=t[r+l]*a/100*o,o=0),n?(c-=u,this.xPct.length+l>=1&&l--):(c+=u,this.xPct.length-l>=1&&l++),s=t[r+l]*o;return e+c},D.prototype.toStepping=function(e){return e=L(this.xVal,this.xPct,e)},D.prototype.fromStepping=function(e){return x(this.xVal,this.xPct,e)},D.prototype.getStep=function(e){return e=Y(this.xPct,this.xSteps,this.snap,e)},D.prototype.getDefaultStep=function(e,t,n){var r=k(e,this.xPct);return(100===e||t&&e===this.xPct[r-1])&&(r=Math.max(r-1,1)),(this.xVal[r]-this.xVal[r-1])/n},D.prototype.getNearbySteps=function(e){var t=k(e,this.xPct);return{stepBefore:{startValue:this.xVal[t-2],step:this.xNumSteps[t-2],highestStep:this.xHighestCompleteStep[t-2]},thisStep:{startValue:this.xVal[t-1],step:this.xNumSteps[t-1],highestStep:this.xHighestCompleteStep[t-1]},stepAfter:{startValue:this.xVal[t],step:this.xNumSteps[t],highestStep:this.xHighestCompleteStep[t]}}},D.prototype.countStepDecimals=function(){var e=this.xNumSteps.map(d);return Math.max.apply(null,e)},D.prototype.convert=function(e){return this.getStep(this.toStepping(e))};var re={to:function(e){return void 0!==e&&e.toFixed(2)},from:Number},ie={target:"target",base:"base",origin:"origin",handle:"handle",handleLower:"handle-lower",handleUpper:"handle-upper",touchArea:"touch-area",horizontal:"horizontal",vertical:"vertical",background:"background",connect:"connect",connects:"connects",ltr:"ltr",rtl:"rtl",textDirectionLtr:"txt-dir-ltr",textDirectionRtl:"txt-dir-rtl",draggable:"draggable",drag:"state-drag",tap:"state-tap",active:"active",tooltip:"tooltip",pips:"pips",pipsHorizontal:"pips-horizontal",pipsVertical:"pips-vertical",marker:"marker",markerHorizontal:"marker-horizontal",markerVertical:"marker-vertical",markerNormal:"marker-normal",markerLarge:"marker-large",markerSub:"marker-sub",value:"value",valueHorizontal:"value-horizontal",valueVertical:"value-vertical",valueNormal:"value-normal",valueLarge:"value-large",valueSub:"value-sub"},oe={tooltips:".__tooltips",aria:".__aria"};return{__spectrum:D,version:ne,cssClasses:ie,create:te}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(943),i=n(34),o=n(3),s=n(38);t.libraryPrompt=r.ng.directive("libraryPrompt",["$timeout","$sce",function(e,t){return{restrict:"E",scope:{originModule:"="},template:'\n <lightbox show="show.libraryprompt" on-close="ignore()">\n\n <a class="ignore" ng-click="ignore()"><i18n>library.prompt.ignore</i18n></a>\n <hr>\n <div class="reduce-block-eight">\n <div class="block-container">\n <h1 class="centered-text">\n <i18n ng-if="step == 1">library.prompt.title1</i18n>\n <i18n ng-if="step == 2">library.prompt.title2</i18n>\n </h1>\n <hr>\n <div class="apps">\n <div ng-if="step == 1" class="container">\n <i class="library-large"></i>\n </div>\n <div>\n <div ng-if="step == 1" class="content1" ng-bind-html="content1"></div>\n <div ng-if="step == 2" class="content1 centered-text" ng-bind-html="content2"></div>\n <div ng-if="step == 2">\n <img skin-src="/img/illustrations/library-incentive.gif" />\n </div>\n </div>\n </div>\n </div>\n <hr>\n <nav class="dots">\n <ul>\n <li class="dot" ng-click="step = 1" ng-class="{ active: step == 1 }"></li>\n <li class="dot" ng-click="step = 2" ng-class="{ active: step == 2 }"></li>\n </ul>\n </nav>\n <div class="row"> \n <button ng-click="seeLater()" class="cancel"><i18n>library.prompt.see.later</i18n></button>\n <button ng-show="step == 1" ng-click="step = 2" class="right-magnet"><i18n>library.prompt.how.to.publish</i18n></button>\n <button ng-show="step == 2" ng-click="ignore()" class="right-magnet"><i18n>library.prompt.understood</i18n></button>\n </div>\n </div>\n \n </lightbox>\n ',link:function(e,n,r){if(e.show={libraryprompt:!1},e.originModule&&"Desktop"==s.deviceType){var a=o.idiom.translate(e.originModule+".library.prompt.title");e.content1=t.trustAsHtml(o.idiom.translate("library.prompt.content1").replace("[[modules]]",a)),e.content2=t.trustAsHtml(o.idiom.translate("library.prompt.content2")),e.step=1;var u;i.http().get("/userbook/preference/libraryprompt").done(function(t){var n;if(t.preference)try{n=JSON.parse(t.preference)}catch(e){console.log("Error parsing quickstart preferences")}n||(n={}),n[e.originModule]||(n[e.originModule]=0),-1!=n[e.originModule]&&(u=n,setTimeout(function(){e.show.libraryprompt=!0,e.$apply()},1e3))}),e.save=function(){i.http().putJson("/userbook/preference/libraryprompt",u)},e.ignore=function(){c(-1)},e.seeLater=function(){c(0)};var c=function(t){e.show.libraryprompt=!1,u[e.originModule]=t,e.save()}}}}}])},function(e,t,n){"use strict";function r(e,t){if(1===e.nodeType){for(var n=getComputedStyle(e),i=0;i<n.length;i++){var o=n[i];["color"].includes(o)||t.style.setProperty(o,n.getPropertyValue(o),n.getPropertyPriority(o))}if(t.style.removeProperty("color"),t.style.pointerEvents="none",t.removeAttribute("id"),t.removeAttribute("draggable"),t.removeAttribute("tooltip"),"CANVAS"===t.nodeName){var s=e,a=t,u=s.getContext("2d").getImageData(0,0,s.width,s.height);a.getContext("2d").putImageData(u,0,0)}}if(e.hasChildNodes())for(var i=0;i<e.childNodes.length;i++)r(e.childNodes[i],t.childNodes[i])}Object.defineProperty(t,"__esModule",{value:!0});var i=n(943),o=n(1042),s=n(1043),a=!1;t.odeDragTargetDirective=i.ng.directive("odeDragTarget",function(){return{restrict:"A",scope:{odeDragValue:"=",odeDragTarget:"@"},link:function(e,t,n){if(!a){navigator.userAgent.toLowerCase().indexOf("android")>-1&&o.polyfill({dragImageTranslateOverride:s.scrollBehaviourDragImageTranslateOverride,tryFindDraggableTarget:function(e){for(var t=e.target;t&&!t.getAttribute("ode-drag-value");)t=t.parentElement;return t},dragImageSetup:function(e){var t=e.cloneNode(!0);return r(e,t),t}})}a=!0;var i=t.get(0);!function(t){t.setAttribute("draggable","true"),t.addEventListener("dragstart",function(t){t.dataTransfer.setData("text",(e.odeDragTarget||"<all>")+"/"+e.odeDragValue),t.dataTransfer.effectAllowed="all";var n;n=e.odeDragTarget?document.querySelectorAll('[ode-drop-target="'+e.odeDragTarget+'"]'):document.querySelectorAll("[ode-drop-target]"),Array.prototype.forEach.call(n,function(e){e.classList.add("ode-js-drop-available")})}),t.addEventListener("dragend",function(e){var t=document.querySelectorAll(".ode-js-drop-available[ode-drop-target]");Array.prototype.forEach.call(t,function(e){e.classList.remove("ode-js-drop-available")})})}(i)}}}),t.odeDropTargetDirective=i.ng.directive("odeDropTarget",function(){return{restrict:"A",scope:{odeDropTarget:"@",odeOndrop:"&",odeDropEffect:"@"},link:function(e,t,n){var r=t.get(0);!function(t){t.addEventListener("dragover",function(n){t.classList.contains("ode-js-drop-available")&&(n.preventDefault(),e.odeDropEffect&&(n.dataTransfer.dropEffect=e.odeDropEffect),r.classList.add("ode-js-drop-hover"))}),t.addEventListener("dragenter",function(e){t.classList.contains("ode-js-drop-available")&&e.preventDefault()}),t.addEventListener("dragleave",function(){r.classList.remove("ode-js-drop-hover")}),t.addEventListener("drop",function(t){var n=t.dataTransfer.getData("text"),i=n.indexOf("/"),o=n.substr(0,i),s=n.substr(i+1),a=e.odeDropTarget?Array.isArray(e.odeDropTarget)?e.odeDropTarget:[e.odeDropTarget]:[];(a===[]||"<all>"===o||a.includes(o))&&(t.preventDefault(),e.odeOndrop({$value:s})),r.classList.remove("ode-js-drop-hover")})}(r)}}})},function(e,t,n){/*! mobile-drag-drop 2.3.0-rc.1 | Copyright (c) 2019 Tim Ruffles | MIT License */
450
450
  !function(e,n){n(t)}(0,function(e){"use strict";function t(e){return e&&e.tagName}function n(e,t,n){void 0===n&&(n=!0),document.addEventListener(e,t,!!M&&{passive:n})}function r(e,t){document.removeEventListener(e,t)}function i(e,t,n,r){void 0===r&&(r=!1);var i=M?{passive:!0,capture:r}:r;return e.addEventListener(t,n,i),{off:function(){e.removeEventListener(t,n,i)}}}function o(e){return 0===e.length?0:e.reduce(function(e,t){return t+e},0)/e.length}function s(e,t){for(var n=0;n<e.changedTouches.length;n++)if(e.changedTouches[n].identifier===t)return!0;return!1}function a(e,t,n){for(var r=[],i=[],s=0;s<t.touches.length;s++){var a=t.touches[s];r.push(a[e+"X"]),i.push(a[e+"Y"])}n.x=o(r),n.y=o(i)}function u(e,t,n,r,i){void 0===i&&(i=!0);var o=t.x,s=t.y;r&&(o+=r.x,s+=r.y),i&&(o-=parseInt(e.offsetWidth,10)/2,s-=parseInt(e.offsetHeight,10)/2);for(var a="translate3d("+o+"px,"+s+"px, 0)",u=0;u<k.length;u++){var c=k[u]+"transform";e.style[c]=a+" "+n[u]}}function c(e,t){return e?e===b[0]?w[0]:0===e.indexOf(b[1])||e===b[7]?w[1]:0===e.indexOf(b[4])?w[3]:e===b[6]?w[2]:w[1]:3===t.nodeType&&"A"===t.tagName?w[3]:w[1]}function l(e,t,n,r,i,o,s){void 0===o&&(o=!0),void 0===s&&(s=null);var a=function(e,t,n,r,i,o,s){void 0===s&&(s=null);var a=t.changedTouches[0],u=new Event(n,{bubbles:!0,cancelable:r});u.dataTransfer=o,u.relatedTarget=s,u.screenX=a.screenX,u.screenY=a.screenY,u.clientX=a.clientX,u.clientY=a.clientY,u.pageX=a.pageX,u.pageY=a.pageY;var c=e.getBoundingClientRect();return u.offsetX=u.clientX-c.left,u.offsetY=u.clientY-c.top,u}(t,n,e,o,document.defaultView,i,s),u=!t.dispatchEvent(a);return r.mode=0,u}function d(e,t){if(!e||e===b[7])return t;if(t===w[1]){if(0===e.indexOf(w[1]))return w[1]}else if(t===w[3]){if(0===e.indexOf(w[3])||e.indexOf("Link")>-1)return w[3]}else if(t===w[2]&&(0===e.indexOf(w[2])||e.indexOf("Move")>-1))return w[2];return w[0]}function h(e){if(!m){var t=Y.tryFindDraggableTarget(e);if(t)try{m=new x(e,Y,t,p)}catch(t){throw p(Y,e,3),t}}}function f(e){var t=e.target,n=function(e){o.off(),s.off(),a.off(),u.off(),t&&t.dispatchEvent(new CustomEvent(g,{bubbles:!0,cancelable:!0})),clearTimeout(r)};t&&t.dispatchEvent(new CustomEvent(y,{bubbles:!0,cancelable:!0}));var r=window.setTimeout(function(){o.off(),s.off(),a.off(),u.off(),h(e)},Y.holdToDrag),o=i(t,"touchend",n),s=i(t,"touchcancel",n),a=i(t,"touchmove",n),u=i(window,"scroll",n,!0)}function p(e,t,n){if(0===n&&e.defaultActionOverride)try{e.defaultActionOverride(t),t.defaultPrevented}catch(e){}m=null}var m,_="dnd-poly-",v="dnd-poly-",y=v+"dragstart-pending",g=v+"dragstart-cancel",b=["none","copy","copyLink","copyMove","link","linkMove","move","all"],w=["none","copy","move","link"],M=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("test",null,t)}catch(e){}return e}(),k=["","-webkit-"],L=function(){function e(e,t){this.t=e,this.i=t,this.s=w[0]}return Object.defineProperty(e.prototype,"dropEffect",{get:function(){return this.s},set:function(e){0!==this.t.mode&&b.indexOf(e)>-1&&(this.s=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"types",{get:function(){if(0!==this.t.mode)return Object.freeze(this.t.types)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"effectAllowed",{get:function(){return this.t.effectAllowed},set:function(e){2===this.t.mode&&b.indexOf(e)>-1&&(this.t.effectAllowed=e)},enumerable:!0,configurable:!0}),e.prototype.setData=function(e,t){if(2===this.t.mode){if(e.indexOf(" ")>-1)throw new Error("illegal arg: type contains space");this.t.data[e]=t,-1===this.t.types.indexOf(e)&&this.t.types.push(e)}},e.prototype.getData=function(e){if(1===this.t.mode||2===this.t.mode)return this.t.data[e]||""},e.prototype.clearData=function(e){if(2===this.t.mode){if(e&&this.t.data[e]){delete this.t.data[e];var t=this.t.types.indexOf(e);return void(t>-1&&this.t.types.splice(t,1))}this.t.data={},this.t.types=[]}},e.prototype.setDragImage=function(e,t,n){2===this.t.mode&&this.i(e,t,n)},e}(),x=function(){function e(e,t,r,i){this.h=e,this.o=t,this.u=r,this.l=i,this.v=0,this.p=null,this.g=null,this.m=e,this.I=e.changedTouches[0],this.j=this.C.bind(this),this.S=this.k.bind(this),n("touchmove",this.j,!1),n("touchend",this.S,!1),n("touchcancel",this.S,!1)}return e.prototype.A=function(){var e=this;this.v=1,this.O=w[0],this.D={data:{},effectAllowed:void 0,mode:3,types:[]},this.M={x:null,y:null},this.F={x:null,y:null};var t=this.u;if(this.N=new L(this.D,function(n,r,i){t=n,"number"!=typeof r&&"number"!=typeof i||(e.P={x:r||0,y:i||0})}),this.D.mode=2,this.N.dropEffect=w[0],l("dragstart",this.u,this.m,this.D,this.N))return this.v=3,this.T(),!1;a("page",this.m,this.F);var n,r=this.o.dragImageSetup(t);if(this.L=(n=r,k.map(function(e){var t=n.style[e+"transform"];return t&&"none"!==t?t.replace(/translate\(\D*\d+[^,]*,\D*\d+[^,]*\)\s*/g,""):""})),r.style.position="absolute",r.style.left="0px",r.style.top="0px",r.style.zIndex="999999",r.classList.add("dnd-poly-drag-image"),r.classList.add("dnd-poly-icon"),this._=r,!this.P)if(this.o.dragImageOffset)this.P={x:this.o.dragImageOffset.x,y:this.o.dragImageOffset.y};else if(this.o.dragImageCenterOnTouch){var i=getComputedStyle(t);this.P={x:0-parseInt(i.marginLeft,10),y:0-parseInt(i.marginTop,10)}}else{var o=t.getBoundingClientRect();i=getComputedStyle(t),this.P={x:o.left-this.I.clientX-parseInt(i.marginLeft,10)+o.width/2,y:o.top-this.I.clientY-parseInt(i.marginTop,10)+o.height/2}}return u(this._,this.F,this.L,this.P,this.o.dragImageCenterOnTouch),document.body.appendChild(this._),this.V=window.setInterval(function(){e.X||(e.X=!0,e.Y(),e.X=!1)},this.o.iterationInterval),!0},e.prototype.T=function(){this.V&&(clearInterval(this.V),this.V=null),r("touchmove",this.j),r("touchend",this.S),r("touchcancel",this.S),this._&&(this._.parentNode.removeChild(this._),this._=null),this.l(this.o,this.m,this.v)},e.prototype.C=function(e){var t=this;if(!1!==s(e,this.I.identifier)){if(this.m=e,0===this.v){var n=void 0;if(this.o.dragStartConditionOverride)try{n=this.o.dragStartConditionOverride(e)}catch(e){n=!1}else n=1===e.touches.length;return n?void(!0===this.A()&&(this.h.preventDefault(),e.preventDefault())):void this.T()}if(e.preventDefault(),a("client",e,this.M),a("page",e,this.F),this.o.dragImageTranslateOverride)try{var r=!1;if(this.o.dragImageTranslateOverride(e,{x:this.M.x,y:this.M.y},this.p,function(e,n){t._&&(r=!0,t.M.x+=e,t.M.y+=n,t.F.x+=e,t.F.y+=n,u(t._,t.F,t.L,t.P,t.o.dragImageCenterOnTouch))}),r)return}catch(e){}u(this._,this.F,this.L,this.P,this.o.dragImageCenterOnTouch)}},e.prototype.k=function(e){if(!1!==s(e,this.I.identifier)){if(this.o.dragImageTranslateOverride)try{this.o.dragImageTranslateOverride(void 0,void 0,void 0,function(){})}catch(e){}0!==this.v?(e.preventDefault(),this.v="touchcancel"===e.type?3:2):this.T()}},e.prototype.Y=function(){var e=this,n=this.O;this.D.mode=3,this.N.dropEffect=w[0];var r=l("drag",this.u,this.m,this.D,this.N);if(r&&(this.O=w[0]),r||2===this.v||3===this.v)return this.q(this.v)?void function(e,t,n,r){var i=getComputedStyle(e);if("hidden"!==i.visibility&&"none"!==i.display){t.classList.add("dnd-poly-snapback");var o=getComputedStyle(t),s=parseFloat(o.transitionDuration);if(isNaN(s)||0===s)r();else{var a=e.getBoundingClientRect(),c={x:a.left,y:a.top};c.x+=document.body.scrollLeft||document.documentElement.scrollLeft,c.y+=document.body.scrollTop||document.documentElement.scrollTop,c.x-=parseInt(i.marginLeft,10),c.y-=parseInt(i.marginTop,10);var l=parseFloat(o.transitionDelay),d=Math.round(1e3*(s+l));u(t,c,n,void 0,!1),setTimeout(r,d)}}else r()}(this.u,this._,this.L,function(){e.B()}):void this.B();var i=this.o.elementFromPoint(this.M.x,this.M.y),o=this.g;i!==this.p&&i!==this.g&&(this.p=i,null!==this.g&&(this.D.mode=3,this.N.dropEffect=w[0],l("dragexit",this.g,this.m,this.D,this.N,!1)),null===this.p?this.g=this.p:(this.D.mode=3,this.N.dropEffect=c(this.D.effectAllowed,this.u),l("dragenter",this.p,this.m,this.D,this.N)?(this.g=this.p,this.O=d(this.N.effectAllowed,this.N.dropEffect)):this.p!==document.body&&(this.g=document.body))),o!==this.g&&t(o)&&(this.D.mode=3,this.N.dropEffect=w[0],l("dragleave",o,this.m,this.D,this.N,!1,this.g)),t(this.g)&&(this.D.mode=3,this.N.dropEffect=c(this.D.effectAllowed,this.u),!1===l("dragover",this.g,this.m,this.D,this.N)?this.O=w[0]:this.O=d(this.N.effectAllowed,this.N.dropEffect)),n!==this.O&&this._.classList.remove(_+n);var s=_+this.O;this._.classList.add(s)},e.prototype.q=function(e){var n=this.O===w[0]||null===this.g||3===e;return n?t(this.g)&&(this.D.mode=3,this.N.dropEffect=w[0],l("dragleave",this.g,this.m,this.D,this.N,!1)):t(this.g)&&(this.D.mode=1,this.N.dropEffect=this.O,!0===l("drop",this.g,this.m,this.D,this.N)?this.O=this.N.dropEffect:this.O=w[0]),n},e.prototype.B=function(){this.D.mode=3,this.N.dropEffect=this.O,l("dragend",this.u,this.m,this.D,this.N,!1),this.v=2,this.T()},e}(),Y={iterationInterval:150,tryFindDraggableTarget:function(e){var t=e.target;do{if(!1!==t.draggable){if(!0===t.draggable)return t;if(t.getAttribute&&"true"===t.getAttribute("draggable"))return t}}while((t=t.parentNode)&&t!==document.body)},dragImageSetup:function(e){var t=e.cloneNode(!0);return function e(t,n){if(1===t.nodeType){for(var r=getComputedStyle(t),i=0;i<r.length;i++){var o=r[i];n.style.setProperty(o,r.getPropertyValue(o),r.getPropertyPriority(o))}if(n.style.pointerEvents="none",n.removeAttribute("id"),n.removeAttribute("class"),n.removeAttribute("draggable"),"CANVAS"===n.nodeName){var s=t,a=n,u=s.getContext("2d").getImageData(0,0,s.width,s.height);a.getContext("2d").putImageData(u,0,0)}}if(t.hasChildNodes())for(i=0;i<t.childNodes.length;i++)e(t.childNodes[i],n.childNodes[i])}(e,t),t},elementFromPoint:function(e,t){return document.elementFromPoint(e,t)}};e.polyfill=function(e){if(e&&Object.keys(e).forEach(function(t){Y[t]=e[t]}),!Y.forceApply){var t=(r={dragEvents:"ondragstart"in document.documentElement,draggable:"draggable"in document.documentElement,userAgentSupportingNativeDnD:void 0},i=!!window.chrome||/chrome/i.test(navigator.userAgent),r.userAgentSupportingNativeDnD=!(/iPad|iPhone|iPod|Android/.test(navigator.userAgent)||i&&"ontouchstart"in document.documentElement),r);if(t.userAgentSupportingNativeDnD&&t.draggable&&t.dragEvents)return!1}var r,i;return Y.holdToDrag?n("touchstart",f,!1):n("touchstart",h,!1),!0},Object.defineProperty(e,"__esModule",{value:!0})})},function(e,t,n){!function(e,n){n(t)}(0,function(e){"use strict";function t(e){return e===document.body||e===document.documentElement}function n(e,n){var r;if(t(e))r=0===n?e.clientLeft:e.clientTop;else{var i=e.getBoundingClientRect();r=0===n?i.left:i.top}return r}function r(e,n){return t(e)?0===n?window.innerWidth:window.innerHeight:0===n?e.clientWidth:e.clientHeight}function i(e,n,r){var i=0===n?"scrollLeft":"scrollTop",o=t(e);if(2===arguments.length)return o?document.body[i]||document.documentElement[i]:e[i];o?(document.documentElement[i]+=r,document.body[i]+=r):e[i]+=r}function o(e){var t=getComputedStyle(e);return e.scrollHeight>e.clientHeight&&("scroll"===t.overflowY||"auto"===t.overflowY)||e.scrollWidth>e.clientWidth&&("scroll"===t.overflowX||"auto"===t.overflowX)}function s(e){do{if(!e)return;if(o(e))return e;if(e===document.documentElement)return null}while(e=e.parentNode);return null}function a(e,t,n){return e<n?-1:t-e<n?1:0}function u(e,t,n,r){return-1===e?Math.abs(t-r):1===e?Math.abs(n-t-r):0}function c(e,t,n){var r=0===e?n.scrollX:n.scrollY;if(1===t){return r>=(0===e?n.scrollWidth-n.width:n.scrollHeight-n.height)}return-1!==t||r<=0}function l(e,t,n,r){m=t,y=r,_!==n&&(_=n,v=s(_)),f(m,v,g.threshold,b,w)?d():p&&(window.cancelAnimationFrame(p),p=null)}function d(){p||(p=window.requestAnimationFrame(h))}function h(){var e=0,n=0,r=t(v);0!==b.horizontal&&(e=Math.round(g.velocityFn(w.x,g.threshold)*b.horizontal),i(v,0,e)),0!==b.vertical&&(n=Math.round(g.velocityFn(w.y,g.threshold)*b.vertical),i(v,1,n)),r?y(e,n):y(0,0),p=null,f(m,v,g.threshold,b,w)&&d()}function f(e,t,o,s,l){if(!e||!t)return!1;var d={x:n(t,0),y:n(t,1),width:r(t,0),height:r(t,1),scrollX:i(t,0),scrollY:i(t,1),scrollWidth:t.scrollWidth,scrollHeight:t.scrollHeight},h={x:e.x-d.x,y:e.y-d.y};return s.horizontal=a(h.x,d.width,o),s.vertical=a(h.y,d.height,o),s.horizontal&&c(0,s.horizontal,d)?s.horizontal=0:s.horizontal&&(l.x=u(s.horizontal,h.x,d.width,o)),s.vertical&&c(1,s.vertical,d)?s.vertical=0:s.vertical&&(l.y=u(s.vertical,h.y,d.height,o)),!(!s.horizontal&&!s.vertical)}var p,m,_,v,y,g={threshold:75,velocityFn:function(e,t){var n=e/t;return n*n*n*t}},b={horizontal:0,vertical:0},w={x:0,y:0},M=l;e.scrollBehaviourDragImageTranslateOverride=M,Object.defineProperty(e,"__esModule",{value:!0})})},function(e,t,n){"use strict";function r(e,t,n){angular.isFunction(n)&&(n={post:n});var r,i=t.contents().remove();return{pre:n&&n.pre?n.pre:null,post:function(t,o){r||(r=e(i)),r(t,function(e){o.append(e)}),n&&n.post&&n.post.apply(null,arguments)}}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(943);t.structureTree=i.ng.directive("structureTree",["$compile",function(e){return{restrict:"E",scope:{items:"=",select:"&"},template:'\n <ul ng-show="display.show">\n <li ng-repeat="item in items"\n ng-class="{active: isSelected(item)}">\n <span ng-click="toggleChildren($event)"\n ng-class="{caret: (item.children && item.children.length > 0) || (item.classes && item.classes.length > 0)}"></span>\n <span ng-click="selectItem(item.id)">[[item.name]]</span>\n <ul class="nested" ng-if="item.children && item.children.length > 0">\n <structure-tree items="item.children" select="bubbleSelect(id)"></structure-tree>\n </ul>\n <ul class="nested" ng-if="item.classes && item.classes.length > 0">\n <li ng-repeat="class in item.classes" \n ng-click="selectItem(class.id)"\n ng-class="{active: isSelected(class)}">[[class.name]]</li>\n </ul>\n </li>\n </ul>\n ',compile:function(t){return r(e,t,function(e){function t(t){var n=document.getElementsByClassName("structure-tree")[0],r=document.getElementsByClassName("structure-tree__current")[0];return t.target==r?(e.display.show=!e.display.show,void e.$apply()):n.contains(t.target)?void 0:(e.display.show=!1,void e.$apply())}e.display={show:!1},e.$on("selectedItem",function(t,n){e.selectedItemId=n}),document.addEventListener("click",t),e.toggleChildren=function(e){var t=e.target.parentElement.querySelector(".nested");t&&t.classList.toggle("unfolded"),e.target.classList.toggle("caret-down")},e.selectItem=function(t){e.select({id:t}),e.$emit("selectedItem",t),e.$broadcast("selectedItem",t)},e.bubbleSelect=function(t){e.selectItem(t)},e.isSelected=function(t){return t.id===e.selectedItemId},e.$on("$destroy",function(){document.removeEventListener("click",t)})})}}}])},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(943),s=n(1),a=n(937),u=n(7);t.toast=o.ng.directive("toastOnboarding",["$http",function(e){return{restrict:"E",scope:{show:"=",confirm:"&"},templateUrl:"/assets/js/entcore/template/video/onboarding.html",link:function(e,t,n){function o(){return r(this,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,u.default.get("/userbook/preference/"+h).then(function(t){var n;if(t.data.preference)try{n=JSON.parse(t.data.preference),e.display.preference=n.showOnboardingVideo,e.display.visible=!0===e.display.preference}catch(e){console.log(e)}else e.display.visible=!0})];case 1:return t.sent(),[2]}})})}function c(){e.display.preference&&u.default.put("/userbook/preference/"+h,JSON.stringify({showOnboardingVideo:!1}))}function l(){s.$("body").addClass("highlight-video"),s.$("html, body").animate({scrollTop:s.$("editor").offset().top},1e3,function(){s.$("body").css("overflow","hidden")}),e.$apply()}function d(){e.display.visible=!1,s.$("body").removeAttr("style").removeClass("highlight-video")}e.display={preference:!0,visible:!1};var h="onboarding";e.hideToastAndSavePreference=function(e){d(),!0===e&&c()},e.openEmbedder=function(){d(),c(),e.show=!0,e.confirm()},function(){r(this,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,a.Me.hasWorkflowRight("video.upload")];case 1:return t.sent()?[4,o()]:[3,4];case 2:return t.sent(),!0!==e.display.visible?[3,4]:[4,l()];case 3:t.sent(),t.label=4;case 4:return[2]}})})}()}}}])},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(1047)),r(n(1048)),r(n(1049))},function(e,t,n){"use strict";function r(){return{restrict:"E",templateUrl:"/assets/js/entcore/template/media-library/virtual-media-library/virtual-media-content.html",scope:{selectedVirtualFolder:"=",search:"="},controllerAs:"vm",bindToController:!0,controller:["$scope","$timeout",o],link:function(e,t,n,r){e.$watchGroup(["vm.selectedVirtualFolder.folders","vm.selectedVirtualFolder.documents"],function(e,t,n){e!==t&&r.setDocuments(e[0],e[1]),r.safeApply(n)}),e.$watch("vm.search",function(t,n){t!==n&&(r.filterDocument(t),r.safeApply(e))})}}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(943),o=function(){function e(e,t){this.$scope=e,this.$timeout=t,this.isMultiple=!1,this.fileFormat="",this.mediaServiceLibrary={},this.folders=[],this.documents=[]}return e.prototype.$onInit=function(){var e=this;this.isMultiple=this.$scope.$parent.multiple,this.fileFormat=this.$scope.$parent.fileFormat,this.$timeout(function(){e.mediaServiceLibrary=e.$scope.vm.selectedVirtualFolder,e.setDocuments()})},e.prototype.updateSelection=function(e){this.isMultiple||(this.documents.forEach(function(e){return e.selected=!1}),e.selected=!0)},e.prototype.setDocuments=function(e,t){e&&t?(this.folders=e,this.documents=this.filterDocumentByFormat(t)):this.mediaServiceLibrary?(this.folders=this.mediaServiceLibrary.folders,this.documents=this.filterDocumentByFormat(this.mediaServiceLibrary.documents)):(this.folders=[],this.documents=[])},e.prototype.filterDocument=function(e){e&&e.trim().length>0?(this.folders=this.mediaServiceLibrary.folders.filter(function(t){return t.name.toLowerCase().includes(e.toLowerCase())}),this.documents=this.filterDocumentByFormat(this.mediaServiceLibrary.documents.filter(function(t){return t.name.toLowerCase().includes(e.toLowerCase())}))):this.setDocuments()},e.prototype.filterDocumentByFormat=function(e){var t=this;return"any"===this.fileFormat?e:e.filter(function(e){return"function"==typeof e.role&&e.role()===t.fileFormat||e.role===t.fileFormat})},e.prototype.getThumbUrl=function(e){return"function"==typeof e.thumbUrl?e.thumbUrl():e.thumbUrl},e.prototype.getRole=function(e){return"function"==typeof e.role?e.role():e.role},e.prototype.safeApply=function(){var e=this.$scope.$root.$$phase;"$apply"!==e&&"$digest"!==e&&this.$scope.$apply()},e}();t.virtualMediaLibraryDocumentView=i.ng.directive("virtualMediaLibraryDocumentView",r)},function(e,t,n){"use strict";function r(){return{restrict:"E",templateUrl:"/assets/js/entcore/template/media-library/virtual-media-library/virtual-media-folder.html",scope:{selectedVirtualFolder:"=",onClick:"&"},controllerAs:"vm",bindToController:!0,controller:["$scope",f],link:function(e,t,n,r){e.$parent.$watch("display.listFrom",function(t){null!=t&&(r.openedFolder=[],r.selectedFolder=null,e.vm.selectedVirtualFolder=null,e.vm.mediaServiceLibrary=null)})}}}var i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(943),a=n(38),u=n(34),c=n(386),l=n(391),d=l.workspace.v2.models,h=n(3),f=function(){function e(e){this.$scope=e,this.initFolderCache=function(e){e.cacheChildren=new d.CacheList(0,function(){return!1},function(){return!1}),e.cacheChildren.setData([]),e.cacheChildren.disableCache(),e.cacheDocument=new d.CacheList(0,function(){return!1},function(){return!1}),e.cacheDocument.setData([]),e.cacheDocument.disableCache()},this.apps=[],this.openedFolder=[],this.folderServiceTree=null,this.selectedFolderService=null,this.mediaServiceLibrary=null}return e.prototype.$onInit=function(){return i(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.loadBehavioursModules()];case 1:return e.sent(),this.initServiceTree(),this.safeApply(),[2]}})})},e.prototype.loadBehavioursModules=function(){return i(this,void 0,void 0,function(){var e,t;return o(this,function(n){switch(n.label){case 0:return[4,u.httpPromisy().get("/workspace/conf/public")];case 1:return e=n.sent(),this.apps=e&&e["folder-service"]?e["folder-service"]:[],t=[],this.apps.forEach(function(e){a.appPrefix!==e&&(t.push(h.idiom.addBundlePromise("/"+e+"/i18n")),t.push(c.Behaviours.load(e)))}),[2,Promise.all(t)]}})})},e.prototype.initServiceTree=function(){var e=this,t=[];this.apps.forEach(function(n){if(c.Behaviours.applicationsBehaviours[n].mediaLibraryService&&c.Behaviours.applicationsBehaviours[n].mediaLibraryService.enableInitFolderTree()){var r={name:h.idiom.translate(n+".virtual.media.title"),children:[],hierarchical:!0};e.initFolderCache(r),r.app=n,t.push(r)}});var n=this;this.folderServiceTree={get trees(){return t},isDisabled:function(e){return!1},isOpenedFolder:function(e){return n.openedFolder.some(function(t){return t===e})},isSelectedFolder:function(e){return n.selectedFolder===e},openFolder:function(e){return i(this,void 0,void 0,function(){var r,i,s,a,s;return o(this,function(o){switch(o.label){case 0:if(n.selectedFolder=e,n.openedFolder.some(function(t){return t===e})||n.openedFolder.push(e),!e.hierarchical)return[3,5];n.mediaServiceLibrary=c.Behaviours.applicationsBehaviours[n.selectedFolder.app].mediaLibraryService,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.mediaServiceLibrary.initFolderTree()];case 2:return o.sent(),t.filter(function(t){return t.name!==e.name&&e.hierarchical}).forEach(function(e){return e.children=[]}),r=t.find(function(t){return t.name===e.name&&e.hierarchical}),r&&(n.selectedFolderService=r,r.children=n.mediaServiceLibrary.folders),n.mediaServiceLibrary.openedTree=this,n.triggerClick(n.mediaServiceLibrary),n.safeApply(),[3,4];case 3:return i=o.sent(),s="Error while initializing folderService: ",console.error(s+(i.message||i)),[3,4];case 4:return[3,8];case 5:return o.trys.push([5,7,,8]),[4,n.mediaServiceLibrary.openFolder(e)];case 6:return o.sent(),n.selectedFolder.children&&(n.selectedFolder.children=n.mediaServiceLibrary.folders),n.safeApply(),[3,8];case 7:return a=o.sent(),s="Error while opening folderFolder: ",console.error(s+(a.message||a)),[3,8];case 8:return[2]}})})}}},e.prototype.triggerClick=function(e){this.$scope.$eval(this.$scope.vm.onClick()),this.$scope.vm.selectedVirtualFolder=e},e.prototype.safeApply=function(){var e=this.$scope.$root.$$phase;"$apply"!==e&&"$digest"!==e&&this.$scope.$apply()},e}();t.virtualMediaLibrary=s.ng.directive("virtualMediaLibrary",r)},function(e,t,n){"use strict";function r(){return{restrict:"E",template:'\n <button type="button" class="right-magnet" ng-disabled="vm.loading || vm.selectedDocuments().length === 0" ng-click="vm.onAddDocuments()">\n <i18n>library.browse.add</i18n>\n </button>',scope:{documents:"=",folders:"=",selectedVirtualFolder:"=",onClick:"&"},controllerAs:"vm",bindToController:!0,controller:["$scope","$timeout",a],link:function(e,t,n,r){}}}var i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(943),a=function(){function e(e,t){this.$scope=e,this.$timeout=t,this.mediaServiceLibrary=null,this.fileFormat="",this.loading=!1,this.copiedDocuments=[]}return e.prototype.$onInit=function(){var e=this;this.fileFormat=this.$scope.$parent.fileFormat,this.$timeout(function(){return e.mediaServiceLibrary=e.$scope.vm.selectedVirtualFolder})},e.prototype.$onDestroy=function(){this.mediaServiceLibrary.clearCopiedDocumentsAfterSelect(this.copiedDocuments)},e.prototype.selectedDocuments=function(){var e=this.$scope.vm.selectedVirtualFolder;return e.documents?this.filterDocumentByFormat(e.documents).filter(function(e){return e.selected}):[]},e.prototype.filterDocumentByFormat=function(e){var t=this;return"any"===this.fileFormat?e:e.filter(function(e){return"function"==typeof e.role&&e.role()===t.fileFormat||e.role===t.fileFormat})},e.prototype.onAddDocuments=function(){return i(this,void 0,void 0,function(){var e,t,n,r=this;return o(this,function(i){switch(i.label){case 0:this.loading=!0,i.label=1;case 1:return i.trys.push([1,3,,4]),e=this,[4,this.mediaServiceLibrary.onSelectVirtualDocumentsBefore(this.selectedDocuments())];case 2:return e.copiedDocuments=i.sent(),this.copiedDocuments.forEach(function(e){e.selected=!0,r.$scope.vm.documents.push(e)}),this.$scope.$eval(this.$scope.vm.onClick()),[3,4];case 3:return t=i.sent(),n="Error while attempting to add documents children: ",console.error(n+t.message),[3,4];case 4:return this.loading=!1,[2]}})})},e.prototype.safeApply=function(){var e=this.$scope.$root.$$phase;"$apply"!==e&&"$digest"!==e&&this.$scope.$apply()},e}();t.virtualMediaLibraryButton=s.ng.directive("virtualMediaLibraryButton",r)},function(e,t,n){"use strict";function r(e){e.directive("withTheme",function(){return{restrict:"EA",link:function(e,n,r){return o(this,void 0,void 0,function(){var e,r,i,o,c,l,d;return s(this,function(s){switch(s.label){case 0:return[4,u.ui.getConf()];case 1:return e=s.sent(),[4,a.skin.onSkinReady];case 2:for(s.sent(),r=a.skin.themeName,i=a.skin.skinName,o=a.skin.theme,c=0,l=e.overriding;c<l.length;c++)d=l[c],d.child==r&&d.bootstrapVersion&&(o=window.CDN_DOMAIN+"/assets/themes/"+d.bootstrapVersion+"/skins/"+i+"/",n.addClass(d.bootstrapVersion),t.themeService.loadThemeJs(d.bootstrapVersion));return u.ui.setStyle(o),[2]}})})}}})}function i(e){e.directive("withThemeLegacy",function(){return{restrict:"EA",link:function(e,n,r){return o(this,void 0,void 0,function(){var e,r,i,o,c,l,d,h;return s(this,function(s){switch(s.label){case 0:return[4,u.ui.getConf()];case 1:return e=s.sent(),[4,a.skin.onSkinReady];case 2:for(s.sent(),r=a.skin.themeName,i=a.skin.skinName,o=a.skin.theme,c=0,l=e.overriding;c<l.length;c++)d=l[c],h=d.legacyVersion||d.parent,d.child==r&&h&&(o=window.CDN_DOMAIN+"/assets/themes/"+h+"/skins/"+i+"/",n.addClass(h),t.themeService.loadThemeJs(h),a.skin.theme="/assets/themes/"+h+"/skins/"+i+"/");return u.ui.setStyle(o),[2]}})})}}})}var o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(t,"__esModule",{value:!0});var a=n(33),u=n(6);t.themeService={loadOldWrappedTheme:function(e,t){var n="dev";window.springboardBuildDate&&(n=window.springboardBuildDate),jQuery("#themeOld").remove();var r=jQuery("<link>",{rel:"stylesheet",type:"text/css",href:window.CDN_DOMAIN+"/assets/themes/"+e+"/skins/"+t+"/wrapped.theme.css?version="+n,id:"themeOld"}).attr("crossorigin","anonymous");jQuery("head").append(r)},loadThemeJs:function(e){var t="dev";window.springboardBuildDate&&(t=window.springboardBuildDate),jQuery("#themeJS").remove();var n=jQuery("<script>",{type:"text/javascript",src:window.CDN_DOMAIN+"/assets/themes/"+e+"/js/theme.js?version="+t,id:"themeJS"});jQuery("body").append(n)}},t.initThemeDirective=r,t.initThemeLegacyDirective=i}]);
451
451
  //# sourceMappingURL=ng-app.js.map