text: /* reyaml-core v1.0.6 | git+https://github.com/cedricpoon/reyaml-core.git | licensed in MIT */
  !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).rc=e()}}(function(){return function(){return function e(t,n,r){function s(o,a){if(!n[o]){if(!t[o]){var c="function"==typeof require&&require;if(!a&&c)return c(o,!0);if(i)return i(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[o]={exports:{}};t[o][0].call(u.exports,function(e){return s(t[o][1][e]||e)},u,u.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}}()({1:[function(e,t,n){const r=({attributes:e,color:t})=>({attributes:{...e},nodeSvgShape:{shapeProps:{...t}}}),s="|+",i="|-",o={symbol:{section:"§",sectionLeft:"◦§",sectionRight:"§◦",keyPostfix:"⏎"},size:{tabSize:2,maxStringSize:15},wrapKeyPairScalar:i,appendBlockScalar:s,blockScalarTranslation:{[i]:s,[">-"]:s,[">+"]:s},nodeMap:{object:{d3:{attributes:{},nodeSvgShape:{shape:"circle",shapeProps:{r:10}}}},array:{d3:{attributes:{},nodeSvgShape:{shape:"rect",shapeProps:{width:15,height:15,x:-10,y:-5}}}}},marker:{name:"*",content:"**"},markerMap:{highlight:{name:"highlight",d3:r({color:{fill:"red",stroke:"red"}})},truncatedDown:{name:"truncatedDown",d3:r({attributes:{"":"⬇"},color:{fill:"lightgoldenrodyellow",stroke:"grey"}})},truncatedUp:{name:"truncatedUp",d3:r({attributes:{"":"⬆"},color:{fill:"lightgoldenrodyellow",stroke:"grey"}})},truncatedLeft:{name:"truncatedLeft",d3:r({attributes:{"":"⬅"},color:{fill:"lightcyan",stroke:"grey"}})},truncatedRight:{name:"truncatedRight",d3:r({attributes:{"":"⮕"},color:{fill:"lightcyan",stroke:"grey"}})}}};t.exports=o},{}],2:[function(e,t,n){const r=e("./lib/object/Ryaml"),s=e("./lib/object/Rjson");t.exports={Ryaml:r,Rjson:s}},{"./lib/object/Rjson":12,"./lib/object/Ryaml":13}],3:[function(e,t,n){const r=e=>null!==e.match(/^\s*#+/),s=e=>null!==e.match(/^\s*$/),i=e=>s(e)|r(e)|(e=>null!==e.match(/^-{3,}/))(e);t.exports={count_junk_line:({sourceYaml:e,lineNo:t})=>{return e.split("\n").reduce((e,n,r)=>e+=i(n)&&(null==t||r<=t)?1:0,0)},is_junk_line:i,is_parser_ignorable:e=>s(e)|r(e)}},{}],4:[function(e,t,n){t.exports={count_key:function({sourceObj:e}){const t=e=>"object"==typeof e?Object.keys(e).reduce((n,r)=>Array.isArray(e)?n+t(e[r]):"object"==typeof e[r]?++n+t(e[r]):++n,0):0;return t(e)}}},{}],5:[function(e,t,n){t.exports={insert:function({key:e,jsSource:t,jsNew:n}){const r=t=>Object.keys(t).filter(t=>t==e).map(e=>Object.assign(t[e],n));return Array.isArray(t)?t.filter(e=>null!=e).map(r):r(t),t}}},{}],6:[function(e,t,n){const r=e("../utils/traverse");t.exports={mark_line:function({marker:e,markerMap:t}){return function({sourceObj:n,lineNo:s}){return null!==s&&null!==n&&r(n).toLineNo(s).then((n,r)=>{!function(n,r){const s=n[r];n[r]={},n[r][e.name]=t.highlight.name,n[r][e.content]=s}(n,r)}),n}}}},{"../utils/traverse":16}],7:[function(e,t,n){t.exports=function(){return this.getKey=(e=>{const t=e.match(/[^:]*:/);return t?t[0]:null}),this.startWithKey=(e=>null!==this.getKey(e)),this.endWithScalar=(e=>null!==e.match(/:\s+[|>][+-]\s*$/)),this.getValue=(e=>{const t=e.match(/(:\s+)([^\s]+.*)/);return t&&3===t.length?t[2]:null}),this.hasNoValue=(e=>null!==e.match(/:\s*$/)),this.isKeyPair=(e=>this.startWithKey(e)&&!this.endWithScalar(e)&&null!==this.getValue(e)),this.isNode=(e=>this.startWithKey(e)||this.isArray(e)),this.isString=(e=>!this.startWithKey(e)&&!this.isArray(e)),this.isArray=(e=>null!==e.match(/^\s*-\s+[^-\s].*/)),this.countIndent=(e=>e.match(/^\s*/)[0].length),this.countIndentWithHyphen=(e=>e.match(/^\s*-*\s*/)[0].length),this.sanitizeRegex=(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),this.replace=((e,t)=>Object.keys(t).reduce((e,n)=>e.replace(new RegExp(n),t[n]),e)),this._trLn=((e,t)=>e.split("\n").reduce(({result:e,prevIndent:n,isScalar:r},s,i,o)=>!r&&this.isNode(s)?{result:e+`${t(i-1>0?o[i-1]:null,s,i+1<o.length?o[i+1]:null,i)}\n`,prevIndent:this.countIndentWithHyphen(s),isScalar:i+1<o.length&&(this.isNode(s)&&this.isString(o[i+1])||this.isKeyPair(s)&&this.countIndentWithHyphen(s)<this.countIndent(o[i+1])||this.startWithKey(s)&&this.endWithScalar(s))}:{result:e+`${s}\n`,prevIndent:n,isScalar:r&&i+1<o.length&&n<this.countIndent(o[i+1])},{result:"",prevIndent:0,isScalar:!1})),this.traverseNode=((e,t)=>this._trLn(e,t).result),this}()},{}],8:[function(e,t,n){const{is_parser_ignorable:r}=e("../count_junk_line"),s=e("./fn");function i(e){return this._yamlString=e,this.wrapKeyPair=(({tabSize:e,trailingScalar:t=""})=>i(s.traverseNode(this._yamlString,(n,r,i,o)=>s.isKeyPair(r)?`${s.getKey(r)} ${t}\n`+" ".repeat(s.countIndentWithHyphen(r)+e)+s.getValue(r):r))),this.appendBlockScalar=(({blockScalar:e})=>i(s.traverseNode(this._yamlString,(t,n,r,i)=>null!==r&&s.startWithKey(n)&&s.hasNoValue(n)&&!s.startWithKey(r)&&!s.isArray(r)?`${n} ${e}`:n))),this.removeEmptyLine=(()=>i(this._yamlString.split("\n").reduce((e,t)=>r(t)?e:e+=`${t}\n`,""))),this.unifyBlockScalar=(({blockScalarMap:e})=>{const t=Object.keys(e).reduce((t,n)=>(t[`${s.sanitizeRegex(n)}\\s*$`]=e[n],t),{});return i(s.traverseNode(this._yamlString,(e,n,r,i)=>s.startWithKey(n)&&s.endWithScalar(n)?s.replace(n,t):n))}),this.appendKey=(({postfix:e})=>i(s.traverseNode(this._yamlString,(t,n,r,i)=>{if(s.startWithKey(n)){const t=s.getKey(n);let r=":";return-1!==t.lastIndexOf('":')?r='":':-1!==t.lastIndexOf("':")&&(r="':"),`${t.substr(0,t.lastIndexOf(r))}${e}${n.substr(t.lastIndexOf(r))}`}return n}))),this.wipeSingularArray=(()=>{const e=[],t=[];let n=-1;s.traverseNode(this._yamlString,(r,i,o,a)=>{const c=s.countIndentWithHyphen(i);if(c>n)e.push({i:-1,ind:c});else if(c<n){let n;do{(n=e.pop())&&n.i>-1&&t.push(n.i)}while(e.length>0&&e[e.length-1].ind!==c)}s.isArray(i)&&s.startWithKey(i)&&(-1===e[e.length-1].i?e[e.length-1].i=a:e[e.length-1].i=-2),n=c});const r=this._yamlString.split("\n");return t.push(...e.filter(e=>e.i>-1).map(e=>e.i)),t.forEach(e=>{r[e]=r[e].replace("-"," ")}),i(r.join("\n"))}),this.result=(()=>this._yamlString),this}t.exports={patcher:i,patch_yaml:({blockScalarTranslation:e,size:t,symbol:n,wrapKeyPairScalar:r,appendBlockScalar:s})=>{return{default:({yamlString:e})=>e,d3Tree:({yamlString:o})=>i(o).removeEmptyLine().wipeSingularArray().unifyBlockScalar({blockScalarMap:e}).wrapKeyPair({tabSize:t.tabSize,trailingScalar:r}).appendKey({postfix:n.keyPostfix}).appendBlockScalar({blockScalar:s}).result()}}}},{"../count_junk_line":3,"./fn":7}],9:[function(e,t,n){const r=(e,t)=>e.length>t?e.substr(0,t-1)+"...":e;t.exports={transform_d3:function({marker:e,markerMap:t,nodeMap:n,symbol:s,size:i}){function o({sourceObj:e,nameHandler:t}){return null!=e&&Object.keys(e).length>1?a({sourceObj:{[s.section]:e},nameHandler:t}):a({sourceObj:e,nameHandler:t})}function a({sourceObj:s,nameHandler:o}){const c=[];return null!=s&&Object.keys(s).forEach(l=>{const{marked:u,type:h,pureContent:f}=function({sourceObj:t,key:n}){return t[n]&&Object.prototype.hasOwnProperty.call(t[n],e.name)?Object.prototype.hasOwnProperty.call(t[n],e.content)?{marked:!0,type:t[n][e.name],pureContent:t[n][e.content]}:{marked:!0,type:t[n][e.name],pureContent:null}:{marked:!1,type:null,pureContent:t[n]}}({sourceObj:s,key:l}),p=JSON.parse(JSON.stringify(Array.isArray(s)?n.array.d3:n.object.d3));if(u){const e=t[h].d3;p.attributes={...p.attributes,...e.attributes},p.nodeSvgShape.shapeProps={...p.nodeSvgShape.shapeProps,...e.nodeSvgShape.shapeProps}}if(p.name=o(Array.isArray(s)?`[${l}]`:l),c.push(p),"object"==typeof f){const e=a({sourceObj:f,nameHandler:o});p.children=e}else p.attributes={},p.attributes[""]=r(f,i.maxStringSize)}),c}return{default:({sourceObj:e})=>o({sourceObj:e,nameHandler:e=>r(e,i.maxStringSize)}),d3Tree:({sourceObj:e})=>o({sourceObj:e,nameHandler:e=>r(e.slice(-1)===s.keyPostfix?`${e.slice(0,-1)} `:e,i.maxStringSize)})}}}},{}],10:[function(e,t,n){(function(e){const n="undefined"!=typeof window?window.jsyaml:void 0!==e?e.jsyaml:null;t.exports={transform_js:function({yamlString:e}){try{let t=n.safeLoadAll(e);return t=1===t.length?t[0]:t}catch(e){return null}}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],11:[function(e,t,n){const r=e("../utils/traverse"),s=e("../utils/modify"),i=r();t.exports={truncate:function({marker:e,markerMap:t,symbol:n}){let o=!0;function a({level:n,sourceObj:s,o:i}){let{parent:a,i:c}=function({sourceObj:e,obj:t,level:n}){for(let s=0;s<n;s++){let i=!0;if(r(e).toObject(t).then((e,n)=>{i=!1,t=e}),i)return{parent:t,i:n-s}}return{parent:t,i:0}}({sourceObj:s,obj:i,level:Object.prototype.hasOwnProperty.call(i,e.name)?n+1:n});if(s!==a&&Object.keys(a).length>1&&o){const n={};n[e.name]=t.truncatedUp.name,Array.isArray(a)?n[e.content]=[...a]:n[e.content]={...a},a=n,c--}return function({sourceObj:n,level:r}){const s=(n,r)=>Object.keys(n).map(i=>{n[i]&&("object"==typeof n[i]&&r>0?s(n[i],r-(Object.prototype.hasOwnProperty.call(n[i],e.name)?0:1)):"object"==typeof n[i]&&o?(n[i]={},n[i][e.name]=t.truncatedDown.name):"object"==typeof n[i]&&(n[i]=null))});s(n,r)}({sourceObj:s=a,level:2*n-c}),s}const c=(t,r,i)=>{if(o){const o=Array.isArray(t)?{[e.name]:i.name}:{[r]:{[e.name]:i.name}};r===n.sectionLeft?s(t).prepend(o):s(t).append(o)}};function l({o:e,name:s,siblingSize:o}){if(e&&"object"==typeof e){const a=Object.keys(e),l=a.findIndex(e=>e===s);!function({o:e,names:r,siblingSize:s,pivot:i}){let o=!1;for(let t=0;t<i-s;t++)delete e[r[t]],o=!0;o&&c(e,n.sectionLeft,t.truncatedLeft)}({o:e,names:a,siblingSize:o,pivot:l}),function({o:e,names:s,siblingSize:o,pivot:a}){let l=0,u=!1;for(let h=a-o>0?a-o:0;h<a;h++)e[s[h]]&&r(e[s[h]]).eachInodes(i.from.RIGHT_TO_LEFT).whenNextLevel(e=>{l=0,u&&c(e,n.sectionLeft,t.truncatedLeft),u=!1}).then((e,t)=>{l++>=o&&(delete e[t],u=!0)})}({o:e,names:a,siblingSize:o,pivot:l}),function({o:e,names:r,siblingSize:s,pivot:i}){let o=!1;for(let t=r.length-1;t>i+s;t--)delete e[r[t]],o=!0;o&&c(e,n.sectionRight,t.truncatedRight)}({o:e,names:a,siblingSize:o,pivot:l}),function({o:e,names:s,siblingSize:o,pivot:a}){let l=0,u=!1;for(let h=a+o<s.length?a+o:s.length-1;h>a;h--)e[s[h]]&&r(e[s[h]]).eachInodes(i.from.LEFT_TO_RIGHT).whenNextLevel(e=>{l=0,u&&c(e,n.sectionRight,t.truncatedRight),u=!1}).then((e,t)=>{l++>=o&&(delete e[t],u=!0)})}({o:e,names:a,siblingSize:o,pivot:l})}}function u({siblingSize:t,sourceObj:n,targetObj:s}){return r(n).eachInodesWithObject(s).then((n,r)=>{Object.prototype.hasOwnProperty.call(n,e.name)||l({o:n,name:r,siblingSize:t})}),n}return function({sourceObj:t,level:n,siblingSize:s,lineNo:c,trimMark:h}){return o=h,null!==n&&null!==t&&r(t).toLineNo(c).then((o,c,h)=>{if(c===e.content||c===e.name){const e=h.toObject(o).return;o=e.o,c=e.name}if(n>=0&&(t=a({level:n,sourceObj:t,o:o})),s>=0)if(Object.prototype.hasOwnProperty.call(o[c],e.name)&&o[c][e.content]&&"object"==typeof o[c][e.content]){const{o:n,name:a}=r(o[c][e.content]).toDeepestTerminal(i.to.MIDDLE).return;t=u({siblingSize:s,sourceObj:t,targetObj:n}),l({o:n,name:a,siblingSize:s})}else t=u({siblingSize:s,sourceObj:t,targetObj:o[c]}),l({o:o,name:c,siblingSize:s})}),t}}}},{"../utils/modify":14,"../utils/traverse":16}],12:[function(e,t,n){const r=e("../../config"),{insert:s}=e("../func/insert"),{transform_d3:i}=e("../func/transform_d3"),{mark_line:o}=e("../func/mark_line"),{count_key:a}=e("../func/count_key"),{truncate:c}=e("../func/truncate"),l=e("../utils/traverse"),u=e("../utils/modify");class h{constructor(e,t=r){this._raw=e,this._config=JSON.parse(JSON.stringify(t))}clone(){return new h(JSON.parse(JSON.stringify(this._raw)))}insert({key:e,insertee:t}){return new h(s({key:e,jsSource:this.clone().raw,jsNew:t.clone().raw}))}markLine({lineNo:e}){return new h(o({...this._config})({sourceObj:this.clone().raw,lineNo:e}))}truncate({level:e,siblingSize:t,lineNo:n,trimMark:r=!0}){return new h(c({...this._config})({sourceObj:this.clone().raw,lineNo:n,level:e,siblingSize:t,trimMark:r}))}traverse(e){return new h(e(l(this.clone().raw)).self)}modify(e){return new h(e(u(this.clone().raw)).self)}toD3({profile:e="default"}={}){return i({...this._config})[e]({sourceObj:this._raw})}get keyCount(){return a({sourceObj:this._raw})}get raw(){return this._raw}}t.exports=h},{"../../config":1,"../func/count_key":4,"../func/insert":5,"../func/mark_line":6,"../func/transform_d3":9,"../func/truncate":11,"../utils/modify":14,"../utils/traverse":16}],13:[function(e,t,n){const r=e("../../config"),{count_junk_line:s,is_junk_line:i}=e("../func/count_junk_line"),{transform_js:o}=e("../func/transform_js"),{patcher:a,patch_yaml:c}=e("../func/patch_yaml"),l=e("./Rjson");class u{static isJunkLine({line:e}){return i(e)}constructor(e,t=r){this._raw=e,this._config=JSON.parse(JSON.stringify(t))}countJunkLine({lineNo:e}={}){return s({sourceYaml:this._raw,lineNo:e})}patch(e){return new u(e(a(this._raw)).result())}toRjson({profile:e="default"}={}){return new l(o({yamlString:c({...this._config})[e]({yamlString:this._raw})}))}get raw(){return this._raw}}t.exports=u},{"../../config":1,"../func/count_junk_line":3,"../func/patch_yaml":8,"../func/transform_js":10,"./Rjson":12}],14:[function(e,t,n){class r{constructor(e){this._source=e}append(e){if(Array.isArray(this._source)){const t=Object.keys(this._source);t.length>0&&t[t.length-1]<this._source.length-1?this._source[parseInt(t[t.length-1])+1]=e:this._source.push(e)}else Object.keys(e).forEach(t=>{this._source[t]=e[t]});return this}prepend(e){if(Array.isArray(this._source)){const t=Object.keys(this._source);t[0]&&t[0]>0?this._source[t[0]-1]=e:this._source.unshift(e)}else{const t=new r({});Object.keys(this._source).forEach(n=>{this._source[n]!==e&&(t.append({[n]:this._source[n]}),delete this._source[n])}),this.append(e),this.append(t.self)}return this}get self(){return this._source}}t.exports=(e=>e?new r(e):r)},{}],15:[function(e,t,n){t.exports=function(){return this.getNumberOfNewLineChar=(e=>{if("string"==typeof e){const t=e.match(/\n/g);return t?t.length:0}return 0}),this}()},{}],16:[function(e,t,n){const r=e("./fn");class s{static get from(){return{LEFT_TO_RIGHT:0,RIGHT_TO_LEFT:1}}static get to(){return{FIRST:0,MIDDLE:1,LAST:2}}constructor(e){this._source=e,this._run=(()=>{})}eachInodes(e=s.from.LEFT_TO_RIGHT){return this._run=((t,n)=>{const r=[],i=i=>{if(i){const o=Object.keys(i);e===s.from.RIGHT_TO_LEFT&&o.reverse(),o.forEach(e=>{t(i,e,this),"object"==typeof i[e]&&r.push({name:e,o:i})}),n(i,this)}};for("object"==typeof this._source&&i(this._source);r.length>0;){const{name:e,o:t}=r.shift();i(t[e])}}),new i(this)}eachInodesWithObject(e){return this._run=(t=>{const n=[],r=t=>{if(t){return Object.keys(t).reduce((s,i)=>{if("object"==typeof t[i]){const e=r(t[i]);return e&&n.push(i),e||s}return e===t||s},!1)}};r(this._source);const s=e=>{n.length>0&&(t(e,n[n.length-1],this),s(e[n.pop()]))};s(this._source)}),this}toDeepestTerminal(e=s.to.FIRST){return this._run=(t=>{const{o:n}=this.eachInodes(s.from.RIGHT_TO_LEFT).return;if(n){const r=Object.keys(n);switch(e){case s.to.FIRST:t(n,r[0],this);break;case s.to.MIDDLE:t(n,r[Math.floor(r.length/2)],this);break;case s.to.LAST:t(n,r[r.length-1],this)}}}),this}toLineNo(e){return this._run=(t=>{const n=({sourceObj:e,lineNo:s,index:i})=>{if(e){const o=Object.keys(e);let a=0;for(;a<o.length;a++){const c=o[a];if(!Array.isArray(e)||"object"!=typeof e[c]){const n=r.getNumberOfNewLineChar(e[c]);0===n&&i===s?t(e,c,this):n>0&&(s>=i&&s<=i+n&&t(e,c,this),i+=n),i++}"object"==typeof e[c]&&(i=n({sourceObj:e[c],lineNo:s,index:i}))}}return i};n({sourceObj:this._source,lineNo:e,index:0})}),this}toObject(e){return this._run=(t=>{const n=({sourceObj:e,obj:r})=>{e&&Object.keys(e).map(s=>{r===e[s]?t(e,s,this):"object"==typeof e[s]&&n({sourceObj:e[s],obj:r})})};n({sourceObj:this._source,obj:e})}),this}then(e){return this._run(e),this}get return(){let e=null,t=null;return this._run((n,r)=>{e=n,t=r}),{o:e,name:t}}get self(){return this._source}}class i extends s{constructor(e){super(e._source),super._run=e._run,this._nextLevel=(()=>{})}whenNextLevel(e){return this._nextLevel=e,this}then(e){return this._run(e,this._nextLevel),this}get return(){let e=null,t=null;return this._run((n,r)=>{e=n,t=r},this._nextLevel),{o:e,name:t}}}t.exports=(e=>e?new s(e):s)},{"./fn":15}]},{},[2])(2)});
  