antosdk-apps/SVGEdit/build/debug/svgedit/iife-Editor.js

519 lines
2.2 MiB
JavaScript
Raw Permalink Normal View History

2023-08-17 23:54:41 +02:00
var Editor=function(){"use strict";function _typeof$2(en){return _typeof$2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(en){return typeof en}:function(en){return en&&"function"==typeof Symbol&&en.constructor===Symbol&&en!==Symbol.prototype?"symbol":typeof en},_typeof$2(en)}function _classCallCheck(en,tn){if(!(en instanceof tn))throw new TypeError("Cannot call a class as a function")}function _defineProperties(en,tn){for(var nn=0;nn<tn.length;nn++){var rn=tn[nn];rn.enumerable=rn.enumerable||!1,rn.configurable=!0,"value"in rn&&(rn.writable=!0),Object.defineProperty(en,rn.key,rn)}}function _createClass(en,tn,nn){return tn&&_defineProperties(en.prototype,tn),nn&&_defineProperties(en,nn),Object.defineProperty(en,"prototype",{writable:!1}),en}function _assertThisInitialized(en){if(void 0===en)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return en}function _setPrototypeOf(en,tn){return _setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(en,tn){return en.__proto__=tn,en},_setPrototypeOf(en,tn)}function _inherits(en,tn){if("function"!=typeof tn&&null!==tn)throw new TypeError("Super expression must either be null or a function");en.prototype=Object.create(tn&&tn.prototype,{constructor:{value:en,writable:!0,configurable:!0}}),Object.defineProperty(en,"prototype",{writable:!1}),tn&&_setPrototypeOf(en,tn)}function _possibleConstructorReturn(en,tn){if(tn&&("object"===_typeof$2(tn)||"function"==typeof tn))return tn;if(void 0!==tn)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(en)}function _getPrototypeOf(en){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(en){return en.__proto__||Object.getPrototypeOf(en)},_getPrototypeOf(en)}function _defineProperty$2(en,tn,nn){return tn in en?Object.defineProperty(en,tn,{value:nn,enumerable:!0,configurable:!0,writable:!0}):en[tn]=nn,en}function _arrayLikeToArray(en,tn){(null==tn||tn>en.length)&&(tn=en.length);for(var nn=0,rn=new Array(tn);nn<tn;nn++)rn[nn]=en[nn];return rn}function _toArray(en){return function _arrayWithHoles(en){if(Array.isArray(en))return en}(en)||function _iterableToArray(en){if("undefined"!=typeof Symbol&&null!=en[Symbol.iterator]||null!=en["@@iterator"])return Array.from(en)}(en)||function _unsupportedIterableToArray(en,tn){if(en){if("string"==typeof en)return _arrayLikeToArray(en,tn);var nn=Object.prototype.toString.call(en).slice(8,-1);return"Object"===nn&&en.constructor&&(nn=en.constructor.name),"Map"===nn||"Set"===nn?Array.from(en):"Arguments"===nn||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(nn)?_arrayLikeToArray(en,tn):void 0}}(en)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ownKeys$3(en,tn){var nn=Object.keys(en);if(Object.getOwnPropertySymbols){var rn=Object.getOwnPropertySymbols(en);tn&&(rn=rn.filter((function(tn){return Object.getOwnPropertyDescriptor(en,tn).enumerable}))),nn.push.apply(nn,rn)}return nn}function _objectSpread$1(en){for(var tn=1;tn<arguments.length;tn++){var nn=null!=arguments[tn]?arguments[tn]:{};tn%2?ownKeys$3(Object(nn),!0).forEach((function(tn){_defineProperty$2(en,tn,nn[tn])})):Object.getOwnPropertyDescriptors?Object.defineProperties(en,Object.getOwnPropertyDescriptors(nn)):ownKeys$3(Object(nn)).forEach((function(tn){Object.defineProperty(en,tn,Object.getOwnPropertyDescriptor(nn,tn))}))}return en}var en={type:"logger",log:function log(en){this.output("log",en)},warn:function warn(en){this.output("warn",en)},error:function error(en){this.output("error",en)},output:function output(en,tn){console&&console[en]&&console[en].apply(console,tn)}},tn=function(){function Logger(en){var tn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,Logger),this.init(en,tn)}return _createClass(Logger,[{key:"init",value:function init(tn){var nn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};
/**
* Tools for working with units.
* @module units
* @license MIT
*
* @copyright 2010 Alexis Deveria, 2010 Jeff Schiller
*/const fa="http://www.w3.org/2000/svg",ya=["x","x1","cx","rx","width"],ba=["y","y1","cy","ry","height"],va=["r","radius",...ya,...ba];let wa,xa={};const getTypeMap$2=()=>xa,shortFloat=en=>{const tn=wa.getRoundDigits();return isNaN(en)?Array.isArray(en)?shortFloat(en[0])+","+shortFloat(en[1]):Number.parseFloat(en).toFixed(tn)-0:Number(Number(en).toFixed(tn))},convertUnit$3=(en,tn)=>(tn=tn||wa.getBaseUnit(),shortFloat(en/xa[tn])),setUnitAttr=(en,tn,nn)=>{en.setAttribute(tn,nn)},convertToNum=(en,tn)=>{if(!isNaN(tn))return tn-0;if("%"===tn.substr(-1)){const nn=tn.substr(0,tn.length-1)/100,rn=wa.getWidth(),an=wa.getHeight();return ya.includes(en)?nn*rn:ba.includes(en)?nn*an:nn*Math.sqrt(rn*rn+an*an)/Math.sqrt(2)}const nn=tn.substr(-2);return tn.substr(0,tn.length-2)*xa[nn]},ka={HTML:"http://www.w3.org/1999/xhtml",MATH:"http://www.w3.org/1998/Math/MathML",SE:"http://svg-edit.googlecode.com",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",OI:"http://www.optimistik.fr/namespace/svg/OIdata",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"},getReverseNS=function(){const en={};return Object.entries(ka).forEach((tn=>{let[nn,rn]=tn;en[rn]=nn.toLowerCase()})),en},Ca=document.createElementNS(ka.SVG,"svg"),transformPoint=function(en,tn,nn){return{x:nn.a*en+nn.c*tn+nn.e,y:nn.b*en+nn.d*tn+nn.f}},isIdentity=function(en){return 1===en.a&&0===en.b&&0===en.c&&1===en.d&&0===en.e&&0===en.f},matrixMultiply=function(){for(var en=arguments.length,tn=new Array(en),nn=0;nn<en;nn++)tn[nn]=arguments[nn];const rn=tn.reduceRight(((en,tn)=>tn.multiply(en)));return Math.abs(rn.a)<1e-14&&(rn.a=0),Math.abs(rn.b)<1e-14&&(rn.b=0),Math.abs(rn.c)<1e-14&&(rn.c=0),Math.abs(rn.d)<1e-14&&(rn.d=0),Math.abs(rn.e)<1e-14&&(rn.e=0),Math.abs(rn.f)<1e-14&&(rn.f=0),rn},hasMatrixTransform=function(en){if(!en)return!1;let tn=en.numberOfItems;for(;tn--;){const nn=en.getItem(tn);if(1===nn.type&&!isIdentity(nn.matrix))return!0}return!1},transformBox=function(en,tn,nn,rn,an){const sn=transformPoint(en,tn,an),cn=transformPoint(en+nn,tn,an),An=transformPoint(en,tn+rn,an),dn=transformPoint(en+nn,tn+rn,an),un=Math.min(sn.x,cn.x,An.x,dn.x),pn=Math.max(sn.x,cn.x,An.x,dn.x),hn=Math.min(sn.y,cn.y,An.y,dn.y);return{tl:sn,tr:cn,bl:An,br:dn,aabox:{x:un,y:hn,width:pn-un,height:Math.max(sn.y,cn.y,An.y,dn.y)-hn}}},transformListToTransform=function(en,tn,nn){if(!en)return Ca.createSVGTransformFromMatrix(Ca.createSVGMatrix());if(tn=tn||0,nn=nn||en.numberOfItems-1,(tn=Number.parseInt(tn))>(nn=Number.parseInt(nn))){const en=nn;nn=tn,tn=en}let rn=Ca.createSVGMatrix();for(let an=tn;an<=nn;++an){const tn=an>=0&&an<en.numberOfItems?en.getItem(an).matrix:Ca.createSVGMatrix();rn=matrixMultiply(rn,tn)}return Ca.createSVGTransformFromMatrix(rn)},getMatrix=en=>{const tn=en.transform.baseVal;return transformListToTransform(tn).matrix},snapToAngle=(en,tn,nn,rn)=>{const an=Math.PI/4,sn=nn-en,cn=rn-tn,An=Math.atan2(cn,sn),dn=Math.sqrt(sn*sn+cn*cn),un=Math.round(An/an)*an;return{x:en+dn*Math.cos(un),y:tn+dn*Math.sin(un),a:un}},rectsIntersect=(en,tn)=>tn.x<en.x+en.width&&tn.x+tn.width>en.x&&tn.y<en.y+en.height&&tn.y+tn.height>en.y;function isObject$9(en){return en&&"object"==typeof en&&!Array.isArray(en)}function mergeDeep$1(en,tn){const nn=Object.assign({},en);return isObject$9(en)&&isObject$9(tn)&&Object.keys(tn).forEach((rn=>{isObject$9(tn[rn])?rn in en?nn[rn]=mergeDeep$1(en[rn],tn[rn]):Object.assign(nn,{[rn]:tn[rn]}):Object.assign(nn,{[rn]:tn[rn]})})),nn}function getClosest(en,tn){const nn=tn.charAt(0),rn="classList"in document.documentElement;let an,sn;for("["===nn&&(an=(tn=tn.substr(1,tn.length-2)).split("="),an.length>1&&(sn=!0,an[1]=an[1].replace(/"/g,"").replace(/'/g,"")));en&&en!==document&&1===en.nodeType;en=en.parentNode){if("."===nn)if(rn){if(en.classList.contains(tn.substr(1)))return en}else if(new RegExp("(^|\\s)"+tn.substr(1)+"(\\s|$)").test(en.className))return en;if("#"===nn&&en.id===tn.substr(1))return en;if("["===nn&&en.hasAttribute(an[0])){if(!sn)return en;if(en.getAttribute(an[0])===an[1])return en}if(en.tagName.toLowerCase()===tn)
/**
* Miscellaneous utilities.
* @module utilities
* @license MIT
*
* @copyright 2010 Alexis Deveria, 2010 Jeff Schiller
*/const Sa="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use,clipPath".split(",");let Ba=null,Ea=null;const toXml=en=>en.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;");function encode64(en){return en=encodeUTF8(en),window.btoa(en)}function decode64$1(en){return function decodeUTF8(en){return decodeURIComponent(escape(en))}(window.atob(en))}const encodeUTF8=en=>unescape(encodeURIComponent(en)),createObjectURL=en=>en&&"undefined"!=typeof URL&&URL.createObjectURL?URL.createObjectURL(en):"",ja=(()=>{if("undefined"==typeof Blob)return"";const en=new Blob(["<html><head><title>SVG-edit</title></head><body>&nbsp;</body></html>"],{type:"text/html"});return createObjectURL(en)})(),text2xml=en=>{let tn,nn;en.includes("<svg:svg")&&(en=en.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns"));try{nn=new DOMParser,nn.async=!1}catch(en){throw new Error("XML Parser could not be instantiated")}try{tn=nn.parseFromString(en,"text/xml")}catch(en){throw new Error("Error parsing XML string")}return tn},walkTree=(en,tn)=>{if(1===(null==en?void 0:en.nodeType)){tn(en);let nn=en.childNodes.length;for(;nn--;)walkTree(en.childNodes.item(nn),tn)}},getUrlFromAttr=function(en){if(en){if(en.startsWith('url("'))return en.substring(5,en.indexOf('"',6));if(en.startsWith("url('"))return en.substring(5,en.indexOf("'",6));if(en.startsWith("url("))return en.substring(4,en.indexOf(")"))}return null};let getHref=function(en){return en.getAttributeNS(ka.XLINK,"href")},setHref=function(en,tn){en.setAttributeNS(ka.XLINK,"xlink:href",tn)};const findDefs=function(){const en=Ba.getSvgContent();let tn=en.getElementsByTagNameNS(ka.SVG,"defs");return tn.length>0?tn=tn[0]:(tn=en.ownerDocument.createElementNS(ka.SVG,"defs"),en.firstChild?en.insertBefore(tn,en.firstChild.nextSibling):en.append(tn)),tn},getBBox=function(en){const tn=en||Ba.getSelectedElements()[0];if(1!==en.nodeType)return null;const nn=tn.nodeName;let rn=null;switch(nn){case"text":""===tn.textContent?(tn.textContent="a",rn=tn.getBBox(),tn.textContent=""):tn.getBBox&&(rn=tn.getBBox());break;case"path":case"g":case"a":tn.getBBox&&(rn=tn.getBBox());break;default:if("use"===nn)rn=tn.getBBox();else if(Sa.includes(nn))if(tn)try{rn=tn.getBBox()}catch(en){const nn=tn.getExtentOfChar(0),an=tn.getComputedTextLength();rn={x:nn.x,y:nn.y,width:an,height:nn.height}}else{const en=getClosest(tn.parentNode,"foreignObject");en.length&&en[0].getBBox&&(rn=en[0].getBBox())}}return rn&&(rn=(en=>{let{x:tn,y:nn,width:rn,height:an}=en;return{x:tn,y:nn,width:rn,height:an}})(rn)),rn},getPathDFromSegments=function(en){let tn="";return en.forEach((function(en,nn){let[rn,an]=en;tn+=rn;for(let en=0;en<an.length;en+=2)tn+=an[en]+","+an[en+1]+" "})),tn},getPathDFromElement=function(en){let tn,nn,rn,an=1.81;switch(en.tagName){case"ellipse":case"circle":{nn=Number(en.getAttribute("rx")),rn=Number(en.getAttribute("ry"));const sn=Number(en.getAttribute("cx")),cn=Number(en.getAttribute("cy"));"circle"===en.tagName&&en.hasAttribute("r")&&(rn=Number(en.getAttribute("r")),nn=rn),tn=getPathDFromSegments([["M",[sn-nn,cn]],["C",[sn-nn,cn-rn/an,sn-nn/an,cn-rn,sn,cn-rn]],["C",[sn+nn/an,cn-rn,sn+nn,cn-rn/an,sn+nn,cn]],["C",[sn+nn,cn+rn/an,sn+nn/an,cn+rn,sn,cn+rn]],["C",[sn-nn/an,cn+rn,sn-nn,cn+rn/an,sn-nn,cn]],["Z",[]]]);break}case"path":tn=en.getAttribute("d");break;case"line":tn="M"+en.getAttribute("x1")+","+en.getAttribute("y1")+"L"+en.getAttribute("x2")+","+en.getAttribute("y2");break;case"polyline":tn="M"+en.getAttribute("points");break;case"polygon":tn="M"+en.getAttribute("points")+" Z";break;case"rect":{nn=Number(en.getAttribute("rx")),rn=Number(en.getAttribute("ry"));const sn=en.getBBox(),{x:cn,y:An}=sn,dn=sn.width,un=sn.height;an=4-an,tn=getPathDFromSegments(nn||rn?[["M",[cn,An+rn]],["C",[cn,An+rn/an,cn+nn/an,An,cn+nn,An]],["L",[cn+dn-nn,An]],["C",[cn+dn-nn/an,An,cn+dn,An+rn/an,cn+dn,An+rn]],["L",[cn+dn,An+un-rn]],["C",[cn+dn,An+un-rn/an,cn+dn-nn/an,An+un,cn+dn-nn,An+un]],["L",[cn+nn,An+un]],["C",[cn+nn/an,An+un,cn,An+un-rn/an,cn,An+
/**
* Path functionality.
* @module path
* @license MIT
*
* @copyright 2011 Alexis Deveria, 2011 Jeff Schiller
*/let Ta=null;const ptObjToArrMethod=function(en,tn){return Ta.getSegData()[en].map((en=>tn[en]))},getGripPtMethod=function(en,tn){const{path:nn}=en;let rn={x:tn?tn.x:en.item.x,y:tn?tn.y:en.item.y};nn.matrix&&(rn=transformPoint(rn.x,rn.y,nn.matrix));const an=Ta.getZoom();return rn.x*=an,rn.y*=an,rn},getPointFromGripMethod=function(en,tn){const nn={x:en.x,y:en.y};tn.matrix&&(en=transformPoint(nn.x,nn.y,tn.imatrix),nn.x=en.x,nn.y=en.y);const rn=Ta.getZoom();return nn.x/=rn,nn.y/=rn,nn},getGripContainerMethod=function(){let en=getElement("pathpointgrip_container");if(!en){const tn=getElement("selectorParentGroup");en=document.createElementNS(ka.SVG,"g"),tn.append(en),en.id="pathpointgrip_container"}return en},addPointGripMethod=function(en,tn,nn){const rn=getGripContainerMethod();let an=getElement("pathpointgrip_"+en);if(!an){var sn;an=document.createElementNS(ka.SVG,"circle");const tn={id:"pathpointgrip_"+en,display:"none",r:4,fill:"#0FF",stroke:"#00F","stroke-width":2,cursor:"move",style:"pointer-events:all"},nn=Ta.getUIStrings();"pathNodeTooltip"in nn&&(tn["xlink:title"]=nn.pathNodeTooltip),assignAttributes(an,tn),rn.append(an),null===(sn=document.getElementById("pathpointgrip_"+en))||void 0===sn||sn.addEventListener("dblclick",(()=>{const en=Ta.getPathObj();en&&en.setSegType()}))}return tn&&nn&&assignAttributes(an,{cx:tn,cy:nn,display:"inline"}),an},addCtrlGripMethod=function(en){let tn=getElement("ctrlpointgrip_"+en);if(tn)return tn;tn=document.createElementNS(ka.SVG,"circle");const nn={id:"ctrlpointgrip_"+en,display:"none",r:4,fill:"#0FF",stroke:"#55F","stroke-width":1,cursor:"move",style:"pointer-events:all"},rn=Ta.getUIStrings();return"pathCtrlPtTooltip"in rn&&(nn["xlink:title"]=rn.pathCtrlPtTooltip),assignAttributes(tn,nn),getGripContainerMethod().append(tn),tn},getCtrlLineMethod=function(en){let tn=getElement("ctrlLine_"+en);return tn||(tn=document.createElementNS(ka.SVG,"line"),assignAttributes(tn,{id:"ctrlLine_"+en,stroke:"#555","stroke-width":1,style:"pointer-events:none"}),getGripContainerMethod().append(tn),tn)},getPointGripMethod=function(en,tn){const{index:nn}=en,rn=addPointGripMethod(nn);if(tn){const tn=getGripPtMethod(en);assignAttributes(rn,{cx:tn.x,cy:tn.y,display:"inline"})}return rn},getControlPointsMethod=function(en){const{item:tn,index:nn}=en;if(!("x1"in tn)||!("x2"in tn))return null;const rn={};getGripContainerMethod();const an=[Ta.getPathObj().segs[nn-1].item,tn];for(let sn=1;sn<3;sn++){const cn=nn+"c"+sn,An=rn["c"+sn+"_line"]=getCtrlLineMethod(cn),dn=getGripPtMethod(en,{x:tn["x"+sn],y:tn["y"+sn]}),un=getGripPtMethod(en,{x:an[sn-1].x,y:an[sn-1].y});assignAttributes(An,{x1:dn.x,y1:dn.y,x2:un.x,y2:un.y,display:"inline"}),rn["c"+sn+"_line"]=An;const pn=rn["c"+sn]=addCtrlGripMethod(cn);assignAttributes(pn,{cx:dn.x,cy:dn.y,display:"inline"}),rn["c"+sn]=pn}return rn},replacePathSegMethod=function(en,tn,nn,rn){const an=Ta.getPathObj(),sn=rn||an.elem,cn=sn["createSVGPathSeg"+Ta.getPathFuncs()[en]](...nn);sn.pathSegList.replaceItem(cn,tn)},getSegSelectorMethod=function(en,tn){const{index:nn}=en;let rn=getElement("segline_"+nn);if(!rn){const en=getGripContainerMethod();rn=document.createElementNS(ka.SVG,"path"),assignAttributes(rn,{id:"segline_"+nn,display:"none",fill:"none",stroke:"#0FF","stroke-width":2,style:"pointer-events:none",d:"M0,0 0,0"}),en.append(rn)}if(tn){const{prev:tn}=en;if(!tn)return rn.setAttribute("display","none"),rn;const nn=getGripPtMethod(tn);replacePathSegMethod(2,0,[nn.x,nn.y],rn);const an=ptObjToArrMethod(en.type,en.item);for(let tn=0;tn<an.length;tn+=2){const nn=getGripPtMethod(en,{x:an[tn],y:an[tn+1]});an[tn]=nn.x,an[tn+1]=nn.y}replacePathSegMethod(en.type,1,an,rn)}return rn};class Segment{constructor(en,tn){this.selected=!1,this.index=en,this.item=tn,this.type=tn.pathSegType,this.ctrlpts=[],this.ptgrip=null,this.segsel=null}showCtrlPts(en){for(const tn in this.ctrlpts)({}).hasOwnProperty.call(this.ctrlpts,tn)&&this.ctrlpts[tn].setAttribute("display",en?"inline":"none")}selectCtrls(en){document.getElementById("ctrlpointgrip_"+this.index+"c1").setAttribute("fill",en?"#0FF":"#E
/**
* Path functionality.
* @module path
* @license MIT
*
* @copyright 2011 Alexis Deveria, 2011 Jeff Schiller
*/let Fa=null,Ua=null;const convertPath$1=function(en,tn){const{pathSegList:nn}=en,rn=nn.numberOfItems;let an=0,sn=0,cn="",An=null;for(let en=0;en<rn;++en){const rn=nn.getItem(en);let dn=rn.x||0,un=rn.y||0,pn=rn.x1||0,hn=rn.y1||0,gn=rn.x2||0,_n=rn.y2||0,mn=rn.pathSegTypeAsLetter;switch(mn){case"z":case"Z":cn+="z",An&&!tn&&(an=An[0],sn=An[1]);break;case"H":dn-=an;case"h":tn?(un=0,an+=dn,mn="l"):(un=sn,dn+=an,an=dn,mn="L"),cn+=pathDSegment$1(mn,[[dn,un]]);break;case"V":un-=sn;case"v":tn?(dn=0,sn+=un,mn="l"):(dn=an,un+=sn,sn=un,mn="L"),cn+=pathDSegment$1(mn,[[dn,un]]);break;case"M":case"L":case"T":dn-=an,un-=sn;case"l":case"m":case"t":tn?(an+=dn,sn+=un,mn=mn.toLowerCase()):(dn+=an,un+=sn,an=dn,sn=un,mn=mn.toUpperCase()),"m"!==mn&&"M"!==mn||(An=[an,sn]),cn+=pathDSegment$1(mn,[[dn,un]]);break;case"C":dn-=an,pn-=an,gn-=an,un-=sn,hn-=sn,_n-=sn;case"c":tn?(an+=dn,sn+=un,mn="c"):(dn+=an,pn+=an,gn+=an,un+=sn,hn+=sn,_n+=sn,an=dn,sn=un,mn="C"),cn+=pathDSegment$1(mn,[[pn,hn],[gn,_n],[dn,un]]);break;case"Q":dn-=an,pn-=an,un-=sn,hn-=sn;case"q":tn?(an+=dn,sn+=un,mn="q"):(dn+=an,pn+=an,un+=sn,hn+=sn,an=dn,sn=un,mn="Q"),cn+=pathDSegment$1(mn,[[pn,hn],[dn,un]]);break;case"A":dn-=an,un-=sn;case"a":tn?(an+=dn,sn+=un,mn="a"):(dn+=an,un+=sn,an=dn,sn=un,mn="A"),cn+=pathDSegment$1(mn,[[rn.r1,rn.r2]],[rn.angle,rn.largeArcFlag?1:0,rn.sweepFlag?1:0],[dn,un]);break;case"S":dn-=an,gn-=an,un-=sn,_n-=sn;case"s":tn?(an+=dn,sn+=un,mn="s"):(dn+=an,gn+=an,un+=sn,_n+=sn,an=dn,sn=un,mn="S"),cn+=pathDSegment$1(mn,[[gn,_n],[dn,un]])}}return cn};function pathDSegment$1(en,tn,nn,rn){tn.forEach((function(en,nn){tn[nn]=shortFloat(en)}));let an=en+tn.join(" ");return nn&&(an+=" "+nn.join(" ")),rn&&(an+=" "+shortFloat(rn)),an}const Na=function(){let en,tn,nn=!1,rn=null,an=!1;return{mouseDown(tn,rn,an,sn){let cn,An;if("path"!==Fa.getCurrentMode()){if(Ua){if(Ua.storeD(),({id:cn}=tn.target),"pathpointgrip_"===cn.substr(0,14)){An=Ua.cur_pt=Number.parseInt(cn.substr(14)),Ua.dragging=[an,sn];const en=Ua.segs[An];tn.shiftKey?en.selected?Ua.removePtFromSelection(An):Ua.addPtsToSelection(An):((Ua.selected_pts.length<=1||!en.selected)&&Ua.clearSelection(),Ua.addPtsToSelection(An))}else if(cn.startsWith("ctrlpointgrip_")){Ua.dragging=[an,sn];const en=cn.split("_")[1].split("c");An=Number(en[0]);const tn=Number(en[1]);Ua.selectPt(An,tn)}if(!Ua.dragging){let en=Fa.getRubberBox();en||(en=Fa.setRubberBox(Fa.selectorManager.getRubberBandBox()));const tn=Fa.getZoom();assignAttributes(en,{x:an*tn,y:sn*tn,width:0,height:0,display:"inline"})}}}else{let rn=an,An=sn;const dn=Fa.getZoom();let un=rn/dn,pn=An/dn,hn=getElement("path_stretch_line");en=[un,pn],Fa.getGridSnapping()&&(un=snapToGrid(un),pn=snapToGrid(pn),rn=snapToGrid(rn),An=snapToGrid(An)),hn||(hn=document.createElementNS(ka.SVG,"path"),assignAttributes(hn,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"}),getElement("selectorParentGroup").append(hn)),hn.setAttribute("display","inline");let gn,_n=null;const mn=Fa.getDrawnPath();if(mn){const en=mn.pathSegList;let rn=en.numberOfItems;const an=6/dn;let sn=!1;for(;rn;){rn--;const tn=en.getItem(rn),nn=tn.x,cn=tn.y;if(un>=nn-an&&un<=nn+an&&pn>=cn-an&&pn<=cn+an){sn=!0;break}}cn=Fa.getId(),Fa.removePath_(cn);const An=getElement(cn);let fn,yn;const bn=en.numberOfItems;if(sn){if(rn<=1&&bn>=2){const tn=en.getItem(0).x,nn=en.getItem(0).y;yn=hn.pathSegList.getItem(1),fn=4===yn.pathSegType?mn.createSVGPathSegLinetoAbs(tn,nn):mn.createSVGPathSegCurvetoCubicAbs(tn,nn,yn.x1/dn,yn.y1/dn,tn,nn);const rn=mn.createSVGPathSegClosePath();en.appendItem(fn),en.appendItem(rn)}else if(bn<3)return _n=!1,_n;if(hn.remove(),Fa.setDrawnPath(null),Fa.setStarted(!1),nn){Ua.matrix&&Fa.remapElement(An,{},Ua.matrix.inverse());const en=An.getAttribute("d"),tn=Ua.elem.getAttribute("d");return Ua.elem.setAttribute("d",tn+en),An.parentNode.removeChild(An),Ua.matrix&&Fa.recalcRotatedPath(),Na.toEditMode(Ua.elem),Ua.selectPt(),!1}}else{if(Fa.getContainer()===Fa.getMouseTarget(tn)||!Fa.getContainer().contains(Fa.getMouseTarget(tn)))return!1;const en=mn.pathSegList.numberOfItems,rn=mn.pathSegList.
/**
* Path functionality.
* @module path
* @license MIT
*
* @copyright 2011 Alexis Deveria, 2011 Jeff Schiller
*/let Ma;const Ra={},setUiStrings=en=>{Object.assign(Ra,en.ui)};let Oa=[],Qa=!0,qa={};const setLinkControlPoints=en=>{Qa=en};let Va=null;const init$g=en=>{Ma=en,Ma.replacePathSeg=replacePathSegMethod,Ma.addPointGrip=addPointGripMethod,Ma.removePath_=removePath_,Ma.getPath_=getPath_,Ma.addCtrlGrip=addCtrlGripMethod,Ma.getCtrlLine=getCtrlLineMethod,Ma.getGripPt=Da,Ma.getPointFromGrip=getPointFromGripMethod,Ma.setLinkControlPoints=setLinkControlPoints,Ma.reorientGrads=reorientGrads,Ma.getSegData=()=>Ia,Ma.getUIStrings=()=>Ra,Ma.getPathObj=()=>Va,Ma.setPathObj=en=>{Va=en},Ma.getPathFuncs=()=>Oa,Ma.getLinkControlPts=()=>Qa,Oa=[0,"ClosePath"],["Moveto","Lineto","CurvetoCubic","CurvetoQuadratic","Arc","LinetoHorizontal","LinetoVertical","CurvetoCubicSmooth","CurvetoQuadraticSmooth"].forEach((en=>{Oa.push(en+"Abs"),Oa.push(en+"Rel")})),(en=>{Fa=en})(Ma),(en=>{Ta=en})(Ma)},Ga=ptObjToArrMethod,Da=getGripPtMethod,Ha=getPointFromGripMethod,za=addPointGripMethod,Ka=getGripContainerMethod,$a=addCtrlGripMethod,Wa=getCtrlLineMethod,Xa=getPointGripMethod,Ya=getControlPointsMethod,Za=replacePathSegMethod,Ja=getSegSelectorMethod,smoothControlPoints=(en,tn,nn)=>{const rn=en.x-nn.x,an=en.y-nn.y,sn=tn.x-nn.x,cn=tn.y-nn.y;if(!(0===rn&&0===an||0===sn&&0===cn)){const en=Math.sqrt(rn*rn+an*an),tn=Math.sqrt(sn*sn+cn*cn),An=Ma.getSvgRoot().createSVGPoint(),dn=Ma.getSvgRoot().createSVGPoint();let un=Math.atan2(an,rn),pn=Math.atan2(cn,sn);un<0&&(un+=2*Math.PI),pn<0&&(pn+=2*Math.PI);const hn=Math.abs(un-pn),gn=Math.abs(Math.PI-hn)/2;let _n,mn;return un-pn>0?(_n=hn<Math.PI?un+gn:un-gn,mn=hn<Math.PI?pn-gn:pn+gn):(_n=hn<Math.PI?un-gn:un+gn,mn=hn<Math.PI?pn+gn:pn-gn),An.x=en*Math.cos(_n)+nn.x,An.y=en*Math.sin(_n)+nn.y,dn.x=tn*Math.cos(mn)+nn.x,dn.y=tn*Math.sin(mn)+nn.y,[An,dn]}},getPath_=en=>{let tn=qa[en.id];return tn||(tn=qa[en.id]=new Path$1(en)),tn},removePath_=en=>{en in qa&&delete qa[en]};let es,ts,ns,rs,os;const getRotVals=(en,tn)=>{let nn=en-ns,rn=tn-rs,an=Math.sqrt(nn*nn+rn*rn),sn=Math.atan2(rn,nn)+os;return nn=an*Math.cos(sn)+ns,rn=an*Math.sin(sn)+rs,nn-=es,rn-=ts,an=Math.sqrt(nn*nn+rn*rn),sn=Math.atan2(rn,nn)-os,{x:an*Math.cos(sn)+es,y:an*Math.sin(sn)+ts}},clearData=()=>{qa={}},reorientGrads=(en,tn)=>{const nn=getBBox(en);for(let rn=0;rn<2;rn++){const an=0===rn?"fill":"stroke",sn=en.getAttribute(an);if(sn&&sn.startsWith("url(")){const rn=getRefElem(sn);if("linearGradient"===rn.tagName){let sn=rn.getAttribute("x1")||0,cn=rn.getAttribute("y1")||0,An=rn.getAttribute("x2")||1,dn=rn.getAttribute("y2")||0;sn=nn.width*sn+nn.x,cn=nn.height*cn+nn.y,An=nn.width*An+nn.x,dn=nn.height*dn+nn.y;const un=transformPoint(sn,cn,tn),pn=transformPoint(An,dn,tn),hn={x1:(un.x-nn.x)/nn.width,y1:(un.y-nn.y)/nn.height,x2:(pn.x-nn.x)/nn.width,y2:(pn.y-nn.y)/nn.height},gn=rn.cloneNode(!0);for(const[en,tn]of Object.entries(hn))gn.setAttribute(en,tn);gn.id=Ma.getNextId(),findDefs().append(gn),en.setAttribute(an,"url(#"+gn.id+")")}}}},is=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],pathDSegment=(en,tn,nn,rn)=>{tn.forEach(((en,nn)=>{tn[nn]=shortFloat(en)}));let an=en+tn.join(" ");return nn&&(an+=" "+nn.join(" ")),rn&&(an+=" "+shortFloat(rn)),an},as=Na;var ss=Object.freeze({__proto__:null,setUiStrings:setUiStrings,setLinkControlPoints:setLinkControlPoints,get path(){return Va},init:init$g,ptObjToArr:Ga,getGripPt:Da,getPointFromGrip:Ha,addPointGrip:za,getGripContainer:Ka,addCtrlGrip:$a,getCtrlLine:Wa,getPointGrip:Xa,getControlPoints:Ya,replacePathSeg:Za,getSegSelector:Ja,smoothControlPoints:smoothControlPoints,getPath_:getPath_,removePath_:removePath_,recalcRotatedPath:()=>{const en=Va.elem;if(os=getRotationAngle(en,!0),!os)return;const tn=Va.oldbbox;ns=tn.x+tn.width/2,rs=tn.y+tn.height/2;const nn=getBBox(en);es=nn.x+nn.width/2,ts=nn.y+nn.height/2;const rn=es-ns,an=ts-rs,sn=Math.sqrt(rn*rn+an*an),cn=Math.atan2(an,rn)+os;es=sn*Math.cos(cn)+ns,ts=sn*Math.sin(cn)+rs;const An=en.pathSegList;let dn=An.numberOfItems;for(;dn;){dn-=1;const en=An.getItem(dn),tn=en.pathSegType;if(1===tn)continue;const nn=getRotVals(en.x,en.y),rn=[nn.x,nn.y];if(en.x1
/**
* Provides tools for the layer concept.
* @module layer
* @license MIT
*
* @copyright 2011 Jeff Schiller, 2016 Flint O'Brien
*/class Layer{constructor(en,tn,nn){if(this.name_=en,this.group_=nn?null:tn,nn){const rn=nn.ownerDocument;this.group_=rn.createElementNS(ka.SVG,"g");const an=rn.createElementNS(ka.SVG,"title");an.textContent=en,this.group_.append(an),tn?tn.insertAdjacentElement("afterend",this.group_):nn.append(this.group_)}!function addLayerClass(en){const tn=en.getAttribute("class");tn&&tn.length?Layer.CLASS_REGEX.test(tn)||en.setAttribute("class",tn+" "+Layer.CLASS_NAME):en.setAttribute("class",Layer.CLASS_NAME)}
/**
* HistoryRecordingService component of history.
* @module history
* @license MIT
* @copyright 2016 Flint O'Brien
*/(this.group_),walkTree(this.group_,(function(en){en.setAttribute("style","pointer-events:inherit")})),this.group_.setAttribute("style",nn?"pointer-events:all":"pointer-events:none")}getName(){return this.name_}getGroup(){return this.group_}activate(){this.group_.setAttribute("style","pointer-events:all")}deactivate(){this.group_.setAttribute("style","pointer-events:none")}setVisible(en){const tn=void 0===en||en?"inline":"none";this.group_.getAttribute("display")!==tn&&this.group_.setAttribute("display",tn)}isVisible(){return"none"!==this.group_.getAttribute("display")}getOpacity(){const en=this.group_.getAttribute("opacity");return en?Number.parseFloat(en):1}setOpacity(en){"number"==typeof en&&en>=0&&en<=1&&this.group_.setAttribute("opacity",en)}appendChildren(en){for(const tn of en)this.group_.append(tn)}getTitleElement(){const en=this.group_.childNodes.length;for(let tn=0;tn<en;++tn){const en=this.group_.childNodes.item(tn);if("title"===(null==en?void 0:en.tagName))return en}return null}setName(en,tn){const nn=this.name_;en=toXml(en);const rn=this.getTitleElement();if(rn){for(;rn.firstChild;)rn.removeChild(rn.firstChild);return rn.textContent=en,this.name_=en,tn&&tn.changeElement(rn,{"#text":nn}),this.name_}return null}removeGroup(){const en=this.group_;return this.group_.remove(),this.group_=void 0,en}static isLayer(en){return en&&"g"===en.tagName&&Layer.CLASS_REGEX.test(en.getAttribute("class"))}}Layer.CLASS_NAME="layer",Layer.CLASS_REGEX=new RegExp("(\\s|^)"+Layer.CLASS_NAME+"(\\s|$)");class HistoryRecordingService{constructor(en){this.undoManager_=en,this.currentBatchCommand_=null,this.batchCommandStack_=[]}startBatchCommand(en){return this.undoManager_?(this.currentBatchCommand_=new BatchCommand$4(en),this.batchCommandStack_.push(this.currentBatchCommand_),this):this}endBatchCommand(){if(!this.undoManager_)return this;if(this.currentBatchCommand_){const en=this.currentBatchCommand_;this.batchCommandStack_.pop();const{length:tn}=this.batchCommandStack_;this.currentBatchCommand_=tn?this.batchCommandStack_[tn-1]:null,this.addCommand_(en)}return this}moveElement(en,tn,nn,rn){return this.undoManager_?(this.addCommand_(new MoveElementCommand$1(en,tn,nn,rn)),this):this}insertElement(en,tn){return this.undoManager_?(this.addCommand_(new InsertElementCommand$4(en,tn)),this):this}removeElement(en,tn,nn,rn){return this.undoManager_?(this.addCommand_(new RemoveElementCommand$2(en,tn,nn,rn)),this):this}changeElement(en,tn,nn){return this.undoManager_?(this.addCommand_(new ChangeElementCommand$2(en,tn,nn)),this):this}addCommand_(en){if(!this.undoManager_)return this;this.currentBatchCommand_?this.currentBatchCommand_.addSubCommand(en):this.undoManager_.addCommandToHistory(en)}}HistoryRecordingService.NO_HISTORY=new HistoryRecordingService;const copyElem=function(en,tn){const nn=document.createElementNS(en.namespaceURI,en.nodeName);if(Object.values(en.attributes).forEach((en=>{nn.setAttributeNS(en.namespaceURI,en.nodeName,en.value)})),nn.removeAttribute("id"),nn.id=tn(),en.childNodes.forEach((function(en){switch(en.nodeType){case 1:nn.append(copyElem(en,tn));break;case 3:nn.textContent=en.nodeValue}})),en.dataset.gsvg)nn.dataset.gsvg=nn.firstChild;else if(en.dataset.symbol){const tn=en.dataset.symbol;nn.dataset.ref=tn,nn.dataset.symbol=tn}else"image"===nn.tagName&&preventClickDefault(nn);return nn},ls="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(",");
/**
* Tools for drawing.
* @module draw
* @license MIT
* @copyright 2011 Jeff Schiller
*/let cs=0,As=[];function historyRecordingService(en){return en||new HistoryRecordingService(ds.undoMgr)}function findLayerNameInGroup(en){const tn=en.querySelector("title");return tn?tn.textContent:""}function getNewLayerName(en){let tn=1;for(;en.includes("Layer "+tn);)tn++;return"Layer "+tn}class Drawing{constructor(en,tn){if(!en||!en.tagName||!en.namespaceURI||"svg"!==en.tagName||en.namespaceURI!==ka.SVG)throw new Error("Error: svgedit.draw.Drawing instance initialized without a <svg> element");this.svgElem_=en,this.obj_num=0,this.idPrefix=tn||"svg_",this.releasedNums=[],this.all_layers=[],this.layer_map={},this.current_layer=null,this.nonce_="";const nn=this.svgElem_.getAttributeNS(ka.SE,"nonce");nn&&2!==cs?this.nonce_=nn:1===cs&&this.setNonce(Math.floor(100001*Math.random()))}getElem_(en){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+en):this.svgElem_.querySelector("[id="+en+"]")}getSvgElem(){return this.svgElem_}getNonce(){return this.nonce_}setNonce(en){this.svgElem_.setAttributeNS(ka.XMLNS,"xmlns:se",ka.SE),this.svgElem_.setAttributeNS(ka.SE,"se:nonce",en),this.nonce_=en}clearNonce(){this.nonce_=""}getId(){return this.nonce_?this.idPrefix+this.nonce_+"_"+this.obj_num:this.idPrefix+this.obj_num}getNextId(){const en=this.obj_num;let tn=!1;this.releasedNums.length>0?(this.obj_num=this.releasedNums.pop(),tn=!0):this.obj_num++;let nn=this.getId();for(;this.getElem_(nn);)tn&&(this.obj_num=en,tn=!1),this.obj_num++,nn=this.getId();return tn&&(this.obj_num=en),nn}releaseId(en){const tn=this.idPrefix+(this.nonce_?this.nonce_+"_":"");if("string"!=typeof en||!en.startsWith(tn))return!1;const nn=Number.parseInt(en.substr(tn.length));return!("number"!=typeof nn||nn<=0||this.releasedNums.includes(nn)||(this.releasedNums.push(nn),0))}getNumLayers(){return this.all_layers.length}hasLayer(en){return void 0!==this.layer_map[en]}getLayerName(en){return en>=0&&en<this.getNumLayers()?this.all_layers[en].getName():""}getCurrentLayer(){return this.current_layer?this.current_layer.getGroup():null}getLayerByName(en){const tn=this.layer_map[en];return tn?tn.getGroup():null}getCurrentLayerName(){return this.current_layer?this.current_layer.getName():""}setCurrentLayerName(en,tn){let nn=null;if(this.current_layer){const rn=this.current_layer.getName();nn=this.current_layer.setName(en,tn),nn&&(delete this.layer_map[rn],this.layer_map[nn]=this.current_layer)}return nn}setCurrentLayerPosition(en){const tn=this.getNumLayers();if(!this.current_layer||en<0||en>=tn)return null;const nn=this.indexCurrentLayer();if(-1===nn||nn===en)return null;const rn=this.current_layer.getGroup(),an=rn.nextSibling;let sn=null;return en>nn?en<tn-1&&(sn=this.all_layers[en+1].getGroup()):sn=this.all_layers[en].getGroup(),this.svgElem_.insertBefore(rn,sn),this.identifyLayers(),this.setCurrentLayer(this.getLayerName(en)),{currentGroup:rn,oldNextSibling:an}}mergeLayer(en){const tn=this.current_layer.getGroup(),nn=tn.previousElementSibling;if(!nn)return;en.startBatchCommand("Merge Layer");const rn=tn.nextSibling;for(en.removeElement(tn,rn,this.svgElem_);tn.firstChild;){const rn=tn.firstChild;if("title"===rn.localName){en.removeElement(rn,rn.nextSibling,tn),rn.remove();continue}const an=rn.nextSibling;nn.append(rn),en.moveElement(rn,an,tn)}this.current_layer.removeGroup();const an=this.indexCurrentLayer();if(an>0){const en=this.current_layer.getName();this.current_layer=this.all_layers[an-1],this.all_layers.splice(an,1),delete this.layer_map[en]}en.endBatchCommand()}mergeAllLayers(en){for(this.current_layer=this.all_layers[this.all_layers.length-1],en.startBatchCommand("Merge all Layers");this.all_layers.length>1;)this.mergeLayer(en);en.endBatchCommand()}setCurrentLayer(en){const tn=this.layer_map[en];return!!tn&&(this.current_layer&&this.current_layer.deactivate(),this.current_layer=tn,this.current_layer.activate(),!0)}indexCurrentLayer(){return this.all_layers.indexOf(this.current_layer)}deleteCurrentLayer(){if(this.current_layer&&this.getNumLayers()>1){const en=this.current_layer.removeGroup();return this.identifyLayers(),en}return null}identify
/**
* @module text-actions Tools for Text edit functions
* @license MIT
*
* @copyright 2010 Alexis Deveria, 2010 Jeff Schiller
*/let js=null;const Ls=function(){let en,tn,nn,rn,an,sn,cn,An,dn,un,pn=[];function setCursor(en){const cn=""===tn.value;if(tn.focus(),!arguments.length)if(cn)en=0;else{if(tn.selectionEnd!==tn.selectionStart)return;en=tn.selectionEnd}const An=pn[en];cn||tn.setSelectionRange(en,en),nn=getElement("text_cursor"),nn||(nn=document.createElementNS(ka.SVG,"line"),assignAttributes(nn,{id:"text_cursor",stroke:"#333","stroke-width":1}),getElement("selectorParentGroup").append(nn)),an||(an=setInterval((function(){const en="none"===nn.getAttribute("display");nn.setAttribute("display",en?"inline":"none")}),600));const dn=ptToScreen(An.x,sn.y),un=ptToScreen(An.x,sn.y+sn.height);assignAttributes(nn,{x1:dn.x,y1:dn.y,x2:un.x,y2:un.y,visibility:"visible",display:"inline"}),rn&&rn.setAttribute("d","")}function setSelection(en,an,cn){if(en===an)return void setCursor(an);cn||tn.setSelectionRange(en,an),rn=getElement("text_selectblock"),rn||(rn=document.createElementNS(ka.SVG,"path"),assignAttributes(rn,{id:"text_selectblock",fill:"green",opacity:.5,style:"pointer-events:none"}),getElement("selectorParentGroup").append(rn));const An=pn[en],dn=pn[an];nn.setAttribute("visibility","hidden");const un=ptToScreen(An.x,sn.y),hn=ptToScreen(An.x+(dn.x-An.x),sn.y),gn=ptToScreen(An.x,sn.y+sn.height),_n=ptToScreen(An.x+(dn.x-An.x),sn.y+sn.height),mn="M"+un.x+","+un.y+" L"+hn.x+","+hn.y+" "+_n.x+","+_n.y+" "+gn.x+","+gn.y+"z";assignAttributes(rn,{d:mn,display:"inline"})}function getIndexFromPoint(tn,nn){const rn=js.getSvgRoot().createSVGPoint();if(rn.x=tn,rn.y=nn,1===pn.length)return 0;let an=en.getCharNumAtPosition(rn);an<0?(an=pn.length-2,tn<=pn[0].x&&(an=0)):an>=pn.length-2&&(an=pn.length-2);const sn=pn[an];return tn>sn.x+sn.width/2&&an++,an}function setCursorFromPoint(en,tn){setCursor(getIndexFromPoint(en,tn))}function setEndSelectionFromPoint(en,nn,rn){const an=tn.selectionStart,sn=getIndexFromPoint(en,nn);setSelection(Math.min(an,sn),Math.max(an,sn),!rn)}function screenToPt(en,tn){const nn={x:en,y:tn},rn=js.getZoom();if(nn.x/=rn,nn.y/=rn,cn){const en=transformPoint(nn.x,nn.y,cn.inverse());nn.x=en.x,nn.y=en.y}return nn}function ptToScreen(en,tn){const nn={x:en,y:tn};if(cn){const en=transformPoint(nn.x,nn.y,cn);nn.x=en.x,nn.y=en.y}const rn=js.getZoom();return nn.x*=rn,nn.y*=rn,nn}function selectAll(tn){setSelection(0,en.textContent.length),tn.target.removeEventListener("click",selectAll)}function selectWord(tn){if(!un||!en)return;const nn=js.getZoom(),rn=transformPoint(tn.pageX,tn.pageY,js.getrootSctm()),an=screenToPt(rn.x*nn,rn.y*nn),sn=getIndexFromPoint(an.x,an.y),cn=en.textContent,An=cn.substr(0,sn).replace(/[a-z\d]+$/i,"").length,dn=cn.substr(sn).match(/^[a-z\d]+/i);setSelection(An,(dn?dn[0].length:0)+sn),js.$click(tn.target,selectAll),setTimeout((function(){tn.target.removeEventListener("click",selectAll)}),300)}return{select(tn,nn,rn){en=tn,js.textActions.toEditMode(nn,rn)},start(tn){en=tn,js.textActions.toEditMode()},mouseDown(en,nn,rn,an){const sn=screenToPt(rn,an);tn.focus(),setCursorFromPoint(sn.x,sn.y),An=rn,dn=an},mouseMove(en,tn){const nn=screenToPt(en,tn);setEndSelectionFromPoint(nn.x,nn.y)},mouseUp(tn,nn,rn){const an=screenToPt(nn,rn);setEndSelectionFromPoint(an.x,an.y,!0),tn.target!==en&&nn<An+2&&nn>An-2&&rn<dn+2&&rn>dn-2&&js.textActions.toSelectMode(!0)},setCursor:setCursor,toEditMode(tn,nn){if(un=!1,js.setCurrentMode("textedit"),js.selectorManager.requestSelector(en).showGrips(!1),js.selectorManager.requestSelector(en),js.textActions.init(),en.style.cursor="text",arguments.length){const en=screenToPt(tn,nn);setCursorFromPoint(en.x,en.y)}else setCursor();setTimeout((function(){un=!0}),300)},toSelectMode(sn){var cn;js.setCurrentMode("select"),clearInterval(an),an=null,rn&&rn.setAttribute("display","none"),nn&&nn.setAttribute("visibility","hidden"),en.style.cursor="move",sn&&(js.clearSelection(),en.style.cursor="move",js.call("selected",[en]),js.addToSelection([en],!0)),null!==(cn=en)&&void 0!==cn&&cn.textContent.length||js.deleteSelectedElements(),tn.blur(),en=!1},setInputElem(en){tn=en},clear(){"textedit"===js.getCurrentMode()&&js.
/**
* Tools for SVG handle on JSON format.
* @module svgcanvas
* @license MIT
*
* @copyright 2010 Alexis Deveria, 2010 Jeff Schiller
*/let Ns=null,Is=null;const getJsonFromSvgElements=en=>{if(3===en.nodeType)return en.nodeValue;const tn={element:en.tagName,attr:{},children:[]};for(let nn,rn=0;nn=en.attributes[rn];rn++)tn.attr[nn.name]=nn.value;for(let nn,rn=0;nn=en.childNodes[rn];rn++)tn.children[rn]=getJsonFromSvgElements(nn);return tn},addSVGElementsFromJson=en=>{if("string"==typeof en)return Is.createTextNode(en);let tn=getElement(en.attr.id);const nn=Ns.getDrawing().getCurrentLayer();if(tn&&en.element!==tn.tagName&&(tn.remove(),tn=null),!tn){const rn=en.namespace||ka.SVG;tn=Is.createElementNS(rn,en.element),nn&&(Ns.getCurrentGroup()||nn).append(tn)}const rn=Ns.getCurShape();return en.curStyles&&assignAttributes(tn,{fill:rn.fill,stroke:rn.stroke,"stroke-width":rn.strokeWidth,"stroke-dasharray":rn.stroke_dasharray,"stroke-linejoin":rn.stroke_linejoin,"stroke-linecap":rn.stroke_linecap,"stroke-opacity":rn.stroke_opacity,"fill-opacity":rn.fill_opacity,opacity:rn.opacity/2,style:"pointer-events:inherit"}),assignAttributes(tn,en.attr),cleanupElement(tn),en.children&&en.children.forEach((en=>{tn.append(addSVGElementsFromJson(en))})),tn};
/**
* @module elem-get-set get and set methods.
* @license MIT
* @copyright 2011 Jeff Schiller
*/let Ms=null;const getResolutionMethod=()=>{const en=Ms.getZoom();return{w:Ms.getSvgContent().getAttribute("width")/en,h:Ms.getSvgContent().getAttribute("height")/en,zoom:en}},getTitleMethod=en=>{const tn=Ms.getSelectedElements(),nn=Ms.getDataStorage();if(!(en=en||tn[0]))return;nn.has(en,"gsvg")?en=nn.get(en,"gsvg"):nn.has(en,"symbol")&&(en=nn.get(en,"symbol"));const rn=en.childNodes;for(const en of rn)if("title"===en.nodeName)return en.textContent;return""},setGroupTitleMethod=en=>{const{InsertElementCommand:tn,RemoveElementCommand:nn,ChangeElementCommand:rn,BatchCommand:an}=Ms.history,sn=Ms.getSelectedElements(),cn=Ms.getDataStorage();let An=sn[0];cn.has(An,"gsvg")&&(An=cn.get(An,"gsvg"));const dn=An.querySelectorAll("title"),un=new an("Set Label");let pn;if(0===en.length){const en=dn.nextSibling;un.addSubCommand(new nn(dn[0],en,An)),dn.remove()}else dn.length?(pn=dn[0],un.addSubCommand(new rn(pn,{"#text":pn.textContent})),pn.textContent=en):(pn=Ms.getDOMDocument().createElementNS(ka.SVG,"title"),pn.textContent=en,An.insertBefore(pn,An.firstChild),un.addSubCommand(new tn(pn)));Ms.addCommandToHistory(un)},setDocumentTitleMethod=en=>{const{ChangeElementCommand:tn,BatchCommand:nn}=Ms.history,rn=Ms.getSvgContent().childNodes;let an=!1,sn="";const cn=new nn("Change Image Title");for(const en of rn)if("title"===en.nodeName){an=en,sn=an.textContent;break}an||(an=Ms.getDOMDocument().createElementNS(ka.SVG,"title"),Ms.getSvgContent().insertBefore(an,Ms.getSvgContent().firstChild)),en.length?an.textContent=en:an.remove(),cn.addSubCommand(new tn(an,{"#text":sn})),Ms.addCommandToHistory(cn)},setResolutionMethod=(en,tn)=>{const{ChangeElementCommand:nn,BatchCommand:rn}=Ms.history,an=Ms.getZoom(),sn=Ms.getResolution(),{w:cn,h:An}=sn;let dn;if("fit"===en){const nn=getStrokedBBoxDefaultVisible();if(!nn)return!1;{dn=new rn("Fit Canvas to Content");const an=getVisibleElements();Ms.addToSelection(an);const sn=[],cn=[];an.forEach(((en,tn)=>{sn.push(-1*nn.x),cn.push(-1*nn.y)}));const An=Ms.moveSelectedElements(sn,cn,!0);dn.addSubCommand(An),Ms.clearSelection(),en=Math.round(nn.width),tn=Math.round(nn.height)}}return en===cn&&tn===An||(dn||(dn=new rn("Change Image Dimensions")),en=convertToNum("width",en),tn=convertToNum("height",tn),Ms.getSvgContent().setAttribute("width",en),Ms.getSvgContent().setAttribute("height",tn),Ms.contentW=en,Ms.contentH=tn,dn.addSubCommand(new nn(Ms.getSvgContent(),{width:cn,height:An})),Ms.getSvgContent().setAttribute("viewBox",[0,0,en/an,tn/an].join(" ")),dn.addSubCommand(new nn(Ms.getSvgContent(),{viewBox:["0 0",cn,An].join(" ")})),Ms.addCommandToHistory(dn),Ms.call("changed",[Ms.getSvgContent()])),!0},getEditorNSMethod=en=>(en&&Ms.getSvgContent().setAttribute("xmlns:se",ka.SE),ka.SE),setBBoxZoomMethod=(en,tn,nn)=>{const rn=Ms.getZoom(),an=Ms.getSelectedElements();let sn,cn=.85;const calcZoom=en=>{if(!en)return!1;const rn=Math.round(tn/en.width*100*cn)/100,an=Math.round(nn/en.height*100*cn)/100,sn=Math.min(rn,an);return Ms.setZoom(sn),{zoom:sn,bbox:en}};if("object"==typeof en){if(sn=en,0===sn.width||0===sn.height){const en=sn.zoom?sn.zoom:rn*sn.factor;return Ms.setZoom(en),{zoom:rn,bbox:sn}}return calcZoom(sn)}switch(en){case"selection":{if(!an[0])return;const en=an.map(((en,tn)=>{if(en)return en}));sn=getStrokedBBoxDefaultVisible(en);break}case"canvas":{const en=Ms.getResolution();cn=.95,sn={width:en.w,height:en.h,x:0,y:0};break}case"content":sn=getStrokedBBoxDefaultVisible();break;case"layer":sn=getStrokedBBoxDefaultVisible(getVisibleElements(Ms.getCurrentDrawing().getCurrentLayer()));break;default:return}return calcZoom(sn)},setZoomMethod=en=>{const tn=Ms.getSelectedElements(),nn=Ms.getResolution();Ms.getSvgContent().setAttribute("viewBox","0 0 "+nn.w/en+" "+nn.h/en),Ms.setZoom(en),tn.forEach((en=>{en&&Ms.selectorManager.requestSelector(en).resize()})),Ms.pathActions.zoomChange(),Ms.runExtensions("zoomChanged",en)},setColorMethod=(en,tn,nn)=>{const rn=Ms.getSelectedElements();Ms.setCurShape(en,tn),Ms.setCurProperties(en+"_paint",{type:"solidColor"});const an=[],addNonG=en=>{"g"!==en.nodeName&&an.push(en
/**
* Recalculate.
* @module recalculate
* @license MIT
*/let Qs;const updateClipPath=(en,tn,nn)=>{const rn=getRefElem(en).firstChild,an=rn.transform.baseVal,sn=Qs.getSvgRoot().createSVGTransform();sn.setTranslate(tn,nn),an.appendItem(sn),recalculateDimensions(rn)},recalculateDimensions=en=>{var tn;if(!en)return null;const nn=Qs.getSvgRoot(),rn=Qs.getDataStorage(),an=null===(tn=en.transform)||void 0===tn?void 0:tn.baseVal;if((null==an?void 0:an.numberOfItems)>0){let tn=an.numberOfItems;const nn=tn;for(;tn--;){const rn=an.getItem(tn);if(0===rn.type)an.removeItem(tn);else if(1===rn.type){if(isIdentity(rn.matrix)){if(1===nn)return en.removeAttribute("transform"),null;an.removeItem(tn)}}else 4===rn.type&&0===rn.angle&&an.removeItem(tn)}if(1===an.numberOfItems&&getRotationAngle(en))return null}if(!an||0===an.numberOfItems)return en.setAttribute("transform",""),en.removeAttribute("transform"),null;if(an){let en=[],tn=an.numberOfItems;for(;tn--;){const nn=an.getItem(tn);1===nn.type?en.push([nn.matrix,tn]):en.length&&(en=[])}if(2===en.length){const tn=nn.createSVGTransformFromMatrix(matrixMultiply(en[1][0],en[0][0]));an.removeItem(en[0][1]),an.removeItem(en[1][1]),an.insertItemBefore(tn,en[1][1])}if(tn=an.numberOfItems,tn>=2&&1===an.getItem(tn-2).type&&2===an.getItem(tn-1).type){const en=nn.createSVGTransform(),rn=matrixMultiply(an.getItem(tn-2).matrix,an.getItem(tn-1).matrix);en.setMatrix(rn),an.removeItem(tn-2),an.removeItem(tn-2),an.appendItem(en)}}switch(en.tagName){case"line":case"polyline":case"polygon":case"path":break;default:if(1===an.numberOfItems&&1===an.getItem(0).type||2===an.numberOfItems&&1===an.getItem(0).type&&4===an.getItem(0).type)return null}const sn=rn.has(en,"gsvg")?rn.get(en,"gsvg"):void 0,cn=new BatchCommand$4("Transform");let An,dn,un={},pn=null,hn=[];switch(en.tagName){case"line":hn=["x1","y1","x2","y2"];break;case"circle":hn=["cx","cy","r"];break;case"ellipse":hn=["cx","cy","rx","ry"];break;case"foreignObject":case"rect":case"image":hn=["width","height","x","y"];break;case"use":case"text":case"tspan":hn=["x","y"];break;case"polygon":case"polyline":{pn={},pn.points=en.getAttribute("points");const tn=en.points,nn=tn.numberOfItems;un.points=new Array(nn);for(let en=0;en<nn;++en){const nn=tn.getItem(en);un.points[en]={x:nn.x,y:nn.y}}break}case"path":pn={},pn.d=en.getAttribute("d"),un.d=en.getAttribute("d")}if(hn.length?hn.forEach((tn=>{un[tn]=convertToNum(tn,en.getAttribute(tn))})):sn&&(un={x:Number(sn.getAttribute("x"))||0,y:Number(sn.getAttribute("y"))||0}),!pn){pn=mergeDeep$1({},un);for(const[en,tn]of Object.entries(pn))pn[en]=convertToNum(en,tn)}if(pn.transform=Qs.getStartTransform()||"","g"===en.tagName&&!sn||"a"===en.tagName){const tn=getBBox(en);An={x:tn.x+tn.width/2,y:tn.y+tn.height/2},dn=transformPoint(tn.x+tn.width/2,tn.y+tn.height/2,transformListToTransform(an).matrix);const rn=getRotationAngle(en);if(rn){const en=rn*Math.PI/180,tn=Math.abs(en)>1e-10?Math.sin(en)/(1-Math.cos(en)):2/en;for(let en=0;en<an.numberOfItems;++en){const nn=an.getItem(en);if(4===nn.type){const rn=nn.matrix;An.y=(tn*rn.e+rn.f)/2,An.x=(rn.e-tn*rn.f)/2,an.removeItem(en);break}}}const sn=an.numberOfItems;let un,pn,hn=0,fn=0,yn=0;if(sn&&(un=an.getItem(0).matrix),sn>=3&&3===an.getItem(sn-2).type&&2===an.getItem(sn-3).type&&2===an.getItem(sn-1).type){yn=3;const tn=an.getItem(sn-3).matrix,rn=an.getItem(sn-2).matrix,An=an.getItem(sn-1).matrix,dn=en.childNodes;let un=dn.length;for(;un--;){const en=dn.item(un);if(hn=0,fn=0,1===en.nodeType){const an=en.transform.baseVal;if(!an)continue;const sn=transformListToTransform(an).matrix,dn=getRotationAngle(en);if(pn=Qs.getStartTransform(),Qs.setStartTransform(en.getAttribute("transform")),dn||hasMatrixTransform(an)){const en=nn.createSVGTransform();en.setMatrix(matrixMultiply(tn,rn,An,sn)),an.clear(),an.appendItem(en)}else{const en=matrixMultiply(sn.inverse(),An,sn),cn=nn.createSVGMatrix();cn.e=-en.e,cn.f=-en.f;const dn=matrixMultiply(cn.inverse(),sn.inverse(),tn,rn,An,sn,en.inverse()),un=nn.createSVGTransform(),pn=nn.createSVGTransform(),hn=nn.createSVGTransform();un.setTranslate(en.e,en.f),pn.setScale(dn.a,dn.d),hn.setTranslate(cn.e,cn.f)
/**
* Tools for blur event.
* @module blur
* @license MIT
* @copyright 2011 Jeff Schiller
*/let $s=null;const setBlurNoUndo=function(en){const tn=$s.getSelectedElements();if($s.getFilter())if(0===en)$s.changeSelectedAttributeNoUndo("filter",""),$s.setFilterHidden(!0);else{const nn=tn[0];$s.getFilterHidden()&&$s.changeSelectedAttributeNoUndo("filter","url(#"+nn.id+"_blur)");const rn=$s.getFilter();$s.changeSelectedAttributeNoUndo("stdDeviation",en,[rn.firstChild]),$s.setBlurOffsets(rn,en)}else $s.setBlur(en)};function finishChange(){const en=$s.undoMgr.finishUndoableChange();$s.getCurCommand().addSubCommand(en),$s.addCommandToHistory($s.getCurCommand()),$s.setCurCommand(null),$s.setFilter(null)}const setBlurOffsets=function(en,tn){tn>3?$s.assignAttributes(en,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100):(en.removeAttribute("x"),en.removeAttribute("y"),en.removeAttribute("width"),en.removeAttribute("height"))},setBlur=function(en,tn){const{InsertElementCommand:nn,ChangeElementCommand:rn,BatchCommand:an}=$s.history,sn=$s.getSelectedElements();if($s.getCurCommand())return void finishChange();const cn=sn[0],An=cn.id;$s.setFilter($s.getElement(An+"_blur")),en-=0;const dn=new an;if($s.getFilter())0===en&&$s.setFilter(null);else{const tn=$s.addSVGElementsFromJson({element:"feGaussianBlur",attr:{in:"SourceGraphic",stdDeviation:en}});$s.setFilter($s.addSVGElementsFromJson({element:"filter",attr:{id:An+"_blur"}})),$s.getFilter().append(tn),$s.findDefs().append($s.getFilter()),dn.addSubCommand(new nn($s.getFilter()))}const un={filter:cn.getAttribute("filter")};if(0===en)return cn.removeAttribute("filter"),void dn.addSubCommand(new rn(cn,un));$s.changeSelectedAttribute("filter","url(#"+An+"_blur)"),dn.addSubCommand(new rn(cn,un)),$s.setBlurOffsets($s.getFilter(),en);const pn=$s.getFilter();$s.setCurCommand(dn),$s.undoMgr.beginUndoableChange("stdDeviation",[pn?pn.firstChild:null]),tn&&($s.setBlurNoUndo(en),finishChange())},Ws=getReverseNS(),Xs=["class","id","display","transform","style"],Ys={a:["clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","mask","opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage","xlink:href","xlink:title"],circle:["clip-path","clip-rule","cx","cy","enable-background","fill","fill-opacity","fill-rule","filter","mask","opacity","r","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage"],clipPath:["clipPathUnits"],defs:[],desc:[],ellipse:["clip-path","clip-rule","cx","cy","fill","fill-opacity","fill-rule","filter","mask","opacity","requiredFeatures","rx","ry","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage"],feBlend:["in","in2"],feColorMatrix:["in","type","value","result","values"],feComposite:["in","operator","result","in2"],feFlood:["flood-color","in","result","flood-opacity"],feGaussianBlur:["color-interpolation-filters","in","requiredFeatures","stdDeviation","result"],feMerge:[],feMergeNode:["in"],feMorphology:["in","operator","radius"],feOffset:["dx","in","dy","result"],filter:["color-interpolation-filters","filterRes","filterUnits","height","primitiveUnits","requiredFeatures","width","x","xlink:href","y"],foreignObject:["font-size","height","opacity","requiredFeatures","width","x","y"],g:["clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage","font-family","font-size","font-style","font-weight","text-anchor"],image:["clip-path","clip-rule","filter","height","mask","opacity","requiredFeatures","systemLanguage","width","x","xlink:href","xlink:title","y"],line:["clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","marker-end","marker-mid","marker-start","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stro
/** @license
*
* jsPDF - PDF Document creation from JavaScript
* Version 2.5.1 Built on 2022-01-28T15:37:57.791Z
* CommitID 00000000
*
* Copyright (c) 2010-2021 James Hall <james@parall.ax>, https://github.com/MrRio/jsPDF
* 2015-2021 yWorks GmbH, http://www.yworks.com
* 2015-2021 Lukas Holländer <lukas.hollaender@yworks.com>, https://github.com/HackbrettXXX
* 2016-2018 Aras Abbasi <aras.abbasi@gmail.com>
* 2010 Aaron Spike, https://github.com/acspike
* 2012 Willow Systems Corporation, https://github.com/willowsystems
* 2012 Pablo Hess, https://github.com/pablohess
* 2012 Florian Jenett, https://github.com/fjenett
* 2013 Warren Weckesser, https://github.com/warrenweckesser
* 2013 Youssef Beddad, https://github.com/lifof
* 2013 Lee Driscoll, https://github.com/lsdriscoll
* 2013 Stefan Slonevskiy, https://github.com/stefslon
* 2013 Jeremy Morel, https://github.com/jmorel
* 2013 Christoph Hartmann, https://github.com/chris-rock
* 2014 Juan Pablo Gaviria, https://github.com/juanpgaviria
* 2014 James Makes, https://github.com/dollaruw
* 2014 Diego Casorran, https://github.com/diegocr
* 2014 Steven Spungin, https://github.com/Flamenco
* 2014 Kenneth Glassey, https://github.com/Gavvers
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Contributor(s):
* siefkenj, ahwolf, rickygu, Midnith, saintclair, eaparango,
* kim3er, mfo, alnorth, Flamenco
*/
var wl=function(){return"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this}();function i$2(){wl.console&&"function"==typeof wl.console.log&&wl.console.log.apply(wl.console,arguments)}var xl={log:i$2,warn:function(en){wl.console&&("function"==typeof wl.console.warn?wl.console.warn.apply(wl.console,arguments):i$2.call(null,arguments))},error:function(en){wl.console&&("function"==typeof wl.console.error?wl.console.error.apply(wl.console,arguments):i$2(en))}};function o$1(en,tn,nn){var rn=new XMLHttpRequest;rn.open("GET",en),rn.responseType="blob",rn.onload=function(){Sl(rn.response,tn,nn)},rn.onerror=function(){xl.error("could not download file")},rn.send()}function s$1(en){var tn=new XMLHttpRequest;tn.open("HEAD",en,!1);try{tn.send()}catch(en){}return tn.status>=200&&tn.status<=299}function c$2(en){try{en.dispatchEvent(new MouseEvent("click"))}catch(nn){var tn=document.createEvent("MouseEvents");tn.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),en.dispatchEvent(tn)}}var kl,Cl,Sl=wl.saveAs||("object"!==("undefined"==typeof window?"undefined":_typeof$1(window))||window!==wl?function(){}:"undefined"!=typeof HTMLAnchorElement&&"download"in HTMLAnchorElement.prototype?function(en,tn,nn){var rn=wl.URL||wl.webkitURL,an=document.createElement("a");tn=tn||en.name||"download",an.download=tn,an.rel="noopener","string"==typeof en?(an.href=en,an.origin!==location.origin?s$1(an.href)?o$1(en,tn,nn):c$2(an,an.target="_blank"):c$2(an)):(an.href=rn.createObjectURL(en),setTimeout((function(){rn.revokeObjectURL(an.href)}),4e4),setTimeout((function(){c$2(an)}),0))}:"msSaveOrOpenBlob"in navigator?function(en,tn,nn){if(tn=tn||en.name||"download","string"==typeof en)if(s$1(en))o$1(en,tn,nn);else{var rn=document.createElement("a");rn.href=en,rn.target="_blank",setTimeout((function(){c$2(rn)}))}else navigator.msSaveOrOpenBlob(function(en,tn){return void 0===tn?tn={autoBom:!1}:"object"!==_typeof$1(tn)&&(xl.warn("Deprecated: Expected third argument to be a object"),tn={autoBom:!tn}),tn.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(en.type)?new Blob([String.fromCharCode(65279),en],{type:en.type}):en}(en,nn),tn)}:function(en,tn,nn,rn){if((rn=rn||open("","_blank"))&&(rn.document.title=rn.document.body.innerText="downloading..."),"string"==typeof en)return o$1(en,tn,nn);var an="application/octet-stream"===en.type,sn=/constructor/i.test(wl.HTMLElement)||wl.safari,cn=/CriOS\/[\d]+/.test(navigator.userAgent);if((cn||an&&sn)&&"object"===("undefined"==typeof FileReader?"undefined":_typeof$1(FileReader))){var An=new FileReader;An.onloadend=function(){var en=An.result;en=cn?en:en.replace(/^data:[^;]*;/,"data:attachment/file;"),rn?rn.location.href=en:location=en,rn=null},An.readAsDataURL(en)}else{var dn=wl.URL||wl.webkitURL,un=dn.createObjectURL(en);rn?rn.location=un:location.href=un,rn=null,setTimeout((function(){dn.revokeObjectURL(un)}),4e4)}});
/**
* A class to parse color values
* @author Stoyan Stefanov <sstoo@gmail.com>
* {@link http://www.phpied.com/rgb-color-parser-in-javascript/}
* @license Use it if you like it
*/function f$1(en){var tn;en=en||"",this.ok=!1,"#"==en.charAt(0)&&(en=en.substr(1,6)),en={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"}[en=(en=en.replace(/ /g,"")).toLowerCase()]||en;for(var nn=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(en){return[parseInt(en[1]),parseInt(en[2]),parseInt(en[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(en){return[parseInt(en[1],16),parseInt(en[2],16),parseInt(en[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(en){return[parseInt(en[1]+en[1],16),parseInt(en[2]+en[2],16),parseInt(en[3]+en[3],16)]}}],rn=0;rn<nn.length;rn++){var an=nn[rn].re,sn=nn[rn].process,cn=an.exec(en);cn&&(tn=sn(cn),this.r=tn[0],this.g=tn[1],this.b=tn[2],this.ok=!0)}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var en=this.r.toString(16),tn=this.g.toString(16),nn=this.b.toString(16);return 1==en.length&&(en="0"+en),1==tn.length&&(tn="0"+tn),1==nn.length&&(nn="0"+nn),"#"+en+tn+nn}}
/**
* @license
* Joseph Myers does not specify a particular license for his work.
*
* Author: Joseph Myers
* Accessed from: http://www.myersdaily.org/joseph/javascript/md5.js
*
* Modified by: Owen Leong
*/function d(en,tn){var nn=en[0],rn=en[1],an=en[2],sn=en[3];nn=g(nn,rn,an,sn,tn[0],7,-680876936),sn=g(sn,nn,rn,an,tn[1],12,-389564586),an=g(an,sn,nn,rn,tn[2],17,606105819),rn=g(rn,an,sn,nn,tn[3],22,-1044525330),nn=g(nn,rn,an,sn,tn[4],7,-176418897),sn=g(sn,nn,rn,an,tn[5],12,1200080426),an=g(an,sn,nn,rn,tn[6],17,-1473231341),rn=g(rn,an,sn,nn,tn[7],22,-45705983),nn=g(nn,rn,an,sn,tn[8],7,1770035416),sn=g(sn,nn,rn,an,tn[9],12,-1958414417),an=g(an,sn,nn,rn,tn[10],17,-42063),rn=g(rn,an,sn,nn,tn[11],22,-1990404162),nn=g(nn,rn,an,sn,tn[12],7,1804603682),sn=g(sn,nn,rn,an,tn[13],12,-40341101),an=g(an,sn,nn,rn,tn[14],17,-1502002290),nn=m$2(nn,rn=g(rn,an,sn,nn,tn[15],22,1236535329),an,sn,tn[1],5,-165796510),sn=m$2(sn,nn,rn,an,tn[6],9,-1069501632),an=m$2(an,sn,nn,rn,tn[11],14,643717713),rn=m$2(rn,an,sn,nn,tn[0],20,-373897302),nn=m$2(nn,rn,an,sn,tn[5],5,-701558691),sn=m$2(sn,nn,rn,an,tn[10],9,38016083),an=m$2(an,sn,nn,rn,tn[15],14,-660478335),rn=m$2(rn,an,sn,nn,tn[4],20,-405537848),nn=m$2(nn,rn,an,sn,tn[9],5,568446438),sn=m$2(sn,nn,rn,an,tn[14],9,-1019803690),an=m$2(an,sn,nn,rn,tn[3],14,-187363961),rn=m$2(rn,an,sn,nn,tn[8],20,1163531501),nn=m$2(nn,rn,an,sn,tn[13],5,-1444681467),sn=m$2(sn,nn,rn,an,tn[2],9,-51403784),an=m$2(an,sn,nn,rn,tn[7],14,1735328473),nn=v$1(nn,rn=m$2(rn,an,sn,nn,tn[12],20,-1926607734),an,sn,tn[5],4,-378558),sn=v$1(sn,nn,rn,an,tn[8],11,-2022574463),an=v$1(an,sn,nn,rn,tn[11],16,1839030562),rn=v$1(rn,an,sn,nn,tn[14],23,-35309556),nn=v$1(nn,rn,an,sn,tn[1],4,-1530992060),sn=v$1(sn,nn,rn,an,tn[4],11,1272893353),an=v$1(an,sn,nn,rn,tn[7],16,-155497632),rn=v$1(rn,an,sn,nn,tn[10],23,-1094730640),nn=v$1(nn,rn,an,sn,tn[13],4,681279174),sn=v$1(sn,nn,rn,an,tn[0],11,-358537222),an=v$1(an,sn,nn,rn,tn[3],16,-722521979),rn=v$1(rn,an,sn,nn,tn[6],23,76029189),nn=v$1(nn,rn,an,sn,tn[9],4,-640364487),sn=v$1(sn,nn,rn,an,tn[12],11,-421815835),an=v$1(an,sn,nn,rn,tn[15],16,530742520),nn=b(nn,rn=v$1(rn,an,sn,nn,tn[2],23,-995338651),an,sn,tn[0],6,-198630844),sn=b(sn,nn,rn,an,tn[7],10,1126891415),an=b(an,sn,nn,rn,tn[14],15,-1416354905),rn=b(rn,an,sn,nn,tn[5],21,-57434055),nn=b(nn,rn,an,sn,tn[12],6,1700485571),sn=b(sn,nn,rn,an,tn[3],10,-1894986606),an=b(an,sn,nn,rn,tn[10],15,-1051523),rn=b(rn,an,sn,nn,tn[1],21,-2054922799),nn=b(nn,rn,an,sn,tn[8],6,1873313359),sn=b(sn,nn,rn,an,tn[15],10,-30611744),an=b(an,sn,nn,rn,tn[6],15,-1560198380),rn=b(rn,an,sn,nn,tn[13],21,1309151649),nn=b(nn,rn,an,sn,tn[4],6,-145523070),sn=b(sn,nn,rn,an,tn[11],10,-1120210379),an=b(an,sn,nn,rn,tn[2],15,718787259),rn=b(rn,an,sn,nn,tn[9],21,-343485551),en[0]=_$1(nn,en[0]),en[1]=_$1(rn,en[1]),en[2]=_$1(an,en[2]),en[3]=_$1(sn,en[3])}function p$1(en,tn,nn,rn,an,sn){return tn=_$1(_$1(tn,en),_$1(rn,sn)),_$1(tn<<an|tn>>>32-an,nn)}function g(en,tn,nn,rn,an,sn,cn){return p$1(tn&nn|~tn&rn,en,tn,an,sn,cn)}function m$2(en,tn,nn,rn,an,sn,cn){return p$1(tn&rn|nn&~rn,en,tn,an,sn,cn)}function v$1(en,tn,nn,rn,an,sn,cn){return p$1(tn^nn^rn,en,tn,an,sn,cn)}function b(en,tn,nn,rn,an,sn,cn){return p$1(nn^(tn|~rn),en,tn,an,sn,cn)}function y$1(en){var tn,nn=en.length,rn=[1732584193,-271733879,-1732584194,271733878];for(tn=64;tn<=en.length;tn+=64)d(rn,w(en.substring(tn-64,tn)));en=en.substring(tn-64);var an=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(tn=0;tn<en.length;tn++)an[tn>>2]|=en.charCodeAt(tn)<<(tn%4<<3);if(an[tn>>2]|=128<<(tn%4<<3),tn>55)for(d(rn,an),tn=0;tn<16;tn++)an[tn]=0;return an[14]=8*nn,d(rn,an),rn}function w(en){var tn,nn=[];for(tn=0;tn<64;tn+=4)nn[tn>>2]=en.charCodeAt(tn)+(en.charCodeAt(tn+1)<<8)+(en.charCodeAt(tn+2)<<16)+(en.charCodeAt(tn+3)<<24);return nn}kl=wl.atob.bind(wl),Cl=wl.btoa.bind(wl);var Bl="0123456789abcdef".split("");function L(en){for(var tn="",nn=0;nn<4;nn++)tn+=Bl[en>>8*nn+4&15]+Bl[en>>8*nn&15];return tn}function A(en){return String.fromCharCode((255&en)>>0,(65280&en)>>8,(16711680&en)>>16,(4278190080&en)>>24)}function x(en){return y$1(en).map(A).join("")}var El="5d41402abc4b2a76b9719d911017c592"!=function(en){for(var tn=0;tn<en.length;tn++)en[tn]=L(en[tn]);return en.join("")}(y$1("hello"));function _$1(en,tn){if(El){var nn=(65535&en)+(65535&tn);return(en>>16)+(tn>>
/**
* @license
* FPDF is released under a permissive license: there is no usage restriction.
* You may embed it freely in your application (commercial or not), with or
* without modifications.
*
* Reference: http://www.fpdf.org/en/script/script37.php
*/function P(en,tn){var nn,rn,an,sn;if(en!==nn){for(var cn=(an=en,sn=1+(256/en.length>>0),new Array(sn+1).join(an)),An=[],dn=0;dn<256;dn++)An[dn]=dn;var un=0;for(dn=0;dn<256;dn++){var pn=An[dn];un=(un+pn+cn.charCodeAt(dn))%256,An[dn]=An[un],An[un]=pn}nn=en,rn=An}else An=rn;var hn=tn.length,gn=0,_n=0,mn="";for(dn=0;dn<hn;dn++)_n=(_n+(pn=An[gn=(gn+1)%256]))%256,An[gn]=An[_n],An[_n]=pn,cn=An[(An[gn]+An[_n])%256],mn+=String.fromCharCode(tn.charCodeAt(dn)^cn);return mn}
/**
* @license
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
* Author: Owen Leong (@owenl131)
* Date: 15 Oct 2020
* References:
* https://www.cs.cmu.edu/~dst/Adobe/Gallery/anon21jul01-pdf-encryption.txt
* https://github.com/foliojs/pdfkit/blob/master/lib/security.js
* http://www.fpdf.org/en/script/script37.php
*/var jl={print:4,modify:8,copy:16,"annot-forms":32};function I(en,tn,nn,rn){this.v=1,this.r=2;var an=192;en.forEach((function(en){if(void 0!==jl.perm)throw new Error("Invalid permission: "+en);an+=jl[en]})),this.padding="(¿N^NuŠAd\0NVÿú\b..\0¶Ðh>€/\f©þdSiz";var sn=(tn+this.padding).substr(0,32),cn=(nn+this.padding).substr(0,32);this.O=this.processOwnerPassword(sn,cn),this.P=-(1+(255^an)),this.encryptionKey=x(sn+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(rn)).substr(0,5),this.U=P(this.encryptionKey,this.padding)}function F(en){if(/[^\u0000-\u00ff]/.test(en))throw new Error("Invalid PDF Name Object: "+en+", Only accept ASCII characters.");for(var tn="",nn=en.length,rn=0;rn<nn;rn++){var an=en.charCodeAt(rn);tn+=an<33||35===an||37===an||40===an||41===an||47===an||60===an||62===an||91===an||93===an||123===an||125===an||an>126?"#"+("0"+an.toString(16)).slice(-2):en[rn]}return tn}function C(en){if("object"!==_typeof$1(en))throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var tn={};this.subscribe=function(en,nn,rn){if(rn=rn||!1,"string"!=typeof en||"function"!=typeof nn||"boolean"!=typeof rn)throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");tn.hasOwnProperty(en)||(tn[en]={});var an=Math.random().toString(35);return tn[en][an]=[nn,!!rn],an},this.unsubscribe=function(en){for(var nn in tn)if(tn[nn][en])return delete tn[nn][en],0===Object.keys(tn[nn]).length&&delete tn[nn],!0;return!1},this.publish=function(nn){if(tn.hasOwnProperty(nn)){var rn=Array.prototype.slice.call(arguments,1),an=[];for(var sn in tn[nn]){var cn=tn[nn][sn];try{cn[0].apply(en,rn)}catch(nn){wl.console&&xl.error("jsPDF PubSub Error",nn.message,nn)}cn[1]&&an.push(sn)}an.length&&an.forEach(this.unsubscribe)}},this.getTopics=function(){return tn}}function j(en){if(!(this instanceof j))return new j(en);var tn="opacity,stroke-opacity".split(",");for(var nn in en)en.hasOwnProperty(nn)&&tn.indexOf(nn)>=0&&(this[nn]=en[nn]);this.id="",this.objectNumber=-1}function O$1(en,tn){this.gState=en,this.matrix=tn,this.id="",this.objectNumber=-1}function B(en,tn,nn,rn,an){if(!(this instanceof B))return new B(en,tn,nn,rn,an);this.type="axial"===en?2:3,this.coords=tn,this.colors=nn,O$1.call(this,rn,an)}function M(en,tn,nn,rn,an){if(!(this instanceof M))return new M(en,tn,nn,rn,an);this.boundingBox=en,this.xStep=tn,this.yStep=nn,this.stream="",this.cloneIndex=0,O$1.call(this,rn,an)}function E(en){var tn,nn="string"==typeof arguments[0]?arguments[0]:"p",rn=arguments[1],an=arguments[2],sn=arguments[3],cn=[],An=1,dn=16,un="S",pn=null;"object"===_typeof$1(en=en||{})&&(nn=en.orientation,rn=en.unit||rn,an=en.format||an,sn=en.compress||en.compressPdf||sn,null!==(pn=en.encryption||null)&&(pn.userPassword=pn.userPassword||"",pn.ownerPassword=pn.ownerPassword||"",pn.userPermissions=pn.userPermissions||[]),An="number"==typeof en.userUnit?Math.abs(en.userUnit):1,void 0!==en.precision&&(tn=en.precision),void 0!==en.floatPrecision&&(dn=en.floatPrecision),un=en.defaultPathOperation||"S"),cn=en.filters||(!0===sn?["FlateEncode"]:cn),rn=rn||"mm",nn=(""+(nn||"P")).toLowerCase();var hn=en.putOnlyUsedFonts||!1,gn={},_n={internal:{},__private__:{}};_n.__private__.PubSub=C;var mn="1.3",fn=_n.__private__.getPdfVersion=function(){return mn};_n.__private__.setPdfVersion=function(en){mn=en};var yn={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,36
/**
* @license
* Copyright (c) 2014 Steven Spungin (TwelveTone LLC) steven@twelvetone.tv
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
function(en){var e=function(en){if(void 0!==en&&""!=en)return!0};E.API.events.push(["addPage",function(en){this.internal.getPageInfo(en.pageNumber).pageContext.annotations=[]}]),en.events.push(["putPage",function(en){for(var tn,nn,rn,an=this.internal.getCoordinateString,sn=this.internal.getVerticalCoordinateString,cn=this.internal.getPageInfoByObjId(en.objId),An=en.pageContext.annotations,dn=!1,un=0;un<An.length&&!dn;un++)switch((tn=An[un]).type){case"link":(e(tn.options.url)||e(tn.options.pageNumber))&&(dn=!0);break;case"reference":case"text":case"freetext":dn=!0}if(0!=dn){this.internal.write("/Annots [");for(var pn=0;pn<An.length;pn++){tn=An[pn];var hn=this.internal.pdfEscape,gn=this.internal.getEncryptor(en.objId);switch(tn.type){case"reference":this.internal.write(" "+tn.object.objId+" 0 R ");break;case"text":var _n=this.internal.newAdditionalObject(),mn=this.internal.newAdditionalObject(),fn=this.internal.getEncryptor(_n.objId),yn=tn.title||"Note";rn="<</Type /Annot /Subtype /Text "+(nn="/Rect ["+an(tn.bounds.x)+" "+sn(tn.bounds.y+tn.bounds.h)+" "+an(tn.bounds.x+tn.bounds.w)+" "+sn(tn.bounds.y)+"] ")+"/Contents ("+hn(fn(tn.contents))+")",rn+=" /Popup "+mn.objId+" 0 R",rn+=" /P "+cn.objId+" 0 R",rn+=" /T ("+hn(fn(yn))+") >>",_n.content=rn;var bn=_n.objId+" 0 R";rn="<</Type /Annot /Subtype /Popup "+(nn="/Rect ["+an(tn.bounds.x+30)+" "+sn(tn.bounds.y+tn.bounds.h)+" "+an(tn.bounds.x+tn.bounds.w+30)+" "+sn(tn.bounds.y)+"] ")+" /Parent "+bn,tn.open&&(rn+=" /Open true"),rn+=" >>",mn.content=rn,this.internal.write(_n.objId,"0 R",mn.objId,"0 R");break;case"freetext":nn="/Rect ["+an(tn.bounds.x)+" "+sn(tn.bounds.y)+" "+an(tn.bounds.x+tn.bounds.w)+" "+sn(tn.bounds.y+tn.bounds.h)+"] ";var vn=tn.color||"#000000";rn="<</Type /Annot /Subtype /FreeText "+nn+"/Contents ("+hn(gn(tn.contents))+")",rn+=" /DS(font: Helvetica,sans-serif 12.0pt; text-align:left; color:#"+vn+")",rn+=" /Border [0 0 0]",rn+=" >>",this.internal.write(rn);break;case"link":if(tn.options.name){var wn=this.annotations._nameMap[tn.options.name];tn.options.pageNumber=wn.page,tn.options.top=wn.y}else tn.options.top||(tn.options.top=0);if(nn="/Rect ["+tn.finalBounds.x+" "+tn.finalBounds.y+" "+tn.finalBounds.w+" "+tn.finalBounds.h+"] ",rn="",tn.options.url)rn="<</Type /Annot /Subtype /Link "+nn+"/Border [0 0 0] /A <</S /URI /URI ("+hn(gn(tn.options.url))+") >>";else if(tn.options.pageNumber)switch(rn="<</Type /Annot /Subtype /Link "+nn+"/Border [0 0 0] /Dest ["+this.internal.getPageInfo(tn.options.pageNumber).objId+" 0 R",tn.options.magFactor=tn.options.magFactor||"XYZ",tn.options.magFactor){case"Fit":rn+=" /Fit]";break;case"FitH":rn+=" /FitH "+tn.options.top+"]";break;case"FitV":tn.options.left=tn.options.left||0,rn+=" /FitV "+tn.options.left+"]";break;default:var xn=sn(tn.options.top);tn.options.left=tn.options.left||0,void 0===tn.options.zoom&&(tn.options.zoom=0),rn+=" /XYZ "+tn.options.left+" "+xn+" "+tn.options.zoom+"]"}""!=rn&&(rn+=" >>",this.internal.write(rn))}}this.internal.write("]")}}]),en.createAnnotation=function(en){var tn=this.internal.getCurrentPageInfo();switch(en.type){case"link":this.link(en.bounds.x,en.bounds.y,en.bounds.w,en.bounds.h,en);break;case"text":case"freetext":tn.pageContext.annotations.push(en)}},en.link=function(en,tn,nn,rn,an){var sn=this.internal.getCurrentPageInfo(),cn=this.internal.getCoordinateString,An=this.internal.getVerticalCoordinateString;sn.pageContext.annotations.push({finalBounds:{x:cn(en),y:An(tn),w:cn(en+nn),h:An(tn+rn)},options:an,type:"link"})},en.textWithLink=function(en,tn,nn,rn){var an,sn,cn=this.getTextWidth(en),An=this.internal.getLineHeight()/this.internal.scaleFactor;if(void 0!==rn.maxWidth){sn=rn.maxWidth;var dn=this.splitTextToSize(en,sn).length;an=Math.ceil(An*dn)}else sn=cn,an=An;return this.text(en,tn,nn,rn),nn+=.2*An,"center"===rn.align&&(tn-=cn/2),"right"===rn.align&&(tn-=cn),this.link(tn,nn-An,sn,an,rn),cn},en.getTextWidth=function(en){var tn=this.internal.getFontSize();return this.getStringUnitWidth(en)*tn/this.internal.scaleFactor}}(E.API),
/**
* @license
* Copyright (c) 2017 Aras Abbasi
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
function(en){var tn={1569:[65152],1570:[65153,65154],1571:[65155,65156],1572:[65157,65158],1573:[65159,65160],1574:[65161,65162,65163,65164],1575:[65165,65166],1576:[65167,65168,65169,65170],1577:[65171,65172],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194],1584:[65195,65196],1585:[65197,65198],1586:[65199,65200],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1649:[64336,64337],1655:[64477],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393],1676:[64388,64389],1677:[64386,64387],1678:[64390,64391],1681:[64396,64397],1688:[64394,64395],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421],1729:[64422,64423,64424,64425],1733:[64480,64481],1734:[64473,64474],1735:[64471,64472],1736:[64475,64476],1737:[64482,64483],1739:[64478,64479],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431],1747:[64432,64433]},nn={65247:{65154:65269,65156:65271,65160:65273,65166:65275},65248:{65154:65270,65156:65272,65160:65274,65166:65276},65165:{65247:{65248:{65258:65010}}},1617:{1612:64606,1613:64607,1614:64608,1615:64609,1616:64610}},rn={1612:64606,1613:64607,1614:64608,1615:64609,1616:64610},an=[1570,1571,1573,1575];en.__arabicParser__={};var sn=en.__arabicParser__.isInArabicSubstitutionA=function(en){return void 0!==tn[en.charCodeAt(0)]},cn=en.__arabicParser__.isArabicLetter=function(en){return"string"==typeof en&&/^[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]+$/.test(en)},An=en.__arabicParser__.isArabicEndLetter=function(en){return cn(en)&&sn(en)&&tn[en.charCodeAt(0)].length<=2},dn=en.__arabicParser__.isArabicAlfLetter=function(en){return cn(en)&&an.indexOf(en.charCodeAt(0))>=0};en.__arabicParser__.arabicLetterHasIsolatedForm=function(en){return cn(en)&&sn(en)&&tn[en.charCodeAt(0)].length>=1};var un=en.__arabicParser__.arabicLetterHasFinalForm=function(en){return cn(en)&&sn(en)&&tn[en.charCodeAt(0)].length>=2};en.__arabicParser__.arabicLetterHasInitialForm=function(en){return cn(en)&&sn(en)&&tn[en.charCodeAt(0)].length>=3};var pn=en.__arabicParser__.arabicLetterHasMedialForm=function(en){return cn(en)&&sn(en)&&4==tn[en.charCodeAt(0)].length},hn=en.__arabicParser__.resolveLigatures=function(en){var tn=0,rn=nn,an="",sn=0;for(tn=0;tn<en.length;tn+=1)void 0!==rn[en.charCodeAt(tn)]?(sn++,"number"==typeof(rn=rn[en.charCodeAt(tn)])&&(an+=String.fromCharCode(rn),rn=nn,sn=0),tn===en.length-1&&(rn=nn,an+=en.charAt(tn-(sn-1)),tn-=sn-1,sn=0)):(rn=nn,an+=en.charAt(tn-sn),tn-=sn,sn=0);return an};en.__arabicParser__.isArabicDiacritic=function(en){return void 0!==en&&void 0!==rn[en.charCodeAt(0)]};var gn=en.__arabicParser__.getCorrectForm=function(en,tn,nn){return cn(en)?!1===sn(en)?-1:!un(en)||!cn(tn)&&!cn(nn)||!cn(nn)&&An(tn)||An(en)&&!cn(tn)||An(en)&&dn(tn)||An(en)&&An(tn)?0:pn(en)&&cn(tn)&&!An(tn)&&cn(nn)&&un(nn)?3:An(en)||!cn(nn)?1:2:-1},d=function(en){var nn=0,rn=0,an=0,sn="",An="",dn="",un=(en=en||"").split("\\s+"),pn=[];for(nn=0;nn<un.length;nn+=1){for(p
/**
* @license
* Copyright (c) 2014 Steven Spungin (TwelveTone LLC) steven@twelvetone.tv
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
function(en){var e=function(){var en=void 0;Object.defineProperty(this,"pdf",{get:function(){return en},set:function(tn){en=tn}});var tn=150;Object.defineProperty(this,"width",{get:function(){return tn},set:function(en){tn=isNaN(en)||!1===Number.isInteger(en)||en<0?150:en,this.getContext("2d").pageWrapXEnabled&&(this.getContext("2d").pageWrapX=tn+1)}});var nn=300;Object.defineProperty(this,"height",{get:function(){return nn},set:function(en){nn=isNaN(en)||!1===Number.isInteger(en)||en<0?300:en,this.getContext("2d").pageWrapYEnabled&&(this.getContext("2d").pageWrapY=nn+1)}});var rn=[];Object.defineProperty(this,"childNodes",{get:function(){return rn},set:function(en){rn=en}});var an={};Object.defineProperty(this,"style",{get:function(){return an},set:function(en){an=en}}),Object.defineProperty(this,"parentNode",{})};e.prototype.getContext=function(en,tn){var nn;if("2d"!==(en=en||"2d"))return null;for(nn in tn)this.pdf.context2d.hasOwnProperty(nn)&&(this.pdf.context2d[nn]=tn[nn]);return this.pdf.context2d._canvas=this,this.pdf.context2d},e.prototype.toDataURL=function(){throw new Error("toDataURL is not implemented.")},en.events.push(["initialized",function(){this.canvas=new e,this.canvas.pdf=this}])}(E.API),function(en){var tn={left:0,top:0,bottom:0,right:0},nn=!1,i=function(){void 0===this.internal.__cell__&&(this.internal.__cell__={},this.internal.__cell__.padding=3,this.internal.__cell__.headerFunction=void 0,this.internal.__cell__.margins=Object.assign({},tn),this.internal.__cell__.margins.width=this.getPageWidth(),a.call(this))},a=function(){this.internal.__cell__.lastCell=new o,this.internal.__cell__.pages=1},o=function(){var en=arguments[0];Object.defineProperty(this,"x",{enumerable:!0,get:function(){return en},set:function(tn){en=tn}});var tn=arguments[1];Object.defineProperty(this,"y",{enumerable:!0,get:function(){return tn},set:function(en){tn=en}});var nn=arguments[2];Object.defineProperty(this,"width",{enumerable:!0,get:function(){return nn},set:function(en){nn=en}});var rn=arguments[3];Object.defineProperty(this,"height",{enumerable:!0,get:function(){return rn},set:function(en){rn=en}});var an=arguments[4];Object.defineProperty(this,"text",{enumerable:!0,get:function(){return an},set:function(en){an=en}});var sn=arguments[5];Object.defineProperty(this,"lineNumber",{enumerable:!0,get:function(){return sn},set:function(en){sn=en}});var cn=arguments[6];return Object.defineProperty(this,"align",{enumerable:!0,get:function(){return cn},set:function(en){cn=en}}),this};o.prototype.clone=function(){return new o(this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align)},o.prototype.toArray=function(){return[this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align]},en.setHeaderFunction=function(en){return i.call(this),this.internal.__cell__.headerFunction="function"==typeof en?en:void 0,this},en.getTextDimensions=function(en,tn){i.call(this);var nn=(tn=tn||{}).fontSize||this.getFontSize(),rn=tn.font||this.getFont(),an=tn.scaleFactor||this.internal.scaleFactor,sn=0,cn=0,An=0,dn=this;if(!Array.isArray(en)&&"string"!=typeof en){if("number"!=typeof en)throw new Error("getTextDimensions expects text-parameter to be of type String or type Number or an Array of Strings.");en=String(en)}var un=tn.maxWidth;un>0?"string"==typeof en?en=this.splitTextToSize(en,un):"[object Array]"===Object.prototype.toString.call(en)&&(en=en.reduce((function(en,tn){return en.concat(dn.splitTextToSize(tn,un))}),[])):en=Array.isArray(en)?en:[en];for(var pn=0;pn<en.length;pn++)sn<(An=this.getStringUnitWidth(en[pn],{font:rn})*nn)&&(sn=An);return 0!==sn&&(cn=en.length),{w:sn/=an,h:Math.max((cn*nn*this.getLineHeightFactor()-nn*(this.getLineHeightFactor()-1))/an,0)}},en.cellAddPage=function(){i.call(this),this.addPage();var en=this.internal.__cell__.margins||tn;return this.internal.__cell__.lastCell=new o(en.left,en.top,void 0,void 0),this.internal.__cell__.pages+=1,this};var rn=en.cell=function(){var en;en=arguments[0]instanceof o?arguments[0]:new o(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],argu
/**
* @license
* jsPDF filters PlugIn
* Copyright (c) 2014 Aras Abbasi
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
function(en){var r=function(en){var tn,nn,rn,an,sn,cn,An,dn,un,pn;for(/[^\x00-\xFF]/.test(en),nn=[],rn=0,an=(en+=tn="\0\0\0\0".slice(en.length%4||4)).length;an>rn;rn+=4)0!==(sn=(en.charCodeAt(rn)<<24)+(en.charCodeAt(rn+1)<<16)+(en.charCodeAt(rn+2)<<8)+en.charCodeAt(rn+3))?(cn=(sn=((sn=((sn=((sn=(sn-(pn=sn%85))/85)-(un=sn%85))/85)-(dn=sn%85))/85)-(An=sn%85))/85)%85,nn.push(cn+33,An+33,dn+33,un+33,pn+33)):nn.push(122);return function(en,tn){for(var nn=tn;nn>0;nn--)en.pop()}(nn,tn.length),String.fromCharCode.apply(String,nn)+"~>"},n=function(en){var tn,nn,rn,an,sn,cn=String,An="length",dn=255,un="charCodeAt",pn="slice",hn="replace";for(en[pn](-2),en=en[pn](0,-2)[hn](/\s/g,"")[hn]("z","!!!!!"),rn=[],an=0,sn=(en+=tn="uuuuu"[pn](en[An]%5||5))[An];sn>an;an+=5)nn=52200625*(en[un](an)-33)+614125*(en[un](an+1)-33)+7225*(en[un](an+2)-33)+85*(en[un](an+3)-33)+(en[un](an+4)-33),rn.push(dn&nn>>24,dn&nn>>16,dn&nn>>8,dn&nn);return function(en,tn){for(var nn=tn;nn>0;nn--)en.pop()}(rn,tn[An]),cn.fromCharCode.apply(cn,rn)},i=function(en){var tn=new RegExp(/^([0-9A-Fa-f]{2})+$/);if(-1!==(en=en.replace(/\s/g,"")).indexOf(">")&&(en=en.substr(0,en.indexOf(">"))),en.length%2&&(en+="0"),!1===tn.test(en))return"";for(var nn="",rn=0;rn<en.length;rn+=2)nn+=String.fromCharCode("0x"+(en[rn]+en[rn+1]));return nn},a=function(en){for(var tn=new Uint8Array(en.length),nn=en.length;nn--;)tn[nn]=en.charCodeAt(nn);return(tn=zlibSync(tn)).reduce((function(en,tn){return en+String.fromCharCode(tn)}),"")};en.processDataByFilters=function(en,tn){var nn=0,rn=en||"",an=[];for("string"==typeof(tn=tn||[])&&(tn=[tn]),nn=0;nn<tn.length;nn+=1)switch(tn[nn]){case"ASCII85Decode":case"/ASCII85Decode":rn=n(rn),an.push("/ASCII85Encode");break;case"ASCII85Encode":case"/ASCII85Encode":rn=r(rn),an.push("/ASCII85Decode");break;case"ASCIIHexDecode":case"/ASCIIHexDecode":rn=i(rn),an.push("/ASCIIHexEncode");break;case"ASCIIHexEncode":case"/ASCIIHexEncode":rn=rn.split("").map((function(en){return("0"+en.charCodeAt().toString(16)).slice(-2)})).join("")+">",an.push("/ASCIIHexDecode");break;case"FlateEncode":case"/FlateEncode":rn=a(rn),an.push("/FlateDecode");break;default:throw new Error('The filter: "'+tn[nn]+'" is not implemented')}return{data:rn,reverseChain:an.reverse().join(" ")}}}(E.API),
/**
* @license
* jsPDF fileloading PlugIn
* Copyright (c) 2018 Aras Abbasi (aras.abbasi@gmail.com)
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
function(en){en.loadFile=function(en,tn,nn){return function(en,tn,nn){tn=!1!==tn,nn="function"==typeof nn?nn:function(){};var rn=void 0;try{rn=function(en,tn,nn){var rn=new XMLHttpRequest,an=0,a=function(en){var tn=en.length,nn=[],rn=String.fromCharCode;for(an=0;an<tn;an+=1)nn.push(rn(255&en.charCodeAt(an)));return nn.join("")};if(rn.open("GET",en,!tn),rn.overrideMimeType("text/plain; charset=x-user-defined"),!1===tn&&(rn.onload=function(){200===rn.status?nn(a(this.responseText)):nn(void 0)}),rn.send(null),tn&&200===rn.status)return a(rn.responseText)}(en,tn,nn)}catch(en){}return rn}(en,tn,nn)},en.loadImageFile=en.loadFile}(E.API),function(en){function r(){return(wl.html2canvas?Promise.resolve(wl.html2canvas):Promise.resolve().then((function(){return WA}))).catch((function(en){return Promise.reject(new Error("Could not load html2canvas: "+en))})).then((function(en){return en.default?en.default:en}))}function i(){return(wl.DOMPurify?Promise.resolve(wl.DOMPurify):Promise.resolve().then((function(){return cd}))).catch((function(en){return Promise.reject(new Error("Could not load dompurify: "+en))})).then((function(en){return en.default?en.default:en}))}var a=function(en){var tn=_typeof$1(en);return"undefined"===tn?"undefined":"string"===tn||en instanceof String?"string":"number"===tn||en instanceof Number?"number":"function"===tn||en instanceof Function?"function":en&&en.constructor===Array?"array":en&&1===en.nodeType?"element":"object"===tn?"object":"unknown"},o=function(en,tn){var nn=document.createElement(en);for(var rn in tn.className&&(nn.className=tn.className),tn.innerHTML&&tn.dompurify&&(nn.innerHTML=tn.dompurify.sanitize(tn.innerHTML)),tn.style)nn.style[rn]=tn.style[rn];return nn},tn=function t(en){var tn=Object.assign(t.convert(Promise.resolve()),JSON.parse(JSON.stringify(t.template))),nn=t.convert(Promise.resolve(),tn);return(nn=nn.setProgress(1,t,1,[t])).set(en)};(tn.prototype=Object.create(Promise.prototype)).constructor=tn,tn.convert=function(en,nn){return en.__proto__=nn||tn.prototype,en},tn.template={prop:{src:null,container:null,overlay:null,canvas:null,img:null,pdf:null,pageSize:null,callback:function(){}},progress:{val:0,state:null,n:0,stack:[]},opt:{filename:"file.pdf",margin:[0,0,0,0],enableLinks:!0,x:0,y:0,html2canvas:{},jsPDF:{},backgroundColor:"transparent"}},tn.prototype.from=function(en,tn){return this.then((function(){switch(tn=tn||function(en){switch(a(en)){case"string":return"string";case"element":return"canvas"===en.nodeName.toLowerCase()?"canvas":"element";default:return"unknown"}}(en)){case"string":return this.then(i).then((function(tn){return this.set({src:o("div",{innerHTML:en,dompurify:tn})})}));case"element":return this.set({src:en});case"canvas":return this.set({canvas:en});case"img":return this.set({img:en});default:return this.error("Unknown source type.")}}))},tn.prototype.to=function(en){switch(en){case"container":return this.toContainer();case"canvas":return this.toCanvas();case"img":return this.toImg();case"pdf":return this.toPdf();default:return this.error("Invalid target.")}},tn.prototype.toContainer=function(){return this.thenList([function(){return this.prop.src||this.error("Cannot duplicate - no source HTML.")},function(){return this.prop.pageSize||this.setPageSize()}]).then((function(){var en={position:"relative",display:"inline-block",width:("number"!=typeof this.opt.width||isNaN(this.opt.width)||"number"!=typeof this.opt.windowWidth||isNaN(this.opt.windowWidth)?Math.max(this.prop.src.clientWidth,this.prop.src.scrollWidth,this.prop.src.offsetWidth):this.opt.windowWidth)+"px",left:0,right:0,top:0,margin:"auto",backgroundColor:this.opt.backgroundColor},tn=function t(en,tn){for(var nn=3===en.nodeType?document.createTextNode(en.nodeValue):en.cloneNode(!1),rn=en.firstChild;rn;rn=rn.nextSibling)!0!==tn&&1===rn.nodeType&&"SCRIPT"===rn.nodeName||nn.appendChild(t(rn,tn));return 1===en.nodeType&&("CANVAS"===en.nodeName?(nn.width=en.width,nn.height=en.height,nn.getContext("2d").drawImage(en,0,0)):"TEXTAREA"!==en.nodeName&&"SELECT"!==en.nodeName||(nn.value=en.value),nn.addEventListener
/**
* @license
* Copyright (c) 2014 Steven Spungin (TwelveTone LLC) steven@twelvetone.tv
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
function(en){var tn;en.events.push(["postPutResources",function(){var en=this,nn=/^(\d+) 0 obj$/;if(this.outline.root.children.length>0)for(var rn=en.outline.render().split(/\r\n/),an=0;an<rn.length;an++){var sn=rn[an],cn=nn.exec(sn);if(null!=cn){var An=cn[1];en.internal.newObjectDeferredBegin(An,!1)}en.internal.write(sn)}if(this.outline.createNamedDestinations){var dn=this.internal.pages.length,un=[];for(an=0;an<dn;an++){var pn=en.internal.newObject();un.push(pn);var hn=en.internal.getPageInfo(an+1);en.internal.write("<< /D["+hn.objId+" 0 R /XYZ null null null]>> endobj")}var gn=en.internal.newObject();for(en.internal.write("<< /Names [ "),an=0;an<un.length;an++)en.internal.write("(page_"+(an+1)+")"+un[an]+" 0 R");en.internal.write(" ] >>","endobj"),tn=en.internal.newObject(),en.internal.write("<< /Dests "+gn+" 0 R"),en.internal.write(">>","endobj")}}]),en.events.push(["putCatalog",function(){this.outline.root.children.length>0&&(this.internal.write("/Outlines",this.outline.makeRef(this.outline.root)),this.outline.createNamedDestinations&&this.internal.write("/Names "+tn+" 0 R"))}]),en.events.push(["initialized",function(){var en=this;en.outline={createNamedDestinations:!1,root:{children:[]}},en.outline.add=function(en,tn,nn){var rn={title:tn,options:nn,children:[]};return null==en&&(en=this.root),en.children.push(rn),rn},en.outline.render=function(){return this.ctx={},this.ctx.val="",this.ctx.pdf=en,this.genIds_r(this.root),this.renderRoot(this.root),this.renderItems(this.root),this.ctx.val},en.outline.genIds_r=function(tn){tn.id=en.internal.newObjectDeferred();for(var nn=0;nn<tn.children.length;nn++)this.genIds_r(tn.children[nn])},en.outline.renderRoot=function(en){this.objStart(en),this.line("/Type /Outlines"),en.children.length>0&&(this.line("/First "+this.makeRef(en.children[0])),this.line("/Last "+this.makeRef(en.children[en.children.length-1]))),this.line("/Count "+this.count_r({count:0},en)),this.objEnd()},en.outline.renderItems=function(tn){for(var nn=this.ctx.pdf.internal.getVerticalCoordinateString,rn=0;rn<tn.children.length;rn++){var an=tn.children[rn];this.objStart(an),this.line("/Title "+this.makeString(an.title)),this.line("/Parent "+this.makeRef(tn)),rn>0&&this.line("/Prev "+this.makeRef(tn.children[rn-1])),rn<tn.children.length-1&&this.line("/Next "+this.makeRef(tn.children[rn+1])),an.children.length>0&&(this.line("/First "+this.makeRef(an.children[0])),this.line("/Last "+this.makeRef(an.children[an.children.length-1])));var sn=this.count=this.count_r({count:0},an);if(sn>0&&this.line("/Count "+sn),an.options&&an.options.pageNumber){var cn=en.internal.getPageInfo(an.options.pageNumber);this.line("/Dest ["+cn.objId+" 0 R /XYZ 0 "+nn(0)+" 0]")}this.objEnd()}for(var An=0;An<tn.children.length;An++)this.renderItems(tn.children[An])},en.outline.line=function(en){this.ctx.val+=en+"\r\n"},en.outline.makeRef=function(en){return en.id+" 0 R"},en.outline.makeString=function(tn){return"("+en.internal.pdfEscape(tn)+")"},en.outline.objStart=function(en){this.ctx.val+="\r\n"+en.id+" 0 obj\r\n<<\r\n"},en.outline.objEnd=function(){this.ctx.val+=">> \r\nendobj\r\n"},en.outline.count_r=function(en,tn){for(var nn=0;nn<tn.children.length;nn++)en.count++,this.count_r(en,tn.children[nn]);return en.count}}])}(E.API),
/**
* @license
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
function(en){var tn=[192,193,194,195,196,197,198,199];en.processJPEG=function(en,nn,rn,an,sn,cn){var An,dn=this.decode.DCT_DECODE,un=null;if("string"==typeof en||this.__addimage__.isArrayBuffer(en)||this.__addimage__.isArrayBufferView(en)){switch(en=sn||en,en=this.__addimage__.isArrayBuffer(en)?new Uint8Array(en):en,(An=function(en){for(var nn,rn=256*en.charCodeAt(4)+en.charCodeAt(5),an=en.length,sn={width:0,height:0,numcomponents:1},cn=4;cn<an;cn+=2){if(cn+=rn,-1!==tn.indexOf(en.charCodeAt(cn+1))){nn=256*en.charCodeAt(cn+5)+en.charCodeAt(cn+6),sn={width:256*en.charCodeAt(cn+7)+en.charCodeAt(cn+8),height:nn,numcomponents:en.charCodeAt(cn+9)};break}rn=256*en.charCodeAt(cn+2)+en.charCodeAt(cn+3)}return sn}(en=this.__addimage__.isArrayBufferView(en)?this.__addimage__.arrayBufferToBinaryString(en):en)).numcomponents){case 1:cn=this.color_spaces.DEVICE_GRAY;break;case 4:cn=this.color_spaces.DEVICE_CMYK;break;case 3:cn=this.color_spaces.DEVICE_RGB}un={data:en,width:An.width,height:An.height,colorSpace:cn,bitsPerComponent:8,filter:dn,index:nn,alias:rn}}return un}}(E.API);var tc,nc,rc,oc,ic,ac=function(){var en,tn,nn;function a(en){var tn,nn,rn,an,sn,cn,An,dn,un,pn,hn,gn,_n,mn;for(this.data=en,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},cn=null;;){switch(tn=this.readUInt32(),un=function(){var en,tn;for(tn=[],en=0;en<4;++en)tn.push(String.fromCharCode(this.data[this.pos++]));return tn}.call(this).join("")){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(tn);break;case"fcTL":cn&&this.animation.frames.push(cn),this.pos+=4,cn={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},sn=this.readUInt16(),an=this.readUInt16()||100,cn.delay=1e3*sn/an,cn.disposeOp=this.data[this.pos++],cn.blendOp=this.data[this.pos++],cn.data=[];break;case"IDAT":case"fdAT":for("fdAT"===un&&(this.pos+=4,tn-=4),en=(null!=cn?cn.data:void 0)||this.imgData,gn=0;0<=tn?gn<tn:gn>tn;0<=tn?++gn:--gn)en.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(rn=this.palette.length/3,this.transparency.indexed=this.read(tn),this.transparency.indexed.length>rn)throw new Error("More transparent colors than palette size");if((pn=rn-this.transparency.indexed.length)>0)for(_n=0;0<=pn?_n<pn:_n>pn;0<=pn?++_n:--_n)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(tn)[0];break;case 2:this.transparency.rgb=this.read(tn)}break;case"tEXt":An=(hn=this.read(tn)).indexOf(0),dn=String.fromCharCode.apply(String,hn.slice(0,An)),this.text[dn]=String.fromCharCode.apply(String,hn.slice(An+1));break;case"IEND":return cn&&this.animation.frames.push(cn),this.colors=function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this),this.hasAlphaChannel=4===(mn=this.colorType)||6===mn,nn=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*nn,this.colorSpace=function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=tn}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}a.prototype.read=function(en){var tn,nn;for(nn=[],tn=0;0<=en?tn<en:tn>en;0<=en?++tn:--tn)nn.push(this.data[this.pos++]);return nn},a.prototype.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},a.prototype.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},a.prototype.decodePixels=function(en){var tn=this.pixelBitlength/8,nn=new Uint8Array(this.width*this.height*tn),rn=0,an=this;if(null==en&&(en=this.imgD
/**
* @license
*
* Copyright (c) 2014 James Robb, https://github.com/jamesbrobb
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ====================================================================
*/
/**
* @license
* (c) Dean McNamee <dean@gmail.com>, 2013.
*
* https://github.com/deanm/omggif
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
* omggif is a JavaScript implementation of a GIF 89a encoder and decoder,
* including animation and compression. It does not rely on any specific
* underlying system, so should run in the browser, Node, or Plask.
*/function Zt(en){var tn=0;if(71!==en[tn++]||73!==en[tn++]||70!==en[tn++]||56!==en[tn++]||56!=(en[tn++]+1&253)||97!==en[tn++])throw new Error("Invalid GIF 87a/89a header.");var nn=en[tn++]|en[tn++]<<8,rn=en[tn++]|en[tn++]<<8,an=en[tn++],sn=an>>7,cn=1<<1+(7&an);en[tn++],en[tn++];var An=null,dn=null;sn&&(An=tn,dn=cn,tn+=3*cn);var un=!0,pn=[],hn=0,gn=null,_n=0,mn=null;for(this.width=nn,this.height=rn;un&&tn<en.length;)switch(en[tn++]){case 33:switch(en[tn++]){case 255:if(11!==en[tn]||78==en[tn+1]&&69==en[tn+2]&&84==en[tn+3]&&83==en[tn+4]&&67==en[tn+5]&&65==en[tn+6]&&80==en[tn+7]&&69==en[tn+8]&&50==en[tn+9]&&46==en[tn+10]&&48==en[tn+11]&&3==en[tn+12]&&1==en[tn+13]&&0==en[tn+16])tn+=14,mn=en[tn++]|en[tn++]<<8,tn++;else for(tn+=12;;){if(!((Ln=en[tn++])>=0))throw Error("Invalid block size");if(0===Ln)break;tn+=Ln}break;case 249:if(4!==en[tn++]||0!==en[tn+4])throw new Error("Invalid graphics extension block.");var fn=en[tn++];hn=en[tn++]|en[tn++]<<8,gn=en[tn++],0==(1&fn)&&(gn=null),_n=fn>>2&7,tn++;break;case 254:for(;;){if(!((Ln=en[tn++])>=0))throw Error("Invalid block size");if(0===Ln)break;tn+=Ln}break;default:throw new Error("Unknown graphic control label: 0x"+en[tn-1].toString(16))}break;case 44:var yn=en[tn++]|en[tn++]<<8,bn=en[tn++]|en[tn++]<<8,vn=en[tn++]|en[tn++]<<8,wn=en[tn++]|en[tn++]<<8,xn=en[tn++],kn=xn>>6&1,Cn=1<<1+(7&xn),Sn=An,Bn=dn,En=!1;xn>>7&&(En=!0,Sn=tn,Bn=Cn,tn+=3*Cn);var jn=tn;for(tn++;;){var Ln;if(!((Ln=en[tn++])>=0))throw Error("Invalid block size");if(0===Ln)break;tn+=Ln}pn.push({x:yn,y:bn,width:vn,height:wn,has_local_palette:En,palette_offset:Sn,palette_size:Bn,data_offset:jn,data_length:tn-jn,transparent_index:gn,interlaced:!!kn,delay:hn,disposal:_n});break;case 59:un=!1;break;default:throw new Error("Unknown gif block: 0x"+en[tn-1].toString(16))}this.numFrames=function(){return pn.length},this.loopCount=function(){return mn},this.frameInfo=function(en){if(en<0||en>=pn.length)throw new Error("Frame index out of range.");return pn[en]},this.decodeAndBlitFrameBGRA=function(tn,rn){var an=this.frameInfo(tn),sn=an.width*an.height,cn=new Uint8Array(sn);$t(en,an.data_offset,cn,sn);var An=an.palette_offset,dn=an.transparent_index;null===dn&&(dn=256);var un=an.width,pn=nn-un,hn=un,gn=4*(an.y*nn+an.x),_n=4*((an.y+an.height)*nn+an.x),mn=gn,fn=4*pn;!0===an.interlaced&&(fn+=4*nn*7);for(var yn=8,bn=0,vn=cn.length;bn<vn;++bn){var wn=cn[bn];if(0===hn&&(hn=un,(mn+=fn)>=_n&&(fn=4*pn+4*nn*(yn-1),mn=gn+(un+pn)*(yn<<1),yn>>=1)),wn===dn)mn+=4;else{var xn=en[An+3*wn],kn=en[An+3*wn+1],Cn=en[An+3*wn+2];rn[mn++]=Cn,rn[mn++]=kn,rn[mn++]=xn,rn[mn++]=255}--hn}},this.decodeAndBlitFrameRGBA=function(tn,rn){var an=this.frameInfo(tn),sn=an.width*an.height,cn=new Uint8Array(sn);$t(en,an.data_offset,cn,sn);var An=an.palette_offset,dn=an.transparent_index;null===dn&&(dn=256);var un=an.width,pn=nn-un,hn=un,gn=4*(an.y*nn+an.x),_n=4*((an.y+an.height)*nn+an.x),mn=gn,fn=4*pn;!0===an.interlaced&&(fn+=4*nn*7);for(var yn=8,bn=0,vn=cn.length;bn<vn;++bn){var wn=cn[bn];if(0===hn&&(hn=un,(mn+=fn)>=_n&&(fn=4*pn+4*nn*(yn-1),mn=gn+(un+pn)*(yn<<1),yn>>=1)),wn===dn)mn+=4;else{var xn=en[An+3*wn],kn=en[An+3*wn+1],Cn=en[An+3*wn+2];rn[mn++]=xn,rn[mn++]=kn,rn[mn++]=Cn,rn[mn++]=255}--hn}}}function $t(en,tn,nn,rn){for(var an=en[tn++],sn=1<<an,cn=sn+1,An=cn+1,dn=an+1,un=(1<<dn)-1,pn=0,hn=0,gn=0,_n=en[tn++],mn=new Int32Array(4096),fn=null;;){for(;pn<16&&0!==_n;)hn|=en[tn++]<<pn,pn+=8,1===_n?_n=en[tn++]:--_n;if(pn<dn)break;var yn=hn&un;if(hn>>=dn,pn-=dn,yn!==sn){if(yn===cn)break;for(var bn=yn<An?yn:fn,vn=0,wn=bn;wn>sn;)wn=mn[wn]>>8,++vn;var xn=wn;if(gn+vn+(bn!==yn?1:0)>rn)return void xl.log("Warning, gif stream longer than expected.");nn[gn++]=xn;var kn=gn+=vn;for(bn!==yn&&(nn[gn++]=xn),wn=bn;vn--;)wn=mn[wn],nn[--kn]=255&wn,wn>>=8;null!==fn&&An<4096&&(mn[An++]=fn<<8|xn,An>=un+1&&dn<12&&(++dn,un=un<<1|1)),fn=yn}else An=cn+1,un=(1<<(dn=an+1))-1,fn=null}return gn!==rn&&xl.log("Warning, gif stream shorter than expected."),nn;
/**
* @license
Copyright (c) 2008, Adobe Systems Incorporated
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Adobe Systems Incorporated nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/}function Qt(en){var tn,nn,rn,an,sn,cn=Math.floor,An=new Array(64),dn=new Array(64),un=new Array(64),pn=new Array(64),hn=new Array(65535),gn=new Array(65535),_n=new Array(64),mn=new Array(64),fn=[],yn=0,bn=7,vn=new Array(64),wn=new Array(64),xn=new Array(64),kn=new Array(256),Cn=new Array(2048),Sn=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],Bn=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],En=[0,1,2,3,4,5,6,7,8,9,10,11],jn=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],Ln=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],Pn=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],Tn=[0,1,2,3,4,5,6,7,8,9,10,11],Fn=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],Un=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function j(en,tn){for(var nn=0,rn=0,an=new Array,sn=1;sn<=16;sn++){for(var cn=1;cn<=en[sn];cn++)an[tn[rn]]=[],an[tn[rn]][0]=nn,an[tn[rn]][1]=sn,rn++,nn++;nn*=2}return an}function O(en){for(var tn=en[0],nn=en[1]-1;nn>=0;)tn&1<<nn&&(yn|=1<<bn),nn--,--bn<0&&(255==yn?(B(255),B(0)):B(yn),bn=7,yn=0)}function B(en){fn.push(en)}function M(en){B(en>>8&255),B(255&en)}function E(en,tn,nn,rn,an){for(var sn,cn=an[0],An=an[240],dn=function(en,tn){var nn,rn,an,sn,cn,An,dn,un,pn,hn,gn=0;for(pn=0;pn<8;++pn){nn=en[gn],rn=en[gn+1],an=en[gn+2],sn=en[gn+3],cn=en[gn+4],An=en[gn+5],dn=en[gn+6];var mn=nn+(un=en[gn+7]),fn=nn-un,yn=rn+dn,bn=rn-dn,vn=an+An,wn=an-An,xn=sn+cn,kn=sn-cn,Cn=mn+xn,Sn=mn-xn,Bn=yn+vn,En=yn-vn;en[gn]=Cn+Bn,en[gn+4]=Cn-Bn;var jn=.707106781*(En+Sn);en[gn+2]=Sn+jn,en[gn+6]=Sn-jn;var Ln=.382683433*((Cn=kn+wn)-(En=bn+fn)),Pn=.5411961*Cn+Ln,Tn=1.306562965*En+Ln,Fn=.707106781*(Bn=wn+bn),Un=fn+Fn,Nn=fn-Fn;en[gn+5]=Nn+Pn,en[gn+3]=Nn-Pn,en[gn+1]=Un+Tn,en[gn+7]=Un-Tn,gn+=8}for(gn=0,pn=0;pn<8;++pn){nn=en[gn],rn=en[gn+8],an=en[gn+16],sn=en[gn+24],cn=en[gn+32],An=en[gn+40],dn=en[gn+48];var In=nn+(un=en[gn+56]),Mn=nn-un,Rn=rn+dn,On=rn-dn,Qn=an+An,qn=an-An,Vn=sn+cn,Gn=sn-cn,Dn=In+Vn,Hn=In-Vn,zn=Rn+Qn,Kn=Rn-Qn;en[gn]=Dn+zn,en[gn+32]=Dn-zn;var $n=.707106781*(Kn+Hn);en[gn+16]=Hn+$n,en[gn+48]=Hn-$n;var Wn=.382683433*((Dn=Gn+qn)-(Kn=On+Mn)),Xn=.5411961*Dn+Wn,Yn=1.306562965*Kn+Wn,Zn=.707106781*(zn=qn+On),Jn=Mn+Zn,Tr=Mn-Zn;en[gn+40]=Tr+Xn,en[gn+24]=Tr-Xn,en[gn+8]=Jn+Yn,en[gn+56]=Jn-Yn,gn++}for(pn=0;pn<64;++pn)hn=en[pn]*tn[pn],_n[pn]=hn>0?hn+.5|0:hn-.5|0;return _n}(en,tn),un=0;un<64;++un)mn[Sn[un]]=dn[un];var pn=mn[0]-nn;nn=mn[0],0==pn?O(rn[0]):(O(rn[gn[sn=32767+pn]]),O(hn[sn]));for(var fn=63;fn>0&&0==mn[fn];)fn--;if(0==fn)return O(cn),nn;for(var yn,bn=1;bn<=fn;){for(var vn=bn;0==mn[bn]&&bn<=fn;)++bn;var wn=bn-vn;if(wn>=16){yn=wn>>4;for(var xn=1;xn<=yn;++xn)O(An);wn&=15}sn=32767+mn[bn],O(an[(wn<<4)+gn[sn]]),O(hn[sn]),bn++}return 63!=fn&&O(cn),nn}function q(en){en=Math.min(Math.max(en,1),100),sn!=en&&(function(en){for(var tn=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,1
/**
* @license
* Copyright (c) 2017 Aras Abbasi
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/function te(en,tn){if(this.pos=0,this.buffer=en,this.datav=new DataView(en.buffer),this.is_with_alpha=!!tn,this.bottom_up=!0,this.flag=String.fromCharCode(this.buffer[0])+String.fromCharCode(this.buffer[1]),this.pos+=2,-1===["BM","BA","CI","CP","IC","PT"].indexOf(this.flag))throw new Error("Invalid BMP File");this.parseHeader(),this.parseBGR()}function ee(en){function e(en){if(!en)throw Error("assert :P")}function r(en,tn,nn){for(var rn=0;4>rn;rn++)if(en[tn+rn]!=nn.charCodeAt(rn))return!0;return!1}function n(en,tn,nn,rn,an){for(var sn=0;sn<an;sn++)en[tn+sn]=nn[rn+sn]}function i(en,tn,nn,rn){for(var an=0;an<rn;an++)en[tn+an]=nn}function a(en){return new Int32Array(en)}function o(en,tn){for(var nn=[],rn=0;rn<en;rn++)nn.push(new tn);return nn}function s(en,tn){var nn=[];return function t(en,nn,rn){for(var an=rn[nn],sn=0;sn<an&&(en.push(rn.length>nn+1?[]:new tn),!(rn.length<nn+1));sn++)t(en[sn],nn+1,rn)}(nn,0,en),nn}var c=function(){var en=this;function c(en,tn){for(var nn=1<<tn-1>>>0;en&nn;)nn>>>=1;return nn?(en&nn-1)+nn:en}function u(en,tn,nn,rn,an){e(!(rn%nn));do{en[tn+(rn-=nn)]=an}while(0<rn)}function h(en,tn,nn,rn,an){if(e(2328>=an),512>=an)var sn=a(512);else if(null==(sn=a(an)))return 0;return function(en,tn,nn,rn,an,sn){var cn,An,dn=tn,un=1<<nn,pn=a(16),hn=a(16);for(e(0!=an),e(null!=rn),e(null!=en),e(0<nn),An=0;An<an;++An){if(15<rn[An])return 0;++pn[rn[An]]}if(pn[0]==an)return 0;for(hn[1]=0,cn=1;15>cn;++cn){if(pn[cn]>1<<cn)return 0;hn[cn+1]=hn[cn]+pn[cn]}for(An=0;An<an;++An)cn=rn[An],0<rn[An]&&(sn[hn[cn]++]=An);if(1==hn[15])return(rn=new l).g=0,rn.value=sn[0],u(en,dn,1,un,rn),un;var gn,_n=-1,mn=un-1,fn=0,yn=1,bn=1,vn=1<<nn;for(An=0,cn=1,an=2;cn<=nn;++cn,an<<=1){if(yn+=bn<<=1,0>(bn-=pn[cn]))return 0;for(;0<pn[cn];--pn[cn])(rn=new l).g=cn,rn.value=sn[An++],u(en,dn+fn,an,vn,rn),fn=c(fn,cn)}for(cn=nn+1,an=2;15>=cn;++cn,an<<=1){if(yn+=bn<<=1,0>(bn-=pn[cn]))return 0;for(;0<pn[cn];--pn[cn]){if(rn=new l,(fn&mn)!=_n){for(dn+=vn,gn=1<<(_n=cn)-nn;15>_n&&!(0>=(gn-=pn[_n]));)++_n,gn<<=1;un+=vn=1<<(gn=_n-nn),en[tn+(_n=fn&mn)].g=gn+nn,en[tn+_n].value=dn-tn-_n}rn.g=cn-nn,rn.value=sn[An++],u(en,dn+(fn>>nn),an,vn,rn),fn=c(fn,cn)}}return yn!=2*hn[15]-1?0:un}(en,tn,nn,rn,an,sn)}function l(){this.value=this.g=0}function f(){this.value=this.g=0}function d(){this.G=o(5,l),this.H=a(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=o(tn,f)}function p(en,tn,nn,rn){e(null!=en),e(null!=tn),e(2147483648>rn),en.Ca=254,en.I=0,en.b=-8,en.Ka=0,en.oa=tn,en.pa=nn,en.Jd=tn,en.Yc=nn+rn,en.Zc=4<=rn?nn+rn-4+1:nn,_(en)}function g(en,tn){for(var nn=0;0<tn--;)nn|=k(en,128)<<tn;return nn}function m(en,tn){var nn=g(en,tn);return P(en)?-nn:nn}function v(en,tn,nn,rn){var an,sn=0;for(e(null!=en),e(null!=tn),e(4294967288>rn),en.Sb=rn,en.Ra=0,en.u=0,en.h=0,4<rn&&(rn=4),an=0;an<rn;++an)sn+=tn[nn+an]<<8*an;en.Ra=sn,en.bb=rn,en.oa=tn,en.pa=nn}function b(en){for(;8<=en.u&&en.bb<en.Sb;)en.Ra>>>=8,en.Ra+=en.oa[en.pa+en.bb]<<an-8>>>0,++en.bb,en.u-=8;A(en)&&(en.h=1,en.u=0)}function y(en,tn){if(e(0<=tn),!en.h&&tn<=rn){var an=L(en)&nn[tn];return en.u+=tn,b(en),an}return en.h=1,en.u=0}function w(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function N(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function L(en){return en.Ra>>>(en.u&an-1)>>>0}function A(en){return e(en.bb<=en.Sb),en.h||en.bb==en.Sb&&en.u>an}function x(en,tn){en.u=tn,en.h=A(en)}function S(en){en.u>=sn&&(e(en.u>=sn),b(en))}function _(en){e(null!=en&&null!=en.oa),en.pa<en.Zc?(en.I=(en.oa[en.pa++]|en.I<<8)>>>0,en.b+=8):(e(null!=en&&null!=en.oa),en.pa<en.Yc?(en.b+=8,en.I=en.oa[en.pa++]|en.I<<8):en.Ka?en.b=0:(en.I<<=8,en.b+=8,en.Ka=1))}function P(en){return g(en,1)}function k(en,tn){var nn=en.Ca;0>en.b&&_(en);var rn=en.b,an=nn*tn>>>8,sn=(en.I>>>rn>an)+0;for(sn?(nn-=an,en.I-=an+1<<rn>>>0):nn=an+1,rn=nn,an=0;256<=rn;)an+=8,rn>>=8;return rn=7^an+cn[rn],en.b-=rn,en.Ca=(nn<<rn)-1,sn}function I(en,tn,nn){en[tn+0]=nn>>24&255,en[tn+1]=nn>>16&255,en[tn+2]=nn>>8&255,en[tn+3]=nn>>0&255}function F(en,tn){return en[tn+0]<<0|en[tn+1]<<8}function C(en,tn){return F(en,tn)|
/** @license
* Copyright (c) 2017 Dominik Homberger
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
https://webpjs.appspot.com
WebPRiffParser dominikhlbg@gmail.com
*/
function(en,tn,nn,rn){for(var an=0;an<4;an++)if(en[tn+an]!="RIFF".charCodeAt(an))return!0;return!1}(en,tn)){var An,dn;for(l(en,tn+=4),tn+=8;tn<en.length;){var un=u(en,tn),pn=l(en,tn+=4);tn+=4;var hn=pn+(1&pn);switch(un){case"VP8 ":case"VP8L":void 0===nn.frames[rn]&&(nn.frames[rn]={}),(mn=nn.frames[rn]).src_off=an?cn:tn-8,mn.src_size=sn+pn+8,rn++,an&&(an=!1,sn=0,cn=0);break;case"VP8X":(mn=nn.header={}).feature_flags=en[tn];var gn=tn+4;mn.canvas_width=1+h(en,gn),gn+=3,mn.canvas_height=1+h(en,gn),gn+=3;break;case"ALPH":an=!0,sn=hn+8,cn=tn-8;break;case"ANIM":(mn=nn.header).bgcolor=l(en,tn),gn=tn+4,mn.loop_count=(An=en)[(dn=gn)+0]<<0|An[dn+1]<<8,gn+=2;break;case"ANMF":var _n,mn;(mn=nn.frames[rn]={}).offset_x=2*h(en,tn),tn+=3,mn.offset_y=2*h(en,tn),tn+=3,mn.width=1+h(en,tn),tn+=3,mn.height=1+h(en,tn),tn+=3,mn.duration=h(en,tn),tn+=3,_n=en[tn++],mn.dispose=1&_n,mn.blend=_n>>1&1}"ANMF"!=un&&(tn+=hn)}return nn}}(sn,0);cn.response=sn,cn.rgbaoutput=!0,cn.dataurl=!1;var An=cn.header?cn.header:null,dn=cn.frames?cn.frames:null;if(An){An.loop_counter=An.loop_count,tn=[An.canvas_height],nn=[An.canvas_width];for(var un=0;un<dn.length&&0!=dn[un].blend;un++);}var pn=dn[0],hn=an.WebPDecodeRGBA(sn,pn.src_off,pn.src_size,nn,tn);pn.rgba=hn,pn.imgwidth=nn[0],pn.imgheight=tn[0];for(var gn=0;gn<nn[0]*tn[0]*4;gn++)rn[gn]=hn[gn];return this.width=nn,this.height=tn,this.data=rn,this}!function(en){var n=function(tn,nn,rn,an){var sn=4,cn=s;switch(an){case en.image_compression.FAST:sn=1,cn=o;break;case en.image_compression.MEDIUM:sn=6,cn=c;break;case en.image_compression.SLOW:sn=9,cn=u}var An=zlibSync(tn=i(tn,nn,rn,cn),{level:sn});return en.__addimage__.arrayBufferToBinaryString(An)},i=function(en,tn,nn,rn){for(var an,sn,cn,An=en.length/tn,dn=new Uint8Array(en.length+An),un=l(),pn=0;pn<An;pn+=1){if(cn=pn*tn,an=en.subarray(cn,cn+tn),rn)dn.set(rn(an,nn,sn),cn+pn);else{for(var hn,gn=un.length,_n=[];hn<gn;hn+=1)_n[hn]=un[hn](an,nn,sn);var mn=f(_n.concat());dn.set(_n[mn],cn+pn)}sn=an}return dn},a=function(en){var tn=Array.apply([],en);return tn.unshift(0),tn},o=function(en,tn){var nn,rn=[],an=en.length;rn[0]=1;for(var sn=0;sn<an;sn+=1)nn=en[sn-tn]||0,rn[sn+1]=en[sn]-nn+256&255;return rn},s=function(en,tn,nn){var rn,an=[],sn=en.length;an[0]=2;for(var cn=0;cn<sn;cn+=1)rn=nn&&nn[cn]||0,an[cn+1]=en[cn]-rn+256&255;return an},c=function(en,tn,nn){var rn,an,sn=[],cn=en.length;sn[0]=3;for(var An=0;An<cn;An+=1)rn=en[An-tn]||0,an=nn&&nn[An]||0,sn[An+1]=en[An]+256-(rn+an>>>1)&255;return sn},u=function(en,tn,nn){var rn,an,sn,cn,An=[],dn=en.length;An[0]=4;for(var un=0;un<dn;un+=1)rn=en[un-tn]||0,an=nn&&nn[un]||0,sn=nn&&nn[un-tn]||0,cn=h(rn,an,sn),An[un+1]=en[un]-cn+256&255;return An},h=function(en,tn,nn){if(en===tn&&tn===nn)return en;var rn=Math.abs(tn-nn),an=Math.abs(en-nn),sn=Math.abs(en+tn-nn-nn);return rn<=an&&rn<=sn?en:an<=sn?tn:nn},l=function(){return[a,o,s,c,u]},f=function(en){var tn=en.map((function(en){return en.reduce((function(en,tn){return en+Math.abs(tn)}),0)}));return tn.indexOf(Math.min.apply(null,tn))};en.processPNG=function(tn,nn,rn,an){var sn,cn,An,dn,un,pn,hn,gn,_n,mn,fn,yn,bn,vn,wn,xn=this.decode.FLATE_DECODE,kn="";if(this.__addimage__.isArrayBuffer(tn)&&(tn=new Uint8Array(tn)),this.__addimage__.isArrayBufferView(tn)){if(tn=(An=new ac(tn)).imgData,cn=An.bits,sn=An.colorSpace,un=An.colors,-1!==[4,6].indexOf(An.colorType)){if(8===An.bits){_n=(gn=32==An.pixelBitlength?new Uint32Array(An.decodePixels().buffer):16==An.pixelBitlength?new Uint16Array(An.decodePixels().buffer):new Uint8Array(An.decodePixels().buffer)).length,fn=new Uint8Array(_n*An.colors),mn=new Uint8Array(_n);var Cn,Sn=An.pixelBitlength-An.bits;for(vn=0,wn=0;vn<_n;vn++){for(bn=gn[vn],Cn=0;Cn<Sn;)fn[wn++]=bn>>>Cn&255,Cn+=An.bits;mn[vn]=bn>>>Cn&255}}if(16===An.bits){_n=(gn=new Uint32Array(An.decodePixels().buffer)).length,fn=new Uint8Array(_n*(32/An.pixelBitlength)*An.colors),mn=new Uint8Array(_n*(32/An.pixelBitlength)),yn=An.colors>1,vn=0,wn=0;for(var Bn=0;vn<_n;)bn=gn[vn++],fn[wn++]=bn>>>0&255,yn&&(fn[wn++]=bn>>>16&255,bn=gn[vn++],fn[wn++]=bn>>>0&255),mn[Bn++]=bn>>>16&255;cn=8}an!==en.ima
/**
* @license
* Copyright (c) 2018 Aras Abbasi
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
function(en){en.processBMP=function(tn,nn,rn,an){var sn=new te(tn,!1),cn=sn.width,An=sn.height,dn={data:sn.getData(),width:cn,height:An},un=new Qt(100).encode(dn,100);return en.processJPEG.call(this,un,nn,rn,an)}}(E.API),ee.prototype.getData=function(){return this.data},
/**
* @license
* Copyright (c) 2019 Aras Abbasi
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
function(en){en.processWEBP=function(tn,nn,rn,an){var sn=new ee(tn),cn=sn.width,An=sn.height,dn={data:sn.getData(),width:cn,height:An},un=new Qt(100).encode(dn,100);return en.processJPEG.call(this,un,nn,rn,an)}}(E.API),E.API.processRGBA=function(en,tn,nn){for(var rn=en.data,an=rn.length,sn=new Uint8Array(an/4*3),cn=new Uint8Array(an/4),An=0,dn=0,un=0;un<an;un+=4){var pn=rn[un],hn=rn[un+1],gn=rn[un+2],_n=rn[un+3];sn[An++]=pn,sn[An++]=hn,sn[An++]=gn,cn[dn++]=_n}var mn=this.__addimage__.arrayBufferToBinaryString(sn);return{alpha:this.__addimage__.arrayBufferToBinaryString(cn),data:mn,index:tn,alias:nn,colorSpace:"DeviceRGB",bitsPerComponent:8,width:en.width,height:en.height}},E.API.setLanguage=function(en){return void 0===this.internal.languageSettings&&(this.internal.languageSettings={},this.internal.languageSettings.isSubscribed=!1),void 0!=={af:"Afrikaans",sq:"Albanian",ar:"Arabic (Standard)","ar-DZ":"Arabic (Algeria)","ar-BH":"Arabic (Bahrain)","ar-EG":"Arabic (Egypt)","ar-IQ":"Arabic (Iraq)","ar-JO":"Arabic (Jordan)","ar-KW":"Arabic (Kuwait)","ar-LB":"Arabic (Lebanon)","ar-LY":"Arabic (Libya)","ar-MA":"Arabic (Morocco)","ar-OM":"Arabic (Oman)","ar-QA":"Arabic (Qatar)","ar-SA":"Arabic (Saudi Arabia)","ar-SY":"Arabic (Syria)","ar-TN":"Arabic (Tunisia)","ar-AE":"Arabic (U.A.E.)","ar-YE":"Arabic (Yemen)",an:"Aragonese",hy:"Armenian",as:"Assamese",ast:"Asturian",az:"Azerbaijani",eu:"Basque",be:"Belarusian",bn:"Bengali",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",zh:"Chinese","zh-HK":"Chinese (Hong Kong)","zh-CN":"Chinese (PRC)","zh-SG":"Chinese (Singapore)","zh-TW":"Chinese (Taiwan)",cv:"Chuvash",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch (Standard)","nl-BE":"Dutch (Belgian)",en:"English","en-AU":"English (Australia)","en-BZ":"English (Belize)","en-CA":"English (Canada)","en-IE":"English (Ireland)","en-JM":"English (Jamaica)","en-NZ":"English (New Zealand)","en-PH":"English (Philippines)","en-ZA":"English (South Africa)","en-TT":"English (Trinidad & Tobago)","en-GB":"English (United Kingdom)","en-US":"English (United States)","en-ZW":"English (Zimbabwe)",eo:"Esperanto",et:"Estonian",fo:"Faeroese",fj:"Fijian",fi:"Finnish",fr:"French (Standard)","fr-BE":"French (Belgium)","fr-CA":"French (Canada)","fr-FR":"French (France)","fr-LU":"French (Luxembourg)","fr-MC":"French (Monaco)","fr-CH":"French (Switzerland)",fy:"Frisian",fur:"Friulian",gd:"Gaelic (Scots)","gd-IE":"Gaelic (Irish)",gl:"Galacian",ka:"Georgian",de:"German (Standard)","de-AT":"German (Austria)","de-DE":"German (Germany)","de-LI":"German (Liechtenstein)","de-LU":"German (Luxembourg)","de-CH":"German (Switzerland)",el:"Greek",gu:"Gujurati",ht:"Haitian",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",iu:"Inuktitut",ga:"Irish",it:"Italian (Standard)","it-CH":"Italian (Switzerland)",ja:"Japanese",kn:"Kannada",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ky:"Kirghiz",tlh:"Klingon",ko:"Korean","ko-KP":"Korean (North Korea)","ko-KR":"Korean (South Korea)",la:"Latin",lv:"Latvian",lt:"Lithuanian",lb:"Luxembourgish",mk:"North Macedonia",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mo:"Moldavian",nv:"Navajo",ng:"Ndonga",ne:"Nepali",no:"Norwegian",nb:"Norwegian (Bokmal)",nn:"Norwegian (Nynorsk)",oc:"Occitan",or:"Oriya",om:"Oromo",fa:"Persian","fa-IR":"Persian/Iran",pl:"Polish",pt:"Portuguese","pt-BR":"Portuguese (Brazil)",pa:"Punjabi","pa-IN":"Punjabi (India)","pa-PK":"Punjabi (Pakistan)",qu:"Quechua",rm:"Rhaeto-Romanic",ro:"Romanian","ro-MO":"Romanian (Moldavia)",ru:"Russian","ru-MO":"Russian (Moldavia)",sz:"Sami (Lappish)",sg:"Sango",sa:"Sanskrit",sc:"Sardinian",sd:"Sindhi",si:"Singhalese",sr:"Serbian",sk:"Slovak",sl:"Slovenian",so:"Somani",sb:"Sorbian",es:"Spanish","es-AR":"Spanish (Argentina)","es-BO":"Spanish (Bolivia)","es-CL":"Spanish (Chile)","es-CO":"Spanish (Colombia)","es-CR":"Spanish (Costa Rica)","es-DO":"Spanish (Dominican Republic)","es-EC":"Spanish (Ecuador)","es-SV":"Spanish (El Salvador)","es-GT":"Spanish (Guatemala)","es-HN":"Spanish (Honduras)","es-M
/**
* @license
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
function(en){var e=function(en){for(var tn=en.length,nn=new Uint8Array(tn),rn=0;rn<tn;rn++)nn[rn]=en.charCodeAt(rn);return nn};en.API.events.push(["addFont",function(tn){var nn=void 0,rn=tn.font,an=tn.instance;if(!rn.isStandardFont){if(void 0===an)throw new Error("Font does not exist in vFS, import fonts or remove declaration doc.addFont('"+rn.postScriptName+"').");if("string"!=typeof(nn=!1===an.existsFileInVFS(rn.postScriptName)?an.loadFile(rn.postScriptName):an.getFileFromVFS(rn.postScriptName)))throw new Error("Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('"+rn.postScriptName+"').");!function(tn,nn){nn=/^\x00\x01\x00\x00/.test(nn)?e(nn):e(kl(nn)),tn.metadata=en.API.TTFFont.open(nn),tn.metadata.Unicode=tn.metadata.Unicode||{encoding:{},kerning:{},widths:[]},tn.metadata.glyIdsUsed=[0]}(rn,nn)}}])}(E),
/** @license
* Copyright (c) 2012 Willow Systems Corporation, https://github.com/willowsystems
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ====================================================================
*/
function(en){function e(){return(wl.canvg?Promise.resolve(wl.canvg):Promise.resolve().then((function(){return NC}))).catch((function(en){return Promise.reject(new Error("Could not load canvg: "+en))})).then((function(en){return en.default?en.default:en}))}E.API.addSvgAsImage=function(en,tn,nn,rn,an,sn,cn,An){if(isNaN(tn)||isNaN(nn))throw xl.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(rn)||isNaN(an))throw xl.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var dn=document.createElement("canvas");dn.width=rn,dn.height=an;var un=dn.getContext("2d");un.fillStyle="#fff",un.fillRect(0,0,dn.width,dn.height);var pn={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},hn=this;return e().then((function(tn){return tn.fromString(un,en,pn)}),(function(){return Promise.reject(new Error("Could not load canvg."))})).then((function(en){return en.render(pn)})).then((function(){hn.addImage(dn.toDataURL("image/jpeg",1),tn,nn,rn,an,cn,An)}))}}(),E.API.putTotalPages=function(en){var tn,nn=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(tn=new RegExp(en,"g"),nn=this.internal.getNumberOfPages()):(tn=new RegExp(this.pdfEscape16(en,this.internal.getFont()),"g"),nn=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var rn=1;rn<=this.internal.getNumberOfPages();rn++)for(var an=0;an<this.internal.pages[rn].length;an++)this.internal.pages[rn][an]=this.internal.pages[rn][an].replace(tn,nn);return this},E.API.viewerPreferences=function(en,tn){var nn;en=en||{},tn=tn||!1;var rn,an,sn,cn={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},An=Object.keys(cn),dn=[],un=0,pn=0,hn=0;function d(en,tn){var nn,rn=!1;for(nn=0;nn<en.length;nn+=1)en[nn]===tn&&(rn=!0);return rn}if(void 0===this.internal.viewerpreferences&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(cn)),this.internal.view
/** ====================================================================
* @license
* jsPDF XMP metadata plugin
* Copyright (c) 2016 Jussi Utunen, u-jussi@suomi24.fi
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ====================================================================
*/
function(en){var e=function(){var en='<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:jspdf="'+this.internal.__metadata__.namespaceuri+'"><jspdf:metadata>',tn=unescape(encodeURIComponent('<x:xmpmeta xmlns:x="adobe:ns:meta/">')),nn=unescape(encodeURIComponent(en)),rn=unescape(encodeURIComponent(this.internal.__metadata__.metadata)),an=unescape(encodeURIComponent("</jspdf:metadata></rdf:Description></rdf:RDF>")),sn=unescape(encodeURIComponent("</x:xmpmeta>")),cn=nn.length+rn.length+an.length+tn.length+sn.length;this.internal.__metadata__.metadata_object_number=this.internal.newObject(),this.internal.write("<< /Type /Metadata /Subtype /XML /Length "+cn+" >>"),this.internal.write("stream"),this.internal.write(tn+nn+rn+an+sn),this.internal.write("endstream"),this.internal.write("endobj")},r=function(){this.internal.__metadata__.metadata_object_number&&this.internal.write("/Metadata "+this.internal.__metadata__.metadata_object_number+" 0 R")};en.addMetadata=function(en,tn){return void 0===this.internal.__metadata__&&(this.internal.__metadata__={metadata:en,namespaceuri:tn||"http://jspdf.default.namespaceuri/"},this.internal.events.subscribe("putCatalog",r),this.internal.events.subscribe("postPutResources",e)),this}}(E.API),function(en){var tn=en.API,nn=tn.pdfEscape16=function(en,tn){for(var nn,rn=tn.metadata.Unicode.widths,an=["","0","00","000","0000"],sn=[""],cn=0,An=en.length;cn<An;++cn){if(nn=tn.metadata.characterToGlyph(en.charCodeAt(cn)),tn.metadata.glyIdsUsed.push(nn),tn.metadata.toUnicode[nn]=en.charCodeAt(cn),-1==rn.indexOf(nn)&&(rn.push(nn),rn.push([parseInt(tn.metadata.widthOfGlyph(nn),10)])),"0"==nn)return sn.join("");nn=nn.toString(16),sn.push(an[4-nn.length],nn)}return sn.join("")},n=function(en){var tn,nn,rn,an,sn,cn,An;for(sn="/CIDInit /ProcSet findresource begin\n12 dict begin\nbegincmap\n/CIDSystemInfo <<\n /Registry (Adobe)\n /Ordering (UCS)\n /Supplement 0\n>> def\n/CMapName /Adobe-Identity-UCS def\n/CMapType 2 def\n1 begincodespacerange\n<0000><ffff>\nendcodespacerange",rn=[],cn=0,An=(nn=Object.keys(en).sort((function(en,tn){return en-tn}))).length;cn<An;cn++)tn=nn[cn],rn.length>=100&&(sn+="\n"+rn.length+" beginbfchar\n"+rn.join("\n")+"\nendbfchar",rn=[]),void 0!==en[tn]&&null!==en[tn]&&"function"==typeof en[tn].toString&&(an=("0000"+en[tn].toString(16)).slice(-4),tn=("0000"+(+tn).toString(16)).slice(-4),rn.push("<"+tn+"><"+an+">"));return rn.length&&(sn+="\n"+rn.length+" beginbfchar\n"+rn.join("\n")+"\nendbfchar\n"),sn+"endcmap\nCMapName currentdict /CMap defineresource pop\nend\nend"};tn.events.push(["putFont",function(tn){!function(tn){var nn=tn.font,rn=tn.out,an=tn.newObject,sn=tn.putStream;if(nn.metadata instanceof en.API.TTFFont&&"Identity-H"===nn.encoding){for(var cn=nn.metadata.Unicode.widths,An=nn.metadata.subset.encode(nn.metadata.glyIdsUsed,1),dn="",un=0;un<An.length;un++)dn+=String.fromCharCode(An[un]);var pn=an();sn({data:dn,addLength1:!0,objectId:pn}),rn("endobj");var hn=an();sn({data:n(nn.metadata.toUnicode),addLength1:!0,objectId:hn}),rn("endobj");var gn=an();rn("<<"),rn("/Type /FontDescriptor"),rn("/FontName /"+F(nn.fontName)),rn("/FontFile2 "+pn+" 0 R"),rn("/FontBBox "+en.API.PDFObject.convert(nn.metadata.bbox)),rn("/Flags "+nn.metadata.flags),rn("/StemV "+nn.metadata.stemV),rn("/ItalicAngle "+nn.metadata.italicAngle),rn("/Ascent "+nn.metadata.ascender),rn("/Descent "+nn.metadata.decender),rn("/CapHeight "+nn.metadata.capHeight),rn(">>"),rn("endobj");var _n=an();rn("<<"),rn("/Type /Font"),rn("/BaseFont /"+F(nn.fontName)),rn("/FontDescriptor "+gn+" 0 R"),rn("/W "+en.API.PDFObject.convert(cn)),rn("/CIDToGIDMap /Identity"),rn("/DW 1000"),rn("/Subtype /CIDFontType2"),rn("/CIDSystemInfo"),rn("<<"),rn("/Supplement 0"),rn("/Registry (Adobe)"),rn("/Ordering ("+nn.encoding+")"),rn(">>"),rn(">>"),rn("endobj"),nn.objectNumber=an(),rn("<<"),rn("/Type /Font"),rn("/Subtype /Type0"),rn("/ToUnicode "+hn+" 0 R"),rn("/BaseFont /"+F(nn.fontName)),rn("/Encoding /"+nn.encoding),rn("/DescendantFonts ["+_n+" 0 R]"),rn(">>"),rn("endobj"),nn.isAlreadyPutted=
/**
* @license
* jsPDF virtual FileSystem functionality
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
function(en){var e=function(){return void 0===this.internal.vFS&&(this.internal.vFS={}),!0};en.existsFileInVFS=function(en){return e.call(this),void 0!==this.internal.vFS[en]},en.addFileToVFS=function(en,tn){return e.call(this),this.internal.vFS[en]=tn,this},en.getFileFromVFS=function(en){return e.call(this),void 0!==this.internal.vFS[en]?this.internal.vFS[en]:null}}(E.API),
/**
* @license
* Unicode Bidi Engine based on the work of Alex Shensis (@asthensis)
* MIT License
*/
function(en){en.__bidiEngine__=en.prototype.__bidiEngine__=function(en){var nn,rn,an,sn,cn,An,dn,un=tn,pn=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],hn=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],gn={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},_n={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},mn=["(",")","(","<",">","<","[","]","[","{","}","{","«","»","«","","","","⁅","⁆","⁅","⁽","⁾","⁽","₍","₎","₍","≤","≥","≤","〈","〉","〈","﹙","﹚","﹙","﹛","﹜","﹛","﹝","﹞","﹝","﹤","﹥","﹤"],fn=new RegExp(/^([1-4|9]|1[0-9]|2[0-9]|3[0168]|4[04589]|5[012]|7[78]|159|16[0-9]|17[0-2]|21[569]|22[03489]|250)$/),yn=!1,bn=0;this.__bidiEngine__={};var b=function(en){var tn=en.charCodeAt(),nn=tn>>8,rn=_n[nn];return void 0!==rn?un[256*rn+(255&tn)]:252===nn||253===nn?"AL":fn.test(nn)?"L":8===nn?"R":"N"},y=function(en){for(var tn,nn=0;nn<en.length;nn++){if("L"===(tn=b(en.charAt(nn))))return!1;if("R"===tn)return!0}return!1},w=function(en,tn,cn,An){var dn,un,pn,hn,gn=tn[An];switch(gn){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":yn=!1;break;case"N":case"AN":break;case"EN":yn&&(gn="AN");break;case"AL":yn=!0,gn="R";break;case"WS":case"BN":gn="N";break;case"CS":An<1||An+1>=tn.length||"EN"!==(dn=cn[An-1])&&"AN"!==dn||"EN"!==(un=tn[An+1])&&"AN"!==un?gn="N":yn&&(un="AN"),gn=un===dn?un:"N";break;case"ES":gn="EN"===(dn=An>0?cn[An-1]:"B")&&An+1<tn.length&&"EN"===tn[An+1]?"EN":"N";break;case"ET":if(An>0&&"EN"===cn[An-1]){gn="EN";break}if(yn){gn="N";break}for(pn=An+1,hn=tn.length;pn<hn&&"ET"===tn[pn];)pn++;gn=pn<hn&&"EN"===tn[pn]?"EN":"N";break;case"NSM":if(an&&!sn){for(hn=tn.length,pn=An+1;pn<hn&&"NSM"===tn[pn];)pn++;if(pn<hn){var _n=en[An],mn=_n>=1425&&_n<=2303||64286===_n;if(dn=tn[pn],mn&&("R"===dn||"AL"===dn)){gn="R";break}}}gn=An<1||"B"===(dn=tn[An-1])?"N":cn[An-1];break;case"B":yn=!1,nn=!0,gn=bn;break;case"S":rn=!0,gn="N"}return gn},N=function(en,tn,nn){var rn=en.split("");return nn&&L(rn,nn,{hiLevel:bn}),rn.reverse(),tn&&tn.reverse(),rn.join("")},L=function(en,tn,an){var sn,cn,An,dn,un,_n=-1,mn=en.length,fn=0,vn=[],wn=bn?hn:pn,xn=[];for(yn=!1,nn=!1,rn=!1,cn=0;cn<mn;cn++)xn[cn]=b(en[cn]);for(An=0;An<mn;An++){if(un=fn,vn[An]=w(en,xn,vn,An),sn=240&(fn=wn[un][gn[vn[An]]]),fn&=15,tn[An]=dn=wn[fn][5],sn>0)if(16===sn){for(cn=_n;cn<An;cn++)tn[cn]=1;_n=-1}else _n=-1;if(wn[fn][6])-1===_n&&(_n=An);else if(_n>-1){for(cn=_n;cn<An;cn++)tn[cn]=dn;_n=-1}"B"===xn[An]&&(tn[An]=0),an.hiLevel|=dn}rn&&function(en,tn,nn){for(var rn=0;rn<nn;rn++)if("S"===en[rn]){tn[rn]=bn;for(var an=rn-1;an>=0&&"WS"===en[an];an--)tn[an]=bn}}(xn,tn,mn)},A=function(en,tn,rn,an,sn){if(!(sn.hiLevel<en)){if(1===en&&1===bn&&!nn)return tn.reverse(),void(rn&&rn.reverse());for(var cn,An,dn,un,pn=tn.length,hn=0;hn<pn;){if(an[hn]>=en){for(dn=hn+1;dn<pn&&an[dn]>=en;)dn++;for(un=hn,An=dn-1;un<An;un++,An--)cn=tn[un],tn[un]=tn[An],tn[An]=cn,rn&&(cn=rn[un],rn[un]=rn[An],rn[An]=cn);hn=dn}hn++}}},x=function(en,tn,nn){var rn=en.split(""),an={hiLevel:bn};return nn||(nn=[]),L(rn,nn,an),function(en,tn,nn){if(0!==nn.hiLevel&&dn)for(var rn,an=0;an<en.length;an++)1===tn[an]&&(rn=mn.indexOf(en[an]))>=0&&(en[an]=mn[rn+1])}(rn,nn,an),A(2,rn,tn,nn,an),A(1,rn,tn,nn,an),rn.join("")};return this.__bidiEngine__.doBidiReorder=function(en,tn,nn){if(function(en,tn){if(tn)for(var nn=0;nn<en.length;nn++)tn[nn]=nn;void 0===sn&&(sn=y(en)),void 0===An&&(An=y(en))}(en,tn),an||!cn||An)if(an&&cn&&sn^An)bn=sn?1:0,en=N(en,tn,nn);else if(!an&&cn&&An)bn=sn?1:0,en=x(en,tn,nn),en=N(en,tn);else if(!an||sn||cn||An){if(an&&!cn&&sn^An)en=N(en,tn),sn?(bn=0,en=x(en,tn,nn)):(bn=1,en=x(en,tn,nn),en=N(en,tn));else if(an&&sn&&!cn&&An)bn=1,en=x(en,tn,nn),en=N(en,tn);else if(!an&&!cn&&sn^An){var rn=dn;sn?(bn=1,en=x(en,tn,nn),bn=0,dn=!1,en=x(en,tn,nn),dn=rn):(bn=0,en=x(en,tn,nn),en=N(en,tn),bn=1,dn=!1,en=x(en,tn,nn),dn=rn,en=N(en,tn))}}else bn=0,en=x(en,tn,nn);else bn=sn?1:0,en=x(en,tn,nn);return en},this.__bidiEngine__.setOptions=function(en){en&&(an=en.isInputVisual,cn=en.isOutputVisual,sn=en.isInputRtl,An=en.isO
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var extendStatics=function(en,tn){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(en,tn){en.__proto__=tn}||function(en,tn){for(var nn in tn)Object.prototype.hasOwnProperty.call(tn,nn)&&(en[nn]=tn[nn])},extendStatics(en,tn)};function __extends(en,tn){if("function"!=typeof tn&&null!==tn)throw new TypeError("Class extends value "+String(tn)+" is not a constructor or null");function __(){this.constructor=en}extendStatics(en,tn),en.prototype=null===tn?Object.create(tn):(__.prototype=tn.prototype,new __)}var __assign=function(){return __assign=Object.assign||function __assign(en){for(var tn,nn=1,rn=arguments.length;nn<rn;nn++)for(var an in tn=arguments[nn])Object.prototype.hasOwnProperty.call(tn,an)&&(en[an]=tn[an]);return en},__assign.apply(this,arguments)};function __awaiter(en,tn,nn,rn){function adopt(en){return en instanceof nn?en:new nn((function(tn){tn(en)}))}return new(nn||(nn=Promise))((function(nn,an){function fulfilled(en){try{step(rn.next(en))}catch(en){an(en)}}function rejected(en){try{step(rn.throw(en))}catch(en){an(en)}}function step(en){en.done?nn(en.value):adopt(en.value).then(fulfilled,rejected)}step((rn=rn.apply(en,tn||[])).next())}))}function __generator(en,tn){var nn,rn,an,sn,cn={label:0,sent:function(){if(1&an[0])throw an[1];return an[1]},trys:[],ops:[]};return sn={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(sn[Symbol.iterator]=function(){return this}),sn;function verb(en){return function(tn){return step([en,tn])}}function step(sn){if(nn)throw new TypeError("Generator is already executing.");for(;cn;)try{if(nn=1,rn&&(an=2&sn[0]?rn.return:sn[0]?rn.throw||((an=rn.return)&&an.call(rn),0):rn.next)&&!(an=an.call(rn,sn[1])).done)return an;switch(rn=0,an&&(sn=[2&sn[0],an.value]),sn[0]){case 0:case 1:an=sn;break;case 4:return cn.label++,{value:sn[1],done:!1};case 5:cn.label++,rn=sn[1],sn=[0];continue;case 7:sn=cn.ops.pop(),cn.trys.pop();continue;default:if(!((an=(an=cn.trys).length>0&&an[an.length-1])||6!==sn[0]&&2!==sn[0])){cn=0;continue}if(3===sn[0]&&(!an||sn[1]>an[0]&&sn[1]<an[3])){cn.label=sn[1];break}if(6===sn[0]&&cn.label<an[1]){cn.label=an[1],an=sn;break}if(an&&cn.label<an[2]){cn.label=an[2],cn.ops.push(sn);break}an[2]&&cn.ops.pop(),cn.trys.pop();continue}sn=tn.call(en,cn)}catch(en){sn=[6,en],rn=0}finally{nn=an=0}if(5&sn[0])throw sn[1];return{value:sn[0]?sn[1]:void 0,done:!0}}}function __spreadArray(en,tn,nn){if(nn||2===arguments.length)for(var rn,an=0,sn=tn.length;an<sn;an++)!rn&&an in tn||(rn||(rn=Array.prototype.slice.call(tn,0,an)),rn[an]=tn[an]);return en.concat(rn||tn)}for(var en=function(){function Bounds(en,tn,nn,rn){this.left=en,this.top=tn,this.width=nn,this.height=rn}return Bounds.prototype.add=function(en,tn,nn,rn){return new Bounds(this.left+en,this.top+tn,this.width+nn,this.height+rn)},Bounds.fromClientRect=function(en,tn){return new Bounds(tn.left+en.windowBounds.left,tn.top+en.windowBounds.top,tn.width,tn.height)},Bounds.fromDOMRectList=function(en,tn){var nn=Array.from(tn).find((function(en){return 0!==en.width}));return nn?new Bounds(nn.left+en.windowBounds.left,nn.top+en.windowBounds.top,nn.width,nn.height):Bounds.EMPTY},Bounds.EMPTY=new Bounds(0,0,0,0),Bounds}(),parseBounds=function(tn,nn){return en.fromClientRect(tn,nn.getBoundingClientRect())},toCodePoints$1=function(en){for(var tn=[],nn=0,rn=en.length;nn<rn;){var an=en.charCodeAt(nn++);if(an>=55296&&an<=56319&&nn<rn){var sn=en.charCodeAt(nn++);56320==(64512&sn)?tn.push(((1023&an)<<10)+(1023&sn)+65536):(tn.push(an),nn--)}else tn.push(an)}return tn},fromCodePoint$1=function(){for(var en=[],tn=0;tn<arguments.length;tn++)en[tn]=arguments[tn];if(String.fromCodePoint)return String.fromCodePoint.apply(String,en);var nn=en.length;if(!nn)return"";for(var rn=[],an=-1,sn="";++an<nn;){var cn=en[an];cn<=65535?rn.push(cn):(cn-=65536,rn.push(55296+(cn>>10),cn%1024+56320)),(an+1===nn||rn.length>16384)&&(sn+=String.fromCharCode.apply(String,rn),rn.length=0)}return sn},tn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nn="undefined"==typeof Uint8Array?[]:new Uint8Array
/*!
* html2canvas 1.4.1 <https://html2canvas.hertzen.com>
* Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
* Released under MIT License
*/
/**
* Tools for svg.
* @module svg
* @license MIT
* @copyright 2011 Jeff Schiller
*/const{InsertElementCommand:XA,RemoveElementCommand:YA,ChangeElementCommand:ZA,BatchCommand:JA}=Pa;let ed=null;const svgCanvasToString=()=>{for(;ed.removeUnusedDefElems()>0;);ed.pathActions.clear(!0),ed.getSvgContent().childNodes.forEach(((en,tn)=>{tn&&8===en.nodeType&&en.data.includes("Created with")&&ed.getSvgContent().firstChild.before(en)})),ed.getCurrentGroup()&&(leaveContext(),ed.selectOnly([ed.getCurrentGroup()]));const en=[],tn=ed.getSvgContent().querySelectorAll("g[data-gsvg]");Array.prototype.forEach.call(tn,(tn=>{const nn=tn.attributes;let rn=nn.length;for(let en=0;en<rn;en++)"id"!==nn[en].nodeName&&"style"!==nn[en].nodeName||rn--;if(rn<=0){const nn=tn.firstChild;en.push(nn),tn.replaceWith(nn)}}));const nn=ed.svgToString(ed.getSvgContent(),0);return en.length&&Array.prototype.forEach.call(en,(en=>{ed.groupSvgElem(en)})),nn},svgToString=(en,tn)=>{const nn=ed.getCurConfig(),rn=ed.getNsMap(),an=[],sn=nn.baseUnit,cn=new RegExp("^-?[\\d\\.]+"+sn+"$");if(en){cleanupElement(en);const An=[...en.attributes],dn=en.childNodes;An.sort(((en,tn)=>en.name>tn.name?-1:1));for(let en=0;en<tn;en++)an.push(" ");if(an.push("<"),an.push(en.nodeName),"svgcontent"===en.id){const tn=ed.getResolution();let cn="";nn.dynamicOutput?(cn=en.getAttribute("viewBox"),an.push(' viewBox="'+cn+'" xmlns="'+ka.SVG+'"')):("px"!==sn&&(tn.w=convertUnit$3(tn.w,sn)+sn,tn.h=convertUnit$3(tn.h,sn)+sn),an.push(' width="'+tn.w+'" height="'+tn.h+'" xmlns="'+ka.SVG+'"'));const dn={},un=en.querySelectorAll("*"),pn=Array.prototype.slice.call(un);pn.push(en),Array.prototype.forEach.call(pn,(en=>{const tn=en.namespaceURI;if(tn&&!dn[tn]&&rn[tn]&&"xmlns"!==rn[tn]&&"xml"!==rn[tn]&&(dn[tn]=!0,an.push(" xmlns:"+rn[tn]+'="'+tn+'"')),en.attributes.length>0)for(const[,tn]of Object.entries(en.attributes)){const en=tn.namespaceURI;en&&!dn[en]&&"xmlns"!==rn[en]&&"xml"!==rn[en]&&(dn[en]=!0,an.push(" xmlns:"+rn[en]+'="'+en+'"'))}}));let hn=An.length;const gn=["width","height","xmlns","x","y","viewBox","id","overflow"];for(;hn--;){const en=An[hn],tn=toXml(en.value);en.nodeName.startsWith("xmlns:")||""===tn||gn.includes(en.localName)||en.namespaceURI&&!rn[en.namespaceURI]||(an.push(" "),an.push(en.nodeName),an.push('="'),an.push(tn),an.push('"'))}}else{if("defs"===en.nodeName&&!en.firstChild)return"";const tn=["-moz-math-font-style","_moz-math-font-style"];for(let nn=An.length-1;nn>=0;nn--){const dn=An[nn];let un=toXml(dn.value);if(!tn.includes(dn.localName)){if("null"===un){const tn=dn.localName.replace(/-[a-z]/g,(en=>en[1].toUpperCase()));if(Object.prototype.hasOwnProperty.call(en.style,tn))continue}if(""!==un){if(un.startsWith("pointer-events"))continue;if("class"===dn.localName&&un.startsWith("se_"))continue;if(an.push(" "),"d"===dn.localName&&(un=ed.pathActions.convertPath(en,!0)),isNaN(un)?cn.test(un)&&(un=shortFloat(un)+sn):un=shortFloat(un),ed.getSvgOptionApply()&&"image"===en.nodeName&&"href"===dn.localName&&ed.getSvgOptionImages()&&"embed"===ed.getSvgOptionImages()){const en=ed.getEncodableImages(un);en&&(un=en)}dn.namespaceURI&&dn.namespaceURI!==ka.SVG&&!rn[dn.namespaceURI]||(an.push(dn.nodeName),an.push('="'),an.push(un),an.push('"'))}}}}if(en.hasChildNodes()){an.push(">"),tn++;let nn=!1;for(let en=0;en<dn.length;en++){const rn=dn.item(en);switch(rn.nodeType){case 1:an.push("\n"),an.push(ed.svgToString(rn,tn));break;case 3:{const en=rn.nodeValue.replace(/^\s+|\s+$/g,"");""!==en&&(nn=!0,an.push(String(toXml(en))));break}case 4:an.push("\n"),an.push(new Array(tn+1).join(" ")),an.push("<![CDATA["),an.push(rn.nodeValue),an.push("]]>");break;case 8:an.push("\n"),an.push(new Array(tn+1).join(" ")),an.push("\x3c!--"),an.push(rn.data),an.push("--\x3e")}}if(tn--,!nn){an.push("\n");for(let en=0;en<tn;en++)an.push(" ")}an.push("</"),an.push(en.nodeName),an.push(">")}else an.push("/>")}return an.join("")},setSvgString=(en,tn)=>{const nn=ed.getCurConfig(),rn=ed.getDataStorage();try{const an=text2xml(en);if(an.firstElementChild&&an.firstElementChild.namespaceURI!==ka.SVG)return!1;ed.prepareSvg(an);const sn=new JA("Change Source"),{nextSibling:cn}=ed.getSvgContent();ed.getSvg
/**
* DOM element selection box tools.
* @module select
* @license MIT
*
* @copyright 2010 Alexis Deveria, 2010 Jeff Schiller
*/let td,nd;const rd=window.ontouchstart?10:4;class Selector{constructor(en,tn,nn){this.id=en,this.selectedElement=tn,this.locked=!0,this.selectorGroup=td.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}}),this.selectorRect=td.createSVGElement({element:"path",attr:{id:"selectedBox"+this.id,fill:"none",stroke:"#22C","stroke-width":"1","stroke-dasharray":"5,5",style:"pointer-events:none"}}),this.selectorGroup.append(this.selectorRect),this.gripCoords={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null},this.reset(this.selectedElement,nn)}reset(en,tn){this.locked=!0,this.selectedElement=en,this.resize(tn),this.selectorGroup.setAttribute("display","inline")}showGrips(en){const tn=en?"inline":"none";nd.selectorGripsGroup.setAttribute("display",tn);const nn=this.selectedElement;this.hasGrips=en,nn&&en&&(this.selectorGroup.append(nd.selectorGripsGroup),Selector.updateGripCursors(getRotationAngle(nn)))}resize(en){const tn=td.getDataStorage(),nn=this.selectorRect,rn=nd,an=rn.selectorGrips,sn=this.selectedElement,cn=td.getZoom();let An=1/cn;const dn=sn.getAttribute("stroke-width");"none"===sn.getAttribute("stroke")||isNaN(dn)||(An+=dn/2);const{tagName:un}=sn;"text"===un&&(An+=2/cn);const pn=sn.transform.baseVal,hn=transformListToTransform(pn).matrix;if(hn.e*=cn,hn.f*=cn,en||(en=getBBox(sn)),"g"===un&&!tn.has(sn,"gsvg")){const tn=getStrokedBBox([sn.childNodes]);tn&&(en=tn)}const gn=en.x,_n=en.y,mn=en.width,fn=en.height;An*=cn;const yn=transformBox(gn*cn,_n*cn,mn*cn,fn*cn,hn),{aabox:bn}=yn;let vn=bn.x-An,wn=bn.y-An,xn=bn.width+2*An,kn=bn.height+2*An;const Cn=vn+xn/2,Sn=wn+kn/2,Bn=getRotationAngle(sn);if(Bn){const en=td.getSvgRoot().createSVGTransform();en.setRotate(-Bn,Cn,Sn);const tn=en.matrix;yn.tl=transformPoint(yn.tl.x,yn.tl.y,tn),yn.tr=transformPoint(yn.tr.x,yn.tr.y,tn),yn.bl=transformPoint(yn.bl.x,yn.bl.y,tn),yn.br=transformPoint(yn.br.x,yn.br.y,tn);const{tl:nn}=yn;let rn=nn.x,an=nn.y,sn=nn.x,cn=nn.y;const{min:dn,max:un}=Math;rn=dn(rn,dn(yn.tr.x,dn(yn.bl.x,yn.br.x)))-An,an=dn(an,dn(yn.tr.y,dn(yn.bl.y,yn.br.y)))-An,sn=un(sn,un(yn.tr.x,un(yn.bl.x,yn.br.x)))+An,cn=un(cn,un(yn.tr.y,un(yn.bl.y,yn.br.y)))+An,vn=rn,wn=an,xn=sn-rn,kn=cn-an}const En="M"+vn+","+wn+" L"+(vn+xn)+","+wn+" "+(vn+xn)+","+(wn+kn)+" "+vn+","+(wn+kn)+"z",jn=Bn?"rotate("+[Bn,Cn,Sn].join(",")+")":"";this.gripCoords={nw:[vn,wn],ne:[vn+xn,wn],sw:[vn,wn+kn],se:[vn+xn,wn+kn],n:[vn+xn/2,wn],w:[vn,wn+kn/2],e:[vn+xn,wn+kn/2],s:[vn+xn/2,wn+kn]},nn.setAttribute("d",En),this.selectorGroup.setAttribute("transform",jn),Object.entries(this.gripCoords).forEach((en=>{let[tn,nn]=en;an[tn].setAttribute("cx",nn[0]),an[tn].setAttribute("cy",nn[1])})),rn.rotateGripConnector.setAttribute("x1",vn+xn/2),rn.rotateGripConnector.setAttribute("y1",wn),rn.rotateGripConnector.setAttribute("x2",vn+xn/2),rn.rotateGripConnector.setAttribute("y2",wn-5*rd),rn.rotateGrip.setAttribute("cx",vn+xn/2),rn.rotateGrip.setAttribute("cy",wn-5*rd)}static updateGripCursors(en){const tn=Object.keys(nd.selectorGrips);let nn=Math.round(en/45);for(nn<0&&(nn+=8);nn>0;)tn.push(tn.shift()),nn--;Object.values(nd.selectorGrips).forEach(((en,nn)=>{en.setAttribute("style","cursor:"+tn[nn]+"-resize")}))}}class SelectorManager{constructor(){this.selectorParentGroup=null,this.rubberBandBox=null,this.selectors=[],this.selectorMap={},this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null},this.selectorGripsGroup=null,this.rotateGripConnector=null,this.rotateGrip=null,this.initGroup()}initGroup(){var en;const tn=td.getDataStorage();if(null!==(en=this.selectorParentGroup)&&void 0!==en&&en.parentNode&&this.selectorParentGroup.remove(),this.selectorParentGroup=td.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}}),this.selectorGripsGroup=td.createSVGElement({element:"g",attr:{display:"none"}}),this.selectorParentGroup.append(this.selectorGripsGroup),td.getSvgRoot().append(this.selectorParentGroup),this.selectorMap={},this.selectors=[],this.rubberBandBox=null,Object.keys(this.selectorGrips).forEach((en=>{const nn=td.createSVGElement({element:"circle",attr:{id:"sele
/**
* Tools for clear.
* @module clear
* @license MIT
* @copyright 2011 Jeff Schiller
*/let od=null;const clearSvgContentElementInit=()=>{const en=od.getCurConfig(),{dimensions:tn}=en,nn=od.getSvgContent();for(;nn.firstChild;)nn.removeChild(nn.firstChild);const rn=od.getSvgRoot();nn.setAttribute("id","svgcontent"),nn.setAttribute("width",tn[0]),nn.setAttribute("height",tn[1]),nn.setAttribute("x",tn[0]),nn.setAttribute("y",tn[1]),nn.setAttribute("overflow",en.show_outside_canvas?"visible":"hidden"),nn.setAttribute("xmlns",ka.SVG),nn.setAttribute("xmlns:se",ka.SE),nn.setAttribute("xmlns:xlink",ka.XLINK),rn.appendChild(nn);const an=od.getDOMDocument().createComment(" Created with SVG-edit - https://github.com/SVG-Edit/svgedit");od.getSvgContent().append(an)},id={_storage:new WeakMap,put:function(en,tn,nn){this._storage.has(en)||this._storage.set(en,new Map),this._storage.get(en).set(tn,nn)},get:function(en,tn){var nn;return null===(nn=this._storage.get(en))||void 0===nn?void 0:nn.get(tn)},has:function(en,tn){return this._storage.has(en)&&this._storage.get(en).has(tn)},remove:function(en,tn){const nn=this._storage.get(en).delete(tn);return 0===this._storage.get(en).size&&this._storage.delete(en),nn}},ad=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],sd="svgedit_clipboard";class SvgCanvas{constructor(en,tn){var nn,rn,an;this.initializeSvgCanvasMethods(),function(en){wa=en;const tn=document.createElementNS(fa,"svg");document.body.append(tn);const nn=document.createElementNS(fa,"rect");nn.setAttribute("width","1em"),nn.setAttribute("height","1ex"),nn.setAttribute("x","1in"),tn.append(nn);const rn=nn.getBBox();tn.remove();const an=rn.x;xa={em:rn.width,ex:rn.height,in:an,cm:an/2.54,mm:an/25.4,pt:an/72,pc:an/6,px:1,"%":0}}(this);const{pathActions:sn}=ss;this.saveOptions={round_digits:2},this.importIds={},this.extensions={},this.removedElements={},this.started=!1,this.startTransform=null,this.currentMode="select",this.currentResizeMode="none",this.justSelected=null,this.rubberBox=null,this.curBBoxes=[],this.lastClickPoint=null,this.events={},this.rootSctm=null,this.drawnPath=null,this.freehand={minx:null,miny:null,maxx:null,maxy:null},this.dAttr=null,this.startX=null,this.startY=null,this.rStartX=null,this.rStartY=null,this.initBbox={},this.sumDistance=0,this.controllPoint2={x:0,y:0},this.controllPoint1={x:0,y:0},this.start={x:0,y:0},this.end={x:0,y:0},this.bSpline={x:0,y:0},this.nextPos={x:0,y:0},this.idprefix="svg_",this.encodableImages={},this.curConfig={show_outside_canvas:!0,selectNew:!0,dimensions:[640,480]},tn&&(this.curConfig=SvgCanvas.mergeDeep(this.curConfig,tn)),this.lastGoodImgUrl="".concat(this.curConfig.imgPath,"/logo.svg");const{dimensions:cn}=this.curConfig;this.svgdoc=window.document,this.container=en,this.svgroot=function(en,tn){return en.importNode(text2xml('<svg id="svgroot" xmlns="'.concat(ka.SVG,'" xlinkns="').concat(ka.XLINK,'" width="').concat(tn[0],'" \n height="').concat(tn[1],'" x="').concat(tn[0],'" y="').concat(tn[1],'" overflow="visible">\n <defs>\n <filter id="canvashadow" filterUnits="objectBoundingBox">\n <feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/>\n <feOffset in="blur" dx="5" dy="5" result="offsetBlur"/>\n <feMerge>\n <feMergeNode in="offsetBlur"/>\n <feMergeNode in="SourceGraphic"/>\n </feMerge>\n </filter>\n </defs>\n </svg>')).documentElement,!0)}(this.svgdoc,cn),en.append(this.svgroot),this.svgContent=this.svgdoc.createElementNS(ka.SVG,"svg"),(en=>{en.svgroot.addEventListener("touchstart",touchHandler),en.svgroot.addEventListener("touchmove",touchHandler),en.svgroot.addEventListener("touchend",touchHandler),en.svgroot.addEventListener("touchcancel",touchHandler)})(this),od=this,this.clearSvgContentElement(),this.current_drawing_=new Drawing(this.svgContent,this.idprefix),this.zoom=1,this.currentGroup=null;const An={shape:{fill:("none"===this.curConfig.initFill.color?"":"#")+this.curConfig.initFill.color,fill_paint:null,fill_opacity:this.curConfig.initFill.opacity,stroke:"#"+this.curConfig.initStroke.co
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var t=function(en,tn){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(en,tn){en.__proto__=tn}||function(en,tn){for(var nn in tn)Object.prototype.hasOwnProperty.call(tn,nn)&&(en[nn]=tn[nn])})(en,tn)};function r(en,tn){if("function"!=typeof tn&&null!==tn)throw new TypeError("Class extends value "+String(tn)+" is not a constructor or null");function i(){this.constructor=en}t(en,tn),en.prototype=null===tn?Object.create(tn):(i.prototype=tn.prototype,new i)}function i(en,tn){var nn=en[0],rn=en[1];return[nn*Math.cos(tn)-rn*Math.sin(tn),nn*Math.sin(tn)+rn*Math.cos(tn)]}function a(){for(var en=[],tn=0;tn<arguments.length;tn++)en[tn]=arguments[tn];for(var nn=0;nn<en.length;nn++)if("number"!=typeof en[nn])throw new Error("assertNumbers arguments["+nn+"] is not a number. "+typeof en[nn]+" == typeof "+en[nn]);return!0}var Xk=Math.PI;function o(en,tn,nn){en.lArcFlag=0===en.lArcFlag?0:1,en.sweepFlag=0===en.sweepFlag?0:1;var rn=en.rX,an=en.rY,sn=en.x,cn=en.y;rn=Math.abs(en.rX),an=Math.abs(en.rY);var An=i([(tn-sn)/2,(nn-cn)/2],-en.xRot/180*Xk),dn=An[0],un=An[1],pn=Math.pow(dn,2)/Math.pow(rn,2)+Math.pow(un,2)/Math.pow(an,2);1<pn&&(rn*=Math.sqrt(pn),an*=Math.sqrt(pn)),en.rX=rn,en.rY=an;var hn=Math.pow(rn,2)*Math.pow(un,2)+Math.pow(an,2)*Math.pow(dn,2),gn=(en.lArcFlag!==en.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(rn,2)*Math.pow(an,2)-hn)/hn)),_n=rn*un/an*gn,mn=-an*dn/rn*gn,fn=i([_n,mn],en.xRot/180*Xk);en.cX=fn[0]+(tn+sn)/2,en.cY=fn[1]+(nn+cn)/2,en.phi1=Math.atan2((un-mn)/an,(dn-_n)/rn),en.phi2=Math.atan2((-un-mn)/an,(-dn-_n)/rn),0===en.sweepFlag&&en.phi2>en.phi1&&(en.phi2-=2*Xk),1===en.sweepFlag&&en.phi2<en.phi1&&(en.phi2+=2*Xk),en.phi1*=180/Xk,en.phi2*=180/Xk}function s(en,tn,nn){a(en,tn,nn);var rn=en*en+tn*tn-nn*nn;if(0>rn)return[];if(0===rn)return[[en*nn/(en*en+tn*tn),tn*nn/(en*en+tn*tn)]];var an=Math.sqrt(rn);return[[(en*nn+tn*an)/(en*en+tn*tn),(tn*nn-en*an)/(en*en+tn*tn)],[(en*nn-tn*an)/(en*en+tn*tn),(tn*nn+en*an)/(en*en+tn*tn)]]}var Yk,Zk=Math.PI/180;function c$1(en,tn,nn){return(1-nn)*en+nn*tn}function y(en,tn,nn,rn){return en+Math.cos(rn/180*Xk)*tn+Math.sin(rn/180*Xk)*nn}function p(en,tn,nn,rn){var an=1e-6,sn=tn-en,cn=nn-tn,An=3*sn+3*(rn-nn)-6*cn,dn=6*(cn-sn),un=3*sn;return Math.abs(An)<an?[-un/dn]:function(en,tn,nn){void 0===nn&&(nn=1e-6);var rn=en*en/4-tn;if(rn<-nn)return[];if(rn<=nn)return[-en/2];var an=Math.sqrt(rn);return[-en/2-an,-en/2+an]}(dn/An,un/An,an)}function m$1(en,tn,nn,rn,an){var sn=1-an;return en*(sn*sn*sn)+tn*(3*sn*sn*an)+nn*(3*sn*an*an)+rn*(an*an*an)}!function(en){function r(){return u((function(en,tn,nn){return en.relative&&(void 0!==en.x1&&(en.x1+=tn),void 0!==en.y1&&(en.y1+=nn),void 0!==en.x2&&(en.x2+=tn),void 0!==en.y2&&(en.y2+=nn),void 0!==en.x&&(en.x+=tn),void 0!==en.y&&(en.y+=nn),en.relative=!1),en}))}function e(){var en=NaN,tn=NaN,nn=NaN,rn=NaN;return u((function(an,sn,cn){return an.type&nC.SMOOTH_CURVE_TO&&(an.type=nC.CURVE_TO,en=isNaN(en)?sn:en,tn=isNaN(tn)?cn:tn,an.x1=an.relative?sn-en:2*sn-en,an.y1=an.relative?cn-tn:2*cn-tn),an.type&nC.CURVE_TO?(en=an.relative?sn+an.x2:an.x2,tn=an.relative?cn+an.y2:an.y2):(en=NaN,tn=NaN),an.type&nC.SMOOTH_QUAD_TO&&(an.type=nC.QUAD_TO,nn=isNaN(nn)?sn:nn,rn=isNaN(rn)?cn:rn,an.x1=an.relative?sn-nn:2*sn-nn,an.y1=an.relative?cn-rn:2*cn-rn),an.type&nC.QUAD_TO?(nn=an.relative?sn+an.x1:an.x1,rn=an.relative?cn+an.y1:an.y1):(nn=NaN,rn=NaN),an}))}function n(){var en=NaN,tn=NaN;return u((function(nn,rn,an){if(nn.type&nC.SMOOTH_QUAD_TO&&(nn.type=nC.QUAD_TO,en=isNaN(en)?rn:en,tn=isNaN(tn)?an:tn,nn.x1=nn.relative?rn-en:2*rn-en,nn.y1=nn.relative?an-tn:2*an-tn),nn.type&nC.QUAD_TO){en=nn.relative?rn+nn.x1:nn.x1,tn=nn.relative?an+nn.y1:nn.y1;var sn=nn.x1,cn=nn.y1;nn.type=nC.CURVE_TO,nn.x1=((nn.relative?0:rn)+2*sn)/3,nn.y1=((nn.relative?0:an)+2*cn)/3,nn.x2=(nn.x+2*sn)/3,nn.y2=(nn.y+2*cn)/3}else en=NaN,tn=NaN;return nn}))}function u(en){var tn=0,nn=0,rn=NaN,an=NaN;return function(sn){if(isNaN(rn)&&!(sn.type&nC.MOVE_TO))throw new Error("path must start with moveto");var cn=en(sn,tn,nn,rn,an);return sn.type&nC.CLOSE_PATH&&(tn=rn,nn=an),void 0!==sn.x&&(tn=sn.rel
/**
* StackBlur - a fast almost Gaussian Blur For Canvas
*
* In case you find this class useful - especially in commercial projects -
* I am not totally unhappy for a small donation to my PayPal account
* mario@quasimondo.de
*
* Or support me on flattr:
* {@link https://flattr.com/thing/72791/StackBlur-a-fast-almost-Gaussian-Blur-Effect-for-CanvasJavascript}.
*
* @module StackBlur
* @author Mario Klingemann
* Contact: mario@quasimondo.com
* Website: {@link http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html}
* Twitter: @quasimondo
*
* @copyright (c) 2010 Mario Klingemann
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
var mC=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],fC=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];var yC=function BlurStack(){!function _classCallCheck(en,tn){if(!(en instanceof tn))throw new TypeError("Cannot call a class as a function")}(this,BlurStack),this.r=0,this.g=0,this.b=0,this.a=0,this.next=null},bC=Object.freeze({__proto__:null,offscreen:function offscreen(){var{DOMParser:en}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},tn={window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:en,createCanvas:(en,tn)=>new OffscreenCanvas(en,tn),createImage:en=>_asyncToGenerator((function*(){var tn=yield fetch(en),nn=yield tn.blob();return yield createImageBitmap(nn)}))()};return"undefined"==typeof DOMParser&&void 0!==en||Reflect.deleteProperty(tn,"DOMParser"),tn},node:function node(en){var{DOMParser:tn,canvas:nn,fetch:rn}=en;return{window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:tn,fetch:rn,createCanvas:nn.createCanvas,createImage:nn.loadImage}}});function compressSpaces(en){return en.replace(/(?!\u3000)\s+/gm," ")}function trimLeft(en){return en.replace(/^[\n \t]+/,"")}function trimRight(en){return en.replace(/[\n \t]+$/,"")}function toNumbers(en){return((en||"").match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm)||[]).map(parseFloat)}var vC=/^[A-Z-]+$/;function normalizeAttributeName(en){return vC.test(en)?en.toLowerCase():en}function parseExternalUrl(en){var tn=/url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(en)||[];return tn[2]||tn[3]||tn[4]}function normalizeColor(en){if(!en.startsWith("rgb"))return en;var tn=3;return en.replace(/\d+(\.\d+)?/g,((en,nn)=>tn--&&nn?String(Math.round(parseFloat(en))):en))}var wC=/(\[[^\]]+\])/g,xC=/(#[^\s+>~.[:]+)/g,kC=/(\.[^\s+>~.[:]+)/g,CC=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,SC=/(:[\w-]+\([^)]*\))/gi,BC=/(:[^\s+>~.[:]+)/g,EC=/([^\s+>~.[:]+)/g;function findSelectorMatch(en,tn){var nn=tn.exec(en);return nn?[en.replace(tn," "),nn.length]:[en,0]}function getSelectorSpecificity(en){var tn=[0,0,0],nn=en.replace(/:not\(([^)]*)\)/g," $1 ").replace(/{[\s\S]*/gm," "),rn=0;return[nn,rn]=findSelectorMatch(nn,wC),tn[1]+=rn,[nn,rn]=findSelectorMatch(nn,xC),tn[0]+=rn,[nn,rn]=findSelectorMatch(nn,kC),tn[1]+=rn,[nn,rn]=findSelectorMatch(nn,CC),tn[2]+=rn,[nn,rn]=findSelectorMatch(nn,SC),tn[1]+=rn,[nn,rn]=findSelectorMatch(nn,BC),tn[1]+=rn,nn=nn.replace(/[*\s+>~]/g," ").replace(/[#.]
/**
* Browser detection.
* @module browser
* @license MIT
*
* @copyright 2010 Jeff Schiller, 2010 Alexis Deveria
*/const _S="http://www.w3.org/2000/svg",{userAgent:mS}=navigator;mS.includes("AppleWebKit"),mS.includes("Gecko/");const fS=mS.includes("Chrome/"),yS=mS.includes("Macintosh");!function(){const en=document.createElementNS(_S,"svg"),tn=document.createElementNS(_S,"svg");document.documentElement.append(en),tn.setAttribute("x",5),en.append(tn);const nn=document.createElementNS(_S,"text");nn.textContent="a",tn.append(nn);try{nn.getStartPositionOfChar(0).x}catch(en){return!1}finally{en.remove()}}();class ConfigObj{constructor(en){this.defaultPrefs={lang:"en",bkgd_color:"#FFF",bkgd_url:"",img_save:"embed",save_notice_done:!1,export_notice_done:!1},this.defaultConfig={canvasName:"default",canvas_expansion:3,initFill:{color:"FF0000",opacity:1},initStroke:{width:5,color:"000000",opacity:1},text:{stroke_width:0,font_size:24,font_family:"Serif"},initOpacity:1,initTool:"select",exportWindowType:"new",wireframe:!1,showlayers:!1,no_save_warning:!1,imgPath:"./images",extPath:"./extensions",dimensions:[640,480],gridSnapping:!1,gridColor:"#000",baseUnit:"px",snappingStep:10,showRulers:!0,dynamicOutput:!1,preventAllURLConfig:!1,preventURLContentLoading:!1,lockExtensions:!1,noDefaultExtensions:!1,showGrid:!1,noStorageOnLoad:!1,forceStorage:!1,emptyStorageOnDecline:!1,avoidClientSide:!1,avoidClientSideDownload:!1,avoidClientSideOpen:!1},this.curPrefs={},this.urldata={},this.defaultExtensions=["ext-eyedropper","ext-grid","ext-markers","ext-panning","ext-shapes","ext-polystar","ext-storage","ext-opensave"],this.curConfig={extensions:[],userExtensions:[],allowedOrigins:[]},this.editor=en}setupCurPrefs(){const en={...this.defaultPrefs,...this.curPrefs};this.curPrefs=en}setupCurConfig(){const en={...this.defaultConfig,...this.curConfig};en.noDefaultExtensions||(en.extensions=[...this.defaultExtensions]),this.curConfig=en}loadFromURL(){const en=this,{search:tn,searchParams:nn}=new URL(location);if(tn){this.urldata={};const tn=nn.entries();for(const en of tn)this.urldata[en[0]]=en[1];if(["initStroke","initFill"].forEach((en=>{nn.has("".concat(en,"[color]"))&&(void 0===this.urldata[en]&&(this.urldata[en]={}),this.urldata[en].color=nn.get("".concat(en,"[color]")))})),nn.has("bkgd_color")&&(this.urldata.bkgd_color="#"+nn.get("bkgd_color")),this.urldata.dimensions&&(this.urldata.dimensions=this.urldata.dimensions.split(",")),this.urldata.extensions&&(this.urldata.extensions=/[:/\\]/.test(this.urldata.extensions)?"":this.urldata.extensions.split(",")),["userExtensions","imgPath"].forEach((function(tn){en.urldata[tn]&&delete en.urldata[tn]})),this.setConfig(this.urldata,{overwrite:!1}),this.setupCurConfig(),!this.curConfig.preventURLContentLoading){let{source:en}=this.urldata;if(!en){const tn=nn.get("source");null!=tn&&tn.startsWith("data:")&&(en=tn)}if(en)return void(en.startsWith("data:")?this.editor.loadFromDataURI(en):this.editor.loadFromString(en));if(this.urldata.url)return void this.editor.loadFromURL(this.urldata.url)}this.urldata.noStorageOnLoad&&!this.curConfig.forceStorage||this.loadContentAndPrefs()}else this.setupCurConfig(),this.loadContentAndPrefs()}loadContentAndPrefs(){(this.curConfig.forceStorage||!this.curConfig.noStorageOnLoad&&/(?:^|;\s*)svgeditstore=(?:prefsAndContent|prefsOnly)/.test(document.cookie))&&Object.keys(this.defaultPrefs).forEach((en=>{const tn="svg-edit-"+en;if(this.editor.storage){const nn=this.editor.storage.getItem(tn);nn&&(this.defaultPrefs[en]=String(nn))}else if(window.widget)this.defaultPrefs[en]=window.widget.preferenceForKey(tn);else{const rn=document.cookie.match(new RegExp("(?:^|;\\s*)"+(nn=encodeURIComponent(tn),String(nn).replace(/[.\\+*?[^\]$(){}=!<>|:-]/g,"\\$&")+"=([^;]+)")));this.defaultPrefs[en]=rn?decodeURIComponent(rn[1]):""}var nn}))}setConfig(en){let tn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const extendOrAdd=(en,tn,nn)=>{en[tn]&&"object"==typeof en[tn]&&!Array.isArray(en[tn])?en[tn]=mergeDeep(en[tn],nn):en[tn]=nn};Object.entries(en).forEach((en=>{let[nn,rn]=en;if(this.defaultPrefs[nn]){if(!1===tn.overwrite&&(this.curConfig.preventAllURLConfig||this.curPrefs[nn]))return;!0===t
/**
* Adds context menu functionality.
* @module contextmenu
* @license Apache-2.0
* @author Adam Bender
*/let bS={};const injectExtendedContextMenuItemsIntoDom=function(){Object.values(bS).forEach((en=>{!function(en){Object.keys(bS).length||document.getElementById("cmenu_canvas").appendChild("<li class='separator'>");const tn=en.shortcut||"";document.getElementById("cmenu_canvas").appendChild("\n <li class='disabled'><a href='#".concat(en.id,"'>").concat(en.label,"<span class='shortcut'>").concat(tn,"</span></a></li>"))}(en)}))};const{$id:vS,getTypeMap:wS}=SvgCanvas;class Rulers{constructor(en){this.rulerIntervals=[];for(let en=.1;en<1e5;en*=10)this.rulerIntervals.push(en),this.rulerIntervals.push(2*en),this.rulerIntervals.push(5*en);this.svgCanvas=en.svgCanvas,this.editor=en;const tn=document.createElement("template");tn.innerHTML='<style>\n /* Rulers\n*/\n\n #ruler_corner {\n background: var(--ruler-color);\n grid-area: corner;\n width: 15px;\n height: 15px;\n overflow: hidden;\n }\n\n #ruler_x {\n background: var(--ruler-color);\n grid-area: rulerX;\n height: 15px;\n border-bottom: 1px solid;\n border-left: 1px solid #777;\n overflow: hidden;\n }\n\n #ruler_y {\n background: var(--ruler-color);\n grid-area: rulerY;\n width: 15px;\n border-right: 1px solid;\n border-top: 1px solid #777;\n overflow: hidden;\n }\n\n #ruler_x canvas {\n float: left;\n }\n</style>\n<div id="ruler_corner"></div>\n<div id="ruler_x">\n <div>\n <canvas height="15"></canvas>\n </div>\n</div>\n<div id="ruler_y">\n <div>\n <canvas width="15"></canvas>\n </div>\n</div>',this.editor.$svgEditor.append(tn.content.cloneNode(!0));const{$id:nn}=SvgCanvas;this.rulerX=nn("ruler_x"),this.rulerY=nn("ruler_y"),this.rulerCorner=nn("ruler_corner")}display(en){en?(this.rulerX.style.removeProperty("display"),this.rulerY.style.removeProperty("display"),this.rulerCorner.style.removeProperty("display")):(this.rulerX.style.display="none",this.rulerY.style.display="none",this.rulerCorner.style.display="none")}manageScroll(){this.rulerX&&(this.rulerX.scrollLeft=this.editor.workarea.scrollLeft),this.rulerY&&(this.rulerY.scrollTop=this.editor.workarea.scrollTop)}updateRulers(en,tn){let nn,rn;tn||(tn=this.svgCanvas.getZoom()),en||(en=document.getElementById("svgcanvas"));const an=3e4,sn=this.svgCanvas.getSvgContent(),cn=wS()[this.editor.configObj.curConfig.baseUnit];for(nn=0;nn<2;nn++){const An=0===nn,dn=An?"x":"y",un=An?"width":"height",pn=Number(sn.getAttribute(dn)),hn=vS("ruler_"+dn).querySelector("canvas"),gn=hn.cloneNode(!0);hn.replaceWith(gn);const _n=gn;let mn;"width"===un?mn=parseFloat(getComputedStyle(en,null).width.replace("px","")):"height"===un&&(mn=parseFloat(getComputedStyle(en,null).height.replace("px","")));const fn=mn;_n.parentNode.style[un]=fn+"px";let yn,bn,vn,wn=_n.getContext("2d");wn.fillStyle="rgb(200,0,0)",wn.fillRect(0,0,_n.width,_n.height);const xn=Array.prototype.filter.call(gn.parentNode.children,(function(en){return en!==gn}));if(Array.from(xn).forEach((function(en){en.remove()})),mn>=an){let en;for(vn=Number.parseInt(mn/an)+1,yn=[],yn[0]=wn,rn=1;rn<vn;rn++)_n[un]=an,en=_n.cloneNode(!0),_n.parentNode.append(en),yn[rn]=en.getContext("2d");en[un]=mn%an,mn=an}_n[un]=mn;const kn=cn*tn,Cn=50/kn;let Sn=1;for(rn=0;rn<this.rulerIntervals.length&&(bn=this.rulerIntervals[rn],Sn=bn,!(Cn<=bn));rn++);const Bn=Sn*kn;wn.font="9px sans-serif";let En=pn/kn%Sn*kn,jn=En-Bn,Ln=0;for(;En<fn;){jn+=Bn;const en=Math.round(En)+.5;let tn;if(An?(wn.moveTo(en,15),wn.lineTo(en,0)):(wn.moveTo(15,en),wn.lineTo(0,en)),bn=(jn-pn)/kn,Sn>=1)tn=Math.round(bn);else{const en=String(Sn).split(".")[1].length;tn=bn.toFixed(en)}if(0!==tn&&1e3!==tn&&tn%1e3==0&&(tn=tn/1e3+"K"),An)wn.fillText(tn,En+2,8);else{const en=String(tn).split("");for(rn=0;rn<en.length;rn++)wn.fillText(en[rn],1,En+9+9*rn)}const nn=Bn/10;for(rn=1;rn<10;rn++){let en=Math.round(En+nn*rn)+.5;if(yn&&en>mn){if(Ln++,wn.stroke(),Ln>=vn){rn=10,En=fn;continue}wn=yn[Ln],En-=an,en=Math.round(En+nn*rn)+.5}const tn=rn%2?12:10;An?(wn.moveTo
//# sourceMappingURL=iife-Editor.js.map