/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation
*/
(function(d,e){typeof define==="function"&&define.amd?define("orion/Deferred",e):typeof exports==="object"?module.exports=e():(d.orion=d.orion||{},d.orion.Deferred=e())})(this,function(){function d(){for(var c;c=l.shift();)c();r=!1}function e(c){l.push(c);r||(r=!0,setTimeout(d,0))}function h(c){return function(){c.apply(void 0,arguments)}}function m(){function c(){for(var a;a=g.shift();){var b=a.deferred,d=i==="fulfilled"?"resolve":"reject";if(typeof a[d]==="function")try{var c=(0,a[d])(j),e=c&&(typeof c===
"object"||typeof c==="function")&&c.then;if(typeof e==="function")if(c===b.promise)b.reject(new TypeError);else{var k=c.cancel;typeof k==="function"?b._protected(l).parentCancel=k.bind(c):delete b._protected(l).parentCancel;e.call(c,h(b.resolve),h(b.reject),h(b.progress))}else b.resolve(c)}catch(m){b.reject(m)}else b[d](j)}}function d(a){delete k.parentCancel;i="rejected";j=a;g.length&&e(c)}function q(a){function s(f){return function(a){h||(h=!0,f(a))}}var h=!1;delete k.parentCancel;try{var p=a&&
(typeof a==="object"||typeof a==="function")&&a.then;if(typeof p==="function")if(a===b)d(new TypeError);else{i="assumed";var l=a&&a.cancel;if(typeof l!=="function"){var n=new m,a=n.promise;try{p(n.resolve,n.reject,n.progress)}catch(o){n.reject(o)}l=a.cancel;p=a.then}j=a;p.call(a,s(q),s(d));k.parentCancel=l.bind(a)}else i="fulfilled",j=a,g.length&&e(c)}catch(f){s(d)(f)}}function p(){var a=k.parentCancel;if(a)delete k.parentCancel,a();else if(!i)a=Error("Cancel"),a.name="Cancel",d(a)}var j,i,g=[],b=
this,k={};Object.defineProperty(this,"_protected",{value:function(a){if(a!==l)throw Error("protected");return k}});this.resolve=function(a){i||q(a);return b};this.reject=function(a){i||d(a);return b};this.progress=function(a){i||g.forEach(function(b){if(b.progress)try{b.progress(a)}catch(c){}});return b.promise};this.cancel=function(){k.parentCancel?setTimeout(p,0):p();return b};this.then=function(a,d,k){a={resolve:a,reject:d,progress:k,deferred:new m};g.push(a);a.deferred._protected(l).parentCancel=
b.promise.cancel.bind(b);(i==="fulfilled"||i==="rejected")&&e(c);return a.deferred.promise};this.promise={then:b.then,cancel:b.cancel}}var l=[],r=!1;m.all=function(c,d){function e(c,a){g||(i[c]=a,--j===0&&b.resolve(i))}function h(c,a){if(!g){if(d)try{e(c,d(a));return}catch(i){a=i}b.reject(a)}}var j=c.length,i=[],g=!1,b=new m;b.then(void 0,function(){g=!0;c.forEach(function(b){b.cancel&&b.cancel()})});j===0?b.resolve(i):c.forEach(function(b,a){b.then(e.bind(void 0,a),h.bind(void 0,a))});return b.promise};
m.when=function(c,d,e,h){var j;if(!(c&&typeof c.then==="function"))j=new m,j.resolve(c),c=j.promise;return c.then(d,e,h)};return m});
(function(d,e){typeof define==="function"&&define.amd?define("orion/plugin",["orion/Deferred"],e):typeof exports==="object"?module.exports=e(require("orion/Deferred")):(d.orion=d.orion||{},d.orion.PluginProvider=e(d.orion.Deferred))})(this,function(d){function e(d,e){this.__objectId=d;this.__methods=e}return function(h){function m(f){b&&(typeof ArrayBuffer==="undefined"&&(f=JSON.stringify(f)),b===self?b.postMessage(f):b.postMessage(f,"*"))}function l(){var f=[];Object.keys(n).forEach(function(a){var b=
n[a];f.push({serviceId:a,names:b.names,methods:b.methods,properties:b.properties})});return{headers:i||{},services:f}}function r(f,a){if(a&&a instanceof XMLHttpRequest){var b,c;try{b=a.status,c=a.statusText}catch(d){b=0,c=""}return{status:b||0,statusText:c}}return a}function c(f){var a=f?JSON.parse(JSON.stringify(f,r)):f;if(f instanceof Error)a.__isError=!0,a.message=a.message||f.message,a.name=a.name||f.name;return a}function w(f){if(!b)return(new d).reject(Error("plugin not connected"));f.id=String(k++);
var c=new d;u[f.id]=c;c.then(null,function(a){g&&a instanceof Error&&a.name==="Cancel"&&o({requestId:f.id,method:"cancel",params:a.message?[a.message]:[]})});var i=Object.prototype.toString;f.params.forEach(function(b,d){if(i.call(b)==="[object Object]"&&!(b instanceof e)){var g,h;for(g in b)i.call(b[g])==="[object Function]"&&(h=h||[],h.push(g));if(h){var j=a++;v[j]=b;g=function(){delete v[j]};c.then(g,g);f.params[d]=new e(j,h)}}});o(f);return c.promise}function q(f,a){f||f===0?o({id:f,result:null,
error:a}):console.log(a)}function p(f,a,b,d){d.forEach(function(a,f){if(a&&typeof a.__objectId!=="undefined"){var b={};a.__methods.forEach(function(f){b[f]=function(){return w({objectId:a.__objectId,method:f,params:Array.prototype.slice.call(arguments)})}});d[f]=b}});var e=typeof f===void 0?null:{id:f,result:null,error:null};try{var g=b.apply(a,d);if(e)g&&typeof g.then==="function"?(t[f]=g,g.then(function(a){delete t[f];e.result=a;o(e)},function(a){if(t[f])delete t[f],e.error=c(a),o(e)},function(){o({responseId:f,
method:"progress",params:Array.prototype.slice.call(arguments)})})):(e.result=g,o(e))}catch(h){if(e)e.error=c(h),o(e)}}function j(a){if(a.source===b){a=typeof a.data!=="string"?a.data:JSON.parse(a.data);try{if(a.method){var c=a.method,d=a.params||[];if("serviceId"in a){var e=n[a.serviceId];e||q(a.id,"service not found");e=e.implementation;c in e?p(a.id,e,e[c],d):q(a.id,"method not found")}else if("objectId"in a){var g=v[a.objectId];g||q(a.id,"object not found");!c in g?p(a.id,g,g[c],d):q(a.id,"method not found")}else if("requestId"in
a){var h=t[a.requestId];h&&c==="cancel"&&h.cancel&&h.cancel.apply(h,d)}else if("responseId"in a){var i=u[a.responseId];i&&c==="progress"&&i.progress&&i.progress.apply(i,d)}else throw Error("Bad method: "+a.method);}else{var j=u[String(a.id)];delete u[String(a.id)];a.error?j.reject(a.error):j.resolve(a.result)}}catch(k){console.log("Plugin._messageHandler "+k)}}}var i=h,g=!1,b=null,k=0,a=0,s=0,t={},u={},v={},n={},o=m;this.updateHeaders=function(a){if(g)throw Error("Cannot update headers. Plugin Provider is connected");
i=a};this.registerServiceProvider=this.registerService=function(a,b,c){if(g)throw Error("Cannot register service. Plugin Provider is connected");typeof a==="string"?a=[a]:Array.isArray(a)||(a=[]);var d=null,e=[];for(d in b)typeof b[d]==="function"&&e.push(d);n[s++]={names:a,methods:e,implementation:b,properties:c||{},listeners:{}}};this.connect=function(a,c){if(!g){if(typeof window==="undefined")b=self;else if(window!==window.parent)b=window.parent;else if(window.opener!==null)b=window.opener;else{c&&
c("No valid plugin target");return}addEventListener("message",j,!1);var d={method:"plugin",params:[l()]};m(d);g=!0}a&&a()};this.disconnect=function(){g&&(removeEventListener("message",j),b=null,g=!1)}}});
define("orion/editor/stylers/text_x-yaml/syntax",[],function(){var d=["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:[{match:"^%(?:YAML|TAG)\\s.*",name:"meta.directive.yaml"},{match:"---|\\.\\.\\.",name:"meta.separator.yaml"},{begin:"^.*?:\\s",end:"$",contentName:"string.unquoted.yaml",patterns:[{include:"#numberSignComment"},{match:"^\\s*[&*]\\s*$",name:"entity.name.tag.yaml"},
{match:"(?i)^\\s*(?:"+d.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"}]}],repository:{numberSignComment:{match:"(?:^|\\s)#.*",name:"comment.line.number-sign.yaml",patterns:[{include:"orion.lib#todo_comment_singleLine"}]}}}],keywords:e.concat(d)}});
define('built-yamlPlugin.js',["orion/plugin","orion/editor/stylers/text_x-yaml/syntax"],function(d,e){var h=new d({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()});