1
0
Fork 0
mirror of synced 2024-06-03 03:14:50 +12:00

fix: scripts for filters and charts

This commit is contained in:
Torsten Dittmann 2022-08-09 16:05:34 +02:00
parent 5db5f7217f
commit d9c7bbd3d2
16 changed files with 273 additions and 1000 deletions

View file

@ -597,8 +597,8 @@ $logs = $this->getParam('logs', null);
View as JSON
</button>
</li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Last Updated: <span data-ls-bind="{{project-collection.$updatedAt|dateText}}"></span></li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Created: <span data-ls-bind="{{project-collection.$createdAt|dateText}}"></span></li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Last Updated: <span data-ls-bind="{{project-collection.$updatedAt|date}}"></span></li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Created: <span data-ls-bind="{{project-collection.$createdAt|date}}"></span></li>
</ul>
<form

View file

@ -292,8 +292,8 @@
<ul class="margin-bottom-large text-fade text-size-small">
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> <button data-ls-ui-trigger="open-json" class="link text-size-small">View as JSON</button></li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Last Updated: <span data-ls-bind="{{project-database.$updatedAt|dateText}}"></span></li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Created: <span data-ls-bind="{{project-database.$createdAt|dateText}}"></span></li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Last Updated: <span data-ls-bind="{{project-database.$updatedAt|date}}"></span></li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Created: <span data-ls-bind="{{project-database.$createdAt|date}}"></span></li>
</ul>
<form

View file

@ -379,8 +379,8 @@ $logs = $this->getParam('logs', null);
View as JSON
</button>
</li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Last Updated: <span data-ls-bind="{{project-document.$updatedAt|dateText}}"></span></li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Created: <span data-ls-bind="{{project-document.$createdAt|dateText}}"></span></li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Last Updated: <span data-ls-bind="{{project-document.$updatedAt|date}}"></span></li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Created: <span data-ls-bind="{{project-document.$createdAt|date}}"></span></li>
</ul>
<div data-ls-if="({{project-document.$id}})">

View file

@ -260,8 +260,8 @@ sort($patterns);
View as JSON
</button>
</li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Last Updated: <span data-ls-bind="{{project-function.$updatedAt|dateText}}"></span></li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Created: <span data-ls-bind="{{project-function.$createdAt|dateText}}"></span></li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Last Updated: <span data-ls-bind="{{project-function.$updatedAt|date}}"></span></li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Created: <span data-ls-bind="{{project-function.$createdAt|date}}"></span></li>
</ul>
<form name="functions.delete" class="margin-bottom"
@ -619,8 +619,8 @@ sort($patterns);
View as JSON
</button>
</li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Last Updated: <span data-ls-bind="{{project-function.$updatedAt|dateText}}"></span></li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Created: <span data-ls-bind="{{project-function.$createdAt|dateText}}"></span></li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Last Updated: <span data-ls-bind="{{project-function.$updatedAt|date}}"></span></li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Created: <span data-ls-bind="{{project-function.$createdAt|date}}"></span></li>
</ul>
<form name="functions.delete" class="margin-bottom"

View file

@ -190,7 +190,7 @@ $fileLimitHuman = $this->getParam('fileLimitHuman', 0);
<span data-ls-bind="{{file.sizeOriginal|humanFileUnit}}"></span>
</div>
<div class="margin-bottom">
<i class="icon-angle-circled-right margin-start-negative-tiny margin-end-tiny"></i> Created at: <span data-ls-bind="{{file.$createdAt|dateText}}"></span>
<i class="icon-angle-circled-right margin-start-negative-tiny margin-end-tiny"></i> Created at: <span data-ls-bind="{{file.$createdAt|date}}"></span>
</div>
</div>
</div>
@ -211,7 +211,7 @@ $fileLimitHuman = $this->getParam('fileLimitHuman', 0);
<span class="text-fade text-size-small" data-ls-bind="{{file.sizeOriginal|humanFileUnit}}"></span>
</td>
<td data-title="Created: ">
<span class="text-fade text-size-small" data-ls-bind="{{file.$createdAt|dateText}}"></span>
<span class="text-fade text-size-small" data-ls-bind="{{file.$createdAt|date}}"></span>
</td>
<td data-title="" class="cell-options-more" style="overflow: visible">
<div class="drop-list end" data-ls-ui-open="" data-button-aria="File Options" data-button-class="icon-dot-3 reset-inner-button" data-blur="1">
@ -481,8 +481,8 @@ $fileLimitHuman = $this->getParam('fileLimitHuman', 0);
View as JSON
</button>
</li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Last Updated: <span data-ls-bind="{{project-bucket.$updatedAt|dateText}}"></span></li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Created: <span data-ls-bind="{{project-bucket.$createdAt|dateText}}"></span></li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Last Updated: <span data-ls-bind="{{project-bucket.$updatedAt|date}}"></span></li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Created: <span data-ls-bind="{{project-bucket.$createdAt|date}}"></span></li>
</ul>
<form name="storage.deleteBucket" class="margin-bottom"

View file

@ -100,7 +100,7 @@ $smtpEnabled = $this->getParam('smtpEnabled', false);
<span class="tag red">Blocked</span>
</span>
</td>
<td data-title="Created: "><small data-ls-bind="{{user.registration|dateText}}"></small></td>
<td data-title="Created: "><small data-ls-bind="{{user.registration|date}}"></small></td>
</tr>
</tbody>
</table>
@ -248,7 +248,7 @@ $smtpEnabled = $this->getParam('smtpEnabled', false);
<a data-ls-attrs="href=/console/users/teams/team?id={{team.$id}}&project={{router.params.project}}" data-ls-bind="{{team.name}}" data-ls-attrs="title={{team.name}}"></a>
</td>
<td data-title="Members: "><span data-ls-bind="{{team.total}} members"></span></td>
<td data-title="Date Created: "><small data-ls-bind="{{team.$createdAt|dateText}}"></small></td>
<td data-title="Date Created: "><small data-ls-bind="{{team.$createdAt|date}}"></small></td>
</tr>
</tbody>
</table>

View file

@ -216,7 +216,7 @@
View as JSON
</button>
</li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Created: <span data-ls-bind="{{team.$createdAt|dateText}}"></span></li>
<li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> Created: <span data-ls-bind="{{team.$createdAt|date}}"></span></li>
</ul>
<form name="teams.delete" class="margin-bottom"

View file

@ -183,7 +183,7 @@
<div class="text-align-center">
<img src="" data-ls-attrs="src={{user|avatar}}" data-size="200" alt="User Avatar" class="avatar huge margin-top-negative-xxl" />
<div class="margin-top-small margin-bottom-small" data-ls-bind="Member since {{user.registration|dateText}}"></div>
<div class="margin-top-small margin-bottom-small" data-ls-bind="Member since {{user.registration|date}}"></div>
<hr class="margin-top-tiny margin-bottom-tiny" data-ls-if="{{user.email}}">
<div class="margin-top-small margin-bottom-small clear" data-ls-if="{{user.email}}">
<span data-ls-bind="{{user.email}}" class="pull-start"></span>

