(function(e){const t=e["en"]=e["en"]||{};t.dictionary=Object.assign(t.dictionary||{},{"%0 of %1":"%0 of %1","Align cell text to the bottom":"Align cell text to the bottom","Align cell text to the center":"Align cell text to the center","Align cell text to the left":"Align cell text to the left","Align cell text to the middle":"Align cell text to the middle","Align cell text to the right":"Align cell text to the right","Align cell text to the top":"Align cell text to the top","Align center":"Align center","Align left":"Align left","Align right":"Align right","Align table to the left":"Align table to the left","Align table to the right":"Align table to the right",Alignment:"Alignment","Almost equal to":"Almost equal to",Angle:"Angle","Approximately equal to":"Approximately equal to",Aquamarine:"Aquamarine","Asterisk operator":"Asterisk operator","Austral sign":"Austral sign","back with leftwards arrow above":"back with leftwards arrow above",Background:"Background",Big:"Big","Bitcoin sign":"Bitcoin sign",Black:"Black","Block quote":"Block quote",Blue:"Blue","Blue marker":"Blue marker",Bold:"Bold",Border:"Border","Break text":"Break text","Bulleted List":"Bulleted List","Bulleted list styles toolbar":"Bulleted list styles toolbar",Cancel:"Cancel","Cannot upload file:":"Cannot upload file:","Cedi sign":"Cedi sign","Cell properties":"Cell properties","Cent sign":"Cent sign","Center table":"Center table","Centered image":"Centered image","Change image text alternative":"Change image text alternative","Character categories":"Character categories","Characters: %0":"Characters: %0","Choose heading":"Choose heading","Choose language":"Choose language",Circle:"Circle",Code:"Code","Colon sign":"Colon sign",Color:"Color","Color picker":"Color picker",Column:"Column","Contains as member":"Contains as member","Copyright sign":"Copyright sign","Cruzeiro sign":"Cruzeiro sign","Currency sign":"Currency sign",Dashed:"Dashed",Decimal:"Decimal","Decimal with leading zero":"Decimal with leading zero","Decrease indent":"Decrease indent",Default:"Default","Degree sign":"Degree sign","Delete column":"Delete column","Delete row":"Delete row","Dim grey":"Dim grey",Dimensions:"Dimensions","Disable editing":"Disable editing",Disc:"Disc","Division sign":"Division sign","Document colors":"Document colors","Dollar sign":"Dollar sign","Dong sign":"Dong sign",Dotted:"Dotted",Double:"Double","Double dagger":"Double dagger","Double exclamation mark":"Double exclamation mark","Double low-9 quotation mark":"Double low-9 quotation mark","Double question mark":"Double question mark",Downloadable:"Downloadable","downwards arrow to bar":"downwards arrow to bar","downwards dashed arrow":"downwards dashed arrow","downwards double arrow":"downwards double arrow","Drachma sign":"Drachma sign","Dropdown toolbar":"Dropdown toolbar","Edit block":"Edit block","Edit link":"Edit link","Edit source":"Edit source","Editor toolbar":"Editor toolbar","Element of":"Element of","Em dash":"Em dash","Empty set":"Empty set","Empty snippet content":"Empty snippet content","En dash":"En dash","Enable editing":"Enable editing","end with leftwards arrow above":"end with leftwards arrow above","Enter image caption":"Enter image caption","Enter table caption":"Enter table caption","Euro sign":"Euro sign","Euro-currency sign":"Euro-currency sign","Exclamation question mark":"Exclamation question mark",Find:"Find","Find and replace":"Find and replace","Find in text…":"Find in text…","Font Background Color":"Font Background Color","Font Color":"Font Color","Font Family":"Font Family","Font Size":"Font Size","For all":"For all","Fraction slash":"Fraction slash","French franc sign":"French franc sign","Full size image":"Full size image","German penny sign":"German penny sign","Greater-than or equal to":"Greater-than or equal to","Greater-than sign":"Greater-than sign",Green:"Green","Green marker":"Green marker","Green pen":"Green pen",Grey:"Grey",Groove:"Groove","Guarani sign":"Guarani sign","Header column":"Header column","Header row":"Header row",Heading:"Heading","Heading 1":"Heading 1","Heading 2":"Heading 2","Heading 3":"Heading 3","Heading 4":"Heading 4","Heading 5":"Heading 5","Heading 6":"Heading 6",Height:"Height",Highlight:"Highlight","Horizontal ellipsis":"Horizontal ellipsis","Horizontal line":"Horizontal line","Horizontal text alignment toolbar":"Horizontal text alignment toolbar","Hryvnia sign":"Hryvnia sign","HTML object":"HTML object","HTML snippet":"HTML snippet",Huge:"Huge","Identical to":"Identical to","Image resize list":"Image resize list","Image toolbar":"Image toolbar","image widget":"image widget","In line":"In line","Increase indent":"Increase indent","Indian rupee sign":"Indian rupee sign",Infinity:"Infinity",Insert:"Insert","Insert code block":"Insert code block","Insert column left":"Insert column left","Insert column right":"Insert column right","Insert HTML":"Insert HTML","Insert image":"Insert image","Insert image via URL":"Insert image via URL","Insert media":"Insert media","Insert paragraph after block":"Insert paragraph after block","Insert paragraph before block":"Insert paragraph before block","Insert row above":"Insert row above","Insert row below":"Insert row below","Insert table":"Insert table",Inset:"Inset",Integral:"Integral",Intersection:"Intersection","Inverted exclamation mark":"Inverted exclamation mark","Inverted question mark":"Inverted question mark",Italic:"Italic",Justify:"Justify","Justify cell text":"Justify cell text","Kip sign":"Kip sign",Language:"Language","Latin capital letter a with breve":"Latin capital letter a with breve","Latin capital letter a with macron":"Latin capital letter a with macron","Latin capital letter a with ogonek":"Latin capital letter a with ogonek","Latin capital letter c with acute":"Latin capital letter c with acute","Latin capital letter c with caron":"Latin capital letter c with caron","Latin capital letter c with circumflex":"Latin capital letter c with circumflex","Latin capital letter c with dot above":"Latin capital letter c with dot above","Latin capital letter d with caron":"Latin capital letter d with caron","Latin capital letter d with stroke":"Latin capital letter d with stroke","Latin capital letter e with breve":"Latin capital letter e with breve","Latin capital letter e with caron":"Latin capital letter e with caron","Latin capital letter e with dot above":"Latin capital letter e with dot above","Latin capital letter e with macron":"Latin capital letter e with macron","Latin capital letter e with ogonek":"Latin capital letter e with ogonek","Latin capital letter eng":"Latin capital letter eng","Latin capital letter g with breve":"Latin capital letter g with breve","Latin capital letter g with cedilla":"Latin capital letter g with cedilla","Latin capital letter g with circumflex":"Latin capital letter g with circumflex","Latin capital letter g with dot above":"Latin capital letter g with dot above","Latin capital letter h with circumflex":"Latin capital letter h with circumflex","Latin capital letter h with stroke":"Latin capital letter h with stroke","Latin capital letter i with breve":"Latin capital letter i with breve","Latin capital letter i with dot above":"Latin capital letter i with dot above","Latin capital letter i with macron":"Latin capital letter i with macron","Latin capital letter i with ogonek":"Latin capital letter i with ogonek","Latin capital letter i with tilde":"Latin capital letter i with tilde","Latin capital letter j with circumflex":"Latin capital letter j with circumflex","Latin capital letter k with cedilla":"Latin capital letter k with cedilla","Latin capital letter l with acute":"Latin capital letter l with acute","Latin capital letter l with caron":"Latin capital letter l with caron","Latin capital letter l with cedilla":"Latin capital letter l with cedilla","Latin capital letter l with middle dot":"Latin capital letter l with middle dot","Latin capital letter l with stroke":"Latin capital letter l with stroke","Latin capital letter n with acute":"Latin capital letter n with acute","Latin capital letter n with caron":"Latin capital letter n with caron","Latin capital letter n with cedilla":"Latin capital letter n with cedilla","Latin capital letter o with breve":"Latin capital letter o with breve","Latin capital letter o with double acute":"Latin capital letter o with double acute","Latin capital letter o with macron":"Latin capital letter o with macron","Latin capital letter r with acute":"Latin capital letter r with acute","Latin capital letter r with caron":"Latin capital letter r with caron","Latin capital letter r with cedilla":"Latin capital letter r with cedilla","Latin capital letter s with acute":"Latin capital letter s with acute","Latin capital letter s with caron":"Latin capital letter s with caron","Latin capital letter s with cedilla":"Latin capital letter s with cedilla","Latin capital letter s with circumflex":"Latin capital letter s with circumflex","Latin capital letter t with caron":"Latin capital letter t with caron","Latin capital letter t with cedilla":"Latin capital letter t with cedilla","Latin capital letter t with stroke":"Latin capital letter t with stroke","Latin capital letter u with breve":"Latin capital letter u with breve","Latin capital letter u with double acute":"Latin capital letter u with double acute","Latin capital letter u with macron":"Latin capital letter u with macron","Latin capital letter u with ogonek":"Latin capital letter u with ogonek","Latin capital letter u with ring above":"Latin capital letter u with ring above","Latin capital letter u with tilde":"Latin capital letter u with tilde","Latin capital letter w with circumflex":"Latin capital letter w with circumflex","Latin capital letter y with circumflex":"Latin capital letter y with circumflex","Latin capital letter y with diaeresis":"Latin capital letter y with diaeresis","Latin capital letter z with acute":"Latin capital letter z with acute","Latin capital letter z with caron":"Latin capital letter z with caron","Latin capital letter z with dot above":"Latin capital letter z with dot above","Latin capital ligature ij":"Latin capital ligature ij","Latin capital ligature oe":"Latin capital ligature oe","Latin small letter a with breve":"Latin small letter a with breve","Latin small letter a with macron":"Latin small letter a with macron","Latin small letter a with ogonek":"Latin small letter a with ogonek","Latin small letter c with acute":"Latin small letter c with acute","Latin small letter c with caron":"Latin small letter c with caron","Latin small letter c with circumflex":"Latin small letter c with circumflex","Latin small letter c with dot above":"Latin small letter c with dot above","Latin small letter d with caron":"Latin small letter d with caron","Latin small letter d with stroke":"Latin small letter d with stroke","Latin small letter dotless i":"Latin small letter dotless i","Latin small letter e with breve":"Latin small letter e with breve","Latin small letter e with caron":"Latin small letter e with caron","Latin small letter e with dot above":"Latin small letter e with dot above","Latin small letter e with macron":"Latin small letter e with macron","Latin small letter e with ogonek":"Latin small letter e with ogonek","Latin small letter eng":"Latin small letter eng","Latin small letter f with hook":"Latin small letter f with hook","Latin small letter g with breve":"Latin small letter g with breve","Latin small letter g with cedilla":"Latin small letter g with cedilla","Latin small letter g with circumflex":"Latin small letter g with circumflex","Latin small letter g with dot above":"Latin small letter g with dot above","Latin small letter h with circumflex":"Latin small letter h with circumflex","Latin small letter h with stroke":"Latin small letter h with stroke","Latin small letter i with breve":"Latin small letter i with breve","Latin small letter i with macron":"Latin small letter i with macron","Latin small letter i with ogonek":"Latin small letter i with ogonek","Latin small letter i with tilde":"Latin small letter i with tilde","Latin small letter j with circumflex":"Latin small letter j with circumflex","Latin small letter k with cedilla":"Latin small letter k with cedilla","Latin small letter kra":"Latin small letter kra","Latin small letter l with acute":"Latin small letter l with acute","Latin small letter l with caron":"Latin small letter l with caron","Latin small letter l with cedilla":"Latin small letter l with cedilla","Latin small letter l with middle dot":"Latin small letter l with middle dot","Latin small letter l with stroke":"Latin small letter l with stroke","Latin small letter long s":"Latin small letter long s","Latin small letter n preceded by apostrophe":"Latin small letter n preceded by apostrophe","Latin small letter n with acute":"Latin small letter n with acute","Latin small letter n with caron":"Latin small letter n with caron","Latin small letter n with cedilla":"Latin small letter n with cedilla","Latin small letter o with breve":"Latin small letter o with breve","Latin small letter o with double acute":"Latin small letter o with double acute","Latin small letter o with macron":"Latin small letter o with macron","Latin small letter r with acute":"Latin small letter r with acute","Latin small letter r with caron":"Latin small letter r with caron","Latin small letter r with cedilla":"Latin small letter r with cedilla","Latin small letter s with acute":"Latin small letter s with acute","Latin small letter s with caron":"Latin small letter s with caron","Latin small letter s with cedilla":"Latin small letter s with cedilla","Latin small letter s with circumflex":"Latin small letter s with circumflex","Latin small letter t with caron":"Latin small letter t with caron","Latin small letter t with cedilla":"Latin small letter t with cedilla","Latin small letter t with stroke":"Latin small letter t with stroke","Latin small letter u with breve":"Latin small letter u with breve","Latin small letter u with double acute":"Latin small letter u with double acute","Latin small letter u with macron":"Latin small letter u with macron","Latin small letter u with ogonek":"Latin small letter u with ogonek","Latin small letter u with ring above":"Latin small letter u with ring above","Latin small letter u with tilde":"Latin small letter u with tilde","Latin small letter w with circumflex":"Latin small letter w with circumflex","Latin small letter y with circumflex":"Latin small letter y with circumflex","Latin small letter z with acute":"Latin small letter z with acute","Latin small letter z with caron":"Latin small letter z with caron","Latin small letter z with dot above":"Latin small letter z with dot above","Latin small ligature ij":"Latin small ligature ij","Latin small ligature oe":"Latin small ligature oe","Left aligned image":"Left aligned image","Left double quotation mark":"Left double quotation mark","Left single quotation mark":"Left single quotation mark","Left-pointing double angle quotation mark":"Left-pointing double angle quotation mark","leftwards arrow to bar":"leftwards arrow to bar","leftwards dashed arrow":"leftwards dashed arrow","leftwards double arrow":"leftwards double arrow","Less-than or equal to":"Less-than or equal to","Less-than sign":"Less-than sign","Light blue":"Light blue","Light green":"Light green","Light grey":"Light grey",Link:"Link","Link image":"Link image","Link URL":"Link URL","Lira sign":"Lira sign","Livre tournois sign":"Livre tournois sign","Logical and":"Logical and","Logical or":"Logical or","Lower-latin":"Lower-latin","Lower–roman":"Lower–roman",Macron:"Macron","Manat sign":"Manat sign","Match case":"Match case","Media toolbar":"Media toolbar","Media URL":"Media URL","media widget":"media widget","Merge cell down":"Merge cell down","Merge cell left":"Merge cell left","Merge cell right":"Merge cell right","Merge cell up":"Merge cell up","Merge cells":"Merge cells","Mill sign":"Mill sign","Minus sign":"Minus sign","Multiplication sign":"Multiplication sign","N-ary product":"N-ary product","N-ary summation":"N-ary summation",Nabla:"Nabla","Naira sign":"Naira sign","New sheqel sign":"New sheqel sign",Next:"Next","Next result":"Next result","No preview available":"No preview available",None:"None","Nordic mark sign":"Nordic mark sign","Not an element of":"Not an element of","Not equal to":"Not equal to","Not sign":"Not sign","Numbered List":"Numbered List","Numbered list styles toolbar":"Numbered list styles toolbar","on with exclamation mark with left right arrow above":"on with exclamation mark with left right arrow above","Open in a new tab":"Open in a new tab","Open link in new tab":"Open link in new tab",Orange:"Orange",Original:"Original",Outset:"Outset",Overline:"Overline",Padding:"Padding","Page break":"Page break",Paragraph:"Paragraph","Paragraph sign":"Paragraph sign","Partial differential":"Partial differential","Paste raw HTML here...":"Paste raw HTML here...","Paste the media URL in the input.":"Paste the media URL in the input.","Per mille sign":"Per mille sign","Per ten thousand sign":"Per ten thousand sign","Peseta sign":"Peseta sign","Peso sign":"Peso sign","Pink marker":"Pink marker","Plain text":"Plain text","Plus-minus sign":"Plus-minus sign","Pound sign":"Pound sign",Previous:"Previous","Previous result":"Previous result","Proportional to":"Proportional to",Purple:"Purple","Question exclamation mark":"Question exclamation mark",Red:"Red","Red pen":"Red pen",Redo:"Redo","Registered sign":"Registered sign","Remove color":"Remove color","Remove Format":"Remove Format","Remove highlight":"Remove highlight","Remove language":"Remove language",Replace:"Replace","Replace all":"Replace all","Replace with…":"Replace with…","Resize image":"Resize image","Resize image to %0":"Resize image to %0","Resize image to the original size":"Resize image to the original size","Restore default":"Restore default","Reversed paragraph sign":"Reversed paragraph sign","Rich Text Editor":"Rich Text Editor","Rich Text Editor, %0":"Rich Text Editor, %0",Ridge:"Ridge","Right aligned image":"Right aligned image","Right double quotation mark":"Right double quotation mark","Right single quotation mark":"Right single quotation mark","Right-pointing double angle quotation mark":"Right-pointing double angle quotation mark","rightwards arrow to bar":"rightwards arrow to bar","rightwards dashed arrow":"rightwards dashed arrow","rightwards double arrow":"rightwards double arrow",Row:"Row","Ruble sign":"Ruble sign","Rupee sign":"Rupee sign",Save:"Save","Save changes":"Save changes","Section sign":"Section sign","Select all":"Select all","Select column":"Select column","Select row":"Select row","Show more items":"Show more items","Show options":"Show options","Side image":"Side image","Single left-pointing angle quotation mark":"Single left-pointing angle quotation mark","Single low-9 quotation mark":"Single low-9 quotation mark","Single right-pointing angle quotation mark":"Single right-pointing angle quotation mark",Small:"Small",Solid:"Solid","soon with rightwards arrow above":"soon with rightwards arrow above",Source:"Source","Special characters":"Special characters","Spesmilo sign":"Spesmilo sign","Split cell horizontally":"Split cell horizontally","Split cell vertically":"Split cell vertically",Square:"Square","Square root":"Square root",Strikethrough:"Strikethrough",Style:"Style",Subscript:"Subscript",Superscript:"Superscript","Table alignment toolbar":"Table alignment toolbar","Table cell text alignment":"Table cell text alignment","Table properties":"Table properties","Table toolbar":"Table toolbar","Tenge sign":"Tenge sign","Text alignment":"Text alignment","Text alignment toolbar":"Text alignment toolbar","Text alternative":"Text alternative","Text highlight toolbar":"Text highlight toolbar","Text to find must not be empty.":"Text to find must not be empty.",'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".':'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".',"The URL must not be empty.":"The URL must not be empty.",'The value is invalid. Try "10px" or "2em" or simply "2".':'The value is invalid. Try "10px" or "2em" or simply "2".',"There exists":"There exists","This link has no URL":"This link has no URL","This media URL is not supported.":"This media URL is not supported.","Tilde operator":"Tilde operator",Tiny:"Tiny","Tip: Find some text first in order to replace it.":"Tip: Find some text first in order to replace it.","Tip: Paste the URL into the content to embed faster.":"Tip: Paste the URL into the content to embed faster.","To-do List":"To-do List","Toggle caption off":"Toggle caption off","Toggle caption on":"Toggle caption on","Toggle the circle list style":"Toggle the circle list style","Toggle the decimal list style":"Toggle the decimal list style","Toggle the decimal with leading zero list style":"Toggle the decimal with leading zero list style","Toggle the disc list style":"Toggle the disc list style","Toggle the lower–latin list style":"Toggle the lower–latin list style","Toggle the lower–roman list style":"Toggle the lower–roman list style","Toggle the square list style":"Toggle the square list style","Toggle the upper–latin list style":"Toggle the upper–latin list style","Toggle the upper–roman list style":"Toggle the upper–roman list style","top with upwards arrow above":"top with upwards arrow above","Trade mark sign":"Trade mark sign","Tugrik sign":"Tugrik sign","Turkish lira sign":"Turkish lira sign",Turquoise:"Turquoise","Two dot leader":"Two dot leader",Underline:"Underline",Undo:"Undo",Union:"Union",Unlink:"Unlink","up down arrow with base":"up down arrow with base",Update:"Update","Update image URL":"Update image URL","Upload failed":"Upload failed","Upload in progress":"Upload in progress","Upper-latin":"Upper-latin","Upper-roman":"Upper-roman","upwards arrow to bar":"upwards arrow to bar","upwards dashed arrow":"upwards dashed arrow","upwards double arrow":"upwards double arrow","Vertical text alignment toolbar":"Vertical text alignment toolbar","Vulgar fraction one half":"Vulgar fraction one half","Vulgar fraction one quarter":"Vulgar fraction one quarter","Vulgar fraction three quarters":"Vulgar fraction three quarters",White:"White","Whole words only":"Whole words only","Widget toolbar":"Widget toolbar",Width:"Width","Won sign":"Won sign","Words: %0":"Words: %0","Wrap text":"Wrap text",Yellow:"Yellow","Yellow marker":"Yellow marker","Yen sign":"Yen sign"})})(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),function(e){function t(t){for(var a,o,l=t[0],r=t[1],c=t[2],u=0,m=[];u{U()||t("unauthenticated"),x.client.userInfo(T(),(i,a)=>{i?t("userinfo"):(a.picture=`https://www.gravatar.com/avatar/${m()(a.email.toLocaleLowerCase()).toString()}`,h.dispatch("setUser",a),e(a))})})}function D(){localStorage.removeItem(g)}function E(){localStorage.removeItem(f)}function N(e){let t=RegExp("[#&]"+e+"=([^&]*)").exec(window.location.hash);return t&&decodeURIComponent(t[1].replace(/\+/g," "))}function I(){let e=N("access_token");localStorage.setItem(f,e)}function P(){let e=N("id_token");localStorage.setItem(g,e)}function U(){const e=S();return!!e&&!R(e)}function A(e){const t=c()(e);if(!t.exp)return null;const i=new Date(0);return i.setUTCSeconds(t.exp),i}function R(e){const t=A(e);return t{this.user=e}).catch(e=>{"userinfo"===e&&k()})},data(){return{user:null}},computed:{isLoggedIn(){return U()}},methods:{logout(){k()}}},O=F,V=(i("5c0b"),i("5bdc"),i("2877")),z=Object(V["a"])(O,o,l,!1,null,"bbbb8102",null),Y=z.exports,H=i("8c4f"),q=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"templates"},[i("sui-grid",[i("sui-grid-column",{attrs:{width:5}},[i("sui-segment",{staticClass:"templates",attrs:{loading:e.templatesLoading}},[e.templates?i("div",[i("sui-input",{attrs:{placeholder:"Search...",icon:"search"},model:{value:e.searchKeyword,callback:function(t){e.searchKeyword=t},expression:"searchKeyword"}}),""!=e.searchKeyword?i("sui-button",{attrs:{id:"filter",icon:"close"},on:{click:function(t){e.searchKeyword=""}}},[e._v("Clear filter")]):e._e(),i("sui-list",{staticClass:"templates-scroll",attrs:{divided:"",relaxed:""}},e._l(e.sortedTemplates,(function(t){return i("sui-list-item",{key:t.name,on:{click:function(i){return e.$router.push("/templates/display/"+t.name)}}},[i("sui-image",{attrs:{size:"mini",src:t.thumbnail}}),i("sui-list-content",[i("sui-list-header",{tag:"a"},[e._v(e._s(t.friendly_name))]),t.maxVersion?i("sui-list-description",{tag:"a"},[e._v("v."+e._s(t.maxVersion.version)+" - "+e._s(e._f("moment")(t.maxVersion.date,"DD/MM/YYYY HH:mm")))]):i("sui-list-description",{tag:"a"},[e._v("No version yet")]),i("sui-list-description",{tag:"a"},[i("small",[e._v(e._s(t.name))])])],1)],1)})),1),i("router-link",{attrs:{to:"/templates/new"}},[i("sui-button",{attrs:{primary:"",content:"New template",icon:"add"}})],1)],1):e._e()])],1),i("sui-grid-column",{attrs:{width:11}},[e.templateName?i("router-view"):i("sui-segment",[i("h3",[e._v("Select a template")]),i("p",[e._v("You have to select a template first in order to see its detail.")])])],1)],1)],1)},j=[],B=i("bc3a"),G=i.n(B);const W="https://next-services.emg-digital.com";function K(){return{headers:{Authorization:`Bearer ${T()}`}}}async function J(){if(U()){let{data:e}=await G.a.get(`${W}/templates/channel/Alpha`,K());return e}throw new Error("User not authenticated.")}async function X(e){if(U()){let{data:t}=await G.a.get(`${W}/templates/${e}/channel/Alpha`,K());return t}throw new Error("User not authenticated.")}async function Q({name:e,friendly_name:t,thumbnail:i,engine_name:a}){if(U()){let{data:n}=await G.a.post(`${W}/templates`,{name:e,friendly_name:t,thumbnail:i,engine_name:a},K());return n}throw new Error("User not authenticated.")}async function Z(e){if(U()){let{data:t}=await G.a.delete(`${W}/templates/${e}`,K());return t}throw new Error("User not authenticated.")}async function ee(e,t){await G.a.put(e,t)}var te={getTemplates:J,getTemplate:X,postTemplate:Q,deleteTemplate:Z,putFile:ee},ie={name:"templates",data(){return{templatesLoading:!0,templates:null,searchKeyword:""}},computed:{templateName(){return"templates"!==this.$route.name},filteredTemplates(){return this.templates.filter(e=>e.name.toLowerCase().includes(this.searchKeyword)||e.friendly_name.toLowerCase().includes(this.searchKeyword))},sortedTemplates(){let e=this.filteredTemplates;return e.sort((e,t)=>{return e.friendly_namet.friendly_name?1:0})}},mounted(){this.getTemplates()},methods:{getTemplates(){this.templatesLoading=!0,te.getTemplates().then(e=>{this.templates=e;for(let t of this.templates){let e=0;for(let i of t.versions)Number(i.version)>e&&(e=Number(i.version));for(let i of t.versions)Number(i.version)===e&&(t.maxVersion=i)}this.templatesLoading=!1})}},watch:{$route(e,t){("templates"===e.name||!e.name&&"NewTemplate"===t.name)&&this.getTemplates()}}},ae=ie,ne=(i("ed6a"),Object(V["a"])(ae,q,j,!1,null,"7d1fb82a",null)),se=ne.exports,oe=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("sui-segment",{attrs:{loading:e.templateLoading}},[e.template?i("div",[i("sui-grid",[i("sui-grid-column",{staticStyle:{"line-height":"55px","text-align":"center"},attrs:{width:2}},[i("img",{staticStyle:{display:"inline-block","vertical-align":"middle","max-width":"100%","max-height":"45px"},attrs:{src:e.template.thumbnail,alt:"",height:"45"}})]),i("sui-grid-column",{attrs:{width:8}},[i("h2",{staticStyle:{"margin-bottom":"0.5rem"}},[e._v(e._s(e.template.friendly_name))]),i("p",[e._v(e._s(e.template.name)+" "),e.template.engine_name?i("i",{staticStyle:{"padding-left":"5px","font-size":"12px"}},[e._v(e._s(e.template.engine_name))]):e._e()])]),i("sui-grid-column",{staticStyle:{"text-align":"right","line-height":"55px"},attrs:{width:6}},[i("router-link",{attrs:{to:"/templates/display/"+e.$route.params.template+"/release-note"}},[i("sui-button",{attrs:{primary:"",content:"Edit release note",icon:"file"}})],1),i("sui-button",{attrs:{negative:"",content:"Delete template",icon:"remove"},on:{click:e.toggleDeleteModal}})],1)],1),i("br"),e.template.versions.length>0?i("sui-table",{attrs:{"single-line":""}},[i("sui-table-header",[i("sui-table-row",[i("sui-table-header-cell",[e._v("Version")]),i("sui-table-header-cell",[e._v("Date")]),i("sui-table-header-cell",{staticStyle:{"text-align":"right"}},[e._v("Channel")]),i("sui-table-header-cell",{staticStyle:{"text-align":"right"}},[e._v("Action")])],1)],1),i("sui-table-body",e._l(e.template.versions,(function(t){return i("sui-table-row",{key:t.version},[i("sui-table-cell",[e._v("v."+e._s(t.version))]),i("sui-table-cell",[e._v(e._s(e._f("moment")(t.date,"DD/MM/YYYY HH:mm")))]),i("sui-table-cell",{staticStyle:{"text-align":"right"}},[i("sui-label",{tag:"div",attrs:{color:e.getChannelColor(t.status)}},[e._v(e._s(t.status))])],1),i("sui-table-cell",{staticStyle:{"text-align":"right"}},[i("router-link",{attrs:{to:"/templates/display/"+e.template.name+"/"+t.id}},[i("sui-button",{attrs:{content:"Details/Edit",size:"tiny"}})],1)],1)],1)})),1)],1):i("sui-message",{attrs:{icon:"folder outline icon",header:"No versions yet",content:"Create the first version of the template."}}),i("sui-button",{attrs:{primary:"",content:"New version",icon:"add"},on:{click:e.newVersion}})],1):e._e(),e.template?i("sui-modal",{model:{value:e.deleteModal,callback:function(t){e.deleteModal=t},expression:"deleteModal"}},[i("sui-modal-header",[e._v("Confirm deletion")]),i("sui-modal-content",{attrs:{image:""}},[i("sui-modal-description",[i("p",[e._v("You're about to delete the \""+e._s(e.template.name)+'" template. This is irreversible and will delete the versions associated.')])])],1),i("sui-modal-actions",[i("sui-button",{on:{click:e.toggleDeleteModal}},[e._v("Cancel")]),i("sui-button",{attrs:{negative:"",icon:"trash"},on:{click:e.deleteTemplate}},[e._v("Delete")])],1)],1):e._e()],1)},le=[];const re="https://next-services.emg-digital.com";function ce(){return{headers:{Authorization:`Bearer ${T()}`}}}async function de(e,t){if(U()){let{data:i}=await G.a.get(`${re}/templates/${e}/versions/${t}`,ce());return i}throw new Error("User not authenticated.")}async function ue(e){if(U()){let{data:t}=await G.a.post(`${re}/templates/${e}/versions`,{},ce());return t}throw new Error("User not authenticated.")}async function me(e,t){if(U()){let{data:i}=await G.a.delete(`${re}/templates/${e}/versions/${t}`,ce());return i}throw new Error("User not authenticated.")}async function pe(e,t,i){if(U()){let{data:a}=await G.a.put(`${re}/templates/${e}/versions/${t}`,{file:i},ce());return a}throw new Error("User not authenticated.")}async function he(e,t,i){if(U()){let{data:a}=await G.a.put(`${re}/templates/${e}/versions/${t}/status`,{status:i},ce());return a}throw new Error("User not authenticated.")}async function ge(e,t){await G.a.put(e,t)}var fe={getVersion:de,getUploadSignature:pe,putFile:ge,deleteVersion:me,postVersion:ue,setStatus:he},ve={name:"Template",data(){return{template:null,templateLoading:!0,deleteModal:!1}},mounted(){this.getTemplate()},watch:{$route(){this.getTemplate()}},methods:{getTemplate(){this.templateLoading=!0,this.template=null,te.getTemplate(this.$route.params.template).then(e=>{this.template=e,this.templateLoading=!1})},toggleDeleteModal(){this.deleteModal=!this.deleteModal},deleteTemplate(){this.templateLoading=!0,te.deleteTemplate(this.template.name).then(()=>{this.templateLoading=!1,this.deleteModal=!1,this.$router.push("/templates")})},newVersion(){this.templateLoading=!0,fe.postVersion(this.$route.params.template).then(()=>{this.getTemplate()})},getChannelColor(e){switch(e){case"Latest":return"blue";case"Beta":return"yellow";default:return"red"}}}},we=ve,be=(i("bcca"),Object(V["a"])(we,oe,le,!1,null,"386b8873",null)),_e=be.exports,ye=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("sui-segment",{attrs:{loading:e.loading}},[i("h3",[e._v("New Template")]),i("p",[e._v("Fill in the details to create the template.")]),i("sui-divider"),e.errorMessage?i("sui-message",{attrs:{color:"red",icon:"times",header:"Error",content:e.errorMessage}}):e._e(),i("sui-form",{on:{submit:e.submit}},[i("sui-form-field",[i("label",[e._v("Name")]),i("input",{directives:[{name:"model",rawName:"v-model",value:e.form.name,expression:"form.name"}],attrs:{name:"name",required:""},domProps:{value:e.form.name},on:{input:function(t){t.target.composing||e.$set(e.form,"name",t.target.value)}}})]),i("sui-form-field",[i("label",[e._v("Friendly name")]),i("input",{directives:[{name:"model",rawName:"v-model",value:e.form.friendly_name,expression:"form.friendly_name"}],attrs:{name:"friendly_name",required:""},domProps:{value:e.form.friendly_name},on:{input:function(t){t.target.composing||e.$set(e.form,"friendly_name",t.target.value)}}})]),i("sui-form-field",[i("label",[e._v("Logo")]),i("input",{attrs:{type:"file",required:"",accept:".png"},on:{change:e.fileEvent}})]),i("sui-form-field",[i("label",[e._v("Engine")]),i("select",{directives:[{name:"model",rawName:"v-model",value:e.form.engine_name,expression:"form.engine_name"}],attrs:{name:"type",required:""},on:{change:function(t){var i=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){var t="_value"in e?e._value:e.value;return t}));e.$set(e.form,"engine_name",t.target.multiple?i:i[0])}}},e._l(e.engines,(function(t){return i("option",{key:t.name,domProps:{value:t.name}},[e._v(e._s(t.friendly_name))])})),0)]),i("br"),i("sui-button",{attrs:{primary:"",icon:"check",type:"submit"}},[e._v("Create")])],1)],1)],1)},Le=[];const xe="https://next-services.emg-digital.com";function Me(){return{headers:{Authorization:`Bearer ${T()}`}}}async function ke(){if(U()){let{data:e}=await G.a.get(`${xe}/engines`,Me());return e}throw new Error("User not authenticated.")}async function $e(e){if(U()){let{data:t}=await G.a.get(`${xe}/engines/${e}`,Me());return t}throw new Error("User not authenticated.")}async function Se({name:e,friendly_name:t,thumbnail:i,type:a}){if(U()){let{data:n}=await G.a.post(`${xe}/engines`,{name:e,friendly_name:t,thumbnail:i,type:a},Me());return n}throw new Error("User not authenticated.")}async function Te(e){if(U()){let{data:t}=await G.a.delete(`${xe}/engines/${e}`,Me());return t}throw new Error("User not authenticated.")}async function Ce(e,t){await G.a.put(e,t)}var De={getEngines:ke,getEngine:$e,postEngine:Se,deleteEngine:Te,putFile:Ce},Ee={name:"NewTemplate",data(){return{form:{name:"",friendly_name:"",thumbnail:"",engine_name:""},file:null,loading:!1,errorMessage:null,engines:[]}},mounted(){De.getEngines().then(e=>{this.engines=e})},methods:{fileEvent(e){this.file=e.target.files[0],this.form.thumbnail=this.file.name},submit(e){e.preventDefault(),this.loading=!0,te.postTemplate({name:this.form.name,friendly_name:this.form.friendly_name,thumbnail:this.form.thumbnail,engine_name:this.form.engine_name}).then(e=>{te.putFile(e.thumbnail_upload_url,this.file).then(()=>{this.$router.push(`/templates/display/${this.form.name}`)})}).catch(e=>{"Request failed with status code 409"===e.message&&(this.errorMessage="A template with this name already exists.",this.loading=!1)})}}},Ne=Ee,Ie=Object(V["a"])(Ne,ye,Le,!1,null,"e2f541de",null),Pe=Ie.exports,Ue=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("sui-segment",{attrs:{loading:e.loadingVersion&&e.loadingDocumentations}},[e.version?i("div",[i("sui-grid",[i("sui-grid-column",{attrs:{width:16}},[i("h2",{staticStyle:{"margin-bottom":"0.5rem"}},[e._v("\n v."+e._s(e.version.version)+" -\n "+e._s(e._f("moment")(e.version.date,"DD/MM/YYYY HH:mm"))+"\n ")]),i("p",[e._v(e._s(e.version.template.friendly_name))]),i("sui-label",{tag:"div",attrs:{color:e.getChannelColor(e.version.status)}},[i("div",{staticClass:"current"},[e._v(e._s(e.version.status))])])],1)],1),i("a",{staticClass:"back",on:{click:function(t){return e.$router.go(-1)}}},[i("i",{staticClass:"caret left icon"}),i("span",[e._v("Back")])]),i("br"),i("h4",[e._v("Files")]),i("sui-divider"),i("tree-list",{staticClass:"list",attrs:{files:e.version.files}}),i("sui-divider"),i("sui-button",{attrs:{primary:"",icon:"upload"},on:{click:function(t){e.uploadModal=!0}}},[e._v("Upload version")]),i("select",{directives:[{name:"model",rawName:"v-model",value:e.version.status,expression:"version.status"}],staticClass:"ui dropdown",attrs:{disabled:e.loadingStatus},on:{change:[function(t){var i=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){var t="_value"in e?e._value:e.value;return t}));e.$set(e.version,"status",t.target.multiple?i:i[0])},e.statusChange]}},[i("option",{attrs:{value:"Alpha"}},[e._v("Alpha")]),i("option",{attrs:{value:"Beta"}},[e._v("Beta")]),i("option",{attrs:{value:"Latest"}},[e._v("Latest")])]),i("sui-button",{attrs:{color:"red",icon:"trash"},on:{click:e.toggleDeleteModal}},[e._v("Delete version")])],1):e._e(),e.documentations?i("div",[i("sui-divider"),i("br"),i("h4",[e._v("Documentations")]),i("sui-divider"),null!=e.documentations?i("sui-table",{attrs:{"single-line":""}},[i("sui-table-body",e._l(e.documentations,(function(t,a){return i("sui-table-row",{key:t},[i("sui-table-cell",[e._v(e._s(a))]),i("sui-table-cell",[e._v("v."+e._s(t))]),i("sui-table-cell",{staticStyle:{"text-align":"right"}},[i("router-link",{attrs:{to:"/templates/display/"+e.$route.params.template+"/"+e.$route.params.version+"/documentation/"+a}},[i("sui-button",{attrs:{content:"Edit",size:"tiny"}})],1)],1)],1)})),1)],1):e._e()],1):e._e()]),e.version?i("sui-modal",{model:{value:e.deleteModal,callback:function(t){e.deleteModal=t},expression:"deleteModal"}},[i("sui-modal-header",[e._v("Confirm deletion")]),i("sui-modal-content",{attrs:{image:""}},[i("sui-modal-description",[i("p",[e._v("\n You're about to delete the \"v."+e._s(e.version.version)+" -\n "+e._s(e._f("moment")(e.version.date,"DD/MM/YYYY HH:mm"))+'" version. This is\n irreversible.\n ')])])],1),i("sui-modal-actions",[i("sui-button",{on:{click:e.toggleDeleteModal}},[e._v("Cancel")]),i("sui-button",{attrs:{negative:"",icon:"trash"},on:{click:e.deleteVersion}},[e._v("Delete")])],1)],1):e._e(),e.version?i("upload-template",{attrs:{open:e.uploadModal,template:e.version.template.name,version:e.$route.params.version},on:{hide:e.hideUploadModal}}):e._e()],1)},Ae=[];const Re="https://next-services.emg-digital.com";function Fe(){return{headers:{Authorization:`Bearer ${T()}`}}}async function Oe(e,t){if(U()){let{data:i}=await G.a.get(`${Re}/templates/${e}/versions/${t}/documentations/`,Fe());return i}throw new Error("User not authenticated.")}async function Ve(e,t,i){if(U()){let{data:a}=await G.a.get(`${Re}/templates/${e}/versions/${t}/documentations/${i}`,Fe());return a}throw new Error("User not authenticated.")}async function ze(e,t,i,a){if(U()){let{data:n}=await G.a.put(`${Re}/templates/${e}/versions/${t}/documentations/${i}`,{content:a},Fe());return n}throw new Error("User not authenticated.")}var Ye={getDocumentations:Oe,getDocumentation:Ve,setDocumentation:ze},He=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("sui-list",e._l(e.files,(function(t,a){return i("sui-list-item",{key:a},["object"===typeof t?[i("sui-list-icon",{attrs:{name:"folder"}}),i("sui-list-content",[i("sui-list-header",[e._v(e._s(a))]),i("tree-list",{attrs:{files:t}})],1)]:[i("sui-list-icon",{attrs:{name:"file"}}),i("sui-list-content",[i("sui-list-header",[e._v(e._s(a))])],1)]],2)})),1)],1)},qe=[],je={name:"TreeList",props:["files"]},Be=je,Ge=Object(V["a"])(Be,He,qe,!1,null,null,null),We=Ge.exports,Ke=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("sui-modal",{attrs:{closable:!1,animationDuration:200},model:{value:e.open,callback:function(t){e.open=t},expression:"open"}},[i("sui-modal-header",[e._v("Upload Template")]),i("sui-modal-content",[i("input",{ref:"file",attrs:{type:"file",multiple:"",webkitdirectory:""},on:{change:e.filesChanged}}),e.selectedFiles?i("div",[i("h4",[e._v("Files to upload")]),i("sui-list",e._l(e.filesToUpload,(function(t){return i("sui-list-item",{key:t.webkitRelativePath},[i("sui-list-icon",{attrs:{name:"file"}}),i("sui-list-content",[i("sui-list-header",[e._v(e._s(""!==t.webkitRelativePath?t.webkitRelativePath:t.name))])],1)],1)})),1),e.uploading?e._e():[i("sui-button",{attrs:{positive:"",icon:"upload"},on:{click:e.startUpload}},[e._v("Upload")]),i("sui-button",{attrs:{primary:"",icon:"upload"},on:{click:function(t){return e.clickUpload("folder")}}},[e._v("Select a folder to upload")]),i("sui-button",{attrs:{primary:"",icon:"upload"},on:{click:function(t){return e.clickUpload("single")}}},[e._v("Select a file to upload")])]],2):i("div",{staticStyle:{"text-align":"center"}},[e._v("\n No directory selected yet!\n "),i("br"),i("br"),i("sui-button",{attrs:{primary:"",icon:"upload"},on:{click:function(t){return e.clickUpload("folder")}}},[e._v("Select a folder to upload")]),i("sui-button",{attrs:{primary:"",icon:"upload"},on:{click:function(t){return e.clickUpload("single")}}},[e._v("Select a file to upload")])],1)]),i("sui-modal-actions",[e.uploading?i("sui-progress",{attrs:{state:"active",color:"green",percent:e.uploadingPercent,label:e.uploadingLabel}}):i("sui-button",{on:{click:e.cancel}},[e._v("Cancel")])],1)],1)},Je=[],Xe={data(){return{selectedFiles:null,filesToUpload:null,uploading:!1,uploadingPercent:0,uploadingLabel:""}},props:["open","template","version"],methods:{filesChanged(e){this.selectedFiles=null,this.filesToUpload=[],this.selectedFiles=e.target.files;for(let t of this.selectedFiles){const e=t.webkitRelativePath.split("/");".DS_Store"!==t.name&&".git"!==e[1]&&this.filesToUpload.push(t)}},clickUpload(e){"single"===e&&(this.$refs.file.multiple=!1,this.$refs.file.webkitdirectory=!1),"folder"===e&&(this.$refs.file.multiple=!0,this.$refs.file.webkitdirectory=!0),this.$refs.file.click()},startUpload(){this.uploading=!0,this.uploadingPercent=0,this.upload().then(()=>{this.selectedFiles=null,this.filesToUpload=null,this.uploadingLabel="",this.uploading=!1,this.uploadingPercent=0,this.$emit("hide")})},async upload(){let e=0;await fe.deleteVersion(this.template,this.version);for(let t of this.filesToUpload){e++;let i=t.webkitRelativePath.split("/");i.shift();let a=i.join("/");""===a&&(a=t.name),this.uploadingLabel=`Uploading "${a}"...`;let n=await fe.getUploadSignature(this.template,this.version,a);await fe.putFile(n.upload_url,t),this.uploadingPercent=e/this.filesToUpload.length*100}},cancel(){this.selectedFiles=null,this.filesToUpload=null,this.$emit("hide")}}},Qe=Xe,Ze=(i("36bc"),Object(V["a"])(Qe,Ke,Je,!1,null,"5ab2ef58",null)),et=Ze.exports,tt={name:"version",components:{TreeList:We,UploadTemplate:et},data(){return{version:null,loadingVersion:!0,uploadModal:!1,deleteModal:!1,documentations:null,loadingDocumentations:!0,loadingStatus:!1}},methods:{getVersion(){this.loadingVersion=!0,fe.getVersion(this.$route.params.template,this.$route.params.version).then(e=>{this.version=e,this.loadingVersion=!1})},hideUploadModal(){this.uploadModal=!1,this.getVersion()},toggleDeleteModal(){this.deleteModal=!this.deleteModal},deleteVersion(){fe.deleteVersion(this.version.template.name,this.$route.params.version).then(()=>{this.$router.go(-1)})},getDocumentations(){this.loadingDocumentations=!0,Ye.getDocumentations(this.$route.params.template,this.$route.params.version).then(e=>{this.documentations=e,this.loadingDocumentations=!1})},getChannelColor(e){switch(e){case"Latest":return"blue";case"Beta":return"yellow";default:return"red"}},statusChange(){this.loadingStatus=!0,fe.setStatus(this.version.template.name,`${this.version.date}_${this.version.version}`,this.version.status).then(()=>{console.log("ok"),this.loadingStatus=!1})}},mounted(){this.getVersion(),this.getDocumentations()}},it=tt,at=(i("5e1e"),Object(V["a"])(it,Ue,Ae,!1,null,"52174ae7",null)),nt=at.exports,st=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("sui-segment",{attrs:{loading:e.loadingDocumentation}},[e.documentation?i("div",[i("sui-grid",[i("sui-grid-column",{attrs:{width:16}},[i("h2",{staticStyle:{"margin-bottom":"0.5rem"}},[e._v("v."+e._s(e.$route.params.version.split("_")[1])+" - "+e._s(e._f("moment")(e.$route.params.version.split("_")[0],"DD/MM/YYYY HH:mm")))]),i("p",[e._v(e._s(e.$route.params.template))]),i("sui-divider"),i("h2",{staticStyle:{"margin-bottom":"0.5rem"}},[e._v(e._s(e.$route.params.documentation))]),i("p",[e._v("v."+e._s(e.documentation.version))])],1)],1),i("a",{staticClass:"back",on:{click:function(t){return e.$router.go(-1)}}},[i("i",{staticClass:"caret left icon"}),i("span",[e._v("Back")])]),i("br"),i("transition",{attrs:{name:"fade"}},[e.messageProperty.visible?i("sui-message",{class:e.messageProperty.color,attrs:{header:e.messageProperty.header,content:e.messageProperty.content},on:{click:function(){return e.setMessageProperty(!1,"red","","")}}}):e._e()],1),i("sui-button",{staticClass:"save-file",attrs:{primary:"",icon:"save"},on:{click:function(t){return e.saveFile()}}},[e._v("Save file")]),i("ckeditor",{attrs:{editor:e.editor},model:{value:e.documentation.content,callback:function(t){e.$set(e.documentation,"content",t)},expression:"documentation.content"}})],1):e._e()])],1)},ot=[],lt=i("0469"),rt=i("c4b1"),ct=i("8a91"),dt=i("a20b"),ut=i("3d63"),mt=i("85a9"),pt=i("2d79"),ht=i("e25f"),gt=i("da83"),ft=i("271b"),vt=i("0349"),wt=i("ac6b"),bt=i("8499"),_t=i("290f"),yt=i("f518"),Lt=i("e195"),xt=i("8352"),Mt=i("191f"),kt=i("2566"),$t=i("2430"),St=i("8b25"),Tt=i("7695"),Ct=i("7e0c"),Dt=i("a59e"),Et=i("0062"),Nt=i("39a0"),It=i("233a"),Pt=i("34ab"),Ut=i("64f1"),At=i("0bf6"),Rt=i("56b3"),Ft=i("7212"),Ot=i("6fa7"),Vt=i("2914"),zt=i("d4c1"),Yt=i("8068"),Ht=i("63ee"),qt=i("4801"),jt=i("1b4b"),Bt=i("0e17"),Gt=i("25ca"),Wt=i("2b3b"),Kt=i("fea3"),Jt=i("f61b"),Xt=i("2b10"),Qt=i("5e96"),Zt=i("e1ed"),ei=i("73d1"),ti=i("7f09"),ii=i("0520"),ai=i("21e3"),ni=i("5ab6"),si=i("0798"),oi=i("5230"),li=i("d5ef"),ri=i("613a"),ci=i("031f"),di=i("a599"),ui=i("643c"),mi=i("1cdd"),pi=i("2bea"),hi=i("9813"),gi=i("f4e9"),fi=i("3ca2"),vi=i("9799"),wi=i("8568"),bi=i("7041"),_i=i("0115"); /** * @license Copyright (c) 2014-2021, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ class yi extends lt["a"]{}yi.builtinPlugins=[rt["a"],ct["a"],dt["a"],ut["a"],mt["a"],pt["a"],ht["a"],gt["a"],ft["a"],vt["a"],wt["a"],bt["a"],_t["a"],yt["a"],Lt["a"],xt["a"],Mt["a"],kt["a"],$t["a"],St["a"],Tt["a"],Ct["a"],Dt["a"],Et["a"],Nt["a"],It["a"],Pt["a"],Ut["a"],At["a"],Rt["a"],Ft["a"],Ot["a"],Vt["a"],zt["a"],Yt["a"],Ht["a"],qt["a"],jt["a"],Bt["a"],Gt["a"],Wt["a"],Kt["a"],Jt["a"],Xt["a"],Qt["a"],Zt["a"],ei["a"],ti["a"],ii["a"],ai["a"],ni["a"],si["a"],oi["a"],li["a"],ri["a"],ci["a"],di["a"],ui["a"],mi["a"],pi["a"],hi["a"],gi["a"],fi["a"],vi["a"],wi["a"],bi["a"],_i["a"]],yi.defaultConfig={toolbar:{items:["undo","redo","|","heading","fontFamily","fontSize","alignment","|","fontColor","fontBackgroundColor","bold","italic","underline","strikethrough","highlight","|","bulletedList","numberedList","todoList","|","outdent","indent","|","insertTable","link","imageUpload","imageInsert","mediaEmbed","blockQuote","specialCharacters","superscript","subscript","-","|","textPartLanguage","findAndReplace","pageBreak","code","codeBlock","htmlEmbed","sourceEditing"]},language:"en",image:{toolbar:["imageTextAlternative","imageStyle:inline","imageStyle:block","imageStyle:side","linkImage"]},table:{contentToolbar:["tableColumn","tableRow","mergeTableCells","tableCellProperties","tableProperties"]}};var Li=yi,xi={name:"documentation",components:{},data(){return{documentation:null,loadingDocumentation:!0,editor:Li,messageProperty:{visible:!1,color:"message-bg-red",header:"",content:""}}},methods:{getDocumentation(){this.loadingDocumentation=!0,Ye.getDocumentation(this.$route.params.template,this.$route.params.version,this.$route.params.documentation).then(e=>{this.documentation=e,this.loadingDocumentation=!1})},saveFile(){this.setMessageProperty(!0,"orange","Save file","Saving documentation in progress...");try{Ye.setDocumentation(this.$route.params.template,this.$route.params.version,this.$route.params.documentation,this.documentation.content).then(()=>{this.getDocumentation(),this.setMessageProperty(!0,"green","Save file","Save completed with success."),this.closeMessage()}).catch(e=>{this.setMessageProperty(!0,"red","Save file","An error occured during save: "+e),this.closeMessage()})}catch(e){this.setMessageProperty(!0,"red","Save file","An error occured during save: "+e),this.closeMessage()}},setMessageProperty(e,t,i,a){this.messageProperty.visible=e,this.messageProperty.color=`message-bg-${t}`,this.messageProperty.header=i,this.messageProperty.content=a},closeMessage(){setTimeout(()=>{this.setMessageProperty(!1,"red","","")},5e3)}},mounted(){this.getDocumentation()}},Mi=xi,ki=(i("3f68"),Object(V["a"])(Mi,st,ot,!1,null,"52a37c32",null)),$i=ki.exports,Si=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("sui-segment",{attrs:{loading:e.loadingReleaseNote}},[e.releaseNote?i("div",[i("sui-grid",[i("sui-grid-column",{attrs:{width:16}},[i("h2",{staticStyle:{"margin-bottom":"0.5rem"}},[e._v("Release note")]),i("p",[e._v(e._s(e.$route.params.template))])])],1),i("a",{staticClass:"back",on:{click:function(t){return e.$router.go(-1)}}},[i("i",{staticClass:"caret left icon"}),i("span",[e._v("Back")])]),i("br"),i("transition",{attrs:{name:"fade"}},[e.messageProperty.visible?i("sui-message",{class:e.messageProperty.color,attrs:{header:e.messageProperty.header,content:e.messageProperty.content},on:{click:function(){return e.setMessageProperty(!1,"red","","")}}}):e._e()],1),i("sui-button",{staticClass:"save-file",attrs:{primary:"",icon:"save"},on:{click:function(t){return e.saveFile()}}},[e._v("Save file")]),i("ckeditor",{attrs:{editor:e.editor},model:{value:e.releaseNote.content,callback:function(t){e.$set(e.releaseNote,"content",t)},expression:"releaseNote.content"}})],1):e._e()])],1)},Ti=[];const Ci="https://next-services.emg-digital.com";function Di(){return{headers:{Authorization:`Bearer ${T()}`}}}async function Ei(e){try{if(U()){let{data:t}=await G.a.get(`${Ci}/templates/${e}/release-note`,Di());return t}{let{data:t}=await G.a.get(`${Ci}/public/templates/${e}/release-note`);return t}}catch(t){if("Request failed with status code 403"===t.message)return{content:"

This documentation does not exist.

"}}}async function Ni(e,t){if(U()){let{data:i}=await G.a.put(`${Ci}/templates/${e}/release-note`,{content:t},Di());return i}throw new Error("User not authenticated.")}var Ii={getReleaseNote:Ei,setReleaseNote:Ni},Pi={name:"releaseNote",components:{},data(){return{releaseNote:null,loadingReleaseNote:!0,editor:Li,messageProperty:{visible:!1,color:"message-bg-red",header:"",content:""}}},methods:{getReleaseNote(){this.loadingReleaseNote=!0,Ii.getReleaseNote(this.$route.params.template).then(e=>{this.releaseNote=e,this.loadingReleaseNote=!1})},saveFile(){this.setMessageProperty(!0,"orange","Save file","Saving releaseNote in progress...");try{Ii.setReleaseNote(this.$route.params.template,this.releaseNote.content).then(()=>{this.getReleaseNote(),this.setMessageProperty(!0,"green","Save file","Save completed with success."),this.closeMessage()}).catch(e=>{this.setMessageProperty(!0,"red","Save file","An error occured during save: "+e),this.closeMessage()})}catch(e){this.setMessageProperty(!0,"red","Save file","An error occured during save: "+e),this.closeMessage()}},setMessageProperty(e,t,i,a){this.messageProperty.visible=e,this.messageProperty.color=`message-bg-${t}`,this.messageProperty.header=i,this.messageProperty.content=a},closeMessage(){setTimeout(()=>{this.setMessageProperty(!1,"red","","")},5e3)}},mounted(){this.getReleaseNote()}},Ui=Pi,Ai=(i("4726"),Object(V["a"])(Ui,Si,Ti,!1,null,"718e33c0",null)),Ri=Ai.exports,Fi=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"engines"},[i("sui-grid",[i("sui-grid-column",{attrs:{width:5}},[i("sui-segment",{staticClass:"engines",attrs:{loading:e.enginesLoading}},[e.engines?i("div",[i("sui-list",{attrs:{divided:"",relaxed:""}},e._l(e.engines,(function(t){return i("sui-list-item",{key:t.name,on:{click:function(i){return e.$router.push("/engines/display/"+t.name)}}},[i("sui-image",{attrs:{size:"mini",src:t.thumbnail}}),i("sui-list-content",[i("sui-list-header",{tag:"a"},[e._v(e._s(t.friendly_name))]),t.maxVersion?i("sui-list-description",{tag:"a"},[e._v("v."+e._s(t.maxVersion.version)+" - "+e._s(e._f("moment")(t.maxVersion.date,"DD/MM/YYYY HH:mm")))]):i("sui-list-description",{tag:"a"},[e._v("No version yet")]),i("sui-list-description",{tag:"a"},[i("small",[e._v(e._s(t.name))])])],1)],1)})),1),i("router-link",{attrs:{to:"/engines/new"}},[i("sui-button",{attrs:{primary:"",content:"New engine",icon:"add"}})],1)],1):e._e()])],1),i("sui-grid-column",{attrs:{width:11}},[e.engineName?i("router-view"):i("sui-segment",[i("h3",[e._v("Select an engine")]),i("p",[e._v("You have to select an engine first in order to see its detail.")])])],1)],1)],1)},Oi=[],Vi=i("b697"),zi=i.n(Vi),Yi={name:"engines",data(){return{enginesLoading:!0,engines:null}},computed:{engineName(){return"engines"!==this.$route.name}},mounted(){this.getEngines()},methods:{getEngines(){this.enginesLoading=!0,De.getEngines().then(e=>{this.engines=e;for(let t of this.engines){let e="0";for(let i of t.versions)1===zi()(i.version,e)&&(e=i.version);for(let i of t.versions)i.version===e&&(t.maxVersion=i)}this.enginesLoading=!1})}},watch:{$route(e,t){("engines"===e.name||!e.name&&"NewEngine"===t.name)&&this.getEngines()}}},Hi=Yi,qi=(i("6b4f"),Object(V["a"])(Hi,Fi,Oi,!1,null,"78d0325c",null)),ji=qi.exports,Bi=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("sui-segment",{attrs:{loading:e.engineLoading}},[e.engine?i("div",[i("sui-grid",[i("sui-grid-column",{staticStyle:{"line-height":"55px","text-align":"center"},attrs:{width:2}},[i("img",{staticStyle:{display:"inline-block","vertical-align":"middle","max-width":"100%","max-height":"45px"},attrs:{src:e.engine.thumbnail,alt:""}})]),i("sui-grid-column",{attrs:{width:8}},[i("h2",{staticStyle:{"margin-bottom":"0.5rem"}},[e._v(e._s(e.engine.friendly_name))]),i("p",[e._v(e._s(e.engine.name))])]),i("sui-grid-column",{staticStyle:{"text-align":"right","line-height":"55px"},attrs:{width:6}},[i("sui-button",{attrs:{negative:"",content:"Delete engine",icon:"remove"},on:{click:e.toggleDeleteModal}})],1)],1),i("sui-divider"),e.engine.versions.length>0?i("sui-table",{attrs:{"single-line":""}},[i("sui-table-header",[i("sui-table-row",[i("sui-table-header-cell",[e._v("Version")]),i("sui-table-header-cell",[e._v("Date")]),i("sui-table-header-cell",{staticStyle:{"text-align":"right"}},[e._v("Action")])],1)],1),i("sui-table-body",e._l(e.engine.versions,(function(t){return i("sui-table-row",{key:t.version},[i("sui-table-cell",[e._v("v."+e._s(t.version))]),i("sui-table-cell",[e._v(e._s(e._f("moment")(t.date,"DD/MM/YYYY HH:mm")))]),i("sui-table-cell",{staticStyle:{"text-align":"right"}},[i("router-link",{attrs:{to:"/engines/display/"+e.engine.name+"/"+t.id}},[i("sui-button",{attrs:{content:"Details/Edit",size:"tiny"}})],1)],1)],1)})),1)],1):i("sui-message",{attrs:{icon:"folder outline icon",header:"No versions yet",content:"Create the first version of the engine."}}),i("sui-button",{attrs:{primary:"",content:"New version",icon:"add"},on:{click:e.toggleNewVersionModal}})],1):e._e(),e.engine?i("sui-modal",{on:{clickAwayModal:e.toggleNewVersionModal},model:{value:e.newVersionModal,callback:function(t){e.newVersionModal=t},expression:"newVersionModal"}},[i("sui-modal-header",[e._v("Version number needed")]),i("sui-modal-content",{attrs:{image:""}},[i("sui-modal-description",[i("p",[e._v('You have to enter here a version number for this version of "'+e._s(e.engine.name)+'".')]),i("sui-form",[i("sui-form-field",[i("label",[e._v("Version")]),i("input",{directives:[{name:"model",rawName:"v-model",value:e.newVersionNumber,expression:"newVersionNumber"}],attrs:{name:"version",placeholder:"Ex. 1.2.0",required:""},domProps:{value:e.newVersionNumber},on:{input:function(t){t.target.composing||(e.newVersionNumber=t.target.value)}}}),e.newVersionError?i("sui-label",{attrs:{basic:"",color:"red",pointing:""}},[e._v('Please enter a valid version number like "1.2.0"')]):e._e()],1)],1)],1)],1),i("sui-modal-actions",[i("sui-button",{on:{click:e.toggleNewVersionModal}},[e._v("Cancel")]),i("sui-button",{attrs:{primary:"",icon:"add"},on:{click:e.newVersion}},[e._v("New version")])],1)],1):e._e(),e.engine?i("sui-modal",{model:{value:e.deleteModal,callback:function(t){e.deleteModal=t},expression:"deleteModal"}},[i("sui-modal-header",[e._v("Confirm deletion")]),i("sui-modal-content",{attrs:{image:""}},[i("sui-modal-description",[i("p",[e._v("You're about to delete the \""+e._s(e.engine.name)+'" engine. This is irreversible and will delete the versions associated.')])])],1),i("sui-modal-actions",[i("sui-button",{on:{click:e.toggleDeleteModal}},[e._v("Cancel")]),i("sui-button",{attrs:{negative:"",icon:"trash"},on:{click:e.deleteEngine}},[e._v("Delete")])],1)],1):e._e()],1)},Gi=[];const Wi="https://next-services.emg-digital.com";function Ki(){return{headers:{Authorization:`Bearer ${T()}`}}}async function Ji(e,t){if(U()){let{data:i}=await G.a.get(`${Wi}/engines/${e}/versions/${t}`,Ki());return i}throw new Error("User not authenticated.")}async function Xi(e,t){if(U()){let{data:i}=await G.a.post(`${Wi}/engines/${e}/versions/${t}`,{},Ki());return i}throw new Error("User not authenticated.")}async function Qi(e,t,i){if(U()){let{data:a}=await G.a.patch(`${Wi}/engines/${e}/versions/${t}/metadata`,{program:i.program?i.program:"",configuration:i.configuration?i.configuration:"",configurationType:i.configurationType?i.configurationType:"",supportedFormats:i.supportedFormats?i.supportedFormats:""},Ki());return a}throw new Error("User not authenticated.")}async function Zi(e,t,i){if(U()){let{data:a}=await G.a.delete(`${Wi}/engines/${e}/versions/${t}/${i}`,Ki());return a}throw new Error("User not authenticated.")}async function ea(e,t,i){if(U()){let{data:a}=await G.a.put(`${Wi}/engines/${e}/versions/${t}`,{file:i},Ki());return a}throw new Error("User not authenticated.")}async function ta(e,t){await G.a.put(e,t)}var ia={getVersion:Ji,getUploadSignature:ea,putFile:ta,deleteVersion:Zi,postVersion:Xi,updateVersionMetadata:Qi},aa=i("8d61"),na=i.n(aa),sa={name:"Engine",data(){return{engine:null,engineLoading:!0,deleteModal:!1,newVersionModal:!1,newVersionNumber:null,newVersionError:!1}},mounted(){this.getEngine()},watch:{$route(){this.getEngine()}},methods:{getEngine(){this.engineLoading=!0,this.engine=null,De.getEngine(this.$route.params.engine).then(e=>{this.engine=e,this.engineLoading=!1})},toggleDeleteModal(){this.deleteModal=!this.deleteModal},toggleNewVersionModal(){this.newVersionModal=!this.newVersionModal,this.newVersionModal||(this.newVersionNumber=null,this.newVersionError=!1)},deleteEngine(){this.engineLoading=!0,De.deleteEngine(this.engine.name).then(()=>{this.engineLoading=!1,this.deleteModal=!1,this.$router.push("/engines")})},newVersion(){const e=na.a.valid(this.newVersionNumber);this.newVersionError=!1,e?(this.toggleNewVersionModal(),this.engineLoading=!0,ia.postVersion(this.$route.params.engine,`${new Date(Date.now()).toISOString()}_${e}`).then(()=>{this.getEngine()})):this.newVersionError=!0}}},oa=sa,la=(i("1a7d"),Object(V["a"])(oa,Bi,Gi,!1,null,"20f7d625",null)),ra=la.exports,ca=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("sui-segment",{attrs:{loading:e.loading}},[i("h3",[e._v("New Engine")]),i("p",[e._v("Fill in the details to create the engine.")]),i("sui-divider"),e.errorMessage?i("sui-message",{attrs:{color:"red",icon:"times",header:"Error",content:e.errorMessage}}):e._e(),i("sui-form",{on:{submit:e.submit}},[i("sui-form-field",[i("label",[e._v("Name")]),i("input",{directives:[{name:"model",rawName:"v-model",value:e.form.name,expression:"form.name"}],attrs:{name:"name",required:""},domProps:{value:e.form.name},on:{input:function(t){t.target.composing||e.$set(e.form,"name",t.target.value)}}})]),i("sui-form-field",[i("label",[e._v("Friendly name")]),i("input",{directives:[{name:"model",rawName:"v-model",value:e.form.friendly_name,expression:"form.friendly_name"}],attrs:{name:"friendly_name",required:""},domProps:{value:e.form.friendly_name},on:{input:function(t){t.target.composing||e.$set(e.form,"friendly_name",t.target.value)}}})]),i("sui-form-field",[i("label",[e._v("Engine type")]),i("select",{directives:[{name:"model",rawName:"v-model",value:e.form.type,expression:"form.type"}],attrs:{name:"type",required:""},on:{change:function(t){var i=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){var t="_value"in e?e._value:e.value;return t}));e.$set(e.form,"type",t.target.multiple?i:i[0])}}},[i("option",{attrs:{value:"casparcg"}},[e._v("CasparCG")]),i("option",{attrs:{value:"unity"}},[e._v("Unity")])])]),i("sui-form-field",[i("label",[e._v("Logo")]),i("input",{attrs:{type:"file",required:"",accept:".png"},on:{change:e.fileEvent}})]),i("br"),i("sui-button",{attrs:{primary:"",icon:"check",type:"submit"}},[e._v("Create")])],1)],1)],1)},da=[],ua={name:"NewEngine",data(){return{form:{name:"",friendly_name:"",thumbnail:"",type:""},file:null,loading:!1,errorMessage:null}},methods:{fileEvent(e){this.file=e.target.files[0],this.form.thumbnail=this.file.name},submit(e){e.preventDefault(),this.loading=!0,De.postEngine({name:this.form.name,friendly_name:this.form.friendly_name,thumbnail:this.form.thumbnail,type:this.form.type}).then(e=>{De.putFile(e.thumbnail_upload_url,this.file).then(()=>{this.$router.push(`/engines/display/${this.form.name}`)})}).catch(e=>{"Request failed with status code 409"===e.message&&(this.errorMessage="An engine with this name already exists.",this.loading=!1)})}}},ma=ua,pa=Object(V["a"])(ma,ca,da,!1,null,"0c7909b9",null),ha=pa.exports,ga=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("sui-segment",{attrs:{loading:e.loadingVersion}},[e.version?i("div",[i("sui-grid",[i("sui-grid-column",{staticStyle:{"line-height":"55px","text-align":"center"},attrs:{width:2}},[i("img",{staticStyle:{display:"inline-block","vertical-align":"middle","max-width":"100%","max-height":"45px"},attrs:{src:e.version.engine.thumbnail,alt:""}})]),i("sui-grid-column",{attrs:{width:14}},[i("h2",{staticStyle:{"margin-bottom":"0.5rem"}},[e._v("v."+e._s(e.version.version)+" - "+e._s(e._f("moment")(e.version.date,"DD/MM/YYYY HH:mm")))]),i("p",[e._v(e._s(e.version.engine.friendly_name))])])],1),i("a",{staticClass:"back",on:{click:function(t){return e.$router.go(-1)}}},[i("i",{staticClass:"caret left icon"}),i("span",[e._v("Back")])]),i("sui-divider"),i("h4",[e._v("Version metadata")]),i("sui-form",[i("sui-grid",[i("sui-grid-column",{attrs:{width:6}},[i("sui-form-field",[i("label",[e._v("Program")]),i("sui-input",{attrs:{name:"program",placeholder:"Ex. casparcg.exe",loading:e.metadataLoading.program},on:{change:function(t){return e.metadataChanged("program")}},model:{value:e.version.metadata.program,callback:function(t){e.$set(e.version.metadata,"program",t)},expression:"version.metadata.program"}})],1)],1),i("sui-grid-column",{attrs:{width:5}},[i("sui-form-field",[i("label",[e._v("Configuration file")]),i("sui-input",{attrs:{name:"configuration",placeholder:"Ex. casparcg.exe",loading:e.metadataLoading.configuration},on:{change:function(t){return e.metadataChanged("configuration")}},model:{value:e.version.metadata.configuration,callback:function(t){e.$set(e.version.metadata,"configuration",t)},expression:"version.metadata.configuration"}})],1)],1),i("sui-grid-column",{attrs:{width:5}},[i("sui-form-field",[i("label",[e._v("Configuration file type")]),i("sui-dropdown",{attrs:{placeholder:"Gender",selection:"",options:[{text:"XML",value:"xml"},{text:"JSON",value:"json"}],loading:e.metadataLoading.configurationType},on:{input:function(t){return e.metadataChanged("configurationType")}},model:{value:e.version.metadata.configurationType,callback:function(t){e.$set(e.version.metadata,"configurationType",t)},expression:"version.metadata.configurationType"}})],1)],1),i("sui-grid-column",{attrs:{width:16}},[i("sui-form-field",[i("label",[e._v("Supported formats")]),i("sui-input",{attrs:{name:"supportedFormats",placeholder:"Ex: 1080i5000:HD 1080i50, 1080p2500:HD 1080p25",loading:e.metadataLoading.supportedFormats},on:{change:function(t){return e.metadataChanged("supportedFormats")}},model:{value:e.version.metadata.supportedFormats,callback:function(t){e.$set(e.version.metadata,"supportedFormats",t)},expression:"version.metadata.supportedFormats"}})],1)],1)],1)],1),i("br"),i("h4",[e._v("Files")]),i("tree-list",{staticClass:"list",attrs:{files:e.version.files}}),i("sui-divider"),i("sui-button",{attrs:{primary:"",icon:"upload"},on:{click:function(t){e.uploadModal=!0}}},[e._v("Upload version")]),i("sui-button",{attrs:{color:"red",icon:"trash"},on:{click:e.toggleDeleteModal}},[e._v("Delete version")])],1):e._e()]),e.version?i("sui-modal",{model:{value:e.deleteModal,callback:function(t){e.deleteModal=t},expression:"deleteModal"}},[i("sui-modal-header",[e._v("Confirm deletion")]),i("sui-modal-content",{attrs:{image:""}},[i("sui-modal-description",[i("p",[e._v("You're about to delete the \"v."+e._s(e.version.version)+" - "+e._s(e._f("moment")(e.version.date,"DD/MM/YYYY HH:mm"))+'" version. This is irreversible.')])])],1),i("sui-modal-actions",[i("sui-button",{on:{click:e.toggleDeleteModal}},[e._v("Cancel")]),i("sui-button",{attrs:{negative:"",icon:"trash"},on:{click:e.deleteVersion}},[e._v("Delete")])],1)],1):e._e(),e.version?i("upload-engine",{attrs:{open:e.uploadModal,engine:e.version.engine.name,version:e.$route.params.version},on:{hide:e.hideUploadModal}}):e._e()],1)},fa=[],va=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("sui-modal",{attrs:{closable:!1,animationDuration:200},model:{value:e.open,callback:function(t){e.open=t},expression:"open"}},[i("sui-modal-header",[e._v("Upload Engine")]),i("sui-modal-content",[i("input",{ref:"file",attrs:{type:"file",multiple:"",webkitdirectory:""},on:{change:e.filesChanged}}),e.selectedFiles?i("div",[i("h4",[e._v("Files to upload")]),i("sui-list",e._l(e.filesToUpload,(function(t){return i("sui-list-item",{key:t.webkitRelativePath},[i("sui-list-icon",{attrs:{name:"file"}}),i("sui-list-content",[i("sui-list-header",[e._v(e._s(t.webkitRelativePath))])],1)],1)})),1),e.uploading?e._e():[i("sui-button",{attrs:{positive:"",icon:"upload"},on:{click:e.startUpload}},[e._v("Upload")]),i("sui-button",{attrs:{icon:"folder"},on:{click:e.clickUpload}},[e._v("Change folder")])]],2):i("div",{staticStyle:{"text-align":"center"}},[e._v("\n No directory selected yet!\n "),i("br"),i("br"),i("sui-button",{attrs:{primary:"",icon:"upload"},on:{click:e.clickUpload}},[e._v("Select a folder to upload")])],1)]),i("sui-modal-actions",[e.uploading?i("sui-progress",{attrs:{state:"active",color:"green",percent:e.uploadingPercent,label:e.uploadingLabel}}):i("sui-button",{on:{click:e.cancel}},[e._v("Cancel")])],1)],1)},wa=[],ba={data(){return{selectedFiles:null,filesToUpload:null,uploading:!1,uploadingPercent:0,uploadingLabel:""}},props:["open","engine","version"],methods:{filesChanged(e){this.selectedFiles=null,this.filesToUpload=[],this.selectedFiles=e.target.files;for(let t of this.selectedFiles)".DS_Store"!==t.name&&this.filesToUpload.push(t)},clickUpload(){this.$refs.file.click()},startUpload(){this.uploading=!0,this.uploadingPercent=0,this.upload().then(()=>{this.selectedFiles=null,this.filesToUpload=null,this.uploadingLabel="",this.uploading=!1,this.uploadingPercent=0,this.$emit("hide")})},async upload(){let e=0;await ia.deleteVersion(this.engine,this.version,"false");for(let t of this.filesToUpload){e++;let i=t.webkitRelativePath.split("/");i.shift();let a=i.join("/");this.uploadingLabel=`Uploading "${a}"...`;let n=await ia.getUploadSignature(this.engine,this.version,a);await ia.putFile(n.upload_url,t),this.uploadingPercent=e/this.filesToUpload.length*100}},cancel(){this.selectedFiles=null,this.filesToUpload=null,this.$emit("hide")}}},_a=ba,ya=(i("1c0f"),Object(V["a"])(_a,va,wa,!1,null,"4d251417",null)),La=ya.exports,xa={name:"version",components:{TreeList:We,UploadEngine:La},data(){return{version:null,loadingVersion:!0,uploadModal:!1,deleteModal:!1,metadataLoading:{program:!1,configuration:!1,configurationType:!1,supportedFormats:!1}}},methods:{getVersion(){ia.getVersion(this.$route.params.engine,this.$route.params.version).then(e=>{this.version=e,this.loadingVersion=!1,this.metadataLoading={program:!1,configuration:!1,configurationType:!1}})},hideUploadModal(){this.uploadModal=!1,this.getVersion()},toggleDeleteModal(){this.deleteModal=!this.deleteModal},deleteVersion(){ia.deleteVersion(this.version.engine.name,this.$route.params.version,"true").then(()=>{this.$router.go(-1)})},metadataChanged(e){this.metadataLoading[e]=!0,ia.updateVersionMetadata(this.version.engine.name,this.$route.params.version,this.version.metadata).then(()=>{this.getVersion()})}},mounted(){this.loadingVersion=!0,this.getVersion()}},Ma=xa,ka=(i("8f09"),Object(V["a"])(Ma,ga,fa,!1,null,"bde322d6",null)),$a=ka.exports,Sa=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("sui-segment",{attrs:{loading:e.loadingReleaseNote}},[e.releaseNote?i("div",[i("sui-grid",[i("sui-grid-column",{attrs:{width:16}},[i("h2",{staticStyle:{"margin-bottom":"0.5rem"}},[e._v("Release note")]),i("p",[e._v(e._s(e.$route.params.template))])])],1),i("br"),i("span",{domProps:{innerHTML:e._s(e.releaseNote.content)}})],1):e._e()])],1)},Ta=[],Ca={name:"releaseNote",components:{},data(){return{releaseNote:null,loadingReleaseNote:!0}},methods:{getReleaseNote(){this.loadingReleaseNote=!0,Ii.getReleaseNote(this.$route.params.template).then(e=>{this.releaseNote=e,this.loadingReleaseNote=!1})}},mounted(){this.getReleaseNote()}},Da=Ca,Ea=Object(V["a"])(Da,Sa,Ta,!1,null,null,null),Na=Ea.exports,Ia=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"licenses"},[i("sui-segments",[e.loading?i("sui-segment",{staticStyle:{height:"200px"},attrs:{loading:!0}}):e._e(),e.loading?e._e():i("sui-segment",[i("sui-grid",[i("sui-grid-column",{attrs:{width:6}},[i("h5",[e._v("My license")]),e.user?i("h3",{staticClass:"my-license"},[e._v(e._s(e.user.email))]):e._e(),e._v("\n "+e._s(e.userLicense.role)+"\n ")]),i("sui-grid-column",{staticClass:"statistics",attrs:{width:10}},[i("sui-statistic",{attrs:{horizontal:"",size:"small"}},[i("sui-statistic-value",[e._v(e._s(e.userLicense.activations.length))]),i("sui-statistic-label",[e._v("Activations")])],1),i("sui-statistic",{attrs:{horizontal:"",size:"small"}},[0===e.userLicense.max_licenses?i("sui-statistic-value",[i("sui-icon",{attrs:{name:"ban"}})],1):i("sui-statistic-value",[e._v(e._s(e.userLicense.max_licenses))]),i("sui-statistic-label",[e._v("Max. activations")])],1),i("sui-statistic",{attrs:{horizontal:"",size:"small"}},[e.userLicense.expires?i("sui-statistic-value",[e._v(e._s(e._f("moment")(e.userLicense.expiration_date,"DD/MM/YYYY")))]):i("sui-statistic-value",[i("sui-icon",{attrs:{name:"ban"}})],1),i("sui-statistic-label",[e._v("Expires")])],1)],1)],1)],1),e.loading?e._e():i("sui-segment",[i("h5",[e._v("My activations")]),0!==e.userLicense.activations.length?i("sui-table",{attrs:{"single-line":"",size:"small"}},[i("sui-table-header",[i("sui-table-row",[i("sui-table-header-cell",[e._v("Machine alias/hardware ID")]),i("sui-table-header-cell",[e._v("Activation date")]),i("sui-table-header-cell",[e._v("Last reach date")])],1)],1),i("sui-table-body",e._l(e.userLicense.activations,(function(t){return i("sui-table-row",{key:t.id},[i("sui-table-cell",[e._v(e._s(t.alias)+"   "),i("sui-icon",{staticClass:"edit-alias",attrs:{name:"edit"},on:{click:function(i){return e.toggleEditAliasModal(e.userLicense,t)}}}),i("div",{staticClass:"hwid"},[e._v(e._s(t.hwid))])],1),i("sui-table-cell",[e._v(e._s(e._f("moment")(t.activation_date,"DD/MM/YYYY HH:mm")))]),i("sui-table-cell",[e._v(e._s(e._f("moment")(t.last_reach_date,"DD/MM/YYYY HH:mm")))])],1)})),1)],1):e._e(),0===e.userLicense.activations.length?i("sui-segment",{staticClass:"empty-table"},[e._v("No activations yet")]):e._e()],1),e.loading?e._e():i("sui-segment",[i("h5",[e._v("My licensees")]),i("sui-table",{attrs:{"single-line":"",size:"small"}},[i("sui-table-header",[i("sui-table-row",[i("sui-table-header-cell",[e._v("User")]),i("sui-table-header-cell",[e._v("Activations")]),i("sui-table-header-cell",[e._v("Max. activations")]),i("sui-table-header-cell",[e._v("Expires")]),i("sui-table-header-cell",[e._v(" ")])],1)],1),i("sui-table-body",e._l(e.users,(function(t){return i("sui-table-row",{key:t.id},[i("sui-table-cell",[e._v(e._s(t.email))]),i("sui-table-cell",[e._v(e._s(t.license.activations.length))]),0!==t.license.max_licenses?i("sui-table-cell",[e._v(e._s(t.license.max_licenses))]):i("sui-table-cell",[i("sui-icon",{attrs:{name:"ban"}})],1),t.license.expires?i("sui-table-cell",[e._v(e._s(e._f("moment")(t.license.expiration_date,"DD/MM/YYYY")))]):i("sui-table-cell",[i("sui-icon",{attrs:{name:"ban"}})],1),i("sui-table-cell",{staticStyle:{"text-align":"right"}},[i("sui-icon",{staticClass:"edit-alias",attrs:{name:"eye"},on:{click:function(i){return e.toggleDisplayLicenseeModal(t)}}}),e._v(" \n "),i("sui-icon",{staticClass:"edit-alias",attrs:{name:"edit"},on:{click:function(i){return e.toggleEditLicenseeModal(t)}}}),i("sui-icon",{staticClass:"edit-alias",attrs:{name:"delete"},on:{click:function(i){return e.toggleDeleteLicenseeModal(t)}}})],1)],1)})),1),i("sui-table-footer",{attrs:{"full-width":""}},[i("sui-table-row",[i("sui-table-header-cell",{attrs:{colspan:"5"}},[i("sui-button",{attrs:{size:"small",primary:"",labeled:""},on:{click:e.toggleNewLicenseeModal}},[i("sui-icon",{attrs:{name:"user"}}),e._v(" New licensee")],1)],1)],1)],1)],1)],1),e.loading?e._e():i("sui-segment",[i("h5",[e._v("My templates")]),i("sui-table",{attrs:{"single-line":"",size:"small"}},[i("sui-table-body",e._l(e.userTemplates,(function(t){return i("sui-table-row",{key:t.name},[i("sui-table-cell",[i("sui-header",{tag:"h4",attrs:{image:""}},[i("sui-image",{attrs:{src:t.thumbnail,size:"mini",shape:"rounded"}}),i("sui-header-content",[e._v("\n "+e._s(t.friendly_name)+"\n "),i("sui-header-subheader",[e._v(e._s(t.name))])],1)],1)],1)],1)})),1)],1)],1)],1),i("sui-modal",{attrs:{closable:!1},model:{value:e.editAliasModal.status,callback:function(t){e.$set(e.editAliasModal,"status",t)},expression:"editAliasModal.status"}},[i("sui-modal-header",[e._v("Edit Alias")]),i("sui-modal-content",{attrs:{image:""}},[i("sui-modal-description",[i("sui-form",[i("sui-form-field",[i("label",[e._v("Enter a new name for the alias")]),i("input",{directives:[{name:"model",rawName:"v-model",value:e.editAliasModal.text,expression:"editAliasModal.text"}],attrs:{name:"alias",required:""},domProps:{value:e.editAliasModal.text},on:{input:function(t){t.target.composing||e.$set(e.editAliasModal,"text",t.target.value)}}})])],1)],1)],1),i("sui-modal-actions",[i("sui-button",{on:{click:e.toggleEditAliasModal}},[e._v("Cancel")]),i("sui-button",{attrs:{primary:"",icon:"check"},on:{click:e.confirmEditAlias}},[e._v("Confirm")])],1)],1),e.loading?e._e():i("sui-modal",{attrs:{closable:!1},model:{value:e.newLicenseeModal.status,callback:function(t){e.$set(e.newLicenseeModal,"status",t)},expression:"newLicenseeModal.status"}},[i("sui-modal-header",[e._v("New licensee")]),i("sui-modal-content",{attrs:{image:""}},[i("sui-modal-description",[i("sui-form",[i("sui-form-field",[i("label",[e._v("Licensee's email")]),i("input",{directives:[{name:"model",rawName:"v-model",value:e.newLicenseeModal.email,expression:"newLicenseeModal.email"}],attrs:{type:"email",name:"email",placeholder:"john.doe@gmail.com",required:""},domProps:{value:e.newLicenseeModal.email},on:{input:function(t){t.target.composing||e.$set(e.newLicenseeModal,"email",t.target.value)}}}),i("sui-form-field"),i("label",[e._v("Licensee's name")]),i("input",{directives:[{name:"model",rawName:"v-model",value:e.newLicenseeModal.name,expression:"newLicenseeModal.name"}],attrs:{type:"text",name:"name",placeholder:"John Doe",required:""},domProps:{value:e.newLicenseeModal.name},on:{input:function(t){t.target.composing||e.$set(e.newLicenseeModal,"name",t.target.value)}}})],1),i("sui-grid",[i("sui-grid-column",{attrs:{width:8}},[i("sui-form-field",[i("label",[e._v("Maximum activations")]),i("input",{directives:[{name:"model",rawName:"v-model",value:e.newLicenseeModal.max_licenses,expression:"newLicenseeModal.max_licenses"}],attrs:{type:"number",name:"number",placeholder:"john.doe@gmail.com",disabled:!e.newLicenseeModal.limited_licenses,required:""},domProps:{value:e.newLicenseeModal.max_licenses},on:{input:function(t){t.target.composing||e.$set(e.newLicenseeModal,"max_licenses",t.target.value)}}}),i("sui-checkbox",{staticClass:"checkbox-below-input",attrs:{label:"Limited activations",disabled:0!==e.userLicense.max_licenses},model:{value:e.newLicenseeModal.limited_licenses,callback:function(t){e.$set(e.newLicenseeModal,"limited_licenses",t)},expression:"newLicenseeModal.limited_licenses"}})],1)],1),i("sui-grid-column",{attrs:{width:8}},[i("sui-form-field",[i("label",[e._v("Licence expiration")]),i("input",{directives:[{name:"model",rawName:"v-model",value:e.newLicenseeModal.expiration_date,expression:"newLicenseeModal.expiration_date"}],attrs:{type:"date",name:"number",placeholder:"john.doe@gmail.com",disabled:!e.newLicenseeModal.expires,required:""},domProps:{value:e.newLicenseeModal.expiration_date},on:{input:function(t){t.target.composing||e.$set(e.newLicenseeModal,"expiration_date",t.target.value)}}}),i("sui-checkbox",{staticClass:"checkbox-below-input",attrs:{label:"Expires"},model:{value:e.newLicenseeModal.expires,callback:function(t){e.$set(e.newLicenseeModal,"expires",t)},expression:"newLicenseeModal.expires"}})],1)],1)],1),i("sui-form-field",[i("label",[e._v("Licensee's accessible templates")]),i("sui-dropdown",{attrs:{multiple:"",fluid:"",options:e.templates,placeholder:"Templates",search:"",selection:"",loading:e.newLicenseeModal.loading_templates},model:{value:e.newLicenseeModal.templates,callback:function(t){e.$set(e.newLicenseeModal,"templates",t)},expression:"newLicenseeModal.templates"}})],1)],1)],1)],1),i("sui-modal-actions",[i("sui-button",{on:{click:e.toggleNewLicenseeModal}},[e._v("Cancel")]),i("sui-button",{attrs:{primary:"",icon:"save"},on:{click:e.confirmNewLicensee}},[e._v("Create")])],1)],1),e.loading?e._e():i("sui-modal",{attrs:{closable:!1},model:{value:e.editLicenseeModal.status,callback:function(t){e.$set(e.editLicenseeModal,"status",t)},expression:"editLicenseeModal.status"}},[i("sui-modal-header",[e._v("Edit licensee")]),i("sui-modal-content",[i("sui-modal-description",[i("sui-form",[i("sui-grid",[i("sui-grid-column",{attrs:{width:8}},[i("sui-form-field",[i("label",[e._v("Maximum activations")]),i("input",{directives:[{name:"model",rawName:"v-model",value:e.editLicenseeModal.max_licenses,expression:"editLicenseeModal.max_licenses"}],attrs:{type:"number",name:"number",placeholder:"john.doe@gmail.com",disabled:!e.editLicenseeModal.limited_licenses,required:""},domProps:{value:e.editLicenseeModal.max_licenses},on:{input:function(t){t.target.composing||e.$set(e.editLicenseeModal,"max_licenses",t.target.value)}}}),i("sui-checkbox",{staticClass:"checkbox-below-input",attrs:{label:"Limited activations",disabled:0!==e.userLicense.max_licenses},model:{value:e.editLicenseeModal.limited_licenses,callback:function(t){e.$set(e.editLicenseeModal,"limited_licenses",t)},expression:"editLicenseeModal.limited_licenses"}})],1)],1),i("sui-grid-column",{attrs:{width:8}},[i("sui-form-field",[i("label",[e._v("Licence expiration")]),i("input",{directives:[{name:"model",rawName:"v-model",value:e.editLicenseeModal.expiration_date,expression:"editLicenseeModal.expiration_date"}],attrs:{type:"date",name:"number",placeholder:"john.doe@gmail.com",disabled:!e.editLicenseeModal.expires,required:""},domProps:{value:e.editLicenseeModal.expiration_date},on:{input:function(t){t.target.composing||e.$set(e.editLicenseeModal,"expiration_date",t.target.value)}}}),i("sui-checkbox",{staticClass:"checkbox-below-input",attrs:{label:"Expires"},model:{value:e.editLicenseeModal.expires,callback:function(t){e.$set(e.editLicenseeModal,"expires",t)},expression:"editLicenseeModal.expires"}})],1)],1)],1),i("sui-form-field",[i("label",[e._v("Licensee's accessible templates")]),i("sui-dropdown",{attrs:{multiple:"",options:e.templates,placeholder:"Templates",search:"",selection:"",loading:e.editLicenseeModal.loading_templates},model:{value:e.editLicenseeModal.templates,callback:function(t){e.$set(e.editLicenseeModal,"templates",t)},expression:"editLicenseeModal.templates"}})],1)],1)],1)],1),i("sui-modal-actions",[i("sui-button",{on:{click:e.toggleEditLicenseeModal}},[e._v("Cancel")]),i("sui-button",{attrs:{primary:"",icon:"save"},on:{click:e.confirmEditLicensee}},[e._v("Save")])],1)],1),i("sui-modal",{attrs:{closable:!1},model:{value:e.newLicenseeSuccessModal,callback:function(t){e.newLicenseeSuccessModal=t},expression:"newLicenseeSuccessModal"}},[i("sui-modal-header",[e._v("Licensee created successfuly")]),i("sui-modal-content",{attrs:{image:""}},[i("sui-modal-description",[i("sui-table",{attrs:{"single-line":""}},[i("sui-table-body",[i("sui-table-row",[i("sui-table-cell",[e._v(e._s(e.newLicenseeModal.email))]),i("sui-table-cell",[e._v(e._s(e.newLicenseeModal.password))])],1)],1)],1)],1)],1),i("sui-modal-actions",[i("sui-button",{on:{click:e.toggleNewLicenseeSuccessModal}},[e._v("Ok")])],1)],1),i("sui-modal",{attrs:{closable:!1},model:{value:e.deleteLicenseeModal.status,callback:function(t){e.$set(e.deleteLicenseeModal,"status",t)},expression:"deleteLicenseeModal.status"}},[i("sui-modal-header",[e._v("Warning: licensee deletion")]),i("sui-modal-content",{attrs:{image:""}},[e.deleteLicenseeModal.user?i("sui-modal-description",[i("p",[e._v("You're about to delete the licensee \""+e._s(e.deleteLicenseeModal.user.email)+'".'),i("br"),e._v("He will lose access to his services and his machines will not be activated anymore.")])]):e._e()],1),i("sui-modal-actions",[i("sui-button",{on:{click:e.toggleDeleteLicenseeModal}},[e._v("Cancel")]),i("sui-button",{attrs:{negative:"",icon:"delete"},on:{click:e.confirmDeleteLicensee}},[e._v("Delete")])],1)],1),i("sui-modal",{attrs:{closable:!1},model:{value:e.displayLicenseeModal.status,callback:function(t){e.$set(e.displayLicenseeModal,"status",t)},expression:"displayLicenseeModal.status"}},[i("sui-modal-header",[e._v("Licensee details")]),i("sui-modal-content",{attrs:{scrolling:"",image:""}},[e.displayLicenseeModal.user?i("sui-modal-description",[i("sui-grid",[i("sui-grid-column",{attrs:{width:4}},[i("h5",[e._v("License")]),i("h3",{staticClass:"my-license"},[e._v(e._s(e.displayLicenseeModal.user.email))]),e._v("\n "+e._s(e.displayLicenseeModal.user.role)+"\n ")]),i("sui-grid-column",{staticClass:"statistics",attrs:{width:12}},[i("sui-statistic",{attrs:{horizontal:"",size:"small"}},[i("sui-statistic-value",[e._v(e._s(e.displayLicenseeModal.user.license.activations.length))]),i("sui-statistic-label",[e._v("Act.")])],1),i("sui-statistic",{attrs:{horizontal:"",size:"small"}},[0===e.displayLicenseeModal.user.license.max_licenses?i("sui-statistic-value",[i("sui-icon",{attrs:{name:"ban"}})],1):i("sui-statistic-value",[e._v(e._s(e.displayLicenseeModal.user.license.max_licenses))]),i("sui-statistic-label",[e._v("Max. act.")])],1),i("sui-statistic",{attrs:{horizontal:"",size:"small"}},[e.displayLicenseeModal.user.license.expires?i("sui-statistic-value",[e._v(e._s(e._f("moment")(e.displayLicenseeModal.user.license.expiration_date,"DD/MM/YYYY")))]):i("sui-statistic-value",[i("sui-icon",{attrs:{name:"ban"}})],1),i("sui-statistic-label",[e._v("Expires")])],1)],1)],1),i("br"),i("h5",[e._v("Activations")]),0!==e.displayLicenseeModal.user.license.activations.length?i("sui-table",{attrs:{"single-line":"",size:"small"}},[i("sui-table-header",[i("sui-table-row",[i("sui-table-header-cell",[e._v("Machine alias/hardware ID")]),i("sui-table-header-cell",[e._v("Activation date")]),i("sui-table-header-cell",[e._v("Last reach date")])],1)],1),i("sui-table-body",e._l(e.displayLicenseeModal.user.license.activations,(function(t){return i("sui-table-row",{key:t.id},[i("sui-table-cell",[e._v(e._s(t.alias)),i("div",{staticClass:"hwid"},[e._v(e._s(t.hwid))])]),i("sui-table-cell",[e._v(e._s(e._f("moment")(t.activation_date,"DD/MM/YYYY HH:mm")))]),i("sui-table-cell",[e._v(e._s(e._f("moment")(t.last_reach_date,"DD/MM/YYYY HH:mm")))])],1)})),1)],1):e._e(),0===e.displayLicenseeModal.user.license.activations.length?i("sui-segment",{staticClass:"empty-table"},[e._v("No activations yet")]):e._e(),i("br"),i("h5",[e._v("Templates")]),i("br"),i("div",{staticClass:"templates-labels"},e._l(e.displayLicenseeModal.user.license.templates,(function(t){return i("sui-label",{key:t},[e._v(e._s(t))])})),1)],1):e._e()],1),i("sui-modal-actions",[i("sui-button",{on:{click:e.toggleDisplayLicenseeModal}},[e._v("Hide")])],1)],1),i("sui-modal",{model:{value:e.errorModal.status,callback:function(t){e.$set(e.errorModal,"status",t)},expression:"errorModal.status"}},[i("sui-modal-header",[e._v("Error")]),i("sui-modal-content",{attrs:{image:""}},[i("sui-modal-description",[e._v("\n "+e._s(e.errorModal.error)+"\n ")])],1),i("sui-modal-actions",[i("sui-button",{on:{click:e.toggleErrorModal}},[e._v("Hide")])],1)],1)],1)},Pa=[],Ua=i("5fb2"),Aa=i.n(Ua);const Ra="https://next-services.emg-digital.com";function Fa(){return{headers:{Authorization:`Bearer ${T()}`}}}async function Oa(){if(!U())throw new Error("User not authenticated.");try{let{data:e}=await G.a.get(`${Ra}/licenses-users/self`,Fa());return e}catch(e){throw new Error(String(e.response.data.message))}}async function Va(e){if(!U())throw new Error("User not authenticated.");try{let{data:t}=await G.a.patch(`${Ra}/licenses-users/${e.id}`,e,Fa());return t}catch(t){throw new Error(String(t.response.data.message))}}async function za({id:e,activation_id:t,alias:i}){if(!U())throw new Error("User not authenticated.");try{let{data:a}=await G.a.patch(`${Ra}/licenses-users/${e}/alias`,{activation_id:t,alias:i},Fa());return a}catch(a){throw new Error(String(a.response.data.message))}}var Ya={getSelfLicense:Oa,patchLicense:Va,patchAlias:za};const Ha="https://next-services.emg-digital.com";function qa(){return{headers:{Authorization:`Bearer ${T()}`}}}async function ja(){if(!U())throw new Error("User not authenticated.");try{let{data:e}=await G.a.get(`${Ha}/users`,qa());return e}catch(e){throw new Error(String(e.response.data.message))}}async function Ba(e){if(!U())throw new Error("User not authenticated.");try{let{data:t}=await G.a.post(`${Ha}/users`,e,qa());return t}catch(t){throw new Error(String(t.response.data.message))}}async function Ga(e){if(!U())throw new Error("User not authenticated.");try{let{data:t}=await G.a.delete(`${Ha}/users/${e}`,qa());return t}catch(t){throw new Error(String(t.response.data.message))}}var Wa={getUsers:ja,postUser:Ba,deleteUser:Ga},Ka={name:"Licenses",data(){return{userLicense:null,users:null,userTemplates:null,templates:[],errorModal:{status:!1,error:""},loading:!0,editAliasModal:{status:!1,text:"",license:null,activation:null},newLicenseeModal:{status:!1,email:"",name:"",max_licenses:0,expiration_date:null,expires:!0,password:null,limited_licenses:!0,loading_templates:!1,templates:[]},editLicenseeModal:{status:!1,max_licenses:0,expiration_date:null,expires:!0,limited_licenses:!0,templates:[],loading_templates:!1,id:null},newLicenseeSuccessModal:!1,deleteLicenseeModal:{status:!1,user:null},displayLicenseeModal:{status:!1,user:null}}},computed:{user(){return h.state.user}},mounted(){this.userLicense=null,this.fetch().then(()=>{this.loading=!1}).catch(e=>{this.loading=!1,this.errorModal.status=!0,this.errorModal.error=e.message})},methods:{async fetch(){let[e,t,i]=await Promise.all([Ya.getSelfLicense(),Wa.getUsers(),te.getTemplates()]);this.userLicense=e,this.users=t,this.userTemplates=i},async fetchTemplates(){const e=await te.getTemplates();this.templates=[];for(let t of e)this.templates.push({key:t.name,value:t.name,text:t.name})},toggleEditAliasModal(e,t){this.editAliasModal.status=!this.editAliasModal.status,this.editAliasModal.status&&(this.editAliasModal.text=t.alias,this.editAliasModal.license=e,this.editAliasModal.activation=t)},toggleDisplayLicenseeModal(e){this.displayLicenseeModal.status=!this.displayLicenseeModal.status,this.displayLicenseeModal.status&&(this.displayLicenseeModal.user=e)},toggleErrorModal(){this.errorModal.status=!this.errorModal.status},confirmEditAlias(){this.toggleEditAliasModal(),this.loading=!0,Ya.patchAlias({id:this.editAliasModal.license.id,activation_id:this.editAliasModal.activation.id,alias:this.editAliasModal.text}).then(()=>{this.fetch().then(()=>{this.loading=!1}).catch(e=>{this.loading=!1,this.errorModal.status=!0,this.errorModal.error=e.message})}).catch(e=>{this.loading=!1,this.errorModal.status=!0,this.errorModal.error=e.message})},toggleNewLicenseeModal(){this.newLicenseeModal.status=!this.newLicenseeModal.status,this.newLicenseeModal.status&&(this.newLicenseeModal.email="",this.newLicenseeModal.name="",this.newLicenseeModal.max_licenses=0,this.newLicenseeModal.limited_licenses=!0,this.newLicenseeModal.expires=!0,this.editLicenseeModal.expiration_date=null,this.newLicenseeModal.loading_templates=!0,this.newLicenseeModal.templates=[],this.fetchTemplates().then(()=>{this.newLicenseeModal.loading_templates=!1}))},toggleNewLicenseeSuccessModal(){this.newLicenseeSuccessModal=!this.newLicenseeSuccessModal},toggleDeleteLicenseeModal(e){e&&!this.deleteLicenseeModal.status&&(this.deleteLicenseeModal.user=e),this.deleteLicenseeModal.status=!this.deleteLicenseeModal.status},toggleEditLicenseeModal(e){e&&!this.editLicenseeModal.status&&(e=JSON.parse(JSON.stringify(e)),this.editLicenseeModal.loading_templates=!0,this.editLicenseeModal.max_licenses=e.license.max_licenses,this.editLicenseeModal.expiration_date=new Date(e.license.expiration_date).toISOString().split("T")[0],this.editLicenseeModal.expires=e.license.expires,this.editLicenseeModal.limited_licenses=0!==e.license.max_licenses,this.editLicenseeModal.id=e.license.id,this.fetchTemplates().then(()=>{this.editLicenseeModal.loading_templates=!1,this.editLicenseeModal.templates=e.license.templates})),this.editLicenseeModal.status=!this.editLicenseeModal.status},confirmNewLicensee(){this.toggleNewLicenseeModal(),this.loading=!0,this.newLicenseeModal.password=Aa.a.generate(12),this.newLicenseeModal.limited_licenses||(this.newLicenseeModal.max_licenses=0),Wa.postUser({name:this.newLicenseeModal.name,email:this.newLicenseeModal.email,password:this.newLicenseeModal.password,max_licenses:this.newLicenseeModal.max_licenses,expires:this.newLicenseeModal.expires,expiration_date:new Date(this.newLicenseeModal.expiration_date).getTime(),templates:this.newLicenseeModal.templates}).then(()=>{this.toggleNewLicenseeSuccessModal(),this.fetch().then(()=>{this.loading=!1}).catch(e=>{this.loading=!1,this.errorModal.status=!0,this.errorModal.error=e.message})}).catch(e=>{this.loading=!1,this.errorModal.status=!0,this.errorModal.error=e.message})},confirmDeleteLicensee(){this.toggleDeleteLicenseeModal(),this.loading=!0,Wa.deleteUser(this.deleteLicenseeModal.user.user_id).then(()=>{this.fetch().then(()=>{this.loading=!1}).catch(e=>{this.loading=!1,this.errorModal.status=!0,this.errorModal.error=e.message})}).catch(e=>{this.loading=!1,this.errorModal.status=!0,this.errorModal.error=e.message})},confirmEditLicensee(){this.toggleEditLicenseeModal(),this.loading=!0,this.editLicenseeModal.limited_licenses||(this.editLicenseeModal.max_licenses=0),Ya.patchLicense({id:this.editLicenseeModal.id,max_licenses:this.editLicenseeModal.max_licenses,expires:this.editLicenseeModal.expires,expiration_date:new Date(this.editLicenseeModal.expiration_date).getTime(),templates:this.editLicenseeModal.templates}).then(()=>{this.fetch().then(()=>{this.loading=!1}).catch(e=>{this.loading=!1,this.errorModal.status=!0,this.errorModal.error=e.message})}).catch(e=>{this.loading=!1,this.errorModal.status=!0,this.errorModal.error=e.message})}},watch:{}},Ja=Ka,Xa=(i("f2a0"),Object(V["a"])(Ja,Ia,Pa,!1,null,"a7cd46b2",null)),Qa=Xa.exports,Za=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{attrs:{id:"home"}},[i("Sidebar",{attrs:{competitions:e.competitions,competitionsListing:e.competitionsListing,competitionIndex:e.competitionIndex},on:{select:e.selectCompetition,edit:function(t){e.formAdd=!1,e.formEdit=!0},add:function(t){e.formAdd=!0,e.formEdit=!1,e.competitionIndex=null}}}),i("div",{staticClass:"main"},[e.competitions.length>0&&!e.formAdd&&!e.formEdit||e.competitionIndex&&!e.formEdit?i("Tabs",{attrs:{tabsName:e.tabs,tabIndex:e.tabIndex,rows:e.rows},on:{change:function(t){e.tabIndex=t,e.data=null,e.rows=[],e.tabChanged()},export:e.convert2csv}},[i("template",{slot:"toolbar"},[e._l(Object.entries(e.tab.inputs),(function(t){return i("div",{key:t.key,staticClass:"input-group"},[i("label",{attrs:{for:t}},[e._v(e._s(t[1].name))]),"input"===t[1].type?i("sui-input",{attrs:{type:"text",id:t[0],value:e.inputValues[t[0]]||t[1].value},on:{change:function(i){return e.inputChange(t[0],i.target.value)}}}):e._e(),"select"===t[1].type&&e.options?i("sui-dropdown",{attrs:{selection:"",placeholder:"Select a season",id:t[0],options:e.options},model:{value:t[1].value,callback:function(i){e.$set(t[1],"value",i)},expression:"input[1].value"}}):e._e()],1)})),Object.keys(e.tab.inputs).length>0?i("sui-button",{attrs:{loading:e.loading,primary:"",icon:"play",content:"Confirm"},on:{click:function(t){e.confirmCall(e.tab),e.loading=!0}}}):e._e(),null!==e.data?i("sui-input",{attrs:{id:"endpoint",type:"text",value:e.endpoint,disabled:""}}):e._e(),null!==e.data?i("a",{attrs:{id:"rawXml",href:e.endpoint,target:"_blank",rel:"noopener noreferrer"}},[i("sui-button",{attrs:{content:"Fichier brut",icon:"file code",secondary:"","label-position":"left"}})],1):e._e()],2),i("template",{slot:"section"},[null!==e.data&&e.rows.length>1?i("div",{attrs:{id:"table"}},[null!==e.data?i("table",{directives:[{name:"columns-resizable",rawName:"v-columns-resizable"}],staticClass:"ui celled table"},[i("thead",[i("tr",e._l(Object.keys(e.rows[0]),(function(t){return i("th",{key:t.key},[e._v("\n "+e._s(t)+"\n ")])})),0)]),i("tbody",e._l(e.rows,(function(t){return i("tr",{key:t.key},e._l(Object.keys(t),(function(a){return i("td",{key:a.key},[e._v("\n "+e._s(t[a]?t[a]:"")+"\n ")])})),0)})),0)]):e._e()]):e._e(),null!==e.data&&"string"===e.type?i("vXmlTree",{attrs:{xmlData:e.data}},[i("template",{slot:"hide"},[e._v("▲")]),i("template",{slot:"expand"},[e._v("▼")])],2):e._e(),null!==e.data&&"object"===e.type?i("pre",[e._v(e._s(e.data))]):e._e()],1)],2):i("Form",{attrs:{competition:e.competition,editing:e.formEdit},on:{"add-compet":e.addCompet,"update-compet":e.updateCompet,"delete-compet":e.delCompet}},[i("template",{slot:"action"},[e._v(e._s(e.formAdd?"Add":"Edit"))])],2)],1)],1)},en=[],tn=i("19de"),an=i.n(tn);class nn{constructor(e,t){this.name=e,this.provider=t}}var sn=i("083c"),on=i.n(sn);class ln{constructor(e,t,i,a){this.name=e,this.endpointViews=t,this.fields=i,this.configuration=a}}const rn=on.a.Parser({mergeAttrs:!0,explicitArray:!0}),cn={username:"",password:"",competitionId:""};function dn(e,t){const i=t.split(".");try{let t=e;for(const e of i)t=e.indexOf("[")>=0?t[e.substring(0,e.indexOf("["))][e.substring(e.indexOf("[")+1,e.indexOf("]"))]:t[e];return"string"===typeof t&&(t=t.split(",")[0]),t||""}catch(a){return""}}class un extends ln{constructor(e=cn){const t=`competition=${e.competitionId}&user=${e.username}&psw=${e.password}`;super("Opta - Football",{Fixtures:{endpoint:`http://omo.akamai.opta.net/competition.php?${t}&season_id=SEASON&feed_type=F1`,inputs:{season:{type:"input",value:(new Date).getFullYear(),name:"Season"}},parse:e=>{const t=[];return rn.parseString(e,(e,i)=>{if(!e&&""!==dn(i,"SoccerFeed.SoccerDocument[0].MatchData"))for(const a of i.SoccerFeed.SoccerDocument[0].MatchData){const e={date:""!==dn(a,"MatchInfo[0].Date[0]._")?a.MatchInfo[0].Date[0]._:dn(a,"MatchInfo[0].Date[0]"),provider_id:dn(a,"uID[0]"),match_day:dn(a,"MatchInfo[0].MatchDay[0]"),period:dn(a,"MatchInfo[0].Period[0]")};if(a.Stat){for(const t of a.Stat)"Venue"===dn(t,"Type[0]")&&(e.venue=dn(t,"_"));for(const t of a.TeamData)switch(dn(t,"Side[0]")){case"Home":e.home_team_id=dn(t,"TeamRef[0]");break;case"Away":e.away_team_id=dn(t,"TeamRef[0]");break;default:break}}t.push(e)}}),t}},Squads:{endpoint:`http://omo.akamai.opta.net/competition.php?${t}&season_id=SEASON&feed_type=F40`,inputs:{season:{type:"input",value:(new Date).getFullYear(),name:"Season"}},parse:e=>{const t=[];return rn.parseString(e,(e,i)=>{if(!e&&dn(i,"SoccerFeed.SoccerDocument[0].Team"))for(const a of i.SoccerFeed.SoccerDocument[0].Team){const e={provider_id:dn(a,"uID[0]"),name:dn(a,"Name[0]"),short_name:dn(a,"short_club_name[0]"),acronym:dn(a,"SYMID[0]")};t.push(e)}}),t}},Players:{endpoint:`http://omo.akamai.opta.net/competition.php?${t}&season_id=SEASON&feed_type=F40`,inputs:{season:{type:"input",value:(new Date).getFullYear(),name:"Season"}},parse:e=>{const t=[];return rn.parseString(e,(e,i)=>{if(!e&&dn(i,"SoccerFeed.SoccerDocument[0].Team"))for(const a of i.SoccerFeed.SoccerDocument[0].Team){if(a.Player)for(const e of a.Player){const i={};if(e.Stat)for(const t of e.Stat)t.Type&&(i[t.Type[0]]="Unknown"!==t["_"]?t["_"]:"");t.push({first_name:dn(i,"first_name"),last_name:dn(i,"last_name"),usual_name:dn(i,"known_name"),name:dn(a,"uID[0]"),provider_id:dn(e,"uID[0]"),position:dn(e,"Position[0]"),number:dn(i,"jersey_num")})}if(a.TeamOfficial)for(const e of a.TeamOfficial)t.push({first_name:dn(e,"PersonName[0].First[0]"),last_name:dn(e,"PersonName[0].Last[0]"),usual_name:"",name:dn(a,"uID[0]"),provider_id:dn(e,"uID[0]"),position:dn(e,"Type[0]"),number:""})}}),t}},Ranking:{endpoint:`http://omo.akamai.opta.net/competition.php?${t}&season_id=SEASON&feed_type=F3`,inputs:{season:{type:"input",value:(new Date).getFullYear(),name:"Season"}},parse:e=>{const t=[];return rn.parseString(e,(e,i)=>{if(!e&&dn(i,"SoccerFeed.SoccerDocument[0].Competition[0].TeamStandings[0].TeamRecord"))for(const a of i.SoccerFeed.SoccerDocument[0].Competition[0].TeamStandings[0].TeamRecord){const e={played:dn(a,"Standing[0].Played[0]"),won:dn(a,"Standing[0].Won[0]"),drawn:dn(a,"Standing[0].Drawn[0]"),lost:dn(a,"Standing[0].Lost[0]"),for:dn(a,"Standing[0].For[0]"),against:dn(a,"Standing[0].Against[0]"),provider_id:dn(a,"TeamRef[0]"),points:dn(a,"Standing[0].Points[0]")};t.push(e)}}),t}},Match:{endpoint:`http://omo.akamai.opta.net/?${t}&feed_type=F9&game_id=MATCHID`,inputs:{matchId:{type:"input",value:853342,name:"Provider Match ID"}}},"Team stats":{endpoint:`http://omo.akamai.opta.net/team_competition.php?${t}&feed_type=F30&team_id=TEAMID&season_id=SEASON`,inputs:{season:{type:"input",value:(new Date).getFullYear(),name:"Season"},teamId:{type:"input",value:149,name:"Provider Team ID"}}}},{username:"Username",password:"Password",competitionId:"Competition ID"},e)}}const mn=on.a.Parser({mergeAttrs:!0,explicitArray:!0}),pn={username:"",password:"",competitionId:""};function hn(e,t){const i=t.split(".");try{let t=e;for(const e of i)t=e.indexOf("[")>=0?t[e.substring(0,e.indexOf("["))][e.substring(e.indexOf("[")+1,e.indexOf("]"))]:t[e];return"string"===typeof t&&(t=t.split(",")[0]),t||""}catch(a){return""}}class gn extends ln{constructor(e=pn){const t=`competition=${e.competitionId}&user=${e.username}&psw=${e.password}`;super("Opta - Rugby",{Fixtures:{endpoint:`http://omo.akamai.opta.net/competition.php?${t}&season_id=SEASON&feed_type=RU1`,inputs:{season:{type:"input",value:(new Date).getFullYear(),name:"Season"}},parse:e=>{const t=[];return mn.parseString(e,(e,i)=>{if(!e&&""!==hn(i,"fixtures.fixture")){const e={};if(hn(i,"fixtures.teams[0].team"))for(const t of i.fixtures.teams[0].team)e[t.id[0]]=t.name[0];for(const a of i.fixtures.fixture){const i={provider_id:hn(a,"id[0]"),name:e!=={}?`${e[hn(a,"team[0].team_id[0]")]} vs. ${e[hn(a,"team[1].team_id[0]")]}`:"",venue:hn(a,"venue[0]"),match_day:hn(a,"round[0]"),home_team_id:hn(a,"team[0].team_id[0]"),away_team_id:hn(a,"team[1].team_id[0]"),date:hn(a,"datetime[0]")};t.push(i)}}}),t}},Squads:{endpoint:`http://omo.akamai.opta.net/competition.php?${t}&season_id=SEASON&feed_type=RU10`,inputs:{season:{type:"input",value:(new Date).getFullYear(),name:"Season"}},parse:e=>{const t=[];return mn.parseString(e,(e,i)=>{if(!e&&""!==hn(i,"RU10_Profile.team"))for(const a of i.RU10_Profile.team)if("TBC"!==hn(a,"name[0]")){const e={provider_id:hn(a,"id[0]"),name:hn(a,"name[0]"),short_name:hn(a,"name[0]"),acronym:hn(a,"team_profile[0].symid[0]"),stadium_id:hn(a,"team_profile[0].venue_id[0]")};t.push(e)}}),t}},Players:{endpoint:`http://omo.akamai.opta.net/competition.php?${t}&season_id=SEASON&feed_type=RU10`,inputs:{season:{type:"input",value:(new Date).getFullYear(),name:"Season"}},parse:e=>{const t=[];return mn.parseString(e,(e,i)=>{if(!e&&""!==hn(i,"RU10_Profile.team"))for(const a of i.RU10_Profile.team)if(a.players)for(const e of a.players){const i={provider_id:hn(e,"player_id[0]"),first_name:hn(e,"player_first_name[0]"),last_name:hn(e,"player_last_name[0]"),usual_name:hn(e,"player_known_name[0]"),team_name:hn(a,"id[0]"),function:hn(e,"position[0]")};t.push(i)}}),t}},Stadiums:{endpoint:`http://omo.akamai.opta.net/competition.php?${t}&season_id=SEASON&feed_type=RU10`,inputs:{season:{type:"input",value:(new Date).getFullYear(),name:"Season"}},parse:e=>{const t=[];return mn.parseString(e,(e,i)=>{if(!e&&""!==hn(i,"RU10_Profile.venue"))for(const a of i.RU10_Profile.venue){const e={provider_id:hn(a,"venue_id[0]"),name:hn(a,"name[0]"),city:hn(a,"city[0]")};t.push(e)}}),t}},Match:{endpoint:`http://omo.akamai.opta.net/?${t}&feed_type=RU7&game_id=MATCHID`,inputs:{matchId:{type:"input",value:321016,name:"Provider Match ID"}}}},{username:"Username",password:"Password",competitionId:"Competition ID"},e)}}const fn={apikey:""};function vn(e,t){const i=t.split(".");try{let t=e;for(const e of i)t=e.indexOf("[")>=0?t[e.substring(0,e.indexOf("["))][e.substring(e.indexOf("[")+1,e.indexOf("]"))]:t[e];return"string"===typeof t&&(t=t.split(",")[0]),t||""}catch(a){return""}}class wn extends ln{constructor(e=fn){const t=`api_key=${e.apikey}`;super("Sportradar - Handball",{Fixtures:{endpoint:`https://api.sportradar.com/handball/production/v2/en/seasons/SEASON/summaries.json?${t}`,inputs:{season:{type:"input",value:"sr:season:77833",name:"Provider Season ID"}},parse:e=>{const t=[];if(e.summaries)for(const i of e.summaries){const e={date:vn(i,"sport_event.start_time"),provider_id:vn(i,"sport_event.id"),match_day:""!==vn(i,"sport_event.sport_event_context.round.name")?i.sport_event.sport_event_context.round.name:vn(i,"sport_event.sport_event_context.round.number"),venue:vn(i,"sport_event.venue.name"),period:""!==vn(i,"sport_event_status.match_status")?i.sport_event_status.match_status:vn(i,"sport_event_status.status")};if(""!==vn(i,"sport_event.competitors"))for(const t of i.sport_event.competitors)"home"===vn(t,"qualifier")&&(e.home_team=vn(t,"name")),"away"===vn(t,"qualifier")&&(e.away_team=vn(t,"name"));t.push(e)}return t}},Match:{endpoint:`https://api.sportradar.com/handball/production/v2/en/sport_events/MATCHID/timeline.json?${t}`,inputs:{matchId:{type:"input",value:"sr:sport_event:23610527",name:"Provider Match ID"}}}},{apikey:"API Key"},e)}}const bn={token:""};function _n(e,t){const i=t.split(".");try{let t=e;for(const e of i)t=e.indexOf("[")>=0?t[e.substring(0,e.indexOf("["))][e.substring(e.indexOf("[")+1,e.indexOf("]"))]:t[e];return"string"===typeof t&&(t=t.split(",")[0]),t||""}catch(a){return""}}class yn extends ln{constructor(e=bn){const t="https://data.livenote.nl/api/v2";super("Southfield - Field Hockey",{Fixtures:{endpoint:`${t}/phase?season=SEASON`,type:"southfield",token:e.token,inputs:{season:{type:"select",value:null,name:"Season"}},parse:e=>{const t=[];if(""!==_n(e,"data"))for(const i of _n(e.data[0],"schedule"))for(const a of i.games){const n=_n(a,"starts_at").split(" "),s=n[1].split(":")[0],o=n[1].split(":")[1],l=_n(a,"team_home"),r=_n(a,"team_away"),c={providerId:_n(a,"id"),startTime:`${s}:${o}`,home_team_providerID:_n(l,"id"),away_team_providerID:_n(r,"id"),competition_providerID:_n(e.data[0],"id"),matchday_providerID:_n(i,"id")};t.push(c)}return t},options:{endpoint:`${t}/season`,parse:e=>{const t=[];if(""!==_n(e,"data"))for(const i of e.data){const e={value:_n(i,"id"),text:_n(i,"name")};t.push(e)}return t}}},Teams:{endpoint:`${t}/team`,type:"southfield",token:e.token,inputs:{},parse:e=>{const t=[];if(""!==_n(e,"data"))for(const i of e.data){const e={providerId:_n(i,"id"),name:_n(i,"club.name"),short_name:_n(i,"club.name"),acronym:_n(i,"club.short_name"),picture:_n(i,"club.short_name"),primary_color:_n(i,"club.color_primary"),secondary_color:_n(i,"club.color_secondary")};t.push(e)}return t}},Players:{endpoint:`${t}/team`,type:"southfield",token:e.token,inputs:{},parse:e=>{const t=[];if(""!==_n(e,"data"))for(const i of e.data)for(const e of i.players){const a={providerId:_n(e,"id"),firstName:_n(e,"first_name"),lastName:_n(e,"last_name"),shirtNumber:_n(e,"shirt_number"),picture:_n(e,"slug"),team_providerID:_n(i,"id")};t.push(a)}return t}},Rounds:{endpoint:`${t}/round?phase=PHASE`,type:"southfield",token:e.token,inputs:{phase:{type:"select",value:null,name:"Phase"}},parse:e=>{const t=[];if(""!==_n(e,"data"))for(const i of e.data){const e={name:_n(i,"name"),id:_n(i,"id")};t.push(e)}return t},options:{endpoint:`${t}/phase`,parse:e=>{const t=[];if(""!==_n(e,"data"))for(const i of e.data)if(_n(i,"schedule").length>0){const e=i.starts_on.split("-")[0],a={value:_n(i,"id"),text:`${_n(i,"name")} (${e})`};t.push(a)}return t}}}},{token:"Token"},e)}}class Ln{constructor(e){this.competitionsCollection=[];for(const t of e)this.competitionsCollection.push(this.initializeCompetition(t))}initializeCompetition(e){if(!e.provider)throw new Error("CompetitionSettings must have a 'provider' key");if(!e.competitionName)throw new Error("CompetitionSettings must have a 'name' key");let t;switch(e.provider){case"OptaFootball":t=new un({username:e.username,password:e.password,competitionId:e.competitionId});break;case"OptaRugby":t=new gn({username:e.username,password:e.password,competitionId:e.competitionId});break;case"SportradarHandball":t=new wn({apikey:e.apikey});break;case"SouthfieldFieldHockey":t=new yn({token:e.token});break}return new nn(e.competitionName,t)}}var xn=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{attrs:{id:"tabs"}},[i("div",{staticClass:"tabs"},[e._l(e.tabsName,(function(t,a){return i("div",{key:t.key,class:["tab",a===e.tabIndex?"active":""],on:{click:function(t){return e.tabChange(a)}}},[e._v("\n "+e._s(t)+"\n ")])})),e.rows.length>0?i("sui-button",{attrs:{primary:"",icon:"download",content:"Export"},on:{click:function(t){return e.$emit("export")}}}):e._e()],2),i("div",{staticClass:"toolbar"},[e._t("toolbar")],2),i("div",{staticClass:"section"},[e._t("section")],2)])},Mn=[],kn={name:"Tabs",props:{tabsName:{type:Array,default:()=>["Tab 1","Tab 2"]},tabIndex:{type:Number},rows:{type:Array}},methods:{tabChange(e){this.$emit("change",e)}}},$n=kn,Sn=Object(V["a"])($n,xn,Mn,!1,null,null,null),Tn=Sn.exports,Cn=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{attrs:{id:"form"}},[i("h2",[e._t("action"),e._v(" competition")],2),i("sui-form",[i("sui-form-field",[i("sui-label",[e._v("Competition name")]),i("sui-input",{attrs:{type:"text"},model:{value:e.name,callback:function(t){e.name=t},expression:"name"}})],1),i("sui-form-field",[i("sui-label",[e._v("Provider")]),i("sui-dropdown",{attrs:{id:"provider",placeholder:"Provider",selection:"",options:e.providerOptions},model:{value:e.providerIndex,callback:function(t){e.providerIndex=t},expression:"providerIndex"}})],1),-1!==e.providerIndex?i("sui-divider"):e._e(),-1!==e.providerIndex&&e.providers[e.providerIndex].fields?[e._l(Object.keys(e.providers[e.providerIndex].fields),(function(t){return[i("sui-form-field",{key:t.key},[i("sui-label",[e._v(e._s(e.providers[e.providerIndex].fields[t]))]),i("sui-input",{attrs:{id:t,type:"text"},model:{value:e.inputs[t],callback:function(i){e.$set(e.inputs,t,i)},expression:"inputs[field]"}})],1)]}))]:e._e()],2),i("sui-button",{attrs:{disabled:""===this.name||-1===this.providerIndex,primary:"",icon:e.editing?"edit":"add"},on:{click:e.addCompetition}},[e._t("action"),e._v("\n competition\n ")],2),e.editing?i("sui-button",{attrs:{disabled:""===this.name||-1===this.providerIndex,secondary:"",icon:"trash"},on:{click:function(t){return e.$emit("delete-compet")}}},[e._v("\n Delete competition\n ")]):e._e()],1)},Dn=[],En={name:"Form",props:{competition:nn,editing:Boolean},data(){return{providers:[],providerIndex:-1,inputs:{},name:""}},mounted(){this.providers=[new un,new gn,new wn,new yn],this.loadInputValues()},methods:{addCompetition(){if(""===this.name)this.$toast.error("Veuillez entrer un nom");else if(-1===this.providerIndex)this.$toast.error("Veuillez choisir un fournisseur");else if(this.isEmpty(this.inputs))this.$toast.error("Veuillez remplir les champs du fournisseur");else{console.log("this inputs",this.inputs),console.log("this providers",this.providers);const e=this.editing?"update-compet":"add-compet";this.$emit(e,{...this.inputs,competitionName:this.name,provider:this.providers[this.providerIndex].name.replace(/ |-/g,"")})}},isEmpty(e){const t=Object.values(e);let i=0;while(""!==t[i]&&ie.name===this.competition.provider.name));for(const[e,t]of Object.entries(this.competition.provider.configuration))this.inputs[e]=t}else this.name="",this.providerIndex=-1,this.inputs={}}},computed:{providerOptions(){return console.log("this.providers",this.providers),this.providers.map((e,t)=>{return{text:e.name,value:t}})}},watch:{competition(){this.loadInputValues()},editing(){this.loadInputValues()}}},Nn=En,In=Object(V["a"])(Nn,Cn,Dn,!1,null,null,null),Pn=In.exports,Un=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"sidebar"},[i("div",{attrs:{id:"competitions"}},[e.competitionsListing?i("div",{staticClass:"waiting-competitions"},[i("div",{staticClass:"ui active inline loader"})]):e._e(),e._l(e.competitions,(function(t,a){return i("div",{key:t.key,class:["competition",a===e.competitionIndex?"active":""],on:{click:function(t){return e.$emit("select",a)}}},[i("span",[e._v(e._s(t.name))])])}))],2),i("sui-button",{attrs:{disabled:null===e.competitionIndex,secondary:"",icon:"edit",content:"Edit competition"},on:{click:function(t){return e.$emit("edit")}}}),i("sui-button",{attrs:{primary:"",icon:"add",content:"Add competition"},on:{click:function(t){return e.$emit("add")}}})],1)},An=[],Rn={name:"Sidebar",props:["competitions","competitionsListing","competitionIndex"]},Fn=Rn,On=Object(V["a"])(Fn,Un,An,!1,null,null,null),Vn=On.exports,zn=i("22eb"),Yn=i.n(zn),Hn={name:"Stats",components:{Tabs:Tn,Form:Pn,vXmlTree:Yn.a,Sidebar:Vn},data(){return{competitions:[],competitionIndex:0,tabIndex:0,inputValues:{},data:null,url:"",loading:!1,endpoint:"",options:null,formAdd:!1,formEdit:!1,rows:[],type:null,competitionsListing:!0}},async mounted(){await this.getCompetitions(),this.competitionsListing=!1},watch:{async competitionIndex(){Object.values(this.competition.provider.endpointViews)[this.tabIndex].options&&(this.options=await this.getOptions())}},computed:{competition(){return this.competitions[this.competitionIndex]},tabs(){return Object.keys(this.competition.provider.endpointViews)},tab(){return Object.values(this.competition.provider.endpointViews)[this.tabIndex]},parse(){return Object.values(this.competition.provider.endpointViews)[this.tabIndex].parse}},methods:{inputChange(e,t){this.inputValues[e]=t},async tabChanged(){0===Object.keys(this.tab.inputs).length&&await this.confirmCall(this.tab),Object.values(this.competition.provider.endpointViews)[this.tabIndex].options&&(this.options=await this.getOptions())},async getOptions(){const e=Object.values(this.competition.provider.endpointViews)[this.tabIndex],t=e.options.endpoint,i=e.type,a=e.token,n=await this.axios.get(t,{headers:{Authorization:`Bearer ${"southfield"===i?a:T()}`}});return e.options.parse(n.data)},getFormattedName(e){return e.toLowerCase().normalize("NFD").replace(/\p{Diacritic}| /gu,"")},async addCompet(e){try{const t=await this.axios.post("https://next-services.emg-digital.com/stateasy",e,{headers:{Authorization:`Bearer ${T()}`}});if("Failure"===t.data.status)throw new Error(t.message);await this.getCompetitions()}catch(t){this.$toast.error(t.message)}},async updateCompet(e){try{const t=await this.axios.put(`https://next-services.emg-digital.com/stateasy/${this.getFormattedName(this.competition.name)}`,e,{headers:{Authorization:`Bearer ${T()}`}});if("Failure"===t.data.status)throw new Error(t.message);await this.getCompetitions()}catch(t){this.$toast.error(t.message)}},async delCompet(){try{const e=await this.axios.delete(`https://next-services.emg-digital.com/stateasy/${this.getFormattedName(this.competition.name)}`,{headers:{Authorization:`Bearer ${T()}`}});if("Failure"===e.data.status)throw new Error(e.message);await this.getCompetitions()}catch(e){this.$toast.error(e.message)}},async getCompetitions(){try{const e=await this.axios.get("https://next-services.emg-digital.com/stateasy",{headers:{Authorization:`Bearer ${T()}`}});if("Failure"===e.data.status)throw new Error(e.message);const t=new Ln(e.data.array);this.competitions=t.competitionsCollection,this.competitions.sort((e,t)=>e.name.localeCompare(t.name))}catch(e){this.$toast.error(e.message)}},async confirmCall(e){let t=e.endpoint;const i=e;for(const n in i.inputs)t=t.replace(n.toUpperCase(),this.inputValues[n]?this.inputValues[n]:i.inputs[n].value);this.url="southfield"===e.type?t:`https://next-services.emg-digital.com/stateasy/proxy/${t}`;try{const t=await this.axios.get(this.url,{headers:{Authorization:`Bearer ${"southfield"===e.type?e.token:T()}`}});this.data=t.data,this.rows=[],this.parse&&(this.rows=this.parse(this.data),this.type=null),0===this.rows.length&&(this.type=typeof this.data)}catch(a){console.error(a)}this.loading=!1,this.endpoint=t},convert2csv(){let e="";for(const t of Object.keys(this.rows[0]))e=""===e?`${t}`:`${e},${t}`;e=`${e}\n`;for(const t of this.rows){let i="";for(const e of Object.keys(t))i=""===i?`${t[e]}`:`${i},${t[e]}`;e=`${e}${i}\n`}an()(e,`${this.getFormattedName(this.competition.name)}_${this.tabs[this.tabIndex].toLowerCase()}.csv`)},selectCompetition(e){this.competitionIndex=e,this.formAdd=!1,this.formEdit=!1,this.data=null,this.tabIndex=0,0===Object.keys(this.tab.inputs).length&&this.confirmCall(this.tab)}}},qn=Hn,jn=Object(V["a"])(qn,Za,en,!1,null,null,null),Bn=jn.exports,Gn=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("sui-grid",[i("sui-grid-column",{attrs:{width:6,centered:!0}},[i("sui-message",{attrs:{header:"Access restricted"}},[i("sui-message-content",[e._v("\n Please sign-in.\n "),i("br"),i("sui-button",{attrs:{content:"Sign in",icon:"sign in alternate icon",primary:""},on:{click:function(t){return e.login()}}})],1)],1)],1)],1)],1)},Wn=[],Kn={name:"Authorize",methods:{login(){M()}}},Jn=Kn,Xn=(i("904a"),Object(V["a"])(Jn,Gn,Wn,!1,null,"5a77d7d0",null)),Qn=Xn.exports,Zn=function(){var e=this,t=e.$createElement;e._self._c;return e._m(0)},es=[function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("p",{staticStyle:{"text-align":"center"}},[e._v("Authentication successful. Please wait.")])])}],ts={name:"",components:{},mounted(){I(),P(),window.location.href="/"}},is=ts,as=Object(V["a"])(is,Zn,es,!1,null,null,null),ns=as.exports;a["default"].use(H["a"]);var ss=new H["a"]({mode:"history",base:"/",routes:[{path:"/",redirect:"/templates"},{path:"/templates",name:"templates",component:se,beforeEnter:$,children:[{path:"/templates/display/:template",component:_e},{path:"/templates/display/:template/release-note",name:"TemplateReleaseNote",component:Ri,beforeEnter:$},{path:"/templates/display/:template/:version",name:"TemplateVersion",component:nt,beforeEnter:$},{path:"/templates/display/:template/:version/documentation/:documentation",name:"TemplateDocumentation",component:$i,beforeEnter:$},{path:"/templates/new",name:"NewTemplate",component:Pe,beforeEnter:$}]},{path:"/engines",name:"engines",component:ji,beforeEnter:$,children:[{path:"/engines/display/:engine",component:ra},{path:"/engines/display/:engine/:version",name:"EngineVersion",component:$a,beforeEnter:$},{path:"/engines/new",name:"NewEngine",component:ha,beforeEnter:$}]},{path:"/release-notes/:template",name:"ReleaseNotes",component:Na},{path:"/licenses",name:"licenses",component:Qa,beforeEnter:$,children:[]},{path:"/statistics",name:"Statistics",component:Bn,beforeEnter:$},{path:"/authorize",name:"authorize",component:Qn},{path:"/callback",component:ns}]}),os=i("2106"),ls=i.n(os),rs=i("a9b2"),cs=i.n(rs),ds=i("b079"),us=i.n(ds),ms=i("6930"),ps=i.n(ms);i("c4ca"),i("8033"),i("4238"),i("b20f");a["default"].config.productionTip=!1,a["default"].use(s.a),a["default"].use(cs.a),a["default"].use(us.a),a["default"].use(ls.a,G.a),a["default"].use(ps.a),a["default"].use(i("2ead")),new a["default"]({router:ss,store:h,render:e=>e(Y)}).$mount("#app")},"5bdc":function(e,t,i){"use strict";var a=i("280b"),n=i.n(a);n.a},"5c0b":function(e,t,i){"use strict";var a=i("0d3e"),n=i.n(a);n.a},"5e1e":function(e,t,i){"use strict";var a=i("3148"),n=i.n(a);n.a},6197:function(e,t,i){},"6b4f":function(e,t,i){"use strict";var a=i("c092"),n=i.n(a);n.a},7512:function(e,t,i){},"82e6":function(e,t,i){},"8b26":function(e,t,i){},"8f09":function(e,t,i){"use strict";var a=i("8b26"),n=i.n(a);n.a},"904a":function(e,t,i){"use strict";var a=i("16e8"),n=i.n(a);n.a},ab64:function(e,t,i){},b20f:function(e,t,i){},bcca:function(e,t,i){"use strict";var a=i("eb43"),n=i.n(a);n.a},bdb5:function(e,t,i){},c092:function(e,t,i){},c3d0:function(e,t,i){},cf05:function(e,t,i){e.exports=i.p+"img/logo.bf1b1805.png"},eb43:function(e,t,i){},ed6a:function(e,t,i){"use strict";var a=i("ab64"),n=i.n(a);n.a},f2a0:function(e,t,i){"use strict";var a=i("7512"),n=i.n(a);n.a},f884:function(e,t,i){e.exports=i.p+"img/gravity.7b0307bd.png"}}); //# sourceMappingURL=app.6ec54c26.js.map