UNPKG

@smartface/smartface.ui-editor

Version:
542 lines (415 loc) 2.71 MB
define("plugins/smartface.ui-editor/package.smartface.ui-editor", [],{"c9":{"plugins":[{"packagePath":"plugins/@smartface/smartface.ui-editor/designer/designer"},{"packagePath":"plugins/@smartface/smartface.ui-editor/engine/engine"},{"packagePath":"plugins/@smartface/smartface.ui-editor/explorer/explorer"},{"packagePath":"plugins/@smartface/smartface.ui-editor/properties/properties"},{"packagePath":"plugins/@smartface/smartface.ui-editor/toolbox/toolbox"},{"packagePath":"plugins/@smartface/smartface.ui-editor/ui-eidtor-panel/ui-eidtor-panel"},{"packagePath":"plugins/@smartface/smartface.ui-editor/journey/journey"},{"packagePath":"plugins/@smartface/smartface.ui-editor/engine/history/history"},{"packagePath":"plugins/@smartface/smartface.ui-editor/themes/themes"},{"packagePath":"plugins/@smartface/smartface.ui-editor/settings/settings"},{"packagePath":"plugins/@smartface/smartface.ui-editor/template-explorer/template-explorer"},{"packagePath":"plugins/@smartface/smartface.ui-editor/updater/updater"},{"packagePath":"plugins/@smartface/smartface.ui-editor/log/log"},{"packagePath":"plugins/@smartface/smartface.ui-editor/initializer/initializer"},{"packagePath":"plugins/@smartface/smartface.ui-editor/engine/newfile"},{"packagePath":"plugins/@smartface/smartface.ui-editor/engine/problem"},{"packagePath":"plugins/@smartface/smartface.ui-editor/ace/ace"}]}}); !function(){function getInlineDeps(fn){var deps=[] return fn.length&&(fn.toString().replace(commentRegExp,"").replace(cjsRequireRegExp,function(match,dep,index,str){ for(var i=index;str.charCodeAt(i-=1)<=32;);"."!==str.charAt(i)&&deps.push(dep)}),deps=["require","exports","module"].concat(deps)), deps}function undefOne(module,path){delete define.errors[module],delete define.loaded[module],delete define.modules[module], delete define.loading[module],delete define.fetchedUrls[path]}function undefAll(module,hash){Object.keys(hash).forEach(function(key){ var i=key.indexOf("!")+1 if(0==key.lastIndexOf(module,0)&&undefOne(key,require.toUrl(key,".js")),i){var plugin=key.slice(0,i-1),resource=key.slice(i) 0!=resource.lastIndexOf(module,0)&&0!=plugin.lastIndexOf(module,0)||(undefOne(key,require.toUrl(key,"")), undefOne(resource,require.toUrl(resource,"")))}})}function hashCode(string){var i,chr,len,result=0 if(0==string.length)return result for(i=0,len=string.length;len>i;i++)chr=string.charCodeAt(i),result=(result<<5)-result+chr,result|=0 return result}function loadText(path,cb){var xhr=new window.XMLHttpRequest xhr.open("GET",path,!0),xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"), xhr.onload=function(e){return xhr.status>399&&xhr.status<600?cb(xhr):void cb(null,xhr.responseText,xhr) },xhr.onabort=xhr.onerror=function(e){cb(e)},xhr.send("")}function checkCache(){var baseUrl return ideCachePromiss=config.useCache&&window.caches.open("ide")["catch"](function(e){console.error(e), config.useCache=ideCachePromiss=ideCache=null}).then(function(ideCache_){return ideCache=ideCache_,ideCache?ideCache.keys():[] }).then(function(keys){baseUrl=config.baseUrl,"/"==baseUrl[0]&&(baseUrl=host+baseUrl) var val=keys.map(function(r){var url=r.url if(url.startsWith(baseUrl))url=url.slice(baseUrl.length) else if(/^\w+:/.test(url))return"" return r.headers.get("etag")+" "+url}).join("\n")+"\n" return val.length<=1?(ideCachePromiss=null,ideCache):new Promise(function(resolve){var checked=0,buffer="",toDelete=[] post(baseUrl+"__check__",val,function(t){var e=t.slice(checked) checked=t.length var parts=(buffer+e).split("\n") buffer=parts.pop() for(var i=0;i<parts.length;i++)if(parts[i]){var del=ideCache["delete"](baseUrl+parts[i]) toDelete.push(del),require.config.transform&&(del=ideCache["delete"](baseUrl+("~/"+require.config.transform)+parts[i]), toDelete.push(del))}},function(e,t){ideCachePromiss=null,Promise.all(toDelete).then(function(){resolve(ideCache) }),setTimeout(function(){setTimeout(function(){config.useCache=!1},5e3)},5e3)})})})}function post(path,val,progress,cb){ var xhr=new window.XMLHttpRequest xhr.open("POST",path,!0),xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"), xhr.onload=function(e){return xhr.status>399&&xhr.status<600?cb(xhr):void cb(null,xhr.responseText,xhr) },xhr.onreadystatechange=function(e){progress(xhr.responseText,xhr)},xhr.onabort=xhr.onerror=function(e){ cb(e)},xhr.send(val)}function definePlugin(plugin,p){require[plugin]=function(moduleName,processLoadQueue){ p.load(moduleName,require,function(value){define(plugin+moduleName,[],function(){return value}),processLoadQueue() })}}var MODULE_LOAD_URL="/standalone/modules",global=function(){return this}() global||"undefined"==typeof window||(global=window) var nextModule,commentRegExp=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm,cjsRequireRegExp=/require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,define=function(name,deps,callback){ return"string"!=typeof name&&(callback=deps,deps=name,name=null),deps&&!Array.isArray(deps)&&(callback=deps, deps=null),nextModule&&(name&&name!=nextModule.name||(name=nextModule.name,deps=deps||nextModule.deps, nextModule=null)),name?void(define.loaded[name]||(deps||"function"!=typeof callback||(deps=getInlineDeps(callback)), define.loaded[name]={id:name,deps:normalizeNames(name,deps||[]),factory:callback,exports:{},packaged:!0 },define.loading[name]&&delete define.loading[name],define.lastModule?define.pending.push(name):define.lastModule=name)):defQueue.push([deps,callback]) },defQueue=[],addToLoadQueue=function(missing,deps,callback,errback){var toLoad=missing.length,map={} define.queue.push({deps:deps,map:map,toLoad:toLoad,callback:callback,errback:errback}) for(var i=0;i<missing.length;++i){var p=missing[i] map[p]=1,define.loading[p]||(require.load(p),define.loading[p]=1)}},processLoadQueue=function(err,id){ var changed=!1 if(err?(id||(id=err.id),define.errors[id]=err,define.queue.forEach(function(r){r.map[id]&&(r.toLoad=-1, r.errback&&r.errback(err))}),define.lastModule==id&&(define.lastModule=null),define.pending=define.pending.filter(function(p){ return p!=id}),changed=!0):!id||defQueue.length||define.loaded[id]||(defQueue=[config.shim&&config.shim[id]||[[],null]]), defQueue.length){if(defQueue.length>1)throw new Error("more than one module in defqueue") define(id,defQueue[0][0],defQueue[0][1]),defQueue.length=0}var pending=define.pending define.queue.forEach(function(r){pending.forEach(function(id){r.map[id]&&r.toLoad--}),r.map[define.lastModule]&&r.toLoad--, r.toLoad||(changed=!0,_require("",r.deps,r.callback,r.errback))}),define.lastModule=null,pending.length&&(define.pending=[]), changed&&(define.queue=define.queue.filter(function(r){return r.toLoad>0}))} define.amd={},define.queue=[],define.loaded={},define.errors={},define.loading={},define.pending=[],define.modules={ require:1,exports:1,module:1},define.fetchedUrls={} var activateModule=function(name){var module=define.loaded[name],exports=module.exports if("function"!=typeof module.factory)exports=module.factory else{var req=function(path,callback){return _require(name,path,callback)} req.toUrl=function(namePlusExt,_1,_2,skipBalancers){return require.toUrl(normalizeName(name,namePlusExt),null,null,skipBalancers) },req.config=require.config var missing=checkMissing(module.deps) if(missing.length)return missing module.define=define var specialModules={require:req,exports:exports,module:module} define.modules[name]=exports var args=module.deps.slice(0,module.factory.length),returnValue=args.length?module.factory.apply(module,args.map(function(name){ return specialModules[name]||lookup(name)})):module.factory(req,exports,module) exports=void 0==returnValue?module.exports:returnValue}delete define.loaded[name],define.modules[name]=exports },checkMissing=function(deps,seen,missing){missing=missing||{},seen=seen||{} for(var i=0;i<deps.length;++i){var depName=deps[i] if(!define.modules[depName]){var dep=define.loaded[depName] dep?missing[depName]||seen[depName]||(seen[depName]=1,checkMissing(dep.deps,seen,missing)):missing[depName]=1 }}return Object.keys(missing)},lookup=function(moduleName){var mod=define.modules[moduleName] return void 0===mod&&define.loaded[moduleName]&&(activateModule(moduleName),mod=define.modules[moduleName]), mod},_require=function(parentId,moduleName,callback,errback){if("string"==typeof moduleName){var depName=normalizeName(parentId,moduleName),module=lookup(depName) if(void 0!==module)return"function"==typeof callback&&callback(module),module if("undefined"!=typeof importScripts)return addToLoadQueue([depName],[depName]),lookup(depName)}else if(Array.isArray(moduleName)){ var deps=normalizeNames(parentId,moduleName),missing=checkMissing(deps) if(missing.length)return addToLoadQueue(missing,deps,callback,errback) var args=deps.map(lookup) return callback&&callback.apply(null,args)}},normalizeName=function(parentId,moduleName){if(-1!==moduleName.indexOf("!")){ var chunks=moduleName.split("!") return normalizeName(parentId,chunks[0])+"!"+normalizeName(parentId,chunks[1])}if("."==moduleName.charAt(0)){ var base=parentId.split("/").slice(0,-1).join("/") for(moduleName=(base||parentId)+"/"+moduleName;-1!==moduleName.indexOf(".")&&previous!=moduleName;){var previous=moduleName moduleName=moduleName.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return moduleName},normalizeNames=function(parentId,moduleNames){ return"plugins/@smartface/smartface.language/smartface-def/smartface"===parentId?[]:moduleNames.map(function(name){ return normalizeName(parentId,name)})},require=function(module,callback,errback){return _require("",module,callback,errback) },config=require.config=function(cfg){cfg.baseUrl&&(config.baseUrl=cfg.baseUrl.replace(/\/*$/,"/")),cfg.host&&(host=cfg.host), Array.isArray(cfg.packages)?cfg.packages.forEach(function(pkg){"string"==typeof pkg&&(pkg={name:pkg}), config.packages[pkg.name]={name:pkg.name,location:(pkg.location||pkg.name).replace(/\/*$/,"/"),main:(pkg.main||"main").replace(/\.js$/,"").replace(/^\.\//,"") }}):cfg.packages&&(config.packages=cfg.packages),cfg.paths&&Object.keys(cfg.paths).forEach(function(p){ config.paths[p]=cfg.paths[p]}),cfg.useCache&&global.caches&&("https:"===location.protocol||"localhost"==location.hostname)&&(config.useCache=!0, checkCache()),cfg.transform&&(config.transform=cfg.transform),cfg.baseUrlLoadBalancers&&(config.baseUrlLoadBalancers=cfg.baseUrlLoadBalancers), cfg.MODULE_LOAD_URL&&(require.MODULE_LOAD_URL=cfg.MODULE_LOAD_URL)} require.resetConfig=function(){config.packages=Object.create(null),config.paths=Object.create(null),config.baseUrl="", config.useCache=!1,config.transform=""},require.getConfig=function(){var script=document.querySelector("script[src*=mini_require]") return{packages:config.packages,paths:config.paths,baseUrl:config.baseUrl,useCache:config.useCache,transform:config.transform, host:host,requireSourceUrl:script&&script.src,MODULE_LOAD_URL:require.MODULE_LOAD_URL}},require.resetConfig(), define.undef=require.undef=function(module,recursive){if(module=normalizeName("",module),recursive){var root=(module+"/").replace(/\/+$/,"/") undefAll(root,define.errors),undefAll(root,define.loaded),undefAll(root,define.modules),undefAll(root,define.loading) }else undefOne(module,require.toUrl(module,".js"))},require.MODULE_LOAD_URL=MODULE_LOAD_URL,require.toUrl=function(moduleName,ext,skipExt,skipBalancers){ var absRe=/^([\w\+\.\-]+:|\/)/,index=moduleName.indexOf("!");-1===index&&ext&&!/^\//.test(moduleName)||(ext="") for(var paths=config.paths,pkgs=config.packages,testPath=moduleName,tail="";testPath;){if(paths[testPath]){ moduleName=paths[testPath]+tail break}if(pkgs[testPath]){moduleName=pkgs[testPath].location+(tail||pkgs[testPath].main) break}var i=testPath.lastIndexOf("/") if(-1===i)break tail=testPath.substr(i)+tail,testPath=testPath.slice(0,i)}if(skipExt)return testPath var url=".js"==ext&&moduleName.slice(-3)==ext?moduleName:moduleName+ext if(absRe.test(url)||(".js"==ext&&require.config.transform&&(url=("~/"+require.config.transform+"/"+url).replace("//","/")), url=(config.baseUrl||require.MODULE_LOAD_URL+"/")+url),"/"===url[0]&&config.baseUrlLoadBalancers&&!skipBalancers&&!config.useCache){ var n=Math.abs(hashCode(url))%config.baseUrlLoadBalancers.length url=config.baseUrlLoadBalancers[n]+url}return"/"==url[0]&&(url=host+url),url} var ideCache,ideCachePromiss,loadScriptWithTag=function(path,id,callback){if("function"==typeof importScripts)return nextModule={ name:id,deps:null},"/"==path[0]&&(path=host+path),importScripts(path),callback(null,id) var head=document.head||document.documentElement,s=document.createElement("script") s.src=path,s.charset="utf-8",s.async=!0,0==path.lastIndexOf(require.MODULE_LOAD_URL,0)&&"/"!=path[0]&&(s.crossOrigin=!0), s.onload=s.onreadystatechange=function(_,isAbort){!isAbort&&s.readyState&&"loaded"!=s.readyState&&"complete"!=s.readyState||(s.remove&&s.remove(), s=s.onload=s.onreadystatechange=null,isAbort||callback(null,id))},s.onerror=function(e){processLoadQueue({ message:"Error loading script "+id+":"+path,id:id,path:path})},head.appendChild(s)},host=location.protocol+"//"+location.hostname+(location.port?":"+location.port:""),loadScript=function(path,id,callback){ if(!config.useCache)return loadScriptWithTag(path,id,callback);/^https?:/.test(path)||(path=host+path) var cb=function(e,val,deps){return e?processLoadQueue({id:id,path:path}):(nextModule={name:id,deps:deps },window.eval(val+"\n//# sourceURL="+path),callback(null,id),define.loaded[id])} loadCached(path,cb)},loadCached=function(path,cb){function loadNew(){loadText(path,function(e,val,xhr){ var m=cb(e,val) if(!e){var ETAG=xhr.getResponseHeader("ETAG") if(!ETAG)return var res=new Response(val) res.headers.set("ETAG",ETAG) var req=new Request(path) req.headers.set("ETAG",ETAG),m&&m.deps&&res.headers.set("deps",m.deps.join(",")),ideCache.put(req,res)["catch"](function(){ ideCache["delete"](path)})}})}return config.useCache?(ideCache||ideCachePromiss||checkCache(),ideCachePromiss?ideCachePromiss.then(function(i){ i&&(ideCache=i),loadCached(path,cb)}):void ideCache.match(path).then(function(e){return e?e.text().then(function(val){ var deps=e.headers.get("deps") "string"==typeof deps&&(deps=deps?deps.split(","):[]),cb(null,val,deps)}):loadNew()})["catch"](function(){ loadNew(),ideCache["delete"](path)})):loadText(path,cb)} require.clearCache=function(callback){ideCachePromiss=window.caches.open("ide").then(function(ideCache_){ return ideCache=ideCache_,ideCache.keys()}).then(function(keys){var toDelete=keys.map(function(i){ideCache["delete"](i) }) Promise.all(toDelete).then(function(){callback&&callback()},function(e){callback&&callback(e)})})},require.load=function(module){ var i=module.indexOf("!")+1 if(i){var plugin=module.substring(0,i) if(module=module.substr(i),"function"==typeof require[plugin])require[plugin](module,processLoadQueue) else if(config.baseUrl){if(require[plugin])return require[plugin][plugin+module]=1 require[plugin]=Object.create(null),require[plugin][plugin+module]=1,require([plugin.slice(0,-1)],function(p){ var pending=require[plugin] definePlugin(plugin,p),Object.keys(pending).forEach(function(p){delete define.loading[p]}),require(Object.keys(pending)) })}else console.error("require plugin "+plugin+"missing")}else{var url=require.toUrl(module,".js") if(1&define.fetchedUrls[url])return!1 define.fetchedUrls[url]|=1,loadScript(url,module,processLoadQueue)}},require["vfs!"]=function(module,callback){ var url=require.MODULE_LOAD_URL+"/~node/"+module return 4&define.fetchedUrls[url]?!1:(define.fetchedUrls[url]|=4,define("vfs!"+module,[],{srcUrl:url,path:module }),void callback())},require["text!"]=function(module,callback){var url=require.toUrl(module) if(2&define.fetchedUrls[url])return!1 define.fetchedUrls[url]|=2 var cb=function(e,val){e&&console.error("Couldn't load module "+module,e),define("text!"+module,[],val), callback()} loadCached(url,cb)},require["ace/requirejs/text!"]=function(module,callback){var url=require.toUrl(module) if(2&define.fetchedUrls[url])return!1 define.fetchedUrls[url]|=2 var cb=function(e,val){e&&console.error("Couldn't load module "+module,e),define("ace/requirejs/text!"+module,[],val), callback()} loadCached(url,cb)},global.define&&global.define.packaged||(define.original=global.define,global.define=define, global.define.packaged=!0),global.require&&global.require.packaged||(global.require=require,global.require.packaged=!0), global.requirejs||(global.requirejs=require),global.miniRequire=require}() define("events",[],function(require,exports,module){var EventEmitter=module.exports=function(){} EventEmitter.EventEmitter=EventEmitter var toString=Object.prototype.toString,isArray=Array.isArray||function(obj){return"[object Array]"===toString.call(obj) },defaultMaxListeners=10 EventEmitter.prototype.setMaxListeners=function(n){this._events||(this._events={}),this._events.maxListeners=n },EventEmitter.prototype.emit=function(type){if(this._events){var handler=this._events[type] if(handler){var returnValue if("function"==typeof handler)switch(arguments.length){case 1:return handler.call(this) case 2:return handler.call(this,arguments[1]) case 3:return handler.call(this,arguments[1],arguments[2]) default:var args=Array.prototype.slice.call(arguments,1) returnValue=handler.apply(this,args)}else if(isArray(handler))for(var temp,args=Array.prototype.slice.call(arguments,1),listeners=handler.slice(),i=0,l=listeners.length;l>i;i++)temp=listeners[i].apply(this,args), void 0!==temp&&(returnValue=temp) return returnValue}}},EventEmitter.prototype.addListener=function(type,listener,plugin){if("function"!=typeof listener)throw new Error("addListener only takes instances of Function") this._events||(this._events={}) var eventList=this._events[type] if(eventList)if(isArray(eventList)){if(!eventList.warned){var m m=void 0!==this._events.maxListeners?this._events.maxListeners:defaultMaxListeners,m&&m>0&&eventList.length>m&&(eventList.warned=!0, console.error('warning: possible EventEmitter memory leak detected. " + eventList.length + " listeners of type "'+type+'" added. Use emitter.setMaxListeners() to increase limit.'), console.trace())}eventList.push(listener)}else this._events[type]=[eventList,listener] else this._events[type]=listener return"newListener"!=type&&this.emit("newListener",type,listener),plugin&&plugin.addEvent(this,type,listener), this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(type,listener,plugin){ var self=this,wrapped=function(){return self.removeListener(type,listener),listener.apply(self,arguments) } return wrapped.listener=listener,self.on(type,wrapped,plugin),this},EventEmitter.prototype.removeListener=function(type,listener){ if("function"!=typeof listener)throw new Error("removeListener only takes instances of Function") if(!this._events||!this._events[type])return this var list=this._events[type] if(isArray(list)){if(!list.some(function(l,i){return(l.listener||l)==listener?(list.splice(i,1),!0):void 0 }))return this 0===list.length&&delete this._events[type]}else(this._events[type].listener||this._events[type])===listener&&delete this._events[type] return"removeListener"!=type&&this.emit("removeListener",type,listener),this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener, EventEmitter.prototype.removeAllListeners=function(type){return type&&this._events&&this._events[type]&&(this._events[type]=null), this},EventEmitter.prototype.listeners=function(type){return this._events||(this._events={}),this._events[type]||(this._events[type]=[]), isArray(this._events[type])||(this._events[type]=[this._events[type]]),this._events[type]}}) define("path",[],function(require,exports,module){function normalizeArray(parts,allowAboveRoot){for(var up=0,i=parts.length-1;i>=0;i--){ var last=parts[i] "."===last?parts.splice(i,1):".."===last?(parts.splice(i,1),up++):up&&(parts.splice(i,1),up--)}if(allowAboveRoot)for(;up--;up)parts.unshift("..") return parts}var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,splitPath=function(filename){ return splitPathRe.exec(filename).slice(1)} exports.resolve=function(){for(var resolvedPath="",resolvedAbsolute=!1,i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){ var path=i>=0?arguments[i]:"/" if("string"!=typeof path)throw new TypeError("Arguments to path.resolve must be strings") path&&(resolvedPath=path+"/"+resolvedPath,resolvedAbsolute="/"===path.charAt(0))}return resolvedPath=normalizeArray(resolvedPath.split("/").filter(function(p){ return!!p}),!resolvedAbsolute).join("/"),(resolvedAbsolute?"/":"")+resolvedPath||"."},exports.normalize=function(path){ var isAbsolute=exports.isAbsolute(path),trailingSlash="/"===path.substr(-1) return path=normalizeArray(path.split("/").filter(function(p){return!!p}),!isAbsolute).join("/"),path||isAbsolute||(path="."), path&&trailingSlash&&(path+="/"),(isAbsolute?"/":"")+path},exports.isAbsolute=function(path){return"/"===path.charAt(0) },exports.join=function(){var paths=Array.prototype.slice.call(arguments,0) return exports.normalize(paths.filter(function(p,index){if("string"!=typeof p)throw new TypeError("Arguments to path.join must be strings") return p}).join("/"))},exports.relative=function(from,to){function trim(arr){for(var start=0;start<arr.length&&""===arr[start];start++); for(var end=arr.length-1;end>=0&&""===arr[end];end--);return start>end?[]:arr.slice(start,end-start+1) }from=exports.resolve(from).substr(1),to=exports.resolve(to).substr(1) for(var fromParts=trim(from.split("/")),toParts=trim(to.split("/")),length=Math.min(fromParts.length,toParts.length),samePartsLength=length,i=0;length>i;i++)if(fromParts[i]!==toParts[i]){ samePartsLength=i break}for(var outputParts=[],i=samePartsLength;i<fromParts.length;i++)outputParts.push("..") return outputParts=outputParts.concat(toParts.slice(samePartsLength)),outputParts.join("/")},exports.dirname=function(path){ var result=splitPath(path),root=result[0],dir=result[1] return root||dir?(dir&&(dir=dir.substr(0,dir.length-1)),root+dir):"."},exports.basename=function(path,ext){ var f=splitPath(path)[2] return ext&&f.substr(-1*ext.length)===ext&&(f=f.substr(0,f.length-ext.length)),f},exports.extname=function(path){ return splitPath(path)[3]},exports._makeLong=function(path){return path}}) define("lib/architect/architect",[],function(require,exports,module){function define(name,deps,m){"function"==typeof name&&(m=name, deps=["require","exports","module"],name=$build_deps$.module.id),"string"!=typeof name&&(m=deps,deps=name, name=$build_deps$.module.id),m||(m=deps,deps=[]) var ret="function"==typeof m?m.apply($build_deps$.module,deps.map(function(n){return $build_deps$[n]||require(n) })):m void 0!=ret&&($build_deps$.module.exports=ret),name!=$build_deps$.module.id&&$build_deps$.module.define&&$build_deps$.module.define(name,[],function(){ return $build_deps$.module.exports})}var $build_deps$={require:require,exports:exports,module:module} exports=void 0,module=void 0,define.amd=!0,("undefined"!=typeof module&&function(m){module.exports=m(require("events")) }||"function"==typeof define&&function(m){define(["events"],m)})(function(events){"use strict" function checkConfig(config,lookup){return config.forEach(function(plugin){if(!plugin.checked){if(!plugin.hasOwnProperty("setup"))throw new Error("Plugin is missing the setup function "+JSON.stringify(plugin)) if(!plugin.hasOwnProperty("provides"))throw new Error("Plugin is missing the provides array "+JSON.stringify(plugin)) if(!plugin.hasOwnProperty("consumes"))throw new Error("Plugin is missing the consumes array "+JSON.stringify(plugin)) }}),checkCycles(config,lookup)}function checkCycles(config,lookup){var plugins=[] config.forEach(function(pluginConfig,index){plugins.push({packagePath:pluginConfig.packagePath,provides:pluginConfig.provides.concat(), consumes:pluginConfig.consumes.concat(),i:index})}) for(var resolved={hub:!0,app:!0},changed=!0,sorted=[];plugins.length&&changed;)changed=!1,plugins.concat().forEach(function(plugin){ for(var consumes=plugin.consumes.concat(),resolvedAll=!0,i=0;i<consumes.length;i++){var service=consumes[i] resolved[service]||lookup&&lookup(service)?plugin.consumes.splice(plugin.consumes.indexOf(service),1):resolvedAll=!1 }resolvedAll&&(plugins.splice(plugins.indexOf(plugin),1),plugin.provides.forEach(function(service){resolved[service]=!0 }),sorted.push(config[plugin.i]),changed=!0)}) if(plugins.length){var unresolved={} plugins.forEach(function(plugin){plugin.consumes.forEach(function(name){unresolved[name]!==!1&&(unresolved[name]||(unresolved[name]=[]), unresolved[name].push(plugin.packagePath))}),plugin.provides.forEach(function(name){unresolved[name]=!1 })}),Object.keys(unresolved).forEach(function(name){unresolved[name]===!1&&delete unresolved[name]}) var unresolvedList=Object.keys(unresolved),resolvedList=Object.keys(resolved),err=new Error("Could not resolve dependencies\n"+(unresolvedList.length?"Missing services: "+JSON.stringify(unresolved,null,4):"Config contains cyclic dependencies")) throw err.unresolved=unresolvedList,err.resolved=resolvedList,err}return sorted}function Architect(config){ function startPlugins(additional){function register(err,provided){return err?app.emit("error",err):(plugin.provides.forEach(function(name){ if(!provided.hasOwnProperty(name)){var err=new Error("Plugin failed to provide "+name+" service. "+JSON.stringify(plugin)) return err.plugin=plugin,app.emit("error",err)}services[name]=provided[name],app.serviceToPlugin[name]=plugin, plugin.__isAdditionalMode=isAdditionalMode,app.emit("service",name,services[name],plugin)}),provided&&provided.hasOwnProperty("onDestroy")&&destructors.push(provided.onDestroy), app.emit("plugin",plugin),recur?callnext=!0:void startPlugins(additional))}var plugin=sortedPlugins.shift() if(!plugin)return ready=!0,app.emit(additional?"ready-additional":"ready",app) var imports={} if(plugin.consumes&&plugin.consumes.forEach(function(name){imports[name]=services[name]}),DEBUG){for(recur++, plugin.setup(plugin,imports,register);callnext&&1>=recur;)callnext=!1,startPlugins(additional) recur--}else try{recur++,plugin.setup(plugin,imports,register)}catch(e){throw e.plugin=plugin,app.emit("error",e), e}finally{for(;callnext&&1>=recur;)callnext=!1,startPlugins(additional) recur--}}var app=this app.config=config,app.serviceToPlugin={} var isAdditionalMode,callnext,ready,services=app.services={hub:app,app:app},sortedPlugins=checkConfig(config),destructors=[],recur=0 ;("object"==typeof process?process.nextTick:setTimeout)(startPlugins),this.loadAdditionalPlugins=function(additionalConfig,callback){ isAdditionalMode=!0,exports.resolveConfig(additionalConfig,function(err,additionalConfig){if(err)return callback(err) app.once(ready?"ready-additional":"ready",function(app){callback(null,app)}) var _sortedPlugins=checkConfig(additionalConfig,function(name){return services[name]}) ready?(sortedPlugins=_sortedPlugins,startPlugins(!0)):_sortedPlugins.forEach(function(item){sortedPlugins.push(item) })})},this.destroy=function(){destructors.forEach(function(destroy){destroy()}),destructors=[]}}function createApp(config,callback){ function onReady(app){done()}function done(err){err&&app.destroy(),app.removeListener("error",done),app.removeListener("ready",onReady), callback(err,app)}var app try{app=new Architect(config)}catch(err){if(!callback)throw err return callback(err,app)}return callback&&(app.on("error",done),app.on("ready",onReady)),app}var EventEmitter=events.EventEmitter,exports={},DEBUG=!("undefined"==typeof location||!location.href.match(/debug=[123]/)) return"object"==typeof module?function(){function loadConfig(configPath,callback){var config=require(configPath),base=dirname(configPath) return resolveConfig(config,base,callback)}function resolveConfig(config,base,callback){if(!callback)return resolveConfigSync(config,base) try{var result=resolveConfigSync(config,base)}catch(e){var err=e}process.nextTick(function(){callback(err,result) })}function resolveConfigSync(config,base){return config.forEach(function(plugin,index){if("string"==typeof plugin&&(plugin=config[index]={ packagePath:plugin}),plugin.hasOwnProperty("packagePath")&&!plugin.hasOwnProperty("setup")){var defaults=resolveModuleSync(base,plugin.packagePath) Object.keys(defaults).forEach(function(key){plugin.hasOwnProperty(key)||(plugin[key]=defaults[key])}), plugin.packagePath=defaults.packagePath,plugin.setup=require(plugin.packagePath)}}),config}function resolveModuleSync(base,modulePath){ var packagePath try{packagePath=resolvePackageSync(base,modulePath+"/package.json")}catch(err){if("ENOENT"!==err.code&&"MODULE_NOT_FOUND"!==err.code)throw err }var metadata=packagePath&&require(packagePath).plugin||{} modulePath=packagePath?dirname(packagePath):resolvePackageSync(base,modulePath) var module=require(modulePath) return metadata.provides=metadata.provides||module.provides||[],metadata.consumes=metadata.consumes||module.consumes||[], metadata.packagePath=modulePath,metadata}function resolvePackageSync(base,packagePath){return Module._resolveFilename(packagePath,{ paths:Module._nodeModulePaths(base),filename:base+"/package.json",id:base+"/package.json"})}var dirname=require("path").dirname,Module=require("module") exports.loadConfig=loadConfig,exports.resolveConfig=resolveConfig}():function(){function loadConfig(path,callback){ require([path],function(config){resolveConfig(config,callback)})}function resolveConfig(config,base,callback,errback){ if("function"==typeof base)return resolveConfig(config,"",arguments[1],arguments[2]) var paths=[],pluginIndexes={} config.forEach(function(plugin,index){"string"==typeof plugin&&(plugin=config[index]={packagePath:plugin }),plugin.hasOwnProperty("packagePath")&&!plugin.hasOwnProperty("setup")&&(paths.push((base||"")+plugin.packagePath), pluginIndexes[plugin.packagePath]=index)}),require(paths,function(){var args=arguments,err=[] return paths.forEach(function(name,i){var module=args[i],plugin=config[pluginIndexes[name]] return module&&plugin?(plugin.setup=module,plugin.provides=module.provides||[],void(plugin.consumes=module.consumes||[])):err.push(name) }),err.length?callback(new Error("Missing plugins: "+err)):void callback(null,config)},errback||function(err){ callback(err)})}exports.loadConfig=loadConfig,exports.resolveConfig=resolveConfig}(),exports.createApp=createApp, exports.Architect=Architect,Architect.prototype=Object.create(EventEmitter.prototype,{constructor:{value:Architect }}),Architect.prototype.getService=function(name){if(!this.services[name])throw new Error("Service '"+name+"' not found in architect app!") return this.services[name]},exports})}) define("plugins/@smartface/smartface.ui-editor/ace/ace",[],function(require,exports,module){function main(options,imports,register){ function load(){if(!loaded){loaded=!0 var contextMenu=ace.contextMenu menuItem.uiEditorView=new MenuItem({position:60,caption:CAPTION.uiEditorView,disabled:!0,onclick:function(e){ PGX_REPLACER_RGX.lastIndex=0 var res=PGX_REPLACER_RGX.exec(tabs.focussedTab.title)||[] tabs.focussedTab.title=res[1]?"Library":tabs.focussedTab.title.replace(".pgx",""),tabs.focussedTab.tooltip=tabs.focussedTab.title, tabs.focussedTab.document.title=tabs.focussedTab.title,tabs.focussedTab.document.tooltip=tabs.focussedTab.tooltip, tabs.switchEditor(tabs.focussedTab,"smf-ui",function(){})}},plugin),commands.addCommand({name:"goto_design_file", group:"ace",hint:"Triggers the goto design file",bindKey:{mac:"F2",win:"F2"},isAvailable:function(editor){ return!menuItem.gotoDesign.disabled},exec:function(){menuItem.designer.isLib?openLibraryComp(menuItem.designer.fileName):openDesignFile(menuItem.designer.fileName) }},plugin),menuItem.gotoDesign=new MenuItem({command:"goto_design_file",position:61,caption:CAPTION.gotoDesign, disabled:!0,onclick:function(e){}},plugin),contextMenu.append(new Divider({position:50})),contextMenu.append(menuItem.uiEditorView), contextMenu.append(menuItem.gotoDesign),contextMenu.append(new Divider({position:70})),tabs.on("tabBeforeActivate",function(e){ menuItem.uiEditorView.disabled=!0,menuItem.gotoDesign.disabled=!0,menuItem.designer.isLib=!1,menuItem.viewUiComp.disabled=!0 var resReg=execSfExtRegex(e.tab.path) if(resReg){resReg[1]&&(menuItem.uiEditorView.disabled=!1) var finalRes=resReg[3]||resReg[4] finalRes&&setMenuItemStatus(finalRes,"components"===resReg[5]||"library"===resReg[5])}})}}function execSfExtRegex(path){ if(path){var parts=path.split("/"),name=parts[parts.length-1] SFREG.lastIndex=0 var res=SFREG.exec(name) return res&&(res[5]=parts[parts.length-2]),res}}function setMenuItemStatus(name,isLib){menuItem.designer.fileName=name, isLib?(menuItem.designer.isLib=!0,menuItem.gotoDesign.disabled=!1):fs.exists("/.ui/"+name+".pgx",function(exists){ menuItem.gotoDesign.disabled=!exists})}function openLibraryComp(name){var libStore=engine.getStoreByPageName(LIB_NAME),compName=name.charAt(0).toLowerCase()+name.slice(1),componentByID=libStore.getState().engine.componentByID,compID=libStore.getPage().props.children.find(function(childID){ return componentByID[childID].props.name===compName}) compID&&tabs.open({path:"/.ui/library/index.pgx",focus:!0,active:!0},function(){libStore.store.dispatch({ type:"select",items:compID})})}function openDesignFile(name){tabs.open({path:"/.ui/"+name+".pgx",focus:!0, active:!0},function(){})}function unload(){loaded=!1}var Plugin=imports.Plugin,ace=imports.ace,commands=imports.commands,tabs=imports.tabManager,fs=(imports.menus, imports.c9,imports.ui,imports.fs),MenuItem=(imports.Menu,imports.MenuItem),Divider=imports.Divider,engine=imports["smartface.ui-editor.engine"],plugin=new Plugin("Smartface",main.consumes,{ name:"smartface.ui-editor.ace"}) const LIB_NAME="__library__",CAPTION={uiEditorView:"View in UI Editor",gotoDesign:"Go to Design"},PGX_REPLACER_RGX=/(index)\.pgx|\.pgx/,SFREG=/\.(pgx)|\.(cpx)|ui_(.*).js|(.*)\.js/ var menuItem={uiEditorView:{},gotoDesign:{},designer:{},viewUiComp:{}},loaded=!1 plugin.on("load",load),plugin.on("unload",unload),plugin.freezePublicAPI({}),register(null,{"smartface.ui-editor.ace":plugin })}return main.consumes=["Plugin","c9","ui","fs","tabManager","ace","commands","menus","Menu","MenuItem","Divider","smartface.ui-editor.engine"], main.provides=["smartface.ui-editor.ace"],main}) define("text!plugins/@smartface/smartface.ui-editor/node_modules/jsonlint/web/jsonlint.js",[],'var jsonlint=function(){var a=!0,b=!1,c={},d=function(){var a={trace:function(){},yy:{},symbols_:{error:2,JSONString:3,STRING:4,JSONNumber:5,NUMBER:6,JSONNullLiteral:7,NULL:8,JSONBooleanLiteral:9,TRUE:10,FALSE:11,JSONText:12,JSONValue:13,EOF:14,JSONObject:15,JSONArray:16,"{":17,"}":18,JSONMemberList:19,JSONMember:20,":":21,",":22,"[":23,"]":24,JSONElementList:25,$accept:0,$end:1},terminals_:{2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},productions_:[0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]],performAction:function(b,c,d,e,f,g,h){var i=g.length-1;switch(f){case 1:this.$=b.replace(/\\\\(\\\\|")/g,"$1").replace(/\\\\n/g,"\\n").replace(/\\\\r/g,"\\r").replace(/\\\\t/g," ").replace(/\\\\v/g,"\x0B").replace(/\\\\f/g,"\\f").replace(/\\\\b/g,"\\b");break;case 2:this.$=Number(b);break;case 3:this.$=null;break;case 4:this.$=!0;break;case 5:this.$=!1;break;case 6:return this.$=g[i-1];case 13:this.$={};break;case 14:this.$=g[i-1];break;case 15:this.$=[g[i-2],g[i]];break;case 16:this.$={},this.$[g[i][0]]=g[i][1];break;case 17:this.$=g[i-2],g[i-2][g[i][0]]=g[i][1];break;case 18:this.$=[];break;case 19:this.$=g[i-1];break;case 20:this.$=[g[i]];break;case 21:this.$=g[i-2],g[i-2].push(g[i])}},table:[{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],12:1,13:2,15:7,16:8,17:[1,14],23:[1,15]},{1:[3]},{14:[1,16]},{14:[2,7],18:[2,7],22:[2,7],24:[2,7]},{14:[2,8],18:[2,8],22:[2,8],24:[2,8]},{14:[2,9],18:[2,9],22:[2,9],24:[2,9]},{14:[2,10],18:[2,10],22:[2,10],24:[2,10]},{14:[2,11],18:[2,11],22:[2,11],24:[2,11]},{14:[2,12],18:[2,12],22:[2,12],24:[2,12]},{14:[2,3],18:[2,3],22:[2,3],24:[2,3]},{14:[2,4],18:[2,4],22:[2,4],24:[2,4]},{14:[2,5],18:[2,5],22:[2,5],24:[2,5]},{14:[2,1],18:[2,1],21:[2,1],22:[2,1],24:[2,1]},{14:[2,2],18:[2,2],22:[2,2],24:[2,2]},{3:20,4:[1,12],18:[1,17],19:18,20:19},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:23,15:7,16:8,17:[1,14],23:[1,15],24:[1,21],25:22},{1:[2,6]},{14:[2,13],18:[2,13],22:[2,13],24:[2,13]},{18:[1,24],22:[1,25]},{18:[2,16],22:[2,16]},{21:[1,26]},{14:[2,18],18:[2,18],22:[2,18],24:[2,18]},{22:[1,28],24:[1,27]},{22:[2,20],24:[2,20]},{14:[2,14],18:[2,14],22:[2,14],24:[2,14]},{3:20,4:[1,12],20:29},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:30,15:7,16:8,17:[1,14],23:[1,15]},{14:[2,19],18:[2,19],22:[2,19],24:[2,19]},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:31,15:7,16:8,17:[1,14],23:[1,15]},{18:[2,17],22:[2,17]},{18:[2,15],22:[2,15]},{22:[2,21],24:[2,21]}],defaultActions:{16:[2,6]},parseError:function(b,c){throw new Error(b)},parse:function(b){function o(a){d.length=d.length-2*a,e.length=e.length-a,f.length=f.length-a}function p(){var a;return a=c.lexer.lex()||1,typeof a!="number"&&(a=c.symbols_[a]||a),a}var c=this,d=[0],e=[null],f=[],g=this.table,h="",i=0,j=0,k=0,l=2,m=1;this.lexer.setInput(b),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var n=this.lexer.yylloc;f.push(n),typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);var q,r,s,t,u,v,w={},x,y,z,A;for(;;){s=d[d.length-1],this.defaultActions[s]?t=this.defaultActions[s]:(q==null&&(q=p()),t=g[s]&&g[s][q]);if(typeof t=="undefined"||!t.length||!t[0]){if(!k){A=[];for(x in g[s])this.terminals_[x]&&x>2&&A.push("\'"+this.terminals_[x]+"\'");var B="";this.lexer.showPosition?B="Parse error on line "+(i+1)+":\\n"+this.lexer.showPosition()+"\\nExpecting "+A.join(", ")+", got \'"+this.terminals_[q]+"\'":B="Parse error on line "+(i+1)+": Unexpected "+(q==1?"end of input":"\'"+(this.terminals_[q]||q)+"\'"),this.parseError(B,{text:this.lexer.match,token:this.terminals_[q]||q,line:this.lexer.yylineno,loc:n,expected:A})}if(k==3){if(q==m)throw new Error(B||"Parsing halted.");j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,n=this.lexer.yylloc,q=p()}for(;;){if(l.toString()in g[s])break;if(s==0)throw new Error(B||"Parsing halted.");o(1),s=d[d.length-1]}r=q,q=l,s=d[d.length-1],t=g[s]&&g[s][l],k=3}if(t[0]instanceof Array&&t.length>1)throw new Error("Parse Error: multiple actions possible at state: "+s+", token: "+q);switch(t[0]){case 1:d.push(q),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(t[1]),q=null,r?(q=r,r=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,n=this.lexer.yylloc,k>0&&k--);break;case 2:y=this.productions_[t[1]][1],w.$=e[e.length-y],w._$={first_line:f[f.length-(y||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(y||1)].first_column,last_column:f[f.length-1].last_column},v=this.performAction.call(w,h,j,i,this.yy,t[1],e,f);if(typeof v!="undefined")return v;y&&(d=d.slice(0,-1*y*2),e=e.slice(0,-1*y),f=f.slice(0,-1*y)),d.push(this.productions_[t[1]][0]),e.push(w.$),f.push(w._$),z=g[d[d.length-2]][d[d.length-1]],d.push(z);break;case 3:return!0}}return!0}},b=function(){var a={EOF:1,parseError:function(b,c){if(!this.yy.parseError)throw new Error(b);this.yy.parseError(b,c)},setInput:function(a){return this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.match+=a,this.matched+=a;var b=a.match(/\\n/);return b&&this.yylineno++,this._input=this._input.slice(1),a},unput:function(a){return this._input=a+this._input,this},more:function(){return this._more=!0,this},less:function(a){this._input=this.match.slice(a)+this._input},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\\n/g,"")},showPosition:function(){var a=this.pastInput(),b=(new Array(a.length+1)).join("-");return a+this.upcomingInput()+"\\n"+b+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d,e,f;this._more||(this.yytext="",this.match="");var g=this._currentRules();for(var h=0;h<g.length;h++){c=this._input.match(this.rules[g[h]]);if(c&&(!b||c[0].length>b[0].length)){b=c,d=h;if(!this.options.flex)break}}if(b){f=b[0].match(/\\n.*/g),f&&(this.yylineno+=f.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:f?f[f.length-1].length-1:this.yylloc.last_column+b[0].length},this.yytext+=b[0],this.match+=b[0],this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(b[0].length),this.matched+=b[0],a=this.performAction.call(this,this.yy,this,g[d],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1);if(a)return a;return}if(this._input==="")return this.EOF;this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var b=this.next();return typeof b!="undefined"?b:this.lex()},begin:function(b){this.conditionStack.push(b)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(b){this.begin(b)}};return a.options={},a.performAction=function(b,c,d,e){var f=e;switch(d){case 0:break;case 1:return 6;case 2:return c.yytext=c.yytext.substr(1,c.yyleng-2),4;case 3:return 17;case 4:return 18;case 5:return 23;case 6:return 24;case 7:return 22;case 8:return 21;case 9:return 10;case 10:return 11;case 11:return 8;case 12:return 14;case 13:return"INVALID"}},a.rules=[/^(?:\\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\\.[0-9]+)?([eE][-+]?[0-9]+)?\\b)/,/^(?:"(?:\\\\[\\\\"bfnrt/]|\\\\u[a-fA-F0-9]{4}|[^\\\\\\0-\\x09\\x0a-\\x1f"])*")/,/^(?:\\{)/,/^(?:\\})/,/^(?:\\[)/,/^(?:\\])/,/^(?:,)/,/^(?::)/,/^(?:true\\b)/,/^(?:false\\b)/,/^(?:null\\b)/,/^(?:$)/,/^(?:.)/],a.conditions={INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}},a}();return a.lexer=b,a}();return typeof a!="undefined"&&typeof c!="undefined"&&(c.parser=d,c.parse=function(){return d.parse.apply(d,arguments)},c.main=function(d){if(!d[1])throw new Error("Usage: "+d[0]+" FILE");if(typeof process!="undefined")var e=a("fs").readFileSync(a("path").join(process.cwd(),d[1]),"utf8");else var f=a("file").path(a("file").cwd()),e=f.join(d[1]).read({charset:"utf-8"});return c.parser.parse(e)},typeof b!="undefined"&&a.main===b&&c.main(typeof process!="undefined"?process.argv.slice(1):a("system").args)),c}();') define("plugins/@smartface/smartface.ui-editor/engine/problem",[],function(require,exports,module){function main(options,imports,register){ function detectProblems(callback){var errors=[] smfThemes.readdirRecursive("/.ui",function(err,designFiles){smfThemes.readdirRecursive("/themes",function(err,themeFiles){ themeFiles=themeFiles||[],designFiles=designFiles||[] var files=themeFiles.concat(designFiles),callbackCount=files.length 0===callbackCount&&callback("themes folder is empty"),files.forEach(function(filePath){smfThemes.readFileSafe(filePath,function(err,content){ if(content){var error=validateStringifiedJSON(content,filePath) error=error&&error.replace(/\n/g,function(){return"\n "})+"\n",error&&errors.push(error)}0===--callbackCount&&callback(null,errors) })})})})}function validateStringifiedJSON(str,path){var error=null try{jsonlint.parse(str)}catch(ex){error=path+": "+ex.toString()}finally{return error}}function watch(){ watcher.watch("/themes"),watcher.watch("/.ui"),watcher.on("change.all",function(e){var shouldShowProblems=e.path.startsWith("/themes")||e.path.startsWith("/.ui") shouldShowProblems&&showProblems()})}function showProblems(){detectProblems(function(err,errors){show(errors) })}function appendLines(doc,content){content&&(content.length||content.count)&&("string"!=typeof content&&(content=content.join("\n")), content.length>0&&doc.insert({row:doc.getLength(),column:0},content))}function saveErrorsToDoc(doc,errors){ appendLines(doc,"-------------------------------- PROBLEMS("+errors.length+") ----------------------------------\n"), appendLines(doc,"\n") for(var fi=0;fi<errors.length;++fi)appendLines(doc,errors[fi]+"\n")}function show(errors){function showWrapper(tab){ if(tab=tab.tab,tab.title===PROBLEMS_TITLE){var session=tab.document.getSession(),acesession=session.session,doc=acesession.getDocument() tab.document.value="",saveErrorsToDoc(doc,errors),tabManager.off("focus",showWrapper)}}if(errors){var reportTab,shouldShow=errors.length>0 shouldShow?(tabManager.on("focus",showWrapper),reportTab=tabManager.open({path:PROBLEMS_PATH,active:!0, pane:tabManager.getPanes()[1],document:{title:PROBLEMS_TITLE,meta:{ignoreSave:!0,newfile:!0},ace:{customSyntax:"c9search", options:{}}},editorType:"ace"},function(err,tab){tabManager.focusTab(tab)})):(reportTab=tabManager.findTab(PROBLEMS_PATH), reportTab&&reportTab.close())}}var Plugin=imports.Plugin,smfThemes=imports["smartface.ui-editor.themes"],watcher=imports.watcher,tabManager=imports.tabManager,plugin=new Plugin("Smartface",main.consumes) eval(require("text!../node_modules/jsonlint/web/jsonlint.js")) const PROBLEMS_PATH=".smf/problems",PROBLEMS_TITLE="Problems" plugin.on("load",function(){watch(),tabManager.on("ready",function(){var reportTab=tabManager.findTab(PROBLEMS_PATH) reportTab?(reportTab.on("close",showProblems),reportTab.close()):showProblems()})}),plugin.on("unload",function(){}), plugin.freezePublicAPI({detectProblems:detectProblems}),register(null,{"smartface.ui-editor.problem":plugin })}return main.consumes=["Plugin","smartface.ui-editor.themes","watcher","tabManager"],main.provides=["smartface.ui-editor.problem"], main}) define("plugins/@smartface/smartface.ui-editor/engine/newfile",[],function(require,exports,module){function main(options,imports,register){ function loadTreeMenuContext(){menus.addItemToMenu(treeMenuContext,menuItemNewThemeTree,1550,plugin)} function createPGX(pageName,source){var savePath=PGX_PATH+"/"+pageName+".pgx",data=source "string"==typeof source&&(data=JSON.parse(source)) var idMap={} data.components.forEach(function(comp){var newId=uiEditorEngine.guid() idMap[comp.props.name]=newId,idMap[comp.id]=newId,comp.id=newId}),data.components.forEach(function(item){ item.props.parent&&(item.props.parent=idMap[item.props.parent]),item.props.children&&item.props.children.forEach(function(child,index){ item.props.children[index]=idMap[child]})}),data.components[0].props.name=pageName,fs.writeFile(savePath,JSON.stringify(data,null," "),"utf8",function(err){ err&&console.error(err),tabManager.open({path:savePath,focus:!0},function(err,tab){})})}function loadTabManagerMenuContext(){ function isAvailable(){reThemesPath.lastIndex=0 var valid=reThemesPath.test(tree.selectedNode.path)&&tree.selectedNode.isFolder===!0&&1===tree.selectedNodes.length return valid}commands.addCommand({name:"NewPgx",isAvailable:function(){return!c9.readonly},exec:function(editor,args){ function getAvailablePageName(dir,prefix,callback){var res="" fs.readdir(dir,function(err,list){if(err)return callback(err) var availablePageNumber=0,pgName=pageName||"newPage",regex=new RegExp(pgName+(prefix?prefix:"")+"(\\d+)\\.pgx") list.forEach(function(stat){var fileName=stat.name regex.lastIndex=0 var res=regex.exec(fileName)||[],currentPageNumber=Number(2===res.length?res[1]:0) currentPageNumber>availablePageNumber&&(availablePageNumber=currentPageNumber)}),++availablePageNumber, prefix?res=prefix+availablePageNumber:10>availablePageNumber?res="00"+availablePageNumber:100>availablePageNumber&&(res="0"+availablePageNumber), callback(null,pgName+res)})}var source=args[1],pageName=args[0],prefix=args[2] getAvailablePageName(PGX_PATH,prefix,function(err,availablePageName){if(err)throw err source?createPGX(availablePageName,source):createPGX(availablePageName,getDefaultPage(availablePageName)) })}},plugin),commands.addCommand({name:"NewTheme",isAvailable:function(){return!c9.readonly},exec:function(){ fileDialog.show(THEME_HEADER,THEME_PATH,function(savePath,stat,done){uiEditorEngine.createTheme(savePath.split("/").pop(),done) },function(){},{createFolderButton:!1,showFilesCheckbox:!0,hideFileInput:!1,chooseCaption:"Save"})}},plugin), menuItemNewThemeTree=new ui.item({caption:THEME_HEADER,command:"NewTheme",isAvailable:isAvailable}),Object.defineProperty(menuItemNewThemeTree,"match",{ enumerable:!0,configurable:!1,disabled:!0})}function hideDialogEvent(e){27===e.which&&fileDialog&&fileDialog.hide() }function getDefaultPage(pageName){return JSON.stringify(uiEditorEngine.getDefaultPage(pageName,uiEditorEngine.version),null," ") }var treeMenuContext,menuItemNewThemeTree,Plugin=imports.Plugin,menus=imports.menus,ui=imports.ui,commands=imports.commands,fileDialog=imports["dialog.file"],uiEditorEngine=imports["smartface.ui-editor.engine"],fs=imports.fs,c9=imports.c9,tabManager=imports.tabManager,tree=imports.tree,PGX_PATH="/.ui",reThemesPath=/^\/themes.*/ const THEME_HEADER="New Theme",THEME_PATH="/themes/newTheme" var plugin=new Plugin("Smartface",main.consumes) plugin.on("load",function(){function getTabManagerMenuContext(){try{tabManager.getElement