diff --git a/build/xypic.js b/build/xypic.js index 4739ff1..da153f0 100644 --- a/build/xypic.js +++ b/build/xypic.js @@ -1 +1 @@ -!function(){"use strict";var e={226:function(e,t){MathJax._.components.global.isObject,MathJax._.components.global.combineConfig,t.PV=MathJax._.components.global.combineDefaults,MathJax._.components.global.combineWithMathJax,t.NI=MathJax._.components.global.MathJax},150:function(e,t){t.v=MathJax._.core.MmlTree.MML.MML},113:function(e,t){t.Ls=MathJax._.core.MmlTree.MmlNode.TEXCLASS,MathJax._.core.MmlTree.MmlNode.TEXCLASSNAMES,MathJax._.core.MmlTree.MmlNode.indentAttributes,t.oI=MathJax._.core.MmlTree.MmlNode.AbstractMmlNode,MathJax._.core.MmlTree.MmlNode.AbstractMmlTokenNode,MathJax._.core.MmlTree.MmlNode.AbstractMmlLayoutNode,MathJax._.core.MmlTree.MmlNode.AbstractMmlBaseNode,MathJax._.core.MmlTree.MmlNode.AbstractMmlEmptyNode,MathJax._.core.MmlTree.MmlNode.TextNode,MathJax._.core.MmlTree.MmlNode.XMLNode},272:function(e,t){MathJax._.util.BBox.BBoxStyleAdjust,t.bK=MathJax._.util.BBox.BBox},54:function(e,t){t.VK=MathJax._.input.tex.Configuration.Configuration,MathJax._.input.tex.Configuration.ConfigurationHandler,MathJax._.input.tex.Configuration.ParserConfiguration},443:function(e,t){t.Z=MathJax._.input.tex.ParseMethods.default},201:function(e,t){MathJax._.input.tex.SymbolMap.AbstractSymbolMap,MathJax._.input.tex.SymbolMap.RegExpMap,MathJax._.input.tex.SymbolMap.AbstractParseMap,MathJax._.input.tex.SymbolMap.CharacterMap,MathJax._.input.tex.SymbolMap.DelimiterMap,MathJax._.input.tex.SymbolMap.MacroMap,t.QQ=MathJax._.input.tex.SymbolMap.CommandMap,t.QM=MathJax._.input.tex.SymbolMap.EnvironmentMap},850:function(e,t){t.Z=MathJax._.input.tex.TexError.default},592:function(e,t){t.Z=MathJax._.input.tex.TexParser.default},225:function(e,t){t.Z=MathJax._.input.tex.base.BaseMethods.default},990:function(e,t){MathJax._.output.chtml.Wrapper.FONTSIZE,MathJax._.output.chtml.Wrapper.SPACE,t.wO=MathJax._.output.chtml.Wrapper.CHTMLWrapper},268:function(e,t){t.w=MathJax._.output.chtml.Wrappers_ts.CHTMLWrappers},511:function(e,t){t.y=MathJax._.output.svg.Wrapper.SVGWrapper},0:function(e,t){t.N=MathJax._.output.svg.Wrappers_ts.SVGWrappers}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}!function(){var e=n(226);(0,e.PV)(e.NI._,"output",{common:{Wrapper:{}},chtml:{Wrapper:{},Wrappers_ts:{}},svg:{Wrapper:{},Wrappers_ts:{}}});var t=n(54),r=n(201),i=n(225),a=n(443),o=n(592),u=n(850);function s(e,t){return console.error(e,t),new u.Z(e,t)}var c={whiteSpaceRegex:/^(\s+|%[^\r\n]*(\r\n|\r|\n)?)+/,lengthResolution:128,interpolationResolution:5,machinePrecision:1e-12};function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){for(var n=0;n=this.length())throw Error("no such element at "+e+". index must be lower than "+this.length()+".");for(var t=this,n=0;n=0;)t=new j(e[n],t),n-=1;return t};var R=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=t,this.tail=n}var t,n,r;return t=e,r=[{key:"unapply",value:function(e){return new Option.Some([e.head,e.tail])}}],(n=[{key:"toString",value:function(){return"("+this.head+"~"+this.tail+")"}}])&&T(t.prototype,n),r&&T(t,r),e}();function F(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function G(e,t){for(var n=0;n>1,this.offset=this.source.length}},{key:"drop",value:function(e){var t,n;for(t=this,n=e;n>0;)t=t.rest(),n-=1;return t}}]),e}();Y.EofCh="\x03";var $=function(){function e(){H(this,e)}return J(e,null,[{key:"parse",value:function(e,t){return e.apply(t)}},{key:"parseAll",value:function(t,n){return t.andl((function(){return e.eos()})).apply(n)}},{key:"parseString",value:function(t,n){var r=new Y(n,0,{lastNoSuccess:void 0});return e.parse(t,r)}},{key:"parseAllString",value:function(t,n){var r=new Y(n,0,{lastNoSuccess:void 0});return e.parseAll(t,r)}},{key:"_handleWhiteSpace",value:function(e){var t=e.context.whiteSpaceRegex,n=e.source,r=e.offset,i=t.exec(n.substring(r,n.length));return null!==i?r+i[0].length:r}},{key:"literal",value:function(t){return new ie((function(n){var r,i,a,o,u,s;for(r=n.source,i=n.offset,o=0,u=a=e._handleWhiteSpace(n);o")}},{key:"andl",value:function(e){return this.flatMap((function(t){return e().map((function(e){return t}))})).named("<~")}},{key:"or",value:function(e){return this.append(e).named("|")}},{key:"andOnce",value:function(e){var t=this;return new ae((function(){return t.flatMap((function(t){return $.commit(e).map((function(e){return new R(t,e)}))})).named("~!")}))}},{key:"longestOr",value:function(t){var n=this;return new e((function(e){var r,i;return r=n.apply(e),i=t()(e),r.successful?i.successful?i.next.pos().isLessThan(r.next.pos())?r:i:r:i.successful?i:r instanceof re||i.next.pos().isLessThan(r.next.pos())?r:i})).named("|||")}},{key:"to",value:function(e){return this.map(e).named(this.toString()+"^^")}},{key:"ret",value:function(t){var n=this;return new e((function(e){return n.apply(e).map((function(e){return t()}))})).named(this.toString()+"^^^")}},{key:"toIfPossible",value:function(t,n){void 0===n&&(n=function(e){return"Constructor function not defined at "+e});var r=this;return new e((function(e){return r.apply(e).mapPartial(t,n)})).named(this.toString()+"^?")}},{key:"into",value:function(e){return this.flatMap(e)}},{key:"rep",value:function(){var e=this;return $.rep((function(){return e}))}},{key:"chain",value:function(e){var t,n;return t=this,n=function(){return t},$.chainl1(n,n,e)}},{key:"rep1",value:function(){var e=this;return $.rep1((function(){return e}))}},{key:"opt",value:function(){var e=this;return $.opt((function(){return e}))}}]),e}();$.Parser=ie;var ae=function(e){Q(n,e);var t=N(n);function n(e){return H(this,n),t.call(this,e)}return J(n,[{key:"and",value:function(e){var t=this;return new n((function(){return t.flatMap((function(t){return $.commit(e).map((function(e){return R(t,e)}))}))})).named("~")}}]),n}(ie);$.OnceParser=ae;var oe=n(113),ue=n(150);function se(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ce(e,t){for(var n=0;n"}}]),e}(),Ce.Vector.Angle=function(){function e(t){be(this,e),this.degree=t}return ye(e,[{key:"toString",value:function(){return"a("+this.degree+")"}}]),e}(),Ce.Vector.Dir=function(){function e(t,n){be(this,e),this.dir=t,this.dimen=n}return ye(e,[{key:"toString",value:function(){return"/"+this.dir+" "+this.dimen+"/"}}]),e}(),Ce.Vector.Corner=function(){function e(t,n){be(this,e),this.corner=t,this.factor=n}return ye(e,[{key:"toString",value:function(){return this.corner.toString()+"("+this.factor+")"}}]),e}(),(Ce.Corner=function e(){be(this,e)}).L=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"L"}}]),e}(),Ce.Corner.R=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"R"}}]),e}(),Ce.Corner.D=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"D"}}]),e}(),Ce.Corner.U=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"U"}}]),e}(),Ce.Corner.CL=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"CL"}}]),e}(),Ce.Corner.CR=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"CR"}}]),e}(),Ce.Corner.CD=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"CD"}}]),e}(),Ce.Corner.CU=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"CU"}}]),e}(),Ce.Corner.LD=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"LD"}}]),e}(),Ce.Corner.RD=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"RD"}}]),e}(),Ce.Corner.LU=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"LU"}}]),e}(),Ce.Corner.RU=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"RU"}}]),e}(),Ce.Corner.NearestEdgePoint=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"E"}}]),e}(),Ce.Corner.PropEdgePoint=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"P"}}]),e}(),Ce.Corner.Axis=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"A"}}]),e}(),(Ce.Place=function(){function e(t,n,r,i){be(this,e),this.shaveP=t,this.shaveC=n,this.factor=r,this.slide=i}return ye(e,[{key:"compound",value:function(e){return new Ce.Place(this.shaveP+e.shaveP,this.shaveC+e.shaveC,void 0===e.factor?this.factor:e.factor,e.slide)}},{key:"toString",value:function(){for(var e="",t=0;t";return void 0!==this.factor&&(e+="("+this.factor+")"),this.slide.dimen.foreach((function(t){e+="/"+t+"/"})),e}}]),e}()).Factor=function(){function e(t){be(this,e),this.factor=t}return ye(e,[{key:"isIntercept",get:function(){return!1}},{key:"toString",value:function(){return this.factor.toString()}}]),e}(),Ce.Place.Intercept=function(){function e(t){be(this,e),this.pos=t}return ye(e,[{key:"isIntercept",get:function(){return!0}},{key:"toString",value:function(){return"!{"+this.pos+"}"}}]),e}(),Ce.Slide=function(){function e(t){be(this,e),this.dimen=t}return ye(e,[{key:"toString",value:function(){return this.dimen.getOrElse("")}}]),e}(),Ce.Object=function(){function e(t,n){be(this,e),this.modifiers=t,this.object=n}return ye(e,[{key:"dirVariant",value:function(){return this.object.dirVariant()}},{key:"dirMain",value:function(){return this.object.dirMain()}},{key:"isDir",value:function(){return this.object.isDir()}},{key:"toString",value:function(){return this.modifiers.mkString()+this.object.toString()}}]),e}(),(Ce.ObjectBox=function(){function e(){be(this,e)}return ye(e,[{key:"isEmpty",get:function(){return!1}},{key:"dirVariant",value:function(){}},{key:"dirMain",value:function(){}},{key:"isDir",value:function(){return!1}}]),e}()).Text=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).math=e,r}return ye(n,[{key:"toString",value:function(){return"{"+this.math.toString()+"}"}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Empty=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"isEmpty",get:function(){return!0}},{key:"toString",value:function(){return"{}"}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Xymatrix=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).xymatrix=e,r}return ye(n,[{key:"toString",value:function(){return this.xymatrix.toString()}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Txt=function(e){ve(n,e);var t=ge(n);function n(e,r){var i;return be(this,n),(i=t.call(this)).width=e,i.textObject=r,i}return ye(n,[{key:"toString",value:function(){return"\\txt"+this.width+"{"+this.textObject.toString()+"}"}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Txt.Width=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return n}(Ce.ObjectBox),Ce.ObjectBox.Txt.Width.Vector=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).vector=e,r}return ye(n,[{key:"toString",value:function(){return this.vector.toString()}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Txt.Width.Default=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return""}}]),n}(Ce.ObjectBox),Ce.ObjectBox.WrapUpObject=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).object=e,r}return ye(n,[{key:"toString",value:function(){return"\\object"+this.object.toString()}}]),n}(Ce.ObjectBox),Ce.ObjectBox.CompositeObject=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).objects=e,r}return ye(n,[{key:"toString",value:function(){return"\\composite{"+this.objects.mkString(" * ")+"}"}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Xybox=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).posDecor=e,r}return ye(n,[{key:"toString",value:function(){return"\\xybox{"+this.posDecor.toString()+"}"}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Cir=function(e){ve(n,e);var t=ge(n);function n(e,r){var i;return be(this,n),(i=t.call(this)).radius=e,i.cir=r,i}return ye(n,[{key:"toString",value:function(){return"\\cir"+this.radius+"{"+this.cir+"}"}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Cir.Radius=function e(){be(this,e)},Ce.ObjectBox.Cir.Radius.Vector=function(){function e(t){be(this,e),this.vector=t}return ye(e,[{key:"toString",value:function(){return this.vector.toString()}}]),e}(),Ce.ObjectBox.Cir.Radius.Default=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return""}}]),e}(),Ce.ObjectBox.Cir.Cir=function e(){be(this,e)},Ce.ObjectBox.Cir.Cir.Segment=function(){function e(t,n,r){be(this,e),this.startDiag=t,this.orient=n,this.endDiag=r}return ye(e,[{key:"toString",value:function(){return this.startDiag.toString()+this.orient+this.endDiag}}]),e}(),Ce.ObjectBox.Cir.Cir.Full=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return""}}]),e}(),Ce.ObjectBox.Dir=function(e){ve(n,e);var t=ge(n);function n(e,r){var i;return be(this,n),(i=t.call(this)).variant=e,i.main=r,i}return ye(n,[{key:"dirVariant",value:function(){return this.variant}},{key:"dirMain",value:function(){return this.main}},{key:"isDir",value:function(){return!0}},{key:"toString",value:function(){return"\\dir"+this.variant+"{"+this.main+"}"}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Curve=function(e){ve(n,e);var t=ge(n);function n(e,r,i){var a;return be(this,n),(a=t.call(this)).modifiers=e,a.objects=r,a.poslist=i,a}return ye(n,[{key:"dirVariant",value:function(){return""}},{key:"dirMain",value:function(){return"-"}},{key:"isDir",value:function(){return!1}},{key:"toString",value:function(){return"\\curve"+this.modifiers.mkString("")+"{"+this.objects.mkString(" ")+" "+this.poslist.mkString("&")+"}"}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Curve.Modifier=function e(){be(this,e)},Ce.ObjectBox.Curve.Modifier.p=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~p"}}]),e}(),Ce.ObjectBox.Curve.Modifier.P=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~P"}}]),e}(),Ce.ObjectBox.Curve.Modifier.l=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~l"}}]),e}(),Ce.ObjectBox.Curve.Modifier.L=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~L"}}]),e}(),Ce.ObjectBox.Curve.Modifier.c=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~c"}}]),e}(),Ce.ObjectBox.Curve.Modifier.C=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~C"}}]),e}(),Ce.ObjectBox.Curve.Modifier.pc=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~pc"}}]),e}(),Ce.ObjectBox.Curve.Modifier.pC=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~pC"}}]),e}(),Ce.ObjectBox.Curve.Modifier.Pc=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~Pc"}}]),e}(),Ce.ObjectBox.Curve.Modifier.PC=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~PC"}}]),e}(),Ce.ObjectBox.Curve.Modifier.lc=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~lc"}}]),e}(),Ce.ObjectBox.Curve.Modifier.lC=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~lC"}}]),e}(),Ce.ObjectBox.Curve.Modifier.Lc=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~Lc"}}]),e}(),Ce.ObjectBox.Curve.Modifier.LC=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~LC"}}]),e}(),Ce.ObjectBox.Curve.Modifier.cC=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~cC"}}]),e}(),Ce.ObjectBox.Curve.Object=function e(){be(this,e)},Ce.ObjectBox.Curve.Object.Drop=function(){function e(t){be(this,e),this.object=t}return ye(e,[{key:"toString",value:function(){return"~*"+this.object}}]),e}(),Ce.ObjectBox.Curve.Object.Connect=function(){function e(t){be(this,e),this.object=t}return ye(e,[{key:"toString",value:function(){return"~**"+this.object}}]),e}(),Ce.ObjectBox.Curve.PosList=function e(){be(this,e)},Ce.ObjectBox.Curve.PosList.CurPos=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return""}}]),e}(),Ce.ObjectBox.Curve.PosList.Pos=function(){function e(t){be(this,e),this.pos=t}return ye(e,[{key:"toString",value:function(){return this.pos.toString()}}]),e}(),Ce.ObjectBox.Curve.PosList.AddStack=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~@"}}]),e}(),(Ce.Modifier=function e(){be(this,e)}).Vector=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).vector=e,r}return ye(n,[{key:"toString",value:function(){return"!"+this.vector}}]),n}(Ce.Modifier),Ce.Modifier.RestoreOriginalRefPoint=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"!"}}]),n}(Ce.Modifier),Ce.Modifier.AddOp=function(e){ve(n,e);var t=ge(n);function n(e,r){var i;return be(this,n),(i=t.call(this)).op=e,i.size=r,i}return ye(n,[{key:"toString",value:function(){return this.op.toString()+" "+this.size}}]),n}(Ce.Modifier),Ce.Modifier.AddOp.Grow=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"+"}}]),e}(),Ce.Modifier.AddOp.Shrink=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"-"}}]),e}(),Ce.Modifier.AddOp.Set=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"="}}]),e}(),Ce.Modifier.AddOp.GrowTo=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"+="}}]),e}(),Ce.Modifier.AddOp.ShrinkTo=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"-="}}]),e}(),Ce.Modifier.AddOp.VactorSize=function(){function e(t){be(this,e),this.vector=t}return ye(e,[{key:"isDefault",get:function(){return!1}},{key:"toString",value:function(){return this.vector.toString()}}]),e}(),Ce.Modifier.AddOp.DefaultSize=function(){function e(){be(this,e)}return ye(e,[{key:"isDefault",get:function(){return!0}},{key:"toString",value:function(){return""}}]),e}(),Ce.Modifier.Shape=function e(){be(this,e)},Ce.Modifier.Shape.Point=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"[.]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.Rect=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"[]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.Alphabets=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).alphabets=e,r}return ye(n,[{key:"toString",value:function(){return"["+this.alphabets+"]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.DefineShape=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).shape=e,r}return ye(n,[{key:"toString",value:function(){return"["+this.shape+"]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.Circle=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"[o]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.L=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"[l]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.R=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"[r]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.U=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"[u]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.D=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"[d]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.C=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"[c]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.ChangeColor=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).colorName=e,r}return ye(n,[{key:"toString",value:function(){return"["+this.colorName+"]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.CompositeModifiers=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).modifiers=e,r}return ye(n,[{key:"toString",value:function(){return this.modifiers.mkString("")}}]),n}(Ce.Modifier),Ce.Modifier.Shape.Frame=function(e){ve(n,e);var t=ge(n);function n(e,r){var i;return be(this,n),(i=t.call(this)).main=e,i.options=r,i}return ye(n,[{key:"toString",value:function(){return"[F"+this.main+this.options.mkString("")+"]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.Frame.Radius=function(){function e(t){be(this,e),this.vector=t}return ye(e,[{key:"toString",value:function(){return":"+this.vector}}]),e}(),Ce.Modifier.Shape.Frame.Color=function(){function e(t){be(this,e),this.colorName=t}return ye(e,[{key:"toString",value:function(){return":"+this.colorName}}]),e}(),Ce.Modifier.Invisible=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"i"}}]),n}(Ce.Modifier),Ce.Modifier.Hidden=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"h"}}]),n}(Ce.Modifier),Ce.Modifier.Direction=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).direction=e,r}return ye(n,[{key:"toString",value:function(){return this.direction.toString()}}]),n}(Ce.Modifier),(Ce.Direction=function e(){be(this,e)}).Compound=function(){function e(t,n){be(this,e),this.dir=t,this.rots=n}return ye(e,[{key:"toString",value:function(){return this.dir.toString()+this.rots.mkString()}}]),e}(),Ce.Direction.Diag=function(){function e(t){be(this,e),this.diag=t}return ye(e,[{key:"toString",value:function(){return this.diag.toString()}}]),e}(),Ce.Direction.Vector=function(){function e(t){be(this,e),this.vector=t}return ye(e,[{key:"toString",value:function(){return"v"+this.vector.toString()}}]),e}(),Ce.Direction.ConstructVector=function(){function e(t){be(this,e),this.posDecor=t}return ye(e,[{key:"toString",value:function(){return"q{"+this.posDecor.toString()+"}"}}]),e}(),Ce.Direction.RotVector=function(){function e(t){be(this,e),this.vector=t}return ye(e,[{key:"toString",value:function(){return":"+this.vector.toString()}}]),e}(),Ce.Direction.RotAntiCW=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"_"}}]),e}(),Ce.Direction.RotCW=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"^"}}]),e}(),(Ce.Diag=function e(){be(this,e)}).Default=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return""}}]),e}(),Ce.Diag.Angle=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return this.symbol}}]),e}(),Ce.Diag.LD=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"symbol",get:function(){return"ld"}},{key:"ang",get:function(){return-3*Math.PI/4}},{key:"turn",value:function(e){return"^"===e?new Ce.Diag.RD:new Ce.Diag.LU}}]),n}(Ce.Diag.Angle),Ce.Diag.RD=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"symbol",get:function(){return"rd"}},{key:"ang",get:function(){return-Math.PI/4}},{key:"turn",value:function(e){return"^"===e?new Ce.Diag.RU:new Ce.Diag.LD}}]),n}(Ce.Diag.Angle),Ce.Diag.LU=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"symbol",get:function(){return"lu"}},{key:"ang",get:function(){return 3*Math.PI/4}},{key:"turn",value:function(e){return"^"===e?new Ce.Diag.LD:new Ce.Diag.RU}}]),n}(Ce.Diag.Angle),Ce.Diag.RU=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"symbol",get:function(){return"ru"}},{key:"ang",get:function(){return Math.PI/4}},{key:"turn",value:function(e){return"^"===e?new Ce.Diag.LU:new Ce.Diag.RD}}]),n}(Ce.Diag.Angle),Ce.Diag.L=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"symbol",get:function(){return"l"}},{key:"ang",get:function(){return Math.PI}},{key:"turn",value:function(e){return"^"===e?new Ce.Diag.D:new Ce.Diag.U}}]),n}(Ce.Diag.Angle),Ce.Diag.R=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"symbol",get:function(){return"r"}},{key:"ang",get:function(){return 0}},{key:"turn",value:function(e){return"^"===e?new Ce.Diag.U:new Ce.Diag.D}}]),n}(Ce.Diag.Angle),Ce.Diag.D=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"symbol",get:function(){return"d"}},{key:"ang",get:function(){return-Math.PI/2}},{key:"turn",value:function(e){return"^"===e?new Ce.Diag.R:new Ce.Diag.L}}]),n}(Ce.Diag.Angle),Ce.Diag.U=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"symbol",get:function(){return"u"}},{key:"ang",get:function(){return Math.PI/2}},{key:"turn",value:function(e){return"^"===e?new Ce.Diag.L:new Ce.Diag.R}}]),n}(Ce.Diag.Angle),Ce.ObjectBox.Frame=function(e){ve(n,e);var t=ge(n);function n(e,r){var i;return be(this,n),(i=t.call(this)).radius=e,i.main=r,i}return ye(n,[{key:"toString",value:function(){return"\\frm"+this.radius+"{"+this.main+"}"}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Frame.Radius=function e(){be(this,e)},Ce.ObjectBox.Frame.Radius.Vector=function(){function e(t){be(this,e),this.vector=t}return ye(e,[{key:"toString",value:function(){return this.vector.toString()}}]),e}(),Ce.ObjectBox.Frame.Radius.Default=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return""}}]),e}(),Ce.Decor=function(){function e(t){be(this,e),this.commands=t}return ye(e,[{key:"toString",value:function(){return this.commands.mkString(" ")}}]),e}(),(Ce.Command=function e(){be(this,e)}).Save=function(){function e(t){be(this,e),this.pos=t}return ye(e,[{key:"toString",value:function(){return"\\save "+this.pos}}]),e}(),Ce.Command.Restore=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"\\restore"}}]),e}(),Ce.Command.Pos=function(){function e(t){be(this,e),this.pos=t}return ye(e,[{key:"toString",value:function(){return"\\POS "+this.pos}}]),e}(),Ce.Command.AfterPos=function(){function e(t,n){be(this,e),this.decor=t,this.pos=n}return ye(e,[{key:"toString",value:function(){return"\\afterPOS{"+this.decor+"} "+this.pos}}]),e}(),Ce.Command.Drop=function(){function e(t){be(this,e),this.object=t}return ye(e,[{key:"toString",value:function(){return"\\drop "+this.object}}]),e}(),Ce.Command.Connect=function(){function e(t){be(this,e),this.object=t}return ye(e,[{key:"toString",value:function(){return"\\connect "+this.object}}]),e}(),Ce.Command.Relax=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"\\relax"}}]),e}(),Ce.Command.Ignore=function(){function e(t,n){be(this,e),this.pos=t,this.decor=n}return ye(e,[{key:"toString",value:function(){return"\\ignore{"+this.pos+" "+this.decor+"}"}}]),e}(),Ce.Command.ShowAST=function(){function e(t,n){be(this,e),this.pos=t,this.decor=n}return ye(e,[{key:"toString",value:function(){return"\\xyshowAST{"+this.pos+" "+this.decor+"}"}}]),e}(),Ce.Command.Path=function(){function e(t){be(this,e),this.path=t}return ye(e,[{key:"toString",value:function(){return"\\PATH "+this.path}}]),e}(),Ce.Command.AfterPath=function(){function e(t,n){be(this,e),this.decor=t,this.path=n}return ye(e,[{key:"toString",value:function(){return"\\afterPATH{"+this.decor+"} "+this.path}}]),e}(),Ce.Command.Path.Path=function(){function e(t){be(this,e),this.pathElements=t}return ye(e,[{key:"toString",value:function(){return this.pathElements.mkString("[",", ","]")}}]),e}(),Ce.Command.Path.SetBeforeAction=function(){function e(t){be(this,e),this.posDecor=t}return ye(e,[{key:"toString",value:function(){return"~={"+this.posDecor+"}"}}]),e}(),Ce.Command.Path.SetAfterAction=function(){function e(t){be(this,e),this.posDecor=t}return ye(e,[{key:"toString",value:function(){return"~/{"+this.posDecor+"}"}}]),e}(),Ce.Command.Path.AddLabelNextSegmentOnly=function(){function e(t){be(this,e),this.labels=t}return ye(e,[{key:"toString",value:function(){return"~<{"+this.labels+"}"}}]),e}(),Ce.Command.Path.AddLabelLastSegmentOnly=function(){function e(t){be(this,e),this.labels=t}return ye(e,[{key:"toString",value:function(){return"~>{"+this.labels+"}"}}]),e}(),Ce.Command.Path.AddLabelEverySegment=function(){function e(t){be(this,e),this.labels=t}return ye(e,[{key:"toString",value:function(){return"~+{"+this.labels+"}"}}]),e}(),Ce.Command.Path.StraightSegment=function(){function e(t){be(this,e),this.segment=t}return ye(e,[{key:"toString",value:function(){return"'"+this.segment}}]),e}(),Ce.Command.Path.TurningSegment=function(){function e(t,n){be(this,e),this.turn=t,this.segment=n}return ye(e,[{key:"toString",value:function(){return"`"+this.turn+" "+this.segment}}]),e}(),Ce.Command.Path.LastSegment=function(){function e(t){be(this,e),this.segment=t}return ye(e,[{key:"toString",value:function(){return this.segment.toString()}}]),e}(),Ce.Command.Path.Turn=function e(){be(this,e)},Ce.Command.Path.Turn.Diag=function(){function e(t,n){be(this,e),this.diag=t,this.radius=n}return ye(e,[{key:"toString",value:function(){return this.diag.toString()+" "+this.radius}}]),e}(),Ce.Command.Path.Turn.Cir=function(){function e(t,n){be(this,e),this.cir=t,this.radius=n}return ye(e,[{key:"toString",value:function(){return this.cir.toString()+" "+this.radius}}]),e}(),Ce.Command.Path.TurnRadius=function e(){be(this,e)},Ce.Command.Path.TurnRadius.Default=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return""}}]),e}(),Ce.Command.Path.TurnRadius.Dimen=function(){function e(t){be(this,e),this.dimen=t}return ye(e,[{key:"toString",value:function(){return"/"+this.dimen}}]),e}(),Ce.Command.Path.Segment=function(){function e(t,n,r){be(this,e),this.pos=t,this.slide=n,this.labels=r}return ye(e,[{key:"toString",value:function(){return this.pos.toString()+" "+this.slide+" "+this.labels}}]),e}(),Ce.Command.Path.Labels=function(){function e(t){be(this,e),this.labels=t}return ye(e,[{key:"toString",value:function(){return this.labels.mkString(" ")}}]),e}(),Ce.Command.Path.Label=function e(t,n,r){be(this,e),this.anchor=t,this.it=n,this.aliasOption=r},Ce.Command.Path.Label.Above=function(e){ve(n,e);var t=ge(n);function n(e,r,i){return be(this,n),t.call(this,e,r,i)}return ye(n,[{key:"toString",value:function(){return"^("+this.anchor+" "+this.it+" "+this.aliasOption+")"}}]),n}(Ce.Command.Path.Label),Ce.Command.Path.Label.Below=function(e){ve(n,e);var t=ge(n);function n(e,r,i){return be(this,n),t.call(this,e,r,i)}return ye(n,[{key:"toString",value:function(){return"_("+this.anchor+" "+this.it+" "+this.aliasOption+")"}}]),n}(Ce.Command.Path.Label),Ce.Command.Path.Label.At=function(e){ve(n,e);var t=ge(n);function n(e,r,i){return be(this,n),t.call(this,e,r,i)}return ye(n,[{key:"toString",value:function(){return"|("+this.anchor+" "+this.it+" "+this.aliasOption+")"}}]),n}(Ce.Command.Path.Label),Ce.Command.Ar=function(){function e(t,n){be(this,e),this.forms=t,this.path=n}return ye(e,[{key:"toString",value:function(){return"\\ar "+this.forms.mkString(" ")+" "+this.path}}]),e}(),Ce.Command.Ar.Form=function e(){be(this,e)},Ce.Command.Ar.Form.BuildArrow=function(e){ve(n,e);var t=ge(n);function n(e,r,i,a){var o;return be(this,n),(o=t.call(this)).variant=e,o.tailTip=r,o.stemConn=i,o.headTip=a,o}return ye(n,[{key:"toString",value:function(){return"@"+this.variant+"{"+this.tailTip.toString()+", "+this.stemConn.toString()+", "+this.headTip.toString()+"}"}}]),n}(Ce.Command.Ar.Form),Ce.Command.Ar.Form.ChangeVariant=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).variant=e,r}return ye(n,[{key:"toString",value:function(){return"@"+this.variant}}]),n}(Ce.Command.Ar.Form),Ce.Command.Ar.Form.Tip=function e(){be(this,e)},Ce.Command.Ar.Form.Tip.Tipchars=function(){function e(t){be(this,e),this.tipchars=t}return ye(e,[{key:"toString",value:function(){return this.tipchars}}]),e}(),Ce.Command.Ar.Form.Tip.Object=function(){function e(t){be(this,e),this.object=t}return ye(e,[{key:"toString",value:function(){return"*"+this.object}}]),e}(),Ce.Command.Ar.Form.Tip.Dir=function(){function e(t){be(this,e),this.dir=t}return ye(e,[{key:"toString",value:function(){return this.dir}}]),e}(),Ce.Command.Ar.Form.Conn=function e(){be(this,e)},Ce.Command.Ar.Form.Conn.Connchars=function(){function e(t){be(this,e),this.connchars=t}return ye(e,[{key:"toString",value:function(){return this.connchars}}]),e}(),Ce.Command.Ar.Form.Conn.Object=function(){function e(t){be(this,e),this.object=t}return ye(e,[{key:"toString",value:function(){return"*"+this.object}}]),e}(),Ce.Command.Ar.Form.Conn.Dir=function(){function e(t){be(this,e),this.dir=t}return ye(e,[{key:"toString",value:function(){return this.dir}}]),e}(),Ce.Command.Ar.Form.ChangeStem=function(){function e(t){be(this,e),this.connchar=t}return ye(e,[{key:"toString",value:function(){return"@"+this.connchar}}]),e}(),Ce.Command.Ar.Form.DashArrowStem=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"@!"}}]),e}(),Ce.Command.Ar.Form.CurveArrow=function(){function e(t,n){be(this,e),this.direction=t,this.dist=n}return ye(e,[{key:"toString",value:function(){return"@/"+this.direction+" "+this.dist+"/"}}]),e}(),Ce.Command.Ar.Form.CurveFitToDirection=function(){function e(t,n){be(this,e),this.outDirection=t,this.inDirection=n}return ye(e,[{key:"toString",value:function(){return"@("+this.outDirection+","+this.inDirection+")"}}]),e}(),Ce.Command.Ar.Form.CurveWithControlPoints=function(){function e(t){be(this,e),this.coord=t}return ye(e,[{key:"toString",value:function(){return"@`{"+this.coord+"}"}}]),e}(),Ce.Command.Ar.Form.AddShape=function(){function e(t){be(this,e),this.shape=t}return ye(e,[{key:"toString",value:function(){return"@["+this.shape+"]"}}]),e}(),Ce.Command.Ar.Form.AddModifiers=function(){function e(t){be(this,e),this.modifiers=t}return ye(e,[{key:"toString",value:function(){return"@*{"+this.modifiers.mkString(" ")+"}"}}]),e}(),Ce.Command.Ar.Form.Slide=function(){function e(t){be(this,e),this.slideDimen=t}return ye(e,[{key:"toString",value:function(){return"@<"+this.slideDimen+">"}}]),e}(),Ce.Command.Ar.Form.LabelAt=function(){function e(t,n){be(this,e),this.anchor=t,this.it=n}return ye(e,[{key:"toString",value:function(){return"|"+this.anchor+" "+this.it}}]),e}(),Ce.Command.Ar.Form.LabelAbove=function(){function e(t,n){be(this,e),this.anchor=t,this.it=n}return ye(e,[{key:"toString",value:function(){return"^"+this.anchor+" "+this.it}}]),e}(),Ce.Command.Ar.Form.LabelBelow=function(){function e(t,n){be(this,e),this.anchor=t,this.it=n}return ye(e,[{key:"toString",value:function(){return"_"+this.anchor+" "+this.it}}]),e}(),Ce.Command.Ar.Form.ReverseAboveAndBelow=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"@?"}}]),e}(),Ce.Command.Xymatrix=function(){function e(t,n){be(this,e),this.setup=t,this.rows=n}return ye(e,[{key:"toString",value:function(){return"\\xymatrix"+this.setup+"{\n"+this.rows.mkString("","\\\\\n","")+"\n}"}}]),e}(),Ce.Command.Xymatrix.Setup=function e(){be(this,e)},Ce.Command.Xymatrix.Setup.Prefix=function(){function e(t){be(this,e),this.prefix=t}return ye(e,[{key:"toString",value:function(){return'"'+this.prefix+'"'}}]),e}(),Ce.Command.Xymatrix.Setup.ChangeSpacing=function e(t,n){be(this,e),this.addop=t,this.dimen=n},Ce.Command.Xymatrix.Setup.ChangeSpacing.Row=function(e){ve(n,e);var t=ge(n);function n(e,r){return be(this,n),t.call(this,e,r)}return ye(n,[{key:"toString",value:function(){return"@R"+this.addop+this.dimen}}]),n}(Ce.Command.Xymatrix.Setup.ChangeSpacing),Ce.Command.Xymatrix.Setup.ChangeSpacing.Column=function(e){ve(n,e);var t=ge(n);function n(e,r){return be(this,n),t.call(this,e,r)}return ye(n,[{key:"toString",value:function(){return"@C"+this.addop+this.dimen}}]),n}(Ce.Command.Xymatrix.Setup.ChangeSpacing),Ce.Command.Xymatrix.Setup.ChangeSpacing.RowAndColumn=function(e){ve(n,e);var t=ge(n);function n(e,r){return be(this,n),t.call(this,e,r)}return ye(n,[{key:"toString",value:function(){return"@"+this.addop+this.dimen}}]),n}(Ce.Command.Xymatrix.Setup.ChangeSpacing),Ce.Command.Xymatrix.Setup.PretendEntrySize=function e(t){be(this,e),this.dimen=t},Ce.Command.Xymatrix.Setup.PretendEntrySize.Height=function(e){ve(n,e);var t=ge(n);function n(e){return be(this,n),t.call(this,e)}return ye(n,[{key:"toString",value:function(){return"@!R="+this.dimen}}]),n}(Ce.Command.Xymatrix.Setup.PretendEntrySize),Ce.Command.Xymatrix.Setup.PretendEntrySize.Width=function(e){ve(n,e);var t=ge(n);function n(e){return be(this,n),t.call(this,e)}return ye(n,[{key:"toString",value:function(){return"@!C="+this.dimen}}]),n}(Ce.Command.Xymatrix.Setup.PretendEntrySize),Ce.Command.Xymatrix.Setup.PretendEntrySize.HeightAndWidth=function(e){ve(n,e);var t=ge(n);function n(e){return be(this,n),t.call(this,e)}return ye(n,[{key:"toString",value:function(){return"@!="+this.dimen}}]),n}(Ce.Command.Xymatrix.Setup.PretendEntrySize),Ce.Command.Xymatrix.Setup.FixGrid=function e(){be(this,e)},Ce.Command.Xymatrix.Setup.FixGrid.Row=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"@!R"}}]),n}(Ce.Command.Xymatrix.Setup.FixGrid),Ce.Command.Xymatrix.Setup.FixGrid.Column=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"@!C"}}]),n}(Ce.Command.Xymatrix.Setup.FixGrid),Ce.Command.Xymatrix.Setup.FixGrid.RowAndColumn=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"@!"}}]),n}(Ce.Command.Xymatrix.Setup.FixGrid),Ce.Command.Xymatrix.Setup.AdjustEntrySize=function e(t,n){be(this,e),this.addop=t,this.dimen=n},Ce.Command.Xymatrix.Setup.AdjustEntrySize.Margin=function(e){ve(n,e);var t=ge(n);function n(e,r){return be(this,n),t.call(this,e,r)}return ye(n,[{key:"toString",value:function(){return"@M"+this.addop+this.dimen}}]),n}(Ce.Command.Xymatrix.Setup.AdjustEntrySize),Ce.Command.Xymatrix.Setup.AdjustEntrySize.Width=function(e){ve(n,e);var t=ge(n);function n(e,r){return be(this,n),t.call(this,e,r)}return ye(n,[{key:"toString",value:function(){return"@W"+this.addop+this.dimen}}]),n}(Ce.Command.Xymatrix.Setup.AdjustEntrySize),Ce.Command.Xymatrix.Setup.AdjustEntrySize.Height=function(e){ve(n,e);var t=ge(n);function n(e,r){return be(this,n),t.call(this,e,r)}return ye(n,[{key:"toString",value:function(){return"@H"+this.addop+this.dimen}}]),n}(Ce.Command.Xymatrix.Setup.AdjustEntrySize),Ce.Command.Xymatrix.Setup.AdjustLabelSep=function(){function e(t,n){be(this,e),this.addop=t,this.dimen=n}return ye(e,[{key:"toString",value:function(){return"@L"+this.addop+this.dimen}}]),e}(),Ce.Command.Xymatrix.Setup.SetOrientation=function(){function e(t){be(this,e),this.direction=t}return ye(e,[{key:"toString",value:function(){return"@"+this.direction}}]),e}(),Ce.Command.Xymatrix.Setup.AddModifier=function(){function e(t){be(this,e),this.modifier=t}return ye(e,[{key:"toString",value:function(){return"@*"+this.modifier}}]),e}(),Ce.Command.Xymatrix.Row=function(){function e(t){be(this,e),this.entries=t}return ye(e,[{key:"toString",value:function(){return this.entries.mkString(" & ")}}]),e}(),Ce.Command.Xymatrix.Entry=function e(){be(this,e)},Ce.Command.Xymatrix.Entry.SimpleEntry=function(e){ve(n,e);var t=ge(n);function n(e,r,i){var a;return be(this,n),(a=t.call(this)).modifiers=e,a.objectbox=r,a.decor=i,a}return ye(n,[{key:"isEmpty",get:function(){return!1}},{key:"toString",value:function(){return this.modifiers.mkString("**{","","}")+" "+this.objectbox+" "+this.decor}}]),n}(Ce.Command.Xymatrix.Entry),Ce.Command.Xymatrix.Entry.ObjectEntry=function(e){ve(n,e);var t=ge(n);function n(e,r,i){var a;return be(this,n),(a=t.call(this)).object=e,a.pos=r,a.decor=i,a}return ye(n,[{key:"isEmpty",get:function(){return!1}},{key:"toString",value:function(){return"*"+this.object+" "+this.pos+" "+this.decor}}]),n}(Ce.Command.Xymatrix.Entry),Ce.Command.Xymatrix.Entry.EmptyEntry=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).decor=e,r}return ye(n,[{key:"isEmpty",get:function(){return!0}},{key:"toString",value:function(){return""+this.decor}}]),n}(Ce.Command.Xymatrix.Entry),Ce.Command.Twocell=function(){function e(t,n,r){be(this,e),this.twocell=t,this.switches=n,this.arrow=r}return ye(e,[{key:"toString",value:function(){return this.twocell.toString()+this.switches.mkString("")+this.arrow}}]),e}(),Ce.Command.Twocell.Hops2cell=function e(t,n){be(this,e),this.hops=t,this.maybeDisplace=n},Ce.Command.Twocell.Twocell=function(e){ve(n,e);var t=ge(n);function n(e,r){return be(this,n),t.call(this,e,r)}return ye(n,[{key:"toString",value:function(){return"\\xtwocell["+this.hops+"]"+this.maybeDisplace.getOrElse("{}")}}]),n}(Ce.Command.Twocell.Hops2cell),Ce.Command.Twocell.UpperTwocell=function(e){ve(n,e);var t=ge(n);function n(e,r){return be(this,n),t.call(this,e,r)}return ye(n,[{key:"toString",value:function(){return"\\xuppertwocell["+this.hops+"]"+this.maybeDisplace.getOrElse("{}")}}]),n}(Ce.Command.Twocell.Hops2cell),Ce.Command.Twocell.LowerTwocell=function(e){ve(n,e);var t=ge(n);function n(e,r){return be(this,n),t.call(this,e,r)}return ye(n,[{key:"toString",value:function(){return"\\xlowertwocell["+this.hops+"]"+this.maybeDisplace.getOrElse("{}")}}]),n}(Ce.Command.Twocell.Hops2cell),Ce.Command.Twocell.CompositeMap=function(e){ve(n,e);var t=ge(n);function n(e,r){return be(this,n),t.call(this,e,r)}return ye(n,[{key:"toString",value:function(){return"\\xcompositemap["+this.hops+"]"+this.maybeDisplace.getOrElse("{}")}}]),n}(Ce.Command.Twocell.Hops2cell),Ce.Command.Twocell.Switch=function e(){be(this,e)},Ce.Command.Twocell.Switch.UpperLabel=function(){function e(t){be(this,e),this.label=t}return ye(e,[{key:"toString",value:function(){return"^"+this.label}}]),e}(),Ce.Command.Twocell.Switch.LowerLabel=function(){function e(t){be(this,e),this.label=t}return ye(e,[{key:"toString",value:function(){return"_"+this.label}}]),e}(),Ce.Command.Twocell.Switch.SetCurvature=function(){function e(t){be(this,e),this.nudge=t}return ye(e,[{key:"toString",value:function(){return this.nudge.toString()}}]),e}(),Ce.Command.Twocell.Switch.DoNotSetCurvedArrows=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"\\omit"}}]),e}(),Ce.Command.Twocell.Switch.PlaceModMapObject=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~!"}}]),e}(),Ce.Command.Twocell.Switch.ChangeHeadTailObject=function(){function e(t,n){be(this,e),this.what=t,this.object=n}return ye(e,[{key:"toString",value:function(){return"~"+this.what+"{"+this.object+"}"}}]),e}(),Ce.Command.Twocell.Switch.ChangeCurveObject=function(){function e(t,n,r){be(this,e),this.what=t,this.spacer=n,this.maybeObject=r}return ye(e,[{key:"toString",value:function(){return"~"+this.what+"{"+this.spacer+(this.maybeObject.isDefined?"~**"+this.maybeObject.get:"")+"}"}}]),e}(),Ce.Command.Twocell.Label=function(){function e(t,n){be(this,e),this.maybeNudge=t,this.labelObject=n}return ye(e,[{key:"toString",value:function(){return this.maybeNudge.toString()+this.labelObject}}]),e}(),Ce.Command.Twocell.Nudge=function e(){be(this,e)},Ce.Command.Twocell.Nudge.Number=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).number=e,r}return ye(n,[{key:"toString",value:function(){return"<"+this.number+">"}}]),n}(Ce.Command.Twocell.Nudge),Ce.Command.Twocell.Nudge.Omit=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"<\\omit>"}}]),n}(Ce.Command.Twocell.Nudge),Ce.Command.Twocell.Arrow=function e(){be(this,e)},Ce.Command.Twocell.Arrow.WithOrientation=function(e){ve(n,e);var t=ge(n);function n(e,r){var i;return be(this,n),(i=t.call(this)).tok=e,i.labelObject=r,i}return ye(n,[{key:"toString",value:function(){return"{["+this.tok+"] "+this.labelObject+"}"}}]),n}(Ce.Command.Twocell.Arrow),Ce.Command.Twocell.Arrow.WithPosition=function(e){ve(n,e);var t=ge(n);function n(e,r){var i;return be(this,n),(i=t.call(this)).nudge=e,i.labelObject=r,i}return ye(n,[{key:"toString",value:function(){return"{["+this.nudge+"] "+this.labelObject+"}"}}]),n}(Ce.Command.Twocell.Arrow),Ce.Command.Newdir=function(){function e(t,n){be(this,e),this.dirMain=t,this.compositeObject=n}return ye(e,[{key:"toString",value:function(){return"\\newdir{"+this.dirMain+"}{"+this.compositeObject+"}"}}]),e}(),Ce.Pos.Xyimport=function e(){be(this,e)},Ce.Pos.Xyimport.TeXCommand=function(e){ve(n,e);var t=ge(n);function n(e,r,i,a,o){var u;return be(this,n),(u=t.call(this)).width=e,u.height=r,u.xOffset=i,u.yOffset=a,u.graphics=o,u}return ye(n,[{key:"toString",value:function(){return"\\xyimport("+this.width+", "+this.height+")("+this.xOffset+", "+this.yOffset+"){"+this.graphics+"}"}}]),n}(Ce.Pos.Xyimport),Ce.Pos.Xyimport.Graphics=function(e){ve(n,e);var t=ge(n);function n(e,r,i,a,o){var u;return be(this,n),(u=t.call(this)).width=e,u.height=r,u.xOffset=i,u.yOffset=a,u.graphics=o,u}return ye(n,[{key:"toString",value:function(){return"\\xyimport("+this.width+", "+this.height+")("+this.xOffset+", "+this.yOffset+"){"+this.graphics+"}"}}]),n}(Ce.Pos.Xyimport),Ce.Command.Includegraphics=function(){function e(t,n,r){be(this,e),this.isClipped=t,this.attributeList=n,this.filepath=r}return ye(e,[{key:"isIncludegraphics",get:function(){return!0}},{key:"toString",value:function(){return"\\includegraphics"+(this.isClipped?"*":"")+this.attributeList.mkString("[",",","]")+"{"+this.filepath+"}"}}]),e}(),Ce.Command.Includegraphics.Attr=function e(){be(this,e)},Ce.Command.Includegraphics.Attr.Width=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).dimen=e,r}return ye(n,[{key:"toString",value:function(){return"width="+this.dimen}}]),n}(Ce.Command.Includegraphics.Attr),Ce.Command.Includegraphics.Attr.Height=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).dimen=e,r}return ye(n,[{key:"toString",value:function(){return"height="+this.dimen}}]),n}(Ce.Command.Includegraphics.Attr);var Me=$.fun,Pe=$.elem,Oe=function(e){return Me($.elem(e))},Be=$.literal,Ee=$.regex,Ae=$.regexLiteral,Le=function(e){return Me($.literal(e))},je=$.seq,De=$.or,Te=function(e){return $.lazyParser(e)().rep()},Re=function(e){return $.lazyParser(e)().rep1()},Fe=function(e){return $.lazyParser(e)().opt()},Ge=$.success,Ve=function(e){return function(){var t=e.memo;return void 0===t&&(t=e.memo=e()),t}},_e=new $,Ie={xy:Ve((function(){return _e.posDecor().to((function(e){return e}))})),xybox:Ve((function(){return Be("{").andr(_e.posDecor).andl(Le("}")).to((function(e){return e}))})),xymatrixbox:Ve((function(){return _e.xymatrix().to((function(e){return new Ce.PosDecor(new Ce.Pos.Coord(new Ce.Coord.C,L.empty),new Ce.Decor(L.empty.append(e)))}))})),posDecor:Ve((function(){return je(_e.pos,_e.decor).to((function(e){return new Ce.PosDecor(e.head,e.tail)}))})),pos:Ve((function(){return je(_e.coord,Te(_e.pos2)).to((function(e){return new Ce.Pos.Coord(e.head,e.tail)}))})),nonemptyPos:Ve((function(){return De(je(_e.nonemptyCoord,Te(_e.pos2)),je(_e.coord,Re(_e.pos2))).to((function(e){return new Ce.Pos.Coord(e.head,e.tail)}))})),pos2:Ve((function(){return De(Be("+").andr(_e.coord).to((function(e){return new Ce.Pos.Plus(e)})),Be("-").andr(_e.coord).to((function(e){return new Ce.Pos.Minus(e)})),Be("!").andr(_e.coord).to((function(e){return new Ce.Pos.Skew(e)})),Be(".").andr(_e.coord).to((function(e){return new Ce.Pos.Cover(e)})),Be(",").andr(_e.coord).to((function(e){return new Ce.Pos.Then(e)})),Be(";").andr(_e.coord).to((function(e){return new Ce.Pos.SwapPAndC(e)})),Be("::").andr(_e.coord).to((function(e){return new Ce.Pos.SetYBase(e)})),Be(":").andr(_e.coord).to((function(e){return new Ce.Pos.SetBase(e)})),Be("**").andr(_e.object).to((function(e){return new Ce.Pos.ConnectObject(e)})),Be("*").andr(_e.object).to((function(e){return new Ce.Pos.DropObject(e)})),Be("?").andr(_e.place).to((function(e){return new Ce.Pos.Place(e)})),Be("@+").andr(_e.coord).to((function(e){return new Ce.Pos.PushCoord(e)})),Be("@-").andr(_e.coord).to((function(e){return new Ce.Pos.EvalCoordThenPop(e)})),Be("@=").andr(_e.coord).to((function(e){return new Ce.Pos.LoadStack(e)})),Be("@@").andr(_e.coord).to((function(e){return new Ce.Pos.DoCoord(e)})),Be("@i").to((function(){return new Ce.Pos.InitStack})),Be("@(").to((function(){return new Ce.Pos.EnterFrame})),Be("@)").to((function(){return new Ce.Pos.LeaveFrame})),Be("=:").andr(Le('"')).andr(_e.id).andl(Oe('"')).to((function(e){return new Ce.Pos.SaveBase(e)})),Be("=@").andr(Le('"')).andr(_e.id).andl(Oe('"')).to((function(e){return new Ce.Pos.SaveStack(e)})),Be("=").andr(Le('"')).andr(_e.id).andl(Oe('"')).to((function(e){return new Ce.Pos.SavePos(e)})),Be("=").andr(_e.nonemptyCoord).andl(Le('"')).and(_e.id).andl(Oe('"')).to((function(e){return new Ce.Pos.SaveMacro(e.head,e.tail)})),_e.xyimport)})),coord:Ve((function(){return De(_e.nonemptyCoord,Ge("empty").to((function(){return new Ce.Coord.C})))})),nonemptyCoord:Ve((function(){return De(Be("c").to((function(){return new Ce.Coord.C})),Be("p").to((function(){return new Ce.Coord.P})),Be("x").to((function(){return new Ce.Coord.X})),Be("y").to((function(){return new Ce.Coord.Y})),_e.vector().to((function(e){return new Ce.Coord.Vector(e)})),Be('"').andr(_e.id).andl(Oe('"')).to((function(e){return new Ce.Coord.Id(e)})),Be("{").andr(_e.posDecor).andl(Le("}")).to((function(e){return new Ce.Coord.Group(e)})),Be("s").andr(Me(Ae(/^\d/))).to((function(e){return new Ce.Coord.StackPosition(parseInt(e))})),Be("s").andr(Le("{")).and(_e.nonnegativeNumber).andl(Le("}")).to((function(e){return new Ce.Coord.StackPosition(e)})),Be("[").andr(Me(Fe(Be('"').andr(_e.id).andl(Oe('"'))).to((function(e){return e.getOrElse("")})))).and(_e.number).andl(Le(",")).and(_e.number).andl(Le("]")).to((function(e){return new Ce.Coord.DeltaRowColumn(e.head.head,e.head.tail,e.tail)})),Be("[").andr(Me(Fe(Be('"').andr(_e.id).andl(Oe('"'))).to((function(e){return e.getOrElse("")})))).and(Me(Te(Ee(/^[lrud]/)))).andl(Le("]")).to((function(e){return new Ce.Coord.Hops(e.head,e.tail)})),Be("[").andr(Me(Fe(Be('"').andr(_e.id).andl(Oe('"'))).to((function(e){return e.getOrElse("")})))).and(Me(Re(Ee(/^[lrud]/)))).and(_e.place).andl(Le("]")).to((function(e){return new Ce.Coord.DeltaRowColumn(e.head.head,e.head.tail,new Ce.Pos.Place(e.tail))})))})),vector:Ve((function(){return De(Be("(").andr(_e.factor).andl(Le(",")).and(_e.factor).andl(Le(")")).to((function(e){return new Ce.Vector.InCurBase(e.head,e.tail)})),Be("<").andr(_e.dimen).andl(Le(",")).and(_e.dimen).andl(Le(">")).to((function(e){return new Ce.Vector.Abs(e.head,e.tail)})),Be("<").andr(_e.dimen).andl(Le(">")).to((function(e){return new Ce.Vector.Abs(e,e)})),Be("a").andr(Le("(")).andr(_e.number).andl(Le(")")).to((function(e){return new Ce.Vector.Angle(e)})),Be("/").andr(_e.direction).and(_e.looseDimen).andl(Le("/")).to((function(e){return new Ce.Vector.Dir(e.head,e.tail)})),Be("0").to((function(e){return new Ce.Vector.Abs("0mm","0mm")})),(function(){return _e.corner().and(Me($.opt(Me(Be("(").andr(_e.factor).andl(Le(")")))).to((function(e){return e.getOrElse(1)})))).to((function(e){return new Ce.Vector.Corner(e.head,e.tail)}))}))})),corner:Ve((function(){return De(Ae(/^(CL|LC)/).to((function(){return new Ce.Corner.CL})),Ae(/^(CR|RC)/).to((function(){return new Ce.Corner.CR})),Ae(/^(CD|DC)/).to((function(){return new Ce.Corner.CD})),Ae(/^(CU|UC)/).to((function(){return new Ce.Corner.CU})),Ae(/^(LD|DL)/).to((function(){return new Ce.Corner.LD})),Ae(/^(RD|DR)/).to((function(){return new Ce.Corner.RD})),Ae(/^(LU|UL)/).to((function(){return new Ce.Corner.LU})),Ae(/^(RU|UR)/).to((function(){return new Ce.Corner.RU})),Be("L").to((function(){return new Ce.Corner.L})),Be("R").to((function(){return new Ce.Corner.R})),Be("D").to((function(){return new Ce.Corner.D})),Be("U").to((function(){return new Ce.Corner.U})),Be("E").to((function(){return new Ce.Corner.NearestEdgePoint})),Be("P").to((function(){return new Ce.Corner.PropEdgePoint})),Be("A").to((function(){return new Ce.Corner.Axis})))})),place:Ve((function(){return De(Be("<").andr(_e.place).to((function(e){return new Ce.Place(1,0,void 0,void 0).compound(e)})),Be(">").andr(_e.place).to((function(e){return new Ce.Place(0,1,void 0,void 0).compound(e)})),Be("(").andr(_e.factor).andl(Le(")")).and(_e.place).to((function(e){return new Ce.Place(0,0,new Ce.Place.Factor(e.head),void 0).compound(e.tail)})),Be("!").andr(Le("{")).andr(_e.pos).andl(Le("}")).and(_e.slide).to((function(e){return new Ce.Place(0,0,new Ce.Place.Intercept(e.head),e.tail)})),(function(){return _e.slide().to((function(e){return new Ce.Place(0,0,void 0,e)}))}))})),slide:Ve((function(){return De(Be("/").andr(_e.dimen).andl(Le("/")).to((function(e){return new Ce.Slide(new g.Some(e))})),Ge("no slide").to((function(){return new Ce.Slide(g.empty)})))})),factor:Ve(Me(Ae(/^[+\-]?(\d+(\.\d*)?|\d*\.\d+)/).to((function(e){return parseFloat(e)})))),number:Ve(Me(Ae(/^[+\-]?\d+/).to((function(e){return parseInt(e)})))),nonnegativeNumber:Ve(Me(Ae(/^\d+/).to((function(e){return parseInt(e)})))),unit:Ve(Me(Ae(/^(em|ex|px|pt|pc|in|cm|mm|mu)/).to((function(e){return e})))),dimen:Ve((function(){return _e.factor().and(_e.unit).to((function(e){return e.head.toString()+e.tail}))})),looseDimen:Ve((function(){return _e.looseFactor().and(_e.unit).to((function(e){return e.head.toString()+e.tail}))})),looseFactor:Ve(Me(De(Ae(/^(\d \d*(\.\d*))/).to((function(e){return parseFloat(e.replace(/ /,""))})),Ae(/^[+\-]?(\d+(\.\d*)?|\d*\.\d+)/).to((function(e){return parseFloat(e)}))))),id:Ve(Me(Ee(/^[^"]+/))),object:Ve((function(){return De(Te(_e.modifier).and(_e.objectbox).to((function(e){return new Ce.Object(e.head,e.tail)})))})),objectbox:Ve((function(){return De(_e.mathText,Be("@").andr(_e.dir),Be("\\dir").andr(_e.dir),Be("\\cir").andr(_e.cirRadius).andl(Le("{")).and(_e.cir).andl(Le("}")).to((function(e){return new Ce.ObjectBox.Cir(e.head,e.tail)})),Be("\\frm").andr(_e.frameRadius).andl(Le("{")).and(_e.frameMain).andl(Le("}")).to((function(e){return new Ce.ObjectBox.Frame(e.head,e.tail)})),Be("\\object").andr(_e.object).to((function(e){return new Ce.ObjectBox.WrapUpObject(e)})),Be("\\composite").and(Le("{")).andr(_e.compositeObject).andl(Le("}")).to((function(e){return new Ce.ObjectBox.CompositeObject(e)})),Be("\\xybox").and(Le("{")).andr(_e.posDecor).andl(Le("}")).to((function(e){return new Ce.ObjectBox.Xybox(e)})),Be("\\xymatrix").andr(_e.xymatrix).to((function(e){return new Ce.ObjectBox.Xymatrix(e)})),_e.txt,_e.curve,Ee(/^(\\[a-zA-Z@][a-zA-Z0-9@]+)/).andl(Le("{")).and(_e.text).andl(Le("}")).and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail;return _e.toMath(t.head+"{"+t.tail+"}",n)})))})),compositeObject:Ve((function(){return _e.object().and(Me(Te(Be("*").andr(_e.object)))).to((function(e){return e.tail.prepend(e.head)}))})),mathText:Ve((function(){return Be("{").andr(_e.text).andl(Oe("}")).and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail;return _e.toMath("\\hbox{$\\objectstyle{"+t+"}$}",n)}))})),toMath:function(e,t){var n=t(e);return new Ce.ObjectBox.Text(n)},textNodeCreator:Ve((function(){return new $.Parser((function(e){return new $.Success(e.context.createTextNode,e)}))})),text:Ve((function(){return Ee(/^[^{}\\%]*/).and((function(){return De(Ee(/^(\\\{|\\\}|\\%|\\)/).to((function(e){return e})),Pe("{").andr(_e.text).andl(Oe("}")).to((function(e){return"{"+e+"}"})),Ee(/^%[^\r\n]*(\r\n|\r|\n)?/).to((function(e){return" "}))).and(Me(Ee(/^[^{}\\%]*/))).rep().to((function(e){var t="";return e.foreach((function(e){t+=e.head+e.tail})),t}))})).to((function(e){return e.head+e.tail}))})),txt:Ve((function(){return Be("\\txt").andr(_e.txtWidth).and(Me(Ee(/^(\\[a-zA-Z@][a-zA-Z0-9@]+)?/))).andl(Le("{")).and(_e.text).andl(Le("}")).and(_e.textNodeCreator).to((function(e){var t,n=e.head,r=e.tail,i=n.head.head,a=n.head.tail,o=n.tail,u=o.split("\\\\");if(u.length<=1)t=a+"{\\hbox{"+o+"}}";else{t="\\hbox{$\\begin{array}{c}\n";for(var s=0;s")).to((function(e){return new Ce.Vector.Abs(e,e)})).to((function(e){return new Ce.ObjectBox.Txt.Width.Vector(e)})),Ge("default").to((function(){return new Ce.ObjectBox.Txt.Width.Default})))})),dir:Ve((function(){return Ae(/^[\^_0123]/).opt().andl(Le("{")).and(_e.dirMain).andl(Le("}")).to((function(e){return new Ce.ObjectBox.Dir(e.head.getOrElse(""),e.tail)}))})),dirMain:Ve((function(){return Ee(/^(-|\.|~|>|<|\(|\)|`|'|\||\*|\+|x|\/|o|=|:|[a-zA-Z@ ])+/).opt().to((function(e){return e.getOrElse("")}))})),cirRadius:Ve((function(){return De(_e.vector().to((function(e){return new Ce.ObjectBox.Cir.Radius.Vector(e)})),Ge("default").to((function(){return new Ce.ObjectBox.Cir.Radius.Default})))})),frameRadius:Ve((function(){return De(_e.frameRadiusVector().to((function(e){return new Ce.ObjectBox.Frame.Radius.Vector(e)})),Ge("default").to((function(){return new Ce.ObjectBox.Frame.Radius.Default})))})),frameRadiusVector:Ve((function(){return De(Be("<").andr(_e.dimen).andl(Le(",")).and(_e.dimen).andl(Le(">")).to((function(e){return new Ce.Vector.Abs(e.head,e.tail)})),Be("<").andr(_e.dimen).andl(Le(">")).to((function(e){return new Ce.Vector.Abs(e,e)})))})),frameMain:Ve((function(){return Ee(/^(((_|\^)?(\\\{|\\\}|\(|\)))|[\-=oe,\.\*]*)/)})),cir:Ve((function(){return De(_e.nonemptyCir,Ge("full").to((function(){return new Ce.ObjectBox.Cir.Cir.Full})))})),nonemptyCir:Ve((function(){return _e.diag().and(Me(Ae(/^[_\^]/))).and(_e.diag).to((function(e){return new Ce.ObjectBox.Cir.Cir.Segment(e.head.head,e.head.tail,e.tail)}))})),curve:Ve((function(){return Be("\\crv").andr(_e.curveModifier).andl(Le("{")).and(_e.curveObject).and(_e.curvePoslist).andl(Le("}")).to((function(e){return new Ce.ObjectBox.Curve(e.head.head,e.head.tail,e.tail)}))})),curveModifier:Ve((function(){return Te(Me(Be("~").andr(_e.curveOption)))})),curveOption:Ve((function(){return De(Be("p").to((function(){return new Ce.ObjectBox.Curve.Modifier.p})),Be("P").to((function(){return new Ce.ObjectBox.Curve.Modifier.P})),Be("l").to((function(){return new Ce.ObjectBox.Curve.Modifier.l})),Be("L").to((function(){return new Ce.ObjectBox.Curve.Modifier.L})),Be("c").to((function(){return new Ce.ObjectBox.Curve.Modifier.c})),Be("C").to((function(){return new Ce.ObjectBox.Curve.Modifier.C})),Be("pc").to((function(){return new Ce.ObjectBox.Curve.Modifier.pc})),Be("pC").to((function(){return new Ce.ObjectBox.Curve.Modifier.pC})),Be("Pc").to((function(){return new Ce.ObjectBox.Curve.Modifier.Pc})),Be("PC").to((function(){return new Ce.ObjectBox.Curve.Modifier.PC})),Be("lc").to((function(){return new Ce.ObjectBox.Curve.Modifier.lc})),Be("lC").to((function(){return new Ce.ObjectBox.Curve.Modifier.lC})),Be("Lc").to((function(){return new Ce.ObjectBox.Curve.Modifier.Lc})),Be("LC").to((function(){return new Ce.ObjectBox.Curve.Modifier.LC})),Be("cC").to((function(){return new Ce.ObjectBox.Curve.Modifier.cC})))})),curveObject:Ve((function(){return Te(De(Be("~*").andr(_e.object).to((function(e){return new Ce.ObjectBox.Curve.Object.Drop(e)})),Be("~**").andr(_e.object).to((function(e){return new Ce.ObjectBox.Curve.Object.Connect(e)}))))})),curvePoslist:Ve((function(){return De(Be("&").andr(_e.curvePoslist2).to((function(e){return e.prepend(new Ce.ObjectBox.Curve.PosList.CurPos)})),Be("~@").andr(Le("&")).andr(_e.curvePoslist2).to((function(e){return e.prepend(new Ce.ObjectBox.Curve.PosList.AddStack)})),Be("~@").to((function(){return L.empty.prepend(new Ce.ObjectBox.Curve.PosList.AddStack)})),_e.pos().andl(Le("&")).and(_e.curvePoslist2).to((function(e){return e.tail.prepend(new Ce.ObjectBox.Curve.PosList.Pos(e.head))})),_e.nonemptyPos().to((function(e){return L.empty.prepend(new Ce.ObjectBox.Curve.PosList.Pos(e))})),Ge("empty").to((function(){return L.empty})))})),curvePoslist2:Ve((function(){return De(Be("&").andr(_e.curvePoslist2).to((function(e){return e.prepend(new Ce.ObjectBox.Curve.PosList.CurPos)})),Be("~@").andr(Le("&")).andr(_e.curvePoslist2).to((function(e){return e.prepend(new Ce.ObjectBox.Curve.PosList.AddStack)})),Be("~@").to((function(){return L.empty.prepend(new Ce.ObjectBox.Curve.PosList.AddStack)})),_e.nonemptyPos().andl(Le("&")).and(_e.curvePoslist2).to((function(e){return e.tail.prepend(new Ce.ObjectBox.Curve.PosList.Pos(e.head))})),_e.nonemptyPos().to((function(e){return L.empty.prepend(new Ce.ObjectBox.Curve.PosList.Pos(e))})),Ge("empty").to((function(){return L.empty.prepend(new Ce.ObjectBox.Curve.PosList.CurPos)})))})),modifier:Ve((function(){return De(Be("!").andr(_e.vector).to((function(e){return new Ce.Modifier.Vector(e)})),Be("!").to((function(e){return new Ce.Modifier.RestoreOriginalRefPoint})),Be("[").andr(_e.shape).andl(Le("]")).to((function(e){return e})),Be("i").to((function(e){return new Ce.Modifier.Invisible})),Be("h").to((function(e){return new Ce.Modifier.Hidden})),_e.addOp().and(_e.size).to((function(e){return new Ce.Modifier.AddOp(e.head,e.tail)})),_e.nonemptyDirection().to((function(e){return new Ce.Modifier.Direction(e)})))})),addOp:Ve((function(){return De(Be("+=").to((function(){return new Ce.Modifier.AddOp.GrowTo})),Be("-=").to((function(){return new Ce.Modifier.AddOp.ShrinkTo})),Be("+").to((function(){return new Ce.Modifier.AddOp.Grow})),Be("-").to((function(){return new Ce.Modifier.AddOp.Shrink})),Be("=").to((function(){return new Ce.Modifier.AddOp.Set})))})),size:Ve((function(){return De((function(){return _e.vector().to((function(e){return new Ce.Modifier.AddOp.VactorSize(e)}))}),Ge("default size").to((function(){return new Ce.Modifier.AddOp.DefaultSize})))})),shape:Ve((function(){return De(Be(".").to((function(){return new Ce.Modifier.Shape.Point})),_e.frameShape,_e.alphabets().to((function(e){return new Ce.Modifier.Shape.Alphabets(e)})),Be("=").andr(_e.alphabets).to((function(e){return new Ce.Modifier.Shape.DefineShape(e)})),Ge("rect").to((function(){return new Ce.Modifier.Shape.Rect})))})),frameShape:Ve((function(){return Be("F").andr(_e.frameMain).and(Me(Te(Be(":").andr(Me(De(_e.frameRadiusVector().to((function(e){return new Ce.Modifier.Shape.Frame.Radius(e)})),_e.colorName().to((function(e){return new Ce.Modifier.Shape.Frame.Color(e)})))))))).to((function(e){var t=e.head;return""===t&&(t="-"),new Ce.Modifier.Shape.Frame(t,e.tail)}))})),alphabets:Ve((function(){return Ee(/^([a-zA-Z]+)/)})),colorName:Ve((function(){return Ee(/^([a-zA-Z][a-zA-Z0-9]*)/)})),direction:Ve((function(){return je(_e.direction0,Te(_e.direction1)).to((function(e){return new Ce.Direction.Compound(e.head,e.tail)}))})),direction0:Ve((function(){return De(_e.direction2,_e.diag().to((function(e){return new Ce.Direction.Diag(e)})))})),direction1:Ve((function(){return De(Be(":").andr(_e.vector).to((function(e){return new Ce.Direction.RotVector(e)})),Be("_").to((function(e){return new Ce.Direction.RotAntiCW})),Be("^").to((function(e){return new Ce.Direction.RotCW})))})),direction2:Ve((function(){return De(Be("v").andr(_e.vector).to((function(e){return new Ce.Direction.Vector(e)})),Be("q").andr(Le("{")).andr(_e.posDecor).andl(Le("}")).to((function(e){return new Ce.Direction.ConstructVector(e)})))})),nonemptyDirection:Ve((function(){return De(je(_e.nonemptyDirection0,Te(_e.direction1)),je(_e.direction0,Re(_e.direction1))).to((function(e){return new Ce.Direction.Compound(e.head,e.tail)}))})),nonemptyDirection0:Ve((function(){return De(_e.direction2,_e.nonemptyDiag().to((function(e){return new Ce.Direction.Diag(e)})))})),diag:Ve((function(){return De(_e.nonemptyDiag,Ge("empty").to((function(e){return new Ce.Diag.Default})))})),nonemptyDiag:Ve((function(){return De(Ae(/^(ld|dl)/).to((function(e){return new Ce.Diag.LD})),Ae(/^(rd|dr)/).to((function(e){return new Ce.Diag.RD})),Ae(/^(lu|ul)/).to((function(e){return new Ce.Diag.LU})),Ae(/^(ru|ur)/).to((function(e){return new Ce.Diag.RU})),Be("l").to((function(e){return new Ce.Diag.L})),Be("r").to((function(e){return new Ce.Diag.R})),Be("d").to((function(e){return new Ce.Diag.D})),Be("u").to((function(e){return new Ce.Diag.U})))})),decor:Ve((function(){return _e.command().rep().to((function(e){return new Ce.Decor(e)}))})),command:Ve((function(){return De(Be("\\ar").andr(Me(Te(_e.arrowForm))).and(_e.path).to((function(e){return new Ce.Command.Ar(e.head,e.tail)})),Be("\\xymatrix").andr(_e.xymatrix),Be("\\PATH").andr(_e.path).to((function(e){return new Ce.Command.Path(e)})),Be("\\afterPATH").andr(Le("{")).andr(_e.decor).andl(Le("}")).and(_e.path).to((function(e){return new Ce.Command.AfterPath(e.head,e.tail)})),Be("\\save").andr(_e.pos).to((function(e){return new Ce.Command.Save(e)})),Be("\\restore").to((function(){return new Ce.Command.Restore})),Be("\\POS").andr(_e.pos).to((function(e){return new Ce.Command.Pos(e)})),Be("\\afterPOS").andr(Le("{")).andr(_e.decor).andl(Le("}")).and(_e.pos).to((function(e){return new Ce.Command.AfterPos(e.head,e.tail)})),Be("\\drop").andr(_e.object).to((function(e){return new Ce.Command.Drop(e)})),Be("\\connect").andr(_e.object).to((function(e){return new Ce.Command.Connect(e)})),Be("\\relax").to((function(){return new Ce.Command.Relax})),Be("\\xyignore").andr(Le("{")).andr(_e.pos).and(_e.decor).andl(Le("}")).to((function(e){return new Ce.Command.Ignore(e.head,e.tail)})),Be("\\xyshowAST").andr(Le("{")).andr(_e.pos).and(_e.decor).andl(Le("}")).to((function(e){return new Ce.Command.ShowAST(e.head,e.tail)})),_e.twocellCommand)})),arrowForm:Ve((function(){return De(Be("@").andr(Me(Ee(/^([\-\.~=:])/))).to((function(e){return new Ce.Command.Ar.Form.ChangeStem(e)})),Be("@").andr(Le("!")).to((function(e){return new Ce.Command.Ar.Form.DashArrowStem})),Be("@").andr(Le("/")).andr(_e.direction).and(Me(Fe(_e.looseDimen))).andl(Le("/")).to((function(e){return new Ce.Command.Ar.Form.CurveArrow(e.head,e.tail.getOrElse(".5pc"))})),Be("@").andr(Le("(")).andr(_e.direction).andl(Le(",")).and(_e.direction).andl(Le(")")).to((function(e){return new Ce.Command.Ar.Form.CurveFitToDirection(e.head,e.tail)})),Be("@").andr(Le("`")).andr(_e.coord).to((function(e){return new Ce.Command.Ar.Form.CurveWithControlPoints(e)})),Be("@").andr(Le("[")).andr(_e.shape).andl(Le("]")).to((function(e){return new Ce.Command.Ar.Form.AddShape(e)})),Be("@").andr(Le("*")).andr(Le("{")).andr(Me(Te(_e.modifier))).andl(Le("}")).to((function(e){return new Ce.Command.Ar.Form.AddModifiers(e)})),Be("@").andr(Le("<")).andr(_e.dimen).andl(Le(">")).to((function(e){return new Ce.Command.Ar.Form.Slide(e)})),Be("|").andr(_e.anchor).and(_e.it).to((function(e){return new Ce.Command.Ar.Form.LabelAt(e.head,e.tail)})),Be("^").andr(_e.anchor).and(_e.it).to((function(e){return new Ce.Command.Ar.Form.LabelAbove(e.head,e.tail)})),Be("_").andr(_e.anchor).and(_e.it).to((function(e){return new Ce.Command.Ar.Form.LabelBelow(e.head,e.tail)})),Be("@").andr(Le("?")).to((function(){return new Ce.Command.Ar.Form.ReverseAboveAndBelow})),Be("@").andr(Me(Ee(/^([\^_0123])/).opt())).and(Me(Fe(_e.tipConnTip))).to((function(e){var t=e.head.getOrElse("");if(e.tail.isDefined){var n=e.tail.get;return new Ce.Command.Ar.Form.BuildArrow(t,n.tail,n.stem,n.head)}return new Ce.Command.Ar.Form.ChangeVariant(t)})))})),tipConnTip:Ve((function(){return Be("{").andr(Me(Fe(_e.nonemptyTip))).and(Me(Fe(_e.nonemptyConn))).and(Me(Fe(_e.nonemptyTip))).andl(Le("}")).to((function(e){var t,n,r,i=e.head.head,a=e.head.tail,o=e.tail,u=new Ce.Command.Ar.Form.Tip.Tipchars("");return a.isDefined||o.isDefined?(t=i.getOrElse(u),n=a.getOrElse(new Ce.Command.Ar.Form.Conn.Connchars("")),r=o.getOrElse(u)):i.isDefined?(t=u,n=new Ce.Command.Ar.Form.Conn.Connchars("-"),r=i.getOrElse(u)):(t=u,n=new Ce.Command.Ar.Form.Conn.Connchars(""),r=u),{tail:t,stem:n,head:r}}))})),nonemptyTip:Ve((function(){return De(Ee(/^([<>()|'`+\/a-zA-Z ]+)/).to((function(e){return new Ce.Command.Ar.Form.Tip.Tipchars(e)})),Be("*").andr(_e.object).to((function(e){return new Ce.Command.Ar.Form.Tip.Object(e)})),_e.dir().to((function(e){return new Ce.Command.Ar.Form.Tip.Dir(e)})))})),nonemptyConn:Ve((function(){return De(Ee(/^([\-\.~=:]+)/).to((function(e){return new Ce.Command.Ar.Form.Conn.Connchars(e)})),Be("*").andr(_e.object).to((function(e){return new Ce.Command.Ar.Form.Conn.Object(e)})),_e.dir().to((function(e){return new Ce.Command.Ar.Form.Conn.Dir(e)})))})),path:Ve((function(){return _e.path2(L.empty).to((function(e){return new Ce.Command.Path.Path(e)}))})),path2:function(e){var t=Ve((function(){return _e.path2(e)}));return De(_e.path3().and(t).to((function(e){return e.tail.prepend(e.head)})),je("~","{",t,"}").to((function(e){return e.head.tail})).into((function(e){return _e.path2(e)})),_e.segment().to((function(e){return L.empty.prepend(new Ce.Command.Path.LastSegment(e))})),Ge(e).to((function(e){return e})))},path3:Ve((function(){return De(je("~","=","{",_e.posDecor,"}").to((function(e){return new Ce.Command.Path.SetBeforeAction(e.head.tail)})),je("~","/","{",_e.posDecor,"}").to((function(e){return new Ce.Command.Path.SetAfterAction(e.head.tail)})),je("~","<","{",_e.labels,"}").to((function(e){return new Ce.Command.Path.AddLabelNextSegmentOnly(e.head.tail)})),je("~",">","{",_e.labels,"}").to((function(e){return new Ce.Command.Path.AddLabelLastSegmentOnly(e.head.tail)})),je("~","+","{",_e.labels,"}").to((function(e){return new Ce.Command.Path.AddLabelEverySegment(e.head.tail)})),je("'",_e.segment).to((function(e){return new Ce.Command.Path.StraightSegment(e.tail)})),je("`",_e.turn,_e.segment).to((function(e){return new Ce.Command.Path.TurningSegment(e.head.tail,e.tail)})))})),turn:Ve((function(){return De(_e.nonemptyCir().and(_e.turnRadius).to((function(e){return new Ce.Command.Path.Turn.Cir(e.head,e.tail)})),_e.diag().and(_e.turnRadius).to((function(e){return new Ce.Command.Path.Turn.Diag(e.head,e.tail)})))})),turnRadius:Ve((function(){return De(Be("/").andr(_e.dimen).to((function(e){return new Ce.Command.Path.TurnRadius.Dimen(e)})),Ge("default").to((function(){return new Ce.Command.Path.TurnRadius.Default})))})),segment:Ve((function(){return _e.nonemptyPos().and(_e.pathSlide).and(_e.labels).to((function(e){return new Ce.Command.Path.Segment(e.head.head,e.head.tail,e.tail)}))})),pathSlide:Ve((function(){return De(Be("<").andr(_e.dimen).andl(Le(">")).to((function(e){return new Ce.Slide(new g.Some(e))})),Ge("no slide").to((function(){return new Ce.Slide(g.empty)})))})),labels:Ve((function(){return _e.label().rep().to((function(e){return new Ce.Command.Path.Labels(e)}))})),label:Ve((function(){return De(je("^",_e.anchor,_e.it,_e.alias).to((function(e){return new Ce.Command.Path.Label.Above(new Ce.Pos.Place(e.head.head.tail),e.head.tail,e.tail)})),je("_",_e.anchor,_e.it,_e.alias).to((function(e){return new Ce.Command.Path.Label.Below(new Ce.Pos.Place(e.head.head.tail),e.head.tail,e.tail)})),je("|",_e.anchor,_e.it,_e.alias).to((function(e){return new Ce.Command.Path.Label.At(new Ce.Pos.Place(e.head.head.tail),e.head.tail,e.tail)})))})),anchor:Ve((function(){return De(Be("-").andr(_e.anchor).to((function(e){return new Ce.Place(1,1,new Ce.Place.Factor(.5),void 0).compound(e)})),_e.place)})),it:Ve((function(){return Te(Be("[").andr(_e.shape).andl(Le("]")).to((function(e){return e}))).and(_e.it2).to((function(e){return new Ce.Object(e.head.concat(e.tail.modifiers),e.tail.object)}))})),it2:Ve((function(){return De(Ae(/^[0-9a-zA-Z]/).and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail;return new Ce.Object(L.empty,_e.toMath("\\labelstyle "+t,n))})),Ae(/^(\\[a-zA-Z][a-zA-Z0-9]*)/).and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail;return new Ce.Object(L.empty,_e.toMath("\\labelstyle "+t,n))})),Be("{").andr(_e.text).andl(Oe("}")).and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail;return new Ce.Object(L.empty,_e.toMath("\\labelstyle "+t,n))})),Be("*").andr(_e.object),Be("@").andr(_e.dir).to((function(e){return new Ce.Object(L.empty,e)})))})),alias:Ve((function(){return je("=",'"',_e.id,'"').opt().to((function(e){return e.map((function(e){return e.head.tail}))}))})),xymatrix:Ve((function(){return _e.setup().andl(Le("{")).and(_e.rows).andl(Le("}")).to((function(e){return new Ce.Command.Xymatrix(e.head,e.tail)}))})),setup:Ve((function(){return Te(Me(De(Be('"').andr(Me(Ee(/^[^"]+/))).andl(Oe('"')).to((function(e){return new Ce.Command.Xymatrix.Setup.Prefix(e)})),Be("@!").andr(Me(Ee(/^[RC]/).opt().to((function(e){return e.getOrElse("")})))).and(Me(De(Pe("0").to((function(){return"0em"})),Pe("=").andr(_e.dimen)))).to((function(e){var t=e.tail;switch(e.head){case"R":return new Ce.Command.Xymatrix.Setup.PretendEntrySize.Height(t);case"C":return new Ce.Command.Xymatrix.Setup.PretendEntrySize.Width(t);default:return new Ce.Command.Xymatrix.Setup.PretendEntrySize.HeightAndWidth(t)}})),Be("@!").andr(Me(De(Pe("R").to((function(){return new Ce.Command.Xymatrix.Setup.FixGrid.Row})),Pe("C").to((function(){return new Ce.Command.Xymatrix.Setup.FixGrid.Column}))).opt().to((function(e){return e.getOrElse(new Ce.Command.Xymatrix.Setup.FixGrid.RowAndColumn)})))),Be("@").andr(Me(Ee(/^[MWHL]/))).and(_e.addOp).and(_e.dimen).to((function(e){var t=e.head.tail,n=e.tail;switch(e.head.head){case"M":return new Ce.Command.Xymatrix.Setup.AdjustEntrySize.Margin(t,n);case"W":return new Ce.Command.Xymatrix.Setup.AdjustEntrySize.Width(t,n);case"H":return new Ce.Command.Xymatrix.Setup.AdjustEntrySize.Height(t,n);case"L":return new Ce.Command.Xymatrix.Setup.AdjustLabelSep(t,n)}})),Be("@").andr(_e.nonemptyDirection).to((function(e){return new Ce.Command.Xymatrix.Setup.SetOrientation(e)})),Be("@*[").andr(_e.shape).andl(Le("]")).to((function(e){return new Ce.Command.Xymatrix.Setup.AddModifier(e)})),Be("@*").andr(_e.addOp).and(_e.size).to((function(e){return new Ce.Command.Xymatrix.Setup.AddModifier(new Ce.Modifier.AddOp(e.head,e.tail))})),Be("@").andr(Me(Ee(/^[RC]/).opt().to((function(e){return e.getOrElse("")})))).and(_e.addOp).and(_e.dimen).to((function(e){var t=e.head.tail,n=e.tail;switch(e.head.head){case"R":return new Ce.Command.Xymatrix.Setup.ChangeSpacing.Row(t,n);case"C":return new Ce.Command.Xymatrix.Setup.ChangeSpacing.Column(t,n);default:return new Ce.Command.Xymatrix.Setup.ChangeSpacing.RowAndColumn(t,n)}})),Be("@1").to((function(){return new Ce.Command.Xymatrix.Setup.AdjustEntrySize.Margin(new Ce.Modifier.AddOp.Set,"1pc")})))))})),rows:Ve((function(){return _e.row().and(Me(Te(Be("\\\\").andr(_e.row)))).to((function(e){var t=e.tail.prepend(e.head);if(!t.isEmpty){var n=t.at(t.length()-1);1===n.entries.length()&&n.entries.at(0).isEmpty&&(t=t.reverse().tail.reverse())}return t}))})),row:Ve((function(){return _e.entry().and(Me(Te(Be("&").andr(_e.entry)))).to((function(e){return new Ce.Command.Xymatrix.Row(e.tail.prepend(e.head))}))})),entry:Ve((function(){return De(Be("*").andr(_e.object).and(_e.pos).and(_e.decor).to((function(e){var t=e.head.head,n=e.head.tail,r=e.tail;return new Ce.Command.Xymatrix.Entry.ObjectEntry(t,n,r)})),_e.entryModifier().rep().and(_e.looseObjectbox).and(_e.decor).to((function(e){var t=e.head.head.foldLeft(L.empty,(function(e,t){return t.concat(e)})),n=e.head.tail.isEmpty,r=e.head.tail.object,i=e.tail;return n&&t.isEmpty?new Ce.Command.Xymatrix.Entry.EmptyEntry(i):new Ce.Command.Xymatrix.Entry.SimpleEntry(t,r,i)})))})),entryModifier:Ve((function(){return De(Be("**").andr(Le("[")).andr(_e.shape).andl(Le("]")).to((function(e){return L.empty.append(e)})),Be("**").andr(Le("{")).andr(Me(Te(_e.modifier))).andl(Le("}")))})),looseObjectbox:Ve((function(){return De(_e.objectbox().to((function(e){return{isEmpty:!1,object:e}})),Ee(/^[^\\{}%&]+/).opt().to((function(e){return e.getOrElse("")})).and(Me(Te(De(Pe("{").andr(_e.text).andl(Oe("}")).to((function(e){return"{"+e+"}"})),Pe("\\").andr(Me((e=Ee(/^(\\|ar|xymatrix|PATH|afterPATH|save|restore|POS|afterPOS|drop|connect|xyignore|([lrud]+(twocell|uppertwocell|lowertwocell|compositemap))|xtwocell|xuppertwocell|xlowertwocell|xcompositemap)/),$.not($.lazyParser(e))))).andr(Me(Ee(/^[{}%&]/).opt().to((function(e){return e.getOrElse("")})))).to((function(e){return"\\"+e})),Ee(/^%[^\r\n]*(\r\n|\r|\n)?/).to((function(e){return" "}))).and(Me(Ee(/^[^\\{}%&]+/).opt().to((function(e){return e.getOrElse("")})))).to((function(e){return e.head+e.tail}))).to((function(e){return e.mkString("")})))).and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail,r=t.head+t.tail;return{isEmpty:0===r.trim().length,object:_e.toMath("\\hbox{$\\objectstyle{"+r+"}$}",n)}})));var e})),twocellCommand:Ve((function(){return _e.twocell().and(Me(Te(_e.twocellSwitch))).and(_e.twocellArrow).to((function(e){return new Ce.Command.Twocell(e.head.head,e.head.tail,e.tail)}))})),twocell:Ve((function(){return De(Ae(/^\\[lrud]+twocell/).to((function(e){var t=e.substring(1,e.length-"twocell".length);return new Ce.Command.Twocell.Twocell(t,g.empty)})),Ae(/^\\[lrud]+uppertwocell/).to((function(e){var t=e.substring(1,e.length-"uppertwocell".length);return new Ce.Command.Twocell.UpperTwocell(t,g.empty)})),Ae(/^\\[lrud]+lowertwocell/).to((function(e){var t=e.substring(1,e.length-"lowertwocell".length);return new Ce.Command.Twocell.LowerTwocell(t,g.empty)})),Ae(/^\\[lrud]+compositemap/).to((function(e){var t=e.substring(1,e.length-"compositemap".length);return new Ce.Command.Twocell.CompositeMap(t,g.empty)})),De(Be("\\xtwocell").to((function(){return Ce.Command.Twocell.Twocell})),Be("\\xuppertwocell").to((function(){return Ce.Command.Twocell.UpperTwocell})),Be("\\xlowertwocell").to((function(){return Ce.Command.Twocell.LowerTwocell})),Be("\\xcompositemap").to((function(){return Ce.Command.Twocell.CompositeMap}))).andl(Le("[")).and(Me(Ee(/^[lrud]+/))).andl(Le("]")).andl(Le("{")).and(_e.text).andl(Le("}")).and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail,r=new Ce.Object(L.empty,_e.toMath("\\labelstyle "+t.tail,n));return new t.head.head(t.head.tail,new g.Some(r))})))})),twocellSwitch:Ve((function(){return De(Be("^").andr(_e.twocellLabel).to((function(e){return new Ce.Command.Twocell.Switch.UpperLabel(e)})),Be("_").andr(_e.twocellLabel).to((function(e){return new Ce.Command.Twocell.Switch.LowerLabel(e)})),Be("\\omit").to((function(){return new Ce.Command.Twocell.Switch.DoNotSetCurvedArrows})),Be("~!").to((function(){return new Ce.Command.Twocell.Switch.PlaceModMapObject})),Ae(/^(~[`'])/).andl(Le("{")).and(_e.object).andl(Le("}")).to((function(e){var t=e.head.substring(1);return new Ce.Command.Twocell.Switch.ChangeHeadTailObject(t,e.tail)})),Ae(/^(~[\^_]?)/).andl(Le("{")).and(_e.object).and(Me(Fe(Be("~**").andr(_e.object)))).andl(Le("}")).to((function(e){var t=e.head.head.substring(1),n=e.head.tail,r=e.tail;return new Ce.Command.Twocell.Switch.ChangeCurveObject(t,n,r)})),_e.nudge().to((function(e){return new Ce.Command.Twocell.Switch.SetCurvature(e)})))})),twocellLabel:Ve((function(){return De(Ae(/^[0-9a-zA-Z]/).and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail,r=new Ce.Object(L.empty,_e.toMath("\\twocellstyle "+t,n));return new Ce.Command.Twocell.Label(g.empty,r)})),Ae(/^(\\[a-zA-Z][a-zA-Z0-9]*)/).and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail,r=new Ce.Object(L.empty,_e.toMath("\\twocellstyle "+t,n));return new Ce.Command.Twocell.Label(g.empty,r)})),Be("{").andr(Me(Fe(_e.nudge))).andl(Le("*")).and(_e.object).andl(Le("}")).to((function(e){return new Ce.Command.Twocell.Label(e.head,e.tail)})),Be("{").andr(Me(Fe(_e.nudge))).and(_e.text).andl(Oe("}")).and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail,r=new Ce.Object(L.empty,_e.toMath("\\twocellstyle "+t.tail,n));return new Ce.Command.Twocell.Label(t.head,r)})))})),nudge:Ve((function(){return De(Be("<\\omit>").to((function(){return new Ce.Command.Twocell.Nudge.Omit})),Be("<").andr(_e.factor).andl(Le(">")).to((function(e){return new Ce.Command.Twocell.Nudge.Number(e)})))})),twocellArrow:Ve((function(){return De(Be("{").andr(Me(Ae(/^([\^_=`'"!]|\\omit)/))).and(_e.twocellLabelEntry).andl(Le("}")).to((function(e){return new Ce.Command.Twocell.Arrow.WithOrientation(e.head,e.tail)})),Be("{").andr(_e.nudge).and(_e.twocellLabelEntry).andl(Le("}")).to((function(e){return new Ce.Command.Twocell.Arrow.WithPosition(e.head,e.tail)})),Be("{").andr(_e.twocellLabelEntry).andl(Le("}")).to((function(e){return new Ce.Command.Twocell.Arrow.WithOrientation("",e)})),Ge("no arrow label").andr(_e.textNodeCreator).to((function(e){return new Ce.Command.Twocell.Arrow.WithOrientation("",new Ce.Object(L.empty,_e.toMath("\\twocellstyle{}",e)))})))})),twocellLabelEntry:Ve((function(){return De(Be("*").andr(_e.object),_e.text().and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail;return new Ce.Object(L.empty,_e.toMath("\\twocellstyle "+t,n))})))})),newdir:Ve((function(){return Be("{").andr(_e.dirMain).andl(Oe("}")).andl(Le("{")).and(_e.compositeObject).andl(Le("}")).to((function(e){return new Ce.Command.Newdir(e.head,new Ce.ObjectBox.CompositeObject(e.tail))}))})),xyimport:Ve((function(){return Be("\\xyimport").andr(Le("(")).andr(_e.factor).andl(Le(",")).and(_e.factor).andl(Le(")")).and(Me(Fe(Be("(").andr(_e.factor).andl(Le(",")).and(_e.factor).andl(Le(")"))))).andl(Le("{")).and(Me(De(Be("\\includegraphics").andr(_e.includegraphics),_e.text().and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail;return _e.toMath("\\hbox{$\\objectstyle{"+t+"}$}",n)}))))).andl(Le("}")).to((function(e){var t,n,r=e.head.head.head,i=e.head.head.tail;e.head.tail.isDefined?(t=e.head.tail.get.head,n=e.head.tail.get.tail):(t=0,n=0);var a=e.tail;return void 0!==a.isIncludegraphics?new Ce.Pos.Xyimport.Graphics(r,i,t,n,a):new Ce.Pos.Xyimport.TeXCommand(r,i,t,n,a)}))})),includegraphics:Ve((function(){return Be("[").andr(Me(Fe(_e.includegraphicsAttrList))).andl(Le("]")).andl(Le("{")).and(Me(Ae(/^[^\s{}]+/))).andl(Le("}")).to((function(e){var t=e.head.getOrElse(L.empty),n=e.tail;return new Ce.Command.Includegraphics(!1,t,n)}))})),includegraphicsAttrList:Ve((function(){return _e.includegraphicsAttr().and(Me(Te(Be(",").andr(_e.includegraphicsAttr)))).to((function(e){return e.tail.prepend(e.head)}))})),includegraphicsAttr:Ve((function(){return De(Be("width").andr(Le("=")).andr(_e.dimen).to((function(e){return new Ce.Command.Includegraphics.Attr.Width(e)})),Be("height").andr(Le("=")).andr(_e.dimen).to((function(e){return new Ce.Command.Includegraphics.Attr.Height(e)})))}))};for(var ze in Ie)_e[ze]=Ie[ze];var Qe=_e,We=function(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]},Ne=function(e){return e<0?-1:e>0?1:0},Ue=function(e){return Math.abs(e)0?(n=i*this.r/r)>this.u?new rt.Point(this.x+this.u*r/i,this.y+this.u):n<-this.d?new rt.Point(this.x-this.d*r/i,this.y-this.d):new rt.Point(this.x+this.r,this.y+n):r<0?(n=-i*this.l/r)>this.u?new rt.Point(this.x+this.u*r/i,this.y+this.u):n<-this.d?new rt.Point(this.x-this.d*r/i,this.y-this.d):new rt.Point(this.x-this.l,this.y+n):i>0?new rt.Point(this.x,this.y+this.u):new rt.Point(this.x,this.y-this.d)}},{key:"proportionalEdgePoint",value:function(e,t){if(this.isPoint())return this;var n=e-this.x,r=t-this.y;if(Math.abs(n)0?3*u/4:-5*u/4))/(u/2),new rt.Point(this.x+this.r,this.y-this.d+i*o))}},{key:"grow",value:function(e,t){return this.toRect({l:Math.max(0,this.l+e),r:Math.max(0,this.r+e),u:Math.max(0,this.u+t),d:Math.max(0,this.d+t)})}},{key:"toSize",value:function(e,t){var n,r,i,a,o=this.l+this.r,u=this.u+this.d;return 0===o?(a=e/2,i=e/2):(a=e*this.l/o,i=e*this.r/o),0===u?(n=t/2,r=t/2):(n=t*this.u/u,r=t*this.d/u),this.toRect({l:a,r:i,u:n,d:r})}},{key:"growTo",value:function(e,t){var n=this.u,r=this.d,i=this.r,a=this.l,o=a+i,u=n+r;return e>o&&(0===o?(a=e/2,i=e/2):(a=e*this.l/o,i=e*this.r/o)),t>u&&(0===u?(n=t/2,r=t/2):(n=t*this.u/u,r=t*this.d/u)),this.toRect({l:a,r:i,u:n,d:r})}},{key:"shrinkTo",value:function(e,t){var n=this.u,r=this.d,i=this.r,a=this.l,o=a+i,u=n+r;return e=this.x-this.l&&t<=this.x+this.r&&n>=this.y-this.d&&n<=this.y+this.u}},{key:"toString",value:function(){return"{x:"+this.x+", y:"+this.y+", l:"+this.l+", r:"+this.r+", u:"+this.u+", d:"+this.d+"}"}}]),n}(rt),rt.Ellipse=function(e){Je(n,e);var t=Ye(n);function n(e,r,i,a,o,u){var s;return et(this,n),(s=t.call(this)).x=e,s.y=r,s.l=i,s.r=a,s.u=o,s.d=u,s}return nt(n,[{key:"isPoint",value:function(){return 0===this.r&&0===this.l||0===this.u&&0===this.d}},{key:"isRect",value:function(){return!1}},{key:"isCircle",value:function(){return!this.isPoint()}},{key:"isPerfectCircle",value:function(){return this.l===this.r&&this.l===this.u&&this.l===this.d}},{key:"edgePoint",value:function(e,t){if(this.isPoint())return this;if(this.isPerfectCircle()){var n,r=e-this.x,i=t-this.y;return n=Math.abs(r)o&&(0===o?(a=e/2,i=e/2):(a=e*this.l/o,i=e*this.r/o)),t>u&&(0===u?(n=t/2,r=t/2):(n=t*this.u/u,r=t*this.d/u)),new rt.Ellipse(this.x,this.y,a,i,n,r)}},{key:"shrinkTo",value:function(e,t){var n=this.u,r=this.d,i=this.r,a=this.l,o=a+i,u=n+r;return en?(this.start=n,this.end=t):(this.start=t,this.end=n)}var t,n,r;return t=e,(n=[{key:"difference",value:function(t){var n=L.empty,r=this.start,i=this.end,a=t.start,o=t.end;return i<=a||o<=r?n=n.prepend(this):r "'+e+'" not defined.');return n}},{key:"toString",value:function(){var e="";for(var t in this.savedPosition)this.savedPosition.hasOwnProperty(t)&&(e.length>0&&(e+=", "),e+=t.toString()+":"+this.savedPosition[t]);return"Env\n p:"+this.p+"\n c:"+this.c+"\n angle:"+this.angle+"\n lastCurve:"+this.lastCurve+"\n savedPosition:{"+e+"}\n origin:{x:"+this.origin.x+", y:"+this.origin.y+"}\n xBase:{x:"+this.xBase.x+", y:"+this.xBase.y+"}\n yBase:{x:"+this.yBase.x+", y:"+this.yBase.y+"}\n stackFrames:"+this.stackFrames+"\n stack:"+this.stack+"\n shouldCapturePos:"+this.shouldCapturePos+"\n capturedPositions:"+this.capturedPositions}}],[{key:"copyFields",value:function(e,t){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);for(var r in t.savedPosition={},e.savedPosition)e.savedPosition.hasOwnProperty(r)&&(t.savedPosition[r]=e.savedPosition[r])}}]),e}();Bt.originPosition=new rt.Point(0,0);var Et=function(){function e(){Mt(this,e)}return Ot(e,[{key:"velocity",value:function(e){var t=this.dpx(e),n=this.dpy(e);return Math.sqrt(t*t+n*n)}},{key:"length",value:function(e){if(e<0||e>1)throw s("ExecutionError","illegal cubic Bezier parameter t:"+e);this.buildLengthArray();var t=e*c.lengthResolution,n=Math.floor(t),r=Math.ceil(t);if(n===r)return this.lengthArray[n];var i=this.lengthArray[n];return i+(this.lengthArray[r]-i)/(r-n)*(t-n)}},{key:"tOfLength",value:function(e){this.buildLengthArray();var t,n,r,i=this.lengthArray;if(ei[i.length-1])return 1;for(var a=0,o=i.length-2;a<=o&&(n=i[t=a+o>>1],r=i[t+1],!(e>=n&&e<=r));)e=0){var c,h=Math.PI/2,l=this.startPosition();this.endPosition();for(c=0;c<=u;c++){l=i+c*a;var m=this.tOfLength(l),p=this.angle(m),f=this.position(m),d=f.x,y=f.y,v=s*Math.cos(p+h),x=s*Math.sin(p+h);e.createSVGElement("circle",{cx:pe.measure.em2px(d+v),cy:-pe.measure.em2px(y+x),r:.12,fill:"currentColor"}),e.createSVGElement("circle",{cx:pe.measure.em2px(d-v),cy:-pe.measure.em2px(y-x),r:.12,fill:"currentColor"})}}}},{key:"drawParallelDashedCurve",value:function(t,n,r){var i,a,o,u,s,c,h,l,m=this.length(1),p=Math.floor((m-n)/(2*n)),f=2*p+1,d=(m-n)/2-p*n,y=new Array(p+1),v=new Array(p+1),x=new Array(p+1),g=new Array(p+1),w=new Array(p+1),S=Math.PI/2,b=r;for(i=0;i<=f;i++)a=this.tOfLength(d+i*n),y[i]=a,o=this.angle(a),s=(u=this.position(a)).x,c=u.y,h=b*Math.cos(o+S),l=b*Math.sin(o+S),v[i]=s+h,x[i]=c+l,g[i]=s-h,w[i]=c-l;e.CubicBeziers.interpolation(y,v,x).drawSkipped(t),e.CubicBeziers.interpolation(y,g,w).drawSkipped(t)}},{key:"drawSquigCurve",value:function(e,t){var n=pe.measure.length2em("0.15em"),r=this.length(1),i=4*n,a=n;if(r>=i){var o,u,s,c,h,l,m,p,f,d=Math.floor(r/i),y=(r-d*i)/2,v=Math.PI/2;switch(t){case"3":o=y,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v),l=a*Math.sin(c+v),m="M"+pe.measure.em2px(s.x+h)+","+pe.measure.em2px(-s.y-l),p="M"+pe.measure.em2px(s.x)+","+pe.measure.em2px(-s.y),f="M"+pe.measure.em2px(s.x-h)+","+pe.measure.em2px(-s.y+l);for(var x=0;x=i){var o,u,s,c,h,l,m,p,f,d=Math.floor((r-i)/2/i),y=(r-i)/2-d*i,v=Math.PI/2;switch(t){case"3":m=p=f="";for(var x=0;x<=d;x++)o=y+i*x*2,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v),l=a*Math.sin(c+v),m+=" M"+pe.measure.em2px(s.x+h)+","+pe.measure.em2px(-s.y-l),p+=" M"+pe.measure.em2px(s.x)+","+pe.measure.em2px(-s.y),f+=" M"+pe.measure.em2px(s.x-h)+","+pe.measure.em2px(-s.y+l),o=y+i*x*2+n,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v),l=a*Math.sin(c+v),m+=" Q"+pe.measure.em2px(s.x+2*h)+","+pe.measure.em2px(-s.y-2*l),p+=" Q"+pe.measure.em2px(s.x+h)+","+pe.measure.em2px(-s.y-l),f+=" Q"+pe.measure.em2px(s.x)+","+pe.measure.em2px(-s.y),o=y+i*x*2+2*n,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v),l=a*Math.sin(c+v),m+=" "+pe.measure.em2px(s.x+h)+","+pe.measure.em2px(-s.y-l),p+=" "+pe.measure.em2px(s.x)+","+pe.measure.em2px(-s.y),f+=" "+pe.measure.em2px(s.x-h)+","+pe.measure.em2px(-s.y+l),o=y+i*x*2+3*n,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v),l=a*Math.sin(c+v),m+=" Q"+pe.measure.em2px(s.x)+","+pe.measure.em2px(-s.y),p+=" Q"+pe.measure.em2px(s.x-h)+","+pe.measure.em2px(-s.y+l),f+=" "+pe.measure.em2px(s.x-2*h)+","+pe.measure.em2px(-s.y+2*l),o=y+i*(2*x+1),u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v),l=a*Math.sin(c+v),m+=" "+pe.measure.em2px(s.x+h)+","+pe.measure.em2px(-s.y-l),p+=" "+pe.measure.em2px(s.x)+","+pe.measure.em2px(-s.y),f+=" "+pe.measure.em2px(s.x-h)+","+pe.measure.em2px(-s.y+l);e.createSVGElement("path",{d:m}),e.createSVGElement("path",{d:p}),e.createSVGElement("path",{d:f});break;case"2":m=p="";for(x=0;x<=d;x++)o=y+i*x*2,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v)/2,l=a*Math.sin(c+v)/2,m+=" M"+pe.measure.em2px(s.x+h)+","+pe.measure.em2px(-s.y-l),p+=" M"+pe.measure.em2px(s.x-h)+","+pe.measure.em2px(-s.y+l),o=y+i*x*2+n,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v)/2,l=a*Math.sin(c+v)/2,m+=" Q"+pe.measure.em2px(s.x+3*h)+","+pe.measure.em2px(-s.y-3*l),p+=" Q"+pe.measure.em2px(s.x+h)+","+pe.measure.em2px(-s.y-l),o=y+i*x*2+2*n,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v)/2,l=a*Math.sin(c+v)/2,m+=" "+pe.measure.em2px(s.x+h)+","+pe.measure.em2px(-s.y-l),p+=" "+pe.measure.em2px(s.x-h)+","+pe.measure.em2px(-s.y+l),o=y+i*x*2+3*n,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v)/2,l=a*Math.sin(c+v)/2,m+=" Q"+pe.measure.em2px(s.x-h)+","+pe.measure.em2px(-s.y+l),p+=" Q"+pe.measure.em2px(s.x-3*h)+","+pe.measure.em2px(-s.y+3*l),o=y+i*(2*x+1),u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v)/2,l=a*Math.sin(c+v)/2,m+=" "+pe.measure.em2px(s.x+h)+","+pe.measure.em2px(-s.y-l),p+=" "+pe.measure.em2px(s.x-h)+","+pe.measure.em2px(-s.y+l);e.createSVGElement("path",{d:m}),e.createSVGElement("path",{d:p});break;default:m="";for(x=0;x<=d;x++)o=y+i*x*2,u=this.tOfLength(o),s=this.position(u),m+=" M"+pe.measure.em2px(s.x)+","+pe.measure.em2px(-s.y),o=y+i*x*2+n,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v),l=a*Math.sin(c+v),m+=" Q"+pe.measure.em2px(s.x+h)+","+pe.measure.em2px(-s.y-l),o=y+i*x*2+2*n,u=this.tOfLength(o),s=this.position(u),m+=" "+pe.measure.em2px(s.x)+","+pe.measure.em2px(-s.y),o=y+i*x*2+3*n,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v),l=a*Math.sin(c+v),m+=" Q"+pe.measure.em2px(s.x-h)+","+pe.measure.em2px(-s.y+l),o=y+i*(2*x+1),u=this.tOfLength(o),s=this.position(u),m+=" "+pe.measure.em2px(s.x)+","+pe.measure.em2px(-s.y);e.createSVGElement("path",{d:m})}}}},{key:"drawCurve",value:function(e,t,n,r){if(r.isEmpty)this._drawCurve(e,t,n);else{var i=new yt(0,1).differenceRanges(r),a=this;i.foreach((function(r){a.slice(r.start,r.end)._drawCurve(e,t,n)}))}}},{key:"_drawCurve",value:function(e,t,n){var r,i=pe.measure.length2em("0.15em");if(void 0!==n){var a=n.dirMain(),o=n.dirVariant();switch(a){case"=":a="-",o="2";break;case"==":a="--",o="2";break;case":":case"::":a=".",o="2"}switch(a){case"":break;case"-":switch(o){case"2":r=i/2,this.drawParallelCurve(e,r);break;case"3":r=i,this.drawParallelCurve(e,r),this.drawPrimitive(e,"none");break;default:r=0,this.drawPrimitive(e,"none")}break;case".":case"..":switch(o){case"2":r=i/2,this.drawParallelDottedCurve(e,i,r);break;case"3":r=i,this.drawParallelDottedCurve(e,i,r),this.drawPrimitive(e,pe.measure.dottedDasharray);break;default:r=0,this.drawPrimitive(e,pe.measure.dottedDasharray)}break;case"--":var u=3*i;if((x=this.length(1))>=u)switch(o){case"2":r=i/2,this.drawParallelDashedCurve(e,u,r);break;case"3":r=i,this.drawParallelDashedCurve(e,u,r);var s=(x-u)/2-Math.floor((x-u)/2/u)*u,c=this.tOfLength(s);this.divide(c)[1].drawPrimitive(e,pe.measure.em2px(u)+" "+pe.measure.em2px(u));break;default:r=0;s=(x-u)/2-Math.floor((x-u)/2/u)*u,c=this.tOfLength(s);this.divide(c)[1].drawPrimitive(e,pe.measure.em2px(u)+" "+pe.measure.em2px(u))}break;case"~":switch(this.drawSquigCurve(e,o),o){case"2":r=1.5*i;break;case"3":r=2*i;break;default:r=0}break;case"~~":switch(this.drawDashSquigCurve(e,o),o){case"2":r=1.5*i;break;case"3":r=2*i;break;default:r=0}break;default:(w=new Bt).c=Bt.originPosition;var h=new xt(ft.none,w),l=n.boundingBox(h);if(null==l)return;var m,p,f=l.l,d=f+l.r;if(void 0!==t){var y=t.boundingBox(h);void 0!==y&&(m=(p=y.l)+y.r)}else m=0;var v=d+m;0==v&&(v=pe.measure.strokeWidth);var x=this.length(1);if(0==(M=Math.floor(x/v)))return;s=(x-M*v)/2,h=new xt(ft.none,w);for(var g=0;g=c)switch(s){case"2":r=a/2;break;case"3":r=a;break;default:r=0}break;case"~":case"~~":switch(s){case"2":r=1.5*a;break;case"3":r=2*a;break;default:r=0}break;default:var h=n.boundingBox(e);if(null==h)return i.angle=0,i.lastCurve=Lt.none,ft.none;r=Math.max(h.u,h.d);var l,m=h.l+h.r;if(void 0!==t){var p=t.boundingBox(e);void 0!==p&&(l=p.l+p.r,r=Math.max(r,p.u,p.d))}else l=0;var f=m+l;0==f&&(f=pe.measure.strokeWidth);var d=this.length(1);return 0==Math.floor(d/f)?(i.angle=0,i.lastCurve=Lt.none,ft.none):(o=new ft.CurveShape(this,t,n,this.boundingBox(r)),e.appendShapeToFront(o),o)}return void 0===r?ft.none:(o=new ft.CurveShape(this,t,n,this.boundingBox(r)),e.appendShapeToFront(o),o)}if(void 0!==t){var y=t.boundingBox(e);if(null==y)return i.angle=0,i.lastCurve=Lt.none,ft.none;var v=y.l+y.r;0==v&&(v=pe.measure.strokeWidth);d=this.length(1);return 0==Math.floor(d/v)?(i.angle=0,i.lastCurve=Lt.none,ft.none):(r=Math.max(y.u,y.d),o=new ft.CurveShape(this,t,n,this.boundingBox(r)),e.appendShapeToFront(o),o)}return o}}],[{key:"sign",value:function(e){return e>0?1:0===e?0:-1}},{key:"solutionsOfCubicEq",value:function(t,n,r,i){if(0===t)return e.solutionsOfQuadEq(n,r,i);var a=n/3/t,o=r/t,u=a*a-o/3,s=-(i/t)/2+o*a/2-a*a*a,c=s*s-u*u*u;if(0===c){var h=2*(d=Math.pow(s,1/3))-a,l=-d-a;return e.filterByIn0to1([h,l])}if(c>0){var m=s+e.sign(s)*Math.sqrt(c),p=(f=e.sign(m)*Math.pow(Math.abs(m),1/3))+(d=u/f)-a;return e.filterByIn0to1([p])}var f=2*Math.sqrt(u),d=Math.acos(2*s/u/f),y=(h=f*Math.cos(d/3)-a,l=f*Math.cos((d+2*Math.PI)/3)-a,f*Math.cos((d+4*Math.PI)/3)-a);return e.filterByIn0to1([h,l,y])}},{key:"solutionsOfQuadEq",value:function(t,n,r){if(0===t)return e.solutionsOfLinearEq(n,r);var i=n*n-4*r*t;if(i>=0){var a=Math.sqrt(i),o=(-n+a)/2/t,u=(-n-a)/2/t;return e.filterByIn0to1([o,u])}return[]}},{key:"solutionsOfLinearEq",value:function(t,n){return 0===t?0===n?0:[]:e.filterByIn0to1([-n/t])}},{key:"filterByIn0to1",value:function(e){for(var t=[],n=0;n=0&&r<=1&&t.push(r)}return t}}]),e}();Et.QuadBezier=function(e){wt(n,e);var t=bt(n);function n(e,r,i){var a;Mt(this,n),(a=t.call(this)).cp0=e,a.cp1=r,a.cp2=i;var o=e.x,u=2*(r.x-e.x),s=i.x-2*r.x+e.x;a.px=function(e){return o+e*u+e*e*s},a.dpx=function(e){return u+2*e*s};var c=e.y,h=2*(r.y-e.y),l=i.y-2*r.y+e.y;return a.py=function(e){return c+e*h+e*e*l},a.dpy=function(e){return h+2*e*l},a}return Ot(n,[{key:"startPosition",value:function(){return this.cp0}},{key:"endPosition",value:function(){return this.cp2}},{key:"position",value:function(e){return new rt.Point(this.px(e),this.py(e))}},{key:"derivative",value:function(e){return new rt.Point(this.dpx(e),this.dpy(e))}},{key:"angle",value:function(e){return Math.atan2(this.dpy(e),this.dpx(e))}},{key:"boundingBox",value:function(e){var t=this.maxMin(this.cp0.x,this.cp1.x,this.cp2.x,e),n=this.maxMin(this.cp0.y,this.cp1.y,this.cp2.y,e);if(0===e)return new rt.Rect(this.cp0.x,this.cp0.y,{l:this.cp0.x-t.min,r:t.max-this.cp0.x,u:n.max-this.cp0.y,d:this.cp0.y-n.min});var r=Math.PI/2,i=this.cp0.x,a=this.cp0.y,o=this.cp2.x,u=this.cp2.y,s=this.angle(0)+r,c=this.angle(1)+r,h=e*Math.cos(s),l=e*Math.sin(s),m=e*Math.cos(c),p=e*Math.sin(c),f=Math.min(t.min,i+h,i-h,o+m,o-m),d=Math.max(t.max,i+h,i-h,o+m,o-m),y=Math.min(n.min,a+l,a-l,u+p,u-p),v=Math.max(n.max,a+l,a-l,u+p,u-p);return new rt.Rect(i,a,{l:i-f,r:d-i,u:v-a,d:a-y})}},{key:"maxMin",value:function(e,t,n,r){var i,a;e>n?(i=e,a=n):(i=n,a=e);var o,u,s=Ue,c=s(e),h=s(t-e),l=s(n-2*t+e);return 0!=l&&(u=-h/l)>0&&u<1&&(o=function(e){return c+2*e*h+e*e*l}(u),i=Math.max(i,o+r,o-r),a=Math.min(a,o+r,o-r)),{min:a,max:i}}},{key:"divide",value:function(e){if(e<0||e>1)throw s("ExecutionError","illegal quadratic Bezier parameter t:"+e);var t=this.cp0.x,n=this.cp1.x,r=this.cp2.x,i=this.cp0.y,a=this.cp1.y,o=this.cp2.y,u=this.px(e),c=this.py(e),h=this.cp0,l=new rt.Point(t+e*(n-t),i+e*(a-i)),m=new rt.Point(u,c),p=m,f=new rt.Point(n+e*(r-n),a+e*(o-a)),d=this.cp2;return[new Et.QuadBezier(h,l,m),new Et.QuadBezier(p,f,d)]}},{key:"slice",value:function(e,t){if(!(e>=t)){if(e<0&&(e=0),t>1&&(t=1),0===e&&1===t)return this;this.cp0.x;var n=this.cp1.x,r=this.cp2.x,i=(this.cp0.y,this.cp1.y),a=this.cp2.y,o=this.px(e),u=this.py(e),s=n+e*(r-n),c=i+e*(a-i),h=new rt.Point(o,u),l=new rt.Point(o+t*(s-o),u+t*(c-u)),m=new rt.Point(this.px(t),this.py(t));return new Et.QuadBezier(h,l,m)}}},{key:"tOfIntersections",value:function(e){if(e.isPoint())return[];if(e.isRect()){var t,n=e.x+e.r,r=e.x-e.l,i=e.y+e.u,a=e.y-e.d,o=Ue,u=this.cp0.x,s=this.cp1.x,c=this.cp2.x,h=o(u),l=o(2*(s-u)),m=o(c-2*s+u),p=function(e){return h+e*l+e*e*m},f=this.cp0.y,d=this.cp1.y,y=this.cp2.y,v=o(f),x=o(2*(d-f)),g=o(y-2*d+f),w=function(e){return v+e*x+e*e*g},S=[];t=(t=Et.solutionsOfQuadEq(m,l,h-n)).concat(Et.solutionsOfQuadEq(m,l,h-r));for(var b=0;b=a&&M<=i&&S.push(I)}t=(t=Et.solutionsOfQuadEq(g,x,v-i)).concat(Et.solutionsOfQuadEq(g,x,v-a));for(b=0;b=r&&k<=n&&S.push(I)}return S}if(e.isCircle()){var C=Math.PI,k=e.x,M=e.y,P=e.l,O=e.r,B=e.u,E=e.d,A=k+(O-P)/2,L=M+(B-E)/2,j=(n=(P+O)/2,(B+E)/2),D=C/180,T=new At.Arc(A,L,n,j,-C-D,-C/2+D),R=new At.Arc(A,L,n,j,-C/2-D,0+D),F=new At.Arc(A,L,n,j,0-D,C/2+D),G=new At.Arc(A,L,n,j,C/2-D,C+D),V=new At.QuadBezier(this,0,1),_=[];_=(_=(_=(_=_.concat(At.findIntersections(T,V))).concat(At.findIntersections(R,V))).concat(At.findIntersections(F,V))).concat(At.findIntersections(G,V));for(S=[],b=0;b<_.length;b++){var I=(_[b][1].min+_[b][1].max)/2;S.push(I)}return S}}},{key:"countOfSegments",value:function(){return 1}},{key:"drawPrimitive",value:function(e,t){var n=this.cp0,r=this.cp1,i=this.cp2;e.createSVGElement("path",{d:"M"+pe.measure.em2px(n.x)+","+pe.measure.em2px(-n.y)+" Q"+pe.measure.em2px(r.x)+","+pe.measure.em2px(-r.y)+" "+pe.measure.em2px(i.x)+","+pe.measure.em2px(-i.y),"stroke-dasharray":t})}},{key:"toString",value:function(){return"QuadBezier("+this.cp0.x+", "+this.cp0.y+")-("+this.cp1.x+", "+this.cp1.y+")-("+this.cp2.x+", "+this.cp2.y+")"}}]),n}(Et),Et.CubicBezier=function(e){wt(n,e);var t=bt(n);function n(e,r,i,a){var o;Mt(this,n),(o=t.call(this)).cp0=e,o.cp1=r,o.cp2=i,o.cp3=a;var u=e.x,s=3*(r.x-e.x),c=3*(i.x-2*r.x+e.x),h=a.x-3*i.x+3*r.x-e.x;o.px=function(e){return u+e*s+e*e*c+e*e*e*h},o.dpx=function(e){return s+2*e*c+3*e*e*h};var l=e.y,m=3*(r.y-e.y),p=3*(i.y-2*r.y+e.y),f=a.y-3*i.y+3*r.y-e.y;return o.py=function(e){return l+e*m+e*e*p+e*e*e*f},o.dpy=function(e){return m+2*e*p+3*e*e*f},o}return Ot(n,[{key:"startPosition",value:function(){return this.cp0}},{key:"endPosition",value:function(){return this.cp3}},{key:"position",value:function(e){return new rt.Point(this.px(e),this.py(e))}},{key:"derivative",value:function(e){return new rt.Point(this.dpx(e),this.dpy(e))}},{key:"angle",value:function(e){return Math.atan2(this.dpy(e),this.dpx(e))}},{key:"boundingBox",value:function(e){var t=this.maxMin(this.cp0.x,this.cp1.x,this.cp2.x,this.cp3.x,e),n=this.maxMin(this.cp0.y,this.cp1.y,this.cp2.y,this.cp3.y,e);if(0===e)return new rt.Rect(this.cp0.x,this.cp0.y,{l:this.cp0.x-t.min,r:t.max-this.cp0.x,u:n.max-this.cp0.y,d:this.cp0.y-n.min});var r=Math.PI/2,i=this.cp0.x,a=this.cp0.y,o=this.cp3.x,u=this.cp3.y,s=this.angle(0)+r,c=this.angle(1)+r,h=e*Math.cos(s),l=e*Math.sin(s),m=e*Math.cos(c),p=e*Math.sin(c),f=Math.min(t.min,i+h,i-h,o+m,o-m),d=Math.max(t.max,i+h,i-h,o+m,o-m),y=Math.min(n.min,a+l,a-l,u+p,u-p),v=Math.max(n.max,a+l,a-l,u+p,u-p);return new rt.Rect(i,a,{l:i-f,r:d-i,u:v-a,d:a-y})}},{key:"maxMin",value:function(e,t,n,r,i){var a,o;e>r?(a=e,o=r):(a=r,o=e);var u,s=Ue,c=s(e),h=s(t-e),l=s(n-2*t+e),m=s(r-3*n+3*t-e),p=function(e){e>0&&e<1&&(u=function(e){return c+3*e*h+3*e*e*l+e*e*e*m}(e),a=Math.max(a,u+i,u-i),o=Math.min(o,u+i,u-i))};if(0==m)0!=l&&p(-h/l/2);else{var f=l*l-h*m;f>0?(p((-l+Math.sqrt(f))/m),p((-l-Math.sqrt(f))/m)):0==f&&p(-l/m)}return{min:o,max:a}}},{key:"divide",value:function(e){if(e<0||e>1)throw s("ExecutionError","illegal cubic Bezier parameter t:"+e);var t=this.cp0.x,n=this.cp1.x,r=this.cp2.x,i=this.cp3.x,a=this.cp0.y,o=this.cp1.y,u=this.cp2.y,c=this.cp3.y,h=this.px(e),l=this.py(e),m=this.cp0,p=new rt.Point(t+e*(n-t),a+e*(o-a)),f=new rt.Point(t+2*e*(n-t)+e*e*(r-2*n+t),a+2*e*(o-a)+e*e*(u-2*o+a)),d=new rt.Point(h,l),y=d,v=new rt.Point(n+2*e*(r-n)+e*e*(i-2*r+n),o+2*e*(u-o)+e*e*(c-2*u+o)),x=new rt.Point(r+e*(i-r),u+e*(c-u)),g=this.cp3;return[new Et.CubicBezier(m,p,f,d),new Et.CubicBezier(y,v,x,g)]}},{key:"slice",value:function(e,t){if(!(e>=t)){if(e<0&&(e=0),t>1&&(t=1),0===e&&1===t)return this;this.cp0.x;var n=this.cp1.x,r=this.cp2.x,i=this.cp3.x,a=(this.cp0.y,this.cp1.y),o=this.cp2.y,u=this.cp3.y,s=this.px(e),c=this.py(e),h=n+2*e*(r-n)+e*e*(i-2*r+n),l=a+2*e*(o-a)+e*e*(u-2*o+a),m=r+e*(i-r),p=o+e*(u-o),f=new rt.Point(s,c),d=new rt.Point(s+t*(h-s),c+t*(l-c)),y=new rt.Point(s+2*t*(h-s)+t*t*(m-2*h+s),c+2*t*(l-c)+t*t*(p-2*l+c)),v=new rt.Point(this.px(t),this.py(t));return new Et.CubicBezier(f,d,y,v)}}},{key:"tOfIntersections",value:function(e){if(e.isPoint())return[];if(e.isRect()){var t,n=e.x+e.r,r=e.x-e.l,i=e.y+e.u,a=e.y-e.d,o=Ue,u=this.cp0.x,s=this.cp1.x,c=this.cp2.x,h=this.cp3.x,l=this.cp0.y,m=this.cp1.y,p=this.cp2.y,f=this.cp3.y,d=o(u),y=o(3*(s-u)),v=o(3*(c-2*s+u)),x=o(h-3*c+3*s-u),g=function(e){return d+e*y+e*e*v+e*e*e*x},w=o(l),S=o(3*(m-l)),b=o(3*(p-2*m+l)),C=o(f-3*p+3*m-l),k=function(e){return w+e*S+e*e*b+e*e*e*C},M=[];t=(t=Et.solutionsOfCubicEq(x,v,y,d-n)).concat(Et.solutionsOfCubicEq(x,v,y,d-r));for(var P=0;P=a&&E<=i&&M.push(N)}t=(t=Et.solutionsOfCubicEq(C,b,S,w-i)).concat(Et.solutionsOfCubicEq(C,b,S,w-a));for(P=0;P=r&&B<=n&&M.push(N)}return M}if(e.isCircle()){var O=Math.PI,B=e.x,E=e.y,A=e.l,L=e.r,j=e.u,D=e.d,T=B+(L-A)/2,R=E+(j-D)/2,F=(n=(A+L)/2,(j+D)/2),G=O/180,V=new At.Arc(T,R,n,F,-O-G,-O/2+G),_=new At.Arc(T,R,n,F,-O/2-G,0+G),I=new At.Arc(T,R,n,F,0-G,O/2+G),z=new At.Arc(T,R,n,F,O/2-G,O+G),Q=new At.CubicBezier(this,0,1),W=[];W=(W=(W=(W=W.concat(At.findIntersections(V,Q))).concat(At.findIntersections(_,Q))).concat(At.findIntersections(I,Q))).concat(At.findIntersections(z,Q));for(M=[],P=0;P=i&&(o=i-1);var u=a-o;return n(e[o],u)},r}return Ot(n,[{key:"startPosition",value:function(){return this.cbs[0].cp0}},{key:"endPosition",value:function(){return this.cbs[this.cbs.length-1].cp3}},{key:"position",value:function(e){return this.delegate(e,(function(e,t){return e.position(t)}),void 0)}},{key:"derivative",value:function(e){return this.delegate(e,(function(e,t){return e.derivative(t)}),void 0)}},{key:"angle",value:function(e){return this.delegate(e,(function(e,t){return e.angle(t)}),0)}},{key:"velocity",value:function(e){var t=this.cbs.length;return this.delegate(e,(function(e,n){return t*e.velocity(n)}),0)}},{key:"boundingBox",value:function(e){if(0!=this.cbs.length){var t,n=this.cbs[0].boundingBox(e),r=this.cbs.length;for(t=1;t1)throw s("ExecutionError","illegal cubic Bezier parameter t:"+e);if(0===e)return[new Et.CubicBeziers([]),this];if(1===e)return[this,new Et.CubicBeziers([])];var t=this.cbs.length,n=e*t,r=Math.floor(n);r===t&&(r=t-1);var i=n-r,a=this.cbs.slice(0,r),o=this.cbs.slice(r+1),u=this.cbs[r].divide(i);return a.push(u[0]),o.unshift(u[1]),[new Et.CubicBeziers(a),new Et.CubicBeziers(o)]}},{key:"slice",value:function(e,t){if(!(e>=t)){if(e<0&&(e=0),t>1&&(t=1),0===e&&1===t)return this;var n=this.cbs.length,r=e*n,i=t*n,a=Math.floor(r),o=Math.floor(i);a===n&&(a=n-1),o===n&&(o=n-1);var u,s=r-a,c=i-o;return a===o?u=[this.cbs[a].slice(s,c)]:((u=this.cbs.slice(a+1,o)).push(this.cbs[o].slice(0,c)),u.unshift(this.cbs[a].slice(s,1))),new Et.CubicBeziers(u)}}},{key:"countOfSegments",value:function(){return this.cbs.length}},{key:"drawPrimitive",value:function(e,t){for(var n=this.cbs.length,r=this.cbs,i=r[0],a=i.cp0,o=i.cp1,u=i.cp2,s=i.cp3,c="M"+pe.measure.em2px(a.x)+","+pe.measure.em2px(-a.y)+" C"+pe.measure.em2px(o.x)+","+pe.measure.em2px(-o.y)+" "+pe.measure.em2px(u.x)+","+pe.measure.em2px(-u.y)+" "+pe.measure.em2px(s.x)+","+pe.measure.em2px(-s.y),h=1;h=0;n--){var l=i[n],m=h[n+1],p=l*l*s[n]-u[n]*m;h[n]=p,c[n]=t[n+1]-t[n]-(m+2*p)/3}var f=new Array(r),d=new Array(r);for(n=0;nu?i[u]:i[e]},h=function(e){var t=Math.abs(e);return t<=1?(3*t*t*t-6*t*t+4)/6:t<=2?-(t-2)*(t-2)*(t-2)/6:0};this.px=function(e){for(var t=(u+2)*e-1,n=Math.ceil(t-2),r=Math.floor(t+2),i=0,a=n;a<=r;a++)i+=h(t-a)*c(a).x;return i},this.py=function(e){for(var t=(u+2)*e-1,n=Math.ceil(t-2),r=Math.floor(t+2),i=0,a=n;a<=r;a++)i+=h(t-a)*c(a).y;return i};var l=function(e){var t=e>0?1:e<0?-1:0,n=Math.abs(e);return n<=1?t*(3*n*n-4*n)/2:n<=2?-t*(n-2)*(n-2)/2:0};this.dpx=function(e){for(var t=(u+2)*e-1,n=Math.ceil(t-2),r=Math.floor(t+2),i=0,a=n;a<=r;a++)i+=l(t-a)*c(a).x;return i},this.dpy=function(e){for(var t=(u+2)*e-1,n=Math.ceil(t-2),r=Math.floor(t+2),i=0,a=n;a<=r;a++)i+=l(t-a)*c(a).y;return i}}return Ot(e,[{key:"position",value:function(e){return new rt.Point(this.px(e),this.py(e))}},{key:"angle",value:function(e){return Math.atan2(this.dpy(e),this.dpx(e))}},{key:"toCubicBeziers",value:function(){var e=[],t=this.cps,n=t[0],r=t[1],i=t[2],a=n.x,o=n.y,u=a+(r.x-a)/3,s=o+(r.y-o)/3,c=a+2*(r.x-a)/3,h=o+2*(r.y-o)/3,l=r.x+(i.x-r.x)/3,m=r.y+(i.y-r.y)/3,p=(c+l)/2,f=(h+m)/2,d=n,y=new rt.Point(u,s),v=new rt.Point(c,h),x=new rt.Point(p,f),g=new Et.CubicBezier(d,y,v,x);e.push(g);for(var w=this.cps.length-1,S=2;S=t)){if(e<0&&(e=0),t>1&&(t=1),0===e&&1===t)return this;var n=this.s,r=this.e,i=r.x-n.x,a=r.y-n.y,o=new rt.Point(n.x+e*i,n.y+e*a),u=new rt.Point(n.x+t*i,n.y+t*a);return new Et.Line(o,u)}}},{key:"tOfIntersections",value:function(e){if(e.isPoint())return[];var t=this.s,n=this.e;if(e.isRect()){var r,i=e.x+e.r,a=e.x-e.l,o=e.y+e.u,u=e.y-e.d,s=t.x,c=t.y,h=n.x-s,l=n.y-c,m=function(e){return s+e*h},p=function(e){return c+e*l},f=[];r=(r=Et.solutionsOfLinearEq(h,s-i)).concat(Et.solutionsOfLinearEq(h,s-a));for(var d=0;d=u&&y<=o&&f.push(v)}r=(r=Et.solutionsOfLinearEq(l,c-o)).concat(Et.solutionsOfLinearEq(l,c-u));for(d=0;d=a&&x<=i&&f.push(v)}return f}if(e.isCircle()){Math.PI;var g=e.l,w=e.r,S=e.u,b=e.d,C=e.x+(w-g)/2,k=e.y+(S-b)/2,M=(i=(g+w)/2,(S+b)/2),P=t.x,O=t.y,B=n.x-P,E=-B,A=(u=n.y-O)*i,L=E*M,j=A*A+L*L,D=(n=-(b=A*C+L*k+((B*O-u*P)*i+(i-M)*E*k))/j,j*i*i-b*b);if(D<0)return[];var T,R,F=Math.sqrt(D)/j,G=M/i,V=A*n+L*F+C,_=G*(L*n-A*F+k-k)+k,I=A*n-L*F+C,z=G*(L*n+A*F+k-k)+k;Math.abs(B)>Math.abs(u)?(T=(V-P)/B,R=(I-P)/B):(T=(_-O)/u,R=(z-O)/u);f=[];return T>=0&&T<=1&&f.push(T),R>=0&&R<=1&&f.push(R),f}}},{key:"toShape",value:function(e,t,n,r){var i=e.env,a=pe.measure.thickness,o=this.s,u=this.e;if(o.x!==u.x||o.y!==u.y){var s,c=u.x-o.x,h=u.y-o.y,l=Math.atan2(h,c),m=ft.none;switch(n){case"=":n="-",r="2";break;case"==":n="--",r="2";break;case":":case"::":n=".",r="2"}switch(n){case"":return i.angle=l,i.lastCurve=new Lt.Line(o,u,i.p,i.c,void 0),m;case"-":case".":case"..":switch(r){case"2":s=a/2;break;case"3":s=a;break;default:s=0}break;case"--":var p=3*a;if((y=Math.sqrt(c*c+h*h))>=p)switch(r){case"2":s=a/2;break;case"3":s=a;break;default:s=0}break;case"~":case"~~":switch(r){case"2":s=1.5*a;break;case"3":s=2*a;break;default:s=0}break;default:var f=t.boundingBox(e);if(null==f)return i.angle=0,i.lastCurve=Lt.none,ft.none;var d=f.l+f.r;0==d&&(d=pe.measure.strokeWidth);var y=Math.sqrt(c*c+h*h);if(0==Math.floor(y/d))return i.angle=0,i.lastCurve=Lt.none,ft.none;s=Math.max(f.u,f.d)}if(void 0!==s){var v=this.boundingBox(s);return m=new ft.LineShape(this,t,n,r,v),e.appendShapeToFront(m),i.angle=l,i.lastCurve=new Lt.Line(o,u,i.p,i.c,m),m}}return i.angle=0,i.lastCurve=Lt.none,ft.none}},{key:"boundingBox",value:function(e){var t=this.s,n=this.e,r=n.x-t.x,i=n.y-t.y,a=Math.atan2(i,r),o=e*Math.cos(a+Math.PI/2),u=e*Math.sin(a+Math.PI/2);return new rt.Rect(t.x,t.y,{l:t.x-Math.min(t.x+o,t.x-o,n.x+o,n.x-o),r:Math.max(t.x+o,t.x-o,n.x+o,n.x-o)-t.x,u:Math.max(t.y+u,t.y-u,n.y+u,n.y-u)-t.y,d:t.y-Math.min(t.y+u,t.y-u,n.y+u,n.y-u)})}},{key:"drawLine",value:function(e,t,n,r,i){if(i.isEmpty)this._drawLine(e,t,n,r);else{var a=new yt(0,1).differenceRanges(i),o=this;a.foreach((function(i){o.slice(i.start,i.end)._drawLine(e,t,n,r)}))}}},{key:"_drawLine",value:function(e,t,n,r){var i=pe.measure.thickness,a=this.s,o=this.e;if(a.x!==o.x||a.y!==o.y){var u=o.x-a.x,s=o.y-a.y,c=Math.atan2(s,u),h={x:0,y:0};switch(n){case"":break;case"-":this.drawStraightLine(e,a,o,h,c,i,r,"");break;case"=":this.drawStraightLine(e,a,o,h,c,i,"2","");break;case".":case"..":this.drawStraightLine(e,a,o,h,c,i,r,pe.measure.dottedDasharray);break;case":":case"::":this.drawStraightLine(e,a,o,h,c,i,"2",pe.measure.dottedDasharray);break;case"--":case"==":var l=3*i;if((P=Math.sqrt(u*u+s*s))>=l)h={x:(O=(P-l)/2-Math.floor((P-l)/2/l)*l)*Math.cos(c),y:O*Math.sin(c)},this.drawStraightLine(e,a,o,h,c,i,"=="===n?"2":r,pe.measure.em2px(l)+" "+pe.measure.em2px(l));break;case"~":if((P=Math.sqrt(u*u+s*s))>=(w=4*i)){h={x:(O=(P-(M=Math.floor(P/w))*w)/2)*Math.cos(c),y:O*Math.sin(c)};for(var m=i*Math.cos(c+Math.PI/2),p=i*Math.sin(c+Math.PI/2),f=i*Math.cos(c),d=i*Math.sin(c),y=a.x+h.x,v=-a.y-h.y,x="M"+pe.measure.em2px(y)+","+pe.measure.em2px(v)+" Q"+pe.measure.em2px(y+f+m)+","+pe.measure.em2px(v-d-p)+" "+pe.measure.em2px(y+2*f)+","+pe.measure.em2px(v-2*d)+" T"+pe.measure.em2px(y+4*f)+","+pe.measure.em2px(v-4*d),g=1;g=(w=4*i)){h={x:(O=(P-w)/2-(M=Math.floor((P-w)/2/w))*w)*Math.cos(c),y:O*Math.sin(c)};for(m=i*Math.cos(c+Math.PI/2),p=i*Math.sin(c+Math.PI/2),f=i*Math.cos(c),d=i*Math.sin(c),y=a.x+h.x,v=-a.y-h.y,x="",g=0;g<=M;g++)x+=" M"+pe.measure.em2px(y+8*g*f)+","+pe.measure.em2px(v-8*g*d)+" Q"+pe.measure.em2px(y+(8*g+1)*f+m)+","+pe.measure.em2px(v-(8*g+1)*d-p)+" "+pe.measure.em2px(y+(8*g+2)*f)+","+pe.measure.em2px(v-(8*g+2)*d)+" T"+pe.measure.em2px(y+(8*g+4)*f)+","+pe.measure.em2px(v-(8*g+4)*d);this.drawSquigglyLineShape(e,x,a,o,m,p,r)}break;default:var S=new Bt;S.c=Bt.originPosition;var b=new xt(ft.none,S),C=t.boundingBox(b);if(null==C)return;var k=C.l+C.r;0==k&&(k=pe.measure.strokeWidth);var M,P=Math.sqrt(u*u+s*s);if(0==(M=Math.floor(P/k)))return;var O=(P-M*k)/2,B=Math.cos(c),E=Math.sin(c),A=k*B,L=k*E,j=a.x+(O+C.l)*B,D=a.y+(O+C.l)*E;for(b=new xt(ft.none,S),g=0;gc?c=l:l0&&r<1&&(void 0===i||r=0&&(m=!1)}if(m)return}else i=0;if(c[s][1]<0)for(l=0;l0&&r<1&&(void 0===a||r>a)&&(a=r)}else a=1;for(l=0;l<=s;l++)c[l]=[l/s,n[0]*e[l].x+n[1]*e[l].y+n[2],1];if(c[0][1]<0){var p=!0;for(l=1;l<=s;l++){var f;(r=-(f=h(c[0],c[l]))[2]/f[0])>0&&r<1&&(void 0===o||r=0&&(p=!1)}if(p)return}else o=0;if(c[s][1]<0)for(l=0;l0&&r<1&&(void 0===u||r>u)&&(u=r)}else u=1;var y=Math.max(i,o),v=Math.min(a,u);return{min:this.tmin+y*(this.tmax-this.tmin),max:this.tmin+v*(this.tmax-this.tmin)}}}],[{key:"findIntersections",value:function(t,n){for(var r=e.maxIterations,i=e.goalAccuracy,a=[[t,n,!1]],o=0,u=[];o0;){o++;var s=a.shift(),c=(t=s[0],n=s[1],s[2]),h=t.fatLine(),l=n.clippedRange(h.min,h.max);if(null!=l){var m=l.min,p=l.max,f=p-m;if(ft.paramLength()){var d=(p+m)/2;a.push([n.clip(m,d),t,!c]),a.push([n.clip(d,p),t,!c])}else{var y=n.clip(m,p),v=t.paramRange(),x=(v.min+v.max)/2;a.push([y,t.clip(v.min,x),!c]),a.push([y,t.clip(x,v.max),!c])}}}return u}},{key:"maxIterations",get:function(){return 30}},{key:"goalAccuracy",get:function(){return 1e-4}}]),e}();At.Line=function(e){wt(n,e);var t=bt(n);function n(e,r,i,a){var o;return Mt(this,n),(o=t.call(this)).p0=e,o.p1=r,o.tmin=i,o.tmax=a,o}return Ot(n,[{key:"paramRange",value:function(){return{min:this.tmin,max:this.tmax}}},{key:"paramLength",value:function(){return this.tmax-this.tmin}},{key:"containsParam",value:function(e){return e>=this.tmin&&e<=this.tmax}},{key:"position",value:function(e){return{x:this.p0.x+e*(this.p1.x-this.p0.x),y:this.p0.y+e*(this.p1.y-this.p0.y)}}},{key:"fatLine",value:function(){var e=this.p1.y-this.p0.y,t=this.p0.x-this.p1.x,n=this.p1.x*this.p0.y-this.p0.x*this.p1.y,r=Math.sqrt(e*e+t*t);return 0===r?(e=1,t=0):(e/=r,t/=r,n/=r),{min:[e,t,n],max:[e,t,n]}}},{key:"clip",value:function(e,t){return new At.Line(this.p0,this.p1,e,t)}},{key:"clippedRange",value:function(e,t){var n=new Array(2);return n[0]=this.position(this.tmin),n[1]=this.position(this.tmax),this.clippedLineRange(n,e,t)}},{key:"drawFatLine",value:function(){this.fatLine().min;var e=function(e,t){return-(e*t[0]+t[2])/t[1]},t=this.p0.x,n=this.p1.x;pe.svgForDebug.createSVGElement("line",{x1:pe.measure.em2px(t),y1:-pe.measure.em2px(e(t,lmax)),x2:pe.measure.em2px(n),y2:-pe.measure.em2px(e(n,lmax)),"stroke-width":pe.measure.em2px(.02*pe.measure.oneem),stroke:"red"})}}]),n}(At),At.QuadBezier=function(e){wt(n,e);var t=bt(n);function n(e,r,i){var a;return Mt(this,n),(a=t.call(this)).bezier=e,a.tmin=r,a.tmax=i,a.cp0=e.position(r),a.cp1=new rt.Point((1-i)*(1-r)*e.cp0.x+(r+i-2*r*i)*e.cp1.x+r*i*e.cp2.x,(1-i)*(1-r)*e.cp0.y+(r+i-2*r*i)*e.cp1.y+r*i*e.cp2.y),a.cp2=e.position(i),a.cps=[a.cp0,a.cp1,a.cp2],a}return Ot(n,[{key:"paramRange",value:function(){return{min:this.tmin,max:this.tmax}}},{key:"paramLength",value:function(){return this.tmax-this.tmin}},{key:"fatLine",value:function(){return this.bezierFatLine(2)}},{key:"clip",value:function(e,t){return new At.QuadBezier(this.bezier,e,t)}},{key:"clippedRange",value:function(e,t){return this.clippedLineRange(this.cps,e,t)}},{key:"drawFatLine",value:function(){var e=this.fatLine(),t=e.min,n=e.max,r=function(e,t){return-(e*t[0]+t[2])/t[1]},i=this.cp0.x,a=this.cp2.x;pe.svgForDebug.createSVGElement("line",{x1:pe.measure.em2px(i),y1:-pe.measure.em2px(r(i,t)),x2:pe.measure.em2px(a),y2:-pe.measure.em2px(r(a,t)),"stroke-width":pe.measure.em2px(.02*pe.measure.oneem),stroke:"blue"}),pe.svgForDebug.createSVGElement("line",{x1:pe.measure.em2px(i),y1:-pe.measure.em2px(r(i,n)),x2:pe.measure.em2px(a),y2:-pe.measure.em2px(r(a,n)),"stroke-width":pe.measure.em2px(.02*pe.measure.oneem),stroke:"red"})}}]),n}(At),At.CubicBezier=function(e){wt(n,e);var t=bt(n);function n(e,r,i){var a;return Mt(this,n),(a=t.call(this)).bezier=e,a.tmin=r,a.tmax=i,a.cp0=e.position(r),a.cp1=new rt.Point((1-i)*(1-r)*(1-r)*e.cp0.x+(1-r)*(2*r+i-3*r*i)*e.cp1.x+r*(2*i+r-3*r*i)*e.cp2.x+r*r*i*e.cp3.x,(1-i)*(1-r)*(1-r)*e.cp0.y+(1-r)*(2*r+i-3*r*i)*e.cp1.y+r*(2*i+r-3*r*i)*e.cp2.y+r*r*i*e.cp3.y),a.cp2=new rt.Point((1-r)*(1-i)*(1-i)*e.cp0.x+(1-i)*(2*i+r-3*r*i)*e.cp1.x+i*(2*r+i-3*r*i)*e.cp2.x+r*i*i*e.cp3.x,(1-r)*(1-i)*(1-i)*e.cp0.y+(1-i)*(2*i+r-3*r*i)*e.cp1.y+i*(2*r+i-3*r*i)*e.cp2.y+r*i*i*e.cp3.y),a.cp3=e.position(i),a.cps=[a.cp0,a.cp1,a.cp2,a.cp3],a}return Ot(n,[{key:"paramRange",value:function(){return{min:this.tmin,max:this.tmax}}},{key:"paramLength",value:function(){return this.tmax-this.tmin}},{key:"fatLine",value:function(){return this.bezierFatLine(3)}},{key:"clip",value:function(e,t){return new At.CubicBezier(this.bezier,e,t)}},{key:"clippedRange",value:function(e,t){return this.clippedLineRange(this.cps,e,t)}},{key:"drawFatLine",value:function(){var e=this.fatLine(),t=e.min,n=e.max,r=function(e,t){return-(e*t[0]+t[2])/t[1]},i=this.cp0.x,a=this.cp3.x;pe.svgForDebug.createSVGElement("line",{x1:pe.measure.em2px(i),y1:-pe.measure.em2px(r(i,t)),x2:pe.measure.em2px(a),y2:-pe.measure.em2px(r(a,t)),"stroke-width":pe.measure.em2px(.02*pe.measure.oneem),stroke:"blue"}),pe.svgForDebug.createSVGElement("line",{x1:pe.measure.em2px(i),y1:-pe.measure.em2px(r(i,n)),x2:pe.measure.em2px(a),y2:-pe.measure.em2px(r(a,n)),"stroke-width":pe.measure.em2px(.02*pe.measure.oneem),stroke:"red"})}}]),n}(At),At.Arc=function(e){wt(n,e);var t=bt(n);function n(e,r,i,a,o,u){var s;return Mt(this,n),(s=t.call(this)).x=e,s.y=r,s.rx=i,s.ry=a,s.angleMin=o,s.angleMax=u,s}return Ot(n,[{key:"paramRange",value:function(){return{min:this.angleMin,max:this.angleMax}}},{key:"paramLength",value:function(){return this.angleMax-this.angleMin}},{key:"normalizeAngle",value:function(e){return(e=e%2*Math.PI)>Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e}},{key:"containsParam",value:function(e){return e>=this.angleMin&&e<=this.angleMax}},{key:"fatLine",value:function(){var e=this.rx,t=this.ry,n=(this.angleMax+this.angleMin)/2,r=(this.angleMax-this.angleMin)/2,i=Math.cos(n),a=Math.sin(n),o=Math.sqrt(e*e*a*a+t*t*i*i);if(o=0){var p=o[0]*l-o[1]*Math.sqrt(s*s-l*l),f=o[1]*l+o[0]*Math.sqrt(s*s-l*l),d=o[0]*l+o[1]*Math.sqrt(s*s-l*l),y=o[1]*l-o[0]*Math.sqrt(s*s-l*l),v=Math.atan2(f,p),x=Math.atan2(y,d);this.containsParam(v)&&m.push(v),this.containsParam(x)&&m.push(x)}var g,w,S=-(o[0]*(n+s*Math.cos(c))+o[1]*(r+s*Math.sin(c))+o[2]),b=-(o[0]*(n+s*Math.cos(h))+o[1]*(r+s*Math.sin(h))+o[2]);if(S<0){if(0==m.length)return;g=Math.min.apply(Math,m)}else g=this.angleMin;if(b<0){if(0==m.length)return;w=Math.max.apply(Math,m)}else w=this.angleMax;m=[];if(s*s-(l=u[0]*n+u[1]*r+u[2])*l>=0){p=-o[0]*l+o[1]*Math.sqrt(s*s-l*l),f=-o[1]*l-o[0]*Math.sqrt(s*s-l*l),d=-o[0]*l-o[1]*Math.sqrt(s*s-l*l),y=-o[1]*l+o[0]*Math.sqrt(s*s-l*l),v=Math.atan2(f,p),x=Math.atan2(y,d);this.containsParam(v)&&m.push(v),this.containsParam(x)&&m.push(x)}var C,k;S=u[0]*(n+s*Math.cos(c))+u[1]*(r+s*Math.sin(c))+u[2],b=u[0]*(n+s*Math.cos(h))+u[1]*(r+s*Math.sin(h))+u[2];if(S<0){if(0==m.length)return;C=Math.min.apply(Math,m)}else C=this.angleMin;if(b<0){if(0==m.length)return;k=Math.max.apply(Math,m)}else k=this.angleMax;return{min:Math.max(g,C),max:Math.min(w,k)}}},{key:"drawFatLine",value:function(){var e=this.fatLine(),t=e.min,n=e.max,r=function(e,t){return-(e*t[0]+t[2])/t[1]},i=this.x+this.r*Math.cos(this.angleMin),a=this.x+this.r*Math.cos(this.angleMax);pe.svgForDebug.createSVGElement("line",{x1:pe.measure.em2px(i),y1:-pe.measure.em2px(r(i,t)),x2:pe.measure.em2px(a),y2:-pe.measure.em2px(r(a,t)),"stroke-width":pe.measure.em2px(.02*pe.measure.oneem),stroke:"blue"}),pe.svgForDebug.createSVGElement("line",{x1:pe.measure.em2px(i),y1:-pe.measure.em2px(r(i,n)),x2:pe.measure.em2px(a),y2:-pe.measure.em2px(r(a,n)),"stroke-width":pe.measure.em2px(.02*pe.measure.oneem),stroke:"red"})}}]),n}(At);var Lt=function e(){Mt(this,e)};function jt(e,t){for(var n=0;n.5?(o=a.x-(1-n)*s+r*s/h,u=a.y-(1-n)*c+r*c/h):(o=i.x+n*s+r*s/h,u=i.y+n*c+r*c/h);var l=this.c.x-this.p.x,m=this.c.y-this.p.y;return 0===l&&0===m?0:Math.abs(l)>Math.abs(m)?(o-this.p.x)/l:(u-this.p.y)/m}},{key:"sliceHole",value:function(e,t){if(void 0!==this.lineShape&&!e.isPoint()){var n=this.lineShape,r=n.line,i=r.tOfIntersections(e);i.push(0),i.push(1),i.sort();for(var a=i[0],o=1;o0&&a.sliceHole(new yt(0,r)),i<1&&a.sliceHole(new yt(i,1))),o}return Ot(n,[{key:"isDefined",get:function(){return!0}},{key:"position",value:function(e){return this.origBezier.position(e)}},{key:"derivative",value:function(e){return this.origBezier.derivative(e)}},{key:"angle",value:function(e){return this.origBezier.angle(e)}},{key:"tOfPlace",value:function(e,t,n,r){var i,a;e?(i=this.tOfShavedStart,a=t?this.tOfShavedEnd-this.tOfShavedStart:1-this.tOfShavedStart):(i=0,a=t?this.tOfShavedEnd:1);var o=this.origBezier,u=i+a*n;if(0!==r){var s=o.length(u);u=o.tOfLength(s+r)}return u}},{key:"sliceHole",value:function(e,t){var n=this.curveShape;if(void 0!==n&&!e.isPoint()){var r=n.curve,i=r.tOfIntersections(e);i.push(0),i.push(1),i.sort();for(var a=i[0],o=1;o0&&a.sliceHole(new yt(0,r)),i<1&&a.sliceHole(new yt(i,1))),o}return Ot(n,[{key:"originalLine",value:function(){return this.originalLine}},{key:"isDefined",get:function(){return!0}},{key:"position",value:function(e){return this.origBezier.position(e)}},{key:"derivative",value:function(e){return this.origBezier.derivative(e)}},{key:"angle",value:function(e){return this.origBezier.angle(e)}},{key:"tOfPlace",value:function(e,t,n,r){var i,a;e?(i=this.tOfShavedStart,a=t?this.tOfShavedEnd-this.tOfShavedStart:1-this.tOfShavedStart):(i=0,a=t?this.tOfShavedEnd:1);var o=this.origBezier,u=i+a*n;if(0!==r){var s=o.length(u);u=o.tOfLength(s+r)}return u}},{key:"sliceHole",value:function(e,t){var n=this.curveShape;if(void 0!==n&&!e.isPoint()){var r=n.curve,i=r.tOfIntersections(e);i.push(0),i.push(1),i.sort();for(var a=i[0],o=1;o0&&u.sliceHole(new yt(0,a)),o<1&&u.sliceHole(new yt(o,1))),s}return Ot(n,[{key:"isDefined",get:function(){return!0}},{key:"position",value:function(e){return this.origBeziers.position(e)}},{key:"derivative",value:function(e){return this.origBeziers.derivative(e)}},{key:"angle",value:function(e){return this.origBeziers.angle(e)}},{key:"tOfPlace",value:function(e,t,n,r){var i,a;e?(i=this.tOfShavedStart,a=t?this.tOfShavedEnd-this.tOfShavedStart:1-this.tOfShavedStart):(i=0,a=t?this.tOfShavedEnd:1);var o=this.origBeziers,u=i+a*n;if(0!==r){var s=o.length(u);u=o.tOfLength(s+r)}return u}},{key:"sliceHole",value:function(e,t){var n=this.curveShape;if(void 0!==n&&!e.isPoint()){var r=n.curve,i=r.tOfIntersections(e);i.push(0),i.push(1),i.sort();for(var a=i[0],o=1;o0,a=r.shaveC>0,o=i?r.shaveP-1:0,u=a?r.shaveC-1:0;if(i&&(n=0),a&&(n=1),i==a&&(n=.5),void 0!==r.factor)if(r.factor.isIntercept){if(a=i=!1,void 0===(n=r.factor.value(e)))return}else n=r.factor.value(e);var s=pe.measure.length2em(r.slide.dimen.getOrElse("0"))+(o-u)*pe.measure.jot,c=t.lastCurve.tOfPlace(i,a,n,s),h=t.lastCurve.position(c),l=t.lastCurve.angle(c);return t.c=h,t.angle=l,c}}}),_t(Ce.Pos.PushCoord,{toShape:function(e){var t=e.env,n=this.coord.position(e);t.pushPos(n)}}),_t(Ce.Pos.EvalCoordThenPop,{toShape:function(e){var t=e.env;t.c=this.coord.position(e),t.popPos()}}),_t(Ce.Pos.LoadStack,{toShape:function(e){var t=e.env;t.startCapturePositions(),this.coord.position(e);var n=t.endCapturePositions();t.setStack(n),t.pushPos(t.c)}}),_t(Ce.Pos.DoCoord,{toShape:function(e){var t=e.env,n=this.coord;t.stack.reverse().foreach((function(r){t.c=r,n.position(e)}))}}),_t(Ce.Pos.InitStack,{toShape:function(e){e.env.initStack()}}),_t(Ce.Pos.EnterFrame,{toShape:function(e){e.env.enterStackFrame()}}),_t(Ce.Pos.LeaveFrame,{toShape:function(e){e.env.leaveStackFrame()}}),_t(Ce.Place.Factor,{value:function(e){return this.factor}}),_t(Ce.Place.Intercept,{value:function(e){var t=e.env;if(t.lastCurve.isDefined){var n=t.duplicate();n.angle=0,n.lastCurve=Lt.none,n.p=n.c=Bt.originPosition;var r=new xt(ft.none,n);this.pos.toShape(r);e.appendShapeToFront(r.shape),n.lastCurve.isDefined||(n.lastCurve=new Lt.Line(n.p,n.c,n.p,n.c,void 0));for(var i=[],a=t.lastCurve.segments(),o=n.lastCurve.segments(),u=0;u0){d=U,x=X,g=H,w=v(f=N),S=v(d),b=c.derivative(x),C=h.derivative(g),k=b.x*w,M=-C.x*S,B=k*k+(P=b.y*w)*P,E=k*M+P*(O=-C.y*S),A=M*k+O*P,L=M*M+O*O,F=k*(T=Z)+P*(R=Y),G=M*T+O*R,V=Math.sqrt(F*F+G*G)0))}return y(f)}var ee=(i[0][0].min+i[0][0].max)/2;for(u=1;ute&&(ee=te)}return ee}}}),_t(Ce.Pos.SavePos,{toShape:function(e){var t=e.env;t.savePos(this.id,new Rt.Position(t.c))}}),_t(Ce.Pos.SaveMacro,{toShape:function(e){e.env.savePos(this.id,new Rt.Macro(this.macro))}}),_t(Ce.Pos.SaveBase,{toShape:function(e){var t=e.env;t.savePos(this.id,new Rt.Base(t.origin,t.xBase,t.yBase))}}),_t(Ce.Pos.SaveStack,{toShape:function(e){var t=e.env;t.savePos(this.id,new Rt.Stack(t.stack))}}),_t(Ce.Object,{toDropShape:function(e){var t=e.env;if(void 0===t.c)return ft.none;var n=this.modifiers;if(n.isEmpty)return this.object.toDropShape(e);var r=t.duplicate(),i=new xt(ft.none,r),a=L.empty;n.foreach((function(e){e.preprocess(i,a),a=a.prepend(e)}));var o=this.object.toDropShape(i),u=r.c;if(void 0===u)return ft.none;var s=r.originalReferencePoint;return(r=t.duplicate()).c=u,r.originalReferencePoint=s,i=new xt(ft.none,r),o=n.head.modifyShape(i,o,n.tail),e.appendShapeToFront(o),t.c=r.c.move(t.c.x,t.c.y),o},toConnectShape:function(e){var t=e.env;if(void 0===t.c)return ft.none;var n=this.modifiers;if(n.isEmpty)return this.object.toConnectShape(e);var r=t.duplicate(),i=new xt(ft.none,r),a=L.empty;n.foreach((function(e){e.preprocess(i,a),a=a.prepend(e)}));var o=this.object.toConnectShape(i);t.angle=r.angle,t.lastCurve=r.lastCurve;var u=r.c;if(void 0===u)return ft.none;var s=r.originalReferencePoint;return(r=t.duplicate()).c=u,r.originalReferencePoint=s,i=new xt(ft.none,r),o=n.head.modifyShape(i,o,n.tail),e.appendShapeToFront(o),t.c=r.c.move(t.c.x,t.c.y),o},boundingBox:function(e){var t=e.duplicateEnv(),n=t.env;return n.angle=0,n.p=n.c=Bt.originPosition,t.shape=ft.none,this.toDropShape(t).getBoundingBox()}}),_t(Ce.ObjectBox,{toConnectShape:function(e){var t=(n=e.env).c,n=e.env,r=(pe.measure.thickness,n.p.edgePoint(n.c.x,n.c.y)),i=n.c.edgePoint(n.p.x,n.p.y);if(r.x!==i.x||r.y!==i.y){var a=new Et.Line(r,i).toShape(e,this,"196883","");return n.originalReferencePoint=t,a}return n.angle=0,n.lastCurve=Lt.none,n.originalReferencePoint=t,ft.none},boundingBox:function(e){var t=e.duplicateEnv(),n=t.env;return n.angle=0,n.p=n.c=Bt.originPosition,t.shape=ft.none,this.toDropShape(t).getBoundingBox()}}),_t(Ce.ObjectBox.WrapUpObject,{toDropShape:function(e){var t=e.env,n=this.object.toDropShape(e);return t.originalReferencePoint=t.c,n},toConnectShape:function(e){var t=e.env,n=this.object.toConnectShape(e);return t.originalReferencePoint=t.c,n}}),_t(Ce.ObjectBox.CompositeObject,{toDropShape:function(e){var t=e.env,n=t.c;if(void 0===n)return ft.none;var r=n,i=t.duplicate(),a=new xt(ft.none,i);this.objects.foreach((function(e){i.c=n;var t=e.toDropShape(a);r=rt.combineRect(r,i.c),r=rt.combineRect(r,t.getBoundingBox().toPoint())})),t.c=r;var o=a.shape;return e.appendShapeToFront(o),t.originalReferencePoint=n,o}}),_t(Ce.ObjectBox.Xybox,{toDropShape:function(e){var t=e.env,n=t.c;if(void 0===n)return ft.none;var r=new Bt,i=new xt(ft.none,r);this.posDecor.toShape(i);var a=i.shape,o=a.getBoundingBox();if(void 0===o)return ft.none;var u=Math.max(0,o.l-o.x),s=Math.max(0,o.r+o.x),c=Math.max(0,o.u+o.y),h=Math.max(0,o.d-o.y);t.c=new rt.Rect(n.x,n.y,{l:u,r:s,u:c,d:h}),t.originalReferencePoint=n;var l=new ft.TranslateShape(n.x,n.y,a);return e.appendShapeToFront(l),l}}),_t(Ce.ObjectBox.Xymatrix,{toDropShape:function(e){var t=e.env,n=t.c,r=this.xymatrix.toShape(e);return t.originalReferencePoint=n,r}}),_t(Ce.ObjectBox.Text,{toDropShape:function(e){var t=e.env,n=new ft.TextShape(t.c,this.math);return e.appendShapeToFront(n),t.c=n.getBoundingBox(),t.originalReferencePoint=n.getOriginalReferencePoint(),n}}),_t(Ce.ObjectBox.Empty,{toDropShape:function(e){var t=e.env;return t.originalReferencePoint=t.c,t.c=new rt.Point(t.c.x,t.c.y),ft.none}}),_t(Ce.ObjectBox.Txt,{toDropShape:function(e){var t=e.env;if(void 0===t.c)return ft.none;var n=this.textObject.toDropShape(e);return t.originalReferencePoint=t.c,n}}),_t(Ce.ObjectBox.Txt.Width.Vector,{width:function(e){return this.vector.xy().x}}),_t(Ce.ObjectBox.Txt.Width.Default,{width:function(e){var t=e.env.c;return t.r+t.l}}),_t(Ce.ObjectBox.Cir,{toDropShape:function(e){var t=e.env;if(void 0===t.c)return ft.none;t.originalReferencePoint=t.c;var n=this.radius.radius(e),r=t.c.x,i=t.c.y,a=this.cir.toDropShape(e,r,i,n);return t.c=new rt.Ellipse(r,i,n,n,n,n),a},toConnectShape:function(e){var t=e.env;return t.originalReferencePoint=t.c,ft.none}}),_t(Ce.ObjectBox.Cir.Radius.Vector,{radius:function(e){return this.vector.xy(e).x}}),_t(Ce.ObjectBox.Cir.Radius.Default,{radius:function(e){return e.env.c.r}}),_t(Ce.ObjectBox.Cir.Cir.Segment,{toDropShape:function(e,t,n,r){e.env;var i,a,o=this.startPointDegree(e),u=this.endPointDegree(e,o),s=u-o;if(0===(s=s<0?s+360:s))return ft.none;"^"===this.orient?(i=s>180?"1":"0",a="0"):(i=s>180?"0":"1",a="1");var c=Math.PI/180,h=t+r*Math.cos(o*c),l=n+r*Math.sin(o*c),m=t+r*Math.cos(u*c),p=n+r*Math.sin(u*c),f=new ft.CircleSegmentShape(t,n,h,l,r,i,a,m,p);return e.appendShapeToFront(f),f},startPointDegree:function(e){var t=this.startDiag.toString();return"^"===this.orient?this.diagToAngleACW(t):this.diagToAngleCW(t)},endPointDegree:function(e,t){var n=this.endDiag.toString();return"^"===this.orient?this.diagToAngleACW(n,t):this.diagToAngleCW(n,t)},diagToAngleACW:function(e,t){switch(e){case"l":return 90;case"r":return-90;case"d":return 180;case"u":return 0;case"dl":case"ld":return 135;case"dr":case"rd":return-135;case"ul":case"lu":return 45;case"ur":case"ru":return-45;default:return void 0!==t?t+180:0}},diagToAngleCW:function(e,t){switch(e){case"l":return-90;case"r":return 90;case"d":return 0;case"u":return 180;case"dl":case"ld":return-45;case"dr":case"rd":return 45;case"ul":case"lu":return-135;case"ur":case"ru":return 135;default:return void 0!==t?t+180:0}}}),_t(Ce.ObjectBox.Cir.Cir.Full,{toDropShape:function(e,t,n,r){var i=new ft.FullCircleShape(t,n,r);return e.appendShapeToFront(i),i}}),_t(Ce.ObjectBox.Frame,{toDropShape:function(e){var t=e.env;return t.originalReferencePoint=t.c,this.toDropFilledShape(e,"currentColor",!1)},toDropFilledShape:function(e,t,n){var r=e.env.c;if(void 0===r)return ft.none;var i=pe.measure.thickness,a=r.x,o=r.y,u=r.l,s=r.r,c=r.u,h=r.d,l=ft.none;switch(this.main){case"--":var m=3*i;if(n){var p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!1,t,pe.measure.em2px(m)+" "+pe.measure.em2px(m))}else{var f=this.radius.radius(e);l=new ft.RectangleShape(a,o,u,s,c,h,f,!1,t,pe.measure.em2px(m)+" "+pe.measure.em2px(m))}break;case"==":m=3*i;if(n){p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!0,t,pe.measure.em2px(m)+" "+pe.measure.em2px(m))}else{f=this.radius.radius(e);l=new ft.RectangleShape(a,o,u,s,c,h,f,!0,t,pe.measure.em2px(m)+" "+pe.measure.em2px(m))}break;case"o-":m=3*i,f=pe.measure.lineElementLength;l=new ft.RectangleShape(a,o,u,s,c,h,f,!1,t,pe.measure.em2px(m)+" "+pe.measure.em2px(m));break;case"oo":var d=(p=this.radius.xy(e)).x;l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,d,d,!0,t,void 0);break;case"ee":p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!0,t,void 0);break;case"-,":var y=this.radius.depth(e);f=this.radius.radius(e);l=new ft.CompositeShape(new ft.RectangleShape(a,o,u,s,c,h,f,!1,t,void 0),new ft.BoxShadeShape(a,o,u,s,c,h,y));break;case".o":d=(p=this.radius.xy(e)).x;l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,d,d,!1,t,pe.measure.dottedDasharray);break;case"-o":m=3*i,d=(p=this.radius.xy(e)).x;l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,d,d,!1,t,pe.measure.em2px(m)+" "+pe.measure.em2px(m));break;case".e":p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!1,t,pe.measure.dottedDasharray);break;case"-e":m=3*i,p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!1,t,pe.measure.em2px(m)+" "+pe.measure.em2px(m));break;case"-":if(n){p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!1,t,void 0)}else{f=this.radius.radius(e);l=new ft.RectangleShape(a,o,u,s,c,h,f,!1,t,void 0)}break;case"=":if(n){p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!0,t,void 0)}else{f=this.radius.radius(e);l=new ft.RectangleShape(a,o,u,s,c,h,f,!0,t,void 0)}break;case".":if(n){p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!1,t,pe.measure.dottedDasharray)}else{f=this.radius.radius(e);l=new ft.RectangleShape(a,o,u,s,c,h,f,!1,t,pe.measure.dottedDasharray)}break;case",":y=this.radius.depth(e);l=new ft.BoxShadeShape(a,o,u,s,c,h,y,t);break;case"o":d=(p=this.radius.xy(e)).x;l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,d,d,!1,t,void 0);break;case"e":p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!1,t,void 0);break;case"\\{":l=new ft.LeftBrace(a-u,o,c,h,0,t);break;case"\\}":l=new ft.LeftBrace(a+s,o,h,c,180,t);break;case"^\\}":case"^\\{":l=new ft.LeftBrace(a,o+c,s,u,270,t);break;case"_\\{":case"_\\}":l=new ft.LeftBrace(a,o-h,u,s,90,t);break;case"(":l=new ft.LeftParenthesis(a-u,o+(c-h)/2,c+h,0,t);break;case")":l=new ft.LeftParenthesis(a+s,o+(c-h)/2,c+h,180,t);break;case"^(":case"^)":l=new ft.LeftParenthesis(a+(s-u)/2,o+c,u+s,270,t);break;case"_(":case"_)":l=new ft.LeftParenthesis(a+(s-u)/2,o-h,u+s,90,t);break;case"*":if(r.isCircle()){p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!1,"currentColor",void 0,t,!0)}else{f=this.radius.radius(e);l=new ft.RectangleShape(a,o,u,s,c,h,f,!1,"currentColor",void 0,t,!0)}break;case"**":if(r.isCircle()){p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!1,"currentColor",void 0,t,!1)}else{f=this.radius.radius(e);l=new ft.RectangleShape(a,o,u,s,c,h,f,!1,"currentColor",void 0,t,!1)}break;default:return ft.none}return e.appendShapeToFront(l),l},toConnectShape:function(e){var t=e.env,n=t.c,r=t.p;void 0!==n&&void 0!==r||ft.none,t.originalReferencePoint=n;var i=t.duplicate();i.c=r.combineRect(n);var a=new xt(ft.none,i),o=this.toDropShape(a);return e.appendShapeToFront(o),o}}),_t(Ce.ObjectBox.Frame.Radius.Vector,{radius:function(e){return this.vector.xy(e).x},depth:function(e){return this.vector.xy(e).x},xy:function(e){return this.vector.xy(e)}}),_t(Ce.ObjectBox.Frame.Radius.Default,{radius:function(e){return 0},depth:function(e){return pe.measure.thickness/2},xy:function(e){var t=e.env.c;return{x:(t.l+t.r)/2,y:(t.u+t.d)/2}}}),_t(Ce.ObjectBox.Dir,{toDropShape:function(e){var t=e.env,n=t.c;t.originalReferencePoint=n;var r=t.angle;if(void 0===n)return ft.none;t.c=new rt.Point(n.x,n.y);pe.measure.thickness;var i=ft.none;switch(this.main){case"":return ft.none;case">":switch(this.variant){case"2":var a=(i=new ft.GT2ArrowheadShape(n,r)).getRadius();t.c=new rt.Ellipse(n.x,n.y,a,a,a,a);break;case"3":a=(i=new ft.GT3ArrowheadShape(n,r)).getRadius();t.c=new rt.Ellipse(n.x,n.y,a,a,a,a);break;default:i="^"===this.variant?new ft.UpperGTArrowheadShape(n,r):"_"===this.variant?new ft.LowerGTArrowheadShape(n,r):new ft.GTArrowheadShape(n,r)}break;case"<":switch(this.variant){case"2":a=(i=new ft.LT2ArrowheadShape(n,r)).getRadius();t.c=new rt.Ellipse(n.x,n.y,a,a,a,a);break;case"3":a=(i=new ft.LT3ArrowheadShape(n,r)).getRadius();t.c=new rt.Ellipse(n.x,n.y,a,a,a,a);break;default:i="^"===this.variant?new ft.UpperLTArrowheadShape(n,r):"_"===this.variant?new ft.LowerLTArrowheadShape(n,r):new ft.LTArrowheadShape(n,r)}break;case"|":switch(this.variant){case"^":i=new ft.UpperColumnArrowheadShape(n,r);break;case"_":i=new ft.LowerColumnArrowheadShape(n,r);break;case"2":i=new ft.Column2ArrowheadShape(n,r);break;case"3":i=new ft.Column3ArrowheadShape(n,r);break;default:i=new ft.ColumnArrowheadShape(n,r)}break;case"(":switch(this.variant){case"^":i=new ft.UpperLParenArrowheadShape(n,r);break;case"_":i=new ft.LowerLParenArrowheadShape(n,r);break;default:i=new ft.LParenArrowheadShape(n,r)}break;case")":switch(this.variant){case"^":i=new ft.UpperRParenArrowheadShape(n,r);break;case"_":i=new ft.LowerRParenArrowheadShape(n,r);break;default:i=new ft.RParenArrowheadShape(n,r)}break;case"`":switch(this.variant){case"_":i=new ft.LowerBackquoteArrowheadShape(n,r);break;case"^":default:i=new ft.UpperBackquoteArrowheadShape(n,r)}break;case"'":switch(this.variant){case"_":i=new ft.LowerQuoteArrowheadShape(n,r);break;case"^":default:i=new ft.UpperQuoteArrowheadShape(n,r)}break;case"*":i=new ft.AsteriskArrowheadShape(n,0);break;case"o":i=new ft.OArrowheadShape(n,0);break;case"+":i=new ft.PlusArrowheadShape(n,r);break;case"x":i=new ft.XArrowheadShape(n,r);break;case"/":i=new ft.SlashArrowheadShape(n,r);break;case"-":case"--":pe.measure.lineElementLength;i="3"===this.variant?new ft.Line3ArrowheadShape(n,r):"2"===this.variant?new ft.Line2ArrowheadShape(n,r):new ft.LineArrowheadShape(n,r);break;case"=":case"==":i=new ft.Line2ArrowheadShape(n,r);break;case".":case"..":i="3"===this.variant?new ft.Dot3ArrowheadShape(n,r):"2"===this.variant?new ft.Dot2ArrowheadShape(n,r):new ft.DotArrowheadShape(n,r);break;case":":case"::":i=new ft.Dot2ArrowheadShape(n,r);break;case"~":case"~~":i="3"===this.variant?new ft.Tilde3ArrowheadShape(n,r):"2"===this.variant?new ft.Tilde2ArrowheadShape(n,r):new ft.TildeArrowheadShape(n,r);break;case">>":switch(this.variant){case"^":i=new ft.UpperGTGTArrowheadShape(n,r);break;case"_":i=new ft.LowerGTGTArrowheadShape(n,r);break;case"2":a=(i=new ft.GTGT2ArrowheadShape(n,r)).getRadius();t.c=new rt.Ellipse(n.x,n.y,a,a,a,a);break;case"3":a=(i=new ft.GTGT3ArrowheadShape(n,r)).getRadius();t.c=new rt.Ellipse(n.x,n.y,a,a,a,a);break;default:i=new ft.GTGTArrowheadShape(n,r)}break;case"<<":switch(this.variant){case"^":i=new ft.UpperLTLTArrowheadShape(n,r);break;case"_":i=new ft.LowerLTLTArrowheadShape(n,r);break;case"2":a=(i=new ft.LTLT2ArrowheadShape(n,r)).getRadius();t.c=new rt.Ellipse(n.x,n.y,a,a,a,a);break;case"3":a=(i=new ft.LTLT3ArrowheadShape(n,r)).getRadius();t.c=new rt.Ellipse(n.x,n.y,a,a,a,a);break;default:i=new ft.LTLTArrowheadShape(n,r)}break;case"||":switch(this.variant){case"^":i=new ft.UpperColumnColumnArrowheadShape(n,r);break;case"_":i=new ft.LowerColumnColumnArrowheadShape(n,r);break;case"2":i=new ft.ColumnColumn2ArrowheadShape(n,r);break;case"3":i=new ft.ColumnColumn3ArrowheadShape(n,r);break;default:i=new ft.ColumnColumnArrowheadShape(n,r)}break;case"|-":switch(this.variant){case"^":i=new ft.UpperColumnLineArrowheadShape(n,r);break;case"_":i=new ft.LowerColumnLineArrowheadShape(n,r);break;case"2":i=new ft.ColumnLine2ArrowheadShape(n,r);break;case"3":i=new ft.ColumnLine3ArrowheadShape(n,r);break;default:i=new ft.ColumnLineArrowheadShape(n,r)}break;case">|":i=new ft.GTColumnArrowheadShape(n,r);break;case">>|":i=new ft.GTGTColumnArrowheadShape(n,r);break;case"|<":i=new ft.ColumnLTArrowheadShape(n,r);break;case"|<<":i=new ft.ColumnLTLTArrowheadShape(n,r);break;case"//":i=new ft.SlashSlashArrowheadShape(n,r);break;case"=>":i=new ft.LineGT2ArrowheadShape(n,r);break;default:var o=pe.repositories.dirRepository.get(this.main);if(void 0===o)throw s("ExecutionError","\\dir "+this.variant+"{"+this.main+"} not defined.");i=o.toDropShape(e)}return e.appendShapeToFront(i),i},toConnectShape:function(e){var t=e.env;t.originalReferencePoint=t.c;pe.measure.thickness;var n=t.p.edgePoint(t.c.x,t.c.y),r=t.c.edgePoint(t.p.x,t.p.y);return n.x!==r.x||n.y!==r.y?new Et.Line(n,r).toShape(e,this,this.main,this.variant):(t.angle=0,t.lastCurve=Lt.none,ft.none)}}),_t(Ce.ObjectBox.Curve,{toDropShape:function(e){var t=e.env;return t.originalReferencePoint=t.c,ft.none},toConnectShape:function(e){var t=e.env;t.originalReferencePoint=t.c;var n=void 0,r=void 0;this.objects.foreach((function(e){n=e.objectForDrop(n),r=e.objectForConnect(r)})),void 0===n&&void 0===r&&(r=new Ce.Object(L.empty,new Ce.ObjectBox.Dir("","-")));pe.measure.thickness;var i=t.c,a=t.p,o=[];this.poslist.foreach((function(t){t.addPositions(o,e)})),t.c=i,t.p=a;var u=ft.none,s=a,c=i;switch(o.length){case 0:return s.x===c.x&&s.y===c.y?(t.lastCurve=Lt.none,t.angle=0,ft.none):void 0!==r?r.toConnectShape(e):n.toConnectShape(e);case 1:var h=(m=new Et.QuadBezier(s,o[0],c)).tOfShavedStart(s),l=m.tOfShavedEnd(c);if(void 0===h||void 0===l||h>=l)return t.angle=0,t.lastCurve=Lt.none,ft.none;u=m.toShape(e,n,r),t.lastCurve=new Lt.QuadBezier(m,h,l,u),t.angle=Math.atan2(c.y-s.y,c.x-s.x);break;case 2:var m;h=(m=new Et.CubicBezier(s,o[0],o[1],c)).tOfShavedStart(s),l=m.tOfShavedEnd(c);if(void 0===h||void 0===l||h>=l)return t.angle=0,t.lastCurve=Lt.none,ft.none;u=m.toShape(e,n,r),t.lastCurve=new Lt.CubicBezier(m,h,l,u),t.angle=Math.atan2(c.y-s.y,c.x-s.x);break;default:var p=new Et.CubicBSpline(s,o,c),f=new Et.CubicBeziers(p.toCubicBeziers());h=f.tOfShavedStart(s),l=f.tOfShavedEnd(c);if(void 0===h||void 0===l||h>=l)return t.angle=0,t.lastCurve=Lt.none,ft.none;u=f.toShape(e,n,r),t.lastCurve=new Lt.CubicBSpline(s,c,f,h,l,u),t.angle=Math.atan2(c.y-s.y,c.x-s.x)}return u}}),_t(Ce.ObjectBox.Curve.Object.Drop,{objectForDrop:function(e){return this.object},objectForConnect:function(e){return e}}),_t(Ce.ObjectBox.Curve.Object.Connect,{objectForDrop:function(e){return e},objectForConnect:function(e){return this.object}}),_t(Ce.ObjectBox.Curve.PosList.CurPos,{addPositions:function(e,t){var n=t.env;e.push(n.c)}}),_t(Ce.ObjectBox.Curve.PosList.Pos,{addPositions:function(e,t){var n=t.env;this.pos.toShape(t),e.push(n.c)}}),_t(Ce.ObjectBox.Curve.PosList.AddStack,{addPositions:function(e,t){t.env.stack.reverse().foreach((function(t){e.push(t)}))}}),_t(Ce.Coord.C,{position:function(e){return e.env.c}}),_t(Ce.Coord.P,{position:function(e){return e.env.p}}),_t(Ce.Coord.X,{position:function(e){var t=e.env,n=t.p,r=t.c,i=t.origin,a=t.xBase,o=r.y-n.y,u=n.x-r.x,s=r.x*n.y-r.y*n.x,h=a.y,l=-a.x,m=a.x*i.y-a.y*i.x,p=o*l-h*u;if(Math.abs(p)i.u+i.d?(a=(i.l-i.r)/2,o=(i.d-i.u)/2):(a=(i.l-i.r)/2,o=i.d-u/2),r.c=r.c.shiftFrame(a,o),t=new ft.TranslateShape(a,o,t)}return this.proceedModifyShape(e,t,n)}}),_t(Ce.Modifier.Shape.D,{preprocess:function(e,t){},modifyShape:function(e,t,n){var r=e.env,i=r.c;if(void 0!==i){var a,o,u=i.r+i.l;u>i.u+i.d?(a=(i.l-i.r)/2,o=(i.d-i.u)/2):(a=(i.l-i.r)/2,o=-i.u+u/2),r.c=r.c.shiftFrame(a,o),t=new ft.TranslateShape(a,o,t)}return this.proceedModifyShape(e,t,n)}}),_t(Ce.Modifier.Shape.C,{preprocess:function(e,t){},modifyShape:function(e,t,n){var r,i,a=e.env,o=a.c;void 0!==o&&(r=(o.l-o.r)/2,i=(o.d-o.u)/2,a.c=a.c.shiftFrame(r,i),t=new ft.TranslateShape(r,i,t));return this.proceedModifyShape(e,t,n)}}),_t(Ce.Modifier.Shape.ChangeColor,{preprocess:function(e,t){},modifyShape:function(e,t,n){return t=this.proceedModifyShape(e,t,n),new ft.ChangeColorShape(this.colorName,t)}}),_t(Ce.Modifier.Shape.Alphabets,{preprocess:function(e,t){var n=pe.repositories.modifierRepository.get(this.alphabets);if(void 0!==n)return n.preprocess(e,t)},modifyShape:function(e,t,n){var r=pe.repositories.modifierRepository.get(this.alphabets);if(void 0!==r)return r.modifyShape(e,t,n)}}),_t(Ce.Modifier.Shape.DefineShape,{preprocess:function(e,t){var n=t.reverse();pe.repositories.modifierRepository.put(this.shape,new Ce.Modifier.Shape.CompositeModifiers(n))},modifyShape:function(e,t,n){return this.proceedModifyShape(e,t,n)}}),_t(Ce.Modifier.Shape.CompositeModifiers,{preprocess:function(e,t){this.modifiers.foreach((function(n){n.preprocess(e,t),t=t.prepend(n)}))},modifyShape:function(e,t,n){return t=this.proceedModifyShape(e,t,this.modifiers),this.proceedModifyShape(e,t,n)}}),_t(Ce.Modifier.Invisible,{preprocess:function(e,t){},modifyShape:function(e,t,n){return t=this.proceedModifyShape(e,t,n),ft.none}}),_t(Ce.Modifier.Hidden,{preprocess:function(e,t){},modifyShape:function(e,t,n){return this.proceedModifyShape(e,t,n)}}),_t(Ce.Modifier.Direction,{preprocess:function(e,t){e.env.angle=this.direction.angle(e)},modifyShape:function(e,t,n){return e.env.angle=this.direction.angle(e),this.proceedModifyShape(e,t,n)}}),_t(Ce.Modifier.AddOp,{preprocess:function(e,t){},modifyShape:function(e,t,n){var r=e.env.c;return e.env.c=this.op.apply(this.size,r,e),e.appendShapeToFront(new ft.InvisibleBoxShape(e.env.c)),this.proceedModifyShape(e,t,n)}}),_t(Ce.Modifier.AddOp.Grow,{apply:function(e,t,n){var r=n.env,i=e.isDefault?{x:2*r.objectmargin,y:2*r.objectmargin}:e.vector.xy(n),a=Math.abs(i.x/2),o=Math.abs(i.y/2);return t.grow(a,o)},applyToDimen:function(e,t){return e+t}}),_t(Ce.Modifier.AddOp.Shrink,{apply:function(e,t,n){var r=n.env,i=e.isDefault?{x:2*r.objectmargin,y:2*r.objectmargin}:e.vector.xy(n),a=-Math.abs(i.x/2),o=-Math.abs(i.y/2);return t.grow(a,o)},applyToDimen:function(e,t){return e-t}}),_t(Ce.Modifier.AddOp.Set,{apply:function(e,t,n){var r=n.env,i=e.isDefault?{x:r.objectwidth,y:r.objectheight}:e.vector.xy(n),a=Math.abs(i.x),o=Math.abs(i.y);return t.toSize(a,o)},applyToDimen:function(e,t){return t}}),_t(Ce.Modifier.AddOp.GrowTo,{apply:function(e,t,n){var r=Math.max(t.l+t.r,t.u+t.d),i=e.isDefault?{x:r,y:r}:e.vector.xy(n),a=Math.abs(i.x),o=Math.abs(i.y);return t.growTo(a,o)},applyToDimen:function(e,t){return Math.max(Math.max(e,t),0)}}),_t(Ce.Modifier.AddOp.ShrinkTo,{apply:function(e,t,n){var r=Math.min(t.l+t.r,t.u+t.d),i=e.isDefault?{x:r,y:r}:e.vector.xy(n),a=Math.abs(i.x),o=Math.abs(i.y);return t.shrinkTo(a,o)},applyToDimen:function(e,t){return Math.max(Math.min(e,t),0)}}),_t(Ce.Modifier.Shape.Frame,{preprocess:function(e,t){},modifyShape:function(e,t,n){var r=e.env;if(void 0!==r.c){this.main;var i=new Ce.ObjectBox.Frame.Radius.Default,a="currentColor";this.options.foreach((function(e){i=e.getRadius(i)})),this.options.foreach((function(e){a=e.getColorName(a)}));var o=r.duplicate(),u=new xt(ft.none,o),s=new Ce.ObjectBox.Frame(i,this.main).toDropFilledShape(u,a,r.c.isCircle());t=new ft.CompositeShape(t,s)}return this.proceedModifyShape(e,t,n)}}),_t(Ce.Modifier.Shape.Frame.Radius,{getRadius:function(e){return new Ce.ObjectBox.Frame.Radius.Vector(this.vector)},getColorName:function(e){return e}}),_t(Ce.Modifier.Shape.Frame.Color,{getRadius:function(e){return e},getColorName:function(e){return this.colorName}}),_t(Ce.Direction.Compound,{angle:function(e){var t=this.dir.angle(e);return this.rots.foreach((function(n){t=n.rotate(t,e)})),t}}),_t(Ce.Direction.Diag,{angle:function(e){return this.diag.angle(e)}}),_t(Ce.Direction.Vector,{angle:function(e){return this.vector.angle(e)}}),_t(Ce.Direction.ConstructVector,{angle:function(e){var t=e.env,n=t.origin,r=t.xBase,i=t.yBase,a=t.p,o=t.c;this.posDecor.toShape(e);var u=Math.atan2(t.c.y-t.p.y,t.c.x-t.p.x);return t.c=o,t.p=a,t.origin=n,t.xBase=r,t.yBase=i,u}}),_t(Ce.Direction.RotVector,{rotate:function(e,t){return e+this.vector.angle(t)}}),_t(Ce.Direction.RotCW,{rotate:function(e,t){return e+Math.PI/2}}),_t(Ce.Direction.RotAntiCW,{rotate:function(e,t){return e-Math.PI/2}}),_t(Ce.Diag.Default,{isEmpty:!0,angle:function(e){return e.env.angle}}),_t(Ce.Diag.Angle,{isEmpty:!1,angle:function(e){return this.ang}}),_t(Ce.Decor,{toShape:function(e){this.commands.foreach((function(t){t.toShape(e)}))}}),_t(Ce.Command.Save,{toShape:function(e){e.env.saveState(),this.pos.toShape(e)}}),_t(Ce.Command.Restore,{toShape:function(e){e.env.restoreState()}}),_t(Ce.Command.Pos,{toShape:function(e){this.pos.toShape(e)}}),_t(Ce.Command.AfterPos,{toShape:function(e){this.pos.toShape(e),this.decor.toShape(e)}}),_t(Ce.Command.Drop,{toShape:function(e){this.object.toDropShape(e)}}),_t(Ce.Command.Connect,{toShape:function(e){this.object.toConnectShape(e)}}),_t(Ce.Command.Relax,{toShape:function(e){}}),_t(Ce.Command.Ignore,{toShape:function(e){}}),_t(Ce.Command.ShowAST,{toShape:function(e){console.log(this.pos.toString()+" "+this.decor)}}),_t(Ce.Command.Ar,{toShape:function(e){var t=e.env,n=t.origin,r=t.xBase,i=t.yBase,a=t.p,o=t.c;t.pathActionForBeforeSegment=g.empty,t.pathActionForAfterSegment=g.empty,t.labelsForNextSegmentOnly=g.empty,t.labelsForLastSegmentOnly=g.empty,t.labelsForEverySegment=g.empty,t.segmentSlideEm=g.empty,t.lastTurnDiag=g.empty,t.arrowVariant="",t.tailTip=new Ce.Command.Ar.Form.Tip.Tipchars(""),t.headTip=new Ce.Command.Ar.Form.Tip.Tipchars(">"),t.stemConn=new Ce.Command.Ar.Form.Conn.Connchars("-"),t.reverseAboveAndBelow=!1,t.arrowObjectModifiers=L.empty,this.forms.foreach((function(t){t.toShape(e)})),t.pathActionForBeforeSegment.isDefined||(t.pathActionForBeforeSegment=new g.Some(new Ce.PosDecor(new Ce.Pos.Coord(new Ce.Coord.C,L.empty.append(new Ce.Pos.ConnectObject(new Ce.Object(t.arrowObjectModifiers,t.stemConn.getObject(e))))),new Ce.Decor(L.empty)))),t.labelsForNextSegmentOnly=new g.Some(new Ce.Command.Path.Labels(L.empty.append(new Ce.Command.Path.Label.At(new Ce.Pos.Place(new Ce.Place(1,1,new Ce.Place.Factor(0),new Ce.Slide(g.empty))),t.tailTip.getObject(e),g.empty)))),t.labelsForLastSegmentOnly=new g.Some(new Ce.Command.Path.Labels(L.empty.append(new Ce.Command.Path.Label.At(new Ce.Pos.Place(new Ce.Place(1,1,new Ce.Place.Factor(1),new Ce.Slide(g.empty))),t.headTip.getObject(e),g.empty)))),this.path.toShape(e),t.c=o,t.p=a,t.origin=n,t.xBase=r,t.yBase=i}}),_t(Ce.Command.Ar.Form.BuildArrow,{toShape:function(e){var t=e.env;t.arrowVariant=this.variant,t.tailTip=this.tailTip,t.stemConn=this.stemConn,t.headTip=this.headTip}}),_t(Ce.Command.Ar.Form.ChangeVariant,{toShape:function(e){e.env.arrowVariant=this.variant}}),_t(Ce.Command.Ar.Form.ChangeStem,{toShape:function(e){e.env.stemConn=new Ce.Command.Ar.Form.Conn.Connchars(this.connchar)}}),_t(Ce.Command.Ar.Form.DashArrowStem,{toShape:function(e){}}),_t(Ce.Command.Ar.Form.CurveArrow,{toShape:function(e){var t=e.env,n=pe.measure.em2length(2*pe.measure.length2em(this.dist));t.pathActionForBeforeSegment=new g.Some(new Ce.PosDecor(new Ce.Pos.Coord(new Ce.Coord.C,L.empty.append(new Ce.Pos.ConnectObject(new Ce.Object(t.arrowObjectModifiers,new Ce.ObjectBox.Curve(L.empty,L.empty.append(new Ce.ObjectBox.Curve.Object.Connect(t.stemConn.getObject(e))),L.empty.append(new Ce.ObjectBox.Curve.PosList.Pos(new Ce.Pos.Coord(new Ce.Coord.Group(new Ce.PosDecor(new Ce.Pos.Coord(new Ce.Coord.C,L.empty.append(new Ce.Pos.ConnectObject(new Ce.Object(L.empty,new Ce.ObjectBox.Dir("","")))).append(new Ce.Pos.Place(new Ce.Place(0,0,void 0,new Ce.Slide(g.empty)))).append(new Ce.Pos.Plus(new Ce.Coord.Vector(new Ce.Vector.Dir(this.direction,n))))),new Ce.Decor(L.empty))),L.empty)))))))),new Ce.Decor(L.empty)))}}),_t(Ce.Command.Ar.Form.CurveFitToDirection,{toShape:function(e){var t=e.env;t.pathActionForBeforeSegment=new g.Some(new Ce.PosDecor(new Ce.Pos.Coord(new Ce.Coord.C,L.empty.append(new Ce.Pos.ConnectObject(new Ce.Object(t.arrowObjectModifiers,new Ce.ObjectBox.Curve(L.empty,L.empty.append(new Ce.ObjectBox.Curve.Object.Connect(t.stemConn.getObject(e))),L.empty.append(new Ce.ObjectBox.Curve.PosList.Pos(new Ce.Pos.Coord(new Ce.Coord.C,L.empty.append(new Ce.Pos.SwapPAndC(new Ce.Coord.C)).append(new Ce.Pos.Plus(new Ce.Coord.Vector(new Ce.Vector.Dir(this.outDirection,"3pc"))))))).append(new Ce.ObjectBox.Curve.PosList.Pos(new Ce.Pos.Coord(new Ce.Coord.C,L.empty.append(new Ce.Pos.SwapPAndC(new Ce.Coord.C)).append(new Ce.Pos.Plus(new Ce.Coord.Vector(new Ce.Vector.Dir(this.inDirection,"3pc")))))))))))),new Ce.Decor(L.empty)))}}),_t(Ce.Command.Ar.Form.CurveWithControlPoints,{toShape:function(e){var t=e.env,n=t.duplicate();n.startCapturePositions();var r=new xt(ft.none,n);this.coord.position(r);var i=n.endCapturePositions();i=i.append(n.c);var a=L.empty;i.reverse().foreach((function(e){var n=t.inverseAbsVector(e.x,e.y);a=a.prepend(new Ce.ObjectBox.Curve.PosList.Pos(new Ce.Pos.Coord(new Ce.Coord.Vector(new Ce.Vector.InCurBase(n.x,n.y)),L.empty)))})),t.pathActionForBeforeSegment=new g.Some(new Ce.PosDecor(new Ce.Pos.Coord(new Ce.Coord.C,L.empty.append(new Ce.Pos.ConnectObject(new Ce.Object(t.arrowObjectModifiers,new Ce.ObjectBox.Curve(L.empty,L.empty.append(new Ce.ObjectBox.Curve.Object.Connect(t.stemConn.getObject(e))),a))))),new Ce.Decor(L.empty)))}}),_t(Ce.Command.Ar.Form.AddShape,{toShape:function(e){e.env.arrowObjectModifiers=L.empty.append(this.shape)}}),_t(Ce.Command.Ar.Form.AddModifiers,{toShape:function(e){e.env.arrowObjectModifiers=this.modifiers}}),_t(Ce.Command.Ar.Form.Slide,{toShape:function(e){e.env.segmentSlideEm=new g.Some(pe.measure.length2em(this.slideDimen))}}),_t(Ce.Command.Ar.Form.LabelAt,{toShape:function(e){e.env.labelsForEverySegment=new g.Some(new Ce.Command.Path.Labels(L.empty.append(new Ce.Command.Path.Label.At(new Ce.Pos.Place(this.anchor),this.it,g.empty))))}}),_t(Ce.Command.Ar.Form.LabelAbove,{toShape:function(e){var t,n=e.env;t=n.reverseAboveAndBelow?new Ce.Command.Path.Label.Below(new Ce.Pos.Place(this.anchor),this.it,g.empty):new Ce.Command.Path.Label.Above(new Ce.Pos.Place(this.anchor),this.it,g.empty),n.labelsForEverySegment=new g.Some(new Ce.Command.Path.Labels(L.empty.append(t)))}}),_t(Ce.Command.Ar.Form.LabelBelow,{toShape:function(e){var t,n=e.env;t=n.reverseAboveAndBelow?new Ce.Command.Path.Label.Above(new Ce.Pos.Place(this.anchor),this.it,g.empty):new Ce.Command.Path.Label.Below(new Ce.Pos.Place(this.anchor),this.it,g.empty),n.labelsForEverySegment=new g.Some(new Ce.Command.Path.Labels(L.empty.append(t)))}}),_t(Ce.Command.Ar.Form.ReverseAboveAndBelow,{toShape:function(e){e.env.reverseAboveAndBelow=!0}}),_t(Ce.Command.Ar.Form.Conn.Connchars,{getObject:function(e){var t=e.env,n=new Ce.ObjectBox.Dir(t.arrowVariant,this.connchars);return new Ce.Object(t.arrowObjectModifiers,n)}}),_t(Ce.Command.Ar.Form.Conn.Object,{getObject:function(e){var t=e.env.arrowObjectModifiers.concat(this.object.modifiers);return new Ce.Object(t,this.object.object)}}),_t(Ce.Command.Ar.Form.Conn.Dir,{getObject:function(e){var t=e.env,n=this.dir,r=n;return""===n.variant&&""!==t.arrowVariant&&(r=new Ce.ObjectBox.Dir(t.arrowVariant,n.main)),new Ce.Object(t.arrowObjectModifiers,r)}}),_t(Ce.Command.Ar.Form.Tip.Tipchars,{getObject:function(e){var t=e.env,n=new Ce.ObjectBox.Dir(t.arrowVariant,this.tipchars);return new Ce.Object(t.arrowObjectModifiers,n)}}),_t(Ce.Command.Ar.Form.Tip.Object,{getObject:function(e){var t=e.env.arrowObjectModifiers.concat(this.object.modifiers);return new Ce.Object(t,this.object.object)}}),_t(Ce.Command.Ar.Form.Tip.Dir,{getObject:function(e){var t=e.env,n=this.dir,r=n;return""===n.variant&&""!==t.arrowVariant&&(r=new Ce.ObjectBox.Dir(t.arrowVariant,n.main)),new Ce.Object(t.arrowObjectModifiers,r)}}),_t(Ce.Command.Path,{toShape:function(e){var t=e.env,n=t.origin,r=t.xBase,i=t.yBase,a=t.p,o=t.c;t.pathActionForBeforeSegment=g.empty,t.pathActionForAfterSegment=g.empty,t.labelsForNextSegmentOnly=g.empty,t.labelsForLastSegmentOnly=g.empty,t.labelsForEverySegment=g.empty,t.segmentSlideEm=g.empty,t.lastTurnDiag=g.empty,this.path.toShape(e),t.c=o,t.p=a,t.origin=n,t.xBase=r,t.yBase=i}}),_t(Ce.Command.AfterPath,{toShape:function(e){this.path.toShape(e),this.decor.toShape(e)}}),_t(Ce.Command.Path.Path,{toShape:function(e){this.pathElements.foreach((function(t){t.toShape(e)}))}}),_t(Ce.Command.Path.SetBeforeAction,{toShape:function(e){e.env.pathActionForBeforeSegment=new g.Some(this.posDecor)}}),_t(Ce.Command.Path.SetAfterAction,{toShape:function(e){e.env.pathActionForAfterSegment=new g.Some(this.posDecor)}}),_t(Ce.Command.Path.AddLabelNextSegmentOnly,{toShape:function(e){e.env.labelsForNextSegmentOnly=new g.Some(this.labels)}}),_t(Ce.Command.Path.AddLabelLastSegmentOnly,{toShape:function(e){e.env.labelsForLastSegmentOnly=new g.Some(this.labels)}}),_t(Ce.Command.Path.AddLabelEverySegment,{toShape:function(e){e.env.labelsForEverySegment=new g.Some(this.labels)}}),_t(Ce.Command.Path.StraightSegment,{toShape:function(e){var t=e.env;this.segment.setupPositions(e);var n=t.c;t.pathActionForBeforeSegment.foreach((function(t){t.toShape(e)})),t.labelsForNextSegmentOnly.foreach((function(n){n.toShape(e),t.labelsForNextSegmentOnly=g.empty})),t.labelsForEverySegment.foreach((function(t){t.toShape(e)})),t.c=n,t.pathActionForAfterSegment.foreach((function(t){t.toShape(e)})),this.segment.toLabelsShape(e)}}),_t(Ce.Command.Path.LastSegment,{toShape:function(e){var t=e.env;this.segment.setupPositions(e);var n=t.c;t.pathActionForBeforeSegment.foreach((function(t){t.toShape(e)})),t.labelsForNextSegmentOnly.foreach((function(n){n.toShape(e),t.labelsForNextSegmentOnly=g.empty})),t.labelsForLastSegmentOnly.foreach((function(n){n.toShape(e),t.labelsForNextSegmentOnly=g.empty})),t.labelsForEverySegment.foreach((function(t){t.toShape(e)})),t.c=n,t.pathActionForAfterSegment.foreach((function(t){t.toShape(e)})),this.segment.toLabelsShape(e)}}),_t(Ce.Command.Path.TurningSegment,{toShape:function(e){var t=e.env,n=t.c;this.segment.pos.toShape(e),t.p=n;var r=this.turn.explicitizedCircle(e),i=this.turn.radius.radius(e);t.lastTurnDiag=new g.Some(r.endDiag);var a=r.startVector(e),o=r.endVector(e),u=t.segmentSlideEm.getOrElse(0);this.segment.slide.dimen.foreach((function(e){u=pe.measure.length2em(e),t.segmentSlideEm=new g.Some(u)})),0!==u&&(t.p=t.p.move(t.p.x-u*a.y,t.p.y+u*a.x),t.c=t.c.move(t.c.x-u*o.y,t.c.y+u*o.x),i="^"===r.orient?Math.max(0,i-u):Math.max(0,i+u));var s,h=t.p.edgePoint(t.p.x+a.x,t.p.y+a.y),l=t.c,m=r.relativeStartPoint(e,i),p=r.relativeEndPoint(e,i),f=r.relativeEndPoint(e,i+("^"===r.orient?u:-u)),d=a.x*o.y-a.y*o.x;if(Math.abs(d)0?0:Math.PI);r=t.c;var u=new xt(ft.none,t);this.it.toDropShape(u);var s=u.shape,c=s.getBoundingBox();if(void 0!==c){var h=c.x-r.x,l=c.y-r.y,m=c.l,p=c.r,f=c.u,d=c.d,y=Math.cos(o),v=Math.sin(o),x=Math.min((h-m)*y+(l-d)*v,(h-m)*y+(l+f)*v,(h+p)*y+(l-d)*v,(h+p)*y+(l+f)*v),g=Math.abs(a)-x;t.c=t.c.move(r.x+g*y,r.y+g*v),e.appendShapeToFront(new ft.TranslateShape(g*y,g*v,s))}}else this.it.toDropShape(e);var w=t.lastCurve;this.shouldSliceHole&&w.isDefined&&void 0!==i&&w.sliceHole(t.c,i),this.aliasOption.foreach((function(e){t.savePos(e,new Rt.Position(t.c))}))}}),_t(Ce.Command.Path.Label.Above,{getLabelMargin:function(e){return e.env.labelmargin},shouldSliceHole:!1}),_t(Ce.Command.Path.Label.Below,{getLabelMargin:function(e){return-e.env.labelmargin},shouldSliceHole:!1}),_t(Ce.Command.Path.Label.At,{getLabelMargin:function(e){return 0},shouldSliceHole:!0}),_t(Ce.Command.Xymatrix,{toShape:function(e){var t=e.env;if(void 0===t.c)return ft.none;var n=t.duplicate(),r=new xt(ft.none,n);n.xymatrixPrefix="",n.xymatrixRowSepEm=pe.measure.length2em("2pc"),n.xymatrixColSepEm=pe.measure.length2em("2pc"),n.xymatrixPretendEntryHeight=g.empty,n.xymatrixPretendEntryWidth=g.empty,n.xymatrixFixedRow=!1,n.xymatrixFixedCol=!1,n.xymatrixOrientationAngle=0,n.xymatrixEntryModifiers=L.empty,this.setup.foreach((function(e){e.toShape(r)}));var i,a,o=n.xymatrixOrientationAngle,u=0,s=0,c=new It(this.rows.map((function(e){s+=1,a=0;var t=new It.Row(e.entries.map((function(e){a+=1;var t=n.duplicate();t.origin={x:0,y:0},t.p=t.c=Bt.originPosition,t.angle=0,t.lastCurve=Lt.none,t.xymatrixRow=s,t.xymatrixCol=a;var r,i,o,u,c=new xt(ft.none,t),h=e.toShape(c),l=t.c;if(n.xymatrixPretendEntryHeight.isDefined){var m=n.xymatrixPretendEntryHeight.get;o=m/2,u=m/2}else o=l.u,u=l.d;if(n.xymatrixPretendEntryWidth.isDefined){var p=n.xymatrixPretendEntryWidth.get;r=p/2,i=p/2}else r=l.l,i=l.r;var f=new rt.Rect(0,0,{l:r,r:i,u:o,d:u});return new It.Entry(t.c,h,e.decor,f)})),o);return u=Math.max(u,a),t})),o);if(0===(i=s))return ft.none;c.rows.foreach((function(e){a=0,e.entries.foreach((function(e){a+=1,c.getColumn(a).addEntry(e)}))}));var h,l,m=n.xymatrixColSepEm,p=[],f=t.c.x;if(p.push(f),n.xymatrixFixedCol){var d=0,y=0;c.columns.foreach((function(e){d=Math.max(d,e.getL()),y=Math.max(y,e.getR())})),c.columns.tail.foreach((function(e){f=f+y+m+d,p.push(f)})),h=d,l=p[p.length-1]+y}else{var v=c.columns.head;c.columns.tail.foreach((function(e){f=f+v.getR()+m+e.getL(),p.push(f),v=e})),h=c.columns.head.getL(),l=f+c.columns.at(u-1).getR()-p[0]}var x,w,S=n.xymatrixRowSepEm,b=[],C=t.c.y;if(b.push(C),n.xymatrixFixedRow){var k=0,M=0;c.rows.foreach((function(e){k=Math.max(k,e.getU()),M=Math.max(M,e.getD())})),c.rows.tail.foreach((function(e){C-=M+S+k,b.push(C)})),x=k,w=b[0]-b[b.length-1]+M}else{var P=c.rows.head;c.rows.tail.foreach((function(e){C-=P.getD()+S+e.getU(),b.push(C),P=e})),x=c.rows.head.getU(),w=b[0]-C+c.rows.at(i-1).getD()}t.c=new rt.Rect(t.c.x,t.c.y,{l:h,r:l,u:x,d:w});var O=n.xymatrixPrefix,B=Math.cos(o),E=Math.sin(o),A=0;c.rows.foreach((function(e){var t=0;e.entries.foreach((function(e){var r=p[t],i=b[A],a=r*B-i*E,o=r*E+i*B,u=t+1,s=A+1,c=new Rt.Position(e.c.move(a,o));n.savePos(s+","+u,c),n.savePos(O+s+","+u,c),t+=1})),A+=1})),r=new xt(ft.none,n);A=0;c.rows.foreach((function(e){var t=0;e.entries.foreach((function(e){var i=p[t],a=b[A],o=i*B-a*E,u=i*E+a*B,s=t+1,c=A+1,h=new ft.TranslateShape(o,u,e.objectShape);r.appendShapeToFront(h),n.c=e.c.move(o,u),n.xymatrixRow=c,n.xymatrixCol=s,e.decor.toShape(r),t+=1})),A+=1}));var j=r.shape;return e.appendShapeToFront(j),t.savedPosition=n.savedPosition,j}});var It=function(){function e(t,n){Ft(this,e),this.rows=t,this.columns=L.empty,this.orientation=n}return Vt(e,[{key:"getColumn",value:function(t){if(this.columns.length()>=t)return this.columns.at(t-1);var n=new e.Column(this.orientation);return this.columns=this.columns.append(n),n}},{key:"toString",value:function(){return"Xymatrix{\n"+this.rows.mkString("\\\\\n")+"\n}"}}]),e}();function zt(e,t,n){var r=[],i=[],a={lastNoSuccess:void 0,whiteSpaceRegex:c.whiteSpaceRegex,createTextNode:function(t){var n=new o.Z(t,e.stack.env,e.configuration).mml(),a=pe.textObjectIdCounter;return pe.textObjectIdCounter++,r.push(n),i.push(a),n}},u=new Y(e.string,e.i,a),h=$.parse(t,u);if(e.i=h.next.offset,h.successful){var l=""+pe.xypicCommandIdCounter;pe.xypicCommandIdCounter++,pe.xypicCommandMap[l]=h.get();var m=JSON.stringify(i);return e.create(n,{"data-cmd-id":l,"data-text-mml-ids":m},r)}var p=a.lastNoSuccess.next.pos().lineContents();throw s("SyntaxError",a.lastNoSuccess.msg+'. Parse error at or near "'+p+'".')}It.Row=function(){function e(t,n){Ft(this,e),this.entries=t,this.orientation=n,Xe(this,"getU"),Xe(this,"getD")}return Vt(e,[{key:"getU",value:function(){var e=this.orientation,t=0;return this.entries.foreach((function(n){t=Math.max(t,n.getU(e))})),t}},{key:"getD",value:function(){var e=this.orientation,t=0;return this.entries.foreach((function(n){t=Math.max(t,n.getD(e))})),t}},{key:"toString",value:function(){return this.entries.mkString(" & ")}}]),e}(),It.Column=function(){function e(t){Ft(this,e),this.entries=L.empty,this.orientation=t,Xe(this,"getL"),Xe(this,"getR")}return Vt(e,[{key:"addEntry",value:function(e){this.entries=this.entries.append(e),this.getL.reset,this.getR.reset}},{key:"getL",value:function(){var e=this.orientation,t=0;return this.entries.foreach((function(n){t=Math.max(t,n.getL(e))})),t}},{key:"getR",value:function(){var e=this.orientation,t=0;return this.entries.foreach((function(n){t=Math.max(t,n.getR(e))})),t}},{key:"toString",value:function(){return this.entries.mkString(" \\\\ ")}}]),e}(),It.Entry=function(){function e(t,n,r,i){Ft(this,e),this.c=t,this.objectShape=n,this.decor=r,this.frame=i}return Vt(e,[{key:"getDistanceToEdgePoint",value:function(e,t){var n=e.edgePoint(e.x+Math.cos(t),e.y+Math.sin(t)),r=n.x-e.x,i=n.y-e.y;return Math.sqrt(r*r+i*i)}},{key:"getU",value:function(e){return 0===e?this.frame.u:this.getDistanceToEdgePoint(this.frame,e+Math.PI/2)}},{key:"getD",value:function(e){return 0===e?this.frame.d:this.getDistanceToEdgePoint(this.frame,e-Math.PI/2)}},{key:"getL",value:function(e){return 0===e?this.frame.l:this.getDistanceToEdgePoint(this.frame,e+Math.PI)}},{key:"getR",value:function(e){return 0===e?this.frame.r:this.getDistanceToEdgePoint(this.frame,e)}},{key:"toString",value:function(){return this.objectShape.toString()+" "+this.decor}}]),e}(),_t(Ce.Command.Xymatrix.Setup.Prefix,{toShape:function(e){e.env.xymatrixPrefix=this.prefix}}),_t(Ce.Command.Xymatrix.Setup.ChangeSpacing.Row,{toShape:function(e){var t=e.env;t.xymatrixRowSepEm=this.addop.applyToDimen(t.xymatrixRowSepEm,pe.measure.length2em(this.dimen))}}),_t(Ce.Command.Xymatrix.Setup.ChangeSpacing.Column,{toShape:function(e){var t=e.env;t.xymatrixColSepEm=this.addop.applyToDimen(t.xymatrixColSepEm,pe.measure.length2em(this.dimen))}}),_t(Ce.Command.Xymatrix.Setup.ChangeSpacing.RowAndColumn,{toShape:function(e){var t=e.env,n=this.addop.applyToDimen(t.xymatrixRowSepEm,pe.measure.length2em(this.dimen));t.xymatrixRowSepEm=n,t.xymatrixColSepEm=n}}),_t(Ce.Command.Xymatrix.Setup.PretendEntrySize.Height,{toShape:function(e){e.env.xymatrixPretendEntryHeight=new g.Some(pe.measure.length2em(this.dimen))}}),_t(Ce.Command.Xymatrix.Setup.PretendEntrySize.Width,{toShape:function(e){e.env.xymatrixPretendEntryWidth=new g.Some(pe.measure.length2em(this.dimen))}}),_t(Ce.Command.Xymatrix.Setup.PretendEntrySize.HeightAndWidth,{toShape:function(e){var t=new g.Some(pe.measure.length2em(this.dimen));e.env.xymatrixPretendEntryHeight=t,e.env.xymatrixPretendEntryWidth=t}}),_t(Ce.Command.Xymatrix.Setup.FixGrid.Row,{toShape:function(e){e.env.xymatrixFixedRow=!0}}),_t(Ce.Command.Xymatrix.Setup.FixGrid.Column,{toShape:function(e){e.env.xymatrixFixedCol=!0}}),_t(Ce.Command.Xymatrix.Setup.FixGrid.RowAndColumn,{toShape:function(e){e.env.xymatrixFixedRow=!0,e.env.xymatrixFixedCol=!0}}),_t(Ce.Command.Xymatrix.Setup.AdjustEntrySize.Margin,{toShape:function(e){var t=e.env;t.objectmargin=this.addop.applyToDimen(t.objectmargin,pe.measure.length2em(this.dimen))}}),_t(Ce.Command.Xymatrix.Setup.AdjustEntrySize.Width,{toShape:function(e){var t=e.env;t.objectwidth=this.addop.applyToDimen(t.objectwidth,pe.measure.length2em(this.dimen))}}),_t(Ce.Command.Xymatrix.Setup.AdjustEntrySize.Height,{toShape:function(e){var t=e.env;t.objectheight=this.addop.applyToDimen(t.objectheight,pe.measure.length2em(this.dimen))}}),_t(Ce.Command.Xymatrix.Setup.AdjustLabelSep,{toShape:function(e){var t=e.env;t.labelmargin=this.addop.applyToDimen(t.labelmargin,pe.measure.length2em(this.dimen))}}),_t(Ce.Command.Xymatrix.Setup.SetOrientation,{toShape:function(e){e.env.xymatrixOrientationAngle=this.direction.angle(e)}}),_t(Ce.Command.Xymatrix.Setup.AddModifier,{toShape:function(e){var t=e.env;t.xymatrixEntryModifiers=t.xymatrixEntryModifiers.prepend(this.modifier)}}),_t(Ce.Command.Xymatrix.Entry.SimpleEntry,{toShape:function(e){var t=e.env,n=pe.measure.em2length(t.objectmargin+t.objectwidth),r=pe.measure.em2length(t.objectmargin+t.objectheight),i=new Ce.Modifier.AddOp(new Ce.Modifier.AddOp.GrowTo,new Ce.Modifier.AddOp.VactorSize(new Ce.Vector.Abs(n,r))),a=pe.measure.em2length(t.objectmargin),o=new Ce.Modifier.AddOp(new Ce.Modifier.AddOp.Grow,new Ce.Modifier.AddOp.VactorSize(new Ce.Vector.Abs(a,a))),u=this.modifiers.concat(t.xymatrixEntryModifiers).prepend(i).prepend(o);return new Ce.Object(u,this.objectbox).toDropShape(e)}}),_t(Ce.Command.Xymatrix.Entry.EmptyEntry,{toShape:function(e){var t=e.env,n=pe.measure.em2length(t.objectmargin+t.objectwidth),r=pe.measure.em2length(t.objectmargin+t.objectheight),i=new Ce.Modifier.AddOp(new Ce.Modifier.AddOp.GrowTo,new Ce.Modifier.AddOp.VactorSize(new Ce.Vector.Abs(n,r))),a=pe.measure.em2length(t.objectmargin),o=new Ce.Modifier.AddOp(new Ce.Modifier.AddOp.Grow,new Ce.Modifier.AddOp.VactorSize(new Ce.Vector.Abs(a,a))),u=t.xymatrixEntryModifiers.prepend(i).prepend(o);return new Ce.Object(u,new Ce.ObjectBox.Empty).toDropShape(e)}}),_t(Ce.Command.Xymatrix.Entry.ObjectEntry,{toShape:function(e){return this.object.toDropShape(e)}}),_t(Ce.Command.Twocell,{toShape:function(e){var t=e.env;if(void 0===t.c)return ft.none;var n=t.duplicate(),r=new xt(ft.none,n);n.twocellmodmapobject=t.twocellmodmapobject||new Ce.Object(L.empty,new Ce.ObjectBox.Dir("","|")),n.twocellhead=t.twocellhead||new Ce.Object(L.empty,new Ce.ObjectBox.Dir("",">")),n.twocelltail=t.twocelltail||new Ce.Object(L.empty,new Ce.ObjectBox.Dir("","")),n.twocellarrowobject=t.twocellarrowobject||new Ce.Object(L.empty,new Ce.ObjectBox.Dir("","=>")),n.twocellUpperCurveObjectSpacer=t.twocellUpperCurveObjectSpacer,n.twocellUpperCurveObject=t.twocellUpperCurveObject,n.twocellLowerCurveObjectSpacer=t.twocellLowerCurveObjectSpacer,n.twocellLowerCurveObject=t.twocellLowerCurveObject,n.twocellUpperLabel=g.empty,n.twocellLowerLabel=g.empty,n.twocellCurvatureEm=g.empty,n.twocellShouldDrawCurve=!0,n.twocellShouldDrawModMap=!1,this.switches.foreach((function(e){e.setup(r)})),this.twocell.toShape(r,this.arrow),e.appendShapeToFront(r.shape)}}),_t(Ce.Command.Twocell.Hops2cell,{toShape:function(e,t){var n=e.env,r=n.c,i=n.angle,a=n.c,o=this.targetPosition(e);if(void 0!==a&&void 0!==o){var u=o.x-a.x,s=o.y-a.y;if(0!==u||0!==s){var c=new rt.Point(a.x+.5*u,a.y+.5*s),h=Math.atan2(s,u),l=h+Math.PI/2,m=n.twocellCurvatureEm.getOrElse(this.getDefaultCurvature()),p=Math.cos(l),f=Math.sin(l),d=this.getUpperControlPoint(a,o,c,m,p,f),y=this.getLowerControlPoint(a,o,c,m,p,f);if(n.twocellShouldDrawCurve){var v,x;if(x=void 0===(v=n.twocellUpperCurveObjectSpacer)?new Ce.Object(L.empty,new Ce.ObjectBox.Dir("","-")):void 0!==n.twocellUpperCurveObject?n.twocellUpperCurveObject.getOrElse(void 0):void 0,this.toUpperCurveShape(e,a,d,o,v,x),n.lastCurve.isDefined){n.angle=h;var g=this.getUpperLabelPosition(a,o,c,m,p,f),w=this.getUpperLabelAngle(l,a,o,c,m,p,f);n.twocellUpperLabel.foreach((function(t){t.toShape(e,g,Math.cos(w),Math.sin(w),h)})),this.hasUpperTips&&t.toUpperTipsShape(e)}if(x=void 0===(v=n.twocellLowerCurveObjectSpacer)?new Ce.Object(L.empty,new Ce.ObjectBox.Dir("","-")):void 0!==n.twocellLowerCurveObject?n.twocellLowerCurveObject.getOrElse(void 0):void 0,this.toLowerCurveShape(e,a,y,o,v,x),n.lastCurve.isDefined){n.angle=h;var S=this.getLowerLabelPosition(a,o,c,m,p,f),b=this.getLowerLabelAngle(l,a,o,c,m,p,f);n.twocellLowerLabel.foreach((function(t){t.toShape(e,S,Math.cos(b),Math.sin(b),h)})),this.hasLowerTips&&t.toLowerTipsShape(e)}}n.c=this.getDefaultArrowPoint(a,o,c,m,p,f),n.angle=l+Math.PI;var C=c;t.toArrowShape(e,C),n.c=r,n.angle=i}}},_toCurveShape:function(e,t,n,r,i,a){var o=e.env,u=new Et.QuadBezier(t,n,r),s=u.tOfShavedStart(t),c=u.tOfShavedEnd(r);if(void 0===s||void 0===c||s>=c)o.lastCurve=Lt.none;else{var h=u.toShape(e,i,a);o.lastCurve=new Lt.QuadBezier(u,s,c,h)}},targetPosition:function(e){var t=e.env,n=t.xymatrixRow,r=t.xymatrixCol;if(void 0===n||void 0===r)throw s("ExecutionError","rows and columns not found for hops ["+this.hops+"]");for(var i=0;i=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(u)throw a}}}}function fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&void 0!==arguments[2]?arguments[2]:null;dn(this,n),i=t.call(this,e,r,a);for(var o=pe.wrapperOfTextObjectMap,u=r.textMmls,s=i.childNodes,c=u.length,h=0;h1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return this.adaptor.node(e,t,n,Cn)}},{key:"setAttribute",value:function(e,t,n,r){return this.adaptor.setAttribute(e,t,n,r)}},{key:"setStyle",value:function(e,t,n){this.adaptor.setStyle(e,t,n)}},{key:"drawTextObject",value:function(e,t,n){var r=pe.measure.length2em("0.2em"),i=t.xypicWrapper,a=i.getChildWrapper(e.math),o=a.adaptor,u=a.getBBox(),s=u.scale,c=(u.h+r)*s,h=(u.d+r)*s,l=(u.w+2*r)*s,m=(c+h)/2,p=l/2,f=e.c;if(e.originalBBox={H:c,D:h,W:l},!n){var d=a.html("mjx-xypic-object");o.append(i.getElement(),d),o.setStyle(d,"text-align","center"),o.setStyle(d,"position","absolute"),o.setStyle(d,"color",t.getCurrentColor()),a.toCHTML(d);var y=t.getOrigin();o.setAttribute(d,"data-x",f.x-p-y.x+r*s),o.setAttribute(d,"data-y",-f.y-m-y.y+r*s),o.setAttribute(d,"data-xypic-id",e.math.xypicTextObjectId),i.appendTextObject(d)}return f.toRect({u:m,d:m,l:p,r:p})}}]),n}(e),r=function(e){xn(n,e);var t=wn(n);function n(e,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return dn(this,n),t.call(this,e,r,i)}return vn(n,[{key:"kind",get:function(){return Ce.xypic.prototype.kind}},{key:"_toCHTML",value:function(e){var t=this.standardCHTMLnode(e);this.cthml=t;var n=this.adaptor;n.setStyle(t,"position","relative");var r=this.length2em("0.2em"),i=pe.measure.strokeWidth,a=1,o=0,u=1,s=pe.measure.em2px,c=rn.createSVG(this,a,o,u,i,"black",{viewBox:[0,-s(a+o),s(u),s(a+o)].join(" "),role:"img",focusable:!1,overflow:"visible"});pe.svgForDebug=c,pe.svgForTestLayout=c,n.append(t,c.svg);var h=this.node.cmd;if(h){var l=new Bt,m=new xt(ft.none,l);h.toShape(m);var p=m.shape;p.draw(c);var f=p.getBoundingBox();if(void 0!==f){var d=(f=new rt.Rect(0,0,{l:Math.max(0,-(f.x-f.l)),r:Math.max(0,f.x+f.r),u:Math.max(0,f.y+f.u),d:Math.max(0,-(f.y-f.d))})).x-f.l-r,y=-f.y-f.u-r,v=f.l+f.r+2*r,x=f.u+f.d+2*r;c.setWidth(v),c.setHeight(x),c.setAttribute("viewBox",[s(d),s(y),s(v),s(x)].join(" ")),n.setStyle(t,"vertical-align",kn(-f.d-r+pe.measure.axis_height)+"em");var g,w=pn(this._textObjects);try{for(w.s();!(g=w.n()).done;){var S=g.value,b=parseFloat(n.getAttribute(S,"data-x")),C=parseFloat(n.getAttribute(S,"data-y"));n.setStyle(S,"left",kn(b-d)+"em"),n.setStyle(S,"top",kn(C+f.y-f.d-.5*r)+"em")}}catch(e){w.e(e)}finally{w.f()}}else n.remove(c.svg)}else n.remove(c.svg)}}],[{key:"styles",get:function(){return{"mjx-xypic path":{"stroke-width":"inherit"},".MathJax mjx-xypic path":{"stroke-width":"inherit"}}}}]),n}(n);t[r.prototype.kind]=r;var i=function(e){xn(n,e);var t=wn(n);function n(e,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return dn(this,n),t.call(this,e,r,i)}return vn(n,[{key:"kind",get:function(){return Ce.xypic.newdir.prototype.kind}},{key:"_toCHTML",value:function(e){var t=this.node.cmd;pe.repositories.dirRepository.put(t.dirMain,t.compositeObject)}}]),n}(n);t[i.prototype.kind]=i;var a=function(e){xn(n,e);var t=wn(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return dn(this,n),(i=t.call(this,e,r,a))._setupGraphics(),i.computeBBox(i.bbox),i.bboxComputed=!0,i}return vn(n,[{key:"kind",get:function(){return Ce.xypic.includegraphics.prototype.kind}},{key:"_setupGraphics",value:function(){this.setupMeasure(this);var e=new Bt,t=new xt(ft.none,e),n=this.node.cmd;if(n.setup(t),!e.includegraphicsWidth.isDefined||!e.includegraphicsHeight.isDefined)throw s("ExecutionError","the 'width' and 'height' attributes of the \\includegraphics are required.");var r=e.includegraphicsWidth.get,i=e.includegraphicsHeight.get;this.imageWidth=this.length2em(r),this.imageHeight=this.length2em(i),this.filepath=n.filepath}},{key:"computeBBox",value:function(e){e.empty(),e.updateFrom(new Ut.bK({w:this.imageWidth,h:this.imageHeight,d:0}))}},{key:"_toCHTML",value:function(e){var t=this.standardCHTMLnode(e);this.cthml=t,this.adaptor.setStyle(t,"position","relative"),this.adaptor.setStyle(t,"vertical-align","0em");var n=this.html("img");this.adaptor.setAttribute(n,"src",this.filepath),this.adaptor.setStyle(n,"width",kn(this.imageWidth)+"em"),this.adaptor.setStyle(n,"height",kn(this.imageHeight)+"em"),this.adaptor.append(t,n)}}]),n}(n);t[a.prototype.kind]=a}void 0!==Wt.wO&&Mn(Wt.wO,Nt.w);var Pn=n(511),On=n(0);function Bn(e){return(Bn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function En(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return An(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return An(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(u)throw a}}}}function An(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&void 0!==arguments[2]?arguments[2]:null;Ln(this,n),i=t.call(this,e,r,a);for(var o=pe.wrapperOfTextObjectMap,u=r.textMmls,s=i.childNodes,c=u.length,h=0;h1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return this.adaptor.node(e,t,n,_n)}},{key:"setAttribute",value:function(e,t,n,r){return this.adaptor.setAttribute(e,t,n,r)}},{key:"setStyle",value:function(e,t,n){this.adaptor.setStyle(e,t,n)}},{key:"drawTextObject",value:function(e,t,n){var r=pe.measure.length2em("0.2em"),i=t.xypicWrapper,a=i.getChildWrapper(e.math),o=a.adaptor,u=a.getBBox(),s=u.scale,c=(u.h+r)*s,h=(u.d+r)*s,l=(u.w+2*r)*s,m=(c+h)/2,p=l/2,f=e.c;if(e.originalBBox={H:c,D:h,W:l},!n){var d=a.svg("g");o.append(i.getElement(),d),o.setAttribute(d,"stroke",t.getCurrentColor()),o.setAttribute(d,"fill",t.getCurrentColor()),a.toSVG(d);var y=t.getOrigin();o.setAttribute(d,"data-x",f.x-p-y.x+r*s),o.setAttribute(d,"data-y",-f.y+(c-h)/2-y.y),o.setAttribute(d,"data-xypic-id",e.math.xypicTextObjectId),i.appendTextObject(d)}return f.toRect({u:m,d:m,l:p,r:p})}}]),n}(e),r=function(e){Tn(n,e);var t=Fn(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return Ln(this,n),(i=t.call(this,e,r,a)).shape=null,i}return Dn(n,[{key:"computeBBox",value:function(e){e.empty();var t=this.node.cmd;if(t){var n=this.length2em("0.2em");if(null==this.shape){var r=pe.svgForDebug,i=pe.svgForTestLayout;this._textObjects=[],this.setupMeasure(this);this.adaptor;var a=pe.measure.strokeWidth,o=1,u=0,s=1,c=pe.measure.em2px,h="black",l=rn.createSVG(this,o,u,s,a,h,{viewBox:[0,-c(o+u),c(s),c(o+u)].join(" "),role:"img",focusable:!1,overflow:"visible"});pe.svgForDebug=l,pe.svgForTestLayout=l;var m=new Bt,p=new xt(ft.none,m);t.toShape(p);var f=p.shape;this.shape=f,pe.svgForDebug=r,pe.svgForTestLayout=i}var d=this.shape,y=d.getBoundingBox();void 0!==y&&(y=new rt.Rect(0,0,{l:Math.max(0,-(y.x-y.l)),r:Math.max(0,y.x+y.r),u:Math.max(0,y.y+y.u),d:Math.max(0,-(y.y-y.d))}),e.updateFrom(new Ut.bK({w:y.l+y.r+2*n,h:y.u+2*n,d:y.d})))}}},{key:"kind",get:function(){return Ce.xypic.prototype.kind}},{key:"_toSVG",value:function(e){var t=this.standardSVGnode(e);this.svgNode=t;var n=this.adaptor,r=this.length2em("0.2em"),i=pe.measure.strokeWidth,a=1,o=0,u=1,s=pe.measure.em2px,c=rn.createSVG(this,a,o,u,i,"black",{viewBox:[0,-s(a+o),s(u),s(a+o)].join(" "),role:"img",focusable:!1,overflow:"visible"});pe.svgForDebug=c,pe.svgForTestLayout=c,n.append(t,c.drawArea);var h=this.node.cmd;if(h){if(null==this.shape){var l=new Bt,m=new xt(ft.none,l);h.toShape(m);var p=m.shape;this.shape=p}var f=this.shape;f.draw(c);var d=f.getBoundingBox();if(void 0!==d){var y=(d=new rt.Rect(0,0,{l:Math.max(0,-(d.x-d.l)),r:Math.max(0,d.x+d.r),u:Math.max(0,d.y+d.u),d:Math.max(0,-(d.y-d.d))})).x-d.l-r,v=-d.y-d.u-r,x=d.l+d.r+2*r,g=d.u+d.d+2*r;c.setWidth(x),c.setHeight(g),c.setAttribute("viewBox",[s(y),s(v),s(x),s(g)].join(" "));var w=this.fixed(1)/s(1);n.setAttribute(c.drawArea,"transform","translate("+this.fixed(-y)+","+this.fixed(d.y+pe.measure.axis_height)+") scale("+w+", "+-w+")");var S,b=En(this._textObjects);try{for(b.s();!(S=b.n()).done;){var C=S.value,k=parseFloat(n.getAttribute(C,"data-x")),M=parseFloat(n.getAttribute(C,"data-y")),P=k-y,O=-M+d.y+pe.measure.axis_height;this.place(P,O,C)}}catch(e){b.e(e)}finally{b.f()}}else n.remove(c.drawArea)}else n.remove(c.drawArea)}}],[{key:"styles",get:function(){return{'g[data-mml-node="xypic"] path':{"stroke-width":"inherit"},'.MathJax g[data-mml-node="xypic"] path':{"stroke-width":"inherit"}}}}]),n}(n);t[r.prototype.kind]=r;var i=function(e){Tn(n,e);var t=Fn(n);function n(e,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return Ln(this,n),t.call(this,e,r,i)}return Dn(n,[{key:"kind",get:function(){return Ce.xypic.newdir.prototype.kind}},{key:"computeBBox",value:function(e){var t=this.node.cmd;pe.repositories.dirRepository.put(t.dirMain,t.compositeObject)}},{key:"_toSVG",value:function(e){var t=this.node.cmd;pe.repositories.dirRepository.put(t.dirMain,t.compositeObject)}}]),n}(n);t[i.prototype.kind]=i;var a=function(e){Tn(n,e);var t=Fn(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return Ln(this,n),(i=t.call(this,e,r,a))._setupGraphics(),i.computeBBox(i.bbox),i.bboxComputed=!0,i}return Dn(n,[{key:"kind",get:function(){return Ce.xypic.includegraphics.prototype.kind}},{key:"_setupGraphics",value:function(){this.setupMeasure(this);var e=new Bt,t=new xt(ft.none,e),n=this.node.cmd;if(n.setup(t),!e.includegraphicsWidth.isDefined||!e.includegraphicsHeight.isDefined)throw s("ExecutionError","the 'width' and 'height' attributes of the \\includegraphics are required.");var r=e.includegraphicsWidth.get,i=e.includegraphicsHeight.get;this.imageWidth=this.length2em(r),this.imageHeight=this.length2em(i),this.filepath=n.filepath}},{key:"computeBBox",value:function(e){e.empty(),e.updateFrom(new Ut.bK({w:this.imageWidth,h:this.imageHeight,d:0}))}},{key:"_toSVG",value:function(e){var t=this.standardSVGnode(e);this.svgNode=t;var n=this.fixed(1),r=this.svg("image",{x:"0",y:"0",preserveAspectRatio:"none",width:In(this.imageWidth),height:In(this.imageHeight),transform:"scale("+n+","+-n+") translate(0,"+In(-this.imageHeight)+")"});this.adaptor.setAttribute(r,"xlink:href",this.filepath,"http://www.w3.org/1999/xlink"),this.adaptor.append(t,r)}}]),n}(n);t[a.prototype.kind]=a}void 0!==Pn.y&&zn(Pn.y,On.N);var Qn=MathJax._.components.loader.Loader;Qn&&(MathJax._.output.chtml.Wrapper.CHTMLWrapper||Qn.ready("output/chtml").then((function(){var e=MathJax._.output.chtml;Mn(e.Wrapper.CHTMLWrapper,e.Wrappers_ts.CHTMLWrappers)})).catch((function(e){return console.log("Caught",e)})),MathJax._.output.svg.Wrapper.SVGWrapper||Qn.ready("output/svg").then((function(){var e=MathJax._.output.svg;zn(e.Wrapper.SVGWrapper,e.Wrappers_ts.SVGWrappers)})).catch((function(e){return console.log("Caught",e)})))}()}(); \ No newline at end of file +!function(){"use strict";var e={226:function(e,t){MathJax._.components.global.isObject,MathJax._.components.global.combineConfig,t.PV=MathJax._.components.global.combineDefaults,MathJax._.components.global.combineWithMathJax,t.NI=MathJax._.components.global.MathJax},150:function(e,t){t.v=MathJax._.core.MmlTree.MML.MML},113:function(e,t){t.Ls=MathJax._.core.MmlTree.MmlNode.TEXCLASS,MathJax._.core.MmlTree.MmlNode.TEXCLASSNAMES,MathJax._.core.MmlTree.MmlNode.indentAttributes,t.oI=MathJax._.core.MmlTree.MmlNode.AbstractMmlNode,MathJax._.core.MmlTree.MmlNode.AbstractMmlTokenNode,MathJax._.core.MmlTree.MmlNode.AbstractMmlLayoutNode,MathJax._.core.MmlTree.MmlNode.AbstractMmlBaseNode,MathJax._.core.MmlTree.MmlNode.AbstractMmlEmptyNode,MathJax._.core.MmlTree.MmlNode.TextNode,MathJax._.core.MmlTree.MmlNode.XMLNode},272:function(e,t){MathJax._.util.BBox.BBoxStyleAdjust,t.bK=MathJax._.util.BBox.BBox},54:function(e,t){t.VK=MathJax._.input.tex.Configuration.Configuration,MathJax._.input.tex.Configuration.ConfigurationHandler,MathJax._.input.tex.Configuration.ParserConfiguration},443:function(e,t){t.Z=MathJax._.input.tex.ParseMethods.default},201:function(e,t){MathJax._.input.tex.SymbolMap.AbstractSymbolMap,MathJax._.input.tex.SymbolMap.RegExpMap,MathJax._.input.tex.SymbolMap.AbstractParseMap,MathJax._.input.tex.SymbolMap.CharacterMap,MathJax._.input.tex.SymbolMap.DelimiterMap,MathJax._.input.tex.SymbolMap.MacroMap,t.QQ=MathJax._.input.tex.SymbolMap.CommandMap,t.QM=MathJax._.input.tex.SymbolMap.EnvironmentMap},850:function(e,t){t.Z=MathJax._.input.tex.TexError.default},592:function(e,t){t.Z=MathJax._.input.tex.TexParser.default},225:function(e,t){t.Z=MathJax._.input.tex.base.BaseMethods.default},990:function(e,t){MathJax._.output.chtml.Wrapper.FONTSIZE,MathJax._.output.chtml.Wrapper.SPACE,t.wO=MathJax._.output.chtml.Wrapper.CHTMLWrapper},268:function(e,t){t.w=MathJax._.output.chtml.Wrappers_ts.CHTMLWrappers},511:function(e,t){t.y=MathJax._.output.svg.Wrapper.SVGWrapper},0:function(e,t){t.N=MathJax._.output.svg.Wrappers_ts.SVGWrappers}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}!function(){var e=n(226);(0,e.PV)(e.NI._,"output",{common:{Wrapper:{}},chtml:{Wrapper:{},Wrappers_ts:{}},svg:{Wrapper:{},Wrappers_ts:{}}});var t=n(54),r=n(201),i=n(225),a=n(443),o=n(592),u=n(850);function s(e,t){return console.error(e,t),new u.Z(e,t)}var c={whiteSpaceRegex:/^(\s+|%[^\r\n]*(\r\n|\r|\n)?)+/,lengthResolution:128,interpolationResolution:5,machinePrecision:1e-12};function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){for(var n=0;n=this.length())throw Error("no such element at "+e+". index must be lower than "+this.length()+".");for(var t=this,n=0;n=0;)t=new j(e[n],t),n-=1;return t};var R=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=t,this.tail=n}var t,n,r;return t=e,r=[{key:"unapply",value:function(e){return new Option.Some([e.head,e.tail])}}],(n=[{key:"toString",value:function(){return"("+this.head+"~"+this.tail+")"}}])&&T(t.prototype,n),r&&T(t,r),e}();function F(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function G(e,t){for(var n=0;n>1,this.offset=this.source.length}},{key:"drop",value:function(e){var t,n;for(t=this,n=e;n>0;)t=t.rest(),n-=1;return t}}]),e}();Y.EofCh="\x03";var $=function(){function e(){H(this,e)}return J(e,null,[{key:"parse",value:function(e,t){return e.apply(t)}},{key:"parseAll",value:function(t,n){return t.andl((function(){return e.eos()})).apply(n)}},{key:"parseString",value:function(t,n){var r=new Y(n,0,{lastNoSuccess:void 0});return e.parse(t,r)}},{key:"parseAllString",value:function(t,n){var r=new Y(n,0,{lastNoSuccess:void 0});return e.parseAll(t,r)}},{key:"_handleWhiteSpace",value:function(e){var t=e.context.whiteSpaceRegex,n=e.source,r=e.offset,i=t.exec(n.substring(r,n.length));return null!==i?r+i[0].length:r}},{key:"literal",value:function(t){return new ie((function(n){var r,i,a,o,u,s;for(r=n.source,i=n.offset,o=0,u=a=e._handleWhiteSpace(n);o")}},{key:"andl",value:function(e){return this.flatMap((function(t){return e().map((function(e){return t}))})).named("<~")}},{key:"or",value:function(e){return this.append(e).named("|")}},{key:"andOnce",value:function(e){var t=this;return new ae((function(){return t.flatMap((function(t){return $.commit(e).map((function(e){return new R(t,e)}))})).named("~!")}))}},{key:"longestOr",value:function(t){var n=this;return new e((function(e){var r,i;return r=n.apply(e),i=t()(e),r.successful?i.successful?i.next.pos().isLessThan(r.next.pos())?r:i:r:i.successful?i:r instanceof re||i.next.pos().isLessThan(r.next.pos())?r:i})).named("|||")}},{key:"to",value:function(e){return this.map(e).named(this.toString()+"^^")}},{key:"ret",value:function(t){var n=this;return new e((function(e){return n.apply(e).map((function(e){return t()}))})).named(this.toString()+"^^^")}},{key:"toIfPossible",value:function(t,n){void 0===n&&(n=function(e){return"Constructor function not defined at "+e});var r=this;return new e((function(e){return r.apply(e).mapPartial(t,n)})).named(this.toString()+"^?")}},{key:"into",value:function(e){return this.flatMap(e)}},{key:"rep",value:function(){var e=this;return $.rep((function(){return e}))}},{key:"chain",value:function(e){var t,n;return t=this,n=function(){return t},$.chainl1(n,n,e)}},{key:"rep1",value:function(){var e=this;return $.rep1((function(){return e}))}},{key:"opt",value:function(){var e=this;return $.opt((function(){return e}))}}]),e}();$.Parser=ie;var ae=function(e){Q(n,e);var t=N(n);function n(e){return H(this,n),t.call(this,e)}return J(n,[{key:"and",value:function(e){var t=this;return new n((function(){return t.flatMap((function(t){return $.commit(e).map((function(e){return R(t,e)}))}))})).named("~")}}]),n}(ie);$.OnceParser=ae;var oe=n(113),ue=n(150);function se(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ce(e,t){for(var n=0;n"}}]),e}(),Ce.Vector.Angle=function(){function e(t){be(this,e),this.degree=t}return ye(e,[{key:"toString",value:function(){return"a("+this.degree+")"}}]),e}(),Ce.Vector.Dir=function(){function e(t,n){be(this,e),this.dir=t,this.dimen=n}return ye(e,[{key:"toString",value:function(){return"/"+this.dir+" "+this.dimen+"/"}}]),e}(),Ce.Vector.Corner=function(){function e(t,n){be(this,e),this.corner=t,this.factor=n}return ye(e,[{key:"toString",value:function(){return this.corner.toString()+"("+this.factor+")"}}]),e}(),(Ce.Corner=function e(){be(this,e)}).L=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"L"}}]),e}(),Ce.Corner.R=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"R"}}]),e}(),Ce.Corner.D=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"D"}}]),e}(),Ce.Corner.U=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"U"}}]),e}(),Ce.Corner.CL=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"CL"}}]),e}(),Ce.Corner.CR=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"CR"}}]),e}(),Ce.Corner.CD=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"CD"}}]),e}(),Ce.Corner.CU=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"CU"}}]),e}(),Ce.Corner.LD=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"LD"}}]),e}(),Ce.Corner.RD=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"RD"}}]),e}(),Ce.Corner.LU=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"LU"}}]),e}(),Ce.Corner.RU=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"RU"}}]),e}(),Ce.Corner.NearestEdgePoint=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"E"}}]),e}(),Ce.Corner.PropEdgePoint=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"P"}}]),e}(),Ce.Corner.Axis=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"A"}}]),e}(),(Ce.Place=function(){function e(t,n,r,i){be(this,e),this.shaveP=t,this.shaveC=n,this.factor=r,this.slide=i}return ye(e,[{key:"compound",value:function(e){return new Ce.Place(this.shaveP+e.shaveP,this.shaveC+e.shaveC,void 0===e.factor?this.factor:e.factor,e.slide)}},{key:"toString",value:function(){for(var e="",t=0;t";return void 0!==this.factor&&(e+="("+this.factor+")"),this.slide.dimen.foreach((function(t){e+="/"+t+"/"})),e}}]),e}()).Factor=function(){function e(t){be(this,e),this.factor=t}return ye(e,[{key:"isIntercept",get:function(){return!1}},{key:"toString",value:function(){return this.factor.toString()}}]),e}(),Ce.Place.Intercept=function(){function e(t){be(this,e),this.pos=t}return ye(e,[{key:"isIntercept",get:function(){return!0}},{key:"toString",value:function(){return"!{"+this.pos+"}"}}]),e}(),Ce.Slide=function(){function e(t){be(this,e),this.dimen=t}return ye(e,[{key:"toString",value:function(){return this.dimen.getOrElse("")}}]),e}(),Ce.Object=function(){function e(t,n){be(this,e),this.modifiers=t,this.object=n}return ye(e,[{key:"dirVariant",value:function(){return this.object.dirVariant()}},{key:"dirMain",value:function(){return this.object.dirMain()}},{key:"isDir",value:function(){return this.object.isDir()}},{key:"toString",value:function(){return this.modifiers.mkString()+this.object.toString()}}]),e}(),(Ce.ObjectBox=function(){function e(){be(this,e)}return ye(e,[{key:"isEmpty",get:function(){return!1}},{key:"dirVariant",value:function(){}},{key:"dirMain",value:function(){}},{key:"isDir",value:function(){return!1}}]),e}()).Text=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).math=e,r}return ye(n,[{key:"toString",value:function(){return"{"+this.math.toString()+"}"}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Empty=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"isEmpty",get:function(){return!0}},{key:"toString",value:function(){return"{}"}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Xymatrix=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).xymatrix=e,r}return ye(n,[{key:"toString",value:function(){return this.xymatrix.toString()}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Txt=function(e){ve(n,e);var t=ge(n);function n(e,r){var i;return be(this,n),(i=t.call(this)).width=e,i.textObject=r,i}return ye(n,[{key:"toString",value:function(){return"\\txt"+this.width+"{"+this.textObject.toString()+"}"}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Txt.Width=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return n}(Ce.ObjectBox),Ce.ObjectBox.Txt.Width.Vector=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).vector=e,r}return ye(n,[{key:"toString",value:function(){return this.vector.toString()}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Txt.Width.Default=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return""}}]),n}(Ce.ObjectBox),Ce.ObjectBox.WrapUpObject=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).object=e,r}return ye(n,[{key:"toString",value:function(){return"\\object"+this.object.toString()}}]),n}(Ce.ObjectBox),Ce.ObjectBox.CompositeObject=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).objects=e,r}return ye(n,[{key:"toString",value:function(){return"\\composite{"+this.objects.mkString(" * ")+"}"}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Xybox=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).posDecor=e,r}return ye(n,[{key:"toString",value:function(){return"\\xybox{"+this.posDecor.toString()+"}"}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Cir=function(e){ve(n,e);var t=ge(n);function n(e,r){var i;return be(this,n),(i=t.call(this)).radius=e,i.cir=r,i}return ye(n,[{key:"toString",value:function(){return"\\cir"+this.radius+"{"+this.cir+"}"}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Cir.Radius=function e(){be(this,e)},Ce.ObjectBox.Cir.Radius.Vector=function(){function e(t){be(this,e),this.vector=t}return ye(e,[{key:"toString",value:function(){return this.vector.toString()}}]),e}(),Ce.ObjectBox.Cir.Radius.Default=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return""}}]),e}(),Ce.ObjectBox.Cir.Cir=function e(){be(this,e)},Ce.ObjectBox.Cir.Cir.Segment=function(){function e(t,n,r){be(this,e),this.startDiag=t,this.orient=n,this.endDiag=r}return ye(e,[{key:"toString",value:function(){return this.startDiag.toString()+this.orient+this.endDiag}}]),e}(),Ce.ObjectBox.Cir.Cir.Full=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return""}}]),e}(),Ce.ObjectBox.Dir=function(e){ve(n,e);var t=ge(n);function n(e,r){var i;return be(this,n),(i=t.call(this)).variant=e,i.main=r,i}return ye(n,[{key:"dirVariant",value:function(){return this.variant}},{key:"dirMain",value:function(){return this.main}},{key:"isDir",value:function(){return!0}},{key:"toString",value:function(){return"\\dir"+this.variant+"{"+this.main+"}"}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Curve=function(e){ve(n,e);var t=ge(n);function n(e,r,i){var a;return be(this,n),(a=t.call(this)).modifiers=e,a.objects=r,a.poslist=i,a}return ye(n,[{key:"dirVariant",value:function(){return""}},{key:"dirMain",value:function(){return"-"}},{key:"isDir",value:function(){return!1}},{key:"toString",value:function(){return"\\curve"+this.modifiers.mkString("")+"{"+this.objects.mkString(" ")+" "+this.poslist.mkString("&")+"}"}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Curve.Modifier=function e(){be(this,e)},Ce.ObjectBox.Curve.Modifier.p=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~p"}}]),e}(),Ce.ObjectBox.Curve.Modifier.P=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~P"}}]),e}(),Ce.ObjectBox.Curve.Modifier.l=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~l"}}]),e}(),Ce.ObjectBox.Curve.Modifier.L=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~L"}}]),e}(),Ce.ObjectBox.Curve.Modifier.c=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~c"}}]),e}(),Ce.ObjectBox.Curve.Modifier.C=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~C"}}]),e}(),Ce.ObjectBox.Curve.Modifier.pc=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~pc"}}]),e}(),Ce.ObjectBox.Curve.Modifier.pC=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~pC"}}]),e}(),Ce.ObjectBox.Curve.Modifier.Pc=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~Pc"}}]),e}(),Ce.ObjectBox.Curve.Modifier.PC=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~PC"}}]),e}(),Ce.ObjectBox.Curve.Modifier.lc=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~lc"}}]),e}(),Ce.ObjectBox.Curve.Modifier.lC=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~lC"}}]),e}(),Ce.ObjectBox.Curve.Modifier.Lc=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~Lc"}}]),e}(),Ce.ObjectBox.Curve.Modifier.LC=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~LC"}}]),e}(),Ce.ObjectBox.Curve.Modifier.cC=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~cC"}}]),e}(),Ce.ObjectBox.Curve.Object=function e(){be(this,e)},Ce.ObjectBox.Curve.Object.Drop=function(){function e(t){be(this,e),this.object=t}return ye(e,[{key:"toString",value:function(){return"~*"+this.object}}]),e}(),Ce.ObjectBox.Curve.Object.Connect=function(){function e(t){be(this,e),this.object=t}return ye(e,[{key:"toString",value:function(){return"~**"+this.object}}]),e}(),Ce.ObjectBox.Curve.PosList=function e(){be(this,e)},Ce.ObjectBox.Curve.PosList.CurPos=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return""}}]),e}(),Ce.ObjectBox.Curve.PosList.Pos=function(){function e(t){be(this,e),this.pos=t}return ye(e,[{key:"toString",value:function(){return this.pos.toString()}}]),e}(),Ce.ObjectBox.Curve.PosList.AddStack=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~@"}}]),e}(),(Ce.Modifier=function e(){be(this,e)}).Vector=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).vector=e,r}return ye(n,[{key:"toString",value:function(){return"!"+this.vector}}]),n}(Ce.Modifier),Ce.Modifier.RestoreOriginalRefPoint=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"!"}}]),n}(Ce.Modifier),Ce.Modifier.AddOp=function(e){ve(n,e);var t=ge(n);function n(e,r){var i;return be(this,n),(i=t.call(this)).op=e,i.size=r,i}return ye(n,[{key:"toString",value:function(){return this.op.toString()+" "+this.size}}]),n}(Ce.Modifier),Ce.Modifier.AddOp.Grow=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"+"}}]),e}(),Ce.Modifier.AddOp.Shrink=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"-"}}]),e}(),Ce.Modifier.AddOp.Set=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"="}}]),e}(),Ce.Modifier.AddOp.GrowTo=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"+="}}]),e}(),Ce.Modifier.AddOp.ShrinkTo=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"-="}}]),e}(),Ce.Modifier.AddOp.VactorSize=function(){function e(t){be(this,e),this.vector=t}return ye(e,[{key:"isDefault",get:function(){return!1}},{key:"toString",value:function(){return this.vector.toString()}}]),e}(),Ce.Modifier.AddOp.DefaultSize=function(){function e(){be(this,e)}return ye(e,[{key:"isDefault",get:function(){return!0}},{key:"toString",value:function(){return""}}]),e}(),Ce.Modifier.Shape=function e(){be(this,e)},Ce.Modifier.Shape.Point=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"[.]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.Rect=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"[]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.Alphabets=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).alphabets=e,r}return ye(n,[{key:"toString",value:function(){return"["+this.alphabets+"]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.DefineShape=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).shape=e,r}return ye(n,[{key:"toString",value:function(){return"["+this.shape+"]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.Circle=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"[o]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.L=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"[l]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.R=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"[r]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.U=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"[u]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.D=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"[d]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.C=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"[c]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.ChangeColor=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).colorName=e,r}return ye(n,[{key:"toString",value:function(){return"["+this.colorName+"]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.CompositeModifiers=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).modifiers=e,r}return ye(n,[{key:"toString",value:function(){return this.modifiers.mkString("")}}]),n}(Ce.Modifier),Ce.Modifier.Shape.Frame=function(e){ve(n,e);var t=ge(n);function n(e,r){var i;return be(this,n),(i=t.call(this)).main=e,i.options=r,i}return ye(n,[{key:"toString",value:function(){return"[F"+this.main+this.options.mkString("")+"]"}}]),n}(Ce.Modifier),Ce.Modifier.Shape.Frame.Radius=function(){function e(t){be(this,e),this.vector=t}return ye(e,[{key:"toString",value:function(){return":"+this.vector}}]),e}(),Ce.Modifier.Shape.Frame.Color=function(){function e(t){be(this,e),this.colorName=t}return ye(e,[{key:"toString",value:function(){return":"+this.colorName}}]),e}(),Ce.Modifier.Invisible=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"i"}}]),n}(Ce.Modifier),Ce.Modifier.Hidden=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"h"}}]),n}(Ce.Modifier),Ce.Modifier.Direction=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).direction=e,r}return ye(n,[{key:"toString",value:function(){return this.direction.toString()}}]),n}(Ce.Modifier),(Ce.Direction=function e(){be(this,e)}).Compound=function(){function e(t,n){be(this,e),this.dir=t,this.rots=n}return ye(e,[{key:"toString",value:function(){return this.dir.toString()+this.rots.mkString()}}]),e}(),Ce.Direction.Diag=function(){function e(t){be(this,e),this.diag=t}return ye(e,[{key:"toString",value:function(){return this.diag.toString()}}]),e}(),Ce.Direction.Vector=function(){function e(t){be(this,e),this.vector=t}return ye(e,[{key:"toString",value:function(){return"v"+this.vector.toString()}}]),e}(),Ce.Direction.ConstructVector=function(){function e(t){be(this,e),this.posDecor=t}return ye(e,[{key:"toString",value:function(){return"q{"+this.posDecor.toString()+"}"}}]),e}(),Ce.Direction.RotVector=function(){function e(t){be(this,e),this.vector=t}return ye(e,[{key:"toString",value:function(){return":"+this.vector.toString()}}]),e}(),Ce.Direction.RotAntiCW=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"_"}}]),e}(),Ce.Direction.RotCW=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"^"}}]),e}(),(Ce.Diag=function e(){be(this,e)}).Default=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return""}}]),e}(),Ce.Diag.Angle=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return this.symbol}}]),e}(),Ce.Diag.LD=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"symbol",get:function(){return"ld"}},{key:"ang",get:function(){return-3*Math.PI/4}},{key:"turn",value:function(e){return"^"===e?new Ce.Diag.RD:new Ce.Diag.LU}}]),n}(Ce.Diag.Angle),Ce.Diag.RD=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"symbol",get:function(){return"rd"}},{key:"ang",get:function(){return-Math.PI/4}},{key:"turn",value:function(e){return"^"===e?new Ce.Diag.RU:new Ce.Diag.LD}}]),n}(Ce.Diag.Angle),Ce.Diag.LU=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"symbol",get:function(){return"lu"}},{key:"ang",get:function(){return 3*Math.PI/4}},{key:"turn",value:function(e){return"^"===e?new Ce.Diag.LD:new Ce.Diag.RU}}]),n}(Ce.Diag.Angle),Ce.Diag.RU=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"symbol",get:function(){return"ru"}},{key:"ang",get:function(){return Math.PI/4}},{key:"turn",value:function(e){return"^"===e?new Ce.Diag.LU:new Ce.Diag.RD}}]),n}(Ce.Diag.Angle),Ce.Diag.L=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"symbol",get:function(){return"l"}},{key:"ang",get:function(){return Math.PI}},{key:"turn",value:function(e){return"^"===e?new Ce.Diag.D:new Ce.Diag.U}}]),n}(Ce.Diag.Angle),Ce.Diag.R=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"symbol",get:function(){return"r"}},{key:"ang",get:function(){return 0}},{key:"turn",value:function(e){return"^"===e?new Ce.Diag.U:new Ce.Diag.D}}]),n}(Ce.Diag.Angle),Ce.Diag.D=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"symbol",get:function(){return"d"}},{key:"ang",get:function(){return-Math.PI/2}},{key:"turn",value:function(e){return"^"===e?new Ce.Diag.R:new Ce.Diag.L}}]),n}(Ce.Diag.Angle),Ce.Diag.U=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"symbol",get:function(){return"u"}},{key:"ang",get:function(){return Math.PI/2}},{key:"turn",value:function(e){return"^"===e?new Ce.Diag.L:new Ce.Diag.R}}]),n}(Ce.Diag.Angle),Ce.ObjectBox.Frame=function(e){ve(n,e);var t=ge(n);function n(e,r){var i;return be(this,n),(i=t.call(this)).radius=e,i.main=r,i}return ye(n,[{key:"toString",value:function(){return"\\frm"+this.radius+"{"+this.main+"}"}}]),n}(Ce.ObjectBox),Ce.ObjectBox.Frame.Radius=function e(){be(this,e)},Ce.ObjectBox.Frame.Radius.Vector=function(){function e(t){be(this,e),this.vector=t}return ye(e,[{key:"toString",value:function(){return this.vector.toString()}}]),e}(),Ce.ObjectBox.Frame.Radius.Default=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return""}}]),e}(),Ce.Decor=function(){function e(t){be(this,e),this.commands=t}return ye(e,[{key:"toString",value:function(){return this.commands.mkString(" ")}}]),e}(),(Ce.Command=function e(){be(this,e)}).Save=function(){function e(t){be(this,e),this.pos=t}return ye(e,[{key:"toString",value:function(){return"\\save "+this.pos}}]),e}(),Ce.Command.Restore=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"\\restore"}}]),e}(),Ce.Command.Pos=function(){function e(t){be(this,e),this.pos=t}return ye(e,[{key:"toString",value:function(){return"\\POS "+this.pos}}]),e}(),Ce.Command.AfterPos=function(){function e(t,n){be(this,e),this.decor=t,this.pos=n}return ye(e,[{key:"toString",value:function(){return"\\afterPOS{"+this.decor+"} "+this.pos}}]),e}(),Ce.Command.Drop=function(){function e(t){be(this,e),this.object=t}return ye(e,[{key:"toString",value:function(){return"\\drop "+this.object}}]),e}(),Ce.Command.Connect=function(){function e(t){be(this,e),this.object=t}return ye(e,[{key:"toString",value:function(){return"\\connect "+this.object}}]),e}(),Ce.Command.Relax=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"\\relax"}}]),e}(),Ce.Command.Ignore=function(){function e(t,n){be(this,e),this.pos=t,this.decor=n}return ye(e,[{key:"toString",value:function(){return"\\ignore{"+this.pos+" "+this.decor+"}"}}]),e}(),Ce.Command.ShowAST=function(){function e(t,n){be(this,e),this.pos=t,this.decor=n}return ye(e,[{key:"toString",value:function(){return"\\xyshowAST{"+this.pos+" "+this.decor+"}"}}]),e}(),Ce.Command.Path=function(){function e(t){be(this,e),this.path=t}return ye(e,[{key:"toString",value:function(){return"\\PATH "+this.path}}]),e}(),Ce.Command.AfterPath=function(){function e(t,n){be(this,e),this.decor=t,this.path=n}return ye(e,[{key:"toString",value:function(){return"\\afterPATH{"+this.decor+"} "+this.path}}]),e}(),Ce.Command.Path.Path=function(){function e(t){be(this,e),this.pathElements=t}return ye(e,[{key:"toString",value:function(){return this.pathElements.mkString("[",", ","]")}}]),e}(),Ce.Command.Path.SetBeforeAction=function(){function e(t){be(this,e),this.posDecor=t}return ye(e,[{key:"toString",value:function(){return"~={"+this.posDecor+"}"}}]),e}(),Ce.Command.Path.SetAfterAction=function(){function e(t){be(this,e),this.posDecor=t}return ye(e,[{key:"toString",value:function(){return"~/{"+this.posDecor+"}"}}]),e}(),Ce.Command.Path.AddLabelNextSegmentOnly=function(){function e(t){be(this,e),this.labels=t}return ye(e,[{key:"toString",value:function(){return"~<{"+this.labels+"}"}}]),e}(),Ce.Command.Path.AddLabelLastSegmentOnly=function(){function e(t){be(this,e),this.labels=t}return ye(e,[{key:"toString",value:function(){return"~>{"+this.labels+"}"}}]),e}(),Ce.Command.Path.AddLabelEverySegment=function(){function e(t){be(this,e),this.labels=t}return ye(e,[{key:"toString",value:function(){return"~+{"+this.labels+"}"}}]),e}(),Ce.Command.Path.StraightSegment=function(){function e(t){be(this,e),this.segment=t}return ye(e,[{key:"toString",value:function(){return"'"+this.segment}}]),e}(),Ce.Command.Path.TurningSegment=function(){function e(t,n){be(this,e),this.turn=t,this.segment=n}return ye(e,[{key:"toString",value:function(){return"`"+this.turn+" "+this.segment}}]),e}(),Ce.Command.Path.LastSegment=function(){function e(t){be(this,e),this.segment=t}return ye(e,[{key:"toString",value:function(){return this.segment.toString()}}]),e}(),Ce.Command.Path.Turn=function e(){be(this,e)},Ce.Command.Path.Turn.Diag=function(){function e(t,n){be(this,e),this.diag=t,this.radius=n}return ye(e,[{key:"toString",value:function(){return this.diag.toString()+" "+this.radius}}]),e}(),Ce.Command.Path.Turn.Cir=function(){function e(t,n){be(this,e),this.cir=t,this.radius=n}return ye(e,[{key:"toString",value:function(){return this.cir.toString()+" "+this.radius}}]),e}(),Ce.Command.Path.TurnRadius=function e(){be(this,e)},Ce.Command.Path.TurnRadius.Default=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return""}}]),e}(),Ce.Command.Path.TurnRadius.Dimen=function(){function e(t){be(this,e),this.dimen=t}return ye(e,[{key:"toString",value:function(){return"/"+this.dimen}}]),e}(),Ce.Command.Path.Segment=function(){function e(t,n,r){be(this,e),this.pos=t,this.slide=n,this.labels=r}return ye(e,[{key:"toString",value:function(){return this.pos.toString()+" "+this.slide+" "+this.labels}}]),e}(),Ce.Command.Path.Labels=function(){function e(t){be(this,e),this.labels=t}return ye(e,[{key:"toString",value:function(){return this.labels.mkString(" ")}}]),e}(),Ce.Command.Path.Label=function e(t,n,r){be(this,e),this.anchor=t,this.it=n,this.aliasOption=r},Ce.Command.Path.Label.Above=function(e){ve(n,e);var t=ge(n);function n(e,r,i){return be(this,n),t.call(this,e,r,i)}return ye(n,[{key:"toString",value:function(){return"^("+this.anchor+" "+this.it+" "+this.aliasOption+")"}}]),n}(Ce.Command.Path.Label),Ce.Command.Path.Label.Below=function(e){ve(n,e);var t=ge(n);function n(e,r,i){return be(this,n),t.call(this,e,r,i)}return ye(n,[{key:"toString",value:function(){return"_("+this.anchor+" "+this.it+" "+this.aliasOption+")"}}]),n}(Ce.Command.Path.Label),Ce.Command.Path.Label.At=function(e){ve(n,e);var t=ge(n);function n(e,r,i){return be(this,n),t.call(this,e,r,i)}return ye(n,[{key:"toString",value:function(){return"|("+this.anchor+" "+this.it+" "+this.aliasOption+")"}}]),n}(Ce.Command.Path.Label),Ce.Command.Ar=function(){function e(t,n){be(this,e),this.forms=t,this.path=n}return ye(e,[{key:"toString",value:function(){return"\\ar "+this.forms.mkString(" ")+" "+this.path}}]),e}(),Ce.Command.Ar.Form=function e(){be(this,e)},Ce.Command.Ar.Form.BuildArrow=function(e){ve(n,e);var t=ge(n);function n(e,r,i,a){var o;return be(this,n),(o=t.call(this)).variant=e,o.tailTip=r,o.stemConn=i,o.headTip=a,o}return ye(n,[{key:"toString",value:function(){return"@"+this.variant+"{"+this.tailTip.toString()+", "+this.stemConn.toString()+", "+this.headTip.toString()+"}"}}]),n}(Ce.Command.Ar.Form),Ce.Command.Ar.Form.ChangeVariant=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).variant=e,r}return ye(n,[{key:"toString",value:function(){return"@"+this.variant}}]),n}(Ce.Command.Ar.Form),Ce.Command.Ar.Form.Tip=function e(){be(this,e)},Ce.Command.Ar.Form.Tip.Tipchars=function(){function e(t){be(this,e),this.tipchars=t}return ye(e,[{key:"toString",value:function(){return this.tipchars}}]),e}(),Ce.Command.Ar.Form.Tip.Object=function(){function e(t){be(this,e),this.object=t}return ye(e,[{key:"toString",value:function(){return"*"+this.object}}]),e}(),Ce.Command.Ar.Form.Tip.Dir=function(){function e(t){be(this,e),this.dir=t}return ye(e,[{key:"toString",value:function(){return this.dir}}]),e}(),Ce.Command.Ar.Form.Conn=function e(){be(this,e)},Ce.Command.Ar.Form.Conn.Connchars=function(){function e(t){be(this,e),this.connchars=t}return ye(e,[{key:"toString",value:function(){return this.connchars}}]),e}(),Ce.Command.Ar.Form.Conn.Object=function(){function e(t){be(this,e),this.object=t}return ye(e,[{key:"toString",value:function(){return"*"+this.object}}]),e}(),Ce.Command.Ar.Form.Conn.Dir=function(){function e(t){be(this,e),this.dir=t}return ye(e,[{key:"toString",value:function(){return this.dir}}]),e}(),Ce.Command.Ar.Form.ChangeStem=function(){function e(t){be(this,e),this.connchar=t}return ye(e,[{key:"toString",value:function(){return"@"+this.connchar}}]),e}(),Ce.Command.Ar.Form.DashArrowStem=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"@!"}}]),e}(),Ce.Command.Ar.Form.CurveArrow=function(){function e(t,n){be(this,e),this.direction=t,this.dist=n}return ye(e,[{key:"toString",value:function(){return"@/"+this.direction+" "+this.dist+"/"}}]),e}(),Ce.Command.Ar.Form.CurveFitToDirection=function(){function e(t,n){be(this,e),this.outDirection=t,this.inDirection=n}return ye(e,[{key:"toString",value:function(){return"@("+this.outDirection+","+this.inDirection+")"}}]),e}(),Ce.Command.Ar.Form.CurveWithControlPoints=function(){function e(t){be(this,e),this.coord=t}return ye(e,[{key:"toString",value:function(){return"@`{"+this.coord+"}"}}]),e}(),Ce.Command.Ar.Form.AddShape=function(){function e(t){be(this,e),this.shape=t}return ye(e,[{key:"toString",value:function(){return"@["+this.shape+"]"}}]),e}(),Ce.Command.Ar.Form.AddModifiers=function(){function e(t){be(this,e),this.modifiers=t}return ye(e,[{key:"toString",value:function(){return"@*{"+this.modifiers.mkString(" ")+"}"}}]),e}(),Ce.Command.Ar.Form.Slide=function(){function e(t){be(this,e),this.slideDimen=t}return ye(e,[{key:"toString",value:function(){return"@<"+this.slideDimen+">"}}]),e}(),Ce.Command.Ar.Form.LabelAt=function(){function e(t,n){be(this,e),this.anchor=t,this.it=n}return ye(e,[{key:"toString",value:function(){return"|"+this.anchor+" "+this.it}}]),e}(),Ce.Command.Ar.Form.LabelAbove=function(){function e(t,n){be(this,e),this.anchor=t,this.it=n}return ye(e,[{key:"toString",value:function(){return"^"+this.anchor+" "+this.it}}]),e}(),Ce.Command.Ar.Form.LabelBelow=function(){function e(t,n){be(this,e),this.anchor=t,this.it=n}return ye(e,[{key:"toString",value:function(){return"_"+this.anchor+" "+this.it}}]),e}(),Ce.Command.Ar.Form.ReverseAboveAndBelow=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"@?"}}]),e}(),Ce.Command.Xymatrix=function(){function e(t,n){be(this,e),this.setup=t,this.rows=n}return ye(e,[{key:"toString",value:function(){return"\\xymatrix"+this.setup+"{\n"+this.rows.mkString("","\\\\\n","")+"\n}"}}]),e}(),Ce.Command.Xymatrix.Setup=function e(){be(this,e)},Ce.Command.Xymatrix.Setup.Prefix=function(){function e(t){be(this,e),this.prefix=t}return ye(e,[{key:"toString",value:function(){return'"'+this.prefix+'"'}}]),e}(),Ce.Command.Xymatrix.Setup.ChangeSpacing=function e(t,n){be(this,e),this.addop=t,this.dimen=n},Ce.Command.Xymatrix.Setup.ChangeSpacing.Row=function(e){ve(n,e);var t=ge(n);function n(e,r){return be(this,n),t.call(this,e,r)}return ye(n,[{key:"toString",value:function(){return"@R"+this.addop+this.dimen}}]),n}(Ce.Command.Xymatrix.Setup.ChangeSpacing),Ce.Command.Xymatrix.Setup.ChangeSpacing.Column=function(e){ve(n,e);var t=ge(n);function n(e,r){return be(this,n),t.call(this,e,r)}return ye(n,[{key:"toString",value:function(){return"@C"+this.addop+this.dimen}}]),n}(Ce.Command.Xymatrix.Setup.ChangeSpacing),Ce.Command.Xymatrix.Setup.ChangeSpacing.RowAndColumn=function(e){ve(n,e);var t=ge(n);function n(e,r){return be(this,n),t.call(this,e,r)}return ye(n,[{key:"toString",value:function(){return"@"+this.addop+this.dimen}}]),n}(Ce.Command.Xymatrix.Setup.ChangeSpacing),Ce.Command.Xymatrix.Setup.PretendEntrySize=function e(t){be(this,e),this.dimen=t},Ce.Command.Xymatrix.Setup.PretendEntrySize.Height=function(e){ve(n,e);var t=ge(n);function n(e){return be(this,n),t.call(this,e)}return ye(n,[{key:"toString",value:function(){return"@!R="+this.dimen}}]),n}(Ce.Command.Xymatrix.Setup.PretendEntrySize),Ce.Command.Xymatrix.Setup.PretendEntrySize.Width=function(e){ve(n,e);var t=ge(n);function n(e){return be(this,n),t.call(this,e)}return ye(n,[{key:"toString",value:function(){return"@!C="+this.dimen}}]),n}(Ce.Command.Xymatrix.Setup.PretendEntrySize),Ce.Command.Xymatrix.Setup.PretendEntrySize.HeightAndWidth=function(e){ve(n,e);var t=ge(n);function n(e){return be(this,n),t.call(this,e)}return ye(n,[{key:"toString",value:function(){return"@!="+this.dimen}}]),n}(Ce.Command.Xymatrix.Setup.PretendEntrySize),Ce.Command.Xymatrix.Setup.FixGrid=function e(){be(this,e)},Ce.Command.Xymatrix.Setup.FixGrid.Row=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"@!R"}}]),n}(Ce.Command.Xymatrix.Setup.FixGrid),Ce.Command.Xymatrix.Setup.FixGrid.Column=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"@!C"}}]),n}(Ce.Command.Xymatrix.Setup.FixGrid),Ce.Command.Xymatrix.Setup.FixGrid.RowAndColumn=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"@!"}}]),n}(Ce.Command.Xymatrix.Setup.FixGrid),Ce.Command.Xymatrix.Setup.AdjustEntrySize=function e(t,n){be(this,e),this.addop=t,this.dimen=n},Ce.Command.Xymatrix.Setup.AdjustEntrySize.Margin=function(e){ve(n,e);var t=ge(n);function n(e,r){return be(this,n),t.call(this,e,r)}return ye(n,[{key:"toString",value:function(){return"@M"+this.addop+this.dimen}}]),n}(Ce.Command.Xymatrix.Setup.AdjustEntrySize),Ce.Command.Xymatrix.Setup.AdjustEntrySize.Width=function(e){ve(n,e);var t=ge(n);function n(e,r){return be(this,n),t.call(this,e,r)}return ye(n,[{key:"toString",value:function(){return"@W"+this.addop+this.dimen}}]),n}(Ce.Command.Xymatrix.Setup.AdjustEntrySize),Ce.Command.Xymatrix.Setup.AdjustEntrySize.Height=function(e){ve(n,e);var t=ge(n);function n(e,r){return be(this,n),t.call(this,e,r)}return ye(n,[{key:"toString",value:function(){return"@H"+this.addop+this.dimen}}]),n}(Ce.Command.Xymatrix.Setup.AdjustEntrySize),Ce.Command.Xymatrix.Setup.AdjustLabelSep=function(){function e(t,n){be(this,e),this.addop=t,this.dimen=n}return ye(e,[{key:"toString",value:function(){return"@L"+this.addop+this.dimen}}]),e}(),Ce.Command.Xymatrix.Setup.SetOrientation=function(){function e(t){be(this,e),this.direction=t}return ye(e,[{key:"toString",value:function(){return"@"+this.direction}}]),e}(),Ce.Command.Xymatrix.Setup.AddModifier=function(){function e(t){be(this,e),this.modifier=t}return ye(e,[{key:"toString",value:function(){return"@*"+this.modifier}}]),e}(),Ce.Command.Xymatrix.Row=function(){function e(t){be(this,e),this.entries=t}return ye(e,[{key:"toString",value:function(){return this.entries.mkString(" & ")}}]),e}(),Ce.Command.Xymatrix.Entry=function e(){be(this,e)},Ce.Command.Xymatrix.Entry.SimpleEntry=function(e){ve(n,e);var t=ge(n);function n(e,r,i){var a;return be(this,n),(a=t.call(this)).modifiers=e,a.objectbox=r,a.decor=i,a}return ye(n,[{key:"isEmpty",get:function(){return!1}},{key:"toString",value:function(){return this.modifiers.mkString("**{","","}")+" "+this.objectbox+" "+this.decor}}]),n}(Ce.Command.Xymatrix.Entry),Ce.Command.Xymatrix.Entry.ObjectEntry=function(e){ve(n,e);var t=ge(n);function n(e,r,i){var a;return be(this,n),(a=t.call(this)).object=e,a.pos=r,a.decor=i,a}return ye(n,[{key:"isEmpty",get:function(){return!1}},{key:"toString",value:function(){return"*"+this.object+" "+this.pos+" "+this.decor}}]),n}(Ce.Command.Xymatrix.Entry),Ce.Command.Xymatrix.Entry.EmptyEntry=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).decor=e,r}return ye(n,[{key:"isEmpty",get:function(){return!0}},{key:"toString",value:function(){return""+this.decor}}]),n}(Ce.Command.Xymatrix.Entry),Ce.Command.Twocell=function(){function e(t,n,r){be(this,e),this.twocell=t,this.switches=n,this.arrow=r}return ye(e,[{key:"toString",value:function(){return this.twocell.toString()+this.switches.mkString("")+this.arrow}}]),e}(),Ce.Command.Twocell.Hops2cell=function e(t,n){be(this,e),this.hops=t,this.maybeDisplace=n},Ce.Command.Twocell.Twocell=function(e){ve(n,e);var t=ge(n);function n(e,r){return be(this,n),t.call(this,e,r)}return ye(n,[{key:"toString",value:function(){return"\\xtwocell["+this.hops+"]"+this.maybeDisplace.getOrElse("{}")}}]),n}(Ce.Command.Twocell.Hops2cell),Ce.Command.Twocell.UpperTwocell=function(e){ve(n,e);var t=ge(n);function n(e,r){return be(this,n),t.call(this,e,r)}return ye(n,[{key:"toString",value:function(){return"\\xuppertwocell["+this.hops+"]"+this.maybeDisplace.getOrElse("{}")}}]),n}(Ce.Command.Twocell.Hops2cell),Ce.Command.Twocell.LowerTwocell=function(e){ve(n,e);var t=ge(n);function n(e,r){return be(this,n),t.call(this,e,r)}return ye(n,[{key:"toString",value:function(){return"\\xlowertwocell["+this.hops+"]"+this.maybeDisplace.getOrElse("{}")}}]),n}(Ce.Command.Twocell.Hops2cell),Ce.Command.Twocell.CompositeMap=function(e){ve(n,e);var t=ge(n);function n(e,r){return be(this,n),t.call(this,e,r)}return ye(n,[{key:"toString",value:function(){return"\\xcompositemap["+this.hops+"]"+this.maybeDisplace.getOrElse("{}")}}]),n}(Ce.Command.Twocell.Hops2cell),Ce.Command.Twocell.Switch=function e(){be(this,e)},Ce.Command.Twocell.Switch.UpperLabel=function(){function e(t){be(this,e),this.label=t}return ye(e,[{key:"toString",value:function(){return"^"+this.label}}]),e}(),Ce.Command.Twocell.Switch.LowerLabel=function(){function e(t){be(this,e),this.label=t}return ye(e,[{key:"toString",value:function(){return"_"+this.label}}]),e}(),Ce.Command.Twocell.Switch.SetCurvature=function(){function e(t){be(this,e),this.nudge=t}return ye(e,[{key:"toString",value:function(){return this.nudge.toString()}}]),e}(),Ce.Command.Twocell.Switch.DoNotSetCurvedArrows=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"\\omit"}}]),e}(),Ce.Command.Twocell.Switch.PlaceModMapObject=function(){function e(){be(this,e)}return ye(e,[{key:"toString",value:function(){return"~!"}}]),e}(),Ce.Command.Twocell.Switch.ChangeHeadTailObject=function(){function e(t,n){be(this,e),this.what=t,this.object=n}return ye(e,[{key:"toString",value:function(){return"~"+this.what+"{"+this.object+"}"}}]),e}(),Ce.Command.Twocell.Switch.ChangeCurveObject=function(){function e(t,n,r){be(this,e),this.what=t,this.spacer=n,this.maybeObject=r}return ye(e,[{key:"toString",value:function(){return"~"+this.what+"{"+this.spacer+(this.maybeObject.isDefined?"~**"+this.maybeObject.get:"")+"}"}}]),e}(),Ce.Command.Twocell.Label=function(){function e(t,n){be(this,e),this.maybeNudge=t,this.labelObject=n}return ye(e,[{key:"toString",value:function(){return this.maybeNudge.toString()+this.labelObject}}]),e}(),Ce.Command.Twocell.Nudge=function e(){be(this,e)},Ce.Command.Twocell.Nudge.Number=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).number=e,r}return ye(n,[{key:"toString",value:function(){return"<"+this.number+">"}}]),n}(Ce.Command.Twocell.Nudge),Ce.Command.Twocell.Nudge.Omit=function(e){ve(n,e);var t=ge(n);function n(){return be(this,n),t.call(this)}return ye(n,[{key:"toString",value:function(){return"<\\omit>"}}]),n}(Ce.Command.Twocell.Nudge),Ce.Command.Twocell.Arrow=function e(){be(this,e)},Ce.Command.Twocell.Arrow.WithOrientation=function(e){ve(n,e);var t=ge(n);function n(e,r){var i;return be(this,n),(i=t.call(this)).tok=e,i.labelObject=r,i}return ye(n,[{key:"toString",value:function(){return"{["+this.tok+"] "+this.labelObject+"}"}}]),n}(Ce.Command.Twocell.Arrow),Ce.Command.Twocell.Arrow.WithPosition=function(e){ve(n,e);var t=ge(n);function n(e,r){var i;return be(this,n),(i=t.call(this)).nudge=e,i.labelObject=r,i}return ye(n,[{key:"toString",value:function(){return"{["+this.nudge+"] "+this.labelObject+"}"}}]),n}(Ce.Command.Twocell.Arrow),Ce.Command.Newdir=function(){function e(t,n){be(this,e),this.dirMain=t,this.compositeObject=n}return ye(e,[{key:"toString",value:function(){return"\\newdir{"+this.dirMain+"}{"+this.compositeObject+"}"}}]),e}(),Ce.Pos.Xyimport=function e(){be(this,e)},Ce.Pos.Xyimport.TeXCommand=function(e){ve(n,e);var t=ge(n);function n(e,r,i,a,o){var u;return be(this,n),(u=t.call(this)).width=e,u.height=r,u.xOffset=i,u.yOffset=a,u.graphics=o,u}return ye(n,[{key:"toString",value:function(){return"\\xyimport("+this.width+", "+this.height+")("+this.xOffset+", "+this.yOffset+"){"+this.graphics+"}"}}]),n}(Ce.Pos.Xyimport),Ce.Pos.Xyimport.Graphics=function(e){ve(n,e);var t=ge(n);function n(e,r,i,a,o){var u;return be(this,n),(u=t.call(this)).width=e,u.height=r,u.xOffset=i,u.yOffset=a,u.graphics=o,u}return ye(n,[{key:"toString",value:function(){return"\\xyimport("+this.width+", "+this.height+")("+this.xOffset+", "+this.yOffset+"){"+this.graphics+"}"}}]),n}(Ce.Pos.Xyimport),Ce.Command.Includegraphics=function(){function e(t,n,r){be(this,e),this.isClipped=t,this.attributeList=n,this.filepath=r}return ye(e,[{key:"isIncludegraphics",get:function(){return!0}},{key:"toString",value:function(){return"\\includegraphics"+(this.isClipped?"*":"")+this.attributeList.mkString("[",",","]")+"{"+this.filepath+"}"}}]),e}(),Ce.Command.Includegraphics.Attr=function e(){be(this,e)},Ce.Command.Includegraphics.Attr.Width=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).dimen=e,r}return ye(n,[{key:"toString",value:function(){return"width="+this.dimen}}]),n}(Ce.Command.Includegraphics.Attr),Ce.Command.Includegraphics.Attr.Height=function(e){ve(n,e);var t=ge(n);function n(e){var r;return be(this,n),(r=t.call(this)).dimen=e,r}return ye(n,[{key:"toString",value:function(){return"height="+this.dimen}}]),n}(Ce.Command.Includegraphics.Attr);var Me=$.fun,Pe=$.elem,Oe=function(e){return Me($.elem(e))},Be=$.literal,Ee=$.regex,Ae=$.regexLiteral,Le=function(e){return Me($.literal(e))},je=$.seq,De=$.or,Te=function(e){return $.lazyParser(e)().rep()},Re=function(e){return $.lazyParser(e)().rep1()},Fe=function(e){return $.lazyParser(e)().opt()},Ge=$.success,Ve=function(e){return function(){var t=e.memo;return void 0===t&&(t=e.memo=e()),t}},_e=new $,Ie={xy:Ve((function(){return _e.posDecor().to((function(e){return e}))})),xybox:Ve((function(){return Be("{").andr(_e.posDecor).andl(Le("}")).to((function(e){return e}))})),xymatrixbox:Ve((function(){return _e.xymatrix().to((function(e){return new Ce.PosDecor(new Ce.Pos.Coord(new Ce.Coord.C,L.empty),new Ce.Decor(L.empty.append(e)))}))})),posDecor:Ve((function(){return je(_e.pos,_e.decor).to((function(e){return new Ce.PosDecor(e.head,e.tail)}))})),pos:Ve((function(){return je(_e.coord,Te(_e.pos2)).to((function(e){return new Ce.Pos.Coord(e.head,e.tail)}))})),nonemptyPos:Ve((function(){return De(je(_e.nonemptyCoord,Te(_e.pos2)),je(_e.coord,Re(_e.pos2))).to((function(e){return new Ce.Pos.Coord(e.head,e.tail)}))})),pos2:Ve((function(){return De(Be("+").andr(_e.coord).to((function(e){return new Ce.Pos.Plus(e)})),Be("-").andr(_e.coord).to((function(e){return new Ce.Pos.Minus(e)})),Be("!").andr(_e.coord).to((function(e){return new Ce.Pos.Skew(e)})),Be(".").andr(_e.coord).to((function(e){return new Ce.Pos.Cover(e)})),Be(",").andr(_e.coord).to((function(e){return new Ce.Pos.Then(e)})),Be(";").andr(_e.coord).to((function(e){return new Ce.Pos.SwapPAndC(e)})),Be("::").andr(_e.coord).to((function(e){return new Ce.Pos.SetYBase(e)})),Be(":").andr(_e.coord).to((function(e){return new Ce.Pos.SetBase(e)})),Be("**").andr(_e.object).to((function(e){return new Ce.Pos.ConnectObject(e)})),Be("*").andr(_e.object).to((function(e){return new Ce.Pos.DropObject(e)})),Be("?").andr(_e.place).to((function(e){return new Ce.Pos.Place(e)})),Be("@+").andr(_e.coord).to((function(e){return new Ce.Pos.PushCoord(e)})),Be("@-").andr(_e.coord).to((function(e){return new Ce.Pos.EvalCoordThenPop(e)})),Be("@=").andr(_e.coord).to((function(e){return new Ce.Pos.LoadStack(e)})),Be("@@").andr(_e.coord).to((function(e){return new Ce.Pos.DoCoord(e)})),Be("@i").to((function(){return new Ce.Pos.InitStack})),Be("@(").to((function(){return new Ce.Pos.EnterFrame})),Be("@)").to((function(){return new Ce.Pos.LeaveFrame})),Be("=:").andr(Le('"')).andr(_e.id).andl(Oe('"')).to((function(e){return new Ce.Pos.SaveBase(e)})),Be("=@").andr(Le('"')).andr(_e.id).andl(Oe('"')).to((function(e){return new Ce.Pos.SaveStack(e)})),Be("=").andr(Le('"')).andr(_e.id).andl(Oe('"')).to((function(e){return new Ce.Pos.SavePos(e)})),Be("=").andr(_e.nonemptyCoord).andl(Le('"')).and(_e.id).andl(Oe('"')).to((function(e){return new Ce.Pos.SaveMacro(e.head,e.tail)})),_e.xyimport)})),coord:Ve((function(){return De(_e.nonemptyCoord,Ge("empty").to((function(){return new Ce.Coord.C})))})),nonemptyCoord:Ve((function(){return De(Be("c").to((function(){return new Ce.Coord.C})),Be("p").to((function(){return new Ce.Coord.P})),Be("x").to((function(){return new Ce.Coord.X})),Be("y").to((function(){return new Ce.Coord.Y})),_e.vector().to((function(e){return new Ce.Coord.Vector(e)})),Be('"').andr(_e.id).andl(Oe('"')).to((function(e){return new Ce.Coord.Id(e)})),Be("{").andr(_e.posDecor).andl(Le("}")).to((function(e){return new Ce.Coord.Group(e)})),Be("s").andr(Me(Ae(/^\d/))).to((function(e){return new Ce.Coord.StackPosition(parseInt(e))})),Be("s").andr(Le("{")).and(_e.nonnegativeNumber).andl(Le("}")).to((function(e){return new Ce.Coord.StackPosition(e)})),Be("[").andr(Me(Fe(Be('"').andr(_e.id).andl(Oe('"'))).to((function(e){return e.getOrElse("")})))).and(_e.number).andl(Le(",")).and(_e.number).andl(Le("]")).to((function(e){return new Ce.Coord.DeltaRowColumn(e.head.head,e.head.tail,e.tail)})),Be("[").andr(Me(Fe(Be('"').andr(_e.id).andl(Oe('"'))).to((function(e){return e.getOrElse("")})))).and(Me(Te(Ee(/^[lrud]/)))).andl(Le("]")).to((function(e){return new Ce.Coord.Hops(e.head,e.tail)})),Be("[").andr(Me(Fe(Be('"').andr(_e.id).andl(Oe('"'))).to((function(e){return e.getOrElse("")})))).and(Me(Re(Ee(/^[lrud]/)))).and(_e.place).andl(Le("]")).to((function(e){return new Ce.Coord.DeltaRowColumn(e.head.head,e.head.tail,new Ce.Pos.Place(e.tail))})))})),vector:Ve((function(){return De(Be("(").andr(_e.factor).andl(Le(",")).and(_e.factor).andl(Le(")")).to((function(e){return new Ce.Vector.InCurBase(e.head,e.tail)})),Be("<").andr(_e.dimen).andl(Le(",")).and(_e.dimen).andl(Le(">")).to((function(e){return new Ce.Vector.Abs(e.head,e.tail)})),Be("<").andr(_e.dimen).andl(Le(">")).to((function(e){return new Ce.Vector.Abs(e,e)})),Be("a").andr(Le("(")).andr(_e.number).andl(Le(")")).to((function(e){return new Ce.Vector.Angle(e)})),Be("/").andr(_e.direction).and(_e.looseDimen).andl(Le("/")).to((function(e){return new Ce.Vector.Dir(e.head,e.tail)})),Be("0").to((function(e){return new Ce.Vector.Abs("0mm","0mm")})),(function(){return _e.corner().and(Me($.opt(Me(Be("(").andr(_e.factor).andl(Le(")")))).to((function(e){return e.getOrElse(1)})))).to((function(e){return new Ce.Vector.Corner(e.head,e.tail)}))}))})),corner:Ve((function(){return De(Ae(/^(CL|LC)/).to((function(){return new Ce.Corner.CL})),Ae(/^(CR|RC)/).to((function(){return new Ce.Corner.CR})),Ae(/^(CD|DC)/).to((function(){return new Ce.Corner.CD})),Ae(/^(CU|UC)/).to((function(){return new Ce.Corner.CU})),Ae(/^(LD|DL)/).to((function(){return new Ce.Corner.LD})),Ae(/^(RD|DR)/).to((function(){return new Ce.Corner.RD})),Ae(/^(LU|UL)/).to((function(){return new Ce.Corner.LU})),Ae(/^(RU|UR)/).to((function(){return new Ce.Corner.RU})),Be("L").to((function(){return new Ce.Corner.L})),Be("R").to((function(){return new Ce.Corner.R})),Be("D").to((function(){return new Ce.Corner.D})),Be("U").to((function(){return new Ce.Corner.U})),Be("E").to((function(){return new Ce.Corner.NearestEdgePoint})),Be("P").to((function(){return new Ce.Corner.PropEdgePoint})),Be("A").to((function(){return new Ce.Corner.Axis})))})),place:Ve((function(){return De(Be("<").andr(_e.place).to((function(e){return new Ce.Place(1,0,void 0,void 0).compound(e)})),Be(">").andr(_e.place).to((function(e){return new Ce.Place(0,1,void 0,void 0).compound(e)})),Be("(").andr(_e.factor).andl(Le(")")).and(_e.place).to((function(e){return new Ce.Place(0,0,new Ce.Place.Factor(e.head),void 0).compound(e.tail)})),Be("!").andr(Le("{")).andr(_e.pos).andl(Le("}")).and(_e.slide).to((function(e){return new Ce.Place(0,0,new Ce.Place.Intercept(e.head),e.tail)})),(function(){return _e.slide().to((function(e){return new Ce.Place(0,0,void 0,e)}))}))})),slide:Ve((function(){return De(Be("/").andr(_e.dimen).andl(Le("/")).to((function(e){return new Ce.Slide(new g.Some(e))})),Ge("no slide").to((function(){return new Ce.Slide(g.empty)})))})),factor:Ve(Me(Ae(/^[+\-]?(\d+(\.\d*)?|\d*\.\d+)/).to((function(e){return parseFloat(e)})))),number:Ve(Me(Ae(/^[+\-]?\d+/).to((function(e){return parseInt(e)})))),nonnegativeNumber:Ve(Me(Ae(/^\d+/).to((function(e){return parseInt(e)})))),unit:Ve(Me(Ae(/^(em|ex|px|pt|pc|in|cm|mm|mu)/).to((function(e){return e})))),dimen:Ve((function(){return _e.factor().and(_e.unit).to((function(e){return e.head.toString()+e.tail}))})),looseDimen:Ve((function(){return _e.looseFactor().and(_e.unit).to((function(e){return e.head.toString()+e.tail}))})),looseFactor:Ve(Me(De(Ae(/^(\d \d*(\.\d*))/).to((function(e){return parseFloat(e.replace(/ /,""))})),Ae(/^[+\-]?(\d+(\.\d*)?|\d*\.\d+)/).to((function(e){return parseFloat(e)}))))),id:Ve(Me(Ee(/^[^"]+/))),object:Ve((function(){return De(Te(_e.modifier).and(_e.objectbox).to((function(e){return new Ce.Object(e.head,e.tail)})))})),objectbox:Ve((function(){return De(_e.mathText,Be("@").andr(_e.dir),Be("\\dir").andr(_e.dir),Be("\\cir").andr(_e.cirRadius).andl(Le("{")).and(_e.cir).andl(Le("}")).to((function(e){return new Ce.ObjectBox.Cir(e.head,e.tail)})),Be("\\frm").andr(_e.frameRadius).andl(Le("{")).and(_e.frameMain).andl(Le("}")).to((function(e){return new Ce.ObjectBox.Frame(e.head,e.tail)})),Be("\\object").andr(_e.object).to((function(e){return new Ce.ObjectBox.WrapUpObject(e)})),Be("\\composite").and(Le("{")).andr(_e.compositeObject).andl(Le("}")).to((function(e){return new Ce.ObjectBox.CompositeObject(e)})),Be("\\xybox").and(Le("{")).andr(_e.posDecor).andl(Le("}")).to((function(e){return new Ce.ObjectBox.Xybox(e)})),Be("\\xymatrix").andr(_e.xymatrix).to((function(e){return new Ce.ObjectBox.Xymatrix(e)})),_e.txt,_e.curve,Ee(/^(\\[a-zA-Z@][a-zA-Z0-9@]+)/).andl(Le("{")).and(_e.text).andl(Le("}")).and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail;return _e.toMath(t.head+"{"+t.tail+"}",n)})))})),compositeObject:Ve((function(){return _e.object().and(Me(Te(Be("*").andr(_e.object)))).to((function(e){return e.tail.prepend(e.head)}))})),mathText:Ve((function(){return Be("{").andr(_e.text).andl(Oe("}")).and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail;return _e.toMath("\\hbox{$\\objectstyle{"+t+"}$}",n)}))})),toMath:function(e,t){var n=t(e);return new Ce.ObjectBox.Text(n)},textNodeCreator:Ve((function(){return new $.Parser((function(e){return new $.Success(e.context.createTextNode,e)}))})),text:Ve((function(){return Ee(/^[^{}\\%]*/).and((function(){return De(Ee(/^(\\\{|\\\}|\\%|\\)/).to((function(e){return e})),Pe("{").andr(_e.text).andl(Oe("}")).to((function(e){return"{"+e+"}"})),Ee(/^%[^\r\n]*(\r\n|\r|\n)?/).to((function(e){return" "}))).and(Me(Ee(/^[^{}\\%]*/))).rep().to((function(e){var t="";return e.foreach((function(e){t+=e.head+e.tail})),t}))})).to((function(e){return e.head+e.tail}))})),txt:Ve((function(){return Be("\\txt").andr(_e.txtWidth).and(Me(Ee(/^(\\[a-zA-Z@][a-zA-Z0-9@]+)?/))).andl(Le("{")).and(_e.text).andl(Le("}")).and(_e.textNodeCreator).to((function(e){var t,n=e.head,r=e.tail,i=n.head.head,a=n.head.tail,o=n.tail,u=o.split("\\\\");if(u.length<=1)t=a+"{\\hbox{"+o+"}}";else{t="\\hbox{$\\begin{array}{c}\n";for(var s=0;s")).to((function(e){return new Ce.Vector.Abs(e,e)})).to((function(e){return new Ce.ObjectBox.Txt.Width.Vector(e)})),Ge("default").to((function(){return new Ce.ObjectBox.Txt.Width.Default})))})),dir:Ve((function(){return Ae(/^[\^_0123]/).opt().andl(Le("{")).and(_e.dirMain).andl(Le("}")).to((function(e){return new Ce.ObjectBox.Dir(e.head.getOrElse(""),e.tail)}))})),dirMain:Ve((function(){return Ee(/^(-|\.|~|>|<|\(|\)|`|'|\||\*|\+|x|\/|o|=|:|[a-zA-Z@ ])+/).opt().to((function(e){return e.getOrElse("")}))})),cirRadius:Ve((function(){return De(_e.vector().to((function(e){return new Ce.ObjectBox.Cir.Radius.Vector(e)})),Ge("default").to((function(){return new Ce.ObjectBox.Cir.Radius.Default})))})),frameRadius:Ve((function(){return De(_e.frameRadiusVector().to((function(e){return new Ce.ObjectBox.Frame.Radius.Vector(e)})),Ge("default").to((function(){return new Ce.ObjectBox.Frame.Radius.Default})))})),frameRadiusVector:Ve((function(){return De(Be("<").andr(_e.dimen).andl(Le(",")).and(_e.dimen).andl(Le(">")).to((function(e){return new Ce.Vector.Abs(e.head,e.tail)})),Be("<").andr(_e.dimen).andl(Le(">")).to((function(e){return new Ce.Vector.Abs(e,e)})))})),frameMain:Ve((function(){return Ee(/^(((_|\^)?(\\\{|\\\}|\(|\)))|[\-=oe,\.\*]*)/)})),cir:Ve((function(){return De(_e.nonemptyCir,Ge("full").to((function(){return new Ce.ObjectBox.Cir.Cir.Full})))})),nonemptyCir:Ve((function(){return _e.diag().and(Me(Ae(/^[_\^]/))).and(_e.diag).to((function(e){return new Ce.ObjectBox.Cir.Cir.Segment(e.head.head,e.head.tail,e.tail)}))})),curve:Ve((function(){return Be("\\crv").andr(_e.curveModifier).andl(Le("{")).and(_e.curveObject).and(_e.curvePoslist).andl(Le("}")).to((function(e){return new Ce.ObjectBox.Curve(e.head.head,e.head.tail,e.tail)}))})),curveModifier:Ve((function(){return Te(Me(Be("~").andr(_e.curveOption)))})),curveOption:Ve((function(){return De(Be("p").to((function(){return new Ce.ObjectBox.Curve.Modifier.p})),Be("P").to((function(){return new Ce.ObjectBox.Curve.Modifier.P})),Be("l").to((function(){return new Ce.ObjectBox.Curve.Modifier.l})),Be("L").to((function(){return new Ce.ObjectBox.Curve.Modifier.L})),Be("c").to((function(){return new Ce.ObjectBox.Curve.Modifier.c})),Be("C").to((function(){return new Ce.ObjectBox.Curve.Modifier.C})),Be("pc").to((function(){return new Ce.ObjectBox.Curve.Modifier.pc})),Be("pC").to((function(){return new Ce.ObjectBox.Curve.Modifier.pC})),Be("Pc").to((function(){return new Ce.ObjectBox.Curve.Modifier.Pc})),Be("PC").to((function(){return new Ce.ObjectBox.Curve.Modifier.PC})),Be("lc").to((function(){return new Ce.ObjectBox.Curve.Modifier.lc})),Be("lC").to((function(){return new Ce.ObjectBox.Curve.Modifier.lC})),Be("Lc").to((function(){return new Ce.ObjectBox.Curve.Modifier.Lc})),Be("LC").to((function(){return new Ce.ObjectBox.Curve.Modifier.LC})),Be("cC").to((function(){return new Ce.ObjectBox.Curve.Modifier.cC})))})),curveObject:Ve((function(){return Te(De(Be("~*").andr(_e.object).to((function(e){return new Ce.ObjectBox.Curve.Object.Drop(e)})),Be("~**").andr(_e.object).to((function(e){return new Ce.ObjectBox.Curve.Object.Connect(e)}))))})),curvePoslist:Ve((function(){return De(Be("&").andr(_e.curvePoslist2).to((function(e){return e.prepend(new Ce.ObjectBox.Curve.PosList.CurPos)})),Be("~@").andr(Le("&")).andr(_e.curvePoslist2).to((function(e){return e.prepend(new Ce.ObjectBox.Curve.PosList.AddStack)})),Be("~@").to((function(){return L.empty.prepend(new Ce.ObjectBox.Curve.PosList.AddStack)})),_e.pos().andl(Le("&")).and(_e.curvePoslist2).to((function(e){return e.tail.prepend(new Ce.ObjectBox.Curve.PosList.Pos(e.head))})),_e.nonemptyPos().to((function(e){return L.empty.prepend(new Ce.ObjectBox.Curve.PosList.Pos(e))})),Ge("empty").to((function(){return L.empty})))})),curvePoslist2:Ve((function(){return De(Be("&").andr(_e.curvePoslist2).to((function(e){return e.prepend(new Ce.ObjectBox.Curve.PosList.CurPos)})),Be("~@").andr(Le("&")).andr(_e.curvePoslist2).to((function(e){return e.prepend(new Ce.ObjectBox.Curve.PosList.AddStack)})),Be("~@").to((function(){return L.empty.prepend(new Ce.ObjectBox.Curve.PosList.AddStack)})),_e.nonemptyPos().andl(Le("&")).and(_e.curvePoslist2).to((function(e){return e.tail.prepend(new Ce.ObjectBox.Curve.PosList.Pos(e.head))})),_e.nonemptyPos().to((function(e){return L.empty.prepend(new Ce.ObjectBox.Curve.PosList.Pos(e))})),Ge("empty").to((function(){return L.empty.prepend(new Ce.ObjectBox.Curve.PosList.CurPos)})))})),modifier:Ve((function(){return De(Be("!").andr(_e.vector).to((function(e){return new Ce.Modifier.Vector(e)})),Be("!").to((function(e){return new Ce.Modifier.RestoreOriginalRefPoint})),Be("[").andr(_e.shape).andl(Le("]")).to((function(e){return e})),Be("i").to((function(e){return new Ce.Modifier.Invisible})),Be("h").to((function(e){return new Ce.Modifier.Hidden})),_e.addOp().and(_e.size).to((function(e){return new Ce.Modifier.AddOp(e.head,e.tail)})),_e.nonemptyDirection().to((function(e){return new Ce.Modifier.Direction(e)})))})),addOp:Ve((function(){return De(Be("+=").to((function(){return new Ce.Modifier.AddOp.GrowTo})),Be("-=").to((function(){return new Ce.Modifier.AddOp.ShrinkTo})),Be("+").to((function(){return new Ce.Modifier.AddOp.Grow})),Be("-").to((function(){return new Ce.Modifier.AddOp.Shrink})),Be("=").to((function(){return new Ce.Modifier.AddOp.Set})))})),size:Ve((function(){return De((function(){return _e.vector().to((function(e){return new Ce.Modifier.AddOp.VactorSize(e)}))}),Ge("default size").to((function(){return new Ce.Modifier.AddOp.DefaultSize})))})),shape:Ve((function(){return De(Be(".").to((function(){return new Ce.Modifier.Shape.Point})),_e.frameShape,_e.alphabets().to((function(e){return new Ce.Modifier.Shape.Alphabets(e)})),Be("=").andr(_e.alphabets).to((function(e){return new Ce.Modifier.Shape.DefineShape(e)})),Ge("rect").to((function(){return new Ce.Modifier.Shape.Rect})))})),frameShape:Ve((function(){return Be("F").andr(_e.frameMain).and(Me(Te(Be(":").andr(Me(De(_e.frameRadiusVector().to((function(e){return new Ce.Modifier.Shape.Frame.Radius(e)})),_e.colorName().to((function(e){return new Ce.Modifier.Shape.Frame.Color(e)})))))))).to((function(e){var t=e.head;return""===t&&(t="-"),new Ce.Modifier.Shape.Frame(t,e.tail)}))})),alphabets:Ve((function(){return Ee(/^([a-zA-Z]+)/)})),colorName:Ve((function(){return Ee(/^([a-zA-Z][a-zA-Z0-9]*)/)})),direction:Ve((function(){return je(_e.direction0,Te(_e.direction1)).to((function(e){return new Ce.Direction.Compound(e.head,e.tail)}))})),direction0:Ve((function(){return De(_e.direction2,_e.diag().to((function(e){return new Ce.Direction.Diag(e)})))})),direction1:Ve((function(){return De(Be(":").andr(_e.vector).to((function(e){return new Ce.Direction.RotVector(e)})),Be("_").to((function(e){return new Ce.Direction.RotAntiCW})),Be("^").to((function(e){return new Ce.Direction.RotCW})))})),direction2:Ve((function(){return De(Be("v").andr(_e.vector).to((function(e){return new Ce.Direction.Vector(e)})),Be("q").andr(Le("{")).andr(_e.posDecor).andl(Le("}")).to((function(e){return new Ce.Direction.ConstructVector(e)})))})),nonemptyDirection:Ve((function(){return De(je(_e.nonemptyDirection0,Te(_e.direction1)),je(_e.direction0,Re(_e.direction1))).to((function(e){return new Ce.Direction.Compound(e.head,e.tail)}))})),nonemptyDirection0:Ve((function(){return De(_e.direction2,_e.nonemptyDiag().to((function(e){return new Ce.Direction.Diag(e)})))})),diag:Ve((function(){return De(_e.nonemptyDiag,Ge("empty").to((function(e){return new Ce.Diag.Default})))})),nonemptyDiag:Ve((function(){return De(Ae(/^(ld|dl)/).to((function(e){return new Ce.Diag.LD})),Ae(/^(rd|dr)/).to((function(e){return new Ce.Diag.RD})),Ae(/^(lu|ul)/).to((function(e){return new Ce.Diag.LU})),Ae(/^(ru|ur)/).to((function(e){return new Ce.Diag.RU})),Be("l").to((function(e){return new Ce.Diag.L})),Be("r").to((function(e){return new Ce.Diag.R})),Be("d").to((function(e){return new Ce.Diag.D})),Be("u").to((function(e){return new Ce.Diag.U})))})),decor:Ve((function(){return _e.command().rep().to((function(e){return new Ce.Decor(e)}))})),command:Ve((function(){return De(Be("\\ar").andr(Me(Te(_e.arrowForm))).and(_e.path).to((function(e){return new Ce.Command.Ar(e.head,e.tail)})),Be("\\xymatrix").andr(_e.xymatrix),Be("\\PATH").andr(_e.path).to((function(e){return new Ce.Command.Path(e)})),Be("\\afterPATH").andr(Le("{")).andr(_e.decor).andl(Le("}")).and(_e.path).to((function(e){return new Ce.Command.AfterPath(e.head,e.tail)})),Be("\\save").andr(_e.pos).to((function(e){return new Ce.Command.Save(e)})),Be("\\restore").to((function(){return new Ce.Command.Restore})),Be("\\POS").andr(_e.pos).to((function(e){return new Ce.Command.Pos(e)})),Be("\\afterPOS").andr(Le("{")).andr(_e.decor).andl(Le("}")).and(_e.pos).to((function(e){return new Ce.Command.AfterPos(e.head,e.tail)})),Be("\\drop").andr(_e.object).to((function(e){return new Ce.Command.Drop(e)})),Be("\\connect").andr(_e.object).to((function(e){return new Ce.Command.Connect(e)})),Be("\\relax").to((function(){return new Ce.Command.Relax})),Be("\\xyignore").andr(Le("{")).andr(_e.pos).and(_e.decor).andl(Le("}")).to((function(e){return new Ce.Command.Ignore(e.head,e.tail)})),Be("\\xyshowAST").andr(Le("{")).andr(_e.pos).and(_e.decor).andl(Le("}")).to((function(e){return new Ce.Command.ShowAST(e.head,e.tail)})),_e.twocellCommand)})),arrowForm:Ve((function(){return De(Be("@").andr(Me(Ee(/^([\-\.~=:])/))).to((function(e){return new Ce.Command.Ar.Form.ChangeStem(e)})),Be("@").andr(Le("!")).to((function(e){return new Ce.Command.Ar.Form.DashArrowStem})),Be("@").andr(Le("/")).andr(_e.direction).and(Me(Fe(_e.looseDimen))).andl(Le("/")).to((function(e){return new Ce.Command.Ar.Form.CurveArrow(e.head,e.tail.getOrElse(".5pc"))})),Be("@").andr(Le("(")).andr(_e.direction).andl(Le(",")).and(_e.direction).andl(Le(")")).to((function(e){return new Ce.Command.Ar.Form.CurveFitToDirection(e.head,e.tail)})),Be("@").andr(Le("`")).andr(_e.coord).to((function(e){return new Ce.Command.Ar.Form.CurveWithControlPoints(e)})),Be("@").andr(Le("[")).andr(_e.shape).andl(Le("]")).to((function(e){return new Ce.Command.Ar.Form.AddShape(e)})),Be("@").andr(Le("*")).andr(Le("{")).andr(Me(Te(_e.modifier))).andl(Le("}")).to((function(e){return new Ce.Command.Ar.Form.AddModifiers(e)})),Be("@").andr(Le("<")).andr(_e.dimen).andl(Le(">")).to((function(e){return new Ce.Command.Ar.Form.Slide(e)})),Be("|").andr(_e.anchor).and(_e.it).to((function(e){return new Ce.Command.Ar.Form.LabelAt(e.head,e.tail)})),Be("^").andr(_e.anchor).and(_e.it).to((function(e){return new Ce.Command.Ar.Form.LabelAbove(e.head,e.tail)})),Be("_").andr(_e.anchor).and(_e.it).to((function(e){return new Ce.Command.Ar.Form.LabelBelow(e.head,e.tail)})),Be("@").andr(Le("?")).to((function(){return new Ce.Command.Ar.Form.ReverseAboveAndBelow})),Be("@").andr(Me(Ee(/^([\^_0123])/).opt())).and(Me(Fe(_e.tipConnTip))).to((function(e){var t=e.head.getOrElse("");if(e.tail.isDefined){var n=e.tail.get;return new Ce.Command.Ar.Form.BuildArrow(t,n.tail,n.stem,n.head)}return new Ce.Command.Ar.Form.ChangeVariant(t)})))})),tipConnTip:Ve((function(){return Be("{").andr(Me(Fe(_e.nonemptyTip))).and(Me(Fe(_e.nonemptyConn))).and(Me(Fe(_e.nonemptyTip))).andl(Le("}")).to((function(e){var t,n,r,i=e.head.head,a=e.head.tail,o=e.tail,u=new Ce.Command.Ar.Form.Tip.Tipchars("");return a.isDefined||o.isDefined?(t=i.getOrElse(u),n=a.getOrElse(new Ce.Command.Ar.Form.Conn.Connchars("")),r=o.getOrElse(u)):i.isDefined?(t=u,n=new Ce.Command.Ar.Form.Conn.Connchars("-"),r=i.getOrElse(u)):(t=u,n=new Ce.Command.Ar.Form.Conn.Connchars(""),r=u),{tail:t,stem:n,head:r}}))})),nonemptyTip:Ve((function(){return De(Ee(/^([<>()|'`+\/a-zA-Z ]+)/).to((function(e){return new Ce.Command.Ar.Form.Tip.Tipchars(e)})),Be("*").andr(_e.object).to((function(e){return new Ce.Command.Ar.Form.Tip.Object(e)})),_e.dir().to((function(e){return new Ce.Command.Ar.Form.Tip.Dir(e)})))})),nonemptyConn:Ve((function(){return De(Ee(/^([\-\.~=:]+)/).to((function(e){return new Ce.Command.Ar.Form.Conn.Connchars(e)})),Be("*").andr(_e.object).to((function(e){return new Ce.Command.Ar.Form.Conn.Object(e)})),_e.dir().to((function(e){return new Ce.Command.Ar.Form.Conn.Dir(e)})))})),path:Ve((function(){return _e.path2(L.empty).to((function(e){return new Ce.Command.Path.Path(e)}))})),path2:function(e){var t=Ve((function(){return _e.path2(e)}));return De(_e.path3().and(t).to((function(e){return e.tail.prepend(e.head)})),je("~","{",t,"}").to((function(e){return e.head.tail})).into((function(e){return _e.path2(e)})),_e.segment().to((function(e){return L.empty.prepend(new Ce.Command.Path.LastSegment(e))})),Ge(e).to((function(e){return e})))},path3:Ve((function(){return De(je("~","=","{",_e.posDecor,"}").to((function(e){return new Ce.Command.Path.SetBeforeAction(e.head.tail)})),je("~","/","{",_e.posDecor,"}").to((function(e){return new Ce.Command.Path.SetAfterAction(e.head.tail)})),je("~","<","{",_e.labels,"}").to((function(e){return new Ce.Command.Path.AddLabelNextSegmentOnly(e.head.tail)})),je("~",">","{",_e.labels,"}").to((function(e){return new Ce.Command.Path.AddLabelLastSegmentOnly(e.head.tail)})),je("~","+","{",_e.labels,"}").to((function(e){return new Ce.Command.Path.AddLabelEverySegment(e.head.tail)})),je("'",_e.segment).to((function(e){return new Ce.Command.Path.StraightSegment(e.tail)})),je("`",_e.turn,_e.segment).to((function(e){return new Ce.Command.Path.TurningSegment(e.head.tail,e.tail)})))})),turn:Ve((function(){return De(_e.nonemptyCir().and(_e.turnRadius).to((function(e){return new Ce.Command.Path.Turn.Cir(e.head,e.tail)})),_e.diag().and(_e.turnRadius).to((function(e){return new Ce.Command.Path.Turn.Diag(e.head,e.tail)})))})),turnRadius:Ve((function(){return De(Be("/").andr(_e.dimen).to((function(e){return new Ce.Command.Path.TurnRadius.Dimen(e)})),Ge("default").to((function(){return new Ce.Command.Path.TurnRadius.Default})))})),segment:Ve((function(){return _e.nonemptyPos().and(_e.pathSlide).and(_e.labels).to((function(e){return new Ce.Command.Path.Segment(e.head.head,e.head.tail,e.tail)}))})),pathSlide:Ve((function(){return De(Be("<").andr(_e.dimen).andl(Le(">")).to((function(e){return new Ce.Slide(new g.Some(e))})),Ge("no slide").to((function(){return new Ce.Slide(g.empty)})))})),labels:Ve((function(){return _e.label().rep().to((function(e){return new Ce.Command.Path.Labels(e)}))})),label:Ve((function(){return De(je("^",_e.anchor,_e.it,_e.alias).to((function(e){return new Ce.Command.Path.Label.Above(new Ce.Pos.Place(e.head.head.tail),e.head.tail,e.tail)})),je("_",_e.anchor,_e.it,_e.alias).to((function(e){return new Ce.Command.Path.Label.Below(new Ce.Pos.Place(e.head.head.tail),e.head.tail,e.tail)})),je("|",_e.anchor,_e.it,_e.alias).to((function(e){return new Ce.Command.Path.Label.At(new Ce.Pos.Place(e.head.head.tail),e.head.tail,e.tail)})))})),anchor:Ve((function(){return De(Be("-").andr(_e.anchor).to((function(e){return new Ce.Place(1,1,new Ce.Place.Factor(.5),void 0).compound(e)})),_e.place)})),it:Ve((function(){return Te(Be("[").andr(_e.shape).andl(Le("]")).to((function(e){return e}))).and(_e.it2).to((function(e){return new Ce.Object(e.head.concat(e.tail.modifiers),e.tail.object)}))})),it2:Ve((function(){return De(Ae(/^[0-9a-zA-Z]/).and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail;return new Ce.Object(L.empty,_e.toMath("\\labelstyle "+t,n))})),Ae(/^(\\[a-zA-Z][a-zA-Z0-9]*)/).and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail;return new Ce.Object(L.empty,_e.toMath("\\labelstyle "+t,n))})),Be("{").andr(_e.text).andl(Oe("}")).and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail;return new Ce.Object(L.empty,_e.toMath("\\labelstyle "+t,n))})),Be("*").andr(_e.object),Be("@").andr(_e.dir).to((function(e){return new Ce.Object(L.empty,e)})))})),alias:Ve((function(){return je("=",'"',_e.id,'"').opt().to((function(e){return e.map((function(e){return e.head.tail}))}))})),xymatrix:Ve((function(){return _e.setup().andl(Le("{")).and(_e.rows).andl(Le("}")).to((function(e){return new Ce.Command.Xymatrix(e.head,e.tail)}))})),setup:Ve((function(){return Te(Me(De(Be('"').andr(Me(Ee(/^[^"]+/))).andl(Oe('"')).to((function(e){return new Ce.Command.Xymatrix.Setup.Prefix(e)})),Be("@!").andr(Me(Ee(/^[RC]/).opt().to((function(e){return e.getOrElse("")})))).and(Me(De(Pe("0").to((function(){return"0em"})),Pe("=").andr(_e.dimen)))).to((function(e){var t=e.tail;switch(e.head){case"R":return new Ce.Command.Xymatrix.Setup.PretendEntrySize.Height(t);case"C":return new Ce.Command.Xymatrix.Setup.PretendEntrySize.Width(t);default:return new Ce.Command.Xymatrix.Setup.PretendEntrySize.HeightAndWidth(t)}})),Be("@!").andr(Me(De(Pe("R").to((function(){return new Ce.Command.Xymatrix.Setup.FixGrid.Row})),Pe("C").to((function(){return new Ce.Command.Xymatrix.Setup.FixGrid.Column}))).opt().to((function(e){return e.getOrElse(new Ce.Command.Xymatrix.Setup.FixGrid.RowAndColumn)})))),Be("@").andr(Me(Ee(/^[MWHL]/))).and(_e.addOp).and(_e.dimen).to((function(e){var t=e.head.tail,n=e.tail;switch(e.head.head){case"M":return new Ce.Command.Xymatrix.Setup.AdjustEntrySize.Margin(t,n);case"W":return new Ce.Command.Xymatrix.Setup.AdjustEntrySize.Width(t,n);case"H":return new Ce.Command.Xymatrix.Setup.AdjustEntrySize.Height(t,n);case"L":return new Ce.Command.Xymatrix.Setup.AdjustLabelSep(t,n)}})),Be("@").andr(_e.nonemptyDirection).to((function(e){return new Ce.Command.Xymatrix.Setup.SetOrientation(e)})),Be("@*[").andr(_e.shape).andl(Le("]")).to((function(e){return new Ce.Command.Xymatrix.Setup.AddModifier(e)})),Be("@*").andr(_e.addOp).and(_e.size).to((function(e){return new Ce.Command.Xymatrix.Setup.AddModifier(new Ce.Modifier.AddOp(e.head,e.tail))})),Be("@").andr(Me(Ee(/^[RC]/).opt().to((function(e){return e.getOrElse("")})))).and(_e.addOp).and(_e.dimen).to((function(e){var t=e.head.tail,n=e.tail;switch(e.head.head){case"R":return new Ce.Command.Xymatrix.Setup.ChangeSpacing.Row(t,n);case"C":return new Ce.Command.Xymatrix.Setup.ChangeSpacing.Column(t,n);default:return new Ce.Command.Xymatrix.Setup.ChangeSpacing.RowAndColumn(t,n)}})),Be("@1").to((function(){return new Ce.Command.Xymatrix.Setup.AdjustEntrySize.Margin(new Ce.Modifier.AddOp.Set,"1pc")})))))})),rows:Ve((function(){return _e.row().and(Me(Te(Be("\\\\").andr(_e.row)))).to((function(e){var t=e.tail.prepend(e.head);if(!t.isEmpty){var n=t.at(t.length()-1);1===n.entries.length()&&n.entries.at(0).isEmpty&&(t=t.reverse().tail.reverse())}return t}))})),row:Ve((function(){return _e.entry().and(Me(Te(Be("&").andr(_e.entry)))).to((function(e){return new Ce.Command.Xymatrix.Row(e.tail.prepend(e.head))}))})),entry:Ve((function(){return De(Be("*").andr(_e.object).and(_e.pos).and(_e.decor).to((function(e){var t=e.head.head,n=e.head.tail,r=e.tail;return new Ce.Command.Xymatrix.Entry.ObjectEntry(t,n,r)})),_e.entryModifier().rep().and(_e.looseObjectbox).and(_e.decor).to((function(e){var t=e.head.head.foldLeft(L.empty,(function(e,t){return t.concat(e)})),n=e.head.tail.isEmpty,r=e.head.tail.object,i=e.tail;return n&&t.isEmpty?new Ce.Command.Xymatrix.Entry.EmptyEntry(i):new Ce.Command.Xymatrix.Entry.SimpleEntry(t,r,i)})))})),entryModifier:Ve((function(){return De(Be("**").andr(Le("[")).andr(_e.shape).andl(Le("]")).to((function(e){return L.empty.append(e)})),Be("**").andr(Le("{")).andr(Me(Te(_e.modifier))).andl(Le("}")))})),looseObjectbox:Ve((function(){return De(_e.objectbox().to((function(e){return{isEmpty:!1,object:e}})),Ee(/^[^\\{}%&]+/).opt().to((function(e){return e.getOrElse("")})).and(Me(Te(De(Pe("{").andr(_e.text).andl(Oe("}")).to((function(e){return"{"+e+"}"})),Pe("\\").andr(Me((e=Ee(/^(\\|ar|xymatrix|PATH|afterPATH|save|restore|POS|afterPOS|drop|connect|xyignore|([lrud]+(twocell|uppertwocell|lowertwocell|compositemap))|xtwocell|xuppertwocell|xlowertwocell|xcompositemap)/),$.not($.lazyParser(e))))).andr(Me(Ee(/^[{}%&]/).opt().to((function(e){return e.getOrElse("")})))).to((function(e){return"\\"+e})),Ee(/^%[^\r\n]*(\r\n|\r|\n)?/).to((function(e){return" "}))).and(Me(Ee(/^[^\\{}%&]+/).opt().to((function(e){return e.getOrElse("")})))).to((function(e){return e.head+e.tail}))).to((function(e){return e.mkString("")})))).and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail,r=t.head+t.tail;return{isEmpty:0===r.trim().length,object:_e.toMath("\\hbox{$\\objectstyle{"+r+"}$}",n)}})));var e})),twocellCommand:Ve((function(){return _e.twocell().and(Me(Te(_e.twocellSwitch))).and(_e.twocellArrow).to((function(e){return new Ce.Command.Twocell(e.head.head,e.head.tail,e.tail)}))})),twocell:Ve((function(){return De(Ae(/^\\[lrud]+twocell/).to((function(e){var t=e.substring(1,e.length-"twocell".length);return new Ce.Command.Twocell.Twocell(t,g.empty)})),Ae(/^\\[lrud]+uppertwocell/).to((function(e){var t=e.substring(1,e.length-"uppertwocell".length);return new Ce.Command.Twocell.UpperTwocell(t,g.empty)})),Ae(/^\\[lrud]+lowertwocell/).to((function(e){var t=e.substring(1,e.length-"lowertwocell".length);return new Ce.Command.Twocell.LowerTwocell(t,g.empty)})),Ae(/^\\[lrud]+compositemap/).to((function(e){var t=e.substring(1,e.length-"compositemap".length);return new Ce.Command.Twocell.CompositeMap(t,g.empty)})),De(Be("\\xtwocell").to((function(){return Ce.Command.Twocell.Twocell})),Be("\\xuppertwocell").to((function(){return Ce.Command.Twocell.UpperTwocell})),Be("\\xlowertwocell").to((function(){return Ce.Command.Twocell.LowerTwocell})),Be("\\xcompositemap").to((function(){return Ce.Command.Twocell.CompositeMap}))).andl(Le("[")).and(Me(Ee(/^[lrud]+/))).andl(Le("]")).andl(Le("{")).and(_e.text).andl(Le("}")).and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail,r=new Ce.Object(L.empty,_e.toMath("\\labelstyle "+t.tail,n));return new t.head.head(t.head.tail,new g.Some(r))})))})),twocellSwitch:Ve((function(){return De(Be("^").andr(_e.twocellLabel).to((function(e){return new Ce.Command.Twocell.Switch.UpperLabel(e)})),Be("_").andr(_e.twocellLabel).to((function(e){return new Ce.Command.Twocell.Switch.LowerLabel(e)})),Be("\\omit").to((function(){return new Ce.Command.Twocell.Switch.DoNotSetCurvedArrows})),Be("~!").to((function(){return new Ce.Command.Twocell.Switch.PlaceModMapObject})),Ae(/^(~[`'])/).andl(Le("{")).and(_e.object).andl(Le("}")).to((function(e){var t=e.head.substring(1);return new Ce.Command.Twocell.Switch.ChangeHeadTailObject(t,e.tail)})),Ae(/^(~[\^_]?)/).andl(Le("{")).and(_e.object).and(Me(Fe(Be("~**").andr(_e.object)))).andl(Le("}")).to((function(e){var t=e.head.head.substring(1),n=e.head.tail,r=e.tail;return new Ce.Command.Twocell.Switch.ChangeCurveObject(t,n,r)})),_e.nudge().to((function(e){return new Ce.Command.Twocell.Switch.SetCurvature(e)})))})),twocellLabel:Ve((function(){return De(Ae(/^[0-9a-zA-Z]/).and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail,r=new Ce.Object(L.empty,_e.toMath("\\twocellstyle "+t,n));return new Ce.Command.Twocell.Label(g.empty,r)})),Ae(/^(\\[a-zA-Z][a-zA-Z0-9]*)/).and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail,r=new Ce.Object(L.empty,_e.toMath("\\twocellstyle "+t,n));return new Ce.Command.Twocell.Label(g.empty,r)})),Be("{").andr(Me(Fe(_e.nudge))).andl(Le("*")).and(_e.object).andl(Le("}")).to((function(e){return new Ce.Command.Twocell.Label(e.head,e.tail)})),Be("{").andr(Me(Fe(_e.nudge))).and(_e.text).andl(Oe("}")).and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail,r=new Ce.Object(L.empty,_e.toMath("\\twocellstyle "+t.tail,n));return new Ce.Command.Twocell.Label(t.head,r)})))})),nudge:Ve((function(){return De(Be("<\\omit>").to((function(){return new Ce.Command.Twocell.Nudge.Omit})),Be("<").andr(_e.factor).andl(Le(">")).to((function(e){return new Ce.Command.Twocell.Nudge.Number(e)})))})),twocellArrow:Ve((function(){return De(Be("{").andr(Me(Ae(/^([\^_=`'"!]|\\omit)/))).and(_e.twocellLabelEntry).andl(Le("}")).to((function(e){return new Ce.Command.Twocell.Arrow.WithOrientation(e.head,e.tail)})),Be("{").andr(_e.nudge).and(_e.twocellLabelEntry).andl(Le("}")).to((function(e){return new Ce.Command.Twocell.Arrow.WithPosition(e.head,e.tail)})),Be("{").andr(_e.twocellLabelEntry).andl(Le("}")).to((function(e){return new Ce.Command.Twocell.Arrow.WithOrientation("",e)})),Ge("no arrow label").andr(_e.textNodeCreator).to((function(e){return new Ce.Command.Twocell.Arrow.WithOrientation("",new Ce.Object(L.empty,_e.toMath("\\twocellstyle{}",e)))})))})),twocellLabelEntry:Ve((function(){return De(Be("*").andr(_e.object),_e.text().and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail;return new Ce.Object(L.empty,_e.toMath("\\twocellstyle "+t,n))})))})),newdir:Ve((function(){return Be("{").andr(_e.dirMain).andl(Oe("}")).andl(Le("{")).and(_e.compositeObject).andl(Le("}")).to((function(e){return new Ce.Command.Newdir(e.head,new Ce.ObjectBox.CompositeObject(e.tail))}))})),xyimport:Ve((function(){return Be("\\xyimport").andr(Le("(")).andr(_e.factor).andl(Le(",")).and(_e.factor).andl(Le(")")).and(Me(Fe(Be("(").andr(_e.factor).andl(Le(",")).and(_e.factor).andl(Le(")"))))).andl(Le("{")).and(Me(De(Be("\\includegraphics").andr(_e.includegraphics),_e.text().and(_e.textNodeCreator).to((function(e){var t=e.head,n=e.tail;return _e.toMath("\\hbox{$\\objectstyle{"+t+"}$}",n)}))))).andl(Le("}")).to((function(e){var t,n,r=e.head.head.head,i=e.head.head.tail;e.head.tail.isDefined?(t=e.head.tail.get.head,n=e.head.tail.get.tail):(t=0,n=0);var a=e.tail;return void 0!==a.isIncludegraphics?new Ce.Pos.Xyimport.Graphics(r,i,t,n,a):new Ce.Pos.Xyimport.TeXCommand(r,i,t,n,a)}))})),includegraphics:Ve((function(){return Be("[").andr(Me(Fe(_e.includegraphicsAttrList))).andl(Le("]")).andl(Le("{")).and(Me(Ae(/^[^\s{}]+/))).andl(Le("}")).to((function(e){var t=e.head.getOrElse(L.empty),n=e.tail;return new Ce.Command.Includegraphics(!1,t,n)}))})),includegraphicsAttrList:Ve((function(){return _e.includegraphicsAttr().and(Me(Te(Be(",").andr(_e.includegraphicsAttr)))).to((function(e){return e.tail.prepend(e.head)}))})),includegraphicsAttr:Ve((function(){return De(Be("width").andr(Le("=")).andr(_e.dimen).to((function(e){return new Ce.Command.Includegraphics.Attr.Width(e)})),Be("height").andr(Le("=")).andr(_e.dimen).to((function(e){return new Ce.Command.Includegraphics.Attr.Height(e)})))}))};for(var ze in Ie)_e[ze]=Ie[ze];var Qe=_e,We=function(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]},Ne=function(e){return e<0?-1:e>0?1:0},Ue=function(e){return Math.abs(e)0?(n=i*this.r/r)>this.u?new rt.Point(this.x+this.u*r/i,this.y+this.u):n<-this.d?new rt.Point(this.x-this.d*r/i,this.y-this.d):new rt.Point(this.x+this.r,this.y+n):r<0?(n=-i*this.l/r)>this.u?new rt.Point(this.x+this.u*r/i,this.y+this.u):n<-this.d?new rt.Point(this.x-this.d*r/i,this.y-this.d):new rt.Point(this.x-this.l,this.y+n):i>0?new rt.Point(this.x,this.y+this.u):new rt.Point(this.x,this.y-this.d)}},{key:"proportionalEdgePoint",value:function(e,t){if(this.isPoint())return this;var n=e-this.x,r=t-this.y;if(Math.abs(n)0?3*u/4:-5*u/4))/(u/2),new rt.Point(this.x+this.r,this.y-this.d+i*o))}},{key:"grow",value:function(e,t){return this.toRect({l:Math.max(0,this.l+e),r:Math.max(0,this.r+e),u:Math.max(0,this.u+t),d:Math.max(0,this.d+t)})}},{key:"toSize",value:function(e,t){var n,r,i,a,o=this.l+this.r,u=this.u+this.d;return 0===o?(a=e/2,i=e/2):(a=e*this.l/o,i=e*this.r/o),0===u?(n=t/2,r=t/2):(n=t*this.u/u,r=t*this.d/u),this.toRect({l:a,r:i,u:n,d:r})}},{key:"growTo",value:function(e,t){var n=this.u,r=this.d,i=this.r,a=this.l,o=a+i,u=n+r;return e>o&&(0===o?(a=e/2,i=e/2):(a=e*this.l/o,i=e*this.r/o)),t>u&&(0===u?(n=t/2,r=t/2):(n=t*this.u/u,r=t*this.d/u)),this.toRect({l:a,r:i,u:n,d:r})}},{key:"shrinkTo",value:function(e,t){var n=this.u,r=this.d,i=this.r,a=this.l,o=a+i,u=n+r;return e=this.x-this.l&&t<=this.x+this.r&&n>=this.y-this.d&&n<=this.y+this.u}},{key:"toString",value:function(){return"{x:"+this.x+", y:"+this.y+", l:"+this.l+", r:"+this.r+", u:"+this.u+", d:"+this.d+"}"}}]),n}(rt),rt.Ellipse=function(e){Je(n,e);var t=Ye(n);function n(e,r,i,a,o,u){var s;return et(this,n),(s=t.call(this)).x=e,s.y=r,s.l=i,s.r=a,s.u=o,s.d=u,s}return nt(n,[{key:"isPoint",value:function(){return 0===this.r&&0===this.l||0===this.u&&0===this.d}},{key:"isRect",value:function(){return!1}},{key:"isCircle",value:function(){return!this.isPoint()}},{key:"isPerfectCircle",value:function(){return this.l===this.r&&this.l===this.u&&this.l===this.d}},{key:"edgePoint",value:function(e,t){if(this.isPoint())return this;if(this.isPerfectCircle()){var n,r=e-this.x,i=t-this.y;return n=Math.abs(r)o&&(0===o?(a=e/2,i=e/2):(a=e*this.l/o,i=e*this.r/o)),t>u&&(0===u?(n=t/2,r=t/2):(n=t*this.u/u,r=t*this.d/u)),new rt.Ellipse(this.x,this.y,a,i,n,r)}},{key:"shrinkTo",value:function(e,t){var n=this.u,r=this.d,i=this.r,a=this.l,o=a+i,u=n+r;return en?(this.start=n,this.end=t):(this.start=t,this.end=n)}var t,n,r;return t=e,(n=[{key:"difference",value:function(t){var n=L.empty,r=this.start,i=this.end,a=t.start,o=t.end;return i<=a||o<=r?n=n.prepend(this):r "'+e+'" not defined.');return n}},{key:"toString",value:function(){var e="";for(var t in this.savedPosition)this.savedPosition.hasOwnProperty(t)&&(e.length>0&&(e+=", "),e+=t.toString()+":"+this.savedPosition[t]);return"Env\n p:"+this.p+"\n c:"+this.c+"\n angle:"+this.angle+"\n lastCurve:"+this.lastCurve+"\n savedPosition:{"+e+"}\n origin:{x:"+this.origin.x+", y:"+this.origin.y+"}\n xBase:{x:"+this.xBase.x+", y:"+this.xBase.y+"}\n yBase:{x:"+this.yBase.x+", y:"+this.yBase.y+"}\n stackFrames:"+this.stackFrames+"\n stack:"+this.stack+"\n shouldCapturePos:"+this.shouldCapturePos+"\n capturedPositions:"+this.capturedPositions}}],[{key:"copyFields",value:function(e,t){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);for(var r in t.savedPosition={},e.savedPosition)e.savedPosition.hasOwnProperty(r)&&(t.savedPosition[r]=e.savedPosition[r])}}]),e}();Bt.originPosition=new rt.Point(0,0);var Et=function(){function e(){Mt(this,e)}return Ot(e,[{key:"velocity",value:function(e){var t=this.dpx(e),n=this.dpy(e);return Math.sqrt(t*t+n*n)}},{key:"length",value:function(e){if(e<0||e>1)throw s("ExecutionError","illegal cubic Bezier parameter t:"+e);this.buildLengthArray();var t=e*c.lengthResolution,n=Math.floor(t),r=Math.ceil(t);if(n===r)return this.lengthArray[n];var i=this.lengthArray[n];return i+(this.lengthArray[r]-i)/(r-n)*(t-n)}},{key:"tOfLength",value:function(e){this.buildLengthArray();var t,n,r,i=this.lengthArray;if(ei[i.length-1])return 1;for(var a=0,o=i.length-2;a<=o&&(n=i[t=a+o>>1],r=i[t+1],!(e>=n&&e<=r));)e=0){var c,h=Math.PI/2,l=this.startPosition();this.endPosition();for(c=0;c<=u;c++){l=i+c*a;var m=this.tOfLength(l),p=this.angle(m),f=this.position(m),d=f.x,y=f.y,v=s*Math.cos(p+h),x=s*Math.sin(p+h);e.createSVGElement("circle",{cx:pe.measure.em2px(d+v),cy:-pe.measure.em2px(y+x),r:.12,fill:"currentColor"}),e.createSVGElement("circle",{cx:pe.measure.em2px(d-v),cy:-pe.measure.em2px(y-x),r:.12,fill:"currentColor"})}}}},{key:"drawParallelDashedCurve",value:function(t,n,r){var i,a,o,u,s,c,h,l,m=this.length(1),p=Math.floor((m-n)/(2*n)),f=2*p+1,d=(m-n)/2-p*n,y=new Array(p+1),v=new Array(p+1),x=new Array(p+1),g=new Array(p+1),w=new Array(p+1),S=Math.PI/2,b=r;for(i=0;i<=f;i++)a=this.tOfLength(d+i*n),y[i]=a,o=this.angle(a),s=(u=this.position(a)).x,c=u.y,h=b*Math.cos(o+S),l=b*Math.sin(o+S),v[i]=s+h,x[i]=c+l,g[i]=s-h,w[i]=c-l;e.CubicBeziers.interpolation(y,v,x).drawSkipped(t),e.CubicBeziers.interpolation(y,g,w).drawSkipped(t)}},{key:"drawSquigCurve",value:function(e,t){var n=pe.measure.length2em("0.15em"),r=this.length(1),i=4*n,a=n;if(r>=i){var o,u,s,c,h,l,m,p,f,d=Math.floor(r/i),y=(r-d*i)/2,v=Math.PI/2;switch(t){case"3":o=y,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v),l=a*Math.sin(c+v),m="M"+pe.measure.em2px(s.x+h)+","+pe.measure.em2px(-s.y-l),p="M"+pe.measure.em2px(s.x)+","+pe.measure.em2px(-s.y),f="M"+pe.measure.em2px(s.x-h)+","+pe.measure.em2px(-s.y+l);for(var x=0;x=i){var o,u,s,c,h,l,m,p,f,d=Math.floor((r-i)/2/i),y=(r-i)/2-d*i,v=Math.PI/2;switch(t){case"3":m=p=f="";for(var x=0;x<=d;x++)o=y+i*x*2,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v),l=a*Math.sin(c+v),m+=" M"+pe.measure.em2px(s.x+h)+","+pe.measure.em2px(-s.y-l),p+=" M"+pe.measure.em2px(s.x)+","+pe.measure.em2px(-s.y),f+=" M"+pe.measure.em2px(s.x-h)+","+pe.measure.em2px(-s.y+l),o=y+i*x*2+n,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v),l=a*Math.sin(c+v),m+=" Q"+pe.measure.em2px(s.x+2*h)+","+pe.measure.em2px(-s.y-2*l),p+=" Q"+pe.measure.em2px(s.x+h)+","+pe.measure.em2px(-s.y-l),f+=" Q"+pe.measure.em2px(s.x)+","+pe.measure.em2px(-s.y),o=y+i*x*2+2*n,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v),l=a*Math.sin(c+v),m+=" "+pe.measure.em2px(s.x+h)+","+pe.measure.em2px(-s.y-l),p+=" "+pe.measure.em2px(s.x)+","+pe.measure.em2px(-s.y),f+=" "+pe.measure.em2px(s.x-h)+","+pe.measure.em2px(-s.y+l),o=y+i*x*2+3*n,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v),l=a*Math.sin(c+v),m+=" Q"+pe.measure.em2px(s.x)+","+pe.measure.em2px(-s.y),p+=" Q"+pe.measure.em2px(s.x-h)+","+pe.measure.em2px(-s.y+l),f+=" "+pe.measure.em2px(s.x-2*h)+","+pe.measure.em2px(-s.y+2*l),o=y+i*(2*x+1),u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v),l=a*Math.sin(c+v),m+=" "+pe.measure.em2px(s.x+h)+","+pe.measure.em2px(-s.y-l),p+=" "+pe.measure.em2px(s.x)+","+pe.measure.em2px(-s.y),f+=" "+pe.measure.em2px(s.x-h)+","+pe.measure.em2px(-s.y+l);e.createSVGElement("path",{d:m}),e.createSVGElement("path",{d:p}),e.createSVGElement("path",{d:f});break;case"2":m=p="";for(x=0;x<=d;x++)o=y+i*x*2,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v)/2,l=a*Math.sin(c+v)/2,m+=" M"+pe.measure.em2px(s.x+h)+","+pe.measure.em2px(-s.y-l),p+=" M"+pe.measure.em2px(s.x-h)+","+pe.measure.em2px(-s.y+l),o=y+i*x*2+n,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v)/2,l=a*Math.sin(c+v)/2,m+=" Q"+pe.measure.em2px(s.x+3*h)+","+pe.measure.em2px(-s.y-3*l),p+=" Q"+pe.measure.em2px(s.x+h)+","+pe.measure.em2px(-s.y-l),o=y+i*x*2+2*n,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v)/2,l=a*Math.sin(c+v)/2,m+=" "+pe.measure.em2px(s.x+h)+","+pe.measure.em2px(-s.y-l),p+=" "+pe.measure.em2px(s.x-h)+","+pe.measure.em2px(-s.y+l),o=y+i*x*2+3*n,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v)/2,l=a*Math.sin(c+v)/2,m+=" Q"+pe.measure.em2px(s.x-h)+","+pe.measure.em2px(-s.y+l),p+=" Q"+pe.measure.em2px(s.x-3*h)+","+pe.measure.em2px(-s.y+3*l),o=y+i*(2*x+1),u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v)/2,l=a*Math.sin(c+v)/2,m+=" "+pe.measure.em2px(s.x+h)+","+pe.measure.em2px(-s.y-l),p+=" "+pe.measure.em2px(s.x-h)+","+pe.measure.em2px(-s.y+l);e.createSVGElement("path",{d:m}),e.createSVGElement("path",{d:p});break;default:m="";for(x=0;x<=d;x++)o=y+i*x*2,u=this.tOfLength(o),s=this.position(u),m+=" M"+pe.measure.em2px(s.x)+","+pe.measure.em2px(-s.y),o=y+i*x*2+n,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v),l=a*Math.sin(c+v),m+=" Q"+pe.measure.em2px(s.x+h)+","+pe.measure.em2px(-s.y-l),o=y+i*x*2+2*n,u=this.tOfLength(o),s=this.position(u),m+=" "+pe.measure.em2px(s.x)+","+pe.measure.em2px(-s.y),o=y+i*x*2+3*n,u=this.tOfLength(o),s=this.position(u),c=this.angle(u),h=a*Math.cos(c+v),l=a*Math.sin(c+v),m+=" Q"+pe.measure.em2px(s.x-h)+","+pe.measure.em2px(-s.y+l),o=y+i*(2*x+1),u=this.tOfLength(o),s=this.position(u),m+=" "+pe.measure.em2px(s.x)+","+pe.measure.em2px(-s.y);e.createSVGElement("path",{d:m})}}}},{key:"drawCurve",value:function(e,t,n,r){if(r.isEmpty)this._drawCurve(e,t,n);else{var i=new yt(0,1).differenceRanges(r),a=this;i.foreach((function(r){a.slice(r.start,r.end)._drawCurve(e,t,n)}))}}},{key:"_drawCurve",value:function(e,t,n){var r,i=pe.measure.length2em("0.15em");if(void 0!==n){var a=n.dirMain(),o=n.dirVariant();switch(a){case"=":a="-",o="2";break;case"==":a="--",o="2";break;case":":case"::":a=".",o="2"}switch(a){case"":break;case"-":switch(o){case"2":r=i/2,this.drawParallelCurve(e,r);break;case"3":r=i,this.drawParallelCurve(e,r),this.drawPrimitive(e,"none");break;default:r=0,this.drawPrimitive(e,"none")}break;case".":case"..":switch(o){case"2":r=i/2,this.drawParallelDottedCurve(e,i,r);break;case"3":r=i,this.drawParallelDottedCurve(e,i,r),this.drawPrimitive(e,pe.measure.dottedDasharray);break;default:r=0,this.drawPrimitive(e,pe.measure.dottedDasharray)}break;case"--":var u=3*i;if((x=this.length(1))>=u)switch(o){case"2":r=i/2,this.drawParallelDashedCurve(e,u,r);break;case"3":r=i,this.drawParallelDashedCurve(e,u,r);var s=(x-u)/2-Math.floor((x-u)/2/u)*u,c=this.tOfLength(s);this.divide(c)[1].drawPrimitive(e,pe.measure.em2px(u)+" "+pe.measure.em2px(u));break;default:r=0;s=(x-u)/2-Math.floor((x-u)/2/u)*u,c=this.tOfLength(s);this.divide(c)[1].drawPrimitive(e,pe.measure.em2px(u)+" "+pe.measure.em2px(u))}break;case"~":switch(this.drawSquigCurve(e,o),o){case"2":r=1.5*i;break;case"3":r=2*i;break;default:r=0}break;case"~~":switch(this.drawDashSquigCurve(e,o),o){case"2":r=1.5*i;break;case"3":r=2*i;break;default:r=0}break;default:(w=new Bt).c=Bt.originPosition;var h=new xt(ft.none,w),l=n.boundingBox(h);if(null==l)return;var m,p,f=l.l,d=f+l.r;if(void 0!==t){var y=t.boundingBox(h);void 0!==y&&(m=(p=y.l)+y.r)}else m=0;var v=d+m;0==v&&(v=pe.measure.strokeWidth);var x=this.length(1);if(0==(M=Math.floor(x/v)))return;s=(x-M*v)/2,h=new xt(ft.none,w);for(var g=0;g=c)switch(s){case"2":r=a/2;break;case"3":r=a;break;default:r=0}break;case"~":case"~~":switch(s){case"2":r=1.5*a;break;case"3":r=2*a;break;default:r=0}break;default:var h=n.boundingBox(e);if(null==h)return i.angle=0,i.lastCurve=Lt.none,ft.none;r=Math.max(h.u,h.d);var l,m=h.l+h.r;if(void 0!==t){var p=t.boundingBox(e);void 0!==p&&(l=p.l+p.r,r=Math.max(r,p.u,p.d))}else l=0;var f=m+l;0==f&&(f=pe.measure.strokeWidth);var d=this.length(1);return 0==Math.floor(d/f)?(i.angle=0,i.lastCurve=Lt.none,ft.none):(o=new ft.CurveShape(this,t,n,this.boundingBox(r)),e.appendShapeToFront(o),o)}return void 0===r?ft.none:(o=new ft.CurveShape(this,t,n,this.boundingBox(r)),e.appendShapeToFront(o),o)}if(void 0!==t){var y=t.boundingBox(e);if(null==y)return i.angle=0,i.lastCurve=Lt.none,ft.none;var v=y.l+y.r;0==v&&(v=pe.measure.strokeWidth);d=this.length(1);return 0==Math.floor(d/v)?(i.angle=0,i.lastCurve=Lt.none,ft.none):(r=Math.max(y.u,y.d),o=new ft.CurveShape(this,t,n,this.boundingBox(r)),e.appendShapeToFront(o),o)}return o}}],[{key:"sign",value:function(e){return e>0?1:0===e?0:-1}},{key:"solutionsOfCubicEq",value:function(t,n,r,i){if(0===t)return e.solutionsOfQuadEq(n,r,i);var a=n/3/t,o=r/t,u=a*a-o/3,s=-(i/t)/2+o*a/2-a*a*a,c=s*s-u*u*u;if(0===c){var h=2*(d=Math.pow(s,1/3))-a,l=-d-a;return e.filterByIn0to1([h,l])}if(c>0){var m=s+e.sign(s)*Math.sqrt(c),p=(f=e.sign(m)*Math.pow(Math.abs(m),1/3))+(d=u/f)-a;return e.filterByIn0to1([p])}var f=2*Math.sqrt(u),d=Math.acos(2*s/u/f),y=(h=f*Math.cos(d/3)-a,l=f*Math.cos((d+2*Math.PI)/3)-a,f*Math.cos((d+4*Math.PI)/3)-a);return e.filterByIn0to1([h,l,y])}},{key:"solutionsOfQuadEq",value:function(t,n,r){if(0===t)return e.solutionsOfLinearEq(n,r);var i=n*n-4*r*t;if(i>=0){var a=Math.sqrt(i),o=(-n+a)/2/t,u=(-n-a)/2/t;return e.filterByIn0to1([o,u])}return[]}},{key:"solutionsOfLinearEq",value:function(t,n){return 0===t?0===n?0:[]:e.filterByIn0to1([-n/t])}},{key:"filterByIn0to1",value:function(e){for(var t=[],n=0;n=0&&r<=1&&t.push(r)}return t}}]),e}();Et.QuadBezier=function(e){wt(n,e);var t=bt(n);function n(e,r,i){var a;Mt(this,n),(a=t.call(this)).cp0=e,a.cp1=r,a.cp2=i;var o=e.x,u=2*(r.x-e.x),s=i.x-2*r.x+e.x;a.px=function(e){return o+e*u+e*e*s},a.dpx=function(e){return u+2*e*s};var c=e.y,h=2*(r.y-e.y),l=i.y-2*r.y+e.y;return a.py=function(e){return c+e*h+e*e*l},a.dpy=function(e){return h+2*e*l},a}return Ot(n,[{key:"startPosition",value:function(){return this.cp0}},{key:"endPosition",value:function(){return this.cp2}},{key:"position",value:function(e){return new rt.Point(this.px(e),this.py(e))}},{key:"derivative",value:function(e){return new rt.Point(this.dpx(e),this.dpy(e))}},{key:"angle",value:function(e){return Math.atan2(this.dpy(e),this.dpx(e))}},{key:"boundingBox",value:function(e){var t=this.maxMin(this.cp0.x,this.cp1.x,this.cp2.x,e),n=this.maxMin(this.cp0.y,this.cp1.y,this.cp2.y,e);if(0===e)return new rt.Rect(this.cp0.x,this.cp0.y,{l:this.cp0.x-t.min,r:t.max-this.cp0.x,u:n.max-this.cp0.y,d:this.cp0.y-n.min});var r=Math.PI/2,i=this.cp0.x,a=this.cp0.y,o=this.cp2.x,u=this.cp2.y,s=this.angle(0)+r,c=this.angle(1)+r,h=e*Math.cos(s),l=e*Math.sin(s),m=e*Math.cos(c),p=e*Math.sin(c),f=Math.min(t.min,i+h,i-h,o+m,o-m),d=Math.max(t.max,i+h,i-h,o+m,o-m),y=Math.min(n.min,a+l,a-l,u+p,u-p),v=Math.max(n.max,a+l,a-l,u+p,u-p);return new rt.Rect(i,a,{l:i-f,r:d-i,u:v-a,d:a-y})}},{key:"maxMin",value:function(e,t,n,r){var i,a;e>n?(i=e,a=n):(i=n,a=e);var o,u,s=Ue,c=s(e),h=s(t-e),l=s(n-2*t+e);return 0!=l&&(u=-h/l)>0&&u<1&&(o=function(e){return c+2*e*h+e*e*l}(u),i=Math.max(i,o+r,o-r),a=Math.min(a,o+r,o-r)),{min:a,max:i}}},{key:"divide",value:function(e){if(e<0||e>1)throw s("ExecutionError","illegal quadratic Bezier parameter t:"+e);var t=this.cp0.x,n=this.cp1.x,r=this.cp2.x,i=this.cp0.y,a=this.cp1.y,o=this.cp2.y,u=this.px(e),c=this.py(e),h=this.cp0,l=new rt.Point(t+e*(n-t),i+e*(a-i)),m=new rt.Point(u,c),p=m,f=new rt.Point(n+e*(r-n),a+e*(o-a)),d=this.cp2;return[new Et.QuadBezier(h,l,m),new Et.QuadBezier(p,f,d)]}},{key:"slice",value:function(e,t){if(!(e>=t)){if(e<0&&(e=0),t>1&&(t=1),0===e&&1===t)return this;this.cp0.x;var n=this.cp1.x,r=this.cp2.x,i=(this.cp0.y,this.cp1.y),a=this.cp2.y,o=this.px(e),u=this.py(e),s=n+e*(r-n),c=i+e*(a-i),h=new rt.Point(o,u),l=new rt.Point(o+t*(s-o),u+t*(c-u)),m=new rt.Point(this.px(t),this.py(t));return new Et.QuadBezier(h,l,m)}}},{key:"tOfIntersections",value:function(e){if(e.isPoint())return[];if(e.isRect()){var t,n=e.x+e.r,r=e.x-e.l,i=e.y+e.u,a=e.y-e.d,o=Ue,u=this.cp0.x,s=this.cp1.x,c=this.cp2.x,h=o(u),l=o(2*(s-u)),m=o(c-2*s+u),p=function(e){return h+e*l+e*e*m},f=this.cp0.y,d=this.cp1.y,y=this.cp2.y,v=o(f),x=o(2*(d-f)),g=o(y-2*d+f),w=function(e){return v+e*x+e*e*g},S=[];t=(t=Et.solutionsOfQuadEq(m,l,h-n)).concat(Et.solutionsOfQuadEq(m,l,h-r));for(var b=0;b=a&&M<=i&&S.push(I)}t=(t=Et.solutionsOfQuadEq(g,x,v-i)).concat(Et.solutionsOfQuadEq(g,x,v-a));for(b=0;b=r&&k<=n&&S.push(I)}return S}if(e.isCircle()){var C=Math.PI,k=e.x,M=e.y,P=e.l,O=e.r,B=e.u,E=e.d,A=k+(O-P)/2,L=M+(B-E)/2,j=(n=(P+O)/2,(B+E)/2),D=C/180,T=new At.Arc(A,L,n,j,-C-D,-C/2+D),R=new At.Arc(A,L,n,j,-C/2-D,0+D),F=new At.Arc(A,L,n,j,0-D,C/2+D),G=new At.Arc(A,L,n,j,C/2-D,C+D),V=new At.QuadBezier(this,0,1),_=[];_=(_=(_=(_=_.concat(At.findIntersections(T,V))).concat(At.findIntersections(R,V))).concat(At.findIntersections(F,V))).concat(At.findIntersections(G,V));for(S=[],b=0;b<_.length;b++){var I=(_[b][1].min+_[b][1].max)/2;S.push(I)}return S}}},{key:"countOfSegments",value:function(){return 1}},{key:"drawPrimitive",value:function(e,t){var n=this.cp0,r=this.cp1,i=this.cp2;e.createSVGElement("path",{d:"M"+pe.measure.em2px(n.x)+","+pe.measure.em2px(-n.y)+" Q"+pe.measure.em2px(r.x)+","+pe.measure.em2px(-r.y)+" "+pe.measure.em2px(i.x)+","+pe.measure.em2px(-i.y),"stroke-dasharray":t})}},{key:"toString",value:function(){return"QuadBezier("+this.cp0.x+", "+this.cp0.y+")-("+this.cp1.x+", "+this.cp1.y+")-("+this.cp2.x+", "+this.cp2.y+")"}}]),n}(Et),Et.CubicBezier=function(e){wt(n,e);var t=bt(n);function n(e,r,i,a){var o;Mt(this,n),(o=t.call(this)).cp0=e,o.cp1=r,o.cp2=i,o.cp3=a;var u=e.x,s=3*(r.x-e.x),c=3*(i.x-2*r.x+e.x),h=a.x-3*i.x+3*r.x-e.x;o.px=function(e){return u+e*s+e*e*c+e*e*e*h},o.dpx=function(e){return s+2*e*c+3*e*e*h};var l=e.y,m=3*(r.y-e.y),p=3*(i.y-2*r.y+e.y),f=a.y-3*i.y+3*r.y-e.y;return o.py=function(e){return l+e*m+e*e*p+e*e*e*f},o.dpy=function(e){return m+2*e*p+3*e*e*f},o}return Ot(n,[{key:"startPosition",value:function(){return this.cp0}},{key:"endPosition",value:function(){return this.cp3}},{key:"position",value:function(e){return new rt.Point(this.px(e),this.py(e))}},{key:"derivative",value:function(e){return new rt.Point(this.dpx(e),this.dpy(e))}},{key:"angle",value:function(e){return Math.atan2(this.dpy(e),this.dpx(e))}},{key:"boundingBox",value:function(e){var t=this.maxMin(this.cp0.x,this.cp1.x,this.cp2.x,this.cp3.x,e),n=this.maxMin(this.cp0.y,this.cp1.y,this.cp2.y,this.cp3.y,e);if(0===e)return new rt.Rect(this.cp0.x,this.cp0.y,{l:this.cp0.x-t.min,r:t.max-this.cp0.x,u:n.max-this.cp0.y,d:this.cp0.y-n.min});var r=Math.PI/2,i=this.cp0.x,a=this.cp0.y,o=this.cp3.x,u=this.cp3.y,s=this.angle(0)+r,c=this.angle(1)+r,h=e*Math.cos(s),l=e*Math.sin(s),m=e*Math.cos(c),p=e*Math.sin(c),f=Math.min(t.min,i+h,i-h,o+m,o-m),d=Math.max(t.max,i+h,i-h,o+m,o-m),y=Math.min(n.min,a+l,a-l,u+p,u-p),v=Math.max(n.max,a+l,a-l,u+p,u-p);return new rt.Rect(i,a,{l:i-f,r:d-i,u:v-a,d:a-y})}},{key:"maxMin",value:function(e,t,n,r,i){var a,o;e>r?(a=e,o=r):(a=r,o=e);var u,s=Ue,c=s(e),h=s(t-e),l=s(n-2*t+e),m=s(r-3*n+3*t-e),p=function(e){e>0&&e<1&&(u=function(e){return c+3*e*h+3*e*e*l+e*e*e*m}(e),a=Math.max(a,u+i,u-i),o=Math.min(o,u+i,u-i))};if(0==m)0!=l&&p(-h/l/2);else{var f=l*l-h*m;f>0?(p((-l+Math.sqrt(f))/m),p((-l-Math.sqrt(f))/m)):0==f&&p(-l/m)}return{min:o,max:a}}},{key:"divide",value:function(e){if(e<0||e>1)throw s("ExecutionError","illegal cubic Bezier parameter t:"+e);var t=this.cp0.x,n=this.cp1.x,r=this.cp2.x,i=this.cp3.x,a=this.cp0.y,o=this.cp1.y,u=this.cp2.y,c=this.cp3.y,h=this.px(e),l=this.py(e),m=this.cp0,p=new rt.Point(t+e*(n-t),a+e*(o-a)),f=new rt.Point(t+2*e*(n-t)+e*e*(r-2*n+t),a+2*e*(o-a)+e*e*(u-2*o+a)),d=new rt.Point(h,l),y=d,v=new rt.Point(n+2*e*(r-n)+e*e*(i-2*r+n),o+2*e*(u-o)+e*e*(c-2*u+o)),x=new rt.Point(r+e*(i-r),u+e*(c-u)),g=this.cp3;return[new Et.CubicBezier(m,p,f,d),new Et.CubicBezier(y,v,x,g)]}},{key:"slice",value:function(e,t){if(!(e>=t)){if(e<0&&(e=0),t>1&&(t=1),0===e&&1===t)return this;this.cp0.x;var n=this.cp1.x,r=this.cp2.x,i=this.cp3.x,a=(this.cp0.y,this.cp1.y),o=this.cp2.y,u=this.cp3.y,s=this.px(e),c=this.py(e),h=n+2*e*(r-n)+e*e*(i-2*r+n),l=a+2*e*(o-a)+e*e*(u-2*o+a),m=r+e*(i-r),p=o+e*(u-o),f=new rt.Point(s,c),d=new rt.Point(s+t*(h-s),c+t*(l-c)),y=new rt.Point(s+2*t*(h-s)+t*t*(m-2*h+s),c+2*t*(l-c)+t*t*(p-2*l+c)),v=new rt.Point(this.px(t),this.py(t));return new Et.CubicBezier(f,d,y,v)}}},{key:"tOfIntersections",value:function(e){if(e.isPoint())return[];if(e.isRect()){var t,n=e.x+e.r,r=e.x-e.l,i=e.y+e.u,a=e.y-e.d,o=Ue,u=this.cp0.x,s=this.cp1.x,c=this.cp2.x,h=this.cp3.x,l=this.cp0.y,m=this.cp1.y,p=this.cp2.y,f=this.cp3.y,d=o(u),y=o(3*(s-u)),v=o(3*(c-2*s+u)),x=o(h-3*c+3*s-u),g=function(e){return d+e*y+e*e*v+e*e*e*x},w=o(l),S=o(3*(m-l)),b=o(3*(p-2*m+l)),C=o(f-3*p+3*m-l),k=function(e){return w+e*S+e*e*b+e*e*e*C},M=[];t=(t=Et.solutionsOfCubicEq(x,v,y,d-n)).concat(Et.solutionsOfCubicEq(x,v,y,d-r));for(var P=0;P=a&&E<=i&&M.push(N)}t=(t=Et.solutionsOfCubicEq(C,b,S,w-i)).concat(Et.solutionsOfCubicEq(C,b,S,w-a));for(P=0;P=r&&B<=n&&M.push(N)}return M}if(e.isCircle()){var O=Math.PI,B=e.x,E=e.y,A=e.l,L=e.r,j=e.u,D=e.d,T=B+(L-A)/2,R=E+(j-D)/2,F=(n=(A+L)/2,(j+D)/2),G=O/180,V=new At.Arc(T,R,n,F,-O-G,-O/2+G),_=new At.Arc(T,R,n,F,-O/2-G,0+G),I=new At.Arc(T,R,n,F,0-G,O/2+G),z=new At.Arc(T,R,n,F,O/2-G,O+G),Q=new At.CubicBezier(this,0,1),W=[];W=(W=(W=(W=W.concat(At.findIntersections(V,Q))).concat(At.findIntersections(_,Q))).concat(At.findIntersections(I,Q))).concat(At.findIntersections(z,Q));for(M=[],P=0;P=i&&(o=i-1);var u=a-o;return n(e[o],u)},r}return Ot(n,[{key:"startPosition",value:function(){return this.cbs[0].cp0}},{key:"endPosition",value:function(){return this.cbs[this.cbs.length-1].cp3}},{key:"position",value:function(e){return this.delegate(e,(function(e,t){return e.position(t)}),void 0)}},{key:"derivative",value:function(e){return this.delegate(e,(function(e,t){return e.derivative(t)}),void 0)}},{key:"angle",value:function(e){return this.delegate(e,(function(e,t){return e.angle(t)}),0)}},{key:"velocity",value:function(e){var t=this.cbs.length;return this.delegate(e,(function(e,n){return t*e.velocity(n)}),0)}},{key:"boundingBox",value:function(e){if(0!=this.cbs.length){var t,n=this.cbs[0].boundingBox(e),r=this.cbs.length;for(t=1;t1)throw s("ExecutionError","illegal cubic Bezier parameter t:"+e);if(0===e)return[new Et.CubicBeziers([]),this];if(1===e)return[this,new Et.CubicBeziers([])];var t=this.cbs.length,n=e*t,r=Math.floor(n);r===t&&(r=t-1);var i=n-r,a=this.cbs.slice(0,r),o=this.cbs.slice(r+1),u=this.cbs[r].divide(i);return a.push(u[0]),o.unshift(u[1]),[new Et.CubicBeziers(a),new Et.CubicBeziers(o)]}},{key:"slice",value:function(e,t){if(!(e>=t)){if(e<0&&(e=0),t>1&&(t=1),0===e&&1===t)return this;var n=this.cbs.length,r=e*n,i=t*n,a=Math.floor(r),o=Math.floor(i);a===n&&(a=n-1),o===n&&(o=n-1);var u,s=r-a,c=i-o;return a===o?u=[this.cbs[a].slice(s,c)]:((u=this.cbs.slice(a+1,o)).push(this.cbs[o].slice(0,c)),u.unshift(this.cbs[a].slice(s,1))),new Et.CubicBeziers(u)}}},{key:"countOfSegments",value:function(){return this.cbs.length}},{key:"drawPrimitive",value:function(e,t){for(var n=this.cbs.length,r=this.cbs,i=r[0],a=i.cp0,o=i.cp1,u=i.cp2,s=i.cp3,c="M"+pe.measure.em2px(a.x)+","+pe.measure.em2px(-a.y)+" C"+pe.measure.em2px(o.x)+","+pe.measure.em2px(-o.y)+" "+pe.measure.em2px(u.x)+","+pe.measure.em2px(-u.y)+" "+pe.measure.em2px(s.x)+","+pe.measure.em2px(-s.y),h=1;h=0;n--){var l=i[n],m=h[n+1],p=l*l*s[n]-u[n]*m;h[n]=p,c[n]=t[n+1]-t[n]-(m+2*p)/3}var f=new Array(r),d=new Array(r);for(n=0;nu?i[u]:i[e]},h=function(e){var t=Math.abs(e);return t<=1?(3*t*t*t-6*t*t+4)/6:t<=2?-(t-2)*(t-2)*(t-2)/6:0};this.px=function(e){for(var t=(u+2)*e-1,n=Math.ceil(t-2),r=Math.floor(t+2),i=0,a=n;a<=r;a++)i+=h(t-a)*c(a).x;return i},this.py=function(e){for(var t=(u+2)*e-1,n=Math.ceil(t-2),r=Math.floor(t+2),i=0,a=n;a<=r;a++)i+=h(t-a)*c(a).y;return i};var l=function(e){var t=e>0?1:e<0?-1:0,n=Math.abs(e);return n<=1?t*(3*n*n-4*n)/2:n<=2?-t*(n-2)*(n-2)/2:0};this.dpx=function(e){for(var t=(u+2)*e-1,n=Math.ceil(t-2),r=Math.floor(t+2),i=0,a=n;a<=r;a++)i+=l(t-a)*c(a).x;return i},this.dpy=function(e){for(var t=(u+2)*e-1,n=Math.ceil(t-2),r=Math.floor(t+2),i=0,a=n;a<=r;a++)i+=l(t-a)*c(a).y;return i}}return Ot(e,[{key:"position",value:function(e){return new rt.Point(this.px(e),this.py(e))}},{key:"angle",value:function(e){return Math.atan2(this.dpy(e),this.dpx(e))}},{key:"toCubicBeziers",value:function(){var e=[],t=this.cps,n=t[0],r=t[1],i=t[2],a=n.x,o=n.y,u=a+(r.x-a)/3,s=o+(r.y-o)/3,c=a+2*(r.x-a)/3,h=o+2*(r.y-o)/3,l=r.x+(i.x-r.x)/3,m=r.y+(i.y-r.y)/3,p=(c+l)/2,f=(h+m)/2,d=n,y=new rt.Point(u,s),v=new rt.Point(c,h),x=new rt.Point(p,f),g=new Et.CubicBezier(d,y,v,x);e.push(g);for(var w=this.cps.length-1,S=2;S=t)){if(e<0&&(e=0),t>1&&(t=1),0===e&&1===t)return this;var n=this.s,r=this.e,i=r.x-n.x,a=r.y-n.y,o=new rt.Point(n.x+e*i,n.y+e*a),u=new rt.Point(n.x+t*i,n.y+t*a);return new Et.Line(o,u)}}},{key:"tOfIntersections",value:function(e){if(e.isPoint())return[];var t=this.s,n=this.e;if(e.isRect()){var r,i=e.x+e.r,a=e.x-e.l,o=e.y+e.u,u=e.y-e.d,s=t.x,c=t.y,h=n.x-s,l=n.y-c,m=function(e){return s+e*h},p=function(e){return c+e*l},f=[];r=(r=Et.solutionsOfLinearEq(h,s-i)).concat(Et.solutionsOfLinearEq(h,s-a));for(var d=0;d=u&&y<=o&&f.push(v)}r=(r=Et.solutionsOfLinearEq(l,c-o)).concat(Et.solutionsOfLinearEq(l,c-u));for(d=0;d=a&&x<=i&&f.push(v)}return f}if(e.isCircle()){Math.PI;var g=e.l,w=e.r,S=e.u,b=e.d,C=e.x+(w-g)/2,k=e.y+(S-b)/2,M=(i=(g+w)/2,(S+b)/2),P=t.x,O=t.y,B=n.x-P,E=-B,A=(u=n.y-O)*i,L=E*M,j=A*A+L*L,D=(n=-(b=A*C+L*k+((B*O-u*P)*i+(i-M)*E*k))/j,j*i*i-b*b);if(D<0)return[];var T,R,F=Math.sqrt(D)/j,G=M/i,V=A*n+L*F+C,_=G*(L*n-A*F+k-k)+k,I=A*n-L*F+C,z=G*(L*n+A*F+k-k)+k;Math.abs(B)>Math.abs(u)?(T=(V-P)/B,R=(I-P)/B):(T=(_-O)/u,R=(z-O)/u);f=[];return T>=0&&T<=1&&f.push(T),R>=0&&R<=1&&f.push(R),f}}},{key:"toShape",value:function(e,t,n,r){var i=e.env,a=pe.measure.thickness,o=this.s,u=this.e;if(o.x!==u.x||o.y!==u.y){var s,c=u.x-o.x,h=u.y-o.y,l=Math.atan2(h,c),m=ft.none;switch(n){case"=":n="-",r="2";break;case"==":n="--",r="2";break;case":":case"::":n=".",r="2"}switch(n){case"":return i.angle=l,i.lastCurve=new Lt.Line(o,u,i.p,i.c,void 0),m;case"-":case".":case"..":switch(r){case"2":s=a/2;break;case"3":s=a;break;default:s=0}break;case"--":var p=3*a;if((y=Math.sqrt(c*c+h*h))>=p)switch(r){case"2":s=a/2;break;case"3":s=a;break;default:s=0}break;case"~":case"~~":switch(r){case"2":s=1.5*a;break;case"3":s=2*a;break;default:s=0}break;default:var f=t.boundingBox(e);if(null==f)return i.angle=0,i.lastCurve=Lt.none,ft.none;var d=f.l+f.r;0==d&&(d=pe.measure.strokeWidth);var y=Math.sqrt(c*c+h*h);if(0==Math.floor(y/d))return i.angle=0,i.lastCurve=Lt.none,ft.none;s=Math.max(f.u,f.d)}if(void 0!==s){var v=this.boundingBox(s);return m=new ft.LineShape(this,t,n,r,v),e.appendShapeToFront(m),i.angle=l,i.lastCurve=new Lt.Line(o,u,i.p,i.c,m),m}}return i.angle=0,i.lastCurve=Lt.none,ft.none}},{key:"boundingBox",value:function(e){var t=this.s,n=this.e,r=n.x-t.x,i=n.y-t.y,a=Math.atan2(i,r),o=e*Math.cos(a+Math.PI/2),u=e*Math.sin(a+Math.PI/2);return new rt.Rect(t.x,t.y,{l:t.x-Math.min(t.x+o,t.x-o,n.x+o,n.x-o),r:Math.max(t.x+o,t.x-o,n.x+o,n.x-o)-t.x,u:Math.max(t.y+u,t.y-u,n.y+u,n.y-u)-t.y,d:t.y-Math.min(t.y+u,t.y-u,n.y+u,n.y-u)})}},{key:"drawLine",value:function(e,t,n,r,i){if(i.isEmpty)this._drawLine(e,t,n,r);else{var a=new yt(0,1).differenceRanges(i),o=this;a.foreach((function(i){o.slice(i.start,i.end)._drawLine(e,t,n,r)}))}}},{key:"_drawLine",value:function(e,t,n,r){var i=pe.measure.thickness,a=this.s,o=this.e;if(a.x!==o.x||a.y!==o.y){var u=o.x-a.x,s=o.y-a.y,c=Math.atan2(s,u),h={x:0,y:0};switch(n){case"":break;case"-":this.drawStraightLine(e,a,o,h,c,i,r,"");break;case"=":this.drawStraightLine(e,a,o,h,c,i,"2","");break;case".":case"..":this.drawStraightLine(e,a,o,h,c,i,r,pe.measure.dottedDasharray);break;case":":case"::":this.drawStraightLine(e,a,o,h,c,i,"2",pe.measure.dottedDasharray);break;case"--":case"==":var l=3*i;if((P=Math.sqrt(u*u+s*s))>=l)h={x:(O=(P-l)/2-Math.floor((P-l)/2/l)*l)*Math.cos(c),y:O*Math.sin(c)},this.drawStraightLine(e,a,o,h,c,i,"=="===n?"2":r,pe.measure.em2px(l)+" "+pe.measure.em2px(l));break;case"~":if((P=Math.sqrt(u*u+s*s))>=(w=4*i)){h={x:(O=(P-(M=Math.floor(P/w))*w)/2)*Math.cos(c),y:O*Math.sin(c)};for(var m=i*Math.cos(c+Math.PI/2),p=i*Math.sin(c+Math.PI/2),f=i*Math.cos(c),d=i*Math.sin(c),y=a.x+h.x,v=-a.y-h.y,x="M"+pe.measure.em2px(y)+","+pe.measure.em2px(v)+" Q"+pe.measure.em2px(y+f+m)+","+pe.measure.em2px(v-d-p)+" "+pe.measure.em2px(y+2*f)+","+pe.measure.em2px(v-2*d)+" T"+pe.measure.em2px(y+4*f)+","+pe.measure.em2px(v-4*d),g=1;g=(w=4*i)){h={x:(O=(P-w)/2-(M=Math.floor((P-w)/2/w))*w)*Math.cos(c),y:O*Math.sin(c)};for(m=i*Math.cos(c+Math.PI/2),p=i*Math.sin(c+Math.PI/2),f=i*Math.cos(c),d=i*Math.sin(c),y=a.x+h.x,v=-a.y-h.y,x="",g=0;g<=M;g++)x+=" M"+pe.measure.em2px(y+8*g*f)+","+pe.measure.em2px(v-8*g*d)+" Q"+pe.measure.em2px(y+(8*g+1)*f+m)+","+pe.measure.em2px(v-(8*g+1)*d-p)+" "+pe.measure.em2px(y+(8*g+2)*f)+","+pe.measure.em2px(v-(8*g+2)*d)+" T"+pe.measure.em2px(y+(8*g+4)*f)+","+pe.measure.em2px(v-(8*g+4)*d);this.drawSquigglyLineShape(e,x,a,o,m,p,r)}break;default:var S=new Bt;S.c=Bt.originPosition;var b=new xt(ft.none,S),C=t.boundingBox(b);if(null==C)return;var k=C.l+C.r;0==k&&(k=pe.measure.strokeWidth);var M,P=Math.sqrt(u*u+s*s);if(0==(M=Math.floor(P/k)))return;var O=(P-M*k)/2,B=Math.cos(c),E=Math.sin(c),A=k*B,L=k*E,j=a.x+(O+C.l)*B,D=a.y+(O+C.l)*E;for(b=new xt(ft.none,S),g=0;gc?c=l:l0&&r<1&&(void 0===i||r=0&&(m=!1)}if(m)return}else i=0;if(c[s][1]<0)for(l=0;l0&&r<1&&(void 0===a||r>a)&&(a=r)}else a=1;for(l=0;l<=s;l++)c[l]=[l/s,n[0]*e[l].x+n[1]*e[l].y+n[2],1];if(c[0][1]<0){var p=!0;for(l=1;l<=s;l++){var f;(r=-(f=h(c[0],c[l]))[2]/f[0])>0&&r<1&&(void 0===o||r=0&&(p=!1)}if(p)return}else o=0;if(c[s][1]<0)for(l=0;l0&&r<1&&(void 0===u||r>u)&&(u=r)}else u=1;var y=Math.max(i,o),v=Math.min(a,u);return{min:this.tmin+y*(this.tmax-this.tmin),max:this.tmin+v*(this.tmax-this.tmin)}}}],[{key:"findIntersections",value:function(t,n){for(var r=e.maxIterations,i=e.goalAccuracy,a=[[t,n,!1]],o=0,u=[];o0;){o++;var s=a.shift(),c=(t=s[0],n=s[1],s[2]),h=t.fatLine(),l=n.clippedRange(h.min,h.max);if(null!=l){var m=l.min,p=l.max,f=p-m;if(ft.paramLength()){var d=(p+m)/2;a.push([n.clip(m,d),t,!c]),a.push([n.clip(d,p),t,!c])}else{var y=n.clip(m,p),v=t.paramRange(),x=(v.min+v.max)/2;a.push([y,t.clip(v.min,x),!c]),a.push([y,t.clip(x,v.max),!c])}}}return u}},{key:"maxIterations",get:function(){return 30}},{key:"goalAccuracy",get:function(){return 1e-4}}]),e}();At.Line=function(e){wt(n,e);var t=bt(n);function n(e,r,i,a){var o;return Mt(this,n),(o=t.call(this)).p0=e,o.p1=r,o.tmin=i,o.tmax=a,o}return Ot(n,[{key:"paramRange",value:function(){return{min:this.tmin,max:this.tmax}}},{key:"paramLength",value:function(){return this.tmax-this.tmin}},{key:"containsParam",value:function(e){return e>=this.tmin&&e<=this.tmax}},{key:"position",value:function(e){return{x:this.p0.x+e*(this.p1.x-this.p0.x),y:this.p0.y+e*(this.p1.y-this.p0.y)}}},{key:"fatLine",value:function(){var e=this.p1.y-this.p0.y,t=this.p0.x-this.p1.x,n=this.p1.x*this.p0.y-this.p0.x*this.p1.y,r=Math.sqrt(e*e+t*t);return 0===r?(e=1,t=0):(e/=r,t/=r,n/=r),{min:[e,t,n],max:[e,t,n]}}},{key:"clip",value:function(e,t){return new At.Line(this.p0,this.p1,e,t)}},{key:"clippedRange",value:function(e,t){var n=new Array(2);return n[0]=this.position(this.tmin),n[1]=this.position(this.tmax),this.clippedLineRange(n,e,t)}},{key:"drawFatLine",value:function(){this.fatLine().min;var e=function(e,t){return-(e*t[0]+t[2])/t[1]},t=this.p0.x,n=this.p1.x;pe.svgForDebug.createSVGElement("line",{x1:pe.measure.em2px(t),y1:-pe.measure.em2px(e(t,lmax)),x2:pe.measure.em2px(n),y2:-pe.measure.em2px(e(n,lmax)),"stroke-width":pe.measure.em2px(.02*pe.measure.oneem),stroke:"red"})}}]),n}(At),At.QuadBezier=function(e){wt(n,e);var t=bt(n);function n(e,r,i){var a;return Mt(this,n),(a=t.call(this)).bezier=e,a.tmin=r,a.tmax=i,a.cp0=e.position(r),a.cp1=new rt.Point((1-i)*(1-r)*e.cp0.x+(r+i-2*r*i)*e.cp1.x+r*i*e.cp2.x,(1-i)*(1-r)*e.cp0.y+(r+i-2*r*i)*e.cp1.y+r*i*e.cp2.y),a.cp2=e.position(i),a.cps=[a.cp0,a.cp1,a.cp2],a}return Ot(n,[{key:"paramRange",value:function(){return{min:this.tmin,max:this.tmax}}},{key:"paramLength",value:function(){return this.tmax-this.tmin}},{key:"fatLine",value:function(){return this.bezierFatLine(2)}},{key:"clip",value:function(e,t){return new At.QuadBezier(this.bezier,e,t)}},{key:"clippedRange",value:function(e,t){return this.clippedLineRange(this.cps,e,t)}},{key:"drawFatLine",value:function(){var e=this.fatLine(),t=e.min,n=e.max,r=function(e,t){return-(e*t[0]+t[2])/t[1]},i=this.cp0.x,a=this.cp2.x;pe.svgForDebug.createSVGElement("line",{x1:pe.measure.em2px(i),y1:-pe.measure.em2px(r(i,t)),x2:pe.measure.em2px(a),y2:-pe.measure.em2px(r(a,t)),"stroke-width":pe.measure.em2px(.02*pe.measure.oneem),stroke:"blue"}),pe.svgForDebug.createSVGElement("line",{x1:pe.measure.em2px(i),y1:-pe.measure.em2px(r(i,n)),x2:pe.measure.em2px(a),y2:-pe.measure.em2px(r(a,n)),"stroke-width":pe.measure.em2px(.02*pe.measure.oneem),stroke:"red"})}}]),n}(At),At.CubicBezier=function(e){wt(n,e);var t=bt(n);function n(e,r,i){var a;return Mt(this,n),(a=t.call(this)).bezier=e,a.tmin=r,a.tmax=i,a.cp0=e.position(r),a.cp1=new rt.Point((1-i)*(1-r)*(1-r)*e.cp0.x+(1-r)*(2*r+i-3*r*i)*e.cp1.x+r*(2*i+r-3*r*i)*e.cp2.x+r*r*i*e.cp3.x,(1-i)*(1-r)*(1-r)*e.cp0.y+(1-r)*(2*r+i-3*r*i)*e.cp1.y+r*(2*i+r-3*r*i)*e.cp2.y+r*r*i*e.cp3.y),a.cp2=new rt.Point((1-r)*(1-i)*(1-i)*e.cp0.x+(1-i)*(2*i+r-3*r*i)*e.cp1.x+i*(2*r+i-3*r*i)*e.cp2.x+r*i*i*e.cp3.x,(1-r)*(1-i)*(1-i)*e.cp0.y+(1-i)*(2*i+r-3*r*i)*e.cp1.y+i*(2*r+i-3*r*i)*e.cp2.y+r*i*i*e.cp3.y),a.cp3=e.position(i),a.cps=[a.cp0,a.cp1,a.cp2,a.cp3],a}return Ot(n,[{key:"paramRange",value:function(){return{min:this.tmin,max:this.tmax}}},{key:"paramLength",value:function(){return this.tmax-this.tmin}},{key:"fatLine",value:function(){return this.bezierFatLine(3)}},{key:"clip",value:function(e,t){return new At.CubicBezier(this.bezier,e,t)}},{key:"clippedRange",value:function(e,t){return this.clippedLineRange(this.cps,e,t)}},{key:"drawFatLine",value:function(){var e=this.fatLine(),t=e.min,n=e.max,r=function(e,t){return-(e*t[0]+t[2])/t[1]},i=this.cp0.x,a=this.cp3.x;pe.svgForDebug.createSVGElement("line",{x1:pe.measure.em2px(i),y1:-pe.measure.em2px(r(i,t)),x2:pe.measure.em2px(a),y2:-pe.measure.em2px(r(a,t)),"stroke-width":pe.measure.em2px(.02*pe.measure.oneem),stroke:"blue"}),pe.svgForDebug.createSVGElement("line",{x1:pe.measure.em2px(i),y1:-pe.measure.em2px(r(i,n)),x2:pe.measure.em2px(a),y2:-pe.measure.em2px(r(a,n)),"stroke-width":pe.measure.em2px(.02*pe.measure.oneem),stroke:"red"})}}]),n}(At),At.Arc=function(e){wt(n,e);var t=bt(n);function n(e,r,i,a,o,u){var s;return Mt(this,n),(s=t.call(this)).x=e,s.y=r,s.rx=i,s.ry=a,s.angleMin=o,s.angleMax=u,s}return Ot(n,[{key:"paramRange",value:function(){return{min:this.angleMin,max:this.angleMax}}},{key:"paramLength",value:function(){return this.angleMax-this.angleMin}},{key:"normalizeAngle",value:function(e){return(e=e%2*Math.PI)>Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e}},{key:"containsParam",value:function(e){return e>=this.angleMin&&e<=this.angleMax}},{key:"fatLine",value:function(){var e=this.rx,t=this.ry,n=(this.angleMax+this.angleMin)/2,r=(this.angleMax-this.angleMin)/2,i=Math.cos(n),a=Math.sin(n),o=Math.sqrt(e*e*a*a+t*t*i*i);if(o=0){var p=o[0]*l-o[1]*Math.sqrt(s*s-l*l),f=o[1]*l+o[0]*Math.sqrt(s*s-l*l),d=o[0]*l+o[1]*Math.sqrt(s*s-l*l),y=o[1]*l-o[0]*Math.sqrt(s*s-l*l),v=Math.atan2(f,p),x=Math.atan2(y,d);this.containsParam(v)&&m.push(v),this.containsParam(x)&&m.push(x)}var g,w,S=-(o[0]*(n+s*Math.cos(c))+o[1]*(r+s*Math.sin(c))+o[2]),b=-(o[0]*(n+s*Math.cos(h))+o[1]*(r+s*Math.sin(h))+o[2]);if(S<0){if(0==m.length)return;g=Math.min.apply(Math,m)}else g=this.angleMin;if(b<0){if(0==m.length)return;w=Math.max.apply(Math,m)}else w=this.angleMax;m=[];if(s*s-(l=u[0]*n+u[1]*r+u[2])*l>=0){p=-o[0]*l+o[1]*Math.sqrt(s*s-l*l),f=-o[1]*l-o[0]*Math.sqrt(s*s-l*l),d=-o[0]*l-o[1]*Math.sqrt(s*s-l*l),y=-o[1]*l+o[0]*Math.sqrt(s*s-l*l),v=Math.atan2(f,p),x=Math.atan2(y,d);this.containsParam(v)&&m.push(v),this.containsParam(x)&&m.push(x)}var C,k;S=u[0]*(n+s*Math.cos(c))+u[1]*(r+s*Math.sin(c))+u[2],b=u[0]*(n+s*Math.cos(h))+u[1]*(r+s*Math.sin(h))+u[2];if(S<0){if(0==m.length)return;C=Math.min.apply(Math,m)}else C=this.angleMin;if(b<0){if(0==m.length)return;k=Math.max.apply(Math,m)}else k=this.angleMax;return{min:Math.max(g,C),max:Math.min(w,k)}}},{key:"drawFatLine",value:function(){var e=this.fatLine(),t=e.min,n=e.max,r=function(e,t){return-(e*t[0]+t[2])/t[1]},i=this.x+this.r*Math.cos(this.angleMin),a=this.x+this.r*Math.cos(this.angleMax);pe.svgForDebug.createSVGElement("line",{x1:pe.measure.em2px(i),y1:-pe.measure.em2px(r(i,t)),x2:pe.measure.em2px(a),y2:-pe.measure.em2px(r(a,t)),"stroke-width":pe.measure.em2px(.02*pe.measure.oneem),stroke:"blue"}),pe.svgForDebug.createSVGElement("line",{x1:pe.measure.em2px(i),y1:-pe.measure.em2px(r(i,n)),x2:pe.measure.em2px(a),y2:-pe.measure.em2px(r(a,n)),"stroke-width":pe.measure.em2px(.02*pe.measure.oneem),stroke:"red"})}}]),n}(At);var Lt=function e(){Mt(this,e)};function jt(e,t){for(var n=0;n.5?(o=a.x-(1-n)*s+r*s/h,u=a.y-(1-n)*c+r*c/h):(o=i.x+n*s+r*s/h,u=i.y+n*c+r*c/h);var l=this.c.x-this.p.x,m=this.c.y-this.p.y;return 0===l&&0===m?0:Math.abs(l)>Math.abs(m)?(o-this.p.x)/l:(u-this.p.y)/m}},{key:"sliceHole",value:function(e,t){if(void 0!==this.lineShape&&!e.isPoint()){var n=this.lineShape,r=n.line,i=r.tOfIntersections(e);i.push(0),i.push(1),i.sort();for(var a=i[0],o=1;o0&&a.sliceHole(new yt(0,r)),i<1&&a.sliceHole(new yt(i,1))),o}return Ot(n,[{key:"isDefined",get:function(){return!0}},{key:"position",value:function(e){return this.origBezier.position(e)}},{key:"derivative",value:function(e){return this.origBezier.derivative(e)}},{key:"angle",value:function(e){return this.origBezier.angle(e)}},{key:"tOfPlace",value:function(e,t,n,r){var i,a;e?(i=this.tOfShavedStart,a=t?this.tOfShavedEnd-this.tOfShavedStart:1-this.tOfShavedStart):(i=0,a=t?this.tOfShavedEnd:1);var o=this.origBezier,u=i+a*n;if(0!==r){var s=o.length(u);u=o.tOfLength(s+r)}return u}},{key:"sliceHole",value:function(e,t){var n=this.curveShape;if(void 0!==n&&!e.isPoint()){var r=n.curve,i=r.tOfIntersections(e);i.push(0),i.push(1),i.sort();for(var a=i[0],o=1;o0&&a.sliceHole(new yt(0,r)),i<1&&a.sliceHole(new yt(i,1))),o}return Ot(n,[{key:"originalLine",value:function(){return this.originalLine}},{key:"isDefined",get:function(){return!0}},{key:"position",value:function(e){return this.origBezier.position(e)}},{key:"derivative",value:function(e){return this.origBezier.derivative(e)}},{key:"angle",value:function(e){return this.origBezier.angle(e)}},{key:"tOfPlace",value:function(e,t,n,r){var i,a;e?(i=this.tOfShavedStart,a=t?this.tOfShavedEnd-this.tOfShavedStart:1-this.tOfShavedStart):(i=0,a=t?this.tOfShavedEnd:1);var o=this.origBezier,u=i+a*n;if(0!==r){var s=o.length(u);u=o.tOfLength(s+r)}return u}},{key:"sliceHole",value:function(e,t){var n=this.curveShape;if(void 0!==n&&!e.isPoint()){var r=n.curve,i=r.tOfIntersections(e);i.push(0),i.push(1),i.sort();for(var a=i[0],o=1;o0&&u.sliceHole(new yt(0,a)),o<1&&u.sliceHole(new yt(o,1))),s}return Ot(n,[{key:"isDefined",get:function(){return!0}},{key:"position",value:function(e){return this.origBeziers.position(e)}},{key:"derivative",value:function(e){return this.origBeziers.derivative(e)}},{key:"angle",value:function(e){return this.origBeziers.angle(e)}},{key:"tOfPlace",value:function(e,t,n,r){var i,a;e?(i=this.tOfShavedStart,a=t?this.tOfShavedEnd-this.tOfShavedStart:1-this.tOfShavedStart):(i=0,a=t?this.tOfShavedEnd:1);var o=this.origBeziers,u=i+a*n;if(0!==r){var s=o.length(u);u=o.tOfLength(s+r)}return u}},{key:"sliceHole",value:function(e,t){var n=this.curveShape;if(void 0!==n&&!e.isPoint()){var r=n.curve,i=r.tOfIntersections(e);i.push(0),i.push(1),i.sort();for(var a=i[0],o=1;o0,a=r.shaveC>0,o=i?r.shaveP-1:0,u=a?r.shaveC-1:0;if(i&&(n=0),a&&(n=1),i==a&&(n=.5),void 0!==r.factor)if(r.factor.isIntercept){if(a=i=!1,void 0===(n=r.factor.value(e)))return}else n=r.factor.value(e);var s=pe.measure.length2em(r.slide.dimen.getOrElse("0"))+(o-u)*pe.measure.jot,c=t.lastCurve.tOfPlace(i,a,n,s),h=t.lastCurve.position(c),l=t.lastCurve.angle(c);return t.c=h,t.angle=l,c}}}),_t(Ce.Pos.PushCoord,{toShape:function(e){var t=e.env,n=this.coord.position(e);t.pushPos(n)}}),_t(Ce.Pos.EvalCoordThenPop,{toShape:function(e){var t=e.env;t.c=this.coord.position(e),t.popPos()}}),_t(Ce.Pos.LoadStack,{toShape:function(e){var t=e.env;t.startCapturePositions(),this.coord.position(e);var n=t.endCapturePositions();t.setStack(n),t.pushPos(t.c)}}),_t(Ce.Pos.DoCoord,{toShape:function(e){var t=e.env,n=this.coord;t.stack.reverse().foreach((function(r){t.c=r,n.position(e)}))}}),_t(Ce.Pos.InitStack,{toShape:function(e){e.env.initStack()}}),_t(Ce.Pos.EnterFrame,{toShape:function(e){e.env.enterStackFrame()}}),_t(Ce.Pos.LeaveFrame,{toShape:function(e){e.env.leaveStackFrame()}}),_t(Ce.Place.Factor,{value:function(e){return this.factor}}),_t(Ce.Place.Intercept,{value:function(e){var t=e.env;if(t.lastCurve.isDefined){var n=t.duplicate();n.angle=0,n.lastCurve=Lt.none,n.p=n.c=Bt.originPosition;var r=new xt(ft.none,n);this.pos.toShape(r);e.appendShapeToFront(r.shape),n.lastCurve.isDefined||(n.lastCurve=new Lt.Line(n.p,n.c,n.p,n.c,void 0));for(var i=[],a=t.lastCurve.segments(),o=n.lastCurve.segments(),u=0;u0){d=U,x=X,g=H,w=v(f=N),S=v(d),b=c.derivative(x),C=h.derivative(g),k=b.x*w,M=-C.x*S,B=k*k+(P=b.y*w)*P,E=k*M+P*(O=-C.y*S),A=M*k+O*P,L=M*M+O*O,F=k*(T=Z)+P*(R=Y),G=M*T+O*R,V=Math.sqrt(F*F+G*G)0))}return y(f)}var ee=(i[0][0].min+i[0][0].max)/2;for(u=1;ute&&(ee=te)}return ee}}}),_t(Ce.Pos.SavePos,{toShape:function(e){var t=e.env;t.savePos(this.id,new Rt.Position(t.c))}}),_t(Ce.Pos.SaveMacro,{toShape:function(e){e.env.savePos(this.id,new Rt.Macro(this.macro))}}),_t(Ce.Pos.SaveBase,{toShape:function(e){var t=e.env;t.savePos(this.id,new Rt.Base(t.origin,t.xBase,t.yBase))}}),_t(Ce.Pos.SaveStack,{toShape:function(e){var t=e.env;t.savePos(this.id,new Rt.Stack(t.stack))}}),_t(Ce.Object,{toDropShape:function(e){var t=e.env;if(void 0===t.c)return ft.none;var n=this.modifiers;if(n.isEmpty)return this.object.toDropShape(e);var r=t.duplicate(),i=new xt(ft.none,r),a=L.empty;n.foreach((function(e){e.preprocess(i,a),a=a.prepend(e)}));var o=this.object.toDropShape(i),u=r.c;if(void 0===u)return ft.none;var s=r.originalReferencePoint;return(r=t.duplicate()).c=u,r.originalReferencePoint=s,i=new xt(ft.none,r),o=n.head.modifyShape(i,o,n.tail),e.appendShapeToFront(o),t.c=r.c.move(t.c.x,t.c.y),o},toConnectShape:function(e){var t=e.env;if(void 0===t.c)return ft.none;var n=this.modifiers;if(n.isEmpty)return this.object.toConnectShape(e);var r=t.duplicate(),i=new xt(ft.none,r),a=L.empty;n.foreach((function(e){e.preprocess(i,a),a=a.prepend(e)}));var o=this.object.toConnectShape(i);t.angle=r.angle,t.lastCurve=r.lastCurve;var u=r.c;if(void 0===u)return ft.none;var s=r.originalReferencePoint;return(r=t.duplicate()).c=u,r.originalReferencePoint=s,i=new xt(ft.none,r),o=n.head.modifyShape(i,o,n.tail),e.appendShapeToFront(o),t.c=r.c.move(t.c.x,t.c.y),o},boundingBox:function(e){var t=e.duplicateEnv(),n=t.env;return n.angle=0,n.p=n.c=Bt.originPosition,t.shape=ft.none,this.toDropShape(t).getBoundingBox()}}),_t(Ce.ObjectBox,{toConnectShape:function(e){var t=(n=e.env).c,n=e.env,r=(pe.measure.thickness,n.p.edgePoint(n.c.x,n.c.y)),i=n.c.edgePoint(n.p.x,n.p.y);if(r.x!==i.x||r.y!==i.y){var a=new Et.Line(r,i).toShape(e,this,"196883","");return n.originalReferencePoint=t,a}return n.angle=0,n.lastCurve=Lt.none,n.originalReferencePoint=t,ft.none},boundingBox:function(e){var t=e.duplicateEnv(),n=t.env;return n.angle=0,n.p=n.c=Bt.originPosition,t.shape=ft.none,this.toDropShape(t).getBoundingBox()}}),_t(Ce.ObjectBox.WrapUpObject,{toDropShape:function(e){var t=e.env,n=this.object.toDropShape(e);return t.originalReferencePoint=t.c,n},toConnectShape:function(e){var t=e.env,n=this.object.toConnectShape(e);return t.originalReferencePoint=t.c,n}}),_t(Ce.ObjectBox.CompositeObject,{toDropShape:function(e){var t=e.env,n=t.c;if(void 0===n)return ft.none;var r=n,i=t.duplicate(),a=new xt(ft.none,i);this.objects.foreach((function(e){i.c=n;var t=e.toDropShape(a);r=rt.combineRect(r,i.c),r=rt.combineRect(r,t.getBoundingBox().toPoint())})),t.c=r;var o=a.shape;return e.appendShapeToFront(o),t.originalReferencePoint=n,o}}),_t(Ce.ObjectBox.Xybox,{toDropShape:function(e){var t=e.env,n=t.c;if(void 0===n)return ft.none;var r=new Bt,i=new xt(ft.none,r);this.posDecor.toShape(i);var a=i.shape,o=a.getBoundingBox();if(void 0===o)return ft.none;var u=Math.max(0,o.l-o.x),s=Math.max(0,o.r+o.x),c=Math.max(0,o.u+o.y),h=Math.max(0,o.d-o.y);t.c=new rt.Rect(n.x,n.y,{l:u,r:s,u:c,d:h}),t.originalReferencePoint=n;var l=new ft.TranslateShape(n.x,n.y,a);return e.appendShapeToFront(l),l}}),_t(Ce.ObjectBox.Xymatrix,{toDropShape:function(e){var t=e.env,n=t.c,r=this.xymatrix.toShape(e);return t.originalReferencePoint=n,r}}),_t(Ce.ObjectBox.Text,{toDropShape:function(e){var t=e.env,n=new ft.TextShape(t.c,this.math);return e.appendShapeToFront(n),t.c=n.getBoundingBox(),t.originalReferencePoint=n.getOriginalReferencePoint(),n}}),_t(Ce.ObjectBox.Empty,{toDropShape:function(e){var t=e.env;return t.originalReferencePoint=t.c,t.c=new rt.Point(t.c.x,t.c.y),ft.none}}),_t(Ce.ObjectBox.Txt,{toDropShape:function(e){var t=e.env;if(void 0===t.c)return ft.none;var n=this.textObject.toDropShape(e);return t.originalReferencePoint=t.c,n}}),_t(Ce.ObjectBox.Txt.Width.Vector,{width:function(e){return this.vector.xy().x}}),_t(Ce.ObjectBox.Txt.Width.Default,{width:function(e){var t=e.env.c;return t.r+t.l}}),_t(Ce.ObjectBox.Cir,{toDropShape:function(e){var t=e.env;if(void 0===t.c)return ft.none;t.originalReferencePoint=t.c;var n=this.radius.radius(e),r=t.c.x,i=t.c.y,a=this.cir.toDropShape(e,r,i,n);return t.c=new rt.Ellipse(r,i,n,n,n,n),a},toConnectShape:function(e){var t=e.env;return t.originalReferencePoint=t.c,ft.none}}),_t(Ce.ObjectBox.Cir.Radius.Vector,{radius:function(e){return this.vector.xy(e).x}}),_t(Ce.ObjectBox.Cir.Radius.Default,{radius:function(e){return e.env.c.r}}),_t(Ce.ObjectBox.Cir.Cir.Segment,{toDropShape:function(e,t,n,r){e.env;var i,a,o=this.startPointDegree(e),u=this.endPointDegree(e,o),s=u-o;if(0===(s=s<0?s+360:s))return ft.none;"^"===this.orient?(i=s>180?"1":"0",a="0"):(i=s>180?"0":"1",a="1");var c=Math.PI/180,h=t+r*Math.cos(o*c),l=n+r*Math.sin(o*c),m=t+r*Math.cos(u*c),p=n+r*Math.sin(u*c),f=new ft.CircleSegmentShape(t,n,h,l,r,i,a,m,p);return e.appendShapeToFront(f),f},startPointDegree:function(e){var t=this.startDiag.toString();return"^"===this.orient?this.diagToAngleACW(t):this.diagToAngleCW(t)},endPointDegree:function(e,t){var n=this.endDiag.toString();return"^"===this.orient?this.diagToAngleACW(n,t):this.diagToAngleCW(n,t)},diagToAngleACW:function(e,t){switch(e){case"l":return 90;case"r":return-90;case"d":return 180;case"u":return 0;case"dl":case"ld":return 135;case"dr":case"rd":return-135;case"ul":case"lu":return 45;case"ur":case"ru":return-45;default:return void 0!==t?t+180:0}},diagToAngleCW:function(e,t){switch(e){case"l":return-90;case"r":return 90;case"d":return 0;case"u":return 180;case"dl":case"ld":return-45;case"dr":case"rd":return 45;case"ul":case"lu":return-135;case"ur":case"ru":return 135;default:return void 0!==t?t+180:0}}}),_t(Ce.ObjectBox.Cir.Cir.Full,{toDropShape:function(e,t,n,r){var i=new ft.FullCircleShape(t,n,r);return e.appendShapeToFront(i),i}}),_t(Ce.ObjectBox.Frame,{toDropShape:function(e){var t=e.env;return t.originalReferencePoint=t.c,this.toDropFilledShape(e,"currentColor",!1)},toDropFilledShape:function(e,t,n){var r=e.env.c;if(void 0===r)return ft.none;var i=pe.measure.thickness,a=r.x,o=r.y,u=r.l,s=r.r,c=r.u,h=r.d,l=ft.none;switch(this.main){case"--":var m=3*i;if(n){var p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!1,t,pe.measure.em2px(m)+" "+pe.measure.em2px(m))}else{var f=this.radius.radius(e);l=new ft.RectangleShape(a,o,u,s,c,h,f,!1,t,pe.measure.em2px(m)+" "+pe.measure.em2px(m))}break;case"==":m=3*i;if(n){p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!0,t,pe.measure.em2px(m)+" "+pe.measure.em2px(m))}else{f=this.radius.radius(e);l=new ft.RectangleShape(a,o,u,s,c,h,f,!0,t,pe.measure.em2px(m)+" "+pe.measure.em2px(m))}break;case"o-":m=3*i,f=pe.measure.lineElementLength;l=new ft.RectangleShape(a,o,u,s,c,h,f,!1,t,pe.measure.em2px(m)+" "+pe.measure.em2px(m));break;case"oo":var d=(p=this.radius.xy(e)).x;l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,d,d,!0,t,void 0);break;case"ee":p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!0,t,void 0);break;case"-,":var y=this.radius.depth(e);f=this.radius.radius(e);l=new ft.CompositeShape(new ft.RectangleShape(a,o,u,s,c,h,f,!1,t,void 0),new ft.BoxShadeShape(a,o,u,s,c,h,y));break;case".o":d=(p=this.radius.xy(e)).x;l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,d,d,!1,t,pe.measure.dottedDasharray);break;case"-o":m=3*i,d=(p=this.radius.xy(e)).x;l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,d,d,!1,t,pe.measure.em2px(m)+" "+pe.measure.em2px(m));break;case".e":p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!1,t,pe.measure.dottedDasharray);break;case"-e":m=3*i,p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!1,t,pe.measure.em2px(m)+" "+pe.measure.em2px(m));break;case"-":if(n){p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!1,t,void 0)}else{f=this.radius.radius(e);l=new ft.RectangleShape(a,o,u,s,c,h,f,!1,t,void 0)}break;case"=":if(n){p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!0,t,void 0)}else{f=this.radius.radius(e);l=new ft.RectangleShape(a,o,u,s,c,h,f,!0,t,void 0)}break;case".":if(n){p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!1,t,pe.measure.dottedDasharray)}else{f=this.radius.radius(e);l=new ft.RectangleShape(a,o,u,s,c,h,f,!1,t,pe.measure.dottedDasharray)}break;case",":y=this.radius.depth(e);l=new ft.BoxShadeShape(a,o,u,s,c,h,y,t);break;case"o":d=(p=this.radius.xy(e)).x;l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,d,d,!1,t,void 0);break;case"e":p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!1,t,void 0);break;case"\\{":l=new ft.LeftBrace(a-u,o,c,h,0,t);break;case"\\}":l=new ft.LeftBrace(a+s,o,h,c,180,t);break;case"^\\}":case"^\\{":l=new ft.LeftBrace(a,o+c,s,u,270,t);break;case"_\\{":case"_\\}":l=new ft.LeftBrace(a,o-h,u,s,90,t);break;case"(":l=new ft.LeftParenthesis(a-u,o+(c-h)/2,c+h,0,t);break;case")":l=new ft.LeftParenthesis(a+s,o+(c-h)/2,c+h,180,t);break;case"^(":case"^)":l=new ft.LeftParenthesis(a+(s-u)/2,o+c,u+s,270,t);break;case"_(":case"_)":l=new ft.LeftParenthesis(a+(s-u)/2,o-h,u+s,90,t);break;case"*":if(r.isCircle()){p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!1,"currentColor",void 0,t,!0)}else{f=this.radius.radius(e);l=new ft.RectangleShape(a,o,u,s,c,h,f,!1,"currentColor",void 0,t,!0)}break;case"**":if(r.isCircle()){p=this.radius.xy(e);l=new ft.EllipseShape(a+(s-u)/2,o+(c-h)/2,p.x,p.y,!1,"currentColor",void 0,t,!1)}else{f=this.radius.radius(e);l=new ft.RectangleShape(a,o,u,s,c,h,f,!1,"currentColor",void 0,t,!1)}break;default:return ft.none}return e.appendShapeToFront(l),l},toConnectShape:function(e){var t=e.env,n=t.c,r=t.p;void 0!==n&&void 0!==r||ft.none,t.originalReferencePoint=n;var i=t.duplicate();i.c=r.combineRect(n);var a=new xt(ft.none,i),o=this.toDropShape(a);return e.appendShapeToFront(o),o}}),_t(Ce.ObjectBox.Frame.Radius.Vector,{radius:function(e){return this.vector.xy(e).x},depth:function(e){return this.vector.xy(e).x},xy:function(e){return this.vector.xy(e)}}),_t(Ce.ObjectBox.Frame.Radius.Default,{radius:function(e){return 0},depth:function(e){return pe.measure.thickness/2},xy:function(e){var t=e.env.c;return{x:(t.l+t.r)/2,y:(t.u+t.d)/2}}}),_t(Ce.ObjectBox.Dir,{toDropShape:function(e){var t=e.env,n=t.c;t.originalReferencePoint=n;var r=t.angle;if(void 0===n)return ft.none;t.c=new rt.Point(n.x,n.y);pe.measure.thickness;var i=ft.none;switch(this.main){case"":return ft.none;case">":switch(this.variant){case"2":var a=(i=new ft.GT2ArrowheadShape(n,r)).getRadius();t.c=new rt.Ellipse(n.x,n.y,a,a,a,a);break;case"3":a=(i=new ft.GT3ArrowheadShape(n,r)).getRadius();t.c=new rt.Ellipse(n.x,n.y,a,a,a,a);break;default:i="^"===this.variant?new ft.UpperGTArrowheadShape(n,r):"_"===this.variant?new ft.LowerGTArrowheadShape(n,r):new ft.GTArrowheadShape(n,r)}break;case"<":switch(this.variant){case"2":a=(i=new ft.LT2ArrowheadShape(n,r)).getRadius();t.c=new rt.Ellipse(n.x,n.y,a,a,a,a);break;case"3":a=(i=new ft.LT3ArrowheadShape(n,r)).getRadius();t.c=new rt.Ellipse(n.x,n.y,a,a,a,a);break;default:i="^"===this.variant?new ft.UpperLTArrowheadShape(n,r):"_"===this.variant?new ft.LowerLTArrowheadShape(n,r):new ft.LTArrowheadShape(n,r)}break;case"|":switch(this.variant){case"^":i=new ft.UpperColumnArrowheadShape(n,r);break;case"_":i=new ft.LowerColumnArrowheadShape(n,r);break;case"2":i=new ft.Column2ArrowheadShape(n,r);break;case"3":i=new ft.Column3ArrowheadShape(n,r);break;default:i=new ft.ColumnArrowheadShape(n,r)}break;case"(":switch(this.variant){case"^":i=new ft.UpperLParenArrowheadShape(n,r);break;case"_":i=new ft.LowerLParenArrowheadShape(n,r);break;default:i=new ft.LParenArrowheadShape(n,r)}break;case")":switch(this.variant){case"^":i=new ft.UpperRParenArrowheadShape(n,r);break;case"_":i=new ft.LowerRParenArrowheadShape(n,r);break;default:i=new ft.RParenArrowheadShape(n,r)}break;case"`":switch(this.variant){case"_":i=new ft.LowerBackquoteArrowheadShape(n,r);break;case"^":default:i=new ft.UpperBackquoteArrowheadShape(n,r)}break;case"'":switch(this.variant){case"_":i=new ft.LowerQuoteArrowheadShape(n,r);break;case"^":default:i=new ft.UpperQuoteArrowheadShape(n,r)}break;case"*":i=new ft.AsteriskArrowheadShape(n,0);break;case"o":i=new ft.OArrowheadShape(n,0);break;case"+":i=new ft.PlusArrowheadShape(n,r);break;case"x":i=new ft.XArrowheadShape(n,r);break;case"/":i=new ft.SlashArrowheadShape(n,r);break;case"-":case"--":pe.measure.lineElementLength;i="3"===this.variant?new ft.Line3ArrowheadShape(n,r):"2"===this.variant?new ft.Line2ArrowheadShape(n,r):new ft.LineArrowheadShape(n,r);break;case"=":case"==":i=new ft.Line2ArrowheadShape(n,r);break;case".":case"..":i="3"===this.variant?new ft.Dot3ArrowheadShape(n,r):"2"===this.variant?new ft.Dot2ArrowheadShape(n,r):new ft.DotArrowheadShape(n,r);break;case":":case"::":i=new ft.Dot2ArrowheadShape(n,r);break;case"~":case"~~":i="3"===this.variant?new ft.Tilde3ArrowheadShape(n,r):"2"===this.variant?new ft.Tilde2ArrowheadShape(n,r):new ft.TildeArrowheadShape(n,r);break;case">>":switch(this.variant){case"^":i=new ft.UpperGTGTArrowheadShape(n,r);break;case"_":i=new ft.LowerGTGTArrowheadShape(n,r);break;case"2":a=(i=new ft.GTGT2ArrowheadShape(n,r)).getRadius();t.c=new rt.Ellipse(n.x,n.y,a,a,a,a);break;case"3":a=(i=new ft.GTGT3ArrowheadShape(n,r)).getRadius();t.c=new rt.Ellipse(n.x,n.y,a,a,a,a);break;default:i=new ft.GTGTArrowheadShape(n,r)}break;case"<<":switch(this.variant){case"^":i=new ft.UpperLTLTArrowheadShape(n,r);break;case"_":i=new ft.LowerLTLTArrowheadShape(n,r);break;case"2":a=(i=new ft.LTLT2ArrowheadShape(n,r)).getRadius();t.c=new rt.Ellipse(n.x,n.y,a,a,a,a);break;case"3":a=(i=new ft.LTLT3ArrowheadShape(n,r)).getRadius();t.c=new rt.Ellipse(n.x,n.y,a,a,a,a);break;default:i=new ft.LTLTArrowheadShape(n,r)}break;case"||":switch(this.variant){case"^":i=new ft.UpperColumnColumnArrowheadShape(n,r);break;case"_":i=new ft.LowerColumnColumnArrowheadShape(n,r);break;case"2":i=new ft.ColumnColumn2ArrowheadShape(n,r);break;case"3":i=new ft.ColumnColumn3ArrowheadShape(n,r);break;default:i=new ft.ColumnColumnArrowheadShape(n,r)}break;case"|-":switch(this.variant){case"^":i=new ft.UpperColumnLineArrowheadShape(n,r);break;case"_":i=new ft.LowerColumnLineArrowheadShape(n,r);break;case"2":i=new ft.ColumnLine2ArrowheadShape(n,r);break;case"3":i=new ft.ColumnLine3ArrowheadShape(n,r);break;default:i=new ft.ColumnLineArrowheadShape(n,r)}break;case">|":i=new ft.GTColumnArrowheadShape(n,r);break;case">>|":i=new ft.GTGTColumnArrowheadShape(n,r);break;case"|<":i=new ft.ColumnLTArrowheadShape(n,r);break;case"|<<":i=new ft.ColumnLTLTArrowheadShape(n,r);break;case"//":i=new ft.SlashSlashArrowheadShape(n,r);break;case"=>":i=new ft.LineGT2ArrowheadShape(n,r);break;default:var o=pe.repositories.dirRepository.get(this.main);if(void 0===o)throw s("ExecutionError","\\dir "+this.variant+"{"+this.main+"} not defined.");i=o.toDropShape(e)}return e.appendShapeToFront(i),i},toConnectShape:function(e){var t=e.env;t.originalReferencePoint=t.c;pe.measure.thickness;var n=t.p.edgePoint(t.c.x,t.c.y),r=t.c.edgePoint(t.p.x,t.p.y);return n.x!==r.x||n.y!==r.y?new Et.Line(n,r).toShape(e,this,this.main,this.variant):(t.angle=0,t.lastCurve=Lt.none,ft.none)}}),_t(Ce.ObjectBox.Curve,{toDropShape:function(e){var t=e.env;return t.originalReferencePoint=t.c,ft.none},toConnectShape:function(e){var t=e.env;t.originalReferencePoint=t.c;var n=void 0,r=void 0;this.objects.foreach((function(e){n=e.objectForDrop(n),r=e.objectForConnect(r)})),void 0===n&&void 0===r&&(r=new Ce.Object(L.empty,new Ce.ObjectBox.Dir("","-")));pe.measure.thickness;var i=t.c,a=t.p,o=[];this.poslist.foreach((function(t){t.addPositions(o,e)})),t.c=i,t.p=a;var u=ft.none,s=a,c=i;switch(o.length){case 0:return s.x===c.x&&s.y===c.y?(t.lastCurve=Lt.none,t.angle=0,ft.none):void 0!==r?r.toConnectShape(e):n.toConnectShape(e);case 1:var h=(m=new Et.QuadBezier(s,o[0],c)).tOfShavedStart(s),l=m.tOfShavedEnd(c);if(void 0===h||void 0===l||h>=l)return t.angle=0,t.lastCurve=Lt.none,ft.none;u=m.toShape(e,n,r),t.lastCurve=new Lt.QuadBezier(m,h,l,u),t.angle=Math.atan2(c.y-s.y,c.x-s.x);break;case 2:var m;h=(m=new Et.CubicBezier(s,o[0],o[1],c)).tOfShavedStart(s),l=m.tOfShavedEnd(c);if(void 0===h||void 0===l||h>=l)return t.angle=0,t.lastCurve=Lt.none,ft.none;u=m.toShape(e,n,r),t.lastCurve=new Lt.CubicBezier(m,h,l,u),t.angle=Math.atan2(c.y-s.y,c.x-s.x);break;default:var p=new Et.CubicBSpline(s,o,c),f=new Et.CubicBeziers(p.toCubicBeziers());h=f.tOfShavedStart(s),l=f.tOfShavedEnd(c);if(void 0===h||void 0===l||h>=l)return t.angle=0,t.lastCurve=Lt.none,ft.none;u=f.toShape(e,n,r),t.lastCurve=new Lt.CubicBSpline(s,c,f,h,l,u),t.angle=Math.atan2(c.y-s.y,c.x-s.x)}return u}}),_t(Ce.ObjectBox.Curve.Object.Drop,{objectForDrop:function(e){return this.object},objectForConnect:function(e){return e}}),_t(Ce.ObjectBox.Curve.Object.Connect,{objectForDrop:function(e){return e},objectForConnect:function(e){return this.object}}),_t(Ce.ObjectBox.Curve.PosList.CurPos,{addPositions:function(e,t){var n=t.env;e.push(n.c)}}),_t(Ce.ObjectBox.Curve.PosList.Pos,{addPositions:function(e,t){var n=t.env;this.pos.toShape(t),e.push(n.c)}}),_t(Ce.ObjectBox.Curve.PosList.AddStack,{addPositions:function(e,t){t.env.stack.reverse().foreach((function(t){e.push(t)}))}}),_t(Ce.Coord.C,{position:function(e){return e.env.c}}),_t(Ce.Coord.P,{position:function(e){return e.env.p}}),_t(Ce.Coord.X,{position:function(e){var t=e.env,n=t.p,r=t.c,i=t.origin,a=t.xBase,o=r.y-n.y,u=n.x-r.x,s=r.x*n.y-r.y*n.x,h=a.y,l=-a.x,m=a.x*i.y-a.y*i.x,p=o*l-h*u;if(Math.abs(p)i.u+i.d?(a=(i.l-i.r)/2,o=(i.d-i.u)/2):(a=(i.l-i.r)/2,o=i.d-u/2),r.c=r.c.shiftFrame(a,o),t=new ft.TranslateShape(a,o,t)}return this.proceedModifyShape(e,t,n)}}),_t(Ce.Modifier.Shape.D,{preprocess:function(e,t){},modifyShape:function(e,t,n){var r=e.env,i=r.c;if(void 0!==i){var a,o,u=i.r+i.l;u>i.u+i.d?(a=(i.l-i.r)/2,o=(i.d-i.u)/2):(a=(i.l-i.r)/2,o=-i.u+u/2),r.c=r.c.shiftFrame(a,o),t=new ft.TranslateShape(a,o,t)}return this.proceedModifyShape(e,t,n)}}),_t(Ce.Modifier.Shape.C,{preprocess:function(e,t){},modifyShape:function(e,t,n){var r,i,a=e.env,o=a.c;void 0!==o&&(r=(o.l-o.r)/2,i=(o.d-o.u)/2,a.c=a.c.shiftFrame(r,i),t=new ft.TranslateShape(r,i,t));return this.proceedModifyShape(e,t,n)}}),_t(Ce.Modifier.Shape.ChangeColor,{preprocess:function(e,t){},modifyShape:function(e,t,n){return t=this.proceedModifyShape(e,t,n),new ft.ChangeColorShape(this.colorName,t)}}),_t(Ce.Modifier.Shape.Alphabets,{preprocess:function(e,t){var n=pe.repositories.modifierRepository.get(this.alphabets);if(void 0!==n)return n.preprocess(e,t)},modifyShape:function(e,t,n){var r=pe.repositories.modifierRepository.get(this.alphabets);if(void 0!==r)return r.modifyShape(e,t,n)}}),_t(Ce.Modifier.Shape.DefineShape,{preprocess:function(e,t){var n=t.reverse();pe.repositories.modifierRepository.put(this.shape,new Ce.Modifier.Shape.CompositeModifiers(n))},modifyShape:function(e,t,n){return this.proceedModifyShape(e,t,n)}}),_t(Ce.Modifier.Shape.CompositeModifiers,{preprocess:function(e,t){this.modifiers.foreach((function(n){n.preprocess(e,t),t=t.prepend(n)}))},modifyShape:function(e,t,n){return t=this.proceedModifyShape(e,t,this.modifiers),this.proceedModifyShape(e,t,n)}}),_t(Ce.Modifier.Invisible,{preprocess:function(e,t){},modifyShape:function(e,t,n){return t=this.proceedModifyShape(e,t,n),ft.none}}),_t(Ce.Modifier.Hidden,{preprocess:function(e,t){},modifyShape:function(e,t,n){return this.proceedModifyShape(e,t,n)}}),_t(Ce.Modifier.Direction,{preprocess:function(e,t){e.env.angle=this.direction.angle(e)},modifyShape:function(e,t,n){return e.env.angle=this.direction.angle(e),this.proceedModifyShape(e,t,n)}}),_t(Ce.Modifier.AddOp,{preprocess:function(e,t){},modifyShape:function(e,t,n){var r=e.env.c;return e.env.c=this.op.apply(this.size,r,e),e.appendShapeToFront(new ft.InvisibleBoxShape(e.env.c)),this.proceedModifyShape(e,t,n)}}),_t(Ce.Modifier.AddOp.Grow,{apply:function(e,t,n){var r=n.env,i=e.isDefault?{x:2*r.objectmargin,y:2*r.objectmargin}:e.vector.xy(n),a=Math.abs(i.x/2),o=Math.abs(i.y/2);return t.grow(a,o)},applyToDimen:function(e,t){return e+t}}),_t(Ce.Modifier.AddOp.Shrink,{apply:function(e,t,n){var r=n.env,i=e.isDefault?{x:2*r.objectmargin,y:2*r.objectmargin}:e.vector.xy(n),a=-Math.abs(i.x/2),o=-Math.abs(i.y/2);return t.grow(a,o)},applyToDimen:function(e,t){return e-t}}),_t(Ce.Modifier.AddOp.Set,{apply:function(e,t,n){var r=n.env,i=e.isDefault?{x:r.objectwidth,y:r.objectheight}:e.vector.xy(n),a=Math.abs(i.x),o=Math.abs(i.y);return t.toSize(a,o)},applyToDimen:function(e,t){return t}}),_t(Ce.Modifier.AddOp.GrowTo,{apply:function(e,t,n){var r=Math.max(t.l+t.r,t.u+t.d),i=e.isDefault?{x:r,y:r}:e.vector.xy(n),a=Math.abs(i.x),o=Math.abs(i.y);return t.growTo(a,o)},applyToDimen:function(e,t){return Math.max(Math.max(e,t),0)}}),_t(Ce.Modifier.AddOp.ShrinkTo,{apply:function(e,t,n){var r=Math.min(t.l+t.r,t.u+t.d),i=e.isDefault?{x:r,y:r}:e.vector.xy(n),a=Math.abs(i.x),o=Math.abs(i.y);return t.shrinkTo(a,o)},applyToDimen:function(e,t){return Math.max(Math.min(e,t),0)}}),_t(Ce.Modifier.Shape.Frame,{preprocess:function(e,t){},modifyShape:function(e,t,n){var r=e.env;if(void 0!==r.c){this.main;var i=new Ce.ObjectBox.Frame.Radius.Default,a="currentColor";this.options.foreach((function(e){i=e.getRadius(i)})),this.options.foreach((function(e){a=e.getColorName(a)}));var o=r.duplicate(),u=new xt(ft.none,o),s=new Ce.ObjectBox.Frame(i,this.main).toDropFilledShape(u,a,r.c.isCircle());t=new ft.CompositeShape(t,s)}return this.proceedModifyShape(e,t,n)}}),_t(Ce.Modifier.Shape.Frame.Radius,{getRadius:function(e){return new Ce.ObjectBox.Frame.Radius.Vector(this.vector)},getColorName:function(e){return e}}),_t(Ce.Modifier.Shape.Frame.Color,{getRadius:function(e){return e},getColorName:function(e){return this.colorName}}),_t(Ce.Direction.Compound,{angle:function(e){var t=this.dir.angle(e);return this.rots.foreach((function(n){t=n.rotate(t,e)})),t}}),_t(Ce.Direction.Diag,{angle:function(e){return this.diag.angle(e)}}),_t(Ce.Direction.Vector,{angle:function(e){return this.vector.angle(e)}}),_t(Ce.Direction.ConstructVector,{angle:function(e){var t=e.env,n=t.origin,r=t.xBase,i=t.yBase,a=t.p,o=t.c;this.posDecor.toShape(e);var u=Math.atan2(t.c.y-t.p.y,t.c.x-t.p.x);return t.c=o,t.p=a,t.origin=n,t.xBase=r,t.yBase=i,u}}),_t(Ce.Direction.RotVector,{rotate:function(e,t){return e+this.vector.angle(t)}}),_t(Ce.Direction.RotCW,{rotate:function(e,t){return e+Math.PI/2}}),_t(Ce.Direction.RotAntiCW,{rotate:function(e,t){return e-Math.PI/2}}),_t(Ce.Diag.Default,{isEmpty:!0,angle:function(e){return e.env.angle}}),_t(Ce.Diag.Angle,{isEmpty:!1,angle:function(e){return this.ang}}),_t(Ce.Decor,{toShape:function(e){this.commands.foreach((function(t){t.toShape(e)}))}}),_t(Ce.Command.Save,{toShape:function(e){e.env.saveState(),this.pos.toShape(e)}}),_t(Ce.Command.Restore,{toShape:function(e){e.env.restoreState()}}),_t(Ce.Command.Pos,{toShape:function(e){this.pos.toShape(e)}}),_t(Ce.Command.AfterPos,{toShape:function(e){this.pos.toShape(e),this.decor.toShape(e)}}),_t(Ce.Command.Drop,{toShape:function(e){this.object.toDropShape(e)}}),_t(Ce.Command.Connect,{toShape:function(e){this.object.toConnectShape(e)}}),_t(Ce.Command.Relax,{toShape:function(e){}}),_t(Ce.Command.Ignore,{toShape:function(e){}}),_t(Ce.Command.ShowAST,{toShape:function(e){console.log(this.pos.toString()+" "+this.decor)}}),_t(Ce.Command.Ar,{toShape:function(e){var t=e.env,n=t.origin,r=t.xBase,i=t.yBase,a=t.p,o=t.c;t.pathActionForBeforeSegment=g.empty,t.pathActionForAfterSegment=g.empty,t.labelsForNextSegmentOnly=g.empty,t.labelsForLastSegmentOnly=g.empty,t.labelsForEverySegment=g.empty,t.segmentSlideEm=g.empty,t.lastTurnDiag=g.empty,t.arrowVariant="",t.tailTip=new Ce.Command.Ar.Form.Tip.Tipchars(""),t.headTip=new Ce.Command.Ar.Form.Tip.Tipchars(">"),t.stemConn=new Ce.Command.Ar.Form.Conn.Connchars("-"),t.reverseAboveAndBelow=!1,t.arrowObjectModifiers=L.empty,this.forms.foreach((function(t){t.toShape(e)})),t.pathActionForBeforeSegment.isDefined||(t.pathActionForBeforeSegment=new g.Some(new Ce.PosDecor(new Ce.Pos.Coord(new Ce.Coord.C,L.empty.append(new Ce.Pos.ConnectObject(new Ce.Object(t.arrowObjectModifiers,t.stemConn.getObject(e))))),new Ce.Decor(L.empty)))),t.labelsForNextSegmentOnly=new g.Some(new Ce.Command.Path.Labels(L.empty.append(new Ce.Command.Path.Label.At(new Ce.Pos.Place(new Ce.Place(1,1,new Ce.Place.Factor(0),new Ce.Slide(g.empty))),t.tailTip.getObject(e),g.empty)))),t.labelsForLastSegmentOnly=new g.Some(new Ce.Command.Path.Labels(L.empty.append(new Ce.Command.Path.Label.At(new Ce.Pos.Place(new Ce.Place(1,1,new Ce.Place.Factor(1),new Ce.Slide(g.empty))),t.headTip.getObject(e),g.empty)))),this.path.toShape(e),t.c=o,t.p=a,t.origin=n,t.xBase=r,t.yBase=i}}),_t(Ce.Command.Ar.Form.BuildArrow,{toShape:function(e){var t=e.env;t.arrowVariant=this.variant,t.tailTip=this.tailTip,t.stemConn=this.stemConn,t.headTip=this.headTip}}),_t(Ce.Command.Ar.Form.ChangeVariant,{toShape:function(e){e.env.arrowVariant=this.variant}}),_t(Ce.Command.Ar.Form.ChangeStem,{toShape:function(e){e.env.stemConn=new Ce.Command.Ar.Form.Conn.Connchars(this.connchar)}}),_t(Ce.Command.Ar.Form.DashArrowStem,{toShape:function(e){}}),_t(Ce.Command.Ar.Form.CurveArrow,{toShape:function(e){var t=e.env,n=pe.measure.em2length(2*pe.measure.length2em(this.dist));t.pathActionForBeforeSegment=new g.Some(new Ce.PosDecor(new Ce.Pos.Coord(new Ce.Coord.C,L.empty.append(new Ce.Pos.ConnectObject(new Ce.Object(t.arrowObjectModifiers,new Ce.ObjectBox.Curve(L.empty,L.empty.append(new Ce.ObjectBox.Curve.Object.Connect(t.stemConn.getObject(e))),L.empty.append(new Ce.ObjectBox.Curve.PosList.Pos(new Ce.Pos.Coord(new Ce.Coord.Group(new Ce.PosDecor(new Ce.Pos.Coord(new Ce.Coord.C,L.empty.append(new Ce.Pos.ConnectObject(new Ce.Object(L.empty,new Ce.ObjectBox.Dir("","")))).append(new Ce.Pos.Place(new Ce.Place(0,0,void 0,new Ce.Slide(g.empty)))).append(new Ce.Pos.Plus(new Ce.Coord.Vector(new Ce.Vector.Dir(this.direction,n))))),new Ce.Decor(L.empty))),L.empty)))))))),new Ce.Decor(L.empty)))}}),_t(Ce.Command.Ar.Form.CurveFitToDirection,{toShape:function(e){var t=e.env;t.pathActionForBeforeSegment=new g.Some(new Ce.PosDecor(new Ce.Pos.Coord(new Ce.Coord.C,L.empty.append(new Ce.Pos.ConnectObject(new Ce.Object(t.arrowObjectModifiers,new Ce.ObjectBox.Curve(L.empty,L.empty.append(new Ce.ObjectBox.Curve.Object.Connect(t.stemConn.getObject(e))),L.empty.append(new Ce.ObjectBox.Curve.PosList.Pos(new Ce.Pos.Coord(new Ce.Coord.C,L.empty.append(new Ce.Pos.SwapPAndC(new Ce.Coord.C)).append(new Ce.Pos.Plus(new Ce.Coord.Vector(new Ce.Vector.Dir(this.outDirection,"3pc"))))))).append(new Ce.ObjectBox.Curve.PosList.Pos(new Ce.Pos.Coord(new Ce.Coord.C,L.empty.append(new Ce.Pos.SwapPAndC(new Ce.Coord.C)).append(new Ce.Pos.Plus(new Ce.Coord.Vector(new Ce.Vector.Dir(this.inDirection,"3pc")))))))))))),new Ce.Decor(L.empty)))}}),_t(Ce.Command.Ar.Form.CurveWithControlPoints,{toShape:function(e){var t=e.env,n=t.duplicate();n.startCapturePositions();var r=new xt(ft.none,n);this.coord.position(r);var i=n.endCapturePositions();i=i.append(n.c);var a=L.empty;i.reverse().foreach((function(e){var n=t.inverseAbsVector(e.x,e.y);a=a.prepend(new Ce.ObjectBox.Curve.PosList.Pos(new Ce.Pos.Coord(new Ce.Coord.Vector(new Ce.Vector.InCurBase(n.x,n.y)),L.empty)))})),t.pathActionForBeforeSegment=new g.Some(new Ce.PosDecor(new Ce.Pos.Coord(new Ce.Coord.C,L.empty.append(new Ce.Pos.ConnectObject(new Ce.Object(t.arrowObjectModifiers,new Ce.ObjectBox.Curve(L.empty,L.empty.append(new Ce.ObjectBox.Curve.Object.Connect(t.stemConn.getObject(e))),a))))),new Ce.Decor(L.empty)))}}),_t(Ce.Command.Ar.Form.AddShape,{toShape:function(e){e.env.arrowObjectModifiers=L.empty.append(this.shape)}}),_t(Ce.Command.Ar.Form.AddModifiers,{toShape:function(e){e.env.arrowObjectModifiers=this.modifiers}}),_t(Ce.Command.Ar.Form.Slide,{toShape:function(e){e.env.segmentSlideEm=new g.Some(pe.measure.length2em(this.slideDimen))}}),_t(Ce.Command.Ar.Form.LabelAt,{toShape:function(e){e.env.labelsForEverySegment=new g.Some(new Ce.Command.Path.Labels(L.empty.append(new Ce.Command.Path.Label.At(new Ce.Pos.Place(this.anchor),this.it,g.empty))))}}),_t(Ce.Command.Ar.Form.LabelAbove,{toShape:function(e){var t,n=e.env;t=n.reverseAboveAndBelow?new Ce.Command.Path.Label.Below(new Ce.Pos.Place(this.anchor),this.it,g.empty):new Ce.Command.Path.Label.Above(new Ce.Pos.Place(this.anchor),this.it,g.empty),n.labelsForEverySegment=new g.Some(new Ce.Command.Path.Labels(L.empty.append(t)))}}),_t(Ce.Command.Ar.Form.LabelBelow,{toShape:function(e){var t,n=e.env;t=n.reverseAboveAndBelow?new Ce.Command.Path.Label.Above(new Ce.Pos.Place(this.anchor),this.it,g.empty):new Ce.Command.Path.Label.Below(new Ce.Pos.Place(this.anchor),this.it,g.empty),n.labelsForEverySegment=new g.Some(new Ce.Command.Path.Labels(L.empty.append(t)))}}),_t(Ce.Command.Ar.Form.ReverseAboveAndBelow,{toShape:function(e){e.env.reverseAboveAndBelow=!0}}),_t(Ce.Command.Ar.Form.Conn.Connchars,{getObject:function(e){var t=e.env,n=new Ce.ObjectBox.Dir(t.arrowVariant,this.connchars);return new Ce.Object(t.arrowObjectModifiers,n)}}),_t(Ce.Command.Ar.Form.Conn.Object,{getObject:function(e){var t=e.env.arrowObjectModifiers.concat(this.object.modifiers);return new Ce.Object(t,this.object.object)}}),_t(Ce.Command.Ar.Form.Conn.Dir,{getObject:function(e){var t=e.env,n=this.dir,r=n;return""===n.variant&&""!==t.arrowVariant&&(r=new Ce.ObjectBox.Dir(t.arrowVariant,n.main)),new Ce.Object(t.arrowObjectModifiers,r)}}),_t(Ce.Command.Ar.Form.Tip.Tipchars,{getObject:function(e){var t=e.env,n=new Ce.ObjectBox.Dir(t.arrowVariant,this.tipchars);return new Ce.Object(t.arrowObjectModifiers,n)}}),_t(Ce.Command.Ar.Form.Tip.Object,{getObject:function(e){var t=e.env.arrowObjectModifiers.concat(this.object.modifiers);return new Ce.Object(t,this.object.object)}}),_t(Ce.Command.Ar.Form.Tip.Dir,{getObject:function(e){var t=e.env,n=this.dir,r=n;return""===n.variant&&""!==t.arrowVariant&&(r=new Ce.ObjectBox.Dir(t.arrowVariant,n.main)),new Ce.Object(t.arrowObjectModifiers,r)}}),_t(Ce.Command.Path,{toShape:function(e){var t=e.env,n=t.origin,r=t.xBase,i=t.yBase,a=t.p,o=t.c;t.pathActionForBeforeSegment=g.empty,t.pathActionForAfterSegment=g.empty,t.labelsForNextSegmentOnly=g.empty,t.labelsForLastSegmentOnly=g.empty,t.labelsForEverySegment=g.empty,t.segmentSlideEm=g.empty,t.lastTurnDiag=g.empty,this.path.toShape(e),t.c=o,t.p=a,t.origin=n,t.xBase=r,t.yBase=i}}),_t(Ce.Command.AfterPath,{toShape:function(e){this.path.toShape(e),this.decor.toShape(e)}}),_t(Ce.Command.Path.Path,{toShape:function(e){this.pathElements.foreach((function(t){t.toShape(e)}))}}),_t(Ce.Command.Path.SetBeforeAction,{toShape:function(e){e.env.pathActionForBeforeSegment=new g.Some(this.posDecor)}}),_t(Ce.Command.Path.SetAfterAction,{toShape:function(e){e.env.pathActionForAfterSegment=new g.Some(this.posDecor)}}),_t(Ce.Command.Path.AddLabelNextSegmentOnly,{toShape:function(e){e.env.labelsForNextSegmentOnly=new g.Some(this.labels)}}),_t(Ce.Command.Path.AddLabelLastSegmentOnly,{toShape:function(e){e.env.labelsForLastSegmentOnly=new g.Some(this.labels)}}),_t(Ce.Command.Path.AddLabelEverySegment,{toShape:function(e){e.env.labelsForEverySegment=new g.Some(this.labels)}}),_t(Ce.Command.Path.StraightSegment,{toShape:function(e){var t=e.env;this.segment.setupPositions(e);var n=t.c;t.pathActionForBeforeSegment.foreach((function(t){t.toShape(e)})),t.labelsForNextSegmentOnly.foreach((function(n){n.toShape(e),t.labelsForNextSegmentOnly=g.empty})),t.labelsForEverySegment.foreach((function(t){t.toShape(e)})),t.c=n,t.pathActionForAfterSegment.foreach((function(t){t.toShape(e)})),this.segment.toLabelsShape(e)}}),_t(Ce.Command.Path.LastSegment,{toShape:function(e){var t=e.env;this.segment.setupPositions(e);var n=t.c;t.pathActionForBeforeSegment.foreach((function(t){t.toShape(e)})),t.labelsForNextSegmentOnly.foreach((function(n){n.toShape(e),t.labelsForNextSegmentOnly=g.empty})),t.labelsForLastSegmentOnly.foreach((function(n){n.toShape(e),t.labelsForNextSegmentOnly=g.empty})),t.labelsForEverySegment.foreach((function(t){t.toShape(e)})),t.c=n,t.pathActionForAfterSegment.foreach((function(t){t.toShape(e)})),this.segment.toLabelsShape(e)}}),_t(Ce.Command.Path.TurningSegment,{toShape:function(e){var t=e.env,n=t.c;this.segment.pos.toShape(e),t.p=n;var r=this.turn.explicitizedCircle(e),i=this.turn.radius.radius(e);t.lastTurnDiag=new g.Some(r.endDiag);var a=r.startVector(e),o=r.endVector(e),u=t.segmentSlideEm.getOrElse(0);this.segment.slide.dimen.foreach((function(e){u=pe.measure.length2em(e),t.segmentSlideEm=new g.Some(u)})),0!==u&&(t.p=t.p.move(t.p.x-u*a.y,t.p.y+u*a.x),t.c=t.c.move(t.c.x-u*o.y,t.c.y+u*o.x),i="^"===r.orient?Math.max(0,i-u):Math.max(0,i+u));var s,h=t.p.edgePoint(t.p.x+a.x,t.p.y+a.y),l=t.c,m=r.relativeStartPoint(e,i),p=r.relativeEndPoint(e,i),f=r.relativeEndPoint(e,i+("^"===r.orient?u:-u)),d=a.x*o.y-a.y*o.x;if(Math.abs(d)0?0:Math.PI);r=t.c;var u=new xt(ft.none,t);this.it.toDropShape(u);var s=u.shape,c=s.getBoundingBox();if(void 0!==c){var h=c.x-r.x,l=c.y-r.y,m=c.l,p=c.r,f=c.u,d=c.d,y=Math.cos(o),v=Math.sin(o),x=Math.min((h-m)*y+(l-d)*v,(h-m)*y+(l+f)*v,(h+p)*y+(l-d)*v,(h+p)*y+(l+f)*v),g=Math.abs(a)-x;t.c=t.c.move(r.x+g*y,r.y+g*v),e.appendShapeToFront(new ft.TranslateShape(g*y,g*v,s))}}else this.it.toDropShape(e);var w=t.lastCurve;this.shouldSliceHole&&w.isDefined&&void 0!==i&&w.sliceHole(t.c,i),this.aliasOption.foreach((function(e){t.savePos(e,new Rt.Position(t.c))}))}}),_t(Ce.Command.Path.Label.Above,{getLabelMargin:function(e){return e.env.labelmargin},shouldSliceHole:!1}),_t(Ce.Command.Path.Label.Below,{getLabelMargin:function(e){return-e.env.labelmargin},shouldSliceHole:!1}),_t(Ce.Command.Path.Label.At,{getLabelMargin:function(e){return 0},shouldSliceHole:!0}),_t(Ce.Command.Xymatrix,{toShape:function(e){var t=e.env;if(void 0===t.c)return ft.none;var n=t.duplicate(),r=new xt(ft.none,n);n.xymatrixPrefix="",n.xymatrixRowSepEm=pe.measure.length2em("2pc"),n.xymatrixColSepEm=pe.measure.length2em("2pc"),n.xymatrixPretendEntryHeight=g.empty,n.xymatrixPretendEntryWidth=g.empty,n.xymatrixFixedRow=!1,n.xymatrixFixedCol=!1,n.xymatrixOrientationAngle=0,n.xymatrixEntryModifiers=L.empty,this.setup.foreach((function(e){e.toShape(r)}));var i,a,o=n.xymatrixOrientationAngle,u=0,s=0,c=new It(this.rows.map((function(e){s+=1,a=0;var t=new It.Row(e.entries.map((function(e){a+=1;var t=n.duplicate();t.origin={x:0,y:0},t.p=t.c=Bt.originPosition,t.angle=0,t.lastCurve=Lt.none,t.xymatrixRow=s,t.xymatrixCol=a;var r,i,o,u,c=new xt(ft.none,t),h=e.toShape(c),l=t.c;if(n.xymatrixPretendEntryHeight.isDefined){var m=n.xymatrixPretendEntryHeight.get;o=m/2,u=m/2}else o=l.u,u=l.d;if(n.xymatrixPretendEntryWidth.isDefined){var p=n.xymatrixPretendEntryWidth.get;r=p/2,i=p/2}else r=l.l,i=l.r;var f=new rt.Rect(0,0,{l:r,r:i,u:o,d:u});return new It.Entry(t.c,h,e.decor,f)})),o);return u=Math.max(u,a),t})),o);if(0===(i=s))return ft.none;c.rows.foreach((function(e){a=0,e.entries.foreach((function(e){a+=1,c.getColumn(a).addEntry(e)}))}));var h,l,m=n.xymatrixColSepEm,p=[],f=t.c.x;if(p.push(f),n.xymatrixFixedCol){var d=0,y=0;c.columns.foreach((function(e){d=Math.max(d,e.getL()),y=Math.max(y,e.getR())})),c.columns.tail.foreach((function(e){f=f+y+m+d,p.push(f)})),h=d,l=p[p.length-1]+y}else{var v=c.columns.head;c.columns.tail.foreach((function(e){f=f+v.getR()+m+e.getL(),p.push(f),v=e})),h=c.columns.head.getL(),l=f+c.columns.at(u-1).getR()-p[0]}var x,w,S=n.xymatrixRowSepEm,b=[],C=t.c.y;if(b.push(C),n.xymatrixFixedRow){var k=0,M=0;c.rows.foreach((function(e){k=Math.max(k,e.getU()),M=Math.max(M,e.getD())})),c.rows.tail.foreach((function(e){C-=M+S+k,b.push(C)})),x=k,w=b[0]-b[b.length-1]+M}else{var P=c.rows.head;c.rows.tail.foreach((function(e){C-=P.getD()+S+e.getU(),b.push(C),P=e})),x=c.rows.head.getU(),w=b[0]-C+c.rows.at(i-1).getD()}t.c=new rt.Rect(t.c.x,t.c.y,{l:h,r:l,u:x,d:w});var O=n.xymatrixPrefix,B=Math.cos(o),E=Math.sin(o),A=0;c.rows.foreach((function(e){var t=0;e.entries.foreach((function(e){var r=p[t],i=b[A],a=r*B-i*E,o=r*E+i*B,u=t+1,s=A+1,c=new Rt.Position(e.c.move(a,o));n.savePos(s+","+u,c),n.savePos(O+s+","+u,c),t+=1})),A+=1})),r=new xt(ft.none,n);A=0;c.rows.foreach((function(e){var t=0;e.entries.foreach((function(e){var i=p[t],a=b[A],o=i*B-a*E,u=i*E+a*B,s=t+1,c=A+1,h=new ft.TranslateShape(o,u,e.objectShape);r.appendShapeToFront(h),n.c=e.c.move(o,u),n.xymatrixRow=c,n.xymatrixCol=s,e.decor.toShape(r),t+=1})),A+=1}));var j=r.shape;return e.appendShapeToFront(j),t.savedPosition=n.savedPosition,j}});var It=function(){function e(t,n){Ft(this,e),this.rows=t,this.columns=L.empty,this.orientation=n}return Vt(e,[{key:"getColumn",value:function(t){if(this.columns.length()>=t)return this.columns.at(t-1);var n=new e.Column(this.orientation);return this.columns=this.columns.append(n),n}},{key:"toString",value:function(){return"Xymatrix{\n"+this.rows.mkString("\\\\\n")+"\n}"}}]),e}();function zt(e,t,n){var r=[],i=[],a={lastNoSuccess:void 0,whiteSpaceRegex:c.whiteSpaceRegex,createTextNode:function(t){var n=new o.Z(t,e.stack.env,e.configuration).mml(),a=pe.textObjectIdCounter;return pe.textObjectIdCounter++,r.push(n),i.push(a),n}},u=new Y(e.string,e.i,a),h=$.parse(t,u);if(e.i=h.next.offset,h.successful){var l=""+pe.xypicCommandIdCounter;pe.xypicCommandIdCounter++,pe.xypicCommandMap[l]=h.get();var m=JSON.stringify(i);return e.create(n,{"data-cmd-id":l,"data-text-mml-ids":m},r)}var p=a.lastNoSuccess.next.pos().lineContents();throw s("SyntaxError",a.lastNoSuccess.msg+'. Parse error at or near "'+p+'".')}It.Row=function(){function e(t,n){Ft(this,e),this.entries=t,this.orientation=n,Xe(this,"getU"),Xe(this,"getD")}return Vt(e,[{key:"getU",value:function(){var e=this.orientation,t=0;return this.entries.foreach((function(n){t=Math.max(t,n.getU(e))})),t}},{key:"getD",value:function(){var e=this.orientation,t=0;return this.entries.foreach((function(n){t=Math.max(t,n.getD(e))})),t}},{key:"toString",value:function(){return this.entries.mkString(" & ")}}]),e}(),It.Column=function(){function e(t){Ft(this,e),this.entries=L.empty,this.orientation=t,Xe(this,"getL"),Xe(this,"getR")}return Vt(e,[{key:"addEntry",value:function(e){this.entries=this.entries.append(e),this.getL.reset,this.getR.reset}},{key:"getL",value:function(){var e=this.orientation,t=0;return this.entries.foreach((function(n){t=Math.max(t,n.getL(e))})),t}},{key:"getR",value:function(){var e=this.orientation,t=0;return this.entries.foreach((function(n){t=Math.max(t,n.getR(e))})),t}},{key:"toString",value:function(){return this.entries.mkString(" \\\\ ")}}]),e}(),It.Entry=function(){function e(t,n,r,i){Ft(this,e),this.c=t,this.objectShape=n,this.decor=r,this.frame=i}return Vt(e,[{key:"getDistanceToEdgePoint",value:function(e,t){var n=e.edgePoint(e.x+Math.cos(t),e.y+Math.sin(t)),r=n.x-e.x,i=n.y-e.y;return Math.sqrt(r*r+i*i)}},{key:"getU",value:function(e){return 0===e?this.frame.u:this.getDistanceToEdgePoint(this.frame,e+Math.PI/2)}},{key:"getD",value:function(e){return 0===e?this.frame.d:this.getDistanceToEdgePoint(this.frame,e-Math.PI/2)}},{key:"getL",value:function(e){return 0===e?this.frame.l:this.getDistanceToEdgePoint(this.frame,e+Math.PI)}},{key:"getR",value:function(e){return 0===e?this.frame.r:this.getDistanceToEdgePoint(this.frame,e)}},{key:"toString",value:function(){return this.objectShape.toString()+" "+this.decor}}]),e}(),_t(Ce.Command.Xymatrix.Setup.Prefix,{toShape:function(e){e.env.xymatrixPrefix=this.prefix}}),_t(Ce.Command.Xymatrix.Setup.ChangeSpacing.Row,{toShape:function(e){var t=e.env;t.xymatrixRowSepEm=this.addop.applyToDimen(t.xymatrixRowSepEm,pe.measure.length2em(this.dimen))}}),_t(Ce.Command.Xymatrix.Setup.ChangeSpacing.Column,{toShape:function(e){var t=e.env;t.xymatrixColSepEm=this.addop.applyToDimen(t.xymatrixColSepEm,pe.measure.length2em(this.dimen))}}),_t(Ce.Command.Xymatrix.Setup.ChangeSpacing.RowAndColumn,{toShape:function(e){var t=e.env,n=this.addop.applyToDimen(t.xymatrixRowSepEm,pe.measure.length2em(this.dimen));t.xymatrixRowSepEm=n,t.xymatrixColSepEm=n}}),_t(Ce.Command.Xymatrix.Setup.PretendEntrySize.Height,{toShape:function(e){e.env.xymatrixPretendEntryHeight=new g.Some(pe.measure.length2em(this.dimen))}}),_t(Ce.Command.Xymatrix.Setup.PretendEntrySize.Width,{toShape:function(e){e.env.xymatrixPretendEntryWidth=new g.Some(pe.measure.length2em(this.dimen))}}),_t(Ce.Command.Xymatrix.Setup.PretendEntrySize.HeightAndWidth,{toShape:function(e){var t=new g.Some(pe.measure.length2em(this.dimen));e.env.xymatrixPretendEntryHeight=t,e.env.xymatrixPretendEntryWidth=t}}),_t(Ce.Command.Xymatrix.Setup.FixGrid.Row,{toShape:function(e){e.env.xymatrixFixedRow=!0}}),_t(Ce.Command.Xymatrix.Setup.FixGrid.Column,{toShape:function(e){e.env.xymatrixFixedCol=!0}}),_t(Ce.Command.Xymatrix.Setup.FixGrid.RowAndColumn,{toShape:function(e){e.env.xymatrixFixedRow=!0,e.env.xymatrixFixedCol=!0}}),_t(Ce.Command.Xymatrix.Setup.AdjustEntrySize.Margin,{toShape:function(e){var t=e.env;t.objectmargin=this.addop.applyToDimen(t.objectmargin,pe.measure.length2em(this.dimen))}}),_t(Ce.Command.Xymatrix.Setup.AdjustEntrySize.Width,{toShape:function(e){var t=e.env;t.objectwidth=this.addop.applyToDimen(t.objectwidth,pe.measure.length2em(this.dimen))}}),_t(Ce.Command.Xymatrix.Setup.AdjustEntrySize.Height,{toShape:function(e){var t=e.env;t.objectheight=this.addop.applyToDimen(t.objectheight,pe.measure.length2em(this.dimen))}}),_t(Ce.Command.Xymatrix.Setup.AdjustLabelSep,{toShape:function(e){var t=e.env;t.labelmargin=this.addop.applyToDimen(t.labelmargin,pe.measure.length2em(this.dimen))}}),_t(Ce.Command.Xymatrix.Setup.SetOrientation,{toShape:function(e){e.env.xymatrixOrientationAngle=this.direction.angle(e)}}),_t(Ce.Command.Xymatrix.Setup.AddModifier,{toShape:function(e){var t=e.env;t.xymatrixEntryModifiers=t.xymatrixEntryModifiers.prepend(this.modifier)}}),_t(Ce.Command.Xymatrix.Entry.SimpleEntry,{toShape:function(e){var t=e.env,n=pe.measure.em2length(t.objectmargin+t.objectwidth),r=pe.measure.em2length(t.objectmargin+t.objectheight),i=new Ce.Modifier.AddOp(new Ce.Modifier.AddOp.GrowTo,new Ce.Modifier.AddOp.VactorSize(new Ce.Vector.Abs(n,r))),a=pe.measure.em2length(t.objectmargin),o=new Ce.Modifier.AddOp(new Ce.Modifier.AddOp.Grow,new Ce.Modifier.AddOp.VactorSize(new Ce.Vector.Abs(a,a))),u=this.modifiers.concat(t.xymatrixEntryModifiers).prepend(i).prepend(o);return new Ce.Object(u,this.objectbox).toDropShape(e)}}),_t(Ce.Command.Xymatrix.Entry.EmptyEntry,{toShape:function(e){var t=e.env,n=pe.measure.em2length(t.objectmargin+t.objectwidth),r=pe.measure.em2length(t.objectmargin+t.objectheight),i=new Ce.Modifier.AddOp(new Ce.Modifier.AddOp.GrowTo,new Ce.Modifier.AddOp.VactorSize(new Ce.Vector.Abs(n,r))),a=pe.measure.em2length(t.objectmargin),o=new Ce.Modifier.AddOp(new Ce.Modifier.AddOp.Grow,new Ce.Modifier.AddOp.VactorSize(new Ce.Vector.Abs(a,a))),u=t.xymatrixEntryModifiers.prepend(i).prepend(o);return new Ce.Object(u,new Ce.ObjectBox.Empty).toDropShape(e)}}),_t(Ce.Command.Xymatrix.Entry.ObjectEntry,{toShape:function(e){return this.object.toDropShape(e)}}),_t(Ce.Command.Twocell,{toShape:function(e){var t=e.env;if(void 0===t.c)return ft.none;var n=t.duplicate(),r=new xt(ft.none,n);n.twocellmodmapobject=t.twocellmodmapobject||new Ce.Object(L.empty,new Ce.ObjectBox.Dir("","|")),n.twocellhead=t.twocellhead||new Ce.Object(L.empty,new Ce.ObjectBox.Dir("",">")),n.twocelltail=t.twocelltail||new Ce.Object(L.empty,new Ce.ObjectBox.Dir("","")),n.twocellarrowobject=t.twocellarrowobject||new Ce.Object(L.empty,new Ce.ObjectBox.Dir("","=>")),n.twocellUpperCurveObjectSpacer=t.twocellUpperCurveObjectSpacer,n.twocellUpperCurveObject=t.twocellUpperCurveObject,n.twocellLowerCurveObjectSpacer=t.twocellLowerCurveObjectSpacer,n.twocellLowerCurveObject=t.twocellLowerCurveObject,n.twocellUpperLabel=g.empty,n.twocellLowerLabel=g.empty,n.twocellCurvatureEm=g.empty,n.twocellShouldDrawCurve=!0,n.twocellShouldDrawModMap=!1,this.switches.foreach((function(e){e.setup(r)})),this.twocell.toShape(r,this.arrow),e.appendShapeToFront(r.shape)}}),_t(Ce.Command.Twocell.Hops2cell,{toShape:function(e,t){var n=e.env,r=n.c,i=n.angle,a=n.c,o=this.targetPosition(e);if(void 0!==a&&void 0!==o){var u=o.x-a.x,s=o.y-a.y;if(0!==u||0!==s){var c=new rt.Point(a.x+.5*u,a.y+.5*s),h=Math.atan2(s,u),l=h+Math.PI/2,m=n.twocellCurvatureEm.getOrElse(this.getDefaultCurvature()),p=Math.cos(l),f=Math.sin(l),d=this.getUpperControlPoint(a,o,c,m,p,f),y=this.getLowerControlPoint(a,o,c,m,p,f);if(n.twocellShouldDrawCurve){var v,x;if(x=void 0===(v=n.twocellUpperCurveObjectSpacer)?new Ce.Object(L.empty,new Ce.ObjectBox.Dir("","-")):void 0!==n.twocellUpperCurveObject?n.twocellUpperCurveObject.getOrElse(void 0):void 0,this.toUpperCurveShape(e,a,d,o,v,x),n.lastCurve.isDefined){n.angle=h;var g=this.getUpperLabelPosition(a,o,c,m,p,f),w=this.getUpperLabelAngle(l,a,o,c,m,p,f);n.twocellUpperLabel.foreach((function(t){t.toShape(e,g,Math.cos(w),Math.sin(w),h)})),this.hasUpperTips&&t.toUpperTipsShape(e)}if(x=void 0===(v=n.twocellLowerCurveObjectSpacer)?new Ce.Object(L.empty,new Ce.ObjectBox.Dir("","-")):void 0!==n.twocellLowerCurveObject?n.twocellLowerCurveObject.getOrElse(void 0):void 0,this.toLowerCurveShape(e,a,y,o,v,x),n.lastCurve.isDefined){n.angle=h;var S=this.getLowerLabelPosition(a,o,c,m,p,f),b=this.getLowerLabelAngle(l,a,o,c,m,p,f);n.twocellLowerLabel.foreach((function(t){t.toShape(e,S,Math.cos(b),Math.sin(b),h)})),this.hasLowerTips&&t.toLowerTipsShape(e)}}n.c=this.getDefaultArrowPoint(a,o,c,m,p,f),n.angle=l+Math.PI;var C=c;t.toArrowShape(e,C),n.c=r,n.angle=i}}},_toCurveShape:function(e,t,n,r,i,a){var o=e.env,u=new Et.QuadBezier(t,n,r),s=u.tOfShavedStart(t),c=u.tOfShavedEnd(r);if(void 0===s||void 0===c||s>=c)o.lastCurve=Lt.none;else{var h=u.toShape(e,i,a);o.lastCurve=new Lt.QuadBezier(u,s,c,h)}},targetPosition:function(e){var t=e.env,n=t.xymatrixRow,r=t.xymatrixCol;if(void 0===n||void 0===r)throw s("ExecutionError","rows and columns not found for hops ["+this.hops+"]");for(var i=0;i=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(u)throw a}}}}function fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&void 0!==arguments[2]?arguments[2]:null;dn(this,n),i=t.call(this,e,r,a);for(var o=pe.wrapperOfTextObjectMap,u=r.textMmls,s=i.childNodes,c=u.length,h=0;h1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return this.adaptor.node(e,t,n,Cn)}},{key:"setAttribute",value:function(e,t,n,r){return this.adaptor.setAttribute(e,t,n,r)}},{key:"setStyle",value:function(e,t,n){this.adaptor.setStyle(e,t,n)}},{key:"drawTextObject",value:function(e,t,n){var r=pe.measure.length2em("0.2em"),i=t.xypicWrapper,a=i.getChildWrapper(e.math),o=a.adaptor,u=a.getBBox(),s=u.scale,c=(u.h+r)*s,h=(u.d+r)*s,l=(u.w+2*r)*s,m=(c+h)/2,p=l/2,f=e.c;if(e.originalBBox={H:c,D:h,W:l},!n){var d=a.html("mjx-xypic-object");o.append(i.getElement(),d),o.setStyle(d,"color",t.getCurrentColor()),a.toCHTML(d);var y=t.getOrigin();o.setAttribute(d,"data-x",f.x-p-y.x+r*s),o.setAttribute(d,"data-y",-f.y-m-y.y+r*s),o.setAttribute(d,"data-xypic-id",e.math.xypicTextObjectId),i.appendTextObject(d)}return f.toRect({u:m,d:m,l:p,r:p})}}]),n}(e),r=function(e){xn(n,e);var t=wn(n);function n(e,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return dn(this,n),t.call(this,e,r,i)}return vn(n,[{key:"kind",get:function(){return Ce.xypic.prototype.kind}},{key:"_toCHTML",value:function(e){var t=this.standardCHTMLnode(e);this.cthml=t;var n=this.adaptor;n.setStyle(t,"position","relative");var r=this.length2em("0.2em"),i=pe.measure.strokeWidth,a=1,o=0,u=1,s=pe.measure.em2px,c=rn.createSVG(this,a,o,u,i,"black",{viewBox:[0,-s(a+o),s(u),s(a+o)].join(" "),role:"img",focusable:!1,overflow:"visible"});pe.svgForDebug=c,pe.svgForTestLayout=c,n.append(t,c.svg);var h=this.node.cmd;if(h){var l=new Bt,m=new xt(ft.none,l);h.toShape(m);var p=m.shape;p.draw(c);var f=p.getBoundingBox();if(void 0!==f){var d=(f=new rt.Rect(0,0,{l:Math.max(0,-(f.x-f.l)),r:Math.max(0,f.x+f.r),u:Math.max(0,f.y+f.u),d:Math.max(0,-(f.y-f.d))})).x-f.l-r,y=-f.y-f.u-r,v=f.l+f.r+2*r,x=f.u+f.d+2*r;c.setWidth(v),c.setHeight(x),c.setAttribute("viewBox",[s(d),s(y),s(v),s(x)].join(" ")),n.setStyle(t,"vertical-align",kn(-f.d-r+pe.measure.axis_height)+"em");var g,w=pn(this._textObjects);try{for(w.s();!(g=w.n()).done;){var S=g.value,b=parseFloat(n.getAttribute(S,"data-x")),C=parseFloat(n.getAttribute(S,"data-y"));n.setStyle(S,"left",kn(b-d)+"em"),n.setStyle(S,"top",kn(C+f.y-f.d-.5*r)+"em")}}catch(e){w.e(e)}finally{w.f()}}else n.remove(c.svg)}else n.remove(c.svg)}}],[{key:"styles",get:function(){return{"mjx-xypic path":{"stroke-width":"inherit"},".MathJax mjx-xypic path":{"stroke-width":"inherit"},"mjx-xypic-object":{"text-align":"center",position:"absolute"}}}}]),n}(n);t[r.prototype.kind]=r;var i=function(e){xn(n,e);var t=wn(n);function n(e,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return dn(this,n),t.call(this,e,r,i)}return vn(n,[{key:"kind",get:function(){return Ce.xypic.newdir.prototype.kind}},{key:"_toCHTML",value:function(e){var t=this.node.cmd;pe.repositories.dirRepository.put(t.dirMain,t.compositeObject)}}]),n}(n);t[i.prototype.kind]=i;var a=function(e){xn(n,e);var t=wn(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return dn(this,n),(i=t.call(this,e,r,a))._setupGraphics(),i.computeBBox(i.bbox),i.bboxComputed=!0,i}return vn(n,[{key:"kind",get:function(){return Ce.xypic.includegraphics.prototype.kind}},{key:"_setupGraphics",value:function(){this.setupMeasure(this);var e=new Bt,t=new xt(ft.none,e),n=this.node.cmd;if(n.setup(t),!e.includegraphicsWidth.isDefined||!e.includegraphicsHeight.isDefined)throw s("ExecutionError","the 'width' and 'height' attributes of the \\includegraphics are required.");var r=e.includegraphicsWidth.get,i=e.includegraphicsHeight.get;this.imageWidth=this.length2em(r),this.imageHeight=this.length2em(i),this.filepath=n.filepath}},{key:"computeBBox",value:function(e){e.empty(),e.updateFrom(new Ut.bK({w:this.imageWidth,h:this.imageHeight,d:0}))}},{key:"_toCHTML",value:function(e){var t=this.standardCHTMLnode(e);this.cthml=t,this.adaptor.setStyle(t,"position","relative"),this.adaptor.setStyle(t,"vertical-align","0em");var n=this.html("img");this.adaptor.setAttribute(n,"src",this.filepath),this.adaptor.setStyle(n,"width",kn(this.imageWidth)+"em"),this.adaptor.setStyle(n,"height",kn(this.imageHeight)+"em"),this.adaptor.append(t,n)}}]),n}(n);t[a.prototype.kind]=a}void 0!==Wt.wO&&Mn(Wt.wO,Nt.w);var Pn=n(511),On=n(0);function Bn(e){return(Bn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function En(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return An(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return An(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(u)throw a}}}}function An(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&void 0!==arguments[2]?arguments[2]:null;Ln(this,n),i=t.call(this,e,r,a);for(var o=pe.wrapperOfTextObjectMap,u=r.textMmls,s=i.childNodes,c=u.length,h=0;h1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return this.adaptor.node(e,t,n,_n)}},{key:"setAttribute",value:function(e,t,n,r){return this.adaptor.setAttribute(e,t,n,r)}},{key:"setStyle",value:function(e,t,n){this.adaptor.setStyle(e,t,n)}},{key:"drawTextObject",value:function(e,t,n){var r=pe.measure.length2em("0.2em"),i=t.xypicWrapper,a=i.getChildWrapper(e.math),o=a.adaptor,u=a.getBBox(),s=u.scale,c=(u.h+r)*s,h=(u.d+r)*s,l=(u.w+2*r)*s,m=(c+h)/2,p=l/2,f=e.c;if(e.originalBBox={H:c,D:h,W:l},!n){var d=a.svg("g");o.append(i.getElement(),d),o.setAttribute(d,"stroke",t.getCurrentColor()),o.setAttribute(d,"fill",t.getCurrentColor()),a.toSVG(d);var y=t.getOrigin();o.setAttribute(d,"data-x",f.x-p-y.x+r*s),o.setAttribute(d,"data-y",-f.y+(c-h)/2-y.y),o.setAttribute(d,"data-xypic-id",e.math.xypicTextObjectId),i.appendTextObject(d)}return f.toRect({u:m,d:m,l:p,r:p})}}]),n}(e),r=function(e){Tn(n,e);var t=Fn(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return Ln(this,n),(i=t.call(this,e,r,a)).shape=null,i}return Dn(n,[{key:"computeBBox",value:function(e){e.empty();var t=this.node.cmd;if(t){var n=this.length2em("0.2em");if(null==this.shape){var r=pe.svgForDebug,i=pe.svgForTestLayout;this._textObjects=[],this.setupMeasure(this);this.adaptor;var a=pe.measure.strokeWidth,o=1,u=0,s=1,c=pe.measure.em2px,h="black",l=rn.createSVG(this,o,u,s,a,h,{viewBox:[0,-c(o+u),c(s),c(o+u)].join(" "),role:"img",focusable:!1,overflow:"visible"});pe.svgForDebug=l,pe.svgForTestLayout=l;var m=new Bt,p=new xt(ft.none,m);t.toShape(p);var f=p.shape;this.shape=f,pe.svgForDebug=r,pe.svgForTestLayout=i}var d=this.shape,y=d.getBoundingBox();void 0!==y&&(y=new rt.Rect(0,0,{l:Math.max(0,-(y.x-y.l)),r:Math.max(0,y.x+y.r),u:Math.max(0,y.y+y.u),d:Math.max(0,-(y.y-y.d))}),e.updateFrom(new Ut.bK({w:y.l+y.r+2*n,h:y.u+2*n,d:y.d})))}}},{key:"kind",get:function(){return Ce.xypic.prototype.kind}},{key:"_toSVG",value:function(e){var t=this.standardSVGnode(e);this.svgNode=t;var n=this.adaptor,r=this.length2em("0.2em"),i=pe.measure.strokeWidth,a=1,o=0,u=1,s=pe.measure.em2px,c=rn.createSVG(this,a,o,u,i,"black",{viewBox:[0,-s(a+o),s(u),s(a+o)].join(" "),role:"img",focusable:!1,overflow:"visible"});pe.svgForDebug=c,pe.svgForTestLayout=c,n.append(t,c.drawArea);var h=this.node.cmd;if(h){if(null==this.shape){var l=new Bt,m=new xt(ft.none,l);h.toShape(m);var p=m.shape;this.shape=p}var f=this.shape;f.draw(c);var d=f.getBoundingBox();if(void 0!==d){var y=(d=new rt.Rect(0,0,{l:Math.max(0,-(d.x-d.l)),r:Math.max(0,d.x+d.r),u:Math.max(0,d.y+d.u),d:Math.max(0,-(d.y-d.d))})).x-d.l-r,v=-d.y-d.u-r,x=d.l+d.r+2*r,g=d.u+d.d+2*r;c.setWidth(x),c.setHeight(g),c.setAttribute("viewBox",[s(y),s(v),s(x),s(g)].join(" "));var w=this.fixed(1)/s(1);n.setAttribute(c.drawArea,"transform","translate("+this.fixed(-y)+","+this.fixed(d.y+pe.measure.axis_height)+") scale("+w+", "+-w+")");var S,b=En(this._textObjects);try{for(b.s();!(S=b.n()).done;){var C=S.value,k=parseFloat(n.getAttribute(C,"data-x")),M=parseFloat(n.getAttribute(C,"data-y")),P=k-y,O=-M+d.y+pe.measure.axis_height;this.place(P,O,C)}}catch(e){b.e(e)}finally{b.f()}}else n.remove(c.drawArea)}else n.remove(c.drawArea)}}],[{key:"styles",get:function(){return{'g[data-mml-node="xypic"] path':{"stroke-width":"inherit"},'.MathJax g[data-mml-node="xypic"] path':{"stroke-width":"inherit"}}}}]),n}(n);t[r.prototype.kind]=r;var i=function(e){Tn(n,e);var t=Fn(n);function n(e,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return Ln(this,n),t.call(this,e,r,i)}return Dn(n,[{key:"kind",get:function(){return Ce.xypic.newdir.prototype.kind}},{key:"computeBBox",value:function(e){var t=this.node.cmd;pe.repositories.dirRepository.put(t.dirMain,t.compositeObject)}},{key:"_toSVG",value:function(e){var t=this.node.cmd;pe.repositories.dirRepository.put(t.dirMain,t.compositeObject)}}]),n}(n);t[i.prototype.kind]=i;var a=function(e){Tn(n,e);var t=Fn(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return Ln(this,n),(i=t.call(this,e,r,a))._setupGraphics(),i.computeBBox(i.bbox),i.bboxComputed=!0,i}return Dn(n,[{key:"kind",get:function(){return Ce.xypic.includegraphics.prototype.kind}},{key:"_setupGraphics",value:function(){this.setupMeasure(this);var e=new Bt,t=new xt(ft.none,e),n=this.node.cmd;if(n.setup(t),!e.includegraphicsWidth.isDefined||!e.includegraphicsHeight.isDefined)throw s("ExecutionError","the 'width' and 'height' attributes of the \\includegraphics are required.");var r=e.includegraphicsWidth.get,i=e.includegraphicsHeight.get;this.imageWidth=this.length2em(r),this.imageHeight=this.length2em(i),this.filepath=n.filepath}},{key:"computeBBox",value:function(e){e.empty(),e.updateFrom(new Ut.bK({w:this.imageWidth,h:this.imageHeight,d:0}))}},{key:"_toSVG",value:function(e){var t=this.standardSVGnode(e);this.svgNode=t;var n=this.fixed(1),r=this.svg("image",{x:"0",y:"0",preserveAspectRatio:"none",width:In(this.imageWidth),height:In(this.imageHeight),transform:"scale("+n+","+-n+") translate(0,"+In(-this.imageHeight)+")"});this.adaptor.setAttribute(r,"xlink:href",this.filepath,"http://www.w3.org/1999/xlink"),this.adaptor.append(t,r)}}]),n}(n);t[a.prototype.kind]=a}void 0!==Pn.y&&zn(Pn.y,On.N);var Qn=MathJax._.components.loader.Loader;Qn&&(MathJax._.output.chtml.Wrapper.CHTMLWrapper||Qn.ready("output/chtml").then((function(){var e=MathJax._.output.chtml;Mn(e.Wrapper.CHTMLWrapper,e.Wrappers_ts.CHTMLWrappers)})).catch((function(e){return console.log("Caught",e)})),MathJax._.output.svg.Wrapper.SVGWrapper||Qn.ready("output/svg").then((function(){var e=MathJax._.output.svg;zn(e.Wrapper.SVGWrapper,e.Wrappers_ts.SVGWrappers)})).catch((function(e){return console.log("Caught",e)})))}()}(); \ No newline at end of file diff --git a/src/output/CHTMLWrappers.js b/src/output/CHTMLWrappers.js index 01ee8aa..87c13a3 100644 --- a/src/output/CHTMLWrappers.js +++ b/src/output/CHTMLWrappers.js @@ -165,9 +165,6 @@ export function CreateCHTMLWrapper(wrapper, wrappers) { const thisRoot = textObjectWrapper.html("mjx-xypic-object"); adaptor.append(parent.getElement(), thisRoot); - // TODO define CSS - adaptor.setStyle(thisRoot, "text-align", "center"); - adaptor.setStyle(thisRoot, "position", "absolute"); adaptor.setStyle(thisRoot, "color", svg.getCurrentColor()); textObjectWrapper.toCHTML(thisRoot); @@ -221,6 +218,10 @@ export function CreateCHTMLWrapper(wrapper, wrappers) { }, '.MathJax mjx-xypic path': { "stroke-width": "inherit" + }, + 'mjx-xypic-object': { + "text-align": "center", + "position": "absolute" } }; }