text: {function t(){window.ccm[v].component(component)}var component={name:'factory',version:[0,9,1],ccm:'https://akless.github.io/ccm/version/ccm-13.1.0.min.js',config:{html:{main:{id:'main',class:'container',inner:[{id:'alertMessage',class:'alert alert-danger',style:'display: none;'},{id:'componentSelector',style:'display: none;',inner:[{inner:'URL of the component:',style:'margin-top: 20px;'},{tag:'input',class:'form-control',id:'componentURL',size:'70',value:''},{inner:'URL of an external config file (optional):'},{tag:'input',class:'form-control',id:'componentConfigURL',size:'70',value:''},{inner:'Key inside the external config file (leave blank when no config file is used):'},{tag:'input',class:'form-control',id:'componentConfigKeyURL',size:'70',value:''},{tag:'button',class:'btn btn-success',style:'margin-top: 15px',inner:'Load component',onclick:'%loadComponentClick%'},{tag:'br'}]},{id:'loadSpinner',class:'spinner',style:'display: none;',inner:[{class:'bounce1'},{class:'bounce2'},{class:'bounce3'}]},{tag:'div',id:'chooseEditingStyle',style:'display: none; margin-top: 15px;',inner:[{inner:'Choose a mode for editing:'},{tag:'button',class:'btn btn-default',inner:'Config editor',onclick:'%configEditorChosenClick%'},{tag:'button',class:'btn btn-default',style:'margin-left: 10px;',inner:'Guided editing',onclick:'%guidedEditingChosenClick%'}]},{tag:'div',id:'areaForConfigEditing',style:'display: none;',inner:[{id:'innerConfigEditorArea',"data-configorigin":'innerConfigEditorArea',inner:[{inner:'Config'}]},{tag:'br'},{tag:'div',inner:[{tag:'button',class:'btn btn-primary',inner:'Generate new component',onclick:'%generateFromEditorClick%'}]}]},{tag:'div',id:'areaForGuidedEditing',style:'display: none;',inner:[{tag:'h2',inner:'Guided editing mode for modifying the component'},{id:'ccmDefaulConfigArea',style:'display: none;',inner:[{tag:'h4',inner:'CCM configuration'},{inner:[{inner:'Name of the new component: '},{tag:'input',class:'form-control',id:'guided_nameOfNewComponent'}]},{inner:[{id:'ccmUrlEditor',inner:['URL of CCM: ',{tag:'button',class:'btn btn-default btn-circle',inner:'?',onclick:'%showHelpForCCMURL%'}]},{tag:'input',class:'form-control',size:'50',id:'guided_ccmURL'}]}]},{id:'guided_componentSpecificConfiguration',inner:[{tag:'h4',inner:'Component specific configuration'},{tag:'div',id:'htmlEditorCaption',inner:['HTML: ',{tag:'button',class:'btn btn-default btn-circle',inner:'?',onclick:'%showHelpForHTML%'}],style:'display: none;'},{tag:'div',id:'htmlEditor',"data-configorigin":'htmlEditor'}]},{tag:'br'},{tag:'button',class:'btn btn-primary',inner:'Generate new component',onclick:'%generateFromGuidedClick%'}]},{tag:'br'},{id:'newComponentDisplayLabel',inner:'Code of the component:',style:'display: none;'},{tag:'textarea',class:'form-control',id:'newComponentDisplay',style:'display: none;',rows:20,cols:50,inner:'New component'},{id:'newComponentConfigDisplayLabel',inner:'New configuration:',style:'display: none;'},{tag:'textarea',class:'form-control',id:'newComponentConfigDisplay',style:'display: none;',rows:20,cols:50,inner:'New configuration'},{tag:'br'},{tag:'button',class:'btn btn-warning',id:'downloadNewComponentButton',style:'display: none;',inner:'Download new component',onclick:'%downloadNewComponentClick%'},{tag:'br'},{id:'demoWrapper',style:'display: none;',inner:{class:'panel panel-default',inner:[{class:'panel-heading',inner:{tag:'h3',class:'panel-title',inner:'Demo'}},{class:'panel-body',inner:{tag:'div',id:'demoArea'}}]}}]}},css:['ccm.load','https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css','https://leoneck.github.io/ccm-factory/css/default.css'],JSONfn:['ccm.load','https://leoneck.github.io/ccm-factory/js/jsonfn.js'],preview:!0,show_ccm_fields:!0,use_ace_for_editing:!0,url_to_modify:'',external_config:'',key_in_external_config:'',display_final_component_and_config:!0,no_bootstrap_container:!1},Instance:function(){const e=this;let n={config:{}};const t={configEditor:null,htmlEditor:null,functionEditors:{},arrayMultipleTypesEditors:{}};this.start=(i)=>{function o(){I.querySelector('#alertMessage').style.display='none',I.querySelector('#loadSpinner').style.display='block';let t='',i='',o='';e.url_to_modify?(t=e.url_to_modify,i=e.external_config,o=e.key_in_external_config):(t=I.querySelector('#componentURL').value,i=I.querySelector('#componentConfigURL').value,o=I.querySelector('#componentConfigKeyURL').value);const l=new XMLHttpRequest;l.open('GET',t),l.onreadystatechange=function(){if(l.readyState===XMLHttpRequest.DONE&&200===l.status){const t=l.responseText.replace('window.ccm&&null===window.ccm.files[f])window.ccm.files[f]','true)window.loadedForFactory').replace('window.ccm && window.ccm.files[ f ] === null','true').replace('window.ccm.files[ f ] = component;','window.loadedForFactory = component;');if(eval(t),n=e.ccm.helper.clone(window.loadedForFactory),'object'!=typeof n)return I.querySelector('#alertMessage').innerHTML='The loaded file does not contain a valid ccm component',void(I.querySelector('#alertMessage').style.display='block');if(n.config||(n.config={}),delete n.config.ccm,''!==i&&''!==o){const t=new XMLHttpRequest;t.open('GET',i),t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE&&200===t.status){const i=t.responseText.replace('ccm.files[\'configs.js\']','window.loadedConfigForFactory').replace('ccm.files["configs.js"]','window.loadedConfigForFactory').replace('ccm.files[ \'configs.js\' ]','window.loadedConfigForFactory').replace('ccm.files[ "configs.js" ]','window.loadedConfigForFactory');eval(i),Object.keys(window.loadedConfigForFactory[o.toLowerCase()]).forEach((e)=>{n.config[e]=window.loadedConfigForFactory[o.toLowerCase()][e]}),e.use_ace_for_editing?setTimeout(r,1e3):r()}},t.send()}else e.use_ace_for_editing?setTimeout(r,1e3):r()}},l.send()}function r(){I.querySelector('#loadSpinner').style.display='none',I.querySelector('#componentSelector').style.display='none',I.querySelector('#chooseEditingStyle').style.display='block',document.createElement('juicy-ace-editor').constructor===HTMLElement&&(e.use_ace_for_editing=!1)}function l(){e.onchange&&e.onchange(e),I.querySelector('#chooseEditingStyle').style.display='none',c()}function c(){I.querySelector('#areaForConfigEditing').style.display='block',t.configEditor=G('innerConfigEditorArea',JSON.stringify(n.config,null,2),600,350,'json')}function a(){n.config=JSON.parse(t.configEditor.getValue()),j(),e.onchange&&e.onchange(e),e.preview&&B()}function d(){e.onchange&&e.onchange(e),I.querySelector('#chooseEditingStyle').style.display='none',I.querySelector('#areaForGuidedEditing').style.display='block',e.show_ccm_fields&&(I.querySelector('#ccmDefaulConfigArea').style.display='block',m()),u(''),n.hasOwnProperty('meta')&&n.meta.hasOwnProperty('config')&&p('')}function m(){I.querySelector('#guided_nameOfNewComponent').value=n.name+'-new',I.querySelector('#guided_ccmURL').value='object'==typeof n.ccm?n.ccm.url:n.ccm}function u(e){let t;for(let i in t=''===e?n.config:O(n.config,e),t){let o;switch(o=''===e?'':e+'.',typeof t[i]){case'string':_(o+i,t[i]);break;case'number':w(o+i,t[i]);break;case'boolean':S(o+i,t[i]);break;case'object':Array.isArray(t[i])?(t[i][0]+'').startsWith('ccm.')?y(o+i,t[i]):x(o+i,t[i]):null===t[i]?v(o+i,t[i]):'html'==i||'templates'==i?f():u(o+i);break;case'function':E(o+i,t[i]);break;default:console.log('!Parsing not implemented! '+i+' -> '+t[i]+' ('+typeof n.config[i]+')');}}}function p(e){let t;for(let i in t=''===e?n.meta.config:O(n.meta.config,e),t){let o;if(o=''===e?'':e+'.','object'==typeof t[i])if(!t[i].ccm_doc_type)p(o+i);else if(void 0===O(n.config,o+i))switch(g(o,n.config),t[i].ccm_doc_type[0]){case'string':_(o+i,'');break;case'number':w(o+i,0);break;case'boolean':S(o+i,!0);break;case'Array<string>':T(o+i,[''],'Array<string>'),M(o+i,[''],'string');break;case'Array<number>':T(o+i,[0],'Array<number>'),M(o+i,[0],'number');break;case'Array<boolean>':T(o+i,[!0],'Array<boolean>'),M(o+i,[!0],'boolean');break;case'function':E(o+i,'function () {}');break;case'null':v(o+i,null);break;default:console.log('!Parsing (meta) not implemented! '+i+' -> '+t[i].ccm_doc_type);}}}function g(e,t){if(''!==e){e.endsWith('.')&&(e=e.slice(0,-1)),s=e.replace(/\[(\w+)\]/g,'.$1'),s=s.replace(/^\./,'');let o=s.split('.');for(let e,r=0,i=o.length;r<i;++r)e=o[r],e in t?t=t[e]:(t[e]={},t=t[e])}}function f(){I.querySelector('#htmlEditorCaption').style.display='block',n.config.html?t.htmlEditor=G('htmlEditor',JSON.stringify(n.config.html,null,2),500,300,'json'):n.config.templates?t.htmlEditor=G('htmlEditor',JSON.stringify(n.config.templates,null,2),500,300,'json'):console.log('Unsupported HTML template')}function y(e,n){const t=n[0];'ccm.load'===t?2===n.length&&'string'==typeof n[0]&&'string'==typeof n[1]?h(e,n,'ccm.load','Load'):b(e,n,t):'ccm.module'===t?2===n.length&&'string'==typeof n[0]&&'string'==typeof n[1]?h(e,n,'ccm.module','Module'):b(e,n,t):'ccm.component'===t?2===n.length&&'string'==typeof n[0]&&'string'==typeof n[1]?h(e,n,'ccm.component','Component'):b(e,n,t):'ccm.instance'===t?2===n.length&&'string'==typeof n[0]&&'string'==typeof n[1]?h(e,n,'ccm.instance','Instance'):b(e,n,t):'ccm.proxy'===t?2===n.length&&'string'==typeof n[0]&&'string'==typeof n[1]?h(e,n,'ccm.proxy','Proxy'):b(e,n,t):'ccm.store'===t?2===n.length&&'string'==typeof n[0]&&'string'==typeof n[1]?h(e,n,'ccm.store','Store'):b(e,n,t):'ccm.get'===t?2===n.length&&'string'==typeof n[0]&&'string'==typeof n[1]?h(e,n,'ccm.get','Get'):b(e,n,t):'ccm.set'===t?2===n.length&&'string'==typeof n[0]&&'string'==typeof n[1]?h(e,n,'ccm.set','Set'):b(e,n,t):'ccm.del'===t?2===n.length&&'string'==typeof n[0]&&'string'==typeof n[1]?h(e,n,'ccm.del','Del'):b(e,n,t):console.log('Parsing of the ccm datatype '+t+' not implemented!')}function b(e,n,t){T(e,n,t);const i=C(e,n);I.querySelector('#guided_componentSpecificConfiguration').appendChild(i)}function h(e,n,t,i){T(e,n,t);const o=document.createElement('span');o.innerHTML='Value: ';const r=document.createElement('input');r.className='form-control form-control-inline',r.id='guidedConfParameterCCMType'+i+'_'+e,r.setAttribute('data-configorigin','guidedConfParameterCCMType'+i+'_'+e),r.value=n[1],r.style='width: 50%';const l=document.createElement('button');l.className='btn btn-default',l.innerHTML='Advanced editor',l.onclick=function(){o.outerHTML='',r.outerHTML='',r.id=r.id.slice(5),r.setAttribute('data-configorigin',r.id.slice(5));const t=C(e,n);l.previousElementSibling.appendChild(document.createElement('br')),l.previousElementSibling.appendChild(t),l.outerHTML=''},I.querySelector('#guided_componentSpecificConfiguration').appendChild(o),I.querySelector('#guided_componentSpecificConfiguration').appendChild(r),I.querySelector('#guided_componentSpecificConfiguration').appendChild(l)}function C(e,n){const t=document.createElement('textarea');return t.className='form-control',t.id='guidedConfParameterCCMTypeAdvanced_'+e,t.setAttribute('data-configorigin','guidedConfParameterCCMTypeAdvanced_'+e),t.rows=5,t.cols=50,t.value=JSON.stringify(n,null,2),t}function E(e,n){T(e,n,'function');const i=document.createElement('div');i.id='guidedConfParameterFunction_'+e,i.setAttribute('data-configorigin','guidedConfParameterFunction_'+e),I.querySelector('#guided_componentSpecificConfiguration').appendChild(i);const o=G('guidedConfParameterFunction_'+e,n.toString(),500,300,'javascript');t.functionEditors['guidedConfParameterFunction_'+e]=o}function S(e,n){T(e,n,'boolean');const t=document.createElement('select');t.className='form-control',t.id='guidedConfParameterBoolean_'+e,t.setAttribute('data-configorigin','guidedConfParameterBoolean_'+e);const i=document.createElement('option');i.text='true',i.value='true',n&&(i.selected='selected'),t.appendChild(i);const o=document.createElement('option');o.text='false',o.value='false',n||(o.selected='selected'),t.appendChild(o),I.querySelector('#guided_componentSpecificConfiguration').appendChild(t)}function _(e,n){T(e,n,'string');const t=document.createElement('input');t.className='form-control',t.value=n,t.id='guidedConfParameterString_'+e,t.setAttribute('data-configorigin','guidedConfParameterString_'+e),I.querySelector('#guided_componentSpecificConfiguration').appendChild(t)}function v(e,n){T(e,n,'null');const t=document.createElement('input');t.className='form-control',t.value='null',t.disabled=!0,t.id='guidedConfParameterNull_'+e,t.setAttribute('data-configorigin','guidedConfParameterNull_'+e),I.querySelector('#guided_componentSpecificConfiguration').appendChild(t)}function w(e,n){T(e,n,'number');const t=document.createElement('input');t.className='form-control',t.value=n,t.id='guidedConfParameterNumber_'+e,t.setAttribute('data-configorigin','guidedConfParameterNumber_'+e),t.type='number',I.querySelector('#guided_componentSpecificConfiguration').appendChild(t)}function x(e,n){const t=L(n);switch(t){case'string':T(e,n,'Array<string>'),M(e,n,'string');break;case'object':for(let t=0;t<n.length;t++)u(e+`[${t}]`);break;case'number':T(e,n,'Array<number>'),M(e,n,'number');break;case'boolean':T(e,n,'Array<boolean>'),M(e,n,'boolean');break;case'undefined':k(e,n);break;default:console.log('Array editor for '+t+' not yet implemented.');}}function k(e,n){T(e,n,'Array');const i=document.createElement('div');i.id='guidedConfParameterArrayMultipleTypes_'+e,i.setAttribute('data-configorigin','guidedConfParameterArrayMultipleTypes_'+e),I.querySelector('#guided_componentSpecificConfiguration').appendChild(i),t.arrayMultipleTypesEditors['guidedConfParameterArrayMultipleTypes_'+e]=G('guidedConfParameterArrayMultipleTypes_'+e,JSON.stringify(n,null,2),500,300,'json')}function L(e){const n=e.length;let t='undefined';const i={string:0,number:0,boolean:0,object:0};return e.forEach(function(e){switch(typeof e){case'string':i.string++;break;case'number':i.number++;break;case'boolean':i.boolean++;break;case'object':i.object++;break;default:}}),i.string===n?t='string':i.number===n?t='number':i.boolean===n?t='boolean':i.object===n&&(t='object'),t}function M(e,n,t){const i=document.createElement('div');'string'===t?(i.id='GuidedArrayStringList_'+e,i.setAttribute('data-configorigin','GuidedArrayStringList_'+e)):'number'===t?(i.id='GuidedArrayNumberList_'+e,i.setAttribute('data-configorigin','GuidedArrayNumberList_'+e)):'boolean'===t&&(i.id='GuidedArrayBooleanList_'+e,i.setAttribute('data-configorigin','GuidedArrayBooleanList_'+e)),n.forEach(function(e){let n=null;if('string'===t)n=document.createElement('input'),n.value=e;else if('number'===t)n=document.createElement('input'),n.value=e,n.type='number';else if('boolean'===t){n=document.createElement('select');const t=document.createElement('option');t.text='true',t.value='true',e&&(t.selected='selected'),n.appendChild(t);const i=document.createElement('option');i.text='false',i.value='false',e||(i.selected='selected'),n.appendChild(i)}n.className='form-control form-control-inline';const o=document.createElement('button');o.className='btn btn-default',o.innerHTML='X',o.onclick=function(){this.nextElementSibling.nextElementSibling.outerHTML='',this.nextElementSibling.outerHTML='',this.previousElementSibling.outerHTML='',this.outerHTML=''};const r=document.createElement('button');r.className='btn btn-default',r.innerHTML='+',r.onclick=function(){let e=null;if('string'===t)e=document.createElement('input'),e.value='';else if('number'===t)e=document.createElement('input'),e.value='',e.type='number';else if('boolean'===t){e=document.createElement('select');const n=document.createElement('option');n.text='true',n.value='true',e.appendChild(n);const t=document.createElement('option');t.text='false',t.value='false',e.appendChild(t)}e.className='form-control form-control-inline';const n=document.createElement('button');n.className='btn btn-default',n.innerHTML='X',n.onclick=function(){this.nextElementSibling.nextElementSibling.outerHTML='',this.nextElementSibling.outerHTML='',this.previousElementSibling.outerHTML='',this.outerHTML=''};const i=document.createElement('br');this.parentNode.insertBefore(i,this.nextSibling);const o=document.createElement('button');o.className='btn btn-default',o.innerHTML='+',o.onclick=r.onclick,this.parentNode.insertBefore(o,this.nextSibling),this.parentNode.insertBefore(n,this.nextSibling),this.parentNode.insertBefore(e,this.nextSibling),this.parentNode.insertBefore(i,this.nextSibling)};const l=document.createElement('br');i.appendChild(n),i.appendChild(o),i.appendChild(r),i.appendChild(l)});const o=document.createElement('button');o.className='btn btn-default',o.innerHTML='+',o.onclick=function(){let e=null;if('string'===t)e=document.createElement('input'),e.value='';else if('number'===t)e=document.createElement('input'),e.value='',e.type='number';else if('boolean'===t){e=document.createElement('select');const n=document.createElement('option');n.text='true',n.value='true',e.appendChild(n);const t=document.createElement('option');t.text='false',t.value='false',e.appendChild(t)}e.className='form-control form-control-inline';const n=document.createElement('button');n.className='btn btn-default',n.innerHTML='X',n.onclick=function(){this.nextElementSibling.nextElementSibling.outerHTML='',this.nextElementSibling.outerHTML='',this.previousElementSibling.outerHTML='',this.outerHTML=''};const i=document.createElement('button');i.className='btn btn-default',i.innerHTML='+',i.onclick=function(){let e=null;if('string'===t)e=document.createElement('input'),e.value='';else if('number'===t)e=document.createElement('input'),e.value='',e.type='number';else if('boolean'===t){e=document.createElement('select');const n=document.createElement('option');n.text='true',n.value='true',e.appendChild(n);const t=document.createElement('option');t.text='false',t.value='false',e.appendChild(t)}e.className='form-control form-control-inline';const n=document.createElement('button');n.className='btn btn-default',n.innerHTML='X',n.onclick=function(){this.nextElementSibling.nextElementSibling.outerHTML='',this.nextElementSibling.outerHTML='',this.previousElementSibling.outerHTML='',this.outerHTML=''};const o=document.createElement('br');this.parentNode.insertBefore(o,this.nextSibling);const r=document.createElement('button');r.className='btn btn-default',r.innerHTML='+',r.onclick=i.onclick,this.parentNode.insertBefore(r,this.nextSibling),this.parentNode.insertBefore(n,this.nextSibling),this.parentNode.insertBefore(e,this.nextSibling),this.parentNode.insertBefore(o,this.nextSibling)};const o=document.createElement('br');this.nextElementSibling.insertBefore(o,this.nextElementSibling.childNodes[0]),this.nextElementSibling.insertBefore(i,this.nextElementSibling.childNodes[0]),this.nextElementSibling.insertBefore(n,this.nextElementSibling.childNodes[0]),this.nextElementSibling.insertBefore(e,this.nextElementSibling.childNodes[0])};const r=document.createElement('button');r.className='btn btn-default',r.innerHTML='+',r.onclick=function(){let e=null;if('string'===t)e=document.createElement('input'),e.value='';else if('number'===t)e=document.createElement('input'),e.value='',e.type='number';else if('boolean'===t){e=document.createElement('select');const n=document.createElement('option');n.text='true',n.value='true',e.appendChild(n);const t=document.createElement('option');t.text='false',t.value='false',e.appendChild(t)}e.className='form-control form-control-inline';const n=document.createElement('button');n.className='btn btn-default',n.innerHTML='X',n.onclick=function(){this.nextElementSibling.nextElementSibling.outerHTML='',this.nextElementSibling.outerHTML='',this.previousElementSibling.outerHTML='',this.outerHTML=''};const i=document.createElement('button');i.className='btn btn-default',i.innerHTML='+',i.onclick=function(){let e=null;if('string'===t)e=document.createElement('input'),e.value='';else if('number'===t)e=document.createElement('input'),e.value='',e.type='number';else if('boolean'===t){e=document.createElement('select');const n=document.createElement('option');n.text='true',n.value='true',e.appendChild(n);const t=document.createElement('option');t.text='false',t.value='false',e.appendChild(t)}e.className='form-control form-control-inline';const n=document.createElement('button');n.className='btn btn-default',n.innerHTML='X',n.onclick=function(){this.nextElementSibling.nextElementSibling.outerHTML='',this.nextElementSibling.outerHTML='',this.previousElementSibling.outerHTML='',this.outerHTML=''};const o=document.createElement('br');this.parentNode.insertBefore(o,this.nextSibling);const r=document.createElement('button');r.className='btn btn-default',r.innerHTML='+',r.onclick=i.onclick,this.parentNode.insertBefore(r,this.nextSibling),this.parentNode.insertBefore(n,this.nextSibling),this.parentNode.insertBefore(e,this.nextSibling),this.parentNode.insertBefore(o,this.nextSibling)};const o=document.createElement('br');this.previousElementSibling.appendChild(e),this.previousElementSibling.appendChild(n),this.previousElementSibling.appendChild(i),this.previousElementSibling.appendChild(o)},I.querySelector('#guided_componentSpecificConfiguration').appendChild(o),I.querySelector('#guided_componentSpecificConfiguration').appendChild(i),I.querySelector('#guided_componentSpecificConfiguration').appendChild(r)}function T(e,n,t){const i=document.createElement('div');i.innerHTML=e+':';const o=document.createElement('button');o.className='btn btn-default btn-circle',o.innerHTML='?',o.onclick=function(){if(!(this.nextElementSibling&&'BR'!==this.nextSibling.nodeName)){const o=document.createElement('div');o.className='bs-callout bs-callout-primary',o.style.width='500px',o.innerHTML=H(e,n,t),i.insertBefore(o,i.children[1])}},i.appendChild(o),I.querySelector('#guided_componentSpecificConfiguration').appendChild(i)}function N(){if(!this.nextElementSibling){const e=document.createElement('div');e.className='bs-callout bs-callout-primary',e.style.width='500px',e.innerHTML=`<a href="https://github.com/akless/ccm/tree/master/version">Available ccm versions</a><br>
                                  Files seen there can be accessed via the following URL-Schema:<br>
                                  https://akless.github.io/ccm/version/&lt;Filename&gt;`,I.querySelector('#ccmUrlEditor').appendChild(e)}}function A(){if(!this.nextElementSibling){const e=document.createElement('div');e.className='bs-callout bs-callout-primary',e.style.width='500px',e.innerHTML=n.hasOwnProperty('meta')&&n.meta.hasOwnProperty('config')&&(n.meta.config.hasOwnProperty('html')||n.meta.config.hasOwnProperty('templates'))?n.meta.config.hasOwnProperty('html')?q(n.meta.config.html.ccm_doc_type,n.meta.config.html.ccm_doc_desc,n.meta.config.html.ccm_doc_examples):q(n.meta.config.templates.ccm_doc_type,n.meta.config.templates.ccm_doc_desc,n.meta.config.templates.ccm_doc_examples):`HTML template in form of a JSON object.`,I.querySelector('#htmlEditorCaption').appendChild(e)}}function H(e,t,i){let o='';if(n.hasOwnProperty('meta')&&n.meta.hasOwnProperty('config')){let t=O(n.meta.config,e);if(t)return o=q(t.ccm_doc_type,t.ccm_doc_desc,t.ccm_doc_examples),o;for(;-1<e.indexOf('.');)if(e=e.substr(0,e.lastIndexOf('.')),t=O(n.meta.config,e),t)return o=q(t.ccm_doc_type,t.ccm_doc_desc,t.ccm_doc_examples),o}let r='';switch(i){case'string':r='In this field any form of text can be typed in.';break;case'number':r='In this field any number can be typed in.';break;case'boolean':r='With the drop-down-menu either <em>true</em> or <em>false</em> can be selected.';break;case'ccm.load':r='<a href="https://github.com/akless/ccm/wiki/Loading-of-Resources">Wiki</a>';break;case'Array<boolean>':r='With the X buttons elements can be deleted. With the + buttons new Elements can be added.<br>Inside the field either <em>true</em> or <em>false</em> can be selected with the drop-down-menus.';break;case'Array<number>':r='With the X buttons elements can be deleted. With the + buttons new Elements can be added.<br>Inside the fields any number can be typed in.';break;case'Array<string>':r='With the X buttons elements can be deleted. With the + buttons new Elements can be added.<br>Inside the fields any form of text can be typed in.';break;case'Array':r='In this array multiple data types can be mixed.';break;case'function':r='The code of the function can be edited.';break;case'null':r='This value can not be changed.';break;default:return o='No help available.',o;}return o=`
                  !The component has not documented this field. The following are general indications for the current type of data in this field. Please orientate yourself by the current value of the field.!<br>
                  <b><u>Data type:</u></b> <code>${i}</code><br>
                  <b><u>Description:</u></b> ${r}`,o}function q(e,n,t){let i='';return t&&t.forEach((e)=>{Object.keys(e).forEach((n)=>{i+=`<i>${R(n)}: </i> ${R(e[n])} <br>`})}),`
              <b><u>Data type(s):</u></b> <code>${R(e.join(', '))}</code><br>
              <b><u>Description:</u></b> ${R(n)}<br>
              <b><u>Examples:</u></b><br>
              ${i}
            `}function P(){e.show_ccm_fields&&(n.name=I.querySelector('#guided_nameOfNewComponent').value,'object'==typeof n.ccm?(n.ccm.url=I.querySelector('#guided_ccmURL').value,delete n.ccm.integrity):n.ccm=I.querySelector('#guided_ccmURL').value),n.config.html?n.config.html=JSON.parse(t.htmlEditor.getValue()):n.config.templates&&(n.config.templates=JSON.parse(t.htmlEditor.getValue()));const o=I.querySelectorAll('input');for(let e=0;e<o.length;e++){if(o[e].id.startsWith('guidedConfParameterString_')){const n=o[e].id.slice(26);D(n,o[e].value)}if(o[e].id.startsWith('guidedConfParameterNull_')){const n=o[e].id.slice(24);D(n,null)}if(o[e].id.startsWith('guidedConfParameterNumber_')){const n=o[e].id.slice(26);D(n,parseFloat(o[e].value))}if(o[e].id.startsWith('guidedConfParameterCCMTypeLoad_')){const n=o[e].id.slice(31);D(n,['ccm.load',o[e].value])}if(o[e].id.startsWith('guidedConfParameterCCMTypeComponent_')){const n=o[e].id.slice(36);D(n,['ccm.component',o[e].value])}if(o[e].id.startsWith('guidedConfParameterCCMTypeModule_')){const n=o[e].id.slice(33);D(n,['ccm.module',o[e].value])}if(o[e].id.startsWith('guidedConfParameterCCMTypeInstance_')){const n=o[e].id.slice(35);D(n,['ccm.instance',o[e].value])}if(o[e].id.startsWith('guidedConfParameterCCMTypeProxy_')){const n=o[e].id.slice(32);D(n,['ccm.proxy',o[e].value])}if(o[e].id.startsWith('guidedConfParameterCCMTypeStore_')){const n=o[e].id.slice(32);D(n,['ccm.store',o[e].value])}if(o[e].id.startsWith('guidedConfParameterCCMTypeGet_')){const n=o[e].id.slice(30);D(n,['ccm.get',o[e].value])}if(o[e].id.startsWith('guidedConfParameterCCMTypeSet_')){const n=o[e].id.slice(30);D(n,['ccm.set',o[e].value])}if(o[e].id.startsWith('guidedConfParameterCCMTypeDel_')){const n=o[e].id.slice(30);D(n,['ccm.del',o[e].value])}}const r=I.querySelectorAll('select');for(let e=0;e<r.length;e++)if(r[e].id.startsWith('guidedConfParameterBoolean_')){const n=r[e].id.slice(27);D(n,'true'===r[e].value)}const l=I.querySelectorAll('textarea');for(let e=0;e<l.length;e++)if(l[e].id.startsWith('guidedConfParameterCCMTypeAdvanced_')){const n=l[e].id.slice(35);D(n,JSON.parse(l[e].value))}const c=I.querySelectorAll('div');for(let e=0;e<c.length;e++)if(c[e].id.startsWith('GuidedArrayStringList_')){const n=c[e].id.slice(22);let t=[];const i=c[e].children;for(let e=0;e<i.length;e++)'INPUT'===i[e].nodeName&&t.push(i[e].value);D(n,t)}else if(c[e].id.startsWith('GuidedArrayNumberList_')){const n=c[e].id.slice(22);let t=[];const i=c[e].children;for(let e=0;e<i.length;e++)'INPUT'===i[e].nodeName&&t.push(parseFloat(i[e].value));D(n,t)}else if(c[e].id.startsWith('GuidedArrayBooleanList_')){const n=c[e].id.slice(23);let t=[];const i=c[e].children;for(let e=0;e<i.length;e++)'SELECT'===i[e].nodeName&&t.push('true'===i[e].value);D(n,t)}else if(c[e].id.startsWith('guidedConfParameterFunction_')){const n=c[e].id.slice(28),i=t.functionEditors[c[e].id].getValue();D(n,eval('('+i+')'))}else if(c[e].id.startsWith('guidedConfParameterArrayMultipleTypes_')){const n=c[e].id.slice(38),i=t.arrayMultipleTypesEditors[c[e].id].getValue();D(n,JSON.parse(i))}j(),e.onchange&&e.onchange(e),e.preview&&B()}function j(){e.display_final_component_and_config&&(I.querySelector('#newComponentDisplayLabel').style.display='block',I.querySelector('#newComponentDisplay').style.display='block',I.querySelector('#newComponentConfigDisplayLabel').style.display='block',I.querySelector('#newComponentConfigDisplay').style.display='block',I.querySelector('#downloadNewComponentButton').style.display='block',I.querySelector('#newComponentDisplay').value=F(n),I.querySelector('#newComponentConfigDisplay').value=W(JSONfn.stringify(n.config)))}function F(e){const n=W(JSONfn.stringify(e));return'{\n\n  var component = '+n+';\n\n  function p(){window.ccm[v].component(component)}var f="ccm."+component.name+(component.version?"-"+component.version.join("."):"")+".js";if(window.ccm&&null===window.ccm.files[f])window.ccm.files[f]=component;else{var n=window.ccm&&window.ccm.components[component.name];n&&n.ccm&&(component.ccm=n.ccm),"string"==typeof component.ccm&&(component.ccm={url:component.ccm});var v=component.ccm.url.split("/").pop().split("-");if(v.length>1?(v=v[1].split("."),v.pop(),"min"===v[v.length-1]&&v.pop(),v=v.join(".")):v="latest",window.ccm&&window.ccm[v])p();else{var e=document.createElement("script");document.head.appendChild(e),component.ccm.integrity&&e.setAttribute("integrity",component.ccm.integrity),component.ccm.crossorigin&&e.setAttribute("crossorigin",component.ccm.crossorigin),e.onload=function(){p(),document.head.removeChild(e)},e.src=component.ccm.url}}\n}'}function W(e){return e.replace(/(.*?)\\n/g,function(e,n){return n.endsWith('\\')?e:e.replace(/\\n/g,'\r\n')}).replace(/function([^]*)}"/g,'function$1}').replace(/"function([^]*)}"/g,'function$1}').replace(/"function/g,'function').replace(/\\\\\//g,'\\/').replace(/\\"/g,'"')}function B(){I.querySelector('#demoWrapper').style.display='block',ccm.start(e.ccm.helper.clone(n),e.ccm.helper.clone(n.config),function(e){ccm.helper.setContent(I.querySelector('#demoArea'),e.root)})}function U(){const e=new Blob([F(n)],{type:'text/plain'}),t=document.createElement('a');t.href=URL.createObjectURL(e),t.download='ccm.'+n.name+'.js',t.style.display='none',document.body.appendChild(t),t.click(),document.body.removeChild(t)}function G(n,t,i,o,r){if(e.use_ace_for_editing){const e=document.createElement('juicy-ace-editor');e.id=n+'attachedEditor',e.setAttribute('data-configorigin',n+'attachedEditor'),e.style.width=i+'px',e.style.height=o+'px',I.querySelector('[data-configorigin="'+n+'"]').appendChild(e);const l=I.querySelector('[data-configorigin="'+n+'attachedEditor"]').editor;return l.setTheme('ace/theme/tomorrow'),l.getSession().setMode('ace/mode/'+r),l.getSession().setTabSize(2),l.getSession().setUseWrapMode(!0),l.$blockScrolling=Infinity,l.setValue(t,1),l}else{const e=document.createElement('textarea');e.className='form-control',e.id=n+'attachedEditor',e.setAttribute('data-configorigin',n+'attachedEditor'),e.style.width=i+'px',e.style.height=o+'px',e.value=t,I.querySelector('[data-configorigin="'+n+'"]').appendChild(e);return{getValue:function(){return e.value}}}}function O(e,n){n=n.replace(/\[(\w+)\]/g,'.$1'),n=n.replace(/^\./,'');let t=n.split('.');for(let o,r=0,i=t.length;r<i;++r)if(o=t[r],o in e)e=e[o];else return;return e}function D(e,t){let o=n.config,r=e.split('.'),l=r.length;for(let n,c=0;c<l-1;c++)n=r[c],o=O(o,n);o[r[l-1]]=t}function R(e){return e.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;')}if(-1<navigator.userAgent.toLowerCase().indexOf('firefox')&&(e.use_ace_for_editing=!1),e.use_ace_for_editing)if('registerElement'in document&&'import'in document.createElement('link')&&'content'in document.createElement('template'));else{const n=document.createElement('script');n.src='https://leoneck.github.io/ccm-factory/js/webcomponents-lite.js',document.body.appendChild(n)}if(e.use_ace_for_editing){const e=document.createElement('link');e.rel='import',e.href='https://leoneck.github.io/ccm-factory/js/juicy-ace-editor.html',document.head.appendChild(e)}e.no_bootstrap_container&&(this.html.main.class='');const I=this.ccm.helper.html(this.html.main,{loadComponentClick:o,configEditorChosenClick:l,guidedEditingChosenClick:d,generateFromEditorClick:a,showHelpForCCMURL:N,showHelpForHTML:A,generateFromGuidedClick:P,downloadNewComponentClick:U});this.element.appendChild(I),''===e.url_to_modify?I.querySelector('#componentSelector').style.display='block':o(),i&&i()},this.getValue=()=>this.ccm.helper.clone(n.config)}},f='ccm.'+component.name+(component.version?'-'+component.version.join('.'):'')+'.js';if(window.ccm&&null===window.ccm.files[f])window.ccm.files[f]=component;else{var n=window.ccm&&window.ccm.components[component.name];n&&n.ccm&&(component.ccm=n.ccm),'string'==typeof component.ccm&&(component.ccm={url:component.ccm});var v=component.ccm.url.split('/').pop().split('-');if(1<v.length?(v=v[1].split('.'),v.pop(),'min'===v[v.length-1]&&v.pop(),v=v.join('.')):v='latest',window.ccm&&window.ccm[v])t();else{var e=document.createElement('script');document.head.appendChild(e),component.ccm.integrity&&e.setAttribute('integrity',component.ccm.integrity),component.ccm.crossorigin&&e.setAttribute('crossorigin',component.ccm.crossorigin),e.onload=function(){t(),document.head.removeChild(e)},e.src=component.ccm.url}}}