(function(b,e){"function"===typeof define&&define.amd?define("orion/Deferred",e):"object"===typeof exports?module.exports=e():(b.orion=b.orion||{},b.orion.Deferred=e())})(this,function(){function b(){for(var c;c=w.shift();)c();u=!1}function e(c){w.push(c);u||(u=!0,x())}function h(c){return function(b){c(b)}}function n(){function c(){for(var a;a=k.shift();){var m=a.deferred,b="fulfilled"===g?"resolve":"reject";a=a[b];if("function"===typeof a)try{var c=a(l),d=c&&("object"===typeof c||"function"===typeof c)&&
c.then;if("function"===typeof d)if(c===m.promise)m.reject(new TypeError);else{var e=c.cancel;"function"===typeof e?m._parentCancel=e.bind(c):delete m._parentCancel;d.call(c,h(m.resolve),h(m.reject),h(m.progress))}else m.resolve(c)}catch(t){m.reject(t)}else m[b](l)}}function b(a){delete d._parentCancel;g="rejected";l=a;k.length&&e(c)}function v(a){function m(f){return function(a){(!g||"assumed"===g)&&f(a)}}delete d._parentCancel;try{var p=a&&("object"===typeof a||"function"===typeof a)&&a.then;if("function"===
typeof p)if(a===d)b(new TypeError);else{g="assumed";var r=a&&a.cancel;if("function"!==typeof r){var h=new n;a=h.promise;try{p(h.resolve,h.reject,h.progress)}catch(s){h.reject(s)}r=a.cancel;p=a.then}l=a;p.call(a,m(v),m(b));d._parentCancel=r.bind(a)}else g="fulfilled",l=a,k.length&&e(c)}catch(q){m(b)(q)}}function s(){var a=d._parentCancel;a?(delete d._parentCancel,a()):g||(a=Error("Cancel"),a.name="Cancel",b(a))}var l,g,k=[],d=this;this.resolve=function(a){g||v(a);return d};this.reject=function(a){g||
b(a);return d};this.progress=function(a){g||k.forEach(function(c){if(c.progress)try{c.progress(a)}catch(b){}});return d.promise};this.cancel=function(){d._parentCancel?setTimeout(s,0):s();return d};this.then=function(a,b,h){var l=new n;l._parentCancel=d.promise.cancel;k.push({resolve:a,reject:b,progress:h,deferred:l});("fulfilled"===g||"rejected"===g)&&e(c);return l.promise};this.promise={then:d.then,cancel:d.cancel}}var w=[],u=!1,x=function(){if("undefined"!==typeof process&&"function"===typeof process.nextTick){var c=
process.nextTick;return function(){c(b)}}if("function"===typeof MutationObserver){var e=document.createElement("div");(new MutationObserver(b)).observe(e,{attributes:!0});return function(){e.setAttribute("class","_tick")}}return function(){setTimeout(b,0)}}();n.all=function(c,b){function e(a,b){k||(g[a]=b,0===--l&&d.resolve(g))}function h(a,c){if(!k){if(b)try{e(a,b(c));return}catch(g){c=g}d.reject(c)}}var l=c.length,g=[],k=!1,d=new n;d.then(void 0,function(){k=!0;c.forEach(function(a){a.cancel&&a.cancel()})});
0===l?d.resolve(g):c.forEach(function(a,c){a.then(e.bind(void 0,c),h.bind(void 0,c))});return d.promise};n.when=function(c,b,e,h){var l;c&&"function"===typeof c.then||(l=new n,l.resolve(c),c=l.promise);return c.then(b,e,h)};return n});
(function(b,e){"function"===typeof define&&define.amd?define("orion/plugin",["orion/Deferred"],e):"object"===typeof exports?module.exports=e(require("orion/Deferred")):(b.orion=b.orion||{},b.orion.PluginProvider=e(b.orion.Deferred))})(this,function(b){function e(b,e){this.__objectId=b;this.__methods=e}return function(h){function n(f){k&&("undefined"===typeof ArrayBuffer&&(f=JSON.stringify(f)),k===self?k.postMessage(f):k.postMessage(f,"*"))}function w(){var f=[];Object.keys(y).forEach(function(a){var c=
y[a];f.push({serviceId:a,names:c.names,methods:c.methods,properties:c.properties})});return{headers:l||{},services:f}}function u(f,a){if(a&&a instanceof XMLHttpRequest){var c,b;try{c=a.status,b=a.statusText}catch(e){c=0,b=""}return{status:c||0,statusText:b}}return a}function x(f){var a=f?JSON.parse(JSON.stringify(f,u)):f;f instanceof Error&&(a.__isError=!0,a.message=a.message||f.message,a.name=a.name||f.name);return a}function c(f){if(!k)return(new b).reject(Error("plugin not connected"));f.id=String(d++);
var c=new b;r[f.id]=c;c.then(null,function(a){g&&a instanceof Error&&"Cancel"===a.name&&q({requestId:f.id,method:"cancel",params:a.message?[a.message]:[]})});var h=Object.prototype.toString;f.params.forEach(function(b,g){if("[object Object]"===h.call(b)&&!(b instanceof e)){var d,k;for(d in b)"[object Function]"===h.call(b[d])&&(k=k||[],k.push(d));if(k){var l=a++;z[l]=b;d=function(){delete z[l]};c.then(d,d);f.params[g]=new e(l,k)}}});q(f);return c.promise}function t(f,a){f||0===f?q({id:f,result:null,
error:a}):console.log(a)}function v(f,a,b,e){e.forEach(function(f,a){if(f&&"undefined"!==typeof f.__objectId){var b={};f.__methods.forEach(function(a){b[a]=function(){return c({objectId:f.__objectId,method:a,params:Array.prototype.slice.call(arguments)})}});e[a]=b}});var d=void 0===typeof f?null:{id:f,result:null,error:null};try{var g=b.apply(a,e);d&&(g&&"function"===typeof g.then?(p[f]=g,g.then(function(a){delete p[f];d.result=a;q(d)},function(a){p[f]&&(delete p[f],d.error=x(a),q(d))},function(){q({responseId:f,
method:"progress",params:Array.prototype.slice.call(arguments)})})):(d.result=g,q(d)))}catch(k){d&&(d.error=x(k),q(d))}}function s(a){if(!(a.source!==k&&"undefined"!==typeof window)){a="string"!==typeof a.data?a.data:JSON.parse(a.data);try{if(a.method){var b=a.method,c=a.params||[];if("serviceId"in a){var d=y[a.serviceId];d||t(a.id,"service not found");d=d.implementation;b in d?v(a.id,d,d[b],c):t(a.id,"method not found")}else if("objectId"in a){var e=z[a.objectId];e||t(a.id,"object not found");!b in
e?v(a.id,e,e[b],c):t(a.id,"method not found")}else if("requestId"in a){var g=p[a.requestId];g&&"cancel"===b&&g.cancel&&g.cancel.apply(g,c)}else if("responseId"in a){var h=r[a.responseId];h&&"progress"===b&&h.progress&&h.progress.apply(h,c)}else throw Error("Bad method: "+a.method);}else{var l=r[String(a.id)];delete r[String(a.id)];a.error?l.reject(a.error):l.resolve(a.result)}}catch(m){console.log("Plugin._messageHandler "+m)}}}var l=h,g=!1,k=null,d=0,a=0,m=0,p={},r={},z={},y={},q=n;this.updateHeaders=
function(a){if(g)throw Error("Cannot update headers. Plugin Provider is connected");l=a};this.registerServiceProvider=this.registerService=function(a,b,c){if(g)throw Error("Cannot register service. Plugin Provider is connected");"string"===typeof a?a=[a]:Array.isArray(a)||(a=[]);var d=null,e=[];for(d in b)"function"===typeof b[d]&&e.push(d);y[m++]={names:a,methods:e,implementation:b,properties:c||{},listeners:{}}};this.connect=function(a,b){if(!g){if("undefined"===typeof window)k=self;else if(window!==
window.parent)k=window.parent;else if(null!==window.opener)k=window.opener;else{b&&b("No valid plugin target");return}addEventListener("message",s,!1);var c={method:"plugin",params:[w()]};n(c);g=!0}a&&a()};this.disconnect=function(){g&&(removeEventListener("message",s),k=null,g=!1)}}});
define("orion/editor/stylers/text_x-yaml/syntax",[],function(){var b=["false","null","true"],e="!!bool !!float !!int !!map !!null !!omap !!seq !!str".split(" ");return{id:"orion.yaml",grammars:[{id:"orion.yaml",contentTypes:["text/x-yaml"],patterns:[{include:"#numberSignComment"},{match:"^%(?:YAML|TAG)\\s.*",name:"meta.directive.yaml"},{begin:"^.*?:(?:[\\t ]|$)",end:"$",contentName:"string.unquoted.yaml",beginCaptures:{0:{name:"entity.name.key.yaml"}},patterns:[{include:"#numberSignComment"},{match:"^\\s*[\x26*]\\s*$",
name:"entity.name.tag.yaml"},{match:"(?i)^\\s*(?:"+b.join("|")+")\\s*$",name:"keyword.control.yaml"},{match:"(?i)^\\s*(?:"+e.join("|")+")\\b",name:"keyword.control.yaml"},{match:"(?i)^\\s*(?:-?[0-9]*(?:\\.[0-9]+)?(?:e[-+][1-9][0-9]*)?)\\s*$",name:"constant.numeric"},{match:"(?i)^\\s*(?:-?[1-9][0-9]*|0|-?\\.inf|\\.nan)\\s*$",name:"constant.numeric"}]},{match:"---|\\.\\.\\.",name:"meta.separator.yaml"}],repository:{numberSignComment:{match:{match:"(?:^|\\s)#.*",literal:"#"},name:"comment.line.number-sign.yaml",
patterns:[{include:"orion.lib#todo_comment_singleLine"}]}}}],keywords:e.concat(b)}});
define("built-yamlPlugin.js",["orion/plugin","orion/editor/stylers/text_x-yaml/syntax"],function(b,e){var h=new b({name:"Orion YAML Tool Support",version:"1.0",description:"This plugin provides YAML tools support for Orion."});h.registerServiceProvider("orion.core.contenttype",{},{contentTypes:[{id:"text/x-yaml","extends":"text/plain",name:"YAML",extension:["yaml","yml"]}]});h.registerServiceProvider("orion.edit.highlighter",{},e.grammars[e.grammars.length-1]);h.connect()});
//@ sourceMappingURL=built-yamlPlugin.js.map