From 8594eb9cb02241224bfbd96d77a34d9660fd140a Mon Sep 17 00:00:00 2001 From: Philipp Legner Date: Wed, 17 Jan 2024 16:06:29 +0000 Subject: [PATCH] Update dependencies --- frontend/assets/course.css | 2 +- frontend/assets/course.js | 10 +- frontend/assets/icons.svg | 2 +- package-lock.json | 1525 ++++++++++++++++++------------------ package.json | 12 +- 5 files changed, 769 insertions(+), 782 deletions(-) diff --git a/frontend/assets/course.css b/frontend/assets/course.css index aa6a1c1b..d18cd5b2 100644 --- a/frontend/assets/course.css +++ b/frontend/assets/course.css @@ -1,2 +1,2 @@ /* (c) Mathigon, generated by Mathigon Studio */ -@charset "UTF-8";article,aside,audio,canvas,details,figcaption,figure,footer,header,main,nav,section,summary,video{display:block}audio:not([controls]){display:none;height:0}html{-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;font-size:100%}template{display:none}svg{display:block;overflow:hidden}li svg,p svg,td svg{display:inline-block}circle,g,image,line,path,polyline,use{transform-box:fill-box;transform-origin:center}*{-webkit-tap-highlight-color:transparent;color:inherit;cursor:inherit}body,html{margin:0;padding:0}p{hanging-punctuation:first;margin:0 0 1em}h1{font-size:40px;font-weight:400}h2{font-size:28px}h2,h3{font-weight:600}h3{font-size:20px}h1,h2,h3,h4,h5,h6{color:inherit;font-weight:700;line-height:1.1;margin:2em 0 .8em;padding:0;text-rendering:optimizelegibility}a{cursor:pointer}a,a:hover{text-decoration:none}a,button{touch-action:manipulation}button{box-sizing:content-box;-webkit-user-select:none;-moz-user-select:none;user-select:none}.small,small{font-size:80%}.b,b,strong{font-weight:700}.i,dfn,em,i{font-style:italic}sub,sup{font-size:65%;line-height:0;margin:0 .1em;position:relative;vertical-align:baseline}sup{top:-.6em}sub{bottom:-.25em}.text-center{text-align:center}.text-right{text-align:right}.break{-webkit-hyphens:auto;hyphens:auto;word-break:break-all}.nowrap{white-space:nowrap}ol,ul{margin:0 0 1em 1.5em;padding:0;text-align:left}ol ol,ol ul,ul ol,ul ul{margin:.5em 0 0 1.5em}li{margin:0 0 .5em}ol.unstyled,ul.unstyled{list-style:none;margin:0}ol.unstyled li,ul.unstyled li{margin:0}hr{background:#aaa;clear:both;display:block;height:1px;margin:1em 0;padding:0}hr,img{border:0}img{-ms-interpolation-mode:bicubic;height:auto;max-width:100%;vertical-align:middle}figure{margin:0}blockquote{margin:1.5em 0}blockquote,q{font-style:italic}q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:none}.hidden,[hidden]{display:none!important;visibility:hidden!important}table{border-collapse:collapse;border-spacing:0}table,td{border:none}td{vertical-align:top}table.fixed{table-layout:fixed}table.grid td{border-bottom:1px solid #c5c2cc;border-right:1px solid #c5c2cc}table.grid tr td:last-child{border-right:none}table.grid tr:last-child td{border-bottom:none}@media print{body,html{background:transparent;color:#000}h2,h3,p{orphans:3;widows:3}h1,h2,h3{page-break-after:avoid}p a,p a:visited{text-decoration:underline}p a[href]:after{content:" (" attr(href) ")"}blockquote,img,pre,tr{page-break-inside:avoid}img{max-width:100%!important}@page{margin:.5cm}}button,form,input,select,textarea{border:none;margin:0;padding:0}input:invalid{box-shadow:none}button,input,select,textarea{background:transparent;display:inline-block;font-family:inherit;font-size:inherit;font-weight:inherit}input[type=date],input[type=email],input[type=password],input[type=text],textarea{cursor:text}button,select{cursor:pointer}form.form-large{margin:0 auto;max-width:600px}.form-row{display:flex;flex-direction:row;flex-wrap:wrap}.form-row .form-field{flex-grow:1;width:180px}.form-large p{margin:0 8px 16px}.form-large .btn,.form-large .icon-btn,.form-large .next-step{margin:12px 8px}.form-field{display:block;padding:8px;position:relative}.form-field input,.form-field select,.form-field textarea,.form-field-style{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:no-repeat top 12px right 10px/24px 24px;background-color:#f6f6f6;border:1px solid rgba(0,0,0,.1);border-radius:4px;box-sizing:border-box;color:#000;display:block;line-height:1.4em;padding:18px 16px 4px;transition:border .2s,background .2s,box-shadow .2s;width:100%}html[theme=dark] .form-field input,html[theme=dark] .form-field select,html[theme=dark] .form-field textarea,html[theme=dark] .form-field-style{background-color:#43424d;border-color:hsla(0,0%,100%,.5);color:#fff}.form-field input:not([disabled]):focus,.form-field input:not([disabled]):hover,.form-field select:not([disabled]):focus,.form-field select:not([disabled]):hover,.form-field textarea:not([disabled]):focus,.form-field textarea:not([disabled]):hover,.form-field-style:not([disabled]):focus,.form-field-style:not([disabled]):hover{background-color:#eee}html[theme=dark] .form-field input:not([disabled]):focus,html[theme=dark] .form-field input:not([disabled]):hover,html[theme=dark] .form-field select:not([disabled]):focus,html[theme=dark] .form-field select:not([disabled]):hover,html[theme=dark] .form-field textarea:not([disabled]):focus,html[theme=dark] .form-field textarea:not([disabled]):hover,html[theme=dark] .form-field-style:not([disabled]):focus,html[theme=dark] .form-field-style:not([disabled]):hover{background-color:#64646d}.form-field input:not([disabled]):focus,.form-field select:not([disabled]):focus,.form-field textarea:not([disabled]):focus,.form-field-style:not([disabled]):focus{border-color:#0f82f2;box-shadow:0 0 0 3px rgba(15,130,242,.5);outline:none}.form-field input:not([disabled]):focus+.placeholder,.form-field select:not([disabled]):focus+.placeholder,.form-field textarea:not([disabled]):focus+.placeholder,.form-field-style:not([disabled]):focus+.placeholder{color:#0f82f2}.form-field input[disabled],.form-field select[disabled],.form-field textarea[disabled],.form-field-style[disabled]{cursor:default!important;opacity:.6}.form-field input.no-label,.form-field select.no-label,.form-field textarea.no-label,.form-field-style.no-label{background-position:top 5px right 10px;padding-top:4px}.form-field input::-moz-placeholder{opacity:0}.form-field input::placeholder{opacity:0}.form-field input:-moz-placeholder-shown{padding:11px 16px}.form-field input:placeholder-shown{padding:11px 16px}.form-field input:-moz-placeholder-shown+.placeholder{transform:none}.form-field input:placeholder-shown+.placeholder{transform:none}.form-field input.dirty:not(:focus){padding-right:36px}.form-field input.dirty:not(:focus).valid,.form-field input.dirty:not(:focus):valid{background-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%2322ab24%22%20d%3D%22m19.7%206.3-.2-.4-.3-.2c-.1-.1-.3%200-.4%200a36.6%2036.6%200%200%200%20-9.8%208.4%2036.1%2036.1%200%200%200%20-4.8-2.9h-.5l-1%20.9a.4.4%200%200%200%20-.1.3c0%20.2%200%20.3.1.4a72.1%2072.1%200%200%201%206.6%207h.4a.5.5%200%200%200%20.4-.2c3.8-6.8%205.7-9.6%209.4-13%20.2.1.2-.1.2-.3z%22%2F%3E%3C%2Fsvg%3E")}.form-field input.dirty:not(:focus).invalid,.form-field input.dirty:not(:focus):invalid{background-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Crect%20x%3D%2210%22%20y%3D%228%22%20width%3D%224%22%20height%3D%2212%22%20fill%3D%22%23fff%22%2F%3E%3Cpath%20fill%3D%22%23cd0e66%22%20d%3D%22M22.1%2C19.5l-9.2-16a1%2C1%2C0%2C0%2C0-1.8%2C0l-9.2%2C16A1%2C1%2C0%2C0%2C0%2C2.7%2C21H21.3A1%2C1%2C0%2C0%2C0%2C22.1%2C19.5Zm-8.7-11v2.4l-.4%2C4.4H11.1l-.4-4.4V8.5ZM12%2C19.4a1.6%2C1.6%2C0%2C0%2C1-1.6-1.6%2C1.6%2C1.6%2C0%2C1%2C1%2C3.2%2C0A1.6%2C1.6%2C0%2C0%2C1%2C12%2C19.4Z%22%2F%3E%3C%2Fsvg%3E");border-color:#cd0e66}.form-field textarea{height:auto;padding:10px 16px;resize:vertical}.form-field textarea::-moz-placeholder{color:#aaa;opacity:1;-moz-transition:color .2s;transition:color .2s}.form-field textarea::placeholder{color:#aaa;opacity:1;transition:color .2s}.form-field textarea:active::-moz-placeholder,.form-field textarea:focus::-moz-placeholder{color:#0f82f2}.form-field textarea:active::placeholder,.form-field textarea:focus::placeholder{color:#0f82f2}.form-field select{background-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%234d4d4d%22%20d%3D%22m19.9%207.5a1.4%201.4%200%200%200%20-2.1%200l-5.8%205.8-5.8-5.8a1.4%201.4%200%200%200%20-2.1%200%201.5%201.5%200%200%200%200%202.1l6.8%206.9a1.6%201.6%200%200%200%202.2%200l6.8-6.9a1.4%201.4%200%200%200%200-2.1z%22%2F%3E%3C%2Fsvg%3E");padding-right:40px}.form-field .form-error,.form-field .form-hint{font-size:14px;line-height:1.3;margin:4px 17px 0}.form-field .form-error{color:#cd0e66}.form-field .placeholder{color:#aaa;left:24px;line-height:1.4em;pointer-events:none;position:absolute;top:19px;transform:translateY(-7px) scale(.7);transform-origin:top left;transition:transform .2s,color .2s;-webkit-user-select:none;-moz-user-select:none;user-select:none}.form-checkbox{cursor:pointer;display:block;margin:16px 8px;min-height:28px;padding-left:40px;position:relative}.form-checkbox input{left:5px;opacity:0;position:absolute;top:7px}.form-checkbox .control{background:#f6f6f6;border:1px solid rgba(0,0,0,.1);border-radius:4px;height:22px;left:0;position:absolute;top:2px;transition:border .2s,background .2s,box-shadow .2s;width:22px}.form-checkbox .control:after{background:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2221%22%20height%3D%2221%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22m19.7%206.3-.2-.4-.3-.2c-.1-.1-.3%200-.4%200a36.6%2036.6%200%200%200%20-9.8%208.4%2036.1%2036.1%200%200%200%20-4.8-2.9h-.5l-1%20.9a.4.4%200%200%200%20-.1.3c0%20.2%200%20.3.1.4a72.1%2072.1%200%200%201%206.6%207h.4a.5.5%200%200%200%20.4-.2c3.8-6.8%205.7-9.6%209.4-13%20.2.1.2-.1.2-.3z%22%2F%3E%3C%2Fsvg%3E");content:" ";display:block;height:21px;left:1px;position:absolute;top:0;transform:scale(0);transition:transform .4s cubic-bezier(.33,1.9,.52,.7);width:21px}.form-checkbox input:focus+.control,.form-checkbox:hover .control{background:#eee;border-color:#0f82f2}.form-checkbox input:focus+.control{box-shadow:0 0 0 3px rgba(15,130,242,.5);outline:none}.form-checkbox input:checked+.control{background:#0f82f2}.form-checkbox input:checked+.control:after{transform:none}.form-checkbox input:focus:checked+.control,.form-checkbox:hover input:checked+.control{border-color:#053563}.input-field{-webkit-appearance:none;-moz-appearance:textfield;border:1px solid;border-radius:4px;color:inherit;cursor:text;display:block;line-height:1.7em;padding:0;transition:border .2s,background .2s,box-shadow .2s,color .2s}.input-field:focus{border-color:#0f82f2;box-shadow:0 0 0 3px rgba(15,130,242,.5);outline:none}.input-field::-webkit-inner-spin-button,.input-field::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.btn,.icon-btn,.next-step{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#181824;border:none;border-radius:24px;color:hsla(0,0%,100%,.95);cursor:pointer;display:inline-block;font-weight:600;height:2em;letter-spacing:.2px;line-height:2em;min-width:48px;outline:none;padding:0 1.2em;text-align:center;transition:background .2s,color .2s,box-shadow .2s;transition:transform .3s,background .2s,color .2s,box-shadow .2s,opacity .2s;width:auto}.btn.on,.btn:hover,.icon-btn:hover,.next-step:hover,.on.icon-btn,.on.next-step{box-shadow:0 4px 12px rgba(0,0,0,.25);color:#fff;z-index:10}.btn.disabled,.btn[disabled],.disabled.icon-btn,.disabled.next-step,[disabled].icon-btn,[disabled].next-step{box-shadow:none;cursor:default;pointer-events:none}.btn:hover,.icon-btn:hover,.next-step:hover{transform:scale(1.08)}.btn:active,.icon-btn:active,.next-step:active{transform:scale(.92)}.btn:active,.btn:hover,.icon-btn:active,.icon-btn:hover,.next-step:active,.next-step:hover{background-color:#504b5c}html.is-tabbing .btn:focus,html.is-tabbing .icon-btn:focus,html.is-tabbing .next-step:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #181824}.btn.disabled,.btn[disabled],.disabled.icon-btn,.disabled.next-step,[disabled].icon-btn,[disabled].next-step{background-color:#ddd!important;color:#999!important}.btn x-icon,.icon-btn x-icon,.next-step x-icon{fill:currentColor;margin:0 6px -6px 0;opacity:.95;transition:opacity .2s}.btn:active x-icon,.btn:hover x-icon,.icon-btn:active x-icon,.icon-btn:hover x-icon,.next-step:active x-icon,.next-step:hover x-icon{opacity:1}.btn-small{height:1.6em;line-height:1.6em;padding:0 .8em}.btn-large{font-size:22px;height:44px;line-height:44px;padding:0 20px}.btn-large x-icon{margin:0 10px -6px -2px}.btn-large .arrow{margin:0 -2px -1px 6px}.btn-row{margin:-10px}.btn-row .btn,.btn-row .icon-btn,.btn-row .next-step{margin:10px}.btn-red,.next-step{-webkit-touch-callout:none;background-color:#cd0e66;outline:none}.btn-red:focus,.btn-red:hover,.next-step:focus,.next-step:hover{background-color:#ef1579}html.is-tabbing .btn-red:focus,html.is-tabbing .next-step:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #ef1579}.btn-blue{-webkit-touch-callout:none;background-color:#0f82f2;outline:none}.btn-blue:focus,.btn-blue:hover{background-color:#3696f4}html.is-tabbing .btn-blue:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #3696f4}.btn-green{-webkit-touch-callout:none;background-color:#22ab24;outline:none}.btn-green:focus,.btn-green:hover{background-color:#29cd2b}html.is-tabbing .btn-green:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #29cd2b}.btn-yellow{-webkit-touch-callout:none;background-color:#fd8c00;outline:none}.btn-yellow:focus,.btn-yellow:hover{background-color:#ff9e27}html.is-tabbing .btn-yellow:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #ff9e27}.btn-grey{-webkit-touch-callout:none;background-color:#656073;outline:none}.btn-grey:focus,.btn-grey:hover{background-color:#797389}html.is-tabbing .btn-grey:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #797389}.btn-white{-webkit-touch-callout:none;outline:none}.btn-white,.btn-white:focus,.btn-white:hover{background-color:#fff}html.is-tabbing .btn-white:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #fff}.btn-white,.btn-white:active,.btn-white:hover{color:#3a3645}.btn.facebook,.facebook.icon-btn,.facebook.next-step{-webkit-touch-callout:none;background-color:#1878f2;outline:none}.btn.facebook:focus,.btn.facebook:hover,.facebook.icon-btn:focus,.facebook.icon-btn:hover,.facebook.next-step:focus,.facebook.next-step:hover{background-color:#3f8ff4}html.is-tabbing .btn.facebook:focus,html.is-tabbing .facebook.icon-btn:focus,html.is-tabbing .facebook.next-step:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #3f8ff4}.btn.twitter,.twitter.icon-btn,.twitter.next-step{-webkit-touch-callout:none;background-color:#00b6f1;outline:none}.btn.twitter:focus,.btn.twitter:hover,.twitter.icon-btn:focus,.twitter.icon-btn:hover,.twitter.next-step:focus,.twitter.next-step:hover{background-color:#1bc7ff}html.is-tabbing .btn.twitter:focus,html.is-tabbing .twitter.icon-btn:focus,html.is-tabbing .twitter.next-step:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #1bc7ff}.btn.youtube,.youtube.icon-btn,.youtube.next-step{-webkit-touch-callout:none;background-color:red;outline:none}.btn.youtube:focus,.btn.youtube:hover,.youtube.icon-btn:focus,.youtube.icon-btn:hover,.youtube.next-step:focus,.youtube.next-step:hover{background-color:#ff2929}html.is-tabbing .btn.youtube:focus,html.is-tabbing .youtube.icon-btn:focus,html.is-tabbing .youtube.next-step:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #ff2929}.btn.instagram,.instagram.icon-btn,.instagram.next-step{-webkit-touch-callout:none;background-color:#bc2a8d;outline:none}.btn.instagram:focus,.btn.instagram:hover,.instagram.icon-btn:focus,.instagram.icon-btn:hover,.instagram.next-step:focus,.instagram.next-step:hover{background-color:#d33ba2}html.is-tabbing .btn.instagram:focus,html.is-tabbing .instagram.icon-btn:focus,html.is-tabbing .instagram.next-step:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #d33ba2}.btn.pinterest,.pinterest.icon-btn,.pinterest.next-step{-webkit-touch-callout:none;background-color:#cb2027;outline:none}.btn.pinterest:focus,.btn.pinterest:hover,.pinterest.icon-btn:focus,.pinterest.icon-btn:hover,.pinterest.next-step:focus,.pinterest.next-step:hover{background-color:#df353c}html.is-tabbing .btn.pinterest:focus,html.is-tabbing .pinterest.icon-btn:focus,html.is-tabbing .pinterest.next-step:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #df353c}.btn.tumblr,.tumblr.icon-btn,.tumblr.next-step{-webkit-touch-callout:none;background-color:#35465d;outline:none}.btn.tumblr:focus,.btn.tumblr:hover,.tumblr.icon-btn:focus,.tumblr.icon-btn:hover,.tumblr.next-step:focus,.tumblr.next-step:hover{background-color:#445a77}html.is-tabbing .btn.tumblr:focus,html.is-tabbing .tumblr.icon-btn:focus,html.is-tabbing .tumblr.next-step:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #445a77}.btn.reddit,.reddit.icon-btn,.reddit.next-step{-webkit-touch-callout:none;background-color:#ff5700;outline:none}.btn.reddit:focus,.btn.reddit:hover,.reddit.icon-btn:focus,.reddit.icon-btn:hover,.reddit.next-step:focus,.reddit.next-step:hover{background-color:#ff7229}html.is-tabbing .btn.reddit:focus,html.is-tabbing .reddit.icon-btn:focus,html.is-tabbing .reddit.next-step:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #ff7229}.btn.microsoft,.microsoft.icon-btn,.microsoft.next-step{-webkit-touch-callout:none;background-color:#2f2f2f;outline:none}.btn.microsoft:focus,.btn.microsoft:hover,.microsoft.icon-btn:focus,.microsoft.icon-btn:hover,.microsoft.next-step:focus,.microsoft.next-step:hover{background-color:#434343}html.is-tabbing .btn.microsoft:focus,html.is-tabbing .microsoft.icon-btn:focus,html.is-tabbing .microsoft.next-step:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #434343}.btn.google,.google.icon-btn,.google.next-step{background:#fff;box-shadow:inset 0 0 0 1px #aaa;color:#3a3645}.btn.google:hover,.google.icon-btn:hover,.google.next-step:hover{box-shadow:inset 0 0 0 1px #aaa,0 4px 12px rgba(0,0,0,.25)}html.is-tabbing .btn.google:focus,html.is-tabbing .google.icon-btn:focus,html.is-tabbing .google.next-step:focus{box-shadow:inset 0 0 0 1px #aaa,0 0 0 2px #fff,0 0 0 4px #656073}.icon-btn{border-radius:20px;display:block;height:40px;min-width:40px;padding:0}.icon-btn x-icon{display:block;margin:8px}@font-face{font-family:Mathigon Symbol;font-style:normal;font-weight:400;src:url(/fonts/mathigon-symbol.woff2) format("woff2"),url(/fonts/mathigon-symbol.woff) format("woff")}.math,math{display:inline-block;font-style:normal;font-weight:400;margin:0 .1em}.nowrap .math,.nowrap math{margin-right:0}mfenced,mfrac,mi,mn,mo,mroot,mrow,ms,msqrt,msub,msup,mtext{display:inline-block;font-family:Mathigon Symbol,Source Sans Pro,sans-serif;font-size:inherit;line-height:1;white-space:nowrap}mi[mathvariant=normal]{font-family:Source Sans Pro,sans-serif}mi{line-height:.9}mo{margin:0 .25em}mn+.cursor+mi,mn+mi{margin-left:.1em}mi+mi{margin-left:.05em}mfrac+.coursor+mi,mfrac+.cursor+mtext,mfrac+mi,mfrac+mtext{margin-left:.15em}mo[value=−]:first-child{margin:0 .1em}mo[value="="],mo[value=≈]{margin:0 .4em}mo[value=∡],mo[value=△]{margin:0}.cursor:first-child+mo,mn+mo[value=…],mo+.cursor+mo,mo+.cursor+mo[value],mo+mo,mo+mo[value],mo:first-child,mo[lspace="0"],mo[value=°],mo[value=’]{margin-left:0}mo:last-child,mo[rspace="0"]{margin-right:0}mtext{font-family:Source Sans Pro,Helvetica,sans-serif}mspace{padding:0 .2em}mphantom{visibility:hidden}ms:after,ms:before{content:'"'}ms[lquote]:before{content:attr(lquote)}ms[rquote]:after{content:attr(rquote)}msubsup>:nth-child(3),msup>:last-child{font-size:67%;margin:-.2em .1em 0 .15em;vertical-align:top}msub>:last-child,msubsup>:nth-child(2){font-size:67%;margin:0 .1em -.2em;vertical-align:bottom}mfrac,msub>:last-child mo,msubsup>:nth-child(3) mo,msup>:last-child mo{margin:0 .1em}mfrac{font-size:.6em;vertical-align:-.2em}mfrac>*{display:block;text-align:center}mfrac>:first-child{padding-bottom:.06em}mfrac>:last-child{border-top:1px solid;float:right;padding-top:.06em;width:100%}mfrac:after{content:" ";visibility:hidden;width:0}.display mfrac,.text-center:not(.inline) mfrac,table mfrac{font-size:1em;vertical-align:-.45em}.display mfrac mfrac,.text-center:not(.inline) mfrac mfrac,mfrac mfrac{font-size:75%;vertical-align:-.25em}mroot,msqrt{border-top:1px solid;margin-left:9px;padding:.1em .1em 0 .2em;position:relative}mroot:before,msqrt:before{background:currentColor;bottom:0;content:"";left:-11px;-webkit-mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2213%22%20height%3D%2222%22%3E%3Cpath%20d%3D%22M3%2C11.72l-1.56.7-.42-1%2C2.93-1.3%2C2.55%2C7.61c.15.46.26.95.37%2C1.41h.09c.09-.46.18-.95.26-1.41L11.12%2C1h1.32L7.67%2C21.13H6.28Z%22%2F%3E%3C%2Fsvg%3E");mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2213%22%20height%3D%2222%22%3E%3Cpath%20d%3D%22M3%2C11.72l-1.56.7-.42-1%2C2.93-1.3%2C2.55%2C7.61c.15.46.26.95.37%2C1.41h.09c.09-.46.18-.95.26-1.41L11.12%2C1h1.32L7.67%2C21.13H6.28Z%22%2F%3E%3C%2Fsvg%3E");-webkit-mask-size:100% 100%;mask-size:100% 100%;position:absolute;top:-2px;width:13px}mroot>:last-child{font-size:67%;margin-top:-5px;position:absolute;right:calc(100% + 5px)}mfenced{margin:0 calc(5px + .1em);padding:.05em .1em;position:relative}mfenced:after,mfenced:before{bottom:-1px;content:"";top:-1px;width:5px}mfenced:before{left:-4px;-webkit-mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%225%22%20height%3D%2222%22%3E%3Cpath%20d%3D%22M0%2C11A18.32%2C18.32%2C0%2C0%2C1%2C2.91%2C1L4%2C1.53A18.32%2C18.32%2C0%2C0%2C0%2C1.5%2C11%2C18.33%2C18.33%2C0%2C0%2C0%2C4%2C20.47L2.91%2C21A18.32%2C18.32%2C0%2C0%2C1%2C0%2C11Z%22%2F%3E%3C%2Fsvg%3E");mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%225%22%20height%3D%2222%22%3E%3Cpath%20d%3D%22M0%2C11A18.32%2C18.32%2C0%2C0%2C1%2C2.91%2C1L4%2C1.53A18.32%2C18.32%2C0%2C0%2C0%2C1.5%2C11%2C18.33%2C18.33%2C0%2C0%2C0%2C4%2C20.47L2.91%2C21A18.32%2C18.32%2C0%2C0%2C1%2C0%2C11Z%22%2F%3E%3C%2Fsvg%3E")}mfenced:after,mfenced:before{background:currentColor;-webkit-mask-size:100% 100%;mask-size:100% 100%;position:absolute}mfenced:after{-webkit-mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%225%22%20height%3D%2222%22%3E%3Cpath%20d%3D%22M1%2C20.47A18.33%2C18.33%2C0%2C0%2C0%2C3.5%2C11%2C18.32%2C18.32%2C0%2C0%2C0%2C1%2C1.53L2.09%2C1A18.32%2C18.32%2C0%2C0%2C1%2C5%2C11%2C18.32%2C18.32%2C0%2C0%2C1%2C2.09%2C21Z%22%2F%3E%3C%2Fsvg%3E");mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%225%22%20height%3D%2222%22%3E%3Cpath%20d%3D%22M1%2C20.47A18.33%2C18.33%2C0%2C0%2C0%2C3.5%2C11%2C18.32%2C18.32%2C0%2C0%2C0%2C1%2C1.53L2.09%2C1A18.32%2C18.32%2C0%2C0%2C1%2C5%2C11%2C18.32%2C18.32%2C0%2C0%2C1%2C2.09%2C21Z%22%2F%3E%3C%2Fsvg%3E");right:-4px}mfenced[open="|"]{border-left:1px solid;border-right:1px solid;margin:0 .1em;padding:0 .1em}mfenced[open="|"]:after,mfenced[open="|"]:before{content:none}mfenced[open="["]:before{content:"["}mfenced[close="]"]:after{content:"]"}mfenced[open="{"]:before{content:"{"}mfenced[close="}"]:after{content:"}"}mover,munder{position:relative}mover>:nth-child(2){font-size:0;height:5px;left:0;position:absolute;right:0}mover>[value=‾]:nth-child(2){-webkit-mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2221%22%20height%3D%225%22%3E%3Cpath%20d%3D%22M0%2C2L21%2C2L21%2C3L0%2C3Z%22%2F%3E%3C%2Fsvg%3E");mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2221%22%20height%3D%225%22%3E%3Cpath%20d%3D%22M0%2C2L21%2C2L21%2C3L0%2C3Z%22%2F%3E%3C%2Fsvg%3E");top:0}mover>[value=‾]:nth-child(2),mover>[value=→]:nth-child(2){background:currentColor;-webkit-mask-size:100% 100%;mask-size:100% 100%;position:absolute}mover>[value=→]:nth-child(2){-webkit-mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2221%22%20height%3D%225%22%3E%3Cpath%20d%3D%22M21%2C2.5L15.7%2C0.3L16.5%2C2L0%2C2L0%2C3L16.5%2C3L15.7%2C4.7L21%2C2.5Z%22%2F%3E%3C%2Fsvg%3E");mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2221%22%20height%3D%225%22%3E%3Cpath%20d%3D%22M21%2C2.5L15.7%2C0.3L16.5%2C2L0%2C2L0%2C3L16.5%2C3L15.7%2C4.7L21%2C2.5Z%22%2F%3E%3C%2Fsvg%3E");top:-2px}mover>[value=↔]:nth-child(2){-webkit-mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2221%22%20height%3D%225%22%3E%3Cpath%20d%3D%22M21%2C2.5L15.7%2C0.3L16.5%2C2L4.5%2C2L5.3%2C0.3L0%2C2.5L5.3%2C4.7L4.5%2C3L16.5%2C3L15.7%2C4.7L21%2C2.5Z%22%2F%3E%3C%2Fsvg%3E");mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2221%22%20height%3D%225%22%3E%3Cpath%20d%3D%22M21%2C2.5L15.7%2C0.3L16.5%2C2L4.5%2C2L5.3%2C0.3L0%2C2.5L5.3%2C4.7L4.5%2C3L16.5%2C3L15.7%2C4.7L21%2C2.5Z%22%2F%3E%3C%2Fsvg%3E")}mover>[value=↔]:nth-child(2),mover>[value=⌒]:nth-child(2){background:currentColor;-webkit-mask-size:100% 100%;mask-size:100% 100%;position:absolute;top:-2px}mover>[value=⌒]:nth-child(2){-webkit-mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2221%22%20height%3D%225%22%3E%3Cpath%20d%3D%22M20.5%2C4.5a.52.52%2C0%2C0%2C1-.29-.09A17.1%2C17.1%2C0%2C0%2C0%2C10.5%2C1.5%2C17.1%2C17.1%2C0%2C0%2C0%2C.79%2C4.41a.5.5%2C0%2C0%2C1-.7-.13.5.5%2C0%2C0%2C1%2C.12-.69A18.22%2C18.22%2C0%2C0%2C1%2C10.5.5%2C18.22%2C18.22%2C0%2C0%2C1%2C20.79%2C3.59a.5.5%2C0%2C0%2C1%2C.12.69A.5.5%2C0%2C0%2C1%2C20.5%2C4.5Z%22%2F%3E%3C%2Fsvg%3E");mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2221%22%20height%3D%225%22%3E%3Cpath%20d%3D%22M20.5%2C4.5a.52.52%2C0%2C0%2C1-.29-.09A17.1%2C17.1%2C0%2C0%2C0%2C10.5%2C1.5%2C17.1%2C17.1%2C0%2C0%2C0%2C.79%2C4.41a.5.5%2C0%2C0%2C1-.7-.13.5.5%2C0%2C0%2C1%2C.12-.69A18.22%2C18.22%2C0%2C0%2C1%2C10.5.5%2C18.22%2C18.22%2C0%2C0%2C1%2C20.79%2C3.59a.5.5%2C0%2C0%2C1%2C.12.69A.5.5%2C0%2C0%2C1%2C20.5%2C4.5Z%22%2F%3E%3C%2Fsvg%3E")}.snackbar{left:50%;position:fixed;top:52px;transform:translateX(-50%);z-index:500}x-alert{background:#000;border-radius:6px;box-shadow:0 3px 8px rgba(0,0,0,.3);color:#fff;display:none;font-size:16px;line-height:1.4;max-width:300px;padding:8px 20px;width:-moz-max-content;width:max-content}x-alert x-icon{float:left;margin:-2px 6px 20px -4px}x-alert.error{background:#b50c5a}x-alert.warn{background:#e47e00}x-alert.success{background:#1e9620}x-icon{fill:currentColor;display:inline-block;height:24px;width:24px}x-icon svg{display:block}x-icon[name=warning]{fill:#cd0e66}.button x-icon{margin:-10px 3px -10px -8px}.modal-background{-webkit-backdrop-filter:blur(4px);background:rgba(0,0,0,.8);bottom:0;display:none;left:0;position:fixed;right:0;top:44px;transition:background .4s;z-index:400}.modal-background.light{background:hsla(0,0%,100%,.9)}html.webview .modal-background{top:0}x-modal{background:#fff;border-radius:12px;box-shadow:0 6px 32px rgba(0,0,0,.8);box-sizing:border-box;display:none;left:50%;margin-top:22px;max-height:calc(100vh - 84px);max-width:calc(100% - 40px);position:fixed;top:50%;transform:translate(-50%,-50%);width:520px;z-index:401}html[theme=dark] x-modal{background:#2d2c38}x-modal.light{box-shadow:0 4px 20px rgba(0,0,0,.25)}html.webview x-modal{margin-top:0;max-height:calc(100% - 40px)}x-modal .modal-body{-webkit-overflow-scrolling:touch;box-sizing:border-box;height:100%;max-height:calc(100vh - 84px);overflow:auto;overscroll-behavior:contain;padding:24px}@media screen and (max-height:720px){x-modal.interactive{top:42px;transform:translate(-50%)}}.is-safari:not(.is-webview) x-modal,.is-safari:not(.is-webview) x-modal .modal-body{max-height:calc(100vh - 200px)}x-modal h2{margin-top:0}x-modal h2 x-icon{margin:-6px 4px -6px -2px}x-modal h3{margin:1.5em 0 .8em}x-modal h3 x-icon{margin:0 5px -5px 0}x-modal .btn-row{margin:0;text-align:right}x-modal .form-large{margin:0 -8px -10px}x-modal p:last-child:not(.btn-row),x-modal ul:last-child{margin-bottom:0}x-modal .form-checkbox{margin:16px 0}x-modal hr{margin:1.5em 0}x-modal .close{fill:rgba(0,0,0,.4);cursor:pointer;display:block;padding:8px;position:absolute;right:0;top:0;transition:transform .2s,color .2s;z-index:10}html[theme=dark] x-modal .close{fill:hsla(0,0%,100%,.4)}x-modal .close:hover{color:#000;transform:scale(1.4)}html[theme=dark] x-modal .close:hover{color:#fff}x-modal.video{background:#000;border-radius:0;width:1200px}x-modal.video .video-wrap{height:0;padding-bottom:56.25%;position:relative}x-modal.video iframe,x-modal.video video{height:100%;position:absolute;width:100%}x-modal.video .close x-icon{fill:hsla(0,0%,100%,.8);top:-40px}header{background:#181824;box-shadow:0 0 12px rgba(0,0,0,.25);color:#fff;display:flex;height:44px;justify-content:space-between;position:fixed;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%;z-index:450}header #logo,header .nav-link{display:block;font-size:18px;height:44px;line-height:44px}header #logo{box-sizing:border-box;margin-right:-12px;padding:4px 4px 4px 16px}header #logo img,header #logo svg{float:left;height:36px;width:auto}header #logo span{display:inline-block;float:left;line-height:36px;margin:0 8px}header #skip-nav{background:#3a3645;border:2px solid #181824;border-radius:30px;height:32px;left:-9999px;padding:2px 18px;position:absolute;top:2px;z-index:9999}html.is-tabbing header #skip-nav:focus{left:2px}header nav{display:flex}header .nav-link{cursor:pointer;opacity:.8;padding:0 16px;transition:opacity .2s,background .2s}header .nav-link:focus,header .nav-link:hover{background:#4b4757;opacity:1}header .nav-link x-icon{margin:0 8px -6px -2px;vertical-align:baseline}header .nav-link.narrow{padding:0 12px}header .nav-link.narrow x-icon{display:block;margin:0}header .nav-link.popup-target{padding-right:18px}header .nav-item.open .nav-link{background:#4b4757;opacity:1}header .nav-user-icon{border:1px solid hsla(0,0%,100%,.5);border-radius:100%;display:block;height:28px;width:28px}header .popup-body{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background:rgba(24,24,36,.91);background-clip:content-box;border-bottom:1px solid hsla(0,0%,100%,.3);border-left:1px solid hsla(0,0%,100%,.3);border-radius:0 0 0 6px;display:none;position:absolute;right:0;top:44px}header .popup-body .nav-link{box-sizing:border-box;color:hsla(0,0%,100%,.8);padding:0 18px;position:relative;text-align:left;transition:background .2s,color .2s;white-space:nowrap;width:100%}header .popup-body .nav-link:before{background:hsla(0,0%,100%,.4);content:" ";display:block;height:1px;position:absolute;top:0;transition:background-color .2s;width:calc(100% - 36px)}header .popup-body .nav-link:first-child:before{display:none}header .popup-body .nav-link.active,header .popup-body .nav-link.on,header .popup-body .nav-link:focus,header .popup-body .nav-link:hover{background:hsla(0,0%,100%,.2);color:#fff}header .popup-body .nav-link.active+:before,header .popup-body .nav-link.active:before,header .popup-body .nav-link.on+:before,header .popup-body .nav-link.on:before,header .popup-body .nav-link:focus+:before,header .popup-body .nav-link:focus:before,header .popup-body .nav-link:hover+:before,header .popup-body .nav-link:hover:before{background:transparent}header .popup-body .nav-link.active,header .popup-body .nav-link.on{background:hsla(0,0%,100%,.32)}header .popup-body .nav-link.logout{max-width:300px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header .popup-body .nav-link:last-child{border-radius:0 0 0 6px}header .popup-body .nav-link img{float:right;margin:10px 2px 0 12px}header .popup-body .nav-link .form-checkbox{float:right;margin:8px 2px 0 12px;padding-left:24px}@media (max-width:840px){header .nav-link{padding:0 12px}header .nav-link.narrow{padding:0 10px}header .nav-link x-icon{margin-right:6px}}@media (max-width:760px){header .nav-item>.nav-link{height:36px;padding:4px 8px}header .nav-item>.nav-link x-icon{display:block;height:24px;margin:0 auto;width:24px}header .nav-text{display:block;font-size:10px;line-height:12px;text-align:center}}x-modal#language{-webkit-user-select:none;-moz-user-select:none;user-select:none;width:540px}.locale-list{-moz-column-count:3;column-count:3}@media (max-width:560px){.locale-list{-moz-column-count:2;column-count:2}}@media (max-width:420px){.locale-list{-moz-column-count:1;column-count:1}}.locale-link{-webkit-column-break-inside:avoid;border-radius:6px;display:block;margin:2px 0;overflow:hidden;padding:4px 8px;text-overflow:ellipsis;transition:background .2s;white-space:nowrap}.locale-link:hover{background:#e2e1e6}html[theme=dark] .locale-link:hover{background:hsla(0,0%,100%,.2)}.locale-link img{margin-right:8px}#search{width:480px}#search .modal-body{overflow:visible;padding:12px}#search .form-field{padding:0}#search .form-field input{border-radius:40px;font-size:24px;line-height:32px;padding:8px 16px 8px 48px}#search .form-field input::-moz-placeholder{color:inherit;opacity:.5}#search .form-field input::placeholder{color:inherit;opacity:.5}#search .form-field input:focus{box-shadow:0 0 0 3px #87c1f9}#search .form-field x-icon{fill:currentColor;left:13px;position:absolute;top:11px}#search .search-body{max-height:calc(100vh - 160px);min-height:180px;overflow:auto;padding:8px 8px 6px 48px}#search .search-body:after,#search .search-body:before{clear:both;content:" ";display:table}@media screen and (max-width:420px){#search .search-body{padding-left:8px}}#search .search-section{font-size:14px;font-weight:600;text-transform:uppercase}#search .search-result{border-radius:6px;display:block;height:48px;line-height:1.2;margin:0 -6px;padding:6px;transition:background .2s}#search .search-result:focus,#search .search-result:hover{background:#e2e1e6}html[theme=dark] #search .search-result:focus,html[theme=dark] #search .search-result:hover{background:hsla(0,0%,100%,.2)}#search .search-img{background:#000 50%;background-size:cover;border-radius:4px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.2);float:left;height:48px;margin-right:10px;width:48px}#search .search-subtitle{color:#aaa;font-size:14px;margin-top:4px}#search .search-subtitle,#search .search-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#search .search-title{font-size:20px;font-weight:600}#search .search-gloss{background:#fed199;border-radius:6px;font-size:16px;line-height:1.4;margin:6px 0;padding:8px 14px}#search .search-gloss:after,#search .search-gloss:before{clear:both;content:" ";display:table}#search .search-gloss img{border:0;float:right;margin:0 -12px 0 0;width:160px}#search .search-gloss .math,#search .search-gloss x-math{white-space:nowrap}#search .search-gloss li,#search .search-gloss p,#search .search-gloss ul{margin-bottom:.3em}#search .search-gloss li:last-child,#search .search-gloss p:last-child,#search .search-gloss ul:last-child{margin-bottom:0}#search .no-results{color:#aaa;margin-top:32px;padding-right:32px;text-align:center}@media screen and (max-width:420px){#search .no-results{padding:0}}#search .no-results x-icon{fill:#aaa;display:block;margin:0 auto}.global-footer{border-top:1px solid #ccc;color:#aaa;display:flex;font-size:15px;margin:50px 0 40px;padding-top:6px}.global-footer .footer-left{flex-grow:1}.global-footer .footer-right{text-align:right}.global-footer .footer-row{margin:4px 0}.global-footer button{cursor:pointer;line-height:inherit;margin-left:24px;position:relative}.global-footer button img{left:-24px;position:absolute;top:2px}.global-footer .dot{display:inline-block;margin:0 8px}.global-footer .footer-left a,.global-footer button{background-image:linear-gradient(transparent calc(100% - 2px),currentColor calc(100% - 2px),currentColor calc(100% - 1px),transparent calc(100% - 1px));background-repeat:no-repeat;background-size:0 100%;display:inline-block;transition:color .2s,background-size .2s ease-in-out}.global-footer .footer-left a:hover,.global-footer button:hover{background-size:100% 100%;color:#333}html[theme=dark] .global-footer .footer-left a:hover,html[theme=dark] .global-footer button:hover{color:#fff}.global-footer .footer-social{color:#aaa;display:inline-block;margin:-5px 0 -11px;padding:6px 3px;transition:color .2s}.global-footer .footer-social x-icon{display:block}.global-footer .footer-social:hover{color:#333}html[theme=dark] .global-footer .footer-social:hover{color:#fff}@media (max-width:760px){.global-footer{display:block;font-size:16px;margin-bottom:30px}.global-footer .footer-left,.global-footer .footer-right{text-align:center}.global-footer .footer-row{margin-bottom:10px}.global-footer .footer-social{padding:6px}.global-footer .footer-social svg{height:28px;margin:0 4px;width:28px}.global-footer button img{height:20px;left:-26px;top:3px;width:20px}}.course{border-top:1px solid #c5c2cc;-moz-column-count:2;column-count:2;-moz-column-gap:10px;column-gap:10px;min-height:80px;padding:18px 0 18px 90px;position:relative}@media screen and (max-width:660px){.course{-moz-column-count:1;column-count:1}}.course .course-img{background-size:cover;border-radius:6px;height:80px;left:0;position:absolute;top:18px;width:80px}.course h3{-moz-column-span:all;column-span:all;margin:0 0 8px 8px}.course h3 img{margin:-4px 0 0 8px}.course .course-banner{border-radius:20px;color:#fff;float:right;font-size:14px;font-weight:400;margin:0 0 4px 6px;padding:2px 10px}.course .course-section{-moz-column-break-inside:avoid;border-radius:4px;break-inside:avoid;font-size:16px;line-height:1.2;padding:7px 8px 7px 34px;page-break-inside:avoid}.course .course-section.locked{color:#aaa;position:relative}.course .course-section.locked .tooltip{background:#656073;left:auto;padding:1px 10px;right:0;top:7px;transform:none}.course a.course-section{display:block;outline:none;transition:background .2s}.course a.course-section:focus,.course a.course-section:hover{background:#e2e1e6}html[theme=dark] .course a.course-section:focus,html[theme=dark] .course a.course-section:hover{background:hsla(0,0%,100%,.2)}.course .course-section.locked x-icon,.course x-progress{fill:#c5c2cc;display:inline-block;margin:0 6px -4px -26px}html{background-color:#fff;cursor:default;font-family:Source Sans Pro,Helvetica,sans-serif;font-size:18px;line-height:1.6;min-width:320px;touch-action:manipulation}html[theme=dark]{background:#22212e}html:not(.ready) *{animation:none!important;transition:none!important}html:not(.is-tabbing) :focus{outline:none!important}html.grabbing,html.grabbing *{cursor:grabbing!important}body{color:#333}html[theme=dark] body{color:hsla(0,0%,100%,.9)}main{padding-top:44px}html.webview main{padding-top:0}.container{margin:0 auto;max-width:calc(100% - 48px);position:relative;width:1000px}.container.narrow{width:800px}.container.wide{width:1200px}.panel.narrow{margin:0 auto;max-width:800px}svg.mathjax{display:inline-block}svg.mathjax g,svg.mathjax path,svg.mathjax use{transform-box:initial;transform-origin:0 0}.is-mobile .only-desktop,.not-mobile .only-mobile,.not-touch .only-touch{display:none!important}@media screen and (max-width:480px){.xs-hide{display:none!important}}@media screen and (max-width:640px){.s-hide{display:none!important}}@media screen and (min-width:641px){.l-hide{display:none!important}}@media screen and (min-width:801px){.xl-hide{display:none!important}}.invert{filter:none}html[theme=dark] .invert{filter:invert(1)}.r{position:relative}.column,.row{display:flex;flex-wrap:wrap;justify-content:center}.column{flex-direction:column}.row.right{flex-direction:row-reverse}.column.padded,.row.padded{margin:-24px}.column.padded>*,.row.padded>*{margin:24px}.column.padded-thin,.row.padded-thin{margin:-12px}.column.padded-thin>*,.row.padded-thin>*{margin:12px}.column .grow,.row .grow{flex-grow:1}.column .shrink,.row .shrink{flex-shrink:1}.row>*>h2:first-child,.row>*>h3:first-child{margin-top:0}.padded-thin>*>p:last-child,.padded>*>p:last-child{margin-bottom:0}.text-medium{color:#999}button.a,label a,ol a,p a,ul a{background-image:linear-gradient(transparent calc(100% - 3px),currentColor calc(100% - 3px),currentColor calc(100% - 1px),transparent calc(100% - 1px));background-repeat:no-repeat;background-size:0 100%;color:#0f82f2;transition:color .2s,background-size .2s ease-in-out}button.a:hover,label a:hover,ol a:hover,p a:hover,ul a:hover{background-size:100% 100%}.caption{color:#888;font-size:80%;margin:0 0 .6em;text-align:left}.emoji{display:inline-block;font-size:inherit;height:20px;line-height:normal;margin:-4px 2px 0;vertical-align:middle;width:20px}img.emoji{width:auto}.tooltip{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background:#181824;border:1px solid #fff;border-radius:16px;color:#fff;font-size:14px;left:50%;line-height:18px;opacity:0;padding:2px 12px;pointer-events:none;position:absolute;top:-22px;transform:translateX(-50%);transition:opacity .1s;white-space:nowrap;z-index:9999}.is-tabbing.not-mobile :focus>.tooltip,.not-mobile :hover>.tooltip{opacity:.8}.alert{background:rgba(253,140,0,.4);border-radius:4px;margin-bottom:2em;padding:12px 44px 12px 20px;position:relative}.alert.fail{background:rgba(205,14,102,.4)}.alert.success{background:rgba(34,171,36,.4)}.alert p:last-child{margin:0}.alert .close{cursor:pointer;font-size:30px;font-weight:700;opacity:.6;padding:0 13px;position:absolute;right:0;top:0}.alert .close:hover{opacity:1}.warning{background:#181824 url(/images/tiles.png);background-size:240px 240px;bottom:0;display:block;left:0;position:fixed;right:0;top:0;z-index:900}.warning-body{left:50%;max-width:calc(100% - 48px);position:absolute;top:50%;transform:translate(-50%,-50%)}.warning-body svg{height:100px;margin:0 auto 20px;width:100px}.warning-body p{background:#cd0e66;border-radius:4px;color:#fff;padding:8px 16px;text-align:center}.warning-body a:hover{color:#3f9bf5}.cookie-warning{background:#b50c5a;border-radius:4px;bottom:10px;box-shadow:0 3px 6px rgba(0,0,0,.3);box-sizing:border-box;color:#fff;left:10px;line-height:1.4;max-width:calc(100vw - 20px);padding:10px 16px 12px;position:fixed;z-index:800}.cookie-warning h2{color:hsla(0,0%,100%,.8);font-size:24px;font-weight:100;margin:0 0 6px}.cookie-warning p{margin-bottom:12px}.cookie-warning .btn,.cookie-warning .icon-btn,.cookie-warning .next-step{color:#b50c5a}.cookie-warning .close{cursor:pointer;opacity:.6;padding:12px;position:absolute;right:2px;top:2px;transition:opacity .2s}.cookie-warning .close:hover{opacity:1}.cookie-warning x-icon{display:block}x-blank,x-blank-mc{display:inline-block;position:relative}x-blank-mc.done,x-blank.done{display:inline;white-space:normal}x-blank .target,x-blank-mc .target{-webkit-touch-callout:none;background:transparent;background:#0f82f2;border-radius:6px;color:#fff;cursor:pointer;display:inline-block;line-height:28px;margin:-3px 2px;padding:0 6px;position:relative;text-align:center;transition:border-radius .2s,background .2s,color .2s,margin .2s,padding .2s,width .2s,min-width .2s,box-shadow .2s}.caption x-blank .target,.caption x-blank-mc .target{height:24px;line-height:24px}x-blank .target:before,x-blank-mc .target:before{background:none;bottom:1px;content:" ";height:3px;left:5px;position:absolute;right:5px}x-blank-mc.on .target,x-blank-mc:hover .target,x-blank.on .target,x-blank:hover .target{box-shadow:0 0 10px rgba(0,0,0,.2)}mfrac x-blank .target,mfrac x-blank-mc .target{margin:0 2px}mfrac x-blank-mc.done .target,mfrac x-blank.done .target{line-height:1}x-blank-mc.invalid .target:before,x-blank.invalid .target:before{background:#cd0e66;border-radius:5px 0 0 5px;bottom:0;color:#fff;content:"×";display:block;font-weight:700;height:auto;left:0;line-height:1;padding:4px 0 3px;position:absolute;text-align:center;top:0;width:20px}x-blank-mc.done .target,x-blank.done .target{background:transparent;background-image:none;box-shadow:none;color:#0f82f2;cursor:default;display:inline;margin:0;min-width:0;padding:1px 0 0}x-blank-mc.done:hover .target,x-blank.done:hover .target{color:#0f82f2}x-blank .target{cursor:text;padding:0}x-blank.invalid .target{padding-left:20px}x-blank input{background:none!important;color:inherit;margin:0;min-width:60px;text-align:center;width:40px}x-blank input:focus{color:#fff}html.is-tabbing x-blank input:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #0f82f2;outline:none}x-blank ::-webkit-input-placeholder{color:inherit!important;opacity:1!important}x-blank :-moz-placeholder,x-blank ::-moz-placeholder{color:inherit!important;opacity:1!important}x-blank-mc .target{line-height:24px;min-width:50px;padding:2px 12px}x-blank-mc.invalid .target{padding-left:30px}html.is-tabbing x-blank-mc .target:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #0f82f2;outline:none}x-blank-mc .popup{background:#0e75da;border-radius:0 6px 6px 6px;box-shadow:0 0 20px rgba(0,0,0,.3);font-style:normal;left:2px;min-width:90px;opacity:0;pointer-events:none;position:absolute;text-align:left;top:100%;transform:scale(.5);transform-origin:left top;transition:opacity .2s,transform .2s;white-space:normal;width:-moz-max-content;width:max-content}.caption x-blank-mc .popup{top:24px}x-blank-mc.left .popup{border-radius:6px 0 6px 6px;left:auto;right:2px;transform-origin:right top}x-blank-mc.top .popup{border-radius:6px 6px 6px 0;bottom:100%;top:auto;transform-origin:left bottom}x-blank-mc.left.top .popup{border-radius:6px 6px 0 6px;transform-origin:right bottom}.caption x-blank-mc.top .popup{bottom:24px}x-blank-mc strong{color:#fff}x-blank-mc.done strong{color:#0f82f2}x-blank-mc.on,x-blank-mc:focus-within{z-index:100}x-blank-mc.on .target,x-blank-mc:focus-within .target{border-radius:5px 5px 0 0}x-blank-mc.on.top .target,x-blank-mc:focus-within.top .target{border-radius:0 0 5px 5px}x-blank-mc.on.invalid .target:before,x-blank-mc:focus-within.invalid .target:before{border-radius:5px 0 0 0}x-blank-mc.on.top.invalid .target:before,x-blank-mc:focus-within.top.invalid .target:before{border-radius:0 0 0 5px}x-blank-mc.on .popup,x-blank-mc:focus-within .popup{opacity:1;pointer-events:all;transform:none}x-blank-mc .choice{box-sizing:border-box;color:hsla(0,0%,100%,.8);cursor:pointer;display:block;font-size:16px;line-height:22px;padding:6px 16px 6px 12px;text-align:left;transition:color .2s,background .2s,box-shadow .2s;width:100%}x-blank-mc .choice:focus,x-blank-mc .choice:hover{background:hsla(0,0%,100%,.2);color:#fff}html.is-tabbing x-blank-mc .choice:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #0f82f2;outline:none}x-blank-mc .choice:first-child{border-top-right-radius:6px}x-blank-mc .choice:last-child{border-radius:0 0 6px 6px}x-blank-mc .choice:before{background:hsla(0,0%,100%,.5);content:" ";display:block;height:1px;left:12px;margin-top:-6px;position:absolute;right:16px;transition:background .2s}x-blank-mc .choice:first-child:before,x-blank-mc .choice:focus+.choice:before,x-blank-mc .choice:focus:before,x-blank-mc .choice:hover+.choice:before,x-blank-mc .choice:hover:before{background:transparent}x-free-text{display:block;margin:1.5em 0;position:relative}x-free-text .text-area{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#f5f5f6;border:1px solid #ccc;border-radius:6px;color:#333;cursor:text;height:auto;line-height:1.4em;padding:10px 16px 42px;transition:background .2s,border .2s,box-shadow .2s}x-free-text .text-area:empty:after{color:#aaa;content:"What do you notice or wonder?"}x-free-text .text-area:hover,x-free-text:focus-within .text-area{background-color:#eee;border-color:#0f82f2;z-index:2}x-free-text:focus-within .text-area{box-shadow:0 0 0 3px rgba(15,130,242,.5);outline:none}x-free-text .toolbar{background:#dddce1;border-radius:0 0 5px 5px;border-top:1px solid #adabb5;bottom:1px;display:flex;left:1px;opacity:0;pointer-events:none;position:absolute;right:1px;transition:opacity .2s}x-free-text .toolbar .space{flex-grow:1}x-free-text .text-area:focus+.toolbar,x-free-text:focus-within .toolbar{opacity:1;pointer-events:all}x-free-text .toolbar .command{fill:#3a3645;border-right:1px solid #adabb5;cursor:pointer;display:block;height:20px;padding:6px;transition:background .2s,fill .2s}x-free-text .toolbar .command:focus,x-free-text .toolbar .command:hover{fill:#181824;background:#c5c2cc}x-free-text .toolbar .command:first-child{border-bottom-left-radius:5px}x-free-text .toolbar .command x-icon{display:block;margin:0;transition:transform .2s}x-free-text .toolbar .command x-icon:hover{transform:scale(1.08)}x-free-text .toolbar .command x-icon:active{transform:scale(.92)}x-free-text .toolbar .submit{border-radius:0 0 5px 0;font-size:16px;height:33px;line-height:33px;margin-top:-1px;padding:0 12px 0 8px}x-free-text .toolbar .submit.invisible{opacity:0;pointer-events:none;transform:scale(.5)}x-free-text .toolbar .submit x-icon{margin-right:2px}x-free-text .toolbar .submit:focus,x-free-text .toolbar .submit:hover{background:#22ab24}x-gallery{display:block;position:relative}x-gallery .wrapper{cursor:ew-resize;overflow:hidden;position:relative}x-gallery .panel{transform:translateX(0)}x-gallery .panel:after,x-gallery .panel:before{clear:both;content:" ";display:table}x-gallery .panel>*{box-sizing:border-box;float:left;padding:10px}x-gallery .panel>* img,x-gallery .panel>* x-img{display:block;height:auto;margin:0 auto;width:100%}x-gallery .nav{border-top:2px solid #c5c2cc;height:34px;position:relative}x-gallery .back,x-gallery .next{border-radius:0 0 6px 6px;display:block;height:36px;min-width:0;padding:0;position:absolute;top:-2px;transform-origin:center top;width:36px}x-gallery .back.disabled,x-gallery .next.disabled{opacity:0}x-gallery .back x-icon,x-gallery .next x-icon{display:block;margin:6px}x-gallery .next{right:0}x-gallery .dots{left:50%;position:absolute;top:10px;transform:translateX(-50%)}x-gallery .dot{background:rgba(24,24,36,.2);border-radius:4px;float:left;height:8px;margin:4px;transition:opacity .2s;width:8px}x-gallery .dot.on{background:rgba(24,24,36,.8)}x-gesture{fill:rgba(0,0,0,.5);stroke:hsla(0,0%,100%,.5);stroke-width:1px;display:none;pointer-events:none;position:absolute;transform-origin:15px 10px;z-index:9999}html[theme=dark] x-gesture{fill:hsla(0,0%,100%,.5);stroke:rgba(34,33,46,.5)}x-bio,x-bio .target,x-gloss,x-gloss .target{display:inline-block;position:relative}x-bio .target,x-gloss .target{-webkit-touch-callout:none;background:transparent;border-radius:6px;cursor:pointer;line-height:28px;margin:-3px -6px;padding:0 6px;transition:background .2s,color .2s,box-shadow .2s}.caption x-bio .target,.caption x-gloss .target{height:24px;line-height:24px}x-bio .target:before,x-gloss .target:before{background:#feaf4d;bottom:1px;content:" ";height:3px;left:5px;position:absolute;right:5px}x-bio.on .target,x-gloss.on .target{background:#feaf4d;color:rgba(0,0,0,.8)}html.is-tabbing x-bio .target:focus,html.is-tabbing x-gloss .target:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #feaf4d;outline:none}x-bio .popup,x-gloss .popup{font-size:16px;font-weight:400}@media screen and (max-width:600px){x-bio .popup,x-gloss .popup{display:none}}@media screen and (min-width:601px){x-bio .popup,x-gloss .popup{background:#f08500;border-radius:0 6px 6px 6px;box-shadow:0 0 10px rgba(0,0,0,.2);font-style:normal;left:-6px;opacity:0;padding:12px 16px;pointer-events:none;position:absolute;text-align:left;top:100%;transform:scale(.5);transform-origin:left top;transition:opacity .2s,transform .2s;white-space:normal;width:300px}.caption x-bio .popup,.caption x-gloss .popup{top:24px}x-bio.left .popup,x-gloss.left .popup{border-radius:6px 0 6px 6px;left:auto;right:-6px;transform-origin:right top}x-bio.top .popup,x-gloss.top .popup{border-radius:6px 6px 6px 0;bottom:100%;top:auto;transform-origin:left bottom}x-bio.left.top .popup,x-gloss.left.top .popup{border-radius:6px 6px 0 6px;transform-origin:right bottom}.caption x-bio.top .popup,.caption x-gloss.top .popup{bottom:24px}x-bio.on,x-bio:focus-within,x-gloss.on,x-gloss:focus-within{z-index:100}x-bio.on .target,x-bio:focus-within .target,x-gloss.on .target,x-gloss:focus-within .target{border-radius:5px 5px 0 0}x-bio.on.top .target,x-bio:focus-within.top .target,x-gloss.on.top .target,x-gloss:focus-within.top .target{border-radius:0 0 5px 5px}x-bio.on.invalid .target:before,x-bio:focus-within.invalid .target:before,x-gloss.on.invalid .target:before,x-gloss:focus-within.invalid .target:before{border-radius:5px 0 0 0}x-bio.on.top.invalid .target:before,x-bio:focus-within.top.invalid .target:before,x-gloss.on.top.invalid .target:before,x-gloss:focus-within.top.invalid .target:before{border-radius:0 0 0 5px}x-bio.on .popup,x-bio:focus-within .popup,x-gloss.on .popup,x-gloss:focus-within .popup{opacity:1;pointer-events:all;transform:none}}.theorem x-bio .target:before,.theorem x-gloss .target:before{background:#fd8c00}.theorem x-bio.on .target:before,.theorem x-gloss.on .target:before{background:#feaf4d}#glossary-modal,x-bio .popup,x-gloss .popup{color:hsla(0,0%,100%,.9)}#glossary-modal li,#glossary-modal p,x-bio .popup li,x-bio .popup p,x-gloss .popup li,x-gloss .popup p{line-height:1.4;margin:0 0 .7em}#glossary-modal li,x-bio .popup li,x-gloss .popup li{margin-bottom:.3em}#glossary-modal p:last-child,x-bio .popup p:last-child,x-gloss .popup p:last-child{margin-bottom:0}#glossary-modal ol,#glossary-modal ul,x-bio .popup ol,x-bio .popup ul,x-gloss .popup ol,x-gloss .popup ul{margin-left:1.5em}#glossary-modal strong,x-bio .popup strong,x-gloss .popup strong{color:#fff}#glossary-modal a.btn,#glossary-modal a.icon-btn,#glossary-modal a.next-step,x-bio .popup a.btn,x-bio .popup a.icon-btn,x-bio .popup a.next-step,x-gloss .popup a.btn,x-gloss .popup a.icon-btn,x-gloss .popup a.next-step{background:hsla(0,0%,100%,.8);color:#fd8c00;font-weight:400;margin:0}#glossary-modal a.btn:after,#glossary-modal a.btn:before,#glossary-modal a.icon-btn:after,#glossary-modal a.icon-btn:before,#glossary-modal a.next-step:after,#glossary-modal a.next-step:before,x-bio .popup a.btn:after,x-bio .popup a.btn:before,x-bio .popup a.icon-btn:after,x-bio .popup a.icon-btn:before,x-bio .popup a.next-step:after,x-bio .popup a.next-step:before,x-gloss .popup a.btn:after,x-gloss .popup a.btn:before,x-gloss .popup a.icon-btn:after,x-gloss .popup a.icon-btn:before,x-gloss .popup a.next-step:after,x-gloss .popup a.next-step:before{display:none}#glossary-modal a.btn:focus,#glossary-modal a.btn:hover,#glossary-modal a.icon-btn:focus,#glossary-modal a.icon-btn:hover,#glossary-modal a.next-step:focus,#glossary-modal a.next-step:hover,x-bio .popup a.btn:focus,x-bio .popup a.btn:hover,x-bio .popup a.icon-btn:focus,x-bio .popup a.icon-btn:hover,x-bio .popup a.next-step:focus,x-bio .popup a.next-step:hover,x-gloss .popup a.btn:focus,x-gloss .popup a.btn:hover,x-gloss .popup a.icon-btn:focus,x-gloss .popup a.icon-btn:hover,x-gloss .popup a.next-step:focus,x-gloss .popup a.next-step:hover{background:#fff;color:#fd8c00}.bio-img{border-radius:4px;float:right;height:auto;margin:4px 0 5px 10px;width:140px}.gloss-img{display:block;filter:invert(100%)}#glossary-modal{background:#fd8c00;border-radius:8px;width:340px}#glossary-modal .modal-body{padding:12px 18px 14px}#glossary-modal p:first-child{margin-right:18px}#glossary-modal .bio-img{display:block;float:none;margin:0 auto 12px;min-height:160px}#glossary-modal .gloss-img{min-height:120px}#glossary-modal .close{fill:hsla(0,0%,100%,.8)}.lightbox-overlay{background:transparent;bottom:0;cursor:zoom-out;display:none;left:0;position:fixed;right:0;top:0;transition:background .4s;will-change:background;z-index:800}.lightbox-overlay.on{background:rgba(0,0,0,.9)}.lightbox-img{background-position:50%;background-repeat:no-repeat;background-size:contain;bottom:30px;left:30px;position:absolute;right:30px;top:30px;will-change:transition}.lightbox-img.transitions{transition:transform .4s ease-in-out}@media screen and (max-width:540px){.lightbox-img{bottom:0;left:0;right:0;top:0}}x-img{display:block;max-width:100%;position:relative}x-img.interactive{cursor:zoom-in}x-img .wrap{height:0}x-img img{border-radius:4px;display:block;max-width:100%}x-img .credit{background:rgba(0,0,0,.8);border-bottom-right-radius:4px;bottom:0;box-sizing:border-box;color:#fff;font-size:11px;line-height:1.2;max-width:90%;opacity:0;padding:4px 8px;position:absolute;right:0;transition:opacity .2s}x-img:hover .credit{opacity:.9}x-img .zoom{background:rgba(0,0,0,.7);border-top-right-radius:4px;height:36px;opacity:.5;position:absolute;right:0;top:0;transition:opacity .2s,background .2s;width:36px}x-img:hover .zoom{opacity:.9}x-img x-icon{fill:#fff;margin:6px}@media print{.lightbox-img,.lightbox-overlay,x-img .zoom{display:none!important}x-img .credit{opacity:1!important}}x-picker{display:flex;justify-content:space-between;margin:1.5em -4px}x-picker .item{border:4px solid transparent;border-radius:8px;cursor:pointer;margin:4px;position:relative;transition:border .2s,opacity .2s;width:100px}x-picker .item:hover{border-color:#eee}x-picker .item.correct{border-color:#22ab24;cursor:default}x-picker .item.incorrect{border-color:#cd0e66;cursor:default}x-picker .item:after{border:4px solid #fff;border-radius:100%;content:"";height:28px;position:absolute;right:-12px;top:-12px;transform:scale(0);transition:transform .5s cubic-bezier(.33,1.9,.52,.7);width:28px}x-picker .item.correct:after{background:#22ab24 url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22m19.7%206.3-.2-.4-.3-.2c-.1-.1-.3%200-.4%200a36.6%2036.6%200%200%200%20-9.8%208.4%2036.1%2036.1%200%200%200%20-4.8-2.9h-.5l-1%20.9a.4.4%200%200%200%20-.1.3c0%20.2%200%20.3.1.4a72.1%2072.1%200%200%201%206.6%207h.4a.5.5%200%200%200%20.4-.2c3.8-6.8%205.7-9.6%209.4-13%20.2.1.2-.1.2-.3z%22%2F%3E%3C%2Fsvg%3E") 2px 2px no-repeat;transform:scale(1)}x-picker .item.incorrect:after{background:#cd0e66 url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22M19%2C16l-4.7-4.3L18.6%2C7a1.2%2C1.2%2C0%2C0%2C0%2C0-1.5l-.4-.3a1%2C1%2C0%2C0%2C0-1.4%2C0L12%2C9.5%2C7.2%2C5.2a1%2C1%2C0%2C0%2C0-1.4%2C0l-.4.3A1.2%2C1.2%2C0%2C0%2C0%2C5.4%2C7l4.3%2C4.7L5%2C16a1.1%2C1.1%2C0%2C0%2C0-.1%2C1.4l1.5%2C1.4a.9.9%2C0%2C0%2C0%2C1.3%2C0L12%2C14.1l4.3%2C4.7a.9.9%2C0%2C0%2C0%2C1.3%2C0l1.5-1.4A1.1%2C1.1%2C0%2C0%2C0%2C19%2C16Z%22%2F%3E%3C%2Fsvg%3E") 2px 2px no-repeat;transform:scale(1)}x-picker.solved .item{border-color:transparent;cursor:default}x-picker.solved .item:after{background-color:#ccc}x-picker.solved .item[data-error]{opacity:.2}x-picker.list{display:block;margin:1em 24px}x-picker.list .item{border:none;border-radius:5px;margin:8px auto;max-width:480px;padding:4px 12px 4px 42px;transition:background .2s;width:auto}x-picker.list .item:not(.correct):not(.incorrect):hover{background:#eee}x-picker.list .item:after{left:0;top:-1px}x-picker.wrap{flex-wrap:wrap;justify-content:center}x-progress{border:2px solid;border-radius:100%;box-sizing:border-box}x-progress svg{display:block;margin:-14px;max-width:none;pointer-events:none}x-progress path.done,x-progress path.pie{transform:translate(12px,12px)}x-progress path.pie{fill:none;stroke:currentColor;transition:stroke-dasharray .2s}x-progress line{stroke:currentColor;stroke-width:2px}x-course-sidebar{background:#3a3645 linear-gradient(transparent 240px,rgba(0,0,0,.25));bottom:0;box-shadow:0 0 12px rgba(0,0,0,.25);color:#fff;display:flex;flex-direction:column;left:0;position:fixed;top:44px;width:280px;z-index:301}x-course-sidebar .sidebar-hero{background-size:cover;flex-shrink:0.5;height:220px;padding:0 20px;position:relative}x-course-sidebar .sidebar-hero-gradient{background-image:linear-gradient(transparent,rgba(0,0,0,.6) 140px);bottom:0;content:" ";left:0;position:absolute;right:0;top:40px}x-course-sidebar .sidebar-title{bottom:16px;font-size:30px;font-weight:600;line-height:1.1;position:absolute}x-course-sidebar .course-icon{background-size:cover;border:2px solid #fff;border-radius:4px;height:54px;margin-bottom:4px;width:54px}x-course-sidebar .sidebar-author{display:block;font-size:16px;margin-top:6px;opacity:.7;width:-moz-fit-content;width:fit-content}x-course-sidebar .sidebar-body{-webkit-overflow-scrolling:touch;flex-grow:1;overflow:auto;overscroll-behavior:contain}x-course-sidebar .sidebar-row{color:hsla(0,0%,100%,.8);display:block;font-weight:600;line-height:20px;padding:11px 20px 11px 52px;position:relative;transition:background .2s,color .2s}x-course-sidebar .sidebar-row:before{background:hsla(0,0%,100%,.4);content:" ";display:block;height:1px;position:absolute;top:0;transition:background-color .2s;width:calc(100% - 72px)}x-course-sidebar .sidebar-row:first-child:before{display:none}x-course-sidebar .sidebar-row.active,x-course-sidebar .sidebar-row.on,x-course-sidebar .sidebar-row:focus,x-course-sidebar .sidebar-row:hover{background:hsla(0,0%,100%,.2);color:#fff}x-course-sidebar .sidebar-row.active+:before,x-course-sidebar .sidebar-row.active:before,x-course-sidebar .sidebar-row.on+:before,x-course-sidebar .sidebar-row.on:before,x-course-sidebar .sidebar-row:focus+:before,x-course-sidebar .sidebar-row:focus:before,x-course-sidebar .sidebar-row:hover+:before,x-course-sidebar .sidebar-row:hover:before{background:transparent}x-course-sidebar .sidebar-row.active,x-course-sidebar .sidebar-row.on{background:hsla(0,0%,100%,.32)}x-course-sidebar .sidebar-row x-progress{color:#fff;height:20px;left:20px;position:absolute;top:11px;width:20px}x-course-sidebar .sidebar-row .connection{background:#fff;height:calc(100% - 18px);left:29px;pointer-events:none;position:absolute;top:30px;width:2px}x-course-sidebar .sidebar-row x-icon.left{color:#fff;left:18px;position:absolute;top:9px}x-course-sidebar .sidebar-row x-icon.left+.connection{height:calc(100% - 16px);top:28px}x-course-sidebar .sidebar-row x-icon.right{color:hsla(0,0%,100%,.6);float:right;margin:-2px -2px 0 6px}x-course-sidebar .sidebar-row:last-child .connection{display:none}x-course-sidebar .sidebar-row:first-child{margin-top:16px}x-course-sidebar .sidebar-footer{display:flex;flex-shrink:0;justify-content:center}x-course-sidebar .footer-link{cursor:pointer;padding:12px 10px;position:relative}x-course-sidebar .footer-link x-icon{fill:hsla(0,0%,100%,.7);display:block;transition:fill .2s}x-course-sidebar .footer-link:focus x-icon,x-course-sidebar .footer-link:hover x-icon{fill:hsla(0,0%,100%,.9)}x-course-sidebar .sidebar-banner{border-top:1px solid hsla(0,0%,100%,.4);color:hsla(0,0%,100%,.6);flex-shrink:0;font-size:14px;margin:0 18px;padding:4px 0 6px;text-align:center}.sidebar-toggle{background:#cd0e66;border-radius:24px;bottom:8px;box-shadow:0 3px 8px rgba(0,0,0,.3);cursor:pointer;display:none;height:24px;left:8px;padding:10px;position:fixed;width:24px;z-index:300}.sidebar-toggle x-icon{fill:#fff}.sidebar-shadow{bottom:0;display:none;left:0;position:fixed;right:0;top:0;z-index:300}x-modal{-webkit-user-select:text;-moz-user-select:text;user-select:text}#feedback .error{color:#cd0e66;display:none;margin:5px 8px}#feedback button[disabled]:after{content:"ing…"}x-modal#feedback-success{text-align:center;width:320px}x-modal#share{width:400px}.share-row{display:flex;flex-wrap:wrap;justify-content:center;margin:-4px}.share-row .btn,.share-row .icon-btn,.share-row .next-step{border-radius:8px;box-shadow:none;height:36px;margin:4px;min-width:0;padding:8px;width:36px}.share-row .btn x-icon,.share-row .icon-btn x-icon,.share-row .next-step x-icon{margin:0}#glossary-search{background:#feddb3;font-size:16px;height:440px;width:600px}.gloss-sidebar{background:#fd8c00;border-radius:12px 0 0 12px;display:flex;flex-direction:column;width:200px}.gloss-sidebar h2{fill:#fff;color:#fff;margin:20px 24px}.gloss-search{position:relative}.gloss-search x-icon{fill:#fff;left:24px;position:absolute;top:9px}.gloss-search input{background:hsla(0,0%,100%,.24);box-sizing:border-box;color:#fff;padding:10px 12px 10px 54px;transition:background .2s;width:100%}.gloss-search input:focus,.gloss-search input:hover{background:hsla(0,0%,100%,.32)}.gloss-search input::-moz-placeholder{color:hsla(0,0%,100%,.7)}.gloss-search input::placeholder{color:hsla(0,0%,100%,.7)}.gloss-list{-webkit-overflow-scrolling:touch;border-bottom-left-radius:12px;flex:1 1;margin-top:-1px;overflow:auto;overscroll-behavior:contain}.gloss-item{color:hsla(0,0%,100%,.8);cursor:pointer;font-weight:600;line-height:1.3;padding:8px 12px 8px 24px;position:relative;transition:background .2s,color .2s}.gloss-item:before{background:hsla(0,0%,100%,.4);content:" ";display:block;height:1px;position:absolute;top:0;transition:background-color .2s;width:calc(100% - 36px)}.gloss-item:first-child:before{display:none}.gloss-item.active,.gloss-item.on,.gloss-item:focus,.gloss-item:hover{background:hsla(0,0%,100%,.2);color:#fff}.gloss-item.active+:before,.gloss-item.active:before,.gloss-item.on+:before,.gloss-item.on:before,.gloss-item:focus+:before,.gloss-item:focus:before,.gloss-item:hover+:before,.gloss-item:hover:before{background:transparent}.gloss-item.active,.gloss-item.on{background:hsla(0,0%,100%,.32)}.gloss-body{-webkit-overflow-scrolling:touch;flex:1 1;overflow:auto;overscroll-behavior:contain;padding:64px 32px 32px}@media screen and (max-width:840px){x-course-sidebar{box-shadow:none;left:-280px;transition:transform .3s,box-shadow .3s;will-change:transform}.sidebar-toggle{display:block}x-course-sidebar.open{box-shadow:10px 0 60px rgba(0,0,0,.5);transform:translateX(280px)}x-course-sidebar.open+.sidebar-shadow{display:block}}x-slider{box-sizing:border-box;display:block;margin:20px auto 2em;max-width:400px;position:relative;width:calc(100% - 24px)}x-slider .bar{background:#b0afb5;border-radius:2px;height:4px;position:relative}x-slider .play+.bar{margin-left:40px}x-slider .knob{background:#cd0e66;border-radius:12px;cursor:grab;height:20px;left:0;margin:-8px 0 0 -10px;position:absolute;touch-action:pan-y;transition:background .2s,transform .2s,box-shadow .2s;width:20px}x-slider .knob:active,x-slider .knob:hover{background:#f01e7f;box-shadow:0 3px 8px rgba(0,0,0,.25);transform:scale(1.4)}x-slider .play{color:#89868f;cursor:pointer;height:32px;left:-8px;padding:4px;position:absolute;top:-18px;transition:fill .2s,transform .2s;width:32px}x-slider .play:hover{transform:scale(1.08)}x-slider .play:active{transform:scale(.92)}x-slider .play:focus,x-slider .play:hover{color:#3a3645;transform:scale(1.2)}html[theme=dark] x-slider .play:focus,html[theme=dark] x-slider .play:hover{color:#fff}x-slider .play:active{transform:scale(.9)}x-slideshow{display:block}x-slideshow .legend-box{border:solid #ccc;border-width:2px 0}x-slideshow .legend-box>*{display:none;padding:.7em 0}x-slideshow .legend-box p:last-child,x-slideshow .legend-box>p{margin-bottom:0}x-slideshow .nav{height:0;position:relative}x-slideshow .back,x-slideshow .next{border-radius:6px 6px 0 0;bottom:-2px;display:block;height:36px;min-width:0;padding:0;position:absolute;transform-origin:center bottom;width:36px;z-index:1}x-slideshow .back.disabled,x-slideshow .next.disabled{opacity:0}x-slideshow .back x-icon,x-slideshow .next x-icon{margin:6px}[dir=rtl] x-slideshow .back x-icon,[dir=rtl] x-slideshow .next x-icon{transform:scaleX(-1)}x-slideshow .next{right:0}x-slideshow .dots{bottom:8px;left:50%;position:absolute;transform:translateX(-50%)}x-slideshow .dot{background:rgba(24,24,36,.2);border-radius:4px;float:left;height:8px;margin:4px;transition:background .2s;width:8px}html[theme=dark] x-slideshow .dot{background:hsla(0,0%,100%,.4)}x-slideshow .dot.on{background:rgba(0,0,0,.8)}html[theme=dark] x-slideshow .dot.on{background:#fff}x-sortable{display:block;margin:1.5em auto;max-width:600px;position:relative}x-sortable>*{background:#0f82f2;border-radius:4px;color:#fff;cursor:grab;left:0;padding:8px 28px 8px 20px;position:absolute;top:0;transition:opacity .1s,box-shadow .1s;width:calc(100% - 48px)}x-sortable>:active{cursor:grabbing;z-index:100}x-sortable>:after{content:"…";position:absolute;right:0;top:7px;transform:rotate(90deg)}x-sortable:active>*{opacity:.6}x-sortable>:active{box-shadow:0 0 20px rgba(0,0,0,.3);opacity:1}x-sortable.solved:active>*,x-sortable.solved>*,x-sortable.solved>:active{background:none;border:1px solid #0f82f2;box-shadow:none;color:inherit;cursor:default;opacity:1;padding:7px 27px 7px 19px}x-sortable.solved:active>:after,x-sortable.solved>:active:after,x-sortable.solved>:after{display:none}x-step{color:#666;contain:layout style;display:block;height:0;line-height:1.7;opacity:0;overflow:hidden;pointer-events:none;position:relative;transform:translateX(-160px);word-spacing:.05em;z-index:1}html[theme=dark] x-step{color:#dedee0}x-step:after,x-step:before{clear:both;content:" ";display:table}x-course.ready x-step{transition:opacity .8s linear,transform .8s cubic-bezier(.165,.84,.44,1);will-change:opacity,transform}x-step.on{height:auto;opacity:1;overflow:visible;pointer-events:auto;transform:none}x-step:hover{z-index:2}x-step:focus-within{z-index:3}.reveal{visibility:hidden}.next-step{box-sizing:border-box;left:50%;margin-left:-70px;position:absolute;top:calc(100% + 12px);width:140px}x-step.hovering{z-index:1}p.voice{margin-left:-40px;padding-left:40px}.sentence{background-image:linear-gradient(rgba(253,140,0,.3),rgba(253,140,0,.3));background-repeat:no-repeat;background-size:0 100%;-webkit-box-decoration-break:clone;box-decoration-break:clone;transition:background .6s}.sentence.playing{background-size:100% 100%;border-radius:4px;margin:0 -4px;padding:0 4px}.playback-btn{background:#c5c2cc url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2214%22%20height%3D%2214%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22m7.5%206.17v11.66a1.12%201.12%200%200%200%201.73.94l9.16-5.77a1.13%201.13%200%200%200%200-1.91l-9.16-5.86a1.12%201.12%200%200%200%20-1.73.94z%22%2F%3E%3C%2Fsvg%3E") 2px 2px no-repeat;background-clip:content-box;border:10px solid transparent;border-radius:30px;cursor:pointer;height:18px;margin:-4px 0 0 -38px;opacity:0;pointer-events:none;position:absolute;transform:scale(0);transition:opacity .2s,background .2s,transform .2s;width:18px}li.voice .playback-btn{margin-left:-56px}.playback-btn.active,.playback-btn:focus,.voice:hover>.playback-btn{opacity:1;pointer-events:all;transform:scale(1)}.voice:hover>.playback-btn:hover{transform:scale(1.3)}.playback-btn:focus,.playback-btn:hover{background-color:#656073}.playback-btn.active{background:#fd8c00 url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2214%22%20height%3D%2214%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22m8%2019a2%202%200%200%200%202-2v-10a2%202%200%200%200%20-2-2%202%202%200%200%200%20-2%202v10a2%202%200%200%200%202%202zm6-12v10a2%202%200%200%200%202%202%202%202%200%200%200%202-2v-10a2%202%200%200%200%20-2-2%202%202%200%200%200%20-2%202z%22%2F%3E%3C%2Fsvg%3E") 2px 2px no-repeat;background-clip:content-box}x-step h2,x-step h3{color:#333;font-weight:600;line-height:1.15}html[theme=dark] x-step h2,html[theme=dark] x-step h3{color:#fff}x-step h2{border-bottom:2px solid #ddd;font-size:1.6em;margin:2em 0 1em;padding-bottom:6px}x-step .row h2{border:none;padding:0}x-step:first-child h2{margin-top:0}x-step h3{font-size:1.3em;margin:1.2em 0 .8em;text-align:center}x-step .row h3{text-align:left}x-step li strong,x-step p strong,x-step table strong{color:#333;font-weight:700}html[theme=dark] x-step li strong,html[theme=dark] x-step p strong,html[theme=dark] x-step table strong{color:#fff}x-step figure+p,x-step x-geopad+p{margin-top:.5em}x-step ol,x-step ul{margin:0 0 1em;padding:0;text-align:left}x-step ul{list-style-type:disc}x-step li{margin:0 0 .5em 1.5em}x-step .caption{color:#aaa;font-size:.85em;line-height:1.5;margin:.5em 0 0;text-align:center;vertical-align:top}html[theme=dark] x-step .caption{color:hsla(0,0%,100%,.55)}x-step .quote{color:#aaa;font-style:italic;margin:1.5em 2em;text-align:center}html[theme=dark] x-step .quote{color:hsla(0,0%,100%,.55)}x-step hr{background:#ddd;height:2px;margin:2em 0}x-step hr:first-child{margin-top:1em}x-step code{background:#eee;border:1px solid #ccc;border-radius:4px;color:#333;font-family:Courier,monospace;font-size:90%;margin:-.2em .1em;padding:.2em .4em;vertical-align:1px}x-step pre{margin:1em 0}x-step pre code{display:block;padding:.3em .8em}x-step table{border:none;border-collapse:collapse;border-spacing:0;margin:.5em auto 1.5em}x-step td,x-step th{border:none;padding:.6em;text-align:center;vertical-align:middle}x-step table.text-left td,x-step table.text-left th{text-align:left}@media screen and (max-width:540px){x-step td,x-step th{padding:.25em}}x-step td[align=left]{text-align:left}x-step td[align=center]{text-align:center}x-step td[align=right]{text-align:right}x-step .table-fixed{table-layout:fixed;width:95%}x-step .table-small,x-step .table-tiny{margin:0 auto 1em}x-step .table-small td{padding:.3em .6em}x-step .table-tiny td{padding:.2em .3em}x-step table.grid td,x-step table.grid th{border-bottom:1px solid #c5c2cc;border-right:1px solid #c5c2cc}x-step table.grid td:last-child,x-step table.grid th:last-child{border-right:none}x-step table.grid tr:last-child td{border-bottom:none}x-step table h3,x-step table p{margin:0;padding:0;text-align:center!important}x-step table img{height:auto;max-width:95%}x-step table .caption{text-align:center!important}x-step table .td_caption_small{padding-top:0!important}x-step .column,x-step .row{margin:-.5em -.5em .5em}x-step .row>*,x-step article .column>*{margin:.5em;width:260px}x-step .row.padded{margin:-.5em -24px .5em}x-step .row.padded-thin{margin:-.5em -12px .5em}x-step .row>.fit{width:-moz-fit-content;width:fit-content}x-step .row>*>:first-child{margin-top:0}x-step .row>*>:last-child{margin-bottom:0}x-step .row>*>p:first-child{margin-top:-6px}x-step svg{height:auto;max-width:100%}.sticky-wrap{position:relative}.sticky{position:sticky;top:54px}.fixme{background:#fcc}html[theme=dark] .fixme{background:rgba(204,0,0,.5)}.todo{background:#eee;border:2px solid #aaa;border-radius:12px;color:#999;font-size:20px;font-style:italic;margin:2em auto;max-width:580px;padding:22px 24px;text-align:center}html[theme=dark] .todo{background:hsla(0,0%,100%,.15)}@media (min-width:720px){.shifted{margin-top:-70px!important}}figure,x-gallery,x-slideshow{margin:2em auto}figure>img,figure>svg,figure>x-img{display:block;margin:0 auto .3em}x-select.segmented{display:flex;margin:0 auto .5em;width:-moz-fit-content;width:fit-content}x-select.segmented>*{border:1px solid #cd0e66;border-left:none;cursor:pointer;text-align:center;transition:color .2s,background .2s;width:100px}x-select.segmented>:first-child{border-left:1px solid #cd0e66;border-radius:20px 0 0 20px}x-select.segmented>:last-child{border-radius:0 20px 20px 0}x-select.segmented>:hover{background:rgba(205,14,102,.18)}x-select.segmented>.active{background:#cd0e66;color:#fff;cursor:default}html.is-tabbing x-select.segmented>:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #cd0e66;outline:none;z-index:1}.box,.frame,.theorem{background:#f5f5f6;border-radius:6px;box-sizing:border-box;color:rgba(0,0,0,.7);padding:16px}html[theme=dark] .box,html[theme=dark] .frame,html[theme=dark] .theorem{background:#2d2c38;color:inherit}.box>ol:last-child,.box>p:last-child:not(.btn-row),.box>ul:last-child,.frame>ol:last-child,.frame>p:last-child:not(.btn-row),.frame>ul:last-child,.theorem>ol:last-child,.theorem>p:last-child:not(.btn-row),.theorem>ul:last-child{margin-bottom:0}.box .caption,.frame .caption,.theorem .caption{color:rgba(0,0,0,.4)}html[theme=dark] .box .caption,html[theme=dark] .frame .caption,html[theme=dark] .theorem .caption{color:hsla(0,0%,100%,.55)}.box hr,.frame hr,.theorem hr{background:rgba(0,0,0,.2)}html[theme=dark] .box hr,html[theme=dark] .frame hr,html[theme=dark] .theorem hr{background:hsla(0,0%,100%,.25)}.frame.red,.red.box,.red.theorem{background:rgba(205,14,102,.25)}html[theme=dark] .frame.red,html[theme=dark] .red.box,html[theme=dark] .red.theorem{background:rgba(205,14,102,.4)}.blue.box,.blue.theorem,.frame.blue{background:rgba(15,130,242,.25)}html[theme=dark] .blue.box,html[theme=dark] .blue.theorem,html[theme=dark] .frame.blue{background:rgba(15,130,242,.4)}.frame.green,.green.box,.green.theorem{background:rgba(34,171,36,.25)}html[theme=dark] .frame.green,html[theme=dark] .green.box,html[theme=dark] .green.theorem{background:rgba(34,171,36,.4)}.frame.yellow,.yellow.box,.yellow.theorem{background:rgba(253,140,0,.25)}html[theme=dark] .frame.yellow,html[theme=dark] .yellow.box,html[theme=dark] .yellow.theorem{background:rgba(253,140,0,.4)}.frame.orange,.orange.box,.orange.theorem{background:rgba(235,71,38,.25)}html[theme=dark] .frame.orange,html[theme=dark] .orange.box,html[theme=dark] .orange.theorem{background:rgba(235,71,38,.4)}.frame.purple,.purple.box,.purple.theorem{background:rgba(109,59,191,.25)}html[theme=dark] .frame.purple,html[theme=dark] .purple.box,html[theme=dark] .purple.theorem{background:rgba(109,59,191,.4)}.frame.teal,.teal.box,.teal.theorem{background:rgba(0,158,166,.25)}html[theme=dark] .frame.teal,html[theme=dark] .teal.box,html[theme=dark] .teal.theorem{background:rgba(0,158,166,.4)}.frame.lime,.lime.box,.lime.theorem{background:rgba(191,194,18,.25)}html[theme=dark] .frame.lime,html[theme=dark] .lime.box,html[theme=dark] .lime.theorem{background:rgba(191,194,18,.4)}.box{margin:2em 0;padding:20px;position:relative}.box.with-title{border-top-left-radius:0;margin-top:calc(2em + 37px)}.box.no-padding{padding:0}figure .box{margin:0}figure .tabs+.box{padding-top:32px}.box h3{background:#181824;border-radius:12px 12px 0 0;color:#fff;font-size:18px;height:36px;left:0;line-height:36px;margin:0;padding:0 20px;position:absolute;top:-37px}@media screen and (max-width:540px){.box{border-radius:0}.box,.box h3{padding-left:24px}.box h3{border-top-left-radius:0}}.box.red h3{background:#cd0e66}.box.blue h3{background:#0f82f2}.box.green h3{background:#22ab24}.box.yellow h3{background:#fd8c00}.box.orange h3{background:#eb4726}.box.purple h3{background:#6d3bbf}.box.teal h3{background:#009ea6}.box.lime h3{background:#bfc212}.theorem{background:rgba(205,14,102,.25);border-left:6px solid #cd0e66;border-radius:3px 6px 6px 3px;margin:1.5em 0;padding:.6em 1em}html[theme=dark] .theorem{background:rgba(205,14,102,.4)}.theorem.red{border-color:#cd0e66}.theorem.blue{border-color:#0f82f2}.theorem.green{border-color:#22ab24}.theorem.yellow{border-color:#fd8c00}.theorem.orange{border-color:#eb4726}.theorem.purple{border-color:#6d3bbf}.theorem.teal{border-color:#009ea6}.theorem.lime{border-color:#bfc212}x-step p a{-webkit-touch-callout:none;background:transparent;border-radius:6px;color:inherit;cursor:pointer;display:inline-block;line-height:28px;margin:-3px -17px -3px -6px;outline:none;padding:0 17px 0 6px;position:relative;transition:background .2s,color .2s,box-shadow .2s}.caption x-step p a{height:24px;line-height:24px}x-step p a:before{background:#57a8f6;bottom:1px;content:" ";height:3px;left:5px;position:absolute;right:5px}x-step p a:focus,x-step p a:hover{background:#57a8f6;box-shadow:0 0 10px rgba(0,0,0,.2);color:rgba(0,0,0,.8)}x-step p a:before{right:17px}x-step p a:after{background:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228%22%20height%3D%2214%22%3E%3Cpath%20fill%3D%22none%22%20stroke%3D%22rgba(0%2C0%2C0%2C0.6)%22%20stroke-width%3D%222px%22%20d%3D%22M2%202L6%207L2%2012%22%2F%3E%3C%2Fsvg%3E");content:" ";display:block;height:14px;left:auto;opacity:0;position:absolute;right:5px;top:7px;transition:opacity .1s;width:9px!important}x-step p a:focus:after,x-step p a:hover:after{opacity:1}.circled{background:#3a3645;border-radius:20px;color:#fff;display:inline-block;height:40px;line-height:40px;text-align:center;width:40px}.circled.red{background:#cd0e66}.circled.blue{background:#0f82f2}.circled.green{background:#22ab24}.circled.yellow{background:#fd8c00}.circled.orange{background:#eb4726}.circled.purple{background:#6d3bbf}.circled.teal{background:#009ea6}.circled.lime{background:#bfc212}.pill{background:rgba(101,96,115,.6);border-radius:16px;color:#fff;display:inline-block;line-height:1.5;min-width:10px;padding:0 10px;text-align:center}.pill.red{background:rgba(205,14,102,.6)}.pill.blue{background:rgba(15,130,242,.6)}.pill.green{background:rgba(34,171,36,.6)}.pill.yellow{background:rgba(253,140,0,.6)}.pill.orange{background:rgba(235,71,38,.6)}.pill.purple{background:rgba(109,59,191,.6)}.pill.teal{background:rgba(0,158,166,.6)}.pill.lime{background:rgba(191,194,18,.6)}.pill.step-target{-webkit-touch-callout:none;background-color:rgba(101,96,115,.6);cursor:pointer;outline:none;transition:background .2s,box-shadow .2s}.pill.step-target:focus,.pill.step-target:hover{background-color:#656073}html.is-tabbing .pill.step-target:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #656073}.pill.step-target.red{-webkit-touch-callout:none;background-color:rgba(205,14,102,.6);outline:none}.pill.step-target.red:focus,.pill.step-target.red:hover{background-color:#cd0e66}html.is-tabbing .pill.step-target.red:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #cd0e66}.pill.step-target.blue{-webkit-touch-callout:none;background-color:rgba(15,130,242,.6);outline:none}.pill.step-target.blue:focus,.pill.step-target.blue:hover{background-color:#0f82f2}html.is-tabbing .pill.step-target.blue:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #0f82f2}.pill.step-target.green{-webkit-touch-callout:none;background-color:rgba(34,171,36,.6);outline:none}.pill.step-target.green:focus,.pill.step-target.green:hover{background-color:#22ab24}html.is-tabbing .pill.step-target.green:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #22ab24}.pill.step-target.yellow{-webkit-touch-callout:none;background-color:rgba(253,140,0,.6);outline:none}.pill.step-target.yellow:focus,.pill.step-target.yellow:hover{background-color:#fd8c00}html.is-tabbing .pill.step-target.yellow:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #fd8c00}.pill.step-target.orange{-webkit-touch-callout:none;background-color:rgba(235,71,38,.6);outline:none}.pill.step-target.orange:focus,.pill.step-target.orange:hover{background-color:#eb4726}html.is-tabbing .pill.step-target.orange:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #eb4726}.pill.step-target.purple{-webkit-touch-callout:none;background-color:rgba(109,59,191,.6);outline:none}.pill.step-target.purple:focus,.pill.step-target.purple:hover{background-color:#6d3bbf}html.is-tabbing .pill.step-target.purple:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #6d3bbf}.pill.step-target.teal{-webkit-touch-callout:none;background-color:rgba(0,158,166,.6);outline:none}.pill.step-target.teal:focus,.pill.step-target.teal:hover{background-color:#009ea6}html.is-tabbing .pill.step-target.teal:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #009ea6}.pill.step-target.lime{-webkit-touch-callout:none;background-color:rgba(191,194,18,.6);outline:none}.pill.step-target.lime:focus,.pill.step-target.lime:hover{background-color:#bfc212}html.is-tabbing .pill.step-target.lime:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #bfc212}.var-action{-webkit-touch-callout:none;background:transparent;background:#cd0e66;background-color:#cd0e66;border-radius:6px;color:hsla(0,0%,100%,.8);cursor:pointer;display:inline-block;line-height:28px;margin:-3px 2px;min-width:20px;outline:none;padding:0 8px;position:relative;transition:color .2s,background .2s,box-shadow .2s,transform .3s}.caption .var-action{height:24px;line-height:24px}.var-action:before{background:none;bottom:1px;content:" ";height:3px;left:5px;position:absolute;right:5px}.var-action:focus,.var-action:hover{background-color:#ef1579}html.is-tabbing .var-action:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #ef1579}.var-action:hover{transform:scale(1.08)}.var-action:active{transform:scale(.92)}.var-action:hover{box-shadow:0 0 10px rgba(0,0,0,.2);color:#fff}html.is-tabbing .var-action:focus{outline:none}.check{background:#22ab24 url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22m19.7%206.3-.2-.4-.3-.2c-.1-.1-.3%200-.4%200a36.6%2036.6%200%200%200%20-9.8%208.4%2036.1%2036.1%200%200%200%20-4.8-2.9h-.5l-1%20.9a.4.4%200%200%200%20-.1.3c0%20.2%200%20.3.1.4a72.1%2072.1%200%200%201%206.6%207h.4a.5.5%200%200%200%20.4-.2c3.8-6.8%205.7-9.6%209.4-13%20.2.1.2-.1.2-.3z%22%2F%3E%3C%2Fsvg%3E");border-radius:100%;display:inline-block;height:24px;text-align:center;vertical-align:middle;visibility:hidden;width:24px}.check.incorrect{background:#cd0e66 url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22M19%2C16l-4.7-4.3L18.6%2C7a1.2%2C1.2%2C0%2C0%2C0%2C0-1.5l-.4-.3a1%2C1%2C0%2C0%2C0-1.4%2C0L12%2C9.5%2C7.2%2C5.2a1%2C1%2C0%2C0%2C0-1.4%2C0l-.4.3A1.2%2C1.2%2C0%2C0%2C0%2C5.4%2C7l4.3%2C4.7L5%2C16a1.1%2C1.1%2C0%2C0%2C0-.1%2C1.4l1.5%2C1.4a.9.9%2C0%2C0%2C0%2C1.3%2C0L12%2C14.1l4.3%2C4.7a.9.9%2C0%2C0%2C0%2C1.3%2C0l1.5-1.4A1.1%2C1.1%2C0%2C0%2C0%2C19%2C16Z%22%2F%3E%3C%2Fsvg%3E")}.overflow-wrap{-webkit-overflow-scrolling:touch;margin:0 -40px;overflow:auto;overscroll-behavior:contain;padding:0 40px}.overflow-wrap.overflow-table{margin:1em -40px}.overflow-wrap table{margin:.5em auto}@media screen and (max-width:540px){.box,figure,x-gallery,x-slideshow{margin-left:-24px;margin-right:-24px}x-parallax.full-width{height:320px}figure .caption{padding:0 24px}.fill.box,.fill.theorem,.frame.fill,figure x-img img,figure x-video video{border-radius:0}x-slideshow .legend-box>*{padding-left:24px;padding-right:24px}x-slideshow .back{border-top-left-radius:0}x-slideshow .next{border-top-right-radius:0}x-gallery .back{border-bottom-left-radius:0}x-gallery .next{border-bottom-right-radius:0}}@media print{x-step{height:auto!important;opacity:1!important;transform:none!important}x-step .row,x-step>*{-moz-column-break-inside:avoid;break-inside:avoid}.reveal{visibility:visible!important}.caption,h2,h3,p,strong{color:#000!important}x-bio .popup,x-gloss .popup{display:none!important}}.target-body{display:none;height:100%;left:0;opacity:0;pointer-events:none;position:fixed;top:0;transform:translateZ(0);transition:opacity .3s;width:100%;will-change:opacity;z-index:900}.target-body>rect{fill:#fff}html[theme=dark] .target-body>rect{fill:#22212e}.target-body #arrow path{fill:#000}html[theme=dark] .target-body #arrow path{fill:#fff}.target-body .target-arrow{stroke:#000}html[theme=dark] .target-body .target-arrow{stroke:#fff}@keyframes spin{to{transform:rotate(1turn)}}x-tutor{display:block;font-size:16px}x-tutor .toasts{bottom:8px;max-width:264px;pointer-events:none;position:fixed;right:8px;transition:transform .4s;z-index:300}@media (max-width:400px){x-tutor .toasts{max-width:calc(100% - 80px)}}x-tutor .chat{background:#9fcdfa;border-radius:12px 0 0 0;bottom:0;box-shadow:0 0 12px rgba(0,0,0,.25);display:none;flex-direction:column;height:420px;max-height:calc(100vh - 44px);position:fixed;right:0;width:280px;z-index:301}html.webview x-tutor .chat{max-height:100vh}x-tutor .chat-header{background:#0b62b6;border-radius:12px 0 0 0;color:#fff;font-size:20px;font-weight:600;height:44px;line-height:44px;padding:0 12px}x-tutor .chat-header x-icon[name=fox]{margin:0 8px -9px 0}@media (max-height:450px){x-tutor .chat-header{border-radius:0}}x-tutor .close{fill:hsla(0,0%,100%,.6);cursor:pointer;padding:10px;position:absolute;right:0;top:0;transition:fill .2s,transform .2s}x-tutor .close x-icon{display:block}x-tutor .close:focus,x-tutor .close:hover{fill:#fff;transform:scale(1.4)}x-tutor .chat-body{-webkit-overflow-scrolling:touch;flex:1 1;overflow:auto;overscroll-behavior:contain;padding:2px 8px 44px;position:relative;-webkit-user-select:text;-moz-user-select:text;user-select:text}x-tutor .chat-body.loading:after{animation:spin .7s linear infinite;border:3px solid rgba(15,130,242,.25);border-radius:14px;border-top-color:#0f82f2;content:"";display:block;float:right;height:14px;margin:8px 2px -28px 0;width:14px}x-tutor .chat-footer{background:#fff;display:flex}x-tutor .chat-footer .hint{fill:#656073;cursor:pointer;position:relative;transition:fill .2s}x-tutor .chat-footer .hint:focus,x-tutor .chat-footer .hint:hover{fill:#3a3645}x-tutor .chat-footer .hint x-icon{display:block;padding:8px}x-tutor .chat-footer .input{-webkit-user-modify:read-write-plaintext-only;cursor:text;flex-grow:1;line-height:1.3;max-height:64px;overflow:auto;padding:10px 8px 10px 20px;-webkit-user-select:text;-moz-user-select:text;user-select:text}x-tutor .chat-footer .input:empty:before{color:#aaa;content:"Type a question… (beta)"}x-tutor .msg-wrap{align-items:flex-end;display:flex;flex-direction:column}x-tutor .msg{border-radius:16px 16px 3px 16px;margin-top:6px;width:-moz-fit-content;width:fit-content}x-tutor .toasts .msg{box-shadow:0 2px 6px rgba(0,0,0,.25);cursor:pointer;pointer-events:all}x-tutor .msg.hint,x-tutor .msg.question{line-height:1.4;padding:5px 12px}x-tutor .msg.hint{background:#0f82f2;color:hsla(0,0%,100%,.9)}x-tutor .msg.question{align-self:flex-start;background:#fff;border-radius:16px 16px 16px 3px;color:#0f82f2}x-tutor .msg.archie{background:#0f82f2;border-radius:28px 28px 3px 28px;padding:10px 6px 6px 10px;transition:background .2s}x-tutor .msg.archie x-icon{display:block}x-tutor .msg.correct{background:#1e9620}x-tutor .msg.incorrect{background:#b50c5a}x-tutor .msg.img{background-color:#000;background-size:cover;height:100px;width:150px}x-tutor .msg.video{background:#000;border-radius:3px;overflow:hidden}x-tutor .msg.video iframe{border:none;display:block;height:126px;width:224px}x-tutor .msg p{margin:0}x-tutor .msg .source{color:hsla(0,0%,100%,.5);font-size:10px;margin-top:2px;text-align:right}x-tutor .msg a{transition:color .2s}x-tutor .msg a:hover{color:#fff}html.webview x-tutor .chat-footer:not(.focus){border-bottom:env(safe-area-inset-bottom) solid #d0d3da;transition:border-bottom-width .3s}html.webview x-tutor .msg.archie{border-radius:28px;padding:8px}p .var,p .var strong{color:#cd0e66}.circled .var,.circled.var,.pill .var,.pill.var{color:#fff}x-var{-webkit-touch-callout:none;background:transparent;background:#cd0e66;border-radius:6px;color:hsla(0,0%,100%,.8);cursor:pointer;display:inline-block;line-height:28px;margin:-3px 2px;padding:0 18px;position:relative;touch-action:none;transition:color .2s,box-shadow .2s}.caption x-var{height:24px;line-height:24px}x-var:before{background:none;bottom:1px;content:" ";height:3px;left:5px;position:absolute;right:5px}x-var .left,x-var .right{opacity:.6;padding:7px 1px;position:absolute;top:0;transition:opacity .2s}x-var .left svg,x-var .left x-icon,x-var .right svg,x-var .right x-icon{color:#fff;display:block}x-var .left{left:0;padding-right:4px}x-var .right{padding-left:4px;right:0}x-var .bubble{bottom:28px;left:50%;margin-left:-60px;opacity:0;padding-bottom:6px;pointer-events:none;position:absolute;transform:scale(.5);transform-origin:bottom center;transition:transform .2s,opacity .2s;width:120px;z-index:500}x-var .bubble-box{background:#cd0e66;border-radius:6px;box-shadow:0 0 15px rgba(0,0,0,.15);display:block;height:10px;position:relative}x-var .bubble-arrow{border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #cd0e66;bottom:0;display:block;height:0;left:50%;margin-left:-6px;position:absolute;width:0}x-var .progress{background:#fff;border-radius:6px;bottom:2px;display:block;left:2px;position:absolute;top:2px}x-var.on,x-var:hover{box-shadow:0 0 20px rgba(0,0,0,.3);color:#fff}x-var.on .left,x-var.on .right,x-var:hover .left,x-var:hover .right{opacity:1}x-var.on .bubble,x-var:hover .bubble{opacity:1;transform:none}.var-overlay{display:none;height:100%;left:0;position:absolute;position:fixed;top:0;width:100%;z-index:999}x-play-btn{display:block;left:50%;position:absolute;top:50%}x-play-btn .play-btn-box{background:rgba(0,0,0,.8);border-radius:6px;cursor:pointer;height:44px;margin:-24px;opacity:.9;padding:2px;transition:transform .2s,opacity .2s,background .2s;width:44px}x-play-btn .play-btn-box x-icon{fill:#fff}x-video x-play-btn .play-btn-box{border:1px solid hsla(0,0%,100%,.8);margin:-25px;pointer-events:none}x-play-btn .play-btn-box:focus,x-play-btn .play-btn-box:hover,x-video:hover x-play-btn .play-btn-box{background:rgba(0,0,0,.9);opacity:1;transform:scale(1.2)}x-video.playing x-play-btn .play-btn-box{opacity:0;transform:scale(.2)}x-play-toggle,x-video{display:block}x-video{margin:0 auto;max-width:100%;position:relative}x-video .video-wrap{cursor:pointer;height:0}x-video video{-webkit-touch-callout:none;border-radius:4px;height:100%;position:absolute;width:100%}x-video x-icon{fill:#fff;display:block}x-video .credit{background:rgba(0,0,0,.8);border-top-right-radius:4px;color:#fff;font-size:10px;opacity:0;padding:1px 8px;position:absolute;right:0;top:0;transition:opacity .2s}x-video .credit:empty{display:none}x-video:hover .credit{opacity:.8}x-video .controls{display:none;transition:opacity .2s}x-video.playing:not(:hover) .controls{opacity:0}x-video .shadow{background:linear-gradient(180deg,transparent,#000);bottom:0;height:50px;opacity:.5;position:absolute;width:100%}x-video .play-pause-btn{bottom:0;cursor:pointer;left:0;padding:6px;position:absolute;transition:transform .2s}x-video .play-pause-btn:hover{transform:scale(1.2)}x-video .pause-icon,x-video.playing .play-icon{display:none}x-video.playing .pause-icon{display:block}x-video .timeline{bottom:16px;height:12px;left:50px;position:absolute;right:60px}x-video .bar{cursor:pointer;height:4px;padding:4px 0;position:relative}x-video .bar>*{border-radius:2px;height:4px;position:absolute;top:4px}x-video .background{width:100%}x-video .background,x-video .buffer{background:hsla(0,0%,100%,.5)}x-video .handle,x-video .progress{background:#cd0e66}x-video .handle{border-radius:8px;cursor:pointer;height:14px;margin-left:-7px;position:absolute;top:-1px;transition:transform .2s,background .2s;width:14px}x-video .handle:active,x-video .handle:hover{background:#f01e7f;transform:scale(1.4)}x-video .timecode{bottom:9px;color:#fff;font-size:16px;pointer-events:none;position:absolute;right:16px}x-tabbox{display:block;margin:1.5em 0}x-tabbox .body{background:#f5f5f6;border-radius:6px;padding-top:18px}html[theme=dark] x-tabbox .body{background:#2d2c38}x-tabbox .tab{display:none;padding:1em 24px}x-tabbox .tab p:last-child{margin-bottom:0}x-tabbox.full-width .tab{padding:0;position:relative}x-tabbox.full-width .tab svg{margin:0}x-select.tabs,x-tabbox .titles{-webkit-overflow-scrolling:touch;display:flex;margin:0 auto -18px;max-width:calc(100% - 12px);overflow:auto;overscroll-behavior:contain;width:-moz-fit-content;width:fit-content}x-select.tabs{position:relative;z-index:1}x-tabbox.sticky .titles{position:sticky;top:48px;z-index:2}.webview x-tabbox.sticky .titles{top:4px}x-select.tabs>*,x-tabbox h3{background:#c5c2cc;border:1px solid #fff;color:#333;cursor:pointer;flex-shrink:0;font-size:18px;font-weight:600;height:36px;line-height:36px;margin:0;padding:0 16px;text-align:center;transition:color .2s,background .2s}html[theme=dark] x-select.tabs>*,html[theme=dark] x-tabbox h3{background:#a7a6ab;border-color:#22212e;color:#3a3645}x-select.tabs>:focus,x-select.tabs>:hover,x-tabbox h3:focus,x-tabbox h3:hover{background:#807c89;color:#fff}x-select.tabs>.active,x-tabbox h3.active{background:#3a3645;color:#fff;cursor:default}html[theme=dark] x-select.tabs>.active,html[theme=dark] x-tabbox h3.active{background:#e9e9ea}x-select.tabs>:first-child,x-tabbox h3:first-child{border-radius:20px 0 0 20px}x-select.tabs>:last-child,x-tabbox h3:last-child{border-bottom-right-radius:20px;border-top-right-radius:20px}x-select.tabs>:nth-child(n+2),x-tabbox h3:nth-child(n+2){border-left:none}x-select.tabs>* .check,x-tabbox h3 .check{border:1px solid #fff;margin:0 -6px 3px 6px}@media screen and (max-width:540px){x-tabbox{margin:1.5em -24px}x-tabbox .body{border-radius:0;padding:0}x-select.tabs,x-tabbox .titles{margin:0 0 0 -1px;max-width:100%}x-select.tabs>:first-child,x-tabbox h3:first-child{border-radius:0}x-select.tabs>:last-child,x-tabbox h3:last-child{border-radius:0 8px 0 0}}body,html{-webkit-text-size-adjust:none;-moz-text-size-adjust:none;text-size-adjust:none;touch-action:pan-y;-webkit-user-select:none;-moz-user-select:none;user-select:none}main{padding:44px 40px 0 320px}x-course{display:block}article{margin:0 auto;max-width:760px;-webkit-user-select:text;-moz-user-select:text;user-select:text}h1{color:#000;font-weight:600;margin:112px 0 64px}html[theme=dark] h1{color:#fff}.course-title{display:none;font-size:24px;opacity:.3}.steps{min-height:calc(100vh - 664px)}.page-background{bottom:0;left:280px;position:fixed;right:0;top:44px;z-index:-1}article.dark .page-background{background:#000}.reveal-banner{background:hsla(255,7%,76%,.95);border-radius:0 24px 24px 0;color:#fff;font-size:13px;left:280px;line-height:17px;padding:4px 18px 4px 16px;position:fixed;top:60px;transition:transform .4s,opacity .4s;z-index:100}.reveal-banner svg{display:inline-block;margin:0 0 -2px 3px}.reveal-banner path{stroke:#fff;fill:none;stroke-width:1.5px;stroke-linecap:round}.reveal-banner .complete{cursor:pointer;display:block;width:-moz-fit-content;width:fit-content}.reveal-banner .complete:hover{text-decoration:underline}.reveal-banner.off{opacity:0;transform:translateX(-100%)}.section-dev{color:#999;text-align:center}.section-dev svg{fill:#999;margin:0 auto 6px;width:120px}.section-dev h2{margin:0 0 12px}footer{display:none;height:320px;padding-top:80px;position:relative}.next-section{display:none;margin:0 auto;max-width:100%;transition:transform .2s,filter .2s;width:-moz-max-content;width:max-content}.next-section:focus,.next-section:hover{filter:drop-shadow(0 4px 12px rgba(0,0,0,.25));transform:scale(1.05)}.next-arrow{border-radius:6px;box-sizing:border-box;color:#fff;height:74px;line-height:1.4;-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22720%22%20height%3D%2274%22%3E%3Cpath%20d%3D%22M718.8%2C34.2%2C705.2%2C2.8A4.9%2C4.9%2C0%2C0%2C0%2C701%2C0H0V74H701a4.9%2C4.9%2C0%2C0%2C0%2C4.2-2.8l13.6-31.4A7.7%2C7.7%2C0%2C0%2C0%2C718.8%2C34.2Z%22%2F%3E%3C%2Fsvg%3E");mask:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22720%22%20height%3D%2274%22%3E%3Cpath%20d%3D%22M718.8%2C34.2%2C705.2%2C2.8A4.9%2C4.9%2C0%2C0%2C0%2C701%2C0H0V74H701a4.9%2C4.9%2C0%2C0%2C0%2C4.2-2.8l13.6-31.4A7.7%2C7.7%2C0%2C0%2C0%2C718.8%2C34.2Z%22%2F%3E%3C%2Fsvg%3E");-webkit-mask-position:right top;mask-position:right top;-webkit-mask-size:720px 74px;mask-size:720px 74px;max-width:100%;padding:8px 36px 0 18px;position:relative;transition:background .2s;-webkit-user-select:none;-moz-user-select:none;user-select:none}.next-arrow .small{color:hsla(0,0%,100%,.6);font-size:16px}.next-arrow .title{font-size:26px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.next-arrow .next-icon{background-position:50%;background-size:cover;border-radius:6px 0 0 6px;border-right:2px solid #fff;height:74px;left:0;position:absolute;top:0;width:74px}.next-arrow .next-icon+.small,.next-arrow .next-icon+.small+.title{padding-left:74px}.skip-step{bottom:0;box-sizing:border-box;color:#888;display:none;font-size:14px;line-height:20px;margin:0;padding:0 40px 24px;position:absolute;text-align:center;width:100%}html[theme=dark] .skip-step{color:#fff}.skip-step a{white-space:nowrap}x-course.ready .skip-step{display:block}@media (max-width:650px){.skip-step br{display:none}}.skip-step svg{display:block;margin:8px auto 0}@media screen and (max-width:840px){main{padding:44px 40px 0}.page-background{left:0}h1{margin:80px 0 54px}.course-title{display:block}.reveal-banner{left:0}}@media screen and (max-width:540px){main{padding:44px 24px 0}.overflow-wrap{margin-left:-24px;margin-right:-24px;padding:0 24px}}@media print{.page-background,footer,header,x-course-sidebar,x-tutor{display:none!important}main{margin:0!important;padding:0 20px!important}article{max-width:none!important}}html.webview main{padding:0 calc(40px + env(safe-area-inset-right)) 0 calc(40px + env(safe-area-inset-left))}html.webview .page-background{left:0;top:0}html.webview .skip-step{padding:0 40px calc(24px + env(safe-area-inset-bottom))}html.webview .steps{min-height:calc(100vh - 620px)}html.webview .reveal-banner{left:0;padding-left:calc(12px + env(safe-area-inset-left));top:16px}@media screen and (max-width:540px){html.webview main{padding:0 calc(24px + env(safe-area-inset-right)) 0 calc(24px + env(safe-area-inset-left))}html.webview .skip-step{background:#eee;margin:0 calc(-24px - env(safe-area-inset-right)) -6px calc(-24px - env(safe-area-inset-left));padding:14px 90px calc(14px + env(safe-area-inset-bottom)) 24px;text-align:left;width:auto}html[theme=dark] html.webview .skip-step{background:#444}}x-algebra-flow,x-math{position:relative}x-algebra-flow svg.equation,x-math svg.equation{fill:currentColor;overflow:visible;width:100%}x-algebra-flow svg.equation *,x-math svg.equation *{transform-origin:0 0}x-algebra-flow .overlay,x-math .overlay{left:0;position:absolute;top:0}x-algebra-flow .overlay>*,x-math .overlay>*{position:absolute;transform-origin:0 0}x-algebra-flow line,x-algebra-flow path,x-math line,x-math path{fill:none;stroke:currentColor;stroke-width:1.45;stroke-linejoin:round;stroke-linecap:round;transform-box:view-box;transform-origin:top left}x-algebra-flow text,x-math text{dominant-baseline:text-before-edge;stroke:currentColor;fill:currentColor;stroke-width:0;font-family:Mathigon Symbol,Source Sans Pro,sans-serif}x-algebra-flow text.font-normal,x-math text.font-normal{font-family:Source Sans Pro,Helvetica,sans-serif}x-math{display:inline-block;font-style:normal}x-math svg.equation{height:100%}x-algebra-flow{display:block;margin:1.5em auto;max-width:440px;position:relative}x-algebra-flow .legend-box{border-top:2px solid #ccc;font-size:16px;line-height:1.5}x-algebra-flow .legend-box p{display:none}x-algebra-flow .legend-box li{display:none;margin:0;padding:8px 48px 0;text-align:center}x-algebra-flow .nav{height:0;position:relative}x-algebra-flow .back,x-algebra-flow .next{border-radius:0 0 6px 6px;display:block;height:36px;min-width:0;padding:0;position:absolute;top:0;transition:opacity .4s,background .2s,color .2s,box-shadow .2s,transform .2s;width:36px;z-index:1}x-algebra-flow .back.hide,x-algebra-flow .next.hide{opacity:0;pointer-events:none}x-algebra-flow .back x-icon,x-algebra-flow .next x-icon{margin:6px}x-algebra-flow .back{transform-origin:left top}x-algebra-flow .next{right:0;transform-origin:right top}.m-red{color:#cd0e66}.m-blue{color:#0f82f2}.m-green{color:#22ab24}.m-yellow{color:#fd8c00}.m-orange{color:#eb4726}.m-purple{color:#6d3bbf}.m-teal{color:#009ea6}.m-lime{color:#bfc212}.lgrey{color:#aaa}.gradient-red{background:#cd0e66 linear-gradient(to bottom right,#cd0e66,#eb4726)}.gradient-orange{background:#eb4726 linear-gradient(to bottom right,#eb4726,#fd8c00)}.gradient-yellow{background:#fd8c00 linear-gradient(to bottom right,#fd8c00,#bfc212)}.gradient-lime{background:#bfc212 linear-gradient(to bottom right,#bfc212,#22ab24)}.gradient-green{background:#22ab24 linear-gradient(to bottom right,#22ab24,#009ea6)}.gradient-teal{background:#009ea6 linear-gradient(to bottom right,#009ea6,#0f82f2)}.gradient-blue{background:#0f82f2 linear-gradient(to bottom right,#0f82f2,#6d3bbf)}.gradient-purple{background:#6d3bbf linear-gradient(to bottom right,#6d3bbf,#cd0e66)}@media (min-width:601px){header .nav-small{display:none!important}}@media (max-width:600px){header .nav-large{display:none!important}header .nav-item>.nav-link{padding:4px 12px}}x-modal#login{width:500px}x-modal#login .modal-body{padding:24px 16px 12px}x-modal#login h2{text-align:center}x-modal#login .btn-row.social{display:flex;flex-wrap:wrap;justify-content:center}x-modal#login .btn-row.social .btn,x-modal#login .btn-row.social .icon-btn,x-modal#login .btn-row.social .next-step{margin:6px;width:140px}x-modal#login .hr{background:#c5c2cc;height:1px;margin:1em 8px;position:relative}x-modal#login .hr span{background:#fff;color:#aaa;display:block;font-size:14px;left:50%;line-height:1;margin-top:-7px;padding:0 12px;position:absolute;text-align:center;text-transform:uppercase;transform:translateX(-50%);white-space:nowrap}.polypad,.tangram{--canvas-bg:#fff;--canvas-fg:#181824}[theme=dark] .polypad,[theme=dark] .tangram{--canvas-bg:#22212e;--canvas-fg:#e2e1e6}x-equation{-webkit-touch-callout:none;background:transparent;background:#0f82f2;border-radius:6px;color:#fff;cursor:pointer;cursor:text;display:inline-block;height:auto;line-height:28px;margin:0;padding:4px 34px 4px 12px;position:relative;text-align:left;transition:background .2s,color .2s,padding .2s,box-shadow .2s}.caption x-equation{height:24px;line-height:24px}x-equation:before{background:none;bottom:1px;content:" ";height:3px;left:5px;position:absolute;right:5px}x-equation.small{font-size:1em;line-height:24px;padding:2px 28px 2px 8px}x-equation.active{z-index:1}x-equation.done{background:none;box-shadow:none;color:#0f82f2;cursor:default;padding:0}html.is-tabbing x-equation.active{box-shadow:0 0 0 2px currentColor,0 0 0 4px #0f82f2}x-equation .input{height:0;overflow:hidden;position:absolute;transform:scale(0);width:0}x-equation.done .input{display:none}x-equation:not(.done) mi+mi{margin-left:0}x-equation>.math{display:inline-block;min-width:80px}x-equation.small .math{min-width:25px}x-equation .math.empty{margin-right:-6px}x-equation .math.empty:after{content:"???"}x-equation.small .math.empty:after{margin-left:10px}x-equation.done .math{min-width:0}x-equation .cursor{animation:cursor 1s step-end infinite;border-right:1px solid;display:none;margin-left:-1px}x-equation.active .cursor{display:inline-block}x-equation mrow.empty{min-width:12px;text-align:center}x-equation mrow.empty:after{content:"◻︎";display:inline-block;margin:0 -.5em;opacity:.5}x-equation .keys{left:0;margin-top:6px;opacity:0;pointer-events:none;position:absolute;top:100%;transform:translateY(-12px);transition:opacity .2s,transform .2s;width:136px}x-equation .btn,x-equation .icon-btn,x-equation .next-step{border-radius:4px;float:left;height:24px;line-height:24px;margin:0 6px 6px 0;min-width:0;padding:2px;width:24px}x-equation .btn rect,x-equation .icon-btn rect,x-equation .next-step rect{fill:#fff;opacity:.45}x-equation .btn line,x-equation .icon-btn line,x-equation .next-step line{stroke:#fff}x-equation .btn path,x-equation .icon-btn path,x-equation .next-step path{fill:#fff}x-equation.active .keys{opacity:1;pointer-events:all;transform:none}x-equation .error{margin-top:-12px;pointer-events:none;position:absolute;right:6px;top:50%}x-equation .error-message{background:#cd0e66;border-radius:6px;bottom:100%;box-shadow:0 2px 4px rgba(0,0,0,.2);color:#fff;cursor:pointer;font-size:14px;left:0;line-height:1.4;margin-bottom:10px;max-width:180px;padding:6px 12px;pointer-events:none;position:absolute;transform-origin:18px bottom -6px;width:-moz-max-content;width:max-content;z-index:10}x-equation .error-message p{margin:0;text-align:left!important}x-equation .error-message:after{border:6px solid transparent;border-top-color:#cd0e66;bottom:-12px;content:" ";left:12px;position:absolute}x-equation .error,x-equation .error-message{opacity:0;transform:scale(.5);transition:opacity .2s,transform .2s}x-equation.has-error:not(.active) .error,x-equation.has-error:not(.active) .error-message{opacity:1;transform:none}x-equation.has-error:not(.active) .error-message{pointer-events:all;transition-delay:.4s}x-equation.done .error,x-equation.done .error-message{display:none}x-equation.small .error{margin-top:-10px;right:4px}x-equation.small .error svg{height:18px;width:18px}x-equation-system{display:block}article x-equation-system table td,table.eqn-system td{padding:.2em .3em;text-align:left}table.eqn-system td{vertical-align:baseline}table.eqn-system td:first-child{text-align:right}.tile{transform-box:view-box;transform-origin:0 0}.tile .handle:not(.persistent),.tile .outline{display:none}.tile.active .handle,.tile.active .link-handle,.tile.active .outline{display:block!important}.tile.no-handles.active .handle{display:none!important}x-polypad:not(.author-mode) .hidden-tile{display:none}x-polypad:not(.author-mode) .locked-tile{pointer-events:none}.geo-path.hidden-tile,.geo-point.hidden-tile,.hidden-tile>:not(.outline,.handle){opacity:.4}.link-handle{fill:#0f82f2;stroke:transparent;stroke-width:10}.link-dot{stroke:var(--canvas-bg);fill:#0f82f2;stroke-width:3}.link-bar{stroke:#0f82f2;stroke-width:5px;fill:none;cursor:move}.link-bar path.dashed{stroke-dasharray:6px 10px;stroke-dashoffset:8px}.group-outline,.rotate-bar,.tile .handle,.tile .outline{stroke-width:6px}.group-outline,.rotate-bar,.tile .outline{stroke:var(--canvas-fg);fill:none}.hidden-tile .outline,.locked-tile .outline{stroke-dasharray:10px 16px}.rotate-circle,.tile .handle{fill:var(--canvas-fg)}.tile path.handle{stroke:var(--canvas-fg)}.group-outline,.rotate-bar{pointer-events:none}.group-shadow{fill:var(--canvas-fg);opacity:15%}.rotate-circle,.tile circle.handle{stroke:transparent;stroke-width:8px}.rotate-circle{cursor:move}.balance,.number-grid-cell circle,.number-tile,.polygon-tile{stroke:var(--canvas-bg);stroke-width:1px}.high-contrast .balance,.high-contrast .number-grid-cell circle,.high-contrast .number-tile,.high-contrast .polygon-tile{stroke:var(--canvas-fg);stroke-width:2px}.prime-move,.prime-segment:hover{stroke:var(--canvas-fg);stroke-width:3px}.grid-axis,.number-line-ticks{stroke-width:3px}.active .grid-axis,.active .number-line-ticks{stroke-width:6px}.axis-gridlines{stroke-width:2px;opacity:.15;pointer-events:none}.penrose-circles{fill:none;stroke-width:2px;stroke:#fff;opacity:.4}.dice-face{stroke-width:4px}.dice-dot{fill:#fff;opacity:.85}.balance-beam{fill:none;stroke-width:8px}.active .balance,.active .balance-beam,.active .bucket{stroke:var(--canvas-fg);stroke-width:6px}.dropzone{fill:none;stroke:var(--canvas-fg);stroke-width:4px;stroke-dasharray:8px 12px;stroke-dashoffset:4px;pointer-events:none}.spinner{fill:var(--canvas-fg);stroke:var(--canvas-bg)}.spinner,pp-tiles .spinner{stroke-width:1px}.utensil .glass{fill:hsla(258,9%,78%,.7)}.utensil .ticks{stroke-width:.6;stroke:var(--canvas-fg);stroke-linecap:butt;pointer-events:none}.utensil .compass-frame,.utensil .compass-legs{fill:#c5c2cc}.utensil .compass-needle,.utensil .compass-top{fill:#656073}.utensil .compass-screw{fill:#c5c2cc}.utensil .compass-pencil{stroke:#656073}.utensil text{fill:var(--canvas-fg);font-size:12px}.polypad.dark .utensil .glass{fill:rgba(101,96,115,.7)}.polypad.dark .utensil .compass-legs{fill:#656073}.polypad.dark .utensil .compass-needle{fill:#c5c2cc}.dot-cell{fill:none;stroke-width:20px;fill-opacity:.3}.bead-gradient{stroke:var(--canvas-bg);fill:url(#sphere-gradient);pointer-events:none}.active .bead-gradient{stroke:var(--canvas-fg);stroke-width:6px}.clock-handle{stroke:transparent;stroke-width:16px;cursor:move;transform-origin:bottom center}.axis-label{font-size:16px;font-weight:700}.axis-label,.geo-label{stroke:var(--canvas-bg);stroke-width:4px;stroke-linejoin:round;paint-order:stroke}.is-safari .axis-label,.is-safari .geo-label{stroke:none}.no-labels text{display:none}.number-line-label,.polygon-label,.polygon-text-label{font-weight:600}.number-line-label,.polygon-label{font-size:18px}.polygon-text-label{pointer-events:none}.number-line-label{transform-box:fill-box;transform-origin:center}.fraction .equation text,.number-line .equation text{font-weight:600}.fraction .equation line{stroke-width:2px}.number-grid-cell.active circle{stroke:var(--canvas-fg);stroke-width:6px}.number-grid-cell text{font-size:24px}.card-label path,.card-label rect{fill:var(--canvas-fg)}.card-label text{stroke:none;fill:var(--canvas-bg);font-size:14px;font-weight:600}.hidden-input{display:none;height:0;overflow:hidden;position:absolute;transform:scale(0);width:0}.problem-box{stroke:#0f82f2;stroke-width:4px;fill:rgba(15,130,242,.25);transition:stroke .3s,fill .3s}.correct .problem-box{stroke:#22ab24;fill:rgba(34,171,36,.25)}.incorrect .problem-box{stroke:#cd0e66;fill:rgba(205,14,102,.25)}.active .problem-box{stroke-width:6px}.problem-text{fill:var(--canvas-fg);color:var(--canvas-fg);cursor:text;font-size:32px;text-align:center}.problem-marker{transform:scale(0);transition:transform .2s cubic-bezier(.33,1.9,.52,.7)}.problem-marker.show{transform:none}.action-card-text{cursor:text;display:none;font-size:20px;text-align:center}@keyframes cursor{0%,to{opacity:1}50%{opacity:0}}.equation{transform-origin:0 0}.equation line,.equation path{fill:none;stroke:currentColor;stroke-width:1.45;transform-box:view-box;transform-origin:top left}.equation text{dominant-baseline:text-before-edge;stroke:currentColor;fill:currentColor;stroke-width:0;font-family:Mathigon Symbol,Source Sans Pro,sans-serif}.equation text.font-normal{font-family:Source Sans Pro,Helvetica,sans-serif}.equation .placeholder{fill:currentColor;opacity:.3}.equation .cursor{stroke:#0f82f2;stroke-width:1.5px;animation:cursor 1s step-end infinite}.equation .range{fill:#87c1f9}.text-edit{-webkit-user-modify:read-write-plaintext-only;word-wrap:normal;font-size:20px;line-height:1.4em;padding:2px 8px;pointer-events:none;-webkit-user-select:text;-moz-user-select:text;user-select:text;width:-moz-fit-content;width:fit-content}.text-edit[contenteditable]{pointer-events:all}.geo-path{fill:none;stroke:currentColor;stroke-width:3px}.geo-path.fill{fill:currentColor;stroke:none;opacity:.5}.geo-path.fill.hover{opacity:.8}.geo-point{fill:currentColor}.geo-point.intersection{stroke:currentColor;stroke-width:3px;fill:var(--canvas-bg)}svg:not(:hover) .geo-point.pending{display:none!important}.geo-shadow{stroke-width:10px;stroke:currentColor;fill:none;display:none}.table-tile{background:var(--canvas-bg);border-left:1px solid var(--border);border-top:1px solid var(--border);display:grid;width:-moz-fit-content;width:fit-content}.table-tile.active{cursor:text}.table-selection{stroke:var(--canvas-fg);fill:var(--canvas-fg);fill-opacity:10%;stroke-width:5px;pointer-events:none}.table-cell{-webkit-user-modify:read-write-plaintext-only;border-bottom:1px solid var(--border);border-right:1px solid var(--border);box-sizing:border-box;color:var(--canvas-fg);font-size:20px;height:50px;line-height:45px;max-width:200px;min-width:100px;padding:2px 8px;text-align:center;-webkit-user-select:text;-moz-user-select:text;user-select:text;white-space:pre}.table-cell.header{background:var(--header);font-weight:700}.table-cell:focus{outline:none}.table-cell:focus:empty{content:"​";display:inline}.table-cell .table-color{border-radius:15px;display:inline-block;height:30px;margin-bottom:-8px;width:30px}.table-hidden{left:0;opacity:0;pointer-events:none;position:fixed;top:0}.chart-line{fill:none;stroke-width:3}.chart-outline{fill:none;stroke-width:6px;stroke:var(--canvas-fg)}.chart-shadow{stroke-width:10px;fill:none;opacity:.4}.donut-hole{fill:var(--canvas-bg)}.chart-focussed{cursor:pointer}@keyframes speaker-move{0%{transform:none}50%{transform:translateX(3px)}to{transform:none}}@keyframes metronome{0%{transform:rotate(-30deg)}50%{transform:rotate(30deg)}to{transform:rotate(-30deg)}}.effects-speaker-move{animation:speaker-move .1s}.polypad svg.overlay,x-polypad{stroke-linecap:round;stroke-linejoin:round;text-anchor:middle}x-polypad{text-anchor:middle;background:var(--canvas-bg);display:block;overflow:hidden;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}x-polypad .canvas{height:100%;outline:none;width:100%}x-polypad .html-overlay,x-polypad .html-overlay>*{left:0;position:absolute;top:0}x-polypad .selection{stroke:#87c1f9;fill:rgba(135,193,249,.5);display:none}x-polypad .stroke{stroke-width:3px;fill:none}x-polypad .stroke.marker{stroke-width:8px}x-polypad .stroke.highlighter{stroke-width:24px;mix-blend-mode:multiply;opacity:.4}x-polypad .stroke.cut{stroke:var(--canvas-fg);stroke-dasharray:10px}.dark x-polypad .stroke.highlighter{mix-blend-mode:screen}x-polypad[data-tool=text]{cursor:text}x-polypad[data-tool=pan]{cursor:move}x-polypad[data-tool=cutPolygon],x-polypad[data-tool=geoPending],x-polypad[data-tool=geo]{cursor:crosshair}x-polypad .geo-paths,x-polypad .geo-points,x-polypad .geo-shadows,x-polypad .grid,x-polypad .selection,x-polypad .strokes,x-polypad:not([data-tool=move]) .tiles{pointer-events:none}x-polypad .grid{opacity:var(--grid-opacity,.25)}x-polypad.high-contrast .grid{opacity:1}x-polypad .geo-shadows{opacity:.3}x-polypad .grid-pattern line,x-polypad .grid-pattern rect{stroke:var(--canvas-fg);fill:none}x-polypad .grid-pattern .filled,x-polypad .grid-pattern circle{fill:var(--canvas-fg);stroke:none}x-polypad .image-drop{background:rgba(15,130,242,.1);border:6px dashed #0f82f2;box-sizing:border-box;display:none;height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%}x-polypad .tile-error{background:#fec680;border-radius:6px;bottom:calc(100% + 10px);box-shadow:0 2px 6px rgba(0,0,0,.1);color:#000;font-size:16px;left:-12px;line-height:1.4;padding:5px 10px;position:relative;position:absolute;text-align:left;top:auto;transform-origin:24px bottom -6px;width:260px}x-polypad .tile-error:after{border-left:8px solid transparent;border-right:8px solid transparent;border-top:8px solid #fec680;content:"";display:block;left:50%;left:24px;margin-left:-8px;position:absolute;top:100%}x-polypad .tile-error button{color:#0f82f2;cursor:pointer}x-polypad .tile-error button:focus,x-polypad .tile-error button:hover{text-decoration:underline}x-polypad.handdrawn .canvas{filter:url(#handdrawn)}x-polypad.handdrawn .geo-paths,x-polypad.handdrawn .strokes{filter:url(#pencil)}x-polypad .bg-icon{bottom:-60px;opacity:.1;pointer-events:none;position:absolute;right:-60px}x-polypad .rotate-label{background-color:#181824;border:1px solid;border-color:var(--canvas-bg);border-radius:6px;color:#fff;font-size:14px;font-weight:600;padding:0 7px 1px;pointer-events:none;position:absolute;top:0}.input-field{background:hsla(0,0%,100%,.1);border:1px solid hsla(0,0%,100%,.16);border-radius:5px;line-height:24px;text-align:center}.input-field:focus,.input-field:hover{background-color:hsla(0,0%,100%,.18)}select.input-field{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22rgba(255%2C%20255%2C%20255%2C%200.5)%22%20d%3D%22m19.9%207.5a1.4%201.4%200%200%200%20-2.1%200l-5.8%205.8-5.8-5.8a1.4%201.4%200%200%200%20-2.1%200%201.5%201.5%200%200%200%200%202.1l6.8%206.9a1.6%201.6%200%200%200%202.2%200l6.8-6.9a1.4%201.4%200%200%200%200-2.1z%22%2F%3E%3C%2Fsvg%3E");background-position:top 6px right 5px;background-repeat:no-repeat;background-size:16px 16px;cursor:pointer;padding:0 24px 0 8px;text-align:left;width:auto}select.input-field option{color:initial}input.toggle[type=checkbox]{-webkit-appearance:none;-moz-appearance:none;appearance:none;height:0;position:absolute;width:0}input.toggle+.control{background:hsla(0,0%,100%,.3);border-radius:12px;content:"";cursor:pointer;display:block;height:10px;padding:1px 0;transition:background .2s;width:32px}input.toggle+.control:after{background-color:#9d9ba2;border-radius:12px;content:"";display:block;height:18px;margin:-4px -1px;transition:transform .2s;width:18px}input.toggle:checked+.control{background:#0f82f2}input.toggle:checked+.control:after{background:#ebebec;transform:translateX(16px)}input.toggle:indeterminate+.control:after{background:#c4c3c7;transform:translateX(8px)}.is-tabbing input.toggle:focus+.control{outline:auto}x-factris{background:#083781;border-radius:0 0 12px 12px;color:#fff;display:block;font-family:Comfortaa,sans-serif;line-height:1.15;padding:10px;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:1}x-factris .factris-body{background:#0b4bb1;border-radius:8px;box-shadow:0 -4px 0 #06275b;height:500px;margin-top:4px;overflow:hidden;position:relative;width:340px}x-factris .factris-panel-left,x-factris .factris-panel-right,x-factris .factris-panel-top{background:#083781;position:absolute}x-factris .factris-panel-top{border-radius:12px 12px 0 0;bottom:100%;left:50%;margin-left:-90px;padding-top:10px;text-align:center;width:180px}x-factris .factris-panel-top .corner.left{bottom:-1px;left:-12px}x-factris .factris-panel-top .corner.right{bottom:-1px;right:-12px}x-factris .factris-panel-left{border-radius:12px 0 0 12px;left:-120px;padding:10px 0 10px 10px;text-align:right;top:0;width:110px}x-factris .factris-panel-left .corner{bottom:-16px;right:-1px}x-factris .factris-panel-right{border-radius:0 12px 12px 0;padding:10px 10px 10px 0;right:-100px;text-align:center;top:0;width:90px}x-factris .factris-panel-right .corner{bottom:-16px;left:-1px}x-factris,x-factris .factris-panel-left,x-factris .factris-panel-right{box-shadow:0 4px 0 #041e47}x-factris .corner{position:absolute}x-factris .corner path{fill:#083781}x-factris .corner path.dark{fill:#041e47}x-factris .play{fill:#fff;border:10px solid #fff;border-radius:100%;box-shadow:0 4px 0 #06275b,inset 0 4px 0 #06275b;cursor:pointer;display:block;left:50%;margin-left:-50px;position:absolute;top:50%}x-factris .play svg{display:block}x-factris .logo{filter:drop-shadow(0 4px 0 #06275b);height:60px;left:50%;margin:-100px 0 0 -100px;position:absolute;top:50%;width:200px}x-factris .overlay{font-size:48px;font-weight:700;left:0;position:absolute;text-align:center;text-shadow:0 2px 0 #06275b;top:71px;width:100%;z-index:10}x-factris .logo,x-factris .overlay,x-factris .play{opacity:0;pointer-events:none;transform:scale(.5);transition:opacity .2s linear,transform .4s cubic-bezier(.33,1.9,.52,.7)}x-factris .logo.show,x-factris .overlay.show,x-factris .play.show{opacity:1;pointer-events:all;transform:none}x-factris button{background:#cd0e66;border:none;border-radius:4px;box-shadow:0 4px 0 #6e0736;cursor:pointer;transition:transform .08s,box-shadow .08s,background .08s}x-factris button x-icon{fill:#fff}x-factris button .icon{fill:#fff;margin:0 auto}x-factris button:focus,x-factris button:hover{background:#f01e7f}x-factris button.active,x-factris button:active{background:#cd0e66;box-shadow:none;transform:translateY(4px)}x-factris .factris-keys{display:flex;justify-content:center;margin-bottom:4px;margin-top:10px}x-factris .factris-keys>button{width:50px}x-factris .factris-keys>button x-icon{margin-top:6px}x-factris .keys-center{display:flex;flex-direction:column;margin:0 14px;width:100px}x-factris .keys-center button{width:100px}x-factris .keys-center button:first-child{height:42px;margin-bottom:14px}x-factris .keys-center button:first-child x-icon{margin-bottom:-4px}x-factris .keys-center button:last-child x-icon{margin:-5px 0 -7px}x-factris .keys-play{display:flex;margin-bottom:12px}x-factris .keys-play x-icon{margin-top:5px}x-factris .keys-play button{height:48px;width:50px}x-factris .keys-play button:first-child{margin-right:10px}x-factris .discharge{border-radius:100%;height:74px;margin:8px 0 4px;width:74px}x-factris .discharge-count{display:inline-block;margin:8px 0 4px}x-factris .discharge-count circle{fill:none;stroke:#fff;stroke-width:10px;stroke-dasharray:201px;transform:rotate(-90deg);transition:stroke-dashoffset .2s}x-factris .discharge-count text{fill:#fff;text-anchor:middle;font-family:inherit}x-factris .discharge-count text.large{font-size:22px;font-weight:700}x-factris .discharge-count text.small{font-size:9px}x-factris .text-small{font-size:14px;white-space:nowrap}x-factris .text-large{font-size:28px;font-weight:700;white-space:nowrap}x-factris .text-large.margin{margin-top:8px}x-factris .text-large.narrow{letter-spacing:-.07em}x-factris hr{background:hsla(0,0%,100%,.2);height:2px;margin:8px 0 10px}x-factris .highscore-panel{text-align:left}x-factris .highscore-title{font-size:16px;margin-bottom:8px}x-factris .highscore-panel table{font-size:12px;line-height:1.3;opacity:.8;width:100%}x-factris .highscore-panel table td:nth-child(2){text-align:right}x-factris .highscore-panel table a:hover{opacity:1;text-decoration:underline}x-factris .highscore{height:100%;left:0;overflow:auto;position:absolute;top:0;width:100%}x-factris .highscore .text-large{margin:40px;text-align:center}x-factris .highscore x-icon{fill:#fff;margin-bottom:-6px}x-factris .highscore table{margin:0 40px;width:calc(100% - 80px)}x-factris .highscore table td{border-bottom:1px solid hsla(0,0%,100%,.5);padding:6px 0 5px}x-factris .highscore table td:last-child{text-align:right}x-factris .highscore table tr:last-child td{border:none}x-factris .factris-board{height:500px;width:340px}x-factris .grid{opacity:.6}x-factris .grid .faint-grid{opacity:.5}x-factris .grid line{stroke:#fff;stroke-linecap:round}x-factris .grid line.thick{stroke-width:2}x-factris .tiles rect{fill:#22ab24;stroke:#6fc871;stroke-width:1;stroke-linejoin:round;transition:fill .2s}x-factris .tiles rect.fixed{fill:#fd8c00;stroke:#feb459}x-factris .tiles rect.removing{fill:#ffe7ca;stroke:#ffe7ca;opacity:0}x-factris .tiles rect.error{fill:#cd0e66;stroke:#df629c}x-factris .tiles.animated rect{transition:fill .2s,stroke .2s,transform .3s,opacity .2s;transition-delay:0s,0s,.7s,.6s}x-factris .scores text{text-anchor:middle;fill:#cd0e66;stroke:#fff;stroke-width:3px;stroke-linejoin:round;font-size:20px;font-weight:700;opacity:0;paint-order:stroke;transform:scale(.5);transition:opacity .2s linear,transform .4s cubic-bezier(.33,1.9,.52,.7)}.is-safari x-factris .scores text{stroke:none}x-factris .scores .visible text{opacity:1;transform:none}x-factris .highscore-btn{display:none}@media (max-height:740px),(max-width:590px){x-factris{display:flex;flex-direction:column;height:100%;padding:0;white-space:nowrap}x-factris,x-factris .factris-panel-left,x-factris .factris-panel-right,x-factris .factris-panel-top{border-radius:0;box-shadow:none}x-factris .corner,x-factris .highscore-panel,x-factris hr{display:none!important}x-factris .factris-body{flex:1 1;margin:4px 10px 0;width:auto}x-factris .factris-board{height:100%;margin:0 auto;width:100%}x-factris .factris-panel-top{background:none;bottom:auto;top:128px;z-index:2}x-factris .factris-panel-top.hide{display:none}x-factris .factris-panel-left,x-factris .factris-panel-right{display:flex;padding:10px;position:static;width:auto}x-factris .factris-panel-left>:first-child,x-factris .factris-panel-right>:first-child{flex-grow:1}x-factris .factris-panel-left{border-bottom:2px solid hsla(0,0%,100%,.2);border-radius:0}x-factris .keys-play button{height:38px;width:40px}x-factris .keys-play button x-icon{margin-top:3px}x-factris .keys-play button x-icon,x-factris .keys-play button x-icon svg{height:32px!important;width:32px!important}x-factris .factris-panel-left .panel-item{width:100px}x-factris .highscore-btn{display:block;margin-left:10px}x-factris .factris-panel-right{border-radius:0;text-align:left}x-factris .factris-panel-right .text-large{display:inline-block;margin-right:8px}x-factris .factris-panel-right .text-large:after{content:","}x-factris .factris-panel-right .text-large:last-child:after{content:none}x-factris .factris-keys{margin-bottom:14px}html.webview x-factris .factris-keys{margin-bottom:calc(14px + env(safe-area-inset-bottom))}x-factris .discharge{height:39px;margin:-1px 0 0 6px;width:40px}x-factris .discharge x-icon{margin-top:3px}x-factris .discharge x-icon,x-factris .discharge x-icon svg{height:28px!important;width:28px!important}x-factris .discharge-count{height:40px;margin:-1px 0 -1px 6px;width:40px}x-factris .discharge-count text.large{font-size:32px;transform:translateY(11px)}x-factris .discharge-count .small{display:none}x-factris .text-large{font-size:24px}x-factris .text-small{font-size:12px}x-factris .keys-play,x-factris .text-large.margin{margin:0}}marker#axis-arrow{fill:#3a3645}html[theme=dark] marker#axis-arrow{fill:#fff}x-coordinate-sketch,x-coordinate-system,x-geopad{display:block;position:relative}x-coordinate-sketch svg.canvas,x-coordinate-system svg.canvas,x-geopad svg.canvas{display:block;height:100%!important;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}x-coordinate-sketch .grid,x-coordinate-system .grid,x-geopad .grid{opacity:.1}html[theme=dark] x-coordinate-sketch .grid,html[theme=dark] x-coordinate-system .grid,html[theme=dark] x-geopad .grid{opacity:.25}x-coordinate-sketch .grid line,x-coordinate-system .grid line,x-geopad .grid line{stroke:#000;stroke-width:2px}html[theme=dark] x-coordinate-sketch .grid line,html[theme=dark] x-coordinate-system .grid line,html[theme=dark] x-geopad .grid line{stroke:#fff}x-coordinate-sketch .axes line,x-coordinate-system .axes line,x-geopad .axes line{stroke:#3a3645;stroke-width:2px}html[theme=dark] x-coordinate-sketch .axes line,html[theme=dark] x-coordinate-system .axes line,html[theme=dark] x-geopad .axes line{stroke:#fff}x-coordinate-sketch .axes,x-coordinate-sketch .grid,x-coordinate-system .axes,x-coordinate-system .grid,x-geopad .axes,x-geopad .grid{stroke-linecap:round;transition:opacity .2s}x-coordinate-sketch .axes line:not(.tick),x-coordinate-system .axes line:not(.tick),x-geopad .axes line:not(.tick){marker-end:url(#axis-arrow)}x-coordinate-sketch .labels text,x-coordinate-system .labels text,x-geopad .labels text{fill:#3a3645;stroke-width:4px;stroke-linejoin:round;stroke:#fff;font-size:14px;paint-order:stroke}.is-safari x-coordinate-sketch .labels text,.is-safari x-coordinate-system .labels text,.is-safari x-geopad .labels text{stroke:none}html[theme=dark] x-coordinate-sketch .labels text,html[theme=dark] x-coordinate-system .labels text,html[theme=dark] x-geopad .labels text{stroke:#000}x-coordinate-sketch x-gesture,x-coordinate-system x-gesture,x-geopad x-gesture{left:0;position:absolute;top:0}@keyframes pulse{0%{opacity:.6;transform:none}to{opacity:0;transform:scale(3)}}x-coordinate-sketch,x-coordinate-system{color:#cd0e66;margin:2em auto;touch-action:pan-y}x-coordinate-sketch svg,x-coordinate-system svg{stroke-linecap:round;stroke-linejoin:round}x-coordinate-sketch .plot path,x-coordinate-system .plot path{fill:none;stroke:currentColor;stroke-width:3px}x-coordinate-sketch .plot circle,x-coordinate-system .plot circle{fill:currentColor}x-coordinate-sketch .crosshair,x-coordinate-system .crosshair{display:none}x-coordinate-sketch .crosshair circle,x-coordinate-system .crosshair circle{fill:#fff;stroke:currentColor;stroke-width:3px}html[theme=dark] x-coordinate-sketch .crosshair circle,html[theme=dark] x-coordinate-system .crosshair circle{fill:#22212e}x-coordinate-sketch .crosshair path,x-coordinate-system .crosshair path{fill:none;stroke:#3a3645;stroke-width:2px}html[theme=dark] x-coordinate-sketch .crosshair path,html[theme=dark] x-coordinate-system .crosshair path{stroke:#fff}x-coordinate-sketch .crosshair text,x-coordinate-system .crosshair text{fill:currentColor;stroke-width:6px;stroke-linejoin:round;stroke:#fff;font-size:14px;paint-order:stroke}.is-safari x-coordinate-sketch .crosshair text,.is-safari x-coordinate-system .crosshair text{stroke:none}html[theme=dark] x-coordinate-sketch .crosshair text,html[theme=dark] x-coordinate-system .crosshair text{stroke:#000}x-coordinate-sketch g.blue,x-coordinate-sketch.blue,x-coordinate-system g.blue,x-coordinate-system.blue{color:#0f82f2}x-coordinate-sketch g.green,x-coordinate-sketch.green,x-coordinate-system g.green,x-coordinate-system.green{color:#22ab24}x-coordinate-sketch g.yellow,x-coordinate-sketch.yellow,x-coordinate-system g.yellow,x-coordinate-system.yellow{color:#fd8c00}x-coordinate-sketch{cursor:crosshair}x-coordinate-sketch .plot path{stroke-width:8px;opacity:.8}x-geopad{background:#f5f5f6;border-radius:4px;color:inherit;margin:0 auto}html[theme=dark] x-geopad{background:#2d2c38;color:#b2b0b9}x-geopad svg.canvas{position:relative;touch-action:none}x-geopad>canvas,x-geopad>img{height:100%;left:0;max-width:none;position:absolute;top:0;transition:opacity .2s;width:100%}x-geopad .labels text{stroke-width:4px;stroke-linejoin:round;stroke:#f5f5f6;paint-order:stroke}.is-safari x-geopad .labels text{stroke:none}html[theme=dark] x-geopad .labels text{stroke:#2d2c38}x-geopad .labels text.white{stroke:none}.theorem x-geopad{background:transparent}.theorem x-geopad .labels text:not(.white){stroke-width:4px;stroke-linejoin:round;stroke:#f3c3d9;paint-order:stroke}.is-safari .theorem x-geopad .labels text:not(.white){stroke:none}html[theme=dark] .theorem x-geopad .labels text:not(.white){stroke:#000}.tab x-geopad{background:rgba(0,0,0,.03)}.tab x-geopad[grid],x-geopad.no-background,x-geopad[grid]{background:none}.tab x-geopad[grid] .labels text:not(.white),x-geopad.no-background .labels text:not(.white),x-geopad[grid] .labels text:not(.white){stroke-width:4px;stroke-linejoin:round;stroke:#fff;paint-order:stroke}.is-safari .tab x-geopad[grid] .labels text:not(.white),.is-safari x-geopad.no-background .labels text:not(.white),.is-safari x-geopad[grid] .labels text:not(.white){stroke:none}html[theme=dark] .tab x-geopad[grid] .labels text:not(.white),html[theme=dark] x-geopad.no-background .labels text:not(.white),html[theme=dark] x-geopad[grid] .labels text:not(.white){stroke:#22212e}x-geopad .sketch{fill:rgba(101,96,115,.6);display:none;transform-origin:bottom left}x-geopad>.icon-btn{position:absolute;right:8px;top:8px}x-geopad>x-play-toggle{left:8px;position:absolute;top:8px}x-geopad .tools{display:flex;margin:4px 0 0 4px;opacity:0;position:absolute;transition:opacity .3s;transition-delay:1s}x-geopad:hover .tools{opacity:1;transition-delay:0s}x-geopad .tool{background:#c5c2cc;border-radius:3px;box-shadow:none;cursor:pointer;display:none;height:36px;margin:4px;transition:background .2s;width:36px}x-geopad .tool x-icon{fill:#fff;margin:4px}x-geopad .tool:hover{background:#6a637e}x-geopad .tool.active{background:#3a3645}x-geopad[tools*=angleBisector] [data-tool=angleBisector],x-geopad[tools*=circle] [data-tool=circle],x-geopad[tools*=line] [data-tool=line],x-geopad[tools*=move] [data-tool=move],x-geopad[tools*=perpBisector] [data-tool=perpBisector],x-geopad[tools*=point] [data-tool=point],x-geopad[tools*=rectangle] [data-tool=rectangle]{display:block}x-geopad .paths path{fill:none;stroke:currentColor;stroke-width:3px;stroke-linecap:round;stroke-linejoin:round;transition:stroke .2s,stroke-width .2s,fill .2s,opacity .2s,color .2s}x-geopad .paths path.hover,x-geopad .paths path.selected{stroke-width:4px}x-geopad .paths path.thin{stroke-width:2px}x-geopad .paths path.thick{stroke-width:4px}x-geopad .paths path.fill{stroke-width:0;fill:currentColor}x-geopad .paths path[x^="angle("]{stroke-linecap:butt}x-geopad .points circle{fill:#f5f5f6;stroke:currentColor;stroke-width:3px;r:3.5px;transition:r .2s,stroke-width .2s,fill .2s,opacity .2s,color .2s}html[theme=dark] x-geopad .points circle{fill:#2d2c38}x-geopad .points circle.move{r:8px;stroke:transparent;stroke-width:20px;fill:currentColor;touch-action:none}html[theme=dark] x-geopad .points circle.move{fill:currentColor}x-geopad .points circle.hover,x-geopad .points circle.selected{r:6px}x-geopad .points circle.move.hover,x-geopad .points circle.move.selected{r:12px}x-geopad .points circle.pending{transition:none}.focus x-geopad .paths path.focus:not(.fill){stroke-width:5px}.focus x-geopad .points circle.focus{r:8px;stroke-width:5px}.focus x-geopad .points circle.move.focus{r:12px}x-geopad .labels text{fill:currentColor;transition:opacity .2s,color .2s}x-geopad image{transition:opacity .2s}.focus x-geopad image{opacity:.2}x-geopad .transparent,x-geopad .transparent.light{opacity:0}x-geopad .transparent.focus{opacity:1}x-geopad .light,x-geopad .transparent.focus.light{opacity:.5}x-geopad .labels text,x-geopad .paths path,x-geopad .points circle{color:#656073}html[theme=dark] x-geopad .labels text,html[theme=dark] x-geopad .paths path,html[theme=dark] x-geopad .points circle{color:#b2b0b9}x-geopad .labels text.dark,x-geopad .labels text.move,x-geopad .paths path.dark,x-geopad .paths path.move,x-geopad .points circle.dark,x-geopad .points circle.move{color:#3a3645}html[theme=dark] x-geopad .labels text.dark,html[theme=dark] x-geopad .labels text.move,html[theme=dark] x-geopad .paths path.dark,html[theme=dark] x-geopad .paths path.move,html[theme=dark] x-geopad .points circle.dark,html[theme=dark] x-geopad .points circle.move{color:#fff}html[theme=dark] x-geopad .labels text.red,html[theme=dark] x-geopad .paths path.red,html[theme=dark] x-geopad .points circle.red,x-geopad .labels text.red,x-geopad .paths path.red,x-geopad .points circle.red{color:#cd0e66}html[theme=dark] x-geopad .labels text.blue,html[theme=dark] x-geopad .paths path.blue,html[theme=dark] x-geopad .points circle.blue,x-geopad .labels text.blue,x-geopad .paths path.blue,x-geopad .points circle.blue{color:#0f82f2}html[theme=dark] x-geopad .labels text.green,html[theme=dark] x-geopad .paths path.green,html[theme=dark] x-geopad .points circle.green,x-geopad .labels text.green,x-geopad .paths path.green,x-geopad .points circle.green{color:#22ab24}html[theme=dark] x-geopad .labels text.yellow,html[theme=dark] x-geopad .paths path.yellow,html[theme=dark] x-geopad .points circle.yellow,x-geopad .labels text.yellow,x-geopad .paths path.yellow,x-geopad .points circle.yellow{color:#fd8c00}html[theme=dark] x-geopad .labels text.teal,html[theme=dark] x-geopad .paths path.teal,html[theme=dark] x-geopad .points circle.teal,x-geopad .labels text.teal,x-geopad .paths path.teal,x-geopad .points circle.teal{color:#009ea6}html[theme=dark] x-geopad .labels text.orange,html[theme=dark] x-geopad .paths path.orange,html[theme=dark] x-geopad .points circle.orange,x-geopad .labels text.orange,x-geopad .paths path.orange,x-geopad .points circle.orange{color:#eb4726}html[theme=dark] x-geopad .labels text.purple,html[theme=dark] x-geopad .paths path.purple,html[theme=dark] x-geopad .points circle.purple,x-geopad .labels text.purple,x-geopad .paths path.purple,x-geopad .points circle.purple{color:#6d3bbf}html[theme=dark] x-geopad .labels text.lime,html[theme=dark] x-geopad .paths path.lime,html[theme=dark] x-geopad .points circle.lime,x-geopad .labels text.lime,x-geopad .paths path.lime,x-geopad .points circle.lime{color:#bfc212}html[theme=dark] x-geopad .labels text.white,html[theme=dark] x-geopad .paths path.white,html[theme=dark] x-geopad .points circle.white,x-geopad .labels text.white,x-geopad .paths path.white,x-geopad .points circle.white{color:#fff}x-geopad .pulse{fill:#3a3645;animation:pulse 1.8s ease-out infinite}html[theme=dark] x-geopad .pulse{fill:#fff}x-geopad .halo{fill:rgba(58,54,69,.5)}html[theme=dark] x-geopad .halo{fill:hsla(0,0%,100%,.5)}.focus x-geopad .paths path:not(.focus),.focus x-geopad .points circle:not(.focus){color:#e7e6e9}html[theme=dark] .focus x-geopad .paths path:not(.focus),html[theme=dark] .focus x-geopad .points circle:not(.focus){color:#383644}.focus x-geopad .paths path:not(.focus).dark,.focus x-geopad .paths path:not(.focus).move,.focus x-geopad .points circle:not(.focus).dark,.focus x-geopad .points circle:not(.focus).move{color:#e2e2e4}html[theme=dark] .focus x-geopad .paths path:not(.focus).dark,html[theme=dark] .focus x-geopad .paths path:not(.focus).move,html[theme=dark] .focus x-geopad .points circle:not(.focus).dark,html[theme=dark] .focus x-geopad .points circle:not(.focus).move{color:#575660}.focus x-geopad .paths path:not(.focus).red,.focus x-geopad .points circle:not(.focus).red{color:#f1dee8}html[theme=dark] .focus x-geopad .paths path:not(.focus).red,html[theme=dark] .focus x-geopad .points circle:not(.focus).red{color:#4d2641}.focus x-geopad .paths path:not(.focus).blue,.focus x-geopad .points circle:not(.focus).blue{color:#deeaf6}html[theme=dark] .focus x-geopad .paths path:not(.focus).blue,html[theme=dark] .focus x-geopad .points circle:not(.focus).blue{color:#273d5d}.focus x-geopad .paths path:not(.focus).green,.focus x-geopad .points circle:not(.focus).green{color:#e0eee1}html[theme=dark] .focus x-geopad .paths path:not(.focus).green,html[theme=dark] .focus x-geopad .points circle:not(.focus).green{color:#2b4534}.focus x-geopad .paths path:not(.focus).yellow,.focus x-geopad .points circle:not(.focus).yellow{color:#f6ebdd}html[theme=dark] .focus x-geopad .paths path:not(.focus).yellow,html[theme=dark] .focus x-geopad .points circle:not(.focus).yellow{color:#573f2d}.focus x-geopad .paths path:not(.focus).teal,.focus x-geopad .points circle:not(.focus).teal{color:#ddecee}html[theme=dark] .focus x-geopad .paths path:not(.focus).teal,html[theme=dark] .focus x-geopad .points circle:not(.focus).teal{color:#24434e}.focus x-geopad .paths path:not(.focus).orange,.focus x-geopad .points circle:not(.focus).orange{color:#f4e4e1}html[theme=dark] .focus x-geopad .paths path:not(.focus).orange,html[theme=dark] .focus x-geopad .points circle:not(.focus).orange{color:#533134}.focus x-geopad .paths path:not(.focus).purple,.focus x-geopad .points circle:not(.focus).purple{color:#e7e2f1}html[theme=dark] .focus x-geopad .paths path:not(.focus).purple,html[theme=dark] .focus x-geopad .points circle:not(.focus).purple{color:#3a2f53}.focus x-geopad .paths path:not(.focus).lime,.focus x-geopad .points circle:not(.focus).lime{color:#f0f0df}html[theme=dark] .focus x-geopad .paths path:not(.focus).lime,html[theme=dark] .focus x-geopad .points circle:not(.focus).lime{color:#4a4a30}.focus x-geopad .paths path:not(.focus).white,.focus x-geopad .points circle:not(.focus).white{color:#f6f6f7}html[theme=dark] .focus x-geopad .paths path:not(.focus).white,html[theme=dark] .focus x-geopad .points circle:not(.focus).white{color:#575660}.focus x-geopad .pulse{display:none}.focus x-geopad .labels text:not(.focus){opacity:.2}.focus x-geopad .axes,.focus x-geopad canvas{opacity:.1}.focus x-geopad .grid{opacity:.01}x-parallax{display:block;overflow:hidden;position:relative}x-parallax .image{background-position:50%;background-size:cover;bottom:0;left:0;position:absolute;right:0;will-change:transform}x-parallax .content{height:100%;overflow:hidden;position:relative}.other-students{background:#3a3645;border-radius:6px;color:#fff;margin:1.5em 0;padding:12px 20px 2px}.other-students h4{margin:0 0 12px}.other-students img{opacity:.8}.proof{counter-reset:proof-counter;margin:0 0 2em 2em}@media screen and (max-width:660px){.proof{margin-left:0}}.proof li{list-style:none;margin:0 0 1em 3.8em;min-height:2.4em}.proof li .text-center{margin-top:.5em}.proof li:before{border:3px solid #c5c2cc;border-radius:100%;content:counter(proof-counter);counter-increment:proof-counter;display:block;float:left;font-size:1.4em;line-height:1.7em;margin:-4px 0 0 -2.7em;width:1.7em}.proof li:before,.proof-step{color:#666;font-weight:700;text-align:center}.proof-step{border:2px solid #c5c2cc;border-radius:100%;display:inline-block;line-height:1.2em;margin:-5px 0;width:1.2em} \ No newline at end of file +@charset "UTF-8";article,aside,audio,canvas,details,figcaption,figure,footer,header,main,nav,section,summary,video{display:block}audio:not([controls]){display:none;height:0}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}template{display:none}svg{display:block;overflow:hidden}li svg,p svg,td svg{display:inline-block}circle,g,image,line,path,polyline,use{transform-box:fill-box;transform-origin:center}*{-webkit-tap-highlight-color:transparent;color:inherit;cursor:inherit}body,html{margin:0;padding:0}p{hanging-punctuation:first;margin:0 0 1em}h1{font-size:40px;font-weight:400}h2{font-size:28px}h2,h3{font-weight:600}h3{font-size:20px}h1,h2,h3,h4,h5,h6{color:inherit;font-weight:700;line-height:1.1;margin:2em 0 .8em;padding:0;text-rendering:optimizelegibility}a{cursor:pointer}a,a:hover{text-decoration:none}a,button{touch-action:manipulation}button{box-sizing:content-box;-webkit-user-select:none;-moz-user-select:none;user-select:none}.small,small{font-size:80%}.b,b,strong{font-weight:700}.i,dfn,em,i{font-style:italic}sub,sup{font-size:65%;line-height:0;margin:0 .1em;position:relative;vertical-align:baseline}sup{top:-.6em}sub{bottom:-.25em}.text-center{text-align:center}.text-right{text-align:right}.break{-webkit-hyphens:auto;hyphens:auto;word-break:break-all}.nowrap{white-space:nowrap}ol,ul{margin:0 0 1em 1.5em;padding:0;text-align:left}ol ol,ol ul,ul ol,ul ul{margin:.5em 0 0 1.5em}li{margin:0 0 .5em}ol.unstyled,ul.unstyled{list-style:none;margin:0}ol.unstyled li,ul.unstyled li{margin:0}hr{background:#aaa;clear:both;display:block;height:1px;margin:1em 0;padding:0}hr,img{border:0}img{vertical-align:middle;-ms-interpolation-mode:bicubic;height:auto;max-width:100%}figure{margin:0}blockquote{margin:1.5em 0}blockquote,q{font-style:italic}q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:none}.hidden,[hidden]{display:none!important;visibility:hidden!important}table{border-collapse:collapse;border-spacing:0}table,td{border:none}td{vertical-align:top}table.fixed{table-layout:fixed}table.grid td{border-bottom:1px solid #c5c2cc;border-right:1px solid #c5c2cc}table.grid tr td:last-child{border-right:none}table.grid tr:last-child td{border-bottom:none}@media print{body,html{background:transparent;color:#000}h2,h3,p{orphans:3;widows:3}h1,h2,h3{page-break-after:avoid}p a,p a:visited{text-decoration:underline}p a[href]:after{content:" (" attr(href) ")"}blockquote,img,pre,tr{page-break-inside:avoid}img{max-width:100%!important}@page{margin:.5cm}}button,form,input,select,textarea{border:none;margin:0;padding:0}input:invalid{box-shadow:none}button,input,select,textarea{background:transparent;display:inline-block;font-family:inherit;font-size:inherit;font-weight:inherit}input[type=date],input[type=email],input[type=password],input[type=text],textarea{cursor:text}button,select{cursor:pointer}form.form-large{margin:0 auto;max-width:600px}.form-row{display:flex;flex-direction:row;flex-wrap:wrap}.form-row .form-field{flex-grow:1;width:180px}.form-large p{margin:0 8px 16px}.form-large .btn,.form-large .icon-btn,.form-large .next-step{margin:12px 8px}.form-field{display:block;padding:8px;position:relative}.form-field input,.form-field select,.form-field textarea,.form-field-style{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:no-repeat top 12px right 10px/24px 24px;background-color:#f6f6f6;border:1px solid rgba(0,0,0,.1);border-radius:4px;box-sizing:border-box;color:#000;display:block;line-height:1.4em;padding:18px 16px 4px;transition:border .2s,background .2s,box-shadow .2s;width:100%}html[theme=dark] .form-field input,html[theme=dark] .form-field select,html[theme=dark] .form-field textarea,html[theme=dark] .form-field-style{background-color:#43424d;border-color:hsla(0,0%,100%,.5);color:#fff}.form-field input:not([disabled]):focus,.form-field input:not([disabled]):hover,.form-field select:not([disabled]):focus,.form-field select:not([disabled]):hover,.form-field textarea:not([disabled]):focus,.form-field textarea:not([disabled]):hover,.form-field-style:not([disabled]):focus,.form-field-style:not([disabled]):hover{background-color:#eee}html[theme=dark] .form-field input:not([disabled]):focus,html[theme=dark] .form-field input:not([disabled]):hover,html[theme=dark] .form-field select:not([disabled]):focus,html[theme=dark] .form-field select:not([disabled]):hover,html[theme=dark] .form-field textarea:not([disabled]):focus,html[theme=dark] .form-field textarea:not([disabled]):hover,html[theme=dark] .form-field-style:not([disabled]):focus,html[theme=dark] .form-field-style:not([disabled]):hover{background-color:#64646d}.form-field input:not([disabled]):focus,.form-field select:not([disabled]):focus,.form-field textarea:not([disabled]):focus,.form-field-style:not([disabled]):focus{border-color:#0f82f2;box-shadow:0 0 0 3px rgba(15,130,242,.5);outline:none}.form-field input:not([disabled]):focus+.placeholder,.form-field select:not([disabled]):focus+.placeholder,.form-field textarea:not([disabled]):focus+.placeholder,.form-field-style:not([disabled]):focus+.placeholder{color:#0f82f2}.form-field input[disabled],.form-field select[disabled],.form-field textarea[disabled],.form-field-style[disabled]{cursor:default!important;opacity:.6}.form-field input.no-label,.form-field select.no-label,.form-field textarea.no-label,.form-field-style.no-label{background-position:top 5px right 10px;padding-top:4px}.form-field input::-moz-placeholder{opacity:0}.form-field input::placeholder{opacity:0}.form-field input:-moz-placeholder-shown{padding:11px 16px}.form-field input:placeholder-shown{padding:11px 16px}.form-field input:-moz-placeholder-shown+.placeholder{transform:none}.form-field input:placeholder-shown+.placeholder{transform:none}.form-field input.dirty:not(:focus){padding-right:36px}.form-field input.dirty:not(:focus).valid,.form-field input.dirty:not(:focus):valid{background-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%2322ab24%22%20d%3D%22m19.7%206.3-.2-.4-.3-.2c-.1-.1-.3%200-.4%200a36.6%2036.6%200%200%200%20-9.8%208.4%2036.1%2036.1%200%200%200%20-4.8-2.9h-.5l-1%20.9a.4.4%200%200%200%20-.1.3c0%20.2%200%20.3.1.4a72.1%2072.1%200%200%201%206.6%207h.4a.5.5%200%200%200%20.4-.2c3.8-6.8%205.7-9.6%209.4-13%20.2.1.2-.1.2-.3z%22%2F%3E%3C%2Fsvg%3E")}.form-field input.dirty:not(:focus).invalid,.form-field input.dirty:not(:focus):invalid{background-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Crect%20x%3D%2210%22%20y%3D%228%22%20width%3D%224%22%20height%3D%2212%22%20fill%3D%22%23fff%22%2F%3E%3Cpath%20fill%3D%22%23cd0e66%22%20d%3D%22M22.1%2C19.5l-9.2-16a1%2C1%2C0%2C0%2C0-1.8%2C0l-9.2%2C16A1%2C1%2C0%2C0%2C0%2C2.7%2C21H21.3A1%2C1%2C0%2C0%2C0%2C22.1%2C19.5Zm-8.7-11v2.4l-.4%2C4.4H11.1l-.4-4.4V8.5ZM12%2C19.4a1.6%2C1.6%2C0%2C0%2C1-1.6-1.6%2C1.6%2C1.6%2C0%2C1%2C1%2C3.2%2C0A1.6%2C1.6%2C0%2C0%2C1%2C12%2C19.4Z%22%2F%3E%3C%2Fsvg%3E");border-color:#cd0e66}.form-field textarea{height:auto;padding:10px 16px;resize:vertical}.form-field textarea::-moz-placeholder{color:#aaa;opacity:1;-moz-transition:color .2s;transition:color .2s}.form-field textarea::placeholder{color:#aaa;opacity:1;transition:color .2s}.form-field textarea:active::-moz-placeholder,.form-field textarea:focus::-moz-placeholder{color:#0f82f2}.form-field textarea:active::placeholder,.form-field textarea:focus::placeholder{color:#0f82f2}.form-field select{background-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%234d4d4d%22%20d%3D%22m19.9%207.5a1.4%201.4%200%200%200%20-2.1%200l-5.8%205.8-5.8-5.8a1.4%201.4%200%200%200%20-2.1%200%201.5%201.5%200%200%200%200%202.1l6.8%206.9a1.6%201.6%200%200%200%202.2%200l6.8-6.9a1.4%201.4%200%200%200%200-2.1z%22%2F%3E%3C%2Fsvg%3E");padding-right:40px}.form-field .form-error,.form-field .form-hint{font-size:14px;line-height:1.3;margin:4px 17px 0}.form-field .form-error{color:#cd0e66}.form-field .placeholder{color:#aaa;left:24px;line-height:1.4em;pointer-events:none;position:absolute;top:19px;transform:translateY(-7px) scale(.7);transform-origin:top left;transition:transform .2s,color .2s;-webkit-user-select:none;-moz-user-select:none;user-select:none}.form-checkbox{cursor:pointer;display:block;margin:16px 8px;min-height:28px;padding-left:40px;position:relative}.form-checkbox input{left:5px;opacity:0;position:absolute;top:7px}.form-checkbox .control{background:#f6f6f6;border:1px solid rgba(0,0,0,.1);border-radius:4px;height:22px;left:0;position:absolute;top:2px;transition:border .2s,background .2s,box-shadow .2s;width:22px}.form-checkbox .control:after{background:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2221%22%20height%3D%2221%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22m19.7%206.3-.2-.4-.3-.2c-.1-.1-.3%200-.4%200a36.6%2036.6%200%200%200%20-9.8%208.4%2036.1%2036.1%200%200%200%20-4.8-2.9h-.5l-1%20.9a.4.4%200%200%200%20-.1.3c0%20.2%200%20.3.1.4a72.1%2072.1%200%200%201%206.6%207h.4a.5.5%200%200%200%20.4-.2c3.8-6.8%205.7-9.6%209.4-13%20.2.1.2-.1.2-.3z%22%2F%3E%3C%2Fsvg%3E");content:" ";display:block;height:21px;left:1px;position:absolute;top:0;transform:scale(0);transition:transform .4s cubic-bezier(.33,1.9,.52,.7);width:21px}.form-checkbox input:focus+.control,.form-checkbox:hover .control{background:#eee;border-color:#0f82f2}.form-checkbox input:focus+.control{box-shadow:0 0 0 3px rgba(15,130,242,.5);outline:none}.form-checkbox input:checked+.control{background:#0f82f2}.form-checkbox input:checked+.control:after{transform:none}.form-checkbox input:focus:checked+.control,.form-checkbox:hover input:checked+.control{border-color:#053563}.input-field{-webkit-appearance:none;-moz-appearance:textfield;border:1px solid;border-radius:4px;color:inherit;cursor:text;display:block;line-height:1.7em;padding:0;transition:border .2s,background .2s,box-shadow .2s,color .2s}.input-field:focus{border-color:#0f82f2;box-shadow:0 0 0 3px rgba(15,130,242,.5);outline:none}.input-field::-webkit-inner-spin-button,.input-field::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.btn,.icon-btn,.next-step{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#181824;border:none;border-radius:24px;color:hsla(0,0%,100%,.95);cursor:pointer;display:inline-block;font-weight:600;height:2em;letter-spacing:.2px;line-height:2em;min-width:48px;outline:none;padding:0 1.2em;text-align:center;transition:background .2s,color .2s,box-shadow .2s;transition:transform .3s,background .2s,color .2s,box-shadow .2s,opacity .2s;width:auto}.btn.on,.btn:hover,.icon-btn:hover,.next-step:hover,.on.icon-btn,.on.next-step{box-shadow:0 4px 12px rgba(0,0,0,.25);color:#fff;z-index:10}.btn.disabled,.btn[disabled],.disabled.icon-btn,.disabled.next-step,[disabled].icon-btn,[disabled].next-step{box-shadow:none;cursor:default;pointer-events:none}.btn:hover,.icon-btn:hover,.next-step:hover{transform:scale(1.08)}.btn:active,.icon-btn:active,.next-step:active{transform:scale(.92)}.btn:active,.btn:hover,.icon-btn:active,.icon-btn:hover,.next-step:active,.next-step:hover{background-color:#504b5c}html.is-tabbing .btn:focus,html.is-tabbing .icon-btn:focus,html.is-tabbing .next-step:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #181824}.btn.disabled,.btn[disabled],.disabled.icon-btn,.disabled.next-step,[disabled].icon-btn,[disabled].next-step{background-color:#ddd!important;color:#999!important}.btn x-icon,.icon-btn x-icon,.next-step x-icon{margin:0 6px -6px 0;opacity:.95;transition:opacity .2s;fill:currentColor}.btn:active x-icon,.btn:hover x-icon,.icon-btn:active x-icon,.icon-btn:hover x-icon,.next-step:active x-icon,.next-step:hover x-icon{opacity:1}.btn-small{height:1.6em;line-height:1.6em;padding:0 .8em}.btn-large{font-size:22px;height:44px;line-height:44px;padding:0 20px}.btn-large x-icon{margin:0 10px -6px -2px}.btn-large .arrow{margin:0 -2px -1px 6px}.btn-row{margin:-10px}.btn-row .btn,.btn-row .icon-btn,.btn-row .next-step{margin:10px}.btn-red,.next-step{background-color:#cd0e66;-webkit-touch-callout:none;outline:none}.btn-red:focus,.btn-red:hover,.next-step:focus,.next-step:hover{background-color:#ef1579}html.is-tabbing .btn-red:focus,html.is-tabbing .next-step:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #ef1579}.btn-blue{background-color:#0f82f2;-webkit-touch-callout:none;outline:none}.btn-blue:focus,.btn-blue:hover{background-color:#3696f4}html.is-tabbing .btn-blue:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #3696f4}.btn-green{background-color:#22ab24;-webkit-touch-callout:none;outline:none}.btn-green:focus,.btn-green:hover{background-color:#29cd2b}html.is-tabbing .btn-green:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #29cd2b}.btn-yellow{background-color:#fd8c00;-webkit-touch-callout:none;outline:none}.btn-yellow:focus,.btn-yellow:hover{background-color:#ff9e27}html.is-tabbing .btn-yellow:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #ff9e27}.btn-grey{background-color:#656073;-webkit-touch-callout:none;outline:none}.btn-grey:focus,.btn-grey:hover{background-color:#797389}html.is-tabbing .btn-grey:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #797389}.btn-white{-webkit-touch-callout:none;outline:none}.btn-white,.btn-white:focus,.btn-white:hover{background-color:#fff}html.is-tabbing .btn-white:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #fff}.btn-white,.btn-white:active,.btn-white:hover{color:#3a3645}.btn.facebook,.facebook.icon-btn,.facebook.next-step{background-color:#1878f2;-webkit-touch-callout:none;outline:none}.btn.facebook:focus,.btn.facebook:hover,.facebook.icon-btn:focus,.facebook.icon-btn:hover,.facebook.next-step:focus,.facebook.next-step:hover{background-color:#3f8ff4}html.is-tabbing .btn.facebook:focus,html.is-tabbing .facebook.icon-btn:focus,html.is-tabbing .facebook.next-step:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #3f8ff4}.btn.twitter,.twitter.icon-btn,.twitter.next-step{background-color:#00b6f1;-webkit-touch-callout:none;outline:none}.btn.twitter:focus,.btn.twitter:hover,.twitter.icon-btn:focus,.twitter.icon-btn:hover,.twitter.next-step:focus,.twitter.next-step:hover{background-color:#1bc7ff}html.is-tabbing .btn.twitter:focus,html.is-tabbing .twitter.icon-btn:focus,html.is-tabbing .twitter.next-step:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #1bc7ff}.btn.youtube,.youtube.icon-btn,.youtube.next-step{background-color:red;-webkit-touch-callout:none;outline:none}.btn.youtube:focus,.btn.youtube:hover,.youtube.icon-btn:focus,.youtube.icon-btn:hover,.youtube.next-step:focus,.youtube.next-step:hover{background-color:#ff2929}html.is-tabbing .btn.youtube:focus,html.is-tabbing .youtube.icon-btn:focus,html.is-tabbing .youtube.next-step:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #ff2929}.btn.instagram,.instagram.icon-btn,.instagram.next-step{background-color:#bc2a8d;-webkit-touch-callout:none;outline:none}.btn.instagram:focus,.btn.instagram:hover,.instagram.icon-btn:focus,.instagram.icon-btn:hover,.instagram.next-step:focus,.instagram.next-step:hover{background-color:#d33ba2}html.is-tabbing .btn.instagram:focus,html.is-tabbing .instagram.icon-btn:focus,html.is-tabbing .instagram.next-step:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #d33ba2}.btn.pinterest,.pinterest.icon-btn,.pinterest.next-step{background-color:#cb2027;-webkit-touch-callout:none;outline:none}.btn.pinterest:focus,.btn.pinterest:hover,.pinterest.icon-btn:focus,.pinterest.icon-btn:hover,.pinterest.next-step:focus,.pinterest.next-step:hover{background-color:#df353c}html.is-tabbing .btn.pinterest:focus,html.is-tabbing .pinterest.icon-btn:focus,html.is-tabbing .pinterest.next-step:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #df353c}.btn.tumblr,.tumblr.icon-btn,.tumblr.next-step{background-color:#35465d;-webkit-touch-callout:none;outline:none}.btn.tumblr:focus,.btn.tumblr:hover,.tumblr.icon-btn:focus,.tumblr.icon-btn:hover,.tumblr.next-step:focus,.tumblr.next-step:hover{background-color:#445a77}html.is-tabbing .btn.tumblr:focus,html.is-tabbing .tumblr.icon-btn:focus,html.is-tabbing .tumblr.next-step:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #445a77}.btn.reddit,.reddit.icon-btn,.reddit.next-step{background-color:#ff5700;-webkit-touch-callout:none;outline:none}.btn.reddit:focus,.btn.reddit:hover,.reddit.icon-btn:focus,.reddit.icon-btn:hover,.reddit.next-step:focus,.reddit.next-step:hover{background-color:#ff7229}html.is-tabbing .btn.reddit:focus,html.is-tabbing .reddit.icon-btn:focus,html.is-tabbing .reddit.next-step:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #ff7229}.btn.microsoft,.microsoft.icon-btn,.microsoft.next-step{background-color:#2f2f2f;-webkit-touch-callout:none;outline:none}.btn.microsoft:focus,.btn.microsoft:hover,.microsoft.icon-btn:focus,.microsoft.icon-btn:hover,.microsoft.next-step:focus,.microsoft.next-step:hover{background-color:#434343}html.is-tabbing .btn.microsoft:focus,html.is-tabbing .microsoft.icon-btn:focus,html.is-tabbing .microsoft.next-step:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #434343}.btn.google,.google.icon-btn,.google.next-step{background:#fff;box-shadow:inset 0 0 0 1px #aaa;color:#3a3645}.btn.google:hover,.google.icon-btn:hover,.google.next-step:hover{box-shadow:inset 0 0 0 1px #aaa,0 4px 12px rgba(0,0,0,.25)}html.is-tabbing .btn.google:focus,html.is-tabbing .google.icon-btn:focus,html.is-tabbing .google.next-step:focus{box-shadow:inset 0 0 0 1px #aaa,0 0 0 2px #fff,0 0 0 4px #656073}.icon-btn{border-radius:20px;display:block;height:40px;min-width:40px;padding:0}.icon-btn x-icon{display:block;margin:8px}@font-face{font-family:Mathigon Symbol;font-style:normal;font-weight:400;src:url(/fonts/mathigon-symbol.woff2) format("woff2"),url(/fonts/mathigon-symbol.woff) format("woff")}.math,math{display:inline-block;font-style:normal;font-weight:400;margin:0 .1em}.nowrap .math,.nowrap math{margin-right:0}mfenced,mfrac,mi,mn,mo,mroot,mrow,ms,msqrt,msub,msup,mtext{display:inline-block;font-family:Mathigon Symbol,Source Sans Pro,sans-serif;font-size:inherit;line-height:1;white-space:nowrap}mi[mathvariant=normal]{font-family:Source Sans Pro,sans-serif}mi{line-height:.9}mo{margin:0 .25em}mn+.cursor+mi,mn+mi{margin-left:.1em}mi+mi{margin-left:.05em}mfrac+.coursor+mi,mfrac+.cursor+mtext,mfrac+mi,mfrac+mtext{margin-left:.15em}mo[value=−]:first-child{margin:0 .1em}mo[value="="],mo[value=≈]{margin:0 .4em}mo[value=∡],mo[value=△]{margin:0}.cursor:first-child+mo,mn+mo[value=…],mo+.cursor+mo,mo+.cursor+mo[value],mo+mo,mo+mo[value],mo:first-child,mo[lspace="0"],mo[value=°],mo[value=’]{margin-left:0}mo:last-child,mo[rspace="0"]{margin-right:0}mtext{font-family:Source Sans Pro,Helvetica,sans-serif}mspace{padding:0 .2em}mphantom{visibility:hidden}ms:after,ms:before{content:'"'}ms[lquote]:before{content:attr(lquote)}ms[rquote]:after{content:attr(rquote)}msubsup>:nth-child(3),msup>:last-child{font-size:67%;margin:-.2em .1em 0 .15em;vertical-align:top}msub>:last-child,msubsup>:nth-child(2){font-size:67%;margin:0 .1em -.2em;vertical-align:bottom}mfrac,msub>:last-child mo,msubsup>:nth-child(3) mo,msup>:last-child mo{margin:0 .1em}mfrac{font-size:.6em;vertical-align:-.2em}mfrac>*{display:block;text-align:center}mfrac>:first-child{padding-bottom:.06em}mfrac>:last-child{border-top:1px solid;float:right;padding-top:.06em;width:100%}mfrac:after{content:" ";visibility:hidden;width:0}.display mfrac,.text-center:not(.inline) mfrac,table mfrac{font-size:1em;vertical-align:-.45em}.display mfrac mfrac,.text-center:not(.inline) mfrac mfrac,mfrac mfrac{font-size:75%;vertical-align:-.25em}mroot,msqrt{border-top:1px solid;margin-left:9px;padding:.1em .1em 0 .2em;position:relative}mroot:before,msqrt:before{background:currentColor;bottom:0;content:"";left:-11px;-webkit-mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2213%22%20height%3D%2222%22%3E%3Cpath%20d%3D%22M3%2C11.72l-1.56.7-.42-1%2C2.93-1.3%2C2.55%2C7.61c.15.46.26.95.37%2C1.41h.09c.09-.46.18-.95.26-1.41L11.12%2C1h1.32L7.67%2C21.13H6.28Z%22%2F%3E%3C%2Fsvg%3E");mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2213%22%20height%3D%2222%22%3E%3Cpath%20d%3D%22M3%2C11.72l-1.56.7-.42-1%2C2.93-1.3%2C2.55%2C7.61c.15.46.26.95.37%2C1.41h.09c.09-.46.18-.95.26-1.41L11.12%2C1h1.32L7.67%2C21.13H6.28Z%22%2F%3E%3C%2Fsvg%3E");-webkit-mask-size:100% 100%;mask-size:100% 100%;position:absolute;top:-2px;width:13px}mroot>:last-child{font-size:67%;margin-top:-5px;position:absolute;right:calc(100% + 5px)}mfenced{margin:0 calc(5px + .1em);padding:.05em .1em;position:relative}mfenced:after,mfenced:before{bottom:-1px;content:"";top:-1px;width:5px}mfenced:before{left:-4px;-webkit-mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%225%22%20height%3D%2222%22%3E%3Cpath%20d%3D%22M0%2C11A18.32%2C18.32%2C0%2C0%2C1%2C2.91%2C1L4%2C1.53A18.32%2C18.32%2C0%2C0%2C0%2C1.5%2C11%2C18.33%2C18.33%2C0%2C0%2C0%2C4%2C20.47L2.91%2C21A18.32%2C18.32%2C0%2C0%2C1%2C0%2C11Z%22%2F%3E%3C%2Fsvg%3E");mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%225%22%20height%3D%2222%22%3E%3Cpath%20d%3D%22M0%2C11A18.32%2C18.32%2C0%2C0%2C1%2C2.91%2C1L4%2C1.53A18.32%2C18.32%2C0%2C0%2C0%2C1.5%2C11%2C18.33%2C18.33%2C0%2C0%2C0%2C4%2C20.47L2.91%2C21A18.32%2C18.32%2C0%2C0%2C1%2C0%2C11Z%22%2F%3E%3C%2Fsvg%3E")}mfenced:after,mfenced:before{background:currentColor;-webkit-mask-size:100% 100%;mask-size:100% 100%;position:absolute}mfenced:after{-webkit-mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%225%22%20height%3D%2222%22%3E%3Cpath%20d%3D%22M1%2C20.47A18.33%2C18.33%2C0%2C0%2C0%2C3.5%2C11%2C18.32%2C18.32%2C0%2C0%2C0%2C1%2C1.53L2.09%2C1A18.32%2C18.32%2C0%2C0%2C1%2C5%2C11%2C18.32%2C18.32%2C0%2C0%2C1%2C2.09%2C21Z%22%2F%3E%3C%2Fsvg%3E");mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%225%22%20height%3D%2222%22%3E%3Cpath%20d%3D%22M1%2C20.47A18.33%2C18.33%2C0%2C0%2C0%2C3.5%2C11%2C18.32%2C18.32%2C0%2C0%2C0%2C1%2C1.53L2.09%2C1A18.32%2C18.32%2C0%2C0%2C1%2C5%2C11%2C18.32%2C18.32%2C0%2C0%2C1%2C2.09%2C21Z%22%2F%3E%3C%2Fsvg%3E");right:-4px}mfenced[open="|"]{border-left:1px solid;border-right:1px solid;margin:0 .1em;padding:0 .1em}mfenced[open="|"]:after,mfenced[open="|"]:before{content:none}mfenced[open="["]:before{content:"["}mfenced[close="]"]:after{content:"]"}mfenced[open="{"]:before{content:"{"}mfenced[close="}"]:after{content:"}"}mover,munder{position:relative}mover>:nth-child(2){font-size:0;height:5px;left:0;position:absolute;right:0}mover>[value=‾]:nth-child(2){-webkit-mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2221%22%20height%3D%225%22%3E%3Cpath%20d%3D%22M0%2C2L21%2C2L21%2C3L0%2C3Z%22%2F%3E%3C%2Fsvg%3E");mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2221%22%20height%3D%225%22%3E%3Cpath%20d%3D%22M0%2C2L21%2C2L21%2C3L0%2C3Z%22%2F%3E%3C%2Fsvg%3E");top:0}mover>[value=‾]:nth-child(2),mover>[value=→]:nth-child(2){background:currentColor;-webkit-mask-size:100% 100%;mask-size:100% 100%;position:absolute}mover>[value=→]:nth-child(2){-webkit-mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2221%22%20height%3D%225%22%3E%3Cpath%20d%3D%22M21%2C2.5L15.7%2C0.3L16.5%2C2L0%2C2L0%2C3L16.5%2C3L15.7%2C4.7L21%2C2.5Z%22%2F%3E%3C%2Fsvg%3E");mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2221%22%20height%3D%225%22%3E%3Cpath%20d%3D%22M21%2C2.5L15.7%2C0.3L16.5%2C2L0%2C2L0%2C3L16.5%2C3L15.7%2C4.7L21%2C2.5Z%22%2F%3E%3C%2Fsvg%3E");top:-2px}mover>[value=↔]:nth-child(2){-webkit-mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2221%22%20height%3D%225%22%3E%3Cpath%20d%3D%22M21%2C2.5L15.7%2C0.3L16.5%2C2L4.5%2C2L5.3%2C0.3L0%2C2.5L5.3%2C4.7L4.5%2C3L16.5%2C3L15.7%2C4.7L21%2C2.5Z%22%2F%3E%3C%2Fsvg%3E");mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2221%22%20height%3D%225%22%3E%3Cpath%20d%3D%22M21%2C2.5L15.7%2C0.3L16.5%2C2L4.5%2C2L5.3%2C0.3L0%2C2.5L5.3%2C4.7L4.5%2C3L16.5%2C3L15.7%2C4.7L21%2C2.5Z%22%2F%3E%3C%2Fsvg%3E")}mover>[value=↔]:nth-child(2),mover>[value=⌒]:nth-child(2){background:currentColor;-webkit-mask-size:100% 100%;mask-size:100% 100%;position:absolute;top:-2px}mover>[value=⌒]:nth-child(2){-webkit-mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2221%22%20height%3D%225%22%3E%3Cpath%20d%3D%22M20.5%2C4.5a.52.52%2C0%2C0%2C1-.29-.09A17.1%2C17.1%2C0%2C0%2C0%2C10.5%2C1.5%2C17.1%2C17.1%2C0%2C0%2C0%2C.79%2C4.41a.5.5%2C0%2C0%2C1-.7-.13.5.5%2C0%2C0%2C1%2C.12-.69A18.22%2C18.22%2C0%2C0%2C1%2C10.5.5%2C18.22%2C18.22%2C0%2C0%2C1%2C20.79%2C3.59a.5.5%2C0%2C0%2C1%2C.12.69A.5.5%2C0%2C0%2C1%2C20.5%2C4.5Z%22%2F%3E%3C%2Fsvg%3E");mask-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2221%22%20height%3D%225%22%3E%3Cpath%20d%3D%22M20.5%2C4.5a.52.52%2C0%2C0%2C1-.29-.09A17.1%2C17.1%2C0%2C0%2C0%2C10.5%2C1.5%2C17.1%2C17.1%2C0%2C0%2C0%2C.79%2C4.41a.5.5%2C0%2C0%2C1-.7-.13.5.5%2C0%2C0%2C1%2C.12-.69A18.22%2C18.22%2C0%2C0%2C1%2C10.5.5%2C18.22%2C18.22%2C0%2C0%2C1%2C20.79%2C3.59a.5.5%2C0%2C0%2C1%2C.12.69A.5.5%2C0%2C0%2C1%2C20.5%2C4.5Z%22%2F%3E%3C%2Fsvg%3E")}.snackbar{left:50%;position:fixed;top:52px;transform:translateX(-50%);z-index:500}x-alert{background:#000;border-radius:6px;box-shadow:0 3px 8px rgba(0,0,0,.3);color:#fff;display:none;font-size:16px;line-height:1.4;max-width:300px;padding:8px 20px;width:-moz-max-content;width:max-content}x-alert x-icon{float:left;margin:-2px 6px 20px -4px}x-alert.error{background:#b50c5a}x-alert.warn{background:#e47e00}x-alert.success{background:#1e9620}x-icon{display:inline-block;height:24px;width:24px;fill:currentColor}x-icon svg{display:block}x-icon[name=warning]{fill:#cd0e66}.button x-icon{margin:-10px 3px -10px -8px}.modal-background{-webkit-backdrop-filter:blur(4px);background:rgba(0,0,0,.8);bottom:0;display:none;left:0;position:fixed;right:0;top:44px;transition:background .4s;z-index:400}.modal-background.light{background:hsla(0,0%,100%,.9)}html.webview .modal-background{top:0}x-modal{background:#fff;border-radius:12px;box-shadow:0 6px 32px rgba(0,0,0,.8);box-sizing:border-box;display:none;left:50%;margin-top:22px;max-height:calc(100vh - 84px);max-width:calc(100% - 40px);position:fixed;top:50%;transform:translate(-50%,-50%);width:520px;z-index:401}html[theme=dark] x-modal{background:#2d2c38}x-modal.light{box-shadow:0 4px 20px rgba(0,0,0,.25)}html.webview x-modal{margin-top:0;max-height:calc(100% - 40px)}x-modal .modal-body{box-sizing:border-box;height:100%;max-height:calc(100vh - 84px);overflow:auto;padding:24px;-webkit-overflow-scrolling:touch;overscroll-behavior:contain}@media screen and (max-height:720px){x-modal.interactive{top:42px;transform:translate(-50%)}}.is-safari:not(.is-webview) x-modal,.is-safari:not(.is-webview) x-modal .modal-body{max-height:calc(100vh - 200px)}x-modal h2{margin-top:0}x-modal h2 x-icon{margin:-6px 4px -6px -2px}x-modal h3{margin:1.5em 0 .8em}x-modal h3 x-icon{margin:0 5px -5px 0}x-modal .btn-row{margin:0;text-align:right}x-modal .form-large{margin:0 -8px -10px}x-modal p:last-child:not(.btn-row),x-modal ul:last-child{margin-bottom:0}x-modal .form-checkbox{margin:16px 0}x-modal hr{margin:1.5em 0}x-modal .close{fill:rgba(0,0,0,.4);cursor:pointer;display:block;padding:8px;position:absolute;right:0;top:0;transition:transform .2s,color .2s;z-index:10}html[theme=dark] x-modal .close{fill:hsla(0,0%,100%,.4)}x-modal .close:hover{color:#000;transform:scale(1.4)}html[theme=dark] x-modal .close:hover{color:#fff}x-modal.video{background:#000;border-radius:0;width:1200px}x-modal.video .video-wrap{height:0;padding-bottom:56.25%;position:relative}x-modal.video iframe,x-modal.video video{height:100%;position:absolute;width:100%}x-modal.video .close x-icon{fill:hsla(0,0%,100%,.8);top:-40px}header{background:#181824;box-shadow:0 0 12px rgba(0,0,0,.25);color:#fff;display:flex;height:44px;justify-content:space-between;position:fixed;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%;z-index:450}header #logo,header .nav-link{display:block;font-size:18px;height:44px;line-height:44px}header #logo{box-sizing:border-box;margin-right:-12px;padding:4px 4px 4px 16px}header #logo img,header #logo svg{float:left;height:36px;width:auto}header #logo span{display:inline-block;float:left;line-height:36px;margin:0 8px}header #skip-nav{background:#3a3645;border:2px solid #181824;border-radius:30px;height:32px;left:-9999px;padding:2px 18px;position:absolute;top:2px;z-index:9999}html.is-tabbing header #skip-nav:focus{left:2px}header nav{display:flex}header .nav-link{cursor:pointer;opacity:.8;padding:0 16px;transition:opacity .2s,background .2s}header .nav-link:focus,header .nav-link:hover{background:#4b4757;opacity:1}header .nav-link x-icon{margin:0 8px -6px -2px;vertical-align:baseline}header .nav-link.narrow{padding:0 12px}header .nav-link.narrow x-icon{display:block;margin:0}header .nav-link.popup-target{padding-right:18px}header .nav-item.open .nav-link{background:#4b4757;opacity:1}header .nav-user-icon{border:1px solid hsla(0,0%,100%,.5);border-radius:100%;display:block;height:28px;width:28px}header .popup-body{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background:rgba(24,24,36,.91);background-clip:content-box;border-bottom:1px solid hsla(0,0%,100%,.3);border-left:1px solid hsla(0,0%,100%,.3);border-radius:0 0 0 6px;display:none;position:absolute;right:0;top:44px}header .popup-body .nav-link{box-sizing:border-box;color:hsla(0,0%,100%,.8);padding:0 18px;position:relative;text-align:left;transition:background .2s,color .2s;white-space:nowrap;width:100%}header .popup-body .nav-link:before{background:hsla(0,0%,100%,.4);content:" ";display:block;height:1px;position:absolute;top:0;transition:background-color .2s;width:calc(100% - 36px)}header .popup-body .nav-link:first-child:before{display:none}header .popup-body .nav-link.active,header .popup-body .nav-link.on,header .popup-body .nav-link:focus,header .popup-body .nav-link:hover{background:hsla(0,0%,100%,.2);color:#fff}header .popup-body .nav-link.active+:before,header .popup-body .nav-link.active:before,header .popup-body .nav-link.on+:before,header .popup-body .nav-link.on:before,header .popup-body .nav-link:focus+:before,header .popup-body .nav-link:focus:before,header .popup-body .nav-link:hover+:before,header .popup-body .nav-link:hover:before{background:transparent}header .popup-body .nav-link.active,header .popup-body .nav-link.on{background:hsla(0,0%,100%,.32)}header .popup-body .nav-link.logout{max-width:300px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header .popup-body .nav-link:last-child{border-radius:0 0 0 6px}header .popup-body .nav-link img{float:right;margin:10px 2px 0 12px}header .popup-body .nav-link .form-checkbox{float:right;margin:8px 2px 0 12px;padding-left:24px}@media (max-width:840px){header .nav-link{padding:0 12px}header .nav-link.narrow{padding:0 10px}header .nav-link x-icon{margin-right:6px}}@media (max-width:760px){header .nav-item>.nav-link{height:36px;padding:4px 8px}header .nav-item>.nav-link x-icon{display:block;height:24px;margin:0 auto;width:24px}header .nav-text{display:block;font-size:10px;line-height:12px;text-align:center}}x-modal#language{-webkit-user-select:none;-moz-user-select:none;user-select:none;width:540px}.locale-list{-moz-column-count:3;column-count:3}@media (max-width:560px){.locale-list{-moz-column-count:2;column-count:2}}@media (max-width:420px){.locale-list{-moz-column-count:1;column-count:1}}.locale-link{border-radius:6px;display:block;margin:2px 0;padding:4px 8px;transition:background .2s;-webkit-column-break-inside:avoid;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.locale-link:hover{background:#e2e1e6}html[theme=dark] .locale-link:hover{background:hsla(0,0%,100%,.2)}.locale-link img{margin-right:8px}#search{width:480px}#search .modal-body{overflow:visible;padding:12px}#search .form-field{padding:0}#search .form-field input{border-radius:40px;font-size:24px;line-height:32px;padding:8px 16px 8px 48px}#search .form-field input::-moz-placeholder{color:inherit;opacity:.5}#search .form-field input::placeholder{color:inherit;opacity:.5}#search .form-field input:focus{box-shadow:0 0 0 3px #87c1f9}#search .form-field x-icon{left:13px;position:absolute;top:11px;fill:currentColor}#search .search-body{max-height:calc(100vh - 160px);min-height:180px;overflow:auto;padding:8px 8px 6px 48px}#search .search-body:after,#search .search-body:before{clear:both;content:" ";display:table}@media screen and (max-width:420px){#search .search-body{padding-left:8px}}#search .search-section{font-size:14px;font-weight:600;text-transform:uppercase}#search .search-result{border-radius:6px;display:block;height:48px;line-height:1.2;margin:0 -6px;padding:6px;transition:background .2s}#search .search-result:focus,#search .search-result:hover{background:#e2e1e6}html[theme=dark] #search .search-result:focus,html[theme=dark] #search .search-result:hover{background:hsla(0,0%,100%,.2)}#search .search-img{background:#000 50%;background-size:cover;border-radius:4px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.2);float:left;height:48px;margin-right:10px;width:48px}#search .search-subtitle{color:#aaa;font-size:14px;margin-top:4px}#search .search-subtitle,#search .search-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#search .search-title{font-size:20px;font-weight:600}#search .search-gloss{background:#fed199;border-radius:6px;font-size:16px;line-height:1.4;margin:6px 0;padding:8px 14px}#search .search-gloss:after,#search .search-gloss:before{clear:both;content:" ";display:table}#search .search-gloss img{border:0;float:right;margin:0 -12px 0 0;width:160px}#search .search-gloss .math,#search .search-gloss x-math{white-space:nowrap}#search .search-gloss li,#search .search-gloss p,#search .search-gloss ul{margin-bottom:.3em}#search .search-gloss li:last-child,#search .search-gloss p:last-child,#search .search-gloss ul:last-child{margin-bottom:0}#search .no-results{color:#aaa;margin-top:32px;padding-right:32px;text-align:center}@media screen and (max-width:420px){#search .no-results{padding:0}}#search .no-results x-icon{display:block;margin:0 auto;fill:#aaa}.global-footer{border-top:1px solid #ccc;color:#aaa;display:flex;font-size:15px;margin:50px 0 40px;padding-top:6px}.global-footer .footer-left{flex-grow:1}.global-footer .footer-right{text-align:right}.global-footer .footer-row{margin:4px 0}.global-footer button{cursor:pointer;line-height:inherit;margin-left:24px;position:relative}.global-footer button img{left:-24px;position:absolute;top:2px}.global-footer .dot{display:inline-block;margin:0 8px}.global-footer .footer-left a,.global-footer button{background-image:linear-gradient(transparent calc(100% - 2px),currentColor calc(100% - 2px),currentColor calc(100% - 1px),transparent calc(100% - 1px));background-repeat:no-repeat;background-size:0 100%;display:inline-block;transition:color .2s,background-size .2s ease-in-out}.global-footer .footer-left a:hover,.global-footer button:hover{background-size:100% 100%;color:#333}html[theme=dark] .global-footer .footer-left a:hover,html[theme=dark] .global-footer button:hover{color:#fff}.global-footer .footer-social{color:#aaa;display:inline-block;margin:-5px 0 -11px;padding:6px 3px;transition:color .2s}.global-footer .footer-social x-icon{display:block}.global-footer .footer-social:hover{color:#333}html[theme=dark] .global-footer .footer-social:hover{color:#fff}@media (max-width:760px){.global-footer{display:block;font-size:16px;margin-bottom:30px}.global-footer .footer-left,.global-footer .footer-right{text-align:center}.global-footer .footer-row{margin-bottom:10px}.global-footer .footer-social{padding:6px}.global-footer .footer-social svg{height:28px;margin:0 4px;width:28px}.global-footer button img{height:20px;left:-26px;top:3px;width:20px}}.course{border-top:1px solid #c5c2cc;-moz-column-count:2;column-count:2;-moz-column-gap:10px;column-gap:10px;min-height:80px;padding:18px 0 18px 90px;position:relative}@media screen and (max-width:660px){.course{-moz-column-count:1;column-count:1}}.course .course-img{background-size:cover;border-radius:6px;height:80px;left:0;position:absolute;top:18px;width:80px}.course h3{-moz-column-span:all;column-span:all;margin:0 0 8px 8px}.course h3 img{margin:-4px 0 0 8px}.course .course-banner{border-radius:20px;color:#fff;float:right;font-size:14px;font-weight:400;margin:0 0 4px 6px;padding:2px 10px}.course .course-section{border-radius:4px;-moz-column-break-inside:avoid;break-inside:avoid;font-size:16px;line-height:1.2;padding:7px 8px 7px 34px;page-break-inside:avoid}.course .course-section.locked{color:#aaa;position:relative}.course .course-section.locked .tooltip{background:#656073;left:auto;padding:1px 10px;right:0;top:7px;transform:none}.course a.course-section{display:block;outline:none;transition:background .2s}.course a.course-section:focus,.course a.course-section:hover{background:#e2e1e6}html[theme=dark] .course a.course-section:focus,html[theme=dark] .course a.course-section:hover{background:hsla(0,0%,100%,.2)}.course .course-section.locked x-icon,.course x-progress{display:inline-block;margin:0 6px -4px -26px;fill:#c5c2cc}html{background-color:#fff;cursor:default;font-family:Source Sans Pro,Helvetica,sans-serif;font-size:18px;line-height:1.6;min-width:320px;touch-action:manipulation}html[theme=dark]{background:#22212e}html:not(.ready) *{animation:none!important;transition:none!important}html:not(.is-tabbing) :focus{outline:none!important}html.grabbing,html.grabbing *{cursor:grabbing!important}body{color:#333}html[theme=dark] body{color:hsla(0,0%,100%,.9)}main{padding-top:44px}html.webview main{padding-top:0}.container{margin:0 auto;max-width:calc(100% - 48px);position:relative;width:1000px}.container.narrow{width:800px}.container.wide{width:1200px}.panel.narrow{margin:0 auto;max-width:800px}svg.mathjax{display:inline-block}svg.mathjax g,svg.mathjax path,svg.mathjax use{transform-box:initial;transform-origin:0 0}.is-mobile .only-desktop,.not-mobile .only-mobile,.not-touch .only-touch{display:none!important}@media screen and (max-width:480px){.xs-hide{display:none!important}}@media screen and (max-width:640px){.s-hide{display:none!important}}@media screen and (min-width:641px){.l-hide{display:none!important}}@media screen and (min-width:801px){.xl-hide{display:none!important}}.invert{filter:none}html[theme=dark] .invert{filter:invert(1)}.r{position:relative}.column,.row{display:flex;flex-wrap:wrap;justify-content:center}.column{flex-direction:column}.row.right{flex-direction:row-reverse}.column.padded,.row.padded{margin:-24px}.column.padded>*,.row.padded>*{margin:24px}.column.padded-thin,.row.padded-thin{margin:-12px}.column.padded-thin>*,.row.padded-thin>*{margin:12px}.column .grow,.row .grow{flex-grow:1}.column .shrink,.row .shrink{flex-shrink:1}.row>*>h2:first-child,.row>*>h3:first-child{margin-top:0}.padded-thin>*>p:last-child,.padded>*>p:last-child{margin-bottom:0}.text-medium{color:#999}button.a,label a,ol a,p a,ul a{background-image:linear-gradient(transparent calc(100% - 3px),currentColor calc(100% - 3px),currentColor calc(100% - 1px),transparent calc(100% - 1px));background-repeat:no-repeat;background-size:0 100%;color:#0f82f2;transition:color .2s,background-size .2s ease-in-out}button.a:hover,label a:hover,ol a:hover,p a:hover,ul a:hover{background-size:100% 100%}.caption{color:#888;font-size:80%;margin:0 0 .6em;text-align:left}.emoji{display:inline-block;font-size:inherit;height:20px;line-height:normal;margin:-4px 2px 0;vertical-align:middle;width:20px}img.emoji{width:auto}.tooltip{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background:#181824;border:1px solid #fff;border-radius:16px;color:#fff;font-size:14px;left:50%;line-height:18px;opacity:0;padding:2px 12px;pointer-events:none;position:absolute;top:-22px;transform:translateX(-50%);transition:opacity .1s;white-space:nowrap;z-index:9999}.is-tabbing.not-mobile :focus>.tooltip,.not-mobile :hover>.tooltip{opacity:.8}.alert{background:rgba(253,140,0,.4);border-radius:4px;margin-bottom:2em;padding:12px 44px 12px 20px;position:relative}.alert.fail{background:rgba(205,14,102,.4)}.alert.success{background:rgba(34,171,36,.4)}.alert p:last-child{margin:0}.alert .close{cursor:pointer;font-size:30px;font-weight:700;opacity:.6;padding:0 13px;position:absolute;right:0;top:0}.alert .close:hover{opacity:1}.warning{background:#181824 url(/images/tiles.png);background-size:240px 240px;bottom:0;display:block;left:0;position:fixed;right:0;top:0;z-index:900}.warning-body{left:50%;max-width:calc(100% - 48px);position:absolute;top:50%;transform:translate(-50%,-50%)}.warning-body svg{height:100px;margin:0 auto 20px;width:100px}.warning-body p{background:#cd0e66;border-radius:4px;color:#fff;padding:8px 16px;text-align:center}.warning-body a:hover{color:#3f9bf5}.cookie-warning{background:#b50c5a;border-radius:4px;bottom:10px;box-shadow:0 3px 6px rgba(0,0,0,.3);box-sizing:border-box;color:#fff;left:10px;line-height:1.4;max-width:calc(100vw - 20px);padding:10px 16px 12px;position:fixed;z-index:800}.cookie-warning h2{color:hsla(0,0%,100%,.8);font-size:24px;font-weight:100;margin:0 0 6px}.cookie-warning p{margin-bottom:12px}.cookie-warning .btn,.cookie-warning .icon-btn,.cookie-warning .next-step{color:#b50c5a}.cookie-warning .close{cursor:pointer;opacity:.6;padding:12px;position:absolute;right:2px;top:2px;transition:opacity .2s}.cookie-warning .close:hover{opacity:1}.cookie-warning x-icon{display:block}x-blank,x-blank-mc{display:inline-block;position:relative}x-blank-mc.done,x-blank.done{display:inline;white-space:normal}x-blank .target,x-blank-mc .target{-webkit-touch-callout:none;background:transparent;background:#0f82f2;border-radius:6px;color:#fff;cursor:pointer;display:inline-block;line-height:28px;margin:-3px 2px;padding:0 6px;position:relative;text-align:center;transition:border-radius .2s,background .2s,color .2s,margin .2s,padding .2s,width .2s,min-width .2s,box-shadow .2s}.caption x-blank .target,.caption x-blank-mc .target{height:24px;line-height:24px}x-blank .target:before,x-blank-mc .target:before{background:none;bottom:1px;content:" ";height:3px;left:5px;position:absolute;right:5px}x-blank-mc.on .target,x-blank-mc:hover .target,x-blank.on .target,x-blank:hover .target{box-shadow:0 0 10px rgba(0,0,0,.2)}mfrac x-blank .target,mfrac x-blank-mc .target{margin:0 2px}mfrac x-blank-mc.done .target,mfrac x-blank.done .target{line-height:1}x-blank-mc.invalid .target:before,x-blank.invalid .target:before{background:#cd0e66;border-radius:5px 0 0 5px;bottom:0;color:#fff;content:"×";display:block;font-weight:700;height:auto;left:0;line-height:1;padding:4px 0 3px;position:absolute;text-align:center;top:0;width:20px}x-blank-mc.done .target,x-blank.done .target{background:transparent;background-image:none;box-shadow:none;color:#0f82f2;cursor:default;display:inline;margin:0;min-width:0;padding:1px 0 0}x-blank-mc.done:hover .target,x-blank.done:hover .target{color:#0f82f2}x-blank .target{cursor:text;padding:0}x-blank.invalid .target{padding-left:20px}x-blank input{background:none!important;color:inherit;margin:0;min-width:60px;text-align:center;width:40px}x-blank input:focus{color:#fff}html.is-tabbing x-blank input:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #0f82f2;outline:none}x-blank ::-webkit-input-placeholder{color:inherit!important;opacity:1!important}x-blank :-moz-placeholder,x-blank ::-moz-placeholder{color:inherit!important;opacity:1!important}x-blank-mc .target{line-height:24px;min-width:50px;padding:2px 12px}x-blank-mc.invalid .target{padding-left:30px}html.is-tabbing x-blank-mc .target:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #0f82f2;outline:none}x-blank-mc .popup{background:#0e75da;border-radius:0 6px 6px 6px;box-shadow:0 0 20px rgba(0,0,0,.3);font-style:normal;left:2px;min-width:90px;opacity:0;pointer-events:none;position:absolute;text-align:left;top:100%;transform:scale(.5);transform-origin:left top;transition:opacity .2s,transform .2s;white-space:normal;width:-moz-max-content;width:max-content}.caption x-blank-mc .popup{top:24px}x-blank-mc.left .popup{border-radius:6px 0 6px 6px;left:auto;right:2px;transform-origin:right top}x-blank-mc.top .popup{border-radius:6px 6px 6px 0;bottom:100%;top:auto;transform-origin:left bottom}x-blank-mc.left.top .popup{border-radius:6px 6px 0 6px;transform-origin:right bottom}.caption x-blank-mc.top .popup{bottom:24px}x-blank-mc strong{color:#fff}x-blank-mc.done strong{color:#0f82f2}x-blank-mc.on,x-blank-mc:focus-within{z-index:100}x-blank-mc.on .target,x-blank-mc:focus-within .target{border-radius:5px 5px 0 0}x-blank-mc.on.top .target,x-blank-mc:focus-within.top .target{border-radius:0 0 5px 5px}x-blank-mc.on.invalid .target:before,x-blank-mc:focus-within.invalid .target:before{border-radius:5px 0 0 0}x-blank-mc.on.top.invalid .target:before,x-blank-mc:focus-within.top.invalid .target:before{border-radius:0 0 0 5px}x-blank-mc.on .popup,x-blank-mc:focus-within .popup{opacity:1;pointer-events:all;transform:none}x-blank-mc .choice{box-sizing:border-box;color:hsla(0,0%,100%,.8);cursor:pointer;display:block;font-size:16px;line-height:22px;padding:6px 16px 6px 12px;text-align:left;transition:color .2s,background .2s,box-shadow .2s;width:100%}x-blank-mc .choice:focus,x-blank-mc .choice:hover{background:hsla(0,0%,100%,.2);color:#fff}html.is-tabbing x-blank-mc .choice:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #0f82f2;outline:none}x-blank-mc .choice:first-child{border-top-right-radius:6px}x-blank-mc .choice:last-child{border-radius:0 0 6px 6px}x-blank-mc .choice:before{background:hsla(0,0%,100%,.5);content:" ";display:block;height:1px;left:12px;margin-top:-6px;position:absolute;right:16px;transition:background .2s}x-blank-mc .choice:first-child:before,x-blank-mc .choice:focus+.choice:before,x-blank-mc .choice:focus:before,x-blank-mc .choice:hover+.choice:before,x-blank-mc .choice:hover:before{background:transparent}x-free-text{display:block;margin:1.5em 0;position:relative}x-free-text .text-area{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#f5f5f6;border:1px solid #ccc;border-radius:6px;color:#333;cursor:text;height:auto;line-height:1.4em;padding:10px 16px 42px;transition:background .2s,border .2s,box-shadow .2s}x-free-text .text-area:empty:after{color:#aaa;content:"What do you notice or wonder?"}x-free-text .text-area:hover,x-free-text:focus-within .text-area{background-color:#eee;border-color:#0f82f2;z-index:2}x-free-text:focus-within .text-area{box-shadow:0 0 0 3px rgba(15,130,242,.5);outline:none}x-free-text .toolbar{background:#dddce1;border-radius:0 0 5px 5px;border-top:1px solid #adabb5;bottom:1px;display:flex;left:1px;opacity:0;pointer-events:none;position:absolute;right:1px;transition:opacity .2s}x-free-text .toolbar .space{flex-grow:1}x-free-text .text-area:focus+.toolbar,x-free-text:focus-within .toolbar{opacity:1;pointer-events:all}x-free-text .toolbar .command{border-right:1px solid #adabb5;cursor:pointer;display:block;height:20px;padding:6px;transition:background .2s,fill .2s;fill:#3a3645}x-free-text .toolbar .command:focus,x-free-text .toolbar .command:hover{background:#c5c2cc;fill:#181824}x-free-text .toolbar .command:first-child{border-bottom-left-radius:5px}x-free-text .toolbar .command x-icon{display:block;margin:0;transition:transform .2s}x-free-text .toolbar .command x-icon:hover{transform:scale(1.08)}x-free-text .toolbar .command x-icon:active{transform:scale(.92)}x-free-text .toolbar .submit{border-radius:0 0 5px 0;font-size:16px;height:33px;line-height:33px;margin-top:-1px;padding:0 12px 0 8px}x-free-text .toolbar .submit.invisible{opacity:0;pointer-events:none;transform:scale(.5)}x-free-text .toolbar .submit x-icon{margin-right:2px}x-free-text .toolbar .submit:focus,x-free-text .toolbar .submit:hover{background:#22ab24}x-gallery{display:block;position:relative}x-gallery .wrapper{cursor:ew-resize;overflow:hidden;position:relative}x-gallery .panel{transform:translateX(0)}x-gallery .panel:after,x-gallery .panel:before{clear:both;content:" ";display:table}x-gallery .panel>*{box-sizing:border-box;float:left;padding:10px}x-gallery .panel>* img,x-gallery .panel>* x-img{display:block;height:auto;margin:0 auto;width:100%}x-gallery .nav{border-top:2px solid #c5c2cc;height:34px;position:relative}x-gallery .back,x-gallery .next{border-radius:0 0 6px 6px;display:block;height:36px;min-width:0;padding:0;position:absolute;top:-2px;transform-origin:center top;width:36px}x-gallery .back.disabled,x-gallery .next.disabled{opacity:0}x-gallery .back x-icon,x-gallery .next x-icon{display:block;margin:6px}x-gallery .next{right:0}x-gallery .dots{left:50%;position:absolute;top:10px;transform:translateX(-50%)}x-gallery .dot{background:rgba(24,24,36,.2);border-radius:4px;float:left;height:8px;margin:4px;transition:opacity .2s;width:8px}x-gallery .dot.on{background:rgba(24,24,36,.8)}x-gesture{display:none;position:absolute;z-index:9999;fill:rgba(0,0,0,.5);stroke:hsla(0,0%,100%,.5);stroke-width:1px;pointer-events:none;transform-origin:15px 10px}html[theme=dark] x-gesture{fill:hsla(0,0%,100%,.5);stroke:rgba(34,33,46,.5)}x-bio,x-bio .target,x-gloss,x-gloss .target{display:inline-block;position:relative}x-bio .target,x-gloss .target{-webkit-touch-callout:none;background:transparent;border-radius:6px;cursor:pointer;line-height:28px;margin:-3px -6px;padding:0 6px;transition:background .2s,color .2s,box-shadow .2s}.caption x-bio .target,.caption x-gloss .target{height:24px;line-height:24px}x-bio .target:before,x-gloss .target:before{background:#feaf4d;bottom:1px;content:" ";height:3px;left:5px;position:absolute;right:5px}x-bio.on .target,x-gloss.on .target{background:#feaf4d;color:rgba(0,0,0,.8)}html.is-tabbing x-bio .target:focus,html.is-tabbing x-gloss .target:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #feaf4d;outline:none}x-bio .popup,x-gloss .popup{font-size:16px;font-weight:400}@media screen and (max-width:600px){x-bio .popup,x-gloss .popup{display:none}}@media screen and (min-width:601px){x-bio .popup,x-gloss .popup{background:#f08500;border-radius:0 6px 6px 6px;box-shadow:0 0 10px rgba(0,0,0,.2);font-style:normal;left:-6px;opacity:0;padding:12px 16px;pointer-events:none;position:absolute;text-align:left;top:100%;transform:scale(.5);transform-origin:left top;transition:opacity .2s,transform .2s;white-space:normal;width:300px}.caption x-bio .popup,.caption x-gloss .popup{top:24px}x-bio.left .popup,x-gloss.left .popup{border-radius:6px 0 6px 6px;left:auto;right:-6px;transform-origin:right top}x-bio.top .popup,x-gloss.top .popup{border-radius:6px 6px 6px 0;bottom:100%;top:auto;transform-origin:left bottom}x-bio.left.top .popup,x-gloss.left.top .popup{border-radius:6px 6px 0 6px;transform-origin:right bottom}.caption x-bio.top .popup,.caption x-gloss.top .popup{bottom:24px}x-bio.on,x-bio:focus-within,x-gloss.on,x-gloss:focus-within{z-index:100}x-bio.on .target,x-bio:focus-within .target,x-gloss.on .target,x-gloss:focus-within .target{border-radius:5px 5px 0 0}x-bio.on.top .target,x-bio:focus-within.top .target,x-gloss.on.top .target,x-gloss:focus-within.top .target{border-radius:0 0 5px 5px}x-bio.on.invalid .target:before,x-bio:focus-within.invalid .target:before,x-gloss.on.invalid .target:before,x-gloss:focus-within.invalid .target:before{border-radius:5px 0 0 0}x-bio.on.top.invalid .target:before,x-bio:focus-within.top.invalid .target:before,x-gloss.on.top.invalid .target:before,x-gloss:focus-within.top.invalid .target:before{border-radius:0 0 0 5px}x-bio.on .popup,x-bio:focus-within .popup,x-gloss.on .popup,x-gloss:focus-within .popup{opacity:1;pointer-events:all;transform:none}}.theorem x-bio .target:before,.theorem x-gloss .target:before{background:#fd8c00}.theorem x-bio.on .target:before,.theorem x-gloss.on .target:before{background:#feaf4d}#glossary-modal,x-bio .popup,x-gloss .popup{color:hsla(0,0%,100%,.9)}#glossary-modal li,#glossary-modal p,x-bio .popup li,x-bio .popup p,x-gloss .popup li,x-gloss .popup p{line-height:1.4;margin:0 0 .7em}#glossary-modal li,x-bio .popup li,x-gloss .popup li{margin-bottom:.3em}#glossary-modal p:last-child,x-bio .popup p:last-child,x-gloss .popup p:last-child{margin-bottom:0}#glossary-modal ol,#glossary-modal ul,x-bio .popup ol,x-bio .popup ul,x-gloss .popup ol,x-gloss .popup ul{margin-left:1.5em}#glossary-modal strong,x-bio .popup strong,x-gloss .popup strong{color:#fff}#glossary-modal a.btn,#glossary-modal a.icon-btn,#glossary-modal a.next-step,x-bio .popup a.btn,x-bio .popup a.icon-btn,x-bio .popup a.next-step,x-gloss .popup a.btn,x-gloss .popup a.icon-btn,x-gloss .popup a.next-step{background:hsla(0,0%,100%,.8);color:#fd8c00;font-weight:400;margin:0}#glossary-modal a.btn:after,#glossary-modal a.btn:before,#glossary-modal a.icon-btn:after,#glossary-modal a.icon-btn:before,#glossary-modal a.next-step:after,#glossary-modal a.next-step:before,x-bio .popup a.btn:after,x-bio .popup a.btn:before,x-bio .popup a.icon-btn:after,x-bio .popup a.icon-btn:before,x-bio .popup a.next-step:after,x-bio .popup a.next-step:before,x-gloss .popup a.btn:after,x-gloss .popup a.btn:before,x-gloss .popup a.icon-btn:after,x-gloss .popup a.icon-btn:before,x-gloss .popup a.next-step:after,x-gloss .popup a.next-step:before{display:none}#glossary-modal a.btn:focus,#glossary-modal a.btn:hover,#glossary-modal a.icon-btn:focus,#glossary-modal a.icon-btn:hover,#glossary-modal a.next-step:focus,#glossary-modal a.next-step:hover,x-bio .popup a.btn:focus,x-bio .popup a.btn:hover,x-bio .popup a.icon-btn:focus,x-bio .popup a.icon-btn:hover,x-bio .popup a.next-step:focus,x-bio .popup a.next-step:hover,x-gloss .popup a.btn:focus,x-gloss .popup a.btn:hover,x-gloss .popup a.icon-btn:focus,x-gloss .popup a.icon-btn:hover,x-gloss .popup a.next-step:focus,x-gloss .popup a.next-step:hover{background:#fff;color:#fd8c00}.bio-img{border-radius:4px;float:right;height:auto;margin:4px 0 5px 10px;width:140px}.gloss-img{display:block;filter:invert(100%)}#glossary-modal{background:#fd8c00;border-radius:8px;width:340px}#glossary-modal .modal-body{padding:12px 18px 14px}#glossary-modal p:first-child{margin-right:18px}#glossary-modal .bio-img{display:block;float:none;margin:0 auto 12px;min-height:160px}#glossary-modal .gloss-img{min-height:120px}#glossary-modal .close{fill:hsla(0,0%,100%,.8)}.lightbox-overlay{background:transparent;bottom:0;cursor:zoom-out;display:none;left:0;position:fixed;right:0;top:0;transition:background .4s;will-change:background;z-index:800}.lightbox-overlay.on{background:rgba(0,0,0,.9)}.lightbox-img{background-position:50%;background-repeat:no-repeat;background-size:contain;bottom:30px;left:30px;position:absolute;right:30px;top:30px;will-change:transition}.lightbox-img.transitions{transition:transform .4s ease-in-out}@media screen and (max-width:540px){.lightbox-img{bottom:0;left:0;right:0;top:0}}x-img{display:block;max-width:100%;position:relative}x-img.interactive{cursor:zoom-in}x-img .wrap{height:0}x-img img{border-radius:4px;display:block;max-width:100%}x-img .credit{background:rgba(0,0,0,.8);border-bottom-right-radius:4px;bottom:0;box-sizing:border-box;color:#fff;font-size:11px;line-height:1.2;max-width:90%;opacity:0;padding:4px 8px;position:absolute;right:0;transition:opacity .2s}x-img:hover .credit{opacity:.9}x-img .zoom{background:rgba(0,0,0,.7);border-top-right-radius:4px;height:36px;opacity:.5;position:absolute;right:0;top:0;transition:opacity .2s,background .2s;width:36px}x-img:hover .zoom{opacity:.9}x-img x-icon{fill:#fff;margin:6px}@media print{.lightbox-img,.lightbox-overlay,x-img .zoom{display:none!important}x-img .credit{opacity:1!important}}x-picker{display:flex;justify-content:space-between;margin:1.5em -4px}x-picker .item{border:4px solid transparent;border-radius:8px;cursor:pointer;margin:4px;position:relative;transition:border .2s,opacity .2s;width:100px}x-picker .item:hover{border-color:#eee}x-picker .item.correct{border-color:#22ab24;cursor:default}x-picker .item.incorrect{border-color:#cd0e66;cursor:default}x-picker .item:after{border:4px solid #fff;border-radius:100%;content:"";height:28px;position:absolute;right:-12px;top:-12px;transform:scale(0);transition:transform .5s cubic-bezier(.33,1.9,.52,.7);width:28px}x-picker .item.correct:after{background:#22ab24 url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22m19.7%206.3-.2-.4-.3-.2c-.1-.1-.3%200-.4%200a36.6%2036.6%200%200%200%20-9.8%208.4%2036.1%2036.1%200%200%200%20-4.8-2.9h-.5l-1%20.9a.4.4%200%200%200%20-.1.3c0%20.2%200%20.3.1.4a72.1%2072.1%200%200%201%206.6%207h.4a.5.5%200%200%200%20.4-.2c3.8-6.8%205.7-9.6%209.4-13%20.2.1.2-.1.2-.3z%22%2F%3E%3C%2Fsvg%3E") 2px 2px no-repeat;transform:scale(1)}x-picker .item.incorrect:after{background:#cd0e66 url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22M19%2C16l-4.7-4.3L18.6%2C7a1.2%2C1.2%2C0%2C0%2C0%2C0-1.5l-.4-.3a1%2C1%2C0%2C0%2C0-1.4%2C0L12%2C9.5%2C7.2%2C5.2a1%2C1%2C0%2C0%2C0-1.4%2C0l-.4.3A1.2%2C1.2%2C0%2C0%2C0%2C5.4%2C7l4.3%2C4.7L5%2C16a1.1%2C1.1%2C0%2C0%2C0-.1%2C1.4l1.5%2C1.4a.9.9%2C0%2C0%2C0%2C1.3%2C0L12%2C14.1l4.3%2C4.7a.9.9%2C0%2C0%2C0%2C1.3%2C0l1.5-1.4A1.1%2C1.1%2C0%2C0%2C0%2C19%2C16Z%22%2F%3E%3C%2Fsvg%3E") 2px 2px no-repeat;transform:scale(1)}x-picker.solved .item{border-color:transparent;cursor:default}x-picker.solved .item:after{background-color:#ccc}x-picker.solved .item[data-error]{opacity:.2}x-picker.list{display:block;margin:1em 24px}x-picker.list .item{border:none;border-radius:5px;margin:8px auto;max-width:480px;padding:4px 12px 4px 42px;transition:background .2s;width:auto}x-picker.list .item:not(.correct):not(.incorrect):hover{background:#eee}x-picker.list .item:after{left:0;top:-1px}x-picker.wrap{flex-wrap:wrap;justify-content:center}x-progress{border:2px solid;border-radius:100%;box-sizing:border-box}x-progress svg{display:block;margin:-14px;max-width:none;pointer-events:none}x-progress path.done,x-progress path.pie{transform:translate(12px,12px)}x-progress path.pie{fill:none;transition:stroke-dasharray .2s;stroke:currentColor}x-progress line{stroke:currentColor;stroke-width:2px}x-course-sidebar{background:#3a3645 linear-gradient(transparent 240px,rgba(0,0,0,.25));bottom:0;box-shadow:0 0 12px rgba(0,0,0,.25);color:#fff;display:flex;flex-direction:column;left:0;position:fixed;top:44px;width:280px;z-index:301}x-course-sidebar .sidebar-hero{background-size:cover;flex-shrink:0.5;height:220px;padding:0 20px;position:relative}x-course-sidebar .sidebar-hero-gradient{background-image:linear-gradient(transparent,rgba(0,0,0,.6) 140px);bottom:0;content:" ";left:0;position:absolute;right:0;top:40px}x-course-sidebar .sidebar-title{bottom:16px;font-size:30px;font-weight:600;line-height:1.1;position:absolute}x-course-sidebar .course-icon{background-size:cover;border:2px solid #fff;border-radius:4px;height:54px;margin-bottom:4px;width:54px}x-course-sidebar .sidebar-author{display:block;font-size:16px;margin-top:6px;opacity:.7;width:-moz-fit-content;width:fit-content}x-course-sidebar .sidebar-body{flex-grow:1;overflow:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain}x-course-sidebar .sidebar-row{color:hsla(0,0%,100%,.8);display:block;font-weight:600;line-height:20px;padding:11px 20px 11px 52px;position:relative;transition:background .2s,color .2s}x-course-sidebar .sidebar-row:before{background:hsla(0,0%,100%,.4);content:" ";display:block;height:1px;position:absolute;top:0;transition:background-color .2s;width:calc(100% - 72px)}x-course-sidebar .sidebar-row:first-child:before{display:none}x-course-sidebar .sidebar-row.active,x-course-sidebar .sidebar-row.on,x-course-sidebar .sidebar-row:focus,x-course-sidebar .sidebar-row:hover{background:hsla(0,0%,100%,.2);color:#fff}x-course-sidebar .sidebar-row.active+:before,x-course-sidebar .sidebar-row.active:before,x-course-sidebar .sidebar-row.on+:before,x-course-sidebar .sidebar-row.on:before,x-course-sidebar .sidebar-row:focus+:before,x-course-sidebar .sidebar-row:focus:before,x-course-sidebar .sidebar-row:hover+:before,x-course-sidebar .sidebar-row:hover:before{background:transparent}x-course-sidebar .sidebar-row.active,x-course-sidebar .sidebar-row.on{background:hsla(0,0%,100%,.32)}x-course-sidebar .sidebar-row x-progress{color:#fff;height:20px;left:20px;position:absolute;top:11px;width:20px}x-course-sidebar .sidebar-row .connection{background:#fff;height:calc(100% - 18px);left:29px;pointer-events:none;position:absolute;top:30px;width:2px}x-course-sidebar .sidebar-row x-icon.left{color:#fff;left:18px;position:absolute;top:9px}x-course-sidebar .sidebar-row x-icon.left+.connection{height:calc(100% - 16px);top:28px}x-course-sidebar .sidebar-row x-icon.right{color:hsla(0,0%,100%,.6);float:right;margin:-2px -2px 0 6px}x-course-sidebar .sidebar-row:last-child .connection{display:none}x-course-sidebar .sidebar-row:first-child{margin-top:16px}x-course-sidebar .sidebar-footer{display:flex;flex-shrink:0;justify-content:center}x-course-sidebar .footer-link{cursor:pointer;padding:12px 10px;position:relative}x-course-sidebar .footer-link x-icon{display:block;fill:hsla(0,0%,100%,.7);transition:fill .2s}x-course-sidebar .footer-link:focus x-icon,x-course-sidebar .footer-link:hover x-icon{fill:hsla(0,0%,100%,.9)}x-course-sidebar .sidebar-banner{border-top:1px solid hsla(0,0%,100%,.4);color:hsla(0,0%,100%,.6);flex-shrink:0;font-size:14px;margin:0 18px;padding:4px 0 6px;text-align:center}.sidebar-toggle{background:#cd0e66;border-radius:24px;bottom:8px;box-shadow:0 3px 8px rgba(0,0,0,.3);cursor:pointer;display:none;height:24px;left:8px;padding:10px;position:fixed;width:24px;z-index:300}.sidebar-toggle x-icon{fill:#fff}.sidebar-shadow{bottom:0;display:none;left:0;position:fixed;right:0;top:0;z-index:300}x-modal{-webkit-user-select:text;-moz-user-select:text;user-select:text}#feedback .error{color:#cd0e66;display:none;margin:5px 8px}#feedback button[disabled]:after{content:"ing…"}x-modal#feedback-success{text-align:center;width:320px}x-modal#share{width:400px}.share-row{display:flex;flex-wrap:wrap;justify-content:center;margin:-4px}.share-row .btn,.share-row .icon-btn,.share-row .next-step{border-radius:8px;box-shadow:none;height:36px;margin:4px;min-width:0;padding:8px;width:36px}.share-row .btn x-icon,.share-row .icon-btn x-icon,.share-row .next-step x-icon{margin:0}#glossary-search{background:#feddb3;font-size:16px;height:440px;width:600px}.gloss-sidebar{background:#fd8c00;border-radius:12px 0 0 12px;display:flex;flex-direction:column;width:200px}.gloss-sidebar h2{color:#fff;margin:20px 24px;fill:#fff}.gloss-search{position:relative}.gloss-search x-icon{left:24px;position:absolute;top:9px;fill:#fff}.gloss-search input{background:hsla(0,0%,100%,.24);box-sizing:border-box;color:#fff;padding:10px 12px 10px 54px;transition:background .2s;width:100%}.gloss-search input:focus,.gloss-search input:hover{background:hsla(0,0%,100%,.32)}.gloss-search input::-moz-placeholder{color:hsla(0,0%,100%,.7)}.gloss-search input::placeholder{color:hsla(0,0%,100%,.7)}.gloss-list{flex:1 1;overflow:auto;-webkit-overflow-scrolling:touch;border-bottom-left-radius:12px;margin-top:-1px;overscroll-behavior:contain}.gloss-item{color:hsla(0,0%,100%,.8);cursor:pointer;font-weight:600;line-height:1.3;padding:8px 12px 8px 24px;position:relative;transition:background .2s,color .2s}.gloss-item:before{background:hsla(0,0%,100%,.4);content:" ";display:block;height:1px;position:absolute;top:0;transition:background-color .2s;width:calc(100% - 36px)}.gloss-item:first-child:before{display:none}.gloss-item.active,.gloss-item.on,.gloss-item:focus,.gloss-item:hover{background:hsla(0,0%,100%,.2);color:#fff}.gloss-item.active+:before,.gloss-item.active:before,.gloss-item.on+:before,.gloss-item.on:before,.gloss-item:focus+:before,.gloss-item:focus:before,.gloss-item:hover+:before,.gloss-item:hover:before{background:transparent}.gloss-item.active,.gloss-item.on{background:hsla(0,0%,100%,.32)}.gloss-body{flex:1 1;overflow:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;padding:64px 32px 32px}@media screen and (max-width:840px){x-course-sidebar{box-shadow:none;left:-280px;transition:transform .3s,box-shadow .3s;will-change:transform}.sidebar-toggle{display:block}x-course-sidebar.open{box-shadow:10px 0 60px rgba(0,0,0,.5);transform:translateX(280px)}x-course-sidebar.open+.sidebar-shadow{display:block}}x-slider{box-sizing:border-box;display:block;margin:20px auto 2em;max-width:400px;position:relative;width:calc(100% - 24px)}x-slider .bar{background:#b0afb5;border-radius:2px;height:4px;position:relative}x-slider .play+.bar{margin-left:40px}x-slider .knob{background:#cd0e66;border-radius:12px;cursor:grab;height:20px;left:0;margin:-8px 0 0 -10px;position:absolute;touch-action:pan-y;transition:background .2s,transform .2s,box-shadow .2s;width:20px}x-slider .knob:active,x-slider .knob:hover{background:#f01e7f;box-shadow:0 3px 8px rgba(0,0,0,.25);transform:scale(1.4)}x-slider .play{color:#89868f;cursor:pointer;height:32px;left:-8px;padding:4px;position:absolute;top:-18px;transition:fill .2s,transform .2s;width:32px}x-slider .play:hover{transform:scale(1.08)}x-slider .play:active{transform:scale(.92)}x-slider .play:focus,x-slider .play:hover{color:#3a3645;transform:scale(1.2)}html[theme=dark] x-slider .play:focus,html[theme=dark] x-slider .play:hover{color:#fff}x-slider .play:active{transform:scale(.9)}x-slideshow{display:block}x-slideshow .legend-box{border:solid #ccc;border-width:2px 0}x-slideshow .legend-box>*{display:none;padding:.7em 0}x-slideshow .legend-box p:last-child,x-slideshow .legend-box>p{margin-bottom:0}x-slideshow .nav{height:0;position:relative}x-slideshow .back,x-slideshow .next{border-radius:6px 6px 0 0;bottom:-2px;display:block;height:36px;min-width:0;padding:0;position:absolute;transform-origin:center bottom;width:36px;z-index:1}x-slideshow .back.disabled,x-slideshow .next.disabled{opacity:0}x-slideshow .back x-icon,x-slideshow .next x-icon{margin:6px}[dir=rtl] x-slideshow .back x-icon,[dir=rtl] x-slideshow .next x-icon{transform:scaleX(-1)}x-slideshow .next{right:0}x-slideshow .dots{bottom:8px;left:50%;position:absolute;transform:translateX(-50%)}x-slideshow .dot{background:rgba(24,24,36,.2);border-radius:4px;float:left;height:8px;margin:4px;transition:background .2s;width:8px}html[theme=dark] x-slideshow .dot{background:hsla(0,0%,100%,.4)}x-slideshow .dot.on{background:rgba(0,0,0,.8)}html[theme=dark] x-slideshow .dot.on{background:#fff}x-sortable{display:block;margin:1.5em auto;max-width:600px;position:relative}x-sortable>*{background:#0f82f2;border-radius:4px;color:#fff;cursor:grab;left:0;padding:8px 28px 8px 20px;position:absolute;top:0;transition:opacity .1s,box-shadow .1s;width:calc(100% - 48px)}x-sortable>:active{cursor:grabbing;z-index:100}x-sortable>:after{content:"…";position:absolute;right:0;top:7px;transform:rotate(90deg)}x-sortable:active>*{opacity:.6}x-sortable>:active{box-shadow:0 0 20px rgba(0,0,0,.3);opacity:1}x-sortable.solved:active>*,x-sortable.solved>*,x-sortable.solved>:active{background:none;border:1px solid #0f82f2;box-shadow:none;color:inherit;cursor:default;opacity:1;padding:7px 27px 7px 19px}x-sortable.solved:active>:after,x-sortable.solved>:active:after,x-sortable.solved>:after{display:none}x-step{color:#666;contain:layout style;display:block;height:0;line-height:1.7;opacity:0;overflow:hidden;pointer-events:none;position:relative;transform:translateX(-160px);word-spacing:.05em;z-index:1}html[theme=dark] x-step{color:#dedee0}x-step:after,x-step:before{clear:both;content:" ";display:table}x-course.ready x-step{transition:opacity .8s linear,transform .8s cubic-bezier(.165,.84,.44,1);will-change:opacity,transform}x-step.on{height:auto;opacity:1;overflow:visible;pointer-events:auto;transform:none}x-step:hover{z-index:2}x-step:focus-within{z-index:3}.reveal{visibility:hidden}.next-step{box-sizing:border-box;left:50%;margin-left:-70px;position:absolute;top:calc(100% + 12px);width:140px}x-step.hovering{z-index:1}p.voice{margin-left:-40px;padding-left:40px}.sentence{background-image:linear-gradient(rgba(253,140,0,.3),rgba(253,140,0,.3));background-repeat:no-repeat;background-size:0 100%;-webkit-box-decoration-break:clone;box-decoration-break:clone;transition:background .6s}.sentence.playing{background-size:100% 100%;border-radius:4px;margin:0 -4px;padding:0 4px}.playback-btn{background:#c5c2cc url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2214%22%20height%3D%2214%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22m7.5%206.17v11.66a1.12%201.12%200%200%200%201.73.94l9.16-5.77a1.13%201.13%200%200%200%200-1.91l-9.16-5.86a1.12%201.12%200%200%200%20-1.73.94z%22%2F%3E%3C%2Fsvg%3E") 2px 2px no-repeat;background-clip:content-box;border:10px solid transparent;border-radius:30px;cursor:pointer;height:18px;margin:-4px 0 0 -38px;opacity:0;pointer-events:none;position:absolute;transform:scale(0);transition:opacity .2s,background .2s,transform .2s;width:18px}li.voice .playback-btn{margin-left:-56px}.playback-btn.active,.playback-btn:focus,.voice:hover>.playback-btn{opacity:1;pointer-events:all;transform:scale(1)}.voice:hover>.playback-btn:hover{transform:scale(1.3)}.playback-btn:focus,.playback-btn:hover{background-color:#656073}.playback-btn.active{background:#fd8c00 url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2214%22%20height%3D%2214%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22m8%2019a2%202%200%200%200%202-2v-10a2%202%200%200%200%20-2-2%202%202%200%200%200%20-2%202v10a2%202%200%200%200%202%202zm6-12v10a2%202%200%200%200%202%202%202%202%200%200%200%202-2v-10a2%202%200%200%200%20-2-2%202%202%200%200%200%20-2%202z%22%2F%3E%3C%2Fsvg%3E") 2px 2px no-repeat;background-clip:content-box}x-step h2,x-step h3{color:#333;font-weight:600;line-height:1.15}html[theme=dark] x-step h2,html[theme=dark] x-step h3{color:#fff}x-step h2{border-bottom:2px solid #ddd;font-size:1.6em;margin:2em 0 1em;padding-bottom:6px}x-step .row h2{border:none;padding:0}x-step:first-child h2{margin-top:0}x-step h3{font-size:1.3em;margin:1.2em 0 .8em;text-align:center}x-step .row h3{text-align:left}x-step li strong,x-step p strong,x-step table strong{color:#333;font-weight:700}html[theme=dark] x-step li strong,html[theme=dark] x-step p strong,html[theme=dark] x-step table strong{color:#fff}x-step figure+p,x-step x-geopad+p{margin-top:.5em}x-step ol,x-step ul{margin:0 0 1em;padding:0;text-align:left}x-step ul{list-style-type:disc}x-step li{margin:0 0 .5em 1.5em}x-step .caption{color:#aaa;font-size:.85em;line-height:1.5;margin:.5em 0 0;text-align:center;vertical-align:top}html[theme=dark] x-step .caption{color:hsla(0,0%,100%,.55)}x-step .quote{color:#aaa;font-style:italic;margin:1.5em 2em;text-align:center}html[theme=dark] x-step .quote{color:hsla(0,0%,100%,.55)}x-step hr{background:#ddd;height:2px;margin:2em 0}x-step hr:first-child{margin-top:1em}x-step code{background:#eee;border:1px solid #ccc;border-radius:4px;color:#333;font-family:Courier,monospace;font-size:90%;margin:-.2em .1em;padding:.2em .4em;vertical-align:1px}x-step pre{margin:1em 0}x-step pre code{display:block;padding:.3em .8em}x-step table{border:none;border-collapse:collapse;border-spacing:0;margin:.5em auto 1.5em}x-step td,x-step th{border:none;padding:.6em;text-align:center;vertical-align:middle}x-step table.text-left td,x-step table.text-left th{text-align:left}@media screen and (max-width:540px){x-step td,x-step th{padding:.25em}}x-step td[align=left]{text-align:left}x-step td[align=center]{text-align:center}x-step td[align=right]{text-align:right}x-step .table-fixed{table-layout:fixed;width:95%}x-step .table-small,x-step .table-tiny{margin:0 auto 1em}x-step .table-small td{padding:.3em .6em}x-step .table-tiny td{padding:.2em .3em}x-step table.grid td,x-step table.grid th{border-bottom:1px solid #c5c2cc;border-right:1px solid #c5c2cc}x-step table.grid td:last-child,x-step table.grid th:last-child{border-right:none}x-step table.grid tr:last-child td{border-bottom:none}x-step table h3,x-step table p{margin:0;padding:0;text-align:center!important}x-step table img{height:auto;max-width:95%}x-step table .caption{text-align:center!important}x-step table .td_caption_small{padding-top:0!important}x-step .column,x-step .row{margin:-.5em -.5em .5em}x-step .row>*,x-step article .column>*{margin:.5em;width:260px}x-step .row.padded{margin:-.5em -24px .5em}x-step .row.padded-thin{margin:-.5em -12px .5em}x-step .row>.fit{width:-moz-fit-content;width:fit-content}x-step .row>*>:first-child{margin-top:0}x-step .row>*>:last-child{margin-bottom:0}x-step .row>*>p:first-child{margin-top:-6px}x-step svg{height:auto;max-width:100%}.sticky-wrap{position:relative}.sticky{position:sticky;top:54px}.fixme{background:#fcc}html[theme=dark] .fixme{background:rgba(204,0,0,.5)}.todo{background:#eee;border:2px solid #aaa;border-radius:12px;color:#999;font-size:20px;font-style:italic;margin:2em auto;max-width:580px;padding:22px 24px;text-align:center}html[theme=dark] .todo{background:hsla(0,0%,100%,.15)}@media (min-width:720px){.shifted{margin-top:-70px!important}}figure,x-gallery,x-slideshow{margin:2em auto}figure>img,figure>svg,figure>x-img{display:block;margin:0 auto .3em}x-select.segmented{display:flex;margin:0 auto .5em;width:-moz-fit-content;width:fit-content}x-select.segmented>*{border:1px solid #cd0e66;border-left:none;cursor:pointer;text-align:center;transition:color .2s,background .2s;width:100px}x-select.segmented>:first-child{border-left:1px solid #cd0e66;border-radius:20px 0 0 20px}x-select.segmented>:last-child{border-radius:0 20px 20px 0}x-select.segmented>:hover{background:rgba(205,14,102,.18)}x-select.segmented>.active{background:#cd0e66;color:#fff;cursor:default}html.is-tabbing x-select.segmented>:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #cd0e66;outline:none;z-index:1}.box,.frame,.theorem{background:#f5f5f6;border-radius:6px;box-sizing:border-box;color:rgba(0,0,0,.7);padding:16px}html[theme=dark] .box,html[theme=dark] .frame,html[theme=dark] .theorem{background:#2d2c38;color:inherit}.box>ol:last-child,.box>p:last-child:not(.btn-row),.box>ul:last-child,.frame>ol:last-child,.frame>p:last-child:not(.btn-row),.frame>ul:last-child,.theorem>ol:last-child,.theorem>p:last-child:not(.btn-row),.theorem>ul:last-child{margin-bottom:0}.box .caption,.frame .caption,.theorem .caption{color:rgba(0,0,0,.4)}html[theme=dark] .box .caption,html[theme=dark] .frame .caption,html[theme=dark] .theorem .caption{color:hsla(0,0%,100%,.55)}.box hr,.frame hr,.theorem hr{background:rgba(0,0,0,.2)}html[theme=dark] .box hr,html[theme=dark] .frame hr,html[theme=dark] .theorem hr{background:hsla(0,0%,100%,.25)}.frame.red,.red.box,.red.theorem{background:rgba(205,14,102,.25)}html[theme=dark] .frame.red,html[theme=dark] .red.box,html[theme=dark] .red.theorem{background:rgba(205,14,102,.4)}.blue.box,.blue.theorem,.frame.blue{background:rgba(15,130,242,.25)}html[theme=dark] .blue.box,html[theme=dark] .blue.theorem,html[theme=dark] .frame.blue{background:rgba(15,130,242,.4)}.frame.green,.green.box,.green.theorem{background:rgba(34,171,36,.25)}html[theme=dark] .frame.green,html[theme=dark] .green.box,html[theme=dark] .green.theorem{background:rgba(34,171,36,.4)}.frame.yellow,.yellow.box,.yellow.theorem{background:rgba(253,140,0,.25)}html[theme=dark] .frame.yellow,html[theme=dark] .yellow.box,html[theme=dark] .yellow.theorem{background:rgba(253,140,0,.4)}.frame.orange,.orange.box,.orange.theorem{background:rgba(235,71,38,.25)}html[theme=dark] .frame.orange,html[theme=dark] .orange.box,html[theme=dark] .orange.theorem{background:rgba(235,71,38,.4)}.frame.purple,.purple.box,.purple.theorem{background:rgba(109,59,191,.25)}html[theme=dark] .frame.purple,html[theme=dark] .purple.box,html[theme=dark] .purple.theorem{background:rgba(109,59,191,.4)}.frame.teal,.teal.box,.teal.theorem{background:rgba(0,158,166,.25)}html[theme=dark] .frame.teal,html[theme=dark] .teal.box,html[theme=dark] .teal.theorem{background:rgba(0,158,166,.4)}.frame.lime,.lime.box,.lime.theorem{background:rgba(191,194,18,.25)}html[theme=dark] .frame.lime,html[theme=dark] .lime.box,html[theme=dark] .lime.theorem{background:rgba(191,194,18,.4)}.box{margin:2em 0;padding:20px;position:relative}.box.with-title{border-top-left-radius:0;margin-top:calc(2em + 37px)}.box.no-padding{padding:0}figure .box{margin:0}figure .tabs+.box{padding-top:32px}.box h3{background:#181824;border-radius:12px 12px 0 0;color:#fff;font-size:18px;height:36px;left:0;line-height:36px;margin:0;padding:0 20px;position:absolute;top:-37px}@media screen and (max-width:540px){.box{border-radius:0}.box,.box h3{padding-left:24px}.box h3{border-top-left-radius:0}}.box.red h3{background:#cd0e66}.box.blue h3{background:#0f82f2}.box.green h3{background:#22ab24}.box.yellow h3{background:#fd8c00}.box.orange h3{background:#eb4726}.box.purple h3{background:#6d3bbf}.box.teal h3{background:#009ea6}.box.lime h3{background:#bfc212}.theorem{background:rgba(205,14,102,.25);border-left:6px solid #cd0e66;border-radius:3px 6px 6px 3px;margin:1.5em 0;padding:.6em 1em}html[theme=dark] .theorem{background:rgba(205,14,102,.4)}.theorem.red{border-color:#cd0e66}.theorem.blue{border-color:#0f82f2}.theorem.green{border-color:#22ab24}.theorem.yellow{border-color:#fd8c00}.theorem.orange{border-color:#eb4726}.theorem.purple{border-color:#6d3bbf}.theorem.teal{border-color:#009ea6}.theorem.lime{border-color:#bfc212}x-step p a{-webkit-touch-callout:none;background:transparent;border-radius:6px;color:inherit;cursor:pointer;display:inline-block;line-height:28px;margin:-3px -17px -3px -6px;outline:none;padding:0 17px 0 6px;position:relative;transition:background .2s,color .2s,box-shadow .2s}.caption x-step p a{height:24px;line-height:24px}x-step p a:before{background:#57a8f6;bottom:1px;content:" ";height:3px;left:5px;position:absolute;right:5px}x-step p a:focus,x-step p a:hover{background:#57a8f6;box-shadow:0 0 10px rgba(0,0,0,.2);color:rgba(0,0,0,.8)}x-step p a:before{right:17px}x-step p a:after{background:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228%22%20height%3D%2214%22%3E%3Cpath%20fill%3D%22none%22%20stroke%3D%22rgba(0%2C0%2C0%2C0.6)%22%20stroke-width%3D%222px%22%20d%3D%22M2%202L6%207L2%2012%22%2F%3E%3C%2Fsvg%3E");content:" ";display:block;height:14px;left:auto;opacity:0;position:absolute;right:5px;top:7px;transition:opacity .1s;width:9px!important}x-step p a:focus:after,x-step p a:hover:after{opacity:1}.circled{background:#3a3645;border-radius:20px;color:#fff;display:inline-block;height:40px;line-height:40px;text-align:center;width:40px}.circled.red{background:#cd0e66}.circled.blue{background:#0f82f2}.circled.green{background:#22ab24}.circled.yellow{background:#fd8c00}.circled.orange{background:#eb4726}.circled.purple{background:#6d3bbf}.circled.teal{background:#009ea6}.circled.lime{background:#bfc212}.pill{background:rgba(101,96,115,.6);border-radius:16px;color:#fff;display:inline-block;line-height:1.5;min-width:10px;padding:0 10px;text-align:center}.pill.red{background:rgba(205,14,102,.6)}.pill.blue{background:rgba(15,130,242,.6)}.pill.green{background:rgba(34,171,36,.6)}.pill.yellow{background:rgba(253,140,0,.6)}.pill.orange{background:rgba(235,71,38,.6)}.pill.purple{background:rgba(109,59,191,.6)}.pill.teal{background:rgba(0,158,166,.6)}.pill.lime{background:rgba(191,194,18,.6)}.pill.step-target{background-color:rgba(101,96,115,.6);cursor:pointer;transition:background .2s,box-shadow .2s;-webkit-touch-callout:none;outline:none}.pill.step-target:focus,.pill.step-target:hover{background-color:#656073}html.is-tabbing .pill.step-target:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #656073}.pill.step-target.red{background-color:rgba(205,14,102,.6);-webkit-touch-callout:none;outline:none}.pill.step-target.red:focus,.pill.step-target.red:hover{background-color:#cd0e66}html.is-tabbing .pill.step-target.red:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #cd0e66}.pill.step-target.blue{background-color:rgba(15,130,242,.6);-webkit-touch-callout:none;outline:none}.pill.step-target.blue:focus,.pill.step-target.blue:hover{background-color:#0f82f2}html.is-tabbing .pill.step-target.blue:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #0f82f2}.pill.step-target.green{background-color:rgba(34,171,36,.6);-webkit-touch-callout:none;outline:none}.pill.step-target.green:focus,.pill.step-target.green:hover{background-color:#22ab24}html.is-tabbing .pill.step-target.green:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #22ab24}.pill.step-target.yellow{background-color:rgba(253,140,0,.6);-webkit-touch-callout:none;outline:none}.pill.step-target.yellow:focus,.pill.step-target.yellow:hover{background-color:#fd8c00}html.is-tabbing .pill.step-target.yellow:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #fd8c00}.pill.step-target.orange{background-color:rgba(235,71,38,.6);-webkit-touch-callout:none;outline:none}.pill.step-target.orange:focus,.pill.step-target.orange:hover{background-color:#eb4726}html.is-tabbing .pill.step-target.orange:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #eb4726}.pill.step-target.purple{background-color:rgba(109,59,191,.6);-webkit-touch-callout:none;outline:none}.pill.step-target.purple:focus,.pill.step-target.purple:hover{background-color:#6d3bbf}html.is-tabbing .pill.step-target.purple:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #6d3bbf}.pill.step-target.teal{background-color:rgba(0,158,166,.6);-webkit-touch-callout:none;outline:none}.pill.step-target.teal:focus,.pill.step-target.teal:hover{background-color:#009ea6}html.is-tabbing .pill.step-target.teal:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #009ea6}.pill.step-target.lime{background-color:rgba(191,194,18,.6);-webkit-touch-callout:none;outline:none}.pill.step-target.lime:focus,.pill.step-target.lime:hover{background-color:#bfc212}html.is-tabbing .pill.step-target.lime:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #bfc212}.var-action{background:transparent;background:#cd0e66;background-color:#cd0e66;border-radius:6px;cursor:pointer;display:inline-block;line-height:28px;margin:-3px 2px;position:relative;-webkit-touch-callout:none;color:hsla(0,0%,100%,.8);min-width:20px;outline:none;padding:0 8px;transition:color .2s,background .2s,box-shadow .2s,transform .3s}.caption .var-action{height:24px;line-height:24px}.var-action:before{background:none;bottom:1px;content:" ";height:3px;left:5px;position:absolute;right:5px}.var-action:focus,.var-action:hover{background-color:#ef1579}html.is-tabbing .var-action:focus{box-shadow:0 0 0 2px currentColor,0 0 0 4px #ef1579}.var-action:hover{transform:scale(1.08)}.var-action:active{transform:scale(.92)}.var-action:hover{box-shadow:0 0 10px rgba(0,0,0,.2);color:#fff}html.is-tabbing .var-action:focus{outline:none}.check{background:#22ab24 url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22m19.7%206.3-.2-.4-.3-.2c-.1-.1-.3%200-.4%200a36.6%2036.6%200%200%200%20-9.8%208.4%2036.1%2036.1%200%200%200%20-4.8-2.9h-.5l-1%20.9a.4.4%200%200%200%20-.1.3c0%20.2%200%20.3.1.4a72.1%2072.1%200%200%201%206.6%207h.4a.5.5%200%200%200%20.4-.2c3.8-6.8%205.7-9.6%209.4-13%20.2.1.2-.1.2-.3z%22%2F%3E%3C%2Fsvg%3E");border-radius:100%;display:inline-block;height:24px;text-align:center;vertical-align:middle;visibility:hidden;width:24px}.check.incorrect{background:#cd0e66 url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22M19%2C16l-4.7-4.3L18.6%2C7a1.2%2C1.2%2C0%2C0%2C0%2C0-1.5l-.4-.3a1%2C1%2C0%2C0%2C0-1.4%2C0L12%2C9.5%2C7.2%2C5.2a1%2C1%2C0%2C0%2C0-1.4%2C0l-.4.3A1.2%2C1.2%2C0%2C0%2C0%2C5.4%2C7l4.3%2C4.7L5%2C16a1.1%2C1.1%2C0%2C0%2C0-.1%2C1.4l1.5%2C1.4a.9.9%2C0%2C0%2C0%2C1.3%2C0L12%2C14.1l4.3%2C4.7a.9.9%2C0%2C0%2C0%2C1.3%2C0l1.5-1.4A1.1%2C1.1%2C0%2C0%2C0%2C19%2C16Z%22%2F%3E%3C%2Fsvg%3E")}.overflow-wrap{overflow:auto;-webkit-overflow-scrolling:touch;margin:0 -40px;overscroll-behavior:contain;padding:0 40px}.overflow-wrap.overflow-table{margin:1em -40px}.overflow-wrap table{margin:.5em auto}@media screen and (max-width:540px){.box,figure,x-gallery,x-slideshow{margin-left:-24px;margin-right:-24px}x-parallax.full-width{height:320px}figure .caption{padding:0 24px}.fill.box,.fill.theorem,.frame.fill,figure x-img img,figure x-video video{border-radius:0}x-slideshow .legend-box>*{padding-left:24px;padding-right:24px}x-slideshow .back{border-top-left-radius:0}x-slideshow .next{border-top-right-radius:0}x-gallery .back{border-bottom-left-radius:0}x-gallery .next{border-bottom-right-radius:0}}@media print{x-step{height:auto!important;opacity:1!important;transform:none!important}x-step .row,x-step>*{-moz-column-break-inside:avoid;break-inside:avoid}.reveal{visibility:visible!important}.caption,h2,h3,p,strong{color:#000!important}x-bio .popup,x-gloss .popup{display:none!important}}.target-body{display:none;height:100%;left:0;opacity:0;pointer-events:none;position:fixed;top:0;transform:translateZ(0);transition:opacity .3s;width:100%;will-change:opacity;z-index:900}.target-body>rect{fill:#fff}html[theme=dark] .target-body>rect{fill:#22212e}.target-body #arrow path{fill:#000}html[theme=dark] .target-body #arrow path{fill:#fff}.target-body .target-arrow{stroke:#000}html[theme=dark] .target-body .target-arrow{stroke:#fff}@keyframes spin{to{transform:rotate(1turn)}}x-tutor{display:block;font-size:16px}x-tutor .toasts{bottom:8px;max-width:264px;pointer-events:none;position:fixed;right:8px;transition:transform .4s;z-index:300}@media (max-width:400px){x-tutor .toasts{max-width:calc(100% - 80px)}}x-tutor .chat{background:#9fcdfa;border-radius:12px 0 0 0;bottom:0;box-shadow:0 0 12px rgba(0,0,0,.25);display:none;flex-direction:column;height:420px;max-height:calc(100vh - 44px);position:fixed;right:0;width:280px;z-index:301}html.webview x-tutor .chat{max-height:100vh}x-tutor .chat-header{background:#0b62b6;border-radius:12px 0 0 0;color:#fff;font-size:20px;font-weight:600;height:44px;line-height:44px;padding:0 12px}x-tutor .chat-header x-icon[name=fox]{margin:0 8px -9px 0}@media (max-height:450px){x-tutor .chat-header{border-radius:0}}x-tutor .close{cursor:pointer;padding:10px;position:absolute;right:0;top:0;transition:fill .2s,transform .2s;fill:hsla(0,0%,100%,.6)}x-tutor .close x-icon{display:block}x-tutor .close:focus,x-tutor .close:hover{fill:#fff;transform:scale(1.4)}x-tutor .chat-body{flex:1 1;overflow:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;padding:2px 8px 44px;position:relative;-webkit-user-select:text;-moz-user-select:text;user-select:text}x-tutor .chat-body.loading:after{animation:spin .7s linear infinite;border:3px solid rgba(15,130,242,.25);border-radius:14px;border-top-color:#0f82f2;content:"";display:block;float:right;height:14px;margin:8px 2px -28px 0;width:14px}x-tutor .chat-footer{background:#fff;display:flex}x-tutor .chat-footer .hint{cursor:pointer;fill:#656073;position:relative;transition:fill .2s}x-tutor .chat-footer .hint:focus,x-tutor .chat-footer .hint:hover{fill:#3a3645}x-tutor .chat-footer .hint x-icon{display:block;padding:8px}x-tutor .chat-footer .input{cursor:text;flex-grow:1;line-height:1.3;max-height:64px;overflow:auto;padding:10px 8px 10px 20px;-webkit-user-select:text;-moz-user-select:text;user-select:text;-webkit-user-modify:read-write-plaintext-only}x-tutor .chat-footer .input:empty:before{color:#aaa;content:"Type a question… (beta)"}x-tutor .msg-wrap{align-items:flex-end;display:flex;flex-direction:column}x-tutor .msg{border-radius:16px 16px 3px 16px;margin-top:6px;width:-moz-fit-content;width:fit-content}x-tutor .toasts .msg{box-shadow:0 2px 6px rgba(0,0,0,.25);cursor:pointer;pointer-events:all}x-tutor .msg.hint,x-tutor .msg.question{line-height:1.4;padding:5px 12px}x-tutor .msg.hint{background:#0f82f2;color:hsla(0,0%,100%,.9)}x-tutor .msg.question{align-self:flex-start;background:#fff;border-radius:16px 16px 16px 3px;color:#0f82f2}x-tutor .msg.archie{background:#0f82f2;border-radius:28px 28px 3px 28px;padding:10px 6px 6px 10px;transition:background .2s}x-tutor .msg.archie x-icon{display:block}x-tutor .msg.correct{background:#1e9620}x-tutor .msg.incorrect{background:#b50c5a}x-tutor .msg.img{background-color:#000;background-size:cover;height:100px;width:150px}x-tutor .msg.video{background:#000;border-radius:3px;overflow:hidden}x-tutor .msg.video iframe{border:none;display:block;height:126px;width:224px}x-tutor .msg p{margin:0}x-tutor .msg .source{color:hsla(0,0%,100%,.5);font-size:10px;margin-top:2px;text-align:right}x-tutor .msg a{transition:color .2s}x-tutor .msg a:hover{color:#fff}html.webview x-tutor .chat-footer:not(.focus){border-bottom:env(safe-area-inset-bottom) solid #d0d3da;transition:border-bottom-width .3s}html.webview x-tutor .msg.archie{border-radius:28px;padding:8px}p .var,p .var strong{color:#cd0e66}.circled .var,.circled.var,.pill .var,.pill.var{color:#fff}x-var{-webkit-touch-callout:none;background:transparent;background:#cd0e66;border-radius:6px;color:hsla(0,0%,100%,.8);cursor:pointer;display:inline-block;line-height:28px;margin:-3px 2px;padding:0 18px;position:relative;touch-action:none;transition:color .2s,box-shadow .2s}.caption x-var{height:24px;line-height:24px}x-var:before{background:none;bottom:1px;content:" ";height:3px;left:5px;position:absolute;right:5px}x-var .left,x-var .right{opacity:.6;padding:7px 1px;position:absolute;top:0;transition:opacity .2s}x-var .left svg,x-var .left x-icon,x-var .right svg,x-var .right x-icon{color:#fff;display:block}x-var .left{left:0;padding-right:4px}x-var .right{padding-left:4px;right:0}x-var .bubble{bottom:28px;left:50%;margin-left:-60px;opacity:0;padding-bottom:6px;pointer-events:none;position:absolute;transform:scale(.5);transform-origin:bottom center;transition:transform .2s,opacity .2s;width:120px;z-index:500}x-var .bubble-box{background:#cd0e66;border-radius:6px;box-shadow:0 0 15px rgba(0,0,0,.15);display:block;height:10px;position:relative}x-var .bubble-arrow{border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #cd0e66;bottom:0;display:block;height:0;left:50%;margin-left:-6px;position:absolute;width:0}x-var .progress{background:#fff;border-radius:6px;bottom:2px;display:block;left:2px;position:absolute;top:2px}x-var.on,x-var:hover{box-shadow:0 0 20px rgba(0,0,0,.3);color:#fff}x-var.on .left,x-var.on .right,x-var:hover .left,x-var:hover .right{opacity:1}x-var.on .bubble,x-var:hover .bubble{opacity:1;transform:none}.var-overlay{display:none;height:100%;left:0;position:absolute;position:fixed;top:0;width:100%;z-index:999}x-play-btn{display:block;left:50%;position:absolute;top:50%}x-play-btn .play-btn-box{background:rgba(0,0,0,.8);border-radius:6px;cursor:pointer;height:44px;margin:-24px;opacity:.9;padding:2px;transition:transform .2s,opacity .2s,background .2s;width:44px}x-play-btn .play-btn-box x-icon{fill:#fff}x-video x-play-btn .play-btn-box{border:1px solid hsla(0,0%,100%,.8);margin:-25px;pointer-events:none}x-play-btn .play-btn-box:focus,x-play-btn .play-btn-box:hover,x-video:hover x-play-btn .play-btn-box{background:rgba(0,0,0,.9);opacity:1;transform:scale(1.2)}x-video.playing x-play-btn .play-btn-box{opacity:0;transform:scale(.2)}x-play-toggle,x-video{display:block}x-video{margin:0 auto;max-width:100%;position:relative}x-video .video-wrap{cursor:pointer;height:0}x-video video{border-radius:4px;height:100%;position:absolute;width:100%;-webkit-touch-callout:none}x-video x-icon{display:block;fill:#fff}x-video .credit{background:rgba(0,0,0,.8);border-top-right-radius:4px;color:#fff;font-size:10px;opacity:0;padding:1px 8px;position:absolute;right:0;top:0;transition:opacity .2s}x-video .credit:empty{display:none}x-video:hover .credit{opacity:.8}x-video .controls{display:none;transition:opacity .2s}x-video.playing:not(:hover) .controls{opacity:0}x-video .shadow{background:linear-gradient(180deg,transparent,#000);bottom:0;height:50px;opacity:.5;position:absolute;width:100%}x-video .play-pause-btn{bottom:0;cursor:pointer;left:0;padding:6px;position:absolute;transition:transform .2s}x-video .play-pause-btn:hover{transform:scale(1.2)}x-video .pause-icon,x-video.playing .play-icon{display:none}x-video.playing .pause-icon{display:block}x-video .timeline{bottom:16px;height:12px;left:50px;position:absolute;right:60px}x-video .bar{cursor:pointer;height:4px;padding:4px 0;position:relative}x-video .bar>*{border-radius:2px;height:4px;position:absolute;top:4px}x-video .background{width:100%}x-video .background,x-video .buffer{background:hsla(0,0%,100%,.5)}x-video .handle,x-video .progress{background:#cd0e66}x-video .handle{border-radius:8px;cursor:pointer;height:14px;margin-left:-7px;position:absolute;top:-1px;transition:transform .2s,background .2s;width:14px}x-video .handle:active,x-video .handle:hover{background:#f01e7f;transform:scale(1.4)}x-video .timecode{bottom:9px;color:#fff;font-size:16px;pointer-events:none;position:absolute;right:16px}x-tabbox{display:block;margin:1.5em 0}x-tabbox .body{background:#f5f5f6;border-radius:6px;padding-top:18px}html[theme=dark] x-tabbox .body{background:#2d2c38}x-tabbox .tab{display:none;padding:1em 24px}x-tabbox .tab p:last-child{margin-bottom:0}x-tabbox.full-width .tab{padding:0;position:relative}x-tabbox.full-width .tab svg{margin:0}x-select.tabs,x-tabbox .titles{display:flex;margin:0 auto -18px;overflow:auto;-webkit-overflow-scrolling:touch;max-width:calc(100% - 12px);overscroll-behavior:contain;width:-moz-fit-content;width:fit-content}x-select.tabs{position:relative;z-index:1}x-tabbox.sticky .titles{position:sticky;top:48px;z-index:2}.webview x-tabbox.sticky .titles{top:4px}x-select.tabs>*,x-tabbox h3{background:#c5c2cc;border:1px solid #fff;color:#333;cursor:pointer;flex-shrink:0;font-size:18px;font-weight:600;height:36px;line-height:36px;margin:0;padding:0 16px;text-align:center;transition:color .2s,background .2s}html[theme=dark] x-select.tabs>*,html[theme=dark] x-tabbox h3{background:#a7a6ab;border-color:#22212e;color:#3a3645}x-select.tabs>:focus,x-select.tabs>:hover,x-tabbox h3:focus,x-tabbox h3:hover{background:#807c89;color:#fff}x-select.tabs>.active,x-tabbox h3.active{background:#3a3645;color:#fff;cursor:default}html[theme=dark] x-select.tabs>.active,html[theme=dark] x-tabbox h3.active{background:#e9e9ea}x-select.tabs>:first-child,x-tabbox h3:first-child{border-radius:20px 0 0 20px}x-select.tabs>:last-child,x-tabbox h3:last-child{border-bottom-right-radius:20px;border-top-right-radius:20px}x-select.tabs>:nth-child(n+2),x-tabbox h3:nth-child(n+2){border-left:none}x-select.tabs>* .check,x-tabbox h3 .check{border:1px solid #fff;margin:0 -6px 3px 6px}@media screen and (max-width:540px){x-tabbox{margin:1.5em -24px}x-tabbox .body{border-radius:0;padding:0}x-select.tabs,x-tabbox .titles{margin:0 0 0 -1px;max-width:100%}x-select.tabs>:first-child,x-tabbox h3:first-child{border-radius:0}x-select.tabs>:last-child,x-tabbox h3:last-child{border-radius:0 8px 0 0}}body,html{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-text-size-adjust:none;-moz-text-size-adjust:none;text-size-adjust:none;touch-action:pan-y}main{padding:44px 40px 0 320px}x-course{display:block}article{margin:0 auto;max-width:760px;-webkit-user-select:text;-moz-user-select:text;user-select:text}h1{color:#000;font-weight:600;margin:112px 0 64px}html[theme=dark] h1{color:#fff}.course-title{display:none;font-size:24px;opacity:.3}.steps{min-height:calc(100vh - 664px)}.page-background{bottom:0;left:280px;position:fixed;right:0;top:44px;z-index:-1}article.dark .page-background{background:#000}.reveal-banner{background:hsla(255,7%,76%,.95);border-radius:0 24px 24px 0;color:#fff;font-size:13px;left:280px;line-height:17px;padding:4px 18px 4px 16px;position:fixed;top:60px;transition:transform .4s,opacity .4s;z-index:100}.reveal-banner svg{display:inline-block;margin:0 0 -2px 3px}.reveal-banner path{stroke:#fff;fill:none;stroke-width:1.5px;stroke-linecap:round}.reveal-banner .complete{cursor:pointer;display:block;width:-moz-fit-content;width:fit-content}.reveal-banner .complete:hover{text-decoration:underline}.reveal-banner.off{opacity:0;transform:translateX(-100%)}.section-dev{color:#999;text-align:center}.section-dev svg{margin:0 auto 6px;width:120px;fill:#999}.section-dev h2{margin:0 0 12px}footer{display:none;height:320px;padding-top:80px;position:relative}.next-section{display:none;margin:0 auto;max-width:100%;transition:transform .2s,filter .2s;width:-moz-max-content;width:max-content}.next-section:focus,.next-section:hover{filter:drop-shadow(0 4px 12px rgba(0,0,0,.25));transform:scale(1.05)}.next-arrow{border-radius:6px;box-sizing:border-box;color:#fff;height:74px;line-height:1.4;-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22720%22%20height%3D%2274%22%3E%3Cpath%20d%3D%22M718.8%2C34.2%2C705.2%2C2.8A4.9%2C4.9%2C0%2C0%2C0%2C701%2C0H0V74H701a4.9%2C4.9%2C0%2C0%2C0%2C4.2-2.8l13.6-31.4A7.7%2C7.7%2C0%2C0%2C0%2C718.8%2C34.2Z%22%2F%3E%3C%2Fsvg%3E");mask:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22720%22%20height%3D%2274%22%3E%3Cpath%20d%3D%22M718.8%2C34.2%2C705.2%2C2.8A4.9%2C4.9%2C0%2C0%2C0%2C701%2C0H0V74H701a4.9%2C4.9%2C0%2C0%2C0%2C4.2-2.8l13.6-31.4A7.7%2C7.7%2C0%2C0%2C0%2C718.8%2C34.2Z%22%2F%3E%3C%2Fsvg%3E");-webkit-mask-position:right top;mask-position:right top;-webkit-mask-size:720px 74px;mask-size:720px 74px;max-width:100%;padding:8px 36px 0 18px;position:relative;transition:background .2s;-webkit-user-select:none;-moz-user-select:none;user-select:none}.next-arrow .small{color:hsla(0,0%,100%,.6);font-size:16px}.next-arrow .title{font-size:26px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.next-arrow .next-icon{background-position:50%;background-size:cover;border-radius:6px 0 0 6px;border-right:2px solid #fff;height:74px;left:0;position:absolute;top:0;width:74px}.next-arrow .next-icon+.small,.next-arrow .next-icon+.small+.title{padding-left:74px}.skip-step{bottom:0;box-sizing:border-box;color:#888;display:none;font-size:14px;line-height:20px;margin:0;padding:0 40px 24px;position:absolute;text-align:center;width:100%}html[theme=dark] .skip-step{color:#fff}.skip-step a{white-space:nowrap}x-course.ready .skip-step{display:block}@media (max-width:650px){.skip-step br{display:none}}.skip-step svg{display:block;margin:8px auto 0}@media screen and (max-width:840px){main{padding:44px 40px 0}.page-background{left:0}h1{margin:80px 0 54px}.course-title{display:block}.reveal-banner{left:0}}@media screen and (max-width:540px){main{padding:44px 24px 0}.overflow-wrap{margin-left:-24px;margin-right:-24px;padding:0 24px}}@media print{.page-background,footer,header,x-course-sidebar,x-tutor{display:none!important}main{margin:0!important;padding:0 20px!important}article{max-width:none!important}}html.webview main{padding:0 calc(40px + env(safe-area-inset-right)) 0 calc(40px + env(safe-area-inset-left))}html.webview .page-background{left:0;top:0}html.webview .skip-step{padding:0 40px calc(24px + env(safe-area-inset-bottom))}html.webview .steps{min-height:calc(100vh - 620px)}html.webview .reveal-banner{left:0;padding-left:calc(12px + env(safe-area-inset-left));top:16px}@media screen and (max-width:540px){html.webview main{padding:0 calc(24px + env(safe-area-inset-right)) 0 calc(24px + env(safe-area-inset-left))}html.webview .skip-step{background:#eee;margin:0 calc(-24px - env(safe-area-inset-right)) -6px calc(-24px - env(safe-area-inset-left));padding:14px 90px calc(14px + env(safe-area-inset-bottom)) 24px;text-align:left;width:auto}html[theme=dark] html.webview .skip-step{background:#444}}x-algebra-flow,x-math{position:relative}x-algebra-flow svg.equation,x-math svg.equation{width:100%;fill:currentColor;overflow:visible}x-algebra-flow svg.equation *,x-math svg.equation *{transform-origin:0 0}x-algebra-flow .overlay,x-math .overlay{left:0;position:absolute;top:0}x-algebra-flow .overlay>*,x-math .overlay>*{position:absolute;transform-origin:0 0}x-algebra-flow line,x-algebra-flow path,x-math line,x-math path{fill:none;stroke:currentColor;stroke-width:1.45;stroke-linejoin:round;stroke-linecap:round;transform-box:view-box;transform-origin:top left}x-algebra-flow text,x-math text{font-family:Mathigon Symbol,Source Sans Pro,sans-serif;dominant-baseline:text-before-edge;stroke:currentColor;fill:currentColor;stroke-width:0}x-algebra-flow text.font-normal,x-math text.font-normal{font-family:Source Sans Pro,Helvetica,sans-serif}x-math{display:inline-block;font-style:normal}x-math svg.equation{height:100%}x-algebra-flow{display:block;margin:1.5em auto;max-width:440px;position:relative}x-algebra-flow .legend-box{border-top:2px solid #ccc;font-size:16px;line-height:1.5}x-algebra-flow .legend-box p{display:none}x-algebra-flow .legend-box li{display:none;margin:0;padding:8px 48px 0;text-align:center}x-algebra-flow .nav{height:0;position:relative}x-algebra-flow .back,x-algebra-flow .next{border-radius:0 0 6px 6px;display:block;height:36px;min-width:0;padding:0;position:absolute;top:0;transition:opacity .4s,background .2s,color .2s,box-shadow .2s,transform .2s;width:36px;z-index:1}x-algebra-flow .back.hide,x-algebra-flow .next.hide{opacity:0;pointer-events:none}x-algebra-flow .back x-icon,x-algebra-flow .next x-icon{margin:6px}x-algebra-flow .back{transform-origin:left top}x-algebra-flow .next{right:0;transform-origin:right top}.m-red{color:#cd0e66}.m-blue{color:#0f82f2}.m-green{color:#22ab24}.m-yellow{color:#fd8c00}.m-orange{color:#eb4726}.m-purple{color:#6d3bbf}.m-teal{color:#009ea6}.m-lime{color:#bfc212}.lgrey{color:#aaa}.gradient-red{background:#cd0e66 linear-gradient(to bottom right,#cd0e66,#eb4726)}.gradient-orange{background:#eb4726 linear-gradient(to bottom right,#eb4726,#fd8c00)}.gradient-yellow{background:#fd8c00 linear-gradient(to bottom right,#fd8c00,#bfc212)}.gradient-lime{background:#bfc212 linear-gradient(to bottom right,#bfc212,#22ab24)}.gradient-green{background:#22ab24 linear-gradient(to bottom right,#22ab24,#009ea6)}.gradient-teal{background:#009ea6 linear-gradient(to bottom right,#009ea6,#0f82f2)}.gradient-blue{background:#0f82f2 linear-gradient(to bottom right,#0f82f2,#6d3bbf)}.gradient-purple{background:#6d3bbf linear-gradient(to bottom right,#6d3bbf,#cd0e66)}@media (min-width:601px){header .nav-small{display:none!important}}@media (max-width:600px){header .nav-large{display:none!important}header .nav-item>.nav-link{padding:4px 12px}}x-modal#login{width:500px}x-modal#login .modal-body{padding:24px 16px 12px}x-modal#login h2{text-align:center}x-modal#login .btn-row.social{display:flex;flex-wrap:wrap;justify-content:center}x-modal#login .btn-row.social .btn,x-modal#login .btn-row.social .icon-btn,x-modal#login .btn-row.social .next-step{margin:6px;width:140px}x-modal#login .hr{background:#c5c2cc;height:1px;margin:1em 8px;position:relative}x-modal#login .hr span{background:#fff;color:#aaa;display:block;font-size:14px;left:50%;line-height:1;margin-top:-7px;padding:0 12px;position:absolute;text-align:center;text-transform:uppercase;transform:translateX(-50%);white-space:nowrap}.polypad,.tangram{--canvas-bg:#fff;--canvas-fg:#181824}[theme=dark] .polypad,[theme=dark] .tangram{--canvas-bg:#22212e;--canvas-fg:#e2e1e6}x-equation{-webkit-touch-callout:none;background:transparent;background:#0f82f2;border-radius:6px;color:#fff;cursor:pointer;cursor:text;display:inline-block;height:auto;line-height:28px;margin:0;padding:4px 34px 4px 12px;position:relative;text-align:left;transition:background .2s,color .2s,padding .2s,box-shadow .2s}.caption x-equation{height:24px;line-height:24px}x-equation:before{background:none;bottom:1px;content:" ";height:3px;left:5px;position:absolute;right:5px}x-equation.small{font-size:1em;line-height:24px;padding:2px 28px 2px 8px}x-equation.active{z-index:1}x-equation.done{background:none;box-shadow:none;color:#0f82f2;cursor:default;padding:0}html.is-tabbing x-equation.active{box-shadow:0 0 0 2px currentColor,0 0 0 4px #0f82f2}x-equation .input{height:0;overflow:hidden;position:absolute;transform:scale(0);width:0}x-equation.done .input{display:none}x-equation:not(.done) mi+mi{margin-left:0}x-equation>.math{display:inline-block;min-width:80px}x-equation.small .math{min-width:25px}x-equation .math.empty{margin-right:-6px}x-equation .math.empty:after{content:"???"}x-equation.small .math.empty:after{margin-left:10px}x-equation.done .math{min-width:0}x-equation .cursor{animation:cursor 1s step-end infinite;border-right:1px solid;display:none;margin-left:-1px}x-equation.active .cursor{display:inline-block}x-equation mrow.empty{min-width:12px;text-align:center}x-equation mrow.empty:after{content:"◻︎";display:inline-block;margin:0 -.5em;opacity:.5}x-equation .keys{left:0;margin-top:6px;opacity:0;pointer-events:none;position:absolute;top:100%;transform:translateY(-12px);transition:opacity .2s,transform .2s;width:136px}x-equation .btn,x-equation .icon-btn,x-equation .next-step{border-radius:4px;float:left;height:24px;line-height:24px;margin:0 6px 6px 0;min-width:0;padding:2px;width:24px}x-equation .btn rect,x-equation .icon-btn rect,x-equation .next-step rect{fill:#fff;opacity:.45}x-equation .btn line,x-equation .icon-btn line,x-equation .next-step line{stroke:#fff}x-equation .btn path,x-equation .icon-btn path,x-equation .next-step path{fill:#fff}x-equation.active .keys{opacity:1;pointer-events:all;transform:none}x-equation .error{margin-top:-12px;pointer-events:none;position:absolute;right:6px;top:50%}x-equation .error-message{background:#cd0e66;border-radius:6px;bottom:100%;box-shadow:0 2px 4px rgba(0,0,0,.2);color:#fff;cursor:pointer;font-size:14px;left:0;line-height:1.4;margin-bottom:10px;max-width:180px;padding:6px 12px;pointer-events:none;position:absolute;transform-origin:18px bottom -6px;width:-moz-max-content;width:max-content;z-index:10}x-equation .error-message p{margin:0;text-align:left!important}x-equation .error-message:after{border:6px solid transparent;border-top-color:#cd0e66;bottom:-12px;content:" ";left:12px;position:absolute}x-equation .error,x-equation .error-message{opacity:0;transform:scale(.5);transition:opacity .2s,transform .2s}x-equation.has-error:not(.active) .error,x-equation.has-error:not(.active) .error-message{opacity:1;transform:none}x-equation.has-error:not(.active) .error-message{pointer-events:all;transition-delay:.4s}x-equation.done .error,x-equation.done .error-message{display:none}x-equation.small .error{margin-top:-10px;right:4px}x-equation.small .error svg{height:18px;width:18px}x-equation-system{display:block}article x-equation-system table td,table.eqn-system td{padding:.2em .3em;text-align:left}table.eqn-system td{vertical-align:baseline}table.eqn-system td:first-child{text-align:right}.tile{transform-box:view-box;transform-origin:0 0}.tile .handle:not(.persistent),.tile .outline{display:none}.tile.active .handle,.tile.active .link-handle,.tile.active .outline{display:block!important}.tile.no-handles.active .handle{display:none!important}x-polypad:not(.author-mode) .hidden-tile{display:none}x-polypad:not(.author-mode) .locked-tile{pointer-events:none}.geo-path.hidden-tile,.geo-point.hidden-tile,.hidden-tile>:not(.outline,.handle){opacity:.4}.link-handle{fill:#0f82f2;stroke:transparent;stroke-width:10}.link-dot{stroke:var(--canvas-bg);fill:#0f82f2;stroke-width:3}.link-bar{stroke:#0f82f2;stroke-width:5px;fill:none;cursor:move}.link-bar path.dashed{stroke-dasharray:6px 10px;stroke-dashoffset:8px}.group-outline,.rotate-bar,.tile .handle,.tile .outline{stroke-width:6px}.group-outline,.rotate-bar,.tile .outline{stroke:var(--canvas-fg);fill:none}.hidden-tile .outline,.locked-tile .outline{stroke-dasharray:10px 16px}.rotate-circle,.tile .handle{fill:var(--canvas-fg)}.tile path.handle{stroke:var(--canvas-fg)}.group-outline,.rotate-bar{pointer-events:none}.group-shadow{fill:var(--canvas-fg);opacity:15%}.rotate-circle,.tile circle.handle{stroke:transparent;stroke-width:8px}.rotate-circle{cursor:move}.balance,.number-grid-cell circle,.number-tile,.polygon-tile{stroke:var(--canvas-bg);stroke-width:1px}.high-contrast .balance,.high-contrast .number-grid-cell circle,.high-contrast .number-tile,.high-contrast .polygon-tile{stroke:var(--canvas-fg);stroke-width:2px}.prime-move,.prime-segment:hover{stroke:var(--canvas-fg);stroke-width:3px}.grid-axis,.number-line-ticks{stroke-width:3px}.active .grid-axis,.active .number-line-ticks{stroke-width:6px}.axis-gridlines{stroke-width:2px;opacity:.15;pointer-events:none}.penrose-circles{fill:none;stroke-width:2px;stroke:#fff;opacity:.4}.dice-face{stroke-width:4px}.dice-dot{fill:#fff;opacity:.85}.balance-beam{fill:none;stroke-width:8px}.active .balance,.active .balance-beam,.active .bucket{stroke:var(--canvas-fg);stroke-width:6px}.dropzone{fill:none;pointer-events:none;stroke:var(--canvas-fg);stroke-width:4px;stroke-dasharray:8px 12px;stroke-dashoffset:4px}.spinner{fill:var(--canvas-fg);stroke:var(--canvas-bg)}.spinner,pp-tiles .spinner{stroke-width:1px}.utensil .glass{fill:hsla(258,9%,78%,.7)}.utensil .ticks{pointer-events:none;stroke-width:.6;stroke:var(--canvas-fg);stroke-linecap:butt}.utensil .compass-frame,.utensil .compass-legs{fill:#c5c2cc}.utensil .compass-needle,.utensil .compass-top{fill:#656073}.utensil .compass-screw{fill:#c5c2cc}.utensil .compass-pencil{stroke:#656073}.utensil text{font-size:12px;fill:var(--canvas-fg)}.polypad.dark .utensil .glass{fill:rgba(101,96,115,.7)}.polypad.dark .utensil .compass-legs{fill:#656073}.polypad.dark .utensil .compass-needle{fill:#c5c2cc}.dot-cell{fill:none;stroke-width:20px;fill-opacity:.3}.bead-gradient{stroke:var(--canvas-bg);fill:url(#sphere-gradient);pointer-events:none}.active .bead-gradient{stroke:var(--canvas-fg);stroke-width:6px}.clock-handle{stroke:transparent;stroke-width:16px;cursor:move;transform-origin:bottom center}.axis-label{font-size:16px;font-weight:700}.axis-label,.geo-label{stroke:var(--canvas-bg);stroke-width:4px;paint-order:stroke;stroke-linejoin:round}.is-safari .axis-label,.is-safari .geo-label{stroke:none}.no-labels text{display:none}.number-line-label,.polygon-label,.polygon-text-label{font-weight:600}.number-line-label,.polygon-label{font-size:18px}.polygon-text-label{pointer-events:none}.number-line-label{transform-box:fill-box;transform-origin:center}.fraction .equation text,.number-line .equation text{font-weight:600}.fraction .equation line{stroke-width:2px}.number-grid-cell.active circle{stroke:var(--canvas-fg);stroke-width:6px}.number-grid-cell text{font-size:24px}.card-label path,.card-label rect{fill:var(--canvas-fg)}.card-label text{font-size:14px;font-weight:600;stroke:none;fill:var(--canvas-bg)}.hidden-input{display:none;height:0;overflow:hidden;position:absolute;transform:scale(0);width:0}.problem-box{stroke:#0f82f2;stroke-width:4px;fill:rgba(15,130,242,.25);transition:stroke .3s,fill .3s}.correct .problem-box{stroke:#22ab24;fill:rgba(34,171,36,.25)}.incorrect .problem-box{stroke:#cd0e66;fill:rgba(205,14,102,.25)}.active .problem-box{stroke-width:6px}.problem-text{font-size:32px;fill:var(--canvas-fg);color:var(--canvas-fg);cursor:text;text-align:center}.problem-marker{transform:scale(0);transition:transform .2s cubic-bezier(.33,1.9,.52,.7)}.problem-marker.show{transform:none}.action-card-text{cursor:text;display:none;font-size:20px;text-align:center}@keyframes cursor{0%,to{opacity:1}50%{opacity:0}}.equation{transform-origin:0 0}.equation line,.equation path{fill:none;stroke:currentColor;stroke-width:1.45;transform-box:view-box;transform-origin:top left}.equation text{font-family:Mathigon Symbol,Source Sans Pro,sans-serif;dominant-baseline:text-before-edge;stroke:currentColor;fill:currentColor;stroke-width:0}.equation text.font-normal{font-family:Source Sans Pro,Helvetica,sans-serif}.equation .placeholder{fill:currentColor;opacity:.3}.equation .cursor{stroke:#0f82f2;stroke-width:1.5px;animation:cursor 1s step-end infinite}.equation .range{fill:#87c1f9}.text-edit{font-size:20px;line-height:1.4em;padding:2px 8px;-webkit-user-modify:read-write-plaintext-only;-webkit-user-select:text;-moz-user-select:text;user-select:text;width:-moz-fit-content;width:fit-content;word-wrap:normal;pointer-events:none}.text-edit[contenteditable]{pointer-events:all}.geo-path{fill:none;stroke:currentColor;stroke-width:3px}.geo-path.fill{fill:currentColor;stroke:none;opacity:.5}.geo-path.fill.hover{opacity:.8}.geo-point{fill:currentColor}.geo-point.intersection{stroke:currentColor;stroke-width:3px;fill:var(--canvas-bg)}svg:not(:hover) .geo-point.pending{display:none!important}.geo-shadow{display:none;stroke-width:10px;stroke:currentColor;fill:none}.table-tile{background:var(--canvas-bg);border-left:1px solid var(--border);border-top:1px solid var(--border);display:grid;width:-moz-fit-content;width:fit-content}.table-tile.active{cursor:text}.table-selection{stroke:var(--canvas-fg);fill:var(--canvas-fg);fill-opacity:10%;pointer-events:none;stroke-width:5px}.table-cell{border-bottom:1px solid var(--border);border-right:1px solid var(--border);box-sizing:border-box;font-size:20px;height:50px;line-height:45px;max-width:200px;min-width:100px;padding:2px 8px;text-align:center;white-space:pre;-webkit-user-modify:read-write-plaintext-only;color:var(--canvas-fg);-webkit-user-select:text;-moz-user-select:text;user-select:text}.table-cell.header{background:var(--header);font-weight:700}.table-cell:focus{outline:none}.table-cell:focus:empty{content:"​";display:inline}.table-cell .table-color{border-radius:15px;display:inline-block;height:30px;margin-bottom:-8px;width:30px}.table-hidden{left:0;opacity:0;pointer-events:none;position:fixed;top:0}.chart-line{fill:none;stroke-width:3}.chart-outline{fill:none;stroke-width:6px;stroke:var(--canvas-fg)}.chart-shadow{stroke-width:10px;fill:none;opacity:.4}.donut-hole{fill:var(--canvas-bg)}.chart-focussed{cursor:pointer}@keyframes speaker-move{0%{transform:none}50%{transform:translateX(3px)}to{transform:none}}@keyframes metronome{0%{transform:rotate(-30deg)}50%{transform:rotate(30deg)}to{transform:rotate(-30deg)}}.effects-speaker-move{animation:speaker-move .1s}.polypad svg.overlay,x-polypad{stroke-linecap:round;stroke-linejoin:round;text-anchor:middle}x-polypad{display:block;overflow:hidden;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;text-anchor:middle;background:var(--canvas-bg)}x-polypad .canvas{height:100%;outline:none;width:100%}x-polypad .html-overlay,x-polypad .html-overlay>*{left:0;position:absolute;top:0}x-polypad .selection{stroke:#87c1f9;fill:rgba(135,193,249,.5);display:none}x-polypad .stroke{stroke-width:3px;fill:none}x-polypad .stroke.marker{stroke-width:8px}x-polypad .stroke.highlighter{stroke-width:24px;mix-blend-mode:multiply;opacity:.4}x-polypad .stroke.cut{stroke:var(--canvas-fg);stroke-dasharray:10px}.dark x-polypad .stroke.highlighter{mix-blend-mode:screen}x-polypad[data-tool=text]{cursor:text}x-polypad[data-tool=pan]{cursor:move}x-polypad[data-tool=cutPolygon],x-polypad[data-tool=geoPending],x-polypad[data-tool=geo]{cursor:crosshair}x-polypad .geo-paths,x-polypad .geo-points,x-polypad .geo-shadows,x-polypad .grid,x-polypad .selection,x-polypad .strokes,x-polypad:not([data-tool=move]) .tiles{pointer-events:none}x-polypad .grid{opacity:var(--grid-opacity,.25)}x-polypad.high-contrast .grid{opacity:1}x-polypad .geo-shadows{opacity:.3}x-polypad .grid-pattern line,x-polypad .grid-pattern rect{stroke:var(--canvas-fg);fill:none}x-polypad .grid-pattern .filled,x-polypad .grid-pattern circle{fill:var(--canvas-fg);stroke:none}x-polypad .image-drop{background:rgba(15,130,242,.1);border:6px dashed #0f82f2;box-sizing:border-box;display:none;height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%}x-polypad .tile-error{background:#fec680;border-radius:6px;bottom:calc(100% + 10px);box-shadow:0 2px 6px rgba(0,0,0,.1);color:#000;font-size:16px;left:-12px;line-height:1.4;padding:5px 10px;position:relative;position:absolute;text-align:left;top:auto;transform-origin:24px bottom -6px;width:260px}x-polypad .tile-error:after{border-left:8px solid transparent;border-right:8px solid transparent;border-top:8px solid #fec680;content:"";display:block;left:50%;left:24px;margin-left:-8px;position:absolute;top:100%}x-polypad .tile-error button{color:#0f82f2;cursor:pointer}x-polypad .tile-error button:focus,x-polypad .tile-error button:hover{text-decoration:underline}x-polypad.handdrawn .canvas{filter:url(#handdrawn)}x-polypad.handdrawn .geo-paths,x-polypad.handdrawn .strokes{filter:url(#pencil)}x-polypad .bg-icon{bottom:-60px;opacity:.1;pointer-events:none;position:absolute;right:-60px}x-polypad .rotate-label{background-color:#181824;border:1px solid;border-color:var(--canvas-bg);border-radius:6px;color:#fff;font-size:14px;font-weight:600;padding:0 7px 1px;pointer-events:none;position:absolute;top:0}.input-field{background:hsla(0,0%,100%,.1);border:1px solid hsla(0,0%,100%,.16);border-radius:5px;line-height:24px;text-align:center}.input-field:focus,.input-field:hover{background-color:hsla(0,0%,100%,.18)}select.input-field{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-image:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22rgba(255%2C%20255%2C%20255%2C%200.5)%22%20d%3D%22m19.9%207.5a1.4%201.4%200%200%200%20-2.1%200l-5.8%205.8-5.8-5.8a1.4%201.4%200%200%200%20-2.1%200%201.5%201.5%200%200%200%200%202.1l6.8%206.9a1.6%201.6%200%200%200%202.2%200l6.8-6.9a1.4%201.4%200%200%200%200-2.1z%22%2F%3E%3C%2Fsvg%3E");background-position:top 6px right 5px;background-repeat:no-repeat;background-size:16px 16px;cursor:pointer;padding:0 24px 0 8px;text-align:left;width:auto}select.input-field option{color:initial}input.toggle[type=checkbox]{-webkit-appearance:none;-moz-appearance:none;appearance:none;height:0;position:absolute;width:0}input.toggle+.control{background:hsla(0,0%,100%,.3);border-radius:12px;content:"";cursor:pointer;display:block;height:10px;padding:1px 0;transition:background .2s;width:32px}input.toggle+.control:after{background-color:#9d9ba2;border-radius:12px;content:"";display:block;height:18px;margin:-4px -1px;transition:transform .2s;width:18px}input.toggle:checked+.control{background:#0f82f2}input.toggle:checked+.control:after{background:#ebebec;transform:translateX(16px)}input.toggle:indeterminate+.control:after{background:#c4c3c7;transform:translateX(8px)}.is-tabbing input.toggle:focus+.control{outline:auto}x-factris{background:#083781;border-radius:0 0 12px 12px;color:#fff;display:block;font-family:Comfortaa,sans-serif;line-height:1.15;padding:10px;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:1}x-factris .factris-body{background:#0b4bb1;border-radius:8px;box-shadow:0 -4px 0 #06275b;height:500px;margin-top:4px;overflow:hidden;position:relative;width:340px}x-factris .factris-panel-left,x-factris .factris-panel-right,x-factris .factris-panel-top{background:#083781;position:absolute}x-factris .factris-panel-top{border-radius:12px 12px 0 0;bottom:100%;left:50%;margin-left:-90px;padding-top:10px;text-align:center;width:180px}x-factris .factris-panel-top .corner.left{bottom:-1px;left:-12px}x-factris .factris-panel-top .corner.right{bottom:-1px;right:-12px}x-factris .factris-panel-left{border-radius:12px 0 0 12px;left:-120px;padding:10px 0 10px 10px;text-align:right;top:0;width:110px}x-factris .factris-panel-left .corner{bottom:-16px;right:-1px}x-factris .factris-panel-right{border-radius:0 12px 12px 0;padding:10px 10px 10px 0;right:-100px;text-align:center;top:0;width:90px}x-factris .factris-panel-right .corner{bottom:-16px;left:-1px}x-factris,x-factris .factris-panel-left,x-factris .factris-panel-right{box-shadow:0 4px 0 #041e47}x-factris .corner{position:absolute}x-factris .corner path{fill:#083781}x-factris .corner path.dark{fill:#041e47}x-factris .play{border:10px solid #fff;display:block;left:50%;position:absolute;top:50%;fill:#fff;border-radius:100%;box-shadow:0 4px 0 #06275b,inset 0 4px 0 #06275b;cursor:pointer;margin-left:-50px}x-factris .play svg{display:block}x-factris .logo{filter:drop-shadow(0 4px 0 #06275b);height:60px;left:50%;margin:-100px 0 0 -100px;position:absolute;top:50%;width:200px}x-factris .overlay{font-size:48px;font-weight:700;left:0;position:absolute;text-align:center;text-shadow:0 2px 0 #06275b;top:71px;width:100%;z-index:10}x-factris .logo,x-factris .overlay,x-factris .play{opacity:0;pointer-events:none;transform:scale(.5);transition:opacity .2s linear,transform .4s cubic-bezier(.33,1.9,.52,.7)}x-factris .logo.show,x-factris .overlay.show,x-factris .play.show{opacity:1;pointer-events:all;transform:none}x-factris button{background:#cd0e66;border:none;border-radius:4px;box-shadow:0 4px 0 #6e0736;cursor:pointer;transition:transform .08s,box-shadow .08s,background .08s}x-factris button x-icon{fill:#fff}x-factris button .icon{fill:#fff;margin:0 auto}x-factris button:focus,x-factris button:hover{background:#f01e7f}x-factris button.active,x-factris button:active{background:#cd0e66;box-shadow:none;transform:translateY(4px)}x-factris .factris-keys{display:flex;justify-content:center;margin-bottom:4px;margin-top:10px}x-factris .factris-keys>button{width:50px}x-factris .factris-keys>button x-icon{margin-top:6px}x-factris .keys-center{display:flex;flex-direction:column;margin:0 14px;width:100px}x-factris .keys-center button{width:100px}x-factris .keys-center button:first-child{height:42px;margin-bottom:14px}x-factris .keys-center button:first-child x-icon{margin-bottom:-4px}x-factris .keys-center button:last-child x-icon{margin:-5px 0 -7px}x-factris .keys-play{display:flex;margin-bottom:12px}x-factris .keys-play x-icon{margin-top:5px}x-factris .keys-play button{height:48px;width:50px}x-factris .keys-play button:first-child{margin-right:10px}x-factris .discharge{border-radius:100%;height:74px;margin:8px 0 4px;width:74px}x-factris .discharge-count{display:inline-block;margin:8px 0 4px}x-factris .discharge-count circle{fill:none;stroke:#fff;stroke-width:10px;transform:rotate(-90deg);stroke-dasharray:201px;transition:stroke-dashoffset .2s}x-factris .discharge-count text{font-family:inherit;fill:#fff;text-anchor:middle}x-factris .discharge-count text.large{font-size:22px;font-weight:700}x-factris .discharge-count text.small{font-size:9px}x-factris .text-small{font-size:14px;white-space:nowrap}x-factris .text-large{font-size:28px;font-weight:700;white-space:nowrap}x-factris .text-large.margin{margin-top:8px}x-factris .text-large.narrow{letter-spacing:-.07em}x-factris hr{background:hsla(0,0%,100%,.2);height:2px;margin:8px 0 10px}x-factris .highscore-panel{text-align:left}x-factris .highscore-title{font-size:16px;margin-bottom:8px}x-factris .highscore-panel table{font-size:12px;line-height:1.3;opacity:.8;width:100%}x-factris .highscore-panel table td:nth-child(2){text-align:right}x-factris .highscore-panel table a:hover{opacity:1;text-decoration:underline}x-factris .highscore{height:100%;left:0;overflow:auto;position:absolute;top:0;width:100%}x-factris .highscore .text-large{margin:40px;text-align:center}x-factris .highscore x-icon{fill:#fff;margin-bottom:-6px}x-factris .highscore table{margin:0 40px;width:calc(100% - 80px)}x-factris .highscore table td{border-bottom:1px solid hsla(0,0%,100%,.5);padding:6px 0 5px}x-factris .highscore table td:last-child{text-align:right}x-factris .highscore table tr:last-child td{border:none}x-factris .factris-board{height:500px;width:340px}x-factris .grid{opacity:.6}x-factris .grid .faint-grid{opacity:.5}x-factris .grid line{stroke:#fff;stroke-linecap:round}x-factris .grid line.thick{stroke-width:2}x-factris .tiles rect{fill:#22ab24;stroke:#6fc871;stroke-width:1;stroke-linejoin:round;transition:fill .2s}x-factris .tiles rect.fixed{fill:#fd8c00;stroke:#feb459}x-factris .tiles rect.removing{fill:#ffe7ca;stroke:#ffe7ca;opacity:0}x-factris .tiles rect.error{fill:#cd0e66;stroke:#df629c}x-factris .tiles.animated rect{transition:fill .2s,stroke .2s,transform .3s,opacity .2s;transition-delay:0s,0s,.7s,.6s}x-factris .scores text{text-anchor:middle;fill:#cd0e66;font-size:20px;font-weight:700;opacity:0;transform:scale(.5);transition:opacity .2s linear,transform .4s cubic-bezier(.33,1.9,.52,.7);stroke:#fff;stroke-width:3px;paint-order:stroke;stroke-linejoin:round}.is-safari x-factris .scores text{stroke:none}x-factris .scores .visible text{opacity:1;transform:none}x-factris .highscore-btn{display:none}@media (max-height:740px),(max-width:590px){x-factris{display:flex;flex-direction:column;height:100%;padding:0;white-space:nowrap}x-factris,x-factris .factris-panel-left,x-factris .factris-panel-right,x-factris .factris-panel-top{border-radius:0;box-shadow:none}x-factris .corner,x-factris .highscore-panel,x-factris hr{display:none!important}x-factris .factris-body{flex:1 1;margin:4px 10px 0;width:auto}x-factris .factris-board{height:100%;margin:0 auto;width:100%}x-factris .factris-panel-top{background:none;bottom:auto;top:128px;z-index:2}x-factris .factris-panel-top.hide{display:none}x-factris .factris-panel-left,x-factris .factris-panel-right{display:flex;padding:10px;position:static;width:auto}x-factris .factris-panel-left>:first-child,x-factris .factris-panel-right>:first-child{flex-grow:1}x-factris .factris-panel-left{border-bottom:2px solid hsla(0,0%,100%,.2);border-radius:0}x-factris .keys-play button{height:38px;width:40px}x-factris .keys-play button x-icon{margin-top:3px}x-factris .keys-play button x-icon,x-factris .keys-play button x-icon svg{height:32px!important;width:32px!important}x-factris .factris-panel-left .panel-item{width:100px}x-factris .highscore-btn{display:block;margin-left:10px}x-factris .factris-panel-right{border-radius:0;text-align:left}x-factris .factris-panel-right .text-large{display:inline-block;margin-right:8px}x-factris .factris-panel-right .text-large:after{content:","}x-factris .factris-panel-right .text-large:last-child:after{content:none}x-factris .factris-keys{margin-bottom:14px}html.webview x-factris .factris-keys{margin-bottom:calc(14px + env(safe-area-inset-bottom))}x-factris .discharge{height:39px;margin:-1px 0 0 6px;width:40px}x-factris .discharge x-icon{margin-top:3px}x-factris .discharge x-icon,x-factris .discharge x-icon svg{height:28px!important;width:28px!important}x-factris .discharge-count{height:40px;margin:-1px 0 -1px 6px;width:40px}x-factris .discharge-count text.large{font-size:32px;transform:translateY(11px)}x-factris .discharge-count .small{display:none}x-factris .text-large{font-size:24px}x-factris .text-small{font-size:12px}x-factris .keys-play,x-factris .text-large.margin{margin:0}}marker#axis-arrow{fill:#3a3645}html[theme=dark] marker#axis-arrow{fill:#fff}x-coordinate-sketch,x-coordinate-system,x-geopad{display:block;position:relative}x-coordinate-sketch svg.canvas,x-coordinate-system svg.canvas,x-geopad svg.canvas{display:block;height:100%!important;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}x-coordinate-sketch .grid,x-coordinate-system .grid,x-geopad .grid{opacity:.1}html[theme=dark] x-coordinate-sketch .grid,html[theme=dark] x-coordinate-system .grid,html[theme=dark] x-geopad .grid{opacity:.25}x-coordinate-sketch .grid line,x-coordinate-system .grid line,x-geopad .grid line{stroke:#000;stroke-width:2px}html[theme=dark] x-coordinate-sketch .grid line,html[theme=dark] x-coordinate-system .grid line,html[theme=dark] x-geopad .grid line{stroke:#fff}x-coordinate-sketch .axes line,x-coordinate-system .axes line,x-geopad .axes line{stroke:#3a3645;stroke-width:2px}html[theme=dark] x-coordinate-sketch .axes line,html[theme=dark] x-coordinate-system .axes line,html[theme=dark] x-geopad .axes line{stroke:#fff}x-coordinate-sketch .axes,x-coordinate-sketch .grid,x-coordinate-system .axes,x-coordinate-system .grid,x-geopad .axes,x-geopad .grid{stroke-linecap:round;transition:opacity .2s}x-coordinate-sketch .axes line:not(.tick),x-coordinate-system .axes line:not(.tick),x-geopad .axes line:not(.tick){marker-end:url(#axis-arrow)}x-coordinate-sketch .labels text,x-coordinate-system .labels text,x-geopad .labels text{fill:#3a3645;font-size:14px;stroke-width:4px;paint-order:stroke;stroke-linejoin:round;stroke:#fff}.is-safari x-coordinate-sketch .labels text,.is-safari x-coordinate-system .labels text,.is-safari x-geopad .labels text{stroke:none}html[theme=dark] x-coordinate-sketch .labels text,html[theme=dark] x-coordinate-system .labels text,html[theme=dark] x-geopad .labels text{stroke:#000}x-coordinate-sketch x-gesture,x-coordinate-system x-gesture,x-geopad x-gesture{left:0;position:absolute;top:0}@keyframes pulse{0%{opacity:.6;transform:none}to{opacity:0;transform:scale(3)}}x-coordinate-sketch,x-coordinate-system{color:#cd0e66;margin:2em auto;touch-action:pan-y}x-coordinate-sketch svg,x-coordinate-system svg{stroke-linecap:round;stroke-linejoin:round}x-coordinate-sketch .plot path,x-coordinate-system .plot path{fill:none;stroke:currentColor;stroke-width:3px}x-coordinate-sketch .plot circle,x-coordinate-system .plot circle{fill:currentColor}x-coordinate-sketch .crosshair,x-coordinate-system .crosshair{display:none}x-coordinate-sketch .crosshair circle,x-coordinate-system .crosshair circle{fill:#fff;stroke:currentColor;stroke-width:3px}html[theme=dark] x-coordinate-sketch .crosshair circle,html[theme=dark] x-coordinate-system .crosshair circle{fill:#22212e}x-coordinate-sketch .crosshair path,x-coordinate-system .crosshair path{fill:none;stroke:#3a3645;stroke-width:2px}html[theme=dark] x-coordinate-sketch .crosshair path,html[theme=dark] x-coordinate-system .crosshair path{stroke:#fff}x-coordinate-sketch .crosshair text,x-coordinate-system .crosshair text{fill:currentColor;font-size:14px;stroke-width:6px;paint-order:stroke;stroke-linejoin:round;stroke:#fff}.is-safari x-coordinate-sketch .crosshair text,.is-safari x-coordinate-system .crosshair text{stroke:none}html[theme=dark] x-coordinate-sketch .crosshair text,html[theme=dark] x-coordinate-system .crosshair text{stroke:#000}x-coordinate-sketch g.blue,x-coordinate-sketch.blue,x-coordinate-system g.blue,x-coordinate-system.blue{color:#0f82f2}x-coordinate-sketch g.green,x-coordinate-sketch.green,x-coordinate-system g.green,x-coordinate-system.green{color:#22ab24}x-coordinate-sketch g.yellow,x-coordinate-sketch.yellow,x-coordinate-system g.yellow,x-coordinate-system.yellow{color:#fd8c00}x-coordinate-sketch{cursor:crosshair}x-coordinate-sketch .plot path{stroke-width:8px;opacity:.8}x-geopad{background:#f5f5f6;border-radius:4px;color:inherit;margin:0 auto}html[theme=dark] x-geopad{background:#2d2c38;color:#b2b0b9}x-geopad svg.canvas{position:relative;touch-action:none}x-geopad>canvas,x-geopad>img{height:100%;left:0;max-width:none;position:absolute;top:0;transition:opacity .2s;width:100%}x-geopad .labels text{stroke-width:4px;paint-order:stroke;stroke-linejoin:round;stroke:#f5f5f6}.is-safari x-geopad .labels text{stroke:none}html[theme=dark] x-geopad .labels text{stroke:#2d2c38}x-geopad .labels text.white{stroke:none}.theorem x-geopad{background:transparent}.theorem x-geopad .labels text:not(.white){stroke-width:4px;paint-order:stroke;stroke-linejoin:round;stroke:#f3c3d9}.is-safari .theorem x-geopad .labels text:not(.white){stroke:none}html[theme=dark] .theorem x-geopad .labels text:not(.white){stroke:#000}.tab x-geopad{background:rgba(0,0,0,.03)}.tab x-geopad[grid],x-geopad.no-background,x-geopad[grid]{background:none}.tab x-geopad[grid] .labels text:not(.white),x-geopad.no-background .labels text:not(.white),x-geopad[grid] .labels text:not(.white){stroke-width:4px;paint-order:stroke;stroke-linejoin:round;stroke:#fff}.is-safari .tab x-geopad[grid] .labels text:not(.white),.is-safari x-geopad.no-background .labels text:not(.white),.is-safari x-geopad[grid] .labels text:not(.white){stroke:none}html[theme=dark] .tab x-geopad[grid] .labels text:not(.white),html[theme=dark] x-geopad.no-background .labels text:not(.white),html[theme=dark] x-geopad[grid] .labels text:not(.white){stroke:#22212e}x-geopad .sketch{display:none;fill:rgba(101,96,115,.6);transform-origin:bottom left}x-geopad>.icon-btn{position:absolute;right:8px;top:8px}x-geopad>x-play-toggle{left:8px;position:absolute;top:8px}x-geopad .tools{display:flex;margin:4px 0 0 4px;opacity:0;position:absolute;transition:opacity .3s;transition-delay:1s}x-geopad:hover .tools{opacity:1;transition-delay:0s}x-geopad .tool{background:#c5c2cc;border-radius:3px;box-shadow:none;cursor:pointer;display:none;height:36px;margin:4px;transition:background .2s;width:36px}x-geopad .tool x-icon{fill:#fff;margin:4px}x-geopad .tool:hover{background:#6a637e}x-geopad .tool.active{background:#3a3645}x-geopad[tools*=angleBisector] [data-tool=angleBisector],x-geopad[tools*=circle] [data-tool=circle],x-geopad[tools*=line] [data-tool=line],x-geopad[tools*=move] [data-tool=move],x-geopad[tools*=perpBisector] [data-tool=perpBisector],x-geopad[tools*=point] [data-tool=point],x-geopad[tools*=rectangle] [data-tool=rectangle]{display:block}x-geopad .paths path{fill:none;stroke:currentColor;stroke-width:3px;transition:stroke .2s,stroke-width .2s,fill .2s,opacity .2s,color .2s;stroke-linecap:round;stroke-linejoin:round}x-geopad .paths path.hover,x-geopad .paths path.selected{stroke-width:4px}x-geopad .paths path.thin{stroke-width:2px}x-geopad .paths path.thick{stroke-width:4px}x-geopad .paths path.fill{stroke-width:0;fill:currentColor}x-geopad .paths path[x^="angle("]{stroke-linecap:butt}x-geopad .points circle{fill:#f5f5f6;stroke:currentColor;stroke-width:3px;transition:r .2s,stroke-width .2s,fill .2s,opacity .2s,color .2s;r:3.5px}html[theme=dark] x-geopad .points circle{fill:#2d2c38}x-geopad .points circle.move{r:8px;touch-action:none;stroke:transparent;stroke-width:20px;fill:currentColor}html[theme=dark] x-geopad .points circle.move{fill:currentColor}x-geopad .points circle.hover,x-geopad .points circle.selected{r:6px}x-geopad .points circle.move.hover,x-geopad .points circle.move.selected{r:12px}x-geopad .points circle.pending{transition:none}.focus x-geopad .paths path.focus:not(.fill){stroke-width:5px}.focus x-geopad .points circle.focus{r:8px;stroke-width:5px}.focus x-geopad .points circle.move.focus{r:12px}x-geopad .labels text{transition:opacity .2s,color .2s;fill:currentColor}x-geopad image{transition:opacity .2s}.focus x-geopad image{opacity:.2}x-geopad .transparent,x-geopad .transparent.light{opacity:0}x-geopad .transparent.focus{opacity:1}x-geopad .light,x-geopad .transparent.focus.light{opacity:.5}x-geopad .labels text,x-geopad .paths path,x-geopad .points circle{color:#656073}html[theme=dark] x-geopad .labels text,html[theme=dark] x-geopad .paths path,html[theme=dark] x-geopad .points circle{color:#b2b0b9}x-geopad .labels text.dark,x-geopad .labels text.move,x-geopad .paths path.dark,x-geopad .paths path.move,x-geopad .points circle.dark,x-geopad .points circle.move{color:#3a3645}html[theme=dark] x-geopad .labels text.dark,html[theme=dark] x-geopad .labels text.move,html[theme=dark] x-geopad .paths path.dark,html[theme=dark] x-geopad .paths path.move,html[theme=dark] x-geopad .points circle.dark,html[theme=dark] x-geopad .points circle.move{color:#fff}html[theme=dark] x-geopad .labels text.red,html[theme=dark] x-geopad .paths path.red,html[theme=dark] x-geopad .points circle.red,x-geopad .labels text.red,x-geopad .paths path.red,x-geopad .points circle.red{color:#cd0e66}html[theme=dark] x-geopad .labels text.blue,html[theme=dark] x-geopad .paths path.blue,html[theme=dark] x-geopad .points circle.blue,x-geopad .labels text.blue,x-geopad .paths path.blue,x-geopad .points circle.blue{color:#0f82f2}html[theme=dark] x-geopad .labels text.green,html[theme=dark] x-geopad .paths path.green,html[theme=dark] x-geopad .points circle.green,x-geopad .labels text.green,x-geopad .paths path.green,x-geopad .points circle.green{color:#22ab24}html[theme=dark] x-geopad .labels text.yellow,html[theme=dark] x-geopad .paths path.yellow,html[theme=dark] x-geopad .points circle.yellow,x-geopad .labels text.yellow,x-geopad .paths path.yellow,x-geopad .points circle.yellow{color:#fd8c00}html[theme=dark] x-geopad .labels text.teal,html[theme=dark] x-geopad .paths path.teal,html[theme=dark] x-geopad .points circle.teal,x-geopad .labels text.teal,x-geopad .paths path.teal,x-geopad .points circle.teal{color:#009ea6}html[theme=dark] x-geopad .labels text.orange,html[theme=dark] x-geopad .paths path.orange,html[theme=dark] x-geopad .points circle.orange,x-geopad .labels text.orange,x-geopad .paths path.orange,x-geopad .points circle.orange{color:#eb4726}html[theme=dark] x-geopad .labels text.purple,html[theme=dark] x-geopad .paths path.purple,html[theme=dark] x-geopad .points circle.purple,x-geopad .labels text.purple,x-geopad .paths path.purple,x-geopad .points circle.purple{color:#6d3bbf}html[theme=dark] x-geopad .labels text.lime,html[theme=dark] x-geopad .paths path.lime,html[theme=dark] x-geopad .points circle.lime,x-geopad .labels text.lime,x-geopad .paths path.lime,x-geopad .points circle.lime{color:#bfc212}html[theme=dark] x-geopad .labels text.white,html[theme=dark] x-geopad .paths path.white,html[theme=dark] x-geopad .points circle.white,x-geopad .labels text.white,x-geopad .paths path.white,x-geopad .points circle.white{color:#fff}x-geopad .pulse{fill:#3a3645;animation:pulse 1.8s ease-out infinite}html[theme=dark] x-geopad .pulse{fill:#fff}x-geopad .halo{fill:rgba(58,54,69,.5)}html[theme=dark] x-geopad .halo{fill:hsla(0,0%,100%,.5)}.focus x-geopad .paths path:not(.focus),.focus x-geopad .points circle:not(.focus){color:#e7e6e9}html[theme=dark] .focus x-geopad .paths path:not(.focus),html[theme=dark] .focus x-geopad .points circle:not(.focus){color:#383644}.focus x-geopad .paths path:not(.focus).dark,.focus x-geopad .paths path:not(.focus).move,.focus x-geopad .points circle:not(.focus).dark,.focus x-geopad .points circle:not(.focus).move{color:#e2e2e4}html[theme=dark] .focus x-geopad .paths path:not(.focus).dark,html[theme=dark] .focus x-geopad .paths path:not(.focus).move,html[theme=dark] .focus x-geopad .points circle:not(.focus).dark,html[theme=dark] .focus x-geopad .points circle:not(.focus).move{color:#575660}.focus x-geopad .paths path:not(.focus).red,.focus x-geopad .points circle:not(.focus).red{color:#f1dee8}html[theme=dark] .focus x-geopad .paths path:not(.focus).red,html[theme=dark] .focus x-geopad .points circle:not(.focus).red{color:#4d2641}.focus x-geopad .paths path:not(.focus).blue,.focus x-geopad .points circle:not(.focus).blue{color:#deeaf6}html[theme=dark] .focus x-geopad .paths path:not(.focus).blue,html[theme=dark] .focus x-geopad .points circle:not(.focus).blue{color:#273d5d}.focus x-geopad .paths path:not(.focus).green,.focus x-geopad .points circle:not(.focus).green{color:#e0eee1}html[theme=dark] .focus x-geopad .paths path:not(.focus).green,html[theme=dark] .focus x-geopad .points circle:not(.focus).green{color:#2b4534}.focus x-geopad .paths path:not(.focus).yellow,.focus x-geopad .points circle:not(.focus).yellow{color:#f6ebdd}html[theme=dark] .focus x-geopad .paths path:not(.focus).yellow,html[theme=dark] .focus x-geopad .points circle:not(.focus).yellow{color:#573f2d}.focus x-geopad .paths path:not(.focus).teal,.focus x-geopad .points circle:not(.focus).teal{color:#ddecee}html[theme=dark] .focus x-geopad .paths path:not(.focus).teal,html[theme=dark] .focus x-geopad .points circle:not(.focus).teal{color:#24434e}.focus x-geopad .paths path:not(.focus).orange,.focus x-geopad .points circle:not(.focus).orange{color:#f4e4e1}html[theme=dark] .focus x-geopad .paths path:not(.focus).orange,html[theme=dark] .focus x-geopad .points circle:not(.focus).orange{color:#533134}.focus x-geopad .paths path:not(.focus).purple,.focus x-geopad .points circle:not(.focus).purple{color:#e7e2f1}html[theme=dark] .focus x-geopad .paths path:not(.focus).purple,html[theme=dark] .focus x-geopad .points circle:not(.focus).purple{color:#3a2f53}.focus x-geopad .paths path:not(.focus).lime,.focus x-geopad .points circle:not(.focus).lime{color:#f0f0df}html[theme=dark] .focus x-geopad .paths path:not(.focus).lime,html[theme=dark] .focus x-geopad .points circle:not(.focus).lime{color:#4a4a30}.focus x-geopad .paths path:not(.focus).white,.focus x-geopad .points circle:not(.focus).white{color:#f6f6f7}html[theme=dark] .focus x-geopad .paths path:not(.focus).white,html[theme=dark] .focus x-geopad .points circle:not(.focus).white{color:#575660}.focus x-geopad .pulse{display:none}.focus x-geopad .labels text:not(.focus){opacity:.2}.focus x-geopad .axes,.focus x-geopad canvas{opacity:.1}.focus x-geopad .grid{opacity:.01}x-parallax{display:block;overflow:hidden;position:relative}x-parallax .image{background-position:50%;background-size:cover;bottom:0;left:0;position:absolute;right:0;will-change:transform}x-parallax .content{height:100%;overflow:hidden;position:relative}.other-students{background:#3a3645;border-radius:6px;color:#fff;margin:1.5em 0;padding:12px 20px 2px}.other-students h4{margin:0 0 12px}.other-students img{opacity:.8}.proof{counter-reset:proof-counter;margin:0 0 2em 2em}@media screen and (max-width:660px){.proof{margin-left:0}}.proof li{list-style:none;margin:0 0 1em 3.8em;min-height:2.4em}.proof li .text-center{margin-top:.5em}.proof li:before{border:3px solid #c5c2cc;border-radius:100%;content:counter(proof-counter);counter-increment:proof-counter;display:block;float:left;font-size:1.4em;line-height:1.7em;margin:-4px 0 0 -2.7em;width:1.7em}.proof li:before,.proof-step{color:#666;font-weight:700;text-align:center}.proof-step{border:2px solid #c5c2cc;border-radius:100%;display:inline-block;line-height:1.2em;margin:-5px 0;width:1.2em} \ No newline at end of file diff --git a/frontend/assets/course.js b/frontend/assets/course.js index 062fd113..1e554482 100644 --- a/frontend/assets/course.js +++ b/frontend/assets/course.js @@ -1,9 +1,9 @@ /* (c) Mathigon, generated by Mathigon Studio */ -"use strict";(()=>{var Ih=Object.defineProperty,Hd=Object.defineProperties,jd=Object.getOwnPropertyDescriptor,Ud=Object.getOwnPropertyDescriptors;var kh=Object.getOwnPropertySymbols;var Wd=Object.prototype.hasOwnProperty,Kd=Object.prototype.propertyIsEnumerable;var Eo=(s,e)=>(e=Symbol[s])?e:Symbol.for("Symbol."+s);var Vh=(s,e,t)=>e in s?Ih(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,ut=(s,e)=>{for(var t in e||(e={}))Wd.call(e,t)&&Vh(s,t,e[t]);if(kh)for(var t of kh(e))Kd.call(e,t)&&Vh(s,t,e[t]);return s},ft=(s,e)=>Hd(s,Ud(e));var T=(s,e,t,i)=>{for(var n=i>1?void 0:i?jd(e,t):e,r=s.length-1,o;r>=0;r--)(o=s[r])&&(n=(i?o(e,t,n):o(n))||n);return i&&n&&Ih(e,t,n),n};var D=(s,e,t)=>new Promise((i,n)=>{var r=h=>{try{a(t.next(h))}catch(l){n(l)}},o=h=>{try{a(t.throw(h))}catch(l){n(l)}},a=h=>h.done?i(h.value):Promise.resolve(h.value).then(r,o);a((t=t.apply(s,e)).next())}),Xd=function(s,e){this[0]=s,this[1]=e};var ks=s=>{var e=s[Eo("asyncIterator")],t=!1,i,n={};return e==null?(e=s[Eo("iterator")](),i=r=>n[r]=o=>e[r](o)):(e=e.call(s),i=r=>n[r]=o=>{if(t){if(t=!1,r==="throw")throw o;return o}return t=!0,{done:!1,value:new Xd(new Promise(a=>{var h=e[r](o);if(!(h instanceof Object))throw TypeError("Object expected");a(h)}),1)}}),n[Eo("iterator")]=()=>n,i("next"),"throw"in e?i("throw"):n.throw=r=>{throw r},"return"in e&&i("return"),n};var Mo=(s,e)=>(e=Symbol[s])?e:Symbol.for("Symbol."+s),Yd=function(s,e){this[0]=s,this[1]=e},Zd=s=>{var e=s[Mo("asyncIterator")],t=!1,i,n={};return e==null?(e=s[Mo("iterator")](),i=r=>n[r]=o=>e[r](o)):(e=e.call(s),i=r=>n[r]=o=>{if(t){if(t=!1,r==="throw")throw o;return o}return t=!0,{done:!1,value:new Yd(new Promise(a=>{var h=e[r](o);if(!(h instanceof Object))throw TypeError("Object expected");a(h)}),1)}}),n[Mo("iterator")]=()=>n,i("next"),"throw"in e?i("throw"):n.throw=r=>{throw r},"return"in e&&i("return"),n};function We(s=10){return Math.random().toString(36).substr(2,s)}function _(s,...e){return e.includes(s)}var Qd=(s,e)=>s.concat(e);function Ao(s,e,t=Qd){for(let i of Object.keys(e))i in s&&Array.isArray(s[i])&&Array.isArray(e[i])?s[i]=t(s[i],e[i]):i in s&&s[i]instanceof Object&&e[i]instanceof Object?Ao(s[i],e[i]):s[i]=e[i]}function Zt(s,e=0){return e?+setTimeout(s,e):(s(),0)}function wi(s){return new Promise(e=>setTimeout(e,s))}function Ke(){let s=()=>{},e=()=>{},t=new Promise((i,n)=>{s=i,e=n});return t.catch(i=>i),{promise:t,resolve:s,reject:e}}var Lh=class extends Error{constructor(s){super("[Cache Error]"),this.data=s}};function Oe(s){let e=new Map;return function(...t){let i=t.join("--");if(!e.has(i))try{e.set(i,s(...t))}catch(r){e.set(i,new Lh(r))}let n=e.get(i);if(n instanceof Lh)throw n.data;return n}}function ve(s,e=0,t=!1){let i=!1,n=!1;return(...r)=>{i?n=!0:(t?n=!0:s(...r),i=!0,setTimeout(()=>{n&&s(...r),i=n=!1},e))}}function Jd(s){return function(e,t){if(!e||Array.isArray(this)||s.includes(e))return t}}function we(s,e,t){if(!s)return e;try{return JSON.parse(s,t?Jd(t):void 0)||e}catch(i){return e}}function re(s,e){return new Array(e).fill(s)}function ko(s,e,t){let i=[];for(let n=0;n=0)for(let n=0;ns;n-=t)i.push(n);else if(s<=e)for(let n=s;n<=e;n+=t)i.push(n);else for(let n=s;n>=e;n-=t)i.push(n);return i}function O(s,e=0){return s[s.length-1-e]}function N(s){return s.reduce((e,t)=>e+t,0)}function yi(s,e,t=!1){return s.slice(0).sort((i,n)=>{let r=e(i),o=e(n);return ro?t?-1:1:0})}function os(s){let e=0;return()=>s[e++%s.length]}function Wt(s){return s.filter((e,t)=>s.indexOf(e)===t)}function ye(s){return s.reduce((e,t)=>e.concat(Array.isArray(t)?ye(t):t),[])}function as(s){let e=0;return s.map(t=>e+=t)}function Vo(s,e){let t=[];for(let i=0;ie.concat(t),[])}var Gh=class{constructor(s){let e=s.length,t=s.map(i=>({val:i}));for(let[i,n]of t.entries())n.next=t[(i+1)%e],n.prev=t[(i-1+e)%e];this.root=t[0]}*traverse(){let s=this.root;for(;s;)if(yield s,s=s.next,s===this.root)return}get array(){return Array.from(this.traverse())}delete(s){if(s===this.root){if(s.next===s)return this.root=void 0;this.root=s.next}s.prev.next=s.next,s.next.prev=s.prev}},Io=(s=>(s[s.first=0]="first",s[s.firstGreater=1]="firstGreater",s))(Io||{});function Lo(s,e,t){let i=0,n=s.length-1,r=-1;for(;i<=n;){let o=Math.floor((i+n)/2),a=s[o].val;ae?(t===1&&(r=o),n=o-1):t===0?(r=o,n=o-1):t===1&&(i=o+1)}return r}function Oo(s,e,t){let i=Lo(s,t,0);if(i<0)return-1;for(;s[i].val===t;){if(s[i].item===e)return i;i+=1}return-1}function K(s,e=/\s+/){return s?s.trim().split(e):[]}function nn(s){return s.toLowerCase().replace(/^-/,"").replace(/-(.)/g,(e,t)=>t.toUpperCase())}function tu(s,e,t=!1){let i=ko(0,s.length+1,e.length+1);for(let n=0;n<=s.length;n++)i[n][0]=n;for(let n=0;n<=e.length;n++)i[0][n]=n;for(let n=1;n<=s.length;n++)for(let r=1;r<=e.length;r++)i[n][r]=Math.min(i[n-1][r-1]+(s.charAt(n-1)===e.charAt(r-1)?0:1),i[n-1][r]+1,i[n][r-1]+1);return t?Math.min(...i[s.length]):i[s.length][e.length]}function zh(s,e){let t=s.length/2,i=e.map(r=>({w:r,d:tu(s,r)})).filter(({d:r})=>rr.d)[0];return n?n.w:void 0}var Re=class{constructor(){this.events=new Map}on(s,e){for(let t of K(s))this.events.has(t)||this.events.set(t,[]),this.events.get(t).push(e)}one(s,e){let t=i=>{this.off(s,t),e(i)};this.on(s,t)}off(s,e){for(let t of K(s))this.events.has(t)&&this.events.set(t,this.events.get(t).filter(i=>i!==e))}trigger(s,e){for(let t of K(s))if(this.events.has(t))for(let i of this.events.get(t))i(e)}},eu=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,su=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i,iu=/rgba?\(([0-9.]+), ?([0-9.]+), ?([0-9.]+)(, ?([0-9.]+))?\)/,nu=["#22ab24","#009ea6","#0f82f2","#6d3bbf","#cd0e66","#eb4726","#fd8c00"];function Oh(s){return s.length===1?`0${s}`:s}function Rh(s,e){if(e<=0)return $t.from(s[0]);if(e>=1)return $t.from(O(s));let t=Math.floor(e*(s.length-1)),i=e*(s.length-1)-t;return $t.mix(s[t+1],s[t],i)}function Co(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*(2/3-t)*6:s}var $t=class Ct{constructor(e,t,i,n=1){this.r=e,this.g=t,this.b=i,this.a=n}get hex(){let e=[this.r,this.g,this.b].map(i=>Oh(Math.round(i).toString(16))),t=this.a>=1?"":Oh(Math.round(this.a*255).toString(16));return`#${e.join("")}${t}`}get rgb(){return`rgba(${[this.r,this.g,this.b].map(t=>Math.round(t)).join(",")},${this.a})`}get brightness(){return(this.r*299+this.g*587+this.g*114)/1e3}get hsl(){let e=this.r/255,t=this.g/255,i=this.b/255,n=Math.max(e,t,i),r=Math.min(e,t,i),o=(r+n)/2,a=n-r;if(n===r)return[0,0,Math.round(o*100)];let h=e===n?(t-i)/a:t===n?2+(i-e)/a:4+(e-t)/a;h=Math.min(h*60,360),h<0&&(h+=360);let l=o<=.5?a/(n+r):a/(2-n-r);return[Math.round(h),Math.round(l*100),Math.round(o*100)]}get chroma(){return Math.max(this.r,this.g,this.b)-Math.min(this.r,this.g,this.b)}toString(){return this.rgb}copy(){return new Ct(this.r,this.g,this.b,this.a)}static from(e){return typeof e!="string"?e:e.startsWith("#")?Ct.fromHex(e):Ct.fromRgb(e)}static fromRgb(e){let t=e.match(iu);if(!t)return new Ct(0,0,0);let i=t[4]?+t[5]||0:1;return new Ct(+t[1],+t[2],+t[3],i)}static fromHex(e){e=e.replace(eu,(i,n,r,o)=>n+n+r+r+o+o);let t=su.exec(e);return t?new Ct(parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16),t[4]?parseInt(t[4],16)/255:1):new Ct(0,0,0)}static fromHsl(e,t,i){if(e/=360,t/=100,i/=100,t===0){let l=Math.round(i*255);return new Ct(l,l,l)}let n=i<.5?i*(1+t):i+t-i*t,r=2*i-n,o=Co(r,n,e+1/3),a=Co(r,n,e),h=Co(r,n,e-1/3);return new Ct(Math.round(o*255),Math.round(a*255),Math.round(h*255))}static rainbow(e){return z(t=>Rh(nu,t/(e-1)),e)}static gradient(e,t){return z(i=>Rh(e,i/(t-1)),t)}static shades(e,t,i=.5){let n=Ct.mix("#fff",e,i),r=Ct.mix("#000",e,i);return Ct.gradient([n,e,r],t)}static mix(e,t,i=.5){return e=Ct.from(e),t=Ct.from(t),new Ct(i*e.r+(1-i)*t.r,i*e.g+(1-i)*t.g,i*e.b+(1-i)*t.b,i*e.a+(1-i)*t.a)}static mixMany(e,t){t||(t=e.map(()=>1));let i=N(t),n=e.map(v=>v.hsl),r=n.map(v=>v[0]),o=r.map(v=>v<180?v+360:v),a=t.map((v,w)=>v*Math.sqrt(e[w].chroma)),h=N(a),l=N(r.map((v,w)=>v*a[w]))/h,c=N(o.map((v,w)=>v*a[w]))/h,u=N(r.map((v,w)=>Math.abs(v-l)*a[w])),d=N(o.map((v,w)=>Math.abs(v-c)*a[w])),g=u<=d?l:c%360,y=N(n.map((v,w)=>t[w]*v[1]))/i,f=N(n.map((v,w)=>t[w]*v[2]))/i;return Ct.fromHsl(g,y,f)}};function Vs(s){return s[Symbol.iterator]().next().value}function*rn(...s){for(let e of s)yield*ks(Zd(e))}function Bt(s,e){for(let t of s)if(e(t))return!0;return!1}function*Bh(s,e){let t=0;for(let i of s)e(i,t)&&(yield i),t+=1}function*_h(s,e){for(let t of s)for(let i of e(t))yield i}function*bi(s,e){for(let t of s)for(let i of e)yield[t,i]}function*Ro(s){let e=s.length;for(let t=0;t{for(var t in e)ru(s,t,{get:e[t],enumerable:!0})},ln=1e-6;function x(s,e,t=ln){return isNaN(s)||isNaN(e)?!1:Math.abs(s-e)t&&([e,t]=[t,e]),s>e+i&&s0?1:-1}var qh=/(\d+)(\d{3})/,au=["","k","m","b","t","q"];function hu(s){let[e,t]=s.split(".");for(;qh.test(e);)e=e.replace(qh,"$1,$2");return e+(t?`.${t}`:"")}function lu(s,e=6){if(!e)return`${s}`;let t=`${Math.abs(Math.floor(s))}`.length,i=t+(s<0?1:0);if(i<=e)return`${Rt(s,e-i)}`;let n=Math.floor(Math.log10(Math.abs(s))/3),r=au[n],o=e-(t%3||3)-(r?1:0)-(s<0?1:0);return Rt(s/Math.pow(10,3*n),o)+r}function Ot(s,e=0,t=!0){let i=lu(s,e).replace("-","\u2013");return t?hu(i):i}var cu=/^-?0,[0-9]+$/,pu=/^-?([0-9]+(,[0-9]{3})*)?\.?[0-9]*$/,du=/^-?[0-9]+(\.[0-9]{3})*,?[0-9]*$/;function Wh(s){return s=s.replace(/^–/,"-").trim(),!s||s.match(/[^0-9.,-]/)?NaN:cu.test(s)?parseFloat(s.replace(/,/,".")):pu.test(s)?parseFloat(s.replace(/,/g,"")):du.test(s)?parseFloat(s.replace(/\./g,"").replace(/,/,".")):NaN}var Do=["","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],Fh=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],uu=[""," thousand"," million"," billion"," trillion"," quadrillion"," quintillion"," sextillion"];function fu(s){let[e,t,i]=s.split(""),n=e==="0"?"":` ${Do[+e]} hundred`;return t+i==="00"?n:+t<2?`${n} ${Do[+(t+i)]}`:i==="0"?`${n} ${Fh[+t]}`:`${n} ${Fh[+t]}-${Do[+i]}`}function zo(s){if(s===0)return"zero";let e=Math.round(Math.abs(s)).toString(),t=Math.ceil(e.length/3),i=e.padStart(3*t,"0"),n="";for(let r=0;rn.length===e):i}function Xh(s){if(s.length===1)return[[],s];let e=s.pop(),t=Xh(s),i=[];for(let n of t)i.push(n,[...n,e]);return i}var on=(s,e)=>{let t=s<0?"\u2013":"";return Math.abs(s)===1&&e?t+e:t+Math.abs(s)+(e||"")},Yh=class mt{constructor(e=0,t=0){this.re=e,this.im=t}get modulus(){return Math.sqrt(this.re*this.re+this.im*this.im)}get argument(){return Math.atan2(this.im,this.re)}get conjugate(){return new mt(this.re,-this.im)}root(e,t=0){let i=Math.pow(this.modulus,1/e),n=(this.argument+t*2*Math.PI)/e;return new mt(i*Math.cos(n),i*Math.sin(n))}toString(e=2){let t=Rt(this.re,e),i=Rt(this.im,e);return i===0?on(t):t===0?on(i,"i"):[on(t),i<0?"\u2013":"+",on(Math.abs(i),"i")].join(" ")}add(e){return mt.sum(this,e)}subtract(e){return mt.difference(this,e)}multiply(e){return mt.product(this,e)}divide(e){return mt.quotient(this,e)}static sum(e,t){return typeof e=="number"&&(e=new mt(e,0)),typeof t=="number"&&(t=new mt(t,0)),new mt(e.re+t.re,e.im+t.im)}static difference(e,t){return typeof e=="number"&&(e=new mt(e,0)),typeof t=="number"&&(t=new mt(t,0)),new mt(e.re-t.re,e.im-t.im)}static product(e,t){typeof e=="number"&&(e=new mt(e,0)),typeof t=="number"&&(t=new mt(t,0));let i=e.re*t.re-e.im*t.im,n=e.im*t.re+e.re*t.im;return new mt(i,n)}static quotient(e,t){if(typeof e=="number"&&(e=new mt(e,0)),typeof t=="number"&&(t=new mt(t,0)),Math.abs(t.re)1)return xe(e,xe(...t));let i=Math.abs(e),n=Math.abs(t[0]);for(;n;)[i,n]=[n,i%n];return i}function Ls(...s){let[e,...t]=s;return t.length>1?Ls(e,Ls(...t)):Math.abs(e*t[0])/xe(e,t[0])}function _o(s){if(s%1!==0||s<2)return!1;if(s%2===0)return s===2;if(s%3===0)return s===3;let e=Math.sqrt(s);for(let t=5;t<=e;t+=6)if(s%t===0||s%(t+2)===0)return!1;return!0}function No(s){if(s===1)return[];if(_o(s))return[s];let e=Math.sqrt(s);for(let t=2;t<=e;++t)if(s%t===0)return No(t).concat(No(s/t));return[]}function Zh(s){return Wt(No(s))}var mu=/^([0-9\-.]*)([%πkmbtq]?)(\/([0-9\-.]+))?([%π]?)$/,Hh=s=>s>=Number.MAX_SAFE_INTEGER,cn=class X{constructor(e,t,i){this.unit=i,this.num=t!==void 0&&t<0?-e:e,t!==void 0&&Math.abs(t)!==1&&e!==0&&(this.den=Math.abs(t))}valueOf(){return this.value}toMixed(){if(!this.den||this.unit)return this.toString();let e=Math.abs(this.num)%this.den,t=Math.abs(Math.trunc(this.value));return t?`${this.sign<0?"\u2013":""}${t} ${e}/${this.den}`:this.toString()}toExpr(e,t=4){let i=this.value;if(Math.abs(i)>=Number.MAX_VALUE)return"\u221E";if((Hh(this.num)||this.den&&Hh(this.den))&&(e="decimal"),e==="scientific"||Math.abs(i)>=Number.MAX_SAFE_INTEGER){let[n,r]=this.value.toExponential(t-1).split("e");if(Math.abs(+r)>=t){let o=r.startsWith("-"),a=`${o?"(":""}${o?r:r.slice(1)}${o?")":""}`;return`${n.replace(/\.?0+$/,"")} \xD7 10^${a}${this.unit||""}`}}if(!this.unit&&!this.den||e==="decimal"||e==="scientific"){let n=Ot(this.value,t);return n.match(/^[\d.]+$/g)?n:`"${n}"`}else return e==="mixed"?this.toMixed():this.toString()}toString(e=4){let t=!this.den&&!this.unit,i=Ot(this.num,this.den?0:e,t),n=this.unit||"",r=this.den?`/${Ot(this.den,0,t)}`:"";return i==="0"&&(n=""),n==="\u03C0"&&!this.den&&(i==="1"||i==="\u20131")&&(i=i.replace("1","")),`${i}${r}${n}`}toMathML(){let e=`${this.num}`;return this.den!==void 0&&(e=`${e}${this.den}`),this.unit&&(e+=this.unit==="\u03C0"?"\u03C0":"%"),e}get value(){let e=this.unit==="%"?.01:this.unit==="\u03C0"?Math.PI:1;return this.num*e/(this.den||1)}get sign(){return Math.sign(this.num)}get simplified(){if(!this.den)return this;let e=xe(Math.abs(this.num),this.den);return new X(this.num/e,this.den/e,this.unit)}get inverse(){return this.den?new X(1/this.num,void 0,this.unit):new X(this.den,this.num)}get negative(){return new X(-this.num,this.den,this.unit)}get fraction(){if(!(this.unit||!be(this.num)))return[this.num,this.den||1]}static fromString(e){e=e.toLowerCase().replace(/[\s,"]/g,"").replace("\u2013","-").replace("pi","\u03C0");let t=e.match(mu);if(!t)return;let i=t[2]||t[5]||void 0,n=t[1]?+t[1]:void 0,r=t[4]?+t[4]:void 0;if(i==="\u03C0"&&(!t[1]||t[1]==="-")&&(n=t[1]?-1:1),n===void 0||isNaN(n))return;let o=i?"kmbtq".indexOf(i):-1;if(o>=0&&(n*=1e3**(o+1),i=void 0),r===void 0)return new X(n,void 0,i);if(!(isNaN(r)||x(r,0)))return!be(n)||!be(r)?new X(n/r,void 0,i):new X(n,r,i)}static fractionFromDecimal(e,t=1e3,i=1e-12){let n=[1,0],r=[0,1],o=Math.abs(e),a=o;for(;Math.abs(n[0]/r[0]-o)>i;){let h=Math.floor(a);if(n=[h*n[0]+n[1],n[0]],r=[h*r[0]+r[1],r[0]],r[0]>t)return new X(e);a=1/(a-h)}return x(n[0]/r[0],o,i)?new X(ou(e)*n[0],r[0]===1?void 0:r[0]):new X(e)}clamp(e,t){let i=this.value;return e!==void 0&&it?new X(t):this}add(e){return X.sum(this,e)}subtract(e){return X.difference(this,e)}multiply(e){return X.product(this,e)}divide(e){return X.quotient(this,e)}static sum(e,t){if(typeof t=="number"&&(t=new X(t)),e.num===0)return t;if(e.unit!==t.unit)return new X(e.value+t.value);if(!e.den&&!t.den)return new X(e.num+t.num,void 0,e.unit);if(e.den||([e,t]=[t,e]),!be(t.num))return new X(e.value+t.value,void 0,e.unit);let i=Ls(e.den,t.den||1),n=i/e.den,r=i/(t.den||1);return new X(e.num*n+t.num*r,i,e.unit)}static difference(e,t){return typeof t=="number"&&(t=new X(t)),X.sum(e,t.negative)}static product(e,t){if(typeof t=="number"&&(t=new X(t)),!e.unit&&!e.den&&be(e.num))return new X(e.num*t.num,t.den,t.unit);if(!t.unit&&!t.den&&be(t.num))return new X(e.num*t.num,e.den,e.unit);if(e.unit==="\u03C0"||t.unit==="\u03C0"||!be(e.num)||!be(t.num))return new X(e.value*t.value);let i=(e.unit==="%"?100:1)*(t.unit==="%"?100:1);return new X(e.num*t.num,(e.den||1)*(t.den||1)*i)}static quotient(e,t){return typeof t=="number"&&(t=new X(t)),X.product(e,t.inverse)}},At={};Go(At,{determinant:()=>bu,fill:()=>Qh,identity:()=>Jh,inverse:()=>sl,product:()=>hn,reflection:()=>wu,rotation:()=>gu,scalarProduct:()=>yu,shear:()=>vu,sum:()=>tl,transpose:()=>el});function Qh(s,e,t){return ko(s,e,t)}function Jh(s=2){let e=Qh(0,s,s);for(let t=0;t1?tl(...t):t[0];if(e.length!==i.length||e[0].length!==i[0].length)throw new Error("Matrix sizes don\u2019t match");let n=[];for(let r=0;rt.map(i=>i*e))}function hn(...s){let[e,...t]=s,i=t.length>1?hn(...t):t[0];if(e[0].length!==i.length)throw new Error("Matrix sizes don\u2019t match.");let n=[];for(let r=0;rs[n][r],e,e);for(let n=0;nnl,binomial:()=>Su,cauchy:()=>Vu,chiCDF:()=>Lu,exponential:()=>Au,find:()=>Pu,geometric:()=>ku,integer:()=>$u,integrate:()=>ol,normal:()=>Cu,normalPDF:()=>Iu,poisson:()=>Eu,shuffle:()=>xu,smart:()=>Tu,uniform:()=>Mu,weighted:()=>il});function xu(s){s=s.slice(0);for(let e=s.length-1;e>0;--e){let t=Math.floor(Math.random()*(e+1));[s[e],s[t]]=[s[t],s[e]]}return s}function $u(s,e){let t=e===void 0?0:s,i=e===void 0?s:e-s+1;return t+Math.floor(i*Math.random())}function il(s){let e=Math.random()*N(s),t=0;return s.findIndex(i=>(t+=i)>=e)}function Pu(s){return s[Math.floor(s.length*Math.random())]}var an=new Map;function Tu(s,e){e||(e=We()),an.has(e)||an.set(e,re(1,s));let t=an.get(e),i=il(t.map(n=>n*n));return t[i]-=1,t[i]<=0&&an.set(e,t.map(n=>n+1)),i}function nl(s=.5){return Math.random()e;++i)t*=Math.random();return i-1}function Mu(s=0,e=1){return s+(e-s)*Math.random()}function Cu(s=0,e=1){let t=Math.random(),i=Math.random();return Math.sqrt(-2*Math.log(t))*Math.cos(2*Math.PI*i)*Math.sqrt(e)+s}function Au(s=1){return s<=0?0:-Math.log(Math.random())/s}function ku(s=.5){if(!(s<=0||s>1))return Math.floor(Math.log(Math.random())/Math.log(1-s))}function Vu(){let s,e,t;do e=2*Math.random()-1,t=2*Math.random()-1,s=e*e+t*t;while(s>=1);return e/t}function Iu(s,e=1,t=0){return Math.exp(-((s-e)**2)/(2*t))/Math.sqrt(2*Math.PI*t)}var jh=7,Uh=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23];function rl(s){if(s<.5)return Math.PI/(Math.sin(Math.PI*s)*rl(1-s));s-=1;let e=Uh[0];for(let i=1;iMath.pow(i,(e-2)/2)*Math.exp(-i/2),0,s)/Math.pow(2,e/2)/rl(e/2)}var qo={};Go(qo,{bestPolynomial:()=>zu,coefficient:()=>hl,exponential:()=>Du,linear:()=>Ru,logarithmic:()=>Nu,polynomial:()=>al,power:()=>Gu});function Ou(s,e){let t=1,i=s[0];for(let n=1;noe(e+1).map(l=>Math.pow(h[0],l))),i=el(t),n=s.map(h=>[h[1]]),r=hn(i,t),o=sl(r);return hn(o,i,n).map(h=>h[0])}function hl(s,e){let i=s.reduce((o,a)=>o+a[1],0)/s.length,n=s.reduce((o,a)=>o+(a[1]-i)**2,0);return 1-s.reduce((o,a)=>o+(a[1]-e(a[0]))**2,0)/n}function zu(s,e=.85,t=8){if(!(s.length<=1))for(let i=1;iOu(n,a);if(hl(s,r)>=e)return{order:i,coefficients:n,fn:r}}}function Os(s){return s.length?N(s)/s.length:0}var Tt=2*Math.PI;function $i(s,e){let t=Math.atan2(s.y-(e?e.y:0),s.x-(e?e.x:0));return gt(t,Tt)}function ll(s,e){let t,i=1/0,n=-1;for(let[r,o]of e.entries()){let a=o.project(s),h=p.distance(s,a);hn.x))/e.length,i=N(e.map(n=>n.y))/e.length;return new et(t,i)}static dot(e,t){return e.x*t.x+e.y*t.y}static sum(e,t){return new et(e.x+t.x,e.y+t.y)}static difference(e,t){return new et(e.x-t.x,e.y-t.y)}static distance(e,t){return Math.sqrt(Qt(e.x-t.x)+Qt(e.y-t.y))}static manhattan(e,t){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)}static interpolate(e,t,i=.5){return new et(tt(e.x,t.x,i),tt(e.y,t.y,i))}static interpolateList(e,t=.5){let i=e.length-1,n=Math.floor(B(t,0,1)*i);return et.interpolate(e[n],e[n+1],i*t-n)}static fromPolar(e,t=1){return new et(t*Math.cos(e),t*Math.sin(e))}static random(e){let t=_t.uniform(e.xMin,e.xMax),i=_t.uniform(e.yMin,e.yMax);return new et(t,i)}static equals(e,t,i){return x(e.x,t.x,i)&&x(e.y,t.y,i)}static colinear(e,t,i,n){let r=e.x-t.x,o=e.y-t.y,a=t.x-i.x,h=t.y-i.y;return x(r*h,a*o,n)}transform(e){let t=e[0][0]*this.x+e[0][1]*this.y+e[0][2],i=e[1][0]*this.x+e[1][1]*this.y+e[1][2];return new et(t,i)}rotate(e,t=R){if(x(e,0))return this;let i=this.x-t.x,n=this.y-t.y,r=Math.cos(e),o=Math.sin(e),a=i*r-n*o+t.x,h=i*o+n*r+t.y;return new et(a,h)}reflect(e){let t=e.p2.x-e.p1.x,i=e.p2.y-e.p1.y,n=this.x-e.p1.x,r=this.y-e.p1.y,o=(t*r-i*n)/(t*t+i*i),a=this.x+2*o*i,h=this.y-2*o*t;return new et(a,h)}scale(e,t=e){return new et(this.x*e,this.y*t)}shift(e,t=e){return new et(this.x+e,this.y+t)}translate(e){return this.shift(e.x,e.y)}equals(e,t){return et.equals(this,e,t)}toString(){return`point(${this.x},${this.y})`}},R=new p(0,0);function St(s){return["polygon","polyline","rectangle","triangle"].includes(s.type)}function Ye(s){return["polygon","triangle"].includes(s.type)}function fn(s){return s.type==="polyline"}function Wo(s){return s.type==="rectangle"}function it(s){return["line","ray","segment"].includes(s.type)}function Ko(s){return s.type==="line"}function mn(s){return s.type==="ray"}function $e(s){return s.type==="segment"}function U(s){return s.type==="circle"}function Ze(s){return s.type==="ellipse"}function Dt(s){return s.type==="arc"}function Pe(s){return s.type==="sector"}function qt(s){return s.type==="angle"}function rt(s){return s.type==="point"}var vt=class xi{constructor(e,t){this.p1=e,this.p2=t,this.type="line"}get length(){return p.distance(this.p1,this.p2)}get lengthSquared(){return(this.p1.x-this.p2.x)**2+(this.p1.y-this.p2.y)**2}get midpoint(){return p.average(this.p1,this.p2)}get slope(){return(this.p2.y-this.p1.y)/(this.p2.x-this.p1.x)}get intercept(){return this.p1.y-this.slope*this.p1.x}get angle(){return $i(this.p2,this.p1)}get unitVector(){return this.p2.subtract(this.p1).unitVector}get perpendicularVector(){return new p(this.p2.y-this.p1.y,this.p1.x-this.p2.x).unitVector}parallel(e){return new xi(e,e.add(this.p2).subtract(this.p1))}perpendicular(e){let t=this.line.project(e);return p.equals(e,t)?new xi(t,t.add(this.perpendicularVector.scale(this.length/2))):new xi(t,e)}get perpendicularBisector(){return this.perpendicular(this.midpoint)}distanceSquared(e){let t=this.project(e);return(e.x-t.x)**2+(e.y-t.y)**2}get line(){return this.type==="line"?this:new xi(this.p1,this.p2)}get ray(){return mn(this)?this:new Xo(this.p1,this.p2)}get segment(){return $e(this)?this:new Y(this.p1,this.p2)}offset(e){let t=p.difference(this.p2,this.p1),i=p.difference(e,this.p1);return p.dot(t,i)/this.lengthSquared}project(e){return this.at(this.offset(e))}side(e,t){let i=p.difference(this.p2,this.p1),n=p.difference(e,this.p1),r=n.x*i.y-n.y*i.x;return x(r,0,t)?0:Math.sign(r)}contains(e,t){return this.side(e,t)===0}at(e){return p.interpolate(this.p1,this.p2,e)}transform(e){return new this.constructor(this.p1.transform(e),this.p2.transform(e))}rotate(e,t=R){return x(e,0)?this:new this.constructor(this.p1.rotate(e,t),this.p2.rotate(e,t))}reflect(e){return new this.constructor(this.p1.reflect(e),this.p2.reflect(e))}scale(e,t=e){return new this.constructor(this.p1.scale(e,t),this.p2.scale(e,t))}shift(e,t=e){return new this.constructor(this.p1.shift(e,t),this.p2.shift(e,t))}translate(e){return this.shift(e.x,e.y)}equals(e,t){return this.contains(e.p1,t)&&this.contains(e.p2,t)}toString(){return`line(${this.p1},${this.p2})`}},Xo=class extends vt{constructor(){super(...arguments),this.type="ray"}equals(s,e){return s.type!=="ray"||!this.p1.equals(s.p1,e)?!1:this.p2.equals(s.p2,e)?!0:s.contains(this.p2,e)||this.contains(s.p2,e)}contains(s,e){if(!super.contains(s,e))return!1;let t=this.offset(s);return x(t,0,e)||t>0}toString(){return`ray(${this.p1},${this.p2})`}},Y=class ml extends vt{constructor(){super(...arguments),this.type="segment"}contains(e,t){return super.contains(e,t)?this.p1.equals(e,t)||this.p2.equals(e,t)?!0:x(this.p1.x,this.p2.x,t)?nt(e.y,this.p1.y,this.p2.y):nt(e.x,this.p1.x,this.p2.x):!1}project(e){let t=p.difference(this.p2,this.p1),i=p.difference(e,this.p1),n=B(p.dot(t,i)/this.lengthSquared,0,1);return this.p1.add(t.scale(n))}contract(e){return new ml(this.at(e),this.at(1-e))}equals(e,t,i=!1){return e.type!=="segment"?!1:this.p1.equals(e.p1,t)&&this.p2.equals(e.p2,t)||!i&&this.p1.equals(e.p2,t)&&this.p2.equals(e.p1,t)}toString(){return`segment(${this.p1},${this.p2})`}},wt=class Rs{constructor(e=R,t=1){this.c=e,this.r=t,this.type="circle"}get circumference(){return Tt*this.r}get area(){return Math.PI*this.r**2}get arc(){let e=this.c.shift(this.r,0);return new Ft(this.c,e,Tt)}tangentAt(e){let t=this.at(e),i=this.c.rotate(Math.PI/2,t);return new vt(t,i)}collision(e){let t=this.c.xe.p.x+e.w?e.p.x+e.w:this.c.x,i=this.c.ye.p.y+e.h?e.p.y+e.h:this.c.y;return p.distance(this.c,new p(t,i))<=this.r}project(e){let t=e.subtract(this.c).unitVector.scale(this.r);return p.sum(this.c,t)}at(e){let t=Tt*e;return this.c.shift(this.r*Math.cos(t),this.r*Math.sin(t))}offset(e){return $i(e,this.c)/Tt}contains(e){return p.distance(e,this.c)<=this.r}transform(e){let t=Math.abs(e[0][0])+Math.abs(e[1][1]);return new Rs(this.c.transform(e),this.r*t/2)}rotate(e,t=R){return x(e,0)?this:new Rs(this.c.rotate(e,t),this.r)}reflect(e){return new Rs(this.c.reflect(e),this.r)}scale(e,t=e){return new Rs(this.c.scale(e,t),this.r*(e+t)/2)}shift(e,t=e){return new Rs(this.c.shift(e,t),this.r)}translate(e){return this.shift(e.x,e.y)}equals(e,t){return x(this.r,e.r,t)&&this.c.equals(e.c,t)}toString(){return`circle(${this.c},${this.r})`}},Ft=class{constructor(s,e,t){this.c=s,this.start=e,this.angle=t,this.type="arc"}get circle(){return new wt(this.c,this.radius)}get radius(){return p.distance(this.c,this.start)}get end(){return this.start.rotate(this.angle,this.c)}get startAngle(){return $i(this.start,this.c)}contract(s){return new this.constructor(this.c,this.at(s/2),this.angle*(1-s))}get minor(){return this.angle<=Math.PI?this:new this.constructor(this.c,this.end,Tt-this.angle)}get major(){return this.angle>=Math.PI?this:new this.constructor(this.c,this.end,Tt-this.angle)}get center(){return this.at(.5)}project(s){let e=this.startAngle,t=e+this.angle,i=$i(s,this.c);return t>Tt&&i=-ls}function cl(s,e,t){let i=s.y-e.y,n=t.x-e.x,r=s.x-e.x,o=t.y-e.y,a=r*n+i*o;if(a(i.prev=e,i.next=t,e.next=i,t&&(t.prev=i),i)}}static node(s){let e=s;return e.remove=()=>{e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e.prev=e.next=void 0},e}};function Uo(s,e,t){let i={above:t.myFill.above,below:t.myFill.below};return{start:s,end:e,myFill:i}}function _u(s,e,t,i,n,r){let o=gl(e,n);return o!==0?o:p.equals(t,r)?0:s!==i?s?1:-1:jo(t,i?n:r,i?r:n)?1:-1}function Zo(s,e,t){s.insertBefore(e,i=>_u(!!e.isStart,e.pt,t,!!i.isStart,i.pt,i.other.pt)<0)}function qu(s,e,t){let i=Ns.node({isStart:!0,pt:e.start,seg:e,primary:t});return Zo(s,i,e.end),i}function Fu(s,e,t,i){let n=Ns.node({pt:t.end,seg:t,primary:i,other:e});e.other=n,Zo(s,n,e.pt)}function dn(s,e,t){let i=qu(s,e,t);return Fu(s,i,e,t),i}function Hu(s,e,t){e.other.remove(),e.seg.end=t,e.other.pt=t,Zo(s,e.other,e.pt)}function ue(s,e,t){let i=Uo(t,e.seg.end,e.seg);return Hu(s,e,t),dn(s,i,!!e.primary)}function ju(s,e){let t=s.seg.start,i=s.seg.end,n=e.seg.start,r=e.seg.end;return p.colinear(t,n,r)?p.colinear(i,n,r)||jo(i,n,r)?1:-1:jo(t,n,r)?1:-1}function Fo(s,e,t){let i=e.seg,n=t.seg,r=i.start,o=i.end,a=n.start,h=n.end,l=Bu(r,o,a,h);if(l===!1){if(!p.colinear(r,o,a)||p.equals(r,h)||p.equals(o,a))return!1;let c=p.equals(r,a),u=p.equals(o,h);if(c&&u)return t;let d=!c&&cl(r,a,h),g=!u&&cl(o,a,h);if(c)return g?ue(s,t,o):ue(s,e,h),t;d&&(u||(g?ue(s,t,o):ue(s,e,h)),ue(s,t,r))}else l.alongA===0&&(l.alongB===-1?ue(s,e,a):l.alongB===0?ue(s,e,l.pt):l.alongB===1&&ue(s,e,h)),l.alongB===0&&(l.alongA===-1?ue(s,t,r):l.alongA===0?ue(s,t,l.pt):l.alongA===1&&ue(s,t,o));return!1}function vl(s,e){var t,i;let n=new Ns,r=[];for(;s.head;){let a=s.head;if(a.isStart){let h=function(){if(c){let g=Fo(s,a,c);if(g)return g}return u?Fo(s,a,u):!1};var o=h;let l=n.findTransition(g=>ju(a,g.ev)>0),c=(t=l.before)==null?void 0:t.ev,u=(i=l.after)==null?void 0:i.ev,d=h();if(d&&(e?(!a.seg.myFill.below||a.seg.myFill.above!==a.seg.myFill.below)&&(d.seg.myFill.above=!d.seg.myFill.above):d.seg.otherFill=a.seg.myFill,a.other.remove(),a.remove()),s.head!==a)continue;if(e){let g=a.seg.myFill.below?a.seg.myFill.above!==a.seg.myFill.below:!0;a.seg.myFill.below=u?u.seg.myFill.above:!1,a.seg.myFill.above=g?!a.seg.myFill.below:a.seg.myFill.below}else if(a.seg.otherFill===void 0){let g=u?a.primary===u.primary?u.seg.otherFill.above:u.seg.myFill.above:!1;a.seg.otherFill={above:g,below:g}}a.other.status=l.insert(Ns.node({ev:a}))}else{let h=a.status;if(h===void 0)throw new Error("[Euclid.js] Zero-length segment detected!");if(n.exists(h.prev)&&n.exists(h.next)&&Fo(s,h.prev.ev,h.next.ev),h.remove(),!a.primary){let l=a.seg.myFill;a.seg.myFill=a.seg.otherFill,a.seg.otherFill=l}r.push(a.seg)}s.head.remove()}return r}function Uu(s){let e=[],t=[];return s.forEach(i=>{let n=i.start,r=i.end;if(p.equals(n,r))return;let o={index:0,matchesHead:!1,matchesPt1:!1},a={index:0,matchesHead:!1,matchesPt1:!1},h=o;function l(f,v,w){h.index=f,h.matchesHead=v,h.matchesPt1=w;let $=h===o;return h=$?a:void 0,!$}for(let f=0;fQo(s,e,Ku),Qu=(s,e)=>Qo(s,e,Xu),Ju=(s,e)=>Qo(s,e,Yu);function tf(s,e){return x(s.p1.x,s.p2.x)?nt(e.y,s.p1.y,s.p2.y):nt(e.x,s.p1.x,s.p2.x)}function ef(s,e){return x(s.p1.x,s.p2.x)?(e.y-s.p1.y)/(s.p2.y-s.p1.y)>0:(e.x-s.p1.x)/(s.p2.x-s.p1.x)>0}function sf(s,e){return nt(s.offset(e),0,1)}function nf(s,e){let t=s.p1.x-s.p2.x,i=s.p1.y-s.p2.y,n=e.p1.x-e.p2.x,r=e.p1.y-e.p2.y,o=t*r-i*n;if(x(o,0))return[];let a=s.p1.x*s.p2.y-s.p1.y*s.p2.x,h=e.p1.x*e.p2.y-e.p1.y*e.p2.x,l=a*n-t*h,c=a*r-i*h;return[new p(l/o,c/o)]}function rf(s,e){let t=p.distance(s.c,e.c);if(t>s.r+e.r)return[];if(ttf(r,o))),mn(r)&&(t=t.filter(o=>ef(r,o))),Dt(r)&&(t=t.filter(o=>sf(r,o)));return t}function Q(...s){if(s.length<2)return[];if(s.length>2)return ye(Kh(s,2).map(i=>Q(...i)));let[e,t]=s;if(qt(e)&&(e=e.shape(!0)),qt(t)&&(t=t.shape(!0)),St(t)&&([e,t]=[t,e]),St(e)){let i=it(t)?e.points.filter(n=>t.contains(n)):[];for(let n of e.edges)i.push(...Q(n,t));return i}return of(e,t)}var V=class Xe{constructor(...e){this.type="polygon",this.points=e}get circumference(){if(this.points.length<=1)return 0;let e=p.distance(this.points[0],O(this.points));for(let t=1;tp.distance(i,e));return Math.max(...t)}get oriented(){if(this.signedArea>=0)return this;let e=[...this.points].reverse();return new this.constructor(...e)}cut(e){let t=this.radius/e.length*10,i=e.at(-t),n=e.at(t),r=e.perpendicularVector.scale(e.length*t),o=[i,n,n.add(r),i.add(r)],a=Qu([this.points],[o]),h=Ju([this.points],[o]);return[...a,...h].map(l=>new Xe(...l))}static collision(e,t){if(e.points.some(i=>t.contains(i))||t.points.some(i=>e.contains(i)))return!0;for(let i of e.edges)for(let n of t.edges)if(Q(i,n)[0])return!0;return!1}static union(...e){let[t,...i]=e;if(!i.length)return[t];let n=[t.points],r=i.length>1?Xe.union(...i).map(o=>o.points):[e[1].points];return Zu(n,r).map(o=>new Xe(...o))}static regular(e,t=1){let i=Tt/e,n=Math.PI/2-i/2,r=z(o=>p.fromPolar(n+i*o,t),e);return new Xe(...r)}static interpolate(e,t,i=.5){let n=e.points.map((r,o)=>p.interpolate(r,t.points[o],i));return new Xe(...n)}static convexHull(...e){if(e.length<=3)return new Xe(...e);let t=e.sort((o,a)=>o.x!==a.x?o.x-a.x:o.y-a.y),i=t.slice(0).reverse(),n=[],r=[];for(let[o,a]of[[t,n],[i,r]]){for(let h of o){for(;a.length>=2;){let l=a[a.length-1],c=a[a.length-2];if((l.x-c.x)*(h.y-c.y)>=(h.x-c.x)*(l.y-c.y))a.pop();else break}a.push(h)}a.pop()}return new Xe(...n.concat(r))}contains(e){let t=!1;for(let i of this.edges){if(i.p1.equals(e)||i.contains(e))return!1;if(i.p1.y>e.y==i.p2.y>e.y)continue;let n=(i.p2.x-i.p1.x)/(i.p2.y-i.p1.y);e.xt)return n.at((t-i)/r);i+=r}return this.points[0]}offset(e){let t=this.edges,i=ll(e,this.edges)||[this.points[0],0],n=0;for(let r=0;rt.transform(e)))}rotate(e,t=R){if(x(e,0))return this;let i=this.points.map(n=>n.rotate(e,t));return new this.constructor(...i)}reflect(e){let t=this.points.map(i=>i.reflect(e));return new this.constructor(...t)}scale(e,t=e){let i=this.points.map(n=>n.scale(e,t));return new this.constructor(...i)}shift(e,t=e){let i=this.points.map(n=>n.shift(e,t));return new this.constructor(...i)}translate(e){return this.shift(e.x,e.y)}equals(e,t,i){let n=this.points.length;if(n!==e.points.length)return!1;let r=i?this:this.oriented,o=i?e:e.oriented;for(let a=0;ah.equals(o.points[(l+a)%n],t)))return!0;return!1}toString(){return`polygon(${this.points.join(",")})`}},te=class extends V{constructor(){super(...arguments),this.type="polyline"}get circumference(){return this.length}get length(){let s=0;for(let e=1;eNumber.MAX_SAFE_INTEGER))return new wt(o,a)}get incircle(){let s=this.edges,e=s.map(c=>c.length),t=e[0]+e[1]+e[2],[i,n,r]=this.points,o=e[1]*i.x+e[2]*n.x+e[0]*r.x,a=e[1]*i.y+e[2]*n.y+e[0]*r.y,h=new p(o/t,a/t),l=h.distanceFromLine(s[0]);return isNaN(l)?void 0:new wt(h,l)}get orthocenter(){let[s,e,t]=this.points,i=new vt(s,e).perpendicular(t),n=new vt(s,t).perpendicular(e);return Q(i,n)[0]}},af=180/Math.PI,hf=Math.PI/180;function Kt(s){return s*af}function J(s){return s*hf}var kt=class fe{constructor(e,t,i){this.a=e,this.b=t,this.c=i,this.type="angle"}static fromDegrees(e){return fe.fromRadians(e*(Math.PI/180))}static fromRadians(e){let t=new p(1,0),i=t.rotate(e);return new fe(t,R,i)}static equals(e,t,i=Math.PI/360){return x(e.rad,t.rad,i)}get rad(){let e=Math.atan2(this.a.y-this.b.y,this.a.x-this.b.x),i=Math.atan2(this.c.y-this.b.y,this.c.x-this.b.x)-e;return i<0&&(i+=Tt),i}get deg(){return this.rad*180/Math.PI}get isRight(){return x(this.rad,Math.PI/2,Math.PI/360)}get bisector(){if(this.b.equals(this.a)||this.b.equals(this.c))return;let e=Math.atan2(this.a.y-this.b.y,this.a.x-this.b.x),t=Math.atan2(this.c.y-this.b.y,this.c.x-this.b.x),i=(e+t)/2;e>t&&(i+=Math.PI);let n=Math.cos(i)+this.b.x,r=Math.sin(i)+this.b.y;return new vt(this.b,new p(n,r))}get sup(){return this.rado.x?i:o.x,n=no.y?r:o.y;return new Ds(new p(t,n),i-t,r-n)}get center(){return new p(this.p.x+this.w/2,this.p.y+this.h/2)}get centroid(){return this.center}get circumference(){return 2*Math.abs(this.w)+2*Math.abs(this.h)}get area(){return Math.abs(this.signedArea)}get signedArea(){return this.w*this.h}get edges(){return this.polygon.edges}get points(){return this.polygon.points}get polygon(){let e=new p(this.p.x+this.w,this.p.y),t=new p(this.p.x+this.w,this.p.y+this.h),i=new p(this.p.x,this.p.y+this.h);return new V(this.p,e,t,i)}get bounds(){return new lt(this.p.x,this.p.x+this.w,this.p.y,this.p.y+this.h)}collision(e){return this.p.xe.p.x&&this.p.ye.p.y}padding(e,t,i,n){return new Ds(this.p.shift(-n,-e),this.w+n+t,this.h+e+i)}get unsigned(){if(this.w>0&&this.h>0)return this;let e=this.p.shift(this.w<0?this.w:0,this.h<0?this.h:0);return new Ds(e,Math.abs(this.w),Math.abs(this.h))}contains(e,t){return nt(e.x,this.p.x,this.p.x+this.w,t)&&nt(e.y,this.p.y,this.p.y+this.h,t)}project(e){let t;for(let i of this.edges){let n=i.project(e);(!t||p.distance(e,n)0?1:0,r=p.distance(e,s);return[s.x,`${s.y}A${r}`,r,0,n,1,t.x,t.y].join(",")}function Jt(...s){return`M${s.map(e=>`${e.x},${e.y}`).join("L")}`}function Ho(s,e){let t=s.perpendicularVector.scale(6),i=s.unitVector.scale(3),n=s.midpoint;switch(e){case"bar":return Jt(n.add(t),n.add(t.inverse));case"bar2":return Jt(n.add(i).add(t),n.add(i).add(t.inverse))+Jt(n.add(i.inverse).add(t),n.add(i.inverse).add(t.inverse));case"arrow":return Jt(n.add(i.inverse).add(t),n.add(i),n.add(i.inverse).add(t.inverse));case"arrow2":return Jt(n.add(i.scale(-2)).add(t),n,n.add(i.scale(-2)).add(t.inverse))+Jt(n.add(t),n.add(i.scale(2)),n.add(t.inverse));default:return""}}function un(s,e){if(!s||!e)return"";let t=e.perpendicular,i=s.add(e.scale(9)).add(t.scale(9)),n=s.add(e.scale(9)).add(t.scale(-9));return Jt(i,s,n)}function lf(s,e){let t="";return _(e,"start","both")&&(t+=un(s.p1,s.unitVector)),_(e,"end","both")&&(t+=un(s.p2,s.unitVector.inverse)),t}function cf(s,e){let t="";if(_(e,"start","both")){let i=new vt(s.c,s.start).perpendicularVector.inverse;t+=un(s.start,i)}if(_(e,"end","both")){let i=new vt(s.c,s.end).perpendicularVector;t+=un(s.end,i)}return t}function pf(s,e,t=e,i=e,n=t){let{p:r,w:o,h:a}=s;return`M${r.x} ${r.y+e}a${e} ${e} 0 0 1 ${e} ${-e}h${o-e-t}a${t} ${t} 0 0 1 ${t} ${t}v${a-t-i}a${i} ${i} 0 0 1 ${-i} ${i}h${-o+n+i}a${n} ${n} 0 0 1 ${-n} ${-n}Z`}function De(s,e={}){if(qt(s)){let t=s.shape(!!e.fill,e.size,e.round);return De(t,e)}if($e(s)){if(s.p1.equals(s.p2))return"";let t=Jt(s.p1,s.p2);return e.mark&&(t+=Ho(s,e.mark)),e.arrows&&(t+=lf(s,e.arrows)),t}if(mn(s)){if(!e.box)return"";let t=Q(s,e.box)[0];if(!t)return"";let i=Jt(s.p1,t);return e.mark&&(i+=Ho(s,e.mark)),i}if(Ko(s)){if(!e.box)return"";let t=Q(s,e.box);if(t.length<2)return"";let i=Jt(t[0],t[1]);return e.mark&&(i+=Ho(s,e.mark)),i}if(U(s))return`M${s.c.x-s.r} ${s.c.y}a${s.r},${s.r} 0 1 0 ${2*s.r} 0a${s.r} ${s.r} 0 1 0 ${-2*s.r} 0Z`;if(Ze(s)){let[t,i]=s.majorVertices,n=Kt(s.angle);return`M${t.x} ${t.y}A${s.a} ${s.b} ${n} 0 0 ${i.x} ${i.y}A${s.a} ${s.b} ${n} 0 0 ${t.x} ${t.y}Z`}if(Dt(s)){let t=`M${fl(s.start,s.c,s.end)}`;return e.arrows&&(t+=cf(s,e.arrows)),t}if(Pe(s))return`M${s.c.x} ${s.c.y} L ${fl(s.start,s.c,s.end)}Z`;if(fn(s))return Jt(...s.points);if(Ye(s))return`${Jt(...s.points)}Z`;if(Wo(s)){if(!e.cornerRadius)return`${Jt(...s.polygon.points)}Z`;let t=s.unsigned,i=Math.min(e.cornerRadius,t.w/2,t.h/2);return pf(t,i)}return""}var ta=(s,e)=>(e=Symbol[s])?e:Symbol.for("Symbol."+s),he=(s,e,t)=>new Promise((i,n)=>{var r=h=>{try{a(t.next(h))}catch(l){n(l)}},o=h=>{try{a(t.throw(h))}catch(l){n(l)}},a=h=>h.done?i(h.value):Promise.resolve(h.value).then(r,o);a((t=t.apply(s,e)).next())}),df=function(s,e){this[0]=s,this[1]=e},uf=s=>{var e=s[ta("asyncIterator")],t=!1,i,n={};return e==null?(e=s[ta("iterator")](),i=r=>n[r]=o=>e[r](o)):(e=e.call(s),i=r=>n[r]=o=>{if(t){if(t=!1,r==="throw")throw o;return o}return t=!0,{done:!1,value:new df(new Promise(a=>{var h=e[r](o);if(!(h instanceof Object))throw TypeError("Object expected");a(h)}),1)}}),n[ta("iterator")]=()=>n,i("next"),"throw"in e?i("throw"):n.throw=r=>{throw r},"return"in e&&i("return"),n},gn="_M",Gs=window.navigator.userAgent.toLowerCase(),ff=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i,wl=/iphone|ipad|ipod/i,mf=/^((?!chrome|android).)*safari/i,yl,gf=class{constructor(){this.isMobile=ff.test(Gs),this.isRetina=(window.devicePixelRatio||1)>1,this.isTouch=!!window.Touch||"ontouchstart"in window,this.isChrome=!!window.chrome,this.isFirefox=Gs.indexOf("firefox")>=0,this.isAndroid=Gs.indexOf("android")>=0,this.isIOS=wl.test(Gs),this.isSafari=wl.test(Gs)||mf.test(Gs),this.loadQueue=[],this.loaded=!1,this.width=window.innerWidth,this.height=window.innerHeight,this.resizeCallbacks=[],this.theme={name:"light",isDark:!1},this.themeChangedCallbacks=[],this.themeOverride="",this.darkQuery=(yl=window.matchMedia)==null?void 0:yl.call(window,"(prefers-color-scheme: dark)");var s,e;window.onload=()=>this.afterLoad(),document.addEventListener("DOMContentLoaded",()=>this.afterLoad());let t=ve(()=>this.applyResize());window.addEventListener("resize",t);try{(s=this.darkQuery)==null||s.addEventListener("change",()=>this.applyThemeChange())}catch(n){(e=this.darkQuery)==null||e.addListener(()=>this.applyThemeChange())}let i=this.getCookie("theme");i&&this.setTheme(i);try{this.localStorage=window.localStorage}catch(n){console.warn("Unable to access Local Storage in this context.")}}afterLoad(){if(!this.loaded){this.loaded=!0;for(let s of this.loadQueue)s();setTimeout(()=>this.resize())}}ready(s){this.loaded?s():this.loadQueue.push(s)}redraw(){document.body.offsetHeight}applyResize(){let s=window.innerWidth,e=window.innerHeight;if(!(this.width===s&&this.height===e)){this.width=s,this.height=e;for(let t of this.resizeCallbacks)t({width:this.width,height:this.height});C.trigger("scroll",{top:C.scrollTop})}}onResize(s){s({width:this.width,height:this.height}),this.resizeCallbacks.push(s)}offResize(s){let e=this.resizeCallbacks.indexOf(s);e>=0&&this.resizeCallbacks.splice(e,1)}resize(){this.applyResize()}applyThemeChange(){let s=this.theme.name,e=s==="dark"||s==="auto"&&this.darkQuery.matches;if(e!==this.theme.isDark){this.theme.isDark=e;for(let t of this.themeChangedCallbacks)t(this.theme);setTimeout(()=>Xt.setAttr("theme",this.themeOverride||(e?"dark":"light")))}}setTheme(s){s!==this.theme.name&&(this.theme.name=s,this.setCookie("theme",s),this.applyThemeChange())}onThemeChange(s){this.themeChangedCallbacks.push(s)}getHash(){return window.location.hash.slice(1)}setHash(s){let e=document.body.scrollTop;window.location.hash=s,document.body.scrollTop=e}setURL(s,e=""){window.history.replaceState({},e,s),e&&(window.document.title=e)}getCookies(){let s=document.cookie.split(";"),e={};for(let t=0,i=s.length;t use")).forEach(function(e){let t=e.getAttribute("xlink:href"),[i,n]=t.split("#");if(!i.length||!n)return;let r=e.parentNode;r.removeChild(e),i in ea||(ea[i]=fetch(i).then(a=>a.text())),ea[i].then(a=>{let h=document.implementation.createHTMLDocument("");h.documentElement.innerHTML=a;let c=h.getElementById(n).cloneNode(!0),u=document.createDocumentFragment();for(;c.childNodes.length;)u.appendChild(c.firstChild);r.appendChild(u)})})}var $f=new Map(Object.entries({" ":"Space",Spacebar:"Space",Del:"Delete",Esc:"Escape",Left:"ArrowLeft",Right:"ArrowRight",Down:"ArrowDown",Up:"ArrowUp"}));function Ei(s){return $f.get(s.key)||s.key}function El(s){let e=new Set(["Enter","Space"]),t=!1;document.addEventListener("keyup",i=>{e.has(Ei(i))&&(t=!1)}),(s||document).addEventListener("keydown",i=>{if(!t&&e.has(Ei(i))){t=!0;let n=b.getActiveInput();n&&n.hasAttr("tabindex")&&n.tagName!=="TEXTAREA"&&(i.preventDefault(),n.trigger("pointerdown",i),n.trigger("pointerstop",i),C.trigger("pointerstop",i),n.trigger("click",i))}})}var Pn=!1;setTimeout(()=>Pn=!0);var Pf="cubic-bezier(0.175, 0.885, 0.32, 1.275)",Tf="cubic-bezier(0.68, -0.275, 0.825, 0.115)",ps={cancel:()=>{},promise:Promise.resolve()};function pt(s,e){if(e===0)return s(1,0,()=>{}),ps;let t=Date.now(),i=Ke(),n=0,r=!0,o=()=>{r=!1,i.reject()};function a(){if(!r)return;(!e||n<=e)&&window.requestAnimationFrame(a);let h=Date.now()-t;s(e?Math.min(1,h/e):h,h-n,o),e&&h>=e&&i.resolve(),n=h}return a(),{cancel:o,promise:i.promise}}function vn(s,e=0,t=0){switch(s){case"quad":return e**2;case"cubic":return e**3;case"quart":return e**4;case"quint":return e**5;case"circ":return 1-Math.sqrt(1-e**2);case"sine":return 1-Math.cos(e*Math.PI/2);case"exp":return e<=0?0:Math.pow(2,10*(e-1));case"back":return t||(t=1.70158),e*e*((t+1)*e-t);case"elastic":return t||(t=.3),-Math.pow(2,10*(e-1))*Math.sin(((e-1)*2/t-.5)*Math.PI);case"swing":return .5-Math.cos(e*Math.PI)/2;case"spring":return 1-Math.cos(e*4.5*Math.PI)*Math.exp(-e*6);case"bounce":return e<1/11?1/64-7.5625*(.5/11-e)*(.5/11-e):e<3/11?1/16-7.5625*(2/11-e)*(2/11-e):e<7/11?1/4-7.5625*(5/11-e)*(5/11-e):1-7.5625*(1-e)*(1-e);default:return e}}function yt(s,e=0,t=0){if(e===0)return 0;if(e===1)return 1;let[i,n]=s.split("-");return n==="in"?vn(i,e,t):n==="out"?1-vn(i,1-e,t):e<=.5?vn(i,2*e,t)/2:1-vn(i,2*(1-e),t)/2}function Ht(s,e,t=400,i=0,n="ease-in-out"){if(!Pn)return Object.keys(e).forEach(f=>{let v=e[f];s.css(f,Array.isArray(v)?v[1]:v)}),ps;n==="bounce-in"&&(n=Pf),n==="bounce-out"&&(n=Tf);let r="";b.isSafari&&(r=s._el.style.transition,s.css("transition","none"),b.redraw());let o=s._data.animation;o&&o.cancel();let a={},h={},l=Ke(),c=window.getComputedStyle(s._el);Object.keys(e).forEach(f=>{let v=e[f],w=nn(f);h[w]=Array.isArray(v)?v[0]:c.getPropertyValue(f),a[w]=Array.isArray(v)?v[1]:v,i&&s.css(f,h[w])});let u=a.height;if(a.height==="auto"){let f=s.children.filter(v=>v.css("position")!=="absolute");a.height=`${N(f.map(v=>v.outerHeight))}px`}let d,g=!1;Zt(()=>{g||(d=s._el.animate([h,a],{duration:t,easing:n,fill:"forwards"}),d.onfinish=()=>{s._el&&Object.keys(e).forEach(f=>s.css(f,f==="height"?u:a[f])),b.isSafari&&s.css("transition",r),l.resolve(),d.cancel(),s._data.animation=void 0})},i);let y={cancel(){g||(g=!0,s._el&&Object.keys(e).forEach(f=>s.css(f,s.css(f))),d&&d.cancel(),s._data.animation=void 0)},promise:l.promise};return setTimeout(()=>s._data.animation=y),y}var Sf=/matrix\([0-9.\-\s]+,[0-9.\-\s]+,[0-9.\-\s]+,[0-9.\-\s]+,([0-9.\-\s]+),([0-9.\-\s]+)\)/;function Ef(s,e="fade",t=500,i=0){if(s.show(),!Pn)return ps;let n=s._data.animation?1:+s.css("opacity")||1;if(e==="fade")return Ht(s,{opacity:[0,n]},t,i);if(e==="pop"){let r=s.transform.replace(/scale\([0-9.]*\)/,"").replace(Sf,"translate($1px,$2px)");return Ht(s,{opacity:[0,n]},t,i),Ht(s,{transform:[`${r} scale(0.5)`,`${r} scale(1)`]},t,i,"bounce-in")}else{if(e==="descend")return Ht(s,{opacity:[0,1],transform:["translateY(-50%)","none"]},t,i);if(e.startsWith("draw")){let r=s.strokeLength;s.css("stroke-dasharray",`${r}px`),s.css("opacity")||s.css("opacity",1);let o=e==="draw-reverse"?`${2*r}px`:0,a={"stroke-dashoffset":[`${r}px`,o]},h=Ht(s,a,t,i,"linear");return h.promise.then(()=>s.css("stroke-dasharray","")),h}else if(e.startsWith("slide")){let r={opacity:[0,n],transform:["translateY(50px)","none"]};return e.includes("down")&&(r.transform[0]="translateY(-50px)"),e.includes("right")&&(r.transform[0]="translateX(-50px)"),e.includes("left")&&(r.transform[0]="translateX(50px)"),Ht(s,r,t,i)}else if(e.startsWith("reveal")){let r={opacity:[0,n],height:[0,"auto"]};return e.includes("left")&&(r.transform=["translateX(-50%)","none"]),e.includes("right")&&(r.transform=["translateX(50%)","none"]),Ht(s,r,t,i)}}return ps}function Mf(s,e="fade",t=400,i=0,n=!1){if(!s._el)return ps;if(!Pn)return s.hide(),ps;if(s.css("display")==="none")return ps;let r;if(e==="fade")r=Ht(s,{opacity:[1,0]},t,i);else if(e==="pop"){let o=s.transform.replace(/scale\([0-9.]*\)/,"");Ht(s,{opacity:[1,0]},t,i),r=Ht(s,{transform:[`${o} scale(1)`,`${o} scale(0.5)`]},t,i,"bounce-out")}else if(e==="ascend")r=Ht(s,{opacity:[1,0],transform:["none","translateY(-50%)"]},t,i);else if(e.startsWith("draw")){let o=s.strokeLength;s.css("stroke-dasharray",o);let h={"stroke-dashoffset":[e==="draw-reverse"?`${2*o}px`:0,`${o}px`]};r=Ht(s,h,t,i,"linear")}else if(e.startsWith("slide")){let o={opacity:0,transform:"translateY(50px)"};e.includes("up")&&(o.transform="translateY(-50px)"),r=Ht(s,o,t,i)}else if(e.startsWith("reveal")){let o={opacity:0,height:0};e.includes("left")&&(o.transform="translateX(-50%)"),e.includes("right")&&(o.transform="translateX(50%)"),r=Ht(s,o,t,i)}return r.promise.then(()=>n?s.remove():s.hide()),r}var Ml={"===":(s,e)=>s===e,"!==":(s,e)=>s!==e,"||":(s,e)=>s||e,"&&":(s,e)=>s&&e,"==":(s,e)=>s==e,"!=":(s,e)=>s!=e,"<=":(s,e)=>s<=e,">=":(s,e)=>s>=e,"**":(s,e)=>s**e,"<":(s,e)=>s":(s,e)=>s>e,"+":(s,e)=>s+e,"-":(s,e)=>s-e,"*":(s,e)=>s*e,"/":(s,e)=>s/e,"%":(s,e)=>s%e},Cl={"-":s=>-s,"+":s=>+s,"!":s=>!s},bl={"||":1,"&&":2,"==":3,"!=":3,"===":3,"!==":3,"<":4,">":4,"<=":4,">=":4,"+":5,"-":5,"*":6,"/":6,"%":6,"**":7},xl={true:!0,false:!1,undefined:void 0},Cf=/\s/,Af=/[0-9]/,sa=/[a-zA-Zα-ωΑ-Ω$_]/,kf=/[0-9a-zA-Zα-ωΑ-Ω$_]/;function Vf(s){let e=s.length,t=0;function i(f){throw new Error(`${f} at character ${t} of "${s}"`)}function n(){for(;Cf.test(s[t]);)t+=1}function r(){var f;let v=((f=s.slice(t).match(/^\d*(\.\d+)?([eE][+-]?\d+)?/))==null?void 0:f[0])||"";t+=v.length;let w=s[t];return w&&(sa.test(w)||w===".")&&i(`Unexpected character (${v+w})`),{type:5,value:parseFloat(v)}}function o(){let f=s[t];t+=1;let v=!1,w="";for(;t2&&M<=bl[I[I.length-2]];)w=I.pop(),v=I.pop(),f=I.pop(),$={type:1,operator:v,left:f,right:w},I.push($);$=u(),$||i(`Expected expression after ${P}`),I.push(P,$)}let A=I.length-1;for($=I[A];A>1;)$={type:1,operator:I[A-1],left:I[A-2],right:$},A-=2;return $}function g(){let f=d();if(n(),f&&s[t]==="?"){t+=1;let v=g();if(v||i("Expected expression"),n(),s[t]===":"){t++;let w=g();return w||i("Expected expression"),{type:3,test:f,consequent:v,alternate:w}}else i("Expected :")}else return f}let y=g();return tae(y,e,t)[0]);return i.some(y=>y===void 0)?wn:[i,void 0];case 1:let n=ae(s.left,e,t)[0],r=ae(s.right,e,t)[0];return"+-**/%".includes(s.operator)&&(n===void 0||r===void 0)?wn:[Ml[s.operator](n,r),void 0];case 2:let[o,a]=ae(s.callee,e,t),h=s.args.map(y=>ae(y,e,t)[0]);return h.some(y=>y===void 0)||typeof o!="function"?wn:[o.apply(a,h),void 0];case 3:let l=ae(s.consequent,e,t),c=ae(s.alternate,e,t);return ae(s.test,e,t)[0]?l:c;case 4:return[t[s.name]||e[s.name],void 0];case 5:return[s.value,void 0];case 6:let u=ae(s.object,e,t)[0],d=s.computed?ae(s.property,e,t)[0]:s.property.name;return u?[u[d],u]:[void 0,void 0];case 7:let g=ae(s.argument,e,t)[0];return g===void 0&&s.operator!=="!"?wn:[Cl[s.operator](g),void 0]}}function ct(s){let e=Vf(s);return e?(t={},i={})=>ae(e,t,i)[0]:(t={})=>{}}var If=/\${([^}]+)}/g;function bn(s,e=!1){let t=s.split(If),i=t.map((n,r)=>r%2?ct(n.replace(/×/g,"*")):void 0);return n=>t.map((r,o)=>{if(!(o%2))return r;let a=i[o](n);return!e&&typeof a=="number"&&a<0?`\u2013${-a}`:a}).join("")}var Ti="ontouchstart"in window,zs="onpointerdown"in window;function Vt(s){if(s.touches){let e=s.targetTouches.length?s.targetTouches:s.changedTouches;return new p(e[0].clientX,e[0].clientY)}else return new p(s.clientX||0,s.clientY||0)}function Lf(s){return s.touches||[]}function me(s,e){return Vt(s).transform(e.inverseTransformMatrix)}function Al(s,e){let t=Vt(s),i=e.bounds,n=(t.x-i.left)*e.canvasWidth/i.width,r=(t.y-i.top)*e.canvasHeight/i.height;return new p(n,r)}function Of(s){if(s instanceof PointerEvent&&s.pointerType==="mouse")return k(s.target);let e=Vt(s);return k(document.elementFromPoint(e.x,e.y)||void 0)}function Rf(s){if(s._data.tapEvent)return;s._data.tapEvent=!0;let e;s.on("pointerdown",t=>e=Vt(t)),s.on("pointerup",t=>{if(!e)return;let i=Vt(t);p.distance(e,i)<6&&s.trigger("tap",t),e=void 0}),s.on("pointercancel",()=>e=void 0)}function Df(s){s._data.clickOutsideEvent||(s._data.clickOutsideEvent=!0,C.on("pointerdown",e=>{let t=e.composedPath()[0]||e.target;!t||s._el===t||s._el.contains(t)||s.trigger("clickOutside",e)}))}function ds(s,e){let t=e.$box||s,i=Vt;t.type==="svg"?i=d=>me(d,t.$ownerSVG):t.type==="canvas"&&(i=d=>Al(d,t));let n=e.justInside?s:C,r,o,a=!1,h=0;s.css("touch-action")==="auto"&&s.css("touch-action","none"),s.addClass("noselect");function l(d){d.handled||Lf(d).length>1||(d.preventDefault(),a=!1,h=d.pointerId||0,n.on("pointermove",c),n.on("pointerstop",u),r=o=i(d),e.down&&e.down(r))}function c(d){if(!r||h&&d.pointerId!==h)return;d.preventDefault();let g=i(d);p.distance(g,o)<.5||(!a&&e.start&&e.start(r),e.move&&e.move(g,r,o),o=g,a=!0)}function u(d,g=!1){r&&(h&&d.pointerId!==h||(d.preventDefault(),n.off("pointermove",c),n.off("pointerstop",u),e.up&&e.up(o,r),a&&e.end&&e.end(o,r),!a&&e.click&&!g&&e.click(r),r=void 0))}C.onKey("Escape",()=>{if(!r)return;a&&e.move&&e.move(r,r,o),o=r;let d=document.createEvent("MouseEvent");d.pointerId=h,u(d,!0)}),s.on("pointerdown",l),e.justInside&&s.on("mouseleave",u),e.accessible&&(s.setAttr("tabindex","0"),document.addEventListener("keydown",d=>{if(![37,38,39,40].includes(d.keyCode)||s!==b.getActiveInput())return;let g=s.boxCenter,y=i({clientX:g.x,clientY:g.y}),f=d.keyCode===37?-25:d.keyCode===39?25:0,v=d.keyCode===38?-25:d.keyCode===40?25:0,w=y.shift(f,v);e.down&&e.down(y),e.start&&e.start(y),e.move&&e.move(w,y,y),e.end&&e.end(w,y)}))}function kl(s,e){let t=Vt;s.type==="svg"?t=n=>me(n,s.$ownerSVG):s.type==="canvas"&&(t=n=>Al(n,s));let i=!1;s.on("touchstart mouseenter",n=>{!i&&e.enter&&e.enter(),e.move&&e.move(t(n)),i=!0},{passive:!0}),s.on("pointermove",n=>{i&&e.move&&e.move(t(n))}),s.on("touchend mouseleave",()=>{i&&e.exit&&e.exit(),i=!1},{passive:!0})}function Nf(s){if(s._data.scrollEvents)return;s._data.scrollEvents=!0;let e=!1,t;function i(){let h=s.scrollTop;if(h===t){e=!1;return}t=h,s.trigger("scroll",{top:t}),window.requestAnimationFrame(i)}function n(){e||window.requestAnimationFrame(i),e=!0}(s.type==="window"?window:s._el).addEventListener("scroll",n);function o(){window.addEventListener("touchmove",n),window.addEventListener("touchend",a)}function a(){window.removeEventListener("touchmove",n),window.removeEventListener("touchend",a)}s._el.addEventListener("touchstart",function(h){h.handled||o()})}function Bs(s,e){let t=e.$clickTarget||s,i=0,n=!1,r=!1,o=!1;function a(){n||(e.enter&&e.enter(),n=!0)}function h(){n&&(clearTimeout(i),e.exit&&e.exit(),n=!1)}s.on("mouseover",()=>{e.preventMouseover&&e.preventMouseover()||(clearTimeout(i),i=Zt(()=>{a(),r=!0},e.delay))}),s.on("mouseout",()=>{r&&(clearTimeout(i),i=Zt(h,e.exitDelay||e.delay))}),t.on("focus",()=>{n||e.preventMouseover&&e.preventMouseover()||(clearTimeout(i),a(),o=!0)});let l=()=>{o&&(e.canFocusWithin?setTimeout(()=>{let c=b.getActiveInput();c&&c.hasParent(s)?c.one("blur",l):h()}):h())};t.on("blur",l),t.on("click",()=>{n&&!r?h():n||(a(),r=!1)}),s.on("clickOutside",h)}var ia;function Gf(s){for(let e of s){let t=e.isIntersecting?"enterViewport":"exitViewport";setTimeout(()=>k(e.target).trigger(t))}}function $l(s){if(!s._data.intersectionEvents){if(s._data.intersectionEvents=!0,!window.IntersectionObserver){let e=!1;C.on("scroll",()=>{let t=s.isInViewport;e&&!t?(s.trigger("exitViewport"),e=!1):t&&!e&&(s.trigger("enterViewport"),e=!0)});return}ia||(ia=new IntersectionObserver(Gf)),ia.observe(s._el)}}function zf(s,e=!1){if(e&&(s._data.resizeObserver&&s._data.resizeObserver.disconnect(),s._data.resizeObserver=void 0),!s._data.resizeObserver){if(window.ResizeObserver){let t=new window.ResizeObserver(()=>s.trigger("resize"));t.observe(s._el),s._data.resizeObserver=t}else if(window.MutationObserver){let t=new MutationObserver(()=>s.trigger("resize"));t.observe(s._el,{attributes:!0,childList:!0,characterData:!0,subtree:!0}),s._data.resizeObserver=t}}}function Pl(s){if(s._data.pointerPositionEvents)return;s._data.pointerPositionEvents=!0;let e=s.parent,t;e.on("pointerend",()=>t=void 0),e.on("pointermove",i=>{let n=t,r=Of(i);t=r.equals(s)||r.hasParent(s),n!==void 0&&t&&!n&&s.trigger("pointerenter",i),!t&&n&&s.trigger("pointerleave",i)})}function na(s,e){e._data[`_${s}`]||(e._data[`_${s}`]=!0,zs?e.on(s.replace("mouse","pointer"),t=>{t.pointerType==="mouse"&&e.trigger(s,t)}):Ti||e._el.addEventListener(s,t=>e.trigger(s,t)))}function Bf(s){s.on("keydown",e=>{if(e.metaKey||e.ctrlKey||b.isAndroid&&e.keyCode===229)return;let t=e.key||String.fromCharCode(e.which),i=!!e.shiftKey;s.trigger("key",{code:e.keyCode,key:t,char:t,shift:i})}),b.isAndroid&&s.type==="input"&&s.on("input",e=>{let t=e.key||e.data[e.data.length-1];s.trigger("key",{code:void 0,key:t,char:t}),s.value=""})}var xn={scrollwheel:"DOMMouseScroll mousewheel",pointerdown:zs?"pointerdown":Ti?"touchstart":"mousedown",pointermove:zs?"pointermove":Ti?"touchmove":"mousemove",pointerup:zs?"pointerup":Ti?"touchend":"mouseup",pointercancel:zs?"pointercancel":"touchcancel",pointerstop:zs?"pointerup pointercancel":Ti?"touchend touchcancel":"mouseup"},$n={scroll:Nf,tap:Rf,clickOutside:Df,key:Bf,mousedown:na.bind(void 0,"mousedown"),mousemove:na.bind(void 0,"mousemove"),mouseup:na.bind(void 0,"mouseup"),pointerenter:Pl,pointerleave:Pl,enterViewport:$l,exitViewport:$l,resize:zf};function _f(s,e,t,i){if(e in $n)$n[e](s,!1);else if(e in xn){let n=K(xn[e]);for(let r of n)s._el.addEventListener(r,t,i)}else s._el.addEventListener(e,t,i)}function qf(s,e,t){if(e in $n)(!s._events[e]||!s._events[e].length)&&$n[e](s,!0);else if(t&&e in xn){let i=K(xn[e]);for(let n of i)s._el.removeEventListener(n,t)}else t&&s._el.removeEventListener(e,t)}var yn=0,ra=new Map;function Tl(s,e){ra.set(s,e)}function Ff(s){if(yn++,s(),yn--,yn===0){for(let[e,t]of ra.entries())e(t);ra.clear()}}function le(s,e){let t=new Map,i=new Map,n=new Set,r,o=0;function a(M){r=M;let P=M(A,!0);return r=void 0,P}function h(M){for(let P of t.values())P.has(M)&&P.delete(M);n.delete(M)}function l(M,P){return n.add(M),P?void 0:M(A,!0)}function c(M,P){i.has(M)&&h(i.get(M));let j=()=>{s[M]=P(A),r===j&&(r=void 0),u(M)};i.set(M,j),a(j)}function u(M){if(yn>0){for(let P of t.get(M)||[])Tl(P,s);for(let P of n)Tl(P,s)}else{for(let P of t.get(M)||[])P(s);for(let P of n)P(s)}}function d(){for(let M of t.values())for(let P of M)P(s);for(let M of n)M(s)}function g(M,P){P&&(s={}),Ff(()=>{for(let[j,ne]of Object.entries(M))j in w||(w[j]=s[j]),A[j]=ne})}function y(){for(o+=1;`_x${o}`in s;)o+=1;return`_x${o}`}function f(){s={},t.clear(),i.clear(),o=0}function v(){return Object.assign({},s)}let w={};function $(){let M=[{},{}];for(let P of Object.keys(w))w[P]!==s[P]&&(M[0][P]=w[P],M[1][P]=s[P]);return w={},M}function I(M){e&&e.watch(()=>A[M]=e[M])}let A=new Proxy(s,{get(M,P){return P==="watch"?a:P==="unwatch"?h:P==="watchAll"?l:P==="setComputed"?c:P==="forceUpdate"?d:P==="getChanges"?$:P==="assign"?g:P==="getKey"?y:P==="clear"?f:P==="copy"?v:P==="_internal"?[s,t]:(r&&(t.has(P)||t.set(P,new Set),t.get(P).add(r)),P in s||I(P),s[P])},set(M,P,j){return s[P]===j||(P in w||(w[P]=s[P]),s[P]=j,i.has(P)&&(h(i.get(P)),i.delete(P)),u(P)),!0},deleteProperty(M,P){return delete s[P],t.delete(P),i.delete(P),!0}});return A}var Hf={A:7,C:6,H:1,L:2,M:2,Q:4,S:4,T:2,V:1,Z:0},jf=/[astvzqmhlc]([^astvzqmhlc]*)/ig,Uf=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function Tn(s){let e=[],t;for(let i of s.match(jf)||[]){let n=i[0].toUpperCase();if(n==="Z"){e.push({type:"Z",points:[]});continue}let r=(i.slice(1).match(Uf)||[]).map(a=>+a),o=n===i[0];for(let[a,h]of Vo(r,Hf[n]).entries()){let l=[],c=n==="M"&&a>0?"L":n,u;n==="H"?(c="L",l=[new p(h[0],o&&(t==null?void 0:t.y)||0)]):n==="V"?(c="L",l=[new p(o&&(t==null?void 0:t.x)||0,h[0])]):n==="A"?(c="A",l=[new p(h[5],h[6])],u=h.slice(0,5)):"MLCSQT".includes(n)&&(l=Vo(h,2).map(d=>new p(d[0],d[1]))),!o&&t&&(l=l.map(d=>d.translate(t))),t=O(l),e.push({type:c,points:l,options:u})}}return e}function oa(s){return s?Tn(s).map(t=>O(t.points)).filter(t=>!!t):[]}var Wf=["font-family","font-size","font-style","font-weight","letter-spacing","text-decoration","color","display","visibility","alignment-baseline","baseline-shift","opacity","text-anchor","clip","clip-path","clip-rule","mask","filter","transform","transform-origin","white-space","line-height"],Kf=["fill","fill-rule","marker","marker-start","marker-mid","marker-end","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-width","text-rendering","dominant-baseline","transform-box","paint-order"],Xf=["padding","min-width","max-width","height","border-width","border-style","border-color","box-sizing","background","width","grid-template-columns","text-align"],Yf=["class","tabindex","contenteditable"],Zf=new Set(["opacity","transform-box","transform-origin","border-width","border-style","border-color"]),Qf={"font-style":"normal","font-weight":"400","letter-spacing":"normal","text-decoration":"none",display:"block",visibility:"visible","alignment-baseline":"auto","baseline-shift":"0px","text-anchor":"start",clip:"auto","clip-path":"none","clip-rule":"nonzero",mask:"none",opacity:"1",filter:"none",fill:"rgb(0, 0, 0)","fill-rule":"nonzero",marker:"none",stroke:"none","stroke-dasharray":"none","stroke-dashoffset":"0px","stroke-linecap":"butt","stroke-linejoin":"miter","stroke-width":"1px","text-rendering":"auto",transform:"none","dominant-baseline":"auto","transform-origin":"0px 0px","transform-box":"view-box","paint-order":"normal"};function Vl(s){var e,t;if(s.getAttribute("hidden")||s.style.opacity==="0"||s.style.display==="none")(e=s.parentNode)==null||e.removeChild(s);else{for(let i of Array.from(s.children))Vl(i);if(s.tagName==="g"&&s.childElementCount===0)(t=s.parentNode)==null||t.removeChild(s);else for(let i of Yf)s.hasAttribute(i)&&s.removeAttribute(i)}}function Jf(s,e){let t=s.parentElement;for(;t;){let i=t.style.getPropertyValue(e);if(i)return i;t=t.parentElement}}function Il(s,e,t=!1){let i=window.getComputedStyle(s);e.removeAttribute("style");let n=t||s.tagName==="foreignObject",r=[...Wf,...n?Xf:Kf];for(let h of r){let l=i.getPropertyValue(h),c=Jf(e,h);l===Qf[h]&&!c||!Zf.has(h)&&l===c||e.style.setProperty(h,l)}let o=s.children,a=e.children;for(let h=0;hi.textContent=n(s)||"")}}else e&&i.bindModel(s)}}bindVariable(s,e){}toggleDOM(s=!0){s!==!!this._el.parentNode&&(this.$placeholder||(this.$placeholder=k(document.createComment("")),this.insertBefore(this.$placeholder)),s?this.$placeholder.insertBefore(this):this.detach())}makeDynamicAttribute(s,e,t){if(s.startsWith("@")){let i=s.slice(1),n=ct(e);this.on(i,r=>n(t,{$event:r}))}else if(s===":show"){let i=ct(e);t.watch(()=>this.toggle(!!i(t)))}else if(s===":if"){let i=ct(e);t.watch(()=>this.toggleDOM(!!i(t)))}else if(s===":html"){let i=ct(e);t.watch(()=>this.html=i(t)||"")}else if(s===":draw"){let i=ct(e);t.watch(()=>this.draw(i(t)))}else if(s===":class"){let i=ct(e),n=`${this.attr("class")} `;t.watch(()=>this.setAttr("class",n+i(t)))}else if(s===":bind")this.bindVariable(t,e);else if(s.startsWith(":")){let i=ct(e),n=s.slice(1);t.watch(()=>this.setAttr(n,i(t)))}else if(e.includes("${")){let i=bn(e,!0);t.watch(()=>this.setAttr(s,i(t)||""))}(s.startsWith("@")||s.startsWith(":"))&&this.removeAttr(s)}makeDynamicList(s){let[e,t]=this.attr(":for").split(" in ");this.removeAttr(":for");let i=ct(t),n=k(document.createComment(""));this.insertBefore(n),this.detach();let r=[],o=0;s.watch(()=>{let a=i(s);Array.isArray(a)||(a=[]);for(let h=a.length;h{let o=i+n*yt(t,r);this.scrollTop=o,this.trigger("scroll",{top:o})},e)}scrollBy(s,e=1e3,t="cubic"){s&&this.scrollTo(this.scrollTop+s,e,t)}css(s,e){if(e===void 0){if(typeof s=="string")return window.getComputedStyle(this._el).getPropertyValue(s);{let t=Object.keys(s);for(let i of t)this._el.style.setProperty(i,`${s[i]}`)}}else typeof s=="string"&&this._el.style.setProperty(s,`${e}`)}get transform(){return this.css("transform").replace("none","")}get transformMatrix(){let s=this.transform;if(!s)return[[1,0,0],[0,1,0]];let e=s.match(/matrix\(([0-9,.\s-]*)\)/);if(!e||!e[1])return[[1,0,0],[0,1,0]];let t=e[1].split(",");return[[+t[0],+t[2],+t[4]],[+t[1],+t[3],+t[5]]]}get scale(){let s=this.transformMatrix;return[s[0][0],s[1][1]]}setTransform(s,e=0,t=1){let i="";s&&(i+=`translate(${Pt(s.x,.1)}px,${Pt(s.y,.1)}px)`),e&&(i+=` rotate(${e}rad)`),t&&(i+=` scale(${t})`),this._el.style.transform=i}translate(s,e){this.setTransform(new p(s,e))}show(){this.hasAttr("hidden")&&this.removeAttr("hidden"),this.data.display==="visibility"?this._el.style.visibility="visible":this._el.style.display=this.data.display||"block"}hide(){this.data.display==="visibility"?this._el.style.visibility="hidden":this._el.style.display="none"}toggle(s){s?this.show():this.hide()}is(s){return this._el.matches?this._el.matches(s):Array.from(document.querySelectorAll(s)).includes(this._el)}index(){let s=0,e=this._el;for(;(e=e.previousSibling||void 0)!==void 0;)++s;return s}prepend(s){let e=this._el.childNodes;e.length?this._el.insertBefore(s._el,e[0]):this._el.appendChild(s._el)}append(s){this._el.appendChild(s instanceof Text?s:s._el)}insertBefore(s){this.parent._el.insertBefore(s._el,this._el)}insertAfter(s){let e=this._el.nextSibling;e?this.parent._el.insertBefore(s._el,e):this.parent._el.appendChild(s._el)}get next(){return k(this._el.nextSibling)}get prev(){return k(this._el.previousSibling)}$(s){return k(s,this)}$$(s){return Te(s,this)}get parent(){return k(this._el.parentElement||void 0)}parents(s){let e=[],t=this.parent;for(;t;)(!s||t.is(s))&&e.push(t),t=t.parent;return e}hasParent(...s){let e=s.map(i=>i._el),t=this._el.parentNode;for(;t;){if(_(t,...e))return!0;t=t.parentNode}return!1}get children(){return Array.from(this._el.children||[],s=>k(s))}get childNodes(){return Array.from(this._el.childNodes,s=>{if(!(s instanceof Comment))return s instanceof Text?s:k(s)}).filter(s=>s)}restartAnimation(){let s=this.next,e=this.parent;this.detach(),s?s.insertBefore(this):e.append(this)}detach(){this._el&&this._el.parentNode&&this._el.parentNode.removeChild(this._el)}remove(){this.detach()}removeChildren(){for(;this._el.firstChild;)this._el.removeChild(this._el.firstChild)}copy(s=!0){return k(this._el.cloneNode(s))}on(s,e,t){for(let i of K(s))i in this._events?this._events[i].includes(e)||this._events[i].push(e):this._events[i]=[e],_f(this,i,e,t)}one(s,e,t){let i=n=>{this.off(s,i),e(n)};this.on(s,i,t)}off(s,e){for(let t of K(s))t in this._events&&(this._events[t]=e?this._events[t].filter(i=>i!==e):[]),qf(this,t,e)}trigger(s,e={}){for(let t of K(s)){if(!this._events[t])return;for(let i of this._events[t])i.call(this,e)}}onKey(s,e,t){s=s.replace("AllArrows","ArrowUp ArrowDown ArrowLeft ArrowRight");let i=new Set(K(s)),n=t!=null&&t.up?"keyup":"keydown";(this._el===document.body?document:this._el).addEventListener(n,o=>{var a,h;let l=Ei(o);(t!=null&&t.meta?!o.ctrlKey&&!o.metaKey:o.ctrlKey||o.metaKey)||!l||!i.has(l)||document.activeElement!==this._el&&((h=(a=document.activeElement)==null?void 0:a.shadowRoot)==null?void 0:h.activeElement)!==this._el&&b.formIsActive||e(o,l)})}onAttr(s,e){new MutationObserver(i=>{for(let n of i)n.type==="attributes"&&n.attributeName===s&&e(this.attr(s))}).observe(this._el,{attributes:!0}),e(this.attr(s),!0)}onPromise(s,e=!1){return e?Promise.resolve():new Promise(t=>this.one(s,()=>t()))}animate(s,e=400,t=0,i="ease-in-out"){return Ht(this,s,e,t,i)}enter(s="fade",e=500,t=0){return Ef(this,s,e,t)}exit(s="fade",e=500,t=0,i=!1){return Mf(this,s,e,t,i)}effect(s){this.one("animationend",()=>this.removeClass(`effects-${s}`)),this.addClass(`effects-${s}`)}},us=class extends Ll{get offsetTop(){return this._el.offsetTop}get offsetLeft(){return this._el.offsetLeft}get offsetParent(){return k(this._el.offsetParent||void 0)}get width(){return this._el.offsetWidth}get height(){return this._el.offsetHeight}get innerWidth(){let s=parseFloat(this.css("padding-left")),e=parseFloat(this.css("padding-right"));return this._el.clientWidth-s-e}get innerHeight(){let s=parseFloat(this.css("padding-bottom")),e=parseFloat(this.css("padding-top"));return this._el.clientHeight-s-e}get outerWidth(){let s=parseFloat(this.css("margin-left")),e=parseFloat(this.css("margin-right"));return this.width+s+e||0}get outerHeight(){let s=parseFloat(this.css("margin-bottom")),e=parseFloat(this.css("margin-top"));return this.height+s+e||0}get positionTop(){let s=this._el,e=0;for(;s;)e+=s.offsetTop,s=s.offsetParent;return e}get positionLeft(){let s=this._el,e=0;for(;s;)e+=s.offsetLeft,s=s.offsetParent;return e}offset(s){if(s._el===this._el.offsetParent){let e=this.offsetTop+s._el.clientTop,t=this.offsetLeft+s._el.clientLeft,i=e+this.height,n=t+this.width;return{top:e,left:t,bottom:i,right:n}}else{let e=s._el.getBoundingClientRect(),t=this._el.getBoundingClientRect();return{top:t.top-e.top,left:t.left-e.left,bottom:t.bottom-e.top,right:t.right-e.left}}}},Ol=class extends Ll{constructor(){super(...arguments),this.type="svg"}get $ownerSVG(){return k(this._el.ownerSVGElement||void 0)}get width(){return this.bounds.width}get height(){return this.bounds.height}get positionLeft(){let s=this._el.getBBox().x+this._el.getCTM().e;return this.$ownerSVG.positionLeft+s}get positionTop(){let s=this._el.getBBox().y+this._el.getCTM().f;return this.$ownerSVG.positionTop+s}get inverseTransformMatrix(){let s=this._el.getScreenCTM().inverse(),e=[[s.a,s.c,s.e],[s.b,s.d,s.f]];if(b.isFirefox){let t=this.transformMatrix;e[0][2]-=t[0][2],e[1][2]-=t[1][2]}return e}setTransform(s,e=0,t=1){let i=s?`translate(${Pt(s.x,.1)} ${Pt(s.y,.1)})`:"",n=x(e,0)?"":`rotate(${e*180/Math.PI})`,r=x(t,1)?"":`scale(${t})`;this.setAttr("transform",[i,n,r].join(" "))}get strokeLength(){if(this._el instanceof SVGGeometryElement)return this._el.getTotalLength();{let s=this.bounds;return 2*s.height+2*s.width}}getPointAtLength(s){if(this._el instanceof SVGGeometryElement){let e=this._el.getPointAtLength(s);return new p(e.x,e.y)}else return new p(0,0)}getPointAt(s){return this.getPointAtLength(s*this.strokeLength)}get points(){return oa(this.attr("d"))}set points(s){let e=s.length?`M${s.map(t=>`${t.x},${t.y}`).join("L")}`:"";this.setAttr("d",e)}addPoint(s){let e=`${this.attr("d")} L ${s.x},${s.y}`;this.setAttr("d",e)}get center(){let s=+this.attr(this.tagName==="TEXT"?"x":"cx"),e=+this.attr(this.tagName==="TEXT"?"y":"cy");return new p(s,e)}setCenter(s){this.setAttr(this.tagName==="TEXT"?"x":"cx",s.x),this.setAttr(this.tagName==="TEXT"?"y":"cy",s.y)}setLine(s,e){this.setAttr("x1",s.x),this.setAttr("y1",s.y),this.setAttr("x2",e.x),this.setAttr("y2",e.y)}setRect(s){this.setAttr("x",s.p.x),this.setAttr("y",s.p.y),this.setAttr("width",s.w),this.setAttr("height",s.h)}draw(s,e={}){if(!s)return this.setAttr("d","");let t={};for(let i of["mark","arrows","round"])this.hasAttr(i)&&(t[i]=this.attr(i));this.hasClass("fill")&&(t.fill="fill"),this.hasAttr("size")&&(t.size=+this.attr("size")||void 0),this.setAttr("d",De(s,Object.assign(e,t)))}},tm=class extends Ol{get viewBox(){return this._el.viewBox.baseVal||{width:0,height:0}}get $ownerSVG(){return this}get positionLeft(){return parseInt(this.css("margin-left"))+this.parent.positionLeft}get positionTop(){return parseInt(this.css("margin-top"))+this.parent.positionTop}get svgWidth(){return this.viewBox.width||this.width}get svgHeight(){return this.viewBox.height||this.height}drawPath(s,e={},t={}){let i=m("path",e,this);return i.draw(s,t),i}image(s,e,t,i){return he(this,null,function*(){let n=this.copy(!0);Il(this._el,n._el),s==="svg"&&Vl(n._el),t||(t=e||this.svgHeight),e||(e=this.svgWidth),n.setAttr("width",e),n.setAttr("height",t),n.setAttr("viewBox",i||this.attr("viewBox")||`0 0 ${this.svgWidth} ${this.svgHeight}`),n.setAttr("xmlns","http://www.w3.org/2000/svg");let r=n.$$("image");if(s==="svg")for(let c of r)c.setAttr("href",new URL(c.attr("href"),location.href));else yield Promise.all(r.map(c=>he(this,null,function*(){c.setAttr("href",yield om(c.attr("href")))})));let o=new XMLSerializer().serializeToString(n._el),a=`data:image/svg+xml;utf8,${encodeURIComponent(o)}`;if(s==="svg")return a;let h=m("canvas",{width:e,height:t});s==="jpg"&&(h.ctx.fillStyle="white",h.ctx.fillRect(0,0,e,t));let l=yield Gl(a);return h.ctx.drawImage(l,0,0,e,t),h.image(s)})}downloadImage(s,e,t,i){let n=b.isIOS?window.open("","_blank"):void 0,r=b.theme.isDark;r&&b.setTheme("light");let o=s.endsWith(".jpg")?"jpg":s.endsWith(".svg")?"svg":"png",a=this.image(o,e,t,i);r&&b.setTheme("dark"),a.then(h=>{if(n)return n.location.href=h;m("a",{download:s,href:h,target:"_blank"})._el.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0}))})}},Rl=class extends us{constructor(){super(...arguments),this.type="window"}get width(){return window.innerWidth}get height(){return window.innerHeight}get innerWidth(){return window.innerWidth}get innerHeight(){return window.innerHeight}get outerWidth(){return window.outerWidth}get outerHeight(){return window.outerHeight}get scrollWidth(){return document.body.scrollWidth}get scrollHeight(){return document.body.scrollHeight}get scrollTop(){return window.pageYOffset}set scrollTop(s){document.body.scrollTop=document.documentElement.scrollTop=s,this.trigger("scroll",{top:s,left:this.scrollLeft})}get scrollLeft(){return window.pageXOffset}set scrollLeft(s){document.body.scrollLeft=document.documentElement.scrollLeft=s,this.trigger("scroll",{top:this.scrollTop,left:s})}},em=class extends us{constructor(){super(...arguments),this.type="form"}get action(){return this._el.action}get formData(){let s={};for(let e of Array.from(this._el.elements)){let t=e.name||e.id;t&&(s[t]=e.value)}return s}get isValid(){return this._el.checkValidity()}},sm=class extends us{constructor(){super(...arguments),this.type="input"}get checked(){return this._el.checked||!1}set checked(s){this._el.checked=s}get value(){return this._el.value}set value(s){this._el.value=s}bindVariable(s,e){if(this._el.type==="checkbox"){let t=e.startsWith("!"),i=n=>t?!n:n;t&&(e=e.slice(1)),s[e]!==void 0?this.checked=i(s[e]):this.hasAttr("checked")&&(s[e]=i(this.checked)),this.on("change",()=>s[e]=i(this.checked)),s.watch(()=>this.checked=i(s[e]));return}if(this._el.type==="number"){let t=this.hasAttr("min")?+this.attr("min"):-1/0,i=this.hasAttr("max")?+this.attr("max"):1/0;this.change(n=>{n&&(s[e]=B(+n,t,i))})}else this.change(t=>s[e]=t);s[e]!==void 0?this.value=s[e]:this.value&&(s[e]=this.value),this.on("blur",()=>this.value=s[e]),s.watch(()=>{document.activeElement!==this._el&&(this.value=s[e])})}setInputPattern(s){if(isNaN(+s))return;let e=s.match(/^[0-9]+$/);this.setAttr("inputmode",e?"numeric":"decimal"),e&&this.setAttr("pattern","[0-9]*")}change(s){let e=this.value||"";this.on("focus",()=>e=this.value),this.on("change keyup input paste",()=>{this.value!==e&&(e=this.value,s(e))})}validate(s){this.change(e=>this.setValidity(s(e)))}setValidity(s){this._el.setCustomValidity(s)}get isValid(){return this._el.checkValidity()}},im=class extends us{constructor(){super(...arguments),this.type="canvas"}getContext(s="2d",e={}){return this._el.getContext(s,e)}image(s="png"){return this._el.toDataURL(s==="png"?"image/png":"image/jpeg")}get canvasWidth(){return this._el.width}get canvasHeight(){return this._el.height}get ctx(){return this._ctx||(this._ctx=this.getContext()),this._ctx}draw(s,e={}){this.ctx.save(),Jo(this.ctx,s,e),this.ctx.restore()}clear(){this.ctx.clearRect(0,0,this.canvasWidth,this.canvasHeight)}fill(s){this.ctx.save(),this.ctx.fillStyle=s,this.ctx.fillRect(0,0,this.canvasWidth,this.canvasHeight),this.ctx.restore()}clearCircle(s,e){this.ctx.save(),this.ctx.globalCompositeOperation="destination-out",this.ctx.beginPath(),this.ctx.arc(s.x,s.y,e,0,2*Math.PI,!1),this.ctx.fill(),this.ctx.restore()}downloadImage(s){let e=this.image(s.endsWith(".jpg")?"jpg":"png");m("a",{download:s,href:e,target:"_blank"})._el.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0}))}},nm=class extends us{play(){return this._el.play()||Promise.resolve()}pause(){return this._el.pause()}},Dl=["path","rect","circle","ellipse","polygon","polyline","g","defs","marker","line","text","tspan","pattern","mask","svg","foreignObject","image","use","clipPath"];function k(s,e){if(!s)return;let t=e?e._el:document.documentElement,i=typeof s=="string"?t.querySelector(s):s;if(!i)return;if(i._view)return i._view;let n=(i.tagName||"").toLowerCase();return n==="svg"?new tm(i):n==="canvas"?new im(i):n==="form"?new em(i):n==="input"||n==="select"||n==="textarea"?new sm(i):n==="video"||n==="audio"?new nm(i):Dl.includes(n)?new Ol(i):new us(i)}function Te(s,e){let t=e?e._el:document.documentElement,i=s?t.querySelectorAll(s):[];return Array.from(i,n=>k(n))}function m(s,e={},t){let i=Dl.includes(s)?document.createElementNS("http://www.w3.org/2000/svg",s):document.createElement(s);for(let[r,o]of Object.entries(e))o!==void 0&&(r==="id"?i.id=o:r==="html"?i.innerHTML=o:r==="text"?i.textContent=o:r==="path"?i.setAttribute("d",De(o)):i.setAttribute(r,o));let n=k(i);return t&&t.append(n),n}var C=new Rl(document.body),Xt=new Rl(document.documentElement);function rm(s){let e=[];for(let t of Object.keys(s)){let i=s[t];if(t=encodeURIComponent(t),i==null){e.push(t);continue}i=Array.isArray(i)?i.join(","):`${i}`,i=i.replace(/(\r)?\n/g,`\r -`),i=encodeURIComponent(i),i=i.replace(/%20/g,"+"),e.push(`${t}=${i}`)}return e.join("&")}function Nl(s){s=s.replace(/^[?,&]/,"");let e=decodeURIComponent(s).split("&"),t={};return e.forEach(i=>{let n=i.split("=");t[n[0]]=n[1]}),t}function Ne(s,e){return he(this,null,function*(){let t=e instanceof FormData,i={method:"POST",body:t?e:e?rm(e):void 0,headers:{"X-CSRF-Token":window.csrfToken||""}};t||(i.headers["Content-Type"]="application/x-www-form-urlencoded");let n=s.includes("?")?"&xhr=1":"?xhr=1",r=yield fetch(s+n,i);if(!r.ok)throw new Error(`Fetch error ${r.status}: ${s}`);return r.text()})}function Gl(s,e=!1){return new Promise(t=>{let i=new Image;e||(i.crossOrigin="Anonymous"),i.onload=()=>t(i),i.src=s})}var om=Oe(s=>he(void 0,null,function*(){let e=yield Gl(s),t=m("canvas",{width:e.width,height:e.height});return t.ctx.drawImage(e,0,0,e.width,e.height),t.image("png")})),Si=new Map;function zl(s,e){Si.has(s)?Ao(Si.get(s),e,(t,i)=>Wt(t.concat(i))):Si.set(s,e)}function Bl(){if(window.navigator.onLine)for(let[s,e]of Si)Si.delete(s),Ne(s,{data:JSON.stringify(e)}).catch(t=>{console.error("Failed to send POST request:",t),zl(s,e)})}var _l=ve(Bl,5e3);window.addEventListener("online",_l);window.onbeforeunload=Bl;function ql(s,e){zl(s,e),_l()}var ee=class{constructor(s,e=1,t=!0){this.src=s,this.defaultVolume=e,this.player=new Audio,this.player.src=s,t&&(this.player.preload="auto")}play(s){this.player.currentTime=0,this.player.volume=s||this.defaultVolume,this.player.play()}},am=os(["#cd0e66","#0f82f2","#22ab24","#fd8c00"]),hm=class{constructor(s){this.index=s,this.color=am(),this.tilt=Math.floor(Math.random()*10)-10,this.tiltAngleIncrement=Math.random()*.07+.05,this.tiltAngle=0,this.x=Math.random()*b.width,this.y=(Math.random()-1)*b.height,this.r=_t.uniform(10,30)}draw(s){s.beginPath(),s.lineWidth=this.r/2,s.strokeStyle=this.color,s.moveTo(this.x+this.tilt+this.r/4,this.y),s.lineTo(this.x+this.tilt,this.y+this.tilt+this.r/4),s.stroke()}update(s,e){this.tiltAngle+=this.tiltAngleIncrement,this.y+=(Math.cos(s)+3+this.r/2)/2,this.x+=Math.sin(s),this.tilt=Math.sin(this.tiltAngle-this.index/3)*15,this.x<-20?(this.x=-20,this.y=Math.random()*b.height,this.tilt=Math.floor(Math.random()*10)-20):this.x>b.width+20?(this.x=b.width+20,this.y=Math.random()*b.height,this.tilt=Math.floor(Math.random()*10)-20):e&&this.y>b.height&&(this.x=Math.random()*b.width,this.y=-10,this.tilt=Math.floor(Math.random()*10)-20)}},lm="position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 9999",cs=void 0;function Mi(s=2e3,e=150){cs||(cs=m("canvas",{style:lm},C)),cs.setAttr("width",b.width),cs.setAttr("height",b.height),cs.show();let t=cs.ctx,i=z(r=>new hm(r),e),n=pt(r=>{t.clearRect(0,0,b.width,b.height);let o=rthis.updateBounds()),ds(s,{start:()=>{this.disabled||(this.startPos=this.position,this.trigger("start"),Xt.addClass("grabbing"))},move:(t,i)=>{this.disabled||(this.setPosition(this.startPos.x+t.x-i.x,this.startPos.y+t.y-i.y),this.trigger("drag",{posn:this.position,pointerPosn:t}),this.checkTarget(t))},end:(t,i)=>{this.disabled||(this.trigger(t.equals(i)?"click":"end",{$target:this.$over}),this.options.$targets&&!this.$over&&this.options.resetOnMiss&&this.resetPosition(),this.$over=void 0,Xt.removeClass("grabbing"))},click:()=>this.trigger("click"),accessible:!0})}addTarget(s){var e;this.options.$targets||(this.options.$targets=[]),(e=this.options.$targets)==null||e.push(s)}removeTarget(s){var e,t;this.options.$targets=(e=this.options.$targets)==null?void 0:e.filter(i=>i!==s),(t=this.options.$targets)!=null&&t.length||(this.options.$targets=void 0)}checkTarget(s){if(!this.options.$targets)return;let e=this.options.$targets.find(t=>t.boundsRect.contains(s));e!==this.$over&&(this.$over&&this.trigger("exit-target",{$target:this.$over}),e&&this.trigger("enter-target",{$target:e}),this.$over=e)}updateBounds(){if(!this.options.withinBounds)return this.bounds=void 0;if(this.options.bounds)return this.bounds=this.options.bounds;let s=this.bounds,e=this.options.$parent||this.$el.parent,t=e.type==="svg"?e.svgWidth:e.width,i=e.type==="svg"?e.svgHeight:e.height;this.bounds=new lt(0,t,0,i),!t&&!i&&setTimeout(()=>this.updateBounds()),s&&this.setPosition(this.position.x*this.bounds.dx/s.dx||0,this.position.y*this.bounds.dy/s.dy||0)}setPosition(s,e){var t;let i=new p(this.options.moveX?s:0,this.options.moveY?e:0);this.bounds&&(i=i.clamp(this.bounds,(t=this.options.margin)!=null?t:0)),i=i.round(this.options.snap||1),this.options.round&&(i=this.options.round(i)),!i.equals(this.position)&&(this.position=i,this.options.useTransform?this.$el.translate(i.x,i.y):(this.options.moveX&&this.$el.css("left",`${i.x}px`),this.options.moveY&&this.$el.css("top",`${i.y}px`)),this.trigger("move",{posn:i}))}resetPosition(s=250){return he(this,null,function*(){let e=this.position;this.$el.css({"pointer-events":"none"}),yield pt(t=>{let i=p.interpolate(e,this.startPos,t);this.setPosition(i.x,i.y)},s).promise,this.$el.css({"pointer-events":"initial"})})}},cm="position: fixed; top: 0; left: 0; width: 100%; height: 4px; background: #0f82f2; pointer-events: none; z-index: 9999; will-change: transform;";function Sl(s,e){let t=e.regex.exec(s);if(t){t.shift();let i={};for(let[n,r]of e.params.entries())i[r]=t[n];return i}else return}function pm(s,e,t){return he(this,null,function*(){return s.template?typeof s.template=="string"?s.template:s.template(e):(yield fetch(t+(t.indexOf("?")>=0?"&xhr=1":"?xhr=1"))).text()})}var Fl=document.readyState==="complete";window.addEventListener("load",()=>setTimeout(()=>Fl=!0));"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual");var dm=class extends Re{constructor(){super(...arguments),this.$viewport=C,this.views=[],this.active={path:"",hash:""},this.preloaded=!1,this.transition=!1,this.noLoad=!1,this.initialise=()=>{}}setup(s={}){s.$viewport&&(this.$viewport=s.$viewport),s.initialise&&(this.initialise=s.initialise),s.preloaded&&(this.preloaded=s.preloaded),s.transition&&(this.transition=s.transition),s.noLoad&&(this.noLoad=s.noLoad),s.click&&C.on("click",e=>this.onLinkClick(e)),s.history&&window.addEventListener("popstate",e=>he(this,null,function*(){var t;if(!Fl||!((t=e.state)!=null&&t.path))return;(yield this.load(e.state.path,e.state.hash))||window.history.pushState(this.active,"",this.active.path+this.active.hash)}))}view(s,{enter:e,exit:t,template:i}={}){let n=(s.match(/:\w+/g)||[]).map(u=>u.substr(1)),r=`${s.replace(/:\w+/g,"([\\w-]+)").replace("/","\\/")}\\/?`,o=s.includes("?")?"":"(\\?.*)?",h={regex:new RegExp(`^${r}${o}$`,"i"),params:n,enter:e,exit:t,template:i};this.views.push(h);let l=window.location.pathname+window.location.search,c=Sl(l,h);c&&(this.active={path:l,hash:window.location.hash},window.history.replaceState(this.active,"",this.active.path+this.active.hash),b.ready(()=>{setTimeout(()=>{this.preloaded?(this.initialise(this.$viewport,c),h.enter&&h.enter(this.$viewport,c)):this.loadView(h,c)})}))}paths(...s){for(let e of s)this.view(e)}getView(s){for(let e of this.views){let t=Sl(s,e);if(t)return{view:e,params:t}}}load(s,e){return he(this,null,function*(){if(s===this.active.path&&e!==this.active.hash)return this.trigger("hashChange",e.slice(1)),this.trigger("change",s+e),this.active={path:s,hash:e},!0;let t=this.getView(s);return!t||this.beforeChange&&!(yield this.beforeChange())?!1:(this.active={path:s,hash:e},this.trigger("change",s+e),window.ga&&window.ga("send","pageview",s+e),this.noLoad?t.view.enter&&t.view.enter(this.$viewport,t.params):this.loadView(t.view,t.params),!0)})}loadView(s){return he(this,arguments,function*(e,t={}){this.showLoadingBar();let i=this.active.path,n=yield pm(e,t,i);if(this.active.path!==i)return;yield this.$viewport.animate({opacity:0},200).promise,this.$viewport.removeChildren(),C.scrollTop=0,this.$viewport.html=n,b.resize(),xf(),this.$viewport.animate({opacity:1},200),this.hideLoadingBar();let r=this.$viewport.$("title");r&&(document.title=r.text),this.initialise(this.$viewport,t),e.enter&&e.enter(this.$viewport,t),this.trigger("afterChange",{$viewport:this.$viewport})})}onLinkClick(s){if(s.metaKey||s.ctrlKey||s.shiftKey||s.defaultPrevented)return;let e=s.target;for(;e&&e.nodeName!=="A";)e=e.parentNode;if(!e||e.nodeName!=="A")return;let t=e;if(t.target||t.origin!==window.location.origin||t.hasAttribute("download")||t.getAttribute("rel")==="external")return;let i=t.getAttribute("href");i&&i.indexOf("mailto:")>-1||this.getView(t.pathname+t.search)&&(s.preventDefault(),this.goTo(t.pathname+t.search,t.hash))}goTo(s,e=""){return he(this,null,function*(){let t=this.active.path+this.active.hash;(yield this.load(s,e))&&t!==this.active.path+this.active.hash&&window.history.pushState(this.active,"",s+e)})}replace(s,e=""){this.active={path:s,hash:e},window.history.replaceState(this.active,"",s+e)}back(){window.history.back()}forward(){window.history.forward()}showLoadingBar(){this.$loadingBar||(this.$loadingBar=m("div",{style:cm},C)),this.$loadingBar.css({transform:"translateX(-100%)",opacity:1}),this.$loadingBar.show(),this.animation=pt(s=>{this.$loadingBar.css("transform",`translateX(-${10+90*Math.exp(-4*s)}%)`)},3e3)}hideLoadingBar(){return he(this,null,function*(){var s,e,t;(s=this.animation)==null||s.cancel(),yield(e=this.$loadingBar)==null?void 0:e.animate({transform:"none",opacity:0}).promise,(t=this.$loadingBar)==null||t.hide()})}},Ci=new dm;function um(s,e){let t=Array.from(s.childNodes);s.innerHTML=e;let i={};for(let n of Array.from(s.querySelectorAll("slot")))i[n.getAttribute("name")||""]=n;for(let n of t){let r=n.getAttribute&&n.getAttribute("slot")||"",o=i[r]||i[""];o&&o.parentNode.insertBefore(n,o)}for(let n of Object.values(i))n.parentNode.removeChild(n)}function*Hl(s){for(let e of Array.from(s.children))e.tagName.includes("-")?yield e:yield*ks(uf(Hl(e)))}var jl=new Map,fm=class extends HTMLElement{constructor(){super(...arguments),this.wasConnected=!1,this.isReady=!1}connectedCallback(){return he(this,null,function*(){if(this.wasConnected){this._view.trigger("connected");return}this.wasConnected=!0,this.isReady=!1,this._view.created();let s=jl.get(this._view.tagName)||{};s.template&&um(this,s.template);let e=[...Hl(this)].filter(t=>!t.isReady).map(t=>new Promise(i=>t.addEventListener("ready",i)));setTimeout(()=>{this.isReady||console.error(`Children of custom element ${this.tagName} not ready after 1s.`)},1e3),yield Promise.all(e),this._view.ready(),this.dispatchEvent(new CustomEvent("ready")),this.isReady=!0})}disconnectedCallback(){this._view.trigger("disconnected")}},E=class extends us{created(){}ready(){}},mm=new Map;function S(s,e={}){return function(t){if(window.customElements.get(s)){console.warn(`Trying to declare the custom element ${s} twice!`);return}class i extends fm{constructor(){super(),this._view=new t(this)}}mm.set(s,t),jl.set(s.toUpperCase(),e),window.customElements.define(s,i)}}var Sn=class{constructor(e){this.clipEndTime=0;this.player=new Audio(e),this.player.preload="true",this.player.addEventListener("timeupdate",()=>{this.player.currentTime>=this.clipEndTime&&this.triggerCallback(!0)}),window.addEventListener("beforeunload",()=>this.player.pause())}playClip(e,t,i){this.triggerCallback(!1),this.player.currentTime=e,this.clipEndTime=t,this.clipCallback=i,this.player.play()}triggerCallback(e){if(!this.clipCallback)return;let t=this.clipCallback;this.clipCallback=void 0,this.player.pause(),t({ended:e})}pause(){this.triggerCallback(!1)}get isPlaying(){return!!this.clipCallback}},ha=!1,aa,En=class{constructor(e,t){this.audio=e;this.paragraphs=[];this.paragraphs=t.$$(".voice").map(i=>new la(i,e));for(let[i,n]of this.paragraphs.entries())n.on("end",()=>{var r;if(this.paragraphs[i+1])this.paragraphs[i+1].play();else{let o=t.nextStep;o&&o.isShown&&((r=o.narration)==null||r.play())}})}play(){var e;this.audio.isPlaying||!ha||(e=this.paragraphs[0])==null||e.play()}},la=class extends Re{constructor(t,i){super();this.$p=t;this.audio=i;this.playing=void 0;this.sentences=t.$$(".sentence[data-timings]").map(n=>new ca(n,i)),this.$button=m("button",{class:"playback-btn",title:"Play Narration"}),this.$button.on("click",()=>{this.playing?this.audio.pause():this.play(),ha=!ha,aa=void 0}),t.prepend(this.$button),t.addClass("sentence-wrap");for(let[n,r]of this.sentences.entries())r.on("end",o=>{this.playing=void 0,o&&this.sentences[n+1]?setTimeout(()=>this.play(this.sentences[n+1]),200):(this.$button.removeClass("active"),o&&setTimeout(()=>this.trigger("end"),400))})}play(t){let i=t||this.sentences[0],n=i.$reveal;if(n&&n.css("visibility")==="hidden"){this.$button.removeClass("active"),aa=n,n.one("reveal",()=>{aa===n&&!this.audio.isPlaying&&this.play(i)});return}this.playing=i,this.playing.play(),this.$button.addClass("active");let r=this.$p.parents("x-tabbox .tab")[0];if(r){let h=r.parents("x-tabbox")[0];h.makeActive(r.index());let l=h.active;h.one("change",c=>{this.playing&&c!==l&&this.audio.pause()})}let o=this.$p.bounds,a=o.top+o.height-b.height+20;a>0&&C.scrollBy(a+100),setTimeout(()=>this.$button.focus(),800)}},ca=class extends Re{constructor(t,i){super();this.$el=t;this.audio=i;let n=t.attr("data-timings").split("-");this.start=+n[0]/1e3,this.end=(+n[1]-200)/1e3}play(){this.$el.addClass("playing"),this.audio.playClip(this.start,this.end,({ended:t})=>{this.$el.removeClass("playing"),this.trigger("end",t)})}get $reveal(){return this.$el.parents(".reveal")[0]}};var gm=Object.defineProperty,vm=Object.getOwnPropertyDescriptor,Ai=(s,e,t,i)=>{for(var n=i>1?void 0:i?vm(e,t):e,r=s.length-1,o;r>=0;r--)(o=s[r])&&(n=(i?o(e,t,n):o(n))||n);return i&&n&&gm(e,t,n),n},Ul=(s,e,t)=>new Promise((i,n)=>{var r=h=>{try{a(t.next(h))}catch(l){n(l)}},o=h=>{try{a(t.throw(h))}catch(l){n(l)}},a=h=>h.done?i(h.value):Promise.resolve(h.value).then(r,o);a((t=t.apply(s,e)).next())}),_s,wm=m("div",{class:"snackbar"},C),Wl=class extends E{ready(){var s;wm.append(this),(s=this.$("button"))==null||s.on("click",()=>this.close())}open(s=2e3){return Ul(this,null,function*(){_s!==this&&(_s&&(yield _s.close()),_s=this,yield this.enter("pop",300).promise,this.setAttr("role","alert"),s&&setTimeout(()=>this.close(),s))})}close(){return Ul(this,null,function*(){_s===this&&(_s=void 0,this.removeAttr("role"),yield this.exit("pop",300).promise)})}};Wl=Ai([S("x-alert")],Wl);var Kl=class extends E{ready(){if(this.children.length)return;let s=m("svg",{viewBox:"0 0 24 24",alt:"",role:"presentation"},this),e=m("use",{},s),t=+this.attr("size")||24;for(let i of[this,s])i.css({width:`${t}px`,height:`${t}px`});this.onAttr("name",i=>e.setAttr("href",`/icons.13d4c88a.svg#${i}`))}};Kl=Ai([S("x-icon")],Kl);var ms=m("div",{class:"modal-background"},C),pa,Se=void 0,da=void 0;function ua(){Se&&Se.canClose&&Se.close()}ms.on("click",ua);C.onKey("Escape",ua);Ci.on("change",ua);ms.on("scrollwheel touchmove",s=>{s.preventDefault(),s.stopPropagation()});C.onKey("Space ArrowUp ArrowDown PageDown PageUp",s=>{Se&&(s.preventDefault(),s.stopPropagation())});var Xl=class extends E{constructor(){super(...arguments),this.isOpen=!1,this.canClose=!0}ready(){this.canClose=!this.hasAttr("no-close"),this.$iframe=this.$("iframe[data-src]"),this.$video=this.$("video");let s=Te(`[data-modal=${this.id}]`);for(let t of s)t.on("click",()=>this.open());Ci.on("afterChange",({$viewport:t})=>{let i=t.$$(`[data-modal=${this.id}]`);for(let n of i)n.on("click",()=>this.open())}),(this.hasClass("open")||b.getHash()===this.id)&&!Se&&this.open(!0),this.$("input")&&this.addClass("interactive");let e=this.$(".close");e&&e.on("click",()=>this.close());for(let t of this.$$(".btn"))t.on("click",()=>this.trigger("btn-click",t))}open(s=!1){var e,t;if(this.isOpen)return;ms.setClass("light",this.hasClass("light")),Se?Se.close(!0):s?ms.show():ms.css("display")==="block"?pa==null||pa.cancel():ms.enter("fade",250),this.isOpen=!0,Se=this,this.$iframe&&this.$iframe.setAttr("src",this.$iframe.data.src),this.$video&&this.$video.play(),s?this.show():this.enter("pop",250).promise.then(()=>this.css("transform","")),this.setAttr("role","dialog"),this.trigger("open"),da=document.activeElement;let i=this.$('input, a, button, textarea, [tabindex="0"]');i&&i.focus(),(e=window.ga)==null||e.call(window,"send","event","Modal",this.id),(t=window.gtag)==null||t.call(window,"event","modal",{action:this.id})}close(s=!1,e=!1){this.isOpen&&(this.isOpen=!1,this.removeAttr("role"),Se=void 0,this.$iframe&&this.$iframe.setAttr("src",""),this.$video&&this.$video.pause(),s||(pa=ms.exit("fade",250)),this.exit("pop",250).promise.then(()=>this.css("transform","")),e||this.trigger("close"),da&&da.focus())}getOpenModal(){return Se}};Xl=Ai([S("x-modal")],Xl);var Yl=class extends E{constructor(){super(...arguments),this.isOpen=!1}ready(){this.animation=this.attr("animation")||"pop",this.$bubble=this.$(".popup-body"),this.$bubble.hide(),this.$(".popup-target").on("click",()=>this.toggleOpen()),this.on("clickOutside",()=>this.close());for(let e of this.$bubble.$$("a"))e.on("click",()=>this.close());C.onKey("Escape",()=>this.close())}toggleOpen(){this.isOpen?this.close():this.open()}open(){this.isOpen||(this.isOpen=!0,this.addClass("active"),this.$bubble.enter(this.animation,150),this.$bubble.setAttr("role","dialog"),this.$bubble.focus(),this.trigger("open"))}close(){this.isOpen&&(this.isOpen=!1,this.removeClass("active"),this.$bubble.exit(this.animation,150),this.$bubble.removeAttr("role"),this.trigger("close"))}};Yl=Ai([S("x-popup")],Yl);var Zl=class extends E{constructor(){super(...arguments),this.$options={}}ready(){let s=this.children;this.$active=this.$(".active")||s[0],this.$active.addClass("active");for(let[e,t]of s.entries())!_(t.tagName,"A","BUTTON")&&!t.hasAttr("tabindex")&&t.setAttr("tabindex",0),t.on("click",()=>this.makeActive(t)),this.$options[t.attr("value")||e]=t;this.trigger("change",this.$active)}makeActive(s){s!==this.$active&&(this.$active.removeClass("active"),this.$active=s,s.addClass("active"),this.trigger("change",s))}bindVariable(s,e){s[e]===void 0&&(s[e]=this.$active.attr("value")),this.on("change",t=>s[e]=t.attr("value")),s.watch(()=>{let t=this.$options[s[e]];t&&this.makeActive(t)})}};Zl=Ai([S("x-select")],Zl);var fa=12;function ym(s){return`M${s},${s/2}a${s/2},${s/2},0,0,1,0,${s}A${s/2},${s/2},0,0,1,${s},${s/2}`}function bm(s){return`M ${s},0 C ${s/2},0,0,${s/2},0,${s} s ${s/2},${s},${s},${s} s ${s}-${s/2},${s}-${s} S ${s*1.5},0,${s},0 z M ${s*44.6/50},${s*76.1/50} L ${s*19.2/50},${s*48.8/50} l ${s*4/50}-${s*4.2/50} l ${s*19.8/50},${s*11.9/50} l ${s*34.2/50}-${s*32.6/50} l ${s*3.5/50},${s*3.5/50} L ${s*44.6/50},${s*76.1/50} z`}var Mn=class extends E{constructor(){super(...arguments);this.completed=!1}ready(){this.r=+this.attr("r")||10,this.r1=this.r+fa,this.$svg=m("svg",{width:2*this.r1,height:2*this.r1},this),this.$progress=m("path",{class:"pie",d:ym(this.r),"stroke-width":this.r},this.$svg),this.onAttr("p",t=>this.setProgress(+t,!1))}setProgress(t,i=!0){if(t>.99)return this.complete(i);let n=Math.PI*this.r;this.$progress.css("stroke",t?"currentColor":"none"),this.$progress.css("stroke-dasharray",`${t*n} ${n}`)}complete(t=!0){if(this.completed||(this.completed=!0,this.$progress.css("stroke","none"),this.$progress.css("fill","currentColor"),this.$progress.setAttr("d",bm(this.r)),!t))return;let i=`translate(${this.r1} ${this.r1})`,n=m("g",{transform:i},this.$svg),r=z(()=>m("line",{},n),18);pt(o=>{let a=this.r+fa*yt("quint-out",o),h=this.r+fa*o;for(let l=0;l<18;++l){let c=Math.cos(Math.PI*2*l/18),u=Math.sin(Math.PI*2*l/18);r[l].setLine({x:c*a,y:u*a},{x:c*h,y:u*h})}},800).promise.then(()=>n.remove())}};Mn=T([S("x-progress")],Mn);var Ql="2.4.1",ma="i5iSjo",Jl="_av",ga="_au",va="(not set)";var Cn=[],se=class{static add(e,t,i){tc(e,t).add(i)}static remove(e,t,i){tc(e,t).remove(i)}constructor(e,t){this.context=e,this.methodName=t,this.isTask=/Task$/.test(t),this.originalMethodReference=this.isTask?e.get(t):e[t],this.methodChain=[],this.boundMethodChain=[],this.wrappedMethod=(...i)=>{let n=this.boundMethodChain[this.boundMethodChain.length-1];return n(...i)},this.isTask?e.set(t,this.wrappedMethod):e[t]=this.wrappedMethod}add(e){this.methodChain.push(e),this.rebindMethodChain()}remove(e){let t=this.methodChain.indexOf(e);t>-1&&(this.methodChain.splice(t,1),this.methodChain.length>0?this.rebindMethodChain():this.destroy())}rebindMethodChain(){this.boundMethodChain=[];for(let e,t=0;e=this.methodChain[t];t++){let i=this.boundMethodChain[t-1]||this.originalMethodReference.bind(this.context);this.boundMethodChain.push(e(i))}}destroy(){let e=Cn.indexOf(this);e>-1&&(Cn.splice(e,1),this.isTask?this.context.set(this.methodName,this.originalMethodReference):this.context[this.methodName]=this.originalMethodReference)}};function tc(s,e){let t=Cn.filter(i=>i.context==s&&i.methodName==e)[0];return t||(t=new se(s,e),Cn.push(t)),t}var qs=window.Element.prototype,Bw=qs.matches||qs.matchesSelector||qs.webkitMatchesSelector||qs.mozMatchesSelector||qs.msMatchesSelector||qs.oMatchesSelector;var Pm="80",Tm="443",Zw=RegExp(":("+Pm+"|"+Tm+")$"),Qw=document.createElement("a");function An(s,e,t=void 0,i=void 0,n=void 0,r=void 0){if(typeof i=="function"){let o=t.get("buildHitTask");return{buildHitTask:a=>{a.set(s,null,!0),a.set(e,null,!0),i(a,n,r),o(a)}}}else return Qe({},s,e)}var wa={};function sc(s,e){let t=s.get("trackingId"),i=wa[t]=wa[t]||{},n=()=>{clearTimeout(i.timeout),i.send&&se.remove(s,"send",i.send),delete wa[t],i.queue.forEach(r=>r())};clearTimeout(i.timeout),i.timeout=setTimeout(n,0),i.queue=i.queue||[],i.queue.push(e),i.send||(i.send=r=>(...o)=>{n(),r(...o)},se.add(s,"send",i.send))}var Qe=Object.assign||function(s,...e){for(let t=0,i=e.length;t>e/4).toString(16):("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,s)};function ya(s,e){let t=window.GoogleAnalyticsObject||"ga";window[t]=window[t]||function(...i){(window[t].q=window[t].q||[]).push(i)},window.gaDevIds=window.gaDevIds||[],window.gaDevIds.indexOf(ma)<0&&window.gaDevIds.push(ma),window[t]("provide",s,e),window.gaplugins=window.gaplugins||{},window.gaplugins[ic(s)]=e}var Vi=class{constructor(){this.registry_={}}on(e,t){this.getRegistry_(e).push(t)}off(e=void 0,t=void 0){if(e&&t){let i=this.getRegistry_(e),n=i.indexOf(t);n>-1&&i.splice(n,1)}else this.registry_={}}emit(e,...t){this.getRegistry_(e).forEach(i=>i(...t))}getEventCount(){let e=0;return Object.keys(this.registry_).forEach(t=>{e+=this.getRegistry_(t).length}),e}getRegistry_(e){return this.registry_[e]=this.registry_[e]||[]}};var kn="autotrack",Fs={},xa=!1,Ii,gs=class s extends Vi{static getOrCreate(e,t,i){let n=[kn,e,t].join(":");return Fs[n]||(Fs[n]=new s(n,i),xa||Em()),Fs[n]}static isSupported_(){if(Ii!=null)return Ii;try{window.localStorage.setItem(kn,kn),window.localStorage.removeItem(kn),Ii=!0}catch(e){Ii=!1}return Ii}static get_(e){return window.localStorage.getItem(e)}static set_(e,t){window.localStorage.setItem(e,t)}static clear_(e){window.localStorage.removeItem(e)}constructor(e,t={}){super(),this.key_=e,this.defaults_=t,this.cache_=null}get(){if(this.cache_)return this.cache_;if(s.isSupported_())try{this.cache_=ba(s.get_(this.key_))}catch(e){}return this.cache_=Qe({},this.defaults_,this.cache_)}set(e){if(this.cache_=Qe({},this.defaults_,this.cache_,e),s.isSupported_())try{s.set_(this.key_,JSON.stringify(this.cache_))}catch(t){}}clear(){if(this.cache_={},s.isSupported_())try{s.clear_(this.key_)}catch(e){}}destroy(){delete Fs[this.key_],Object.keys(Fs).length||Mm()}};function Em(){window.addEventListener("storage",rc),xa=!0}function Mm(){window.removeEventListener("storage",rc),xa=!1}function rc(s){let e=Fs[s.key];if(e){let t=Qe({},e.defaults_,ba(s.oldValue)),i=Qe({},e.defaults_,ba(s.newValue));e.cache_=i,e.emit("externalSet",i,t)}}function ba(s){let e={};if(s)try{e=JSON.parse(s)}catch(t){}return e}var Cm=1e3,Am=60*Cm,Vn={},vs=class s{static getOrCreate(e,t,i){let n=e.get("trackingId");return Vn[n]?Vn[n]:Vn[n]=new s(e,t,i)}constructor(e,t,i){this.tracker=e,this.timeout=t||s.DEFAULT_TIMEOUT,this.timeZone=i,this.sendHitTaskOverride=this.sendHitTaskOverride.bind(this),se.add(e,"sendHitTask",this.sendHitTaskOverride);try{this.dateTimeFormatter=new Intl.DateTimeFormat("en-US",{timeZone:this.timeZone})}catch(r){}let n={hitTime:0,isExpired:!1};this.store=gs.getOrCreate(e.get("trackingId"),"session",n),this.store.get().id||this.store.set({id:ki()})}getId(){return this.store.get().id}isExpired(e=this.getId()){if(e!=this.getId())return!0;let t=this.store.get();if(t.isExpired)return!0;let i=t.hitTime;if(i){let n=new Date,r=new Date(i);if(n-r>this.timeout*Am||this.datesAreDifferentInTimezone(n,r))return!0}return!1}datesAreDifferentInTimezone(e,t){return this.dateTimeFormatter?this.dateTimeFormatter.format(e)!=this.dateTimeFormatter.format(t):!1}sendHitTaskOverride(e){return t=>{e(t);let i=t.get("sessionControl"),n=i=="start"||this.isExpired(),r=i=="end",o=this.store.get();o.hitTime=Je(),n&&(o.isExpired=!1,o.id=ki()),r&&(o.isExpired=!0),this.store.set(o)}}destroy(){se.remove(this.tracker,"sendHitTask",this.sendHitTaskOverride),this.store.destroy(),delete Vn[this.tracker.get("trackingId")]}};vs.DEFAULT_TIMEOUT=30;var $a={CLEAN_URL_TRACKER:1,EVENT_TRACKER:2,IMPRESSION_TRACKER:3,MEDIA_QUERY_TRACKER:4,OUTBOUND_FORM_TRACKER:5,OUTBOUND_LINK_TRACKER:6,PAGE_VISIBILITY_TRACKER:7,SOCIAL_WIDGET_TRACKER:8,URL_CHANGE_TRACKER:9,MAX_SCROLL_TRACKER:10},oc=Object.keys($a).length;function ac(s,e){Rm(s),Om(s,e)}function km(s){return parseInt(s||"0",16).toString(2)}function Vm(s){return parseInt(s||"0",2).toString(16)}function Im(s,e){if(s.length{document.visibilityState==Ee?(this.opts.sendInitialPageview&&(this.sendPageview({isPageLoad:!0}),this.isInitialPageviewSent_=!0),this.store.set({time:Je(),state:Ee,pageId:Hs,sessionId:this.session.getId()})):this.opts.sendInitialPageview&&this.opts.pageLoadsMetricIndex&&this.sendPageLoad()})}handleChange(){if(!(document.visibilityState==Ee||document.visibilityState==Li))return;let e=this.getAndValidateChangeData(),t={time:Je(),state:document.visibilityState,pageId:Hs,sessionId:this.session.getId()};document.visibilityState==Ee&&this.opts.sendInitialPageview&&!this.isInitialPageviewSent_&&(this.sendPageview(),this.isInitialPageviewSent_=!0),document.visibilityState==Li&&this.visibleThresholdTimeout_&&clearTimeout(this.visibleThresholdTimeout_),this.session.isExpired(e.sessionId)?(this.store.clear(),this.lastPageState==Li&&document.visibilityState==Ee&&(clearTimeout(this.visibleThresholdTimeout_),this.visibleThresholdTimeout_=setTimeout(()=>{this.store.set(t),this.sendPageview({hitTime:t.time})},this.opts.visibleThreshold))):(e.pageId==Hs&&e.state==Ee&&this.sendPageVisibilityEvent(e),this.store.set(t)),this.lastPageState=document.visibilityState}getAndValidateChangeData(){let e=this.store.get();return this.lastPageState==Ee&&e.state==Li&&e.pageId!=Hs&&(e.state=Ee,e.pageId=Hs,this.store.set(e)),e}sendPageVisibilityEvent(e,{hitTime:t}={}){let i=this.getTimeSinceLastStoredChange(e,{hitTime:t});if(i&&i>=this.opts.visibleThreshold){let n=Math.round(i/hc),r={transport:"beacon",nonInteraction:!0,eventCategory:"Page Visibility",eventAction:"track",eventValue:n,eventLabel:va};t&&(r.queueTime=Je()-t),this.opts.visibleMetricIndex&&(r["metric"+this.opts.visibleMetricIndex]=n),this.tracker.send("event",An(r,this.opts.fieldsObj,this.tracker,this.opts.hitFilter))}}sendPageLoad(){let e={transport:"beacon",eventCategory:"Page Visibility",eventAction:"page load",eventLabel:va,["metric"+this.opts.pageLoadsMetricIndex]:1,nonInteraction:!0};this.tracker.send("event",An(e,this.opts.fieldsObj,this.tracker,this.opts.hitFilter))}sendPageview({hitTime:e,isPageLoad:t}={}){let i={transport:"beacon"};e&&(i.queueTime=Je()-e),t&&this.opts.pageLoadsMetricIndex&&(i["metric"+this.opts.pageLoadsMetricIndex]=1),this.tracker.send("pageview",An(i,this.opts.fieldsObj,this.tracker,this.opts.hitFilter))}trackerSetOverride(e){return(t,i)=>{let n=nc(t)?t:{[t]:i};n.page&&n.page!==this.tracker.get("page")&&this.lastPageState==Ee&&this.handleChange(),e(t,i)}}getTimeSinceLastStoredChange(e,{hitTime:t}={}){return e.time?(t||Je())-e.time:0}handleExternalStoreSet(e,t){e.time!=t.time&&t.pageId==Hs&&t.state==Ee&&!this.session.isExpired(t.sessionId)&&this.sendPageVisibilityEvent(t,{hitTime:e.time})}handleWindowUnload(){this.lastPageState!=Li&&this.handleChange()}remove(){this.store.destroy(),this.session.destroy(),se.remove(this.tracker,"set",this.trackerSetOverride),window.removeEventListener("unload",this.handleWindowUnload),document.removeEventListener("visibilitychange",this.handleChange)}};ya("pageVisibilityTracker",Pa);El();Xt.addClass((b.isMobile?"is":"not")+"-mobile");b.isSafari&&Xt.addClass("is-safari");setTimeout(()=>Xt.addClass("ready"));window.addEventListener("keydown",s=>{s.keyCode===9&&Xt.addClass("is-tabbing")});window.addEventListener("mousedown",()=>{Xt.removeClass("is-tabbing")});var lc=k(".cookie-warning");lc&&k("#yes-to-cookies").on("click",function(){lc.exit("pop",300),b.setCookie("cookie_consent",1)});var Ta=k("x-modal#privacy");Ta&&Ta.$("form").on("submit",s=>{s.preventDefault(),fetch("/profile/accept-policies",{method:"POST"}),Ta.close()});var pc;(pc=navigator.serviceWorker)==null||pc.register("/service_worker.js",{scope:"/"}).catch(()=>console.warn("Unable to register Service Worker."));var dc;(dc=k("#skip-nav"))==null||dc.on("click",()=>{var e;(e=(k("article")||k(".panel.active")||k(".body")||C).$("input, button, a, textarea, [contenteditable], [tabindex]"))==null||e.focus()});var Sa=k("nav x-popup");if(Sa){let s=Sa.$$(".popup-body a, .popup-body button");for(let e of s)e.on("click",()=>Sa.close())}var Dm=Te("#language .locale-link");Ci.on("change",s=>{for(let e of Dm)e.setAttr("href",e.data.host+s)});var In=k("#dark-mode");In&&(In.checked=b.theme.isDark,In.on("change",()=>b.setTheme(In.checked?"dark":"light")));var Oi={},ws=k("#search"),ts=ws==null?void 0:ws.$(".form-field input"),Ln=ws==null?void 0:ws.$(".search-body");Oi[""]=(Ln==null?void 0:Ln.html)||"";function Nm(s){return s=s.trim().replace(/\s+/," ").toLowerCase().slice(0,50),s==="pi"||s.length>=3?s:""}function Gm(s){return D(this,null,function*(){if(s=encodeURIComponent(Nm(s)),s in Oi)return Oi[s];let e=yield fetch(`/api/search?q=${s}`);return e.ok?Oi[s]=yield e.text():Oi[s]=""})}var zm=0,cc=0;function uc(s){return D(this,null,function*(){let e=zm+=1,t=yield Gm(s);e<=cc||(cc=e,Ln.html=t)})}ts==null||ts.change(s=>{b.setCookie("search",s,60*60*24),setTimeout(()=>{ts.value===s&&uc(s)},300)});ts!=null&&ts.value&&ws.one("open",()=>uc(ts.value));var fc='';function mc(s){if(s.match("^[0-9]+/[0-9]+$")){let e=s.split("/");return+e[0]/+e[1]}else return Wh(s)}var On=class extends E{constructor(){super(...arguments);this.solution="";this.solutionNum=NaN;this.solutionDisplay="";this.range=0;this.input="";this.hint="";this.attempts=0;this.placeholder="???";this.done=!1}ready(){if(this.$input=this.$("input"),this.$target=this.$(".target"),this.solution=this.attr("solution"),this.solution.indexOf("\xB1")>=0){let t=this.solution.split("\xB1");this.solution=t[0].trim(),this.range=+t[1]}this.solutionNum=mc(this.solution),this.solutionDisplay=this.solution,this.hint=this.attr("hint"),this.removeAttr("solution"),this.removeAttr("hint"),this.$input.setInputPattern(this.solution),this.hasAttr("placeholder")&&(this.placeholder=this.attr("placeholder")),this.$input.setAttr("placeholder",this.placeholder),this.removeAttr("placeholder"),this.$input.change(t=>{this.input=t,this.isCorrect&&(this.solve(),this.trigger("valid",t),this.moveCursor())}),this.$input.onKey("Enter",()=>this.$input.blur()),this.$input.on("focus",()=>{this.addClass("on"),this.removeClass("invalid"),this.$input.setAttr("placeholder"," ")}),this.$input.on("blur",()=>{if(this.removeClass("on"),this.setClass("invalid",!!this.input&&!this.done),this.$input.setAttr("placeholder",this.placeholder),this.input&&!this.done){this.attempts+=1;let t=this.attempts>=(this.hint?4:3)?`Hmmm\u2026 maybe try ${this.solution}?`:this.attempts>=2?this.hint:void 0;this.trigger("invalid",{hint:t})}})}setup(t,i,n){var r;this.goal=i,this.$step=t,(r=n==null?void 0:n.scores)!=null&&r.includes(i)&&this.solve(!0),this.one("valid",()=>{t.addHint("correct"),t.score(this.solvedBlank?this.solvedBlank.goal:i)}),this.on("invalid",o=>t.addHint(o.hint||"incorrect",{class:"incorrect"}))}get isCorrect(){if(this.done)return!0;if(this.linkedBlanks){let t=this.linkedBlanks.map(i=>i.solvedBlank);return this.solvedBlank=this.linkedBlanks.find(i=>{if(i.done&&!i.solvedBlank||t.includes(i))return!1;if(i.checkAnswer(this.input))return!0}),this.solvedBlank&&(this.solutionDisplay=this.solvedBlank.solution),!!this.solvedBlank}return this.checkAnswer(this.input)}checkAnswer(t){let i=mc(t);return t.toLowerCase()===this.solution.toLowerCase()?!0:this.range&&Math.abs(i-this.solutionNum)<=this.range?(this.solutionDisplay=t,!0):x(i,this.solutionNum)||zo(i)===this.solution||t===zo(this.solutionNum)}moveCursor(){if(!this.$step)return;let t=this.$step.$blanks[this.$step.$blanks.indexOf(this)+1];!t||t.done||t.tagName==="X-BLANK-MC"||t.css("visibility")==="hidden"||!t.bounds.width||t.focus()}solve(t=!1){this.done=!0,this.$input.remove(),this.$target.html=this.solutionDisplay,this.addClass("done"),this.trigger("solve",{solution:this.solutionDisplay,restore:t})}focus(){this.$input.focus()}blur(){this.$input.blur()}};On=T([S("x-blank",{template:fc})],On);var gc='???';var Rn=class extends E{constructor(){super(...arguments);this.done=!1}ready(){this.$target=this.$(".target"),this.$popup=this.$(".popup");let t=this.$popup.$$(".choice");this.solution=t[0].html,_t.shuffle(oe(t.length)).forEach(r=>{this.$popup.append(t[r]),t[r].on("click",()=>{this.removeClass("on"),t[r].blur(),r?(this.$target.html=t[r].html,this.addClass("invalid"),this.trigger("invalid")):(this.solve(),this.trigger("valid",this.solution))})});let n=this.$target.bounds.left+this.$popup.width>b.width-15;this.setClass("left",n),Bs(this,{enter:()=>{if(this.done)return;this.addClass("on");let r=this.$target.bounds,o=this.$popup.width,a=this.$popup.height,h=b.width-10-r.left,l=o10,u=r.top+r.height+a>b.height-10;this.setClass("left",c&&!l),this.setClass("top",u),this.$popup.css("max-width",!c&&!l?`${h}px`:"none")},exit:()=>{this.removeClass("on")},delay:100,exitDelay:400,$clickTarget:this.$target})}setup(t,i,n){var r;(r=n==null?void 0:n.scores)!=null&&r.includes(i)&&this.solve(!0),this.one("valid",()=>{t.addHint("correct"),t.score(i)}),this.on("invalid",o=>t.addHint(o.hint||"incorrect",{class:"incorrect"}))}solve(t=!1){this.done=!0,this.$target.html=this.solution,this.removeClass("on invalid"),this.addClass("done"),this.trigger("solve",{solution:this.solution,restore:t}),setTimeout(()=>this.$popup.remove(),250),this.$target.removeAttr("tabindex")}};Rn=T([S("x-blank-mc",{template:gc})],Rn);var vc='
';var wc=40,yc="free-text",Dn=class extends E{setup(e,t,i){var l,c;let n=this.$(".text-area"),r=this.$(".toolbar .submit"),o=((l=i==null?void 0:i.data)==null?void 0:l[yc])||"";o&&(n.html=o);for(let u of this.$$(".toolbar .command")){let d=u.data.command.split(":");u.on("click",()=>document.execCommand(d[0],!1,d[1]))}let a=o,h=ve(()=>{a!==o&&e.storeData(yc,o),a=o},5e3);n.on("change keyup input paste",()=>{o=n.html.replace(/ /g," ").trim().slice(0,500).trim(),r.setClass("invisible",o.length{h(),e.score(t),r.exit("pop"),this.trigger("submit")}))}};Dn=T([S("x-free-text",{template:vc})],Dn);var bc='
';var Nn=class extends E{ready(){let e=this.$(".wrapper"),t=this.$(".panel"),i=t.children,n=this.$(".next"),r=this.$(".back"),o=this.$(".dots"),a=i.map(()=>m("div",{class:"dot"},o)),h=i.length,l=+this.attr("slide-width")||void 0,c=this.width,u=1,d=c,g=0,y=0,f=dt=>{y=dt,t.translate(dt,0),this.trigger("move",dt)},v=dt=>{g=dt;for(let[ge,vi]of a.entries())vi.setClass("on",ge>=dt&&ge{c=this.width,u=l?Math.ceil(c/l):1,d=c/u;for(let dt of i)dt.css("width",d+"px");t.css("width",h*d+"px"),f(-g*d),v(g)});let w="quad",$=500,I,A,M,P,j=!1,ne=()=>{I=Date.now()-P,f(A+M*yt(w,I/$)),!j&&I<$?requestAnimationFrame(ne):this.trigger("slide-end")},As=dt=>{j=!1,I=0,A=y,M=-dt*d-y,P=Date.now(),v(dt),ne()};n.on("click",()=>{w="quad",g{w="quad",g>0&&As(g-1)});let en,To,So,sn;ds(e,{start:dt=>{j=!0,en=y,To=dt.x,sn=So=To},move:dt=>{So=sn,sn=dt.x;let ge=en-To+dt.x,vi=-(h-u)*d,Fd=ge>0?ge/4:ge{let dt=sn-So,ge=dt>12?1:dt<-12?-1:0;w="quad-out",As(B(Math.round(-y/d-ge),0,h-u)),setTimeout(()=>this.css("pointer-events","auto"))}})}};Nn=T([S("x-gallery",{template:bc})],Nn);var xc='';function Ea(s,e){let t=e.positionLeft-s.positionLeft+e.width/2,i=e.positionTop-s.positionTop+e.height/2;return new p(t,i)}function $c(s){return s?new p(...s.split(",").map(e=>+e)):void 0}var Gn=class extends E{constructor(){super(...arguments);this.doAnimation=!1}created(){this.slide=$c(this.attr("slide")),this.shift=$c(this.attr("offset"))}ready(){this.$target=k(this.attr("target")),this.$target&&(this.$target.on("click pointerdown focus",()=>this.stop()),this.hasAttr("start")&&this.start())}setTarget(t,i,n){this.$target=typeof t=="string"?k(t):t,i&&(this.slide=i),n&&(this.slide=n)}start(t){this.doAnimation||!this.from&&!this.$target||(this.doAnimation=!0,t&&(this.slide=t),this.slide||this.$end?this.runSlideAnimation():this.runClickAnimation())}startSlide(t,i){this.$target=t,this.$end=i,this.start()}stop(){this.doAnimation=!1}runSlideAnimation(){return D(this,null,function*(){this.show();let t=this.from||Ea(this,this.$target);this.shift&&(t=t.add(this.shift));let i=this.slide?t.add(this.slide):Ea(this,this.$end),n=`translate(${t.x-15}px,${t.y-10}px)`,r=`translate(${i.x-15}px,${i.y-10}px)`;yield this.animate({transform:[n+" scale(2)",n],opacity:[0,1]},300).promise,yield this.animate({transform:[n,r]},1e3).promise,yield this.animate({transform:[r,r+" scale(2)"],opacity:[1,0]},300).promise,this.hide(),setTimeout(()=>{this.doAnimation&&this.runSlideAnimation()},1e3)})}runClickAnimation(){return D(this,null,function*(){this.show();let t=this.from||Ea(this,this.$target);this.shift&&(t=t.add(this.shift));let i=`translate(${t.x-15}px,${t.y-10}px)`;yield this.animate({transform:[i+" scale(2)",i],opacity:[0,1]},500).promise,yield this.animate({transform:[i,i+" scale(2)"],opacity:[1,0]},500,200).promise,this.hide(),setTimeout(()=>{this.doAnimation&&this.runClickAnimation()},1e3)})}};Gn=T([S("x-gesture",{template:xc})],Gn);var Ma='';var Bm=JSON.parse(k("#glossary").text),_m=JSON.parse(k("#bios").text),Ca=600,Bn;b.onResize(()=>{Bn&&Bn.hide()});var Ri=class extends E{ready(){this.xid=this.attr("xid"),this.$target=this.$(".target"),this.$popup=this.$(".popup"),this.$popup.html=this.body()||"",this.setClass("left",b.width>Ca&&this.$target.bounds.left+this.$popup.width>b.width-15),Bs(this,{enter:()=>this.show(),exit:()=>this.hide(),delay:100,exitDelay:200,$clickTarget:this.$target,canFocusWithin:!0,preventMouseover:()=>b.width<=Ca})}show(){if(Bn=this,this.addClass("on"),b.width<=Ca){let a=k("#glossary-modal");return a.$(".modal-body").html=this.body(),a.open()}let t=this.$target.bounds,i=this.$popup.width,n=this.$popup.height,r=t.top+t.height+n54;this.setClass("top",o&&!r),this.setClass("left",t.left+i>b.width-15)}hide(){Bn=void 0,this.removeClass("on")}body(){let t=Bm[this.xid];if(!t)return console.warn("missing gloss:",this.xid);let i=t.text;return t.image&&(i+=``),t.link&&(location.pathname===t.link.split("#")[0]||(i+=`

Learn more\u2026

`)),i}};Ri=T([S("x-gloss",{template:Ma})],Ri);var zn=class extends Ri{body(){let e=_m[this.xid];if(!e)return console.warn("missing bio:",this.xid);let t=``,i=e.born?`

Timeline

`:"";return(e.image===!1?"":t)+e.bio+i}};zn=T([S("x-bio",{template:Ma})],zn);var Pc='
';var qm=document.createElement("a").relList.supports("ar"),qn=!1,Aa={x:0,y:0,s:1},Tc,ys=m("div",{class:"lightbox-overlay"},C),Ge=m("div",{class:"lightbox-img"},ys);function Fm(s,e,t){qn=!0,Tc=s,ys.show(),Ge.show();let i=s.bounds,n=Ge.bounds,r=i.left+i.width/2-n.left-n.width/2,o=i.top+i.height/2-n.top-n.height/2,a=Math.max(i.width/n.width,i.height/n.height);Aa={x:r,y:o,s:a},Ge.css("background-image",`url(${t}), url(${e})`),Ge.css("transform",`translate(${r}px, ${o}px) scale(${a})`),b.redraw(),Ge.addClass("transitions"),b.redraw(),s.css("visibility","hidden"),ys.addClass("on"),Ge.css("transform","scale(1) translate(0,0)")}function Sc(){qn&&(qn=!1,ys.removeClass("on"),Ge.setTransform(Aa,0,Aa.s),setTimeout(()=>{Tc.css("visibility","visible"),ys.css("display","none"),Ge.css("transform","none"),Ge.removeClass("transitions")},400))}ys.on("click touchmove",Sc);C.onKey("Escape",Sc);ys.on("scrollwheel touchmove",s=>{s.preventDefault(),s.stopPropagation()});C.onKey("Space AllArrows PageDown PageUp",s=>{qn&&(s.preventDefault(),s.stopPropagation())});var _n=class extends E{ready(){let e=this.attr("src"),t=this.$(".wrap"),i=this.attr("width"),n=this.attr("height");this.css("width",i+"px"),t.css("padding-bottom",+n/+i*100+"%");let r=t.$("img");r.setAttr("src",e),r.setAttr("alt",this.attr("alt")||""),r.setAttr("width",i),r.setAttr("height",n),e.endsWith(".gif")&&r.on("click",()=>r.setAttr("src",e));let o=t.$(".credit"),a=this.attr("credit");a?o.text=a:o.remove();let h=t.$(".zoom");if(this.hasAttr("lightbox")){this.addClass("interactive");let l=e.replace(/\.(?=[^.]*$)/,"-large.");this.on("click",()=>Fm(this,e,l))}else h.remove();if(qm&&this.hasAttr("ar")){let l=m("a",{href:this.attr("ar"),rel:"ar"});t.prepend(l),l.append(r)}}};_n=T([S("x-img",{template:Pc})],_n);var Fn=class extends E{constructor(){super(...arguments);this.correctCount=0;this.solvedCount=0;this.isSolved=!1}setup(t,i,n){var h;let r=this.children,o=r.map(()=>!1);for(let[l,c]of r.entries()){let u=c.data.error,d=u?"incorrect":"correct";u||(this.correctCount+=1),c.one("click",()=>{o[l]||this.isSolved||(t.addHint(u||"correct",{class:d}),c.addClass(d),u||(this.solvedCount+=1,t.score("picker-"+l),this.checkSolved()))})}let a=((h=n==null?void 0:n.scores)==null?void 0:h.filter(l=>l.startsWith("picker-")))||[];for(let l of a){let c=+l.slice(7);o[c]=!0,r[c].addClass("correct")}this.solvedCount=a.length,this.checkSolved()}checkSolved(){this.solvedCountthis.steps=+a),this.speed=+this.attr("speed")||1;let t=this.$(".bar"),i=this.$(".knob"),n=this.$(".play");this.hasAttr("no-play")?n.remove():n.on("click",()=>this.play());let r=this.hasAttr("continuous"),o=this.hasAttr("snap")?t.width/this.steps:.001;this.drag=new fs(i,{moveY:!1,snap:o}),this.drag.on("start",()=>{this.animation&&this.animation.cancel(),this.animation=void 0}),this.drag.on("move",({posn:a})=>{let h=a.x/this.drag.bounds.dx*this.steps;r||(h=Math.round(h)),!x(h,this.current)&&(this.current=h,this.trigger("move",h))}),this.drag.on("end",()=>this.trigger("slide-end"))}setup(t,i){this.bindModel(t.model),this.one("slide-end",()=>t.score(i))}set(t){x(t,this.current)||this.drag.setPosition(t*this.drag.bounds.dx/this.steps,0)}play(){return D(this,null,function*(){this.current>=this.steps&&this.set(0);let t=(1-this.current/this.steps)*3e3/this.speed;this.moveTo(this.steps,t)})}moveTo(t,i=600){return D(this,null,function*(){if(this.animation||t===this.current)return;let n=this.current;this.animation=pt(r=>{this.set(n+(t-n)*yt("quad",r))},i),yield this.animation.promise,this.animation=void 0,this.trigger("slide-end")})}bindVariable(t,i){t[i]=0,this.on("move",n=>t[i]=n),t.watch(()=>this.set(t[i]))}};Hn=T([S("x-slider",{template:Ec})],Hn);var Mc='
';function Hm(s){let e=s.$$("x-blank, x-blank-mc");if(!e.length)return Promise.resolve();let t=0;return new Promise(i=>{for(let n of e)n.on("solve",()=>{t+=1,t>=e.length&&i()})})}var jn=class extends E{constructor(){super(...arguments);this.length=0;this.current=0;this.locked=!1}ready(){this.$legend=this.$(".legend-box"),this.$steps=this.$legend.children,this.$back=this.$(".back"),this.$next=this.$(".next");let t=this.$(".dots");this.$dots=this.$steps.map(()=>m("div",{class:"dot"},t)),this.length=this.$steps.length,this.current=0,this.$back.on("click",()=>this.goBack()),this.$next.on("click",()=>this.goNext()),this.blanks=this.$steps.map(i=>Hm(i)),this.reveals=this.$$("[slide]").map(i=>{let n=i.attr("slide").split("-"),r=n.length>1?[+n[0]||0,+n[1]||this.length]:[+n[0],+n[0]],o=[i.data.animation||"fade",+i.data.duration||400];return i.data.display="visibility",r[0]>=0&&!i.hasClass("reveal")&&i.hide(),[i,r,o]}),this.autoAdvance=this.attr("step")==="auto",this.$steps[0].show(),this.$dots[0].addClass("on"),this.setupSlide(0)}setup(t,i,n){var o;let r=(o=n==null?void 0:n.scores)==null?void 0:o.filter(a=>a.startsWith("slide-")).length;if(r&&rt.score("slide-"+(a-1)))}go(t){if(this.locked||t<0||t>this.length-1||t===this.current)return;this.locked=!0,setTimeout(()=>this.locked=!1,600),this.$back.setClass("disabled",t===0),this.$next.setClass("disabled",t===this.length-1),this.$dots[this.current].removeClass("on"),this.$dots[t].addClass("on"),this.$steps[t].show();let i=this.$steps[t].height+"px";this.$steps[t].hide(),this.$steps[this.current].exit("fade",300).promise.then(()=>this.$steps[t].enter("fade",300)),this.$legend.animate({height:i},600).promise.then(()=>this.$legend.css("height","auto")),this.setupSlide(t),this.current=t,this.trigger("step",t)}setupSlide(t){this.$next.setAttr("disabled","true"),this.blanks[t].then(()=>this.$next.removeAttr("disabled"));for(let[i,n,r]of this.reveals){if(i.hasClass("reveal"))continue;let o=i.css("visibility")!=="hidden",a=t>=n[0]&&t<=n[1];a&&!o&&i.enter(...r,300),!a&&o&&i.exit(...r)}}goNext(){this.locked||(this.go(this.current+1),this.trigger("next",this.current))}goBack(){this.locked||(this.go(this.current-1),this.trigger("back",this.current))}};jn=T([S("x-slideshow",{template:Mc})],jn);var Un=class extends E{ready(){var g,y;(g=k(".sidebar-toggle"))==null||g.on("click",()=>this.addClass("open")),(y=k(".sidebar-shadow"))==null||y.on("pointerdown",()=>this.removeClass("open"));let e=k("#feedback form"),t=k("#feedback button"),i=k("#feedback .error"),n=k("#feedback-success"),r=k('#feedback textarea[name="message"]'),o=k("x-course").id;e==null||e.on("submit",f=>{f.preventDefault(),t.setAttr("disabled","true"),i.hide(),Ne(`/course/${o}/feedback`,e.formData).then(()=>{n.open(),r.value=""}).catch(()=>i.show()).then(()=>t.removeAttr("disabled"))});let a=JSON.parse(k("#glossary").text),h=k("#glossary-search"),l=h.$(".gloss-body"),c=h.$(".gloss-list"),u=h.$(".gloss-search input"),d;for(let f of Object.keys(a).sort()){let v=a[f],w=m("div",{class:"gloss-item",html:v.title,tabindex:0},c);w.on("click",()=>{d&&d.removeClass("on"),d=w,w.addClass("on"),l.html=v.text});let $=v.title.toLowerCase();u.change(I=>w.setClass("hidden",!!I&&$.indexOf(I.toLowerCase())<0))}}};Un=T([S("x-course-sidebar")],Un);function ka(s,e){let t=as(s.map(i=>i.h+10));for(let[i,n]of s.entries())n.drag.bounds=new lt(0,0,0,O(t)),n!==e&&n.drag.setPosition(0,t[i-1]||0)}function jm(s){return s.every((e,t)=>e.index===t)||s.every((e,t)=>e.index===s.length-t-1)}var Wn=class extends E{ready(){this.items=this.children.map(t=>({drag:new fs(t,{moveX:!1,useTransform:!0}),index:+t.data.index,h:0}));for(let t of this.children)t.removeAttr("data-index");for(let t of this.items)t.drag.on("drag",()=>{this.items=yi(this.items,i=>i.drag.position.y-(i===t?10:0)),ka(this.items,t)}),t.drag.on("end",()=>{ka(this.items),jm(this.items)&&this.solve()});b.onResize(()=>{for(let i of this.items)i.h=i.drag.$el.height;let t=N(this.items.map(i=>i.h));this.css("height",t+this.items.length*10-10+"px"),ka(this.items)})}setup(t,i,n){var r;(r=n==null?void 0:n.scores)!=null&&r.includes(i)&&this.solve(),this.one("solve",()=>{t.addHint("correct"),t.score(i)})}solve(){this.trigger("solve"),this.addClass("solved");for(let t of this.items)t.drag.disabled=!0}};Wn=T([S("x-sortable")],Wn);function Cc(s,e=!1){return D(this,null,function*(){if(s.css("visibility")==="visible")return;s.data.display="visibility";let t=+s.data.duration||400,i=(e?0:600)+(+s.data.delay||0);yield s.enter(s.data.animation||"fade",t,i).promise,s.css({opacity:"",transform:""}),s.trigger("reveal"),s.removeClass("reveal")})}var Kn=class extends E{constructor(){super(...arguments);this.model=le({});this.isShown=!1;this.isCompleted=!1;this.scores=new Set}ready(){var i,n,r,o;this.$course=this.parents("x-course")[0],this.$blanks=this.$$("x-blank, x-blank-mc"),this.$components=this.$$("[goal]"),this.userData=(r=(n=(i=this.$course)==null?void 0:i.userData)==null?void 0:n.steps)==null?void 0:r[this.id],this.goals=K(this.attr("goals")),this.$reveals=this.$$(".reveal");let t=this.$$(".check[data-when]");for(let a of[...this.$reveals,...t])this.onScore(a.data.when,()=>Cc(a));this.$nextBtn=this.$$(".next-step");for(let[a,h]of this.$nextBtn.entries())this.onScore("next-"+a,()=>h.exit("pop")),h.one("click",()=>this.score("next-"+a));for(let a of this.$$(".step-target"))a.tagName!=="X-TARGET"&&Bs(a,{enter:()=>{let h=this.$$('[target~="'+a.data.to+'"]');for(let l of h)l.addClass("focus");this.addClass("focus"),this.trigger("target-focus",{$targets:h})},exit:()=>{for(let h of this.$$(".focus"))h.removeClass("focus");this.removeClass("focus")}});for(let a of this.$$(".var, .var-action"))a.bindModel(this.model);(o=this.$course)!=null&&o.audio&&(this.narration=new En(this.$course.audio,this))}show(){var n,r,o;if(this.isShown)return;this.isShown=!0,(n=StepFunctions==null?void 0:StepFunctions[nn(this.id)])==null||n.call(StepFunctions,this);for(let a of this.$components)a.setup(this,a.attr("goal"),this.userData);let t=((r=this.userData)==null?void 0:r.scores)||[];for(let a of t)this.score(a,!1);let i=this.$$("x-gesture[target]");setTimeout(()=>{if(!this.isReady)for(let a of i)a.start()},2e3),(o=this.$course)==null||o.log("Step","show",this.id),this.trigger("show"),this.addClass("on"),this.narration&&setTimeout(()=>this.narration.play(),400)}complete(){if(!this.isCompleted){this.isShown||this.show(),this.isCompleted=!0;for(let t=0;tthis.scores.has(t))}get isPageLoaded(){return this.$course?this.$course.isReady:!0}score(t,i=!0){this.scores.has(t)||(this.scores.add(t),this.trigger("score-"+t),this.trigger("score"),this.$course&&(this.$course.trigger("score"),this.$course.saveProgress({steps:{[this.id]:{scores:[t]}}}),this.$course.log("Step","score",this.id+"/"+t)),i&&this.isReady&&this.$course&&this.$course.isReady&&setTimeout(()=>{this.$course.$activeStep===this&&this.$course.nextStep()},1200))}storeData(t,i){var n;(n=this.$course)==null||n.saveProgress({steps:{[this.id]:{data:{[t]:i}}}})}onScore(t,i){let n=K(t);if(n.every(a=>this.scores.has(a)))return i&&i(),Promise.resolve();let r=Ke(),o=()=>{n.every(a=>this.scores.has(a))&&(i&&i(),r.resolve(),this.off("score",o))};return this.on("score",o),r.promise}addHint(t,i={}){var n,r,o;return this.trigger("hint",t),(n=this.$course)!=null&&n.isReady?this.isInViewport?(r=this.$course.$tutor)==null?void 0:r.showHint(t,i):(this.one("enterViewport",()=>{var a;return(a=this.$course.$tutor)==null?void 0:a.showHint(t,i)}),{text:((o=this.$course.$tutor)==null?void 0:o.hints[t])||t}):{text:t}}delayedHint(t,i=1e4){let n=setTimeout(t,i);this.on("score",()=>{clearTimeout(n),this.isCompleted||(n=setTimeout(t,i))}),this.on("complete",()=>clearTimeout(n))}get nextStep(){if(!this.$course)return;let t=this.$course.$steps.indexOf(this);return this.$course.$steps[t+1]}groupBlanks(...t){let i=t.map(n=>this.$blanks[n]);for(let n of i)n.linkedBlanks=i}};Kn=T([S("x-step")],Kn);var Um='
',Xn=class extends E{constructor(){super(...arguments);this.$titles=[];this.active=0}ready(){let t=this.$(".titles");this.$body=this.$(".body"),this.$tabs=this.$$(".tab");for(let i=0;ithis.makeActive(i))}this.$titles[0].addClass("active"),this.$tabs[0].show()}makeActive(t){if(this.active===t)return;this.$titles[this.active].removeClass("active"),this.$titles[t].addClass("active"),this.$tabs[t].show();let i=this.$tabs[t].outerHeight+"px";this.$tabs[t].hide(),this.$tabs[this.active].exit("fade",300).promise.then(()=>this.$tabs[t].enter("fade",300)),this.$body.animate({height:i},600).promise.then(()=>this.$body.css("height","auto")),this.active=t,this.trigger("change",t)}};Xn=T([S("x-tabbox",{template:Um})],Xn);var Ac='';function Wm(s,e,t,i){let n=new p(s.left-15,s.top+t-15),r=new G(n,s.width+30,s.height+30),o=new p(e.left-15,e.top+i-15),a=new G(o,e.width+30,e.height+30),h=new Y(r.center,a.center);return[Q(h,r)[0],Q(h,a)[0]]}function Km(s,e){return Math.abs(s[0]-e[0])+Math.abs(s[1]-e[1])}var kc=Te("header, x-tutor, .sidebar"),Us=m("svg",{class:"target-body",html:Ac},C),Xm=Us.$("mask"),Ym=Us.$(".target-arrow"),js=!1,Vc=[],Yn=class extends E{ready(){this.setAttr("tabindex",0);let e=this.attr("to").replace(/_/g," "),t=this.hasClass("no-margins"),i,n,r,o,a=()=>{js=!0;let u=Te(e);if(!u.length)return;let d=u[0].hasParent(...kc);i===void 0&&(i=this.hasParent(...kc));let g=this.bounds,y=u.map(f=>f.bounds).filter(f=>f.width||f.height);if(r=0,!d){let f=Math.min(...y.map(I=>I.top)),v=Math.max(...y.map(I=>I.top+I.height)),w=b.height-12-v,$=56-f;r=w<0?w:$>0?$:0}for(let f of Vc)f.remove();Vc=[g,...y].map((f,v)=>{let w=!v||t?4:10;return m("rect",{x:f.left-w,y:f.top-w+(v||!i?r:0),width:f.width+2*w,height:f.height+2*w,rx:v?4:18,ry:v?4:18},Xm)}),Ym.points=Wm(g,y[0],i?0:r,d?0:r)},h=()=>{r&&C.scrollBy(-r,300),Us.css("display","block"),b.redraw(),Zt(function(){Us.css("opacity",1)},r?300:0)},l=u=>{js&&(u&&_(u.type,"mousemove","pointermove")&&Km(n,[u.clientX,u.clientY])<40||(clearTimeout(o),js=!1,Us.css("opacity",0),setTimeout(()=>{js||Us.css("display","none")},300),C.off("mousewheel mousemove touchend touchmove",l),this.off("mouseleave blur",l)))},c=()=>{r&&!i?C.on("mousemove",l):this.on("mouseleave",l),C.on("mousewheel touchend touchmove",l),this.on("blur",l)};this.on("mouseenter touchstart focus",u=>{n=[u.clientX,u.clientY],a(),o=window.setTimeout(h,r?50:30),c()}),this.on("click",u=>{js?(u.handled=!0,l(),setTimeout(()=>k(e).trigger("click mousedown"))):(js=!0,r=0,h(),c())})}};Yn=T([S("x-target")],Yn);var ot=class ce extends Error{constructor(e,t){super(t),this.name=e}static undefinedVariable(e){return new ce("EvalError",`Undefined variable \u201C${e}\u201D.`)}static undefinedFunction(e){return new ce("EvalError",`Undefined function \u201C${e}\u201D.`)}static uncallableExpression(e){return new ce("EvalError",`Cannot call \u201C${e}\u201D.`)}static evalLoop(e){return new ce("EvalError",`Loop in nested evaluation \u201C${e}\u201D.`)}static invalidCharacter(e){return new ce("SyntaxError",`Unknown symbol \u201C${e}\u201D.`)}static conflictingBrackets(e){return new ce("SyntaxError",`Conflicting brackets \u201C${e}\u201D.`)}static unclosedBracket(e){return new ce("SyntaxError",`Unclosed bracket \u201C${e}\u201D.`)}static startOperator(e){return new ce("SyntaxError",`A term cannot start with a \u201C${e}\u201D.`)}static endOperator(e){return new ce("SyntaxError",`A term cannot end with a \u201C${e}\u201D.`)}static consecutiveOperators(e,t){return new ce("SyntaxError",`A \u201C${e}\u201D cannot be followed by a \u201C${t}\u201D.`)}static invalidExpression(){return new ce("SyntaxError","This expression is invalid.")}},za={pi:Math.PI,\u03C0:Math.PI,e:Math.E},Oa={"(":")","[":"]","{":"}"},Xs={"*":"\xB7","**":"\u2217","//":"//","+-":"\xB1","\u2013":"\u2212","-":"\u2212",xx:"\xD7",sum:"\u2211",prod:"\u220F",int:"\u222B",del:"\u2202",grad:"\u2207",aleph:"\u2135",not:"\xAC",AA:"\u2200",EE:"\u2203","'":"\u2019","!=":"\u2260","<=":"\u2264",">=":"\u2265",in:"\u2208","!in":"\u2209","==":"\u2261","~=":"\u2245","~~":"\u2248",sub:"\u2282",sube:"\u2286",prop:"\u221D",oo:"\u221E",cap:"\u2229",cup:"\u222A","<-":"\u2190","->":"\u2192","=>":"\u21D2","<=>":"\u21D4","|->":"\u21A6",uarr:"\u2191",darr:"\u2193",lArr:"\u21D0"},Ni={Gamma:"\u0393",Delta:"\u0394",Theta:"\u0398",Lambda:"\u039B",Xi:"\u039E",Pi:"\u03A0",Sigma:"\u03A3",Phi:"\u03A6",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u025B",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",pi:"\u03C0",rho:"\u03C1",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",CC:"\u2102",NN:"\u2115",QQ:"\u211A",RR:"\u211D",ZZ:"\u2124"},Bc="abcdefghijklmnopqrstuvwxyz",Zm=Bc.split(""),Qm=Bc.toUpperCase().split(""),Jm=Object.values(Ni),tg=[...Zm,...Qm,...Jm,"$"],eg="|()[]{}\xF7,!<>=*/+-\u2013\u2212~^_\u2026\xB0\u2022\u2225\u22A5'\u2220:%\u223C\u25B3",sg=Object.values(Xs),ig=[...eg,...sg],ng={_:"sub","^":"sup","//":"/","\xF7":"/"},Ic={"<":"<",">":">"};function _c(s){return s in Ic?Ic[s]:s}var rg=["abs","round","floor","ceil","max","min","mod","lcm","gcd","gcf","log","exp","ln","sqrt","root","sin","cos","tan","sec","csc","cot","cosec","cotan","arcsin","arccos","arctan","sinh","cosh","tanh","sech","csch","coth","cosech"];function $s(s){return rg.includes(s)}var Ys={"+":"plus","\u2212":"minus","\xB7":"times","\xD7":"times","/":"over","//":"divided by","%":"percent","!":"factorial","\xB1":"plus-minus","=":"equals","\u2260":"does not equal","<":"is less than",">":"is greater than","\u2264":"is less than or equal to","\u2265":"is greater than or equal to",\u03C0:"pi","\u2245":"is congruent to","\u2225":"is parallel to","\u22A5":"is perpendicular to"};for(let s of Object.keys(Ni))Ys[Ni[s]]=s;var qc=s=>typeof s=="number"?s:s[0],Fc=s=>typeof s=="number"?[s,s]:s,ss=class{evaluate(s={},e){return NaN}interval(s={},e){return Fc(this.evaluate(s))}substitute(s={}){return this}recursiveSubstitute(s){let e=Object.keys(s);return this.unknowns.filter(t=>e.includes(t)).length?this.substitute(s).recursiveSubstitute(s):this}get simplified(){return this}get unknowns(){return this.variables.filter(s=>!Object.prototype.hasOwnProperty.call(za,s))}get variables(){return[]}get functions(){return[]}collapse(){return this}toString(){return""}toVoice(s={}){return""}toMathML(s={}){return""}},Va=new Set;function Ra(s,e,t=!1){var i;let n=(i=e[s])!=null?i:za[s];if(n===void 0)throw ot.undefinedVariable(s);if(typeof n=="string"||n instanceof ss){if(t||Va.clear(),Va.has(s))throw ot.evalLoop(s);return Va.add(s),typeof n=="string"&&(n=Et.parse(n)),n.evaluate(e,!0)}else return typeof n=="function"?n():n}var Gi=class extends ss{constructor(s){super(),this.n=s}evaluate(){return this.n}toString(){return`${this.n}`}toVoice(){return`${this.n}`}toMathML(){return`${this.n}`}},Zs=class extends ss{constructor(s){super(),this.i=s}evaluate(s={},e){return qc(Ra(this.i,s,e))}interval(s={},e){return Fc(Ra(this.i,s,e))}toMathML(){return`${this.i}`}substitute(s={}){return s[this.i]||this}get variables(){return[this.i]}toString(){return this.i}toVoice(){return this.i in Ys?Ys[this.i]:this.i.length===1?`_${this.i}_`:this.i}},og=class extends ss{constructor(s){super(),this.s=s}evaluate(s={},e){return qc(Ra(this.s,s,e))}toString(){return`"${this.s}"`}toVoice(){return this.s}toMathML(){return`${this.s}`}},Hc=class extends ss{toString(){return" "}toMathML(){return""}},Ce=class extends ss{constructor(s){super(),this.o=s}toString(){return this.o.replace("//","/")}toVoice(){return Ys[this.o]||this.o}get functions(){return[this.o]}toMathML(){let s=_c(this.toString());return`${s}`}},Lc=[-1/0,1/0],Ks=[NaN,NaN],bs=Math.PI/2,Da=Math.PI*2,ht=(s,e)=>[s-Number.EPSILON,e+Number.EPSILON],xs=(...s)=>ht(Math.min(...s),Math.max(...s)),ag=s=>Math.abs(s[1]-s[0]);var Ws=s=>isNaN(s[0])||isNaN(s[1]),Oc=s=>!isFinite(s[0])&&s[0]===s[1],hg=(s,e)=>nt(e,s[0]-Number.EPSILON,s[1]+Number.EPSILON),Jn=s=>hg(s,0),Me={add:(...s)=>s.reduce((e,t)=>e+t,0),sub:(...s)=>s.length>1?s[0]-s[1]:-s[0],mul:(...s)=>s.reduce((e,t)=>e*t,1),div:(s,e)=>s/e,abs:s=>Math.abs(s),round:s=>Math.round(s),floor:s=>Math.floor(s),ceil:s=>Math.ceil(s),max:(...s)=>Math.max(...s),min:(...s)=>Math.min(...s),mod:(s,e)=>s%e,lcm:(...s)=>Ls(...s),gcd:(...s)=>xe(...s),gcf:(...s)=>xe(...s),sup:(s,e)=>Math.pow(s,e),log:(s,e)=>Math.log(s)/(e===void 0?1:Math.log(e)),exp:s=>Math.exp(s),ln:s=>Math.log(s),sqrt:s=>Math.sqrt(s),root:(s,e)=>Math.pow(s,1/e),sin:s=>Math.sin(s),cos:s=>Math.cos(s),tan:s=>Math.tan(s),sec:s=>1/Math.cos(s),csc:s=>1/Math.sin(s),cot:s=>1/Math.tan(s),cosec:s=>Me.csc(s),cotan:s=>Me.cot(s),arcsin:s=>Math.asin(s),arccos:s=>Math.acos(s),arctan:s=>Math.atan(s),sinh:s=>Math.sinh(s),cosh:s=>Math.cosh(s),tanh:s=>Math.tanh(s),sech:s=>1/Math.cosh(s),csch:s=>1/Math.sinh(s),coth:s=>1/Math.tanh(s),cosech:s=>Me.csch(s)};function Zn(s,e){if(s[0]>0)return e[0]>=0?ht(s[0]**e[0],s[1]**e[1]):xs(s[0]**e[0],s[0]**e[1],s[1]**e[0],s[1]**e[1]);let t=e[0];return Number.isInteger(t)&&t===e[1]?t===0?[Jn(s)?0:1,1]:t%2?ht(s[0]**t,s[1]**t):Jn(s)?[0,Math.max(s[0]**t,s[1]**t)]:xs(s[1]**t,s[0]**t):Ks}function Rc(s,e=Da){let t=Math.floor(s[0]/e)*e;return[s[0]-t,s[1]-t]}var q={add:(...s)=>ht(N(s.map(e=>e[0])),N(s.map(e=>e[1]))),sub:(s,e)=>e!==void 0?ht(s[0]-e[1],s[1]-e[0]):ht(-s[1],-s[0]),mul:(s,...e)=>(e.length>1&&(e=[q.mul(...e)]),xs(s[0]*e[0][0],s[0]*e[0][1],s[1]*e[0][0],s[1]*e[0][1])),div:(s,e)=>Jn(e)?Lc:xs(s[0]/e[0],s[0]/e[1],s[1]/e[0],s[1]/e[1]),abs:s=>Jn(s)?ht(0,Math.max(-s[0],s[1])):xs(Math.abs(s[0]),Math.abs(s[1])),round:s=>ht(Math.round(s[0]),Math.round(s[1])),floor:s=>ht(Math.floor(s[0]),Math.floor(s[1])),ceil:s=>ht(Math.ceil(s[0]),Math.ceil(s[1])),max:(...s)=>ht(Math.max(...s.map(e=>e[0])),Math.max(...s.map(e=>e[1]))),min:(...s)=>ht(Math.min(...s.map(e=>e[0])),Math.min(...s.map(e=>e[1]))),mod:(s,e)=>{if(Ws(s)||Ws(e))return Ks;let t=s[0]/(s[0]<0?e[0]:e[1]);return t=t<0?Math.ceil(t):Math.floor(t),q.sub(s,q.mul(e,[t,t]))},lcm:(...s)=>xs(Ls(...s.map(e=>e[0]))),gcd:(...s)=>xs(xe(...s.map(e=>e[0]))),gcf:(...s)=>q.gcd(...s),sup:(s,e)=>Zn(s,e),log:(s,e)=>(e!==void 0&&q.div(q.log(s),q.log(e)),ht(s[0]<=0?-1/0:Math.log(s[0]),Math.log(s[1]))),exp:s=>Zn([Math.E,Math.E],s),ln:s=>q.log(s),sqrt:s=>Zn(s,[.5,.5]),root:(s,e)=>Zn(s,q.div([1,1],e)),sin:s=>q.cos(q.sub(s,[bs,bs])),cos:s=>Ws(s)||Oc(s)?Ks:ag(s)>=Da-Number.EPSILON?[-1,1]:(s=Rc(s),s[0]>Math.PI+Number.EPSILON?q.sub(q.cos(q.sub(s,[Math.PI,Math.PI]))):s[1]Ws(s)||Oc(s)?Ks:(s=Rc(s,Math.PI),s[0]>bs+Number.EPSILON&&(s=q.sub(s,[Math.PI,Math.PI])),s[0]<-bs+Number.EPSILON||s[1]>bs-Number.EPSILON?Lc:ht(Math.tan(s[0]),Math.tan(s[1]))),sec:s=>q.div([1,1],q.cos(s)),csc:s=>q.div([1,1],q.sin(s)),cot:s=>q.div([1,1],q.tan(s)),cosec:s=>q.csc(s),cotan:s=>q.cot(s),arcsin:s=>Ws(s)||s[1]<-1||s[0]>1?Ks:ht(s[0]<=-1?-bs:Math.asin(s[0]),s[1]>=1?bs:Math.asin(s[1])),arccos:s=>Ws(s)||s[1]<-1||s[0]>1?Ks:ht(s[1]>=1?0:Math.acos(s[1]),s[0]<=-1?Math.PI:Math.acos(s[0])),arctan:s=>ht(Math.atan(s[0]),Math.atan(s[1])),sinh:s=>ht(Math.sinh(s[0]),Math.sinh(s[1])),cosh:s=>s[1]<0?ht(Math.cosh(s[1]),Math.cosh(s[0])):s[0]>0?ht(Math.cosh(s[0]),Math.cosh(s[1])):ht(1,Math.cosh(Math.max(-s[0],s[1]))),tanh:s=>ht(Math.tanh(s[0]),Math.tanh(s[1])),sech:s=>q.div([1,1],q.cosh(s)),csch:s=>q.div([1,1],q.sinh(s)),coth:s=>q.div([1,1],q.tanh(s)),cosech:s=>q.csch(s)},Qn=K("+ \u2212 * \xD7 \xB7 / \xF7 // sup sub subsup"),Dc=K("sub sup subsup"),Ia=',';function jc(s,e){return Qn.includes(e)?s instanceof tr?!0:!(s instanceof jt)||!Qn.includes(s.fn)?!1:Dc.includes(s.fn)&&Dc.includes(e)?!0:Qn.indexOf(e)>Qn.indexOf(s.fn):!1}function lg(s,e,t){return jc(s,e)?`${t}`:t}function es(s,e){return s instanceof tr||s instanceof jt?`${e}`:e}function Nc(s){return s==="2"?"squared":s==="3"?"cubed":`to the power of ${s}`}var jt=class Na extends ss{constructor(e,t=[]){super(),this.fn=e,this.args=t}evaluate(e={}){let t=this.args.map(i=>i.evaluate(e));if(this.fn in e){let i=e[this.fn];if(typeof i=="function")return i(...t);if(typeof i=="number"&&t.length===1)return Me.mul(i,t[0]);throw ot.uncallableExpression(this.fn)}if(this.fn==="+")return Me.add(...t);if(this.fn==="\u2212")return Me.sub(...t);if(["*","\xB7","\xD7"].includes(this.fn))return Me.mul(...t);if(this.fn==="/")return Me.div(...t);if(this.fn==="sup")return Me.sup(...t);if($s(this.fn))return Me[this.fn](...t);if(this.fn==="(")return t[0];throw ot.undefinedFunction(this.fn)}interval(e={}){let t=this.args.map(i=>i.interval(e));if(this.fn in e){let i=e[this.fn];if(typeof i=="function")return re(i(...t.map(n=>n[0])),2);if(typeof i=="number"&&t.length===1)return q.mul([i,i],t[0]);if(Array.isArray(i)&&t.length===1)return q.mul(i,t[0]);throw ot.uncallableExpression(this.fn)}if(this.fn==="+")return q.add(...t);if(this.fn==="\u2212")return q.sub(...t);if(["*","\xB7","\xD7"].includes(this.fn))return q.mul(...t);if(this.fn==="/")return q.div(...t);if(this.fn==="sup")return q.sup(...t);if($s(this.fn))return q[this.fn](...t);if(this.fn==="(")return t[0];throw ot.undefinedFunction(this.fn)}substitute(e={}){return new Na(this.fn,this.args.map(t=>t.substitute(e)))}collapse(){return this.fn==="("?this.args[0].collapse():new Na(this.fn,this.args.map(e=>e.collapse()))}get simplified(){return this}get variables(){return Wt(ye(this.args.map(e=>e.variables)))}get functions(){return Wt([this.fn,...ye(this.args.map(e=>e.functions))])}toString(){let e=this.args.map(t=>jc(t,this.fn)?`(${t.toString()})`:t.toString());return this.fn==="\u2212"?e.length>1?e.join(" \u2212 "):`\u2212${e[0]}`:this.fn==="sup"?e.join("^"):this.fn==="sub"?e.join("_"):this.fn==="subsup"?`${e[0]}_${e[1]}^${e[2]}`:K("+ * \xD7 \xB7 / = < > \u2264 \u2265 \u2248").includes(this.fn)?e.join(` ${this.fn} `):_(this.fn,"(","[","{")?this.fn+this.args.join(", ")+Oa[this.fn]:_(this.fn,"!","%")?e[0]+this.fn:`${this.fn}(${e.join(", ")})`}toMathML(e={}){let t=this.args.map(r=>r.toMathML(e)),i=this.args.map((r,o)=>lg(r,this.fn,t[o]));if(this.fn in e){let r=t.map((o,a)=>({toString:()=>o,val:this.args[a]}));return e[this.fn](...r)}if(this.fn==="\u2212")return i.length>1?i.join('\u2212'):`\u2212${i[0]}`;if(_(this.fn,"+","=","<",">","\u2264","\u2265","\u2248")){let r=_c(this.fn);return i.join(`${r}`)}if(_(this.fn,"*","\xD7","\xB7")){let r=i[0];for(let o=1;o\xD7':"")+i[1]}return r}if(this.fn==="//")return i.join('/');if(this.fn==="sqrt")return`${i[0]}`;if(_(this.fn,"/","root")){let r=this.fn==="/"?"mfrac":"mroot",o=this.args.map((a,h)=>es(a,t[h]));return`<${r}>${o.join("")}`}if(_(this.fn,"sup","sub")){let r=[es(this.args[0],i[0]),es(this.args[1],t[1])];return`${r.join("")}`}return this.fn==="subsup"?`${[es(this.args[0],i[0]),es(this.args[1],t[1]),es(this.args[2],t[2])].join("")}`:_(this.fn,"(","[","{")?`${i.join(Ia)}`:_(this.fn,"!","%")?`${i[0]}${this.fn}`:this.fn==="abs"?`${i.join(Ia)}`:this.fn==="bar"?`${es(this.args[0],i[0])}\u203E`:this.fn==="vec"?`${es(this.args[0],i[0])}\u2192`:`${this.fn}${i.join(Ia)}`}toVoice(e={}){let t=this.args.map(n=>n.toVoice(e)),i=t.join(" ");if(this.fn in e){let n=t.map((r,o)=>({toString:()=>r,val:this.args[o]}));return e[this.fn](...n)}return _(this.fn,"(","[","{")?i:this.fn==="sqrt"?`square root of ${i}`:this.fn==="%"?`${i} percent`:this.fn==="!"?`${i} factorial`:this.fn==="/"?`${t[0]} over ${t[1]}`:this.fn==="//"?`${t[0]} divided by ${t[1]}`:this.fn==="sub"?i:this.fn==="subsup"?`${t[0]} ${t[1]} ${Nc(t[2])}`:this.fn==="sup"?`${t[0]} ${Nc(t[1])}`:Ys[this.fn]?t.join(` ${Ys[this.fn]} `):$s(this.fn)?`${this.fn} ${i}`:`${this.fn} of ${i}`}},tr=class extends ss{constructor(s){super(),this.items=s}evaluate(s={}){return this.collapse().evaluate(s)}interval(s={}){return this.collapse().interval(s)}substitute(s={}){return this.collapse().substitute(s)}get simplified(){return this.collapse().simplified}get variables(){return Wt(Nh(...this.items.map(s=>s.variables)))}get functions(){return this.collapse().functions}toString(){return this.items.map(s=>s.toString()).join(" ")}toMathML(s={}){return this.items.map(e=>e.toMathML(s)).join("")}toVoice(s={}){return this.items.map(e=>e.toVoice(s)).join(" ")}collapse(){return Ga(this.items).collapse()}};function La(s,e){if(e===2)return new og(s);if(!(!s||!e)){if(e===1&&s.length>1)return new Hc;if(e===3){if(isNaN(+s))throw ot.invalidExpression();return new Gi(+s)}if(e===4)return s in Ni?new Zs(Ni[s]):s in Xs?new Ce(Xs[s]):new Zs(s);if(e===5)return s in Xs?new Ce(Xs[s]):new Ce(s)}}function cg(s){let e=[],t="",i=0;for(let r of s){if(r==='"'){let a=i===2?0:2,h=La(t,i);h&&e.push(h),t="",i=a;continue}else if(i===2){t+=r;continue}let o=r.match(/[0-9.]/)?3:tg.includes(r)?4:ig.includes(r)?5:r.match(/\s/)?1:0;if(!o)throw ot.invalidCharacter(r);if(!i||i===3&&o!==3||i===4&&o!==4&&o!==3||i===5&&!(t+r in Xs)||i===1&&o!==1){let a=La(t,i);a&&e.push(a),t="",i=o}t+=r}let n=La(t,i);return n&&e.push(n),e}function pg(s){return s.length>1?new tr(s):s[0]instanceof Ce?new tr(s):s[0]}function dg(s,e){let t=[[]];for(let i of s)e(i)?t.push([]):O(t).push(i);return t}function Nt(s,e){return s instanceof Ce&&K(e).includes(s.o)}function Di(s){return s instanceof jt&&s.fn==="("?s.args[0]:s}function er(s,e){if(Nt(s[0],e))throw ot.startOperator(s[0]);if(Nt(O(s),e))throw ot.endOperator(O(s));for(let t=1;tNt(d,","));a.push(new jt(c,u.map(Gc)))}else Nt(n,"( [ {")?t.push([n]):O(t).push(n)}if(t.length>1)throw ot.unclosedBracket(O(t)[0].o);return Gc(t[0])}function zc(s,e,t=!1){let i=[],n=[],r=!1;function o(){if(r)throw ot.invalidExpression();n.length&&(i.push(n.length>1?new jt(e[0],n):n[0]),n=[])}for(let a of s)if(Nt(a,e)){if(r||!n.length)throw ot.invalidExpression();r=!0}else if(a instanceof Ce)o(),i.push(a),r=!1;else{let h=!t||a instanceof Gi;if(n.length&&!r&&h)throw ot.invalidExpression();n.push(a),r=!1}return o(),i}function Ga(s){if(s=s.filter(t=>!(t instanceof Hc)),!s.length)throw ot.invalidExpression();let e=s.findIndex(t=>Nt(t,"= < > \u2264 \u2265"));if(e===0)throw ot.startOperator(s[0]);if(e===s.length-1)throw ot.endOperator(s[0]);if(e>0){let t=Ga(s.slice(0,e)),i=Ga(s.slice(e+1));return new jt(s[e].o,[t,i])}if(Nt(s[0],"%!"))throw ot.startOperator(s[0]);for(let t=0;t1)throw ot.invalidExpression();return s[0]}function fg(s,e=!1,t){let i=ug(cg(s),t);return e?i.collapse():i}function mg(s,e){try{let t=Wt([...s.variables,...e.variables]),i=s.collapse(),n=e.collapse(),r=0;for(let o=0;o<5;++o){let a={};for(let c of t)a[c]=za[c]||Math.random()*5;let h=i.evaluate(a),l=n.evaluate(a);if(!(isNaN(h)||isNaN(l))){if(!x(h,l))return!1;r+=1}}return!!r}catch(t){return!1}}var Et={numEquals:mg,parse:Oe(fg)};var Uc='
';var gg=/[0-9+\-*/()^\s]+/g,vg=os(_t.shuffle(["happy","spongebob","sloth","party","robot","excited","cute","highfive1","applause","highfive2"])),wg=os(_t.shuffle(["minions","panther","dog","snape","what","door","horrible"]));function Ba(s,e,t={}){let i=m("div",{class:"msg-wrap","data-display":"flex"}),n=m("div",{class:"msg "+e},i);return t.class&&n.addClass(t.class),t.visible||i.hide(),_(e,"hint","question")?n.html=s:e==="img"?n.css("background-image",`url(${s})`):e==="video"&&m("iframe",{src:s,allowfullscreen:!0},n),i}var sr=class extends E{constructor(){super(...arguments);this.recentMessages=[];this.isOpen=!1;this.queuePromise=Promise.resolve()}ready(){var r;this.$course=this.parents("x-course")[0],this.hints=this.$course?JSON.parse(this.$course.$("#hints").text):{};let t=window.user;this.correct=os(_t.shuffle(this.hints.correct||[])),this.incorrect=os(_t.shuffle(this.hints.incorrect||[])),this.$toasts=this.$(".toasts"),this.$chat=this.$(".chat"),this.$chatBody=this.$(".chat-body"),this.$toasts.on("click",o=>{o.handled||this.open()}),this.$(".close").on("click",()=>this.close());let i=this.$(".chat-footer");if(this.$query=i.$(".input"),this.$query.onKey("Enter",o=>{o.preventDefault(),this.askQuestion(this.$query.text.trim()),this.$query.text=""}),this.$query.on("focus",()=>i.addClass("focus")),this.$query.on("blur",()=>i.removeClass("focus")),this.$(".hint").on("click",()=>{this.queue(this.hints.tutorial1),this.queue(t?this.hints.tutorial2:this.hints.account)}),this.$course&&((r=this.$course.userData)!=null&&r.messages))for(let o of this.$course.userData.messages)this.$chatBody.append(Ba(o.content,o.kind||"hint",{visible:!0}));if(!b.getCookie("sessionWelcome")&&this.$course){b.setCookie("sessionWelcome",1,60*60*4);let o=new Date().getHours(),a=o<12?"Morning":o<18?"Afternoon":"Evening";t?setTimeout(()=>this.showHint(`welcome${a}Named`,{variables:{name:t.shortName}}),3e3):b.getCookie("welcome")?(setTimeout(()=>this.showHint(`welcome${a}`),3e3),setTimeout(()=>this.queue(this.hints.account),4500)):(b.setCookie("welcome",1),setTimeout(()=>this.queue(this.hints.welcome),3e3),setTimeout(()=>this.queue(this.hints.tutorial1),4500))}}open(){this.isOpen||(this.isOpen=!0,this.$chat.enter("slide-up",200),this.$chatBody.scrollTop=this.$chatBody.scrollHeight,this.trigger("open"))}close(){this.isOpen&&(this.isOpen=!1,this.$query.blur(),this.trigger("close"),this.$chat.exit("slide-down",200))}queue(t,i="hint",n={}){this.queuePromise=this.queuePromise.then(()=>(this.display(t,i,n),wi(500)))}display(t,i="hint",n={}){let r=n.timeout||8e3;if(b.width<640&&(r*=.7),(n.toast==null?!0:n.toast)&&!this.isOpen){let h=Ba(t,i,n);h.setAttr("role","alert"),this.$toasts.append(h),h.enter("reveal-right"),setTimeout(()=>h.exit("reveal-right",400,0,!0),r),this.on("open",()=>h.exit("reveal",200,0,!0))}let a=Ba(t,i,{class:n.class,visible:!this.isOpen});this.$chatBody.append(a),this.isOpen&&(a.enter("reveal",300),pt(()=>this.$chatBody.scrollTop=this.$chatBody.scrollHeight,200))}showHint(t,i={}){if(_(t,"correct","incorrect")){let r=t==="correct"?this.correct():this.incorrect(),o=t==="correct"?3e3:5e3;if(this.queue(r,"hint",{class:i.class||t,timeout:o}),Math.random()<.2){let a=t==="correct"?vg():wg(),h="";this.queue(`${h}/images/gifs/${a}.gif`,"img",{timeout:o})}return{text:r}}let n=this.hints[t]||t;if(i.variables)for(let[r,o]of Object.entries(i.variables))n=n.replace(new RegExp("\\$"+r,"g"),o);return!i.force&&this.recentMessages.includes(t)?{text:n}:(this.recentMessages.push(t),setTimeout(()=>this.recentMessages.shift(),1e4),i.store!==!1&&this.$course&&this.$course.saveProgress({hints:[{content:n,kind:"hint"}]}),this.queue(n,"hint",{class:i.class}),{text:n})}askQuestion(t){if(!t)return;this.queue(t,"question"),this.$course&&this.$course.log("Tutor","ask",t);let i=(t.match(gg)||[]).filter(n=>n.length>=3&&!n.match(/^[\s0-9]+$/));if(i.length)try{let n=Et.parse(i[0],!0),r=Et.parse("="+n.evaluate());return this.queue(`${n.toMathML()}${r.toMathML()}`)}catch(n){console.log("Parse Error:",i[0])}this.$chatBody.addClass("loading"),Ne(this.attr("api"),{query:t}).then(n=>{this.$chatBody.removeClass("loading");let r=JSON.parse(n);for(let o of r)this.queue(o.content,o.kind)}).catch(n=>{this.$chatBody.removeClass("loading"),this.queue(this.hints.serverError),console.error("Tutor Error:",n)})}};sr=T([S("x-tutor",{template:Uc})],sr);var Wc='
';var Kc=m("div",{class:"var-overlay"},C),ir=class extends E{constructor(){super(...arguments);this.valueChange=!1}ready(){let t=this.attr("bind");if(!t)return;let[i,n,r]=t.split("|");[this.min,this.max,this.step]=r.split(",").map(l=>+l),this.name=i,this.model=this.getParentModel(),this.$(".content").bindModel(this.model),this.$progress=this.$(".progress"),this.setValue(+n);let o=20*(b.isMobile?1.5:1)/B((this.max-this.min)/this.step/12,1,3),a=0,h=0;for(let l of this.$$(".left, .right")){let c=l.hasClass("left")?-this.step:this.step;l.on("click",()=>{this.setValue(this.value+c),this.trigger("slide-end")})}ds(this,{start:l=>{a=l.x,h=this.value,this.addClass("on"),this.valueChange=!1,Kc.show(),Xt.addClass("grabbing")},move:l=>{let c=(l.x-a)/o;this.setValue(h+Rt(c)*this.step)},end:()=>{this.removeClass("on"),this.valueChange&&this.trigger("slide-end"),Kc.hide(),Xt.removeClass("grabbing")}})}setup(t,i){this.one("slide-end",()=>t.score(i))}setValue(t){let i=Rt(B(t,this.min,this.max),2);if(i===this.value)return;this.value=i,this.valueChange=!0,this.model&&(this.model[this.name]=i);let n=this.max-this.min;this.$progress.css("width",116*(i-this.min)/n+"px")}};ir=T([S("x-var",{template:Wc})],ir);var Xc='';var nr=class extends E{constructor(){super(...arguments);this.visible=!0}ready(){this.on("click",()=>{this.play(),setTimeout(()=>this.trigger("play"),400)})}play(){this.visible&&(this.visible=!1,this.exit("pop",400))}reset(){this.visible||(this.visible=!0,setTimeout(()=>this.enter("pop"),400))}};nr=T([S("x-play-btn",{template:Xc})],nr);var rr=class extends E{constructor(){super(...arguments);this.playing=!1}ready(){this.$icon=this.$("x-icon"),this.$("button").on("click",()=>this.toggle())}toggle(){this.playing?this.pause():this.play()}play(){this.playing||(this.playing=!0,this.$icon.setAttr("name","pause"),this.trigger("play"))}pause(){this.playing&&(this.playing=!1,this.$icon.setAttr("name","play"),this.trigger("pause"))}};rr=T([S("x-play-toggle",{template:''})],rr);var Yc='
';function Zc(s){let e=Math.floor(s/60),t=Math.floor(s%60);return e+":"+(t<10?"0":"")+t}var or=class extends E{ready(){let t=this.attr("src"),i=this.$(".video-wrap"),n=this.$("video"),r=this.attr("width"),o=this.attr("height");this.css("width",r+"px"),i.css("padding-bottom",+o/+r*100+"%"),n.setAttr("poster",this.attr("poster")||t.replace(/mp4$/,"jpg")),this.hasAttr("loop")&&(n._el.loop=!0),this.hasAttr("audio")||(n._el.muted=!0),n._el.preload=this.attr("preload")==="no"?"metadata":"auto",m("source",{src:t,type:"video/mp4"},n),this.hasAttr("credit")&&(this.$(".credit").text=this.attr("credit"));let a=this.$(".bar"),h=this.$(".progress"),l=this.$(".buffer"),c=this.$(".timecode"),u=new fs(this.$(".handle"),{$parent:a,moveY:!1}),d=this.video=n._el,g=this.width-110;b.onResize(()=>g=this.width-110),n.on("canplay",()=>{c.text=Zc(+d.duration)}),n.on("timeupdate",()=>{let v=d.currentTime/d.duration;h.css("width",v*100+"%"),c.text=Zc(+d.currentTime),u.setPosition(v*g,0),this.trigger("timeupdate",d.currentTime)}),n.on("progress",()=>{if(d.buffered.length<=0||d.duration<=0)return;let w=d.buffered.end(d.buffered.length-1)/d.duration*100;l.css("width",w+"%")}),n.on("ended",()=>{d.pause(),this.removeClass("playing"),this.trigger("end")});let y=()=>d.paused?this.play():this.pause(),f=v=>this.setTime(v/g*d.duration);this.hasAttr("hover")?(n.on("mouseover touchstart",()=>this.play()),n.on("mouseout touchend touchcancel",()=>this.pause())):n.on("click",y),this.hasAttr("controls")&&(this.$(".controls").show(),this.$(".play-pause-btn").on("click",y),u.on("start",()=>this.pause()),u.on("drag",({posn:v})=>f(v.x)),a.on("click",v=>f(v.offsetX)))}setTime(t){this.video.currentTime=t}play(){this.video.play(),this.addClass("playing"),this.trigger("play")}pause(){this.video.pause(),this.removeClass("playing")}};or=T([S("x-video",{template:Yc})],or);var ar=class extends E{constructor(){super(...arguments);this.isCompleted=!1;this.isReady=!1}created(){this.userData=window.progressData||JSON.parse(this.$("#userdata").text)||{},this.$steps=this.$$("x-step");for(let t of this.$steps)t.on("score",()=>this.trigger("score"));this.data.audio&&(this.audio=new Sn(this.data.audio))}ready(){this.$footer=this.$("footer"),this.$skipStep=this.$footer.$(".skip-step"),this.$progress=this.$(".sidebar-row.active x-progress"),this.$tutor=this.$("x-tutor"),this.$stepsWrap=this.$(".steps");let t=this.findStep(b.getHash()),i=this.findStep(this.userData.activeStep);this.$activeStep=i||this.$steps[0];for(let r of this.$steps){if(r.show(),r===this.$activeStep)break;r.complete()}if(this.userData.completed||b.getHash()==="full"||this.data.reveal)this.complete();else for(;this.$activeStep&&this.$activeStep.isReady&&!this.isCompleted;)this.nextStep();(t||i&&!this.userData.completed)&&this.goToStep(t||i,!1),this.$(".section-dev")&&this.complete();let n=this.$(".reveal-banner");setTimeout(()=>{this.isCompleted||(n.removeClass("off"),this.on("score complete",()=>n.addClass("off")))},1500),n.$(".complete").one("click",()=>this.complete()),C.onKey("Space",r=>{r.preventDefault(),this.nextStep(),n.addClass("off")}),this.$footer.$(".skip").on("click",()=>this.nextStep()),this.$footer.$(".show-all").on("click",()=>this.complete()),this.$footer.show(),this.isReady=!0,setTimeout(()=>this.addClass("ready"))}nextStep(){if(this.isCompleted)return;let t=this.$activeStep,i=this.$stepsWrap.height;do{if(t.complete(),t=this.$steps[this.$steps.indexOf(t)+1],!t)return this.complete(!0);t.show()}while(t.isReady);this.$stepsWrap.animate({height:[i+"px","auto"]},800),this.$activeStep=t,this.saveProgress({activeStep:t.id})}goToStep(t,i=!0){let n=this.$stepsWrap.height;for(let a of this.$steps){if(a.isShown||(this.$activeStep=a),a.show(),t.isShown&&!a.isReady)break;a.complete()}let r=t.positionTop-Math.max(50,(b.height-t.height)/2);i?(this.$stepsWrap.animate({height:[n+"px","auto"]},800),C.scrollTo(r)):C.scrollTop=r;let o=O(this.$steps);if(o.isShown&&o.isReady)return this.complete();this.$activeStep&&this.saveProgress({activeStep:this.$activeStep.id})}complete(t=!1){if(this.isCompleted)return;this.isCompleted=!0,this.$steps.forEach(n=>n.complete()),this.$activeStep=void 0;let i=this.$footer.$(".next-section");t?(this.$skipStep.exit("fade",200),i&&i.enter("pop")):(this.$skipStep.hide(),i&&i.show()),this.trigger("complete"),this.saveProgress({completed:!0}),this.log("Course","complete")}findStep(t){for(let i of this.$steps)if(i.id===t)return i}saveProgress(t){if(!this.isReady)return;let n=N(this.$steps.map(r=>r.scores.size))/+this.data.goals||0;this.$progress.setProgress(n),ql(`/course/${this.id}/${this.data.section}`,t)}log(t,i,n){if(window.ga&&this.isReady){let r=i+(n?":"+n:"");window.ga("send","event",t,r,this.id)}}};ar=T([S("x-course")],ar);var hr=class{constructor(){this.callbacks=[]}add(e){this.callbacks.push(e)}start(e=1e3){return pt(i=>{for(let n of this.callbacks)n(i)},e).promise}};function Qc(s,e){return s.every((t,i)=>x(t,e[i]))}function Jc(s,e){s.scale*=e.scale,s.x=s.x*e.scale+e.x,s.y=s.y*e.scale+e.y}function tp(s,e){return x(s.x,e.x)&&x(s.y,e.y)&&x(s.scale,e.scale)}function lr(s,e,t){if(t==="adding"){let i=s.strokeLength,n=e<.5?0:yt("cubic-in",e*2-1);s.css({"stroke-dasharray":i+"px","stroke-dashoffset":i*(1-n)+"px"})}else if(t==="deleting"){let i=s.strokeLength,n=e<.5?yt("cubic-in",2*e):1;s.css({"stroke-dasharray":i+"px","stroke-dashoffset":i*(2-n)+"px"})}}function ep(s,e){let t=[s],i=s.expr;for(;e.startsWith(i);){if(e===i)return t;let n=O(t).next;if(!n)return;t.push(n),i+=n.expr}}function sp(s,e,t=1){let i=t*Math.abs(e.x-s.x)/3,n=p.average(s,e).shift(0,i);return function(r){let o=(1-r)**2*s.x+2*r*(1-r)*n.x+r*r*e.x,a=(1-r)**2*s.y+2*r*(1-r)*n.y+r*r*e.y;return{x:o,y:a}}}function _a(s,e){return Math.max(e*s,.4)/s}function ze(s){return s instanceof Ae&&s.children.length>1||s instanceof zi?`(${s.expr})`:s.expr}function Qs(s,e){return e.length===1&&e[0].type==="mrow"?e[0]:new Ae(e,s)}var Gt=class s{constructor(e,t,i,n){this.type=e;this.equation=i;this.$element=n;this.children=[];this.status="";this.value="";this.customColor="";this.roundedMotion=!1;this.width=0;this.height=0;this.baseline=0;this.transform={x:0,y:0,scale:1};this.currentDimensions=[0,0,0];this.currentWorldTransform={x:0,y:0,scale:1};this.addChildren(t),n&&i.$row.append(n)}get expr(){return""}get log(){let e=this.children.map(t=>t.log);return`<${this.type}>${e.join("")}`}get color(){return this.customColor||(this.parent?this.parent.color:"")}static create(e,t){let i=e.nodeName.toLowerCase();if(_(i,"mn","mi","mo","mtext")){if(e.textContent==="placeholder")return new Ha(t);let r=e.getAttribute("mathvariant")||void 0;return new cr(i,e.textContent||"",t,r)}if(!_(i,"mrow","mfrac","mfenced","msqrt","mroot","msub","msup","msubsup","munder","mover","munderover","mspace"))return new Ka(e,t);if(i==="mfenced"&&e.getAttribute("open")==="["){let r=e.children.length,o=ye(Array.from(e.children,h=>Array.from(h.children,l=>s.create(l,t)))),a=new Wa(o,t,r);return new pr([a],t)}let n=Array.from(e.children,r=>s.create(r,t));switch(i){case"mrow":return new Ae(n,t);case"mfrac":return n=n.map(r=>Qs(t,[r])),new ja(n,t);case"mfenced":return n=[Qs(t,n)],new pr(n,t);case"msqrt":return n=[Qs(t,n)],new dr(i,n,t);case"mroot":return n=n.map(r=>Qs(t,[r])),new dr(i,n,t);case"msub":case"msup":case"msubsup":return n=n.map(r=>Qs(t,[r])),new zi(i,n,t);case"munder":case"mover":case"munderover":return n=n.map(r=>Qs(t,[r])),new Ua(i,n,t);case"mspace":return new Fa(t)}throw new Error(`Unknown element type tag ${e.nodeName}`)}get marginLeft(){return .1}get marginRight(){return .1}setTransform(e=0,t=0,i=1){this.transform.x=e,this.transform.y=t,this.transform.scale=i}get worldTransform(){let e=this,t=Object.assign({},this.transform);for(;e=e.parent;)Jc(t,e.transform);return t}get index(){return this.parent?this.parent.children.indexOf(this):-1}get next(){if(!this.parent)return;let e=this.parent.children.indexOf(this);return this.parent.children[e+1]}get prev(){if(!this.parent)return;let e=this.parent.children.indexOf(this);return this.parent.children[e-1]}addChildren(e,t=this.children.length){for(let i of this.children)i.type==="placeholder"&&i.deleteFromDom();for(let i of e)i.detach(),i.parent=this;this.children.splice(t,0,...e)}insertAfter(e){let t=this.parent.children.indexOf(this);this.parent.addChildren(e,t+1)}insertBefore(e){let t=this.parent.children.indexOf(this);this.parent.addChildren(e,t)}detach(){if(this.parent){let e=this.parent.children.indexOf(this);e>=0&&this.parent.children.splice(e,1),this.parent=void 0}}deleteFromDom(){this.parent&&this.detach(),this.$element&&this.$element.remove(),this.$element=void 0;for(let e of this.children.slice(0))e.deleteFromDom()}*parents(e=!1){let t=e?this:this.parent;for(;t;)yield t,t=t.parent}hasParent(e,t=!1){return Bt(this.parents(t),e)}hitTest(e){let{x:t,scale:i}=this.worldTransform,n=this.marginLeft*i*this.equation.fontSize,r=this.marginRight*i*this.equation.fontSize;if(nt(e.x,t-n,t+this.width*i+n+r))return this.hitTestChildren(e)||this}hitTestChildren(e){for(let t of this.children){let i=t.hitTest(e);if(i)return i}}measure(e=1){for(let t of this.children)t.measure(e)}clean(){for(let e of this.children)e.clean()}setStatus(e){this.status=e;for(let t of this.children)t.setStatus(e)}render(e){for(let h of this.children)h.render(e);if(!this.$element)return;let t=this.currentWorldTransform,i=this.currentWorldTransform=this.worldTransform,n=this.currentDimensions,r=this.currentDimensions=[this.width,this.height,this.baseline];if(tp(t,i)&&Qc(n,r)&&!this.status)return;if(!e){this.positionElement(i),this.drawElement(1,r[0],r[1],r[2],i.scale);return}this.status==="adding"&&this.positionElement(i);let o=i.y+this.baseline{if(!this.$element)return;let l=yt("cubic",h),c=_(this.status,"adding","deleting"),u=c?r[0]:tt(n[0],r[0],l),d=c?r[1]:tt(n[1],r[1],l),g=c?r[2]:tt(n[2],r[2],l),y=c?i.scale:tt(t.scale,i.scale,l);if(this.drawElement(h,u,d,g,y),!this.status){let f=a?a(l):p.interpolate(t,i,l);this.positionElement({x:f.x,y:f.y,scale:y})}})}positionElement(e){this.$element.setTransform(e,0,e.scale)}drawElement(e,t,i,n,r){}},yg="acegmnopqrsuvwxyz",Ps=1.1,Js=.2,qa=new Set(["=","\u2248","<",">","\u2264","\u2265"]),bg=document.createElement("canvas"),ip=bg.getContext("2d"),xg=Oe((s,e)=>(ip.font=`${e}px "Source Sans Pro", sans-serif`,ip.measureText(s).width)),cr=class extends Gt{constructor(t,i,n,r){super(t,[],n,m("text",{}));this.variant=r;this.setValue(i)}setValue(t){this.$element.text=this.value=t;let i=this.value.split("").every(r=>yg.includes(r));this.width=xg(t,this.equation.fontSize),this.height=(Ps-(i?.1:0))*this.equation.fontSize,this.baseline=this.height-Js*this.equation.fontSize;let n=this.type==="mtext"||this.variant==="normal";this.$element.setClass("font-normal",n||$s(this.value))}get expr(){return this.value==="xx"?'"xx"':this.type==="mtext"?`"${this.value}"`:this.value}get log(){return`<${this.type}>${this.value}`}get marginLeft(){if(this.type==="mo")return qa.has(this.value)?this.equation.isDisplay?.5:.35:_(this.value,"\u2221","\u25B3","!","%","\u2019")||_(this.value,"\u2026","\xB0")&&this.prev&&this.prev.type==="mn"?0:.25;if(this.type==="mi"){if(this.prev&&this.prev.type==="mn")return .1;if(this.prev&&this.prev.type==="mi")return .05;if(this.prev&&this.prev.type==="mfrac")return .15}return 0}get marginRight(){return this.type==="mo"?this.equation.isDisplay&&qa.has(this.value)?.5:_(this.value,"\u2221","\u25B3")?0:this.value==="\u2212"&&(!this.prev||qa.has(this.prev.value))?.1:.25:0}positionElement(t){if(!this.$element)return;let i=(this.equation.fontSize-this.baseline)*t.scale;this.$element.setTransform({x:t.x,y:t.y-i},0,t.scale)}drawElement(t,i,n,r,o){this.status==="adding"?this.$element.setAttr("opacity",t<.5?0:yt("cubic-in",t*2-1)):this.status==="deleting"&&this.$element.setAttr("opacity",t<.5?1-yt("cubic-in",2*t):0),this.$element.css("stroke-width",(1-o)*1.5+"px"),this.$element.css("color",this.color||"currentColor")}},Fa=class extends Gt{constructor(e){super("mspace",[],e),this.height=(Ps-.1)*e.fontSize,this.baseline=this.height-Js*this.equation.fontSize,this.width=e.fontSize*.2}get expr(){return" "}},Ae=class extends Gt{constructor(t,i,n,r=0){super("mrow",t,i);this.align=n;this.dx=r}addChildren(t,i=this.children.length){let n=[];for(let r of t)r.type==="mrow"?(n.push(...r.children),r.detach()):n.push(r);super.addChildren(n,i)}get expr(){return this.children.map(t=>t.expr).join(" ").replace(/− /,"\u2212")||"placeholder"}measure(t=1){if(super.measure(t),!this.children.length){this.height=this.width=this.baseline=0;return}this.baseline=Math.max(...this.children.map(n=>n.baseline)),this.height=this.baseline+Math.max(...this.children.map(n=>n.height-n.baseline));let i=0;for(let[n,r]of this.children.entries())r.setTransform(i,this.baseline-r.baseline),i+=r.width,nr.expr===this.align);n&&(this.transform.x=this.dx-n.transform.x-n.width/2)}this.width=i}},Ha=class extends Gt{constructor(e){let t=e.fontSize,i=`M${.1*t} ${.3*t}h${t/2}v${t/2}h-${t/2}Z`,n=m("path",{class:"placeholder",d:i});super("placeholder",[],e,n),this.width=.7*t,this.height=Ps*t,this.baseline=this.height-Js*t}get expr(){return"placeholder"}get marginLeft(){return 0}get marginRight(){return 0}},ja=class extends Gt{constructor(e,t){super("mfrac",e,t,m("line"))}get expr(){return this.children.map(e=>ze(e)).join("/")}measure(e){let t=this.hasParent(a=>a.type==="mfrac"||a.type==="matrix"),i=_a(e,!this.equation.isDisplay||t?.66:1),n=.1*this.equation.fontSize,[r,o]=this.children;super.measure(e*i),this.width=(Math.max(r.width,o.width)+2*n)*i,this.height=(r.height+o.height)*i,this.baseline=r.height*i+this.equation.fontSize*(Ps/2-Js),r.setTransform((this.width-r.width*i)/2,0,i),o.setTransform((this.width-o.width*i)/2,r.height*i,i)}drawElement(e,t,i,n){let r=n-this.equation.fontSize*(Ps/2-Js);this.$element.setLine({x:0,y:r},{x:t,y:r}),this.$element.setAttr("stroke",this.color||"currentColor"),lr(this.$element,e,this.status)}hitTestChildren(e){let{scale:t,y:i}=this.worldTransform,n=this.baseline-this.equation.fontSize*(Ps/2-Js),r=e.y<=i+n*t,o=this.children[r?0:1];return o.hitTestChildren(e)||o}},zi=class extends Gt{get expr(){let e=ze(this.children[0]);return this.type!=="msup"&&(e+="_"+ze(this.children[1])),this.type==="msup"&&(e+="^"+ze(this.children[1])),this.type==="msubsup"&&(e+="^"+ze(this.children[2])),e}measure(e){let[t,i,n]=this.children,r=this.type==="msup"?void 0:i,o=this.type==="msubsup"?n:this.type==="msup"?i:void 0,a=.05*this.equation.fontSize,h=_a(e,.65);t.measure(e),r&&r.measure(e*h),o&&o.measure(e*h);let l=o?o.height*h-.4*this.equation.fontSize:0,c=r?r.height*h-.5*this.equation.fontSize:0,u=o?o.width:0,d=r?r.width:0;this.width=t.width+a+Math.max(u,d)*h,this.height=t.height+l+c,this.baseline=t.baseline+l,t.setTransform(0,this.baseline-t.baseline),o&&o.setTransform(t.width+a,0,h),r&&r.setTransform(t.width+a,this.height-r.height*h,h)}clean(){if(super.clean(),this.children=this.children.filter(e=>e.type!=="mrow"||e.children.length),this.children.length===0)return this.detach();this.children.length===1&&(this.insertAfter(this.children),this.detach())}},Ua=class extends Gt{get expr(){let e=this.children[0].expr;return this.type!=="munder"&&(e+="_"+ze(this.children[1])),this.type==="mover"&&(e+="^"+ze(this.children[1])),this.type==="munderover"&&(e+="^"+ze(this.children[2])),e}measure(e){super.measure(e)}},pr=class extends Gt{constructor(e,t){super("mfenced",e,t,m("path"))}get expr(){return`(${this.children.map(e=>e.expr).join(",")})`}get marginLeft(){return .2}get marginRight(){return .2}measure(e){super.measure(e);let t=this.children[0];this.height=t.height+2,this.baseline=t.baseline+1;let i=1+this.height/this.equation.fontSize,n=.1*this.equation.fontSize;this.width=t.width+2*(i+n),t.setTransform(i+n,1)}drawElement(e,t,i){let n=Math.min(2+i/this.equation.fontSize,5),r=i-4,o=t-n,a=`M${n},2c${-2*n/3},${.15*r},${-n},${.32*r},${-n},${r/2}s${n/3},${.35*r},${n},${r/2}M${o},2c${2*n/3},${.15*r},${n},${.32*r},${n},${r/2}s${-n/3},${.35*r},${-n},${r/2}`;this.$element.setAttr("d",a),this.$element.css("stroke",this.color||"currentColor"),lr(this.$element,e,this.status)}clean(){super.clean(),this.children.length||this.detach()}},dr=class extends Gt{constructor(e,t,i){super(e,t,i,m("path"))}get expr(){return`sqrt(${this.children.map(e=>e.expr).join(", ")})`}get marginLeft(){return .2}get marginRight(){return .2}measure(e){super.measure(e);let t=this.children[0];this.height=t.height+2,this.baseline=t.baseline+2;let i=Math.min(16,3+5*this.height/this.equation.fontSize),n=.05*this.equation.fontSize;this.width=t.width+i+2*n,t.setTransform(i+n,2)}drawElement(e,t,i){let n=Math.min(16,3+5*i/this.equation.fontSize),r=i-2,o=`M0,${.55*r}L${.18*n},${.51*r}L${.45*n},${r}L${n},2L${t},2`;this.$element.setAttr("d",o),this.$element.css("stroke",this.color||"currentColor"),lr(this.$element,e,this.status)}clean(){super.clean(),this.children.length||this.detach()}},Wa=class extends Gt{constructor(t,i,n){super("matrix",t,i,m("g"));this.rows=n;this.cols=Math.floor(t.length/n)}get expr(){return`${this.children.map(t=>t.expr).join(", ")}`}measure(t){super.measure(t);let i=.6*this.equation.fontSize,n=z(a=>Math.max(...z(h=>this.children[a*this.cols+h].height,this.cols)),this.rows),r=z(a=>Math.max(...z(h=>this.children[h*this.cols+a].width,this.rows)),this.cols);this.height=N(n)+(this.rows-1)*i/2,this.width=N(r)+this.cols*i,this.baseline=(this.height+Ps*this.equation.fontSize)/2;let o=0;for(let a=0;a{this.checkForResize()&&this.equation.resize()}),(n=this.$body.$("x-blank, x-blank-mc"))==null||n.on("solve",r=>{Zt(()=>this.replace(r.solution,"#0f82f2"),r.restore?0:200)})}deleteFromDom(){var t;super.deleteFromDom(),(t=this.$body)==null||t.remove(),this.$body=void 0,this.$measure=void 0}replace(t,i){var o;let n=Number.isNaN(+t)?"mtext":"mn",r=new cr(n,t,this.equation);r.customColor=i,this.insertAfter([r]),(o=this.$body)==null||o.off("resize"),this.deleteFromDom(),this.equation.resize()}checkForResize(){var r,o;let t=this.height,i=this.width,n=this.baseline;return this.height=((r=this.$body)==null?void 0:r.height)||0,this.width=((o=this.$body)==null?void 0:o.width)||0,this.baseline=this.$measure.bounds.top-this.$body.bounds.top,!(x(t,this.height)&&x(i,this.width)&&x(n,this.baseline))}positionElement(t){var i,n;(i=this.$body)==null||i.css({left:t.x+"px",top:t.y+"px"}),x(t.scale,1)||(n=this.$body)==null||n.css("transform",`scale(${t.scale})`)}get expr(){var t;return`"${(t=this.$body)==null?void 0:t.text}"`}get log(){return`${this.expr}`}};var Be=class extends Re{constructor(t,i,n=0,r="=",o=18,a=!0){super();this.$row=t;this.$overlay=i;this.fontSize=o;this.isDisplay=a;this.isReady=!0;this.deletedNodes=new Set;this.root=new Ae([],this,r,n)}setValue(t){let i=Array.isArray(t)?t.map(n=>Gt.create(n,this)):this.parse(t);for(;this.root.children.length;)this.root.children[0].deleteFromDom();this.root.addChildren(i),this.updateDescription(),this.resize()}updateDescription(){try{let t=Et.parse(this.root.expr).toVoice();this.$row.setAttr("aria-label",t)}catch(t){this.$row.setAttr("aria-label","Invalid expression: "+this.root.expr)}}resize(){this.root.measure(),this.root.render()}parse(t){var a;let i=new DOMParser,n=Et.parse(t).toMathML(),r=i.parseFromString(`${n}`,"text/xml");if(((a=r.firstChild)==null?void 0:a.nodeName)==="parsererror")throw new Error(r.firstChild.textContent);let o=r.firstChild.childNodes;return Array.from(o,h=>Gt.create(h,this))}find(t){let[i,n]=t.split("`");i=i.replace(/[–-]/g,"\u2212");let r=+n||1,o=this.root.children.slice(0),a=0;for(;o.length;){let h=o.shift(),l=h instanceof Ae?void 0:ep(h,i);if(l&&(a+=1,a===r))return l;o.unshift(...h.children)}throw new Error(`Can't find element ${i}.`)}animate(t=1200){return D(this,null,function*(){this.isReady=!1,this.root.clean(),this.root.measure();let i=new hr;this.root.render(i),this.trigger("resize",{height:this.root.height});for(let n of this.deletedNodes)n.render(i);yield i.start(t);for(let n of this.deletedNodes)n.deleteFromDom();this.root.setStatus(""),this.deletedNodes.clear(),this.isReady=!0})}addTermAfter(t,i){let n=O(i?this.find(i):this.root.children),r=this.parse(t);n.insertAfter(r);for(let o of r)o.setStatus("adding");this.updateDescription()}addTermBefore(t,i){let n=i?this.find(i)[0]:this.root.children[0],r=this.parse(t);n.insertBefore(r);for(let o of r)o.setStatus("adding");this.updateDescription()}deleteTerm(t){for(let i of this.find(t))i.setStatus("deleting"),i.detach(),this.deletedNodes.add(i);this.updateDescription()}replaceTerm(t,i){let n=this.find(t),r=this.parse(i);n[0].insertBefore(r);for(let o of r)o.setStatus("adding");for(let o of n)o.setStatus("deleting"),o.detach(),this.deletedNodes.add(o);this.updateDescription()}moveTermAfter(t,i){let n=this.find(t);for(let o of n)o.roundedMotion=!0;O(i?this.find(i):this.root.children).insertAfter(n),this.updateDescription()}moveTermBefore(t,i){let n=this.find(t);for(let o of n)o.roundedMotion=!0;(i?this.find(i)[0]:this.root.children[0]).insertBefore(n),this.updateDescription()}moveTermToStart(t){let i=this.find(t);for(let n of i)n.roundedMotion=!0;this.root.children[0].insertBefore(i),this.updateDescription()}wrapTerms(t,...i){let n=i.map(o=>this.find(o));for(let o of n)for(let a of o)a.roundedMotion=!0;let r=this.parse(t);for(let o of r)o.setStatus("adding");n[0][0].insertBefore(r);for(let[o,a]of n.entries()){let h=this.find("$"+(o+1))[0];h.insertAfter(a),h.deleteFromDom()}this.updateDescription()}unwrapTerm(t,i=1){let n=this.find(t),r=n[0],o=1;for(;o<=i;)r=r.parent,r instanceof Ae&&(r=r.parent),o+=1;r.insertAfter(n),r.setStatus("deleting"),r.detach(),this.deletedNodes.add(r),this.updateDescription()}get leftSide(){let t=this.root.children.findIndex(i=>i.expr==="=");return this.root.children.slice(0,t-1)}get rightSide(){let t=this.root.children.findIndex(i=>i.expr==="=");return this.root.children.slice(t+1)}};var np='
';var rp=1200,$g=400,op=1200,ti=600,Bi=16,ur=class extends E{constructor(){super(...arguments);this.rows=[];this.isReady=!0;this.topOffset=4;this.currentHeight=0;this.currentStep=0;this.nextEvents={};this.backEvents={}}ready(){this.$svg=this.$("svg"),this.$lastRow=this.$svg.$("g"),this.$overlay=this.$(".overlay"),this.$legend=this.$(".legend-box"),this.$steps=this.$legend.$$("li"),this.$back=this.$(".back"),this.$next=this.$(".next");let t=+this.attr("dx")||0;this.equation=new Be(this.$lastRow,this.$overlay,t);let i=this.$(".math"),n=i?Array.from(i._el.children):[];this.equation.setValue(this.attr("expr")||n),this.currentHeight=this.topOffset+this.$lastRow.height+16,this.$svg.css("height",this.currentHeight+"px"),this.equation.on("resize",({height:o})=>{let a=this.topOffset+o+Bi;Math.abs(a-this.currentHeight)this.goBack()),this.$next.on("click",()=>this.goNext()),this.$steps[0].show(),b.onResize(()=>{let o=this.$svg.width/2;for(let a of[this.$lastRow,this.$overlay])a.css("transform",`translate(${o}px, ${this.topOffset}px)`);for(let a of this.rows)a.$el.css("transform",`translate(${o}px, ${a.top}px)`)});let r=this.$overlay.$$("x-blank, x-blank-mc");r.length&&(this.$next.addClass("hide"),Promise.all(r.map(o=>o.onPromise("solve"))).then(()=>setTimeout(()=>this.goNext(),rp)))}setup(t){this.one("next",({step:i})=>t.score("algebra-flow-"+(i-1)))}newRow(){return D(this,null,function*(){let t=this.$lastRow.copy(!0,!1),i=this.equation.root.height;this.rows.push({$el:t,height:i,top:this.topOffset}),this.$lastRow.insertBefore(t),b.redraw(),this.topOffset+=i+Bi,this.currentHeight=this.topOffset+i+Bi;for(let n of[this.$lastRow,this.$overlay])n.animate({transform:`translate(${this.$svg.width/2}px, ${this.topOffset}px)`},ti);yield this.$svg.animate({height:this.currentHeight+"px"},ti).promise})}hideLastRow(){return D(this,null,function*(){if(!this.rows.length)return;let t=this.rows.pop();this.topOffset=t.top;for(let i of[this.$lastRow,this.$overlay])i.animate({transform:`translate(${this.$svg.width/2}px, ${t.top}px)`},ti);this.currentHeight=t.top+this.$lastRow.height+Bi,this.$svg.animate({height:this.currentHeight+"px"},ti),yield t.$el.exit("fade",ti/2,ti/2).promise,t.$el.remove()})}onNextStep(t){this.nextEvents=t}onBackStep(t){this.backEvents=t}goNext(){return D(this,null,function*(){if(!this.isReady||!this.equation.isReady||this.currentStep>=this.$steps.length-1)return;this.isReady=!1;let t=this.currentStep+1;this.$steps[t].hasClass("new-row")&&(yield this.newRow(),yield wi($g)),t in this.nextEvents&&(yield this.nextEvents[t](this.equation),yield this.equation.animate(op),yield wi(rp)),yield this.go(t),this.trigger("next",{step:t}),this.isReady=!0})}goBack(){return D(this,null,function*(){if(!this.isReady||!this.equation.isReady||this.currentStep<=0)return;let t=this.currentStep-1;this.isReady=!1,this.currentStep in this.backEvents&&(yield this.backEvents[this.currentStep](this.equation),yield this.equation.animate()),this.$steps[this.currentStep].hasClass("new-row")&&this.hideLastRow(),yield this.go(t),this.trigger("back",{step:t}),this.isReady=!0})}go(t){return D(this,null,function*(){this.$steps[t].show();let i=this.$steps[t].height+"px";this.$steps[t].hide(),this.$legend.animate({height:i},800).promise.then(()=>this.$legend.css("height","auto"));let n=this.currentStep;this.currentStep=t,this.trigger("step",t),yield this.$steps[n].exit("fade",400).promise,this.$back.setClass("hide",t<=0),this.$next.setClass("hide",t>=this.$steps.length-1),yield this.$steps[t].enter("fade",400).promise})}};ur=T([S("x-algebra-flow",{template:np})],ur);var ap='
+
\u2212
\xD7
\xF7
\u03C0
';function cp(s){let e=s.prev;e&&_(e.tagName,"MO","MI","MN")?e.insertBefore(s):e?O(e.children).append(s):s.parent.hasClass("math")||(s.parent.prev?s.parent.prev.append(s):s.parent.parent.insertBefore(s))}function Pg(s){let e=s.next;if(e&&_(e.tagName,"MO","MI","MN"))return e.insertAfter(s);e?e.children[0].prepend(s):s.parent.hasClass("math")||(s.parent.next?s.parent.next.prepend(s):s.parent.parent.insertAfter(s))}function Tg(s){let e=s.parent;for(;e.parent.tagName!=="MFRAC"||!e.prev;){if(e.hasClass("math"))return;e=e.parent}e.prev.append(s)}function Sg(s){let e=s.parent;for(;e.parent.tagName!=="MFRAC"||!e.next;){if(e.hasClass("math"))return;e=e.parent}e.next.prepend(s)}function Eg(s){let e=s.prev,t=s.parent;if(e&&_(e.tagName,"MO","MI","MN"))e.remove(),t.children.length<=1&&t.addClass("empty");else if(!e&&!t.prev&&!t.hasClass("math")){let i=t.parent;i.insertBefore(s);for(let n of i.children)for(let r of n.children)i.insertBefore(r);i.remove(),s.parent.children.length<=1&&s.parent.addClass("empty")}else cp(s)}function Ts(s,e){e.insertBefore(s),e.parent.removeClass("empty"),s.children.length&&s.children[0].append(e)}function hp(s,e){"abcdefghijklmnopqrstuvwxyz\u03C0".includes(e)?Ts(m("mi",{text:e}),s):"0123456789.".includes(e)?Ts(m("mn",{text:e}),s):"+\u2212\xB1\xD7\xF7<>\u2264\u2265=%!".includes(e)?Ts(m("mo",{text:e,value:e}),s):e==="frac"?Ts(m("mfrac",{html:''}),s):e==="sqrt"?Ts(m("msqrt",{html:''}),s):_(e,"^","sup")?Ts(m("msup",{html:''}),s):e==="brackets"||"([{|".includes(e)?Ts(m("mfenced",{html:'',type:"("}),s):")]}".includes(e)&&!s.next&&s.parent.parent.tagName==="MFENCED"&&s.parent.parent.insertAfter(s)}function lp(s,e){let t=s.$$(`${e}:first-child, *:not(${e}) + ${e}`);for(let i of t)if(i.parent.tagName!=="MFRAC")for(;i.next&&i.next.tagName===e.toUpperCase();)i.text+=i.next.text,i.next.remove()}var Mg="This is not a valid mathematical expression.",Cg="Fill in all empty placeholders in the expression.",Ag={"+":"addition","\xD7":"multiplication","/":"fractions or division","\u2212":"subtraction",sqrt:"square roots","^":"powers"};function Ss(s,e){if(s instanceof Text)return s.textContent||"";if(s.hasClass("cursor"))return"";let t=s.childNodes;return s.tagName==="MI"?s.text+(e?" ":""):s.tagName==="MFENCED"?"("+Ss(t[0],e)+")":s.tagName==="MSUP"?"^("+Ss(t[0],e)+")":s.tagName==="MFRAC"?`(${Ss(t[0],e)})/(${Ss(t[1],e)})`:s.tagName==="MSQRT"?"sqrt("+Ss(t[0],e)+")":t.map(i=>Ss(i,e)).join("")}function kg(s,e){try{return{expr:Et.parse(s,!0,{variables:e})}}catch(t){return{error:t instanceof ot?t.message:Mg}}}function Vg(s,e,t){let i=s.variables;if(e.length){let n=i.find(o=>!e.includes(o));if(n){let o=zh(n,t||e);return o?`Did you mean \u201C${o}\u201D instead of \u201C${n}\u201D?`:`There shouldn\u2019t be a variable called \u201C${n}\u201D.`}let r=e.find(o=>!i.includes(o));if(r)return`Your expression should contain \u201C${r}\u201D.`}}function Ig(s,e){if(e.length){let t=s.functions.find(i=>!e.includes(i));if(t)return`This expression should not contain ${Ag[t]||"\u201C"+t+"\u201D"}.`}}function Lg(s,e,t=.001){try{return x(s.evaluate(),e.evaluate(),t)}catch(i){return!1}}var fr=class extends E{constructor(){super(...arguments);this.isDone=!1;this.shortVar=!1;this.lastAttempt="";this.errorCount=0;this.hints=[];this.fns=[];this.vars=[];this.validate=void 0}ready(){if(this.$math=this.$(".math"),this.$textarea=this.$("textarea"),this.$cursor=this.$(".cursor"),this.$error=this.$(".error-message"),this.solution=Et.parse(this.attr("solution")),this.hasAttr("numeric")&&(this.numeric=+this.attr("precision")||.01),this.vars=this.hasAttr("vars")?K(this.attr("vars")):this.solution?this.solution.variables:[],this.hasAttr("fns")&&(this.fns=K(this.attr("fns"))),this.solution&&this.fns.push(...this.solution.functions),this.fns.includes("/")&&!this.fns.includes("\xD7")&&this.fns.push("\xD7"),this.hasAttr("hints")&&(this.hints=K(this.attr("hints"))),this.hasAttr("substitutions")){this.substitutions={},this.autocomplete=this.vars.slice(0);for(let n of this.attr("substitutions").split("|"))if(n.trim()){let[r,o]=n.split(":");this.autocomplete.push(r.trim()),this.substitutions[r.trim()]=Et.parse(o)}}for(let n of["solution","precision","vars","fns","vars-required","substitutions"])this.removeAttr(n);this.shortVar=this.hasAttr("short-var");let t=K(this.attr("keys")||"+ \u2212 \xD7 \xF7 frac sup sqrt brackets"),i=this.$(".keys");for(let n of i.children)t.includes(n.data.type)?(n.on("pointerdown",r=>r.preventDefault()),n.on("pointerup",()=>{hp(this.$cursor,n.data.type),this.check()})):n.remove();this.on("pointerdown",n=>this.onPointerdown(n)),this.$textarea.on("focus",()=>this.onPointerdown()),this.$textarea.on("blur",()=>this.onBlur()),this.$textarea.on("key",n=>this.handleKey(n))}setup(t,i,n){var r;this.$step=t,(r=n==null?void 0:n.scores)!=null&&r.includes(i)&&this.solve(),this.on("solve",()=>{t.addHint("correct"),t.score(i)})}focus(){this.trigger("pointerdown")}onPointerdown(t){if(this.isDone)return;t&&t.preventDefault&&t.preventDefault(),this.addClass("active"),this.$textarea.focus();let i=t&&t.target?k(t.target):this;if(i.tagName==="X-EQUATION"||i.hasClass("math")){let n=this.$math.children,r=N(n.map(a=>a.outerWidth))/2;(t?Vt(t).x=5&&this.$step.addHint(`Hmmm\u2026 maybe try ${this.solution.toMathML()}?`)}check(){if(this.error=void 0,this.value=Ss(this.$math,this.shortVar).trim(),!this.value)return;if(this.$math.$(".empty"))return this.error=Cg;let t=kg(this.value,this.vars);if(t.error)return this.error=t.error;let i=this.substitutions?t.expr.substitute(this.substitutions):t.expr;if(this.numeric&&Lg(this.solution,i,this.numeric))return this.solve();if(this.validate){let o=this.validate(t.expr)||{};if(o.isCorrect)return this.complete(t.expr);if(o.error)return this.error=o.error}if(this.solution&&Et.numEquals(this.solution,i))return this.complete(t.expr);let n=Vg(i,this.vars,this.autocomplete);if(n)return this.error=n;let r=Ig(i,this.fns);if(r)return this.error=r}complete(t){this.isDone||(this.isDone=!0,this.removeClass("has-error active"),this.addClass("done"),this.$textarea.blur(),this.shortVar||lp(this.$math,"mi"),lp(this.$math,"mn"),this.trigger("solve",{expr:t}))}solve(){this.$math.removeClass("empty"),this.$math.html=this.solution.toMathML(),this.complete(this.solution)}};fr=T([S("x-equation",{template:ap})],fr);var Og={opacity:[0,1],transform:["translateX(-50px)","none"]},Rg={error:"You\u2019ve already had this expression before. Try simplifying it."},Dg="You have to fully simplify this expression. The correct solution is $0.",mr=class extends E{constructor(){super(...arguments);this.rowCount=1;this.previousAnswers=[];this.isSolved=!1;this.maxRows=6;this.steps=[];this.hints=[]}created(){this.$table=this.$("table tbody"),this.lastRowContent=this.$table.$("tr:last-child").html}ready(){this.hasAttr("max-rows")&&(this.maxRows=+this.attr("max-rows")),this.hasAttr("steps")&&(this.steps=this.attr("steps").split("|")),this.hasAttr("hints")&&(this.hints=this.attr("hints").split("|")),this.removeAttr("steps"),this.removeAttr("hints"),this.setupEquation(this.$("x-equation"))}setup(t,i,n){var r;this.$step=this.$equation.$step=t,(r=n==null?void 0:n.scores)!=null&&r.includes(i)&&this.solve(),this.on("solve",()=>{t.addHint("correct"),t.score(i)}),this.on("hint",o=>t.addHint(o))}setupEquation(t){this.$equation=t,this.$equation.$step=this.$step,t.one("solve",i=>this.onSolveRow(i.expr)),t.hints=this.hints,t.validate=i=>{let n=this.previousAnswers.includes(i.toString());return(this.validate?this.validate(i,n):void 0)||(n?Rg:{})}}onSolveRow(t){if(this.trigger("solve-row",{expr:t,$math:this.$equation.$math}),this.isFinal&&this.isFinal(t))return this.trigger("solve");if(this.isSolved)return;if(this.rowCount+=1,this.previousAnswers.push(t.toString()),this.rowCount>this.maxRows){let n=this.$equation.solution.toMathML();this.trigger("hint",Dg.replace("$0",n)),this.trigger("solve")}let i=m("tr",{html:this.lastRowContent},this.$table);i.animate(Og,400,500),this.setupEquation(i.$("x-equation")),setTimeout(()=>this.$equation.focus(),1200)}solve(){if(this.isSolved=!0,this.steps.length){let t=this.$table.$("tr:last-child"),i=this.lastRowContent.replace(//,'');for(let n of this.steps){let r=m("tr",{html:i},this.$table),o=r.$(".math.fill"),a=Et.parse(n);o.html=a.toMathML(),t.insertBefore(r),this.trigger("solve-row",{expr:a,$math:o})}}this.$equation.solve()}};mr=T([S("x-equation-system")],mr);var Ya=Math.PI/2;function gr(s){if(rt(s))return[s];if(St(s))return s.points;if(it(s))return[s.p1,s.p2];if(qt(s))return gr(s.shape(!0));if(U(s))return[s.c.shift(s.r,0),s.c.shift(-s.r,0),s.c.shift(0,s.r),s.c.shift(0,-s.r)];if(Ze(s))return s.extremes;if(Pe(s)||Dt(s)){let e=[s.start,s.end];Pe(s)&&e.push(s.c);let t=s.radius;for(let[i,n]of[[t,0],[0,t],[-t,0],[0,-t]]){let r=s.c.shift(i,n);Ft.prototype.contains.call(s,r)&&e.push(r)}return e}return[]}function It(...s){return G.aroundPoints(function*(){for(let e of s)for(let t of gr(e))yield t}())}function pp(s,e){let t=It(...Array.from(s,n=>n.transformed.rotate(-e))),i=t.p.shift(t.w/2,t.h/2).rotate(e).shift(-t.w/2,-t.h/2);return new G(i,t.w,t.h)}function wr(s,e,t){return!s.size&&!e.size?new lt(0,100,0,100):G.aroundPoints(function*(){for(let i of s.values())if(i.transformed&&(i.props.status!=="hidden"||t))for(let n of gr(i.transformed))yield n;for(let i of e.values())if(i.path)for(let n of gr(i.path))yield n}()).bounds}function _i(s,e,t){if(rt(e))return s.contains(e);if(Ye(e))return V.collision(s.polygon,e);if(Wo(e))return e.collision(s);if(it(e))return Q(e,s).length>0||s.contains(e.p1);if(qt(e))return _i(s,e.shape(!0),t);if(U(e))return t==="geo"?Q(e,s).length>0||s.contains(e.at(0)):e.collision(s);if(Pe(e)||Dt(e)){let i=new V(e.c,e.start,e.at(.25),e.at(.5),e.at(.75),e.end);return V.collision(s.polygon,i)}if(Ze(e)){let i=new V(...oe(0,1,.125).map(n=>e.at(n)));return V.collision(s.polygon,i)}return!1}var vr=class{constructor(e){this.$parent=e;this.visible=!1;this.$el=m("div",{class:"tile-error",hidden:!0},e.$html),this.$text=m("span",{},this.$el),this.$button=m("button",{text:"Select Errors"},this.$el),this.$button.on("click",()=>{e.selection.clear(),this.error&&e.selection.select(this.error.locations||[]),this.hide()})}show(e,t){var i;this.visible&&this.error===t||(this.visible=!0,this.$el.setTransform(e),this.$text.html=t.message,this.$button.toggle(!!((i=t==null?void 0:t.locations)!=null&&i.length)),this.$el.enter("pop",200),this.error=t)}hide(){this.visible&&(this.visible=!1,this.$el.exit("pop",200),this.error=void 0)}},Xa=new Map;function _e(s,e=!0){if(!s||!e||!b.theme.isDark)return s;if(Xa.has(s))return Xa.get(s);let t=$t.fromHex(s),i=t.hsl;nt(i[2],30,70)||(i[2]=100-i[2]);let n=$t.fromHsl(...i);n.a=t.a;let r=n.hex;return Xa.set(s,r),r}var yr=Oe(s=>{let e=$t.fromHex(s),[t,i,n]=["r","g","b"].map(o=>e[o]<=128?0:2*e[o]-255);return new $t(t,i,n).hex}),br=Oe(s=>$t.from(s).brightness<195?"#fff":"#000");function dp(s){let e=s==null?void 0:s.items;if(e!=null&&e.length)for(let t=0;t+d);let r=n.length>0?+n[0]:t?t[0]:0,o=n.length>1?+n[1]:t?t[1]:e;if(x(r,o))return[r-1,o+1,1];i&&(o+=.01*(o-r));let a=Math.floor(Math.abs(e)/Ng),h=(o-r)/a,l=Math.floor(Math.log10(h)),c=Math.pow(10,l),u=Gg.find(d=>c*d<=h)*c;return o=u*Math.ceil(o/u),r=u*Math.floor(r/u),[r,o,u]}function xr(s,e=4e3){let t=k(`x-alert[key=${s}]`);return t==null?void 0:t.open(e)}function up(s,e){let t=new p(-s/2,-e/2);return new G(t,s,e)}function Qa(s,e,t){if(!s)return;let i={},n=0;for(let r of s){let o=e(r);if(o&&(i[r.id]=o,n+=1),t&&n>t)break}return n?i:void 0}function fp(s,e,t,i,n){return m("use",{href:`/icons.13d4c88a.svg#${s}`,fill:e,width:t,height:t,x:i==null?void 0:i.x,y:i==null?void 0:i.y},n)}function mp(s=0){return 20*1.2**s}function*ke(s,e=!1){for(let t of s){let i=t.is("group");(!i||e)&&(yield t),i&&(yield*ks(ke(t.children,e)))}}function*gp(s){let e=new Set;for(let t of s)if(t.group){let i=t.group;for(;i.group;)i=i.group;if(e.has(i))continue;e.add(i),yield i}else yield t}function Ja(s){let e=Math.min(...s.map(i=>Math.min(...i.map(n=>n.y)))),t=Math.max(...s.map(i=>Math.max(...i.map(n=>n.y))));return[e,t]}function Ve(s,e,t){return s.hasAttr(e)?s.attr(e)!=="no":t}function vp(s){let e=K(s).map(t=>+t);return e.length===1?[e[0],e[0],e[0],e[0]]:e.length===2?[e[0],e[1],e[0],e[1]]:e.length===3?[e[0],e[1],e[2],e[1]]:e}function wp(s){let e=s.split(",");return[e[0]!=="no",(e.length>1?e[1]:e[0])!=="no"]}var yp={hasGeoModel:!0,pi:Math.PI,point:(s,e)=>s!==void 0&&e!==void 0?new p(s,e):void 0,angle:(s,e,t)=>s&&e&&t?new kt(s,e,t):void 0,line:(s,e)=>s&&e&&!s.equals(e)?new vt(s,e):void 0,ray:(s,e)=>s&&e&&!s.equals(e)?new Xo(s,e):void 0,segment:(s,e)=>s&&e&&!s.equals(e)?new Y(s,e):void 0,circle:(s,e)=>s&&e?new wt(s,e):void 0,arc:(s,e,t)=>s&&e&&t?new Ft(s,e,t):void 0,sector:(s,e,t)=>s&&e&&t?new Yo(s,e,t):void 0,polygon:(...s)=>s.every(e=>e)?new V(...s):void 0,polyline:(...s)=>s.every(e=>e)?new te(...s):void 0,triangle:(s,e,t)=>s&&e&&t?new Pi(s,e,t):void 0,rectangle:(s,e,t)=>s?new G(s,e,t):void 0,distance:p.distance,round:(s,e=0)=>Rt(s,e),sqrt:Math.sqrt,floor:Math.floor,ceil:Math.ceil,intersections:Q};function $r(s,e,t){let i=t,n;for(let r of s){let o=e(r);o!==void 0&&o`,is=class extends E{constructor(){super(...arguments);this.labelSuffix=["",""];this.gridSize=[1,1];this.showGrid=!1;this.showXAxis=!1;this.showYAxis=!1;this.showLabels=!1}setupCoordinates(t,i={}){this.$svg=t,t.addClass("canvas"),this.proportional=!!i.proportional,this.padding=vp(this.attr("padding")||i.padding||"0"),Ve(this,"grid",i.showGrid||!1)&&(this.$grid=m("g",{class:"grid"}),t.prepend(this.$grid),this.showGrid=!0);let n=this.attr("axes")||(i.showAxes?"yes":"no");[this.showXAxis,this.showYAxis]=wp(n),(this.showXAxis||this.showYAxis)&&(m("defs",{html:zg},t),this.$axes=m("g",{class:"axes"}),t.prepend(this.$axes),this.axisNames=(this.attr("axis-names")||",").split(",")),this.$axes&&Ve(this,"labels",!0)&&(this.labelSuffix=(this.attr("label-suffix")||",").split(","),this.showLabels=!0),(this.showLabels||this.axisNames)&&(this.$labels=m("g",{class:"labels"},t)),this.resize()}resize(){this.css("max-width","none");let t=+this.attr("width")||this.width,i=+this.attr("height")||(this.hasAttr("width")?t:this.height);this.css("max-width",t+"px"),this.$svg.setAttr("width",t),this.$svg.setAttr("height",i),this.$svg.setAttr("viewBox",`0 0 ${t} ${i}`);let n=this.padding;this.viewportBounds=new lt(n[3],t-n[1],n[0],i-n[2]),this.updatePlotBounds(),this.positionElements(t,i)}updatePlotBounds(t){let[i,n,r]=Za(this.attr("x-axis"),this.viewportBounds.dx,t==null?void 0:t.xRange),[o,a,h]=Za(this.attr("y-axis"),this.viewportBounds.dy,t==null?void 0:t.yRange),l=Math.abs(this.viewportBounds.dx/(n-i)),c=Math.abs(this.viewportBounds.dy/(a-o)),u=Math.min(l,c),d=this.proportional?l/u:1,g=this.proportional?c/u:1;this.plotBounds=new lt(d*i,d*n,g*a,g*o),this.plotScale=this.proportional?u:(l+c)/2,this.gridSize=[r,h];let[y,f]=[this.plotBounds,this.viewportBounds];this.plotToViewportMatrix=[[f.dx/y.dx,0,f.xMin-y.xMin/y.dx*f.dx],[0,f.dy/y.dy,f.yMin-y.yMin/y.dy*f.dy]];let v=i>0?d*i:n<0?d*n:0,w=o>0?g*o:a<0?g*a:0;this.plotOrigin=new p(v,w),this.drawAxes()}drawAxes(){let[t,i]=[this.plotBounds,this.viewportBounds],n=this.toViewportCoords(this.plotOrigin),[r,o]=this.gridSize;if(this.$grid&&this.$grid.removeChildren(),this.$axes&&this.$axes.removeChildren(),this.$labels&&this.$labels.removeChildren(),this.showGrid||this.showXAxis){let a=r*Math.trunc(t.xMin/r+.01);for(let h=a;ho=void 0,move:a=>{let h=B(Math.round((a.x-n.xMin)*r),0,this.steps-1);this.points[h]=this.toPlotCoords(new p(n.xMin+h/r,a.y)),o&&this.interpolate(o,h),o=h,this.redraw()},end:()=>this.snap()})}interpolate(t,i){in).map(n=>[n.x,n.y]),i=qo.bestPolynomial(t);if(i){for(let n=0;nt}ready(){let t=m("svg",{},this);if(this.$plot=m("g",{class:"plot"},t),this.$overlay=m("g",{class:"overlay"},t),this.setupCoordinates(t,{showGrid:!0,showAxes:!0,padding:"20"}),this.hasAttr("fn")){let i=Et.parse(this.attr("fn"),!0);this.setFunctions(n=>i.evaluate({x:n}))}Ve(this,"crosshairs",!0)&&(this.crosshairGrid=+this.attr("crosshair-grid")||10,this.setupCrosshairs(t))}setPoints(t,i=1){let n=t.map((r,o)=>new p(o+i,r));this.setSeries(n)}setSeries(...t){let i=Math.max(...t.map(o=>O(o).x)),[n,r]=Ja(t);this.updatePlotBounds(new lt(0,i,n,r)),this.$plot.removeChildren();for(let o of t)this.drawLinePlot(o);this.getCrosshairPosn=o=>t[0].reduce((a,h)=>Math.abs(h.x-o.x)<=Math.abs(a.x-o.x)?h:a)}setFunctions(...t){let[i,n]=[this.plotBounds,this.viewportBounds],r=t.map(l=>{let c=[];for(let u=n.xMin;u{let c=Pt(B(l.x,i.xMin,i.xMax),h);return new p(c,t[0](c))}}drawLinePlot(t){let i=m("g",{},this.$plot),n=m("path",{},i),r=this.plotBounds;t=t.filter(a=>a.y>=r.yMax&&a.y<=r.yMin);let o=t.map(a=>this.toViewportCoords(a));this.isAnimated?pt(a=>{let h=t.findIndex(l=>l.x>r.xMin+a*r.dx);n.points=o.slice(0,h)},Tp):n.points=o}drawPoints(t){let i=m("g",{},this.$plot),n=this.plotBounds;for(let r of t){let o=this.toViewportCoords(r),a=m("circle",{r:4,cx:o.x,cy:o.y},i);if(this.isAnimated){a.hide();let h=Tp*(r.x-n.xMin)/(n.xMax-n.xMin);setTimeout(()=>a.show(),h)}}}setupCrosshairs(t){let i=m("g",{class:"crosshair"},t),n=m("path",{},i),r=m("circle",{r:4},i),o=m("text",{},i),a=0,h=l=>{let c=this.getCrosshairPosn(this.toPlotCoords(l));if(x(c.x,a))return;a=c.x;let u=this.toViewportCoords(c),d=this.toViewportCoords(this.plotOrigin);r.setCenter(u),n.points=[new p(d.x,u.y),u,new p(u.x,d.y)],o.text=`(${Ot(c.x,5,!1)}, ${Ot(c.y,5,!1)})`;let g=o.width,y=u.x+8+g20?u.y-7:u.y+18)};kl(t,{enter:()=>i.show(),move:l=>h(l),exit:()=>i.hide()})}};Tr=T([S("x-coordinate-system")],Tr);var ei=class{constructor(e,t){this.$canvas=e;this.defaultCallbacks=t;this.callbacks=new WeakMap;this.global=[];this.isMoving=!1;this.shiftKey=!1;this.altKey=!1;this.cancelled=!1;document.addEventListener("keydown",i=>this.checkKeys(i)),document.addEventListener("keyup",i=>this.checkKeys(i)),document.addEventListener("visibilitychange",()=>{this.shiftKey=this.altKey=!1}),this.$root=Xt,e.css("touch-action","none"),e.on("pointerdown",i=>this.startEvent(i)),C.onKey("Escape",()=>this.cancel()),t.hover&&e.on("pointermove",i=>{this.isMoving||t.hover({posn:me(i,e),event:i,target:i.target})})}checkKeys(e){this.shiftKey=e.shiftKey,this.altKey=e.altKey}listen(e,t){this.callbacks.set(e._el,t),e.hasParent(this.$canvas)||(e.css("touch-action","none"),e.on("pointerdown",i=>this.startEvent(i)))}listenAll(e){this.global.push(e)}startEvent(e){var d,g,y;if(e.handled||e.button)return;this.isMoving=!0,this.cancelled=!1,e.preventDefault(),this.checkKeys(e);let t=e.pointerId,i=e.target,n=this.getCallbacks(i);"shiftKey"in e&&(this.shiftKey=e.shiftKey),n.blurInput!==!1&&((d=b.getActiveInput())==null||d.blur());let r=me(e,this.$canvas),o=r,a=!1,h;if(this.constrainInBox){let f=this.$canvas.boundsRect;h=new lt(f.p.x,f.p.x+f.w,f.p.y,f.p.y+f.h)}let l=f=>{var $,I,A,M;if(f.pointerId&&f.pointerId!==t)return;if(f.preventDefault(),this.checkKeys(f),this.cancelled)return c(f);let v=Vt(f);if(h&&(v=v.clamp(h)),v=v.transform(this.$canvas.inverseTransformMatrix),p.distance(v,o)<.5)return;if(!a){let P={posn:r,event:f,target:i};($=n.start)==null||$.call(n,P);for(let j of this.global)(I=j.start)==null||I.call(j,P)}let w={posn:v,startPosn:r,lastPosn:o,event:f,target:i};(A=n.move)==null||A.call(n,w);for(let P of this.global)(M=P.move)==null||M.call(P,w);!a&&n.cursor!==!1&&this.grabbing(),o=v,a=!0},c=f=>{var w,$,I,A,M,P;if(f.pointerId&&f.pointerId!==t)return;f.preventDefault(),this.checkKeys(f),C.off("pointermove",l),C.off("pointerstop",c);let v={posn:r,event:f,target:i};(w=n.up)==null||w.call(n,v);for(let j of this.global)($=j.up)==null||$.call(j,v);if(a){let j={posn:o,lastPosn:o,startPosn:r,event:f,cancelled:this.cancelled,target:i};(I=n.end)==null||I.call(n,j);for(let ne of this.global)(A=ne.end)==null||A.call(ne,j)}else if(!this.cancelled){(M=n.click)==null||M.call(n,v);for(let j of this.global)(P=j.click)==null||P.call(j,v)}this.grabbing(!1),this.isMoving=this.cancelled=!1},u={posn:r,event:e,target:i};(g=n.down)==null||g.call(n,u);for(let f of this.global)(y=f.down)==null||y.call(f,u);C.on("pointermove",l),C.on("pointerstop",c)}grabbing(e=!0){this.$root.setClass("grabbing",e)}getCallbacks(e){for(;e&&e!==this.$canvas._el;){let t=this.callbacks.get(e);if(t&&(!t.checkIfActive||t.checkIfActive()))return t;e=e.parentNode||void 0}return this.defaultCallbacks}cancel(){this.cancelled=!0}};function _g(s,e){if(typeof s=="string"){let t=ct(s);return i=>{var n;return(n=t(e))==null?void 0:n.equals(i)}}return typeof s=="function"?s:t=>s.equals(t)}function th(s,e,t){let i=e.map(g=>_g(g,s.model)),n=re(void 0,e.length),r=Ke(),o=[],a=({point:g})=>o.push(g),h=t.maxErrors||4,l=0,c=({path:g})=>{t.onBegin&&t.onBegin(g)},u=()=>{n.every(g=>g)&&(t.onComplete&&t.onComplete(!0),s.off("add:path",d),s.off("begin:path",c),s.off("add:point",a),r.resolve(n))},d=({path:g})=>{let y=g.value;if(y){for(let[f,v]of i.entries())if(!n[f]&&v(y))return n[f]=g,t.onCorrect&&t.onCorrect(g,f),l=0,o=[],u();g.delete();for(let f of o)f.delete();if(o=[],!(it(y)&&y.length<1))if(l+=1,l>=h){let f=n.findIndex(w=>!w),v=e[f];if(typeof v!="function"){let w=s.drawPath(v,{animated:1e3});n[f]=w,t.onHint&&t.onHint(w,f),l=0,u()}}else t.onIncorrect&&t.onIncorrect(g)}};return s.on("begin:path",c),s.on("add:path",d),s.on("add:point",a),r.promise}function Mp(s,e){return m("text",{target:s.attr("target")||void 0,class:s.attr("label-class")||s.attr("class")||void 0,"data-when":s.data.when,style:e?`color: ${e}`:void 0,"text-anchor":"middle"})}function Sp(s,e){let t=[];for(let i of e.paths)i!==s&&i.value&&t.push(i.value.transform(e.plotToViewportMatrix));return t}var qg=new wt(new p(0,-9),12);function Ep(s,e,t){for(let i of t)if(e.every(n=>!Q(qg.translate(i),n).length))return i;return t[0]}function Cp(s,e){let t=s.value.transform(e.plotToViewportMatrix),i=s.$el;if(it(t)){let n=t.perpendicularVector,r=t.angle;n.y>=0&&(n=n.scale(-1),r+=Math.PI);let o=[];for(let l of[.5,.35,.65])for(let c of[-15,5])o.push(t.at(l).add(n.scale(c)));if(!e.labelPositioning)return[o[0],r];let a=Sp(s,e),h=Ep(t,a,o);return i.hasAttr("mark")&&(h=h.add(t.unitVector.scale(12))),[h,r]}if(Pe(t))return[t.at(.5).subtract(t.c).scale(.6).add(t.c).shift(0,5)];if(Dt(t)){let n=new vt(t.start,t.end),r=n.perpendicularVector.y>=0,o=n.angle+(r?Math.PI:0);return[t.at(.5).add(n.perpendicularVector.scale(r?14:5)),o]}if(qt(t)){let n=(+i.attr("size")||(t.isRight&&!i.hasAttr("round")?20:t.radius))+8;return[t.b.add(t.bisector.unitVector.scale(n+5)).shift(0,3)]}if(rt(t)){let n=i.hasClass("move")?10:8,r=[t.shift(n,-n),t.shift(-n,-n),t.shift(n,10+n),t.shift(-n,10+n)];if(!e.labelPositioning)return[r[0]];let o=Sp(s,e);return[Ep(t,o,r)]}return St(t)?[t.centroid.shift(0,5)]:U(t)?[t.c.shift(0,5)]:[]}var Sr=class{constructor(e,t,i,n){this.$parent=e;this.$el=i;this.color="";this.label="";this.isPending=!1;this.isLocked=!1;this.components=[];this.dependencies=[];this.fixedLabel=!1;this.name=n||e.model.getKey(),e.shapes.set(this.name,this),e.model.watch(r=>{let o=r[this.name];this.$el.css("display",o?"block":"none"),this.$label&&this.$label.css("display",o?"block":"none"),o&&this.redraw(o),e.queueLabelPositioning()}),this.color=i.css("color")||"",this.setValue(t),i.hasAttr("label")&&this.setLabel(i.attr("label"))}get value(){return this.$parent.model[this.name]}get type(){var e;return(e=this.value)==null?void 0:e.type}get locked(){return this.isLocked}get isHidden(){return this.isPending||this.$el.hasAttr("hidden")||this.$el.hasClass("transparent")}setValue(e){e instanceof Function?this.$parent.model.setComputed(this.name,e):this.$parent.model[this.name]=e}setLabel(e,t,i){this.$label||(this.$label=Mp(this.$el,t),this.$parent.$objLabels.append(this.$label));let n=bn(e);if(this.$parent.model.watch(r=>this.$label.text=n(r)||""),this.fixedLabel=!!i,i){let r=ct(i);this.$parent.model.watch(o=>{this.$label.setTransform(r(o).shift(0,5))})}this.updateLabelPosition()}setColor(e){this.color=e,this.$el.css("color",e);for(let t of this.dependencies)t.setColor(e);this.$label&&this.$label.css("color",e)}updateLabelPosition(){if(!this.$label||!this.value||this.fixedLabel)return;let[e,t]=Cp(this,this.$parent);this.$label.setTransform(e,t)}select(){this.$el.addClass("selected"),this.$el.parent.append(this.$el);for(let e of this.dependencies)e.select()}deselect(){this.$el.removeClass("selected");for(let e of this.dependencies)e.deselect()}hover(e=!1){if(!e){if(this.$parent.hovering===this)return;this.$parent.hovering&&this.$parent.hovering.unhover(),this.$parent.hovering=this}this.$el.addClass("hover");for(let t of this.dependencies)t.hover(!0)}unhover(e=!1){if(!e){if(this.$parent.hovering!==this)return;this.$parent.hovering=void 0}this.$el.removeClass("hover");for(let t of this.dependencies)t.unhover(!0)}delete(e=300){return D(this,null,function*(){this.$parent.shapes.delete(this.name);for(let t of this.components)t.deselect();this.$label&&this.$label.exit("fade",e,0,!0),yield this.removeElement(e),this.$parent.model[this.name]=void 0})}},Ie=class extends Sr{constructor(t,i,n,r,o=!1){r||(r=m("circle",{}));super(t,i,r,n);this.$parent.hidePoints||t.$points.append(this.$el),t.points.add(this),this.projectionId=t.model.getKey(),this.projectionOffset=void 0,t.model.watch(a=>{this.projection=a[this.projectionId],this.projection&&(this.projectionOffset===void 0&&(this.projectionOffset=this.projection.offset(this.$parent.model[this.name])),this.$parent.model[this.name]=this.projection.at(this.projectionOffset))}),this.lock(o)}setValue(t){t instanceof Function?(this.project(void 0),this.$parent.model.setComputed(this.name,t)):(t&&this.projection&&(t=this.projection.project(t),this.projectionOffset=this.projection.offset(t)),this.$parent.model[this.name]=t)}redraw(t){let i=t.transform(this.$parent.plotToViewportMatrix);this.$el.setCenter(i),this.$halo&&this.$halo.setCenter(i),this.$pulse&&this.$pulse.setCenter(i)}removeElement(t){return D(this,null,function*(){this.$parent.points.delete(this),yield this.$el.exit("pop",t,0,!0).promise})}distance(t){return this.value?p.distance(t,this.value):1/0}lock(t=!0){this.isLocked=t,this.$el.setClass("move",!t),t?this.$el.removeAttr("tabindex"):this.$el.setAttr("tabindex",0)}project(t){if(this.projectionOffset=void 0,typeof t=="string"){let i=ct(t);this.$parent.model.setComputed(this.projectionId,i)}else t?this.$parent.model.setComputed(this.projectionId,()=>t.value):this.$parent.model[this.projectionId]=void 0}makeIntersection({path1:t,path2:i,index:n}){this.setValue(r=>{if(!r[t.name]||!r[i.name])return;let o=Q(r[t.name],r[i.name]);return o[Math.min(n,o.length-1)]}),this.lock()}addHalo(){this.$halo=m("circle",{class:"halo",r:18},this.$parent.$pulses),this.$halo.setCenter(this.$el.center),this.$halo.enter("pop")}removeHalo(){return D(this,null,function*(){this.$halo&&(this.$halo.exit("pop",500,0,!0),this.$halo=void 0)})}pulsate(){this.$pulse=m("circle",{class:"pulse",r:8},this.$parent.$pulses),this.$pulse.setCenter(this.$el.center),this.$el.one("mouseover pointerdown focus",()=>{this.$pulse&&this.$pulse.remove(),this.$pulse=void 0})}},qe=class extends Sr{constructor(e,t,i,n){super(e,t,n||m("path"),i),e.$paths.append(this.$el),e.paths.add(this)}get locked(){return this.isLocked||!this.components.length||this.components.every(e=>e.locked)}redraw(e){let t=e.transform(this.$parent.plotToViewportMatrix);this.$el.draw(t,{box:this.$parent.viewportRect})}distance(e){return this.value?p.distance(e,this.value.project(e)):1/0}removeElement(e){return D(this,null,function*(){this.$parent.paths.delete(this),yield this.$el.exit("draw",e,0,!0).promise})}setComponents(e,t){this.components=this.dependencies=e,this.setValue(()=>{let i=e.map(n=>n.value);if(!i.some(n=>n===void 0))return t(...i)})}};var qi=class{constructor(e){this.$parent=e}enable(){}down(e){}start(e){}move(e,t){}end(e){}hover(e){}click(e){}cancel(){}snapToGrid(e){return this.$parent.snapToGrid?e.round(this.$parent.snapToGrid):e}snapToPoint(e,t){if(this.snapPoint=this.$parent.getPointAt(t),this.snapPoint)return e.$el.setClass("move",!this.snapPoint.locked),e.setValue(this.snapPoint.value);if(this.snapIntersect=this.$parent.getIntersectionAt(t),this.snapIntersect)return e.$el.removeClass("move"),e.setValue(this.snapIntersect.posn);if(!this.$parent.snapToGrid&&(this.snapPath=this.$parent.getPathAt(t),this.snapPath))return e.setValue(this.snapPath.value.project(t));e.$el.addClass("move"),e.setValue(this.snapToGrid(t))}getOrMakePointAt(e){let t=this.$parent.getPointAt(e);if(!t){t=new Ie(this.$parent,this.snapToGrid(e));let i=this.$parent.getIntersectionAt(e);if(i)t.makeIntersection(i);else if(!this.$parent.snapToGrid){let n=this.$parent.getPathAt(e);n&&t.project(n)}this.$parent.trigger("add:point",{point:t})}return t}showPendingPointAt(e){var n,r,o;let t=((n=this.$parent.getIntersectionAt(e))==null?void 0:n.posn)||((o=(r=this.$parent.getPathAt(e))==null?void 0:r.value)==null?void 0:o.project(e)),i=!!t;if(this.$parent.$pendingPoint.toggle(i),i){let a=this.$parent.toViewportCoords(t||e);this.$parent.$pendingPoint.setCenter(a)}}},Fi=class extends qi{constructor(){super(...arguments);this.isMoving=!1}enable(){}down(t){this.obj=this.$parent.getPointAt(t)||this.$parent.getPathAt(t),this.obj||this.$parent.deselect();let i=this.$parent.selection;i!==this.obj&&(i&&i.components.includes(this.obj)||this.$parent.select(this.obj))}start(){this.obj&&(this.isMoving=!0,this.obj.isPending=!0,this.$parent.updateIntersections(),this.$parent.trigger("move",{obj:this.obj}))}move(t,i){if(!(!this.obj||this.obj.locked||this.$parent.locked))if(this.obj instanceof qe){let n=t.subtract(i);for(let r of this.obj.components)r.locked||r.setValue(r.value.add(n))}else this.obj instanceof Ie&&this.obj.setValue(this.snapToGrid(t))}end(){this.obj&&(this.isMoving=!1,this.obj.isPending=!1,this.snapPoint||(this.snapIntersect?this.obj.makeIntersection(this.snapIntersect):this.snapPath&&this.obj.project(this.snapPath)),this.$parent.trigger("moveEnd",{path:this.obj}),this.obj=void 0,this.$parent.updateIntersections())}hover(t){if(this.isMoving)return;let i=this.$parent.getPointAt(t)||this.$parent.getPathAt(t),n=i&&!this.$parent.locked&&!i.locked,r=i&&this.$parent.canSelect;this.$parent.setCursor(n?"grab":r?"pointer":"default"),n||r?i.hover():this.$parent.hovering&&this.$parent.hovering.unhover()}},Er=class extends Fi{down(e){this.$parent.deselect(),this.obj=this.getOrMakePointAt(e),this.$parent.select(this.obj)}hover(e){let t=this.$parent.getPointAt(e);if(t)return this.$parent.setCursor(this.$parent.locked||t.locked?"default":"grab"),this.$parent.$pendingPoint.hide(),t.hover();this.$parent.hovering&&this.$parent.hovering.unhover(),this.$parent.setCursor("crosshair"),this.showPendingPointAt(e)}},si=class extends qi{enable(){this.$parent.setCursor("crosshair")}down(t){this.$parent.deselect(),this.startPoint=this.getOrMakePointAt(t)}start(t){this.startPoint&&(this.$parent.$pendingPoint.hide(),this.endPoint=new Ie(this.$parent,t),this.endPoint.isPending=!0,this.endPoint.$el.addClass("pending"),this.path=new qe(this.$parent,void 0),this.path.setComponents([this.startPoint,this.endPoint],this.expr),this.path.isPending=!0,this.$parent.updateIntersections(),this.$parent.trigger("begin:path",{path:this.path,start:this.startPoint}))}move(t){if(!this.startPoint||!this.path||!this.endPoint)return;if(p.distance(t,this.startPoint.value)<20/this.$parent.plotScale)return this.endPoint.setValue(this.snapToGrid(t));this.snapToPoint(this.endPoint,t)}end(){if(!this.startPoint||!this.path||!this.endPoint)return;this.path.isPending=!1,this.endPoint.isPending=!1,this.startPoint.value.equals(this.endPoint.value)?(this.endPoint.delete(),this.path.delete(),this.path=this.endPoint=void 0):this.snapPoint?(this.path.setComponents([this.startPoint,this.snapPoint],this.expr),this.endPoint.delete(),this.endPoint=void 0):this.snapIntersect?this.endPoint.makeIntersection(this.snapIntersect):this.snapPath&&this.endPoint.project(this.snapPath),this.endPoint&&(this.$parent.trigger("add:point",{point:this.endPoint}),this.endPoint.$el.removeClass("pending"));let t=this.path;this.startPoint=this.endPoint=this.path=void 0,t&&(this.$parent.trigger("add:path",{path:t}),this.$parent.updateIntersections())}hover(t){let i=this.$parent.getPointAt(t);if(i)return this.$parent.$pendingPoint.hide(),i.hover();this.$parent.hovering&&this.$parent.hovering.unhover(),this.showPendingPointAt(t)}cancel(){this.endPoint&&this.endPoint.delete(),this.path&&this.path.delete(),this.$parent.$pendingPoint.hide(),this.startPoint=this.endPoint=this.path=void 0}},Mr=class extends si{expr(e,t){return new Y(e,t)}},Cr=class extends si{expr(e,t){return new wt(e,p.distance(e,t))}},Ar=class extends si{expr(e,t){return new G(e,t.x-e.x,t.y-e.y)}},kr=class extends si{expr(e,t){return new Y(e,t).perpendicularBisector}},Ap=(s,e,t)=>new kt(s,e,t).bisector,Vr=class extends qi{enable(){}down(t){if(this.$parent.deselect(),!this.firstPoint)this.firstPoint=this.getOrMakePointAt(t),this.firstPoint&&this.firstPoint.addHalo();else if(this.secondPoint){this.path.isPending=this.thirdPoint.isPending=!1,this.thirdPoint.$el.removeClass("pending"),this.firstPoint.removeHalo(),this.secondPoint.removeHalo(),this.snapPoint?(this.path.setComponents([this.firstPoint,this.secondPoint,this.snapPoint],Ap),this.thirdPoint.delete(),this.thirdPoint=void 0):this.snapIntersect?this.thirdPoint.makeIntersection(this.snapIntersect):this.snapPath&&this.thirdPoint.project(this.snapPath);let i=this.path,n=this.thirdPoint;this.firstPoint=this.secondPoint=this.thirdPoint=this.path=void 0,n&&this.$parent.trigger("add:point",{point:n}),this.$parent.trigger("add:path",{path:i}),this.$parent.updateIntersections()}else{if(this.secondPoint=this.getOrMakePointAt(t),!this.secondPoint)return;this.secondPoint.addHalo(),this.thirdPoint=new Ie(this.$parent,this.secondPoint.value),this.thirdPoint.$el.addClass("pending"),this.path=new qe(this.$parent,void 0),this.path.setComponents([this.firstPoint,this.secondPoint,this.thirdPoint],Ap),this.path.isPending=this.thirdPoint.isPending=!0}}hover(t){if(this.$parent.$pendingPoint.hide(),this.thirdPoint){this.snapToPoint(this.thirdPoint,t),this.$parent.setCursor(this.snapPoint?"pointer":"crosshair");return}let i=this.$parent.getPointAt(t);if(i)return this.$parent.setCursor("pointer"),i.hover();this.$parent.hovering&&this.$parent.hovering.unhover(),this.$parent.setCursor("crosshair"),this.showPendingPointAt(t)}cancel(){this.firstPoint&&this.firstPoint.removeHalo(),this.secondPoint&&this.secondPoint.removeHalo(),this.thirdPoint&&this.thirdPoint.delete(),this.path&&this.path.delete(),this.firstPoint=this.secondPoint=this.thirdPoint=this.path=void 0}};var kp='
';var Ir=class extends is{constructor(){super(...arguments);this.shapes=new Map;this.points=new Set;this.paths=new Set;this.intersections=new Set;this.snapToGrid=0;this.locked=!1;this.hidePoints=!1;this.canSelect=!1;this.canIntersect=!1;this.canProject=!0;this.labelPositioning=!1;this.cursor="default"}ready(){let t=this.children.filter(h=>h.tagName==="SVG")[0];if(this.hasAttr("complex")&&(this.setAttr("label-suffix",",i"),this.setAttr("axis-names","Real, Imaginary"),this.setAttr("axes","true"),this.setAttr("grid","true")),!this.hasAttr("x-axis")&&!this.hasAttr("y-axis")){let h=+this.attr("grid"),l=+this.attr("width")||this.width,c=+this.attr("height")||l;this.setAttr("x-axis",h?`-0.5,${l/h-.5},1`:`0,${l},1`),this.setAttr("y-axis",h?`${c/h-.5},-0.5,1`:`${c},0,1`),h&&this.setAttr("snap",1)}this.setupCoordinates(t,{proportional:!0}),this.viewportRect=this.viewportBounds.rect,this.model=this.getParentModel()||le({}),this.model.hasGeoModel||this.model.assign(yp),this.$paths=m("g",{class:"paths"},t),this.$pulses=m("g",{class:"pulses"},t),this.$points=m("g",{class:"points"},t),this.$objLabels=m("g",{class:"labels"},t),this.snapToGrid=this.hasAttr("snap")?+this.attr("snap")||1:0,this.hidePoints=this.hasAttr("no-points"),this.canIntersect=Ve(this,"intersections",!1),this.canProject=Ve(this,"projections",!0),this.canSelect=Ve(this,"selectable",!1),this.labelPositioning=Ve(this,"label-positioning",!0),this.hasClass("sticky")&&this.css("top",`calc(50vh - ${this.height/2}px)`),this.queueLabelPositioning=ve(()=>{for(let h of this.shapes.values())h.updateLabelPosition()},0,!0);let i=t.$$("path[x], path[\\:d], circle");for(let h of i){let l=h.hasAttr("x")?ct(h.attr("x")):void 0,c=h.attr("name");if(h.hasAttr(":d"))this.$paths.append(h),h.bindModel(this.model);else if(h.tagName==="PATH")this.$paths.append(h),new qe(this,l,c,h);else{this.$points.append(h);let u=!h.hasClass("move"),d=l||h.center,g=new Ie(this,d,c,h,u);h.hasAttr("project")&&g.project(h.attr("project")),h.hasClass("pulsate")&&g.pulsate()}}this.$pendingPoint=m("circle",{class:"pending"},this.$points),this.$pendingPoint.hide(),this.updateIntersections();let n={move:new Fi(this),point:new Er(this),line:new Mr(this),circle:new Cr(this),perpBisector:new kr(this),angleBisector:new Vr(this),rectangle:new Ar(this)};this.$tools=this.$(".tools");let r=n[this.$tools.$active.data.tool];r.enable();let o=()=>this.toolOverride||r;this.$tools.on("change",h=>{o().cancel(),this.toolOverride=void 0,r=n[h.data.tool],this.hovering&&this.hovering.unhover(),this.$pendingPoint.hide(),this.hovering=void 0,this.deselect(),r.enable()});let a=(h,l=!1)=>this.toPlotCoords(l?h.clamp(this.viewportBounds,8):h);new ei(t,{down:h=>o().down(a(h.posn)),start:h=>o().start(a(h.posn)),move:h=>o().move(a(h.posn,!0),a(h.lastPosn,!0)),end:h=>o().end(a(h.posn,!0)),click:h=>o().click(a(h.posn)),hover:h=>o().hover(a(h.posn))}),C.onKey("Escape",()=>o().cancel()),C.onKey("Backspace Clear Delete",()=>this.delete()),document.addEventListener("keydown",h=>{if([37,38,39,40].indexOf(h.keyCode)<0)return;let c=b.getActiveInput();if(!(!c||!c.hasParent(this))){h.preventDefault();for(let u of this.points){if(u.$el!==c||!u.value)continue;let d=15/this.plotScale,g=this.plotBounds.yMin>this.plotBounds.yMax?-1:1,y=h.keyCode===37?-d:h.keyCode===39?d:0,f=h.keyCode===38?-g*d:h.keyCode===40?g*d:0;u.setValue(u.value.shift(y,f));return}}})}switchTool(t){this.$tools.makeActive(this.$(`.tool[data-tool="${t}"]`))}setCursor(t="default"){t!==this.cursor&&(this.cursor=t,this.$svg.css("cursor",t))}select(t){this.canSelect&&(this.deselect(),t&&(this.selection=t,t.select()),this.trigger("select",{shape:t}))}deselect(){this.selection&&(this.selection.deselect(),this.selection=void 0,this.trigger("select",{shape:void 0}))}delete(){this.hovering&&this.hovering.unhover(),this.selection&&this.selection.delete(),this.trigger("select",{shape:void 0})}redraw(){this.resize(),this.viewportRect=this.viewportBounds.rect,this.model.forceUpdate()}getPointAt(t,i=20){if(this.hidePoints)return;let n=r=>r.isHidden?void 0:r.distance(t);return $r(this.points,n,i/this.plotScale)}getPathAt(t,i=10){if(this.hidePoints||!this.canProject)return;let n=r=>r.isHidden?void 0:r.distance(t);return $r(this.paths,n,i/this.plotScale)}getIntersectionAt(t,i=20){if(!this.canIntersect)return;let n=r=>p.distance(t,r.posn);return $r(this.intersections,n,i/this.plotScale)}updateIntersections(){!this.canIntersect||this.hidePoints||bp(this.paths,this.intersections)}drawPath(t,i={}){typeof t=="string"&&(t=ct(t));let n=new qe(this,t,i.name);i.classes&&n.$el.addClass(i.classes),i.target&&n.$el.setAttr("target",i.target);let r=n.$el.hasClass("fill")?"fade":"draw";return i.animated&&n.$el.enter(r,i.animated),n}drawPoint(t,i={}){typeof t=="string"&&(t=ct(t));let n=new Ie(this,t,i.name,void 0,i.interactive===!1);return i.classes&&n.$el.addClass(i.classes),i.target&&n.$el.setAttr("target",i.target),i.animated!==0&&n.$el.enter("pop",i.animated||500),n}animatePoint(t,i,n=400){let r=this.shapes.get(t),o=new Y(this.model[t],i);return pt(a=>r.setValue(o.at(yt("quad",a))),n)}animateConstruction(t,i=2e3){return D(this,null,function*(){let n=this.shapes.get(t),r=n.value;if(U(r)&&(r=r.arc),it(r)){this.$ruler||(this.$ruler=m("path",{d:$p,class:"sketch"},this.$svg));let o=Es(r.at(-.1),12,r.angle-.3,r.length*1.2),a=Es(r.at(-.1),12,r.angle,r.length*1.2);this.$ruler.show(),n.$el.hide(),yield this.$ruler.animate({opacity:[0,1],transform:[o,a]},500).promise,yield n.$el.enter("draw",i).promise,yield this.$ruler.animate({opacity:[1,0],transform:[a,o]},500).promise}else if(Dt(r)){this.$compass||(this.$compass=m("path",{d:xp,class:"sketch"},this.$svg));let o=Es(r.c,50,r.startAngle,r.radius*1.5),a=Es(r.c,50,r.startAngle,r.radius),h=Es(r.c,50,r.startAngle+r.angle,r.radius),l=Es(r.c,50,r.startAngle+r.angle,r.radius*1.5);this.$compass.show(),n.$el.hide(),yield this.$compass.animate({opacity:[0,1],transform:[o,a]},500).promise,n.$el.enter("draw",i),yield this.$compass.animate({transform:[a,h]},i,0,"linear").promise,yield this.$compass.animate({opacity:[1,0],transform:[h,l]},500).promise}})}showGesture(t,i){this.$gesture||(this.$gesture=m("x-gesture",{},this)),this.$gesture.stop();let n=this.toViewportCoords(ct(t)(this.model));if(this.$gesture.from=n,i){let r=this.toViewportCoords(ct(i)(this.model));this.$gesture.start(r.subtract(n))}else this.$gesture.start();this.one("click mouseover pointerdown",()=>this.$gesture.stop())}waitForPoint(){return D(this,null,function*(){return new Promise(t=>{this.one("add:point",({point:i})=>t(i))})})}waitForPath(n){return D(this,arguments,function*(t,i={}){return(yield th(this,[t],i))[0]})}waitForPaths(t,i={}){return th(this,t,i)}};Ir=T([S("x-geopad",{template:kp})],Ir);var Vp='
';var Lr=class extends E{ready(){let e=this.$(".image"),t=this.positionTop<50,i,n;e.css({"background-image":`url("${this.attr("background")}")`,height:t?"100%":"150%"});let r=({height:a})=>{let h=this.positionTop;i=Math.max(0,h-a),n=h+this.height};function o(a){if(a.topn)return;let h=(a.top-i)/(n-i)*(t?50:33);e.css("transform",`translateY(${h}%)`)}b.onResize(r),C.on("scroll",o)}};Lr=T([S("x-parallax",{template:Vp})],Lr);var st=new AudioContext,Rr,Fe,Or=.05,Rp="/polypad/assets/audio/samples/",Ip=new Map,Dp=new Map,Lp=!1;function Fg(){return D(this,null,function*(){if(Lp)return;Lp=!0,Fe=st.createDynamicsCompressor(),Fe.threshold.setValueAtTime(-15,0),Fe.knee.setValueAtTime(1,0),Fe.ratio.setValueAtTime(2,0),Fe.attack.setValueAtTime(1e-5,0),Fe.release.setValueAtTime(1,0),Rr=st.createConvolver();let e=yield(yield fetch(`${Rp}IR13.mp3`)).arrayBuffer();Rr.buffer=yield st.decodeAudioData(e)})}function Np(s){if(!s||s==="synth"||Ip.has(s))return;let e=fetch(`${Rp}${s}.mp3`).then(t=>t.arrayBuffer()).then(t=>st.decodeAudioData(t)).then(t=>Dp.set(s,t)).catch(()=>console.error("Unable to load sample for",s));Ip.set(s,e)}var eh={piano:{label:"Piano",pitch:-6,vol:-1.5},epiano:{label:"E-Piano",pitch:-1,vol:-2},organ:{label:"Organ",pitch:-1,vol:-1.75},marimba:{label:"Marimba",pitch:1},synth:{label:"Synth"},bass:{label:"Synth Bass",pitch:6.2,vol:-1.75,icon:"synth"},aguitar:{label:"Guitar",pitch:5},eguitar:{label:"E-Guitar",vol:-2},violin:{label:"Violin",vol:-1.75},cello:{label:"Cello",vol:-1.5},banjo:{label:"Banjo",vol:3},trumpet:{label:"Trumpet",vol:-1.75,pitch:-14},clarinet:{label:"Clarinet",pitch:-2,vol:-2},ubass:{label:"Upright Bass",vol:2,icon:"cello"},kick:{label:"Kick",noLoop:!0},snare:{label:"Snare",noLoop:!0},"tom-high":{label:"High Tom",noLoop:!0},"tom-low":{label:"Low Tom",noLoop:!0},"hihat-open":{label:"Open HiHat",noLoop:!0,icon:"hihat"},"hihat-closed":{label:"HiHat",noLoop:!0,icon:"hihat"},ride:{label:"Ride Cymbal",noLoop:!0},crash:{label:"Crash Cymbal",noLoop:!0},cowbell:{label:"Cowbell",noLoop:!0},tambo:{label:"Tambourine",noLoop:!0},bongo:{label:"Bongos",noLoop:!0},shaker:{label:"Shaker",noLoop:!0},woodblock:{label:"Woodblock",noLoop:!0},voice:{label:"Vocal",vol:-1.5},clap:{label:"Clap",noLoop:!0},snap:{label:"Snap",noLoop:!0},ting:{label:"Ting",pitch:5.5},honk:{label:"Honk",pitch:-2,noLoop:!0},scraper:{label:"Scraper",noLoop:!0},boing:{label:"Spring",noLoop:!0,pitch:7},vibraslap:{label:"Vibraslap",noLoop:!0},cow:{label:"Cow",vol:-1.75,noLoop:!0},bark:{label:"Dog",noLoop:!0},duck:{label:"Duck",noLoop:!0},pig:{label:"Pig",noLoop:!0},rooster:{label:"Rooster",pitch:-5,noLoop:!0}},Hg=440*2**(-9/12);var jg={none:[],percussion:[],major:[0,2,4,5,7,9,11],minor:[0,2,3,5,7,8,10],blues:[0,3,5,6,7,10],pentatonic:[0,2,4,7,9],chromatic:oe(12)};function ih(s,e,t=0,i){if(s==="none")return 0;i&&(e=t-e-1);let n=jg[s],r=gt(e,n.length);return Math.round((e-r)/n.length)*12+n[r]}function Gp(s,e,t){let i=st.createGain();i.connect(Fe),i.connect(Rr).connect(Fe).connect(st.destination);let n=s+1e-5;return i.gain.setValueAtTime(1e-5,n),i.gain.linearRampToValueAtTime(e,n+=t[0]),i.gain.linearRampToValueAtTime(e*.8,n+=t[1]),i.gain.setValueAtTime(e*.8,n+=t[2]),i.gain.linearRampToValueAtTime(1e-5,n+t[3]),i}function Hi(s,e="piano"){return s===void 0?0:e==="synth"?Hg*2**(s/12):2**((s+(eh[e].pitch||0))/12)||0}function Ug(s,e,t,i,n){let r=Dp.get(s);if(!r)throw new Error(`Missing audio sample: ${s}`);let o=Gp(t,i,n),a=st.createBufferSource(),h=Hi(e,s);a.playbackRate.value=h,a.buffer=r,a.connect(o),a.start(t);let l=[a],c=a.buffer.duration/h,u=c*.5>1.5?1.1:c*.9,d=n[2]/.6,g=d/u;if(d>1.1&&!eh[s].noLoop)for(let y=1;ythis.stop())}play(e=st.currentTime+Or,t=1){if(!this.setup)return 0;this.isPlaying&&this.stop(),this.isPlaying=!0,this.tempo=(this.tile.props.tempo||1)*t;let i=this.tile.props.note||0;if(this.currentData=this.setup(i,this.tempo),!this.currentData.beats.length)return this.isPlaying=!1,this.currentData=void 0,0;let n=O(this.currentData.beats);return this.duration=(n.time+n.duration)/this.tempo,this.start=e,this.lastBeat=-1,Op.add(this),this.duration}stop(){var e,t;if(this.isPlaying){Op.remove(this),window.clearInterval(this.timeout),this.isPlaying=!1,(t=(e=this.currentData).end)==null||t.call(e);for(let i of this.stopCont)i.stop();this.stopCont.clear(),this.currentData=void 0,this.tile.$parent.selection.update()}}tick(){var o,a;let e=st.currentTime,t=this.currentData.beats,i=(e-this.start)*this.tempo,n=t.findIndex(h=>h.time>=i);n<0&&(n=t.length-1);for(let h=this.lastBeat+1;h<=n;++h)this.processStep(h);(a=(o=this.currentData).tick)==null||a.call(o,i<0?0:i);let r=this.start+this.duration-e;this.lastBeat>=t.length-1&&r<=0&&this.stop()}processStep(e){var h,l;let t=this.currentData.beats[e],i=this.start+t.time/this.tempo;if(i>st.currentTime+Or)return;let n=((h=this.tile.props.volume)!=null?h:1)+((l=t.volume)!=null?l:0),r=t.duration/this.tempo,o=t.sound||this.tile.props.sound||"piano";if(t.note instanceof Function)this.playContinuous(t.note,o,i,r,n);else{let c=Array.isArray(t.note)?t.note:[t.note];for(let u of c)this.playNote(u,o,i,r,n)}let a=i-st.currentTime;this.timeout=Zt(()=>{var c,u;return(u=(c=this.currentData).step)==null?void 0:u.call(c,e)},a*1e3),this.lastBeat=e}playNote(e,t=this.tile.props.sound||"piano",i=st.currentTime+Or,n=.8,r=this.tile.props.volume||1){return Kg(e,t,r,n,i,this.tile.props.modGain,this.tile.props.modFreq)}playContinuous(e,t,i,n,r){let o=this.playNote(Hi(e(0)),t,i,n,r),a=o instanceof OscillatorNode,h=1/60;for(let l=0;l<=n;l+=h){let c=Hi(e(l*this.tempo),t);if(a)o.frequency.setValueAtTime(c,i+l);else for(let u of o)u.playbackRate.setValueAtTime(c,i+l)}if(a)this.stopCont.add(o);else for(let l of o)this.stopCont.add(l)}},sh=class{constructor(){this.running=!1;this.tracks=new Set}add(e){this.tracks.add(e),this.running||(st.state!=="running"&&st.resume(),this.running=!0,this.tick(),requestAnimationFrame(()=>this.tick()))}remove(e){this.tracks.delete(e),this.tracks.size||(this.running=!1)}tick(){for(let e of this.tracks)e.tick();this.running&&requestAnimationFrame(()=>this.tick())}},Op=new sh;var Xg=new Set(["watch","assign","updateTheme","flushChanges","raw","copy"]);function zp(s,e){let t,i=new Set,n=!0,r=new Map,o=(u,d)=>{for(let g of K(u))r.has(g)||r.set(g,[]),r.get(g).push(d);d(c)},a=u=>{let d=Object.keys(u).filter(y=>u[y]!==s[y]);if(!d.length)return;Object.assign(s,u),e.$parent.pendingChanges.add(e);for(let y of d)i.add(y);let g=Wt(d.flatMap(y=>{var f;return(f=r.get(y))!=null?f:[]}));for(let y of g)y(c)},h=()=>{var u;for(let d of(u=r.get("color"))!=null?u:[])d(c)},l=()=>{if(e.isDeleting)return i.clear(),n?void 0:[t,void 0];let u=t;if(t=Object.assign({},s),n)return i.clear(),n=!1,[void 0,t];let d={},g={},y=!1;for(let f of i)t[f]!==u[f]&&(y=!0,d[f]=t[f],g[f]=u[f]);return i.clear(),y?[g,d]:void 0},c=new Proxy(s,{get(u,d){switch(d){case"watch":return o;case"assign":return a;case"updateTheme":return h;case"flushChanges":return l;case"raw":return s;case"copy":return()=>Object.assign({},s);case"zIndex":return s.zIndex||0;case"layer":return s.layer||"normal";case"color":return _e(s.color,e.$parent.flipTheme);default:return s[d]}},set(u,d,g){var y;if(Xg.has(d))return!1;if(s[d]===g)return!0;s[d]=g;for(let f of(y=r.get(d))!=null?y:[])f(c);return e.$parent.pendingChanges.add(e),i.add(d),!0}});return c}function Bp(s){let e=s.signedArea<0,t=0;for(let[n,r]of s.points.entries())r.ys.points[t].x||(t=n);let i=hs(s.points,t+(e?1:0));return e&&(i=i.reverse()),new V(...i)}function nh(s,e,t=0){let i=s.centroid.x,n=Math.max(...s.points.map(r=>r.y))+42+t;return m("text",{x:i,y:n,style:"font-size:25px"},e)}function Yg(s,e,t,i){e.removeChildren();let n=s.is("polyomino"),r=Bp(s.path),o=r.edges,a=as(o.map(A=>A.length)),h=O(a),l=yr(s.props.color),c=z(A=>{let M=ih(s.props.musicScale||"major",A,o.length,s.props.musicScaleRev),P=(a[A-1]||0)*.01;return{note:t+M,time:P,duration:o[A].length*.01}},o.length),u=m("g",{filter:"url(#outline)"},e),d=m("g",{class:"axis-label",fill:l},e),g=s.props.animation==="vertices"?9:6,y=m("path",{path:r,fill:"none",stroke:l,"stroke-width":5,opacity:1,hidden:!0},u),f=r.points.map(A=>m("circle",{cx:A.x,cy:A.y,r:g,fill:l,hidden:!0},u)),v,w,$;return s.props.animation==="vertices"?$=r.points.map((A,M)=>m("text",{text:M+1,x:A.x,y:A.y+5,fill:"white",hidden:!0},u)):s.props.labels==="number"&&(v=nh(r,d),w=o.map(A=>{let M=A.perpendicularBisector,P=M.at(n?0:15/M.length),j=A.length<45?12:15;return m("text",{text:Rt(A.length/50,1),x:P.x,y:P.y+5,hidden:!0,style:`font-size:${j}px`},d)})),{beats:c,step:A=>{A===0&&(y==null||y.enter("draw",10*h/i)),f==null||f[A].show(),$==null||$[A].show(),w==null||w[A].show(),v&&(v.textStr=Rt(a[A]/50,1))}}}function Zg(s,e,t){e.removeChildren();let i=s.path.area/2500,n=t-12,r=i,o=yr(s.props.color),a=m("clipPath",{id:`clip-${s.id}`},e),h=m("path",{path:G.aroundPoints(s.path.points)},a);s.$path.setAttr("id",`shape-${s.id}`),m("path",{path:s.path,"clip-path":`url(#clip-${s.id})`,fill:o,opacity:1},e);let l=m("g",{class:"axis-label",fill:o},e),c=nh(s.path,l,-15);return{beats:[{note:g=>tt(n-i,n,g/r),duration:r,time:0}],tick:g=>{if(s.props.labels){let f=g/r,v=Rt(tt(0,i,f>.95?1:f),1);c.text=v>0?v+" units\xB2":""}let y=G.aroundPoints(s.path.points).h;h.css("transform",`translateY(${y*(1-g/r)}px)`)}}}function Qg(s,e,t,i){e.removeChildren();let n=Bp(s.path),r=n.points.length,o=n.points.map((v,w)=>new kt(n.points[gt(w+1,r)],v,n.points[gt(w-1,r)])),a=o.map(v=>v.deg),h=[0,...as(a)],l=.42*Math.min(...n.edges.map(v=>v.length)),c=s.is("polyomino"),u=yr(s.props.color),d=m("g",{class:"axis-label",fill:u},e),g=nh(n,d);return{beats:a.map((v,w)=>({note:ih(s.props.musicScale||"major",w,a.length,s.props.musicScaleRev)+t,duration:a[w]/90,time:h[w]/90})),step:v=>{let w=o[v],$=m("path",{fill:u});if(e.prepend($),s.props.labels){let I=w.bisector,A=I.at(-12/I.length),M=`font-size:${c?12:15}px`;m("text",{text:Rt(a[v])+"\xB0",x:A.x,y:A.y+5,style:M},d)}pt(I=>{let A=new kt(w.arc.at(1-I),w.b,w.c);$.draw(A.shape(!0,l,!0)),s.props.labels&&(g.text=Math.round(tt(h[v],h[v+1],I))+"\xB0")},a[v]/90*1e3/i)}}}function _p(s,e){let t=()=>{s.props.labels!=="number"&&e.removeChildren()};return new Dr(s,(i,n)=>{switch(s.props.animation){case"area":return ft(ut({},Zg(s,e,i)),{end:t});case"angles":return ft(ut({},Qg(s,e,i,n)),{end:t});default:return ft(ut({},Yg(s,e,i,n)),{end:t})}})}var qp=6,Jg="M8.1-1.7l-14-8.8c-0.6-0.4-1.4-0.4-2-0.1c-0.6,0.4-1,1-1,1.7V8.8c0,0.7,0.4,1.4,1,1.7c0.3,0.2,0.6,0.3,1,0.3c0.4,0,0.7-0.1,1.1-0.3l14-8.8C8.6,1.3,9,0.7,9,0S8.6-1.3,8.1-1.7z",ji=!1;function Fp(s){if(!Array.isArray(s))return Fp([s,0]);let[e,t]=s;if(e instanceof p)return[[e,t]];if(U(e)&&(e=new G(e.c.shift(-e.r),2*e.r,2*e.r)),!(e instanceof V)&&!(e instanceof G))return[[R,0]];let i=e.edges.map(n=>[n.midpoint,n.perpendicularBisector.angle]).filter(n=>!x(n[1],1.5*Math.PI));return hs(i,t)}var Nr=class{constructor(e,t,i){this.tile=e;this.name=t;this.options={};this.cables=new Set;i&&this.setOptions(i)}get location(){let e=this.options.location;return Array.isArray(e)?e[0]:e}get type(){return(this.location||this.tile.path)instanceof p?"POINT":"REGION"}get points(){let e=this.options.location||this.tile.path||R;return Fp(e).map(t=>[this.tile.worldPosn(t[0]),t[1]])}setOptions(e,t=!0){Object.assign(this.options,e),t&&this.redraw()}redraw(){for(let e of this.cables)e.redraw()}},Gr=class extends Nr{sendMessage(e){this.cables.size===0&&this.redraw();for(let t of this.cables.values())t.enqueueMessage(e,!1);Hp()}addCable(e,t=!1){this.cables.add(e),!e.to&&!e.dragging&&this.cables.size>1&&this.removeCable(e,!1),t&&(this.tile.updateCableProps(),this.tile.$parent.flushChanges()),this.redraw()}removeCable(e,t=!0){this.cables.delete(e),e.delete(),t&&this.redraw(),this.tile.updateCableProps()}redraw(){if(Bt(this.cables,e=>e.to))for(let e of this.cables)!e.to&&!e.dragging&&this.removeCable(e);this.cables.size||this.addCable(new ns(this)),super.redraw()}delete(){for(let e of this.cables)e.delete()}},zr=class extends Nr{setOptions(t,i=!0){Object.assign(this.options,t);let n=Array.isArray(t.location)?t.location[0]:t.location;n instanceof p?this.$dot=m("circle",{class:"link-dot persist",r:qp,cx:n.x,cy:n.y},this.tile.$el):this.$dot&&this.$dot.remove(),i&&this.redraw()}addCable(t,i){i&&this.tile.highlight(!0),this.cables.add(t),this.options.connect&&this.options.connect(t)}removeCable(t,i){var n,r;i&&this.tile.highlight(!1),(r=(n=this.options).disconnect)==null||r.call(n,t),this.cables.delete(t)}delete(){for(let t of this.cables)t.from.tile.$parent.pendingChanges.add(t.from.tile),t.from.removeCable(t)}validateConnection(t){return ah(t,this)}},oh=[],rh=!1;function Hp(){var e,t;if(rh)return;rh=!0;let s=0;for(;oh.length;){if(s>=1e4)throw new Error("Queue overflow!");let[i,n]=oh.shift();(e=i.to)!=null&&e.options.message&&((t=i.to)==null||t.options.message(n,i)),s++}rh=!1}function ah(s,e){if(s.tile===e.tile||e.options.max&&[...e.cables].filter(r=>r.from!==s||r.to!==e).length>=e.options.max)return!1;let t=e.options.tileTypes;if(t){let n=s.tile.props.name;if(!t.includes(n))return!1}let i=s.options.tileTypes;if(i){let n=e.tile.props.name;if(!i.includes(n))return!1}return!0}var ns=class s{constructor(e,t){this.from=e;this.dragging=!1;let i=this.from.tile.$parent,n=e.options.persistent?"":"dashed";this.$group=m("g",{class:"link-bar",style:"display:none"},e.tile.$el),this.$line=m("path",{style:"pointer-events: none",class:n},this.$group),this.$originDot=m("circle",{class:"link-dot",r:qp},this.$group),this.$handle=m("path",{class:"link-handle",d:Jg},this.$group),this.connectTo(t),i.events.listen(this.$handle,{start:()=>{i.selection.add(e.tile,!0),ji=this.dragging=!0},move:({posn:o})=>{this.connectTo(i.getInputAt(o,this.from),o)},end:()=>{ji=this.dragging=!1,this.to&&this.to.tile.highlight(!1),this.redraw(),e.addCable(this,!0)},click:()=>{this.connectTo(),e.addCable(this,!0)}});let r;i.events.listen(this.$originDot,{start:()=>{i.selection.add(e.tile,!0),r=new s(this.from),ji=r.dragging=!0,this.from.addCable(r)},move:({posn:o})=>{r.connectTo(i.getInputAt(o,this.from),o)},end:()=>{r.to&&r.to.tile.highlight(!1),r.redraw(),ji=r.dragging=!1,e.addCable(r,!0),r=void 0}})}connectTo(e,t){this.to&&this.to!==e&&this.to.removeCable(this,!0),e?this.to!==e&&ah(this.from,e)&&(this.to=e,e.addCable(this,t!==void 0),this.from.options.connect&&this.from.options.connect(this)):this.to=void 0,this.redraw(t)}redraw(e){var y;if(!(this.from.options.persistent||this.from.tile.isActive||((y=this.to)==null?void 0:y.tile.isActive)))return this.$group.hide();if(this.from.tile.$el.append(this.$group),this.$group.show(),!this.to&&!e){let[f,v]=this.from.points[0],w=new wt(R,20).at(v/(Math.PI*2));this.$handle.setTransform(this.from.tile.relativePosn(f).add(w),v),this.$line.setAttr("d",""),this.$originDot.hide();return}let i=this.to?this.to.points:[[e,0]],n=bi(this.from.points,i),[r,o]=Is(n,([f,v])=>p.distance(f[0],v[0])),a=this.from.tile.relativePosn(r[0]),h=o[1]+J((this.to?this.to.tile.rot:180)-this.from.tile.rot),l=this.to?new wt(R,14).at(h/(Math.PI*2)):R,c=this.from.tile.relativePosn(o[0]).add(l),u=p.distance(a,c),d=a.add(p.fromPolar(r[1],u*.7)),g=c.add(p.fromPolar(h,Math.max(u*.7,40)));this.$line.setAttr("d",`M${c.x} ${c.y}C${g.x} ${g.y},${d.x} ${d.y},${a.x} ${a.y}`),this.$handle.setTransform(c,h+Math.PI,this.to?.8:1),this.$originDot.setTransform(a),this.$originDot.show()}delete(){this.connectTo(),this.$group.remove()}enqueueMessage(e,t=!0){if(oh.push([this,e]),t&&Hp(),!this.from.options.highlights)return;let n=e.type==="number"&&e.value===1?F.yellow:F.blue;this.$line.setAttr("style",`stroke: ${n}`),this.$handle.setAttr("style",`fill: ${n}`)}serialize(){return this.to?{fromPort:this.from.name,toTileId:this.to.tile.id,toPort:this.to.name}:void 0}static unSerialize(e,t,i){var o,a;let n=i.tiles.get(e),r=i.tiles.get(t.toTileId);if(n&&r){let h=(o=n.outPorts)==null?void 0:o.get(t.fromPort||"main"),l=(a=r.inPorts)==null?void 0:a.get(t.toPort||"main");h&&l&&ah(h,l)&&h.addCable(new s(h,l))}}static get isMoving(){return ji}};var _r=["polygon","custom-polygon","reg-polygon","rectangle","polyomino","circle","arrow"],Br=class{constructor(e){this.tileContext=e,this.tileContextProps=this.tileContext.props,this.tileContextProps.watch("color",()=>this.setColor()),this.tileContextProps.watch("textLabel",()=>{var t;this.tileContext.value=(t=cn.fromString(this.tileContextProps.textLabel||""))==null?void 0:t.value,this.renderTextLabel()}),this.tileContextProps.watch("textLabelRotate",()=>this.align()),this.tileContextProps.watch("textLabelFontSize",()=>this.setFontSize())}renderTextLabel(){if(this.$textLabel){this.$textLabel.text=this.tileContextProps.textLabel||"",this.align();return}this.tileContextProps.textLabel&&(this.$textLabel=m("text",{class:"polygon-text-label",text:this.tileContextProps.textLabel,"dominant-baseline":"middle"},this.tileContext.$el),this.setColor(),this.setFontSize(),this.align())}setColor(){this.$textLabel&&this.$textLabel.css("fill",br(this.tileContextProps.color))}setFontSize(){if(!this.$textLabel)return;let e=this.tileContextProps.textLabelFontSize||0;this.$textLabel.css("font-size",mp(e)),this.$textLabel.setAttr("dy",e)}align(){if(!this.$textLabel)return;let e=this.tileContextProps.textLabelRotate?0:-this.tileContext.rot;this.$textLabel.setTransform(this.tileContext.path&&Ye(this.tileContext.path)?this.tileContext.path.centroid:this.tileContext.center,J(e))}};var F={grey:"#cccccc",darkGrey:"#242436",red:"#cd0e66",orange:"#eb4726",yellow:"#fd8c00",lime:"#bfc212",green:"#22ab24",teal:"#009ea6",blue:"#0f82f2",purple:"#6d3bbf",fg:"var(--canvas-fg)",bg:"var(--canvas-bg)"},t0="M12.5,0H0V25H12.5a12.5,12.5,0,0,0,0-25Z",e0="M0,0V12.5a12.5,12.5,0,0,0,25,0V0Z",qr=new Map,Fr=new Map,s0=[];function Ut(s){qr.set(s.type,s)}function Mt(s){s0.push(...s)}var H=class s{constructor(e,t,i,n){this.$parent=e;this.rot=0;this.snapPoints=[];this.snapLines=[];this.snapAngles=[0,90];this.id=i||We(10),t.name||(t.name=this.constructor.type),this.props=zp(t,this),this.posn=new p(this.props.x||0,this.props.y||0),this.rot=t.rot||0,this.$el=n||m("g",{class:"tile"}),e.tiles.set(this.id,this),Fr.set(this.$el._el,this),e.pendingChanges.add(this),this.props.watch("status",({status:r})=>{this.$el.setClass("locked-tile",r==="locked"),this.$el.setClass("hidden-tile",r==="hidden"),this.canSelect||this.$parent.selection.remove(this)}),this.props.watch("sound",r=>Np(r.sound||"piano")),this.props.watch("zIndex layer",()=>this.updateZIndex(!0)),this.props.watch("hideHandles",()=>this.$el.setClass("no-handles",!this.showHandles))}static create(e,t,i){let n=qr.get(t.name);if(!n)throw new Error(`Unknown tile type: ${t.name}`);let r=Object.assign({},n.defaultProps||{},t);r.arpeggio===!1&&!r.musicScale&&(r.musicScale="none",r.arpeggio=void 0);let o=new n(e,r,i);return o.setTransform(),o}static thumbnail(e,t,i){var o,a;let n=qr.get(t);if(!n)throw new Error(`Unknown tile type: ${t}`);let r=we(i.attr("props"),{});return i.setAttr("aria-label",((o=n.altText)==null?void 0:o.call(n,r))||r.name),(a=n.makeThumbnail)==null?void 0:a.call(n,i,r,e)}delete(){var e,t,i;if(!this.isDeleting){this.isDeleting=!0,(e=this.track)==null||e.stop(),this.collision&&this.collision.setCollision();for(let n of this.optionListeners||[])this.$parent.options.unwatch(n);for(let n of this.stateListeners||[])this.$parent.state.unwatch(n);this.$parent.selection.remove(this);for(let n of((t=this.inPorts)==null?void 0:t.values())||[])n.delete();for(let n of((i=this.outPorts)==null?void 0:i.values())||[])n.delete();this.$parent.tiles.delete(this.id),this.$parent.zIndex.remove(this),this.$parent.mathContext.removeSource(this),Fr.delete(this.$el._el),this.$parent.pendingChanges.add(this),this.$el.remove()}}applyChange(e){this.props.assign(e),this.flushChanges(),("x"in e||"y"in e||"rot"in e)&&this.setTransform(new p(this.props.x,this.props.y),this.props.rot)}flushChanges(){return this.props.flushChanges()}setupAudioTrack(){}makeHandle(e,t,i,n,r){let a=m(e==="c"?"circle":"path",{class:"handle"},this.$el);return e==="h"&&a.setAttr("d",t0),e==="v"&&a.setAttr("d",e0),e==="c"&&a.setAttr("r",10),a.css("cursor",e==="c"?"move":e==="h"?"ew-resize":"ns-resize"),this.$parent.events.listen(a,{down:()=>{var h;return(h=this.track)==null?void 0:h.stop()},start:()=>{this.$parent.selection.add(this.root,!0),n==null||n()},move:h=>t(this.relativePosn(h.posn),h.posn,h.event),click:()=>i==null?void 0:i(),end:()=>{r==null||r(),this.$parent.flushChanges()}}),a}is(e){return this.props.name===e}get $container(){return this.$parent.$tiles[this.props.layer==="back"?0:this.props.layer==="front"?2:1]}updateZIndex(e){e&&this.$parent.zIndex.addOrUpdate(this);let t=this.$parent.zIndex.getTileAbove(this);if(!t)return this.$container.append(this.$el);t.$el.insertBefore(this.$el)}get canSelect(){return this.$parent.state.authorMode?!0:this.props.status!=="hidden"&&this.props.status!=="locked"}get canEdit(){return this.$parent.state.authorMode?!0:!this.authoringOnly&&this.props.status!=="fixed"&&this.props.status!=="generator"}get canRotate(){return this.cannotRotateType?!1:this.$parent.state.authorMode?!0:this.canEdit&&!this.$parent.options.noRotating&&!this.props.cannotRotate}get showHandles(){return this.$parent.state.authorMode?!0:!this.props.hideHandles&&!this.authoringOnly&&this.props.status!=="generator"}get altText(){var t;if(this.props.altText)return this.props.altText;let e=qr.get(this.props.name);return((t=e==null?void 0:e.altText)==null?void 0:t.call(e,this.props))||this.props.name}watchPolypadOptions(e){this.optionListeners||(this.optionListeners=[]),this.optionListeners.push(e),this.$parent.options.watch(e)}watchPolypadState(e){this.stateListeners||(this.stateListeners=[]),this.stateListeners.push(e),this.$parent.state.watch(e)}showErrorIcon(e){var t;if(this.currentError=e,!e)return(t=this.$errorIcon)==null?void 0:t.detach();this.$errorIcon||(this.$errorIcon=m("g",{style:"cursor: pointer"}),m("circle",{cx:12,cy:12,r:12,fill:"transparent"},this.$errorIcon),fp("warning",F.yellow,24,void 0,this.$errorIcon),this.transform(),this.$parent.events.listen(this.$errorIcon,{click:()=>{let i=this.$errorIcon.transformMatrix,n=this.posn.shift(i[0][2],i[1][2]);this.$parent.warningBanner.show(n,this.currentError)}})),this.$el.append(this.$errorIcon)}setCollision(e){var t;!this.canEdit||e&&!e.canEdit||e&&e===this.collision||((t=this.collision)==null||t.highlight(!1),this.collision=e,e==null||e.highlight(!0))}collide(e){}get root(){var e;return((e=this.group)==null?void 0:e.root)||this}flipColor(e){let{color:t,backColor:i}=this.props;this.props.color=i||e,this.props.backColor=t}click(e,t){}doubleClick(e){}down(e){}up(e){}format(e,t){}focus(){this.$parent.focussedTile=this,this.$parent.selection.clear(),this.isFocussed=!0,this.$parent.trigger("change-focus",{tiles:[this]})}blur(){this.isFocussed=!1,this.$parent.focussedTile=void 0,this.$parent.trigger("change-focus",{tiles:[]})}highlight(e=!0){}onDropzonesChange(){}select(){this.isActive=!0,this.$el.addClass("active"),this.$el.setClass("no-handles",!this.showHandles),this.noAutoLayering||this.updateZIndex(),this.redrawCables()}deselect(){this.isDeleting||(this.isActive=!1,this.$el.removeClass("active"),this.noAutoLayering||this.updateZIndex(),this.redrawCables())}moveStart(e=!1){this.startPosn=this.posn}move(e,t){var i;if(e){let n=(i=this.startPosn)==null?void 0:i.add(e);n&&(this.posn=n),this.transform(!0)}}moveEnd(){this.collision&&this.collide(this.collision),this.setTransform()}rotate(e,t=R){this.posn=this.posn.rotate(J(e),t),this.rot=gt(this.rot+e,360),this.transform(!0)}transform(e){var i,n;let t=J(this.rot);this.$el.setTransform(this.posn,t),this.redrawCables(),!e&&this.path&&(this.transformed=this.path.rotate(t).translate(this.posn),this.padding&&(this.transformedPadded=It(this.path).padding(...this.padding).rotate(t).translate(this.posn)),this.snapPoints=this.getSnapPoints().map(r=>r.rotate(t).translate(this.posn)),this.snapLines=this.getSnapLines().map(r=>r.rotate(t).translate(this.posn)),(i=this.$errorIcon)==null||i.setTransform(It(this.path).p.shift(-28,5)),(n=this.group)==null||n.transform())}setTransform(e=this.posn,t=this.rot){this.posn=e,this.props.x=e.x,this.props.y=e.y,this.rot=this.props.rot=gt(t,360),this.transform()}getSnapPoints(){return this.path?rt(this.path)?[this.path]:St(this.path)?this.path.points:it(this.path)?[this.path.p1,this.path.p2]:U(this.path)?[this.path.c,this.path.c.shift(0,this.path.r),this.path.c.shift(0,-this.path.r),this.path.c.shift(this.path.r,0),this.path.c.shift(-this.path.r,0)]:Ze(this.path)?[...this.path.majorVertices,...this.path.minorVertices]:Pe(this.path)?[this.path.c,this.path.start,this.path.end]:Dt(this.path)?[this.path.start,this.path.end]:qt(this.path)?[]:[]:[]}getSnapLines(){return[]}relativePosn(e){return e.subtract(this.posn).rotate(-J(this.rot))}worldPosn(e){return e.rotate(J(this.rot)).add(this.posn)}get center(){return this.path?U(this.path)||Ze(this.path)?this.path.c:It(this.path).center:R}contains(e){let t=this.transformed;return!t||!St(t)&&!U(t)&&!Pe(t)?!1:t.contains(e)}findNearby(e,t,i){let n=i||this.worldPosn(this.center);for(let r of this.$parent.getTilesOfType(e))if(r!==this&&p.distance(n,r.worldPosn(r.center))Array.from(ke([h],!0),d=>{let g=d.posn.add(l).subtract(h.posn);return{tile:d,posn:g,rot:c,scale:u}}));let r=e.map(h=>h.tile.posn),o=e.map(h=>h.tile.rot);for(let h of e)h.tile.setTransform(h.posn,(a=h.rot)!=null?a:h.tile.rot),h.tile.isAnimating=!0;if(!t)return Promise.resolve();yield pt(h=>{var l,c;h=yt(n,h);for(let[u,d]of e.entries()){let g=J(tt(o[u],(l=d.rot)!=null?l:d.tile.rot,h));if(d.tile.is("group")){let y=p.interpolate(r[u].subtract(d.posn),R,h);d.tile.transformed=d.tile.path.rotate(g,d.tile.path.center).translate(y)}else{let y=p.interpolate(r[u],d.posn,h),f=d.scale?tt(d.scale[0],d.scale[1],h):void 0;d.tile.$el.setTransform(y,g,f),d.tile.transformed=(c=d.tile.path)==null?void 0:c.rotate(g).translate(y)}}i&&i(h)},t).promise;for(let h of e)h.tile.isAnimating=!1})}delayedSetup(){var t;for(let i of((t=this.outPorts)==null?void 0:t.values())||[])for(let n of i.cables)n.delete();let e=this.props.cables||[];for(let i of e)ns.unSerialize(this.id,i,this.$parent)}redrawCables(){var e,t;for(let i of((e=this.inPorts)==null?void 0:e.values())||[])i.redraw();for(let i of((t=this.outPorts)==null?void 0:t.values())||[])i.redraw()}makeInPort(e,t){this.inPorts||(this.inPorts=new Map),this.inPorts.has(e)||this.inPorts.set(e,new zr(this,e));let i=this.inPorts.get(e);return i.setOptions(t,!1),i}makeOutPort(e,t){this.outPorts||(this.outPorts=new Map),this.outPorts.has(e)||this.outPorts.set(e,new Gr(this,e));let i=this.outPorts.get(e);return i.setOptions(t,!1),i}emitMessage(e,t){var i;typeof e=="string"&&(e=(i=this.outPorts)==null?void 0:i.get(e)),e==null||e.sendMessage(t)}*getCableData(e="out"){let t=e==="in"?this.inPorts:this.outPorts;if(t)for(let i of t.values())for(let n of i.cables)(e==="in"||n.to)&&(yield n.serialize())}updateCableProps(){if(this.$parent.setup)return;let e=Array.from(this.getCableData());this.props.cables=e.length?e:void 0}getClosestPort(e,t,i=10){if(!this.inPorts)return;let n=this.relativePosn(e);for(let a of this.inPorts.values())if(a.location&&rt(a.location)&&p.distance(a.location,n)<=i&&(!t||a.validateConnection(t)))return a;if(!this.contains(e))return;let r=Array.from(this.inPorts.values()).filter(a=>!t||a.validateConnection(t));for(let a of r.filter(h=>h.type==="REGION"))if((a.location||this.path).contains(n))return a;let o=r.filter(a=>a.type==="POINT");return Is(o,a=>p.distance(n,a.location))}},i0=new vt(R,new p(0,1)),n0=new G(R,50,50).shift(-25,-25).polygon,ii=class extends H{constructor(t,i,n){super(t,i,n);this.$path=m("path",{class:"polygon-tile"},this.$el),this.$outline=m("path",{class:"outline"},this.$el),this.props.watch("color",({color:r})=>this.$path.setAttr("fill",r)),this.textLabelInstance=new Br(this)}transform(t){var i;super.transform(t),(i=this.textLabelInstance)==null||i.align()}setPath(t=n0,i,n){if(i&&!this.symmetric&&(t=t.reflect(i0)),this.path=t,St(t)&&(this.snapAngles=Wt(t.edges.map(a=>gt(Math.round(Kt(a.angle)),180)))),this.$path.draw(t,{cornerRadius:n}),this.$outline.draw(t,{cornerRadius:n}),this.transform(),!St(t))return;let r=G.aroundPoints(t.points),o=new p(r.center.x,r.p.y);this.showSelectionOutline=p.distance(o,t.project(o))>5}select(){var t,i;(t=this.track)==null||t.stop(),(i=this.$audio)==null||i.removeChildren(),super.select()}setupAudioTrack(){St(this.path)&&(this.$audio=m("g",{style:"font-size:15px;font-weight:600",fill:"white"}),this.$outline.insertBefore(this.$audio),this.track=_p(this,this.$audio),this.props.watch("labels",()=>this.track.stop()))}flip(t){this.props.isFlipped=!this.props.isFlipped||void 0;let i=new p(2*t.x-this.posn.x,this.posn.y);this.setTransform(i,-this.rot)}};var Hr={point:(s,e)=>s!==void 0&&e!==void 0?new p(s,e):void 0,angle:(s,e,t)=>s&&e&&t?new kt(s,e,t):void 0,line:(s,e)=>s&&e&&!s.equals(e)?new vt(s,e):void 0,segment:(s,e)=>s&&e&&!s.equals(e)?new Y(s,e):void 0,circle:(s,e)=>s&&e?new wt(s,e):void 0,arc:(s,e,t)=>s&&e&&t?new Ft(s,e,t):void 0,polygon:(...s)=>s.every(Boolean)?new V(...s):void 0,polyline:(...s)=>s.every(Boolean)?new te(...s):void 0,triangle:(s,e,t)=>s&&e&&t?new Pi(s,e,t):void 0,rectangle:(s,e,t)=>s?new G(s,e,t):void 0,distance:p.distance,intersections:Q},r0=/^_x\d+\.at\([\d.e-]+\)$/,o0=/^intersections\(|\.midpoint$|\.centroid$/,jr=class{constructor(){this.model=le({});this.tiles=new Map;this.dependencies=new Map;this.model.assign(Hr),this.queueLabelPositioning=ve(()=>{for(let e of this.tiles.values())Kp(e)},0,!0)}reset(){this.model.clear(),this.model.assign(Hr)}redrawLines(e){for(let t of this.tiles.values())t.path&&Ko(t.path)&&(t.$el.draw(t.path,{box:e}),t.$shadow.setAttr("d",t.$el.attr("d")))}},Yt=class extends H{constructor(t,i,n){super(t,i,n,m("path",{class:"geo-path"},t.$geoPaths));this.$parent=t;this.hideSelectionOutline=!0;this.noAutoLayering=!0;this.isProjection=!1;this.parentKeys=[];this.deleted=!1;this.onDraw=()=>this.draw();this.$shadow=m("path",{class:"geo-shadow"},t.$geoShadows),this.props.key||(this.props.key=t.geoData.model.getKey()),t.geoData.tiles.set(this.props.key,this),this.snapPoints=this.snapLines=this.snapAngles=[],this.props.expr&&this.setExpr(this.props.expr),t.geoData.model.watch(this.onDraw),this.props.color||(this.props.color=t.state.penColor),this.props.watch("color",({color:r})=>{var o,a,h;(o=this.$el)==null||o.css("color",r),(a=this.$shadow)==null||a.css("color",r),(h=this.$label)==null||h.setAttr("fill",r)}),this.props.watch("arrows marks",()=>this.draw(!0)),this.props.watch("label",({label:r})=>{if(!r&&this.$label)return this.$label.detach();this.$label||(this.$label=m("text",{fill:this.props.color,class:"geo-label"})),this.$parent.$geoPoints.append(this.$label),Kp(this)})}applyChange(t){super.applyChange(t),"expr"in t&&this.setExpr(this.props.expr)}setExpr(t,i=!1){let n=ct(t);this.$parent.geoData.model.setComputed(this.props.key,n),!i&&(this.props.expr=t,this.setParentKeys(t.match(/_x\d+/g)||[]),this.isProjection=r0.test(t),this.computed=o0.test(t),this.$el.setClass("intersection",this.computed))}draw(t=!1){let i=this.$parent.geoData.model[this.props.key];if(!t&&i===this.path)return;this.path=i,this.$el.setAttr("hidden",i?void 0:!0),this.isActive&&!i&&this.$shadow.hide();let n=i==null?void 0:i.type;if(n!==this.geoType&&(this.$el.setClass("geo-point",n==="point"),this.$el.setClass("geo-path",n!=="point"),this.geoType=n,this.$container.append(this.$el)),!i)return;n==="point"&&(i=new wt(i,this.computed?3.5:6)),this.$el.setClass("fill",this.geoType==="angle");let r=this.$parent.canvasBounds||this.$parent.viewportBounds;this.$el.draw(i,{box:r.rect,arrows:this.props.arrows,mark:this.props.marks}),this.$shadow.setAttr("d",this.$el.attr("d")),this.transform()}setParentKeys(t){var n;let i=this.$parent.geoData.dependencies;for(let r of this.parentKeys)(n=i.get(r))==null||n.delete(this.props.key);this.parentKeys=t;for(let r of t)i.has(r)||i.set(r,new Set),i.get(r).add(this.props.key)}get parents(){let t=this.$parent.geoData.tiles;return this.parentKeys.map(i=>t.get(i)).filter(Boolean)}get children(){let t=this.$parent.geoData.dependencies.get(this.props.key);return t?Array.from(t).map(i=>this.$parent.geoData.tiles.get(i)).filter(Boolean):[]}get ariaDescription(){var t;return`${(t=this.path)==null?void 0:t.type} ${this.props.key}: ${this.props.expr}`}get $container(){return this.geoType==="point"?this.$parent.$geoPoints:this.$parent.$geoPaths}select(){var t;this.isActive=!0,this.path&&(this.geoType==="angle"?this.$el.addClass("hover"):(this.$shadow.show(),(t=this.$el.parent)==null||t.append(this.$el)))}deselect(){this.isActive=!1,this.$shadow.hide(),this.$el.removeClass("hover")}hover(t=!0){this.isActive||!this.path||(this.geoType==="angle"?this.$el.setClass("hover",t):t?this.$shadow.show():this.$shadow.hide())}transform(){this.transformed=this.path,this.snapPoints=this.pending?[]:this.getSnapPoints(),this.snapLines=this.pending||!this.path||rt(this.path)||qt(this.path)?[]:[this.path],this.$parent.geoData.queueLabelPositioning()}setTransform(){this.transform()}shift(t){/^point\([\d.-]+,[\d.-]+\)$/.test(this.props.expr)&&this.setExpr(this.path.translate(t).toString())}delete(){var t;this.deleted=!0,super.delete(),this.$parent.geoData.model.unwatch(this.onDraw),this.$parent.geoData.model[this.props.key]=void 0,this.$parent.geoData.tiles.delete(this.props.key),this.$shadow.remove(),(t=this.$label)==null||t.remove();for(let i of this.children)i.delete()}setPending(t=!0){this.pending=t,t||this.transform();for(let i of this.children)i.setPending(t)}moveStart(){if(!(this.computed||!this.path)){if(this.isProjection){if(this.$parent.selection.size>1)return;this.setParentKeys([])}this.setPending(!0);for(let t of this.parents)t.moveStart();this.moveStartValue=this.transformed}}move(t,i){if(!(!t||!this.path||!this.moveStartValue))if(rt(this.path))this.snapTarget=i,this.$el.setClass("intersection",this.computed||!!(i!=null&&i.intersection)),this.$parent.geoData.model[this.props.key]=this.moveStartValue.translate(t);else for(let n of this.parents)n.move(t)}moveEnd(){var t,i,n,r;if(this.moveStartValue){for(let o of this.parents)o.moveEnd();if(this.setPending(!1),(t=this.snapTarget)!=null&&t.intersection)this.setExpr(this.snapTarget.intersection);else if(((n=(i=this.snapTarget)==null?void 0:i.tile)==null?void 0:n.props.name)==="geo"){let o=(r=this.snapTarget)==null?void 0:r.tile;if(o.path&&rt(o.path)){let a=this.children;for(let h of a)h.setExpr(h.props.expr.replaceAll(this.props.key,o.props.key));this.delete(),this.$parent.flushChanges()}else if(o.path){let a=o.path.offset(this.$parent.geoData.model[this.props.key]);this.setExpr(`${o.props.key}.at(${a})`)}}else this.path&&rt(this.path)&&(this.props.expr=`point(${this.path.x},${this.path.y})`,this.isActive||this.$parent.pendingChanges.add(this))}}static getInferredShape(t){if(t=t.filter(h=>h.path),!t.length)return;if(t.length===1)return{type:t[0].path.type,expr:t[0].props.key,value:t[0].path};t=t.filter(h=>h.geoType!=="angle");let i=t.filter(h=>rt(h.path)),n=t.filter(h=>it(h.path)||U(h.path));if(n.length===1&&i.length===t.length-1){let h=n[0].path;if(i.every(l=>h.contains(l.path)))return{type:h.type,expr:n[0].props.key,value:h}}let r=n.filter(h=>it(h.path));if(i.length+r.length!==t.length)return;for(let h of r)if($e(h.path)){let l=h.parentKeys.map(c=>h.$parent.geoData.tiles.get(c));for(let c of l)i.includes(c)||i.push(c)}else if(i.filter(l=>h.path.contains(l.path)).length<2)return;let o=i.map(h=>h.props.key).join(","),a=i.map(h=>h.path);if(i.length===2){let h=new Y(a[0],a[1]);return{type:"segment",expr:`segment(${o})`,value:h}}return i.length===3?{type:"triangle",expr:`triangle(${o})`,value:new Pi(...a)}:{type:"polygon",expr:`polygon(${o})`,value:new V(...a)}}static copy(t,i,n){let r=h=>{let l=t.get(h)||n.model.getKey();return t.set(h,l),l},o=r(i.key),a=i.expr.replace(/\b_x\d+\b/g,r);return{key:o,expr:a}}};Yt.type="geo",Yt=T([Ut],Yt);var jp=new WeakMap,Up=s=>{let e=jp.get(s);if(e)return e;let t=Yt.getInferredShape(s);return jp.set(s,t),t};Mt([["Midpoint","geo-midpoint","$0.midpoint","segment"],["Perpendicular bisector","geo-perp-bisector","$0.perpendicularBisector","segment"],["Parallel line","geo-parallel","$0.parallel($1)","line","segment"],["Perpendicular line","geo-perpendicular","$0.perpendicular($1)","line","segment"],["Tangent line","geo-tangent","line($0.c,$1).perpendicular($1)","circle"],["Centroid","geo-centroid","$0.centroid","polygon","triangle"],["Circumcircle","geo-circumcircle","$0.circumcircle","triangle"],["Incircle","geo-incircle","$0.incircle","triangle"],["Angle bisector","geo-angle-bisector","$0.bisector","angle"]].map(([s,e,t,...i])=>({id:e,type:"button",tileTypes:["geo"],label:s,icon:e,noFlush:!0,show:n=>{var r;return i.includes(((r=Up(n))==null?void 0:r.type)||"")},click:(n,r)=>{var h;let o=(h=Up(n))==null?void 0:h.expr,a=t.replace(/\$0/g,o||"");if(a.includes("$1"))r.tools.geoPending.enable(a);else{let l=H.create(r,{name:"geo",expr:a});r.selection.add(l,!0);let c=rt(l.path)?"pop":"draw",u=l.$el.enter(c,400);l.$shadow.enter(c,400),r.snapping.updateIntersections(),r.flushChanges(),u.promise.then(()=>l.$el.css("display",""))}}})));Mt([{id:"line-style",type:"select",tileTypes:["geo"],label:"Line Type:",location:"more",show:s=>s.every(e=>e.path&&it(e.path)),options:[{key:"line",label:"Line"},{key:"ray",label:"Ray"},{key:"segment",label:"Segment"}],get:s=>s.geoType,set:(s,e)=>e.setExpr(e.props.expr.replace(/\.(line|ray|segment)$/,"")+`.${s}`)},{id:"arrows",type:"select",tileTypes:["geo"],label:"Arrows:",location:"more",show:s=>s.every(e=>e.geoType==="segment"),options:[{key:"",label:"None"},{key:"start",label:"Start"},{key:"end",label:"End"},{key:"both",label:"Both"}],get:s=>s.props.arrows||"",set:(s,e)=>e.props.arrows=s||void 0},{id:"marks",type:"select",tileTypes:["geo"],label:"Decoration:",location:"more",show:s=>s.every(e=>e.path&&it(e.path)),options:[{key:"",label:"None"},{key:"bar",label:"Bar"},{key:"bar2",label:"Double Bars"},{key:"arrow",label:"Arrow"},{key:"arrow2",label:"Double Arrows"}],get:s=>s.props.marks||"",set:(s,e)=>e.props.marks=s||void 0}]);Mt([{id:"label",type:"input",tileTypes:["geo"],label:"Label:",location:"more",get:s=>s.props.label||"",set:(s,e)=>e.props.label=s}]);var Wp=Math.PI/12;function a0(s){return be(s/Wp,.03)?new cn(Math.round(s/Wp),12,"\u03C0").simplified.toString():Ot(s,4)}function h0(s,e){return $e(e)?s.replace(/\$l/g,Ot(e.length/50,4)):St(e)||U(e)?s.replace(/\$[cp]/g,Ot(e.circumference/50,4)).replace(/\$a/g,Ot(e.area/2500,4)):qt(e)?s.replace(/\$r/g,a0(e.rad)).replace(/\$d/g,Ot(e.deg,4)+"\xB0"):s}function Kp(s){if(!s.props.label||!s.path)return;s.$label.text=h0(s.props.label,s.path);let[e,t]=l0(s);s.$label.css("transform",`translate(${e.x}px,${e.y}px) rotate(${t}rad)`)}function l0(s){let e,t=s.$label.width,i=12,n=new G(new p(-t/2-3,-i-3),t+6,i+6);for(let r of c0(s.path,s,t,i)){e||(e=r);let o=n.rotate(r[1]).translate(r[0]);if(!Bt(s.$parent.geoData.tiles.values(),a=>{if(!a.path||a.props.status==="hidden"||a===s)return!1;let h=rt(a.path)?new wt(a.path,10):a.path;if(Q(h,o).length)return!0}))return r}return e||[R,0]}function*c0(s,e,t,i){var n;if(rt(s)){let r=e.computed?8:10;yield[s.shift(r+t/2,-r),0],yield[s.shift(-r-t/2,-r),0],yield[s.shift(r+t/2,r+i),0],yield[s.shift(-r-t/2,r+i),0]}else if(it(s)){let r=s.perpendicularVector,o=s.angle;r.y>=0&&(r=r.scale(-1),o+=Math.PI);let a=$e(s)?[.5,.3,.7]:[0,150,-150];for(let h of a)for(let l of[8,-8-i])yield[s.at(h).add(r.scale(l)),o]}else if(St(s))for(let r of s.edges){let o=r.perpendicularVector.scale(8),a=r.angle;o.y>=0&&(o=o.scale(1+i/8),a+=Math.PI),yield[r.midpoint.add(o),a]}else if(U(s))yield[s.at(7/8).shift(5+t/2,-5),0],yield[s.at(5/8).shift(-5-t/2,-5),0],yield[s.at(1/8).shift(5+t/2,5+i),0],yield[s.at(3/8).shift(-5-t/2,5+i),0];else if(qt(s)){let r=s.isRight?20*Math.sqrt(2):s.radius,o=((n=s.bisector)==null?void 0:n.unitVector.scale(r+6))||R,a=o.angle();yield[s.b.add(o).shift(t/2*Math.cos(a),i/2*(1+Math.sin(a))),0]}}var Ms=25,Yp=5.4,Zp=4.7;var p0="#ddd",d0={1:F.yellow,x:F.green,x2:F.blue,y:F.teal,y2:"#8d2ca1",xy:"#4e53d0"},hh=s=>s[0]==="-"?F.red:d0[s],Xp=s=>s[0]==="-"?s.slice(1):"-"+s;function lh({splitH:s,splitV:e,expr:t},i=!1){let n=s*e;return t.replace(/2$/,"^2")+(n>1?`${i?"//":"/"}${n}`:"")}function Ur(s,e,t,i){switch(s.startsWith("-")?s.slice(1):s){case"x2":return[t,t];case"y2":return[i,i];case"xy":return[t,i];case"x":return[e,t];case"y":return[e,i];default:return[e,e]}}function Qp(s){let[e,t]=s.reduce(([n,r],{props:o})=>{let a=o.splitH*o.splitV;return[n*a+r,r*a]},[0,1]),i=xe(e,t);return[e/i,t/i]}function*u0(s){let e=s,t=[];for(let i=1;ithis.updateFill()),this.props.watch("labels expr",()=>this.updateLabel()),this.resize(),this.move()}applyChange(t){super.applyChange(t),this.resize(),this.move()}get isRotated(){return nt(this.rot,45,135)||nt(this.rot,225,315)}get denominator(){return this.props.splitV*this.props.splitH}isInverseOf(t){return this.denominator===t.denominator&&Xp(this.props.expr)===t.props.expr}get size(){let{algebraXSize:t,algebraYSize:i}=this.$parent.options,{expr:n,splitV:r,splitH:o}=this.props,[a,h]=Ur(n,1,t,i);return[a*Ms/o,h*Ms/r]}resize(){let[t,i]=this.size;this.setPath(up(t,i).polygon)}updateLabel(){let[t,i]=this.size;this.isRotated&&([t,i]=[i,t]);let n=this.props.labels!=="hidden"&&t>=12&&i>=12;if(this.$label.toggle(n),!n)return;this.labelEqn.setValue(this.collision?"0":lh(this.props,i<25));let r=this.labelEqn.root,o=Math.min((t-2)/r.width*.8,i/r.height*.8,1);this.labelEqn.$row.css("transform",`translate(${-r.width/2}px,${-r.height/2}px)`),this.$label.css("transform",`scale(${o}) rotate(${-this.rot}deg)`)}updateFill(){this.$path.setAttr("fill",this.collision?_e(p0,this.$parent.flipTheme):this.props.color)}transform(t){this.updateLabel(),super.transform(t)}getSideLength(t){this.isRotated&&(t=t==="h"?"v":"h");let{expr:i,splitV:n,splitH:r}=this.props,[o,a]=Ur(i,"1","x","y");return t==="h"?[o,1/r]:[a,1/n]}getEdge(t){let i=gt(t-Math.round(this.rot/90),4);return this.transformed.edges[i]}setCollision(t){this.collision=t,this.updateFill(),this.updateLabel()}move(t){super.move(t);let i=this.collision;if(i){if(p.distance(this.posn,i.posn)<.95*Ms&&this.isInverseOf(i))return;i.setCollision(),this.setCollision()}for(let n of this.$parent.getTilesOfType("algebra"))if(!(n.collision||!this.isInverseOf(n))&&!(p.distance(this.posn,n.posn)>=.95*Ms)){this.setCollision(n),n.setCollision(this);return}}split(t,i=2){this.isRotated&&(t=t==="h"?"v":"h");let[n,r]=this.size,o=t==="h"?new Y(new p(-n/2,0),new p(n/2,0)):new Y(new p(0,-r/2),new p(0,r/2)),a=ft(ut({},this.props.raw),{splitH:t==="h"?this.props.splitH*i:this.props.splitH,splitV:t==="v"?this.props.splitV*i:this.props.splitV});return this.delete(),z(h=>{let l=this.worldPosn(o.at((h+.5)/i));return H.create(this.$parent,Object.assign({},a,{x:l.x,y:l.y}))},i)}static merge(t){let i=It(...t.map(f=>f.transformed)),{x:n,y:r}=i.center,o=t.every(f=>f.isRotated)?90:0,a=t[0].props.expr,{algebraXSize:h,algebraYSize:l}=t[0].$parent.options,c=Ur(a,Ms,h*Ms,l*Ms)[0],u=Qp(t)[1],d=[...u0(u)].find(f=>f>=Math.round(c/(o?i.h:i.w)))||1,g=u/d,y=H.create(t[0].$parent,{name:"algebra",expr:a,splitH:d,splitV:g,x:n,y:r,rot:o});for(let f of t)f.delete();return y}static makeThumbnail(t,i){let n=i.expr,[r,o]=Ur(n,20,78,64),a=n[0]==="-"?n.slice(1):n,h=a==="y2"?112:["x2","xy"].includes(a)?28:2,l=a==="1"?2:["x","x2"].includes(a)?28:112;i.rot&&([h,l,r,o]=[l,h,o,r]),t.setRect(new G(new p(h,l),r,o)),t.setAttr("fill",hh(n));let c=m("g",{style:"font-size:15px;color:white;text-anchor:start",class:"equation"}),u=new Be(c,void 0,0,"",15,!0);u.setValue(lh(i)),u.$row.css("transform",`translate(${h+r/2-u.root.width/2}px, ${l+o/2-u.root.height/2}px)`),t.insertAfter(c)}static altText(t){return lh(t)+" Algebra Tile"}negate(){this.props.expr=Xp(this.props.expr),this.flipColor(hh(this.props.expr)),this.move()}};Cs.type="algebra",Cs.defaultProps={splitH:1,splitV:1},Cs=T([Ut],Cs);Mt([{id:"negate",type:"button",tileTypes:["algebra","dot","number-card"],label:"Negate",icon:"turn",useTextLabel:!0,click:s=>{for(let e of s)e.negate()}}]);Mt([{id:"merge-algebra",type:"button",tileTypes:["algebra"],label:"Merge",icon:"merge",useTextLabel:!0,show:s=>s.length<2||!s.every(e=>e.props.expr===s[0].props.expr)?!1:Qp(s)[0]===1,click:(s,e)=>{e.selection.add(Cs.merge(s),!0)}},{id:"splitV",type:"button",tileTypes:["algebra"],label:"Split Vertically",icon:"split-v",show:s=>s.every(e=>e.props.splitV<8),click:(s,e)=>{e.selection.select(s.flatMap(t=>t.split("v",2)))}},{id:"splitH",type:"button",tileTypes:["algebra"],label:"Split Horizontally",icon:"split-h",show:s=>s.every(e=>e.props.splitH<8),click:(s,e)=>{e.selection.select(s.flatMap(t=>t.split("h",2)))}},{id:"split",type:"range",tileTypes:["algebra"],label:"Denominator:",value:"number",icon:"split-h",location:"more",get:s=>[s.props.splitH,s.props.splitV],set:(s,e)=>{e.props.assign({splitH:B(Math.round(s[0]),1,8),splitV:B(Math.round(s[1]),1,8)}),e.resize(),e.updateLabel()}}]);var Jp=1,f0=.2,m0=5;function g0([s,e],t,i){if(!i)return[Math.min(s,t),Math.max(e,t)];let n=eh.length)),n=O(i),r=i.findIndex(h=>h/n>e)+1,o=i.findIndex(h=>h/n>t)+1,a=e<=t?s.points.slice(r,o):[...s.points.slice(r),...s.points.slice(0,o)];return new te(s.at(e),...a,s.at(t))}return s}function ch(s,e,t,i){let n=Jp,r=-1;for(let o=e+1;on&&(r=o,n=a)}n>Jp&&(r-e>1&&ch(s,e,r,i),i.push(s[r]),t-r>1&&ch(s,r,t,i))}function w0(s){if(s.length<=2)return s;let e=[s[0]];return ch(s,0,s.length-1,e),e.push(O(s)),e}function y0(s){if(s.length<=2)return De(new te(...s));let e=s.map((t,i)=>{let n=s[i-1]||t.subtract(s[i+1].subtract(t).unitVector),r=s[i+1]||t.subtract(s[i-1].subtract(t).unitVector),o=Math.atan2(r.y-n.y,r.x-n.x),a=Math.abs(new kt(n,t,r).sup.rad/Math.PI-.5),h=Math.min(p.distance(n,r),100)*a*f0;return new p(Math.cos(o),Math.sin(o)).scale(h)});return s.map((t,i)=>{if(i===0)return`M${t.x.toFixed(2)} ${t.y.toFixed(2)}`;if(p.distance(s[i-1],t)<4)return`L${t.x.toFixed(2)},${t.y.toFixed(2)}`;let n=s[i-1].add(e[i-1]),r=t.subtract(e[i]);return`C${n.x.toFixed(2)},${n.y.toFixed(2)} ${r.x.toFixed(2)},${r.y.toFixed(2)} ${t.x.toFixed(2)},${t.y.toFixed(2)}`}).join("")}var He=class s{constructor(e,t,i,n,r){this.$parent=e;this.brush=n;this.options="";this.$el=m("path",{class:`stroke ${n}`},e.$strokes),this.id=r||We(10),this.setColor(i),t&&this.parse(t),e.strokes.set(this.id,this),this.$parent.pendingStrokes.add(this)}setColor(e){this.color=e,this.$el.setAttr("stroke",_e(e,this.$parent.flipTheme))}parse(e){if(this.options=e,e.startsWith("M")){let t=oa(e);this.path=new te(...t),this.$el.setAttr("d",e)}else this.path=ct(e)(Hr),this.path&&(this.snap=!0),this.$el.setAttr("d",this.path?De(this.path):"")}start(e,t){var i;if(this.brush==="ruler"&&(e=((i=this.$parent.snapping.snap([e]))==null?void 0:i.posn)||e),this.startPoint=e,this.path=new te(e,e.shift(.01)),t&&this.brush!=="ruler"){this.utensil=t;let n=t.offset(e);this.utensilRange=[n,n+.01]}this.$el.draw(this.path)}addPoint(e){if(this.brush==="ruler"){let t=this.$parent.snapping.snap([e]),i=(t==null?void 0:t.posn)||e.snap(this.startPoint,m0);this.path=new Y(this.startPoint,i),this.$el.draw(this.path)}else if(this.utensil){let t=B(this.utensil.offset(e),0,1),i=U(this.utensil)||Ye(this.utensil);this.utensilRange=g0(this.utensilRange,t,i),this.path=v0(this.utensil,...this.utensilRange),this.$el.draw(this.path)}else this.path.points.push(e),this.$el.setAttr("d",this.$el.attr("d")+`L${e.x},${e.y}`)}end(){if(this.utensil||this.brush==="ruler")return this.snap=!0,this.options=this.path.toString().replace(/\.(\d{3})\d+/g,(e,t)=>`.${t}`),this.$parent.snapping.addStroke(this);{let e=w0(this.path.points);this.path=new te(...e),this.options=y0(e),this.$el.setAttr("d",this.options)}this.startPoint=this.utensil=this.utensilRange=void 0}flushChanges(){let e=this.serialize();return this.$parent.strokes.has(this.id)?[void 0,e]:[e,void 0]}get snapPoints(){if(this.snap){if($e(this.path))return[this.path.p1,this.path.p2];if(Dt(this.path))return[this.path.start,this.path.end]}}hitTest(e,t){if(!this.path)return!1;let i=this.path.project(e);return(e.x-i.x)**2+(e.y-i.y)**2t/2?i-t:i}var Kr=class{constructor(e){this.$parent=e;this.angle=0;this.startAngle=0;this.hasChanged=!1;this.showTools=!1;this.isMoving=!1;this.tiles=new Set;this.$tools=e.$(".transform-tools"),this.$shadow=e.$(".group-shadow"),this.$rect=this.$tools.$(".group-outline"),this.$rotateBar=this.$tools.$(".rotate-bar"),this.$rotateCircle=this.$tools.$(".rotate-circle");let t=e.$(".rotate-label");t.hide(),e.events.listen(this.$rotateCircle,{start:()=>{this.startAngle=this.angle,this.rotateStart(),t.show()},move:({startPosn:i,posn:n,event:r})=>{this.rotate(this.startAngle-new kt(n,this.center,i).deg);let o=Vt(r).subtract(e.topLeftPosition);t.setTransform(o.shift(b.isMobile?-15:5,b.isMobile?-100:-40)),t.text=gt(Rt(this.angle,1),360)+"\u2009\xB0"},end:()=>{this.rotateEnd(),t.hide()}})}bindKeyboardEvents(e){e.onKey("AllArrows r R",(t,i)=>{if(this.tiles.size){if(i==="r"||i==="R"){if(Array.from(this.tiles).some(r=>!r.canRotate))return;this.rotateStart();let n=i==="r"||i==="R"&&t.shiftKey&&t.getModifierState("CapsLock")?15:-15;this.rotate(this.angle+n),this.rotateEnd()}else{let n=R,r=t.shiftKey?5:25,o=i==="ArrowLeft"?-r:i==="ArrowRight"?r:0,a=i==="ArrowUp"?-r:i==="ArrowDown"?r:0,h=n.shift(o,a);this.moveStart(),this.move({posn:h,startPosn:n}),this.moveEnd()}this.$parent.trigger("shift-selection")}}),e.onKey("Escape",()=>this.clear())}get flatTiles(){return[...ke(this.tiles,!0)]}get size(){return this.tiles.size}add(e,t=!1,i=!1){t&&this.clear(),!e.isActive&&this.$parent.tiles.has(e.id)&&this.select([e],i)}select(e,t=!1){var i;(i=this.$parent.focussedTile)==null||i.blur(),this.$parent.zIndex.bringToFront(ke(e),!1,!0);for(let n of e)n.isActive||!this.$parent.tiles.has(n.id)||n.group||(this.tiles.add(n),n.select(),this.hasChanged=!0);t||this.update(!0)}remove(e,t=!1){e.group||!e.isActive||(e.deselect(),this.hasChanged=!0,this.tiles.delete(e),t||this.update(!0))}clear(){if(!this.isMoving){for(let e of this.tiles)e.deselect();this.tiles.size&&(this.hasChanged=!0),this.tiles.clear(),this.update(!0)}}getTileProperty(e){if(!this.size)return;let t=e(Vs(this.tiles.values()));for(let i of this.tiles)if(e(i)!==t)return;return t}update(e=!1){if(e&&!this.hasChanged)return;if(this.hasChanged=!1,!this.size){for(let o of[this.$shadow,this.$tools])o.hide();this.$parent.trigger("change-selection",{tiles:[],color:void 0});return}let t=Array.from(this.tiles).filter(o=>o.transformed);this.angle=this.getTileProperty(o=>o.rot)||0,this.rect=pp(t,J(this.angle)),this.center=this.rect.center;let i=t.every(o=>o.canRotate);if(t.length===1&&U(t[0].transformed)&&(i=!1),i&&this.getTileProperty(o=>o.rotateAroundOrigin)){let o=t[0].posn;t.slice(1).every(a=>a.posn.equals(o))&&(this.center=o,this.angle&&t.length===1&&(this.rect=It(t[0].transformed.rotate(-J(this.angle),o))))}this.$rotateBar.toggle(i),this.$rotateCircle.toggle(i);let n=this.size>1||t[0].showSelectionOutline;this.$rect.toggle(n),this.showTools=!this.getTileProperty(o=>o.hideSelectionOutline),this.$tools.toggle(this.showTools),this.$shadow.toggle(n&&this.showTools),(!i||!this.showTools)&&(this.rotateHandle=void 0),(this.size===1?t[0].$container:this.$parent.$svg).append(this.$tools),this.positionTools();let r=this.getTileProperty(o=>o.props.color);this.$parent.trigger("change-selection",{tiles:t,color:r})}positionTools(){if(!this.showTools)return;let e=this.bounds;for(let n of[this.$shadow,this.$rect])n.draw(e);let t=new p(this.center.x,this.rect.p.y),i=new Y(t,t.shift(0,-28)).rotate(J(this.angle),this.center);this.$rotateBar.setLine(i.p1,i.p2),this.$rotateCircle.setCenter(i.p2),this.rotateHandle=i.p2}get bounds(){return this.rect.rotate(J(this.angle),this.center)}getDragBounds(){let{canvas:e,canvasX:t,canvasY:i}=this.$parent.options;if(e==="infinite")return;let n=e==="notebook"?1/0:i!=null?i:0,r=It(...Array.from(this.tiles,o=>o.transformed));if(Number.isFinite(r.w))return new lt(-r.p.x,(t!=null?t:0)-r.p.x-r.w,-r.p.y,n-r.p.y-r.h,"swap")}moveStart(e=!1){if(!Bt(this.tiles,t=>!t.canEdit||t.isAnimating)){this.isMoving=!0,this.$parent.dropzoneManager.onMoveStart(this.tiles);for(let t of this.tiles)t.moveStart(e);this.startSnapPoints=[];for(let t of this.tiles)for(let i of t.snapPoints)this.startSnapPoints.some(n=>i.equals(n))||this.startSnapPoints.push(i);ed=this.rect,td=this.center,this.dragBounds=this.getDragBounds(),this.$parent.newTileShift=0,this.$parent.trigger("move-start")}}move({posn:e,startPosn:t},i=!1){if(!this.isMoving)return;let n=e.subtract(t);this.dragBounds&&!i&&(n=n.clamp(this.dragBounds));let r=this.startSnapPoints.map(h=>h.add(n)),o=this.$parent.snapping.snap(r);o&&(n=n.add(o.shift));let a=this.tiles.size===1?o:void 0;for(let h of this.tiles)h.move(n,a);this.rect=ed.translate(n),this.center=td.add(n),this.positionTools(),this.$parent.dropzoneManager.onMove(this.tiles),this.$parent.trigger("move-selection")}moveEnd(e,t=!1){if(this.isMoving){t&&this.$parent.options.canvas!=="infinite"&&this.move(e);for(let i of this.tiles)i.moveEnd();this.$parent.dropzoneManager.onMoveEnd(),Bt(this.tiles,i=>i.props.name==="geo")&&this.$parent.snapping.updateIntersections(),this.$parent.trigger("move-end"),this.isMoving=!1,this.$parent.flushChanges()}}rotateStart(){ph.clear();for(let e of this.tiles)for(let t of e.snapAngles)ph.add(gt(t+e.rot,180));Wr.clear(),Wr.add(0);for(let e of this.$parent.tiles.values())if(!e.isActive&&Bt(this.tiles,t=>p.distance(t.posn,e.posn)<140))for(let t of e.snapAngles)Wr.add(gt(t+e.rot,180));this.$parent.dropzoneManager.onMoveStart(this.tiles),this.$parent.newTileShift=0,this.$parent.trigger("rotate-start")}rotate(e){if(e=Pt(e,3),e===this.angle)return;let t=1/0;for(let n of ph)for(let r of Wr){let o=b0(r,n+e-this.startAngle,180);Math.abs(o)n.authoringOnly))return{};let t={},i=this.flatTiles;for(let n of i)t[n.id]=n.props.copy();for(let n of i)if(n.is("geo")){for(let r of n.parents)if(!i.includes(r)&&!(r.id in t)&&r.geoType==="point"){let o=`point(${r.path.x},${r.path.y})`;t[r.id]=Object.assign(r.props.copy(),{expr:o})}}return t}delete(){if(this.isMoving||this.$parent.option("noDeleting")||ns.isMoving)return;let e=ke([...this.tiles].filter(i=>i.canEdit),!0);this.tiles.clear();for(let i of e)i.delete();Bt(e,i=>i.props.name==="geo")&&this.$parent.snapping.updateIntersections(),this.$parent.flushChanges(),this.$parent.newTileShift=0}};var xt=class s{constructor(e=0,t=0,i=0){this.x=e;this.y=t;this.z=i}transform(e){if(e instanceof Ui&&(e=e.matrix),e.length!==4||e[0].length!==4)throw new Error("Must use a 4x4 matrix for 3D transforms!");let[[t],[i],[n],[r]]=At.product(e,[[this.x],[this.y],[this.z],[1]]);return new s(t/r,i/r,n/r)}equals(e){return x(this.x,e.x)&&x(this.y,e.y)&&x(this.z,e.z)}fixFloat(){return new s(x(this.x,0)?0:this.x,x(this.y,0)?0:this.y,x(this.z,0)?0:this.z)}add(e){return this.x+=e.x||0,this.y+=e.y||0,this.z+=e.z||0,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}lerp(e,t){return new s(tt(this.x,e.x||0,t),tt(this.y,e.y||0,t),tt(this.z,e.z||0,t))}scale(e){return new s(this.x*e,this.y*e,this.z*e)}get magnitude(){return Math.hypot(this.x,this.y,this.z)}get normalize(){return this.scale(1/this.magnitude)}get asArray(){return[this.x,this.y,this.z]}get inverse(){return new s(-this.x,-this.y,-this.z)}get xy(){return new p(this.x,this.y)}[Symbol.iterator](){return this.asArray.values()}static get zero(){return new s(0,0,0)}static get oneZ(){return new s(0,0,1)}static get one(){return new s(1,1,1)}static all(e){return new s(e,e,e)}static from2D(e){return new s(e.x,e.y,0)}static average(e){return new s(Os(e.map(t=>t.x)),Os(e.map(t=>t.y)),Os(e.map(t=>t.z)))}static dot(e,t){return e.x*t.x+e.y*t.y+e.z*t.z}static cross(e,t){let i=e.y*t.z-e.z*t.y,n=e.z*t.x-e.x*t.z,r=e.x*t.y-e.y*t.x;return new s(i,n,r)}};var ie={translate({x:s,y:e,z:t}){return[[1,0,0,s],[0,1,0,e],[0,0,1,t],[0,0,0,1]]},rotateX(s){let e=Math.cos(s),t=Math.sin(s);return[[1,0,0,0],[0,e,-t,0],[0,t,e,0],[0,0,0,1]]},rotateY(s){let e=Math.cos(s),t=Math.sin(s);return[[e,0,t,0],[0,1,0,0],[-t,0,e,0],[0,0,0,1]]},rotateZ(s){let e=Math.cos(s),t=Math.sin(s);return[[e,-t,0,0],[t,e,0,0],[0,0,1,0],[0,0,0,1]]},rotateAxis({x:s,y:e,z:t},i){let n=Math.hypot(s,e,t);n=1/n,s*=n,e*=n,t*=n;let r=Math.sin(i),o=Math.cos(i),a=1-o;return[[s*s*a+o,s*e*a-t*r,s*t*a+e*r,0],[e*s*a+t*r,e*e*a+o,e*t*a-s*r,0],[t*s*a-e*r,t*e*a+s*r,t*t*a+o,0],[0,0,0,1]]},fromEulerAngles(s,e,t){return At.product(ie.rotateX(s),ie.rotateY(e),ie.rotateZ(t))},scale({x:s,y:e,z:t}){return[[s,0,0,0],[0,e,0,0],[0,0,t,0],[0,0,0,1]]},scaleAll(s){return[[s,0,0,0],[0,s,0,0],[0,0,s,0],[0,0,0,1]]},perspective(s,e,t,i){let n=t*Math.tan(J(s)/2),r=-n,o=n*e,a=-o;return[[2*t/(o-a),0,(o+a)/(o-a),0],[0,2*t/(n-r),(n+r)/(n-r),0],[0,0,-((i+t)/(i-t)),-(2*i*t/(i-t))],[0,0,-1,0]]},transformPoint(s,e){return e instanceof xt?e.transform(s):new xt(e.x,e.y).transform(s)}},Ui=class{constructor(){this.matrix=At.identity(4)}clear(){return this.matrix=At.identity(4),this}translate(e=0,t=0,i=0){return this.matrix=At.product(this.matrix,ie.translate({x:e,y:t,z:i})),this}rotate(e=0,t=0,i=0){return this.matrix=At.product(this.matrix,ie.rotateZ(i),ie.rotateY(t),ie.rotateX(e)),this}scale(e){return this.matrix=At.product(this.matrix,ie.scale(e)),this}dragToRotate(e,t,i=100){let n=new xt(e.x,e.y,i**3/(i**2+e.length**2)).normalize,r=new xt(t.x,t.y,i**3/(i**2+t.length**2)).normalize,o=B(xt.dot(n,r),-1,1),a=xt.cross(n,r),h=ie.rotateAxis(a,2*Math.acos(o));return this.matrix=At.product(h,this.matrix),this}isRotationMatrix(){if(!x(At.determinant(this.matrix),1))return!1;let e=At.transpose(this.matrix);return At.product(this.matrix,e).every((i,n)=>i.every((r,o)=>x(r,n===o?1:0)))}toEulerAngles(){let e=this.matrix,t=Math.hypot(e[0][0],e[1][0]);if(x(t,0)){let a=Math.atan2(-e[1][2],e[1][1]),h=Math.atan2(-e[2][0],t);return[a,h,0]}let n=Math.atan2(e[2][1],e[2][2]),r=Math.atan2(-e[2][0],t),o=Math.atan2(e[1][0],e[0][0]);return[n,r,o]}};var x0=new $t(0,0,0);function $0(s){let e=s.r,t=s.c.x,i=s.c.y,n=.5523*e;return`M${t} ${i-e}C${t+n} ${i-e} ${t+e} ${i-n} ${t+e} ${i}C${t+e} ${i+n} ${t+n} ${i+e} ${t} ${i+e}C${t-n} ${i+e} ${t-e} ${i+n} ${t-e} ${i}C${t-e} ${i-n} ${t-n} ${i-e} ${t} ${i-e}`}var Xr=class{constructor(){this.transform=new Ui;this.visible=!0}getTransformed(e){let t=this;do e=e.transform(t.transform);while(t=t.parent);return e}get normal(){return this.getTransformed(xt.oneZ).add(this.getTransformed(xt.zero).inverse).normalize}project(e,t={fov:120}){if(t.fov===!1)return new p(e.x,e.y);let i=Math.exp(e.z/t.fov);return new p(e.x*i,e.y*i)}*getProjectedVertices(e){for(let t of this.getVertices())yield this.project(t,e)}},Wi=class extends Xr{constructor(t,i={},n){super();this.children=[];this.sorting=!1;this.$el=m("g",i,n);for(let r of t)this.addChild(r)}addChild(t){return t.parent&&t.parent.removeChild(t),this.children.push(t),this.$el&&t.$el&&this.$el.append(t.$el),t.parent=this,t}removeChild(t){let i=this.children.indexOf(t);i>=0&&this.children.splice(i,1),t.$el&&t.$el.remove(),t.parent=void 0}render(t){if(this.visible){if(this.sorting)for(let i of yi(this.children,n=>n.zIndex))this.$el.append(i.$el);for(let i of this.children)i.render(t)}}*getFaces(){for(let t of this.children)for(let i of t.getFaces())yield i}*getVertices(){for(let t of this.children)for(let i of t.getVertices())yield i}get zIndex(){return Os(this.children.map(t=>t.zIndex))}},Ki=class extends Xr{constructor(t,i={},n){super();this.shape=t;if(!t)this.commands=[];else if(typeof t=="string")this.commands=Tn(t);else{let o=U(t)?$0(t):De(t);this.commands=Tn(o)}let r=p.average(...this.commands.filter(o=>o.points.length).map(o=>p.average(...o.points)));this.centroid=new xt(r.x,r.y,0),n&&(this.color=n),this.$el=m("path",i)}render(t){if(!this.visible)return;let i=this.normal.z;if(t!=null&&t.hideBackface){let r=i>-.01;if(this.$el.toggle(r),!r)return}if(this.color){let r=$t.mix(this.color,x0,(Math.abs(i)+1)/2);this.$el.setAttr("fill",r),this.$el.setAttr("stroke",r)}let n=this.commands.map(r=>{let o=r.points.map(a=>{let h=this.project(this.getTransformed(new xt(a.x,a.y)),t);return`${h.x},${h.y}`});return r.type+o.join(",")}).join("");this.$el.setAttr("d",n)}get zIndex(){return this.getTransformed(this.centroid).z}*getFaces(){yield this}*getVertices(){if(!(!this.shape||typeof this.shape=="string"||!St(this.shape)))for(let t of this.commands)for(let i of t.points)yield this.getTransformed(new xt(i.x,i.y))}};var W=V.regular(3),ni=V.regular(4),pe=V.regular(5),sd={shape:W,children:[{shape:W,dihedral:70.53,rot:180},{shape:W,dihedral:70.53,parentEdge:1,rot:300},{shape:W,dihedral:70.53,parentEdge:2,rot:60}]},id={shape:ni,children:[{shape:ni,dihedral:90,myEdge:2,children:[{shape:ni,dihedral:90,myEdge:2}]},{shape:ni,dihedral:90,parentEdge:1,rot:270},{shape:ni,dihedral:90,parentEdge:2},{shape:ni,dihedral:90,parentEdge:3,rot:90}]},nd={shape:W,children:[{shape:W,dihedral:109.47,rot:180},{shape:W,dihedral:109.47,parentEdge:1,rot:300,children:[{shape:W,dihedral:109.47,parentEdge:1,rot:300}]},{shape:W,dihedral:109.47,parentEdge:2,rot:60,children:[{shape:W,dihedral:109.47,parentEdge:1,rot:300},{shape:W,dihedral:109.47,parentEdge:2,rot:60,children:[{shape:W,dihedral:109.47,parentEdge:1,rot:300}]}]}]},rd={shape:pe,children:[{shape:pe,dihedral:116.57,rot:180},{shape:pe,dihedral:116.57,parentEdge:1,rot:252},{shape:pe,dihedral:116.57,parentEdge:2,rot:324},{shape:pe,dihedral:116.57,parentEdge:3,rot:36},{shape:pe,dihedral:116.57,parentEdge:4,rot:108,children:[{shape:pe,dihedral:116.57,parentEdge:2,rot:324,children:[{shape:pe,dihedral:116.57,parentEdge:3,rot:36,children:[{shape:pe,dihedral:116.57,parentEdge:1,rot:252},{shape:pe,dihedral:116.57,parentEdge:2,rot:324},{shape:pe,dihedral:116.57,parentEdge:3,rot:36},{shape:pe,dihedral:116.57,parentEdge:4,rot:108}]}]}]}]},od={shape:W,children:[{shape:W,dihedral:138.19,rot:180},{shape:W,dihedral:138.19,parentEdge:1,rot:300,children:[{shape:W,dihedral:138.19,parentEdge:1,rot:300,children:[{shape:W,dihedral:138.19,parentEdge:2,rot:60,children:[{shape:W,dihedral:138.19,parentEdge:1,rot:300,children:[{shape:W,dihedral:138.19,parentEdge:1,rot:300}]},{shape:W,dihedral:138.19,parentEdge:2,rot:60}]},{shape:W,dihedral:138.19,parentEdge:1,rot:300}]},{shape:W,dihedral:138.19,parentEdge:2,rot:60}]},{shape:W,dihedral:138.19,parentEdge:2,rot:60,children:[{shape:W,dihedral:138.19,parentEdge:2,rot:60,children:[{shape:W,dihedral:138.19,parentEdge:1,rot:300,children:[{shape:W,dihedral:138.19,parentEdge:2,rot:60,children:[{shape:W,dihedral:138.19,parentEdge:1,rot:300,children:[{shape:W,dihedral:138.19,parentEdge:1,rot:300}]},{shape:W,dihedral:138.19,parentEdge:2,rot:60}]},{shape:W,dihedral:138.19,parentEdge:1,rot:300}]},{shape:W,dihedral:138.19,parentEdge:2,rot:60}]},{shape:W,dihedral:138.19,parentEdge:1,rot:300}]}]},ad=new V(new p(.587785,.466639),new p(0,.750495),new p(-.587785,.466639),new p(0,-.73981)),je={shape:ad,dihedral:89.7451,rot:180},nE={shape:ad,children:[ft(ut({},je),{parentEdge:1,myEdge:1,children:[ft(ut({},je),{children:[ft(ut({},je),{parentEdge:1,myEdge:1,children:[ft(ut({},je),{children:[ft(ut({},je),{parentEdge:1,myEdge:1,children:[ft(ut({},je),{children:[ft(ut({},je),{parentEdge:1,myEdge:1,children:[ft(ut({},je),{children:[ft(ut({},je),{parentEdge:1,myEdge:1})]})]})]})]})]})]})]})]})]};function hd(s,e,t){let i=V.regular(s).scale(e*zt(s)),n=new G(R,e,t).polygon,r=[{shape:i,rot:180,parentEdge:2}],o=z(a=>({shape:n,parentEdge:a,rot:360/s*a,children:a?void 0:r}),s);return{shape:i,children:o}}function ld(s,e,t){let i=V.regular(s).scale(e*zt(s)),n=new V(new p(-e/2,0),new p(e/2,0),new p(0,-t)),r=Kt(Math.acos(e/t/2/Math.tan(Math.PI/s))),o=z(a=>({shape:n,dihedral:r,parentEdge:a,rot:180+360/s*a}),s);return{shape:i,children:o}}var P0=At.identity(4);function cd(s,e,t,i){var g;let n=e.shape.edges[s.parentEdge||0],r=s.shape.edges[s.myEdge||0],o=J(s.dihedral||90),a=i(s);t.addChild(a);let h=xt.from2D(n.midpoint),l=xt.from2D(r.midpoint),c=xt.from2D(n.unitVector),u=s.rot?J(s.rot):0,d=((g=s.children)==null?void 0:g.map(y=>cd(y,s,t,i)))||[];return[a,h,l,c,u,o,d]}function dh(s,e,t=1){var o;let i=e(s),n=new Wi([i]);n.sorting=!0;let r=((o=s.children)==null?void 0:o.map(a=>cd(a,s,n,e)))||[];return uh(r,n,t),{group:new Wi([n]),foldTree:r}}function pd(s,e,t=P0){let[i,n,r,o,a,h,l]=s,c=tt(Math.PI,h,e),u=ie.rotateAxis(o,Math.PI-c);a&&(u=At.product(u,ie.rotateZ(a)));let d=r.transform(u),g=ie.translate(d.inverse.add(n));i.transform.matrix=At.product(t,g,u);for(let y of l||[])pd(y,e,i.transform.matrix)}function uh(s,e,t){e.transform.clear();for(let r of s)pd(r,t);let i=Array.from(e.getFaces()).map(r=>r.getTransformed(r.centroid)),n=xt.average(i).inverse;e.transform.translate(n.x,n.y,n.z)}function T0(s,e,t){let i=Math.cos(s),n=Math.cos(e),r=Math.cos(t),o=Math.sin(e),a=Math.acos((r-i*n)/(Math.sin(s)*o)),h=Math.acos((i-n*r)/(o*Math.sin(t)));return[a,h]}function dd(s,e){return Math.asin(Math.cos(s*e)/Math.cos(s/2))}var S0=new Set([60,90,108]),E0=[{internal:[60,90,90,90],dihedral:[144.74,135,135,135]},{internal:[60,60,60,60,90],dihedral:[153.23,153.23,153.23,142.98,142.98]},{internal:[60,90,108,90],dihedral:[159.09,148.28,148.28,159.09]},{internal:[60,60,60,60,108],dihedral:[164.18,164.18,152.93,152.93,152.93]}];function M0(...s){let e=s.length;if(e===3)return T0(s[0],s[1],s[2]);let t=s.map(n=>Math.round(Kt(n)));if((e===4||e===5)&&t.includes(60)&&t.every(n=>S0.has(n))){for(let n of E0)if(n.internal.length===e){for(let r=0;ro===n.internal[(a+r)%e]))return hs(n.dihedral,r).slice(0,e-1).map(o=>J(o))}}if(e===4&&t.filter(n=>n===60).length===3){let n=t.findIndex(l=>l!==60),r=(Math.PI-s[n])/4,o=Math.acos(-1/Math.sqrt(3)*Math.tan(r)),a=Math.acos(1-2/3*((3-Math.tan(r)**2)/4+(Math.sin(3*r)/Math.sin(2*r))**2));return hs([o,a,a,o],4-n).slice(0,e-1)}let i=Math.PI/N(s);return z(n=>{let r=dd(s[n],i),o=dd(s[n+1],i);return r+o},s.length-1)}var fh=(s,e)=>gt(s+1,e.size),mh=(s,e)=>gt(s-1,e.size);function C0(s,e){let t=s.polygon.points[mh(e,s)],i=s.polygon.points[e],n=s.polygon.points[fh(e,s)];return new kt(n,i,t).sup.rad}function A0(s){let e=s.find(a=>a.neighbours.filter(Boolean).length===1),t=mh(e.neighbours.findIndex(Boolean),e),i=[],n=e,r=t;do{let a=[];for(;a.push({face:n,vertex:r}),!!n.neighbours[r];){let h=n;n=n.neighbours[r],r=fh(n.neighbours.indexOf(h),n)}r=fh(r,n),i.push(a)}while(n!==e||r!==t);let o=new Gh(i);for(;;){let a=Math.max(3,...o.array.map(c=>c.val.length)),h=o.array.filter(c=>c.val.length>=a);if(!h.length)break;let l=new Set;for(let c of h){if(l.has(c))continue;let u=c.val.map(g=>C0(g.face,g.vertex)),d=M0(...u);for(let[g,y]of d.entries()){let f=c.val[g],v=c.val[g+1],w=f.vertex,$=mh(v.vertex,v.face);f.face.dihedral[w]=v.face.dihedral[$]=Math.max(y,f.face.dihedral[w]||0,v.face.dihedral[$]||0)}c.prev.val.push(...c.next.val),l.add(c.next),o.delete(c.next),o.delete(c)}}}function ud(s,e){return Math.max(...s.neighbours.map(t=>!t||t===e?0:ud(t,s)))+1}function fd(s,e){return s.visited?!0:(s.visited=!0,s.neighbours.filter(t=>t&&t!==e).some(t=>fd(t,s)))}function md(s,e,t,i){let n=s.neighbours.map((r,o)=>{if(!(!r||r===t))return md(r,e,s,s.dihedral[o])}).filter(Boolean);return{shape:s.polygon.translate(e.inverse),color:s.tile.props.color,children:n.length?n:void 0,dihedral:i?+Kt(i).toFixed(2):void 0,parentEdge:t?t.neighbours.indexOf(s):void 0,myEdge:t?s.neighbours.indexOf(t):void 0}}function k0(s){let e=s.map(t=>{let i=t.transformed.oriented,n=i.points.length;return{tile:t,polygon:i,size:n,neighbours:re(void 0,n),dihedral:re(void 0,n),edges:i.edges,center:i.centroid,radius:i.radius}});if(!e.some(t=>t.size<3)){for(let[t,i]of e.entries())for(let[n,r]of e.entries())if(!(t>=n)&&!(i.radius+r.radius!t.joined)&&!fd(e[0]))return e}}function gd(s){let e=k0(s);if(!e)return;A0(e);let t=Is(e,n=>ud(n)),i=t.polygon.centroid;return[i,md(t,i)]}var gh=s=>Xi[s%Xi.length]||F.yellow;function yd(s){var t;let e=((t=s.c||s.children)==null?void 0:t.map(i=>yd(i)))||[];return{shape:Yr(s.shape||s.s),color:s.color||s.a,children:e,dihedral:s.dihedral||s.d,parentEdge:s.parentEdge||s.p,myEdge:s.myEdge||s.m,rot:s.rot||s.r}}function bd(s){var t;let e=(t=s.children)==null?void 0:t.map(i=>bd(i));return e!=null&&e.length||(e=void 0),{s:oi(s.shape),a:s.color,c:e,d:s.dihedral,p:s.parentEdge,m:s.myEdge,r:s.rot}}function V0(s){return yd(we(s.replace(/([a-z]):/g,'"$1":'),{}))}function I0(s){return JSON.stringify(bd(s)).replace(/"([a-z])":/g,"$1:")}function ri(s,e=1){var i;let t=(i=s.children)==null?void 0:i.map(n=>ri(n,e));return Object.assign({},s,{children:t,shape:s.shape.scale(e)})}var vd=s=>s.split(",").map(e=>+e),vh=s=>s.map(e=>e.toFixed(4)).join(","),wh={Tetrahedron:{net:ri(sd,zt(3)*50),scale:1.1,name:"Tetrahedron"},Cube:{net:ri(id,zt(4)*50),scale:.8,name:"Cube"},Octahedron:{net:ri(nd,zt(3)*50),scale:.95,name:"Octahedron"},Dodecahedron:{net:ri(rd,zt(5)*50),scale:.42,name:"Dodecahedron"},Icosahedron:{net:ri(od,zt(3)*50),scale:.67,name:"Icosahedron"},Pyramid:{net:ld(6,50,100),scale:.57,name:"Pyramid"},Prism:{net:hd(6,50,100),scale:.45,name:"Prism"}},yh={fov:400},wd=[1.066,.243,-.088],rs=class extends H{constructor(t,i,n){var o;super(t,i,n);this.cannotRotateType=!0;this.net=((o=wh[this.props.net])==null?void 0:o.net)||V0(this.props.net),this.rotation=vd(this.props.rotation);let r=dh(this.net,a=>new Ki(a.shape,{class:"polygon-tile"},a.color||gh(a.shape.points.length)));this.solid=r.group,this.foldTree=r.foldTree,this.$el.append(this.solid.$el),this.$outline=m("path",{class:"outline"},this.$el),this.$moveBar=m("path",{d:"M0 0h30",class:"handle"},this.$el),this.$moveHandle=m("path",{d:"M0 0h14v14h-14Z",class:"handle",style:"cursor: grab"},this.$el),this.solid.$el.css("cursor","move"),this.props.watch("color",({color:a})=>{if(a){for(let h of this.solid.getFaces())h.color=a;this.render(!1)}}),this.render(),this.updateOutline(),t.events.listen(this.solid.$el,{start:()=>{t.selection.add(this,!0),this.$el.removeClass("active")},move:({posn:a,lastPosn:h})=>{this.solid.transform.dragToRotate(h.subtract(this.posn),a.subtract(this.posn),100),this.render(!1)},end:()=>{this.rotation=this.solid.transform.toEulerAngles(),this.props.rotation=vh(this.rotation),this.updateOutline(),t.flushChanges(),this.$el.addClass("active")},click:a=>t.tools.move.down(a),checkIfActive:()=>this.props.hinge>0})}applyChange(t){super.applyChange(t),this.rotation=vd(this.props.rotation),this.render(),this.updateOutline()}render(t=!0){t&&(this.solid.transform.clear(),uh(this.foldTree,this.solid.children[0],-this.props.hinge),this.solid.transform.rotate(...this.rotation)),this.solid.render(yh)}updateOutline(){let t=this.solid.getProjectedVertices(yh);this.path=V.convexHull(...t),this.$outline.draw(this.path),this.transform(),this.$moveBar.translate(this.path.points[0].x-30,this.path.points[0].y),this.$moveHandle.translate(this.path.points[0].x-45,this.path.points[0].y-7)}animateHinges(t,i=!1,n=800){return D(this,null,function*(){let r=i?this.rotation:[0,0,0],o=this.props.hinge;yield pt(a=>{this.props.hinge=tt(o,t,a),i&&(this.rotation=r.map(h=>h*(1-a))),this.render()},n).promise,this.props.rotation=vh(this.rotation),this.updateOutline()})}hingeStart(){this.startRotation=this.rotation,this.startAngle=this.props.hinge,this.$el.removeClass("active")}hingeMove(t){if(!x(t,this.props.hinge)){if(this.props.hinge=B(t,0,1),this.startRotation&&this.startAngle){let i=B(t/this.startAngle,0,1);this.rotation=this.startRotation.map(n=>i*n)}this.render()}}hingeEnd(){this.updateOutline(),this.props.rotation=vh(this.rotation),this.$el.addClass("active")}static fold(t){let i=gd(t);if(!i){xr("polyhedron-error");return}let n={name:"polyhedron",net:I0(i[1]),hinge:0,rotation:"0,0,0"},r=H.create(t[0].$parent,n),o=r.solid.children[0].transform.matrix;r.setTransform(i[0].shift(-o[0][3],-o[1][3])),r.props.hinge=1,setTimeout(()=>{r.props.hinge=0,r.animateHinges(1)},10);for(let a of t)a.delete();return r}unfold(){return D(this,null,function*(){this.$parent.selection.remove(this),this.props.hinge>0&&(yield this.animateHinges(0,!0));let t=Array.from(this.solid.getFaces()).map(i=>{let n=new V(...Array.from(i.getProjectedVertices())),r=this.props.color||i.color||gh(n.points.length);return H.create(this.$parent,{name:"polygon",shape:oi(n),color:r,x:this.posn.x,y:this.posn.y})});return this.delete(),t})}static makeThumbnail(t,i){let n=m("svg",{width:70,height:70},t),r=m("g",{transform:"translate(35, 35)"},n),{net:o,scale:a}=wh[i.net],h=dh(o,l=>new Ki(l.shape,{class:"polygon-tile"},gh(l.shape.points.length)),-1).group;h.transform.clear().rotate(...wd).scale({x:a,y:a,z:a}),r.append(h.$el),h.render(yh)}static altText(t){var i;return((i=wh[t.net])==null?void 0:i.name)||"Polyhedron"}};rs.type="polyhedron",rs.defaultProps={hinge:1,rotation:wd.join(",")},rs=T([Ut],rs);Mt([{id:"unfold",type:"button",tileTypes:["polyhedron"],label:"Unfold",click:s=>Promise.all(s.map(e=>e.unfold()))},{id:"hinges",type:"slider",tileTypes:["polyhedron"],label:"Hinges",start:s=>s.hingeStart(),move:(s,e)=>s.hingeMove(e),end:s=>s.hingeEnd(),get:s=>s.props.hinge}]);var L=50,at=Math.sqrt(3)/4*L;function zt(s){let e=Math.cos(Tt/s);return 1/Math.sqrt(2-2*e)}var xd={"equ-triangle":new V(new p(-L/2,at),new p(L/2,at),new p(0,-at)),square:V.regular(4,L*zt(4)),"reg-pentagon":V.regular(5,L*zt(5)),"reg-hexagon":V.regular(6,L*zt(6)),"reg-heptagon":V.regular(7,L*zt(7)),"reg-octagon":V.regular(8,L*zt(8)),"reg-decagon":V.regular(10,L*zt(10)),"reg-dodecagon":V.regular(12,L*zt(12)),rectangle:new G(new p(-L,-L/2),2*L,L).polygon,trapezium:new V(new p(-L,at),new p(L,at),new p(L/2,-at),new p(-L/2,-at)),rhombus:new V(new p(-L*3/4,at),new p(L/4,at),new p(L*3/4,-at),new p(-L/4,-at)),"right-triangle":new V(new p(-L/2,-L/2),new p(L/2,-L/2),new p(-L/2,L/2)),"rhombus-2":new V(new p(L/2-at,L/4),new p(-at-L/2,L/4),new p(at-L/2,-L/4),new p(at+L/2,-L/4)),chevron:new V(new p(-.75*L,2*at),new p(.25*L,2*at),new p(.75*L,0),new p(.25*L,-2*at),new p(-.75*L,-2*at),new p(-.25*L,0)),"right-triangle-2":new V(new p(-2*at,-L/2),new p(-2*at,L/2),new p(2*at,-L/2)),kite:new V(new p(0,-L),new p(2*at,-L/2),new p(0,L),new p(-2*at,-L/2)),dart:new V(new p(2*at,.75*L),new p(0,-.75*L),new p(-2*at,.75*L),new p(0,.25*L))},L0={"equ-triangle":"Equilateral Triangle",square:"Square","reg-pentagon":"Regular Pentagon","reg-hexagon":"Regular Hexagon","reg-heptagon":"Regular Heptagon","reg-octagon":"Regular Octagon","reg-decagon":"Regular Decagon","reg-dodecagon":"Regular Dodecagon",rectangle:"Rectangle",trapezium:"Trapezium",rhombus:"Rhombus","right-triangle":"Right Triangle","rhombus-2":"Rhombus",chevron:"Chevron","right-triangle-2":"Right Triangle",kite:"Kite",dart:"Dart"},O0=[[[-15.7728,63.1105],[-65.2725,56.0545],[-61.7426,-21.037],[-34.7275,-63.1105],[65.2725,-63.1105]],[[60.6056,14.8729],[-53.4909,57.394],[-80.668,-12.5086],[-20.582,-57.394],[80.668,-57.394]],[[0,-73.612],[50,12.9905],[15,73.612],[-50,12.9905],[-30,-73.612]],[[67.056,-58.248],[67.056,1.752],[-10.5597,58.248],[-67.056,-19.3675],[7.056,-58.248]],[[-74.4415,-47.6314],[35.5585,-47.6314],[74.4415,-8.733],[60.1965,44.3902],[-19.4415,47.6314]],[[47.6215,-81.108],[43.731,-26.2458],[-24.012,81.108],[-47.6215,-43.6179],[-7.3786,-81.108]],[[94.9659,43.7299],[-5.0343,43.7299],[-94.9659,0],[-5.0343,-43.7299],[42.1151,-41.1631]],[[-13.1927,57.1955],[76.8074,57.1955],[76.8257,-32.8045],[-9.8062,-57.1955],[-76.8257,-6.4506]],[[-3.2764,58.8874],[86.2804,29.1016],[26.2804,-43.7514],[-26.2804,-58.8874],[-86.2804,13.9666]],[[51.5265,-55],[58.4735,-14.7198],[9.6458,43.251],[-58.4735,55],[-58.4735,-55]],[[-95.733,-40.991],[53.87,-40.991],[95.733,-15.7718],[1.5099,40.991],[-95.733,-10.4271]],[[-85.642,-51.4515],[12.4961,-51.4515],[85.642,-13.2965],[-38.4855,51.4515],[-85.642,18.5485]],[[-69.99,67.0025],[84.488,2.9975],[84.488,-67.0025],[14.488,-67.0025],[-84.488,32.0117]],[[-15.6401,96.696],[46.9202,6.219],[8.0799,-96.696],[-46.9202,-96.696],[-46.9202,51.458]],[[-46.6683,85],[-46.6683,22.7758],[15.5561,-85],[46.6683,-31.1122],[15.5561,85]],[[0,-46.65],[-43.301,-21.65],[-43.301,46.65],[43.301,46.65],[43.301,-21.65]],[[-25,46.65],[25,46.65],[59.15,-12.5],[0,-46.65],[-59.15,-12.5]],[[0,-64.951],[-50,21.65],[-25,64.951],[25,64.951],[50,21.65]]].map(s=>new V(...s.map(e=>new p(...e)))),Xi=["","","",F.yellow,F.blue,F.green,F.red,F.teal,F.purple],R0={trapezium:F.orange,"right-triangle":F.green,"rhombus-2":F.lime,chevron:F.orange,kite:F.purple,dart:F.teal},D0={"equ-triangle":F.green,square:F.yellow,"reg-pentagon":F.blue,"reg-hexagon":"#ffd615",rectangle:F.yellow,trapezium:"#cc1030",rhombus:F.blue,"rhombus-2":"#e6e2c6",chevron:"#cc1030","right-triangle-2":"#ffd615",kite:"#134791",dart:F.purple},N0=[...$t.rainbow(15).map(s=>s.hex),F.red,F.blue,F.yellow],G0=new Set(["trapezium","rhombus","rhombus-2","rectangle","right-triangle","right-triangle-2"]),z0=new Set(["equ-triangle","square","reg-pentagon","reg-hexagon","reg-heptagon","reg-octagon","reg-decagon","reg-dodecagon","rectangle","trapezium","kite","dart"]),oi=s=>s.points.map(e=>`${e.x.toFixed(2)} ${e.y.toFixed(2)}`).join(","),B0=s=>new V(...s.split(",").map(e=>{let[t,i]=e.split(" ");return new p(+t||0,+i||0)}));function Yr(s){return s.startsWith("pentagon-")?O0[+s.slice(9)-1]:/^[\d.-]/.test(s)?B0(s):xd[s]||xd.square}function $d(s,e,t=!1){return s.startsWith("pentagon-")?N0[+s.slice(9)-1]:(t?D0:R0)[s]||Xi[e%Xi.length]||F.yellow}var Yi=class extends ii{constructor(e,t,i){super(e,t,i);let n=Yr(this.props.shape);this.props.watch("scale isFlipped",({isFlipped:r,scale:o})=>this.setPath(n.scale(o||1),r)),this.symmetric=z0.has(this.props.shape),this.props.color||(this.props.color=$d(this.props.shape,this.path.points.length,e.options.altColors))}static makeThumbnail(e,t,i){let n=G0.has(t.shape)?60:80,r=Yr(t.shape);r=r.scale((t.shape.startsWith("pentagon-")?41:36)/r.radius).shift(40,n/2);let o=m("svg",{width:80,height:n},e),a=m("path",{class:"polygon-tile",path:r},o);i.options.watch(h=>a.setAttr("fill",$d(t.shape,r.points.length,h.altColors)))}static altText(e){if(e.shape.startsWith("pentagon-")){let t=+e.shape.slice(9);return t<16?`Pentagon ${t}`:t===16?"Prismatic Pentagon":t===17?"Cairo Pentagon":"Floret Pentagon"}return L0[e.shape]||"Polygon"}};Yi.type="polygon",Yi=T([Ut],Yi);var ai=["polygon","tangram","polyomino","custom-polygon","rectangle","reg-polygon","fractal","penrose","aperiodic-hat"];Mt([{id:"flip",type:"button",label:"Flip",icon:"flip",useTextLabel:!0,tileTypes:[...ai,"arrow","egg","garden","number-frame"],show:s=>s.length>1||!!s[0].rot||!s[0].symmetric,click:(s,e)=>{let t=e.selection.center;for(let i of s)i.flip(t)}},{id:"cut",type:"button",tileTypes:ai,label:"Cut",icon:"cut",useTextLabel:!0,noFlush:!0,show:s=>s.every(e=>!(e.is("rectangle")&&e.props.cornerRadius>0)),click:(s,e)=>e.tools.cutPolygon.enable()},{id:"join",type:"button",label:"Join",icon:"merge",useTextLabel:!0,tileTypes:ai,location:"more",show:s=>s.length>1&&s.every(e=>!(e.is("rectangle")&&e.props.cornerRadius>0)),click:(s,e)=>{let t=s.map(o=>o.transformed),i=V.union(...t),n=s[0].props.color,r=i.map(o=>H.create(e,{name:"polygon",shape:oi(o),color:n}));for(let o of s)o.delete();e.selection.select(r,!0)}},{id:"fold-net",type:"button",label:"Fold Net",icon:"cube",useTextLabel:!0,tileTypes:ai,show:s=>s.length>2,click:s=>rs.fold(s)},{id:"animation",type:"select",tileTypes:ai,label:"Animation:",location:"music",flattenGroups:!0,feature:"noMusic",options:[{key:"vertices",label:"Vertices"},{key:"perimeter",label:"Perimeter"},{key:"area",label:"Area"},{key:"angles",label:"Angles"}],get:s=>{var e;return((e=s.props.animation)==null?void 0:e.replace("hidden","perimeter"))||"perimeter"},set:(s,e)=>e.props.animation=s},{id:"audio-labels",type:"checkbox",tileTypes:ai,label:"Show labels:",location:"music",flattenGroups:!0,feature:"noMusic",show:s=>s.every(e=>!["vertices"].includes(e.props.animation)),get:s=>s.props.labels==="number",set:(s,e)=>e.props.labels=s?"number":void 0}]);Mt([{id:"label",type:"input",label:"Label:",tileTypes:_r,icon:"text",authorOnly:!0,get:s=>s.props.textLabel||"",set:(s,e)=>e.props.textLabel=`${s}`},{id:"labelFontSize",type:"input",label:"Font size:",tileTypes:_r,icon:" ",value:"number",range:[1,15],increment:1,authorOnly:!0,show:s=>s.some(e=>e.props.textLabel),get:s=>5+(s.props.textLabelFontSize||0),set:(s,e)=>e.props.textLabelFontSize=+s-5},{id:"textLabelRotate",type:"checkbox",label:"Rotate label:",tileTypes:_r,icon:" ",authorOnly:!0,show:s=>s.some(e=>e.props.textLabel),get:s=>!!s.props.textLabelRotate,set:(s,e)=>e.props.textLabelRotate=s}]);Mt([{id:"scale",type:"input",label:"Scale:",location:"more",value:"number",range:[.1,10],icon:"geo-scale",increment:.1,tileTypes:["polygon","reg-polygon","rectangle","custom-polygon"],get:s=>s.props.scale||1,set:(s,e)=>{let t=e.path.centroid.scale(1-+s/(e.props.scale||1));e.setTransform(e.posn.add(t)),e.props.scale=+s,e.$parent.selection.update()}}]);var Pd='';var bt=50,_0=100,ui=class extends H{constructor(t,i,n){super(t,i,n);this.cannotRotateType=!0;this.cannotDragToSelect=!0;this.$el.addClass("utensil"),this.setup(),this.$handles=[0,1].map(r=>this.makeHandle("c",(o,a)=>{let h=r?this.posn:this.absoluteEnd;a=this.$parent.snapping.orthogonal(a,h),r&&(this.absoluteEnd=a);let l=r?this.posn:a;this.props.isFixed||(this.props.width=Math.max(p.distance(l,this.absoluteEnd),_0)),this.setTransform(l,Kt(this.absoluteEnd.angle(l))),this.update()})),this.update()}applyChange(t){super.applyChange(t),this.update()}flip(){this.props.isFlipped=!this.props.isFlipped,this.update()}transform(t){super.transform(t),this.absoluteEnd=this.worldPosn(new p(this.props.width,0))}update(){this.$handles[1].setCenter({x:this.props.width,y:0}),this.transform()}getDrawingPath(t){var n;let i=(n=this.transformed)==null?void 0:n.project(t);if(i&&p.distance(t,i)<30)return this.transformed}},q0=new Set(["ruler","protractor","set-triangle","compass"]);function Sd(s){return q0.has(s.props.name)}var F0=2.54,Zr=60,hi=bt*F0;function*Td(s,e,t,i){let n=(e+.1)/s;for(let r=0;r<=n;r+=1){let o=i?i.findIndex(h=>!(r%h)):-1,a=r*s;yield[t?e-a:a,o]}}var li=class extends ui{constructor(t,i,n){super(t,i,n);this.padding=[0,20,0,20];this.props.watch("units fixed",()=>this.update())}setup(){this.$glass=m("rect",{x:-20,height:Zr,class:"glass",rx:5},this.$el),this.$ticks=m("path",{class:"ticks"},this.$el),this.$labelsTop=z(t=>m("text",{text:t},this.$el),31),this.$labelsBottom=z(t=>m("text",{text:t,y:42},this.$el),12),this.$labelsBottom[0].text="0 in"}update(){let{units:t,width:i,isFlipped:n}=this.props,r=t==="both",o=t==="hidden";this.$glass.setAttr("width",i+40),this.path=new G(R,i,Zr);let a="";if(!o&&t!=="in")for(let[l,c]of Td(bt/10,i,n,[10,5]))a+=`M${l} 0v${([20,15][c]||10)*(r?.8:1)}`;if(!o&&t!=="cm"){let l=r?Zr:0;for(let[c,u]of Td(hi/16,i,n,[16,8,4]))a+=`M${c} ${l}v${([20,16,12][u]||8)*(r?-.8:1)}`}this.$ticks.setAttr("d",a),this.$labelsTop[0].text=t==="in"?"0 in":"0 cm";let h=t==="in"?hi:bt;for(let[l,c]of this.$labelsTop.entries())c.toggle(!o&&l*h<=i+.1),c.setAttr("y",r?26:32),c.setAttr("x",n?i-h*l:h*l);for(let[l,c]of this.$labelsBottom.entries())c.toggle(!o&&r&&l*hi<=i+.1),c.setAttr("x",n?i-hi*l:hi*l);super.update()}getSnapPoints(){if(this.props.units==="hidden")return[];let t=this.props.units==="both",i=hi/2,n=z(o=>new p(this.props.isFlipped?this.props.width-o*bt:o*bt,0),this.props.width/bt),r=z(o=>new p(this.props.isFlipped?this.props.width-o*i:o*i,t?Zr:0),this.props.width/i);return this.props.units==="cm"?n:t?[...n,...r]:r}getSnapLines(){let[t,i,n]=this.path.edges;return this.props.units==="both"?[t,n]:[t]}getDrawingPath(t){if(!this.transformed)return;let[i,n,r]=this.transformed.edges,o=p.distance(t,i.project(t)),a=p.distance(t,r.project(t));return o<30?i:this.props.units==="both"&&a<30?r:void 0}static altText(){return"Ruler"}};li.type="ruler",li.defaultProps={width:400,layer:"front",units:"cm"},li=T([Ut],li);function H0(s){return`M0-${s}A${s},${s},0,0,0-${s},0V3a5,5,0,0,0,5,5H${s-5}a5,5,0,0,0,5-5V0A${s},${s},0,0,0,0-${s}Z`}var ci=class extends ui{constructor(){super(...arguments);this.padding=[0,0,10,0]}setup(){this.$glass=m("path",{d:"",class:"glass"},this.$el),this.$ticks=m("path",{class:"ticks"},this.$el),this.$labels=z(t=>[m("text",{text:t*10},this.$el),m("text",{text:t*10,style:"font-size:9px"},this.$el)],19),this.$labels[9][0].css("font-size","20px"),this.$labels[9][1].hide()}update(){let t=this.props.width;this.path=new Ft(R,new p(-this.props.width,0),Math.PI),this.$glass.setAttr("d",H0(t));let i="",n=this.props.width<120?5:1;for(let r=0;r<=180;r+=n){let o=!(r%10),a=!o&&!(r%5),h=p.fromPolar(J(-r)),l=t-(o?30:a?23:15);i+=`M${h.x*t} ${h.y*t}L${h.x*l} ${h.y*l}`,o&&(i+=`M${h.x*8} ${h.y*8}L${h.x*(t-60)} ${h.y*(t-60)}`)}this.$ticks.setAttr("d",i);for(let[r,[o,a]]of this.$labels.entries()){if(r===9){o.setAttr("y",52-t);continue}o.toggle(t>160||!(r%3)),a.toggle(t>160),o.setAttr("y",44-t),a.setAttr("y",55-t),o.setAttr("transform",`rotate(${(this.props.isFlipped?-1:1)*(90-10*r)})`),a.setAttr("transform",`rotate(${(this.props.isFlipped?1:-1)*(90-10*r)})`)}super.update()}getSnapPoints(){return[R,this.path.start,this.path.at(.5),this.path.end]}getSnapLines(){return[]}static altText(){return"Protractor"}};ci.type="protractor",ci.defaultProps={width:200,layer:"front"},ci=T([Ut],ci);var bh=234,to=150;function j0(s){let e=sm("text",{text:t,y:-23},this.$el),31),this.$hLabels[0].hide(),this.$vLabels=z(t=>m("text",{text:t,x:25,"dominant-baseline":"central"},this.$el),31),this.$vLabels[0].hide()}update(){this.path=new V(R,new p(this.props.width,0),new p(0,-this.props.width)),this.$glass.setAttr("d",j0(this.props.width));let t=this.props.width-50,i="",n=2,r=1;for(let o=0;o<=t;o+=bt/10){let a=o%bt?o%(bt/2)?0:r:n,h=o<10?-10*(o/10):[-10,-15,-20][a];i+=`M${o} 0V${h}`}for(let o=0;o<=t;o+=bt/10){let a=o%bt?o%(bt/2)?0:r:n,h=o<10?10*(o/10):[10,15,20][a];i+=`M0,${-o} H${h}`}this.$ticks.setAttr("d",i);for(let[o,a]of this.$hLabels.entries())o>0&&a.toggle(this.props.width>=to&&o0&&a.toggle(this.props.width>=to&&oi.at(a*bt/t),t/bt),o=z(a=>n.at(a*bt/t),t/bt);return r.concat(o)}getSnapLines(){return[this.path]}static altText(){return"Set Triangle"}};pi.type="set-triangle",pi.defaultProps={width:280,layer:"front"},pi=T([Ut],pi);var Qr=375,Jr=new p(54,68),di=class extends ui{setup(){this.$el.html=Pd,this.$pencil=this.$el.$(".pencil"),this.$top=this.$el.$(".top"),this.$legPin=this.$el.$(".leg-pin"),this.$legPencil=this.$el.$(".leg-pencil"),this.props.watch("color",({color:n})=>this.$pencil.css("fill",n));let t,i=0;this.$parent.events.listen(this.$pencil.$("g"),{start:n=>{let r=new p(this.props.width,0).rotate(J(this.rot)).add(this.posn);t=new He(this.$parent,"",this.props.color,"pen"),t.start(r,new wt(this.posn,this.props.width)),i=Kt(n.posn.angle(this.posn))-this.rot;for(let o of this.$handles)o.setAttr("hidden",!0)},move:n=>{this.rot=Kt(n.posn.angle(this.posn))-i,this.transform();let r=p.fromPolar(J(this.rot),this.props.width).add(this.posn);t.addPoint(r)},end:()=>{t.end(),this.$parent.flushChanges(),t=void 0;for(let n of this.$handles)n.removeAttr("hidden")}}),this.$parent.events.listen(this.$top,{start:n=>{i=Kt(n.posn.angle(this.posn))-this.rot;for(let r of this.$handles)r.setAttr("hidden",!0)},move:n=>{this.rot=Kt(n.posn.angle(this.posn))-i,this.transform()},end:()=>{this.$parent.flushChanges();for(let n of this.$handles)n.removeAttr("hidden")}})}update(){this.props.width>730&&(this.props.width=730);let t=this.props.width-Jr.x,i=Qr-Jr.y,n=new wt(R,Qr),r=new wt(new p(t,-Jr.y),i),o=Q(n,r)[0],a=Math.acos(o.x/Qr),h=Math.acos((t-o.x)/i);this.$legPin.css("transform",`rotate(${-a+Ya}rad`),this.$legPencil.css("transform",`rotate(${h-Ya}rad`),this.$pencil.setTransform({x:this.props.width-Jr.x,y:0}),this.$top.setTransform({x:o.x,y:Qr+o.y}),this.path=new Y(R,new p(this.props.width,0)),super.update()}getSnapPoints(){return[R,new p(this.props.width,0)]}getDrawingPath(){}static altText(){return"Compass"}};di.type="compass",di.defaultProps={width:300,layer:"front",color:F.red},di=T([Ut],di);Mt([{id:"flip",type:"button",tileTypes:["ruler","protractor"],label:"Flip",icon:"flip",useTextLabel:!0,click:s=>{for(let e of s)e.flip()}}]);Mt([{id:"labels",type:"select",tileTypes:["ruler"],label:"Labels:",options:[{label:"Centimeters",key:"cm"},{label:"Inches",key:"in"},{label:"Both",key:"both"},{label:"None",key:"hidden"}],location:"more",get:s=>s.props.units,set:(s,e)=>e.props.units=s},{id:"fixed-length",type:"checkbox",tileTypes:["ruler"],label:"Fixed Length",location:"more",get:s=>!!s.props.isFixed,set:(s,e)=>e.props.isFixed=s}]);var Ue=class{constructor(e){this.$parent=e}getTileAt(e){let t=this.$parent.snapping.snapGeo(e.posn);if(t!=null&&t.tile&&t.tile.canSelect)return t.tile;let i=e.target;for(;i;){let n=Fr.get(i);if(n!=null&&n.canSelect&&n.props.name!=="geo")return n;if(i=i.parentNode||void 0,i===this.$parent._el)return}}hoverGeoTile(e){var t;this.hoveringTile!==e&&((t=this.hoveringTile)==null||t.hover(!1)),e==null||e.hover(),this.hoveringTile=e}down(e){}start(e){}move(e){}up(e){}end(e){}click(e){}hover(e){}cancel(){}},eo=class extends Ue{constructor(){super(...arguments);this.clickTimeout=0}down(t){var n,r;let i=this.activeTile=(n=this.getTileAt(t))==null?void 0:n.root;this.activeTileWasSelected=i==null?void 0:i.isActive,this.previousSelection=void 0,(r=this.$parent.focussedTile)==null||r.blur(),this.$parent.warningBanner.hide(),i?(i.isActive&&this.$parent.events.shiftKey?this.$parent.selection.remove(i):(this.$parent.events.shiftKey||!i.isActive)&&this.$parent.selection.add(i,!this.$parent.events.shiftKey),i.down(t),this.$parent.events.grabbing()):this.$parent.events.shiftKey?this.previousSelection=new Set(this.$parent.selection.tiles):this.$parent.selection.clear()}up(t){var i;(i=this.activeTile)==null||i.up(t)}start(){if(this.activeTile){let t=!this.$parent.state.authorMode&&this.activeTile.props.status==="generator";(this.$parent.events.altKey||t)&&(t&&this.$parent.selection.add(this.activeTile,!0),this.$parent.paste(this.$parent.selection.copy(!0),R)),this.$parent.selection.moveStart()}else this.$parent.$selection.show()}move(t){var n;if(this.activeTile){this.$parent.selection.move(t);return}let i=G.aroundPoints([t.startPosn,t.posn]);this.$parent.$selection.setRect(i);for(let r of this.$parent.tiles.values()){if(!r.canSelect||r.cannotDragToSelect||!r.transformed||r.group)continue;let o=_i(i,r.transformed,r.props.name);(this.$parent.events.shiftKey&&((n=this.previousSelection)==null?void 0:n.has(r))?!o:o)?this.$parent.selection.add(r,!1,!0):this.$parent.selection.remove(r,!0)}this.$parent.selection.update(!0)}end(){this.activeTile?this.$parent.selection.moveEnd():this.$parent.$selection.hide(),this.$parent.events.grabbing(!1)}click(t){if(this.activeTile){this.activeTile.click(t,!this.activeTileWasSelected);let i=Date.now();i-this.clickTimeout<500&&this.activeTile.doubleClick(t),this.clickTimeout=i}}hover(t){let i=this.getTileAt(t);this.hoverGeoTile(i!=null&&i.is("geo")?i:void 0),this.$parent.$svg.css("cursor",i?"grab":"")}},so=class extends Ue{down({posn:e}){this.erase(e)}move({posn:e,lastPosn:t}){let i=p.distance(e,t)/4;for(let n=0;nn.distanceSquared(e)<100):U(t)&&i==="geo"?Math.abs(p.distance(e,t.c)-t.r)<10:t.contains(e)}erase(e){let t=this.$parent.option("noDeleting")?[]:this.$parent.tiles.values();for(let i of t)if(!(!i.transformed||i.cannotDragToSelect||!i.canSelect||!i.canEdit)&&this.shouldErase(e,i.transformed,i.props.name)){i.delete();return}for(let i of this.$parent.strokes.values())if(i.hitTest(e,10)){i.delete();return}}end(){this.$parent.flushChanges(),this.$parent.snapping.updateIntersections()}click(){this.end()}},io=class extends Ue{constructor(){super(...arguments);this.options="text"}down({posn:t}){let i=H.create(this.$parent,{name:this.options,x:t.x-10,y:t.y-15});this.$parent.trigger("add-tile",{tile:i}),this.$parent.setActiveTool("move"),i.focus(!0)}},no=class extends Ue{enable(){this.previousTool=this.$parent.state.tool,this.$parent.setActiveTool("pan")}down(t){this.initialOrigin=this.$parent.origin,this.startPosn=Vt(t.event)}move(t){let i=Vt(t.event).subtract(this.startPosn),n=this.initialOrigin.subtract(i.scale(1/this.$parent.zoom));this.$parent.setViewport(n,this.$parent.zoom)}disable(){this.$parent.setActiveTool(this.previousTool)}},ro=class extends Ue{constructor(){super(...arguments);this.options="pen"}getUtensil(t){for(let i of this.$parent.tiles.values()){let n=Sd(i)?i.getDrawingPath(t):void 0;if(n)return n}}down({posn:t}){this.stroke=new He(this.$parent,"",this.$parent.state.penColor,this.options),this.stroke.start(t,this.getUtensil(t))}move({posn:t}){this.stroke.addPoint(t)}click(){this.$parent.flushChanges(),this.stroke=void 0}end(t){this.stroke.end(),this.click()}},Zi=class extends Ue{constructor(){super(...arguments);this.options="line";this.angleIndex=0}expr(t,i){var n;switch(this.options){case"line":return`segment(${t},${i})`;case"circle":return`circle(${t},distance(${t},${i}))`;case"rect":return`rectangle(${t},${i}.x-${t}.x,${i}.y-${t}.y)`;case"angle":return`angle(${i},${(n=this.midPoint)==null?void 0:n.props.key},${t})`}}snapPoint(t){var o;this.$parent.options.canvas!=="infinite"&&(t=t.clamp(this.$parent.canvasBounds));let i=this.$parent.snapping.snap([t]);i&&(t=t.add(i.shift));let n="",r=((o=i==null?void 0:i.tile)==null?void 0:o.props.name)==="geo"?i==null?void 0:i.tile:void 0;return r!=null&&r.path&&rt(r.path)&&(n=r.props.key),i!=null&&i.intersection&&(n=i.intersection),{point:t,tile:r,expr:n||`point(${t.x},${t.y})`}}getOrMakePointTile(t){var n,r;if((n=t==null?void 0:t.tile)!=null&&n.path&&rt(t.tile.path))return t.tile;if((r=t==null?void 0:t.tile)!=null&&r.path){let o=t.tile.path.offset(t.point),a=new Yt(this.$parent,{expr:`${t.tile.props.key}.at(${o})`});return this.$parent.trigger("add-tile",{tile:a}),a}let i=new Yt(this.$parent,{expr:t.expr});return this.$parent.trigger("add-tile",{tile:i}),i}drawPendingPoint(t){var r,o;let i=((o=(r=t.tile)==null?void 0:r.path)==null?void 0:o.type)==="point",n=t.expr.startsWith("intersection");this.$parent.$pendingPoint.toggle(!i),i||(this.$parent.$pendingPoint.setCenter(t.point),this.$parent.$pendingPoint.setClass("intersection",n),this.$parent.$pendingPoint.setAttr("r",n?3.5:6))}down({posn:t}){let i=this.snapPoint(t),n=this.getOrMakePointTile(i);this.options==="angle"?(this.angleIndex===0?(this.startPoint=n,this.angleIndex=1):this.angleIndex===1?(this.midPoint=n,this.angleIndex=2,this.path=new Yt(this.$parent,{expr:this.expr(this.startPoint.props.key,n.props.key)})):(this.path.setExpr(this.expr(this.startPoint.props.key,n.props.key)),this.angleIndex=0,this.path=this.startPoint=this.midPoint=void 0),this.$parent.flushChanges()):this.startPoint=n}start(){var t;this.options!=="angle"&&(this.path=new Yt(this.$parent,{}),this.startPoint.pending=this.path.pending=!0,(t=this.$parent.$pendingPoint)==null||t.show(),this.hoverGeoTile())}move({posn:t}){var i;this.options!=="angle"&&(this.endSnap=this.snapPoint(t),this.path.setExpr(this.expr(this.startPoint.props.key,this.endSnap.expr),!0),this.drawPendingPoint(this.endSnap),this.hoverGeoTile((i=this.endSnap)==null?void 0:i.tile))}end(){var n;if(this.options==="angle")return;let t=p.distance(this.startPoint.path,this.endSnap.point)<8,i;t?this.path.delete():(i=this.getOrMakePointTile(this.endSnap),this.path.setExpr(this.expr(this.startPoint.props.key,i.props.key)),this.path.setPending(!1),this.$parent.trigger("add-tile",{tile:this.path})),this.startPoint.setPending(!1),(n=this.$parent.$pendingPoint)==null||n.hide(),this.hoverGeoTile(),this.$parent.snapping.updateIntersections(),this.$parent.flushChanges(),this.startPoint=this.path=this.endSnap=void 0}click(){this.options!=="angle"&&this.$parent.flushChanges()}hover(t){var n;let i=this.snapPoint(t.posn);this.drawPendingPoint(i),this.hoverGeoTile(((n=i==null?void 0:i.tile)==null?void 0:n.props.name)==="geo"?i.tile:void 0),this.options==="angle"&&this.angleIndex===2&&this.path.setExpr(this.expr(this.startPoint.props.key,i.expr))}cancel(){this.$parent.$pendingPoint.hide(),this.path&&this.path.delete(),this.startPoint=this.path=this.endSnap=void 0,this.angleIndex=0}},oo=class extends Zi{constructor(){super(...arguments);this.expression=""}enable(t){var i;this.expression=t,this.$parent.selection.clear(),this.$parent.setActiveTool("geoPending"),(i=window.event)!=null&&i.clientX&&this.hover({posn:me(window.event,this.$parent.$svg)})}makePath(){return this.path=new Yt(this.$parent,{}),this.path.$el.css("opacity",.5),this.path.pending=!0,this.path}down(t){if(!this.expression)return;super.down(t);let i=this.path||this.makePath();i.$el.css("opacity",1),i.setExpr(this.expression.replace(/\$1/g,this.startPoint.props.key)),i.pending=!1,this.path=void 0,this.$parent.selection.add(i,!0),this.$parent.flushChanges(),this.$parent.snapping.updateIntersections(),this.$parent.trigger("add-tile",{tile:i}),this.$parent.setActiveTool("move")}hover({posn:t}){var n;if(!this.expression)return;let i=this.snapPoint(t);this.drawPendingPoint(i),this.hoverGeoTile(((n=i==null?void 0:i.tile)==null?void 0:n.props.name)==="geo"?i.tile:void 0),this.path||this.makePath(),this.path.setExpr(this.expression.replace(/\$1/g,i.expr))}cancel(){super.cancel(),this.expression=""}},ao=class extends Ue{enable(){if(this.tiles=Array.from(this.$parent.selection.tiles),!this.tiles.length)return this.cancel();this.$parent.selection.clear(),this.$parent.setActiveTool("cutPolygon");for(let t of this.tiles)t.$el.addClass("active")}down(){}start({posn:t}){var i;this.tiles&&(this.startPoint=((i=this.$parent.snapping.snap([t]))==null?void 0:i.posn)||t,this.$stroke=m("line",{class:"stroke cut"},this.$parent.$strokes))}move({posn:t}){var i,n;this.tiles&&(this.endPoint=((i=this.$parent.snapping.snap([t]))==null?void 0:i.posn)||t.snap(this.startPoint,5),(n=this.$stroke)==null||n.setLine(this.startPoint,this.endPoint))}end(t){var n;if(!this.tiles)return;if(t.cancelled)return this.cancel();let i=new vt(this.startPoint,this.endPoint);for(let r of this.tiles||[]){let a=r.transformed.cut(i);if(a.length>1){for(let h of a)H.create(this.$parent,ft(ut({},r.props.raw),{name:"polygon",shape:oi(h),scale:void 0,index:void 0,isFlipped:void 0,width:void 0,height:void 0,sides:void 0,x:0,y:0,rot:0}));r.delete()}else r.$el.removeClass("active")}this.$parent.flushChanges(),(n=this.$stroke)==null||n.remove(),this.$stroke=this.tiles=this.startPoint=this.endPoint=void 0,this.$parent.setActiveTool("move")}click(){this.cancel()}cancel(){var t;for(let i of this.tiles||[])i.$el.removeClass("active");(t=this.$stroke)==null||t.remove(),this.$stroke=this.tiles=this.startPoint=this.endPoint=void 0,setTimeout(()=>this.$parent.setActiveTool("move"))}};var Ed='
';var Cd=new Set(["x","y","\u03B8","r"]);function Md(s,e){if(s instanceof jt&&s.fn==="="){let[t,i]=s.args;if(t instanceof Zs&&!(e==="graphing"&&Cd.has(t.i)))return{variable:t.i,expression:i}}return{expression:s}}var ho=class{constructor(){this.assignments=new Map;this.callbackDeps=new Map;this.updatedNames=new Set}get defined(){return[...this.assignments.keys()]}findFirstAssigner(e){var t;return(t=this.assignments.get(e))==null?void 0:t.keys().next().value}findDependants(e,t=[]){let i=[];for(let[r,o]of this.assignments.entries())o.size===1&&r!==e&&!t.includes(r)&&Vs(o.values()).unknowns.filter(h=>!t.includes(h)).includes(e)&&i.push(r);let n=_h(i,r=>this.findDependants(r,i.filter(o=>o!==r)));return[...i,...n]}validate(e){let t=new Set,i=(n,r=[])=>{if(!this.assignments.has(n)){t.add(n);return}if(r.includes(n))return{message:`The variable ${n} is defined recursively.`,locations:r.splice(r.indexOf(n)).map(a=>this.findFirstAssigner(a))};let o=this.assignments.get(n);if(o.size===1){let a=Vs(o.values());for(let h of a.unknowns){let l=i(h,[...r,n]);if(l)return l}}else return{message:`You have defined ${n} in multiple places.`,locations:Array.from(o.keys())}};for(let n of e.unknowns){let r=i(n);if(r)return{error:r,dependsOn:[],unknowns:[]}}return{dependsOn:[],unknowns:Array.from(t)}}evaluate(e){try{let{error:t,unknowns:i}=this.validate(e);return t||i.length?{error:t,value:Number.NaN}:{value:e.evaluate(this.evalContext)}}catch(t){return{value:Number.NaN}}}get evalContext(){let e={};for(let[t,i]of this.assignments.entries())i.size===1&&(e[t]=Vs(i.values()));return e}serializeEvalContext(e){let t={};for(let[i,n]of Object.entries(this.evalContext))e==="graphing"&&Cd.has(i)||(t[i]=n.toString());return t}substituteAssignments(e,t){let i=Md(e,t);return i.variable?new jt("=",[new Zs(i.variable),i.expression.recursiveSubstitute(this.evalContext)]):e.recursiveSubstitute(this.evalContext)}markUpdated(e){this.updatedNames.add(e);for(let t of this.findDependants(e))this.updatedNames.add(t)}flushChanges(){for(let[t,i]of this.callbackDeps.entries())i.some(n=>this.updatedNames.has(n))&&t();let e=Array.from(this.updatedNames);return this.updatedNames.clear(),e}updateSource(e,t,i,n=!0){this.removeSource(e,!1),this.assignments.has(t)||this.assignments.set(t,new Map),this.assignments.get(t).set(e,i),this.markUpdated(t),n&&this.flushChanges()}attemptUpdateSource(e,t,i,n=!0){if(typeof t=="string")try{t=Et.parse(t).collapse()}catch(o){return}let r=Md(t,i);return r.variable?this.updateSource(e,r.variable,r.expression,n):this.removeSource(e),r}removeSource(e,t=!0){for(let[i,n]of this.assignments.entries())n.has(e)&&this.markUpdated(i),n.delete(e),n.size===0&&this.assignments.delete(i);t&&this.flushChanges()}watch(e,t,i=!1){this.callbackDeps.set(t,e),i&&t()}unwatch(e){e&&this.callbackDeps.delete(e)}};var de="/polypad/assets/audio",Ad={roll:new ee(`${de}/roll.mp3`,.6,!1),spin:new ee(`${de}/spin.mp3`,.5,!1),coinToss:new ee(`${de}/coin-toss.mp3`,.3,!1),shuffle:new ee(`${de}/shuffle.mp3`,.3,!1),rng:new ee(`${de}/rng-roll.mp3`,.3,!1),draw:new ee(`${de}/card-draw.mp3`,.2,!1),click:new ee(`${de}/click.mp3`,.3,!1),woosh:new ee(`${de}/woosh.mp3`,.2,!1),rise:new ee(`${de}/rise.mp3`,.3,!1),fall:new ee(`${de}/fall.mp3`,.3,!1),splitCoins:new ee(`${de}/split-coins.mp3`,.175,!1),mergeCoins:new ee(`${de}/merge-coins.mp3`,.3,!1)};var Le=25,xh=Le*Math.sqrt(3)/2,U0=Math.sqrt(2*Le**2)/2;function fi(s,e,t){let i,n,r;t:for(let o of t)for(let a of e){let h=o.posn||o.path.project(a),l=h.subtract(a),c=l.length;if(c^-]/g,""),n=btoa(e.props.name+i+e.props.raw.color).replace(/=/g,""),r=(g=s.tileWeights.get(n))!=null?g:1;return[n,1,0,r,r]}function W0(s,e,t){let i={},n=0,r=(d,g=1)=>{let[y,f,v,w,$]=Ph(s,d);n+=g*w,y&&(i[y]||(i[y]=[0,0,0]),i[y][0]+=g*f,i[y][1]+=g*v,i[y][2]=$)};for(let d of e)r(d,1);for(let d of t)r(d,-1);if(x(n,0))return;let o=Object.keys(i).filter(d=>i[d][0]||i[d][1]),a=o.find(d=>!s.tileWeights.has(d))||O(o);if(!a)return!0;let[h,l,c]=i[a],u=x(l,0)?c-n/h:Math.max(...Bo(l,h,n-h*c-l*c*c));s.tileWeights.set(a,u),s.options.tileWeights=Array.from(s.tileWeights.entries()).map(d=>d.join("=")).join(",")}function Th(s,e){s.tileWeights.clear();for(let t of e.split(",")){let[i,n]=t.split("=");i&&s.tileWeights.set(i,+n||0)}}var kd="M0,26A18.1,18.1,0,0,0-18,44V72H18V44A18.1,18.1,0,0,0,0,26Z",K0=new Set(["text","number-line","spinner","decimal-grid","axes","custom-spinner","ruler","protractor","compass","geo","dot-machine","abacus","balance","chess-board","multi-jump","set-triangle","bucket","table","number-grid","chart","pie-chart","box-whisker","clock","polyhedron","rectangle","question-blank","logic-switch","logic-gate","logic-speaker","chess-piece","function-machine"]),Qi=15,Lt=40,Vd=180;function co(s){let e=s/2;return`M${e},0C${e},16,66.3,20,0,20S${-e},16${-e},0Z`}var mi=class extends H{constructor(t,i,n){super(t,i,n);this.cannotRotateType=!0;this.$beam=m("path",{class:"balance-beam"},this.$el),this.$left=m("path",{class:"balance"},this.$el),this.$right=m("path",{class:"balance"},this.$el),this.$base=m("path",{d:kd,class:"balance"},this.$el),this.dropzones=this.targetAreas().map(r=>this.$parent.dropzoneManager.createDropzone(this,{path:r,ignored:K0})),this.$handle=this.makeHandle("c",r=>{this.props.size=B(Pt(r.x-Lt,20),120,800),this.resize(),this.draw(),this.transform()}),this.$handle.css("cursor","ew-resize"),this.props.watch("color",({color:r})=>{this.$beam.css("stroke",r);for(let o of[this.$base,this.$left,this.$right])o.css("fill",r)}),this.customTransform(),this.resize(),this.draw()}onDropzonesChange(){this.rebalance(400)}applyChange(t){super.applyChange(t),"level"in t&&this.draw()}targetAreas(){let t=new G(new p(0,-Vd),this.props.size,Vd),i=t.shift(-this.props.size-Lt,this.props.level*Qi),n=t.shift(Lt,-this.props.level*Qi);return[i,n]}resize(){this.$left.setAttr("d",co(this.props.size)),this.$right.setAttr("d",co(this.props.size)),this.customTransform()}draw(t=this.props.level){let i=this.props.size/2+Lt,n=new p(-i,t*15),r=new p(i,-t*15);this.$beam.draw(new te(n.shift(0,10),n.shift(0,44),r.shift(0,44),r.shift(0,10))),this.$left.setTransform(n),this.$right.setTransform(r),this.$handle.setCenter({x:this.props.size+Lt,y:-t*15});let[o,a]=this.targetAreas();this.dropzones[0].updateTarget(o),this.dropzones[1].updateTarget(a)}rebalance(t=400){return D(this,null,function*(){let[i,n]=this.dropzones.map(d=>d.containedTiles),r=N(Array.from(ke(i),d=>Ph(this.$parent,d)[3])),o=N(Array.from(ke(n),d=>Ph(this.$parent,d)[3])),a=x(r,o)?0:r({tile:d,posn:d.posn.shift(0,l)})),u=Array.from(n,d=>({tile:d,posn:d.posn.shift(0,-l)}));yield H.animate([...c,...u],t,d=>{this.draw(tt(h,a,d)),this.$parent.selection.update()}),this.isAnimating=!1,this.transform(),this.$parent.selection.update()})}customTransform(){let t=this.props.level*Qi,i=this.props.size+Lt;this.path=new V(new p(-i,t),new p(-Lt,t),new p(-Lt,25),new p(Lt,25),new p(Lt,-t),new p(i,-t),new p(i,-t+48),new p(Lt,-t+48),new p(Lt,72),new p(-Lt,72),new p(-Lt,t+48),new p(-i,t+48))}getSnapPoints(){let t=this.props.level*Qi,i=this.props.size+Lt;return[new p(-i,t),new p(-Lt,t),new p(Lt,-t),new p(i,-t)]}getSnapLines(){let[t,i,n,r]=this.getSnapPoints();return[new Y(t,i),new Y(n,r)]}balance(){let[t,i]=this.dropzones.map(r=>r.containedTiles);if(W0(this.$parent,t,i))return xr("balance-error");for(let r of this.$parent.getTilesOfType("balance"))r.rebalance()}static makeThumbnail(t){let i=m("svg",{width:250,height:50,viewBox:"-290 -10 580 82",class:"scale"},t);m("path",{d:"M-160 10v34h320v-34",fill:"transparent",stroke:"#bbb","stroke-width":10},i),m("path",{d:co(240),transform:"translate(-160 0)",fill:"#bbb"},i),m("path",{d:co(240),transform:"translate(160 0)",fill:"#bbb"},i),m("path",{d:kd,fill:"#bbb"},i)}static altText(){return"Balance Scale"}};mi.type="balance",mi.defaultProps={level:0,size:240,color:"#bbb"},mi=T([Ut],mi);Mt([{id:"balance",type:"button",tileTypes:["balance"],label:"Balance",show:s=>s.length===1&&!!s[0].props.level,click:s=>{s[0].balance()}}]);function Id(s){return[...s].sort((e,t)=>e.props.zIndex-t.props.zIndex)}function Ld(s,e,t){let i=Oo(s,e,t);i>=0&&s.splice(i,1)}function X0(s,e){if(!s.length)return s.push({item:e,val:e.props.zIndex});let t=Lo(s,e.props.zIndex,Io.firstGreater);s.splice(t<0?s.length:t,0,{item:e,val:e.props.zIndex})}var po=class{constructor(e){this.$parent=e;this.sorted={front:[],normal:[],back:[]};this.layers=new WeakMap}clear(){this.sorted={front:[],normal:[],back:[]},this.layers=new WeakMap}addOrUpdate(e){let t=this.layers.get(e);t&&Ld(this.sorted[t.layer],e,t.z);let i=t&&t.layer!==e.props.layer,n=this.sorted[e.props.layer];(e.props.raw.zIndex===void 0||i)&&(e.props.raw.zIndex=n.length?O(n).val+1:0),this.layers.set(e,{layer:e.props.layer,z:e.props.zIndex}),X0(n,e)}remove(e){let t=this.sorted[e.props.layer];Ld(t,e,e.props.zIndex),this.layers.delete(e)}bringToFront(e,t,i){for(let n of Id(e)){if(n.noAutoLayering&&!t)continue;let r=O(this.sorted[n.props.layer]);r.item!==n&&(n.props.zIndex=r?r.val+1:0,i&&this.$parent.pendingChanges.add(n))}}bringToBack(e,t){for(let i of Id(e)){if(i.noAutoLayering&&!t)continue;let n=this.sorted[i.props.layer][0];if(n.item===i)return;i.props.zIndex=n?n.val-1:0}}getTileAbove(e){let t=this.sorted[e.props.layer],i=Oo(t,e,e.props.zIndex);for(let n=i+1;n

This colour is adjusted in dark mode.

Customise the Polypad features and UI, or use advanced tile properties and authoring tools. Learn more

\u2022 \u2022 Learn more

Polypad UI and features

Tile actions and properties

Display and audio options

`;function Sh(s=!0){let e=s?"":"hidden";return{mergeTiles:s,sidebar:e,toolbar:e,actionbar:e,settings:e,noCopyPaste:!s,noUndoRedo:!s,noPinchPan:!s,noDeleting:!s,noAudio:!s,noMusic:!s,noRotating:!s,noSnapping:!s,altColors:!1}}var uo=class extends E{bindPolypad(e){var u;this.bindModel(e.options);let t=this.$('input[type="color"]');t.change(d=>e.options.background=d),t.on("blur",()=>e.flushChanges());let i=this.$(".bg-warn"),n=()=>{let d=e.options.background||"#ffffff";t.value=d,t.next.css("background",d),i==null||i.toggle(b.theme.isDark&&e.flipTheme)};e.options.watch(n),b.onThemeChange(n),this.$("select").on("change",()=>{let d=e.options.canvas;e.options.canvasX=d==="infinite"?void 0:750,e.options.canvasY=d==="fixed"?750:void 0,e.resetViewport(),e.flushChanges()});for(let[d,g]of this.$$(".size").entries()){let y=d===1?"canvasY":"canvasX";g.onKey("Enter",()=>g.blur()),g.change(f=>{f&&(e.options[y]=(Math.round(+f)||15)*50,e.resetViewport())}),g.on("blur",()=>e.flushChanges()),e.options.watch(f=>g.value=`${(f[y]||0)/50}`)}for(let d of this.$$("input.toggle"))d.on("change",()=>e.selection.update());let o=this.$(".sidebar");e.options.watch(d=>o.checked=d.sidebar!=="hidden"),o.on("click",()=>e.options.sidebar=o.checked?"":"hidden");let a=this.$$(".setting");e.options.watch(({settings:d})=>{let g=(d==null?void 0:d.split(","))||[];for(let y of a)y.checked=!d||g.includes(y.data.key)});for(let d of a)d.on("change",()=>{e.options.settings=a.every(g=>g.checked)?void 0:a.filter(g=>g.checked).map(g=>g.data.key).join(",")||"other"});for(let d of this.$$(".advanced input, .authoring, .advanced select"))d.on("change",()=>setTimeout(()=>e.flushChanges()));Eh||(u=this.$(".handdrawn"))==null||u.parent.remove(),this.$(".authoring").bindVariable(e.state,"authorMode");let l=this.$$(".caption, .advanced");e.state.watch(d=>l.map((g,y)=>g.toggle(d.authorMode?!!y:!y)));let c=this.$$(".preset");for(let[d,g]of c.entries())g.on("click",()=>e.options.assign(Sh(!d)))}};uo=T([S("pp-customise",{template:Od})],uo);var Rd=12,Dd=s=>s.path.rotate(J(s.rot),s.is("group")?s.path.center:void 0),fo=class{constructor(e,t){this.tile=e;this.options=t;this.containedTiles=new Set;this.$path=m("path",{class:"dropzone",path:t.path,hidden:!0},e.$el)}canInsert(e){var n,r,o,a;let t=(r=(n=this.options.allowed)==null?void 0:n.has(e.props.name))!=null?r:!0,i=(a=(o=this.options.ignored)==null?void 0:o.has(e.props.name))!=null?a:!1;return t&&!i&&(!this.options.canAdd||this.options.canAdd(e))}hasReachedTileLimit(){return this.options.maxTiles?this.containedTiles.size>=this.options.maxTiles:!1}overlaps(e){if(!e.path)return!1;let t=Dd(e).translate(e.posn.subtract(this.tile.posn)).rotate(-J(this.tile.rot));return _i(this.options.path,t)}addTile(e){this.containedTiles.add(e),e.inDropZone=this}delete(){for(let e of this.containedTiles)e.inDropZone=void 0;this.containedTiles.clear(),this.$path.remove()}updateTarget(e,t){var n;this.options.path=e;let i=-((n=this.options.boxOffset)!=null?n:0);this.$path.draw(e.padding(i,i,i,i)),this.reflowLayout(t)}reflowLayout(e){if(!this.containedTiles.size||!this.options.layout||this.options.layout==="none")return;let t=this.getSortedTiles(),i=this.options.layout==="flow"?this.flowLayout(t):this.centerLayout(t),n=e?0:240;H.animate(i,n,()=>this.tile.$parent.selection.update())}getSortedTiles(){return Array.from(this.containedTiles).sort((e,t)=>Math.abs(e.posn.y-t.posn.y)<25?e.posn.x-t.posn.x:e.posn.y-t.posn.y)}flowLayout(e){var l;let t=Math.min(this.options.path.h,this.options.path.w),i=B(0,(t-50)/2,(l=this.options.padding)!=null?l:Rd),n=i,r=i,o=0,a=0,h=this.tile.posn.add(this.options.path.p);return e.map(c=>{let u=It(c.transformed);n+u.w+i>this.options.path.w+.001&&(r+=o+i,r>this.options.path.h-25+.001&&(a++,r=i+5*a),n=i+5*a,o=0);let d=h.add(c.posn).subtract(u.p).shift(n,r);return n+=u.w+i,o=Math.max(o,u.h),{tile:c,posn:d}})}centerLayout(e){var v;let t=e.map(w=>It(Dd(w))),i=Math.ceil(Math.sqrt(e.length)),n=Math.ceil(e.length/i),r=z(w=>oe(w*i,Math.min((w+1)*i,e.length)-1),n),o=z(w=>N(r[w].map($=>t[$].w)),n),a=Math.max(...o),h=z(w=>Math.max(...r[w].map($=>t[$].h)),n),l=N(h),c=(v=this.options.padding)!=null?v:Rd,u=o.map(w=>i>1?Math.min((this.options.path.w-w)/(i-1),c):0),d=n>1?Math.min((this.options.path.h-l)/(n-1),c):0,g=this.tile.posn.add(this.options.path.center).shift(-(a+(i-1)*Math.min(...u))/2,-(l+(n-1)*d)/2),y=0,f=0;return e.map((w,$)=>{let I=$%i,A=Math.floor($/i),M=g.shift(y,f).subtract(t[$].p);return(I+1)%i?y+=t[$].w+u[A]:(y=0,f+=h[A]+d),{tile:w,posn:M}})}};var Nd=s=>s.props.status!=="locked"&&s.props.status!=="hidden",mo=class{constructor(e){this.polypad=e;this.dropzones=new Map;this.lockedTiles=new Set;this.tilesMoved=!1}createDropzone(e,t){this.dropzones.has(e)||this.dropzones.set(e,new Set);let i=new fo(e,t);return this.dropzones.get(e).add(i),i}deleteDropzone(e){var t;e.delete(),(t=this.dropzones.get(e.tile))==null||t.delete(e)}clear(){for(let e of this.dropzones.values())for(let t of e)t.delete();this.dropzones.clear()}lockToZone(e,t){var i;(i=e.inDropZone)==null||i.containedTiles.delete(e),t.containedTiles.add(e),this.lockedTiles.add(e)}update(e){if(!this.dropzones.size)return;if(!e||Bt(e,n=>this.dropzones.has(n))){let n=Bh(e||[],r=>r.isDeleting);e=rn(this.polypad.tiles.values(),n)}let t=new Set,i=!1;t:for(let n of gp(e)){if(n.isDeleting&&(i=!0),n.isDeleting&&this.dropzones.has(n)){for(let r of this.dropzones.get(n))r.delete();this.dropzones.delete(n);continue}if(n.inDropZone){if(t.add(n.inDropZone.tile),!n.isDeleting&&this.lockedTiles.has(n))continue;n.inDropZone.containedTiles.delete(n),n.inDropZone=void 0}if(Nd(n)&&!(this.dropzones.has(n)||n.isDeleting)){for(let r of this.dropzones.values())for(let o of r)if(o.overlaps(n)){if(!o.canInsert(n)){o.options.ejectInvalid&&this.ejectFromZone(n,o);continue}if(o.hasReachedTileLimit()&&o.containedTiles.size){let a=O([...o.containedTiles]);this.ejectFromZone(a,o)}o.addTile(n),t.add(o.tile);continue t}}}for(let n of t){if(this.tilesMoved||i)for(let r of this.dropzones.get(n)||[])r.reflowLayout();n.isDeleting||n.onDropzonesChange()}this.polypad.trigger("dropzone-change",{tiles:t}),this.lockedTiles.clear(),this.tilesMoved=!1}ejectFromZone(e,t,i=20){let n=It(e.transformed),r=t.tile.posn.add(t.options.path.p),o=[{y:r.y-n.p.y-n.h-i},{x:r.x+t.options.path.w-n.p.x+i},{y:r.y+t.options.path.h-n.p.y+i},{x:r.x-n.p.x-n.w-i}];for(let[a,h]of o.entries()){let l=e.posn.shift(h.x||0,h.y||0);if(!(a<3&&this.polypad.getTileAt(l,["categorizer"])))return t.containedTiles.delete(e),e.inDropZone=void 0,H.animate([{tile:e,posn:l}],200,()=>e.$parent.selection.update())}}onMoveStart(e){if(!this.dropzones.size)return;let t=new Set;for(let i of e)for(let n of this.dropzones.get(i)||[])if(n.$path.show(),n.options.sticky)for(let r of n.containedTiles)t.add(r);this.polypad.selection.select(t)}onMove(e){if(!this.dropzones.size)return;let t=new Set;for(let[i,n]of this.dropzones.entries())if(!i.isActive)for(let r of n)r.$path.toggle(Bt(e,o=>{if(!Nd(o))return;let a=!t.has(o)&&(r.containedTiles.has(o)||r.canInsert(o))&&r.overlaps(o);return a&&t.add(o),a}))}onMoveEnd(){if(this.dropzones.size){this.tilesMoved=!0;for(let e of this.dropzones.values())for(let t of e)t.$path.hide()}}};var go=4,vo=s=>`${s.xMin} ${s.yMin} ${s.dx} ${s.dy}`,Gd=s=>!!s.name,Eh=b.isChrome&&!b.isMobile,wo=class extends E{constructor(){super(...arguments);this.tiles=new Map;this.strokes=new Map;this.options=le({});this.state=le({tool:"move",changeCount:0,penColor:"#242436",audioPlaying:0});this.mathContext=new ho;this.snapping=new lo(this);this.zIndex=new po(this);this.dropzoneManager=new mo(this);this.geoData=new jr;this.tools={move:new eo(this),pen:new ro(this),geo:new Zi(this),geoPending:new oo(this),eraser:new so(this),text:new io(this),pan:new no(this),cutPolygon:new ao(this)};this.origin=R;this.zoom=1;this.margins=[40,40,40,40];this.initial={};this.newTileShift=0;this.tileWeights=new Map;this.setup=!1;this.undoStack=[];this.redoStack=[];this.pendingChanges=new Set;this.pendingStrokes=new Set}ready(){this.$svg=this.$("svg.canvas"),this.$tiles=this.$svg.$$(".tiles"),this.$selection=this.$svg.$(".selection"),this.$strokes=this.$svg.$(".strokes"),this.$grid=this.$svg.$(".grid"),this.$html=this.$(".html-overlay"),this.$mask=this.$(".mask"),this.$geoShadows=this.$svg.$(".geo-shadows"),this.$geoPaths=this.$svg.$(".geo-paths"),this.$geoPoints=this.$svg.$(".geo-points"),this.$pendingPoint=m("circle",{class:"geo-point pending",hidden:!0},this.$geoPoints),this.setAttr("data-tool","move"),this.events=new ei(this.$svg,{down:i=>this.tools[this.state.tool].down(i),up:i=>this.tools[this.state.tool].up(i),start:i=>this.tools[this.state.tool].start(i),move:i=>this.tools[this.state.tool].move(i),end:i=>this.tools[this.state.tool].end(i),click:i=>this.tools[this.state.tool].click(i),hover:i=>this.tools[this.state.tool].hover(i),cursor:!1}),this.selection=new Kr(this),this.warningBanner=new vr(this),this.setViewport(R,1),this.options.watch(i=>{this.$grid.setAttr("fill",i.grid&&i.grid!=="none"?`url(#${i.grid})`:"none"),this.$grid.setRect(this.viewportBounds.rect)}),this.$svg.on("contextmenu",i=>{this.focussedTile||i.preventDefault()}),this.enablePinchPan(),this.enableAccessibility(),b.onThemeChange(()=>{this.setBackground(this.options.background);for(let i of this.tiles.values())i.props.updateTheme();for(let i of this.strokes.values())i.setColor(i.color);this.updateCursor()}),this.options.watch(i=>this.setBackground(i.background)),this.options.watch(i=>this.setClass("high-contrast",!!i.highContrast)),Eh&&this.options.watch(i=>this.setClass("handdrawn",!!i.handdrawn)),this.state.watch(()=>this.updateCursor());let t=this.$(".bg-icon");this.state.watch(i=>{t.toggle(i.authorMode),this.setClass("author-mode",!!i.authorMode),this.selection.clear()}),this.options.watch(()=>{let{canvas:i,canvasX:n=750,canvasY:r=750}=this.options,o=2e4;this.$mask.toggle(i!=="infinite"),i==="notebook"?this.$mask.setAttr("d",`M-1 -1h${n+2}V${o}H${o}V${-o}H${-o}V${o}H-1z`):i==="fixed"&&this.$mask.setAttr("d",`M-1 -1h${n+2}v${r+2}h${-n-2}zM${-o}${-o}V${o}H${o}V${-o}z`),this.canvasBounds=i==="infinite"?void 0:new lt(0,n,0,i==="notebook"?1e10:r)})}playSound(t){this.options.noAudio||Ad[t].play()}setBackground(t="#fff"){let i=$t.fromHex(t).hsl[2],n=t;this.flipTheme=i>=70,b.theme.isDark&&this.flipTheme&&(n=i>99?"#22212e":_e(t),i=100-i);let r=i<50?"#e2e1e6":"#181824";this.parent.css("--canvas-bg",n),this.parent.css("--canvas-fg",r),this.parent.css("--grid-opacity",.5-Math.abs(i/50-1)/4),this.parent.setClass("dark",i<50),this.$mask.css("fill",$t.mix("#000",n,.25).hex);let o=this.margins.some(a=>a>0);this.$mask.css("stroke",o?$t.mix(r,n,.4).hex:"transparent")}updateCursor(){let{tool:t,toolOptions:i,penColor:n}=this.state;if(t!=="pen"&&t!=="eraser")return this.css("cursor","");let r=t==="eraser"?10:i==="highlighter"?12:5,o=t==="eraser"?"#fff":_e(n||"#000",this.flipTheme);this.css("cursor",`url('data:image/svg+xml;utf8,') ${r+1} ${r+1}, auto`.replaceAll("#","%23"))}getTileAt(t,i){for(let n of this.tiles.values())if(!(i&&!i.includes(n.props.name))&&n.contains(t))return n}getInputAt(t,i){for(let n of this.tiles.values()){let r=n.getClosestPort(t,i);if(r)return r}}*getTilesOfType(t){for(let i of this.tiles.values())i.is(t)&&(yield i)}getBounds(t=0){let{canvas:i,canvasX:n,canvasY:r}=this.options;if(i==="infinite")return this.contentBounds.extend(t);let o=i==="notebook"?this.contentBounds.yMax+t:r;return new lt(0,n!=null?n:0,0,o!=null?o:0)}option(t){return this.state.authorMode?!1:!!this.options[t]}hasAction(t){let i=this.options.actionbar;return i?i.split(",").includes(t):!0}enablePinchPan(){this.on("wheel",n=>{if(!this.options.noPinchPan)if(n.preventDefault(),n.ctrlKey){let r=this.zoom*(1-n.deltaY/100);this.setViewport(this.origin,r,me(n,this.$svg))}else{let r=this.origin.shift(n.deltaX/this.zoom,n.deltaY/this.zoom);this.setViewport(r,this.zoom)}});let t=0,i=this.origin;this.on("gesturestart",n=>{this.options.noPinchPan||(n.preventDefault(),i=new p(n.pageX,n.pageY).subtract(this.origin),t=this.zoom,this.events.cancel())}),this.on("gesturechange",n=>{if(this.options.noPinchPan)return;n.preventDefault();let r=t*n.scale,o=new p(n.pageX,n.pageY).subtract(i);this.setViewport(o,r,me(n,this.$svg))}),this.on("gestureend",n=>{this.options.noPinchPan||n.preventDefault()})}enableImageDrop(t,i){let n=m("div",{class:"image-drop"},this);this.imageUploadCallback=t,this.on("dragenter dragover dragleave drop",o=>o.preventDefault()),this.on("dragenter dragover",()=>n.show()),this.on("dragleave drop",()=>n.hide());let r=(o,a)=>D(this,null,function*(){let l=Array.from((o==null?void 0:o.files)||[]).slice(0,10).map((c,u)=>this.newImage(c,a.shift(u*25),t));yield Promise.all(l),this.flushChanges(),this.trigger("paste")});this.on("drop",o=>r(o.dataTransfer,me(o,this.$svg))),i==null||i.on("change",()=>D(this,null,function*(){yield r(i._el,this.viewportBounds.center),i.value=""}))}bindKeyboardEvents(t=C,i){this.selection.bindKeyboardEvents(t),t.onKey("Backspace Clear Delete",()=>this.selection.delete()),t.onKey("z",n=>{n.preventDefault(),this[n.shiftKey?"redo":"undo"]()},{meta:!0}),t.onKey("y",n=>{n.preventDefault(),this.redo()},{meta:!0}),t.onKey("c C",()=>{if(this.option("noCopyPaste"))return;let n=this.selection.copy();this.paste(n,new p(25,25)),this.flushChanges()}),t.onKey("a",n=>{var o;if((o=k("x-modal"))!=null&&o.getOpenModal())return;n.preventDefault();let r=Array.from(this.tiles.values());this.state.authorMode||(r=r.filter(a=>a.canSelect)),this.selection.select(r)},{meta:!0}),C.on("cut copy",n=>{var o;if(i!=null&&i()||!this.selection.tiles.size||this.option("noCopyPaste")||b.formIsActive)return;let r=this.selection.copy();(o=window.navigator.clipboard)==null||o.writeText(JSON.stringify(r)),n.type==="cut"&&this.selection.delete()}),C.on("paste",n=>D(this,null,function*(){var a;if(i!=null&&i()||this.option("noCopyPaste")||b.formIsActive)return;let r=dp(n.clipboardData);if(r&&this.imageUploadCallback)return yield this.newImage(r,this.center.shift(-50),this.imageUploadCallback),this.flushChanges(),this.trigger("paste");let o=yield(a=window.navigator.clipboard)==null?void 0:a.readText();if(o){try{let h=JSON.parse(o);if(!Object.keys(h).length)return;this.paste(h)}catch(h){let l=H.create(this,{name:"text",html:o});l.setTransform(this.viewportBounds.center.subtract(l.center)),this.selection.add(l,!0),this.flushChanges(),this.trigger("paste"),this.selection.select([l])}this.flushChanges()}})),t.onKey("Space",n=>{this.options.noPinchPan||this.state.tool==="pan"||(n.preventDefault(),this.tools.pan.enable())}),t.onKey("Space",n=>{this.options.noPinchPan||this.state.tool!=="pan"||(n.preventDefault(),this.tools.pan.disable())},{up:!0})}enableAccessibility(){let t,i=!1,n=r=>{this.focussedTile||(t=r,this.$svg.setAttr("aria-description",r?r.altText:"Empty Canvas"),r&&this.selection.add(r,!0))};this.$svg.on("focusin",()=>{if(!i)return;let r=Array.from(this.tiles.values()).filter(o=>!o.props.status);n(this.events.shiftKey?O(r):r[0])}),this.$svg.on("focusout",()=>t=void 0),C.on("keydown",r=>{var a;if(i=!0,r.key==="Escape")return(a=this.focussedTile)==null?void 0:a.blur();if(r.key!=="Tab"||!t)return;let o=Array.from(this.tiles.values()).filter(h=>!h.group&&!h.props.status);n(o[o.indexOf(t)+(r.shiftKey?-1:1)]),t&&r.preventDefault()}),C.on("pointerdown",()=>i=!1),this.$svg.on("pointerdown",()=>{i=!1,this.focussedTile||this.$svg.focus()})}newImage(t,i,n){return D(this,null,function*(){let r=new FileReader;r.readAsDataURL(t),yield new Promise(a=>r.onloadend=a);let o=H.create(this,{name:"image",href:(r.result||"").toString(),x:i.x,y:i.y});return this.selection.add(o,!0),yield n==null?void 0:n(t,o),o})}setViewport(t,i=1,n){var v;if(i=B(i,1/go,go),n){let w=this.zoom/i;t=n.subtract(n.subtract(this.origin).scale(w))}let r=this.width/i,o=this.height/i,{canvas:a,canvasX:h=0,canvasY:l=0,grid:c}=this.options,[u,d,g,y]=this.margins;if(a==="infinite")this.origin=t.clamp(this.contentBounds.extend(o,0,0,r),50/i);else{let w=a==="notebook"?this.contentBounds.yMax+o-u/i:l,$=new lt(-y/i,h-r+d/i,-u/i,w-o+g/i,"center");this.origin=t.clamp($)}this.zoom=i,this.viewportBounds=new lt(this.origin.x,this.origin.x+r,this.origin.y,this.origin.y+o),this.$svg.setAttr("viewBox",this.attr("viewBox")||vo(this.viewportBounds)),this.$html.setTransform(this.origin.inverse.scale(this.zoom),0,this.zoom);let f=this.viewportBounds.rect;c!=="none"&&this.$grid.setRect(f),this.geoData.redrawLines(((v=this.canvasBounds)==null?void 0:v.rect)||f),this.newTileShift=0,this.trigger("viewport")}resetViewport(){if(this.options.canvas==="infinite"&&!this.tiles.size&&!this.strokes.size)return this.setViewport(R,1);this.panToBounds()}panToBounds(t,i=0){let{width:n,height:r,margins:o,origin:a,zoom:h,options:l}=this,[c,u,d,g]=o,y=!t&&l.canvas==="notebook",f=!t&&l.canvas==="infinite",v=t||this.getBounds(),w=(n-g-u)/v.dx,$=y?1:(r-c-d)/v.dy,I=B(Math.min(w,$),1/go,f?1:go),A=new p(n+g-u,r+c-d),M=y?new p(0,-c):v.center.subtract(A.scale(1/2/I)),P=new p(n/2,r/2);pt(j=>{let ne=yt("cubic",j),As=Math.exp(tt(Math.log(h),Math.log(I),ne)),en=p.interpolate(a,M,ne).add(P.scale(tt(1/h,1/I,ne)-1/As));this.setViewport(en,As)},i)}setZoom(t){let i=this.viewportBounds.center;this.setViewport(this.origin,this.zoom*t,i)}bindSource(t,i){let n=t.attr("tile");t.setAttr("tabindex",0),H.thumbnail(this,n,t);let r,o=i==null?void 0:i.$(".tiles");this.events.listen(t,{down:()=>this.trigger("add-tile-start"),start:({posn:a})=>{r=H.create(this,Object.assign({name:n},we(t.attr("props"),{}))),r.setTransform(a.subtract(r.center)),this.selection.add(r,!0),this.selection.moveStart(!0),i&&i.setAttr("viewBox",vo(this.viewportBounds)),(o||r.$container).append(r.$el),this.trigger("add-tile",{tile:r})},move:a=>this.selection.move(a,!0),end:a=>{r.$container.append(r.$el),this.selection.moveEnd(a,!0)},click:()=>{r=H.create(this,Object.assign({name:n},we(t.attr("props"),{}))),r.setTransform(this.center.subtract(r.center).shift(this.newTileShift*25)),this.selection.add(r,!0),r.moveEnd(),this.trigger("add-tile",{tile:r}),this.flushChanges(),this.newTileShift+=1}})}get center(){let[t,i,n,r]=this.margins;return this.viewportBounds.center.shift((r-i)/this.zoom/2,(t-n)/this.zoom/2)}setActiveTool(t,i){this.tools[this.state.tool].cancel(),this.warningBanner.hide(),this.selection.clear(),this.state.assign({tool:t,toolOptions:i}),i&&(this.tools[this.state.tool].options=i),this.setAttr("data-tool",t)}clear(t=!0){this.selection.clear();for(let i of this.tiles.values())i.delete();for(let i of this.strokes.values())i.delete();t&&this.setViewport(R,1),this.flushChanges()}thumbnail(t,i,n="jpg"){return D(this,null,function*(){return this.state.authorMode&&(this.state.authorMode=!1),yield this.$svg.image(n,t,i,vo(this.getBounds(50)))})}downloadImage(t="png",i){var o;this.selection.clear();let n=i||((o=this.state.title)==null?void 0:o.replace(/\s+/g,"-").replace(/[^\w-]/g,"").toLowerCase())||"polypad",r=this.getBounds(50);this.$svg.downloadImage(`${n}.${t}`,r.dx,r.dy,vo(r))}paste(t,i){this.selection.clear();let n=new Map;for(let h of Object.keys(t))n.set(h,We(10));let r=new Map,o=Object.entries(t).sort((h,l)=>(h[1].zIndex||0)-(l[1].zIndex||0)).map(([h,l])=>{var c,u,d;return l.name==="geo"&&Object.assign(l,Yt.copy(r,l,this.geoData)),l.name==="group"&&(l.children=(c=l.children)==null?void 0:c.split(",").map(g=>n.get(g)).join(",")),l.status=void 0,l.zIndex=void 0,l.cables=(u=l.cables)==null?void 0:u.map(g=>ft(ut({},g),{toTileId:n.get(g.toTileId)})),(l.name==="table"||l.name==="action-card")&&(l.links=(d=l.links)==null?void 0:d.split(",").map(g=>n.get(g)||g).join(",")),H.create(this,l,n.get(h))}).filter(Boolean);for(let h of o)h.delayedSetup();let a=It(...o.map(h=>h.transformed)).center;i===void 0&&(i=this.center.subtract(a).shift(this.newTileShift*25));for(let h of o)h.is("geo")?h.shift(i):h.setTransform(h.posn.add(i));this.newTileShift+=1,this.dropzoneManager.onMoveEnd(),this.flushChanges(),this.trigger("paste"),this.selection.select(o)}check(t){let i=!1;return new Promise(n=>{this.on("change",()=>{!i&&t(Array.from(this.tiles.values()))&&(i=!0,n())})})}flushChanges(){if(this.setup)return;this.trigger("change",{action:"change"});let t=new Map,i=this.options.getChanges();Object.keys(i[0]).length&&t.set("options",i),this.dropzoneManager.update(this.pendingChanges);for(let n of rn(this.pendingChanges,this.pendingStrokes)){let r=n.flushChanges();r&&t.set(n.id,r)}this.pendingChanges.clear(),this.pendingStrokes.clear(),t.size&&(this.contentBounds=wr(this.tiles,this.strokes),!this.options.noUndoRedo&&(this.undoStack.push(t),this.undoStack.length>50&&this.undoStack.shift(),this.redoStack=[],this.state.canUndo=!0,this.state.canRedo=!1,this.state.changeCount+=1))}undo(){this.undoStack.length&&(this.applyChange(O(this.undoStack),!0),this.redoStack.push(this.undoStack.pop()),this.state.canUndo=!!this.undoStack.length,this.state.canRedo=!0,this.state.changeCount-=1,this.selection.update(),this.trigger("change",{action:"undo"}))}redo(){this.redoStack.length&&(this.applyChange(O(this.redoStack)),this.undoStack.push(this.redoStack.pop()),this.state.canUndo=!0,this.state.canRedo=!!this.redoStack.length,this.state.changeCount+=1,this.selection.update(),this.trigger("change",{action:"redo"}))}applyChange(t,i=!1){var r,o;let n=new Set;for(let[a,[h,l]]of t.entries()){if(i&&([h,l]=[l,h]),a==="options")this.options.assign(l),("canvas"in l||"canvasX"in l||"canvasY"in l)&&this.resetViewport(),"tileWeights"in l&&Th(this,l.tileWeights||"");else if(h)if(l){let c=this.tiles.get(a);c==null||c.applyChange(l),c&&n.add(c)}else if(Gd(h)){let c=this.tiles.get(a);c==null||c.delete(),c&&n.add(c)}else(r=this.strokes.get(a))==null||r.delete();else if(Gd(l)){let c=H.create(this,l,a);c.flushChanges(),n.add(c)}else He.create(this,l,a);this.contentBounds=wr(this.tiles,this.strokes)}for(let a of t.keys())(o=this.tiles.get(a))==null||o.delayedSetup();this.dropzoneManager.update(n),this.pendingChanges.clear(),this.pendingStrokes.clear(),this.options.getChanges()}serialize(t=5e3,i=2e3,n=16e3){var r;return{title:(r=this.state.title)==null?void 0:r.slice(0,30),version:2,tiles:Qa(this.tiles.values(),o=>o.props.copy(),t),strokes:Qa(this.strokes.values(),o=>o.serialize(n),i),options:this.options.copy()}}load(t){this.setup=!0,this.clear(!1),this.geoData.reset(),this.zIndex.clear(),this.dropzoneManager.clear(),this.initial=t,this.state.assign({title:t.title,canUndo:!1,canRedo:!1,changeCount:0,audioPlaying:0,authorMode:!1}),this.undoStack=this.redoStack=[],t.options||(t.options=Sh(!0)),t.options.grid||(t.options.grid="none"),t.options.canvas||(t.options.canvas="infinite"),t.options.algebraXSize||(t.options.algebraXSize=Yp),t.options.algebraYSize||(t.options.algebraYSize=Zp),t.options.pinActions||(t.options.pinActions="custom"),this.options.assign(t.options,!0),this.options.forceUpdate(),Th(this,t.options.tileWeights||"");for(let[i,n]of Object.entries(t.tiles||{}))H.create(this,n,i).flushChanges();for(let[i,n]of Object.entries(t.strokes||{}))He.create(this,n,i);for(let i of this.tiles.values())i.delayedSetup();this.snapping.updateIntersections(),this.contentBounds=wr(this.tiles,this.strokes),this.dropzoneManager.update(),this.resetViewport(),this.setActiveTool("move"),this.pendingChanges.clear(),this.pendingStrokes.clear(),this.options.getChanges(),this.setup=!1}};wo=T([S("x-polypad",{template:Ed})],wo);var zd=`
\${numberFormat(points)}
Points
\${min(time)}m \${time % 60}s
Time

Highscore
\${highscore[0].name.slice(0, 4)}\${numberFormat(highscore[0].score)}
\${highscore[1].name.slice(0, 4)}\${numberFormat(highscore[1].score)}
\${highscore[2].name.slice(0, 4)}\${numberFormat(highscore[2].score)}
\${highscore[3].name.slice(0, 4)}\${numberFormat(highscore[3].score)}
View more\u2026
Next blocks:
\${next[0]}
\${next[1]}
\${next[2]}
\${next[3]}
\${next[4]}

Discharge:
\${discardCounter}needed
Game over!
Paused
Highscore
\${highscore[0].name}\${numberFormat(highscore[0].score)}
\${highscore[1].name}\${numberFormat(highscore[1].score)}
\${highscore[2].name}\${numberFormat(highscore[2].score)}
\${highscore[3].name}\${numberFormat(highscore[3].score)}
\${highscore[4].name}\${numberFormat(highscore[4].score)}
\${highscore[5].name}\${numberFormat(highscore[5].score)}
\${highscore[6].name}\${numberFormat(highscore[6].score)}
\${highscore[7].name}\${numberFormat(highscore[7].score)}
\${highscore[8].name}\${numberFormat(highscore[8].score)}
\${highscore[9].name}\${numberFormat(highscore[9].score)}
\${highscore[10].name}\${numberFormat(highscore[10].score)}
Block size:
\${active[0] || '?' } = \${active[2]|| '?'} \xD7 \${active[1]|| '?'}
`;var Y0=1e3,Z=B(+Nl(location.search).size||16,8,24),Z0=5,gi=Math.ceil(Z/2),bo=Z+gi,xo=[];for(let s=2;s<=Z*1.5;s+=1){let e=_o(s);e&&s>.75*Z||s>Z&&Zh(s)[0]>Z/2||(e&&s>Z/2||s>1.25*Z?xo.push(s):xo.push(s,s))}var Ji=()=>xo[_t.integer(xo.length)],Q0=oe(1,Z),J0=Z*10,Bd=z(s=>J0*2**s,Z),Mh=class{constructor(e,t,i){this.$el=m("rect",{width:20,height:20},i),this.setPosition(e,t)}setPosition(e,t){this.x=e,this.y=t,this.$el.setTransform({x:10+20*this.x,y:10+20*this.y})}go(e,t,i){this.setPosition(this.x+i-t,this.y+e)}canSet(e,t,i){return!i.find(n=>n.x===e&&n.y===t)}canGo(e,t,i,n){let r=this.x+i-t,o=this.y+e;return o>=bo||r<0||r>=Z?!1:this.canSet(r,o,n)}canGoDown(e){return this.canGo(1,0,0,e)}goDown(e=1){if(e!==0)return this.go(e,0,0)}},yo=class extends E{constructor(){super(...arguments);this.interval=void 0;this.tiles=[];this.activeTiles=[];this.activeSize=[0,0,0];this.activeFactors=[];this.isDown=!1;this.keyLock=!1;this.requestQueue=Promise.resolve("");this.highscore=!0}ready(){this.$svg=this.$(".factris-board"),this.$tiles=this.$svg.$(".tiles"),this.$shadow=this.$svg.$(".shadow"),this.attr("highscore")==="no"&&(this.highscore=!1);let t=this.$svg.$(".scores");this.$scores=Bd.map((i,n)=>{let r=m("g",{},t);return m("text",{text:"+"+i,class:`s${n+1}`},r),r}),this.bindModel(le({time:0,points:0,playing:!1,lost:!1,initial:!0,key:void 0,discardCounter:0,next:[],active:[],highscore:[],showHighscore:!1,min:i=>Math.floor(i/60),numberFormat:Ot,app:this}));for(let i of this.$$("button, .play"))i.on("contextmenu",n=>n.preventDefault());C.onKey("AllArrows",(i,n)=>{this.model.playing&&(i.preventDefault(),this.isDown=!0,this.model.key=n,this.keyPress(n))}),C.onKey("AllArrows",()=>{this.model.playing&&(this.isDown=this.keyLock=!1,this.model.key=void 0)},{up:!0}),this.setupSVG(),this.updateHighscore()}setupSVG(){this.$svg.setAttr("viewBox",`0 0 ${(Z+1)*20} ${(bo+1)*20}`);let t=this.$svg.$(".grid"),i=t.$(".faint-grid");for(let n=0;n<=Z;n+=1){let r=10+n*20,o=10+(gi+n)*20,a=!(n%4)||n===Z?t:i,h=!(n%2)||n===Z?"thick":"";m("line",{x1:10,y1:o,x2:10+Z*20,y2:o,class:h},a),m("line",{x1:r,y1:10+gi*20,x2:r,y2:bo*20+10,class:h},a)}}drawShadow(){this.activeTiles.length&&(this.$shadow.setAttr("x",10+20*this.activeSize[0]),this.$shadow.setAttr("y",10+20*this.activeSize[1]),this.$shadow.setAttr("width",20*this.activeSize[2]),this.$shadow.setAttr("height",20*(bo-this.activeSize[1])))}newRect(){let t=this.getNewTileSize();this.activeFactors=Q0.filter(r=>t%r===0);let i=this.activeFactors.pop(),n=Math.floor((Z-i)/2);this.activeTiles=z(r=>new Mh(n+r%i,Math.floor(r/i),this.$tiles),t),this.model.active=[t,i,t/i],this.activeSize=[n,t/i,i],this.drawShadow(),this.isDown&&(this.keyLock=!0)}reset(){this.pause(),this.model.time=0,this.model.points=0,this.model.discardCounter=0,this.model.showHighscore=!1,this.model.lost=!1,this.model.next=[Ji(),Ji(),Ji(),Ji()];for(let t of this.tiles)t.$el.remove();for(let t of this.activeTiles)t.$el.remove();this.tiles=[],this.newRect(),this.play(),this.requestQueue=Promise.resolve("")}toggle(){this.model.lost?this.reset():this.model.playing?this.pause():this.play()}pause(){this.model.playing=!1,clearInterval(this.interval)}play(){var t,i;if(this.model.showHighscore=!1,(t=window.ga)==null||t.call(window,"send","event","Factris","play"),(i=window.gtag)==null||i.call(window,"event","factris",{action:"play"}),this.model.initial||this.model.lost)return this.model.initial=!1,this.reset();this.model.playing=!0,this.interval=window.setInterval(()=>this.tick(),Y0)}getNewTileSize(){let t=Z*Z-this.tiles.length;if(this.model.next[0]>t)return t>Z?t-Z:Z;this.model.discardCounter>0&&(this.model.discardCounter-=1);let i=this.model.next[0];return this.model.next=[...this.model.next.slice(1),Ji()],i}tick(){if(this.model.time+=1,this.activeTiles.every(o=>o.canGoDown(this.tiles))){for(let o of this.activeTiles)o.goDown();this.activeSize[1]+=1,this.drawShadow();return}this.tiles.push(...this.activeTiles);for(let o of this.activeTiles)o.$el.addClass("fixed");if(this.tiles.some(o=>o.y=6&&Mi(10,150*i.length/Z),this.removeRows(i);let n=this.model.points,r=(n+Z)%13+(n-Z)%87;this.requestQueue=this.requestQueue.then(o=>Ne("/factris-verify",{token:o,size:Z,score:n,check:r})),this.trigger("score",{points:n})}getFullRows(){return z(t=>this.tiles.filter(i=>i.y===t+gi),Z).filter(t=>t.length===Z)}removeRows(t){let i=ye(t);this.tiles=this.tiles.filter(o=>!i.includes(o)),this.$tiles.addClass("animated"),b.redraw();for(let o of i)o.$el.addClass("removing");let n=t.map(o=>o[0].y);for(let o of this.tiles)o.goDown(n.filter(a=>a>o.y).length);let r=400/t.length;for(let[o,a]of n.reverse().entries())this.$scores[o].setTransform({x:10+gi*20,y:27+a*20}),Zt(()=>this.$scores[o].addClass("visible"),o*r);return setTimeout(()=>{for(let o of this.$scores)o.removeClass("visible")},600),setTimeout(()=>{for(let o of i)o.$el.remove();this.$tiles.removeClass("animated"),this.newRect()},1e3),!1}gameOver(){this.model.lost=!0;for(let t of this.activeTiles)t.$el.addClass("error");this.pause(),this.requestQueue.then(t=>{t&&this.trigger("game-over",{token:t,points:this.model.points})})}discharge(){if(this.model.playing){for(let t of this.activeTiles)t.$el.remove();this.newRect(),this.model.discardCounter=Z0}}keyPress(t,i=!0){if(this.model.playing&&!this.keyLock){if(t==="ArrowUp"){if(!this.activeFactors.length)return;let n=this.activeFactors.pop(),r=this.activeSize[0]+Math.floor((this.activeSize[2]-n)/2),o=this.activeSize[1];if(this.activeTiles.some((l,c)=>!l.canSet(r+c%n,o-1-Math.floor(c/n),this.tiles)))return;for(let[l,c]of this.activeTiles.entries())c.setPosition(r+l%n,o-1-Math.floor(l/n));let h=this.model.active[0];this.model.active=[h,n,h/n],this.activeSize=[r,o,n]}else{let n=t==="ArrowDown"?1:0,r=t==="ArrowLeft"?1:0,o=t==="ArrowRight"?1:0;if(this.activeTiles.every(a=>a.canGo(n,r,o,this.tiles))){for(let a of this.activeTiles)a.go(n,r,o);this.activeSize[0]+=o-r,this.activeSize[1]+=n}i&&t==="ArrowDown"&&setTimeout(()=>this.keyPress("ArrowDown",!1),100)}this.drawShadow()}}showHighscore(){this.highscore&&(this.pause(),this.model.showHighscore=!0)}updateHighscore(){return D(this,null,function*(){if(!this.highscore)return;let t=yield fetch(`/factris-highscore?size=${Z}`);this.model.highscore=yield t.json()})}};yo=T([S("x-factris",{template:zd})],yo);var $o=class extends E{ready(){let e=Array.from(this._el.children);this.removeChildren();let t=m("svg",{class:"equation"},this),i=m("g",{transform:"translate(2 0)"},t),n=m("div",{class:"overlay"},this),r=parseFloat(this.css("font-size")),o=this.parents(".text-center").length||this.hasClass("display"),a=new Be(i,n,0,"",r,!!o);a.setValue(this.attr("expr")||e),this.css({width:a.root.width+4+"px",height:a.root.height+"px","vertical-align":`-${a.root.height-a.root.baseline}px`})}};$o=T([S("x-math")],$o);window.$=k;window.$$=Te;window.Browser=b;var Po=k("x-modal#privacy");Po&&Po.$("form").on("submit",s=>{s.preventDefault();let e=Po.$('input[name="newsletter"]');Ne("/settings/privacy",{policies:"on",newsletter:e.checked?"on":"off"}),Po.close()});var _d="";function Ah(){return fetch("/joke").then(s=>s.text()).then(s=>_d=s),_d}var Ch=k(".error-box");Ch&&Ch.on("click",()=>Ch.html=Ah());Ah();window.tellMeAJoke=function(){return Ah().replace(/

/g,"").replace(/<\/p>/g,` +"use strict";(()=>{var Ih=Object.defineProperty,Hd=Object.defineProperties,jd=Object.getOwnPropertyDescriptor,Ud=Object.getOwnPropertyDescriptors;var kh=Object.getOwnPropertySymbols;var Wd=Object.prototype.hasOwnProperty,Kd=Object.prototype.propertyIsEnumerable;var Eo=(s,t)=>(t=Symbol[s])?t:Symbol.for("Symbol."+s);var Vh=(s,t,e)=>t in s?Ih(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ut=(s,t)=>{for(var e in t||(t={}))Wd.call(t,e)&&Vh(s,e,t[e]);if(kh)for(var e of kh(t))Kd.call(t,e)&&Vh(s,e,t[e]);return s},ft=(s,t)=>Hd(s,Ud(t));var T=(s,t,e,i)=>{for(var n=i>1?void 0:i?jd(t,e):t,r=s.length-1,o;r>=0;r--)(o=s[r])&&(n=(i?o(t,e,n):o(n))||n);return i&&n&&Ih(t,e,n),n};var D=(s,t,e)=>new Promise((i,n)=>{var r=h=>{try{a(e.next(h))}catch(l){n(l)}},o=h=>{try{a(e.throw(h))}catch(l){n(l)}},a=h=>h.done?i(h.value):Promise.resolve(h.value).then(r,o);a((e=e.apply(s,t)).next())}),Xd=function(s,t){this[0]=s,this[1]=t};var ks=s=>{var t=s[Eo("asyncIterator")],e=!1,i,n={};return t==null?(t=s[Eo("iterator")](),i=r=>n[r]=o=>t[r](o)):(t=t.call(s),i=r=>n[r]=o=>{if(e){if(e=!1,r==="throw")throw o;return o}return e=!0,{done:!1,value:new Xd(new Promise(a=>{var h=t[r](o);if(!(h instanceof Object))throw TypeError("Object expected");a(h)}),1)}}),n[Eo("iterator")]=()=>n,i("next"),"throw"in t?i("throw"):n.throw=r=>{throw r},"return"in t&&i("return"),n};var Mo=(s,t)=>(t=Symbol[s])?t:Symbol.for("Symbol."+s),Yd=function(s,t){this[0]=s,this[1]=t},Zd=s=>{var t=s[Mo("asyncIterator")],e=!1,i,n={};return t==null?(t=s[Mo("iterator")](),i=r=>n[r]=o=>t[r](o)):(t=t.call(s),i=r=>n[r]=o=>{if(e){if(e=!1,r==="throw")throw o;return o}return e=!0,{done:!1,value:new Yd(new Promise(a=>{var h=t[r](o);if(!(h instanceof Object))throw TypeError("Object expected");a(h)}),1)}}),n[Mo("iterator")]=()=>n,i("next"),"throw"in t?i("throw"):n.throw=r=>{throw r},"return"in t&&i("return"),n};function We(s=10){return Math.random().toString(36).substr(2,s)}function _(s,...t){return t.includes(s)}var Qd=(s,t)=>s.concat(t);function Ao(s,t,e=Qd){for(let i of Object.keys(t))i in s&&Array.isArray(s[i])&&Array.isArray(t[i])?s[i]=e(s[i],t[i]):i in s&&s[i]instanceof Object&&t[i]instanceof Object?Ao(s[i],t[i]):s[i]=t[i]}function Zt(s,t=0){return t?+setTimeout(s,t):(s(),0)}function wi(s){return new Promise(t=>setTimeout(t,s))}function Ke(){let s=()=>{},t=()=>{},e=new Promise((i,n)=>{s=i,t=n});return e.catch(i=>i),{promise:e,resolve:s,reject:t}}var Lh=class extends Error{constructor(s){super("[Cache Error]"),this.data=s}};function Oe(s){let t=new Map;return function(...e){let i=e.join("--");if(!t.has(i))try{t.set(i,s(...e))}catch(r){t.set(i,new Lh(r))}let n=t.get(i);if(n instanceof Lh)throw n.data;return n}}function ve(s,t=0,e=!1){let i=!1,n=!1;return(...r)=>{i?n=!0:(e?n=!0:s(...r),i=!0,setTimeout(()=>{n&&s(...r),i=n=!1},t))}}function Jd(s){return function(t,e){if(!t||Array.isArray(this)||s.includes(t))return e}}function we(s,t,e){if(!s)return t;try{return JSON.parse(s,e?Jd(e):void 0)||t}catch(i){return t}}function re(s,t){return new Array(t).fill(s)}function ko(s,t,e){let i=[];for(let n=0;n=0)for(let n=0;ns;n-=e)i.push(n);else if(s<=t)for(let n=s;n<=t;n+=e)i.push(n);else for(let n=s;n>=t;n-=e)i.push(n);return i}function O(s,t=0){return s[s.length-1-t]}function N(s){return s.reduce((t,e)=>t+e,0)}function yi(s,t,e=!1){return s.slice(0).sort((i,n)=>{let r=t(i),o=t(n);return ro?e?-1:1:0})}function os(s){let t=0;return()=>s[t++%s.length]}function Wt(s){return s.filter((t,e)=>s.indexOf(t)===e)}function ye(s){return s.reduce((t,e)=>t.concat(Array.isArray(e)?ye(e):e),[])}function as(s){let t=0;return s.map(e=>t+=e)}function Vo(s,t){let e=[];for(let i=0;it.concat(e),[])}var Gh=class{constructor(s){let t=s.length,e=s.map(i=>({val:i}));for(let[i,n]of e.entries())n.next=e[(i+1)%t],n.prev=e[(i-1+t)%t];this.root=e[0]}*traverse(){let s=this.root;for(;s;)if(yield s,s=s.next,s===this.root)return}get array(){return Array.from(this.traverse())}delete(s){if(s===this.root){if(s.next===s)return this.root=void 0;this.root=s.next}s.prev.next=s.next,s.next.prev=s.prev}},Io=(s=>(s[s.first=0]="first",s[s.firstGreater=1]="firstGreater",s))(Io||{});function Lo(s,t,e){let i=0,n=s.length-1,r=-1;for(;i<=n;){let o=Math.floor((i+n)/2),a=s[o].val;at?(e===1&&(r=o),n=o-1):e===0?(r=o,n=o-1):e===1&&(i=o+1)}return r}function Oo(s,t,e){let i=Lo(s,e,0);if(i<0)return-1;for(;s[i].val===e;){if(s[i].item===t)return i;i+=1}return-1}function K(s,t=/\s+/){return s?s.trim().split(t):[]}function rn(s){return s.toLowerCase().replace(/^-/,"").replace(/-(.)/g,(t,e)=>e.toUpperCase())}function tu(s,t,e=!1){let i=ko(0,s.length+1,t.length+1);for(let n=0;n<=s.length;n++)i[n][0]=n;for(let n=0;n<=t.length;n++)i[0][n]=n;for(let n=1;n<=s.length;n++)for(let r=1;r<=t.length;r++)i[n][r]=Math.min(i[n-1][r-1]+(s.charAt(n-1)===t.charAt(r-1)?0:1),i[n-1][r]+1,i[n][r-1]+1);return e?Math.min(...i[s.length]):i[s.length][t.length]}function zh(s,t){let e=s.length/2,i=t.map(r=>({w:r,d:tu(s,r)})).filter(({d:r})=>rr.d)[0];return n?n.w:void 0}var Re=class{constructor(){this.events=new Map}on(s,t){for(let e of K(s))this.events.has(e)||this.events.set(e,[]),this.events.get(e).push(t)}one(s,t){let e=i=>{this.off(s,e),t(i)};this.on(s,e)}off(s,t){for(let e of K(s))this.events.has(e)&&this.events.set(e,this.events.get(e).filter(i=>i!==t))}trigger(s,t){for(let e of K(s))if(this.events.has(e))for(let i of this.events.get(e))i(t)}},eu=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,su=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i,iu=/rgba?\(([0-9.]+), ?([0-9.]+), ?([0-9.]+)(, ?([0-9.]+))?\)/,nu=["#22ab24","#009ea6","#0f82f2","#6d3bbf","#cd0e66","#eb4726","#fd8c00"];function Oh(s){return s.length===1?`0${s}`:s}function Rh(s,t){if(t<=0)return $t.from(s[0]);if(t>=1)return $t.from(O(s));let e=Math.floor(t*(s.length-1)),i=t*(s.length-1)-e;return $t.mix(s[e+1],s[e],i)}function Co(s,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?s+(t-s)*6*e:e<1/2?t:e<2/3?s+(t-s)*(2/3-e)*6:s}var $t=class Ct{constructor(t,e,i,n=1){this.r=t,this.g=e,this.b=i,this.a=n}get hex(){let t=[this.r,this.g,this.b].map(i=>Oh(Math.round(i).toString(16))),e=this.a>=1?"":Oh(Math.round(this.a*255).toString(16));return`#${t.join("")}${e}`}get rgb(){return`rgba(${[this.r,this.g,this.b].map(e=>Math.round(e)).join(",")},${this.a})`}get brightness(){return(this.r*299+this.g*587+this.g*114)/1e3}get hsl(){let t=this.r/255,e=this.g/255,i=this.b/255,n=Math.max(t,e,i),r=Math.min(t,e,i),o=(r+n)/2,a=n-r;if(n===r)return[0,0,Math.round(o*100)];let h=t===n?(e-i)/a:e===n?2+(i-t)/a:4+(t-e)/a;h=Math.min(h*60,360),h<0&&(h+=360);let l=o<=.5?a/(n+r):a/(2-n-r);return[Math.round(h),Math.round(l*100),Math.round(o*100)]}get chroma(){return Math.max(this.r,this.g,this.b)-Math.min(this.r,this.g,this.b)}toString(){return this.rgb}copy(){return new Ct(this.r,this.g,this.b,this.a)}static from(t){return typeof t!="string"?t:t.startsWith("#")?Ct.fromHex(t):Ct.fromRgb(t)}static fromRgb(t){let e=t.match(iu);if(!e)return new Ct(0,0,0);let i=e[4]?+e[5]||0:1;return new Ct(+e[1],+e[2],+e[3],i)}static fromHex(t){t=t.replace(eu,(i,n,r,o)=>n+n+r+r+o+o);let e=su.exec(t);return e?new Ct(parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16),e[4]?parseInt(e[4],16)/255:1):new Ct(0,0,0)}static fromHsl(t,e,i){if(t/=360,e/=100,i/=100,e===0){let l=Math.round(i*255);return new Ct(l,l,l)}let n=i<.5?i*(1+e):i+e-i*e,r=2*i-n,o=Co(r,n,t+1/3),a=Co(r,n,t),h=Co(r,n,t-1/3);return new Ct(Math.round(o*255),Math.round(a*255),Math.round(h*255))}static rainbow(t){return z(e=>Rh(nu,e/(t-1)),t)}static gradient(t,e){return z(i=>Rh(t,i/(e-1)),e)}static shades(t,e,i=.5){let n=Ct.mix("#fff",t,i),r=Ct.mix("#000",t,i);return Ct.gradient([n,t,r],e)}static mix(t,e,i=.5){return t=Ct.from(t),e=Ct.from(e),new Ct(i*t.r+(1-i)*e.r,i*t.g+(1-i)*e.g,i*t.b+(1-i)*e.b,i*t.a+(1-i)*e.a)}static mixMany(t,e){e||(e=t.map(()=>1));let i=N(e),n=t.map(v=>v.hsl),r=n.map(v=>v[0]),o=r.map(v=>v<180?v+360:v),a=e.map((v,y)=>v*Math.sqrt(t[y].chroma)),h=N(a),l=N(r.map((v,y)=>v*a[y]))/h,c=N(o.map((v,y)=>v*a[y]))/h,u=N(r.map((v,y)=>Math.abs(v-l)*a[y])),d=N(o.map((v,y)=>Math.abs(v-c)*a[y])),g=u<=d?l:c%360,w=N(n.map((v,y)=>e[y]*v[1]))/i,f=N(n.map((v,y)=>e[y]*v[2]))/i;return Ct.fromHsl(g,w,f)}};function Vs(s){return s[Symbol.iterator]().next().value}function*on(...s){for(let t of s)yield*ks(Zd(t))}function At(s,t){for(let e of s)if(t(e))return!0;return!1}function*Bh(s,t){let e=0;for(let i of s)t(i,e)&&(yield i),e+=1}function*_h(s,t){for(let e of s)for(let i of t(e))yield i}function*bi(s,t){for(let e of s)for(let i of t)yield[e,i]}function*Ro(s){let t=s.length;for(let e=0;e{for(var e in t)ru(s,e,{get:t[e],enumerable:!0})},cn=1e-6;function x(s,t,e=cn){return isNaN(s)||isNaN(t)?!1:Math.abs(s-t)e&&([t,e]=[e,t]),s>t+i&&s0?1:-1}var Fh=/(\d+)(\d{3})/,au=["","k","m","b","t","q"];function hu(s){let[t,e]=s.split(".");for(;Fh.test(t);)t=t.replace(Fh,"$1,$2");return t+(e?`.${e}`:"")}function lu(s,t=6){if(!t)return`${s}`;let e=`${Math.abs(Math.floor(s))}`.length,i=e+(s<0?1:0);if(i<=t)return`${Dt(s,t-i)}`;let n=Math.floor(Math.log10(Math.abs(s))/3),r=au[n],o=t-(e%3||3)-(r?1:0)-(s<0?1:0);return Dt(s/Math.pow(10,3*n),o)+r}function Rt(s,t=0,e=!0){let i=lu(s,t).replace("-","\u2013");return e?hu(i):i}var cu=/^-?0,[0-9]+$/,pu=/^-?([0-9]+(,[0-9]{3})*)?\.?[0-9]*$/,du=/^-?[0-9]+(\.[0-9]{3})*,?[0-9]*$/;function Wh(s){return s=s.replace(/^–/,"-").trim(),!s||s.match(/[^0-9.,-]/)?NaN:cu.test(s)?parseFloat(s.replace(/,/,".")):pu.test(s)?parseFloat(s.replace(/,/g,"")):du.test(s)?parseFloat(s.replace(/\./g,"").replace(/,/,".")):NaN}var Do=["","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],qh=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],uu=[""," thousand"," million"," billion"," trillion"," quadrillion"," quintillion"," sextillion"];function fu(s){let[t,e,i]=s.split(""),n=t==="0"?"":` ${Do[+t]} hundred`;return e+i==="00"?n:+e<2?`${n} ${Do[+(e+i)]}`:i==="0"?`${n} ${qh[+e]}`:`${n} ${qh[+e]}-${Do[+i]}`}function zo(s){if(s===0)return"zero";let t=Math.round(Math.abs(s)).toString(),e=Math.ceil(t.length/3),i=t.padStart(3*e,"0"),n="";for(let r=0;rn.length===t):i}function Xh(s){if(s.length===1)return[[],s];let t=s.pop(),e=Xh(s),i=[];for(let n of e)i.push(n,[...n,t]);return i}var an=(s,t)=>{let e=s<0?"\u2013":"";return Math.abs(s)===1&&t?e+t:e+Math.abs(s)+(t||"")},Yh=class mt{constructor(t=0,e=0){this.re=t,this.im=e}get modulus(){return Math.sqrt(this.re*this.re+this.im*this.im)}get argument(){return Math.atan2(this.im,this.re)}get conjugate(){return new mt(this.re,-this.im)}root(t,e=0){let i=Math.pow(this.modulus,1/t),n=(this.argument+e*2*Math.PI)/t;return new mt(i*Math.cos(n),i*Math.sin(n))}toString(t=2){let e=Dt(this.re,t),i=Dt(this.im,t);return i===0?an(e):e===0?an(i,"i"):[an(e),i<0?"\u2013":"+",an(Math.abs(i),"i")].join(" ")}add(t){return mt.sum(this,t)}subtract(t){return mt.difference(this,t)}multiply(t){return mt.product(this,t)}divide(t){return mt.quotient(this,t)}static sum(t,e){return typeof t=="number"&&(t=new mt(t,0)),typeof e=="number"&&(e=new mt(e,0)),new mt(t.re+e.re,t.im+e.im)}static difference(t,e){return typeof t=="number"&&(t=new mt(t,0)),typeof e=="number"&&(e=new mt(e,0)),new mt(t.re-e.re,t.im-e.im)}static product(t,e){typeof t=="number"&&(t=new mt(t,0)),typeof e=="number"&&(e=new mt(e,0));let i=t.re*e.re-t.im*e.im,n=t.im*e.re+t.re*e.im;return new mt(i,n)}static quotient(t,e){if(typeof t=="number"&&(t=new mt(t,0)),typeof e=="number"&&(e=new mt(e,0)),Math.abs(e.re)1)return xe(t,xe(...e));let i=Math.abs(t),n=Math.abs(e[0]);for(;n;)[i,n]=[n,i%n];return i}function Ls(...s){let[t,...e]=s;return e.length>1?Ls(t,Ls(...e)):Math.abs(t*e[0])/xe(t,e[0])}function _o(s){if(s%1!==0||s<2)return!1;if(s%2===0)return s===2;if(s%3===0)return s===3;let t=Math.sqrt(s);for(let e=5;e<=t;e+=6)if(s%e===0||s%(e+2)===0)return!1;return!0}function No(s){if(s===1)return[];if(_o(s))return[s];let t=Math.sqrt(s);for(let e=2;e<=t;++e)if(s%e===0)return No(e).concat(No(s/e));return[]}function Zh(s){return Wt(No(s))}var mu=/^([0-9\-.]*)([%πkmbtq]?)(\/([0-9\-.]+))?([%π]?)$/,Hh=s=>s>=Number.MAX_SAFE_INTEGER,pn=class X{constructor(t,e,i){this.unit=i,this.num=e!==void 0&&e<0?-t:t,e!==void 0&&Math.abs(e)!==1&&t!==0&&(this.den=Math.abs(e))}valueOf(){return this.value}toMixed(){if(!this.den||this.unit)return this.toString();let t=Math.abs(this.num)%this.den,e=Math.abs(Math.trunc(this.value));return e?`${this.sign<0?"\u2013":""}${e} ${t}/${this.den}`:this.toString()}toExpr(t,e=4){let i=this.value;if(Math.abs(i)>=Number.MAX_VALUE)return"\u221E";if((Hh(this.num)||this.den&&Hh(this.den))&&(t="decimal"),t==="scientific"||Math.abs(i)>=Number.MAX_SAFE_INTEGER){let[n,r]=this.value.toExponential(e-1).split("e");if(Math.abs(+r)>=e){let o=r.startsWith("-"),a=`${o?"(":""}${o?r:r.slice(1)}${o?")":""}`;return`${n.replace(/\.?0+$/,"")} \xD7 10^${a}${this.unit||""}`}}if(!this.unit&&!this.den||t==="decimal"||t==="scientific"){let n=Rt(this.value,e);return n.match(/^[\d.]+$/g)?n:`"${n}"`}else return t==="mixed"?this.toMixed():this.toString()}toString(t=4){let e=!this.den&&!this.unit,i=Rt(this.num,this.den?0:t,e),n=this.unit||"",r=this.den?`/${Rt(this.den,0,e)}`:"";return i==="0"&&(n=""),n==="\u03C0"&&!this.den&&(i==="1"||i==="\u20131")&&(i=i.replace("1","")),`${i}${r}${n}`}toMathML(){let t=`${this.num}`;return this.den!==void 0&&(t=`${t}${this.den}`),this.unit&&(t+=this.unit==="\u03C0"?"\u03C0":"%"),t}get value(){let t=this.unit==="%"?.01:this.unit==="\u03C0"?Math.PI:1;return this.num*t/(this.den||1)}get sign(){return Math.sign(this.num)}get simplified(){if(!this.den)return this;let t=xe(Math.abs(this.num),this.den);return new X(this.num/t,this.den/t,this.unit)}get inverse(){return this.den?new X(1/this.num,void 0,this.unit):new X(this.den,this.num)}get negative(){return new X(-this.num,this.den,this.unit)}get fraction(){if(!(this.unit||!be(this.num)))return[this.num,this.den||1]}static fromString(t){t=t.toLowerCase().replace(/[\s,"]/g,"").replace("\u2013","-").replace("pi","\u03C0");let e=t.match(mu);if(!e)return;let i=e[2]||e[5]||void 0,n=e[1]?+e[1]:void 0,r=e[4]?+e[4]:void 0;if(i==="\u03C0"&&(!e[1]||e[1]==="-")&&(n=e[1]?-1:1),n===void 0||isNaN(n))return;let o=i?"kmbtq".indexOf(i):-1;if(o>=0&&(n*=1e3**(o+1),i=void 0),r===void 0)return new X(n,void 0,i);if(!(isNaN(r)||x(r,0)))return!be(n)||!be(r)?new X(n/r,void 0,i):new X(n,r,i)}static fractionFromDecimal(t,e=1e3,i=1e-12){let n=[1,0],r=[0,1],o=Math.abs(t),a=o;for(;Math.abs(n[0]/r[0]-o)>i;){let h=Math.floor(a);if(n=[h*n[0]+n[1],n[0]],r=[h*r[0]+r[1],r[0]],r[0]>e)return new X(t);a=1/(a-h)}return x(n[0]/r[0],o,i)?new X(ou(t)*n[0],r[0]===1?void 0:r[0]):new X(t)}clamp(t,e){let i=this.value;return t!==void 0&&ie?new X(e):this}add(t){return X.sum(this,t)}subtract(t){return X.difference(this,t)}multiply(t){return X.product(this,t)}divide(t){return X.quotient(this,t)}static sum(t,e){if(typeof e=="number"&&(e=new X(e)),t.num===0)return e;if(t.unit!==e.unit)return new X(t.value+e.value);if(!t.den&&!e.den)return new X(t.num+e.num,void 0,t.unit);if(t.den||([t,e]=[e,t]),!be(e.num))return new X(t.value+e.value,void 0,t.unit);let i=Ls(t.den,e.den||1),n=i/t.den,r=i/(e.den||1);return new X(t.num*n+e.num*r,i,t.unit)}static difference(t,e){return typeof e=="number"&&(e=new X(e)),X.sum(t,e.negative)}static product(t,e){if(typeof e=="number"&&(e=new X(e)),!t.unit&&!t.den&&be(t.num))return new X(t.num*e.num,e.den,e.unit);if(!e.unit&&!e.den&&be(e.num))return new X(t.num*e.num,t.den,t.unit);if(t.unit==="\u03C0"||e.unit==="\u03C0"||!be(t.num)||!be(e.num))return new X(t.value*e.value);let i=(t.unit==="%"?100:1)*(e.unit==="%"?100:1);return new X(t.num*e.num,(t.den||1)*(e.den||1)*i)}static quotient(t,e){return typeof e=="number"&&(e=new X(e)),X.product(t,e.inverse)}},kt={};Go(kt,{determinant:()=>bu,fill:()=>Qh,identity:()=>Jh,inverse:()=>sl,product:()=>ln,reflection:()=>wu,rotation:()=>gu,scalarProduct:()=>yu,shear:()=>vu,sum:()=>tl,transpose:()=>el});function Qh(s,t,e){return ko(s,t,e)}function Jh(s=2){let t=Qh(0,s,s);for(let e=0;e1?tl(...e):e[0];if(t.length!==i.length||t[0].length!==i[0].length)throw new Error("Matrix sizes don\u2019t match");let n=[];for(let r=0;re.map(i=>i*t))}function ln(...s){let[t,...e]=s,i=e.length>1?ln(...e):e[0];if(t[0].length!==i.length)throw new Error("Matrix sizes don\u2019t match.");let n=[];for(let r=0;rs[n][r],t,t);for(let n=0;nnl,binomial:()=>Su,cauchy:()=>Vu,chiCDF:()=>Lu,exponential:()=>Au,find:()=>Pu,geometric:()=>ku,integer:()=>$u,integrate:()=>ol,normal:()=>Cu,normalPDF:()=>Iu,poisson:()=>Eu,shuffle:()=>xu,smart:()=>Tu,uniform:()=>Mu,weighted:()=>il});function xu(s){s=s.slice(0);for(let t=s.length-1;t>0;--t){let e=Math.floor(Math.random()*(t+1));[s[t],s[e]]=[s[e],s[t]]}return s}function $u(s,t){let e=t===void 0?0:s,i=t===void 0?s:t-s+1;return e+Math.floor(i*Math.random())}function il(s){let t=Math.random()*N(s),e=0;return s.findIndex(i=>(e+=i)>=t)}function Pu(s){return s[Math.floor(s.length*Math.random())]}var hn=new Map;function Tu(s,t){t||(t=We()),hn.has(t)||hn.set(t,re(1,s));let e=hn.get(t),i=il(e.map(n=>n*n));return e[i]-=1,e[i]<=0&&hn.set(t,e.map(n=>n+1)),i}function nl(s=.5){return Math.random()t;++i)e*=Math.random();return i-1}function Mu(s=0,t=1){return s+(t-s)*Math.random()}function Cu(s=0,t=1){let e=Math.random(),i=Math.random();return Math.sqrt(-2*Math.log(e))*Math.cos(2*Math.PI*i)*Math.sqrt(t)+s}function Au(s=1){return s<=0?0:-Math.log(Math.random())/s}function ku(s=.5){if(!(s<=0||s>1))return Math.floor(Math.log(Math.random())/Math.log(1-s))}function Vu(){let s,t,e;do t=2*Math.random()-1,e=2*Math.random()-1,s=t*t+e*e;while(s>=1);return t/e}function Iu(s,t=1,e=0){return Math.exp(-((s-t)**2)/(2*e))/Math.sqrt(2*Math.PI*e)}var jh=7,Uh=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23];function rl(s){if(s<.5)return Math.PI/(Math.sin(Math.PI*s)*rl(1-s));s-=1;let t=Uh[0];for(let i=1;iMath.pow(i,(t-2)/2)*Math.exp(-i/2),0,s)/Math.pow(2,t/2)/rl(t/2)}var Fo={};Go(Fo,{bestPolynomial:()=>zu,coefficient:()=>hl,exponential:()=>Du,linear:()=>Ru,logarithmic:()=>Nu,polynomial:()=>al,power:()=>Gu});function Ou(s,t){let e=1,i=s[0];for(let n=1;noe(t+1).map(l=>Math.pow(h[0],l))),i=el(e),n=s.map(h=>[h[1]]),r=ln(i,e),o=sl(r);return ln(o,i,n).map(h=>h[0])}function hl(s,t){let i=s.reduce((o,a)=>o+a[1],0)/s.length,n=s.reduce((o,a)=>o+(a[1]-i)**2,0);return 1-s.reduce((o,a)=>o+(a[1]-t(a[0]))**2,0)/n}function zu(s,t=.85,e=8){if(!(s.length<=1))for(let i=1;iOu(n,a);if(hl(s,r)>=t)return{order:i,coefficients:n,fn:r}}}function Os(s){return s.length?N(s)/s.length:0}var Tt=2*Math.PI;function $i(s,t){let e=Math.atan2(s.y-(t?t.y:0),s.x-(t?t.x:0));return gt(e,Tt)}function ll(s,t){let e,i=1/0,n=-1;for(let[r,o]of t.entries()){let a=o.project(s),h=p.distance(s,a);hn.x))/t.length,i=N(t.map(n=>n.y))/t.length;return new et(e,i)}static dot(t,e){return t.x*e.x+t.y*e.y}static sum(t,e){return new et(t.x+e.x,t.y+e.y)}static difference(t,e){return new et(t.x-e.x,t.y-e.y)}static distance(t,e){return Math.sqrt(Qt(t.x-e.x)+Qt(t.y-e.y))}static manhattan(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)}static interpolate(t,e,i=.5){return new et(tt(t.x,e.x,i),tt(t.y,e.y,i))}static interpolateList(t,e=.5){let i=t.length-1,n=Math.floor(B(e,0,1)*i);return et.interpolate(t[n],t[n+1],i*e-n)}static fromPolar(t,e=1){return new et(e*Math.cos(t),e*Math.sin(t))}static random(t){let e=_t.uniform(t.xMin,t.xMax),i=_t.uniform(t.yMin,t.yMax);return new et(e,i)}static equals(t,e,i){return x(t.x,e.x,i)&&x(t.y,e.y,i)}static colinear(t,e,i,n){let r=t.x-e.x,o=t.y-e.y,a=e.x-i.x,h=e.y-i.y;return x(r*h,a*o,n)}transform(t){let e=t[0][0]*this.x+t[0][1]*this.y+t[0][2],i=t[1][0]*this.x+t[1][1]*this.y+t[1][2];return new et(e,i)}rotate(t,e=R){if(x(t,0))return this;let i=this.x-e.x,n=this.y-e.y,r=Math.cos(t),o=Math.sin(t),a=i*r-n*o+e.x,h=i*o+n*r+e.y;return new et(a,h)}reflect(t){let e=t.p2.x-t.p1.x,i=t.p2.y-t.p1.y,n=this.x-t.p1.x,r=this.y-t.p1.y,o=(e*r-i*n)/(e*e+i*i),a=this.x+2*o*i,h=this.y-2*o*e;return new et(a,h)}scale(t,e=t){return new et(this.x*t,this.y*e)}shift(t,e=t){return new et(this.x+t,this.y+e)}translate(t){return this.shift(t.x,t.y)}equals(t,e){return et.equals(this,t,e)}toString(){return`point(${this.x},${this.y})`}},R=new p(0,0);function St(s){return["polygon","polyline","rectangle","triangle"].includes(s.type)}function Ye(s){return["polygon","triangle"].includes(s.type)}function mn(s){return s.type==="polyline"}function Wo(s){return s.type==="rectangle"}function it(s){return["line","ray","segment"].includes(s.type)}function Ko(s){return s.type==="line"}function gn(s){return s.type==="ray"}function $e(s){return s.type==="segment"}function U(s){return s.type==="circle"}function Ze(s){return s.type==="ellipse"}function Nt(s){return s.type==="arc"}function Pe(s){return s.type==="sector"}function Ft(s){return s.type==="angle"}function rt(s){return s.type==="point"}var vt=class xi{constructor(t,e){this.p1=t,this.p2=e,this.type="line"}get length(){return p.distance(this.p1,this.p2)}get lengthSquared(){return(this.p1.x-this.p2.x)**2+(this.p1.y-this.p2.y)**2}get midpoint(){return p.average(this.p1,this.p2)}get slope(){return(this.p2.y-this.p1.y)/(this.p2.x-this.p1.x)}get intercept(){return this.p1.y-this.slope*this.p1.x}get angle(){return $i(this.p2,this.p1)}get unitVector(){return this.p2.subtract(this.p1).unitVector}get perpendicularVector(){return new p(this.p2.y-this.p1.y,this.p1.x-this.p2.x).unitVector}parallel(t){return new xi(t,t.add(this.p2).subtract(this.p1))}perpendicular(t){let e=this.line.project(t);return p.equals(t,e)?new xi(e,e.add(this.perpendicularVector.scale(this.length/2))):new xi(e,t)}get perpendicularBisector(){return this.perpendicular(this.midpoint)}distanceSquared(t){let e=this.project(t);return(t.x-e.x)**2+(t.y-e.y)**2}get line(){return this.type==="line"?this:new xi(this.p1,this.p2)}get ray(){return gn(this)?this:new Xo(this.p1,this.p2)}get segment(){return $e(this)?this:new Y(this.p1,this.p2)}offset(t){let e=p.difference(this.p2,this.p1),i=p.difference(t,this.p1);return p.dot(e,i)/this.lengthSquared}project(t){return this.at(this.offset(t))}side(t,e){let i=p.difference(this.p2,this.p1),n=p.difference(t,this.p1),r=n.x*i.y-n.y*i.x;return x(r,0,e)?0:Math.sign(r)}contains(t,e){return this.side(t,e)===0}at(t){return p.interpolate(this.p1,this.p2,t)}transform(t){return new this.constructor(this.p1.transform(t),this.p2.transform(t))}rotate(t,e=R){return x(t,0)?this:new this.constructor(this.p1.rotate(t,e),this.p2.rotate(t,e))}reflect(t){return new this.constructor(this.p1.reflect(t),this.p2.reflect(t))}scale(t,e=t){return new this.constructor(this.p1.scale(t,e),this.p2.scale(t,e))}shift(t,e=t){return new this.constructor(this.p1.shift(t,e),this.p2.shift(t,e))}translate(t){return this.shift(t.x,t.y)}equals(t,e){return this.contains(t.p1,e)&&this.contains(t.p2,e)}toString(){return`line(${this.p1},${this.p2})`}},Xo=class extends vt{constructor(){super(...arguments),this.type="ray"}equals(s,t){return s.type!=="ray"||!this.p1.equals(s.p1,t)?!1:this.p2.equals(s.p2,t)?!0:s.contains(this.p2,t)||this.contains(s.p2,t)}contains(s,t){if(!super.contains(s,t))return!1;let e=this.offset(s);return x(e,0,t)||e>0}toString(){return`ray(${this.p1},${this.p2})`}},Y=class ml extends vt{constructor(){super(...arguments),this.type="segment"}contains(t,e){return super.contains(t,e)?this.p1.equals(t,e)||this.p2.equals(t,e)?!0:x(this.p1.x,this.p2.x,e)?nt(t.y,this.p1.y,this.p2.y):nt(t.x,this.p1.x,this.p2.x):!1}project(t){let e=p.difference(this.p2,this.p1),i=p.difference(t,this.p1),n=B(p.dot(e,i)/this.lengthSquared,0,1);return this.p1.add(e.scale(n))}contract(t){return new ml(this.at(t),this.at(1-t))}equals(t,e,i=!1){return t.type!=="segment"?!1:this.p1.equals(t.p1,e)&&this.p2.equals(t.p2,e)||!i&&this.p1.equals(t.p2,e)&&this.p2.equals(t.p1,e)}toString(){return`segment(${this.p1},${this.p2})`}},wt=class Rs{constructor(t=R,e=1){this.c=t,this.r=e,this.type="circle"}get circumference(){return Tt*this.r}get area(){return Math.PI*this.r**2}get arc(){let t=this.c.shift(this.r,0);return new qt(this.c,t,Tt)}tangentAt(t){let e=this.at(t),i=this.c.rotate(Math.PI/2,e);return new vt(e,i)}collision(t){let e=this.c.xt.p.x+t.w?t.p.x+t.w:this.c.x,i=this.c.yt.p.y+t.h?t.p.y+t.h:this.c.y;return p.distance(this.c,new p(e,i))<=this.r}project(t){let e=t.subtract(this.c).unitVector.scale(this.r);return p.sum(this.c,e)}at(t){let e=Tt*t;return this.c.shift(this.r*Math.cos(e),this.r*Math.sin(e))}offset(t){return $i(t,this.c)/Tt}contains(t){return p.distance(t,this.c)<=this.r}transform(t){let e=Math.abs(t[0][0])+Math.abs(t[1][1]);return new Rs(this.c.transform(t),this.r*e/2)}rotate(t,e=R){return x(t,0)?this:new Rs(this.c.rotate(t,e),this.r)}reflect(t){return new Rs(this.c.reflect(t),this.r)}scale(t,e=t){return new Rs(this.c.scale(t,e),this.r*(t+e)/2)}shift(t,e=t){return new Rs(this.c.shift(t,e),this.r)}translate(t){return this.shift(t.x,t.y)}equals(t,e){return x(this.r,t.r,e)&&this.c.equals(t.c,e)}toString(){return`circle(${this.c},${this.r})`}},qt=class{constructor(s,t,e){this.c=s,this.start=t,this.angle=e,this.type="arc"}get circle(){return new wt(this.c,this.radius)}get radius(){return p.distance(this.c,this.start)}get end(){return this.start.rotate(this.angle,this.c)}get startAngle(){return $i(this.start,this.c)}contract(s){return new this.constructor(this.c,this.at(s/2),this.angle*(1-s))}get minor(){return this.angle<=Math.PI?this:new this.constructor(this.c,this.end,Tt-this.angle)}get major(){return this.angle>=Math.PI?this:new this.constructor(this.c,this.end,Tt-this.angle)}get center(){return this.at(.5)}project(s){let t=this.startAngle,e=t+this.angle,i=$i(s,this.c);return e>Tt&&i=-ls}function cl(s,t,e){let i=s.y-t.y,n=e.x-t.x,r=s.x-t.x,o=e.y-t.y,a=r*n+i*o;if(a(i.prev=t,i.next=e,t.next=i,e&&(e.prev=i),i)}}static node(s){let t=s;return t.remove=()=>{t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t.prev=t.next=void 0},t}};function Uo(s,t,e){let i={above:e.myFill.above,below:e.myFill.below};return{start:s,end:t,myFill:i}}function _u(s,t,e,i,n,r){let o=gl(t,n);return o!==0?o:p.equals(e,r)?0:s!==i?s?1:-1:jo(e,i?n:r,i?r:n)?1:-1}function Zo(s,t,e){s.insertBefore(t,i=>_u(!!t.isStart,t.pt,e,!!i.isStart,i.pt,i.other.pt)<0)}function Fu(s,t,e){let i=Ns.node({isStart:!0,pt:t.start,seg:t,primary:e});return Zo(s,i,t.end),i}function qu(s,t,e,i){let n=Ns.node({pt:e.end,seg:e,primary:i,other:t});t.other=n,Zo(s,n,t.pt)}function un(s,t,e){let i=Fu(s,t,e);return qu(s,i,t,e),i}function Hu(s,t,e){t.other.remove(),t.seg.end=e,t.other.pt=e,Zo(s,t.other,t.pt)}function ue(s,t,e){let i=Uo(e,t.seg.end,t.seg);return Hu(s,t,e),un(s,i,!!t.primary)}function ju(s,t){let e=s.seg.start,i=s.seg.end,n=t.seg.start,r=t.seg.end;return p.colinear(e,n,r)?p.colinear(i,n,r)||jo(i,n,r)?1:-1:jo(e,n,r)?1:-1}function qo(s,t,e){let i=t.seg,n=e.seg,r=i.start,o=i.end,a=n.start,h=n.end,l=Bu(r,o,a,h);if(l===!1){if(!p.colinear(r,o,a)||p.equals(r,h)||p.equals(o,a))return!1;let c=p.equals(r,a),u=p.equals(o,h);if(c&&u)return e;let d=!c&&cl(r,a,h),g=!u&&cl(o,a,h);if(c)return g?ue(s,e,o):ue(s,t,h),e;d&&(u||(g?ue(s,e,o):ue(s,t,h)),ue(s,e,r))}else l.alongA===0&&(l.alongB===-1?ue(s,t,a):l.alongB===0?ue(s,t,l.pt):l.alongB===1&&ue(s,t,h)),l.alongB===0&&(l.alongA===-1?ue(s,e,r):l.alongA===0?ue(s,e,l.pt):l.alongA===1&&ue(s,e,o));return!1}function vl(s,t){var e,i;let n=new Ns,r=[];for(;s.head;){let a=s.head;if(a.isStart){let h=function(){if(c){let g=qo(s,a,c);if(g)return g}return u?qo(s,a,u):!1};var o=h;let l=n.findTransition(g=>ju(a,g.ev)>0),c=(e=l.before)==null?void 0:e.ev,u=(i=l.after)==null?void 0:i.ev,d=h();if(d&&(t?(!a.seg.myFill.below||a.seg.myFill.above!==a.seg.myFill.below)&&(d.seg.myFill.above=!d.seg.myFill.above):d.seg.otherFill=a.seg.myFill,a.other.remove(),a.remove()),s.head!==a)continue;if(t){let g=a.seg.myFill.below?a.seg.myFill.above!==a.seg.myFill.below:!0;a.seg.myFill.below=u?u.seg.myFill.above:!1,a.seg.myFill.above=g?!a.seg.myFill.below:a.seg.myFill.below}else if(a.seg.otherFill===void 0){let g=u?a.primary===u.primary?u.seg.otherFill.above:u.seg.myFill.above:!1;a.seg.otherFill={above:g,below:g}}a.other.status=l.insert(Ns.node({ev:a}))}else{let h=a.status;if(h===void 0)throw new Error("[Euclid.js] Zero-length segment detected!");if(n.exists(h.prev)&&n.exists(h.next)&&qo(s,h.prev.ev,h.next.ev),h.remove(),!a.primary){let l=a.seg.myFill;a.seg.myFill=a.seg.otherFill,a.seg.otherFill=l}r.push(a.seg)}s.head.remove()}return r}function Uu(s){let t=[],e=[];return s.forEach(i=>{let n=i.start,r=i.end;if(p.equals(n,r))return;let o={index:0,matchesHead:!1,matchesPt1:!1},a={index:0,matchesHead:!1,matchesPt1:!1},h=o;function l(f,v,y){h.index=f,h.matchesHead=v,h.matchesPt1=y;let $=h===o;return h=$?a:void 0,!$}for(let f=0;fQo(s,t,Ku),Qu=(s,t)=>Qo(s,t,Xu),Ju=(s,t)=>Qo(s,t,Yu);function tf(s,t){return x(s.p1.x,s.p2.x)?nt(t.y,s.p1.y,s.p2.y):nt(t.x,s.p1.x,s.p2.x)}function ef(s,t){return x(s.p1.x,s.p2.x)?(t.y-s.p1.y)/(s.p2.y-s.p1.y)>0:(t.x-s.p1.x)/(s.p2.x-s.p1.x)>0}function sf(s,t){return nt(s.offset(t),0,1)}function nf(s,t){let e=s.p1.x-s.p2.x,i=s.p1.y-s.p2.y,n=t.p1.x-t.p2.x,r=t.p1.y-t.p2.y,o=e*r-i*n;if(x(o,0))return[];let a=s.p1.x*s.p2.y-s.p1.y*s.p2.x,h=t.p1.x*t.p2.y-t.p1.y*t.p2.x,l=a*n-e*h,c=a*r-i*h;return[new p(l/o,c/o)]}function rf(s,t){let e=p.distance(s.c,t.c);if(e>s.r+t.r)return[];if(etf(r,o))),gn(r)&&(e=e.filter(o=>ef(r,o))),Nt(r)&&(e=e.filter(o=>sf(r,o)));return e}function Q(...s){if(s.length<2)return[];if(s.length>2)return ye(Kh(s,2).map(i=>Q(...i)));let[t,e]=s;if(Ft(t)&&(t=t.shape(!0)),Ft(e)&&(e=e.shape(!0)),St(e)&&([t,e]=[e,t]),St(t)){let i=it(e)?t.points.filter(n=>e.contains(n)):[];for(let n of t.edges)i.push(...Q(n,e));return i}return of(t,e)}var V=class Xe{constructor(...t){this.type="polygon",this.points=t}get circumference(){if(this.points.length<=1)return 0;let t=p.distance(this.points[0],O(this.points));for(let e=1;ep.distance(i,t));return Math.max(...e)}get oriented(){if(this.signedArea>=0)return this;let t=[...this.points].reverse();return new this.constructor(...t)}cut(t){let e=this.radius/t.length*10,i=t.at(-e),n=t.at(e),r=t.perpendicularVector.scale(t.length*e),o=[i,n,n.add(r),i.add(r)],a=Qu([this.points],[o]),h=Ju([this.points],[o]);return[...a,...h].map(l=>new Xe(...l))}static collision(t,e){if(t.points.some(i=>e.contains(i))||e.points.some(i=>t.contains(i)))return!0;for(let i of t.edges)for(let n of e.edges)if(Q(i,n)[0])return!0;return!1}static union(...t){let[e,...i]=t;if(!i.length)return[e];let n=[e.points],r=i.length>1?Xe.union(...i).map(o=>o.points):[t[1].points];return Zu(n,r).map(o=>new Xe(...o))}static regular(t,e=1){let i=Tt/t,n=Math.PI/2-i/2,r=z(o=>p.fromPolar(n+i*o,e),t);return new Xe(...r)}static interpolate(t,e,i=.5){let n=t.points.map((r,o)=>p.interpolate(r,e.points[o],i));return new Xe(...n)}static convexHull(...t){if(t.length<=3)return new Xe(...t);let e=t.sort((o,a)=>o.x!==a.x?o.x-a.x:o.y-a.y),i=e.slice(0).reverse(),n=[],r=[];for(let[o,a]of[[e,n],[i,r]]){for(let h of o){for(;a.length>=2;){let l=a[a.length-1],c=a[a.length-2];if((l.x-c.x)*(h.y-c.y)>=(h.x-c.x)*(l.y-c.y))a.pop();else break}a.push(h)}a.pop()}return new Xe(...n.concat(r))}contains(t){let e=!1;for(let i of this.edges){if(i.p1.equals(t)||i.contains(t))return!1;if(i.p1.y>t.y==i.p2.y>t.y)continue;let n=(i.p2.x-i.p1.x)/(i.p2.y-i.p1.y);t.xe)return n.at((e-i)/r);i+=r}return this.points[0]}offset(t){let e=this.edges,i=ll(t,this.edges)||[this.points[0],0],n=0;for(let r=0;re.transform(t)))}rotate(t,e=R){if(x(t,0))return this;let i=this.points.map(n=>n.rotate(t,e));return new this.constructor(...i)}reflect(t){let e=this.points.map(i=>i.reflect(t));return new this.constructor(...e)}scale(t,e=t){let i=this.points.map(n=>n.scale(t,e));return new this.constructor(...i)}shift(t,e=t){let i=this.points.map(n=>n.shift(t,e));return new this.constructor(...i)}translate(t){return this.shift(t.x,t.y)}equals(t,e,i){let n=this.points.length;if(n!==t.points.length)return!1;let r=i?this:this.oriented,o=i?t:t.oriented;for(let a=0;ah.equals(o.points[(l+a)%n],e)))return!0;return!1}toString(){return`polygon(${this.points.join(",")})`}},te=class extends V{constructor(){super(...arguments),this.type="polyline"}get circumference(){return this.length}get length(){let s=0;for(let t=1;tNumber.MAX_SAFE_INTEGER))return new wt(o,a)}get incircle(){let s=this.edges,t=s.map(c=>c.length),e=t[0]+t[1]+t[2],[i,n,r]=this.points,o=t[1]*i.x+t[2]*n.x+t[0]*r.x,a=t[1]*i.y+t[2]*n.y+t[0]*r.y,h=new p(o/e,a/e),l=h.distanceFromLine(s[0]);return isNaN(l)?void 0:new wt(h,l)}get orthocenter(){let[s,t,e]=this.points,i=new vt(s,t).perpendicular(e),n=new vt(s,e).perpendicular(t);return Q(i,n)[0]}},af=180/Math.PI,hf=Math.PI/180;function Kt(s){return s*af}function J(s){return s*hf}var Vt=class fe{constructor(t,e,i){this.a=t,this.b=e,this.c=i,this.type="angle"}static fromDegrees(t){return fe.fromRadians(t*(Math.PI/180))}static fromRadians(t){let e=new p(1,0),i=e.rotate(t);return new fe(e,R,i)}static equals(t,e,i=Math.PI/360){return x(t.rad,e.rad,i)}get rad(){let t=Math.atan2(this.a.y-this.b.y,this.a.x-this.b.x),i=Math.atan2(this.c.y-this.b.y,this.c.x-this.b.x)-t;return i<0&&(i+=Tt),i}get deg(){return this.rad*180/Math.PI}get isRight(){return x(this.rad,Math.PI/2,Math.PI/360)}get bisector(){if(this.b.equals(this.a)||this.b.equals(this.c))return;let t=Math.atan2(this.a.y-this.b.y,this.a.x-this.b.x),e=Math.atan2(this.c.y-this.b.y,this.c.x-this.b.x),i=(t+e)/2;t>e&&(i+=Math.PI);let n=Math.cos(i)+this.b.x,r=Math.sin(i)+this.b.y;return new vt(this.b,new p(n,r))}get sup(){return this.rado.x?i:o.x,n=no.y?r:o.y;return new Ds(new p(e,n),i-e,r-n)}get center(){return new p(this.p.x+this.w/2,this.p.y+this.h/2)}get centroid(){return this.center}get circumference(){return 2*Math.abs(this.w)+2*Math.abs(this.h)}get area(){return Math.abs(this.signedArea)}get signedArea(){return this.w*this.h}get edges(){return this.polygon.edges}get points(){return this.polygon.points}get polygon(){let t=new p(this.p.x+this.w,this.p.y),e=new p(this.p.x+this.w,this.p.y+this.h),i=new p(this.p.x,this.p.y+this.h);return new V(this.p,t,e,i)}get bounds(){return new lt(this.p.x,this.p.x+this.w,this.p.y,this.p.y+this.h)}collision(t){return this.p.xt.p.x&&this.p.yt.p.y}padding(t,e,i,n){return new Ds(this.p.shift(-n,-t),this.w+n+e,this.h+t+i)}get unsigned(){if(this.w>0&&this.h>0)return this;let t=this.p.shift(this.w<0?this.w:0,this.h<0?this.h:0);return new Ds(t,Math.abs(this.w),Math.abs(this.h))}contains(t,e){return nt(t.x,this.p.x,this.p.x+this.w,e)&&nt(t.y,this.p.y,this.p.y+this.h,e)}project(t){let e;for(let i of this.edges){let n=i.project(t);(!e||p.distance(t,n)0?1:0,r=p.distance(t,s);return[s.x,`${s.y}A${r}`,r,0,n,1,e.x,e.y].join(",")}function Jt(...s){return`M${s.map(t=>`${t.x},${t.y}`).join("L")}`}function Ho(s,t){let e=s.perpendicularVector.scale(6),i=s.unitVector.scale(3),n=s.midpoint;switch(t){case"bar":return Jt(n.add(e),n.add(e.inverse));case"bar2":return Jt(n.add(i).add(e),n.add(i).add(e.inverse))+Jt(n.add(i.inverse).add(e),n.add(i.inverse).add(e.inverse));case"arrow":return Jt(n.add(i.inverse).add(e),n.add(i),n.add(i.inverse).add(e.inverse));case"arrow2":return Jt(n.add(i.scale(-2)).add(e),n,n.add(i.scale(-2)).add(e.inverse))+Jt(n.add(e),n.add(i.scale(2)),n.add(e.inverse));default:return""}}function fn(s,t){if(!s||!t)return"";let e=t.perpendicular,i=s.add(t.scale(9)).add(e.scale(9)),n=s.add(t.scale(9)).add(e.scale(-9));return Jt(i,s,n)}function lf(s,t){let e="";return _(t,"start","both")&&(e+=fn(s.p1,s.unitVector)),_(t,"end","both")&&(e+=fn(s.p2,s.unitVector.inverse)),e}function cf(s,t){let e="";if(_(t,"start","both")){let i=new vt(s.c,s.start).perpendicularVector.inverse;e+=fn(s.start,i)}if(_(t,"end","both")){let i=new vt(s.c,s.end).perpendicularVector;e+=fn(s.end,i)}return e}function pf(s,t,e=t,i=t,n=e){let{p:r,w:o,h:a}=s;return`M${r.x} ${r.y+t}a${t} ${t} 0 0 1 ${t} ${-t}h${o-t-e}a${e} ${e} 0 0 1 ${e} ${e}v${a-e-i}a${i} ${i} 0 0 1 ${-i} ${i}h${-o+n+i}a${n} ${n} 0 0 1 ${-n} ${-n}Z`}function De(s,t={}){if(Ft(s)){let e=s.shape(!!t.fill,t.size,t.round);return De(e,t)}if($e(s)){if(s.p1.equals(s.p2))return"";let e=Jt(s.p1,s.p2);return t.mark&&(e+=Ho(s,t.mark)),t.arrows&&(e+=lf(s,t.arrows)),e}if(gn(s)){if(!t.box)return"";let e=Q(s,t.box)[0];if(!e)return"";let i=Jt(s.p1,e);return t.mark&&(i+=Ho(s,t.mark)),i}if(Ko(s)){if(!t.box)return"";let e=Q(s,t.box);if(e.length<2)return"";let i=Jt(e[0],e[1]);return t.mark&&(i+=Ho(s,t.mark)),i}if(U(s))return`M${s.c.x-s.r} ${s.c.y}a${s.r},${s.r} 0 1 0 ${2*s.r} 0a${s.r} ${s.r} 0 1 0 ${-2*s.r} 0Z`;if(Ze(s)){let[e,i]=s.majorVertices,n=Kt(s.angle);return`M${e.x} ${e.y}A${s.a} ${s.b} ${n} 0 0 ${i.x} ${i.y}A${s.a} ${s.b} ${n} 0 0 ${e.x} ${e.y}Z`}if(Nt(s)){let e=`M${fl(s.start,s.c,s.end)}`;return t.arrows&&(e+=cf(s,t.arrows)),e}if(Pe(s))return`M${s.c.x} ${s.c.y} L ${fl(s.start,s.c,s.end)}Z`;if(mn(s))return Jt(...s.points);if(Ye(s))return`${Jt(...s.points)}Z`;if(Wo(s)){if(!t.cornerRadius)return`${Jt(...s.polygon.points)}Z`;let e=s.unsigned,i=Math.min(t.cornerRadius,e.w/2,e.h/2);return pf(e,i)}return""}var ta=(s,t)=>(t=Symbol[s])?t:Symbol.for("Symbol."+s),he=(s,t,e)=>new Promise((i,n)=>{var r=h=>{try{a(e.next(h))}catch(l){n(l)}},o=h=>{try{a(e.throw(h))}catch(l){n(l)}},a=h=>h.done?i(h.value):Promise.resolve(h.value).then(r,o);a((e=e.apply(s,t)).next())}),df=function(s,t){this[0]=s,this[1]=t},uf=s=>{var t=s[ta("asyncIterator")],e=!1,i,n={};return t==null?(t=s[ta("iterator")](),i=r=>n[r]=o=>t[r](o)):(t=t.call(s),i=r=>n[r]=o=>{if(e){if(e=!1,r==="throw")throw o;return o}return e=!0,{done:!1,value:new df(new Promise(a=>{var h=t[r](o);if(!(h instanceof Object))throw TypeError("Object expected");a(h)}),1)}}),n[ta("iterator")]=()=>n,i("next"),"throw"in t?i("throw"):n.throw=r=>{throw r},"return"in t&&i("return"),n},vn="_M",Gs=window.navigator.userAgent.toLowerCase(),ff=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i,wl=/iphone|ipad|ipod/i,mf=/^((?!chrome|android).)*safari/i,yl,gf=class{constructor(){this.isMobile=ff.test(Gs),this.isRetina=(window.devicePixelRatio||1)>1,this.isTouch=!!window.Touch||"ontouchstart"in window,this.isChrome=!!window.chrome,this.isFirefox=Gs.indexOf("firefox")>=0,this.isAndroid=Gs.indexOf("android")>=0,this.isIOS=wl.test(Gs),this.isSafari=wl.test(Gs)||mf.test(Gs),this.loadQueue=[],this.loaded=!1,this.width=window.innerWidth,this.height=window.innerHeight,this.resizeCallbacks=[],this.theme={name:"light",isDark:!1},this.themeChangedCallbacks=[],this.themeOverride="",this.darkQuery=(yl=window.matchMedia)==null?void 0:yl.call(window,"(prefers-color-scheme: dark)");var s,t;window.onload=()=>this.afterLoad(),document.addEventListener("DOMContentLoaded",()=>this.afterLoad());let e=ve(()=>this.applyResize());window.addEventListener("resize",e);try{(s=this.darkQuery)==null||s.addEventListener("change",()=>this.applyThemeChange())}catch(n){(t=this.darkQuery)==null||t.addListener(()=>this.applyThemeChange())}let i=this.getCookie("theme");i&&this.setTheme(i);try{this.localStorage=window.localStorage}catch(n){console.warn("Unable to access Local Storage in this context.")}}afterLoad(){if(!this.loaded){this.loaded=!0;for(let s of this.loadQueue)s();setTimeout(()=>this.resize())}}ready(s){this.loaded?s():this.loadQueue.push(s)}redraw(){document.body.offsetHeight}applyResize(){let s=window.innerWidth,t=window.innerHeight;if(!(this.width===s&&this.height===t)){this.width=s,this.height=t;for(let e of this.resizeCallbacks)e({width:this.width,height:this.height});C.trigger("scroll",{top:C.scrollTop})}}onResize(s){s({width:this.width,height:this.height}),this.resizeCallbacks.push(s)}offResize(s){let t=this.resizeCallbacks.indexOf(s);t>=0&&this.resizeCallbacks.splice(t,1)}resize(){this.applyResize()}applyThemeChange(){let s=this.theme.name,t=s==="dark"||s==="auto"&&this.darkQuery.matches;if(t!==this.theme.isDark){this.theme.isDark=t;for(let e of this.themeChangedCallbacks)e(this.theme);setTimeout(()=>Xt.setAttr("theme",this.themeOverride||(t?"dark":"light")))}}setTheme(s){s!==this.theme.name&&(this.theme.name=s,this.setCookie("theme",s),this.applyThemeChange())}onThemeChange(s){this.themeChangedCallbacks.push(s)}getHash(){return window.location.hash.slice(1)}setHash(s){let t=document.body.scrollTop;window.location.hash=s,document.body.scrollTop=t}setURL(s,t=""){window.history.replaceState({},t,s),t&&(window.document.title=t)}getCookies(){let s=document.cookie.split(";"),t={};for(let e=0,i=s.length;e use")).forEach(function(t){let e=t.getAttribute("xlink:href"),[i,n]=e.split("#");if(!i.length||!n)return;let r=t.parentNode;r.removeChild(t),i in ea||(ea[i]=fetch(i).then(a=>a.text())),ea[i].then(a=>{let h=document.implementation.createHTMLDocument("");h.documentElement.innerHTML=a;let c=h.getElementById(n).cloneNode(!0),u=document.createDocumentFragment();for(;c.childNodes.length;)u.appendChild(c.firstChild);r.appendChild(u)})})}var $f=new Map(Object.entries({" ":"Space",Spacebar:"Space",Del:"Delete",Esc:"Escape",Left:"ArrowLeft",Right:"ArrowRight",Down:"ArrowDown",Up:"ArrowUp"}));function Ei(s){return $f.get(s.key)||s.key}function El(s){let t=new Set(["Enter","Space"]),e=!1;document.addEventListener("keyup",i=>{t.has(Ei(i))&&(e=!1)}),(s||document).addEventListener("keydown",i=>{if(!e&&t.has(Ei(i))){e=!0;let n=b.getActiveInput();n&&n.hasAttr("tabindex")&&n.tagName!=="TEXTAREA"&&(i.preventDefault(),n.trigger("pointerdown",i),n.trigger("pointerstop",i),C.trigger("pointerstop",i),n.trigger("click",i))}})}var Tn=!1;setTimeout(()=>Tn=!0);var Pf="cubic-bezier(0.175, 0.885, 0.32, 1.275)",Tf="cubic-bezier(0.68, -0.275, 0.825, 0.115)",ps={cancel:()=>{},promise:Promise.resolve()};function pt(s,t){if(t===0)return s(1,0,()=>{}),ps;let e=Date.now(),i=Ke(),n=0,r=!0,o=()=>{r=!1,i.reject()};function a(){if(!r)return;(!t||n<=t)&&window.requestAnimationFrame(a);let h=Date.now()-e;s(t?Math.min(1,h/t):h,h-n,o),t&&h>=t&&i.resolve(),n=h}return a(),{cancel:o,promise:i.promise}}function wn(s,t=0,e=0){switch(s){case"quad":return t**2;case"cubic":return t**3;case"quart":return t**4;case"quint":return t**5;case"circ":return 1-Math.sqrt(1-t**2);case"sine":return 1-Math.cos(t*Math.PI/2);case"exp":return t<=0?0:Math.pow(2,10*(t-1));case"back":return e||(e=1.70158),t*t*((e+1)*t-e);case"elastic":return e||(e=.3),-Math.pow(2,10*(t-1))*Math.sin(((t-1)*2/e-.5)*Math.PI);case"swing":return .5-Math.cos(t*Math.PI)/2;case"spring":return 1-Math.cos(t*4.5*Math.PI)*Math.exp(-t*6);case"bounce":return t<1/11?1/64-7.5625*(.5/11-t)*(.5/11-t):t<3/11?1/16-7.5625*(2/11-t)*(2/11-t):t<7/11?1/4-7.5625*(5/11-t)*(5/11-t):1-7.5625*(1-t)*(1-t);default:return t}}function yt(s,t=0,e=0){if(t===0)return 0;if(t===1)return 1;let[i,n]=s.split("-");return n==="in"?wn(i,t,e):n==="out"?1-wn(i,1-t,e):t<=.5?wn(i,2*t,e)/2:1-wn(i,2*(1-t),e)/2}function Ht(s,t,e=400,i=0,n="ease-in-out"){if(!Tn)return Object.keys(t).forEach(f=>{let v=t[f];s.css(f,Array.isArray(v)?v[1]:v)}),ps;n==="bounce-in"&&(n=Pf),n==="bounce-out"&&(n=Tf);let r="";b.isSafari&&(r=s._el.style.transition,s.css("transition","none"),b.redraw());let o=s._data.animation;o&&o.cancel();let a={},h={},l=Ke(),c=window.getComputedStyle(s._el);Object.keys(t).forEach(f=>{let v=t[f],y=rn(f);h[y]=Array.isArray(v)?v[0]:c.getPropertyValue(f),a[y]=Array.isArray(v)?v[1]:v,i&&s.css(f,h[y])});let u=a.height;if(a.height==="auto"){let f=s.children.filter(v=>v.css("position")!=="absolute");a.height=`${N(f.map(v=>v.outerHeight))}px`}let d,g=!1;Zt(()=>{g||(d=s._el.animate([h,a],{duration:e,easing:n,fill:"forwards"}),d.onfinish=()=>{s._el&&Object.keys(t).forEach(f=>s.css(f,f==="height"?u:a[f])),b.isSafari&&s.css("transition",r),l.resolve(),d.cancel(),s._data.animation=void 0})},i);let w={cancel(){g||(g=!0,s._el&&Object.keys(t).forEach(f=>s.css(f,s.css(f))),d&&d.cancel(),s._data.animation=void 0)},promise:l.promise};return setTimeout(()=>s._data.animation=w),w}var Sf=/matrix\([0-9.\-\s]+,[0-9.\-\s]+,[0-9.\-\s]+,[0-9.\-\s]+,([0-9.\-\s]+),([0-9.\-\s]+)\)/;function Ef(s,t="fade",e=500,i=0){if(s.show(),!Tn)return ps;let n=s._data.animation?1:+s.css("opacity")||1;if(t==="fade")return Ht(s,{opacity:[0,n]},e,i);if(t==="pop"){let r=s.transform.replace(/scale\([0-9.]*\)/,"").replace(Sf,"translate($1px,$2px)");return Ht(s,{opacity:[0,n]},e,i),Ht(s,{transform:[`${r} scale(0.5)`,`${r} scale(1)`]},e,i,"bounce-in")}else{if(t==="descend")return Ht(s,{opacity:[0,1],transform:["translateY(-50%)","none"]},e,i);if(t.startsWith("draw")){let r=s.strokeLength;s.css("stroke-dasharray",`${r}px`),s.css("opacity")||s.css("opacity",1);let o=t==="draw-reverse"?`${2*r}px`:0,a={"stroke-dashoffset":[`${r}px`,o]},h=Ht(s,a,e,i,"linear");return h.promise.then(()=>s.css("stroke-dasharray","")),h}else if(t.startsWith("slide")){let r={opacity:[0,n],transform:["translateY(50px)","none"]};return t.includes("down")&&(r.transform[0]="translateY(-50px)"),t.includes("right")&&(r.transform[0]="translateX(-50px)"),t.includes("left")&&(r.transform[0]="translateX(50px)"),Ht(s,r,e,i)}else if(t.startsWith("reveal")){let r={opacity:[0,n],height:[0,"auto"]};return t.includes("left")&&(r.transform=["translateX(-50%)","none"]),t.includes("right")&&(r.transform=["translateX(50%)","none"]),Ht(s,r,e,i)}}return ps}function Mf(s,t="fade",e=400,i=0,n=!1){if(!s._el)return ps;if(!Tn)return s.hide(),ps;if(s.css("display")==="none")return ps;let r;if(t==="fade")r=Ht(s,{opacity:[1,0]},e,i);else if(t==="pop"){let o=s.transform.replace(/scale\([0-9.]*\)/,"");Ht(s,{opacity:[1,0]},e,i),r=Ht(s,{transform:[`${o} scale(1)`,`${o} scale(0.5)`]},e,i,"bounce-out")}else if(t==="ascend")r=Ht(s,{opacity:[1,0],transform:["none","translateY(-50%)"]},e,i);else if(t.startsWith("draw")){let o=s.strokeLength;s.css("stroke-dasharray",o);let h={"stroke-dashoffset":[t==="draw-reverse"?`${2*o}px`:0,`${o}px`]};r=Ht(s,h,e,i,"linear")}else if(t.startsWith("slide")){let o={opacity:0,transform:"translateY(50px)"};t.includes("up")&&(o.transform="translateY(-50px)"),r=Ht(s,o,e,i)}else if(t.startsWith("reveal")){let o={opacity:0,height:0};t.includes("left")&&(o.transform="translateX(-50%)"),t.includes("right")&&(o.transform="translateX(50%)"),r=Ht(s,o,e,i)}return r.promise.then(()=>n?s.remove():s.hide()),r}var Ml={"===":(s,t)=>s===t,"!==":(s,t)=>s!==t,"||":(s,t)=>s||t,"&&":(s,t)=>s&&t,"==":(s,t)=>s==t,"!=":(s,t)=>s!=t,"<=":(s,t)=>s<=t,">=":(s,t)=>s>=t,"**":(s,t)=>s**t,"<":(s,t)=>s":(s,t)=>s>t,"+":(s,t)=>s+t,"-":(s,t)=>s-t,"*":(s,t)=>s*t,"/":(s,t)=>s/t,"%":(s,t)=>s%t},Cl={"-":s=>-s,"+":s=>+s,"!":s=>!s},bl={"||":1,"&&":2,"==":3,"!=":3,"===":3,"!==":3,"<":4,">":4,"<=":4,">=":4,"+":5,"-":5,"*":6,"/":6,"%":6,"**":7},xl={true:!0,false:!1,undefined:void 0},Cf=/\s/,Af=/[0-9]/,sa=/[a-zA-Zα-ωΑ-Ω$_]/,kf=/[0-9a-zA-Zα-ωΑ-Ω$_]/;function Vf(s){let t=s.length,e=0;function i(f){throw new Error(`${f} at character ${e} of "${s}"`)}function n(){for(;Cf.test(s[e]);)e+=1}function r(){var f;let v=((f=s.slice(e).match(/^\d*(\.\d+)?([eE][+-]?\d+)?/))==null?void 0:f[0])||"";e+=v.length;let y=s[e];return y&&(sa.test(y)||y===".")&&i(`Unexpected character (${v+y})`),{type:5,value:parseFloat(v)}}function o(){let f=s[e];e+=1;let v=!1,y="";for(;e2&&M<=bl[I[I.length-2]];)y=I.pop(),v=I.pop(),f=I.pop(),$={type:1,operator:v,left:f,right:y},I.push($);$=u(),$||i(`Expected expression after ${P}`),I.push(P,$)}let A=I.length-1;for($=I[A];A>1;)$={type:1,operator:I[A-1],left:I[A-2],right:$},A-=2;return $}function g(){let f=d();if(n(),f&&s[e]==="?"){e+=1;let v=g();if(v||i("Expected expression"),n(),s[e]===":"){e++;let y=g();return y||i("Expected expression"),{type:3,test:f,consequent:v,alternate:y}}else i("Expected :")}else return f}let w=g();return eae(w,t,e)[0]);return i.some(w=>w===void 0)?yn:[i,void 0];case 1:let n=ae(s.left,t,e)[0],r=ae(s.right,t,e)[0];return"+-**/%".includes(s.operator)&&(n===void 0||r===void 0)?yn:[Ml[s.operator](n,r),void 0];case 2:let[o,a]=ae(s.callee,t,e),h=s.args.map(w=>ae(w,t,e)[0]);return h.some(w=>w===void 0)||typeof o!="function"?yn:[o.apply(a,h),void 0];case 3:let l=ae(s.consequent,t,e),c=ae(s.alternate,t,e);return ae(s.test,t,e)[0]?l:c;case 4:return[e[s.name]||t[s.name],void 0];case 5:return[s.value,void 0];case 6:let u=ae(s.object,t,e)[0],d=s.computed?ae(s.property,t,e)[0]:s.property.name;return u?[u[d],u]:[void 0,void 0];case 7:let g=ae(s.argument,t,e)[0];return g===void 0&&s.operator!=="!"?yn:[Cl[s.operator](g),void 0]}}function ct(s){let t=Vf(s);return t?(e={},i={})=>ae(t,e,i)[0]:(e={})=>{}}var If=/\${([^}]+)}/g;function xn(s,t=!1){let e=s.split(If),i=e.map((n,r)=>r%2?ct(n.replace(/×/g,"*")):void 0);return n=>e.map((r,o)=>{if(!(o%2))return r;let a=i[o](n);return!t&&typeof a=="number"&&a<0?`\u2013${-a}`:a}).join("")}var Ti="ontouchstart"in window,zs="onpointerdown"in window;function It(s){if(s.touches){let t=s.targetTouches.length?s.targetTouches:s.changedTouches;return new p(t[0].clientX,t[0].clientY)}else return new p(s.clientX||0,s.clientY||0)}function Lf(s){return s.touches||[]}function me(s,t){return It(s).transform(t.inverseTransformMatrix)}function Al(s,t){let e=It(s),i=t.bounds,n=(e.x-i.left)*t.canvasWidth/i.width,r=(e.y-i.top)*t.canvasHeight/i.height;return new p(n,r)}function Of(s){if(s instanceof PointerEvent&&s.pointerType==="mouse")return k(s.target);let t=It(s);return k(document.elementFromPoint(t.x,t.y)||void 0)}function Rf(s){if(s._data.tapEvent)return;s._data.tapEvent=!0;let t;s.on("pointerdown",e=>t=It(e)),s.on("pointerup",e=>{if(!t)return;let i=It(e);p.distance(t,i)<6&&s.trigger("tap",e),t=void 0}),s.on("pointercancel",()=>t=void 0)}function Df(s){s._data.clickOutsideEvent||(s._data.clickOutsideEvent=!0,C.on("pointerdown",t=>{let e=t.composedPath()[0]||t.target;!e||s._el===e||s._el.contains(e)||s.trigger("clickOutside",t)}))}function ds(s,t){let e=t.$box||s,i=It;e.type==="svg"?i=d=>me(d,e.$ownerSVG):e.type==="canvas"&&(i=d=>Al(d,e));let n=t.justInside?s:C,r,o,a=!1,h=0;s.css("touch-action")==="auto"&&s.css("touch-action","none"),s.addClass("noselect");function l(d){d.handled||Lf(d).length>1||(d.preventDefault(),a=!1,h=d.pointerId||0,n.on("pointermove",c),n.on("pointerstop",u),r=o=i(d),t.down&&t.down(r))}function c(d){if(!r||h&&d.pointerId!==h)return;d.preventDefault();let g=i(d);p.distance(g,o)<.5||(!a&&t.start&&t.start(r),t.move&&t.move(g,r,o),o=g,a=!0)}function u(d,g=!1){r&&(h&&d.pointerId!==h||(d.preventDefault(),n.off("pointermove",c),n.off("pointerstop",u),t.up&&t.up(o,r),a&&t.end&&t.end(o,r),!a&&t.click&&!g&&t.click(r),r=void 0))}C.onKey("Escape",()=>{if(!r)return;a&&t.move&&t.move(r,r,o),o=r;let d=document.createEvent("MouseEvent");d.pointerId=h,u(d,!0)}),s.on("pointerdown",l),t.justInside&&s.on("mouseleave",u),t.accessible&&(s.setAttr("tabindex","0"),document.addEventListener("keydown",d=>{if(![37,38,39,40].includes(d.keyCode)||s!==b.getActiveInput())return;let g=s.boxCenter,w=i({clientX:g.x,clientY:g.y}),f=d.keyCode===37?-25:d.keyCode===39?25:0,v=d.keyCode===38?-25:d.keyCode===40?25:0,y=w.shift(f,v);t.down&&t.down(w),t.start&&t.start(w),t.move&&t.move(y,w,w),t.end&&t.end(y,w)}))}function kl(s,t){let e=It;s.type==="svg"?e=n=>me(n,s.$ownerSVG):s.type==="canvas"&&(e=n=>Al(n,s));let i=!1;s.on("touchstart mouseenter",n=>{!i&&t.enter&&t.enter(),t.move&&t.move(e(n)),i=!0},{passive:!0}),s.on("pointermove",n=>{i&&t.move&&t.move(e(n))}),s.on("touchend mouseleave",()=>{i&&t.exit&&t.exit(),i=!1},{passive:!0})}function Nf(s){if(s._data.scrollEvents)return;s._data.scrollEvents=!0;let t=!1,e;function i(){let h=s.scrollTop;if(h===e){t=!1;return}e=h,s.trigger("scroll",{top:e}),window.requestAnimationFrame(i)}function n(){t||window.requestAnimationFrame(i),t=!0}(s.type==="window"?window:s._el).addEventListener("scroll",n);function o(){window.addEventListener("touchmove",n),window.addEventListener("touchend",a)}function a(){window.removeEventListener("touchmove",n),window.removeEventListener("touchend",a)}s._el.addEventListener("touchstart",function(h){h.handled||o()})}function Bs(s,t){let e=t.$clickTarget||s,i=0,n=!1,r=!1,o=!1;function a(){n||(t.enter&&t.enter(),n=!0)}function h(){n&&(clearTimeout(i),t.exit&&t.exit(),n=!1)}s.on("mouseover",()=>{t.preventMouseover&&t.preventMouseover()||(clearTimeout(i),i=Zt(()=>{a(),r=!0},t.delay))}),s.on("mouseout",()=>{r&&(clearTimeout(i),i=Zt(h,t.exitDelay||t.delay))}),e.on("focus",()=>{n||t.preventMouseover&&t.preventMouseover()||(clearTimeout(i),a(),o=!0)});let l=()=>{o&&(t.canFocusWithin?setTimeout(()=>{let c=b.getActiveInput();c&&c.hasParent(s)?c.one("blur",l):h()}):h())};e.on("blur",l),e.on("click",()=>{n&&!r?h():n||(a(),r=!1)}),s.on("clickOutside",h)}var ia;function Gf(s){for(let t of s){let e=t.isIntersecting?"enterViewport":"exitViewport";setTimeout(()=>k(t.target).trigger(e))}}function $l(s){if(!s._data.intersectionEvents){if(s._data.intersectionEvents=!0,!window.IntersectionObserver){let t=!1;C.on("scroll",()=>{let e=s.isInViewport;t&&!e?(s.trigger("exitViewport"),t=!1):e&&!t&&(s.trigger("enterViewport"),t=!0)});return}ia||(ia=new IntersectionObserver(Gf)),ia.observe(s._el)}}function zf(s,t=!1){if(t&&(s._data.resizeObserver&&s._data.resizeObserver.disconnect(),s._data.resizeObserver=void 0),!s._data.resizeObserver){if(window.ResizeObserver){let e=new window.ResizeObserver(()=>s.trigger("resize"));e.observe(s._el),s._data.resizeObserver=e}else if(window.MutationObserver){let e=new MutationObserver(()=>s.trigger("resize"));e.observe(s._el,{attributes:!0,childList:!0,characterData:!0,subtree:!0}),s._data.resizeObserver=e}}}function Pl(s){if(s._data.pointerPositionEvents)return;s._data.pointerPositionEvents=!0;let t=s.parent,e;t.on("pointerend",()=>e=void 0),t.on("pointermove",i=>{let n=e,r=Of(i);e=r.equals(s)||r.hasParent(s),n!==void 0&&e&&!n&&s.trigger("pointerenter",i),!e&&n&&s.trigger("pointerleave",i)})}function na(s,t){t._data[`_${s}`]||(t._data[`_${s}`]=!0,zs?t.on(s.replace("mouse","pointer"),e=>{e.pointerType==="mouse"&&t.trigger(s,e)}):Ti||t._el.addEventListener(s,e=>t.trigger(s,e)))}function Bf(s){s.on("keydown",t=>{if(t.metaKey||t.ctrlKey||b.isAndroid&&t.keyCode===229)return;let e=t.key||String.fromCharCode(t.which),i=!!t.shiftKey;s.trigger("key",{code:t.keyCode,key:e,char:e,shift:i})}),b.isAndroid&&s.type==="input"&&s.on("input",t=>{let e=t.key||t.data[t.data.length-1];s.trigger("key",{code:void 0,key:e,char:e}),s.value=""})}var $n={scrollwheel:"DOMMouseScroll mousewheel",pointerdown:zs?"pointerdown":Ti?"touchstart":"mousedown",pointermove:zs?"pointermove":Ti?"touchmove":"mousemove",pointerup:zs?"pointerup":Ti?"touchend":"mouseup",pointercancel:zs?"pointercancel":"touchcancel",pointerstop:zs?"pointerup pointercancel":Ti?"touchend touchcancel":"mouseup"},Pn={scroll:Nf,tap:Rf,clickOutside:Df,key:Bf,mousedown:na.bind(void 0,"mousedown"),mousemove:na.bind(void 0,"mousemove"),mouseup:na.bind(void 0,"mouseup"),pointerenter:Pl,pointerleave:Pl,enterViewport:$l,exitViewport:$l,resize:zf};function _f(s,t,e,i){if(t in Pn)Pn[t](s,!1);else if(t in $n){let n=K($n[t]);for(let r of n)s._el.addEventListener(r,e,i)}else s._el.addEventListener(t,e,i)}function Ff(s,t,e){if(t in Pn)(!s._events[t]||!s._events[t].length)&&Pn[t](s,!0);else if(e&&t in $n){let i=K($n[t]);for(let n of i)s._el.removeEventListener(n,e)}else e&&s._el.removeEventListener(t,e)}var bn=0,ra=new Map;function Tl(s,t){ra.set(s,t)}function qf(s){if(bn++,s(),bn--,bn===0){for(let[t,e]of ra.entries())t(e);ra.clear()}}function le(s,t){let e=new Map,i=new Map,n=new Set,r,o=0;function a(M){r=M;let P=M(A,!0);return r=void 0,P}function h(M){for(let P of e.values())P.has(M)&&P.delete(M);n.delete(M)}function l(M,P){return n.add(M),P?void 0:M(A,!0)}function c(M,P){i.has(M)&&h(i.get(M));let j=()=>{s[M]=P(A),r===j&&(r=void 0),u(M)};i.set(M,j),a(j)}function u(M){if(bn>0){for(let P of e.get(M)||[])Tl(P,s);for(let P of n)Tl(P,s)}else{for(let P of e.get(M)||[])P(s);for(let P of n)P(s)}}function d(){for(let M of e.values())for(let P of M)P(s);for(let M of n)M(s)}function g(M,P){P&&(s={}),qf(()=>{for(let[j,ne]of Object.entries(M))j in y||(y[j]=s[j]),A[j]=ne})}function w(){for(o+=1;`_x${o}`in s;)o+=1;return`_x${o}`}function f(){s={},e.clear(),i.clear(),o=0}function v(){return Object.assign({},s)}let y={};function $(){let M=[{},{}];for(let P of Object.keys(y))y[P]!==s[P]&&(M[0][P]=y[P],M[1][P]=s[P]);return y={},M}function I(M){t&&t.watch(()=>A[M]=t[M])}let A=new Proxy(s,{get(M,P){return P==="watch"?a:P==="unwatch"?h:P==="watchAll"?l:P==="setComputed"?c:P==="forceUpdate"?d:P==="getChanges"?$:P==="assign"?g:P==="getKey"?w:P==="clear"?f:P==="copy"?v:P==="_internal"?[s,e]:(r&&(e.has(P)||e.set(P,new Set),e.get(P).add(r)),P in s||I(P),s[P])},set(M,P,j){return s[P]===j||(P in y||(y[P]=s[P]),s[P]=j,i.has(P)&&(h(i.get(P)),i.delete(P)),u(P)),!0},deleteProperty(M,P){return delete s[P],e.delete(P),i.delete(P),!0}});return A}var Hf={A:7,C:6,H:1,L:2,M:2,Q:4,S:4,T:2,V:1,Z:0},jf=/[astvzqmhlc]([^astvzqmhlc]*)/ig,Uf=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function Sn(s){let t=[],e;for(let i of s.match(jf)||[]){let n=i[0].toUpperCase();if(n==="Z"){t.push({type:"Z",points:[]});continue}let r=(i.slice(1).match(Uf)||[]).map(a=>+a),o=n===i[0];for(let[a,h]of Vo(r,Hf[n]).entries()){let l=[],c=n==="M"&&a>0?"L":n,u;n==="H"?(c="L",l=[new p(h[0],o&&(e==null?void 0:e.y)||0)]):n==="V"?(c="L",l=[new p(o&&(e==null?void 0:e.x)||0,h[0])]):n==="A"?(c="A",l=[new p(h[5],h[6])],u=h.slice(0,5)):"MLCSQT".includes(n)&&(l=Vo(h,2).map(d=>new p(d[0],d[1]))),!o&&e&&(l=l.map(d=>d.translate(e))),e=O(l),t.push({type:c,points:l,options:u})}}return t}function oa(s){return s?Sn(s).map(e=>O(e.points)).filter(e=>!!e):[]}var Wf=["font-family","font-size","font-style","font-weight","letter-spacing","text-decoration","color","display","visibility","alignment-baseline","baseline-shift","opacity","text-anchor","clip","clip-path","clip-rule","mask","filter","transform","transform-origin","white-space","line-height"],Kf=["fill","fill-rule","marker","marker-start","marker-mid","marker-end","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-width","text-rendering","dominant-baseline","transform-box","paint-order"],Xf=["padding","min-width","max-width","height","border-width","border-style","border-color","box-sizing","background","width","grid-template-columns","text-align"],Yf=["class","tabindex","contenteditable"],Zf=new Set(["opacity","transform-box","transform-origin","border-width","border-style","border-color"]),Qf={"font-style":"normal","font-weight":"400","letter-spacing":"normal","text-decoration":"none",display:"block",visibility:"visible","alignment-baseline":"auto","baseline-shift":"0px","text-anchor":"start",clip:"auto","clip-path":"none","clip-rule":"nonzero",mask:"none",opacity:"1",filter:"none",fill:"rgb(0, 0, 0)","fill-rule":"nonzero",marker:"none",stroke:"none","stroke-dasharray":"none","stroke-dashoffset":"0px","stroke-linecap":"butt","stroke-linejoin":"miter","stroke-width":"1px","text-rendering":"auto",transform:"none","dominant-baseline":"auto","transform-origin":"0px 0px","transform-box":"view-box","paint-order":"normal"};function Vl(s){var t,e;if(s.getAttribute("hidden")||s.style.opacity==="0"||s.style.display==="none")(t=s.parentNode)==null||t.removeChild(s);else{for(let i of Array.from(s.children))Vl(i);if(s.tagName==="g"&&s.childElementCount===0)(e=s.parentNode)==null||e.removeChild(s);else for(let i of Yf)s.hasAttribute(i)&&s.removeAttribute(i)}}function Jf(s,t){let e=s.parentElement;for(;e;){let i=e.style.getPropertyValue(t);if(i)return i;e=e.parentElement}}function Il(s,t,e=!1){let i=window.getComputedStyle(s);t.removeAttribute("style");let n=e||s.tagName==="foreignObject",r=[...Wf,...n?Xf:Kf];for(let h of r){let l=i.getPropertyValue(h),c=Jf(t,h);l===Qf[h]&&!c||!Zf.has(h)&&l===c||t.style.setProperty(h,l)}let o=s.children,a=t.children;for(let h=0;hi.textContent=n(s)||"")}}else t&&i.bindModel(s)}}bindVariable(s,t){}toggleDOM(s=!0){s!==!!this._el.parentNode&&(this.$placeholder||(this.$placeholder=k(document.createComment("")),this.insertBefore(this.$placeholder)),s?this.$placeholder.insertBefore(this):this.detach())}makeDynamicAttribute(s,t,e){if(s.startsWith("@")){let i=s.slice(1),n=ct(t);this.on(i,r=>n(e,{$event:r}))}else if(s===":show"){let i=ct(t);e.watch(()=>this.toggle(!!i(e)))}else if(s===":if"){let i=ct(t);e.watch(()=>this.toggleDOM(!!i(e)))}else if(s===":html"){let i=ct(t);e.watch(()=>this.html=i(e)||"")}else if(s===":draw"){let i=ct(t);e.watch(()=>this.draw(i(e)))}else if(s===":class"){let i=ct(t),n=`${this.attr("class")} `;e.watch(()=>this.setAttr("class",n+i(e)))}else if(s===":bind")this.bindVariable(e,t);else if(s.startsWith(":")){let i=ct(t),n=s.slice(1);e.watch(()=>this.setAttr(n,i(e)))}else if(t.includes("${")){let i=xn(t,!0);e.watch(()=>this.setAttr(s,i(e)||""))}(s.startsWith("@")||s.startsWith(":"))&&this.removeAttr(s)}makeDynamicList(s){let[t,e]=this.attr(":for").split(" in ");this.removeAttr(":for");let i=ct(e),n=k(document.createComment(""));this.insertBefore(n),this.detach();let r=[],o=0;s.watch(()=>{let a=i(s);Array.isArray(a)||(a=[]);for(let h=a.length;h{let o=i+n*yt(e,r);this.scrollTop=o,this.trigger("scroll",{top:o})},t)}scrollBy(s,t=1e3,e="cubic"){s&&this.scrollTo(this.scrollTop+s,t,e)}css(s,t){if(t===void 0){if(typeof s=="string")return window.getComputedStyle(this._el).getPropertyValue(s);{let e=Object.keys(s);for(let i of e)this._el.style.setProperty(i,`${s[i]}`)}}else typeof s=="string"&&this._el.style.setProperty(s,`${t}`)}get transform(){return this.css("transform").replace("none","")}get transformMatrix(){let s=this.transform;if(!s)return[[1,0,0],[0,1,0]];let t=s.match(/matrix\(([0-9,.\s-]*)\)/);if(!t||!t[1])return[[1,0,0],[0,1,0]];let e=t[1].split(",");return[[+e[0],+e[2],+e[4]],[+e[1],+e[3],+e[5]]]}get scale(){let s=this.transformMatrix;return[s[0][0],s[1][1]]}setTransform(s,t=0,e=1){let i="";s&&(i+=`translate(${Pt(s.x,.1)}px,${Pt(s.y,.1)}px)`),t&&(i+=` rotate(${t}rad)`),e&&(i+=` scale(${e})`),this._el.style.transform=i}translate(s,t){this.setTransform(new p(s,t))}show(){this.hasAttr("hidden")&&this.removeAttr("hidden"),this.data.display==="visibility"?this._el.style.visibility="visible":this._el.style.display=this.data.display||"block"}hide(){this.data.display==="visibility"?this._el.style.visibility="hidden":this._el.style.display="none"}toggle(s){s?this.show():this.hide()}is(s){return this._el.matches?this._el.matches(s):Array.from(document.querySelectorAll(s)).includes(this._el)}index(){let s=0,t=this._el;for(;(t=t.previousSibling||void 0)!==void 0;)++s;return s}prepend(s){let t=this._el.childNodes;t.length?this._el.insertBefore(s._el,t[0]):this._el.appendChild(s._el)}append(s){this._el.appendChild(s instanceof Text?s:s._el)}insertBefore(s){this.parent._el.insertBefore(s._el,this._el)}insertAfter(s){let t=this._el.nextSibling;t?this.parent._el.insertBefore(s._el,t):this.parent._el.appendChild(s._el)}get next(){return k(this._el.nextSibling)}get prev(){return k(this._el.previousSibling)}$(s){return k(s,this)}$$(s){return Te(s,this)}get parent(){return k(this._el.parentElement||void 0)}parents(s){let t=[],e=this.parent;for(;e;)(!s||e.is(s))&&t.push(e),e=e.parent;return t}hasParent(...s){let t=s.map(i=>i._el),e=this._el.parentNode;for(;e;){if(_(e,...t))return!0;e=e.parentNode}return!1}get children(){return Array.from(this._el.children||[],s=>k(s))}get childNodes(){return Array.from(this._el.childNodes,s=>{if(!(s instanceof Comment))return s instanceof Text?s:k(s)}).filter(s=>s)}restartAnimation(){let s=this.next,t=this.parent;this.detach(),s?s.insertBefore(this):t.append(this)}detach(){this._el&&this._el.parentNode&&this._el.parentNode.removeChild(this._el)}remove(){this.detach()}removeChildren(){for(;this._el.firstChild;)this._el.removeChild(this._el.firstChild)}copy(s=!0){return k(this._el.cloneNode(s))}on(s,t,e){for(let i of K(s))i in this._events?this._events[i].includes(t)||this._events[i].push(t):this._events[i]=[t],_f(this,i,t,e)}one(s,t,e){let i=n=>{this.off(s,i),t(n)};this.on(s,i,e)}off(s,t){for(let e of K(s))e in this._events&&(this._events[e]=t?this._events[e].filter(i=>i!==t):[]),Ff(this,e,t)}trigger(s,t={}){for(let e of K(s)){if(!this._events[e])return;for(let i of this._events[e])i.call(this,t)}}onKey(s,t,e){s=s.replace("AllArrows","ArrowUp ArrowDown ArrowLeft ArrowRight");let i=new Set(K(s)),n=e!=null&&e.up?"keyup":"keydown";(this._el===document.body?document:this._el).addEventListener(n,o=>{var a,h;let l=Ei(o);(e!=null&&e.meta?!o.ctrlKey&&!o.metaKey:o.ctrlKey||o.metaKey)||!l||!i.has(l)||document.activeElement!==this._el&&((h=(a=document.activeElement)==null?void 0:a.shadowRoot)==null?void 0:h.activeElement)!==this._el&&b.formIsActive||t(o,l)})}onAttr(s,t){new MutationObserver(i=>{for(let n of i)n.type==="attributes"&&n.attributeName===s&&t(this.attr(s))}).observe(this._el,{attributes:!0}),t(this.attr(s),!0)}onPromise(s,t=!1){return t?Promise.resolve():new Promise(e=>this.one(s,()=>e()))}animate(s,t=400,e=0,i="ease-in-out"){return Ht(this,s,t,e,i)}enter(s="fade",t=500,e=0){return Ef(this,s,t,e)}exit(s="fade",t=500,e=0,i=!1){return Mf(this,s,t,e,i)}effect(s){this.one("animationend",()=>this.removeClass(`effects-${s}`)),this.addClass(`effects-${s}`)}},us=class extends Ll{get offsetTop(){return this._el.offsetTop}get offsetLeft(){return this._el.offsetLeft}get offsetParent(){return k(this._el.offsetParent||void 0)}get width(){return this._el.offsetWidth}get height(){return this._el.offsetHeight}get innerWidth(){let s=parseFloat(this.css("padding-left")),t=parseFloat(this.css("padding-right"));return this._el.clientWidth-s-t}get innerHeight(){let s=parseFloat(this.css("padding-bottom")),t=parseFloat(this.css("padding-top"));return this._el.clientHeight-s-t}get outerWidth(){let s=parseFloat(this.css("margin-left")),t=parseFloat(this.css("margin-right"));return this.width+s+t||0}get outerHeight(){let s=parseFloat(this.css("margin-bottom")),t=parseFloat(this.css("margin-top"));return this.height+s+t||0}get positionTop(){let s=this._el,t=0;for(;s;)t+=s.offsetTop,s=s.offsetParent;return t}get positionLeft(){let s=this._el,t=0;for(;s;)t+=s.offsetLeft,s=s.offsetParent;return t}offset(s){if(s._el===this._el.offsetParent){let t=this.offsetTop+s._el.clientTop,e=this.offsetLeft+s._el.clientLeft,i=t+this.height,n=e+this.width;return{top:t,left:e,bottom:i,right:n}}else{let t=s._el.getBoundingClientRect(),e=this._el.getBoundingClientRect();return{top:e.top-t.top,left:e.left-t.left,bottom:e.bottom-t.top,right:e.right-t.left}}}},Ol=class extends Ll{constructor(){super(...arguments),this.type="svg"}get $ownerSVG(){return k(this._el.ownerSVGElement||void 0)}get width(){return this.bounds.width}get height(){return this.bounds.height}get positionLeft(){let s=this._el.getBBox().x+this._el.getCTM().e;return this.$ownerSVG.positionLeft+s}get positionTop(){let s=this._el.getBBox().y+this._el.getCTM().f;return this.$ownerSVG.positionTop+s}get inverseTransformMatrix(){let s=this._el.getScreenCTM().inverse(),t=[[s.a,s.c,s.e],[s.b,s.d,s.f]];if(b.isFirefox){let e=this.transformMatrix;t[0][2]-=e[0][2],t[1][2]-=e[1][2]}return t}setTransform(s,t=0,e=1){let i=s?`translate(${Pt(s.x,.1)} ${Pt(s.y,.1)})`:"",n=x(t,0)?"":`rotate(${t*180/Math.PI})`,r=x(e,1)?"":`scale(${e})`;this.setAttr("transform",[i,n,r].join(" "))}get strokeLength(){if(this._el instanceof SVGGeometryElement)return this._el.getTotalLength();{let s=this.bounds;return 2*s.height+2*s.width}}getPointAtLength(s){if(this._el instanceof SVGGeometryElement){let t=this._el.getPointAtLength(s);return new p(t.x,t.y)}else return new p(0,0)}getPointAt(s){return this.getPointAtLength(s*this.strokeLength)}get points(){return oa(this.attr("d"))}set points(s){let t=s.length?`M${s.map(e=>`${e.x},${e.y}`).join("L")}`:"";this.setAttr("d",t)}addPoint(s){let t=`${this.attr("d")} L ${s.x},${s.y}`;this.setAttr("d",t)}get center(){let s=+this.attr(this.tagName==="TEXT"?"x":"cx"),t=+this.attr(this.tagName==="TEXT"?"y":"cy");return new p(s,t)}setCenter(s){this.setAttr(this.tagName==="TEXT"?"x":"cx",s.x),this.setAttr(this.tagName==="TEXT"?"y":"cy",s.y)}setLine(s,t){this.setAttr("x1",s.x),this.setAttr("y1",s.y),this.setAttr("x2",t.x),this.setAttr("y2",t.y)}setRect(s){this.setAttr("x",s.p.x),this.setAttr("y",s.p.y),this.setAttr("width",s.w),this.setAttr("height",s.h)}draw(s,t={}){if(!s)return this.setAttr("d","");let e={};for(let i of["mark","arrows","round"])this.hasAttr(i)&&(e[i]=this.attr(i));this.hasClass("fill")&&(e.fill="fill"),this.hasAttr("size")&&(e.size=+this.attr("size")||void 0),this.setAttr("d",De(s,Object.assign(t,e)))}},tm=class extends Ol{get viewBox(){return this._el.viewBox.baseVal||{width:0,height:0}}get $ownerSVG(){return this}get positionLeft(){return parseInt(this.css("margin-left"))+this.parent.positionLeft}get positionTop(){return parseInt(this.css("margin-top"))+this.parent.positionTop}get svgWidth(){return this.viewBox.width||this.width}get svgHeight(){return this.viewBox.height||this.height}drawPath(s,t={},e={}){let i=m("path",t,this);return i.draw(s,e),i}image(s,t,e,i){return he(this,null,function*(){let n=this.copy(!0);Il(this._el,n._el),s==="svg"&&Vl(n._el),e||(e=t||this.svgHeight),t||(t=this.svgWidth),n.setAttr("width",t),n.setAttr("height",e),n.setAttr("viewBox",i||this.attr("viewBox")||`0 0 ${this.svgWidth} ${this.svgHeight}`),n.setAttr("xmlns","http://www.w3.org/2000/svg");let r=n.$$("image");if(s==="svg")for(let c of r)c.setAttr("href",new URL(c.attr("href"),location.href));else yield Promise.all(r.map(c=>he(this,null,function*(){c.setAttr("href",yield om(c.attr("href")))})));let o=new XMLSerializer().serializeToString(n._el),a=`data:image/svg+xml;utf8,${encodeURIComponent(o)}`;if(s==="svg")return a;let h=m("canvas",{width:t,height:e});s==="jpg"&&(h.ctx.fillStyle="white",h.ctx.fillRect(0,0,t,e));let l=yield Gl(a);return h.ctx.drawImage(l,0,0,t,e),h.image(s)})}downloadImage(s,t,e,i){let n=b.isIOS?window.open("","_blank"):void 0,r=b.theme.isDark;r&&b.setTheme("light");let o=s.endsWith(".jpg")?"jpg":s.endsWith(".svg")?"svg":"png",a=this.image(o,t,e,i);r&&b.setTheme("dark"),a.then(h=>{if(n)return n.location.href=h;m("a",{download:s,href:h,target:"_blank"})._el.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0}))})}},Rl=class extends us{constructor(){super(...arguments),this.type="window"}get width(){return window.innerWidth}get height(){return window.innerHeight}get innerWidth(){return window.innerWidth}get innerHeight(){return window.innerHeight}get outerWidth(){return window.outerWidth}get outerHeight(){return window.outerHeight}get scrollWidth(){return document.body.scrollWidth}get scrollHeight(){return document.body.scrollHeight}get scrollTop(){return window.pageYOffset}set scrollTop(s){document.body.scrollTop=document.documentElement.scrollTop=s,this.trigger("scroll",{top:s,left:this.scrollLeft})}get scrollLeft(){return window.pageXOffset}set scrollLeft(s){document.body.scrollLeft=document.documentElement.scrollLeft=s,this.trigger("scroll",{top:this.scrollTop,left:s})}},em=class extends us{constructor(){super(...arguments),this.type="form"}get action(){return this._el.action}get formData(){let s={};for(let t of Array.from(this._el.elements)){let e=t.name||t.id;e&&(s[e]=t.value)}return s}get isValid(){return this._el.checkValidity()}},sm=class extends us{constructor(){super(...arguments),this.type="input"}get checked(){return this._el.checked||!1}set checked(s){this._el.checked=s}get value(){return this._el.value}set value(s){this._el.value=s}bindVariable(s,t){if(this._el.type==="checkbox"){let e=t.startsWith("!"),i=n=>e?!n:n;e&&(t=t.slice(1)),s[t]!==void 0?this.checked=i(s[t]):this.hasAttr("checked")&&(s[t]=i(this.checked)),this.on("change",()=>s[t]=i(this.checked)),s.watch(()=>this.checked=i(s[t]));return}if(this._el.type==="number"){let e=this.hasAttr("min")?+this.attr("min"):-1/0,i=this.hasAttr("max")?+this.attr("max"):1/0;this.change(n=>{n&&(s[t]=B(+n,e,i))})}else this.change(e=>s[t]=e);s[t]!==void 0?this.value=s[t]:this.value&&(s[t]=this.value),this.on("blur",()=>this.value=s[t]),s.watch(()=>{document.activeElement!==this._el&&(this.value=s[t])})}setInputPattern(s){if(isNaN(+s))return;let t=s.match(/^[0-9]+$/);this.setAttr("inputmode",t?"numeric":"decimal"),t&&this.setAttr("pattern","[0-9]*")}change(s){let t=this.value||"";this.on("focus",()=>t=this.value),this.on("change keyup input paste",()=>{this.value!==t&&(t=this.value,s(t))})}validate(s){this.change(t=>this.setValidity(s(t)))}setValidity(s){this._el.setCustomValidity(s)}get isValid(){return this._el.checkValidity()}},im=class extends us{constructor(){super(...arguments),this.type="canvas"}getContext(s="2d",t={}){return this._el.getContext(s,t)}image(s="png"){return this._el.toDataURL(s==="png"?"image/png":"image/jpeg")}get canvasWidth(){return this._el.width}get canvasHeight(){return this._el.height}get ctx(){return this._ctx||(this._ctx=this.getContext()),this._ctx}draw(s,t={}){this.ctx.save(),Jo(this.ctx,s,t),this.ctx.restore()}clear(){this.ctx.clearRect(0,0,this.canvasWidth,this.canvasHeight)}fill(s){this.ctx.save(),this.ctx.fillStyle=s,this.ctx.fillRect(0,0,this.canvasWidth,this.canvasHeight),this.ctx.restore()}clearCircle(s,t){this.ctx.save(),this.ctx.globalCompositeOperation="destination-out",this.ctx.beginPath(),this.ctx.arc(s.x,s.y,t,0,2*Math.PI,!1),this.ctx.fill(),this.ctx.restore()}downloadImage(s){let t=this.image(s.endsWith(".jpg")?"jpg":"png");m("a",{download:s,href:t,target:"_blank"})._el.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0}))}},nm=class extends us{play(){return this._el.play()||Promise.resolve()}pause(){return this._el.pause()}},Dl=["path","rect","circle","ellipse","polygon","polyline","g","defs","marker","line","text","tspan","pattern","mask","svg","foreignObject","image","use","clipPath"];function k(s,t){if(!s)return;let e=t?t._el:document.documentElement,i=typeof s=="string"?e.querySelector(s):s;if(!i)return;if(i._view)return i._view;let n=(i.tagName||"").toLowerCase();return n==="svg"?new tm(i):n==="canvas"?new im(i):n==="form"?new em(i):n==="input"||n==="select"||n==="textarea"?new sm(i):n==="video"||n==="audio"?new nm(i):Dl.includes(n)?new Ol(i):new us(i)}function Te(s,t){let e=t?t._el:document.documentElement,i=s?e.querySelectorAll(s):[];return Array.from(i,n=>k(n))}function m(s,t={},e){let i=Dl.includes(s)?document.createElementNS("http://www.w3.org/2000/svg",s):document.createElement(s);for(let[r,o]of Object.entries(t))o!==void 0&&(r==="id"?i.id=o:r==="html"?i.innerHTML=o:r==="text"?i.textContent=o:r==="path"?i.setAttribute("d",De(o)):i.setAttribute(r,o));let n=k(i);return e&&e.append(n),n}var C=new Rl(document.body),Xt=new Rl(document.documentElement);function rm(s){let t=[];for(let e of Object.keys(s)){let i=s[e];if(e=encodeURIComponent(e),i==null){t.push(e);continue}i=Array.isArray(i)?i.join(","):`${i}`,i=i.replace(/(\r)?\n/g,`\r +`),i=encodeURIComponent(i),i=i.replace(/%20/g,"+"),t.push(`${e}=${i}`)}return t.join("&")}function Nl(s){s=s.replace(/^[?,&]/,"");let t=decodeURIComponent(s).split("&"),e={};return t.forEach(i=>{let n=i.split("=");e[n[0]]=n[1]}),e}function Ne(s,t){return he(this,null,function*(){let e=t instanceof FormData,i={method:"POST",body:e?t:t?rm(t):void 0,headers:{"X-CSRF-Token":window.csrfToken||""}};e||(i.headers["Content-Type"]="application/x-www-form-urlencoded");let n=s.includes("?")?"&xhr=1":"?xhr=1",r=yield fetch(s+n,i);if(!r.ok)throw new Error(`Fetch error ${r.status}: ${s}`);return r.text()})}function Gl(s,t=!1){return new Promise(e=>{let i=new Image;t||(i.crossOrigin="Anonymous"),i.onload=()=>e(i),i.src=s})}var om=Oe(s=>he(void 0,null,function*(){let t=yield Gl(s),e=m("canvas",{width:t.width,height:t.height});return e.ctx.drawImage(t,0,0,t.width,t.height),e.image("png")})),Si=new Map;function zl(s,t){Si.has(s)?Ao(Si.get(s),t,(e,i)=>Wt(e.concat(i))):Si.set(s,t)}function Bl(){if(window.navigator.onLine)for(let[s,t]of Si)Si.delete(s),Ne(s,{data:JSON.stringify(t)}).catch(e=>{console.error("Failed to send POST request:",e),zl(s,t)})}var _l=ve(Bl,5e3);window.addEventListener("online",_l);window.onbeforeunload=Bl;function Fl(s,t){zl(s,t),_l()}var ee=class{constructor(s,t=1,e=!0){this.src=s,this.defaultVolume=t,this.player=new Audio,this.player.src=s,e&&(this.player.preload="auto")}play(s){this.player.currentTime=0,this.player.volume=s||this.defaultVolume,this.player.play()}},am=os(["#cd0e66","#0f82f2","#22ab24","#fd8c00"]),hm=class{constructor(s){this.index=s,this.color=am(),this.tilt=Math.floor(Math.random()*10)-10,this.tiltAngleIncrement=Math.random()*.07+.05,this.tiltAngle=0,this.x=Math.random()*b.width,this.y=(Math.random()-1)*b.height,this.r=_t.uniform(10,30)}draw(s){s.beginPath(),s.lineWidth=this.r/2,s.strokeStyle=this.color,s.moveTo(this.x+this.tilt+this.r/4,this.y),s.lineTo(this.x+this.tilt,this.y+this.tilt+this.r/4),s.stroke()}update(s,t){this.tiltAngle+=this.tiltAngleIncrement,this.y+=(Math.cos(s)+3+this.r/2)/2,this.x+=Math.sin(s),this.tilt=Math.sin(this.tiltAngle-this.index/3)*15,this.x<-20?(this.x=-20,this.y=Math.random()*b.height,this.tilt=Math.floor(Math.random()*10)-20):this.x>b.width+20?(this.x=b.width+20,this.y=Math.random()*b.height,this.tilt=Math.floor(Math.random()*10)-20):t&&this.y>b.height&&(this.x=Math.random()*b.width,this.y=-10,this.tilt=Math.floor(Math.random()*10)-20)}},lm="position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 9999",cs=void 0;function Mi(s=2e3,t=150){cs||(cs=m("canvas",{style:lm},C)),cs.setAttr("width",b.width),cs.setAttr("height",b.height),cs.show();let e=cs.ctx,i=z(r=>new hm(r),t),n=pt(r=>{e.clearRect(0,0,b.width,b.height);let o=rthis.updateBounds()),ds(s,{start:()=>{this.disabled||(this.startPos=this.position,this.trigger("start"),Xt.addClass("grabbing"))},move:(e,i)=>{this.disabled||(this.setPosition(this.startPos.x+e.x-i.x,this.startPos.y+e.y-i.y),this.trigger("drag",{posn:this.position,pointerPosn:e}),this.checkTarget(e))},end:(e,i)=>{this.disabled||(this.trigger(e.equals(i)?"click":"end",{$target:this.$over}),this.options.$targets&&!this.$over&&this.options.resetOnMiss&&this.resetPosition(),this.$over=void 0,Xt.removeClass("grabbing"))},click:()=>this.trigger("click"),accessible:!0})}addTarget(s){var t;this.options.$targets||(this.options.$targets=[]),(t=this.options.$targets)==null||t.push(s)}removeTarget(s){var t,e;this.options.$targets=(t=this.options.$targets)==null?void 0:t.filter(i=>i!==s),(e=this.options.$targets)!=null&&e.length||(this.options.$targets=void 0)}checkTarget(s){if(!this.options.$targets)return;let t=this.options.$targets.find(e=>e.boundsRect.contains(s));t!==this.$over&&(this.$over&&this.trigger("exit-target",{$target:this.$over}),t&&this.trigger("enter-target",{$target:t}),this.$over=t)}updateBounds(){if(!this.options.withinBounds)return this.bounds=void 0;if(this.options.bounds)return this.bounds=this.options.bounds;let s=this.bounds,t=this.options.$parent||this.$el.parent,e=t.type==="svg"?t.svgWidth:t.width,i=t.type==="svg"?t.svgHeight:t.height;this.bounds=new lt(0,e,0,i),!e&&!i&&setTimeout(()=>this.updateBounds()),s&&this.setPosition(this.position.x*this.bounds.dx/s.dx||0,this.position.y*this.bounds.dy/s.dy||0)}setPosition(s,t){var e;let i=new p(this.options.moveX?s:0,this.options.moveY?t:0);this.bounds&&(i=i.clamp(this.bounds,(e=this.options.margin)!=null?e:0)),i=i.round(this.options.snap||1),this.options.round&&(i=this.options.round(i)),!i.equals(this.position)&&(this.position=i,this.options.useTransform?this.$el.translate(i.x,i.y):(this.options.moveX&&this.$el.css("left",`${i.x}px`),this.options.moveY&&this.$el.css("top",`${i.y}px`)),this.trigger("move",{posn:i}))}resetPosition(s=250){return he(this,null,function*(){let t=this.position;this.$el.css({"pointer-events":"none"}),yield pt(e=>{let i=p.interpolate(t,this.startPos,e);this.setPosition(i.x,i.y)},s).promise,this.$el.css({"pointer-events":"initial"})})}},cm="position: fixed; top: 0; left: 0; width: 100%; height: 4px; background: #0f82f2; pointer-events: none; z-index: 9999; will-change: transform;";function Sl(s,t){let e=t.regex.exec(s);if(e){e.shift();let i={};for(let[n,r]of t.params.entries())i[r]=e[n];return i}else return}function pm(s,t,e){return he(this,null,function*(){return s.template?typeof s.template=="string"?s.template:s.template(t):(yield fetch(e+(e.indexOf("?")>=0?"&xhr=1":"?xhr=1"))).text()})}var ql=document.readyState==="complete";window.addEventListener("load",()=>setTimeout(()=>ql=!0));"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual");var dm=class extends Re{constructor(){super(...arguments),this.$viewport=C,this.views=[],this.active={path:"",hash:""},this.preloaded=!1,this.transition=!1,this.noLoad=!1,this.initialise=()=>{}}setup(s={}){s.$viewport&&(this.$viewport=s.$viewport),s.initialise&&(this.initialise=s.initialise),s.preloaded&&(this.preloaded=s.preloaded),s.transition&&(this.transition=s.transition),s.noLoad&&(this.noLoad=s.noLoad),s.click&&C.on("click",t=>this.onLinkClick(t)),s.history&&window.addEventListener("popstate",t=>he(this,null,function*(){var e;if(!ql||!((e=t.state)!=null&&e.path))return;(yield this.load(t.state.path,t.state.hash))||window.history.pushState(this.active,"",this.active.path+this.active.hash)}))}view(s,{enter:t,exit:e,template:i}={}){let n=(s.match(/:\w+/g)||[]).map(u=>u.substr(1)),r=`${s.replace(/:\w+/g,"([\\w-]+)").replace("/","\\/")}\\/?`,o=s.includes("?")?"":"(\\?.*)?",h={regex:new RegExp(`^${r}${o}$`,"i"),params:n,enter:t,exit:e,template:i};this.views.push(h);let l=window.location.pathname+window.location.search,c=Sl(l,h);c&&(this.active={path:l,hash:window.location.hash},window.history.replaceState(this.active,"",this.active.path+this.active.hash),b.ready(()=>{setTimeout(()=>{this.preloaded?(this.initialise(this.$viewport,c),h.enter&&h.enter(this.$viewport,c)):this.loadView(h,c)})}))}paths(...s){for(let t of s)this.view(t)}getView(s){for(let t of this.views){let e=Sl(s,t);if(e)return{view:t,params:e}}}load(s,t){return he(this,null,function*(){if(s===this.active.path&&t!==this.active.hash)return this.trigger("hashChange",t.slice(1)),this.trigger("change",s+t),this.active={path:s,hash:t},!0;let e=this.getView(s);return!e||this.beforeChange&&!(yield this.beforeChange())?!1:(this.active={path:s,hash:t},this.trigger("change",s+t),window.ga&&window.ga("send","pageview",s+t),this.noLoad?e.view.enter&&e.view.enter(this.$viewport,e.params):this.loadView(e.view,e.params),!0)})}loadView(s){return he(this,arguments,function*(t,e={}){this.showLoadingBar();let i=this.active.path,n=yield pm(t,e,i);if(this.active.path!==i)return;yield this.$viewport.animate({opacity:0},200).promise,this.$viewport.removeChildren(),C.scrollTop=0,this.$viewport.html=n,b.resize(),xf(),this.$viewport.animate({opacity:1},200),this.hideLoadingBar();let r=this.$viewport.$("title");r&&(document.title=r.text),this.initialise(this.$viewport,e),t.enter&&t.enter(this.$viewport,e),this.trigger("afterChange",{$viewport:this.$viewport})})}onLinkClick(s){if(s.metaKey||s.ctrlKey||s.shiftKey||s.defaultPrevented)return;let t=s.target;for(;t&&t.nodeName!=="A";)t=t.parentNode;if(!t||t.nodeName!=="A")return;let e=t;if(e.target||e.origin!==window.location.origin||e.hasAttribute("download")||e.getAttribute("rel")==="external")return;let i=e.getAttribute("href");i&&i.indexOf("mailto:")>-1||this.getView(e.pathname+e.search)&&(s.preventDefault(),this.goTo(e.pathname+e.search,e.hash))}goTo(s,t=""){return he(this,null,function*(){let e=this.active.path+this.active.hash;(yield this.load(s,t))&&e!==this.active.path+this.active.hash&&window.history.pushState(this.active,"",s+t)})}replace(s,t=""){this.active={path:s,hash:t},window.history.replaceState(this.active,"",s+t)}back(){window.history.back()}forward(){window.history.forward()}showLoadingBar(){this.$loadingBar||(this.$loadingBar=m("div",{style:cm},C)),this.$loadingBar.css({transform:"translateX(-100%)",opacity:1}),this.$loadingBar.show(),this.animation=pt(s=>{this.$loadingBar.css("transform",`translateX(-${10+90*Math.exp(-4*s)}%)`)},3e3)}hideLoadingBar(){return he(this,null,function*(){var s,t,e;(s=this.animation)==null||s.cancel(),yield(t=this.$loadingBar)==null?void 0:t.animate({transform:"none",opacity:0}).promise,(e=this.$loadingBar)==null||e.hide()})}},Ci=new dm;function um(s,t){let e=Array.from(s.childNodes);s.innerHTML=t;let i={};for(let n of Array.from(s.querySelectorAll("slot")))i[n.getAttribute("name")||""]=n;for(let n of e){let r=n.getAttribute&&n.getAttribute("slot")||"",o=i[r]||i[""];o&&o.parentNode.insertBefore(n,o)}for(let n of Object.values(i))n.parentNode.removeChild(n)}function*Hl(s){for(let t of Array.from(s.children))t.tagName.includes("-")?yield t:yield*ks(uf(Hl(t)))}var jl=new Map,fm=class extends HTMLElement{constructor(){super(...arguments),this.wasConnected=!1,this.isReady=!1}connectedCallback(){return he(this,null,function*(){if(this.wasConnected){this._view.trigger("connected");return}this.wasConnected=!0,this.isReady=!1,this._view.created();let s=jl.get(this._view.tagName)||{};s.template&&um(this,s.template);let t=[...Hl(this)].filter(e=>!e.isReady).map(e=>new Promise(i=>e.addEventListener("ready",i)));setTimeout(()=>{this.isReady||console.error(`Children of custom element ${this.tagName} not ready after 1s.`)},1e3),yield Promise.all(t),this._view.ready(),this.dispatchEvent(new CustomEvent("ready")),this.isReady=!0})}disconnectedCallback(){this._view.trigger("disconnected")}},E=class extends us{created(){}ready(){}},mm=new Map;function S(s,t={}){return function(e){if(window.customElements.get(s)){console.warn(`Trying to declare the custom element ${s} twice!`);return}class i extends fm{constructor(){super(),this._view=new e(this)}}mm.set(s,e),jl.set(s.toUpperCase(),t),window.customElements.define(s,i)}}var En=class{constructor(t){this.clipEndTime=0;this.player=new Audio(t),this.player.preload="true",this.player.addEventListener("timeupdate",()=>{this.player.currentTime>=this.clipEndTime&&this.triggerCallback(!0)}),window.addEventListener("beforeunload",()=>this.player.pause())}playClip(t,e,i){this.triggerCallback(!1),this.player.currentTime=t,this.clipEndTime=e,this.clipCallback=i,this.player.play()}triggerCallback(t){if(!this.clipCallback)return;let e=this.clipCallback;this.clipCallback=void 0,this.player.pause(),e({ended:t})}pause(){this.triggerCallback(!1)}get isPlaying(){return!!this.clipCallback}},ha=!1,aa,Mn=class{constructor(t,e){this.audio=t;this.paragraphs=[];this.paragraphs=e.$$(".voice").map(i=>new la(i,t));for(let[i,n]of this.paragraphs.entries())n.on("end",()=>{var r;if(this.paragraphs[i+1])this.paragraphs[i+1].play();else{let o=e.nextStep;o&&o.isShown&&((r=o.narration)==null||r.play())}})}play(){var t;this.audio.isPlaying||!ha||(t=this.paragraphs[0])==null||t.play()}},la=class extends Re{constructor(e,i){super();this.$p=e;this.audio=i;this.playing=void 0;this.sentences=e.$$(".sentence[data-timings]").map(n=>new ca(n,i)),this.$button=m("button",{class:"playback-btn",title:"Play Narration"}),this.$button.on("click",()=>{this.playing?this.audio.pause():this.play(),ha=!ha,aa=void 0}),e.prepend(this.$button),e.addClass("sentence-wrap");for(let[n,r]of this.sentences.entries())r.on("end",o=>{this.playing=void 0,o&&this.sentences[n+1]?setTimeout(()=>this.play(this.sentences[n+1]),200):(this.$button.removeClass("active"),o&&setTimeout(()=>this.trigger("end"),400))})}play(e){let i=e||this.sentences[0],n=i.$reveal;if(n&&n.css("visibility")==="hidden"){this.$button.removeClass("active"),aa=n,n.one("reveal",()=>{aa===n&&!this.audio.isPlaying&&this.play(i)});return}this.playing=i,this.playing.play(),this.$button.addClass("active");let r=this.$p.parents("x-tabbox .tab")[0];if(r){let h=r.parents("x-tabbox")[0];h.makeActive(r.index());let l=h.active;h.one("change",c=>{this.playing&&c!==l&&this.audio.pause()})}let o=this.$p.bounds,a=o.top+o.height-b.height+20;a>0&&C.scrollBy(a+100),setTimeout(()=>this.$button.focus(),800)}},ca=class extends Re{constructor(e,i){super();this.$el=e;this.audio=i;let n=e.attr("data-timings").split("-");this.start=+n[0]/1e3,this.end=(+n[1]-200)/1e3}play(){this.$el.addClass("playing"),this.audio.playClip(this.start,this.end,({ended:e})=>{this.$el.removeClass("playing"),this.trigger("end",e)})}get $reveal(){return this.$el.parents(".reveal")[0]}};var gm=Object.defineProperty,vm=Object.getOwnPropertyDescriptor,Ai=(s,t,e,i)=>{for(var n=i>1?void 0:i?vm(t,e):t,r=s.length-1,o;r>=0;r--)(o=s[r])&&(n=(i?o(t,e,n):o(n))||n);return i&&n&&gm(t,e,n),n},Ul=(s,t,e)=>new Promise((i,n)=>{var r=h=>{try{a(e.next(h))}catch(l){n(l)}},o=h=>{try{a(e.throw(h))}catch(l){n(l)}},a=h=>h.done?i(h.value):Promise.resolve(h.value).then(r,o);a((e=e.apply(s,t)).next())}),_s,wm=m("div",{class:"snackbar"},C),Wl=class extends E{ready(){var s;wm.append(this),(s=this.$("button"))==null||s.on("click",()=>this.close())}open(s=2e3){return Ul(this,null,function*(){_s!==this&&(_s&&(yield _s.close()),_s=this,yield this.enter("pop",300).promise,this.setAttr("role","alert"),s&&setTimeout(()=>this.close(),s))})}close(){return Ul(this,null,function*(){_s===this&&(_s=void 0,this.removeAttr("role"),yield this.exit("pop",300).promise)})}};Wl=Ai([S("x-alert")],Wl);var Kl=class extends E{ready(){if(this.children.length)return;let s=m("svg",{viewBox:"0 0 24 24",alt:"",role:"presentation"},this),t=m("use",{},s),e=+this.attr("size")||24;for(let i of[this,s])i.css({width:`${e}px`,height:`${e}px`});this.onAttr("name",i=>t.setAttr("href",`/icons.040bc2f9.svg#${i}`))}};Kl=Ai([S("x-icon")],Kl);var ms=m("div",{class:"modal-background"},C),pa,Se=void 0,da=void 0;function ua(){Se&&Se.canClose&&Se.close()}ms.on("click",ua);C.onKey("Escape",ua);Ci.on("change",ua);ms.on("scrollwheel touchmove",s=>{s.preventDefault(),s.stopPropagation()});C.onKey("Space ArrowUp ArrowDown PageDown PageUp",s=>{Se&&(s.preventDefault(),s.stopPropagation())});var Xl=class extends E{constructor(){super(...arguments),this.isOpen=!1,this.canClose=!0}ready(){this.canClose=!this.hasAttr("no-close"),this.$iframe=this.$("iframe[data-src]"),this.$video=this.$("video");let s=Te(`[data-modal=${this.id}]`);for(let e of s)e.on("click",()=>this.open());Ci.on("afterChange",({$viewport:e})=>{let i=e.$$(`[data-modal=${this.id}]`);for(let n of i)n.on("click",()=>this.open())}),(this.hasClass("open")||b.getHash()===this.id)&&!Se&&this.open(!0),this.$("input")&&this.addClass("interactive");let t=this.$(".close");t&&t.on("click",()=>this.close());for(let e of this.$$(".btn"))e.on("click",()=>this.trigger("btn-click",e))}open(s=!1){var t,e;if(this.isOpen)return;ms.setClass("light",this.hasClass("light")),Se?Se.close(!0):s?ms.show():ms.css("display")==="block"?pa==null||pa.cancel():ms.enter("fade",250),this.isOpen=!0,Se=this,this.$iframe&&this.$iframe.setAttr("src",this.$iframe.data.src),this.$video&&this.$video.play(),s?this.show():this.enter("pop",250).promise.then(()=>this.css("transform","")),this.setAttr("role","dialog"),this.trigger("open"),da=document.activeElement;let i=this.$('input, a, button, textarea, [tabindex="0"]');i&&i.focus(),(t=window.ga)==null||t.call(window,"send","event","Modal",this.id),(e=window.gtag)==null||e.call(window,"event","modal",{action:this.id})}close(s=!1,t=!1){this.isOpen&&(this.isOpen=!1,this.removeAttr("role"),Se=void 0,this.$iframe&&this.$iframe.setAttr("src",""),this.$video&&this.$video.pause(),s||(pa=ms.exit("fade",250)),this.exit("pop",250).promise.then(()=>this.css("transform","")),t||this.trigger("close"),da&&da.focus())}getOpenModal(){return Se}};Xl=Ai([S("x-modal")],Xl);var Yl=class extends E{constructor(){super(...arguments),this.isOpen=!1}ready(){this.animation=this.attr("animation")||"pop",this.$bubble=this.$(".popup-body"),this.$bubble.hide(),this.$(".popup-target").on("click",()=>this.toggleOpen()),this.on("clickOutside",()=>this.close());for(let t of this.$bubble.$$("a"))t.on("click",()=>this.close());C.onKey("Escape",()=>this.close())}toggleOpen(){this.isOpen?this.close():this.open()}open(){this.isOpen||(this.isOpen=!0,this.addClass("active"),this.$bubble.enter(this.animation,150),this.$bubble.setAttr("role","dialog"),this.$bubble.focus(),this.trigger("open"))}close(){this.isOpen&&(this.isOpen=!1,this.removeClass("active"),this.$bubble.exit(this.animation,150),this.$bubble.removeAttr("role"),this.trigger("close"))}};Yl=Ai([S("x-popup")],Yl);var Zl=class extends E{constructor(){super(...arguments),this.$options={}}ready(){let s=this.children;this.$active=this.$(".active")||s[0],this.$active.addClass("active");for(let[t,e]of s.entries())!_(e.tagName,"A","BUTTON")&&!e.hasAttr("tabindex")&&e.setAttr("tabindex",0),e.on("click",()=>this.makeActive(e)),this.$options[e.attr("value")||t]=e;this.trigger("change",this.$active)}makeActive(s){s!==this.$active&&(this.$active.removeClass("active"),this.$active=s,s.addClass("active"),this.trigger("change",s))}bindVariable(s,t){s[t]===void 0&&(s[t]=this.$active.attr("value")),this.on("change",e=>s[t]=e.attr("value")),s.watch(()=>{let e=this.$options[s[t]];e&&this.makeActive(e)})}};Zl=Ai([S("x-select")],Zl);var fa=12;function ym(s){return`M${s},${s/2}a${s/2},${s/2},0,0,1,0,${s}A${s/2},${s/2},0,0,1,${s},${s/2}`}function bm(s){return`M ${s},0 C ${s/2},0,0,${s/2},0,${s} s ${s/2},${s},${s},${s} s ${s}-${s/2},${s}-${s} S ${s*1.5},0,${s},0 z M ${s*44.6/50},${s*76.1/50} L ${s*19.2/50},${s*48.8/50} l ${s*4/50}-${s*4.2/50} l ${s*19.8/50},${s*11.9/50} l ${s*34.2/50}-${s*32.6/50} l ${s*3.5/50},${s*3.5/50} L ${s*44.6/50},${s*76.1/50} z`}var Cn=class extends E{constructor(){super(...arguments);this.completed=!1}ready(){this.r=+this.attr("r")||10,this.r1=this.r+fa,this.$svg=m("svg",{width:2*this.r1,height:2*this.r1},this),this.$progress=m("path",{class:"pie",d:ym(this.r),"stroke-width":this.r},this.$svg),this.onAttr("p",e=>this.setProgress(+e,!1))}setProgress(e,i=!0){if(e>.99)return this.complete(i);let n=Math.PI*this.r;this.$progress.css("stroke",e?"currentColor":"none"),this.$progress.css("stroke-dasharray",`${e*n} ${n}`)}complete(e=!0){if(this.completed||(this.completed=!0,this.$progress.css("stroke","none"),this.$progress.css("fill","currentColor"),this.$progress.setAttr("d",bm(this.r)),!e))return;let i=`translate(${this.r1} ${this.r1})`,n=m("g",{transform:i},this.$svg),r=z(()=>m("line",{},n),18);pt(o=>{let a=this.r+fa*yt("quint-out",o),h=this.r+fa*o;for(let l=0;l<18;++l){let c=Math.cos(Math.PI*2*l/18),u=Math.sin(Math.PI*2*l/18);r[l].setLine({x:c*a,y:u*a},{x:c*h,y:u*h})}},800).promise.then(()=>n.remove())}};Cn=T([S("x-progress")],Cn);var Ql="2.4.1",ma="i5iSjo",Jl="_av",ga="_au",va="(not set)";var An=[],se=class{static add(t,e,i){tc(t,e).add(i)}static remove(t,e,i){tc(t,e).remove(i)}constructor(t,e){this.context=t,this.methodName=e,this.isTask=/Task$/.test(e),this.originalMethodReference=this.isTask?t.get(e):t[e],this.methodChain=[],this.boundMethodChain=[],this.wrappedMethod=(...i)=>{let n=this.boundMethodChain[this.boundMethodChain.length-1];return n(...i)},this.isTask?t.set(e,this.wrappedMethod):t[e]=this.wrappedMethod}add(t){this.methodChain.push(t),this.rebindMethodChain()}remove(t){let e=this.methodChain.indexOf(t);e>-1&&(this.methodChain.splice(e,1),this.methodChain.length>0?this.rebindMethodChain():this.destroy())}rebindMethodChain(){this.boundMethodChain=[];for(let t,e=0;t=this.methodChain[e];e++){let i=this.boundMethodChain[e-1]||this.originalMethodReference.bind(this.context);this.boundMethodChain.push(t(i))}}destroy(){let t=An.indexOf(this);t>-1&&(An.splice(t,1),this.isTask?this.context.set(this.methodName,this.originalMethodReference):this.context[this.methodName]=this.originalMethodReference)}};function tc(s,t){let e=An.filter(i=>i.context==s&&i.methodName==t)[0];return e||(e=new se(s,t),An.push(e)),e}var Fs=window.Element.prototype,Bw=Fs.matches||Fs.matchesSelector||Fs.webkitMatchesSelector||Fs.mozMatchesSelector||Fs.msMatchesSelector||Fs.oMatchesSelector;var Pm="80",Tm="443",Zw=RegExp(":("+Pm+"|"+Tm+")$"),Qw=document.createElement("a");function kn(s,t,e=void 0,i=void 0,n=void 0,r=void 0){if(typeof i=="function"){let o=e.get("buildHitTask");return{buildHitTask:a=>{a.set(s,null,!0),a.set(t,null,!0),i(a,n,r),o(a)}}}else return Qe({},s,t)}var wa={};function sc(s,t){let e=s.get("trackingId"),i=wa[e]=wa[e]||{},n=()=>{clearTimeout(i.timeout),i.send&&se.remove(s,"send",i.send),delete wa[e],i.queue.forEach(r=>r())};clearTimeout(i.timeout),i.timeout=setTimeout(n,0),i.queue=i.queue||[],i.queue.push(t),i.send||(i.send=r=>(...o)=>{n(),r(...o)},se.add(s,"send",i.send))}var Qe=Object.assign||function(s,...t){for(let e=0,i=t.length;e>t/4).toString(16):("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,s)};function ya(s,t){let e=window.GoogleAnalyticsObject||"ga";window[e]=window[e]||function(...i){(window[e].q=window[e].q||[]).push(i)},window.gaDevIds=window.gaDevIds||[],window.gaDevIds.indexOf(ma)<0&&window.gaDevIds.push(ma),window[e]("provide",s,t),window.gaplugins=window.gaplugins||{},window.gaplugins[ic(s)]=t}var Vi=class{constructor(){this.registry_={}}on(t,e){this.getRegistry_(t).push(e)}off(t=void 0,e=void 0){if(t&&e){let i=this.getRegistry_(t),n=i.indexOf(e);n>-1&&i.splice(n,1)}else this.registry_={}}emit(t,...e){this.getRegistry_(t).forEach(i=>i(...e))}getEventCount(){let t=0;return Object.keys(this.registry_).forEach(e=>{t+=this.getRegistry_(e).length}),t}getRegistry_(t){return this.registry_[t]=this.registry_[t]||[]}};var Vn="autotrack",qs={},xa=!1,Ii,gs=class s extends Vi{static getOrCreate(t,e,i){let n=[Vn,t,e].join(":");return qs[n]||(qs[n]=new s(n,i),xa||Em()),qs[n]}static isSupported_(){if(Ii!=null)return Ii;try{window.localStorage.setItem(Vn,Vn),window.localStorage.removeItem(Vn),Ii=!0}catch(t){Ii=!1}return Ii}static get_(t){return window.localStorage.getItem(t)}static set_(t,e){window.localStorage.setItem(t,e)}static clear_(t){window.localStorage.removeItem(t)}constructor(t,e={}){super(),this.key_=t,this.defaults_=e,this.cache_=null}get(){if(this.cache_)return this.cache_;if(s.isSupported_())try{this.cache_=ba(s.get_(this.key_))}catch(t){}return this.cache_=Qe({},this.defaults_,this.cache_)}set(t){if(this.cache_=Qe({},this.defaults_,this.cache_,t),s.isSupported_())try{s.set_(this.key_,JSON.stringify(this.cache_))}catch(e){}}clear(){if(this.cache_={},s.isSupported_())try{s.clear_(this.key_)}catch(t){}}destroy(){delete qs[this.key_],Object.keys(qs).length||Mm()}};function Em(){window.addEventListener("storage",rc),xa=!0}function Mm(){window.removeEventListener("storage",rc),xa=!1}function rc(s){let t=qs[s.key];if(t){let e=Qe({},t.defaults_,ba(s.oldValue)),i=Qe({},t.defaults_,ba(s.newValue));t.cache_=i,t.emit("externalSet",i,e)}}function ba(s){let t={};if(s)try{t=JSON.parse(s)}catch(e){}return t}var Cm=1e3,Am=60*Cm,In={},vs=class s{static getOrCreate(t,e,i){let n=t.get("trackingId");return In[n]?In[n]:In[n]=new s(t,e,i)}constructor(t,e,i){this.tracker=t,this.timeout=e||s.DEFAULT_TIMEOUT,this.timeZone=i,this.sendHitTaskOverride=this.sendHitTaskOverride.bind(this),se.add(t,"sendHitTask",this.sendHitTaskOverride);try{this.dateTimeFormatter=new Intl.DateTimeFormat("en-US",{timeZone:this.timeZone})}catch(r){}let n={hitTime:0,isExpired:!1};this.store=gs.getOrCreate(t.get("trackingId"),"session",n),this.store.get().id||this.store.set({id:ki()})}getId(){return this.store.get().id}isExpired(t=this.getId()){if(t!=this.getId())return!0;let e=this.store.get();if(e.isExpired)return!0;let i=e.hitTime;if(i){let n=new Date,r=new Date(i);if(n-r>this.timeout*Am||this.datesAreDifferentInTimezone(n,r))return!0}return!1}datesAreDifferentInTimezone(t,e){return this.dateTimeFormatter?this.dateTimeFormatter.format(t)!=this.dateTimeFormatter.format(e):!1}sendHitTaskOverride(t){return e=>{t(e);let i=e.get("sessionControl"),n=i=="start"||this.isExpired(),r=i=="end",o=this.store.get();o.hitTime=Je(),n&&(o.isExpired=!1,o.id=ki()),r&&(o.isExpired=!0),this.store.set(o)}}destroy(){se.remove(this.tracker,"sendHitTask",this.sendHitTaskOverride),this.store.destroy(),delete In[this.tracker.get("trackingId")]}};vs.DEFAULT_TIMEOUT=30;var $a={CLEAN_URL_TRACKER:1,EVENT_TRACKER:2,IMPRESSION_TRACKER:3,MEDIA_QUERY_TRACKER:4,OUTBOUND_FORM_TRACKER:5,OUTBOUND_LINK_TRACKER:6,PAGE_VISIBILITY_TRACKER:7,SOCIAL_WIDGET_TRACKER:8,URL_CHANGE_TRACKER:9,MAX_SCROLL_TRACKER:10},oc=Object.keys($a).length;function ac(s,t){Rm(s),Om(s,t)}function km(s){return parseInt(s||"0",16).toString(2)}function Vm(s){return parseInt(s||"0",2).toString(16)}function Im(s,t){if(s.length{document.visibilityState==Ee?(this.opts.sendInitialPageview&&(this.sendPageview({isPageLoad:!0}),this.isInitialPageviewSent_=!0),this.store.set({time:Je(),state:Ee,pageId:Hs,sessionId:this.session.getId()})):this.opts.sendInitialPageview&&this.opts.pageLoadsMetricIndex&&this.sendPageLoad()})}handleChange(){if(!(document.visibilityState==Ee||document.visibilityState==Li))return;let t=this.getAndValidateChangeData(),e={time:Je(),state:document.visibilityState,pageId:Hs,sessionId:this.session.getId()};document.visibilityState==Ee&&this.opts.sendInitialPageview&&!this.isInitialPageviewSent_&&(this.sendPageview(),this.isInitialPageviewSent_=!0),document.visibilityState==Li&&this.visibleThresholdTimeout_&&clearTimeout(this.visibleThresholdTimeout_),this.session.isExpired(t.sessionId)?(this.store.clear(),this.lastPageState==Li&&document.visibilityState==Ee&&(clearTimeout(this.visibleThresholdTimeout_),this.visibleThresholdTimeout_=setTimeout(()=>{this.store.set(e),this.sendPageview({hitTime:e.time})},this.opts.visibleThreshold))):(t.pageId==Hs&&t.state==Ee&&this.sendPageVisibilityEvent(t),this.store.set(e)),this.lastPageState=document.visibilityState}getAndValidateChangeData(){let t=this.store.get();return this.lastPageState==Ee&&t.state==Li&&t.pageId!=Hs&&(t.state=Ee,t.pageId=Hs,this.store.set(t)),t}sendPageVisibilityEvent(t,{hitTime:e}={}){let i=this.getTimeSinceLastStoredChange(t,{hitTime:e});if(i&&i>=this.opts.visibleThreshold){let n=Math.round(i/hc),r={transport:"beacon",nonInteraction:!0,eventCategory:"Page Visibility",eventAction:"track",eventValue:n,eventLabel:va};e&&(r.queueTime=Je()-e),this.opts.visibleMetricIndex&&(r["metric"+this.opts.visibleMetricIndex]=n),this.tracker.send("event",kn(r,this.opts.fieldsObj,this.tracker,this.opts.hitFilter))}}sendPageLoad(){let t={transport:"beacon",eventCategory:"Page Visibility",eventAction:"page load",eventLabel:va,["metric"+this.opts.pageLoadsMetricIndex]:1,nonInteraction:!0};this.tracker.send("event",kn(t,this.opts.fieldsObj,this.tracker,this.opts.hitFilter))}sendPageview({hitTime:t,isPageLoad:e}={}){let i={transport:"beacon"};t&&(i.queueTime=Je()-t),e&&this.opts.pageLoadsMetricIndex&&(i["metric"+this.opts.pageLoadsMetricIndex]=1),this.tracker.send("pageview",kn(i,this.opts.fieldsObj,this.tracker,this.opts.hitFilter))}trackerSetOverride(t){return(e,i)=>{let n=nc(e)?e:{[e]:i};n.page&&n.page!==this.tracker.get("page")&&this.lastPageState==Ee&&this.handleChange(),t(e,i)}}getTimeSinceLastStoredChange(t,{hitTime:e}={}){return t.time?(e||Je())-t.time:0}handleExternalStoreSet(t,e){t.time!=e.time&&e.pageId==Hs&&e.state==Ee&&!this.session.isExpired(e.sessionId)&&this.sendPageVisibilityEvent(e,{hitTime:t.time})}handleWindowUnload(){this.lastPageState!=Li&&this.handleChange()}remove(){this.store.destroy(),this.session.destroy(),se.remove(this.tracker,"set",this.trackerSetOverride),window.removeEventListener("unload",this.handleWindowUnload),document.removeEventListener("visibilitychange",this.handleChange)}};ya("pageVisibilityTracker",Pa);El();Xt.addClass((b.isMobile?"is":"not")+"-mobile");b.isSafari&&Xt.addClass("is-safari");setTimeout(()=>Xt.addClass("ready"));window.addEventListener("keydown",s=>{s.keyCode===9&&Xt.addClass("is-tabbing")});window.addEventListener("mousedown",()=>{Xt.removeClass("is-tabbing")});var lc=k(".cookie-warning");lc&&k("#yes-to-cookies").on("click",function(){lc.exit("pop",300),b.setCookie("cookie_consent",1)});var Ta=k("x-modal#privacy");Ta&&Ta.$("form").on("submit",s=>{s.preventDefault(),fetch("/profile/accept-policies",{method:"POST"}),Ta.close()});var pc;(pc=navigator.serviceWorker)==null||pc.register("/service_worker.js",{scope:"/"}).catch(()=>console.warn("Unable to register Service Worker."));var dc;(dc=k("#skip-nav"))==null||dc.on("click",()=>{var t;(t=(k("article")||k(".panel.active")||k(".body")||C).$("input, button, a, textarea, [contenteditable], [tabindex]"))==null||t.focus()});var Sa=k("nav x-popup");if(Sa){let s=Sa.$$(".popup-body a, .popup-body button");for(let t of s)t.on("click",()=>Sa.close())}var Dm=Te("#language .locale-link");Ci.on("change",s=>{for(let t of Dm)t.setAttr("href",t.data.host+s)});var Ln=k("#dark-mode");Ln&&(Ln.checked=b.theme.isDark,Ln.on("change",()=>b.setTheme(Ln.checked?"dark":"light")));var Oi={},ws=k("#search"),ts=ws==null?void 0:ws.$(".form-field input"),On=ws==null?void 0:ws.$(".search-body");Oi[""]=(On==null?void 0:On.html)||"";function Nm(s){return s=s.trim().replace(/\s+/," ").toLowerCase().slice(0,50),s==="pi"||s.length>=3?s:""}function Gm(s){return D(this,null,function*(){if(s=encodeURIComponent(Nm(s)),s in Oi)return Oi[s];let t=yield fetch(`/api/search?q=${s}`);return t.ok?Oi[s]=yield t.text():Oi[s]=""})}var zm=0,cc=0;function uc(s){return D(this,null,function*(){let t=zm+=1,e=yield Gm(s);t<=cc||(cc=t,On.html=e)})}ts==null||ts.change(s=>{b.setCookie("search",s,60*60*24),setTimeout(()=>{ts.value===s&&uc(s)},300)});ts!=null&&ts.value&&ws.one("open",()=>uc(ts.value));var fc='';function mc(s){if(s.match("^[0-9]+/[0-9]+$")){let t=s.split("/");return+t[0]/+t[1]}else return Wh(s)}var Rn=class extends E{constructor(){super(...arguments);this.solution="";this.solutionNum=NaN;this.solutionDisplay="";this.range=0;this.input="";this.hint="";this.attempts=0;this.placeholder="???";this.done=!1}ready(){if(this.$input=this.$("input"),this.$target=this.$(".target"),this.solution=this.attr("solution"),this.solution.indexOf("\xB1")>=0){let e=this.solution.split("\xB1");this.solution=e[0].trim(),this.range=+e[1]}this.solutionNum=mc(this.solution),this.solutionDisplay=this.solution,this.hint=this.attr("hint"),this.removeAttr("solution"),this.removeAttr("hint"),this.$input.setInputPattern(this.solution),this.hasAttr("placeholder")&&(this.placeholder=this.attr("placeholder")),this.$input.setAttr("placeholder",this.placeholder),this.removeAttr("placeholder"),this.$input.change(e=>{this.input=e,this.isCorrect&&(this.solve(),this.trigger("valid",e),this.moveCursor())}),this.$input.onKey("Enter",()=>this.$input.blur()),this.$input.on("focus",()=>{this.addClass("on"),this.removeClass("invalid"),this.$input.setAttr("placeholder"," ")}),this.$input.on("blur",()=>{if(this.removeClass("on"),this.setClass("invalid",!!this.input&&!this.done),this.$input.setAttr("placeholder",this.placeholder),this.input&&!this.done){this.attempts+=1;let e=this.attempts>=(this.hint?4:3)?`Hmmm\u2026 maybe try ${this.solution}?`:this.attempts>=2?this.hint:void 0;this.trigger("invalid",{hint:e})}})}setup(e,i,n){var r;this.goal=i,this.$step=e,(r=n==null?void 0:n.scores)!=null&&r.includes(i)&&this.solve(!0),this.one("valid",()=>{e.addHint("correct"),e.score(this.solvedBlank?this.solvedBlank.goal:i)}),this.on("invalid",o=>e.addHint(o.hint||"incorrect",{class:"incorrect"}))}get isCorrect(){if(this.done)return!0;if(this.linkedBlanks){let e=this.linkedBlanks.map(i=>i.solvedBlank);return this.solvedBlank=this.linkedBlanks.find(i=>{if(i.done&&!i.solvedBlank||e.includes(i))return!1;if(i.checkAnswer(this.input))return!0}),this.solvedBlank&&(this.solutionDisplay=this.solvedBlank.solution),!!this.solvedBlank}return this.checkAnswer(this.input)}checkAnswer(e){let i=mc(e);return e.toLowerCase()===this.solution.toLowerCase()?!0:this.range&&Math.abs(i-this.solutionNum)<=this.range?(this.solutionDisplay=e,!0):x(i,this.solutionNum)||zo(i)===this.solution||e===zo(this.solutionNum)}moveCursor(){if(!this.$step)return;let e=this.$step.$blanks[this.$step.$blanks.indexOf(this)+1];!e||e.done||e.tagName==="X-BLANK-MC"||e.css("visibility")==="hidden"||!e.bounds.width||e.focus()}solve(e=!1){this.done=!0,this.$input.remove(),this.$target.html=this.solutionDisplay,this.addClass("done"),this.trigger("solve",{solution:this.solutionDisplay,restore:e})}focus(){this.$input.focus()}blur(){this.$input.blur()}};Rn=T([S("x-blank",{template:fc})],Rn);var gc='???

';var Dn=class extends E{constructor(){super(...arguments);this.done=!1}ready(){this.$target=this.$(".target"),this.$popup=this.$(".popup");let e=this.$popup.$$(".choice");this.solution=e[0].html,_t.shuffle(oe(e.length)).forEach(r=>{this.$popup.append(e[r]),e[r].on("click",()=>{this.removeClass("on"),e[r].blur(),r?(this.$target.html=e[r].html,this.addClass("invalid"),this.trigger("invalid")):(this.solve(),this.trigger("valid",this.solution))})});let n=this.$target.bounds.left+this.$popup.width>b.width-15;this.setClass("left",n),Bs(this,{enter:()=>{if(this.done)return;this.addClass("on");let r=this.$target.bounds,o=this.$popup.width,a=this.$popup.height,h=b.width-10-r.left,l=o10,u=r.top+r.height+a>b.height-10;this.setClass("left",c&&!l),this.setClass("top",u),this.$popup.css("max-width",!c&&!l?`${h}px`:"none")},exit:()=>{this.removeClass("on")},delay:100,exitDelay:400,$clickTarget:this.$target})}setup(e,i,n){var r;(r=n==null?void 0:n.scores)!=null&&r.includes(i)&&this.solve(!0),this.one("valid",()=>{e.addHint("correct"),e.score(i)}),this.on("invalid",o=>e.addHint(o.hint||"incorrect",{class:"incorrect"}))}solve(e=!1){this.done=!0,this.$target.html=this.solution,this.removeClass("on invalid"),this.addClass("done"),this.trigger("solve",{solution:this.solution,restore:e}),setTimeout(()=>this.$popup.remove(),250),this.$target.removeAttr("tabindex")}};Dn=T([S("x-blank-mc",{template:gc})],Dn);var vc='
';var wc=40,yc="free-text",Nn=class extends E{setup(t,e,i){var l,c;let n=this.$(".text-area"),r=this.$(".toolbar .submit"),o=((l=i==null?void 0:i.data)==null?void 0:l[yc])||"";o&&(n.html=o);for(let u of this.$$(".toolbar .command")){let d=u.data.command.split(":");u.on("click",()=>document.execCommand(d[0],!1,d[1]))}let a=o,h=ve(()=>{a!==o&&t.storeData(yc,o),a=o},5e3);n.on("change keyup input paste",()=>{o=n.html.replace(/ /g," ").trim().slice(0,500).trim(),r.setClass("invisible",o.length{h(),t.score(e),r.exit("pop"),this.trigger("submit")}))}};Nn=T([S("x-free-text",{template:vc})],Nn);var bc='
';var Gn=class extends E{ready(){let t=this.$(".wrapper"),e=this.$(".panel"),i=e.children,n=this.$(".next"),r=this.$(".back"),o=this.$(".dots"),a=i.map(()=>m("div",{class:"dot"},o)),h=i.length,l=+this.attr("slide-width")||void 0,c=this.width,u=1,d=c,g=0,w=0,f=dt=>{w=dt,e.translate(dt,0),this.trigger("move",dt)},v=dt=>{g=dt;for(let[ge,vi]of a.entries())vi.setClass("on",ge>=dt&&ge{c=this.width,u=l?Math.ceil(c/l):1,d=c/u;for(let dt of i)dt.css("width",d+"px");e.css("width",h*d+"px"),f(-g*d),v(g)});let y="quad",$=500,I,A,M,P,j=!1,ne=()=>{I=Date.now()-P,f(A+M*yt(y,I/$)),!j&&I<$?requestAnimationFrame(ne):this.trigger("slide-end")},As=dt=>{j=!1,I=0,A=w,M=-dt*d-w,P=Date.now(),v(dt),ne()};n.on("click",()=>{y="quad",g{y="quad",g>0&&As(g-1)});let sn,To,So,nn;ds(t,{start:dt=>{j=!0,sn=w,To=dt.x,nn=So=To},move:dt=>{So=nn,nn=dt.x;let ge=sn-To+dt.x,vi=-(h-u)*d,qd=ge>0?ge/4:ge{let dt=nn-So,ge=dt>12?1:dt<-12?-1:0;y="quad-out",As(B(Math.round(-w/d-ge),0,h-u)),setTimeout(()=>this.css("pointer-events","auto"))}})}};Gn=T([S("x-gallery",{template:bc})],Gn);var xc='';function Ea(s,t){let e=t.positionLeft-s.positionLeft+t.width/2,i=t.positionTop-s.positionTop+t.height/2;return new p(e,i)}function $c(s){return s?new p(...s.split(",").map(t=>+t)):void 0}var zn=class extends E{constructor(){super(...arguments);this.doAnimation=!1}created(){this.slide=$c(this.attr("slide")),this.shift=$c(this.attr("offset"))}ready(){this.$target=k(this.attr("target")),this.$target&&(this.$target.on("click pointerdown focus",()=>this.stop()),this.hasAttr("start")&&this.start())}setTarget(e,i,n){this.$target=typeof e=="string"?k(e):e,i&&(this.slide=i),n&&(this.slide=n)}start(e){this.doAnimation||!this.from&&!this.$target||(this.doAnimation=!0,e&&(this.slide=e),this.slide||this.$end?this.runSlideAnimation():this.runClickAnimation())}startSlide(e,i){this.$target=e,this.$end=i,this.start()}stop(){this.doAnimation=!1}runSlideAnimation(){return D(this,null,function*(){this.show();let e=this.from||Ea(this,this.$target);this.shift&&(e=e.add(this.shift));let i=this.slide?e.add(this.slide):Ea(this,this.$end),n=`translate(${e.x-15}px,${e.y-10}px)`,r=`translate(${i.x-15}px,${i.y-10}px)`;yield this.animate({transform:[n+" scale(2)",n],opacity:[0,1]},300).promise,yield this.animate({transform:[n,r]},1e3).promise,yield this.animate({transform:[r,r+" scale(2)"],opacity:[1,0]},300).promise,this.hide(),setTimeout(()=>{this.doAnimation&&this.runSlideAnimation()},1e3)})}runClickAnimation(){return D(this,null,function*(){this.show();let e=this.from||Ea(this,this.$target);this.shift&&(e=e.add(this.shift));let i=`translate(${e.x-15}px,${e.y-10}px)`;yield this.animate({transform:[i+" scale(2)",i],opacity:[0,1]},500).promise,yield this.animate({transform:[i,i+" scale(2)"],opacity:[1,0]},500,200).promise,this.hide(),setTimeout(()=>{this.doAnimation&&this.runClickAnimation()},1e3)})}};zn=T([S("x-gesture",{template:xc})],zn);var Ma='';var Bm=JSON.parse(k("#glossary").text),_m=JSON.parse(k("#bios").text),Ca=600,_n;b.onResize(()=>{_n&&_n.hide()});var Ri=class extends E{ready(){this.xid=this.attr("xid"),this.$target=this.$(".target"),this.$popup=this.$(".popup"),this.$popup.html=this.body()||"",this.setClass("left",b.width>Ca&&this.$target.bounds.left+this.$popup.width>b.width-15),Bs(this,{enter:()=>this.show(),exit:()=>this.hide(),delay:100,exitDelay:200,$clickTarget:this.$target,canFocusWithin:!0,preventMouseover:()=>b.width<=Ca})}show(){if(_n=this,this.addClass("on"),b.width<=Ca){let o=k("#glossary-modal");return o.$(".modal-body").html=this.body(),o.open()}let t=this.$target.bounds,e=this.$popup.width,i=this.$popup.height,n=t.top+t.height+i54;this.setClass("top",r&&!n),this.setClass("left",t.left+e>b.width-15)}hide(){_n=void 0,this.removeClass("on")}body(){let t=Bm[this.xid];if(!t)return console.warn("missing gloss:",this.xid);let e=t.text;return t.image&&(e+=``),t.link&&(location.pathname===t.link.split("#")[0]||(e+=`

Learn more\u2026

`)),e}};Ri=T([S("x-gloss",{template:Ma})],Ri);var Bn=class extends Ri{body(){let t=_m[this.xid];if(!t)return console.warn("missing bio:",this.xid);let e=``,i=t.born?`

Timeline

`:"";return(t.image===!1?"":e)+t.bio+i}};Bn=T([S("x-bio",{template:Ma})],Bn);var Pc='
';var Fm=document.createElement("a").relList.supports("ar"),qn=!1,Aa={x:0,y:0,s:1},Tc,ys=m("div",{class:"lightbox-overlay"},C),Ge=m("div",{class:"lightbox-img"},ys);function qm(s,t,e){qn=!0,Tc=s,ys.show(),Ge.show();let i=s.bounds,n=Ge.bounds,r=i.left+i.width/2-n.left-n.width/2,o=i.top+i.height/2-n.top-n.height/2,a=Math.max(i.width/n.width,i.height/n.height);Aa={x:r,y:o,s:a},Ge.css("background-image",`url(${e}), url(${t})`),Ge.css("transform",`translate(${r}px, ${o}px) scale(${a})`),b.redraw(),Ge.addClass("transitions"),b.redraw(),s.css("visibility","hidden"),ys.addClass("on"),Ge.css("transform","scale(1) translate(0,0)")}function Sc(){qn&&(qn=!1,ys.removeClass("on"),Ge.setTransform(Aa,0,Aa.s),setTimeout(()=>{Tc.css("visibility","visible"),ys.css("display","none"),Ge.css("transform","none"),Ge.removeClass("transitions")},400))}ys.on("click touchmove",Sc);C.onKey("Escape",Sc);ys.on("scrollwheel touchmove",s=>{s.preventDefault(),s.stopPropagation()});C.onKey("Space AllArrows PageDown PageUp",s=>{qn&&(s.preventDefault(),s.stopPropagation())});var Fn=class extends E{ready(){let t=this.attr("src"),e=this.$(".wrap"),i=this.attr("width"),n=this.attr("height");this.css("width",i+"px"),e.css("padding-bottom",+n/+i*100+"%");let r=e.$("img");r.setAttr("src",t),r.setAttr("alt",this.attr("alt")||""),r.setAttr("width",i),r.setAttr("height",n),t.endsWith(".gif")&&r.on("click",()=>r.setAttr("src",t));let o=e.$(".credit"),a=this.attr("credit");a?o.text=a:o.remove();let h=e.$(".zoom");if(this.hasAttr("lightbox")){this.addClass("interactive");let l=t.replace(/\.(?=[^.]*$)/,"-large.");this.on("click",()=>qm(this,t,l))}else h.remove();if(Fm&&this.hasAttr("ar")){let l=m("a",{href:this.attr("ar"),rel:"ar"});e.prepend(l),l.append(r)}}};Fn=T([S("x-img",{template:Pc})],Fn);var Hn=class extends E{constructor(){super(...arguments);this.correctCount=0;this.solvedCount=0;this.isSolved=!1}setup(e,i,n){var h;let r=this.children,o=r.map(()=>!1);for(let[l,c]of r.entries()){let u=c.data.error,d=u?"incorrect":"correct";u||(this.correctCount+=1),c.one("click",()=>{o[l]||this.isSolved||(e.addHint(u||"correct",{class:d}),c.addClass(d),u||(this.solvedCount+=1,e.score("picker-"+l),this.checkSolved()))})}let a=((h=n==null?void 0:n.scores)==null?void 0:h.filter(l=>l.startsWith("picker-")))||[];for(let l of a){let c=+l.slice(7);o[c]=!0,r[c].addClass("correct")}this.solvedCount=a.length,this.checkSolved()}checkSolved(){this.solvedCountthis.steps=+a),this.speed=+this.attr("speed")||1;let e=this.$(".bar"),i=this.$(".knob"),n=this.$(".play");this.hasAttr("no-play")?n.remove():n.on("click",()=>this.play());let r=this.hasAttr("continuous"),o=this.hasAttr("snap")?e.width/this.steps:.001;this.drag=new fs(i,{moveY:!1,snap:o}),this.drag.on("start",()=>{this.animation&&this.animation.cancel(),this.animation=void 0}),this.drag.on("move",({posn:a})=>{let h=a.x/this.drag.bounds.dx*this.steps;r||(h=Math.round(h)),!x(h,this.current)&&(this.current=h,this.trigger("move",h))}),this.drag.on("end",()=>this.trigger("slide-end"))}setup(e,i){this.bindModel(e.model),this.one("slide-end",()=>e.score(i))}set(e){x(e,this.current)||this.drag.setPosition(e*this.drag.bounds.dx/this.steps,0)}play(){return D(this,null,function*(){this.current>=this.steps&&this.set(0);let e=(1-this.current/this.steps)*3e3/this.speed;this.moveTo(this.steps,e)})}moveTo(e,i=600){return D(this,null,function*(){if(this.animation||e===this.current)return;let n=this.current;this.animation=pt(r=>{this.set(n+(e-n)*yt("quad",r))},i),yield this.animation.promise,this.animation=void 0,this.trigger("slide-end")})}bindVariable(e,i){e[i]=0,this.on("move",n=>e[i]=n),e.watch(()=>this.set(e[i]))}};jn=T([S("x-slider",{template:Ec})],jn);var Mc='
';function Hm(s){let t=s.$$("x-blank, x-blank-mc");if(!t.length)return Promise.resolve();let e=0;return new Promise(i=>{for(let n of t)n.on("solve",()=>{e+=1,e>=t.length&&i()})})}var Un=class extends E{constructor(){super(...arguments);this.length=0;this.current=0;this.locked=!1}ready(){this.$legend=this.$(".legend-box"),this.$steps=this.$legend.children,this.$back=this.$(".back"),this.$next=this.$(".next");let e=this.$(".dots");this.$dots=this.$steps.map(()=>m("div",{class:"dot"},e)),this.length=this.$steps.length,this.current=0,this.$back.on("click",()=>this.goBack()),this.$next.on("click",()=>this.goNext()),this.blanks=this.$steps.map(i=>Hm(i)),this.reveals=this.$$("[slide]").map(i=>{let n=i.attr("slide").split("-"),r=n.length>1?[+n[0]||0,+n[1]||this.length]:[+n[0],+n[0]],o=[i.data.animation||"fade",+i.data.duration||400];return i.data.display="visibility",r[0]>=0&&!i.hasClass("reveal")&&i.hide(),[i,r,o]}),this.autoAdvance=this.attr("step")==="auto",this.$steps[0].show(),this.$dots[0].addClass("on"),this.setupSlide(0)}setup(e,i,n){var o;let r=(o=n==null?void 0:n.scores)==null?void 0:o.filter(a=>a.startsWith("slide-")).length;if(r&&re.score("slide-"+(a-1)))}go(e){if(this.locked||e<0||e>this.length-1||e===this.current)return;this.locked=!0,setTimeout(()=>this.locked=!1,600),this.$back.setClass("disabled",e===0),this.$next.setClass("disabled",e===this.length-1),this.$dots[this.current].removeClass("on"),this.$dots[e].addClass("on"),this.$steps[e].show();let i=this.$steps[e].height+"px";this.$steps[e].hide(),this.$steps[this.current].exit("fade",300).promise.then(()=>this.$steps[e].enter("fade",300)),this.$legend.animate({height:i},600).promise.then(()=>this.$legend.css("height","auto")),this.setupSlide(e),this.current=e,this.trigger("step",e)}setupSlide(e){this.$next.setAttr("disabled","true"),this.blanks[e].then(()=>this.$next.removeAttr("disabled"));for(let[i,n,r]of this.reveals){if(i.hasClass("reveal"))continue;let o=i.css("visibility")!=="hidden",a=e>=n[0]&&e<=n[1];a&&!o&&i.enter(...r,300),!a&&o&&i.exit(...r)}}goNext(){this.locked||(this.go(this.current+1),this.trigger("next",this.current))}goBack(){this.locked||(this.go(this.current-1),this.trigger("back",this.current))}};Un=T([S("x-slideshow",{template:Mc})],Un);var Wn=class extends E{ready(){var g,w;(g=k(".sidebar-toggle"))==null||g.on("click",()=>this.addClass("open")),(w=k(".sidebar-shadow"))==null||w.on("pointerdown",()=>this.removeClass("open"));let t=k("#feedback form"),e=k("#feedback button"),i=k("#feedback .error"),n=k("#feedback-success"),r=k('#feedback textarea[name="message"]'),o=k("x-course").id;t==null||t.on("submit",f=>{f.preventDefault(),e.setAttr("disabled","true"),i.hide(),Ne(`/course/${o}/feedback`,t.formData).then(()=>{n.open(),r.value=""}).catch(()=>i.show()).then(()=>e.removeAttr("disabled"))});let a=JSON.parse(k("#glossary").text),h=k("#glossary-search"),l=h.$(".gloss-body"),c=h.$(".gloss-list"),u=h.$(".gloss-search input"),d;for(let f of Object.keys(a).sort()){let v=a[f],y=m("div",{class:"gloss-item",html:v.title,tabindex:0},c);y.on("click",()=>{d&&d.removeClass("on"),d=y,y.addClass("on"),l.html=v.text});let $=v.title.toLowerCase();u.change(I=>y.setClass("hidden",!!I&&$.indexOf(I.toLowerCase())<0))}}};Wn=T([S("x-course-sidebar")],Wn);function ka(s,t){let e=as(s.map(i=>i.h+10));for(let[i,n]of s.entries())n.drag.bounds=new lt(0,0,0,O(e)),n!==t&&n.drag.setPosition(0,e[i-1]||0)}function jm(s){return s.every((t,e)=>t.index===e)||s.every((t,e)=>t.index===s.length-e-1)}var Kn=class extends E{ready(){this.items=this.children.map(t=>({drag:new fs(t,{moveX:!1,useTransform:!0}),index:+t.data.index,h:0}));for(let t of this.children)t.removeAttr("data-index");for(let t of this.items)t.drag.on("drag",()=>{this.items=yi(this.items,e=>e.drag.position.y-(e===t?10:0)),ka(this.items,t)}),t.drag.on("end",()=>{ka(this.items),jm(this.items)&&this.solve()});b.onResize(()=>{for(let e of this.items)e.h=e.drag.$el.height;let t=N(this.items.map(e=>e.h));this.css("height",t+this.items.length*10-10+"px"),ka(this.items)})}setup(t,e,i){var n;(n=i==null?void 0:i.scores)!=null&&n.includes(e)&&this.solve(),this.one("solve",()=>{t.addHint("correct"),t.score(e)})}solve(){this.trigger("solve"),this.addClass("solved");for(let t of this.items)t.drag.disabled=!0}};Kn=T([S("x-sortable")],Kn);function Cc(s,t=!1){return D(this,null,function*(){if(s.css("visibility")==="visible")return;s.data.display="visibility";let e=+s.data.duration||400,i=(t?0:600)+(+s.data.delay||0);yield s.enter(s.data.animation||"fade",e,i).promise,s.css({opacity:"",transform:""}),s.trigger("reveal"),s.removeClass("reveal")})}var Xn=class extends E{constructor(){super(...arguments);this.model=le({});this.isShown=!1;this.isCompleted=!1;this.scores=new Set}ready(){var i,n,r,o;this.$course=this.parents("x-course")[0],this.$blanks=this.$$("x-blank, x-blank-mc"),this.$components=this.$$("[goal]"),this.userData=(r=(n=(i=this.$course)==null?void 0:i.userData)==null?void 0:n.steps)==null?void 0:r[this.id],this.goals=K(this.attr("goals")),this.$reveals=this.$$(".reveal");let e=this.$$(".check[data-when]");for(let a of[...this.$reveals,...e])this.onScore(a.data.when,()=>Cc(a));this.$nextBtn=this.$$(".next-step");for(let[a,h]of this.$nextBtn.entries())this.onScore("next-"+a,()=>h.exit("pop")),h.one("click",()=>this.score("next-"+a));for(let a of this.$$(".step-target"))a.tagName!=="X-TARGET"&&Bs(a,{enter:()=>{let h=this.$$('[target~="'+a.data.to+'"]');for(let l of h)l.addClass("focus");this.addClass("focus"),this.trigger("target-focus",{$targets:h})},exit:()=>{for(let h of this.$$(".focus"))h.removeClass("focus");this.removeClass("focus")}});for(let a of this.$$(".var, .var-action"))a.bindModel(this.model);(o=this.$course)!=null&&o.audio&&(this.narration=new Mn(this.$course.audio,this))}show(){var n,r,o;if(this.isShown)return;this.isShown=!0,(n=StepFunctions==null?void 0:StepFunctions[rn(this.id)])==null||n.call(StepFunctions,this);for(let a of this.$components)a.setup(this,a.attr("goal"),this.userData);let e=((r=this.userData)==null?void 0:r.scores)||[];for(let a of e)this.score(a,!1);let i=this.$$("x-gesture[target]");setTimeout(()=>{if(!this.isReady)for(let a of i)a.start()},2e3),(o=this.$course)==null||o.log("Step","show",this.id),this.trigger("show"),this.addClass("on"),this.narration&&setTimeout(()=>this.narration.play(),400)}complete(){if(!this.isCompleted){this.isShown||this.show(),this.isCompleted=!0;for(let e=0;ethis.scores.has(e))}get isPageLoaded(){return this.$course?this.$course.isReady:!0}score(e,i=!0){this.scores.has(e)||(this.scores.add(e),this.trigger("score-"+e),this.trigger("score"),this.$course&&(this.$course.trigger("score"),this.$course.saveProgress({steps:{[this.id]:{scores:[e]}}}),this.$course.log("Step","score",this.id+"/"+e)),i&&this.isReady&&this.$course&&this.$course.isReady&&setTimeout(()=>{this.$course.$activeStep===this&&this.$course.nextStep()},1200))}storeData(e,i){var n;(n=this.$course)==null||n.saveProgress({steps:{[this.id]:{data:{[e]:i}}}})}onScore(e,i){let n=K(e);if(n.every(a=>this.scores.has(a)))return i&&i(),Promise.resolve();let r=Ke(),o=()=>{n.every(a=>this.scores.has(a))&&(i&&i(),r.resolve(),this.off("score",o))};return this.on("score",o),r.promise}addHint(e,i={}){var n,r,o;return this.trigger("hint",e),(n=this.$course)!=null&&n.isReady?this.isInViewport?(r=this.$course.$tutor)==null?void 0:r.showHint(e,i):(this.one("enterViewport",()=>{var a;return(a=this.$course.$tutor)==null?void 0:a.showHint(e,i)}),{text:((o=this.$course.$tutor)==null?void 0:o.hints[e])||e}):{text:e}}delayedHint(e,i=1e4){let n=setTimeout(e,i);this.on("score",()=>{clearTimeout(n),this.isCompleted||(n=setTimeout(e,i))}),this.on("complete",()=>clearTimeout(n))}get nextStep(){if(!this.$course)return;let e=this.$course.$steps.indexOf(this);return this.$course.$steps[e+1]}groupBlanks(...e){let i=e.map(n=>this.$blanks[n]);for(let n of i)n.linkedBlanks=i}};Xn=T([S("x-step")],Xn);var Um='
',Yn=class extends E{constructor(){super(...arguments);this.$titles=[];this.active=0}ready(){let e=this.$(".titles");this.$body=this.$(".body"),this.$tabs=this.$$(".tab");for(let i=0;ithis.makeActive(i))}this.$titles[0].addClass("active"),this.$tabs[0].show()}makeActive(e){if(this.active===e)return;this.$titles[this.active].removeClass("active"),this.$titles[e].addClass("active"),this.$tabs[e].show();let i=this.$tabs[e].outerHeight+"px";this.$tabs[e].hide(),this.$tabs[this.active].exit("fade",300).promise.then(()=>this.$tabs[e].enter("fade",300)),this.$body.animate({height:i},600).promise.then(()=>this.$body.css("height","auto")),this.active=e,this.trigger("change",e)}};Yn=T([S("x-tabbox",{template:Um})],Yn);var Ac='';function Wm(s,t,e,i){let n=new p(s.left-15,s.top+e-15),r=new G(n,s.width+30,s.height+30),o=new p(t.left-15,t.top+i-15),a=new G(o,t.width+30,t.height+30),h=new Y(r.center,a.center);return[Q(h,r)[0],Q(h,a)[0]]}function Km(s,t){return Math.abs(s[0]-t[0])+Math.abs(s[1]-t[1])}var kc=Te("header, x-tutor, .sidebar"),Us=m("svg",{class:"target-body",html:Ac},C),Xm=Us.$("mask"),Ym=Us.$(".target-arrow"),js=!1,Vc=[],Zn=class extends E{ready(){this.setAttr("tabindex",0);let t=this.attr("to").replace(/_/g," "),e=this.hasClass("no-margins"),i,n,r,o,a=()=>{js=!0;let u=Te(t);if(!u.length)return;let d=u[0].hasParent(...kc);i===void 0&&(i=this.hasParent(...kc));let g=this.bounds,w=u.map(f=>f.bounds).filter(f=>f.width||f.height);if(r=0,!d){let f=Math.min(...w.map(I=>I.top)),v=Math.max(...w.map(I=>I.top+I.height)),y=b.height-12-v,$=56-f;r=y<0?y:$>0?$:0}for(let f of Vc)f.remove();Vc=[g,...w].map((f,v)=>{let y=!v||e?4:10;return m("rect",{x:f.left-y,y:f.top-y+(v||!i?r:0),width:f.width+2*y,height:f.height+2*y,rx:v?4:18,ry:v?4:18},Xm)}),Ym.points=Wm(g,w[0],i?0:r,d?0:r)},h=()=>{r&&C.scrollBy(-r,300),Us.css("display","block"),b.redraw(),Zt(function(){Us.css("opacity",1)},r?300:0)},l=u=>{js&&(u&&_(u.type,"mousemove","pointermove")&&Km(n,[u.clientX,u.clientY])<40||(clearTimeout(o),js=!1,Us.css("opacity",0),setTimeout(()=>{js||Us.css("display","none")},300),C.off("mousewheel mousemove touchend touchmove",l),this.off("mouseleave blur",l)))},c=()=>{r&&!i?C.on("mousemove",l):this.on("mouseleave",l),C.on("mousewheel touchend touchmove",l),this.on("blur",l)};this.on("mouseenter touchstart focus",u=>{n=[u.clientX,u.clientY],a(),o=window.setTimeout(h,r?50:30),c()}),this.on("click",u=>{js?(u.handled=!0,l(),setTimeout(()=>k(t).trigger("click mousedown"))):(js=!0,r=0,h(),c())})}};Zn=T([S("x-target")],Zn);var ot=class ce extends Error{constructor(t,e){super(e),this.name=t}static undefinedVariable(t){return new ce("EvalError",`Undefined variable \u201C${t}\u201D.`)}static undefinedFunction(t){return new ce("EvalError",`Undefined function \u201C${t}\u201D.`)}static uncallableExpression(t){return new ce("EvalError",`Cannot call \u201C${t}\u201D.`)}static evalLoop(t){return new ce("EvalError",`Loop in nested evaluation \u201C${t}\u201D.`)}static invalidCharacter(t){return new ce("SyntaxError",`Unknown symbol \u201C${t}\u201D.`)}static conflictingBrackets(t){return new ce("SyntaxError",`Conflicting brackets \u201C${t}\u201D.`)}static unclosedBracket(t){return new ce("SyntaxError",`Unclosed bracket \u201C${t}\u201D.`)}static startOperator(t){return new ce("SyntaxError",`A term cannot start with a \u201C${t}\u201D.`)}static endOperator(t){return new ce("SyntaxError",`A term cannot end with a \u201C${t}\u201D.`)}static consecutiveOperators(t,e){return new ce("SyntaxError",`A \u201C${t}\u201D cannot be followed by a \u201C${e}\u201D.`)}static invalidExpression(){return new ce("SyntaxError","This expression is invalid.")}},za={pi:Math.PI,\u03C0:Math.PI,e:Math.E},Oa={"(":")","[":"]","{":"}"},Xs={"*":"\xB7","**":"\u2217","//":"//","+-":"\xB1","\u2013":"\u2212","-":"\u2212",xx:"\xD7",sum:"\u2211",prod:"\u220F",int:"\u222B",del:"\u2202",grad:"\u2207",aleph:"\u2135",not:"\xAC",AA:"\u2200",EE:"\u2203","'":"\u2019","!=":"\u2260","?=":"\u225F","<=":"\u2264",">=":"\u2265",in:"\u2208","!in":"\u2209","==":"\u2261","~=":"\u2245","~~":"\u2248",sub:"\u2282",sube:"\u2286",prop:"\u221D",oo:"\u221E",cap:"\u2229",cup:"\u222A","<-":"\u2190","->":"\u2192","=>":"\u21D2","<=>":"\u21D4","|->":"\u21A6",uarr:"\u2191",darr:"\u2193",lArr:"\u21D0"},Ni={Gamma:"\u0393",Delta:"\u0394",Theta:"\u0398",Lambda:"\u039B",Xi:"\u039E",Pi:"\u03A0",Sigma:"\u03A3",Phi:"\u03A6",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u025B",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",pi:"\u03C0",rho:"\u03C1",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",CC:"\u2102",NN:"\u2115",QQ:"\u211A",RR:"\u211D",ZZ:"\u2124"},Bc="abcdefghijklmnopqrstuvwxyz",Zm=Bc.split(""),Qm=Bc.toUpperCase().split(""),Jm=Object.values(Ni),tg=[...Zm,...Qm,...Jm,"$"],eg="|()[]{}\xF7,!?<>=*/+-\u2013\u2212~^_\u2026\xB0\u2022\u2225\u22A5'\u2220:%\u223C\u25B3",sg=Object.values(Xs),ig=[...eg,...sg],ng={_:"sub","^":"sup","//":"/","\xF7":"/"},Ic={"<":"<",">":">"};function _c(s){return s in Ic?Ic[s]:s}var rg=["abs","round","floor","ceil","max","min","mod","lcm","gcd","gcf","log","exp","ln","sqrt","root","sin","cos","tan","sec","csc","cot","cosec","cotan","arcsin","arccos","arctan","sinh","cosh","tanh","sech","csch","coth","cosech"];function $s(s){return rg.includes(s)}var Ys={"+":"plus","\u2212":"minus","\xB7":"times","\xD7":"times","/":"over","//":"divided by","%":"percent","!":"factorial","\xB1":"plus-minus","=":"equals","\u2260":"does not equal","\u225F":"is it equal?","<":"is less than",">":"is greater than","\u2264":"is less than or equal to","\u2265":"is greater than or equal to",\u03C0:"pi","\u2245":"is congruent to","\u2225":"is parallel to","\u22A5":"is perpendicular to"};for(let s of Object.keys(Ni))Ys[Ni[s]]=s;var Fc=s=>typeof s=="number"?s:s[0],qc=s=>typeof s=="number"?[s,s]:s,ss=class{evaluate(s={},t){return NaN}interval(s={},t){return qc(this.evaluate(s))}substitute(s={}){return this}recursiveSubstitute(s){let t=Object.keys(s);return this.unknowns.filter(e=>t.includes(e)).length?this.substitute(s).recursiveSubstitute(s):this}get simplified(){return this}get unknowns(){return this.variables.filter(s=>!Object.prototype.hasOwnProperty.call(za,s))}get variables(){return[]}get functions(){return[]}collapse(){return this}toString(){return""}toVoice(s={}){return""}toMathML(s={}){return""}},Va=new Set;function Ra(s,t,e=!1){var i;let n=(i=t[s])!=null?i:za[s];if(n===void 0)throw ot.undefinedVariable(s);if(typeof n=="string"||n instanceof ss){if(e||Va.clear(),Va.has(s))throw ot.evalLoop(s);return Va.add(s),typeof n=="string"&&(n=Et.parse(n)),n.evaluate(t,!0)}else return typeof n=="function"?n():n}var Gi=class extends ss{constructor(s){super(),this.n=s}evaluate(){return this.n}toString(){return`${this.n}`}toVoice(){return`${this.n}`}toMathML(){return`${this.n}`}},Zs=class extends ss{constructor(s){super(),this.i=s}evaluate(s={},t){return Fc(Ra(this.i,s,t))}interval(s={},t){return qc(Ra(this.i,s,t))}toMathML(){return`${this.i}`}substitute(s={}){return s[this.i]||this}get variables(){return[this.i]}toString(){return this.i}toVoice(){return this.i in Ys?Ys[this.i]:this.i.length===1?`_${this.i}_`:this.i}},og=class extends ss{constructor(s){super(),this.s=s}evaluate(s={},t){return Fc(Ra(this.s,s,t))}toString(){return`"${this.s}"`}toVoice(){return this.s}toMathML(){return`${this.s}`}},Hc=class extends ss{toString(){return" "}toMathML(){return""}},Ce=class extends ss{constructor(s){super(),this.o=s}toString(){return this.o.replace("//","/")}toVoice(){return Ys[this.o]||this.o}get functions(){return[this.o]}toMathML(){let s=_c(this.toString());return`${s}`}},Lc=[-1/0,1/0],Ks=[NaN,NaN],bs=Math.PI/2,Da=Math.PI*2,ht=(s,t)=>[s-Number.EPSILON,t+Number.EPSILON],xs=(...s)=>ht(Math.min(...s),Math.max(...s)),ag=s=>Math.abs(s[1]-s[0]);var Ws=s=>isNaN(s[0])||isNaN(s[1]),Oc=s=>!isFinite(s[0])&&s[0]===s[1],hg=(s,t)=>nt(t,s[0]-Number.EPSILON,s[1]+Number.EPSILON),tr=s=>hg(s,0),Me={add:(...s)=>s.reduce((t,e)=>t+e,0),sub:(...s)=>s.length>1?s[0]-s[1]:-s[0],mul:(...s)=>s.reduce((t,e)=>t*e,1),div:(s,t)=>s/t,abs:s=>Math.abs(s),round:s=>Math.round(s),floor:s=>Math.floor(s),ceil:s=>Math.ceil(s),max:(...s)=>Math.max(...s),min:(...s)=>Math.min(...s),mod:(s,t)=>s%t,lcm:(...s)=>Ls(...s),gcd:(...s)=>xe(...s),gcf:(...s)=>xe(...s),sup:(s,t)=>Math.pow(s,t),log:(s,t)=>Math.log(s)/(t===void 0?1:Math.log(t)),exp:s=>Math.exp(s),ln:s=>Math.log(s),sqrt:s=>Math.sqrt(s),root:(s,t)=>Math.pow(s,1/t),sin:s=>Math.sin(s),cos:s=>Math.cos(s),tan:s=>Math.tan(s),sec:s=>1/Math.cos(s),csc:s=>1/Math.sin(s),cot:s=>1/Math.tan(s),cosec:s=>Me.csc(s),cotan:s=>Me.cot(s),arcsin:s=>Math.asin(s),arccos:s=>Math.acos(s),arctan:s=>Math.atan(s),sinh:s=>Math.sinh(s),cosh:s=>Math.cosh(s),tanh:s=>Math.tanh(s),sech:s=>1/Math.cosh(s),csch:s=>1/Math.sinh(s),coth:s=>1/Math.tanh(s),cosech:s=>Me.csch(s)};function Qn(s,t){if(s[0]>0)return t[0]>=0?ht(s[0]**t[0],s[1]**t[1]):xs(s[0]**t[0],s[0]**t[1],s[1]**t[0],s[1]**t[1]);let e=t[0];return Number.isInteger(e)&&e===t[1]?e===0?[tr(s)?0:1,1]:e%2?ht(s[0]**e,s[1]**e):tr(s)?[0,Math.max(s[0]**e,s[1]**e)]:xs(s[1]**e,s[0]**e):Ks}function Rc(s,t=Da){let e=Math.floor(s[0]/t)*t;return[s[0]-e,s[1]-e]}var F={add:(...s)=>ht(N(s.map(t=>t[0])),N(s.map(t=>t[1]))),sub:(s,t)=>t!==void 0?ht(s[0]-t[1],s[1]-t[0]):ht(-s[1],-s[0]),mul:(s,...t)=>(t.length>1&&(t=[F.mul(...t)]),xs(s[0]*t[0][0],s[0]*t[0][1],s[1]*t[0][0],s[1]*t[0][1])),div:(s,t)=>tr(t)?Lc:xs(s[0]/t[0],s[0]/t[1],s[1]/t[0],s[1]/t[1]),abs:s=>tr(s)?ht(0,Math.max(-s[0],s[1])):xs(Math.abs(s[0]),Math.abs(s[1])),round:s=>ht(Math.round(s[0]),Math.round(s[1])),floor:s=>ht(Math.floor(s[0]),Math.floor(s[1])),ceil:s=>ht(Math.ceil(s[0]),Math.ceil(s[1])),max:(...s)=>ht(Math.max(...s.map(t=>t[0])),Math.max(...s.map(t=>t[1]))),min:(...s)=>ht(Math.min(...s.map(t=>t[0])),Math.min(...s.map(t=>t[1]))),mod:(s,t)=>{if(Ws(s)||Ws(t))return Ks;let e=s[0]/(s[0]<0?t[0]:t[1]);return e=e<0?Math.ceil(e):Math.floor(e),F.sub(s,F.mul(t,[e,e]))},lcm:(...s)=>xs(Ls(...s.map(t=>t[0]))),gcd:(...s)=>xs(xe(...s.map(t=>t[0]))),gcf:(...s)=>F.gcd(...s),sup:(s,t)=>Qn(s,t),log:(s,t)=>(t!==void 0&&F.div(F.log(s),F.log(t)),ht(s[0]<=0?-1/0:Math.log(s[0]),Math.log(s[1]))),exp:s=>Qn([Math.E,Math.E],s),ln:s=>F.log(s),sqrt:s=>Qn(s,[.5,.5]),root:(s,t)=>Qn(s,F.div([1,1],t)),sin:s=>F.cos(F.sub(s,[bs,bs])),cos:s=>Ws(s)||Oc(s)?Ks:ag(s)>=Da-Number.EPSILON?[-1,1]:(s=Rc(s),s[0]>Math.PI+Number.EPSILON?F.sub(F.cos(F.sub(s,[Math.PI,Math.PI]))):s[1]Ws(s)||Oc(s)?Ks:(s=Rc(s,Math.PI),s[0]>bs+Number.EPSILON&&(s=F.sub(s,[Math.PI,Math.PI])),s[0]<-bs+Number.EPSILON||s[1]>bs-Number.EPSILON?Lc:ht(Math.tan(s[0]),Math.tan(s[1]))),sec:s=>F.div([1,1],F.cos(s)),csc:s=>F.div([1,1],F.sin(s)),cot:s=>F.div([1,1],F.tan(s)),cosec:s=>F.csc(s),cotan:s=>F.cot(s),arcsin:s=>Ws(s)||s[1]<-1||s[0]>1?Ks:ht(s[0]<=-1?-bs:Math.asin(s[0]),s[1]>=1?bs:Math.asin(s[1])),arccos:s=>Ws(s)||s[1]<-1||s[0]>1?Ks:ht(s[1]>=1?0:Math.acos(s[1]),s[0]<=-1?Math.PI:Math.acos(s[0])),arctan:s=>ht(Math.atan(s[0]),Math.atan(s[1])),sinh:s=>ht(Math.sinh(s[0]),Math.sinh(s[1])),cosh:s=>s[1]<0?ht(Math.cosh(s[1]),Math.cosh(s[0])):s[0]>0?ht(Math.cosh(s[0]),Math.cosh(s[1])):ht(1,Math.cosh(Math.max(-s[0],s[1]))),tanh:s=>ht(Math.tanh(s[0]),Math.tanh(s[1])),sech:s=>F.div([1,1],F.cosh(s)),csch:s=>F.div([1,1],F.sinh(s)),coth:s=>F.div([1,1],F.tanh(s)),cosech:s=>F.csch(s)},Jn=K("+ \u2212 * \xD7 \xB7 / \xF7 // sup sub subsup"),Dc=K("sub sup subsup"),Ia=',';function jc(s,t){return Jn.includes(t)?s instanceof er?!0:!(s instanceof jt)||!Jn.includes(s.fn)?!1:Dc.includes(s.fn)&&Dc.includes(t)?!0:Jn.indexOf(t)>Jn.indexOf(s.fn):!1}function lg(s,t,e){return jc(s,t)?`${e}`:e}function es(s,t){return s instanceof er||s instanceof jt?`${t}`:t}function Nc(s){return s==="2"?"squared":s==="3"?"cubed":`to the power of ${s}`}var jt=class Na extends ss{constructor(t,e=[]){super(),this.fn=t,this.args=e}evaluate(t={}){let e=this.args.map(i=>i.evaluate(t));if(this.fn in t){let i=t[this.fn];if(typeof i=="function")return i(...e);if(typeof i=="number"&&e.length===1)return Me.mul(i,e[0]);throw ot.uncallableExpression(this.fn)}if(this.fn==="+")return Me.add(...e);if(this.fn==="\u2212")return Me.sub(...e);if(["*","\xB7","\xD7"].includes(this.fn))return Me.mul(...e);if(this.fn==="/")return Me.div(...e);if(this.fn==="sup")return Me.sup(...e);if($s(this.fn))return Me[this.fn](...e);if(this.fn==="(")return e[0];throw ot.undefinedFunction(this.fn)}interval(t={}){let e=this.args.map(i=>i.interval(t));if(this.fn in t){let i=t[this.fn];if(typeof i=="function")return re(i(...e.map(n=>n[0])),2);if(typeof i=="number"&&e.length===1)return F.mul([i,i],e[0]);if(Array.isArray(i)&&e.length===1)return F.mul(i,e[0]);throw ot.uncallableExpression(this.fn)}if(this.fn==="+")return F.add(...e);if(this.fn==="\u2212")return F.sub(...e);if(["*","\xB7","\xD7"].includes(this.fn))return F.mul(...e);if(this.fn==="/")return F.div(...e);if(this.fn==="sup")return F.sup(...e);if($s(this.fn))return F[this.fn](...e);if(this.fn==="(")return e[0];throw ot.undefinedFunction(this.fn)}substitute(t={}){return new Na(this.fn,this.args.map(e=>e.substitute(t)))}collapse(){return this.fn==="("?this.args[0].collapse():new Na(this.fn,this.args.map(t=>t.collapse()))}get simplified(){return this}get variables(){return Wt(ye(this.args.map(t=>t.variables)))}get functions(){return Wt([this.fn,...ye(this.args.map(t=>t.functions))])}toString(){let t=this.args.map(e=>jc(e,this.fn)?`(${e.toString()})`:e.toString());return this.fn==="\u2212"?t.length>1?t.join(" \u2212 "):`\u2212${t[0]}`:this.fn==="sup"?t.join("^"):this.fn==="sub"?t.join("_"):this.fn==="subsup"?`${t[0]}_${t[1]}^${t[2]}`:K("+ * \xD7 \xB7 / = < > \u2264 \u2265 \u2248 \u225F \u2260").includes(this.fn)?t.join(` ${this.fn} `):_(this.fn,"(","[","{")?this.fn+this.args.join(", ")+Oa[this.fn]:_(this.fn,"!","%")?t[0]+this.fn:`${this.fn}(${t.join(", ")})`}toMathML(t={}){let e=this.args.map(r=>r.toMathML(t)),i=this.args.map((r,o)=>lg(r,this.fn,e[o]));if(this.fn in t){let r=e.map((o,a)=>({toString:()=>o,val:this.args[a]}));return t[this.fn](...r)}if(this.fn==="\u2212")return i.length>1?i.join('\u2212'):`\u2212${i[0]}`;if(_(this.fn,"+","=","<",">","\u2264","\u2265","\u2248","\u225F","\u2260")){let r=_c(this.fn);return i.join(`${r}`)}if(_(this.fn,"*","\xD7","\xB7")){let r=i[0];for(let o=1;o\xD7':"")+i[1]}return r}if(this.fn==="//")return i.join('/');if(this.fn==="sqrt")return`${i[0]}`;if(_(this.fn,"/","root")){let r=this.fn==="/"?"mfrac":"mroot",o=this.args.map((a,h)=>es(a,e[h]));return`<${r}>${o.join("")}`}if(_(this.fn,"sup","sub")){let r=[es(this.args[0],i[0]),es(this.args[1],e[1])];return`${r.join("")}`}return this.fn==="subsup"?`${[es(this.args[0],i[0]),es(this.args[1],e[1]),es(this.args[2],e[2])].join("")}`:_(this.fn,"(","[","{")?`${i.join(Ia)}`:_(this.fn,"!","%")?`${i[0]}${this.fn}`:this.fn==="abs"?`${i.join(Ia)}`:this.fn==="bar"?`${es(this.args[0],i[0])}\u203E`:this.fn==="vec"?`${es(this.args[0],i[0])}\u2192`:`${this.fn}${i.join(Ia)}`}toVoice(t={}){let e=this.args.map(n=>n.toVoice(t)),i=e.join(" ");if(this.fn in t){let n=e.map((r,o)=>({toString:()=>r,val:this.args[o]}));return t[this.fn](...n)}return _(this.fn,"(","[","{")?i:this.fn==="sqrt"?`square root of ${i}`:this.fn==="%"?`${i} percent`:this.fn==="!"?`${i} factorial`:this.fn==="/"?`${e[0]} over ${e[1]}`:this.fn==="//"?`${e[0]} divided by ${e[1]}`:this.fn==="sub"?i:this.fn==="subsup"?`${e[0]} ${e[1]} ${Nc(e[2])}`:this.fn==="sup"?`${e[0]} ${Nc(e[1])}`:Ys[this.fn]?e.join(` ${Ys[this.fn]} `):$s(this.fn)?`${this.fn} ${i}`:`${this.fn} of ${i}`}},er=class extends ss{constructor(s){super(),this.items=s}evaluate(s={}){return this.collapse().evaluate(s)}interval(s={}){return this.collapse().interval(s)}substitute(s={}){return this.collapse().substitute(s)}get simplified(){return this.collapse().simplified}get variables(){return Wt(Nh(...this.items.map(s=>s.variables)))}get functions(){return this.collapse().functions}toString(){return this.items.map(s=>s.toString()).join(" ")}toMathML(s={}){return this.items.map(t=>t.toMathML(s)).join("")}toVoice(s={}){return this.items.map(t=>t.toVoice(s)).join(" ")}collapse(){return Ga(this.items).collapse()}};function La(s,t){if(t===2)return new og(s);if(!(!s||!t)){if(t===1&&s.length>1)return new Hc;if(t===3){if(isNaN(+s))throw ot.invalidExpression();return new Gi(+s)}if(t===4)return s in Ni?new Zs(Ni[s]):s in Xs?new Ce(Xs[s]):new Zs(s);if(t===5)return s in Xs?new Ce(Xs[s]):new Ce(s)}}function cg(s){let t=[],e="",i=0;for(let r of s){if(r==='"'){let a=i===2?0:2,h=La(e,i);h&&t.push(h),e="",i=a;continue}else if(i===2){e+=r;continue}let o=r.match(/[0-9.]/)?3:tg.includes(r)?4:ig.includes(r)?5:r.match(/\s/)?1:0;if(!o)throw ot.invalidCharacter(r);if(!i||i===3&&o!==3||i===4&&o!==4&&o!==3||i===5&&!(e+r in Xs)||i===1&&o!==1){let a=La(e,i);a&&t.push(a),e="",i=o}e+=r}let n=La(e,i);return n&&t.push(n),t}function pg(s){return s.length>1?new er(s):s[0]instanceof Ce?new er(s):s[0]}function dg(s,t){let e=[[]];for(let i of s)t(i)?e.push([]):O(e).push(i);return e}function Gt(s,t){return s instanceof Ce&&K(t).includes(s.o)}function Di(s){return s instanceof jt&&s.fn==="("?s.args[0]:s}function sr(s,t){if(Gt(s[0],t))throw ot.startOperator(s[0]);if(Gt(O(s),t))throw ot.endOperator(O(s));for(let e=1;eGt(d,","));a.push(new jt(c,u.map(Gc)))}else Gt(n,"( [ {")?e.push([n]):O(e).push(n)}if(e.length>1)throw ot.unclosedBracket(O(e)[0].o);return Gc(e[0])}function zc(s,t,e=!1){let i=[],n=[],r=!1;function o(){if(r)throw ot.invalidExpression();n.length&&(i.push(n.length>1?new jt(t[0],n):n[0]),n=[])}for(let a of s)if(Gt(a,t)){if(r||!n.length)throw ot.invalidExpression();r=!0}else if(a instanceof Ce)o(),i.push(a),r=!1;else{let h=!e||a instanceof Gi;if(n.length&&!r&&h)throw ot.invalidExpression();n.push(a),r=!1}return o(),i}function Ga(s){if(s=s.filter(e=>!(e instanceof Hc)),!s.length)throw ot.invalidExpression();let t=s.findIndex(e=>Gt(e,"= < > \u2264 \u2265 \u225F \u2260"));if(t===0)throw ot.startOperator(s[0]);if(t===s.length-1)throw ot.endOperator(s[0]);if(t>0){let e=Ga(s.slice(0,t)),i=Ga(s.slice(t+1));return new jt(s[t].o,[e,i])}if(Gt(s[0],"%!"))throw ot.startOperator(s[0]);for(let e=0;e1)throw ot.invalidExpression();return s[0]}function fg(s,t=!1,e){let i=ug(cg(s),e);return t?i.collapse():i}function mg(s,t){try{let e=Wt([...s.variables,...t.variables]),i=s.collapse(),n=t.collapse(),r=0;for(let o=0;o<5;++o){let a={};for(let c of e)a[c]=za[c]||Math.random()*5;let h=i.evaluate(a),l=n.evaluate(a);if(!(isNaN(h)||isNaN(l))){if(!x(h,l))return!1;r+=1}}return!!r}catch(e){return!1}}var Et={numEquals:mg,parse:Oe(fg)};var Uc='
';var gg=/[0-9+\-*/()^\s]+/g,vg=os(_t.shuffle(["happy","spongebob","sloth","party","robot","excited","cute","highfive1","applause","highfive2"])),wg=os(_t.shuffle(["minions","panther","dog","snape","what","door","horrible"]));function Ba(s,t,e={}){let i=m("div",{class:"msg-wrap","data-display":"flex"}),n=m("div",{class:"msg "+t},i);return e.class&&n.addClass(e.class),e.visible||i.hide(),_(t,"hint","question")?n.html=s:t==="img"?n.css("background-image",`url(${s})`):t==="video"&&m("iframe",{src:s,allowfullscreen:!0},n),i}var ir=class extends E{constructor(){super(...arguments);this.recentMessages=[];this.isOpen=!1;this.queuePromise=Promise.resolve()}ready(){var r;this.$course=this.parents("x-course")[0],this.hints=this.$course?JSON.parse(this.$course.$("#hints").text):{};let e=window.user;this.correct=os(_t.shuffle(this.hints.correct||[])),this.incorrect=os(_t.shuffle(this.hints.incorrect||[])),this.$toasts=this.$(".toasts"),this.$chat=this.$(".chat"),this.$chatBody=this.$(".chat-body"),this.$toasts.on("click",o=>{o.handled||this.open()}),this.$(".close").on("click",()=>this.close());let i=this.$(".chat-footer");if(this.$query=i.$(".input"),this.$query.onKey("Enter",o=>{o.preventDefault(),this.askQuestion(this.$query.text.trim()),this.$query.text=""}),this.$query.on("focus",()=>i.addClass("focus")),this.$query.on("blur",()=>i.removeClass("focus")),this.$(".hint").on("click",()=>{this.queue(this.hints.tutorial1),this.queue(e?this.hints.tutorial2:this.hints.account)}),this.$course&&((r=this.$course.userData)!=null&&r.messages))for(let o of this.$course.userData.messages)this.$chatBody.append(Ba(o.content,o.kind||"hint",{visible:!0}));if(!b.getCookie("sessionWelcome")&&this.$course){b.setCookie("sessionWelcome",1,60*60*4);let o=new Date().getHours(),a=o<12?"Morning":o<18?"Afternoon":"Evening";e?setTimeout(()=>this.showHint(`welcome${a}Named`,{variables:{name:e.shortName}}),3e3):b.getCookie("welcome")?(setTimeout(()=>this.showHint(`welcome${a}`),3e3),setTimeout(()=>this.queue(this.hints.account),4500)):(b.setCookie("welcome",1),setTimeout(()=>this.queue(this.hints.welcome),3e3),setTimeout(()=>this.queue(this.hints.tutorial1),4500))}}open(){this.isOpen||(this.isOpen=!0,this.$chat.enter("slide-up",200),this.$chatBody.scrollTop=this.$chatBody.scrollHeight,this.trigger("open"))}close(){this.isOpen&&(this.isOpen=!1,this.$query.blur(),this.trigger("close"),this.$chat.exit("slide-down",200))}queue(e,i="hint",n={}){this.queuePromise=this.queuePromise.then(()=>(this.display(e,i,n),wi(500)))}display(e,i="hint",n={}){let r=n.timeout||8e3;if(b.width<640&&(r*=.7),(n.toast==null?!0:n.toast)&&!this.isOpen){let h=Ba(e,i,n);h.setAttr("role","alert"),this.$toasts.append(h),h.enter("reveal-right"),setTimeout(()=>h.exit("reveal-right",400,0,!0),r),this.on("open",()=>h.exit("reveal",200,0,!0))}let a=Ba(e,i,{class:n.class,visible:!this.isOpen});this.$chatBody.append(a),this.isOpen&&(a.enter("reveal",300),pt(()=>this.$chatBody.scrollTop=this.$chatBody.scrollHeight,200))}showHint(e,i={}){if(_(e,"correct","incorrect")){let r=e==="correct"?this.correct():this.incorrect(),o=e==="correct"?3e3:5e3;if(this.queue(r,"hint",{class:i.class||e,timeout:o}),Math.random()<.2){let a=e==="correct"?vg():wg();this.queue(`/images/gifs/${a}.gif`,"img",{timeout:o})}return{text:r}}let n=this.hints[e]||e;if(i.variables)for(let[r,o]of Object.entries(i.variables))n=n.replace(new RegExp("\\$"+r,"g"),o);return!i.force&&this.recentMessages.includes(e)?{text:n}:(this.recentMessages.push(e),setTimeout(()=>this.recentMessages.shift(),1e4),i.store!==!1&&this.$course&&this.$course.saveProgress({hints:[{content:n,kind:"hint"}]}),this.queue(n,"hint",{class:i.class}),{text:n})}askQuestion(e){if(!e)return;this.queue(e,"question"),this.$course&&this.$course.log("Tutor","ask",e);let i=(e.match(gg)||[]).filter(n=>n.length>=3&&!n.match(/^[\s0-9]+$/));if(i.length)try{let n=Et.parse(i[0],!0),r=Et.parse("="+n.evaluate());return this.queue(`${n.toMathML()}${r.toMathML()}`)}catch(n){console.log("Parse Error:",i[0])}this.$chatBody.addClass("loading"),Ne(this.attr("api"),{query:e}).then(n=>{this.$chatBody.removeClass("loading");let r=JSON.parse(n);for(let o of r)this.queue(o.content,o.kind)}).catch(n=>{this.$chatBody.removeClass("loading"),this.queue(this.hints.serverError),console.error("Tutor Error:",n)})}};ir=T([S("x-tutor",{template:Uc})],ir);var Wc='
';var Kc=m("div",{class:"var-overlay"},C),nr=class extends E{constructor(){super(...arguments);this.valueChange=!1}ready(){let e=this.attr("bind");if(!e)return;let[i,n,r]=e.split("|");[this.min,this.max,this.step]=r.split(",").map(l=>+l),this.name=i,this.model=this.getParentModel(),this.$(".content").bindModel(this.model),this.$progress=this.$(".progress"),this.setValue(+n);let o=20*(b.isMobile?1.5:1)/B((this.max-this.min)/this.step/12,1,3),a=0,h=0;for(let l of this.$$(".left, .right")){let c=l.hasClass("left")?-this.step:this.step;l.on("click",()=>{this.setValue(this.value+c),this.trigger("slide-end")})}ds(this,{start:l=>{a=l.x,h=this.value,this.addClass("on"),this.valueChange=!1,Kc.show(),Xt.addClass("grabbing")},move:l=>{let c=(l.x-a)/o;this.setValue(h+Dt(c)*this.step)},end:()=>{this.removeClass("on"),this.valueChange&&this.trigger("slide-end"),Kc.hide(),Xt.removeClass("grabbing")}})}setup(e,i){this.one("slide-end",()=>e.score(i))}setValue(e){let i=Dt(B(e,this.min,this.max),2);if(i===this.value)return;this.value=i,this.valueChange=!0,this.model&&(this.model[this.name]=i);let n=this.max-this.min;this.$progress.css("width",116*(i-this.min)/n+"px")}};nr=T([S("x-var",{template:Wc})],nr);var Xc='';var rr=class extends E{constructor(){super(...arguments);this.visible=!0}ready(){this.on("click",()=>{this.play(),setTimeout(()=>this.trigger("play"),400)})}play(){this.visible&&(this.visible=!1,this.exit("pop",400))}reset(){this.visible||(this.visible=!0,setTimeout(()=>this.enter("pop"),400))}};rr=T([S("x-play-btn",{template:Xc})],rr);var or=class extends E{constructor(){super(...arguments);this.playing=!1}ready(){this.$icon=this.$("x-icon"),this.$("button").on("click",()=>this.toggle())}toggle(){this.playing?this.pause():this.play()}play(){this.playing||(this.playing=!0,this.$icon.setAttr("name","pause"),this.trigger("play"))}pause(){this.playing&&(this.playing=!1,this.$icon.setAttr("name","play"),this.trigger("pause"))}};or=T([S("x-play-toggle",{template:''})],or);var Yc='
';function Zc(s){let t=Math.floor(s/60),e=Math.floor(s%60);return t+":"+(e<10?"0":"")+e}var ar=class extends E{ready(){let t=this.attr("src"),e=this.$(".video-wrap"),i=this.$("video"),n=this.attr("width"),r=this.attr("height");this.css("width",n+"px"),e.css("padding-bottom",+r/+n*100+"%"),i.setAttr("poster",this.attr("poster")||t.replace(/mp4$/,"jpg")),this.hasAttr("loop")&&(i._el.loop=!0),this.hasAttr("audio")||(i._el.muted=!0),i._el.preload=this.attr("preload")==="no"?"metadata":"auto",m("source",{src:t,type:"video/mp4"},i),this.hasAttr("credit")&&(this.$(".credit").text=this.attr("credit"));let o=this.$(".bar"),a=this.$(".progress"),h=this.$(".buffer"),l=this.$(".timecode"),c=new fs(this.$(".handle"),{$parent:o,moveY:!1}),u=this.video=i._el,d=this.width-110;b.onResize(()=>d=this.width-110),i.on("canplay",()=>{l.text=Zc(+u.duration)}),i.on("timeupdate",()=>{let f=u.currentTime/u.duration;a.css("width",f*100+"%"),l.text=Zc(+u.currentTime),c.setPosition(f*d,0),this.trigger("timeupdate",u.currentTime)}),i.on("progress",()=>{if(u.buffered.length<=0||u.duration<=0)return;let v=u.buffered.end(u.buffered.length-1)/u.duration*100;h.css("width",v+"%")}),i.on("ended",()=>{u.pause(),this.removeClass("playing"),this.trigger("end")});let g=()=>u.paused?this.play():this.pause(),w=f=>this.setTime(f/d*u.duration);this.hasAttr("hover")?(i.on("mouseover touchstart",()=>this.play()),i.on("mouseout touchend touchcancel",()=>this.pause())):i.on("click",g),this.hasAttr("controls")&&(this.$(".controls").show(),this.$(".play-pause-btn").on("click",g),c.on("start",()=>this.pause()),c.on("drag",({posn:f})=>w(f.x)),o.on("click",f=>w(f.offsetX)))}setTime(t){this.video.currentTime=t}play(){this.video.play(),this.addClass("playing"),this.trigger("play")}pause(){this.video.pause(),this.removeClass("playing")}};ar=T([S("x-video",{template:Yc})],ar);var hr=class extends E{constructor(){super(...arguments);this.isCompleted=!1;this.isReady=!1}created(){this.userData=window.progressData||JSON.parse(this.$("#userdata").text)||{},this.$steps=this.$$("x-step");for(let e of this.$steps)e.on("score",()=>this.trigger("score"));this.data.audio&&(this.audio=new En(this.data.audio))}ready(){this.$footer=this.$("footer"),this.$skipStep=this.$footer.$(".skip-step"),this.$progress=this.$(".sidebar-row.active x-progress"),this.$tutor=this.$("x-tutor"),this.$stepsWrap=this.$(".steps");let e=this.findStep(b.getHash()),i=this.findStep(this.userData.activeStep);this.$activeStep=i||this.$steps[0];for(let r of this.$steps){if(r.show(),r===this.$activeStep)break;r.complete()}if(this.userData.completed||b.getHash()==="full"||this.data.reveal)this.complete();else for(;this.$activeStep&&this.$activeStep.isReady&&!this.isCompleted;)this.nextStep();(e||i&&!this.userData.completed)&&this.goToStep(e||i,!1),this.$(".section-dev")&&this.complete();let n=this.$(".reveal-banner");setTimeout(()=>{this.isCompleted||(n.removeClass("off"),this.on("score complete",()=>n.addClass("off")))},1500),n.$(".complete").one("click",()=>this.complete()),C.onKey("Space",r=>{r.preventDefault(),this.nextStep(),n.addClass("off")}),this.$footer.$(".skip").on("click",()=>this.nextStep()),this.$footer.$(".show-all").on("click",()=>this.complete()),this.$footer.show(),this.isReady=!0,setTimeout(()=>this.addClass("ready"))}nextStep(){if(this.isCompleted)return;let e=this.$activeStep,i=this.$stepsWrap.height;do{if(e.complete(),e=this.$steps[this.$steps.indexOf(e)+1],!e)return this.complete(!0);e.show()}while(e.isReady);this.$stepsWrap.animate({height:[i+"px","auto"]},800),this.$activeStep=e,this.saveProgress({activeStep:e.id})}goToStep(e,i=!0){let n=this.$stepsWrap.height;for(let a of this.$steps){if(a.isShown||(this.$activeStep=a),a.show(),e.isShown&&!a.isReady)break;a.complete()}let r=e.positionTop-Math.max(50,(b.height-e.height)/2);i?(this.$stepsWrap.animate({height:[n+"px","auto"]},800),C.scrollTo(r)):C.scrollTop=r;let o=O(this.$steps);if(o.isShown&&o.isReady)return this.complete();this.$activeStep&&this.saveProgress({activeStep:this.$activeStep.id})}complete(e=!1){if(this.isCompleted)return;this.isCompleted=!0,this.$steps.forEach(n=>n.complete()),this.$activeStep=void 0;let i=this.$footer.$(".next-section");e?(this.$skipStep.exit("fade",200),i&&i.enter("pop")):(this.$skipStep.hide(),i&&i.show()),this.trigger("complete"),this.saveProgress({completed:!0}),this.log("Course","complete")}findStep(e){for(let i of this.$steps)if(i.id===e)return i}saveProgress(e){if(!this.isReady)return;let n=N(this.$steps.map(r=>r.scores.size))/+this.data.goals||0;this.$progress.setProgress(n),Fl(`/course/${this.id}/${this.data.section}`,e)}log(e,i,n){if(window.ga&&this.isReady){let r=i+(n?":"+n:"");window.ga("send","event",e,r,this.id)}}};hr=T([S("x-course")],hr);var lr=class{constructor(){this.callbacks=[]}add(t){this.callbacks.push(t)}start(t=1e3){return pt(i=>{for(let n of this.callbacks)n(i)},t).promise}};function Qc(s,t){return s.every((e,i)=>x(e,t[i]))}function Jc(s,t){s.scale*=t.scale,s.x=s.x*t.scale+t.x,s.y=s.y*t.scale+t.y}function tp(s,t){return x(s.x,t.x)&&x(s.y,t.y)&&x(s.scale,t.scale)}function cr(s,t,e){if(e==="adding"){let i=s.strokeLength,n=t<.5?0:yt("cubic-in",t*2-1);s.css({"stroke-dasharray":i+"px","stroke-dashoffset":i*(1-n)+"px"})}else if(e==="deleting"){let i=s.strokeLength,n=t<.5?yt("cubic-in",2*t):1;s.css({"stroke-dasharray":i+"px","stroke-dashoffset":i*(2-n)+"px"})}}function ep(s,t){let e=[s],i=s.expr;for(;t.startsWith(i);){if(t===i)return e;let n=O(e).next;if(!n)return;e.push(n),i+=n.expr}}function sp(s,t,e=1){let i=e*Math.abs(t.x-s.x)/3,n=p.average(s,t).shift(0,i);return function(r){let o=(1-r)**2*s.x+2*r*(1-r)*n.x+r*r*t.x,a=(1-r)**2*s.y+2*r*(1-r)*n.y+r*r*t.y;return{x:o,y:a}}}function _a(s,t){return Math.max(t*s,.4)/s}function ze(s){return s instanceof Ae&&s.children.length>1||s instanceof zi?`(${s.expr})`:s.expr}function Qs(s,t){return t.length===1&&t[0].type==="mrow"?t[0]:new Ae(t,s)}var zt=class s{constructor(t,e,i,n){this.type=t;this.equation=i;this.$element=n;this.children=[];this.status="";this.value="";this.customColor="";this.roundedMotion=!1;this.width=0;this.height=0;this.baseline=0;this.transform={x:0,y:0,scale:1};this.currentDimensions=[0,0,0];this.currentWorldTransform={x:0,y:0,scale:1};this.addChildren(e),n&&i.$row.append(n)}get expr(){return""}get log(){let t=this.children.map(e=>e.log);return`<${this.type}>${t.join("")}`}get color(){return this.customColor||(this.parent?this.parent.color:"")}static create(t,e){let i=t.nodeName.toLowerCase();if(_(i,"mn","mi","mo","mtext")){if(t.textContent==="placeholder")return new Ha(e);let r=t.getAttribute("mathvariant")||void 0;return new pr(i,t.textContent||"",e,r)}if(!_(i,"mrow","mfrac","mfenced","msqrt","mroot","msub","msup","msubsup","munder","mover","munderover","mspace"))return new Ka(t,e);if(i==="mfenced"&&t.getAttribute("open")==="["){let r=t.children.length,o=ye(Array.from(t.children,h=>Array.from(h.children,l=>s.create(l,e)))),a=new Wa(o,e,r);return new dr([a],e)}let n=Array.from(t.children,r=>s.create(r,e));switch(i){case"mrow":return new Ae(n,e);case"mfrac":return n=n.map(r=>Qs(e,[r])),new ja(n,e);case"mfenced":return n=[Qs(e,n)],new dr(n,e);case"msqrt":return n=[Qs(e,n)],new ur(i,n,e);case"mroot":return n=n.map(r=>Qs(e,[r])),new ur(i,n,e);case"msub":case"msup":case"msubsup":return n=n.map(r=>Qs(e,[r])),new zi(i,n,e);case"munder":case"mover":case"munderover":return n=n.map(r=>Qs(e,[r])),new Ua(i,n,e);case"mspace":return new qa(e)}throw new Error(`Unknown element type tag ${t.nodeName}`)}get marginLeft(){return .1}get marginRight(){return .1}setTransform(t=0,e=0,i=1){this.transform.x=t,this.transform.y=e,this.transform.scale=i}get worldTransform(){let t=this,e=Object.assign({},this.transform);for(;t=t.parent;)Jc(e,t.transform);return e}get index(){return this.parent?this.parent.children.indexOf(this):-1}get next(){if(!this.parent)return;let t=this.parent.children.indexOf(this);return this.parent.children[t+1]}get prev(){if(!this.parent)return;let t=this.parent.children.indexOf(this);return this.parent.children[t-1]}addChildren(t,e=this.children.length){for(let i of this.children)i.type==="placeholder"&&i.deleteFromDom();for(let i of t)i.detach(),i.parent=this;this.children.splice(e,0,...t)}insertAfter(t){let e=this.parent.children.indexOf(this);this.parent.addChildren(t,e+1)}insertBefore(t){let e=this.parent.children.indexOf(this);this.parent.addChildren(t,e)}detach(){if(this.parent){let t=this.parent.children.indexOf(this);t>=0&&this.parent.children.splice(t,1),this.parent=void 0}}deleteFromDom(){this.parent&&this.detach(),this.$element&&this.$element.remove(),this.$element=void 0;for(let t of this.children.slice(0))t.deleteFromDom()}*parents(t=!1){let e=t?this:this.parent;for(;e;)yield e,e=e.parent}hasParent(t,e=!1){return At(this.parents(e),t)}hitTest(t){let{x:e,scale:i}=this.worldTransform,n=this.marginLeft*i*this.equation.fontSize,r=this.marginRight*i*this.equation.fontSize;if(nt(t.x,e-n,e+this.width*i+n+r))return this.hitTestChildren(t)||this}hitTestChildren(t){for(let e of this.children){let i=e.hitTest(t);if(i)return i}}measure(t=1){for(let e of this.children)e.measure(t)}clean(){for(let t of this.children)t.clean()}setStatus(t){this.status=t;for(let e of this.children)e.setStatus(t)}render(t){for(let h of this.children)h.render(t);if(!this.$element)return;let e=this.currentWorldTransform,i=this.currentWorldTransform=this.worldTransform,n=this.currentDimensions,r=this.currentDimensions=[this.width,this.height,this.baseline];if(tp(e,i)&&Qc(n,r)&&!this.status)return;if(!t){this.positionElement(i),this.drawElement(1,r[0],r[1],r[2],i.scale);return}this.status==="adding"&&this.positionElement(i);let o=i.y+this.baseline{if(!this.$element)return;let l=yt("cubic",h),c=_(this.status,"adding","deleting"),u=c?r[0]:tt(n[0],r[0],l),d=c?r[1]:tt(n[1],r[1],l),g=c?r[2]:tt(n[2],r[2],l),w=c?i.scale:tt(e.scale,i.scale,l);if(this.drawElement(h,u,d,g,w),!this.status){let f=a?a(l):p.interpolate(e,i,l);this.positionElement({x:f.x,y:f.y,scale:w})}})}positionElement(t){this.$element.setTransform(t,0,t.scale)}drawElement(t,e,i,n,r){}},yg="acegmnopqrsuvwxyz",Ps=1.1,Js=.2,Fa=new Set(["=","\u2248","<",">","\u2264","\u2265"]),bg=document.createElement("canvas"),ip=bg.getContext("2d"),xg=Oe((s,t)=>(ip.font=`${t}px "Source Sans Pro", sans-serif`,ip.measureText(s).width)),pr=class extends zt{constructor(e,i,n,r){super(e,[],n,m("text",{}));this.variant=r;this.setValue(i)}setValue(e){this.$element.text=this.value=e;let i=this.value.split("").every(r=>yg.includes(r));this.width=xg(e,this.equation.fontSize),this.height=(Ps-(i?.1:0))*this.equation.fontSize,this.baseline=this.height-Js*this.equation.fontSize;let n=this.type==="mtext"||this.variant==="normal";this.$element.setClass("font-normal",n||$s(this.value))}get expr(){return this.value==="xx"?'"xx"':this.type==="mtext"?`"${this.value}"`:this.value}get log(){return`<${this.type}>${this.value}`}get marginLeft(){if(this.type==="mo")return Fa.has(this.value)?this.equation.isDisplay?.5:.35:_(this.value,"\u2221","\u25B3","!","%","\u2019")||_(this.value,"\u2026","\xB0")&&this.prev&&this.prev.type==="mn"?0:.25;if(this.type==="mi"){if(this.prev&&this.prev.type==="mn")return .1;if(this.prev&&this.prev.type==="mi")return .05;if(this.prev&&this.prev.type==="mfrac")return .15}return 0}get marginRight(){return this.type==="mo"?this.equation.isDisplay&&Fa.has(this.value)?.5:_(this.value,"\u2221","\u25B3")?0:this.value==="\u2212"&&(!this.prev||Fa.has(this.prev.value))?.1:.25:0}positionElement(e){if(!this.$element)return;let i=(this.equation.fontSize-this.baseline)*e.scale;this.$element.setTransform({x:e.x,y:e.y-i},0,e.scale)}drawElement(e,i,n,r,o){this.status==="adding"?this.$element.setAttr("opacity",e<.5?0:yt("cubic-in",e*2-1)):this.status==="deleting"&&this.$element.setAttr("opacity",e<.5?1-yt("cubic-in",2*e):0),this.$element.css("stroke-width",(1-o)*1.5+"px"),this.$element.css("color",this.color||"currentColor")}},qa=class extends zt{constructor(t){super("mspace",[],t),this.height=(Ps-.1)*t.fontSize,this.baseline=this.height-Js*this.equation.fontSize,this.width=t.fontSize*.2}get expr(){return" "}},Ae=class extends zt{constructor(e,i,n,r=0){super("mrow",e,i);this.align=n;this.dx=r}addChildren(e,i=this.children.length){let n=[];for(let r of e)r.type==="mrow"?(n.push(...r.children),r.detach()):n.push(r);super.addChildren(n,i)}get expr(){return this.children.map(e=>e.expr).join(" ").replace(/− /,"\u2212")||"placeholder"}measure(e=1){if(super.measure(e),!this.children.length){this.height=this.width=this.baseline=0;return}this.baseline=Math.max(...this.children.map(n=>n.baseline)),this.height=this.baseline+Math.max(...this.children.map(n=>n.height-n.baseline));let i=0;for(let[n,r]of this.children.entries())r.setTransform(i,this.baseline-r.baseline),i+=r.width,nr.expr===this.align);n&&(this.transform.x=this.dx-n.transform.x-n.width/2)}this.width=i}},Ha=class extends zt{constructor(t){let e=t.fontSize,i=`M${.1*e} ${.3*e}h${e/2}v${e/2}h-${e/2}Z`,n=m("path",{class:"placeholder",d:i});super("placeholder",[],t,n),this.width=.7*e,this.height=Ps*e,this.baseline=this.height-Js*e}get expr(){return"placeholder"}get marginLeft(){return 0}get marginRight(){return 0}},ja=class extends zt{constructor(t,e){super("mfrac",t,e,m("line"))}get expr(){return this.children.map(t=>ze(t)).join("/")}measure(t){let e=this.hasParent(a=>a.type==="mfrac"||a.type==="matrix"),i=_a(t,!this.equation.isDisplay||e?.66:1),n=.1*this.equation.fontSize,[r,o]=this.children;super.measure(t*i),this.width=(Math.max(r.width,o.width)+2*n)*i,this.height=(r.height+o.height)*i,this.baseline=r.height*i+this.equation.fontSize*(Ps/2-Js),r.setTransform((this.width-r.width*i)/2,0,i),o.setTransform((this.width-o.width*i)/2,r.height*i,i)}drawElement(t,e,i,n){let r=n-this.equation.fontSize*(Ps/2-Js);this.$element.setLine({x:0,y:r},{x:e,y:r}),this.$element.setAttr("stroke",this.color||"currentColor"),cr(this.$element,t,this.status)}hitTestChildren(t){let{scale:e,y:i}=this.worldTransform,n=this.baseline-this.equation.fontSize*(Ps/2-Js),r=t.y<=i+n*e,o=this.children[r?0:1];return o.hitTestChildren(t)||o}},zi=class extends zt{get expr(){let t=ze(this.children[0]);return this.type!=="msup"&&(t+="_"+ze(this.children[1])),this.type==="msup"&&(t+="^"+ze(this.children[1])),this.type==="msubsup"&&(t+="^"+ze(this.children[2])),t}measure(t){let[e,i,n]=this.children,r=this.type==="msup"?void 0:i,o=this.type==="msubsup"?n:this.type==="msup"?i:void 0,a=.05*this.equation.fontSize,h=_a(t,.65);e.measure(t),r&&r.measure(t*h),o&&o.measure(t*h);let l=o?o.height*h-.4*this.equation.fontSize:0,c=r?r.height*h-.5*this.equation.fontSize:0,u=o?o.width:0,d=r?r.width:0;this.width=e.width+a+Math.max(u,d)*h,this.height=e.height+l+c,this.baseline=e.baseline+l,e.setTransform(0,this.baseline-e.baseline),o&&o.setTransform(e.width+a,0,h),r&&r.setTransform(e.width+a,this.height-r.height*h,h)}clean(){if(super.clean(),this.children=this.children.filter(t=>t.type!=="mrow"||t.children.length),this.children.length===0)return this.detach();this.children.length===1&&(this.insertAfter(this.children),this.detach())}},Ua=class extends zt{get expr(){let t=this.children[0].expr;return this.type!=="munder"&&(t+="_"+ze(this.children[1])),this.type==="mover"&&(t+="^"+ze(this.children[1])),this.type==="munderover"&&(t+="^"+ze(this.children[2])),t}measure(t){super.measure(t)}},dr=class extends zt{constructor(t,e){super("mfenced",t,e,m("path"))}get expr(){return`(${this.children.map(t=>t.expr).join(",")})`}get marginLeft(){return .2}get marginRight(){return .2}measure(t){super.measure(t);let e=this.children[0];this.height=e.height+2,this.baseline=e.baseline+1;let i=1+this.height/this.equation.fontSize,n=.1*this.equation.fontSize;this.width=e.width+2*(i+n),e.setTransform(i+n,1)}drawElement(t,e,i){let n=Math.min(2+i/this.equation.fontSize,5),r=i-4,o=e-n,a=`M${n},2c${-2*n/3},${.15*r},${-n},${.32*r},${-n},${r/2}s${n/3},${.35*r},${n},${r/2}M${o},2c${2*n/3},${.15*r},${n},${.32*r},${n},${r/2}s${-n/3},${.35*r},${-n},${r/2}`;this.$element.setAttr("d",a),this.$element.css("stroke",this.color||"currentColor"),cr(this.$element,t,this.status)}clean(){super.clean(),this.children.length||this.detach()}},ur=class extends zt{constructor(t,e,i){super(t,e,i,m("path"))}get expr(){return`sqrt(${this.children.map(t=>t.expr).join(", ")})`}get marginLeft(){return .2}get marginRight(){return .2}measure(t){super.measure(t);let e=this.children[0];this.height=e.height+2,this.baseline=e.baseline+2;let i=Math.min(16,3+5*this.height/this.equation.fontSize),n=.05*this.equation.fontSize;this.width=e.width+i+2*n,e.setTransform(i+n,2)}drawElement(t,e,i){let n=Math.min(16,3+5*i/this.equation.fontSize),r=i-2,o=`M0,${.55*r}L${.18*n},${.51*r}L${.45*n},${r}L${n},2L${e},2`;this.$element.setAttr("d",o),this.$element.css("stroke",this.color||"currentColor"),cr(this.$element,t,this.status)}clean(){super.clean(),this.children.length||this.detach()}},Wa=class extends zt{constructor(e,i,n){super("matrix",e,i,m("g"));this.rows=n;this.cols=Math.floor(e.length/n)}get expr(){return`${this.children.map(e=>e.expr).join(", ")}`}measure(e){super.measure(e);let i=.6*this.equation.fontSize,n=z(a=>Math.max(...z(h=>this.children[a*this.cols+h].height,this.cols)),this.rows),r=z(a=>Math.max(...z(h=>this.children[h*this.cols+a].width,this.rows)),this.cols);this.height=N(n)+(this.rows-1)*i/2,this.width=N(r)+this.cols*i,this.baseline=(this.height+Ps*this.equation.fontSize)/2;let o=0;for(let a=0;a{this.checkForResize()&&this.equation.resize()}),(i=this.$body.$("x-blank, x-blank-mc"))==null||i.on("solve",n=>{Zt(()=>this.replace(n.solution,"#0f82f2"),n.restore?0:200)})}deleteFromDom(){var t;super.deleteFromDom(),(t=this.$body)==null||t.remove(),this.$body=void 0,this.$measure=void 0}replace(t,e){var r;let i=Number.isNaN(+t)?"mtext":"mn",n=new pr(i,t,this.equation);n.customColor=e,this.insertAfter([n]),(r=this.$body)==null||r.off("resize"),this.deleteFromDom(),this.equation.resize()}checkForResize(){var n,r;let t=this.height,e=this.width,i=this.baseline;return this.height=((n=this.$body)==null?void 0:n.height)||0,this.width=((r=this.$body)==null?void 0:r.width)||0,this.baseline=this.$measure.bounds.top-this.$body.bounds.top,!(x(t,this.height)&&x(e,this.width)&&x(i,this.baseline))}positionElement(t){var e,i;(e=this.$body)==null||e.css({left:t.x+"px",top:t.y+"px"}),x(t.scale,1)||(i=this.$body)==null||i.css("transform",`scale(${t.scale})`)}get expr(){var t;return`"${(t=this.$body)==null?void 0:t.text}"`}get log(){return`${this.expr}`}};var Be=class extends Re{constructor(e,i,n=0,r="=",o=18,a=!0){super();this.$row=e;this.$overlay=i;this.fontSize=o;this.isDisplay=a;this.isReady=!0;this.deletedNodes=new Set;this.root=new Ae([],this,r,n)}setValue(e){let i=Array.isArray(e)?e.map(n=>zt.create(n,this)):this.parse(e);for(;this.root.children.length;)this.root.children[0].deleteFromDom();this.root.addChildren(i),this.updateDescription(),this.resize()}updateDescription(){try{let e=Et.parse(this.root.expr).toVoice();this.$row.setAttr("aria-label",e)}catch(e){this.$row.setAttr("aria-label","Invalid expression: "+this.root.expr)}}resize(){this.root.measure(),this.root.render()}parse(e){var a;let i=new DOMParser,n=Et.parse(e).toMathML(),r=i.parseFromString(`${n}`,"text/xml");if(((a=r.firstChild)==null?void 0:a.nodeName)==="parsererror")throw new Error(r.firstChild.textContent);let o=r.firstChild.childNodes;return Array.from(o,h=>zt.create(h,this))}find(e){let[i,n]=e.split("`");i=i.replace(/[–-]/g,"\u2212");let r=+n||1,o=this.root.children.slice(0),a=0;for(;o.length;){let h=o.shift(),l=h instanceof Ae?void 0:ep(h,i);if(l&&(a+=1,a===r))return l;o.unshift(...h.children)}throw new Error(`Can't find element ${i}.`)}animate(e=1200){return D(this,null,function*(){this.isReady=!1,this.root.clean(),this.root.measure();let i=new lr;this.root.render(i),this.trigger("resize",{height:this.root.height});for(let n of this.deletedNodes)n.render(i);yield i.start(e);for(let n of this.deletedNodes)n.deleteFromDom();this.root.setStatus(""),this.deletedNodes.clear(),this.isReady=!0})}addTermAfter(e,i){let n=O(i?this.find(i):this.root.children),r=this.parse(e);n.insertAfter(r);for(let o of r)o.setStatus("adding");this.updateDescription()}addTermBefore(e,i){let n=i?this.find(i)[0]:this.root.children[0],r=this.parse(e);n.insertBefore(r);for(let o of r)o.setStatus("adding");this.updateDescription()}deleteTerm(e){for(let i of this.find(e))i.setStatus("deleting"),i.detach(),this.deletedNodes.add(i);this.updateDescription()}replaceTerm(e,i){let n=this.find(e),r=this.parse(i);n[0].insertBefore(r);for(let o of r)o.setStatus("adding");for(let o of n)o.setStatus("deleting"),o.detach(),this.deletedNodes.add(o);this.updateDescription()}moveTermAfter(e,i){let n=this.find(e);for(let o of n)o.roundedMotion=!0;O(i?this.find(i):this.root.children).insertAfter(n),this.updateDescription()}moveTermBefore(e,i){let n=this.find(e);for(let o of n)o.roundedMotion=!0;(i?this.find(i)[0]:this.root.children[0]).insertBefore(n),this.updateDescription()}moveTermToStart(e){let i=this.find(e);for(let n of i)n.roundedMotion=!0;this.root.children[0].insertBefore(i),this.updateDescription()}wrapTerms(e,...i){let n=i.map(o=>this.find(o));for(let o of n)for(let a of o)a.roundedMotion=!0;let r=this.parse(e);for(let o of r)o.setStatus("adding");n[0][0].insertBefore(r);for(let[o,a]of n.entries()){let h=this.find("$"+(o+1))[0];h.insertAfter(a),h.deleteFromDom()}this.updateDescription()}unwrapTerm(e,i=1){let n=this.find(e),r=n[0],o=1;for(;o<=i;)r=r.parent,r instanceof Ae&&(r=r.parent),o+=1;r.insertAfter(n),r.setStatus("deleting"),r.detach(),this.deletedNodes.add(r),this.updateDescription()}get leftSide(){let e=this.root.children.findIndex(i=>i.expr==="=");return this.root.children.slice(0,e-1)}get rightSide(){let e=this.root.children.findIndex(i=>i.expr==="=");return this.root.children.slice(e+1)}};var np='
';var rp=1200,$g=400,op=1200,ti=600,Bi=16,fr=class extends E{constructor(){super(...arguments);this.rows=[];this.isReady=!0;this.topOffset=4;this.currentHeight=0;this.currentStep=0;this.nextEvents={};this.backEvents={}}ready(){this.$svg=this.$("svg"),this.$lastRow=this.$svg.$("g"),this.$overlay=this.$(".overlay"),this.$legend=this.$(".legend-box"),this.$steps=this.$legend.$$("li"),this.$back=this.$(".back"),this.$next=this.$(".next");let e=+this.attr("dx")||0;this.equation=new Be(this.$lastRow,this.$overlay,e);let i=this.$(".math"),n=i?Array.from(i._el.children):[];this.equation.setValue(this.attr("expr")||n),this.currentHeight=this.topOffset+this.$lastRow.height+16,this.$svg.css("height",this.currentHeight+"px"),this.equation.on("resize",({height:o})=>{let a=this.topOffset+o+Bi;Math.abs(a-this.currentHeight)this.goBack()),this.$next.on("click",()=>this.goNext()),this.$steps[0].show(),b.onResize(()=>{let o=this.$svg.width/2;for(let a of[this.$lastRow,this.$overlay])a.css("transform",`translate(${o}px, ${this.topOffset}px)`);for(let a of this.rows)a.$el.css("transform",`translate(${o}px, ${a.top}px)`)});let r=this.$overlay.$$("x-blank, x-blank-mc");r.length&&(this.$next.addClass("hide"),Promise.all(r.map(o=>o.onPromise("solve"))).then(()=>setTimeout(()=>this.goNext(),rp)))}setup(e){this.one("next",({step:i})=>e.score("algebra-flow-"+(i-1)))}newRow(){return D(this,null,function*(){let e=this.$lastRow.copy(!0,!1),i=this.equation.root.height;this.rows.push({$el:e,height:i,top:this.topOffset}),this.$lastRow.insertBefore(e),b.redraw(),this.topOffset+=i+Bi,this.currentHeight=this.topOffset+i+Bi;for(let n of[this.$lastRow,this.$overlay])n.animate({transform:`translate(${this.$svg.width/2}px, ${this.topOffset}px)`},ti);yield this.$svg.animate({height:this.currentHeight+"px"},ti).promise})}hideLastRow(){return D(this,null,function*(){if(!this.rows.length)return;let e=this.rows.pop();this.topOffset=e.top;for(let i of[this.$lastRow,this.$overlay])i.animate({transform:`translate(${this.$svg.width/2}px, ${e.top}px)`},ti);this.currentHeight=e.top+this.$lastRow.height+Bi,this.$svg.animate({height:this.currentHeight+"px"},ti),yield e.$el.exit("fade",ti/2,ti/2).promise,e.$el.remove()})}onNextStep(e){this.nextEvents=e}onBackStep(e){this.backEvents=e}goNext(){return D(this,null,function*(){if(!this.isReady||!this.equation.isReady||this.currentStep>=this.$steps.length-1)return;this.isReady=!1;let e=this.currentStep+1;this.$steps[e].hasClass("new-row")&&(yield this.newRow(),yield wi($g)),e in this.nextEvents&&(yield this.nextEvents[e](this.equation),yield this.equation.animate(op),yield wi(rp)),yield this.go(e),this.trigger("next",{step:e}),this.isReady=!0})}goBack(){return D(this,null,function*(){if(!this.isReady||!this.equation.isReady||this.currentStep<=0)return;let e=this.currentStep-1;this.isReady=!1,this.currentStep in this.backEvents&&(yield this.backEvents[this.currentStep](this.equation),yield this.equation.animate()),this.$steps[this.currentStep].hasClass("new-row")&&this.hideLastRow(),yield this.go(e),this.trigger("back",{step:e}),this.isReady=!0})}go(e){return D(this,null,function*(){this.$steps[e].show();let i=this.$steps[e].height+"px";this.$steps[e].hide(),this.$legend.animate({height:i},800).promise.then(()=>this.$legend.css("height","auto"));let n=this.currentStep;this.currentStep=e,this.trigger("step",e),yield this.$steps[n].exit("fade",400).promise,this.$back.setClass("hide",e<=0),this.$next.setClass("hide",e>=this.$steps.length-1),yield this.$steps[e].enter("fade",400).promise})}};fr=T([S("x-algebra-flow",{template:np})],fr);var ap='
+
\u2212
\xD7
\xF7
\u03C0
';function cp(s){let t=s.prev;t&&_(t.tagName,"MO","MI","MN")?t.insertBefore(s):t?O(t.children).append(s):s.parent.hasClass("math")||(s.parent.prev?s.parent.prev.append(s):s.parent.parent.insertBefore(s))}function Pg(s){let t=s.next;if(t&&_(t.tagName,"MO","MI","MN"))return t.insertAfter(s);t?t.children[0].prepend(s):s.parent.hasClass("math")||(s.parent.next?s.parent.next.prepend(s):s.parent.parent.insertAfter(s))}function Tg(s){let t=s.parent;for(;t.parent.tagName!=="MFRAC"||!t.prev;){if(t.hasClass("math"))return;t=t.parent}t.prev.append(s)}function Sg(s){let t=s.parent;for(;t.parent.tagName!=="MFRAC"||!t.next;){if(t.hasClass("math"))return;t=t.parent}t.next.prepend(s)}function Eg(s){let t=s.prev,e=s.parent;if(t&&_(t.tagName,"MO","MI","MN"))t.remove(),e.children.length<=1&&e.addClass("empty");else if(!t&&!e.prev&&!e.hasClass("math")){let i=e.parent;i.insertBefore(s);for(let n of i.children)for(let r of n.children)i.insertBefore(r);i.remove(),s.parent.children.length<=1&&s.parent.addClass("empty")}else cp(s)}function Ts(s,t){t.insertBefore(s),t.parent.removeClass("empty"),s.children.length&&s.children[0].append(t)}function hp(s,t){"abcdefghijklmnopqrstuvwxyz\u03C0".includes(t)?Ts(m("mi",{text:t}),s):"0123456789.".includes(t)?Ts(m("mn",{text:t}),s):"+\u2212\xB1\xD7\xF7<>\u2264\u2265=%!".includes(t)?Ts(m("mo",{text:t,value:t}),s):t==="frac"?Ts(m("mfrac",{html:''}),s):t==="sqrt"?Ts(m("msqrt",{html:''}),s):_(t,"^","sup")?Ts(m("msup",{html:''}),s):t==="brackets"||"([{|".includes(t)?Ts(m("mfenced",{html:'',type:"("}),s):")]}".includes(t)&&!s.next&&s.parent.parent.tagName==="MFENCED"&&s.parent.parent.insertAfter(s)}function lp(s,t){let e=s.$$(`${t}:first-child, *:not(${t}) + ${t}`);for(let i of e)if(i.parent.tagName!=="MFRAC")for(;i.next&&i.next.tagName===t.toUpperCase();)i.text+=i.next.text,i.next.remove()}var Mg="This is not a valid mathematical expression.",Cg="Fill in all empty placeholders in the expression.",Ag={"+":"addition","\xD7":"multiplication","/":"fractions or division","\u2212":"subtraction",sqrt:"square roots","^":"powers"};function Ss(s,t){if(s instanceof Text)return s.textContent||"";if(s.hasClass("cursor"))return"";let e=s.childNodes;return s.tagName==="MI"?s.text+(t?" ":""):s.tagName==="MFENCED"?"("+Ss(e[0],t)+")":s.tagName==="MSUP"?"^("+Ss(e[0],t)+")":s.tagName==="MFRAC"?`(${Ss(e[0],t)})/(${Ss(e[1],t)})`:s.tagName==="MSQRT"?"sqrt("+Ss(e[0],t)+")":e.map(i=>Ss(i,t)).join("")}function kg(s,t){try{return{expr:Et.parse(s,!0,{variables:t})}}catch(e){return{error:e instanceof ot?e.message:Mg}}}function Vg(s,t,e){let i=s.variables;if(t.length){let n=i.find(o=>!t.includes(o));if(n){let o=zh(n,e||t);return o?`Did you mean \u201C${o}\u201D instead of \u201C${n}\u201D?`:`There shouldn\u2019t be a variable called \u201C${n}\u201D.`}let r=t.find(o=>!i.includes(o));if(r)return`Your expression should contain \u201C${r}\u201D.`}}function Ig(s,t){if(t.length){let e=s.functions.find(i=>!t.includes(i));if(e)return`This expression should not contain ${Ag[e]||"\u201C"+e+"\u201D"}.`}}function Lg(s,t,e=.001){try{return x(s.evaluate(),t.evaluate(),e)}catch(i){return!1}}var mr=class extends E{constructor(){super(...arguments);this.isDone=!1;this.shortVar=!1;this.lastAttempt="";this.errorCount=0;this.hints=[];this.fns=[];this.vars=[];this.validate=void 0}ready(){if(this.$math=this.$(".math"),this.$textarea=this.$("textarea"),this.$cursor=this.$(".cursor"),this.$error=this.$(".error-message"),this.solution=Et.parse(this.attr("solution")),this.hasAttr("numeric")&&(this.numeric=+this.attr("precision")||.01),this.vars=this.hasAttr("vars")?K(this.attr("vars")):this.solution?this.solution.variables:[],this.hasAttr("fns")&&(this.fns=K(this.attr("fns"))),this.solution&&this.fns.push(...this.solution.functions),this.fns.includes("/")&&!this.fns.includes("\xD7")&&this.fns.push("\xD7"),this.hasAttr("hints")&&(this.hints=K(this.attr("hints"))),this.hasAttr("substitutions")){this.substitutions={},this.autocomplete=this.vars.slice(0);for(let n of this.attr("substitutions").split("|"))if(n.trim()){let[r,o]=n.split(":");this.autocomplete.push(r.trim()),this.substitutions[r.trim()]=Et.parse(o)}}for(let n of["solution","precision","vars","fns","vars-required","substitutions"])this.removeAttr(n);this.shortVar=this.hasAttr("short-var");let e=K(this.attr("keys")||"+ \u2212 \xD7 \xF7 frac sup sqrt brackets"),i=this.$(".keys");for(let n of i.children)e.includes(n.data.type)?(n.on("pointerdown",r=>r.preventDefault()),n.on("pointerup",()=>{hp(this.$cursor,n.data.type),this.check()})):n.remove();this.on("pointerdown",n=>this.onPointerdown(n)),this.$textarea.on("focus",()=>this.onPointerdown()),this.$textarea.on("blur",()=>this.onBlur()),this.$textarea.on("key",n=>this.handleKey(n))}setup(e,i,n){var r;this.$step=e,(r=n==null?void 0:n.scores)!=null&&r.includes(i)&&this.solve(),this.on("solve",()=>{e.addHint("correct"),e.score(i)})}focus(){this.trigger("pointerdown")}onPointerdown(e){if(this.isDone)return;e&&e.preventDefault&&e.preventDefault(),this.addClass("active"),this.$textarea.focus();let i=e&&e.target?k(e.target):this;if(i.tagName==="X-EQUATION"||i.hasClass("math")){let n=this.$math.children,r=N(n.map(a=>a.outerWidth))/2;(e?It(e).x=5&&this.$step.addHint(`Hmmm\u2026 maybe try ${this.solution.toMathML()}?`)}check(){if(this.error=void 0,this.value=Ss(this.$math,this.shortVar).trim(),!this.value)return;if(this.$math.$(".empty"))return this.error=Cg;let e=kg(this.value,this.vars);if(e.error)return this.error=e.error;let i=this.substitutions?e.expr.substitute(this.substitutions):e.expr;if(this.numeric&&Lg(this.solution,i,this.numeric))return this.solve();if(this.validate){let o=this.validate(e.expr)||{};if(o.isCorrect)return this.complete(e.expr);if(o.error)return this.error=o.error}if(this.solution&&Et.numEquals(this.solution,i))return this.complete(e.expr);let n=Vg(i,this.vars,this.autocomplete);if(n)return this.error=n;let r=Ig(i,this.fns);if(r)return this.error=r}complete(e){this.isDone||(this.isDone=!0,this.removeClass("has-error active"),this.addClass("done"),this.$textarea.blur(),this.shortVar||lp(this.$math,"mi"),lp(this.$math,"mn"),this.trigger("solve",{expr:e}))}solve(){this.$math.removeClass("empty"),this.$math.html=this.solution.toMathML(),this.complete(this.solution)}};mr=T([S("x-equation",{template:ap})],mr);var Og={opacity:[0,1],transform:["translateX(-50px)","none"]},Rg={error:"You\u2019ve already had this expression before. Try simplifying it."},Dg="You have to fully simplify this expression. The correct solution is $0.",gr=class extends E{constructor(){super(...arguments);this.rowCount=1;this.previousAnswers=[];this.isSolved=!1;this.maxRows=6;this.steps=[];this.hints=[]}created(){this.$table=this.$("table tbody"),this.lastRowContent=this.$table.$("tr:last-child").html}ready(){this.hasAttr("max-rows")&&(this.maxRows=+this.attr("max-rows")),this.hasAttr("steps")&&(this.steps=this.attr("steps").split("|")),this.hasAttr("hints")&&(this.hints=this.attr("hints").split("|")),this.removeAttr("steps"),this.removeAttr("hints"),this.setupEquation(this.$("x-equation"))}setup(e,i,n){var r;this.$step=this.$equation.$step=e,(r=n==null?void 0:n.scores)!=null&&r.includes(i)&&this.solve(),this.on("solve",()=>{e.addHint("correct"),e.score(i)}),this.on("hint",o=>e.addHint(o))}setupEquation(e){this.$equation=e,this.$equation.$step=this.$step,e.one("solve",i=>this.onSolveRow(i.expr)),e.hints=this.hints,e.validate=i=>{let n=this.previousAnswers.includes(i.toString());return(this.validate?this.validate(i,n):void 0)||(n?Rg:{})}}onSolveRow(e){if(this.trigger("solve-row",{expr:e,$math:this.$equation.$math}),this.isFinal&&this.isFinal(e))return this.trigger("solve");if(this.isSolved)return;if(this.rowCount+=1,this.previousAnswers.push(e.toString()),this.rowCount>this.maxRows){let n=this.$equation.solution.toMathML();this.trigger("hint",Dg.replace("$0",n)),this.trigger("solve")}let i=m("tr",{html:this.lastRowContent},this.$table);i.animate(Og,400,500),this.setupEquation(i.$("x-equation")),setTimeout(()=>this.$equation.focus(),1200)}solve(){if(this.isSolved=!0,this.steps.length){let e=this.$table.$("tr:last-child"),i=this.lastRowContent.replace(//,'');for(let n of this.steps){let r=m("tr",{html:i},this.$table),o=r.$(".math.fill"),a=Et.parse(n);o.html=a.toMathML(),e.insertBefore(r),this.trigger("solve-row",{expr:a,$math:o})}}this.$equation.solve()}};gr=T([S("x-equation-system")],gr);var Ya=Math.PI/2;function vr(s){if(rt(s))return[s];if(St(s))return s.points;if(it(s))return[s.p1,s.p2];if(Ft(s))return vr(s.shape(!0));if(U(s))return[s.c.shift(s.r,0),s.c.shift(-s.r,0),s.c.shift(0,s.r),s.c.shift(0,-s.r)];if(Ze(s))return s.extremes;if(Pe(s)||Nt(s)){let t=[s.start,s.end];Pe(s)&&t.push(s.c);let e=s.radius;for(let[i,n]of[[e,0],[0,e],[-e,0],[0,-e]]){let r=s.c.shift(i,n);qt.prototype.contains.call(s,r)&&t.push(r)}return t}return[]}function Lt(...s){return G.aroundPoints(function*(){for(let t of s)for(let e of vr(t))yield e}())}function pp(s,t){let e=Lt(...Array.from(s,n=>n.transformed.rotate(-t))),i=e.p.shift(e.w/2,e.h/2).rotate(t).shift(-e.w/2,-e.h/2);return new G(i,e.w,e.h)}function _i(s,t,e){if(!s.size&&!t.size)return new lt(0,100,0,100);let i=[...s.values()].every(r=>r.props.status==="hidden"),n=e||i;return G.aroundPoints(function*(){for(let r of s.values())if(r.transformed&&(r.props.status!=="hidden"||n))for(let o of vr(r.transformed))yield o;for(let r of t.values())if(r.path)for(let o of vr(r.path))yield o}()).bounds}function Fi(s,t,e){if(rt(t))return s.contains(t);if(Ye(t))return V.collision(s.polygon,t);if(Wo(t))return t.collision(s);if(it(t))return Q(t,s).length>0||s.contains(t.p1);if(Ft(t))return Fi(s,t.shape(!0),e);if(U(t))return e==="geo"?Q(t,s).length>0||s.contains(t.at(0)):t.collision(s);if(Pe(t)||Nt(t)){let i=new V(t.c,t.start,t.at(.25),t.at(.5),t.at(.75),t.end);return V.collision(s.polygon,i)}if(Ze(t)){let i=new V(...oe(0,1,.125).map(n=>t.at(n)));return V.collision(s.polygon,i)}return!1}var wr=class{constructor(t){this.$parent=t;this.visible=!1;this.$el=m("div",{class:"tile-error",hidden:!0},t.$html),this.$text=m("span",{},this.$el),this.$button=m("button",{text:"Select Errors"},this.$el),this.$button.on("click",()=>{t.selection.clear(),this.error&&t.selection.select(this.error.locations||[]),this.hide()})}show(t,e){var i;this.visible&&this.error===e||(this.visible=!0,this.$el.setTransform(t),this.$text.html=e.message,this.$button.toggle(!!((i=e==null?void 0:e.locations)!=null&&i.length)),this.$el.enter("pop",200),this.error=e)}hide(){this.visible&&(this.visible=!1,this.$el.exit("pop",200),this.error=void 0)}},Xa=new Map;function _e(s,t=!0){if(!s||!t||!b.theme.isDark)return s;if(Xa.has(s))return Xa.get(s);let e=$t.fromHex(s),i=e.hsl;nt(i[2],30,70)||(i[2]=100-i[2]);let n=$t.fromHsl(...i);n.a=e.a;let r=n.hex;return Xa.set(s,r),r}var yr=Oe(s=>{let t=$t.fromHex(s),[e,i,n]=["r","g","b"].map(o=>t[o]<=128?0:2*t[o]-255);return new $t(e,i,n).hex}),br=Oe(s=>$t.from(s).brightness<195?"#fff":"#000");function dp(s){let t=s==null?void 0:s.items;if(t!=null&&t.length)for(let e=0;e+d);let r=n.length>0?+n[0]:e?e[0]:0,o=n.length>1?+n[1]:e?e[1]:t;if(x(r,o))return[r-1,o+1,1];i&&(o+=.01*(o-r));let a=Math.floor(Math.abs(t)/Ng),h=(o-r)/a,l=Math.floor(Math.log10(h)),c=Math.pow(10,l),u=Gg.find(d=>c*d<=h)*c;return o=u*Math.ceil(o/u),r=u*Math.floor(r/u),[r,o,u]}function xr(s,t=4e3){let e=k(`x-alert[key=${s}]`);return e==null?void 0:e.open(t)}function up(s,t){let e=new p(-s/2,-t/2);return new G(e,s,t)}function Qa(s,t,e){if(!s)return;let i={},n=0;for(let r of s){let o=t(r);if(o&&(i[r.id]=o,n+=1),e&&n>e)break}return n?i:void 0}function fp(s,t,e,i,n){return m("use",{href:`/icons.040bc2f9.svg#${s}`,fill:t,width:e,height:e,x:i==null?void 0:i.x,y:i==null?void 0:i.y},n)}function mp(s=0){return 20*1.2**s}function*ke(s,t=!1){for(let e of s){let i=e.is("group");(!i||t)&&(yield e),i&&(yield*ks(ke(e.children,t)))}}function*gp(s){let t=new Set;for(let e of s)if(e.group){let i=e.group;for(;i.group;)i=i.group;if(t.has(i))continue;t.add(i),yield i}else yield e}function Ja(s){let t=Math.min(...s.map(i=>Math.min(...i.map(n=>n.y)))),e=Math.max(...s.map(i=>Math.max(...i.map(n=>n.y))));return[t,e]}function Ve(s,t,e){return s.hasAttr(t)?s.attr(t)!=="no":e}function vp(s){let t=K(s).map(e=>+e);return t.length===1?[t[0],t[0],t[0],t[0]]:t.length===2?[t[0],t[1],t[0],t[1]]:t.length===3?[t[0],t[1],t[2],t[1]]:t}function wp(s){let t=s.split(",");return[t[0]!=="no",(t.length>1?t[1]:t[0])!=="no"]}var yp={hasGeoModel:!0,pi:Math.PI,point:(s,t)=>s!==void 0&&t!==void 0?new p(s,t):void 0,angle:(s,t,e)=>s&&t&&e?new Vt(s,t,e):void 0,line:(s,t)=>s&&t&&!s.equals(t)?new vt(s,t):void 0,ray:(s,t)=>s&&t&&!s.equals(t)?new Xo(s,t):void 0,segment:(s,t)=>s&&t&&!s.equals(t)?new Y(s,t):void 0,circle:(s,t)=>s&&t?new wt(s,t):void 0,arc:(s,t,e)=>s&&t&&e?new qt(s,t,e):void 0,sector:(s,t,e)=>s&&t&&e?new Yo(s,t,e):void 0,polygon:(...s)=>s.every(t=>t)?new V(...s):void 0,polyline:(...s)=>s.every(t=>t)?new te(...s):void 0,triangle:(s,t,e)=>s&&t&&e?new Pi(s,t,e):void 0,rectangle:(s,t,e)=>s?new G(s,t,e):void 0,distance:p.distance,round:(s,t=0)=>Dt(s,t),sqrt:Math.sqrt,floor:Math.floor,ceil:Math.ceil,intersections:Q};function $r(s,t,e){let i=e,n;for(let r of s){let o=t(r);o!==void 0&&o`,is=class extends E{constructor(){super(...arguments);this.labelSuffix=["",""];this.gridSize=[1,1];this.showGrid=!1;this.showXAxis=!1;this.showYAxis=!1;this.showLabels=!1}setupCoordinates(e,i={}){this.$svg=e,e.addClass("canvas"),this.proportional=!!i.proportional,this.padding=vp(this.attr("padding")||i.padding||"0"),Ve(this,"grid",i.showGrid||!1)&&(this.$grid=m("g",{class:"grid"}),e.prepend(this.$grid),this.showGrid=!0);let n=this.attr("axes")||(i.showAxes?"yes":"no");[this.showXAxis,this.showYAxis]=wp(n),(this.showXAxis||this.showYAxis)&&(m("defs",{html:zg},e),this.$axes=m("g",{class:"axes"}),e.prepend(this.$axes),this.axisNames=(this.attr("axis-names")||",").split(",")),this.$axes&&Ve(this,"labels",!0)&&(this.labelSuffix=(this.attr("label-suffix")||",").split(","),this.showLabels=!0),(this.showLabels||this.axisNames)&&(this.$labels=m("g",{class:"labels"},e)),this.resize()}resize(){this.css("max-width","none");let e=+this.attr("width")||this.width,i=+this.attr("height")||(this.hasAttr("width")?e:this.height);this.css("max-width",e+"px"),this.$svg.setAttr("width",e),this.$svg.setAttr("height",i),this.$svg.setAttr("viewBox",`0 0 ${e} ${i}`);let n=this.padding;this.viewportBounds=new lt(n[3],e-n[1],n[0],i-n[2]),this.updatePlotBounds(),this.positionElements(e,i)}updatePlotBounds(e){let[i,n,r]=Za(this.attr("x-axis"),this.viewportBounds.dx,e==null?void 0:e.xRange),[o,a,h]=Za(this.attr("y-axis"),this.viewportBounds.dy,e==null?void 0:e.yRange),l=Math.abs(this.viewportBounds.dx/(n-i)),c=Math.abs(this.viewportBounds.dy/(a-o)),u=Math.min(l,c),d=this.proportional?l/u:1,g=this.proportional?c/u:1;this.plotBounds=new lt(d*i,d*n,g*a,g*o),this.plotScale=this.proportional?u:(l+c)/2,this.gridSize=[r,h];let[w,f]=[this.plotBounds,this.viewportBounds];this.plotToViewportMatrix=[[f.dx/w.dx,0,f.xMin-w.xMin/w.dx*f.dx],[0,f.dy/w.dy,f.yMin-w.yMin/w.dy*f.dy]];let v=i>0?d*i:n<0?d*n:0,y=o>0?g*o:a<0?g*a:0;this.plotOrigin=new p(v,y),this.drawAxes()}drawAxes(){let[e,i]=[this.plotBounds,this.viewportBounds],n=this.toViewportCoords(this.plotOrigin),[r,o]=this.gridSize;if(this.$grid&&this.$grid.removeChildren(),this.$axes&&this.$axes.removeChildren(),this.$labels&&this.$labels.removeChildren(),this.showGrid||this.showXAxis){let a=r*Math.trunc(e.xMin/r+.01);for(let h=a;ho=void 0,move:a=>{let h=B(Math.round((a.x-n.xMin)*r),0,this.steps-1);this.points[h]=this.toPlotCoords(new p(n.xMin+h/r,a.y)),o&&this.interpolate(o,h),o=h,this.redraw()},end:()=>this.snap()})}interpolate(e,i){in).map(n=>[n.x,n.y]),i=Fo.bestPolynomial(e);if(i){for(let n=0;ne}ready(){let e=m("svg",{},this);if(this.$plot=m("g",{class:"plot"},e),this.$overlay=m("g",{class:"overlay"},e),this.setupCoordinates(e,{showGrid:!0,showAxes:!0,padding:"20"}),this.hasAttr("fn")){let i=Et.parse(this.attr("fn"),!0);this.setFunctions(n=>i.evaluate({x:n}))}Ve(this,"crosshairs",!0)&&(this.crosshairGrid=+this.attr("crosshair-grid")||10,this.setupCrosshairs(e))}setPoints(e,i=1){let n=e.map((r,o)=>new p(o+i,r));this.setSeries(n)}setSeries(...e){let i=Math.max(...e.map(o=>O(o).x)),[n,r]=Ja(e);this.updatePlotBounds(new lt(0,i,n,r)),this.$plot.removeChildren();for(let o of e)this.drawLinePlot(o);this.getCrosshairPosn=o=>e[0].reduce((a,h)=>Math.abs(h.x-o.x)<=Math.abs(a.x-o.x)?h:a)}setFunctions(...e){let[i,n]=[this.plotBounds,this.viewportBounds],r=e.map(l=>{let c=[];for(let u=n.xMin;u{let c=Pt(B(l.x,i.xMin,i.xMax),h);return new p(c,e[0](c))}}drawLinePlot(e){let i=m("g",{},this.$plot),n=m("path",{},i),r=this.plotBounds;e=e.filter(a=>a.y>=r.yMax&&a.y<=r.yMin);let o=e.map(a=>this.toViewportCoords(a));this.isAnimated?pt(a=>{let h=e.findIndex(l=>l.x>r.xMin+a*r.dx);n.points=o.slice(0,h)},Tp):n.points=o}drawPoints(e){let i=m("g",{},this.$plot),n=this.plotBounds;for(let r of e){let o=this.toViewportCoords(r),a=m("circle",{r:4,cx:o.x,cy:o.y},i);if(this.isAnimated){a.hide();let h=Tp*(r.x-n.xMin)/(n.xMax-n.xMin);setTimeout(()=>a.show(),h)}}}setupCrosshairs(e){let i=m("g",{class:"crosshair"},e),n=m("path",{},i),r=m("circle",{r:4},i),o=m("text",{},i),a=0,h=l=>{let c=this.getCrosshairPosn(this.toPlotCoords(l));if(x(c.x,a))return;a=c.x;let u=this.toViewportCoords(c),d=this.toViewportCoords(this.plotOrigin);r.setCenter(u),n.points=[new p(d.x,u.y),u,new p(u.x,d.y)],o.text=`(${Rt(c.x,5,!1)}, ${Rt(c.y,5,!1)})`;let g=o.width,w=u.x+8+g20?u.y-7:u.y+18)};kl(e,{enter:()=>i.show(),move:l=>h(l),exit:()=>i.hide()})}};Tr=T([S("x-coordinate-system")],Tr);var ei=class{constructor(t,e){this.$canvas=t;this.defaultCallbacks=e;this.callbacks=new WeakMap;this.global=[];this.isMoving=!1;this.shiftKey=!1;this.altKey=!1;this.cancelled=!1;document.addEventListener("keydown",i=>this.checkKeys(i)),document.addEventListener("keyup",i=>this.checkKeys(i)),document.addEventListener("visibilitychange",()=>{this.shiftKey=this.altKey=!1}),this.$root=Xt,t.css("touch-action","none"),t.on("pointerdown",i=>this.startEvent(i)),C.onKey("Escape",()=>this.cancel()),e.hover&&t.on("pointermove",i=>{this.isMoving||e.hover({posn:me(i,t),event:i,target:i.target})})}checkKeys(t){this.shiftKey=t.shiftKey,this.altKey=t.altKey}listen(t,e){this.callbacks.set(t._el,e),t.hasParent(this.$canvas)||(t.css("touch-action","none"),t.on("pointerdown",i=>this.startEvent(i)))}listenAll(t){this.global.push(t)}startEvent(t){var d,g,w;if(t.handled||t.button)return;this.isMoving=!0,this.cancelled=!1,t.preventDefault(),this.checkKeys(t);let e=t.pointerId,i=t.target,n=this.getCallbacks(i);"shiftKey"in t&&(this.shiftKey=t.shiftKey),n.blurInput!==!1&&((d=b.getActiveInput())==null||d.blur());let r=me(t,this.$canvas),o=r,a=!1,h;if(this.constrainInBox){let f=this.$canvas.boundsRect;h=new lt(f.p.x,f.p.x+f.w,f.p.y,f.p.y+f.h)}let l=f=>{var $,I,A,M;if(f.pointerId&&f.pointerId!==e)return;if(f.preventDefault(),this.checkKeys(f),this.cancelled)return c(f);let v=It(f);if(h&&(v=v.clamp(h)),v=v.transform(this.$canvas.inverseTransformMatrix),p.distance(v,o)<.5)return;if(!a){let P={posn:r,event:f,target:i};($=n.start)==null||$.call(n,P);for(let j of this.global)(I=j.start)==null||I.call(j,P)}let y={posn:v,startPosn:r,lastPosn:o,event:f,target:i};(A=n.move)==null||A.call(n,y);for(let P of this.global)(M=P.move)==null||M.call(P,y);!a&&n.cursor!==!1&&this.grabbing(),o=v,a=!0},c=f=>{var y,$,I,A,M,P;if(f.pointerId&&f.pointerId!==e)return;f.preventDefault(),this.checkKeys(f),C.off("pointermove",l),C.off("pointerstop",c);let v={posn:r,event:f,target:i};(y=n.up)==null||y.call(n,v);for(let j of this.global)($=j.up)==null||$.call(j,v);if(a){let j={posn:o,lastPosn:o,startPosn:r,event:f,cancelled:this.cancelled,target:i};(I=n.end)==null||I.call(n,j);for(let ne of this.global)(A=ne.end)==null||A.call(ne,j)}else if(!this.cancelled){(M=n.click)==null||M.call(n,v);for(let j of this.global)(P=j.click)==null||P.call(j,v)}this.grabbing(!1),this.isMoving=this.cancelled=!1},u={posn:r,event:t,target:i};(g=n.down)==null||g.call(n,u);for(let f of this.global)(w=f.down)==null||w.call(f,u);C.on("pointermove",l),C.on("pointerstop",c)}grabbing(t=!0){this.$root.setClass("grabbing",t)}getCallbacks(t){for(;t&&t!==this.$canvas._el;){let e=this.callbacks.get(t);if(e&&(!e.checkIfActive||e.checkIfActive()))return e;t=t.parentNode||void 0}return this.defaultCallbacks}cancel(){this.cancelled=!0}};function _g(s,t){if(typeof s=="string"){let e=ct(s);return i=>{var n;return(n=e(t))==null?void 0:n.equals(i)}}return typeof s=="function"?s:e=>s.equals(e)}function th(s,t,e){let i=t.map(g=>_g(g,s.model)),n=re(void 0,t.length),r=Ke(),o=[],a=({point:g})=>o.push(g),h=e.maxErrors||4,l=0,c=({path:g})=>{e.onBegin&&e.onBegin(g)},u=()=>{n.every(g=>g)&&(e.onComplete&&e.onComplete(!0),s.off("add:path",d),s.off("begin:path",c),s.off("add:point",a),r.resolve(n))},d=({path:g})=>{let w=g.value;if(w){for(let[f,v]of i.entries())if(!n[f]&&v(w))return n[f]=g,e.onCorrect&&e.onCorrect(g,f),l=0,o=[],u();g.delete();for(let f of o)f.delete();if(o=[],!(it(w)&&w.length<1))if(l+=1,l>=h){let f=n.findIndex(y=>!y),v=t[f];if(typeof v!="function"){let y=s.drawPath(v,{animated:1e3});n[f]=y,e.onHint&&e.onHint(y,f),l=0,u()}}else e.onIncorrect&&e.onIncorrect(g)}};return s.on("begin:path",c),s.on("add:path",d),s.on("add:point",a),r.promise}function Mp(s,t){return m("text",{target:s.attr("target")||void 0,class:s.attr("label-class")||s.attr("class")||void 0,"data-when":s.data.when,style:t?`color: ${t}`:void 0,"text-anchor":"middle"})}function Sp(s,t){let e=[];for(let i of t.paths)i!==s&&i.value&&e.push(i.value.transform(t.plotToViewportMatrix));return e}var Fg=new wt(new p(0,-9),12);function Ep(s,t,e){for(let i of e)if(t.every(n=>!Q(Fg.translate(i),n).length))return i;return e[0]}function Cp(s,t){let e=s.value.transform(t.plotToViewportMatrix),i=s.$el;if(it(e)){let n=e.perpendicularVector,r=e.angle;n.y>=0&&(n=n.scale(-1),r+=Math.PI);let o=[];for(let l of[.5,.35,.65])for(let c of[-15,5])o.push(e.at(l).add(n.scale(c)));if(!t.labelPositioning)return[o[0],r];let a=Sp(s,t),h=Ep(e,a,o);return i.hasAttr("mark")&&(h=h.add(e.unitVector.scale(12))),[h,r]}if(Pe(e))return[e.at(.5).subtract(e.c).scale(.6).add(e.c).shift(0,5)];if(Nt(e)){let n=new vt(e.start,e.end),r=n.perpendicularVector.y>=0,o=n.angle+(r?Math.PI:0);return[e.at(.5).add(n.perpendicularVector.scale(r?14:5)),o]}if(Ft(e)){let n=(+i.attr("size")||(e.isRight&&!i.hasAttr("round")?20:e.radius))+8;return[e.b.add(e.bisector.unitVector.scale(n+5)).shift(0,3)]}if(rt(e)){let n=i.hasClass("move")?10:8,r=[e.shift(n,-n),e.shift(-n,-n),e.shift(n,10+n),e.shift(-n,10+n)];if(!t.labelPositioning)return[r[0]];let o=Sp(s,t);return[Ep(e,o,r)]}return St(e)?[e.centroid.shift(0,5)]:U(e)?[e.c.shift(0,5)]:[]}var Sr=class{constructor(t,e,i,n){this.$parent=t;this.$el=i;this.color="";this.label="";this.isPending=!1;this.isLocked=!1;this.components=[];this.dependencies=[];this.fixedLabel=!1;this.name=n||t.model.getKey(),t.shapes.set(this.name,this),t.model.watch(r=>{let o=r[this.name];this.$el.css("display",o?"block":"none"),this.$label&&this.$label.css("display",o?"block":"none"),o&&this.redraw(o),t.queueLabelPositioning()}),this.color=i.css("color")||"",this.setValue(e),i.hasAttr("label")&&this.setLabel(i.attr("label"))}get value(){return this.$parent.model[this.name]}get type(){var t;return(t=this.value)==null?void 0:t.type}get locked(){return this.isLocked}get isHidden(){return this.isPending||this.$el.hasAttr("hidden")||this.$el.hasClass("transparent")}setValue(t){t instanceof Function?this.$parent.model.setComputed(this.name,t):this.$parent.model[this.name]=t}setLabel(t,e,i){this.$label||(this.$label=Mp(this.$el,e),this.$parent.$objLabels.append(this.$label));let n=xn(t);if(this.$parent.model.watch(r=>this.$label.text=n(r)||""),this.fixedLabel=!!i,i){let r=ct(i);this.$parent.model.watch(o=>{this.$label.setTransform(r(o).shift(0,5))})}this.updateLabelPosition()}setColor(t){this.color=t,this.$el.css("color",t);for(let e of this.dependencies)e.setColor(t);this.$label&&this.$label.css("color",t)}updateLabelPosition(){if(!this.$label||!this.value||this.fixedLabel)return;let[t,e]=Cp(this,this.$parent);this.$label.setTransform(t,e)}select(){this.$el.addClass("selected"),this.$el.parent.append(this.$el);for(let t of this.dependencies)t.select()}deselect(){this.$el.removeClass("selected");for(let t of this.dependencies)t.deselect()}hover(t=!1){if(!t){if(this.$parent.hovering===this)return;this.$parent.hovering&&this.$parent.hovering.unhover(),this.$parent.hovering=this}this.$el.addClass("hover");for(let e of this.dependencies)e.hover(!0)}unhover(t=!1){if(!t){if(this.$parent.hovering!==this)return;this.$parent.hovering=void 0}this.$el.removeClass("hover");for(let e of this.dependencies)e.unhover(!0)}delete(t=300){return D(this,null,function*(){this.$parent.shapes.delete(this.name);for(let e of this.components)e.deselect();this.$label&&this.$label.exit("fade",t,0,!0),yield this.removeElement(t),this.$parent.model[this.name]=void 0})}},Ie=class extends Sr{constructor(t,e,i,n,r=!1){n||(n=m("circle",{})),super(t,e,n,i),this.$parent.hidePoints||t.$points.append(this.$el),t.points.add(this),this.projectionId=t.model.getKey(),this.projectionOffset=void 0,t.model.watch(o=>{this.projection=o[this.projectionId],this.projection&&(this.projectionOffset===void 0&&(this.projectionOffset=this.projection.offset(this.$parent.model[this.name])),this.$parent.model[this.name]=this.projection.at(this.projectionOffset))}),this.lock(r)}setValue(t){t instanceof Function?(this.project(void 0),this.$parent.model.setComputed(this.name,t)):(t&&this.projection&&(t=this.projection.project(t),this.projectionOffset=this.projection.offset(t)),this.$parent.model[this.name]=t)}redraw(t){let e=t.transform(this.$parent.plotToViewportMatrix);this.$el.setCenter(e),this.$halo&&this.$halo.setCenter(e),this.$pulse&&this.$pulse.setCenter(e)}removeElement(t){return D(this,null,function*(){this.$parent.points.delete(this),yield this.$el.exit("pop",t,0,!0).promise})}distance(t){return this.value?p.distance(t,this.value):1/0}lock(t=!0){this.isLocked=t,this.$el.setClass("move",!t),t?this.$el.removeAttr("tabindex"):this.$el.setAttr("tabindex",0)}project(t){if(this.projectionOffset=void 0,typeof t=="string"){let e=ct(t);this.$parent.model.setComputed(this.projectionId,e)}else t?this.$parent.model.setComputed(this.projectionId,()=>t.value):this.$parent.model[this.projectionId]=void 0}makeIntersection({path1:t,path2:e,index:i}){this.setValue(n=>{if(!n[t.name]||!n[e.name])return;let r=Q(n[t.name],n[e.name]);return r[Math.min(i,r.length-1)]}),this.lock()}addHalo(){this.$halo=m("circle",{class:"halo",r:18},this.$parent.$pulses),this.$halo.setCenter(this.$el.center),this.$halo.enter("pop")}removeHalo(){return D(this,null,function*(){this.$halo&&(this.$halo.exit("pop",500,0,!0),this.$halo=void 0)})}pulsate(){this.$pulse=m("circle",{class:"pulse",r:8},this.$parent.$pulses),this.$pulse.setCenter(this.$el.center),this.$el.one("mouseover pointerdown focus",()=>{this.$pulse&&this.$pulse.remove(),this.$pulse=void 0})}},Fe=class extends Sr{constructor(t,e,i,n){super(t,e,n||m("path"),i),t.$paths.append(this.$el),t.paths.add(this)}get locked(){return this.isLocked||!this.components.length||this.components.every(t=>t.locked)}redraw(t){let e=t.transform(this.$parent.plotToViewportMatrix);this.$el.draw(e,{box:this.$parent.viewportRect})}distance(t){return this.value?p.distance(t,this.value.project(t)):1/0}removeElement(t){return D(this,null,function*(){this.$parent.paths.delete(this),yield this.$el.exit("draw",t,0,!0).promise})}setComponents(t,e){this.components=this.dependencies=t,this.setValue(()=>{let i=t.map(n=>n.value);if(!i.some(n=>n===void 0))return e(...i)})}};var qi=class{constructor(t){this.$parent=t}enable(){}down(t){}start(t){}move(t,e){}end(t){}hover(t){}click(t){}cancel(){}snapToGrid(t){return this.$parent.snapToGrid?t.round(this.$parent.snapToGrid):t}snapToPoint(t,e){if(this.snapPoint=this.$parent.getPointAt(e),this.snapPoint)return t.$el.setClass("move",!this.snapPoint.locked),t.setValue(this.snapPoint.value);if(this.snapIntersect=this.$parent.getIntersectionAt(e),this.snapIntersect)return t.$el.removeClass("move"),t.setValue(this.snapIntersect.posn);if(!this.$parent.snapToGrid&&(this.snapPath=this.$parent.getPathAt(e),this.snapPath))return t.setValue(this.snapPath.value.project(e));t.$el.addClass("move"),t.setValue(this.snapToGrid(e))}getOrMakePointAt(t){let e=this.$parent.getPointAt(t);if(!e){e=new Ie(this.$parent,this.snapToGrid(t));let i=this.$parent.getIntersectionAt(t);if(i)e.makeIntersection(i);else if(!this.$parent.snapToGrid){let n=this.$parent.getPathAt(t);n&&e.project(n)}this.$parent.trigger("add:point",{point:e})}return e}showPendingPointAt(t){var n,r,o;let e=((n=this.$parent.getIntersectionAt(t))==null?void 0:n.posn)||((o=(r=this.$parent.getPathAt(t))==null?void 0:r.value)==null?void 0:o.project(t)),i=!!e;if(this.$parent.$pendingPoint.toggle(i),i){let a=this.$parent.toViewportCoords(e||t);this.$parent.$pendingPoint.setCenter(a)}}},Hi=class extends qi{constructor(){super(...arguments);this.isMoving=!1}enable(){}down(e){this.obj=this.$parent.getPointAt(e)||this.$parent.getPathAt(e),this.obj||this.$parent.deselect();let i=this.$parent.selection;i!==this.obj&&(i&&i.components.includes(this.obj)||this.$parent.select(this.obj))}start(){this.obj&&(this.isMoving=!0,this.obj.isPending=!0,this.$parent.updateIntersections(),this.$parent.trigger("move",{obj:this.obj}))}move(e,i){if(!(!this.obj||this.obj.locked||this.$parent.locked))if(this.obj instanceof Fe){let n=e.subtract(i);for(let r of this.obj.components)r.locked||r.setValue(r.value.add(n))}else this.obj instanceof Ie&&this.obj.setValue(this.snapToGrid(e))}end(){this.obj&&(this.isMoving=!1,this.obj.isPending=!1,this.snapPoint||(this.snapIntersect?this.obj.makeIntersection(this.snapIntersect):this.snapPath&&this.obj.project(this.snapPath)),this.$parent.trigger("moveEnd",{path:this.obj}),this.obj=void 0,this.$parent.updateIntersections())}hover(e){if(this.isMoving)return;let i=this.$parent.getPointAt(e)||this.$parent.getPathAt(e),n=i&&!this.$parent.locked&&!i.locked,r=i&&this.$parent.canSelect;this.$parent.setCursor(n?"grab":r?"pointer":"default"),n||r?i.hover():this.$parent.hovering&&this.$parent.hovering.unhover()}},Er=class extends Hi{down(t){this.$parent.deselect(),this.obj=this.getOrMakePointAt(t),this.$parent.select(this.obj)}hover(t){let e=this.$parent.getPointAt(t);if(e)return this.$parent.setCursor(this.$parent.locked||e.locked?"default":"grab"),this.$parent.$pendingPoint.hide(),e.hover();this.$parent.hovering&&this.$parent.hovering.unhover(),this.$parent.setCursor("crosshair"),this.showPendingPointAt(t)}},si=class extends qi{enable(){this.$parent.setCursor("crosshair")}down(t){this.$parent.deselect(),this.startPoint=this.getOrMakePointAt(t)}start(t){this.startPoint&&(this.$parent.$pendingPoint.hide(),this.endPoint=new Ie(this.$parent,t),this.endPoint.isPending=!0,this.endPoint.$el.addClass("pending"),this.path=new Fe(this.$parent,void 0),this.path.setComponents([this.startPoint,this.endPoint],this.expr),this.path.isPending=!0,this.$parent.updateIntersections(),this.$parent.trigger("begin:path",{path:this.path,start:this.startPoint}))}move(t){if(!this.startPoint||!this.path||!this.endPoint)return;if(p.distance(t,this.startPoint.value)<20/this.$parent.plotScale)return this.endPoint.setValue(this.snapToGrid(t));this.snapToPoint(this.endPoint,t)}end(){if(!this.startPoint||!this.path||!this.endPoint)return;this.path.isPending=!1,this.endPoint.isPending=!1,this.startPoint.value.equals(this.endPoint.value)?(this.endPoint.delete(),this.path.delete(),this.path=this.endPoint=void 0):this.snapPoint?(this.path.setComponents([this.startPoint,this.snapPoint],this.expr),this.endPoint.delete(),this.endPoint=void 0):this.snapIntersect?this.endPoint.makeIntersection(this.snapIntersect):this.snapPath&&this.endPoint.project(this.snapPath),this.endPoint&&(this.$parent.trigger("add:point",{point:this.endPoint}),this.endPoint.$el.removeClass("pending"));let t=this.path;this.startPoint=this.endPoint=this.path=void 0,t&&(this.$parent.trigger("add:path",{path:t}),this.$parent.updateIntersections())}hover(t){let e=this.$parent.getPointAt(t);if(e)return this.$parent.$pendingPoint.hide(),e.hover();this.$parent.hovering&&this.$parent.hovering.unhover(),this.showPendingPointAt(t)}cancel(){this.endPoint&&this.endPoint.delete(),this.path&&this.path.delete(),this.$parent.$pendingPoint.hide(),this.startPoint=this.endPoint=this.path=void 0}},Mr=class extends si{expr(t,e){return new Y(t,e)}},Cr=class extends si{expr(t,e){return new wt(t,p.distance(t,e))}},Ar=class extends si{expr(t,e){return new G(t,e.x-t.x,e.y-t.y)}},kr=class extends si{expr(t,e){return new Y(t,e).perpendicularBisector}},Ap=(s,t,e)=>new Vt(s,t,e).bisector,Vr=class extends qi{enable(){}down(t){if(this.$parent.deselect(),!this.firstPoint)this.firstPoint=this.getOrMakePointAt(t),this.firstPoint&&this.firstPoint.addHalo();else if(this.secondPoint){this.path.isPending=this.thirdPoint.isPending=!1,this.thirdPoint.$el.removeClass("pending"),this.firstPoint.removeHalo(),this.secondPoint.removeHalo(),this.snapPoint?(this.path.setComponents([this.firstPoint,this.secondPoint,this.snapPoint],Ap),this.thirdPoint.delete(),this.thirdPoint=void 0):this.snapIntersect?this.thirdPoint.makeIntersection(this.snapIntersect):this.snapPath&&this.thirdPoint.project(this.snapPath);let e=this.path,i=this.thirdPoint;this.firstPoint=this.secondPoint=this.thirdPoint=this.path=void 0,i&&this.$parent.trigger("add:point",{point:i}),this.$parent.trigger("add:path",{path:e}),this.$parent.updateIntersections()}else{if(this.secondPoint=this.getOrMakePointAt(t),!this.secondPoint)return;this.secondPoint.addHalo(),this.thirdPoint=new Ie(this.$parent,this.secondPoint.value),this.thirdPoint.$el.addClass("pending"),this.path=new Fe(this.$parent,void 0),this.path.setComponents([this.firstPoint,this.secondPoint,this.thirdPoint],Ap),this.path.isPending=this.thirdPoint.isPending=!0}}hover(t){if(this.$parent.$pendingPoint.hide(),this.thirdPoint){this.snapToPoint(this.thirdPoint,t),this.$parent.setCursor(this.snapPoint?"pointer":"crosshair");return}let e=this.$parent.getPointAt(t);if(e)return this.$parent.setCursor("pointer"),e.hover();this.$parent.hovering&&this.$parent.hovering.unhover(),this.$parent.setCursor("crosshair"),this.showPendingPointAt(t)}cancel(){this.firstPoint&&this.firstPoint.removeHalo(),this.secondPoint&&this.secondPoint.removeHalo(),this.thirdPoint&&this.thirdPoint.delete(),this.path&&this.path.delete(),this.firstPoint=this.secondPoint=this.thirdPoint=this.path=void 0}};var kp='
';var Ir=class extends is{constructor(){super(...arguments);this.shapes=new Map;this.points=new Set;this.paths=new Set;this.intersections=new Set;this.snapToGrid=0;this.locked=!1;this.hidePoints=!1;this.canSelect=!1;this.canIntersect=!1;this.canProject=!0;this.labelPositioning=!1;this.cursor="default"}ready(){let e=this.children.filter(h=>h.tagName==="SVG")[0];if(this.hasAttr("complex")&&(this.setAttr("label-suffix",",i"),this.setAttr("axis-names","Real, Imaginary"),this.setAttr("axes","true"),this.setAttr("grid","true")),!this.hasAttr("x-axis")&&!this.hasAttr("y-axis")){let h=+this.attr("grid"),l=+this.attr("width")||this.width,c=+this.attr("height")||l;this.setAttr("x-axis",h?`-0.5,${l/h-.5},1`:`0,${l},1`),this.setAttr("y-axis",h?`${c/h-.5},-0.5,1`:`${c},0,1`),h&&this.setAttr("snap",1)}this.setupCoordinates(e,{proportional:!0}),this.viewportRect=this.viewportBounds.rect,this.model=this.getParentModel()||le({}),this.model.hasGeoModel||this.model.assign(yp),this.$paths=m("g",{class:"paths"},e),this.$pulses=m("g",{class:"pulses"},e),this.$points=m("g",{class:"points"},e),this.$objLabels=m("g",{class:"labels"},e),this.snapToGrid=this.hasAttr("snap")?+this.attr("snap")||1:0,this.hidePoints=this.hasAttr("no-points"),this.canIntersect=Ve(this,"intersections",!1),this.canProject=Ve(this,"projections",!0),this.canSelect=Ve(this,"selectable",!1),this.labelPositioning=Ve(this,"label-positioning",!0),this.hasClass("sticky")&&this.css("top",`calc(50vh - ${this.height/2}px)`),this.queueLabelPositioning=ve(()=>{for(let h of this.shapes.values())h.updateLabelPosition()},0,!0);let i=e.$$("path[x], path[\\:d], circle");for(let h of i){let l=h.hasAttr("x")?ct(h.attr("x")):void 0,c=h.attr("name");if(h.hasAttr(":d"))this.$paths.append(h),h.bindModel(this.model);else if(h.tagName==="PATH")this.$paths.append(h),new Fe(this,l,c,h);else{this.$points.append(h);let u=!h.hasClass("move"),d=l||h.center,g=new Ie(this,d,c,h,u);h.hasAttr("project")&&g.project(h.attr("project")),h.hasClass("pulsate")&&g.pulsate()}}this.$pendingPoint=m("circle",{class:"pending"},this.$points),this.$pendingPoint.hide(),this.updateIntersections();let n={move:new Hi(this),point:new Er(this),line:new Mr(this),circle:new Cr(this),perpBisector:new kr(this),angleBisector:new Vr(this),rectangle:new Ar(this)};this.$tools=this.$(".tools");let r=n[this.$tools.$active.data.tool];r.enable();let o=()=>this.toolOverride||r;this.$tools.on("change",h=>{o().cancel(),this.toolOverride=void 0,r=n[h.data.tool],this.hovering&&this.hovering.unhover(),this.$pendingPoint.hide(),this.hovering=void 0,this.deselect(),r.enable()});let a=(h,l=!1)=>this.toPlotCoords(l?h.clamp(this.viewportBounds,8):h);new ei(e,{down:h=>o().down(a(h.posn)),start:h=>o().start(a(h.posn)),move:h=>o().move(a(h.posn,!0),a(h.lastPosn,!0)),end:h=>o().end(a(h.posn,!0)),click:h=>o().click(a(h.posn)),hover:h=>o().hover(a(h.posn))}),C.onKey("Escape",()=>o().cancel()),C.onKey("Backspace Clear Delete",()=>this.delete()),document.addEventListener("keydown",h=>{if([37,38,39,40].indexOf(h.keyCode)<0)return;let c=b.getActiveInput();if(!(!c||!c.hasParent(this))){h.preventDefault();for(let u of this.points){if(u.$el!==c||!u.value)continue;let d=15/this.plotScale,g=this.plotBounds.yMin>this.plotBounds.yMax?-1:1,w=h.keyCode===37?-d:h.keyCode===39?d:0,f=h.keyCode===38?-g*d:h.keyCode===40?g*d:0;u.setValue(u.value.shift(w,f));return}}})}switchTool(e){this.$tools.makeActive(this.$(`.tool[data-tool="${e}"]`))}setCursor(e="default"){e!==this.cursor&&(this.cursor=e,this.$svg.css("cursor",e))}select(e){this.canSelect&&(this.deselect(),e&&(this.selection=e,e.select()),this.trigger("select",{shape:e}))}deselect(){this.selection&&(this.selection.deselect(),this.selection=void 0,this.trigger("select",{shape:void 0}))}delete(){this.hovering&&this.hovering.unhover(),this.selection&&this.selection.delete(),this.trigger("select",{shape:void 0})}redraw(){this.resize(),this.viewportRect=this.viewportBounds.rect,this.model.forceUpdate()}getPointAt(e,i=20){if(this.hidePoints)return;let n=r=>r.isHidden?void 0:r.distance(e);return $r(this.points,n,i/this.plotScale)}getPathAt(e,i=10){if(this.hidePoints||!this.canProject)return;let n=r=>r.isHidden?void 0:r.distance(e);return $r(this.paths,n,i/this.plotScale)}getIntersectionAt(e,i=20){if(!this.canIntersect)return;let n=r=>p.distance(e,r.posn);return $r(this.intersections,n,i/this.plotScale)}updateIntersections(){!this.canIntersect||this.hidePoints||bp(this.paths,this.intersections)}drawPath(e,i={}){typeof e=="string"&&(e=ct(e));let n=new Fe(this,e,i.name);i.classes&&n.$el.addClass(i.classes),i.target&&n.$el.setAttr("target",i.target);let r=n.$el.hasClass("fill")?"fade":"draw";return i.animated&&n.$el.enter(r,i.animated),n}drawPoint(e,i={}){typeof e=="string"&&(e=ct(e));let n=new Ie(this,e,i.name,void 0,i.interactive===!1);return i.classes&&n.$el.addClass(i.classes),i.target&&n.$el.setAttr("target",i.target),i.animated!==0&&n.$el.enter("pop",i.animated||500),n}animatePoint(e,i,n=400){let r=this.shapes.get(e),o=new Y(this.model[e],i);return pt(a=>r.setValue(o.at(yt("quad",a))),n)}animateConstruction(e,i=2e3){return D(this,null,function*(){let n=this.shapes.get(e),r=n.value;if(U(r)&&(r=r.arc),it(r)){this.$ruler||(this.$ruler=m("path",{d:$p,class:"sketch"},this.$svg));let o=Es(r.at(-.1),12,r.angle-.3,r.length*1.2),a=Es(r.at(-.1),12,r.angle,r.length*1.2);this.$ruler.show(),n.$el.hide(),yield this.$ruler.animate({opacity:[0,1],transform:[o,a]},500).promise,yield n.$el.enter("draw",i).promise,yield this.$ruler.animate({opacity:[1,0],transform:[a,o]},500).promise}else if(Nt(r)){this.$compass||(this.$compass=m("path",{d:xp,class:"sketch"},this.$svg));let o=Es(r.c,50,r.startAngle,r.radius*1.5),a=Es(r.c,50,r.startAngle,r.radius),h=Es(r.c,50,r.startAngle+r.angle,r.radius),l=Es(r.c,50,r.startAngle+r.angle,r.radius*1.5);this.$compass.show(),n.$el.hide(),yield this.$compass.animate({opacity:[0,1],transform:[o,a]},500).promise,n.$el.enter("draw",i),yield this.$compass.animate({transform:[a,h]},i,0,"linear").promise,yield this.$compass.animate({opacity:[1,0],transform:[h,l]},500).promise}})}showGesture(e,i){this.$gesture||(this.$gesture=m("x-gesture",{},this)),this.$gesture.stop();let n=this.toViewportCoords(ct(e)(this.model));if(this.$gesture.from=n,i){let r=this.toViewportCoords(ct(i)(this.model));this.$gesture.start(r.subtract(n))}else this.$gesture.start();this.one("click mouseover pointerdown",()=>this.$gesture.stop())}waitForPoint(){return D(this,null,function*(){return new Promise(e=>{this.one("add:point",({point:i})=>e(i))})})}waitForPath(n){return D(this,arguments,function*(e,i={}){return(yield th(this,[e],i))[0]})}waitForPaths(e,i={}){return th(this,e,i)}};Ir=T([S("x-geopad",{template:kp})],Ir);var Vp='
';var Lr=class extends E{ready(){let t=this.$(".image"),e=this.positionTop<50,i,n;t.css({"background-image":`url("${this.attr("background")}")`,height:e?"100%":"150%"});let r=({height:a})=>{let h=this.positionTop;i=Math.max(0,h-a),n=h+this.height};function o(a){if(a.topn)return;let h=(a.top-i)/(n-i)*(e?50:33);t.css("transform",`translateY(${h}%)`)}b.onResize(r),C.on("scroll",o)}};Lr=T([S("x-parallax",{template:Vp})],Lr);var st=new AudioContext,Rr,qe,Or=.05,Rp="/polypad/assets/audio/samples/",Ip=new Map,Dp=new Map,Lp=!1;function qg(){return D(this,null,function*(){if(Lp)return;Lp=!0,qe=st.createDynamicsCompressor(),qe.threshold.setValueAtTime(-15,0),qe.knee.setValueAtTime(1,0),qe.ratio.setValueAtTime(2,0),qe.attack.setValueAtTime(1e-5,0),qe.release.setValueAtTime(1,0),Rr=st.createConvolver();let t=yield(yield fetch(`${Rp}IR13.mp3`)).arrayBuffer();Rr.buffer=yield st.decodeAudioData(t)})}function Np(s){if(!s||s==="synth"||Ip.has(s))return;let t=fetch(`${Rp}${s}.mp3`).then(e=>e.arrayBuffer()).then(e=>st.decodeAudioData(e)).then(e=>Dp.set(s,e)).catch(()=>console.error("Unable to load sample for",s));Ip.set(s,t)}var eh={piano:{label:"Piano",pitch:-6,vol:-1.5},epiano:{label:"E-Piano",pitch:-1,vol:-2},organ:{label:"Organ",pitch:-1,vol:-1.75},marimba:{label:"Marimba",pitch:1},synth:{label:"Synth"},bass:{label:"Synth Bass",pitch:6.2,vol:-1.75,icon:"synth"},aguitar:{label:"Guitar",pitch:5},eguitar:{label:"E-Guitar",vol:-2},violin:{label:"Violin",vol:-1.75},cello:{label:"Cello",vol:-1.5},banjo:{label:"Banjo",vol:3},trumpet:{label:"Trumpet",vol:-1.75,pitch:-14},clarinet:{label:"Clarinet",pitch:-2,vol:-2},ubass:{label:"Upright Bass",vol:2,icon:"cello"},kick:{label:"Kick",noLoop:!0},snare:{label:"Snare",noLoop:!0},"tom-high":{label:"High Tom",noLoop:!0},"tom-low":{label:"Low Tom",noLoop:!0},"hihat-open":{label:"Open HiHat",noLoop:!0,icon:"hihat"},"hihat-closed":{label:"HiHat",noLoop:!0,icon:"hihat"},ride:{label:"Ride Cymbal",noLoop:!0},crash:{label:"Crash Cymbal",noLoop:!0},cowbell:{label:"Cowbell",noLoop:!0},tambo:{label:"Tambourine",noLoop:!0},bongo:{label:"Bongos",noLoop:!0},shaker:{label:"Shaker",noLoop:!0},woodblock:{label:"Woodblock",noLoop:!0},voice:{label:"Vocal",vol:-1.5},clap:{label:"Clap",noLoop:!0},snap:{label:"Snap",noLoop:!0},ting:{label:"Ting",pitch:5.5},honk:{label:"Honk",pitch:-2,noLoop:!0},scraper:{label:"Scraper",noLoop:!0},boing:{label:"Spring",noLoop:!0,pitch:7},vibraslap:{label:"Vibraslap",noLoop:!0},cow:{label:"Cow",vol:-1.75,noLoop:!0},bark:{label:"Dog",noLoop:!0},duck:{label:"Duck",noLoop:!0},pig:{label:"Pig",noLoop:!0},rooster:{label:"Rooster",pitch:-5,noLoop:!0}},Hg=440*2**(-9/12);var jg={none:[],percussion:[],major:[0,2,4,5,7,9,11],minor:[0,2,3,5,7,8,10],blues:[0,3,5,6,7,10],pentatonic:[0,2,4,7,9],chromatic:oe(12)};function ih(s,t,e=0,i){if(s==="none")return 0;i&&(t=e-t-1);let n=jg[s],r=gt(t,n.length);return Math.round((t-r)/n.length)*12+n[r]}function Gp(s,t,e){let i=st.createGain();i.connect(qe),i.connect(Rr).connect(qe).connect(st.destination);let n=s+1e-5;return i.gain.setValueAtTime(1e-5,n),i.gain.linearRampToValueAtTime(t,n+=e[0]),i.gain.linearRampToValueAtTime(t*.8,n+=e[1]),i.gain.setValueAtTime(t*.8,n+=e[2]),i.gain.linearRampToValueAtTime(1e-5,n+e[3]),i}function ji(s,t="piano"){return s===void 0?0:t==="synth"?Hg*2**(s/12):2**((s+(eh[t].pitch||0))/12)||0}function Ug(s,t,e,i,n){let r=Dp.get(s);if(!r)throw new Error(`Missing audio sample: ${s}`);let o=Gp(e,i,n),a=st.createBufferSource(),h=ji(t,s);a.playbackRate.value=h,a.buffer=r,a.connect(o),a.start(e);let l=[a],c=a.buffer.duration/h,u=c*.5>1.5?1.1:c*.9,d=n[2]/.6,g=d/u;if(d>1.1&&!eh[s].noLoop)for(let w=1;wthis.stop())}play(t=st.currentTime+Or,e=1){if(!this.setup)return 0;this.isPlaying&&this.stop(),this.isPlaying=!0,this.tempo=(this.tile.props.tempo||1)*e;let i=this.tile.props.note||0;if(this.currentData=this.setup(i,this.tempo),!this.currentData.beats.length)return this.isPlaying=!1,this.currentData=void 0,0;let n=O(this.currentData.beats);return this.duration=(n.time+n.duration)/this.tempo,this.start=t,this.lastBeat=-1,Op.add(this),this.duration}stop(){var t,e;if(this.isPlaying){Op.remove(this),window.clearInterval(this.timeout),this.isPlaying=!1,(e=(t=this.currentData).end)==null||e.call(t);for(let i of this.stopCont)i.stop();this.stopCont.clear(),this.currentData=void 0,this.tile.$parent.selection.update()}}tick(){var o,a;let t=st.currentTime,e=this.currentData.beats,i=(t-this.start)*this.tempo,n=e.findIndex(h=>h.time>=i);n<0&&(n=e.length-1);for(let h=this.lastBeat+1;h<=n;++h)this.processStep(h);(a=(o=this.currentData).tick)==null||a.call(o,i<0?0:i);let r=this.start+this.duration-t;this.lastBeat>=e.length-1&&r<=0&&this.stop()}processStep(t){var h,l;let e=this.currentData.beats[t],i=this.start+e.time/this.tempo;if(i>st.currentTime+Or)return;let n=((h=this.tile.props.volume)!=null?h:1)+((l=e.volume)!=null?l:0),r=e.duration/this.tempo,o=e.sound||this.tile.props.sound||"piano";if(e.note instanceof Function)this.playContinuous(e.note,o,i,r,n);else{let c=Array.isArray(e.note)?e.note:[e.note];for(let u of c)this.playNote(u,o,i,r,n)}let a=i-st.currentTime;this.timeout=Zt(()=>{var c,u;return(u=(c=this.currentData).step)==null?void 0:u.call(c,t)},a*1e3),this.lastBeat=t}playNote(t,e=this.tile.props.sound||"piano",i=st.currentTime+Or,n=.8,r=this.tile.props.volume||1){return Kg(t,e,r,n,i,this.tile.props.modGain,this.tile.props.modFreq)}playContinuous(t,e,i,n,r){let o=this.playNote(ji(t(0)),e,i,n,r),a=o instanceof OscillatorNode,h=1/60;for(let l=0;l<=n;l+=h){let c=ji(t(l*this.tempo),e);if(a)o.frequency.setValueAtTime(c,i+l);else for(let u of o)u.playbackRate.setValueAtTime(c,i+l)}if(a)this.stopCont.add(o);else for(let l of o)this.stopCont.add(l)}},sh=class{constructor(){this.running=!1;this.tracks=new Set}add(t){this.tracks.add(t),this.running||(st.state!=="running"&&st.resume(),this.running=!0,this.tick(),requestAnimationFrame(()=>this.tick()))}remove(t){this.tracks.delete(t),this.tracks.size||(this.running=!1)}tick(){for(let t of this.tracks)t.tick();this.running&&requestAnimationFrame(()=>this.tick())}},Op=new sh;var Xg=new Set(["watch","assign","updateTheme","flushChanges","raw","copy"]);function zp(s,t){let e,i=new Set,n=!0,r=new Map,o=(u,d)=>{for(let g of K(u))r.has(g)||r.set(g,[]),r.get(g).push(d);d(c)},a=u=>{let d=Object.keys(u).filter(w=>u[w]!==s[w]);if(!d.length)return;Object.assign(s,u),t.$parent.pendingChanges.add(t);for(let w of d)i.add(w);let g=Wt(d.flatMap(w=>{var f;return(f=r.get(w))!=null?f:[]}));for(let w of g)w(c)},h=()=>{var u;for(let d of(u=r.get("color"))!=null?u:[])d(c)},l=()=>{if(t.isDeleting)return i.clear(),n?void 0:[e,void 0];let u=e;if(e=Object.assign({},s),n)return i.clear(),n=!1,[void 0,e];let d={},g={},w=!1;for(let f of i)e[f]!==u[f]&&(w=!0,d[f]=e[f],g[f]=u[f]);return i.clear(),w?[g,d]:void 0},c=new Proxy(s,{get(u,d){switch(d){case"watch":return o;case"assign":return a;case"updateTheme":return h;case"flushChanges":return l;case"raw":return s;case"copy":return()=>Object.assign({},s);case"zIndex":return s.zIndex||0;case"layer":return s.layer||"normal";case"color":return _e(s.color,t.$parent.flipTheme);default:return s[d]}},set(u,d,g){var w;if(Xg.has(d))return!1;if(s[d]===g)return!0;s[d]=g;for(let f of(w=r.get(d))!=null?w:[])f(c);return t.$parent.pendingChanges.add(t),i.add(d),!0}});return c}function Bp(s){let t=s.signedArea<0,e=0;for(let[n,r]of s.points.entries())r.ys.points[e].x||(e=n);let i=hs(s.points,e+(t?1:0));return t&&(i=i.reverse()),new V(...i)}function nh(s,t,e=0){let i=s.centroid.x,n=Math.max(...s.points.map(r=>r.y))+42+e;return m("text",{x:i,y:n,style:"font-size:25px"},t)}function Yg(s,t,e,i){t.removeChildren();let n=s.is("polyomino"),r=Bp(s.path),o=r.edges,a=as(o.map(A=>A.length)),h=O(a),l=yr(s.props.color),c=z(A=>{let M=ih(s.props.musicScale||"major",A,o.length,s.props.musicScaleRev),P=(a[A-1]||0)*.01;return{note:e+M,time:P,duration:o[A].length*.01}},o.length),u=m("g",{filter:"url(#outline)"},t),d=m("g",{class:"axis-label",fill:l},t),g=s.props.animation==="vertices"?9:6,w=m("path",{path:r,fill:"none",stroke:l,"stroke-width":5,opacity:1,hidden:!0},u),f=r.points.map(A=>m("circle",{cx:A.x,cy:A.y,r:g,fill:l,hidden:!0},u)),v,y,$;return s.props.animation==="vertices"?$=r.points.map((A,M)=>m("text",{text:M+1,x:A.x,y:A.y+5,fill:"white",hidden:!0},u)):s.props.labels==="number"&&(v=nh(r,d),y=o.map(A=>{let M=A.perpendicularBisector,P=M.at(n?0:15/M.length),j=A.length<45?12:15;return m("text",{text:Dt(A.length/50,1),x:P.x,y:P.y+5,hidden:!0,style:`font-size:${j}px`},d)})),{beats:c,step:A=>{A===0&&(w==null||w.enter("draw",10*h/i)),f==null||f[A].show(),$==null||$[A].show(),y==null||y[A].show(),v&&(v.textStr=Dt(a[A]/50,1))}}}function Zg(s,t,e){t.removeChildren();let i=s.path.area/2500,n=e-12,r=i,o=yr(s.props.color),a=m("clipPath",{id:`clip-${s.id}`},t),h=m("path",{path:G.aroundPoints(s.path.points)},a);s.$path.setAttr("id",`shape-${s.id}`),m("path",{path:s.path,"clip-path":`url(#clip-${s.id})`,fill:o,opacity:1},t);let l=m("g",{class:"axis-label",fill:o},t),c=nh(s.path,l,-15);return{beats:[{note:g=>tt(n-i,n,g/r),duration:r,time:0}],tick:g=>{if(s.props.labels){let f=g/r,v=Dt(tt(0,i,f>.95?1:f),1);c.text=v>0?v+" units\xB2":""}let w=G.aroundPoints(s.path.points).h;h.css("transform",`translateY(${w*(1-g/r)}px)`)}}}function Qg(s,t,e,i){t.removeChildren();let n=Bp(s.path),r=n.points.length,o=n.points.map((v,y)=>new Vt(n.points[gt(y+1,r)],v,n.points[gt(y-1,r)])),a=o.map(v=>v.deg),h=[0,...as(a)],l=.42*Math.min(...n.edges.map(v=>v.length)),c=s.is("polyomino"),u=yr(s.props.color),d=m("g",{class:"axis-label",fill:u},t),g=nh(n,d);return{beats:a.map((v,y)=>({note:ih(s.props.musicScale||"major",y,a.length,s.props.musicScaleRev)+e,duration:a[y]/90,time:h[y]/90})),step:v=>{let y=o[v],$=m("path",{fill:u});if(t.prepend($),s.props.labels){let I=y.bisector,A=I.at(-12/I.length),M=`font-size:${c?12:15}px`;m("text",{text:Dt(a[v])+"\xB0",x:A.x,y:A.y+5,style:M},d)}pt(I=>{let A=new Vt(y.arc.at(1-I),y.b,y.c);$.draw(A.shape(!0,l,!0)),s.props.labels&&(g.text=Math.round(tt(h[v],h[v+1],I))+"\xB0")},a[v]/90*1e3/i)}}}function _p(s,t){let e=()=>{s.props.labels!=="number"&&t.removeChildren()};return new Dr(s,(i,n)=>{switch(s.props.animation){case"area":return ft(ut({},Zg(s,t,i)),{end:e});case"angles":return ft(ut({},Qg(s,t,i,n)),{end:e});default:return ft(ut({},Yg(s,t,i,n)),{end:e})}})}var Fp=6,Jg="M8.1-1.7l-14-8.8c-0.6-0.4-1.4-0.4-2-0.1c-0.6,0.4-1,1-1,1.7V8.8c0,0.7,0.4,1.4,1,1.7c0.3,0.2,0.6,0.3,1,0.3c0.4,0,0.7-0.1,1.1-0.3l14-8.8C8.6,1.3,9,0.7,9,0S8.6-1.3,8.1-1.7z",Ui=!1;function qp(s){if(!Array.isArray(s))return qp([s,0]);let[t,e]=s;if(t instanceof p)return[[t,e]];if(U(t)&&(t=new G(t.c.shift(-t.r),2*t.r,2*t.r)),!(t instanceof V)&&!(t instanceof G))return[[R,0]];let i=t.edges.map(n=>[n.midpoint,n.perpendicularBisector.angle]).filter(n=>!x(n[1],1.5*Math.PI));return hs(i,e)}var Nr=class{constructor(t,e,i){this.tile=t;this.name=e;this.options={};this.cables=new Set;i&&this.setOptions(i)}get location(){let t=this.options.location;return Array.isArray(t)?t[0]:t}get type(){return(this.location||this.tile.path)instanceof p?"POINT":"REGION"}get points(){let t=this.options.location||this.tile.path||R;return qp(t).map(e=>[this.tile.worldPosn(e[0]),e[1]])}setOptions(t,e=!0){Object.assign(this.options,t),e&&this.redraw()}redraw(){for(let t of this.cables)t.redraw()}},Gr=class extends Nr{sendMessage(t){this.cables.size===0&&this.redraw();for(let e of this.cables.values())e.enqueueMessage(t,!1);Hp()}addCable(t,e=!1){this.cables.add(t),!t.to&&!t.dragging&&this.cables.size>1&&this.removeCable(t,!1),e&&(this.tile.updateCableProps(),this.tile.$parent.flushChanges()),this.redraw()}removeCable(t,e=!0){this.cables.delete(t),t.delete(),e&&this.redraw(),this.tile.updateCableProps()}redraw(){if(At(this.cables,t=>t.to))for(let t of this.cables)!t.to&&!t.dragging&&this.removeCable(t);this.cables.size||this.addCable(new ns(this)),super.redraw()}delete(){for(let t of this.cables)t.delete()}},zr=class extends Nr{setOptions(t,e=!0){Object.assign(this.options,t);let i=Array.isArray(t.location)?t.location[0]:t.location;i instanceof p?this.$dot=m("circle",{class:"link-dot persist",r:Fp,cx:i.x,cy:i.y},this.tile.$el):this.$dot&&this.$dot.remove(),e&&this.redraw()}addCable(t,e){e&&this.tile.highlight(!0),this.cables.add(t),this.options.connect&&this.options.connect(t)}removeCable(t,e){var i,n;e&&this.tile.highlight(!1),(n=(i=this.options).disconnect)==null||n.call(i,t),this.cables.delete(t)}delete(){for(let t of this.cables)t.from.tile.$parent.pendingChanges.add(t.from.tile),t.from.removeCable(t)}validateConnection(t){return ah(t,this)}},oh=[],rh=!1;function Hp(){var t,e;if(rh)return;rh=!0;let s=0;for(;oh.length;){if(s>=1e4)throw new Error("Queue overflow!");let[i,n]=oh.shift();(t=i.to)!=null&&t.options.message&&((e=i.to)==null||e.options.message(n,i)),s++}rh=!1}function ah(s,t){if(s.tile===t.tile||t.options.max&&[...t.cables].filter(r=>r.from!==s||r.to!==t).length>=t.options.max)return!1;let e=t.options.tileTypes;if(e){let n=s.tile.props.name;if(!e.includes(n))return!1}let i=s.options.tileTypes;if(i){let n=t.tile.props.name;if(!i.includes(n))return!1}return!0}var ns=class s{constructor(t,e){this.from=t;this.dragging=!1;let i=this.from.tile.$parent,n=t.options.persistent?"":"dashed";this.$group=m("g",{class:"link-bar",style:"display:none"},t.tile.$el),this.$line=m("path",{style:"pointer-events: none",class:n},this.$group),this.$originDot=m("circle",{class:"link-dot",r:Fp},this.$group),this.$handle=m("path",{class:"link-handle",d:Jg},this.$group),this.connectTo(e),i.events.listen(this.$handle,{start:()=>{i.selection.add(t.tile,!0),Ui=this.dragging=!0},move:({posn:o})=>{this.connectTo(i.getInputAt(o,this.from),o)},end:()=>{Ui=this.dragging=!1,this.to&&this.to.tile.highlight(!1),this.redraw(),t.addCable(this,!0)},click:()=>{this.connectTo(),t.addCable(this,!0)}});let r;i.events.listen(this.$originDot,{start:()=>{i.selection.add(t.tile,!0),r=new s(this.from),Ui=r.dragging=!0,this.from.addCable(r)},move:({posn:o})=>{r.connectTo(i.getInputAt(o,this.from),o)},end:()=>{r.to&&r.to.tile.highlight(!1),r.redraw(),Ui=r.dragging=!1,t.addCable(r,!0),r=void 0}})}connectTo(t,e){this.to&&this.to!==t&&this.to.removeCable(this,!0),t?this.to!==t&&ah(this.from,t)&&(this.to=t,t.addCable(this,e!==void 0),this.from.options.connect&&this.from.options.connect(this)):this.to=void 0,this.redraw(e)}redraw(t){var w;if(!((!this.from.options.hidden||this.to||t)&&(this.from.options.persistent||this.from.tile.isActive||((w=this.to)==null?void 0:w.tile.isActive))))return this.$group.hide();if(this.from.tile.$el.append(this.$group),this.$group.show(),!this.to&&!t){let[f,v]=this.from.points[0],y=new wt(R,20).at(v/(Math.PI*2));this.$handle.setTransform(this.from.tile.relativePosn(f).add(y),v),this.$line.setAttr("d",""),this.$originDot.hide();return}let i=this.to?this.to.points:[[t,0]],n=bi(this.from.points,i),[r,o]=Is(n,([f,v])=>p.distance(f[0],v[0])),a=this.from.tile.relativePosn(r[0]),h=o[1]+J((this.to?this.to.tile.rot:180)-this.from.tile.rot),l=this.to?new wt(R,14).at(h/(Math.PI*2)):R,c=this.from.tile.relativePosn(o[0]).add(l),u=p.distance(a,c),d=a.add(p.fromPolar(r[1],u*.7)),g=c.add(p.fromPolar(h,Math.max(u*.7,40)));this.$line.setAttr("d",`M${c.x} ${c.y}C${g.x} ${g.y},${d.x} ${d.y},${a.x} ${a.y}`),this.$handle.setTransform(c,h+Math.PI,this.to?.8:1),this.$originDot.setTransform(a),this.$originDot.show()}delete(){this.connectTo(),this.$group.remove()}enqueueMessage(t,e=!0){if(oh.push([this,t]),e&&Hp(),!this.from.options.highlights)return;let n=t.type==="number"&&t.value===1?q.yellow:q.blue;this.$line.setAttr("style",`stroke: ${n}`),this.$handle.setAttr("style",`fill: ${n}`)}serialize(){return this.to?{fromPort:this.from.name,toTileId:this.to.tile.id,toPort:this.to.name}:void 0}static unSerialize(t,e,i){var o,a;let n=i.tiles.get(t),r=i.tiles.get(e.toTileId);if(n&&r){let h=(o=n.outPorts)==null?void 0:o.get(e.fromPort||"main"),l=(a=r.inPorts)==null?void 0:a.get(e.toPort||"main");h&&l&&ah(h,l)&&h.addCable(new s(h,l))}}static get isMoving(){return Ui}};var _r=["polygon","custom-polygon","reg-polygon","rectangle","polyomino","circle","arrow"],Br=class{constructor(t){this.tileContext=t,this.tileContextProps=this.tileContext.props,this.tileContextProps.watch("color",()=>this.setColor()),this.tileContextProps.watch("textLabel",()=>{var e;this.tileContext.value=(e=pn.fromString(this.tileContextProps.textLabel||""))==null?void 0:e.value,this.renderTextLabel()}),this.tileContextProps.watch("textLabelRotate",()=>this.align()),this.tileContextProps.watch("textLabelFontSize",()=>this.setFontSize())}renderTextLabel(){if(this.$textLabel){this.$textLabel.text=this.tileContextProps.textLabel||"",this.align();return}this.tileContextProps.textLabel&&(this.$textLabel=m("text",{class:"polygon-text-label",text:this.tileContextProps.textLabel,"dominant-baseline":"middle"},this.tileContext.$el),this.setColor(),this.setFontSize(),this.align())}setColor(){this.$textLabel&&this.$textLabel.css("fill",br(this.tileContextProps.color))}setFontSize(){if(!this.$textLabel)return;let t=this.tileContextProps.textLabelFontSize||0;this.$textLabel.css("font-size",mp(t)),this.$textLabel.setAttr("dy",t)}align(){if(!this.$textLabel)return;let t=this.tileContextProps.textLabelRotate?0:-this.tileContext.rot;this.$textLabel.setTransform(this.tileContext.path&&Ye(this.tileContext.path)?this.tileContext.path.centroid:this.tileContext.center,J(t))}};var q={grey:"#cccccc",darkGrey:"#242436",red:"#cd0e66",orange:"#eb4726",yellow:"#fd8c00",lime:"#bfc212",green:"#22ab24",teal:"#009ea6",blue:"#0f82f2",purple:"#6d3bbf",fg:"var(--canvas-fg)",bg:"var(--canvas-bg)"},t0="M12.5,0H0V25H12.5a12.5,12.5,0,0,0,0-25Z",e0="M0,0V12.5a12.5,12.5,0,0,0,25,0V0Z",Fr=new Map,qr=new Map,s0=[];function Ut(s){Fr.set(s.type,s)}function Mt(s){s0.push(...s)}var H=class s{constructor(t,e,i,n){this.$parent=t;this.rot=0;this.snapPoints=[];this.snapLines=[];this.snapAngles=[0,90];this.id=i||We(10),e.name||(e.name=this.constructor.type),this.props=zp(e,this),this.posn=new p(this.props.x||0,this.props.y||0),this.rot=e.rot||0,this.$el=n||m("g",{class:"tile"}),t.tiles.set(this.id,this),qr.set(this.$el._el,this),t.pendingChanges.add(this),this.props.watch("status",({status:r})=>{this.$el.setClass("locked-tile",r==="locked"),this.$el.setClass("hidden-tile",r==="hidden"),this.canSelect||this.$parent.selection.remove(this)}),this.props.watch("sound",r=>Np(r.sound||"piano")),this.props.watch("zIndex layer",()=>this.updateZIndex(!0)),this.props.watch("hideHandles",()=>this.$el.setClass("no-handles",!this.showHandles))}static create(t,e,i){let n=Fr.get(e.name);if(!n)throw new Error(`Unknown tile type: ${e.name}`);let r=Object.assign({},n.defaultProps||{},e);r.arpeggio===!1&&!r.musicScale&&(r.musicScale="none",r.arpeggio=void 0);let o=new n(t,r,i);return o.setTransform(),o}static thumbnail(t,e,i){var o,a;let n=Fr.get(e);if(!n)throw new Error(`Unknown tile type: ${e}`);let r=we(i.attr("props"),{});return i.setAttr("aria-label",((o=n.altText)==null?void 0:o.call(n,r))||r.name),(a=n.makeThumbnail)==null?void 0:a.call(n,i,r,t)}delete(){var t,e,i;if(!this.isDeleting){this.isDeleting=!0,(t=this.track)==null||t.stop(),this.collision&&this.collision.setCollision();for(let n of this.optionListeners||[])this.$parent.options.unwatch(n);for(let n of this.stateListeners||[])this.$parent.state.unwatch(n);this.$parent.selection.remove(this);for(let n of((e=this.inPorts)==null?void 0:e.values())||[])n.delete();for(let n of((i=this.outPorts)==null?void 0:i.values())||[])n.delete();this.$parent.tiles.delete(this.id),this.$parent.zIndex.remove(this),this.$parent.mathContext.removeSource(this),qr.delete(this.$el._el),this.$parent.pendingChanges.add(this),this.$el.remove()}}applyChange(t){this.props.assign(t),this.flushChanges(),("x"in t||"y"in t||"rot"in t)&&this.setTransform(new p(this.props.x,this.props.y),this.props.rot)}flushChanges(){return this.props.flushChanges()}setupAudioTrack(){}makeHandle(t,e,i,n,r){let a=m(t==="c"?"circle":"path",{class:"handle"},this.$el);return t==="h"&&a.setAttr("d",t0),t==="v"&&a.setAttr("d",e0),t==="c"&&a.setAttr("r",10),a.css("cursor",t==="c"?"move":t==="h"?"ew-resize":"ns-resize"),this.$parent.events.listen(a,{down:()=>{var h;return(h=this.track)==null?void 0:h.stop()},start:()=>{this.$parent.selection.add(this.root,!0),n==null||n()},move:h=>e(this.relativePosn(h.posn),h.posn,h.event),click:()=>i==null?void 0:i(),end:()=>{r==null||r(),this.$parent.flushChanges()}}),a}is(t){return this.props.name===t}get $container(){return this.$parent.$tiles[this.props.layer==="back"?0:this.props.layer==="front"?2:1]}updateZIndex(t){t&&this.$parent.zIndex.addOrUpdate(this);let e=this.$parent.zIndex.getTileAbove(this);if(!e)return this.$container.append(this.$el);e.$el.insertBefore(this.$el)}get canSelect(){return this.$parent.state.authorMode?!0:this.props.status!=="hidden"&&this.props.status!=="locked"}get canEdit(){return this.$parent.state.authorMode?!0:!this.authoringOnly&&this.props.status!=="fixed"&&this.props.status!=="generator"}get canRotate(){return this.cannotRotateType?!1:this.$parent.state.authorMode?!0:this.canEdit&&!this.$parent.options.noRotating&&!this.props.cannotRotate}get showHandles(){return this.$parent.state.authorMode?!0:!this.props.hideHandles&&!this.authoringOnly&&this.props.status!=="generator"}get altText(){var e;if(this.props.altText)return this.props.altText;let t=Fr.get(this.props.name);return((e=t==null?void 0:t.altText)==null?void 0:e.call(t,this.props))||this.props.name}watchPolypadOptions(t){this.optionListeners||(this.optionListeners=[]),this.optionListeners.push(t),this.$parent.options.watch(t)}watchPolypadState(t){this.stateListeners||(this.stateListeners=[]),this.stateListeners.push(t),this.$parent.state.watch(t)}showErrorIcon(t){var e;if(this.currentError=t,!t)return(e=this.$errorIcon)==null?void 0:e.detach();this.$errorIcon||(this.$errorIcon=m("g",{style:"cursor: pointer"}),m("circle",{cx:12,cy:12,r:12,fill:"transparent"},this.$errorIcon),fp("warning",q.yellow,24,void 0,this.$errorIcon),this.transform(),this.$parent.events.listen(this.$errorIcon,{click:()=>{let i=this.$errorIcon.transformMatrix,n=this.posn.shift(i[0][2],i[1][2]);this.$parent.warningBanner.show(n,this.currentError)}})),this.$el.append(this.$errorIcon)}setCollision(t){var e;!this.canEdit||t&&!t.canEdit||t&&t===this.collision||((e=this.collision)==null||e.highlight(!1),this.collision=t,t==null||t.highlight(!0))}collide(t){}get root(){var t;return((t=this.group)==null?void 0:t.root)||this}flipColor(t){let{color:e,backColor:i}=this.props;this.props.color=i||t,this.props.backColor=e}click(t,e){}doubleClick(t){}down(t){}up(t){}format(t,e){}focus(){this.$parent.focussedTile=this,this.$parent.selection.clear(),this.isFocussed=!0,this.$parent.trigger("change-focus",{tiles:[this]})}blur(){this.isFocussed=!1,this.$parent.focussedTile=void 0,this.$parent.trigger("change-focus",{tiles:[]})}highlight(t=!0){}onDropzonesChange(){}select(){this.isActive=!0,this.$el.addClass("active"),this.$el.setClass("no-handles",!this.showHandles),this.noAutoLayering||this.updateZIndex(),this.redrawCables()}deselect(){this.isDeleting||(this.isActive=!1,this.$el.removeClass("active"),this.noAutoLayering||this.updateZIndex(),this.redrawCables())}moveStart(t=!1){this.startPosn=this.posn}move(t,e){var i;if(t){let n=(i=this.startPosn)==null?void 0:i.add(t);n&&(this.posn=n),this.transform(!0)}}moveEnd(){this.collision&&this.collide(this.collision),this.setTransform()}rotate(t,e=R){this.posn=this.posn.rotate(J(t),e),this.rot=gt(this.rot+t,360),this.transform(!0)}transform(t){var i,n;let e=J(this.rot);this.$el.setTransform(this.posn,e),this.redrawCables(),!t&&this.path&&(this.transformed=this.path.rotate(e).translate(this.posn),this.padding&&(this.transformedPadded=Lt(this.path).padding(...this.padding).rotate(e).translate(this.posn)),this.snapPoints=this.getSnapPoints().map(r=>r.rotate(e).translate(this.posn)),this.snapLines=this.getSnapLines().map(r=>r.rotate(e).translate(this.posn)),(i=this.$errorIcon)==null||i.setTransform(Lt(this.path).p.shift(-28,5)),(n=this.group)==null||n.transform())}setTransform(t=this.posn,e=this.rot){this.posn=t,this.props.x=t.x,this.props.y=t.y,this.rot=this.props.rot=gt(e,360),this.transform()}getSnapPoints(){return this.path?rt(this.path)?[this.path]:St(this.path)?this.path.points:it(this.path)?[this.path.p1,this.path.p2]:U(this.path)?[this.path.c,this.path.c.shift(0,this.path.r),this.path.c.shift(0,-this.path.r),this.path.c.shift(this.path.r,0),this.path.c.shift(-this.path.r,0)]:Ze(this.path)?[...this.path.majorVertices,...this.path.minorVertices]:Pe(this.path)?[this.path.c,this.path.start,this.path.end]:Nt(this.path)?[this.path.start,this.path.end]:Ft(this.path)?[]:[]:[]}getSnapLines(){return[]}relativePosn(t){return t.subtract(this.posn).rotate(-J(this.rot))}worldPosn(t){return t.rotate(J(this.rot)).add(this.posn)}get center(){return this.path?U(this.path)||Ze(this.path)?this.path.c:Lt(this.path).center:R}contains(t){let e=this.transformed;return!e||!St(e)&&!U(e)&&!Pe(e)?!1:e.contains(t)}findNearby(t,e,i){let n=i||this.worldPosn(this.center);for(let r of this.$parent.getTilesOfType(t))if(r!==this&&p.distance(n,r.worldPosn(r.center))Array.from(ke([l],!0),g=>{let w=g.posn.add(c).subtract(l.posn);return{tile:g,posn:w,rot:u,scale:d}})),o=r.map(l=>l.tile.posn),a=r.map(l=>l.tile.rot);for(let l of r)l.tile.setTransform(l.posn,(h=l.rot)!=null?h:l.tile.rot),e&&(l.tile.isAnimating=!0);if(!e)return Promise.resolve();yield pt(l=>{var c,u;l=yt(n,l);for(let[d,g]of r.entries()){let w=J(tt(a[d],(c=g.rot)!=null?c:g.tile.rot,l));if(g.tile.is("group")){let f=p.interpolate(o[d].subtract(g.posn),R,l);g.tile.transformed=g.tile.path.rotate(w,g.tile.path.center).translate(f)}else{let f=p.interpolate(o[d],g.posn,l),v=g.scale?tt(g.scale[0],g.scale[1],l):void 0;g.tile.$el.setTransform(f,w,v),g.tile.transformed=(u=g.tile.path)==null?void 0:u.rotate(w).translate(f)}}i&&i(l)},e).promise;for(let l of r)l.tile.isAnimating=!1})}delayedSetup(){var e;for(let i of((e=this.outPorts)==null?void 0:e.values())||[])for(let n of i.cables)n.delete();let t=this.props.cables||[];for(let i of t)ns.unSerialize(this.id,i,this.$parent)}redrawCables(){var t,e;for(let i of((t=this.inPorts)==null?void 0:t.values())||[])i.redraw();for(let i of((e=this.outPorts)==null?void 0:e.values())||[])i.redraw()}makeInPort(t,e){this.inPorts||(this.inPorts=new Map),this.inPorts.has(t)||this.inPorts.set(t,new zr(this,t));let i=this.inPorts.get(t);return i.setOptions(e,!1),i}makeOutPort(t,e){this.outPorts||(this.outPorts=new Map),this.outPorts.has(t)||this.outPorts.set(t,new Gr(this,t));let i=this.outPorts.get(t);return i.setOptions(e,!1),i}emitMessage(t,e){var i;typeof t=="string"&&(t=(i=this.outPorts)==null?void 0:i.get(t)),t==null||t.sendMessage(e)}*getCableData(t="out"){let e=t==="in"?this.inPorts:this.outPorts;if(e)for(let i of e.values())for(let n of i.cables)(t==="in"||n.to)&&(yield n.serialize())}updateCableProps(){if(this.$parent.setup)return;let t=Array.from(this.getCableData());this.props.cables=t.length?t:void 0}getClosestPort(t,e,i=10){if(!this.inPorts)return;let n=this.relativePosn(t);for(let a of this.inPorts.values())if(a.location&&rt(a.location)&&p.distance(a.location,n)<=i&&(!e||a.validateConnection(e)))return a;if(!this.contains(t))return;let r=Array.from(this.inPorts.values()).filter(a=>!e||a.validateConnection(e));for(let a of r.filter(h=>h.type==="REGION"))if((a.location||this.path).contains(n))return a;let o=r.filter(a=>a.type==="POINT");return Is(o,a=>p.distance(n,a.location))}},i0=new vt(R,new p(0,1)),n0=new G(R,50,50).shift(-25,-25).polygon,ii=class extends H{constructor(t,e,i){super(t,e,i),this.$path=m("path",{class:"polygon-tile"},this.$el),this.$outline=m("path",{class:"outline"},this.$el),this.props.watch("color",({color:n})=>this.$path.setAttr("fill",n)),this.textLabelInstance=new Br(this)}transform(t){var e;super.transform(t),(e=this.textLabelInstance)==null||e.align()}setPath(t=n0,e,i){if(e&&!this.symmetric&&(t=t.reflect(i0)),this.path=t,St(t)&&(this.snapAngles=Wt(t.edges.map(o=>gt(Math.round(Kt(o.angle)),180)))),this.$path.draw(t,{cornerRadius:i}),this.$outline.draw(t,{cornerRadius:i}),this.transform(),!St(t))return;let n=G.aroundPoints(t.points),r=new p(n.center.x,n.p.y);this.showSelectionOutline=p.distance(r,t.project(r))>5}select(){var t,e;(t=this.track)==null||t.stop(),(e=this.$audio)==null||e.removeChildren(),super.select()}setupAudioTrack(){St(this.path)&&(this.$audio=m("g",{style:"font-size:15px;font-weight:600",fill:"white"}),this.$outline.insertBefore(this.$audio),this.track=_p(this,this.$audio),this.props.watch("labels",()=>this.track.stop()))}flip(t){this.props.isFlipped=!this.props.isFlipped||void 0;let e=new p(2*t.x-this.posn.x,this.posn.y);this.setTransform(e,-this.rot)}};var Hr={point:(s,t)=>s!==void 0&&t!==void 0?new p(s,t):void 0,angle:(s,t,e)=>s&&t&&e?new Vt(s,t,e):void 0,line:(s,t)=>s&&t&&!s.equals(t)?new vt(s,t):void 0,segment:(s,t)=>s&&t&&!s.equals(t)?new Y(s,t):void 0,circle:(s,t)=>s&&t?new wt(s,t):void 0,arc:(s,t,e)=>s&&t&&e?new qt(s,t,e):void 0,polygon:(...s)=>s.every(Boolean)?new V(...s):void 0,polyline:(...s)=>s.every(Boolean)?new te(...s):void 0,triangle:(s,t,e)=>s&&t&&e?new Pi(s,t,e):void 0,rectangle:(s,t,e)=>s?new G(s,t,e):void 0,distance:p.distance,intersections:Q},r0=/^_x\d+\.at\([\d.e-]+\)$/,o0=/^intersections\(|\.midpoint$|\.centroid$/,jr=class{constructor(){this.model=le({});this.tiles=new Map;this.dependencies=new Map;this.model.assign(Hr),this.queueLabelPositioning=ve(()=>{for(let t of this.tiles.values())Kp(t)},0,!0)}reset(){this.model.clear(),this.model.assign(Hr)}redrawLines(t){for(let e of this.tiles.values())e.path&&Ko(e.path)&&(e.$el.draw(e.path,{box:t}),e.$shadow.setAttr("d",e.$el.attr("d")))}},Yt=class extends H{constructor(e,i,n){super(e,i,n,m("path",{class:"geo-path"},e.$geoPaths));this.$parent=e;this.hideSelectionOutline=!0;this.noAutoLayering=!0;this.isProjection=!1;this.parentKeys=[];this.deleted=!1;this.onDraw=()=>this.draw();this.$shadow=m("path",{class:"geo-shadow"},e.$geoShadows),this.props.key||(this.props.key=e.geoData.model.getKey()),e.geoData.tiles.set(this.props.key,this),this.snapPoints=this.snapLines=this.snapAngles=[],this.props.expr&&this.setExpr(this.props.expr),e.geoData.model.watch(this.onDraw),this.props.color||(this.props.color=e.state.penColor),this.props.watch("color",({color:r})=>{var o,a,h;(o=this.$el)==null||o.css("color",r),(a=this.$shadow)==null||a.css("color",r),(h=this.$label)==null||h.setAttr("fill",r)}),this.props.watch("arrows marks",()=>this.draw(!0)),this.props.watch("label",({label:r})=>{if(!r&&this.$label)return this.$label.detach();this.$label||(this.$label=m("text",{fill:this.props.color,class:"geo-label"})),this.$parent.$geoPoints.append(this.$label),Kp(this)})}applyChange(e){super.applyChange(e),"expr"in e&&this.setExpr(this.props.expr)}setExpr(e,i=!1){let n=ct(e);this.$parent.geoData.model.setComputed(this.props.key,n),!i&&(this.props.expr=e,this.setParentKeys(e.match(/_x\d+/g)||[]),this.isProjection=r0.test(e),this.computed=o0.test(e),this.$el.setClass("intersection",this.computed))}draw(e=!1){let i=this.$parent.geoData.model[this.props.key];if(!e&&i===this.path)return;this.path=i,this.$el.setAttr("hidden",i?void 0:!0),this.isActive&&!i&&this.$shadow.hide();let n=i==null?void 0:i.type;if(n!==this.geoType&&(this.$el.setClass("geo-point",n==="point"),this.$el.setClass("geo-path",n!=="point"),this.geoType=n,this.$container.append(this.$el)),!i)return;n==="point"&&(i=new wt(i,this.computed?3.5:6)),this.$el.setClass("fill",this.geoType==="angle");let r=this.$parent.canvasBounds||this.$parent.viewportBounds;this.$el.draw(i,{box:r.rect,arrows:this.props.arrows,mark:this.props.marks}),this.$shadow.setAttr("d",this.$el.attr("d")),this.transform()}setParentKeys(e){var n;let i=this.$parent.geoData.dependencies;for(let r of this.parentKeys)(n=i.get(r))==null||n.delete(this.props.key);this.parentKeys=e;for(let r of e)i.has(r)||i.set(r,new Set),i.get(r).add(this.props.key)}get parents(){let e=this.$parent.geoData.tiles;return this.parentKeys.map(i=>e.get(i)).filter(Boolean)}get children(){let e=this.$parent.geoData.dependencies.get(this.props.key);return e?Array.from(e).map(i=>this.$parent.geoData.tiles.get(i)).filter(Boolean):[]}get ariaDescription(){var e;return`${(e=this.path)==null?void 0:e.type} ${this.props.key}: ${this.props.expr}`}get $container(){return this.geoType==="point"?this.$parent.$geoPoints:this.$parent.$geoPaths}select(){var e;this.isActive=!0,this.path&&(this.geoType==="angle"?this.$el.addClass("hover"):(this.$shadow.show(),(e=this.$el.parent)==null||e.append(this.$el)))}deselect(){this.isActive=!1,this.$shadow.hide(),this.$el.removeClass("hover")}hover(e=!0){this.isActive||!this.path||(this.geoType==="angle"?this.$el.setClass("hover",e):e?this.$shadow.show():this.$shadow.hide())}transform(){this.transformed=this.path,this.snapPoints=this.pending?[]:this.getSnapPoints(),this.snapLines=this.pending||!this.path||rt(this.path)||Ft(this.path)?[]:[this.path],this.$parent.geoData.queueLabelPositioning()}setTransform(){this.transform()}shift(e){/^point\([\d.-]+,[\d.-]+\)$/.test(this.props.expr)&&this.setExpr(this.path.translate(e).toString())}delete(){var e;this.deleted=!0,super.delete(),this.$parent.geoData.model.unwatch(this.onDraw),this.$parent.geoData.model[this.props.key]=void 0,this.$parent.geoData.tiles.delete(this.props.key),this.$shadow.remove(),(e=this.$label)==null||e.remove();for(let i of this.children)i.delete()}setPending(e=!0){this.pending=e,e||this.transform();for(let i of this.children)i.setPending(e)}moveStart(){if(!(this.computed||!this.path)){if(this.isProjection){if(this.$parent.selection.size>1)return;this.setParentKeys([])}this.setPending(!0);for(let e of this.parents)e.moveStart();this.moveStartValue=this.transformed}}move(e,i){if(!(!e||!this.path||!this.moveStartValue))if(rt(this.path))this.snapTarget=i,this.$el.setClass("intersection",this.computed||!!(i!=null&&i.intersection)),this.$parent.geoData.model[this.props.key]=this.moveStartValue.translate(e);else for(let n of this.parents)n.move(e)}moveEnd(){var e,i,n,r;if(this.moveStartValue){for(let o of this.parents)o.moveEnd();if(this.setPending(!1),(e=this.snapTarget)!=null&&e.intersection)this.setExpr(this.snapTarget.intersection);else if(((n=(i=this.snapTarget)==null?void 0:i.tile)==null?void 0:n.props.name)==="geo"){let o=(r=this.snapTarget)==null?void 0:r.tile;if(o.path&&rt(o.path)){let a=this.children;for(let h of a)h.setExpr(h.props.expr.replaceAll(this.props.key,o.props.key));this.delete(),this.$parent.flushChanges()}else if(o.path){let a=o.path.offset(this.$parent.geoData.model[this.props.key]);this.setExpr(`${o.props.key}.at(${a})`)}}else this.path&&rt(this.path)&&(this.props.expr=`point(${this.path.x},${this.path.y})`,this.isActive||this.$parent.pendingChanges.add(this))}}static getInferredShape(e){if(e=e.filter(h=>h.path),!e.length)return;if(e.length===1)return{type:e[0].path.type,expr:e[0].props.key,value:e[0].path};e=e.filter(h=>h.geoType!=="angle");let i=e.filter(h=>rt(h.path)),n=e.filter(h=>it(h.path)||U(h.path));if(n.length===1&&i.length===e.length-1){let h=n[0].path;if(i.every(l=>h.contains(l.path)))return{type:h.type,expr:n[0].props.key,value:h}}let r=n.filter(h=>it(h.path));if(i.length+r.length!==e.length)return;for(let h of r)if($e(h.path)){let l=h.parentKeys.map(c=>h.$parent.geoData.tiles.get(c));for(let c of l)i.includes(c)||i.push(c)}else if(i.filter(l=>h.path.contains(l.path)).length<2)return;let o=i.map(h=>h.props.key).join(","),a=i.map(h=>h.path);if(i.length===2){let h=new Y(a[0],a[1]);return{type:"segment",expr:`segment(${o})`,value:h}}return i.length===3?{type:"triangle",expr:`triangle(${o})`,value:new Pi(...a)}:{type:"polygon",expr:`polygon(${o})`,value:new V(...a)}}static copy(e,i,n){let r=h=>{let l=e.get(h)||n.model.getKey();return e.set(h,l),l},o=r(i.key),a=i.expr.replace(/\b_x\d+\b/g,r);return{key:o,expr:a}}};Yt.type="geo",Yt=T([Ut],Yt);var jp=new WeakMap,Up=s=>{let t=jp.get(s);if(t)return t;let e=Yt.getInferredShape(s);return jp.set(s,e),e};Mt([["Midpoint","geo-midpoint","$0.midpoint","segment"],["Perpendicular bisector","geo-perp-bisector","$0.perpendicularBisector","segment"],["Parallel line","geo-parallel","$0.parallel($1)","line","segment"],["Perpendicular line","geo-perpendicular","$0.perpendicular($1)","line","segment"],["Tangent line","geo-tangent","line($0.c,$1).perpendicular($1)","circle"],["Centroid","geo-centroid","$0.centroid","polygon","triangle"],["Circumcircle","geo-circumcircle","$0.circumcircle","triangle"],["Incircle","geo-incircle","$0.incircle","triangle"],["Angle bisector","geo-angle-bisector","$0.bisector","angle"]].map(([s,t,e,...i])=>({id:t,type:"button",tileTypes:["geo"],label:s,icon:t,noFlush:!0,show:n=>{var r;return i.includes(((r=Up(n))==null?void 0:r.type)||"")},click:(n,r)=>{var h;let o=(h=Up(n))==null?void 0:h.expr,a=e.replace(/\$0/g,o||"");if(a.includes("$1"))r.tools.geoPending.enable(a);else{let l=H.create(r,{name:"geo",expr:a});r.selection.add(l,!0);let c=rt(l.path)?"pop":"draw",u=l.$el.enter(c,400);l.$shadow.enter(c,400),r.snapping.updateIntersections(),r.flushChanges(),u.promise.then(()=>l.$el.css("display",""))}}})));Mt([{id:"line-style",type:"select",tileTypes:["geo"],label:"Line Type:",location:"more",show:s=>s.every(t=>t.path&&it(t.path)),options:[{key:"line",label:"Line"},{key:"ray",label:"Ray"},{key:"segment",label:"Segment"}],get:s=>s.geoType,set:(s,t)=>t.setExpr(t.props.expr.replace(/\.(line|ray|segment)$/,"")+`.${s}`)},{id:"arrows",type:"select",tileTypes:["geo"],label:"Arrows:",location:"more",show:s=>s.every(t=>t.geoType==="segment"),options:[{key:"",label:"None"},{key:"start",label:"Start"},{key:"end",label:"End"},{key:"both",label:"Both"}],get:s=>s.props.arrows||"",set:(s,t)=>t.props.arrows=s||void 0},{id:"marks",type:"select",tileTypes:["geo"],label:"Decoration:",location:"more",show:s=>s.every(t=>t.path&&it(t.path)),options:[{key:"",label:"None"},{key:"bar",label:"Bar"},{key:"bar2",label:"Double Bars"},{key:"arrow",label:"Arrow"},{key:"arrow2",label:"Double Arrows"}],get:s=>s.props.marks||"",set:(s,t)=>t.props.marks=s||void 0}]);Mt([{id:"label",type:"input",tileTypes:["geo"],label:"Label:",location:"more",get:s=>s.props.label||"",set:(s,t)=>t.props.label=s}]);var Wp=Math.PI/12;function a0(s){return be(s/Wp,.03)?new pn(Math.round(s/Wp),12,"\u03C0").simplified.toString():Rt(s,4)}function h0(s,t){return $e(t)?s.replace(/\$l/g,Rt(t.length/50,4)):St(t)||U(t)?s.replace(/\$[cp]/g,Rt(t.circumference/50,4)).replace(/\$a/g,Rt(t.area/2500,4)):Ft(t)?s.replace(/\$r/g,a0(t.rad)).replace(/\$d/g,Rt(t.deg,4)+"\xB0"):s}function Kp(s){if(!s.props.label||!s.path)return;s.$label.text=h0(s.props.label,s.path);let[t,e]=l0(s);s.$label.css("transform",`translate(${t.x}px,${t.y}px) rotate(${e}rad)`)}function l0(s){let t,e=s.$label.width,i=12,n=new G(new p(-e/2-3,-i-3),e+6,i+6);for(let r of c0(s.path,s,e,i)){t||(t=r);let o=n.rotate(r[1]).translate(r[0]);if(!At(s.$parent.geoData.tiles.values(),a=>{if(!a.path||a.props.status==="hidden"||a===s)return!1;let h=rt(a.path)?new wt(a.path,10):a.path;if(Q(h,o).length)return!0}))return r}return t||[R,0]}function*c0(s,t,e,i){var n;if(rt(s)){let r=t.computed?8:10;yield[s.shift(r+e/2,-r),0],yield[s.shift(-r-e/2,-r),0],yield[s.shift(r+e/2,r+i),0],yield[s.shift(-r-e/2,r+i),0]}else if(it(s)){let r=s.perpendicularVector,o=s.angle;r.y>=0&&(r=r.scale(-1),o+=Math.PI);let a=$e(s)?[.5,.3,.7]:[0,150,-150];for(let h of a)for(let l of[8,-8-i])yield[s.at(h).add(r.scale(l)),o]}else if(St(s))for(let r of s.edges){let o=r.perpendicularVector.scale(8),a=r.angle;o.y>=0&&(o=o.scale(1+i/8),a+=Math.PI),yield[r.midpoint.add(o),a]}else if(U(s))yield[s.at(7/8).shift(5+e/2,-5),0],yield[s.at(5/8).shift(-5-e/2,-5),0],yield[s.at(1/8).shift(5+e/2,5+i),0],yield[s.at(3/8).shift(-5-e/2,5+i),0];else if(Ft(s)){let r=s.isRight?20*Math.sqrt(2):s.radius,o=((n=s.bisector)==null?void 0:n.unitVector.scale(r+6))||R,a=o.angle();yield[s.b.add(o).shift(e/2*Math.cos(a),i/2*(1+Math.sin(a))),0]}}var Ms=25,Yp=5.4,Zp=4.7;var p0="#ddd",d0={1:q.yellow,x:q.green,x2:q.blue,y:q.teal,y2:"#8d2ca1",xy:"#4e53d0"},hh=s=>s[0]==="-"?q.red:d0[s],Xp=s=>s[0]==="-"?s.slice(1):"-"+s;function lh({splitH:s,splitV:t,expr:e},i=!1){let n=s*t;return e.replace(/2$/,"^2")+(n>1?`${i?"//":"/"}${n}`:"")}function Ur(s,t,e,i){switch(s.startsWith("-")?s.slice(1):s){case"x2":return[e,e];case"y2":return[i,i];case"xy":return[e,i];case"x":return[t,e];case"y":return[t,i];default:return[t,t]}}function Qp(s){let[t,e]=s.reduce(([n,r],{props:o})=>{let a=o.splitH*o.splitV;return[n*a+r,r*a]},[0,1]),i=xe(t,e);return[t/i,e/i]}function*u0(s){let t=s,e=[];for(let i=1;ithis.updateFill()),this.props.watch("labels expr",()=>this.updateLabel()),this.resize(),this.move()}applyChange(t){super.applyChange(t),this.resize(),this.move()}get isRotated(){return nt(this.rot,45,135)||nt(this.rot,225,315)}get denominator(){return this.props.splitV*this.props.splitH}isInverseOf(t){return this.denominator===t.denominator&&Xp(this.props.expr)===t.props.expr}get size(){let{algebraXSize:t,algebraYSize:e}=this.$parent.options,{expr:i,splitV:n,splitH:r}=this.props,[o,a]=Ur(i,1,t,e);return[o*Ms/r,a*Ms/n]}resize(){let[t,e]=this.size;this.setPath(up(t,e).polygon)}updateLabel(){let[t,e]=this.size;this.isRotated&&([t,e]=[e,t]);let i=this.props.labels!=="hidden"&&t>=12&&e>=12;if(this.$label.toggle(i),!i)return;this.labelEqn.setValue(this.collision?"0":lh(this.props,e<25));let n=this.labelEqn.root,r=Math.min((t-2)/n.width*.8,e/n.height*.8,1);this.labelEqn.$row.css("transform",`translate(${-n.width/2}px,${-n.height/2}px)`),this.$label.css("transform",`scale(${r}) rotate(${-this.rot}deg)`)}updateFill(){this.$path.setAttr("fill",this.collision?_e(p0,this.$parent.flipTheme):this.props.color)}transform(t){this.updateLabel(),super.transform(t)}getSideLength(t){this.isRotated&&(t=t==="h"?"v":"h");let{expr:e,splitV:i,splitH:n}=this.props,[r,o]=Ur(e,"1","x","y");return t==="h"?[r,1/n]:[o,1/i]}getEdge(t){let e=gt(t-Math.round(this.rot/90),4);return this.transformed.edges[e]}setCollision(t){this.collision=t,this.updateFill(),this.updateLabel()}move(t){super.move(t);let e=this.collision;if(e){if(p.distance(this.posn,e.posn)<.95*Ms&&this.isInverseOf(e))return;e.setCollision(),this.setCollision()}for(let i of this.$parent.getTilesOfType("algebra"))if(!(i.collision||!this.isInverseOf(i))&&!(p.distance(this.posn,i.posn)>=.95*Ms)){this.setCollision(i),i.setCollision(this);return}}split(t,e=2){this.isRotated&&(t=t==="h"?"v":"h");let[i,n]=this.size,r=t==="h"?new Y(new p(-i/2,0),new p(i/2,0)):new Y(new p(0,-n/2),new p(0,n/2)),o=ft(ut({},this.props.raw),{splitH:t==="h"?this.props.splitH*e:this.props.splitH,splitV:t==="v"?this.props.splitV*e:this.props.splitV});return this.delete(),z(a=>{let h=this.worldPosn(r.at((a+.5)/e));return H.create(this.$parent,Object.assign({},o,{x:h.x,y:h.y}))},e)}static merge(t){let e=Lt(...t.map(w=>w.transformed)),{x:i,y:n}=e.center,r=t.every(w=>w.isRotated)?90:0,o=t[0].props.expr,{algebraXSize:a,algebraYSize:h}=t[0].$parent.options,l=Ur(o,Ms,a*Ms,h*Ms)[0],c=Qp(t)[1],u=[...u0(c)].find(w=>w>=Math.round(l/(r?e.h:e.w)))||1,d=c/u,g=H.create(t[0].$parent,{name:"algebra",expr:o,splitH:u,splitV:d,x:i,y:n,rot:r});for(let w of t)w.delete();return g}static makeThumbnail(t,e){let i=e.expr,[n,r]=Ur(i,20,78,64),o=i[0]==="-"?i.slice(1):i,a=o==="y2"?112:["x2","xy"].includes(o)?28:2,h=o==="1"?2:["x","x2"].includes(o)?28:112;e.rot&&([a,h,n,r]=[h,a,r,n]),t.setRect(new G(new p(a,h),n,r)),t.setAttr("fill",hh(i));let l=m("g",{style:"font-size:15px;color:white;text-anchor:start",class:"equation"}),c=new Be(l,void 0,0,"",15,!0);c.setValue(lh(e)),c.$row.css("transform",`translate(${a+n/2-c.root.width/2}px, ${h+r/2-c.root.height/2}px)`),t.insertAfter(l)}static altText(t){return lh(t)+" Algebra Tile"}negate(){this.props.expr=Xp(this.props.expr),this.flipColor(hh(this.props.expr)),this.move()}};Cs.type="algebra",Cs.defaultProps={splitH:1,splitV:1},Cs=T([Ut],Cs);Mt([{id:"negate",type:"button",tileTypes:["algebra","dot","number-card"],label:"Negate",icon:"turn",useTextLabel:!0,click:s=>{for(let t of s)t.negate()}}]);Mt([{id:"merge-algebra",type:"button",tileTypes:["algebra"],label:"Merge",icon:"merge",useTextLabel:!0,show:s=>s.length<2||!s.every(t=>t.props.expr===s[0].props.expr)?!1:Qp(s)[0]===1,click:(s,t)=>{t.selection.add(Cs.merge(s),!0)}},{id:"splitV",type:"button",tileTypes:["algebra"],label:"Split Vertically",icon:"split-v",show:s=>s.every(t=>t.props.splitV<8),click:(s,t)=>{t.selection.select(s.flatMap(e=>e.split("v",2)))}},{id:"splitH",type:"button",tileTypes:["algebra"],label:"Split Horizontally",icon:"split-h",show:s=>s.every(t=>t.props.splitH<8),click:(s,t)=>{t.selection.select(s.flatMap(e=>e.split("h",2)))}},{id:"split",type:"range",tileTypes:["algebra"],label:"Denominator:",value:"number",icon:"split-h",location:"more",get:s=>[s.props.splitH,s.props.splitV],set:(s,t)=>{t.props.assign({splitH:B(Math.round(s[0]),1,8),splitV:B(Math.round(s[1]),1,8)}),t.resize(),t.updateLabel()}}]);var Jp=1,f0=.2,m0=5;function g0([s,t],e,i){if(!i)return[Math.min(s,e),Math.max(t,e)];let n=th.length)),n=O(i),r=i.findIndex(h=>h/n>t)+1,o=i.findIndex(h=>h/n>e)+1,a=t<=e?s.points.slice(r,o):[...s.points.slice(r),...s.points.slice(0,o)];return new te(s.at(t),...a,s.at(e))}return s}function ch(s,t,e,i){let n=Jp,r=-1;for(let o=t+1;on&&(r=o,n=a)}n>Jp&&(r-t>1&&ch(s,t,r,i),i.push(s[r]),e-r>1&&ch(s,r,e,i))}function w0(s){if(s.length<=2)return s;let t=[s[0]];return ch(s,0,s.length-1,t),t.push(O(s)),t}function y0(s){if(s.length<=2)return De(new te(...s));let t=s.map((e,i)=>{let n=s[i-1]||e.subtract(s[i+1].subtract(e).unitVector),r=s[i+1]||e.subtract(s[i-1].subtract(e).unitVector),o=Math.atan2(r.y-n.y,r.x-n.x),a=Math.abs(new Vt(n,e,r).sup.rad/Math.PI-.5),h=Math.min(p.distance(n,r),100)*a*f0;return new p(Math.cos(o),Math.sin(o)).scale(h)});return s.map((e,i)=>{if(i===0)return`M${e.x.toFixed(2)} ${e.y.toFixed(2)}`;if(p.distance(s[i-1],e)<4)return`L${e.x.toFixed(2)},${e.y.toFixed(2)}`;let n=s[i-1].add(t[i-1]),r=e.subtract(t[i]);return`C${n.x.toFixed(2)},${n.y.toFixed(2)} ${r.x.toFixed(2)},${r.y.toFixed(2)} ${e.x.toFixed(2)},${e.y.toFixed(2)}`}).join("")}var He=class s{constructor(t,e,i,n,r){this.$parent=t;this.brush=n;this.options="";this.$el=m("path",{class:`stroke ${n}`},t.$strokes),this.id=r||We(10),this.setColor(i),e&&this.parse(e),t.strokes.set(this.id,this),this.$parent.pendingStrokes.add(this)}setColor(t){this.color=t,this.$el.setAttr("stroke",_e(t,this.$parent.flipTheme))}parse(t){if(this.options=t,t.startsWith("M")){let e=oa(t);this.path=new te(...e),this.$el.setAttr("d",t)}else this.path=ct(t)(Hr),this.path&&(this.snap=!0),this.$el.setAttr("d",this.path?De(this.path):"")}start(t,e){var i;if(this.brush==="ruler"&&(t=((i=this.$parent.snapping.snap([t]))==null?void 0:i.posn)||t),this.startPoint=t,this.path=new te(t,t.shift(.01)),e&&this.brush!=="ruler"){this.utensil=e;let n=e.offset(t);this.utensilRange=[n,n+.01]}this.$el.draw(this.path)}addPoint(t){if(this.brush==="ruler"){let e=this.$parent.snapping.snap([t]),i=(e==null?void 0:e.posn)||t.snap(this.startPoint,m0);this.path=new Y(this.startPoint,i),this.$el.draw(this.path)}else if(this.utensil){let e=B(this.utensil.offset(t),0,1),i=U(this.utensil)||Ye(this.utensil);this.utensilRange=g0(this.utensilRange,e,i),this.path=v0(this.utensil,...this.utensilRange),this.$el.draw(this.path)}else this.path.points.push(t),this.$el.setAttr("d",this.$el.attr("d")+`L${t.x},${t.y}`)}end(){if(this.utensil||this.brush==="ruler")return this.snap=!0,this.options=this.path.toString().replace(/\.(\d{3})\d+/g,(t,e)=>`.${e}`),this.$parent.snapping.addStroke(this);{let t=w0(this.path.points);this.path=new te(...t),this.options=y0(t),this.$el.setAttr("d",this.options)}this.startPoint=this.utensil=this.utensilRange=void 0}flushChanges(){let t=this.serialize();return this.$parent.strokes.has(this.id)?[void 0,t]:[t,void 0]}get snapPoints(){if(this.snap){if($e(this.path))return[this.path.p1,this.path.p2];if(Nt(this.path))return[this.path.start,this.path.end]}}hitTest(t,e){if(!this.path)return!1;let i=this.path.project(t);return(t.x-i.x)**2+(t.y-i.y)**2e/2?i-e:i}var Kr=class{constructor(t){this.$parent=t;this.angle=0;this.startAngle=0;this.hasChanged=!1;this.showTools=!1;this.isMoving=!1;this.tiles=new Set;this.$tools=t.$(".transform-tools"),this.$shadow=t.$(".group-shadow"),this.$rect=this.$tools.$(".group-outline"),this.$rotateBar=this.$tools.$(".rotate-bar"),this.$rotateCircle=this.$tools.$(".rotate-circle");let e=t.$(".rotate-label");e.hide(),t.events.listen(this.$rotateCircle,{start:()=>{this.startAngle=this.angle,this.rotateStart(),e.show()},move:({startPosn:i,posn:n,event:r})=>{this.rotate(this.startAngle-new Vt(n,this.center,i).deg);let o=It(r).subtract(t.topLeftPosition);e.setTransform(o.shift(b.isMobile?-15:5,b.isMobile?-100:-40)),e.text=gt(Dt(this.angle,1),360)+"\u2009\xB0"},end:()=>{this.rotateEnd(),e.hide()}})}bindKeyboardEvents(t){t.onKey("AllArrows r R",(e,i)=>{if(this.tiles.size){if(i==="r"||i==="R"){if(Array.from(this.tiles).some(r=>!r.canRotate))return;this.rotateStart();let n=i==="r"||i==="R"&&e.shiftKey&&e.getModifierState("CapsLock")?15:-15;this.rotate(this.angle+n),this.rotateEnd()}else{let n=R,r=e.shiftKey?5:25,o=i==="ArrowLeft"?-r:i==="ArrowRight"?r:0,a=i==="ArrowUp"?-r:i==="ArrowDown"?r:0,h=n.shift(o,a);this.moveStart(),this.move({posn:h,startPosn:n}),this.moveEnd()}this.$parent.trigger("shift-selection")}}),t.onKey("Escape",()=>this.clear())}get flatTiles(){return[...ke(this.tiles,!0)]}get size(){return this.tiles.size}add(t,e=!1,i=!1){e&&this.clear(),!t.isActive&&this.$parent.tiles.has(t.id)&&this.select([t],i)}select(t,e=!1){var i;(i=this.$parent.focussedTile)==null||i.blur(),this.$parent.zIndex.bringToFront(ke(t),!1,!0);for(let n of t)n.isActive||!this.$parent.tiles.has(n.id)||n.group||(this.tiles.add(n),n.select(),this.hasChanged=!0);e||this.update(!0)}remove(t,e=!1){t.group||!t.isActive||(t.deselect(),this.hasChanged=!0,this.tiles.delete(t),e||this.update(!0))}clear(){if(!this.isMoving){for(let t of this.tiles)t.deselect();this.tiles.size&&(this.hasChanged=!0),this.tiles.clear(),this.update(!0)}}getTileProperty(t){if(!this.size)return;let e=t(Vs(this.tiles.values()));for(let i of this.tiles)if(t(i)!==e)return;return e}update(t=!1){if(t&&!this.hasChanged)return;if(this.hasChanged=!1,!this.size){for(let o of[this.$shadow,this.$tools])o.hide();this.$parent.trigger("change-selection",{tiles:[],color:void 0});return}let e=Array.from(this.tiles).filter(o=>o.transformed);this.angle=this.getTileProperty(o=>o.rot)||0,this.rect=pp(e,J(this.angle)),this.center=this.rect.center;let i=e.every(o=>o.canRotate);if(e.length===1&&U(e[0].transformed)&&(i=!1),i&&this.getTileProperty(o=>o.rotateAroundOrigin)){let o=e[0].posn;e.slice(1).every(a=>a.posn.equals(o))&&(this.center=o,this.angle&&e.length===1&&(this.rect=Lt(e[0].transformed.rotate(-J(this.angle),o))))}this.$rotateBar.toggle(i),this.$rotateCircle.toggle(i);let n=this.size>1||e[0].showSelectionOutline;this.$rect.toggle(n),this.showTools=!this.getTileProperty(o=>o.hideSelectionOutline),this.$tools.toggle(this.showTools),this.$shadow.toggle(n&&this.showTools),(!i||!this.showTools)&&(this.rotateHandle=void 0),(this.size===1?e[0].$container:this.$parent.$svg).append(this.$tools),this.positionTools();let r=this.getTileProperty(o=>o.props.color);this.$parent.trigger("change-selection",{tiles:e,color:r})}positionTools(){if(!this.showTools)return;let t=this.bounds;for(let n of[this.$shadow,this.$rect])n.draw(t);let e=new p(this.center.x,this.rect.p.y),i=new Y(e,e.shift(0,-28)).rotate(J(this.angle),this.center);this.$rotateBar.setLine(i.p1,i.p2),this.$rotateCircle.setCenter(i.p2),this.rotateHandle=i.p2}get bounds(){return this.rect.rotate(J(this.angle),this.center)}getDragBounds(){let{canvas:t,canvasX:e,canvasY:i}=this.$parent.options;if(t==="infinite")return;let n=t==="notebook"?1/0:i!=null?i:0,r=Lt(...Array.from(this.tiles,o=>o.transformed));if(Number.isFinite(r.w))return new lt(-r.p.x,(e!=null?e:0)-r.p.x-r.w,-r.p.y,n-r.p.y-r.h,"swap")}moveStart(t=!1){if(!At(this.tiles,e=>!e.canEdit||e.isAnimating)){this.isMoving=!0,this.$parent.dropzoneManager.onMoveStart(this.tiles);for(let e of this.tiles)e.moveStart(t);this.startSnapPoints=[];for(let e of this.tiles)for(let i of e.snapPoints)this.startSnapPoints.some(n=>i.equals(n))||this.startSnapPoints.push(i);ed=this.rect,td=this.center,this.dragBounds=this.getDragBounds(),this.$parent.newTileShift=0,this.$parent.trigger("move-start")}}move({posn:t,startPosn:e},i=!1){if(!this.isMoving)return;let n=t.subtract(e);this.dragBounds&&!i&&(n=n.clamp(this.dragBounds));let r=this.startSnapPoints.map(h=>h.add(n)),o=this.$parent.snapping.snap(r);o&&(n=n.add(o.shift));let a=this.tiles.size===1?o:void 0;for(let h of this.tiles)h.move(n,a);this.rect=ed.translate(n),this.center=td.add(n),this.positionTools(),this.$parent.dropzoneManager.onMove(this.tiles),this.$parent.trigger("move-selection")}moveEnd(t,e=!1){if(this.isMoving){e&&this.$parent.options.canvas!=="infinite"&&this.move(t);for(let i of this.tiles)i.moveEnd();this.$parent.dropzoneManager.onMoveEnd(),At(this.tiles,i=>i.props.name==="geo")&&this.$parent.snapping.updateIntersections(),this.$parent.trigger("move-end"),this.isMoving=!1,this.$parent.flushChanges()}}rotateStart(){ph.clear();for(let t of this.tiles)for(let e of t.snapAngles)ph.add(gt(e+t.rot,180));Wr.clear(),Wr.add(0);for(let t of this.$parent.tiles.values())if(!t.isActive&&At(this.tiles,e=>p.distance(e.posn,t.posn)<140))for(let e of t.snapAngles)Wr.add(gt(e+t.rot,180));this.$parent.dropzoneManager.onMoveStart(this.tiles),this.$parent.newTileShift=0,this.$parent.trigger("rotate-start")}rotate(t){if(t=Pt(t,3),t===this.angle)return;let e=1/0;for(let n of ph)for(let r of Wr){let o=b0(r,n+t-this.startAngle,180);Math.abs(o)n.cannotCopyDelete))return{};if(!this.$parent.state.authorMode&&At(this.tiles,n=>n.authoringOnly))return{};let e={},i=this.flatTiles;for(let n of i)e[n.id]=n.props.copy();for(let n of i)if(n.is("geo")){for(let r of n.parents)if(!i.includes(r)&&!(r.id in e)&&r.geoType==="point"){let o=`point(${r.path.x},${r.path.y})`;e[r.id]=Object.assign(r.props.copy(),{expr:o})}}return e}delete(){if(this.isMoving||this.$parent.option("noDeleting")||ns.isMoving||At(this.tiles,i=>i.cannotCopyDelete))return;let t=ke([...this.tiles].filter(i=>i.canEdit),!0);this.tiles.clear();for(let i of t)i.delete();At(t,i=>i.props.name==="geo")&&this.$parent.snapping.updateIntersections(),this.$parent.flushChanges(),this.$parent.newTileShift=0}};var xt=class s{constructor(t=0,e=0,i=0){this.x=t;this.y=e;this.z=i}transform(t){if(t instanceof Wi&&(t=t.matrix),t.length!==4||t[0].length!==4)throw new Error("Must use a 4x4 matrix for 3D transforms!");let[[e],[i],[n],[r]]=kt.product(t,[[this.x],[this.y],[this.z],[1]]);return new s(e/r,i/r,n/r)}equals(t){return x(this.x,t.x)&&x(this.y,t.y)&&x(this.z,t.z)}fixFloat(){return new s(x(this.x,0)?0:this.x,x(this.y,0)?0:this.y,x(this.z,0)?0:this.z)}add(t){return this.x+=t.x||0,this.y+=t.y||0,this.z+=t.z||0,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}lerp(t,e){return new s(tt(this.x,t.x||0,e),tt(this.y,t.y||0,e),tt(this.z,t.z||0,e))}scale(t){return new s(this.x*t,this.y*t,this.z*t)}get magnitude(){return Math.hypot(this.x,this.y,this.z)}get normalize(){return this.scale(1/this.magnitude)}get asArray(){return[this.x,this.y,this.z]}get inverse(){return new s(-this.x,-this.y,-this.z)}get xy(){return new p(this.x,this.y)}[Symbol.iterator](){return this.asArray.values()}static get zero(){return new s(0,0,0)}static get oneZ(){return new s(0,0,1)}static get one(){return new s(1,1,1)}static all(t){return new s(t,t,t)}static from2D(t){return new s(t.x,t.y,0)}static average(t){return new s(Os(t.map(e=>e.x)),Os(t.map(e=>e.y)),Os(t.map(e=>e.z)))}static dot(t,e){return t.x*e.x+t.y*e.y+t.z*e.z}static cross(t,e){let i=t.y*e.z-t.z*e.y,n=t.z*e.x-t.x*e.z,r=t.x*e.y-t.y*e.x;return new s(i,n,r)}};var ie={translate({x:s,y:t,z:e}){return[[1,0,0,s],[0,1,0,t],[0,0,1,e],[0,0,0,1]]},rotateX(s){let t=Math.cos(s),e=Math.sin(s);return[[1,0,0,0],[0,t,-e,0],[0,e,t,0],[0,0,0,1]]},rotateY(s){let t=Math.cos(s),e=Math.sin(s);return[[t,0,e,0],[0,1,0,0],[-e,0,t,0],[0,0,0,1]]},rotateZ(s){let t=Math.cos(s),e=Math.sin(s);return[[t,-e,0,0],[e,t,0,0],[0,0,1,0],[0,0,0,1]]},rotateAxis({x:s,y:t,z:e},i){let n=Math.hypot(s,t,e);n=1/n,s*=n,t*=n,e*=n;let r=Math.sin(i),o=Math.cos(i),a=1-o;return[[s*s*a+o,s*t*a-e*r,s*e*a+t*r,0],[t*s*a+e*r,t*t*a+o,t*e*a-s*r,0],[e*s*a-t*r,e*t*a+s*r,e*e*a+o,0],[0,0,0,1]]},fromEulerAngles(s,t,e){return kt.product(ie.rotateX(s),ie.rotateY(t),ie.rotateZ(e))},scale({x:s,y:t,z:e}){return[[s,0,0,0],[0,t,0,0],[0,0,e,0],[0,0,0,1]]},scaleAll(s){return[[s,0,0,0],[0,s,0,0],[0,0,s,0],[0,0,0,1]]},perspective(s,t,e,i){let n=e*Math.tan(J(s)/2),r=-n,o=n*t,a=-o;return[[2*e/(o-a),0,(o+a)/(o-a),0],[0,2*e/(n-r),(n+r)/(n-r),0],[0,0,-((i+e)/(i-e)),-(2*i*e/(i-e))],[0,0,-1,0]]},transformPoint(s,t){return t instanceof xt?t.transform(s):new xt(t.x,t.y).transform(s)}},Wi=class{constructor(){this.matrix=kt.identity(4)}clear(){return this.matrix=kt.identity(4),this}translate(t=0,e=0,i=0){return this.matrix=kt.product(this.matrix,ie.translate({x:t,y:e,z:i})),this}rotate(t=0,e=0,i=0){return this.matrix=kt.product(this.matrix,ie.rotateZ(i),ie.rotateY(e),ie.rotateX(t)),this}scale(t){return this.matrix=kt.product(this.matrix,ie.scale(t)),this}dragToRotate(t,e,i=100){let n=new xt(t.x,t.y,i**3/(i**2+t.length**2)).normalize,r=new xt(e.x,e.y,i**3/(i**2+e.length**2)).normalize,o=B(xt.dot(n,r),-1,1),a=xt.cross(n,r),h=ie.rotateAxis(a,2*Math.acos(o));return this.matrix=kt.product(h,this.matrix),this}isRotationMatrix(){if(!x(kt.determinant(this.matrix),1))return!1;let t=kt.transpose(this.matrix);return kt.product(this.matrix,t).every((i,n)=>i.every((r,o)=>x(r,n===o?1:0)))}toEulerAngles(){let t=this.matrix,e=Math.hypot(t[0][0],t[1][0]);if(x(e,0)){let a=Math.atan2(-t[1][2],t[1][1]),h=Math.atan2(-t[2][0],e);return[a,h,0]}let n=Math.atan2(t[2][1],t[2][2]),r=Math.atan2(-t[2][0],e),o=Math.atan2(t[1][0],t[0][0]);return[n,r,o]}};var x0=new $t(0,0,0);function $0(s){let t=s.r,e=s.c.x,i=s.c.y,n=.5523*t;return`M${e} ${i-t}C${e+n} ${i-t} ${e+t} ${i-n} ${e+t} ${i}C${e+t} ${i+n} ${e+n} ${i+t} ${e} ${i+t}C${e-n} ${i+t} ${e-t} ${i+n} ${e-t} ${i}C${e-t} ${i-n} ${e-n} ${i-t} ${e} ${i-t}`}var Xr=class{constructor(){this.transform=new Wi;this.visible=!0}getTransformed(t){let e=this;do t=t.transform(e.transform);while(e=e.parent);return t}get normal(){return this.getTransformed(xt.oneZ).add(this.getTransformed(xt.zero).inverse).normalize}project(t,e={fov:120}){if(e.fov===!1)return new p(t.x,t.y);let i=Math.exp(t.z/e.fov);return new p(t.x*i,t.y*i)}*getProjectedVertices(t){for(let e of this.getVertices())yield this.project(e,t)}},Ki=class extends Xr{constructor(e,i={},n){super();this.children=[];this.sorting=!1;this.$el=m("g",i,n);for(let r of e)this.addChild(r)}addChild(e){return e.parent&&e.parent.removeChild(e),this.children.push(e),this.$el&&e.$el&&this.$el.append(e.$el),e.parent=this,e}removeChild(e){let i=this.children.indexOf(e);i>=0&&this.children.splice(i,1),e.$el&&e.$el.remove(),e.parent=void 0}render(e){if(this.visible){if(this.sorting)for(let i of yi(this.children,n=>n.zIndex))this.$el.append(i.$el);for(let i of this.children)i.render(e)}}*getFaces(){for(let e of this.children)for(let i of e.getFaces())yield i}*getVertices(){for(let e of this.children)for(let i of e.getVertices())yield i}get zIndex(){return Os(this.children.map(e=>e.zIndex))}},Xi=class extends Xr{constructor(e,i={},n){super();this.shape=e;if(!e)this.commands=[];else if(typeof e=="string")this.commands=Sn(e);else{let o=U(e)?$0(e):De(e);this.commands=Sn(o)}let r=p.average(...this.commands.filter(o=>o.points.length).map(o=>p.average(...o.points)));this.centroid=new xt(r.x,r.y,0),n&&(this.color=n),this.$el=m("path",i)}render(e){if(!this.visible)return;let i=this.normal.z;if(e!=null&&e.hideBackface){let r=i>-.01;if(this.$el.toggle(r),!r)return}if(this.color){let r=$t.mix(this.color,x0,(Math.abs(i)+1)/2);this.$el.setAttr("fill",r),this.$el.setAttr("stroke",r)}let n=this.commands.map(r=>{let o=r.points.map(a=>{let h=this.project(this.getTransformed(new xt(a.x,a.y)),e);return`${h.x},${h.y}`});return r.type+o.join(",")}).join("");this.$el.setAttr("d",n)}get zIndex(){return this.getTransformed(this.centroid).z}*getFaces(){yield this}*getVertices(){if(!(!this.shape||typeof this.shape=="string"||!St(this.shape)))for(let e of this.commands)for(let i of e.points)yield this.getTransformed(new xt(i.x,i.y))}};var W=V.regular(3),ni=V.regular(4),pe=V.regular(5),sd={shape:W,children:[{shape:W,dihedral:70.53,rot:180},{shape:W,dihedral:70.53,parentEdge:1,rot:300},{shape:W,dihedral:70.53,parentEdge:2,rot:60}]},id={shape:ni,children:[{shape:ni,dihedral:90,myEdge:2,children:[{shape:ni,dihedral:90,myEdge:2}]},{shape:ni,dihedral:90,parentEdge:1,rot:270},{shape:ni,dihedral:90,parentEdge:2},{shape:ni,dihedral:90,parentEdge:3,rot:90}]},nd={shape:W,children:[{shape:W,dihedral:109.47,rot:180},{shape:W,dihedral:109.47,parentEdge:1,rot:300,children:[{shape:W,dihedral:109.47,parentEdge:1,rot:300}]},{shape:W,dihedral:109.47,parentEdge:2,rot:60,children:[{shape:W,dihedral:109.47,parentEdge:1,rot:300},{shape:W,dihedral:109.47,parentEdge:2,rot:60,children:[{shape:W,dihedral:109.47,parentEdge:1,rot:300}]}]}]},rd={shape:pe,children:[{shape:pe,dihedral:116.57,rot:180},{shape:pe,dihedral:116.57,parentEdge:1,rot:252},{shape:pe,dihedral:116.57,parentEdge:2,rot:324},{shape:pe,dihedral:116.57,parentEdge:3,rot:36},{shape:pe,dihedral:116.57,parentEdge:4,rot:108,children:[{shape:pe,dihedral:116.57,parentEdge:2,rot:324,children:[{shape:pe,dihedral:116.57,parentEdge:3,rot:36,children:[{shape:pe,dihedral:116.57,parentEdge:1,rot:252},{shape:pe,dihedral:116.57,parentEdge:2,rot:324},{shape:pe,dihedral:116.57,parentEdge:3,rot:36},{shape:pe,dihedral:116.57,parentEdge:4,rot:108}]}]}]}]},od={shape:W,children:[{shape:W,dihedral:138.19,rot:180},{shape:W,dihedral:138.19,parentEdge:1,rot:300,children:[{shape:W,dihedral:138.19,parentEdge:1,rot:300,children:[{shape:W,dihedral:138.19,parentEdge:2,rot:60,children:[{shape:W,dihedral:138.19,parentEdge:1,rot:300,children:[{shape:W,dihedral:138.19,parentEdge:1,rot:300}]},{shape:W,dihedral:138.19,parentEdge:2,rot:60}]},{shape:W,dihedral:138.19,parentEdge:1,rot:300}]},{shape:W,dihedral:138.19,parentEdge:2,rot:60}]},{shape:W,dihedral:138.19,parentEdge:2,rot:60,children:[{shape:W,dihedral:138.19,parentEdge:2,rot:60,children:[{shape:W,dihedral:138.19,parentEdge:1,rot:300,children:[{shape:W,dihedral:138.19,parentEdge:2,rot:60,children:[{shape:W,dihedral:138.19,parentEdge:1,rot:300,children:[{shape:W,dihedral:138.19,parentEdge:1,rot:300}]},{shape:W,dihedral:138.19,parentEdge:2,rot:60}]},{shape:W,dihedral:138.19,parentEdge:1,rot:300}]},{shape:W,dihedral:138.19,parentEdge:2,rot:60}]},{shape:W,dihedral:138.19,parentEdge:1,rot:300}]}]},ad=new V(new p(.587785,.466639),new p(0,.750495),new p(-.587785,.466639),new p(0,-.73981)),je={shape:ad,dihedral:89.7451,rot:180},nE={shape:ad,children:[ft(ut({},je),{parentEdge:1,myEdge:1,children:[ft(ut({},je),{children:[ft(ut({},je),{parentEdge:1,myEdge:1,children:[ft(ut({},je),{children:[ft(ut({},je),{parentEdge:1,myEdge:1,children:[ft(ut({},je),{children:[ft(ut({},je),{parentEdge:1,myEdge:1,children:[ft(ut({},je),{children:[ft(ut({},je),{parentEdge:1,myEdge:1})]})]})]})]})]})]})]})]})]};function hd(s,t,e){let i=V.regular(s).scale(t*Bt(s)),n=new G(R,t,e).polygon,r=[{shape:i,rot:180,parentEdge:2}],o=z(a=>({shape:n,parentEdge:a,rot:360/s*a,children:a?void 0:r}),s);return{shape:i,children:o}}function ld(s,t,e){let i=V.regular(s).scale(t*Bt(s)),n=new V(new p(-t/2,0),new p(t/2,0),new p(0,-e)),r=Kt(Math.acos(t/e/2/Math.tan(Math.PI/s))),o=z(a=>({shape:n,dihedral:r,parentEdge:a,rot:180+360/s*a}),s);return{shape:i,children:o}}var P0=kt.identity(4);function cd(s,t,e,i){var g;let n=t.shape.edges[s.parentEdge||0],r=s.shape.edges[s.myEdge||0],o=J(s.dihedral||90),a=i(s);e.addChild(a);let h=xt.from2D(n.midpoint),l=xt.from2D(r.midpoint),c=xt.from2D(n.unitVector),u=s.rot?J(s.rot):0,d=((g=s.children)==null?void 0:g.map(w=>cd(w,s,e,i)))||[];return[a,h,l,c,u,o,d]}function dh(s,t,e=1){var o;let i=t(s),n=new Ki([i]);n.sorting=!0;let r=((o=s.children)==null?void 0:o.map(a=>cd(a,s,n,t)))||[];return uh(r,n,e),{group:new Ki([n]),foldTree:r}}function pd(s,t,e=P0){let[i,n,r,o,a,h,l]=s,c=tt(Math.PI,h,t),u=ie.rotateAxis(o,Math.PI-c);a&&(u=kt.product(u,ie.rotateZ(a)));let d=r.transform(u),g=ie.translate(d.inverse.add(n));i.transform.matrix=kt.product(e,g,u);for(let w of l||[])pd(w,t,i.transform.matrix)}function uh(s,t,e){t.transform.clear();for(let r of s)pd(r,e);let i=Array.from(t.getFaces()).map(r=>r.getTransformed(r.centroid)),n=xt.average(i).inverse;t.transform.translate(n.x,n.y,n.z)}function T0(s,t,e){let i=Math.cos(s),n=Math.cos(t),r=Math.cos(e),o=Math.sin(t),a=Math.acos((r-i*n)/(Math.sin(s)*o)),h=Math.acos((i-n*r)/(o*Math.sin(e)));return[a,h]}function dd(s,t){return Math.asin(Math.cos(s*t)/Math.cos(s/2))}var S0=new Set([60,90,108]),E0=[{internal:[60,90,90,90],dihedral:[144.74,135,135,135]},{internal:[60,60,60,60,90],dihedral:[153.23,153.23,153.23,142.98,142.98]},{internal:[60,90,108,90],dihedral:[159.09,148.28,148.28,159.09]},{internal:[60,60,60,60,108],dihedral:[164.18,164.18,152.93,152.93,152.93]}];function M0(...s){let t=s.length;if(t===3)return T0(s[0],s[1],s[2]);let e=s.map(n=>Math.round(Kt(n)));if((t===4||t===5)&&e.includes(60)&&e.every(n=>S0.has(n))){for(let n of E0)if(n.internal.length===t){for(let r=0;ro===n.internal[(a+r)%t]))return hs(n.dihedral,r).slice(0,t-1).map(o=>J(o))}}if(t===4&&e.filter(n=>n===60).length===3){let n=e.findIndex(l=>l!==60),r=(Math.PI-s[n])/4,o=Math.acos(-1/Math.sqrt(3)*Math.tan(r)),a=Math.acos(1-2/3*((3-Math.tan(r)**2)/4+(Math.sin(3*r)/Math.sin(2*r))**2));return hs([o,a,a,o],4-n).slice(0,t-1)}let i=Math.PI/N(s);return z(n=>{let r=dd(s[n],i),o=dd(s[n+1],i);return r+o},s.length-1)}var fh=(s,t)=>gt(s+1,t.size),mh=(s,t)=>gt(s-1,t.size);function C0(s,t){let e=s.polygon.points[mh(t,s)],i=s.polygon.points[t],n=s.polygon.points[fh(t,s)];return new Vt(n,i,e).sup.rad}function A0(s){let t=s.find(a=>a.neighbours.filter(Boolean).length===1),e=mh(t.neighbours.findIndex(Boolean),t),i=[],n=t,r=e;do{let a=[];for(;a.push({face:n,vertex:r}),!!n.neighbours[r];){let h=n;n=n.neighbours[r],r=fh(n.neighbours.indexOf(h),n)}r=fh(r,n),i.push(a)}while(n!==t||r!==e);let o=new Gh(i);for(;;){let a=Math.max(3,...o.array.map(c=>c.val.length)),h=o.array.filter(c=>c.val.length>=a);if(!h.length)break;let l=new Set;for(let c of h){if(l.has(c))continue;let u=c.val.map(g=>C0(g.face,g.vertex)),d=M0(...u);for(let[g,w]of d.entries()){let f=c.val[g],v=c.val[g+1],y=f.vertex,$=mh(v.vertex,v.face);f.face.dihedral[y]=v.face.dihedral[$]=Math.max(w,f.face.dihedral[y]||0,v.face.dihedral[$]||0)}c.prev.val.push(...c.next.val),l.add(c.next),o.delete(c.next),o.delete(c)}}}function ud(s,t){return Math.max(...s.neighbours.map(e=>!e||e===t?0:ud(e,s)))+1}function fd(s,t){return s.visited?!0:(s.visited=!0,s.neighbours.filter(e=>e&&e!==t).some(e=>fd(e,s)))}function md(s,t,e,i){let n=s.neighbours.map((r,o)=>{if(!(!r||r===e))return md(r,t,s,s.dihedral[o])}).filter(Boolean);return{shape:s.polygon.translate(t.inverse),color:s.tile.props.color,children:n.length?n:void 0,dihedral:i?+Kt(i).toFixed(2):void 0,parentEdge:e?e.neighbours.indexOf(s):void 0,myEdge:e?s.neighbours.indexOf(e):void 0}}function k0(s){let t=s.map(e=>{let i=e.transformed.oriented,n=i.points.length;return{tile:e,polygon:i,size:n,neighbours:re(void 0,n),dihedral:re(void 0,n),edges:i.edges,center:i.centroid,radius:i.radius}});if(!t.some(e=>e.size<3)){for(let[e,i]of t.entries())for(let[n,r]of t.entries())if(!(e>=n)&&!(i.radius+r.radius!e.joined)&&!fd(t[0]))return t}}function gd(s){let t=k0(s);if(!t)return;A0(t);let e=Is(t,n=>ud(n)),i=e.polygon.centroid;return[i,md(e,i)]}var gh=s=>Yi[s%Yi.length]||q.yellow;function yd(s){var e;let t=((e=s.c||s.children)==null?void 0:e.map(i=>yd(i)))||[];return{shape:Yr(s.shape||s.s),color:s.color||s.a,children:t,dihedral:s.dihedral||s.d,parentEdge:s.parentEdge||s.p,myEdge:s.myEdge||s.m,rot:s.rot||s.r}}function bd(s){var e;let t=(e=s.children)==null?void 0:e.map(i=>bd(i));return t!=null&&t.length||(t=void 0),{s:oi(s.shape),a:s.color,c:t,d:s.dihedral,p:s.parentEdge,m:s.myEdge,r:s.rot}}function V0(s){return yd(we(s.replace(/([a-z]):/g,'"$1":'),{}))}function I0(s){return JSON.stringify(bd(s)).replace(/"([a-z])":/g,"$1:")}function ri(s,t=1){var i;let e=(i=s.children)==null?void 0:i.map(n=>ri(n,t));return Object.assign({},s,{children:e,shape:s.shape.scale(t)})}var vd=s=>s.split(",").map(t=>+t),vh=s=>s.map(t=>t.toFixed(4)).join(","),wh={Tetrahedron:{net:ri(sd,Bt(3)*50),scale:1.1,name:"Tetrahedron"},Cube:{net:ri(id,Bt(4)*50),scale:.8,name:"Cube"},Octahedron:{net:ri(nd,Bt(3)*50),scale:.95,name:"Octahedron"},Dodecahedron:{net:ri(rd,Bt(5)*50),scale:.42,name:"Dodecahedron"},Icosahedron:{net:ri(od,Bt(3)*50),scale:.67,name:"Icosahedron"},Pyramid:{net:ld(6,50,100),scale:.57,name:"Pyramid"},Prism:{net:hd(6,50,100),scale:.45,name:"Prism"}},yh={fov:400},wd=[1.066,.243,-.088],rs=class extends H{constructor(e,i,n){var o;super(e,i,n);this.cannotRotateType=!0;this.net=((o=wh[this.props.net])==null?void 0:o.net)||V0(this.props.net),this.rotation=vd(this.props.rotation);let r=dh(this.net,a=>new Xi(a.shape,{class:"polygon-tile"},a.color||gh(a.shape.points.length)));this.solid=r.group,this.foldTree=r.foldTree,this.$el.append(this.solid.$el),this.$outline=m("path",{class:"outline"},this.$el),this.$moveBar=m("path",{d:"M0 0h30",class:"handle"},this.$el),this.$moveHandle=m("path",{d:"M0 0h14v14h-14Z",class:"handle",style:"cursor: grab"},this.$el),this.solid.$el.css("cursor","move"),this.props.watch("color",({color:a})=>{if(a){for(let h of this.solid.getFaces())h.color=a;this.render(!1)}}),this.render(),this.updateOutline(),e.events.listen(this.solid.$el,{start:()=>{e.selection.add(this,!0),this.$el.removeClass("active")},move:({posn:a,lastPosn:h})=>{this.solid.transform.dragToRotate(h.subtract(this.posn),a.subtract(this.posn),100),this.render(!1)},end:()=>{this.rotation=this.solid.transform.toEulerAngles(),this.props.rotation=vh(this.rotation),this.updateOutline(),e.flushChanges(),this.$el.addClass("active")},click:a=>e.tools.move.down(a),checkIfActive:()=>this.props.hinge>0})}applyChange(e){super.applyChange(e),this.rotation=vd(this.props.rotation),this.render(),this.updateOutline()}render(e=!0){e&&(this.solid.transform.clear(),uh(this.foldTree,this.solid.children[0],-this.props.hinge),this.solid.transform.rotate(...this.rotation)),this.solid.render(yh)}updateOutline(){let e=this.solid.getProjectedVertices(yh);this.path=V.convexHull(...e),this.$outline.draw(this.path),this.transform(),this.$moveBar.translate(this.path.points[0].x-30,this.path.points[0].y),this.$moveHandle.translate(this.path.points[0].x-45,this.path.points[0].y-7)}animateHinges(e,i=!1,n=800){return D(this,null,function*(){let r=i?this.rotation:[0,0,0],o=this.props.hinge;yield pt(a=>{this.props.hinge=tt(o,e,a),i&&(this.rotation=r.map(h=>h*(1-a))),this.render()},n).promise,this.props.rotation=vh(this.rotation),this.updateOutline()})}hingeStart(){this.startRotation=this.rotation,this.startAngle=this.props.hinge,this.$el.removeClass("active")}hingeMove(e){if(!x(e,this.props.hinge)){if(this.props.hinge=B(e,0,1),this.startRotation&&this.startAngle){let i=B(e/this.startAngle,0,1);this.rotation=this.startRotation.map(n=>i*n)}this.render()}}hingeEnd(){this.updateOutline(),this.props.rotation=vh(this.rotation),this.$el.addClass("active")}static fold(e){let i=gd(e);if(!i){xr("polyhedron-error");return}let n={name:"polyhedron",net:I0(i[1]),hinge:0,rotation:"0,0,0"},r=H.create(e[0].$parent,n),o=r.solid.children[0].transform.matrix;r.setTransform(i[0].shift(-o[0][3],-o[1][3])),r.props.hinge=1,setTimeout(()=>{r.props.hinge=0,r.animateHinges(1)},10);for(let a of e)a.delete();return r}unfold(){return D(this,null,function*(){this.$parent.selection.remove(this),this.props.hinge>0&&(yield this.animateHinges(0,!0));let e=Array.from(this.solid.getFaces()).map(i=>{let n=new V(...Array.from(i.getProjectedVertices())),r=this.props.color||i.color||gh(n.points.length);return H.create(this.$parent,{name:"polygon",shape:oi(n),color:r,x:this.posn.x,y:this.posn.y})});return this.delete(),e})}static makeThumbnail(e,i){let n=m("svg",{width:70,height:70},e),r=m("g",{transform:"translate(35, 35)"},n),{net:o,scale:a}=wh[i.net],h=dh(o,l=>new Xi(l.shape,{class:"polygon-tile"},gh(l.shape.points.length)),-1).group;h.transform.clear().rotate(...wd).scale({x:a,y:a,z:a}),r.append(h.$el),h.render(yh)}static altText(e){var i;return((i=wh[e.net])==null?void 0:i.name)||"Polyhedron"}};rs.type="polyhedron",rs.defaultProps={hinge:1,rotation:wd.join(",")},rs=T([Ut],rs);Mt([{id:"unfold",type:"button",tileTypes:["polyhedron"],label:"Unfold",click:s=>Promise.all(s.map(t=>t.unfold()))},{id:"hinges",type:"slider",tileTypes:["polyhedron"],label:"Hinges",start:s=>s.hingeStart(),move:(s,t)=>s.hingeMove(t),end:s=>s.hingeEnd(),get:s=>s.props.hinge}]);var L=50,at=Math.sqrt(3)/4*L;function Bt(s){let t=Math.cos(Tt/s);return 1/Math.sqrt(2-2*t)}var xd={"equ-triangle":new V(new p(-L/2,at),new p(L/2,at),new p(0,-at)),square:V.regular(4,L*Bt(4)),"reg-pentagon":V.regular(5,L*Bt(5)),"reg-hexagon":V.regular(6,L*Bt(6)),"reg-heptagon":V.regular(7,L*Bt(7)),"reg-octagon":V.regular(8,L*Bt(8)),"reg-decagon":V.regular(10,L*Bt(10)),"reg-dodecagon":V.regular(12,L*Bt(12)),rectangle:new G(new p(-L,-L/2),2*L,L).polygon,trapezium:new V(new p(-L,at),new p(L,at),new p(L/2,-at),new p(-L/2,-at)),rhombus:new V(new p(-L*3/4,at),new p(L/4,at),new p(L*3/4,-at),new p(-L/4,-at)),"right-triangle":new V(new p(-L/2,-L/2),new p(L/2,-L/2),new p(-L/2,L/2)),"rhombus-2":new V(new p(L/2-at,L/4),new p(-at-L/2,L/4),new p(at-L/2,-L/4),new p(at+L/2,-L/4)),chevron:new V(new p(-.75*L,2*at),new p(.25*L,2*at),new p(.75*L,0),new p(.25*L,-2*at),new p(-.75*L,-2*at),new p(-.25*L,0)),"right-triangle-2":new V(new p(-2*at,-L/2),new p(-2*at,L/2),new p(2*at,-L/2)),kite:new V(new p(0,-L),new p(2*at,-L/2),new p(0,L),new p(-2*at,-L/2)),dart:new V(new p(2*at,.75*L),new p(0,-.75*L),new p(-2*at,.75*L),new p(0,.25*L))},L0={"equ-triangle":"Equilateral Triangle",square:"Square","reg-pentagon":"Regular Pentagon","reg-hexagon":"Regular Hexagon","reg-heptagon":"Regular Heptagon","reg-octagon":"Regular Octagon","reg-decagon":"Regular Decagon","reg-dodecagon":"Regular Dodecagon",rectangle:"Rectangle",trapezium:"Trapezium",rhombus:"Rhombus","right-triangle":"Right Triangle","rhombus-2":"Rhombus",chevron:"Chevron","right-triangle-2":"Right Triangle",kite:"Kite",dart:"Dart"},O0=[[[-15.7728,63.1105],[-65.2725,56.0545],[-61.7426,-21.037],[-34.7275,-63.1105],[65.2725,-63.1105]],[[60.6056,14.8729],[-53.4909,57.394],[-80.668,-12.5086],[-20.582,-57.394],[80.668,-57.394]],[[0,-73.612],[50,12.9905],[15,73.612],[-50,12.9905],[-30,-73.612]],[[67.056,-58.248],[67.056,1.752],[-10.5597,58.248],[-67.056,-19.3675],[7.056,-58.248]],[[-74.4415,-47.6314],[35.5585,-47.6314],[74.4415,-8.733],[60.1965,44.3902],[-19.4415,47.6314]],[[47.6215,-81.108],[43.731,-26.2458],[-24.012,81.108],[-47.6215,-43.6179],[-7.3786,-81.108]],[[94.9659,43.7299],[-5.0343,43.7299],[-94.9659,0],[-5.0343,-43.7299],[42.1151,-41.1631]],[[-13.1927,57.1955],[76.8074,57.1955],[76.8257,-32.8045],[-9.8062,-57.1955],[-76.8257,-6.4506]],[[-3.2764,58.8874],[86.2804,29.1016],[26.2804,-43.7514],[-26.2804,-58.8874],[-86.2804,13.9666]],[[51.5265,-55],[58.4735,-14.7198],[9.6458,43.251],[-58.4735,55],[-58.4735,-55]],[[-95.733,-40.991],[53.87,-40.991],[95.733,-15.7718],[1.5099,40.991],[-95.733,-10.4271]],[[-85.642,-51.4515],[12.4961,-51.4515],[85.642,-13.2965],[-38.4855,51.4515],[-85.642,18.5485]],[[-69.99,67.0025],[84.488,2.9975],[84.488,-67.0025],[14.488,-67.0025],[-84.488,32.0117]],[[-15.6401,96.696],[46.9202,6.219],[8.0799,-96.696],[-46.9202,-96.696],[-46.9202,51.458]],[[-46.6683,85],[-46.6683,22.7758],[15.5561,-85],[46.6683,-31.1122],[15.5561,85]],[[0,-46.65],[-43.301,-21.65],[-43.301,46.65],[43.301,46.65],[43.301,-21.65]],[[-25,46.65],[25,46.65],[59.15,-12.5],[0,-46.65],[-59.15,-12.5]],[[0,-64.951],[-50,21.65],[-25,64.951],[25,64.951],[50,21.65]]].map(s=>new V(...s.map(t=>new p(...t)))),Yi=["","","",q.yellow,q.blue,q.green,q.red,q.teal,q.purple],R0={trapezium:q.orange,"right-triangle":q.green,"rhombus-2":q.lime,chevron:q.orange,kite:q.purple,dart:q.teal},D0={"equ-triangle":q.green,square:q.yellow,"reg-pentagon":q.blue,"reg-hexagon":"#ffd615",rectangle:q.yellow,trapezium:"#cc1030",rhombus:q.blue,"rhombus-2":"#e6e2c6",chevron:"#cc1030","right-triangle-2":"#ffd615",kite:"#134791",dart:q.purple},N0=[...$t.rainbow(15).map(s=>s.hex),q.red,q.blue,q.yellow],G0=new Set(["trapezium","rhombus","rhombus-2","rectangle","right-triangle","right-triangle-2"]),z0=new Set(["equ-triangle","square","reg-pentagon","reg-hexagon","reg-heptagon","reg-octagon","reg-decagon","reg-dodecagon","rectangle","trapezium","kite","dart"]),oi=s=>s.points.map(t=>`${t.x.toFixed(2)} ${t.y.toFixed(2)}`).join(","),B0=s=>new V(...s.split(",").map(t=>{let[e,i]=t.split(" ");return new p(+e||0,+i||0)}));function Yr(s){return s.startsWith("pentagon-")?O0[+s.slice(9)-1]:/^[\d.-]/.test(s)?B0(s):xd[s]||xd.square}function $d(s,t,e=!1){return s.startsWith("pentagon-")?N0[+s.slice(9)-1]:(e?D0:R0)[s]||Yi[t%Yi.length]||q.yellow}var Zi=class extends ii{constructor(t,e,i){super(t,e,i);let n=Yr(this.props.shape);this.props.watch("scale isFlipped",({isFlipped:r,scale:o})=>this.setPath(n.scale(o||1),r)),this.symmetric=z0.has(this.props.shape),this.props.color||(this.props.color=$d(this.props.shape,this.path.points.length,t.options.altColors))}static makeThumbnail(t,e,i){let n=G0.has(e.shape)?60:80,r=Yr(e.shape);r=r.scale((e.shape.startsWith("pentagon-")?41:36)/r.radius).shift(40,n/2);let o=m("svg",{width:80,height:n},t),a=m("path",{class:"polygon-tile",path:r},o);i.options.watch(h=>a.setAttr("fill",$d(e.shape,r.points.length,h.altColors)))}static altText(t){if(t.shape.startsWith("pentagon-")){let e=+t.shape.slice(9);return e<16?`Pentagon ${e}`:e===16?"Prismatic Pentagon":e===17?"Cairo Pentagon":"Floret Pentagon"}return L0[t.shape]||"Polygon"}};Zi.type="polygon",Zi=T([Ut],Zi);var ai=["polygon","tangram","polyomino","custom-polygon","rectangle","reg-polygon","fractal","penrose","aperiodic-hat"];Mt([{id:"flip",type:"button",label:"Flip",icon:"flip",useTextLabel:!0,tileTypes:[...ai,"arrow","egg","garden","number-frame"],show:s=>s.length>1||!!s[0].rot||!s[0].symmetric,click:(s,t)=>{let e=t.selection.center;for(let i of s)i.flip(e)}},{id:"cut",type:"button",tileTypes:ai,label:"Cut",icon:"cut",useTextLabel:!0,noFlush:!0,show:s=>s.every(t=>!(t.is("rectangle")&&t.props.cornerRadius>0)),click:(s,t)=>t.tools.cutPolygon.enable()},{id:"join",type:"button",label:"Join",icon:"merge",useTextLabel:!0,tileTypes:ai,location:"more",show:s=>s.length>1&&s.every(t=>!(t.is("rectangle")&&t.props.cornerRadius>0)),click:(s,t)=>{let e=s.map(o=>o.transformed),i=V.union(...e),n=s[0].props.color,r=i.map(o=>H.create(t,{name:"polygon",shape:oi(o),color:n}));for(let o of s)o.delete();t.selection.select(r,!0)}},{id:"fold-net",type:"button",label:"Fold Net",icon:"cube",useTextLabel:!0,tileTypes:ai,show:s=>s.length>2,click:s=>rs.fold(s)},{id:"animation",type:"select",tileTypes:ai,label:"Animation:",location:"music",flattenGroups:!0,feature:"noMusic",options:[{key:"vertices",label:"Vertices"},{key:"perimeter",label:"Perimeter"},{key:"area",label:"Area"},{key:"angles",label:"Angles"}],get:s=>{var t;return((t=s.props.animation)==null?void 0:t.replace("hidden","perimeter"))||"perimeter"},set:(s,t)=>t.props.animation=s},{id:"audio-labels",type:"checkbox",tileTypes:ai,label:"Show labels:",location:"music",flattenGroups:!0,feature:"noMusic",show:s=>s.every(t=>!["vertices"].includes(t.props.animation)),get:s=>s.props.labels==="number",set:(s,t)=>t.props.labels=s?"number":void 0}]);Mt([{id:"label",type:"input",label:"Label:",tileTypes:_r,icon:"text",authorOnly:!0,get:s=>s.props.textLabel||"",set:(s,t)=>t.props.textLabel=`${s}`},{id:"labelFontSize",type:"input",label:"Font size:",tileTypes:_r,icon:" ",value:"number",range:[1,15],increment:1,authorOnly:!0,show:s=>s.some(t=>t.props.textLabel),get:s=>5+(s.props.textLabelFontSize||0),set:(s,t)=>t.props.textLabelFontSize=+s-5},{id:"textLabelRotate",type:"checkbox",label:"Rotate label:",tileTypes:_r,icon:" ",authorOnly:!0,show:s=>s.some(t=>t.props.textLabel),get:s=>!!s.props.textLabelRotate,set:(s,t)=>t.props.textLabelRotate=s}]);Mt([{id:"scale",type:"input",label:"Scale:",location:"more",value:"number",range:[.1,10],icon:"geo-scale",increment:.1,tileTypes:["polygon","reg-polygon","rectangle","custom-polygon"],get:s=>s.props.scale||1,set:(s,t)=>{let e=t.path.centroid.scale(1-+s/(t.props.scale||1));t.setTransform(t.posn.add(e)),t.props.scale=+s,t.$parent.selection.update()}}]);var Pd='';var bt=50,_0=100,ui=class extends H{constructor(e,i,n){super(e,i,n);this.cannotRotateType=!0;this.cannotDragToSelect=!0;this.$el.addClass("utensil"),this.setup(),this.$handles=[0,1].map(r=>this.makeHandle("c",(o,a)=>{let h=r?this.posn:this.absoluteEnd;a=this.$parent.snapping.orthogonal(a,h),r&&(this.absoluteEnd=a);let l=r?this.posn:a;this.props.isFixed||(this.props.width=Math.max(p.distance(l,this.absoluteEnd),_0)),this.setTransform(l,Kt(this.absoluteEnd.angle(l))),this.update()})),this.update()}applyChange(e){super.applyChange(e),this.update()}flip(){this.props.isFlipped=!this.props.isFlipped,this.update()}transform(e){super.transform(e),this.absoluteEnd=this.worldPosn(new p(this.props.width,0))}update(){this.$handles[1].setCenter({x:this.props.width,y:0}),this.transform()}getDrawingPath(e){var n;let i=(n=this.transformed)==null?void 0:n.project(e);if(i&&p.distance(e,i)<30)return this.transformed}},F0=new Set(["ruler","protractor","set-triangle","compass"]);function Sd(s){return F0.has(s.props.name)}var q0=2.54,Zr=60,hi=bt*q0;function*Td(s,t,e,i){let n=(t+.1)/s;for(let r=0;r<=n;r+=1){let o=i?i.findIndex(h=>!(r%h)):-1,a=r*s;yield[e?t-a:a,o]}}var li=class extends ui{constructor(e,i,n){super(e,i,n);this.padding=[0,20,0,20];this.props.watch("units fixed",()=>this.update())}setup(){this.$glass=m("rect",{x:-20,height:Zr,class:"glass",rx:5},this.$el),this.$ticks=m("path",{class:"ticks"},this.$el),this.$labelsTop=z(e=>m("text",{text:e},this.$el),31),this.$labelsBottom=z(e=>m("text",{text:e,y:42},this.$el),12),this.$labelsBottom[0].text="0 in"}update(){let{units:e,width:i,isFlipped:n}=this.props,r=e==="both",o=e==="hidden";this.$glass.setAttr("width",i+40),this.path=new G(R,i,Zr);let a="";if(!o&&e!=="in")for(let[l,c]of Td(bt/10,i,n,[10,5]))a+=`M${l} 0v${([20,15][c]||10)*(r?.8:1)}`;if(!o&&e!=="cm"){let l=r?Zr:0;for(let[c,u]of Td(hi/16,i,n,[16,8,4]))a+=`M${c} ${l}v${([20,16,12][u]||8)*(r?-.8:1)}`}this.$ticks.setAttr("d",a),this.$labelsTop[0].text=e==="in"?"0 in":"0 cm";let h=e==="in"?hi:bt;for(let[l,c]of this.$labelsTop.entries())c.toggle(!o&&l*h<=i+.1),c.setAttr("y",r?26:32),c.setAttr("x",n?i-h*l:h*l);for(let[l,c]of this.$labelsBottom.entries())c.toggle(!o&&r&&l*hi<=i+.1),c.setAttr("x",n?i-hi*l:hi*l);super.update()}getSnapPoints(){if(this.props.units==="hidden")return[];let e=this.props.units==="both",i=hi/2,n=z(o=>new p(this.props.isFlipped?this.props.width-o*bt:o*bt,0),this.props.width/bt),r=z(o=>new p(this.props.isFlipped?this.props.width-o*i:o*i,e?Zr:0),this.props.width/i);return this.props.units==="cm"?n:e?[...n,...r]:r}getSnapLines(){let[e,i,n]=this.path.edges;return this.props.units==="both"?[e,n]:[e]}getDrawingPath(e){if(!this.transformed)return;let[i,n,r]=this.transformed.edges,o=p.distance(e,i.project(e)),a=p.distance(e,r.project(e));return o<30?i:this.props.units==="both"&&a<30?r:void 0}static altText(){return"Ruler"}};li.type="ruler",li.defaultProps={width:400,layer:"front",units:"cm"},li=T([Ut],li);function H0(s){return`M0-${s}A${s},${s},0,0,0-${s},0V3a5,5,0,0,0,5,5H${s-5}a5,5,0,0,0,5-5V0A${s},${s},0,0,0,0-${s}Z`}var ci=class extends ui{constructor(){super(...arguments);this.padding=[0,0,10,0]}setup(){this.$glass=m("path",{d:"",class:"glass"},this.$el),this.$ticks=m("path",{class:"ticks"},this.$el),this.$labels=z(e=>[m("text",{text:e*10},this.$el),m("text",{text:e*10,style:"font-size:9px"},this.$el)],19),this.$labels[9][0].css("font-size","20px"),this.$labels[9][1].hide()}update(){let e=this.props.width;this.path=new qt(R,new p(-this.props.width,0),Math.PI),this.$glass.setAttr("d",H0(e));let i="",n=this.props.width<120?5:1;for(let r=0;r<=180;r+=n){let o=!(r%10),a=!o&&!(r%5),h=p.fromPolar(J(-r)),l=e-(o?30:a?23:15);i+=`M${h.x*e} ${h.y*e}L${h.x*l} ${h.y*l}`,o&&(i+=`M${h.x*8} ${h.y*8}L${h.x*(e-60)} ${h.y*(e-60)}`)}this.$ticks.setAttr("d",i);for(let[r,[o,a]]of this.$labels.entries()){if(r===9){o.setAttr("y",52-e);continue}o.toggle(e>160||!(r%3)),a.toggle(e>160),o.setAttr("y",44-e),a.setAttr("y",55-e),o.setAttr("transform",`rotate(${(this.props.isFlipped?-1:1)*(90-10*r)})`),a.setAttr("transform",`rotate(${(this.props.isFlipped?1:-1)*(90-10*r)})`)}super.update()}getSnapPoints(){return[R,this.path.start,this.path.at(.5),this.path.end]}getSnapLines(){return[]}static altText(){return"Protractor"}};ci.type="protractor",ci.defaultProps={width:200,layer:"front"},ci=T([Ut],ci);var bh=234,to=150;function j0(s){let t=sm("text",{text:t,y:-23},this.$el),31),this.$hLabels[0].hide(),this.$vLabels=z(t=>m("text",{text:t,x:25,"dominant-baseline":"central"},this.$el),31),this.$vLabels[0].hide()}update(){this.path=new V(R,new p(this.props.width,0),new p(0,-this.props.width)),this.$glass.setAttr("d",j0(this.props.width));let t=this.props.width-50,e="",i=2,n=1;for(let r=0;r<=t;r+=bt/10){let o=r%bt?r%(bt/2)?0:n:i,a=r<10?-10*(r/10):[-10,-15,-20][o];e+=`M${r} 0V${a}`}for(let r=0;r<=t;r+=bt/10){let o=r%bt?r%(bt/2)?0:n:i,a=r<10?10*(r/10):[10,15,20][o];e+=`M0,${-r} H${a}`}this.$ticks.setAttr("d",e);for(let[r,o]of this.$hLabels.entries())r>0&&o.toggle(this.props.width>=to&&r0&&o.toggle(this.props.width>=to&&re.at(o*bt/t),t/bt),r=z(o=>i.at(o*bt/t),t/bt);return n.concat(r)}getSnapLines(){return[this.path]}static altText(){return"Set Triangle"}};pi.type="set-triangle",pi.defaultProps={width:280,layer:"front"},pi=T([Ut],pi);var Qr=375,Jr=new p(54,68),di=class extends ui{setup(){this.$el.html=Pd,this.$pencil=this.$el.$(".pencil"),this.$top=this.$el.$(".top"),this.$legPin=this.$el.$(".leg-pin"),this.$legPencil=this.$el.$(".leg-pencil"),this.props.watch("color",({color:i})=>this.$pencil.css("fill",i));let t,e=0;this.$parent.events.listen(this.$pencil.$("g"),{start:i=>{let n=new p(this.props.width,0).rotate(J(this.rot)).add(this.posn);t=new He(this.$parent,"",this.props.color,"pen"),t.start(n,new wt(this.posn,this.props.width)),e=Kt(i.posn.angle(this.posn))-this.rot;for(let r of this.$handles)r.setAttr("hidden",!0)},move:i=>{this.rot=Kt(i.posn.angle(this.posn))-e,this.transform();let n=p.fromPolar(J(this.rot),this.props.width).add(this.posn);t.addPoint(n)},end:()=>{t.end(),this.$parent.flushChanges(),t=void 0;for(let i of this.$handles)i.removeAttr("hidden")}}),this.$parent.events.listen(this.$top,{start:i=>{e=Kt(i.posn.angle(this.posn))-this.rot;for(let n of this.$handles)n.setAttr("hidden",!0)},move:i=>{this.rot=Kt(i.posn.angle(this.posn))-e,this.transform()},end:()=>{this.$parent.flushChanges();for(let i of this.$handles)i.removeAttr("hidden")}})}update(){this.props.width>730&&(this.props.width=730);let t=this.props.width-Jr.x,e=Qr-Jr.y,i=new wt(R,Qr),n=new wt(new p(t,-Jr.y),e),r=Q(i,n)[0],o=Math.acos(r.x/Qr),a=Math.acos((t-r.x)/e);this.$legPin.css("transform",`rotate(${-o+Ya}rad`),this.$legPencil.css("transform",`rotate(${a-Ya}rad`),this.$pencil.setTransform({x:this.props.width-Jr.x,y:0}),this.$top.setTransform({x:r.x,y:Qr+r.y}),this.path=new Y(R,new p(this.props.width,0)),super.update()}getSnapPoints(){return[R,new p(this.props.width,0)]}getDrawingPath(){}static altText(){return"Compass"}};di.type="compass",di.defaultProps={width:300,layer:"front",color:q.red},di=T([Ut],di);Mt([{id:"flip",type:"button",tileTypes:["ruler","protractor"],label:"Flip",icon:"flip",useTextLabel:!0,click:s=>{for(let t of s)t.flip()}}]);Mt([{id:"labels",type:"select",tileTypes:["ruler"],label:"Labels:",options:[{label:"Centimeters",key:"cm"},{label:"Inches",key:"in"},{label:"Both",key:"both"},{label:"None",key:"hidden"}],location:"more",get:s=>s.props.units,set:(s,t)=>t.props.units=s},{id:"fixed-length",type:"checkbox",tileTypes:["ruler"],label:"Fixed Length",location:"more",get:s=>!!s.props.isFixed,set:(s,t)=>t.props.isFixed=s}]);var Ue=class{constructor(t){this.$parent=t}getTileAt(t){let e=this.$parent.snapping.snapGeo(t.posn);if(e!=null&&e.tile&&e.tile.canSelect)return e.tile;let i=t.target;for(;i;){let n=qr.get(i);if(n!=null&&n.canSelect&&n.props.name!=="geo")return n;if(i=i.parentNode||void 0,i===this.$parent._el)return}}hoverGeoTile(t){var e;this.hoveringTile!==t&&((e=this.hoveringTile)==null||e.hover(!1)),t==null||t.hover(),this.hoveringTile=t}down(t){}start(t){}move(t){}up(t){}end(t){}click(t){}hover(t){}cancel(){}},eo=class extends Ue{constructor(){super(...arguments);this.clickTimeout=0}down(e){var n,r;let i=this.activeTile=(n=this.getTileAt(e))==null?void 0:n.root;this.activeTileWasSelected=i==null?void 0:i.isActive,this.previousSelection=void 0,(r=this.$parent.focussedTile)==null||r.blur(),this.$parent.warningBanner.hide(),i?(i.isActive&&this.$parent.events.shiftKey?this.$parent.selection.remove(i):(this.$parent.events.shiftKey||!i.isActive)&&this.$parent.selection.add(i,!this.$parent.events.shiftKey),i.down(e),this.$parent.events.grabbing()):this.$parent.events.shiftKey?this.previousSelection=new Set(this.$parent.selection.tiles):this.$parent.selection.clear()}up(e){var i;(i=this.activeTile)==null||i.up(e)}start(){if(!this.activeTile){this.$parent.$selection.show();return}if(this.$parent.events.altKey)this.$parent.paste(this.$parent.selection.copy(!0),R,!1);else if(!this.$parent.state.authorMode){let e=Array.from(this.$parent.selection.tiles).filter(i=>i.props.status!=="generator");for(let i of e)this.$parent.selection.remove(i);this.$parent.paste(this.$parent.selection.copy(!0),R,!1);for(let i of e)this.$parent.selection.add(i)}this.$parent.selection.moveStart()}move(e){var n;if(this.activeTile){this.$parent.selection.move(e);return}let i=G.aroundPoints([e.startPosn,e.posn]);this.$parent.$selection.setRect(i);for(let r of this.$parent.tiles.values()){if(!r.canSelect||r.cannotDragToSelect||!r.transformed||r.group)continue;let o=Fi(i,r.transformed,r.props.name);(this.$parent.events.shiftKey&&((n=this.previousSelection)==null?void 0:n.has(r))?!o:o)?this.$parent.selection.add(r,!1,!0):this.$parent.selection.remove(r,!0)}this.$parent.selection.update(!0)}end(){this.activeTile?this.$parent.selection.moveEnd():this.$parent.$selection.hide(),this.$parent.events.grabbing(!1)}click(e){if(this.activeTile){this.activeTile.click(e,!this.activeTileWasSelected);let i=Date.now();i-this.clickTimeout<500&&this.activeTile.doubleClick(e),this.clickTimeout=i}}hover(e){let i=this.getTileAt(e);this.hoverGeoTile(i!=null&&i.is("geo")?i:void 0),this.$parent.$svg.css("cursor",i?"grab":"")}},so=class extends Ue{down({posn:t}){this.erase(t)}move({posn:t,lastPosn:e}){let i=p.distance(t,e)/4;for(let n=0;nn.distanceSquared(t)<100):U(e)&&i==="geo"?Math.abs(p.distance(t,e.c)-e.r)<10:e.contains(t)}erase(t){let e=this.$parent.option("noDeleting")?[]:this.$parent.tiles.values();for(let i of e)if(!(!i.transformed||i.cannotDragToSelect||!i.canSelect||!i.canEdit)&&this.shouldErase(t,i.transformed,i.props.name)){i.delete();return}for(let i of this.$parent.strokes.values())if(i.hitTest(t,10)){i.delete();return}}end(){this.$parent.flushChanges(),this.$parent.snapping.updateIntersections()}click(){this.end()}},io=class extends Ue{constructor(){super(...arguments);this.options="text"}down({posn:e}){let i=H.create(this.$parent,{name:this.options,x:e.x-10,y:e.y-15});this.$parent.trigger("add-tile",{tile:i}),this.$parent.setActiveTool("move"),i.focus(!0)}},no=class extends Ue{enable(){this.previousTool=this.$parent.state.tool,this.$parent.setActiveTool("pan")}down(t){this.initialOrigin=this.$parent.origin,this.startPosn=It(t.event)}move(t){let e=It(t.event).subtract(this.startPosn),i=this.initialOrigin.subtract(e.scale(1/this.$parent.zoom));this.$parent.setViewport(i,this.$parent.zoom)}disable(){this.$parent.setActiveTool(this.previousTool)}},ro=class extends Ue{constructor(){super(...arguments);this.options="pen"}getUtensil(e){for(let i of this.$parent.tiles.values()){let n=Sd(i)?i.getDrawingPath(e):void 0;if(n)return n}}down({posn:e}){this.stroke=new He(this.$parent,"",this.$parent.state.penColor,this.options),this.stroke.start(e,this.getUtensil(e))}move({posn:e}){this.stroke.addPoint(e)}click(){this.$parent.flushChanges(),this.stroke=void 0}end(e){this.stroke.end(),this.click()}},Qi=class extends Ue{constructor(){super(...arguments);this.options="line";this.angleIndex=0}expr(e,i){var n;switch(this.options){case"line":return`segment(${e},${i})`;case"circle":return`circle(${e},distance(${e},${i}))`;case"rect":return`rectangle(${e},${i}.x-${e}.x,${i}.y-${e}.y)`;case"angle":return`angle(${i},${(n=this.midPoint)==null?void 0:n.props.key},${e})`}}snapPoint(e){var o;this.$parent.options.canvas!=="infinite"&&(e=e.clamp(this.$parent.canvasBounds));let i=this.$parent.snapping.snap([e]);i&&(e=e.add(i.shift));let n="",r=((o=i==null?void 0:i.tile)==null?void 0:o.props.name)==="geo"?i==null?void 0:i.tile:void 0;return r!=null&&r.path&&rt(r.path)&&(n=r.props.key),i!=null&&i.intersection&&(n=i.intersection),{point:e,tile:r,expr:n||`point(${e.x},${e.y})`}}getOrMakePointTile(e){var n,r;if((n=e==null?void 0:e.tile)!=null&&n.path&&rt(e.tile.path))return e.tile;if((r=e==null?void 0:e.tile)!=null&&r.path){let o=e.tile.path.offset(e.point),a=new Yt(this.$parent,{expr:`${e.tile.props.key}.at(${o})`});return this.$parent.trigger("add-tile",{tile:a}),a}let i=new Yt(this.$parent,{expr:e.expr});return this.$parent.trigger("add-tile",{tile:i}),i}drawPendingPoint(e){var r,o;let i=((o=(r=e.tile)==null?void 0:r.path)==null?void 0:o.type)==="point",n=e.expr.startsWith("intersection");this.$parent.$pendingPoint.toggle(!i),i||(this.$parent.$pendingPoint.setCenter(e.point),this.$parent.$pendingPoint.setClass("intersection",n),this.$parent.$pendingPoint.setAttr("r",n?3.5:6))}down({posn:e}){let i=this.snapPoint(e),n=this.getOrMakePointTile(i);this.options==="angle"?(this.angleIndex===0?(this.startPoint=n,this.angleIndex=1):this.angleIndex===1?(this.midPoint=n,this.angleIndex=2,this.path=new Yt(this.$parent,{expr:this.expr(this.startPoint.props.key,n.props.key)})):(this.path.setExpr(this.expr(this.startPoint.props.key,n.props.key)),this.angleIndex=0,this.path=this.startPoint=this.midPoint=void 0),this.$parent.flushChanges()):this.startPoint=n}start(){var e;this.options!=="angle"&&(this.path=new Yt(this.$parent,{}),this.startPoint.pending=this.path.pending=!0,(e=this.$parent.$pendingPoint)==null||e.show(),this.hoverGeoTile())}move({posn:e}){var i;this.options!=="angle"&&(this.endSnap=this.snapPoint(e),this.path.setExpr(this.expr(this.startPoint.props.key,this.endSnap.expr),!0),this.drawPendingPoint(this.endSnap),this.hoverGeoTile((i=this.endSnap)==null?void 0:i.tile))}end(){var n;if(this.options==="angle")return;let e=p.distance(this.startPoint.path,this.endSnap.point)<8,i;e?this.path.delete():(i=this.getOrMakePointTile(this.endSnap),this.path.setExpr(this.expr(this.startPoint.props.key,i.props.key)),this.path.setPending(!1),this.$parent.trigger("add-tile",{tile:this.path})),this.startPoint.setPending(!1),(n=this.$parent.$pendingPoint)==null||n.hide(),this.hoverGeoTile(),this.$parent.snapping.updateIntersections(),this.$parent.flushChanges(),this.startPoint=this.path=this.endSnap=void 0}click(){this.options!=="angle"&&this.$parent.flushChanges()}hover(e){var n;let i=this.snapPoint(e.posn);this.drawPendingPoint(i),this.hoverGeoTile(((n=i==null?void 0:i.tile)==null?void 0:n.props.name)==="geo"?i.tile:void 0),this.options==="angle"&&this.angleIndex===2&&this.path.setExpr(this.expr(this.startPoint.props.key,i.expr))}cancel(){this.$parent.$pendingPoint.hide(),this.path&&this.path.delete(),this.startPoint=this.path=this.endSnap=void 0,this.angleIndex=0}},oo=class extends Qi{constructor(){super(...arguments);this.expression=""}enable(e){var i;this.expression=e,this.$parent.selection.clear(),this.$parent.setActiveTool("geoPending"),(i=window.event)!=null&&i.clientX&&this.hover({posn:me(window.event,this.$parent.$svg)})}makePath(){return this.path=new Yt(this.$parent,{}),this.path.$el.css("opacity",.5),this.path.pending=!0,this.path}down(e){if(!this.expression)return;super.down(e);let i=this.path||this.makePath();i.$el.css("opacity",1),i.setExpr(this.expression.replace(/\$1/g,this.startPoint.props.key)),i.pending=!1,this.path=void 0,this.$parent.selection.add(i,!0),this.$parent.flushChanges(),this.$parent.snapping.updateIntersections(),this.$parent.trigger("add-tile",{tile:i}),this.$parent.setActiveTool("move")}hover({posn:e}){var n;if(!this.expression)return;let i=this.snapPoint(e);this.drawPendingPoint(i),this.hoverGeoTile(((n=i==null?void 0:i.tile)==null?void 0:n.props.name)==="geo"?i.tile:void 0),this.path||this.makePath(),this.path.setExpr(this.expression.replace(/\$1/g,i.expr))}cancel(){super.cancel(),this.expression=""}},ao=class extends Ue{enable(){if(this.tiles=Array.from(this.$parent.selection.tiles),!this.tiles.length)return this.cancel();this.$parent.selection.clear(),this.$parent.setActiveTool("cutPolygon");for(let t of this.tiles)t.$el.addClass("active")}down(){}start({posn:t}){var e;this.tiles&&(this.startPoint=((e=this.$parent.snapping.snap([t]))==null?void 0:e.posn)||t,this.$stroke=m("line",{class:"stroke cut"},this.$parent.$strokes))}move({posn:t}){var e,i;this.tiles&&(this.endPoint=((e=this.$parent.snapping.snap([t]))==null?void 0:e.posn)||t.snap(this.startPoint,5),(i=this.$stroke)==null||i.setLine(this.startPoint,this.endPoint))}end(t){var i;if(!this.tiles)return;if(t.cancelled)return this.cancel();let e=new vt(this.startPoint,this.endPoint);for(let n of this.tiles||[]){let o=n.transformed.cut(e);if(o.length>1){for(let a of o)H.create(this.$parent,ft(ut({},n.props.raw),{name:"polygon",shape:oi(a),scale:void 0,index:void 0,isFlipped:void 0,width:void 0,height:void 0,sides:void 0,x:0,y:0,rot:0}));n.delete()}else n.$el.removeClass("active")}this.$parent.flushChanges(),(i=this.$stroke)==null||i.remove(),this.$stroke=this.tiles=this.startPoint=this.endPoint=void 0,this.$parent.setActiveTool("move")}click(){this.cancel()}cancel(){var t;for(let e of this.tiles||[])e.$el.removeClass("active");(t=this.$stroke)==null||t.remove(),this.$stroke=this.tiles=this.startPoint=this.endPoint=void 0,setTimeout(()=>this.$parent.setActiveTool("move"))}};var Ed='
';var Cd=new Set(["x","y","\u03B8","r"]);function Md(s,t){if(s instanceof jt&&s.fn==="="){let[e,i]=s.args;if(e instanceof Zs&&!(t==="graphing"&&Cd.has(e.i)))return{variable:e.i,expression:i}}return{expression:s}}var ho=class{constructor(){this.assignments=new Map;this.callbackDeps=new Map;this.updatedNames=new Set}get defined(){return[...this.assignments.keys()]}findFirstAssigner(t){var e;return(e=this.assignments.get(t))==null?void 0:e.keys().next().value}findDependants(t,e=[]){let i=[];for(let[r,o]of this.assignments.entries())o.size===1&&r!==t&&!e.includes(r)&&Vs(o.values()).unknowns.filter(h=>!e.includes(h)).includes(t)&&i.push(r);let n=_h(i,r=>this.findDependants(r,i.filter(o=>o!==r)));return[...i,...n]}validate(t){let e=new Set,i=(n,r=[])=>{if(!this.assignments.has(n)){e.add(n);return}if(r.includes(n))return{message:`The variable ${n} is defined recursively.`,locations:r.splice(r.indexOf(n)).map(a=>this.findFirstAssigner(a))};let o=this.assignments.get(n);if(o.size===1){let a=Vs(o.values());for(let h of a.unknowns){let l=i(h,[...r,n]);if(l)return l}}else return{message:`You have defined ${n} in multiple places.`,locations:Array.from(o.keys())}};for(let n of t.unknowns){let r=i(n);if(r)return{error:r,dependsOn:[],unknowns:[]}}return{dependsOn:[],unknowns:Array.from(e)}}evaluate(t){try{let{error:e,unknowns:i}=this.validate(t);return e||i.length?{error:e,value:Number.NaN}:{value:t.evaluate(this.evalContext)}}catch(e){return{value:Number.NaN}}}get evalContext(){let t={};for(let[e,i]of this.assignments.entries())i.size===1&&(t[e]=Vs(i.values()));return t}serializeEvalContext(t){let e={};for(let[i,n]of Object.entries(this.evalContext))t==="graphing"&&Cd.has(i)||(e[i]=n.toString());return e}substituteAssignments(t,e){let i=Md(t,e);return i.variable?new jt("=",[new Zs(i.variable),i.expression.recursiveSubstitute(this.evalContext)]):t.recursiveSubstitute(this.evalContext)}markUpdated(t){this.updatedNames.add(t);for(let e of this.findDependants(t))this.updatedNames.add(e)}flushChanges(){for(let[e,i]of this.callbackDeps.entries())i.some(n=>this.updatedNames.has(n))&&e();let t=Array.from(this.updatedNames);return this.updatedNames.clear(),t}updateSource(t,e,i,n=!0){this.removeSource(t,!1),this.assignments.has(e)||this.assignments.set(e,new Map),this.assignments.get(e).set(t,i),this.markUpdated(e),n&&this.flushChanges()}attemptUpdateSource(t,e,i,n=!0){if(typeof e=="string")try{e=Et.parse(e).collapse()}catch(o){return}let r=Md(e,i);return r.variable?this.updateSource(t,r.variable,r.expression,n):this.removeSource(t),r}removeSource(t,e=!0){for(let[i,n]of this.assignments.entries())n.has(t)&&this.markUpdated(i),n.delete(t),n.size===0&&this.assignments.delete(i);e&&this.flushChanges()}watch(t,e,i=!1){this.callbackDeps.set(e,t),i&&e()}unwatch(t){t&&this.callbackDeps.delete(t)}};var de="/polypad/assets/audio",Ad={roll:new ee(`${de}/roll.mp3`,.6,!1),spin:new ee(`${de}/spin.mp3`,.5,!1),coinToss:new ee(`${de}/coin-toss.mp3`,.3,!1),shuffle:new ee(`${de}/shuffle.mp3`,.3,!1),rng:new ee(`${de}/rng-roll.mp3`,.3,!1),draw:new ee(`${de}/card-draw.mp3`,.2,!1),click:new ee(`${de}/click.mp3`,.3,!1),woosh:new ee(`${de}/woosh.mp3`,.2,!1),rise:new ee(`${de}/rise.mp3`,.3,!1),fall:new ee(`${de}/fall.mp3`,.3,!1),splitCoins:new ee(`${de}/split-coins.mp3`,.175,!1),mergeCoins:new ee(`${de}/merge-coins.mp3`,.3,!1)};var Le=25,xh=Le*Math.sqrt(3)/2,U0=Math.sqrt(2*Le**2)/2;function fi(s,t,e){let i,n,r;t:for(let o of e)for(let a of t){let h=o.posn||o.path.project(a),l=h.subtract(a),c=l.length;if(c^-]/g,""),n=btoa(t.props.name+i+t.props.raw.color).replace(/=/g,""),r=(g=s.tileWeights.get(n))!=null?g:1;return[n,1,0,r,r]}function W0(s,t,e){let i={},n=0,r=(d,g=1)=>{let[w,f,v,y,$]=Ph(s,d);n+=g*y,w&&(i[w]||(i[w]=[0,0,0]),i[w][0]+=g*f,i[w][1]+=g*v,i[w][2]=$)};for(let d of t)r(d,1);for(let d of e)r(d,-1);if(x(n,0))return;let o=Object.keys(i).filter(d=>i[d][0]||i[d][1]),a=o.find(d=>!s.tileWeights.has(d))||O(o);if(!a)return!0;let[h,l,c]=i[a],u=x(l,0)?c-n/h:Math.max(...Bo(l,h,n-h*c-l*c*c));s.tileWeights.set(a,u),s.options.tileWeights=Array.from(s.tileWeights.entries()).map(d=>d.join("=")).join(",")}function Th(s,t){s.tileWeights.clear();for(let e of t.split(",")){let[i,n]=e.split("=");i&&s.tileWeights.set(i,+n||0)}}var kd="M0,26A18.1,18.1,0,0,0-18,44V72H18V44A18.1,18.1,0,0,0,0,26Z",K0=new Set(["text","number-line","spinner","decimal-grid","axes","custom-spinner","ruler","protractor","compass","geo","dot-machine","abacus","balance","chess-board","multi-jump","set-triangle","bucket","table","number-grid","chart","pie-chart","box-whisker","clock","polyhedron","rectangle","question-blank","logic-switch","logic-gate","logic-speaker","chess-piece","function-machine"]),Ji=15,Ot=40,Vd=180;function co(s){let t=s/2;return`M${t},0C${t},16,66.3,20,0,20S${-t},16${-t},0Z`}var mi=class extends H{constructor(e,i,n){super(e,i,n);this.cannotRotateType=!0;this.$beam=m("path",{class:"balance-beam"},this.$el),this.$left=m("path",{class:"balance"},this.$el),this.$right=m("path",{class:"balance"},this.$el),this.$base=m("path",{d:kd,class:"balance"},this.$el),this.dropzones=this.targetAreas().map(r=>this.$parent.dropzoneManager.createDropzone(this,{path:r,ignored:K0})),this.$handle=this.makeHandle("c",r=>{this.props.size=B(Pt(r.x-Ot,20),120,800),this.resize(),this.draw(),this.transform()}),this.$handle.css("cursor","ew-resize"),this.props.watch("color",({color:r})=>{this.$beam.css("stroke",r);for(let o of[this.$base,this.$left,this.$right])o.css("fill",r)}),this.customTransform(),this.resize(),this.draw()}onDropzonesChange(){this.rebalance(400)}applyChange(e){super.applyChange(e),"level"in e&&this.draw()}targetAreas(){let e=new G(new p(0,-Vd),this.props.size,Vd),i=e.shift(-this.props.size-Ot,this.props.level*Ji),n=e.shift(Ot,-this.props.level*Ji);return[i,n]}resize(){this.$left.setAttr("d",co(this.props.size)),this.$right.setAttr("d",co(this.props.size)),this.customTransform()}draw(e=this.props.level){let i=this.props.size/2+Ot,n=new p(-i,e*15),r=new p(i,-e*15);this.$beam.draw(new te(n.shift(0,10),n.shift(0,44),r.shift(0,44),r.shift(0,10))),this.$left.setTransform(n),this.$right.setTransform(r),this.$handle.setCenter({x:this.props.size+Ot,y:-e*15});let[o,a]=this.targetAreas();this.dropzones[0].updateTarget(o),this.dropzones[1].updateTarget(a)}rebalance(e=400){return D(this,null,function*(){let[i,n]=this.dropzones.map(d=>d.containedTiles),r=N(Array.from(ke(i),d=>Ph(this.$parent,d)[3])),o=N(Array.from(ke(n),d=>Ph(this.$parent,d)[3])),a=x(r,o)?0:r({tile:d,posn:d.posn.shift(0,l)})),u=Array.from(n,d=>({tile:d,posn:d.posn.shift(0,-l)}));yield H.animate([...c,...u],e,d=>{this.draw(tt(h,a,d)),this.$parent.selection.update()}),this.isAnimating=!1,this.transform(),this.$parent.selection.update()})}customTransform(){let e=this.props.level*Ji,i=this.props.size+Ot;this.path=new V(new p(-i,e),new p(-Ot,e),new p(-Ot,25),new p(Ot,25),new p(Ot,-e),new p(i,-e),new p(i,-e+48),new p(Ot,-e+48),new p(Ot,72),new p(-Ot,72),new p(-Ot,e+48),new p(-i,e+48))}getSnapPoints(){let e=this.props.level*Ji,i=this.props.size+Ot;return[new p(-i,e),new p(-Ot,e),new p(Ot,-e),new p(i,-e)]}getSnapLines(){let[e,i,n,r]=this.getSnapPoints();return[new Y(e,i),new Y(n,r)]}balance(){let[e,i]=this.dropzones.map(r=>r.containedTiles);if(W0(this.$parent,e,i))return xr("balance-error");for(let r of this.$parent.getTilesOfType("balance"))r.rebalance()}static makeThumbnail(e){let i=m("svg",{width:250,height:50,viewBox:"-290 -10 580 82",class:"scale"},e);m("path",{d:"M-160 10v34h320v-34",fill:"transparent",stroke:"#bbb","stroke-width":10},i),m("path",{d:co(240),transform:"translate(-160 0)",fill:"#bbb"},i),m("path",{d:co(240),transform:"translate(160 0)",fill:"#bbb"},i),m("path",{d:kd,fill:"#bbb"},i)}static altText(){return"Balance Scale"}};mi.type="balance",mi.defaultProps={level:0,size:240,color:"#bbb"},mi=T([Ut],mi);Mt([{id:"balance",type:"button",tileTypes:["balance"],label:"Balance",show:s=>s.length===1&&!!s[0].props.level,click:s=>{s[0].balance()}}]);function Id(s){return[...s].sort((t,e)=>t.props.zIndex-e.props.zIndex)}function Ld(s,t,e){let i=Oo(s,t,e);i>=0&&s.splice(i,1)}function X0(s,t){if(!s.length)return s.push({item:t,val:t.props.zIndex});let e=Lo(s,t.props.zIndex,Io.firstGreater);s.splice(e<0?s.length:e,0,{item:t,val:t.props.zIndex})}var po=class{constructor(t){this.$parent=t;this.sorted={front:[],normal:[],back:[]};this.layers=new WeakMap}clear(){this.sorted={front:[],normal:[],back:[]},this.layers=new WeakMap}addOrUpdate(t){let e=this.layers.get(t);e&&Ld(this.sorted[e.layer],t,e.z);let i=e&&e.layer!==t.props.layer,n=this.sorted[t.props.layer];(t.props.raw.zIndex===void 0||i)&&(t.props.raw.zIndex=n.length?O(n).val+1:0),this.layers.set(t,{layer:t.props.layer,z:t.props.zIndex}),X0(n,t)}remove(t){let e=this.sorted[t.props.layer];Ld(e,t,t.props.zIndex),this.layers.delete(t)}bringToFront(t,e,i){for(let n of Id(t)){if(n.noAutoLayering&&!e)continue;let r=O(this.sorted[n.props.layer]);r.item!==n&&(n.props.zIndex=r?r.val+1:0,i&&this.$parent.pendingChanges.add(n))}}bringToBack(t,e){for(let i of Id(t)){if(i.noAutoLayering&&!e)continue;let n=this.sorted[i.props.layer][0];if(n.item===i)return;i.props.zIndex=n?n.val-1:0}}getTileAbove(t){let e=this.sorted[t.props.layer],i=Oo(e,t,t.props.zIndex);for(let n=i+1;n

This colour is adjusted in dark mode.

Customise the Polypad features and UI, or use advanced tile properties and authoring tools. Learn more

\u2022 \u2022 Learn more

Polypad UI and features

Tile actions and properties

Display and audio options

`;function Sh(s=!0){let t=s?"":"hidden";return{mergeTiles:s,sidebar:t,toolbar:t,actionbar:t,settings:t,noCopyPaste:!s,noUndoRedo:!s,resetState:!s,noPinchPan:!s,noDeleting:!s,noAudio:!s,noMusic:!s,noRotating:!s,noSnapping:!s,altColors:!1}}var uo=class extends E{bindPolypad(t){var u;this.bindModel(t.options);let e=this.$('input[type="color"]');e.change(d=>t.options.background=d),e.on("blur",()=>t.flushChanges());let i=this.$(".bg-warn"),n=()=>{let d=t.options.background||"#ffffff";e.value=d,e.next.css("background",d),i==null||i.toggle(b.theme.isDark&&t.flipTheme)};t.options.watch(n),b.onThemeChange(n),this.$("select").on("change",()=>{let d=t.options.canvas;t.options.canvasX=d==="infinite"?void 0:750,t.options.canvasY=d==="fixed"?750:void 0,t.resetViewport(),t.flushChanges()});for(let[d,g]of this.$$(".size").entries()){let w=d===1?"canvasY":"canvasX";g.onKey("Enter",()=>g.blur()),g.change(f=>{f&&(t.options[w]=(Math.round(+f)||15)*50,t.resetViewport())}),g.on("blur",()=>t.flushChanges()),t.options.watch(f=>g.value=`${(f[w]||0)/50}`)}for(let d of this.$$("input.toggle"))d.on("change",()=>t.selection.update());let o=this.$(".sidebar");t.options.watch(d=>o.checked=d.sidebar!=="hidden"),o.on("click",()=>t.options.sidebar=o.checked?"":"hidden");let a=this.$$(".setting");t.options.watch(({settings:d})=>{let g=(d==null?void 0:d.split(","))||[];for(let w of a)w.checked=!d||g.includes(w.data.key)});for(let d of a)d.on("change",()=>{t.options.settings=a.every(g=>g.checked)?void 0:a.filter(g=>g.checked).map(g=>g.data.key).join(",")||"other"});for(let d of this.$$(".advanced input, .authoring, .advanced select"))d.on("change",()=>setTimeout(()=>t.flushChanges()));Eh||(u=this.$(".handdrawn"))==null||u.parent.remove(),this.$(".authoring").bindVariable(t.state,"authorMode");let l=this.$$(".caption, .advanced");t.state.watch(d=>l.map((g,w)=>g.toggle(d.authorMode?!!w:!w)));let c=this.$$(".preset");for(let[d,g]of c.entries())g.on("click",()=>t.options.assign(Sh(!d)))}};uo=T([S("pp-customise",{template:Od})],uo);var Rd=12,Dd=s=>s.path.rotate(J(s.rot),s.is("group")?s.path.center:void 0),fo=class{constructor(t,e){this.tile=t;this.options=e;this.containedTiles=new Set;this.$path=m("path",{class:"dropzone",path:e.path,hidden:!0},t.$el)}canInsert(t){var n,r,o,a;let e=(r=(n=this.options.allowed)==null?void 0:n.has(t.props.name))!=null?r:!0,i=(a=(o=this.options.ignored)==null?void 0:o.has(t.props.name))!=null?a:!1;return e&&!i&&(!this.options.canAdd||this.options.canAdd(t))}hasReachedTileLimit(){return this.options.maxTiles?this.containedTiles.size>=this.options.maxTiles:!1}overlaps(t){if(!t.path)return!1;let e=Dd(t).translate(t.posn.subtract(this.tile.posn)).rotate(-J(this.tile.rot));return Fi(this.options.path,e)}addTile(t){this.containedTiles.add(t),t.inDropZone=this}delete(){for(let t of this.containedTiles)t.inDropZone=void 0;this.containedTiles.clear(),this.$path.remove()}updateTarget(t,e){var n;this.options.path=t;let i=-((n=this.options.boxOffset)!=null?n:0);this.$path.draw(t.padding(i,i,i,i)),this.reflowLayout(e)}reflowLayout(t){if(!this.containedTiles.size||!this.options.layout||this.options.layout==="none")return;let e=this.getSortedTiles(),i=this.options.layout==="flow"?this.flowLayout(e):this.centerLayout(e),n=t?0:240;H.animate(i,n,()=>this.tile.$parent.selection.update())}getSortedTiles(){return Array.from(this.containedTiles).sort((t,e)=>Math.abs(t.posn.y-e.posn.y)<25?t.posn.x-e.posn.x:t.posn.y-e.posn.y)}flowLayout(t){var l;let e=Math.min(this.options.path.h,this.options.path.w),i=B(0,(e-50)/2,(l=this.options.padding)!=null?l:Rd),n=i,r=i,o=0,a=0,h=this.tile.posn.add(this.options.path.p);return t.map(c=>{let u=Lt(c.transformed);n+u.w+i>this.options.path.w+.001&&(r+=o+i,r>this.options.path.h-25+.001&&(a++,r=i+5*a),n=i+5*a,o=0);let d=h.add(c.posn).subtract(u.p).shift(n,r);return n+=u.w+i,o=Math.max(o,u.h),{tile:c,posn:d}})}centerLayout(t){var v;let e=t.map(y=>Lt(Dd(y))),i=Math.ceil(Math.sqrt(t.length)),n=Math.ceil(t.length/i),r=z(y=>oe(y*i,Math.min((y+1)*i,t.length)-1),n),o=z(y=>N(r[y].map($=>e[$].w)),n),a=Math.max(...o),h=z(y=>Math.max(...r[y].map($=>e[$].h)),n),l=N(h),c=(v=this.options.padding)!=null?v:Rd,u=o.map(y=>i>1?Math.min((this.options.path.w-y)/(i-1),c):0),d=n>1?Math.min((this.options.path.h-l)/(n-1),c):0,g=this.tile.posn.add(this.options.path.center).shift(-(a+(i-1)*Math.min(...u))/2,-(l+(n-1)*d)/2),w=0,f=0;return t.map((y,$)=>{let I=$%i,A=Math.floor($/i),M=g.shift(w,f).subtract(e[$].p);return(I+1)%i?w+=e[$].w+u[A]:(w=0,f+=h[A]+d),{tile:y,posn:M}})}};var Nd=s=>s.props.status!=="locked"&&s.props.status!=="hidden",mo=class{constructor(t){this.polypad=t;this.dropzones=new Map;this.lockedTiles=new Set;this.tilesMoved=!1}createDropzone(t,e){this.dropzones.has(t)||this.dropzones.set(t,new Set);let i=new fo(t,e);return this.dropzones.get(t).add(i),i}deleteDropzone(t){var e;t.delete(),(e=this.dropzones.get(t.tile))==null||e.delete(t)}clear(){for(let t of this.dropzones.values())for(let e of t)e.delete();this.dropzones.clear()}lockToZone(t,e){var i;(i=t.inDropZone)==null||i.containedTiles.delete(t),e.containedTiles.add(t),this.lockedTiles.add(t)}update(t){if(!this.dropzones.size)return;if(!t||At(t,n=>this.dropzones.has(n))){let n=Bh(t||[],r=>r.isDeleting);t=on(this.polypad.tiles.values(),n)}let e=new Set,i=!1;t:for(let n of gp(t)){if(n.isDeleting&&(i=!0),n.isDeleting&&this.dropzones.has(n)){for(let r of this.dropzones.get(n))r.delete();this.dropzones.delete(n);continue}if(n.inDropZone){if(e.add(n.inDropZone.tile),!n.isDeleting&&this.lockedTiles.has(n))continue;n.inDropZone.containedTiles.delete(n),n.inDropZone=void 0}if(Nd(n)&&!(this.dropzones.has(n)||n.isDeleting)){for(let r of this.dropzones.values())for(let o of r)if(o.overlaps(n)){if(!o.canInsert(n)){o.options.ejectInvalid&&this.ejectFromZone(n,o);continue}if(o.hasReachedTileLimit()&&o.containedTiles.size){let a=O([...o.containedTiles]);this.ejectFromZone(a,o)}o.addTile(n),e.add(o.tile);continue t}}}for(let n of e){if(this.tilesMoved||i)for(let r of this.dropzones.get(n)||[])r.reflowLayout();n.isDeleting||n.onDropzonesChange()}this.polypad.trigger("dropzone-change",{tiles:e}),this.lockedTiles.clear(),this.tilesMoved=!1}ejectFromZone(t,e,i=20){let n=Lt(t.transformed),r=e.tile.posn.add(e.options.path.p),o=[{y:r.y-n.p.y-n.h-i},{x:r.x+e.options.path.w-n.p.x+i},{y:r.y+e.options.path.h-n.p.y+i},{x:r.x-n.p.x-n.w-i}];for(let[a,h]of o.entries()){let l=t.posn.shift(h.x||0,h.y||0);if(!(a<3&&this.polypad.getTileAt(l,["categorizer"])))return e.containedTiles.delete(t),t.inDropZone=void 0,H.animate([{tile:t,posn:l}],200,()=>t.$parent.selection.update())}}onMoveStart(t){if(!this.dropzones.size)return;let e=new Set;for(let i of t)for(let n of this.dropzones.get(i)||[])if(n.$path.show(),n.options.sticky)for(let r of n.containedTiles)e.add(r);this.polypad.selection.select(e)}onMove(t){if(!this.dropzones.size)return;let e=new Set;for(let[i,n]of this.dropzones.entries())if(!i.isActive)for(let r of n)r.$path.toggle(At(t,o=>{if(!Nd(o))return;let a=!e.has(o)&&(r.containedTiles.has(o)||r.canInsert(o))&&r.overlaps(o);return a&&e.add(o),a}))}onMoveEnd(){if(this.dropzones.size){this.tilesMoved=!0;for(let t of this.dropzones.values())for(let e of t)e.$path.hide()}}};var go=4,vo=s=>`${s.xMin} ${s.yMin} ${s.dx} ${s.dy}`,Gd=s=>!!s.name,Eh=b.isChrome&&!b.isMobile,wo=class extends E{constructor(){super(...arguments);this.tiles=new Map;this.strokes=new Map;this.options=le({});this.state=le({tool:"move",changeCount:0,penColor:"#242436",audioPlaying:0});this.mathContext=new ho;this.snapping=new lo(this);this.zIndex=new po(this);this.dropzoneManager=new mo(this);this.geoData=new jr;this.tools={move:new eo(this),pen:new ro(this),geo:new Qi(this),geoPending:new oo(this),eraser:new so(this),text:new io(this),pan:new no(this),cutPolygon:new ao(this)};this.origin=R;this.zoom=1;this.margins=[40,40,40,40];this.initial={};this.newTileShift=0;this.tileWeights=new Map;this.setup=!1;this.undoStack=[];this.redoStack=[];this.pendingChanges=new Set;this.pendingStrokes=new Set}ready(){this.$svg=this.$("svg.canvas"),this.$tiles=this.$svg.$$(".tiles"),this.$selection=this.$svg.$(".selection"),this.$strokes=this.$svg.$(".strokes"),this.$grid=this.$svg.$(".grid"),this.$html=this.$(".html-overlay"),this.$mask=this.$(".mask"),this.$geoShadows=this.$svg.$(".geo-shadows"),this.$geoPaths=this.$svg.$(".geo-paths"),this.$geoPoints=this.$svg.$(".geo-points"),this.$pendingPoint=m("circle",{class:"geo-point pending",hidden:!0},this.$geoPoints),this.setAttr("data-tool","move"),this.events=new ei(this.$svg,{down:i=>this.tools[this.state.tool].down(i),up:i=>this.tools[this.state.tool].up(i),start:i=>this.tools[this.state.tool].start(i),move:i=>this.tools[this.state.tool].move(i),end:i=>this.tools[this.state.tool].end(i),click:i=>this.tools[this.state.tool].click(i),hover:i=>this.tools[this.state.tool].hover(i),cursor:!1}),this.selection=new Kr(this),this.warningBanner=new wr(this),this.setViewport(R,1),this.options.watch(i=>{this.$grid.setAttr("fill",i.grid&&i.grid!=="none"?`url(#${i.grid})`:"none"),this.$grid.setRect(this.viewportBounds.rect)}),this.$svg.on("contextmenu",i=>{this.focussedTile||i.preventDefault()}),this.enablePinchPan(),this.enableAccessibility(),b.onThemeChange(()=>{this.setBackground(this.options.background);for(let i of this.tiles.values())i.props.updateTheme();for(let i of this.strokes.values())i.setColor(i.color);this.updateCursor()}),this.options.watch(i=>this.setBackground(i.background)),this.options.watch(i=>this.setClass("high-contrast",!!i.highContrast)),Eh&&this.options.watch(i=>this.setClass("handdrawn",!!i.handdrawn)),this.state.watch(()=>this.updateCursor());let e=this.$(".bg-icon");this.state.watch(i=>{e.toggle(i.authorMode),this.setClass("author-mode",!!i.authorMode),this.selection.clear()}),this.options.watch(i=>this.toggleViewportTile(i.customInitialViewport)),this.options.watch(()=>{let{canvas:i,canvasX:n=750,canvasY:r=750}=this.options,o=2e4;this.$mask.toggle(i!=="infinite"),i==="notebook"?this.$mask.setAttr("d",`M-1 -1h${n+2}V${o}H${o}V${-o}H${-o}V${o}H-1z`):i==="fixed"&&this.$mask.setAttr("d",`M-1 -1h${n+2}v${r+2}h${-n-2}zM${-o}${-o}V${o}H${o}V${-o}z`),this.canvasBounds=i==="infinite"?void 0:new lt(0,n,0,i==="notebook"?1e10:r)})}playSound(e){this.options.noAudio||Ad[e].play()}toggleViewportTile(e){if(!this.setup)if(e)H.create(this,{name:"initial-viewport",x:this.viewportBounds.center.x-200,y:this.viewportBounds.center.y-200},"INITIAL_VIEWPORT");else for(let i of this.getTilesOfType("initial-viewport"))i.delete()}get customInitialBounds(){if(!this.options.customInitialViewport)return;let e=this.tiles.get("INITIAL_VIEWPORT");if(e)return _i(new Map([["INITIAL_VIEWPORT",e]]),new Map,!0)}setBackground(e="#fff"){let i=$t.fromHex(e).hsl[2],n=e;this.flipTheme=i>=70,b.theme.isDark&&this.flipTheme&&(n=i>99?"#22212e":_e(e),i=100-i);let r=i<50?"#e2e1e6":"#181824";this.parent.css("--canvas-bg",n),this.parent.css("--canvas-fg",r),this.parent.css("--grid-opacity",.5-Math.abs(i/50-1)/4),this.parent.setClass("dark",i<50),this.$mask.css("fill",$t.mix("#000",n,.25).hex);let o=this.margins.some(a=>a>0);this.$mask.css("stroke",o?$t.mix(r,n,.4).hex:"transparent")}updateCursor(){let{tool:e,toolOptions:i,penColor:n}=this.state;if(e!=="pen"&&e!=="eraser")return this.css("cursor","");let r=e==="eraser"?10:i==="highlighter"?12:5,o=e==="eraser"?"#fff":_e(n||"#000",this.flipTheme);this.css("cursor",`url('data:image/svg+xml;utf8,') ${r+1} ${r+1}, auto`.replaceAll("#","%23"))}getTileAt(e,i){for(let n of this.tiles.values())if(!(i&&!i.includes(n.props.name))&&n.contains(e))return n}getInputAt(e,i){for(let n of this.tiles.values()){let r=n.getClosestPort(e,i);if(r)return r}}*getTilesOfType(e){for(let i of this.tiles.values())i.is(e)&&(yield i)}getBounds(e=0){let{canvas:i,canvasX:n,canvasY:r}=this.options;if(i==="infinite")return this.contentBounds.extend(e);let o=i==="notebook"?this.contentBounds.yMax+e:r;return new lt(0,n!=null?n:0,0,o!=null?o:0)}getThumbnailBounds(e=0){var a;let{canvas:i,canvasX:n,canvasY:r}=this.options,o=(a=this.customInitialBounds)!=null?a:this.contentBounds.extend(e);return i==="infinite"||(o.xMin=Math.max(0,o.xMin),o.yMin=Math.max(0,o.yMin),o.xMax=n?Math.min(o.xMax,n):o.xMax,o.yMax=o.dx/1.5,o.yMax=r?Math.min(o.yMax,r):o.yMax),o}option(e){return this.state.authorMode?!1:!!this.options[e]}hasAction(e){let i=this.options.actionbar;return i?i.split(",").includes(e):!0}enablePinchPan(){this.on("wheel",n=>{if(!this.options.noPinchPan)if(n.preventDefault(),n.ctrlKey){let r=this.zoom*(1-n.deltaY/100);this.setViewport(this.origin,r,me(n,this.$svg))}else{let r=this.origin.shift(n.deltaX/this.zoom,n.deltaY/this.zoom);this.setViewport(r,this.zoom)}});let e=0,i=this.origin;this.on("gesturestart",n=>{this.options.noPinchPan||(n.preventDefault(),i=new p(n.pageX,n.pageY).subtract(this.origin),e=this.zoom,this.events.cancel())}),this.on("gesturechange",n=>{if(this.options.noPinchPan)return;n.preventDefault();let r=e*n.scale,o=new p(n.pageX,n.pageY).subtract(i);this.setViewport(o,r,me(n,this.$svg))}),this.on("gestureend",n=>{this.options.noPinchPan||n.preventDefault()})}enableImageDrop(e,i){let n=m("div",{class:"image-drop"},this);this.imageUploadCallback=e,this.on("dragenter dragover dragleave drop",o=>o.preventDefault()),this.on("dragenter dragover",()=>n.show()),this.on("dragleave drop",()=>n.hide());let r=(o,a)=>D(this,null,function*(){let l=Array.from((o==null?void 0:o.files)||[]).slice(0,10).map((c,u)=>this.newImage(c,a.shift(u*25),e));yield Promise.all(l),this.flushChanges(),this.trigger("paste")});this.on("drop",o=>r(o.dataTransfer,me(o,this.$svg))),i==null||i.on("change",()=>D(this,null,function*(){yield r(i._el,this.viewportBounds.center),i.value=""}))}bindKeyboardEvents(e=C,i){this.selection.bindKeyboardEvents(e),e.onKey("Backspace Clear Delete",()=>this.selection.delete()),e.onKey("z",n=>{n.preventDefault(),this[n.shiftKey?"redo":"undo"]()},{meta:!0}),e.onKey("y",n=>{n.preventDefault(),this.redo()},{meta:!0}),e.onKey("c C",()=>{if(this.option("noCopyPaste"))return;let n=this.selection.copy();this.paste(n,new p(25,25)),this.flushChanges()}),e.onKey("a",n=>{var o;if((o=k("x-modal"))!=null&&o.getOpenModal())return;n.preventDefault();let r=Array.from(this.tiles.values());this.state.authorMode||(r=r.filter(a=>a.canSelect)),this.selection.select(r)},{meta:!0}),C.on("cut copy",n=>{var o;if(i!=null&&i()||!this.selection.tiles.size||this.option("noCopyPaste")||b.formIsActive)return;let r=this.selection.copy();(o=window.navigator.clipboard)==null||o.writeText(JSON.stringify(r)),n.type==="cut"&&this.selection.delete()}),C.on("paste",n=>D(this,null,function*(){var a;if(i!=null&&i()||this.option("noCopyPaste")||b.formIsActive)return;let r=dp(n.clipboardData);if(r&&this.imageUploadCallback)return yield this.newImage(r,this.center.shift(-50),this.imageUploadCallback),this.flushChanges(),this.trigger("paste");let o=yield(a=window.navigator.clipboard)==null?void 0:a.readText();if(o){try{let h=JSON.parse(o);if(!Object.keys(h).length)return;this.paste(h)}catch(h){let l=H.create(this,{name:"text",html:o});l.setTransform(this.viewportBounds.center.subtract(l.center)),this.selection.add(l,!0),this.flushChanges(),this.trigger("paste"),this.selection.select([l])}this.flushChanges()}})),e.onKey("Space",n=>{this.options.noPinchPan||this.state.tool==="pan"||(n.preventDefault(),this.tools.pan.enable())}),e.onKey("Space",n=>{this.options.noPinchPan||this.state.tool!=="pan"||(n.preventDefault(),this.tools.pan.disable())},{up:!0})}enableAccessibility(){let e,i=!1,n=r=>{this.focussedTile||(e=r,this.$svg.setAttr("aria-description",r?r.altText:"Empty Canvas"),r&&this.selection.add(r,!0))};this.$svg.on("focusin",()=>{if(!i)return;let r=Array.from(this.tiles.values()).filter(o=>!o.props.status);n(this.events.shiftKey?O(r):r[0])}),this.$svg.on("focusout",()=>e=void 0),C.on("keydown",r=>{var a;if(i=!0,r.key==="Escape")return(a=this.focussedTile)==null||a.blur(),this.setActiveTool("move");if(r.key!=="Tab"||!e)return;let o=Array.from(this.tiles.values()).filter(h=>!h.group&&!h.props.status);n(o[o.indexOf(e)+(r.shiftKey?-1:1)]),e&&r.preventDefault()}),C.on("pointerdown",()=>i=!1),this.$svg.on("pointerdown",()=>{i=!1,this.focussedTile||this.$svg.focus()})}newImage(e,i,n){return D(this,null,function*(){let r=new FileReader;r.readAsDataURL(e),yield new Promise(a=>r.onloadend=a);let o=H.create(this,{name:"image",href:(r.result||"").toString(),x:i.x,y:i.y});return this.selection.add(o,!0),yield n==null?void 0:n(e,o),o})}setViewport(e,i=1,n){var v;if(i=B(i,1/go,go),n){let y=this.zoom/i;e=n.subtract(n.subtract(this.origin).scale(y))}let r=this.width/i,o=this.height/i,{canvas:a,canvasX:h=0,canvasY:l=0,grid:c}=this.options,[u,d,g,w]=this.margins;if(a==="infinite")this.origin=e.clamp(this.contentBounds.extend(o,0,0,r),50/i);else{let y=a==="notebook"?this.contentBounds.yMax+o-u/i:l,$=new lt(-w/i,h-r+d/i,-u/i,y-o+g/i,"center");this.origin=e.clamp($)}this.zoom=i,this.viewportBounds=new lt(this.origin.x,this.origin.x+r,this.origin.y,this.origin.y+o),this.$svg.setAttr("viewBox",this.attr("viewBox")||vo(this.viewportBounds)),this.$html.setTransform(this.origin.inverse.scale(this.zoom),0,this.zoom);let f=this.viewportBounds.rect;c!=="none"&&this.$grid.setRect(f),this.geoData.redrawLines(((v=this.canvasBounds)==null?void 0:v.rect)||f),this.newTileShift=0,this.trigger("viewport")}resetViewport(){if(this.options.canvas==="infinite"&&!this.tiles.size&&!this.strokes.size)return this.setViewport(R,1);this.panToBounds(this.customInitialBounds)}panToBounds(e,i=0){let{width:n,height:r,margins:o,origin:a,zoom:h,options:l}=this,[c,u,d,g]=o,w=!e&&l.canvas==="notebook",f=!e&&l.canvas==="infinite",v=e||this.getBounds(),y=(n-g-u)/v.dx,$=w?1:(r-c-d)/v.dy,I=B(Math.min(y,$),1/go,f?1:go),A=new p(n+g-u,r+c-d),M=w?new p(0,-c):v.center.subtract(A.scale(1/2/I)),P=new p(n/2,r/2);pt(j=>{let ne=yt("cubic",j),As=Math.exp(tt(Math.log(h),Math.log(I),ne)),sn=p.interpolate(a,M,ne).add(P.scale(tt(1/h,1/I,ne)-1/As));this.setViewport(sn,As)},i)}setZoom(e){let i=this.viewportBounds.center;this.setViewport(this.origin,this.zoom*e,i)}bindSource(e,i){let n=e.attr("tile");e.setAttr("tabindex",0),H.thumbnail(this,n,e);let r,o=i==null?void 0:i.$(".tiles");this.events.listen(e,{down:()=>this.trigger("add-tile-start"),start:({posn:a})=>{r=H.create(this,Object.assign({name:n},we(e.attr("props"),{}))),r.setTransform(a.subtract(r.center)),this.selection.add(r,!0),this.selection.moveStart(!0),i&&i.setAttr("viewBox",vo(this.viewportBounds)),(o||r.$container).append(r.$el),this.trigger("add-tile",{tile:r})},move:a=>this.selection.move(a,!0),end:a=>{r.$container.append(r.$el),this.selection.moveEnd(a,!0)},click:()=>{r=H.create(this,Object.assign({name:n},we(e.attr("props"),{}))),r.setTransform(this.center.subtract(r.center).shift(this.newTileShift*25)),this.selection.add(r,!0),r.moveEnd(),this.trigger("add-tile",{tile:r}),this.flushChanges(),this.newTileShift+=1}})}get center(){let[e,i,n,r]=this.margins;return this.viewportBounds.center.shift((r-i)/this.zoom/2,(e-n)/this.zoom/2)}setActiveTool(e,i){this.tools[this.state.tool].cancel(),this.warningBanner.hide(),this.selection.clear(),this.state.assign({tool:e,toolOptions:i}),i&&(this.tools[this.state.tool].options=i),this.setAttr("data-tool",e)}clear(e=!0){this.selection.clear();for(let i of this.tiles.values())i.delete();for(let i of this.strokes.values())i.delete();e&&this.setViewport(R,1),this.flushChanges()}thumbnail(e,i,n="jpg"){return D(this,null,function*(){return this.state.authorMode&&(this.state.authorMode=!1),yield this.$svg.image(n,e,i,vo(this.getThumbnailBounds(50)))})}downloadImage(e="png",i){var o;this.selection.clear();let n=i||((o=this.state.title)==null?void 0:o.replace(/\s+/g,"-").replace(/[^\w-]/g,"").toLowerCase())||"polypad",r=this.getBounds(50);this.$svg.downloadImage(`${n}.${e}`,r.dx,r.dy,vo(r))}paste(e,i,n=!0){this.selection.clear();let r=new Map;for(let l of Object.keys(e))r.set(l,We(10));let o=new Map,a=Object.entries(e).sort((l,c)=>(l[1].zIndex||0)-(c[1].zIndex||0)).map(([l,c])=>{var u,d,g;return c.name==="geo"&&Object.assign(c,Yt.copy(o,c,this.geoData)),c.name==="group"&&(c.children=(u=c.children)==null?void 0:u.split(",").map(w=>r.get(w)).join(",")),c.status=void 0,c.zIndex=void 0,c.cables=(d=c.cables)==null?void 0:d.map(w=>ft(ut({},w),{toTileId:r.get(w.toTileId)})),(c.name==="table"||c.name==="action-card")&&(c.links=(g=c.links)==null?void 0:g.split(",").map(w=>r.get(w)||w).join(",")),H.create(this,c,r.get(l))}).filter(Boolean);for(let l of a)l.delayedSetup();let h=Lt(...a.map(l=>l.transformed)).center;i===void 0&&(i=this.center.subtract(h).shift(this.newTileShift*25));for(let l of a)l.is("geo")?l.shift(i):l.setTransform(l.posn.add(i));this.newTileShift+=1,n&&(this.dropzoneManager.onMoveEnd(),this.flushChanges(),this.trigger("paste")),this.selection.select(a)}check(e){let i=!1;return new Promise(n=>{this.on("change",()=>{!i&&e(Array.from(this.tiles.values()))&&(i=!0,n())})})}flushChanges(){if(this.setup)return;this.trigger("change",{action:"change"});let e=new Map,i=this.options.getChanges();Object.keys(i[0]).length&&e.set("options",i),this.dropzoneManager.update(this.pendingChanges);for(let n of on(this.pendingChanges,this.pendingStrokes)){let r=n.flushChanges();r&&e.set(n.id,r)}this.pendingChanges.clear(),this.pendingStrokes.clear(),e.size&&(this.contentBounds=_i(this.tiles,this.strokes),!this.options.noUndoRedo&&(this.undoStack.push(e),this.undoStack.length>50&&this.undoStack.shift(),this.redoStack=[],this.state.canUndo=!0,this.state.canRedo=!1,this.state.changeCount+=1))}undo(){this.undoStack.length&&(this.applyChange(O(this.undoStack),!0),this.redoStack.push(this.undoStack.pop()),this.state.canUndo=!!this.undoStack.length,this.state.canRedo=!0,this.state.changeCount-=1,this.selection.update(),this.trigger("change",{action:"undo"}))}redo(){this.redoStack.length&&(this.applyChange(O(this.redoStack)),this.undoStack.push(this.redoStack.pop()),this.state.canUndo=!0,this.state.canRedo=!!this.redoStack.length,this.state.changeCount+=1,this.selection.update(),this.trigger("change",{action:"redo"}))}applyChange(e,i=!1){var r,o;let n=new Set;for(let[a,[h,l]]of e.entries()){if(i&&([h,l]=[l,h]),a==="options")this.options.assign(l),("canvas"in l||"canvasX"in l||"canvasY"in l)&&this.resetViewport(),"tileWeights"in l&&Th(this,l.tileWeights||"");else if(h)if(l){let c=this.tiles.get(a);c==null||c.applyChange(l),c&&n.add(c)}else if(Gd(h)){let c=this.tiles.get(a);c==null||c.delete(),c&&n.add(c)}else(r=this.strokes.get(a))==null||r.delete();else if(Gd(l)){let c=H.create(this,l,a);c.flushChanges(),n.add(c)}else He.create(this,l,a);this.contentBounds=_i(this.tiles,this.strokes)}for(let a of e.keys())(o=this.tiles.get(a))==null||o.delayedSetup();this.dropzoneManager.update(n),this.pendingChanges.clear(),this.pendingStrokes.clear(),this.options.getChanges()}serialize(e=5e3,i=2e3,n=16e3){var r;return{title:(r=this.state.title)==null?void 0:r.slice(0,30),version:2,tiles:Qa(this.tiles.values(),o=>o.props.copy(),e),strokes:Qa(this.strokes.values(),o=>o.serialize(n),i),options:this.options.copy()}}resetState(e=this.initial){this.load(e)}load(e){this.setup=!0,this.clear(!1),this.geoData.reset(),this.zIndex.clear(),this.dropzoneManager.clear(),this.initial=e,this.state.assign({title:e.title,canUndo:!1,canRedo:!1,changeCount:0,audioPlaying:0,authorMode:!1}),this.undoStack=this.redoStack=[],e.options||(e.options=Sh(!0)),e.options.grid||(e.options.grid="none"),e.options.canvas||(e.options.canvas="infinite"),e.options.algebraXSize||(e.options.algebraXSize=Yp),e.options.algebraYSize||(e.options.algebraYSize=Zp),e.options.pinActions||(e.options.pinActions="custom"),this.options.assign(e.options,!0),this.options.forceUpdate(),Th(this,e.options.tileWeights||"");for(let[i,n]of Object.entries(e.tiles||{}))H.create(this,n,i).flushChanges();for(let[i,n]of Object.entries(e.strokes||{}))He.create(this,n,i);for(let i of this.tiles.values())i.delayedSetup();this.snapping.updateIntersections(),this.contentBounds=_i(this.tiles,this.strokes),this.dropzoneManager.update(),this.resetViewport(),this.setActiveTool("move"),this.pendingChanges.clear(),this.pendingStrokes.clear(),this.options.getChanges(),this.setup=!1}};wo=T([S("x-polypad",{template:Ed})],wo);var zd=`
\${numberFormat(points)}
Points
\${min(time)}m \${time % 60}s
Time

Highscore
\${highscore[0].name.slice(0, 4)}\${numberFormat(highscore[0].score)}
\${highscore[1].name.slice(0, 4)}\${numberFormat(highscore[1].score)}
\${highscore[2].name.slice(0, 4)}\${numberFormat(highscore[2].score)}
\${highscore[3].name.slice(0, 4)}\${numberFormat(highscore[3].score)}
View more\u2026
Next blocks:
\${next[0]}
\${next[1]}
\${next[2]}
\${next[3]}
\${next[4]}

Discharge:
\${discardCounter}needed
Game over!
Paused
Highscore
\${highscore[0].name}\${numberFormat(highscore[0].score)}
\${highscore[1].name}\${numberFormat(highscore[1].score)}
\${highscore[2].name}\${numberFormat(highscore[2].score)}
\${highscore[3].name}\${numberFormat(highscore[3].score)}
\${highscore[4].name}\${numberFormat(highscore[4].score)}
\${highscore[5].name}\${numberFormat(highscore[5].score)}
\${highscore[6].name}\${numberFormat(highscore[6].score)}
\${highscore[7].name}\${numberFormat(highscore[7].score)}
\${highscore[8].name}\${numberFormat(highscore[8].score)}
\${highscore[9].name}\${numberFormat(highscore[9].score)}
\${highscore[10].name}\${numberFormat(highscore[10].score)}
Block size:
\${active[0] || '?' } = \${active[2]|| '?'} \xD7 \${active[1]|| '?'}
`;var Y0=1e3,Z=B(+Nl(location.search).size||16,8,24),Z0=5,gi=Math.ceil(Z/2),bo=Z+gi,xo=[];for(let s=2;s<=Z*1.5;s+=1){let t=_o(s);t&&s>.75*Z||s>Z&&Zh(s)[0]>Z/2||(t&&s>Z/2||s>1.25*Z?xo.push(s):xo.push(s,s))}var tn=()=>xo[_t.integer(xo.length)],Q0=oe(1,Z),J0=Z*10,Bd=z(s=>J0*2**s,Z),Mh=class{constructor(t,e,i){this.$el=m("rect",{width:20,height:20},i),this.setPosition(t,e)}setPosition(t,e){this.x=t,this.y=e,this.$el.setTransform({x:10+20*this.x,y:10+20*this.y})}go(t,e,i){this.setPosition(this.x+i-e,this.y+t)}canSet(t,e,i){return!i.find(n=>n.x===t&&n.y===e)}canGo(t,e,i,n){let r=this.x+i-e,o=this.y+t;return o>=bo||r<0||r>=Z?!1:this.canSet(r,o,n)}canGoDown(t){return this.canGo(1,0,0,t)}goDown(t=1){if(t!==0)return this.go(t,0,0)}},yo=class extends E{constructor(){super(...arguments);this.interval=void 0;this.tiles=[];this.activeTiles=[];this.activeSize=[0,0,0];this.activeFactors=[];this.isDown=!1;this.keyLock=!1;this.requestQueue=Promise.resolve("");this.highscore=!0}ready(){this.$svg=this.$(".factris-board"),this.$tiles=this.$svg.$(".tiles"),this.$shadow=this.$svg.$(".shadow"),this.attr("highscore")==="no"&&(this.highscore=!1);let e=this.$svg.$(".scores");this.$scores=Bd.map((i,n)=>{let r=m("g",{},e);return m("text",{text:"+"+i,class:`s${n+1}`},r),r}),this.bindModel(le({time:0,points:0,playing:!1,lost:!1,initial:!0,key:void 0,discardCounter:0,next:[],active:[],highscore:[],showHighscore:!1,min:i=>Math.floor(i/60),numberFormat:Rt,app:this}));for(let i of this.$$("button, .play"))i.on("contextmenu",n=>n.preventDefault());C.onKey("AllArrows",(i,n)=>{this.model.playing&&(i.preventDefault(),this.isDown=!0,this.model.key=n,this.keyPress(n))}),C.onKey("AllArrows",()=>{this.model.playing&&(this.isDown=this.keyLock=!1,this.model.key=void 0)},{up:!0}),this.setupSVG(),this.updateHighscore()}setupSVG(){this.$svg.setAttr("viewBox",`0 0 ${(Z+1)*20} ${(bo+1)*20}`);let e=this.$svg.$(".grid"),i=e.$(".faint-grid");for(let n=0;n<=Z;n+=1){let r=10+n*20,o=10+(gi+n)*20,a=!(n%4)||n===Z?e:i,h=!(n%2)||n===Z?"thick":"";m("line",{x1:10,y1:o,x2:10+Z*20,y2:o,class:h},a),m("line",{x1:r,y1:10+gi*20,x2:r,y2:bo*20+10,class:h},a)}}drawShadow(){this.activeTiles.length&&(this.$shadow.setAttr("x",10+20*this.activeSize[0]),this.$shadow.setAttr("y",10+20*this.activeSize[1]),this.$shadow.setAttr("width",20*this.activeSize[2]),this.$shadow.setAttr("height",20*(bo-this.activeSize[1])))}newRect(){let e=this.getNewTileSize();this.activeFactors=Q0.filter(r=>e%r===0);let i=this.activeFactors.pop(),n=Math.floor((Z-i)/2);this.activeTiles=z(r=>new Mh(n+r%i,Math.floor(r/i),this.$tiles),e),this.model.active=[e,i,e/i],this.activeSize=[n,e/i,i],this.drawShadow(),this.isDown&&(this.keyLock=!0)}reset(){this.pause(),this.model.time=0,this.model.points=0,this.model.discardCounter=0,this.model.showHighscore=!1,this.model.lost=!1,this.model.next=[tn(),tn(),tn(),tn()];for(let e of this.tiles)e.$el.remove();for(let e of this.activeTiles)e.$el.remove();this.tiles=[],this.newRect(),this.play(),this.requestQueue=Promise.resolve("")}toggle(){this.model.lost?this.reset():this.model.playing?this.pause():this.play()}pause(){this.model.playing=!1,clearInterval(this.interval)}play(){var e,i;if(this.model.showHighscore=!1,(e=window.ga)==null||e.call(window,"send","event","Factris","play"),(i=window.gtag)==null||i.call(window,"event","factris",{action:"play"}),this.model.initial||this.model.lost)return this.model.initial=!1,this.reset();this.model.playing=!0,this.interval=window.setInterval(()=>this.tick(),Y0)}getNewTileSize(){let e=Z*Z-this.tiles.length;if(this.model.next[0]>e)return e>Z?e-Z:Z;this.model.discardCounter>0&&(this.model.discardCounter-=1);let i=this.model.next[0];return this.model.next=[...this.model.next.slice(1),tn()],i}tick(){if(this.model.time+=1,this.activeTiles.every(o=>o.canGoDown(this.tiles))){for(let o of this.activeTiles)o.goDown();this.activeSize[1]+=1,this.drawShadow();return}this.tiles.push(...this.activeTiles);for(let o of this.activeTiles)o.$el.addClass("fixed");if(this.tiles.some(o=>o.y=6&&Mi(10,150*i.length/Z),this.removeRows(i);let n=this.model.points,r=(n+Z)%13+(n-Z)%87;this.requestQueue=this.requestQueue.then(o=>Ne("/factris-verify",{token:o,size:Z,score:n,check:r})),this.trigger("score",{points:n})}getFullRows(){return z(e=>this.tiles.filter(i=>i.y===e+gi),Z).filter(e=>e.length===Z)}removeRows(e){let i=ye(e);this.tiles=this.tiles.filter(o=>!i.includes(o)),this.$tiles.addClass("animated"),b.redraw();for(let o of i)o.$el.addClass("removing");let n=e.map(o=>o[0].y);for(let o of this.tiles)o.goDown(n.filter(a=>a>o.y).length);let r=400/e.length;for(let[o,a]of n.reverse().entries())this.$scores[o].setTransform({x:10+gi*20,y:27+a*20}),Zt(()=>this.$scores[o].addClass("visible"),o*r);return setTimeout(()=>{for(let o of this.$scores)o.removeClass("visible")},600),setTimeout(()=>{for(let o of i)o.$el.remove();this.$tiles.removeClass("animated"),this.newRect()},1e3),!1}gameOver(){this.model.lost=!0;for(let e of this.activeTiles)e.$el.addClass("error");this.pause(),this.requestQueue.then(e=>{e&&this.trigger("game-over",{token:e,points:this.model.points})})}discharge(){if(this.model.playing){for(let e of this.activeTiles)e.$el.remove();this.newRect(),this.model.discardCounter=Z0}}keyPress(e,i=!0){if(this.model.playing&&!this.keyLock){if(e==="ArrowUp"){if(!this.activeFactors.length)return;let n=this.activeFactors.pop(),r=this.activeSize[0]+Math.floor((this.activeSize[2]-n)/2),o=this.activeSize[1];if(this.activeTiles.some((l,c)=>!l.canSet(r+c%n,o-1-Math.floor(c/n),this.tiles)))return;for(let[l,c]of this.activeTiles.entries())c.setPosition(r+l%n,o-1-Math.floor(l/n));let h=this.model.active[0];this.model.active=[h,n,h/n],this.activeSize=[r,o,n]}else{let n=e==="ArrowDown"?1:0,r=e==="ArrowLeft"?1:0,o=e==="ArrowRight"?1:0;if(this.activeTiles.every(a=>a.canGo(n,r,o,this.tiles))){for(let a of this.activeTiles)a.go(n,r,o);this.activeSize[0]+=o-r,this.activeSize[1]+=n}i&&e==="ArrowDown"&&setTimeout(()=>this.keyPress("ArrowDown",!1),100)}this.drawShadow()}}showHighscore(){this.highscore&&(this.pause(),this.model.showHighscore=!0)}updateHighscore(){return D(this,null,function*(){if(!this.highscore)return;let e=yield fetch(`/factris-highscore?size=${Z}`);this.model.highscore=yield e.json()})}};yo=T([S("x-factris",{template:zd})],yo);var $o=class extends E{ready(){let t=Array.from(this._el.children);this.removeChildren();let e=m("svg",{class:"equation"},this),i=m("g",{transform:"translate(2 0)"},e),n=m("div",{class:"overlay"},this),r=parseFloat(this.css("font-size")),o=this.parents(".text-center").length||this.hasClass("display"),a=new Be(i,n,0,"",r,!!o);a.setValue(this.attr("expr")||t),this.css({width:a.root.width+4+"px",height:a.root.height+"px","vertical-align":`-${a.root.height-a.root.baseline}px`})}};$o=T([S("x-math")],$o);window.$=k;window.$$=Te;window.Browser=b;var Po=k("x-modal#privacy");Po&&Po.$("form").on("submit",s=>{s.preventDefault();let t=Po.$('input[name="newsletter"]');Ne("/settings/privacy",{policies:"on",newsletter:t.checked?"on":"off"}),Po.close()});var _d="";function Ah(){return fetch("/joke").then(s=>s.text()).then(s=>_d=s),_d}var Ch=k(".error-box");Ch&&Ch.on("click",()=>Ch.html=Ah());Ah();window.tellMeAJoke=function(){return Ah().replace(/

/g,"").replace(/<\/p>/g,` `).trim()};console.log(`%cWelcome to Mathigon! %cYou can see our source code at https://github.com/mathigon %cIf you want to contribute, visit https://mathigon.io -%cJust here for fun? Run tellMeAJoke()`,"color: #cd0e66; font-weight: bold; font-size: 18px;","color: #0f82f2; font-weight: bold;","color: #22ab24; font-weight: bold;","color: #fd8c00; font-weight: bold;");var qd=[38,38,40,40,37,39,37,39,66,65],tn=0;document.addEventListener("keydown",s=>{s.keyCode===qd[tn]?(tn+=1,tn===qd.length&&(Mi(),tn=0)):tn=0});})(); \ No newline at end of file +%cJust here for fun? Run tellMeAJoke()`,"color: #cd0e66; font-weight: bold; font-size: 18px;","color: #0f82f2; font-weight: bold;","color: #22ab24; font-weight: bold;","color: #fd8c00; font-weight: bold;");var Fd=[38,38,40,40,37,39,37,39,66,65],en=0;document.addEventListener("keydown",s=>{s.keyCode===Fd[en]?(en+=1,en===Fd.length&&(Mi(),en=0)):en=0});})(); \ No newline at end of file diff --git a/frontend/assets/icons.svg b/frontend/assets/icons.svg index 52c3da5e..2d24e8c1 100644 --- a/frontend/assets/icons.svg +++ b/frontend/assets/icons.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 844e92d0..5b14de53 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,12 +9,12 @@ "version": "0.7.4", "license": "UNLICENSED", "dependencies": { - "@mathigon/boost": "1.2.19", - "@mathigon/core": "1.1.14", - "@mathigon/euclid": "1.1.16", - "@mathigon/fermat": "1.1.13", - "@mathigon/hilbert": "1.1.13", - "@mathigon/studio": "0.1.40", + "@mathigon/boost": "1.2.20", + "@mathigon/core": "1.1.15", + "@mathigon/euclid": "1.1.17", + "@mathigon/fermat": "1.1.14", + "@mathigon/hilbert": "1.1.14", + "@mathigon/studio": "0.1.41", "@types/d3": "6.3.0", "@types/three": "0.91.14", "@types/topojson": "3.2.3", @@ -1180,10 +1180,25 @@ "node": ">=12" } }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.11.tgz", + "integrity": "sha512-FnzU0LyE3ySQk7UntJO4+qIiQgI7KoODnZg5xzXIrFJlKd2P2gwHsHY4927xj9y5PJmJSzULiUCWmv7iWnNa7g==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@esbuild/android-arm": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.8.tgz", - "integrity": "sha512-31E2lxlGM1KEfivQl8Yf5aYU/mflz9g06H6S15ITUFQueMFtFjESRMoDSkvMo8thYvLBax+VKTPlpnx+sPicOA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.11.tgz", + "integrity": "sha512-5OVapq0ClabvKvQ58Bws8+wkLCV+Rxg7tUVbo9xu034Nm536QTII4YzhaFriQ7rMrorfnFKUsArD2lqKbFY4vw==", "cpu": [ "arm" ], @@ -1196,9 +1211,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.8.tgz", - "integrity": "sha512-B8JbS61bEunhfx8kasogFENgQfr/dIp+ggYXwTqdbMAgGDhRa3AaPpQMuQU0rNxDLECj6FhDzk1cF9WHMVwrtA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.11.tgz", + "integrity": "sha512-aiu7K/5JnLj//KOnOfEZ0D90obUkRzDMyqd/wNAUQ34m4YUPVhRZpnqKV9uqDGxT7cToSDnIHsGooyIczu9T+Q==", "cpu": [ "arm64" ], @@ -1211,9 +1226,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.8.tgz", - "integrity": "sha512-rdqqYfRIn4jWOp+lzQttYMa2Xar3OK9Yt2fhOhzFXqg0rVWEfSclJvZq5fZslnz6ypHvVf3CT7qyf0A5pM682A==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.11.tgz", + "integrity": "sha512-eccxjlfGw43WYoY9QgB82SgGgDbibcqyDTlk3l3C0jOVHKxrjdc9CTwDUQd0vkvYg5um0OH+GpxYvp39r+IPOg==", "cpu": [ "x64" ], @@ -1226,9 +1241,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.8.tgz", - "integrity": "sha512-RQw9DemMbIq35Bprbboyf8SmOr4UXsRVxJ97LgB55VKKeJOOdvsIPy0nFyF2l8U+h4PtBx/1kRf0BelOYCiQcw==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.11.tgz", + "integrity": "sha512-ETp87DRWuSt9KdDVkqSoKoLFHYTrkyz2+65fj9nfXsaV3bMhTCjtQfw3y+um88vGRKRiF7erPrh/ZuIdLUIVxQ==", "cpu": [ "arm64" ], @@ -1241,9 +1256,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.8.tgz", - "integrity": "sha512-3sur80OT9YdeZwIVgERAysAbwncom7b4bCI2XKLjMfPymTud7e/oY4y+ci1XVp5TfQp/bppn7xLw1n/oSQY3/Q==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.11.tgz", + "integrity": "sha512-fkFUiS6IUK9WYUO/+22omwetaSNl5/A8giXvQlcinLIjVkxwTLSktbF5f/kJMftM2MJp9+fXqZ5ezS7+SALp4g==", "cpu": [ "x64" ], @@ -1256,9 +1271,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.8.tgz", - "integrity": "sha512-WAnPJSDattvS/XtPCTj1tPoTxERjcTpH6HsMr6ujTT+X6rylVe8ggxk8pVxzf5U1wh5sPODpawNicF5ta/9Tmw==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.11.tgz", + "integrity": "sha512-lhoSp5K6bxKRNdXUtHoNc5HhbXVCS8V0iZmDvyWvYq9S5WSfTIHU2UGjcGt7UeS6iEYp9eeymIl5mJBn0yiuxA==", "cpu": [ "arm64" ], @@ -1271,9 +1286,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.8.tgz", - "integrity": "sha512-ICvZyOplIjmmhjd6mxi+zxSdpPTKFfyPPQMQTK/w+8eNK6WV01AjIztJALDtwNNfFhfZLux0tZLC+U9nSyA5Zg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.11.tgz", + "integrity": "sha512-JkUqn44AffGXitVI6/AbQdoYAq0TEullFdqcMY/PCUZ36xJ9ZJRtQabzMA+Vi7r78+25ZIBosLTOKnUXBSi1Kw==", "cpu": [ "x64" ], @@ -1286,9 +1301,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.8.tgz", - "integrity": "sha512-H4vmI5PYqSvosPaTJuEppU9oz1dq2A7Mr2vyg5TF9Ga+3+MGgBdGzcyBP7qK9MrwFQZlvNyJrvz6GuCaj3OukQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.11.tgz", + "integrity": "sha512-3CRkr9+vCV2XJbjwgzjPtO8T0SZUmRZla+UL1jw+XqHZPkPgZiyWvbDvl9rqAN8Zl7qJF0O/9ycMtjU67HN9/Q==", "cpu": [ "arm" ], @@ -1301,9 +1316,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.8.tgz", - "integrity": "sha512-z1zMZivxDLHWnyGOctT9JP70h0beY54xDDDJt4VpTX+iwA77IFsE1vCXWmprajJGa+ZYSqkSbRQ4eyLCpCmiCQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.11.tgz", + "integrity": "sha512-LneLg3ypEeveBSMuoa0kwMpCGmpu8XQUh+mL8XXwoYZ6Be2qBnVtcDI5azSvh7vioMDhoJFZzp9GWp9IWpYoUg==", "cpu": [ "arm64" ], @@ -1316,9 +1331,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.8.tgz", - "integrity": "sha512-1a8suQiFJmZz1khm/rDglOc8lavtzEMRo0v6WhPgxkrjcU0LkHj+TwBrALwoz/OtMExvsqbbMI0ChyelKabSvQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.11.tgz", + "integrity": "sha512-caHy++CsD8Bgq2V5CodbJjFPEiDPq8JJmBdeyZ8GWVQMjRD0sU548nNdwPNvKjVpamYYVL40AORekgfIubwHoA==", "cpu": [ "ia32" ], @@ -1331,9 +1346,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.8.tgz", - "integrity": "sha512-fHZWS2JJxnXt1uYJsDv9+b60WCc2RlvVAy1F76qOLtXRO+H4mjt3Tr6MJ5l7Q78X8KgCFudnTuiQRBhULUyBKQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.11.tgz", + "integrity": "sha512-ppZSSLVpPrwHccvC6nQVZaSHlFsvCQyjnvirnVjbKSHuE5N24Yl8F3UwYUUR1UEPaFObGD2tSvVKbvR+uT1Nrg==", "cpu": [ "loong64" ], @@ -1346,9 +1361,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.8.tgz", - "integrity": "sha512-Wy/z0EL5qZYLX66dVnEg9riiwls5IYnziwuju2oUiuxVc+/edvqXa04qNtbrs0Ukatg5HEzqT94Zs7J207dN5Q==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.11.tgz", + "integrity": "sha512-B5x9j0OgjG+v1dF2DkH34lr+7Gmv0kzX6/V0afF41FkPMMqaQ77pH7CrhWeR22aEeHKaeZVtZ6yFwlxOKPVFyg==", "cpu": [ "mips64el" ], @@ -1361,9 +1376,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.8.tgz", - "integrity": "sha512-ETaW6245wK23YIEufhMQ3HSeHO7NgsLx8gygBVldRHKhOlD1oNeNy/P67mIh1zPn2Hr2HLieQrt6tWrVwuqrxg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.11.tgz", + "integrity": "sha512-MHrZYLeCG8vXblMetWyttkdVRjQlQUb/oMgBNurVEnhj4YWOr4G5lmBfZjHYQHHN0g6yDmCAQRR8MUHldvvRDA==", "cpu": [ "ppc64" ], @@ -1376,9 +1391,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.8.tgz", - "integrity": "sha512-T2DRQk55SgoleTP+DtPlMrxi/5r9AeFgkhkZ/B0ap99zmxtxdOixOMI570VjdRCs9pE4Wdkz7JYrsPvsl7eESg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.11.tgz", + "integrity": "sha512-f3DY++t94uVg141dozDu4CCUkYW+09rWtaWfnb3bqe4w5NqmZd6nPVBm+qbz7WaHZCoqXqHz5p6CM6qv3qnSSQ==", "cpu": [ "riscv64" ], @@ -1391,9 +1406,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.8.tgz", - "integrity": "sha512-NPxbdmmo3Bk7mbNeHmcCd7R7fptJaczPYBaELk6NcXxy7HLNyWwCyDJ/Xx+/YcNH7Im5dHdx9gZ5xIwyliQCbg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.11.tgz", + "integrity": "sha512-A5xdUoyWJHMMlcSMcPGVLzYzpcY8QP1RtYzX5/bS4dvjBGVxdhuiYyFwp7z74ocV7WDc0n1harxmpq2ePOjI0Q==", "cpu": [ "s390x" ], @@ -1406,9 +1421,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.8.tgz", - "integrity": "sha512-lytMAVOM3b1gPypL2TRmZ5rnXl7+6IIk8uB3eLsV1JwcizuolblXRrc5ShPrO9ls/b+RTp+E6gbsuLWHWi2zGg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.11.tgz", + "integrity": "sha512-grbyMlVCvJSfxFQUndw5mCtWs5LO1gUlwP4CDi4iJBbVpZcqLVT29FxgGuBJGSzyOxotFG4LoO5X+M1350zmPA==", "cpu": [ "x64" ], @@ -1421,9 +1436,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.8.tgz", - "integrity": "sha512-hvWVo2VsXz/8NVt1UhLzxwAfo5sioj92uo0bCfLibB0xlOmimU/DeAEsQILlBQvkhrGjamP0/el5HU76HAitGw==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.11.tgz", + "integrity": "sha512-13jvrQZJc3P230OhU8xgwUnDeuC/9egsjTkXN49b3GcS5BKvJqZn86aGM8W9pd14Kd+u7HuFBMVtrNGhh6fHEQ==", "cpu": [ "x64" ], @@ -1436,9 +1451,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.8.tgz", - "integrity": "sha512-/7Y7u77rdvmGTxR83PgaSvSBJCC2L3Kb1M/+dmSIvRvQPXXCuC97QAwMugBNG0yGcbEGfFBH7ojPzAOxfGNkwQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.11.tgz", + "integrity": "sha512-ysyOGZuTp6SNKPE11INDUeFVVQFrhcNDVUgSQVDzqsqX38DjhPEPATpid04LCoUr2WXhQTEZ8ct/EgJCUDpyNw==", "cpu": [ "x64" ], @@ -1451,9 +1466,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.8.tgz", - "integrity": "sha512-9Lc4s7Oi98GqFA4HzA/W2JHIYfnXbUYgekUP/Sm4BG9sfLjyv6GKKHKKVs83SMicBF2JwAX6A1PuOLMqpD001w==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.11.tgz", + "integrity": "sha512-Hf+Sad9nVwvtxy4DXCZQqLpgmRTQqyFyhT3bZ4F2XlJCjxGmRFF0Shwn9rzhOYRB61w9VMXUkxlBy56dk9JJiQ==", "cpu": [ "x64" ], @@ -1466,9 +1481,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.8.tgz", - "integrity": "sha512-rq6WzBGjSzihI9deW3fC2Gqiak68+b7qo5/3kmB6Gvbh/NYPA0sJhrnp7wgV4bNwjqM+R2AApXGxMO7ZoGhIJg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.11.tgz", + "integrity": "sha512-0P58Sbi0LctOMOQbpEOvOL44Ne0sqbS0XWHMvvrg6NE5jQ1xguCSSw9jQeUk2lfrXYsKDdOe6K+oZiwKPilYPQ==", "cpu": [ "arm64" ], @@ -1481,9 +1496,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.8.tgz", - "integrity": "sha512-AIAbverbg5jMvJznYiGhrd3sumfwWs8572mIJL5NQjJa06P8KfCPWZQ0NwZbPQnbQi9OWSZhFVSUWjjIrn4hSw==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.11.tgz", + "integrity": "sha512-6YOrWS+sDJDmshdBIQU+Uoyh7pQKrdykdefC1avn76ss5c+RN6gut3LZA4E2cH5xUEp5/cA0+YxRaVtRAb0xBg==", "cpu": [ "ia32" ], @@ -1496,9 +1511,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.8.tgz", - "integrity": "sha512-bfZ0cQ1uZs2PqpulNL5j/3w+GDhP36k1K5c38QdQg+Swy51jFZWWeIkteNsufkQxp986wnqRRsb/bHbY1WQ7TA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.11.tgz", + "integrity": "sha512-vfkhltrjCAb603XaFhqhAF4LGDi2M4OrCRrFusyQ+iTLQ/o60QQXxc9cZC/FFpihBI9N1Grn6SMKVJ4KP7Fuiw==", "cpu": [ "x64" ], @@ -1834,81 +1849,81 @@ } }, "node_modules/@mathigon/boost": { - "version": "1.2.19", - "resolved": "https://registry.npmjs.org/@mathigon/boost/-/boost-1.2.19.tgz", - "integrity": "sha512-IzlXgaTJT2CUoAjGndGqI8ULkuUIDc4Q6MBbn7aEmQTk+TjZPHyLdHjRfOhgxEKuLNkbPyHBSvrPaeZ7Eh0MXw==", + "version": "1.2.20", + "resolved": "https://registry.npmjs.org/@mathigon/boost/-/boost-1.2.20.tgz", + "integrity": "sha512-8PNCOjoNpSiNg6cfdDKWa0ekgW2QRX1tZgRB98/yMiDhmokNdu5SGsiSAI0VSZ0fZugw/s8xefK0RIDNWcJvDA==", "dependencies": { - "@mathigon/core": "1.1.14", - "@mathigon/euclid": "1.1.16", - "@mathigon/fermat": "1.1.13" + "@mathigon/core": "1.1.15", + "@mathigon/euclid": "1.1.17", + "@mathigon/fermat": "1.1.14" }, "engines": { "node": ">=16" } }, "node_modules/@mathigon/core": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/@mathigon/core/-/core-1.1.14.tgz", - "integrity": "sha512-x5y8TlR48xi9jMiceoWLEIdH9yCpJRs4MgabRdaDY6F+UY7rrNihyITsdoCsQYF/pQaIkYFtbTeTsnnRX9m3hQ==", + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/@mathigon/core/-/core-1.1.15.tgz", + "integrity": "sha512-94FtnUxyP1ozvGIhGiHDqZYTunCqKaBKWRNCJyDuDFfoLVdz5ct7LnM9HvtxSdBks/gb1J8YuDNT6AXCsBUX7g==", "engines": { "node": ">=16" } }, "node_modules/@mathigon/euclid": { - "version": "1.1.16", - "resolved": "https://registry.npmjs.org/@mathigon/euclid/-/euclid-1.1.16.tgz", - "integrity": "sha512-UqhLsR3n+RLhVmETtaScd5tP86BflhVHmnc132DHtDW5dX+03OTGoL5HlVaE9i+kS3iL5L5IXcALq0pOsF2y/A==", + "version": "1.1.17", + "resolved": "https://registry.npmjs.org/@mathigon/euclid/-/euclid-1.1.17.tgz", + "integrity": "sha512-/cIDYS3iChTCWTnlJHolR6sDxKGPebkXc+mwdx0RnFn+JI3DykT4O9WYzBp5PHRVL6tKgE13KaBTzWcNU3Hnkw==", "dependencies": { - "@mathigon/core": "1.1.14", - "@mathigon/fermat": "1.1.13" + "@mathigon/core": "1.1.15", + "@mathigon/fermat": "1.1.14" }, "engines": { "node": ">=16" } }, "node_modules/@mathigon/fermat": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/@mathigon/fermat/-/fermat-1.1.13.tgz", - "integrity": "sha512-YjQBI+3cgrgD7OaRqOnqk3tffK4zIwHRj1f8oyuYU0rf07UbVa1h6ZFlimqI2FV1N7fDqMkOyx3osQUhPSBYEQ==", + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/@mathigon/fermat/-/fermat-1.1.14.tgz", + "integrity": "sha512-oYy9XPaSIMbaddqsmVU9JXJnxGVc8MySyYWEPllnTPd229Bc/eomKpZTAhmsvC1fKRCbvPk49V+MFfhIpoea4Q==", "dependencies": { - "@mathigon/core": "1.1.14" + "@mathigon/core": "1.1.15" }, "engines": { "node": ">=16" } }, "node_modules/@mathigon/hilbert": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/@mathigon/hilbert/-/hilbert-1.1.13.tgz", - "integrity": "sha512-iEpWUNmYC+MGeqxINwT+BB8pd2VdDmkTRGYzG5MnlfvkrH3w9eamJIvxCAgmF9BprZEazYPqenWcXSAVKCeekg==", + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/@mathigon/hilbert/-/hilbert-1.1.14.tgz", + "integrity": "sha512-hH7jD6cwnWs3qAR1Ng3wAfPsUJEN0eA1BF720tbB7kmzmwIquuYaHl3jWVsuGtIAKMBZzfDP4NOYQYs2UvEReQ==", "dependencies": { - "@mathigon/core": "1.1.14", - "@mathigon/fermat": "1.1.13" + "@mathigon/core": "1.1.15", + "@mathigon/fermat": "1.1.14" }, "engines": { "node": ">=16" } }, "node_modules/@mathigon/studio": { - "version": "0.1.40", - "resolved": "https://registry.npmjs.org/@mathigon/studio/-/studio-0.1.40.tgz", - "integrity": "sha512-xGJxJLr7XinS1cdY3HxGEpLwn8vET4vT4LtVV0Wmrs6rf4pMJwm2osmMlIrIEK3Jno2zDIk0niGHKHpJj3W1bQ==", - "dependencies": { - "@mathigon/boost": "1.2.19", - "@mathigon/core": "1.1.14", - "@mathigon/euclid": "1.1.16", - "@mathigon/fermat": "1.1.13", - "@mathigon/hilbert": "1.1.13", - "@sendgrid/mail": "7.7.0", + "version": "0.1.41", + "resolved": "https://registry.npmjs.org/@mathigon/studio/-/studio-0.1.41.tgz", + "integrity": "sha512-SjnkTPVpTWzhLMuy+KNVmxihGVXsKDz7AAg+TG2FJP81SjeX3qUI91KroS4XGjvWceMrpTOGbrGycCBQBNpD3g==", + "dependencies": { + "@mathigon/boost": "1.2.20", + "@mathigon/core": "1.1.15", + "@mathigon/euclid": "1.1.17", + "@mathigon/fermat": "1.1.14", + "@mathigon/hilbert": "1.1.14", + "@sendgrid/mail": "8.0.0", "@types/bcryptjs": "2.4.6", "@types/compression": "1.7.5", "@types/cookie-parser": "1.4.6", "@types/express": "4.17.21", "@types/express-flash": "0.0.5", "@types/express-session": "1.17.10", - "@types/js-yaml": "4.0.5", + "@types/js-yaml": "4.0.9", "@types/lusca": "1.7.4", - "@types/node-fetch": "2.6.4", + "@types/node-fetch": "2.6.11", "@types/pug": "2.0.10", "@types/validator": "13.11.7", "@webcomponents/custom-elements": "1.6.0", @@ -1920,9 +1935,9 @@ "compression": "1.7.4", "connect-mongo": "4.6.0", "cookie-parser": "1.4.6", - "cssnano": "6.0.1", + "cssnano": "6.0.3", "date-fns": "2.30.0", - "esbuild": "0.19.8", + "esbuild": "0.19.11", "express": "4.18.2", "express-flash": "0.0.2", "express-session": "1.17.3", @@ -1937,13 +1952,13 @@ "mongodb-memory-server": "8.15.1", "mongoose": "7.4.3", "node-fetch": "2.6.9", - "postcss": "8.4.31", + "postcss": "8.4.33", "postcss-inline-svg": "6.0.0", "pug": "3.0.2", "rtlcss": "4.1.1", - "sass": "1.69.5", + "sass": "1.69.7", "tslib": "2.6.2", - "typescript": "5.1.6", + "typescript": "5.3.3", "validator": "13.11.0", "web-animations-js": "2.3.2", "xss": "1.0.14", @@ -2060,18 +2075,6 @@ "node": ">= 0.8" } }, - "node_modules/@mathigon/studio/node_modules/typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, "node_modules/@mongodb-js/saslprep": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.0.tgz", @@ -2237,38 +2240,38 @@ } }, "node_modules/@sendgrid/client": { - "version": "7.7.0", - "resolved": "https://registry.npmjs.org/@sendgrid/client/-/client-7.7.0.tgz", - "integrity": "sha512-SxH+y8jeAQSnDavrTD0uGDXYIIkFylCo+eDofVmZLQ0f862nnqbC3Vd1ej6b7Le7lboyzQF6F7Fodv02rYspuA==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@sendgrid/client/-/client-8.1.0.tgz", + "integrity": "sha512-Kp2kKLr307v/HnR3uGuySt0AbCkeG7naDVOzfPOtWvKHVZIEHmKidQjJjzytVZNYWtoRdYgNfBw6GyUznGqa6w==", "dependencies": { - "@sendgrid/helpers": "^7.7.0", - "axios": "^0.26.0" + "@sendgrid/helpers": "^8.0.0", + "axios": "^1.6.0" }, "engines": { - "node": "6.* || 8.* || >=10.*" + "node": ">=12.*" } }, "node_modules/@sendgrid/helpers": { - "version": "7.7.0", - "resolved": "https://registry.npmjs.org/@sendgrid/helpers/-/helpers-7.7.0.tgz", - "integrity": "sha512-3AsAxfN3GDBcXoZ/y1mzAAbKzTtUZ5+ZrHOmWQ279AuaFXUNCh9bPnRpN504bgveTqoW+11IzPg3I0WVgDINpw==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@sendgrid/helpers/-/helpers-8.0.0.tgz", + "integrity": "sha512-Ze7WuW2Xzy5GT5WRx+yEv89fsg/pgy3T1E3FS0QEx0/VvRmigMZ5qyVGhJz4SxomegDkzXv/i0aFPpHKN8qdAA==", "dependencies": { "deepmerge": "^4.2.2" }, "engines": { - "node": ">= 6.0.0" + "node": ">= 12.0.0" } }, "node_modules/@sendgrid/mail": { - "version": "7.7.0", - "resolved": "https://registry.npmjs.org/@sendgrid/mail/-/mail-7.7.0.tgz", - "integrity": "sha512-5+nApPE9wINBvHSUxwOxkkQqM/IAAaBYoP9hw7WwgDNQPxraruVqHizeTitVtKGiqWCKm2mnjh4XGN3fvFLqaw==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@sendgrid/mail/-/mail-8.0.0.tgz", + "integrity": "sha512-ePir+LT6kzJ7yaWAFuo8R+N9Pjm3KQMV5NpJ9XuTaLwwuXrUBiPzFo953Qc7slsYf7AKhMurF4w+ta4v1nsJ7A==", "dependencies": { - "@sendgrid/client": "^7.7.0", - "@sendgrid/helpers": "^7.7.0" + "@sendgrid/client": "^8.0.0", + "@sendgrid/helpers": "^8.0.0" }, "engines": { - "node": "6.* || 8.* || >=10.*" + "node": ">=12.*" } }, "node_modules/@tootallnate/once": { @@ -2637,9 +2640,9 @@ "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==" }, "node_modules/@types/js-yaml": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.5.tgz", - "integrity": "sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==" + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.9.tgz", + "integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==" }, "node_modules/@types/json-schema": { "version": "7.0.15", @@ -2706,12 +2709,12 @@ "integrity": "sha512-zyxJM8I1c9q5sRMtVF+zdd13Jt6RU4r4qfhTd7lQubyThvLfx6yYekWSQjGCGV2Tkecgxnlpl/DNlb6Hg+dmEw==" }, "node_modules/@types/node-fetch": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.4.tgz", - "integrity": "sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg==", + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.11.tgz", + "integrity": "sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==", "dependencies": { "@types/node": "*", - "form-data": "^3.0.0" + "form-data": "^4.0.0" } }, "node_modules/@types/pug": { @@ -3568,11 +3571,13 @@ } }, "node_modules/axios": { - "version": "0.26.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", - "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.5.tgz", + "integrity": "sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==", "dependencies": { - "follow-redirects": "^1.14.8" + "follow-redirects": "^1.15.4", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" } }, "node_modules/b4a": { @@ -3736,9 +3741,9 @@ } }, "node_modules/browserslist": { - "version": "4.21.10", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.10.tgz", - "integrity": "sha512-bipEBdZfVH5/pwrvqc+Ub0kUPVfGUhlKxbvfD+z1BDnPEO/X98ruXGA1WP5ASpAFKan7Qr6j736IacbZQuAlKQ==", + "version": "4.22.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.2.tgz", + "integrity": "sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==", "funding": [ { "type": "opencollective", @@ -3754,10 +3759,10 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001517", - "electron-to-chromium": "^1.4.477", - "node-releases": "^2.0.13", - "update-browserslist-db": "^1.0.11" + "caniuse-lite": "^1.0.30001565", + "electron-to-chromium": "^1.4.601", + "node-releases": "^2.0.14", + "update-browserslist-db": "^1.0.13" }, "bin": { "browserslist": "cli.js" @@ -3883,9 +3888,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001554", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001554.tgz", - "integrity": "sha512-A2E3U//MBwbJVzebddm1YfNp7Nud5Ip+IPn4BozBmn4KqVX7AvluoIDFWjsv5OkGnKUXQVmMSoMKLa3ScCblcQ==", + "version": "1.0.30001578", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001578.tgz", + "integrity": "sha512-J/jkFgsQ3NEl4w2lCoM9ZPxrD+FoBNJ7uJUpGVjIg/j0OwJosWM36EPDv+Yyi0V4twBk9pPmlFS+PLykgEvUmg==", "funding": [ { "type": "opencollective", @@ -4336,11 +4341,11 @@ } }, "node_modules/css-declaration-sorter": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-6.4.0.tgz", - "integrity": "sha512-jDfsatwWMWN0MODAFuHszfjphEXfNw9JUAhmY4pLu3TyTU+ohUpsbVtbU+1MZn4a47D9kqh03i4eyOm+74+zew==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-7.1.1.tgz", + "integrity": "sha512-dZ3bVTEEc1vxr3Bek9vGwfB5Z6ESPULhcRvO472mfjVnj8jRcTnKO8/JTczlvxM10Myb+wBM++1MtdO76eWcaQ==", "engines": { - "node": "^10 || ^12 || >=14" + "node": "^14 || ^16 || >=18" }, "peerDependencies": { "postcss": "^8.0.9" @@ -4401,12 +4406,12 @@ "integrity": "sha512-FAaLDaplstoRsDR8XGYH51znUN0UY7nMc6Z9/fvE8EXGwvJE9hu7W2vHwx1+bd6gCYnln9nLbzxFTrcO9YQDZw==" }, "node_modules/cssnano": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-6.0.1.tgz", - "integrity": "sha512-fVO1JdJ0LSdIGJq68eIxOqFpIJrZqXUsBt8fkrBcztCQqAjQD51OhZp7tc0ImcbwXD4k7ny84QTV90nZhmqbkg==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-6.0.3.tgz", + "integrity": "sha512-MRq4CIj8pnyZpcI2qs6wswoYoDD1t0aL28n+41c1Ukcpm56m1h6mCexIHBGjfZfnTqtGSSCP4/fB1ovxgjBOiw==", "dependencies": { - "cssnano-preset-default": "^6.0.1", - "lilconfig": "^2.1.0" + "cssnano-preset-default": "^6.0.3", + "lilconfig": "^3.0.0" }, "engines": { "node": "^14 || ^16 || >=18.0" @@ -4416,60 +4421,60 @@ "url": "https://opencollective.com/cssnano" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/cssnano-preset-default": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-6.0.1.tgz", - "integrity": "sha512-7VzyFZ5zEB1+l1nToKyrRkuaJIx0zi/1npjvZfbBwbtNTzhLtlvYraK/7/uqmX2Wb2aQtd983uuGw79jAjLSuQ==", - "dependencies": { - "css-declaration-sorter": "^6.3.1", - "cssnano-utils": "^4.0.0", - "postcss-calc": "^9.0.0", - "postcss-colormin": "^6.0.0", - "postcss-convert-values": "^6.0.0", - "postcss-discard-comments": "^6.0.0", - "postcss-discard-duplicates": "^6.0.0", - "postcss-discard-empty": "^6.0.0", - "postcss-discard-overridden": "^6.0.0", - "postcss-merge-longhand": "^6.0.0", - "postcss-merge-rules": "^6.0.1", - "postcss-minify-font-values": "^6.0.0", - "postcss-minify-gradients": "^6.0.0", - "postcss-minify-params": "^6.0.0", - "postcss-minify-selectors": "^6.0.0", - "postcss-normalize-charset": "^6.0.0", - "postcss-normalize-display-values": "^6.0.0", - "postcss-normalize-positions": "^6.0.0", - "postcss-normalize-repeat-style": "^6.0.0", - "postcss-normalize-string": "^6.0.0", - "postcss-normalize-timing-functions": "^6.0.0", - "postcss-normalize-unicode": "^6.0.0", - "postcss-normalize-url": "^6.0.0", - "postcss-normalize-whitespace": "^6.0.0", - "postcss-ordered-values": "^6.0.0", - "postcss-reduce-initial": "^6.0.0", - "postcss-reduce-transforms": "^6.0.0", - "postcss-svgo": "^6.0.0", - "postcss-unique-selectors": "^6.0.0" + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-6.0.3.tgz", + "integrity": "sha512-4y3H370aZCkT9Ev8P4SO4bZbt+AExeKhh8wTbms/X7OLDo5E7AYUUy6YPxa/uF5Grf+AJwNcCnxKhZynJ6luBA==", + "dependencies": { + "css-declaration-sorter": "^7.1.1", + "cssnano-utils": "^4.0.1", + "postcss-calc": "^9.0.1", + "postcss-colormin": "^6.0.2", + "postcss-convert-values": "^6.0.2", + "postcss-discard-comments": "^6.0.1", + "postcss-discard-duplicates": "^6.0.1", + "postcss-discard-empty": "^6.0.1", + "postcss-discard-overridden": "^6.0.1", + "postcss-merge-longhand": "^6.0.2", + "postcss-merge-rules": "^6.0.3", + "postcss-minify-font-values": "^6.0.1", + "postcss-minify-gradients": "^6.0.1", + "postcss-minify-params": "^6.0.2", + "postcss-minify-selectors": "^6.0.2", + "postcss-normalize-charset": "^6.0.1", + "postcss-normalize-display-values": "^6.0.1", + "postcss-normalize-positions": "^6.0.1", + "postcss-normalize-repeat-style": "^6.0.1", + "postcss-normalize-string": "^6.0.1", + "postcss-normalize-timing-functions": "^6.0.1", + "postcss-normalize-unicode": "^6.0.2", + "postcss-normalize-url": "^6.0.1", + "postcss-normalize-whitespace": "^6.0.1", + "postcss-ordered-values": "^6.0.1", + "postcss-reduce-initial": "^6.0.2", + "postcss-reduce-transforms": "^6.0.1", + "postcss-svgo": "^6.0.2", + "postcss-unique-selectors": "^6.0.2" }, "engines": { "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/cssnano-utils": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/cssnano-utils/-/cssnano-utils-4.0.0.tgz", - "integrity": "sha512-Z39TLP+1E0KUcd7LGyF4qMfu8ZufI0rDzhdyAMsa/8UyNUU8wpS0fhdBxbQbv32r64ea00h4878gommRVg2BHw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/cssnano-utils/-/cssnano-utils-4.0.1.tgz", + "integrity": "sha512-6qQuYDqsGoiXssZ3zct6dcMxiqfT6epy7x4R0TQJadd4LWO3sPR6JH6ZByOvVLoZ6EdwPGgd7+DR1EmX3tiXQQ==", "engines": { "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/csso": { @@ -4610,9 +4615,9 @@ "devOptional": true }, "node_modules/deepmerge": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", - "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", "engines": { "node": ">=0.10.0" } @@ -4858,9 +4863,9 @@ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, "node_modules/electron-to-chromium": { - "version": "1.4.496", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.496.tgz", - "integrity": "sha512-qeXC3Zbykq44RCrBa4kr8v/dWzYJA8rAwpyh9Qd+NKWoJfjG5vvJqy9XOJ9H4P/lqulZBCgUWAYi+FeK5AuJ8g==" + "version": "1.4.635", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.635.tgz", + "integrity": "sha512-iu/2D0zolKU3iDGXXxdOzNf72Jnokn+K1IN6Kk4iV6l1Tr2g/qy+mvmtfAiBwZe5S3aB5r92vp+zSZ69scYRrg==" }, "node_modules/emoji-regex": { "version": "8.0.0", @@ -4999,9 +5004,9 @@ } }, "node_modules/esbuild": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.8.tgz", - "integrity": "sha512-l7iffQpT2OrZfH2rXIp7/FkmaeZM0vxbxN9KfiCwGYuZqzMg/JdvX26R31Zxn/Pxvsrg3Y9N6XTcnknqDyyv4w==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.11.tgz", + "integrity": "sha512-HJ96Hev2hX/6i5cDVwcqiJBBtuo9+FeIJOtZ9W1kA5M6AMJRHUZlpYZ1/SbEwtO0ioNAW8rUooVpC/WehY2SfA==", "hasInstallScript": true, "bin": { "esbuild": "bin/esbuild" @@ -5010,28 +5015,29 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/android-arm": "0.19.8", - "@esbuild/android-arm64": "0.19.8", - "@esbuild/android-x64": "0.19.8", - "@esbuild/darwin-arm64": "0.19.8", - "@esbuild/darwin-x64": "0.19.8", - "@esbuild/freebsd-arm64": "0.19.8", - "@esbuild/freebsd-x64": "0.19.8", - "@esbuild/linux-arm": "0.19.8", - "@esbuild/linux-arm64": "0.19.8", - "@esbuild/linux-ia32": "0.19.8", - "@esbuild/linux-loong64": "0.19.8", - "@esbuild/linux-mips64el": "0.19.8", - "@esbuild/linux-ppc64": "0.19.8", - "@esbuild/linux-riscv64": "0.19.8", - "@esbuild/linux-s390x": "0.19.8", - "@esbuild/linux-x64": "0.19.8", - "@esbuild/netbsd-x64": "0.19.8", - "@esbuild/openbsd-x64": "0.19.8", - "@esbuild/sunos-x64": "0.19.8", - "@esbuild/win32-arm64": "0.19.8", - "@esbuild/win32-ia32": "0.19.8", - "@esbuild/win32-x64": "0.19.8" + "@esbuild/aix-ppc64": "0.19.11", + "@esbuild/android-arm": "0.19.11", + "@esbuild/android-arm64": "0.19.11", + "@esbuild/android-x64": "0.19.11", + "@esbuild/darwin-arm64": "0.19.11", + "@esbuild/darwin-x64": "0.19.11", + "@esbuild/freebsd-arm64": "0.19.11", + "@esbuild/freebsd-x64": "0.19.11", + "@esbuild/linux-arm": "0.19.11", + "@esbuild/linux-arm64": "0.19.11", + "@esbuild/linux-ia32": "0.19.11", + "@esbuild/linux-loong64": "0.19.11", + "@esbuild/linux-mips64el": "0.19.11", + "@esbuild/linux-ppc64": "0.19.11", + "@esbuild/linux-riscv64": "0.19.11", + "@esbuild/linux-s390x": "0.19.11", + "@esbuild/linux-x64": "0.19.11", + "@esbuild/netbsd-x64": "0.19.11", + "@esbuild/openbsd-x64": "0.19.11", + "@esbuild/sunos-x64": "0.19.11", + "@esbuild/win32-arm64": "0.19.11", + "@esbuild/win32-ia32": "0.19.11", + "@esbuild/win32-x64": "0.19.11" } }, "node_modules/escalade": { @@ -5989,9 +5995,9 @@ } }, "node_modules/form-data": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -7231,19 +7237,6 @@ } } }, - "node_modules/jsdom/node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/jsdom/node_modules/tr46": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz", @@ -7421,11 +7414,11 @@ } }, "node_modules/lilconfig": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", - "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.0.0.tgz", + "integrity": "sha512-K2U4W2Ff5ibV7j7ydLr+zLAkIg5JJ4lPn1Ltsdt+Tz/IjQ8buJ55pZAxoP34lqIiwtF9iAvtLv3JGv7CAyAg+g==", "engines": { - "node": ">=10" + "node": ">=14" } }, "node_modules/lines-and-columns": { @@ -7944,9 +7937,9 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "node_modules/nanoid": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", - "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", "funding": [ { "type": "github", @@ -8055,9 +8048,9 @@ } }, "node_modules/node-releases": { - "version": "2.0.13", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", - "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==" + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", + "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==" }, "node_modules/nopt": { "version": "4.0.3", @@ -8706,9 +8699,9 @@ } }, "node_modules/postcss": { - "version": "8.4.31", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", - "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", + "version": "8.4.33", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.33.tgz", + "integrity": "sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg==", "funding": [ { "type": "opencollective", @@ -8724,7 +8717,7 @@ } ], "dependencies": { - "nanoid": "^3.3.6", + "nanoid": "^3.3.7", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" }, @@ -8748,11 +8741,11 @@ } }, "node_modules/postcss-colormin": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-6.0.0.tgz", - "integrity": "sha512-EuO+bAUmutWoZYgHn2T1dG1pPqHU6L4TjzPlu4t1wZGXQ/fxV16xg2EJmYi0z+6r+MGV1yvpx1BHkUaRrPa2bw==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-6.0.2.tgz", + "integrity": "sha512-TXKOxs9LWcdYo5cgmcSHPkyrLAh86hX1ijmyy6J8SbOhyv6ua053M3ZAM/0j44UsnQNIWdl8gb5L7xX2htKeLw==", "dependencies": { - "browserslist": "^4.21.4", + "browserslist": "^4.22.2", "caniuse-api": "^3.0.0", "colord": "^2.9.1", "postcss-value-parser": "^4.2.0" @@ -8761,66 +8754,66 @@ "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-convert-values": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-6.0.0.tgz", - "integrity": "sha512-U5D8QhVwqT++ecmy8rnTb+RL9n/B806UVaS3m60lqle4YDFcpbS3ae5bTQIh3wOGUSDHSEtMYLs/38dNG7EYFw==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-6.0.2.tgz", + "integrity": "sha512-aeBmaTnGQ+NUSVQT8aY0sKyAD/BaLJenEKZ03YK0JnDE1w1Rr8XShoxdal2V2H26xTJKr3v5haByOhJuyT4UYw==", "dependencies": { - "browserslist": "^4.21.4", + "browserslist": "^4.22.2", "postcss-value-parser": "^4.2.0" }, "engines": { "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-discard-comments": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-6.0.0.tgz", - "integrity": "sha512-p2skSGqzPMZkEQvJsgnkBhCn8gI7NzRH2683EEjrIkoMiwRELx68yoUJ3q3DGSGuQ8Ug9Gsn+OuDr46yfO+eFw==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-6.0.1.tgz", + "integrity": "sha512-f1KYNPtqYLUeZGCHQPKzzFtsHaRuECe6jLakf/RjSRqvF5XHLZnM2+fXLhb8Qh/HBFHs3M4cSLb1k3B899RYIg==", "engines": { "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-discard-duplicates": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-6.0.0.tgz", - "integrity": "sha512-bU1SXIizMLtDW4oSsi5C/xHKbhLlhek/0/yCnoMQany9k3nPBq+Ctsv/9oMmyqbR96HYHxZcHyK2HR5P/mqoGA==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-6.0.1.tgz", + "integrity": "sha512-1hvUs76HLYR8zkScbwyJ8oJEugfPV+WchpnA+26fpJ7Smzs51CzGBHC32RS03psuX/2l0l0UKh2StzNxOrKCYg==", "engines": { "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-discard-empty": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-6.0.0.tgz", - "integrity": "sha512-b+h1S1VT6dNhpcg+LpyiUrdnEZfICF0my7HAKgJixJLW7BnNmpRH34+uw/etf5AhOlIhIAuXApSzzDzMI9K/gQ==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-6.0.1.tgz", + "integrity": "sha512-yitcmKwmVWtNsrrRqGJ7/C0YRy53i0mjexBDQ9zYxDwTWVBgbU4+C9jIZLmQlTDT9zhml+u0OMFJh8+31krmOg==", "engines": { "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-discard-overridden": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-6.0.0.tgz", - "integrity": "sha512-4VELwssYXDFigPYAZ8vL4yX4mUepF/oCBeeIT4OXsJPYOtvJumyz9WflmJWTfDwCUcpDR+z0zvCWBXgTx35SVw==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-6.0.1.tgz", + "integrity": "sha512-qs0ehZMMZpSESbRkw1+inkf51kak6OOzNRaoLd/U7Fatp0aN2HQ1rxGOrJvYcRAN9VpX8kUF13R2ofn8OlvFVA==", "engines": { "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-inline-svg": { @@ -8838,41 +8831,41 @@ } }, "node_modules/postcss-merge-longhand": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-6.0.0.tgz", - "integrity": "sha512-4VSfd1lvGkLTLYcxFuISDtWUfFS4zXe0FpF149AyziftPFQIWxjvFSKhA4MIxMe4XM3yTDgQMbSNgzIVxChbIg==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-6.0.2.tgz", + "integrity": "sha512-+yfVB7gEM8SrCo9w2lCApKIEzrTKl5yS1F4yGhV3kSim6JzbfLGJyhR1B6X+6vOT0U33Mgx7iv4X9MVWuaSAfw==", "dependencies": { "postcss-value-parser": "^4.2.0", - "stylehacks": "^6.0.0" + "stylehacks": "^6.0.2" }, "engines": { "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-merge-rules": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-6.0.1.tgz", - "integrity": "sha512-a4tlmJIQo9SCjcfiCcCMg/ZCEe0XTkl/xK0XHBs955GWg9xDX3NwP9pwZ78QUOWB8/0XCjZeJn98Dae0zg6AAw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-6.0.3.tgz", + "integrity": "sha512-yfkDqSHGohy8sGYIJwBmIGDv4K4/WrJPX355XrxQb/CSsT4Kc/RxDi6akqn5s9bap85AWgv21ArcUWwWdGNSHA==", "dependencies": { - "browserslist": "^4.21.4", + "browserslist": "^4.22.2", "caniuse-api": "^3.0.0", - "cssnano-utils": "^4.0.0", - "postcss-selector-parser": "^6.0.5" + "cssnano-utils": "^4.0.1", + "postcss-selector-parser": "^6.0.15" }, "engines": { "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-minify-font-values": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-6.0.0.tgz", - "integrity": "sha512-zNRAVtyh5E8ndZEYXA4WS8ZYsAp798HiIQ1V2UF/C/munLp2r1UGHwf1+6JFu7hdEhJFN+W1WJQKBrtjhFgEnA==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-6.0.1.tgz", + "integrity": "sha512-tIwmF1zUPoN6xOtA/2FgVk1ZKrLcCvE0dpZLtzyyte0j9zUeB8RTbCqrHZGjJlxOvNWKMYtunLrrl7HPOiR46w==", "dependencies": { "postcss-value-parser": "^4.2.0" }, @@ -8880,70 +8873,70 @@ "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-minify-gradients": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-6.0.0.tgz", - "integrity": "sha512-wO0F6YfVAR+K1xVxF53ueZJza3L+R3E6cp0VwuXJQejnNUH0DjcAFe3JEBeTY1dLwGa0NlDWueCA1VlEfiKgAA==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-6.0.1.tgz", + "integrity": "sha512-M1RJWVjd6IOLPl1hYiOd5HQHgpp6cvJVLrieQYS9y07Yo8itAr6jaekzJphaJFR0tcg4kRewCk3kna9uHBxn/w==", "dependencies": { "colord": "^2.9.1", - "cssnano-utils": "^4.0.0", + "cssnano-utils": "^4.0.1", "postcss-value-parser": "^4.2.0" }, "engines": { "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-minify-params": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-6.0.0.tgz", - "integrity": "sha512-Fz/wMQDveiS0n5JPcvsMeyNXOIMrwF88n7196puSuQSWSa+/Ofc1gDOSY2xi8+A4PqB5dlYCKk/WfqKqsI+ReQ==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-6.0.2.tgz", + "integrity": "sha512-zwQtbrPEBDj+ApELZ6QylLf2/c5zmASoOuA4DzolyVGdV38iR2I5QRMsZcHkcdkZzxpN8RS4cN7LPskOkTwTZw==", "dependencies": { - "browserslist": "^4.21.4", - "cssnano-utils": "^4.0.0", + "browserslist": "^4.22.2", + "cssnano-utils": "^4.0.1", "postcss-value-parser": "^4.2.0" }, "engines": { "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-minify-selectors": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-6.0.0.tgz", - "integrity": "sha512-ec/q9JNCOC2CRDNnypipGfOhbYPuUkewGwLnbv6omue/PSASbHSU7s6uSQ0tcFRVv731oMIx8k0SP4ZX6be/0g==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-6.0.2.tgz", + "integrity": "sha512-0b+m+w7OAvZejPQdN2GjsXLv5o0jqYHX3aoV0e7RBKPCsB7TYG5KKWBFhGnB/iP3213Ts8c5H4wLPLMm7z28Sg==", "dependencies": { - "postcss-selector-parser": "^6.0.5" + "postcss-selector-parser": "^6.0.15" }, "engines": { "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-charset": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-6.0.0.tgz", - "integrity": "sha512-cqundwChbu8yO/gSWkuFDmKrCZ2vJzDAocheT2JTd0sFNA4HMGoKMfbk2B+J0OmO0t5GUkiAkSM5yF2rSLUjgQ==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-6.0.1.tgz", + "integrity": "sha512-aW5LbMNRZ+oDV57PF9K+WI1Z8MPnF+A8qbajg/T8PP126YrGX1f9IQx21GI2OlGz7XFJi/fNi0GTbY948XJtXg==", "engines": { "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-display-values": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-display-values/-/postcss-normalize-display-values-6.0.0.tgz", - "integrity": "sha512-Qyt5kMrvy7dJRO3OjF7zkotGfuYALETZE+4lk66sziWSPzlBEt7FrUshV6VLECkI4EN8Z863O6Nci4NXQGNzYw==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-display-values/-/postcss-normalize-display-values-6.0.1.tgz", + "integrity": "sha512-mc3vxp2bEuCb4LgCcmG1y6lKJu1Co8T+rKHrcbShJwUmKJiEl761qb/QQCfFwlrvSeET3jksolCR/RZuMURudw==", "dependencies": { "postcss-value-parser": "^4.2.0" }, @@ -8951,13 +8944,13 @@ "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-positions": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-positions/-/postcss-normalize-positions-6.0.0.tgz", - "integrity": "sha512-mPCzhSV8+30FZyWhxi6UoVRYd3ZBJgTRly4hOkaSifo0H+pjDYcii/aVT4YE6QpOil15a5uiv6ftnY3rm0igPg==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-positions/-/postcss-normalize-positions-6.0.1.tgz", + "integrity": "sha512-HRsq8u/0unKNvm0cvwxcOUEcakFXqZ41fv3FOdPn916XFUrympjr+03oaLkuZENz3HE9RrQE9yU0Xv43ThWjQg==", "dependencies": { "postcss-value-parser": "^4.2.0" }, @@ -8965,13 +8958,13 @@ "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-repeat-style": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-6.0.0.tgz", - "integrity": "sha512-50W5JWEBiOOAez2AKBh4kRFm2uhrT3O1Uwdxz7k24aKtbD83vqmcVG7zoIwo6xI2FZ/HDlbrCopXhLeTpQib1A==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-6.0.1.tgz", + "integrity": "sha512-Gbb2nmCy6tTiA7Sh2MBs3fj9W8swonk6lw+dFFeQT68B0Pzwp1kvisJQkdV6rbbMSd9brMlS8I8ts52tAGWmGQ==", "dependencies": { "postcss-value-parser": "^4.2.0" }, @@ -8979,13 +8972,13 @@ "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-string": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-string/-/postcss-normalize-string-6.0.0.tgz", - "integrity": "sha512-KWkIB7TrPOiqb8ZZz6homet2KWKJwIlysF5ICPZrXAylGe2hzX/HSf4NTX2rRPJMAtlRsj/yfkrWGavFuB+c0w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-string/-/postcss-normalize-string-6.0.1.tgz", + "integrity": "sha512-5Fhx/+xzALJD9EI26Aq23hXwmv97Zfy2VFrt5PLT8lAhnBIZvmaT5pQk+NuJ/GWj/QWaKSKbnoKDGLbV6qnhXg==", "dependencies": { "postcss-value-parser": "^4.2.0" }, @@ -8993,13 +8986,13 @@ "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-timing-functions": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-6.0.0.tgz", - "integrity": "sha512-tpIXWciXBp5CiFs8sem90IWlw76FV4oi6QEWfQwyeREVwUy39VSeSqjAT7X0Qw650yAimYW5gkl2Gd871N5SQg==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-6.0.1.tgz", + "integrity": "sha512-4zcczzHqmCU7L5dqTB9rzeqPWRMc0K2HoR+Bfl+FSMbqGBUcP5LRfgcH4BdRtLuzVQK1/FHdFoGT3F7rkEnY+g==", "dependencies": { "postcss-value-parser": "^4.2.0" }, @@ -9007,28 +9000,28 @@ "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-unicode": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-6.0.0.tgz", - "integrity": "sha512-ui5crYkb5ubEUDugDc786L/Me+DXp2dLg3fVJbqyAl0VPkAeALyAijF2zOsnZyaS1HyfPuMH0DwyY18VMFVNkg==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-6.0.2.tgz", + "integrity": "sha512-Ff2VdAYCTGyMUwpevTZPZ4w0+mPjbZzLLyoLh/RMpqUqeQKZ+xMm31hkxBavDcGKcxm6ACzGk0nBfZ8LZkStKA==", "dependencies": { - "browserslist": "^4.21.4", + "browserslist": "^4.22.2", "postcss-value-parser": "^4.2.0" }, "engines": { "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-url": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-6.0.0.tgz", - "integrity": "sha512-98mvh2QzIPbb02YDIrYvAg4OUzGH7s1ZgHlD3fIdTHLgPLRpv1ZTKJDnSAKr4Rt21ZQFzwhGMXxpXlfrUBKFHw==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-6.0.1.tgz", + "integrity": "sha512-jEXL15tXSvbjm0yzUV7FBiEXwhIa9H88JOXDGQzmcWoB4mSjZIsmtto066s2iW9FYuIrIF4k04HA2BKAOpbsaQ==", "dependencies": { "postcss-value-parser": "^4.2.0" }, @@ -9036,13 +9029,13 @@ "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-normalize-whitespace": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-whitespace/-/postcss-normalize-whitespace-6.0.0.tgz", - "integrity": "sha512-7cfE1AyLiK0+ZBG6FmLziJzqQCpTQY+8XjMhMAz8WSBSCsCNNUKujgIgjCAmDT3cJ+3zjTXFkoD15ZPsckArVw==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-whitespace/-/postcss-normalize-whitespace-6.0.1.tgz", + "integrity": "sha512-76i3NpWf6bB8UHlVuLRxG4zW2YykF9CTEcq/9LGAiz2qBuX5cBStadkk0jSkg9a9TCIXbMQz7yzrygKoCW9JuA==", "dependencies": { "postcss-value-parser": "^4.2.0" }, @@ -9050,43 +9043,43 @@ "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-ordered-values": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-ordered-values/-/postcss-ordered-values-6.0.0.tgz", - "integrity": "sha512-K36XzUDpvfG/nWkjs6d1hRBydeIxGpKS2+n+ywlKPzx1nMYDYpoGbcjhj5AwVYJK1qV2/SDoDEnHzlPD6s3nMg==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-ordered-values/-/postcss-ordered-values-6.0.1.tgz", + "integrity": "sha512-XXbb1O/MW9HdEhnBxitZpPFbIvDgbo9NK4c/5bOfiKpnIGZDoL2xd7/e6jW5DYLsWxBbs+1nZEnVgnjnlFViaA==", "dependencies": { - "cssnano-utils": "^4.0.0", + "cssnano-utils": "^4.0.1", "postcss-value-parser": "^4.2.0" }, "engines": { "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-reduce-initial": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-6.0.0.tgz", - "integrity": "sha512-s2UOnidpVuXu6JiiI5U+fV2jamAw5YNA9Fdi/GRK0zLDLCfXmSGqQtzpUPtfN66RtCbb9fFHoyZdQaxOB3WxVA==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-6.0.2.tgz", + "integrity": "sha512-YGKalhNlCLcjcLvjU5nF8FyeCTkCO5UtvJEt0hrPZVCTtRLSOH4z00T1UntQPj4dUmIYZgMj8qK77JbSX95hSw==", "dependencies": { - "browserslist": "^4.21.4", + "browserslist": "^4.22.2", "caniuse-api": "^3.0.0" }, "engines": { "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-reduce-transforms": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-6.0.0.tgz", - "integrity": "sha512-FQ9f6xM1homnuy1wLe9lP1wujzxnwt1EwiigtWwuyf8FsqqXUDUp2Ulxf9A5yjlUOTdCJO6lonYjg1mgqIIi2w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-6.0.1.tgz", + "integrity": "sha512-fUbV81OkUe75JM+VYO1gr/IoA2b/dRiH6HvMwhrIBSUrxq3jNZQZitSnugcTLDi1KkQh1eR/zi+iyxviUNBkcQ==", "dependencies": { "postcss-value-parser": "^4.2.0" }, @@ -9094,13 +9087,13 @@ "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-selector-parser": { - "version": "6.0.13", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.13.tgz", - "integrity": "sha512-EaV1Gl4mUEV4ddhDnv/xtj7sxwrwxdetHdWUGnT4VJQf+4d05v6lHYZr8N573k5Z0BViss7BDhfWtKS3+sfAqQ==", + "version": "6.0.15", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.15.tgz", + "integrity": "sha512-rEYkQOMUCEMhsKbK66tbEU9QVIxbhN18YiniAwA7XQYTVBqrBy+P2p5JcdqsHgKM2zWylp8d7J6eszocfds5Sw==", "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" @@ -9110,32 +9103,32 @@ } }, "node_modules/postcss-svgo": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-6.0.0.tgz", - "integrity": "sha512-r9zvj/wGAoAIodn84dR/kFqwhINp5YsJkLoujybWG59grR/IHx+uQ2Zo+IcOwM0jskfYX3R0mo+1Kip1VSNcvw==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-6.0.2.tgz", + "integrity": "sha512-IH5R9SjkTkh0kfFOQDImyy1+mTCb+E830+9SV1O+AaDcoHTvfsvt6WwJeo7KwcHbFnevZVCsXhDmjFiGVuwqFQ==", "dependencies": { "postcss-value-parser": "^4.2.0", - "svgo": "^3.0.2" + "svgo": "^3.2.0" }, "engines": { "node": "^14 || ^16 || >= 18" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-unique-selectors": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-6.0.0.tgz", - "integrity": "sha512-EPQzpZNxOxP7777t73RQpZE5e9TrnCrkvp7AH7a0l89JmZiPnS82y216JowHXwpBCQitfyxrof9TK3rYbi7/Yw==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-6.0.2.tgz", + "integrity": "sha512-8IZGQ94nechdG7Y9Sh9FlIY2b4uS8/k8kdKRX040XHsS3B6d1HrJAkXrBSsSu4SuARruSsUjW3nlSw8BHkaAYQ==", "dependencies": { - "postcss-selector-parser": "^6.0.5" + "postcss-selector-parser": "^6.0.15" }, "engines": { "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/postcss-value-parser": { @@ -9459,8 +9452,7 @@ "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "optional": true + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" }, "node_modules/psl": { "version": "1.9.0", @@ -10049,9 +10041,9 @@ } }, "node_modules/sass": { - "version": "1.69.5", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.69.5.tgz", - "integrity": "sha512-qg2+UCJibLr2LCVOt3OlPhr/dqVHWOa9XtZf2OjbLs/T4VPSJ00udtgJxH3neXZm+QqX8B+3cU7RaLqp1iVfcQ==", + "version": "1.69.7", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.69.7.tgz", + "integrity": "sha512-rzj2soDeZ8wtE2egyLXgOOHQvaC2iosZrkF6v3EUG+tBwEvhqUCzm0VP3k9gHF9LXbSrRhT5SksoI56Iw8NPnQ==", "dependencies": { "chokidar": ">=3.0.0 <4.0.0", "immutable": "^4.0.0", @@ -10544,18 +10536,18 @@ "optional": true }, "node_modules/stylehacks": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-6.0.0.tgz", - "integrity": "sha512-+UT589qhHPwz6mTlCLSt/vMNTJx8dopeJlZAlBMJPWA3ORqu6wmQY7FBXf+qD+FsqoBJODyqNxOUP3jdntFRdw==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-6.0.2.tgz", + "integrity": "sha512-00zvJGnCu64EpMjX8b5iCZ3us2Ptyw8+toEkb92VdmkEaRaSGBNKAoK6aWZckhXxmQP8zWiTaFaiMGIU8Ve8sg==", "dependencies": { - "browserslist": "^4.21.4", - "postcss-selector-parser": "^6.0.4" + "browserslist": "^4.22.2", + "postcss-selector-parser": "^6.0.15" }, "engines": { "node": "^14 || ^16 || >=18.0" }, "peerDependencies": { - "postcss": "^8.2.15" + "postcss": "^8.4.31" } }, "node_modules/supports-color": { @@ -10578,14 +10570,15 @@ } }, "node_modules/svgo": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-3.0.2.tgz", - "integrity": "sha512-Z706C1U2pb1+JGP48fbazf3KxHrWOsLme6Rv7imFBn5EnuanDW1GPaA/P1/dvObE670JDePC3mnj0k0B7P0jjQ==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/svgo/-/svgo-3.2.0.tgz", + "integrity": "sha512-4PP6CMW/V7l/GmKRKzsLR8xxjdHTV4IMvhTnpuHwwBazSIlw5W/5SmPjN8Dwyt7lKbSJrRDgp4t9ph0HgChFBQ==", "dependencies": { "@trysound/sax": "0.2.0", "commander": "^7.2.0", "css-select": "^5.1.0", - "css-tree": "^2.2.1", + "css-tree": "^2.3.1", + "css-what": "^6.1.0", "csso": "^5.0.5", "picocolors": "^1.0.0" }, @@ -11039,9 +11032,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", - "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", + "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", "funding": [ { "type": "opencollective", @@ -12526,136 +12519,142 @@ "@jridgewell/trace-mapping": "0.3.9" } }, + "@esbuild/aix-ppc64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.11.tgz", + "integrity": "sha512-FnzU0LyE3ySQk7UntJO4+qIiQgI7KoODnZg5xzXIrFJlKd2P2gwHsHY4927xj9y5PJmJSzULiUCWmv7iWnNa7g==", + "optional": true + }, "@esbuild/android-arm": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.8.tgz", - "integrity": "sha512-31E2lxlGM1KEfivQl8Yf5aYU/mflz9g06H6S15ITUFQueMFtFjESRMoDSkvMo8thYvLBax+VKTPlpnx+sPicOA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.11.tgz", + "integrity": "sha512-5OVapq0ClabvKvQ58Bws8+wkLCV+Rxg7tUVbo9xu034Nm536QTII4YzhaFriQ7rMrorfnFKUsArD2lqKbFY4vw==", "optional": true }, "@esbuild/android-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.8.tgz", - "integrity": "sha512-B8JbS61bEunhfx8kasogFENgQfr/dIp+ggYXwTqdbMAgGDhRa3AaPpQMuQU0rNxDLECj6FhDzk1cF9WHMVwrtA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.11.tgz", + "integrity": "sha512-aiu7K/5JnLj//KOnOfEZ0D90obUkRzDMyqd/wNAUQ34m4YUPVhRZpnqKV9uqDGxT7cToSDnIHsGooyIczu9T+Q==", "optional": true }, "@esbuild/android-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.8.tgz", - "integrity": "sha512-rdqqYfRIn4jWOp+lzQttYMa2Xar3OK9Yt2fhOhzFXqg0rVWEfSclJvZq5fZslnz6ypHvVf3CT7qyf0A5pM682A==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.11.tgz", + "integrity": "sha512-eccxjlfGw43WYoY9QgB82SgGgDbibcqyDTlk3l3C0jOVHKxrjdc9CTwDUQd0vkvYg5um0OH+GpxYvp39r+IPOg==", "optional": true }, "@esbuild/darwin-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.8.tgz", - "integrity": "sha512-RQw9DemMbIq35Bprbboyf8SmOr4UXsRVxJ97LgB55VKKeJOOdvsIPy0nFyF2l8U+h4PtBx/1kRf0BelOYCiQcw==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.11.tgz", + "integrity": "sha512-ETp87DRWuSt9KdDVkqSoKoLFHYTrkyz2+65fj9nfXsaV3bMhTCjtQfw3y+um88vGRKRiF7erPrh/ZuIdLUIVxQ==", "optional": true }, "@esbuild/darwin-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.8.tgz", - "integrity": "sha512-3sur80OT9YdeZwIVgERAysAbwncom7b4bCI2XKLjMfPymTud7e/oY4y+ci1XVp5TfQp/bppn7xLw1n/oSQY3/Q==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.11.tgz", + "integrity": "sha512-fkFUiS6IUK9WYUO/+22omwetaSNl5/A8giXvQlcinLIjVkxwTLSktbF5f/kJMftM2MJp9+fXqZ5ezS7+SALp4g==", "optional": true }, "@esbuild/freebsd-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.8.tgz", - "integrity": "sha512-WAnPJSDattvS/XtPCTj1tPoTxERjcTpH6HsMr6ujTT+X6rylVe8ggxk8pVxzf5U1wh5sPODpawNicF5ta/9Tmw==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.11.tgz", + "integrity": "sha512-lhoSp5K6bxKRNdXUtHoNc5HhbXVCS8V0iZmDvyWvYq9S5WSfTIHU2UGjcGt7UeS6iEYp9eeymIl5mJBn0yiuxA==", "optional": true }, "@esbuild/freebsd-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.8.tgz", - "integrity": "sha512-ICvZyOplIjmmhjd6mxi+zxSdpPTKFfyPPQMQTK/w+8eNK6WV01AjIztJALDtwNNfFhfZLux0tZLC+U9nSyA5Zg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.11.tgz", + "integrity": "sha512-JkUqn44AffGXitVI6/AbQdoYAq0TEullFdqcMY/PCUZ36xJ9ZJRtQabzMA+Vi7r78+25ZIBosLTOKnUXBSi1Kw==", "optional": true }, "@esbuild/linux-arm": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.8.tgz", - "integrity": "sha512-H4vmI5PYqSvosPaTJuEppU9oz1dq2A7Mr2vyg5TF9Ga+3+MGgBdGzcyBP7qK9MrwFQZlvNyJrvz6GuCaj3OukQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.11.tgz", + "integrity": "sha512-3CRkr9+vCV2XJbjwgzjPtO8T0SZUmRZla+UL1jw+XqHZPkPgZiyWvbDvl9rqAN8Zl7qJF0O/9ycMtjU67HN9/Q==", "optional": true }, "@esbuild/linux-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.8.tgz", - "integrity": "sha512-z1zMZivxDLHWnyGOctT9JP70h0beY54xDDDJt4VpTX+iwA77IFsE1vCXWmprajJGa+ZYSqkSbRQ4eyLCpCmiCQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.11.tgz", + "integrity": "sha512-LneLg3ypEeveBSMuoa0kwMpCGmpu8XQUh+mL8XXwoYZ6Be2qBnVtcDI5azSvh7vioMDhoJFZzp9GWp9IWpYoUg==", "optional": true }, "@esbuild/linux-ia32": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.8.tgz", - "integrity": "sha512-1a8suQiFJmZz1khm/rDglOc8lavtzEMRo0v6WhPgxkrjcU0LkHj+TwBrALwoz/OtMExvsqbbMI0ChyelKabSvQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.11.tgz", + "integrity": "sha512-caHy++CsD8Bgq2V5CodbJjFPEiDPq8JJmBdeyZ8GWVQMjRD0sU548nNdwPNvKjVpamYYVL40AORekgfIubwHoA==", "optional": true }, "@esbuild/linux-loong64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.8.tgz", - "integrity": "sha512-fHZWS2JJxnXt1uYJsDv9+b60WCc2RlvVAy1F76qOLtXRO+H4mjt3Tr6MJ5l7Q78X8KgCFudnTuiQRBhULUyBKQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.11.tgz", + "integrity": "sha512-ppZSSLVpPrwHccvC6nQVZaSHlFsvCQyjnvirnVjbKSHuE5N24Yl8F3UwYUUR1UEPaFObGD2tSvVKbvR+uT1Nrg==", "optional": true }, "@esbuild/linux-mips64el": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.8.tgz", - "integrity": "sha512-Wy/z0EL5qZYLX66dVnEg9riiwls5IYnziwuju2oUiuxVc+/edvqXa04qNtbrs0Ukatg5HEzqT94Zs7J207dN5Q==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.11.tgz", + "integrity": "sha512-B5x9j0OgjG+v1dF2DkH34lr+7Gmv0kzX6/V0afF41FkPMMqaQ77pH7CrhWeR22aEeHKaeZVtZ6yFwlxOKPVFyg==", "optional": true }, "@esbuild/linux-ppc64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.8.tgz", - "integrity": "sha512-ETaW6245wK23YIEufhMQ3HSeHO7NgsLx8gygBVldRHKhOlD1oNeNy/P67mIh1zPn2Hr2HLieQrt6tWrVwuqrxg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.11.tgz", + "integrity": "sha512-MHrZYLeCG8vXblMetWyttkdVRjQlQUb/oMgBNurVEnhj4YWOr4G5lmBfZjHYQHHN0g6yDmCAQRR8MUHldvvRDA==", "optional": true }, "@esbuild/linux-riscv64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.8.tgz", - "integrity": "sha512-T2DRQk55SgoleTP+DtPlMrxi/5r9AeFgkhkZ/B0ap99zmxtxdOixOMI570VjdRCs9pE4Wdkz7JYrsPvsl7eESg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.11.tgz", + "integrity": "sha512-f3DY++t94uVg141dozDu4CCUkYW+09rWtaWfnb3bqe4w5NqmZd6nPVBm+qbz7WaHZCoqXqHz5p6CM6qv3qnSSQ==", "optional": true }, "@esbuild/linux-s390x": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.8.tgz", - "integrity": "sha512-NPxbdmmo3Bk7mbNeHmcCd7R7fptJaczPYBaELk6NcXxy7HLNyWwCyDJ/Xx+/YcNH7Im5dHdx9gZ5xIwyliQCbg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.11.tgz", + "integrity": "sha512-A5xdUoyWJHMMlcSMcPGVLzYzpcY8QP1RtYzX5/bS4dvjBGVxdhuiYyFwp7z74ocV7WDc0n1harxmpq2ePOjI0Q==", "optional": true }, "@esbuild/linux-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.8.tgz", - "integrity": "sha512-lytMAVOM3b1gPypL2TRmZ5rnXl7+6IIk8uB3eLsV1JwcizuolblXRrc5ShPrO9ls/b+RTp+E6gbsuLWHWi2zGg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.11.tgz", + "integrity": "sha512-grbyMlVCvJSfxFQUndw5mCtWs5LO1gUlwP4CDi4iJBbVpZcqLVT29FxgGuBJGSzyOxotFG4LoO5X+M1350zmPA==", "optional": true }, "@esbuild/netbsd-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.8.tgz", - "integrity": "sha512-hvWVo2VsXz/8NVt1UhLzxwAfo5sioj92uo0bCfLibB0xlOmimU/DeAEsQILlBQvkhrGjamP0/el5HU76HAitGw==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.11.tgz", + "integrity": "sha512-13jvrQZJc3P230OhU8xgwUnDeuC/9egsjTkXN49b3GcS5BKvJqZn86aGM8W9pd14Kd+u7HuFBMVtrNGhh6fHEQ==", "optional": true }, "@esbuild/openbsd-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.8.tgz", - "integrity": "sha512-/7Y7u77rdvmGTxR83PgaSvSBJCC2L3Kb1M/+dmSIvRvQPXXCuC97QAwMugBNG0yGcbEGfFBH7ojPzAOxfGNkwQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.11.tgz", + "integrity": "sha512-ysyOGZuTp6SNKPE11INDUeFVVQFrhcNDVUgSQVDzqsqX38DjhPEPATpid04LCoUr2WXhQTEZ8ct/EgJCUDpyNw==", "optional": true }, "@esbuild/sunos-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.8.tgz", - "integrity": "sha512-9Lc4s7Oi98GqFA4HzA/W2JHIYfnXbUYgekUP/Sm4BG9sfLjyv6GKKHKKVs83SMicBF2JwAX6A1PuOLMqpD001w==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.11.tgz", + "integrity": "sha512-Hf+Sad9nVwvtxy4DXCZQqLpgmRTQqyFyhT3bZ4F2XlJCjxGmRFF0Shwn9rzhOYRB61w9VMXUkxlBy56dk9JJiQ==", "optional": true }, "@esbuild/win32-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.8.tgz", - "integrity": "sha512-rq6WzBGjSzihI9deW3fC2Gqiak68+b7qo5/3kmB6Gvbh/NYPA0sJhrnp7wgV4bNwjqM+R2AApXGxMO7ZoGhIJg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.11.tgz", + "integrity": "sha512-0P58Sbi0LctOMOQbpEOvOL44Ne0sqbS0XWHMvvrg6NE5jQ1xguCSSw9jQeUk2lfrXYsKDdOe6K+oZiwKPilYPQ==", "optional": true }, "@esbuild/win32-ia32": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.8.tgz", - "integrity": "sha512-AIAbverbg5jMvJznYiGhrd3sumfwWs8572mIJL5NQjJa06P8KfCPWZQ0NwZbPQnbQi9OWSZhFVSUWjjIrn4hSw==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.11.tgz", + "integrity": "sha512-6YOrWS+sDJDmshdBIQU+Uoyh7pQKrdykdefC1avn76ss5c+RN6gut3LZA4E2cH5xUEp5/cA0+YxRaVtRAb0xBg==", "optional": true }, "@esbuild/win32-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.8.tgz", - "integrity": "sha512-bfZ0cQ1uZs2PqpulNL5j/3w+GDhP36k1K5c38QdQg+Swy51jFZWWeIkteNsufkQxp986wnqRRsb/bHbY1WQ7TA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.11.tgz", + "integrity": "sha512-vfkhltrjCAb603XaFhqhAF4LGDi2M4OrCRrFusyQ+iTLQ/o60QQXxc9cZC/FFpihBI9N1Grn6SMKVJ4KP7Fuiw==", "optional": true }, "@eslint-community/eslint-utils": { @@ -12890,69 +12889,69 @@ } }, "@mathigon/boost": { - "version": "1.2.19", - "resolved": "https://registry.npmjs.org/@mathigon/boost/-/boost-1.2.19.tgz", - "integrity": "sha512-IzlXgaTJT2CUoAjGndGqI8ULkuUIDc4Q6MBbn7aEmQTk+TjZPHyLdHjRfOhgxEKuLNkbPyHBSvrPaeZ7Eh0MXw==", + "version": "1.2.20", + "resolved": "https://registry.npmjs.org/@mathigon/boost/-/boost-1.2.20.tgz", + "integrity": "sha512-8PNCOjoNpSiNg6cfdDKWa0ekgW2QRX1tZgRB98/yMiDhmokNdu5SGsiSAI0VSZ0fZugw/s8xefK0RIDNWcJvDA==", "requires": { - "@mathigon/core": "1.1.14", - "@mathigon/euclid": "1.1.16", - "@mathigon/fermat": "1.1.13" + "@mathigon/core": "1.1.15", + "@mathigon/euclid": "1.1.17", + "@mathigon/fermat": "1.1.14" } }, "@mathigon/core": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/@mathigon/core/-/core-1.1.14.tgz", - "integrity": "sha512-x5y8TlR48xi9jMiceoWLEIdH9yCpJRs4MgabRdaDY6F+UY7rrNihyITsdoCsQYF/pQaIkYFtbTeTsnnRX9m3hQ==" + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/@mathigon/core/-/core-1.1.15.tgz", + "integrity": "sha512-94FtnUxyP1ozvGIhGiHDqZYTunCqKaBKWRNCJyDuDFfoLVdz5ct7LnM9HvtxSdBks/gb1J8YuDNT6AXCsBUX7g==" }, "@mathigon/euclid": { - "version": "1.1.16", - "resolved": "https://registry.npmjs.org/@mathigon/euclid/-/euclid-1.1.16.tgz", - "integrity": "sha512-UqhLsR3n+RLhVmETtaScd5tP86BflhVHmnc132DHtDW5dX+03OTGoL5HlVaE9i+kS3iL5L5IXcALq0pOsF2y/A==", + "version": "1.1.17", + "resolved": "https://registry.npmjs.org/@mathigon/euclid/-/euclid-1.1.17.tgz", + "integrity": "sha512-/cIDYS3iChTCWTnlJHolR6sDxKGPebkXc+mwdx0RnFn+JI3DykT4O9WYzBp5PHRVL6tKgE13KaBTzWcNU3Hnkw==", "requires": { - "@mathigon/core": "1.1.14", - "@mathigon/fermat": "1.1.13" + "@mathigon/core": "1.1.15", + "@mathigon/fermat": "1.1.14" } }, "@mathigon/fermat": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/@mathigon/fermat/-/fermat-1.1.13.tgz", - "integrity": "sha512-YjQBI+3cgrgD7OaRqOnqk3tffK4zIwHRj1f8oyuYU0rf07UbVa1h6ZFlimqI2FV1N7fDqMkOyx3osQUhPSBYEQ==", + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/@mathigon/fermat/-/fermat-1.1.14.tgz", + "integrity": "sha512-oYy9XPaSIMbaddqsmVU9JXJnxGVc8MySyYWEPllnTPd229Bc/eomKpZTAhmsvC1fKRCbvPk49V+MFfhIpoea4Q==", "requires": { - "@mathigon/core": "1.1.14" + "@mathigon/core": "1.1.15" } }, "@mathigon/hilbert": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/@mathigon/hilbert/-/hilbert-1.1.13.tgz", - "integrity": "sha512-iEpWUNmYC+MGeqxINwT+BB8pd2VdDmkTRGYzG5MnlfvkrH3w9eamJIvxCAgmF9BprZEazYPqenWcXSAVKCeekg==", + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/@mathigon/hilbert/-/hilbert-1.1.14.tgz", + "integrity": "sha512-hH7jD6cwnWs3qAR1Ng3wAfPsUJEN0eA1BF720tbB7kmzmwIquuYaHl3jWVsuGtIAKMBZzfDP4NOYQYs2UvEReQ==", "requires": { - "@mathigon/core": "1.1.14", - "@mathigon/fermat": "1.1.13" + "@mathigon/core": "1.1.15", + "@mathigon/fermat": "1.1.14" } }, "@mathigon/studio": { - "version": "0.1.40", - "resolved": "https://registry.npmjs.org/@mathigon/studio/-/studio-0.1.40.tgz", - "integrity": "sha512-xGJxJLr7XinS1cdY3HxGEpLwn8vET4vT4LtVV0Wmrs6rf4pMJwm2osmMlIrIEK3Jno2zDIk0niGHKHpJj3W1bQ==", + "version": "0.1.41", + "resolved": "https://registry.npmjs.org/@mathigon/studio/-/studio-0.1.41.tgz", + "integrity": "sha512-SjnkTPVpTWzhLMuy+KNVmxihGVXsKDz7AAg+TG2FJP81SjeX3qUI91KroS4XGjvWceMrpTOGbrGycCBQBNpD3g==", "requires": { "@google-cloud/secret-manager": "4.2.2", "@google-cloud/text-to-speech": "4.2.3", "@google-cloud/translate": "7.2.2", - "@mathigon/boost": "1.2.19", - "@mathigon/core": "1.1.14", - "@mathigon/euclid": "1.1.16", - "@mathigon/fermat": "1.1.13", - "@mathigon/hilbert": "1.1.13", - "@sendgrid/mail": "7.7.0", + "@mathigon/boost": "1.2.20", + "@mathigon/core": "1.1.15", + "@mathigon/euclid": "1.1.17", + "@mathigon/fermat": "1.1.14", + "@mathigon/hilbert": "1.1.14", + "@sendgrid/mail": "8.0.0", "@types/bcryptjs": "2.4.6", "@types/compression": "1.7.5", "@types/cookie-parser": "1.4.6", "@types/express": "4.17.21", "@types/express-flash": "0.0.5", "@types/express-session": "1.17.10", - "@types/js-yaml": "4.0.5", + "@types/js-yaml": "4.0.9", "@types/lusca": "1.7.4", - "@types/node-fetch": "2.6.4", + "@types/node-fetch": "2.6.11", "@types/pug": "2.0.10", "@types/validator": "13.11.7", "@webcomponents/custom-elements": "1.6.0", @@ -12964,9 +12963,9 @@ "compression": "1.7.4", "connect-mongo": "4.6.0", "cookie-parser": "1.4.6", - "cssnano": "6.0.1", + "cssnano": "6.0.3", "date-fns": "2.30.0", - "esbuild": "0.19.8", + "esbuild": "0.19.11", "express": "4.18.2", "express-flash": "0.0.2", "express-session": "1.17.3", @@ -12983,14 +12982,14 @@ "mongodb-memory-server": "8.15.1", "mongoose": "7.4.3", "node-fetch": "2.6.9", - "postcss": "8.4.31", + "postcss": "8.4.33", "postcss-inline-svg": "6.0.0", "pug": "3.0.2", "puppeteer": "20.9.0", "rtlcss": "4.1.1", - "sass": "1.69.5", + "sass": "1.69.7", "tslib": "2.6.2", - "typescript": "5.1.6", + "typescript": "5.3.3", "validator": "13.11.0", "web-animations-js": "2.3.2", "xss": "1.0.14", @@ -13067,11 +13066,6 @@ "iconv-lite": "0.4.24", "unpipe": "1.0.0" } - }, - "typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==" } } }, @@ -13213,29 +13207,29 @@ } }, "@sendgrid/client": { - "version": "7.7.0", - "resolved": "https://registry.npmjs.org/@sendgrid/client/-/client-7.7.0.tgz", - "integrity": "sha512-SxH+y8jeAQSnDavrTD0uGDXYIIkFylCo+eDofVmZLQ0f862nnqbC3Vd1ej6b7Le7lboyzQF6F7Fodv02rYspuA==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@sendgrid/client/-/client-8.1.0.tgz", + "integrity": "sha512-Kp2kKLr307v/HnR3uGuySt0AbCkeG7naDVOzfPOtWvKHVZIEHmKidQjJjzytVZNYWtoRdYgNfBw6GyUznGqa6w==", "requires": { - "@sendgrid/helpers": "^7.7.0", - "axios": "^0.26.0" + "@sendgrid/helpers": "^8.0.0", + "axios": "^1.6.0" } }, "@sendgrid/helpers": { - "version": "7.7.0", - "resolved": "https://registry.npmjs.org/@sendgrid/helpers/-/helpers-7.7.0.tgz", - "integrity": "sha512-3AsAxfN3GDBcXoZ/y1mzAAbKzTtUZ5+ZrHOmWQ279AuaFXUNCh9bPnRpN504bgveTqoW+11IzPg3I0WVgDINpw==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@sendgrid/helpers/-/helpers-8.0.0.tgz", + "integrity": "sha512-Ze7WuW2Xzy5GT5WRx+yEv89fsg/pgy3T1E3FS0QEx0/VvRmigMZ5qyVGhJz4SxomegDkzXv/i0aFPpHKN8qdAA==", "requires": { "deepmerge": "^4.2.2" } }, "@sendgrid/mail": { - "version": "7.7.0", - "resolved": "https://registry.npmjs.org/@sendgrid/mail/-/mail-7.7.0.tgz", - "integrity": "sha512-5+nApPE9wINBvHSUxwOxkkQqM/IAAaBYoP9hw7WwgDNQPxraruVqHizeTitVtKGiqWCKm2mnjh4XGN3fvFLqaw==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@sendgrid/mail/-/mail-8.0.0.tgz", + "integrity": "sha512-ePir+LT6kzJ7yaWAFuo8R+N9Pjm3KQMV5NpJ9XuTaLwwuXrUBiPzFo953Qc7slsYf7AKhMurF4w+ta4v1nsJ7A==", "requires": { - "@sendgrid/client": "^7.7.0", - "@sendgrid/helpers": "^7.7.0" + "@sendgrid/client": "^8.0.0", + "@sendgrid/helpers": "^8.0.0" } }, "@tootallnate/once": { @@ -13600,9 +13594,9 @@ "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==" }, "@types/js-yaml": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.5.tgz", - "integrity": "sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==" + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.9.tgz", + "integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==" }, "@types/json-schema": { "version": "7.0.15", @@ -13669,12 +13663,12 @@ "integrity": "sha512-zyxJM8I1c9q5sRMtVF+zdd13Jt6RU4r4qfhTd7lQubyThvLfx6yYekWSQjGCGV2Tkecgxnlpl/DNlb6Hg+dmEw==" }, "@types/node-fetch": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.4.tgz", - "integrity": "sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg==", + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.11.tgz", + "integrity": "sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==", "requires": { "@types/node": "*", - "form-data": "^3.0.0" + "form-data": "^4.0.0" } }, "@types/pug": { @@ -14298,11 +14292,13 @@ "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==" }, "axios": { - "version": "0.26.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", - "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.5.tgz", + "integrity": "sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==", "requires": { - "follow-redirects": "^1.14.8" + "follow-redirects": "^1.15.4", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" } }, "b4a": { @@ -14435,14 +14431,14 @@ } }, "browserslist": { - "version": "4.21.10", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.10.tgz", - "integrity": "sha512-bipEBdZfVH5/pwrvqc+Ub0kUPVfGUhlKxbvfD+z1BDnPEO/X98ruXGA1WP5ASpAFKan7Qr6j736IacbZQuAlKQ==", + "version": "4.22.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.2.tgz", + "integrity": "sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==", "requires": { - "caniuse-lite": "^1.0.30001517", - "electron-to-chromium": "^1.4.477", - "node-releases": "^2.0.13", - "update-browserslist-db": "^1.0.11" + "caniuse-lite": "^1.0.30001565", + "electron-to-chromium": "^1.4.601", + "node-releases": "^2.0.14", + "update-browserslist-db": "^1.0.13" } }, "bson": { @@ -14524,9 +14520,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001554", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001554.tgz", - "integrity": "sha512-A2E3U//MBwbJVzebddm1YfNp7Nud5Ip+IPn4BozBmn4KqVX7AvluoIDFWjsv5OkGnKUXQVmMSoMKLa3ScCblcQ==" + "version": "1.0.30001578", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001578.tgz", + "integrity": "sha512-J/jkFgsQ3NEl4w2lCoM9ZPxrD+FoBNJ7uJUpGVjIg/j0OwJosWM36EPDv+Yyi0V4twBk9pPmlFS+PLykgEvUmg==" }, "catharsis": { "version": "0.9.0", @@ -14880,9 +14876,9 @@ } }, "css-declaration-sorter": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-6.4.0.tgz", - "integrity": "sha512-jDfsatwWMWN0MODAFuHszfjphEXfNw9JUAhmY4pLu3TyTU+ohUpsbVtbU+1MZn4a47D9kqh03i4eyOm+74+zew==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-7.1.1.tgz", + "integrity": "sha512-dZ3bVTEEc1vxr3Bek9vGwfB5Z6ESPULhcRvO472mfjVnj8jRcTnKO8/JTczlvxM10Myb+wBM++1MtdO76eWcaQ==", "requires": {} }, "css-select": { @@ -14922,54 +14918,54 @@ "integrity": "sha512-FAaLDaplstoRsDR8XGYH51znUN0UY7nMc6Z9/fvE8EXGwvJE9hu7W2vHwx1+bd6gCYnln9nLbzxFTrcO9YQDZw==" }, "cssnano": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-6.0.1.tgz", - "integrity": "sha512-fVO1JdJ0LSdIGJq68eIxOqFpIJrZqXUsBt8fkrBcztCQqAjQD51OhZp7tc0ImcbwXD4k7ny84QTV90nZhmqbkg==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-6.0.3.tgz", + "integrity": "sha512-MRq4CIj8pnyZpcI2qs6wswoYoDD1t0aL28n+41c1Ukcpm56m1h6mCexIHBGjfZfnTqtGSSCP4/fB1ovxgjBOiw==", "requires": { - "cssnano-preset-default": "^6.0.1", - "lilconfig": "^2.1.0" + "cssnano-preset-default": "^6.0.3", + "lilconfig": "^3.0.0" } }, "cssnano-preset-default": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-6.0.1.tgz", - "integrity": "sha512-7VzyFZ5zEB1+l1nToKyrRkuaJIx0zi/1npjvZfbBwbtNTzhLtlvYraK/7/uqmX2Wb2aQtd983uuGw79jAjLSuQ==", - "requires": { - "css-declaration-sorter": "^6.3.1", - "cssnano-utils": "^4.0.0", - "postcss-calc": "^9.0.0", - "postcss-colormin": "^6.0.0", - "postcss-convert-values": "^6.0.0", - "postcss-discard-comments": "^6.0.0", - "postcss-discard-duplicates": "^6.0.0", - "postcss-discard-empty": "^6.0.0", - "postcss-discard-overridden": "^6.0.0", - "postcss-merge-longhand": "^6.0.0", - "postcss-merge-rules": "^6.0.1", - "postcss-minify-font-values": "^6.0.0", - "postcss-minify-gradients": "^6.0.0", - "postcss-minify-params": "^6.0.0", - "postcss-minify-selectors": "^6.0.0", - "postcss-normalize-charset": "^6.0.0", - "postcss-normalize-display-values": "^6.0.0", - "postcss-normalize-positions": "^6.0.0", - "postcss-normalize-repeat-style": "^6.0.0", - "postcss-normalize-string": "^6.0.0", - "postcss-normalize-timing-functions": "^6.0.0", - "postcss-normalize-unicode": "^6.0.0", - "postcss-normalize-url": "^6.0.0", - "postcss-normalize-whitespace": "^6.0.0", - "postcss-ordered-values": "^6.0.0", - "postcss-reduce-initial": "^6.0.0", - "postcss-reduce-transforms": "^6.0.0", - "postcss-svgo": "^6.0.0", - "postcss-unique-selectors": "^6.0.0" + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-6.0.3.tgz", + "integrity": "sha512-4y3H370aZCkT9Ev8P4SO4bZbt+AExeKhh8wTbms/X7OLDo5E7AYUUy6YPxa/uF5Grf+AJwNcCnxKhZynJ6luBA==", + "requires": { + "css-declaration-sorter": "^7.1.1", + "cssnano-utils": "^4.0.1", + "postcss-calc": "^9.0.1", + "postcss-colormin": "^6.0.2", + "postcss-convert-values": "^6.0.2", + "postcss-discard-comments": "^6.0.1", + "postcss-discard-duplicates": "^6.0.1", + "postcss-discard-empty": "^6.0.1", + "postcss-discard-overridden": "^6.0.1", + "postcss-merge-longhand": "^6.0.2", + "postcss-merge-rules": "^6.0.3", + "postcss-minify-font-values": "^6.0.1", + "postcss-minify-gradients": "^6.0.1", + "postcss-minify-params": "^6.0.2", + "postcss-minify-selectors": "^6.0.2", + "postcss-normalize-charset": "^6.0.1", + "postcss-normalize-display-values": "^6.0.1", + "postcss-normalize-positions": "^6.0.1", + "postcss-normalize-repeat-style": "^6.0.1", + "postcss-normalize-string": "^6.0.1", + "postcss-normalize-timing-functions": "^6.0.1", + "postcss-normalize-unicode": "^6.0.2", + "postcss-normalize-url": "^6.0.1", + "postcss-normalize-whitespace": "^6.0.1", + "postcss-ordered-values": "^6.0.1", + "postcss-reduce-initial": "^6.0.2", + "postcss-reduce-transforms": "^6.0.1", + "postcss-svgo": "^6.0.2", + "postcss-unique-selectors": "^6.0.2" } }, "cssnano-utils": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/cssnano-utils/-/cssnano-utils-4.0.0.tgz", - "integrity": "sha512-Z39TLP+1E0KUcd7LGyF4qMfu8ZufI0rDzhdyAMsa/8UyNUU8wpS0fhdBxbQbv32r64ea00h4878gommRVg2BHw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/cssnano-utils/-/cssnano-utils-4.0.1.tgz", + "integrity": "sha512-6qQuYDqsGoiXssZ3zct6dcMxiqfT6epy7x4R0TQJadd4LWO3sPR6JH6ZByOvVLoZ6EdwPGgd7+DR1EmX3tiXQQ==", "requires": {} }, "csso": { @@ -15073,9 +15069,9 @@ "devOptional": true }, "deepmerge": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", - "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==" + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==" }, "define-properties": { "version": "1.2.0", @@ -15259,9 +15255,9 @@ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, "electron-to-chromium": { - "version": "1.4.496", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.496.tgz", - "integrity": "sha512-qeXC3Zbykq44RCrBa4kr8v/dWzYJA8rAwpyh9Qd+NKWoJfjG5vvJqy9XOJ9H4P/lqulZBCgUWAYi+FeK5AuJ8g==" + "version": "1.4.635", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.635.tgz", + "integrity": "sha512-iu/2D0zolKU3iDGXXxdOzNf72Jnokn+K1IN6Kk4iV6l1Tr2g/qy+mvmtfAiBwZe5S3aB5r92vp+zSZ69scYRrg==" }, "emoji-regex": { "version": "8.0.0", @@ -15376,32 +15372,33 @@ } }, "esbuild": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.8.tgz", - "integrity": "sha512-l7iffQpT2OrZfH2rXIp7/FkmaeZM0vxbxN9KfiCwGYuZqzMg/JdvX26R31Zxn/Pxvsrg3Y9N6XTcnknqDyyv4w==", - "requires": { - "@esbuild/android-arm": "0.19.8", - "@esbuild/android-arm64": "0.19.8", - "@esbuild/android-x64": "0.19.8", - "@esbuild/darwin-arm64": "0.19.8", - "@esbuild/darwin-x64": "0.19.8", - "@esbuild/freebsd-arm64": "0.19.8", - "@esbuild/freebsd-x64": "0.19.8", - "@esbuild/linux-arm": "0.19.8", - "@esbuild/linux-arm64": "0.19.8", - "@esbuild/linux-ia32": "0.19.8", - "@esbuild/linux-loong64": "0.19.8", - "@esbuild/linux-mips64el": "0.19.8", - "@esbuild/linux-ppc64": "0.19.8", - "@esbuild/linux-riscv64": "0.19.8", - "@esbuild/linux-s390x": "0.19.8", - "@esbuild/linux-x64": "0.19.8", - "@esbuild/netbsd-x64": "0.19.8", - "@esbuild/openbsd-x64": "0.19.8", - "@esbuild/sunos-x64": "0.19.8", - "@esbuild/win32-arm64": "0.19.8", - "@esbuild/win32-ia32": "0.19.8", - "@esbuild/win32-x64": "0.19.8" + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.11.tgz", + "integrity": "sha512-HJ96Hev2hX/6i5cDVwcqiJBBtuo9+FeIJOtZ9W1kA5M6AMJRHUZlpYZ1/SbEwtO0ioNAW8rUooVpC/WehY2SfA==", + "requires": { + "@esbuild/aix-ppc64": "0.19.11", + "@esbuild/android-arm": "0.19.11", + "@esbuild/android-arm64": "0.19.11", + "@esbuild/android-x64": "0.19.11", + "@esbuild/darwin-arm64": "0.19.11", + "@esbuild/darwin-x64": "0.19.11", + "@esbuild/freebsd-arm64": "0.19.11", + "@esbuild/freebsd-x64": "0.19.11", + "@esbuild/linux-arm": "0.19.11", + "@esbuild/linux-arm64": "0.19.11", + "@esbuild/linux-ia32": "0.19.11", + "@esbuild/linux-loong64": "0.19.11", + "@esbuild/linux-mips64el": "0.19.11", + "@esbuild/linux-ppc64": "0.19.11", + "@esbuild/linux-riscv64": "0.19.11", + "@esbuild/linux-s390x": "0.19.11", + "@esbuild/linux-x64": "0.19.11", + "@esbuild/netbsd-x64": "0.19.11", + "@esbuild/openbsd-x64": "0.19.11", + "@esbuild/sunos-x64": "0.19.11", + "@esbuild/win32-arm64": "0.19.11", + "@esbuild/win32-ia32": "0.19.11", + "@esbuild/win32-x64": "0.19.11" } }, "escalade": { @@ -16138,9 +16135,9 @@ } }, "form-data": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", "requires": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -17005,16 +17002,6 @@ "xml-name-validator": "^4.0.0" }, "dependencies": { - "form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - }, "tr46": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz", @@ -17175,9 +17162,9 @@ } }, "lilconfig": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", - "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==" + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.0.0.tgz", + "integrity": "sha512-K2U4W2Ff5ibV7j7ydLr+zLAkIg5JJ4lPn1Ltsdt+Tz/IjQ8buJ55pZAxoP34lqIiwtF9iAvtLv3JGv7CAyAg+g==" }, "lines-and-columns": { "version": "1.2.4", @@ -17559,9 +17546,9 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "nanoid": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", - "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==" + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==" }, "natural-compare": { "version": "1.4.0", @@ -17637,9 +17624,9 @@ "optional": true }, "node-releases": { - "version": "2.0.13", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", - "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==" + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", + "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==" }, "nopt": { "version": "4.0.3", @@ -18120,11 +18107,11 @@ } }, "postcss": { - "version": "8.4.31", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", - "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", + "version": "8.4.33", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.33.tgz", + "integrity": "sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg==", "requires": { - "nanoid": "^3.3.6", + "nanoid": "^3.3.7", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" } @@ -18139,47 +18126,47 @@ } }, "postcss-colormin": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-6.0.0.tgz", - "integrity": "sha512-EuO+bAUmutWoZYgHn2T1dG1pPqHU6L4TjzPlu4t1wZGXQ/fxV16xg2EJmYi0z+6r+MGV1yvpx1BHkUaRrPa2bw==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-6.0.2.tgz", + "integrity": "sha512-TXKOxs9LWcdYo5cgmcSHPkyrLAh86hX1ijmyy6J8SbOhyv6ua053M3ZAM/0j44UsnQNIWdl8gb5L7xX2htKeLw==", "requires": { - "browserslist": "^4.21.4", + "browserslist": "^4.22.2", "caniuse-api": "^3.0.0", "colord": "^2.9.1", "postcss-value-parser": "^4.2.0" } }, "postcss-convert-values": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-6.0.0.tgz", - "integrity": "sha512-U5D8QhVwqT++ecmy8rnTb+RL9n/B806UVaS3m60lqle4YDFcpbS3ae5bTQIh3wOGUSDHSEtMYLs/38dNG7EYFw==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-6.0.2.tgz", + "integrity": "sha512-aeBmaTnGQ+NUSVQT8aY0sKyAD/BaLJenEKZ03YK0JnDE1w1Rr8XShoxdal2V2H26xTJKr3v5haByOhJuyT4UYw==", "requires": { - "browserslist": "^4.21.4", + "browserslist": "^4.22.2", "postcss-value-parser": "^4.2.0" } }, "postcss-discard-comments": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-6.0.0.tgz", - "integrity": "sha512-p2skSGqzPMZkEQvJsgnkBhCn8gI7NzRH2683EEjrIkoMiwRELx68yoUJ3q3DGSGuQ8Ug9Gsn+OuDr46yfO+eFw==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-6.0.1.tgz", + "integrity": "sha512-f1KYNPtqYLUeZGCHQPKzzFtsHaRuECe6jLakf/RjSRqvF5XHLZnM2+fXLhb8Qh/HBFHs3M4cSLb1k3B899RYIg==", "requires": {} }, "postcss-discard-duplicates": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-6.0.0.tgz", - "integrity": "sha512-bU1SXIizMLtDW4oSsi5C/xHKbhLlhek/0/yCnoMQany9k3nPBq+Ctsv/9oMmyqbR96HYHxZcHyK2HR5P/mqoGA==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-6.0.1.tgz", + "integrity": "sha512-1hvUs76HLYR8zkScbwyJ8oJEugfPV+WchpnA+26fpJ7Smzs51CzGBHC32RS03psuX/2l0l0UKh2StzNxOrKCYg==", "requires": {} }, "postcss-discard-empty": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-6.0.0.tgz", - "integrity": "sha512-b+h1S1VT6dNhpcg+LpyiUrdnEZfICF0my7HAKgJixJLW7BnNmpRH34+uw/etf5AhOlIhIAuXApSzzDzMI9K/gQ==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-6.0.1.tgz", + "integrity": "sha512-yitcmKwmVWtNsrrRqGJ7/C0YRy53i0mjexBDQ9zYxDwTWVBgbU4+C9jIZLmQlTDT9zhml+u0OMFJh8+31krmOg==", "requires": {} }, "postcss-discard-overridden": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-6.0.0.tgz", - "integrity": "sha512-4VELwssYXDFigPYAZ8vL4yX4mUepF/oCBeeIT4OXsJPYOtvJumyz9WflmJWTfDwCUcpDR+z0zvCWBXgTx35SVw==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-6.0.1.tgz", + "integrity": "sha512-qs0ehZMMZpSESbRkw1+inkf51kak6OOzNRaoLd/U7Fatp0aN2HQ1rxGOrJvYcRAN9VpX8kUF13R2ofn8OlvFVA==", "requires": {} }, "postcss-inline-svg": { @@ -18194,182 +18181,182 @@ } }, "postcss-merge-longhand": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-6.0.0.tgz", - "integrity": "sha512-4VSfd1lvGkLTLYcxFuISDtWUfFS4zXe0FpF149AyziftPFQIWxjvFSKhA4MIxMe4XM3yTDgQMbSNgzIVxChbIg==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-6.0.2.tgz", + "integrity": "sha512-+yfVB7gEM8SrCo9w2lCApKIEzrTKl5yS1F4yGhV3kSim6JzbfLGJyhR1B6X+6vOT0U33Mgx7iv4X9MVWuaSAfw==", "requires": { "postcss-value-parser": "^4.2.0", - "stylehacks": "^6.0.0" + "stylehacks": "^6.0.2" } }, "postcss-merge-rules": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-6.0.1.tgz", - "integrity": "sha512-a4tlmJIQo9SCjcfiCcCMg/ZCEe0XTkl/xK0XHBs955GWg9xDX3NwP9pwZ78QUOWB8/0XCjZeJn98Dae0zg6AAw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-6.0.3.tgz", + "integrity": "sha512-yfkDqSHGohy8sGYIJwBmIGDv4K4/WrJPX355XrxQb/CSsT4Kc/RxDi6akqn5s9bap85AWgv21ArcUWwWdGNSHA==", "requires": { - "browserslist": "^4.21.4", + "browserslist": "^4.22.2", "caniuse-api": "^3.0.0", - "cssnano-utils": "^4.0.0", - "postcss-selector-parser": "^6.0.5" + "cssnano-utils": "^4.0.1", + "postcss-selector-parser": "^6.0.15" } }, "postcss-minify-font-values": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-6.0.0.tgz", - "integrity": "sha512-zNRAVtyh5E8ndZEYXA4WS8ZYsAp798HiIQ1V2UF/C/munLp2r1UGHwf1+6JFu7hdEhJFN+W1WJQKBrtjhFgEnA==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-6.0.1.tgz", + "integrity": "sha512-tIwmF1zUPoN6xOtA/2FgVk1ZKrLcCvE0dpZLtzyyte0j9zUeB8RTbCqrHZGjJlxOvNWKMYtunLrrl7HPOiR46w==", "requires": { "postcss-value-parser": "^4.2.0" } }, "postcss-minify-gradients": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-6.0.0.tgz", - "integrity": "sha512-wO0F6YfVAR+K1xVxF53ueZJza3L+R3E6cp0VwuXJQejnNUH0DjcAFe3JEBeTY1dLwGa0NlDWueCA1VlEfiKgAA==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-6.0.1.tgz", + "integrity": "sha512-M1RJWVjd6IOLPl1hYiOd5HQHgpp6cvJVLrieQYS9y07Yo8itAr6jaekzJphaJFR0tcg4kRewCk3kna9uHBxn/w==", "requires": { "colord": "^2.9.1", - "cssnano-utils": "^4.0.0", + "cssnano-utils": "^4.0.1", "postcss-value-parser": "^4.2.0" } }, "postcss-minify-params": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-6.0.0.tgz", - "integrity": "sha512-Fz/wMQDveiS0n5JPcvsMeyNXOIMrwF88n7196puSuQSWSa+/Ofc1gDOSY2xi8+A4PqB5dlYCKk/WfqKqsI+ReQ==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-6.0.2.tgz", + "integrity": "sha512-zwQtbrPEBDj+ApELZ6QylLf2/c5zmASoOuA4DzolyVGdV38iR2I5QRMsZcHkcdkZzxpN8RS4cN7LPskOkTwTZw==", "requires": { - "browserslist": "^4.21.4", - "cssnano-utils": "^4.0.0", + "browserslist": "^4.22.2", + "cssnano-utils": "^4.0.1", "postcss-value-parser": "^4.2.0" } }, "postcss-minify-selectors": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-6.0.0.tgz", - "integrity": "sha512-ec/q9JNCOC2CRDNnypipGfOhbYPuUkewGwLnbv6omue/PSASbHSU7s6uSQ0tcFRVv731oMIx8k0SP4ZX6be/0g==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-6.0.2.tgz", + "integrity": "sha512-0b+m+w7OAvZejPQdN2GjsXLv5o0jqYHX3aoV0e7RBKPCsB7TYG5KKWBFhGnB/iP3213Ts8c5H4wLPLMm7z28Sg==", "requires": { - "postcss-selector-parser": "^6.0.5" + "postcss-selector-parser": "^6.0.15" } }, "postcss-normalize-charset": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-6.0.0.tgz", - "integrity": "sha512-cqundwChbu8yO/gSWkuFDmKrCZ2vJzDAocheT2JTd0sFNA4HMGoKMfbk2B+J0OmO0t5GUkiAkSM5yF2rSLUjgQ==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-6.0.1.tgz", + "integrity": "sha512-aW5LbMNRZ+oDV57PF9K+WI1Z8MPnF+A8qbajg/T8PP126YrGX1f9IQx21GI2OlGz7XFJi/fNi0GTbY948XJtXg==", "requires": {} }, "postcss-normalize-display-values": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-display-values/-/postcss-normalize-display-values-6.0.0.tgz", - "integrity": "sha512-Qyt5kMrvy7dJRO3OjF7zkotGfuYALETZE+4lk66sziWSPzlBEt7FrUshV6VLECkI4EN8Z863O6Nci4NXQGNzYw==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-display-values/-/postcss-normalize-display-values-6.0.1.tgz", + "integrity": "sha512-mc3vxp2bEuCb4LgCcmG1y6lKJu1Co8T+rKHrcbShJwUmKJiEl761qb/QQCfFwlrvSeET3jksolCR/RZuMURudw==", "requires": { "postcss-value-parser": "^4.2.0" } }, "postcss-normalize-positions": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-positions/-/postcss-normalize-positions-6.0.0.tgz", - "integrity": "sha512-mPCzhSV8+30FZyWhxi6UoVRYd3ZBJgTRly4hOkaSifo0H+pjDYcii/aVT4YE6QpOil15a5uiv6ftnY3rm0igPg==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-positions/-/postcss-normalize-positions-6.0.1.tgz", + "integrity": "sha512-HRsq8u/0unKNvm0cvwxcOUEcakFXqZ41fv3FOdPn916XFUrympjr+03oaLkuZENz3HE9RrQE9yU0Xv43ThWjQg==", "requires": { "postcss-value-parser": "^4.2.0" } }, "postcss-normalize-repeat-style": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-6.0.0.tgz", - "integrity": "sha512-50W5JWEBiOOAez2AKBh4kRFm2uhrT3O1Uwdxz7k24aKtbD83vqmcVG7zoIwo6xI2FZ/HDlbrCopXhLeTpQib1A==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-6.0.1.tgz", + "integrity": "sha512-Gbb2nmCy6tTiA7Sh2MBs3fj9W8swonk6lw+dFFeQT68B0Pzwp1kvisJQkdV6rbbMSd9brMlS8I8ts52tAGWmGQ==", "requires": { "postcss-value-parser": "^4.2.0" } }, "postcss-normalize-string": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-string/-/postcss-normalize-string-6.0.0.tgz", - "integrity": "sha512-KWkIB7TrPOiqb8ZZz6homet2KWKJwIlysF5ICPZrXAylGe2hzX/HSf4NTX2rRPJMAtlRsj/yfkrWGavFuB+c0w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-string/-/postcss-normalize-string-6.0.1.tgz", + "integrity": "sha512-5Fhx/+xzALJD9EI26Aq23hXwmv97Zfy2VFrt5PLT8lAhnBIZvmaT5pQk+NuJ/GWj/QWaKSKbnoKDGLbV6qnhXg==", "requires": { "postcss-value-parser": "^4.2.0" } }, "postcss-normalize-timing-functions": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-6.0.0.tgz", - "integrity": "sha512-tpIXWciXBp5CiFs8sem90IWlw76FV4oi6QEWfQwyeREVwUy39VSeSqjAT7X0Qw650yAimYW5gkl2Gd871N5SQg==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-6.0.1.tgz", + "integrity": "sha512-4zcczzHqmCU7L5dqTB9rzeqPWRMc0K2HoR+Bfl+FSMbqGBUcP5LRfgcH4BdRtLuzVQK1/FHdFoGT3F7rkEnY+g==", "requires": { "postcss-value-parser": "^4.2.0" } }, "postcss-normalize-unicode": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-6.0.0.tgz", - "integrity": "sha512-ui5crYkb5ubEUDugDc786L/Me+DXp2dLg3fVJbqyAl0VPkAeALyAijF2zOsnZyaS1HyfPuMH0DwyY18VMFVNkg==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-6.0.2.tgz", + "integrity": "sha512-Ff2VdAYCTGyMUwpevTZPZ4w0+mPjbZzLLyoLh/RMpqUqeQKZ+xMm31hkxBavDcGKcxm6ACzGk0nBfZ8LZkStKA==", "requires": { - "browserslist": "^4.21.4", + "browserslist": "^4.22.2", "postcss-value-parser": "^4.2.0" } }, "postcss-normalize-url": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-6.0.0.tgz", - "integrity": "sha512-98mvh2QzIPbb02YDIrYvAg4OUzGH7s1ZgHlD3fIdTHLgPLRpv1ZTKJDnSAKr4Rt21ZQFzwhGMXxpXlfrUBKFHw==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-6.0.1.tgz", + "integrity": "sha512-jEXL15tXSvbjm0yzUV7FBiEXwhIa9H88JOXDGQzmcWoB4mSjZIsmtto066s2iW9FYuIrIF4k04HA2BKAOpbsaQ==", "requires": { "postcss-value-parser": "^4.2.0" } }, "postcss-normalize-whitespace": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-normalize-whitespace/-/postcss-normalize-whitespace-6.0.0.tgz", - "integrity": "sha512-7cfE1AyLiK0+ZBG6FmLziJzqQCpTQY+8XjMhMAz8WSBSCsCNNUKujgIgjCAmDT3cJ+3zjTXFkoD15ZPsckArVw==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-whitespace/-/postcss-normalize-whitespace-6.0.1.tgz", + "integrity": "sha512-76i3NpWf6bB8UHlVuLRxG4zW2YykF9CTEcq/9LGAiz2qBuX5cBStadkk0jSkg9a9TCIXbMQz7yzrygKoCW9JuA==", "requires": { "postcss-value-parser": "^4.2.0" } }, "postcss-ordered-values": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-ordered-values/-/postcss-ordered-values-6.0.0.tgz", - "integrity": "sha512-K36XzUDpvfG/nWkjs6d1hRBydeIxGpKS2+n+ywlKPzx1nMYDYpoGbcjhj5AwVYJK1qV2/SDoDEnHzlPD6s3nMg==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-ordered-values/-/postcss-ordered-values-6.0.1.tgz", + "integrity": "sha512-XXbb1O/MW9HdEhnBxitZpPFbIvDgbo9NK4c/5bOfiKpnIGZDoL2xd7/e6jW5DYLsWxBbs+1nZEnVgnjnlFViaA==", "requires": { - "cssnano-utils": "^4.0.0", + "cssnano-utils": "^4.0.1", "postcss-value-parser": "^4.2.0" } }, "postcss-reduce-initial": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-6.0.0.tgz", - "integrity": "sha512-s2UOnidpVuXu6JiiI5U+fV2jamAw5YNA9Fdi/GRK0zLDLCfXmSGqQtzpUPtfN66RtCbb9fFHoyZdQaxOB3WxVA==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-6.0.2.tgz", + "integrity": "sha512-YGKalhNlCLcjcLvjU5nF8FyeCTkCO5UtvJEt0hrPZVCTtRLSOH4z00T1UntQPj4dUmIYZgMj8qK77JbSX95hSw==", "requires": { - "browserslist": "^4.21.4", + "browserslist": "^4.22.2", "caniuse-api": "^3.0.0" } }, "postcss-reduce-transforms": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-6.0.0.tgz", - "integrity": "sha512-FQ9f6xM1homnuy1wLe9lP1wujzxnwt1EwiigtWwuyf8FsqqXUDUp2Ulxf9A5yjlUOTdCJO6lonYjg1mgqIIi2w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-6.0.1.tgz", + "integrity": "sha512-fUbV81OkUe75JM+VYO1gr/IoA2b/dRiH6HvMwhrIBSUrxq3jNZQZitSnugcTLDi1KkQh1eR/zi+iyxviUNBkcQ==", "requires": { "postcss-value-parser": "^4.2.0" } }, "postcss-selector-parser": { - "version": "6.0.13", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.13.tgz", - "integrity": "sha512-EaV1Gl4mUEV4ddhDnv/xtj7sxwrwxdetHdWUGnT4VJQf+4d05v6lHYZr8N573k5Z0BViss7BDhfWtKS3+sfAqQ==", + "version": "6.0.15", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.15.tgz", + "integrity": "sha512-rEYkQOMUCEMhsKbK66tbEU9QVIxbhN18YiniAwA7XQYTVBqrBy+P2p5JcdqsHgKM2zWylp8d7J6eszocfds5Sw==", "requires": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" } }, "postcss-svgo": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-6.0.0.tgz", - "integrity": "sha512-r9zvj/wGAoAIodn84dR/kFqwhINp5YsJkLoujybWG59grR/IHx+uQ2Zo+IcOwM0jskfYX3R0mo+1Kip1VSNcvw==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-6.0.2.tgz", + "integrity": "sha512-IH5R9SjkTkh0kfFOQDImyy1+mTCb+E830+9SV1O+AaDcoHTvfsvt6WwJeo7KwcHbFnevZVCsXhDmjFiGVuwqFQ==", "requires": { "postcss-value-parser": "^4.2.0", - "svgo": "^3.0.2" + "svgo": "^3.2.0" } }, "postcss-unique-selectors": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-6.0.0.tgz", - "integrity": "sha512-EPQzpZNxOxP7777t73RQpZE5e9TrnCrkvp7AH7a0l89JmZiPnS82y216JowHXwpBCQitfyxrof9TK3rYbi7/Yw==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-6.0.2.tgz", + "integrity": "sha512-8IZGQ94nechdG7Y9Sh9FlIY2b4uS8/k8kdKRX040XHsS3B6d1HrJAkXrBSsSu4SuARruSsUjW3nlSw8BHkaAYQ==", "requires": { - "postcss-selector-parser": "^6.0.5" + "postcss-selector-parser": "^6.0.15" } }, "postcss-value-parser": { @@ -18619,8 +18606,7 @@ "proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "optional": true + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" }, "psl": { "version": "1.9.0", @@ -19069,9 +19055,9 @@ } }, "sass": { - "version": "1.69.5", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.69.5.tgz", - "integrity": "sha512-qg2+UCJibLr2LCVOt3OlPhr/dqVHWOa9XtZf2OjbLs/T4VPSJ00udtgJxH3neXZm+QqX8B+3cU7RaLqp1iVfcQ==", + "version": "1.69.7", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.69.7.tgz", + "integrity": "sha512-rzj2soDeZ8wtE2egyLXgOOHQvaC2iosZrkF6v3EUG+tBwEvhqUCzm0VP3k9gHF9LXbSrRhT5SksoI56Iw8NPnQ==", "requires": { "chokidar": ">=3.0.0 <4.0.0", "immutable": "^4.0.0", @@ -19466,12 +19452,12 @@ "optional": true }, "stylehacks": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-6.0.0.tgz", - "integrity": "sha512-+UT589qhHPwz6mTlCLSt/vMNTJx8dopeJlZAlBMJPWA3ORqu6wmQY7FBXf+qD+FsqoBJODyqNxOUP3jdntFRdw==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-6.0.2.tgz", + "integrity": "sha512-00zvJGnCu64EpMjX8b5iCZ3us2Ptyw8+toEkb92VdmkEaRaSGBNKAoK6aWZckhXxmQP8zWiTaFaiMGIU8Ve8sg==", "requires": { - "browserslist": "^4.21.4", - "postcss-selector-parser": "^6.0.4" + "browserslist": "^4.22.2", + "postcss-selector-parser": "^6.0.15" } }, "supports-color": { @@ -19485,14 +19471,15 @@ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==" }, "svgo": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-3.0.2.tgz", - "integrity": "sha512-Z706C1U2pb1+JGP48fbazf3KxHrWOsLme6Rv7imFBn5EnuanDW1GPaA/P1/dvObE670JDePC3mnj0k0B7P0jjQ==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/svgo/-/svgo-3.2.0.tgz", + "integrity": "sha512-4PP6CMW/V7l/GmKRKzsLR8xxjdHTV4IMvhTnpuHwwBazSIlw5W/5SmPjN8Dwyt7lKbSJrRDgp4t9ph0HgChFBQ==", "requires": { "@trysound/sax": "0.2.0", "commander": "^7.2.0", "css-select": "^5.1.0", - "css-tree": "^2.2.1", + "css-tree": "^2.3.1", + "css-what": "^6.1.0", "csso": "^5.0.5", "picocolors": "^1.0.0" } @@ -19820,9 +19807,9 @@ "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" }, "update-browserslist-db": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", - "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", + "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", "requires": { "escalade": "^3.1.1", "picocolors": "^1.0.0" diff --git a/package.json b/package.json index 406e36df..5149e2cb 100644 --- a/package.json +++ b/package.json @@ -19,12 +19,12 @@ "node": ">=16" }, "dependencies": { - "@mathigon/boost": "1.2.19", - "@mathigon/core": "1.1.14", - "@mathigon/euclid": "1.1.16", - "@mathigon/fermat": "1.1.13", - "@mathigon/hilbert": "1.1.13", - "@mathigon/studio": "0.1.40", + "@mathigon/boost": "1.2.20", + "@mathigon/core": "1.1.15", + "@mathigon/euclid": "1.1.17", + "@mathigon/fermat": "1.1.14", + "@mathigon/hilbert": "1.1.14", + "@mathigon/studio": "0.1.41", "@types/d3": "6.3.0", "@types/three": "0.91.14", "@types/topojson": "3.2.3",