text: // System Designer - Copyright 2021 Erwan Carriou
  // Licensed under the Apache License, Version 2.0 (the "License")
  runtime.install({"name":"editor-component","master":true,"version":"1.0.0","description":"","schemas":{"104ad1f48518376":{"_id":"104ad1f48518376","_name":"_Channel","_inherit":["_Component"],"$editorUpdateSystem":"event","$editorUpdateSchema":"event","$editorUpdateSchemaId":"event","$editorUpdateSchemaName":"event","$editorUpdateModel":"event","$editorUpdateModelId":"event","$editorUpdateType":"event","$editorDeleteType":"event","$editorUpdateBehavior":"event","$editorDeleteBehavior":"event","$editorUpdateComponent":"event","$editorUpdateComponentId":"event","$editorDeleteComponent":"event","$appLogDebug":"event","$appLogInfo":"event","$appLogWarn":"event","$appLogError":"event","$appLoadSystem":"event","$designerSync":"event","$designerCreateBehavior":"event","$designerCreateComponent":"event","$designerCreateType":"event","$designerCreateSchema":"event","$designerCreateModel":"event","$designerDeleteSchema":"event","$designerDeleteModel":"event","$designerDeleteType":"event","$designerDeleteBehavior":"event","$designerDeleteComponent":"event","$designerUpdateComponent":"event","$designerUpdateModel":"event","$designerUpdateBehavior":"event","send":"event","$runtimeCreateComponent":"event","$runtimeDeleteComponent":"event","$runtimeUpdateComponent":"event"},"h1544a15cd115619":{"_name":"CSS","source":"property","_id":"h1544a15cd115619"},"o1ead8184af1a83e":{"_name":"Designer","_inherit":["_Component"],"version":"property","runWindow":"property","debugWindow":"property","linkModel":"method","save":"method","saveCordova":"method","saveAs":"method","welcome":"method","open":"method","render":"event","isCordova":"method","isElectron":"method","isMac":"method","updateCordovaContext":"method","runMessages":"method","installExtensions":"method","addShorcuts":"method","_id":"o1ead8184af1a83e","addShortcuts":"method"},"v123b51abbb18712":{"_id":"v123b51abbb18712","_name":"Diagram","_inherit":["_Component"],"data":"property","ref":"property","zoom":"property","render":"method"},"n1a57f14f7e1d5fe":{"_name":"Dialog","_inherit":["_Component"],"title":"property","message":"property","data":"property","html":"link","ok":"event","cancel":"event","show":"method","hide":"method","_id":"n1a57f14f7e1d5fe"},"r1ddda1abc81d3ae":{"_name":"DialogCopyright","_inherit":["Dialog"],"_id":"r1ddda1abc81d3ae"},"j1dd971e4e417dc0":{"_name":"DialogBehaviorCreation","_inherit":["Dialog"],"_id":"j1dd971e4e417dc0"},"z1cebc15af210ffd":{"_name":"DialogComponentCreation","_inherit":["Dialog"],"_id":"z1cebc15af210ffd"},"y18a2615cad1374d":{"_name":"DialogConfig","_inherit":["Dialog"],"_id":"y18a2615cad1374d"},"w1b40b10be812656":{"_name":"DialogDropFile","_inherit":["Dialog"],"_id":"w1b40b10be812656"},"w143aa1a8401eb92":{"_name":"DialogExport","_inherit":["Dialog"],"_id":"w143aa1a8401eb92"},"n1c79a1da261e02e":{"_name":"DialogImport","_inherit":["Dialog"],"_id":"n1c79a1da261e02e"},"c1758d13d20146d4":{"_name":"DialogImportFile","_inherit":["Dialog"],"mergeSystem":"event","importSystem":"event","_id":"c1758d13d20146d4"},"t13c8d1b4271338c":{"_name":"DialogModelCreation","_inherit":["Dialog"],"_id":"t13c8d1b4271338c"},"z19abb1de8815574":{"_name":"DialogComponentInfo","_inherit":["Dialog"],"_id":"z19abb1de8815574"},"b1cad1118451b9d7":{"_name":"DialogSchemaCreation","_inherit":["Dialog"],"_id":"b1cad1118451b9d7"},"e1c0cd11f9210181":{"_name":"DialogSearch","_inherit":["Dialog"],"filter":"property","currentSelection":"property","nbResult":"property","_id":"e1c0cd11f9210181"},"v112c0137f31f448":{"_name":"DialogShare","_inherit":["Dialog"],"_id":"v112c0137f31f448"},"j1a5781d076127b4":{"_name":"DialogSync","_inherit":["Dialog"],"_id":"j1a5781d076127b4"},"y1cc6f1fdc415f97":{"_name":"DialogSystemCreation","_inherit":["Dialog"],"_id":"y1cc6f1fdc415f97"},"z15c55119a7160f3":{"_name":"DialogTypeCreation","_inherit":["Dialog"],"_id":"z15c55119a7160f3"},"g1db25176311401d":{"_name":"DialogWelcome","_inherit":["Dialog"],"_id":"g1db25176311401d"},"m1b56110321128fb":{"_id":"m1b56110321128fb","_name":"DialogExtension","_inherit":["Dialog"],"add":"method","remove":"method"},"e1d0301185e17e58":{"_id":"e1d0301185e17e58","_name":"DialogCommand","_inherit":["Dialog"],"filter":"property","currentSelection":"property","nbResult":"property"},"k16ab6191c412fea":{"_id":"k16ab6191c412fea","_name":"DialogDelete","_inherit":["Dialog"]},"b1a8ae1c3f113625":{"_id":"b1a8ae1c3f113625","_name":"DialogDropDiagram","_inherit":["Dialog"]},"f1d18452-66e4-4d67-a370-c83dd9437d83":{"_id":"f1d18452-66e4-4d67-a370-c83dd9437d83","_name":"DialogInstallPWA","_inherit":["Dialog"],"deferredPrompt":"property"},"1a3811dc79129d0":{"_id":"1a3811dc79129d0","_name":"Editor","_inherit":["_Component"],"editor":"property","type":"property","context":"property","render":"method","initValue":"method","getValue":"method","setValue":"method","setEditor":"method","undo":"method","redo":"method","selectAll":"method","copy":"method","paste":"method"},"v1dfff1f04618899":{"_id":"v1dfff1f04618899","_name":"Export","_inherit":["_Component"],"toJSON":"method","toHTML":"method","toJavaScript":"method","toNode":"method","toGraphviz":"method"},"x15866118f7110a3":{"_id":"x15866118f7110a3","_name":"Extension","_inherit":["_Component"],"source":"property","isCore":"property","installed":"property"},"13bdf1ff1815d7c":{"_id":"13bdf1ff1815d7c","_name":"Github","_inherit":["_Component"],"refresh":"method","push":"method","merge":"method"},"p181111d5c01f97b":{"_name":"HTML","source":"property","_id":"p181111d5c01f97b","_inherit":["_Component"],"render":"method","getHTML":"method"},"a77b5281-cd56-477a-8201-c2ffdfe14317":{"_id":"a77b5281-cd56-477a-8201-c2ffdfe14317","_name":"Strings","_inherit":["_Component"],"help_systems":"property","help_schemas":"property","help_models":"property","help_types":"property","help_behaviors":"property","help_components":"property","help_logs":"property"},"c452eff3-f0f1-4dd5-ad8d-b5a3ec521352":{"_id":"c452eff3-f0f1-4dd5-ad8d-b5a3ec521352","_name":"Internationalization","_inherit":["_Component"],"get":"method","locale":"property"},"w10edc1dd24108d1":{"_name":"JS","source":"property","_id":"w10edc1dd24108d1","_inherit":["_Component"]},"r1bacb1740a1fc45":{"_name":"JSON","source":"property","_id":"r1bacb1740a1fc45","_inherit":["_Component"],"platform":"property"},"g1f6ce17a5713f1d":{"_id":"g1f6ce17a5713f1d","_name":"Language","_inherit":["_Component"],"target":"property","createBehaviorBody":"method","createBehavior":"method","createDestroyBehavior":"method","createStartBehavior":"method","createMergeComment":"method","createBehaviorHeader":"method","createBehaviorParameters":"method","createBehaviorParametersEvent":"method","createBehaviorParametersEventArray":"method"},"v1f156196ff13c17":{"_name":"Log","type":"property","log":"property","_id":"v1f156196ff13c17","_inherit":["_Component"]},"p1f6f51d9f111925":{"_name":"MenuAction","html":"link","position":"property","type":"property","hide":"method","show":"method","render":"method","click":"event","_id":"p1f6f51d9f111925","_inherit":["_Component"]},"a1097d1ea0812005":{"_name":"MenuBar","logo":"property","header":"property","items":"collection","actions":"collection","render":"method","clear":"method","_id":"a1097d1ea0812005","_inherit":["_Component"]},"t14a79156a81862a":{"_name":"MenuHeader","html":"link","type":"property","hide":"method","show":"method","render":"method","_id":"t14a79156a81862a","_inherit":["_Component"]},"l1d113198721599d":{"_name":"MenuItem","html":"link","position":"property","type":"property","name":"property","platform":"property","render":"method","click":"event","_id":"l1d113198721599d","_inherit":["_Component"]},"h1d5181d0f31d7fc":{"_name":"MenuLogo","html":"link","hide":"method","show":"method","render":"method","_id":"h1d5181d0f31d7fc","_inherit":["_Component"]},"t198c41630f1d37e":{"_name":"Message","success":"method","info":"method","warning":"method","danger":"method","clean":"method","_id":"t198c41630f1d37e","_inherit":["_Component"]},"f199ca1d9b01cdcf":{"_name":"ModelBehavior","uuid":"property","title":"property","content":"property","document":"property","render":"method","hide":"method","show":"method","_id":"f199ca1d9b01cdcf","_inherit":["_Component"]},"o1d37f1e7c511205":{"_name":"ModelClass","title":"property","uuid":"property","content":"property","document":"property","editable":"property","render":"method","hide":"method","show":"method","_id":"o1d37f1e7c511205","_inherit":["_Component"]},"s10e57101f91fe18":{"_name":"ModelComponent","title":"property","uuid":"property","model":"property","document":"property","content":"property","render":"method","hide":"method","show":"method","_id":"s10e57101f91fe18","_inherit":["_Component"]},"l15c261708e1fa7f":{"_name":"ModelLog","title":"property","uuid":"property","content":"property","document":"property","render":"method","hide":"method","show":"method","_id":"l15c261708e1fa7f","_inherit":["_Component"]},"b19a2a1904c1521c":{"_name":"ModelSchema","title":"property","uuid":"property","content":"property","document":"property","editable":"property","render":"method","hide":"method","show":"method","_id":"b19a2a1904c1521c","_inherit":["_Component"]},"v12a9113d7e19b21":{"_name":"ModelSystem","title":"property","uuid":"property","content":"property","document":"property","render":"method","hide":"method","show":"method","_id":"v12a9113d7e19b21","_inherit":["_Component"]},"h162301b2eb1e8f8":{"_name":"ModelType","title":"property","uuid":"property","content":"property","document":"property","render":"method","hide":"method","show":"method","_id":"h162301b2eb1e8f8","_inherit":["_Component"]},"z1e592183e81ce64":{"_id":"z1e592183e81ce64","_name":"Router","_inherit":["_Component"],"start":"method","update":"method"},"p14e93127f6159df":{"_name":"SpaceItem","name":"property","uuid":"property","click":"event","_id":"p14e93127f6159df","_inherit":["_Component"]},"v194541e0431ce95":{"_name":"Spaces","items":"collection","systems":"collection","components":"collection","render":"method","clear":"method","_id":"v194541e0431ce95","_inherit":["_Component"]},"y1efb3178341398a":{"_name":"State","_inherit":["_Component"],"type":"property","component":"property","lastPage":"property","messages":"property","menu":"property","previousMenu":"property","space":"property","navigation":"property","logs":"collection","_id":"y1efb3178341398a"},"b1d38a143001d960":{"_name":"Store","uuid":"property","collection":"property","data":"property","extra":"property","_id":"b1d38a143001d960","_inherit":["_Component"]},"u1aff21b1e617f34":{"_name":"System","name":"property","master":"property","version":"property","description":"property","schemas":"property","models":"property","behaviors":"property","types":"property","components":"property","_id":"u1aff21b1e617f34","_inherit":["_Component"]},"l1ea0910f981a5f3":{"_id":"l1ea0910f981a5f3","_name":"SystemFactory","_inherit":["_Component"],"system":"property","syncModel":"method","syncBehavior":"method","syncComponent":"method","createModel":"method","createBehavior":"method","deleteSchema":"method","generateId":"method","getGeneratedSchema":"method","getGeneratedModel":"method","getParents":"method","mergeBehavior":"method","mergeSystem":"method","updateBehavior":"method","updateComponent":"method","updateComponentId":"method","deleteComponent":"method","createComponent":"method","updateSystem":"method","overwriteComponent":"method","deleteBehavior":"method","udpdateBehavior":"method","updateModelId":"method","updateModel":"method","updateSchemaId":"method","updateSchema":"method","updateSchemaName":"method","deleteType":"method","updateType":"method","create":"method","toJSON":"method","addSchema":"method","addType":"method","addComponent":"method","addBehavior":"method","getModelPaths":"method","isModel":"method","isType":"method","getModelPathType":"method"},"f1257f17deb16097":{"_name":"ToolBar","items":"collection","render":"method","_id":"f1257f17deb16097","_inherit":["_Component"]},"t19b6b11ff31158d":{"_id":"t19b6b11ff31158d","_name":"ToolBarItem","_inherit":["_Component"],"html":"link","position":"property","type":"property","platform":"property","render":"method","click":"event"},"f1092816b571e03c":{"_name":"Workspace","create":"method","load":"method","clear":"method","render":"method","_id":"f1092816b571e03c","_inherit":["_Component"]},"f1a0b01c1fb15a8e":{"_id":"f1a0b01c1fb15a8e","_name":"MessageHelp","_inherit":["_Component"],"render":"method","remove":"method"},"12fa8181ce127a0":{"_id":"12fa8181ce127a0","_name":"_Storage","_inherit":["_Component"],"_core":true,"store":"property","get":"method","set":"method","remove":"method","clear":"method","changed":"event"}},"models":{"135c71078810af2":{"_id":"135c71078810af2","_name":"_Channel","$editorUpdateSchemaName":{"params":[{"name":"name","type":"string"},{"name":"id","type":"string"}]},"$designerSync":{},"$appLoadSystem":{"params":[{"name":"system","type":"object"}]},"$designerCreateBehavior":{"params":[{"name":"behavior","type":"object"}]},"$editorUpdateBehavior":{"params":[{"name":"id","type":"string"},{"name":"behavior","type":"object"}]},"$designerUpdateBehavior":{"params":[{"name":"id","type":"string"},{"name":"behavior","type":"object"}]},"$editorDeleteBehavior":{"params":[{"name":"id","type":"string"}]},"$designerDeleteBehavior":{"params":[{"name":"id","type":"string"}]},"$designerCreateComponent":{"params":[{"name":"collection","type":"string"},{"name":"component","type":"object"}]},"$editorUpdateComponent":{"params":[{"name":"id","type":"string"},{"name":"collection","type":"string"},{"name":"component","type":"object"}]},"$editorUpdateComponentId":{"params":[{"name":"oldId","type":"string"},{"name":"newId","type":"string"},{"name":"collection","type":"string"}]},"$designerUpdateComponent":{"params":[{"name":"id","type":"string"},{"name":"collection","type":"string"},{"name":"component","type":"object"}]},"$editorDeleteComponent":{"params":[{"name":"id","type":"string"},{"name":"collection","type":"string"}]},"$designerDeleteComponent":{"params":[{"name":"id","type":"string"},{"name":"collection","type":"string"}]},"$designerCreateType":{"params":[{"name":"id","type":"string"},{"name":"type","type":"object"}]},"$editorUpdateType":{"params":[{"name":"id","type":"string"},{"name":"type","type":"object"}]},"$editorDeleteType":{"params":[{"name":"id","type":"string"}]},"$designerCreateSchema":{"params":[{"name":"id","type":"string"},{"name":"schema","type":"object"}]},"$editorUpdateSchema":{"params":[{"name":"id","type":"string"},{"name":"schema","type":"object"}]},"$editorUpdateSchemaId":{"params":[{"name":"oldId","type":"string"},{"name":"newId","type":"string"}]},"$designerDeleteSchema":{"params":[{"name":"id","type":"string"}]},"$designerCreateModel":{"params":[{"name":"id","type":"string"},{"name":"model","type":"object"}]},"$editorUpdateModel":{"params":[{"name":"id","type":"string"},{"name":"model","type":"object"}]},"$designerUpdateModel":{"params":[{"name":"id","type":"string"},{"name":"model","type":"object"}]},"$editorUpdateModelId":{"params":[{"name":"oldId","type":"string"},{"name":"newId","type":"string"}]},"$designerDeleteModel":{"params":[{"name":"id","type":"string"}]},"$designerDeleteType":{"params":[{"name":"id","type":"string"}]},"$editorUpdateSystem":{"params":[{"name":"id","type":"string"},{"name":"system","type":"object"}]},"$appLogDebug":{"params":[{"name":"message","type":"string"}]},"$appLogInfo":{"params":[{"name":"message","type":"string"}]},"$appLogWarn":{"params":[{"name":"message","type":"string"}]},"$appLogError":{"params":[{"name":"message","type":"string"}]},"send":{"params":[{"name":"message","type":"message"}]},"$runtimeCreateComponent":{"params":[{"name":"collection","type":"string"},{"name":"component","type":"object"}]},"$runtimeDeleteComponent":{"params":[{"name":"id","type":"string"},{"name":"collection","type":"string"}]},"$runtimeUpdateComponent":{"params":[{"name":"id","type":"string"},{"name":"collection","type":"string"},{"name":"field","type":"string"},{"name":"value","type":"any"}]}},"j1933417dac11240":{"_name":"CSS","source":{"type":"css","readOnly":true,"mandatory":true,"default":""},"_id":"j1933417dac11240"},"q129be1c61b18285":{"_name":"Designer","version":{"type":"string","readOnly":false,"mandatory":false,"default":"5.0.1"},"runWindow":{"type":"object","readOnly":false,"mandatory":false,"default":null},"debugWindow":{"type":"object","readOnly":false,"mandatory":false,"default":null},"linkModel":{"params":[{"name":"source","type":"string","mandatory":false,"default":""},{"name":"target","type":"string","mandatory":false,"default":""}]},"save":{},"saveCordova":{},"welcome":{},"render":{},"open":{"params":[{"name":"url","type":"string","mandatory":false,"default":""},{"name":"target","type":"string","mandatory":false,"default":""},{"name":"isExt","type":"boolean","mandatory":false,"default":false}]},"saveAs":{"params":[{"name":"data","type":"object","mandatory":false,"default":{}},{"name":"fileName","type":"string","mandatory":false,"default":""}]},"isCordova":{"result":"boolean"},"isElectron":{"result":"boolean"},"runMessages":{"params":[{"name":"messages","type":"array","mandatory":true,"default":[]}]},"updateCordovaContext":{},"_id":"q129be1c61b18285","installExtensions":{},"isMac":{"result":"boolean"},"addShorcuts":{},"addShortcuts":{}},"b169321637f19101":{"_id":"b169321637f19101","_name":"Diagram","_description":"","ref":{"description":"","type":"any","readOnly":false,"mandatory":false,"default":""},"zoom":{"description":"","type":"number","readOnly":false,"mandatory":false,"default":1},"render":{"description":"","params":[],"result":"any"},"data":{"description":"","type":"string","readOnly":false,"mandatory":false,"default":""}},"l1d4181e4d71ade2":{"_name":"Dialog","title":{"type":"text","readOnly":true,"mandatory":true,"default":""},"message":{"type":"text","readOnly":true,"mandatory":false,"default":""},"data":{"type":"any","readOnly":false,"mandatory":false,"default":{}},"show":{},"hide":{},"cancel":{},"ok":{},"_id":"l1d4181e4d71ade2","html":{"type":"HTML","readOnly":false,"mandatory":false,"default":""}},"n14a831448a1ef6a":{"_name":"DialogCopyright","_id":"n14a831448a1ef6a"},"g1ab8111f2d1c7ce":{"_name":"DialogBehaviorCreation","_id":"g1ab8111f2d1c7ce"},"t12b5d1be8512beb":{"_name":"DialogComponentCreation","_id":"t12b5d1be8512beb"},"t15a691554c1155f":{"_name":"DialogConfig","_id":"t15a691554c1155f"},"c1b56e1fdb3174a8":{"_name":"DialogDropFile","_id":"c1b56e1fdb3174a8"},"h1fedc1441312ac4":{"_name":"DialogExport","_id":"h1fedc1441312ac4"},"t1c8ab1e8c010544":{"_name":"DialogImport","_id":"t1c8ab1e8c010544"},"w15777160d41bb38":{"_name":"DialogImportFile","mergeSystem":{},"importSystem":{},"_id":"w15777160d41bb38"},"v108dd1f00315ebe":{"_name":"DialogModelCreation","_id":"v108dd1f00315ebe"},"o19888142191439e":{"_name":"DialogComponentInfo","_id":"o19888142191439e"},"i15fee18f0e164ba":{"_name":"DialogSchemaCreation","_id":"i15fee18f0e164ba"},"u1caa614eb713967":{"_name":"DialogSearch","filter":{"type":"string","readOnly":false,"mandatory":false,"default":""},"_id":"u1caa614eb713967","currentSelection":{"type":"number","readOnly":false,"mandatory":false,"default":-1},"nbResult":{"type":"number","readOnly":false,"mandatory":false,"default":0}},"e167bf16b5c1fd5f":{"_name":"DialogShare","_id":"e167bf16b5c1fd5f"},"k105d3130531ae5c":{"_name":"DialogSync","_id":"k105d3130531ae5c"},"k19f8d10dec1beda":{"_name":"DialogSystemCreation","_id":"k19f8d10dec1beda"},"x1e7931468415710":{"_name":"DialogTypeCreation","_id":"x1e7931468415710"},"e1dd3f1e688107a8":{"_name":"DialogWelcome","_id":"e1dd3f1e688107a8"},"u147e01d928148d4":{"_id":"u147e01d928148d4","_name":"DialogExtension","add":{},"remove":{}},"p17fe617ee3189f7":{"_id":"p17fe617ee3189f7","_name":"DialogCommand","filter":{"type":"string","readOnly":false,"mandatory":false,"default":""},"currentSelection":{"type":"number","readOnly":false,"mandatory":false,"default":-1},"nbResult":{"type":"number","readOnly":false,"mandatory":false,"default":0}},"i1d79c1b51e1c166":{"_id":"i1d79c1b51e1c166","_name":"DialogDelete"},"y11f3c1fe9b1f239":{"_id":"y11f3c1fe9b1f239","_name":"DialogDropDiagram","_description":""},"d4ae5298-d26e-4fc5-8919-aa250edea85c":{"_id":"d4ae5298-d26e-4fc5-8919-aa250edea85c","_name":"DialogInstallPWA","_description":"","deferredPrompt":{"description":"","type":"any","readOnly":false,"mandatory":false,"default":""}},"17a551ea931289c":{"_id":"17a551ea931289c","_name":"Editor","editor":{"type":"editorRef","readOnly":true,"mandatory":true,"default":{}},"render":{},"getValue":{"result":"any"},"setValue":{"params":[{"name":"val","type":"any","mandatory":false,"default":""}]},"type":{"type":"editorRuntimeType","readOnly":false,"mandatory":false,"default":"ace"},"setEditor":{"params":[{"name":"mode","type":"string","mandatory":false,"default":""},{"name":"value","type":"string","mandatory":false,"default":""},{"name":"lineNumber","type":"number","mandatory":false,"default":1},{"name":"autocomplete","type":"boolean","mandatory":false,"default":false}]},"context":{"type":"editorType","readOnly":false,"mandatory":false,"default":"system"},"initValue":{"params":[{"name":"value","type":"string","mandatory":false,"default":""},{"name":"lineNumber","type":"number","mandatory":false,"default":1}]},"undo":{},"redo":{},"selectAll":{},"copy":{},"paste":{}},"v1ca291072418fa4":{"_id":"v1ca291072418fa4","_name":"Export","toJSON":{"params":[{"name":"isMaster","type":"boolean","mandatory":false,"default":true}],"result":"string"},"toHTML":{"params":[{"name":"logLevel","type":"string","mandatory":false,"default":"info"}],"result":"string"},"toNode":{"params":[{"name":"logLevel","type":"string","mandatory":false,"default":"info"}],"result":"string"},"toJavaScript":{"params":[{"name":"logLevel","type":"string","mandatory":false,"default":"info"}],"result":"string"},"toGraphviz":{"description":"","params":[{"name":"diagramType","description":"","type":"string","mandatory":false,"default":"class"}],"result":"string"}},"h19261129ee12d64":{"_id":"h19261129ee12d64","_name":"Extension","source":{"type":"json","readOnly":false,"mandatory":false,"default":{}},"installed":{"type":"boolean","readOnly":false,"mandatory":false,"default":false},"isCore":{"type":"boolean","readOnly":false,"mandatory":false,"default":true}},"1c23c1ed49186e9":{"_id":"1c23c1ed49186e9","_name":"Github","refresh":{},"push":{"params":[{"name":"comment","type":"string","mandatory":false,"default":""},{"name":"createHTML","type":"boolean","mandatory":false,"default":false},{"name":"createNode","type":"boolean","mandatory":false,"default":false},{"name":"logLevel","type":"string","mandatory":false,"default":"debug"},{"name":"createPackage","type":"boolean","mandatory":false,"default":false}]},"merge":{"params":[{"name":"sys","type":"object","mandatory":true,"default":{}}]}},"w1417e1d6d613a0d":{"_name":"HTML","source":{"type":"html","readOnly":true,"mandatory":true,"default":""},"_id":"w1417e1d6d613a0d","render":{"params":[{"name":"id","type":"any","mandatory":false,"default":null}]},"getHTML":{"description":"","params":[],"result":"string"}},"eabc29ab-77ba-4eee-ad98-68dac6797ee8":{"_id":"eabc29ab-77ba-4eee-ad98-68dac6797ee8","_name":"Strings","_description":"","help_systems":{"description":"","type":"string","readOnly":false,"mandatory":false,"default":""},"help_schemas":{"description":"","type":"string","readOnly":false,"mandatory":false,"default":""},"help_models":{"description":"","type":"string","readOnly":false,"mandatory":false,"default":""},"help_types":{"description":"","type":"string","readOnly":false,"mandatory":false,"default":""},"help_behaviors":{"description":"","type":"string","readOnly":false,"mandatory":false,"default":""},"help_components":{"description":"","type":"string","readOnly":false,"mandatory":false,"default":""},"help_logs":{"description":"","type":"string","readOnly":false,"mandatory":false,"default":""}},"ba12d3ed-d8cc-4809-9821-9a1351268fc5":{"_id":"ba12d3ed-d8cc-4809-9821-9a1351268fc5","_name":"Internationalization","_description":"","get":{"description":"","params":[{"description":"","name":"key","type":"string","mandatory":true,"default":""}],"result":"string"},"locale":{"description":"","type":"string","readOnly":false,"mandatory":false,"default":"en-US"}},"o180bb1fb96134b7":{"_name":"JS","source":{"type":"javascript","readOnly":true,"mandatory":true,"default":""},"_id":"o180bb1fb96134b7"},"v1146f14eaa15324":{"_name":"JSON","source":{"type":"json","readOnly":true,"mandatory":true,"default":{}},"_id":"v1146f14eaa15324","platform":{"type":"platform","readOnly":false,"mandatory":false,"default":"all"}},"i1bab91d926104d3":{"_id":"i1bab91d926104d3","_name":"Language","target":{"type":"language","readOnly":false,"mandatory":false,"default":"javascript"},"createBehaviorBody":{"params":[{"name":"returnedType","type":"string","mandatory":false,"default":"string"}],"result":"string"},"createBehavior":{"params":[{"name":"name","type":"string","mandatory":false,"default":""},{"name":"params","type":"string","mandatory":false,"default":""},{"name":"body","type":"string","mandatory":false,"default":""}],"result":"string"},"createDestroyBehavior":{"result":"string"},"createStartBehavior":{"result":"string"},"createMergeComment":{"params":[{"name":"systemName","type":"string","mandatory":false,"default":""}],"result":"string"},"createBehaviorHeader":{"params":[{"name":"name","type":"string","mandatory":false,"default":""},{"name":"params","type":"string","mandatory":false,"default":""}],"result":"string"},"createBehaviorParameters":{"params":[{"name":"model","type":"object","mandatory":false,"default":{}}],"result":"string"},"createBehaviorParametersEvent":{"result":"string"},"createBehaviorParametersEventArray":{"result":"string"}},"l100ba180b514a8b":{"_name":"Log","type":{"type":"string","readOnly":true,"mandatory":true,"default":"debug"},"log":{"type":"string","readOnly":true,"mandatory":true,"default":""},"_id":"l100ba180b514a8b"},"w124ac16b591df57":{"_name":"MenuAction","html":{"type":"HTML","readOnly":false,"mandatory":false,"default":""},"position":{"type":"number","readOnly":false,"mandatory":false,"default":0},"type":{"type":"editorType","readOnly":false,"mandatory":false,"default":"designer"},"hide":{},"show":{},"render":{},"_id":"w124ac16b591df57","click":{"description":"","params":[]}},"y18b1217aaa13456":{"_name":"MenuBar","logo":{"type":"MenuLogo","readOnly":false,"mandatory":false,"default":""},"header":{"type":"MenuHeader","readOnly":false,"mandatory":false,"default":""},"items":{"type":["MenuItem"],"readOnly":false,"mandatory":false,"default":[]},"actions":{"type":["MenuAction"],"readOnly":false,"mandatory":false,"default":[]},"clear":{},"render":{},"_id":"y18b1217aaa13456"},"f13ebe1ad331b263":{"_name":"MenuHeader","html":{"type":"HTML","readOnly":false,"mandatory":false,"default":""},"type":{"type":"editorType","readOnly":false,"mandatory":false,"default":"designer"},"hide":{},"show":{},"render":{},"_id":"f13ebe1ad331b263"},"u1f9a01abe31b3bf":{"_name":"MenuItem","html":{"type":"HTML","readOnly":false,"mandatory":false,"default":""},"position":{"type":"number","readOnly":false,"mandatory":false,"default":0},"name":{"type":"string","readOnly":false,"mandatory":false,"default":""},"type":{"type":"editorType","readOnly":false,"mandatory":false,"default":"designer"},"render":{},"click":{},"_id":"u1f9a01abe31b3bf","platform":{"type":"platform","readOnly":false,"mandatory":false,"default":"all"}},"p19358155261f3b0":{"_name":"MenuLogo","html":{"type":"HTML","readOnly":false,"mandatory":false,"default":""},"hide":{},"show":{},"render":{},"_id":"p19358155261f3b0"},"i17fe71fd15150c9":{"_name":"Message","success":{"params":[{"name":"message","type":"string"}]},"info":{"params":[{"name":"message","type":"string"}]},"warning":{"params":[{"name":"message","type":"string"}]},"danger":{"params":[{"name":"message","type":"string"}]},"clean":{},"_id":"i17fe71fd15150c9"},"l19cd5176761a073":{"_name":"ModelBehavior","uuid":{"type":"string","readOnly":false,"mandatory":false,"default":""},"title":{"type":"string","readOnly":false,"mandatory":false,"default":""},"content":{"type":"string","readOnly":false,"mandatory":false,"default":""},"document":{"type":"object","readOnly":false,"mandatory":false,"default":{}},"hide":{},"show":{},"render":{},"_id":"l19cd5176761a073"},"d19365156f61a519":{"_name":"ModelClass","title":{"type":"string","readOnly":false,"mandatory":false,"default":""},"uuid":{"type":"string","readOnly":false,"mandatory":false,"default":""},"content":{"type":"string","readOnly":false,"mandatory":false,"default":""},"document":{"type":"object","readOnly":false,"mandatory":false,"default":{}},"editable":{"type":"boolean","readOnly":false,"mandatory":false,"default":false},"hide":{},"show":{},"render":{},"_id":"d19365156f61a519"},"a14b6c1b21b13626":{"_name":"ModelComponent","title":{"type":"string","readOnly":false,"mandatory":false,"default":""},"uuid":{"type":"string","readOnly":false,"mandatory":false,"default":""},"model":{"type":"string","readOnly":false,"mandatory":false,"default":""},"document":{"type":"object","readOnly":false,"mandatory":false,"default":{}},"content":{"type":"string","readOnly":false,"mandatory":false,"default":""},"hide":{},"show":{},"render":{},"_id":"a14b6c1b21b13626"},"n1d0441c3c817fc9":{"_name":"ModelLog","title":{"type":"string","readOnly":false,"mandatory":false,"default":""},"uuid":{"type":"string","readOnly":false,"mandatory":false,"default":""},"content":{"type":"string","readOnly":false,"mandatory":false,"default":""},"document":{"type":"object","readOnly":false,"mandatory":false,"default":{}},"hide":{},"show":{},"render":{},"_id":"n1d0441c3c817fc9"},"e1081c193ea1fd07":{"_name":"ModelSchema","title":{"type":"string","readOnly":false,"mandatory":false,"default":""},"uuid":{"type":"string","readOnly":false,"mandatory":false,"default":""},"content":{"type":"string","readOnly":false,"mandatory":false,"default":""},"document":{"type":"object","readOnly":false,"mandatory":false,"default":{}},"editable":{"type":"boolean","readOnly":false,"mandatory":false,"default":false},"hide":{},"show":{},"render":{},"_id":"e1081c193ea1fd07"},"x1444a1ac6c10ce6":{"_name":"ModelSystem","title":{"type":"string","readOnly":false,"mandatory":false,"default":""},"uuid":{"type":"string","readOnly":false,"mandatory":false,"default":""},"content":{"type":"string","readOnly":false,"mandatory":false,"default":""},"document":{"type":"object","readOnly":false,"mandatory":false,"default":{}},"hide":{},"show":{},"render":{},"_id":"x1444a1ac6c10ce6"},"l1c1a91b69b1dc5b":{"_name":"ModelType","title":{"type":"string","readOnly":false,"mandatory":false,"default":""},"uuid":{"type":"string","readOnly":false,"mandatory":false,"default":""},"content":{"type":"string","readOnly":false,"mandatory":false,"default":""},"document":{"type":"object","readOnly":false,"mandatory":false,"default":{}},"hide":{},"show":{},"render":{},"_id":"l1c1a91b69b1dc5b"},"c1b00612faf188cf":{"_id":"c1b00612faf188cf","_name":"Router","start":{},"update":{}},"p1d9251b9e619c48":{"_name":"SpaceItem","name":{"type":"string","readOnly":false,"mandatory":false,"default":""},"uuid":{"type":"string","readOnly":false,"mandatory":false,"default":""},"click":{},"_id":"p1d9251b9e619c48"},"i15f6718c9d19b10":{"_name":"Spaces","items":{"type":["SpaceItem"],"readOnly":false,"mandatory":false,"default":[]},"systems":{"type":["SpaceItem"],"readOnly":false,"mandatory":false,"default":[]},"components":{"type":["SpaceItem"],"readOnly":false,"mandatory":false,"default":[]},"clear":{},"render":{},"_id":"i15f6718c9d19b10"},"j18ad71fd8c1c175":{"_name":"State","type":{"type":"editorType","readOnly":false,"mandatory":false,"default":"designer"},"component":{"type":"string","readOnly":false,"mandatory":false,"default":""},"_id":"j18ad71fd8c1c175","lastPage":{"type":"string","readOnly":false,"mandatory":false,"default":"index.html"},"messages":{"type":"array","readOnly":false,"mandatory":false,"default":[]},"menu":{"type":"string","readOnly":false,"mandatory":false,"default":""},"previousMenu":{"type":"string","readOnly":false,"mandatory":false,"default":""},"space":{"type":"string","readOnly":false,"mandatory":false,"default":""},"logs":{"type":["Log"],"readOnly":false,"mandatory":false,"default":[]},"navigation":{"type":"navigation","readOnly":false,"mandatory":false,"default":{"menu":[],"spaces":[]}}},"u1692f1399a13209":{"_name":"Store","uuid":{"type":"string","readOnly":false,"mandatory":false,"default":""},"collection":{"type":"string","readOnly":false,"mandatory":false,"default":""},"data":{"type":"object","readOnly":false,"mandatory":false,"default":{}},"extra":{"type":"object","readOnly":false,"mandatory":false,"default":{}},"_id":"u1692f1399a13209"},"t1fcf714b4c15616":{"_name":"System","name":{"type":"string","readOnly":false,"mandatory":false,"default":"system"},"master":{"type":"boolean","readOnly":false,"mandatory":false,"default":false},"version":{"type":"string","readOnly":false,"mandatory":false,"default":"0.0.1"},"description":{"type":"string","readOnly":false,"mandatory":false,"default":""},"schemas":{"type":"json","readOnly":false,"mandatory":false,"default":{}},"models":{"type":"json","readOnly":false,"mandatory":false,"default":{}},"behaviors":{"type":"json","readOnly":false,"mandatory":false,"default":{}},"types":{"type":"json","readOnly":false,"mandatory":false,"default":{}},"components":{"type":"json","readOnly":false,"mandatory":false,"default":{}},"_id":"t1fcf714b4c15616"},"h1ac4f1c0511caa0":{"_id":"h1ac4f1c0511caa0","_name":"SystemFactory","system":{"type":"System","readOnly":false,"mandatory":false,"default":""},"syncModel":{"params":[{"name":"schema","type":"object","mandatory":false,"default":{}}]},"syncBehavior":{"params":[{"name":"model","type":"object","mandatory":false,"default":{}}]},"syncComponent":{"params":[{"name":"model","type":"object","mandatory":false,"default":{}},{"name":"oldModel","type":"object","mandatory":false,"default":{}},{"name":"forceDelete","type":"boolean","mandatory":false,"default":true}]},"createModel":{"params":[{"name":"schema","type":"object","mandatory":false,"default":{}}],"result":"object"},"createBehavior":{"params":[{"name":"type","type":"string","mandatory":false,"default":"method"},{"name":"model","type":"string","mandatory":false,"default":""},{"name":"state","type":"string","mandatory":false,"default":""},{"name":"def","type":"object","mandatory":false,"default":{}}]},"deleteSchema":{"params":[{"name":"id","type":"string","mandatory":false,"default":""},{"name":"sync","type":"boolean","mandatory":false,"default":true}]},"generateId":{"result":"string"},"getGeneratedSchema":{"params":[{"name":"schema","type":"string","mandatory":true,"default":""}],"result":"object"},"getGeneratedModel":{"params":[{"name":"model","type":"string","mandatory":true,"default":""}],"result":"object"},"mergeBehavior":{"params":[{"name":"behaviors","type":"object","mandatory":true,"default":{}},{"name":"behavior","type":"object","mandatory":true,"default":{}},{"name":"sysId","type":"string","mandatory":true,"default":""},{"name":"systemName","type":"string","mandatory":true,"default":""}]},"mergeSystem":{"params":[{"name":"sys","type":"any","mandatory":false,"default":null}]},"updateBehavior":{"params":[{"name":"id","type":"string","mandatory":false,"default":""},{"name":"behavior","type":"object","mandatory":false,"default":{}}]},"updateComponent":{"params":[{"name":"id","type":"string","mandatory":false,"default":""},{"name":"collection","type":"string","mandatory":false,"default":""},{"name":"field","type":"string","mandatory":false,"default":""},{"name":"value","type":"any","mandatory":false,"default":""}]},"deleteComponent":{"params":[{"name":"id","type":"string","mandatory":false,"default":""},{"name":"collection","type":"string","mandatory":false,"default":""}]},"createComponent":{"params":[{"name":"collection","type":"string","mandatory":false,"default":""},{"name":"component","type":"object","mandatory":false,"default":{}}]},"updateSystem":{"params":[{"name":"id","type":"string","mandatory":false,"default":""},{"name":"system","type":"object","mandatory":false,"default":{}}]},"overwriteComponent":{"params":[{"name":"id","type":"string","mandatory":false,"default":""},{"name":"collection","type":"string","mandatory":false,"default":""},{"name":"component","type":"object","mandatory":false,"default":{}}]},"deleteBehavior":{"params":[{"name":"id","type":"string","mandatory":false,"default":""}]},"udpdateBehavior":{"params":[{"name":"id","type":"string","mandatory":false,"default":""},{"name":"behavior","type":"object","mandatory":false,"default":{}}]},"updateModelId":{"params":[{"name":"oldId","type":"string","mandatory":false,"default":""},{"name":"newId","type":"string","mandatory":false,"default":""}]},"updateModel":{"params":[{"name":"id","type":"string","mandatory":false,"default":""},{"name":"model","type":"object","mandatory":false,"default":{}}]},"updateSchemaId":{"params":[{"name":"oldId","type":"string","mandatory":false,"default":""},{"name":"newId","type":"string","mandatory":false,"default":""}]},"updateSchema":{"params":[{"name":"id","type":"string","mandatory":false,"default":""},{"name":"schema","type":"object","mandatory":false,"default":{}}]},"updateSchemaName":{"params":[{"name":"name","type":"string","mandatory":false,"default":""},{"name":"id","type":"string","mandatory":false,"default":""}]},"deleteType":{"params":[{"name":"id","type":"string","mandatory":false,"default":""}]},"updateType":{"params":[{"name":"id","type":"string","mandatory":false,"default":""},{"name":"type","type":"object","mandatory":false,"default":{}}]},"create":{"params":[{"name":"sys","type":"object","mandatory":false,"default":{}},{"name":"withStartMethod","type":"boolean","mandatory":false,"default":false}],"result":"System"},"toJSON":{"result":"any"},"addSchema":{"params":[{"name":"name","type":"string","mandatory":false,"default":""}],"result":"object"},"addType":{"params":[{"name":"name","type":"string","mandatory":false,"default":""},{"name":"isEnum","type":"boolean","mandatory":false,"default":false}],"result":"object"},"addComponent":{"params":[{"name":"model","type":"string","mandatory":false,"default":""}],"result":"object"},"addBehavior":{"params":[{"name":"model","type":"string","mandatory":false,"default":""},{"name":"component","type":"string","mandatory":false,"default":""},{"name":"state","type":"string","mandatory":false,"default":""}],"result":"object"},"updateComponentId":{"params":[{"name":"oldId","type":"string","mandatory":false,"default":""},{"name":"newId","type":"string","mandatory":false,"default":""},{"name":"collection","type":"string"}]},"getModelPaths":{"params":[{"name":"model","type":"string","mandatory":false,"default":""}],"result":"array"},"isModel":{"params":[{"name":"name","type":"any","mandatory":false,"default":""}],"result":"boolean"},"getModelPathType":{"description":"","params":[{"description":"","name":"model","type":"string","mandatory":false,"default":""},{"name":"path","description":"","type":"string","mandatory":false,"default":""}],"result":"any"},"isType":{"description":"","params":[{"name":"name","type":"string","mandatory":false,"default":""}],"result":"boolean"},"getParents":{"description":"","params":[{"description":"","name":"name","type":"string","mandatory":false,"default":""}],"result":"array"}},"l129a713e681c903":{"_name":"ToolBar","items":{"type":["ToolBarItem"],"readOnly":false,"mandatory":false,"default":[]},"render":{},"_id":"l129a713e681c903"},"u1f4c7177bb1a459":{"_name":"ToolBarItem","html":{"type":"HTML","readOnly":false,"mandatory":false,"default":""},"position":{"type":"number","readOnly":false,"mandatory":false,"default":0},"type":{"type":"editorType","readOnly":false,"mandatory":false,"default":"designer"},"render":{},"click":{},"_id":"u1f4c7177bb1a459","platform":{"type":"platform","readOnly":false,"mandatory":false,"default":"all"}},"v1435e1809e10be7":{"_name":"Workspace","create":{},"load":{},"clear":{},"_id":"v1435e1809e10be7","render":{}},"k1127212a8e18f9c":{"_id":"k1127212a8e18f9c","_name":"MessageHelp","render":{},"remove":{}},"1f4141671514c2c":{"_id":"1f4141671514c2c","_name":"_Storage","get":{"params":[{"name":"key","type":"string","mandatory":true,"default":""}]},"set":{"params":[{"name":"key","type":"string","mandatory":true,"default":""},{"name":"value","type":"any","mandatory":true,"default":null}]},"changed":{"params":[{"name":"obj","type":"object","mandatory":true,"default":{}}]},"clear":{},"remove":{"params":[{"name":"key","type":"string","mandatory":true,"default":""}]},"_core":true,"store":{"type":"object","readOnly":false,"mandatory":false,"default":{}}}},"behaviors":{"p13d9f1c84d121d2":{"_id":"p13d9f1c84d121d2","component":"Designer","state":"isCordova","action":"function isCordova() {\n  var result = false;\n  \n  if (typeof cordova !== 'undefined') {\n    result = true;\n  }\n  return result;\n}"},"p12f03101af19689":{"_id":"p12f03101af19689","component":"Designer","state":"isElectron","action":"function isElectron() {\n  var result = false;\n  var userAgent = navigator.userAgent.toLowerCase();\n  \n  if (userAgent.indexOf(' electron/') !== -1) {\n     result = true;\n  }\n  return result;\n}"},"s1472210b2419449":{"_id":"s1472210b2419449","component":"Designer","state":"open","action":"function open(url, target, isExt) {\n    var ref = null,\n        that = this;\n    \n    function _getRelativePath() {\n      var result = 'index.html';\n      \n      switch (that.require('state').menu()) {\n        case 'systems':\n          if (that.require('factory').system()) {\n            result = result + '#' + that.require('factory').system().id() + '#systems#' + that.require('factory').system().name();\n          }\n          break;\n        case 'schemas':\n          if (that.require('factory').system()) {\n            result = result + '#' + that.require('factory').system().id() + '#schemas';\n            if (that.require('state').space()) {\n             result = result + '#' + that.require('state').space();\n            }\n          }\n          break;\n        case 'models':\n          if (that.require('factory').system()) {\n            result = result + '#' + that.require('factory').system().id() + '#models';\n            if (that.require('state').space()) {\n             result = result + '#' + that.require('state').space();\n            }\n          }\n          break;\n        case 'types':\n          if (that.require('factory').system()) {\n            result = result + '#' + that.require('factory').system().id() + '#types';\n            if (that.require('state').space()) {\n             result = result + '#' + that.require('state').space();\n            }\n          }\n          break;\n        case 'behaviors':\n          if (that.require('factory').system()) {\n            result = result + '#' + that.require('factory').system().id() + '#behaviors';\n            if (that.require('state').space()) {\n             result = result + '#' + that.require('state').space();\n            }\n          }\n          break;\n        case 'components':\n          if (that.require('factory').system()) {\n            result = result + '#' + that.require('factory').system().id() + '#components';\n            if (that.require('state').space()) {\n             result = result + '#' + that.require('state').space();\n            }\n          }\n          break;\n        case 'logs':\n          if (that.require('factory').system()) {\n            result = result + '#' + that.require('factory').system().id() + '#logs';\n          }\n          break;\n        default:\n          break;\n      }\n      \n      return result;\n    }\n    \n    switch(true) {\n      case this.isElectron():\n        if (isExt) {\n            ref = require('electron').shell.openExternal(url, { activate: true });  \n        } else {\n            if (target === '_self') {\n              window.location.href = url;\n            } else {\n              ref = window.open(url, target);\n              ref.focus();\n            }\n        }\n        break;\n      case this.isCordova():\n        if (isExt) {\n          window.open(url, '_system');\n        } else { \n          if (url.indexOf('index.html') === -1 || url.indexOf('app/') !== -1) {\n            /*\n            var system = this.require('db').collections().System.find({\n                '_id': this.require('factory').system().id()\n            })[0];\n            system = JSON.parse(JSON.stringify(system));\n\n            url = url + '?system=' + encodeURIComponent(JSON.stringify(system));\n            url = url + '&ref=' + encodeURIComponent(_getRelativePath());\n            */\n            url = url + '?ref=' + encodeURIComponent(_getRelativePath());\n          }\n          document.location.href = url;\n        }\n        break;\n      default:\n        ref = window.open(url, target);\n        break;\n    }\n    \n    return ref;\n}"},"g1043310ce91f287":{"_id":"g1043310ce91f287","component":"Designer","state":"saveAs","action":"function saveAs(data, fileName) {\n    var textToWrite = null,\n        textFileAsBlob = null,\n        fileNameToSaveAs = null,\n        downloadLink = null,\n        message = this.require('message');\n    \n    textToWrite = JSON.stringify(data);\n    fileNameToSaveAs = fileName;\n    \n    if (!this.isElectron()) {\n      \n      textFileAsBlob = new Blob([textToWrite], {\n          type: 'text/plain'\n      });\n      \n      if (navigator.msSaveBlob) {\n        navigator.msSaveBlob(textFileAsBlob, fileNameToSaveAs);\n      } else {\n        downloadLink = document.createElement('a');\n        downloadLink.download = fileNameToSaveAs;\n        downloadLink.innerHTML = 'Download File';\n        if (window.URL != null) {\n            downloadLink.href = window.URL.createObjectURL(textFileAsBlob);\n        } else {\n            downloadLink.href = window.URL.createObjectURL(textFileAsBlob);\n            downloadLink.onclick = function (event) {\n                document.body.removeChild(event.target);\n            };\n            downloadLink.style.display = 'none';\n            document.body.appendChild(downloadLink);\n        }\n    \n        downloadLink.click();\n      }\n      \n      message.success('Exportation is done.');\n    } else {\n      var {dialog} = require(\"electron\").remote;\n      var fs = require('fs');\n\n      dialog.showSaveDialog({\n          'defaultPath': '~/' + fileNameToSaveAs\n        }).then(function(ret) {\n          var savePath = ret.filePath; \n          if (savePath) {\n            fs.writeFile(savePath, textToWrite, function(err) {\n              if (err) {\n                message.danger('Exportation failed.');\n              } else {\n                message.success('Exportation is done.');\n              }\n            });\n          }\n      });\n    }\n}"},"u16f78106f713bd5":{"_id":"u16f78106f713bd5","component":"Designer","state":"updateCordovaContext","action":"function updateCordovaContext() {\n  var params = {},\n      urlParams = [],\n      system = null;\n      \n  urlParams = document.location.href.split('?');\n\n  if (urlParams.length > 1) {\n      urlParams = urlParams[1].split('&');\n      urlParams.forEach(function (urlParam) {\n          var name = '',\n              value = '';\n\n          name = urlParam.split('=')[0].trim();\n          value = urlParam.split('=')[1].trim();\n\n          params[name] = decodeURIComponent(value);\n      });    \n  }\n      \n      \n  //if (params.system) {\n    //system = JSON.parse(params.system);\n    //this.require('storage').set(system._id, system);\n  //}\n  \n  if (params.ref) {\n    this.require('state').lastPage(params.ref);\n  }\n}"},"i1ae8c1cb711320e":{"_id":"i1ae8c1cb711320e","component":"Designer","state":"installExtensions","action":"function installExtensions() { \n\tvar extensions = null,\n\t    numExtension = -1;\n  \n  // extensions\n  extensions = this.require('storage').get('system-designer-extensions');\n  if (extensions && extensions.extensions && extensions.extensions.length) {\n    extensions.extensions.forEach(function (extension) {\n      var Extension = this.require('Extension'),\n          system = {},\n          cleanJson = {},\n          reg = null,\n          needsUpdate = false;\n          \n      numExtension++;    \n         \n      if (extension.installed) {    \n        system = extension.source;\n        \n        try {\n          // check if we have to update the extension\n          if (this.require(extension._id) && this.require(extension._id).source().version > system.version) {\n            system = this.require(extension._id).source();\n            needsUpdate = true;\n          }\n          \n          cleanJson = JSON.stringify(system);\n          reg = new RegExp(system._id, 'g');\n          cleanJson = cleanJson.replace(reg, 'ext_' + system._id );\n          system = JSON.parse(cleanJson);\n          \n          this.require('runtime').install(system);\n          \n          new Extension(extension);\n          \n          if (needsUpdate) {\n            // save the updated system\n            extensions.extensions[numExtension].source = system;\n            this.require('storage').set('system-designer-extensions', extensions);\n            \n            this.require('message').success('Extension \\'' + system.description + '\\' has been updated.');\n          }\n        } catch (e) {\n          this.require('message').danger('Can not install an extension: ' + e.message);\n        }\n      }\n    }.bind(this));\n  }\n}","useCoreAPI":false,"core":false},"j1fc6515c8f1838f":{"_id":"j1fc6515c8f1838f","component":"Designer","state":"isMac","action":"function isMac() { \n\tvar result = false;\n\t\n\tif (navigator.userAgent.toLowerCase().indexOf('macintosh') !== -1) {\n\t  result = true;\n\t} \n\treturn result;\n}","useCoreAPI":false,"core":false},"k10e3f115ef1a83b":{"_id":"k10e3f115ef1a83b","component":"DialogCopyright","state":"init","action":"function init(conf) { \n  var html = '',\n      dom = null;\n  \n  $('#designer-dialog').empty();\n\n  html = this.require('dialog-modal-copyright.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n      .replace(/{{title}}/gi, this.title())\n      .replace(/{{message}}/gi, this.message())\n  );\n\n  //events\n  dom = document.getElementById('designer-dialog-copyright-modal-ok');\n  dom.addEventListener('click', function (event) {\n      this.ok();\n  }.bind(this));\n  \n  dom = document.getElementById('designer-dialog-copyright-modal');\n  dom.addEventListener('keydown', function keydown(event) {\n    if (event.keyCode === 13) {\n      event.stopPropagation();\n      event.preventDefault();\n      this.ok();\n      return false;\n    }\n  }.bind(this));\n}","useCoreAPI":false,"core":false},"k191d71c949120ec":{"_id":"k191d71c949120ec","component":"DialogCopyright","state":"show","action":"function show() { \n  $('#designer-dialog-copyright-modal').modal('show');\n}","useCoreAPI":false,"core":false},"z17fdc13a9a1f940":{"_id":"z17fdc13a9a1f940","component":"DialogCopyright","state":"hide","action":"function hide() { \n  $('#designer-dialog-copyright-modal').modal('hide');\n}","useCoreAPI":false,"core":false},"k11cb01de7316017":{"_id":"k11cb01de7316017","component":"DialogImport","state":"init","action":"function init(conf) { \n  var html = '',\n      dom = null;\n\n  $('.modal-backdrop').remove();\n  $('#designer-dialog').empty();\n  \n  html = this.require('dialog-modal-import.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n        .replace(/{{title}}/gi, this.title())\n        .replace(/{{message}}/gi, this.message())\n  );\n  \n  // events\n  dom = document.getElementById('designer-dialog-import-modal-cancel');\n  dom.addEventListener('click', function click(event) {\n    this.cancel();\n  }.bind(this));\n  \n  dom = document.getElementById('designer-dialog-import-modal-ok');\n  dom.addEventListener('click', function click(event) {\n    this.ok();\n  }.bind(this));\t\n  \n  dom = document.getElementById('designer-dialog-import-modal');\n  dom.addEventListener('keydown', function keydown(event) {\n    if (event.keyCode === 13) {\n      event.stopPropagation();\n      event.preventDefault();\n      this.ok();\n      return false;\n    }\n  }.bind(this));\n}","useCoreAPI":false,"core":false},"n1ff331a4a41052e":{"_id":"n1ff331a4a41052e","component":"DialogImport","state":"show","action":"function show() { \n  $('#designer-dialog-import-modal').modal('show');\t\n}","useCoreAPI":false,"core":false},"c10f7913c3113bb1":{"_id":"c10f7913c3113bb1","component":"DialogImport","state":"hide","action":"function hide() { \n  $('#designer-dialog-import-modal').modal('hide');\n}","useCoreAPI":false,"core":false},"w17f82152171991e":{"_id":"w17f82152171991e","component":"DialogWelcome","state":"init","action":"function init(conf) { \n  var html = '',\n      dom = null;\n  \n  $('#designer-dialog').empty();\n  \n  html = this.require('dialog-modal-welcome.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n        .replace(/{{title}}/gi, this.title())\n  );\n  \n  // events\n  dom = document.getElementById('designer-dialog-welcome-modal-ok');\n  dom.addEventListener('click', function click(event) {\n    this.ok();\n  }.bind(this));\t\n}","useCoreAPI":false,"core":false},"l149ed1bf1411137":{"_id":"l149ed1bf1411137","component":"DialogWelcome","state":"show","action":"function show() { \n  $('#designer-dialog-welcome-modal').modal('show');\t\n}","useCoreAPI":false,"core":false},"g184031e6b71648a":{"_id":"g184031e6b71648a","component":"DialogWelcome","state":"hide","action":"function hide() { \n  $('#designer-dialog-welcome-modal').modal('hide');\t\n}","useCoreAPI":false,"core":false},"z1d0ec1a0ce18278":{"_id":"z1d0ec1a0ce18278","component":"DialogSync","state":"init","action":"function init(conf) { \n  var html = '',\n      dom = null;\n\n  $('#designer-dialog').empty();\n\n  html = this.require('dialog-modal-sync.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n        .replace(/{{title}}/gi, this.title())\n  );\n\n  // events\n  dom = document.getElementById('designer-dialog-sync-modal-ok');\n  dom.addEventListener('click', function click(event) {\n    this.ok();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-type-creation-hasHTML');\n  dom.addEventListener('click', function click(event) {\n    if ($('#designer-dialog-type-creation-hasHTML')[0].checked) {\n        $('#designer-dialog-sync-options-log-level').show();\n    } else {\n        $('#designer-dialog-sync-options-log-level').hide();\n    }\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-sync-commit');\n  dom.addEventListener('click', function click(event) {\n    $('#designer-dialog-sync-comments-area').show();\n    $('#designer-dialog-sync-options-area').show();\n    $('#designer-dialog-sync-options-node').show();\n    if ($('#designer-dialog-type-creation-hasHTML')[0].checked) {\n        $('#designer-dialog-sync-options-log-level').show();\n    }\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-sync-refresh');\n  dom.addEventListener('click', function click(event) {\n    $('#designer-dialog-sync-comments-area').hide();\n    $('#designer-dialog-sync-options-area').hide();\n    $('#designer-dialog-sync-options-log-level').hide();\n    $('#designer-dialog-sync-options-node').hide();\n  }.bind(this));\t\n  \n  dom = document.getElementById('designer-dialog-sync-modal');\n  dom.addEventListener('keydown', function keydown(event) {\n    if (event.keyCode === 13) {\n      event.stopPropagation();\n      event.preventDefault();\n      this.ok();\n      return false;\n    }\n  }.bind(this));\n  \n}","useCoreAPI":false,"core":false},"f1df481fac01acdc":{"_id":"f1df481fac01acdc","component":"DialogSync","state":"show","action":"function show() { \n  $('#designer-dialog-sync-modal').modal('show');\t\n}","useCoreAPI":false,"core":false},"m187b818e2f1b30f":{"_id":"m187b818e2f1b30f","component":"DialogSync","state":"hide","action":"function hide() { \n  $('#designer-dialog-sync-modal').modal('hide');\t\n}","useCoreAPI":false,"core":false},"y1934b1e72412bd0":{"_id":"y1934b1e72412bd0","component":"DialogShare","state":"init","action":"function init(conf) { \n  var html = null,\n      dom = null,\n      sys = '';\n\n  $('#designer-dialog').empty();\n\n  sys = this.require('db').collections().System.find({\n      '_id': this.require('factory').system().id()\n  })[0];\n\n  html = this.require('dialog-modal-share.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n        .replace(/{{title}}/gi, this.title())\n        .replace(/{{message}}/gi, window.location.toString().split('#')[0] + '?system=' + encodeURIComponent(JSON.stringify(sys)))\n  );\n\n  // events\n  dom = document.getElementById('designer-dialog-share-modal-cancel');\n  dom.addEventListener('click', function click(event) {\n    this.cancel();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-share-modal-ok');\n  dom.addEventListener('click', function click(event) {\n    this.ok();\n  }.bind(this));\t\n}","useCoreAPI":false,"core":false},"l1eb0516ca015910":{"_id":"l1eb0516ca015910","component":"DialogShare","state":"show","action":"function show() { \n  $('#designer-dialog-share-modal').modal('show');\t\n}","useCoreAPI":false,"core":false},"q1e62a1c9d61ba89":{"_id":"q1e62a1c9d61ba89","component":"DialogShare","state":"hide","action":"function hide() { \n  $('#designer-dialog-share-modal').modal('hide');\n}","useCoreAPI":false,"core":false},"s1d027166051b0ad":{"_id":"s1d027166051b0ad","component":"DialogConfig","state":"init","action":"function init(conf) { \n  var html = '',\n      dom = null,\n      that = this,\n      storeConfig = null,\n      designer = that.require('designer');\n\n  $('#designer-dialog').empty();\n\n  html = this.require('dialog-modal-config.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n        .replace(/{{title}}/gi, this.title())\n  );\n\n  // default config value\n  storeConfig = this.require('storage').get('system-designer-config');\n\n  if (!storeConfig) {\n    storeConfig = {};\n  }\n\n  if (typeof storeConfig.debugType === 'undefined') {\n    storeConfig.debugType = 'client';\n    this.require('storage').set('system-designer-config', storeConfig);\n  }\n  if (storeConfig.debugType === 'client') {\n    $('#designer-dialog-config-radio-client').attr('checked', true);\n    $('#designer-dialog-config-server-form').hide();\n  } else {\n    $('#designer-dialog-config-radio-server').attr('checked', true);\n    $('#designer-dialog-config-client-form').hide();\n  }\n  if (storeConfig.urlClient) {\n    $('#designer-dialog-config-url-client')[0].value = storeConfig.urlClient;\n  }\n  if (storeConfig.urlServer) {\n    $('#designer-dialog-config-url-server')[0].value = storeConfig.urlServer;\n  }\n  if (storeConfig.githubToken) {\n    $('#designer-dialog-config-github-token')[0].value = atob(storeConfig.githubToken);\n  }\n  if (storeConfig.githubRepository) {\n    $('#designer-dialog-config-github-repository')[0].value = storeConfig.githubRepository;\n  }\n  if (storeConfig.advancedMode) {\n    $('#designer-dialog-config-advanced-mode-isAdvanced').attr('checked', true);\n  }\n  if (storeConfig.language) {\n    $('#designer-dialog-config-language-select').val(storeConfig.language);\n  }\n  \n  // events\n  dom = document.getElementById('designer-dialog-config-radio-client');\n  dom.addEventListener('click', function click(event) {\n    var config = this.require('storage').get('system-designer-config');\n\n    if (!config) {\n      config = {};\n    }\n\n    config.debugType = 'client';\n    this.require('storage').set('system-designer-config', config);\n\n    $('#designer-dialog-config-client-form').show();\n    $('#designer-dialog-config-server-form').hide();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-config-radio-server');\n  dom.addEventListener('click', function click(event) {\n    var config = this.require('storage').get('system-designer-config');\n\n    if (!config) {\n      config = {};\n    }\n\n    config.debugType = 'server';\n    this.require('storage').set('system-designer-config', config);\n\n    $('#designer-dialog-config-client-form').hide();\n    $('#designer-dialog-config-server-form').show();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-config-url-client');\n  dom.addEventListener('keydown', function keydown(event) {\n    if (event.keyCode === 13) {\n        event.stopPropagation();\n        event.preventDefault();\n        if ($('#designer-dialog-config-url-client').val()) {\n          this.ok();\n        }\n        return false;\n    }\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-config-github-token');\n  dom.addEventListener('keydown', function keydown(event) {\n    if (event.keyCode === 13) {\n        event.stopPropagation();\n        event.preventDefault();\n        if ($('#designer-dialog-config-github-token').val()) {\n          this.ok();\n        }\n        return false;\n    }\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-config-github-repository');\n  dom.addEventListener('keydown', function keydown(event) {\n    if (event.keyCode === 13) {\n        event.stopPropagation();\n        event.preventDefault();\n        if ($('#designer-dialog-config-github-repository').val()) {\n          this.ok();\n        }\n        return false;\n    }\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-config-url-server');\n  dom.addEventListener('keydown', function keydown(event) {\n    if (event.keyCode === 13) {\n        event.stopPropagation();\n        event.preventDefault();\n        if ($('#designer-dialog-config-url-server').val()) {\n          this.ok();\n        }\n        return false;\n    }\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-config-advanced-mode-isAdvanced');\n  dom.addEventListener('click', function click(event) {\n    var config = this.require('storage').get('system-designer-config');\n\n    if (!config) {\n      config = {};\n    }\n\n    config.advancedMode = $('#designer-dialog-config-advanced-mode-isAdvanced').prop('checked');\n    this.require('storage').set('system-designer-config', config);\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-config-modal-cancel');\n  dom.addEventListener('click', function click(event) {\n    this.cancel();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-config-modal-ok');\n  dom.addEventListener('click', function click(event) {\n    this.ok();\n  }.bind(this));\n  \n  dom = document.getElementById('designer-dialog-config-modal');\n  dom.addEventListener('keydown', function keydown(event) {\n    if (event.keyCode === 13) {\n      event.stopPropagation();\n      event.preventDefault();\n      this.ok();\n      return false;\n    }\n  }.bind(this));\n}","useCoreAPI":false,"core":false},"f16d5719c171dfe5":{"_id":"f16d5719c171dfe5","component":"DialogConfig","state":"show","action":"function show() { \n  $('#designer-dialog-config-modal').modal('show');\t\n}","useCoreAPI":false,"core":false},"l1cb42113d7185c8":{"_id":"l1cb42113d7185c8","component":"DialogConfig","state":"hide","action":"function hide() { \n  $('#designer-dialog-config-modal').modal('hide');\n}","useCoreAPI":false,"core":false},"f1f43d11c0d15597":{"_id":"f1f43d11c0d15597","component":"DialogConfig","state":"ok","action":"function ok() { \n  var config = this.require('storage').get('system-designer-config');\n  var previousLanguage = '';\n\n  if (!config) {\n    config = {};\n  }\n\n  config.urlClient = $('#designer-dialog-config-url-client')[0].value;\n  config.urlServer = $('#designer-dialog-config-url-server')[0].value;\n  config.githubToken = btoa($('#designer-dialog-config-github-token')[0].value);\n  config.githubRepository = $('#designer-dialog-config-github-repository')[0].value;\n  \n  // refresh if current language has changed\n  previousLanguage = config.language;\n  config.language = $('#designer-dialog-config-language-select').val();\n  if (previousLanguage !== config.language) {\n    window.location.reload();\n  }\n\n  this.require('storage').set('system-designer-config', config);\t\n}","useCoreAPI":false,"core":false},"t143b71071c16185":{"_id":"t143b71071c16185","component":"DialogImportFile","state":"init","action":"function init(conf) { \n  var html = '',\n      dom = null,\n      that = this,\n      libraries = [],\n      library = '',\n      systems = [],\n      system = '',\n      sys = '',\n      systemIds = '',\n      length = 0,\n      i = 0,\n      list = '',\n      platform = '',\n      platformLibraries = [],\n      systemClean = '';\n\n  $('#designer-dialog').empty();\n\n  libraries = this.require('db').collections().JSON.find({\n    'platform': 'all'\n  });\n  \n  // get platformspecific items\n  switch(true) {\n    case this.require('designer').isElectron() === true:\n      platform = 'electron';\n      break;\n    case this.require('designer').isCordova() === true:\n      platform = 'cordova';\n      break;\n    default:\n      platform = 'web';\n      break;\n  }\n  \n  platformLibraries = this.require('db').collections().JSON.find({\n    'platform': platform\n  });\n  \n  libraries = libraries.concat(platformLibraries);\n  \n  // sort JSON\n  libraries.sort(function (itemA, itemB) {\n    if (itemA._id > itemB._id) {\n      return 1;\n    }\n    if (itemA._id < itemB._id) {\n      return -1;\n    }\n    return 0;\n  });\n  \n  length = libraries.length;\n  for (i = 0; i < length; i++) {\n    library = this.require(libraries[i]._id);\n\n    list = list + '<a class=\"list-group-item\" id=\"designer-dialog-import-file-modal-library-' + library.id() + '\">' +\n        '<h4 class=\"list-group-item-heading\">' + library.source().description.substr(0, 40).split('\\n')[0].split('.')[0] + '</h4>' +\n        '<p class=\"list-group-item-text\">v' + library.source().version + '</p>' +\n        '</a>';\n  }\n\n  systems = this.require('storage').get('system-designer-systems');\n\n  if (systems) {\n    systemIds = systems.systems;\n  }\n  length = systemIds.length;\n\n  for (i = 0; i < length; i++) {\n    system = this.require('storage').get(systemIds[i]);\n\n    if (this.require('factory').system() && this.require('factory').system().id() === system._id) {\n    } else {\n        sys = sys + '<a class=\"list-group-item\" id=\"designer-dialog-import-file-modal-systems-' + system._id + '\">' +\n            '<h4 class=\"list-group-item-heading\">' + system.name + '</h4>' +\n            '<p class=\"list-group-item-text\">v' + system.version + '</p>' +\n            '</a>';\n    }\n  }\n\n  html = this.require('dialog-modal-import-file.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n        .replace(/{{title}}/gi, this.title())\n        .replace(/{{library}}/gi, list)\n        .replace(/{{systems}}/gi, sys)\n  );\n\n  // init\n  if (sys === '') {\n    $('#designer-dialog-import-modal-from-systems-input').hide();\n  }\n  if (!this.require('factory').system()) {\n    $('#designer-dialog-import-file-modal-merge').hide();\n  }\n\n  // systems events  \n  var callbackSystemEvent = function cbSystemEvent(event) {\n    var id = '',\n        systems = null,\n        length = 0,\n        i = 0;\n\n    if ($(this).hasClass('active')) {\n      $(this).removeClass('active');\n      that.data(null);\n    } else {\n      id = this.getAttribute('id').replace('designer-dialog-import-file-modal-systems-', '');\n      \n      that.data(that.require('storage').get(id));\n\n      // remove old active\n      systems = document.getElementById('designer-dialog-import-file-modal-systems');\n\n      length = systems.children.length;\n      for (i = 0; i < length; i++) {\n        $(systems.children[i]).removeClass('active');\n      }\n\n      // add current active\n      $(this).addClass('active');\n    }\n  };\n\n  length = systemIds.length;\n  for (i = 0; i < length; i++) {\n    system = that.require('storage').get(systems.systems[i]);\n    if (this.require('factory').system() && this.require('factory').system().id() === system._id) {\n    } else {\n      dom = document.getElementById('designer-dialog-import-file-modal-systems-' + system._id);\n      dom.addEventListener('click', callbackSystemEvent);\n    }\n  }\n\n  // library events  \n  var callbackEvent = function cbEvent(event) {\n    var id = '',\n        libraries = null,\n        length = 0,\n        i = 0,\n        system = {};\n\n    if ($(this).hasClass('active')) {\n      $(this).removeClass('active');\n      that.data(null);\n    } else {\n      id = this.getAttribute('id').replace('designer-dialog-import-file-modal-library-', '');\n\n      // case of extensions\n      system = that.require(id).source();\n      if (system.name.indexOf('extension-') !== -1) {\n        system.name = 'extension-' + Math.floor((1 + Math.random()) * 0x10000).toString(16);\n        system._id = that.require('factory').generateId();\n        \n        // to avoid an issue when removing extensions\n        systemClean = JSON.stringify(system);\n        \n        systemClean = systemClean.replace(/d1bdde1f59f1befe/g, that.require('factory').generateId());\n        systemClean = systemClean.replace(/n1467b1097a16481/g, that.require('factory').generateId());\n        systemClean = systemClean.replace(/t1fb0b150c810528/g, that.require('factory').generateId());\n\n        system = JSON.parse(systemClean);\n      }\n      \n      that.data(system);\n\n      // remove old active\n      libraries = document.getElementById('designer-dialog-import-file-modal-library');\n\n      length = libraries.children.length;\n      for (i = 0; i < length; i++) {\n        $(libraries.children[i]).removeClass('active');\n      }\n\n      // add current active\n      $(this).addClass('active');\n    }\n  };\n\n  length = libraries.length;\n  for (i = 0; i < length; i++) {\n    library = this.require(libraries[i]._id);\n    dom = document.getElementById('designer-dialog-import-file-modal-library-' + library.id());\n\n    dom.addEventListener('click', callbackEvent);\n  }\n\n  dom = document.getElementById('designer-dialog-import-modal-from-file');\n  dom.addEventListener('click', function click(event) {\n    this.data(null);\n    $('#designer-dialog-import-modal-from-file-form').show();\n    $('#designer-dialog-import-modal-from-systems-form').hide();\n    $('#designer-dialog-import-modal-from-library-form').hide();\n    $('#designer-dialog-import-file-modal-import').show();\n    $('#designer-dialog-import-file-modal-merge').removeClass('btn-primary');\n    $('#designer-dialog-import-file-modal-merge').addClass('btn-default');\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-import-modal-from-library');\n  dom.addEventListener('click', function click(event) {\n    this.data(null);\n    $('#designer-dialog-import-modal-from-library-form').show();\n    $('#designer-dialog-import-modal-from-systems-form').hide();\n    $('#designer-dialog-import-modal-from-file-form').hide();\n    $('#designer-dialog-import-file-modal-import').show();\n    $('#designer-dialog-import-file-modal-merge').removeClass('btn-primary');\n    $('#designer-dialog-import-file-modal-merge').addClass('btn-default');\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-import-modal-from-systems');\n  dom.addEventListener('click', function click(event) {\n    this.data(null);\n    $('#designer-dialog-import-modal-from-library-form').hide();\n    $('#designer-dialog-import-modal-from-systems-form').show();\n    $('#designer-dialog-import-modal-from-file-form').hide();\n    $('#designer-dialog-import-file-modal-import').hide();\n    $('#designer-dialog-import-file-modal-merge').removeClass('btn-default');\n    $('#designer-dialog-import-file-modal-merge').addClass('btn-primary');\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-import-file-modal-cancel');\n  dom.addEventListener('click', function click(event) {\n    this.cancel();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-import-file-modal-merge');\n  dom.addEventListener('click', function click(event) {\n    if (this.data() && Object.keys(this.data()).length) {\n      this.mergeSystem();\n    }\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-import-file-modal-import');\n  dom.addEventListener('click', function click(event) {\n    \n    if (this.data() && Object.keys(this.data()).length) {\n      this.importSystem();\n    }\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-import-file-modal-file');\n  dom.addEventListener('change', function click(e) {\n    e.stopPropagation();\n    e.preventDefault();\n   \n    var files = e.target.files,\n        reader = new FileReader(),\n        json = '',\n        that = this;\n\n    reader.onload = function onload(event) {\n      json = json + event.target.result;\n    };\n    reader.onloadend = function onloadend() {\n      try {\n        var sys = JSON.parse(json);\n        \n        if (\n          typeof sys._id !== 'undefined' &&\n          typeof sys.name !== 'undefined' &&\n          typeof sys.description !== 'undefined' &&\n          typeof sys.version !== 'undefined' &&\n          typeof sys.schemas !== 'undefined'\n          ) {\n          that.data(sys);\n        } else {\n          that.data(null);\n        } \n      } catch (e) {\n        that.data(null);\n      }\n    };\n    if (files[0]) {\n      reader.readAsText(files[0], 'UTF-8');\n    }\n  }.bind(this));\n  \n  dom = document.getElementById('designer-dialog-import-file-modal');\n  dom.addEventListener('keydown', function keydown(event) {\n    \n    if (event.keyCode === 13) {\n      event.stopPropagation();\n      event.preventDefault();\n      if ($('#designer-dialog-import-modal-from-file').prop('checked') ||\n          $('#designer-dialog-import-modal-from-library').prop('checked')\n      ) {\n        if (this.data() && Object.keys(this.data()).length) {\n          this.importSystem();\n        }\n      }\n      if ($('#designer-dialog-import-modal-from-systems').prop('checked')) {\n        if (this.data() && Object.keys(this.data()).length) {\n          this.mergeSystem();\n        }\n      }\n      return false;\n    }\n  }.bind(this));\n}","useCoreAPI":false,"core":false},"n1948e18c6f1f038":{"_id":"n1948e18c6f1f038","component":"DialogImportFile","state":"show","action":"function show() {\n  $('#designer-dialog-import-file-modal').modal('show');\n}","useCoreAPI":false,"core":false},"y1c99c14f7316ed0":{"_id":"y1c99c14f7316ed0","component":"DialogImportFile","state":"hide","action":"function hide() { \n  $('#designer-dialog-import-file-modal').modal('hide');\n}","useCoreAPI":false,"core":false},"w13035176cd18ec0":{"_id":"w13035176cd18ec0","component":"DialogDropFile","state":"init","action":"function init(conf) { \n  var html = null,\n      dom = null;\n\n  $('#designer-dialog').empty();\n\n  html = this.require('dialog-modal-drop-file.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n        .replace(/{{title}}/gi, this.title())\n        .replace(/{{message}}/gi, this.message())\n  );\n\n  //events\n  dom = document.getElementById('designer-dialog-drop-file-modal-cancel');\n  dom.addEventListener('click', function click(event) {\n    this.cancel();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-drop-file-modal-merge');\n  dom.addEventListener('click', function click(event) {\n    this.require('factory').mergeSystem(this.data());\n    \n    this.require('designer').save();\n\n    this.require('spaces').render();\n    this.require('workspace').render();\n\n    this.require('router').update();\n\n    this.hide();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-drop-file-modal-import');\n  dom.addEventListener('click', function click(event) {\n    var System = this.require('System'),\n      sys = null,\n      state = this.require('state'),\n      message = this.require('message');\n\n    if (this.require('factory').system()) {\n      this.require('factory').system().destroy();\n    }\n    sys = this.require('factory').create(this.data());\n  \n    // empty log\n    state.logs().forEach(function (item) {\n      this.logs().pop();\n    }.bind(state));\n    \n    // hide log\n    $('#designer-menu-item-logs-number').hide();\n    document.querySelector('#designer-menu-item-logs-number').innerHTML = 0;\n  \n    this.require('designer').save();\n  \n    this.require('state').space(sys.name());\n    this.require('spaces').render();\n    this.require('workspace').render();\n  \n    this.require('router').update();\n  \n    this.hide();\n    this.require('designer').save();\n  \n    message.success('Importation of the system is done.');\t\n  }.bind(this));\n  \n  dom = document.getElementById('designer-dialog-drop-file-modal');\n  dom.addEventListener('keydown', function keydown(event) {\n    if (event.keyCode === 13) {\n      event.stopPropagation();\n      event.preventDefault();\n      document.getElementById('designer-dialog-drop-file-modal-import').click();\n      return false;\n    }\n  }.bind(this));\n\n  if (!this.require('factory').system()) {\n    $('#designer-dialog-drop-file-modal-merge').hide();\n  }\n}","useCoreAPI":false,"core":false},"i1c2891d03c165db":{"_id":"i1c2891d03c165db","component":"DialogDropFile","state":"show","action":"function show() { \n  $('#designer-dialog-drop-file-modal').modal('show');\n}","useCoreAPI":false,"core":false},"w1ef271a5801083b":{"_id":"w1ef271a5801083b","component":"DialogDropFile","state":"hide","action":"function hide() { \n  $('#designer-dialog-drop-file-modal').modal('hide');\n}","useCoreAPI":false,"core":false},"o158c0125d313bc1":{"_id":"o158c0125d313bc1","component":"DialogTypeCreation","state":"init","action":"function init(conf) { \n  var html = '',\n      dom = null;\n\n  $('#designer-dialog').empty();\n\n  html = this.require('dialog-modal-type-creation.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n        .replace(/{{title}}/gi, this.title())\n  );\n\n  //events\n  dom = document.getElementById('designer-dialog-type-creation-name');\n  dom.addEventListener('keydown', function keydown(event) {\n    if (event.keyCode === 13) {\n      event.stopPropagation();\n      event.preventDefault();\n      if ($('#designer-dialog-type-creation-name').val()) {\n        this.ok();\n      }\n      return false;\n    }\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-type-creation-modal-cancel');\n  dom.addEventListener('click', function click(event) {\n    this.cancel();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-type-creation-modal-ok');\n  dom.addEventListener('click', function click(event) {\n    this.ok();\n  }.bind(this));\n\n  // focus\n  $('#designer-dialog-type-creation-modal').on('shown.bs.modal', function modal() {\n    $('#designer-dialog-type-creation-name').focus();\n  });\n}","useCoreAPI":false,"core":false},"f1bf26153e91a94e":{"_id":"f1bf26153e91a94e","component":"DialogTypeCreation","state":"show","action":"function show() { \n  $('#designer-dialog-type-creation-modal').modal('show');\n}","useCoreAPI":false,"core":false},"r1b7ef1af221063a":{"_id":"r1b7ef1af221063a","component":"DialogTypeCreation","state":"hide","action":"function hide() { \n  $('#designer-dialog-type-creation-modal').modal('hide');\n}","useCoreAPI":false,"core":false},"m1c6a71fad71fee1":{"_id":"m1c6a71fad71fee1","component":"DialogExport","state":"init","action":"function init(conf) { \n  var html = '',\n      dom = null,\n      system = this.require('factory').system();\n\n  $('#designer-dialog').empty();\n\n  html = this.require('dialog-modal-export.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n        .replace(/{{title}}/gi, this.title())\n  );\n\n  // default value\n  if (system.master() === true) {\n    $('#designer-dialog-export-isMaster').attr('checked', true);\n  }\n\n  //events\n  dom = document.getElementById('designer-dialog-export-modal-cancel');\n  dom.addEventListener('click', function click(event) {\n    this.cancel();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-export-modal-ok');\n  dom.addEventListener('click', function click(event) {\n    this.ok();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-export-json');\n  dom.addEventListener('click', function click(event) {\n    $('#designer-dialog-export-options').show();\n    $('#designer-dialog-export-options-log-level').hide();\n    $('#designer-dialog-export-options-diagram-type').hide();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-export-javascript');\n  dom.addEventListener('click', function click(event) {\n    $('#designer-dialog-export-options').hide();\n    $('#designer-dialog-export-options-diagram-type').hide();\n    $('#designer-dialog-export-options-log-level').show();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-export-html');\n  dom.addEventListener('click', function click(event) {\n    $('#designer-dialog-export-options').hide();\n    $('#designer-dialog-export-options-diagram-type').hide();\n    $('#designer-dialog-export-options-log-level').show();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-export-node');\n  dom.addEventListener('click', function click(event) {\n    $('#designer-dialog-export-options').hide();\n    $('#designer-dialog-export-options-diagram-type').hide();\n    $('#designer-dialog-export-options-log-level').show();\n  }.bind(this));\n  \n  dom = document.getElementById('designer-dialog-export-graphviz');\n  dom.addEventListener('click', function click(event) {\n    $('#designer-dialog-export-options').hide();\n    $('#designer-dialog-export-options-log-level').hide();\n    $('#designer-dialog-export-options-diagram-type').show();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-export-modal');\n  dom.addEventListener('keydown', function keydown(event) {\n    if (event.keyCode === 13) {\n      event.stopPropagation();\n      event.preventDefault();\n      this.ok();\n      return false;\n    }\n  }.bind(this));\n}","useCoreAPI":false,"core":false},"j1c3811fb511de72":{"_id":"j1c3811fb511de72","component":"DialogExport","state":"show","action":"function show() { \n  $('#designer-dialog-export-modal').modal('show');\n}","useCoreAPI":false,"core":false},"o11bf7168fa1a773":{"_id":"o11bf7168fa1a773","component":"DialogExport","state":"hide","action":"function hide() { \n  $('#designer-dialog-export-modal').modal('hide');\t\n}","useCoreAPI":false,"core":false},"l15e6a1e7711d0ef":{"_id":"l15e6a1e7711d0ef","component":"DialogSchemaCreation","state":"init","action":"function init(conf) { \n  var html = '',\n      dom = null;\n\n  $('#designer-dialog').empty();\n\n  html = this.require('dialog-modal-schema-creation.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n        .replace(/{{title}}/gi, this.title())\n  );\n\n  //events\n  dom = document.getElementById('designer-dialog-schema-creation-name');\n  dom.addEventListener('keydown', function keydown(event) {\n    if (event.keyCode === 13) {\n      event.stopPropagation();\n      event.preventDefault();\n      if ($('#designer-dialog-schema-creation-name').val()) {\n        this.ok();\n      }\n      return false;\n    }\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-schema-creation-modal-cancel');\n  dom.addEventListener('click', function click(event) {\n    this.cancel();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-schema-creation-modal-ok');\n  dom.addEventListener('click', function click(event) {\n    this.ok();\n  }.bind(this));\n\n  // focus\n  $('#designer-dialog-schema-creation-modal').on('shown.bs.modal', function modal() {\n    $('#designer-dialog-schema-creation-name').focus();\n  });\n}","useCoreAPI":false,"core":false},"d1118d16e2b12b21":{"_id":"d1118d16e2b12b21","component":"DialogSchemaCreation","state":"show","action":"function show() { \n  $('#designer-dialog-schema-creation-modal').modal('show');\n}","useCoreAPI":false,"core":false},"o121e11a6ee1db91":{"_id":"o121e11a6ee1db91","component":"DialogSchemaCreation","state":"hide","action":"function hide() { \n  $('#designer-dialog-schema-creation-modal').modal('hide');\n}","useCoreAPI":false,"core":false},"w1f7a8132f216d1c":{"_id":"w1f7a8132f216d1c","component":"DialogSystemCreation","state":"init","action":"function init(conf) { \n  var html = '',\n      dom = null;\n\n  $('#designer-dialog').empty();\n\n  html = this.require('dialog-modal-system-creation.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n        .replace(/{{title}}/gi, this.title())\n  );\n\n  //events\n  dom = document.getElementById('designer-dialog-system-creation-name');\n  dom.addEventListener('keydown', function keydown(event) {\n    if (event.keyCode === 13) {\n      event.stopPropagation();\n      event.preventDefault();\n      if ($('#designer-dialog-system-creation-name').val()) {\n        this.ok();\n      }\n      return false;\n    }\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-system-creation-modal-cancel');\n  dom.addEventListener('click', function click(event) {\n    this.cancel();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-system-creation-modal-ok');\n  dom.addEventListener('click', function click(event) {\n    this.ok();\n  }.bind(this));\n\n  // focus\n  $('#designer-dialog-system-creation-modal').on('shown.bs.modal', function modal() {\n    $('#designer-dialog-system-creation-name').focus();\n  });\n}","useCoreAPI":false,"core":false},"e1e6ca1015e1d465":{"_id":"e1e6ca1015e1d465","component":"DialogSystemCreation","state":"show","action":"function show() { \n  $('#designer-dialog-system-creation-modal').modal('show');\n}","useCoreAPI":false,"core":false},"m10f82178e11130e":{"_id":"m10f82178e11130e","component":"DialogSystemCreation","state":"hide","action":"function hide() { \n  $('#designer-dialog-system-creation-modal').modal('hide');\n}","useCoreAPI":false,"core":false},"l1188a196431b09d":{"_id":"l1188a196431b09d","component":"DialogModelCreation","state":"init","action":"function init(conf) { \n  var html = '',\n      dom = null;\n\n  $('#designer-dialog').empty();\n\n  html = this.require('dialog-modal-model-creation.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n        .replace(/{{title}}/gi, this.title())\n  );\n\n  dom = document.getElementById('designer-dialog-model-creation-modal-ok');\n  dom.addEventListener('click', function click(event) {\n    this.ok();\n  }.bind(this));\t\n  \n  dom = document.getElementById('designer-dialog-model-creation-modal');\n  dom.addEventListener('keydown', function keydown(event) {\n    if (event.keyCode === 13) {\n      event.stopPropagation();\n      event.preventDefault();\n      this.ok();\n      return false;\n    }\n  }.bind(this));\n}","useCoreAPI":false,"core":false},"v1f50e113f9119f9":{"_id":"v1f50e113f9119f9","component":"DialogModelCreation","state":"show","action":"function show() { \n  $('#designer-dialog-model-creation-modal').modal('show');\n}","useCoreAPI":false,"core":false},"t122401bc301f40a":{"_id":"t122401bc301f40a","component":"DialogModelCreation","state":"hide","action":"function hide() { \n  $('#designer-dialog-model-creation-modal').modal('hide');\n}","useCoreAPI":false,"core":false},"n1de871334c1351c":{"_id":"n1de871334c1351c","component":"DialogBehaviorCreation","state":"init","action":"function init(conf) { \n  var html = '',\n      dom = null,\n      selectStates = '',\n      states = [],\n      factory = this.require('factory'),\n      space = this.require('state').space();\n\n  $('#designer-dialog').empty();\n\n  states = factory.getModelPaths(space);\n  states.forEach(\n    function (name) {\n      selectStates = selectStates + '<option value=\"' + name + '\">' + name + '</option>';\n  });\n\n  html = this.require('dialog-modal-behavior-creation.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n        .replace(/{{title}}/gi, this.title())\n        .replace(/{{states}}/gi, selectStates)\n  );\n\n  //events\n  dom = document.getElementById('designer-dialog-behavior-creation-state');\n  dom.addEventListener('keydown', function (event) {\n    if (event.keyCode === 13) {\n      event.stopPropagation();\n      event.preventDefault();\n      if ($('#designer-dialog-behavior-creation-state').val()) {\n        this.ok();\n      }\n      return false;\n    }\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-behavior-creation-modal-cancel');\n  dom.addEventListener('click', function click(event) {\n    this.cancel();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-behavior-creation-modal-ok');\n  dom.addEventListener('click', function click(event) {\n    this.ok();\n  }.bind(this));\n\n  // focus\n  $('#designer-dialog-behavior-creation-modal').on('shown.bs.modal', function modal() {\n    $('#designer-dialog-behavior-creation-state').focus();\n  });\n}","useCoreAPI":false,"core":false},"z134f51d13d1b4d0":{"_id":"z134f51d13d1b4d0","component":"DialogBehaviorCreation","state":"show","action":"function show() { \n  $('#designer-dialog-behavior-creation-modal').modal('show');\n}","useCoreAPI":false,"core":false},"b17f0312b751a46c":{"_id":"b17f0312b751a46c","component":"DialogBehaviorCreation","state":"hide","action":"function hide() { \n  $('#designer-dialog-behavior-creation-modal').modal('hide');\n}","useCoreAPI":false,"core":false},"q1b5f114b1c1e74e":{"_id":"q1b5f114b1c1e74e","component":"DialogComponentCreation","state":"init","action":"function init(conf) { \n  var html = '',\n      name = '',\n      dom = null,\n      selectModels = '',\n      designer = this.require('designer'),\n      models = this.require('factory').system().models();\n\n  $('#designer-dialog').empty();\n\n  for (name in models) {\n    selectModels = selectModels + '<option value=\"' + name + '\">' + name + '</option>';\n  }\n\n  html = this.require('dialog-modal-component-creation.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n        .replace(/{{title}}/gi, this.title())\n        .replace(/{{models}}/gi, selectModels)\n  );\n\n  // events\n  dom = document.getElementById('designer-dialog-component-creation-modal-cancel');\n  dom.addEventListener('click', function click(event) {\n    this.cancel();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-component-creation-modal-ok');\n  dom.addEventListener('click', function click(event) {\n    this.ok();\n  }.bind(this));\n}","useCoreAPI":false,"core":false},"r1efd0102531db59":{"_id":"r1efd0102531db59","component":"DialogComponentCreation","state":"show","action":"function show() { \n  $('#designer-dialog-component-creation-modal').modal('show');\n}","useCoreAPI":false,"core":false},"t1250217bbe111b1":{"_id":"t1250217bbe111b1","component":"DialogComponentCreation","state":"hide","action":"function hide() { \n  $('#designer-dialog-component-creation-modal').modal('hide');\n}","useCoreAPI":false,"core":false},"r1b0d81aa7d163d1":{"_id":"r1b0d81aa7d163d1","component":"DialogComponentInfo","state":"init","action":"function init(conf) { \n  var html = '',\n      dom = null;\n\n  $('#designer-dialog').empty();\n\n  html = this.require('dialog-modal-component-info.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n        .replace(/{{title}}/gi, this.title())\n  );\n\n  // events\n  dom = document.getElementById('designer-dialog-component-info-modal-ok');\n  dom.addEventListener('click', function click(event) {\n    this.hide();\n  }.bind(this));\t\n}","useCoreAPI":false,"core":false},"n10b6a1d0411f758":{"_id":"n10b6a1d0411f758","component":"DialogComponentInfo","state":"show","action":"function show() { \n  $('#designer-dialog-component-info-modal').modal('show');\n}","useCoreAPI":false,"core":false},"n1cb8f1f6981f0b8":{"_id":"n1cb8f1f6981f0b8","component":"DialogComponentInfo","state":"hide","action":"function hide() { \n  $('#designer-dialog-component-info-modal').modal('hide');\n}","useCoreAPI":false,"core":false},"p14fb71056d1c4e5":{"_id":"p14fb71056d1c4e5","component":"DialogSearch","state":"init","action":"function init(conf) { \n  var html = '',\n      dom = null,\n      system = this.require('factory').system(),\n      search  = null;\n\n  $('#designer-dialog').empty();\n\n  html = this.require('dialog-modal-search.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n        .replace(/{{title}}/gi, this.title())\n  );\n\n  //events\n  dom = document.getElementById('designer-dialog-search-modal-ok');\n  dom.addEventListener('click', function click(event) {\n    this.ok();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-search-result');\n  dom.addEventListener('click', function click(event) {\n    this.hide();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-input-search');\n  dom.addEventListener('keyup', function keyup(event) {\n    var currentSelection = 0;\n    \n    switch (true) {\n      case event.keyCode === 37:\n      case event.keyCode === 39:\n        event.stopPropagation();\n        event.preventDefault();\n        return false;\n        break;\n      case event.keyCode === 13:\n        if (this.currentSelection() >= 0) {\n          document.getElementsByClassName('list-group-item active')[0].click();\n        } else {\n          this.hide();\n        }\n        event.stopPropagation();\n        event.preventDefault();\n        return false;\n        break;\n      case event.keyCode === 38:\n        currentSelection = this.currentSelection();\n        if (currentSelection > 0) {\n          $($('.list-group a')[currentSelection]).removeClass('active');\n          currentSelection = currentSelection - 1;\n          this.currentSelection(currentSelection);\n          $($('.list-group a')[currentSelection]).addClass('active');\n          $($('.list-group a')[currentSelection])[0].scrollIntoView();\n        }\n        event.stopPropagation();\n        event.preventDefault();\n        return false;\n        break;\n      case event.keyCode === 40:\n        currentSelection = this.currentSelection();\n        if (currentSelection < this.nbResult() -1) {\n          $($('.list-group a')[currentSelection]).removeClass('active');\n          currentSelection = currentSelection + 1;\n          this.currentSelection(currentSelection);\n          $($('.list-group a')[currentSelection]).addClass('active');\n          $($('.list-group a')[currentSelection])[0].scrollIntoView();\n        }\n        event.stopPropagation();\n        event.preventDefault();\n        return false;\n        break;\n      default:\n        this.filter(event.target.value);\n        if (typeof sessionStorage !== 'undefined') {\n          sessionStorage.setItem('system-designer-search', event.target.value);\n        }\n        break;\n    }\n  }.bind(this));\n\n  dom.addEventListener('keydown', function keydown(event) {\n    if (event.keyCode === 13 || event.keyCode === 38 || event.keyCode === 40) {\n      event.stopPropagation();\n      event.preventDefault();\n      return false;\n    }\n  }.bind(this));\n\n  // focus\n  $('#designer-dialog-search-modal').on('shown.bs.modal', function modal() {\n    $('#designer-dialog-input-search').focus();\n  });\n\n  // set old search if any\n  if (typeof sessionStorage !== 'undefined') {\n    search = sessionStorage.getItem('system-designer-search');\n    if (search !== null) {\n      $('#designer-dialog-input-search').val(search);\n      this.filter(search);\n    }\n  }\n  \n  $('#designer-dialog-search-result-area').hide();\n}","useCoreAPI":false,"core":false},"i1f2a414c501ccef":{"_id":"i1f2a414c501ccef","component":"DialogSearch","state":"show","action":"function show() { \n  $('#designer-dialog-search-modal').modal('show');\n}","useCoreAPI":false,"core":false},"m113f71766a1a35a":{"_id":"m113f71766a1a35a","component":"DialogSearch","state":"hide","action":"function hide() { \n  $('#designer-dialog-search-modal').modal('hide');\n}","useCoreAPI":false,"core":false},"a1782f14fca18eba":{"_id":"a1782f14fca18eba","component":"DialogExtension","state":"show","action":"function show() { \n  $('#designer-dialog-extension-modal').modal('show');\n}","useCoreAPI":false,"core":false},"r1a97f1be45125db":{"_id":"r1a97f1be45125db","component":"DialogExtension","state":"hide","action":"function hide() { \n  $('#designer-dialog-extension-modal').modal('hide');\n}","useCoreAPI":false,"core":false},"y1cef2194f4195d5":{"_id":"y1cef2194f4195d5","component":"DialogExtension","state":"init","action":"function init(conf) { \n\tvar html = '',\n      dom = null,\n      extensions = [],\n      extensionsUninstalled = [],\n      extension = '',\n      listExtensions = '',\n      listExtensionsUninstalled ='',\n      systems = null,\n      sys = '',\n      system = null,\n      length = 0,\n      i = 0,\n      that = this,\n      nbExtensionToAdd = 0,\n      nbExtensionUninstalled = 0,\n      nbExtensionInstalled = 0,\n      isSystemContainsExtension = false;\n\n  $('.modal-backdrop').remove();\n  $('#designer-dialog').empty();\n  \n  // init extensions list\n  extensions = this.require('db').collections().Extension.find({\n    'installed': true\n  });\n  \n  nbExtensionInstalled = extensions.length;\n  for (i = 0; i < nbExtensionInstalled; i++) {\n    extension = this.require(extensions[i]._id);\n\n    listExtensions = listExtensions + '<a class=\"list-group-item\" id=\"designer-dialog-extension-modal-extensions-' + extension.id() + '\">' +\n      '<h4 class=\"list-group-item-heading\">' + extension.source().description.substr(0, 40).split('\\n')[0].split('.')[0] + '</h4>' +\n      '<p class=\"list-group-item-text\">v' + extension.source().version + '</p>' +\n      '</a>';\n  }\n  if (nbExtensionInstalled === 0) {\n    listExtensions = '<a class=\"list-group-item\"><h4 class=\"list-group-item-heading\">No extension found</h4></a>';\n  }\n  \n  // init extensions uninstalled list\n  extensionsUninstalled = this.require('db').collections().Extension.find({\n    'isCore': true\n  });\n  \n  nbExtensionUninstalled = extensionsUninstalled.length;\n  for (i = 0; i < nbExtensionUninstalled; i++) {\n    extension = this.require(extensionsUninstalled[i]._id);\n\n    listExtensionsUninstalled = listExtensionsUninstalled + '<a class=\"list-group-item\" id=\"designer-dialog-extension-modal-uninstalled-extensions-' + extension.id() + '\">' +\n      '<h4 class=\"list-group-item-heading\">' + extension.source().description.substr(0, 40).split('\\n')[0].split('.')[0] + '</h4>' +\n      '<p class=\"list-group-item-text\">v' + extension.source().version + '</p>' +\n      '</a>';\n  }\n  if (nbExtensionUninstalled === 0) {\n    listExtensionsUninstalled = '<a class=\"list-group-item\"><h4 class=\"list-group-item-heading\">No extension found</h4></a>';\n  }\n\n  // init systems list\n  systems = this.require('storage').get('system-designer-systems');\n  if (systems) {\n    systemIds = systems.systems;\n    nbExtensionToAdd = systemIds.length;\n  }\n\n  for (i = 0; i < nbExtensionToAdd; i++) {\n    system = this.require('storage').get(systemIds[i]);\n \n    if (system && system.name.indexOf('extension-') !== -1) {\n      isSystemContainsExtension = true;\n      sys = sys + '<a class=\"list-group-item\" id=\"designer-dialog-extension-modal-systems-' + system._id + '\">' +\n          '<h4 class=\"list-group-item-heading\">' + system.description.substr(0, 40).split('\\n')[0].split('.')[0] + '</h4>' +\n          '<p class=\"list-group-item-text\">v' + system.version + '</p>' +\n          '</a>';\n    }\n  }\n  \n  if (nbExtensionToAdd === 0) {\n    sys = '<a class=\"list-group-item\"><h4 class=\"list-group-item-heading\">No extension found</h4></a>';\n  }\n\n  html = this.require('dialog-modal-extension.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n     .replace(/{{title}}/gi, this.title())\n        .replace(/{{extensions}}/gi, listExtensions)\n        .replace(/{{uninstalled_extensions}}/gi, listExtensionsUninstalled)\n        .replace(/{{systems}}/gi, sys)\n  );\n  \n  // systems events  \n  var callbackSystemEvent = function cbSystemEvent(event) {\n    var id = '',\n        libraries = null,\n        length = 0,\n        i = 0;\n\n    if ($(this).hasClass('active')) {\n      $(this).removeClass('active');\n      that.data(null);\n    } else {\n      id = this.getAttribute('id').replace('designer-dialog-extension-modal-systems-', '');\n\n      that.data(that.require('storage').get(id));\n\n      // remove old active\n      libraries = document.getElementById('designer-dialog-extension-modal-systems');\n      length = libraries.children.length;\n      for (i = 0; i < length; i++) {\n        $(libraries.children[i]).removeClass('active');\n      }\n      \n      libraries = document.getElementById('designer-dialog-extension-modal-uninstalled-extensions');\n      length = libraries.children.length;\n      for (i = 0; i < length; i++) {\n        $(libraries.children[i]).removeClass('active');\n      }\n      \n      libraries = document.getElementById('designer-dialog-extension-modal-extensions');\n      length = libraries.children.length;\n      for (i = 0; i < length; i++) {\n        $(libraries.children[i]).removeClass('active');\n      }\n\n      // add current active\n      $(this).addClass('active');\n    }\n  };\n\n  for (i = 0; i < nbExtensionToAdd; i++) {\n    system = this.require('storage').get(systemIds[i]);\n\n    if (system && system.name.indexOf('extension-') !== -1) {\n      dom = document.getElementById('designer-dialog-extension-modal-systems-' + system._id);\n      dom.addEventListener('click', callbackSystemEvent);\n    }\n  }\n  \n  // uninstalled extensions events  \n  var callbackEvent = function cbEvent(event) {\n    var id = '',\n        libraries = null,\n        length = 0,\n        i = 0;\n\n    if ($(this).hasClass('active')) {\n      $(this).removeClass('active');\n      that.data(null);\n    } else {\n      id = this.getAttribute('id').replace('designer-dialog-extension-modal-uninstalled-extensions-', '');\n\n      that.data(that.require(id));\n\n      // remove old active\n      libraries = document.getElementById('designer-dialog-extension-modal-systems');\n      length = libraries.children.length;\n      for (i = 0; i < length; i++) {\n        $(libraries.children[i]).removeClass('active');\n      }\n      \n      libraries = document.getElementById('designer-dialog-extension-modal-uninstalled-extensions');\n      length = libraries.children.length;\n      for (i = 0; i < length; i++) {\n        $(libraries.children[i]).removeClass('active');\n      }\n      \n      libraries = document.getElementById('designer-dialog-extension-modal-extensions');\n      length = libraries.children.length;\n      for (i = 0; i < length; i++) {\n        $(libraries.children[i]).removeClass('active');\n      }\n\n      // add current active\n      $(this).addClass('active');\n    }\n  };\n  \n  for (i = 0; i < nbExtensionUninstalled; i++) {\n    extension = this.require(extensionsUninstalled[i]._id);\n\n    dom = document.getElementById('designer-dialog-extension-modal-uninstalled-extensions-' + extension.id());\n    dom.addEventListener('click', callbackEvent);\n  }\n\n  // extensions events  \n  var callbackEvent = function cbEvent(event) {\n    var id = '',\n        libraries = null,\n        length = 0,\n        i = 0;\n\n    if ($(this).hasClass('active')) {\n      $(this).removeClass('active');\n      that.data(null);\n    } else {\n      id = this.getAttribute('id').replace('designer-dialog-extension-modal-extensions-', '');\n\n      that.data(that.require(id));\n\n      // remove old active\n      libraries = document.getElementById('designer-dialog-extension-modal-systems');\n      length = libraries.children.length;\n      for (i = 0; i < length; i++) {\n        $(libraries.children[i]).removeClass('active');\n      }\n      \n      libraries = document.getElementById('designer-dialog-extension-modal-uninstalled-extensions');\n      length = libraries.children.length;\n      for (i = 0; i < length; i++) {\n        $(libraries.children[i]).removeClass('active');\n      }\n      \n      libraries = document.getElementById('designer-dialog-extension-modal-extensions');\n      length = libraries.children.length;\n      for (i = 0; i < length; i++) {\n        $(libraries.children[i]).removeClass('active');\n      }\n\n      // add current active\n      $(this).addClass('active');\n    }\n  };\n  \n  for (i = 0; i < nbExtensionInstalled; i++) {\n    extension = this.require(extensions[i]._id);\n\n    dom = document.getElementById('designer-dialog-extension-modal-extensions-' + extension.id());\n    dom.addEventListener('click', callbackEvent);\n  }\n  \n  dom = document.getElementById('designer-dialog-extension-modal-action-remove');\n  dom.addEventListener('click', function click(event) {\n    var libraries = [],\n        i = 0,\n        length = 0;\n    \n    this.data(null);\n    \n    libraries = document.getElementById('designer-dialog-extension-modal-systems');\n    length = libraries.children.length;\n    for (i = 0; i < length; i++) {\n      $(libraries.children[i]).removeClass('active');\n    }\n    \n    libraries = document.getElementById('designer-dialog-extension-modal-uninstalled-extensions');\n    length = libraries.children.length;\n    for (i = 0; i < length; i++) {\n      $(libraries.children[i]).removeClass('active');\n    }\n    \n    libraries = document.getElementById('designer-dialog-extension-modal-extensions');\n    length = libraries.children.length;\n    for (i = 0; i < length; i++) {\n      $(libraries.children[i]).removeClass('active');\n    }\n    \n    $('#designer-dialog-extension-modal-extensions-area').show();\n    $('#designer-dialog-extension-modal-systems-area').hide();\n    $('#designer-dialog-extension-modal-uninstalled-extensions-area').hide();\n    $('#designer-dialog-extension-modal-remove').show();\n    $('#designer-dialog-extension-modal-add').hide();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-extension-modal-action-add');\n  dom.addEventListener('click', function click(event) {\n    var libraries = [],\n        i = 0,\n        length = 0;\n    \n    this.data(null);\n    \n    libraries = document.getElementById('designer-dialog-extension-modal-systems');\n    length = libraries.children.length;\n    for (i = 0; i < length; i++) {\n      $(libraries.children[i]).removeClass('active');\n    }\n    \n    libraries = document.getElementById('designer-dialog-extension-modal-uninstalled-extensions');\n    length = libraries.children.length;\n    for (i = 0; i < length; i++) {\n      $(libraries.children[i]).removeClass('active');\n    }\n    \n    libraries = document.getElementById('designer-dialog-extension-modal-extensions');\n    length = libraries.children.length;\n    for (i = 0; i < length; i++) {\n      $(libraries.children[i]).removeClass('active');\n    }\n    \n    $('#designer-dialog-extension-modal-extensions-area').hide();\n    if (isSystemContainsExtension) {\n      $('#designer-dialog-extension-modal-systems-area').show();\n    }\n    $('#designer-dialog-extension-modal-uninstalled-extensions-area').show();\n    $('#designer-dialog-extension-modal-remove').hide();\n    $('#designer-dialog-extension-modal-add').show();\n  }.bind(this));\n  \n  // events\n  dom = document.getElementById('designer-dialog-extension-modal-cancel');\n  dom.addEventListener('click', function click(event) {\n    this.cancel();\n  }.bind(this));\n  \n  dom = document.getElementById('designer-dialog-extension-modal-add');\n  dom.addEventListener('click', function click(event) {\n    this.add();\n  }.bind(this));\n  \n  dom = document.getElementById('designer-dialog-extension-modal-remove');\n  dom.addEventListener('click', function click(event) {\n    this.remove();\n  }.bind(this));\n  \n  dom = document.getElementById('designer-dialog-extension-modal');\n  dom.addEventListener('keydown', function keydown(event) {\n    if (this.data() && event.keyCode === 13) {\n      event.stopPropagation();\n      event.preventDefault();\n      if ($('#designer-dialog-extension-modal-action-add').prop('checked')) {\n        this.add();\n      } else {\n        this.remove(); \n      }\n      return false;\n    }\n  }.bind(this));\n  \n  if (isSystemContainsExtension) {\n    $('#designer-dialog-extension-modal-systems-area').show();\n  }\n}","useCoreAPI":false,"core":false},"u11da5146311bf9b":{"_id":"u11da5146311bf9b","component":"DialogExtension","state":"add","action":"function add() { \n\tvar Extension = this.require('Extension'),\n\tdata = this.data(),\n\tsystem = {},\n\textension = null,\n\textensions = [],\n\textensionToSave = {\n\t  extensions: []\n\t},\n\tcleanJson = '',\n\treg = null,\n\tupdated = false,\n\tfromExtension = false;\n\t\n\tif (data && Object.keys(data).length) {\n  \tif (data.isCore) {\n  \t  fromExtension = true;\n  \t  system = data.source();\n  \t} else {\n  \t  system = this.data();\n  \t}\n  \n  \tif (system && Object.keys(system).length) {\n  \t  \n  \t  if (!fromExtension) {\n    \t  // update or add extension\n      \textensions = this.require('db').collections().Extension.find();\n    \n        extensions.forEach(function forEach(extension) {\n          if (extension.source._id === system._id) {\n            extension.source = system;\n            updated = true;\n          }\n        });\n    \n        if (!updated) {\n        \tnew Extension({\n        \t  'source': system,\n        \t  'installed': true\n        \t});\n        }\n  \t  } else {\n  \t    this.data().installed(true);\n  \t  }\n      \n      // save\n      extensions = this.require('db').collections().Extension.find();\n    \t\n    \textensionToSave.extensions = extensions.map(function map(extension) {\n    \t  var clean = JSON.parse(JSON.stringify(extension));\n    \t  return clean;\n    \t});\n      \n      this.require('storage').set('system-designer-extensions', extensionToSave);\n    \t\n    \t// install extension\n    \t// TODO put that in function\n    \tif (updated) {\n    \t  this.require('runtime').stop('ext_' + system._id);\n    \t  this.require('runtime').uninstall('ext_' + system._id);\n    \t}\n    \t\n      cleanJson = JSON.stringify(system);\n      reg = new RegExp(system._id, 'g');\n      cleanJson = cleanJson.replace(reg, 'ext_' + system._id);\n      system = JSON.parse(cleanJson);\n          \n    \tthis.require('runtime').install(system);\n    \tthis.require('menubar').render();\n    \tthis.require('toolbar').render();\n    \t\n    \tthis.hide();\n    \tthis.require('message').success('The extension has been added.');\n  \t}\n\t}\n}","useCoreAPI":false,"core":false},"h125f41b82b19da2":{"_id":"h125f41b82b19da2","component":"DialogExtension","state":"remove","action":"function remove() { \n\tvar extension = this.data(),\n\textensions = [],\n\textensionToSave = {\n\t  extensions: []\n\t};\n\t\n\tif (extension && Object.keys(extension).length) {\n  \t// TODO put that in function\n  \tthis.require('runtime').stop('ext_' + extension.source()._id);\n  \tthis.require('runtime').uninstall('ext_' + extension.source()._id);\n  \tthis.require('menubar').render();\n  \tthis.require('toolbar').render();\n  \t\n  \tif (extension.isCore()) {\n  \t  extension.installed(false);\n  \t} else {\n  \t  extension.destroy();\n  \t}\n  \t\n  \t// extensions\n  \textensions = this.require('db').collections().Extension.find();\n  \t\n  \textensionToSave.extensions = extensions.map(function map(extension) {\n  \t  var clean = JSON.parse(JSON.stringify(extension));\n  \t  return clean;\n  \t});\n    \n    this.require('storage').set('system-designer-extensions', extensionToSave);\n  \t\n  \tthis.hide();\n  \t\n  \tthis.require('message').success('The extension has been removed.');\n\t}\n}","useCoreAPI":false,"core":false},"w1e8901ec6f110c0":{"_id":"w1e8901ec6f110c0","component":"DialogSearch","state":"ok","action":"function ok() { \n  this.hide();\t\n}","useCoreAPI":false,"core":false},"l199a81e07b123f5":{"_id":"l199a81e07b123f5","component":"DialogSearch","state":"filter","action":"function filter(value) { \n  var systemId = this.require('factory').system().id(),\n    systemName = this.require('factory').system().name(),\n    schemas = this.require('factory').system().schemas(),\n    models = this.require('factory').system().models(),\n    types = this.require('factory').system().types(),\n    behaviors = this.require('factory').system().behaviors(),\n    components = this.require('factory').system().components(),\n    collection = '',\n    id = '',\n    toSearch = '',\n    index = -1,\n    result = [],\n    nbItems = 0,\n    nbResults = 0,\n    numberResult = {};\n    \n  function showResult(str, index, value) {\n    var result = '',\n        length = value.length;\n    \n    result = str.substring(index - 20, index + length + 20);\n    result = result.replace(/</g,'&lt;');\n    result = result.replace(value, '<b>' + value + '</b>');\n    \n    return result;\n  }  \n  \n  function showNumberResult(search, str) {\n    var result = '',\n        cleanSearch = '',\n        reg = null,\n        nb = null;\n    \n    cleanSearch = search.replace(/\\\\/g, '\\\\\\\\');\n    cleanSearch = cleanSearch.replace(/\\(/g, '\\\\(');\n    cleanSearch = cleanSearch.replace(/\\)/g, '\\\\)');\n    cleanSearch = cleanSearch.replace(/\\[/g, '\\\\[');\n    cleanSearch = cleanSearch.replace(/\\]/g, '\\\\]');\n    cleanSearch = cleanSearch.replace(/\\./g, '\\\\.');\n    cleanSearch = cleanSearch.replace(/\\+/g, '\\\\+');\n    cleanSearch = cleanSearch.replace(/\\*/g, '\\\\*');\n    cleanSearch = cleanSearch.replace(/\\$/g, '\\\\\\u0024');\n    \n    reg = new RegExp(cleanSearch, 'gi');\n    nb = str.match(reg);\n    \n    if (nb && nb.length) {\n      nbItems++;\n      nbResults = nbResults + nb.length;\n      result = '<span class=\"badge\">' + nb.length + '</span>';\n    }\n    \n    return {\n      'nb': nb.length,\n      'html': result\n      };\n  }\n  \n  function showInfoResult() {\n    var info = '';\n    \n    if (nbResults > 1) {\n      info = 'There are ' + nbResults + ' results';\n    } else {\n      info = 'There is '+ info + nbResults + ' result';\n    }\n    \n    info = info + ' in ';\n    \n    if (nbItems > 1) {\n      info = info + nbItems + ' elements';\n    } else {\n      info = info + nbItems + ' element';\n    }\n    \n    if (nbResults > 0) {\n      $('#designer-dialog-search-result-number').text(info);\n    } else {\n      $('#designer-dialog-search-result-number').text('');\n    }\n  }\n\n  // clean\n  document.getElementById('designer-dialog-search-result').innerHTML = '';\n\n  if (value.length > 0 && value.trim() !== '') {\n\n    // schema\n    for (id in schemas) {\n      toSearch = JSON.stringify(schemas[id]);\n      index = toSearch.toLowerCase().indexOf(value.toLowerCase());\n      if (index != -1) {\n        numberResult = showNumberResult(value, toSearch);\n        link = '<a href=\"#' + systemId + '#schemas#' + id + '\" class=\"list-group-item\" class=\"list-group-item active\">' +\n          '<h4 class=\"list-group-item-heading\">Schema ' + schemas[id]._name + ' ' + numberResult.html + '</h4>' +\n          '<p class=\"list-group-item-text\">...' + showResult(toSearch, index, value) + '...</p>' +\n          '</a>';\n\n        result.push({\n          'occurences': numberResult.nb,\n          'html': link\n        });\n      }\n    }\n\n    // model\n    for (id in models) {\n      toSearch = JSON.stringify(models[id]);\n      index = toSearch.toLowerCase().indexOf(value.toLowerCase());\n      if (index != -1) {\n        numberResult = showNumberResult(value, toSearch);\n        link = '<a href=\"#' + systemId + '#models#' + id + '\" class=\"list-group-item\" class=\"list-group-item active\">' +\n          '<h4 class=\"list-group-item-heading\">Model ' + models[id]._name + ' ' + numberResult.html + '</h4>' +\n          '<p class=\"list-group-item-text\">...' + showResult(toSearch, index, value) + '...</p>' +\n          '</a>';\n\n        result.push({\n          'occurences': numberResult.nb,\n          'html': link\n        });\n      }\n    }\n\n    // type\n    for (id in types) {\n      toSearch = JSON.stringify(types[id]);\n      index = toSearch.toLowerCase().indexOf(value.toLowerCase());\n      if (index != -1) {\n        numberResult = showNumberResult(value, toSearch);\n        link = '<a href=\"#' + systemId + '#types#' + types[id].name + '\" class=\"list-group-item\" class=\"list-group-item active\">' +\n          '<h4 class=\"list-group-item-heading\">Type ' + types[id].name + ' ' + numberResult.html + '</h4>' +\n          '<p class=\"list-group-item-text\">...' + showResult(toSearch, index, value) + '...</p>' +\n          '</a>';\n\n        result.push({\n          'occurences': numberResult.nb,\n          'html': link\n        });\n      }\n    }\n\n    // behavior\n    for (id in behaviors) {\n      toSearch = JSON.stringify(behaviors[id]);\n      index = toSearch.toLowerCase().indexOf(value.toLowerCase());\n      if (index != -1) {\n        numberResult = showNumberResult(value, toSearch);\n        link = '<a href=\"#' + systemId + '#behaviors#' + behaviors[id].component + '#' + behaviors[id].state + '\" class=\"list-group-item\" class=\"list-group-item active\">';\n          \n        if (behaviors[id].component === systemId) {\n          link = link + '<h4 class=\"list-group-item-heading\">Behavior ' + systemName + '.' + behaviors[id].state + ' ' + numberResult.html + '</h4>';\n        } else { \n          link = link + '<h4 class=\"list-group-item-heading\">Behavior ' + behaviors[id].component + '.' + behaviors[id].state + ' ' + numberResult.html + '</h4>';\n        }\n          \n        link = link + '<p class=\"list-group-item-text\">...' + showResult(behaviors[id].action, behaviors[id].action.toLowerCase().indexOf(value.toLowerCase()), value) + '...</p>' +\n        '</a>';\n\n        result.push({\n          'occurences': numberResult.nb,\n          'html': link\n        });\n      }\n    }\n\n    // components\n    for (collection in components) {\n      for (id in components[collection]) {\n        toSearch = JSON.stringify(components[collection][id]);\n        index = toSearch.toLowerCase().indexOf(value.toLowerCase());\n        if (index != -1) {\n          numberResult = showNumberResult(value, toSearch);\n          link = '<a href=\"#' + systemId + '#components#' + collection + '#' + id + '\" class=\"list-group-item\" class=\"list-group-item active\">' +\n            '<h4 class=\"list-group-item-heading\">Component ' + components[collection][id]._id + ' ' + numberResult.html + '</h4>' +\n            '<p class=\"list-group-item-text\">...' + showResult(toSearch, index, value) + '...</p>' +\n            '</a>';\n\n          result.push({\n            'occurences': numberResult.nb,\n            'html': link\n          });\n        }\n      }\n    }\n    \n    result.sort(function (resultA, resultB) {\n      if (resultA.occurences < resultB.occurences) {\n        return 1;\n      }\n      if (resultA.occurences > resultB.occurences) {\n        return -1;\n      }\n      return 0;\n    });\n    \n    showInfoResult();\n    \n    if (result.length === 0) {\n      this.nbResult(0);\n      result.push({\n        'occurences': 0,\n        'html': '<a class=\"list-group-item\"><h4 class=\"list-group-item-heading\">There is no result for your search</h4></a>'\n      });\n    } else {\n      this.nbResult(result.length);\n    }\n\n    // result\n    document.getElementById('designer-dialog-search-result').innerHTML = result.map(function(res) {\n      return res.html;\n    }).join(' ');\n    \n    if (this.nbResult() > 0) {\n      $('.list-group a:first').addClass('active');\n      this.currentSelection(0);\n    } else {\n      this.currentSelection(-1);\n    }\n    \n    $('#designer-dialog-search-result-area').show();\n    \n    if (this.nbResult() > 0) {\n      $('.list-group a:first')[0].scrollIntoView();\n    }\n    \n  } else {\n    $('#designer-dialog-search-result-area').hide();\n  }\n}","useCoreAPI":false,"core":false},"q1767e1d52d10d30":{"_id":"q1767e1d52d10d30","component":"DialogCommand","state":"init","action":"function init(conf) { \n  var html = '',\n      dom = null,\n      system = this.require('factory').system();\n\n  $('#designer-dialog').empty();\n\n  html = this.require('dialog-modal-command.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',html.source());\n\n  dom = document.getElementById('designer-dialog-input-command');\n  dom.addEventListener('keyup', function keyup(event) {\n    var currentSelection = 0;\n    \n    switch (true) {\n      case event.keyCode === 37:\n      case event.keyCode === 39:\n        event.stopPropagation();\n        event.preventDefault();\n        return false;\n        break;\n      case event.keyCode === 13:\n        if (this.currentSelection() > -1) {\n          $($('.list-group a')[this.currentSelection()]).click();\n        }\n        event.stopPropagation();\n        event.preventDefault();\n        return false;\n        break;\n      case event.keyCode === 38:\n        currentSelection = this.currentSelection();\n        if (currentSelection > 0) {\n          $($('.list-group a')[currentSelection]).removeClass('active');\n          currentSelection = currentSelection - 1;\n          this.currentSelection(currentSelection);\n          $($('.list-group a')[currentSelection]).addClass('active');\n          $($('.list-group a')[currentSelection])[0].scrollIntoView();\n        }\n        event.stopPropagation();\n        event.preventDefault();\n        return false;\n        break;\n      case event.keyCode === 40:\n        currentSelection = this.currentSelection();\n        if (currentSelection < this.nbResult() -1) {\n          $($('.list-group a')[currentSelection]).removeClass('active');\n          currentSelection = currentSelection + 1;\n          this.currentSelection(currentSelection);\n          $($('.list-group a')[currentSelection]).addClass('active');\n          $($('.list-group a')[currentSelection])[0].scrollIntoView();\n        }\n        event.stopPropagation();\n        event.preventDefault();\n        return false;\n        break;\n      default:\n        this.filter(event.target.value);\n        break;\n    }\n  }.bind(this));\n\n  dom.addEventListener('keydown', function keydown(event) {\n    if (event.keyCode === 13 || event.keyCode === 38 || event.keyCode === 40) {\n      event.stopPropagation();\n      event.preventDefault();\n      return false;\n    }\n  }.bind(this));\n\n  // focus\n  $('#designer-dialog-command-modal').on('shown.bs.modal', function modal() {\n    $('#designer-dialog-input-command').focus();\n  });\n  \n  $('#designer-dialog-command-result-area').hide();\n}","useCoreAPI":false,"core":false},"v1b469169cd19052":{"_id":"v1b469169cd19052","component":"DialogCommand","state":"filter","action":"function filter(value) { \n  var systemId = this.require('factory').system().id(),\n    systemName = this.require('factory').system().name(),\n    schemas = this.require('factory').system().schemas(),\n    models = this.require('factory').system().models(),\n    types = this.require('factory').system().types(),\n    behaviors = this.require('factory').system().behaviors(),\n    components = this.require('factory').system().components(),\n    collection = '',\n    id = '',\n    toSearch = '',\n    index = -1,\n    result = [];\n    \n  // clean\n  document.getElementById('designer-dialog-command-result').innerHTML = '';\n  \n  function hasValues(val, str) {\n    var result = true,\n        values = [];\n        \n    values = val.split(' ');\n    \n    values.forEach(function (value) {\n      if (str.toLowerCase().indexOf(value.toLowerCase()) === -1) {\n        result = false;\n      }\n    });\n    \n    return result;\n  }\n\n  if (value.length > 0 && value.trim() !== '') {\n\n    // schema\n    for (id in schemas) {\n      if (hasValues(value, 'Schema ' + schemas[id]._name)) {\n        link = '<a class=\"list-group-item\" class=\"list-group-item active\" onclick=\"$(\\'#designer-dialog-command-modal\\').modal(\\'hide\\'); runtime.require(\\'designer\\').open(\\'schema.html#' + id + '#' + systemId + '\\', \\'' + id + '\\');\">' +\n          '<h4 class=\"list-group-item-heading\">Schema ' + schemas[id]._name + '</h4>' +\n          '</a>';\n\n        result.push(link);\n      }\n    }\n\n    // model\n    for (id in models) {\n      if (hasValues(value, 'Model ' + models[id]._name)) {\n        link = '<a class=\"list-group-item\" class=\"list-group-item active\" onclick=\"$(\\'#designer-dialog-command-modal\\').modal(\\'hide\\'); runtime.require(\\'designer\\').open(\\'model.html#' + id + '#' + systemId + '\\', \\'' + id + '\\');\">' +\n          '<h4 class=\"list-group-item-heading\">Model ' + models[id]._name + '</h4>' +\n          '</a>';\n\n        result.push(link);\n      }\n    }\n\n    // type\n    for (id in types) {\n      if (hasValues(value, 'Type ' + types[id].name)) {\n        link = '<a class=\"list-group-item\" class=\"list-group-item active\" onclick=\"$(\\'#designer-dialog-command-modal\\').modal(\\'hide\\'); runtime.require(\\'designer\\').open(\\'type.html#' + id + '#' + systemId + '\\', \\'' + id + '\\');\">' +\n          '<h4 class=\"list-group-item-heading\">Type ' + types[id].name + '</h4>' +\n          '</a>';\n\n        result.push(link);\n      }\n    }\n\n    // behavior\n    for (id in behaviors) {\n      var fullName = behaviors[id].component + '.' + behaviors[id].state;\n      if (behaviors[id].component === systemId) {\n        fullName = systemName + '.' + behaviors[id].state;\n      }\n      if (hasValues(value, 'Behavior ' + fullName)) {\n        link = '<a class=\"list-group-item\" class=\"list-group-item active\" onclick=\"$(\\'#designer-dialog-command-modal\\').modal(\\'hide\\'); runtime.require(\\'designer\\').open(\\'behavior.html#' + id + '#' + systemId + '\\', \\'' + id + '\\');\">';\n          \n        if (behaviors[id].component === systemId) {\n          link = link + '<h4 class=\"list-group-item-heading\">Behavior ' + systemName + '.' + behaviors[id].state + '</h4>';\n        } else { \n          link = link + '<h4 class=\"list-group-item-heading\">Behavior ' + behaviors[id].component + '.' + behaviors[id].state + '</h4>';\n        }\n        '</a>';\n\n        result.push(link);\n      }\n    }\n\n    // components\n    for (collection in components) {\n      for (id in components[collection]) {\n        if (hasValues(value, 'Component' + components[collection][id]._id)) {\n          link = '<a class=\"list-group-item\" class=\"list-group-item active\" onclick=\"$(\\'#designer-dialog-command-modal\\').modal(\\'hide\\'); runtime.require(\\'designer\\').open(\\'component.html#' + id + '#' + encodeURIComponent(collection) + '#' + encodeURIComponent(systemId) + '\\', \\'' + id + '\\');\">' +\n            '<h4 class=\"list-group-item-heading\">Component ' + components[collection][id]._id + '</h4>' +\n            '</a>';\n\n          result.push(link);\n        }\n      }\n    }\n    \n    if (result.length === 0) {\n      this.nbResult(0);\n      result.push('<a class=\"list-group-item\"><h4 class=\"list-group-item-heading\">There is no result</h4></a>');\n    } else {\n      this.nbResult(result.length);\n    }\n\n    // result\n    document.getElementById('designer-dialog-command-result').innerHTML = result.join(' ');\n    \n    if (this.nbResult() > 0) {\n      $('.list-group a:first').addClass('active');\n      this.currentSelection(0);\n    } else {\n      this.currentSelection(-1);\n    }\n    \n    $('#designer-dialog-command-result-area').show();\n    \n    if (this.nbResult() > 0) {\n      $($('.list-group a')[0])[0].scrollIntoView();\n    }\n  } else {\n    $('#designer-dialog-command-result-area').hide();\n  }\n}","useCoreAPI":false,"core":false},"v1626c1b34014385":{"_id":"v1626c1b34014385","component":"DialogCommand","state":"show","action":"function show() { \n $('#designer-dialog-command-modal').modal('show');\t\n}","useCoreAPI":false,"core":false},"a10153101bc1a2ef":{"_id":"a10153101bc1a2ef","component":"DialogCommand","state":"hide","action":"function hide() { \n  $('#designer-dialog-command-modal').modal('hide');\t\n}","useCoreAPI":false,"core":false},"o1007d12b0a1a3e3":{"_id":"o1007d12b0a1a3e3","component":"DialogDelete","state":"init","action":"function init(conf) { \n  var html = '',\n      dom = null;\n\n  // empty area\n  $('#designer-dialog').empty();\n\n  // render\n  html = this.require('dialog-modal-delete.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n      .replace(/{{title}}/gi, this.title())\n      .replace(/{{message}}/gi, this.message())\n  );\n\n  // events\n  dom = document.getElementById('designer-dialog-delete-cancel');\n  dom.addEventListener('click', function click(event) {\n    this.cancel();\n  }.bind(this));\n  \n  dom = document.getElementById('designer-dialog-delete-ok');\n  dom.addEventListener('click', function click(event) {\n    this.ok();\n  }.bind(this));\t\n  \n  dom = document.getElementById('designer-dialog-delete-modal');\n  dom.addEventListener('keydown', function keydown(event) {\n    if (event.keyCode === 13) {\n      this.ok();\n      event.stopPropagation();\n      event.preventDefault();\n      return false;\n    }\n  }.bind(this));\n  \n  // show\n  $('#designer-dialog-delete-modal').modal('show');\t\t\n}","useCoreAPI":false,"core":false},"b190621a3cf139b0":{"_id":"b190621a3cf139b0","component":"DialogDelete","state":"hide","action":"function hide() { \n  $('#designer-dialog-delete-modal').modal('hide');\t\n}","useCoreAPI":false,"core":false},"z19b6c1e87e10065":{"_id":"z19b6c1e87e10065","component":"DialogDelete","state":"show","action":"function show() { \n  $('#designer-dialog-delete-modal').modal('show');\t\n}","useCoreAPI":false,"core":false},"a110631fc9a10b17":{"_id":"a110631fc9a10b17","component":"DialogDelete","state":"cancel","action":"function cancel() { \n  this.hide();\t\n}","useCoreAPI":false,"core":false},"b1f8331ef3b19fb8":{"_id":"b1f8331ef3b19fb8","component":"DialogExport","state":"ok","action":"function ok() { \n  var message = this.require('message');\n  // code inspired from the blog post\n  // https://thiscouldbebetter.wordpress.com/2012/12/18/loading-editing-and-saving-a-text-file-in-html5-using-javascrip/\n  if (this.require('factory').system()) {\n    var system = null,\n      textToWrite = null,\n      textFileAsBlob = null,\n      fileNameToSaveAs = null,\n      downloadLink = null;\n\n    system = this.require('db').collections().System.find({\n      '_id': this.require('factory').system().id()\n    })[0];\n    system = JSON.parse(JSON.stringify(system));\n\n    switch (true) {\n      case $('#designer-dialog-export-json').prop('checked'):\n        textToWrite = this.require('export').toJSON($('#designer-dialog-export-isMaster').prop('checked'));\n        fileNameToSaveAs = this.require('factory').system().name() + '.json';\n        break;\n      case $('#designer-dialog-export-javascript').prop('checked'):\n        textToWrite = this.require('export').toJavaScript($('#designer-dialog-export-options-log-level-select').val());\n        fileNameToSaveAs = this.require('factory').system().name() + '.js';\n        break;\n      case $('#designer-dialog-export-html').prop('checked'):\n        textToWrite = this.require('export').toHTML($('#designer-dialog-export-options-log-level-select').val());\n        fileNameToSaveAs = this.require('factory').system().name() + '.html';\n        break;\n      case $('#designer-dialog-export-node').prop('checked'):\n        textToWrite = this.require('export').toNode($('#designer-dialog-export-options-log-level-select').val());\n        fileNameToSaveAs = this.require('factory').system().name() + '.js';\n        break;\n      case $('#designer-dialog-export-graphviz').prop('checked'):\n        textToWrite = this.require('export').toGraphviz($('#designer-dialog-export-options-diagram-type-select').val());\n        fileNameToSaveAs = this.require('factory').system().name() + '.gv';\n        break;\n      default:\n        break;\n    }\n\n    if (!this.require('designer').isElectron()) {\n\n      textFileAsBlob = new Blob([textToWrite], {\n        type: 'application/octet-stream'\n      });\n\n      if (navigator.msSaveBlob) {\n        navigator.msSaveBlob(textFileAsBlob, fileNameToSaveAs);\n      } else {\n        downloadLink = document.createElement('a');\n        document.body.appendChild(downloadLink);\n        downloadLink.style.display = 'none';\n                \n        downloadLink.download = fileNameToSaveAs;\n        downloadLink.href = window.URL.createObjectURL(textFileAsBlob);\n        \n        downloadLink.click();\n        window.URL.revokeObjectURL(downloadLink.href);\n      }\n\n      this.hide();\n    } else {\n      this.hide();\n\n      var { dialog } = require('electron').remote;\n      var fs = require('fs');\n\n      dialog.showSaveDialog({\n          'defaultPath': '~/' + fileNameToSaveAs\n        }).then(function(ret) {\n          var savePath = ret.filePath; \n          if (savePath) {\n            fs.writeFile(savePath, textToWrite, function(err) {\n              if (err) {\n                message.danger('Exportation failed.');\n              } else {\n                message.success('Exportation is done.');\n              }\n            });\n          }\n      });\n    }\n  } else {\n    message.warning('There is no system to export.');\n  }\n}","useCoreAPI":false,"core":false},"m1ce691dc881ef9b":{"_id":"m1ce691dc881ef9b","component":"DialogSystemCreation","state":"ok","action":"function ok() { \n  var designer = this.require('designer'),\n    that = this,\n    name = null,\n    system = {},\n    ModelSystem = null,\n    modelSystem = null;\n  \n  function canCreate(name) {\n    var systems = that.require('storage').get('system-designer-systems'),\n      systemIds = [],\n      i = 0,\n      result = true;\n  \n    if (systems) {\n      systemIds = systems.systems;\n    }\n    length = systemIds.length;\n  \n    for (i = 0; i < length; i++) {\n      system = that.require('storage').get(systemIds[i]);\n      \n      if (!system || system.name === name) {\n        result = false;\n        break;\n      }\n    }\n    \n    // internal default name\n    if (name === 'default') {\n      result = false;\n    }\n  \n    return result;\n  }\n  \n  // get value\n  name = $('#designer-dialog-system-creation-name').val();\n  \n  // clean\n  name = name.trim();\n  name = name.replace(/\\s|\\t/gi, '-').replace(/[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\`\\{\\|\\}\\~]/gi, '');\n  \n  if (name && canCreate(name)) {\n  \n    system = this.require('factory').create({'name': name}, true);\n  \n    ModelSystem = this.require('ModelSystem');\n    modelSystem = new ModelSystem({\n      'title': name\n    });\n    modelSystem.uuid = system._id;\n    modelSystem.document(JSON.parse(JSON.stringify(system)));\n    modelSystem.content(JSON.stringify(system));\n  \n    designer.save();\n  \n    this.hide();\n    \n    // hide log if any\n    $('#designer-menu-item-logs-number').hide();\n    document.querySelector('#designer-menu-item-logs-number').innerHTML = 0;\n              \n    this.require('message-help').remove();\n  \n    this.require('state').space(name);\n  \n    this.require('spaces').render();\n    this.require('workspace').render();\n  \n    this.require('message').success('System created. You can now begin to create schemas.');\n  }\n}","useCoreAPI":false,"core":false},"z1b97f16c7f167ef":{"_id":"z1b97f16c7f167ef","component":"DialogSchemaCreation","state":"ok","action":"function ok() { \n  var designer = this.require('designer'),\n    that = this,\n    name = null,\n    schema = {},\n    ModelSchema = null,\n    modelSchema = null;\n  \n  function canCreate(name) {\n    var result = true,\n      id = '';\n  \n    for (id in that.require('factory').system().schemas()) {\n      if (that.require('factory').system().schemas()[id]._name === name) {\n        result = false;\n        break;\n      }\n    }\n  \n    if (that.require('factory').system().name() === name) {\n      result = false;\n    }\n  \n    return result;\n  }\n  \n  // get value\n  name = $('#designer-dialog-schema-creation-name').val();\n  \n  // clean\n  name = name.trim();\n  name = name.replace(/\\s|\\t/gi, '_').replace(/[\\-\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\`\\{\\|\\}\\~]/gi, '');\n  \n  if (name && canCreate(name)) {\n    schema = this.require('factory').addSchema(name);\n  \n    ModelSchema = this.require('ModelSchema');\n    modelSchema = new ModelSchema({\n      'title': name\n    });\n  \n    modelSchema.document(JSON.parse(JSON.stringify(schema)));\n    modelSchema.content(JSON.stringify(schema));\n    modelSchema.uuid(schema._id);\n  \n    this.require('designer').save();\n  \n    this.require('factory').createModel(schema);\n  \n    this.require('designer').save();\n  \n    this.require('channel').$designerCreateSchema(name, schema);\n  \n    this.hide();\n    this.require('message-help').remove();\n  \n    this.require('state').space(schema._id);\n  \n    this.require('spaces').render();\n    this.require('workspace').render();\n  \n    this.require('router').update();\n  \n    this.require('message').success('Schema created. A model has been also generated.');\n  }\n}","useCoreAPI":false,"core":false},"x18f131fc0f15c28":{"_id":"x18f131fc0f15c28","component":"DialogModelCreation","state":"ok","action":"function ok() { \n  this.hide();\n}","useCoreAPI":false,"core":false},"d1fe2a1b48a1ac00":{"_id":"d1fe2a1b48a1ac00","component":"DialogTypeCreation","state":"ok","action":"function ok() { \n  var designer = this.require('designer'),\n    name = null,\n    isEnum = false,\n    type = {},\n    ModelType = null,\n    modelType = null,\n    id = '',\n    that = this;\n    \n  function canCreate(name) {\n    var result = true,\n      id = '';\n  \n    for (id in that.require('factory').system().types()) {\n      if (that.require('factory').system().types()[id].name === name) {\n        result = false;\n        break;\n      }\n    }\n  \n    if (that.require('factory').system().name() === name) {\n      result = false;\n    }\n  \n    return result;\n  }\n  \n  // get value\n  name = $('#designer-dialog-type-creation-name').val();\n  isEnum = $('#designer-dialog-type-creation-isEnum')[0].checked;\n  \n  // clean\n  name = name.trim();\n  name = name.replace(/\\s|\\t/gi, '_').replace(/[\\-\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\`\\{\\|\\}\\~]/gi, '');\n  \n  if (name && canCreate(name)) {\n    type = this.require('factory').addType(name, isEnum);\n  \n    ModelType = this.require('ModelType');\n    modelType = new ModelType({\n      'title': name\n    });\n    modelType.uuid = name;\n    modelType.document(JSON.parse(JSON.stringify(type)));\n    modelType.content(JSON.stringify(type));\n  \n    designer.save();\n  \n    this.require('channel').$designerCreateType(name, type);\n  \n    this.hide();\n    this.require('message-help').remove();\n  \n    this.require('state').space(name);\n  \n    this.require('spaces').render();\n    this.require('workspace').render();\n  \n    this.require('message').success('Type created. You can use it in your model.');\n  }\n}","useCoreAPI":false,"core":false},"c147fb1fa4214beb":{"_id":"c147fb1fa4214beb","component":"DialogBehaviorCreation","state":"ok","action":"function ok() { \n  var that = this, \n    message = this.require('message'),\n    behavior = {},\n    ModelBehavior = null,\n    modelBehavior = null,\n    model = '',\n    state = '',\n    componentId = '';\n  \n  function _findSchemaId(compId) {\n    var result = compId,\n      modelName = '';\n  \n    for (modelName in that.require('factory').system().components()) {\n      if (typeof that.require('factory').system().components()[modelName][compId] !== 'undefined') {\n        result = modelName;\n        break;\n      }\n    }\n    return result;\n  }\n  \n  // get value\n  model = _findSchemaId(this.require('state').space());\n  state = $('#designer-dialog-behavior-creation-state').val();\n  componentId = this.require('state').space();\n  \n  behavior = this.require('factory').addBehavior(model, componentId, state);\n  \n  if (Object.keys(behavior).length) {\n    ModelBehavior = this.require('ModelBehavior');\n  \n    modelBehavior = new ModelBehavior({\n      'uuid': behavior._id\n    });\n  \n    modelBehavior.title(state);\n    modelBehavior.document(behavior);\n    modelBehavior.content(JSON.parse(JSON.stringify(behavior.action)));\n  \n    this.hide();\n    this.require('message-help').remove();\n    \n    modelBehavior.render();\n  \n    Prism.highlightAll();\n  \n    // little effect\n    $('#designer-behavior-' + behavior._id).hide();\n    $('#designer-behavior-' + behavior._id).fadeIn(1000);\n  \n    this.require('designer').save();\n  \n    this.require('channel').$designerCreateBehavior(behavior);\n    message.success('Behavior created.');\n  } else {\n    this.hide();\n    message.warning('Can not create two behaviors for a method.');\n  }\n}","useCoreAPI":false,"core":false},"h19e081c0c015dec":{"_id":"h19e081c0c015dec","component":"DialogImportFile","state":"mergeSystem","action":"function mergeSystem() { \n  this.require('factory').mergeSystem(this.data());\n  this.require('designer').save();\n\n  this.require('spaces').render();\n  this.require('workspace').render();\n\n  this.require('router').update();\n\n  this.hide();\n}","useCoreAPI":false,"core":false},"k170351fdea1494e":{"_id":"k170351fdea1494e","component":"DialogImportFile","state":"importSystem","action":"function importSystem() { \n  var sys = null,\n    designer = this.require('designer'),\n    message = this.require('message');\n\n  if (Object.keys(this.data()).length) {\n    if (this.require('factory').system()) {\n      this.require('factory').system().destroy();\n    }\n    \n    sys = this.require('factory').create(this.data());\n\n    // empty log\n    this.require('state').logs().forEach(function (item) {\n      this.logs().pop();\n    }.bind(this.require('state')));\n    \n    \n    // hide log\n    $('#designer-menu-item-logs-number').hide();\n    document.querySelector('#designer-menu-item-logs-number').innerHTML = 0;\n\n    designer.save();\n\n    this.require('state').space(sys.name());\n\n    this.require('spaces').render();\n    this.require('workspace').render();\n\n    this.require('router').update();\n\n    this.hide();\n\n    message.success('Importation of the system is done.');\n  } else {\n    message.danger('The system you try to import is invalid');\n  }\n}","useCoreAPI":false,"core":false},"p1bc351895f16e0d":{"_id":"p1bc351895f16e0d","component":"DialogDropDiagram","state":"hide","action":"function hide() { \n\t  $('#designer-dialog-drop-diagram-modal').modal('hide');\t\n}","useCoreAPI":false,"core":false},"g1fa4c1f2b8146c3":{"_id":"g1fa4c1f2b8146c3","component":"DialogDropDiagram","state":"show","action":"function show() { \n  $('#designer-dialog-drop-diagram-modal').modal('show');\t\n}","useCoreAPI":false,"core":false},"u1ab541be0216fb1":{"_id":"u1ab541be0216fb1","component":"DialogDropDiagram","state":"init","action":"function init(conf) { \n  var html = null,\n      dom = null;\n\n  $('#designer-dialog').empty();\n\n  html = this.require('dialog-modal-drop-diagram.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n        .replace(/{{title}}/gi, this.title())\n        .replace(/{{message}}/gi, this.message())\n  );\n\n  //events\n  dom = document.getElementById('designer-dialog-drop-diagram-modal-cancel');\n  dom.addEventListener('click', function click(event) {\n    this.cancel();\n  }.bind(this));\n\n  dom = document.getElementById('designer-dialog-drop-diagram-modal-import');\n  dom.addEventListener('click', function click(event) {\n    this.require('viz').render(this.data());\n    this.require('viz').data(this.data());\n    this.hide();\n  }.bind(this));\n  \n  dom = document.getElementById('designer-dialog-drop-diagram-modal');\n  dom.addEventListener('keydown', function keydown(event) {\n    if (event.keyCode === 13) {\n      event.stopPropagation();\n      event.preventDefault();\n      document.getElementById('designer-dialog-drop-diagram-modal-import').click();\n      return false;\n    }\n  }.bind(this));\n\n  if (!this.require('factory').system()) {\n    $('#designer-dialog-drop-diagram-modal-merge').hide();\n  }\n}","useCoreAPI":false,"core":false},"f560d27c-4105-4260-bf18-444a3d846cb0":{"_id":"f560d27c-4105-4260-bf18-444a3d846cb0","component":"DialogInstallPWA","state":"cancel","action":"function cancel() { \n\tthis.hide();\n}","useCoreAPI":false,"core":false},"cc1b0d4e-3767-49d8-8dc8-5f415446445c":{"_id":"cc1b0d4e-3767-49d8-8dc8-5f415446445c","component":"DialogInstallPWA","state":"show","action":"function show() { \n  $('#designer-dialog-install-pwa-modal').modal('show');\t\n}","useCoreAPI":false,"core":false},"d9f3f449-0d74-4348-8b0f-ed2c5f990dd0":{"_id":"d9f3f449-0d74-4348-8b0f-ed2c5f990dd0","component":"DialogInstallPWA","state":"hide","action":"function hide() { \n  $('#designer-dialog-install-pwa-modal').modal('hide');\t\n}","useCoreAPI":false,"core":false},"ed9b0296-eb25-49bc-a623-9fb8082a33ec":{"_id":"ed9b0296-eb25-49bc-a623-9fb8082a33ec","component":"DialogInstallPWA","state":"init","action":"function init(conf) { \n var html = '',\n      dom = null;\n\n  // empty area\n  if ($('#designer-dialog').children().length) {\n    $('#' + $(\"#designer-dialog\").children()[0].id).removeClass('fade').modal('hide');\n  }\n  $('#designer-dialog').empty();\n  \n  // render\n  html = this.require('dialog-modal-install-pwa.html');\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n      .replace(/{{title}}/gi, this.title())\n  );\n\n  // events\n  dom = document.getElementById('designer-dialog-install-pwa-cancel');\n  dom.addEventListener('click', function click(event) {\n    this.cancel();\n  }.bind(this));\n  \n  dom = document.getElementById('designer-dialog-install-pwa-ok');\n  dom.addEventListener('click', function click(event) {\n    this.ok();\n  }.bind(this));\t\n  \n  dom = document.getElementById('designer-dialog-install-pwa-modal');\n  dom.addEventListener('keydown', function keydown(event) {\n    if (event.keyCode === 13) {\n      this.ok();\n      event.stopPropagation();\n      event.preventDefault();\n      return false;\n    }\n  }.bind(this));\n  \n  // show\n  $('#designer-dialog-install-pwa-modal').modal('show');\t\t\n}","useCoreAPI":false,"core":false},"af9fea82-f707-4dc6-bebc-67c35788472a":{"_id":"af9fea82-f707-4dc6-bebc-67c35788472a","component":"DialogInstallPWA","state":"ok","action":"function ok() { \n if (this.deferredPrompt() && this.deferredPrompt().prompt) {\n    this.deferredPrompt().prompt();\n    this.deferredPrompt().userChoice.then(function()  {\n      this.deferredPrompt(null);\n    }.bind(this));\n  } \n  \n  var config = this.require('storage').get('system-designer-config');\n  if (!config) {\n    config = {};\n  }\n  config.pwaInstalled = true;\n  this.require('storage').set('system-designer-config', config);\n  \n  this.hide();\n}","useCoreAPI":false,"core":false},"1b6011ee4810caa":{"_id":"1b6011ee4810caa","component":"Editor","state":"getValue","action":"function getValue() { \n  var result = '';\n  \n  switch (this.type()) {\n    case 'ace':\n      result = this.editor().getValue();\n      break;\n    case 'codemirror':\n      result = this.editor().getValue();\n      break;\n    default:\n      break;\n  }\n  \n  return result;\n}","useCoreAPI":false,"core":false},"18cfb1c93610ad4":{"_id":"18cfb1c93610ad4","component":"Editor","state":"setValue","action":"function setValue(val) { \n  switch (this.type()) {\n    case 'ace':\n      result = this.editor().setValue(val);\n      break;\n    case 'codemirror':\n      result = this.editor().setValue(val);\n      break;\n    default:\n      break;\n  }\n}","useCoreAPI":false,"core":false},"1a63c188a61e193":{"_id":"1a63c188a61e193","component":"Editor","state":"setEditor","action":"function setEditor(mode, value, lineNumber, autocomplete) {\n  var language = {\n    'text': 'text/x-textile',\n    'json': 'application/json',\n    'javascript': 'text/javascript',\n    'html': 'htmlmixed',\n    'css': 'text/css'\n  };\n\n  switch (this.type()) {\n    case 'ace':\n      switch (this.context()) {\n        case 'system':\n        case 'schema':\n        case 'model':\n        case 'type':\n          this.editor().getSession().setMode('ace/mode/' + mode);\n          this.editor().setValue(value);\n          this.editor().gotoLine(lineNumber);\n          this.editor().getSession().$undoManager.reset();\n          this.editor().getSession().setUndoManager(new ace.UndoManager());\n          this.editor().getSession().setTabSize(2);\n          this.editor().focus();\n          break;\n        case 'behavior':\n          if (mode === 'javascript') {\n            this.editor().getSession().setMode('ace/mode/' + mode);\n            this.editor().getSession().setTabSize(2);\n\n            var completer = {\n              getCompletions: function (editor, session, pos, prefix, callback) {\n                var systemId = '',\n                  result = [],\n                  behavior = {},\n                  schemaName = '',\n                  schemas = {},\n                  schema = {},\n                  parents = {},\n                  i = 0;\n                  \n                if (this.require('state').menu() !== 'action') {\n                  return;\n                }\n                \n                function hasDot() {\n                  var result = false;\n                  if (editor.session.getLine(pos.row)[pos.column - 1 - prefix.length] === '.') {\n                    result = true;\n                  }\n                  return result;\n                }\n\n                function _getSchema(schemas, name) {\n                  var result = '',\n                    id = '';\n\n                  for (id in schemas) {\n                    if (schemas[id]._name === name) {\n                      result = schemas[id];\n                      break;\n                    }\n                  }\n                  return result;\n                }\n                \n                function _findSchemaName(id, components) {\n                  var result = id,\n                      modelName = '';\n                \n                  for (modelName in components) {\n                    if (typeof components[modelName][id] !== 'undefined') {\n                      result = modelName;\n                      break;\n                    }\n                  }\n                  return result;\n                }  \n\n                id = document.location.href.split('#')[1];\n                systemId = document.location.href.split('#')[2];\n\n                system = this.require('storage').get(systemId);\n                if (system && hasDot()) {\n                  schemaName = _findSchemaName(system.behaviors[id].component, this.require('factory').system().components());\n                  schemas = system.schemas;\n\n                  schema = _getSchema(schemas, schemaName);\n\n                  for (var name in schema) {\n                    if (name.indexOf('_') !== 0) {\n                      result.push({ name: name, caption: name, snippet: name + '($0)', meta: schema[name] });\n                    }\n                  }\n\n                  // case of system\n                  if (system.behaviors[id].component === systemId) {\n                    if ('id'.indexOf(prefix) === 0) {\n                      result.push({ name: 'id', caption:'id', snippet: 'id()', meta: 'property (inherited)' });\n                    }\n                    if ('require'.indexOf(prefix) === 0) {\n                      result.push({ name: 'require', caption:'require', snippet: 'require(\\'$0\\')', meta: 'method (inherited)' });\n                    }\n                    if ('destroy'.indexOf(prefix) === 0) {\n                      result.push({ name: 'destroy', caption:'destroy', snippet: 'destroy()', meta: 'method (inherited)' });\n                    }\n                    if ('init'.indexOf(prefix) === 0) {\n                      result.push({ name: 'init', caption:'init', snippet: 'init($0)', meta: 'method (inherited)' });\n                    }\n                    if ('error'.indexOf(prefix) === 0) {\n                      result.push({ name: 'error', caption:'error', snippet: 'error($0)', meta: 'event (inherited)' });\n                    }\n                  }\n\n                  // inherited\n                  parents = schema._inherit;\n                  if (parents) {\n                    length = parents.length;\n\n                    for (i = 0; i < length; i++) {\n                      if (parents[i].indexOf('_Component') !== -1) {\n                        if ('id'.indexOf(prefix) === 0) {\n                          result.push({ name: 'id', caption:'id', snippet: 'id()', meta: 'property (inherited)' });\n                        }\n                        if ('require'.indexOf(prefix) === 0) {\n                          result.push({ name: 'require', caption:'require', snippet: 'require(\\'$0\\')', meta: 'method (inherited)' });\n                        }\n                        if ('destroy'.indexOf(prefix) === 0) {\n                          result.push({ name: 'destroy', caption:'destroy', snippet: 'destroy()', meta: 'method (inherited)' });\n                        }\n                        if ('init'.indexOf(prefix) === 0) {\n                          result.push({ name: 'init', caption:'init', snippet: 'init($0)', meta: 'method (inherited)' });\n                        }\n                        if ('error'.indexOf(prefix) === 0) {\n                          result.push({ name: 'error', caption:'error', snippet: 'error($0)', meta: 'event (inherited)' });\n                        }\n                      } else {\n                        schema = _getSchema(schemas, parents[i]);\n\n                        for (var prop in schema) {\n                          if (prop.indexOf('_') !== 0 && prop.indexOf(prefix) === 0) {\n                            result.push({ name: prop, caption: prop, snippet: prop + '($0)', meta: schema[prop] + ' (inherited)' });\n                          }\n                        }\n                      }\n                    }\n                  }\n                }\n                \n                // snippets\n                if (hasDot()) {\n                  if ('collections'.indexOf(prefix) === 0) {\n                    result.push({ name: 'snip_collections', caption: 'collections', snippet:  'this.require(\\'db\\').collections()', meta: 'snippet' });\n                  }\n                  if ('require'.indexOf(prefix) === 0) {\n                    result.push({ name: 'snip_require', caption: 'require', snippet:  'this.require(\\'$0\\')', meta: 'snippet' });\n                  }\n                  if ('debug'.indexOf(prefix) === 0) {\n                    result.push({ name: 'snip_debug', caption: 'debug', snippet:  'this.require(\\'logger\\').debug(\\'$0\\')', meta: 'snippet' });\n                  }\n                  if ('info'.indexOf(prefix) === 0) {\n                    result.push({ name: 'snip_info', caption: 'info', snippet:  'this.require(\\'logger\\').info(\\'$0\\')', meta: 'snippet' });\n                  }\n                  if ('warn'.indexOf(prefix) === 0) {\n                    result.push({ name: 'snip_warn', caption: 'warn', snippet:  'this.require(\\'logger\\').warn(\\'$0\\')', meta: 'snippet' });\n                  }\n                  if ('error'.indexOf(prefix) === 0) {\n                    result.push({ name: 'snip_error', caption: 'error', snippet:  'this.require(\\'logger\\').error(\\'$0\\')', meta: 'snippet' });\n                  }\n                }\n\n                result.sort(function (a, b) {\n                  if (a.name > b.name) {\n                    return 1;\n                  }\n                  if (a.name < b.name) {\n                    return -1;\n                  }\n                  return 0;\n                }\n                );\n                callback(null, result);\n              }.bind(this)\n            };\n\n            this.editor().setOptions({\n              enableLiveAutocompletion: [completer]\n            });\n            this.editor().setValue(value);\n\n            this.editor().gotoLine(lineNumber);\n\n            this.editor().getSession().$undoManager.reset();\n            this.editor().getSession().setUndoManager(new ace.UndoManager());\n            this.editor().focus();\n          } else {\n            this.editor().getSession().setMode('ace/mode/' + mode);\n            this.editor().setValue(value);\n            this.editor().gotoLine(lineNumber);\n            this.editor().getSession().$undoManager.reset();\n            this.editor().getSession().setUndoManager(new ace.UndoManager());\n            this.editor().focus();\n          }\n          break;\n        case 'component':\n          this.editor().getSession().setMode('ace/mode/' + mode);\n          this.editor().getSession().setTabSize(2);\n          if (autocomplete) {\n            this.editor().setOptions({\n              enableLiveAutocompletion: true,\n            });\n          }\n          this.editor().setValue(value);\n          this.editor().gotoLine(lineNumber);\n          this.editor().getSession().$undoManager.reset();\n          this.editor().getSession().setUndoManager(new ace.UndoManager());\n          this.editor().focus();\n          break;\n        default:\n          break;\n      }\n      break;\n    case 'codemirror':\n      switch (this.context()) {\n        case 'system':\n        case 'schema':\n        case 'model':\n        case 'type':\n        case 'behavior':\n        case 'component':\n          this.editor().setValue('');\n          this.editor().setOption('mode', language[mode]);\n          this.editor().setValue(value);\n          this.editor().setCursor({\n            line: lineNumber - 1,\n            ch: 0\n          });\n          this.editor().clearHistory();\n          break;\n        default:\n          break;\n      }\n      break;\n    default:\n      break;\n  }\n}","useCoreAPI":false,"core":false},"14e9517c531160a":{"_id":"14e9517c531160a","component":"Editor","state":"render","action":"function render() {\n  switch (this.type()) {\n    case 'ace':\n      switch (this.context()) {\n        case 'system':\n          this.editor().getSession().setMode('ace/mode/text');\n          this.editor().setShowPrintMargin(false);\n          this.editor().setReadOnly(false);\n          this.editor().getSession().setTabSize(2);\n          this.editor().$blockScrolling = Infinity;\n          this.editor().setValue('');\n          this.editor().focus();\n          this.editor().commands.addCommand({\n            name: 'myCommand',\n            bindKey: { win: 'Ctrl-S', mac: 'Command-S' },\n            exec: function (editor) {\n              runtime.require('designer').save();\n            }\n          });\n          this.editor().commands.addCommand({\n            name: 'gotoCommand',\n            bindKey: { win: 'Ctrl-O', mac: 'Command-O' },\n            exec: function (editor) {\n              if ($('#designer-dialog-command-modal').length) {\n                $('#designer-dialog-command-modal').modal('show');\n              } else {\n                var Dialog = runtime.require('DialogCommand');\n                var dialog = new Dialog({ 'title': '' });\n                dialog.show();\n              }\n            }\n          });\n          break;\n        case 'schema':\n          this.editor().getSession().setMode('ace/mode/json');\n          var langTools = ace.require('ace/ext/language_tools');\n          var completer = {\n            getCompletions: function (editor, session, pos, prefix, callback) {\n              var result = [];\n              var system = '';\n              var schemas = '';\n              var systemId = '';\n\n              // snippets and helpers\n              if ('property'.indexOf(prefix) === 0) {\n                result.push({ name: 'property', value: 'property', meta: 'type' });\n                result.push({ name: 'property', caption: 'property', snippet: '\"$0\":\"property\",\\n', meta: \"add a property (snippet)\" });\n              }\n              if ('link'.indexOf(prefix) === 0) {\n                result.push({ name: 'link', value: 'link', meta: 'type' });\n                result.push({ name: 'link', caption: 'link', snippet: '\"$0\":\"link\",\\n', meta: 'add a link (snippet)' });\n              }\n              if ('collection'.indexOf(prefix) === 0) {\n                result.push({ name: 'collection', value: 'collection', meta: 'type' });\n                result.push({ name: 'collection', caption: 'collection', snippet: '\"$0\":\"collection\",\\n', meta: 'add a collection (snippet)' });\n              }\n              if ('method'.indexOf(prefix) === 0) {\n                result.push({ name: 'method', value: 'method', meta: 'type' });\n                result.push({ name: 'method', caption: 'method', snippet: '\"$0\":\"method\",\\n', meta: 'add a method (snippet)' });\n              }\n              if ('event'.indexOf(prefix) === 0) {\n                result.push({ name: 'event', value: 'event', meta: 'type' });\n                result.push({ name: 'event', caption: 'event', snippet: '\"$0\":\"event\",\\n', meta: 'add an event (snippet)' });\n              }\n\n              // schemas\n              systemId = document.location.href.split('#')[2].split('?')[0];\n              system = this.require('storage').get(systemId);\n\n              if (system) {\n                result.push({ name: \"_Component\", value: \"_Component\", meta: \"schema\" });\n\n                schemas = system.schemas;\n                for (var name in schemas) {\n                  if (schemas[name]._name.indexOf(prefix) === 0) {\n                    result.push({ name: '' + schemas[name]._name, value: '' + schemas[name]._name, meta: \"schema\" });\n                  }\n                }\n              }\n\n              callback(null, result);\n            }.bind(this)\n          };\n          this.editor().setOptions({\n            enableLiveAutocompletion: [completer]\n          });\n          this.editor().setShowPrintMargin(false);\n          this.editor().setReadOnly(false);\n          this.editor().getSession().setTabSize(2);\n          this.editor().$blockScrolling = Infinity;\n          this.editor().setValue('');\n          this.editor().commands.addCommand({\n            name: 'myCommand',\n            bindKey: { win: 'Ctrl-S', mac: 'Command-S' },\n            exec: function (editor) {\n              runtime.require('designer').save();\n            }\n          });\n          this.editor().commands.addCommand({\n            name: 'gotoCommand',\n            bindKey: { win: 'Ctrl-O', mac: 'Command-O' },\n            exec: function (editor) {\n              if ($('#designer-dialog-command-modal').length) {\n                $('#designer-dialog-command-modal').modal('show');\n              } else {\n                var Dialog = runtime.require('DialogCommand');\n                var dialog = new Dialog({ 'title': '' });\n                dialog.show();\n              }\n            }\n          });\n          this.editor().focus();\n          break;\n        case 'model':\n          this.editor().getSession().setMode('ace/mode/json');\n          this.editor().getSession().setTabSize(2);\n          var completer = {\n            getCompletions: function (editor, session, pos, prefix, callback) {\n              var systemId = '',\n                modelId = '',\n                modelName = '',\n                typeName = '',\n                result = [],\n                types = {},\n                schemas = {};\n\n              if ('any'.indexOf(prefix) === 0) {\n                result.push({ name: \"any\", value: \"any\", meta: \"natif type\" });\n              }\n              if ('string'.indexOf(prefix) === 0) {\n                result.push({ name: \"string\", value: \"string\", meta: \"natif type\" });\n              }\n              if ('number'.indexOf(prefix) === 0) {\n                result.push({ name: \"number\", value: \"number\", meta: \"natif type\" });\n              }\n              if ('boolean'.indexOf(prefix) === 0) {\n                result.push({ name: \"boolean\", value: \"boolean\", meta: \"natif type\" });\n              }\n              if ('date'.indexOf(prefix) === 0) {\n                result.push({ name: \"date\", value: \"date\", meta: \"natif type\" });\n              }\n              if ('object'.indexOf(prefix) === 0) {\n                result.push({ name: \"object\", value: \"object\", meta: \"natif type\" });\n              }\n              if ('array'.indexOf(prefix) === 0) {\n                result.push({ name: \"array\", value: \"array\", meta: \"natif type\" });\n              }\n              if ('json'.indexOf(prefix) === 0) {\n                result.push({ name: \"json\", value: \"json\", meta: \"alias\" });\n              }\n              if ('html'.indexOf(prefix) === 0) {\n                result.push({ name: \"html\", value: \"html\", meta: \"alias\" });\n              }\n              if ('css'.indexOf(prefix) === 0) {\n                result.push({ name: \"css\", value: \"css\", meta: \"alias\" });\n              }\n              if ('text'.indexOf(prefix) === 0) {\n                result.push({ name: \"text\", value: \"text\", meta: \"alias\" });\n              }\n              if ('javascript'.indexOf(prefix) === 0) {\n                result.push({ name: \"javascript\", value: \"javascript\", meta: \"alias\" });\n              }\n\n              systemId = document.location.href.split('#')[2].split('?')[0];\n              modelId = document.location.href.split('#')[1].split('#')[0];\n              system = this.require('storage').get(systemId);\n\n              if (system) {\n                types = system.types;\n                for (typeName in types) {\n                  if (types[typeName].name.indexOf(prefix) === 0) {\n                    result.push({ name: types[typeName].name, value: types[typeName].name, meta: \"custom type\" });\n                  }\n                }\n                if ('_Component'.indexOf(prefix) === 0) {\n                  result.push({ name: \"_Component\", value: \"_Component\", meta: \"model\" });\n                }\n                schemas = system.schemas;\n                for (var name in schemas) {\n                  if (schemas[name]._name.indexOf(prefix) === 0) {\n                    result.push({ name: '' + schemas[name]._name, value: '' + schemas[name]._name, meta: \"model\" });\n                  }\n                }\n              }\n\n              // helpers\n              if ('dependency'.indexOf(prefix) === 0) {\n                result.push({ name: \"kind_dependency\", value: \"dependency\", meta: \"kind of relationship\" });\n              }\n              if ('aggregation'.indexOf(prefix) === 0) {\n                result.push({ name: \"kind_aggregation\", value: \"aggregation\", meta: \"kind of relationship\" });\n              }\n              if ('composition'.indexOf(prefix) === 0) {\n                result.push({ name: \"kind_composition\", value: \"composition\", meta: \"kind of relationship\" });\n              }\n              if ('normal'.indexOf(prefix) === 0) {\n                result.push({ name: \"kind_normal\", value: \"normal\", meta: \"kind of relationship\" });\n              }\n\n              // snippets\n              if ('property'.indexOf(prefix) === 0) {\n                result.push({ name: 'snip_property', caption: 'property', snippet: '\"$0\": {\\n\\t\\\"description\\\": \\\"\\\",\\n\\t\\\"type\\\": \\\"any\\\",\\n\\t\\\"readOnly\\\": false,\\n\\t\\\"mandatory\\\": false,\\n\\t\\\"default\\\": \\\"\\\"\\n}\\t', meta: 'override an inherited property (snippet)' });\n              }\n              if ('link'.indexOf(prefix) === 0) {\n                result.push({ name: 'snip_link', caption: 'link', snippet: '\"$0\": {\\n\\t\\\"description\\\": \\\"\\\",\\n\\t\\\"type\\\": \\\"_Component\\\",\\n\\t\\\"kind\\\": \\\"normal\\\",\\n\\t\\\"readOnly\\\": false,\\n\\t\\\"mandatory\\\": false,\\n\\t\\\"default\\\": \\\"\\\"\\n}\\t', meta: 'override an inherited link (snippet)' });\n              }\n              if ('collection'.indexOf(prefix) === 0) {\n                result.push({ name: 'snip_collection', caption: 'collection', snippet: '\"$0\": {\\n\\t\\\"description\\\": \\\"\\\",\\n\\t\\\"type\\\": \\\"[_Component]\\\",\\n\\t\\\"kind\\\": \\\"normal\\\",\\n\\t\\\"readOnly\\\": false,\\n\\t\\\"mandatory\\\": false,\\n\\t\\\"default\\\": []\\n}\\t', meta: 'override an inherited collection (snippet)' });\n              }\n              if ('method'.indexOf(prefix) === 0) {\n                result.push({ name: 'snip_property', caption: 'method', snippet: '\"$0\": {\\n\\t\\\"description\\\": \\\"\\\",\\n\\t\\\"params\\\": {\\n\\t\\t\\\"name\\\": \\\"param\\\",\\n\\t\\t\\\"description\\\": \\\"\\\",\\n\\t\\t\\\"type\\\": \\\"any\\\",\\n\\t\\t\\\"mandatory\\\": false,\\n\\t\\t\\\"default\\\": null\\n\\t},\\n\\t\\\"result\\\": \\\"any\\“\\n}\\t', meta: 'override an inherited method (snippet)' });\n              }\n              if ('event'.indexOf(prefix) === 0) {\n                result.push({ name: 'snip_event', caption: 'event', snippet: '\"$0\": {\\n\\t\\\"description\\\": \\\"\\\",\\n\\t\\\"params\\\": {\\n\\t\\t\\\"name\\\": \\\"param\\\",\\n\\t\\t\\\"description\\\": \\\"\\\",\\n\\t\\t\\\"type\\\": \\\"any\\\",\\n\\t\\t\\\"mandatory\\\": false,\\n\\t\\t\\\"default\\\": null\\n\\t}\\n}', meta: 'override an inherited event (snippet)' });\n              }\n\n              if ('parameter'.indexOf(prefix) === 0) {\n                result.push({ name: 'snip_parameter', caption: 'parameter', snippet: '{\\n\\t\\\"name\\\": \\\"$0\\\",\\n\\t\\\"description\\\": \\\"\\\",\\n\\t\\\"type\\\": \\\"any\\\",\\n\\t\\\"mandatory\\\": false,\\n\\t\\\"default\\\": null\\n}\\t', meta: 'add a new parameter (snippet)' });\n              }\n              if ('default date'.indexOf(prefix) === 0) {\n                result.push({ name: 'snip_default_date', caption: 'default date', snippet: '1970-01-01T00:00:00.000Z', meta: 'set a default date value (snippet)' });\n              }\n\n              result.sort(function (a, b) {\n                if (a.name > b.name) {\n                  return 1;\n                }\n                if (a.name < b.name) {\n                  return -1;\n                }\n                return 0;\n              }\n              );\n\n              callback(null, result);\n            }.bind(this)\n          };\n\n          this.editor().setOptions({\n            enableLiveAutocompletion: [completer]\n          });\n          this.editor().setShowPrintMargin(false);\n          this.editor().setReadOnly(false);\n          this.editor().$blockScrolling = Infinity;\n          this.editor().setValue('');\n          this.editor().commands.addCommand({\n            name: 'myCommand',\n            bindKey: { win: 'Ctrl-S', mac: 'Command-S' },\n            exec: function (editor) {\n              runtime.require('designer').save();\n            }\n          });\n          this.editor().commands.addCommand({\n            name: 'gotoCommand',\n            bindKey: { win: 'Ctrl-O', mac: 'Command-O' },\n            exec: function (editor) {\n              if ($('#designer-dialog-command-modal').length) {\n                $('#designer-dialog-command-modal').modal('show');\n              } else {\n                var Dialog = runtime.require('DialogCommand');\n                var dialog = new Dialog({ 'title': '' });\n                dialog.show();\n              }\n            }\n          });\n          this.editor().focus();\n\n          $(function () {\n            $('[data-toggle=\"tooltip\"]').tooltip({ 'container': 'body', delay: { \"show\": 1000, \"hide\": 100 } });\n          });\n          break;\n        case 'type':\n          this.editor().getSession().setMode('ace/mode/json');\n          this.editor().getSession().setTabSize(2);\n          var langTools = ace.require('ace/ext/language_tools');\n          var completer = {\n            getCompletions: function (editor, session, pos, prefix, callback) {\n              var systemId = '',\n                typeName = '',\n                types = {},\n                result = [],\n                schemas = {};\n\n              if ('any'.indexOf(prefix) === 0) {\n                result.push({ name: \"any\", value: \"any\", meta: \"natif type\" });\n              }\n              if ('string'.indexOf(prefix) === 0) {\n                result.push({ name: \"string\", value: \"string\", meta: \"natif type\" });\n              }\n              if ('number'.indexOf(prefix) === 0) {\n                result.push({ name: \"number\", value: \"number\", meta: \"natif type\" });\n              }\n              if ('boolean'.indexOf(prefix) === 0) {\n                result.push({ name: \"boolean\", value: \"boolean\", meta: \"natif type\" });\n              }\n              if ('date'.indexOf(prefix) === 0) {\n                result.push({ name: \"date\", value: \"date\", meta: \"natif type\" });\n              }\n              if ('object'.indexOf(prefix) === 0) {\n                result.push({ name: \"object\", value: \"object\", meta: \"natif type\" });\n              }\n              if ('array'.indexOf(prefix) === 0) {\n                result.push({ name: \"array\", value: \"array\", meta: \"natif type\" });\n              }\n              if ('json'.indexOf(prefix) === 0) {\n                result.push({ name: \"json\", value: \"json\", meta: \"alias\" });\n              }\n              if ('html'.indexOf(prefix) === 0) {\n                result.push({ name: \"html\", value: \"html\", meta: \"alias\" });\n              }\n              if ('css'.indexOf(prefix) === 0) {\n                result.push({ name: \"css\", value: \"css\", meta: \"alias\" });\n              }\n              if ('text'.indexOf(prefix) === 0) {\n                result.push({ name: \"text\", value: \"text\", meta: \"alias\" });\n              }\n              if ('javascript'.indexOf(prefix) === 0) {\n                result.push({ name: \"javascript\", value: \"javascript\", meta: \"alias\" });\n              }\n\n              // snippet\n              if ('property'.indexOf(prefix) === 0) {\n                result.push({ name: 'property', caption: 'property', snippet: '\\\"$0\\\": {\\n\\t\\\"description\\\": \\\"\\\",\\n\\t\\\"type\\\": \\\"any\\\",\\n\\t\\\"mandatory\\\": false,\\n\\t\\\"default\\\": \\\"\\\"\\n}', meta: \"add a property (snippet)\" });\n              }\n\n              systemId = document.location.href.split('#')[2];\n              system = this.require('storage').get(systemId);\n\n              if (system) {\n                types = system.types;\n                for (typeName in types) {\n                  if (types[typeName].name.indexOf(prefix) === 0) {\n                    result.push({ name: types[typeName].name, value: types[typeName].name, meta: \"custom type\" });\n                  }\n                }\n                if ('_Component'.indexOf(prefix) === 0) {\n                  result.push({ name: \"_Component\", value: \"_Component\", meta: \"model\" });\n                }\n                schemas = system.schemas;\n                for (var name in schemas) {\n                  if (schemas[name]._name.indexOf(prefix) === 0) {\n                    result.push({ name: '' + schemas[name]._name, value: '' + schemas[name]._name, meta: \"model\" });\n                  }\n                }\n              }\n\n              result.sort(function (a, b) {\n                if (a.name > b.name) {\n                  return 1;\n                }\n                if (a.name < b.name) {\n                  return -1;\n                }\n                return 0;\n              }\n              );\n              callback(null, result);\n            }.bind(this)\n          };\n\n          this.editor().setOptions({\n            enableLiveAutocompletion: [completer]\n          });\n\n          this.editor().setShowPrintMargin(false);\n          this.editor().setReadOnly(false);\n          this.editor().$blockScrolling = Infinity;\n          this.editor().setValue('');\n          this.editor().commands.addCommand({\n            name: 'myCommand',\n            bindKey: { win: 'Ctrl-S', mac: 'Command-S' },\n            exec: function (editor) {\n              runtime.require('designer').save();\n            }\n          });\n          this.editor().commands.addCommand({\n            name: 'gotoCommand',\n            bindKey: { win: 'Ctrl-O', mac: 'Command-O' },\n            exec: function (editor) {\n              if ($('#designer-dialog-command-modal').length) {\n                $('#designer-dialog-command-modal').modal('show');\n              } else {\n                var Dialog = runtime.require('DialogCommand');\n                var dialog = new Dialog({ 'title': '' });\n                dialog.show();\n              }\n            }\n          });\n          this.editor().focus();\n          break;\n        case 'behavior':\n          this.editor().getSession().setMode('ace/mode/javascript');\n          this.editor().getSession().setTabSize(2);\n          var completer = {\n            getCompletions: function (editor, session, pos, prefix, callback) {\n\n              var systemId = '',\n                result = [],\n                behavior = {},\n                schemaName = '',\n                schemas = {},\n                schema = {},\n                parents = {},\n                i = 0;\n\n              if (this.require('state').menu() !== 'action') {\n                return;\n              }\n\n              function hasDot() {\n                var result = false;\n                if (editor.session.getLine(pos.row)[pos.column - 1 - prefix.length] === '.') {\n                  result = true;\n                }\n                return result;\n              }\n\n              function _searchApis(parents) {\n                var length = 0,\n                  i = 0;\n\n                if (parents) {\n                  length = parents.length;\n                  for (i = 0; i < length; i++) {\n                    if (parents[i].indexOf('_Component') !== -1) {\n                      if ('id'.indexOf(prefix) === 0) {\n                        result.push({ name: 'id', caption: 'id', snippet: 'id()', meta: 'property (inherited)' });\n                      }\n                      if ('require'.indexOf(prefix) === 0) {\n                        result.push({ name: 'require', caption: 'require', snippet: 'require(\\'$0\\')', meta: 'method (inherited)' });\n                      }\n                      if ('destroy'.indexOf(prefix) === 0) {\n                        result.push({ name: 'destroy', caption: 'destroy', snippet: 'destroy()', meta: 'method (inherited)' });\n                      }\n                      if ('init'.indexOf(prefix) === 0) {\n                        result.push({ name: 'init', caption: 'init', snippet: 'init($0)', meta: 'method (inherited)' });\n                      }\n                      if ('error'.indexOf(prefix) === 0) {\n                        result.push({ name: 'error', caption: 'error', snippet: 'error($0)', meta: 'event (inherited)' });\n                      }\n                    } else {\n                      schema = _getSchema(schemas, parents[i]);\n\n                      for (var prop in schema) {\n                        if (prop.indexOf('_') !== 0 && prop.indexOf(prefix) === 0) {\n                          result.push({ name: prop, caption: prop, snippet: prop + '($0)', meta: schema[prop] + ' (inherited)' });\n                        }\n                      }\n\n                      if (typeof schema._inherit !== 'undefined') {\n                        _searchApis(schema._inherit);\n                      }\n                    }\n                  }\n                }\n              }\n\n              function _getSchema(schemas, name) {\n                var result = '',\n                  id = '';\n\n                for (id in schemas) {\n                  if (schemas[id]._name === name) {\n                    result = schemas[id];\n                    break;\n                  }\n                }\n                return result;\n              }\n\n              function _findSchemaName(id, components) {\n                var result = id,\n                  modelName = '';\n\n                for (modelName in components) {\n                  if (typeof components[modelName][id] !== 'undefined') {\n                    result = modelName;\n                    break;\n                  }\n                }\n                return result;\n              }\n\n              id = document.location.href.split('#')[1];\n              systemId = document.location.href.split('#')[2];\n\n              system = this.require('storage').get(systemId);\n              \n              // helper on component name\n              if (system) {\n                components = system.components;\n                for (modelName in components) {\n                  for (componentId in components[modelName]) {\n                    if (components[modelName][componentId]._id.indexOf(prefix) === 0) {\n                      result.push({ name: componentId, value: componentId, meta: modelName + ' component' });\n                    }\n                  }\n                }\n              }\n\n              if (system && hasDot()) {\n                schemaName = _findSchemaName(system.behaviors[id].component, this.require('factory').system().components());\n                schemas = system.schemas;\n\n                schema = _getSchema(schemas, schemaName);\n\n                for (var name in schema) {\n                  if (name.indexOf('_') !== 0 && name.indexOf(prefix) === 0) {\n                    result.push({ name: name, caption: name, snippet: name + '($0)', meta: schema[name] });\n                  }\n                }\n\n                // case of system\n                if (system.behaviors[id].component === systemId) {\n                  if ('id'.indexOf(prefix) === 0) {\n                    result.push({ name: 'id', caption: 'id', snippet: 'id()', meta: 'property (inherited)' });\n                  }\n                  if ('require'.indexOf(prefix) === 0) {\n                    result.push({ name: 'require', caption: 'require', snippet: 'require(\\'$0\\')', meta: 'method (inherited)' });\n                  }\n                  if ('destroy'.indexOf(prefix) === 0) {\n                    result.push({ name: 'destroy', caption: 'destroy', snippet: 'destroy()', meta: 'method (inherited)' });\n                  }\n                  if ('init'.indexOf(prefix) === 0) {\n                    result.push({ name: 'init', caption: 'init', snippet: 'init($0)', meta: 'method (inherited)' });\n                  }\n                  if ('error'.indexOf(prefix) === 0) {\n                    result.push({ name: 'error', caption: 'error', snippet: 'error($0)', meta: 'event (inherited)' });\n                  }\n                }\n\n                // inherited\n                parents = schema._inherit;\n                if (parents) {\n                  length = parents.length;\n\n                  for (i = 0; i < length; i++) {\n                    if (parents[i].indexOf('_Component') !== -1) {\n                      if ('id'.indexOf(prefix) === 0) {\n                        result.push({ name: 'id', caption: 'id', snippet: 'id()', meta: 'property (inherited)' });\n                      }\n                      if ('require'.indexOf(prefix) === 0) {\n                        result.push({ name: 'require', caption: 'require', snippet: 'require(\\'$0\\')', meta: 'method (inherited)' });\n                      }\n                      if ('destroy'.indexOf(prefix) === 0) {\n                        result.push({ name: 'destroy', caption: 'destroy', snippet: 'destroy()', meta: 'method (inherited)' });\n                      }\n                      if ('init'.indexOf(prefix) === 0) {\n                        result.push({ name: 'init', caption: 'init', snippet: 'init($0)', meta: 'method (inherited)' });\n                      }\n                      if ('error'.indexOf(prefix) === 0) {\n                        result.push({ name: 'error', caption: 'error', snippet: 'error($0)', meta: 'event (inherited)' });\n                      }\n                    } else {\n                      schema = _getSchema(schemas, parents[i]);\n\n                      for (var prop in schema) {\n                        if (prop.indexOf('_') !== 0 & prop.indexOf(prefix) === 0) {\n                          result.push({ name: prop, caption: prop, snippet: prop + '($0)', meta: schema[prop] + ' (inherited)' });\n                        }\n                      }\n                      if (typeof schema._inherit !== 'undefined') {\n                        _searchApis(schema._inherit);\n                      }\n                    }\n                  }\n                }\n              }\n\n              if (!hasDot()) {\n                // snippets\n                if ('collections'.indexOf(prefix) === 0) {\n                  result.push({ name: 'snip_collections', caption: 'collections', snippet: 'this.require(\\'db\\').collections()', meta: 'get a collection (snippet)' });\n                }\n                if ('require'.indexOf(prefix) === 0) {\n                  result.push({ name: 'snip_require', caption: 'require', snippet: 'this.require(\\'$0\\')', meta: 'require a component (snippet)' });\n                }\n                if ('debug'.indexOf(prefix) === 0) {\n                  result.push({ name: 'snip_debug', caption: 'debug', snippet: 'this.require(\\'logger\\').debug(\\'$0\\')', meta: 'log a debug message (snippet)' });\n                }\n                if ('info'.indexOf(prefix) === 0) {\n                  result.push({ name: 'snip_info', caption: 'info', snippet: 'this.require(\\'logger\\').info(\\'$0\\')', meta: 'log an info message (snippet)' });\n                }\n                if ('warn'.indexOf(prefix) === 0) {\n                  result.push({ name: 'snip_warn', caption: 'warn', snippet: 'this.require(\\'logger\\').warn(\\'$0\\')', meta: 'log a warning message (snippet)' });\n                }\n                if ('error'.indexOf(prefix) === 0) {\n                  result.push({ name: 'snip_error', caption: 'error', snippet: 'this.require(\\'logger\\').error(\\'$0\\')', meta: 'log an error message (snippet)' });\n                }\n              }\n\n              result.sort(function (a, b) {\n                if (a.name > b.name) {\n                  return 1;\n                }\n                if (a.name < b.name) {\n                  return -1;\n                }\n                return 0;\n              }\n              );\n              callback(null, result);\n            }.bind(this)\n          };\n\n          // uncomment to add more autocomplete\n          //var langtools = ace.require(\"ace/ext/language_tools\");\n          //langtools.addCompleter(completer);\n\n          this.editor().setOptions({\n            enableLiveAutocompletion: [completer]\n            //enableLiveAutocompletion: true\n          });\n          this.editor().setShowPrintMargin(false);\n          this.editor().setReadOnly(false);\n          this.editor().$blockScrolling = Infinity;\n          this.editor().setValue('');\n          this.editor().commands.addCommand({\n            name: 'myCommand',\n            bindKey: { win: 'Ctrl-S', mac: 'Command-S' },\n            exec: function (editor) {\n              runtime.require('designer').save();\n            }\n          });\n          this.editor().commands.addCommand({\n            name: 'gotoCommand',\n            bindKey: { win: 'Ctrl-O', mac: 'Command-O' },\n            exec: function (editor) {\n              if ($('#designer-dialog-command-modal').length) {\n                $('#designer-dialog-command-modal').modal('show');\n              } else {\n                var Dialog = runtime.require('DialogCommand');\n                var dialog = new Dialog({ 'title': '' });\n                dialog.show();\n              }\n            }\n          });\n          this.editor().focus();\n          break;\n        case 'component':\n          this.editor().setShowPrintMargin(false);\n          this.editor().getSession().setTabSize(2);\n          this.editor().setReadOnly(false);\n          this.editor().$blockScrolling = Infinity;\n          this.editor().setValue('');\n\n          var completer = {\n            getCompletions: function (editor, session, pos, prefix, callback) {\n              var systemId = '',\n                system = '',\n                modelName = '',\n                componentId = '',\n                components = {},\n                result = [];\n\n              systemId = document.location.href.split('#')[3];\n              system = this.require('storage').get(systemId);\n\n              if (system) {\n                components = system.components;\n                for (modelName in components) {\n                  for (componentId in components[modelName]) {\n                    if (components[modelName][componentId]._id.indexOf(prefix) === 0) {\n                      result.push({ name: componentId, value: componentId, meta: modelName });\n                    }\n                  }\n                }\n              }\n\n              result.sort(function (a, b) {\n                if (a.name > b.name) {\n                  return 1;\n                }\n                if (a.name < b.name) {\n                  return -1;\n                }\n                return 0;\n              }\n              );\n              callback(null, result);\n            }.bind(this)\n          };\n\n          this.editor().setOptions({\n            enableLiveAutocompletion: [completer]\n          });\n\n          this.editor().commands.addCommand({\n            name: 'myCommand',\n            bindKey: { win: 'Ctrl-S', mac: 'Command-S' },\n            exec: function (editor) {\n              runtime.require('designer').save();\n            }\n          });\n          this.editor().commands.addCommand({\n            name: 'gotoCommand',\n            bindKey: { win: 'Ctrl-O', mac: 'Command-O' },\n            exec: function (editor) {\n              if ($('#designer-dialog-command-modal').length) {\n                $('#designer-dialog-command-modal').modal('show');\n              } else {\n                var Dialog = runtime.require('DialogCommand');\n                var dialog = new Dialog({ 'title': '' });\n                dialog.show();\n              }\n            }\n          });\n          break;\n        default:\n          break;\n      }\n      break;\n    case 'codemirror':\n      switch (this.context()) {\n        case 'system':\n          this.editor().addKeyMap({\n            \"Cmd-S\": function () { runtime.require('designer').save() },\n            \"Ctrl-S\": function () { runtime.require('designer').save() }\n          });\n          break;\n\n        case 'schema':\n          var snippets = [];\n          var system = '';\n          var schemas = '';\n          var systemId = '';\n\n          // snippets and helpers\n          snippets.push({ searchText: 'property', text: 'property', displayText: 'property (type)' });\n          snippets.push({ searchText: 'property', text: '\"\":\"property\"', displayText: 'add a property (snippet)' });\n\n          snippets.push({ searchText: 'link', text: 'link', displayText: 'link (type)' });\n          snippets.push({ searchText: 'link', text: '\"\":\"link\"', displayText: 'add a link (snippet)' });\n\n          snippets.push({ searchText: 'collection', text: 'collection', displayText: 'collection (type)' })\n          snippets.push({ searchText: 'collection', text: '\"\":\"collection\"', displayText: 'add a collection (snippet)' });\n\n          snippets.push({ searchText: 'method', text: 'method', displayText: 'method (type)' })\n          snippets.push({ searchText: 'method', text: '\"\":\"method\"', displayText: 'add a method (snippet)' });\n\n          snippets.push({ searchText: 'event', text: 'event', displayText: 'event (type)' })\n          snippets.push({ searchText: 'event', text: '\"\":\"event\"', displayText: 'add an event (snippet)' });\n\n          // schemas\n          systemId = document.location.href.split('#')[2].split('?')[0];\n          system = this.require('storage').get(systemId);\n\n          if (system) {\n            snippets.push({ searchText: '_Component', text: '_Component', displayText: '_Component (schema)' });\n\n            schemas = system.schemas;\n            for (var name in schemas) {\n              snippets.push({ searchText: schemas[name]._name, text: schemas[name]._name, displayText: schemas[name]._name + ' (schema)' });\n            }\n          }\n\n          function showAutocomplete() {\n            CodeMirror.showHint(runtime.require('editor').editor(), function () {\n              var cursor = runtime.require('editor').editor().getCursor();\n              var token = runtime.require('editor').editor().getTokenAt(cursor);\n              var start = token.start;\n              var end = cursor.ch;\n              var line = cursor.line;\n              var currentWord = token.string;\n              var list = [];\n              var cleanWord = currentWord.replace(/\"/g, '');\n\n              if (cleanWord && cleanWord.length > 1) {\n                list = snippets.filter(function (item) {\n                  return item.searchText.indexOf(cleanWord) >= 0\n                })\n              }\n\n              if (currentWord && currentWord[0] === '\"') {\n                start = start + 1;\n              }\n\n              return {\n                list: list,\n                from: CodeMirror.Pos(line, start),\n                to: CodeMirror.Pos(line, end)\n              }\n            }, { completeSingle: false })\n          }\n\n          this.editor().on('keyup', function (cm, event) {\n            if (\n              !cm.state.completionActive &&\n              event.keyCode != 13 &&\n              event.keyCode != 37 &&\n              event.keyCode != 39 &&\n              event.keyCode != 38 &&\n              event.keyCode != 40 &&\n              event.keyCode != 222 &&\n              event.keyCode != 51\n            ) {\n              showAutocomplete();\n            }\n          });\n\n          this.editor().addKeyMap({\n            'Cmd-S': function () { runtime.require('designer').save() },\n            'Ctrl-S': function () { runtime.require('designer').save() }\n          });\n\n          break;\n\n        case 'model':\n          var systemId = '',\n            modelId = '',\n            modelName = '',\n            typeName = '',\n            snippets = [],\n            types = {},\n            schemas = {};\n\n          snippets.push({ searchText: \"any\", text: \"any\", displayText: \" any (natif type)\" });\n          snippets.push({ searchText: \"string\", text: \"string\", displayText: \"string (natif type)\" });\n          snippets.push({ searchText: \"number\", text: \"number\", displayText: \"number (natif type)\" });\n          snippets.push({ searchText: \"boolean\", text: \"boolean\", displayText: \"boolean (natif type)\" });\n          snippets.push({ searchText: \"date\", text: \"date\", displayText: \"date (natif type)\" });\n          snippets.push({ searchText: \"object\", text: \"object\", displayText: \"object (natif type)\" });\n          snippets.push({ searchText: \"array\", text: \"array\", displayText: \"array (natif type)\" });\n          snippets.push({ searchText: \"json\", text: \"json\", displayText: \"json (alias)\" });\n          snippets.push({ searchText: \"html\", text: \"html\", displayText: \"html (alias)\" });\n          snippets.push({ searchText: \"css\", text: \"css\", displayText: \"css (alias)\" });\n          snippets.push({ searchText: \"text\", text: \"text\", displayText: \"text (alias)\" });\n          snippets.push({ searchText: \"javascript\", text: \"javascript\", displayText: \"javascript (alias)\" });\n\n          systemId = document.location.href.split('#')[2].split('?')[0];\n          modelId = document.location.href.split('#')[1].split('#')[0];\n          system = this.require('storage').get(systemId);\n\n          if (system) {\n            types = system.types;\n            for (typeName in types) {\n              snippets.push({ searchText: types[typeName].name, text: types[typeName].name, displayText: types[typeName].name + \" (custom type)\" });\n            }\n\n            snippets.push({ searchText: \"_Component\", text: \"_Component\", displayText: \"_Component (model)\" });\n\n            schemas = system.schemas;\n            for (var name in schemas) {\n              snippets.push({ searchText: schemas[name]._name, text: schemas[name]._name, displayText: schemas[name]._name + \" (model)\" });\n            }\n          }\n\n          // helpers\n          snippets.push({ searchText: \"dependency\", text: \"dependency\", displayText: \"dependency (kind of relationship)\" });\n          snippets.push({ searchText: \"aggregation\", text: \"aggregation\", displayText: \"aggregation (kind of relationship)\" });\n          snippets.push({ searchText: \"composition\", text: \"composition\", displayText: \"composition (kind of relationship)\" });\n          snippets.push({ searchText: \"normal\", text: \"normal\", displayText: \"normal (kind of relationship)\" });\n\n          // snippets\n          snippets.push({ searchText: 'property', text: '\"\": {\\n\\t\\\"description\\\": \\\"\\\",\\n\\t\\\"type\\\": \\\"any\\\",\\n\\t\\\"readOnly\\\": false,\\n\\t\\\"mandatory\\\": false,\\n\\t\\\"default\\\": \\\"\\\"\\n}\\t', displayText: 'override an inherited property (snippet)' });\n          snippets.push({ searchText: 'link', text: '\"\": {\\n\\t\\\"description\\\": \\\"\\\",\\n\\t\\\"type\\\": \\\"_Component\\\",\\n\\t\\\"kind\\\": \\\"normal\\\",\\n\\t\\\"readOnly\\\": false,\\n\\t\\\"mandatory\\\": false,\\n\\t\\\"default\\\": \\\"\\\"\\n}\\t', displayText: 'override an inherited link (snippet)' });\n          snippets.push({ searchText: 'collection', text: '\"\": {\\n\\t\\\"description\\\": \\\"\\\",\\n\\t\\\"type\\\": \\\"[_Component]\\\",\\n\\t\\\"kind\\\": \\\"normal\\\",\\n\\t\\\"readOnly\\\": false,\\n\\t\\\"mandatory\\\": false,\\n\\t\\\"default\\\": []\\n}\\t', displayText: 'override an inherited collection (snippet)' });\n          snippets.push({ searchText: 'method', text: '\"\": {\\n\\t\\\"description\\\": \\\"\\\",\\n\\t\\\"params\\\": {\\n\\t\\t\\\"name\\\": \\\"param\\\",\\n\\t\\t\\\"description\\\": \\\"\\\",\\n\\t\\t\\\"type\\\": \\\"any\\\",\\n\\t\\t\\\"mandatory\\\": false,\\n\\t\\t\\\"default\\\": null\\n\\t},\\n\\t\\\"result\\\": \\\"any\\“\\n}\\t', displayText: 'override an inherited method (snippet)' });\n          snippets.push({ searchText: 'event', text: '\"\": {\\n\\t\\\"description\\\": \\\"\\\",\\n\\t\\\"params\\\": {\\n\\t\\t\\\"name\\\": \\\"param\\\",\\n\\t\\t\\\"description\\\": \\\"\\\",\\n\\t\\t\\\"type\\\": \\\"any\\\",\\n\\t\\t\\\"mandatory\\\": false,\\n\\t\\t\\\"default\\\": null\\n\\t}\\n}', displayText: 'override an inherited event (snippet)' });\n          snippets.push({ searchText: 'parameter', text: '{\\n\\t\\\"name\\\": \\\"\\\",\\n\\t\\\"description\\\": \\\"\\\",\\n\\t\\\"type\\\": \\\"any\\\",\\n\\t\\\"mandatory\\\": false,\\n\\t\\\"default\\\": null\\n}\\t', displayText: 'add a new parameter (snippet)' });\n\n          snippets.push({ searchText: 'default date', text: '1970-01-01T00:00:00.000Z', displayText: 'set a default date value (snippet)' });\n\n          function showAutocomplete() {\n            CodeMirror.showHint(runtime.require('editor').editor(), function () {\n              var cursor = runtime.require('editor').editor().getCursor();\n              var token = runtime.require('editor').editor().getTokenAt(cursor);\n              var start = token.start;\n              var end = cursor.ch;\n              var line = cursor.line;\n              var currentWord = token.string;\n              var list = [];\n              var cleanWord = currentWord.replace(/\"/g, '');\n\n              if (cleanWord && cleanWord.length > 1) {\n                list = snippets.filter(function (item) {\n                  return item.searchText.indexOf(cleanWord) >= 0\n                })\n              }\n\n              if (currentWord && currentWord[0] === '\"') {\n                start = start + 1;\n              }\n\n              return {\n                list: list,\n                from: CodeMirror.Pos(line, start),\n                to: CodeMirror.Pos(line, end)\n              }\n            }, { completeSingle: false })\n          }\n\n          this.editor().on('keyup', function (cm, event) {\n            if (\n              !cm.state.completionActive &&\n              event.keyCode != 13 &&\n              event.keyCode != 37 &&\n              event.keyCode != 39 &&\n              event.keyCode != 38 &&\n              event.keyCode != 40 &&\n              event.keyCode != 222 &&\n              event.keyCode != 51\n            ) {\n              showAutocomplete();\n            }\n          });\n\n          this.editor().addKeyMap({\n            'Cmd-S': function () { runtime.require('designer').save() },\n            'Ctrl-S': function () { runtime.require('designer').save() }\n          });\n\n          break;\n\n        case 'type':\n          var systemId = '',\n            typeName = '',\n            types = {},\n            snippets = [],\n            schemas = {};\n\n          snippets.push({ searchText: \"any\", text: \"any\", displayText: \"any (natif type)\" });\n          snippets.push({ searchText: \"string\", text: \"string\", displayText: \"string (natif type)\" });\n          snippets.push({ searchText: \"number\", text: \"number\", displayText: \"number (natif type)\" });\n          snippets.push({ searchText: \"boolean\", text: \"boolean\", displayText: \"boolean (natif type)\" });\n          snippets.push({ searchText: \"date\", text: \"date\", displayText: \"date (natif type)\" });\n          snippets.push({ searchText: \"object\", text: \"object\", displayText: \"object (natif type)\" });\n          snippets.push({ searchText: \"array\", text: \"array\", displayText: \"array (natif type)\" });\n          snippets.push({ searchText: \"json\", text: \"json\", displayText: \"json (alias)\" });\n          snippets.push({ searchText: \"html\", text: \"html\", displayText: \"html (alias)\" });\n          snippets.push({ searchText: \"css\", text: \"css\", displayText: \"css (alias)\" });\n          snippets.push({ searchText: \"text\", text: \"text\", displayText: \"text (alias)\" });\n          snippets.push({ searchText: \"javascript\", text: \"javascript\", displayText: \"javascript (alias)\" });\n\n          // snippet\n          snippets.push({ searchText: 'property', text: '\\\"\\\": {\\n\\t\\\"description\\\": \\\"\\\",\\n\\t\\\"type\\\": \\\"any\\\",\\n\\t\\\"mandatory\\\": false,\\n\\t\\\"default\\\": \\\"\\\"\\n}', displayText: \"Add a property (snippet)\" });\n\n          systemId = document.location.href.split('#')[2].split('?')[0];\n          system = this.require('storage').get(systemId);\n\n          if (system) {\n            types = system.types;\n            for (typeName in types) {\n              snippets.push({ searchText: types[typeName].name, text: types[typeName].name, displayText: types[typeName].name + \" (custom type)\" });\n            }\n\n            snippets.push({ searchText: \"_Component\", text: \"_Component\", displayText: \"_Component (model)\" });\n            schemas = system.schemas;\n            for (var name in schemas) {\n              snippets.push({ searchText: schemas[name]._name, text: schemas[name]._name, displayText: schemas[name]._name + \" (model)\" });\n            }\n          }\n\n          function showAutocomplete() {\n            CodeMirror.showHint(runtime.require('editor').editor(), function () {\n              var cursor = runtime.require('editor').editor().getCursor();\n              var token = runtime.require('editor').editor().getTokenAt(cursor);\n              var start = token.start;\n              var end = cursor.ch;\n              var line = cursor.line;\n              var currentWord = token.string;\n              var list = [];\n              var cleanWord = currentWord.replace(/\"/g, '');\n\n              if (cleanWord && cleanWord.length > 1) {\n                list = snippets.filter(function (item) {\n                  return item.searchText.indexOf(cleanWord) >= 0\n                })\n              }\n\n              if (currentWord && currentWord[0] === '\"') {\n                start = start + 1;\n              }\n\n              return {\n                list: list,\n                from: CodeMirror.Pos(line, start),\n                to: CodeMirror.Pos(line, end)\n              }\n            }, { completeSingle: false })\n          }\n\n          this.editor().on('keyup', function (cm, event) {\n            if (\n              !cm.state.completionActive &&\n              event.keyCode != 13 &&\n              event.keyCode != 37 &&\n              event.keyCode != 39 &&\n              event.keyCode != 38 &&\n              event.keyCode != 40 &&\n              event.keyCode != 222 &&\n              event.keyCode != 51\n            ) {\n              showAutocomplete();\n            }\n          });\n\n          this.editor().addKeyMap({\n            'Cmd-S': function () { runtime.require('designer').save() },\n            'Ctrl-S': function () { runtime.require('designer').save() }\n          });\n\n          break;\n\n        case 'behavior':\n          var systemId = '',\n            snippets = [],\n            behavior = {},\n            schemaName = '',\n            schemas = {},\n            schema = {},\n            parents = {},\n            i = 0;\n\n          if (this.require('state').menu() !== 'action') {\n            return;\n          }\n\n          function _searchApis(parents) {\n            var length = 0,\n              i = 0;\n\n            if (parents) {\n              length = parents.length;\n              for (i = 0; i < length; i++) {\n                if (parents[i].indexOf('_Component') !== -1) {\n                  snippets.push({ searchText: 'id', text: 'id()', displayText: 'id (inherited property)' });\n                  snippets.push({ searchText: 'require', text: 'require(\\'\\')', displayText: 'require (inherited method)' });\n                  snippets.push({ searchText: 'destroy', text: 'destroy()', displayText: 'destroy (inherited method)' });\n                  snippets.push({ searchText: 'init', text: 'init()', displayText: 'init (inherited method)' });\n                  snippets.push({ searchText: 'error', text: 'error()', displayText: 'error (inherited method)' });\n                } else {\n                  schema = _getSchema(schemas, parents[i]);\n\n                  for (var prop in schema) {\n                    if (prop.indexOf('_') !== 0) {\n                      snippets.push({ searchText: prop, text: prop + '()', displayText: prop + ' (inherited ' + schema[prop] + ')' });\n                    }\n                  }\n\n                  if (typeof schema._inherit !== 'undefined') {\n                    _searchApis(schema._inherit);\n                  }\n                }\n              }\n            }\n          }\n\n          function _getSchema(schemas, name) {\n            var result = '',\n              id = '';\n\n            for (id in schemas) {\n              if (schemas[id]._name === name) {\n                result = schemas[id];\n                break;\n              }\n            }\n            return result;\n          }\n\n          function _findSchemaName(id, components) {\n            var result = id,\n              modelName = '';\n\n            for (modelName in components) {\n              if (typeof components[modelName][id] !== 'undefined') {\n                result = modelName;\n                break;\n              }\n            }\n            return result;\n          }\n\n          id = document.location.href.split('#')[1].split('?')[0];\n          systemId = document.location.href.split('#')[2].split('?')[0];\n\n          system = this.require('storage').get(systemId);\n          \n          \n          // helper on component name\n          if (system) {\n            components = system.components;\n            for (modelName in components) {\n              for (componentId in components[modelName]) {\n                snippets.push({ searchText: componentId, text: componentId, displayText: componentId + ' (' + modelName + ')' });\n              }\n            }\n          }\n\n          if (system) {\n            schemaName = _findSchemaName(system.behaviors[id].component, this.require('factory').system().components());\n            schemas = system.schemas;\n\n            schema = _getSchema(schemas, schemaName);\n\n            for (var name in schema) {\n              if (name.indexOf('_') !== 0) {\n                snippets.push({ searchText: name, text: name + '()', displayText: name + ' (' + schema[name] + ')' });\n              }\n            }\n\n            // case of system\n            if (system.behaviors[id].component === systemId) {\n              snippets.push({ searchText: 'id', text: 'id()', displayText: 'id (inherited property)' });\n              snippets.push({ searchText: 'require', text: 'require(\\'\\')', displayText: 'require (inherited method)' });\n              snippets.push({ searchText: 'destroy', text: 'destroy()', displayText: 'destroy (inherited method)' });\n              snippets.push({ searchText: 'init', text: 'init()', displayText: 'init (inherited method)' });\n              snippets.push({ searchText: 'error', text: 'error()', displayText: 'error (inherited method)' });\n            }\n\n            // inherited\n            parents = schema._inherit;\n            if (parents) {\n              length = parents.length;\n\n              for (i = 0; i < length; i++) {\n                if (parents[i].indexOf('_Component') !== -1) {\n                  snippets.push({ searchText: 'id', text: 'id()', displayText: 'id (inherited property)' });\n                  snippets.push({ searchText: 'require', text: 'require(\\'\\')', displayText: 'require (inherited method)' });\n                  snippets.push({ searchText: 'destroy', text: 'destroy()', displayText: 'destroy (inherited method)' });\n                  snippets.push({ searchText: 'init', text: 'init()', displayText: 'init (inherited method)' });\n                  snippets.push({ searchText: 'error', text: 'error()', displayText: 'error (inherited method)' });\n                } else {\n                  schema = _getSchema(schemas, parents[i]);\n\n                  for (var prop in schema) {\n                    if (prop.indexOf('_') !== 0) {\n                      snippets.push({ searchText: prop, text: prop + '()', displayText: prop + ' (inherited ' + schema[prop] + ')' });\n                    }\n                  }\n                  if (typeof schema._inherit !== 'undefined') {\n                    _searchApis(schema._inherit);\n                  }\n                }\n              }\n            }\n          }\n\n          // snippets\n          snippets.push({ searchText: 'collections', text: 'this.require(\\'db\\').collections()', displayText: 'get a collection (snippet)' });\n          snippets.push({ searchText: 'require', text: 'this.require(\\'\\')', displayText: 'require a component (snippet)' });\n          snippets.push({ searchText: 'debug', text: 'this.require(\\'logger\\').debug(\\'\\')', displayText: 'log a debug message (snippet)' });\n          snippets.push({ searchText: 'info', text: 'this.require(\\'logger\\').info(\\'\\')', displayText: 'log an info message (snippet)' });\n          snippets.push({ searchText: 'warn', text: 'this.require(\\'logger\\').warn(\\'\\')', displayText: 'log a warning message (snippet)' });\n          snippets.push({ searchText: 'error', text: 'this.require(\\'logger\\').error(\\'\\')', displayText: 'log an error message (snippet)' });\n\n          function showAutocomplete() {\n            CodeMirror.showHint(runtime.require('editor').editor(), function () {\n              var cursor = runtime.require('editor').editor().getCursor();\n              var token = runtime.require('editor').editor().getTokenAt(cursor);\n              var start = token.start;\n              var end = cursor.ch;\n              var line = cursor.line;\n              var currentWord = token.string;\n              var list = [];\n\n              if (currentWord && currentWord.length > 1) {\n                list = snippets.filter(function (item) {\n                  return item.searchText.indexOf(currentWord) >= 0\n                })\n              }\n\n              return {\n                list: list,\n                from: CodeMirror.Pos(line, start),\n                to: CodeMirror.Pos(line, end)\n              }\n            }, { completeSingle: false })\n          }\n\n          this.editor().on('keyup', function (cm, event) {\n            if (\n              !cm.state.completionActive &&\n              event.keyCode != 13 &&\n              event.keyCode != 37 &&\n              event.keyCode != 39 &&\n              event.keyCode != 38 &&\n              event.keyCode != 40 &&\n              event.keyCode != 222 &&\n              event.keyCode != 51\n            ) {\n              showAutocomplete();\n            }\n          });\n          this.editor().addKeyMap({\n            'Cmd-S': function () { runtime.require('designer').save() },\n            'Ctrl-S': function () { runtime.require('designer').save() }\n          });\n          break;\n\n        case 'component':\n          var systemId = '',\n            system = '',\n            modelName = '',\n            componentId = '',\n            components = {},\n            snippets = [];\n\n          systemId = document.location.href.split('#')[3].split('?')[0];\n          system = this.require('storage').get(systemId);\n\n          if (system) {\n            components = system.components;\n            for (modelName in components) {\n              for (componentId in components[modelName]) {\n                snippets.push({ searchText: componentId, text: componentId, displayText: componentId + ' (' + modelName + ')' });\n              }\n            }\n          }\n\n          function showAutocomplete() {\n            CodeMirror.showHint(runtime.require('editor').editor(), function () {\n              var cursor = runtime.require('editor').editor().getCursor();\n              var token = runtime.require('editor').editor().getTokenAt(cursor);\n              var start = token.start;\n              var end = cursor.ch;\n              var line = cursor.line;\n              var currentWord = token.string;\n              var list = [];\n              var cleanWord = currentWord.replace(/\"/g, '');\n\n              if (cleanWord && cleanWord.length > 1) {\n                list = snippets.filter(function (item) {\n                  return item.searchText.indexOf(cleanWord) >= 0\n                })\n              }\n\n              if (currentWord && currentWord[0] === '\"') {\n                start = start + 1;\n              }\n\n              return {\n                list: list,\n                from: CodeMirror.Pos(line, start),\n                to: CodeMirror.Pos(line, end)\n              }\n            }, { completeSingle: false })\n          }\n\n          this.editor().on('keyup', function (cm, event) {\n            if (\n              !cm.state.completionActive &&\n              event.keyCode != 13 &&\n              event.keyCode != 37 &&\n              event.keyCode != 39 &&\n              event.keyCode != 38 &&\n              event.keyCode != 40 &&\n              event.keyCode != 222 &&\n              event.keyCode != 51\n            ) {\n              showAutocomplete();\n            }\n          });\n          this.editor().addKeyMap({\n            'Cmd-S': function () { runtime.require('designer').save() },\n            'Ctrl-S': function () { runtime.require('designer').save() }\n          });\n          break;\n        default:\n          break;\n      }\n      break;\n    default:\n      break;\n  }\n}","useCoreAPI":false,"core":false},"11df21f30c14808":{"_id":"11df21f30c14808","component":"Editor","state":"initValue","action":"function initValue(value, lineNumber) {\n  var that = this;\n\n  switch (this.type()) {\n    case 'ace':\n      switch (this.context()) {\n        case 'system':\n        case 'schema':\n        case 'model':\n        case 'type':\n          this.editor().setValue(value);\n          this.editor().gotoLine(lineNumber);\n          this.editor().getSession().$undoManager.reset();\n          this.editor().getSession().setUndoManager(new ace.UndoManager());\n          break;\n        case 'behavior':\n          this.editor().setValue(value);\n          this.editor().gotoLine(lineNumber);\n          this.editor().getSession().$undoManager.reset();\n          this.editor().getSession().setUndoManager(new ace.UndoManager());\n\n          var Range = ace.require('ace/range').Range;\n          var endLine = value.indexOf('{') + 1;\n\n          this.editor().session.addMarker(new Range(0, 0, 0, endLine), 'readonly');\n\n          // readonly\n          this.editor().keyBinding.addKeyboardHandler({\n            handleKeyboard: function (data, hash, keyString, keyCode, event) {\n              var result = null;\n\n              switch (true) {\n                case (hash === -1 || (keyCode <= 40 && keyCode >= 37)):\n                  result = false;\n                  break;\n                case intersects(new Range(0, 0, 0, endLine)):\n                  if (event.keyCode !== 67 && event.keyCode !== 70) {\n                    result = {\n                      command: 'null',\n                      passEvent: false\n                    };\n\n                    if (event.keyCode !== 91 && event.keyCode !== 17) {\n                      runtime.require('message').warning('You can not modify the header of the behavior.');\n                    }\n                  } else {\n                    result = false;\n                  }\n                  break;\n                default:\n                  break;\n              }\n\n              if (result) {\n                return result;\n              }\n            }\n          });\n\n          function intersects(range) {\n            var result = false,\n              selection = that.editor().getSelectionRange();\n\n            result = (selection.end.row === 0 && selection.end.column < endLine + 1) && selection.intersects(range) && that.require('state').menu() === 'action';\n            return result;\n          }\n          break;\n        case 'component':\n          break;\n        default:\n          break;\n      }\n      break;\n    case 'codemirror':\n      switch (this.context()) {\n        case 'system':\n        case 'schema':\n        case 'model':\n        case 'type':\n        case 'behavior':\n        case 'component':\n          this.editor().setValue(value);\n          this.editor().setCursor({\n            line: lineNumber - 1,\n            ch: 0\n          });\n          this.editor().clearHistory();\n          break;\n        default:\n          break;\n      }\n      break;\n    default:\n      break;\n  }\n}","useCoreAPI":false,"core":false},"z17c861b9211fe8c":{"_id":"z17c861b9211fe8c","component":"Editor","state":"undo","action":"function undo() { \n\t switch (this.type()) {\n    case 'ace':\n      this.require('editor').editor().focus();\n      this.editor().undo();\n      break;\n    case 'codemirror':\n      this.require('editor').editor().focus();\n      this.editor().undo();\n      break;\n    default:\n      break;\n\t }\n}","useCoreAPI":false,"core":false},"i132801925d14b80":{"_id":"i132801925d14b80","component":"Editor","state":"redo","action":"function redo() { \n\t switch (this.type()) {\n    case 'ace':\n      this.require('editor').editor().focus();\n      this.editor().redo();\n      break;\n    case 'codemirror':\n      this.require('editor').editor().focus();\n      this.editor().redo();\n      break;\n    default:\n      break;\n\t }\n}","useCoreAPI":false,"core":false},"s1134312b151d82d":{"_id":"s1134312b151d82d","component":"Editor","state":"selectAll","action":"function selectAll() {\n  switch (this.type()) {\n    case 'ace':\n      this.require('editor').editor().focus();\n      this.editor().selectAll();\n      break;\n    case 'codemirror':\n      this.require('editor').editor().focus();\n      this.require('editor').editor().setSelection({\n        line: this.require('editor').editor().firstLine(),\n        ch: 0\n      }, {\n          line: this.require('editor').editor().lastLine() + 1,\n          ch: 0\n        });\n      break;\n    default:\n      break;\n  }\n}","useCoreAPI":false,"core":false},"o1b84c1595615c6f":{"_id":"o1b84c1595615c6f","component":"Editor","state":"copy","action":"function copy() { \n  switch (this.type()) {\n    case 'ace':\n      this.require('editor').editor().focus();\n      document.execCommand('copy');\n      break;\n    case 'codemirror':\n      this.require('editor').editor().focus();\n      document.execCommand('copy');\n      break;\n    default:\n      break;\n  }\n}","useCoreAPI":false,"core":false},"e180711f2cf19133":{"_id":"e180711f2cf19133","component":"Editor","state":"paste","action":"function paste() { \n\t switch (this.type()) {\n    case 'ace':\n      this.require('editor').editor().focus();\n      if (!document.execCommand('paste', null, null)) {\n        // TODO\n      }\n      break;\n    case 'codemirror':\n      if (!document.execCommand('paste', null, null)) {\n        // TODO\n      }\n      break;\n    default:\n      break;\n\t }\n}","useCoreAPI":false,"core":false},"p14b27128f61643e":{"_id":"p14b27128f61643e","component":"Export","state":"toJSON","action":"function toJSON(isMaster) {\n  var system = this.require('db').collections().System.find({\n    '_id': this.require('factory').system().id()\n  })[0];\n  system = JSON.parse(JSON.stringify(system));\n\n  system = JSON.parse(JSON.stringify(system));\n\n  if (isMaster) {\n    system.master = true;\n  } else {\n    system.master = false;\n  }\n\n  return JSON.stringify(system);\n}","useCoreAPI":false,"core":false},"g131c91154e14849":{"_id":"g131c91154e14849","component":"Export","state":"toHTML","action":"function toHTML(logLevel) {\n  var system = this.require('db').collections().System.find({\n    '_id': this.require('factory').system().id()\n  })[0];\n  system = JSON.parse(JSON.stringify(system));\n\n  var source = this.require('export-app.html').source();\n\n  source = source\n    .replace(/{{name}}/g, this.require('factory').system().name())\n    .replace(/{{logLevel}}/g, $('#designer-dialog-export-options-log-level-select').val())\n    .replace(/{{system}}/g, function (val) { return JSON.stringify(system) });\n\n  return source;\n}","useCoreAPI":false,"core":false},"r11d81144f810201":{"_id":"r11d81144f810201","component":"Export","state":"toNode","action":"function toNode(logLevel) {\n  var system = this.require('db').collections().System.find({\n    '_id': this.require('factory').system().id()\n  })[0];\n  system = JSON.parse(JSON.stringify(system));\n\n  var source = this.require('app.js').source();\n\n  source = source\n    .replace(/{{version}}/g, this.require('factory').system().version())\n    .replace(/{{description}}/g, this.require('factory').system().description().replace(/\\n/g, '\\n * '))\n    .replace(/{{name}}/g, this.require('factory').system().name())\n    .replace(/{{logLevel}}/g, $('#designer-dialog-export-options-log-level-select').val())\n    .replace(/{{system}}/g, JSON.stringify(system));\n\n  return source;\n}","useCoreAPI":false,"core":false},"h14919197fb17aaf":{"_id":"h14919197fb17aaf","component":"Export","state":"toJavaScript","action":"function toJavaScript(logLevel) {\n  var system = this.require('db').collections().System.find({\n    '_id': this.require('factory').system().id()\n  })[0];\n  system = JSON.parse(JSON.stringify(system));\n\n  var source = this.require('javascript-export.js').source();\n\n  source = source\n    .replace(/{{version}}/g, this.require('factory').system().version())\n    .replace(/{{description}}/g, this.require('factory').system().description().replace(/\\n/g, '\\n * '))\n    .replace(/{{name}}/g, this.require('factory').system().name())\n    .replace(/{{logLevel}}/g, $('#designer-dialog-export-options-log-level-select').val());\n\n  // SYSTEM\n\n  var confSystem = {};\n\n  confSystem._id = system._id;\n  confSystem.name = system.name;\n  confSystem.version = system.version;\n  confSystem.description = system.description;\n\n  source = source + '/**\\n';\n  source = source + ' * System ' + confSystem.name + '\\n';\n  source = source + ' * @system\\n';\n  source = source + ' */\\n';\n  source = source + 'runtime.system(' + JSON.stringify(confSystem, null, '\\t', 2) + ');\\n\\n';\n\n  // SCHEMA / MODEL / TYPE     \n  if (Object.keys(system.schemas).length > 0 || Object.keys(system.types).length > 0) {\n    source = source + '\\n// Schemas, models and types creation\\n\\n\\n';\n  }\n\n  var name = '';\n  var schemaSorted = [];\n  var schemaNameSorted = [];\n  var schemaName = {};\n\n  for (name in system.schemas) {\n    schemaSorted.push(system.schemas[name]);\n    schemaNameSorted.push(system.schemas[name]._name);\n    schemaName[system.schemas[name]._name] = system.schemas[name]._name;\n  }\n  schemaSorted.sort(function (schemaA, schemaB) {\n    return schemaA._name > schemaB._name;\n  });\n  schemaNameSorted.sort();\n\n  schemaSorted.forEach(function (schema) {\n    source = source + '/**\\n';\n    source = source + ' * Schema ' + schema._name + '\\n';\n    source = source + ' * @schema\\n';\n    source = source + ' */\\n';\n    source = source + 'runtime.require(\\'metamodel\\').schema(' + JSON.stringify(schema, null, '\\t', 2) + ');\\n\\n';\n  });\n\n  var modelSorted = [];\n  var modelNameSorted = [];\n  for (name in system.models) {\n    modelSorted.push(system.models[name]);\n    modelNameSorted.push(system.models[name]._name);\n  }\n  modelSorted.sort(function (modelA, modelB) {\n    return modelA._name > modelB._name;\n  });\n  modelNameSorted.sort();\n\n  modelSorted.forEach(function (model) {\n    source = source + '/**\\n';\n    source = source + ' * Model ' + model._name + '\\n';\n    source = source + ' * @model\\n';\n    source = source + ' */\\n';\n    source = source + 'runtime.require(\\'metamodel\\').model(' + JSON.stringify(model, null, '\\t', 2) + ');\\n\\n';\n  });\n\n  var typeSorted = [];\n  var typeNameSorted = [];\n  for (name in system.types) {\n    typeSorted.push(system.types[name]);\n    typeNameSorted.push(system.types[name].name);\n  }\n  typeSorted.sort(function (typeA, typeB) {\n    return typeA.name > typeB.name;\n  });\n  typeNameSorted.sort();\n\n  typeSorted.forEach(function (type) {\n    source = source + '/**\\n';\n    source = source + ' * Type ' + type.name + '\\n';\n    source = source + ' * @type\\n';\n    source = source + ' */\\n';\n    source = source + 'runtime.require(\\'metamodel\\').type(' + JSON.stringify(type, null, '\\t', 2) + ');\\n\\n';\n  });\n\n  if (Object.keys(system.schemas).length > 0 || Object.keys(system.models).length > 0 || Object.keys(system.types).length > 0) {\n    source = source + 'runtime.require(\\'metamodel\\').create();\\n\\n';\n  }\n\n  // COMPONENT   \n  if (Object.keys(system.components).length > 0) {\n    source = source + '\\n// Components creation\\n\\n\\n';\n  }\n  schemaNameSorted.forEach(function (collection) {\n    for (name in system.components[collection]) {\n      source = source + '/**\\n';\n      source = source + ' * Component ' + system.components[collection][name]._id + '\\n';\n      source = source + ' * @component\\n';\n      source = source + ' */\\n';\n      source = source + 'new (runtime.require(\\'' + collection + '\\'))(' + JSON.stringify(system.components[collection][name], null, '\\t', 2) + ');\\n\\n';\n    }\n  });\n\n  // BEHAVIOR   \n  if (Object.keys(system.behaviors).length > 0) {\n    source = source + '\\n// Behaviors creation\\n\\n\\n';\n  }\n\n  var behaviors = {};\n  var behaviorsComponentNameSorted = [];\n  var modelsByName = {};\n\n  for (name in system.behaviors) {\n    if (typeof behaviors[system.behaviors[name].component] === 'undefined') {\n      behaviors[system.behaviors[name].component] = [];\n    }\n    behaviors[system.behaviors[name].component].push(system.behaviors[name]);\n  }\n\n  behaviorsComponentNameSorted = Object.keys(behaviors);\n  behaviorsComponentNameSorted.sort();\n\n  var id = '';\n  for (id in system.models) {\n    modelsByName[system.models[id]._name] = system.models[id];\n  }\n\n  behaviorsComponentNameSorted.forEach(function forEach(componentName) {\n    var componentBehaviors = behaviors[componentName];\n\n    componentBehaviors.sort(function sort(behaviorA, behaviorB) {\n      return behaviorA.state > behaviorB.state;\n    });\n\n    if (componentBehaviors.length > 0) {\n      if (componentName === system._id) {\n        source = source + '// system behaviors\\n\\n';\n      } else {\n        source = source + '// ' + componentName + ' behaviors\\n\\n';\n      }\n    }\n\n    componentBehaviors.forEach(function forEach(behavior) {\n      var useCoreAPI = typeof behavior.useCoreAPI !== 'undefined' ? behavior.useCoreAPI : false;\n      var core = typeof behavior.core !== 'undefined' ? behavior.core : false;\n      var comp = '';\n      var behaviorParamDef = {};\n      var options = ');\\n\\n';\n\n      if (useCoreAPI && !core) {\n        options = ', true);\\n\\n';\n      }\n      if (useCoreAPI && core) {\n        options = ', true, true);\\n\\n';\n      }\n\n      source = source + '/**\\n';\n      source = source + ' * @method ' + behavior.state + '\\n';\n\n      if (modelsByName[behavior.component] && modelsByName[behavior.component][behavior.state] && modelsByName[behavior.component][behavior.state].params) {\n        modelsByName[behavior.component][behavior.state].params.forEach(function forEach(param) {\n          source = source + ' * @param {' + param.type + '} ' + param.name + '\\n';\n        });\n      }\n      if (modelsByName[behavior.component] && modelsByName[behavior.component][behavior.state] && modelsByName[behavior.component][behavior.state].result) {\n        source = source + ' * @returns {' + modelsByName[behavior.component][behavior.state].result + '} \\n';\n      }\n\n      source = source + ' */\\n';\n\n      switch (true) {\n        case behavior.component === system._id:\n          comp = 'runtime.system()';\n          break;\n        default:\n          comp = 'runtime.require(\\'' + behavior.component + '\\')';\n          break;\n      }\n\n      source = source + comp + '.on(\\'' + behavior.state + '\\', ' + behavior.action + options;\n    })\n  });\n\n  // START\n  source = source + '// Start the system\\n';\n  source = source + 'runtime.system().start();\\n';\n\n  return source;\n}","useCoreAPI":false,"core":false},"e13c7916b1a15fc4":{"_id":"e13c7916b1a15fc4","component":"Export","state":"toGraphviz","action":"function toGraphviz(diagramType) {\n  var schemas = this.require('factory').system().schemas();\n  var models = this.require('factory').system().models();\n  var types = this.require('factory').system().types();\n  var components = this.require('factory').system().components();\n  var inheritance = '';\n  var modelId = '';\n  var typeId = '';\n  var componentId = '';\n  var modelName = '';\n  var typeName = '';\n  var modelDescription = '';\n  var propName = '';\n  var propVal = '';\n  var propDef = '';\n  var attributes = '';\n  var methods = '';\n  var result = '';\n  var dependencies = '';\n  var instancesOf = '';\n  var links = '';\n  var collections = '';\n  var instances = '';\n  var that = this;\n  var keys = [];\n  var sortedKeys = {};\n  var generatedDiagram = '';\n  var parents = '';\n  var modelNames = [];\n  var modelDef = {};\n  var schemaDef = {};\n  var incoming = '';\n  var outgoing = '';\n  var edges = '';\n  var relationships = '';\n  var instancesRelation ='';\n  var kindToEdgeStyle = {\n    'normal': 'none',\n    'dependency': 'vee',\n    'composition': 'diamond',\n    'aggregation': 'odiamond'\n  };\n\n  callbackProp = function (param) {\n    var realType = param.type;\n    var isArray = false;\n\n    if (Array.isArray(param.type)) {\n      isArray = true;\n      realType = param.type[0];\n    }\n\n    if (that.require('factory').isModel(realType) && realType !== '_Component') {\n      if (isArray) {\n        params = params + param.name + ' : [' + realType + '], ';\n      } else {\n        params = params + param.name + ' : ' + realType + ', ';\n      }\n    } else {\n      if (['any', 'boolean', 'string', 'number', 'object', 'function', 'array', 'html', 'javascript', 'css', 'errorInfo', 'json', 'text', 'date'].indexOf(realType) === -1 && realType !== '_Component') {\n        if (isArray) {\n          params = params + param.name + ' : [' + realType + '], ';\n        } else {\n          params = params + param.name + ' : ' + realType + ', ';\n        }\n      } else {\n        if (isArray) {\n          params = params + param.name + ' : [' + realType + '], ';\n        } else {\n          params = params + param.name + ' : ' + realType + ', ';\n        }\n      }\n    }\n  };\n\n  function _getReturnType(returnType) {\n    var result = '';\n    var realType = returnType;\n    var isArray = false;\n\n    if (Array.isArray(returnType)) {\n      isArray = true;\n      realType = returnType[0];\n    }\n\n    if (that.require('factory').isModel(realType) && realType !== '_Component') {\n      if (isArray) {\n        result = '[' + realType + ']';\n      } else {\n        result = realType;\n      }\n    } else {\n      if (['any', 'boolean', 'string', 'number', 'object', 'function', 'array', 'html', 'javascript', 'css', 'errorInfo', 'json', 'text', 'date'].indexOf(realType) === -1 && realType !== '_Component') {\n        if (isArray) {\n          result = '[' + realType + ']';\n        } else {\n          result = realType;\n        }\n      } else {\n        if (isArray) {\n          result = '[' + realType + ']';\n        } else {\n          result = realType;\n        }\n      }\n    }\n    return result;\n  }\n\n  function _getModelId(name) {\n    var result = '',\n      id = '';\n\n    for (id in that.require('factory').system().models()) {\n      if (that.require('factory').system().models()[id]._name === name) {\n        result = id;\n        break;\n      }\n    }\n    return result;\n  }\n\n  function _isType(name) {\n    return typeof types[name] !== 'undefined';\n  }\n\n  function _clean(text) {\n    return text.replace(/\\{/g, '').replace(/\\}/g, '');\n  }\n\n  function _cleanName(text) {\n    return text.toString()\n              .replace(/\\'/g, ' ')\n              .replace(/\\./g, '')\n              .replace(/\\-/g, '')\n              //.replace(/node/i, '_node')\n              .replace(/edge/i, '_edge')\n              .replace(/graph/i, '_graph')\n              .replace(/digraph/i, '_digraph')\n              .replace(/subgraph/i, '_subgraph')\n              .replace(/strict/i, '_strict')\n              .trim()\n              .replace(/ /g, '_');\n  }\n\n  function _cleanVal(text) {\n    var clean = JSON.stringify(text)\n      .replace(/\\\"/g, ' ')\n      .replace(/\\'/g, ' ')\n      .trim()\n      .replace(/\\./g, '\\\\.')\n      .replace(/\\-/g, '\\\\-')\n      .replace(/\\{/g, '\\\\{')\n      .replace(/\\}/g, '\\\\}')\n      .replace(/\\</g, '\\\\<')\n      .replace(/\\>/g, '\\\\>')\n      .replace(/\\\\n/g, '');\n\n    if (clean.length > 42) {\n      return clean.substring(0, 42) + '...';\n    } else {\n      return clean;\n    }\n  }\n\n  // COMPUTATION\n\n  switch (diagramType) {\n    case 'graph':\n\n      // create node\n      for (modelId in models) {\n\n        modelName = models[modelId]._name;\n        parents = this.require('factory').getParents(modelName);\n        if (modelName !== 'Nodes' && modelName !== 'Relationships' && parents.indexOf('Nodes') !== -1) {\n          modelNames.push(modelName);\n          modelDescription += '\\n\\n\\t' + _cleanName(modelName) + ' [\\n\\t\\tlabel = ' + modelName + '\\n\\t]';\n        }\n      }\n\n      // create relationships\n      for (modelId in models) {\n\n        modelName = models[modelId]._name;\n        parents = this.require('factory').getParents(modelName);\n        modelDef = this.require('factory').getGeneratedModel(modelName);\n        if (modelName !== 'Nodes' && modelName !== 'Relationships' && parents.indexOf('Relationships') !== -1) {\n          incoming = modelDef.incoming.type;\n          outgoing = modelDef.outgoing.type;\n\n          edges += `\\n\\tedge [\n    fontname = \"Helvetica\"\n    headlabel = \"\"\n    taillabel = \"\"\n    fontsize = 5\n    label     = ${modelName}\n  ]`;\n\n          switch (true) {\n            case incoming === 'Nodes' && outgoing === 'Nodes':\n              modelNames.forEach(function (incoming) {\n                modelNames.forEach(function (outgoing) {\n                  edges += '\\n\\t' + _cleanName(incoming) + ' -> ' + _cleanName(outgoing) + '\\n';\n                });\n              });\n              break;\n            case incoming === 'Nodes' && outgoing !== 'Nodes':\n              modelNames.forEach(function (incoming) {\n                edges += '\\n\\t' + _cleanName(incoming) + ' -> ' + _cleanName(outgoing) + '\\n';\n              });\n              break;\n            case incoming !== 'Nodes' && outgoing !== 'Nodes':\n              edges += '\\n\\t' + _cleanName(incoming) + ' -> ' + _cleanName(outgoing) + '\\n';\n              break;\n            default:\n              break;\n          }\n        }\n      }\n\n      break;\n\n    case 'component':\n\n      // create instances\n      for (modelName in components) {\n        schemaDef = this.require('factory').getGeneratedSchema(modelName);\n        parents = this.require('factory').getParents(modelName);\n\n        for (componentId in components[modelName]) {\n          \n          if (modelName === 'Relationships' || parents.indexOf('Relationships') !== -1) {\n            instancesRelation += '\\n\\n\\t' + _cleanName(componentId) + ' [\\n\\t\\tlabel = \"{\\n\\t\\t\\t' + componentId + ' : ' + modelName + '|';\n          } else {\n            instances += '\\n\\n\\t' + _cleanName(componentId) + ' [\\n\\t\\tlabel = \"{\\n\\t\\t\\t' + componentId + ' : ' + modelName + '|';\n          }\n          attributes = '';\n          \n          keys = [];\n          sortedKeys = {};\n          \n           // get keys\n          for (propName in components[modelName][componentId]) {\n            keys.push(propName);\n          }\n          keys.sort();\n          \n          // sorted keys\n          keys.forEach(function(key) {\n            sortedKeys[key] = components[modelName][componentId][key];\n          }.bind(this));\n\n          for (var prop in sortedKeys) {\n            if (prop !== '_id') {\n              if (prop !== 'incoming' && prop !== 'outgoing') {\n                if (schemaDef[prop] && schemaDef[prop] === 'collection') {\n                  if (sortedKeys[prop].length > 0) {\n                    attributes += '\\n\\t\\t\\t' + prop + ' = [\\\\l' + sortedKeys[prop].map(function(item) { return _cleanVal(item)}).join(',\\\\l') + '\\\\l]\\\\l'; \n                  } else {\n                    attributes += '\\n\\t\\t\\t' + prop + ' = []\\\\l'; \n                  }\n                } else {\n                  attributes += '\\n\\t\\t\\t' + prop + ' = ' + _cleanVal(sortedKeys[prop]) + '\\\\l';\n                }\n              }\n              \n              if (schemaDef[prop] && (schemaDef[prop] === 'link' || schemaDef[prop] === 'collection')) {\n                if (sortedKeys[prop] !== '') {\n                \n                  switch(prop) {\n                    case 'incoming':\n                      relationships += '\\n\\t' + _cleanName(sortedKeys[prop]) + ' -> ' + _cleanName(componentId); \n                      break;\n                    case 'outgoing':\n                      relationships += '\\n\\t' + _cleanName(componentId) + ' -> ' + _cleanName(sortedKeys[prop]); \n                      break;\n                    default:\n                      if (Array.isArray(sortedKeys[prop])) {\n                        sortedKeys[prop].forEach(function(item) {\n                          dependencies += '\\n\\t' + _cleanName(componentId) + ' -> ' + _cleanName(item);  \n                        })\n                      } else {\n                        dependencies += '\\n\\t' + _cleanName(componentId) + ' -> ' + _cleanName(JSON.stringify(sortedKeys[prop]));\n                      }\n                      break;\n                  }\n                }\n              }\n            }\n          }\n\n          if (modelName === 'Relationships' || parents.indexOf('Relationships') !== -1) {\n            instancesRelation += attributes;\n            instancesRelation += '\\n\\t\\t}\"\\r\\t]';\n          } else {\n            instances += attributes;\n            instances += '\\n\\t\\t}\"\\r\\t]';\n          }\n        }\n      }\n      break;\n\n    case 'class':\n\n      // create model for types\n      for (typeId in types) {\n\n        // structure\n        if (types[typeId].schema) {\n          typeName = types[typeId].name;\n          modelDescription += '\\n\\n\\t' + _cleanName(typeName) + ' [\\n\\t\\tlabel = \"{\\n\\t\\t\\t' + typeName + '|';\n\n          attributes = '';\n          keys = [];\n          sortedKeys = {};\n\n          // get keys\n          for (propName in types[typeId].schema) {\n            keys.push(propName);\n          }\n          keys.sort();\n\n          // sorted keys\n          keys.forEach(function (key) {\n            sortedKeys[key] = types[typeId].schema[key];\n          }.bind(this));\n\n          for (propName in sortedKeys) {\n            if (types[typeId].schema.hasOwnProperty(propName)) {\n              propDef = types[typeId].schema[propName];\n              attributes += '\\n\\t\\t\\t+ ' + propName + ' : ' + propDef.type + '\\\\l';\n              if (_isType(propDef.type)) {\n                dependencies += '\\n\\t' + _cleanName(typeName) + ' -> ' + propDef.type;\n              }\n            }\n          }\n\n          modelDescription += _clean(attributes);\n          modelDescription += '\\n\\t\\t}\"\\r\\t]';\n        }\n\n        // enumeration\n        if (types[typeId].value) {\n          typeName = types[typeId].name;\n          modelDescription += '\\n\\n\\t' + _cleanName(typeName) + ' [\\n\\t\\tlabel = \"{\\n\\t\\t\\t\\\\<\\\\<enumeration\\\\>\\\\>\\\\l' + typeName + '|';\n\n          attributes = '';\n\n          types[typeId].value.forEach(function (enumValue) {\n            attributes += '\\n\\t\\t\\t' + enumValue + '\\\\l';\n          });\n\n          modelDescription += _clean(attributes);\n          modelDescription += '\\n\\t\\t}\"\\r\\t]';\n        }\n      }\n\n      // create model\n      for (modelId in models) {\n\n        modelName = models[modelId]._name;\n        modelDescription += '\\n\\n\\t' + _cleanName(modelName) + ' [\\n\\t\\tlabel = \"{\\n\\t\\t\\t' + modelName + '|';\n\n        attributes = '';\n        methods = '';\n        keys = [];\n        sortedKeys = {};\n\n        // get keys\n        for (propName in models[modelId]) {\n          keys.push(propName);\n        }\n        keys.sort();\n\n        // sorted keys\n        keys.forEach(function (key) {\n          sortedKeys[key] = models[modelId][key];\n        }.bind(this));\n\n        for (propName in sortedKeys) {\n          if (models[modelId].hasOwnProperty(propName)) {\n            propVal = models[modelId][propName];\n\n            switch (true) {\n              case typeof propVal.type !== 'undefined':\n                if (!Array.isArray(propVal.type)) {\n                  if (that.require('factory').isModel(propVal.type)) {\n\n                    links += `\\n\\tedge [\n    fontname = \"Helvetica\"\n    arrowhead = \"${propVal.kind ? kindToEdgeStyle[propVal.kind] : 'none'}\"\n    headlabel = \"1\"\n    taillabel = \"\"\n    label     = \"${propVal.description ? propVal.description : ''}\"\n    style     = \"${propVal.kind === 'dependency' ? 'dashed' : 'normal'}\"\n  ]`\n                    links += '\\n\\t' + _cleanName(modelName) + ' -> ' + propVal.type + '\\n';\n\n                    if (modelId !== '123751cb591de26' && propVal.type !== '_Component') {\n                      attributes += '\\n\\t\\t\\t+ ' + propName + ' : ' + propVal.type + '\\\\l';\n                    } else {\n                      attributes += '\\n\\t\\t\\t+ ' + propName + ' : ' + propVal.type + '\\\\l';\n                    }\n                  } else {\n                    if (['any', 'boolean', 'string', 'number', 'object', 'function', 'array', 'html', 'javascript', 'css', 'json', 'text', 'date'].indexOf(propVal.type) === -1) {\n                      if (modelId !== '123751cb591de26') {\n                        attributes += '\\n\\t\\t\\t+ ' + propName + ' : ' + propVal.type + '\\\\l';\n                        dependencies += '\\n\\t' + _cleanName(modelName) + ' -> ' + propVal.type;\n                      } else {\n                        attributes += '\\n\\t\\t\\t+ ' + propName + ' : ' + propVal.type + '\\\\l';\n                        //links += '\\n\\t' + modelName + ' -> ' + propVal.type;\n                      }\n                    } else {\n                      attributes += '\\n\\t\\t\\t+ ' + propName + ' : ' + propVal.type + '\\\\l';\n                    }\n                  }\n                } else {\n                  if (that.require('factory').isModel(propVal.type[0])) {\n\n                    collections += `\\n\\tedge [\n    fontname = \"Helvetica\"\n    arrowhead = \"${propVal.kind ? kindToEdgeStyle[propVal.kind] : 'none'}\"\n    headlabel = \"0..*\"\n    taillabel = \"\"\n    label     = \"${propVal.description ? propVal.description : ''}\"\n    style     = \"${propVal.kind === 'dependency' ? 'dashed' : 'normal'}\"\n  ]`;\n\n                    collections += '\\n\\t' + _cleanName(modelName) + ' -> ' + propVal.type[0] + '\\n';\n\n                    if (modelId !== '123751cb591de26' && propVal.type[0] !== '_Component') {\n                      attributes += '\\n\\t\\t\\t+ ' + propName + ' : ' + propVal.type[0] + ' [ ]\\\\l';\n                    } else {\n                      attributes += '\\n\\t\\t\\t+ ' + propName + ' : ' + propVal.type[0] + ' [ ]\\\\l';\n                    }\n                  } else {\n                    if (['any', 'boolean', 'string', 'number', 'object', 'function', 'array', 'html', 'javascript', 'css', 'json', 'text', 'date'].indexOf(propVal.type[0]) === -1) {\n                      if (modelId !== '123751cb591de26') {\n                        attributes += '\\n\\t\\t\\t+ ' + propName + ' : ' + propVal.type[0] + ' [ ]\\\\l';\n                        //collections += '\\n\\t' + modelName + ' -> ' + propVal.type[0];\n                        dependencies += '\\n\\t' + _cleanName(modelName) + ' -> ' + propVal.type[0];\n                      } else {\n                        attributes += '\\n\\t\\t\\t+ ' + propName + ' : ' + propVal.type[0] + ' [ ]\\\\l';\n\n                        collections += `\\n\\tedge [\n    fontname = \"Helvetica\"\n    arrowhead = \"${propVal.kind ? kindToEdgeStyle[propVal.kind] : 'none'}\"\n    headlabel = \"0..*\"\n    taillabel = \"\"\n    label     = \"${propVal.description ? propVal.description : ''}\"\n    style     = \"${propVal.kind === 'dependency' ? 'dashed' : 'normal'}\"\n  ]`;\n\n                        collections += '\\n\\t' + _cleanName(modelName) + ' -> ' + propVal.type[0] + '\\n';\n                      }\n                    } else {\n                      attributes += '\\n\\t\\t\\t+ ' + propName + ' : ' + propVal.type[0] + ' [ ]\\\\l';\n                      //collections += '\\n\\t' + modelName + ' -> ' + propVal.type[0];\n                      // do not show types as links\n                    }\n                  }\n                }\n                break;\n\n              case typeof propVal.params !== 'undefined':\n                result = 'undefined';\n                var params = '(';\n                propVal.params.forEach(callbackProp.bind(this));\n                params = params + ')';\n                params = params.replace(', )', ')');\n\n                if (typeof propVal.result !== 'undefined') {\n                  result = _getReturnType(propVal.result);\n                  if (modelId !== '123751cb591de26') {\n                    methods += '\\n\\t\\t\\t+ ' + propName + params + ' : ' + result + '\\\\l';\n                  } else {\n                    methods += '\\n\\t\\t\\t+ ' + propName + params + ' : ' + result + '\\\\l';\n                  }\n                } else {\n                  if (modelId !== '123751cb591de26') {\n                    methods += '\\n\\t\\t\\t+ ' + propName + params + '\\\\l';\n                  } else {\n                    methods += '\\n\\t\\t\\t+ ' + propName + params + '\\\\l';\n                  }\n                }\n                break;\n\n              case propName.indexOf('_') !== -1:\n                // we do not show private / internal properties\n                break;\n\n              default:\n                result = 'undefined';\n                if (typeof propVal.result !== 'undefined') {\n                  result = _getReturnType(propVal.result);\n\n                  if (modelId !== '123751cb591de26') {\n                    methods += '\\n\\t\\t\\t+ ' + propName + '() : ' + result + '\\\\l';\n                  } else {\n                    methods += '\\n\\t\\t\\t+ ' + propName + '() : ' + result + '\\\\l';\n                  }\n                } else {\n                  if (modelId !== '123751cb591de26') {\n                    methods += '\\n\\t\\t\\t+ ' + propName + '()\\\\l';\n                  } else {\n                    methods += '\\n\\t\\t\\t+ ' + propName + '()\\\\l';\n                  }\n                }\n                break;\n            }\n          }\n        }\n\n        modelDescription += _clean(attributes) + '|' + _clean(methods);\n        modelDescription += '\\n\\t\\t}\"\\r\\t]';\n      }\n\n      // create inheritance links\n      for (var schema in schemas) {\n        if (schemas[schema]._inherit && schemas[schema]._inherit.length) {\n          schemas[schema]._inherit.forEach(function (parent) {\n            inheritance += '\\n\\t' + _cleanName(schemas[schema]._name) + ' -> ' + parent;\n          });\n        }\n      }\n\n      // case of Component\n      if (inheritance.indexOf('_Component') !== -1) {\n        modelDescription += `\\n\\n\\t_Component [\n      label = \"{\\n\\t\\t\\t_Component|\\n\\t\\t\\t+ id : string\\\\l|\\n\\t\\t\\t+ destroy()\\\\l\\n\\t\\t\\t+ error(e : object)\\\\l\\n\\t\\t\\t+ init(document : object)\\\\l\\n\\t\\t\\t+ require(id : string) : _Component\\\\l\\n\\t\\t}\"\n  ]`\n      };\n      break;\n\n    default:\n      break;\n  }\n\n  // DIAGRAM\n \n  switch (diagramType) {\n    case 'graph':\n      generatedDiagram = `digraph system {\n  fontname = \"Helvetica\"\n  rankdir = LR\n  size = 8\n\n  node [\n    fontname = \"Helvetica\"\n    fontsize = 10\n    shape = \"circle\"\n  ]\n  ${modelDescription}\n  ${edges}\n}`;\n      break;\n\n    case 'component':\n      generatedDiagram = `digraph system {\n  fontname = \"Helvetica\"\n  fontsize = 10\n      \n  node [\n    fontname = \"Helvetica\"\n    fontsize = 10\n    shape = \"record\"\n  ]\n  ${instances}\n  \n  node [\n    fontname = \"Helvetica\"\n    fontsize = 10\n    shape = \"record\"\n    style = \"rounded\"\n  ]\n  ${instancesRelation}\n  \n  edge [\n    fontname = \"Helvetica\"\n    arrowhead = \"none\"\n    headlabel = \"\"\n    taillabel = \"\"\n    label     = \"\"\n    style     = \"normal\"\n  ]\n  ${dependencies}\n  \n  edge [\n    fontname = \"Helvetica\"\n    arrowhead = \"vee\"\n    headlabel = \"\"\n    taillabel = \"\"\n    label     = \"\"\n    style     = \"normal\"\n  ]\n  ${relationships}\n}`;\n      break;\n\n    case 'class':\n      generatedDiagram = `digraph system {\n  fontname = \"Helvetica\"\n  fontsize = 10\n\n  node [\n    fontname = \"Helvetica\"\n    fontsize = 10\n    shape = \"record\"\n  ]\n  \n  edge [\n    fontname = \"Helvetica\"\n    fontsize = 10\n  ]${modelDescription}\n  \n  node [\n    fontname = \"Helvetica\"\n    fontsize = 10\n  ]\n  ${instances}\n  \n  edge [\n    fontname = \"Helvetica\"\n    arrowhead = \"vee\"\n    headlabel = \"\"\n    taillabel = \"\"\n    label     = \"\"\n    style     = \"dashed\"\n  ]\n  ${dependencies}\n  \n  edge [\n    fontname = \"Helvetica\"\n    arrowhead = \"vee\"\n    headlabel = \"\"\n    taillabel = \"\"\n    label     = \"\"\n    style     = \"dashed\"\n  ]\n  ${instancesOf}\n  \n  ${links}\n  ${collections}\n  edge [\n    fontname = \"Helvetica\"\n    fontsize = 10\n    arrowhead = \"empty\"\n    headlabel = \"\"\n    taillabel = \"\"\n    label     = \"\"\n    style     = \"normal\"\n  ]\n  ${inheritance}\n}`;\n      break;\n\n    default:\n      break;\n  }\n\n  return generatedDiagram;\n}","useCoreAPI":false,"core":false},"1c2e3132fd18c75":{"_id":"1c2e3132fd18c75","component":"Github","state":"refresh","action":"function refresh() {\n  var config = {},\n    gh = null,\n    userName = '',\n    repository = '';\n\n  config = this.require('storage').get('system-designer-config');\n  if (config && config.githubToken && config.githubRepository) {\n\n    gh = new GitHub({\n      token: atob(config.githubToken)\n    });\n\n    userName = config.githubRepository.split('/')[0];\n    repository = config.githubRepository.split('/')[1];\n\n    repo = gh.getRepo(userName, repository);\n\n    repo.getContents('master', '', 'raw')\n      .then(function (contents) {\n        contents.data.forEach(function (item) {\n          if (item.type === 'file' && item.name.indexOf('.json') !== -1) {\n            repo.getContents('master', item.name, 'raw')\n              .then(function (content) {\n                var system = content.data,\n                  systems = runtime.require('storage').get('system-designer-systems'),\n                  sys = null,\n                  sysStorage = null;\n\n                // check valid system\n                if (\n                  (Object.keys(system).indexOf('schemas') !== -1) &&\n                  (Object.keys(system).indexOf('models') !== -1) &&\n                  (Object.keys(system).indexOf('behaviors') !== -1) &&\n                  (Object.keys(system).indexOf('types') !== -1) &&\n                  (Object.keys(system).indexOf('components') !== -1)\n                ) {\n                  if (runtime.require('storage').get(system._id)) {\n                    runtime.require('github').merge(system);\n                  } else {\n                    runtime.require('storage').set(system._id, system);\n                  }\n\n                  // save index\n                  if (!systems) {\n                    systems = { 'systems': [system._id] };\n                  } else {\n                    if (systems.systems.indexOf(system._id) === -1) {\n                      systems.systems.push(system._id);\n                    }\n                  }\n                  runtime.require('storage').set('system-designer-systems', systems);\n\n                  // refresh\n                  if (!runtime.require('factory').system()) {\n                    sys = runtime.require('factory').create(system);\n                    runtime.require('state').space(sys.name());\n                  }\n\n                  runtime.require('spaces').render();\n                  runtime.require('workspace').render();\n                  runtime.require('router').update();\n\n                  runtime.require('designer').save();\n                }\n              })\n              .catch(function (e) {\n                runtime.require('message').danger('<strong>GitHub:</strong> ' + e.response.data.message + '.');\n              });\n          }\n        });\n\n        if (contents.data.length === 0) {\n          runtime.require('message').info('there is no system in your repository.');\n        } else {\n          runtime.require('message').success('Pull request finished with success.');\n        }\n      })\n      .catch(function (e) {\n        runtime.require('message').danger('<strong>GitHub:</strong> ' + e.response.data.message + '.');\n      });\n  } else {\n    runtime.require('message').warning('No configuration found for GitHub. Please set the correct information in the configuration panel.');\n  }\n}","useCoreAPI":false,"core":false},"11845140101e5ae":{"_id":"11845140101e5ae","component":"Github","state":"push","action":"function push(comment, createHTML, createNode, logLevel, createPackage) {\n  var config = {},\n    gh = null,\n    userName = '',\n    repository = '',\n    designer = null,\n    system = {},\n    repo1 = null,\n    repo2 = null,\n    repo3 = null;\n\n  config = this.require('storage').get('system-designer-config');\n  if (config && config.githubToken && config.githubRepository) {\n\n    gh = new GitHub({\n      token: atob(config.githubToken)\n    });\n\n    userName = config.githubRepository.split('/')[0];\n    repository = config.githubRepository.split('/')[1];\n\n    designer = this.require('designer');\n\n    if (this.require('factory').system()) {\n      system = this.require('db').collections().System.find({\n        '_id': this.require('factory').system().id()\n      })[0];\n\n      system = JSON.parse(JSON.stringify(system));\n\n      repo1 = gh.getRepo(userName, repository);\n      repo2 = gh.getRepo(userName, repository);\n      repo3 = gh.getRepo(userName, repository);\n      repo4 = gh.getRepo(userName, repository);\n      \n      var generatedId = Math.random() * 100000000000000000;\n      var tempParam = '?_temp=' + generatedId;\n\n      repo1.writeFile('master', system.name + '.json' + tempParam, JSON.stringify(system), comment || 'updated with System Designer', {})\n        .then(function (response) {\n          var name = response.data.content.name.replace('.json', '');\n          var js = '';\n          var htmlSource = '';\n          var jsSource = '';\n          var packageSource = {};\n\n          runtime.require('message').success('system ' + name + ' pushed on GitHub.');\n\n          // HTML\n          if (createHTML) {\n            htmlSource = runtime.require('export-app-github.html').source();\n            htmlSource = htmlSource\n              .replace(/{{logLevel}}/g, logLevel)\n              .replace(/{{name}}/g, runtime.require('factory').system().name());\n\n            repo2.writeFile('master', runtime.require('factory').system().name() + '.html' + tempParam, htmlSource, 'created with System Designer', {})\n              .then(function (response) {\n                var name = response.data.content.name;\n                runtime.require('message').success(name + ' created on GitHub.');\n              })\n              .catch(function (e) {\n                runtime.require('message').danger('<strong>GitHub:</strong> ' + e.response.data.message + '.');\n              });\n          }\n\n          // Node\n          if (createNode) {\n            jsSource = runtime.require('app-github.js').source();\n            jsSource = jsSource\n              .replace(/{{logLevel}}/g, logLevel)\n              .replace(/{{description}}/g, runtime.require('factory').system().description().replace(/\\n/g, '\\n * '))\n              .replace(/{{version}}/g, runtime.require('factory').system().version())\n              .replace(/{{name}}/g, runtime.require('factory').system().name());\n\n            repo3.writeFile('master', runtime.require('factory').system().name() + '.js' + tempParam, jsSource, 'created with System Designer', {})\n              .then(function (response) {\n                var name = response.data.content.name;\n                runtime.require('message').success(name + ' created on GitHub.');\n              })\n              .catch(function (e) {\n                runtime.require('message').danger('<strong>GitHub:</strong> ' + e.response.data.message + '.');\n              });\n          }\n\n          // PACKAGE\n          if (createPackage) {\n            packageSource.name = runtime.require('factory').system().name();\n            packageSource.version = runtime.require('factory').system().version();\n            packageSource.description = runtime.require('factory').system().description();\n            packageSource.main = './' + runtime.require('factory').system().name() + '.json';\n            packageSource.repository = {};\n            packageSource.repository.type = 'git';\n            packageSource.repository.url = 'https://github.com/' + config.githubRepository;\n\n            repo4.writeFile('master', 'package.json' + tempParam, JSON.stringify(packageSource, null, '  ').toString(), 'created with System Designer', {})\n              .then(function (response) {\n                var name = response.data.content.name;\n                runtime.require('message').success(name + ' created on GitHub.');\n              })\n              .catch(function (e) {\n                runtime.require('message').danger('<strong>GitHub:</strong> ' + e.response.data.message + '.');\n              });\n          }\n        })\n        .catch(function (e) {\n          runtime.require('message').danger('<strong>GitHub:</strong> ' + e.response.data.message + '.');\n        });\n    } else {\n      runtime.require('message').warning('There is no system to push on GitHub.');\n    }\n  } else {\n    runtime.require('message').warning('No configuration found for GitHub. Please set the correct information in the configuration panel.');\n  }\n}","useCoreAPI":false,"core":false},"y194b01571d100d9":{"_id":"y194b01571d100d9","component":"Github","state":"merge","action":"function merge(sys) {\n  var System = this.require('System'),\n    name = '',\n    propName = '',\n    modelName = '',\n    compId = '',\n    modelId = '',\n    schemaId = '',\n    designer = this.require('designer'),\n    schemas = {},\n    models = {},\n    types = {},\n    components = {},\n    behaviors = {},\n    system = this.require('storage').get(sys._id),\n    message = this.require('message');\n\n  function _getModelId(name) {\n    var result = '',\n      id = '';\n\n    for (id in system.models) {\n      if (system.models[id]._name === name) {\n        result = id;\n        break;\n      }\n    }\n    return result;\n  }\n\n  function _getSchemaId(name) {\n    var result = '',\n      id = '';\n\n    for (id in system.schemas) {\n      if (system.schemas[id]._name === name) {\n        result = id;\n        break;\n      }\n    }\n    return result;\n  }\n\n  function _canOverrideBehavior(id, component, state, behaviors) {\n    var behavior = {},\n      behaviorId = '';\n\n    for (behaviorId in behaviors) {\n      behavior = behaviors[behaviorId];\n      if (behavior.component === component && behavior.state === state && behavior._id !== id) {\n        delete behaviors[behavior._id];\n        break;\n      }\n    }\n  }\n\n  function _canOverride(sysId, schemas, behaviors, behavior) {\n    var def = {},\n      id = '',\n      result = true;\n\n    id = _getSchemaId(behavior.component);\n    def = schemas[id];\n\n    if (def && def[behavior.state]) {\n      if (def[behavior.state] === 'method') {\n        _canOverrideBehavior(behavior._id, behavior.component, behavior.state, behaviors);\n      }\n    }/* else {\n      result = false;\n    }*/ // case of behavior on components\n\n    return result;\n  }\n\n  if (Object.keys(sys).length) {\n\n    // schemas\n    schemas = JSON.parse(JSON.stringify(system.schemas));\n    for (name in sys.schemas) {\n      if (schemas[name]) {\n        for (propName in sys.schemas[name]) {\n          schemas[name][propName] = sys.schemas[name][propName];\n        }\n      } else {\n        if (!_getSchemaId(sys.schemas[name]._name)) {\n          schemas[name] = sys.schemas[name];\n        } else {\n          for (propName in sys.schemas[name]) {\n            if (propName.indexOf('_') !== 0) {\n              schemas[_getSchemaId(sys.schemas[name]._name)][propName] = sys.schemas[name][propName];\n            }\n          }\n        }\n      }\n    }\n    system.schemas = schemas;\n\n    // models\n    models = JSON.parse(JSON.stringify(system.models));\n    for (name in sys.models) {\n      if (models[name]) {\n        for (propName in sys.models[name]) {\n          models[name][propName] = sys.models[name][propName];\n        }\n      } else {\n        if (!_getModelId(sys.models[name]._name)) {\n          models[name] = sys.models[name];\n        } else {\n          for (propName in sys.models[name]) {\n            if (propName.indexOf('_') !== 0) {\n              models[_getModelId(sys.models[name]._name)][propName] = sys.models[name][propName];\n            }\n          }\n        }\n      }\n    }\n    system.models = models;\n\n    // types\n    types = JSON.parse(JSON.stringify(system.types));\n    for (name in sys.types) {\n      if (types[name]) {\n        for (propName in sys.types[name]) {\n          types[name][propName] = sys.types[name][propName];\n        }\n      } else {\n        types[name] = sys.types[name];\n      }\n    }\n    system.types = types;\n\n    // behaviors\n    behaviors = JSON.parse(JSON.stringify(system.behaviors));\n    for (name in sys.behaviors) {\n      if (sys.behaviors[name].component === sys._id || _canOverride(sys._id, schemas, behaviors, sys.behaviors[name])) {\n        behaviors[name] = sys.behaviors[name];\n      }\n    }\n    system.behaviors = behaviors;\n\n    // components\n    components = JSON.parse(JSON.stringify(system.components));\n    for (modelName in sys.components) {\n      if (!components[modelName]) {\n        components[modelName] = {};\n      }\n      for (compId in sys.components[modelName]) {\n        if (components[modelName][compId]) {\n          for (propName in sys.components[modelName][compId]) {\n            components[modelName][compId][propName] = sys.components[modelName][compId][propName];\n          }\n        } else {\n          components[modelName][compId] = sys.components[modelName][compId];\n        }\n      }\n    }\n\n    system.schemas = schemas;\n    system.models = models;\n    system.types = types;\n    system.behaviors = behaviors;\n    system.components = components;\n\n    system.version = sys.version;\n    system.description = sys.description;\n\n    this.require('storage').set(sys._id, system);\n    if (this.require('factory').system().id() === system._id) {\n      this.require('factory').create(system);\n    }\n  } else {\n    if (this.require('factory').system()) {\n      message.danger('The system you try to merge is invalid.');\n    } else {\n      message.danger('There is no system to compose with.');\n    }\n  }\n}","useCoreAPI":false,"core":false},"c103c31cc9d1821e":{"_id":"c103c31cc9d1821e","component":"HTML","state":"render","action":"function render(id) { \n  var dom = null;\n  \n  id = id || 'designer-workspace';\n  \n  if (id === 'body') {\n    dom = document.body;\n  } else {\n    dom = document.getElementById(id);\n  }\n  \n  dom.insertAdjacentHTML('beforeend', this.getHTML());\n}","useCoreAPI":false,"core":false},"e5ef68c9-d858-4ac2-8eea-82580d0f29df":{"_id":"e5ef68c9-d858-4ac2-8eea-82580d0f29df","component":"HTML","state":"getHTML","action":"function getHTML() { \n  var html = this.source();\n  var pattern = '';\n  var matches = null;\n  var message = '';\n  var key = '';\n  \n  // localization\n  pattern = /<i18n[^\\/]*\\/i18n>/;\n  matches = html.match(pattern);\n\n  if (matches) {\n   \n    key = matches[0].split('{')[1].split('}')[0].trim();\n    message = this.require('i18n').get(key);\n    \n    html = html.replace(matches[0], message);\n  }\n  \n  return html;\n}","useCoreAPI":false,"core":false},"f71c2810-ffb7-4f19-a94b-2e08ec78d256":{"_id":"f71c2810-ffb7-4f19-a94b-2e08ec78d256","component":"Internationalization","state":"get","action":"function get(key) { \n  let strings = this.require(this.locale());\n  if (!strings) {\n     strings = this.require('en-US');\n  }\n  return strings[key]();\n}","useCoreAPI":false,"core":false},"e1e35e1690f16945":{"_id":"e1e35e1690f16945","component":"Language","state":"createBehaviorBody","action":"function createBehaviorBody(returnedType) { \n\tvar body = '  \\n';\n\t\n\tswitch(this.target()) {\n\t  case 'javascript':\n      switch (returnedType) {\n        case 'css':\n        case 'html':\n        case 'javascript':  \n        case 'string':\n          body = \"  let result = '';\\n  return result;\\n\";\n          break;\n        case 'array':\n          body = \"  let result = [];\\n  return result;\\n\";\n          break;\n        case 'number':\n          body = \"  let result = 0;\\n  return result;\\n\";\n          break;\n        case 'boolean':\n          body = \"  let result = false;\\n  return result;\\n\";\n          break;\n        case 'object':\n        case 'json':\n          body = \"  let result = {};\\n  return result;\\n\";\n          break;\n        case 'date':\n          body = \"  let result = '';\\n  return result;\\n\";\n          break;\n        case 'any':\n          body = \"  let result = '';\\n  return result;\\n\";\n          break;\n        default:\n          body = \"  let result = {};\\n  return result;\\n\";\n          break;\n      }\n\t    break;\n\t  default:\n\t    break;\n\t}\n\t\n\treturn body;\n}","useCoreAPI":false,"core":false},"v19a5a1998c1efa2":{"_id":"v19a5a1998c1efa2","component":"Language","state":"createBehavior","action":"function createBehavior(name, params, body) { \n\tvar behavior = '',\n\t    funcName = '';\n\n\tswitch(this.target()) {\n\t  case 'javascript':\n\t    if (body === '') {\n\t      body = '  \\n';\n\t    }\n\t    \n\t    if (name.indexOf('.') !== -1) {\n\t      funcName = name.split('.')[name.split('.').length - 1];\n\t    } else {\n\t      funcName = name;\n\t    }\n\t    \n\t    behavior = \"function \" + funcName + \"(\" + params + \") { \\n\" + body + \"}\";\n\t    break;\n    default:\n      break;\n\t}\n\t\n\treturn behavior;\n}","useCoreAPI":false,"core":false},"v1825c1731e17082":{"_id":"v1825c1731e17082","component":"Language","state":"createDestroyBehavior","action":"function createDestroyBehavior() { \n\tvar behavior = '';\n\t\n\tswitch(this.target()) {\n\t  case 'javascript':\n\t    behavior = \"function destroy() { \\n\\n  // destroy the component\\n  $component.destroy(this.id());\\n}\";\n\t    break;\n    default:\n      break;\n\t}\n\t\n\treturn behavior;\n}","useCoreAPI":false,"core":false},"z138a2168e11cfc5":{"_id":"z138a2168e11cfc5","component":"Language","state":"createStartBehavior","action":"function createStartBehavior() { \n\tvar behavior = '';\n\t\n\tswitch(this.target()) {\n\t  case 'javascript':\n\t    behavior = \"function start() { \\n  \\n}\";\n\t    break;\n    default:\n      break;\n\t}\n\t\n\treturn behavior;\n}","useCoreAPI":false,"core":false},"a17ad5184f61b5cd":{"_id":"a17ad5184f61b5cd","component":"Language","state":"createMergeComment","action":"function createMergeComment(systemName) { \n\tvar comment = '';\n\t\n\tswitch(this.target()) {\n\t  case 'javascript':\n\t    comment = '\\n  // from system ' + systemName + '\\n';\n\t    break;\n    default:\n      break;\n\t}\n\t\n\treturn comment;\n}","useCoreAPI":false,"core":false},"s1bb671c9261461a":{"_id":"s1bb671c9261461a","component":"Language","state":"createBehaviorHeader","action":"function createBehaviorHeader(name, params) { \n\tvar header = '';\n\t\n\tswitch(this.target()) {\n\t  case 'javascript':\n\t    header = 'function ' + name + '(' + params + ') ';\n\t    break;\n    default:\n      break;\n\t}\n\t\n\treturn header;\n}","useCoreAPI":false,"core":false},"x1833b1fece19d5b":{"_id":"x1833b1fece19d5b","component":"Language","state":"createBehaviorParameters","action":"function createBehaviorParameters(model) { \n\tvar params = '',\n\t    i = 0,\n\t    length = 0;\n\t\n\tswitch(this.target()) {\n\t  case 'javascript':\n\t   if (model && model.length) {\n        length = model.length;\n        for (i = 0; i < length; i++) {\n          if (i === 0) {\n            params = model[i].name;\n          } else {\n            params = params + ', ' + model[i].name;\n          }\n        }\n      }\n\t    break;\n    default:\n      break;\n\t}\n\t\n\treturn params;\n}","useCoreAPI":false,"core":false},"l171be17d531662a":{"_id":"l171be17d531662a","component":"Language","state":"createBehaviorParametersEvent","action":"function createBehaviorParametersEvent() { \n\tvar parameters = '';\n\t\n\tswitch(this.target()) {\n\t  case 'javascript':\n\t    parameters = 'value';\n\t    break;\n    default:\n      break;\n\t}\n\t\n\treturn parameters;\n}","useCoreAPI":false,"core":false},"y16ae91b06c1a586":{"_id":"y16ae91b06c1a586","component":"Language","state":"createBehaviorParametersEventArray","action":"function createBehaviorParametersEventArray() { \n\tvar parameters = '';\n\t\n\tswitch(this.target()) {\n\t  case 'javascript':\n\t    parameters = 'value, type';\n\t    break;\n    default:\n      break;\n\t}\n\t\n\treturn parameters;\n}","useCoreAPI":false,"core":false},"b126ff129e914cfa":{"_id":"b126ff129e914cfa","component":"MenuBar","state":"render","action":"function render() {\n  var length = 0,\n    i = 0,\n    item = null,\n    domHeader = document.getElementById('designer-menubar-header'),\n    domItems = document.getElementById('designer-menubar-items'),\n    domAction = document.getElementById('designer-menubar-actions'),\n    self = this,\n    arr = window.location.href.split('#'),\n    params = window.location.href.split('?messages='),\n    messages = [],\n    context = 'systems',\n    space = '',\n    designer = this.require('designer'),\n    menuHeader = [],\n    menuItems = [],\n    menuActions = [],\n    menuSearch = [];\n    config = {},\n    isModeAdvanced = false,\n    platform = '',\n    platformMenuItems = [];\n\n  function _removeActive() {\n    var length = 0,\n      i = 0,\n      item = null;\n\n    length = domItems.children.length;\n    for (i = 0; i < length; i++) {\n      item = domItems.children[i];\n      $(item).removeClass('active');\n    }\n  }\n  \n  // empty\n  $('#designer-menubar-header').empty();\n  $('#designer-menubar-items').empty();\n  $('#designer-menubar-actions').empty();\n  this.items([]);\n  this.actions([]);\n  \n  // get mode    \n  config = this.require('storage').get('system-designer-config');\n  if (config && config.advancedMode) {\n    isModeAdvanced = true;\n  }\n\n  // menu header\n  menuHeader = this.require('db').collections().MenuHeader.find({\n    'type': this.require('state').type()\n  });\n  this.header(this.require(menuHeader[0]._id));\n\n  // menu items\n  menuItems = this.require('db').collections().MenuItem.find({\n    'type': this.require('state').type(),\n    'platform': 'all'\n  });\n  \n  // get platform specific items\n  switch(true) {\n    case this.require('designer').isElectron() === true:\n      platform = 'electron';\n      break;\n    case this.require('designer').isCordova() === true:\n      platform = 'cordova';\n      break;\n    default:\n      platform = 'web';\n      break;\n  }\n  \n  platformMenuItems = this.require('db').collections().MenuItem.find({\n    'type': this.require('state').type(),\n    'platform': platform\n  });\n  \n  menuItems = menuItems.concat(platformMenuItems);\n\n  menuItems.sort(function (itemA, itemB) {\n    if (itemA.position > itemB.position) {\n      return 1;\n    }\n    if (itemA.position < itemB.position) {\n      return -1;\n    }\n    return 0;\n  });\n\n  menuItems.forEach(function (menuItem) {\n    var id = menuItem._id;\n    var name = menuItem.name;\n    \n    if ((name === 'bundle' && self.require('state').type() === 'system') || (name === 'behavior' && self.require('state').type() === 'behavior')) {\n      if (isModeAdvanced) {\n        self.items().push(self.require(id));\n      }\n    } else {\n      self.items().push(self.require(id));\n    }\n  });\n\n  // menu actions\n  menuActions = this.require('db').collections().MenuAction.find({\n    'type': this.require('state').type()\n  }).sort({\n    'position': 1\n  });\n\n  menuActions.forEach(function (menuAction) {\n    var id = menuAction._id;\n    self.actions().push(self.require(id));\n  });\n\n  // header\n  domHeader.insertAdjacentHTML('afterbegin', this.header().html().source());\n\n  // items\n  this.require('state').navigation().menu([]);\n  this.items().forEach(function (item) {\n    domItems.insertAdjacentHTML('beforeend', '<li>' + item.html().source() + '</>');\n    this.require('state').navigation().menu().push('designer-menu-item-' + item.name());\n  }.bind(this));\n\n  // events\n  var callback = function () {\n    _removeActive();\n    $(this).addClass('active');\n  };\n\n  length = domItems.children.length;\n  for (i = 0; i < length; i++) {\n    item = domItems.children[i];\n    item.addEventListener('click', callback);\n    item.addEventListener('click', function click() {\n      this.click();\n    }.bind(self.items(i)));\n  }\n\n  // actions\n  this.actions().forEach(function (action) {\n    domAction.insertAdjacentHTML('beforeend', '<li>' + action.html().source() + '</>');\n  });\n\n  length = domAction.children.length;\n  for (i = 0; i < length; i++) {\n    item = domAction.children[i];\n    item.addEventListener('click', function click() {\n      this.click();\n    }.bind(self.actions(i)));\n  }\n\n  if (this.require('state').type() === 'designer') {\n    // focus on first element\n    // or restore the context\n    if (arr.length > 2 && arr[2].length !== 0) {\n      context = arr[2];\n      context = context.split('?')[0];\n    }\n    if (arr.length > 3) {\n      space = arr[3];\n      space = space.split('?')[0];\n    }\n    if (arr.length > 4) {\n      this.require('state').component(arr[4].split('?')[0]);\n    }\n    \n    length = this.items().length;\n    for (i = 0; i < length; i++) {\n      if (this.items(i).name() === context) {\n        item = domItems.children[i];\n        $(item).addClass('active');\n      }\n    }\n    if (space) {\n      this.require('state').space(decodeURIComponent(space));\n    }\n    this.require('state').menu(context);\n\n    this.require('router').update();\n\n    // run messages\n    if (params[1]) {\n      messages = JSON.parse(decodeURIComponent(params[1]));\n      if (runtime.require('factory').system() && runtime.require('factory').system().name() !== 'default') {\n        this.require('state').messages(messages);\n      }\n    }\n  } else {\n    // focus on first element\n    if (length > 0) {\n      this.require('state').menu(this.items(0).name());\n      item = domItems.children[0];\n      $(item).addClass('active');\n    }\n  }\n  \n  $(function () {\n    $('[data-toggle=\"tooltip\"]').tooltip({ 'container': 'body', delay: { 'show': 1500, 'hide': 100 }, trigger: 'hover' });\n  });\n}","useCoreAPI":false,"core":false},"f1c1eb158101aab8":{"_id":"f1c1eb158101aab8","component":"Message","state":"clean","action":"function clean() {\n  document.querySelector('#designer-message').innerHTML = '';\n}"},"f1bf2a100901b407":{"_id":"f1bf2a100901b407","component":"Message","state":"danger","action":"function danger(message) {\n  var id = requestAnimationFrame(function () {\n    var html = this.require('message-alert-danger.html').source(),\n        id = this.require('factory').generateId(),\n        domId = 'designer-message-danger-' + id;\n        \n    this.clean();    \n    \n    message = message.replace('[object Object]', 'message can not be displayed because it is not a string.');\n        \n    document.querySelector('#designer-message').insertAdjacentHTML('afterbegin', \n      html.replace(/{{message}}/gi, message)\n          .replace(/{id}/gi, id)\n      );\n    $('#' + domId).fadeIn(500);\n    \n    setTimeout(function () {\n      $('#' + domId).fadeOut(1000, function() {\n        $(this).remove();\n      });\n    }, 4000);\n  }.bind(this));\n  \n  setTimeout(function () {\n    cancelAnimationFrame(id);\n  }, 50);\n}"},"i1b72d17c6c154ab":{"_id":"i1b72d17c6c154ab","component":"Message","state":"info","action":"function info(message) {\n  var id = requestAnimationFrame(function () {\n    var html = this.require('message-alert-info.html').source(),\n      id = this.require('factory').generateId(),\n      domId = 'designer-message-info-' + id;\n      \n    this.clean();\n    \n    message = message.replace('[object Object]', 'message can not be displayed because it is not a string.');\n        \n    document.querySelector('#designer-message').insertAdjacentHTML('afterbegin', \n      html.replace(/{{message}}/gi, message)\n          .replace(/{id}/gi, id)\n      );\n    $('#' + domId).fadeIn(500);\n    \n    setTimeout(function () {\n      $('#' + domId).fadeOut(1000, function() {\n        $(this).remove();\n      });\n    }, 4000);\n  }.bind(this));\n  \n  setTimeout(function () {\n    cancelAnimationFrame(id);\n  }, 50);\n}"},"s1a2461e9b9155cc":{"_id":"s1a2461e9b9155cc","component":"Message","state":"success","action":"function success(message) {\n  var id = requestAnimationFrame(function () {\n    var html = this.require('message-alert-success.html').source(),\n        id = this.require('factory').generateId(),\n        domId = 'designer-message-success-' + id;\n        \n    this.clean();\n    \n    message = message.replace('[object Object]', 'message can not be displayed because it is not a string.');\n        \n    document.querySelector('#designer-message').insertAdjacentHTML('afterbegin', \n      html.replace(/{{message}}/gi, message)\n          .replace(/{id}/gi, id)\n      );\n    $('#' + domId).fadeIn(500);\n    \n    setTimeout(function () {\n      $('#' + domId).fadeOut(1000, function() {\n        $(this).remove();\n      });\n    }, 4000);\n  }.bind(this));\n  \n  setTimeout(function () {\n    cancelAnimationFrame(id);\n  }, 50);\n}"},"k1dd3c148c011f25":{"_id":"k1dd3c148c011f25","component":"Message","state":"warning","action":"function warning(message) {\n  var id = requestAnimationFrame(function () {\n    var html = this.require('message-alert-warning.html').source(),\n        id = this.require('factory').generateId(),\n        domId = 'designer-message-warning-' + id;\n        \n    this.clean();\n    \n    message = message.replace('[object Object]', 'message can not be displayed because it is not a string.');\n        \n    document.querySelector('#designer-message').insertAdjacentHTML('afterbegin', \n      html.replace(/{{message}}/gi, message)\n          .replace(/{id}/gi, id)\n      );\n    $('#' + domId).fadeIn(500);\n    \n    setTimeout(function () {\n      $('#' + domId).fadeOut(1000, function() {\n        $(this).remove();\n      });\n    }, 4000);\n  }.bind(this));\n  \n  setTimeout(function () {\n    cancelAnimationFrame(id);\n  }, 50);\n}"},"l17e9c1fb07156c0":{"_id":"l17e9c1fb07156c0","component":"ModelSystem","state":"render","action":"function render() { \n  var html = null,\n      that = this,\n      doc = '',\n      propName = '',\n      propVal = '';\n\n  // html \n  html = this.require('model-system.html');\n\n  for (propName in this.document()) {\n    if (['name', 'description', 'version'].indexOf(propName) !== -1) {\n      propVal = this.document()[propName];\n      propVal = propVal.replace(/\\n/g, '<br>');\n      doc = doc + '<tr><td>' + propName + '</td><td>' + propVal + '</td></tr>';\n    }\n  }\n\n  document.querySelector('#designer-workspace').insertAdjacentHTML('afterbegin',\n    html.source()\n        .replace(/{{title}}/gi, this.title())\n        .replace(/{{_id}}/gi, this.uuid())\n        .replace(/{{content}}/gi, doc)\n  );\n\n  // events\n  html = document.getElementById('designer-system-' + this.uuid()).children[0].children[1];\n  if (html) {\n    html.addEventListener('click', function click(event) {\n      this.require('designer').open('system.html#' + that.uuid() + '#description', that.uuid());\n    }.bind(this));\n  }\n\n  html = document.getElementById('designer-system-' + this.uuid() + '-delete');\n  if (html) {\n    html.addEventListener('click', function click(event) {\n      var Dialog = this.require('DialogDelete'),\n          data = {},\n          dialog = {};\n\n      dialog = new Dialog({\n        'title': 'Confirm deletion',\n        'message': 'Do you want to delete the system?<br><br>The related schemas, models, behaviors and components will be also deleted.'\n      });\n      \n      data = dialog.data();\n      \n      data.ui = this.id();\n      data.uuid = this.uuid();\n      \n      dialog.data(data);\n    \n      dialog.on('ok', function ok() {\n        var systems = this.require('storage').get('system-designer-systems'),\n            designer = this.require('designer'),\n            state = this.require('state'),\n            System = this.require('System'),\n            systemId = this.data().uuid,\n            that = this,\n            isUninstalled = false;\n        \n        function _isExtensionInstalled (id) {\n          var extensions = that.require('db').collections().Extension.find({\n            'installed':true\n          }),\n              result = false;\n          \n          extensions.forEach(function (val) {\n            if (val.source._id === id) {\n              result = true;\n            }\n          });\n          \n          return result;\n        }    \n            \n        // uninstall extension\n        if (this.require('factory').system().name().indexOf('extension-') !== -1) {\n          // check if installed as Extensions\n          if (!_isExtensionInstalled(this.require('factory').system().id())) {\n            if (this.require('ext_' + this.require('factory').system().id())) {\n              this.require('runtime').stop('ext_' + this.require('factory').system().id());\n        \t    this.require('runtime').uninstall('ext_' + this.require('factory').system().id());\n        \t    this.require('menubar').render();\n        \t    this.require('toolbar').render();\n        \t    \n        \t    isUninstalled = true;\n            }\n          }\n        }    \n\n        // remove from storage\n        this.require('storage').remove(systemId);\n        systems.systems.splice(systems.systems.indexOf(systemId), 1);\n        this.require('storage').set('system-designer-systems', systems);\n  \n        this.require('factory').system().destroy();\n  \n        // remove log\n        state.logs([]);\n        \n        // hide log if any\n        $('#designer-menu-item-logs-number').hide();\n        document.querySelector('#designer-menu-item-logs-number').innerHTML = 0;\n  \n        // set default system\n        if (systems.systems.length) {\n          this.require('factory').create(this.require('storage').get(systems.systems[0]));\n        }\n  \n        $('#designer-system-' + this.data().uuid).remove();\n        this.require(this.data().ui).destroy();\n  \n        designer.require('state').space('');\n        \n        designer.require('spaces').render();\n        designer.require('workspace').render();\n        \n        this.hide();\n        \n        if (isUninstalled) {\n          this.require('message').success('The system has been deleted and the related extension has been uninstalled.');\n        } else {\n          this.require('message').success('The system has been deleted.');\n        }\n      });\n      \n      dialog.show();\n    }.bind(this));\n  }\n}","useCoreAPI":false,"core":false},"y1d4ef15995101f1":{"_id":"y1d4ef15995101f1","component":"ModelSystem","state":"hide","action":"function hide() { \n  $('#designer-system-' + this.uuid()).hide();\n}","useCoreAPI":false,"core":false},"s1f1d11cc651c54c":{"_id":"s1f1d11cc651c54c","component":"ModelSystem","state":"show","action":"function show() { \n  $('#designer-system-' + this.uuid()).show();\n}","useCoreAPI":false,"core":false},"h14f82133531cb01":{"_id":"h14f82133531cb01","component":"ModelType","state":"render","action":"function render() {\n  var html = null,\n    that = this,\n    doc = '',\n    propName = '',\n    propVal = '',\n    propDescription = '',\n    systemId = '',\n    keys = [];\n    sortedKeys = {};\n\n  systemId = this.require('factory').system().id();\n\n  function _getModelId(name) {\n    var result = '',\n      id = '';\n\n    for (id in that.require('factory').system().models()) {\n      if (that.require('factory').system().models()[id]._name === name) {\n        result = id;\n        break;\n      }\n    }\n    return result;\n  }\n\n  function _setTitle(description) {\n    var result = '';\n\n    if (description) {\n      result = ' data-toggle=\"tooltip\" data-placement=\"right\" title=\"' + description + '\"';\n    }\n    return result;\n  }\n\n  function _getLink(propName, val, description) {\n    var result = '';\n\n    if (!Array.isArray(val)) {\n      if (that.require('factory').isModel(val)) {\n        if (val !== '_Component') {\n          result = '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(description) + '>' + propName + '<a href=\"#' + that.require('factory').system().id() + '#models#' + _getModelId(val) + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + val + '</a></div>';\n        } else {\n          result = '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(description) + '>' + propName + val + '</div>';\n        }\n      } else {\n        if (['any', 'boolean', 'string', 'number', 'object', 'function', 'array', 'html', 'javascript', 'css', 'json', 'text', 'date'].indexOf(val) === -1) {\n          result = '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(description) + '>' + propName + '<a href=\"#' + that.require('factory').system().id() + '#types#' + val + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + val + '</a></div>';\n        } else {\n          result = '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(description) + '>' + propName + val + '</div>';\n        }\n      }\n    } else {\n      if (that.require('factory').isModel(val[0])) {\n        if (val[0] !== '_Component') {\n          result = '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(description) + '>' + propName + '<a href=\"#' + that.require('factory').system().id() + '#models#' + _getModelId(val[0]) + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + val[0] + '</a> [ ]</div>';\n        } else {\n          result = '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(description) + '>' + propName + val[0] + ' [ ]</div>';\n        }\n      } else {\n        if (['any', 'boolean', 'string', 'number', 'object', 'function', 'array', 'html', 'javascript', 'css', 'json', 'text', 'date'].indexOf(val[0]) === -1) {\n          result = '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(description) + '>' + propName + '<a href=\"#' + that.require('factory').system().id() + '#types#' + val[0] + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + val[0] + '</a> [ ]</div>';\n        } else {\n          result = '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(description) + '>' + propName + val[0] + ' [ ]</div>';\n        }\n      }\n    }\n\n    return result;\n  }\n\n  // html \n  html = this.require('model-type.html');\n\n  if (this.document().schema) {\n    \n    // get keys\n    for (propName in this.document().schema) {\n      keys.push(propName);\n    }\n    keys.sort();\n    \n    // sorted keys\n    keys.forEach(function(key) {\n      sortedKeys[key] = this.document().schema[key];\n    }.bind(this));\n    \n    for (propName in sortedKeys) {\n      if (this.document().schema.hasOwnProperty(propName)) {\n        propVal = this.document().schema[propName].type;\n        propDescription = this.document().schema[propName].description;\n        doc = doc + _getLink(propName + ' : ', propVal, propDescription);\n      }\n    }\n  }\n\n  if (this.document().value) {\n    this.document().value.sort().forEach(function (val) {\n      doc = doc + '<div class=\"list-group-item\" style=\"text-align: left\">' + val + '</div>';\n    });\n  }\n\n\n  if (!this.document().schema && !this.document().value) {\n    propVal = this.document().type;\n    doc = doc + '<div class=\"list-group-item\" style=\"text-align: left\"><i>alias</i> : ' + propVal + '</div>';\n  }\n\n  if (doc === '') {\n    doc = doc + '<a class=\"list-group-item\" style=\"text-align: left\"><br/><br/></a>';\n  }\n\n  document.querySelector('#designer-workspace').insertAdjacentHTML('afterbegin',\n    html.source()\n      .replace(/{{title}}/gi, this.title())\n      .replace(/{{id}}/gi, this.uuid())\n      .replace(/{{content}}/gi, doc)\n  );\n\n  // events\n  html = document.getElementById('designer-type-' + this.uuid()).children[0].children[1];\n  if (html) {\n    html.addEventListener('click', function click(event) {\n      this.require('designer').open('type.html#' + that.uuid() + '#' + systemId, that.uuid());\n\n      // force hide tooltip\n      $('.designer-type [data-toggle=\"tooltip\"]').tooltip('hide');\n    }.bind(this));\n  }\n\n  html = document.getElementById('designer-type-' + this.uuid() + '-delete');\n  if (html) {\n    html.addEventListener('click', function click(event) {\n      var Dialog = this.require('DialogDelete'),\n        data = {},\n        dialog = {};\n\n      dialog = new Dialog({\n        'title': 'Confirm deletion',\n        'message': 'Do you want to delete the type?'\n      });\n\n      data = dialog.data();\n\n      data.ui = this.id();\n      data.uuid = this.uuid();\n      data.title = this.title();\n\n      dialog.data(data);\n\n      dialog.on('ok', function ok() {\n        var designer = this.require('designer');\n\n        types = this.require('factory').system().types();\n\n        delete types[this.data().title];\n        this.require('factory').system().types(types);\n\n        $('#designer-type-' + this.data().title).remove();\n\n        this.require('channel').$designerDeleteType(this.data().uuid);\n\n        this.require(this.data().ui).destroy();\n        designer.save();\n\n        designer.require('state').space('');\n        designer.require('spaces').render();\n        designer.require('workspace').render();\n\n        this.hide();\n        this.require('message').success('The type has been deleted.');\n      });\n\n      dialog.show();\n    }.bind(this));\n  }\n\n  $(function () {\n    $('[data-toggle=\"tooltip\"]').tooltip({ 'container': 'body', delay: { 'show': 500, 'hide': 100 }, trigger: 'hover' });\n  });\n}","useCoreAPI":false,"core":false},"y193ad1d2dd19a94":{"_id":"y193ad1d2dd19a94","component":"ModelType","state":"hide","action":"function hide() { \n  $('#designer-type-' + this.title()).hide();\n}","useCoreAPI":false,"core":false},"r1fddf1076313f2a":{"_id":"r1fddf1076313f2a","component":"ModelType","state":"show","action":"function show() { \n  $('#designer-type-' + this.title()).show();\n}","useCoreAPI":false,"core":false},"x1ef931bdf218b5c":{"_id":"x1ef931bdf218b5c","component":"ModelSchema","state":"render","action":"function render() { \n  var html = null,\n      doc = '',\n      that = this,\n      propName = '',\n      propVal = '',\n      htmlId = '',\n      keys = [],\n      sortedKeys = {};\n\n  htmlId = this.uuid() || this.title();\n  systemId = this.require('factory').system().id();\n\n  // html \n  html = this.require('model-schema.html');\n  \n  // get keys\n  for (propName in this.document()) {\n    keys.push(propName);\n  }\n  keys.sort();\n  \n  // sorted keys\n  keys.forEach(function(key) {\n    sortedKeys[key] = this.document()[key];\n  }.bind(this));\n  \n  for (propName in sortedKeys) {\n    if (this.document().hasOwnProperty(propName) && propName.indexOf('_') !== 0) {\n      propVal = this.document()[propName];\n      doc = doc + '<tr><td>' + propName + '</td><td>' + propVal + '</td></tr>';\n    }\n  }\n\n  if (doc === '') {\n    doc = doc + '<tr><td><br/><br/><br/></td><td><br/><br/><br/></td></tr>';\n  }\n\n  document.querySelector('#designer-workspace').insertAdjacentHTML('afterbegin',\n    html.source()\n        .replace(/{{title}}/gi, this.title())\n        .replace(/{{id}}/gi, htmlId)\n        .replace(/{{content}}/gi, doc)\n  );\n\n  //events\n  if (this.editable()) {\n    html = document.getElementById('designer-schema-' + htmlId).children[0].children[1];\n\n    if (html) {\n      html.addEventListener('click', function click(event) {\n        this.require('designer').open('schema.html#' + that.uuid() + '#' + systemId, that.uuid());\n      }.bind(this));\n    }\n\n    html = document.getElementById('designer-schema-' + htmlId + '-delete');\n    if (html) {\n      html.addEventListener('click', function click(event) {\n      var Dialog = this.require('DialogDelete')\n          data = {},\n          dialog = {};\n\n      dialog = new Dialog({\n        'title': 'Confirm deletion',\n        'message': 'Do you want to delete the schema?<br><br>The related model, behaviors and components will be also deleted.'\n      });\n      \n      data = dialog.data();\n      \n      data.ui = this.id();\n      data.uuid = this.uuid();\n      \n      dialog.data(data);\n      \n      dialog.on('ok', function ok() {\n        var designer = this.require('designer');\n\n        this.require('factory').deleteSchema(this.data().uuid);\n\n        $('#designer-schema-' + this.data().uuid).remove();\n\n        this.require('channel').$designerDeleteSchema(this.data().uuid);\n\n        this.require(this.data().ui).destroy();\n\n        jsPlumb.deleteEveryEndpoint();\n\n        designer.save();\n\n        designer.require('state').space('');\n        designer.require('spaces').render();\n        designer.require('workspace').render(); \n        \n        this.hide();\n        this.require('message').success('The schema, the related model, behaviors and components have been deleted.');\n      });\n      \n      dialog.show();  \n        \n      }.bind(this));\n    }\n  } else {\n    $('#designer-schema-' + htmlId + ' > div > div > div > button').hide();\n\n    html = document.getElementById('designer-schema-' + htmlId).children[0].children[1];\n    if (html) {\n      html.addEventListener('click', function click(event) {\n        var DialogComponentInfo = null;\n\n        if (this.title() !== '_Component') {\n          if (this.require('factory').system().schemas()[that.uuid()]) {\n            this.require('designer').open('index.html#' + this.require('factory').system().id() + '#schemas#' + that.uuid(), '_self');\n          } else {\n            this.require('message').warning('Your schema \\‘' + that.title() + '\\’ has not been yet created.');\n          }\n        } else {\n          DialogComponentInfo = this.require('DialogComponentInfo');\n          DialogComponentInfo = new DialogComponentInfo({\n            'title': '_Component schema'\n          });\n          DialogComponentInfo.show();\n        }\n      }.bind(this));\n    }\n  }\n}","useCoreAPI":false,"core":false},"s16bee11b7711ffc":{"_id":"s16bee11b7711ffc","component":"ModelSchema","state":"hide","action":"function hide() { \n  $('#designer-schema-' + this.uuid()).hide();\n}","useCoreAPI":false,"core":false},"s129cc1a59c1d6e0":{"_id":"s129cc1a59c1d6e0","component":"ModelSchema","state":"show","action":"function show() { \n  $('#designer-schema-' + this.uuid()).show();\n}","useCoreAPI":false,"core":false},"d1cc401928b148ce":{"_id":"d1cc401928b148ce","component":"ModelClass","state":"render","action":"function render() {\n  var html = null,\n    that = this,\n    propName = '',\n    attributes = '',\n    collections = '',\n    methods = '',\n    events = '',\n    propVal = '',\n    result = '',\n    callbackProp = null,\n    htmlId = '',\n    htmlComp = null,\n    systemId = '',\n    keys = [],\n    sortedKeys = {},\n    length = 0,\n    i = 0;\n\n  htmlId = this.uuid() || this.title();\n  systemId = this.require('factory').system().id();\n\n  callbackProp = function (param) {\n    var realType = param.type;\n    var isArray = false;\n\n    if (Array.isArray(param.type)) {\n      isArray = true;\n      realType = param.type[0];\n    }\n\n    if (that.require('factory').isModel(realType) && realType !== '_Component') {\n      if (isArray) {\n        params = params + param.name + ' : [<a href=\"#' + this.require('factory').system().id() + '#models#' + _getModelId(realType) + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + realType + '</a>' + '], ';\n      } else {\n        params = params + param.name + ' : <a href=\"#' + this.require('factory').system().id() + '#models#' + _getModelId(realType) + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + realType + '</a>' + ', ';\n      }\n    } else {\n      if (['any', 'boolean', 'string', 'number', 'object', 'function', 'array', 'html', 'javascript', 'css', 'errorInfo', 'json', 'text', 'date'].indexOf(realType) === -1 && realType !== '_Component') {\n        if (isArray) {\n          params = params + param.name + ' : [<a href=\"#' + this.require('factory').system().id() + '#types#' + realType + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + realType + '</a>' + '], ';\n        } else {\n          params = params + param.name + ' : <a href=\"#' + this.require('factory').system().id() + '#types#' + realType + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + realType + '</a>' + ', ';\n        }\n      } else {\n        if (isArray) {\n          params = params + param.name + ' : [' + realType + '], ';\n        } else {\n          params = params + param.name + ' : ' + realType + ', ';\n        }\n      }\n    }\n  };\n\n  function _getReturnType(returnType) {\n    var result = '';\n    var realType = returnType;\n    var isArray = false;\n\n    if (Array.isArray(returnType)) {\n      isArray = true;\n      realType = returnType[0];\n    }\n\n    if (that.require('factory').isModel(realType) && realType !== '_Component') {\n      if (isArray) {\n        result = '[<a href=\"#' + that.require('factory').system().id() + '#models#' + _getModelId(realType) + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + realType + '</a>]';\n      } else {\n        result = '<a href=\"#' + that.require('factory').system().id() + '#models#' + _getModelId(realType) + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + realType + '</a>';\n      }\n    } else {\n      if (['any', 'boolean', 'string', 'number', 'object', 'function', 'array', 'html', 'javascript', 'css', 'errorInfo', 'json', 'text', 'date'].indexOf(realType) === -1 && realType !== '_Component') {\n        if (isArray) {\n          result = '[<a href=\"#' + that.require('factory').system().id() + '#types#' + realType + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + realType + '</a>]';\n        } else {\n          result = '<a href=\"#' + that.require('factory').system().id() + '#types#' + realType + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + realType + '</a>';\n        }\n      } else {\n        if (isArray) {\n          result = '[' + realType + ']';\n        } else {\n          result = realType;\n        }\n      }\n    }\n    return result;\n  }\n\n  function _getModelId(name) {\n    var result = '',\n      id = '';\n\n    for (id in that.require('factory').system().models()) {\n      if (that.require('factory').system().models()[id]._name === name) {\n        result = id;\n        break;\n      }\n    }\n    return result;\n  }\n\n  function _setTitle(description) {\n    var result = '';\n\n    if (description) {\n      result = ' data-toggle=\"tooltip\" data-placement=\"right\" title=\"' + description + '\"';\n    }\n    return result;\n  }\n  \n  // get keys\n  for (propName in this.document()) {\n    keys.push(propName);\n  }\n  keys.sort();\n  \n  // sorted keys\n  keys.forEach(function(key) {\n    sortedKeys[key] = this.document()[key];\n  }.bind(this));\n\n  for (propName in sortedKeys) {\n    //if (this.document().hasOwnProperty(propName)) {\n      propVal = this.document()[propName];\n\n      switch (true) {\n        case typeof propVal.type !== 'undefined':\n          if (!Array.isArray(propVal.type)) {\n            if (that.require('factory').isModel(propVal.type)) {\n              if (htmlId !== '123751cb591de26' && propVal.type !== '_Component') {\n                attributes = attributes + '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(propVal.description) + '>+ ' + propName + ' : <a href=\"#' + this.require('factory').system().id() + '#models#' + _getModelId(propVal.type) + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + propVal.type + '</a></div>';\n              } else {\n                attributes = attributes + '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(propVal.description) + '>+ ' + propName + ' : ' + propVal.type + '</div>';\n              }\n            } else {\n              if (['any', 'boolean', 'string', 'number', 'object', 'function', 'array', 'html', 'javascript', 'css', 'json', 'text', 'date'].indexOf(propVal.type) === -1) {\n                if (htmlId !== '123751cb591de26') {\n                  attributes = attributes + '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(propVal.description) + '>+ ' + propName + ' : <a href=\"#' + this.require('factory').system().id() + '#types#' + propVal.type + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + propVal.type + '</a></div>';\n                } else {\n                  attributes = attributes + '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(propVal.description) + '>+ ' + propName + ' : ' + propVal.type + '</div>';\n                }\n              } else {\n                attributes = attributes + '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(propVal.description) + '>+ ' + propName + ' : ' + propVal.type + '</div>';\n              }\n            }\n          } else {\n            if (that.require('factory').isModel(propVal.type[0])) {\n              if (htmlId !== '123751cb591de26' && propVal.type[0] !== '_Component') {\n                attributes = attributes + '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(propVal.description) + '>+ ' + propName + ' : <a href=\"#' + this.require('factory').system().id() + '#models#' + _getModelId(propVal.type[0]) + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + propVal.type[0] + '</a> [ ]</div>';\n              } else {\n                attributes = attributes + '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(propVal.description) + '>+ ' + propName + ' : ' + propVal.type[0] + ' [ ]</div>';\n              }\n            } else {\n              if (['any', 'boolean', 'string', 'number', 'object', 'function', 'array', 'html', 'javascript', 'css', 'json', 'text', 'date'].indexOf(propVal.type[0]) === -1) {\n                if (htmlId !== '123751cb591de26') {\n                  attributes = attributes + '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(propVal.description) + '>+ ' + propName + ' : <a href=\"#' + this.require('factory').system().id() + '#types#' + propVal.type[0] + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + propVal.type[0] + '</a> [ ]</div>';\n                } else {\n                  attributes = attributes + '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(propVal.description) + '>+ ' + propName + ' : ' + propVal.type[0] + ' [ ]</div>';\n                }\n              } else {\n                attributes = attributes + '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(propVal.description) + '>+ ' + propName + ' : ' + propVal.type[0] + ' [ ]</div>';\n              }\n            }\n          }\n          break;\n        case typeof propVal.params !== 'undefined':\n          result = 'undefined';\n          var params = '(';\n          propVal.params.forEach(callbackProp.bind(this));\n          params = params + ')';\n          params = params.replace(', )', ')');\n\n          if (typeof propVal.result !== 'undefined') {\n            result = _getReturnType(propVal.result);\n            if (htmlId !== '123751cb591de26') {\n              methods = methods + '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(propVal.description) + '>+ <a href=\"#' + this.require('factory').system().id() + '#behaviors#' + this.document()._name + '#' + propName + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + propName + '</a>' + params + ' : ' + result + '</div>';\n            } else {\n              methods = methods + '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(propVal.description) + '>+ ' + propName + params + ' : ' + result + '</div>';\n            }\n          } else {\n            if (htmlId !== '123751cb591de26') {\n              methods = methods + '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(propVal.description) + '>+ <a href=\"#' + this.require('factory').system().id() + '#behaviors#' + this.document()._name + '#' + propName + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + propName + '</a>' + params + '</div>';\n            } else {\n              methods = methods + '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(propVal.description) + '>+ ' + propName + params + '</div>';\n            }\n          }\n          break;\n        case propName.indexOf('_') !== -1:\n          // we do not show private / internal properties\n          break;\n        default:\n          result = 'undefined';\n          if (typeof propVal.result !== 'undefined') {\n            result = _getReturnType(propVal.result);\n\n            if (htmlId !== '123751cb591de26') {\n              methods = methods + '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(propVal.description) + '>+ <a href=\"#' + this.require('factory').system().id() + '#behaviors#' + this.document()._name + '#' + propName + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + propName + '</a>() : ' + result + '</div>';\n            } else {\n              methods = methods + '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(propVal.description) + '>+ ' + propName + '() : ' + result + '</div>';\n            }\n          } else {\n            if (htmlId !== '123751cb591de26') {\n              methods = methods + '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(propVal.description) + '>+ <a href=\"#' + this.require('factory').system().id() + '#behaviors#' + this.document()._name + '#' + propName + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + propName + '</a>()</div>';\n            } else {\n              methods = methods + '<div class=\"list-group-item\" style=\"text-align: left\"' + _setTitle(propVal.description) + '>+ ' + propName + '()</div>';\n            }\n          }\n          break;\n      }\n    //\"\"}\n  }\n\n  if (attributes === '') {\n    attributes = attributes + '<a class=\"list-group-item\" style=\"text-align: left\"><br/></a>';\n  }\n  if (methods === '') {\n    methods = methods + '<a class=\"list-group-item\" style=\"text-align: left\"><br/></a>';\n  }\n\n  // html \n  htmlComp = this.require('model-class.html');\n\n  document.querySelector('#designer-workspace').insertAdjacentHTML('afterbegin',\n    htmlComp.source()\n      .replace(/{{title}}/gi, this.title())\n      .replace(/{{_id}}/gi, htmlId)\n      .replace(/{{attributes}}/gi, attributes)\n      .replace(/{{collections}}/gi, collections)\n      .replace(/{{methods}}/gi, methods)\n      .replace(/{{events}}/gi, events)\n  );\n\n  // events\n  if (this.editable()) {\n    html = document.getElementById('designer-model-' + htmlId).children[0].children[1];\n    if (html) {\n      html.addEventListener('click', function click(event) {\n        this.require('designer').open('model.html#' + that.uuid() + '#' + systemId, that.uuid());\n      }.bind(this));\n    }\n  } else {\n    $('#designer-model-' + htmlId + ' > div > div > div > button').hide();\n\n    html = document.getElementById('designer-model-' + htmlId).children[0].children[1];\n    if (html) {\n      html.addEventListener('click', function click(event) {\n        var DialogComponentInfo = null;\n\n        if (this.title() !== '_Component') {\n          if (this.require('factory').system().models()[that.uuid()]) {\n            this.require('designer').open('index.html#' + this.require('factory').system().id() + '#models#' + that.uuid(), '_self');\n          } else {\n            this.require('message').warning('Your schema \\‘' + that.title() + '\\’ has not been yet created.');\n          }\n        } else {\n          DialogComponentInfo = this.require('DialogComponentInfo');\n          DialogComponentInfo = new DialogComponentInfo({\n            'title': '_Component model'\n          });\n          DialogComponentInfo.show();\n\n          // force hide tooltip\n          $('.designer-model [data-toggle=\"tooltip\"]').tooltip('hide');\n        }\n      }.bind(this));\n    }\n  }\n\n  $(function () {\n    $('[data-toggle=\"tooltip\"]').tooltip({ 'container': 'body', delay: { 'show': 500, 'hide': 100 }, trigger: 'hover' });\n  });\n}","useCoreAPI":false,"core":false},"e1b783124781eb46":{"_id":"e1b783124781eb46","component":"ModelClass","state":"hide","action":"function hide() { \n  $('#designer-class-' + this.uuid()).hide();\n}","useCoreAPI":false,"core":false},"e1860d16c061bd75":{"_id":"e1860d16c061bd75","component":"ModelClass","state":"show","action":"function show() { \n  $('#designer-class-' + this.uuid()).show();\n}","useCoreAPI":false,"core":false},"a10e171013c1a0a3":{"_id":"a10e171013c1a0a3","component":"ModelBehavior","state":"render","action":"function render() { \n  var template = '',\n      html = null,\n      that = this,\n      systemId = '';\n\n  systemId = this.require('factory').system().id();\n\n  // html \n  template = this.require('model-behavior.html');\n\n  document.querySelector('#designer-workspace').insertAdjacentHTML('afterbegin',\n    template.source()\n        .replace(/{{_id}}/gi, this.uuid())\n        .replace(/{{title}}/gi, this.title())\n        .replace(/{{content}}/gi, this.content().replace(/</g, '&lt;').replace(/\\$/g, '&#36;'))\n  );\n\n  //events\n  html = document.getElementById('designer-behavior-' + this.uuid()).children[0].children[1];\n  if (html) {\n    html.addEventListener('click', function click(event) {\n      this.require('designer').open('behavior.html#' + that.uuid() + '#' + systemId + '#action', that.uuid());\n    }.bind(this));\n  }\n\n  html = document.getElementById('designer-behavior-' + this.uuid() + '-delete');\n  if (html) {\n    html.addEventListener('click', function click(event) {\n      var Dialog = this.require('DialogDelete'),\n          data = {},\n          dialog = {};\n\n      dialog = new Dialog({\n        'title': 'Confirm deletion',\n        'message': 'Do you want to delete the behavior?'\n      });\n      \n      data = dialog.data();\n      \n      data.ui = this.id();\n      data.uuid = this.uuid();\n      \n      dialog.data(data);\n      \n      dialog.on('ok', function ok() {\n        var designer = this.require('designer');\n            behaviors = this.require('factory').system().behaviors();\n  \n        delete behaviors[this.data().uuid];\n        this.require('factory').system().behaviors(behaviors);\n  \n        $('#designer-behavior-' + this.data().uuid).fadeOut(400, function fadeout() {\n          $(this).remove();\n          \n          if ($('#designer-workspace').children().length === 0) {\n            runtime.require('message-help').render();\n          }\n        });\n  \n        this.require('channel').$designerDeleteBehavior(this.data().uuid);\n  \n        this.require(this.data().ui).destroy();\n        designer.save();\n        \n        this.hide();\n        this.require('message').success('The behavior has been deleted.');\n      });\n      \n      dialog.show();\n    }.bind(this));\n  }\n}","useCoreAPI":false,"core":false},"a1553d131ff1af56":{"_id":"a1553d131ff1af56","component":"ModelBehavior","state":"hide","action":"function hide() { \n  $('#designer-behavior-' + this.uuid()).hide();\n}","useCoreAPI":false,"core":false},"s1870e16bf01a557":{"_id":"s1870e16bf01a557","component":"ModelBehavior","state":"show","action":"function show() { \n  $('#designer-behavior-' + this.uuid()).show();\n}","useCoreAPI":false,"core":false},"c1e7c01b4a51caf0":{"_id":"c1e7c01b4a51caf0","component":"ModelComponent","state":"render","action":"function render() { \n  var htmlComp = null,\n      html = null,\n      doc = '',\n      that = this,\n      propName = '',\n      propVal = '',\n      value = '',\n      systemId = '',\n      links = '',\n      modelName = '',\n      realModelName = '',\n      schema = null,\n      components = null,\n      keys = [],\n      sortedKeys = {};\n\n  function _getModelFromComponent(id) {\n    var result = '',\n        modelName = '',\n        componentId = '';\n\n    for (modelName in that.require('factory').system().components()) {\n      for (componentId in that.require('factory').system().components()[modelName]) {\n        if (componentId === id) {\n          result = modelName;\n          break;\n        }\n      }\n    }\n    return result;\n  }\n\n  function _createLink(id) {\n    var modelName = model[propName].type[0],\n        realModelName = '';\n        components = that.require('factory').system().components();\n    \n    if (components && components[modelName] && components[modelName][id]) {\n      // component found\n    } else {\n      realModelName = _getModelFromComponent(id);\n      if (realModelName) {\n        modelName = realModelName;\n      }\n    }\n\n    links = links + '<a href=\"#' + runtime.require('factory').system().id() + '#components#' + modelName + '#' + id + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + id + '</a>,<br>';\n  }\n  \n  systemId = this.require('factory').system().id();\n  schema = this.require('factory').getGeneratedSchema(this.model());\n  model = this.require('factory').getGeneratedModel(this.model());\n  components = this.require('factory').system().components();\n  \n // get keys\n  for (propName in this.document()) {\n    keys.push(propName);\n  }\n  keys.sort();\n  \n  // sorted keys\n  keys.forEach(function(key) {\n    sortedKeys[key] = this.document()[key];\n  }.bind(this));\n  \n  for (propName in sortedKeys) {\n    if (sortedKeys.hasOwnProperty(propName) && propName !== '_id' && propName !== '_core') {\n      propVal = sortedKeys[propName];\n      value = JSON.stringify(propVal);\n      links = '';\n\n      switch (true) {\n        case schema[propName] === 'link':\n          if (typeof propVal === 'string') {\n            modelName = model[propName].type;\n            \n            if (components && components[modelName] && components[modelName][sortedKeys[propName]]) {\n              // component found\n            } else {\n              realModelName = _getModelFromComponent(sortedKeys[propName]);\n              if (realModelName) {\n                modelName = realModelName;\n              }\n            }\n\n            doc = doc + '<tr><td>' + propName + '</td><td><a href=\"#' + this.require('factory').system().id() + '#components#' + modelName + '#' + propVal + '\" onclick=\"(function (e) {e.stopPropagation();})(arguments[0])\">' + propVal + '</a></td></tr>';\n          } else {\n            doc = doc + '<tr><td>' + propName + '</td><td>' + value + '</td></tr>';\n          }\n          break;\n        case schema[propName] === 'collection':\n          if (Array.isArray(propVal) && this.require('factory').isModel(model[propName].type[0])) {\n            propVal.forEach(_createLink);\n            doc = doc + '<tr><td>' + propName + '</td><td>[' + links + ']</td></tr>';\n            doc = doc.replace(',<br>]', ']');\n          } else {\n            if (value.length < 25) {\n              doc = doc + '<tr><td>' + propName + '</td><td>' + value + '</td></tr>';\n            } else {\n              doc = doc + '<tr><td>' + propName + '</td><td>' + value.substring(0, 25) + ' ...</td></tr>';\n            }\n          }\n          break;\n        default:\n          if (value.length < 25) {\n            if (typeof propVal === 'string') {\n              doc = doc + '<tr><td>' + propName + '</td><td>' + propVal.replace(/</g, '&lt;') + '</td></tr>';\n            } else {\n              doc = doc + '<tr><td>' + propName + '</td><td>' + value.replace(/</g, '&lt;') + '</td></tr>';\n            }\n          } else {\n            if (typeof propVal === 'string') {\n              doc = doc + '<tr><td>' + propName + '</td><td>' + propVal.substring(0, 23).replace(/</g, '&lt;') + ' ...</td></tr>';\n            } else {\n              doc = doc + '<tr><td>' + propName + '</td><td>' + value.substring(0, 23).replace(/</g, '&lt;') + ' ...</td></tr>';\n            }\n          }\n          break;\n      }\n    }\n  }\n\n  if (doc === '') {\n    doc = doc + '<tr><td><br/><br/></td><td><br/><br/></td></tr>';\n  }\n\n  // html \n  htmlComp = this.require('model-component.html');\n\n  document.querySelector('#designer-workspace').insertAdjacentHTML('afterbegin',\n    htmlComp.source()\n        .replace(/{{title}}/gi, this.title())\n        .replace(/{{_id}}/gi, this.uuid().replace(/\\./g, '-'))\n        .replace(/{{content}}/gi, doc)\n  );\n\n  // events\n  html = document.getElementById('designer-component-' + this.uuid().replace(/\\./g, '-')).children[0].children[1];\n  if (html) {\n    html.addEventListener('click', function click(event) {\n      this.require('designer').open('component.html#' + encodeURIComponent(that.title()) + '#' + encodeURIComponent(that.model()) + '#' + systemId, that.uuid());\n    }.bind(this));\n  }\n\n  html = document.getElementById('designer-component-' + this.uuid().replace(/\\./g, '-') + '-delete');\n  if (html) {\n    html.addEventListener('click', function click(event) {\n      var Dialog = this.require('DialogDelete')\n          data = {},\n          dialog = {};\n\n      dialog = new Dialog({\n        'title': 'Confirm deletion',\n        'message': 'Do you want to delete the component?'\n      });\n      \n      data = dialog.data();\n      \n      data.model = this.model();\n      data.uuid = this.uuid();\n      data.ui = this.id();\n      \n      dialog.data(data);\n      \n      dialog.on('ok', function ok() {\n        var uuid = this.data().uuid,\n            model = this.data().model,\n            ui = this.data().ui;\n  \n        this.require('factory').deleteComponent(uuid, model);\n  \n        $('#designer-component-' + uuid.replace(/\\./g, '-')).fadeOut(400, function fadeOut() {\n          $(this).remove();\n          \n          if ($('#designer-workspace').children().length === 0) {\n            runtime.require('message-help').render();\n          }\n        });\n  \n        this.require('channel').$designerDeleteComponent(uuid, model);\n        this.hide();\n        \n        this.require(ui).destroy();\n        \n        this.require('designer').save();\n        this.require('message').success('The component has been deleted.');\n      });\n      \n      dialog.show();\n    }.bind(this));\n  }\n}","useCoreAPI":false,"core":false},"s1320a140a91efd8":{"_id":"s1320a140a91efd8","component":"ModelComponent","state":"hide","action":"function hide() { \n  $('#designer-component-' + this.uuid()).hide();\n}","useCoreAPI":false,"core":false},"l107d01de7f1f8b0":{"_id":"l107d01de7f1f8b0","component":"ModelComponent","state":"show","action":"function show() { \n  $('#designer-component-' + this.uuid()).show();\n}","useCoreAPI":false,"core":false},"l102fa1aac8159a8":{"_id":"l102fa1aac8159a8","component":"ModelLog","state":"render","action":"function render() { \n  var html = null,\n      that = this,\n      doc = '',\n      propName = '',\n      propVal = '',\n      logs = '';\n\n  // html \n  htmlComp = this.require('model-log.html');\n\n  // logs\n  this.require('state').logs().forEach(function (log) {\n    var filter = this.require('state').space();\n    \n    switch (log.type()) {\n      case 'debug':\n        if (filter === 'all' || filter === 'debug' || filter === '') {\n          logs = logs + '<p class=\"text-muted\">' + log.log() + '</p>';\n        }\n        break;\n      case 'info':\n        if (filter === 'all' || filter === 'info' || filter === '') {\n          logs = logs + '<p class=\"text-info\">' + log.log() + '</p>';\n        }\n        break;\n      case 'warn':\n        if (filter === 'all' || filter === 'warn' || filter === '') {\n          logs = logs + '<p class=\"text-warning\">' + log.log() + '</p>';\n        }\n        break;\n      case 'error':\n        if (filter === 'all' || filter === 'error' || filter === '') {\n          logs = logs + '<p class=\"text-danger\">' + log.log() + '</p>';\n        }\n        break;\n      default:\n        break;\n    }\n  }.bind(this));\n\n  document.querySelector('#designer-workspace').insertAdjacentHTML('afterbegin',\n    htmlComp.source().replace('{{logs}}', logs)\n  );\n\n  // events       \n  html = document.getElementById('designer-log-clean');\n\n  html.addEventListener('click', function click(event) {\n    this.require('state').logs([]);\n    document.querySelector('#designer-loug-output').innerHTML = '';\n    this.require('message').success('The logs have been cleared.');\n  }.bind(this));\n}","useCoreAPI":false,"core":false},"c19c981365a18e6f":{"_id":"c19c981365a18e6f","component":"ModelLog","state":"hide","action":"function hide() { \n  $('#designer-log').hide();\n}","useCoreAPI":false,"core":false},"f182891664d151ab":{"_id":"f182891664d151ab","component":"ModelLog","state":"show","action":"function show() { \n  $('#designer-log').show();\n}","useCoreAPI":false,"core":false},"d1a56d197331e510":{"_id":"d1a56d197331e510","component":"SystemFactory","state":"mergeBehavior","action":"function mergeBehavior(behaviors, behavior, sysId, systemName) { \n\tvar that = this,\n\t    source = {},\n\t    lastA = -1,\n\t    firstB = -1,\n\t    lastB = -1,\n\t    toAdd = '';\n\t    \n\tfunction _getBehavior() {\n\t  var result = null,\n\t      id = '';\n\t      \n\t  for (id in behaviors) {\n\t    if (behaviors[id].state === behavior.state && behaviors[id].component === sysId) {\n\t      result = behaviors[id];\n\t      break;\n\t    }\n\t  }\n\t  \n\t  if (!result) {\n\t    result = {\n\t      \"_id\": that.generateId(),\n\t      \"component\": sysId,\n\t      \"state\": behavior.state,\n\t      \"action\": that.require('language').createBehavior(behavior.state),\n\t    };\n\t  }\n\t  \n\t  return result;\n\t}  \n\t\n\tsource = _getBehavior();\n\t    \n\tlastA = source.action.lastIndexOf('}');\n\tfirstB = behavior.action.indexOf('{');\n\tlastB = behavior.action.lastIndexOf('}');\n\t\n\ttoAdd = behavior.action.substring(firstB + 1, lastB);\n\t\n\tif (toAdd.trim() !== '') { \n\t  toAdd = this.require('language').createMergeComment(systemName) + toAdd + '\\n}';\n\t} else {\n\t  toAdd = '}';\n\t}\n\t\n\tsource.action = source.action.substring(0, lastA) + toAdd;\n\t\n\tbehaviors[source._id] =  source;\n}","useCoreAPI":false,"core":false},"r177551fafb195af":{"_id":"r177551fafb195af","component":"SystemFactory","state":"getGeneratedSchema","action":"function getGeneratedSchema(schema) { \n  var schemaDef = null,\n      result = {},\n      i = 0,\n      length = 0,\n      propName = '';\n\n  function _getSchemaDef(name, schemas) {\n      var result = '',\n          id = '';\n\n      for (id in schemas) {\n          if (schemas[id]._name === name) {\n              result = schemas[id];\n              break;\n          }\n      }\n      return result;\n  }\n\n  function _searchParents(parents, states, schemas) {\n      var parent = '',\n          schemaDef = null,\n          i = 0,\n          length = 0;\n\n      length = parents.length;\n      for (i = 0; i < length; i++) {\n          parent = parents[i];\n          if (parent === '_Component') {\n              result.init = 'init';\n              result.destroy = 'destroy';\n              result.error = 'error';\n          } else {\n              schemaDef = _getSchemaDef(parent, schemas);\n\n              for (propName in schemaDef) {\n                  if (propName.indexOf('_') !== 0) {\n                      result[propName] = schemaDef[propName];\n                  }\n              }\n\n              if (schemaDef._inherit) {\n                  _searchParents(schemaDef._inherit, result, schemas);\n              }\n          }\n      }\n  }\n\n  schemaDef = _getSchemaDef(schema, this.system().schemas());\n\n  for (propName in schemaDef) {\n      if (propName.indexOf('_') !== 0) {\n          result[propName] = schemaDef[propName];\n      }\n  }\n\n  if (schemaDef._inherit) {\n      _searchParents(schemaDef._inherit, result, this.system().schemas());\n  }\n\n  return result;\n}","useCoreAPI":false,"core":false},"z13a3b1308218a5d":{"_id":"z13a3b1308218a5d","component":"SystemFactory","state":"getGeneratedModel","action":"function getGeneratedModel(model) { \n  var modelDef = null,\n      result = {},\n      i = 0,\n      length = 0,\n      propName = '';\n\n  function _getInherit(name, schemas) {\n      var result = '',\n          id = '';\n\n      for (id in schemas) {\n          if (schemas[id]._name === name) {\n              result = schemas[id]._inherit;\n              break;\n          }\n      }\n      return result;\n  }\n\n  function _getModelDef(name, models) {\n      var result = '',\n          id = '';\n\n      for (id in models) {\n          if (models[id]._name === name) {\n              result = models[id];\n              break;\n          }\n      }\n      return result;\n  }\n\n  function _searchParents(parents, states, models, schemas) {\n      var parent = '',\n          modelDef = null,\n          i = 0,\n          length = 0;\n\n      length = parents.length;\n      for (i = 0; i < length; i++) {\n          parent = parents[i];\n          if (parent === '_Component') {\n              result.init = {\n                  \"params\": [{\n                      \"name\": \"document\",\n                      \"type\": \"object\"\n                  }]\n              };\n\n              result.destroy = {\n                  \"params\": []\n              };\n\n              result.error = {\n                  \"params\": [{\n                      \"name\": \"e\",\n                      \"type\": \"object\"\n                  }]\n              };\n\n          } else {\n              modelDef = _getModelDef(parent, models);\n\n              for (propName in modelDef) {\n                  if (propName.indexOf('_') !== 0 && typeof result[propName] === 'undefined') {\n                      result[propName] = modelDef[propName];\n                  }\n              }\n\n              if (_getInherit(parent, schemas)) {\n                  _searchParents(_getInherit(parent, schemas), result, models, schemas);\n              }\n          }\n      }\n  }\n\n  modelDef = _getModelDef(model, this.system().models());\n\n  for (propName in modelDef) {\n      if (propName.indexOf('_') !== 0) {\n          result[propName] = modelDef[propName];\n      }\n  }\n\n  if (_getInherit(model, this.system().schemas())) {\n    try {\n    _searchParents(_getInherit(model, this.system().schemas()), result, this.system().models(), this.system().schemas());\n    } catch(e) {\n      this.require('message').danger('You have a cyclic inheritance problem with your current schema, please update your schema.');\n    }\n  }\n  return result;\n}","useCoreAPI":false,"core":false},"z13676132a318174":{"_id":"z13676132a318174","component":"SystemFactory","state":"generateId","action":"function generateId() {\n  // taken from https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript\n  function gen() {\n    return 'xxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n      var r = (Math.random() * 16) | 0;\n      var v = c === 'x' ? r : (r & 0x3) | 0x8;\n      return v.toString(16);\n    });\n  }\n\n  // force the uuid to start with a letter\n  function genPrefix() {\n    var validPrefix = 'abcdef';\n    return validPrefix.charAt(Math.floor(Math.random() * validPrefix.length));\n  }\n  \n  return genPrefix() + gen();\n}","useCoreAPI":false,"core":false},"f14ed91a7d21b111":{"_id":"f14ed91a7d21b111","component":"SystemFactory","state":"syncBehavior","action":"function syncBehavior(model) { \n  var behaviors = this.system().behaviors(),\n    components = this.system().components(),\n    schema = null,\n    propName = '',\n    params = '',\n    header = '',\n    def = null,\n    methodDef = null,\n    length = 0,\n    i = 0,\n    behaviorId = '',\n    action = '',\n    behavior = null,\n    that = this;\n\n  function _getSchema(name) {\n    var result = '',\n      id = '';\n\n    for (id in that.system().schemas()) {\n      if (that.system().schemas()[id]._name === name) {\n        result = that.system().schemas()[id];\n        break;\n      }\n    }\n    return result;\n  }\n\n  schema = _getSchema(model._name);\n\n  for (propName in schema) {\n    switch (true) {\n      case schema[propName] === 'method':\n      case schema[propName] === 'event':\n        // params\n        def = model[propName];\n\n        if (typeof model[propName] !== 'object') {\n          if (schema[propName] === 'method') {\n            def = {\n              \"params\": [\n                {\n                  \"name\": \"param\",\n                  \"type\": \"string\",\n                  \"mandatory\": false,\n                  \"default\": \"\"\n                }\n              ],\n              \"result\": \"string\"\n            };\n          } else {\n            def = {\n              \"params\": [\n                {\n                  \"name\": \"param\",\n                  \"type\": \"string\",\n                  \"mandatory\": false,\n                  \"default\": \"\"\n                }\n              ]\n            };\n          }\n        }\n        methodDef = def.params;\n        params = '';\n        if (methodDef && methodDef.length) {\n          length = methodDef.length;\n          for (i = 0; i < length; i++) {\n            if (i === 0) {\n              params = methodDef[i].name;\n            } else {\n              params = params + ', ' + methodDef[i].name;\n            }\n          }\n        }\n\n        header = this.require('language').createBehaviorHeader(propName, params);\n\n        for (behaviorId in behaviors) {\n          behavior = behaviors[behaviorId];\n          \n          // behaviors on models\n          if (behavior.component === model._name && behavior.state === propName) {\n            action = behavior.action.split('{');\n            action[0] = header;\n            behaviors[behaviorId].action = action.join('{');\n            this.system().behaviors(behaviors);\n            this.require('channel').$designerUpdateBehavior(behavior._id, behavior);\n          }\n          \n          // behaviors on components\n          for (var component in components[model._name]) {\n             if (behavior.component === components[model._name][component]._id && behavior.state === propName) {\n              action = behavior.action.split('{');\n              action[0] = header;\n              behaviors[behaviorId].action = action.join('{');\n              this.system().behaviors(behaviors);\n              this.require('channel').$designerUpdateBehavior(behavior._id, behavior);\n            }\n          }\n        }\n\n        break;\n      default:\n        break;\n    }\n  }\n}","useCoreAPI":false,"core":false},"y17ae11cbc214f76":{"_id":"y17ae11cbc214f76","component":"SystemFactory","state":"syncModel","action":"function syncModel(schema) { \n  var schemas = this.system().schemas(),\n      models = this.system().models(),\n      components = this.system().components(),\n      behaviors = this.system().behaviors(),\n      name = '',\n      id = '',\n      propName = '',\n      component = null,\n      behavior = null,\n      model = null,\n      oldSchema = null,\n      createModel = false;\n\n  name = schema._name;\n\n  // search\n  for (id in models) {\n    if (models[id]._name === schema._name) {\n      model = models[id];\n    }\n  }\n\n  // case of no model\n  if (!model) {\n    createModel = true;\n    model = {\n      \"_id\": this.generateId(),\n      \"_name\": name,\n      \"_description\": \"\",\n    };\n  }\n\n  // previous schema\n  oldSchema = schemas[schema._id];\n  for (propName in schema) {\n    if ((schema.hasOwnProperty(propName) &&\n        oldSchema &&\n        (typeof oldSchema[propName] === 'undefined' ||\n            oldSchema[propName] !== schema[propName])) ||\n        createModel\n    ) {\n        switch (true) {\n          case schema[propName] === 'property':\n            model[propName] = {\n              \"description\": \"\",\n              \"type\": \"any\",\n              \"readOnly\": false,\n              \"mandatory\": false,\n              \"default\": \"\"\n            };\n\n            for (component in components[name]) {\n              components[name][component][propName] = model[propName].default;\n              this.require('channel').$designerUpdateComponent(component, name, components[name][component]);\n              this.system().components(components);\n            }\n\n            break;\n          case schema[propName] === 'link':\n            model[propName] = {\n              \"description\": \"\",\n              \"type\": \"_Component\",\n              \"kind\": \"normal\",\n              \"readOnly\": false,\n              \"mandatory\": false,\n              \"default\": \"\"\n            };\n\n            for (component in components[name]) {\n              components[name][component][propName] = model[propName].default;\n              this.require('channel').$designerUpdateComponent(component, name, components[name][component]);\n              this.system().components(components);\n            }\n\n            break;\n          case schema[propName] === 'method':\n            if (typeof model[propName] === 'undefined' || (typeof model[propName] !== 'undefined' && typeof model[propName].type !== 'undefined')) {\n              model[propName] = {\n                  \"description\": \"\",\n                  \"params\": [{\n                        \"description\": \"\",\n                        \"name\": \"param\",\n                        \"type\": \"any\",\n                        \"mandatory\": false,\n                        \"default\": null\n                      }],\n                  \"result\": \"any\"\n              };\n\n              // create behavior\n              this.createBehavior('method', model._name, propName, model[propName]);\n            }\n\n            break;\n          case schema[propName] === 'event':\n            if (typeof model[propName] === 'undefined' || (typeof model[propName] !== 'undefined' && typeof model[propName].type !== 'undefined')) {\n              model[propName] = {\n                \"description\": \"\",\n                \"params\": [{\n                    \"description\": \"\",\n                    \"name\": \"param\",\n                    \"type\": \"any\",\n                    \"mandatory\": false,\n                    \"default\": null\n                }]\n              };\n\n              // remove this to create a behavior by default for event\n              //this.createBehavior('event', model._name, propName, model[propName]);\n            } else {\n              if (typeof model[propName].result !== 'undefined') {\n                delete model[propName].result;\n              }\n            }\n\n            break;\n          case schema[propName] === 'collection':\n            model[propName] = {\n              \"description\": \"\",\n              \"type\": [\"_Component\"],\n              \"kind\": \"normal\",\n              \"readOnly\": false,\n              \"mandatory\": false,\n              \"default\": []\n            };\n\n            for (component in components[name]) {\n              components[name][component][propName] = model[propName].default;\n              this.require('channel').$designerUpdateComponent(component, name, components[name][component]);\n              this.system().components(components);\n            }\n\n            break;\n          case propName.indexOf('_') !== 1:\n            if (propName !== '_id' && propName !== '_inherit') {\n              model[propName] = schema[propName];\n            }\n            break;\n          default:\n            break;\n        }\n    }\n  }\n\n  if (oldSchema) {\n    for (propName in oldSchema) {\n      if (propName.indexOf('_') !== 0 && typeof schema[propName] === 'undefined') {\n        delete model[propName];\n\n        for (component in components[name]) {\n          delete components[name][component][propName];\n          this.require('channel').$designerUpdateComponent(component, name, components[name][component]);\n          this.system().components(components);\n        }\n\n        for (behavior in behaviors) {\n          if (model && behaviors[behavior].component === model._name && behaviors[behavior].state === propName) {\n            delete behaviors[behavior];\n            this.require('channel').$designerDeleteBehavior(behavior);\n            this.system().behaviors(behaviors);\n          }\n          for (component in components[name]) {\n            if (behaviors[behavior] && behaviors[behavior].component === components[name][component]._id && behaviors[behavior].state === propName) { \n              delete behaviors[behavior];\n              this.require('channel').$designerDeleteBehavior(behavior);\n              this.system().behaviors(behaviors);\n            }\n          }\n        }\n      }\n    }\n  }\n\n  models[model._id] = model;\n  this.system().models(models);\n  this.require('channel').$designerUpdateModel(model._id, model);\n}","useCoreAPI":false,"core":false},"z16b03119e81c817":{"_id":"z16b03119e81c817","component":"SystemFactory","state":"syncComponent","action":"function syncComponent(model, oldModel, forceDelete) { \n  var components = this.system().components(),\n      name = '',\n      componentId = '',\n      propName = '',\n      modelDef = null,\n      component = null,\n      createModel = false;\n\n  name = model._name;\n\n  schema = this.getGeneratedSchema(name);\n  modelDef = this.getGeneratedModel(name);\n  \n  function isEqual(arrA, arrB) {\n    var result = true;\n    var strA = '';\n    var strB = '';\n    \n    try {\n      strA = JSON.stringify(arrA);\n      strB = JSON.stringify(arrB);\n      \n      result = strA === strB;\n    } catch(e) {\n      result = false;\n    }\n    \n    return result;\n  }\n\n  for (propName in schema) {\n    switch (true) {\n      case schema[propName] === 'property':\n          for (component in components[name]) {\n            if (typeof components[name][component][propName] === 'undefined') {\n              components[name][component][propName] = modelDef[propName].default;\n              this.require('channel').$designerUpdateComponent(component, name, components[name][component]);\n              this.system().components(components);\n            } else {\n              if (oldModel && oldModel[propName]) {\n                // update type => update component value\n                if (modelDef[propName].type !== oldModel[propName].type) {\n                  components[name][component][propName] = modelDef[propName].default;\n                  this.require('channel').$designerUpdateComponent(component, name, components[name][component]);\n                  this.system().components(components);\n                }\n                // update default value => update component value\n                if (\n                  modelDef[propName].type === oldModel[propName].type && \n                  modelDef[propName].default !== oldModel[propName].default &&\n                  components[name][component][propName] === oldModel[propName].default\n                ) {\n                  components[name][component][propName] = modelDef[propName].default;\n                  this.require('channel').$designerUpdateComponent(component, name, components[name][component]);\n                  this.system().components(components);\n                }\n              }\n            }\n          }\n          break;\n      case schema[propName] === 'link':\n          for (component in components[name]) {\n            if (typeof components[name][component][propName] === 'undefined') {\n              components[name][component][propName] = modelDef[propName].default;\n              this.require('channel').$designerUpdateComponent(component, name, components[name][component]);\n              this.system().components(components);\n            } else {\n              if (oldModel && oldModel[propName]) {\n                // update type => update component value\n                if (modelDef[propName].type !== oldModel[propName].type) {\n                  components[name][component][propName] = modelDef[propName].default;\n                  this.require('channel').$designerUpdateComponent(component, name, components[name][component]);\n                  this.system().components(components);\n                }\n                // update default value => update component value\n                if (\n                  modelDef[propName].type === oldModel[propName].type && \n                  modelDef[propName].default !== oldModel[propName].default &&\n                  components[name][component][propName] === oldModel[propName].default\n                ) {\n                  components[name][component][propName] = modelDef[propName].default;\n                  this.require('channel').$designerUpdateComponent(component, name, components[name][component]);\n                  this.system().components(components);\n                }\n              }\n            }\n          }\n          break;\n      case schema[propName] === 'collection':\n        for (component in components[name]) {\n          if (typeof components[name][component][propName] === 'undefined') {\n            components[name][component][propName] = modelDef[propName].default;\n            this.require('channel').$designerUpdateComponent(component, name, components[name][component]);\n            this.system().components(components);\n          } else {\n              if (oldModel && oldModel[propName]) {\n                // update type => update component value\n                if (!isEqual(modelDef[propName].type, oldModel[propName].type)) {\n                  components[name][component][propName] = modelDef[propName].default;\n                  this.require('channel').$designerUpdateComponent(component, name, components[name][component]);\n                  this.system().components(components);\n                }\n                // update default value => update component value\n                if (\n                  isEqual(modelDef[propName].type, oldModel[propName].type) && \n                  !isEqual(modelDef[propName].default, oldModel[propName].default) &&\n                  isEqual(components[name][component][propName], oldModel[propName].default)\n                ) {\n                  components[name][component][propName] = modelDef[propName].default;\n                  this.require('channel').$designerUpdateComponent(component, name, components[name][component]);\n                  this.system().components(components);\n                }\n              }\n            }\n        }\n        break;\n      default:\n        break;\n    }\n  }\n\n  if (forceDelete) {\n    for (componentId in components[name]) {\n      for (propName in components[name][componentId]) {\n        if (typeof modelDef[propName] === 'undefined' && propName.indexOf('_') !== 0) {\n          delete components[name][componentId][propName];\n          this.require('channel').$designerDeleteComponent(componentId, name);\n          this.system().components(components);\n        }\n      }\n    }\n  }\n}","useCoreAPI":false,"core":false},"f17e231c64613693":{"_id":"f17e231c64613693","component":"SystemFactory","state":"createModel","action":"function createModel(schema) { \n  var schemas = this.system().schemas(),\n      models = this.system().models(),\n      components = this.system().components(),\n      name = '',\n      id = '',\n      propName = '',\n      component = null,\n      behavior = null,\n      model = null,\n      oldSchema = null;\n\n  id = this.generateId();\n\n  model = {\n    \"_id\": id,\n    \"_name\": schema._name,\n    \"_description\": \"\"\n  };\n\n  for (propName in schema) {\n    if (propName.indexOf('_') !== 0) {\n      switch (true) {\n        case schema[propName] === 'property':\n          model[propName] = {\n            \"description\": \"\",\n            \"type\": \"any\",\n            \"readOnly\": false,\n            \"mandatory\": false,\n            \"default\": \"\"\n          };\n\n          for (component in components[name]) {\n            components[name][component][propName] = model[propName].default;\n            this.require('channel').$designerUpdateComponent(component, name, components[name][component]);\n          }\n\n          break;\n        case schema[propName] === 'link':\n          model[propName] = {\n            \"description\": \"\",\n            \"type\": \"_Component\",\n            \"kind\": \"normal\",\n            \"readOnly\": false,\n            \"mandatory\": false,\n            \"default\": \"\"\n          };\n\n          for (component in components[name]) {\n            components[name][component][propName] = model[propName].default;\n            this.require('channel').$designerUpdateComponent(component, name, components[name][component]);\n          }\n\n          break;\n        case schema[propName] === 'method':\n          model[propName] = {\n            \"description\": \"\",\n            \"params\": [{\n                \"description\": \"\",\n                \"name\": \"param\",\n                \"type\": \"any\",\n                \"mandatory\": false,\n                \"default\": null\n              }],\n            \"result\": \"any\"\n          };\n\n          for (component in components[name]) {\n            components[name][component][propName] = model[propName].default;\n            this.require('channel').$designerUpdateComponent(component, name, components[name][component]);\n          }\n\n          break;\n        case schema[propName] === 'event':\n          model[propName] = {\n            \"description\": \"\",\n            \"params\": [{\n              \"description\": \"\",\n              \"name\": \"param\",\n              \"type\": \"any\",\n              \"mandatory\": false,\n              \"default\": null\n            }]\n          };\n\n          for (component in components[name]) {\n            components[name][component][propName] = model[propName].default;\n            this.require('channel').$designerUpdateComponent(component, name, components[name][component]);\n          }\n\n          break;\n        case schema[propName] === 'collection':\n          model[propName] = {\n            \"description\": \"\",\n            \"type\": [\"_Component\"],\n            \"kind\": \"normal\",\n            \"readOnly\": false,\n            \"mandatory\": false,\n            \"default\": []\n          };\n\n          for (component in components[name]) {\n            components[name][component][propName] = model[propName].default;\n            this.require('channel').$designerUpdateComponent(component, name, components[name][component]);\n          }\n\n          break;\n        default:\n          break;\n      }\n    }\n  }\n\n  models[id] = model;\n\n  this.system().models(models);\n  \n  this.require('channel').$designerCreateModel(model._id, model);\n  this.system().components(components);\n  \n  return model;\n}","useCoreAPI":false,"core":false},"z1168215afe1773c":{"_id":"z1168215afe1773c","component":"SystemFactory","state":"deleteSchema","action":"function deleteSchema(id, sync) {\n  var behaviorId = '',\n    modelId = '',\n    behavior = null,\n    schemas = this.system().schemas(),\n    models = this.system().models(),\n    behaviors = this.system().behaviors(),\n    components = this.system().components(),\n    schemaName = '';\n\n  function _getModelId(name, models) {\n    var result = '',\n      id = '';\n\n    for (id in models) {\n      if (models[id]._name === name) {\n        result = id;\n        break;\n      }\n    }\n    return result;\n  }\n\n  if (sync && schemas[id] && schemas[id]._name) {\n  \n    schemaName = schemas[id]._name;\n    \n    // components\n    delete components[schemaName];\n    this.system().components(components);\n  \n    // behaviors\n    for (behaviorId in behaviors) {\n      behavior = behaviors[behaviorId];\n      if (behavior.component === schemaName) {\n        delete behaviors[behaviorId];\n        this.system().behaviors(behaviors);\n      }\n    }\n  \n    // model\n    modelId = _getModelId(schemas[id]._name, models);\n    if (modelId) {\n      delete models[modelId];\n      this.system().models(models);\n    }\n  }\n\n  // schema\n  delete schemas[id];\n  this.system().schemas(schemas);\n}","useCoreAPI":false,"core":false},"v1bc5010b18187ff":{"_id":"v1bc5010b18187ff","component":"SystemFactory","state":"createBehavior","action":"function createBehavior(type, model, state, def) { \n  var body = '\\t\\n',\n      behaviors = this.system().behaviors();\n\n  function _canCreate(type, component, state, behaviors) {\n    var behavior = {},\n        id = '',\n        exist = false,\n        result = true;\n\n    for (id in behaviors) {\n      behavior = behaviors[id];\n      if (behavior.component === component && behavior.state === state) {\n        exist = true;\n        break;\n      }\n    }\n    if (exist) {\n      result = false;\n    }\n\n    return result;\n  }\n\n  if (_canCreate(type, model, state, behaviors)) {\n    uuid = this.generateId();\n\n    // params\n    methodDef = def.params;\n    params = this.require('language').createBehaviorParameters(methodDef);\n\n    // body\n    result = def.result;\n    if (result) {\n      body = this.require('language').createBehaviorBody(result);\n    }\n\n    // set behavior\n    behavior = {\n      \"_id\": uuid,\n      \"component\": model,\n      \"state\": state,\n      \"action\": this.require('language').createBehavior(state, params, body),\n      \"useCoreAPI\": false,\n      \"core\": false\n    };\n\n    behaviors[uuid] = behavior;\n\n    this.system().behaviors(behaviors);\n\n    this.require('channel').$designerCreateBehavior(behavior);\n  }\n}","useCoreAPI":false,"core":false},"c1b62f1086818a0f":{"_id":"c1b62f1086818a0f","component":"SystemFactory","state":"mergeSystem","action":"function mergeSystem(sys) { \n  var System = this.require('System'),\n    name = '',\n    propName = '',\n    modelName = '',\n    compId = '',\n    modelId = '',\n    schemaId = '',\n    factory = this.require('factory'),\n    schemas = {},\n    models = {},\n    types = {},\n    components = {},\n    behaviors = {},\n    system = this.system(),\n    message = this.require('message');\n\n  function _getModelId(name) {\n    var result = '',\n      id = '';\n\n    for (id in factory.system().models()) {\n      if (factory.system().models()[id]._name === name) {\n        result = id;\n        break;\n      }\n    }\n    return result;\n  }\n\n  function _getSchemaId(name) {\n    var result = '',\n      id = '';\n\n    for (id in factory.system().schemas()) {\n      if (factory.system().schemas()[id]._name === name) {\n        result = id;\n        break;\n      }\n    }\n    return result;\n  }\n\n  function _canOverrideBehavior(id, component, state, behaviors) {\n    var behavior = {},\n      behaviorId = '';\n\n    for (behaviorId in behaviors) {\n      behavior = behaviors[behaviorId];\n      if (behavior.component === component && behavior.state === state && behavior._id !== id) {\n        delete behaviors[behavior._id];\n        break;\n      }\n    }\n  }\n\n  function _canOverride(sysId, schemas, behaviors, behavior) {\n    var def = {},\n      id = '',\n      result = true;\n\n    id = _getSchemaId(behavior.component);\n    def = schemas[id];\n\n    if (def && def[behavior.state]) {\n      if (def[behavior.state] === 'method') {\n        _canOverrideBehavior(behavior._id, behavior.component, behavior.state, behaviors);\n      }\n    }\n\n    if ((behavior.state === 'error' || behavior.state === 'start' || behavior.state === 'stop') && behavior.component === sysId) {\n      result = false;\n    }\n\n    return result;\n  }\n\n  if (Object.keys(sys).length) {\n \n    // schemas\n    schemas = JSON.parse(JSON.stringify(this.require('factory').system().schemas()));\n    for (name in sys.schemas) {\n      if (schemas[name]) {\n        for (propName in sys.schemas[name]) {\n          schemas[name][propName] = sys.schemas[name][propName];\n        }\n      } else {\n        if (!_getSchemaId(sys.schemas[name]._name)) {\n          schemas[name] = sys.schemas[name];\n        } else {\n          for (propName in sys.schemas[name]) {\n            if (propName.indexOf('_') !== 0) {\n              schemas[_getSchemaId(sys.schemas[name]._name)][propName] = sys.schemas[name][propName];\n            }\n          }\n        }\n      }\n    }\n    this.require('factory').system().schemas(schemas);\n\n    // behaviors\n    behaviors = JSON.parse(JSON.stringify(this.require('factory').system().behaviors()));\n    for (name in sys.behaviors) {\n      if (name !== sys._id && _canOverride(sys._id, schemas, behaviors, sys.behaviors[name])) {\n        behaviors[name] = sys.behaviors[name];\n      } else {\n        // merge error / start / stop\n        if ((sys.behaviors[name].state === 'error' || sys.behaviors[name].state === 'start' || sys.behaviors[name].state === 'stop') && sys.behaviors[name].component === sys._id) {\n          this.require('factory').mergeBehavior(behaviors, sys.behaviors[name], this.require('factory').system().id(), sys.name);\n        }\n      }\n    }\n    this.require('factory').system().behaviors(behaviors);\n\n\n    // models\n    models = JSON.parse(JSON.stringify(this.require('factory').system().models()));\n    for (name in sys.models) {\n      if (models[name]) {\n        for (propName in sys.models[name]) {\n          models[name][propName] = sys.models[name][propName];\n        }\n      } else {\n        if (!_getModelId(sys.models[name]._name)) {\n          models[name] = sys.models[name];\n        } else {\n          for (propName in sys.models[name]) {\n            if (propName.indexOf('_') !== 0) {\n              models[_getModelId(sys.models[name]._name)][propName] = sys.models[name][propName];\n            }\n          }\n        }\n      }\n    }\n    \n    // sync models\n    for (schemaId in schemas) {\n      this.require('factory').syncModel(schemas[schemaId]);\n    }\n    \n    this.require('factory').system().models(models);\n\n    // sync behaviors and components\n    for (modelId in models) {\n      this.require('factory').syncBehavior(models[modelId]);\n    }\n\n    // types\n    types = JSON.parse(JSON.stringify(this.require('factory').system().types()));\n    for (name in sys.types) {\n      if (types[name]) {\n        for (propName in sys.types[name]) {\n          types[name][propName] = sys.types[name][propName];\n        }\n      } else {\n        types[name] = sys.types[name];\n      }\n    }\n    this.require('factory').system().types(types);\n\n    // components\n    components = JSON.parse(JSON.stringify(this.require('factory').system().components()));\n    for (modelName in sys.components) {\n      if (!components[modelName]) {\n        components[modelName] = {};\n      }\n      for (compId in sys.components[modelName]) {\n        if (components[modelName][compId]) {\n          for (propName in sys.components[modelName][compId]) {\n            components[modelName][compId][propName] = sys.components[modelName][compId][propName];\n          }\n        } else {\n          components[modelName][compId] = sys.components[modelName][compId];\n        }\n      }\n    }\n    this.require('factory').system().components(components);\n\n    // sync components\n    for (modelId in models) {\n      this.require('factory').syncComponent(models[modelId]);\n    }\n\n    this.require('factory').system().schemas(schemas);\n    this.require('factory').system().models(models);\n    this.require('factory').system().types(types);\n    this.require('factory').system().behaviors(behaviors);\n    this.require('factory').system().components(components);\n\n    if (this.require('factory').system().id() === sys._id) {\n      this.require('factory').system().version(sys.version);\n      this.require('factory').system().description(sys.description);\n    }\n\n    message.success('Composition of the system is done.');\n  } else {\n    if (this.require('factory').system()) {\n      message.danger('The system you try to import is invalid.');\n    } else {\n      message.danger('There is no system to compose with.');\n    }\n  }\n}","useCoreAPI":false,"core":false},"c179f91426817730":{"_id":"c179f91426817730","component":"SystemFactory","state":"updateBehavior","action":"function updateBehavior(id, behavior) { \n  var behaviors = this.system().behaviors();\n\n  behaviors[id] = behavior;\n  this.system().behaviors(behaviors);\n}","useCoreAPI":false,"core":false},"p1bf7312724172d3":{"_id":"p1bf7312724172d3","component":"SystemFactory","state":"updateComponent","action":"function updateComponent(id, collection, field, value) { \n  var components = this.system().components();\n  var subField = field.split('.');\n  var length = subField.length;\n  var i = 0;\n  var arr = '';\n  var index = -1;\n  var component = null;\n\n  function _hasSchema(name, schemas) {\n    var result = false,\n        id = '';\n\n    for (id in schemas) {\n        if (schemas[id]._name === name) {\n            result = true;\n            break;\n        }\n    }\n    return result;\n  }\n  \n  if (_hasSchema(collection, this.system().schemas())) {\n    if (typeof components[collection] !== 'undefined' && \n        typeof components[collection][id] !== 'undefined') {\n          \n      if (components[collection][id][subField[0]] !== 'undefined') {\n        component = components[collection][id];\n      \n        for (i = 0; i < length - 1; i++) {\n          if (subField[i].indexOf('[') !== -1) {\n            arr = subField[i].split('[')[0];\n            index = subField[i].split('[')[1].replace(']', '');\n            component = component[arr][index];\n          } else {\n            component = component[subField[i]];\n          }\n        }\n        component[subField[i]] = value;\n            \n        this.system().components(components);\n      }\n    }\t\n  }\n}","useCoreAPI":false,"core":false},"u15b121620519864":{"_id":"u15b121620519864","component":"SystemFactory","state":"deleteComponent","action":"function deleteComponent(id, collection) { \n  var components = this.system().components(),\n      behaviors = this.system().behaviors(),\n      behaviorId = '';\n      \n  function _hasSchema(name, schemas) {\n    var result = false,\n        id = '';\n\n    for (id in schemas) {\n        if (schemas[id]._name === name) {\n            result = true;\n            break;\n        }\n    }\n    return result;\n  }\n  \n  if (_hasSchema(collection, this.system().schemas())) {\n    if (typeof components[collection] !== 'undefined') {\n      delete components[collection][id];\n      this.system().components(components);\n      \n      // remove behaviors linked to the component\n      for (behaviorId in behaviors) {\n        if (behaviors[behaviorId].component === id) {\n  \t      this.deleteBehavior(behaviorId);\n  \t      this.require('channel').$designerDeleteBehavior(behaviorId);\n  \t      break;\n  \t    }\n      }\n    }\t\n  }\n}","useCoreAPI":false,"core":false},"d129be15b711107c":{"_id":"d129be15b711107c","component":"SystemFactory","state":"createComponent","action":"function createComponent(collection, component) { \n  var components = this.system().components();\n  \n  function _hasSchema(name, schemas) {\n    var result = false,\n        id = '';\n\n    for (id in schemas) {\n        if (schemas[id]._name === name) {\n            result = true;\n            break;\n        }\n    }\n    return result;\n  }\n  \n  if (_hasSchema(collection, this.system().schemas())) {\n    if (typeof components[collection] === 'undefined') {\n      components[collection] = {};\n    }\n  \n    components[collection][component._id] = component;\n    this.system().components(components);\n  }\n}","useCoreAPI":false,"core":false},"x10f461f9731db3d":{"_id":"x10f461f9731db3d","component":"SystemFactory","state":"updateSystem","action":"function updateSystem(id, system) { \n  var System = this.require('System'),\n      sys = null;\n\n  if (this.system()) {\n    this.system().destroy();\n  }\n  \n  sys = new System(system);\n  this.system(sys);\n}","useCoreAPI":false,"core":false},"b1c3581800519d9b":{"_id":"b1c3581800519d9b","component":"SystemFactory","state":"overwriteComponent","action":"function overwriteComponent(id, collection, component) { \n  var components = this.system().components();\n  \n  components[collection][id] = component;\n  this.system().components(components);\n}","useCoreAPI":false,"core":false},"p1258b190941d225":{"_id":"p1258b190941d225","component":"SystemFactory","state":"deleteBehavior","action":"function deleteBehavior(id) { \n  var behaviors = this.system().behaviors();\n\n  delete behaviors[id];\n  this.system().behaviors(behaviors);\n}","useCoreAPI":false,"core":false},"n199891dd69109ed":{"_id":"n199891dd69109ed","component":"SystemFactory","state":"udpdateBehavior","action":"function udpdateBehavior(id, behavior) { \n  var behaviors = this.system().behaviors();\n\n  behaviors[id] = behavior;\n  this.system().behaviors(behaviors);\n}","useCoreAPI":false,"core":false},"s15ad71a52019253":{"_id":"s15ad71a52019253","component":"SystemFactory","state":"updateModelId","action":"function updateModelId(oldId, newId) { \n  var models = this.system().models(),\n      model = null;\n\n  model = JSON.parse(JSON.stringify(models[oldId]));\n\n  delete models[oldId];\n\n  model._id = newId;\n  models[newId] = model;\n\n  this.system().models(models);\n}","useCoreAPI":false,"core":false},"a1ae681430b1cbc0":{"_id":"a1ae681430b1cbc0","component":"SystemFactory","state":"updateModel","action":"function updateModel(id, model) { \n var models = this.system().models();\n \n  models[id] = model;\n  this.system().models(models);\n}","useCoreAPI":false,"core":false},"p17e2e1c19b19ed7":{"_id":"p17e2e1c19b19ed7","component":"SystemFactory","state":"updateSchemaId","action":"function updateSchemaId(oldId, newId) { \n  var schemas = this.system().schemas(),\n      schema = null;\n\n  schema = JSON.parse(JSON.stringify(schemas[oldId]));\n\n  delete schemas[oldId];\n\n  schema._id = newId;\n  \n  schemas[newId] = schema;\n  \n  this.system().schemas(schemas);\n}","useCoreAPI":false,"core":false},"o188e9105da13288":{"_id":"o188e9105da13288","component":"SystemFactory","state":"updateSchema","action":"function updateSchema(id, schema) { \n  var schemas = this.system().schemas();\n      \n  schemas[id] = schema;\n  \n  this.system().schemas(schemas);\n}","useCoreAPI":false,"core":false},"v1fc521228d1d589":{"_id":"v1fc521228d1d589","component":"SystemFactory","state":"updateSchemaName","action":"function updateSchemaName(name, id) { \n  var oldName = this.system().schemas()[id]._name,\n      models = this.system().models(),\n      behaviors = this.system().behaviors(),\n      components = this.system().components(),\n      modelId = '',\n      behaviorId = '',\n      behavior = null;\n\n  function _getModelId(name, models) {\n    var result = '',\n        id = '';\n\n    for (id in models) {\n      if (models[id]._name === name) {\n        result = id;\n        break;\n      }\n    }\n    return result;\n  }\n\n  modelId = _getModelId(oldName, this.system().models());\n\n  // update model\n  models[modelId]._name = name;\n  this.system().models(models);\n\n  // update behaviors\n  for (behaviorId in behaviors) {\n    if (behaviors[behaviorId].component === oldName) {\n      behaviors[behaviorId].component = name;\n\n      this.system().behaviors(behaviors);\n    }\n  }\n\n  // components\n  if (components[oldName]) {\n    components[name] = JSON.parse(JSON.stringify(components[oldName]));\n    delete components[oldName];\n\n    this.system().components(components);\n  }\n}","useCoreAPI":false,"core":false},"o1a54f1f354126b9":{"_id":"o1a54f1f354126b9","component":"SystemFactory","state":"deleteType","action":"function deleteType(id) { \n  var types = this.system().types();\n\n  delete types[id];\n  this.system().types(types);\n}","useCoreAPI":false,"core":false},"g151cb1f2bc16ab5":{"_id":"g151cb1f2bc16ab5","component":"SystemFactory","state":"updateType","action":"function updateType(id, type) { \n  var types = this.system().types();\n\n  types[id] = type;\n  this.system().types(types);\n}","useCoreAPI":false,"core":false},"g172411b1b817aec":{"_id":"g172411b1b817aec","component":"SystemFactory","state":"create","action":"function create(sys, withStartMethod) { \n  var System = this.require('System'),\n      uuid = this.generateId(),\n      mainUuid = this.generateId(),\n      system = {},\n      instance = null,\n      migrateSys = '';\n      \n  sys = JSON.parse(JSON.stringify(sys));    \n  \n  // deprecated property\n  // delete sys.subsystem;\n  \n  // migrate v1->v2\n  // migrateSys = JSON.stringify(sys);\n  // migrateSys = migrateSys.replace(/\\\"RuntimeComponent\\\"/g, '\"_Component\"');\n  // migrateSys = migrateSys.replace(/\\\"RuntimeDatabase\\\"/g, '\"_Database\"');\n  // migrateSys = migrateSys.replace(/\\\"RuntimeChannel\\\"/g, '\"_Channel\"');\n  // migrateSys = migrateSys.replace(/\\\"\\u0040/g, '\"');\n  \n  // sys = JSON.parse(migrateSys);\n  \n      \n  // default system\n  system = {\n    \"name\": \"default\",\n    \"master\": true,\n    \"version\": \"0.0.1\",\n    \"description\": \"\",\n    \"schemas\": {},\n    \"models\": {},\n    \"behaviors\": {},\n    \"types\": {},\n    \"components\": {},\n    \"_id\": uuid\n  };\n  \n  for (var prop in sys) {\n    if (sys.hasOwnProperty(prop)) {\n      system[prop] = sys[prop];\n    }\n  }\n\n  if (withStartMethod) {\n    // add main method\n    system.behaviors[mainUuid] = {\n      \"_id\": mainUuid,\n      \"component\": system._id,\n      \"state\": \"start\",\n      \"action\": this.require('language').createStartBehavior(),\n      \"useCoreAPI\": false,\n      \"core\": false\n    };\n  }\n\n  // add (TODO improve)\n  if (this.system()) {\n    this.system().destroy();\n  }\n  \n  instance = new System(system);\n\n  this.system(instance);\n\n  return instance;\n}","useCoreAPI":false,"core":false},"j18c34108721d01d":{"_id":"j18c34108721d01d","component":"SystemFactory","state":"toJSON","action":"function toJSON() { \n  var result = {};\n\t\n  if (this.system()) {\n    result = this.require('db').collections().System.find({\n      '_id': this.system().id()\n    })[0];\n  }\n\t\n  result = JSON.parse(JSON.stringify(result));\n\t\n  return result;\n}","useCoreAPI":false,"core":false},"f184d9169fd1d682":{"_id":"f184d9169fd1d682","component":"SystemFactory","state":"addSchema","action":"function addSchema(name) { \n  var id = this.generateId().toString(),\n      schema = {},\n      schemas = {};\n  \n  // set schema\n  schema = {\n    \"_id\": id,\n    \"_name\": name,\n    \"_inherit\": [\"_Component\"]\n  };\n  \n  schemas = this.system().schemas();\n  schemas[id] = schema;\n  \n  this.system().schemas(schemas);\n  \n  return JSON.parse(JSON.stringify(schema));\n}","useCoreAPI":false,"core":false},"h16f101a2bf17a4d":{"_id":"h16f101a2bf17a4d","component":"SystemFactory","state":"addType","action":"function addType(name, isEnum) { \n  var id = this.generateId().toString(),\n      types = this.system().types(),\n      type = {};\n  \n  // set type\n  if (isEnum) {\n    type = {\n      \"_id\": id,\n      \"name\": name,\n      \"description\": \"\",\n      \"type\": \"any\",\n      \"value\": [\"value1\", \"value2\"]\n    };\n  } else {\n    type = {\n      \"_id\": id,\n      \"name\": name,\n      \"description\": \"\",\n      \"type\": \"object\",\n      \"schema\": {\n        \"property1\": {\n          \"description\":\"\",\n          \"type\": \"any\",\n          \"mandatory\": false,\n          \"default\": \"\"\n        },\n        \"property2\": {\n          \"description\":\"\",\n          \"type\": \"any\",\n          \"mandatory\": false,\n          \"default\": \"\"\n        }\n      }\n    };\n  }\n  \n  types[name] = type;\n  this.require('factory').system().types(types);\n  \n  return JSON.parse(JSON.stringify(type));\n}","useCoreAPI":false,"core":false},"j18b1b101501aead":{"_id":"j18b1b101501aead","component":"SystemFactory","state":"addComponent","action":"function addComponent(model) { \n  var schemaDef = this.getGeneratedSchema(model),\n      components = this.system().components(),\n      uuid = this.generateId(),\n      component = {};\n  \n  // set component\n  component = {\n    \"_id\": uuid,\n  };\n  \n  // set properties default values\n  var propertyNames = [];\n  for (var att in schemaDef) {\n    if (schemaDef[att] === 'property') {\n      propertyNames.push(att);\n    }\n    if (schemaDef[att] === 'link') {\n      propertyNames.push(att);\n    }\n    if (schemaDef[att] === 'collection') {\n      propertyNames.push(att);\n    }\n  }\n  \n  propertyNames.sort();\n  \n  modelDef = this.getGeneratedModel(model);\n  \n  length = propertyNames.length;\n  for (var i = 0; i < length; i++) {\n    if (modelDef && modelDef[propertyNames[i]]) {\n      component[propertyNames[i]] = modelDef[propertyNames[i]].default;\n    }\n  }\n  \n  if (!components[model]) {\n    components[model] = {};\n  }\n  components[model][uuid] = component;\n  \n  this.system().components(components);\n  \n  return JSON.parse(JSON.stringify(component));\n}","useCoreAPI":false,"core":false},"w1c83110cfc1f1f9":{"_id":"w1c83110cfc1f1f9","component":"SystemFactory","state":"addBehavior","action":"function addBehavior(model, component, state) {\n  var that = this,\n      schemas = this.system().schemas(),\n      models = this.system().models(),\n      modelDef = null,\n      factory = this,\n      behaviors = this.system().behaviors(),\n      types = this.system().types(),\n      message = this.require('message'),\n      language = this.require('language'),\n      schemaId = '',\n      modelId = '',\n      methodDef = null,\n      behavior = {},\n      result = '',\n      body = '\\t\\n',\n      ModelBehavior = null,\n      modelBehavior = null,\n      uuid = '',\n      params = '',\n      canCreate = true,\n      i = 0,\n      length = 0,\n      pathType = '';\n\n  function _getSchemaId(name) {\n    var result = '',\n      id = '';\n\n    for (id in that.system().schemas()) {\n      if (that.system().schemas()[id]._name === name) {\n        result = id;\n        break;\n      }\n    }\n    return result;\n  }\n\n  function _getModelId(name) {\n    var result = '',\n      id = '';\n\n    for (id in that.system().models()) {\n      if (that.system().models()[id]._name === name) {\n        result = id;\n        break;\n      }\n    }\n    return result;\n  }\n\n  function _existBehavior(state, space, model) {\n    var result = false;\n\n    if (_isModel(space)) {\n      for (id in that.system().behaviors()) {\n        if (that.system().behaviors()[id].state === state && that.system().behaviors()[id].component === model) {\n          result = true;\n          break;\n        }\n      }\n    } else {\n      for (id in that.system().behaviors()) {\n        if (that.system().behaviors()[id].state === state && that.system().behaviors()[id].component === space) {\n          result = true;\n          break;\n        }\n      }\n    }\n    return result;\n  }\n\n  function _isModel(name) {\n    var result = false;\n\n    if (Object.keys(that.system().components()).indexOf(name) !== -1) {\n      result = true;\n    }\n\n    return result;\n  }\n\n  // get value\n\n  if (model && state) {\n\n    uuid = this.require('factory').generateId();\n\n    if (model !== this.require('factory').system().name()) {\n\n      schemaId = _getSchemaId(model);\n      modelId = _getModelId(model);\n      modelDef = this.getGeneratedModel(model);\n\n      // method params\n      if (modelDef[state]) {\n        methodDef = modelDef[state].params;\n      }\n      params = language.createBehaviorParameters(methodDef);\n      \n      \n      // property params\n      if (schemas[schemaId][state] === 'property' || schemas[schemaId][state] === 'link') {\n        if (models[modelId][state].type === 'array') {\n          params = language.createBehaviorParametersEventArray();\n        } else {\n          params = language.createBehaviorParametersEvent();\n        }\n      }\n      \n      // case of structure\n      if (state.indexOf('.') !== -1) {\n        pathType = this.getModelPathType(model, state);\n        if (Array.isArray(pathType)) {\n          params = language.createBehaviorParametersEventArray();\n        } else {\n          params = language.createBehaviorParametersEvent();\n        }\n      }\n      \n      /*if (state.indexOf('.') !== -1 && schemas[schemaId][state.split('.')[0]] === 'property' && typeof types[models[modelId][state.split('.')[0]].type] !== 'undefined') {\n        if (types[models[modelId][state.split('.')[0]].type].schema[state.split('.')[1]].type === 'array') {\n          params = language.createBehaviorParametersEventArray();\n        } else {\n          params = language.createBehaviorParametersEvent();\n        }\n      }\n      \n      // case of structure in an array\n      if (state.indexOf('.') !== -1 && schemas[schemaId][state.split('.')[0]] === 'collection' && typeof types[models[modelId][state.split('.')[0]].type] !== 'undefined') {\n        if (types[models[modelId][state.split('.')[0]].type].schema[state.split('.')[1]].type === 'array') {\n          params = language.createBehaviorParametersEventArray();\n        } else {\n          params = language.createBehaviorParametersEvent();\n        }\n      }*/\n      \n      // collection params\n      if (schemas[schemaId][state] === 'collection') {\n        params = language.createBehaviorParametersEventArray();\n      }\n\n      // method params\n      if (schemas[schemaId][state] === 'method') {\n        if (_existBehavior(state, this.require('state').space(), model)) {\n          canCreate = false;\n        }\n      }\n      \n      // _Component state params\n      if (state === 'init') {\n        params = 'document';\n        if (_existBehavior(state, this.require('state').space(), model)) {\n          canCreate = false;\n        }\n      }\n\n      if (state === 'destroy') {\n        if (_existBehavior(state, this.require('state').space(), model)) {\n          canCreate = false;\n        }\n      }\n\n      if (state === 'error') {\n        params = 'e';\n        if (_existBehavior(state, this.require('state').space(), model)) {\n          canCreate = false;\n        }\n      }\n\n      // body\n      if (modelDef[state]) {\n        result = modelDef[state].result;\n      }\n      if (result) {\n       body = this.require('language').createBehaviorBody(result);\n      }\n    } else {\n      component = this.require('factory').system().id();\n      \n      if (state === 'error') {\n        params = 'e';\n      }\n      \n      if (_existBehavior(state, component, model)) {\n        canCreate = false;\n      }\n    }\n\n    if (canCreate) {\n      // set model\n      if (state !== 'destroy') {\n        behavior = {\n          \"_id\": uuid,\n          \"component\": component,\n          \"state\": state,\n          \"action\": this.require('language').createBehavior(state, params, body),\n          \"useCoreAPI\": false,\n          \"core\": false\n        };\n      } else {\n        behavior = {\n          \"_id\": uuid,\n          \"component\": component,\n          \"state\": \"destroy\",\n          \"action\": this.require('language').createDestroyBehavior(),\n          \"useCoreAPI\": true,\n          \"core\": false\n        };\n      }\n\n      behaviors[uuid] = behavior;\n      this.require('factory').system().behaviors(behaviors);\n    }\n  }\n  \n  return JSON.parse(JSON.stringify(behavior));\n}","useCoreAPI":false,"core":false},"u1e3e81ddc719f7f":{"_id":"u1e3e81ddc719f7f","component":"SystemFactory","state":"updateComponentId","action":"function updateComponentId(oldId, newId, collection) { \n  var behaviors = this.require('factory').system().behaviors(),\n      behavior = {},\n      behaviorId ='';\n\n  this.updateComponent(oldId, collection, '_id', newId);\n  // TODO ? this.require('channel').$designerUpdateComponent ...\n  \n  // update behaviors linked to the component\n  for (behaviorId in behaviors) {\n    if (behaviors[behaviorId].component === oldId) {\n      behavior = behaviors[behaviorId];\n      behavior.component = newId;\n      this.updateBehavior(behaviorId, behavior);\n      this.require('channel').$designerUpdateBehavior(behaviorId, behavior);\n      break;\n    }\n  }\n}","useCoreAPI":false,"core":false},"c104ab1e9711e87a":{"_id":"c104ab1e9711e87a","component":"SystemFactory","state":"getModelPaths","action":"function getModelPaths(model) { \n\tvar result = [],\n\t    modelDef = '',\n\t    components = this.system().components(),\n\t    prop = '',\n\t    propType = '',\n\t    types = this.system().types();\n\t    \n  function _findModelName(id) {\n    var result = id,\n        modelName = '';\n  \n    for (modelName in components) {\n      if (typeof components[modelName][id] !== 'undefined') {\n        result = modelName;\n        break;\n      }\n    }\n    return result;\n  }   \n  \n  function _findPathRec(path, type) {\n   if (typeof types[type] !== 'undefined' && typeof types[type].schema !== 'undefined') {\n    for (propType in types[type].schema) {\n      result.push(path + '.' + propType);\n      \n      _findPathRec(path + '.' + propType, types[type].schema[propType].type);\n    }\n   }\n  }\n  \n  modelDef = this.getGeneratedModel(_findModelName(model));\n\t\n\tif (model !== this.system().name()) {\n  \tfor (prop in modelDef) {\n  \t  if (modelDef[prop].type && typeof types[modelDef[prop].type] !== 'undefined') {\n  \t    if (typeof types[modelDef[prop].type].schema !== 'undefined') {\n  \t      result.push(prop);\n  \t      for (propType in types[modelDef[prop].type].schema) {\n  \t        result.push(prop + '.' + propType);\n  \t        \n  \t        _findPathRec(prop + '.' + propType, types[modelDef[prop].type].schema[propType].type);\n  \t      }\n  \t    } else {\n  \t      result.push(prop);\n  \t    }\n  \t  } else {\n  \t    result.push(prop);\n  \t  }\n    }\n  } else {\n    result.push('error');\n    result.push('start');\n    result.push('stop');\n  }\n\n  result.sort();\n  \n  return result;\n}","useCoreAPI":false,"core":false},"d1915d138cc1d922":{"_id":"d1915d138cc1d922","component":"SystemFactory","state":"isModel","action":"function isModel(name) { \n\tvar schemas = this.system().schemas(),\n\t    result = false,\n\t    prop = '';\n\t    \n\tif (name === '_Component') {\n\t  result = true;  \n\t}\n\t\n\tif (!result) {\n\t  for (prop in schemas) {\n\t    if (schemas[prop]._name === name) {\n\t      result = true;\n\t      break;\n\t    }\n\t  }\n\t}\n\t\n\treturn result;\n}","useCoreAPI":false,"core":false},"l128b8102d81d2ac":{"_id":"l128b8102d81d2ac","component":"SystemFactory","state":"getModelPathType","action":"function getModelPathType(model, path) { \n  var result = null;\n  var subpaths = [];\n  var subpath = '';\n  var i = 0;\n  var length = 0;\n  var structure = '';\n  var models = this.system().models();\n  var modelId = '';\n  var types = this.system().types();\n  var that = this;\n  \n  function _getModelId(name) {\n    var result = '',\n      id = '';\n\n    for (id in that.system().models()) {\n      if (that.system().models()[id]._name === name) {\n        result = id;\n        break;\n      }\n    }\n    return result;\n  }\n\n  modelId = _getModelId(model);\n  subpaths = path.split('.');\n  length = subpaths.length;\n\n  for (i = 0; i < length; i++) {\n    subpath = subpaths[i];\n    subpath = subpath.split('[')[0];\n    if (i === 0) {\n      result = models[modelId][subpath].type;\n    } else {\n      // collection\n      if (Array.isArray(result)) {\n        result = result[0];\n      }\n      // structure\n      structure = types[result];\n      if (structure && structure.schema) {\n        result = structure.schema[subpath].type;\n      }\n    }\n  }\n  return result;\n}","useCoreAPI":false,"core":false},"v119e617ef513e94":{"_id":"v119e617ef513e94","component":"SystemFactory","state":"isType","action":"function isType(name) { \n  var types = this.system().types(),\n    result = false,\n    prop = '';\n\n\tif (!result) {\n\t  for (prop in types) {\n\t    if (schemas[prop].name === name) {\n\t      result = true;\n\t      break;\n\t    }\n\t  }\n\t}\n\t\n\treturn result;\n}","useCoreAPI":false,"core":false},"p116a812b6310e26":{"_id":"p116a812b6310e26","component":"SystemFactory","state":"getParents","action":"function getParents(name) { \n  var schemaDef = null,\n      parent = '',\n      tempResult = {};\n      result = [];\n\n  function _getSchemaDef(name, schemas) {\n      var result = '',\n          id = '';\n\n      for (id in schemas) {\n          if (schemas[id]._name === name) {\n              result = schemas[id];\n              break;\n          }\n      }\n      return result;\n  }\n\n  function _searchParents(parents, states, schemas) {\n      var parent = '',\n          schemaDef = null,\n          i = 0,\n          length = 0;\n\n      length = parents.length;\n      for (i = 0; i < length; i++) {\n          parent = parents[i];\n          if (parent === '_Component') {\n              result.push('_Component');\n          } else {\n              schemaDef = _getSchemaDef(parent, schemas);\n\n              if (schemaDef._inherit) {\n                result = result.concat(schemaDef._inherit);\n                _searchParents(schemaDef._inherit, result, schemas);\n              }\n          }\n      }\n  }\n\n  schemaDef = _getSchemaDef(name, this.system().schemas());\n\n  if (schemaDef._inherit) {\n      result = result.concat(schemaDef._inherit);\n      _searchParents(schemaDef._inherit, result, this.system().schemas());\n  }\n  \n  // clean\n  result.forEach(function (parent) {\n    tempResult[parent] = parent;\n  });\n  \n  result = [];\n  for (parent in tempResult) {\n    result.push(parent);\n  }\n  \n  return result;\n}","useCoreAPI":false,"core":false},"n12d44154da1020f":{"_id":"n12d44154da1020f","component":"ToolBar","state":"render","action":"function render() { \n  var domItems = document.getElementById('designer-toolbar-items'),\n    i = 0,\n    length = 0,\n    item = null,\n    toolBarItems = [],\n    platformToolBarItems = [],\n    platform = '',\n    self = this;\n    \n  // empty\n  $('#designer-toolbar-items').empty();\n  this.items([]);\n\n  // get items\n  toolBarItems = this.require('db').collections().ToolBarItem.find({\n    'type': this.require('state').type(),\n    'platform': 'all'\n  });\n  \n  // get platform specific items\n  switch (true) {\n    case this.require('designer').isElectron() === true:\n      platform = 'electron';\n      break;\n    case this.require('designer').isCordova() === true:\n      platform = 'cordova';\n      break;\n    default:\n      platform = 'web';\n      break;\n  }\n  \n  platformToolBarItems = this.require('db').collections().ToolBarItem.find({\n    'type': this.require('state').type(),\n    'platform': platform\n  });\n  \n  toolBarItems = toolBarItems.concat(platformToolBarItems);\n\n  // sort items\n  toolBarItems.sort(function (itemA, itemB) {\n    if (itemA.position > itemB.position) {\n      return 1;\n    }\n    if (itemA.position < itemB.position) {\n      return -1;\n    }\n    return 0;\n  });\n\n  toolBarItems.forEach(function (toolBarItem) {\n    var id = toolBarItem._id;\n    self.items().push(self.require(id));\n  });\n\n  // render items\n  this.items().forEach(function (item) {\n    domItems.insertAdjacentHTML('beforeend', '<li>' + item.html().source() + '</>');\n  });\n\n  // add events\n  length = domItems.children.length;\n  for (i = 0; i < length; i++) {\n    item = domItems.children[i];\n    item.addEventListener('click', function () {\n      this.click();\n    }.bind(self.items(i)));\n  }\n}","useCoreAPI":false,"core":false},"d1c07e16ad411943":{"_id":"d1c07e16ad411943","component":"MessageHelp","state":"render","action":"function render() {\n  var template = '';\n  var message = '';\n  var dom = null;\n  var menu = this.require('state').menu();\n  var system = this.require('factory').system();\n  var hasSchema = false;\n  \n  function hasSystem() {\n    var result = true;\n    \n    if (typeof system == 'undefined') {\n      result = false;\n    }\n    if (typeof system !== 'undefined' && system.name() === 'default') {\n      result = false;\n    }\n    \n    return result;\n  }\n\n  if (hasSystem()) {\n    hasSchema = Object.keys(system.schemas()).length !== 0;\n  }\n\n  template = this.require('message-help.html');\n\n  switch (true) {\n    case menu === 'systems':\n      message = \"To create a system, click on the '+' button or click here.\";\n      break;\n    case menu === 'schemas' && hasSystem():\n      message = \"To create a schema, click on the '+' button or click here.\";\n      break;\n    case menu === 'schemas' && !hasSystem():\n      message = \"To create a system, click here.\";\n      break;\n    case menu === 'models' && !hasSystem():\n      message = \"To create a system, click here.\";\n      break;  \n    case menu === 'models' && hasSystem() && !hasSchema:\n      message = \"To create a model, you need to create first a schema. Click here to create a schema.\";\n      break;\n    case menu === 'types' && hasSystem():\n      message = \"To create a type, click on the '+' button or click here.\";\n      break;\n    case menu === 'types' && !hasSystem():\n      message = \"To create a system, click here.\";\n      break;\n    case menu === 'behaviors' && hasSystem():\n      message = \"To create a behavior, click on the '+' button or click here.\";\n      break;  \n    case menu === 'behaviors' && !hasSystem():\n      message = \"To create a system, click here.\";\n      break;  \n    case menu === 'components' && hasSystem() && hasSchema:\n      message = \"To create a component, click on the '+' button or click here.\";\n      break;\n    case menu === 'components' && hasSystem() && !hasSchema:\n      message = \"To create a component, you need to create first a schema. Click here to create a schema.\";\n      break;\n    case menu === 'components' && !hasSystem():\n      message = \"To create a system, click here.\";\n      break;\n    case menu === 'logs' && !hasSystem():\n      message = \"To create a system, click here.\";\n      break;\n    case menu === 'class' && !hasSystem():\n      message = \"To view a diagram, create first a system or drag and drop a Graphviz file here.\";\n      break;\n    case menu === 'component' && !hasSystem():\n      message = \"To view a diagram, create first a system or drag and drop a Graphviz file here.\";\n      break;\n    case menu === 'graph' && !hasSystem():\n      message = \"To view a diagram, create first a system or drag and drop a Graphviz file here.\";\n      break;\n    default:\n      break;\n  }\n\n  if (menu === 'class' || menu === 'component' || menu === 'graph') {\n    document.querySelector('#designer-diagram').insertAdjacentHTML(\n      'afterbegin',\n      template.source().replace(/{{message}}/gi, message));\n  } else {\n    document.querySelector('#designer-workspace').insertAdjacentHTML(\n      'afterbegin',\n      template.source().replace(/{{message}}/gi, message));\n  }\n\n  // events\n  dom = document.getElementById('panel-message-help');\n  if (dom && menu !== 'class' && menu !== 'component' && menu !== 'graph') {\n    dom.addEventListener('click', function click(event) {\n      var menu = this.require('state').menu();\n      var system = this.require('factory').system();\n      var hasSchema = false;\n      var Dialog = null;\n      \n      function hasSystem() {\n        var result = true;\n        \n        if (typeof system == 'undefined') {\n          result = false;\n        }\n        if (typeof system !== 'undefined' && system.name() === 'default') {\n          result = false;\n        }\n        \n        return result;\n      }\n      \n      if (hasSystem()) {\n        hasSchema = Object.keys(system.schemas()).length !== 0;\n      }\n      \n      if (!hasSystem()) {\n        Dialog = this.require('DialogSystemCreation');\n        dialog = new Dialog({\n          'title': 'Create a new system',\n        });\n        dialog.show();\n      } else {\n        switch (true) {\n          case menu === 'models' && !hasSchema:\n          case menu === 'components' && !hasSchema:\n            Dialog = this.require('DialogSchemaCreation');\n            dialog = new Dialog({\n              'title': 'Create a new schema',\n            });\n            dialog.show();\n            break;\n          default:\n            this.require('workspace').create();\n            break;\n        }\n      }\n    }.bind(this));\n  }\n}","useCoreAPI":false,"core":false},"j14bb21eb8a1b68a":{"_id":"j14bb21eb8a1b68a","component":"MessageHelp","state":"remove","action":"function remove() { \n  if ($('#panel-message-help')) {\n\t  $('#panel-message-help').remove();\n  }\n}","useCoreAPI":false,"core":false},"1ca0f1020412d4f":{"_id":"1ca0f1020412d4f","component":"_Storage","state":"get","action":"function get(key) {\n  var result = null;\n\n  if (typeof this.store()[key]) {\n    result = this.store()[key];\n  }\n  return result;\n}","useCoreAPI":false,"core":true},"16764100d51b5f8":{"_id":"16764100d51b5f8","component":"_Storage","state":"set","action":"function set(key, value) {\n  var store = this.store(),\n    item = {};\n\n  store[key] = value;\n  this.store(store);\n\n  item[key] = JSON.stringify(value);\n\n  try {\n    switch (true) {\n      case typeof localStorage !== 'undefined':\n        localStorage.setItem(key, JSON.stringify(value));\n        break;\n      default:\n        break;\n    }\n  } catch (e) { }\n}","useCoreAPI":false,"core":true},"134b616b1016f60":{"_id":"134b616b1016f60","component":"_Storage","state":"clear","action":"function clear() {\n  this.store({});\n  try {\n    switch (true) {\n      case typeof localStorage !== 'undefined':\n        localStorage.clear();\n        break;\n      default:\n        break;\n    }\n  } catch (e) { }\n}","useCoreAPI":false,"core":true},"14c7f1a8431b3d5":{"_id":"14c7f1a8431b3d5","component":"_Storage","state":"init","action":"function init(conf) {\n  try {\n    switch (true) {\n      case typeof localStorage !== 'undefined':\n        // init \n        var keys = Object.keys(localStorage),\n          store = {},\n          i = 0,\n          length = 0;\n\n        length = keys.length;\n        for (i = 0; i < length; i++) {\n          try {\n            store[keys[i]] = JSON.parse(localStorage[keys[i]]);\n          } catch (e) { }\n        }\n        this.store(store);\n\n        // event\n        window.addEventListener('storage', function (e) {\n          var obj = {},\n            store = this.store();\n\n          try {\n            store[e.key] = JSON.parse(e.newValue);\n            this.store(store);\n\n            obj[e.key] = {};\n            obj[e.key].oldValue = JSON.parse(e.oldValue);\n            obj[e.key].newValue = JSON.parse(e.newValue);\n\n            this.changed(obj);\n          } catch (e) { }\n        }.bind(this));\n        break;\n      default:\n        break;\n    }\n  } catch (e) { }\n}","useCoreAPI":false,"core":true},"1a4921ac7112bd4":{"_id":"1a4921ac7112bd4","component":"_Storage","state":"remove","action":"function remove(key) {\n  var store = this.store();\n\n  delete store[key];\n  this.store(store);\n\n  try {\n    switch (true) {\n      case typeof localStorage !== 'undefined':\n        localStorage.removeItem(key);\n        break;\n      default:\n        break;\n    }\n  } catch (e) { }\n}","useCoreAPI":false,"core":true},"x1013f12b661a249":{"_id":"x1013f12b661a249","component":"wdbc51200e11z03","state":"click","action":"function click() { \n  $('#designer-toolbar-item-copy').tooltip('hide');\n  if ($('#designer-dialog').children().length) {\n    $('#' + $(\"#designer-dialog\").children()[0].id).removeClass('fade').modal('hide');\n  }\n  \n  this.require('editor').copy();\n  this.require('message').success('The text has been copied to the clipboard.');\n}"},"v1639613d361aacf":{"_id":"v1639613d361aacf","component":"wdbc51200e11z04","state":"click","action":"function click() { \n  $('#designer-toolbar-item-paste').tooltip('hide');\n  if ($('#designer-dialog').children().length) {\n    $('#' + $(\"#designer-dialog\").children()[0].id).removeClass('fade').modal('hide');\n  }\n  \n  this.require('editor').paste(); \n}"},"g1a0081da861f758":{"_id":"g1a0081da861f758","component":"wdbc51200e11z02","state":"click","action":"function click() { \n  $('#designer-toolbar-item-select-all').tooltip('hide');\n  if ($('#designer-dialog').children().length) {\n    $('#' + $(\"#designer-dialog\").children()[0].id).removeClass('fade').modal('hide');\n  }\n  \n  this.require('editor').selectAll(); \n}"},"q1812b16012148e4":{"_id":"q1812b16012148e4","component":"wdbc51200e11z01","state":"click","action":"function click() { \n  $('#designer-toolbar-item-redo').tooltip('hide');\n  if ($('#designer-dialog').children().length) {\n    $('#' + $(\"#designer-dialog\").children()[0].id).removeClass('fade').modal('hide');\n  }\n  \n  this.require('editor').redo(); \n}"},"f1f85510ffb1f7de":{"_id":"f1f85510ffb1f7de","component":"wdbc51200e11z00","state":"click","action":"function click() { \n  $('#designer-toolbar-item-undo').tooltip('hide');\n  if ($('#designer-dialog').children().length) {\n    $('#' + $(\"#designer-dialog\").children()[0].id).removeClass('fade').modal('hide');\n  }\n  \n  this.require('editor').undo(); \n}"},"a1ca6b1c67e16e93":{"_id":"a1ca6b1c67e16e93","component":"1dbc51200e11617","state":"click","action":"function click() { \n  $('#designer-toolbar-item-help').tooltip('hide');\n  if ($('#designer-dialog').children().length) {\n    $('#' + $(\"#designer-dialog\").children()[0].id).removeClass('fade').modal('hide');\n  }\n  \n  this.require('designer').open('https://designfirst.io/systemdesigner/documentation/docs/create-a-component.html', '_blank', true);\n}"},"u1b6fb175031cb76":{"_id":"u1b6fb175031cb76","component":"1dbc51200e11614","state":"click","action":"function click() {\n  $('#designer-toolbar-item-copyright').tooltip('hide');\n  if ($('#designer-dialog').children().length) {\n    $('#' + $(\"#designer-dialog\").children()[0].id).removeClass('fade').modal('hide');\n  }\n  \n  var DialogCopyright = this.require('DialogCopyright');\n  var message = this.require('copyright.html');\n  \n  DialogCopyright = new DialogCopyright({\n    'title': 'System Designer',\n    'message': message.source().replace('{{version}}', this.require('designer').version())\n  });\n  DialogCopyright.show();\n  DialogCopyright.on('ok', function () {\n    this.hide();\n  });\n}"},"n1e17b11f5d1fd1d":{"_id":"n1e17b11f5d1fd1d","component":"1dbc51200e11613","state":"click","action":"function click() {\n  $('#designer-toolbar-item-save').tooltip('hide');\n  if ($('#designer-dialog').children().length) {\n    $('#' + $(\"#designer-dialog\").children()[0].id).removeClass('fade').modal('hide');\n  }\n  \n  this.require('designer').save();\n}"},"s10e461a0831354a":{"_id":"s10e461a0831354a","component":"MenuItem","state":"click","action":"function click() { \n  var designer = this.require('designer'),\n    editor = this.require('editor'),\n    state = this.require('state'),\n    extra = null,\n    oldContext = '',\n    context = '',\n    val = '';\n\n  state.previousMenu(state.menu());\n  state.menu(this.name());\n\n  extra = this.require('store').extra();\n  oldContext = state.previousMenu();\n  context = state.menu();\n  val = editor.getValue();\n\n  if (oldContext) {\n    if (oldContext !== 'runtimeComponent') {\n      if (extra[oldContext] === 'json') {\n        this.require('store').data()[oldContext] = JSON.parse(editor.getValue());\n      } else {\n        this.require('store').data()[oldContext] = editor.getValue();\n      }\n    } else {\n      this.require('store').data(JSON.parse(editor.getValue()));\n    }\n  }\n\n  component = this.require('store').data();\n\n  if (context !== 'runtimeComponent') {\n    if (extra[context] === 'json') {\n      editor.setEditor(extra[context], JSON.stringify(component[context], null, '\\t'), 2);\n    } else {\n      editor.setEditor(extra[context], component[context], 1, true);\n    }\n  } else {\n    editor.setEditor('json', JSON.stringify(this.require('store').data(), null, '\\t'), 2);\n  }\n}","useCoreAPI":false,"core":false},"f1236f1ee1e1d68f":{"_id":"f1236f1ee1e1d68f","component":"Workspace","state":"render","action":"function render() { \n  var Editor = null,\n    designer = null,\n    editor = null;\n\n  Editor = this.require('Editor');\n  designer = this.require('designer');\n\n  if (designer.isCordova()) {\n    editor = new Editor({\n      '_id': 'editor',\n      'type': 'codemirror',\n      'context': 'component',\n      'editor': CodeMirror($('#designer-editor')[0], {\n        lineNumbers: true,\n        styleActiveLine: true,\n        'mode': 'application/json',\n        'theme': 'eclipse',\n        'tabSize': 2,\n        'autoCloseBrackets': true\n      })\n    });\n  } else {\n    editor = new Editor({\n      '_id': 'editor',\n      'type': 'ace',\n      'context': 'component',\n      'editor': ace.edit('designer-editor')\n    });\n  }\n  \n  editor.render();\n}","useCoreAPI":false,"core":false},"b1c1bb1ef0416898":{"_id":"b1c1bb1ef0416898","component":"Designer","state":"render","action":"function render() {\n  var systemId = '',\n    system = null,\n    sys = null,\n    id = '',\n    types = null,\n    title = '',\n    collection = '',\n    self = this,\n    designer = this.require('designer'),\n    result = {},\n    property = '',\n    propName = '',\n    editor = null;\n\n  // type\n  this.require('state').type(window.location.href.split('.html')[0].split('/')[window.location.href.split('.html')[0].split('/').length - 1]);\n\n  if (this.isCordova()) {\n    this.updateCordovaContext();\n  }\n\n  // get parameters\n  id = decodeURIComponent(document.location.href.split('#')[1].split('?')[0]);\n  collection = decodeURIComponent(document.location.href.split('#')[2].split('?')[0]);\n  systemId = document.location.href.split('#')[3].split('?')[0];\n  \n  // set system\n  system = this.require('storage').get(systemId);\n\n  sys = this.require('factory').create(system);\n  \n  // extensions\n  this.installExtensions();\n\n  // render\n  this.require('toolbar').render();\n  this.require('workspace').render();\n  \n  // set editor\n  system = this.require('storage').get(systemId);\n  component = system.components[collection][id];\n  model = this.require('factory').getGeneratedModel(collection);\n\n  function _init(props) {\n    var propName = '',\n      position = 0,\n      menuitem = null,\n      arrId = [];\n \n    if (Object.keys(props)) {\n      // add menuitems\n      for (propName in props) {\n        self.require('db').collections().HTML.insert({\n          \"_id\": \"menu-item-property-\" + propName + \".html\",\n          \"source\": '<a id=\"designer-menu-item-property-' + propName + '\" href=\"#' + propName + '\">' + propName + '</a>'\n        });\n        arrId = self.require('db').collections().MenuItem.insert({\n          \"name\": propName,\n          \"html\": \"menu-item-property-\" + propName + \".html\",\n          \"position\": position + 10,\n          \"type\": \"component\"\n        });\n      }\n\n      // items\n      var toto = self.require('menubar').items().sort(function (itemA, itemB) {\n        var compA = runtime.require(itemA),\n          compB = runtime.require(itemB);\n\n        if (compA.position() > compB.position()) {\n          return 1;\n        }\n        if (compA.position() < compB.position()) {\n          return -1;\n        }\n        return 0;\n      });\n      // render\n      self.require('menubar').render();\n    }\n  }\n\n  this.require('store').uuid(id);\n  this.require('store').collection(collection);\n  this.require('store').data(component);\n\n  for (property in component) {\n    if (model[property] && model[property].type) {\n      switch (true) {\n        case model[property].type === 'html':\n          result[property] = 'html';\n          break;\n        case model[property].type === 'javascript':\n          result[property] = 'javascript';\n          break;\n        case model[property].type === 'css':\n          result[property] = 'css';\n          break;\n        case model[property].type === 'json':\n          result[property] = 'json';\n          break;\n        case model[property].type === 'object':\n          result[property] = 'json';\n          break;\n        case model[property].type === 'text':\n          result[property] = 'text';\n          break;\n        //case Array.isArray(model[property].type):\n        //result[property] = 'array';\n        //break;\n        default:\n          // case of object / json type\n          types = system.types;\n          if (\n            types &&\n            typeof types[model[property].type] !== 'undefined' &&\n            (types[model[property].type].type === 'object' || types[model[property].type].type === 'json')\n          ) {\n            result[property] = 'json';\n          }\n          break;\n      }\n    }\n  }\n\n  this.require('store').extra(result);\n  _init(result);\n\n  document.title = 'component ' + id + ' · system ' + system.name;\n\n  editor = this.require('editor');\n  if (Object.keys(result).length === 0) {\n    editor.setEditor('json', JSON.stringify(component, null, '\\t'), 2);\n  } else {\n    propName = Object.keys(result)[0];\n    if (result[propName] === 'json') {\n      editor.setEditor(result[propName], JSON.stringify(component[propName], null, '\\t'), 2);\n    } else {\n      editor.setEditor(result[propName], component[propName], 1, true);\n    }\n  }\n  \n  this.require('router').update();\n  \n  this.addShortcuts();\n}","useCoreAPI":false,"core":false},"z1bac81ce5915b1d":{"_id":"z1bac81ce5915b1d","component":"Designer","state":"save","action":"function save() { \n  var val = this.require('editor').getValue(),\n    designer = this.require('designer'),\n    message = this.require('message'),\n    store = this.require('store').data(),\n    state = this.require('state'),\n    extra = this.require('store').extra(),\n    factory = this.require('factory'),\n    id = '',\n    systems = this.require('storage').get('system-designer-systems');\n    \n  if (systems && systems.systems.length === 0) {\n    message.danger('Can not save your component: there is no system.');\n    return;\n  }\n\n  if (state.menu() === 'runtimeComponent') {\n    try {\n      store = JSON.parse(val);\n    } catch (e) {\n      message.danger('Can not save your component: your component has an invalid structure.');\n      return;\n    }\n\n    if (!store._id) {\n      id = decodeURIComponent(document.location.href.split('#')[1].split('?')[0]);\n      if (id) {\n        store._id = id;\n      } else {\n        store._id = factory.generateId();\n      }\n    }\n    if (store._id && store._id.indexOf(' ') !== -1) {\n      message.danger('Invalid \\'_id\\'. <br>Space is not authorized in the value of \\'_id\\'.');\n      return;\n    }\n  } else {\n    if (extra[state.menu()] === 'json') {\n      store[state.menu()] = JSON.parse(val);\n    } else {\n      store[state.menu()] = val;\n    }\n  }\n  this.require('store').data(store);\n\n  // check if ID change\n  if (this.require('store').uuid() !== this.require('store').data()._id) {\n    this.require('channel').$editorUpdateComponentId(this.require('store').uuid(), this.require('store').data()._id, this.require('store').collection());\n    this.require('channel').$editorDeleteComponent(this.require('store').uuid(), this.require('store').collection());\n\n    this.require('store').uuid(this.require('store').data()._id);\n\n    // update title\n    document.title = 'component ' + this.require('store').uuid() + ' · ' + document.title.split('·')[1].trim();\n  }\n\n  this.require('channel').$editorUpdateComponent(this.require('store').uuid(), this.require('store').collection(), this.require('store').data());\n  this.require('message').clean();\n  this.require('message').success('Component saved.');\n}","useCoreAPI":false,"core":false},"n1e0b41437a1ee21":{"_id":"n1e0b41437a1ee21","component":"x1f67a1a3311b2f4","state":"start","action":"function start() { \n  var storeConfig = '';\n  \n  // set locale\n  storeConfig = this.require('storage').get('system-designer-config');\n\n  if (!storeConfig) {\n    storeConfig = {};\n  }\n\n  if (typeof storeConfig.language === 'undefined') {\n    storeConfig.language = 'en-US';\n    this.require('storage').set('system-designer-config', storeConfig);\n  } else {\n    this.require('i18n').locale(storeConfig.language);\n  }\n  \n  this.require('designer').render();\n}","useCoreAPI":false,"core":false},"m169e6148951d670":{"_id":"m169e6148951d670","component":"Router","state":"update","action":"function update() { \n  var menubar = [],\n    i = 0,\n    length = 0,\n    id = '',\n    systemId = '',\n    href = '';\n\n  id = decodeURIComponent(document.location.href.split('#')[1]);\n  collection = document.location.href.split('#')[2];\n  systemId = document.location.href.split('#')[3].split('?')[0];\n\n  // update menubar\n  menubar = $('#designer-menubar-items > li > a');\n  length = menubar.length;\n  for (i = 0; i < length; i++) {\n    href = menubar[i].href;\n    context = href.split('#')[href.split('#').length - 1];\n    menubar[i].href = '#' + id + '#' + collection + '#' + systemId + '#' + context;\n  }\n}","useCoreAPI":false,"core":false},"p16e0e101141aec7":{"_id":"p16e0e101141aec7","component":"_Channel","state":"send","action":"function send(message) { \n  if (message.event.indexOf('$system') !== 0) {\n    var storage = this.require('storage'),\n      config = storage.get('system-designer-config'),\n      designer = this.require('designer'),\n      state = this.require('state');\n\n    storage.set('system-designer-message', message);\n\n    if (designer.isCordova()) {\n      state.messages().push(message);\n    }\n\n    // message for server debug\n    if (typeof config.debugType !== 'undefined' && config.debugType === 'server' && config.urlServer) {\n      $.post(config.urlServer.replace(':8888', '') + ':8888/' + message.event, encodeURIComponent(JSON.stringify(message.data)));\n    }\n  }\t\n}","useCoreAPI":false,"core":false},"k141a418b2f1e2c1":{"_id":"k141a418b2f1e2c1","component":"_Channel","state":"init","action":"function init(conf) { \n  this.require('_Storage').on('changed', function (obj) {\n    if (typeof obj['system-designer-message'] !== 'undefined') {\n      $db._Message.insert(obj['system-designer-message'].newValue);\n    }\n  }, true);\t\n}","useCoreAPI":false,"core":false},"b1a55213199167b3":{"_id":"b1a55213199167b3","component":"r185da17faa18ba1","state":"click","action":"function click() { \n  $('#designer-toolbar-item-command').tooltip('hide');\n  if ($('#designer-dialog').children().length) {\n    $('#' + $(\"#designer-dialog\").children()[0].id).removeClass('fade').modal('hide');\n  }\n  \n  if (this.require('factory').system()) {\n      if ($('#designer-dialog-command-modal').length) {\n        $('#designer-dialog-input-command').val('');\n        $('#designer-dialog-command-result').empty();\n        $('#designer-dialog-command-result-area').hide();\n        $('#designer-dialog-command-modal').modal('show');\n    } else {\n      var Dialog = runtime.require('DialogCommand');\n      var dialog = new Dialog({'title':''});\n      dialog.show();\n    }\t\n  } else {\n    this.require('message').warning('There is no system.');\n  }\n}","useCoreAPI":false,"core":false},"a12e151c735189b9":{"_id":"a12e151c735189b9","component":"z125f2124301bac8","state":"click","action":"function click() { \n  $('#designer-toolbar-item-command').tooltip('hide');\n  if ($('#designer-dialog').children().length) {\n    $('#' + $(\"#designer-dialog\").children()[0].id).removeClass('fade').modal('hide');\n  }\n  \n  if (this.require('factory').system()) {\n      if ($('#designer-dialog-command-modal').length) {\n        $('#designer-dialog-input-command').val('');\n        $('#designer-dialog-command-result').empty();\n        $('#designer-dialog-command-result-area').hide();\n        $('#designer-dialog-command-modal').modal('show');\n    } else {\n      var Dialog = runtime.require('DialogCommand');\n      var dialog = new Dialog({'title':''});\n      dialog.show();\n    }\t\n  } else {\n    this.require('message').warning('There is no system.');\n  }\n}","useCoreAPI":false,"core":false},"y10fc61d1d41464f":{"_id":"y10fc61d1d41464f","component":"Designer","state":"addShortcuts","action":"function addShorcuts() { \n  if (!this.isCordova()) {\n  \tif (this.isMac()) {\n      document.body.addEventListener('keydown', function keydown(event){\n        var message = this.require('message'),\n            key = event.which || event.keyCode,\n            command = event.metaKey ? event.metaKey : ((key === 91) ? true : false),\n            dialog = null,\n            Dialog = null;\n    \n        switch (true) {\n          // Command + O\n          case key === 79 && command:\n            if ($('#designer-dialog').children().length) {\n              $('#' + $(\"#designer-dialog\").children()[0].id).removeClass('fade').modal('hide');\n            }\n            Dialog = runtime.require('DialogCommand');\n            dialog = new Dialog({'title':''});\n            dialog.show();\n            event.stopPropagation();\n            event.preventDefault();\n            return false;\n            break;\n          default:\n            break;\n        }\n      }.bind(this));\n  \t} else {\n      document.body.addEventListener('keydown', function keydown(event){\n        var key = event.which || event.keyCode;\n        var ctrl = event.ctrlKey ? event.ctrlKey : ((key === 17) ? true : false);\n  \n        switch (true) {\n          // Ctrl + O\n          case key === 79 && ctrl:\n            if ($('#designer-dialog').children().length) {\n              $('#' + $(\"#designer-dialog\").children()[0].id).removeClass('fade').modal('hide');\n            }\n            Dialog = runtime.require('DialogCommand');\n            dialog = new Dialog({'title':''});\n            dialog.show();\n            event.stopPropagation();\n            event.preventDefault();\n            return false;\n            break;\n          default:\n            break;\n        }\n      }.bind(this)); \n  \t}\n  }\n}","useCoreAPI":false,"core":false}},"types":{"dialogtype":{"_id":"i1947115bed161d4","name":"dialogtype","type":"string","value":["sync","system","type","schema","model","behavior","component"]},"editorType":{"_id":"o1d8851841b1c785","name":"editorType","type":"string","value":["designer","system","type","schema","model","behavior","component","diagram"]},"editorRuntimeType":{"name":"editorRuntimeType","type":"string","value":["ace","codemirror"]},"editorRef":{"name":"editorRef","type":"object"},"language":{"_id":"z19c6b10ed914764","name":"language","type":"any","value":["javascript"]},"navigation":{"_id":"n1bb7e1a8a713f75","name":"navigation","type":"object","schema":{"menu":{"type":"array","mandatory":false,"default":[]},"spaces":{"type":"array","mandatory":false,"default":[]}}},"platform":{"_id":"r10214160211309c","name":"platform","type":"string","value":["all","web","electron","cordova"]}},"components":{"_Channel":{"channel":{"_id":"channel"}},"Designer":{"designer":{"_id":"designer","debugWindow":null,"runWindow":null,"version":"5.0.1"}},"Diagram":{},"Export":{"export":{"_id":"export"}},"Extension":{"w15b291d1a312ff6":{"_id":"w15b291d1a312ff6","installed":false,"isCore":true,"source":{"name":"extension-model-json","master":false,"version":"1.5.0","description":"Create a model from a JSON file","schemas":{"p181111d5c01f97b":{"_id":"p181111d5c01f97b","_inherit":["_Component"],"_name":"HTML","render":"method","source":"property"},"t19b6b11ff31158d":{"_id":"t19b6b11ff31158d","_name":"ToolBarItem","_inherit":["_Component"],"html":"link","position":"property","type":"property","platform":"property","render":"method","click":"event"},"l1cbdc1fc4612ece":{"_id":"l1cbdc1fc4612ece","_name":"Modal","_inherit":["_Component"],"title":"property","message":"property","html":"link","ok":"event","cancel":"event","show":"method","hide":"method","render":"method"}},"models":{"w1417e1d6d613a0d":{"_id":"w1417e1d6d613a0d","_name":"HTML","source":{"type":"html","readOnly":true,"mandatory":true,"default":""},"render":{"params":[{"name":"id","type":"any","mandatory":false,"default":null}]}},"u1f4c7177bb1a459":{"_id":"u1f4c7177bb1a459","_name":"ToolBarItem","html":{"type":"HTML","readOnly":false,"mandatory":false,"default":"toolbar-item-template.html"},"position":{"type":"number","readOnly":false,"mandatory":false,"default":100},"type":{"type":"editorType","readOnly":false,"mandatory":false,"default":"designer"},"render":{},"click":{},"platform":{"type":"platform","readOnly":false,"mandatory":false,"default":"all"}},"q1d12b19f4712a7a":{"_id":"q1d12b19f4712a7a","_name":"Modal","title":{"type":"text","readOnly":true,"mandatory":false,"default":""},"message":{"type":"text","readOnly":true,"mandatory":false,"default":""},"html":{"type":"HTML","readOnly":false,"mandatory":false,"default":"modal-template.html"},"show":{},"hide":{},"cancel":{},"ok":{},"render":{}}},"behaviors":{"z1f6731cf3219889":{"_id":"z1f6731cf3219889","component":"x10b021de0a19b46","state":"click","action":"function click() { \n  $('#designer-toolbar-item-model-json').tooltip('hide');\n  \n  if (this.require('factory').system()) {\n    this.require('j16a581f46813de3').render();\n  } else {\n    this.require('message').warning('There is no system');\n  } \n}","useCoreAPI":false,"core":false},"v19bb01b70a1a51c":{"_id":"v19bb01b70a1a51c","component":"j16a581f46813de3","state":"ok","action":"function ok() {\n  var name = $('#modal-modeljson-name').val(),\n    jsonText = $('#modal-modeljson-json').val(),\n    json = null,\n    schema = {},\n    model = {},\n    property = '',\n    type = '',\n    typeName = '',\n    arrayType = '',\n    that = this,\n    createdTypes = [];\n\n  function _cleanName(name) {\n    var cleanedName = name.replace(/\\-/gi,'_');\n    \n    if (name && '0123456789'.indexOf(name[0]) !== -1) { \n      cleanedName = '_' + cleanedName; \n    }\n    \n    return cleanedName;\n  }\n\n  function _mergeItems(arr) {\n    var result = {};\n\n    arr.forEach(function forEach(item) {\n      var copyItem = {},\n          prop = '',\n          subprop = '';\n\n      for (prop in item) {\n        switch (_getType(item[prop])) {\n          case 'object':\n            for (subprop in item[prop]) {\n              if (typeof result[prop] === 'undefined') {\n                result[prop] = {};\n              }\n              result[prop][subprop] = item[prop][subprop];\n            }\n            break;\n          case 'array':\n            if (typeof result[prop]  === 'undefined') {\n              result[prop] = [];\n            }\n            item[prop].forEach(function (val) {\n              result[prop].push(val);\n            });\n            break;\n          default:\n            result[prop] = item[prop];\n            break;\n        }\n      }\n    });\n\n    return result;\n  }\n\n  function _getTypeName(parent, name) {\n    var result = '';\n    \n    if (!_validType(name)) {\n      result = _cleanName(name) + '_' + Math.floor(Math.random() * 11);\n    } else {\n      result = _cleanName(name);\n    }\n\n    return result;\n  }\n\n  function _getType(value) {\n    var type = '';\n\n    if (Array.isArray(value)) {\n      type = 'array';\n    } else {\n      type = typeof value;\n    }\n\n    return type;\n  }\n\n  function _validName(name) {\n    var result = true,\n      id = '';\n\n    for (id in that.require('factory').system().schemas()) {\n      if (that.require('factory').system().schemas()[id]._name === name) {\n        result = false;\n        break;\n      }\n    }\n\n    if (that.require('factory').system().name() === name) {\n      result = false;\n    }\n\n    return result;\n  }\n\n  // comment the code \n  // to have less types\n  // but possible type collisions\n  function _validType(name) {\n    var result = true,\n      id = '';\n\n    for (id in that.require('factory').system().types()) {\n      if (that.require('factory').system().types()[id].name === name) {\n        result = false;\n        break;\n      }\n    }\n\n    if (createdTypes.indexOf(name) !== -1) {\n      result = false;\n    }\n    \n\n    return result;\n  }\n\n  function _createTypeFromObject(parent, name, obj) {\n    var typeDef = '',\n      property = '',\n      type = '',\n      typeName = '',\n      arrayType = '',\n      cleanProperty = '';\n\n    typeName = _getTypeName(parent, name);\n    typeDef = that.require('factory').addType(typeName, false);\n    createdTypes.push(typeName);\n\n    typeDef.schema = {};\n    that.require('designer').save();\n\n    for (property in obj) {\n      //if (property.indexOf('_') !== 0) {\n      type = _getType(obj[property]);\n      cleanProperty = _cleanName(property);\n      switch (type) {\n        case 'object':\n          typeDef.schema[cleanProperty] = {};\n          typeDef.schema[cleanProperty].type = _createTypeFromObject(name, property, obj[property]);\n          typeDef.schema[cleanProperty].mandatory = false;\n          typeDef.schema[cleanProperty].default = {};\n          break;\n        case 'number':\n          typeDef.schema[cleanProperty] = {};\n          typeDef.schema[cleanProperty].type = 'number';\n          typeDef.schema[cleanProperty].mandatory = false;\n          typeDef.schema[cleanProperty].default = 0;\n          break;\n        case 'boolean':\n          typeDef.schema[cleanProperty] = {};\n          typeDef.schema[cleanProperty].type = 'boolean';\n          typeDef.schema[cleanProperty].mandatory = false;\n          typeDef.schema[cleanProperty].default = false;\n          break;\n        case 'array':\n          typeDef.schema[cleanProperty] = {};\n          typeDef.schema[cleanProperty].mandatory = false;\n          if (typeof obj[property][0] !== 'undefined') {\n            arrayType = _getType(obj[property][0]);\n\n            if (arrayType === 'object') {\n              if (obj[property][0] !== null) {\n                typeDef.schema[cleanProperty].type = [_createTypeFromObject(name, property, _mergeItems(obj[property]))];\n                typeDef.schema[cleanProperty].default = [];\n              } else {\n                typeDef.schema[cleanProperty].type = ['object'];\n                typeDef.schema[cleanProperty].default = [];\n              }\n            } else {\n              typeDef.schema[cleanProperty].type = [arrayType];\n              typeDef.schema[cleanProperty].default = [];\n            }\n          } else {\n            typeDef.schema[cleanProperty].type = ['any'];\n            typeDef.schema[cleanProperty].default = [];\n          }\n          break;\n        default:\n          typeDef.schema[cleanProperty] = {};\n          typeDef.schema[cleanProperty].type = 'string';\n          typeDef.schema[cleanProperty].mandatory = false;\n          typeDef.schema[cleanProperty].default = '';\n          break;\n      }\n      //}\n    }\n    that.require('factory').updateType(typeName, typeDef);\n    that.require('designer').save();\n\n    return typeName;\n  }\n\n  // clean name\n  name = name.replace(/\\s|\\t/gi, '_').replace(/[\\-\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\`\\{\\|\\}\\~]/gi, '');\n\n  if (name && _validName(name) && jsonText) {\n    try {\n      json = JSON.parse(jsonText);\n      if (json) {\n        // schema\n        schema = this.require('factory').addSchema(name.trim());\n\n        schema._inherit = [];\n        this.require('factory').updateSchema(schema._id, schema);\n\n        this.require('designer').save();\n\n        for (property in json) {\n          if (property.indexOf('_') !== 0) {\n            type = _getType(json[property]);\n            if (type === 'array') {\n              schema[property] = 'collection';\n            } else {\n              schema[property] = 'property';\n            }\n          }\n        }\n\n        this.require('factory').updateSchema(schema._id, schema);\n        this.require('designer').save();\n\n        // model\n        model = this.require('factory').createModel(schema);\n        this.require('designer').save();\n\n        for (property in schema) {\n          if (property.indexOf('_') !== 0) {\n            type = _getType(json[property]);\n            switch (type) {\n              case 'object':\n                if (json[property] !== null) {\n                  model[property].type = _createTypeFromObject('', property, json[property]);\n                  model[property].default = {};\n                } else {\n                  model[property].type = 'object';\n                  model[property].default = {};\n                }\n                break;\n              case 'number':\n                model[property].type = 'number';\n                model[property].default = 0;\n                break;\n              case 'boolean':\n                model[property].type = 'boolean';\n                model[property].default = false;\n                break;\n              case 'array':\n                if (typeof json[property][0] !== 'undefined') {\n                  arrayType = _getType(json[property][0]);\n                  if (arrayType === 'object') {\n                    if (json[property][0] !== null) {\n                      model[property].type = [_createTypeFromObject('', property, _mergeItems(json[property]))];\n                      model[property].default = [];\n                    } else {\n                      model[property].type = ['object'];\n                      model[property].default = [];\n                    }\n                  } else {\n                    model[property].type = [arrayType];\n                    model[property].default = [];\n                  }\n                } else {\n                  model[property].type = ['any'];\n                  model[property].default = [];\n                }\n                break;\n              case 'string':\n                model[property].type = 'string';\n                model[property].default = '';\n                break;\n              default:\n                break;\n            }\n          }\n        }\n\n        this.require('factory').updateModel(model._id, model);\n        this.require('designer').save();\n\n        this.require('channel').$designerCreateSchema(name, schema);\n\n        this.hide();\n\n        this.require('spaces').render();\n        this.require('workspace').render();\n\n        this.require('message').success('A model has been created for the JSON.');\n      }\n    } catch (e) {\n      this.hide();\n      this.require('message').warning('Can not create the model: the JSON is invalid.');\n    }\n  }\n}","useCoreAPI":false,"core":false},"h19d481534915d09":{"_id":"h19d481534915d09","component":"j16a581f46813de3","state":"render","action":"function render() { \n  var dom = null;\n  \n  this.require('Modal').render(this);\t\n  \n  $('#modal-modeljson').on('shown.bs.modal', function modal() {\n    $('#modal-modeljson-name').focus();\n  });\n  \n  // events\n  dom = document.getElementById('modal-modeljson-name');\n  dom.addEventListener('keyup', function keyup(event) {\n    if (event.keyCode === 13) {\n      event.stopPropagation();\n      event.preventDefault();\n      if ($('#modal-modeljson-name').val()) {\n        this.ok();\n      }\n      return false;\n    }\n  }.bind(this));\n  \n  dom = document.getElementById('modal-modeljson-json');\n  dom.addEventListener('keyup', function keyup(event) {\n    if (event.keyCode === 13) {\n      event.stopPropagation();\n      event.preventDefault();\n      if ($('#modal-modeljson-json').val()) {\n        this.ok();\n      }\n      return false;\n    }\n  }.bind(this));\n}","useCoreAPI":false,"core":false},"h1f7551398814e9b":{"_id":"h1f7551398814e9b","component":"j16a581f46813de3","state":"cancel","action":"function cancel() { \n  this.hide();\t\n}","useCoreAPI":false,"core":false},"v16701182a014b42":{"_id":"v16701182a014b42","component":"Modal","state":"render","action":"function render() { \n  var html = '',\n      dom = null,\n      templateId = this.html().id(),\n      id = templateId.replace('.html', '');\n\n  // empty area\n  $('#designer-dialog').empty();\n\n  // render\n  html = this.html();\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n      .replace(/{{title}}/gi, this.title())\n      .replace(/{{message}}/gi, this.message())\n  );\n\n  // modal events\n  dom = document.getElementById(id + '-cancel');\n  dom.addEventListener('click', function click(event) {\n    this.cancel();\n  }.bind(this));\n  \n  dom = document.getElementById(id + '-ok');\n  dom.addEventListener('click', function click(event) {\n    this.ok();\n  }.bind(this));\t\t\n  \n  // show modal\n  $('#' + id).modal('show');\t\n}","useCoreAPI":false,"core":false},"x1902b11a0a1b7d8":{"_id":"x1902b11a0a1b7d8","component":"Modal","state":"hide","action":"function hide() { \n  var id = this.html().id().replace('.html', '');\n  $('#' + id).modal('hide');\n}","useCoreAPI":false,"core":false},"x16db81674e14726":{"_id":"x16db81674e14726","component":"Modal","state":"show","action":"function show() { \n  var id = this.html().id().replace('.html', '');\n  $('#' + id).modal('show');\n}","useCoreAPI":false,"core":false}},"types":{"editorType":{"name":"editorType","type":"string","value":["designer","system","type","schema","model","behavior","component"]},"platform":{"_id":"r10214160211309c","name":"platform","type":"string","value":["all","web","electron","cordova"]}},"components":{"ToolBarItem":{"x10b021de0a19b46":{"_id":"x10b021de0a19b46","html":"toolbar-item-modeljson.html","platform":"all","position":68,"type":"designer"}},"HTML":{"modal-modeljson.html":{"_id":"modal-modeljson.html","source":"<div class=\"modal fade\" id=\"modal-modeljson\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"modalLabel\">\n  <div class=\"modal-dialog modal-lg\" role=\"document\">\n    <div class=\"modal-content\">\n      <div class=\"modal-header\">\n        <h4 class=\"modal-title\" id=\"modalLabel\">{{title}}</h4>\n      </div>\n      <div class=\"modal-body\">\n        <form class=\"form-horizontal\" role=\"form\">\n          <div class=\"form-group\">\n            <label class=\"col-xs-offset-0 col-xs-2 control-label\">Name</label>\n            <div class=\"col-xs-offset-0 col-xs-9\">\n              <input class=\"form-control\" placeholder=\"give a name to your model\" type=\"text\" id=\"modal-modeljson-name\">\n            </div>\n          </div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label class=\"col-xs-offset-0 col-xs-2 control-label\">JSON</label>\n\t\t\t\t\t\t<div class=\"col-xs-offset-0 col-xs-9\">\n\t\t\t\t\t\t\t<textarea class=\"form-control\" placeholder=\"put your JSON here\" rows=\"6\" id=\"modal-modeljson-json\"></textarea>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</form>\t\n      </div>\n      <div class=\"modal-footer\">\n        <button type=\"button\" class=\"btn btn-default\" id=\"modal-modeljson-cancel\">Cancel</button>\n        <button type=\"button\" class=\"btn btn-primary\" id=\"modal-modeljson-ok\">OK</button>\n      </div>\n    </div>\n  </div>\n</div>"},"toolbar-item-modeljson.html":{"_id":"toolbar-item-modeljson.html","source":"<button type=\"button\" id=\"designer-toolbar-item-model-json\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Create a model from JSON\">\n  <span class=\"glyphicon glyphicon-unchecked\" aria-hidden=\"true\"></span>\n</button>"}},"Modal":{"j16a581f46813de3":{"_id":"j16a581f46813de3","html":"modal-modeljson.html","message":"","title":"Create a model from JSON"}}},"_id":"u155371124418bea"}}},"Github":{"github":{"_id":"github"}},"HTML":{"copyright.html":{"_id":"copyright.html","source":"Version {{version}}<br>Copyright © 2021 - <a href=\"https://designfirst.io/systemdesigner/documentation/docs/who-is-behind-system-designer.html\" target=\"_blank\">Erwan Carriou</a><br><br>System\nDesigner is <a href=\"https://designfirst.io/systemdesigner/documentation/docs/en/license.html\" target=\"_blank\">distributed under Apache License 2.0</a> and is powered by <a href=\"https://designfirst.io/systemruntime/\" target=\"_blank\">System Runtime</a>.<br><br>For comments or questions\nyou can <a href=\"https://github.com/design-first/system-designer/issues\" target=\"_blank\">go to the support page</a> or <a href=\"mailto:erwan.carriou@mac.com\">send me an email</a>.<br>If you find a bug, please\nreport it on <a href=\"https://github.com/design-first/system-designer/issues\">this page</a>."},"dialog-modal-welcome.html":{"_id":"dialog-modal-welcome.html","source":"<div class=\"modal fade\" id=\"designer-dialog-welcome-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">\n    <div class=\"modal-dialog modal-lg\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\" id=\"myModalLabel\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                <form class=\"form-horizontal\" role=\"form\">\n                  System Designer will help you to create systems. To begin have a look on our <a href=\"https://designfirst.io/systemdesigner/documentation/docs/quick-start.html\" target=\"_blank\">Quick Start</a>.<br>\n                  <br>\n                  Tips: use System Designer in landscape mode to have more space to design your system.<br>\n                  <br>\n                </form>\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-welcome-modal-ok\">Close</button>\n            </div>\n        </div>\n    </div>\n</div>"},"menu-action-version.html":{"_id":"menu-action-version.html","source":"<a>v5.0.1</a>"},"menu-header-behavior.html":{"_id":"menu-header-behavior.html","source":"<a href=\"javascript:systemDesignerBack()\"><div class=\"navbar-brand\" style=\"padding:16px\"><span class=\"glyphicon glyphicon-menu-left\" aria-hidden=\"true\"></span></div></a>"},"menu-header-component.html":{"_id":"menu-header-component.html","source":"<a href=\"javascript:systemDesignerBack()\"><div class=\"navbar-brand\" style=\"padding:16px\"><span class=\"glyphicon glyphicon-menu-left\" aria-hidden=\"true\"></span></div></a>"},"menu-header-model.html":{"_id":"menu-header-model.html","source":"<a href=\"javascript:systemDesignerBack()\"><div class=\"navbar-brand\" style=\"padding:16px\"><span class=\"glyphicon glyphicon-menu-left\" aria-hidden=\"true\"></span></div></a>"},"menu-header-schema.html":{"_id":"menu-header-schema.html","source":"<a href=\"javascript:systemDesignerBack()\"><div class=\"navbar-brand\" style=\"padding:16px\"><span class=\"glyphicon glyphicon-menu-left\" aria-hidden=\"true\"></span></div></a>"},"menu-header-system.html":{"_id":"menu-header-system.html","source":"<a href=\"javascript:systemDesignerBack()\"><div class=\"navbar-brand\" style=\"padding:16px\"><span class=\"glyphicon glyphicon-menu-left\" aria-hidden=\"true\"></span></div></a>"},"menu-header-type.html":{"_id":"menu-header-type.html","source":"<a href=\"javascript:systemDesignerBack()\"><div class=\"navbar-brand\" style=\"padding:16px\"><span class=\"glyphicon glyphicon-menu-left\" aria-hidden=\"true\"></span></div></a>"},"model-behavior.html":{"_id":"model-behavior.html","source":"<div id=\"designer-behavior-{{_id}}\" class=\"col-xs-offset-2 col-sm-offset-0 col-xs-8 col-sm-6 placeholder designer-behavior\">\n    <div class=\"panel panel-default\">\n        <div class=\"panel-heading\">\n            <h3 class=\"panel-title\">{{title}}</h3>\n            <div class=\"dropdown dropdown-menu-right\">\n                <button type=\"button\" id=\"designer-behavior-{{_id}}-delete\" class=\"btn btn-default\" data-placement=\"right\">\n                    <span class=\"glyphicon glyphicon-remove\" aria-hidden=\"true\"></span>\n                </button>\n            </div>\n        </div>\n        <div class=\"panel-body\">\n            <pre class=\"language-javascript\"><code class=\"language-javascript\">{{content}}</code></pre>\n        </div>\n    </div>\n</div>"},"model-class.html":{"_id":"model-class.html","source":"<div class=\"row\">\n    <div class=\"col-xs-offset-2 col-sm-offset-2 col-xs-8 col-sm-8 placeholder designer-model\" id=\"designer-model-{{_id}}\">\n        <div class=\"panel panel-default\" id=\"designer-model-panel-{{_id}}\">\n            <div class=\"panel-heading\">\n                <h3 class=\"panel-title\">{{title}}</h3>\n            </div>\n            <div class=\"panel-body\">\n                <ul class=\"list-group\">\n                    {{attributes}}\n                    <li class=\"list-group-item list-group-item-methods\" style=\"padding: 0px;height: 3px;background-color: #DDDDDD\"></li>\n                    {{methods}}\n                </ul>\n            </div>\n        </div>\n    </div>\n</div>"},"model-component.html":{"_id":"model-component.html","source":"<div class=\"col-xs-offset-2 col-sm-offset-0 col-xs-8 col-sm-6 placeholder designer-component\" id=\"designer-component-{{_id}}\">\n    <div class=\"panel panel-default\">\n        <div class=\"panel-heading\">\n            <h3 class=\"panel-title\">{{title}}</h3>\n            <div class=\"dropdown dropdown-menu-right\">\n                <button type=\"button\" id=\"designer-component-{{_id}}-delete\" class=\"btn btn-default\" data-placement=\"right\">\n                    <span class=\"glyphicon glyphicon-remove\" aria-hidden=\"true\"></span>\n                </button>\n            </div>\n        </div>\n        <div class=\"panel-body\">\n            <table class=\"table\">\n                <thead>\n                </thead>\n                <tbody>\n                    {{content}}\n                </tbody>\n            </table>\n        </div>\n    </div>\n</div>"},"model-log.html":{"_id":"model-log.html","source":"<div class=\"col-xs-offset-2 col-sm-offset-1 col-xs-9 col-sm-10 placeholder designer-log\" id=\"designer-log\">\n    <div class=\"panel panel-default\">\n        <div class=\"panel-heading\">\n            <h3 class=\"panel-title\">Logs</h3>\n            <div class=\"dropdown dropdown-menu-right\">\n                <button type=\"button\" id=\"designer-log-clean\" class=\"btn btn-default\" data-placement=\"right\">\n                    <span class=\"glyphicon glyphicon-trash\" aria-hidden=\"true\"></span>\n                </button>\n            </div>\n        </div>\n        <div class=\"panel-body\">\n            <div id=\"designer-loug-output\" style=\"text-align:left;\">\n                {{logs}}\n            </div>\n        </div>\n    </div>\n</div>"},"model-schema.html":{"_id":"model-schema.html","source":"<div class=\"row\">\n    <div class=\"col-xs-offset-2 col-sm-offset-2 col-xs-8 col-sm-8 placeholder designer-schema\" id=\"designer-schema-{{id}}\">\n        <div class=\"panel panel-default\" id=\"designer-model-panel-{{id}}\">\n            <div class=\"panel-heading\">\n                <h3 class=\"panel-title\">{{title}}</h3>\n                <div class=\"dropdown dropdown-menu-right\">\n                <button type=\"button\" id=\"designer-schema-{{id}}-delete\" class=\"btn btn-default\" data-placement=\"right\">\n                    <span class=\"glyphicon glyphicon-remove\" aria-hidden=\"true\"></span>\n                </button>\n                </div>\n            </div>\n            <div class=\"panel-body\">\n                <table class=\"table\">\n                    <thead>\n                    </thead>\n                    <tbsody>\n                        {{content}}\n                    </tbody>\n                </table>\n            </div>\n        </div>\n    </div>\n</div>"},"model-system.html":{"_id":"model-system.html","source":"<div class=\"col-xs-offset-2 col-sm-offset-2 col-xs-8 col-sm-8 placeholder designer-system\" id=\"designer-system-{{_id}}\">\n    <div class=\"panel panel-default\">\n        <div class=\"panel-heading\">\n            <h3 class=\"panel-title\">{{title}}</h3>\n            <div class=\"dropdown dropdown-menu-right\">\n                <button type=\"button\" id=\"designer-system-{{_id}}-delete\" class=\"btn btn-default\" data-placement=\"right\">\n                    <span class=\"glyphicon glyphicon-remove\" aria-hidden=\"true\"></span>\n                </button>\n            </div>\n        </div>\n        <div class=\"panel-body\">\n            <table class=\"table\">\n                <thead>\n                </thead>\n                <tbody>\n                    {{content}}\n                </tbody>\n            </table>\n        </div>\n    </div>\n</div>"},"model-type.html":{"_id":"model-type.html","source":"<div class=\"col-xs-offset-2 col-sm-offset-3 col-xs-8 col-sm-6 placeholder designer-type\" id=\"designer-type-{{id}}\">\n    <div class=\"panel panel-default\">\n        <div class=\"panel-heading\">\n            <h3 class=\"panel-title\">{{title}}</h3>\n            <div class=\"dropdown dropdown-menu-right\">\n                <button type=\"button\" id=\"designer-type-{{id}}-delete\" class=\"btn btn-default\" data-placement=\"right\">\n                    <span class=\"glyphicon glyphicon-remove\" aria-hidden=\"true\"></span>\n                </button>\n            </div>\n        </div>\n        <div class=\"panel-body\">\n            <ul class=\"list-group\">\n                {{content}}\n            </ul>\n        </div>\n    </div>\n</div>"},"dialog-modal-behavior-creation.html":{"_id":"dialog-modal-behavior-creation.html","source":"<div class=\"modal fade\" id=\"designer-dialog-behavior-creation-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">\n    <div class=\"modal-dialog modal-sm\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\" id=\"myModalLabel\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                <form class=\"form-horizontal\" role=\"form\">\n                    <div class=\"form-group\">\n                        <label for=\"inputPassword3\" class=\"col-xs-2 col-sm-2 control-label\">On</label>\n                        <div class=\"col-xs-10 col-sm-10\">\n                            <select id=\"designer-dialog-behavior-creation-state\" name=\"state\" class=\"form-control\">\n                                {{states}}\n                            </select>\n                        </div>\n                    </div>\n                </form>\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\" id=\"designer-dialog-behavior-creation-modal-cancel\">Cancel</button>\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-behavior-creation-modal-ok\">Create</button>\n            </div>\n        </div>\n    </div>\n</div>"},"dialog-modal-component-creation.html":{"_id":"dialog-modal-component-creation.html","source":"<div class=\"modal fade\" id=\"designer-dialog-component-creation-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">\n    <div class=\"modal-dialog modal-sm\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\" id=\"myModalLabel\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                <form class=\"form-horizontal\" role=\"form\">\n                    <div class=\"form-group\">\n                        <label for=\"inputPassword3\" class=\"col-sm-4 control-label\">Model</label>\n                        <div class=\"col-sm-8\">\n                            <select id=\"designer-dialog-component-creation-model\" name=\"schema\" class=\"form-control\">\n                                {{models}}\n                            </select>\n                        </div>\n                    </div>\n                </form>\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\" id=\"designer-dialog-component-creation-modal-cancel\">Cancel</button>\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-component-creation-modal-ok\">Create</button>\n            </div>\n        </div>\n    </div>\n</div>"},"dialog-modal-config.html":{"_id":"dialog-modal-config.html","source":"<div class=\"modal fade\" id=\"designer-dialog-config-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">\n    <div class=\"modal-dialog modal-lg\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\" id=\"myModalLabel\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                <form class=\"form-horizontal\" role=\"form\">\n                    <div class=\"form-group\" id=\"designer-dialog-config-client-type-debugging\">\n                        <label class=\"col-xs-offset-0 col-xs-3 control-label\">Type of debugging</label>\n                        <div class=\"col-xs-offset-0 col-xs-8\">\n                            <div class=\"radio\">\n                                <label><input type=\"radio\" name=\"debug-type\" id=\"designer-dialog-config-radio-client\" value=\"client\">Client-side</label>\n                            </div>\n                            <div class=\"radio\"><label><input type=\"radio\" name=\"debug-type\" id=\"designer-dialog-config-radio-server\" value=\"server\">Server-side</label>\n                            </div>\n                        </div>\n                    </div>\n                    <div class=\"form-group\" id=\"designer-dialog-config-client-form\">\n                        <label class=\"col-xs-offset-0 col-xs-3 control-label\">Url of the page to debug</label>\n                        <div class=\"col-xs-offset-0 col-xs-8\">\n                            <input type=\"text\" class=\"form-control\" placeholder=\"example: http://server-name/page-name\" id=\"designer-dialog-config-url-client\">\n                        </div>\n                    </div>\n                    <div class=\"form-group\" id=\"designer-dialog-config-server-form\">\n                        <label class=\"col-xs-offset-0 col-xs-3 control-label\">Url of the server to debug</label>\n                        <div class=\"col-xs-offset-0 col-xs-8\">\n                            <input type=\"text\" class=\"form-control\" placeholder=\"example: http://localhost\" id=\"designer-dialog-config-url-server\">\n                        </div>\n                    </div>\n                    <div class=\"form-group\">\n                        <label class=\"col-xs-offset-0 col-xs-3 control-label\">GitHub repository</label>\n                        <div class=\"col-xs-offset-0 col-xs-8\">\n                            <input class=\"form-control\" placeholder=\"user/repository\" type=\"text\" id=\"designer-dialog-config-github-repository\">\n                        </div>\n                    </div>\n                    <div class=\"form-group\">\n                        <label class=\"col-xs-offset-0 col-xs-3 control-label\">GitHub token</label>\n                        <div class=\"col-xs-offset-0 col-xs-8\">\n                            <input class=\"form-control\" placeholder=\"your personal access token\" type=\"password\" id=\"designer-dialog-config-github-token\">\n                        </div>\n                    </div>\n                    <div class=\"form-group\" id=\"designer-dialog-config-language\">\n                      <label class=\"col-xs-offset-0 col-xs-3 control-label\">Language</label>\n                      <div class=\"col-xs-offset-0 col-xs-3\">\n                        <select id=\"designer-dialog-config-language-select\" name=\"language\" class=\"form-control\">\n                          <option value=\"en-US\">English</option>\n                        </select>\n                      </div>\n                    </div>\n                    <div class=\"form-group\" id=\"designer-dialog-config-advanced-mode\">\n                      <label class=\"col-xs-offset-0 col-xs-3 control-label\">Advanced mode</label>\n                      <div class=\"col-xs-offset-0 col-xs-8\">\n                        <label class=\"checkbox-inline\">\n                          <input type=\"checkbox\" value=\"advanced\" id=\"designer-dialog-config-advanced-mode-isAdvanced\">Enable\n                        </label>\n                      </div>\n                    </div>\n                </form>\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\" id=\"designer-dialog-config-modal-cancel\">Cancel</button>\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-config-modal-ok\">Save</button>\n            </div>\n        </div>\n    </div>\n</div>\n\n\n\n<!--\n\n \n-->"},"dialog-modal-copyright.html":{"_id":"dialog-modal-copyright.html","source":"<div class=\"modal fade\" id=\"designer-dialog-copyright-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">\n    <div class=\"modal-dialog modal-lg\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\" id=\"myModalLabel\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                {{message}}\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-copyright-modal-ok\">Close</button>\n            </div>\n        </div>\n    </div>\n</div>"},"dialog-modal-drop-file.html":{"_id":"dialog-modal-drop-file.html","source":"<div class=\"modal fade\" id=\"designer-dialog-drop-file-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">\n    <div class=\"modal-dialog modal-sm\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\" id=\"myModalLabel\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                {{message}}\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\" id=\"designer-dialog-drop-file-modal-cancel\">Cancel</button>\n                <button type=\"button\" class=\"btn btn-default\" id=\"designer-dialog-drop-file-modal-merge\">Compose</button>\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-drop-file-modal-import\">Import</button>\n            </div>\n        </div>\n    </div>\n</div>"},"dialog-modal-export.html":{"_id":"dialog-modal-export.html","source":"<div class=\"modal fade\" id=\"designer-dialog-export-modal\" tabindex=\"-1\" role=\"dialog\">\n    <div class=\"modal-dialog modal-sm\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                <form class=\"form-horizontal\" role=\"form\">\n                    <div class=\"form-group\">\n                        <label class=\"col-xs-offset-3 col-xs-3 col-sm-offset-2 col-sm-3 control-label\">Format</label>\n                        <div class=\"col-xs-offset-0 col-xs-3 col-sm-offset-0 col-sm-6\">\n                            <div class=\"radio\">\n                                <label>\n                                    <input type=\"radio\" name=\"optradio\" id=\"designer-dialog-export-json\" checked>JSON</label>\n                            </div>\n                            <div class=\"radio\">\n                                <label>\n                                    <input type=\"radio\" name=\"optradio\" id=\"designer-dialog-export-javascript\">JavaScript</label>\n                            </div>\n                            <div class=\"radio\">\n                                <label>\n                                    <input type=\"radio\" name=\"optradio\" id=\"designer-dialog-export-html\">HTML</label>\n                            </div>\n                            <div class=\"radio\">\n                                <label>\n                                    <input type=\"radio\" name=\"optradio\" id=\"designer-dialog-export-node\">Node.js</label>\n                            </div>\n                            <div class=\"radio\">\n                                <label>\n                                    <input type=\"radio\" name=\"optradio\" id=\"designer-dialog-export-graphviz\">Graphviz</label>\n                            </div>\n                        </div>\n                    </div>\n                    <div class=\"form-group\">\n                        <div id=\"designer-dialog-export-options\">\n                            <label class=\"col-xs-offset-3 col-xs-3 col-sm-offset-2 col-sm-3 control-label\">Options</label>\n                            <div class=\"col-xs-offset-0 col-xs-3 col-sm-offset-0 col-sm-6\">\n                                <label class=\"checkbox-inline\">\n                                <input type=\"checkbox\" value=\"master\" id=\"designer-dialog-export-isMaster\"/>Core system\n                            </label>\n                            </div>\n                            <div id=\"designer-dialog-export-options-sub-system\">\n                                <label class=\"col-xs-offset-3 col-sm-offset-2 col-sm-3 control-label\"></label>\n                                <div class=\"col-xs-offset-3 col-sm-offset-0 col-sm-6\">\n                                    <label class=\"checkbox-inline\">        \n                                <input type=\"checkbox\" value=\"subsystem\" id=\"designer-dialog-export-isSubsystem\"/>Sub-system\n                            </label>\n                                </div>\n                            </div>\n                        </div>\n                        <div id=\"designer-dialog-export-options-log-level\">\n                            <label class=\"col-xs-offset-3 col-xs-3 col-sm-offset-2 col-sm-3 control-label\">Logs</label>\n                            <div class=\"col-xs-offset-0 col-xs-3 col-sm-offset-0 col-sm-6\">\n                                <select id=\"designer-dialog-export-options-log-level-select\" name=\"log-level\" class=\"form-control\">\n                                <option value=\"debug\">debug level</option>\n                                <option value=\"info\" selected>info level</option>\n                                <option value=\"warn\">warning level</option>\n                                <option value=\"error\">error level</option>\n                            </select>\n                            </div>\n                        </div>\n                        <div id=\"designer-dialog-export-options-diagram-type\">\n                            <label class=\"col-xs-offset-3 col-xs-3 col-sm-offset-2 col-sm-3 control-label\">Type</label>\n                            <div class=\"col-xs-offset-0 col-xs-3 col-sm-offset-0 col-sm-6\">\n                                <select id=\"designer-dialog-export-options-diagram-type-select\" name=\"diagram-type\" class=\"form-control\">\n                                <option value=\"class\" selected>Class diagram</option>\n                                <option value=\"component\">Component diagram</option>\n                                <option value=\"graph\">Graph diagram</option>\n                            </select>\n                            </div>\n                        </div>\n                    </div>\n                </form>\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\" id=\"designer-dialog-export-modal-cancel\">Cancel</button>\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-export-modal-ok\">Export</button>\n            </div>\n        </div>\n    </div>\n</div>"},"dialog-modal-import-file.html":{"_id":"dialog-modal-import-file.html","source":"<div class=\"modal fade\" id=\"designer-dialog-import-file-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">\n    <div class=\"modal-dialog modal-lg\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\" id=\"myModalLabel\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                <form class=\"form-horizontal\" role=\"form\">\n                    <div class=\"form-group\" id=\"designer-dialog-import-modal-type-import\">\n                        <label class=\"col-xs-offset-0 col-xs-3 control-label\">Import</label>\n                        <div class=\"col-xs-offset-0 col-xs-8\">\n                            <div class=\"radio\" id=\"designer-dialog-import-modal-from-file-input\">\n                                <label><input type=\"radio\" name=\"import-type\" id=\"designer-dialog-import-modal-from-file\" value=\"file\" checked>from a file</label>\n                            </div>\n                            <div class=\"radio\" id=\"designer-dialog-import-modal-from-library-input\">\n                                <label><input type=\"radio\" name=\"import-type\" id=\"designer-dialog-import-modal-from-library\" value=\"library\">from the library</label>\n                            </div>\n                            <div class=\"radio\" id=\"designer-dialog-import-modal-from-systems-input\">\n                                <label><input type=\"radio\" name=\"import-type\" id=\"designer-dialog-import-modal-from-systems\" value=\"library\">from your systems</label>\n                            </div>\n                        </div>\n                    </div>\n                    <div class=\"form-group\" id=\"designer-dialog-import-modal-from-file-form\">\n                        <label class=\"col-xs-offset-0 col-xs-3 control-label\">Select a file</label>\n                        <div class=\"col-xs-offset-0 col-xs-8\">\n                            <div class=\"checkbox\">\n                                <input type=\"file\" id=\"designer-dialog-import-file-modal-file\">\n                            </div>\n                        </div>\n                    </div>\n                    <div class=\"form-group\" id=\"designer-dialog-import-modal-from-library-form\">\n                        <label class=\"col-xs-offset-0 col-xs-3 control-label\">Select a system</label>\n                        <div class=\"col-xs-offset-0 col-xs-8\">\n                            <div class=\"well\" style=\"padding:0px;\" id=\"designer-dialog-import-file-modal-well\">\n                                <div class=\"list-group designer-library\" id=\"designer-dialog-import-file-modal-library\">\n                                    {{library}}\n                                </div>\n                            </div>\n                        </div>\n                    </div>\n                    <div class=\"form-group\" id=\"designer-dialog-import-modal-from-systems-form\">\n                        <label class=\"col-xs-offset-0 col-xs-3 control-label\">Select a system</label>\n                        <div class=\"col-xs-offset-0 col-xs-8\">\n                            <div class=\"well\" style=\"padding:0px;\" id=\"designer-dialog-import-file-modal-well\">\n                                <div class=\"list-group designer-library\" id=\"designer-dialog-import-file-modal-systems\">\n                                    {{systems}}\n                                </div>\n                            </div>\n                        </div>\n                    </div>\n                </form>\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\" id=\"designer-dialog-import-file-modal-cancel\">Cancel</button>\n                <button type=\"button\" class=\"btn btn-default\" id=\"designer-dialog-import-file-modal-merge\">Compose</button>\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-import-file-modal-import\">Import</button>\n            </div>\n        </div>\n    </div>\n</div>"},"dialog-modal-import.html":{"_id":"dialog-modal-import.html","source":"<div class=\"modal fade\" id=\"designer-dialog-import-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">\n    <div class=\"modal-dialog modal-sm\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\" id=\"myModalLabel\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                {{message}}\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\" id=\"designer-dialog-import-modal-cancel\">Cancel</button>\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-import-modal-ok\">Import</button>\n            </div>\n        </div>\n    </div>\n</div>"},"dialog-modal-model-creation.html":{"_id":"dialog-modal-model-creation.html","source":"<div class=\"modal fade\" id=\"designer-dialog-model-creation-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">\n    <div class=\"modal-dialog modal-sm\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\" id=\"myModalLabel\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                <form class=\"form-horizontal\" role=\"form\">\n                    <div class=\"form-group\">\n                        <div class=\"col-sm-offset-1 col-sm-10\">\n                            <p style=\"text-align:justify\">You can not directly create a model.</p>\n                            <p style=\"text-align:justify\">To create a model, you have to create a schema and then a model will be generated based on your schema definition.</p>\n                        </div>\n                    </div>\n                </form>\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-model-creation-modal-ok\">Close</button>\n            </div>\n        </div>\n    </div>\n</div>"},"dialog-modal-component-info.html":{"_id":"dialog-modal-component-info.html","source":"<div class=\"modal fade\" id=\"designer-dialog-component-info-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">\n    <div class=\"modal-dialog modal-lg\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\" id=\"myModalLabel\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                <form class=\"form-horizontal\" role=\"form\">\n                    <div class=\"form-group\">\n                        <div class=\"col-lg-offset-1 col-lg-10\">\n                            <p style=\"text-align:justify\">By default all your models inherit from <i>_Component</i>. It adds to your models a set of APIs to:</p>\n                            <p style=\"text-align:justify\">- <b>manage the component lifecycle</b> and</p>\n                            <p style=\"text-align:justify\">- <b>require</b> components.</p>\n                            <p style=\"text-align:justify\">You can remove this inheritance for your needs.</p>\n                        </div>\n                    </div>\n                </form>\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-component-info-modal-ok\">Close</button>\n            </div>\n        </div>\n    </div>\n</div>"},"dialog-modal-schema-creation.html":{"_id":"dialog-modal-schema-creation.html","source":"<div class=\"modal fade\" id=\"designer-dialog-schema-creation-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">\n    <div class=\"modal-dialog modal-sm\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\" id=\"myModalLabel\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                <form class=\"form-horizontal\" role=\"form\">\n                    <div class=\"form-group\">\n                        <label for=\"inputPassword3\" class=\"col-xs-2 col-sm-4 control-label\">Name</label>\n                        <div class=\"col-xs-10 col-sm-8\">\n                            <input type=\"text\" class=\"form-control\" placeholder=\"schema name\" id=\"designer-dialog-schema-creation-name\">\n                        </div>\n                    </div>\n                </form>\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\" id=\"designer-dialog-schema-creation-modal-cancel\">Cancel</button>\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-schema-creation-modal-ok\">Create</button>\n            </div>\n        </div>\n    </div>\n</div>"},"dialog-modal-search.html":{"_id":"dialog-modal-search.html","source":"<div class=\"modal fade\" id=\"designer-dialog-search-modal\" tabindex=\"-1\" role=\"dialog\">\n    <div class=\"modal-dialog modal-lg\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                <form class=\"form-horizontal\" role=\"form\">\n                    <div class=\"form-group\">\n                        <div class=\"col-xs-offset-1 col-xs-10\">\n                            <div class=\"input-group\">\n                                <span class=\"input-group-addon\">Search for</span>\n                                <input autocomplete=\"new-password\" type=\"text\" class=\"form-control\" placeholder=\"something in a schema, model, ...\" id=\"designer-dialog-input-search\">\n                            </div>\n                        </div>\n                    </div>\n                    <div class=\"form-group\" id=\"designer-dialog-search-result-area\">\n                        <div class=\"col-xs-offset-1 col-xs-10 result-search\">\n                            <h4><div id=\"designer-dialog-search-result-number\"></div></h4>\n                            <div class=\"well\" style=\"padding:0px;\">\n                                <div id=\"designer-dialog-search-result\" class=\"list-group designer-library\"></div>\n                            </div>\n                        </div>\n                    </div>\n                </form>\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-search-modal-ok\">Close</button>\n            </div>\n        </div>\n    </div>\n</div>"},"dialog-modal-share.html":{"_id":"dialog-modal-share.html","source":"<div class=\"modal fade\" id=\"designer-dialog-share-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">\n    <div class=\"modal-dialog modal-sm\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\" id=\"myModalLabel\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                <form class=\"form-horizontal\" role=\"form\">\n                    <div class=\"form-group\">\n                        <div class=\"col-sm-12\">\n                            <input type=\"text\" class=\"form-control\" placeholder=\"schema name\" value=\"{{message}}\" readonly>\n                        </div>\n                    </div>\n                </form>\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\" id=\"designer-dialog-share-modal-cancel\">Cancel</button>\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-share-modal-ok\">OK</button>\n            </div>\n        </div>\n    </div>\n</div>"},"dialog-modal-sync.html":{"_id":"dialog-modal-sync.html","source":"<div class=\"modal fade\" id=\"designer-dialog-sync-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">\n\t<div class=\"modal-dialog modal-lg\" role=\"document\">\n\t\t<div class=\"modal-content\">\n\t\t\t<div class=\"modal-header\">\n\t\t\t\t<h4 class=\"modal-title\" id=\"myModalLabel\">{{title}}</h4>\n\t\t\t</div>\n\t\t\t<div class=\"modal-body\">\n\t\t\t\t<form class=\"form-horizontal\" role=\"form\">\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label class=\"col-xs-offset-0 col-xs-3 control-label\">Command</label>\n\t\t\t\t\t\t<div class=\"col-xs-offset-0 col-xs-8\">\n\t\t\t\t\t\t\t<div class=\"radio\">\n\t\t\t\t\t\t\t\t<label><input type=\"radio\" name=\"sync-type\" id=\"designer-dialog-sync-commit\" value=\"commit\" checked>Push</label>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class=\"radio\">\n\t\t\t\t\t\t\t\t<label><input type=\"radio\" name=\"sync-type\" id=\"designer-dialog-sync-refresh\" value=\"refresh\">Pull</label>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\" id=\"designer-dialog-sync-comments-area\">\n\t\t\t\t\t\t<label class=\"col-xs-offset-0 col-xs-3 control-label\">Comments</label>\n\t\t\t\t\t\t<div class=\"col-xs-offset-0 col-xs-8\">\n\t\t\t\t\t\t\t<textarea class=\"form-control\" placeholder=\"put comments here\" rows=\"2\" id=\"designer-dialog-sync-comments\"></textarea>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\" id=\"designer-dialog-sync-options-area\">\n\t\t\t\t\t\t<label class=\"col-xs-offset-0 col-xs-3 control-label\">Website</label>\n\t\t\t\t\t\t<div class=\"col-xs-offset-0 col-xs-8\">\n\t\t\t\t\t\t\t<label class=\"checkbox-inline\">\n                <input type=\"checkbox\" value=\"htmlPages\" id=\"designer-dialog-type-creation-hasHTML\">Add a webpage\n              </label>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\" id=\"designer-dialog-sync-options-log-level\">\n\t\t\t\t\t\t<label class=\"col-xs-offset-0 col-xs-3 control-label\">Logs</label>\n\t\t\t\t\t\t<div class=\"col-xs-offset-0 col-xs-8\">\n\t\t\t\t\t\t\t<select id=\"designer-dialog-sync-options-log-level-select\" name=\"log-level\" class=\"form-control\">\n                <option value=\"debug\">debug level</option>\n                <option value=\"info\" selected>info level</option>\n                <option value=\"warn\">warning level</option>\n                <option value=\"error\">error level</option>\n              </select>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\" id=\"designer-dialog-sync-options-node\">\n\t\t\t\t\t\t<label class=\"col-xs-offset-0 col-xs-3 control-label\">NPM module</label>\n\t\t\t\t\t\t<div class=\"col-xs-offset-0 col-xs-8\">\n\t\t\t\t\t\t\t<label class=\"checkbox-inline\">\n                <input type=\"checkbox\" value=\"htmlPages\" id=\"designer-dialog-type-creation-hasPackage\">Add a <i>package.json</i> file\n              </label>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t\t<div class=\"modal-footer\">\n\t\t\t\t<button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\" id=\"designer-dialog-sync-modal-cancel\">Cancel</button>\n\t\t\t\t<button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-sync-modal-ok\">Execute</button>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</div>"},"dialog-modal-system-creation.html":{"_id":"dialog-modal-system-creation.html","source":"<div class=\"modal fade\" id=\"designer-dialog-system-creation-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">\n    <div class=\"modal-dialog modal-sm\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\" id=\"myModalLabel\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                <form class=\"form-horizontal\" role=\"form\">\n                    <div class=\"form-group\">\n                        <label class=\"col-xs-2 col-sm-4 control-label\">Name</label>\n                        <div class=\"col-xs-10 col-sm-8\">\n                            <input type=\"text\" class=\"form-control\" placeholder=\"system name\" id=\"designer-dialog-system-creation-name\">\n                        </div>\n                    </div>\n                </form>\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\" id=\"designer-dialog-system-creation-modal-cancel\">Cancel</button>\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-system-creation-modal-ok\">Create</button>\n            </div>\n        </div>\n    </div>\n</div>"},"dialog-modal-type-creation.html":{"_id":"dialog-modal-type-creation.html","source":"<div class=\"modal fade\" id=\"designer-dialog-type-creation-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">\n    <div class=\"modal-dialog modal-sm\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\" id=\"myModalLabel\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                <form class=\"form-horizontal\" role=\"form\">\n                    <div class=\"form-group\">\n                        <label for=\"inputPassword3\" class=\"col-xs-2 col-sm-4 control-label\">Name</label>\n                        <div class=\"col-xs-10 col-sm-8\">\n                            <input type=\"text\" class=\"form-control\" placeholder=\"type name\" id=\"designer-dialog-type-creation-name\">\n                        </div>\n                    </div>\n                    <div class=\"form-group\">\n                        <div class=\"col-xs-offset-2 col-xs-10 col-sm-offset-4 col-sm-8\">\n                            <label class=\"checkbox-inline\">\n                                <input type=\"checkbox\" value=\"enum\" id=\"designer-dialog-type-creation-isEnum\">Enumeration\n                            </label>\n                        </div>\n                    </div>\n                </form>\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\" id=\"designer-dialog-type-creation-modal-cancel\">Cancel</button>\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-type-creation-modal-ok\">Create</button>\n            </div>\n        </div>\n    </div>\n</div>"},"dialog-modal.html":{"_id":"dialog-modal.html","source":"<div class=\"modal fade\" id=\"designer-dialog-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">\n    <div class=\"modal-dialog modal-sm\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\" id=\"myModalLabel\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                {{message}}\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\" id=\"designer-dialog-modal-cancel\">Cancel</button>\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-modal-ok\">OK</button>\n            </div>\n        </div>\n    </div>\n</div>"},"export-app-github.html":{"_id":"export-app-github.html","source":"<!DOCTYPE html>\n<html>\n\n<head>\n  <title>{{name}}</title>\n  <meta charset=\"UTF-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  <!-- system -->\n  <link rel=\"system\" type=\"application/json\" href=\"{{name}}.json\">\n</head>\n\n<body>\n  <!-- system runtime  -->\n  <script log=\"{{logLevel}}\" src=\"https://cdn.jsdelivr.net/npm/system-runtime/dist/system-runtime.min.js\"></script>\n</body>\n\n</html>"},"export-app.html":{"_id":"export-app.html","source":"<!DOCTYPE html>\n<html>\n\n<head>\n    <title>{{name}}</title>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n</head>\n\n<body>\n  <!-- system runtime  -->\n  <script log=\"{{logLevel}}\" src=\"https://cdn.jsdelivr.net/npm/system-runtime/dist/system-runtime.min.js\"></script>\n  <!-- system -->\n  <script>\n    runtime.on('ready', function ready() {\n        // install and start the system\n        this.install({{system}});\n    }, false, true);\n  </script>\n</body>\n\n</html>"},"help-behaviors.html":{"_id":"help-behaviors.html","source":"<i18n>{help_behaviors}</i18n>"},"help-components.html":{"_id":"help-components.html","source":"<i18n>{help_components}</i18n>"},"help-logs.html":{"_id":"help-logs.html","source":"<i18n>{help_logs}</i18n>"},"help-models.html":{"_id":"help-models.html","source":"<i18n>{help_models}</i18n>"},"help-schemas.html":{"_id":"help-schemas.html","source":"<i18n>{help_schemas}</i18n>"},"help-system.html":{"_id":"help-system.html","source":"<i18n>{help_systems}</i18n>"},"help-types.html":{"_id":"help-types.html","source":"<i18n>{help_types}</i18n>"},"menu-header.html":{"_id":"menu-header.html","source":"<div class=\"navbar-brand\" style=\"padding:7px\"><img src=\"img/logo.png\" style=\"width:35px;height:35px\"></img></div>"},"menu-item-action.html":{"_id":"menu-item-action.html","source":"<a id=\"designer-menu-item-action\" href=\"#action\">Action</a>"},"menu-item-behaviors.html":{"_id":"menu-item-behaviors.html","source":"<a id=\"designer-menu-item-behaviors\" href=\"#behaviors\">Behaviors</a>"},"menu-item-component.html":{"_id":"menu-item-component.html","source":"<a id=\"designer-menu-item-component\" href=\"#component\">Component</a>"},"menu-item-components.html":{"_id":"menu-item-components.html","source":"<a id=\"designer-menu-item-components\" href=\"#components\">Components</a>"},"menu-item-description.html":{"_id":"menu-item-description.html","source":"<a id=\"designer-menu-item-description\" href=\"#description\">Description</a>"},"menu-item-json.html":{"_id":"menu-item-json.html","source":"<a id=\"designer-menu-item-json\" href=\"#json\">JSON</a>"},"menu-item-logs.html":{"_id":"menu-item-logs.html","source":"<a id=\"designer-menu-item-logs\" href=\"#logs\">Logs<span id=\"designer-menu-item-logs-number\" class=\"badge log-number\" style=\"display: none;\">0</span></a>"},"menu-item-model.html":{"_id":"menu-item-model.html","source":"<a id=\"designer-menu-item-model\" href=\"#model\">Model</a>"},"menu-item-models.html":{"_id":"menu-item-models.html","source":"<a id=\"designer-menu-item-models\" href=\"#models\">Models</a>"},"menu-item-mson.html":{"_id":"menu-item-mson.html","source":"<a id=\"designer-menu-item-mson\" href=\"#mson\">MSON</a>"},"menu-item-name.html":{"_id":"menu-item-name.html","source":"<a id=\"designer-menu-item-name\" href=\"#name\">Name</a>"},"menu-item-overview.html":{"_id":"menu-item-overview.html","source":"<a id=\"designer-menu-overview\" href=\"#overview\">Overview</a>"},"menu-item-schema.html":{"_id":"menu-item-schema.html","source":"<a id=\"designer-menu-item-schema\" href=\"#schema\">Schema</a>"},"menu-item-schemas.html":{"_id":"menu-item-schemas.html","source":"<a id=\"designer-menu-item-schemas\" href=\"#schemas\">Schemas</a>"},"menu-item-system.html":{"_id":"menu-item-system.html","source":"<a id=\"designer-menu-item-systems\" href=\"#systems\">Systems</a>"},"menu-item-type.html":{"_id":"menu-item-type.html","source":"<a id=\"designer-menu-item-type\" href=\"#type\">Type</a>"},"menu-item-types.html":{"_id":"menu-item-types.html","source":"<a id=\"designer-menu-item-types\" href=\"#types\">Types</a>"},"menu-item-version.html":{"_id":"menu-item-version.html","source":"<a id=\"designer-menu-item-version\" href=\"#version\">Version</a>"},"message-alert-danger.html":{"_id":"message-alert-danger.html","source":"<div id=\"designer-message-danger-{id}\" class=\"alert alert-danger designer-message-danger\" role=\"alert\">{{message}}</div>"},"message-alert-info.html":{"_id":"message-alert-info.html","source":"<div id=\"designer-message-info-{id}\" class=\"alert alert-info designer-message-info\" role=\"alert\">{{message}}</div>"},"message-alert-success.html":{"_id":"message-alert-success.html","source":"<div id=\"designer-message-success-{id}\" class=\"alert alert-success designer-message-success\" role=\"alert\">{{message}}</div>"},"message-alert-warning.html":{"_id":"message-alert-warning.html","source":"<div id=\"designer-message-warning-{id}\" class=\"alert alert-warning designer-message-warning\" role=\"alert\">{{message}}</div>"},"toolbar-item-config.html":{"_id":"toolbar-item-config.html","source":"<button type=\"button\" id=\"designer-toolbar-item-config\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Configure System Designer\">\n    <span class=\"glyphicon glyphicon-cog\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-copy.html":{"_id":"toolbar-item-copy.html","source":"<button type=\"button\" id=\"designer-toolbar-item-copy\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Copy to clipboard\">\n    <span class=\"glyphicon glyphicon-copy\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-copyright.html":{"_id":"toolbar-item-copyright.html","source":"<button type=\"button\" id=\"designer-toolbar-item-copyright\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Copyright\">\n    <span class=\"glyphicon glyphicon-copyright-mark\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-create.html":{"_id":"toolbar-item-create.html","source":"<button type=\"button\" id=\"designer-toolbar-item-create\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Create a new item\">\n    <span class=\"glyphicon glyphicon-plus\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-delete.html":{"_id":"toolbar-item-delete.html","source":"<button type=\"button\" id=\"designer-toolbar-item-delete\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Delete\">\n    <span class=\"glyphicon glyphicon-remove\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-export-document.html":{"_id":"toolbar-item-export-document.html","source":"<button type=\"button\" id=\"designer-toolbar-item-export-document\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Export\">\n    <span class=\"glyphicon glyphicon-log-out icon-rotate-left\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-export.html":{"_id":"toolbar-item-export.html","source":"<button type=\"button\" id=\"designer-toolbar-item-export\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Export your current system\">\n    <span class=\"glyphicon glyphicon-log-out icon-rotate-left\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-help.html":{"_id":"toolbar-item-help.html","source":"<button type=\"button\" id=\"designer-toolbar-item-help\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Read the documentation\">\n    <span class=\"glyphicon glyphicon-question-sign\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-import.html":{"_id":"toolbar-item-import.html","source":"<button type=\"button\" id=\"designer-toolbar-item-import\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Import a system\">\n    <span class=\"glyphicon glyphicon-log-in icon-rotate-right\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-library.html":{"_id":"toolbar-item-library.html","source":"<button type=\"button\" id=\"designer-toolbar-item-library\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Import from library\">\n    <span class=\"glyphicon glyphicon-th\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-paste.html":{"_id":"toolbar-item-paste.html","source":"<button type=\"button\" id=\"designer-toolbar-item-paste\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Paste from clipboard\">\n    <span class=\"glyphicon glyphicon-paste\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-publish.html":{"_id":"toolbar-item-publish.html","source":"<button type=\"button\" id=\"designer-toolbar-item-publish\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Run the current system\">\n    <span class=\"glyphicon glyphicon-play\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-redo.html":{"_id":"toolbar-item-redo.html","source":"<button type=\"button\" id=\"designer-toolbar-item-redo\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Redo\">\n    <span class=\"glyphicon glyphicon-repeat\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-refresh.html":{"_id":"toolbar-item-refresh.html","source":"<button type=\"button\" id=\"designer-toolbar-item-refresh\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Design a remote system\">\n    <span class=\"glyphicon glyphicon-edit\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-save.html":{"_id":"toolbar-item-save.html","source":"<button type=\"button\" id=\"designer-toolbar-item-save\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Save\">\n    <span class=\"glyphicon glyphicon-ok\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-search.html":{"_id":"toolbar-item-search.html","source":"<button type=\"button\" id=\"designer-toolbar-item-search\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Search\">\n    <span class=\"glyphicon glyphicon-search\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-select-all.html":{"_id":"toolbar-item-select-all.html","source":"<button type=\"button\" id=\"designer-toolbar-item-select-all\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Select all\">\n    <span class=\"glyphicon glyphicon-align-justify\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-share.html":{"_id":"toolbar-item-share.html","source":"<button type=\"button\" id=\"designer-toolbar-item-share\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Share your current system\">\n    <span class=\"glyphicon glyphicon-link\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-sync.html":{"_id":"toolbar-item-sync.html","source":"<button type=\"button\" id=\"designer-toolbar-item-sync\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Synchronize your system with GitHub\">\n    <span class=\"glyphicon glyphicon glyphicon-refresh\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-undo.html":{"_id":"toolbar-item-undo.html","source":"<button type=\"button\" id=\"designer-toolbar-item-undo\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Undo\">\n    <span class=\"glyphicon glyphicon-repeat icon-reverse\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-extension.html":{"_id":"toolbar-item-extension.html","source":"<button type=\"button\" id=\"designer-toolbar-item-extension\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Manage your extensions\">\n    <span class=\"glyphicon glyphicon-th-large icon-reverse\" aria-hidden=\"true\"></span>\n</button>"},"dialog-modal-extension.html":{"_id":"dialog-modal-extension.html","source":"<div class=\"modal fade\" id=\"designer-dialog-extension-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">\n    <div class=\"modal-dialog modal-lg\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\" id=\"myModalLabel\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                <form class=\"form-horizontal\" role=\"form\">\n                    <div class=\"form-group\" id=\"designer-dialog-extension-modal-type\">\n                        <label class=\"col-xs-offset-0 col-xs-3 control-label\">You want to</label>\n                        <div class=\"col-xs-offset-0 col-xs-8\">\n                            <div class=\"radio\">\n                                <label><input type=\"radio\" name=\"action-type\" id=\"designer-dialog-extension-modal-action-add\" value=\"action\" checked>add or reinstall an extension</label>\n                            </div>\n                            <div class=\"radio\">\n                                <label><input type=\"radio\" name=\"action-type\" id=\"designer-dialog-extension-modal-action-remove\" value=\"action\">remove an extension</label>\n                            </div>\n                        </div>\n                    </div>\n                    <div class=\"form-group\" id=\"designer-dialog-extension-modal-uninstalled-extensions-area\">\n                        <label class=\"col-xs-offset-0 col-xs-3 control-label\">From the list of extensions</label>\n                        <div class=\"col-xs-offset-0 col-xs-8\">\n                            <div class=\"well\" style=\"padding:0px;\">\n                                <div class=\"list-group designer-library\" id=\"designer-dialog-extension-modal-uninstalled-extensions\">\n                                    {{uninstalled_extensions}}\n                                </div>\n                            </div>\n                        </div>\n                    </div>\n                    <div class=\"form-group\" id=\"designer-dialog-extension-modal-systems-area\">\n                        <label class=\"col-xs-offset-0 col-xs-3 control-label\">From your systems</label>\n                        <div class=\"col-xs-offset-0 col-xs-8\">\n                            <div class=\"well\" style=\"padding:0px;\">\n                                <div class=\"list-group designer-library\" id=\"designer-dialog-extension-modal-systems\">\n                                    {{systems}}\n                                </div>\n                            </div>\n                        </div>\n                    </div>\n                    <div class=\"form-group\" id=\"designer-dialog-extension-modal-extensions-area\">\n                        <label class=\"col-xs-offset-0 col-xs-3 control-label\">Select an extension</label>\n                        <div class=\"col-xs-offset-0 col-xs-8\">\n                            <div class=\"well\" style=\"padding:0px;\">\n                                <div class=\"list-group designer-library\" id=\"designer-dialog-extension-modal-extensions\">\n                                    {{extensions}}\n                                </div>\n                            </div>\n                        </div>\n                    </div>\n                </form>\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\" id=\"designer-dialog-extension-modal-cancel\">Cancel</button>\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-extension-modal-add\">Add</button>\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-extension-modal-remove\">Remove</button>\n            </div>\n        </div>\n    </div>\n</div>"},"dialog-modal-command.html":{"_id":"dialog-modal-command.html","source":"<div class=\"modal fade\" id=\"designer-dialog-command-modal\" tabindex=\"-1\" role=\"dialog\">\n    <div class=\"modal-dialog modal-lg\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-body\">\n                <form class=\"form-horizontal\" role=\"form\">\n                    <div class=\"form-group\">\n                        <div class=\"col-xs-offset-0 col-xs-12\">\n                            <div class=\"input-group\">\n                                <span class=\"input-group-addon\">Open</span>\n                                <input autocomplete=\"new-password\" type=\"text\" class=\"form-control\" placeholder=\"a schema, model, ...\" id=\"designer-dialog-input-command\">\n                            </div>\n                        </div>\n                    </div>\n                    <div class=\"form-group\" id=\"designer-dialog-command-result-area\">\n                        <div class=\"col-xs-offset-0 col-xs-12 result-command\">\n                            <div class=\"well\" style=\"padding:0px;\">\n                                <div id=\"designer-dialog-command-result\" class=\"list-group designer-command-result\"></div>\n                            </div>\n                        </div>\n                    </div>\n                </form>\n            </div>\n        </div>\n    </div>\n</div>"},"toolbar-item-command.html":{"_id":"toolbar-item-command.html","source":"<button type=\"button\" id=\"designer-toolbar-item-command\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Open a schema, model, ...\">\n  <span class=\"glyphicon glyphicon-new-window\" aria-hidden=\"true\"></span>\n</button>"},"dialog-modal-delete.html":{"_id":"dialog-modal-delete.html","source":"<div class=\"modal fade\" id=\"designer-dialog-delete-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"deleteLabel\">\n    <div class=\"modal-dialog modal-sm\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\" id=\"deleteLabel\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                {{message}}\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-default\" id=\"designer-dialog-delete-cancel\">Cancel</button>\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-delete-ok\">Delete</button>\n            </div>\n        </div>\n    </div>\n</div>"},"message-help.html":{"_id":"message-help.html","source":"<div id=\"panel-message-help\" class=\"panel panel-default panel-help\">\n  <div class=\"panel-body\">\n  {{message}}            \n  </div>\n</div>"},"menu-item-bundle.html":{"_id":"menu-item-bundle.html","source":"<a id=\"designer-menu-item-bundle\" href=\"#bundle\">Bundle</a>"},"menu-item-behavior.html":{"_id":"menu-item-behavior.html","source":"<a id=\"designer-menu-item-behavior\" href=\"#behavior\">Behavior</a>"},"toolbar-item-diagram.html":{"_id":"toolbar-item-diagram.html","source":"<button type=\"button\" id=\"designer-toolbar-item-diagram\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"View the diagram of the system\">\n  <span class=\"glyphicon glyphicon-modal-window\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-zoomout.html":{"_id":"toolbar-item-zoomout.html","source":"<button type=\"button\" id=\"designer-toolbar-item-zoomout\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Zoom out\">\n    <span class=\"glyphicon glyphicon-zoom-out\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-zoomin.html":{"_id":"toolbar-item-zoomin.html","source":"<button type=\"button\" id=\"designer-toolbar-item-zoomin\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Zoom in\">\n    <span class=\"glyphicon glyphicon-zoom-in\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-zoominit.html":{"_id":"toolbar-item-zoominit.html","source":"<button type=\"button\" id=\"designer-toolbar-item-zoominit\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Use all available space\">\n    <span class=\"glyphicon glyphicon-fullscreen\" aria-hidden=\"true\"></span>\n</button>"},"toolbar-item-export-diagram.html":{"_id":"toolbar-item-export-diagram.html","source":"<button type=\"button\" id=\"designer-toolbar-item-export-diagram\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Export the diagram to SVG\">\n  <span class=\"glyphicon glyphicon-log-out icon-rotate-left\" aria-hidden=\"true\"></span>\n</button>"},"menu-action-back.html":{"_id":"menu-action-back.html","source":"<a><span class=\"glyphicon glyphicon-menu-left\" aria-hidden=\"true\"></span></a>"},"menu-action-forward.html":{"_id":"menu-action-forward.html","source":"<a><span class=\"glyphicon glyphicon-menu-right\" aria-hidden=\"true\"></span></a>"},"dialog-modal-drop-diagram.html":{"_id":"dialog-modal-drop-diagram.html","source":"<div class=\"modal fade\" id=\"designer-dialog-drop-diagram-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\">\n    <div class=\"modal-dialog modal-sm\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\" id=\"myModalLabel\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                {{message}}\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\" id=\"designer-dialog-drop-diagram-modal-cancel\">Cancel</button>\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-drop-diagram-modal-import\">View</button>\n            </div>\n        </div>\n    </div>\n</div>"},"menu-item-class-diagram.html":{"_id":"menu-item-class-diagram.html","source":"<a id=\"designer-menu-item-class-diagram\" href=\"#class\">Class diagram</a>"},"menu-item-component-diagram.html":{"_id":"menu-item-component-diagram.html","source":"<a id=\"designer-menu-item-component-diagram\" href=\"#component\">Component diagram</a>"},"menu-item-graph-diagram.html":{"_id":"menu-item-graph-diagram.html","source":"<a id=\"designer-menu-item-graph-diagram\" href=\"#graph\">Graph diagram</a>"},"dialog-modal-install-pwa.html":{"_id":"dialog-modal-install-pwa.html","source":"<div class=\"modal fade\" id=\"designer-dialog-install-pwa-modal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"installPWALabel\">\n    <div class=\"modal-dialog modal-sm\" role=\"document\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\" id=\"installPWALabel\">{{title}}</h4>\n            </div>\n            <div class=\"modal-body\">\n                Because System Designer is a Progressive Web App (PWA), it can be installed on your device.<br>\n                <br>\n                Do you want to add System Designer to your Home Screen?\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-default\" id=\"designer-dialog-install-pwa-cancel\">Cancel</button>\n                <button type=\"button\" class=\"btn btn-primary\" id=\"designer-dialog-install-pwa-ok\">Install</button>\n            </div>\n        </div>\n    </div>\n</div>"}},"Internationalization":{"i18n":{"_id":"i18n","locale":"en-US"}},"Strings":{"en-US":{"_id":"en-US","help_systems":"An application is a system. Once you have created one, your next step is to create a schema.","help_schemas":"A schema is the definition of your model. Models are generated based on the schema definition.","help_models":"A model is an UML representation of your classes. It is generated from a schema.","help_types":"A type is used in your model to define an enumeration or a structure.","help_behaviors":"A behavior is the action to do when a method or an event is called.","help_components":"Components are your classes instances. Their states are saved in a store, a JSON object.","help_logs":"You will find here the logs of the running system.<br/><br/>Example of code to send a log:<br/><br/><i>this<br/>.require('logger')<br/>.info('hello world');</i>"}},"JS":{"app-github.js":{"_id":"app-github.js","source":"/* \n * {{name}}\n * \n * @description {{description}}\n * \n * @module {{name}}\n * @version {{version}}\n * @requires system-runtime\n * \n */\n\n// install System Runtime\nconst runtime = require('system-runtime');\n\n// set the level of log\nruntime.require('logger').level('{{logLevel}}');\n\n// install and start the system\nruntime.install({{system}});"},"app.js":{"_id":"app.js","source":"/* \n * {{name}}\n * \n * @description {{description}}\n * \n * @module {{name}}\n * @version {{version}}\n * @requires system-runtime\n * \n */\n\n// install System Runtime\nconst runtime = require('system-runtime');\n\n// uncomment this line to debug your system\n// runtime.install('node_modules/system-runtime/extensions/mode-admin-server.json');\n\n// set the level of log\nruntime.require('logger').level('{{logLevel}}');\n\n// install and start the system\nruntime.install({{system}});"},"javascript-export.js":{"_id":"javascript-export.js","source":"/* \n * {{name}}\n * \n * @description {{description}}\n * \n * @system {{name}}\n * @version {{version}}\n * @requires system-runtime\n * \n */\n\n// uncomment this line if this system runs on node.js\n// const runtime = require('system-runtime');\n\n// uncomment this line to debug your system on node.js\n// runtime.install('node_modules/system-runtime/extensions/mode-admin-server.json');\n\nruntime.require('logger').level('{{logLevel}}');\n\n"}},"JSON":{"00-quickstart":{"_id":"00-quickstart","platform":"all","source":{"name":"quick-start","master":true,"version":"1.5.0","description":"Quick start\n\nThis system is taken from the quick start.","schemas":{"154661fa5617782":{"_id":"154661fa5617782","_name":"Jedi","_inherit":["_Component"],"firstName":"property","lastName":"property","father":"link","fullName":"method"}},"models":{"1a3a2150b31c099":{"_id":"1a3a2150b31c099","_name":"Jedi","firstName":{"description":"first name of a Jedi","type":"string","readOnly":false,"mandatory":true,"default":""},"lastName":{"description":"last name of a Jedi","type":"string","readOnly":false,"mandatory":true,"default":""},"father":{"description":"father of a Jedi","type":"Jedi","readOnly":false,"mandatory":false,"default":""},"fullName":{"description":"full name of a Jedi","result":"string"}}},"behaviors":{"137491d3c61213b":{"_id":"137491d3c61213b","component":"100e51f87218a8f","state":"start","action":"function start() {\n  let luke = null,\n      logger = null;\n  \n  // get logger component\n  logger = this.require('logger');\n  \n  // get luke component\n  luke = this.require('luke');\n  \n  // get the name of the father of Luke\n  logger.info(luke.father().fullName());\n}","useCoreAPI":false,"core":false},"11a2910bbd142e1":{"_id":"11a2910bbd142e1","component":"Jedi","state":"fullName","action":"function fullName() {\n  const result = this.firstName() + ' ' + this.lastName();\n  return result;\n}","useCoreAPI":false,"core":false}},"types":{},"components":{"Jedi":{"vader":{"_id":"vader","father":"","firstName":"Darth","lastName":"Vader"},"luke":{"_id":"luke","father":"vader","firstName":"Luke","lastName":"Skywalker"}}},"_id":"100e51f87218a8f"}},"01-book-collection":{"_id":"01-book-collection","platform":"all","source":{"name":"book-collection","master":true,"version":"1.5.0","description":"Create a Book collection manager\n\nThis system shows a list of books and an input to filter on that list.\n\nnote: if you create a Book Component when running the application, the list will be automatically updated","schemas":{"z198ba11ccf1a29b":{"_id":"z198ba11ccf1a29b","_name":"Template","_inherit":["_Component"],"source":"property","render":"method"},"l1f8dd1f44d1ef53":{"_id":"l1f8dd1f44d1ef53","_name":"CSS","_inherit":["_Component"],"source":"property","render":"method"},"l1cbef1eb531773c":{"_id":"l1cbef1eb531773c","_name":"List","_inherit":["_Component"],"filter":"property","render":"method"},"j1ca8314c081d9de":{"_id":"j1ca8314c081d9de","_name":"Book","_inherit":["_Component"],"name":"property","year":"property","author":"link"},"k1d43e1430e1af90":{"_id":"k1d43e1430e1af90","_name":"Author","_inherit":["_Component"],"firstName":"property","lastName":"property","fullName":"method"}},"models":{"o19b04191b513cf7":{"_id":"o19b04191b513cf7","_name":"Template","source":{"description":"html of the template","type":"html","readOnly":false,"mandatory":false,"default":""},"render":{"description":"render the template","params":[{"name":"elt","type":"DOMElement","mandatory":false,"default":null}]}},"z128c91df861dc34":{"_id":"z128c91df861dc34","_name":"CSS","source":{"description":"css of the component","type":"css","readOnly":false,"mandatory":false,"default":""},"render":{"description":"render the component"}},"p1b9fa10ca51e9d4":{"_id":"p1b9fa10ca51e9d4","_name":"List","render":{"description":"render the list"},"filter":{"description":"filter on the list","type":"string","readOnly":false,"mandatory":false,"default":"{}"}},"o18b681c27f196a6":{"_id":"o18b681c27f196a6","_name":"Book","_description":"","name":{"description":"name of a book","type":"string","readOnly":false,"mandatory":false,"default":""},"year":{"description":"year when the book was written","type":"number","readOnly":false,"mandatory":false,"default":0},"author":{"description":"author of the book","type":"Author","readOnly":false,"mandatory":false,"default":""}},"z174c61a72c16e21":{"_id":"z174c61a72c16e21","_name":"Author","_description":"","firstName":{"description":"first name of an author","type":"string","readOnly":false,"mandatory":false,"default":""},"lastName":{"description":"last name of an author","type":"string","readOnly":false,"mandatory":false,"default":""},"fullName":{"description":"full name of an author","params":[],"result":"string"}}},"behaviors":{"r1e7a2121b21dd77":{"_id":"r1e7a2121b21dd77","component":"k119f317c9d181db","state":"start","action":"function start() { \n  // add HTML\n  this.require('template').render();\n  \n  // add CSS\n  this.require('list.css').render();\n  \n  // init the filter\n  this.require('list').filter('');\n  \n  // show the list\n  this.require('list').render();\n  \n  // add listener\n  document.getElementById('search').addEventListener('keyup', function keyup(e) {\n    this.require('list').filter(e.target.value.trim());\n  }.bind(this));\n}","useCoreAPI":false,"core":false},"n1ab81101b41b375":{"_id":"n1ab81101b41b375","component":"Template","state":"render","action":"function render(elt) { \n  let html = this.source(),\n      domNode = elt;\n  \n  if (html) {\n    if (domNode === null) {\n      domNode = document.body;\n    }\n    \n    domNode.insertAdjacentHTML('beforeend', html);\n  }\n}","useCoreAPI":false,"core":false},"g1725a1c65e1d149":{"_id":"g1725a1c65e1d149","component":"CSS","state":"render","action":"function render() { \n  let div = document.createElement('style');\n  div.innerHTML = this.source();\n  document.head.appendChild(div);\n}","useCoreAPI":false,"core":false},"k1d4551afd717da8":{"_id":"k1d4551afd717da8","component":"List","state":"render","action":"function render() { \n  let items = [],\n      properties = {},\n      links = {},\n      html = '',\n      criteria = null,\n      table = document.getElementById('table');\n  \n  if (table) {\n  \n    // get data\n    if (this.filter().trim() !== '') {\n      criteria = new RegExp(this.filter().trim(), 'gi');\n      items = this.require('db').collections().Book.find({\n        name: criteria\n      });\n    } else {\n      items = this.require('db').collections().Book.find();\n    }\n    \n    properties = ['name', 'year'];\n    links = ['author'];\n    \n    html = '<tr>';\n    // build table header\n    properties.forEach(function(property) {\n      html = html + '<th scope=\"col\">' + property.toUpperCase() +'</th>'; \n    });\n    links.forEach(function (link) {\n      html = html + '<th scope=\"col\">' + link.toUpperCase() +'</th>'; \n    });\n    html = html + '<tr>';\n    \n    // build table body\n    items.forEach(function (item){\n      html = html + '<tr>';\n      \n      properties.forEach(function(property) {\n        html = html + '<td>' + item[property] + '</td>';\n      });\n      \n      links.forEach(function (link) {\n        const author = this.require(item[link]);\n        \n        if (author) {\n          html = html + '<td>' + author.fullName() + '</td>';\n        } else {\n          html = html + '<td></td>';\n        }\n      }.bind(this));\n      \n      html = html + '</tr>';\n    }.bind(this));\n    \n    html = html + '</table>';\n    \n    table.innerHTML = html;\n  }\n}","useCoreAPI":false,"core":false},"w1d4ac1c9821d391":{"_id":"w1d4ac1c9821d391","component":"List","state":"filter","action":"function filter(value) { \n\tthis.render();\n}","useCoreAPI":false,"core":false},"a1a55019f6a116d1":{"_id":"a1a55019f6a116d1","component":"Book","state":"init","action":"function init(conf) { \n  this.require('list').render();\t\n}","useCoreAPI":false,"core":false},"s106991b9f112c56":{"_id":"s106991b9f112c56","component":"Book","state":"destroy","action":"function destroy() { \n  this.require('list').render();\n\n  // destroy the component\n  $component.destroy(this.id());\n}","useCoreAPI":true,"core":false},"o1d3ca175e51c17b":{"_id":"o1d3ca175e51c17b","component":"Author","state":"fullName","action":"function fullName() { \n  let result = this.firstName() + ' ' + this.lastName();\n  return result;\n}","useCoreAPI":false,"core":false}},"types":{"DOMElement":{"_id":"m14b771764815eca","name":"DOMElement","type":"object"}},"components":{"CSS":{"list.css":{"_id":"list.css","source":"body {\n  padding-top: 50px;\n  font-family: \"Helvetica Neue\",Helvetica,Arial,sans-serif;\n}\n\n.input-group {\n  padding-bottom:20px;\n}\n\ntable {\n  font-family: arial, sans-serif;\n  border-collapse: collapse;\n  width: 100%;\n}\n\ntd, th {\n  border: 1px solid #dddddd;\n  text-align: left;\n  padding: 8px;\n}\n\nth {\n  background-color: #e7e7e7;\n}"}},"Template":{"template":{"_id":"template","source":"<div class=\"input-group\">\n  <input id=\"search\" type=\"text\" class=\"form-control\" placeholder=\"search for a book name\">\n</div>\n\n<table id=\"table\"></table>"}},"List":{"list":{"_id":"list","filter":""}},"Book":{"n193a61759c1003b":{"_id":"n193a61759c1003b","author":"p183d91088f12f6a","name":"The Three Musketeers","year":1844},"v1ff7018f18166da":{"_id":"v1ff7018f18166da","author":"a1654216c6c11216","name":"Twenty Thousand Leagues Under the Sea","year":1870},"g138f61067815e83":{"_id":"g138f61067815e83","author":"r1ee7f1534e19b8b","name":"The Little Prince","year":1943}},"Author":{"r1ee7f1534e19b8b":{"_id":"r1ee7f1534e19b8b","firstName":"Antoine","lastName":"De Saint-Exupéry"},"a1654216c6c11216":{"_id":"a1654216c6c11216","firstName":"Jules","lastName":"Verne"},"p183d91088f12f6a":{"_id":"p183d91088f12f6a","firstName":"Alexandre","lastName":"Dumas"}}},"_id":"k119f317c9d181db"}},"02-nodejs":{"_id":"02-nodejs","platform":"electron","source":{"name":"nodejs","master":true,"version":"1.5.0","description":"Create a server application\n\nThis example shows you how to create a Node.js application in System Designer.\n\nYou can the test the application directly in System Designer.","schemas":{},"models":{},"behaviors":{"17d001e5ae12a44":{"_id":"17d001e5ae12a44","component":"1638e12721115b5","state":"start","action":"function start() { \n  const http = require('http'),\n      logger = this.require('logger');\n\n  http.createServer(function (req, res) {\n    res.writeHead(200);\n    res.end('hello world\\n');\n  }).listen(1234);\n  \n  logger.info('server is running at http://127.0.0.1:1234');\n}","useCoreAPI":false,"core":false}},"types":{},"components":{},"_id":"1638e12721115b5"}},"03-graph-system-example":{"_id":"03-graph-system-example","platform":"all","source":{"name":"graph-example","master":true,"version":"1.0.0","description":"Graph system example. \n\n\nnote: see the tutorials for more informations.","schemas":{"q1fb6e179641acb7":{"_id":"q1fb6e179641acb7","_name":"Nodes","_inherit":["_Component"]},"q1a868198e31bce7":{"_id":"q1a868198e31bce7","_name":"Relationships","_inherit":["_Component"],"incoming":"link","outgoing":"link"},"n1a88c10eff1beb6":{"_id":"n1a88c10eff1beb6","_name":"Person","_inherit":["Nodes"],"name":"property","age":"property"},"z1747d12e621e92f":{"_id":"z1747d12e621e92f","_name":"IS_FRIEND_WITH","_inherit":["Relationships"],"since":"property"},"i15a3614c1e17109":{"_id":"i15a3614c1e17109","_name":"HAS_READ","_inherit":["Relationships"],"date":"property","rated":"property"},"i1d8501332c1c6bd":{"_id":"i1d8501332c1c6bd","_name":"Book","_inherit":["Nodes"],"title":"property","author":"property"}},"models":{"e143b513b801a48c":{"_id":"e143b513b801a48c","_name":"Nodes","_description":""},"l1bf6210e8510013":{"_id":"l1bf6210e8510013","_name":"Relationships","_description":"","incoming":{"description":"","type":"Nodes","kind":"normal","readOnly":false,"mandatory":false,"default":""},"outgoing":{"description":"","type":"Nodes","kind":"normal","readOnly":false,"mandatory":false,"default":""}},"m11c1515b7e12099":{"_id":"m11c1515b7e12099","_name":"Person","_description":"","name":{"description":"","type":"string","readOnly":false,"mandatory":false,"default":""},"age":{"description":"","type":"number","readOnly":false,"mandatory":false,"default":0}},"g19e531c5c819149":{"_id":"g19e531c5c819149","_name":"IS_FRIEND_WITH","_description":"","since":{"description":"","type":"date","readOnly":false,"mandatory":false,"default":"1970-01-01T00:00:00.000Z"},"incoming":{"description":"","type":"Person","kind":"normal","readOnly":false,"mandatory":false,"default":""},"outgoing":{"description":"","type":"Person","kind":"normal","readOnly":false,"mandatory":false,"default":""}},"d11f871f899154fd":{"_id":"d11f871f899154fd","_name":"HAS_READ","_description":"","date":{"description":"","type":"date","readOnly":false,"mandatory":false,"default":"1970-01-01T00:00:00.000Z"},"rated":{"description":"","type":"number","readOnly":false,"mandatory":false,"default":0},"incoming":{"description":"","type":"Person","kind":"normal","readOnly":false,"mandatory":false,"default":""},"outgoing":{"description":"","type":"Book","kind":"normal","readOnly":false,"mandatory":false,"default":""}},"y12eff155c715742":{"_id":"y12eff155c715742","_name":"Book","_description":"","title":{"description":"","type":"string","readOnly":false,"mandatory":false,"default":""},"author":{"description":"","type":"string","readOnly":false,"mandatory":false,"default":""}}},"behaviors":{"k191b51f33413bc3":{"_id":"k191b51f33413bc3","component":"c14393197831b99d","state":"start","action":"function start() { \n  // show the number of person that have read the book GraphDatabase\n  this.require('logger').info(\n    this.require('db').collections().HAS_READ.find({\n      'outgoing': {\n        '$eq': 'GraphDatabase'\n      }\n    }).length\n  );\n}","useCoreAPI":false,"core":false}},"types":{},"components":{"Person":{"sally":{"_id":"sally","age":32,"name":"Sally"},"john":{"_id":"john","age":27,"name":"John"}},"IS_FRIEND_WITH":{"i1c36e1b6331b0f6":{"_id":"i1c36e1b6331b0f6","incoming":"john","outgoing":"sally","since":"2013-01-09T00:00:00.000Z"}},"HAS_READ":{"k132a8124351e768":{"_id":"k132a8124351e768","date":"2013-02-03T00:00:00.000Z","incoming":"john","outgoing":"GraphDatabase","rated":5},"s146f0142a518868":{"_id":"s146f0142a518868","date":"2013-09-02T00:00:00.000Z","incoming":"sally","outgoing":"GraphDatabase","rated":4}},"Book":{"GraphDatabase":{"_id":"GraphDatabase","author":"Jim Webber, Ian Robinson","title":"Graph Database"}}},"_id":"c14393197831b99d"}},"04-create-graph-system":{"_id":"04-create-graph-system","platform":"all","source":{"name":"graph-system","master":true,"version":"1.1.0","description":"Create a Graph system.\n\nCreate a Graph system with models that inherit from Nodes and Relationships models.\n\n\nnote: see the tutorials for more informations.","schemas":{"q1fb6e179641acb7":{"_id":"q1fb6e179641acb7","_name":"Nodes","_inherit":["_Component"]},"q1a868198e31bce7":{"_id":"q1a868198e31bce7","_name":"Relationships","_inherit":["_Component"],"incoming":"link","outgoing":"link"}},"models":{"e143b513b801a48c":{"_id":"e143b513b801a48c","_name":"Nodes","_description":""},"l1bf6210e8510013":{"_id":"l1bf6210e8510013","_name":"Relationships","_description":"","incoming":{"description":"Nodes component that starts the relationship","type":"Nodes","kind":"normal","readOnly":false,"mandatory":false,"default":""},"outgoing":{"description":"Nodes component that ends the relationship","type":"Nodes","kind":"normal","readOnly":false,"mandatory":false,"default":""}}},"behaviors":{"k191b51f33413bc3":{"_id":"k191b51f33413bc3","component":"c14393197831b88d","state":"start","action":"function start() { \n  \n}","useCoreAPI":false,"core":false}},"types":{},"components":{},"_id":"c14393197831b88d"}},"06-create-extension.json":{"_id":"06-create-extension.json","platform":"all","source":{"name":"extension-template","master":false,"version":"1.5.0","description":"Create an extension\n\nExtension for creating:\n\n* toolbar items,\n* actions when clicking on them and\n* show modal dialog.\n\n\nnote: see the tutorials for more informations.","schemas":{"p181111d5c01f97b":{"_id":"p181111d5c01f97b","_inherit":["_Component"],"_name":"HTML","render":"method","source":"property"},"t19b6b11ff31158d":{"_id":"t19b6b11ff31158d","_name":"ToolBarItem","_inherit":["_Component"],"html":"link","position":"property","type":"property","platform":"property","render":"method","click":"event"},"l1cbdc1fc4612ece":{"_id":"l1cbdc1fc4612ece","_name":"Modal","_inherit":["_Component"],"title":"property","message":"property","html":"link","ok":"event","cancel":"event","show":"method","hide":"method","render":"method"}},"models":{"w1417e1d6d613a0d":{"_id":"w1417e1d6d613a0d","_name":"HTML","source":{"description":"HTML of the component","type":"html","readOnly":true,"mandatory":true,"default":""},"render":{"description":"render the component","params":[{"name":"id","type":"any","mandatory":false,"default":null}]}},"u1f4c7177bb1a459":{"_id":"u1f4c7177bb1a459","_name":"ToolBarItem","html":{"description":"HTML the toolbar item","type":"HTML","readOnly":false,"mandatory":false,"default":"toolbar-item-template.html"},"position":{"description":"position of the toolbar item in the toolbar","type":"number","readOnly":false,"mandatory":false,"default":70},"type":{"description":"on which context to display the toolbar item","type":"editorType","readOnly":false,"mandatory":false,"default":"designer"},"render":{"description":"render the toolbar item"},"click":{"description":"click on the toolbar item"},"platform":{"description":"on which platform to display the toolbar item","type":"platform","readOnly":false,"mandatory":false,"default":"all"}},"q1d12b19f4712a7a":{"_id":"q1d12b19f4712a7a","_name":"Modal","title":{"description":"title of the modal","type":"text","readOnly":true,"mandatory":false,"default":""},"message":{"description":"message to display","type":"text","readOnly":true,"mandatory":false,"default":""},"html":{"description":"HTML of the modal","type":"HTML","readOnly":false,"mandatory":false,"default":"modal-template.html"},"show":{"description":"show the modal"},"hide":{"description":"hide the modal"},"cancel":{"description":"click on the 'Cancel' button of the modal"},"ok":{"description":"click on the 'OK' button of the modal"},"render":{"description":"render the modal"}}},"behaviors":{"g10c63191dc16341":{"_id":"g10c63191dc16341","component":"toolbar-item-template","state":"click","action":"function click() { \n  $('#designer-toolbar-item-template').tooltip('hide');\n  this.require('modal-template').render();\t\n}","useCoreAPI":false,"core":false},"d1bdde1f59f1befe":{"_id":"d1bdde1f59f1befe","component":"Modal","state":"show","action":"function show() { \n  const id = this.html().id().replace('.html', '');\n  $('#' + id).modal('show');\n}","useCoreAPI":false,"core":false},"n1467b1097a16481":{"_id":"n1467b1097a16481","component":"Modal","state":"hide","action":"function hide() { \n  const id = this.html().id().replace('.html', '');\n  $('#' + id).modal('hide');\n}","useCoreAPI":false,"core":false},"t1fb0b150c810528":{"_id":"t1fb0b150c810528","component":"Modal","state":"render","action":"function render() { \n  let html = '',\n      dom = null,\n      templateId = this.html().id(),\n      id = templateId.replace('.html', '');\n\n  // empty area\n  $('#designer-dialog').empty();\n\n  // render\n  html = this.html();\n  document.querySelector('#designer-dialog').insertAdjacentHTML('afterbegin',\n    html.source()\n      .replace(/{{title}}/gi, this.title())\n      .replace(/{{message}}/gi, this.message())\n  );\n\n  // modal events\n  dom = document.getElementById(id + '-cancel');\n  dom.addEventListener('click', function click(event) {\n    this.cancel();\n  }.bind(this));\n  \n  dom = document.getElementById(id + '-ok');\n  dom.addEventListener('click', function click(event) {\n    this.ok();\n  }.bind(this));\t\t\n  \n  // show modal\n  $('#' + id).modal('show');\t\n}","useCoreAPI":false,"core":false},"w1cffe198cb19e9c":{"_id":"w1cffe198cb19e9c","component":"modal-template","state":"cancel","action":"function cancel() { \n  this.hide();\t\n}","useCoreAPI":false,"core":false},"c1bee91492f11173":{"_id":"c1bee91492f11173","component":"modal-template","state":"ok","action":"function ok() { \n  this.hide();\t\n}","useCoreAPI":false,"core":false}},"types":{"editorType":{"name":"editorType","type":"string","value":["designer","system","type","schema","model","behavior","component"]},"platform":{"_id":"r10214160211309c","name":"platform","type":"string","value":["all","web","electron","cordova"]}},"components":{"ToolBarItem":{"toolbar-item-template":{"_id":"toolbar-item-template","html":"toolbar-item-template.html","platform":"all","position":70,"type":"designer"}},"HTML":{"toolbar-item-template.html":{"_id":"toolbar-item-template.html","source":"<button type=\"button\" id=\"designer-toolbar-item-template\" class=\"btn btn-default btn-lg\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Template\">\n  <span class=\"glyphicon glyphicon-star\" aria-hidden=\"true\"></span>\n</button>"},"modal-template.html":{"_id":"modal-template.html","source":"<div class=\"modal fade\" id=\"modal-template\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"modalLabel\">\n  <div class=\"modal-dialog modal-lg\" role=\"document\">\n    <div class=\"modal-content\">\n      <div class=\"modal-header\">\n        <h4 class=\"modal-title\" id=\"modalLabel\">{{title}}</h4>\n      </div>\n      <div class=\"modal-body\">\n        {{message}}\n      </div>\n      <div class=\"modal-footer\">\n        <button type=\"button\" class=\"btn btn-default\" id=\"modal-template-cancel\">Cancel</button>\n        <button type=\"button\" class=\"btn btn-primary\" id=\"modal-template-ok\">OK</button>\n      </div>\n    </div>\n  </div>\n</div>"}},"Modal":{"modal-template":{"_id":"modal-template","message":"This is a template of a modal dialog.","title":"An example of modal dialog","html":"modal-template.html"}}},"_id":"h1ffb312ef619349"}},"07-listen-collection-events.json":{"_id":"07-listen-collection-events.json","source":{"name":"listen-collection-events","master":true,"version":"1.5.0","description":"Listen to components collection events\n\nSystem Runtime NoSQL Database is an instance of '_Database' class that sends insert, update and remove events for each collection of the database.\n\nYou can listen to all these events to perform the action you want.\n\nnote: events are send for the collections (i.e. schemas) you have created but also for the private collections of the database.\n\n\nnote: see the tutorials for more informations.","schemas":{"1723516a30132ac":{"_id":"1723516a30132ac","_name":"_Database","_inherit":["_Component"],"_core":true,"insert":"event","update":"event","remove":"event"}},"models":{"13b4415f6511c15":{"_id":"13b4415f6511c15","_name":"_Database","_core":true,"insert":{"description":"event send when a document is inserted in a collection","params":[{"name":"event","type":"dbInsertEvent"}]},"update":{"description":"event send when a document is updated in a collection","params":[{"name":"event","type":"dbUpdateEvent"}]},"remove":{"description":"event send when a document is removed from a collection","params":[{"name":"event","type":"dbRemoveEvent"}]}}},"behaviors":{"1de8c154bb18a01":{"_id":"1de8c154bb18a01","component":"_Database","state":"insert","action":"function insert(event) { \n  // always filter on the schema you want\n  if (event.collection === '') {\n    \n  }\t\t\n}","useCoreAPI":false,"core":false},"173ff13cde1c29e":{"_id":"173ff13cde1c29e","component":"_Database","state":"remove","action":"function remove(event) { \n  // always filter on the schema you want\n  if (event.collection === '') {\n    \n  }\t\n}","useCoreAPI":false,"core":false},"1e0a71b78c1fd0e":{"_id":"1e0a71b78c1fd0e","component":"_Database","state":"update","action":"function update(event) { \n  // always filter on the schema you want\n  if (event.collection === '') {\n    \n  }\t\n}","useCoreAPI":false,"core":false}},"types":{"dbUpdateEvent":{"_id":"1f5c41309711752","name":"dbUpdateEvent","type":"object","schema":{"collection":{"description":"id of the collection where a document has been updated","type":"string","mandatory":true,"default":""},"id":{"description":"id of the document that has been updated","type":"string","mandatory":true,"default":""},"field":{"description":"field of the document that has been updated","type":"string","mandatory":true,"default":""},"value":{"description":"value of the field of the document that has been updated","type":"any","mandatory":true,"default":null}}},"dbRemoveEvent":{"_id":"1952e1ac4213f4a","name":"dbRemoveEvent","type":"object","schema":{"collection":{"description":"id of the collection where a document has been removed","type":"string","mandatory":true,"default":""},"id":{"description":"id of the document that has been removed","type":"string","mandatory":true,"default":""}}},"dbInsertEvent":{"_id":"148ef1e19810e6d","name":"dbInsertEvent","type":"object","schema":{"collection":{"description":"id of the collection where a document has been inserted","type":"string","mandatory":true,"default":""},"document":{"description":"document that has been inserted","type":"object","mandatory":true,"default":{}}}}},"components":{},"_id":"1d4431844018720"},"platform":"all"},"05-send-messages.json":{"_id":"05-send-messages.json","source":{"name":"send-messages","master":true,"version":"1.5.0","description":"Send messages through a channel\n\n\nYou can send messages into the current system or from one system to another system with channels. To do that:\n\n1. Define an event in '_Channel' schema and model.\n2. To listen to the message, just add a behavior to the event.\n3. To send a message: this.require('channel').myevent(param1, param2, ...).\n\n\nnote: see the tutorials for more informations.","schemas":{"104ad1f48518376":{"_id":"104ad1f48518376","_name":"_Channel","_inherit":["_Component"],"send":"event"}},"models":{"135c71078810af2":{"_id":"135c71078810af2","_name":"_Channel","send":{"description":"send a message","params":[{"name":"message","type":"message"}]}}},"behaviors":{"1ae8e11ece1a658":{"_id":"1ae8e11ece1a658","component":"_Channel","state":"send","action":"function send(message) { \n\n}","useCoreAPI":false,"core":false}},"types":{"message":{"name":"message","type":"object","schema":{"event":{"description":"name of the event","type":"string","mandatory":true},"from":{"description":"id of the system","type":"string","mandatory":false},"data":{"description":"arguments send to the event","type":"array","mandatory":true}},"core":true}},"components":{"_Channel":{"channel":{"_id":"channel"}}},"_id":"12eaf148b211195"},"platform":"all"}},"Language":{"language":{"_id":"language","target":"javascript"}},"MenuAction":{"1f8571164c179bj":{"_id":"1f8571164c179bj","html":"menu-action-version.html","position":10,"type":"component"}},"MenuHeader":{"1fb101b99813a18":{"_id":"1fb101b99813a18","html":"menu-header-component.html","type":"component"}},"MenuItem":{"1f1781882618113":{"_id":"1f1781882618113","name":"runtimeComponent","html":"menu-item-component.html","position":200,"type":"component","platform":"all"}},"MenuBar":{"menubar":{"_id":"menubar","actions":[],"header":"","items":[],"logo":""}},"Message":{"message":{"_id":"message"}},"Router":{"router":{"_id":"router"}},"Spaces":{"spaces":{"_id":"spaces","components":[],"items":[],"systems":[]}},"State":{"state":{"_id":"state","component":"","lastPage":"index.html","logs":[],"menu":"","messages":[],"navigation":{"menu":[],"spaces":[]},"previousMenu":"","space":"","type":"designer"}},"Store":{"store":{"_id":"store","collection":"","data":{},"extra":{},"uuid":""}},"SystemFactory":{"factory":{"_id":"factory","system":""}},"ToolBar":{"toolbar":{"_id":"toolbar","items":[]}},"Workspace":{"workspace":{"_id":"workspace"}},"MessageHelp":{"message-help":{"_id":"message-help"}},"_Storage":{"storage":{"_id":"storage","_core":true}},"ToolBarItem":{"wdbc51200e11z03":{"_id":"wdbc51200e11z03","html":"toolbar-item-copy.html","position":50,"type":"component","platform":"electron"},"wdbc51200e11z04":{"_id":"wdbc51200e11z04","html":"toolbar-item-paste.html","position":60,"type":"component","platform":"electron"},"1dbc51200e11613":{"_id":"1dbc51200e11613","html":"toolbar-item-save.html","position":10,"type":"component","platform":"all"},"1dbc51200e11614":{"_id":"1dbc51200e11614","html":"toolbar-item-copyright.html","position":90,"type":"component","platform":"all"},"1dbc51200e11617":{"_id":"1dbc51200e11617","html":"toolbar-item-help.html","position":80,"type":"component","platform":"all"},"wdbc51200e11z00":{"_id":"wdbc51200e11z00","html":"toolbar-item-undo.html","position":20,"type":"component","platform":"all"},"wdbc51200e11z01":{"_id":"wdbc51200e11z01","html":"toolbar-item-redo.html","position":30,"type":"component","platform":"all"},"wdbc51200e11z02":{"_id":"wdbc51200e11z02","html":"toolbar-item-select-all.html","position":40,"type":"component","platform":"electron"},"r185da17faa18ba1":{"_id":"r185da17faa18ba1","html":"toolbar-item-command.html","platform":"web","position":75,"type":"component"},"z125f2124301bac8":{"_id":"z125f2124301bac8","html":"toolbar-item-command.html","platform":"electron","position":75,"type":"component"}}},"_id":"x1f67a1a3311b2f4"});