58
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "677b1b47c8567f0b7b05645e2bbc7bc7",
"content-hash": "6628dccfb632303caa5de412afd21854",
"packages": [
{
"name": "adhocore/jwt",
@ -1733,16 +1733,16 @@
},
{
"name": "utopia-php/abuse",
"version": "0.7.0",
"version": "dev-origin/timestamp-to-datetime",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/abuse.git",
"reference": "52fb20e39e2e9619948bc0a73b52e10caa71350d"
"reference": "48b93d69550b6f99e9f3f1f9c8348406d89aa6c0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/abuse/zipball/52fb20e39e2e9619948bc0a73b52e10caa71350d",
"reference": "52fb20e39e2e9619948bc0a73b52e10caa71350d",
"url": "https://api.github.com/repos/utopia-php/abuse/zipball/48b93d69550b6f99e9f3f1f9c8348406d89aa6c0",
"reference": "48b93d69550b6f99e9f3f1f9c8348406d89aa6c0",
"shasum": ""
},
"require": {
@ -1780,9 +1780,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/abuse/issues",
"source": "https://github.com/utopia-php/abuse/tree/0.7.0"
"source": "https://github.com/utopia-php/abuse/tree/origin/timestamp-to-datetime"
},
"time": "2021-12-27T13:06:45+00:00"
"time": "2022-08-02T16:41:45+00:00"
},
{
"name": "utopia-php/analytics",
@ -1841,16 +1841,16 @@
},
{
"name": "utopia-php/audit",
"version": "0.8.0",
"version": "dev-origin/unix-to-datetime",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/audit.git",
"reference": "b46dc42614a69437c45eb229249b6a6d000122c1"
"reference": "670fd68fe069b6bcdda64c9b0df16d2a8411c4ba"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/audit/zipball/b46dc42614a69437c45eb229249b6a6d000122c1",
"reference": "b46dc42614a69437c45eb229249b6a6d000122c1",
"url": "https://api.github.com/repos/utopia-php/audit/zipball/670fd68fe069b6bcdda64c9b0df16d2a8411c4ba",
"reference": "670fd68fe069b6bcdda64c9b0df16d2a8411c4ba",
"shasum": ""
},
"require": {
@ -1888,9 +1888,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/audit/issues",
"source": "https://github.com/utopia-php/audit/tree/0.8.0"
"source": "https://github.com/utopia-php/audit/tree/origin/unix-to-datetime"
},
"time": "2021-12-27T13:05:56+00:00"
"time": "2022-08-02T16:38:13+00:00"
},
{
"name": "utopia-php/cache",
@ -2051,16 +2051,16 @@
},
{
"name": "utopia-php/database",
"version": "0.18.9",
"version": "0.19.0",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/database.git",
"reference": "227b3ca919149b7b0d6556c8effe9ee46ed081e6"
"reference": "207d9f2665bf2124797351dfdcc928a46a301b04"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/database/zipball/227b3ca919149b7b0d6556c8effe9ee46ed081e6",
"reference": "227b3ca919149b7b0d6556c8effe9ee46ed081e6",
"url": "https://api.github.com/repos/utopia-php/database/zipball/207d9f2665bf2124797351dfdcc928a46a301b04",
"reference": "207d9f2665bf2124797351dfdcc928a46a301b04",
"shasum": ""
},
"require": {
@ -2109,9 +2109,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/database/issues",
"source": "https://github.com/utopia-php/database/tree/0.18.9"
"source": "https://github.com/utopia-php/database/tree/0.19.0"
},
"time": "2022-07-19T09:42:53+00:00"
"time": "2022-08-01T11:51:01+00:00"
},
{
"name": "utopia-php/domains",
@ -5346,9 +5346,25 @@
"time": "2022-05-17T05:48:52+00:00"
}
],
"aliases": [],
"aliases": [
{
"package": "utopia-php/abuse",
"version": "dev-origin/timestamp-to-datetime",
"alias": "0.7.2",
"alias_normalized": "0.7.2.0"
},
{
"package": "utopia-php/audit",
"version": "dev-origin/unix-to-datetime",
"alias": "0.8.2",
"alias_normalized": "0.8.2.0"
}
],
"minimum-stability": "stable",
"stability-flags": [],
"stability-flags": {
"utopia-php/abuse": 20,
"utopia-php/audit": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {

View file

@ -103,7 +103,7 @@ services:
- ./phpunit.xml:/usr/src/code/phpunit.xml
- ./tests:/usr/src/code/tests
- ./app:/usr/src/code/app
- ./vendor/utopia-php/database:/usr/src/code/vendor/utopia-php/database
# - ./vendor/utopia-php/database:/usr/src/code/vendor/utopia-php/database
- ./docs:/usr/src/code/docs
- ./public:/usr/src/code/public
- ./src:/usr/src/code/src
@ -330,7 +330,7 @@ services:
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
- ./vendor/utopia-php/database:/usr/src/code/vendor/utopia-php/database
# - ./vendor/utopia-php/database:/usr/src/code/vendor/utopia-php/database
depends_on:
- redis
- mariadb

View file

@ -963,10 +963,12 @@ gc.splice(0,gcLen);}
return longest;}
function _alignPixel(chart,pixel,width){const devicePixelRatio=chart.currentDevicePixelRatio;const halfWidth=width!==0?Math.max(width/2,0.5):0;return Math.round((pixel-halfWidth)*devicePixelRatio)/devicePixelRatio+halfWidth;}
function clearCanvas(canvas,ctx){ctx=ctx||canvas.getContext('2d');ctx.save();ctx.resetTransform();ctx.clearRect(0,0,canvas.width,canvas.height);ctx.restore();}
function drawPoint(ctx,options,x,y){let type,xOffset,yOffset,size,cornerRadius;const style=options.pointStyle;const rotation=options.rotation;const radius=options.radius;let rad=(rotation||0)*RAD_PER_DEG;if(style&&typeof style==='object'){type=style.toString();if(type==='[object HTMLImageElement]'||type==='[object HTMLCanvasElement]'){ctx.save();ctx.translate(x,y);ctx.rotate(rad);ctx.drawImage(style,-style.width/2,-style.height/2,style.width,style.height);ctx.restore();return;}}
function drawPoint(ctx,options,x,y){drawPointLegend(ctx,options,x,y,null);}
function drawPointLegend(ctx,options,x,y,w){let type,xOffset,yOffset,size,cornerRadius,width;const style=options.pointStyle;const rotation=options.rotation;const radius=options.radius;let rad=(rotation||0)*RAD_PER_DEG;if(style&&typeof style==='object'){type=style.toString();if(type==='[object HTMLImageElement]'||type==='[object HTMLCanvasElement]'){ctx.save();ctx.translate(x,y);ctx.rotate(rad);ctx.drawImage(style,-style.width/2,-style.height/2,style.width,style.height);ctx.restore();return;}}
if(isNaN(radius)||radius<=0){return;}
ctx.beginPath();switch(style){default:ctx.arc(x,y,radius,0,TAU);ctx.closePath();break;case'triangle':ctx.moveTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);rad+=TWO_THIRDS_PI;ctx.lineTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);rad+=TWO_THIRDS_PI;ctx.lineTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);ctx.closePath();break;case'rectRounded':cornerRadius=radius*0.516;size=radius-cornerRadius;xOffset=Math.cos(rad+QUARTER_PI)*size;yOffset=Math.sin(rad+QUARTER_PI)*size;ctx.arc(x-xOffset,y-yOffset,cornerRadius,rad-PI,rad-HALF_PI);ctx.arc(x+yOffset,y-xOffset,cornerRadius,rad-HALF_PI,rad);ctx.arc(x+xOffset,y+yOffset,cornerRadius,rad,rad+HALF_PI);ctx.arc(x-yOffset,y+xOffset,cornerRadius,rad+HALF_PI,rad+PI);ctx.closePath();break;case'rect':if(!rotation){size=Math.SQRT1_2*radius;ctx.rect(x-size,y-size,2*size,2*size);break;}
rad+=QUARTER_PI;case'rectRot':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+yOffset,y-xOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.lineTo(x-yOffset,y+xOffset);ctx.closePath();break;case'crossRot':rad+=QUARTER_PI;case'cross':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);break;case'star':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);rad+=QUARTER_PI;xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);break;case'line':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);break;case'dash':ctx.moveTo(x,y);ctx.lineTo(x+Math.cos(rad)*radius,y+Math.sin(rad)*radius);break;}
ctx.beginPath();switch(style){default:if(w){ctx.ellipse(x,y,w/2,radius,0,0,TAU);}else{ctx.arc(x,y,radius,0,TAU);}
ctx.closePath();break;case'triangle':ctx.moveTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);rad+=TWO_THIRDS_PI;ctx.lineTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);rad+=TWO_THIRDS_PI;ctx.lineTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);ctx.closePath();break;case'rectRounded':cornerRadius=radius*0.516;size=radius-cornerRadius;xOffset=Math.cos(rad+QUARTER_PI)*size;yOffset=Math.sin(rad+QUARTER_PI)*size;ctx.arc(x-xOffset,y-yOffset,cornerRadius,rad-PI,rad-HALF_PI);ctx.arc(x+yOffset,y-xOffset,cornerRadius,rad-HALF_PI,rad);ctx.arc(x+xOffset,y+yOffset,cornerRadius,rad,rad+HALF_PI);ctx.arc(x-yOffset,y+xOffset,cornerRadius,rad+HALF_PI,rad+PI);ctx.closePath();break;case'rect':if(!rotation){size=Math.SQRT1_2*radius;width=w?w/2:size;ctx.rect(x-width,y-size,2*width,2*size);break;}
rad+=QUARTER_PI;case'rectRot':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+yOffset,y-xOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.lineTo(x-yOffset,y+xOffset);ctx.closePath();break;case'crossRot':rad+=QUARTER_PI;case'cross':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);break;case'star':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);rad+=QUARTER_PI;xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);break;case'line':xOffset=w?w/2:Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);break;case'dash':ctx.moveTo(x,y);ctx.lineTo(x+Math.cos(rad)*radius,y+Math.sin(rad)*radius);break;}
ctx.fill();if(options.borderWidth>0){ctx.stroke();}}
function _isPointInArea(point,area,margin){margin=margin||0.5;return!area||(point&&point.x>area.left-margin&&point.x<area.right+margin&&point.y>area.top-margin&&point.y<area.bottom+margin);}
function clipArea(ctx,area){ctx.save();ctx.beginPath();ctx.rect(area.left,area.top,area.right-area.left,area.bottom-area.top);ctx.clip();}
@ -1116,7 +1118,7 @@ if(start<i-1){addStyle(start,i-1,segment.loop,prevStyle);}}
return result;}
function readStyle(options){return{backgroundColor:options.backgroundColor,borderCapStyle:options.borderCapStyle,borderDash:options.borderDash,borderDashOffset:options.borderDashOffset,borderJoinStyle:options.borderJoinStyle,borderWidth:options.borderWidth,borderColor:options.borderColor};}
function styleChanged(style,prevStyle){return prevStyle&&JSON.stringify(style)!==JSON.stringify(prevStyle);}
var helpers=Object.freeze({__proto__:null,easingEffects:effects,isPatternOrGradient:isPatternOrGradient,color:color,getHoverColor:getHoverColor,noop:noop,uid:uid,isNullOrUndef:isNullOrUndef,isArray:isArray,isObject:isObject,isFinite:isNumberFinite,finiteOrDefault:finiteOrDefault,valueOrDefault:valueOrDefault,toPercentage:toPercentage,toDimension:toDimension,callback:callback,each:each,_elementsEqual:_elementsEqual,clone:clone,_merger:_merger,merge:merge,mergeIf:mergeIf,_mergerIf:_mergerIf,_deprecated:_deprecated,resolveObjectKey:resolveObjectKey,_capitalize:_capitalize,defined:defined,isFunction:isFunction,setsEqual:setsEqual,_isClickEvent:_isClickEvent,toFontString:toFontString,_measureText:_measureText,_longestText:_longestText,_alignPixel:_alignPixel,clearCanvas:clearCanvas,drawPoint:drawPoint,_isPointInArea:_isPointInArea,clipArea:clipArea,unclipArea:unclipArea,_steppedLineTo:_steppedLineTo,_bezierCurveTo:_bezierCurveTo,renderText:renderText,addRoundedRectPath:addRoundedRectPath,_lookup:_lookup,_lookupByKey:_lookupByKey,_rlookupByKey:_rlookupByKey,_filterBetween:_filterBetween,listenArrayEvents:listenArrayEvents,unlistenArrayEvents:unlistenArrayEvents,_arrayUnique:_arrayUnique,_createResolver:_createResolver,_attachContext:_attachContext,_descriptors:_descriptors,_parseObjectDataRadialScale:_parseObjectDataRadialScale,splineCurve:splineCurve,splineCurveMonotone:splineCurveMonotone,_updateBezierControlPoints:_updateBezierControlPoints,_isDomSupported:_isDomSupported,_getParentNode:_getParentNode,getStyle:getStyle,getRelativePosition:getRelativePosition,getMaximumSize:getMaximumSize,retinaScale:retinaScale,supportsEventListenerOptions:supportsEventListenerOptions,readUsedSize:readUsedSize,fontString:fontString,requestAnimFrame:requestAnimFrame,throttled:throttled,debounce:debounce,_toLeftRightCenter:_toLeftRightCenter,_alignStartEnd:_alignStartEnd,_textX:_textX,_pointInLine:_pointInLine,_steppedInterpolation:_steppedInterpolation,_bezierInterpolation:_bezierInterpolation,formatNumber:formatNumber,toLineHeight:toLineHeight,_readValueToProps:_readValueToProps,toTRBL:toTRBL,toTRBLCorners:toTRBLCorners,toPadding:toPadding,toFont:toFont,resolve:resolve,_addGrace:_addGrace,createContext:createContext,PI:PI,TAU:TAU,PITAU:PITAU,INFINITY:INFINITY,RAD_PER_DEG:RAD_PER_DEG,HALF_PI:HALF_PI,QUARTER_PI:QUARTER_PI,TWO_THIRDS_PI:TWO_THIRDS_PI,log10:log10,sign:sign,niceNum:niceNum,_factorize:_factorize,isNumber:isNumber,almostEquals:almostEquals,almostWhole:almostWhole,_setMinAndMaxByKey:_setMinAndMaxByKey,toRadians:toRadians,toDegrees:toDegrees,_decimalPlaces:_decimalPlaces,getAngleFromPoint:getAngleFromPoint,distanceBetweenPoints:distanceBetweenPoints,_angleDiff:_angleDiff,_normalizeAngle:_normalizeAngle,_angleBetween:_angleBetween,_limitValue:_limitValue,_int16Range:_int16Range,_isBetween:_isBetween,getRtlAdapter:getRtlAdapter,overrideTextDirection:overrideTextDirection,restoreTextDirection:restoreTextDirection,_boundSegment:_boundSegment,_boundSegments:_boundSegments,_computeSegments:_computeSegments});function binarySearch(metaset,axis,value,intersect){const{controller,data,_sorted}=metaset;const iScale=controller._cachedMeta.iScale;if(iScale&&axis===iScale.axis&&axis!=='r'&&_sorted&&data.length){const lookupMethod=iScale._reversePixels?_rlookupByKey:_lookupByKey;if(!intersect){return lookupMethod(data,axis,value);}else if(controller._sharedOptions){const el=data[0];const range=typeof el.getRange==='function'&&el.getRange(axis);if(range){const start=lookupMethod(data,axis,value-range);const end=lookupMethod(data,axis,value+range);return{lo:start.lo,hi:end.hi};}}}
var helpers=Object.freeze({__proto__:null,easingEffects:effects,isPatternOrGradient:isPatternOrGradient,color:color,getHoverColor:getHoverColor,noop:noop,uid:uid,isNullOrUndef:isNullOrUndef,isArray:isArray,isObject:isObject,isFinite:isNumberFinite,finiteOrDefault:finiteOrDefault,valueOrDefault:valueOrDefault,toPercentage:toPercentage,toDimension:toDimension,callback:callback,each:each,_elementsEqual:_elementsEqual,clone:clone,_merger:_merger,merge:merge,mergeIf:mergeIf,_mergerIf:_mergerIf,_deprecated:_deprecated,resolveObjectKey:resolveObjectKey,_capitalize:_capitalize,defined:defined,isFunction:isFunction,setsEqual:setsEqual,_isClickEvent:_isClickEvent,toFontString:toFontString,_measureText:_measureText,_longestText:_longestText,_alignPixel:_alignPixel,clearCanvas:clearCanvas,drawPoint:drawPoint,drawPointLegend:drawPointLegend,_isPointInArea:_isPointInArea,clipArea:clipArea,unclipArea:unclipArea,_steppedLineTo:_steppedLineTo,_bezierCurveTo:_bezierCurveTo,renderText:renderText,addRoundedRectPath:addRoundedRectPath,_lookup:_lookup,_lookupByKey:_lookupByKey,_rlookupByKey:_rlookupByKey,_filterBetween:_filterBetween,listenArrayEvents:listenArrayEvents,unlistenArrayEvents:unlistenArrayEvents,_arrayUnique:_arrayUnique,_createResolver:_createResolver,_attachContext:_attachContext,_descriptors:_descriptors,_parseObjectDataRadialScale:_parseObjectDataRadialScale,splineCurve:splineCurve,splineCurveMonotone:splineCurveMonotone,_updateBezierControlPoints:_updateBezierControlPoints,_isDomSupported:_isDomSupported,_getParentNode:_getParentNode,getStyle:getStyle,getRelativePosition:getRelativePosition,getMaximumSize:getMaximumSize,retinaScale:retinaScale,supportsEventListenerOptions:supportsEventListenerOptions,readUsedSize:readUsedSize,fontString:fontString,requestAnimFrame:requestAnimFrame,throttled:throttled,debounce:debounce,_toLeftRightCenter:_toLeftRightCenter,_alignStartEnd:_alignStartEnd,_textX:_textX,_pointInLine:_pointInLine,_steppedInterpolation:_steppedInterpolation,_bezierInterpolation:_bezierInterpolation,formatNumber:formatNumber,toLineHeight:toLineHeight,_readValueToProps:_readValueToProps,toTRBL:toTRBL,toTRBLCorners:toTRBLCorners,toPadding:toPadding,toFont:toFont,resolve:resolve,_addGrace:_addGrace,createContext:createContext,PI:PI,TAU:TAU,PITAU:PITAU,INFINITY:INFINITY,RAD_PER_DEG:RAD_PER_DEG,HALF_PI:HALF_PI,QUARTER_PI:QUARTER_PI,TWO_THIRDS_PI:TWO_THIRDS_PI,log10:log10,sign:sign,niceNum:niceNum,_factorize:_factorize,isNumber:isNumber,almostEquals:almostEquals,almostWhole:almostWhole,_setMinAndMaxByKey:_setMinAndMaxByKey,toRadians:toRadians,toDegrees:toDegrees,_decimalPlaces:_decimalPlaces,getAngleFromPoint:getAngleFromPoint,distanceBetweenPoints:distanceBetweenPoints,_angleDiff:_angleDiff,_normalizeAngle:_normalizeAngle,_angleBetween:_angleBetween,_limitValue:_limitValue,_int16Range:_int16Range,_isBetween:_isBetween,getRtlAdapter:getRtlAdapter,overrideTextDirection:overrideTextDirection,restoreTextDirection:restoreTextDirection,_boundSegment:_boundSegment,_boundSegments:_boundSegments,_computeSegments:_computeSegments});function binarySearch(metaset,axis,value,intersect){const{controller,data,_sorted}=metaset;const iScale=controller._cachedMeta.iScale;if(iScale&&axis===iScale.axis&&axis!=='r'&&_sorted&&data.length){const lookupMethod=iScale._reversePixels?_rlookupByKey:_lookupByKey;if(!intersect){return lookupMethod(data,axis,value);}else if(controller._sharedOptions){const el=data[0];const range=typeof el.getRange==='function'&&el.getRange(axis);if(range){const start=lookupMethod(data,axis,value-range);const end=lookupMethod(data,axis,value+range);return{lo:start.lo,hi:end.hi};}}}
return{lo:0,hi:data.length-1};}
function evaluateInteractionItems(chart,axis,position,handler,intersect){const metasets=chart.getSortedVisibleDatasetMetas();const value=position[axis];for(let i=0,ilen=metasets.length;i<ilen;++i){const{index,data}=metasets[i];const{lo,hi}=binarySearch(metasets[i],axis,value,intersect);for(let j=lo;j<=hi;++j){const element=data[j];if(!element.skip){handler(element,index,j);}}}}
function getDistanceMetricForAxis(axis){const useX=axis.indexOf('x')!==-1;const useY=axis.indexOf('y')!==-1;return function(pt1,pt2){const deltaX=useX?Math.abs(pt1.x-pt2.x):0;const deltaY=useY?Math.abs(pt1.y-pt2.y):0;return Math.sqrt(Math.pow(deltaX,2)+Math.pow(deltaY,2));};}
@ -1336,6 +1338,7 @@ return animations;}
getSharedOptions(options){if(!options.$shared){return;}
return this._sharedOptions||(this._sharedOptions=Object.assign({},options));}
includeOptions(mode,sharedOptions){return!sharedOptions||isDirectUpdateMode(mode)||this.chart._animationsDisabled;}
_getSharedOptions(start,mode){const firstOpts=this.resolveDataElementOptions(start,mode);const previouslySharedOptions=this._sharedOptions;const sharedOptions=this.getSharedOptions(firstOpts);const includeOptions=this.includeOptions(mode,sharedOptions)||(sharedOptions!==previouslySharedOptions);this.updateSharedOptions(sharedOptions,mode,firstOpts);return{sharedOptions,includeOptions};}
updateElement(element,index,properties,mode){if(isDirectUpdateMode(mode)){Object.assign(element,properties);}else{this._resolveAnimations(index,mode).update(element,properties);}}
updateSharedOptions(sharedOptions,mode,newOptions){if(sharedOptions&&!isDirectUpdateMode(mode)){this._resolveAnimations(undefined,mode).update(sharedOptions,newOptions);}}
_setStyle(element,index,mode,active){element.active=active;const options=this.getStyle(index,active);this._resolveAnimations(index,mode,active).update(element,{options:(!active&&this.getSharedOptions(options))||options});}
@ -1581,16 +1584,17 @@ _descriptors(chart){if(this._cache){return this._cache;}
const descriptors=this._cache=this._createDescriptors(chart);this._notifyStateChanges(chart);return descriptors;}
_createDescriptors(chart,all){const config=chart&&chart.config;const options=valueOrDefault(config.options&&config.options.plugins,{});const plugins=allPlugins(config);return options===false&&!all?[]:createDescriptors(chart,plugins,options,all);}
_notifyStateChanges(chart){const previousDescriptors=this._oldCache||[];const descriptors=this._cache;const diff=(a,b)=>a.filter(x=>!b.some(y=>x.plugin.id===y.plugin.id));this._notify(diff(previousDescriptors,descriptors),chart,'stop');this._notify(diff(descriptors,previousDescriptors),chart,'start');}}
function allPlugins(config){const plugins=[];const keys=Object.keys(registry.plugins.items);for(let i=0;i<keys.length;i++){plugins.push(registry.getPlugin(keys[i]));}
const local=config.plugins||[];for(let i=0;i<local.length;i++){const plugin=local[i];if(plugins.indexOf(plugin)===-1){plugins.push(plugin);}}
return plugins;}
function allPlugins(config){const localIds={};const plugins=[];const keys=Object.keys(registry.plugins.items);for(let i=0;i<keys.length;i++){plugins.push(registry.getPlugin(keys[i]));}
const local=config.plugins||[];for(let i=0;i<local.length;i++){const plugin=local[i];if(plugins.indexOf(plugin)===-1){plugins.push(plugin);localIds[plugin.id]=true;}}
return{plugins,localIds};}
function getOpts(options,all){if(!all&&options===false){return null;}
if(options===true){return{};}
return options;}
function createDescriptors(chart,plugins,options,all){const result=[];const context=chart.getContext();for(let i=0;i<plugins.length;i++){const plugin=plugins[i];const id=plugin.id;const opts=getOpts(options[id],all);if(opts===null){continue;}
result.push({plugin,options:pluginOpts(chart.config,plugin,opts,context)});}
function createDescriptors(chart,{plugins,localIds},options,all){const result=[];const context=chart.getContext();for(const plugin of plugins){const id=plugin.id;const opts=getOpts(options[id],all);if(opts===null){continue;}
result.push({plugin,options:pluginOpts(chart.config,{plugin,local:localIds[id]},opts,context)});}
return result;}
function pluginOpts(config,plugin,opts,context){const keys=config.pluginScopeKeys(plugin);const scopes=config.getOptionScopes(opts,keys);return config.createResolver(scopes,context,[''],{scriptable:false,indexable:false,allKeys:true});}
function pluginOpts(config,{plugin,local},opts,context){const keys=config.pluginScopeKeys(plugin);const scopes=config.getOptionScopes(opts,keys);if(local&&plugin.defaults){scopes.push(plugin.defaults);}
return config.createResolver(scopes,context,[''],{scriptable:false,indexable:false,allKeys:true});}
function getIndexAxis(type,options){const datasetDefaults=defaults.datasets[type]||{};const datasetOptions=(options.datasets||{})[type]||{};return datasetOptions.indexAxis||options.indexAxis||datasetDefaults.indexAxis||'x';}
function getAxisFromDefaultScaleID(id,indexAxis){let axis=id;if(id==='_index_'){axis=indexAxis;}else if(id==='_value_'){axis=indexAxis==='x'?'y':'x';}
return axis;}
@ -1639,7 +1643,7 @@ const cacheKey=prefixes.join();let cached=cache.get(cacheKey);if(!cached){const
return cached;}
const hasFunction=value=>isObject(value)&&Object.getOwnPropertyNames(value).reduce((acc,key)=>acc||isFunction(value[key]),false);function needContext(proxy,names){const{isScriptable,isIndexable}=_descriptors(proxy);for(const prop of names){const scriptable=isScriptable(prop);const indexable=isIndexable(prop);const value=(indexable||scriptable)&&proxy[prop];if((scriptable&&(isFunction(value)||hasFunction(value)))||(indexable&&isArray(value))){return true;}}
return false;}
var version="3.8.0";const KNOWN_POSITIONS=['top','bottom','left','right','chartArea'];function positionIsHorizontal(position,axis){return position==='top'||position==='bottom'||(KNOWN_POSITIONS.indexOf(position)===-1&&axis==='x');}
var version="3.8.2";const KNOWN_POSITIONS=['top','bottom','left','right','chartArea'];function positionIsHorizontal(position,axis){return position==='top'||position==='bottom'||(KNOWN_POSITIONS.indexOf(position)===-1&&axis==='x');}
function compare2Level(l1,l2){return function(a,b){return a[l1]===b[l1]?a[l2]-b[l2]:a[l1]-b[l1];};}
function onAnimationsComplete(context){const chart=context.chart;const animationOptions=chart.options.animation;chart.notifyPlugins('afterRender');callback(animationOptions&&animationOptions.onComplete,[context],chart);}
function onAnimationProgress(context){const chart=context.chart;const animationOptions=chart.options.animation;callback(animationOptions&&animationOptions.onProgress,[context],chart);}
@ -1650,7 +1654,7 @@ const instances={};const getChart=(key)=>{const canvas=getCanvas(key);return Obj
function determineLastEvent(e,lastEvent,inChartArea,isClick){if(!inChartArea||e.type==='mouseout'){return null;}
if(isClick){return lastEvent;}
return e;}
class Chart{constructor(item,userConfig){const config=this.config=new Config(userConfig);const initialCanvas=getCanvas(item);const existingChart=getChart(initialCanvas);if(existingChart){throw new Error('Canvas is already in use. Chart with ID \''+existingChart.id+'\''+' must be destroyed before the canvas can be reused.');}
class Chart{constructor(item,userConfig){const config=this.config=new Config(userConfig);const initialCanvas=getCanvas(item);const existingChart=getChart(initialCanvas);if(existingChart){throw new Error('Canvas is already in use. Chart with ID \''+existingChart.id+'\''+' must be destroyed before the canvas with ID \''+existingChart.canvas.id+'\' can be reused.');}
const options=config.createResolver(config.chartOptionScopes(),this.getContext());this.platform=new(config.platform||_detectPlatform(initialCanvas))();this.platform.updateConfig(config);const context=this.platform.acquireContext(initialCanvas,options.aspectRatio);const canvas=context&&context.canvas;const height=canvas&&canvas.height;const width=canvas&&canvas.width;this.id=uid();this.ctx=context;this.canvas=canvas;this.width=width;this.height=height;this._options=options;this._aspectRatio=this.aspectRatio;this._layers=[];this._metasets=[];this._stacks=undefined;this.boxes=[];this.currentDevicePixelRatio=undefined;this.chartArea=undefined;this._active=[];this._lastEvent=undefined;this._listeners={};this._responsiveListeners=undefined;this._sortedMetasets=[];this.scales={};this._plugins=new PluginService();this.$proxies={};this._hiddenIndices={};this.attached=false;this._animationsDisabled=undefined;this.$context=undefined;this._doResize=debounce(mode=>this.update(mode),options.resizeDelay||0);this._dataChanges=[];instances[this.id]=this;if(!context||!canvas){console.error("Failed to create chart: can't acquire context from the given item");return;}
animator.listen(this,'complete',onAnimationsComplete);animator.listen(this,'progress',onAnimationProgress);this._initialize();if(this.attached){this.update();}}
get aspectRatio(){const{options:{aspectRatio,maintainAspectRatio},width,height,_aspectRatio}=this;if(!isNullOrUndef(aspectRatio)){return aspectRatio;}
@ -1815,12 +1819,11 @@ getMaxOverflow(){return 0;}
getLabelAndValue(index){const meta=this._cachedMeta;const{iScale,vScale}=meta;const parsed=this.getParsed(index);const custom=parsed._custom;const value=isFloatBar(custom)?'['+custom.start+', '+custom.end+']':''+vScale.getLabelForValue(parsed[vScale.axis]);return{label:''+iScale.getLabelForValue(parsed[iScale.axis]),value};}
initialize(){this.enableOptionSharing=true;super.initialize();const meta=this._cachedMeta;meta.stack=this.getDataset().stack;}
update(mode){const meta=this._cachedMeta;this.updateElements(meta.data,0,meta.data.length,mode);}
updateElements(bars,start,count,mode){const reset=mode==='reset';const{index,_cachedMeta:{vScale}}=this;const base=vScale.getBasePixel();const horizontal=vScale.isHorizontal();const ruler=this._getRuler();const firstOpts=this.resolveDataElementOptions(start,mode);const sharedOptions=this.getSharedOptions(firstOpts);const includeOptions=this.includeOptions(mode,sharedOptions);this.updateSharedOptions(sharedOptions,mode,firstOpts);for(let i=start;i<start+count;i++){const parsed=this.getParsed(i);const vpixels=reset||isNullOrUndef(parsed[vScale.axis])?{base,head:base}:this._calculateBarValuePixels(i);const ipixels=this._calculateBarIndexPixels(i,ruler);const stack=(parsed._stacks||{})[vScale.axis];const properties={horizontal,base:vpixels.base,enableBorderRadius:!stack||isFloatBar(parsed._custom)||(index===stack._top||index===stack._bottom),x:horizontal?vpixels.head:ipixels.center,y:horizontal?ipixels.center:vpixels.head,height:horizontal?ipixels.size:Math.abs(vpixels.size),width:horizontal?Math.abs(vpixels.size):ipixels.size};if(includeOptions){properties.options=sharedOptions||this.resolveDataElementOptions(i,bars[i].active?'active':mode);}
updateElements(bars,start,count,mode){const reset=mode==='reset';const{index,_cachedMeta:{vScale}}=this;const base=vScale.getBasePixel();const horizontal=vScale.isHorizontal();const ruler=this._getRuler();const{sharedOptions,includeOptions}=this._getSharedOptions(start,mode);for(let i=start;i<start+count;i++){const parsed=this.getParsed(i);const vpixels=reset||isNullOrUndef(parsed[vScale.axis])?{base,head:base}:this._calculateBarValuePixels(i);const ipixels=this._calculateBarIndexPixels(i,ruler);const stack=(parsed._stacks||{})[vScale.axis];const properties={horizontal,base:vpixels.base,enableBorderRadius:!stack||isFloatBar(parsed._custom)||(index===stack._top||index===stack._bottom),x:horizontal?vpixels.head:ipixels.center,y:horizontal?ipixels.center:vpixels.head,height:horizontal?ipixels.size:Math.abs(vpixels.size),width:horizontal?Math.abs(vpixels.size):ipixels.size};if(includeOptions){properties.options=sharedOptions||this.resolveDataElementOptions(i,bars[i].active?'active':mode);}
const options=properties.options||bars[i].options;setBorderSkipped(properties,options,stack,index);setInflateAmount(properties,options,ruler.ratio);this.updateElement(bars[i],i,properties,mode);}}
_getStacks(last,dataIndex){const meta=this._cachedMeta;const iScale=meta.iScale;const metasets=iScale.getMatchingVisibleMetas(this._type);const stacked=iScale.options.stacked;const ilen=metasets.length;const stacks=[];let i,item;for(i=0;i<ilen;++i){item=metasets[i];if(!item.controller.options.grouped){continue;}
if(typeof dataIndex!=='undefined'){const val=item.controller.getParsed(dataIndex)[item.controller._cachedMeta.vScale.axis];if(isNullOrUndef(val)||isNaN(val)){continue;}}
if(stacked===false||stacks.indexOf(item.stack)===-1||(stacked===undefined&&item.stack===undefined)){stacks.push(item.stack);}
if(item.index===last){break;}}
_getStacks(last,dataIndex){const{iScale}=this._cachedMeta;const metasets=iScale.getMatchingVisibleMetas(this._type).filter(meta=>meta.controller.options.grouped);const stacked=iScale.options.stacked;const stacks=[];const skipNull=(meta)=>{const parsed=meta.controller.getParsed(dataIndex);const val=parsed&&parsed[meta.vScale.axis];if(isNullOrUndef(val)||isNaN(val)){return true;}};for(const meta of metasets){if(dataIndex!==undefined&&skipNull(meta)){continue;}
if(stacked===false||stacks.indexOf(meta.stack)===-1||(stacked===undefined&&meta.stack===undefined)){stacks.push(meta.stack);}
if(meta.index===last){break;}}
if(!stacks.length){stacks.push(undefined);}
return stacks;}
_getStackCount(index){return this._getStacks(undefined,index).length;}
@ -1849,9 +1852,8 @@ getMaxOverflow(){const data=this._cachedMeta.data;let max=0;for(let i=data.lengt
return max>0&&max;}
getLabelAndValue(index){const meta=this._cachedMeta;const{xScale,yScale}=meta;const parsed=this.getParsed(index);const x=xScale.getLabelForValue(parsed.x);const y=yScale.getLabelForValue(parsed.y);const r=parsed._custom;return{label:meta.label,value:'('+x+', '+y+(r?', '+r:'')+')'};}
update(mode){const points=this._cachedMeta.data;this.updateElements(points,0,points.length,mode);}
updateElements(points,start,count,mode){const reset=mode==='reset';const{iScale,vScale}=this._cachedMeta;const firstOpts=this.resolveDataElementOptions(start,mode);const sharedOptions=this.getSharedOptions(firstOpts);const includeOptions=this.includeOptions(mode,sharedOptions);const iAxis=iScale.axis;const vAxis=vScale.axis;for(let i=start;i<start+count;i++){const point=points[i];const parsed=!reset&&this.getParsed(i);const properties={};const iPixel=properties[iAxis]=reset?iScale.getPixelForDecimal(0.5):iScale.getPixelForValue(parsed[iAxis]);const vPixel=properties[vAxis]=reset?vScale.getBasePixel():vScale.getPixelForValue(parsed[vAxis]);properties.skip=isNaN(iPixel)||isNaN(vPixel);if(includeOptions){properties.options=this.resolveDataElementOptions(i,point.active?'active':mode);if(reset){properties.options.radius=0;}}
this.updateElement(point,i,properties,mode);}
this.updateSharedOptions(sharedOptions,mode,firstOpts);}
updateElements(points,start,count,mode){const reset=mode==='reset';const{iScale,vScale}=this._cachedMeta;const{sharedOptions,includeOptions}=this._getSharedOptions(start,mode);const iAxis=iScale.axis;const vAxis=vScale.axis;for(let i=start;i<start+count;i++){const point=points[i];const parsed=!reset&&this.getParsed(i);const properties={};const iPixel=properties[iAxis]=reset?iScale.getPixelForDecimal(0.5):iScale.getPixelForValue(parsed[iAxis]);const vPixel=properties[vAxis]=reset?vScale.getBasePixel():vScale.getPixelForValue(parsed[vAxis]);properties.skip=isNaN(iPixel)||isNaN(vPixel);if(includeOptions){properties.options=sharedOptions||this.resolveDataElementOptions(i,point.active?'active':mode);if(reset){properties.options.radius=0;}}
this.updateElement(point,i,properties,mode);}}
resolveDataElementOptions(index,mode){const parsed=this.getParsed(index);let values=super.resolveDataElementOptions(index,mode);if(values.$shared){values=Object.assign({},values,{$shared:false});}
const radius=values.radius;if(mode!=='active'){values.radius=0;}
values.radius+=valueOrDefault(parsed&&parsed._custom,radius);return values;}}
@ -1868,10 +1870,9 @@ return{rotation:min,circumference:max-min,};}
update(mode){const chart=this.chart;const{chartArea}=chart;const meta=this._cachedMeta;const arcs=meta.data;const spacing=this.getMaxBorderWidth()+this.getMaxOffset(arcs)+this.options.spacing;const maxSize=Math.max((Math.min(chartArea.width,chartArea.height)-spacing)/2,0);const cutout=Math.min(toPercentage(this.options.cutout,maxSize),1);const chartWeight=this._getRingWeight(this.index);const{circumference,rotation}=this._getRotationExtents();const{ratioX,ratioY,offsetX,offsetY}=getRatioAndOffset(rotation,circumference,cutout);const maxWidth=(chartArea.width-spacing)/ratioX;const maxHeight=(chartArea.height-spacing)/ratioY;const maxRadius=Math.max(Math.min(maxWidth,maxHeight)/2,0);const outerRadius=toDimension(this.options.radius,maxRadius);const innerRadius=Math.max(outerRadius*cutout,0);const radiusLength=(outerRadius-innerRadius)/this._getVisibleDatasetWeightTotal();this.offsetX=offsetX*outerRadius;this.offsetY=offsetY*outerRadius;meta.total=this.calculateTotal();this.outerRadius=outerRadius-radiusLength*this._getRingWeightOffset(this.index);this.innerRadius=Math.max(this.outerRadius-radiusLength*chartWeight,0);this.updateElements(arcs,0,arcs.length,mode);}
_circumference(i,reset){const opts=this.options;const meta=this._cachedMeta;const circumference=this._getCircumference();if((reset&&opts.animation.animateRotate)||!this.chart.getDataVisibility(i)||meta._parsed[i]===null||meta.data[i].hidden){return 0;}
return this.calculateCircumference(meta._parsed[i]*circumference/TAU);}
updateElements(arcs,start,count,mode){const reset=mode==='reset';const chart=this.chart;const chartArea=chart.chartArea;const opts=chart.options;const animationOpts=opts.animation;const centerX=(chartArea.left+chartArea.right)/2;const centerY=(chartArea.top+chartArea.bottom)/2;const animateScale=reset&&animationOpts.animateScale;const innerRadius=animateScale?0:this.innerRadius;const outerRadius=animateScale?0:this.outerRadius;const firstOpts=this.resolveDataElementOptions(start,mode);const sharedOptions=this.getSharedOptions(firstOpts);const includeOptions=this.includeOptions(mode,sharedOptions);let startAngle=this._getRotation();let i;for(i=0;i<start;++i){startAngle+=this._circumference(i,reset);}
updateElements(arcs,start,count,mode){const reset=mode==='reset';const chart=this.chart;const chartArea=chart.chartArea;const opts=chart.options;const animationOpts=opts.animation;const centerX=(chartArea.left+chartArea.right)/2;const centerY=(chartArea.top+chartArea.bottom)/2;const animateScale=reset&&animationOpts.animateScale;const innerRadius=animateScale?0:this.innerRadius;const outerRadius=animateScale?0:this.outerRadius;const{sharedOptions,includeOptions}=this._getSharedOptions(start,mode);let startAngle=this._getRotation();let i;for(i=0;i<start;++i){startAngle+=this._circumference(i,reset);}
for(i=start;i<start+count;++i){const circumference=this._circumference(i,reset);const arc=arcs[i];const properties={x:centerX+this.offsetX,y:centerY+this.offsetY,startAngle,endAngle:startAngle+circumference,circumference,outerRadius,innerRadius};if(includeOptions){properties.options=sharedOptions||this.resolveDataElementOptions(i,arc.active?'active':mode);}
startAngle+=circumference;this.updateElement(arc,i,properties,mode);}
this.updateSharedOptions(sharedOptions,mode,firstOpts);}
startAngle+=circumference;this.updateElement(arc,i,properties,mode);}}
calculateTotal(){const meta=this._cachedMeta;const metaData=meta.data;let total=0;let i;for(i=0;i<metaData.length;i++){const value=meta._parsed[i];if(value!==null&&!isNaN(value)&&this.chart.getDataVisibility(i)&&!metaData[i].hidden){total+=Math.abs(value);}}
return total;}
calculateCircumference(value){const total=this._cachedMeta.total;if(total>0&&!isNaN(value)){return TAU*(Math.abs(value)/total);}
@ -1893,11 +1894,10 @@ return dataLabel;}}}}};class LineController extends DatasetController{initialize
update(mode){const meta=this._cachedMeta;const{dataset:line,data:points=[],_dataset}=meta;const animationsDisabled=this.chart._animationsDisabled;let{start,count}=getStartAndCountOfVisiblePoints(meta,points,animationsDisabled);this._drawStart=start;this._drawCount=count;if(scaleRangesChanged(meta)){start=0;count=points.length;}
line._chart=this.chart;line._datasetIndex=this.index;line._decimated=!!_dataset._decimated;line.points=points;const options=this.resolveDatasetElementOptions(mode);if(!this.options.showLine){options.borderWidth=0;}
options.segment=this.options.segment;this.updateElement(line,undefined,{animated:!animationsDisabled,options},mode);this.updateElements(points,start,count,mode);}
updateElements(points,start,count,mode){const reset=mode==='reset';const{iScale,vScale,_stacked,_dataset}=this._cachedMeta;const firstOpts=this.resolveDataElementOptions(start,mode);const sharedOptions=this.getSharedOptions(firstOpts);const includeOptions=this.includeOptions(mode,sharedOptions);const iAxis=iScale.axis;const vAxis=vScale.axis;const{spanGaps,segment}=this.options;const maxGapLength=isNumber(spanGaps)?spanGaps:Number.POSITIVE_INFINITY;const directUpdate=this.chart._animationsDisabled||reset||mode==='none';let prevParsed=start>0&&this.getParsed(start-1);for(let i=start;i<start+count;++i){const point=points[i];const parsed=this.getParsed(i);const properties=directUpdate?point:{};const nullData=isNullOrUndef(parsed[vAxis]);const iPixel=properties[iAxis]=iScale.getPixelForValue(parsed[iAxis],i);const vPixel=properties[vAxis]=reset||nullData?vScale.getBasePixel():vScale.getPixelForValue(_stacked?this.applyStack(vScale,parsed,_stacked):parsed[vAxis],i);properties.skip=isNaN(iPixel)||isNaN(vPixel)||nullData;properties.stop=i>0&&(Math.abs(parsed[iAxis]-prevParsed[iAxis]))>maxGapLength;if(segment){properties.parsed=parsed;properties.raw=_dataset.data[i];}
updateElements(points,start,count,mode){const reset=mode==='reset';const{iScale,vScale,_stacked,_dataset}=this._cachedMeta;const{sharedOptions,includeOptions}=this._getSharedOptions(start,mode);const iAxis=iScale.axis;const vAxis=vScale.axis;const{spanGaps,segment}=this.options;const maxGapLength=isNumber(spanGaps)?spanGaps:Number.POSITIVE_INFINITY;const directUpdate=this.chart._animationsDisabled||reset||mode==='none';let prevParsed=start>0&&this.getParsed(start-1);for(let i=start;i<start+count;++i){const point=points[i];const parsed=this.getParsed(i);const properties=directUpdate?point:{};const nullData=isNullOrUndef(parsed[vAxis]);const iPixel=properties[iAxis]=iScale.getPixelForValue(parsed[iAxis],i);const vPixel=properties[vAxis]=reset||nullData?vScale.getBasePixel():vScale.getPixelForValue(_stacked?this.applyStack(vScale,parsed,_stacked):parsed[vAxis],i);properties.skip=isNaN(iPixel)||isNaN(vPixel)||nullData;properties.stop=i>0&&(Math.abs(parsed[iAxis]-prevParsed[iAxis]))>maxGapLength;if(segment){properties.parsed=parsed;properties.raw=_dataset.data[i];}
if(includeOptions){properties.options=sharedOptions||this.resolveDataElementOptions(i,point.active?'active':mode);}
if(!directUpdate){this.updateElement(point,i,properties,mode);}
prevParsed=parsed;}
this.updateSharedOptions(sharedOptions,mode,firstOpts);}
prevParsed=parsed;}}
getMaxOverflow(){const meta=this._cachedMeta;const dataset=meta.dataset;const border=dataset.options&&dataset.options.borderWidth||0;const data=meta.data||[];if(!data.length){return border;}
const firstPoint=data[0].size(this.resolveDataElementOptions(0));const lastPoint=data[data.length-1].size(this.resolveDataElementOptions(data.length-1));return Math.max(border,firstPoint,lastPoint)/2;}
draw(){const meta=this._cachedMeta;meta.dataset.updateControlPoints(this.chart.chartArea,meta.iScale.axis);super.draw();}}
@ -2064,6 +2064,7 @@ function _getEdge(a,b,prop,fn){if(a&&b){return fn(a[prop],b[prop]);}
return a?a[prop]:b?b[prop]:0;}
function _createBoundaryLine(boundary,line){let points=[];let _loop=false;if(isArray(boundary)){_loop=true;points=boundary;}else{points=_pointsFromSegments(boundary,line);}
return points.length?new LineElement({points,options:{tension:0},_loop,_fullLoop:_loop}):null;}
function _shouldApplyFill(source){return source&&source.fill!==false;}
function _resolveTarget(sources,index,propagate){const source=sources[index];let fill=source.fill;const visited=[index];let target;if(!propagate){return fill;}
while(fill!==false&&visited.indexOf(fill)===-1){if(!isNumberFinite(fill)){return fill;}
target=sources[fill];if(!target){return false;}
@ -2126,9 +2127,9 @@ var index={id:'filler',afterDatasetsUpdate(chart,_args,options){const count=(cha
meta.$filler=source;sources.push(source);}
for(i=0;i<count;++i){source=sources[i];if(!source||source.fill===false){continue;}
source.fill=_resolveTarget(sources,i,options.propagate);}},beforeDraw(chart,_args,options){const draw=options.drawTime==='beforeDraw';const metasets=chart.getSortedVisibleDatasetMetas();const area=chart.chartArea;for(let i=metasets.length-1;i>=0;--i){const source=metasets[i].$filler;if(!source){continue;}
source.line.updateControlPoints(area,source.axis);if(draw){_drawfill(chart.ctx,source,area);}}},beforeDatasetsDraw(chart,_args,options){if(options.drawTime!=='beforeDatasetsDraw'){return;}
const metasets=chart.getSortedVisibleDatasetMetas();for(let i=metasets.length-1;i>=0;--i){const source=metasets[i].$filler;if(source){_drawfill(chart.ctx,source,chart.chartArea);}}},beforeDatasetDraw(chart,args,options){const source=args.meta.$filler;if(!source||source.fill===false||options.drawTime!=='beforeDatasetDraw'){return;}
_drawfill(chart.ctx,source,chart.chartArea);},defaults:{propagate:true,drawTime:'beforeDatasetDraw'}};const getBoxSize=(labelOpts,fontSize)=>{let{boxHeight=fontSize,boxWidth=fontSize}=labelOpts;if(labelOpts.usePointStyle){boxHeight=Math.min(boxHeight,fontSize);boxWidth=Math.min(boxWidth,fontSize);}
source.line.updateControlPoints(area,source.axis);if(draw&&source.fill){_drawfill(chart.ctx,source,area);}}},beforeDatasetsDraw(chart,_args,options){if(options.drawTime!=='beforeDatasetsDraw'){return;}
const metasets=chart.getSortedVisibleDatasetMetas();for(let i=metasets.length-1;i>=0;--i){const source=metasets[i].$filler;if(_shouldApplyFill(source)){_drawfill(chart.ctx,source,chart.chartArea);}}},beforeDatasetDraw(chart,args,options){const source=args.meta.$filler;if(!_shouldApplyFill(source)||options.drawTime!=='beforeDatasetDraw'){return;}
_drawfill(chart.ctx,source,chart.chartArea);},defaults:{propagate:true,drawTime:'beforeDatasetDraw'}};const getBoxSize=(labelOpts,fontSize)=>{let{boxHeight=fontSize,boxWidth=fontSize}=labelOpts;if(labelOpts.usePointStyle){boxHeight=Math.min(boxHeight,fontSize);boxWidth=labelOpts.pointStyleWidth||Math.min(boxWidth,fontSize);}
return{boxWidth,boxHeight,itemHeight:Math.max(fontSize,boxHeight)};};const itemsEqual=(a,b)=>a!==null&&b!==null&&a.datasetIndex===b.datasetIndex&&a.index===b.index;class Legend extends Element{constructor(config){super();this._added=false;this.legendHitBoxes=[];this._hoveredItem=null;this.doughnutMode=false;this.chart=config.chart;this.options=config.options;this.ctx=config.ctx;this.legendItems=undefined;this.columnSizes=undefined;this.lineWidths=undefined;this.maxHeight=undefined;this.maxWidth=undefined;this.top=undefined;this.bottom=undefined;this.left=undefined;this.right=undefined;this.height=undefined;this.width=undefined;this._margins=undefined;this.position=undefined;this.weight=undefined;this.fullSize=undefined;}
update(maxWidth,maxHeight,margins){this.maxWidth=maxWidth;this.maxHeight=maxHeight;this._margins=margins;this.setDimensions();this.buildLabels();this.fit();}
setDimensions(){if(this.isHorizontal()){this.width=this.maxWidth;this.left=this._margins.left;this.right=this.width;}else{this.height=this.maxHeight;this.top=this._margins.top;this.bottom=this.height;}}
@ -2150,7 +2151,7 @@ hitbox.top=top;hitbox.left+=this.left+padding;hitbox.left=rtlHelper.leftForLtr(r
isHorizontal(){return this.options.position==='top'||this.options.position==='bottom';}
draw(){if(this.options.display){const ctx=this.ctx;clipArea(ctx,this);this._draw();unclipArea(ctx);}}
_draw(){const{options:opts,columnSizes,lineWidths,ctx}=this;const{align,labels:labelOpts}=opts;const defaultColor=defaults.color;const rtlHelper=getRtlAdapter(opts.rtl,this.left,this.width);const labelFont=toFont(labelOpts.font);const{color:fontColor,padding}=labelOpts;const fontSize=labelFont.size;const halfFontSize=fontSize/2;let cursor;this.drawTitle();ctx.textAlign=rtlHelper.textAlign('left');ctx.textBaseline='middle';ctx.lineWidth=0.5;ctx.font=labelFont.string;const{boxWidth,boxHeight,itemHeight}=getBoxSize(labelOpts,fontSize);const drawLegendBox=function(x,y,legendItem){if(isNaN(boxWidth)||boxWidth<=0||isNaN(boxHeight)||boxHeight<0){return;}
ctx.save();const lineWidth=valueOrDefault(legendItem.lineWidth,1);ctx.fillStyle=valueOrDefault(legendItem.fillStyle,defaultColor);ctx.lineCap=valueOrDefault(legendItem.lineCap,'butt');ctx.lineDashOffset=valueOrDefault(legendItem.lineDashOffset,0);ctx.lineJoin=valueOrDefault(legendItem.lineJoin,'miter');ctx.lineWidth=lineWidth;ctx.strokeStyle=valueOrDefault(legendItem.strokeStyle,defaultColor);ctx.setLineDash(valueOrDefault(legendItem.lineDash,[]));if(labelOpts.usePointStyle){const drawOptions={radius:boxWidth*Math.SQRT2/2,pointStyle:legendItem.pointStyle,rotation:legendItem.rotation,borderWidth:lineWidth};const centerX=rtlHelper.xPlus(x,boxWidth/2);const centerY=y+halfFontSize;drawPoint(ctx,drawOptions,centerX,centerY);}else{const yBoxTop=y+Math.max((fontSize-boxHeight)/2,0);const xBoxLeft=rtlHelper.leftForLtr(x,boxWidth);const borderRadius=toTRBLCorners(legendItem.borderRadius);ctx.beginPath();if(Object.values(borderRadius).some(v=>v!==0)){addRoundedRectPath(ctx,{x:xBoxLeft,y:yBoxTop,w:boxWidth,h:boxHeight,radius:borderRadius,});}else{ctx.rect(xBoxLeft,yBoxTop,boxWidth,boxHeight);}
ctx.save();const lineWidth=valueOrDefault(legendItem.lineWidth,1);ctx.fillStyle=valueOrDefault(legendItem.fillStyle,defaultColor);ctx.lineCap=valueOrDefault(legendItem.lineCap,'butt');ctx.lineDashOffset=valueOrDefault(legendItem.lineDashOffset,0);ctx.lineJoin=valueOrDefault(legendItem.lineJoin,'miter');ctx.lineWidth=lineWidth;ctx.strokeStyle=valueOrDefault(legendItem.strokeStyle,defaultColor);ctx.setLineDash(valueOrDefault(legendItem.lineDash,[]));if(labelOpts.usePointStyle){const drawOptions={radius:boxHeight*Math.SQRT2/2,pointStyle:legendItem.pointStyle,rotation:legendItem.rotation,borderWidth:lineWidth};const centerX=rtlHelper.xPlus(x,boxWidth/2);const centerY=y+halfFontSize;drawPointLegend(ctx,drawOptions,centerX,centerY,boxWidth);}else{const yBoxTop=y+Math.max((fontSize-boxHeight)/2,0);const xBoxLeft=rtlHelper.leftForLtr(x,boxWidth);const borderRadius=toTRBLCorners(legendItem.borderRadius);ctx.beginPath();if(Object.values(borderRadius).some(v=>v!==0)){addRoundedRectPath(ctx,{x:xBoxLeft,y:yBoxTop,w:boxWidth,h:boxHeight,radius:borderRadius,});}else{ctx.rect(xBoxLeft,yBoxTop,boxWidth,boxHeight);}
ctx.fill();if(lineWidth!==0){ctx.stroke();}}
ctx.restore();};const fillText=function(x,y,legendItem){renderText(ctx,legendItem.text,x,y+(itemHeight/2),labelFont,{strikethrough:legendItem.hidden,textAlign:rtlHelper.textAlign(legendItem.textAlign)});};const isHorizontal=this.isHorizontal();const titleHeight=this._computeTitleHeight();if(isHorizontal){cursor={x:_alignStartEnd(align,this.left+padding,this.right-lineWidths[0]),y:this.top+padding+titleHeight,line:0};}else{cursor={x:this.left+padding,y:_alignStartEnd(align,this.top+titleHeight+padding,this.bottom-columnSizes[0].height),line:0};}
overrideTextDirection(this.ctx,opts.textDirection);const lineHeight=itemHeight+padding;this.legendItems.forEach((legendItem,i)=>{ctx.strokeStyle=legendItem.fontColor||fontColor;ctx.fillStyle=legendItem.fontColor||fontColor;const textWidth=ctx.measureText(legendItem.text).width;const textAlign=rtlHelper.textAlign(legendItem.textAlign||(legendItem.textAlign=labelOpts.textAlign));const width=boxWidth+halfFontSize+textWidth;let x=cursor.x;let y=cursor.y;rtlHelper.setWidth(this.width);if(isHorizontal){if(i>0&&x+width+padding>this.right){y=cursor.y+=lineHeight;cursor.line++;x=cursor.x=_alignStartEnd(align,this.left+padding,this.right-lineWidths[cursor.line]);}}else if(i>0&&y+lineHeight>this.bottom){x=cursor.x=x+columnSizes[cursor.line].width+padding;cursor.line++;y=cursor.y=_alignStartEnd(align,this.top+titleHeight+padding,this.bottom-columnSizes[cursor.line].height);}
@ -2240,7 +2241,7 @@ if(yAlign==='top'){y1=ptY;y2=y1-caretSize;x1=x2-caretSize;x3=x2+caretSize;}else{
y3=y1;}
return{x1,x2,x3,y1,y2,y3};}
drawTitle(pt,ctx,options){const title=this.title;const length=title.length;let titleFont,titleSpacing,i;if(length){const rtlHelper=getRtlAdapter(options.rtl,this.x,this.width);pt.x=getAlignedX(this,options.titleAlign,options);ctx.textAlign=rtlHelper.textAlign(options.titleAlign);ctx.textBaseline='middle';titleFont=toFont(options.titleFont);titleSpacing=options.titleSpacing;ctx.fillStyle=options.titleColor;ctx.font=titleFont.string;for(i=0;i<length;++i){ctx.fillText(title[i],rtlHelper.x(pt.x),pt.y+titleFont.lineHeight/2);pt.y+=titleFont.lineHeight+titleSpacing;if(i+1===length){pt.y+=options.titleMarginBottom-titleSpacing;}}}}
_drawColorBox(ctx,pt,i,rtlHelper,options){const labelColors=this.labelColors[i];const labelPointStyle=this.labelPointStyles[i];const{boxHeight,boxWidth,boxPadding}=options;const bodyFont=toFont(options.bodyFont);const colorX=getAlignedX(this,'left',options);const rtlColorX=rtlHelper.x(colorX);const yOffSet=boxHeight<bodyFont.lineHeight?(bodyFont.lineHeight-boxHeight)/2:0;const colorY=pt.y+yOffSet;if(options.usePointStyle){const drawOptions={radius:Math.min(boxWidth,boxHeight)/2,pointStyle:labelPointStyle.pointStyle,rotation:labelPointStyle.rotation,borderWidth:1};const centerX=rtlHelper.leftForLtr(rtlColorX,boxWidth)+boxWidth/2;const centerY=colorY+boxHeight/2;ctx.strokeStyle=options.multiKeyBackground;ctx.fillStyle=options.multiKeyBackground;drawPoint(ctx,drawOptions,centerX,centerY);ctx.strokeStyle=labelColors.borderColor;ctx.fillStyle=labelColors.backgroundColor;drawPoint(ctx,drawOptions,centerX,centerY);}else{ctx.lineWidth=labelColors.borderWidth||1;ctx.strokeStyle=labelColors.borderColor;ctx.setLineDash(labelColors.borderDash||[]);ctx.lineDashOffset=labelColors.borderDashOffset||0;const outerX=rtlHelper.leftForLtr(rtlColorX,boxWidth-boxPadding);const innerX=rtlHelper.leftForLtr(rtlHelper.xPlus(rtlColorX,1),boxWidth-boxPadding-2);const borderRadius=toTRBLCorners(labelColors.borderRadius);if(Object.values(borderRadius).some(v=>v!==0)){ctx.beginPath();ctx.fillStyle=options.multiKeyBackground;addRoundedRectPath(ctx,{x:outerX,y:colorY,w:boxWidth,h:boxHeight,radius:borderRadius,});ctx.fill();ctx.stroke();ctx.fillStyle=labelColors.backgroundColor;ctx.beginPath();addRoundedRectPath(ctx,{x:innerX,y:colorY+1,w:boxWidth-2,h:boxHeight-2,radius:borderRadius,});ctx.fill();}else{ctx.fillStyle=options.multiKeyBackground;ctx.fillRect(outerX,colorY,boxWidth,boxHeight);ctx.strokeRect(outerX,colorY,boxWidth,boxHeight);ctx.fillStyle=labelColors.backgroundColor;ctx.fillRect(innerX,colorY+1,boxWidth-2,boxHeight-2);}}
_drawColorBox(ctx,pt,i,rtlHelper,options){const labelColors=this.labelColors[i];const labelPointStyle=this.labelPointStyles[i];const{boxHeight,boxWidth,boxPadding}=options;const bodyFont=toFont(options.bodyFont);const colorX=getAlignedX(this,'left',options);const rtlColorX=rtlHelper.x(colorX);const yOffSet=boxHeight<bodyFont.lineHeight?(bodyFont.lineHeight-boxHeight)/2:0;const colorY=pt.y+yOffSet;if(options.usePointStyle){const drawOptions={radius:Math.min(boxWidth,boxHeight)/2,pointStyle:labelPointStyle.pointStyle,rotation:labelPointStyle.rotation,borderWidth:1};const centerX=rtlHelper.leftForLtr(rtlColorX,boxWidth)+boxWidth/2;const centerY=colorY+boxHeight/2;ctx.strokeStyle=options.multiKeyBackground;ctx.fillStyle=options.multiKeyBackground;drawPoint(ctx,drawOptions,centerX,centerY);ctx.strokeStyle=labelColors.borderColor;ctx.fillStyle=labelColors.backgroundColor;drawPoint(ctx,drawOptions,centerX,centerY);}else{ctx.lineWidth=isObject(labelColors.borderWidth)?Math.max(...Object.values(labelColors.borderWidth)):(labelColors.borderWidth||1);ctx.strokeStyle=labelColors.borderColor;ctx.setLineDash(labelColors.borderDash||[]);ctx.lineDashOffset=labelColors.borderDashOffset||0;const outerX=rtlHelper.leftForLtr(rtlColorX,boxWidth-boxPadding);const innerX=rtlHelper.leftForLtr(rtlHelper.xPlus(rtlColorX,1),boxWidth-boxPadding-2);const borderRadius=toTRBLCorners(labelColors.borderRadius);if(Object.values(borderRadius).some(v=>v!==0)){ctx.beginPath();ctx.fillStyle=options.multiKeyBackground;addRoundedRectPath(ctx,{x:outerX,y:colorY,w:boxWidth,h:boxHeight,radius:borderRadius,});ctx.fill();ctx.stroke();ctx.fillStyle=labelColors.backgroundColor;ctx.beginPath();addRoundedRectPath(ctx,{x:innerX,y:colorY+1,w:boxWidth-2,h:boxHeight-2,radius:borderRadius,});ctx.fill();}else{ctx.fillStyle=options.multiKeyBackground;ctx.fillRect(outerX,colorY,boxWidth,boxHeight);ctx.strokeRect(outerX,colorY,boxWidth,boxHeight);ctx.fillStyle=labelColors.backgroundColor;ctx.fillRect(innerX,colorY+1,boxWidth-2,boxHeight-2);}}
ctx.fillStyle=this.labelTextColors[i];}
drawBody(pt,ctx,options){const{body}=this;const{bodySpacing,bodyAlign,displayColors,boxHeight,boxWidth,boxPadding}=options;const bodyFont=toFont(options.bodyFont);let bodyLineHeight=bodyFont.lineHeight;let xLinePadding=0;const rtlHelper=getRtlAdapter(options.rtl,this.x,this.width);const fillLineOfText=function(line){ctx.fillText(line,rtlHelper.x(pt.x+xLinePadding),pt.y+bodyLineHeight/2);pt.y+=bodyLineHeight+bodySpacing;};const bodyAlignForCalculation=rtlHelper.textAlign(bodyAlign);let bodyItem,textColor,lines,i,j,ilen,jlen;ctx.textAlign=bodyAlign;ctx.textBaseline='middle';ctx.font=bodyFont.string;pt.x=getAlignedX(this,bodyAlignForCalculation,options);ctx.fillStyle=options.bodyColor;each(this.beforeBody,fillLineOfText);xLinePadding=displayColors&&bodyAlignForCalculation!=='right'?bodyAlign==='center'?(boxWidth/2+boxPadding):(boxWidth+2+boxPadding):0;for(i=0,ilen=body.length;i<ilen;++i){bodyItem=body[i];textColor=this.labelTextColors[i];ctx.fillStyle=textColor;each(bodyItem.before,fillLineOfText);lines=bodyItem.lines;if(displayColors&&lines.length){this._drawColorBox(ctx,pt,i,rtlHelper,options);bodyLineHeight=Math.max(bodyFont.lineHeight,boxHeight);}
for(j=0,jlen=lines.length;j<jlen;++j){fillLineOfText(lines[j]);bodyLineHeight=bodyFont.lineHeight;}
@ -2627,21 +2628,22 @@ this.__rules__.forEach((function(rule){rule.enabled=false;}));this.enable(list,i
var result=[];list.forEach((function(name){var idx=this.__find__(name);if(idx<0){if(ignoreInvalid){return;}
throw new Error("Rules manager: invalid rule name "+name);}
this.__rules__[idx].enabled=false;result.push(name);}),this);this.__cache__=null;return result;};Ruler.prototype.getRules=function(chainName){if(this.__cache__===null){this.__compile__();}
return this.__cache__[chainName]||[];};var ruler=Ruler;var NEWLINES_RE=/\r\n?|\n/g;var NULL_RE=/\0/g;var normalize=function normalize(state){var str;str=state.src.replace(NEWLINES_RE,"\n");str=str.replace(NULL_RE,"\ufffd");state.src=str;};var block=function block(state){var token;if(state.inlineMode){token=new state.Token("inline","",0);token.content=state.src;token.map=[0,1];token.children=[];state.tokens.push(token);}else{state.md.block.parse(state.src,state.md,state.env,state.tokens);}};var inline=function inline(state){var tokens=state.tokens,tok,i,l;for(i=0,l=tokens.length;i<l;i++){tok=tokens[i];if(tok.type==="inline"){state.md.inline.parse(tok.content,state.md,state.env,tok.children);}}};var arrayReplaceAt=utils.arrayReplaceAt;function isLinkOpen(str){return/^<a[>\s]/i.test(str);}
function isLinkClose(str){return/^<\/a\s*>/i.test(str);}
var linkify=function linkify(state){var i,j,l,tokens,token,currentToken,nodes,ln,text,pos,lastPos,level,htmlLinkLevel,url,fullUrl,urlText,blockTokens=state.tokens,links;if(!state.md.options.linkify){return;}
return this.__cache__[chainName]||[];};var ruler=Ruler;var NEWLINES_RE=/\r\n?|\n/g;var NULL_RE=/\0/g;var normalize=function normalize(state){var str;str=state.src.replace(NEWLINES_RE,"\n");str=str.replace(NULL_RE,"\ufffd");state.src=str;};var block=function block(state){var token;if(state.inlineMode){token=new state.Token("inline","",0);token.content=state.src;token.map=[0,1];token.children=[];state.tokens.push(token);}else{state.md.block.parse(state.src,state.md,state.env,state.tokens);}};var inline=function inline(state){var tokens=state.tokens,tok,i,l;for(i=0,l=tokens.length;i<l;i++){tok=tokens[i];if(tok.type==="inline"){state.md.inline.parse(tok.content,state.md,state.env,tok.children);}}};var arrayReplaceAt=utils.arrayReplaceAt;function isLinkOpen$1(str){return/^<a[>\s]/i.test(str);}
function isLinkClose$1(str){return/^<\/a\s*>/i.test(str);}
var linkify$1=function linkify(state){var i,j,l,tokens,token,currentToken,nodes,ln,text,pos,lastPos,level,htmlLinkLevel,url,fullUrl,urlText,blockTokens=state.tokens,links;if(!state.md.options.linkify){return;}
for(j=0,l=blockTokens.length;j<l;j++){if(blockTokens[j].type!=="inline"||!state.md.linkify.pretest(blockTokens[j].content)){continue;}
tokens=blockTokens[j].children;htmlLinkLevel=0;for(i=tokens.length-1;i>=0;i--){currentToken=tokens[i];if(currentToken.type==="link_close"){i--;while(tokens[i].level!==currentToken.level&&tokens[i].type!=="link_open"){i--;}
continue;}
if(currentToken.type==="html_inline"){if(isLinkOpen(currentToken.content)&&htmlLinkLevel>0){htmlLinkLevel--;}
if(isLinkClose(currentToken.content)){htmlLinkLevel++;}}
if(currentToken.type==="html_inline"){if(isLinkOpen$1(currentToken.content)&&htmlLinkLevel>0){htmlLinkLevel--;}
if(isLinkClose$1(currentToken.content)){htmlLinkLevel++;}}
if(htmlLinkLevel>0){continue;}
if(currentToken.type==="text"&&state.md.linkify.test(currentToken.content)){text=currentToken.content;links=state.md.linkify.match(text);nodes=[];level=currentToken.level;lastPos=0;for(ln=0;ln<links.length;ln++){url=links[ln].url;fullUrl=state.md.normalizeLink(url);if(!state.md.validateLink(fullUrl)){continue;}
if(currentToken.type==="text"&&state.md.linkify.test(currentToken.content)){text=currentToken.content;links=state.md.linkify.match(text);nodes=[];level=currentToken.level;lastPos=0;if(links.length>0&&links[0].index===0&&i>0&&tokens[i-1].type==="text_special"){links=links.slice(1);}
for(ln=0;ln<links.length;ln++){url=links[ln].url;fullUrl=state.md.normalizeLink(url);if(!state.md.validateLink(fullUrl)){continue;}
urlText=links[ln].text;if(!links[ln].schema){urlText=state.md.normalizeLinkText("http://"+urlText).replace(/^http:\/\//,"");}else if(links[ln].schema==="mailto:"&&!/^mailto:/i.test(urlText)){urlText=state.md.normalizeLinkText("mailto:"+urlText).replace(/^mailto:/,"");}else{urlText=state.md.normalizeLinkText(urlText);}
pos=links[ln].index;if(pos>lastPos){token=new state.Token("text","",0);token.content=text.slice(lastPos,pos);token.level=level;nodes.push(token);}
token=new state.Token("link_open","a",1);token.attrs=[["href",fullUrl]];token.level=level++;token.markup="linkify";token.info="auto";nodes.push(token);token=new state.Token("text","",0);token.content=urlText;token.level=level;nodes.push(token);token=new state.Token("link_close","a",-1);token.level=--level;token.markup="linkify";token.info="auto";nodes.push(token);lastPos=links[ln].lastIndex;}
if(lastPos<text.length){token=new state.Token("text","",0);token.content=text.slice(lastPos);token.level=level;nodes.push(token);}
blockTokens[j].children=tokens=arrayReplaceAt(tokens,i,nodes);}}}};var RARE_RE=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/;var SCOPED_ABBR_TEST_RE=/\((c|tm|r|p)\)/i;var SCOPED_ABBR_RE=/\((c|tm|r|p)\)/gi;var SCOPED_ABBR={c:"\xa9",r:"\xae",p:"\xa7",tm:"\u2122"};function replaceFn(match,name){return SCOPED_ABBR[name.toLowerCase()];}
blockTokens[j].children=tokens=arrayReplaceAt(tokens,i,nodes);}}}};var RARE_RE=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/;var SCOPED_ABBR_TEST_RE=/\((c|tm|r)\)/i;var SCOPED_ABBR_RE=/\((c|tm|r)\)/gi;var SCOPED_ABBR={c:"\xa9",r:"\xae",tm:"\u2122"};function replaceFn(match,name){return SCOPED_ABBR[name.toLowerCase()];}
function replace_scoped(inlineTokens){var i,token,inside_autolink=0;for(i=inlineTokens.length-1;i>=0;i--){token=inlineTokens[i];if(token.type==="text"&&!inside_autolink){token.content=token.content.replace(SCOPED_ABBR_RE,replaceFn);}
if(token.type==="link_open"&&token.info==="auto"){inside_autolink--;}
if(token.type==="link_close"&&token.info==="auto"){inside_autolink++;}}}
@ -2651,7 +2653,7 @@ if(token.type==="link_close"&&token.info==="auto"){inside_autolink++;}}}
var replacements=function replace(state){var blkIdx;if(!state.md.options.typographer){return;}
for(blkIdx=state.tokens.length-1;blkIdx>=0;blkIdx--){if(state.tokens[blkIdx].type!=="inline"){continue;}
if(SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)){replace_scoped(state.tokens[blkIdx].children);}
if(RARE_RE.test(state.tokens[blkIdx].content)){replace_rare(state.tokens[blkIdx].children);}}};var isWhiteSpace$1=utils.isWhiteSpace;var isPunctChar$1=utils.isPunctChar;var isMdAsciiPunct$1=utils.isMdAsciiPunct;var QUOTE_TEST_RE=/['"]/;var QUOTE_RE=/['"]/g;var APOSTROPHE="\u2019";function replaceAt(str,index,ch){return str.substr(0,index)+ch+str.substr(index+1);}
if(RARE_RE.test(state.tokens[blkIdx].content)){replace_rare(state.tokens[blkIdx].children);}}};var isWhiteSpace$1=utils.isWhiteSpace;var isPunctChar$1=utils.isPunctChar;var isMdAsciiPunct$1=utils.isMdAsciiPunct;var QUOTE_TEST_RE=/['"]/;var QUOTE_RE=/['"]/g;var APOSTROPHE="\u2019";function replaceAt(str,index,ch){return str.slice(0,index)+ch+str.slice(index+1);}
function process_inlines(tokens,state){var i,token,text,t,pos,max,thisLevel,item,lastChar,nextChar,isLastPunctChar,isNextPunctChar,isLastWhiteSpace,isNextWhiteSpace,canOpen,canClose,j,isSingle,stack,openQuote,closeQuote;stack=[];for(i=0;i<tokens.length;i++){token=tokens[i];thisLevel=tokens[i].level;for(j=stack.length-1;j>=0;j--){if(stack[j].level<=thisLevel){break;}}
stack.length=j+1;if(token.type!=="text"){continue;}
text=token.content;pos=0;max=text.length;OUTER:while(pos<max){QUOTE_RE.lastIndex=pos;t=QUOTE_RE.exec(text);if(!t){break;}
@ -2670,13 +2672,16 @@ text=token.content;max=text.length;stack.length=j;continue OUTER;}}}
if(canOpen){stack.push({token:i,pos:t.index,single:isSingle,level:thisLevel});}else if(canClose&&isSingle){token.content=replaceAt(token.content,t.index,APOSTROPHE);}}}}
var smartquotes=function smartquotes(state){var blkIdx;if(!state.md.options.typographer){return;}
for(blkIdx=state.tokens.length-1;blkIdx>=0;blkIdx--){if(state.tokens[blkIdx].type!=="inline"||!QUOTE_TEST_RE.test(state.tokens[blkIdx].content)){continue;}
process_inlines(state.tokens[blkIdx].children,state);}};function Token(type,tag,nesting){this.type=type;this.tag=tag;this.attrs=null;this.map=null;this.nesting=nesting;this.level=0;this.children=null;this.content="";this.markup="";this.info="";this.meta=null;this.block=false;this.hidden=false;}
process_inlines(state.tokens[blkIdx].children,state);}};var text_join=function text_join(state){var j,l,tokens,curr,max,last,blockTokens=state.tokens;for(j=0,l=blockTokens.length;j<l;j++){if(blockTokens[j].type!=="inline")continue;tokens=blockTokens[j].children;max=tokens.length;for(curr=0;curr<max;curr++){if(tokens[curr].type==="text_special"){tokens[curr].type="text";}}
for(curr=last=0;curr<max;curr++){if(tokens[curr].type==="text"&&curr+1<max&&tokens[curr+1].type==="text"){tokens[curr+1].content=tokens[curr].content+tokens[curr+1].content;}else{if(curr!==last){tokens[last]=tokens[curr];}
last++;}}
if(curr!==last){tokens.length=last;}}};function Token(type,tag,nesting){this.type=type;this.tag=tag;this.attrs=null;this.map=null;this.nesting=nesting;this.level=0;this.children=null;this.content="";this.markup="";this.info="";this.meta=null;this.block=false;this.hidden=false;}
Token.prototype.attrIndex=function attrIndex(name){var attrs,i,len;if(!this.attrs){return-1;}
attrs=this.attrs;for(i=0,len=attrs.length;i<len;i++){if(attrs[i][0]===name){return i;}}
return-1;};Token.prototype.attrPush=function attrPush(attrData){if(this.attrs){this.attrs.push(attrData);}else{this.attrs=[attrData];}};Token.prototype.attrSet=function attrSet(name,value){var idx=this.attrIndex(name),attrData=[name,value];if(idx<0){this.attrPush(attrData);}else{this.attrs[idx]=attrData;}};Token.prototype.attrGet=function attrGet(name){var idx=this.attrIndex(name),value=null;if(idx>=0){value=this.attrs[idx][1];}
return value;};Token.prototype.attrJoin=function attrJoin(name,value){var idx=this.attrIndex(name);if(idx<0){this.attrPush([name,value]);}else{this.attrs[idx][1]=this.attrs[idx][1]+" "+value;}};var token=Token;function StateCore(src,md,env){this.src=src;this.env=env;this.tokens=[];this.inlineMode=false;this.md=md;}
StateCore.prototype.Token=token;var state_core=StateCore;var _rules$2=[["normalize",normalize],["block",block],["inline",inline],["linkify",linkify],["replacements",replacements],["smartquotes",smartquotes]];function Core(){this.ruler=new ruler;for(var i=0;i<_rules$2.length;i++){this.ruler.push(_rules$2[i][0],_rules$2[i][1]);}}
Core.prototype.process=function(state){var i,l,rules;rules=this.ruler.getRules("");for(i=0,l=rules.length;i<l;i++){rules[i](state);}};Core.prototype.State=state_core;var parser_core=Core;var isSpace$a=utils.isSpace;function getLine(state,line){var pos=state.bMarks[line]+state.tShift[line],max=state.eMarks[line];return state.src.substr(pos,max-pos);}
StateCore.prototype.Token=token;var state_core=StateCore;var _rules$2=[["normalize",normalize],["block",block],["inline",inline],["linkify",linkify$1],["replacements",replacements],["smartquotes",smartquotes],["text_join",text_join]];function Core(){this.ruler=new ruler;for(var i=0;i<_rules$2.length;i++){this.ruler.push(_rules$2[i][0],_rules$2[i][1]);}}
Core.prototype.process=function(state){var i,l,rules;rules=this.ruler.getRules("");for(i=0,l=rules.length;i<l;i++){rules[i](state);}};Core.prototype.State=state_core;var parser_core=Core;var isSpace$a=utils.isSpace;function getLine(state,line){var pos=state.bMarks[line]+state.tShift[line],max=state.eMarks[line];return state.src.slice(pos,max);}
function escapedSplit(str){var result=[],pos=0,max=str.length,ch,isEscaped=false,lastPos=0,current="";ch=str.charCodeAt(pos);while(pos<max){if(ch===124){if(!isEscaped){result.push(current+str.substring(lastPos,pos));current="";lastPos=pos+1;}else{current+=str.substring(lastPos,pos-1);lastPos=pos;}}
isEscaped=ch===92;pos++;ch=str.charCodeAt(pos);}
result.push(current+str.substring(lastPos));return result;}
@ -2865,18 +2870,17 @@ state=new this.State(src,md,env,outTokens);this.tokenize(state,state.line,state.
var text=function text(state,silent){var pos=state.pos;while(pos<state.posMax&&!isTerminatorChar(state.src.charCodeAt(pos))){pos++;}
if(pos===state.pos){return false;}
if(!silent){state.pending+=state.src.slice(state.pos,pos);}
state.pos=pos;return true;};var isSpace$3=utils.isSpace;var newline=function newline(state,silent){var pmax,max,ws,pos=state.pos;if(state.src.charCodeAt(pos)!==10){return false;}
state.pos=pos;return true;};var SCHEME_RE=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;var linkify=function linkify(state,silent){var pos,max,match,proto,link,url,fullUrl,token;if(!state.md.options.linkify)return false;if(state.linkLevel>0)return false;pos=state.pos;max=state.posMax;if(pos+3>max)return false;if(state.src.charCodeAt(pos)!==58)return false;if(state.src.charCodeAt(pos+1)!==47)return false;if(state.src.charCodeAt(pos+2)!==47)return false;match=state.pending.match(SCHEME_RE);if(!match)return false;proto=match[1];link=state.md.linkify.matchAtStart(state.src.slice(pos-proto.length));if(!link)return false;url=link.url;url=url.replace(/\*+$/,"");fullUrl=state.md.normalizeLink(url);if(!state.md.validateLink(fullUrl))return false;if(!silent){state.pending=state.pending.slice(0,-proto.length);token=state.push("link_open","a",1);token.attrs=[["href",fullUrl]];token.markup="linkify";token.info="auto";token=state.push("text","",0);token.content=state.md.normalizeLinkText(url);token=state.push("link_close","a",-1);token.markup="linkify";token.info="auto";}
state.pos+=url.length-proto.length;return true;};var isSpace$3=utils.isSpace;var newline=function newline(state,silent){var pmax,max,ws,pos=state.pos;if(state.src.charCodeAt(pos)!==10){return false;}
pmax=state.pending.length-1;max=state.posMax;if(!silent){if(pmax>=0&&state.pending.charCodeAt(pmax)===32){if(pmax>=1&&state.pending.charCodeAt(pmax-1)===32){ws=pmax-1;while(ws>=1&&state.pending.charCodeAt(ws-1)===32)ws--;state.pending=state.pending.slice(0,ws);state.push("hardbreak","br",0);}else{state.pending=state.pending.slice(0,-1);state.push("softbreak","br",0);}}else{state.push("softbreak","br",0);}}
pos++;while(pos<max&&isSpace$3(state.src.charCodeAt(pos))){pos++;}
state.pos=pos;return true;};var isSpace$2=utils.isSpace;var ESCAPED=[];for(var i=0;i<256;i++){ESCAPED.push(0);}"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach((function(ch){ESCAPED[ch.charCodeAt(0)]=1;}));var _escape=function escape(state,silent){var ch,pos=state.pos,max=state.posMax;if(state.src.charCodeAt(pos)!==92){return false;}
pos++;if(pos<max){ch=state.src.charCodeAt(pos);if(ch<256&&ESCAPED[ch]!==0){if(!silent){state.pending+=state.src[pos];}
state.pos+=2;return true;}
if(ch===10){if(!silent){state.push("hardbreak","br",0);}
pos++;while(pos<max){ch=state.src.charCodeAt(pos);if(!isSpace$2(ch)){break;}
pos++;}
state.pos=pos;return true;}}
if(!silent){state.pending+="\\";}
state.pos++;return true;};var backticks=function backtick(state,silent){var start,max,marker,token,matchStart,matchEnd,openerLength,closerLength,pos=state.pos,ch=state.src.charCodeAt(pos);if(ch!==96){return false;}
state.pos=pos;return true;};var isSpace$2=utils.isSpace;var ESCAPED=[];for(var i=0;i<256;i++){ESCAPED.push(0);}"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach((function(ch){ESCAPED[ch.charCodeAt(0)]=1;}));var _escape=function escape(state,silent){var ch1,ch2,origStr,escapedStr,token,pos=state.pos,max=state.posMax;if(state.src.charCodeAt(pos)!==92)return false;pos++;if(pos>=max)return false;ch1=state.src.charCodeAt(pos);if(ch1===10){if(!silent){state.push("hardbreak","br",0);}
pos++;while(pos<max){ch1=state.src.charCodeAt(pos);if(!isSpace$2(ch1))break;pos++;}
state.pos=pos;return true;}
escapedStr=state.src[pos];if(ch1>=55296&&ch1<=56319&&pos+1<max){ch2=state.src.charCodeAt(pos+1);if(ch2>=56320&&ch2<=57343){escapedStr+=state.src[pos+1];pos++;}}
origStr="\\"+escapedStr;if(!silent){token=state.push("text_special","",0);if(ch1<256&&ESCAPED[ch1]!==0){token.content=escapedStr;}else{token.content=origStr;}
token.markup=origStr;token.info="escape";}
state.pos=pos+1;return true;};var backticks=function backtick(state,silent){var start,max,marker,token,matchStart,matchEnd,openerLength,closerLength,pos=state.pos,ch=state.src.charCodeAt(pos);if(ch!==96){return false;}
start=pos;pos++;max=state.posMax;while(pos<max&&state.src.charCodeAt(pos)===96){pos++;}
marker=state.src.slice(start,pos);openerLength=marker.length;if(state.backticksScanned&&(state.backticks[openerLength]||0)<=start){if(!silent)state.pending+=marker;state.pos+=openerLength;return true;}
matchStart=matchEnd=pos;while((matchStart=state.src.indexOf("`",matchEnd))!==-1){matchEnd=matchStart+1;while(matchEnd<max&&state.src.charCodeAt(matchEnd)===96){matchEnd++;}
@ -2914,7 +2918,7 @@ if(!label){label=state.src.slice(labelStart,labelEnd);}
ref=state.env.references[normalizeReference$1(label)];if(!ref){state.pos=oldPos;return false;}
href=ref.href;title=ref.title;}
if(!silent){state.pos=labelStart;state.posMax=labelEnd;token=state.push("link_open","a",1);token.attrs=attrs=[["href",href]];if(title){attrs.push(["title",title]);}
state.md.inline.tokenize(state);token=state.push("link_close","a",-1);}
state.linkLevel++;state.md.inline.tokenize(state);state.linkLevel--;token=state.push("link_close","a",-1);}
state.pos=pos;state.posMax=max;return true;};var normalizeReference=utils.normalizeReference;var isSpace=utils.isSpace;var image=function image(state,silent){var attrs,code,content,label,labelEnd,labelStart,pos,ref,res,title,token,tokens,start,href="",oldPos=state.pos,max=state.posMax;if(state.src.charCodeAt(state.pos)!==33){return false;}
if(state.src.charCodeAt(state.pos+1)!==91){return false;}
labelStart=state.pos+2;labelEnd=state.md.helpers.parseLinkLabel(state,state.pos+1,false);if(labelEnd<0){return false;}
@ -2938,25 +2942,25 @@ state.pos+=url.length+2;return true;}
if(EMAIL_RE.test(url)){fullUrl=state.md.normalizeLink("mailto:"+url);if(!state.md.validateLink(fullUrl)){return false;}
if(!silent){token=state.push("link_open","a",1);token.attrs=[["href",fullUrl]];token.markup="autolink";token.info="auto";token=state.push("text","",0);token.content=state.md.normalizeLinkText(url);token=state.push("link_close","a",-1);token.markup="autolink";token.info="auto";}
state.pos+=url.length+2;return true;}
return false;};var HTML_TAG_RE=html_re.HTML_TAG_RE;function isLetter(ch){var lc=ch|32;return lc>=97&&lc<=122;}
return false;};var HTML_TAG_RE=html_re.HTML_TAG_RE;function isLinkOpen(str){return/^<a[>\s]/i.test(str);}
function isLinkClose(str){return/^<\/a\s*>/i.test(str);}
function isLetter(ch){var lc=ch|32;return lc>=97&&lc<=122;}
var html_inline=function html_inline(state,silent){var ch,match,max,token,pos=state.pos;if(!state.md.options.html){return false;}
max=state.posMax;if(state.src.charCodeAt(pos)!==60||pos+2>=max){return false;}
ch=state.src.charCodeAt(pos+1);if(ch!==33&&ch!==63&&ch!==47&&!isLetter(ch)){return false;}
match=state.src.slice(pos).match(HTML_TAG_RE);if(!match){return false;}
if(!silent){token=state.push("html_inline","",0);token.content=state.src.slice(pos,pos+match[0].length);}
state.pos+=match[0].length;return true;};var has=utils.has;var isValidEntityCode=utils.isValidEntityCode;var fromCodePoint=utils.fromCodePoint;var DIGITAL_RE=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;var NAMED_RE=/^&([a-z][a-z0-9]{1,31});/i;var entity=function entity(state,silent){var ch,code,match,pos=state.pos,max=state.posMax;if(state.src.charCodeAt(pos)!==38){return false;}
if(pos+1<max){ch=state.src.charCodeAt(pos+1);if(ch===35){match=state.src.slice(pos).match(DIGITAL_RE);if(match){if(!silent){code=match[1][0].toLowerCase()==="x"?parseInt(match[1].slice(1),16):parseInt(match[1],10);state.pending+=isValidEntityCode(code)?fromCodePoint(code):fromCodePoint(65533);}
state.pos+=match[0].length;return true;}}else{match=state.src.slice(pos).match(NAMED_RE);if(match){if(has(entities,match[1])){if(!silent){state.pending+=entities[match[1]];}
state.pos+=match[0].length;return true;}}}}
if(!silent){state.pending+="&";}
state.pos++;return true;};function processDelimiters(state,delimiters){var closerIdx,openerIdx,closer,opener,minOpenerIdx,newMinOpenerIdx,isOddMatch,lastJump,openersBottom={},max=delimiters.length;if(!max)return;var headerIdx=0;var lastTokenIdx=-2;var jumps=[];for(closerIdx=0;closerIdx<max;closerIdx++){closer=delimiters[closerIdx];jumps.push(0);if(delimiters[headerIdx].marker!==closer.marker||lastTokenIdx!==closer.token-1){headerIdx=closerIdx;}
if(!silent){token=state.push("html_inline","",0);token.content=state.src.slice(pos,pos+match[0].length);if(isLinkOpen(token.content))state.linkLevel++;if(isLinkClose(token.content))state.linkLevel--;}
state.pos+=match[0].length;return true;};var has=utils.has;var isValidEntityCode=utils.isValidEntityCode;var fromCodePoint=utils.fromCodePoint;var DIGITAL_RE=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;var NAMED_RE=/^&([a-z][a-z0-9]{1,31});/i;var entity=function entity(state,silent){var ch,code,match,token,pos=state.pos,max=state.posMax;if(state.src.charCodeAt(pos)!==38)return false;if(pos+1>=max)return false;ch=state.src.charCodeAt(pos+1);if(ch===35){match=state.src.slice(pos).match(DIGITAL_RE);if(match){if(!silent){code=match[1][0].toLowerCase()==="x"?parseInt(match[1].slice(1),16):parseInt(match[1],10);token=state.push("text_special","",0);token.content=isValidEntityCode(code)?fromCodePoint(code):fromCodePoint(65533);token.markup=match[0];token.info="entity";}
state.pos+=match[0].length;return true;}}else{match=state.src.slice(pos).match(NAMED_RE);if(match){if(has(entities,match[1])){if(!silent){token=state.push("text_special","",0);token.content=entities[match[1]];token.markup=match[0];token.info="entity";}
state.pos+=match[0].length;return true;}}}
return false;};function processDelimiters(state,delimiters){var closerIdx,openerIdx,closer,opener,minOpenerIdx,newMinOpenerIdx,isOddMatch,lastJump,openersBottom={},max=delimiters.length;if(!max)return;var headerIdx=0;var lastTokenIdx=-2;var jumps=[];for(closerIdx=0;closerIdx<max;closerIdx++){closer=delimiters[closerIdx];jumps.push(0);if(delimiters[headerIdx].marker!==closer.marker||lastTokenIdx!==closer.token-1){headerIdx=closerIdx;}
lastTokenIdx=closer.token;closer.length=closer.length||0;if(!closer.close)continue;if(!openersBottom.hasOwnProperty(closer.marker)){openersBottom[closer.marker]=[-1,-1,-1,-1,-1,-1];}
minOpenerIdx=openersBottom[closer.marker][(closer.open?3:0)+closer.length%3];openerIdx=headerIdx-jumps[headerIdx]-1;newMinOpenerIdx=openerIdx;for(;openerIdx>minOpenerIdx;openerIdx-=jumps[openerIdx]+1){opener=delimiters[openerIdx];if(opener.marker!==closer.marker)continue;if(opener.open&&opener.end<0){isOddMatch=false;if(opener.close||closer.open){if((opener.length+closer.length)%3===0){if(opener.length%3!==0||closer.length%3!==0){isOddMatch=true;}}}
if(!isOddMatch){lastJump=openerIdx>0&&!delimiters[openerIdx-1].open?jumps[openerIdx-1]+1:0;jumps[closerIdx]=closerIdx-openerIdx+lastJump;jumps[openerIdx]=lastJump;closer.open=false;opener.end=closerIdx;opener.close=false;newMinOpenerIdx=-1;lastTokenIdx=-2;break;}}}
if(newMinOpenerIdx!==-1){openersBottom[closer.marker][(closer.open?3:0)+(closer.length||0)%3]=newMinOpenerIdx;}}}
var balance_pairs=function link_pairs(state){var curr,tokens_meta=state.tokens_meta,max=state.tokens_meta.length;processDelimiters(state,state.delimiters);for(curr=0;curr<max;curr++){if(tokens_meta[curr]&&tokens_meta[curr].delimiters){processDelimiters(state,tokens_meta[curr].delimiters);}}};var text_collapse=function text_collapse(state){var curr,last,level=0,tokens=state.tokens,max=state.tokens.length;for(curr=last=0;curr<max;curr++){if(tokens[curr].nesting<0)level--;tokens[curr].level=level;if(tokens[curr].nesting>0)level++;if(tokens[curr].type==="text"&&curr+1<max&&tokens[curr+1].type==="text"){tokens[curr+1].content=tokens[curr].content+tokens[curr+1].content;}else{if(curr!==last){tokens[last]=tokens[curr];}
var balance_pairs=function link_pairs(state){var curr,tokens_meta=state.tokens_meta,max=state.tokens_meta.length;processDelimiters(state,state.delimiters);for(curr=0;curr<max;curr++){if(tokens_meta[curr]&&tokens_meta[curr].delimiters){processDelimiters(state,tokens_meta[curr].delimiters);}}};var fragments_join=function fragments_join(state){var curr,last,level=0,tokens=state.tokens,max=state.tokens.length;for(curr=last=0;curr<max;curr++){if(tokens[curr].nesting<0)level--;tokens[curr].level=level;if(tokens[curr].nesting>0)level++;if(tokens[curr].type==="text"&&curr+1<max&&tokens[curr+1].type==="text"){tokens[curr+1].content=tokens[curr].content+tokens[curr+1].content;}else{if(curr!==last){tokens[last]=tokens[curr];}
last++;}}
if(curr!==last){tokens.length=last;}};var isWhiteSpace=utils.isWhiteSpace;var isPunctChar=utils.isPunctChar;var isMdAsciiPunct=utils.isMdAsciiPunct;function StateInline(src,md,env,outTokens){this.src=src;this.env=env;this.md=md;this.tokens=outTokens;this.tokens_meta=Array(outTokens.length);this.pos=0;this.posMax=this.src.length;this.level=0;this.pending="";this.pendingLevel=0;this.cache={};this.delimiters=[];this._prev_delimiters=[];this.backticks={};this.backticksScanned=false;}
if(curr!==last){tokens.length=last;}};var isWhiteSpace=utils.isWhiteSpace;var isPunctChar=utils.isPunctChar;var isMdAsciiPunct=utils.isMdAsciiPunct;function StateInline(src,md,env,outTokens){this.src=src;this.env=env;this.md=md;this.tokens=outTokens;this.tokens_meta=Array(outTokens.length);this.pos=0;this.posMax=this.src.length;this.level=0;this.pending="";this.pendingLevel=0;this.cache={};this.delimiters=[];this._prev_delimiters=[];this.backticks={};this.backticksScanned=false;this.linkLevel=0;}
StateInline.prototype.pushPending=function(){var token$1=new token("text","",0);token$1.content=this.pending;token$1.level=this.pendingLevel;this.tokens.push(token$1);this.pending="";return token$1;};StateInline.prototype.push=function(type,tag,nesting){if(this.pending){this.pushPending();}
var token$1=new token(type,tag,nesting);var token_meta=null;if(nesting<0){this.level--;this.delimiters=this._prev_delimiters.pop();}
token$1.level=this.level;if(nesting>0){this.level++;this._prev_delimiters.push(this.delimiters);this.delimiters=[];token_meta={delimiters:this.delimiters};}
@ -2964,7 +2968,7 @@ this.pendingLevel=this.level;this.tokens.push(token$1);this.tokens_meta.push(tok
count=pos-start;nextChar=pos<max?this.src.charCodeAt(pos):32;isLastPunctChar=isMdAsciiPunct(lastChar)||isPunctChar(String.fromCharCode(lastChar));isNextPunctChar=isMdAsciiPunct(nextChar)||isPunctChar(String.fromCharCode(nextChar));isLastWhiteSpace=isWhiteSpace(lastChar);isNextWhiteSpace=isWhiteSpace(nextChar);if(isNextWhiteSpace){left_flanking=false;}else if(isNextPunctChar){if(!(isLastWhiteSpace||isLastPunctChar)){left_flanking=false;}}
if(isLastWhiteSpace){right_flanking=false;}else if(isLastPunctChar){if(!(isNextWhiteSpace||isNextPunctChar)){right_flanking=false;}}
if(!canSplitWord){can_open=left_flanking&&(!right_flanking||isLastPunctChar);can_close=right_flanking&&(!left_flanking||isNextPunctChar);}else{can_open=left_flanking;can_close=right_flanking;}
return{can_open:can_open,can_close:can_close,length:count};};StateInline.prototype.Token=token;var state_inline=StateInline;var _rules=[["text",text],["newline",newline],["escape",_escape],["backticks",backticks],["strikethrough",strikethrough.tokenize],["emphasis",emphasis.tokenize],["link",link],["image",image],["autolink",autolink],["html_inline",html_inline],["entity",entity]];var _rules2=[["balance_pairs",balance_pairs],["strikethrough",strikethrough.postProcess],["emphasis",emphasis.postProcess],["text_collapse",text_collapse]];function ParserInline(){var i;this.ruler=new ruler;for(i=0;i<_rules.length;i++){this.ruler.push(_rules[i][0],_rules[i][1]);}
return{can_open:can_open,can_close:can_close,length:count};};StateInline.prototype.Token=token;var state_inline=StateInline;var _rules=[["text",text],["linkify",linkify],["newline",newline],["escape",_escape],["backticks",backticks],["strikethrough",strikethrough.tokenize],["emphasis",emphasis.tokenize],["link",link],["image",image],["autolink",autolink],["html_inline",html_inline],["entity",entity]];var _rules2=[["balance_pairs",balance_pairs],["strikethrough",strikethrough.postProcess],["emphasis",emphasis.postProcess],["fragments_join",fragments_join]];function ParserInline(){var i;this.ruler=new ruler;for(i=0;i<_rules.length;i++){this.ruler.push(_rules[i][0],_rules[i][1]);}
this.ruler2=new ruler;for(i=0;i<_rules2.length;i++){this.ruler2.push(_rules2[i][0],_rules2[i][1]);}}
ParserInline.prototype.skipToken=function(state){var ok,i,pos=state.pos,rules=this.ruler.getRules(""),len=rules.length,maxNesting=state.md.options.maxNesting,cache=state.cache;if(typeof cache[pos]!=="undefined"){state.pos=cache[pos];return;}
if(state.level<maxNesting){for(i=0;i<len;i++){state.level++;ok=rules[i](state,true);state.level--;if(ok){break;}}}else{state.pos=state.posMax;}
@ -2973,7 +2977,7 @@ cache[pos]=state.pos;};ParserInline.prototype.tokenize=function(state){var ok,i,
if(ok){if(state.pos>=end){break;}
continue;}
state.pending+=state.src[state.pos++];}
if(state.pending){state.pushPending();}};ParserInline.prototype.parse=function(str,md,env,outTokens){var i,rules,len;var state=new this.State(str,md,env,outTokens);this.tokenize(state);rules=this.ruler2.getRules("");len=rules.length;for(i=0;i<len;i++){rules[i](state);}};ParserInline.prototype.State=state_inline;var parser_inline=ParserInline;var re=function(opts){var re={};re.src_Any=regex$3.source;re.src_Cc=regex$2.source;re.src_Z=regex.source;re.src_P=regex$4.source;re.src_ZPCc=[re.src_Z,re.src_P,re.src_Cc].join("|");re.src_ZCc=[re.src_Z,re.src_Cc].join("|");var text_separators="[><\uff5c]";re.src_pseudo_letter="(?:(?!"+text_separators+"|"+re.src_ZPCc+")"+re.src_Any+")";re.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)";re.src_auth="(?:(?:(?!"+re.src_ZCc+"|[@/\\[\\]()]).)+@)?";re.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?";re.src_host_terminator="(?=$|"+text_separators+"|"+re.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+re.src_ZPCc+"))";re.src_path="(?:"+"[/?#]"+"(?:"+"(?!"+re.src_ZCc+"|"+text_separators+"|[()[\\]{}.,\"'?!\\-;]).|"+"\\[(?:(?!"+re.src_ZCc+"|\\]).)*\\]|"+"\\((?:(?!"+re.src_ZCc+"|[)]).)*\\)|"+"\\{(?:(?!"+re.src_ZCc+"|[}]).)*\\}|"+'\\"(?:(?!'+re.src_ZCc+'|["]).)+\\"|'+"\\'(?:(?!"+re.src_ZCc+"|[']).)+\\'|"+"\\'(?="+re.src_pseudo_letter+"|[-]).|"+"\\.{2,}[a-zA-Z0-9%/&]|"+"\\.(?!"+re.src_ZCc+"|[.]).|"+(opts&&opts["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+re.src_ZCc+").|"+";(?!"+re.src_ZCc+").|"+"\\!+(?!"+re.src_ZCc+"|[!]).|"+"\\?(?!"+re.src_ZCc+"|[?])."+")+"+"|\\/"+")?";re.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*';re.src_xn="xn--[a-z0-9\\-]{1,59}";re.src_domain_root="(?:"+re.src_xn+"|"+re.src_pseudo_letter+"{1,63}"+")";re.src_domain="(?:"+re.src_xn+"|"+"(?:"+re.src_pseudo_letter+")"+"|"+"(?:"+re.src_pseudo_letter+"(?:-|"+re.src_pseudo_letter+"){0,61}"+re.src_pseudo_letter+")"+")";re.src_host="(?:"+"(?:(?:(?:"+re.src_domain+")\\.)*"+re.src_domain+")"+")";re.tpl_host_fuzzy="(?:"+re.src_ip4+"|"+"(?:(?:(?:"+re.src_domain+")\\.)+(?:%TLDS%))"+")";re.tpl_host_no_ip_fuzzy="(?:(?:(?:"+re.src_domain+")\\.)+(?:%TLDS%))";re.src_host_strict=re.src_host+re.src_host_terminator;re.tpl_host_fuzzy_strict=re.tpl_host_fuzzy+re.src_host_terminator;re.src_host_port_strict=re.src_host+re.src_port+re.src_host_terminator;re.tpl_host_port_fuzzy_strict=re.tpl_host_fuzzy+re.src_port+re.src_host_terminator;re.tpl_host_port_no_ip_fuzzy_strict=re.tpl_host_no_ip_fuzzy+re.src_port+re.src_host_terminator;re.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+re.src_ZPCc+"|>|$))";re.tpl_email_fuzzy="(^|"+text_separators+'|"|\\(|'+re.src_ZCc+")"+"("+re.src_email_name+"@"+re.tpl_host_fuzzy_strict+")";re.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|"+re.src_ZPCc+"))"+"((?![$+<=>^`|\uff5c])"+re.tpl_host_port_fuzzy_strict+re.src_path+")";re.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|"+re.src_ZPCc+"))"+"((?![$+<=>^`|\uff5c])"+re.tpl_host_port_no_ip_fuzzy_strict+re.src_path+")";return re;};function assign(obj){var sources=Array.prototype.slice.call(arguments,1);sources.forEach((function(source){if(!source){return;}
if(state.pending){state.pushPending();}};ParserInline.prototype.parse=function(str,md,env,outTokens){var i,rules,len;var state=new this.State(str,md,env,outTokens);this.tokenize(state);rules=this.ruler2.getRules("");len=rules.length;for(i=0;i<len;i++){rules[i](state);}};ParserInline.prototype.State=state_inline;var parser_inline=ParserInline;var re=function(opts){var re={};opts=opts||{};re.src_Any=regex$3.source;re.src_Cc=regex$2.source;re.src_Z=regex.source;re.src_P=regex$4.source;re.src_ZPCc=[re.src_Z,re.src_P,re.src_Cc].join("|");re.src_ZCc=[re.src_Z,re.src_Cc].join("|");var text_separators="[><\uff5c]";re.src_pseudo_letter="(?:(?!"+text_separators+"|"+re.src_ZPCc+")"+re.src_Any+")";re.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)";re.src_auth="(?:(?:(?!"+re.src_ZCc+"|[@/\\[\\]()]).)+@)?";re.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?";re.src_host_terminator="(?=$|"+text_separators+"|"+re.src_ZPCc+")"+"(?!"+(opts["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+re.src_ZPCc+"))";re.src_path="(?:"+"[/?#]"+"(?:"+"(?!"+re.src_ZCc+"|"+text_separators+"|[()[\\]{}.,\"'?!\\-;]).|"+"\\[(?:(?!"+re.src_ZCc+"|\\]).)*\\]|"+"\\((?:(?!"+re.src_ZCc+"|[)]).)*\\)|"+"\\{(?:(?!"+re.src_ZCc+"|[}]).)*\\}|"+'\\"(?:(?!'+re.src_ZCc+'|["]).)+\\"|'+"\\'(?:(?!"+re.src_ZCc+"|[']).)+\\'|"+"\\'(?="+re.src_pseudo_letter+"|[-])|"+"\\.{2,}[a-zA-Z0-9%/&]|"+"\\.(?!"+re.src_ZCc+"|[.]|$)|"+(opts["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+re.src_ZCc+"|$)|"+";(?!"+re.src_ZCc+"|$)|"+"\\!+(?!"+re.src_ZCc+"|[!]|$)|"+"\\?(?!"+re.src_ZCc+"|[?]|$)"+")+"+"|\\/"+")?";re.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*';re.src_xn="xn--[a-z0-9\\-]{1,59}";re.src_domain_root="(?:"+re.src_xn+"|"+re.src_pseudo_letter+"{1,63}"+")";re.src_domain="(?:"+re.src_xn+"|"+"(?:"+re.src_pseudo_letter+")"+"|"+"(?:"+re.src_pseudo_letter+"(?:-|"+re.src_pseudo_letter+"){0,61}"+re.src_pseudo_letter+")"+")";re.src_host="(?:"+"(?:(?:(?:"+re.src_domain+")\\.)*"+re.src_domain+")"+")";re.tpl_host_fuzzy="(?:"+re.src_ip4+"|"+"(?:(?:(?:"+re.src_domain+")\\.)+(?:%TLDS%))"+")";re.tpl_host_no_ip_fuzzy="(?:(?:(?:"+re.src_domain+")\\.)+(?:%TLDS%))";re.src_host_strict=re.src_host+re.src_host_terminator;re.tpl_host_fuzzy_strict=re.tpl_host_fuzzy+re.src_host_terminator;re.src_host_port_strict=re.src_host+re.src_port+re.src_host_terminator;re.tpl_host_port_fuzzy_strict=re.tpl_host_fuzzy+re.src_port+re.src_host_terminator;re.tpl_host_port_no_ip_fuzzy_strict=re.tpl_host_no_ip_fuzzy+re.src_port+re.src_host_terminator;re.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+re.src_ZPCc+"|>|$))";re.tpl_email_fuzzy="(^|"+text_separators+'|"|\\(|'+re.src_ZCc+")"+"("+re.src_email_name+"@"+re.tpl_host_fuzzy_strict+")";re.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|"+re.src_ZPCc+"))"+"((?![$+<=>^`|\uff5c])"+re.tpl_host_port_fuzzy_strict+re.src_path+")";re.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|"+re.src_ZPCc+"))"+"((?![$+<=>^`|\uff5c])"+re.tpl_host_port_no_ip_fuzzy_strict+re.src_path+")";return re;};function assign(obj){var sources=Array.prototype.slice.call(arguments,1);sources.forEach((function(source){if(!source){return;}
Object.keys(source).forEach((function(key){obj[key]=source[key];}));}));return obj;}
function _class(obj){return Object.prototype.toString.call(obj);}
function isString(obj){return _class(obj)==="[object String]";}
@ -3003,7 +3007,7 @@ if(isFunction(val.normalize)){compiled.normalize=val.normalize;}else if(!val.nor
return;}
if(isString(val)){aliases.push(name);return;}
schemaError(name,val);}));aliases.forEach((function(alias){if(!self.__compiled__[self.__schemas__[alias]]){return;}
self.__compiled__[alias].validate=self.__compiled__[self.__schemas__[alias]].validate;self.__compiled__[alias].normalize=self.__compiled__[self.__schemas__[alias]].normalize;}));self.__compiled__[""]={validate:null,normalize:createNormalizer()};var slist=Object.keys(self.__compiled__).filter((function(name){return name.length>0&&self.__compiled__[name];})).map(escapeRE).join("|");self.re.schema_test=RegExp("(^|(?!_)(?:[><\uff5c]|"+re$1.src_ZPCc+"))("+slist+")","i");self.re.schema_search=RegExp("(^|(?!_)(?:[><\uff5c]|"+re$1.src_ZPCc+"))("+slist+")","ig");self.re.pretest=RegExp("("+self.re.schema_test.source+")|("+self.re.host_fuzzy_test.source+")|@","i");resetScanCache(self);}
self.__compiled__[alias].validate=self.__compiled__[self.__schemas__[alias]].validate;self.__compiled__[alias].normalize=self.__compiled__[self.__schemas__[alias]].normalize;}));self.__compiled__[""]={validate:null,normalize:createNormalizer()};var slist=Object.keys(self.__compiled__).filter((function(name){return name.length>0&&self.__compiled__[name];})).map(escapeRE).join("|");self.re.schema_test=RegExp("(^|(?!_)(?:[><\uff5c]|"+re$1.src_ZPCc+"))("+slist+")","i");self.re.schema_search=RegExp("(^|(?!_)(?:[><\uff5c]|"+re$1.src_ZPCc+"))("+slist+")","ig");self.re.schema_at_start=RegExp("^"+self.re.schema_search.source,"i");self.re.pretest=RegExp("("+self.re.schema_test.source+")|("+self.re.host_fuzzy_test.source+")|@","i");resetScanCache(self);}
function Match(self,shift){var start=self.__index__,end=self.__last_index__,text=self.__text_cache__.slice(start,end);this.schema=self.__schema__.toLowerCase();this.index=start+shift;this.lastIndex=end+shift;this.raw=text;this.text=text;this.url=text;}
function createMatch(self,shift){var match=new Match(self,shift);self.__compiled__[match.schema].normalize(match,self);return match;}
function LinkifyIt(schemas,options){if(!(this instanceof LinkifyIt)){return new LinkifyIt(schemas,options);}
@ -3017,7 +3021,7 @@ return this.__index__>=0;};LinkifyIt.prototype.pretest=function pretest(text){re
return this.__compiled__[schema.toLowerCase()].validate(text,pos,this);};LinkifyIt.prototype.match=function match(text){var shift=0,result=[];if(this.__index__>=0&&this.__text_cache__===text){result.push(createMatch(this,shift));shift=this.__last_index__;}
var tail=shift?text.slice(shift):text;while(this.test(tail)){result.push(createMatch(this,shift));tail=tail.slice(this.__last_index__);shift+=this.__last_index__;}
if(result.length){return result;}
return null;};LinkifyIt.prototype.tlds=function tlds(list,keepOld){list=Array.isArray(list)?list:[list];if(!keepOld){this.__tlds__=list.slice();this.__tlds_replaced__=true;compile(this);return this;}
return null;};LinkifyIt.prototype.matchAtStart=function matchAtStart(text){this.__text_cache__=text;this.__index__=-1;if(!text.length)return null;var m=this.re.schema_at_start.exec(text);if(!m)return null;var len=this.testSchemaAt(text,m[2],m[0].length);if(!len)return null;this.__schema__=m[2];this.__index__=m.index+m[1].length;this.__last_index__=m.index+m[0].length+len;return createMatch(this,0);};LinkifyIt.prototype.tlds=function tlds(list,keepOld){list=Array.isArray(list)?list:[list];if(!keepOld){this.__tlds__=list.slice();this.__tlds_replaced__=true;compile(this);return this;}
this.__tlds__=this.__tlds__.concat(list).sort().filter((function(el,idx,arr){return el!==arr[idx-1];})).reverse();compile(this);return this;};LinkifyIt.prototype.normalize=function normalize(match){if(!match.schema){match.url="http://"+match.url;}
if(match.schema==="mailto:"&&!/^mailto:/i.test(match.url)){match.url="mailto:"+match.url;}};LinkifyIt.prototype.onCompile=function onCompile(){};var linkifyIt=LinkifyIt;var maxInt=2147483647;var base=36;var tMin=1;var tMax=26;var skew=38;var damp=700;var initialBias=72;var initialN=128;var delimiter="-";var regexPunycode=/^xn--/;var regexNonASCII=/[^\x20-\x7E]/;var regexSeparators=/[\x2E\u3002\uFF0E\uFF61]/g;var errors={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"};var baseMinusTMin=base-tMin;var floor=Math.floor;var stringFromCharCode=String.fromCharCode;function error(type){throw new RangeError(errors[type]);}
function map(array,fn){var length=array.length;var result=[];while(length--){result[length]=fn(array[length]);}
@ -3058,7 +3062,7 @@ output.push(stringFromCharCode(digitToBasic(q,0)));bias=adapt(delta,handledCPCou
return output.join("");}
function toUnicode(input){return mapDomain(input,(function(string){return regexPunycode.test(string)?decode(string.slice(4).toLowerCase()):string;}));}
function toASCII(input){return mapDomain(input,(function(string){return regexNonASCII.test(string)?"xn--"+encode(string):string;}));}
var version="1.4.1";var ucs2={decode:ucs2decode,encode:ucs2encode};var punycode$1={version:version,ucs2:ucs2,toASCII:toASCII,toUnicode:toUnicode,encode:encode,decode:decode};var punycode$2=Object.freeze({__proto__:null,decode:decode,encode:encode,toUnicode:toUnicode,toASCII:toASCII,version:version,ucs2:ucs2,default:punycode$1});var _default={options:{html:false,xhtmlOut:false,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}};var zero={options:{html:false,xhtmlOut:false,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","text_collapse"]}}};var commonmark={options:{html:true,xhtmlOut:true,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","text_collapse"]}}};var punycode=getAugmentedNamespace(punycode$2);var config={default:_default,zero:zero,commonmark:commonmark};var BAD_PROTO_RE=/^(vbscript|javascript|file|data):/;var GOOD_DATA_RE=/^data:image\/(gif|png|jpeg|webp);/;function validateLink(url){var str=url.trim().toLowerCase();return BAD_PROTO_RE.test(str)?GOOD_DATA_RE.test(str)?true:false:true;}
var version="1.4.1";var ucs2={decode:ucs2decode,encode:ucs2encode};var punycode$1={version:version,ucs2:ucs2,toASCII:toASCII,toUnicode:toUnicode,encode:encode,decode:decode};var punycode$2=Object.freeze({__proto__:null,decode:decode,encode:encode,toUnicode:toUnicode,toASCII:toASCII,version:version,ucs2:ucs2,default:punycode$1});var _default={options:{html:false,xhtmlOut:false,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}};var zero={options:{html:false,xhtmlOut:false,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}};var commonmark={options:{html:true,xhtmlOut:true,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}};var punycode=getAugmentedNamespace(punycode$2);var config={default:_default,zero:zero,commonmark:commonmark};var BAD_PROTO_RE=/^(vbscript|javascript|file|data):/;var GOOD_DATA_RE=/^data:image\/(gif|png|jpeg|webp);/;function validateLink(url){var str=url.trim().toLowerCase();return BAD_PROTO_RE.test(str)?GOOD_DATA_RE.test(str)?true:false:true;}
var RECODE_HOSTNAME_FOR=["http:","https:","mailto:"];function normalizeLink(url){var parsed=mdurl.parse(url,true);if(parsed.hostname){if(!parsed.protocol||RECODE_HOSTNAME_FOR.indexOf(parsed.protocol)>=0){try{parsed.hostname=punycode.toASCII(parsed.hostname);}catch(er){}}}
return mdurl.encode(mdurl.format(parsed));}
function normalizeLinkText(url){var parsed=mdurl.parse(url,true);if(parsed.hostname){if(!parsed.protocol||RECODE_HOSTNAME_FOR.indexOf(parsed.protocol)>=0){try{parsed.hostname=punycode.toUnicode(parsed.hostname);}catch(er){}}}
@ -3676,111 +3680,9 @@ params=formData;break;}
return new Promise(function(resolve,reject){let request=new XMLHttpRequest(),key;request.withCredentials=true;request.open(method,path,true);for(key in headers){if(headers.hasOwnProperty(key)){request.setRequestHeader(key,headers[key]);}}
request.onload=function(){if(4===request.readyState&&399>=request.status){let data=request.response;let contentType=this.getResponseHeader('content-type');contentType=contentType.substring(0,contentType.indexOf(';'));switch(contentType){case'application/json':data=JSON.parse(data);break;}
resolve(data);}else{reject(new Error(request.statusText));}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,false);}
request.onerror=function(){reject(new Error("Network Error"));};request.send(params);})};return{'get':function(path,headers={},params={}){return call('GET',path+((params.length>0)?'?'+buildQuery(params):''),headers,{});},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress);},'put':function(path,headers={},params={},progress=null){return call('PUT',headers,params,progress);},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress);},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress);},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let analytics={create:function(id,source,activity,url){return http.post('/analytics',{'content-type':'application/json'},{id:id,source:source,activity:activity,url:url,version:env.VERSION,setup:env.SETUP});},};return{analytics:analytics,};},true);})(window);(function(window){"use strict";window.ls.container.set('console',function(window){var sdk=new window.Appwrite();var endpoint=window.location.origin+'/v1';sdk.setEndpoint(endpoint).setProject('console').setLocale(APP_ENV.LOCALE);return sdk;},true);})(window);(function(window){"use strict";window.ls.container.set('date',function(){function format(format,timestamp){return timestamp;var jsdate,f
var txtWords=['Sun','Mon','Tues','Wednes','Thurs','Fri','Satur','January','February','March','April','May','June','July','August','September','October','November','December']
var formatChr=/\\?(.?)/gi
var formatChrCb=function(t,s){return f[t]?f[t]():s}
var _pad=function(n,c){n=String(n)
while(n.length<c){n='0'+n}
return n}
f={d:function(){return _pad(f.j(),2)},D:function(){return f.l().slice(0,3)},j:function(){return jsdate.getDate()},l:function(){return txtWords[f.w()]+'day'},N:function(){return f.w()||7},S:function(){var j=f.j()
var i=j%10
if(i<=3&&parseInt((j%100)/10,10)===1){i=0}
return['st','nd','rd'][i-1]||'th'},w:function(){return jsdate.getDay()},z:function(){var a=new Date(f.Y(),f.n()-1,f.j())
var b=new Date(f.Y(),0,1)
return Math.round((a-b)/864e5)},W:function(){var a=new Date(f.Y(),f.n()-1,f.j()-f.N()+3)
var b=new Date(a.getFullYear(),0,4)
return _pad(1+Math.round((a-b)/864e5/7),2)},F:function(){return txtWords[6+f.n()]},m:function(){return _pad(f.n(),2)},M:function(){return f.F().slice(0,3)},n:function(){return jsdate.getMonth()+1},t:function(){return(new Date(f.Y(),f.n(),0)).getDate()},L:function(){var j=f.Y()
return j%4===0&j%100!==0|j%400===0},o:function(){var n=f.n()
var W=f.W()
var Y=f.Y()
return Y+(n===12&&W<9?1:n===1&&W>9?-1:0)},Y:function(){return jsdate.getFullYear()},y:function(){return f.Y().toString().slice(-2)},a:function(){return jsdate.getHours()>11?'pm':'am'},A:function(){return f.a().toUpperCase()},B:function(){var H=jsdate.getUTCHours()*36e2
var i=jsdate.getUTCMinutes()*60
var s=jsdate.getUTCSeconds()
return _pad(Math.floor((H+i+s+36e2)/86.4)%1e3,3)},g:function(){return f.G()%12||12},G:function(){return jsdate.getHours()},h:function(){return _pad(f.g(),2)},H:function(){return _pad(f.G(),2)},i:function(){return _pad(jsdate.getMinutes(),2)},s:function(){return _pad(jsdate.getSeconds(),2)},u:function(){return _pad(jsdate.getMilliseconds()*1000,6)},e:function(){var msg='Not supported (see source code of date() for timezone on how to add support)'
throw new Error(msg)},I:function(){var a=new Date(f.Y(),0)
var c=Date.UTC(f.Y(),0)
var b=new Date(f.Y(),6)
var d=Date.UTC(f.Y(),6)
return((a-c)!==(b-d))?1:0},O:function(){var tzo=jsdate.getTimezoneOffset()
var a=Math.abs(tzo)
return(tzo>0?'-':'+')+_pad(Math.floor(a/60)*100+a%60,4)},P:function(){var O=f.O()
return(O.substr(0,3)+':'+O.substr(3,2))},T:function(){return'UTC'},Z:function(){return-jsdate.getTimezoneOffset()*60},c:function(){return'Y-m-d\\TH:i:sP'.replace(formatChr,formatChrCb)},r:function(){return'D, d M Y H:i:s O'.replace(formatChr,formatChrCb)},U:function(){return jsdate/1000|0}}
var _date=function(format,timestamp){jsdate=(timestamp===undefined?new Date():(timestamp instanceof Date)?new Date(timestamp):new Date(timestamp*1000))
return format.replace(formatChr,formatChrCb)}
return _date(format,timestamp)}
function strtotime(text,now){return text;var parsed
var match
var today
var year
var date
var days
var ranges
var len
var times
var regex
var i
var fail=false
if(!text){return fail}
text=text.replace(/^\s+|\s+$/g,'').replace(/\s{2,}/g,' ').replace(/[\t\r\n]/g,'').toLowerCase()
var pattern=new RegExp(['^(\\d{1,4})','([\\-\\.\\/:])','(\\d{1,2})','([\\-\\.\\/:])','(\\d{1,4})','(?:\\s(\\d{1,2}):(\\d{2})?:?(\\d{2})?)?','(?:\\s([A-Z]+)?)?$'].join(''))
match=text.match(pattern)
if(match&&match[2]===match[4]){if(match[1]>1901){switch(match[2]){case'-':if(match[3]>12||match[5]>31){return fail}
return new Date(match[1],parseInt(match[3],10)-1,match[5],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000
case'.':return fail
case'/':if(match[3]>12||match[5]>31){return fail}
return new Date(match[1],parseInt(match[3],10)-1,match[5],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000}}else if(match[5]>1901){switch(match[2]){case'-':if(match[3]>12||match[1]>31){return fail}
return new Date(match[5],parseInt(match[3],10)-1,match[1],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000
case'.':if(match[3]>12||match[1]>31){return fail}
return new Date(match[5],parseInt(match[3],10)-1,match[1],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000
case'/':if(match[1]>12||match[3]>31){return fail}
return new Date(match[5],parseInt(match[1],10)-1,match[3],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000}}else{switch(match[2]){case'-':if(match[3]>12||match[5]>31||(match[1]<70&&match[1]>38)){return fail}
year=match[1]>=0&&match[1]<=38?+match[1]+2000:match[1]
return new Date(year,parseInt(match[3],10)-1,match[5],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000
case'.':if(match[5]>=70){if(match[3]>12||match[1]>31){return fail}
return new Date(match[5],parseInt(match[3],10)-1,match[1],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000}
if(match[5]<60&&!match[6]){if(match[1]>23||match[3]>59){return fail}
today=new Date()
return new Date(today.getFullYear(),today.getMonth(),today.getDate(),match[1]||0,match[3]||0,match[5]||0,match[9]||0)/1000}
return fail
case'/':if(match[1]>12||match[3]>31||(match[5]<70&&match[5]>38)){return fail}
year=match[5]>=0&&match[5]<=38?+match[5]+2000:match[5]
return new Date(year,parseInt(match[1],10)-1,match[3],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000
case':':if(match[1]>23||match[3]>59||match[5]>59){return fail}
today=new Date()
return new Date(today.getFullYear(),today.getMonth(),today.getDate(),match[1]||0,match[3]||0,match[5]||0)/1000}}}
if(text==='now'){return now===null||isNaN(now)?new Date().getTime()/1000|0:now|0}
if(!isNaN(parsed=Date.parse(text))){return parsed/1000|0}
pattern=new RegExp(['^([0-9]{4}-[0-9]{2}-[0-9]{2})','[ t]','([0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?)','([\\+-][0-9]{2}(:[0-9]{2})?|z)'].join(''))
match=text.match(pattern)
if(match){if(match[4]==='z'){match[4]='Z'}else if(match[4].match(/^([+-][0-9]{2})$/)){match[4]=match[4]+':00'}
if(!isNaN(parsed=Date.parse(match[1]+'T'+match[2]+match[4]))){return parsed/1000|0}}
date=now?new Date(now*1000):new Date()
days={'sun':0,'mon':1,'tue':2,'wed':3,'thu':4,'fri':5,'sat':6}
ranges={'yea':'FullYear','mon':'Month','day':'Date','hou':'Hours','min':'Minutes','sec':'Seconds'}
function lastNext(type,range,modifier){var diff
var day=days[range]
if(typeof day!=='undefined'){diff=day-date.getDay()
if(diff===0){diff=7*modifier}else if(diff>0&&type==='last'){diff-=7}else if(diff<0&&type==='next'){diff+=7}
date.setDate(date.getDate()+diff)}}
function process(val){var splt=val.split(' ')
var type=splt[0]
var range=splt[1].substring(0,3)
var typeIsNumber=/\d+/.test(type)
var ago=splt[2]==='ago'
var num=(type==='last'?-1:1)*(ago?-1:1)
if(typeIsNumber){num*=parseInt(type,10)}
if(ranges.hasOwnProperty(range)&&!splt[1].match(/^mon(day|\.)?$/i)){return date['set'+ranges[range]](date['get'+ranges[range]]()+num)}
if(range==='wee'){return date.setDate(date.getDate()+(num*7))}
if(type==='next'||type==='last'){lastNext(type,range,num)}else if(!typeIsNumber){return false}
return true}
times='(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec'+'|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?'+'|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)'
regex='([+-]?\\d+\\s'+times+'|'+'(last|next)\\s'+times+')(\\sago)?'
match=text.match(new RegExp(regex,'gi'))
if(!match){return fail}
for(i=0,len=match.length;i<len;i++){if(!process(match[i])){return fail}}
return(date.getTime()/1000)}
return{format:format,strtotime:strtotime}}(),true);})(window);(function(window){"use strict";window.ls.container.set('env',function(){return APP_ENV;},true);})(window);(function(window){"use strict";window.ls.container.set('form',function(){function cast(value,to){if(value&&Array.isArray(value)&&to!=='array'){value=value.map(element=>cast(element,to));return value;}
request.onerror=function(){reject(new Error("Network Error"));};request.send(params);})};return{'get':function(path,headers={},params={}){return call('GET',path+((params.length>0)?'?'+buildQuery(params):''),headers,{});},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress);},'put':function(path,headers={},params={},progress=null){return call('PUT',headers,params,progress);},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress);},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress);},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let analytics={create:function(id,source,activity,url){return http.post('/analytics',{'content-type':'application/json'},{id:id,source:source,activity:activity,url:url,version:env.VERSION,setup:env.SETUP});},};return{analytics:analytics,};},true);})(window);(function(window){"use strict";window.ls.container.set('console',function(window){var sdk=new window.Appwrite();var endpoint=window.location.origin+'/v1';sdk.setEndpoint(endpoint).setProject('console').setLocale(APP_ENV.LOCALE);return sdk;},true);})(window);(function(window){"use strict";window.ls.container.set('date',function(){function format(format,datetime){if(!datetime){return null;}
return new Intl.DateTimeFormat('en-US',{timeZone:'UTC',hourCycle:'h24',...format}).format(new Date(datetime));}
return{format:format,}}(),true);})(window);(function(window){"use strict";window.ls.container.set('env',function(){return APP_ENV;},true);})(window);(function(window){"use strict";window.ls.container.set('form',function(){function cast(value,to){if(value&&Array.isArray(value)&&to!=='array'){value=value.map(element=>cast(element,to));return value;}
switch(to){case'int':case'integer':value=parseInt(value);break;case'numeric':value=Number(value);break;case'float':value=parseFloat(value);break;case'string':value=value.toString();if(value.length===0){value=null;}
break;case'json':value=(value)?JSON.parse(value):[];break;case'array':value=(value&&value.constructor&&value.constructor===Array)?value:[value];break;case'array-empty':value=[];break;case'bool':case'boolean':value=(value==='false')?false:value;value=!!value;break;}
return value;}
@ -3810,7 +3712,7 @@ return false;};return{isRTL:isRTL,};},true);})(window);(function(window){"use st
let size=element.dataset["size"]||80;let name=$value.name||$value||"";name=(typeof name!=='string')?'--':name;return def="/v1/avatars/initials?project=console"+"&name="+
encodeURIComponent(name)+"&width="+
size+"&height="+
size;}).add("selectedCollection",function($value,router){return $value===router.params.collectionId?"selected":"";}).add("selectedDocument",function($value,router){return $value===router.params.documentId?"selected":"";}).add("localeString",function($value){$value=parseInt($value);return!Number.isNaN($value)?$value.toLocaleString():"";}).add("date",function($value,date){return $value?date.format("Y-m-d",$value):"";}).add("dateTime",function($value,date){return $value?date.format("Y-m-d H:i",$value):"";}).add("dateText",function($value,date){return $value?date.format("d M Y",$value):"";}).add("timeSince",function($value){$value=$value*1000;let seconds=Math.floor((Date.now()-$value)/1000);let unit="second";let direction="ago";if(seconds<0){seconds=-seconds;direction="from now";}
size;}).add("selectedCollection",function($value,router){return $value===router.params.collectionId?"selected":"";}).add("selectedDocument",function($value,router){return $value===router.params.documentId?"selected":"";}).add("localeString",function($value){$value=parseInt($value);return!Number.isNaN($value)?$value.toLocaleString():"";}).add("dateTime",function($value,date){return $value?date.format({year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit'},$value):"";}).add("date",function($value,date){return $value?date.format({year:'numeric',month:'short',day:'2-digit',},$value):"";}).add("timeSince",function($value){$value=new Date($value).getTime();let now=new Date();now.setMinutes(now.getMinutes()+now.getTimezoneOffset());let timestamp=new Date(now.toISOString()).getTime();let seconds=Math.floor((timestamp-$value)/1000);let unit="second";let direction="ago";if(seconds<0){seconds=-seconds;direction="from now";}
let value=seconds;if(seconds>=31536000){value=Math.floor(seconds/31536000);unit="year";}
else if(seconds>=86400){value=Math.floor(seconds/86400);unit="day";}
else if(seconds>=3600){value=Math.floor(seconds/3600);unit="hour";}
@ -3907,9 +3809,9 @@ button.addEventListener("click",function(){var clone=document.createElement(elem
clone.innerHTML=template;clone.className=element.className;var input=clone.querySelector("input, select, textarea");view.render(clone);if(debug){console.log('Debug: clone: ',clone);console.log('Debug: target: ',target);}
if(target){target.appendChild(clone);}else{button.parentNode.insertBefore(clone,button);}
if(input){input.focus();}
Array.prototype.slice.call(clone.querySelectorAll("[data-remove]")).map(function(obj){obj.addEventListener("click",function(){clone.parentNode.removeChild(clone);obj.scrollIntoView({behavior:"smooth"});});});Array.prototype.slice.call(clone.querySelectorAll("[data-up]")).map(function(obj){obj.addEventListener("click",function(){if(clone.previousElementSibling){clone.parentNode.insertBefore(clone,clone.previousElementSibling);obj.scrollIntoView({behavior:"smooth"});}});});Array.prototype.slice.call(clone.querySelectorAll("[data-down]")).map(function(obj){obj.addEventListener("click",function(){if(clone.nextElementSibling){clone.parentNode.insertBefore(clone.nextElementSibling,clone);obj.scrollIntoView({behavior:"smooth"});}});});});element.parentNode.insertBefore(button,element.nextSibling);element.parentNode.removeChild(element);button.form.addEventListener('reset',function(event){target.innerHTML='';if(first){button.click();}});if(first){button.click();}}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-add",repeat:false,controller:function(element,view,container,document){for(var i=0;i<element.children.length;i++){let button=document.createElement("button");let template=element.children[i].cloneNode(true);let as=element.getAttribute('data-ls-as');let counter=0;button.type="button";button.innerText="Add";button.classList.add("reverse");button.classList.add("margin-end-small");button.addEventListener('click',function(){container.addNamespace(as,'new-'+counter++);console.log(container.namespaces,container.get(as),as);container.set(as,null,true,true);let child=template.cloneNode(true);view.render(child);element.appendChild(child);element.style.visibility='visible';let inputs=child.querySelectorAll('input,textarea');for(let index=0;index<inputs.length;++index){if(inputs[index].type!=='hidden'){inputs[index].focus();break;}}});element.after(button);}}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-chart",controller:function(element,container,date,document){let wrapper=document.createElement("div");let child=document.createElement("canvas");let sources=element.getAttribute('data-forms-chart');let width=element.getAttribute('data-width')||500;let height=element.getAttribute('data-height')||175;let showXAxis=element.getAttribute('data-show-x-axis')||false;let showYAxis=element.getAttribute('data-show-y-axis')||false;let colors=(element.getAttribute('data-colors')||'blue,green,orange,red').split(',');let themes={'blue':'#29b5d9','green':'#4eb55b','orange':'#fba233','red':'#dc3232','create':'#00b680','read':'#009cde','update':'#696fd7','delete':'#da5d95',};let range={'24h':'H:i','7d':'d F Y','30d':'d F Y','90d':'d F Y'}
Array.prototype.slice.call(clone.querySelectorAll("[data-remove]")).map(function(obj){obj.addEventListener("click",function(){clone.parentNode.removeChild(clone);obj.scrollIntoView({behavior:"smooth"});});});Array.prototype.slice.call(clone.querySelectorAll("[data-up]")).map(function(obj){obj.addEventListener("click",function(){if(clone.previousElementSibling){clone.parentNode.insertBefore(clone,clone.previousElementSibling);obj.scrollIntoView({behavior:"smooth"});}});});Array.prototype.slice.call(clone.querySelectorAll("[data-down]")).map(function(obj){obj.addEventListener("click",function(){if(clone.nextElementSibling){clone.parentNode.insertBefore(clone.nextElementSibling,clone);obj.scrollIntoView({behavior:"smooth"});}});});});element.parentNode.insertBefore(button,element.nextSibling);element.parentNode.removeChild(element);button.form.addEventListener('reset',function(event){target.innerHTML='';if(first){button.click();}});if(first){button.click();}}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-add",repeat:false,controller:function(element,view,container,document){for(var i=0;i<element.children.length;i++){let button=document.createElement("button");let template=element.children[i].cloneNode(true);let as=element.getAttribute('data-ls-as');let counter=0;button.type="button";button.innerText="Add";button.classList.add("reverse");button.classList.add("margin-end-small");button.addEventListener('click',function(){container.addNamespace(as,'new-'+counter++);console.log(container.namespaces,container.get(as),as);container.set(as,null,true,true);let child=template.cloneNode(true);view.render(child);element.appendChild(child);element.style.visibility='visible';let inputs=child.querySelectorAll('input,textarea');for(let index=0;index<inputs.length;++index){if(inputs[index].type!=='hidden'){inputs[index].focus();break;}}});element.after(button);}}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-chart",controller:function(element,container,date,document){let wrapper=document.createElement("div");let child=document.createElement("canvas");let sources=element.getAttribute('data-forms-chart');let width=element.getAttribute('data-width')||500;let height=element.getAttribute('data-height')||175;let showXAxis=element.getAttribute('data-show-x-axis')||false;let showYAxis=element.getAttribute('data-show-y-axis')||false;let colors=(element.getAttribute('data-colors')||'blue,green,orange,red').split(',');let themes={'blue':'#29b5d9','green':'#4eb55b','orange':'#fba233','red':'#dc3232','create':'#00b680','read':'#009cde','update':'#696fd7','delete':'#da5d95',};let range={'24h':{hour:'2-digit',minute:'2-digit'},'7d':{year:'numeric',month:'short',day:'2-digit',},'30d':{year:'numeric',month:'short',day:'2-digit',},'90d':{year:'numeric',month:'short',day:'2-digit',}}
let ticksCount=5;element.parentNode.insertBefore(wrapper,element.nextSibling);wrapper.classList.add('content');child.width=width;child.height=height;sources=sources.split(',');wrapper.appendChild(child);let chart=null;let check=function(){let config={type:"line",data:{labels:[],datasets:[]},options:{animation:{duration:0},responsive:true,hover:{mode:"nearest",intersect:false},scales:{x:{display:showXAxis},y:{display:showYAxis,min:0,ticks:{count:ticksCount,fontColor:"#8f8f8f"},}},plugins:{title:{display:false,text:"Stats"},legend:{display:false},tooltip:{mode:"index",intersect:false,caretPadding:0},}}};let highest=0;for(let i=0;i<sources.length;i++){let label=sources[i].substring(0,sources[i].indexOf('='));let path=sources[i].substring(sources[i].indexOf('=')+1);let usage=container.get('usage');let data=usage[path];let value=JSON.parse(element.value);config.data.labels[i]=label;config.data.datasets[i]={};config.data.datasets[i].label=label;config.data.datasets[i].borderColor=themes[colors[i]];config.data.datasets[i].backgroundColor=themes[colors[i]]+'36';config.data.datasets[i].borderWidth=2;config.data.datasets[i].data=[0,0,0,0,0,0,0];config.data.datasets[i].fill=true;if(!data){return;}
let dateFormat=(value.range&&range[value.range])?range[value.range]:'d F Y';for(let x=0;x<data.length;x++){if(data[x].value>highest){highest=data[x].value;}
let dateFormat=(value.range&&range[value.range])?range[value.range]:{year:'numeric',month:'short',day:'2-digit',};for(let x=0;x<data.length;x++){if(data[x].value>highest){highest=data[x].value;}
config.data.datasets[i].data[x]=data[x].value;config.data.labels[x]=date.format(dateFormat,data[x].date);}}
if(highest==0){config.options.scales.y.ticks.stepSize=1;config.options.scales.y.max=ticksCount;}else{highest=Math.ceil(highest/ticksCount)*ticksCount;config.options.scales.y.ticks.stepSize=highest/ticksCount;config.options.scales.y.max=highest;}
if(chart){chart.destroy();}

View file

@ -963,10 +963,12 @@ gc.splice(0,gcLen);}
return longest;}
function _alignPixel(chart,pixel,width){const devicePixelRatio=chart.currentDevicePixelRatio;const halfWidth=width!==0?Math.max(width/2,0.5):0;return Math.round((pixel-halfWidth)*devicePixelRatio)/devicePixelRatio+halfWidth;}
function clearCanvas(canvas,ctx){ctx=ctx||canvas.getContext('2d');ctx.save();ctx.resetTransform();ctx.clearRect(0,0,canvas.width,canvas.height);ctx.restore();}
function drawPoint(ctx,options,x,y){let type,xOffset,yOffset,size,cornerRadius;const style=options.pointStyle;const rotation=options.rotation;const radius=options.radius;let rad=(rotation||0)*RAD_PER_DEG;if(style&&typeof style==='object'){type=style.toString();if(type==='[object HTMLImageElement]'||type==='[object HTMLCanvasElement]'){ctx.save();ctx.translate(x,y);ctx.rotate(rad);ctx.drawImage(style,-style.width/2,-style.height/2,style.width,style.height);ctx.restore();return;}}
function drawPoint(ctx,options,x,y){drawPointLegend(ctx,options,x,y,null);}
function drawPointLegend(ctx,options,x,y,w){let type,xOffset,yOffset,size,cornerRadius,width;const style=options.pointStyle;const rotation=options.rotation;const radius=options.radius;let rad=(rotation||0)*RAD_PER_DEG;if(style&&typeof style==='object'){type=style.toString();if(type==='[object HTMLImageElement]'||type==='[object HTMLCanvasElement]'){ctx.save();ctx.translate(x,y);ctx.rotate(rad);ctx.drawImage(style,-style.width/2,-style.height/2,style.width,style.height);ctx.restore();return;}}
if(isNaN(radius)||radius<=0){return;}
ctx.beginPath();switch(style){default:ctx.arc(x,y,radius,0,TAU);ctx.closePath();break;case'triangle':ctx.moveTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);rad+=TWO_THIRDS_PI;ctx.lineTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);rad+=TWO_THIRDS_PI;ctx.lineTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);ctx.closePath();break;case'rectRounded':cornerRadius=radius*0.516;size=radius-cornerRadius;xOffset=Math.cos(rad+QUARTER_PI)*size;yOffset=Math.sin(rad+QUARTER_PI)*size;ctx.arc(x-xOffset,y-yOffset,cornerRadius,rad-PI,rad-HALF_PI);ctx.arc(x+yOffset,y-xOffset,cornerRadius,rad-HALF_PI,rad);ctx.arc(x+xOffset,y+yOffset,cornerRadius,rad,rad+HALF_PI);ctx.arc(x-yOffset,y+xOffset,cornerRadius,rad+HALF_PI,rad+PI);ctx.closePath();break;case'rect':if(!rotation){size=Math.SQRT1_2*radius;ctx.rect(x-size,y-size,2*size,2*size);break;}
rad+=QUARTER_PI;case'rectRot':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+yOffset,y-xOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.lineTo(x-yOffset,y+xOffset);ctx.closePath();break;case'crossRot':rad+=QUARTER_PI;case'cross':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);break;case'star':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);rad+=QUARTER_PI;xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);break;case'line':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);break;case'dash':ctx.moveTo(x,y);ctx.lineTo(x+Math.cos(rad)*radius,y+Math.sin(rad)*radius);break;}
ctx.beginPath();switch(style){default:if(w){ctx.ellipse(x,y,w/2,radius,0,0,TAU);}else{ctx.arc(x,y,radius,0,TAU);}
ctx.closePath();break;case'triangle':ctx.moveTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);rad+=TWO_THIRDS_PI;ctx.lineTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);rad+=TWO_THIRDS_PI;ctx.lineTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);ctx.closePath();break;case'rectRounded':cornerRadius=radius*0.516;size=radius-cornerRadius;xOffset=Math.cos(rad+QUARTER_PI)*size;yOffset=Math.sin(rad+QUARTER_PI)*size;ctx.arc(x-xOffset,y-yOffset,cornerRadius,rad-PI,rad-HALF_PI);ctx.arc(x+yOffset,y-xOffset,cornerRadius,rad-HALF_PI,rad);ctx.arc(x+xOffset,y+yOffset,cornerRadius,rad,rad+HALF_PI);ctx.arc(x-yOffset,y+xOffset,cornerRadius,rad+HALF_PI,rad+PI);ctx.closePath();break;case'rect':if(!rotation){size=Math.SQRT1_2*radius;width=w?w/2:size;ctx.rect(x-width,y-size,2*width,2*size);break;}
rad+=QUARTER_PI;case'rectRot':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+yOffset,y-xOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.lineTo(x-yOffset,y+xOffset);ctx.closePath();break;case'crossRot':rad+=QUARTER_PI;case'cross':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);break;case'star':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);rad+=QUARTER_PI;xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);break;case'line':xOffset=w?w/2:Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);break;case'dash':ctx.moveTo(x,y);ctx.lineTo(x+Math.cos(rad)*radius,y+Math.sin(rad)*radius);break;}
ctx.fill();if(options.borderWidth>0){ctx.stroke();}}
function _isPointInArea(point,area,margin){margin=margin||0.5;return!area||(point&&point.x>area.left-margin&&point.x<area.right+margin&&point.y>area.top-margin&&point.y<area.bottom+margin);}
function clipArea(ctx,area){ctx.save();ctx.beginPath();ctx.rect(area.left,area.top,area.right-area.left,area.bottom-area.top);ctx.clip();}
@ -1116,7 +1118,7 @@ if(start<i-1){addStyle(start,i-1,segment.loop,prevStyle);}}
return result;}
function readStyle(options){return{backgroundColor:options.backgroundColor,borderCapStyle:options.borderCapStyle,borderDash:options.borderDash,borderDashOffset:options.borderDashOffset,borderJoinStyle:options.borderJoinStyle,borderWidth:options.borderWidth,borderColor:options.borderColor};}
function styleChanged(style,prevStyle){return prevStyle&&JSON.stringify(style)!==JSON.stringify(prevStyle);}
var helpers=Object.freeze({__proto__:null,easingEffects:effects,isPatternOrGradient:isPatternOrGradient,color:color,getHoverColor:getHoverColor,noop:noop,uid:uid,isNullOrUndef:isNullOrUndef,isArray:isArray,isObject:isObject,isFinite:isNumberFinite,finiteOrDefault:finiteOrDefault,valueOrDefault:valueOrDefault,toPercentage:toPercentage,toDimension:toDimension,callback:callback,each:each,_elementsEqual:_elementsEqual,clone:clone,_merger:_merger,merge:merge,mergeIf:mergeIf,_mergerIf:_mergerIf,_deprecated:_deprecated,resolveObjectKey:resolveObjectKey,_capitalize:_capitalize,defined:defined,isFunction:isFunction,setsEqual:setsEqual,_isClickEvent:_isClickEvent,toFontString:toFontString,_measureText:_measureText,_longestText:_longestText,_alignPixel:_alignPixel,clearCanvas:clearCanvas,drawPoint:drawPoint,_isPointInArea:_isPointInArea,clipArea:clipArea,unclipArea:unclipArea,_steppedLineTo:_steppedLineTo,_bezierCurveTo:_bezierCurveTo,renderText:renderText,addRoundedRectPath:addRoundedRectPath,_lookup:_lookup,_lookupByKey:_lookupByKey,_rlookupByKey:_rlookupByKey,_filterBetween:_filterBetween,listenArrayEvents:listenArrayEvents,unlistenArrayEvents:unlistenArrayEvents,_arrayUnique:_arrayUnique,_createResolver:_createResolver,_attachContext:_attachContext,_descriptors:_descriptors,_parseObjectDataRadialScale:_parseObjectDataRadialScale,splineCurve:splineCurve,splineCurveMonotone:splineCurveMonotone,_updateBezierControlPoints:_updateBezierControlPoints,_isDomSupported:_isDomSupported,_getParentNode:_getParentNode,getStyle:getStyle,getRelativePosition:getRelativePosition,getMaximumSize:getMaximumSize,retinaScale:retinaScale,supportsEventListenerOptions:supportsEventListenerOptions,readUsedSize:readUsedSize,fontString:fontString,requestAnimFrame:requestAnimFrame,throttled:throttled,debounce:debounce,_toLeftRightCenter:_toLeftRightCenter,_alignStartEnd:_alignStartEnd,_textX:_textX,_pointInLine:_pointInLine,_steppedInterpolation:_steppedInterpolation,_bezierInterpolation:_bezierInterpolation,formatNumber:formatNumber,toLineHeight:toLineHeight,_readValueToProps:_readValueToProps,toTRBL:toTRBL,toTRBLCorners:toTRBLCorners,toPadding:toPadding,toFont:toFont,resolve:resolve,_addGrace:_addGrace,createContext:createContext,PI:PI,TAU:TAU,PITAU:PITAU,INFINITY:INFINITY,RAD_PER_DEG:RAD_PER_DEG,HALF_PI:HALF_PI,QUARTER_PI:QUARTER_PI,TWO_THIRDS_PI:TWO_THIRDS_PI,log10:log10,sign:sign,niceNum:niceNum,_factorize:_factorize,isNumber:isNumber,almostEquals:almostEquals,almostWhole:almostWhole,_setMinAndMaxByKey:_setMinAndMaxByKey,toRadians:toRadians,toDegrees:toDegrees,_decimalPlaces:_decimalPlaces,getAngleFromPoint:getAngleFromPoint,distanceBetweenPoints:distanceBetweenPoints,_angleDiff:_angleDiff,_normalizeAngle:_normalizeAngle,_angleBetween:_angleBetween,_limitValue:_limitValue,_int16Range:_int16Range,_isBetween:_isBetween,getRtlAdapter:getRtlAdapter,overrideTextDirection:overrideTextDirection,restoreTextDirection:restoreTextDirection,_boundSegment:_boundSegment,_boundSegments:_boundSegments,_computeSegments:_computeSegments});function binarySearch(metaset,axis,value,intersect){const{controller,data,_sorted}=metaset;const iScale=controller._cachedMeta.iScale;if(iScale&&axis===iScale.axis&&axis!=='r'&&_sorted&&data.length){const lookupMethod=iScale._reversePixels?_rlookupByKey:_lookupByKey;if(!intersect){return lookupMethod(data,axis,value);}else if(controller._sharedOptions){const el=data[0];const range=typeof el.getRange==='function'&&el.getRange(axis);if(range){const start=lookupMethod(data,axis,value-range);const end=lookupMethod(data,axis,value+range);return{lo:start.lo,hi:end.hi};}}}
var helpers=Object.freeze({__proto__:null,easingEffects:effects,isPatternOrGradient:isPatternOrGradient,color:color,getHoverColor:getHoverColor,noop:noop,uid:uid,isNullOrUndef:isNullOrUndef,isArray:isArray,isObject:isObject,isFinite:isNumberFinite,finiteOrDefault:finiteOrDefault,valueOrDefault:valueOrDefault,toPercentage:toPercentage,toDimension:toDimension,callback:callback,each:each,_elementsEqual:_elementsEqual,clone:clone,_merger:_merger,merge:merge,mergeIf:mergeIf,_mergerIf:_mergerIf,_deprecated:_deprecated,resolveObjectKey:resolveObjectKey,_capitalize:_capitalize,defined:defined,isFunction:isFunction,setsEqual:setsEqual,_isClickEvent:_isClickEvent,toFontString:toFontString,_measureText:_measureText,_longestText:_longestText,_alignPixel:_alignPixel,clearCanvas:clearCanvas,drawPoint:drawPoint,drawPointLegend:drawPointLegend,_isPointInArea:_isPointInArea,clipArea:clipArea,unclipArea:unclipArea,_steppedLineTo:_steppedLineTo,_bezierCurveTo:_bezierCurveTo,renderText:renderText,addRoundedRectPath:addRoundedRectPath,_lookup:_lookup,_lookupByKey:_lookupByKey,_rlookupByKey:_rlookupByKey,_filterBetween:_filterBetween,listenArrayEvents:listenArrayEvents,unlistenArrayEvents:unlistenArrayEvents,_arrayUnique:_arrayUnique,_createResolver:_createResolver,_attachContext:_attachContext,_descriptors:_descriptors,_parseObjectDataRadialScale:_parseObjectDataRadialScale,splineCurve:splineCurve,splineCurveMonotone:splineCurveMonotone,_updateBezierControlPoints:_updateBezierControlPoints,_isDomSupported:_isDomSupported,_getParentNode:_getParentNode,getStyle:getStyle,getRelativePosition:getRelativePosition,getMaximumSize:getMaximumSize,retinaScale:retinaScale,supportsEventListenerOptions:supportsEventListenerOptions,readUsedSize:readUsedSize,fontString:fontString,requestAnimFrame:requestAnimFrame,throttled:throttled,debounce:debounce,_toLeftRightCenter:_toLeftRightCenter,_alignStartEnd:_alignStartEnd,_textX:_textX,_pointInLine:_pointInLine,_steppedInterpolation:_steppedInterpolation,_bezierInterpolation:_bezierInterpolation,formatNumber:formatNumber,toLineHeight:toLineHeight,_readValueToProps:_readValueToProps,toTRBL:toTRBL,toTRBLCorners:toTRBLCorners,toPadding:toPadding,toFont:toFont,resolve:resolve,_addGrace:_addGrace,createContext:createContext,PI:PI,TAU:TAU,PITAU:PITAU,INFINITY:INFINITY,RAD_PER_DEG:RAD_PER_DEG,HALF_PI:HALF_PI,QUARTER_PI:QUARTER_PI,TWO_THIRDS_PI:TWO_THIRDS_PI,log10:log10,sign:sign,niceNum:niceNum,_factorize:_factorize,isNumber:isNumber,almostEquals:almostEquals,almostWhole:almostWhole,_setMinAndMaxByKey:_setMinAndMaxByKey,toRadians:toRadians,toDegrees:toDegrees,_decimalPlaces:_decimalPlaces,getAngleFromPoint:getAngleFromPoint,distanceBetweenPoints:distanceBetweenPoints,_angleDiff:_angleDiff,_normalizeAngle:_normalizeAngle,_angleBetween:_angleBetween,_limitValue:_limitValue,_int16Range:_int16Range,_isBetween:_isBetween,getRtlAdapter:getRtlAdapter,overrideTextDirection:overrideTextDirection,restoreTextDirection:restoreTextDirection,_boundSegment:_boundSegment,_boundSegments:_boundSegments,_computeSegments:_computeSegments});function binarySearch(metaset,axis,value,intersect){const{controller,data,_sorted}=metaset;const iScale=controller._cachedMeta.iScale;if(iScale&&axis===iScale.axis&&axis!=='r'&&_sorted&&data.length){const lookupMethod=iScale._reversePixels?_rlookupByKey:_lookupByKey;if(!intersect){return lookupMethod(data,axis,value);}else if(controller._sharedOptions){const el=data[0];const range=typeof el.getRange==='function'&&el.getRange(axis);if(range){const start=lookupMethod(data,axis,value-range);const end=lookupMethod(data,axis,value+range);return{lo:start.lo,hi:end.hi};}}}
return{lo:0,hi:data.length-1};}
function evaluateInteractionItems(chart,axis,position,handler,intersect){const metasets=chart.getSortedVisibleDatasetMetas();const value=position[axis];for(let i=0,ilen=metasets.length;i<ilen;++i){const{index,data}=metasets[i];const{lo,hi}=binarySearch(metasets[i],axis,value,intersect);for(let j=lo;j<=hi;++j){const element=data[j];if(!element.skip){handler(element,index,j);}}}}
function getDistanceMetricForAxis(axis){const useX=axis.indexOf('x')!==-1;const useY=axis.indexOf('y')!==-1;return function(pt1,pt2){const deltaX=useX?Math.abs(pt1.x-pt2.x):0;const deltaY=useY?Math.abs(pt1.y-pt2.y):0;return Math.sqrt(Math.pow(deltaX,2)+Math.pow(deltaY,2));};}
@ -1336,6 +1338,7 @@ return animations;}
getSharedOptions(options){if(!options.$shared){return;}
return this._sharedOptions||(this._sharedOptions=Object.assign({},options));}
includeOptions(mode,sharedOptions){return!sharedOptions||isDirectUpdateMode(mode)||this.chart._animationsDisabled;}
_getSharedOptions(start,mode){const firstOpts=this.resolveDataElementOptions(start,mode);const previouslySharedOptions=this._sharedOptions;const sharedOptions=this.getSharedOptions(firstOpts);const includeOptions=this.includeOptions(mode,sharedOptions)||(sharedOptions!==previouslySharedOptions);this.updateSharedOptions(sharedOptions,mode,firstOpts);return{sharedOptions,includeOptions};}
updateElement(element,index,properties,mode){if(isDirectUpdateMode(mode)){Object.assign(element,properties);}else{this._resolveAnimations(index,mode).update(element,properties);}}
updateSharedOptions(sharedOptions,mode,newOptions){if(sharedOptions&&!isDirectUpdateMode(mode)){this._resolveAnimations(undefined,mode).update(sharedOptions,newOptions);}}
_setStyle(element,index,mode,active){element.active=active;const options=this.getStyle(index,active);this._resolveAnimations(index,mode,active).update(element,{options:(!active&&this.getSharedOptions(options))||options});}
@ -1581,16 +1584,17 @@ _descriptors(chart){if(this._cache){return this._cache;}
const descriptors=this._cache=this._createDescriptors(chart);this._notifyStateChanges(chart);return descriptors;}
_createDescriptors(chart,all){const config=chart&&chart.config;const options=valueOrDefault(config.options&&config.options.plugins,{});const plugins=allPlugins(config);return options===false&&!all?[]:createDescriptors(chart,plugins,options,all);}
_notifyStateChanges(chart){const previousDescriptors=this._oldCache||[];const descriptors=this._cache;const diff=(a,b)=>a.filter(x=>!b.some(y=>x.plugin.id===y.plugin.id));this._notify(diff(previousDescriptors,descriptors),chart,'stop');this._notify(diff(descriptors,previousDescriptors),chart,'start');}}
function allPlugins(config){const plugins=[];const keys=Object.keys(registry.plugins.items);for(let i=0;i<keys.length;i++){plugins.push(registry.getPlugin(keys[i]));}
const local=config.plugins||[];for(let i=0;i<local.length;i++){const plugin=local[i];if(plugins.indexOf(plugin)===-1){plugins.push(plugin);}}
return plugins;}
function allPlugins(config){const localIds={};const plugins=[];const keys=Object.keys(registry.plugins.items);for(let i=0;i<keys.length;i++){plugins.push(registry.getPlugin(keys[i]));}
const local=config.plugins||[];for(let i=0;i<local.length;i++){const plugin=local[i];if(plugins.indexOf(plugin)===-1){plugins.push(plugin);localIds[plugin.id]=true;}}
return{plugins,localIds};}
function getOpts(options,all){if(!all&&options===false){return null;}
if(options===true){return{};}
return options;}
function createDescriptors(chart,plugins,options,all){const result=[];const context=chart.getContext();for(let i=0;i<plugins.length;i++){const plugin=plugins[i];const id=plugin.id;const opts=getOpts(options[id],all);if(opts===null){continue;}
result.push({plugin,options:pluginOpts(chart.config,plugin,opts,context)});}
function createDescriptors(chart,{plugins,localIds},options,all){const result=[];const context=chart.getContext();for(const plugin of plugins){const id=plugin.id;const opts=getOpts(options[id],all);if(opts===null){continue;}
result.push({plugin,options:pluginOpts(chart.config,{plugin,local:localIds[id]},opts,context)});}
return result;}
function pluginOpts(config,plugin,opts,context){const keys=config.pluginScopeKeys(plugin);const scopes=config.getOptionScopes(opts,keys);return config.createResolver(scopes,context,[''],{scriptable:false,indexable:false,allKeys:true});}
function pluginOpts(config,{plugin,local},opts,context){const keys=config.pluginScopeKeys(plugin);const scopes=config.getOptionScopes(opts,keys);if(local&&plugin.defaults){scopes.push(plugin.defaults);}
return config.createResolver(scopes,context,[''],{scriptable:false,indexable:false,allKeys:true});}
function getIndexAxis(type,options){const datasetDefaults=defaults.datasets[type]||{};const datasetOptions=(options.datasets||{})[type]||{};return datasetOptions.indexAxis||options.indexAxis||datasetDefaults.indexAxis||'x';}
function getAxisFromDefaultScaleID(id,indexAxis){let axis=id;if(id==='_index_'){axis=indexAxis;}else if(id==='_value_'){axis=indexAxis==='x'?'y':'x';}
return axis;}
@ -1639,7 +1643,7 @@ const cacheKey=prefixes.join();let cached=cache.get(cacheKey);if(!cached){const
return cached;}
const hasFunction=value=>isObject(value)&&Object.getOwnPropertyNames(value).reduce((acc,key)=>acc||isFunction(value[key]),false);function needContext(proxy,names){const{isScriptable,isIndexable}=_descriptors(proxy);for(const prop of names){const scriptable=isScriptable(prop);const indexable=isIndexable(prop);const value=(indexable||scriptable)&&proxy[prop];if((scriptable&&(isFunction(value)||hasFunction(value)))||(indexable&&isArray(value))){return true;}}
return false;}
var version="3.8.0";const KNOWN_POSITIONS=['top','bottom','left','right','chartArea'];function positionIsHorizontal(position,axis){return position==='top'||position==='bottom'||(KNOWN_POSITIONS.indexOf(position)===-1&&axis==='x');}
var version="3.8.2";const KNOWN_POSITIONS=['top','bottom','left','right','chartArea'];function positionIsHorizontal(position,axis){return position==='top'||position==='bottom'||(KNOWN_POSITIONS.indexOf(position)===-1&&axis==='x');}
function compare2Level(l1,l2){return function(a,b){return a[l1]===b[l1]?a[l2]-b[l2]:a[l1]-b[l1];};}
function onAnimationsComplete(context){const chart=context.chart;const animationOptions=chart.options.animation;chart.notifyPlugins('afterRender');callback(animationOptions&&animationOptions.onComplete,[context],chart);}
function onAnimationProgress(context){const chart=context.chart;const animationOptions=chart.options.animation;callback(animationOptions&&animationOptions.onProgress,[context],chart);}
@ -1650,7 +1654,7 @@ const instances={};const getChart=(key)=>{const canvas=getCanvas(key);return Obj
function determineLastEvent(e,lastEvent,inChartArea,isClick){if(!inChartArea||e.type==='mouseout'){return null;}
if(isClick){return lastEvent;}
return e;}
class Chart{constructor(item,userConfig){const config=this.config=new Config(userConfig);const initialCanvas=getCanvas(item);const existingChart=getChart(initialCanvas);if(existingChart){throw new Error('Canvas is already in use. Chart with ID \''+existingChart.id+'\''+' must be destroyed before the canvas can be reused.');}
class Chart{constructor(item,userConfig){const config=this.config=new Config(userConfig);const initialCanvas=getCanvas(item);const existingChart=getChart(initialCanvas);if(existingChart){throw new Error('Canvas is already in use. Chart with ID \''+existingChart.id+'\''+' must be destroyed before the canvas with ID \''+existingChart.canvas.id+'\' can be reused.');}
const options=config.createResolver(config.chartOptionScopes(),this.getContext());this.platform=new(config.platform||_detectPlatform(initialCanvas))();this.platform.updateConfig(config);const context=this.platform.acquireContext(initialCanvas,options.aspectRatio);const canvas=context&&context.canvas;const height=canvas&&canvas.height;const width=canvas&&canvas.width;this.id=uid();this.ctx=context;this.canvas=canvas;this.width=width;this.height=height;this._options=options;this._aspectRatio=this.aspectRatio;this._layers=[];this._metasets=[];this._stacks=undefined;this.boxes=[];this.currentDevicePixelRatio=undefined;this.chartArea=undefined;this._active=[];this._lastEvent=undefined;this._listeners={};this._responsiveListeners=undefined;this._sortedMetasets=[];this.scales={};this._plugins=new PluginService();this.$proxies={};this._hiddenIndices={};this.attached=false;this._animationsDisabled=undefined;this.$context=undefined;this._doResize=debounce(mode=>this.update(mode),options.resizeDelay||0);this._dataChanges=[];instances[this.id]=this;if(!context||!canvas){console.error("Failed to create chart: can't acquire context from the given item");return;}
animator.listen(this,'complete',onAnimationsComplete);animator.listen(this,'progress',onAnimationProgress);this._initialize();if(this.attached){this.update();}}
get aspectRatio(){const{options:{aspectRatio,maintainAspectRatio},width,height,_aspectRatio}=this;if(!isNullOrUndef(aspectRatio)){return aspectRatio;}
@ -1815,12 +1819,11 @@ getMaxOverflow(){return 0;}
getLabelAndValue(index){const meta=this._cachedMeta;const{iScale,vScale}=meta;const parsed=this.getParsed(index);const custom=parsed._custom;const value=isFloatBar(custom)?'['+custom.start+', '+custom.end+']':''+vScale.getLabelForValue(parsed[vScale.axis]);return{label:''+iScale.getLabelForValue(parsed[iScale.axis]),value};}
initialize(){this.enableOptionSharing=true;super.initialize();const meta=this._cachedMeta;meta.stack=this.getDataset().stack;}
update(mode){const meta=this._cachedMeta;this.updateElements(meta.data,0,meta.data.length,mode);}
updateElements(bars,start,count,mode){const reset=mode==='reset';const{index,_cachedMeta:{vScale}}=this;const base=vScale.getBasePixel();const horizontal=vScale.isHorizontal();const ruler=this._getRuler();const firstOpts=this.resolveDataElementOptions(start,mode);const sharedOptions=this.getSharedOptions(firstOpts);const includeOptions=this.includeOptions(mode,sharedOptions);this.updateSharedOptions(sharedOptions,mode,firstOpts);for(let i=start;i<start+count;i++){const parsed=this.getParsed(i);const vpixels=reset||isNullOrUndef(parsed[vScale.axis])?{base,head:base}:this._calculateBarValuePixels(i);const ipixels=this._calculateBarIndexPixels(i,ruler);const stack=(parsed._stacks||{})[vScale.axis];const properties={horizontal,base:vpixels.base,enableBorderRadius:!stack||isFloatBar(parsed._custom)||(index===stack._top||index===stack._bottom),x:horizontal?vpixels.head:ipixels.center,y:horizontal?ipixels.center:vpixels.head,height:horizontal?ipixels.size:Math.abs(vpixels.size),width:horizontal?Math.abs(vpixels.size):ipixels.size};if(includeOptions){properties.options=sharedOptions||this.resolveDataElementOptions(i,bars[i].active?'active':mode);}
updateElements(bars,start,count,mode){const reset=mode==='reset';const{index,_cachedMeta:{vScale}}=this;const base=vScale.getBasePixel();const horizontal=vScale.isHorizontal();const ruler=this._getRuler();const{sharedOptions,includeOptions}=this._getSharedOptions(start,mode);for(let i=start;i<start+count;i++){const parsed=this.getParsed(i);const vpixels=reset||isNullOrUndef(parsed[vScale.axis])?{base,head:base}:this._calculateBarValuePixels(i);const ipixels=this._calculateBarIndexPixels(i,ruler);const stack=(parsed._stacks||{})[vScale.axis];const properties={horizontal,base:vpixels.base,enableBorderRadius:!stack||isFloatBar(parsed._custom)||(index===stack._top||index===stack._bottom),x:horizontal?vpixels.head:ipixels.center,y:horizontal?ipixels.center:vpixels.head,height:horizontal?ipixels.size:Math.abs(vpixels.size),width:horizontal?Math.abs(vpixels.size):ipixels.size};if(includeOptions){properties.options=sharedOptions||this.resolveDataElementOptions(i,bars[i].active?'active':mode);}
const options=properties.options||bars[i].options;setBorderSkipped(properties,options,stack,index);setInflateAmount(properties,options,ruler.ratio);this.updateElement(bars[i],i,properties,mode);}}
_getStacks(last,dataIndex){const meta=this._cachedMeta;const iScale=meta.iScale;const metasets=iScale.getMatchingVisibleMetas(this._type);const stacked=iScale.options.stacked;const ilen=metasets.length;const stacks=[];let i,item;for(i=0;i<ilen;++i){item=metasets[i];if(!item.controller.options.grouped){continue;}
if(typeof dataIndex!=='undefined'){const val=item.controller.getParsed(dataIndex)[item.controller._cachedMeta.vScale.axis];if(isNullOrUndef(val)||isNaN(val)){continue;}}
if(stacked===false||stacks.indexOf(item.stack)===-1||(stacked===undefined&&item.stack===undefined)){stacks.push(item.stack);}
if(item.index===last){break;}}
_getStacks(last,dataIndex){const{iScale}=this._cachedMeta;const metasets=iScale.getMatchingVisibleMetas(this._type).filter(meta=>meta.controller.options.grouped);const stacked=iScale.options.stacked;const stacks=[];const skipNull=(meta)=>{const parsed=meta.controller.getParsed(dataIndex);const val=parsed&&parsed[meta.vScale.axis];if(isNullOrUndef(val)||isNaN(val)){return true;}};for(const meta of metasets){if(dataIndex!==undefined&&skipNull(meta)){continue;}
if(stacked===false||stacks.indexOf(meta.stack)===-1||(stacked===undefined&&meta.stack===undefined)){stacks.push(meta.stack);}
if(meta.index===last){break;}}
if(!stacks.length){stacks.push(undefined);}
return stacks;}
_getStackCount(index){return this._getStacks(undefined,index).length;}
@ -1849,9 +1852,8 @@ getMaxOverflow(){const data=this._cachedMeta.data;let max=0;for(let i=data.lengt
return max>0&&max;}
getLabelAndValue(index){const meta=this._cachedMeta;const{xScale,yScale}=meta;const parsed=this.getParsed(index);const x=xScale.getLabelForValue(parsed.x);const y=yScale.getLabelForValue(parsed.y);const r=parsed._custom;return{label:meta.label,value:'('+x+', '+y+(r?', '+r:'')+')'};}
update(mode){const points=this._cachedMeta.data;this.updateElements(points,0,points.length,mode);}
updateElements(points,start,count,mode){const reset=mode==='reset';const{iScale,vScale}=this._cachedMeta;const firstOpts=this.resolveDataElementOptions(start,mode);const sharedOptions=this.getSharedOptions(firstOpts);const includeOptions=this.includeOptions(mode,sharedOptions);const iAxis=iScale.axis;const vAxis=vScale.axis;for(let i=start;i<start+count;i++){const point=points[i];const parsed=!reset&&this.getParsed(i);const properties={};const iPixel=properties[iAxis]=reset?iScale.getPixelForDecimal(0.5):iScale.getPixelForValue(parsed[iAxis]);const vPixel=properties[vAxis]=reset?vScale.getBasePixel():vScale.getPixelForValue(parsed[vAxis]);properties.skip=isNaN(iPixel)||isNaN(vPixel);if(includeOptions){properties.options=this.resolveDataElementOptions(i,point.active?'active':mode);if(reset){properties.options.radius=0;}}
this.updateElement(point,i,properties,mode);}
this.updateSharedOptions(sharedOptions,mode,firstOpts);}
updateElements(points,start,count,mode){const reset=mode==='reset';const{iScale,vScale}=this._cachedMeta;const{sharedOptions,includeOptions}=this._getSharedOptions(start,mode);const iAxis=iScale.axis;const vAxis=vScale.axis;for(let i=start;i<start+count;i++){const point=points[i];const parsed=!reset&&this.getParsed(i);const properties={};const iPixel=properties[iAxis]=reset?iScale.getPixelForDecimal(0.5):iScale.getPixelForValue(parsed[iAxis]);const vPixel=properties[vAxis]=reset?vScale.getBasePixel():vScale.getPixelForValue(parsed[vAxis]);properties.skip=isNaN(iPixel)||isNaN(vPixel);if(includeOptions){properties.options=sharedOptions||this.resolveDataElementOptions(i,point.active?'active':mode);if(reset){properties.options.radius=0;}}
this.updateElement(point,i,properties,mode);}}
resolveDataElementOptions(index,mode){const parsed=this.getParsed(index);let values=super.resolveDataElementOptions(index,mode);if(values.$shared){values=Object.assign({},values,{$shared:false});}
const radius=values.radius;if(mode!=='active'){values.radius=0;}
values.radius+=valueOrDefault(parsed&&parsed._custom,radius);return values;}}
@ -1868,10 +1870,9 @@ return{rotation:min,circumference:max-min,};}
update(mode){const chart=this.chart;const{chartArea}=chart;const meta=this._cachedMeta;const arcs=meta.data;const spacing=this.getMaxBorderWidth()+this.getMaxOffset(arcs)+this.options.spacing;const maxSize=Math.max((Math.min(chartArea.width,chartArea.height)-spacing)/2,0);const cutout=Math.min(toPercentage(this.options.cutout,maxSize),1);const chartWeight=this._getRingWeight(this.index);const{circumference,rotation}=this._getRotationExtents();const{ratioX,ratioY,offsetX,offsetY}=getRatioAndOffset(rotation,circumference,cutout);const maxWidth=(chartArea.width-spacing)/ratioX;const maxHeight=(chartArea.height-spacing)/ratioY;const maxRadius=Math.max(Math.min(maxWidth,maxHeight)/2,0);const outerRadius=toDimension(this.options.radius,maxRadius);const innerRadius=Math.max(outerRadius*cutout,0);const radiusLength=(outerRadius-innerRadius)/this._getVisibleDatasetWeightTotal();this.offsetX=offsetX*outerRadius;this.offsetY=offsetY*outerRadius;meta.total=this.calculateTotal();this.outerRadius=outerRadius-radiusLength*this._getRingWeightOffset(this.index);this.innerRadius=Math.max(this.outerRadius-radiusLength*chartWeight,0);this.updateElements(arcs,0,arcs.length,mode);}
_circumference(i,reset){const opts=this.options;const meta=this._cachedMeta;const circumference=this._getCircumference();if((reset&&opts.animation.animateRotate)||!this.chart.getDataVisibility(i)||meta._parsed[i]===null||meta.data[i].hidden){return 0;}
return this.calculateCircumference(meta._parsed[i]*circumference/TAU);}
updateElements(arcs,start,count,mode){const reset=mode==='reset';const chart=this.chart;const chartArea=chart.chartArea;const opts=chart.options;const animationOpts=opts.animation;const centerX=(chartArea.left+chartArea.right)/2;const centerY=(chartArea.top+chartArea.bottom)/2;const animateScale=reset&&animationOpts.animateScale;const innerRadius=animateScale?0:this.innerRadius;const outerRadius=animateScale?0:this.outerRadius;const firstOpts=this.resolveDataElementOptions(start,mode);const sharedOptions=this.getSharedOptions(firstOpts);const includeOptions=this.includeOptions(mode,sharedOptions);let startAngle=this._getRotation();let i;for(i=0;i<start;++i){startAngle+=this._circumference(i,reset);}
updateElements(arcs,start,count,mode){const reset=mode==='reset';const chart=this.chart;const chartArea=chart.chartArea;const opts=chart.options;const animationOpts=opts.animation;const centerX=(chartArea.left+chartArea.right)/2;const centerY=(chartArea.top+chartArea.bottom)/2;const animateScale=reset&&animationOpts.animateScale;const innerRadius=animateScale?0:this.innerRadius;const outerRadius=animateScale?0:this.outerRadius;const{sharedOptions,includeOptions}=this._getSharedOptions(start,mode);let startAngle=this._getRotation();let i;for(i=0;i<start;++i){startAngle+=this._circumference(i,reset);}
for(i=start;i<start+count;++i){const circumference=this._circumference(i,reset);const arc=arcs[i];const properties={x:centerX+this.offsetX,y:centerY+this.offsetY,startAngle,endAngle:startAngle+circumference,circumference,outerRadius,innerRadius};if(includeOptions){properties.options=sharedOptions||this.resolveDataElementOptions(i,arc.active?'active':mode);}
startAngle+=circumference;this.updateElement(arc,i,properties,mode);}
this.updateSharedOptions(sharedOptions,mode,firstOpts);}
startAngle+=circumference;this.updateElement(arc,i,properties,mode);}}
calculateTotal(){const meta=this._cachedMeta;const metaData=meta.data;let total=0;let i;for(i=0;i<metaData.length;i++){const value=meta._parsed[i];if(value!==null&&!isNaN(value)&&this.chart.getDataVisibility(i)&&!metaData[i].hidden){total+=Math.abs(value);}}
return total;}
calculateCircumference(value){const total=this._cachedMeta.total;if(total>0&&!isNaN(value)){return TAU*(Math.abs(value)/total);}
@ -1893,11 +1894,10 @@ return dataLabel;}}}}};class LineController extends DatasetController{initialize
update(mode){const meta=this._cachedMeta;const{dataset:line,data:points=[],_dataset}=meta;const animationsDisabled=this.chart._animationsDisabled;let{start,count}=getStartAndCountOfVisiblePoints(meta,points,animationsDisabled);this._drawStart=start;this._drawCount=count;if(scaleRangesChanged(meta)){start=0;count=points.length;}
line._chart=this.chart;line._datasetIndex=this.index;line._decimated=!!_dataset._decimated;line.points=points;const options=this.resolveDatasetElementOptions(mode);if(!this.options.showLine){options.borderWidth=0;}
options.segment=this.options.segment;this.updateElement(line,undefined,{animated:!animationsDisabled,options},mode);this.updateElements(points,start,count,mode);}
updateElements(points,start,count,mode){const reset=mode==='reset';const{iScale,vScale,_stacked,_dataset}=this._cachedMeta;const firstOpts=this.resolveDataElementOptions(start,mode);const sharedOptions=this.getSharedOptions(firstOpts);const includeOptions=this.includeOptions(mode,sharedOptions);const iAxis=iScale.axis;const vAxis=vScale.axis;const{spanGaps,segment}=this.options;const maxGapLength=isNumber(spanGaps)?spanGaps:Number.POSITIVE_INFINITY;const directUpdate=this.chart._animationsDisabled||reset||mode==='none';let prevParsed=start>0&&this.getParsed(start-1);for(let i=start;i<start+count;++i){const point=points[i];const parsed=this.getParsed(i);const properties=directUpdate?point:{};const nullData=isNullOrUndef(parsed[vAxis]);const iPixel=properties[iAxis]=iScale.getPixelForValue(parsed[iAxis],i);const vPixel=properties[vAxis]=reset||nullData?vScale.getBasePixel():vScale.getPixelForValue(_stacked?this.applyStack(vScale,parsed,_stacked):parsed[vAxis],i);properties.skip=isNaN(iPixel)||isNaN(vPixel)||nullData;properties.stop=i>0&&(Math.abs(parsed[iAxis]-prevParsed[iAxis]))>maxGapLength;if(segment){properties.parsed=parsed;properties.raw=_dataset.data[i];}
updateElements(points,start,count,mode){const reset=mode==='reset';const{iScale,vScale,_stacked,_dataset}=this._cachedMeta;const{sharedOptions,includeOptions}=this._getSharedOptions(start,mode);const iAxis=iScale.axis;const vAxis=vScale.axis;const{spanGaps,segment}=this.options;const maxGapLength=isNumber(spanGaps)?spanGaps:Number.POSITIVE_INFINITY;const directUpdate=this.chart._animationsDisabled||reset||mode==='none';let prevParsed=start>0&&this.getParsed(start-1);for(let i=start;i<start+count;++i){const point=points[i];const parsed=this.getParsed(i);const properties=directUpdate?point:{};const nullData=isNullOrUndef(parsed[vAxis]);const iPixel=properties[iAxis]=iScale.getPixelForValue(parsed[iAxis],i);const vPixel=properties[vAxis]=reset||nullData?vScale.getBasePixel():vScale.getPixelForValue(_stacked?this.applyStack(vScale,parsed,_stacked):parsed[vAxis],i);properties.skip=isNaN(iPixel)||isNaN(vPixel)||nullData;properties.stop=i>0&&(Math.abs(parsed[iAxis]-prevParsed[iAxis]))>maxGapLength;if(segment){properties.parsed=parsed;properties.raw=_dataset.data[i];}
if(includeOptions){properties.options=sharedOptions||this.resolveDataElementOptions(i,point.active?'active':mode);}
if(!directUpdate){this.updateElement(point,i,properties,mode);}
prevParsed=parsed;}
this.updateSharedOptions(sharedOptions,mode,firstOpts);}
prevParsed=parsed;}}
getMaxOverflow(){const meta=this._cachedMeta;const dataset=meta.dataset;const border=dataset.options&&dataset.options.borderWidth||0;const data=meta.data||[];if(!data.length){return border;}
const firstPoint=data[0].size(this.resolveDataElementOptions(0));const lastPoint=data[data.length-1].size(this.resolveDataElementOptions(data.length-1));return Math.max(border,firstPoint,lastPoint)/2;}
draw(){const meta=this._cachedMeta;meta.dataset.updateControlPoints(this.chart.chartArea,meta.iScale.axis);super.draw();}}
@ -2064,6 +2064,7 @@ function _getEdge(a,b,prop,fn){if(a&&b){return fn(a[prop],b[prop]);}
return a?a[prop]:b?b[prop]:0;}
function _createBoundaryLine(boundary,line){let points=[];let _loop=false;if(isArray(boundary)){_loop=true;points=boundary;}else{points=_pointsFromSegments(boundary,line);}
return points.length?new LineElement({points,options:{tension:0},_loop,_fullLoop:_loop}):null;}
function _shouldApplyFill(source){return source&&source.fill!==false;}
function _resolveTarget(sources,index,propagate){const source=sources[index];let fill=source.fill;const visited=[index];let target;if(!propagate){return fill;}
while(fill!==false&&visited.indexOf(fill)===-1){if(!isNumberFinite(fill)){return fill;}
target=sources[fill];if(!target){return false;}
@ -2126,9 +2127,9 @@ var index={id:'filler',afterDatasetsUpdate(chart,_args,options){const count=(cha
meta.$filler=source;sources.push(source);}
for(i=0;i<count;++i){source=sources[i];if(!source||source.fill===false){continue;}
source.fill=_resolveTarget(sources,i,options.propagate);}},beforeDraw(chart,_args,options){const draw=options.drawTime==='beforeDraw';const metasets=chart.getSortedVisibleDatasetMetas();const area=chart.chartArea;for(let i=metasets.length-1;i>=0;--i){const source=metasets[i].$filler;if(!source){continue;}
source.line.updateControlPoints(area,source.axis);if(draw){_drawfill(chart.ctx,source,area);}}},beforeDatasetsDraw(chart,_args,options){if(options.drawTime!=='beforeDatasetsDraw'){return;}
const metasets=chart.getSortedVisibleDatasetMetas();for(let i=metasets.length-1;i>=0;--i){const source=metasets[i].$filler;if(source){_drawfill(chart.ctx,source,chart.chartArea);}}},beforeDatasetDraw(chart,args,options){const source=args.meta.$filler;if(!source||source.fill===false||options.drawTime!=='beforeDatasetDraw'){return;}
_drawfill(chart.ctx,source,chart.chartArea);},defaults:{propagate:true,drawTime:'beforeDatasetDraw'}};const getBoxSize=(labelOpts,fontSize)=>{let{boxHeight=fontSize,boxWidth=fontSize}=labelOpts;if(labelOpts.usePointStyle){boxHeight=Math.min(boxHeight,fontSize);boxWidth=Math.min(boxWidth,fontSize);}
source.line.updateControlPoints(area,source.axis);if(draw&&source.fill){_drawfill(chart.ctx,source,area);}}},beforeDatasetsDraw(chart,_args,options){if(options.drawTime!=='beforeDatasetsDraw'){return;}
const metasets=chart.getSortedVisibleDatasetMetas();for(let i=metasets.length-1;i>=0;--i){const source=metasets[i].$filler;if(_shouldApplyFill(source)){_drawfill(chart.ctx,source,chart.chartArea);}}},beforeDatasetDraw(chart,args,options){const source=args.meta.$filler;if(!_shouldApplyFill(source)||options.drawTime!=='beforeDatasetDraw'){return;}
_drawfill(chart.ctx,source,chart.chartArea);},defaults:{propagate:true,drawTime:'beforeDatasetDraw'}};const getBoxSize=(labelOpts,fontSize)=>{let{boxHeight=fontSize,boxWidth=fontSize}=labelOpts;if(labelOpts.usePointStyle){boxHeight=Math.min(boxHeight,fontSize);boxWidth=labelOpts.pointStyleWidth||Math.min(boxWidth,fontSize);}
return{boxWidth,boxHeight,itemHeight:Math.max(fontSize,boxHeight)};};const itemsEqual=(a,b)=>a!==null&&b!==null&&a.datasetIndex===b.datasetIndex&&a.index===b.index;class Legend extends Element{constructor(config){super();this._added=false;this.legendHitBoxes=[];this._hoveredItem=null;this.doughnutMode=false;this.chart=config.chart;this.options=config.options;this.ctx=config.ctx;this.legendItems=undefined;this.columnSizes=undefined;this.lineWidths=undefined;this.maxHeight=undefined;this.maxWidth=undefined;this.top=undefined;this.bottom=undefined;this.left=undefined;this.right=undefined;this.height=undefined;this.width=undefined;this._margins=undefined;this.position=undefined;this.weight=undefined;this.fullSize=undefined;}
update(maxWidth,maxHeight,margins){this.maxWidth=maxWidth;this.maxHeight=maxHeight;this._margins=margins;this.setDimensions();this.buildLabels();this.fit();}
setDimensions(){if(this.isHorizontal()){this.width=this.maxWidth;this.left=this._margins.left;this.right=this.width;}else{this.height=this.maxHeight;this.top=this._margins.top;this.bottom=this.height;}}
@ -2150,7 +2151,7 @@ hitbox.top=top;hitbox.left+=this.left+padding;hitbox.left=rtlHelper.leftForLtr(r
isHorizontal(){return this.options.position==='top'||this.options.position==='bottom';}
draw(){if(this.options.display){const ctx=this.ctx;clipArea(ctx,this);this._draw();unclipArea(ctx);}}
_draw(){const{options:opts,columnSizes,lineWidths,ctx}=this;const{align,labels:labelOpts}=opts;const defaultColor=defaults.color;const rtlHelper=getRtlAdapter(opts.rtl,this.left,this.width);const labelFont=toFont(labelOpts.font);const{color:fontColor,padding}=labelOpts;const fontSize=labelFont.size;const halfFontSize=fontSize/2;let cursor;this.drawTitle();ctx.textAlign=rtlHelper.textAlign('left');ctx.textBaseline='middle';ctx.lineWidth=0.5;ctx.font=labelFont.string;const{boxWidth,boxHeight,itemHeight}=getBoxSize(labelOpts,fontSize);const drawLegendBox=function(x,y,legendItem){if(isNaN(boxWidth)||boxWidth<=0||isNaN(boxHeight)||boxHeight<0){return;}
ctx.save();const lineWidth=valueOrDefault(legendItem.lineWidth,1);ctx.fillStyle=valueOrDefault(legendItem.fillStyle,defaultColor);ctx.lineCap=valueOrDefault(legendItem.lineCap,'butt');ctx.lineDashOffset=valueOrDefault(legendItem.lineDashOffset,0);ctx.lineJoin=valueOrDefault(legendItem.lineJoin,'miter');ctx.lineWidth=lineWidth;ctx.strokeStyle=valueOrDefault(legendItem.strokeStyle,defaultColor);ctx.setLineDash(valueOrDefault(legendItem.lineDash,[]));if(labelOpts.usePointStyle){const drawOptions={radius:boxWidth*Math.SQRT2/2,pointStyle:legendItem.pointStyle,rotation:legendItem.rotation,borderWidth:lineWidth};const centerX=rtlHelper.xPlus(x,boxWidth/2);const centerY=y+halfFontSize;drawPoint(ctx,drawOptions,centerX,centerY);}else{const yBoxTop=y+Math.max((fontSize-boxHeight)/2,0);const xBoxLeft=rtlHelper.leftForLtr(x,boxWidth);const borderRadius=toTRBLCorners(legendItem.borderRadius);ctx.beginPath();if(Object.values(borderRadius).some(v=>v!==0)){addRoundedRectPath(ctx,{x:xBoxLeft,y:yBoxTop,w:boxWidth,h:boxHeight,radius:borderRadius,});}else{ctx.rect(xBoxLeft,yBoxTop,boxWidth,boxHeight);}
ctx.save();const lineWidth=valueOrDefault(legendItem.lineWidth,1);ctx.fillStyle=valueOrDefault(legendItem.fillStyle,defaultColor);ctx.lineCap=valueOrDefault(legendItem.lineCap,'butt');ctx.lineDashOffset=valueOrDefault(legendItem.lineDashOffset,0);ctx.lineJoin=valueOrDefault(legendItem.lineJoin,'miter');ctx.lineWidth=lineWidth;ctx.strokeStyle=valueOrDefault(legendItem.strokeStyle,defaultColor);ctx.setLineDash(valueOrDefault(legendItem.lineDash,[]));if(labelOpts.usePointStyle){const drawOptions={radius:boxHeight*Math.SQRT2/2,pointStyle:legendItem.pointStyle,rotation:legendItem.rotation,borderWidth:lineWidth};const centerX=rtlHelper.xPlus(x,boxWidth/2);const centerY=y+halfFontSize;drawPointLegend(ctx,drawOptions,centerX,centerY,boxWidth);}else{const yBoxTop=y+Math.max((fontSize-boxHeight)/2,0);const xBoxLeft=rtlHelper.leftForLtr(x,boxWidth);const borderRadius=toTRBLCorners(legendItem.borderRadius);ctx.beginPath();if(Object.values(borderRadius).some(v=>v!==0)){addRoundedRectPath(ctx,{x:xBoxLeft,y:yBoxTop,w:boxWidth,h:boxHeight,radius:borderRadius,});}else{ctx.rect(xBoxLeft,yBoxTop,boxWidth,boxHeight);}
ctx.fill();if(lineWidth!==0){ctx.stroke();}}
ctx.restore();};const fillText=function(x,y,legendItem){renderText(ctx,legendItem.text,x,y+(itemHeight/2),labelFont,{strikethrough:legendItem.hidden,textAlign:rtlHelper.textAlign(legendItem.textAlign)});};const isHorizontal=this.isHorizontal();const titleHeight=this._computeTitleHeight();if(isHorizontal){cursor={x:_alignStartEnd(align,this.left+padding,this.right-lineWidths[0]),y:this.top+padding+titleHeight,line:0};}else{cursor={x:this.left+padding,y:_alignStartEnd(align,this.top+titleHeight+padding,this.bottom-columnSizes[0].height),line:0};}
overrideTextDirection(this.ctx,opts.textDirection);const lineHeight=itemHeight+padding;this.legendItems.forEach((legendItem,i)=>{ctx.strokeStyle=legendItem.fontColor||fontColor;ctx.fillStyle=legendItem.fontColor||fontColor;const textWidth=ctx.measureText(legendItem.text).width;const textAlign=rtlHelper.textAlign(legendItem.textAlign||(legendItem.textAlign=labelOpts.textAlign));const width=boxWidth+halfFontSize+textWidth;let x=cursor.x;let y=cursor.y;rtlHelper.setWidth(this.width);if(isHorizontal){if(i>0&&x+width+padding>this.right){y=cursor.y+=lineHeight;cursor.line++;x=cursor.x=_alignStartEnd(align,this.left+padding,this.right-lineWidths[cursor.line]);}}else if(i>0&&y+lineHeight>this.bottom){x=cursor.x=x+columnSizes[cursor.line].width+padding;cursor.line++;y=cursor.y=_alignStartEnd(align,this.top+titleHeight+padding,this.bottom-columnSizes[cursor.line].height);}
@ -2240,7 +2241,7 @@ if(yAlign==='top'){y1=ptY;y2=y1-caretSize;x1=x2-caretSize;x3=x2+caretSize;}else{
y3=y1;}
return{x1,x2,x3,y1,y2,y3};}
drawTitle(pt,ctx,options){const title=this.title;const length=title.length;let titleFont,titleSpacing,i;if(length){const rtlHelper=getRtlAdapter(options.rtl,this.x,this.width);pt.x=getAlignedX(this,options.titleAlign,options);ctx.textAlign=rtlHelper.textAlign(options.titleAlign);ctx.textBaseline='middle';titleFont=toFont(options.titleFont);titleSpacing=options.titleSpacing;ctx.fillStyle=options.titleColor;ctx.font=titleFont.string;for(i=0;i<length;++i){ctx.fillText(title[i],rtlHelper.x(pt.x),pt.y+titleFont.lineHeight/2);pt.y+=titleFont.lineHeight+titleSpacing;if(i+1===length){pt.y+=options.titleMarginBottom-titleSpacing;}}}}
_drawColorBox(ctx,pt,i,rtlHelper,options){const labelColors=this.labelColors[i];const labelPointStyle=this.labelPointStyles[i];const{boxHeight,boxWidth,boxPadding}=options;const bodyFont=toFont(options.bodyFont);const colorX=getAlignedX(this,'left',options);const rtlColorX=rtlHelper.x(colorX);const yOffSet=boxHeight<bodyFont.lineHeight?(bodyFont.lineHeight-boxHeight)/2:0;const colorY=pt.y+yOffSet;if(options.usePointStyle){const drawOptions={radius:Math.min(boxWidth,boxHeight)/2,pointStyle:labelPointStyle.pointStyle,rotation:labelPointStyle.rotation,borderWidth:1};const centerX=rtlHelper.leftForLtr(rtlColorX,boxWidth)+boxWidth/2;const centerY=colorY+boxHeight/2;ctx.strokeStyle=options.multiKeyBackground;ctx.fillStyle=options.multiKeyBackground;drawPoint(ctx,drawOptions,centerX,centerY);ctx.strokeStyle=labelColors.borderColor;ctx.fillStyle=labelColors.backgroundColor;drawPoint(ctx,drawOptions,centerX,centerY);}else{ctx.lineWidth=labelColors.borderWidth||1;ctx.strokeStyle=labelColors.borderColor;ctx.setLineDash(labelColors.borderDash||[]);ctx.lineDashOffset=labelColors.borderDashOffset||0;const outerX=rtlHelper.leftForLtr(rtlColorX,boxWidth-boxPadding);const innerX=rtlHelper.leftForLtr(rtlHelper.xPlus(rtlColorX,1),boxWidth-boxPadding-2);const borderRadius=toTRBLCorners(labelColors.borderRadius);if(Object.values(borderRadius).some(v=>v!==0)){ctx.beginPath();ctx.fillStyle=options.multiKeyBackground;addRoundedRectPath(ctx,{x:outerX,y:colorY,w:boxWidth,h:boxHeight,radius:borderRadius,});ctx.fill();ctx.stroke();ctx.fillStyle=labelColors.backgroundColor;ctx.beginPath();addRoundedRectPath(ctx,{x:innerX,y:colorY+1,w:boxWidth-2,h:boxHeight-2,radius:borderRadius,});ctx.fill();}else{ctx.fillStyle=options.multiKeyBackground;ctx.fillRect(outerX,colorY,boxWidth,boxHeight);ctx.strokeRect(outerX,colorY,boxWidth,boxHeight);ctx.fillStyle=labelColors.backgroundColor;ctx.fillRect(innerX,colorY+1,boxWidth-2,boxHeight-2);}}
_drawColorBox(ctx,pt,i,rtlHelper,options){const labelColors=this.labelColors[i];const labelPointStyle=this.labelPointStyles[i];const{boxHeight,boxWidth,boxPadding}=options;const bodyFont=toFont(options.bodyFont);const colorX=getAlignedX(this,'left',options);const rtlColorX=rtlHelper.x(colorX);const yOffSet=boxHeight<bodyFont.lineHeight?(bodyFont.lineHeight-boxHeight)/2:0;const colorY=pt.y+yOffSet;if(options.usePointStyle){const drawOptions={radius:Math.min(boxWidth,boxHeight)/2,pointStyle:labelPointStyle.pointStyle,rotation:labelPointStyle.rotation,borderWidth:1};const centerX=rtlHelper.leftForLtr(rtlColorX,boxWidth)+boxWidth/2;const centerY=colorY+boxHeight/2;ctx.strokeStyle=options.multiKeyBackground;ctx.fillStyle=options.multiKeyBackground;drawPoint(ctx,drawOptions,centerX,centerY);ctx.strokeStyle=labelColors.borderColor;ctx.fillStyle=labelColors.backgroundColor;drawPoint(ctx,drawOptions,centerX,centerY);}else{ctx.lineWidth=isObject(labelColors.borderWidth)?Math.max(...Object.values(labelColors.borderWidth)):(labelColors.borderWidth||1);ctx.strokeStyle=labelColors.borderColor;ctx.setLineDash(labelColors.borderDash||[]);ctx.lineDashOffset=labelColors.borderDashOffset||0;const outerX=rtlHelper.leftForLtr(rtlColorX,boxWidth-boxPadding);const innerX=rtlHelper.leftForLtr(rtlHelper.xPlus(rtlColorX,1),boxWidth-boxPadding-2);const borderRadius=toTRBLCorners(labelColors.borderRadius);if(Object.values(borderRadius).some(v=>v!==0)){ctx.beginPath();ctx.fillStyle=options.multiKeyBackground;addRoundedRectPath(ctx,{x:outerX,y:colorY,w:boxWidth,h:boxHeight,radius:borderRadius,});ctx.fill();ctx.stroke();ctx.fillStyle=labelColors.backgroundColor;ctx.beginPath();addRoundedRectPath(ctx,{x:innerX,y:colorY+1,w:boxWidth-2,h:boxHeight-2,radius:borderRadius,});ctx.fill();}else{ctx.fillStyle=options.multiKeyBackground;ctx.fillRect(outerX,colorY,boxWidth,boxHeight);ctx.strokeRect(outerX,colorY,boxWidth,boxHeight);ctx.fillStyle=labelColors.backgroundColor;ctx.fillRect(innerX,colorY+1,boxWidth-2,boxHeight-2);}}
ctx.fillStyle=this.labelTextColors[i];}
drawBody(pt,ctx,options){const{body}=this;const{bodySpacing,bodyAlign,displayColors,boxHeight,boxWidth,boxPadding}=options;const bodyFont=toFont(options.bodyFont);let bodyLineHeight=bodyFont.lineHeight;let xLinePadding=0;const rtlHelper=getRtlAdapter(options.rtl,this.x,this.width);const fillLineOfText=function(line){ctx.fillText(line,rtlHelper.x(pt.x+xLinePadding),pt.y+bodyLineHeight/2);pt.y+=bodyLineHeight+bodySpacing;};const bodyAlignForCalculation=rtlHelper.textAlign(bodyAlign);let bodyItem,textColor,lines,i,j,ilen,jlen;ctx.textAlign=bodyAlign;ctx.textBaseline='middle';ctx.font=bodyFont.string;pt.x=getAlignedX(this,bodyAlignForCalculation,options);ctx.fillStyle=options.bodyColor;each(this.beforeBody,fillLineOfText);xLinePadding=displayColors&&bodyAlignForCalculation!=='right'?bodyAlign==='center'?(boxWidth/2+boxPadding):(boxWidth+2+boxPadding):0;for(i=0,ilen=body.length;i<ilen;++i){bodyItem=body[i];textColor=this.labelTextColors[i];ctx.fillStyle=textColor;each(bodyItem.before,fillLineOfText);lines=bodyItem.lines;if(displayColors&&lines.length){this._drawColorBox(ctx,pt,i,rtlHelper,options);bodyLineHeight=Math.max(bodyFont.lineHeight,boxHeight);}
for(j=0,jlen=lines.length;j<jlen;++j){fillLineOfText(lines[j]);bodyLineHeight=bodyFont.lineHeight;}
@ -2627,21 +2628,22 @@ this.__rules__.forEach((function(rule){rule.enabled=false;}));this.enable(list,i
var result=[];list.forEach((function(name){var idx=this.__find__(name);if(idx<0){if(ignoreInvalid){return;}
throw new Error("Rules manager: invalid rule name "+name);}
this.__rules__[idx].enabled=false;result.push(name);}),this);this.__cache__=null;return result;};Ruler.prototype.getRules=function(chainName){if(this.__cache__===null){this.__compile__();}
return this.__cache__[chainName]||[];};var ruler=Ruler;var NEWLINES_RE=/\r\n?|\n/g;var NULL_RE=/\0/g;var normalize=function normalize(state){var str;str=state.src.replace(NEWLINES_RE,"\n");str=str.replace(NULL_RE,"\ufffd");state.src=str;};var block=function block(state){var token;if(state.inlineMode){token=new state.Token("inline","",0);token.content=state.src;token.map=[0,1];token.children=[];state.tokens.push(token);}else{state.md.block.parse(state.src,state.md,state.env,state.tokens);}};var inline=function inline(state){var tokens=state.tokens,tok,i,l;for(i=0,l=tokens.length;i<l;i++){tok=tokens[i];if(tok.type==="inline"){state.md.inline.parse(tok.content,state.md,state.env,tok.children);}}};var arrayReplaceAt=utils.arrayReplaceAt;function isLinkOpen(str){return/^<a[>\s]/i.test(str);}
function isLinkClose(str){return/^<\/a\s*>/i.test(str);}
var linkify=function linkify(state){var i,j,l,tokens,token,currentToken,nodes,ln,text,pos,lastPos,level,htmlLinkLevel,url,fullUrl,urlText,blockTokens=state.tokens,links;if(!state.md.options.linkify){return;}
return this.__cache__[chainName]||[];};var ruler=Ruler;var NEWLINES_RE=/\r\n?|\n/g;var NULL_RE=/\0/g;var normalize=function normalize(state){var str;str=state.src.replace(NEWLINES_RE,"\n");str=str.replace(NULL_RE,"\ufffd");state.src=str;};var block=function block(state){var token;if(state.inlineMode){token=new state.Token("inline","",0);token.content=state.src;token.map=[0,1];token.children=[];state.tokens.push(token);}else{state.md.block.parse(state.src,state.md,state.env,state.tokens);}};var inline=function inline(state){var tokens=state.tokens,tok,i,l;for(i=0,l=tokens.length;i<l;i++){tok=tokens[i];if(tok.type==="inline"){state.md.inline.parse(tok.content,state.md,state.env,tok.children);}}};var arrayReplaceAt=utils.arrayReplaceAt;function isLinkOpen$1(str){return/^<a[>\s]/i.test(str);}
function isLinkClose$1(str){return/^<\/a\s*>/i.test(str);}
var linkify$1=function linkify(state){var i,j,l,tokens,token,currentToken,nodes,ln,text,pos,lastPos,level,htmlLinkLevel,url,fullUrl,urlText,blockTokens=state.tokens,links;if(!state.md.options.linkify){return;}
for(j=0,l=blockTokens.length;j<l;j++){if(blockTokens[j].type!=="inline"||!state.md.linkify.pretest(blockTokens[j].content)){continue;}
tokens=blockTokens[j].children;htmlLinkLevel=0;for(i=tokens.length-1;i>=0;i--){currentToken=tokens[i];if(currentToken.type==="link_close"){i--;while(tokens[i].level!==currentToken.level&&tokens[i].type!=="link_open"){i--;}
continue;}
if(currentToken.type==="html_inline"){if(isLinkOpen(currentToken.content)&&htmlLinkLevel>0){htmlLinkLevel--;}
if(isLinkClose(currentToken.content)){htmlLinkLevel++;}}
if(currentToken.type==="html_inline"){if(isLinkOpen$1(currentToken.content)&&htmlLinkLevel>0){htmlLinkLevel--;}
if(isLinkClose$1(currentToken.content)){htmlLinkLevel++;}}
if(htmlLinkLevel>0){continue;}
if(currentToken.type==="text"&&state.md.linkify.test(currentToken.content)){text=currentToken.content;links=state.md.linkify.match(text);nodes=[];level=currentToken.level;lastPos=0;for(ln=0;ln<links.length;ln++){url=links[ln].url;fullUrl=state.md.normalizeLink(url);if(!state.md.validateLink(fullUrl)){continue;}
if(currentToken.type==="text"&&state.md.linkify.test(currentToken.content)){text=currentToken.content;links=state.md.linkify.match(text);nodes=[];level=currentToken.level;lastPos=0;if(links.length>0&&links[0].index===0&&i>0&&tokens[i-1].type==="text_special"){links=links.slice(1);}
for(ln=0;ln<links.length;ln++){url=links[ln].url;fullUrl=state.md.normalizeLink(url);if(!state.md.validateLink(fullUrl)){continue;}
urlText=links[ln].text;if(!links[ln].schema){urlText=state.md.normalizeLinkText("http://"+urlText).replace(/^http:\/\//,"");}else if(links[ln].schema==="mailto:"&&!/^mailto:/i.test(urlText)){urlText=state.md.normalizeLinkText("mailto:"+urlText).replace(/^mailto:/,"");}else{urlText=state.md.normalizeLinkText(urlText);}
pos=links[ln].index;if(pos>lastPos){token=new state.Token("text","",0);token.content=text.slice(lastPos,pos);token.level=level;nodes.push(token);}
token=new state.Token("link_open","a",1);token.attrs=[["href",fullUrl]];token.level=level++;token.markup="linkify";token.info="auto";nodes.push(token);token=new state.Token("text","",0);token.content=urlText;token.level=level;nodes.push(token);token=new state.Token("link_close","a",-1);token.level=--level;token.markup="linkify";token.info="auto";nodes.push(token);lastPos=links[ln].lastIndex;}
if(lastPos<text.length){token=new state.Token("text","",0);token.content=text.slice(lastPos);token.level=level;nodes.push(token);}
blockTokens[j].children=tokens=arrayReplaceAt(tokens,i,nodes);}}}};var RARE_RE=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/;var SCOPED_ABBR_TEST_RE=/\((c|tm|r|p)\)/i;var SCOPED_ABBR_RE=/\((c|tm|r|p)\)/gi;var SCOPED_ABBR={c:"\xa9",r:"\xae",p:"\xa7",tm:"\u2122"};function replaceFn(match,name){return SCOPED_ABBR[name.toLowerCase()];}
blockTokens[j].children=tokens=arrayReplaceAt(tokens,i,nodes);}}}};var RARE_RE=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/;var SCOPED_ABBR_TEST_RE=/\((c|tm|r)\)/i;var SCOPED_ABBR_RE=/\((c|tm|r)\)/gi;var SCOPED_ABBR={c:"\xa9",r:"\xae",tm:"\u2122"};function replaceFn(match,name){return SCOPED_ABBR[name.toLowerCase()];}
function replace_scoped(inlineTokens){var i,token,inside_autolink=0;for(i=inlineTokens.length-1;i>=0;i--){token=inlineTokens[i];if(token.type==="text"&&!inside_autolink){token.content=token.content.replace(SCOPED_ABBR_RE,replaceFn);}
if(token.type==="link_open"&&token.info==="auto"){inside_autolink--;}
if(token.type==="link_close"&&token.info==="auto"){inside_autolink++;}}}
@ -2651,7 +2653,7 @@ if(token.type==="link_close"&&token.info==="auto"){inside_autolink++;}}}
var replacements=function replace(state){var blkIdx;if(!state.md.options.typographer){return;}
for(blkIdx=state.tokens.length-1;blkIdx>=0;blkIdx--){if(state.tokens[blkIdx].type!=="inline"){continue;}
if(SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)){replace_scoped(state.tokens[blkIdx].children);}
if(RARE_RE.test(state.tokens[blkIdx].content)){replace_rare(state.tokens[blkIdx].children);}}};var isWhiteSpace$1=utils.isWhiteSpace;var isPunctChar$1=utils.isPunctChar;var isMdAsciiPunct$1=utils.isMdAsciiPunct;var QUOTE_TEST_RE=/['"]/;var QUOTE_RE=/['"]/g;var APOSTROPHE="\u2019";function replaceAt(str,index,ch){return str.substr(0,index)+ch+str.substr(index+1);}
if(RARE_RE.test(state.tokens[blkIdx].content)){replace_rare(state.tokens[blkIdx].children);}}};var isWhiteSpace$1=utils.isWhiteSpace;var isPunctChar$1=utils.isPunctChar;var isMdAsciiPunct$1=utils.isMdAsciiPunct;var QUOTE_TEST_RE=/['"]/;var QUOTE_RE=/['"]/g;var APOSTROPHE="\u2019";function replaceAt(str,index,ch){return str.slice(0,index)+ch+str.slice(index+1);}
function process_inlines(tokens,state){var i,token,text,t,pos,max,thisLevel,item,lastChar,nextChar,isLastPunctChar,isNextPunctChar,isLastWhiteSpace,isNextWhiteSpace,canOpen,canClose,j,isSingle,stack,openQuote,closeQuote;stack=[];for(i=0;i<tokens.length;i++){token=tokens[i];thisLevel=tokens[i].level;for(j=stack.length-1;j>=0;j--){if(stack[j].level<=thisLevel){break;}}
stack.length=j+1;if(token.type!=="text"){continue;}
text=token.content;pos=0;max=text.length;OUTER:while(pos<max){QUOTE_RE.lastIndex=pos;t=QUOTE_RE.exec(text);if(!t){break;}
@ -2670,13 +2672,16 @@ text=token.content;max=text.length;stack.length=j;continue OUTER;}}}
if(canOpen){stack.push({token:i,pos:t.index,single:isSingle,level:thisLevel});}else if(canClose&&isSingle){token.content=replaceAt(token.content,t.index,APOSTROPHE);}}}}
var smartquotes=function smartquotes(state){var blkIdx;if(!state.md.options.typographer){return;}
for(blkIdx=state.tokens.length-1;blkIdx>=0;blkIdx--){if(state.tokens[blkIdx].type!=="inline"||!QUOTE_TEST_RE.test(state.tokens[blkIdx].content)){continue;}
process_inlines(state.tokens[blkIdx].children,state);}};function Token(type,tag,nesting){this.type=type;this.tag=tag;this.attrs=null;this.map=null;this.nesting=nesting;this.level=0;this.children=null;this.content="";this.markup="";this.info="";this.meta=null;this.block=false;this.hidden=false;}
process_inlines(state.tokens[blkIdx].children,state);}};var text_join=function text_join(state){var j,l,tokens,curr,max,last,blockTokens=state.tokens;for(j=0,l=blockTokens.length;j<l;j++){if(blockTokens[j].type!=="inline")continue;tokens=blockTokens[j].children;max=tokens.length;for(curr=0;curr<max;curr++){if(tokens[curr].type==="text_special"){tokens[curr].type="text";}}
for(curr=last=0;curr<max;curr++){if(tokens[curr].type==="text"&&curr+1<max&&tokens[curr+1].type==="text"){tokens[curr+1].content=tokens[curr].content+tokens[curr+1].content;}else{if(curr!==last){tokens[last]=tokens[curr];}
last++;}}
if(curr!==last){tokens.length=last;}}};function Token(type,tag,nesting){this.type=type;this.tag=tag;this.attrs=null;this.map=null;this.nesting=nesting;this.level=0;this.children=null;this.content="";this.markup="";this.info="";this.meta=null;this.block=false;this.hidden=false;}
Token.prototype.attrIndex=function attrIndex(name){var attrs,i,len;if(!this.attrs){return-1;}
attrs=this.attrs;for(i=0,len=attrs.length;i<len;i++){if(attrs[i][0]===name){return i;}}
return-1;};Token.prototype.attrPush=function attrPush(attrData){if(this.attrs){this.attrs.push(attrData);}else{this.attrs=[attrData];}};Token.prototype.attrSet=function attrSet(name,value){var idx=this.attrIndex(name),attrData=[name,value];if(idx<0){this.attrPush(attrData);}else{this.attrs[idx]=attrData;}};Token.prototype.attrGet=function attrGet(name){var idx=this.attrIndex(name),value=null;if(idx>=0){value=this.attrs[idx][1];}
return value;};Token.prototype.attrJoin=function attrJoin(name,value){var idx=this.attrIndex(name);if(idx<0){this.attrPush([name,value]);}else{this.attrs[idx][1]=this.attrs[idx][1]+" "+value;}};var token=Token;function StateCore(src,md,env){this.src=src;this.env=env;this.tokens=[];this.inlineMode=false;this.md=md;}
StateCore.prototype.Token=token;var state_core=StateCore;var _rules$2=[["normalize",normalize],["block",block],["inline",inline],["linkify",linkify],["replacements",replacements],["smartquotes",smartquotes]];function Core(){this.ruler=new ruler;for(var i=0;i<_rules$2.length;i++){this.ruler.push(_rules$2[i][0],_rules$2[i][1]);}}
Core.prototype.process=function(state){var i,l,rules;rules=this.ruler.getRules("");for(i=0,l=rules.length;i<l;i++){rules[i](state);}};Core.prototype.State=state_core;var parser_core=Core;var isSpace$a=utils.isSpace;function getLine(state,line){var pos=state.bMarks[line]+state.tShift[line],max=state.eMarks[line];return state.src.substr(pos,max-pos);}
StateCore.prototype.Token=token;var state_core=StateCore;var _rules$2=[["normalize",normalize],["block",block],["inline",inline],["linkify",linkify$1],["replacements",replacements],["smartquotes",smartquotes],["text_join",text_join]];function Core(){this.ruler=new ruler;for(var i=0;i<_rules$2.length;i++){this.ruler.push(_rules$2[i][0],_rules$2[i][1]);}}
Core.prototype.process=function(state){var i,l,rules;rules=this.ruler.getRules("");for(i=0,l=rules.length;i<l;i++){rules[i](state);}};Core.prototype.State=state_core;var parser_core=Core;var isSpace$a=utils.isSpace;function getLine(state,line){var pos=state.bMarks[line]+state.tShift[line],max=state.eMarks[line];return state.src.slice(pos,max);}
function escapedSplit(str){var result=[],pos=0,max=str.length,ch,isEscaped=false,lastPos=0,current="";ch=str.charCodeAt(pos);while(pos<max){if(ch===124){if(!isEscaped){result.push(current+str.substring(lastPos,pos));current="";lastPos=pos+1;}else{current+=str.substring(lastPos,pos-1);lastPos=pos;}}
isEscaped=ch===92;pos++;ch=str.charCodeAt(pos);}
result.push(current+str.substring(lastPos));return result;}
@ -2865,18 +2870,17 @@ state=new this.State(src,md,env,outTokens);this.tokenize(state,state.line,state.
var text=function text(state,silent){var pos=state.pos;while(pos<state.posMax&&!isTerminatorChar(state.src.charCodeAt(pos))){pos++;}
if(pos===state.pos){return false;}
if(!silent){state.pending+=state.src.slice(state.pos,pos);}
state.pos=pos;return true;};var isSpace$3=utils.isSpace;var newline=function newline(state,silent){var pmax,max,ws,pos=state.pos;if(state.src.charCodeAt(pos)!==10){return false;}
state.pos=pos;return true;};var SCHEME_RE=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;var linkify=function linkify(state,silent){var pos,max,match,proto,link,url,fullUrl,token;if(!state.md.options.linkify)return false;if(state.linkLevel>0)return false;pos=state.pos;max=state.posMax;if(pos+3>max)return false;if(state.src.charCodeAt(pos)!==58)return false;if(state.src.charCodeAt(pos+1)!==47)return false;if(state.src.charCodeAt(pos+2)!==47)return false;match=state.pending.match(SCHEME_RE);if(!match)return false;proto=match[1];link=state.md.linkify.matchAtStart(state.src.slice(pos-proto.length));if(!link)return false;url=link.url;url=url.replace(/\*+$/,"");fullUrl=state.md.normalizeLink(url);if(!state.md.validateLink(fullUrl))return false;if(!silent){state.pending=state.pending.slice(0,-proto.length);token=state.push("link_open","a",1);token.attrs=[["href",fullUrl]];token.markup="linkify";token.info="auto";token=state.push("text","",0);token.content=state.md.normalizeLinkText(url);token=state.push("link_close","a",-1);token.markup="linkify";token.info="auto";}
state.pos+=url.length-proto.length;return true;};var isSpace$3=utils.isSpace;var newline=function newline(state,silent){var pmax,max,ws,pos=state.pos;if(state.src.charCodeAt(pos)!==10){return false;}
pmax=state.pending.length-1;max=state.posMax;if(!silent){if(pmax>=0&&state.pending.charCodeAt(pmax)===32){if(pmax>=1&&state.pending.charCodeAt(pmax-1)===32){ws=pmax-1;while(ws>=1&&state.pending.charCodeAt(ws-1)===32)ws--;state.pending=state.pending.slice(0,ws);state.push("hardbreak","br",0);}else{state.pending=state.pending.slice(0,-1);state.push("softbreak","br",0);}}else{state.push("softbreak","br",0);}}
pos++;while(pos<max&&isSpace$3(state.src.charCodeAt(pos))){pos++;}
state.pos=pos;return true;};var isSpace$2=utils.isSpace;var ESCAPED=[];for(var i=0;i<256;i++){ESCAPED.push(0);}"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach((function(ch){ESCAPED[ch.charCodeAt(0)]=1;}));var _escape=function escape(state,silent){var ch,pos=state.pos,max=state.posMax;if(state.src.charCodeAt(pos)!==92){return false;}
pos++;if(pos<max){ch=state.src.charCodeAt(pos);if(ch<256&&ESCAPED[ch]!==0){if(!silent){state.pending+=state.src[pos];}
state.pos+=2;return true;}
if(ch===10){if(!silent){state.push("hardbreak","br",0);}
pos++;while(pos<max){ch=state.src.charCodeAt(pos);if(!isSpace$2(ch)){break;}
pos++;}
state.pos=pos;return true;}}
if(!silent){state.pending+="\\";}
state.pos++;return true;};var backticks=function backtick(state,silent){var start,max,marker,token,matchStart,matchEnd,openerLength,closerLength,pos=state.pos,ch=state.src.charCodeAt(pos);if(ch!==96){return false;}
state.pos=pos;return true;};var isSpace$2=utils.isSpace;var ESCAPED=[];for(var i=0;i<256;i++){ESCAPED.push(0);}"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach((function(ch){ESCAPED[ch.charCodeAt(0)]=1;}));var _escape=function escape(state,silent){var ch1,ch2,origStr,escapedStr,token,pos=state.pos,max=state.posMax;if(state.src.charCodeAt(pos)!==92)return false;pos++;if(pos>=max)return false;ch1=state.src.charCodeAt(pos);if(ch1===10){if(!silent){state.push("hardbreak","br",0);}
pos++;while(pos<max){ch1=state.src.charCodeAt(pos);if(!isSpace$2(ch1))break;pos++;}
state.pos=pos;return true;}
escapedStr=state.src[pos];if(ch1>=55296&&ch1<=56319&&pos+1<max){ch2=state.src.charCodeAt(pos+1);if(ch2>=56320&&ch2<=57343){escapedStr+=state.src[pos+1];pos++;}}
origStr="\\"+escapedStr;if(!silent){token=state.push("text_special","",0);if(ch1<256&&ESCAPED[ch1]!==0){token.content=escapedStr;}else{token.content=origStr;}
token.markup=origStr;token.info="escape";}
state.pos=pos+1;return true;};var backticks=function backtick(state,silent){var start,max,marker,token,matchStart,matchEnd,openerLength,closerLength,pos=state.pos,ch=state.src.charCodeAt(pos);if(ch!==96){return false;}
start=pos;pos++;max=state.posMax;while(pos<max&&state.src.charCodeAt(pos)===96){pos++;}
marker=state.src.slice(start,pos);openerLength=marker.length;if(state.backticksScanned&&(state.backticks[openerLength]||0)<=start){if(!silent)state.pending+=marker;state.pos+=openerLength;return true;}
matchStart=matchEnd=pos;while((matchStart=state.src.indexOf("`",matchEnd))!==-1){matchEnd=matchStart+1;while(matchEnd<max&&state.src.charCodeAt(matchEnd)===96){matchEnd++;}
@ -2914,7 +2918,7 @@ if(!label){label=state.src.slice(labelStart,labelEnd);}
ref=state.env.references[normalizeReference$1(label)];if(!ref){state.pos=oldPos;return false;}
href=ref.href;title=ref.title;}
if(!silent){state.pos=labelStart;state.posMax=labelEnd;token=state.push("link_open","a",1);token.attrs=attrs=[["href",href]];if(title){attrs.push(["title",title]);}
state.md.inline.tokenize(state);token=state.push("link_close","a",-1);}
state.linkLevel++;state.md.inline.tokenize(state);state.linkLevel--;token=state.push("link_close","a",-1);}
state.pos=pos;state.posMax=max;return true;};var normalizeReference=utils.normalizeReference;var isSpace=utils.isSpace;var image=function image(state,silent){var attrs,code,content,label,labelEnd,labelStart,pos,ref,res,title,token,tokens,start,href="",oldPos=state.pos,max=state.posMax;if(state.src.charCodeAt(state.pos)!==33){return false;}
if(state.src.charCodeAt(state.pos+1)!==91){return false;}
labelStart=state.pos+2;labelEnd=state.md.helpers.parseLinkLabel(state,state.pos+1,false);if(labelEnd<0){return false;}
@ -2938,25 +2942,25 @@ state.pos+=url.length+2;return true;}
if(EMAIL_RE.test(url)){fullUrl=state.md.normalizeLink("mailto:"+url);if(!state.md.validateLink(fullUrl)){return false;}
if(!silent){token=state.push("link_open","a",1);token.attrs=[["href",fullUrl]];token.markup="autolink";token.info="auto";token=state.push("text","",0);token.content=state.md.normalizeLinkText(url);token=state.push("link_close","a",-1);token.markup="autolink";token.info="auto";}
state.pos+=url.length+2;return true;}
return false;};var HTML_TAG_RE=html_re.HTML_TAG_RE;function isLetter(ch){var lc=ch|32;return lc>=97&&lc<=122;}
return false;};var HTML_TAG_RE=html_re.HTML_TAG_RE;function isLinkOpen(str){return/^<a[>\s]/i.test(str);}
function isLinkClose(str){return/^<\/a\s*>/i.test(str);}
function isLetter(ch){var lc=ch|32;return lc>=97&&lc<=122;}
var html_inline=function html_inline(state,silent){var ch,match,max,token,pos=state.pos;if(!state.md.options.html){return false;}
max=state.posMax;if(state.src.charCodeAt(pos)!==60||pos+2>=max){return false;}
ch=state.src.charCodeAt(pos+1);if(ch!==33&&ch!==63&&ch!==47&&!isLetter(ch)){return false;}
match=state.src.slice(pos).match(HTML_TAG_RE);if(!match){return false;}
if(!silent){token=state.push("html_inline","",0);token.content=state.src.slice(pos,pos+match[0].length);}
state.pos+=match[0].length;return true;};var has=utils.has;var isValidEntityCode=utils.isValidEntityCode;var fromCodePoint=utils.fromCodePoint;var DIGITAL_RE=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;var NAMED_RE=/^&([a-z][a-z0-9]{1,31});/i;var entity=function entity(state,silent){var ch,code,match,pos=state.pos,max=state.posMax;if(state.src.charCodeAt(pos)!==38){return false;}
if(pos+1<max){ch=state.src.charCodeAt(pos+1);if(ch===35){match=state.src.slice(pos).match(DIGITAL_RE);if(match){if(!silent){code=match[1][0].toLowerCase()==="x"?parseInt(match[1].slice(1),16):parseInt(match[1],10);state.pending+=isValidEntityCode(code)?fromCodePoint(code):fromCodePoint(65533);}
state.pos+=match[0].length;return true;}}else{match=state.src.slice(pos).match(NAMED_RE);if(match){if(has(entities,match[1])){if(!silent){state.pending+=entities[match[1]];}
state.pos+=match[0].length;return true;}}}}
if(!silent){state.pending+="&";}
state.pos++;return true;};function processDelimiters(state,delimiters){var closerIdx,openerIdx,closer,opener,minOpenerIdx,newMinOpenerIdx,isOddMatch,lastJump,openersBottom={},max=delimiters.length;if(!max)return;var headerIdx=0;var lastTokenIdx=-2;var jumps=[];for(closerIdx=0;closerIdx<max;closerIdx++){closer=delimiters[closerIdx];jumps.push(0);if(delimiters[headerIdx].marker!==closer.marker||lastTokenIdx!==closer.token-1){headerIdx=closerIdx;}
if(!silent){token=state.push("html_inline","",0);token.content=state.src.slice(pos,pos+match[0].length);if(isLinkOpen(token.content))state.linkLevel++;if(isLinkClose(token.content))state.linkLevel--;}
state.pos+=match[0].length;return true;};var has=utils.has;var isValidEntityCode=utils.isValidEntityCode;var fromCodePoint=utils.fromCodePoint;var DIGITAL_RE=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;var NAMED_RE=/^&([a-z][a-z0-9]{1,31});/i;var entity=function entity(state,silent){var ch,code,match,token,pos=state.pos,max=state.posMax;if(state.src.charCodeAt(pos)!==38)return false;if(pos+1>=max)return false;ch=state.src.charCodeAt(pos+1);if(ch===35){match=state.src.slice(pos).match(DIGITAL_RE);if(match){if(!silent){code=match[1][0].toLowerCase()==="x"?parseInt(match[1].slice(1),16):parseInt(match[1],10);token=state.push("text_special","",0);token.content=isValidEntityCode(code)?fromCodePoint(code):fromCodePoint(65533);token.markup=match[0];token.info="entity";}
state.pos+=match[0].length;return true;}}else{match=state.src.slice(pos).match(NAMED_RE);if(match){if(has(entities,match[1])){if(!silent){token=state.push("text_special","",0);token.content=entities[match[1]];token.markup=match[0];token.info="entity";}
state.pos+=match[0].length;return true;}}}
return false;};function processDelimiters(state,delimiters){var closerIdx,openerIdx,closer,opener,minOpenerIdx,newMinOpenerIdx,isOddMatch,lastJump,openersBottom={},max=delimiters.length;if(!max)return;var headerIdx=0;var lastTokenIdx=-2;var jumps=[];for(closerIdx=0;closerIdx<max;closerIdx++){closer=delimiters[closerIdx];jumps.push(0);if(delimiters[headerIdx].marker!==closer.marker||lastTokenIdx!==closer.token-1){headerIdx=closerIdx;}
lastTokenIdx=closer.token;closer.length=closer.length||0;if(!closer.close)continue;if(!openersBottom.hasOwnProperty(closer.marker)){openersBottom[closer.marker]=[-1,-1,-1,-1,-1,-1];}
minOpenerIdx=openersBottom[closer.marker][(closer.open?3:0)+closer.length%3];openerIdx=headerIdx-jumps[headerIdx]-1;newMinOpenerIdx=openerIdx;for(;openerIdx>minOpenerIdx;openerIdx-=jumps[openerIdx]+1){opener=delimiters[openerIdx];if(opener.marker!==closer.marker)continue;if(opener.open&&opener.end<0){isOddMatch=false;if(opener.close||closer.open){if((opener.length+closer.length)%3===0){if(opener.length%3!==0||closer.length%3!==0){isOddMatch=true;}}}
if(!isOddMatch){lastJump=openerIdx>0&&!delimiters[openerIdx-1].open?jumps[openerIdx-1]+1:0;jumps[closerIdx]=closerIdx-openerIdx+lastJump;jumps[openerIdx]=lastJump;closer.open=false;opener.end=closerIdx;opener.close=false;newMinOpenerIdx=-1;lastTokenIdx=-2;break;}}}
if(newMinOpenerIdx!==-1){openersBottom[closer.marker][(closer.open?3:0)+(closer.length||0)%3]=newMinOpenerIdx;}}}
var balance_pairs=function link_pairs(state){var curr,tokens_meta=state.tokens_meta,max=state.tokens_meta.length;processDelimiters(state,state.delimiters);for(curr=0;curr<max;curr++){if(tokens_meta[curr]&&tokens_meta[curr].delimiters){processDelimiters(state,tokens_meta[curr].delimiters);}}};var text_collapse=function text_collapse(state){var curr,last,level=0,tokens=state.tokens,max=state.tokens.length;for(curr=last=0;curr<max;curr++){if(tokens[curr].nesting<0)level--;tokens[curr].level=level;if(tokens[curr].nesting>0)level++;if(tokens[curr].type==="text"&&curr+1<max&&tokens[curr+1].type==="text"){tokens[curr+1].content=tokens[curr].content+tokens[curr+1].content;}else{if(curr!==last){tokens[last]=tokens[curr];}
var balance_pairs=function link_pairs(state){var curr,tokens_meta=state.tokens_meta,max=state.tokens_meta.length;processDelimiters(state,state.delimiters);for(curr=0;curr<max;curr++){if(tokens_meta[curr]&&tokens_meta[curr].delimiters){processDelimiters(state,tokens_meta[curr].delimiters);}}};var fragments_join=function fragments_join(state){var curr,last,level=0,tokens=state.tokens,max=state.tokens.length;for(curr=last=0;curr<max;curr++){if(tokens[curr].nesting<0)level--;tokens[curr].level=level;if(tokens[curr].nesting>0)level++;if(tokens[curr].type==="text"&&curr+1<max&&tokens[curr+1].type==="text"){tokens[curr+1].content=tokens[curr].content+tokens[curr+1].content;}else{if(curr!==last){tokens[last]=tokens[curr];}
last++;}}
if(curr!==last){tokens.length=last;}};var isWhiteSpace=utils.isWhiteSpace;var isPunctChar=utils.isPunctChar;var isMdAsciiPunct=utils.isMdAsciiPunct;function StateInline(src,md,env,outTokens){this.src=src;this.env=env;this.md=md;this.tokens=outTokens;this.tokens_meta=Array(outTokens.length);this.pos=0;this.posMax=this.src.length;this.level=0;this.pending="";this.pendingLevel=0;this.cache={};this.delimiters=[];this._prev_delimiters=[];this.backticks={};this.backticksScanned=false;}
if(curr!==last){tokens.length=last;}};var isWhiteSpace=utils.isWhiteSpace;var isPunctChar=utils.isPunctChar;var isMdAsciiPunct=utils.isMdAsciiPunct;function StateInline(src,md,env,outTokens){this.src=src;this.env=env;this.md=md;this.tokens=outTokens;this.tokens_meta=Array(outTokens.length);this.pos=0;this.posMax=this.src.length;this.level=0;this.pending="";this.pendingLevel=0;this.cache={};this.delimiters=[];this._prev_delimiters=[];this.backticks={};this.backticksScanned=false;this.linkLevel=0;}
StateInline.prototype.pushPending=function(){var token$1=new token("text","",0);token$1.content=this.pending;token$1.level=this.pendingLevel;this.tokens.push(token$1);this.pending="";return token$1;};StateInline.prototype.push=function(type,tag,nesting){if(this.pending){this.pushPending();}
var token$1=new token(type,tag,nesting);var token_meta=null;if(nesting<0){this.level--;this.delimiters=this._prev_delimiters.pop();}
token$1.level=this.level;if(nesting>0){this.level++;this._prev_delimiters.push(this.delimiters);this.delimiters=[];token_meta={delimiters:this.delimiters};}
@ -2964,7 +2968,7 @@ this.pendingLevel=this.level;this.tokens.push(token$1);this.tokens_meta.push(tok
count=pos-start;nextChar=pos<max?this.src.charCodeAt(pos):32;isLastPunctChar=isMdAsciiPunct(lastChar)||isPunctChar(String.fromCharCode(lastChar));isNextPunctChar=isMdAsciiPunct(nextChar)||isPunctChar(String.fromCharCode(nextChar));isLastWhiteSpace=isWhiteSpace(lastChar);isNextWhiteSpace=isWhiteSpace(nextChar);if(isNextWhiteSpace){left_flanking=false;}else if(isNextPunctChar){if(!(isLastWhiteSpace||isLastPunctChar)){left_flanking=false;}}
if(isLastWhiteSpace){right_flanking=false;}else if(isLastPunctChar){if(!(isNextWhiteSpace||isNextPunctChar)){right_flanking=false;}}
if(!canSplitWord){can_open=left_flanking&&(!right_flanking||isLastPunctChar);can_close=right_flanking&&(!left_flanking||isNextPunctChar);}else{can_open=left_flanking;can_close=right_flanking;}
return{can_open:can_open,can_close:can_close,length:count};};StateInline.prototype.Token=token;var state_inline=StateInline;var _rules=[["text",text],["newline",newline],["escape",_escape],["backticks",backticks],["strikethrough",strikethrough.tokenize],["emphasis",emphasis.tokenize],["link",link],["image",image],["autolink",autolink],["html_inline",html_inline],["entity",entity]];var _rules2=[["balance_pairs",balance_pairs],["strikethrough",strikethrough.postProcess],["emphasis",emphasis.postProcess],["text_collapse",text_collapse]];function ParserInline(){var i;this.ruler=new ruler;for(i=0;i<_rules.length;i++){this.ruler.push(_rules[i][0],_rules[i][1]);}
return{can_open:can_open,can_close:can_close,length:count};};StateInline.prototype.Token=token;var state_inline=StateInline;var _rules=[["text",text],["linkify",linkify],["newline",newline],["escape",_escape],["backticks",backticks],["strikethrough",strikethrough.tokenize],["emphasis",emphasis.tokenize],["link",link],["image",image],["autolink",autolink],["html_inline",html_inline],["entity",entity]];var _rules2=[["balance_pairs",balance_pairs],["strikethrough",strikethrough.postProcess],["emphasis",emphasis.postProcess],["fragments_join",fragments_join]];function ParserInline(){var i;this.ruler=new ruler;for(i=0;i<_rules.length;i++){this.ruler.push(_rules[i][0],_rules[i][1]);}
this.ruler2=new ruler;for(i=0;i<_rules2.length;i++){this.ruler2.push(_rules2[i][0],_rules2[i][1]);}}
ParserInline.prototype.skipToken=function(state){var ok,i,pos=state.pos,rules=this.ruler.getRules(""),len=rules.length,maxNesting=state.md.options.maxNesting,cache=state.cache;if(typeof cache[pos]!=="undefined"){state.pos=cache[pos];return;}
if(state.level<maxNesting){for(i=0;i<len;i++){state.level++;ok=rules[i](state,true);state.level--;if(ok){break;}}}else{state.pos=state.posMax;}
@ -2973,7 +2977,7 @@ cache[pos]=state.pos;};ParserInline.prototype.tokenize=function(state){var ok,i,
if(ok){if(state.pos>=end){break;}
continue;}
state.pending+=state.src[state.pos++];}
if(state.pending){state.pushPending();}};ParserInline.prototype.parse=function(str,md,env,outTokens){var i,rules,len;var state=new this.State(str,md,env,outTokens);this.tokenize(state);rules=this.ruler2.getRules("");len=rules.length;for(i=0;i<len;i++){rules[i](state);}};ParserInline.prototype.State=state_inline;var parser_inline=ParserInline;var re=function(opts){var re={};re.src_Any=regex$3.source;re.src_Cc=regex$2.source;re.src_Z=regex.source;re.src_P=regex$4.source;re.src_ZPCc=[re.src_Z,re.src_P,re.src_Cc].join("|");re.src_ZCc=[re.src_Z,re.src_Cc].join("|");var text_separators="[><\uff5c]";re.src_pseudo_letter="(?:(?!"+text_separators+"|"+re.src_ZPCc+")"+re.src_Any+")";re.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)";re.src_auth="(?:(?:(?!"+re.src_ZCc+"|[@/\\[\\]()]).)+@)?";re.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?";re.src_host_terminator="(?=$|"+text_separators+"|"+re.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+re.src_ZPCc+"))";re.src_path="(?:"+"[/?#]"+"(?:"+"(?!"+re.src_ZCc+"|"+text_separators+"|[()[\\]{}.,\"'?!\\-;]).|"+"\\[(?:(?!"+re.src_ZCc+"|\\]).)*\\]|"+"\\((?:(?!"+re.src_ZCc+"|[)]).)*\\)|"+"\\{(?:(?!"+re.src_ZCc+"|[}]).)*\\}|"+'\\"(?:(?!'+re.src_ZCc+'|["]).)+\\"|'+"\\'(?:(?!"+re.src_ZCc+"|[']).)+\\'|"+"\\'(?="+re.src_pseudo_letter+"|[-]).|"+"\\.{2,}[a-zA-Z0-9%/&]|"+"\\.(?!"+re.src_ZCc+"|[.]).|"+(opts&&opts["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+re.src_ZCc+").|"+";(?!"+re.src_ZCc+").|"+"\\!+(?!"+re.src_ZCc+"|[!]).|"+"\\?(?!"+re.src_ZCc+"|[?])."+")+"+"|\\/"+")?";re.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*';re.src_xn="xn--[a-z0-9\\-]{1,59}";re.src_domain_root="(?:"+re.src_xn+"|"+re.src_pseudo_letter+"{1,63}"+")";re.src_domain="(?:"+re.src_xn+"|"+"(?:"+re.src_pseudo_letter+")"+"|"+"(?:"+re.src_pseudo_letter+"(?:-|"+re.src_pseudo_letter+"){0,61}"+re.src_pseudo_letter+")"+")";re.src_host="(?:"+"(?:(?:(?:"+re.src_domain+")\\.)*"+re.src_domain+")"+")";re.tpl_host_fuzzy="(?:"+re.src_ip4+"|"+"(?:(?:(?:"+re.src_domain+")\\.)+(?:%TLDS%))"+")";re.tpl_host_no_ip_fuzzy="(?:(?:(?:"+re.src_domain+")\\.)+(?:%TLDS%))";re.src_host_strict=re.src_host+re.src_host_terminator;re.tpl_host_fuzzy_strict=re.tpl_host_fuzzy+re.src_host_terminator;re.src_host_port_strict=re.src_host+re.src_port+re.src_host_terminator;re.tpl_host_port_fuzzy_strict=re.tpl_host_fuzzy+re.src_port+re.src_host_terminator;re.tpl_host_port_no_ip_fuzzy_strict=re.tpl_host_no_ip_fuzzy+re.src_port+re.src_host_terminator;re.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+re.src_ZPCc+"|>|$))";re.tpl_email_fuzzy="(^|"+text_separators+'|"|\\(|'+re.src_ZCc+")"+"("+re.src_email_name+"@"+re.tpl_host_fuzzy_strict+")";re.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|"+re.src_ZPCc+"))"+"((?![$+<=>^`|\uff5c])"+re.tpl_host_port_fuzzy_strict+re.src_path+")";re.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|"+re.src_ZPCc+"))"+"((?![$+<=>^`|\uff5c])"+re.tpl_host_port_no_ip_fuzzy_strict+re.src_path+")";return re;};function assign(obj){var sources=Array.prototype.slice.call(arguments,1);sources.forEach((function(source){if(!source){return;}
if(state.pending){state.pushPending();}};ParserInline.prototype.parse=function(str,md,env,outTokens){var i,rules,len;var state=new this.State(str,md,env,outTokens);this.tokenize(state);rules=this.ruler2.getRules("");len=rules.length;for(i=0;i<len;i++){rules[i](state);}};ParserInline.prototype.State=state_inline;var parser_inline=ParserInline;var re=function(opts){var re={};opts=opts||{};re.src_Any=regex$3.source;re.src_Cc=regex$2.source;re.src_Z=regex.source;re.src_P=regex$4.source;re.src_ZPCc=[re.src_Z,re.src_P,re.src_Cc].join("|");re.src_ZCc=[re.src_Z,re.src_Cc].join("|");var text_separators="[><\uff5c]";re.src_pseudo_letter="(?:(?!"+text_separators+"|"+re.src_ZPCc+")"+re.src_Any+")";re.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)";re.src_auth="(?:(?:(?!"+re.src_ZCc+"|[@/\\[\\]()]).)+@)?";re.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?";re.src_host_terminator="(?=$|"+text_separators+"|"+re.src_ZPCc+")"+"(?!"+(opts["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+re.src_ZPCc+"))";re.src_path="(?:"+"[/?#]"+"(?:"+"(?!"+re.src_ZCc+"|"+text_separators+"|[()[\\]{}.,\"'?!\\-;]).|"+"\\[(?:(?!"+re.src_ZCc+"|\\]).)*\\]|"+"\\((?:(?!"+re.src_ZCc+"|[)]).)*\\)|"+"\\{(?:(?!"+re.src_ZCc+"|[}]).)*\\}|"+'\\"(?:(?!'+re.src_ZCc+'|["]).)+\\"|'+"\\'(?:(?!"+re.src_ZCc+"|[']).)+\\'|"+"\\'(?="+re.src_pseudo_letter+"|[-])|"+"\\.{2,}[a-zA-Z0-9%/&]|"+"\\.(?!"+re.src_ZCc+"|[.]|$)|"+(opts["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+re.src_ZCc+"|$)|"+";(?!"+re.src_ZCc+"|$)|"+"\\!+(?!"+re.src_ZCc+"|[!]|$)|"+"\\?(?!"+re.src_ZCc+"|[?]|$)"+")+"+"|\\/"+")?";re.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*';re.src_xn="xn--[a-z0-9\\-]{1,59}";re.src_domain_root="(?:"+re.src_xn+"|"+re.src_pseudo_letter+"{1,63}"+")";re.src_domain="(?:"+re.src_xn+"|"+"(?:"+re.src_pseudo_letter+")"+"|"+"(?:"+re.src_pseudo_letter+"(?:-|"+re.src_pseudo_letter+"){0,61}"+re.src_pseudo_letter+")"+")";re.src_host="(?:"+"(?:(?:(?:"+re.src_domain+")\\.)*"+re.src_domain+")"+")";re.tpl_host_fuzzy="(?:"+re.src_ip4+"|"+"(?:(?:(?:"+re.src_domain+")\\.)+(?:%TLDS%))"+")";re.tpl_host_no_ip_fuzzy="(?:(?:(?:"+re.src_domain+")\\.)+(?:%TLDS%))";re.src_host_strict=re.src_host+re.src_host_terminator;re.tpl_host_fuzzy_strict=re.tpl_host_fuzzy+re.src_host_terminator;re.src_host_port_strict=re.src_host+re.src_port+re.src_host_terminator;re.tpl_host_port_fuzzy_strict=re.tpl_host_fuzzy+re.src_port+re.src_host_terminator;re.tpl_host_port_no_ip_fuzzy_strict=re.tpl_host_no_ip_fuzzy+re.src_port+re.src_host_terminator;re.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+re.src_ZPCc+"|>|$))";re.tpl_email_fuzzy="(^|"+text_separators+'|"|\\(|'+re.src_ZCc+")"+"("+re.src_email_name+"@"+re.tpl_host_fuzzy_strict+")";re.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|"+re.src_ZPCc+"))"+"((?![$+<=>^`|\uff5c])"+re.tpl_host_port_fuzzy_strict+re.src_path+")";re.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|"+re.src_ZPCc+"))"+"((?![$+<=>^`|\uff5c])"+re.tpl_host_port_no_ip_fuzzy_strict+re.src_path+")";return re;};function assign(obj){var sources=Array.prototype.slice.call(arguments,1);sources.forEach((function(source){if(!source){return;}
Object.keys(source).forEach((function(key){obj[key]=source[key];}));}));return obj;}
function _class(obj){return Object.prototype.toString.call(obj);}
function isString(obj){return _class(obj)==="[object String]";}
@ -3003,7 +3007,7 @@ if(isFunction(val.normalize)){compiled.normalize=val.normalize;}else if(!val.nor
return;}
if(isString(val)){aliases.push(name);return;}
schemaError(name,val);}));aliases.forEach((function(alias){if(!self.__compiled__[self.__schemas__[alias]]){return;}
self.__compiled__[alias].validate=self.__compiled__[self.__schemas__[alias]].validate;self.__compiled__[alias].normalize=self.__compiled__[self.__schemas__[alias]].normalize;}));self.__compiled__[""]={validate:null,normalize:createNormalizer()};var slist=Object.keys(self.__compiled__).filter((function(name){return name.length>0&&self.__compiled__[name];})).map(escapeRE).join("|");self.re.schema_test=RegExp("(^|(?!_)(?:[><\uff5c]|"+re$1.src_ZPCc+"))("+slist+")","i");self.re.schema_search=RegExp("(^|(?!_)(?:[><\uff5c]|"+re$1.src_ZPCc+"))("+slist+")","ig");self.re.pretest=RegExp("("+self.re.schema_test.source+")|("+self.re.host_fuzzy_test.source+")|@","i");resetScanCache(self);}
self.__compiled__[alias].validate=self.__compiled__[self.__schemas__[alias]].validate;self.__compiled__[alias].normalize=self.__compiled__[self.__schemas__[alias]].normalize;}));self.__compiled__[""]={validate:null,normalize:createNormalizer()};var slist=Object.keys(self.__compiled__).filter((function(name){return name.length>0&&self.__compiled__[name];})).map(escapeRE).join("|");self.re.schema_test=RegExp("(^|(?!_)(?:[><\uff5c]|"+re$1.src_ZPCc+"))("+slist+")","i");self.re.schema_search=RegExp("(^|(?!_)(?:[><\uff5c]|"+re$1.src_ZPCc+"))("+slist+")","ig");self.re.schema_at_start=RegExp("^"+self.re.schema_search.source,"i");self.re.pretest=RegExp("("+self.re.schema_test.source+")|("+self.re.host_fuzzy_test.source+")|@","i");resetScanCache(self);}
function Match(self,shift){var start=self.__index__,end=self.__last_index__,text=self.__text_cache__.slice(start,end);this.schema=self.__schema__.toLowerCase();this.index=start+shift;this.lastIndex=end+shift;this.raw=text;this.text=text;this.url=text;}
function createMatch(self,shift){var match=new Match(self,shift);self.__compiled__[match.schema].normalize(match,self);return match;}
function LinkifyIt(schemas,options){if(!(this instanceof LinkifyIt)){return new LinkifyIt(schemas,options);}
@ -3017,7 +3021,7 @@ return this.__index__>=0;};LinkifyIt.prototype.pretest=function pretest(text){re
return this.__compiled__[schema.toLowerCase()].validate(text,pos,this);};LinkifyIt.prototype.match=function match(text){var shift=0,result=[];if(this.__index__>=0&&this.__text_cache__===text){result.push(createMatch(this,shift));shift=this.__last_index__;}
var tail=shift?text.slice(shift):text;while(this.test(tail)){result.push(createMatch(this,shift));tail=tail.slice(this.__last_index__);shift+=this.__last_index__;}
if(result.length){return result;}
return null;};LinkifyIt.prototype.tlds=function tlds(list,keepOld){list=Array.isArray(list)?list:[list];if(!keepOld){this.__tlds__=list.slice();this.__tlds_replaced__=true;compile(this);return this;}
return null;};LinkifyIt.prototype.matchAtStart=function matchAtStart(text){this.__text_cache__=text;this.__index__=-1;if(!text.length)return null;var m=this.re.schema_at_start.exec(text);if(!m)return null;var len=this.testSchemaAt(text,m[2],m[0].length);if(!len)return null;this.__schema__=m[2];this.__index__=m.index+m[1].length;this.__last_index__=m.index+m[0].length+len;return createMatch(this,0);};LinkifyIt.prototype.tlds=function tlds(list,keepOld){list=Array.isArray(list)?list:[list];if(!keepOld){this.__tlds__=list.slice();this.__tlds_replaced__=true;compile(this);return this;}
this.__tlds__=this.__tlds__.concat(list).sort().filter((function(el,idx,arr){return el!==arr[idx-1];})).reverse();compile(this);return this;};LinkifyIt.prototype.normalize=function normalize(match){if(!match.schema){match.url="http://"+match.url;}
if(match.schema==="mailto:"&&!/^mailto:/i.test(match.url)){match.url="mailto:"+match.url;}};LinkifyIt.prototype.onCompile=function onCompile(){};var linkifyIt=LinkifyIt;var maxInt=2147483647;var base=36;var tMin=1;var tMax=26;var skew=38;var damp=700;var initialBias=72;var initialN=128;var delimiter="-";var regexPunycode=/^xn--/;var regexNonASCII=/[^\x20-\x7E]/;var regexSeparators=/[\x2E\u3002\uFF0E\uFF61]/g;var errors={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"};var baseMinusTMin=base-tMin;var floor=Math.floor;var stringFromCharCode=String.fromCharCode;function error(type){throw new RangeError(errors[type]);}
function map(array,fn){var length=array.length;var result=[];while(length--){result[length]=fn(array[length]);}
@ -3058,7 +3062,7 @@ output.push(stringFromCharCode(digitToBasic(q,0)));bias=adapt(delta,handledCPCou
return output.join("");}
function toUnicode(input){return mapDomain(input,(function(string){return regexPunycode.test(string)?decode(string.slice(4).toLowerCase()):string;}));}
function toASCII(input){return mapDomain(input,(function(string){return regexNonASCII.test(string)?"xn--"+encode(string):string;}));}
var version="1.4.1";var ucs2={decode:ucs2decode,encode:ucs2encode};var punycode$1={version:version,ucs2:ucs2,toASCII:toASCII,toUnicode:toUnicode,encode:encode,decode:decode};var punycode$2=Object.freeze({__proto__:null,decode:decode,encode:encode,toUnicode:toUnicode,toASCII:toASCII,version:version,ucs2:ucs2,default:punycode$1});var _default={options:{html:false,xhtmlOut:false,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}};var zero={options:{html:false,xhtmlOut:false,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","text_collapse"]}}};var commonmark={options:{html:true,xhtmlOut:true,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","text_collapse"]}}};var punycode=getAugmentedNamespace(punycode$2);var config={default:_default,zero:zero,commonmark:commonmark};var BAD_PROTO_RE=/^(vbscript|javascript|file|data):/;var GOOD_DATA_RE=/^data:image\/(gif|png|jpeg|webp);/;function validateLink(url){var str=url.trim().toLowerCase();return BAD_PROTO_RE.test(str)?GOOD_DATA_RE.test(str)?true:false:true;}
var version="1.4.1";var ucs2={decode:ucs2decode,encode:ucs2encode};var punycode$1={version:version,ucs2:ucs2,toASCII:toASCII,toUnicode:toUnicode,encode:encode,decode:decode};var punycode$2=Object.freeze({__proto__:null,decode:decode,encode:encode,toUnicode:toUnicode,toASCII:toASCII,version:version,ucs2:ucs2,default:punycode$1});var _default={options:{html:false,xhtmlOut:false,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}};var zero={options:{html:false,xhtmlOut:false,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}};var commonmark={options:{html:true,xhtmlOut:true,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}};var punycode=getAugmentedNamespace(punycode$2);var config={default:_default,zero:zero,commonmark:commonmark};var BAD_PROTO_RE=/^(vbscript|javascript|file|data):/;var GOOD_DATA_RE=/^data:image\/(gif|png|jpeg|webp);/;function validateLink(url){var str=url.trim().toLowerCase();return BAD_PROTO_RE.test(str)?GOOD_DATA_RE.test(str)?true:false:true;}
var RECODE_HOSTNAME_FOR=["http:","https:","mailto:"];function normalizeLink(url){var parsed=mdurl.parse(url,true);if(parsed.hostname){if(!parsed.protocol||RECODE_HOSTNAME_FOR.indexOf(parsed.protocol)>=0){try{parsed.hostname=punycode.toASCII(parsed.hostname);}catch(er){}}}
return mdurl.encode(mdurl.format(parsed));}
function normalizeLinkText(url){var parsed=mdurl.parse(url,true);if(parsed.hostname){if(!parsed.protocol||RECODE_HOSTNAME_FOR.indexOf(parsed.protocol)>=0){try{parsed.hostname=punycode.toUnicode(parsed.hostname);}catch(er){}}}

View file

@ -521,111 +521,9 @@ params=formData;break;}
return new Promise(function(resolve,reject){let request=new XMLHttpRequest(),key;request.withCredentials=true;request.open(method,path,true);for(key in headers){if(headers.hasOwnProperty(key)){request.setRequestHeader(key,headers[key]);}}
request.onload=function(){if(4===request.readyState&&399>=request.status){let data=request.response;let contentType=this.getResponseHeader('content-type');contentType=contentType.substring(0,contentType.indexOf(';'));switch(contentType){case'application/json':data=JSON.parse(data);break;}
resolve(data);}else{reject(new Error(request.statusText));}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,false);}
request.onerror=function(){reject(new Error("Network Error"));};request.send(params);})};return{'get':function(path,headers={},params={}){return call('GET',path+((params.length>0)?'?'+buildQuery(params):''),headers,{});},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress);},'put':function(path,headers={},params={},progress=null){return call('PUT',headers,params,progress);},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress);},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress);},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let analytics={create:function(id,source,activity,url){return http.post('/analytics',{'content-type':'application/json'},{id:id,source:source,activity:activity,url:url,version:env.VERSION,setup:env.SETUP});},};return{analytics:analytics,};},true);})(window);(function(window){"use strict";window.ls.container.set('console',function(window){var sdk=new window.Appwrite();var endpoint=window.location.origin+'/v1';sdk.setEndpoint(endpoint).setProject('console').setLocale(APP_ENV.LOCALE);return sdk;},true);})(window);(function(window){"use strict";window.ls.container.set('date',function(){function format(format,timestamp){return timestamp;var jsdate,f
var txtWords=['Sun','Mon','Tues','Wednes','Thurs','Fri','Satur','January','February','March','April','May','June','July','August','September','October','November','December']
var formatChr=/\\?(.?)/gi
var formatChrCb=function(t,s){return f[t]?f[t]():s}
var _pad=function(n,c){n=String(n)
while(n.length<c){n='0'+n}
return n}
f={d:function(){return _pad(f.j(),2)},D:function(){return f.l().slice(0,3)},j:function(){return jsdate.getDate()},l:function(){return txtWords[f.w()]+'day'},N:function(){return f.w()||7},S:function(){var j=f.j()
var i=j%10
if(i<=3&&parseInt((j%100)/10,10)===1){i=0}
return['st','nd','rd'][i-1]||'th'},w:function(){return jsdate.getDay()},z:function(){var a=new Date(f.Y(),f.n()-1,f.j())
var b=new Date(f.Y(),0,1)
return Math.round((a-b)/864e5)},W:function(){var a=new Date(f.Y(),f.n()-1,f.j()-f.N()+3)
var b=new Date(a.getFullYear(),0,4)
return _pad(1+Math.round((a-b)/864e5/7),2)},F:function(){return txtWords[6+f.n()]},m:function(){return _pad(f.n(),2)},M:function(){return f.F().slice(0,3)},n:function(){return jsdate.getMonth()+1},t:function(){return(new Date(f.Y(),f.n(),0)).getDate()},L:function(){var j=f.Y()
return j%4===0&j%100!==0|j%400===0},o:function(){var n=f.n()
var W=f.W()
var Y=f.Y()
return Y+(n===12&&W<9?1:n===1&&W>9?-1:0)},Y:function(){return jsdate.getFullYear()},y:function(){return f.Y().toString().slice(-2)},a:function(){return jsdate.getHours()>11?'pm':'am'},A:function(){return f.a().toUpperCase()},B:function(){var H=jsdate.getUTCHours()*36e2
var i=jsdate.getUTCMinutes()*60
var s=jsdate.getUTCSeconds()
return _pad(Math.floor((H+i+s+36e2)/86.4)%1e3,3)},g:function(){return f.G()%12||12},G:function(){return jsdate.getHours()},h:function(){return _pad(f.g(),2)},H:function(){return _pad(f.G(),2)},i:function(){return _pad(jsdate.getMinutes(),2)},s:function(){return _pad(jsdate.getSeconds(),2)},u:function(){return _pad(jsdate.getMilliseconds()*1000,6)},e:function(){var msg='Not supported (see source code of date() for timezone on how to add support)'
throw new Error(msg)},I:function(){var a=new Date(f.Y(),0)
var c=Date.UTC(f.Y(),0)
var b=new Date(f.Y(),6)
var d=Date.UTC(f.Y(),6)
return((a-c)!==(b-d))?1:0},O:function(){var tzo=jsdate.getTimezoneOffset()
var a=Math.abs(tzo)
return(tzo>0?'-':'+')+_pad(Math.floor(a/60)*100+a%60,4)},P:function(){var O=f.O()
return(O.substr(0,3)+':'+O.substr(3,2))},T:function(){return'UTC'},Z:function(){return-jsdate.getTimezoneOffset()*60},c:function(){return'Y-m-d\\TH:i:sP'.replace(formatChr,formatChrCb)},r:function(){return'D, d M Y H:i:s O'.replace(formatChr,formatChrCb)},U:function(){return jsdate/1000|0}}
var _date=function(format,timestamp){jsdate=(timestamp===undefined?new Date():(timestamp instanceof Date)?new Date(timestamp):new Date(timestamp*1000))
return format.replace(formatChr,formatChrCb)}
return _date(format,timestamp)}
function strtotime(text,now){return text;var parsed
var match
var today
var year
var date
var days
var ranges
var len
var times
var regex
var i
var fail=false
if(!text){return fail}
text=text.replace(/^\s+|\s+$/g,'').replace(/\s{2,}/g,' ').replace(/[\t\r\n]/g,'').toLowerCase()
var pattern=new RegExp(['^(\\d{1,4})','([\\-\\.\\/:])','(\\d{1,2})','([\\-\\.\\/:])','(\\d{1,4})','(?:\\s(\\d{1,2}):(\\d{2})?:?(\\d{2})?)?','(?:\\s([A-Z]+)?)?$'].join(''))
match=text.match(pattern)
if(match&&match[2]===match[4]){if(match[1]>1901){switch(match[2]){case'-':if(match[3]>12||match[5]>31){return fail}
return new Date(match[1],parseInt(match[3],10)-1,match[5],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000
case'.':return fail
case'/':if(match[3]>12||match[5]>31){return fail}
return new Date(match[1],parseInt(match[3],10)-1,match[5],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000}}else if(match[5]>1901){switch(match[2]){case'-':if(match[3]>12||match[1]>31){return fail}
return new Date(match[5],parseInt(match[3],10)-1,match[1],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000
case'.':if(match[3]>12||match[1]>31){return fail}
return new Date(match[5],parseInt(match[3],10)-1,match[1],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000
case'/':if(match[1]>12||match[3]>31){return fail}
return new Date(match[5],parseInt(match[1],10)-1,match[3],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000}}else{switch(match[2]){case'-':if(match[3]>12||match[5]>31||(match[1]<70&&match[1]>38)){return fail}
year=match[1]>=0&&match[1]<=38?+match[1]+2000:match[1]
return new Date(year,parseInt(match[3],10)-1,match[5],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000
case'.':if(match[5]>=70){if(match[3]>12||match[1]>31){return fail}
return new Date(match[5],parseInt(match[3],10)-1,match[1],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000}
if(match[5]<60&&!match[6]){if(match[1]>23||match[3]>59){return fail}
today=new Date()
return new Date(today.getFullYear(),today.getMonth(),today.getDate(),match[1]||0,match[3]||0,match[5]||0,match[9]||0)/1000}
return fail
case'/':if(match[1]>12||match[3]>31||(match[5]<70&&match[5]>38)){return fail}
year=match[5]>=0&&match[5]<=38?+match[5]+2000:match[5]
return new Date(year,parseInt(match[1],10)-1,match[3],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000
case':':if(match[1]>23||match[3]>59||match[5]>59){return fail}
today=new Date()
return new Date(today.getFullYear(),today.getMonth(),today.getDate(),match[1]||0,match[3]||0,match[5]||0)/1000}}}
if(text==='now'){return now===null||isNaN(now)?new Date().getTime()/1000|0:now|0}
if(!isNaN(parsed=Date.parse(text))){return parsed/1000|0}
pattern=new RegExp(['^([0-9]{4}-[0-9]{2}-[0-9]{2})','[ t]','([0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?)','([\\+-][0-9]{2}(:[0-9]{2})?|z)'].join(''))
match=text.match(pattern)
if(match){if(match[4]==='z'){match[4]='Z'}else if(match[4].match(/^([+-][0-9]{2})$/)){match[4]=match[4]+':00'}
if(!isNaN(parsed=Date.parse(match[1]+'T'+match[2]+match[4]))){return parsed/1000|0}}
date=now?new Date(now*1000):new Date()
days={'sun':0,'mon':1,'tue':2,'wed':3,'thu':4,'fri':5,'sat':6}
ranges={'yea':'FullYear','mon':'Month','day':'Date','hou':'Hours','min':'Minutes','sec':'Seconds'}
function lastNext(type,range,modifier){var diff
var day=days[range]
if(typeof day!=='undefined'){diff=day-date.getDay()
if(diff===0){diff=7*modifier}else if(diff>0&&type==='last'){diff-=7}else if(diff<0&&type==='next'){diff+=7}
date.setDate(date.getDate()+diff)}}
function process(val){var splt=val.split(' ')
var type=splt[0]
var range=splt[1].substring(0,3)
var typeIsNumber=/\d+/.test(type)
var ago=splt[2]==='ago'
var num=(type==='last'?-1:1)*(ago?-1:1)
if(typeIsNumber){num*=parseInt(type,10)}
if(ranges.hasOwnProperty(range)&&!splt[1].match(/^mon(day|\.)?$/i)){return date['set'+ranges[range]](date['get'+ranges[range]]()+num)}
if(range==='wee'){return date.setDate(date.getDate()+(num*7))}
if(type==='next'||type==='last'){lastNext(type,range,num)}else if(!typeIsNumber){return false}
return true}
times='(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec'+'|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?'+'|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)'
regex='([+-]?\\d+\\s'+times+'|'+'(last|next)\\s'+times+')(\\sago)?'
match=text.match(new RegExp(regex,'gi'))
if(!match){return fail}
for(i=0,len=match.length;i<len;i++){if(!process(match[i])){return fail}}
return(date.getTime()/1000)}
return{format:format,strtotime:strtotime}}(),true);})(window);(function(window){"use strict";window.ls.container.set('env',function(){return APP_ENV;},true);})(window);(function(window){"use strict";window.ls.container.set('form',function(){function cast(value,to){if(value&&Array.isArray(value)&&to!=='array'){value=value.map(element=>cast(element,to));return value;}
request.onerror=function(){reject(new Error("Network Error"));};request.send(params);})};return{'get':function(path,headers={},params={}){return call('GET',path+((params.length>0)?'?'+buildQuery(params):''),headers,{});},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress);},'put':function(path,headers={},params={},progress=null){return call('PUT',headers,params,progress);},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress);},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress);},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let analytics={create:function(id,source,activity,url){return http.post('/analytics',{'content-type':'application/json'},{id:id,source:source,activity:activity,url:url,version:env.VERSION,setup:env.SETUP});},};return{analytics:analytics,};},true);})(window);(function(window){"use strict";window.ls.container.set('console',function(window){var sdk=new window.Appwrite();var endpoint=window.location.origin+'/v1';sdk.setEndpoint(endpoint).setProject('console').setLocale(APP_ENV.LOCALE);return sdk;},true);})(window);(function(window){"use strict";window.ls.container.set('date',function(){function format(format,datetime){if(!datetime){return null;}
return new Intl.DateTimeFormat('en-US',{timeZone:'UTC',hourCycle:'h24',...format}).format(new Date(datetime));}
return{format:format,}}(),true);})(window);(function(window){"use strict";window.ls.container.set('env',function(){return APP_ENV;},true);})(window);(function(window){"use strict";window.ls.container.set('form',function(){function cast(value,to){if(value&&Array.isArray(value)&&to!=='array'){value=value.map(element=>cast(element,to));return value;}
switch(to){case'int':case'integer':value=parseInt(value);break;case'numeric':value=Number(value);break;case'float':value=parseFloat(value);break;case'string':value=value.toString();if(value.length===0){value=null;}
break;case'json':value=(value)?JSON.parse(value):[];break;case'array':value=(value&&value.constructor&&value.constructor===Array)?value:[value];break;case'array-empty':value=[];break;case'bool':case'boolean':value=(value==='false')?false:value;value=!!value;break;}
return value;}
@ -655,7 +553,7 @@ return false;};return{isRTL:isRTL,};},true);})(window);(function(window){"use st
let size=element.dataset["size"]||80;let name=$value.name||$value||"";name=(typeof name!=='string')?'--':name;return def="/v1/avatars/initials?project=console"+"&name="+
encodeURIComponent(name)+"&width="+
size+"&height="+
size;}).add("selectedCollection",function($value,router){return $value===router.params.collectionId?"selected":"";}).add("selectedDocument",function($value,router){return $value===router.params.documentId?"selected":"";}).add("localeString",function($value){$value=parseInt($value);return!Number.isNaN($value)?$value.toLocaleString():"";}).add("date",function($value,date){return $value?date.format("Y-m-d",$value):"";}).add("dateTime",function($value,date){return $value?date.format("Y-m-d H:i",$value):"";}).add("dateText",function($value,date){return $value?date.format("d M Y",$value):"";}).add("timeSince",function($value){$value=$value*1000;let seconds=Math.floor((Date.now()-$value)/1000);let unit="second";let direction="ago";if(seconds<0){seconds=-seconds;direction="from now";}
size;}).add("selectedCollection",function($value,router){return $value===router.params.collectionId?"selected":"";}).add("selectedDocument",function($value,router){return $value===router.params.documentId?"selected":"";}).add("localeString",function($value){$value=parseInt($value);return!Number.isNaN($value)?$value.toLocaleString():"";}).add("dateTime",function($value,date){return $value?date.format({year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit'},$value):"";}).add("date",function($value,date){return $value?date.format({year:'numeric',month:'short',day:'2-digit',},$value):"";}).add("timeSince",function($value){$value=new Date($value).getTime();let now=new Date();now.setMinutes(now.getMinutes()+now.getTimezoneOffset());let timestamp=new Date(now.toISOString()).getTime();let seconds=Math.floor((timestamp-$value)/1000);let unit="second";let direction="ago";if(seconds<0){seconds=-seconds;direction="from now";}
let value=seconds;if(seconds>=31536000){value=Math.floor(seconds/31536000);unit="year";}
else if(seconds>=86400){value=Math.floor(seconds/86400);unit="day";}
else if(seconds>=3600){value=Math.floor(seconds/3600);unit="hour";}
@ -752,9 +650,9 @@ button.addEventListener("click",function(){var clone=document.createElement(elem
clone.innerHTML=template;clone.className=element.className;var input=clone.querySelector("input, select, textarea");view.render(clone);if(debug){console.log('Debug: clone: ',clone);console.log('Debug: target: ',target);}
if(target){target.appendChild(clone);}else{button.parentNode.insertBefore(clone,button);}
if(input){input.focus();}
Array.prototype.slice.call(clone.querySelectorAll("[data-remove]")).map(function(obj){obj.addEventListener("click",function(){clone.parentNode.removeChild(clone);obj.scrollIntoView({behavior:"smooth"});});});Array.prototype.slice.call(clone.querySelectorAll("[data-up]")).map(function(obj){obj.addEventListener("click",function(){if(clone.previousElementSibling){clone.parentNode.insertBefore(clone,clone.previousElementSibling);obj.scrollIntoView({behavior:"smooth"});}});});Array.prototype.slice.call(clone.querySelectorAll("[data-down]")).map(function(obj){obj.addEventListener("click",function(){if(clone.nextElementSibling){clone.parentNode.insertBefore(clone.nextElementSibling,clone);obj.scrollIntoView({behavior:"smooth"});}});});});element.parentNode.insertBefore(button,element.nextSibling);element.parentNode.removeChild(element);button.form.addEventListener('reset',function(event){target.innerHTML='';if(first){button.click();}});if(first){button.click();}}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-add",repeat:false,controller:function(element,view,container,document){for(var i=0;i<element.children.length;i++){let button=document.createElement("button");let template=element.children[i].cloneNode(true);let as=element.getAttribute('data-ls-as');let counter=0;button.type="button";button.innerText="Add";button.classList.add("reverse");button.classList.add("margin-end-small");button.addEventListener('click',function(){container.addNamespace(as,'new-'+counter++);console.log(container.namespaces,container.get(as),as);container.set(as,null,true,true);let child=template.cloneNode(true);view.render(child);element.appendChild(child);element.style.visibility='visible';let inputs=child.querySelectorAll('input,textarea');for(let index=0;index<inputs.length;++index){if(inputs[index].type!=='hidden'){inputs[index].focus();break;}}});element.after(button);}}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-chart",controller:function(element,container,date,document){let wrapper=document.createElement("div");let child=document.createElement("canvas");let sources=element.getAttribute('data-forms-chart');let width=element.getAttribute('data-width')||500;let height=element.getAttribute('data-height')||175;let showXAxis=element.getAttribute('data-show-x-axis')||false;let showYAxis=element.getAttribute('data-show-y-axis')||false;let colors=(element.getAttribute('data-colors')||'blue,green,orange,red').split(',');let themes={'blue':'#29b5d9','green':'#4eb55b','orange':'#fba233','red':'#dc3232','create':'#00b680','read':'#009cde','update':'#696fd7','delete':'#da5d95',};let range={'24h':'H:i','7d':'d F Y','30d':'d F Y','90d':'d F Y'}
Array.prototype.slice.call(clone.querySelectorAll("[data-remove]")).map(function(obj){obj.addEventListener("click",function(){clone.parentNode.removeChild(clone);obj.scrollIntoView({behavior:"smooth"});});});Array.prototype.slice.call(clone.querySelectorAll("[data-up]")).map(function(obj){obj.addEventListener("click",function(){if(clone.previousElementSibling){clone.parentNode.insertBefore(clone,clone.previousElementSibling);obj.scrollIntoView({behavior:"smooth"});}});});Array.prototype.slice.call(clone.querySelectorAll("[data-down]")).map(function(obj){obj.addEventListener("click",function(){if(clone.nextElementSibling){clone.parentNode.insertBefore(clone.nextElementSibling,clone);obj.scrollIntoView({behavior:"smooth"});}});});});element.parentNode.insertBefore(button,element.nextSibling);element.parentNode.removeChild(element);button.form.addEventListener('reset',function(event){target.innerHTML='';if(first){button.click();}});if(first){button.click();}}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-add",repeat:false,controller:function(element,view,container,document){for(var i=0;i<element.children.length;i++){let button=document.createElement("button");let template=element.children[i].cloneNode(true);let as=element.getAttribute('data-ls-as');let counter=0;button.type="button";button.innerText="Add";button.classList.add("reverse");button.classList.add("margin-end-small");button.addEventListener('click',function(){container.addNamespace(as,'new-'+counter++);console.log(container.namespaces,container.get(as),as);container.set(as,null,true,true);let child=template.cloneNode(true);view.render(child);element.appendChild(child);element.style.visibility='visible';let inputs=child.querySelectorAll('input,textarea');for(let index=0;index<inputs.length;++index){if(inputs[index].type!=='hidden'){inputs[index].focus();break;}}});element.after(button);}}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-chart",controller:function(element,container,date,document){let wrapper=document.createElement("div");let child=document.createElement("canvas");let sources=element.getAttribute('data-forms-chart');let width=element.getAttribute('data-width')||500;let height=element.getAttribute('data-height')||175;let showXAxis=element.getAttribute('data-show-x-axis')||false;let showYAxis=element.getAttribute('data-show-y-axis')||false;let colors=(element.getAttribute('data-colors')||'blue,green,orange,red').split(',');let themes={'blue':'#29b5d9','green':'#4eb55b','orange':'#fba233','red':'#dc3232','create':'#00b680','read':'#009cde','update':'#696fd7','delete':'#da5d95',};let range={'24h':{hour:'2-digit',minute:'2-digit'},'7d':{year:'numeric',month:'short',day:'2-digit',},'30d':{year:'numeric',month:'short',day:'2-digit',},'90d':{year:'numeric',month:'short',day:'2-digit',}}
let ticksCount=5;element.parentNode.insertBefore(wrapper,element.nextSibling);wrapper.classList.add('content');child.width=width;child.height=height;sources=sources.split(',');wrapper.appendChild(child);let chart=null;let check=function(){let config={type:"line",data:{labels:[],datasets:[]},options:{animation:{duration:0},responsive:true,hover:{mode:"nearest",intersect:false},scales:{x:{display:showXAxis},y:{display:showYAxis,min:0,ticks:{count:ticksCount,fontColor:"#8f8f8f"},}},plugins:{title:{display:false,text:"Stats"},legend:{display:false},tooltip:{mode:"index",intersect:false,caretPadding:0},}}};let highest=0;for(let i=0;i<sources.length;i++){let label=sources[i].substring(0,sources[i].indexOf('='));let path=sources[i].substring(sources[i].indexOf('=')+1);let usage=container.get('usage');let data=usage[path];let value=JSON.parse(element.value);config.data.labels[i]=label;config.data.datasets[i]={};config.data.datasets[i].label=label;config.data.datasets[i].borderColor=themes[colors[i]];config.data.datasets[i].backgroundColor=themes[colors[i]]+'36';config.data.datasets[i].borderWidth=2;config.data.datasets[i].data=[0,0,0,0,0,0,0];config.data.datasets[i].fill=true;if(!data){return;}
let dateFormat=(value.range&&range[value.range])?range[value.range]:'d F Y';for(let x=0;x<data.length;x++){if(data[x].value>highest){highest=data[x].value;}
let dateFormat=(value.range&&range[value.range])?range[value.range]:{year:'numeric',month:'short',day:'2-digit',};for(let x=0;x<data.length;x++){if(data[x].value>highest){highest=data[x].value;}
config.data.datasets[i].data[x]=data[x].value;config.data.labels[x]=date.format(dateFormat,data[x].date);}}
if(highest==0){config.options.scales.y.ticks.stepSize=1;config.options.scales.y.max=ticksCount;}else{highest=Math.ceil(highest/ticksCount)*ticksCount;config.options.scales.y.ticks.stepSize=highest/ticksCount;config.options.scales.y.max=highest;}
if(chart){chart.destroy();}

View file

@ -28,19 +28,33 @@ window.ls.filter
$value = parseInt($value);
return !Number.isNaN($value) ? $value.toLocaleString() : "";
})
.add("date", function ($value, date) {
return $value ? date.format("Y-m-d", $value) : "";
})
.add("dateTime", function ($value, date) {
return $value ? date.format("Y-m-d H:i", $value) : "";
return $value ? date.format({
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit'
}, $value) : "";
})
.add("dateText", function ($value, date) {
return $value ? date.format("d M Y", $value) : "";
.add("date", function ($value, date) {
return $value ? date.format({
year: 'numeric',
month: 'short',
day: '2-digit',
}, $value) : "";
})
.add("timeSince", function ($value) {
$value = $value * 1000;
$value = new Date($value).getTime();
let seconds = Math.floor((Date.now() - $value) / 1000);
/**
* Adapt to timezone UTC.
*/
let now = new Date();
now.setMinutes(now.getMinutes() + now.getTimezoneOffset());
let timestamp = new Date(now.toISOString()).getTime();
let seconds = Math.floor((timestamp - $value) / 1000);
let unit = "second";
let direction = "ago";

View file

@ -2,605 +2,20 @@
"use strict";
window.ls.container.set('date', function () {
function format (format, timestamp) {
return timestamp; // TODO: implement DateTime Formatter
// discuss at: http://locutus.io/php/date/
// original by: Carlos R. L. Rodrigues (http://www.jsfromhell.com)
// original by: gettimeofday
// parts by: Peter-Paul Koch (http://www.quirksmode.org/js/beat.html)
// improved by: Kevin van Zonneveld (http://kvz.io)
// improved by: MeEtc (http://yass.meetcweb.com)
// improved by: Brad Touesnard
// improved by: Tim Wiel
// improved by: Bryan Elliott
// improved by: David Randall
// improved by: Theriault (https://github.com/Theriault)
// improved by: Theriault (https://github.com/Theriault)
// improved by: Brett Zamir (http://brett-zamir.me)
// improved by: Theriault (https://github.com/Theriault)
// improved by: Thomas Beaucourt (http://www.webapp.fr)
// improved by: JT
// improved by: Theriault (https://github.com/Theriault)
// improved by: Rafał Kukawski (http://blog.kukawski.pl)
// improved by: Theriault (https://github.com/Theriault)
// input by: Brett Zamir (http://brett-zamir.me)
// input by: majak
// input by: Alex
// input by: Martin
// input by: Alex Wilson
// input by: Haravikk
// bugfixed by: Kevin van Zonneveld (http://kvz.io)
// bugfixed by: majak
// bugfixed by: Kevin van Zonneveld (http://kvz.io)
// bugfixed by: Brett Zamir (http://brett-zamir.me)
// bugfixed by: omid (http://locutus.io/php/380:380#comment_137122)
// bugfixed by: Chris (http://www.devotis.nl/)
// note 1: Uses global: locutus to store the default timezone
// note 1: Although the function potentially allows timezone info
// note 1: (see notes), it currently does not set
// note 1: per a timezone specified by date_default_timezone_set(). Implementers might use
// note 1: $locutus.currentTimezoneOffset and
// note 1: $locutus.currentTimezoneDST set by that function
// note 1: in order to adjust the dates in this function
// note 1: (or our other date functions!) accordingly
// example 1: date('H:m:s \\m \\i\\s \\m\\o\\n\\t\\h', 1062402400)
// returns 1: '07:09:40 m is month'
// example 2: date('F j, Y, g:i a', 1062462400)
// returns 2: 'September 2, 2003, 12:26 am'
// example 3: date('Y W o', 1062462400)
// returns 3: '2003 36 2003'
// example 4: var $x = date('Y m d', (new Date()).getTime() / 1000)
// example 4: $x = $x + ''
// example 4: var $result = $x.length // 2009 01 09
// returns 4: 10
// example 5: date('W', 1104534000)
// returns 5: '52'
// example 6: date('B t', 1104534000)
// returns 6: '999 31'
// example 7: date('W U', 1293750000.82); // 2010-12-31
// returns 7: '52 1293750000'
// example 8: date('W', 1293836400); // 2011-01-01
// returns 8: '52'
// example 9: date('W Y-m-d', 1293974054); // 2011-01-02
// returns 9: '52 2011-01-02'
// test: skip-1 skip-2 skip-5
var jsdate, f
// Keep this here (works, but for code commented-out below for file size reasons)
// var tal= [];
var txtWords = [
'Sun', 'Mon', 'Tues', 'Wednes', 'Thurs', 'Fri', 'Satur',
'January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December'
]
// trailing backslash -> (dropped)
// a backslash followed by any character (including backslash) -> the character
// empty string -> empty string
var formatChr = /\\?(.?)/gi
var formatChrCb = function (t, s) {
return f[t] ? f[t]() : s
}
var _pad = function (n, c) {
n = String(n)
while (n.length < c) {
n = '0' + n
}
return n
}
f = {
// Day
d: function () {
// Day of month w/leading 0; 01..31
return _pad(f.j(), 2)
},
D: function () {
// Shorthand day name; Mon...Sun
return f.l()
.slice(0, 3)
},
j: function () {
// Day of month; 1..31
return jsdate.getDate()
},
l: function () {
// Full day name; Monday...Sunday
return txtWords[f.w()] + 'day'
},
N: function () {
// ISO-8601 day of week; 1[Mon]..7[Sun]
return f.w() || 7
},
S: function () {
// Ordinal suffix for day of month; st, nd, rd, th
var j = f.j()
var i = j % 10
if (i <= 3 && parseInt((j % 100) / 10, 10) === 1) {
i = 0
}
return ['st', 'nd', 'rd'][i - 1] || 'th'
},
w: function () {
// Day of week; 0[Sun]..6[Sat]
return jsdate.getDay()
},
z: function () {
// Day of year; 0..365
var a = new Date(f.Y(), f.n() - 1, f.j())
var b = new Date(f.Y(), 0, 1)
return Math.round((a - b) / 864e5)
},
// Week
W: function () {
// ISO-8601 week number
var a = new Date(f.Y(), f.n() - 1, f.j() - f.N() + 3)
var b = new Date(a.getFullYear(), 0, 4)
return _pad(1 + Math.round((a - b) / 864e5 / 7), 2)
},
// Month
F: function () {
// Full month name; January...December
return txtWords[6 + f.n()]
},
m: function () {
// Month w/leading 0; 01...12
return _pad(f.n(), 2)
},
M: function () {
// Shorthand month name; Jan...Dec
return f.F()
.slice(0, 3)
},
n: function () {
// Month; 1...12
return jsdate.getMonth() + 1
},
t: function () {
// Days in month; 28...31
return (new Date(f.Y(), f.n(), 0))
.getDate()
},
// Year
L: function () {
// Is leap year?; 0 or 1
var j = f.Y()
return j % 4 === 0 & j % 100 !== 0 | j % 400 === 0
},
o: function () {
// ISO-8601 year
var n = f.n()
var W = f.W()
var Y = f.Y()
return Y + (n === 12 && W < 9 ? 1 : n === 1 && W > 9 ? -1 : 0)
},
Y: function () {
// Full year; e.g. 1980...2010
return jsdate.getFullYear()
},
y: function () {
// Last two digits of year; 00...99
return f.Y()
.toString()
.slice(-2)
},
// Time
a: function () {
// am or pm
return jsdate.getHours() > 11 ? 'pm' : 'am'
},
A: function () {
// AM or PM
return f.a()
.toUpperCase()
},
B: function () {
// Swatch Internet time; 000..999
var H = jsdate.getUTCHours() * 36e2
// Hours
var i = jsdate.getUTCMinutes() * 60
// Minutes
// Seconds
var s = jsdate.getUTCSeconds()
return _pad(Math.floor((H + i + s + 36e2) / 86.4) % 1e3, 3)
},
g: function () {
// 12-Hours; 1..12
return f.G() % 12 || 12
},
G: function () {
// 24-Hours; 0..23
return jsdate.getHours()
},
h: function () {
// 12-Hours w/leading 0; 01..12
return _pad(f.g(), 2)
},
H: function () {
// 24-Hours w/leading 0; 00..23
return _pad(f.G(), 2)
},
i: function () {
// Minutes w/leading 0; 00..59
return _pad(jsdate.getMinutes(), 2)
},
s: function () {
// Seconds w/leading 0; 00..59
return _pad(jsdate.getSeconds(), 2)
},
u: function () {
// Microseconds; 000000-999000
return _pad(jsdate.getMilliseconds() * 1000, 6)
},
// Timezone
e: function () {
// Timezone identifier; e.g. Atlantic/Azores, ...
// The following works, but requires inclusion of the very large
// timezone_abbreviations_list() function.
/* return that.date_default_timezone_get();
*/
var msg = 'Not supported (see source code of date() for timezone on how to add support)'
throw new Error(msg)
},
I: function () {
// DST observed?; 0 or 1
// Compares Jan 1 minus Jan 1 UTC to Jul 1 minus Jul 1 UTC.
// If they are not equal, then DST is observed.
var a = new Date(f.Y(), 0)
// Jan 1
var c = Date.UTC(f.Y(), 0)
// Jan 1 UTC
var b = new Date(f.Y(), 6)
// Jul 1
// Jul 1 UTC
var d = Date.UTC(f.Y(), 6)
return ((a - c) !== (b - d)) ? 1 : 0
},
O: function () {
// Difference to GMT in hour format; e.g. +0200
var tzo = jsdate.getTimezoneOffset()
var a = Math.abs(tzo)
return (tzo > 0 ? '-' : '+') + _pad(Math.floor(a / 60) * 100 + a % 60, 4)
},
P: function () {
// Difference to GMT w/colon; e.g. +02:00
var O = f.O()
return (O.substr(0, 3) + ':' + O.substr(3, 2))
},
T: function () {
// The following works, but requires inclusion of the very
// large timezone_abbreviations_list() function.
/* var abbr, i, os, _default;
if (!tal.length) {
tal = that.timezone_abbreviations_list();
}
if ($locutus && $locutus.default_timezone) {
_default = $locutus.default_timezone;
for (abbr in tal) {
for (i = 0; i < tal[abbr].length; i++) {
if (tal[abbr][i].timezone_id === _default) {
return abbr.toUpperCase();
}
}
}
}
for (abbr in tal) {
for (i = 0; i < tal[abbr].length; i++) {
os = -jsdate.getTimezoneOffset() * 60;
if (tal[abbr][i].offset === os) {
return abbr.toUpperCase();
}
}
}
*/
return 'UTC'
},
Z: function () {
// Timezone offset in seconds (-43200...50400)
return -jsdate.getTimezoneOffset() * 60
},
// Full Date/Time
c: function () {
// ISO-8601 date.
return 'Y-m-d\\TH:i:sP'.replace(formatChr, formatChrCb)
},
r: function () {
// RFC 2822
return 'D, d M Y H:i:s O'.replace(formatChr, formatChrCb)
},
U: function () {
// Seconds since UNIX epoch
return jsdate / 1000 | 0
}
function format(format, datetime) {
if (!datetime) {
return null;
}
var _date = function (format, timestamp) {
jsdate = (timestamp === undefined ? new Date() // Not provided
: (timestamp instanceof Date) ? new Date(timestamp) // JS Date()
: new Date(timestamp * 1000) // Unix timestamp (auto-convert to int)
)
return format.replace(formatChr, formatChrCb)
}
return _date(format, timestamp)
}
function strtotime (text, now) {
return text; // TODO: implement DateTime Formatter
// discuss at: http://locutus.io/php/strtotime/
// original by: Caio Ariede (http://caioariede.com)
// improved by: Kevin van Zonneveld (http://kvz.io)
// improved by: Caio Ariede (http://caioariede.com)
// improved by: A. Matías Quezada (http://amatiasq.com)
// improved by: preuter
// improved by: Brett Zamir (http://brett-zamir.me)
// improved by: Mirko Faber
// input by: David
// bugfixed by: Wagner B. Soares
// bugfixed by: Artur Tchernychev
// bugfixed by: Stephan Bösch-Plepelits (http://github.com/plepe)
// note 1: Examples all have a fixed timestamp to prevent
// note 1: tests to fail because of variable time(zones)
// example 1: strtotime('+1 day', 1129633200)
// returns 1: 1129719600
// example 2: strtotime('+1 week 2 days 4 hours 2 seconds', 1129633200)
// returns 2: 1130425202
// example 3: strtotime('last month', 1129633200)
// returns 3: 1127041200
// example 4: strtotime('2009-05-04 08:30:00 GMT')
// returns 4: 1241425800
// example 5: strtotime('2009-05-04 08:30:00+00')
// returns 5: 1241425800
// example 6: strtotime('2009-05-04 08:30:00+02:00')
// returns 6: 1241418600
// example 7: strtotime('2009-05-04T08:30:00Z')
// returns 7: 1241425800
var parsed
var match
var today
var year
var date
var days
var ranges
var len
var times
var regex
var i
var fail = false
if (!text) {
return fail
}
// Unecessary spaces
text = text.replace(/^\s+|\s+$/g, '')
.replace(/\s{2,}/g, ' ')
.replace(/[\t\r\n]/g, '')
.toLowerCase()
// in contrast to php, js Date.parse function interprets:
// dates given as yyyy-mm-dd as in timezone: UTC,
// dates with "." or "-" as MDY instead of DMY
// dates with two-digit years differently
// etc...etc...
// ...therefore we manually parse lots of common date formats
var pattern = new RegExp([
'^(\\d{1,4})',
'([\\-\\.\\/:])',
'(\\d{1,2})',
'([\\-\\.\\/:])',
'(\\d{1,4})',
'(?:\\s(\\d{1,2}):(\\d{2})?:?(\\d{2})?)?',
'(?:\\s([A-Z]+)?)?$'
].join(''))
match = text.match(pattern)
if (match && match[2] === match[4]) {
if (match[1] > 1901) {
switch (match[2]) {
case '-':
// YYYY-M-D
if (match[3] > 12 || match[5] > 31) {
return fail
}
return new Date(match[1], parseInt(match[3], 10) - 1, match[5],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000
case '.':
// YYYY.M.D is not parsed by strtotime()
return fail
case '/':
// YYYY/M/D
if (match[3] > 12 || match[5] > 31) {
return fail
}
return new Date(match[1], parseInt(match[3], 10) - 1, match[5],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000
}
} else if (match[5] > 1901) {
switch (match[2]) {
case '-':
// D-M-YYYY
if (match[3] > 12 || match[1] > 31) {
return fail
}
return new Date(match[5], parseInt(match[3], 10) - 1, match[1],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000
case '.':
// D.M.YYYY
if (match[3] > 12 || match[1] > 31) {
return fail
}
return new Date(match[5], parseInt(match[3], 10) - 1, match[1],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000
case '/':
// M/D/YYYY
if (match[1] > 12 || match[3] > 31) {
return fail
}
return new Date(match[5], parseInt(match[1], 10) - 1, match[3],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000
}
} else {
switch (match[2]) {
case '-':
// YY-M-D
if (match[3] > 12 || match[5] > 31 || (match[1] < 70 && match[1] > 38)) {
return fail
}
year = match[1] >= 0 && match[1] <= 38 ? +match[1] + 2000 : match[1]
return new Date(year, parseInt(match[3], 10) - 1, match[5],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000
case '.':
// D.M.YY or H.MM.SS
if (match[5] >= 70) {
// D.M.YY
if (match[3] > 12 || match[1] > 31) {
return fail
}
return new Date(match[5], parseInt(match[3], 10) - 1, match[1],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000
}
if (match[5] < 60 && !match[6]) {
// H.MM.SS
if (match[1] > 23 || match[3] > 59) {
return fail
}
today = new Date()
return new Date(today.getFullYear(), today.getMonth(), today.getDate(),
match[1] || 0, match[3] || 0, match[5] || 0, match[9] || 0) / 1000
}
// invalid format, cannot be parsed
return fail
case '/':
// M/D/YY
if (match[1] > 12 || match[3] > 31 || (match[5] < 70 && match[5] > 38)) {
return fail
}
year = match[5] >= 0 && match[5] <= 38 ? +match[5] + 2000 : match[5]
return new Date(year, parseInt(match[1], 10) - 1, match[3],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000
case ':':
// HH:MM:SS
if (match[1] > 23 || match[3] > 59 || match[5] > 59) {
return fail
}
today = new Date()
return new Date(today.getFullYear(), today.getMonth(), today.getDate(),
match[1] || 0, match[3] || 0, match[5] || 0) / 1000
}
}
}
// other formats and "now" should be parsed by Date.parse()
if (text === 'now') {
return now === null || isNaN(now)
? new Date().getTime() / 1000 | 0
: now | 0
}
if (!isNaN(parsed = Date.parse(text))) {
return parsed / 1000 | 0
}
// Browsers !== Chrome have problems parsing ISO 8601 date strings, as they do
// not accept lower case characters, space, or shortened time zones.
// Therefore, fix these problems and try again.
// Examples:
// 2015-04-15 20:33:59+02
// 2015-04-15 20:33:59z
// 2015-04-15t20:33:59+02:00
pattern = new RegExp([
'^([0-9]{4}-[0-9]{2}-[0-9]{2})',
'[ t]',
'([0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?)',
'([\\+-][0-9]{2}(:[0-9]{2})?|z)'
].join(''))
match = text.match(pattern)
if (match) {
// @todo: time zone information
if (match[4] === 'z') {
match[4] = 'Z'
} else if (match[4].match(/^([+-][0-9]{2})$/)) {
match[4] = match[4] + ':00'
}
if (!isNaN(parsed = Date.parse(match[1] + 'T' + match[2] + match[4]))) {
return parsed / 1000 | 0
}
}
date = now ? new Date(now * 1000) : new Date()
days = {
'sun': 0,
'mon': 1,
'tue': 2,
'wed': 3,
'thu': 4,
'fri': 5,
'sat': 6
}
ranges = {
'yea': 'FullYear',
'mon': 'Month',
'day': 'Date',
'hou': 'Hours',
'min': 'Minutes',
'sec': 'Seconds'
}
function lastNext (type, range, modifier) {
var diff
var day = days[range]
if (typeof day !== 'undefined') {
diff = day - date.getDay()
if (diff === 0) {
diff = 7 * modifier
} else if (diff > 0 && type === 'last') {
diff -= 7
} else if (diff < 0 && type === 'next') {
diff += 7
}
date.setDate(date.getDate() + diff)
}
}
function process (val) {
// @todo: Reconcile this with regex using \s, taking into account
// browser issues with split and regexes
var splt = val.split(' ')
var type = splt[0]
var range = splt[1].substring(0, 3)
var typeIsNumber = /\d+/.test(type)
var ago = splt[2] === 'ago'
var num = (type === 'last' ? -1 : 1) * (ago ? -1 : 1)
if (typeIsNumber) {
num *= parseInt(type, 10)
}
if (ranges.hasOwnProperty(range) && !splt[1].match(/^mon(day|\.)?$/i)) {
return date['set' + ranges[range]](date['get' + ranges[range]]() + num)
}
if (range === 'wee') {
return date.setDate(date.getDate() + (num * 7))
}
if (type === 'next' || type === 'last') {
lastNext(type, range, num)
} else if (!typeIsNumber) {
return false
}
return true
}
times = '(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec' +
'|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?' +
'|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)'
regex = '([+-]?\\d+\\s' + times + '|' + '(last|next)\\s' + times + ')(\\sago)?'
match = text.match(new RegExp(regex, 'gi'))
if (!match) {
return fail
}
for (i = 0, len = match.length; i < len; i++) {
if (!process(match[i])) {
return fail
}
}
return (date.getTime() / 1000)
return new Intl.DateTimeFormat('en-US', {
timeZone: 'UTC',
hourCycle: 'h24',
...format
}).format(new Date(datetime));
}
return {
format: format,
strtotime: strtotime
}
}(), true);

View file

@ -13,7 +13,27 @@
let showYAxis = element.getAttribute('data-show-y-axis') || false;
let colors = (element.getAttribute('data-colors') || 'blue,green,orange,red').split(',');
let themes = { 'blue': '#29b5d9', 'green': '#4eb55b', 'orange': '#fba233', 'red': '#dc3232', 'create': '#00b680', 'read': '#009cde', 'update': '#696fd7', 'delete': '#da5d95', };
let range = { '24h': 'H:i', '7d': 'd F Y', '30d': 'd F Y', '90d': 'd F Y' }
let range = {
'24h': {
hour: '2-digit',
minute: '2-digit'
},
'7d': {
year: 'numeric',
month: 'short',
day: '2-digit',
},
'30d': {
year: 'numeric',
month: 'short',
day: '2-digit',
},
'90d': {
year: 'numeric',
month: 'short',
day: '2-digit',
}
}
let ticksCount = 5;
element.parentNode.insertBefore(wrapper, element.nextSibling);
@ -97,10 +117,14 @@
return;
}
let dateFormat = (value.range && range[value.range]) ? range[value.range] : 'd F Y';
let dateFormat = (value.range && range[value.range]) ? range[value.range] : {
year: 'numeric',
month: 'short',
day: '2-digit',
};
for (let x = 0; x < data.length; x++) {
if(data[x].value > highest) {
if (data[x].value > highest) {
highest = data[x].value;
}
config.data.datasets[i].data[x] = data[x].value;
@ -108,7 +132,7 @@
}
}
if(highest == 0) {
if (highest == 0) {
config.options.scales.y.ticks.stepSize = 1;
config.options.scales.y.max = ticksCount;
} else {
@ -117,8 +141,8 @@
config.options.scales.y.ticks.stepSize = highest / ticksCount;
config.options.scales.y.max = highest;
}
if(chart) {
if (chart) {
chart.destroy();
}
else {