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;nnen.length)&&(tn=en.length);for(var nn=0,rn=new Array(tn);nn1&&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]:{};this.prefix=nn.prefix||"i18next:",this.logger=tn||en,this.options=nn,this.debug=nn.debug}},{key:"setDebug",value:function setDebug(en){this.debug=en}},{key:"log",value:function log(){for(var en=arguments.length,tn=new Array(en),nn=0;nn1?tn-1:0),rn=1;rn-1?en.replace(/###/g,"."):en}function canNotTraverseDeeper(){return!en||"string"==typeof en}for(var rn="string"!=typeof tn?[].concat(tn):tn.split(".");rn.length>1;){if(canNotTraverseDeeper())return{};var an=cleanKey(rn.shift());!en[an]&&nn&&(en[an]=new nn),en=Object.prototype.hasOwnProperty.call(en,an)?en[an]:{}}return canNotTraverseDeeper()?{}:{obj:en,k:cleanKey(rn.shift())}}function setPath(en,tn,nn){var rn=getLastOfPath(en,tn,Object);rn.obj[rn.k]=nn}function getPath(en,tn){var nn=getLastOfPath(en,tn),rn=nn.obj,an=nn.k;if(rn)return rn[an]}function getPathWithDefaults(en,tn,nn){var rn=getPath(en,nn);return void 0!==rn?rn:getPath(tn,nn)}function deepExtend(en,tn,nn){for(var rn in tn)"__proto__"!==rn&&"constructor"!==rn&&(rn in en?"string"==typeof en[rn]||en[rn]instanceof String||"string"==typeof tn[rn]||tn[rn]instanceof String?nn&&(en[rn]=tn[rn]):deepExtend(en[rn],tn[rn],nn):en[rn]=tn[rn]);return en}function regexEscape$1(en){return en.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var rn={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function escape$1(en){return"string"==typeof en?en.replace(/[&<>"'\/]/g,(function(en){return rn[en]})):en}var an="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,sn=[" ",",","?","!",";"];function ownKeys$1$1(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$1(en){for(var tn=1;tn2&&void 0!==arguments[2]?arguments[2]:".";if(en){if(en[tn])return en[tn];for(var rn=tn.split(nn),an=en,sn=0;snsn+cn;)cn++,dn=an[An=rn.slice(sn,sn+cn).join(nn)];if(void 0===dn)return;if(null===dn)return null;if(tn.endsWith(An)){if("string"==typeof dn)return dn;if(An&&"string"==typeof dn[An])return dn[An]}var un=rn.slice(sn+cn).join(nn);return un?deepFind(dn,un,nn):void 0}an=an[rn[sn]]}return an}}var cn=function(en){_inherits(ResourceStore,nn);var tn=_createSuper(ResourceStore);function ResourceStore(en){var rn,sn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return _classCallCheck(this,ResourceStore),rn=tn.call(this),an&&nn.call(_assertThisInitialized(rn)),rn.data=en||{},rn.options=sn,void 0===rn.options.keySeparator&&(rn.options.keySeparator="."),void 0===rn.options.ignoreJSONStructure&&(rn.options.ignoreJSONStructure=!0),rn}return _createClass(ResourceStore,[{key:"addNamespaces",value:function addNamespaces(en){this.options.ns.indexOf(en)<0&&this.options.ns.push(en)}},{key:"removeNamespaces",value:function removeNamespaces(en){var tn=this.options.ns.indexOf(en);tn>-1&&this.options.ns.splice(tn,1)}},{key:"getResource",value:function getResource(en,tn,nn){var rn=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},an=void 0!==rn.keySeparator?rn.keySeparator:this.options.keySeparator,sn=void 0!==rn.ignoreJSONStructure?rn.ignoreJSONStructure:this.options.ignoreJSONStructure,cn=[en,tn];nn&&"string"!=typeof nn&&(cn=cn.concat(nn)),nn&&"string"==typeof nn&&(cn=cn.concat(an?nn.split(an):nn)),en.indexOf(".")>-1&&(cn=en.split("."));var An=getPath(this.data,cn);return An||!sn||"string"!=typeof nn?An:deepFind(this.data&&this.data[en]&&this.data[en][tn],nn,an)}},{key:"addResource",value:function addResource(en,tn,nn,rn){var an=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},sn=this.options.keySeparator;void 0===sn&&(sn=".");var cn=[en,tn];nn&&(cn=cn.concat(sn?nn.split(sn):nn)),en.indexOf(".")>-1&&(rn=tn,tn=(cn=en.split("."))[1]),this.addNamespaces(tn),setPath(this.data,cn,rn),an.silent||this.emit("added",en,tn,nn,rn)}},{key:"addResources",value:function addResources(en,tn,nn){var rn=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var an in nn)"string"!=typeof nn[an]&&"[object Array]"!==Object.prototype.toString.apply(nn[an])||this.addResource(en,tn,an,nn[an],{silent:!0});rn.silent||this.emit("added",en,tn,nn)}},{key:"addResourceBundle",value:function addResourceBundle(en,tn,nn,rn,an){var sn=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},cn=[en,tn];en.indexOf(".")>-1&&(rn=nn,nn=tn,tn=(cn=en.split("."))[1]),this.addNamespaces(tn);var An=getPath(this.data,cn)||{};rn?deepExtend(An,nn,an):An=_objectSpread$1$1(_objectSpread$1$1({},An),nn),setPath(this.data,cn,An),sn.silent||this.emit("added",en,tn,nn)}},{key:"removeResourceBundle",value:function removeResourceBundle(en,tn){this.hasResourceBundle(en,tn)&&delete this.data[en][tn],this.removeNamespaces(tn),this.emit("removed",en,tn)}},{key:"hasResourceBundle",value:function hasResourceBundle(en,tn){return void 0!==this.getResource(en,tn)}},{key:"getResourceBundle",value:function getResourceBundle(en,tn){return tn||(tn=this.options.defaultNS),"v1"===this.options.compatibilityAPI?_objectSpread$1$1(_objectSpread$1$1({},{}),this.getResource(en,tn)):this.getResource(en,tn)}},{key:"getDataByLanguage",value:function getDataByLanguage(en){return this.data[en]}},{key:"hasLanguageSomeTranslations",value:function hasLanguageSomeTranslations(en){var tn=this.getDataByLanguage(en);return!!(tn&&Object.keys(tn)||[]).find((function(en){return tn[en]&&Object.keys(tn[en]).length>0}))}},{key:"toJSON",value:function toJSON(){return this.data}}]),ResourceStore}(),An={processors:{},addPostProcessor:function addPostProcessor(en){this.processors[en.name]=en},handle:function handle(en,tn,nn,rn,an){var sn=this;return en.forEach((function(en){sn.processors[en]&&(tn=sn.processors[en].process(tn,nn,rn,an))})),tn}};function ownKeys$2$1(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$2$1(en){for(var tn=1;tn1&&void 0!==arguments[1]?arguments[1]:{};return _classCallCheck(this,Translator),sn=rn.call(this),an&&nn.call(_assertThisInitialized(sn)),copy(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],en,_assertThisInitialized(sn)),sn.options=cn,void 0===sn.options.keySeparator&&(sn.options.keySeparator="."),sn.logger=tn.create("translator"),sn}return _createClass(Translator,[{key:"changeLanguage",value:function changeLanguage(en){en&&(this.language=en)}},{key:"exists",value:function exists(en){var tn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==en)return!1;var nn=this.resolve(en,tn);return nn&&void 0!==nn.res}},{key:"extractFromKey",value:function extractFromKey(en,tn){var nn=void 0!==tn.nsSeparator?tn.nsSeparator:this.options.nsSeparator;void 0===nn&&(nn=":");var rn=void 0!==tn.keySeparator?tn.keySeparator:this.options.keySeparator,an=tn.ns||this.options.defaultNS||[],cn=nn&&en.indexOf(nn)>-1,An=!(this.options.userDefinedKeySeparator||tn.keySeparator||this.options.userDefinedNsSeparator||tn.nsSeparator||function looksLikeObjectPath(en,tn,nn){tn=tn||"",nn=nn||"";var rn=sn.filter((function(en){return tn.indexOf(en)<0&&nn.indexOf(en)<0}));if(0===rn.length)return!0;var an=new RegExp("(".concat(rn.map((function(en){return"?"===en?"\\?":en})).join("|"),")")),cn=!an.test(en);if(!cn){var An=en.indexOf(nn);An>0&&!an.test(en.substring(0,An))&&(cn=!0)}return cn}(en,nn,rn));if(cn&&!An){var dn=en.match(this.interpolator.nestingRegexp);if(dn&&dn.length>0)return{key:en,namespaces:an};var un=en.split(nn);(nn!==rn||nn===rn&&this.options.ns.indexOf(un[0])>-1)&&(an=un.shift()),en=un.join(rn)}return"string"==typeof an&&(an=[an]),{key:en,namespaces:an}}},{key:"translate",value:function translate(en,tn,nn){var rn=this;if("object"!==_typeof$2(tn)&&this.options.overloadTranslationOptionHandler&&(tn=this.options.overloadTranslationOptionHandler(arguments)),tn||(tn={}),null==en)return"";Array.isArray(en)||(en=[String(en)]);var an=void 0!==tn.returnDetails?tn.returnDetails:this.options.returnDetails,sn=void 0!==tn.keySeparator?tn.keySeparator:this.options.keySeparator,cn=this.extractFromKey(en[en.length-1],tn),An=cn.key,dn=cn.namespaces,un=dn[dn.length-1],pn=tn.lng||this.language,hn=tn.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(pn&&"cimode"===pn.toLowerCase()){if(hn){var gn=tn.nsSeparator||this.options.nsSeparator;return an?(_n.res="".concat(un).concat(gn).concat(An),_n):"".concat(un).concat(gn).concat(An)}return an?(_n.res=An,_n):An}var _n=this.resolve(en,tn),mn=_n&&_n.res,fn=_n&&_n.usedKey||An,yn=_n&&_n.exactUsedKey||An,bn=Object.prototype.toString.apply(mn),vn=["[object Number]","[object Function]","[object RegExp]"],wn=void 0!==tn.joinArrays?tn.joinArrays:this.options.joinArrays,xn=!this.i18nFormat||this.i18nFormat.handleAsObject,kn="string"!=typeof mn&&"boolean"!=typeof mn&&"number"!=typeof mn;if(xn&&mn&&kn&&vn.indexOf(bn)<0&&("string"!=typeof wn||"[object Array]"!==bn)){if(!tn.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var Cn=this.options.returnedObjectHandler?this.options.returnedObjectHandler(fn,mn,_objectSpread$2$1(_objectSpread$2$1({},tn),{},{ns:dn})):"key '".concat(An," (").concat(this.language,")' returned an object instead of string.");return an?(_n.res=Cn,_n):Cn}if(sn){var Sn="[object Array]"===bn,Bn=Sn?[]:{},En=Sn?yn:fn;for(var jn in mn)if(Object.prototype.hasOwnProperty.call(mn,jn)){var Ln="".concat(En).concat(sn).concat(jn);Bn[jn]=this.translate(Ln,_objectSpread$2$1(_objectSpread$2$1({},tn),{joinArrays:!1,ns:dn})),Bn[jn]===Ln&&(Bn[jn]=mn[jn])}mn=Bn}}else if(xn&&"string"==typeof wn&&"[object Array]"===bn)(mn=mn.join(wn))&&(mn=this.extendTranslation(mn,en,tn,nn));else{var Pn=!1,Tn=!1,Fn=void 0!==tn.count&&"string"!=typeof tn.count,Un=Translator.hasDefaultValue(tn),Nn=Fn?this.pluralResolver.getSuffix(pn,tn.count,tn):"",In=tn["defaultValue".concat(Nn)]||tn.defaultValue;!this.isValidLookup(mn)&&Un&&(Pn=!0,mn=In),this.isValidLookup(mn)||(Tn=!0,mn=An);var Mn=tn.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,Rn=Mn&&Tn?void 0:mn,On=Un&&In!==mn&&this.options.updateMissing;if(Tn||Pn||On){if(this.logger.log(On?"updateKey":"missingKey",pn,un,An,On?In:mn),sn){var Qn=this.resolve(An,_objectSpread$2$1(_objectSpread$2$1({},tn),{},{keySeparator:!1}));Qn&&Qn.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var qn=[],Vn=this.languageUtils.getFallbackCodes(this.options.fallbackLng,tn.lng||this.language);if("fallback"===this.options.saveMissingTo&&Vn&&Vn[0])for(var Gn=0;Gn1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof en&&(en=[en]),en.forEach((function(en){if(!cn.isValidLookup(tn)){var un=cn.extractFromKey(en,An),pn=un.key;nn=pn;var hn=un.namespaces;cn.options.fallbackNS&&(hn=hn.concat(cn.options.fallbackNS));var gn=void 0!==An.count&&"string"!=typeof An.count,_n=gn&&!An.ordinal&&0===An.count&&cn.pluralResolver.shouldUseIntlApi(),mn=void 0!==An.context&&("string"==typeof An.context||"number"==typeof An.context)&&""!==An.context,fn=An.lngs?An.lngs:cn.languageUtils.toResolveHierarchy(An.lng||cn.language,An.fallbackLng);hn.forEach((function(en){cn.isValidLookup(tn)||(sn=en,!dn["".concat(fn[0],"-").concat(en)]&&cn.utils&&cn.utils.hasLoadedNamespace&&!cn.utils.hasLoadedNamespace(sn)&&(dn["".concat(fn[0],"-").concat(en)]=!0,cn.logger.warn('key "'.concat(nn,'" for languages "').concat(fn.join(", "),'" won\'t get resolved as namespace "').concat(sn,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),fn.forEach((function(nn){if(!cn.isValidLookup(tn)){an=nn;var sn,dn=[pn];if(cn.i18nFormat&&cn.i18nFormat.addLookupKeys)cn.i18nFormat.addLookupKeys(dn,pn,nn,en,An);else{var un;gn&&(un=cn.pluralResolver.getSuffix(nn,An.count,An));var hn="".concat(cn.options.pluralSeparator,"zero");if(gn&&(dn.push(pn+un),_n&&dn.push(pn+hn)),mn){var fn="".concat(pn).concat(cn.options.contextSeparator).concat(An.context);dn.push(fn),gn&&(dn.push(fn+un),_n&&dn.push(fn+hn))}}for(;sn=dn.pop();)cn.isValidLookup(tn)||(rn=sn,tn=cn.getResource(nn,en,sn,An))}})))}))}})),{res:tn,usedKey:nn,exactUsedKey:rn,usedLng:an,usedNS:sn}}},{key:"isValidLookup",value:function isValidLookup(en){return!(void 0===en||!this.options.returnNull&&null===en||!this.options.returnEmptyString&&""===en)}},{key:"getResource",value:function getResource(en,tn,nn){var rn=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(en,tn,nn,rn):this.resourceStore.getResource(en,tn,nn,rn)}}],[{key:"hasDefaultValue",value:function hasDefaultValue(en){var tn="defaultValue";for(var nn in en)if(Object.prototype.hasOwnProperty.call(en,nn)&&tn===nn.substring(0,tn.length)&&void 0!==en[nn])return!0;return!1}}]),Translator}();function capitalize(en){return en.charAt(0).toUpperCase()+en.slice(1)}var pn=function(){function LanguageUtil(en){_classCallCheck(this,LanguageUtil),this.options=en,this.supportedLngs=this.options.supportedLngs||!1,this.logger=tn.create("languageUtils")}return _createClass(LanguageUtil,[{key:"getScriptPartFromCode",value:function getScriptPartFromCode(en){if(!en||en.indexOf("-")<0)return null;var tn=en.split("-");return 2===tn.length?null:(tn.pop(),"x"===tn[tn.length-1].toLowerCase()?null:this.formatLanguageCode(tn.join("-")))}},{key:"getLanguagePartFromCode",value:function getLanguagePartFromCode(en){if(!en||en.indexOf("-")<0)return en;var tn=en.split("-");return this.formatLanguageCode(tn[0])}},{key:"formatLanguageCode",value:function formatLanguageCode(en){if("string"==typeof en&&en.indexOf("-")>-1){var tn=["hans","hant","latn","cyrl","cans","mong","arab"],nn=en.split("-");return this.options.lowerCaseLng?nn=nn.map((function(en){return en.toLowerCase()})):2===nn.length?(nn[0]=nn[0].toLowerCase(),nn[1]=nn[1].toUpperCase(),tn.indexOf(nn[1].toLowerCase())>-1&&(nn[1]=capitalize(nn[1].toLowerCase()))):3===nn.length&&(nn[0]=nn[0].toLowerCase(),2===nn[1].length&&(nn[1]=nn[1].toUpperCase()),"sgn"!==nn[0]&&2===nn[2].length&&(nn[2]=nn[2].toUpperCase()),tn.indexOf(nn[1].toLowerCase())>-1&&(nn[1]=capitalize(nn[1].toLowerCase())),tn.indexOf(nn[2].toLowerCase())>-1&&(nn[2]=capitalize(nn[2].toLowerCase()))),nn.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?en.toLowerCase():en}},{key:"isSupportedCode",value:function isSupportedCode(en){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(en=this.getLanguagePartFromCode(en)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(en)>-1}},{key:"getBestMatchFromCodes",value:function getBestMatchFromCodes(en){var tn,nn=this;return en?(en.forEach((function(en){if(!tn){var rn=nn.formatLanguageCode(en);nn.options.supportedLngs&&!nn.isSupportedCode(rn)||(tn=rn)}})),!tn&&this.options.supportedLngs&&en.forEach((function(en){if(!tn){var rn=nn.getLanguagePartFromCode(en);if(nn.isSupportedCode(rn))return tn=rn;tn=nn.options.supportedLngs.find((function(en){if(0===en.indexOf(rn))return en}))}})),tn||(tn=this.getFallbackCodes(this.options.fallbackLng)[0]),tn):null}},{key:"getFallbackCodes",value:function getFallbackCodes(en,tn){if(!en)return[];if("function"==typeof en&&(en=en(tn)),"string"==typeof en&&(en=[en]),"[object Array]"===Object.prototype.toString.apply(en))return en;if(!tn)return en.default||[];var nn=en[tn];return nn||(nn=en[this.getScriptPartFromCode(tn)]),nn||(nn=en[this.formatLanguageCode(tn)]),nn||(nn=en[this.getLanguagePartFromCode(tn)]),nn||(nn=en.default),nn||[]}},{key:"toResolveHierarchy",value:function toResolveHierarchy(en,tn){var nn=this,rn=this.getFallbackCodes(tn||this.options.fallbackLng||[],en),an=[],sn=function addCode(en){en&&(nn.isSupportedCode(en)?an.push(en):nn.logger.warn("rejecting language code not found in supportedLngs: ".concat(en)))};return"string"==typeof en&&en.indexOf("-")>-1?("languageOnly"!==this.options.load&&sn(this.formatLanguageCode(en)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&sn(this.getScriptPartFromCode(en)),"currentOnly"!==this.options.load&&sn(this.getLanguagePartFromCode(en))):"string"==typeof en&&sn(this.formatLanguageCode(en)),rn.forEach((function(en){an.indexOf(en)<0&&sn(nn.formatLanguageCode(en))})),an}}]),LanguageUtil}(),hn=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],gn={1:function _(en){return Number(en>1)},2:function _(en){return Number(1!=en)},3:function _(en){return 0},4:function _(en){return Number(en%10==1&&en%100!=11?0:en%10>=2&&en%10<=4&&(en%100<10||en%100>=20)?1:2)},5:function _(en){return Number(0==en?0:1==en?1:2==en?2:en%100>=3&&en%100<=10?3:en%100>=11?4:5)},6:function _(en){return Number(1==en?0:en>=2&&en<=4?1:2)},7:function _(en){return Number(1==en?0:en%10>=2&&en%10<=4&&(en%100<10||en%100>=20)?1:2)},8:function _(en){return Number(1==en?0:2==en?1:8!=en&&11!=en?2:3)},9:function _(en){return Number(en>=2)},10:function _(en){return Number(1==en?0:2==en?1:en<7?2:en<11?3:4)},11:function _(en){return Number(1==en||11==en?0:2==en||12==en?1:en>2&&en<20?2:3)},12:function _(en){return Number(en%10!=1||en%100==11)},13:function _(en){return Number(0!==en)},14:function _(en){return Number(1==en?0:2==en?1:3==en?2:3)},15:function _(en){return Number(en%10==1&&en%100!=11?0:en%10>=2&&(en%100<10||en%100>=20)?1:2)},16:function _(en){return Number(en%10==1&&en%100!=11?0:0!==en?1:2)},17:function _(en){return Number(1==en||en%10==1&&en%100!=11?0:1)},18:function _(en){return Number(0==en?0:1==en?1:2)},19:function _(en){return Number(1==en?0:0==en||en%100>1&&en%100<11?1:en%100>10&&en%100<20?2:3)},20:function _(en){return Number(1==en?0:0==en||en%100>0&&en%100<20?1:2)},21:function _(en){return Number(en%100==1?1:en%100==2?2:en%100==3||en%100==4?3:0)},22:function _(en){return Number(1==en?0:2==en?1:(en<0||en>10)&&en%10==0?2:3)}},_n=["v1","v2","v3"],mn={zero:0,one:1,two:2,few:3,many:4,other:5};function createRules(){var en={};return hn.forEach((function(tn){tn.lngs.forEach((function(nn){en[nn]={numbers:tn.nr,plurals:gn[tn.fc]}}))})),en}var fn=function(){function PluralResolver(en){var nn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,PluralResolver),this.languageUtils=en,this.options=nn,this.logger=tn.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=createRules()}return _createClass(PluralResolver,[{key:"addRule",value:function addRule(en,tn){this.rules[en]=tn}},{key:"getRule",value:function getRule(en){var tn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(en,{type:tn.ordinal?"ordinal":"cardinal"})}catch(en){return}return this.rules[en]||this.rules[this.languageUtils.getLanguagePartFromCode(en)]}},{key:"needsPlural",value:function needsPlural(en){var tn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},nn=this.getRule(en,tn);return this.shouldUseIntlApi()?nn&&nn.resolvedOptions().pluralCategories.length>1:nn&&nn.numbers.length>1}},{key:"getPluralFormsOfKey",value:function getPluralFormsOfKey(en,tn){var nn=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(en,nn).map((function(en){return"".concat(tn).concat(en)}))}},{key:"getSuffixes",value:function getSuffixes(en){var tn=this,nn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},rn=this.getRule(en,nn);return rn?this.shouldUseIntlApi()?rn.resolvedOptions().pluralCategories.sort((function(en,tn){return mn[en]-mn[tn]})).map((function(en){return"".concat(tn.options.prepend).concat(en)})):rn.numbers.map((function(rn){return tn.getSuffix(en,rn,nn)})):[]}},{key:"getSuffix",value:function getSuffix(en,tn){var nn=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},rn=this.getRule(en,nn);return rn?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(rn.select(tn)):this.getSuffixRetroCompatible(rn,tn):(this.logger.warn("no plural rule found for: ".concat(en)),"")}},{key:"getSuffixRetroCompatible",value:function getSuffixRetroCompatible(en,tn){var nn=this,rn=en.noAbs?en.plurals(tn):en.plurals(Math.abs(tn)),an=en.numbers[rn];this.options.simplifyPluralSuffix&&2===en.numbers.length&&1===en.numbers[0]&&(2===an?an="plural":1===an&&(an=""));var sn=function returnSuffix(){return nn.options.prepend&&an.toString()?nn.options.prepend+an.toString():an.toString()};return"v1"===this.options.compatibilityJSON?1===an?"":"number"==typeof an?"_plural_".concat(an.toString()):sn():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===en.numbers.length&&1===en.numbers[0]?sn():this.options.prepend&&rn.toString()?this.options.prepend+rn.toString():rn.toString()}},{key:"shouldUseIntlApi",value:function shouldUseIntlApi(){return!_n.includes(this.options.compatibilityJSON)}}]),PluralResolver}();function ownKeys$3$1(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$3(en){for(var tn=1;tn0&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck(this,Interpolator),this.logger=tn.create("interpolator"),this.options=en,this.format=en.interpolation&&en.interpolation.format||function(en){return en},this.init(en)}return _createClass(Interpolator,[{key:"init",value:function init(){var en=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};en.interpolation||(en.interpolation={escapeValue:!0});var tn=en.interpolation;this.escape=void 0!==tn.escape?tn.escape:escape$1,this.escapeValue=void 0===tn.escapeValue||tn.escapeValue,this.useRawValueToEscape=void 0!==tn.useRawValueToEscape&&tn.useRawValueToEscape,this.prefix=tn.prefix?regexEscape$1(tn.prefix):tn.prefixEscaped||"{{",this.suffix=tn.suffix?regexEscape$1(tn.suffix):tn.suffixEscaped||"}}",this.formatSeparator=tn.formatSeparator?tn.formatSeparator:tn.formatSeparator||",",this.unescapePrefix=tn.unescapeSuffix?"":tn.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":tn.unescapeSuffix||"",this.nestingPrefix=tn.nestingPrefix?regexEscape$1(tn.nestingPrefix):tn.nestingPrefixEscaped||regexEscape$1("$t("),this.nestingSuffix=tn.nestingSuffix?regexEscape$1(tn.nestingSuffix):tn.nestingSuffixEscaped||regexEscape$1(")"),this.nestingOptionsSeparator=tn.nestingOptionsSeparator?tn.nestingOptionsSeparator:tn.nestingOptionsSeparator||",",this.maxReplaces=tn.maxReplaces?tn.maxReplaces:1e3,this.alwaysFormat=void 0!==tn.alwaysFormat&&tn.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function reset(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function resetRegExp(){var en="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(en,"g");var tn="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(tn,"g");var nn="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(nn,"g")}},{key:"interpolate",value:function interpolate(en,tn,nn,rn){var an,sn,cn,An=this,dn=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function regexSafe(en){return en.replace(/\$/g,"$$$$")}var un=function handleFormat(en){if(en.indexOf(An.formatSeparator)<0){var an=getPathWithDefaults(tn,dn,en);return An.alwaysFormat?An.format(an,void 0,nn,_objectSpread$3(_objectSpread$3(_objectSpread$3({},rn),tn),{},{interpolationkey:en})):an}var sn=en.split(An.formatSeparator),cn=sn.shift().trim(),un=sn.join(An.formatSeparator).trim();return An.format(getPathWithDefaults(tn,dn,cn),un,nn,_objectSpread$3(_objectSpread$3(_objectSpread$3({},rn),tn),{},{interpolationkey:cn}))};this.resetRegExp();var pn=rn&&rn.missingInterpolationHandler||this.options.missingInterpolationHandler,hn=rn&&rn.interpolation&&void 0!==rn.interpolation.skipOnVariables?rn.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function safeValue(en){return regexSafe(en)}},{regex:this.regexp,safeValue:function safeValue(en){return An.escapeValue?regexSafe(An.escape(en)):regexSafe(en)}}].forEach((function(tn){for(cn=0;an=tn.regex.exec(en);){var nn=an[1].trim();if(void 0===(sn=un(nn)))if("function"==typeof pn){var dn=pn(en,an,rn);sn="string"==typeof dn?dn:""}else if(rn&&rn.hasOwnProperty(nn))sn="";else{if(hn){sn=an[0];continue}An.logger.warn("missed to pass in variable ".concat(nn," for interpolating ").concat(en)),sn=""}else"string"==typeof sn||An.useRawValueToEscape||(sn=makeString(sn));var gn=tn.safeValue(sn);if(en=en.replace(an[0],gn),hn?(tn.regex.lastIndex+=sn.length,tn.regex.lastIndex-=an[0].length):tn.regex.lastIndex=0,++cn>=An.maxReplaces)break}})),en}},{key:"nest",value:function nest(en,tn){var nn,rn,an=this,sn=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},cn=_objectSpread$3({},sn);function handleHasOptions(en,tn){var nn=this.nestingOptionsSeparator;if(en.indexOf(nn)<0)return en;var rn=en.split(new RegExp("".concat(nn,"[ ]*{"))),an="{".concat(rn[1]);en=rn[0],an=(an=this.interpolate(an,cn)).replace(/'/g,'"');try{cn=JSON.parse(an),tn&&(cn=_objectSpread$3(_objectSpread$3({},tn),cn))}catch(tn){return this.logger.warn("failed parsing options string in nesting for key ".concat(en),tn),"".concat(en).concat(nn).concat(an)}return delete cn.defaultValue,en}for(cn.applyPostProcessor=!1,delete cn.defaultValue;nn=this.nestingRegexp.exec(en);){var An=[],dn=!1;if(-1!==nn[0].indexOf(this.formatSeparator)&&!/{.*}/.test(nn[1])){var un=nn[1].split(this.formatSeparator).map((function(en){return en.trim()}));nn[1]=un.shift(),An=un,dn=!0}if((rn=tn(handleHasOptions.call(this,nn[1].trim(),cn),cn))&&nn[0]===en&&"string"!=typeof rn)return rn;"string"!=typeof rn&&(rn=makeString(rn)),rn||(this.logger.warn("missed to resolve ".concat(nn[1]," for nesting ").concat(en)),rn=""),dn&&(rn=An.reduce((function(en,tn){return an.format(en,tn,sn.lng,_objectSpread$3(_objectSpread$3({},sn),{},{interpolationkey:nn[1].trim()}))}),rn.trim())),en=en.replace(nn[0],rn),this.regexp.lastIndex=0}return en}}]),Interpolator}();function ownKeys$4(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$4(en){for(var tn=1;tn0&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck(this,Formatter),this.logger=tn.create("formatter"),this.options=en,this.formats={number:function number(en,tn,nn){return new Intl.NumberFormat(tn,nn).format(en)},currency:function currency(en,tn,nn){return new Intl.NumberFormat(tn,_objectSpread$4(_objectSpread$4({},nn),{},{style:"currency"})).format(en)},datetime:function datetime(en,tn,nn){return new Intl.DateTimeFormat(tn,_objectSpread$4({},nn)).format(en)},relativetime:function relativetime(en,tn,nn){return new Intl.RelativeTimeFormat(tn,_objectSpread$4({},nn)).format(en,nn.range||"day")},list:function list(en,tn,nn){return new Intl.ListFormat(tn,_objectSpread$4({},nn)).format(en)}},this.init(en)}return _createClass(Formatter,[{key:"init",value:function init(en){var tn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},nn=tn.interpolation;this.formatSeparator=nn.formatSeparator?nn.formatSeparator:nn.formatSeparator||","}},{key:"add",value:function add(en,tn){this.formats[en.toLowerCase().trim()]=tn}},{key:"format",value:function format(en,tn,nn,rn){var an=this,sn=tn.split(this.formatSeparator).reduce((function(en,tn){var sn=function parseFormatStr(en){var tn=en.toLowerCase().trim(),nn={};if(en.indexOf("(")>-1){var rn=en.split("(");tn=rn[0].toLowerCase().trim();var an=rn[1].substring(0,rn[1].length-1);"currency"===tn&&an.indexOf(":")<0?nn.currency||(nn.currency=an.trim()):"relativetime"===tn&&an.indexOf(":")<0?nn.range||(nn.range=an.trim()):an.split(";").forEach((function(en){if(en){var tn=_toArray(en.split(":")),rn=tn[0],an=tn.slice(1).join(":").trim().replace(/^'+|'+$/g,"");nn[rn.trim()]||(nn[rn.trim()]=an),"false"===an&&(nn[rn.trim()]=!1),"true"===an&&(nn[rn.trim()]=!0),isNaN(an)||(nn[rn.trim()]=parseInt(an,10))}}))}return{formatName:tn,formatOptions:nn}}(tn),cn=sn.formatName,An=sn.formatOptions;if(an.formats[cn]){var dn=en;try{var un=rn&&rn.formatParams&&rn.formatParams[rn.interpolationkey]||{},pn=un.locale||un.lng||rn.locale||rn.lng||nn;dn=an.formats[cn](en,pn,_objectSpread$4(_objectSpread$4(_objectSpread$4({},An),rn),un))}catch(en){an.logger.warn(en)}return dn}return an.logger.warn("there was no format function for ".concat(cn)),en}),en);return sn}}]),Formatter}();function ownKeys$5(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$5(en){for(var tn=1;tn3&&void 0!==arguments[3]?arguments[3]:{};return _classCallCheck(this,Connector),An=rn.call(this),an&&nn.call(_assertThisInitialized(An)),An.backend=en,An.store=sn,An.services=cn,An.languageUtils=cn.languageUtils,An.options=dn,An.logger=tn.create("backendConnector"),An.waitingReads=[],An.maxParallelReads=dn.maxParallelReads||10,An.readingCalls=0,An.maxRetries=dn.maxRetries>=0?dn.maxRetries:5,An.retryTimeout=dn.retryTimeout>=1?dn.retryTimeout:350,An.state={},An.queue=[],An.backend&&An.backend.init&&An.backend.init(cn,dn.backend,dn),An}return _createClass(Connector,[{key:"queueLoad",value:function queueLoad(en,tn,nn,rn){var an=this,sn={},cn={},An={},dn={};return en.forEach((function(en){var rn=!0;tn.forEach((function(tn){var An="".concat(en,"|").concat(tn);!nn.reload&&an.store.hasResourceBundle(en,tn)?an.state[An]=2:an.state[An]<0||(1===an.state[An]?void 0===cn[An]&&(cn[An]=!0):(an.state[An]=1,rn=!1,void 0===cn[An]&&(cn[An]=!0),void 0===sn[An]&&(sn[An]=!0),void 0===dn[tn]&&(dn[tn]=!0)))})),rn||(An[en]=!0)})),(Object.keys(sn).length||Object.keys(cn).length)&&this.queue.push({pending:cn,pendingCount:Object.keys(cn).length,loaded:{},errors:[],callback:rn}),{toLoad:Object.keys(sn),pending:Object.keys(cn),toLoadLanguages:Object.keys(An),toLoadNamespaces:Object.keys(dn)}}},{key:"loaded",value:function loaded(en,tn,nn){var rn=en.split("|"),an=rn[0],sn=rn[1];tn&&this.emit("failedLoading",an,sn,tn),nn&&this.store.addResourceBundle(an,sn,nn),this.state[en]=tn?-1:2;var loaded={};this.queue.forEach((function(nn){!function pushPath(en,tn,nn,rn){var an=getLastOfPath(en,tn,Object),sn=an.obj,cn=an.k;sn[cn]=sn[cn]||[],rn&&(sn[cn]=sn[cn].concat(nn)),rn||sn[cn].push(nn)}(nn.loaded,[an],sn),function removePending(en,tn){void 0!==en.pending[tn]&&(delete en.pending[tn],en.pendingCount--)}(nn,en),tn&&nn.errors.push(tn),0!==nn.pendingCount||nn.done||(Object.keys(nn.loaded).forEach((function(en){loaded[en]||(loaded[en]={});var tn=nn.loaded[en];tn.length&&tn.forEach((function(tn){void 0===loaded[en][tn]&&(loaded[en][tn]=!0)}))})),nn.done=!0,nn.errors.length?nn.callback(nn.errors):nn.callback())})),this.emit("loaded",loaded),this.queue=this.queue.filter((function(en){return!en.done}))}},{key:"read",value:function read(en,tn,nn){var rn=this,an=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,sn=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,cn=arguments.length>5?arguments[5]:void 0;return en.length?this.readingCalls>=this.maxParallelReads?void this.waitingReads.push({lng:en,ns:tn,fcName:nn,tried:an,wait:sn,callback:cn}):(this.readingCalls++,this.backend[nn](en,tn,(function(An,dn){if(rn.readingCalls--,rn.waitingReads.length>0){var un=rn.waitingReads.shift();rn.read(un.lng,un.ns,un.fcName,un.tried,un.wait,un.callback)}An&&dn&&an2&&void 0!==arguments[2]?arguments[2]:{},an=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),an&&an();"string"==typeof en&&(en=this.languageUtils.toResolveHierarchy(en)),"string"==typeof tn&&(tn=[tn]);var sn=this.queueLoad(en,tn,rn,an);if(!sn.toLoad.length)return sn.pending.length||an(),null;sn.toLoad.forEach((function(en){nn.loadOne(en)}))}},{key:"load",value:function load(en,tn,nn){this.prepareLoading(en,tn,{},nn)}},{key:"reload",value:function reload(en,tn,nn){this.prepareLoading(en,tn,{reload:!0},nn)}},{key:"loadOne",value:function loadOne(en){var tn=this,nn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",rn=en.split("|"),an=rn[0],sn=rn[1];this.read(an,sn,"read",void 0,void 0,(function(rn,cn){rn&&tn.logger.warn("".concat(nn,"loading namespace ").concat(sn," for language ").concat(an," failed"),rn),!rn&&cn&&tn.logger.log("".concat(nn,"loaded namespace ").concat(sn," for language ").concat(an),cn),tn.loaded(en,rn,cn)}))}},{key:"saveMissing",value:function saveMissing(en,tn,nn,rn,an){var sn=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(tn)?this.logger.warn('did not save key "'.concat(nn,'" as the namespace "').concat(tn,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):null!=nn&&""!==nn&&(this.backend&&this.backend.create&&this.backend.create(en,tn,nn,rn,null,_objectSpread$5(_objectSpread$5({},sn),{},{isUpdate:an})),en&&en[0]&&this.store.addResource(en[0],tn,nn,rn))}}]),Connector}();function get(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function handle(en){var tn={};if("object"===_typeof$2(en[1])&&(tn=en[1]),"string"==typeof en[1]&&(tn.defaultValue=en[1]),"string"==typeof en[2]&&(tn.tDescription=en[2]),"object"===_typeof$2(en[2])||"object"===_typeof$2(en[3])){var nn=en[3]||en[2];Object.keys(nn).forEach((function(en){tn[en]=nn[en]}))}return tn},interpolation:{escapeValue:!0,format:function format(en,tn,nn,rn){return en},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function transformOptions(en){return"string"==typeof en.ns&&(en.ns=[en.ns]),"string"==typeof en.fallbackLng&&(en.fallbackLng=[en.fallbackLng]),"string"==typeof en.fallbackNS&&(en.fallbackNS=[en.fallbackNS]),en.supportedLngs&&en.supportedLngs.indexOf("cimode")<0&&(en.supportedLngs=en.supportedLngs.concat(["cimode"])),en}function ownKeys$6(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$6(en){for(var tn=1;tn0&&void 0!==arguments[0]?arguments[0]:{},cn=arguments.length>1?arguments[1]:void 0;if(_classCallCheck(this,I18n),en=rn.call(this),an&&nn.call(_assertThisInitialized(en)),en.options=transformOptions(sn),en.services={},en.logger=tn,en.modules={external:[]},bindMemberFunctions(_assertThisInitialized(en)),cn&&!en.isInitialized&&!sn.isClone){if(!en.options.initImmediate)return en.init(sn,cn),_possibleConstructorReturn(en,_assertThisInitialized(en));setTimeout((function(){en.init(sn,cn)}),0)}return en}return _createClass(I18n,[{key:"init",value:function init(){var en=this,nn=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},rn=arguments.length>1?arguments[1]:void 0;"function"==typeof nn&&(rn=nn,nn={}),!nn.defaultNS&&nn.ns&&("string"==typeof nn.ns?nn.defaultNS=nn.ns:nn.ns.indexOf("translation")<0&&(nn.defaultNS=nn.ns[0]));var an=get();function createClassOnDemand(en){return en?"function"==typeof en?new en:en:null}if(this.options=_objectSpread$6(_objectSpread$6(_objectSpread$6({},an),this.options),transformOptions(nn)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=_objectSpread$6(_objectSpread$6({},an.interpolation),this.options.interpolation)),void 0!==nn.keySeparator&&(this.options.userDefinedKeySeparator=nn.keySeparator),void 0!==nn.nsSeparator&&(this.options.userDefinedNsSeparator=nn.nsSeparator),!this.options.isClone){var sn;this.modules.logger?tn.init(createClassOnDemand(this.modules.logger),this.options):tn.init(null,this.options),this.modules.formatter?sn=this.modules.formatter:"undefined"!=typeof Intl&&(sn=bn);var An=new pn(this.options);this.store=new cn(this.options.resources,this.options);var dn=this.services;dn.logger=tn,dn.resourceStore=this.store,dn.languageUtils=An,dn.pluralResolver=new fn(An,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!sn||this.options.interpolation.format&&this.options.interpolation.format!==an.interpolation.format||(dn.formatter=createClassOnDemand(sn),dn.formatter.init(dn,this.options),this.options.interpolation.format=dn.formatter.format.bind(dn.formatter)),dn.interpolator=new yn(this.options),dn.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},dn.backendConnector=new vn(createClassOnDemand(this.modules.backend),dn.resourceStore,dn,this.options),dn.backendConnector.on("*",(function(tn){for(var nn=arguments.length,rn=new Array(nn>1?nn-1:0),an=1;an1?nn-1:0),an=1;an0&&"dev"!==hn[0]&&(this.options.lng=hn[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");var gn=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];gn.forEach((function(tn){en[tn]=function(){var nn;return(nn=en.store)[tn].apply(nn,arguments)}}));var _n=["addResource","addResources","addResourceBundle","removeResourceBundle"];_n.forEach((function(tn){en[tn]=function(){var nn;return(nn=en.store)[tn].apply(nn,arguments),en}}));var mn=defer(),wn=function load(){var tn=function finish(tn,nn){en.isInitialized&&!en.initializedStoreOnce&&en.logger.warn("init: i18next is already initialized. You should call init just once!"),en.isInitialized=!0,en.options.isClone||en.logger.log("initialized",en.options),en.emit("initialized",en.options),mn.resolve(nn),rn(tn,nn)};if(en.languages&&"v1"!==en.options.compatibilityAPI&&!en.isInitialized)return tn(null,en.t.bind(en));en.changeLanguage(en.options.lng,tn)};return this.options.resources||!this.options.initImmediate?wn():setTimeout(wn,0),mn}},{key:"loadResources",value:function loadResources(en){var tn=this,nn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:noop$2,rn=nn,an="string"==typeof en?en:this.language;if("function"==typeof en&&(rn=en),!this.options.resources||this.options.partialBundledLanguages){if(an&&"cimode"===an.toLowerCase())return rn();var sn=[],cn=function append(en){en&&tn.services.languageUtils.toResolveHierarchy(en).forEach((function(en){sn.indexOf(en)<0&&sn.push(en)}))};if(an)cn(an);else{var An=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);An.forEach((function(en){return cn(en)}))}this.options.preload&&this.options.preload.forEach((function(en){return cn(en)})),this.services.backendConnector.load(sn,this.options.ns,(function(en){en||tn.resolvedLanguage||!tn.language||tn.setResolvedLanguage(tn.language),rn(en)}))}else rn(null)}},{key:"reloadResources",value:function reloadResources(en,tn,nn){var rn=defer();return en||(en=this.languages),tn||(tn=this.options.ns),nn||(nn=noop$2),this.services.backendConnector.reload(en,tn,(function(en){rn.resolve(),nn(en)})),rn}},{key:"use",value:function use(en){if(!en)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!en.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===en.type&&(this.modules.backend=en),("logger"===en.type||en.log&&en.warn&&en.error)&&(this.modules.logger=en),"languageDetector"===en.type&&(this.modules.languageDetector=en),"i18nFormat"===en.type&&(this.modules.i18nFormat=en),"postProcessor"===en.type&&An.addPostProcessor(en),"formatter"===en.type&&(this.modules.formatter=en),"3rdParty"===en.type&&this.modules.external.push(en),this}},{key:"setResolvedLanguage",value:function setResolvedLanguage(en){if(en&&this.languages&&!(["cimode","dev"].indexOf(en)>-1))for(var tn=0;tn-1)&&this.store.hasLanguageSomeTranslations(nn)){this.resolvedLanguage=nn;break}}}},{key:"changeLanguage",value:function changeLanguage(en,tn){var nn=this;this.isLanguageChangingTo=en;var rn=defer();this.emit("languageChanging",en);var an=function setLngProps(en){nn.language=en,nn.languages=nn.services.languageUtils.toResolveHierarchy(en),nn.resolvedLanguage=void 0,nn.setResolvedLanguage(en)},sn=function setLng(sn){en||sn||!nn.services.languageDetector||(sn=[]);var cn="string"==typeof sn?sn:nn.services.languageUtils.getBestMatchFromCodes(sn);cn&&(nn.language||an(cn),nn.translator.language||nn.translator.changeLanguage(cn),nn.services.languageDetector&&nn.services.languageDetector.cacheUserLanguage(cn)),nn.loadResources(cn,(function(en){!function done(en,sn){sn?(an(sn),nn.translator.changeLanguage(sn),nn.isLanguageChangingTo=void 0,nn.emit("languageChanged",sn),nn.logger.log("languageChanged",sn)):nn.isLanguageChangingTo=void 0,rn.resolve((function(){return nn.t.apply(nn,arguments)})),tn&&tn(en,(function(){return nn.t.apply(nn,arguments)}))}(en,cn)}))};return en||!this.services.languageDetector||this.services.languageDetector.async?!en&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(sn):sn(en):sn(this.services.languageDetector.detect()),rn}},{key:"getFixedT",value:function getFixedT(en,tn,nn){var rn=this,an=function fixedT(en,tn){var an;if("object"!==_typeof$2(tn)){for(var sn=arguments.length,cn=new Array(sn>2?sn-2:0),An=2;An1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var rn=this.resolvedLanguage||this.languages[0],an=!!this.options&&this.options.fallbackLng,sn=this.languages[this.languages.length-1];if("cimode"===rn.toLowerCase())return!0;var cn=function loadNotPending(en,nn){var rn=tn.services.backendConnector.state["".concat(en,"|").concat(nn)];return-1===rn||2===rn};if(nn.precheck){var An=nn.precheck(this,cn);if(void 0!==An)return An}return!!this.hasResourceBundle(rn,en)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!cn(rn,en)||an&&!cn(sn,en)))}},{key:"loadNamespaces",value:function loadNamespaces(en,tn){var nn=this,rn=defer();return this.options.ns?("string"==typeof en&&(en=[en]),en.forEach((function(en){nn.options.ns.indexOf(en)<0&&nn.options.ns.push(en)})),this.loadResources((function(en){rn.resolve(),tn&&tn(en)})),rn):(tn&&tn(),Promise.resolve())}},{key:"loadLanguages",value:function loadLanguages(en,tn){var nn=defer();"string"==typeof en&&(en=[en]);var rn=this.options.preload||[],an=en.filter((function(en){return rn.indexOf(en)<0}));return an.length?(this.options.preload=rn.concat(an),this.loadResources((function(en){nn.resolve(),tn&&tn(en)})),nn):(tn&&tn(),Promise.resolve())}},{key:"dir",value:function dir(en){if(en||(en=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!en)return"rtl";return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(this.services.languageUtils.getLanguagePartFromCode(en))>-1||en.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function cloneInstance(){var en=this,tn=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},nn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:noop$2,rn=_objectSpread$6(_objectSpread$6(_objectSpread$6({},this.options),tn),{isClone:!0}),an=new I18n(rn),sn=["store","services","language"];return sn.forEach((function(tn){an[tn]=en[tn]})),an.services=_objectSpread$6({},this.services),an.services.utils={hasLoadedNamespace:an.hasLoadedNamespace.bind(an)},an.translator=new un(an.services,an.options),an.translator.on("*",(function(en){for(var tn=arguments.length,nn=new Array(tn>1?tn-1:0),rn=1;rn0&&void 0!==arguments[0]?arguments[0]:{},tn=arguments.length>1?arguments[1]:void 0;return new wn(en,tn)}));var xn=wn.createInstance();let kn;xn.createInstance=wn.createInstance,xn.createInstance,xn.init,xn.loadResources,xn.reloadResources,xn.use,xn.changeLanguage,xn.getFixedT,xn.t,xn.exists,xn.setDefaultNamespace,xn.hasLoadedNamespace,xn.loadNamespaces,xn.loadLanguages;const putLocale=async function(en,tn){en?kn=en:navigator.userLanguage?kn=navigator.userLanguage:navigator.language&&(kn=navigator.language),tn.includes(kn)||"test"===kn||(kn="en");const nn=await function __variableDynamicImportRuntime0__(en){switch(en){case"./locale/lang.af.js":return Promise.resolve().then((function(){return zS}));case"./locale/lang.ar.js":return Promise.resolve().then((function(){return KS}));case"./locale/lang.az.js":return Promise.resolve().then((function(){return $S}));case"./locale/lang.be.js":return Promise.resolve().then((function(){return WS}));case"./locale/lang.bg.js":return Promise.resolve().then((function(){return XS}));case"./locale/lang.ca.js":return Promise.resolve().then((function(){return YS}));case"./locale/lang.cs.js":return Promise.resolve().then((function(){return ZS}));case"./locale/lang.cy.js":return Promise.resolve().then((function(){return JS}));case"./locale/lang.da.js":return Promise.resolve().then((function(){return eB}));case"./locale/lang.de.js":return Promise.resolve().then((function(){return tB}));case"./locale/lang.el.js":return Promise.resolve().then((function(){return nB}));case"./locale/lang.en.js":return Promise.resolve().then((function(){return rB}));case"./locale/lang.es.js":return Promise.resolve().then((function(){return oB}));case"./locale/lang.et.js":return Promise.resolve().then((function(){return iB}));case"./locale/lang.fa.js":return Promise.resolve().then((function(){return aB}));case"./locale/lang.fi.js":return Promise.resolve().then((function(){return sB}));case"./locale/lang.fr.js":return Promise.resolve().then((function(){return lB}));case"./locale/lang.fy.js":return Promise.resolve().then((function(){return cB}));case"./locale/lang.ga.js":return Promise.resolve().then((function(){return AB}));case"./locale/lang.gl.js":return Promise.resolve().then((function(){return dB}));case"./locale/lang.he.js":return Promise.resolve().then((function(){return uB}));case"./locale/lang.hi.js":return Promise.resolve().then((function(){return pB}));case"./locale/lang.hr.js":return Promise.resolve().then((function(){return hB}));case"./locale/lang.hu.js":return Promise.resolve().then((function(){return gB}));case"./locale/lang.hy.js":return Promise.resolve().then((function(){return _B}));case"./locale/lang.id.js":return Promise.resolve().then((function(){return mB}));case"./locale/lang.is.js":return Promise.resolve().then((function(){return fB}));case"./locale/lang.it.js":return Promise.resolve().then((function(){return yB}));case"./locale/lang.ja.js":return Promise.resolve().then((function(){return bB}));case"./locale/lang.ko.js":return Promise.resolve().then((function(){return vB}));case"./locale/lang.lt.js":return Promise.resolve().then((function(){return wB}));case"./locale/lang.lv.js":return Promise.resolve().then((function(){return xB}));case"./locale/lang.mk.js":return Promise.resolve().then((function(){return kB}));case"./locale/lang.ms.js":return Promise.resolve().then((function(){return CB}));case"./locale/lang.mt.js":return Promise.resolve().then((function(){return SB}));case"./locale/lang.nl.js":return Promise.resolve().then((function(){return BB}));case"./locale/lang.no.js":return Promise.resolve().then((function(){return EB}));case"./locale/lang.pl.js":return Promise.resolve().then((function(){return jB}));case"./locale/lang.pt-BR.js":return Promise.resolve().then((function(){return LB}));case"./locale/lang.pt-PT.js":return Promise.resolve().then((function(){return PB}));case"./locale/lang.ro.js":return Promise.resolve().then((function(){return TB}));case"./locale/lang.ru.js":return Promise.resolve().then((function(){return FB}));case"./locale/lang.sk.js":return Promise.resolve().then((function(){return UB}));case"./locale/lang.sl.js":return Promise.resolve().then((function(){return NB}));case"./locale/lang.sq.js":return Promise.resolve().then((function(){return IB}));case"./locale/lang.sr.js":return Promise.resolve().then((function(){return MB}));case"./locale/lang.sv.js":return Promise.resolve().then((function(){return RB}));case"./locale/lang.sw.js":return Promise.resolve().then((function(){return OB}));case"./locale/lang.test.js":return Promise.resolve().then((function(){return QB}));case"./locale/lang.th.js":return Promise.resolve().then((function(){return qB}));case"./locale/lang.tl.js":return Promise.resolve().then((function(){return VB}));case"./locale/lang.tr.js":return Promise.resolve().then((function(){return GB}));case"./locale/lang.uk.js":return Promise.resolve().then((function(){return DB}));case"./locale/lang.vi.js":return Promise.resolve().then((function(){return HB}));case"./locale/lang.yi.js":return Promise.resolve().then((function(){return zB}));case"./locale/lang.zh-CN.js":return Promise.resolve().then((function(){return KB}));case"./locale/lang.zh-HK.js":return Promise.resolve().then((function(){return $B}));case"./locale/lang.zh-TW.js":return Promise.resolve().then((function(){return WB}));default:return new Promise((function(tn,nn){("function"==typeof queueMicrotask?queueMicrotask:setTimeout)(nn.bind(null,new Error("Unknown variable dynamic import: "+en)))}))}}("./locale/lang.".concat(encodeURIComponent(kn),".js"));return xn.init({lng:kn,debug:!1,resources:{[kn]:{translation:nn.default}}}),{langParam:kn,i18next:xn}},t$1=function(en){return xn.t(en)},Cn=document.createElement("template");Cn.innerHTML='\n \n
\n icon\n
\n';class ToolButton extends HTMLElement{constructor(){super(),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(Cn.content.cloneNode(!0)),this.$div=this._shadowRoot.querySelector("div"),this.$img=this._shadowRoot.querySelector("img"),this.imgPath=svgEditor.configObj.curConfig.imgPath}static get observedAttributes(){return["title","src","pressed","disabled","size","style"]}attributeChangedCallback(en,tn,nn){if(tn!==nn)switch(en){case"title":{const en=this.getAttribute("shortcut");this.$div.setAttribute("title","".concat(t$1(nn)," ").concat(en?"[".concat(t$1(en),"]"):""))}break;case"style":this.$div.style=nn;break;case"src":-1!==nn.indexOf("data:")?this.$img.setAttribute("src",nn):this.$img.setAttribute("src",this.imgPath+"/"+nn);break;case"pressed":null===nn?this.$div.classList.remove("pressed"):this.$div.classList.add("pressed");break;case"size":"small"===nn?this.$div.classList.add("small"):this.$div.classList.remove("small");break;case"disabled":nn?this.$div.classList.add("disabled"):this.$div.classList.remove("disabled");break;default:console.error("unknown attribute: ".concat(en))}}get title(){return this.getAttribute("title")}set title(en){this.setAttribute("title",en)}get pressed(){return this.hasAttribute("pressed")}set pressed(en){en?this.setAttribute("pressed","true"):this.removeAttribute("pressed")}get disabled(){return this.hasAttribute("disabled")}set disabled(en){en?this.setAttribute("disabled","true"):this.removeAttribute("disabled")}get src(){return this.getAttribute("src")}set src(en){this.setAttribute("src",en)}get size(){return this.getAttribute("size")}set size(en){this.setAttribute("size",en)}connectedCallback(){const en=this.getAttribute("shortcut");en&&document.addEventListener("keydown",(tn=>{if("BODY"!==tn.target.nodeName)return;const nn="".concat(tn.metaKey?"meta+":"").concat(tn.ctrlKey?"ctrl+":"").concat(tn.key.toUpperCase());en===nn&&(this.click(),tn.preventDefault())}))}}customElements.define("se-button",ToolButton);class FlyingButton extends HTMLElement{constructor(){super(),this.imgPath=svgEditor.configObj.curConfig.imgPath,this.template=this.createTemplate(this.imgPath),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(this.template.content.cloneNode(!0)),this.$button=this._shadowRoot.querySelector(".menu-button"),this.$handle=this._shadowRoot.querySelector(".handle"),this.$overall=this._shadowRoot.querySelector(".overall"),this.$img=this._shadowRoot.querySelector("img"),this.$menu=this._shadowRoot.querySelector(".menu"),this.$elements=this.$menu.lastElementChild.assignedElements()}createTemplate(en){const tn=document.createElement("template");return tn.innerHTML="\n \n\n
\n \n \n
'),tn}static get observedAttributes(){return["title","pressed","disabled","opened"]}attributeChangedCallback(en,tn,nn){if(tn!==nn)switch(en){case"title":{const en=this.getAttribute("shortcut");this.$button.setAttribute("title","".concat(t$1(nn)," ").concat(en?"[".concat(t$1(en),"]"):""))}break;case"pressed":nn?this.$overall.classList.add("pressed"):this.$overall.classList.remove("pressed");break;case"opened":nn?this.$menu.classList.add("open"):this.$menu.classList.remove("open");break;case"disabled":nn?this.$overall.classList.add("disabled"):this.$overall.classList.remove("disabled");break;default:console.error("unknown attribute: ".concat(en))}}get title(){return this.getAttribute("title")}set title(en){this.setAttribute("title",en)}get pressed(){return this.hasAttribute("pressed")}set pressed(en){en?this.setAttribute("pressed","true"):(this.removeAttribute("pressed",""),this.removeAttribute("opened"))}get opened(){return this.hasAttribute("opened")}set opened(en){en?this.setAttribute("opened","opened"):this.removeAttribute("opened")}get disabled(){return this.hasAttribute("disabled")}set disabled(en){en?this.setAttribute("disabled","true"):this.removeAttribute("disabled","")}connectedCallback(){this.activeSlot=this.shadowRoot.querySelector("slot").assignedElements()[0],this.$img.setAttribute("src",this.imgPath+"/"+this.activeSlot.getAttribute("src"));const onClickHandler=en=>{switch(en.stopPropagation(),en.target.nodeName){case"SE-FLYINGBUTTON":this.pressed?this.setAttribute("opened","opened"):(this.activeSlot.click(),this.setAttribute("pressed","pressed"));break;case"SE-BUTTON":this.$img.setAttribute("src",this.imgPath+"/"+en.target.getAttribute("src")),this.activeSlot=en.target,this.setAttribute("pressed","pressed"),this.$menu.classList.remove("open");break;case"DIV":if(this.opened)this.removeAttribute("opened");else{this.setAttribute("opened","opened");const en=this.getBoundingClientRect();this.$menu.style.top=en.top+"px"}break;default:console.error("unkonw nodeName for:",en.target,en.target.className)}};svgEditor.$click(this,onClickHandler),svgEditor.$click(this.$handle,onClickHandler)}}customElements.define("se-flyingbutton",FlyingButton);class ExplorerButton extends HTMLElement{constructor(){super(),this.imgPath=svgEditor.configObj.curConfig.imgPath,this.template=this.createTemplate(this.imgPath),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(this.template.content.cloneNode(!0)),this.$button=this._shadowRoot.querySelector(".menu-button"),this.$overall=this._shadowRoot.querySelector(".overall"),this.$img=this._shadowRoot.querySelector(".menu-button img"),this.$menu=this._shadowRoot.querySelector(".menu"),this.$handle=this._shadowRoot.querySelector(".handle"),this.$lib=this._shadowRoot.querySelector(".image-lib"),this.files=[],this.request=new XMLHttpRequest,this.imgPath=svgEditor.configObj.curConfig.imgPath}createTemplate(en){const tn=document.createElement("template");return tn.innerHTML="\n \n \n
\n \n
\n \n
\n \n
'),tn}static get observedAttributes(){return["title","pressed","disabled","lib","src"]}async attributeChangedCallback(en,tn,nn){if(tn!==nn)switch(en){case"title":{const en=this.getAttribute("shortcut");this.$button.setAttribute("title","".concat(nn," [").concat(en,"]"))}break;case"pressed":nn?this.$overall.classList.add("pressed"):this.$overall.classList.remove("pressed");break;case"disabled":nn?this.$overall.classList.add("disabled"):this.$overall.classList.remove("disabled");break;case"lib":try{const en=await fetch("".concat(nn,"index.json")),tn=await en.json(),{lib:rn}=tn;this.$menu.innerHTML=rn.map(((en,tn)=>'"))).join(""),await this.updateLib(rn[0])}catch(en){console.error(en)}break;case"src":this.$img.setAttribute("src",this.imgPath+"/"+nn);break;default:console.error("unknown attribute: ".concat(en))}}get title(){return this.getAttribute("title")}set title(en){this.setAttribute("title",en)}get pressed(){return this.hasAttribute("pressed")}set pressed(en){en?this.setAttribute("pressed","true"):this.removeAttribute("pressed","")}get disabled(){return this.hasAttribute("disabled")}set disabled(en){en?this.setAttribute("disabled","true"):this.removeAttribute("disabled","")}connectedCallback(){const onClickHandler=en=>{switch(en.stopPropagation(),en.target.nodeName){case"SE-EXPLORERBUTTON":this.$menu.classList.add("open"),this.$lib.classList.add("open-lib");break;case"SE-BUTTON":this.currentAction=en.target,this.$img.setAttribute("src",this.currentAction.getAttribute("src")),this.dataset.draw=this.data[this.currentAction.dataset.shape],this._shadowRoot.querySelectorAll(".image-lib [pressed]").forEach((en=>{en.pressed=!1})),this.currentAction.setAttribute("pressed","pressed"),this.$menu.classList.remove("open"),this.$lib.classList.remove("open-lib");break;case"DIV":"handle"===en.target.classList[0]?(this.$menu.classList.toggle("open"),this.$lib.classList.toggle("open-lib")):(this._shadowRoot.querySelectorAll(".menu > .pressed").forEach((en=>{en.classList.remove("pressed")})),en.target.classList.add("pressed"),this.updateLib(en.target.dataset.menu));break;default:console.error("unknown nodeName for:",en.target,en.target.className)}};svgEditor.$click(this,onClickHandler),svgEditor.$click(this.$menu,onClickHandler),svgEditor.$click(this.$lib,onClickHandler),svgEditor.$click(this.$handle,onClickHandler)}async updateLib(en){const tn=this.getAttribute("lib");try{var nn;const rn=await fetch("".concat(tn).concat(en,".json")),an=await rn.json();this.data=an.data;const sn=null!==(nn=an.size)&&void 0!==nn?nn:300,cn=an.fill?"#333":"none",An=.05*sn,dn=[-An,-An,sn+2*An,sn+2*An].join(" "),un=an.fill?0:sn/30;this.$lib.innerHTML=Object.entries(this.data).map((en=>{let[tn,nn]=en;const rn=btoa('\n \n \n '));return'')})).join("")}catch(nn){console.error("could not read file:".concat(tn).concat(en,".json"),nn)}}}customElements.define("se-explorerbutton",ExplorerButton);const Sn=document.createElement("template");Sn.innerHTML='\n \n
\n icon\n \n
\n
\n
\n
\n
\n \n
\n
\n \n';class SeZoom extends HTMLElement{constructor(){super(),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.initPopup=this.initPopup.bind(this),this.handleInput=this.handleInput.bind(this),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(Sn.content.cloneNode(!0)),this.slotElement=this._shadowRoot.querySelector("slot"),this.slotElement.addEventListener("slotchange",this.handleOptionsChange.bind(this)),this.inputElement=this._shadowRoot.querySelector("input"),this.inputElement.addEventListener("click",this.handleClick.bind(this)),this.inputElement.addEventListener("change",this.handleInput),this.inputElement.addEventListener("keydown",this.handleKeyDown),this.clickArea=this._shadowRoot.querySelector("#down"),this.clickArea.addEventListener("click",this.handleClick.bind(this)),this.imageElement=this._shadowRoot.querySelector("img"),this.imageElement.setAttribute("src",this.imgPath=svgEditor.configObj.curConfig.imgPath+"/"+this.getAttribute("src")),this.arrowUp=this._shadowRoot.querySelector("#arrow-up"),this.arrowUp.addEventListener("click",this.increment.bind(this)),this.arrowUp.addEventListener("mousedown",(en=>this.handleMouseDown("up",!0))),this.arrowUp.addEventListener("mouseleave",(en=>this.handleMouseUp("up"))),this.arrowUp.addEventListener("mouseup",(en=>this.handleMouseUp("up"))),this.arrowDown=this._shadowRoot.querySelector("#arrow-down"),this.arrowDown.addEventListener("click",this.decrement.bind(this)),this.arrowDown.addEventListener("mousedown",(en=>this.handleMouseDown("down",!0))),this.arrowDown.addEventListener("mouseleave",(en=>this.handleMouseUp("down"))),this.arrowDown.addEventListener("mouseup",(en=>this.handleMouseUp("down"))),this.optionsContainer=this._shadowRoot.querySelector("#options-container"),document.addEventListener("click",(en=>this.handleClose(en))),this.changedTimeout=null}static get observedAttributes(){return["value"]}get value(){return this.getAttribute("value")}set value(en){this.setAttribute("value",en)}attributeChangedCallback(en,tn,nn){if(tn!==nn){if("value"===en)this.inputElement.value=nn,this.dispatchEvent(new CustomEvent("change",{detail:{value:nn}}))}else if("value"===en)parseInt(this.inputElement.value)!==nn&&(this.inputElement.value=nn)}handleOptionsChange(){this.slotElement.assignedElements().length>0&&(this.options=this.slotElement.assignedElements(),this.selectedValue=this.options[0].textContent,this.initPopup(),this.options.forEach((en=>{en.addEventListener("click",(en=>this.handleSelect(en)))})))}handleClick(){this.optionsContainer.style.display="flex",this.inputElement.select(),this.initPopup()}handleSelect(en){this.value=en.target.getAttribute("value"),this.title=en.target.getAttribute("text")}initPopup(){const en=this.getBoundingClientRect(),tn=this.optionsContainer.getBoundingClientRect(),nn=en.top-tn.height,rn=en.left;this.optionsContainer.style.position="fixed",this.optionsContainer.style.top="".concat(nn,"px"),this.optionsContainer.style.left="".concat(rn,"px")}handleClose(en){en.target!==this&&(this.optionsContainer.style.display="none",this.inputElement.blur())}handleInput(){this.changedTimeout&&clearTimeout(this.changedTimeout),this.changedTimeout=setTimeout(this.triggerInputChanged.bind(this),500)}triggerInputChanged(){const en=this.inputElement.value;this.value=en}increment(){this.value=parseInt(this.value)+10}decrement(){this.value-10<=0?this.value=10:this.value=parseInt(this.value)-10}handleMouseDown(en,tn){"up"===en?(this.incrementHold=!0,!tn&&this.increment(),setTimeout((()=>{this.incrementHold&&this.handleMouseDown(en,!1)}),tn?500:50)):"down"===en&&(this.decrementHold=!0,!tn&&this.decrement(),setTimeout((()=>{this.decrementHold&&this.handleMouseDown(en,!1)}),tn?500:50))}handleMouseUp(en){"up"===en?this.incrementHold=!1:this.decrementHold=!1}handleKeyDown(en){"ArrowUp"===en.key?this.increment():"ArrowDown"===en.key&&this.decrement()}}function _defineProperty$1(en,tn,nn){return tn in en?Object.defineProperty(en,tn,{value:nn,enumerable:!0,configurable:!0,writable:!0}):en[tn]=nn,en}function _taggedTemplateLiteral(en,tn){return tn||(tn=en.slice(0)),Object.freeze(Object.defineProperties(en,{raw:{value:Object.freeze(tn)}}))}customElements.define("se-zoom",SeZoom);const Bn={html(en){for(var tn=arguments.length,nn=new Array(tn>1?tn-1:0),rn=1;rn1?nn-1:0),an=1;an{const nn=Object.getOwnPropertyDescriptor(en.prototype,tn);return nn&&"function"==typeof nn.set})).map((en=>function propertyNameToAttribute(en){let tn=$n[en];if(!tn){const nn=/([A-Z])/g;tn=en.replace(nn,"-$1").toLowerCase(),$n[en]=tn}return tn}(en))).filter((en=>nn.indexOf(en)<0));return nn.concat(rn)}function booleanAttributeValue(en,tn){return"boolean"==typeof tn?tn:"string"==typeof tn&&(""===tn||en.toLowerCase()===tn.toLowerCase())}const Wn={checked:!0,defer:!0,disabled:!0,hidden:!0,ismap:!0,multiple:!0,noresize:!0,readonly:!0,selected:!0},Xn=Symbol("state"),Yn=Symbol("raiseChangeEventsInNextRender"),Zn=Symbol("changedSinceLastRender");function fieldsChanged(en,tn){const nn={};for(const sn in tn)rn=tn[sn],an=en[sn],(rn instanceof Date&&an instanceof Date?rn.getTime()===an.getTime():rn===an)||(nn[sn]=!0);var rn,an;return nn}const Jn=new Map,Tr=Symbol("shadowIdProxy"),Ur=Symbol("proxyElement"),Rr={get(en,tn){const nn=en[Ur][Vn];return nn&&"string"==typeof tn?nn.getElementById(tn):null}};const Qr=function AttributeMarshallingMixin(en){return class AttributeMarshalling extends en{attributeChangedCallback(en,tn,nn){if(super.attributeChangedCallback&&super.attributeChangedCallback(en,tn,nn),nn!==tn&&!this[Qn]){const tn=function attributeToPropertyName(en){let tn=Kn[en];if(!tn){const nn=/-([a-z])/g;tn=en.replace(nn,(en=>en[1].toUpperCase())),Kn[en]=tn}return tn}(en);if(tn in this){const rn=Wn[en]?booleanAttributeValue(en,nn):nn;this[tn]=rn}}}static get observedAttributes(){return attributesForClass(this)}}}(function ReactiveMixin(en){class Reactive extends en{constructor(){super(),this[Pn]=void 0,this[In]=!1,this[Zn]=null,this[qn](this[jn])}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this[Rn]()}get[jn](){return super[jn]||{}}[Mn](en){super[Mn]&&super[Mn](en)}[Rn](){void 0===this[Pn]&&(this[Pn]=!0);const en=this[Zn];if(this[Pn]||en){const tn=this[In];this[In]=this[Yn],this[Yn]=!1,this[Qn]=!0,this[Mn](en),this[Qn]=!1,this[Zn]=null,this[On](en),this[Pn]=!1,this[In]=tn}}[On](en){super[On]&&super[On](en)}async[qn](en){this[Qn]&&console.warn("".concat(this.constructor.name," called [setState] during rendering, which you should avoid.\nSee https://elix.org/documentation/ReactiveMixin."));const{state:tn,changed:nn}=function copyStateWithChanges(en,tn){const nn=Object.assign({},en[Xn]),rn={};let an=tn;for(;;){const tn=fieldsChanged(nn,an);if(0===Object.keys(tn).length)break;Object.assign(nn,an),Object.assign(rn,tn),an=en[Hn](nn,tn)}return{state:nn,changed:rn}}(this,en);if(this[Xn]&&0===Object.keys(nn).length)return;Object.freeze(tn),this[Xn]=tn,this[In]&&(this[Yn]=!0);const rn=void 0===this[Pn]||null!==this[Zn];this[Zn]=Object.assign(this[Zn]||{},nn);this.isConnected&&!rn&&(await Promise.resolve(),this[Rn]())}get[Dn](){return this[Xn]}[Hn](en,tn){return super[Hn]?super[Hn](en,tn):{}}}return"true"===new URLSearchParams(location.search).get("elixdebug")&&Object.defineProperty(Reactive.prototype,"state",{get(){return this[Dn]}}),Reactive}(function ShadowTemplateMixin(en){return class ShadowTemplate extends en{get[Un](){if(!this[Tr]){const en={[Ur]:this};this[Tr]=new Proxy(en,Rr)}return this[Tr]}[Mn](en){if(super[Mn]&&super[Mn](en),void 0===this[Vn]){const en=function getTemplate(en){let tn=en[Fn]?void 0:Jn.get(en.constructor);if(void 0===tn){if(tn=en[zn],tn&&!(tn instanceof HTMLTemplateElement))throw"Warning: the [template] property for ".concat(en.constructor.name," must return an HTMLTemplateElement.");en[Fn]||Jn.set(en.constructor,tn||null)}return tn}(this);if(en){const tn=this.attachShadow({delegatesFocus:this[Ln],mode:this[Gn]}),nn=document.importNode(en.content,!0);tn.append(nn),this[Vn]=tn}else this[Vn]=null}}get[Gn](){return"open"}}}(HTMLElement))),Vr=Symbol("checkSize"),Gr=Symbol("closestAvailableItemIndex"),Dr=Symbol("contentSlot"),Hr=jn,zr=Symbol("defaultTabIndex"),Kr=Ln,$r=Symbol("effectEndTarget"),Wr=Pn,Xr=Tn,Yr=Symbol("getItemText"),Zr=Symbol("goDown"),Jr=Symbol("goEnd"),eo=Symbol("goFirst"),to=Symbol("goLast"),no=Symbol("goLeft"),ro=Symbol("goNext"),oo=Symbol("goPrevious"),io=Symbol("goRight"),ao=Symbol("goStart"),so=Symbol("goToItemWithPrefix"),lo=Symbol("goUp"),co=Fn,Ao=Un,uo=Symbol("inputDelegate"),po=Symbol("itemsDelegate"),ho=Symbol("keydown"),go=Symbol("mouseenter"),_o=Symbol("mouseleave"),mo=Nn,fo=In,yo=Mn,bo=Rn,vo=Symbol("renderDataToElement"),wo=On,xo=Qn,ko=Symbol("scrollTarget"),Co=qn,So=Vn,Bo=Gn,Eo=Symbol("startEffect"),jo=Dn,Lo=Hn,Po=Symbol("swipeDown"),To=Symbol("swipeDownComplete"),Fo=Symbol("swipeLeft"),Uo=Symbol("swipeLeftTransitionEnd"),No=Symbol("swipeRight"),Io=Symbol("swipeRightTransitionEnd"),Mo=Symbol("swipeUp"),Ro=Symbol("swipeUpComplete"),Oo=Symbol("swipeStart"),Qo=Symbol("swipeTarget"),qo=Symbol("tap"),Vo=zn,Go=Symbol("toggleSelectedFlag");function DelegateInputLabelMixin(en){return class DelegateInputLabel extends en{get ariaLabel(){return this[jo].ariaLabel}set ariaLabel(en){this[jo].removingAriaAttribute||this[Co]({ariaLabel:String(en)})}get ariaLabelledby(){return this[jo].ariaLabelledby}set ariaLabelledby(en){this[jo].removingAriaAttribute||this[Co]({ariaLabelledby:String(en)})}get[Hr](){return Object.assign(super[Hr]||{},{ariaLabel:null,ariaLabelledby:null,inputLabel:null,removingAriaAttribute:!1})}[yo](en){if(super[yo]&&super[yo](en),this[Wr]&&this.addEventListener("focus",(()=>{this[fo]=!0;const en=refreshInputLabel(this,this[jo]);this[Co]({inputLabel:en}),this[fo]=!1})),en.inputLabel){const{inputLabel:en}=this[jo];en?this[uo].setAttribute("aria-label",en):this[uo].removeAttribute("aria-label")}}[wo](en){if(super[wo]&&super[wo](en),this[Wr]){(window.requestIdleCallback||setTimeout)((()=>{const en=refreshInputLabel(this,this[jo]);this[Co]({inputLabel:en})}))}const{ariaLabel:tn,ariaLabelledby:nn}=this[jo];en.ariaLabel&&!this[jo].removingAriaAttribute&&this.getAttribute("aria-label")&&(this.setAttribute("delegated-label",tn),this[Co]({removingAriaAttribute:!0}),this.removeAttribute("aria-label")),en.ariaLabelledby&&!this[jo].removingAriaAttribute&&this.getAttribute("aria-labelledby")&&(this.setAttribute("delegated-labelledby",nn),this[Co]({removingAriaAttribute:!0}),this.removeAttribute("aria-labelledby")),en.removingAriaAttribute&&this[jo].removingAriaAttribute&&this[Co]({removingAriaAttribute:!1})}[Lo](en,tn){const nn=super[Lo]?super[Lo](en,tn):{};if(tn.ariaLabel&&en.ariaLabel||tn.selectedText&&en.ariaLabelledby&&this.matches(":focus-within")){const tn=refreshInputLabel(this,en);Object.assign(nn,{inputLabel:tn})}return nn}}}function getLabelFromElement(en){if("selectedText"in en)return en.selectedText;if("value"in en&&"options"in en){const tn=en.value,nn=en.options.find((en=>en.value===tn));return nn?nn.innerText:""}return"value"in en?en.value:en.innerText}function refreshInputLabel(en,tn){const{ariaLabel:nn,ariaLabelledby:rn}=tn,an=en.isConnected?en.getRootNode():null;let sn=null;if(rn&&an){const nn=rn.split(" ").map((nn=>{const rn=an.getElementById(nn);return rn?rn===en&&null!==tn.value?tn.selectedText:getLabelFromElement(rn):""}));sn=nn.join(" ")}else if(nn)sn=nn;else if(an){const tn=en.id;if(tn){const en=an.querySelector('[for="'.concat(tn,'"]'));en instanceof HTMLElement&&(sn=getLabelFromElement(en))}if(null===sn){const tn=en.closest("label");tn&&(sn=getLabelFromElement(tn))}}return sn&&(sn=sn.trim()),sn}"true"===new URLSearchParams(location.search).get("elixdebug")&&(window.elix={internal:{checkSize:Vr,closestAvailableItemIndex:Gr,contentSlot:Dr,defaultState:Hr,defaultTabIndex:zr,delegatesFocus:Kr,effectEndTarget:$r,firstRender:Wr,focusTarget:Xr,getItemText:Yr,goDown:Zr,goEnd:Jr,goFirst:eo,goLast:to,goLeft:no,goNext:ro,goPrevious:oo,goRight:io,goStart:ao,goToItemWithPrefix:so,goUp:lo,hasDynamicTemplate:co,ids:Ao,inputDelegate:uo,itemsDelegate:po,keydown:ho,mouseenter:go,mouseleave:_o,nativeInternals:mo,event:event,raiseChangeEvents:fo,render:yo,renderChanges:bo,renderDataToElement:vo,rendered:wo,rendering:xo,scrollTarget:ko,setState:Co,shadowRoot:So,shadowRootMode:Bo,startEffect:Eo,state:jo,stateEffects:Lo,swipeDown:Po,swipeDownComplete:To,swipeLeft:Fo,swipeLeftTransitionEnd:Uo,swipeRight:No,swipeRightTransitionEnd:Io,swipeUp:Mo,swipeUpComplete:Ro,swipeStart:Oo,swipeTarget:Qo,tap:qo,template:Vo,toggleSelectedFlag:Go}});const Do=Symbol("mousedownListener");function closestFocusableNode(en){for(const tn of selfAndComposedAncestors(en)){const en=tn[Tn]||tn,nn=en;if(en instanceof HTMLElement&&en.tabIndex>=0&&!nn.disabled&&!(en instanceof HTMLSlotElement))return en}return null}function deepContains(en,tn){let nn=tn;for(;nn;){const tn=nn.assignedSlot||nn.parentNode||nn.host;if(tn===en)return!0;nn=tn}return!1}function firstFocusableElement(en){const tn=walkComposedTree(en,(en=>en instanceof HTMLElement&&en.matches('a[href],area[href],button:not([disabled]),details,iframe,input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[contentEditable="true"],[tabindex]')&&en.tabIndex>=0)),{value:nn}=tn.next();return nn instanceof HTMLElement?nn:null}function forwardFocus(en,tn){en[Do]&&en.removeEventListener("mousedown",en[Do]),tn&&(en[Do]=en=>{if(0!==en.button)return;const nn=closestFocusableNode(tn[Tn]||tn);nn&&(nn.focus(),en.preventDefault())},en.addEventListener("mousedown",en[Do]))}function indexOfItemContainingTarget(en,tn){return Array.prototype.findIndex.call(en,(en=>en===tn||deepContains(en,tn)))}function ownEvent(en,tn){const nn=tn.composedPath()[0];return en===nn||deepContains(en,nn)}function*selfAndComposedAncestors(en){en&&(yield en,yield*function*composedAncestors(en){let tn=en;for(;tn=tn instanceof HTMLElement&&tn.assignedSlot?tn.assignedSlot:tn instanceof ShadowRoot?tn.host:tn.parentNode,tn;)yield tn}(en))}function setInternalState(en,tn,nn){if(en.toggleAttribute(tn,nn),en[Nn]&&en[Nn].states){const rn=en[Nn].states,an="--".concat(tn);nn?rn.add(an):rn.delete(an)}}function*walkComposedTree(en,tn){let nn;if(tn(en)&&(yield en),en instanceof HTMLElement&&en.shadowRoot)nn=en.shadowRoot.children;else{const tn=en instanceof HTMLSlotElement?en.assignedNodes({flatten:!0}):[];nn=tn.length>0?tn:en.childNodes}if(nn)for(let en=0;en{Promise.resolve().then((()=>{const tn=en.relatedTarget||document.activeElement,nn=this===tn,rn=deepContains(this,tn);!nn&&!rn&&(this[Co]({focusVisible:!1}),document.removeEventListener("focusvisiblechange",this[$o]),this[$o]=null)}))})),this.addEventListener("focusin",(()=>{Promise.resolve().then((()=>{this[jo].focusVisible!==Ko&&this[Co]({focusVisible:Ko}),this[$o]||(this[$o]=()=>function refreshFocus(en){en[Co]({focusVisible:Ko})}(this),document.addEventListener("focusvisiblechange",this[$o]))}))}))}get[Hr](){return Object.assign(super[Hr]||{},{focusVisible:!1})}[yo](en){if(super[yo]&&super[yo](en),en.focusVisible){const{focusVisible:en}=this[jo];this.toggleAttribute("focus-visible",en)}}get[Vo](){const en=super[Vo]||En.html(Ho||(Ho=_taggedTemplateLiteral([""])));return en.content.append(Bn.html(zo||(zo=_taggedTemplateLiteral(["\n \n "])))),en}}}function updateKeyboardActive(en){if(Ko!==en){Ko=en;const tn=new CustomEvent("focusvisiblechange",{detail:{focusVisible:Ko}});document.dispatchEvent(tn)}}function FormElementMixin(en){return class FormElement extends en{constructor(){super();const en=this;!this[mo]&&en.attachInternals&&(this[mo]=en.attachInternals())}checkValidity(){return this[mo].checkValidity()}get[Hr](){return Object.assign(super[Hr]||{},{name:"",validationMessage:"",valid:!0})}get internals(){return this[mo]}static get formAssociated(){return!0}get form(){return this[mo].form}get name(){return this[jo]?this[jo].name:""}set name(tn){const nn=String(tn);"name"in en.prototype&&(super.name=nn),this[Co]({name:nn})}[yo](en){if(super[yo]&&super[yo](en),en.name){const{name:en}=this[jo];en?this.setAttribute("name",en):this.removeAttribute("name")}if(this[mo]&&this[mo].setValidity&&(en.valid||en.validationMessage)){const{valid:en,validationMessage:tn}=this[jo];en?this[mo].setValidity({}):this[mo].setValidity({customError:!0},tn)}}[wo](en){super[wo]&&super[wo](en),en.value&&this[mo]&&this[mo].setFormValue&&this[mo].setFormValue(this[jo].value,this[jo])}reportValidity(){return this[mo].reportValidity()}get type(){return super.type||this.localName}get validationMessage(){return this[jo].validationMessage}get validity(){return this[mo].validity}get willValidate(){return this[mo].willValidate}}}function refreshSelectionState(en){const tn=en.inner,{selectionEnd:nn,selectionStart:rn}=tn;en[Co]({selectionEnd:nn,selectionStart:rn})}function DelegateFocusMixin(en){return class DelegateFocus extends en{get[Kr](){return!0}focus(en){const tn=this[Xr];tn&&tn.focus(en)}get[Xr](){return firstFocusableElement(this[So])}}}var Wo;window.addEventListener("keydown",(()=>{updateKeyboardActive(!0)}),{capture:!0}),window.addEventListener("mousedown",(()=>{updateKeyboardActive(!1)}),{capture:!0});const Xo=Symbol("extends"),Yo=Symbol("delegatedPropertySetters"),Zo={a:!0,area:!0,button:!0,details:!0,iframe:!0,input:!0,select:!0,textarea:!0},Jo={address:["scroll"],blockquote:["scroll"],caption:["scroll"],center:["scroll"],dd:["scroll"],dir:["scroll"],div:["scroll"],dl:["scroll"],dt:["scroll"],fieldset:["scroll"],form:["reset","scroll"],frame:["load"],h1:["scroll"],h2:["scroll"],h3:["scroll"],h4:["scroll"],h5:["scroll"],h6:["scroll"],iframe:["load"],img:["abort","error","load"],input:["abort","change","error","select","load"],li:["scroll"],link:["load"],menu:["scroll"],object:["error","scroll"],ol:["scroll"],p:["scroll"],script:["error","load"],select:["change","scroll"],tbody:["scroll"],tfoot:["scroll"],thead:["scroll"],textarea:["change","select","scroll"]},ei=["click","dblclick","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","wheel"],ti={abort:!0,change:!0,reset:!0},ni=["address","article","aside","blockquote","canvas","dd","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","section","table","tfoot","ul","video"],ri=["accept-charset","autoplay","buffered","challenge","codebase","colspan","contenteditable","controls","crossorigin","datetime","dirname","for","formaction","http-equiv","icon","ismap","itemprop","keytype","language","loop","manifest","maxlength","minlength","muted","novalidate","preload","radiogroup","readonly","referrerpolicy","rowspan","scoped","usemap"],oi=DelegateFocusMixin(Qr);class WrappedStandardElement extends oi{constructor(){super();const en=this;!this[mo]&&en.attachInternals&&(this[mo]=en.attachInternals())}attributeChangedCallback(en,tn,nn){if(ri.indexOf(en)>=0){const tn=Object.assign({},this[jo].innerAttributes,{[en]:nn});this[Co]({innerAttributes:tn})}else super.attributeChangedCallback(en,tn,nn)}blur(){this.inner.blur()}get[Hr](){return Object.assign(super[Hr],{innerAttributes:{}})}get[zr](){return Zo[this.extends]?0:-1}get extends(){return this.constructor[Xo]}get inner(){const en=this[Ao]&&this[Ao].inner;return en||console.warn("Attempted to get an inner standard element before it was instantiated."),en}static get observedAttributes(){return[...super.observedAttributes,...ri]}[yo](en){super[yo](en);const tn=this.inner;if(this[Wr]){(Jo[this.extends]||[]).forEach((en=>{tn.addEventListener(en,(()=>{const tn=new Event(en,{bubbles:ti[en]||!1});this.dispatchEvent(tn)}))})),"disabled"in tn&&ei.forEach((en=>{this.addEventListener(en,(en=>{tn.disabled&&en.stopImmediatePropagation()}))}))}if(en.tabIndex&&(tn.tabIndex=this[jo].tabIndex),en.innerAttributes){const{innerAttributes:en}=this[jo];for(const nn in en)applyAttribute(tn,nn,en[nn])}this.constructor[Yo].forEach((nn=>{if(en[nn]){const en=this[jo][nn];("selectionEnd"===nn||"selectionStart"===nn)&&null===en||(tn[nn]=en)}}))}[wo](en){if(super[wo](en),en.disabled){const{disabled:en}=this[jo];void 0!==en&&setInternalState(this,"disabled",en)}}get[Vo](){const en=ni.includes(this.extends)?"block":"inline-block",tn=this.extends;return En.html(Wo||(Wo=_taggedTemplateLiteral(["\n \n <',' id="inner" part="inner ','">\n \n \n "])),en,tn,tn,tn)}static wrap(en){class Wrapped extends WrappedStandardElement{}Wrapped[Xo]=en;const tn=document.createElement(en);return function defineDelegates(en,tn){const nn=Object.getOwnPropertyNames(tn);en[Yo]=[],nn.forEach((nn=>{const rn=Object.getOwnPropertyDescriptor(tn,nn);if(!rn)return;const an=function createDelegate(en,tn){if("function"==typeof tn.value){if("constructor"!==en)return function createMethodDelegate(en,tn){const value=function(){this.inner[en](...arguments)};return{configurable:tn.configurable,enumerable:tn.enumerable,value:value,writable:tn.writable}}(en,tn)}else if("function"==typeof tn.get||"function"==typeof tn.set)return function createPropertyDelegate(en,tn){const nn={configurable:tn.configurable,enumerable:tn.enumerable};tn.get&&(nn.get=function(){return function getInnerProperty(en,tn){return en[jo][tn]||en[So]&&en.inner[tn]}(this,en)});tn.set&&(nn.set=function(tn){!function setInnerProperty(en,tn,nn){en[jo][tn]!==nn&&en[Co]({[tn]:nn})}(this,en,tn)});tn.writable&&(nn.writable=tn.writable);return nn}(en,tn);return null}(nn,rn);an&&(Object.defineProperty(en.prototype,nn,an),an.set&&en[Yo].push(nn))}))}(Wrapped,Object.getPrototypeOf(tn)),Wrapped}}function applyAttribute(en,tn,nn){Wn[tn]?"string"==typeof nn?en.setAttribute(tn,""):null===nn&&en.removeAttribute(tn):null!=nn?en.setAttribute(tn,nn.toString()):en.removeAttribute(tn)}var ii;const ai=DelegateInputLabelMixin(FocusVisibleMixin(FormElementMixin(function TrackTextSelectionMixin(en){return class TrackTextSelection extends en{get[Hr](){return Object.assign(super[Hr]||{},{selectionEnd:0,selectionStart:0})}[yo](en){if(super[yo]&&super[yo](en),this[Wr]){const en=(()=>{setTimeout((()=>{this[fo]=!0,refreshSelectionState(this),this[fo]=!1}),10)}).bind(this);this.addEventListener("keydown",en),this.addEventListener("mousedown",en),this.addEventListener("touchend",en)}}[wo](en){super[wo](en),en.value&&refreshSelectionState(this)}}}(WrappedStandardElement.wrap("input")))));class Input extends ai{get[Hr](){return Object.assign(super[Hr],{value:""})}get[uo](){return this.inner}[yo](en){super[yo](en),this[Wr]&&this[Ao].inner.addEventListener("input",(()=>{this[fo]=!0;const en=this[Ao].inner;this[Co]({value:en.value}),this[fo]=!1}))}get[Vo](){const en=super[Vo];return en.content.append(Bn.html(ii||(ii=_taggedTemplateLiteral(['\n \n '])))),en}get value(){return this[jo].value}set value(en){this[Co]({value:String(en)})}}var si;class PlainInput extends(function PlainInputMixin(en){return class PlainInput extends en{get[Vo](){const en=super[Vo];return en.content.append(Bn.html(si||(si=_taggedTemplateLiteral(['\n \n '])))),en}}}(Input)){}customElements.define("elix-input",class ElixInput extends PlainInput{});const li=document.createElement("template");li.innerHTML='\n \n
\n icon\n label\n \n
\n';class SEInput extends HTMLElement{constructor(){super(),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(li.content.cloneNode(!0)),this.$div=this._shadowRoot.querySelector("div"),this.$img=this._shadowRoot.querySelector("img"),this.$label=this.shadowRoot.getElementById("label"),this.$event=new CustomEvent("change"),this.$input=this._shadowRoot.querySelector("elix-input")}static get observedAttributes(){return["value","label","src","size","title"]}attributeChangedCallback(en,tn,nn){if(tn!==nn)switch(en){case"title":this.$div.setAttribute("title","".concat(t$1(nn)));break;case"src":this.$img.setAttribute("src",nn),this.$label.remove();break;case"size":this.$input.setAttribute("size",nn);break;case"label":this.$label.textContent=t$1(nn),this.$img.remove();break;case"value":this.$input.value=nn;break;default:console.error("unknown attribute: ".concat(en))}}get title(){return this.getAttribute("title")}set title(en){this.setAttribute("title",en)}get label(){return this.getAttribute("label")}set label(en){this.setAttribute("label",en)}get value(){return this.$input.value}set value(en){this.$input.value=en}get src(){return this.getAttribute("src")}set src(en){this.setAttribute("src",en)}get size(){return this.getAttribute("size")}set size(en){this.setAttribute("size",en)}connectedCallback(){this.$input.addEventListener("change",(en=>{en.preventDefault(),this.value=en.target.value,this.dispatchEvent(this.$event)})),this.$input.addEventListener("keyup",(en=>{en.preventDefault(),this.value=en.target.value,this.dispatchEvent(this.$event)}))}}customElements.define("se-input",SEInput);const ci=document.createElement("div");ci.attachShadow({mode:"open",delegatesFocus:!0});const Ai=ci.shadowRoot.delegatesFocus;var di;const ui=function ComposedFocusMixin(en){return class ComposedFocus extends en{get[Hr](){return Object.assign(super[Hr]||{},{composeFocus:!Ai})}[yo](en){super[yo]&&super[yo](en),this[Wr]&&this.addEventListener("mousedown",(en=>{if(this[jo].composeFocus&&0===en.button&&en.target instanceof Element){const tn=closestFocusableNode(en.target);tn&&(tn.focus(),en.preventDefault())}}))}}}(DelegateInputLabelMixin(FocusVisibleMixin(WrappedStandardElement.wrap("button"))));class Button extends ui{get[Hr](){return Object.assign(super[Hr],{role:"button"})}get[uo](){return this[Ao].inner}[qo](){const en=new MouseEvent("click",{bubbles:!0,cancelable:!0});this.dispatchEvent(en)}get[Vo](){const en=super[Vo];return en.content.append(Bn.html(di||(di=_taggedTemplateLiteral(['\n \n '])))),en}}class SyntheticMouseEvent extends MouseEvent{}function clearRepeat(en){en[jo].repeatTimeout&&clearTimeout(en[jo].repeatTimeout),en[jo].repeatInterval&&clearInterval(en[jo].repeatInterval)}function repeatStart(en){const{repeatIntervalDuration:tn,repeatDelayDuration:nn}=en[jo],rn=setTimeout((()=>{const nn=setInterval((()=>{!function raiseMousedown(en){const tn=new SyntheticMouseEvent("mousedown",{bubbles:!0,button:0,cancelable:!0,clientX:0,clientY:0});en.dispatchEvent(tn)}(en)}),tn);en[Co]({repeatInterval:nn})}),nn-tn);en[Co]({repeatTimeout:rn})}function repeatStop(en){clearRepeat(en),en[Co]({repeatTimeout:null,repeatInterval:null})}class RepeatButton extends(function RepeatMousedownMixin(en){return class RepeatMousedown extends en{get[Hr](){return Object.assign(super[Hr]||{},{repeatDelayDuration:500,repeatInterval:null,repeatIntervalDuration:50,repeatTimeout:null})}[yo](en){super[yo]&&super[yo](en),this[Wr]&&(this.addEventListener("mousedown",(en=>{en instanceof SyntheticMouseEvent||0!==en.button||(this[fo]=!0,repeatStart(this),this[fo]=!1)})),this.addEventListener("mouseup",(en=>{0===en.button&&(this[fo]=!0,repeatStop(this),this[fo]=!1)})),this.addEventListener("mouseleave",(en=>{0===en.button&&(this[fo]=!0,repeatStop(this),this[fo]=!1)})),this.addEventListener("touchstart",(()=>{this[fo]=!0,repeatStart(this),this[fo]=!1})),this.addEventListener("touchend",(()=>{this[fo]=!0,repeatStop(this),this[fo]=!1})))}[Lo](en,tn){const nn=super[Lo]?super[Lo](en,tn):{};return tn.disabled&&en.disabled&&(clearRepeat(this),Object.assign(nn,{repeatInterval:null,repeatTimeout:null})),nn}}}(Button)){}var pi,hi;function PlainButtonMixin(en){return class PlainButton extends en{get[Vo](){const en=super[Vo];return en.content.append(Bn.html(pi||(pi=_taggedTemplateLiteral(['\n \n '])))),en}}}class PlainRepeatButton extends(PlainButtonMixin(RepeatButton)){}const gi=new Map;function createElement(en){if("function"==typeof en){let tn;try{tn=new en}catch(nn){if("TypeError"!==nn.name)throw nn;!function registerCustomElement(en){let tn;const nn=/^[A-Za-z][A-Za-z0-9_$]*$/,rn=en.name&&en.name.match(nn);if(rn){const en=/([A-Z])/g;tn=rn[0].replace(en,((en,tn,nn)=>nn>0?"-".concat(tn):tn)).toLowerCase()}else tn="custom-element";let an,sn=gi.get(tn)||0;for(;an="".concat(tn,"-").concat(sn),customElements.get(an);sn++);customElements.define(an,en),gi.set(tn,sn+1)}(en),tn=new en}return tn}return document.createElement(en)}function replace(en,tn){const nn=en.parentNode;if(!nn)throw"An element must have a parent before it can be substituted.";return(en instanceof HTMLElement||en instanceof SVGElement)&&(tn instanceof HTMLElement||tn instanceof SVGElement)&&(Array.prototype.forEach.call(en.attributes,(en=>{tn.getAttribute(en.name)||"class"===en.name||"style"===en.name||tn.setAttribute(en.name,en.value)})),Array.prototype.forEach.call(en.classList,(en=>{tn.classList.add(en)})),Array.prototype.forEach.call(en.style,(nn=>{tn.style[nn]||(tn.style[nn]=en.style[nn])}))),tn.append(...en.childNodes),nn.replaceChild(tn,en),tn}function transmute(en,tn){if("function"==typeof tn&&en.constructor===tn||"string"==typeof tn&&en instanceof Element&&en.localName===tn)return en;{const nn=createElement(tn);return replace(en,nn),nn}}function DisabledMixin(en){return class Disabled extends en{get[Hr](){return Object.assign(super[Hr]||{},{disabled:!1})}get disabled(){return this[jo].disabled}set disabled(en){this[Co]({disabled:en})}[wo](en){if(super[wo]&&super[wo](en),en.disabled&&(this.toggleAttribute("disabled",this.disabled),this[fo])){const en=new CustomEvent("disabledchange",{bubbles:!0});this.dispatchEvent(en)}}}}function KeyboardDirectionMixin(en){return class KeyboardDirection extends en{get[Hr](){return Object.assign(super[Hr],{handleBubblingDirectionKeys:!1})}[Zr](){if(super[Zr])return super[Zr]()}[Jr](){if(super[Jr])return super[Jr]()}[no](){if(super[no])return super[no]()}[io](){if(super[io])return super[io]()}[ao](){if(super[ao])return super[ao]()}[lo](){if(super[lo])return super[lo]()}[ho](en){let tn=!1;if(this[jo].handleBubblingDirectionKeys||en.target===this){const nn=this[jo].orientation||"both",rn="horizontal"===nn||"both"===nn,an="vertical"===nn||"both"===nn;switch(en.key){case"ArrowDown":an&&(tn=en.altKey?this[Jr]():this[Zr]());break;case"ArrowLeft":!rn||en.metaKey||en.altKey||(tn=this[no]());break;case"ArrowRight":!rn||en.metaKey||en.altKey||(tn=this[io]());break;case"ArrowUp":an&&(tn=en.altKey?this[ao]():this[lo]());break;case"End":tn=this[Jr]();break;case"Home":tn=this[ao]()}}return tn||super[ho]&&super[ho](en)||!1}}}function KeyboardMixin(en){return class Keyboard extends en{constructor(){super(),this.addEventListener("keydown",(async en=>{this[fo]=!0,this[jo].focusVisible||this[Co]({focusVisible:!0});this[ho](en)&&(en.preventDefault(),en.stopImmediatePropagation()),await Promise.resolve(),this[fo]=!1}))}attributeChangedCallback(en,tn,nn){if("tabindex"===en){let en;null===nn?en=-1:(en=Number(nn),isNaN(en)&&(en=this[zr]?this[zr]:0)),this.tabIndex=en}else super.attributeChangedCallback(en,tn,nn)}get[Hr](){const en=this[Kr]?-1:0;return Object.assign(super[Hr]||{},{tabIndex:en})}[ho](en){return!!super[ho]&&super[ho](en)}[yo](en){super[yo]&&super[yo](en),en.tabIndex&&(this.tabIndex=this[jo].tabIndex)}get tabIndex(){return super.tabIndex}set tabIndex(en){super.tabIndex!==en&&(super.tabIndex=en),this[xo]||this[Co]({tabIndex:en})}}}var _i;const mi=DelegateFocusMixin(DelegateInputLabelMixin(function DelegateInputSelectionMixin(en){return class DelegateInputSelection extends en{select(){this[uo].select()}get selectionEnd(){return this[uo].selectionEnd}set selectionEnd(en){this[uo].selectionEnd=en}get selectionStart(){return this[uo].selectionStart}set selectionStart(en){this[uo].selectionStart=en}setRangeText(){this[uo].setRangeText(...arguments)}setSelectionRange(){this[uo].setSelectionRange(...arguments);document.createElement("input").select}}}(DisabledMixin(FocusVisibleMixin(FormElementMixin(KeyboardDirectionMixin(KeyboardMixin(Qr))))))));class SpinBox extends mi{get[Hr](){return Object.assign(super[Hr],{buttonPartType:"button",canGoDown:!0,canGoUp:!0,inputPartType:"input",orientation:"vertical",step:1,stepSelect:!1,value:""})}[Zr](){return super[Zr]&&super[Zr](),this.stepDown(),!0}[lo](){return super[lo]&&super[lo](),this.stepUp(),!0}get[uo](){return this[Ao].input}[yo](en){if(super[yo](en),function renderParts$4(en,tn,nn){if(!nn||nn.inputPartType){const{buttonPartType:nn}=tn;en.querySelectorAll('[part~="spin-button"]').forEach((en=>{transmute(en,nn)}))}if(!nn||nn.inputPartType){const{inputPartType:nn}=tn,rn=en.getElementById("input");rn&&transmute(rn,nn)}}(this[So],this[jo],en),en.buttonPartType&&(this[Ao].downButton.addEventListener("mousedown",(()=>{this[fo]=!0,this.stepDown(),this[fo]=!1})),this[Ao].upButton.addEventListener("mousedown",(()=>{this[fo]=!0,this.stepUp(),this[fo]=!1}))),en.inputPartType&&this[Ao].input.addEventListener("input",(()=>{this[fo]=!0,this.value=this[Ao].input.value,this[fo]=!1})),en.buttonPartType||en.inputPartType){const en=this[Ao].input,tn=this[Ao].downButton;tn instanceof HTMLElement&&en instanceof HTMLElement&&forwardFocus(tn,en);const nn=this[Ao].upButton;nn instanceof HTMLElement&&en instanceof HTMLElement&&forwardFocus(nn,en)}const{disabled:tn,value:nn}=this[jo];if(en.canGoUp||en.canGoDown||en.disabled){const{canGoUp:en,canGoDown:nn}=this[jo];if("disabled"in this[Ao].input&&(this[Ao].input.disabled=tn),"disabled"in this[Ao].downButton){const nn=tn||!en;this[Ao].upButton.disabled=nn}if("disabled"in this[Ao].upButton){const en=tn||!nn;this[Ao].downButton.disabled=en}}en.value&&(this[Ao].input.value=nn)}[wo](en){super[wo](en);const{stepSelect:tn,value:nn}=this[jo];if(en.value&&tn){const en=this[Ao].input,tn=nn.length;en.selectionStart=tn,en.selectionEnd=tn,this[Co]({stepSelect:!1})}if(en.value&&this[fo]){const en=new CustomEvent("change",{bubbles:!0,detail:{value:nn}});this.dispatchEvent(en)}}stepDown(){this[Co]({stepSelect:!0})}stepUp(){this[Co]({stepSelect:!0})}get[Vo](){const en=super[Vo];return en.content.append(Bn.html(_i||(_i=_taggedTemplateLiteral(['\n \n
\n
\n
\n '])))),en}get value(){return this[jo].value}set value(en){this[Co]({value:String(en)})}}class NumberSpinBox extends SpinBox{attributeChangedCallback(en,tn,nn){"max"===en?this.max=parseFloat(nn):"min"===en?this.min=parseFloat(nn):"step"===en?this.step=parseFloat(nn):super.attributeChangedCallback(en,tn,nn)}get[Hr](){return Object.assign(super[Hr],{max:null,min:null,step:1})}formatValue(en,tn){return Number(en).toFixed(tn)}get max(){return this[jo].max}set max(en){this[Co]({max:en})}get min(){return this[jo].min}set min(en){this[Co]({min:en})}parseValue(en,tn){const nn=0===tn?parseInt(en):parseFloat(en);return isNaN(nn)?0:nn}[Lo](en,tn){const nn=super[Lo];if(tn.step){const{step:tn}=en,rn=/\.(\d)+$/.exec(String(tn)),an=rn&&rn[1]?rn[1].length:0;Object.assign(nn,{precision:an})}if(tn.max||tn.min||tn.value){const{max:tn,min:rn,precision:an,value:sn}=en,cn=parseInt(sn,an);""!==sn&&isNaN(cn)?Object.assign(nn,{valid:!1,validationMessage:"Value must be a number"}):null===tn||cn<=tn?null===rn||cn>=rn?Object.assign(nn,{valid:!0,validationMessage:""}):Object.assign(nn,{valid:!1,validationMessage:"Value must be greater than or equal to ".concat(rn,".")}):Object.assign(nn,{valid:!1,validationMessage:"Value must be less than or equal to ".concat(tn,".")}),Object.assign(nn,{canGoUp:isNaN(cn)||null===en.max||cn<=en.max}),Object.assign(nn,{canGoDown:isNaN(cn)||null===en.min||cn>=en.min})}return nn}get step(){return this[jo].step}set step(en){isNaN(en)||this[Co]({step:en})}stepDown(){super.stepDown();const{max:en,precision:tn,value:nn}=this[jo];let rn=this.parseValue(nn,tn)-this.step;null!==en&&(rn=Math.min(rn,en));const{min:an}=this[jo];(null===an||rn>=an)&&(this.value=this.formatValue(rn,tn))}stepUp(){super.stepUp();const{min:en,precision:tn,value:nn}=this[jo];let rn=this.parseValue(nn,tn)+this.step;null!==en&&(rn=Math.max(rn,en));const{max:an}=this[jo];(null===an||rn<=an)&&(this.value=this.formatValue(rn,tn))}}class PlainNumberSpinBox extends(function PlainSpinBoxMixin(en){return class PlainSpinBox extends en{get[Hr](){return Object.assign(super[Hr]||{},{buttonPartType:PlainRepeatButton,inputPartType:PlainInput})}get[Vo](){const en=super[Vo];en.content.getElementById("upButton").textContent="▲";return en.content.getElementById("downButton").textContent="▼",en.content.append(Bn.html(hi||(hi=_taggedTemplateLiteral(['\n \n '])))),en}}}(NumberSpinBox)){}customElements.define("elix-number-spin-box",class ElixNumberSpinBox extends PlainNumberSpinBox{});const fi=document.createElement("template");fi.innerHTML='\n \n
\n icon\n label\n \n
\n';class SESpinInput extends HTMLElement{constructor(){super(),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(fi.content.cloneNode(!0)),this.$div=this._shadowRoot.querySelector("div"),this.$img=this._shadowRoot.querySelector("img"),this.$label=this.shadowRoot.getElementById("label"),this.$event=new CustomEvent("change"),this.$input=this._shadowRoot.querySelector("elix-number-spin-box"),this.imgPath=svgEditor.configObj.curConfig.imgPath}static get observedAttributes(){return["value","label","src","size","min","max","step","title"]}attributeChangedCallback(en,tn,nn){if(tn!==nn)switch(en){case"title":{const en=this.getAttribute("shortcut");this.$div.setAttribute("title","".concat(t$1(nn)," ").concat(en?"[".concat(t$1(en),"]"):""))}break;case"src":this.$img.setAttribute("src",this.imgPath+"/"+nn),this.$label.remove(),this.$div.classList.add("imginside");break;case"size":this.$input.shadowRoot.getElementById("input").size=nn,this.$input.shadowRoot.getElementById("input").style.width="unset";break;case"step":this.$input.setAttribute("step",nn);break;case"min":this.$input.setAttribute("min",nn);break;case"max":this.$input.setAttribute("max",nn);break;case"label":this.$label.textContent=t$1(nn),this.$img.remove();break;case"value":this.$input.value=nn;break;default:console.error("unknown attribute: ".concat(en))}}get title(){return this.getAttribute("title")}set title(en){this.setAttribute("title",en)}get label(){return this.getAttribute("label")}set label(en){this.setAttribute("label",en)}get value(){return this.$input.value}set value(en){this.$input.value=en}get src(){return this.getAttribute("src")}set src(en){this.setAttribute("src",en)}get size(){return this.getAttribute("size")}set size(en){this.setAttribute("size",en)}connectedCallback(){const en=this.$input.shadowRoot;Array.from(en.childNodes).forEach((en=>{"input"===(null==en?void 0:en.id)&&en.addEventListener("keyup",(en=>{en.preventDefault(),isNaN(en.target.value)||(this.value=en.target.value,this.dispatchEvent(this.$event))}))})),this.$input.addEventListener("change",(en=>{en.preventDefault(),this.value=en.target.value,this.dispatchEvent(this.$event)})),svgEditor.$click(this.$input,(en=>{en.preventDefault(),this.value=en.target.value,this.dispatchEvent(this.$event)}))}}customElements.define("se-spin-input",SESpinInput);const yi=["none","#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00","#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff","#aaaaff","#d4aaff","#ffaaff","#ffaad4"],bi=document.createElement("template");bi.innerHTML='\n \n
\n
\n
\n
\n';class SEPalette extends HTMLElement{constructor(){super(),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(bi.content.cloneNode(!0)),this.$strip=this._shadowRoot.querySelector("#js-se-palette"),yi.forEach((en=>{const tn=document.createElement("div");if(tn.classList.add("square"),"none"===en){const en=document.createElement("img");en.src="data:image/svg+xml;charset=utf-8;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQgMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgY2xhc3M9InN2Z19pY29uIj48c3ZnIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgICA8bGluZSBmaWxsPSJub25lIiBzdHJva2U9IiNkNDAwMDAiIGlkPSJzdmdfOTAiIHkyPSIyNCIgeDI9IjI0IiB5MT0iMCIgeDE9IjAiLz4KICAgIDxsaW5lIGlkPSJzdmdfOTIiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2Q0MDAwMCIgeTI9IjI0IiB4Mj0iMCIgeTE9IjAiIHgxPSIyNCIvPgogIDwvc3ZnPjwvc3ZnPg==",en.style.width="15px",en.style.height="15px",tn.append(en)}else tn.style.backgroundColor=en;tn.dataset.rgb=en,svgEditor.$click(tn,(en=>{en.preventDefault();const nn=en.shiftKey||2===en.button?"stroke":"fill";let rn=tn.dataset.rgb;"none"!==rn&&"transparent"!==rn&&"initial"!==rn||(rn="none");const an=new CustomEvent("change",{detail:{picker:nn,color:rn},bubbles:!1});this.dispatchEvent(an)})),this.$strip.append(tn)}))}init(en){this.setAttribute("ui-palette_info",en.t("ui.palette_info"))}static get observedAttributes(){return["ui-palette_info"]}attributeChangedCallback(en,tn,nn){let rn;"ui-palette_info"===en&&(rn=this._shadowRoot.querySelector("#palette_holder"),rn.setAttribute("title",nn))}connectedCallback(){}}customElements.define("se-palette",SEPalette);class MenuItem extends(function CurrentMixin(en){return class Current extends en{constructor(){super();const en=this;!this[mo]&&en.attachInternals&&(this[mo]=en.attachInternals())}attributeChangedCallback(en,tn,nn){if("current"===en){const tn=booleanAttributeValue(en,nn);this.current!==tn&&(this.current=tn)}else super.attributeChangedCallback(en,tn,nn)}get[Hr](){return Object.assign(super[Hr]||{},{current:!1})}[yo](en){if(super[yo](en),en.current){const{current:en}=this[jo];setInternalState(this,"current",en)}}[wo](en){if(super[wo]&&super[wo](en),en.current){const{current:en}=this[jo],tn=new CustomEvent("currentchange",{bubbles:!0,detail:{current:en}});this.dispatchEvent(tn)}}get current(){return this[jo].current}set current(en){this[Co]({current:en})}}}(DisabledMixin(function SelectableMixin(en){return class Selectable extends en{constructor(){super();const en=this;!this[mo]&&en.attachInternals&&(this[mo]=en.attachInternals())}get[Hr](){return Object.assign(super[Hr]||{},{selected:!1})}[yo](en){if(super[yo](en),en.selected){const{selected:en}=this[jo];setInternalState(this,"selected",en)}}[wo](en){if(super[wo]&&super[wo](en),en.selected){const{selected:en}=this[jo],tn=new CustomEvent("selectedchange",{bubbles:!0,detail:{selected:en}});this.dispatchEvent(tn)}}get selected(){return this[jo].selected}set selected(en){this[Co]({selected:en})}}}(Qr)))){}var vi;class PlainMenuItem extends MenuItem{get[Vo](){return En.html(vi||(vi=_taggedTemplateLiteral(['\n \n \n \n \n \n \n '])))}}customElements.define("elix-menu-item",class ElixMenuItem extends PlainMenuItem{});const wi={a:"link",article:"region",button:"button",h1:"sectionhead",h2:"sectionhead",h3:"sectionhead",h4:"sectionhead",h5:"sectionhead",h6:"sectionhead",hr:"sectionhead",iframe:"region",link:"link",menu:"menu",ol:"list",option:"option",output:"liveregion",progress:"progressbar",select:"select",table:"table",td:"td",textarea:"textbox",th:"th",ul:"list"};function defaultScrollTarget(en){const tn=en[So],nn=tn&&tn.querySelector("slot:not([name])");return nn&&nn.parentNode instanceof Element&&function getScrollableElement(en){for(const tn of selfAndComposedAncestors(en))if(tn instanceof HTMLElement&&isElementScrollable(tn))return tn;return null}(nn.parentNode)||en}function isElementScrollable(en){const tn=getComputedStyle(en),nn=tn.overflowX,rn=tn.overflowY;return"scroll"===nn||"auto"===nn||"scroll"===rn||"auto"===rn}function moveToIndex(en,tn,nn){const rn=en[Gr](en[jo],{direction:nn,index:tn});if(rn<0)return!1;const an=en[jo].currentIndex!==rn;return an&&en[Co]({currentIndex:rn}),an}const xi=["applet","basefont","embed","font","frame","frameset","isindex","keygen","link","multicol","nextid","noscript","object","param","script","style","template","noembed"];function getIndexOfItemAtY(en,tn,nn){const rn=en[jo].items,an=nn?0:rn.length-1,sn=nn?rn.length:0,cn=nn?1:-1;let An,dn,un=null;const{availableItemFlags:pn}=en[jo];for(An=an;An!==sn;An+=cn){if((!pn||pn[An])&&(dn=rn[An].getBoundingClientRect(),dn.top<=tn&&tn<=dn.bottom)){un=rn[An];break}}if(!un||!dn)return null;const hn=getComputedStyle(un),gn=hn.paddingTop?parseFloat(hn.paddingTop):0,_n=hn.paddingBottom?parseFloat(hn.paddingBottom):0,mn=dn.top+gn,fn=mn+un.clientHeight-gn-_n;return nn&&mn<=tn||!nn&&fn>=tn?An:An-cn}function scrollOnePage(en,tn){const nn=en[jo].items,rn=en[jo].currentIndex,an=en[ko].getBoundingClientRect(),sn=getIndexOfItemAtY(en,tn?an.bottom:an.top,tn);let cn;if(sn&&rn===sn){const an=nn[rn].getBoundingClientRect(),sn=en[ko].clientHeight;cn=getIndexOfItemAtY(en,tn?an.bottom+sn:an.top-sn,tn)}else cn=sn;if(!cn){const rn=tn?nn.length-1:0;cn=en[Gr]?en[Gr](en[jo],{direction:tn?-1:1,index:rn}):rn}const An=cn!==rn;if(An){const tn=en[fo];en[fo]=!0,en[Co]({currentIndex:cn}),en[fo]=tn}return An}const ki=Symbol("typedPrefix"),Ci=Symbol("prefixTimeout");function resetPrefixTimeout(en){const tn=en;tn[Ci]&&(clearTimeout(tn[Ci]),tn[Ci]=!1)}function resetTypedPrefix(en){en[ki]="",resetPrefixTimeout(en)}function setPrefixTimeout(en){resetPrefixTimeout(en),en[Ci]=setTimeout((()=>{resetTypedPrefix(en)}),1e3)}function LanguageDirectionMixin(en){return class LanguageDirection extends en{connectedCallback(){const en="rtl"===getComputedStyle(this).direction;this[Co]({rightToLeft:en}),super.connectedCallback()}}}function ContentItemsMixin(en){return class ContentItems extends en{get[Hr](){return Object.assign(super[Hr]||{},{items:null})}[Lo](en,tn){const nn=super[Lo]?super[Lo](en,tn):{};if(tn.content){const tn=en.content,rn=tn?Array.prototype.filter.call(tn,(en=>function isSubstantiveElement(en){return en instanceof Element&&(!en.localName||xi.indexOf(en.localName)<0)}(en))):null;rn&&Object.freeze(rn),Object.assign(nn,{items:rn})}return nn}}}function SlotContentMixin(en){return class SlotContent extends en{get[Dr](){const en=this[So]&&this[So].querySelector("slot:not([name])");return this[So]&&en||console.warn("SlotContentMixin expects ".concat(this.constructor.name," to define a shadow tree that includes a default (unnamed) slot.\nSee https://elix.org/documentation/SlotContentMixin.")),en}get[Hr](){return Object.assign(super[Hr]||{},{content:null})}[wo](en){if(super[wo]&&super[wo](en),this[Wr]){const en=this[Dr];en&&en.addEventListener("slotchange",(async()=>{this[fo]=!0;const tn=en.assignedNodes({flatten:!0});Object.freeze(tn),this[Co]({content:tn}),await Promise.resolve(),this[fo]=!1}))}}}}var Si;const Bi=function AriaMenuMixin(en){return class AriaMenu extends en{get[Hr](){const en=super[Hr];return Object.assign(en,{itemRole:en.itemRole||"menuitem",role:en.role||"menu"})}get itemRole(){return this[jo].itemRole}set itemRole(en){this[Co]({itemRole:en})}[yo](en){super[yo]&&super[yo](en);const tn=this[jo].items;if((en.items||en.itemRole)&&tn){const{itemRole:en}=this[jo];tn.forEach((tn=>{en===wi[tn.localName]?tn.removeAttribute("role"):tn.setAttribute("role",en)}))}if(en.role){const{role:en}=this[jo];this.setAttribute("role",en)}}get role(){return super.role}set role(en){super.role=en,this[xo]||this[Co]({role:en})}}}(function CursorAPIMixin(en){return class CursorAPI extends en{attributeChangedCallback(en,tn,nn){if("current-index"===en)this.currentIndex=Number(nn);else if("current-item-required"===en){const tn=booleanAttributeValue(en,nn);this.currentItemRequired!==tn&&(this.currentItemRequired=tn)}else if("cursor-operations-wrap"===en){const tn=booleanAttributeValue(en,nn);this.cursorOperationsWrap!==tn&&(this.cursorOperationsWrap=tn)}else super.attributeChangedCallback(en,tn,nn)}get currentIndex(){const{items:en,currentIndex:tn}=this[jo];return en&&en.length>0?tn:-1}set currentIndex(en){isNaN(en)||this[Co]({currentIndex:en})}get currentItem(){const{items:en,currentIndex:tn}=this[jo];return en&&en[tn]}set currentItem(en){const{items:tn}=this[jo];if(!tn)return;const nn=tn.indexOf(en);this[Co]({currentIndex:nn})}get currentItemRequired(){return this[jo].currentItemRequired}set currentItemRequired(en){this[Co]({currentItemRequired:en})}get cursorOperationsWrap(){return this[jo].cursorOperationsWrap}set cursorOperationsWrap(en){this[Co]({cursorOperationsWrap:en})}goFirst(){return super.goFirst&&super.goFirst(),this[eo]()}goLast(){return super.goLast&&super.goLast(),this[to]()}goNext(){return super.goNext&&super.goNext(),this[ro]()}goPrevious(){return super.goPrevious&&super.goPrevious(),this[oo]()}[wo](en){if(super[wo]&&super[wo](en),en.currentIndex&&this[fo]){const{currentIndex:en}=this[jo],tn=new CustomEvent("currentindexchange",{bubbles:!0,detail:{currentIndex:en}});this.dispatchEvent(tn)}}}}(function CursorInViewMixin(en){return class CursorInView extends en{[wo](en){super[wo]&&super[wo](en),en.currentItem&&this.scrollCurrentItemIntoView()}scrollCurrentItemIntoView(){super.scrollCurrentItemIntoView&&super.scrollCurrentItemIntoView();const{currentItem:en,items:tn}=this[jo];if(!en||!tn)return;const nn=this[ko].getBoundingClientRect(),rn=en.getBoundingClientRect(),an=rn.bottom-nn.bottom,sn=rn.left-nn.left,cn=rn.right-nn.right,An=rn.top-nn.top,dn=this[jo].orientation||"both";"horizontal"!==dn&&"both"!==dn||(cn>0?this[ko].scrollLeft+=cn:sn<0&&(this[ko].scrollLeft+=Math.ceil(sn))),"vertical"!==dn&&"both"!==dn||(an>0?this[ko].scrollTop+=an:An<0&&(this[ko].scrollTop+=Math.ceil(An)))}get[ko](){return super[ko]||defaultScrollTarget(this)}}}(DelegateFocusMixin(function DirectionCursorMixin(en){return class DirectionCursor extends en{get[Hr](){return Object.assign(super[Hr]||{},{canGoDown:null,canGoLeft:null,canGoRight:null,canGoUp:null})}[Zr](){return super[Zr]&&super[Zr](),this[ro]()}[Jr](){return super[Jr]&&super[Jr](),this[to]()}[no](){return super[no]&&super[no](),this[jo]&&this[jo].rightToLeft?this[ro]():this[oo]()}[io](){return super[io]&&super[io](),this[jo]&&this[jo].rightToLeft?this[oo]():this[ro]()}[ao](){return super[ao]&&super[ao](),this[eo]()}[lo](){return super[lo]&&super[lo](),this[oo]()}[Lo](en,tn){const nn=super[Lo]?super[Lo](en,tn):{};if(tn.canGoNext||tn.canGoPrevious||tn.languageDirection||tn.orientation||tn.rightToLeft){const{canGoNext:tn,canGoPrevious:rn,orientation:an,rightToLeft:sn}=en,cn="horizontal"===an||"both"===an,An="vertical"===an||"both"===an,dn=An&&tn,un=!!cn&&(sn?tn:rn),pn=!!cn&&(sn?rn:tn),hn=An&&rn;Object.assign(nn,{canGoDown:dn,canGoLeft:un,canGoRight:pn,canGoUp:hn})}return nn}}}(function ItemsAPIMixin(en){return class ItemsAPI extends en{get items(){return this[jo]?this[jo].items:null}[wo](en){if(super[wo]&&super[wo](en),!this[Wr]&&en.items&&this[fo]){const en=new CustomEvent("itemschange",{bubbles:!0});this.dispatchEvent(en)}}}}(function ItemsCursorMixin(en){return class ItemsCursor extends en{[Gr](en){let tn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const nn=void 0!==tn.direction?tn.direction:1,rn=void 0!==tn.index?tn.index:en.currentIndex,an=void 0!==tn.wrap?tn.wrap:en.cursorOperationsWrap,{items:sn}=en,cn=sn?sn.length:0;if(0===cn)return-1;if(an){let tn=(rn%cn+cn)%cn;const an=((tn-nn)%cn+cn)%cn;for(;tn!==an;){if(!en.availableItemFlags||en.availableItemFlags[tn])return tn;tn=((tn+nn)%cn+cn)%cn}}else for(let tn=rn;tn>=0&&tn0&&An[rn]!==sn){const en=An.indexOf(sn);en>=0&&(pn=en)}else tn.currentIndex&&(rn<0&&null!==sn||rn>=0&&(0===dn||An[rn]!==sn)||null===an)&&(pn=rn);cn&&pn<0&&(pn=0),pn<0?(pn=-1,un=-1):0===dn?un=-1:(un=Math.max(Math.min(dn-1,pn),0),un=this[Gr](en,{direction:1,index:un,wrap:!1}),un<0&&(un=this[Gr](en,{direction:-1,index:un-1,wrap:!1})));const hn=An&&An[un]||null;Object.assign(nn,{currentIndex:un,desiredCurrentIndex:pn,currentItem:hn})}return nn}}}(function ItemsTextMixin(en){return class ItemsText extends en{get[Hr](){return Object.assign(super[Hr]||{},{texts:null})}[Yr](en){return super[Yr]?super[Yr](en):function getDefaultText(en){return en.getAttribute("aria-label")||en.getAttribute("alt")||en.innerText||en.textContent||""}(en)}[Lo](en,tn){const nn=super[Lo]?super[Lo](en,tn):{};if(tn.items){const{items:tn}=en,rn=function getTextsFromItems(en,tn){return en?Array.from(en,(en=>tn(en))):null}(tn,this[Yr]);rn&&(Object.freeze(rn),Object.assign(nn,{texts:rn}))}return nn}}}(KeyboardDirectionMixin(KeyboardMixin(function KeyboardPagedCursorMixin(en){return class KeyboardPagedCursor extends en{[ho](en){let tn=!1;if("horizontal"!==this.orientation)switch(en.key){case"PageDown":tn=this.pageDown();break;case"PageUp":tn=this.pageUp()}return tn||super[ho]&&super[ho](en)}get orientation(){return super.orientation||this[jo]&&this[jo].orientation||"both"}pageDown(){return super.pageDown&&super.pageDown(),scrollOnePage(this,!0)}pageUp(){return super.pageUp&&super.pageUp(),scrollOnePage(this,!1)}get[ko](){return super[ko]||defaultScrollTarget(this)}}}(function KeyboardPrefixCursorMixin(en){return class KeyboardPrefixCursor extends en{constructor(){super(),resetTypedPrefix(this)}[so](en){if(super[so]&&super[so](en),null==en||0===en.length)return!1;const tn=en.toLowerCase(),nn=this[jo].texts.findIndex((nn=>nn.substr(0,en.length).toLowerCase()===tn));if(nn>=0){const en=this[jo].currentIndex;return this[Co]({currentIndex:nn}),this[jo].currentIndex!==en}return!1}[ho](en){let tn;switch(en.key){case"Backspace":!function handleBackspace(en){const tn=en,nn=tn[ki]?tn[ki].length:0;nn>0&&(tn[ki]=tn[ki].substr(0,nn-1));en[so](tn[ki]),setPrefixTimeout(en)}(this),tn=!0;break;case"Escape":resetTypedPrefix(this);break;default:en.ctrlKey||en.metaKey||en.altKey||1!==en.key.length||function handlePlainCharacter(en,tn){const nn=en,rn=nn[ki]||"";nn[ki]=rn+tn,en[so](nn[ki]),setPrefixTimeout(en)}(this,en.key)}return tn||super[ho]&&super[ho](en)}}}(LanguageDirectionMixin(function SlotItemsMixin(en){return ContentItemsMixin(SlotContentMixin(en))}(function TapCursorMixin(en){return class TapCursor extends en{constructor(){super(),this.addEventListener("mousedown",(en=>{0===en.button&&(this[fo]=!0,this[qo](en),this[fo]=!1)}))}[yo](en){super[yo]&&super[yo](en),this[Wr]&&Object.assign(this.style,{touchAction:"manipulation",mozUserSelect:"none",msUserSelect:"none",webkitUserSelect:"none",userSelect:"none"})}[qo](en){const tn=en.composedPath?en.composedPath()[0]:en.target,{items:nn,currentItemRequired:rn}=this[jo];if(nn&&tn instanceof Node){const an=indexOfItemContainingTarget(nn,tn),sn=an>=0?nn[an]:null;(sn&&!sn.disabled||!sn&&!rn)&&(this[Co]({currentIndex:an}),en.stopPropagation())}}}}(Qr)))))))))))))));class Menu extends Bi{get[Hr](){return Object.assign(super[Hr],{availableItemFlags:null,handleBubblingDirectionKeys:!0,highlightCurrentItem:!0,orientation:"vertical",currentItemFocused:!1})}async flashCurrentItem(){const en=this[jo].focusVisible,tn=matchMedia("(pointer: fine)").matches;if(en||tn){const en=75;this[Co]({highlightCurrentItem:!1}),await new Promise((tn=>setTimeout(tn,en))),this[Co]({highlightCurrentItem:!0}),await new Promise((tn=>setTimeout(tn,en)))}}[yo](en){super[yo](en),this[Wr]&&(this.addEventListener("disabledchange",(en=>{this[fo]=!0;const tn=en.target,{items:nn}=this[jo],rn=null===nn?-1:nn.indexOf(tn);if(rn>=0){const en=this[jo].availableItemFlags.slice();en[rn]=!tn.disabled,this[Co]({availableItemFlags:en})}this[fo]=!1})),"PointerEvent"in window?this.addEventListener("pointerdown",(en=>this[qo](en))):this.addEventListener("touchstart",(en=>this[qo](en))),this.removeAttribute("tabindex"));const{currentIndex:tn,items:nn}=this[jo];if((en.items||en.currentIndex||en.highlightCurrentItem)&&nn){const{highlightCurrentItem:en}=this[jo];nn.forEach(((nn,rn)=>{nn.toggleAttribute("current",en&&rn===tn)}))}(en.items||en.currentIndex||en.currentItemFocused||en.focusVisible)&&nn&&nn.forEach(((en,nn)=>{const rn=nn===tn,an=tn<0&&0===nn;this[jo].currentItemFocused?rn||an||en.removeAttribute("tabindex"):(rn||an)&&(en.tabIndex=0)}))}[wo](en){if(super[wo](en),!this[Wr]&&en.currentIndex&&!this[jo].currentItemFocused){const{currentItem:en}=this[jo];(en instanceof HTMLElement?en:this).focus(),this[Co]({currentItemFocused:!0})}}get[ko](){return this[Ao].content}[Lo](en,tn){const nn=super[Lo](en,tn);if(tn.currentIndex&&Object.assign(nn,{currentItemFocused:!1}),tn.items){const{items:tn}=en,rn=null===tn?null:tn.map((en=>!en.disabled));Object.assign(nn,{availableItemFlags:rn})}return nn}get[Vo](){return En.html(Si||(Si=_taggedTemplateLiteral(['\n \n
\n \n
\n '])))}}const Ei=Symbol("documentMouseupListener");async function handleMouseup(en){const tn=this,nn=tn[So].elementsFromPoint(en.clientX,en.clientY);if(tn.opened){const en=nn.indexOf(tn[Ao].source)>=0,rn=tn[Ao].popup,an=nn.indexOf(rn)>=0,sn=rn.frame&&nn.indexOf(rn.frame)>=0;en?tn[jo].dragSelect&&(tn[fo]=!0,tn[Co]({dragSelect:!1}),tn[fo]=!1):an||sn||(tn[fo]=!0,await tn.close(),tn[fo]=!1)}}function listenIfOpenAndConnected$1(en){en[jo].opened&&en.isConnected?en[Ei]||(en[Ei]=handleMouseup.bind(en),document.addEventListener("mouseup",en[Ei])):en[Ei]&&(document.removeEventListener("mouseup",en[Ei]),en[Ei]=null)}function availableSpace(en,tn,nn,rn){const an=getSourceOrigin(en,nn,rn);let sn=0,cn=0;const An="above"===nn||"below"===nn;switch(nn){case"above":sn=an.y-tn.top;break;case"below":sn=tn.bottom-an.y;break;case"left":cn=an.x-tn.left;break;case"right":cn=tn.right-an.x}switch(rn){case"bottom":sn=an.y-tn.top;break;case"center":An?cn=tn.width:sn=tn.height;break;case"stretch":An?cn=en.width:sn=en.height;break;case"left":cn=tn.right-an.x;break;case"right":cn=an.x-tn.left;break;case"top":sn=tn.bottom-an.y}return sn=Math.max(0,sn),cn=Math.max(0,cn),{height:sn,width:cn}}function getSourceOrigin(en,tn,nn){let rn=0,an=0;const sn="above"===tn||"below"===tn;switch(tn){case"above":an=en.top;break;case"below":an=en.bottom;break;case"left":case"right":rn=en[tn]}switch(nn){case"bottom":case"top":an=en[nn];break;case"left":case"right":rn=en[nn];break;case"center":sn?rn=en.left+en.width/2:an=en.top+en.height/2;break;case"stretch":sn?rn=en.left:an=en.top}return{x:rn,y:an}}function layoutPopup(en,tn,nn,rn){const an=function normalizeOptions(en){const{align:tn,direction:nn,rightToLeft:rn}=en,an="below",sn={above:"above",below:"below",column:"below","column-reverse":"above",left:"left",right:"right",row:rn?"left":"right","row-reverse":rn?"right":"left"}[nn]||an,cn={above:"horizontal",below:"horizontal",left:"vertical",right:"vertical"}[sn],An={horizontal:"left",vertical:"top"}[cn];return{align:{horizontal:{center:"center",end:rn?"left":"right",left:"left",right:"right",start:rn?"right":"left",stretch:"stretch"},vertical:{bottom:"bottom",center:"center",end:"bottom",start:"top",stretch:"stretch",top:"top"}}[cn][tn]||An,direction:sn,rightToLeft:rn}}(rn),sn=function prioritizedLayouts(en,tn){const nn={above:"below",below:"above",left:"right",right:"left"},rn={top:"bottom",bottom:"top",left:"right",right:"left"},an=[{align:tn,direction:en}];"center"===tn||"stretch"===tn?an.push({align:tn,direction:nn[en]}):(an.push({align:rn[tn],direction:en}),an.push({align:tn,direction:nn[en]}),an.push({align:rn[tn],direction:nn[en]}));return an}(an.direction,an.align);sn.sort(((rn,an)=>function compareLayouts(en,tn,nn,rn,an){const sn=availableSpace(nn,an,en.direction,en.align),cn=availableSpace(nn,an,tn.direction,tn.align),An=rn.width<=sn.width,dn=rn.height<=sn.height,un=An||dn,pn=An&&dn,hn=rn.width<=cn.width,gn=rn.height<=cn.height,_n=hn||gn,mn=hn&&gn,fn=sn.width*sn.height,yn=cn.width*cn.height;return pn&&mn?0:pn?-1:mn?1:un&&!_n?-1:_n&&!un?1:un&&fn>yn?-1:_n&&yn>fn?1:fn>yn?-1:yn>fn?1:0}(rn,an,en,tn,nn)));const cn=sn[0];return cn.rect=function getPositionedRect(en,tn,nn,rn,an){const sn=getSourceOrigin(en,rn,an);let{x:cn,y:An,bottom:dn,right:un}=nn,pn=0,hn=0,gn=tn.height,_n=tn.width;const mn="above"===rn||"below"===rn;switch(rn){case"above":hn=sn.y-tn.height,dn=sn.y;break;case"below":hn=sn.y,An=sn.y;break;case"left":pn=sn.x-tn.width,un=sn.x;break;case"right":pn=sn.x,cn=sn.x}switch(an){case"bottom":hn=sn.y-tn.height,dn=sn.y;break;case"left":pn=sn.x,cn=sn.x;break;case"center":mn?pn=sn.x-tn.width/2:hn=sn.y-tn.height/2;break;case"right":pn=sn.x-tn.width,un=sn.x;break;case"stretch":mn?(pn=sn.x,_n=en.width):(hn=sn.y,gn=en.height);break;case"top":hn=sn.y,An=sn.y}return pn=Math.max(pn,cn),hn=Math.max(hn,An),_n=Math.min(_n,un-pn),gn=Math.min(gn,dn-hn),new DOMRect(pn,hn,_n,gn)}(en,tn,nn,cn.direction,cn.align),cn}const ji=Symbol("closePromise"),Li=Symbol("closeResolve");function OpenCloseMixin(en){return class OpenClose extends en{attributeChangedCallback(en,tn,nn){if("opened"===en){const tn=booleanAttributeValue(en,nn);this.opened!==tn&&(this.opened=tn)}else super.attributeChangedCallback(en,tn,nn)}async close(en){super.close&&await super.close(),this[Co]({closeResult:en}),await this.toggle(!1)}get closed(){return this[jo]&&!this[jo].opened}get closeFinished(){return this[jo].closeFinished}get closeResult(){return this[jo].closeResult}get[Hr](){const en={closeResult:void 0,opened:!1};return this[Eo]&&Object.assign(en,{closeFinished:!0,effect:"close",effectPhase:"after",openCloseEffects:!0}),Object.assign(super[Hr]||{},en)}async open(){super.open&&await super.open(),await this.toggle(!0)}get opened(){return this[jo]&&this[jo].opened}set opened(en){this[Co]({closeResult:void 0}),this.toggle(en)}[yo](en){if(super[yo](en),en.opened){const{opened:en}=this[jo];setInternalState(this,"opened",en)}if(en.closeFinished){const{closeFinished:en}=this[jo];setInternalState(this,"closed",en)}}[wo](en){if(super[wo]&&super[wo](en),en.opened&&this[fo]){const en=new CustomEvent("openedchange",{bubbles:!0,detail:{closeResult:this[jo].closeResult,opened:this[jo].opened}});if(this.dispatchEvent(en),this[jo].opened){const en=new CustomEvent("opened",{bubbles:!0});this.dispatchEvent(en);const tn=new CustomEvent("open",{bubbles:!0});this.dispatchEvent(tn)}else{const en=new CustomEvent("closed",{bubbles:!0,detail:{closeResult:this[jo].closeResult}});this.dispatchEvent(en);const tn=new CustomEvent("close",{bubbles:!0,detail:{closeResult:this[jo].closeResult}});this.dispatchEvent(tn)}}const tn=this[Li];this.closeFinished&&tn&&(this[Li]=null,this[ji]=null,tn(this[jo].closeResult))}[Lo](en,tn){const nn=super[Lo]?super[Lo](en,tn):{};if(tn.opened&&en.opened&&Object.assign(nn,{closeResult:void 0}),tn.openCloseEffects||tn.effect||tn.effectPhase||tn.opened){const{effect:tn,effectPhase:rn,openCloseEffects:an,opened:sn}=en,cn=an?"close"===tn&&"after"===rn:!sn;Object.assign(nn,{closeFinished:cn})}return nn}async toggle(){let en=arguments.length>0&&void 0!==arguments[0]?arguments[0]:!this.opened;super.toggle&&await super.toggle(en);if(en!==this[jo].opened){const tn={opened:en};this[jo].openCloseEffects&&(tn.effect=en?"open":"close","after"===this[jo].effectPhase&&(tn.effectPhase="before")),await this[Co](tn)}}whenClosed(){return this[ji]||(this[ji]=new Promise((en=>{this[Li]=en}))),this[ji]}}}var Pi;const Ti=function AriaRoleMixin(en){return class AriaRole extends en{get[Hr](){return Object.assign(super[Hr]||{},{role:null})}[yo](en){if(super[yo]&&super[yo](en),en.role){const{role:en}=this[jo];en?this.setAttribute("role",en):this.removeAttribute("role")}}get role(){return super.role}set role(en){const tn=String(en);super.role=tn,this[xo]||this[Co]({s:tn})}}}(Qr);class Backdrop extends Ti{get[Hr](){return Object.assign(super[Hr],{role:"none"})}get[Vo](){return En.html(Pi||(Pi=_taggedTemplateLiteral(["\n \n \n "])))}}var Fi,Ui,Ni;class OverlayFrame extends Qr{get[Vo](){return En.html(Fi||(Fi=_taggedTemplateLiteral(["\n \n \n "])))}}const Ii=Symbol("appendedToDocument"),Mi=Symbol("assignedZIndex"),Ri=Symbol("restoreFocusToElement");function bringToFront(en){const tn=function maxZIndexInUse(){const en=document.body.querySelectorAll("*"),tn=Array.from(en,(en=>{const tn=getComputedStyle(en);let nn=0;if("static"!==tn.position&&"auto"!==tn.zIndex){const en=tn.zIndex?parseInt(tn.zIndex):0;nn=isNaN(en)?0:en}return nn}));return Math.max(...tn)}()+1;en[Mi]=tn,en.style.zIndex=tn.toString()}function hasZIndex(en){const tn=getComputedStyle(en).zIndex,nn=en.style.zIndex,rn=!isNaN(parseInt(nn));if("auto"===tn)return rn;if("0"===tn&&!rn){const tn=en.assignedSlot||(en instanceof ShadowRoot?en.host:en.parentNode);if(!(tn instanceof HTMLElement))return!0;if(!hasZIndex(tn))return!1}return!0}var Oi;const Qi=OpenCloseMixin(function OverlayMixin(en){return class Overlay extends en{get autoFocus(){return this[jo].autoFocus}set autoFocus(en){this[Co]({autoFocus:en})}get[Hr](){return Object.assign(super[Hr]||{},{autoFocus:!0,persistent:!1})}async open(){this[jo].persistent||this.isConnected||(this[Ii]=!0,document.body.append(this)),super.open&&await super.open()}[yo](en){if(super[yo]&&super[yo](en),this[Wr]&&this.addEventListener("blur",(en=>{const tn=en.relatedTarget||document.activeElement;if(tn instanceof HTMLElement){deepContains(this,tn)||(this.opened?this[Ri]=tn:(tn.focus(),this[Ri]=null))}})),(en.effectPhase||en.opened||en.persistent)&&!this[jo].persistent){(void 0===this.closeFinished?this.closed:this.closeFinished)?this[Mi]&&(this.style.zIndex="",this[Mi]=null):this[Mi]?this.style.zIndex=this[Mi]:hasZIndex(this)||bringToFront(this)}}[wo](en){if(super[wo]&&super[wo](en),this[Wr]&&this[jo].persistent&&!hasZIndex(this)&&bringToFront(this),en.opened&&this[jo].autoFocus)if(this[jo].opened){this[Ri]||document.activeElement===document.body||(this[Ri]=document.activeElement);const en=firstFocusableElement(this);en&&en.focus()}else this[Ri]&&(this[Ri].focus(),this[Ri]=null);!this[Wr]&&!this[jo].persistent&&this.closeFinished&&this[Ii]&&(this[Ii]=!1,this.parentNode&&this.parentNode.removeChild(this))}get[Vo](){const en=super[Vo]||En.html(Ui||(Ui=_taggedTemplateLiteral([""])));return en.content.append(Bn.html(Ni||(Ni=_taggedTemplateLiteral(["\n \n "])))),en}}}(SlotContentMixin(Qr)));class Overlay extends Qi{get backdrop(){return this[Ao]&&this[Ao].backdrop}get backdropPartType(){return this[jo].backdropPartType}set backdropPartType(en){this[Co]({backdropPartType:en})}get[Hr](){return Object.assign(super[Hr],{backdropPartType:Backdrop,framePartType:OverlayFrame})}get frame(){return this[Ao].frame}get framePartType(){return this[jo].framePartType}set framePartType(en){this[Co]({framePartType:en})}[yo](en){super[yo](en),renderParts$3(this[So],this[jo],en)}[wo](en){super[wo](en),en.opened&&this[jo].content&&this[jo].content.forEach((en=>{en[Vr]&&en[Vr]()}))}get[Vo](){const en=super[Vo];return en.content.append(Bn.html(Oi||(Oi=_taggedTemplateLiteral(['\n \n
\n
\n \n
\n '])))),renderParts$3(en.content,this[jo]),en}}function renderParts$3(en,tn,nn){if(!nn||nn.backdropPartType){const{backdropPartType:nn}=tn,rn=en.getElementById("backdrop");rn&&transmute(rn,nn)}if(!nn||nn.framePartType){const{framePartType:nn}=tn,rn=en.getElementById("frame");rn&&transmute(rn,nn)}}const qi=Symbol("implicitCloseListener"),Vi="true"===new URLSearchParams(location.search).get("elixdebugpopup");async function blurHandler$1(en){const tn=this,nn=en.relatedTarget||document.activeElement;nn instanceof Element&&!deepContains(tn,nn)&&(tn[fo]=!0,await tn.close({canceled:"window blur"}),tn[fo]=!1)}async function closeHandler(en){const tn=this,nn="resize"!==en.type||tn[jo].closeOnWindowResize;!ownEvent(tn,en)&&nn&&(tn[fo]=!0,await tn.close({canceled:"window ".concat(en.type)}),tn[fo]=!1)}var Gi;const Di=KeyboardMixin(function PopupModalityMixin(en){return class PopupModality extends en{get closeOnWindowResize(){return this[jo].closeOnWindowResize}set closeOnWindowResize(en){this[Co]({closeOnWindowResize:en})}get[Hr](){return Object.assign(super[Hr]||{},{closeOnWindowResize:!0,role:"alert"})}[ho](en){let tn=!1;if("Escape"===en.key)this.close({canceled:"Escape"}),tn=!0;return tn||super.keydown&&super.keydown(en)||!1}[yo](en){if(super[yo]&&super[yo](en),this[Wr]&&(Vi||this.addEventListener("blur",blurHandler$1.bind(this))),en.role){const{role:en}=this[jo];this.setAttribute("role",en)}}[wo](en){if(super[wo]&&super[wo](en),en.opened)if(this.opened){("requestIdleCallback"in window?window.requestIdleCallback:setTimeout)((()=>{this.opened&&function addEventListeners$1(en){en[qi]=closeHandler.bind(en),Vi||window.addEventListener("blur",en[qi]);window.addEventListener("resize",en[qi]),window.addEventListener("scroll",en[qi])}(this)}))}else!function removeEventListeners$1(en){en[qi]&&(Vi||window.removeEventListener("blur",en[qi]),window.removeEventListener("resize",en[qi]),window.removeEventListener("scroll",en[qi]),en[qi]=null)}(this)}get role(){return super.role}set role(en){super.role=en,this[xo]||this[Co]({role:en})}}}(Overlay));class Popup extends Di{[yo](en){super[yo](en),en.backdropPartType&&(this[Ao].backdrop.addEventListener("mousedown",mousedownHandler.bind(this)),"PointerEvent"in window||this[Ao].backdrop.addEventListener("touchend",mousedownHandler))}get[Vo](){const en=super[Vo];return en.content.append(Bn.html(Gi||(Gi=_taggedTemplateLiteral(["\n \n "])))),en}}async function mousedownHandler(en){const tn=this;tn[fo]=!0,await tn.close({canceled:"mousedown outside"}),tn[fo]=!1,en.preventDefault(),en.stopPropagation()}var Hi;const zi=Symbol("resizeListener"),Ki=DisabledMixin(FocusVisibleMixin(LanguageDirectionMixin(OpenCloseMixin(Qr))));function choosePopupLayout(en){const{popupAlign:tn,popupDirection:nn,rightToLeft:rn}=en[jo],an=en[Ao].source.getBoundingClientRect(),sn=en[Ao].popup.getBoundingClientRect();en[Ao].popup.frame&&(sn.height=en[Ao].popup[Ao].frame.scrollHeight,sn.width=en[Ao].popup[Ao].frame.scrollWidth);const cn=layoutPopup(an,sn,function viewportBounds(){const en=window.visualViewport;return en?new DOMRect(en.offsetLeft,en.offsetTop,en.width,en.height):new DOMRect(0,0,window.innerWidth,window.innerHeight)}(),{align:tn,direction:nn,rightToLeft:rn});en[Co]({popupLayout:cn})}function renderParts$2(en,tn,nn){if(!nn||nn.popupPartType){const{popupPartType:nn}=tn,rn=en.getElementById("popup");rn&&transmute(rn,nn)}if(!nn||nn.sourcePartType){const{sourcePartType:nn}=tn,rn=en.getElementById("source");rn&&transmute(rn,nn)}}var $i;const Wi="true"===new URLSearchParams(location.search).get("elixdebugpopup"),Xi=DelegateFocusMixin(KeyboardMixin(function PopupDragSelectMixin(en){return class PopupDragSelect extends en{connectedCallback(){super.connectedCallback(),listenIfOpenAndConnected$1(this)}get[Hr](){return Object.assign(super[Hr]||{},{dragSelect:!0})}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),listenIfOpenAndConnected$1(this)}[wo](en){super[wo](en),en.opened&&listenIfOpenAndConnected$1(this)}[Lo](en,tn){const nn=super[Lo](en,tn);return tn.opened&&en.opened&&Object.assign(nn,{dragSelect:!0}),nn}}}(class PopupSource extends Ki{get[Hr](){return Object.assign(super[Hr],{ariaHasPopup:"true",popupAlign:"start",popupDirection:"column",popupLayout:null,popupPartType:Popup,sourcePartType:"div"})}get[uo](){return this[Ao].source}get frame(){return this[Ao].popup.frame}get popupAlign(){return this[jo].popupAlign}set popupAlign(en){this[Co]({popupAlign:en})}get popupDirection(){return this[jo].popupDirection}set popupDirection(en){this[Co]({popupDirection:en})}get popupPartType(){return this[jo].popupPartType}set popupPartType(en){this[Co]({popupPartType:en})}[yo](en){if(super[yo](en),renderParts$2(this[So],this[jo],en),this[Wr]||en.ariaHasPopup){const{ariaHasPopup:en}=this[jo];null===en?this[uo].removeAttribute("aria-haspopup"):this[uo].setAttribute("aria-haspopup",this[jo].ariaHasPopup)}if(en.popupPartType&&(this[Ao].popup.addEventListener("open",(()=>{this.opened||(this[fo]=!0,this.open(),this[fo]=!1)})),this[Ao].popup.addEventListener("close",(en=>{if(!this.closed){this[fo]=!0;const tn=en.detail.closeResult;this.close(tn),this[fo]=!1}}))),en.opened||en.popupLayout){const{opened:en,popupLayout:tn}=this[jo],nn={height:"",left:"",opacity:"",top:"",width:""};if(en)if(tn){const{align:en,direction:rn,rect:an}=tn,sn="stretch"===en,cn="above"===rn||"below"===rn,An=!cn&&sn?"minmax(0, 1fr)":"",dn=cn&&sn?"minmax(0, 1fr)":"";Object.assign(nn,{gridTemplateColumns:dn,gridTemplateRows:An,height:"".concat(an.height,"px"),left:"".concat(an.left,"px"),top:"".concat(an.top,"px"),width:"".concat(an.width,"px")})}else nn.opacity=0;else;Object.assign(this[Ao].popup.style,nn)}if(en.opened){const{opened:en}=this[jo];this[Ao].popup.opened=en}if(en.disabled&&"disabled"in this[Ao].source){const{disabled:en}=this[jo];this[Ao].source.disabled=en}if(en.popupLayout){const{popupLayout:en}=this[jo];if(en){const{align:tn,direction:nn}=en,rn=this[Ao].popup;"position"in rn&&(rn.position=nn),"align"in rn&&(rn.align=tn)}}}[wo](en){super[wo](en);const{opened:tn}=this[jo];en.opened?tn?function waitThenRenderOpened(en){setTimeout((()=>{en[jo].opened&&(choosePopupLayout(en),function addEventListeners(en){const tn=en;tn[zi]=()=>{choosePopupLayout(en)};(window.visualViewport||window).addEventListener("resize",tn[zi])}(en))}))}(this):function removeEventListeners(en){const tn=en;if(tn[zi]){(window.visualViewport||window).removeEventListener("resize",tn[zi]),tn[zi]=null}}(this):en.popupLayout&&this[jo].opened&&!this[jo].popupLayout&&choosePopupLayout(this)}get sourcePartType(){return this[jo].sourcePartType}set sourcePartType(en){this[Co]({sourcePartType:en})}[Lo](en,tn){const nn=super[Lo](en,tn);return(tn.opened&&!en.opened||en.opened&&(tn.popupAlign||tn.popupDirection||tn.rightToLeft))&&Object.assign(nn,{popupLayout:null}),nn}get[Vo](){const en=super[Vo];return en.content.append(Bn.html(Hi||(Hi=_taggedTemplateLiteral(['\n \n
\n \n
\n \n '])))),renderParts$2(en.content,this[jo]),en}})));async function blurHandler(en){const tn=this,nn=en.relatedTarget||document.activeElement;nn instanceof Element&&!deepContains(tn,nn)&&(tn[fo]=!0,await tn.close({canceled:"blur"}),tn[fo]=!1)}const Yi=Symbol("documentMousemoveListener");function handleMousemove(en){const tn=this,{hasHoveredOverItemSinceOpened:nn,opened:rn}=tn[jo];if(rn){const rn=en.composedPath?en.composedPath()[0]:en.target,an=tn.items;if(rn&&rn instanceof Node&&an){const en=indexOfItemContainingTarget(an,rn),sn=an[en],cn=sn&&!sn.disabled?en:-1;(nn||cn>=0)&&cn!==tn[jo].currentIndex&&(tn[fo]=!0,tn[Co]({currentIndex:cn}),cn>=0&&!nn&&tn[Co]({hasHoveredOverItemSinceOpened:!0}),tn[fo]=!1)}}}function listenIfOpenAndConnected(en){en[jo].opened&&en.isConnected?en[Yi]||(en[Yi]=handleMousemove.bind(en),document.addEventListener("mousemove",en[Yi])):en[Yi]&&(document.removeEventListener("mousemove",en[Yi]),en[Yi]=null)}async function selectCurrentItemAndClose(en){const tn=en[fo],nn=en[jo].currentIndex>=0,rn=en.items;if(rn){const an=nn?rn[en[jo].currentIndex]:void 0,sn=en[jo].popupList;nn&&"flashCurrentItem"in sn&&await sn.flashCurrentItem();const cn=en[fo];en[fo]=tn,await en.close(an),en[fo]=cn}}var Zi,Ji;const ea=function PopupListMixin(en){return class PopupList extends en{connectedCallback(){super.connectedCallback(),listenIfOpenAndConnected(this)}get[Hr](){return Object.assign(super[Hr]||{},{currentIndex:-1,hasHoveredOverItemSinceOpened:!1,popupList:null})}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),listenIfOpenAndConnected(this)}[ho](en){let tn=!1;if("Enter"===en.key)this.opened&&(selectCurrentItemAndClose(this),tn=!0);return tn||super[ho]&&super[ho](en)||!1}[yo](en){if(super[yo]&&super[yo](en),en.popupList){const{popupList:en}=this[jo];en&&(en.addEventListener("mouseup",(async en=>{const tn=this[jo].currentIndex;this[jo].dragSelect||tn>=0?(en.stopPropagation(),this[fo]=!0,await selectCurrentItemAndClose(this),this[fo]=!1):en.stopPropagation()})),en.addEventListener("currentindexchange",(en=>{this[fo]=!0;const tn=en;this[Co]({currentIndex:tn.detail.currentIndex}),this[fo]=!1})))}if(en.currentIndex||en.popupList){const{currentIndex:en,popupList:tn}=this[jo];tn&&"currentIndex"in tn&&(tn.currentIndex=en)}}[wo](en){if(super[wo]&&super[wo](en),en.opened){if(this[jo].opened){const{popupList:en}=this[jo];en.scrollCurrentItemIntoView&&setTimeout((()=>{en.scrollCurrentItemIntoView()}))}listenIfOpenAndConnected(this)}}[Lo](en,tn){const nn=super[Lo]?super[Lo](en,tn):{};return tn.opened&&en.opened&&Object.assign(nn,{hasHoveredOverItemSinceOpened:!1}),nn}}}(class PopupButton extends Xi{get[Hr](){return Object.assign(super[Hr],{sourcePartType:"button"})}[ho](en){let tn;switch(en.key){case" ":case"ArrowDown":case"ArrowUp":this.closed&&(this.open(),tn=!0);break;case"Enter":this.opened||(this.open(),tn=!0);break;case"Escape":this.opened&&(this.close({canceled:"Escape"}),tn=!0)}if(tn=super[ho]&&super[ho](en),!tn&&this.opened&&!en.metaKey&&!en.altKey)switch(en.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":case"PageDown":case"PageUp":case" ":tn=!0}return tn}[yo](en){if(super[yo](en),this[Wr]&&(Wi||this.addEventListener("blur",blurHandler.bind(this)),this[Ao].source.addEventListener("focus",(async en=>{const tn=ownEvent(this[Ao].popup,en),nn=null!==this[jo].popupHeight;!tn&&this.opened&&nn&&(this[fo]=!0,await this.close(),this[fo]=!1)}))),en.opened){const{opened:en}=this[jo];this.toggleAttribute("opened",en)}if(en.sourcePartType){this[Ao].source.addEventListener("mousedown",(en=>{if(this.disabled)return void en.preventDefault();const tn=en;tn.button&&0!==tn.button||(setTimeout((()=>{this.opened||(this[fo]=!0,this.open(),this[fo]=!1)})),en.stopPropagation())}))}en.popupPartType&&this[Ao].popup.removeAttribute("tabindex")}get[Vo](){const en=super[Vo];return en.content.append(Bn.html($i||($i=_taggedTemplateLiteral(['\n \n '])))),en}});class MenuButton extends ea{get[Hr](){return Object.assign(super[Hr],{menuPartType:Menu})}get items(){const en=this[Ao]&&this[Ao].menu;return en?en.items:null}get menuPartType(){return this[jo].menuPartType}set menuPartType(en){this[Co]({menuPartType:en})}[yo](en){if(super[yo](en),renderParts$1(this[So],this[jo],en),en.menuPartType&&(this[Ao].menu.addEventListener("blur",(async en=>{const tn=en.relatedTarget||document.activeElement;this.opened&&!deepContains(this[Ao].menu,tn)&&(this[fo]=!0,await this.close(),this[fo]=!1)})),this[Ao].menu.addEventListener("mousedown",(en=>{0===en.button&&this.opened&&(en.stopPropagation(),en.preventDefault())}))),en.opened){const{opened:en}=this[jo];this[Ao].source.setAttribute("aria-expanded",en.toString())}}[wo](en){super[wo](en),en.menuPartType&&this[Co]({popupList:this[Ao].menu})}[Lo](en,tn){const nn=super[Lo](en,tn);return tn.opened&&!en.opened&&Object.assign(nn,{currentIndex:-1}),nn}get[Vo](){const en=super[Vo],tn=en.content.querySelector("slot:not([name])");return tn&&tn.replaceWith(Bn.html(Zi||(Zi=_taggedTemplateLiteral(['\n \n '])))),renderParts$1(en.content,this[jo]),en.content.append(Bn.html(Ji||(Ji=_taggedTemplateLiteral(['\n \n '])))),en}}function renderParts$1(en,tn,nn){if(!nn||nn.menuPartType){const{menuPartType:nn}=tn,rn=en.getElementById("menu");rn&&transmute(rn,nn)}}var ta;const na=DisabledMixin(Qr);class UpDownToggle extends na{get[Hr](){return Object.assign(super[Hr],{direction:"down"})}get direction(){return this[jo].direction}set direction(en){this[Co]({direction:en})}[yo](en){if(super[yo](en),en.direction){const{direction:en}=this[jo];this[Ao].downIcon.style.display="down"===en?"block":"none",this[Ao].upIcon.style.display="up"===en?"block":"none"}}get[Vo](){return En.html(ta||(ta=_taggedTemplateLiteral(['\n \n
\n \n
\n
\n \n
\n '])))}}var ra,oa,ia,aa,sa,la,ca,Aa,da,ua;function renderParts(en,tn,nn){if(!nn||nn.popupTogglePartType){const{popupTogglePartType:nn}=tn,rn=en.getElementById("popupToggle");rn&&transmute(rn,nn)}}class PlainButton extends(PlainButtonMixin(Button)){}class PlainBorderButton extends PlainButton{get[Vo](){const en=super[Vo];return en.content.append(Bn.html(ia||(ia=_taggedTemplateLiteral(['\n \n '])))),en}}class PlainMenu extends Menu{get[Vo](){const en=super[Vo];return en.content.append(Bn.html(aa||(aa=_taggedTemplateLiteral(["\n \n "])))),en}}class PlainOpenCloseToggle extends UpDownToggle{get[Vo](){const en=super[Vo],tn=en.content.getElementById("downIcon"),nn=Bn.html(sa||(sa=_taggedTemplateLiteral(['\n \n \n \n ']))).firstElementChild;tn&&nn&&replace(tn,nn);const rn=en.content.getElementById("upIcon"),an=Bn.html(la||(la=_taggedTemplateLiteral(['\n \n \n \n ']))).firstElementChild;return rn&&an&&replace(rn,an),en.content.append(Bn.html(ca||(ca=_taggedTemplateLiteral(['\n \n '])))),en}}class PlainBackdrop extends Backdrop{}class PlainOverlayFrame extends OverlayFrame{get[Vo](){const en=super[Vo];return en.content.append(Bn.html(Aa||(Aa=_taggedTemplateLiteral(["\n \n "])))),en}}class PlainPopup extends Popup{get[Hr](){return Object.assign(super[Hr],{backdropPartType:PlainBackdrop,framePartType:PlainOverlayFrame})}}class PlainMenuButton extends(function PopupToggleMixin(en){return class PopupToggle extends en{get[Hr](){return Object.assign(super[Hr]||{},{popupTogglePartType:UpDownToggle})}get popupTogglePartType(){return this[jo].popupTogglePartType}set popupTogglePartType(en){this[Co]({popupTogglePartType:en})}[yo](en){if(super[yo](en),renderParts(this[So],this[jo],en),en.popupDirection||en.popupTogglePartType){const{popupDirection:en}=this[jo],tn="above"===en||"column-reverse"===en?"up":"down",nn=this[Ao].popupToggle;"direction"in nn&&(nn.direction=tn)}if(en.disabled){const{disabled:en}=this[jo];this[Ao].popupToggle.disabled=en}}get[Vo](){const en=super[Vo],tn=en.content.querySelector('[part~="source"]');return tn&&tn.append(Bn.html(ra||(ra=_taggedTemplateLiteral(['\n \n '])))),renderParts(en.content,this[jo]),en.content.append(Bn.html(oa||(oa=_taggedTemplateLiteral(['\n \n '])))),en}}}(MenuButton)){get[Hr](){return Object.assign(super[Hr],{menuPartType:PlainMenu,popupPartType:PlainPopup,popupTogglePartType:PlainOpenCloseToggle,sourcePartType:PlainBorderButton})}get[Vo](){const en=super[Vo];return en.content.append(Bn.html(da||(da=_taggedTemplateLiteral(['\n \n '])))),en}}class SePlainBorderButton extends PlainButton{get[Vo](){const en=super[Vo];return en.content.append(Bn.html(ua||(ua=_taggedTemplateLiteral(['\n \n '])))),en}}customElements.define("elix-menu-button",class ElixMenuButton extends PlainMenuButton{get[Hr](){return Object.assign(super[Hr],{sourcePartType:SePlainBorderButton})}});const pa=document.createElement("template");pa.innerHTML='\n \n\n \n \n \n\n';class SeMenu extends HTMLElement{constructor(){super(),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(pa.content.cloneNode(!0)),this.$menu=this._shadowRoot.querySelector("elix-menu-button"),this.$label=this.$menu.shadowRoot.querySelector("#popupToggle").shadowRoot,this.imgPath=svgEditor.configObj.curConfig.imgPath}static get observedAttributes(){return["label","src"]}attributeChangedCallback(en,tn,nn){const rn=new Image;if(tn!==nn)switch(en){case"src":rn.src=this.imgPath+"/"+nn,rn.width=24,rn.height=24,this.$label.prepend(rn);break;case"label":this.$label.prepend(nn);break;default:console.error("unknown attribute: ".concat(en))}}get label(){return this.getAttribute("label")}set label(en){this.setAttribute("label",en)}get src(){return this.getAttribute("src")}set src(en){this.setAttribute("src",en)}}customElements.define("se-menu",SeMenu);customElements.define("elix-menu",class ElixMenu extends PlainMenu{});const ha=document.createElement("template");ha.innerHTML='\n \n \n
\n icon\n \n
\n
\n';class SeMenuItem extends HTMLElement{constructor(){super(),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(ha.content.cloneNode(!0)),this.$img=this._shadowRoot.querySelector("img"),this.$label=this._shadowRoot.querySelector("span"),this.$menuitem=this._shadowRoot.querySelector("elix-menu-item"),this.$svg=this.$menuitem.shadowRoot.querySelector("#checkmark"),this.$svg.setAttribute("style","display: none;"),this.imgPath=svgEditor.configObj.curConfig.imgPath}static get observedAttributes(){return["label","src"]}attributeChangedCallback(en,tn,nn){let rn="";if(tn!==nn)switch(en){case"src":this.$img.style.display="inline-block",this.$img.setAttribute("src",this.imgPath+"/"+nn);break;case"label":rn=this.getAttribute("shortcut"),this.$label.textContent="".concat(t$1(nn)," ").concat(rn?"(".concat(rn,")"):"");break;default:console.error("unknown attribute: ".concat(en))}}get label(){return this.getAttribute("label")}set label(en){this.setAttribute("label",en)}get src(){return this.getAttribute("src")}set src(en){this.setAttribute("src",en)}connectedCallback(){const en=this.getAttribute("shortcut");en&&document.addEventListener("keydown",(tn=>{if("BODY"!==tn.target.nodeName)return;const nn="".concat(tn.metaKey?"meta+":"").concat(tn.ctrlKey?"ctrl+":"").concat(tn.key.toUpperCase());en===nn&&(this.id&&document.getElementById(this.id).click(),tn.preventDefault())}))}}customElements.define("se-menu-item",SeMenuItem);const ga=document.createElement("template");ga.innerHTML='\n\n \n
\n
\n
\n \n
\n
\n\n';class SeList extends HTMLElement{constructor(){super(),_defineProperty$1(this,"toggleList",(en=>{this.isDropdownOpen?this.closeDropdown():(this.openDropdown(),this.setDropdownListPosition())})),_defineProperty$1(this,"updateSelectedValue",(en=>{Array.from(this.items).forEach((tn=>{if(tn.getAttribute("value")===en)if(tn.setAttribute("selected",!0),tn.hasAttribute("src")){for(;this.$selection.firstChild;)this.$selection.removeChild(this.$selection.firstChild);const en=document.createElement("img");en.src=this.imgPath+"/"+tn.getAttribute("src"),en.style.height=tn.getAttribute("img-height"),en.setAttribute("title",t$1(tn.getAttribute("title"))),this.$selection.append(en)}else this.$selection.textContent=t$1(tn.getAttribute("option"));else tn.setAttribute("selected",!1)}))})),_defineProperty$1(this,"openDropdown",(()=>{this.isDropdownOpen=!0,this.$optionsContainer.classList.remove("closed")})),_defineProperty$1(this,"closeDropdown",(()=>{this.isDropdownOpen=!1,this.$optionsContainer.classList.add("closed")})),_defineProperty$1(this,"setDropdownListPosition",(()=>{const en=window.innerHeight,tn=this.$selection.getBoundingClientRect(),nn=this.$optionsContainer.getBoundingClientRect();tn.bottom+nn.height>en?(this.$optionsContainer.style.top=tn.top-nn.height+"px",this.$optionsContainer.style.left=tn.left+"px"):(this.$optionsContainer.style.top=tn.bottom+"px",this.$optionsContainer.style.left=tn.left+"px")})),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(ga.content.cloneNode(!0)),this.$dropdown=this._shadowRoot.querySelector("#select-container"),this.$label=this._shadowRoot.querySelector("label"),this.$selection=this.$dropdown.querySelector("#selected-value"),this.items=this.querySelectorAll("se-list-item"),this.imgPath=svgEditor.configObj.curConfig.imgPath,this.$optionsContainer=this._shadowRoot.querySelector("#options-container"),this.$optionsContainer.classList.add("closed"),this.$selection.addEventListener("click",this.toggleList),this.updateSelectedValue(this.items[0].getAttribute("value")),this.isDropdownOpen=!1}static get observedAttributes(){return["label","width","height","title","value"]}attributeChangedCallback(en,tn,nn){if(tn!==nn)switch(en){case"title":this.$dropdown.setAttribute("title",t$1(nn));break;case"label":this.$label.textContent=t$1(nn);break;case"height":this.$dropdown.style.height=nn;break;case"width":this.$dropdown.style.width=nn;break;case"value":this.updateSelectedValue(nn);break;default:console.error("unknown attribute: ".concat(en))}}get title(){return this.getAttribute("title")}set title(en){this.setAttribute("title",en)}get label(){return this.getAttribute("label")}set label(en){this.setAttribute("label",en)}get width(){return this.getAttribute("width")}set width(en){this.setAttribute("width",en)}get height(){return this.getAttribute("height")}set height(en){this.setAttribute("height",en)}connectedCallback(){const en=this;this.$dropdown.addEventListener("selectedindexchange",(tn=>{var nn;if(void 0!==(null==tn||null===(nn=tn.detail)||void 0===nn?void 0:nn.selectedItem)){const nn=tn.detail.selectedItem,rn=new CustomEvent("change",{detail:{value:nn}});en.dispatchEvent(rn),en.value=nn,en.setAttribute("value",nn)}})),this.$dropdown.addEventListener("focusout",(en=>{this.closeDropdown()})),window.addEventListener("mousedown",(en=>{this.isDropdownOpen&&(en.target.closest("se-list")||(en.stopPropagation(),this.closeDropdown()))}),{capture:!0})}}customElements.define("se-list",SeList);const _a=document.createElement("template");_a.innerHTML='\n \n
\n icon\n \n
\n';class SeListItem extends HTMLElement{constructor(){super(),this._shadowRoot=this.attachShadow({mode:"open"}),this._shadowRoot.append(_a.content.cloneNode(!0)),this.$menuitem=this._shadowRoot.querySelector("[aria-label=option]"),this.$img=this._shadowRoot.querySelector("img"),this.$img.setAttribute("style","display: none;"),this.imgPath=svgEditor.configObj.curConfig.imgPath,this.$menuitem.addEventListener("mousedown",(en=>{this.$menuitem.dispatchEvent(new CustomEvent("selectedindexchange",{bubbles:!0,composed:!0,detail:{selectedItem:this.getAttribute("value")}}))}))}static get observedAttributes(){return["option","src","title","img-height","selected"]}attributeChangedCallback(en,tn,nn){if(tn!==nn)switch(en){case"option":this.$menuitem.setAttribute("option",nn),this.$menuitem.textContent=t$1(nn);break;case"src":this.$img.setAttribute("style","display: block;"),this.$img.setAttribute("src",this.imgPath+"/"+nn);break;case"title":this.$img.setAttribute("title",t$1(nn));break;case"img-height":this.$img.setAttribute("height",nn);break;case"selected":"true"===nn?this.$menuitem.classList.add("selected"):this.$menuitem.classList.remove("selected");break;default:console.error("unknown attribute: ".concat(en))}}get option(){return this.getAttribute("option")}set option(en){this.setAttribute("option",en)}get title(){return this.getAttribute("title")}set title(en){this.setAttribute("title",en)}get imgHeight(){return this.getAttribute("img-height")}set imgHeight(en){this.setAttribute("img-height",en)}get src(){return this.getAttribute("src")}set src(en){this.setAttribute("src",en)}}function _mergeNamespaces(en,tn){return tn.forEach((function(tn){tn&&"string"!=typeof tn&&!Array.isArray(tn)&&Object.keys(tn).forEach((function(nn){if("default"!==nn&&!(nn in en)){var rn=Object.getOwnPropertyDescriptor(tn,nn);Object.defineProperty(en,nn,rn.get?rn:{enumerable:!0,get:function(){return tn[nn]}})}}))})),Object.freeze(en)}customElements.define("se-list-item",SeListItem),"undefined"!=typeof window&&("SVGPathSeg"in window||(window.SVGPathSeg=function(en,tn,nn){this.pathSegType=en,this.pathSegTypeAsLetter=tn,this._owningPathSegList=nn},window.SVGPathSeg.prototype.classname="SVGPathSeg",window.SVGPathSeg.PATHSEG_UNKNOWN=0,window.SVGPathSeg.PATHSEG_CLOSEPATH=1,window.SVGPathSeg.PATHSEG_MOVETO_ABS=2,window.SVGPathSeg.PATHSEG_MOVETO_REL=3,window.SVGPathSeg.PATHSEG_LINETO_ABS=4,window.SVGPathSeg.PATHSEG_LINETO_REL=5,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS=6,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL=7,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS=8,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL=9,window.SVGPathSeg.PATHSEG_ARC_ABS=10,window.SVGPathSeg.PATHSEG_ARC_REL=11,window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS=12,window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL=13,window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS=14,window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL=15,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS=16,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL=17,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS=18,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL=19,window.SVGPathSeg.prototype._segmentChanged=function(){this._owningPathSegList&&this._owningPathSegList.segmentChanged(this)},window.SVGPathSegClosePath=function(en){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CLOSEPATH,"z",en)},window.SVGPathSegClosePath.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegClosePath.prototype.toString=function(){return"[object SVGPathSegClosePath]"},window.SVGPathSegClosePath.prototype._asPathString=function(){return this.pathSegTypeAsLetter},window.SVGPathSegClosePath.prototype.clone=function(){return new window.SVGPathSegClosePath(void 0)},window.SVGPathSegMovetoAbs=function(en,tn,nn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_MOVETO_ABS,"M",en),this._x=tn,this._y=nn},window.SVGPathSegMovetoAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegMovetoAbs.prototype.toString=function(){return"[object SVGPathSegMovetoAbs]"},window.SVGPathSegMovetoAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},window.SVGPathSegMovetoAbs.prototype.clone=function(){return new window.SVGPathSegMovetoAbs(void 0,this._x,this._y)},Object.defineProperty(window.SVGPathSegMovetoAbs.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegMovetoAbs.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegMovetoRel=function(en,tn,nn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_MOVETO_REL,"m",en),this._x=tn,this._y=nn},window.SVGPathSegMovetoRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegMovetoRel.prototype.toString=function(){return"[object SVGPathSegMovetoRel]"},window.SVGPathSegMovetoRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},window.SVGPathSegMovetoRel.prototype.clone=function(){return new window.SVGPathSegMovetoRel(void 0,this._x,this._y)},Object.defineProperty(window.SVGPathSegMovetoRel.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegMovetoRel.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegLinetoAbs=function(en,tn,nn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_LINETO_ABS,"L",en),this._x=tn,this._y=nn},window.SVGPathSegLinetoAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegLinetoAbs.prototype.toString=function(){return"[object SVGPathSegLinetoAbs]"},window.SVGPathSegLinetoAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},window.SVGPathSegLinetoAbs.prototype.clone=function(){return new window.SVGPathSegLinetoAbs(void 0,this._x,this._y)},Object.defineProperty(window.SVGPathSegLinetoAbs.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegLinetoAbs.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegLinetoRel=function(en,tn,nn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_LINETO_REL,"l",en),this._x=tn,this._y=nn},window.SVGPathSegLinetoRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegLinetoRel.prototype.toString=function(){return"[object SVGPathSegLinetoRel]"},window.SVGPathSegLinetoRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},window.SVGPathSegLinetoRel.prototype.clone=function(){return new window.SVGPathSegLinetoRel(void 0,this._x,this._y)},Object.defineProperty(window.SVGPathSegLinetoRel.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegLinetoRel.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoCubicAbs=function(en,tn,nn,rn,an,sn,cn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS,"C",en),this._x=tn,this._y=nn,this._x1=rn,this._y1=an,this._x2=sn,this._y2=cn},window.SVGPathSegCurvetoCubicAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoCubicAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicAbs]"},window.SVGPathSegCurvetoCubicAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y},window.SVGPathSegCurvetoCubicAbs.prototype.clone=function(){return new window.SVGPathSegCurvetoCubicAbs(void 0,this._x,this._y,this._x1,this._y1,this._x2,this._y2)},Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype,"x1",{get:function(){return this._x1},set:function(en){this._x1=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype,"y1",{get:function(){return this._y1},set:function(en){this._y1=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype,"x2",{get:function(){return this._x2},set:function(en){this._x2=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype,"y2",{get:function(){return this._y2},set:function(en){this._y2=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoCubicRel=function(en,tn,nn,rn,an,sn,cn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL,"c",en),this._x=tn,this._y=nn,this._x1=rn,this._y1=an,this._x2=sn,this._y2=cn},window.SVGPathSegCurvetoCubicRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoCubicRel.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicRel]"},window.SVGPathSegCurvetoCubicRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y},window.SVGPathSegCurvetoCubicRel.prototype.clone=function(){return new window.SVGPathSegCurvetoCubicRel(void 0,this._x,this._y,this._x1,this._y1,this._x2,this._y2)},Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype,"x1",{get:function(){return this._x1},set:function(en){this._x1=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype,"y1",{get:function(){return this._y1},set:function(en){this._y1=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype,"x2",{get:function(){return this._x2},set:function(en){this._x2=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype,"y2",{get:function(){return this._y2},set:function(en){this._y2=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoQuadraticAbs=function(en,tn,nn,rn,an){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS,"Q",en),this._x=tn,this._y=nn,this._x1=rn,this._y1=an},window.SVGPathSegCurvetoQuadraticAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoQuadraticAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticAbs]"},window.SVGPathSegCurvetoQuadraticAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y},window.SVGPathSegCurvetoQuadraticAbs.prototype.clone=function(){return new window.SVGPathSegCurvetoQuadraticAbs(void 0,this._x,this._y,this._x1,this._y1)},Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype,"x1",{get:function(){return this._x1},set:function(en){this._x1=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype,"y1",{get:function(){return this._y1},set:function(en){this._y1=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoQuadraticRel=function(en,tn,nn,rn,an){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL,"q",en),this._x=tn,this._y=nn,this._x1=rn,this._y1=an},window.SVGPathSegCurvetoQuadraticRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoQuadraticRel.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticRel]"},window.SVGPathSegCurvetoQuadraticRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y},window.SVGPathSegCurvetoQuadraticRel.prototype.clone=function(){return new window.SVGPathSegCurvetoQuadraticRel(void 0,this._x,this._y,this._x1,this._y1)},Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype,"x1",{get:function(){return this._x1},set:function(en){this._x1=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype,"y1",{get:function(){return this._y1},set:function(en){this._y1=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegArcAbs=function(en,tn,nn,rn,an,sn,cn,An){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_ARC_ABS,"A",en),this._x=tn,this._y=nn,this._r1=rn,this._r2=an,this._angle=sn,this._largeArcFlag=cn,this._sweepFlag=An},window.SVGPathSegArcAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegArcAbs.prototype.toString=function(){return"[object SVGPathSegArcAbs]"},window.SVGPathSegArcAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y},window.SVGPathSegArcAbs.prototype.clone=function(){return new window.SVGPathSegArcAbs(void 0,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)},Object.defineProperty(window.SVGPathSegArcAbs.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcAbs.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcAbs.prototype,"r1",{get:function(){return this._r1},set:function(en){this._r1=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcAbs.prototype,"r2",{get:function(){return this._r2},set:function(en){this._r2=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcAbs.prototype,"angle",{get:function(){return this._angle},set:function(en){this._angle=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcAbs.prototype,"largeArcFlag",{get:function(){return this._largeArcFlag},set:function(en){this._largeArcFlag=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcAbs.prototype,"sweepFlag",{get:function(){return this._sweepFlag},set:function(en){this._sweepFlag=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegArcRel=function(en,tn,nn,rn,an,sn,cn,An){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_ARC_REL,"a",en),this._x=tn,this._y=nn,this._r1=rn,this._r2=an,this._angle=sn,this._largeArcFlag=cn,this._sweepFlag=An},window.SVGPathSegArcRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegArcRel.prototype.toString=function(){return"[object SVGPathSegArcRel]"},window.SVGPathSegArcRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y},window.SVGPathSegArcRel.prototype.clone=function(){return new window.SVGPathSegArcRel(void 0,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)},Object.defineProperty(window.SVGPathSegArcRel.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcRel.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcRel.prototype,"r1",{get:function(){return this._r1},set:function(en){this._r1=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcRel.prototype,"r2",{get:function(){return this._r2},set:function(en){this._r2=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcRel.prototype,"angle",{get:function(){return this._angle},set:function(en){this._angle=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcRel.prototype,"largeArcFlag",{get:function(){return this._largeArcFlag},set:function(en){this._largeArcFlag=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegArcRel.prototype,"sweepFlag",{get:function(){return this._sweepFlag},set:function(en){this._sweepFlag=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegLinetoHorizontalAbs=function(en,tn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS,"H",en),this._x=tn},window.SVGPathSegLinetoHorizontalAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegLinetoHorizontalAbs.prototype.toString=function(){return"[object SVGPathSegLinetoHorizontalAbs]"},window.SVGPathSegLinetoHorizontalAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x},window.SVGPathSegLinetoHorizontalAbs.prototype.clone=function(){return new window.SVGPathSegLinetoHorizontalAbs(void 0,this._x)},Object.defineProperty(window.SVGPathSegLinetoHorizontalAbs.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegLinetoHorizontalRel=function(en,tn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL,"h",en),this._x=tn},window.SVGPathSegLinetoHorizontalRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegLinetoHorizontalRel.prototype.toString=function(){return"[object SVGPathSegLinetoHorizontalRel]"},window.SVGPathSegLinetoHorizontalRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x},window.SVGPathSegLinetoHorizontalRel.prototype.clone=function(){return new window.SVGPathSegLinetoHorizontalRel(void 0,this._x)},Object.defineProperty(window.SVGPathSegLinetoHorizontalRel.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegLinetoVerticalAbs=function(en,tn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS,"V",en),this._y=tn},window.SVGPathSegLinetoVerticalAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegLinetoVerticalAbs.prototype.toString=function(){return"[object SVGPathSegLinetoVerticalAbs]"},window.SVGPathSegLinetoVerticalAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._y},window.SVGPathSegLinetoVerticalAbs.prototype.clone=function(){return new window.SVGPathSegLinetoVerticalAbs(void 0,this._y)},Object.defineProperty(window.SVGPathSegLinetoVerticalAbs.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegLinetoVerticalRel=function(en,tn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL,"v",en),this._y=tn},window.SVGPathSegLinetoVerticalRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegLinetoVerticalRel.prototype.toString=function(){return"[object SVGPathSegLinetoVerticalRel]"},window.SVGPathSegLinetoVerticalRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._y},window.SVGPathSegLinetoVerticalRel.prototype.clone=function(){return new window.SVGPathSegLinetoVerticalRel(void 0,this._y)},Object.defineProperty(window.SVGPathSegLinetoVerticalRel.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoCubicSmoothAbs=function(en,tn,nn,rn,an){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,"S",en),this._x=tn,this._y=nn,this._x2=rn,this._y2=an},window.SVGPathSegCurvetoCubicSmoothAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoCubicSmoothAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicSmoothAbs]"},window.SVGPathSegCurvetoCubicSmoothAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y},window.SVGPathSegCurvetoCubicSmoothAbs.prototype.clone=function(){return new window.SVGPathSegCurvetoCubicSmoothAbs(void 0,this._x,this._y,this._x2,this._y2)},Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype,"x2",{get:function(){return this._x2},set:function(en){this._x2=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype,"y2",{get:function(){return this._y2},set:function(en){this._y2=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoCubicSmoothRel=function(en,tn,nn,rn,an){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL,"s",en),this._x=tn,this._y=nn,this._x2=rn,this._y2=an},window.SVGPathSegCurvetoCubicSmoothRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoCubicSmoothRel.prototype.toString=function(){return"[object SVGPathSegCurvetoCubicSmoothRel]"},window.SVGPathSegCurvetoCubicSmoothRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y},window.SVGPathSegCurvetoCubicSmoothRel.prototype.clone=function(){return new window.SVGPathSegCurvetoCubicSmoothRel(void 0,this._x,this._y,this._x2,this._y2)},Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype,"x2",{get:function(){return this._x2},set:function(en){this._x2=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype,"y2",{get:function(){return this._y2},set:function(en){this._y2=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoQuadraticSmoothAbs=function(en,tn,nn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS,"T",en),this._x=tn,this._y=nn},window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticSmoothAbs]"},window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype.clone=function(){return new window.SVGPathSegCurvetoQuadraticSmoothAbs(void 0,this._x,this._y)},Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),window.SVGPathSegCurvetoQuadraticSmoothRel=function(en,tn,nn){window.SVGPathSeg.call(this,window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,"t",en),this._x=tn,this._y=nn},window.SVGPathSegCurvetoQuadraticSmoothRel.prototype=Object.create(window.SVGPathSeg.prototype),window.SVGPathSegCurvetoQuadraticSmoothRel.prototype.toString=function(){return"[object SVGPathSegCurvetoQuadraticSmoothRel]"},window.SVGPathSegCurvetoQuadraticSmoothRel.prototype._asPathString=function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y},window.SVGPathSegCurvetoQuadraticSmoothRel.prototype.clone=function(){return new window.SVGPathSegCurvetoQuadraticSmoothRel(void 0,this._x,this._y)},Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothRel.prototype,"x",{get:function(){return this._x},set:function(en){this._x=en,this._segmentChanged()},enumerable:!0}),Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothRel.prototype,"y",{get:function(){return this._y},set:function(en){this._y=en,this._segmentChanged()},enumerable:!0}),window.SVGPathElement.prototype.createSVGPathSegClosePath=function(){return new window.SVGPathSegClosePath(void 0)},window.SVGPathElement.prototype.createSVGPathSegMovetoAbs=function(en,tn){return new window.SVGPathSegMovetoAbs(void 0,en,tn)},window.SVGPathElement.prototype.createSVGPathSegMovetoRel=function(en,tn){return new window.SVGPathSegMovetoRel(void 0,en,tn)},window.SVGPathElement.prototype.createSVGPathSegLinetoAbs=function(en,tn){return new window.SVGPathSegLinetoAbs(void 0,en,tn)},window.SVGPathElement.prototype.createSVGPathSegLinetoRel=function(en,tn){return new window.SVGPathSegLinetoRel(void 0,en,tn)},window.SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs=function(en,tn,nn,rn,an,sn){return new window.SVGPathSegCurvetoCubicAbs(void 0,en,tn,nn,rn,an,sn)},window.SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel=function(en,tn,nn,rn,an,sn){return new window.SVGPathSegCurvetoCubicRel(void 0,en,tn,nn,rn,an,sn)},window.SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs=function(en,tn,nn,rn){return new window.SVGPathSegCurvetoQuadraticAbs(void 0,en,tn,nn,rn)},window.SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticRel=function(en,tn,nn,rn){return new window.SVGPathSegCurvetoQuadraticRel(void 0,en,tn,nn,rn)},window.SVGPathElement.prototype.createSVGPathSegArcAbs=function(en,tn,nn,rn,an,sn,cn){return new window.SVGPathSegArcAbs(void 0,en,tn,nn,rn,an,sn,cn)},window.SVGPathElement.prototype.createSVGPathSegArcRel=function(en,tn,nn,rn,an,sn,cn){return new window.SVGPathSegArcRel(void 0,en,tn,nn,rn,an,sn,cn)},window.SVGPathElement.prototype.createSVGPathSegLinetoHorizontalAbs=function(en){return new window.SVGPathSegLinetoHorizontalAbs(void 0,en)},window.SVGPathElement.prototype.createSVGPathSegLinetoHorizontalRel=function(en){return new window.SVGPathSegLinetoHorizontalRel(void 0,en)},window.SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs=function(en){return new window.SVGPathSegLinetoVerticalAbs(void 0,en)},window.SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel=function(en){return new window.SVGPathSegLinetoVerticalRel(void 0,en)},window.SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs=function(en,tn,nn,rn){return new window.SVGPathSegCurvetoCubicSmoothAbs(void 0,en,tn,nn,rn)},window.SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel=function(en,tn,nn,rn){return new window.SVGPathSegCurvetoCubicSmoothRel(void 0,en,tn,nn,rn)},window.SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs=function(en,tn){return new window.SVGPathSegCurvetoQuadraticSmoothAbs(void 0,en,tn)},window.SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel=function(en,tn){return new window.SVGPathSegCurvetoQuadraticSmoothRel(void 0,en,tn)},"getPathSegAtLength"in window.SVGPathElement.prototype||(window.SVGPathElement.prototype.getPathSegAtLength=function(en){if(void 0===en||!isFinite(en))throw"Invalid arguments.";var tn=document.createElementNS("http://www.w3.org/2000/svg","path");tn.setAttribute("d",this.getAttribute("d"));var nn=tn.pathSegList.numberOfItems-1;if(nn<=0)return 0;do{if(tn.pathSegList.removeItem(nn),en>tn.getTotalLength())break;nn--}while(nn>0);return nn})),"SVGPathSegList"in window&&"appendItem"in window.SVGPathSegList.prototype||(window.SVGPathSegList=function(en){this._pathElement=en,this._list=this._parsePath(this._pathElement.getAttribute("d")),this._mutationObserverConfig={attributes:!0,attributeFilter:["d"]},this._pathElementMutationObserver=new MutationObserver(this._updateListFromPathMutations.bind(this)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)},window.SVGPathSegList.prototype.classname="SVGPathSegList",Object.defineProperty(window.SVGPathSegList.prototype,"numberOfItems",{get:function(){return this._checkPathSynchronizedToList(),this._list.length},enumerable:!0}),Object.defineProperty(window.SVGPathSegList.prototype,"length",{get:function(){return this._checkPathSynchronizedToList(),this._list.length},enumerable:!0}),Object.defineProperty(window.SVGPathElement.prototype,"pathSegList",{get:function(){return this._pathSegList||(this._pathSegList=new window.SVGPathSegList(this)),this._pathSegList},enumerable:!0}),Object.defineProperty(window.SVGPathElement.prototype,"normalizedPathSegList",{get:function(){return this.pathSegList},enumerable:!0}),Object.defineProperty(window.SVGPathElement.prototype,"animatedPathSegList",{get:function(){return this.pathSegList},enumerable:!0}),Object.defineProperty(window.SVGPathElement.prototype,"animatedNormalizedPathSegList",{get:function(){return this.pathSegList},enumerable:!0}),window.SVGPathSegList.prototype._checkPathSynchronizedToList=function(){this._updateListFromPathMutations(this._pathElementMutationObserver.takeRecords())},window.SVGPathSegList.prototype._updateListFromPathMutations=function(en){if(this._pathElement){var tn=!1;en.forEach((function(en){"d"==en.attributeName&&(tn=!0)})),tn&&(this._list=this._parsePath(this._pathElement.getAttribute("d")))}},window.SVGPathSegList.prototype._writeListToPath=function(){this._pathElementMutationObserver.disconnect(),this._pathElement.setAttribute("d",window.SVGPathSegList._pathSegArrayAsString(this._list)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)},window.SVGPathSegList.prototype.segmentChanged=function(en){this._writeListToPath()},window.SVGPathSegList.prototype.clear=function(){this._checkPathSynchronizedToList(),this._list.forEach((function(en){en._owningPathSegList=null})),this._list=[],this._writeListToPath()},window.SVGPathSegList.prototype.initialize=function(en){return this._checkPathSynchronizedToList(),this._list=[en],en._owningPathSegList=this,this._writeListToPath(),en},window.SVGPathSegList.prototype._checkValidIndex=function(en){if(isNaN(en)||en<0||en>=this.numberOfItems)throw"INDEX_SIZE_ERR"},window.SVGPathSegList.prototype.getItem=function(en){return this._checkPathSynchronizedToList(),this._checkValidIndex(en),this._list[en]},window.SVGPathSegList.prototype.insertItemBefore=function(en,tn){return this._checkPathSynchronizedToList(),tn>this.numberOfItems&&(tn=this.numberOfItems),en._owningPathSegList&&(en=en.clone()),this._list.splice(tn,0,en),en._owningPathSegList=this,this._writeListToPath(),en},window.SVGPathSegList.prototype.replaceItem=function(en,tn){return this._checkPathSynchronizedToList(),en._owningPathSegList&&(en=en.clone()),this._checkValidIndex(tn),this._list[tn]=en,en._owningPathSegList=this,this._writeListToPath(),en},window.SVGPathSegList.prototype.removeItem=function(en){this._checkPathSynchronizedToList(),this._checkValidIndex(en);var tn=this._list[en];return this._list.splice(en,1),this._writeListToPath(),tn},window.SVGPathSegList.prototype.appendItem=function(en){return this._checkPathSynchronizedToList(),en._owningPathSegList&&(en=en.clone()),this._list.push(en),en._owningPathSegList=this,this._writeListToPath(),en},window.SVGPathSegList._pathSegArrayAsString=function(en){var tn="",nn=!0;return en.forEach((function(en){nn?(nn=!1,tn+=en._asPathString()):tn+=" "+en._asPathString()})),tn},window.SVGPathSegList.prototype._parsePath=function(en){if(!en||0==en.length)return[];var tn=this,Builder=function(){this.pathSegList=[]};Builder.prototype.appendSegment=function(en){this.pathSegList.push(en)};var Source=function(en){this._string=en,this._currentIndex=0,this._endIndex=this._string.length,this._previousCommand=window.SVGPathSeg.PATHSEG_UNKNOWN,this._skipOptionalSpaces()};Source.prototype._isCurrentSpace=function(){var en=this._string[this._currentIndex];return en<=" "&&(" "==en||"\n"==en||"\t"==en||"\r"==en||"\f"==en)},Source.prototype._skipOptionalSpaces=function(){for(;this._currentIndex="0"&&en<="9")&&tn!=window.SVGPathSeg.PATHSEG_CLOSEPATH?tn==window.SVGPathSeg.PATHSEG_MOVETO_ABS?window.SVGPathSeg.PATHSEG_LINETO_ABS:tn==window.SVGPathSeg.PATHSEG_MOVETO_REL?window.SVGPathSeg.PATHSEG_LINETO_REL:tn:window.SVGPathSeg.PATHSEG_UNKNOWN},Source.prototype.initialCommandIsMoveTo=function(){if(!this.hasMoreData())return!0;var en=this.peekSegmentType();return en==window.SVGPathSeg.PATHSEG_MOVETO_ABS||en==window.SVGPathSeg.PATHSEG_MOVETO_REL},Source.prototype._parseNumber=function(){var en=0,tn=0,nn=1,rn=0,an=1,sn=1,cn=this._currentIndex;if(this._skipOptionalSpaces(),this._currentIndex"9")&&"."!=this._string.charAt(this._currentIndex))){for(var An=this._currentIndex;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)this._currentIndex++;if(this._currentIndex!=An)for(var dn=this._currentIndex-1,un=1;dn>=An;)tn+=un*(this._string.charAt(dn--)-"0"),un*=10;if(this._currentIndex=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)nn*=10,rn+=(this._string.charAt(this._currentIndex)-"0")/nn,this._currentIndex+=1}if(this._currentIndex!=cn&&this._currentIndex+1=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)en*=10,en+=this._string.charAt(this._currentIndex)-"0",this._currentIndex++}var pn=tn+rn;if(pn*=an,en&&(pn*=Math.pow(10,sn*en)),cn!=this._currentIndex)return this._skipOptionalSpacesOrDelimiter(),pn}},Source.prototype._parseArcFlag=function(){if(!(this._currentIndex>=this._endIndex)){var en=!1,tn=this._string.charAt(this._currentIndex++);if("0"==tn)en=!1;else{if("1"!=tn)return;en=!0}return this._skipOptionalSpacesOrDelimiter(),en}},Source.prototype.parseSegment=function(){var en=this._string[this._currentIndex],nn=this._pathSegTypeFromChar(en);if(nn==window.SVGPathSeg.PATHSEG_UNKNOWN){if(this._previousCommand==window.SVGPathSeg.PATHSEG_UNKNOWN)return null;if((nn=this._nextCommandHelper(en,this._previousCommand))==window.SVGPathSeg.PATHSEG_UNKNOWN)return null}else this._currentIndex++;switch(this._previousCommand=nn,nn){case window.SVGPathSeg.PATHSEG_MOVETO_REL:return new window.SVGPathSegMovetoRel(tn,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_MOVETO_ABS:return new window.SVGPathSegMovetoAbs(tn,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_REL:return new window.SVGPathSegLinetoRel(tn,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_ABS:return new window.SVGPathSegLinetoAbs(tn,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:return new window.SVGPathSegLinetoHorizontalRel(tn,this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:return new window.SVGPathSegLinetoHorizontalAbs(tn,this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:return new window.SVGPathSegLinetoVerticalRel(tn,this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:return new window.SVGPathSegLinetoVerticalAbs(tn,this._parseNumber());case window.SVGPathSeg.PATHSEG_CLOSEPATH:return this._skipOptionalSpaces(),new window.SVGPathSegClosePath(tn);case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:var rn={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new window.SVGPathSegCurvetoCubicRel(tn,rn.x,rn.y,rn.x1,rn.y1,rn.x2,rn.y2);case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:return rn={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoCubicAbs(tn,rn.x,rn.y,rn.x1,rn.y1,rn.x2,rn.y2);case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:return rn={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoCubicSmoothRel(tn,rn.x,rn.y,rn.x2,rn.y2);case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:return rn={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoCubicSmoothAbs(tn,rn.x,rn.y,rn.x2,rn.y2);case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:return rn={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoQuadraticRel(tn,rn.x,rn.y,rn.x1,rn.y1);case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:return rn={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoQuadraticAbs(tn,rn.x,rn.y,rn.x1,rn.y1);case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:return new window.SVGPathSegCurvetoQuadraticSmoothRel(tn,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:return new window.SVGPathSegCurvetoQuadraticSmoothAbs(tn,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_ARC_REL:return rn={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegArcRel(tn,rn.x,rn.y,rn.x1,rn.y1,rn.arcAngle,rn.arcLarge,rn.arcSweep);case window.SVGPathSeg.PATHSEG_ARC_ABS:return rn={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegArcAbs(tn,rn.x,rn.y,rn.x1,rn.y1,rn.arcAngle,rn.arcLarge,rn.arcSweep);default:throw"Unknown path seg type."}};var nn=new Builder,rn=new Source(en);if(!rn.initialCommandIsMoveTo())return[];for(;rn.hasMoreData();){var an=rn.parseSegment();if(!an)return[];nn.appendSegment(an)}return nn.pathSegList}));class Paint{constructor(en){const tn=en||{};if(this.alpha=isNaN(tn.alpha)?100:tn.alpha,tn.copy)switch(this.type=tn.copy.type,this.alpha=tn.copy.alpha,this.solidColor=null,this.linearGradient=null,this.radialGradient=null,this.type){case"none":break;case"solidColor":this.solidColor=tn.copy.solidColor;break;case"linearGradient":this.linearGradient=tn.copy.linearGradient.cloneNode(!0);break;case"radialGradient":this.radialGradient=tn.copy.radialGradient.cloneNode(!0)}else if(tn.linearGradient)if(this.type="linearGradient",this.solidColor=null,this.radialGradient=null,tn.linearGradient.hasAttribute("xlink:href")){const en=document.getElementById(tn.linearGradient.getAttribute("xlink:href").substr(1));this.linearGradient=en.cloneNode(!0)}else this.linearGradient=tn.linearGradient.cloneNode(!0);else if(tn.radialGradient)if(this.type="radialGradient",this.solidColor=null,this.linearGradient=null,tn.radialGradient.hasAttribute("xlink:href")){const en=document.getElementById(tn.radialGradient.getAttribute("xlink:href").substr(1));this.radialGradient=en.cloneNode(!0)}else this.radialGradient=tn.radialGradient.cloneNode(!0);else tn.solidColor?(this.type="solidColor",this.solidColor=tn.solidColor):(this.type="none",this.solidColor=null,this.linearGradient=null,this.radialGradient=null)}} /** * Tools for working with units. * @module units * @license MIT * * @copyright 2010 Alexis Deveria, 2010 Jeff Schiller */const ma="http://www.w3.org/2000/svg",fa=["x","x1","cx","rx","width"],ya=["y","y1","cy","ry","height"],ba=["r","radius",...fa,...ya];let va,wa={};const getTypeMap$2=()=>wa,shortFloat=en=>{const tn=va.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||va.getBaseUnit(),shortFloat(en/wa[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=va.getWidth(),an=va.getHeight();return fa.includes(en)?nn*rn:ya.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)*wa[nn]},xa={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(xa).forEach((tn=>{let[nn,rn]=tn;en[rn]=nn.toLowerCase()})),en},ka=document.createElementNS(xa.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;nntn.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 ka.createSVGTransformFromMatrix(ka.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=ka.createSVGMatrix();for(let an=tn;an<=nn;++an){const tn=an>=0&&an{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.xen.x&&tn.yen.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)return en}return null}function getParents(en,tn){const nn=[],rn=null==tn?void 0:tn.charAt(0);for(;en&&en!==document;en=en.parentNode)tn?("."===rn&&en.classList.contains(tn.substr(1))&&nn.push(en),"#"===rn&&en.id===tn.substr(1)&&nn.push(en),"["===rn&&en.hasAttribute(tn.substr(1,tn.length-1))&&nn.push(en),en.tagName.toLowerCase()===tn&&nn.push(en)):nn.push(en);return nn.length?nn:null} /** * Miscellaneous utilities. * @module utilities * @license MIT * * @copyright 2010 Alexis Deveria, 2010 Jeff Schiller */const Ca="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use,clipPath".split(",");let Sa=null,Ba=null;const toXml=en=>en.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'");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):"",Ea=(()=>{if("undefined"==typeof Blob)return"";const en=new Blob(["SVG-edit "],{type:"text/html"});return createObjectURL(en)})(),text2xml=en=>{let tn,nn;en.includes("{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(xa.XLINK,"href")},setHref=function(en,tn){en.setAttributeNS(xa.XLINK,"xlink:href",tn)};const findDefs=function(){const en=Sa.getSvgContent();let tn=en.getElementsByTagNameNS(xa.SVG,"defs");return tn.length>0?tn=tn[0]:(tn=en.ownerDocument.createElementNS(xa.SVG,"defs"),en.firstChild?en.insertBefore(tn,en.firstChild.nextSibling):en.append(tn)),tn},getBBox=function(en){const tn=en||Sa.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(Ca.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-.001&&nn<.001||nn<-89.99||nn>89.99)}(sn,cn))if(["ellipse","path","line","polyline","polygon"].includes(en.tagName))An=getBBoxOfElementAsPath(en,tn,nn),rn=An;else if("rect"===en.tagName){const an=Number(en.getAttribute("rx")),sn=Number(en.getAttribute("ry"));(an||sn)&&(An=getBBoxOfElementAsPath(en,tn,nn),rn=An)}if(!An){const{matrix:en}=transformListToTransform(an);rn=transformBox(rn.x,rn.y,rn.width,rn.height,en).aabox}}return rn},getStrokeOffsetForBBox=en=>{const tn=en.getAttribute("stroke-width");return isNaN(tn)||"none"===en.getAttribute("stroke")?0:tn/2},getStrokedBBox=(en,tn,nn)=>{if(!en||!en.length)return!1;let rn;if(en.forEach((en=>{rn||en.parentNode&&(rn=getBBoxWithTransform(en,tn,nn))})),!rn)return null;let an=rn.x+rn.width,sn=rn.y+rn.height,cn=rn.x,An=rn.y;if(1===en.length){const tn=getStrokeOffsetForBBox(en[0]);cn-=tn,An-=tn,an+=tn,sn+=tn}else en.forEach((en=>{const rn=getBBoxWithTransform(en,tn,nn);if(rn){const tn=getStrokeOffsetForBBox(en);cn=Math.min(cn,rn.x-tn),An=Math.min(An,rn.y-tn),1===en.nodeType&&(an=Math.max(an,rn.x+rn.width+tn),sn=Math.max(sn,rn.y+rn.height+tn))}}));return rn.x=cn,rn.y=An,rn.width=an-cn,rn.height=sn-An,rn},getVisibleElements=en=>{en||(en=Sa.getSvgContent().children[0]);const tn=[],nn=en.children;return Array.from(nn,(en=>{en.getBBox&&tn.push(en)})),tn.reverse()},getStrokedBBoxDefaultVisible=en=>(en||(en=getVisibleElements()),getStrokedBBox(en,Sa.addSVGElementsFromJson,Sa.pathActions)),getRotationAngleFromTransformList=(en,tn)=>{if(!en)return 0;for(let nn=0;nn{var nn;const rn=null===(nn=(en||Sa.getSelectedElements()[0]).transform)||void 0===nn?void 0:nn.baseVal;return getRotationAngleFromTransformList(rn,tn)};const getRefElem=en=>getElement(getUrlFromAttr(en).substr(1)),getFeGaussianBlur=en=>{var tn;if("feGaussianBlur"===(null==en||null===(tn=en.firstChild)||void 0===tn?void 0:tn.tagName))return en.firstChild;{const tn=en.children;for(const[en,nn]of Object.entries(tn))if("feGaussianBlur"===nn.tagName)return nn}return null},getElement=en=>Ba.querySelector("#"+en),assignAttributes=(en,tn,nn,rn)=>{for(const[nn,an]of Object.entries(tn)){const tn="xml:"===nn.substr(0,4)?xa.XML:"xlink:"===nn.substr(0,6)?xa.XLINK:null;void 0!==an?tn?en.setAttributeNS(tn,nn,an):rn?setUnitAttr(en,nn,an):en.setAttribute(nn,an):tn?en.removeAttributeNS(tn,nn):en.removeAttribute(nn)}},cleanupElement=en=>{const tn={"fill-opacity":1,"stop-opacity":1,opacity:1,stroke:"none","stroke-dasharray":"none","stroke-linejoin":"miter","stroke-linecap":"butt","stroke-opacity":1,"stroke-width":1,rx:0,ry:0};"ellipse"===en.nodeName&&(delete tn.rx,delete tn.ry),Object.entries(tn).forEach((tn=>{let[nn,rn]=tn;en.getAttribute(nn)===String(rn)&&en.removeAttribute(nn)}))},snapToGrid=en=>{const tn=Sa.getBaseUnit();let nn=Sa.getSnappingStep();return"px"!==tn&&(nn*=getTypeMap$2()[tn]),Math.round(en/nn)*nn},preventClickDefault=en=>{$click$6(en,(en=>{en.preventDefault()}))},stringToHTML=en=>(new DOMParser).parseFromString(en,"text/html").body.firstChild,insertChildAtIndex=function(en,tn){let nn=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const rn=stringToHTML(tn);nn>=en.children.length?en.appendChild(rn):en.insertBefore(rn,en.children[nn])},$id$8=en=>document.getElementById(en),$qq$1=en=>document.querySelector(en),$qa$2=en=>[...document.querySelectorAll(en)],$click$6=(en,tn)=>{en.addEventListener("click",tn),en.addEventListener("touchend",tn)},ja={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"};class Command{getText(){return this.text}apply(en,tn){en&&en.handleHistoryEvent(ja.BEFORE_APPLY,this),tn(en),en&&en.handleHistoryEvent(ja.AFTER_APPLY,this)}unapply(en,tn){en&&en.handleHistoryEvent(ja.BEFORE_UNAPPLY,this),tn(),en&&en.handleHistoryEvent(ja.AFTER_UNAPPLY,this)}elements(){return[this.elem]}type(){return this.constructor.name}}class MoveElementCommand$1 extends Command{constructor(en,tn,nn,rn){super(),this.elem=en,this.text=rn?"Move "+en.tagName+" to "+rn:"Move "+en.tagName,this.oldNextSibling=tn,this.oldParent=nn,this.newNextSibling=en.nextSibling,this.newParent=en.parentNode}apply(en){super.apply(en,(()=>{this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling)}))}unapply(en){super.unapply(en,(()=>{this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling)}))}}class InsertElementCommand$4 extends Command{constructor(en,tn){super(),this.elem=en,this.text=tn||"Create "+en.tagName,this.parent=en.parentNode,this.nextSibling=this.elem.nextSibling}apply(en){super.apply(en,(()=>{this.elem=this.parent.insertBefore(this.elem,this.nextSibling)}))}unapply(en){super.unapply(en,(()=>{this.parent=this.elem.parentNode,this.elem.remove()}))}}class RemoveElementCommand$2 extends Command{constructor(en,tn,nn,rn){super(),this.elem=en,this.text=rn||"Delete "+en.tagName,this.nextSibling=tn,this.parent=nn}apply(en){super.apply(en,(()=>{this.parent=this.elem.parentNode,this.elem.remove()}))}unapply(en){super.unapply(en,(()=>{this.nextSibling||console.error("Reference element was lost"),this.parent.insertBefore(this.elem,this.nextSibling)}))}}class ChangeElementCommand$2 extends Command{constructor(en,tn,nn){super(),this.elem=en,this.text=nn?"Change "+en.tagName+" "+nn:"Change "+en.tagName,this.newValues={},this.oldValues=tn;for(const nn in tn)this.newValues[nn]="#text"===nn?en?en.textContent:"":"#href"===nn?getHref(en):en.getAttribute(nn)}apply(en){super.apply(en,(()=>{let en=!1;if(Object.entries(this.newValues).forEach((tn=>{let[nn,rn]=tn;rn?"#text"===nn?this.elem.textContent=rn:"#href"===nn?setHref(this.elem,rn):this.elem.setAttribute(nn,rn):"#text"===nn?this.elem.textContent="":(this.elem.setAttribute(nn,""),this.elem.removeAttribute(nn)),"transform"===nn&&(en=!0)})),!en){const en=getRotationAngle(this.elem);if(en){const tn=getBBox(this.elem),nn=["rotate(",en," ",tn.x+tn.width/2,",",tn.y+tn.height/2,")"].join("");nn!==this.elem.getAttribute("transform")&&this.elem.setAttribute("transform",nn)}}}))}unapply(en){super.unapply(en,(()=>{let en=!1;if(Object.entries(this.oldValues).forEach((tn=>{let[nn,rn]=tn;rn?"#text"===nn?this.elem.textContent=rn:"#href"===nn?setHref(this.elem,rn):this.elem.setAttribute(nn,rn):"#text"===nn?this.elem.textContent="":this.elem.removeAttribute(nn),"transform"===nn&&(en=!0)})),!en){const en=getRotationAngle(this.elem);if(en){const tn=getBBox(this.elem),nn=["rotate(",en," ",tn.x+tn.width/2,",",tn.y+tn.height/2,")"].join("");nn!==this.elem.getAttribute("transform")&&this.elem.setAttribute("transform",nn)}}}))}}class BatchCommand$4 extends Command{constructor(en){super(),this.text=en||"Batch Command",this.stack=[]}apply(en){super.apply(en,(()=>{this.stack.forEach((tn=>{console.assert(tn,"stack item should not be null"),tn&&tn.apply(en)}))}))}unapply(en){super.unapply(en,(()=>{this.stack.reverse().forEach((tn=>{console.assert(tn,"stack item should not be null"),tn&&tn.unapply(en)}))}))}elements(){const en=[];let tn=this.stack.length;for(;tn--;){if(!this.stack[tn])continue;const nn=this.stack[tn].elements();let rn=nn.length;for(;rn--;)en.includes(nn[rn])||en.push(nn[rn])}return en}addSubCommand(en){console.assert(null!==en,"cmd should not be null"),this.stack.push(en)}isEmpty(){return!this.stack.length}}var La=Object.freeze({__proto__:null,HistoryEventTypes:ja,Command:Command,MoveElementCommand:MoveElementCommand$1,InsertElementCommand:InsertElementCommand$4,RemoveElementCommand:RemoveElementCommand$2,ChangeElementCommand:ChangeElementCommand$2,BatchCommand:BatchCommand$4,UndoManager:class UndoManager$1{constructor(en){this.handler_=en||null,this.undoStackPointer=0,this.undoStack=[],this.undoChangeStackPointer=-1,this.undoableChangeStack=[]}resetUndoStack(){this.undoStack=[],this.undoStackPointer=0}getUndoStackSize(){return this.undoStackPointer}getRedoStackSize(){return this.undoStack.length-this.undoStackPointer}getNextUndoCommandText(){return this.undoStackPointer>0?this.undoStack[this.undoStackPointer-1].getText():""}getNextRedoCommandText(){return this.undoStackPointer0&&this.undoStack[--this.undoStackPointer].unapply(this.handler_)}redo(){this.undoStackPointer0&&this.undoStack[this.undoStackPointer++].apply(this.handler_)}addCommandToHistory(en){this.undoStackPointer0&&(this.undoStack=this.undoStack.splice(0,this.undoStackPointer)),this.undoStack.push(en),this.undoStackPointer=this.undoStack.length}beginUndoableChange(en,tn){const nn=++this.undoChangeStackPointer;let rn=tn.length;const an=new Array(rn),sn=new Array(rn);for(;rn--;){const nn=tn[rn];nn&&(sn[rn]=nn,an[rn]=nn.getAttribute(en))}this.undoableChangeStack[nn]={attrName:en,oldValues:an,elements:sn}}finishUndoableChange(){const en=this.undoChangeStackPointer--,tn=this.undoableChangeStack[en],{attrName:nn}=tn,rn=new BatchCommand$4("Change "+nn);let an=tn.elements.length;for(;an--;){const en=tn.elements[an];if(!en)continue;const sn={};sn[nn]=tn.oldValues[an],sn[nn]!==en.getAttribute(nn)&&rn.addSubCommand(new ChangeElementCommand$2(en,sn,nn))}return this.undoableChangeStack[en]=null,rn}}}); /** * Path functionality. * @module path * @license MIT * * @copyright 2011 Alexis Deveria, 2011 Jeff Schiller */let Pa=null;const ptObjToArrMethod=function(en,tn){return Pa.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=Pa.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=Pa.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(xa.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(xa.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=Pa.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=Pa.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(xa.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=Pa.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(xa.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=[Pa.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=Pa.getPathObj(),sn=rn||an.elem,cn=sn["createSVGPathSeg"+Pa.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(xa.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 element");this.elem=en,this.segs=[],this.selected_pts=[],Pa.setPathObj(this),this.init()}setPathContext(){Pa.setPathObj(this)}init(){const en=getGripContainerMethod().querySelectorAll("*");Array.prototype.forEach.call(en,(function(en){en.setAttribute("display","none")}));const tn=this.elem.pathSegList,nn=tn.numberOfItems;this.segs=[],this.selected_pts=[],this.first_seg=null;for(let en=0;en=nn?null:rn[en+1],cn=en-1<0?null:rn[en-1];if(2===tn.type){if(cn&&1!==cn.type){const en=rn[an];en.next=rn[an+1],en.next.prev=en,en.addGrip()}an=en}else if(1===(null==sn?void 0:sn.type))tn.next=rn[an+1],tn.next.prev=tn,tn.mate=rn[an],tn.addGrip(),this.first_seg||(this.first_seg=tn);else if(sn)1!==tn.type&&(tn.addGrip(),sn&&2!==sn.type&&(tn.next=sn,tn.next.prev=tn));else if(1!==tn.type){const en=rn[an];en.next=rn[an+1],en.next.prev=en,en.addGrip(),tn.addGrip(),this.first_seg||(this.first_seg=rn[an])}}return this}eachSeg(en){const tn=this.segs.length;for(let nn=0;nn{this.segs[en].ptgrip&&!this.selected_pts.includes(en)&&en>=0&&this.selected_pts.push(en)})),this.selected_pts.sort();let tn=this.selected_pts.length;const nn=[];for(nn.length=tn;tn--;){const en=this.selected_pts[tn],rn=this.segs[en];rn.select(!0),nn[tn]=rn.ptgrip}const rn=Path$1.subpathIsClosed(this.selected_pts[0]);Pa.addPtsToSelection({grips:nn,closedSubpath:rn})}static subpathIsClosed(en){let tn=!1;return Pa.getPathObj().eachSeg((function(nn){return nn<=en||2!==this.type&&(1!==this.type||(tn=!0,!1))})),tn}} /** * Path functionality. * @module path * @license MIT * * @copyright 2011 Alexis Deveria, 2011 Jeff Schiller */let Ta=null,Fa=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=nn-an&&un<=nn+an&&pn>=cn-an&&pn<=cn+an){sn=!0;break}}cn=Ta.getId(),Ta.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(),Ta.setDrawnPath(null),Ta.setStarted(!1),nn){Fa.matrix&&Ta.remapElement(An,{},Fa.matrix.inverse());const en=An.getAttribute("d"),tn=Fa.elem.getAttribute("d");return Fa.elem.setAttribute("d",tn+en),An.parentNode.removeChild(An),Fa.matrix&&Ta.recalcRotatedPath(),Ua.toEditMode(Fa.elem),Fa.selectPt(),!1}}else{if(Ta.getContainer()===Ta.getMouseTarget(tn)||!Ta.getContainer().contains(Ta.getMouseTarget(tn)))return!1;const en=mn.pathSegList.numberOfItems,rn=mn.pathSegList.getItem(en-1),an=rn.x,sn=rn.y;if(tn.shiftKey){const en=snapToAngle(an,sn,un,pn);({x:un,y:pn}=en)}yn=hn.pathSegList.getItem(1),fn=4===yn.pathSegType?mn.createSVGPathSegLinetoAbs(Ta.round(un),Ta.round(pn)):mn.createSVGPathSegCurvetoCubicAbs(Ta.round(un),Ta.round(pn),yn.x1/dn,yn.y1/dn,yn.x2/dn,yn.y2/dn),mn.pathSegList.appendItem(fn),un*=dn,pn*=dn,hn.setAttribute("d",["M",un,pn,un,pn].join(" ")),gn=en,nn&&(gn+=Fa.segs.length),Ta.addPointGrip(gn,un,pn)}}else{const en="M"+un+","+pn+" ";Ta.setDrawnPath(Ta.addSVGElementsFromJson({element:"path",curStyles:!0,attr:{d:en,id:Ta.getNextId(),opacity:Ta.getOpacity()/2}})),hn.setAttribute("d",["M",rn,An,rn,An].join(" ")),gn=nn?Fa.segs.length:0,Ta.addPointGrip(gn,rn,An)}}},mouseMove(nn,rn){const sn=Ta.getZoom();an=!0;const cn=Ta.getDrawnPath();if("path"!==Ta.getCurrentMode())if(Fa.dragging){const en=Ta.getPointFromGrip({x:Fa.dragging[0],y:Fa.dragging[1]},Fa),tn=Ta.getPointFromGrip({x:nn,y:rn},Fa),an=tn.x-en.x,sn=tn.y-en.y;Fa.dragging=[nn,rn],Fa.dragctrl?Fa.moveCtrl(an,sn):Fa.movePts(an,sn)}else Fa.selected_pts=[],Fa.eachSeg((function(en){const tn=this;if(!tn.next&&!tn.prev)return;const nn=Ta.getRubberBox(),rn=getBBox(nn),an=Ta.getGripPt(tn),sn={x:an.x,y:an.y,width:0,height:0},cn=rectsIntersect(rn,sn);this.select(cn),cn&&Fa.selected_pts.push(tn.index)}));else{if(!cn)return;const an=cn.pathSegList,An=an.numberOfItems-1;if(en){const dn=Ta.addCtrlGrip("1c1"),un=Ta.addCtrlGrip("0c2");dn.setAttribute("cx",nn),dn.setAttribute("cy",rn),dn.setAttribute("display","inline");const pn=en[0],hn=en[1],gn=pn+(pn-nn/sn),_n=hn+(hn-rn/sn);un.setAttribute("cx",gn*sn),un.setAttribute("cy",_n*sn),un.setAttribute("display","inline");const mn=Ta.getCtrlLine(1);if(assignAttributes(mn,{x1:nn,y1:rn,x2:gn*sn,y2:_n*sn,display:"inline"}),0===An)tn=[nn,rn];else{const en=an.getItem(An-1);let nn=en.x,rn=en.y;6===en.pathSegType?(nn+=nn-en.x2,rn+=rn-en.y2):tn&&(nn=tn[0]/sn,rn=tn[1]/sn),Ta.replacePathSeg(6,An,[pn,hn,nn,rn,gn,_n],cn)}}else{const en=getElement("path_stretch_line");if(en){const cn=an.getItem(An);if(6===cn.pathSegType){const tn=cn.x+(cn.x-cn.x2),an=cn.y+(cn.y-cn.y2);Ta.replacePathSeg(6,1,[nn,rn,tn*sn,an*sn,nn,rn],en)}else tn?Ta.replacePathSeg(6,1,[nn,rn,tn[0],tn[1],nn,rn],en):Ta.replacePathSeg(4,1,[nn,rn],en)}}}},mouseUp(nn,rn,sn,cn){const An=Ta.getDrawnPath();if("path"===Ta.getCurrentMode())return en=null,An||(rn=getElement(Ta.getId()),Ta.setStarted(!1),tn=null),{keep:!0,element:rn};const dn=Ta.getRubberBox();if(Fa.dragging){const en=Fa.cur_pt;Fa.dragging=!1,Fa.dragctrl=!1,Fa.update(),an&&Fa.endChanges("Move path point(s)"),nn.shiftKey||an||Fa.selectPt(en)}else"none"!==(null==dn?void 0:dn.getAttribute("display"))?(dn.setAttribute("display","none"),dn.getAttribute("width")<=2&&dn.getAttribute("height")<=2&&Ua.toSelectMode(nn.target)):Ua.toSelectMode(nn.target);an=!1},toEditMode(en){Fa=Ta.getPath_(en),Ta.setCurrentMode("pathedit"),Ta.clearSelection(),Fa.setPathContext(),Fa.show(!0).update(),Fa.oldbbox=getBBox(Fa.elem),nn=!1},toSelectMode(en){const tn=en===Fa.elem;Ta.setCurrentMode("select"),Fa.setPathContext(),Fa.show(!1),rn=!1,Ta.clearSelection(),Fa.matrix&&Ta.recalcRotatedPath(),tn&&(Ta.call("selected",[en]),Ta.addToSelection([en],!0))},addSubPath(en){en?(Ta.setCurrentMode("path"),nn=!0):(Ua.clear(!0),Ua.toEditMode(Fa.elem))},select(en){rn===en?(Ua.toEditMode(en),Ta.setCurrentMode("pathedit")):rn=en},reorient(){const en=Ta.getSelectedElements()[0];if(!en)return;if(0===getRotationAngle(en))return;const tn=new BatchCommand$4("Reorient path"),nn={d:en.getAttribute("d"),transform:en.getAttribute("transform")};tn.addSubCommand(new ChangeElementCommand$2(en,nn)),Ta.clearSelection(),this.resetOrientation(en),Ta.addCommandToHistory(tn),Ta.getPath_(en).show(!1).matrix=null,this.clear(),Ta.addToSelection([en],!0),Ta.call("changed",Ta.getSelectedElements())},clear(){const en=Ta.getDrawnPath();if(rn=null,en){const en=getElement(Ta.getId()),nn=getElement("path_stretch_line");nn.parentNode.removeChild(nn),en.parentNode.removeChild(en);const rn=getElement("pathpointgrip_container").querySelectorAll("*");Array.prototype.forEach.call(rn,(function(en){en.setAttribute("display","none")})),tn=null,Ta.setDrawnPath(null),Ta.setStarted(!1)}else"pathedit"===Ta.getCurrentMode()&&this.toSelectMode();Fa&&Fa.init().show(!1)},resetOrientation(en){if("path"!==(null==en?void 0:en.nodeName))return!1;const tn=en.transform.baseVal,nn=transformListToTransform(tn).matrix;tn.clear(),en.removeAttribute("transform");const rn=en.pathSegList,an=rn.numberOfItems;for(let tn=0;tn0){const nn=en.getItem(tn-1).pathSegType;if(2===nn){remItems(tn-1,1),cleanup();break}if(1===nn&&en.numberOfItems-1===tn){remItems(tn,1),cleanup();break}}}return!1};if(cleanup(),Fa.elem.pathSegList.numberOfItems<=1)return Ua.toSelectMode(Fa.elem),void Ta.canvas.deleteSelectedElements();Fa.init(),Fa.clearSelection(),window.opera&&Fa.elem.setAttribute("d",Fa.elem.getAttribute("d")),Fa.endChanges("Delete path node(s)")},smoothPolylineIntoPath:function(en){let tn;const{points:nn}=en,rn=nn.numberOfItems;if(rn>=4){let an=nn.getItem(0),sn=null,cn=[];for(cn.push(["M",an.x,",",an.y," C"].join("")),tn=1;tn<=rn-4;tn+=3){let en=nn.getItem(tn);const rn=nn.getItem(tn+1),An=nn.getItem(tn+2);if(sn){const tn=Ta.smoothControlPoints(sn,en,an);if(2===(null==tn?void 0:tn.length)){const nn=cn[cn.length-1].split(",");nn[2]=tn[0].x,nn[3]=tn[0].y,cn[cn.length-1]=nn.join(","),en=tn[1]}}cn.push([en.x,en.y,rn.x,rn.y,An.x,An.y].join(",")),an=An,sn=rn}for(cn.push("L");tn{Object.assign(Ma,en.ui)};let Ra=[],Oa=!0,Qa={};const setLinkControlPoints=en=>{Oa=en};let qa=null;const init$g=en=>{Ia=en,Ia.replacePathSeg=replacePathSegMethod,Ia.addPointGrip=addPointGripMethod,Ia.removePath_=removePath_,Ia.getPath_=getPath_,Ia.addCtrlGrip=addCtrlGripMethod,Ia.getCtrlLine=getCtrlLineMethod,Ia.getGripPt=Ga,Ia.getPointFromGrip=getPointFromGripMethod,Ia.setLinkControlPoints=setLinkControlPoints,Ia.reorientGrads=reorientGrads,Ia.getSegData=()=>Na,Ia.getUIStrings=()=>Ma,Ia.getPathObj=()=>qa,Ia.setPathObj=en=>{qa=en},Ia.getPathFuncs=()=>Ra,Ia.getLinkControlPts=()=>Oa,Ra=[0,"ClosePath"],["Moveto","Lineto","CurvetoCubic","CurvetoQuadratic","Arc","LinetoHorizontal","LinetoVertical","CurvetoCubicSmooth","CurvetoQuadraticSmooth"].forEach((en=>{Ra.push(en+"Abs"),Ra.push(en+"Rel")})),Ta=Ia,Pa=Ia},Va=ptObjToArrMethod,Ga=getGripPtMethod,Da=getPointFromGripMethod,Ha=addPointGripMethod,za=getGripContainerMethod,Ka=addCtrlGripMethod,$a=getCtrlLineMethod,Wa=getPointGripMethod,Xa=getControlPointsMethod,Ya=replacePathSegMethod,Za=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=Ia.getSvgRoot().createSVGPoint(),dn=Ia.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{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 Ja,es,ts,ns,rs;const getRotVals=(en,tn)=>{let nn=en-ts,rn=tn-ns,an=Math.sqrt(nn*nn+rn*rn),sn=Math.atan2(rn,nn)+rs;return nn=an*Math.cos(sn)+ts,rn=an*Math.sin(sn)+ns,nn-=Ja,rn-=es,an=Math.sqrt(nn*nn+rn*rn),sn=Math.atan2(rn,nn)-rs,{x:an*Math.cos(sn)+Ja,y:an*Math.sin(sn)+es}},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=Ia.getNextId(),findDefs().append(gn),en.setAttribute(an,"url(#"+gn.id+")")}}}},os=[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},is=Ua;var as=Object.freeze({__proto__:null,setUiStrings:setUiStrings,setLinkControlPoints:setLinkControlPoints,get path(){return qa},init:init$g,ptObjToArr:Va,getGripPt:Ga,getPointFromGrip:Da,addPointGrip:Ha,getGripContainer:za,addCtrlGrip:Ka,getCtrlLine:$a,getPointGrip:Wa,getControlPoints:Xa,replacePathSeg:Ya,getSegSelector:Za,smoothControlPoints:smoothControlPoints,getPath_:getPath_,removePath_:removePath_,recalcRotatedPath:()=>{const en=qa.elem;if(rs=getRotationAngle(en,!0),!rs)return;const tn=qa.oldbbox;ts=tn.x+tn.width/2,ns=tn.y+tn.height/2;const nn=getBBox(en);Ja=nn.x+nn.width/2,es=nn.y+nn.height/2;const rn=Ja-ts,an=es-ns,sn=Math.sqrt(rn*rn+an*an),cn=Math.atan2(an,rn)+rs;Ja=sn*Math.cos(cn)+ts,es=sn*Math.sin(cn)+ns;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&&en.x2){const tn=getRotVals(en.x1,en.y1),nn=getRotVals(en.x2,en.y2);rn.splice(rn.length,0,tn.x,tn.y,nn.x,nn.y)}Ya(tn,dn,rn)}getBBox(en);const un=Ia.getSvgRoot().createSVGTransform(),pn=en.transform.baseVal;un.setRotate(180*rs/Math.PI,Ja,es),pn.replaceItem(un,0)},clearData:clearData,reorientGrads:reorientGrads,convertPath:(en,tn)=>{const{pathSegList:nn}=en,rn=nn.numberOfItems;let an=0,sn=0,cn="",An=null;for(let en=0;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{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},ss="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 ls=0,cs=[];function historyRecordingService(en){return en||new HistoryRecordingService(As.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!==xa.SVG)throw new Error("Error: svgedit.draw.Drawing instance initialized without a 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(xa.SE,"nonce");nn&&2!==ls?this.nonce_=nn:1===ls&&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(xa.XMLNS,"xmlns:se",xa.SE),this.svgElem_.setAttributeNS(xa.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=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?en0){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}identifyLayers(){this.all_layers=[],this.layer_map={};const en=this.svgElem_.childNodes.length,tn=[],nn=[];let rn=null,an=!1;for(let sn=0;sn0||!an?(rn=new Layer(getNewLayerName(nn),null,this.svgElem_),rn.appendChildren(tn),this.all_layers.push(rn),this.layer_map[name]=rn):rn.activate(),this.current_layer=rn}createLayer(en,tn){this.current_layer&&this.current_layer.deactivate(),(null==en||""===en||this.layer_map[en])&&(en=getNewLayerName(Object.keys(this.layer_map)));const nn=new Layer(en,null,this.svgElem_);return tn&&(tn.startBatchCommand("Create Layer"),tn.insertElement(nn.getGroup()),tn.endBatchCommand()),this.all_layers.push(nn),this.layer_map[en]=nn,this.current_layer=nn,nn.getGroup()}cloneLayer(en,tn){if(!this.current_layer)return null;this.current_layer.deactivate(),(null==en||""===en||this.layer_map[en])&&(en=getNewLayerName(Object.keys(this.layer_map)));const nn=this.current_layer.getGroup(),rn=new Layer(en,nn,this.svgElem_),an=rn.getGroup();[...nn.childNodes].forEach((en=>{"title"!==en.localName&&an.append(this.copyElem(en))})),tn&&(tn.startBatchCommand("Duplicate Layer"),tn.insertElement(an),tn.endBatchCommand());const sn=this.indexCurrentLayer();return sn>=0?this.all_layers.splice(sn+1,0,rn):this.all_layers.push(rn),this.layer_map[en]=rn,this.current_layer=rn,an}getLayerVisibility(en){const tn=this.layer_map[en];return!!tn&&tn.isVisible()}setLayerVisibility(en,tn){if("boolean"!=typeof tn)return null;const nn=this.layer_map[en];return nn?(nn.setVisible(tn),nn.getGroup()):null}getLayerOpacity(en){const tn=this.layer_map[en];return tn?tn.getOpacity():null}setLayerOpacity(en,tn){if("number"!=typeof tn||tn<0||tn>1)return;const nn=this.layer_map[en];nn&&nn.setOpacity(tn)}copyElem(en){const tn=this;return copyElem(en,(function(){return tn.getNextId()}))}}let As;const identifyLayers=()=>{leaveContext(),As.getCurrentDrawing().identifyLayers()},indexCurrentLayer=()=>As.getCurrentDrawing().indexCurrentLayer(),createLayer=(en,tn)=>{const nn=As.getCurrentDrawing().createLayer(en,historyRecordingService(tn));As.clearSelection(),As.call("changed",[nn])},cloneLayer=(en,tn)=>{const nn=As.getCurrentDrawing().cloneLayer(en,historyRecordingService(tn));As.clearSelection(),leaveContext(),As.call("changed",[nn])},deleteCurrentLayer=()=>{const{BatchCommand:en,RemoveElementCommand:tn}=As.history;let nn=As.getCurrentDrawing().getCurrentLayer();const{nextSibling:rn}=nn,an=nn.parentNode;if(nn=As.getCurrentDrawing().deleteCurrentLayer(),nn){const sn=new en("Delete Layer");return sn.addSubCommand(new tn(nn,rn,an)),As.addCommandToHistory(sn),As.clearSelection(),As.call("changed",[an]),!0}return!1},setCurrentLayer=en=>{const tn=As.getCurrentDrawing().setCurrentLayer(toXml(en));return tn&&As.clearSelection(),tn},renameCurrentLayer=en=>{const tn=As.getCurrentDrawing(),nn=tn.getCurrentLayer();return!(!nn||!tn.setCurrentLayerName(en,historyRecordingService()))&&(As.call("changed",[nn]),!0)},setCurrentLayerPosition=en=>{const{MoveElementCommand:tn}=As.history,nn=As.getCurrentDrawing().setCurrentLayerPosition(en);return!!nn&&(As.addCommandToHistory(new tn(nn.currentGroup,nn.oldNextSibling,As.getSvgContent())),!0)},setLayerVisibility=(en,tn)=>{const{ChangeElementCommand:nn}=As.history,rn=As.getCurrentDrawing(),an=rn.getLayerVisibility(en),sn=rn.setLayerVisibility(en,tn);if(!sn)return!1;{const en=an?"inline":"none";As.addCommandToHistory(new nn(sn,{display:en},"Layer Visibility"))}return sn===rn.getCurrentLayer()&&(As.clearSelection(),As.pathActions.clear()),!0},moveSelectedToLayer=en=>{const{BatchCommand:tn,MoveElementCommand:nn}=As.history,rn=As.getCurrentDrawing().getLayerByName(en);if(!rn)return!1;const an=new tn("Move Elements to Layer"),sn=As.getSelectedElements();let cn=sn.length;for(;cn--;){const en=sn[cn];if(!en)continue;const tn=en.nextSibling,An=en.parentNode;rn.append(en),an.addSubCommand(new nn(en,tn,An))}return As.addCommandToHistory(an),!0},mergeLayer=en=>{As.getCurrentDrawing().mergeLayer(historyRecordingService(en)),As.clearSelection(),leaveContext(),As.changeSvgContent()},mergeAllLayers=en=>{As.getCurrentDrawing().mergeAllLayers(historyRecordingService(en)),As.clearSelection(),leaveContext(),As.changeSvgContent()},leaveContext=()=>{const en=cs.length,tn=As.getDataStorage();if(en){for(let nn=0;nn{const tn=As.getDataStorage();leaveContext(),"string"==typeof en&&(en=getElement(en)),As.setCurrentGroup(en);const nn=function getParentsUntil(en,tn,nn){const rn=[],an=null==tn?void 0:tn.charAt(0),sn=null==nn?void 0:nn.selector.charAt(0);for(;en&&en!==document;en=en.parentNode){if(tn){if("."===an&&en.classList.contains(tn.substr(1)))break;if("#"===an&&en.id===tn.substr(1))break;if("["===an&&en.hasAttribute(tn.substr(1,tn.length-1)))break;if(en.tagName.toLowerCase()===tn)break}nn?("."===sn&&en.classList.contains(nn.substr(1))&&rn.push(en),"#"===sn&&en.id===nn.substr(1)&&rn.push(en),"["===sn&&en.hasAttribute(nn.substr(1,nn.length-1))&&rn.push(en),en.tagName.toLowerCase()===nn&&rn.push(en)):rn.push(en)}return rn.length?rn:null}(en,"#svgcontent"),rn=[];nn.forEach((function(en){Array.prototype.filter.call(en.parentNode.children,(function(tn){return tn!==en})).forEach((function(en){rn.push(en)}))})),rn.forEach((function(en){const nn=en.getAttribute("opacity")||1;tn.put(en,"orig_opac",nn),en.setAttribute("opacity",.33*nn),en.setAttribute("style","pointer-events: none"),cs.push(en)})),As.clearSelection(),As.call("contextset",As.getCurrentGroup())},{InsertElementCommand:ds,BatchCommand:us}=La;let ps=null;const pasteElementsMethod=function(en,tn,nn){let rn=JSON.parse(sessionStorage.getItem(ps.getClipboardID()));if(!rn)return;let an=rn.length;if(!an)return;const sn=[],cn=new us("Paste elements"),An={};function checkIDs(en){var tn;null!==(tn=en.attr)&&void 0!==tn&&tn.id&&(An[en.attr.id]=ps.getNextId(),en.attr.id=An[en.attr.id]),en.children&&en.children.forEach((en=>checkIDs(en)))}for(rn.forEach((en=>checkIDs(en))),ps.runExtensions("IDsUpdated",{elems:rn,changes:An},!0).forEach((function(en){en&&"remove"in en&&en.remove.forEach((function(en){rn=rn.filter((function(tn){return tn.attr.id!==en}))}))}));an--;){const en=rn[an];if(!en)continue;const tn=ps.addSVGElementsFromJson(en);sn.push(tn),cn.addSubCommand(new ds(tn)),ps.restoreRefElements(tn)}if(ps.selectOnly(sn),"in_place"!==en){let rn,an;en?"point"===en&&(rn=tn,an=nn):(rn=ps.getLastClickPoint("x"),an=ps.getLastClickPoint("y"));const An=getStrokedBBoxDefaultVisible(sn),dn=rn-(An.x+An.width/2),un=an-(An.y+An.height/2),pn=[],hn=[];sn.forEach((function(en){pn.push(dn),hn.push(un)}));const gn=ps.moveSelectedElements(pn,hn,!1);gn&&cn.addSubCommand(gn)}ps.addCommandToHistory(cn),ps.call("changed",sn)},touchHandler=en=>{en.preventDefault();const{changedTouches:tn}=en,nn=tn[0];let rn="";switch(en.type){case"touchstart":rn="mousedown";break;case"touchmove":rn="mousemove";break;case"touchend":rn="mouseup";break;default:return}const{screenX:an,screenY:sn,clientX:cn,clientY:An}=nn,dn=new MouseEvent(rn,{bubbles:!0,cancelable:!0,view:window,detail:1,screenX:an,screenY:sn,clientX:cn,clientY:An,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});tn.length<2&&nn.target.dispatchEvent(dn)},hs="http://www.w3.org/2000/svg",{userAgent:gs}=navigator,_s=gs.includes("AppleWebKit"),ms=gs.includes("Gecko/"),fs=gs.includes("Chrome/");gs.includes("Macintosh");const ys=function(){const en=document.createElementNS(hs,"svg"),tn=document.createElementNS(hs,"svg");document.documentElement.append(en),tn.setAttribute("x",5),en.append(tn);const nn=document.createElementNS(hs,"text");nn.textContent="a",tn.append(nn);try{return 0===nn.getStartPositionOfChar(0).x}catch(en){return!1}finally{en.remove()}}(),isWebkit=()=>_s,isGecko$1=()=>ms,{UndoManager:bs,HistoryEventTypes:vs}=La;let ws=null;const ffClone=function(en){if(!isGecko$1())return en;const tn=en.cloneNode(!0);return en.before(tn),en.remove(),ws.selectorManager.releaseSelector(en),ws.setSelectedElements(0,tn),ws.selectorManager.requestSelector(tn).showGrips(!0),tn},changeSelectedAttributeNoUndoMethod=(en,tn,nn)=>{var rn;if("id"===en){const en=nn[0],rn=en.id;return void(rn!==tn&&(ws.clearSelection(),en.id=tn,ws.addToSelection([en],!0),ws.call("elementRenamed",{elem:en,oldId:rn,newId:tn})))}const an=ws.getSelectedElements(),sn=ws.getZoom();"pathedit"===ws.getCurrentMode()&&ws.pathActions.moveNode(en,tn);let cn=(nn=null!==(rn=nn)&&void 0!==rn?rn:an).length;const An=["g","polyline","path"];for(;cn--;){let rn=nn[cn];if(!rn)continue;if(("x"===en||"y"===en)&&An.includes(rn.tagName)){const nn=getStrokedBBoxDefaultVisible([rn]),an="x"===en?tn-nn.x:0,cn="y"===en?tn-nn.y:0;ws.moveSelectedElements(an*sn,cn*sn,!0);continue}let un="#text"===en?rn.textContent:rn.getAttribute(en);if(un||(un=""),un!==String(tn)){"#text"===en?(rn.textContent=tn,/rotate/.test(rn.getAttribute("transform"))&&(rn=ffClone(rn))):"#href"===en?setHref(rn,tn):tn||"number"==typeof tn?rn.setAttribute(en,tn):rn.removeAttribute(en),"textedit"===ws.getCurrentMode()&&"#text"!==en&&rn.textContent.length&&ws.textActions.toSelectMode(rn),isGecko$1()&&"text"===rn.nodeName&&/rotate/.test(rn.getAttribute("transform"))&&(String(tn).startsWith("url")||["font-size","font-family","x","y"].includes(en)&&rn.textContent)&&(rn=ffClone(rn)),an.includes(rn)&&setTimeout((function(){rn.parentNode&&ws.selectorManager.requestSelector(rn).resize()}),0);const nn=getRotationAngle(rn);if(0!==nn&&"transform"!==en){var dn;const en=null===(dn=rn.transform)||void 0===dn?void 0:dn.baseVal;let tn=en.numberOfItems;for(;tn--;)if(4===en.getItem(tn).type){en.removeItem(tn);const an=getBBox(rn),sn=transformPoint(an.x+an.width/2,an.y+an.height/2,transformListToTransform(en).matrix),cn=sn.x,An=sn.y,dn=ws.getSvgRoot().createSVGTransform();dn.setRotate(nn,cn,An),en.insertItemBefore(dn,tn);break}}}}},changeSelectedAttributeMethod=function(en,tn,nn){const rn=ws.getSelectedElements();nn=nn||rn,ws.undoMgr.beginUndoableChange(en,nn),changeSelectedAttributeNoUndoMethod(en,tn,nn);const an=ws.undoMgr.finishUndoableChange();an.isEmpty()||ws.undoMgr.addCommandToHistory(an)},{BatchCommand:ks}=La;let Cs=null;const clearSelectionMethod=en=>{var tn;Cs.getSelectedElements().forEach((en=>{en&&Cs.selectorManager.releaseSelector(en)})),null!==(tn=Cs)&&void 0!==tn&&tn.setEmptySelectedElements(),en||Cs.call("selected",Cs.getSelectedElements())},addToSelectionMethod=(en,tn)=>{const nn=Cs.getSelectedElements();if(!en.length)return;let rn=0;for(;rn1&&en.showGrips(!1)}}if(nn.length)for(Cs.call("selected",nn),1===nn.length&&Cs.selectorManager.requestSelector(nn[0]).showGrips(tn),nn.sort(((en,tn)=>en&&tn&&en.compareDocumentPosition?3-(6&tn.compareDocumentPosition(en)):en?0:1));!nn[0];)nn.shift(0)},getMouseTargetMethod=en=>{if(!en)return null;let tn=en.target;if(tn.correspondingUseElement&&(tn=tn.correspondingUseElement),[xa.MATH,xa.HTML].includes(tn.namespaceURI)&&"svgcanvas"!==tn.id)for(;"foreignObject"!==tn.nodeName;)if(tn=tn.parentNode,!tn)return Cs.getSvgRoot();const nn=Cs.getCurrentDrawing().getCurrentLayer();if([Cs.getSvgRoot(),Cs.getDOMContainer(),Cs.getSvgContent(),nn].includes(tn))return Cs.getSvgRoot();if(getClosest(tn.parentNode,"#selectorParentGroup"))return Cs.selectorManager.selectorParentGroup;for(;null===(rn=tn)||void 0===rn||null===(an=rn.parentNode)||void 0===an||!an.isSameNode(Cs.getCurrentGroup()||nn);){var rn,an;tn=tn.parentNode}return tn},runExtensionsMethod=(en,tn,nn)=>{let rn=!!nn&&[];for(const[an,sn]of Object.entries(Cs.getExtensions()))if("function"==typeof tn&&(tn=tn(an)),sn.eventBased){const nn=new CustomEvent("svgedit",{detail:{action:en,vars:tn}});document.dispatchEvent(nn)}else sn[en]&&(nn?rn.push(sn[en](tn)):rn=sn[en](tn));return rn},getIntersectionListMethod=en=>{const tn=Cs.getZoom();if(!Cs.getRubberBox())return null;const nn=Cs.getCurrentGroup()||Cs.getCurrentDrawing().getCurrentLayer();let rn;if(en)rn=Cs.getSvgContent().createSVGRect(),rn.x=en.x,rn.y=en.y,rn.width=en.width,rn.height=en.height;else{rn=getBBox(Cs.getRubberBox());const en=Cs.getSvgContent().createSVGRect();["x","y","width","height","top","right","bottom","left"].forEach((nn=>{en[nn]=rn[nn]/tn})),rn=en}const an=[];0===Cs.getCurBBoxes().length&&Cs.setCurBBoxes((en=>{en||(en=Cs.getSvgContent().children);const tn=[],nn=en.children;return Array.from(nn).forEach((en=>{en.getBBox&&tn.push({elem:en,bbox:getStrokedBBoxDefaultVisible([en])})})),tn.reverse()})(nn));let sn=Cs.getCurBBoxes().length;for(;sn--;){const en=Cs.getCurBBoxes();rn.width&&rectsIntersect(rn,en[sn].bbox)&&an.push(en[sn].elem)}return an},groupSvgElem=en=>{const tn=Cs.getDataStorage(),nn=document.createElementNS(xa.SVG,"g");en.replaceWith(nn),nn.appendChild(en),tn.put(nn,"gsvg",en),nn.id=Cs.getNextId()},prepareSvg=en=>{Cs.sanitizeSvg(en.documentElement),[...en.getElementsByTagNameNS(xa.SVG,"path")].forEach((en=>{const tn=Cs.pathActions.convertPath(en);en.setAttribute("d",tn),Cs.pathActions.fixEnd(en)}))},setRotationAngle=(en,tn)=>{const nn=Cs.getSelectedElements();en=Number.parseFloat(en);const rn=nn[0],an=rn.getAttribute("transform"),sn=getBBox(rn),cn=sn.x+sn.width/2,An=sn.y+sn.height/2,dn=rn.transform.baseVal;if(dn.numberOfItems>0&&4===dn.getItem(0).type&&dn.removeItem(0),0!==en){const tn=transformPoint(cn,An,transformListToTransform(dn).matrix),nn=Cs.getSvgRoot().createSVGTransform();nn.setRotate(en,tn.x,tn.y),dn.numberOfItems?dn.insertItemBefore(nn,0):dn.appendItem(nn)}else 0===dn.numberOfItems&&rn.removeAttribute("transform");if(!tn){let en=rn.getAttribute("transform");if(en){const tn=en.split(" "),nn=(en=>Math.round(Number(en)+Number.EPSILON))(tn[1]);en="".concat(tn[0]," ").concat(nn," ").concat(tn[2])}an?rn.setAttribute("transform",an):rn.removeAttribute("transform"),Cs.changeSelectedAttribute("transform",en,nn),Cs.call("changed",nn)}Cs.selectorManager.requestSelector(nn[0]).resize(),Cs.getSelector().updateGripCursors(en)},recalculateAllSelectedDimensions=()=>{const en="none"===Cs.getCurrentResizeMode()?"position":"size",tn=new ks(en),nn=Cs.getSelectedElements();nn.forEach((en=>{const nn=Cs.recalculateDimensions(en);nn&&tn.addSubCommand(nn)})),tn.isEmpty()||(Cs.addCommandToHistory(tn),Cs.call("changed",nn))}; /** * @module text-actions Tools for Text edit functions * @license MIT * * @copyright 2010 Alexis Deveria, 2010 Jeff Schiller */let Bs=null;const js=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(xa.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(xa.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=Bs.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=Bs.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=Bs.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=Bs.getZoom(),rn=transformPoint(tn.pageX,tn.pageY,Bs.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),Bs.$click(tn.target,selectAll),setTimeout((function(){tn.target.removeEventListener("click",selectAll)}),300)}return{select(tn,nn,rn){en=tn,Bs.textActions.toEditMode(nn,rn)},start(tn){en=tn,Bs.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&&nnAn-2&&rndn-2&&Bs.textActions.toSelectMode(!0)},setCursor:setCursor,toEditMode(tn,nn){if(un=!1,Bs.setCurrentMode("textedit"),Bs.selectorManager.requestSelector(en).showGrips(!1),Bs.selectorManager.requestSelector(en),Bs.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;Bs.setCurrentMode("select"),clearInterval(an),an=null,rn&&rn.setAttribute("display","none"),nn&&nn.setAttribute("visibility","hidden"),en.style.cursor="move",sn&&(Bs.clearSelection(),en.style.cursor="move",Bs.call("selected",[en]),Bs.addToSelection([en],!0)),null!==(cn=en)&&void 0!==cn&&cn.textContent.length||Bs.deleteSelectedElements(),tn.blur(),en=!1},setInputElem(en){tn=en},clear(){"textedit"===Bs.getCurrentMode()&&Bs.textActions.toSelectMode()},init(nn){if(!en)return;let rn,an;if(!en.parentNode){const tn=Bs.getSelectedElements();en=tn[0],Bs.selectorManager.requestSelector(en).showGrips(!1)}const An=en.textContent.length,dn=en.getAttribute("transform");for(sn=getBBox(en),cn=dn?getMatrix(en):null,pn=[],pn.length=An,tn.focus(),en.removeEventListener("dblclick",selectWord),en.addEventListener("dblclick",selectWord),An||(an={x:sn.x+sn.width/2,width:0}),rn=0;rn{const tn={x:0,y:0},nn=Ps.getControllPoint2("x"),rn=Ps.getControllPoint2("y"),an=Ps.getControllPoint1("x"),sn=Ps.getControllPoint1("y"),cn=Ps.getStart("x"),An=Ps.getStart("y"),dn=Ps.getEnd("x"),un=Ps.getEnd("y"),pn=1/6,hn=en*en,gn=hn*en,_n=[[-1,3,-3,1],[3,-6,3,0],[-3,0,3,0],[1,4,1,0]];return tn.x=pn*((nn*_n[0][0]+an*_n[0][1]+cn*_n[0][2]+dn*_n[0][3])*gn+(nn*_n[1][0]+an*_n[1][1]+cn*_n[1][2]+dn*_n[1][3])*hn+(nn*_n[2][0]+an*_n[2][1]+cn*_n[2][2]+dn*_n[2][3])*en+(nn*_n[3][0]+an*_n[3][1]+cn*_n[3][2]+dn*_n[3][3])),tn.y=pn*((rn*_n[0][0]+sn*_n[0][1]+An*_n[0][2]+un*_n[0][3])*gn+(rn*_n[1][0]+sn*_n[1][1]+An*_n[1][2]+un*_n[1][3])*hn+(rn*_n[2][0]+sn*_n[2][1]+An*_n[2][2]+un*_n[2][3])*en+(rn*_n[3][0]+sn*_n[3][1]+An*_n[3][2]+un*_n[3][3])),{x:tn.x,y:tn.y}},mouseMoveEvent=en=>{var tn;if(!Ps.getStarted())return;if(1===en.button||Ps.spaceKey)return;Ps.textActions.init(),en.preventDefault();const nn=Ps.getSelectedElements(),rn=Ps.getZoom(),an=Ps.getSvgRoot(),sn=nn[0];let cn,An,dn,un,pn,hn,gn,_n,mn;const fn=transformPoint(en.clientX,en.clientY,Ps.getrootSctm()),yn=fn.x*rn,bn=fn.y*rn,vn=getElement(Ps.getId());let wn,xn=yn/rn,kn=xn,Cn=bn/rn,Sn=Cn;switch(Ps.getCurConfig().gridSnapping&&(kn=snapToGrid(kn),Sn=snapToGrid(Sn)),Ps.getCurrentMode()){case"select":sn&&(pn=kn-Ps.getStartX(),hn=Sn-Ps.getStartY(),Ps.getCurConfig().gridSnapping&&(pn=snapToGrid(pn),hn=snapToGrid(hn)),(pn||hn)&&(nn.forEach((en=>{en&&(((en,tn,nn,rn)=>{var an;const sn=en.createSVGTransform();sn.setTranslate(nn,rn);const cn=null===(an=tn.transform)||void 0===an?void 0:an.baseVal;cn.numberOfItems?2===cn.getItem(0).type?cn.replaceItem(sn,0):cn.insertItemBefore(sn,0):cn.appendItem(sn)})(an,en,pn,hn),Ps.selectorManager.requestSelector(en).resize())})),Ps.call("transition",nn)));break;case"multiselect":{xn*=rn,Cn*=rn,assignAttributes(Ps.getRubberBox(),{x:Math.min(Ps.getRStartX(),xn),y:Math.min(Ps.getRStartY(),Cn),width:Math.abs(xn-Ps.getRStartX()),height:Math.abs(Cn-Ps.getRStartY())});const en=nn.slice(),tn=[],an=Ps.getIntersectionList();for(gn=an.length,cn=0;cn0&&Ps.removeFromSelection(en),tn.length>0&&Ps.addToSelection(tn);break}case"resize":{wn=sn.transform.baseVal;const tn=hasMatrixTransform(wn);mn=tn?Ps.getInitBbox():getBBox(sn);let rn=mn.x,cn=mn.y,{width:An,height:dn}=mn;if(pn=kn-Ps.getStartX(),hn=Sn-Ps.getStartY(),Ps.getCurConfig().gridSnapping&&(pn=snapToGrid(pn),hn=snapToGrid(hn),dn=snapToGrid(dn),An=snapToGrid(An)),_n=getRotationAngle(sn),_n){const en=Math.sqrt(pn*pn+hn*hn),tn=Math.atan2(hn,pn)-_n*Math.PI/180;pn=en*Math.cos(tn),hn=en*Math.sin(tn)}Ps.getCurrentResizeMode().includes("n")||Ps.getCurrentResizeMode().includes("s")||(hn=0),Ps.getCurrentResizeMode().includes("e")||Ps.getCurrentResizeMode().includes("w")||(pn=0);let un=0,gn=0,fn=dn?(dn+hn)/dn:1,yn=An?(An+pn)/An:1;Ps.getCurrentResizeMode().includes("n")&&(fn=dn?(dn-hn)/dn:1,gn=dn),Ps.getCurrentResizeMode().includes("w")&&(yn=An?(An-pn)/An:1,un=An);const bn=an.createSVGTransform(),vn=an.createSVGTransform(),xn=an.createSVGTransform();if(Ps.getCurConfig().gridSnapping&&(rn=snapToGrid(rn),un=snapToGrid(un),cn=snapToGrid(cn),gn=snapToGrid(gn)),bn.setTranslate(-(rn+un),-(cn+gn)),en.shiftKey&&(1===yn?yn=fn:fn=yn),vn.setScale(yn,fn),xn.setTranslate(rn+un,cn+gn),tn){const en=_n?1:0;wn.replaceItem(bn,2+en),wn.replaceItem(vn,1+en),wn.replaceItem(xn,Number(en))}else{const en=wn.numberOfItems;wn.replaceItem(xn,en-3),wn.replaceItem(vn,en-2),wn.replaceItem(bn,en-1)}Ps.selectorManager.requestSelector(sn).resize(),Ps.call("transition",nn);break}case"zoom":xn*=rn,Cn*=rn,assignAttributes(Ps.getRubberBox(),{x:Math.min(Ps.getRStartX()*rn,xn),y:Math.min(Ps.getRStartY()*rn,Cn),width:Math.abs(xn-Ps.getRStartX()*rn),height:Math.abs(Cn-Ps.getRStartY()*rn)});break;case"text":assignAttributes(vn,{x:kn,y:Sn});break;case"line":{Ps.getCurConfig().gridSnapping&&(kn=snapToGrid(kn),Sn=snapToGrid(Sn));let tn=kn,nn=Sn;en.shiftKey&&(An=snapToAngle(Ps.getStartX(),Ps.getStartY(),tn,nn),tn=An.x,nn=An.y),vn.setAttribute("x2",tn),vn.setAttribute("y2",nn);break}case"foreignObject":case"square":case"rect":case"image":{const tn="square"===Ps.getCurrentMode()||en.shiftKey;let nn,rn,an=Math.abs(kn-Ps.getStartX()),sn=Math.abs(Sn-Ps.getStartY());tn?(an=sn=Math.max(an,sn),nn=Ps.getStartX()Ps.getThreSholdDist()){Ps.setSumDistance(Ps.getSumDistance()-Ps.getThreSholdDist());const en=Ps.getSvgContent().createSVGPoint();en.x=Ps.getbSpline("x"),en.y=Ps.getbSpline("y"),vn.points.appendItem(en)}Ps.setControllPoint2("x",Ps.getControllPoint1("x")),Ps.setControllPoint2("y",Ps.getControllPoint1("y")),Ps.setControllPoint1("x",Ps.getStart("x")),Ps.setControllPoint1("y",Ps.getStart("y")),Ps.setStart({x:Ps.getEnd("x"),y:Ps.getEnd("y")});break;case"path":case"pathedit":if(kn*=rn,Sn*=rn,Ps.getCurConfig().gridSnapping&&(kn=snapToGrid(kn),Sn=snapToGrid(Sn),Ps.setStartX(snapToGrid(Ps.getStartX())),Ps.setStartY(snapToGrid(Ps.getStartY()))),en.shiftKey){const{path:en}=as;let tn,nn;en?(tn=en.dragging?en.dragging[0]:Ps.getStartX(),nn=en.dragging?en.dragging[1]:Ps.getStartY()):(tn=Ps.getStartX(),nn=Ps.getStartY()),An=snapToAngle(tn,nn,kn,Sn),({x:kn,y:Sn}=An)}"none"!==(null===(tn=Ps.getRubberBox())||void 0===tn?void 0:tn.getAttribute("display"))&&(xn*=rn,Cn*=rn,assignAttributes(Ps.getRubberBox(),{x:Math.min(Ps.getRStartX()*rn,xn),y:Math.min(Ps.getRStartY()*rn,Cn),width:Math.abs(xn-Ps.getRStartX()*rn),height:Math.abs(Cn-Ps.getRStartY()*rn)})),Ps.pathActions.mouseMove(kn,Sn);break;case"textedit":kn*=rn,Sn*=rn,Ps.textActions.mouseMove(yn,bn);break;case"rotate":{mn=getBBox(sn),dn=mn.x+mn.width/2,un=mn.y+mn.height/2;const tn=getMatrix(sn),rn=transformPoint(dn,un,tn);if(dn=rn.x,un=rn.y,_n=(Math.atan2(un-Sn,dn-kn)*(180/Math.PI)-90)%360,Ps.getCurConfig().gridSnapping&&(_n=snapToGrid(_n)),en.shiftKey){const en=45;_n=Math.round(_n/en)*en}Ps.setRotationAngle(_n<-180?360+_n:_n,!0),Ps.call("transition",nn);break}}Ps.runExtensions("mouseMove",{event:en,mouse_x:yn,mouse_y:bn,selected:sn})},mouseOutEvent=()=>{const{$id:en}=Ps;if("select"!==Ps.getCurrentMode()&&Ps.getStarted()){const tn=new Event("mouseup");en("svgcanvas").dispatchEvent(tn)}},mouseUpEvent=en=>{if(2===en.button)return;if(!Ps.getStarted())return;Ps.textActions.init();const tn=Ps.getSelectedElements(),nn=Ps.getZoom(),rn=Ps.getJustSelected();Ps.setJustSelected(null);const an=transformPoint(en.clientX,en.clientY,Ps.getrootSctm()),sn=an.x*nn,cn=an.y*nn,An=sn/nn,dn=cn/nn;let un=getElement(Ps.getId()),pn=!1;const hn=An,gn=dn;let _n;switch(Ps.setStarted(!1),Ps.getCurrentMode()){case"resize":case"multiselect":Ps.getRubberBox()&&(Ps.getRubberBox().setAttribute("display","none"),Ps.setCurBBoxes([])),Ps.setCurrentMode("select");case"select":if(tn[0]){if(!tn[1]){const en=tn[0];switch(en.tagName){case"g":case"use":case"image":case"foreignObject":break;case"text":Ps.setCurText("font_size",en.getAttribute("font-size")),Ps.setCurText("font_family",en.getAttribute("font-family"));default:Ps.setCurProperties("fill",en.getAttribute("fill")),Ps.setCurProperties("fill_opacity",en.getAttribute("fill-opacity")),Ps.setCurProperties("stroke",en.getAttribute("stroke")),Ps.setCurProperties("stroke_opacity",en.getAttribute("stroke-opacity")),Ps.setCurProperties("stroke_width",en.getAttribute("stroke-width")),Ps.setCurProperties("stroke_dasharray",en.getAttribute("stroke-dasharray")),Ps.setCurProperties("stroke_linejoin",en.getAttribute("stroke-linejoin")),Ps.setCurProperties("stroke_linecap",en.getAttribute("stroke-linecap"))}Ps.selectorManager.requestSelector(en).showGrips(!0)}if(Ps.recalculateAllSelectedDimensions(),hn!==Ps.getRStartX()||gn!==Ps.getRStartY()){const en=tn.length;for(let nn=0;nn{en.removeAttribute("style")})))}return;case"zoom":{var mn;null===(mn=Ps.getRubberBox())||void 0===mn||mn.setAttribute("display","none");const tn=en.shiftKey?.5:2;return void Ps.call("zoomed",{x:Math.min(Ps.getRStartX(),hn),y:Math.min(Ps.getRStartY(),gn),width:Math.abs(hn-Ps.getRStartX()),height:Math.abs(gn-Ps.getRStartY()),factor:tn})}case"fhpath":{Ps.setSumDistance(0),Ps.setControllPoint2("x",0),Ps.setControllPoint2("y",0),Ps.setControllPoint1("x",0),Ps.setControllPoint1("y",0),Ps.setStart({x:0,y:0}),Ps.setEnd("x",0),Ps.setEnd("y",0);const en=un.getAttribute("points"),tn=en.indexOf(",");pn=tn>=0?en.includes(",",tn+1):en.includes(" ",en.indexOf(" ")+1),pn&&(un=Ps.pathActions.smoothPolylineIntoPath(un));break}case"line":{const en=un.getAttribute("x1"),tn=un.getAttribute("y1"),nn=un.getAttribute("x2"),rn=un.getAttribute("y2");pn=en!==nn||tn!==rn}break;case"foreignObject":case"square":case"rect":case"image":{const en=un.getAttribute("width"),tn=un.getAttribute("height");pn=en||tn||"image"===Ps.getCurrentMode()}break;case"circle":pn="0"!==un.getAttribute("r");break;case"ellipse":{const en=Number(un.getAttribute("rx")),tn=Number(un.getAttribute("ry"));pn=en||tn}break;case"fhellipse":Ps.getFreehand("maxx")-Ps.getFreehand("minx")>0&&Ps.getFreehand("maxy")-Ps.getFreehand("miny")>0&&(un=Ps.addSVGElementsFromJson({element:"ellipse",curStyles:!0,attr:{cx:(Ps.getFreehand("minx")+Ps.getFreehand("maxx"))/2,cy:(Ps.getFreehand("miny")+Ps.getFreehand("maxy"))/2,rx:(Ps.getFreehand("maxx")-Ps.getFreehand("minx"))/2,ry:(Ps.getFreehand("maxy")-Ps.getFreehand("miny"))/2,id:Ps.getId()}}),Ps.call("changed",[un]),pn=!0);break;case"fhrect":Ps.getFreehand("maxx")-Ps.getFreehand("minx")>0&&Ps.getFreehand("maxy")-Ps.getFreehand("miny")>0&&(un=Ps.addSVGElementsFromJson({element:"rect",curStyles:!0,attr:{x:Ps.getFreehand("minx"),y:Ps.getFreehand("miny"),width:Ps.getFreehand("maxx")-Ps.getFreehand("minx"),height:Ps.getFreehand("maxy")-Ps.getFreehand("miny"),id:Ps.getId()}}),Ps.call("changed",[un]),pn=!0);break;case"text":pn=!0,Ps.selectOnly([un]),Ps.textActions.start(un);break;case"path":{un=null,Ps.setStarted(!0);const tn=Ps.pathActions.mouseUp(en,un,sn,cn);({element:un}=tn),({keep:pn}=tn);break}case"pathedit":pn=!0,un=null,Ps.pathActions.mouseUp(en);break;case"textedit":pn=!1,un=null,Ps.textActions.mouseUp(en,sn,cn);break;case"rotate":{pn=!0,un=null,Ps.setCurrentMode("select");const en=Ps.undoMgr.finishUndoableChange();en.isEmpty()||Ps.addCommandToHistory(en),Ps.recalculateAllSelectedDimensions(),Ps.call("changed",tn);break}}if(Ps.runExtensions("mouseUp",{event:en,mouse_x:sn,mouse_y:cn},!0).forEach((en=>{en&&(pn=en.keep||pn,({element:un}=en),Ps.setStarted(en.started||Ps.getStarted()))})),!pn&&un){var fn;for(Ps.getCurrentDrawing().releaseId(Ps.getId()),un.remove(),un=null,_n=en.target;"g"===(null===(yn=_n)||void 0===yn||null===(bn=yn.parentNode)||void 0===bn||null===(vn=bn.parentNode)||void 0===vn?void 0:vn.tagName);){var yn,bn,vn;_n=_n.parentNode}"path"===Ps.getCurrentMode()&&Ps.getDrawnPath()||!_n||"selectorParentGroup"===(null===(fn=_n.parentNode)||void 0===fn?void 0:fn.id)||"svgcanvas"===_n.id||"svgroot"===_n.id||(Ps.setMode("select"),Ps.selectOnly([_n],!0))}else if(un){Ps.addedNew=!0;let tn,nn=.2;const rn=Ps.getStyle(),an=Ps.getOpacAni();if(an.beginElement&&Number.parseFloat(un.getAttribute("opacity"))!==rn.opacity){tn=an.cloneNode(!0),tn.setAttribute("to",rn.opacity),tn.setAttribute("dur",nn),un.appendChild(tn);try{tn.beginElement()}catch(en){}}else nn=0;setTimeout((()=>{tn&&tn.remove(),un.setAttribute("opacity",rn.opacity),un.setAttribute("style","pointer-events:inherit"),cleanupElement(un),"path"===Ps.getCurrentMode()?Ps.pathActions.toEditMode(un):Ps.getCurConfig().selectNew&&(-1!==["circle","ellipse","square","rect","fhpath","line","fhellipse","fhrect","star","polygon"].indexOf(Ps.getCurrentMode())&&Ps.setMode("select"),Ps.selectOnly([un],!0)),Ps.addCommandToHistory(new Ls(un)),Ps.call("changed",[un])}),1e3*nn)}Ps.setStartTransform(null)},dblClickEvent=en=>{const tn=Ps.getSelectedElements(),nn=en.target.parentNode;let rn=Ps.getMouseTarget(en);const{tagName:an}=rn;if("text"===an&&"textedit"!==Ps.getCurrentMode()){const tn=transformPoint(en.clientX,en.clientY,Ps.getrootSctm());Ps.textActions.select(rn,tn.x,tn.y)}nn!==Ps.getCurrentGroup()&&("g"!==an&&"a"!==an||!getRotationAngle(rn)||(Ps.pushGroupProperties(rn),rn=tn[0],Ps.clearSelection(!0)),Ps.getCurrentGroup()&&leaveContext(),"g"!==nn.tagName&&"a"!==nn.tagName||nn===Ps.getCurrentDrawing().getCurrentLayer()||rn===Ps.selectorManager.selectorParentGroup||setContext(rn))},mouseDownEvent=en=>{const tn=Ps.getDataStorage(),nn=Ps.getSelectedElements(),rn=Ps.getZoom(),an=Ps.getStyle(),sn=Ps.getSvgRoot(),{$id:cn}=Ps;if(Ps.spaceKey||1===en.button)return;const An=2===en.button;en.altKey&&Ps.cloneSelectedElements(0,0),Ps.setRootSctm(cn("svgcontent").querySelector("g").getScreenCTM().inverse());const dn=transformPoint(en.clientX,en.clientY,Ps.getrootSctm()),un=dn.x*rn,pn=dn.y*rn;if(en.preventDefault(),An){if("path"===Ps.getCurrentMode())return;Ps.setCurrentMode("select"),Ps.setLastClickPoint(dn)}let hn=un/rn,gn=pn/rn,_n=Ps.getMouseTarget(en);"a"===_n.tagName&&1===_n.childNodes.length&&(_n=_n.firstChild);const mn=hn;Ps.setStartX(hn),Ps.setRStartX(hn);const fn=gn;if(Ps.setStartY(gn),Ps.setRStartY(gn),Ps.getCurConfig().gridSnapping&&(hn=snapToGrid(hn),gn=snapToGrid(gn),Ps.setStartX(snapToGrid(Ps.getStartX())),Ps.setStartY(snapToGrid(Ps.getStartY()))),_n===Ps.selectorManager.selectorParentGroup&&nn[0]){const rn=en.target,an=tn.get(rn,"type");"rotate"===an?Ps.setCurrentMode("rotate"):"resize"===an&&(Ps.setCurrentMode("resize"),Ps.setCurrentResizeMode(tn.get(rn,"dir"))),_n=nn[0]}Ps.setStartTransform(_n.getAttribute("transform"));const yn=_n.transform.baseVal;if(yn.numberOfItems>1){const en=yn.getItem(0);yn.removeItem(0),yn.consolidate(),yn.insertItemBefore(en,0)}switch(Ps.getCurrentMode()){case"select":if(Ps.setStarted(!0),Ps.setCurrentResizeMode("none"),An&&Ps.setStarted(!1),_n!==sn){if(nn.includes(_n)||(en.shiftKey||Ps.clearSelection(!0),Ps.addToSelection([_n]),Ps.setJustSelected(_n),Ps.pathActions.clear()),!An)for(const en of nn){var bn;if(!en)continue;const tn=null===(bn=en.transform)||void 0===bn?void 0:bn.baseVal;tn.numberOfItems?tn.insertItemBefore(sn.createSVGTransform(),0):tn.appendItem(sn.createSVGTransform())}}else An||(Ps.clearSelection(),Ps.setCurrentMode("multiselect"),Ps.getRubberBox()||Ps.setRubberBox(Ps.selectorManager.getRubberBandBox()),Ps.setRStartX(Ps.getRStartX()*rn),Ps.setRStartY(Ps.getRStartY()*rn),assignAttributes(Ps.getRubberBox(),{x:Ps.getRStartX(),y:Ps.getRStartY(),width:0,height:0,display:"inline"}));break;case"zoom":Ps.setStarted(!0),Ps.getRubberBox()||Ps.setRubberBox(Ps.selectorManager.getRubberBandBox()),assignAttributes(Ps.getRubberBox(),{x:mn*rn,y:mn*rn,width:0,height:0,display:"inline"});break;case"resize":{Ps.setStarted(!0),Ps.setStartX(hn),Ps.setStartY(gn),Ps.setInitBbox(getBBox(cn("selectedBox0")));const en={};for(const[tn,nn]of Object.entries(Ps.getInitBbox()))en[tn]=nn/rn;Ps.setInitBbox(en);const tn=getRotationAngle(_n)?1:0;hasMatrixTransform(yn)?(yn.insertItemBefore(sn.createSVGTransform(),tn),yn.insertItemBefore(sn.createSVGTransform(),tn),yn.insertItemBefore(sn.createSVGTransform(),tn)):(yn.appendItem(sn.createSVGTransform()),yn.appendItem(sn.createSVGTransform()),yn.appendItem(sn.createSVGTransform()));break}case"fhellipse":case"fhrect":case"fhpath":Ps.setStart({x:mn,y:fn}),Ps.setControllPoint1("x",0),Ps.setControllPoint1("y",0),Ps.setControllPoint2("x",0),Ps.setControllPoint2("y",0),Ps.setStarted(!0),Ps.setDAttr(mn+","+fn+" "),Ps.addSVGElementsFromJson({element:"polyline",curStyles:!0,attr:{points:Ps.getDAttr(),id:Ps.getNextId(),fill:"none",opacity:an.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}}),Ps.setFreehand("minx",mn),Ps.setFreehand("maxx",mn),Ps.setFreehand("miny",fn),Ps.setFreehand("maxy",fn);break;case"image":{Ps.setStarted(!0);const en=Ps.addSVGElementsFromJson({element:"image",attr:{x:hn,y:gn,width:0,height:0,id:Ps.getNextId(),opacity:an.opacity/2,style:"pointer-events:inherit"}});setHref(en,Ps.getLastGoodImgUrl()),preventClickDefault(en);break}case"square":case"rect":Ps.setStarted(!0),Ps.setStartX(hn),Ps.setStartY(gn),Ps.addSVGElementsFromJson({element:"rect",curStyles:!0,attr:{x:hn,y:gn,width:0,height:0,id:Ps.getNextId(),opacity:an.opacity/2}});break;case"line":{Ps.setStarted(!0);const en=0===Number(an.stroke_width)?1:an.stroke_width;Ps.addSVGElementsFromJson({element:"line",curStyles:!0,attr:{x1:hn,y1:gn,x2:hn,y2:gn,id:Ps.getNextId(),stroke:an.stroke,"stroke-width":en,"stroke-dasharray":an.stroke_dasharray,"stroke-linejoin":an.stroke_linejoin,"stroke-linecap":an.stroke_linecap,"stroke-opacity":an.stroke_opacity,fill:"none",opacity:an.opacity/2,style:"pointer-events:none"}});break}case"circle":Ps.setStarted(!0),Ps.addSVGElementsFromJson({element:"circle",curStyles:!0,attr:{cx:hn,cy:gn,r:0,id:Ps.getNextId(),opacity:an.opacity/2}});break;case"ellipse":Ps.setStarted(!0),Ps.addSVGElementsFromJson({element:"ellipse",curStyles:!0,attr:{cx:hn,cy:gn,rx:0,ry:0,id:Ps.getNextId(),opacity:an.opacity/2}});break;case"text":Ps.setStarted(!0),Ps.addSVGElementsFromJson({element:"text",curStyles:!0,attr:{x:hn,y:gn,id:Ps.getNextId(),fill:Ps.getCurText("fill"),"stroke-width":Ps.getCurText("stroke_width"),"font-size":Ps.getCurText("font_size"),"font-family":Ps.getCurText("font_family"),"text-anchor":"middle","xml:space":"preserve",opacity:an.opacity}});break;case"path":case"pathedit":Ps.setStartX(Ps.getStartX()*rn),Ps.setStartY(Ps.getStartY()*rn),Ps.pathActions.mouseDown(en,_n,Ps.getStartX(),Ps.getStartY()),Ps.setStarted(!0);break;case"textedit":Ps.setStartX(Ps.getStartX()*rn),Ps.setStartY(Ps.getStartY()*rn),Ps.textActions.mouseDown(en,_n,Ps.getStartX(),Ps.getStartY()),Ps.setStarted(!0);break;case"rotate":Ps.setStarted(!0),Ps.undoMgr.beginUndoableChange("transform",nn)}Ps.runExtensions("mouseDown",{event:en,start_x:Ps.getStartX(),start_y:Ps.getStartY(),selectedElements:nn},!0).forEach((en=>{(null==en?void 0:en.started)&&Ps.setStarted(!0)}))},DOMMouseScrollEvent=en=>{const tn=Ps.getZoom(),{$id:nn}=Ps;if(!en.shiftKey)return;en.preventDefault(),Ps.setRootSctm(nn("svgcontent").querySelector("g").getScreenCTM().inverse());const rn=document.getElementById("workarea"),an=Ps.getCurConfig().showRulers?16:0,sn=transformPoint(en.clientX,en.clientY,Ps.getrootSctm()),cn=parseFloat(getComputedStyle(rn,null).width.replace("px","")),An=parseFloat(getComputedStyle(rn,null).height.replace("px","")),dn=cn-15-an,un=An-15-an,pn=dn*Ps.getrootSctm().a,hn=un*Ps.getrootSctm().d,gn=function findPos(en){let tn=0,nn=0;if(en.offsetParent){do{tn+=en.offsetLeft,nn+=en.offsetTop}while(en=en.offsetParent);return{left:tn,top:nn}}return{left:tn,top:nn}}(rn),_n=gn.left+an,mn=gn.top+an,fn=en.wheelDelta?en.wheelDelta:en.detail?-en.detail:0;if(!fn)return;let yn,bn,vn=Math.max(3/4,Math.min(4/3,fn));vn>1?(yn=Math.ceil(dn/pn*vn*100)/100,bn=Math.ceil(un/hn*vn*100)/100):(yn=Math.floor(dn/pn*vn*100)/100,bn=Math.floor(un/hn*vn*100)/100);let wn=Math.min(yn,bn);if(wn=Math.min(10,Math.max(.01,wn)),wn===tn)return;vn=wn/tn;const xn=transformPoint(_n,mn,Ps.getrootSctm()),kn={x:(sn.x-(sn.x-xn.x)/vn)*wn-an+cn/2,y:(sn.y-(sn.y-xn.y)/vn)*wn-an+An/2};Ps.setZoom(wn),document.getElementById("zoom").value=(100*wn).toFixed(1),Ps.call("updateCanvas",{center:!1,newCtr:kn}),Ps.call("zoomDone")}; /** * Tools for SVG handle on JSON format. * @module svgcanvas * @license MIT * * @copyright 2010 Alexis Deveria, 2010 Jeff Schiller */let Ts=null,Ns=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 Ns.createTextNode(en);let tn=getElement(en.attr.id);const nn=Ts.getDrawing().getCurrentLayer();if(tn&&en.element!==tn.tagName&&(tn.remove(),tn=null),!tn){const rn=en.namespace||xa.SVG;tn=Ns.createElementNS(rn,en.element),nn&&(Ts.getCurrentGroup()||nn).append(tn)}const rn=Ts.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 Is=null;const getResolutionMethod=()=>{const en=Is.getZoom();return{w:Is.getSvgContent().getAttribute("width")/en,h:Is.getSvgContent().getAttribute("height")/en,zoom:en}},getTitleMethod=en=>{const tn=Is.getSelectedElements(),nn=Is.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}=Is.history,sn=Is.getSelectedElements(),cn=Is.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=Is.getDOMDocument().createElementNS(xa.SVG,"title"),pn.textContent=en,An.insertBefore(pn,An.firstChild),un.addSubCommand(new tn(pn)));Is.addCommandToHistory(un)},setDocumentTitleMethod=en=>{const{ChangeElementCommand:tn,BatchCommand:nn}=Is.history,rn=Is.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=Is.getDOMDocument().createElementNS(xa.SVG,"title"),Is.getSvgContent().insertBefore(an,Is.getSvgContent().firstChild)),en.length?an.textContent=en:an.remove(),cn.addSubCommand(new tn(an,{"#text":sn})),Is.addCommandToHistory(cn)},setResolutionMethod=(en,tn)=>{const{ChangeElementCommand:nn,BatchCommand:rn}=Is.history,an=Is.getZoom(),sn=Is.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();Is.addToSelection(an);const sn=[],cn=[];an.forEach(((en,tn)=>{sn.push(-1*nn.x),cn.push(-1*nn.y)}));const An=Is.moveSelectedElements(sn,cn,!0);dn.addSubCommand(An),Is.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),Is.getSvgContent().setAttribute("width",en),Is.getSvgContent().setAttribute("height",tn),Is.contentW=en,Is.contentH=tn,dn.addSubCommand(new nn(Is.getSvgContent(),{width:cn,height:An})),Is.getSvgContent().setAttribute("viewBox",[0,0,en/an,tn/an].join(" ")),dn.addSubCommand(new nn(Is.getSvgContent(),{viewBox:["0 0",cn,An].join(" ")})),Is.addCommandToHistory(dn),Is.call("changed",[Is.getSvgContent()])),!0},getEditorNSMethod=en=>(en&&Is.getSvgContent().setAttribute("xmlns:se",xa.SE),xa.SE),setBBoxZoomMethod=(en,tn,nn)=>{const rn=Is.getZoom(),an=Is.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 Is.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 Is.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=Is.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(Is.getCurrentDrawing().getCurrentLayer()));break;default:return}return calcZoom(sn)},setZoomMethod=en=>{const tn=Is.getSelectedElements(),nn=Is.getResolution();Is.getSvgContent().setAttribute("viewBox","0 0 "+nn.w/en+" "+nn.h/en),Is.setZoom(en),tn.forEach((en=>{en&&Is.selectorManager.requestSelector(en).resize()})),Is.pathActions.zoomChange(),Is.runExtensions("zoomChanged",en)},setColorMethod=(en,tn,nn)=>{const rn=Is.getSelectedElements();Is.setCurShape(en,tn),Is.setCurProperties(en+"_paint",{type:"solidColor"});const an=[],addNonG=en=>{"g"!==en.nodeName&&an.push(en)};let sn=rn.length;for(;sn--;){const tn=rn[sn];tn&&("g"===tn.tagName?walkTree(tn,addNonG):"fill"===en?"polyline"!==tn.tagName&&"line"!==tn.tagName&&an.push(tn):an.push(tn))}an.length>0&&(nn?Is.changeSelectedAttributeNoUndo(en,tn,an):(Is.changeSelectedAttribute(en,tn,an),Is.call("changed",an)))},setGradientMethod=en=>{if(!Is.getCurProperties(en+"_paint")||"solidColor"===Is.getCurProperties(en+"_paint").type)return;let tn=Is[en+"Grad"];const nn=findDuplicateGradient(tn),rn=findDefs();nn?tn=nn:(tn=Is.getDOMDocument().importNode(tn,!0),rn.append(tn),tn.id=Is.getNextId()),Is.setColor(en,"url(#"+tn.id+")")},findDuplicateGradient=en=>{const tn=findDefs().querySelectorAll("linearGradient, radialGradient");let nn=tn.length;const rn=["r","cx","cy","fx","fy"];for(;nn--;){const an=tn[nn];if("linearGradient"===en.tagName){if(en.getAttribute("x1")!==an.getAttribute("x1")||en.getAttribute("y1")!==an.getAttribute("y1")||en.getAttribute("x2")!==an.getAttribute("x2")||en.getAttribute("y2")!==an.getAttribute("y2"))continue}else{const tn={r:Number(en.getAttribute("r")),cx:Number(en.getAttribute("cx")),cy:Number(en.getAttribute("cy")),fx:Number(en.getAttribute("fx")),fy:Number(en.getAttribute("fy"))},nn={r:Number(an.getAttribute("r")),cx:Number(an.getAttribute("cx")),cy:Number(an.getAttribute("cy")),fx:Number(an.getAttribute("fx")),fy:Number(an.getAttribute("fy"))};let sn=!1;if(rn.forEach((en=>{tn[en]!==nn[en]&&(sn=!0)})),sn)continue}const sn=en.getElementsByTagNameNS(xa.SVG,"stop"),cn=an.getElementsByTagNameNS(xa.SVG,"stop");if(sn.length!==cn.length)continue;let An=sn.length;for(;An--;){const en=sn[An],tn=cn[An];if(en.getAttribute("offset")!==tn.getAttribute("offset")||en.getAttribute("stop-opacity")!==tn.getAttribute("stop-opacity")||en.getAttribute("stop-color")!==tn.getAttribute("stop-color"))break}if(-1===An)return an}return null},setPaintMethod=(en,tn)=>{const nn=new Paint(tn);switch(Is.setPaintOpacity(en,nn.alpha/100,!0),Is.setCurProperties(en+"_paint",nn),nn.type){case"solidColor":Is.setColor(en,"none"!==nn.solidColor?"#"+nn.solidColor:"none");break;case"linearGradient":case"radialGradient":Is.setCanvas(en+"Grad",nn[nn.type]),Is.setGradient(en)}},setStrokeWidthMethod=en=>{const tn=Is.getSelectedElements();if(0===en&&["line","path"].includes(Is.getMode()))return void Is.setStrokeWidth(1);Is.setCurProperties("stroke_width",en);const nn=[],addNonG=en=>{"g"!==en.nodeName&&nn.push(en)};let rn=tn.length;for(;rn--;){const en=tn[rn];en&&("g"===en.tagName?walkTree(en,addNonG):nn.push(en))}nn.length>0&&(Is.changeSelectedAttribute("stroke-width",en,nn),Is.call("changed",tn))},setStrokeAttrMethod=(en,tn)=>{const nn=Is.getSelectedElements();Is.setCurShape(en.replace("-","_"),tn);const rn=[];let an=nn.length;for(;an--;){const en=nn[an];en&&("g"===en.tagName?walkTree(en,(en=>{"g"!==en.nodeName&&rn.push(en)})):rn.push(en))}rn.length>0&&(Is.changeSelectedAttribute(en,tn,rn),Is.call("changed",nn))},getBoldMethod=()=>{const en=Is.getSelectedElements(),tn=en[0];return"text"===(null==tn?void 0:tn.tagName)&&!en[1]&&"bold"===tn.getAttribute("font-weight")},setBoldMethod=en=>{var tn;const nn=Is.getSelectedElements();"text"!==(null===(tn=nn[0])||void 0===tn?void 0:tn.tagName)||nn[1]||Is.changeSelectedAttribute("font-weight",en?"bold":"normal"),nn[0].textContent||Is.textActions.setCursor()},hasTextDecorationMethod=en=>{const tn=Is.getSelectedElements(),nn=tn[0];return"text"===(null==nn?void 0:nn.tagName)&&!tn[1]&&(nn.getAttribute("text-decoration")||"").includes(en)},addTextDecorationMethod=en=>{const tn=Is.getSelectedElements(),nn=tn[0];if("text"===(null==nn?void 0:nn.tagName)&&!tn[1]){const tn=nn.getAttribute("text-decoration")||"";Is.changeSelectedAttribute("text-decoration",(tn+" "+en).trim())}tn.length>0&&!tn[0].textContent&&Is.textActions.setCursor()},removeTextDecorationMethod=en=>{const tn=Is.getSelectedElements(),nn=tn[0];if("text"===(null==nn?void 0:nn.tagName)&&!tn[1]){const tn=nn.getAttribute("text-decoration")||"";Is.changeSelectedAttribute("text-decoration",tn.replace(en,"").trim())}tn.length>0&&!tn[0].textContent&&Is.textActions.setCursor()},getItalicMethod=()=>{const en=Is.getSelectedElements(),tn=en[0];return"text"===(null==tn?void 0:tn.tagName)&&!en[1]&&"italic"===tn.getAttribute("font-style")},setItalicMethod=en=>{var tn;const nn=Is.getSelectedElements();"text"!==(null===(tn=nn[0])||void 0===tn?void 0:tn.tagName)||nn[1]||Is.changeSelectedAttribute("font-style",en?"italic":"normal"),nn[0].textContent||Is.textActions.setCursor()},setTextAnchorMethod=en=>{var tn;const nn=Is.getSelectedElements();"text"!==(null===(tn=nn[0])||void 0===tn?void 0:tn.tagName)||nn[1]||Is.changeSelectedAttribute("text-anchor",en),nn.length>0&&!nn[0].textContent&&Is.textActions.setCursor()},setLetterSpacingMethod=en=>{var tn;const nn=Is.getSelectedElements();"text"!==(null===(tn=nn[0])||void 0===tn?void 0:tn.tagName)||nn[1]||Is.changeSelectedAttribute("letter-spacing",en),nn.length>0&&!nn[0].textContent&&Is.textActions.setCursor()},setWordSpacingMethod=en=>{var tn;const nn=Is.getSelectedElements();"text"!==(null===(tn=nn[0])||void 0===tn?void 0:tn.tagName)||nn[1]||Is.changeSelectedAttribute("word-spacing",en),nn.length>0&&!nn[0].textContent&&Is.textActions.setCursor()},setTextLengthMethod=en=>{var tn;const nn=Is.getSelectedElements();"text"!==(null===(tn=nn[0])||void 0===tn?void 0:tn.tagName)||nn[1]||Is.changeSelectedAttribute("textLength",en),nn.length>0&&!nn[0].textContent&&Is.textActions.setCursor()},setLengthAdjustMethod=en=>{var tn;const nn=Is.getSelectedElements();"text"!==(null===(tn=nn[0])||void 0===tn?void 0:tn.tagName)||nn[1]||Is.changeSelectedAttribute("lengthAdjust",en),nn.length>0&&!nn[0].textContent&&Is.textActions.setCursor()},getFontFamilyMethod=()=>Is.getCurText("font_family"),setFontFamilyMethod=en=>{var tn;const nn=Is.getSelectedElements();Is.setCurText("font_family",en),Is.changeSelectedAttribute("font-family",en),(null===(tn=nn[0])||void 0===tn?void 0:tn.textContent)||Is.textActions.setCursor()},setFontColorMethod=en=>{Is.setCurText("fill",en),Is.changeSelectedAttribute("fill",en)},getFontColorMethod=()=>Is.getCurText("fill"),getFontSizeMethod=()=>Is.getCurText("font_size"),setFontSizeMethod=en=>{var tn;const nn=Is.getSelectedElements();Is.setCurText("font_size",en),Is.changeSelectedAttribute("font-size",en),(null===(tn=nn[0])||void 0===tn?void 0:tn.textContent)||Is.textActions.setCursor()},getTextMethod=()=>{const en=Is.getSelectedElements()[0];return en?en.textContent:""},setTextContentMethod=en=>{Is.changeSelectedAttribute("#text",en),Is.textActions.init(en),Is.textActions.setCursor()},setImageURLMethod=en=>{const{ChangeElementCommand:tn,BatchCommand:nn}=Is.history,rn=Is.getSelectedElements()[0];if(!rn)return;const an=rn.getAttribute("width"),sn=rn.getAttribute("height"),cn=!an||!sn,An=getHref(rn);if(An===en&&!cn)return;const dn=new nn("Change Image URL");setHref(rn,en),dn.addSubCommand(new tn(rn,{"#href":An}));const un=new Image;un.onload=function(){const en={width:rn.getAttribute("width"),height:rn.getAttribute("height")};rn.setAttribute("width",this.width),rn.setAttribute("height",this.height),Is.selectorManager.requestSelector(rn).resize(),dn.addSubCommand(new tn(rn,en)),Is.addCommandToHistory(dn),Is.call("changed",[rn])},un.src=en},setLinkURLMethod=en=>{const{ChangeElementCommand:tn,BatchCommand:nn}=Is.history;let rn=Is.getSelectedElements()[0];if(!rn)return;if("a"!==rn.tagName){const en=getParents(rn.parentNode,"a");if(null==en||!en.length)return;rn=en[0]}const an=getHref(rn);if(an===en)return;const sn=new nn("Change Link URL");setHref(rn,en),sn.addSubCommand(new tn(rn,{"#href":an})),Is.addCommandToHistory(sn)},setRectRadiusMethod=en=>{const{ChangeElementCommand:tn}=Is.history,nn=Is.getSelectedElements()[0];if("rect"===(null==nn?void 0:nn.tagName)){const rn=Number(nn.getAttribute("rx"));rn!==en&&(nn.setAttribute("rx",en),nn.setAttribute("ry",en),Is.addCommandToHistory(new tn(nn,{rx:rn,ry:rn},"Radius")),Is.call("changed",[nn]))}},makeHyperlinkMethod=en=>{Is.groupSelectedElements("a",en)},removeHyperlinkMethod=()=>{Is.ungroupSelectedElement()},setSegTypeMethod=en=>{Is.pathActions.setSegType(en)},setBackgroundMethod=(en,tn)=>{const nn=getElement("canvasBackground"),rn=nn.querySelector("rect");let an=getElement("background_image"),sn=getElement("background_pattern");if(rn.setAttribute("fill","chessboard"===en?"#fff":en),"chessboard"===en){if(!sn){sn=Is.getDOMDocument().createElementNS(xa.SVG,"foreignObject"),Is.assignAttributes(sn,{id:"background_pattern",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"});const en=document.createElement("div");Is.assignAttributes(en,{style:"pointer-events:none;width:100%;height:100%;background-image:url(data:image/gif;base64,R0lGODlhEAAQAIAAAP///9bW1iH5BAAAAAAALAAAAAAQABAAAAIfjG+gq4jM3IFLJgpswNly/XkcBpIiVaInlLJr9FZWAQA7);"}),sn.append(en),nn.append(sn)}}else sn&&sn.remove();tn?(an||(an=Is.getDOMDocument().createElementNS(xa.SVG,"image"),Is.assignAttributes(an,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})),setHref(an,tn),nn.append(an)):an&&an.remove()},Ms=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"];let Rs=null;const remapElement=(en,tn,nn)=>{const remap=(en,tn)=>transformPoint(en,tn,nn),scalew=en=>nn.a*en,scaleh=en=>nn.d*en,rn=Rs.getGridSnapping()&&"svg"===en.parentNode.parentNode.localName,finishUp=()=>{rn&&Object.entries(tn).forEach((en=>{let[nn,rn]=en;tn[nn]=snapToGrid(rn)})),assignAttributes(en,tn,0,!0)},an=getBBox(en);["fill","stroke"].forEach((tn=>{const rn=en.getAttribute(tn);if(null!=rn&&rn.startsWith("url(")&&(nn.a<0||nn.d<0)){const an=getRefElem(rn).cloneNode(!0);if(nn.a<0){const en=an.getAttribute("x1"),tn=an.getAttribute("x2");an.setAttribute("x1",-(en-1)),an.setAttribute("x2",-(tn-1))}if(nn.d<0){const en=an.getAttribute("y1"),tn=an.getAttribute("y2");an.setAttribute("y1",-(en-1)),an.setAttribute("y2",-(tn-1))}an.id=Rs.getCurrentDrawing().getNextId(),findDefs().append(an),en.setAttribute(tn,"url(#"+an.id+")")}}));const sn=en.tagName;if("g"===sn||"text"===sn||"tspan"===sn||"use"===sn)if(1!==nn.a||0!==nn.b||0!==nn.c||1!==nn.d||0===nn.e&&0===nn.f){const tn=en.transform.baseVal,rn=Rs.getSvgRoot().createSVGTransform();rn.setMatrix(matrixMultiply(transformListToTransform(tn).matrix,nn)),tn.clear(),tn.appendItem(rn)}else{const rn=transformListToTransform(en).matrix,an=matrixMultiply(rn.inverse(),nn,rn);tn.x=Number.parseFloat(tn.x)+an.e,tn.y=Number.parseFloat(tn.y)+an.f}switch(sn){case"foreignObject":case"rect":case"image":if("image"===sn&&(nn.a<0||nn.d<0)){const tn=en.transform.baseVal,rn=Rs.getSvgRoot().createSVGTransform();rn.setMatrix(matrixMultiply(transformListToTransform(tn).matrix,nn)),tn.clear(),tn.appendItem(rn)}else{const en=remap(tn.x,tn.y);tn.width=scalew(tn.width),tn.height=scaleh(tn.height),tn.x=en.x+Math.min(0,tn.width),tn.y=en.y+Math.min(0,tn.height),tn.width=Math.abs(tn.width),tn.height=Math.abs(tn.height)}finishUp();break;case"ellipse":{const en=remap(tn.cx,tn.cy);tn.cx=en.x,tn.cy=en.y,tn.rx=scalew(tn.rx),tn.ry=scaleh(tn.ry),tn.rx=Math.abs(tn.rx),tn.ry=Math.abs(tn.ry),finishUp();break}case"circle":{const en=remap(tn.cx,tn.cy);tn.cx=en.x,tn.cy=en.y;const rn=transformBox(an.x,an.y,an.width,an.height,nn),sn=rn.tr.x-rn.tl.x,cn=rn.bl.y-rn.tl.y;tn.r=Math.min(sn/2,cn/2),tn.r&&(tn.r=Math.abs(tn.r)),finishUp();break}case"line":{const en=remap(tn.x1,tn.y1),nn=remap(tn.x2,tn.y2);tn.x1=en.x,tn.y1=en.y,tn.x2=nn.x,tn.y2=nn.y}case"text":case"tspan":case"use":finishUp();break;case"g":{const nn=Rs.getDataStorage().get(en,"gsvg");nn&&assignAttributes(nn,tn,0,!0);break}case"polyline":case"polygon":{tn.points.forEach((en=>{const{x:tn,y:nn}=remap(en.x,en.y);en.x=tn,en.y=nn}));let nn="";tn.points.forEach((en=>{nn+=en.x+","+en.y+" "})),en.setAttribute("points",nn);break}case"path":{const nn=en.pathSegList;let rn=nn.numberOfItems;tn.d=[];for(let en=0;en0&&(sn=remap(an.x,an.y),tn.d[0].x=sn.x,tn.d[0].y=sn.y);for(let en=1;en{const{type:tn}=en;switch(cn+=Ms[tn],tn){case 13:case 12:cn+=en.x+" ";break;case 15:case 14:cn+=en.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:cn+=en.x+","+en.y+" ";break;case 7:case 6:cn+=en.x1+","+en.y1+" "+en.x2+","+en.y2+" "+en.x+","+en.y+" ";break;case 9:case 8:cn+=en.x1+","+en.y1+" "+en.x+","+en.y+" ";break;case 11:case 10:cn+=en.r1+","+en.r2+" "+en.angle+" "+Number(en.largeArcFlag)+" "+Number(en.sweepFlag)+" "+en.x+","+en.y+" ";break;case 17:case 16:cn+=en.x2+","+en.y2+" "+en.x+","+en.y+" "}})),en.setAttribute("d",cn);break}}}; /** * Recalculate. * @module recalculate * @license MIT */let Os;const updateClipPath=(en,tn,nn)=>{const rn=getRefElem(en).firstChild,an=rn.transform.baseVal,sn=Os.getSvgRoot().createSVGTransform();sn.setTranslate(tn,nn),an.appendItem(sn),recalculateDimensions(rn)},recalculateDimensions=en=>{var tn;if(!en)return null;const nn=Os.getSvgRoot(),rn=Os.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{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=Os.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=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=Os.getStartTransform(),Os.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),an.appendItem(hn),an.appendItem(pn),an.appendItem(un)}cn.addSubCommand(recalculateDimensions(en)),Os.setStartTransform(pn)}}an.removeItem(sn-1),an.removeItem(sn-2),an.removeItem(sn-3)}else if(sn>=3&&1===an.getItem(sn-1).type){yn=3;const en=transformListToTransform(an).matrix,tn=nn.createSVGTransform();tn.setMatrix(en),an.clear(),an.appendItem(tn)}else if((1===sn||sn>1&&3!==an.getItem(1).type)&&2===an.getItem(0).type){yn=2;const tn=transformListToTransform(an).matrix;an.removeItem(0);const rn=transformListToTransform(an).matrix.inverse(),sn=matrixMultiply(rn,tn);if(hn=sn.e,fn=sn.f,0!==hn||0!==fn){const tn=en.childNodes;let rn=tn.length;const an=[];for(;rn--;){const sn=tn.item(rn);if(1===sn.nodeType){var gn;if(sn.getAttribute("clip-path")){const en=sn.getAttribute("clip-path");an.includes(en)||(updateClipPath(en,hn,fn),an.push(en))}pn=Os.getStartTransform(),Os.setStartTransform(sn.getAttribute("transform"));const tn=null===(gn=sn.transform)||void 0===gn?void 0:gn.baseVal;if(tn){const rn=nn.createSVGTransform();rn.setTranslate(hn,fn),tn.numberOfItems?tn.insertItemBefore(rn,0):tn.appendItem(rn),cn.addSubCommand(recalculateDimensions(sn));const an=en.getElementsByTagNameNS(xa.SVG,"use"),An="#"+sn.id;let dn=an.length;for(;dn--;){const en=an.item(dn);if(An===getHref(en)){const tn=nn.createSVGTransform();tn.setTranslate(-hn,-fn),en.transform.baseVal.insertItemBefore(tn,0),cn.addSubCommand(recalculateDimensions(en))}}Os.setStartTransform(pn)}}}Os.setStartTransform(pn)}}else{if(1!==sn||1!==an.getItem(0).type||rn){if(rn){const en=nn.createSVGTransform();en.setRotate(rn,dn.x,dn.y),an.numberOfItems?an.insertItemBefore(en,0):an.appendItem(en)}return 0===an.numberOfItems&&en.removeAttribute("transform"),null}{yn=1;const tn=an.getItem(0).matrix,rn=en.childNodes;let sn=rn.length;for(;sn--;){const en=rn.item(sn);if(1===en.nodeType){var _n;pn=Os.getStartTransform(),Os.setStartTransform(en.getAttribute("transform"));const rn=null===(_n=en.transform)||void 0===_n?void 0:_n.baseVal;if(!rn)continue;const an=matrixMultiply(tn,transformListToTransform(rn).matrix),sn=nn.createSVGTransform();sn.setMatrix(an),rn.clear(),rn.appendItem(sn,0),cn.addSubCommand(recalculateDimensions(en)),Os.setStartTransform(pn);const An=en.getAttribute("stroke-width");if("none"!==en.getAttribute("stroke")&&!isNaN(An)){const tn=(Math.abs(an.a)+Math.abs(an.d))/2;en.setAttribute("stroke-width",An*tn)}}}an.clear()}}if(2===yn){if(rn){dn={x:An.x+un.e,y:An.y+un.f};const en=nn.createSVGTransform();en.setRotate(rn,dn.x,dn.y),an.numberOfItems?an.insertItemBefore(en,0):an.appendItem(en)}}else if(3===yn){const tn=transformListToTransform(an).matrix,sn=nn.createSVGTransform();sn.setRotate(rn,An.x,An.y);const un=sn.matrix,gn=nn.createSVGTransform();gn.setRotate(rn,dn.x,dn.y);const _n=gn.matrix.inverse(),yn=tn.inverse(),bn=matrixMultiply(yn,_n,un,tn);if(hn=bn.e,fn=bn.f,0!==hn||0!==fn){const tn=en.childNodes;let rn=tn.length;for(;rn--;){const en=tn.item(rn);if(1===en.nodeType){var mn;pn=Os.getStartTransform(),Os.setStartTransform(en.getAttribute("transform"));const tn=null===(mn=en.transform)||void 0===mn?void 0:mn.baseVal,rn=nn.createSVGTransform();rn.setTranslate(hn,fn),tn.numberOfItems?tn.insertItemBefore(rn,0):tn.appendItem(rn),cn.addSubCommand(recalculateDimensions(en)),Os.setStartTransform(pn)}}}rn&&(an.numberOfItems?an.insertItemBefore(gn,0):an.appendItem(gn))}}else{const tn=getBBox(en);if(!tn&&"path"!==en.tagName)return null;let rn;const sn=getRotationAngle(en);if(sn){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 en=sn*Math.PI/180,nn=Math.abs(en)>1e-10?Math.sin(en)/(1-Math.cos(en)):2/en;for(let en=0;en=3&&3===an.getItem(pn-2).type&&2===an.getItem(pn-3).type&&2===an.getItem(pn-1).type)cn=3,rn=transformListToTransform(an,pn-3,pn-1).matrix,an.removeItem(pn-1),an.removeItem(pn-2),an.removeItem(pn-3);else if(4===pn&&1===an.getItem(pn-1).type){cn=3,rn=transformListToTransform(an).matrix;const en=nn.createSVGTransform();en.setMatrix(rn),an.clear(),an.appendItem(en),rn=nn.createSVGMatrix()}else if((1===pn||pn>1&&3!==an.getItem(1).type)&&2===an.getItem(0).type){cn=2;const en=an.getItem(0).matrix,tn=transformListToTransform(an,1).matrix,nn=tn.inverse();rn=matrixMultiply(nn,en,tn),an.removeItem(0)}else{if(1!==pn||1!==an.getItem(0).type||sn){if(sn){const en=nn.createSVGTransform();en.setRotate(sn,dn.x,dn.y),an.numberOfItems?an.insertItemBefore(en,0):an.appendItem(en)}return 0===an.numberOfItems&&en.removeAttribute("transform"),null}switch(rn=transformListToTransform(an).matrix,en.tagName){case"line":un={x1:en.getAttribute("x1"),y1:en.getAttribute("y1"),x2:en.getAttribute("x2"),y2:en.getAttribute("y2")};case"polyline":case"polygon":if(un.points=en.getAttribute("points"),un.points){const tn=en.points,nn=tn.numberOfItems;un.points=new Array(nn);for(let en=0;en{const[en]=zs.getSelectedElements();if(en){const tn=en,nn=tn.parentNode,rn=tn.nextSibling;tn.parentNode.append(tn),rn!==tn.nextSibling&&(zs.addCommandToHistory(new Qs(tn,rn,nn,"top")),zs.call("changed",[tn]))}},moveToBottomSelectedElem=()=>{const[en]=zs.getSelectedElements();if(en){let tn=en;const nn=tn.parentNode,rn=tn.nextSibling;let{firstChild:an}=tn.parentNode;"title"===an.tagName&&(an=an.nextSibling),"defs"===an.tagName&&(an=an.nextSibling),tn=tn.parentNode.insertBefore(tn,an),rn!==tn.nextSibling&&(zs.addCommandToHistory(new Qs(tn,rn,nn,"bottom")),zs.call("changed",[tn]))}},moveUpDownSelected=en=>{const tn=zs.getSelectedElements()[0];if(!tn)return;let nn,rn;zs.setCurBBoxes([]);const an=zs.getIntersectionList(getStrokedBBoxDefaultVisible([tn]));if("Down"===en&&an.reverse(),Array.prototype.forEach.call(an,(en=>rn?(void 0===nn&&(nn=en),!1):(en===tn&&(rn=!0),!0))),!nn)return;const sn=tn,cn=sn.parentNode,An=sn.nextSibling;"Down"===en?nn.insertAdjacentElement("beforebegin",sn):nn.insertAdjacentElement("afterend",sn),An!==sn.nextSibling&&(zs.addCommandToHistory(new Qs(sn,An,cn,"Move "+en)),zs.call("changed",[sn]))},moveSelectedElements=function(en,tn){let nn=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const rn=zs.getSelectedElements(),an=zs.getZoom();Array.isArray(en)||(en/=an,tn/=an);const sn=new Vs("position");if(rn.forEach(((nn,rn)=>{if(nn){var an;const cn=zs.getSvgRoot().createSVGTransform(),An=null===(an=nn.transform)||void 0===an?void 0:an.baseVal;Array.isArray(en)?cn.setTranslate(en[rn],tn[rn]):cn.setTranslate(en,tn),An.numberOfItems?An.insertItemBefore(cn,0):An.appendItem(cn);const dn=recalculateDimensions(nn);dn&&sn.addSubCommand(dn),zs.gettingSelectorManager().requestSelector(nn).resize()}})),!sn.isEmpty())return nn&&zs.addCommandToHistory(sn),zs.call("changed",rn),sn},cloneSelectedElements=(en,tn)=>{const nn=zs.getSelectedElements(),rn=zs.getCurrentGroup();let an,sn;const cn=new Vs("Clone Elements"),An=nn.length,index=en=>{if(!en)return-1;let tn=0;do{tn++}while(en===en.previousElementSibling);return tn};for(nn.sort(((en,tn)=>index(tn)-index(en))),an=0;an{const nn=zs.getSelectedElements(),rn=[],an=nn.length;if(!an)return;let sn=Number.MAX_VALUE,cn=Number.MIN_VALUE,An=Number.MAX_VALUE,dn=Number.MIN_VALUE;const isHorizontalAlign=en=>["l","c","r","left","center","right"].includes(en),isVerticalAlign=en=>["t","m","b","top","middle","bottom"].includes(en);for(let en=0;enen.width-tn.width)),tn=en[0];sn=tn.x,An=tn.y,cn=tn.x+tn.width,dn=tn.y+tn.height}break;case"largest":if(isHorizontalAlign(en)||isVerticalAlign(en)){const en=rn.slice().sort(((en,tn)=>en.width-tn.width)),tn=en[rn.length-1];sn=tn.x,An=tn.y,cn=tn.x+tn.width,dn=tn.y+tn.height}break;case"page":sn=0,An=0,cn=zs.getContentW(),dn=zs.getContentH();break;default:sn=Math.min(...rn.map((en=>en.x))),An=Math.min(...rn.map((en=>en.y))),cn=Math.max(...rn.map((en=>en.x+en.width))),dn=Math.max(...rn.map((en=>en.y+en.height)))}let un=[],pn=[];["dh","distrib_horiz"].includes(en)?[un,pn]=_getDistributeHorizontalDistances(tn,nn,rn,sn,cn,An,dn):["dv","distrib_verti"].includes(en)?[un,pn]=_getDistributeVerticalDistances(tn,nn,rn,sn,cn,An,dn):[un,pn]=_getNormalDistances(en,nn,rn,sn,cn,An,dn),moveSelectedElements(un,pn)},_getDistributeHorizontalDistances=(en,tn,nn,rn,an,sn,cn)=>{const An=[],dn=[];for(let en=0;en{const nn=en.x+en.width,rn=tn.x+tn.width;return nn===rn?0:nn>rn?1:-1}));"page"===en&&(un.unshift({x:0,y:0,width:0,height:cn}),un.push({x:an,y:0,width:0,height:cn}));const pn=an-rn,hn=un.map((en=>en.width)).reduce(((en,tn)=>en+tn),0),gn=(pn-hn)/(un.length-1),_n=[];for(let en=0;en{const rn=nn.findIndex((tn=>tn===en));-1!==rn&&(An[rn]=_n[tn])})),[An,dn]},_getDistributeVerticalDistances=(en,tn,nn,rn,an,sn,cn)=>{const An=[],dn=[];for(let en=0;en{const nn=en.y+en.height,rn=tn.y+tn.height;return nn===rn?0:nn>rn?1:-1}));"page"===en&&(un.unshift({x:0,y:0,width:an,height:0}),un.push({x:0,y:cn,width:an,height:0}));const pn=cn-sn,hn=un.map((en=>en.height)).reduce(((en,tn)=>en+tn),0),gn=(pn-hn)/(un.length-1),_n=[];for(let en=0;en{const rn=nn.findIndex((tn=>tn===en));-1!==rn&&(dn[rn]=_n[tn])})),[An,dn]},_getNormalDistances=(en,tn,nn,rn,an,sn,cn)=>{const An=tn.length,dn=new Array(An),un=new Array(An);for(let pn=0;pn{const en=zs.getSelectedElements(),tn=new Vs("Delete Elements"),nn=[];en.forEach((en=>{if(en){let rn=en.parentNode,an=en;zs.gettingSelectorManager().releaseSelector(an),removePath_(an.id),"a"===rn.tagName&&1===rn.childNodes.length&&(an=rn,rn=rn.parentNode);const{nextSibling:sn}=an;an.remove();const cn=an;nn.push(en),tn.addSubCommand(new Ds(cn,sn,rn))}})),zs.setEmptySelectedElements(),tn.isEmpty()||zs.addCommandToHistory(tn),zs.call("changed",nn),zs.clearSelection()},copySelectedElements=()=>{const en=zs.getSelectedElements(),tn=JSON.stringify(en.map((en=>zs.getJsonFromSvgElements(en))));sessionStorage.setItem(zs.getClipboardID(),tn),zs.flashStorage(),document.getElementById("se-cmenu_canvas").setAttribute("enablemenuitems","#paste,#paste_in_place")},groupSelectedElements=(en,tn)=>{const nn=zs.getSelectedElements();en||(en="g");let rn,an="";"a"===en?(an="Make hyperlink",rn=tn||""):(en="g",an="Group Elements");const sn=new Vs(an),cn=zs.addSVGElementsFromJson({element:en,attr:{id:zs.getNextId()}});"a"===en&&setHref(cn,rn),sn.addSubCommand(new Gs(cn));let An=nn.length;for(;An--;){let en=nn[An];if(!en)continue;"a"===en.parentNode.tagName&&1===en.parentNode.childNodes.length&&(en=en.parentNode);const tn=en.nextSibling,rn=en.parentNode;cn.append(en),sn.addSubCommand(new Qs(en,tn,rn))}sn.isEmpty()||zs.addCommandToHistory(sn),zs.selectOnly([cn],!0)},pushGroupProperty=(en,tn)=>{const nn=en.childNodes,rn=nn.length,an=en.getAttribute("transform"),sn=en.transform.baseVal,cn=transformListToTransform(sn).matrix,An=new Vs("Push group properties"),dn=getRotationAngle(en),un={filter:en.getAttribute("filter"),opacity:en.getAttribute("opacity")};let pn,hn,gn;const _n=zs.getDrawing();for(let tn=0;tn{const tn=zs.getSelectedElements();en||(en=tn[0]);const nn=en,rn=new Vs;let an;const sn=zs.getDataStorage();if(sn.has(nn,"gsvg")){const tn=en.firstChild,nn={x:Number(tn.getAttribute("x")),y:Number(tn.getAttribute("y"))},rn=en.firstChild.firstChild;rn&&(rn.outerHTML=rn.innerHTML),sn.remove(en,"gsvg");const an=en.transform.baseVal,cn=zs.getSvgRoot().createSVGTransform();cn.setTranslate(nn.x,nn.y),an.appendItem(cn),recalculateDimensions(en),zs.call("selected",[en])}else if(sn.has(nn,"symbol")){en=sn.get(nn,"symbol"),an=nn.getAttribute("transform");const tn={x:Number(nn.getAttribute("x")),y:Number(nn.getAttribute("y"))},cn=en.getAttribute("viewBox");if(cn){const en=cn.split(" ");tn.x-=Number(en[0]),tn.y-=Number(en[1])}an+=" translate("+(tn.x||0)+","+(tn.y||0)+")";const An=nn.previousElementSibling;rn.addSubCommand(new Ds(nn,nn.nextElementSibling,nn.parentNode)),nn.remove();const dn=zs.getSvgContent().querySelectorAll("use").length,un=zs.getDOMDocument().createElementNS(xa.SVG,"g"),pn=en.childNodes;let hn;for(hn=0;hntn;tn++)un.appendChild(en[tn].cloneNode(!0))}an&&un.setAttribute("transform",an);const gn=en.parentNode;if(zs.uniquifyElems(un),isGecko$1()){const en=findDefs(),tn=un.querySelectorAll("linearGradient,radialGradient,pattern");for(let nn=0,rn=tn.length;rn>nn;nn++)en.appendChild(tn[nn])}if(un.id=zs.getNextId(),An.after(un),gn){if(!dn){const{nextSibling:tn}=en;en.remove(),rn.addSubCommand(new Ds(en,tn,gn))}rn.addSubCommand(new Gs(un))}zs.setUseData(un),isGecko$1()?zs.convertGradients(findDefs()):zs.convertGradients(un),((en,tn)=>{if(1===(null==en?void 0:en.nodeType)){let nn=en.childNodes.length;for(;nn--;)walkTree(en.childNodes.item(nn),tn);tn(en)}})(un,(en=>{try{recalculateDimensions(en)}catch(en){console.error(en)}}));const _n=un.querySelectorAll(zs.getVisElems());Array.prototype.forEach.call(_n,(en=>{en.id||(en.id=zs.getNextId())})),zs.selectOnly([un]);const mn=pushGroupProperty(un,!0);mn&&rn.addSubCommand(mn),zs.addCommandToHistory(rn)}else console.warn("Unexpected element to ungroup:",en)},ungroupSelectedElement=()=>{const en=zs.getSelectedElements(),tn=zs.getDataStorage();let nn=en[0];if(!nn)return;if(tn.has(nn,"gsvg")||tn.has(nn,"symbol"))return void convertToGroup(nn);if("use"===nn.tagName){const en=getElement(getHref(nn).substr(1));return tn.put(nn,"symbol",en),tn.put(nn,"ref",en),void convertToGroup(nn)}const rn=getParents(nn.parentNode,"a");if(null!=rn&&rn.length&&(nn=rn[0]),"g"===nn.tagName||"a"===nn.tagName){const en=new Vs("Ungroup Elements"),tn=pushGroupProperty(nn,!0);tn&&en.addSubCommand(tn);const rn=nn.parentNode,an=nn.nextSibling,sn=new Array(nn.childNodes.length);let cn=0;for(;nn.firstChild;){const tn=nn.firstChild,An=tn.nextSibling,dn=tn.parentNode;if("title"!==tn.tagName)sn[cn++]=rn.insertBefore(tn,an),en.addSubCommand(new Qs(tn,An,dn));else{const{nextSibling:nn}=tn;en.addSubCommand(new Ds(tn,nn,dn)),tn.remove()}}zs.clearSelection();const An=nn.nextSibling;nn.remove(),en.addSubCommand(new Ds(nn,An,rn)),en.isEmpty()||zs.addCommandToHistory(en),zs.addToSelection(sn)}},updateCanvas=(en,tn)=>{zs.getSvgRoot().setAttribute("width",en),zs.getSvgRoot().setAttribute("height",tn);const nn=zs.getZoom(),rn=document.getElementById("canvasBackground"),an=Number(zs.getSvgContent().getAttribute("x")),sn=Number(zs.getSvgContent().getAttribute("y")),cn=(en-zs.contentW*nn)/2,An=(tn-zs.contentH*nn)/2;assignAttributes(zs.getSvgContent(),{width:zs.contentW*nn,height:zs.contentH*nn,x:cn,y:An,viewBox:"0 0 "+zs.contentW+" "+zs.contentH}),assignAttributes(rn,{width:zs.getSvgContent().getAttribute("width"),height:zs.getSvgContent().getAttribute("height"),x:cn,y:An});const dn=getElement("background_image");return dn&&assignAttributes(dn,{width:"100%",height:"100%"}),zs.selectorManager.selectorParentGroup.setAttribute("transform","translate("+cn+","+An+")"),zs.runExtensions("canvasUpdated",{new_x:cn,new_y:An,old_x:an,old_y:sn,d_x:cn-an,d_y:An-sn}),{x:cn,y:An,old_x:an,old_y:sn,d_x:cn-an,d_y:An-sn}},cycleElement=en=>{const tn=zs.getSelectedElements(),nn=zs.getCurrentGroup();let rn;const an=tn[0];let sn=!1;const cn=getVisibleElements(nn||zs.getCurrentDrawing().getCurrentLayer());if(cn.length){if(an){let tn=cn.length;for(;tn--;)if(cn[tn]===an){rn=en?tn-1:tn+1,rn>=cn.length?rn=0:rn<0&&(rn=cn.length-1),sn=cn[rn];break}}else rn=en?cn.length-1:0,sn=cn[rn];zs.selectOnly([sn],!0),zs.call("selected",tn)}}; /** * Tools for blur event. * @module blur * @license MIT * @copyright 2011 Jeff Schiller */let Ks=null;const setBlurNoUndo=function(en){const tn=Ks.getSelectedElements();if(Ks.getFilter())if(0===en)Ks.changeSelectedAttributeNoUndo("filter",""),Ks.setFilterHidden(!0);else{const nn=tn[0];Ks.getFilterHidden()&&Ks.changeSelectedAttributeNoUndo("filter","url(#"+nn.id+"_blur)");const rn=Ks.getFilter();Ks.changeSelectedAttributeNoUndo("stdDeviation",en,[rn.firstChild]),Ks.setBlurOffsets(rn,en)}else Ks.setBlur(en)};function finishChange(){const en=Ks.undoMgr.finishUndoableChange();Ks.getCurCommand().addSubCommand(en),Ks.addCommandToHistory(Ks.getCurCommand()),Ks.setCurCommand(null),Ks.setFilter(null)}const setBlurOffsets=function(en,tn){tn>3?Ks.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}=Ks.history,sn=Ks.getSelectedElements();if(Ks.getCurCommand())return void finishChange();const cn=sn[0],An=cn.id;Ks.setFilter(Ks.getElement(An+"_blur")),en-=0;const dn=new an;if(Ks.getFilter())0===en&&Ks.setFilter(null);else{const tn=Ks.addSVGElementsFromJson({element:"feGaussianBlur",attr:{in:"SourceGraphic",stdDeviation:en}});Ks.setFilter(Ks.addSVGElementsFromJson({element:"filter",attr:{id:An+"_blur"}})),Ks.getFilter().append(tn),Ks.findDefs().append(Ks.getFilter()),dn.addSubCommand(new nn(Ks.getFilter()))}const un={filter:cn.getAttribute("filter")};if(0===en)return cn.removeAttribute("filter"),void dn.addSubCommand(new rn(cn,un));Ks.changeSelectedAttribute("filter","url(#"+An+"_blur)"),dn.addSubCommand(new rn(cn,un)),Ks.setBlurOffsets(Ks.getFilter(),en);const pn=Ks.getFilter();Ks.setCurCommand(dn),Ks.undoMgr.beginUndoableChange("stdDeviation",[pn?pn.firstChild:null]),tn&&(Ks.setBlurNoUndo(en),finishChange())},$s=getReverseNS(),Ws=["class","id","display","transform","style"],Xs={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","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage","x1","x2","y1","y2"],linearGradient:["gradientTransform","gradientUnits","requiredFeatures","spreadMethod","systemLanguage","x1","x2","xlink:href","y1","y2"],marker:["markerHeight","markerUnits","markerWidth","orient","preserveAspectRatio","refX","refY","se_type","systemLanguage","viewBox"],mask:["height","maskContentUnits","maskUnits","width","x","y"],metadata:[],path:["clip-path","clip-rule","d","enable-background","fill","fill-opacity","fill-rule","filter","marker-end","marker-mid","marker-start","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage"],pattern:["height","patternContentUnits","patternTransform","patternUnits","requiredFeatures","systemLanguage","viewBox","width","x","xlink:href","y"],polygon:["clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","marker-end","marker-mid","marker-start","mask","opacity","points","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage","sides","shape","edge","point","starRadiusMultiplier","r","radialshift","r2","orient","cx","cy"],polyline:["clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","marker-end","marker-mid","marker-start","mask","opacity","points","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage","se:connector"],radialGradient:["cx","cy","fx","fy","gradientTransform","gradientUnits","r","requiredFeatures","spreadMethod","systemLanguage","xlink:href"],rect:["clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","height","mask","opacity","requiredFeatures","rx","ry","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage","width","x","y"],stop:["offset","requiredFeatures","stop-opacity","systemLanguage","stop-color","gradientUnits","gradientTransform"],style:["type"],svg:["clip-path","clip-rule","enable-background","filter","height","mask","preserveAspectRatio","requiredFeatures","systemLanguage","version","viewBox","width","x","xmlns","xmlns:se","xmlns:xlink","xmlns:oi","oi:animations","y","stroke-linejoin","fill-rule","aria-label","stroke-width","fill-rule","xml:space"],switch:["requiredFeatures","systemLanguage"],symbol:["fill","fill-opacity","fill-rule","filter","font-family","font-size","font-style","font-weight","opacity","overflow","preserveAspectRatio","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage","viewBox","width","height"],text:["clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","font-family","font-size","font-style","font-weight","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage","text-anchor","letter-spacing","word-spacing","text-decoration","textLength","lengthAdjust","x","xml:space","y"],textPath:["method","requiredFeatures","spacing","startOffset","systemLanguage","xlink:href"],title:[],tspan:["clip-path","clip-rule","dx","dy","fill","fill-opacity","fill-rule","filter","font-family","font-size","font-style","font-weight","mask","opacity","requiredFeatures","rotate","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","systemLanguage","text-anchor","textLength","x","xml:space","y"],use:["clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","height","mask","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","width","x","xlink:href","y","overflow"],annotation:["encoding"],"annotation-xml":["encoding"],maction:["actiontype","other","selection"],math:["xmlns"],menclose:["notation"],merror:[],mfrac:["linethickness"],mi:["mathvariant"],mmultiscripts:[],mn:[],mo:["fence","lspace","maxsize","minsize","rspace","stretchy"],mover:[],mpadded:["lspace","width","height","depth","voffset"],mphantom:[],mprescripts:[],mroot:[],mrow:["xlink:href","xlink:type","xmlns:xlink"],mspace:["depth","height","width"],msqrt:[],mstyle:["displaystyle","mathbackground","mathcolor","mathvariant","scriptlevel"],msub:[],msubsup:[],msup:[],mtable:["align","columnalign","columnlines","columnspacing","displaystyle","equalcolumns","equalrows","frame","rowalign","rowlines","rowspacing","width"],mtd:["columnalign","columnspan","rowalign","rowspan"],mtext:[],mtr:["columnalign","rowalign"],munder:[],munderover:[],none:[],semantics:[]};Object.keys(Xs).forEach((en=>{Xs[en]=[...Xs[en],...Ws]}));const Ys={};Object.entries(Xs).forEach((en=>{let[tn,nn]=en;const rn={};Object.entries(nn).forEach((en=>{let[tn,nn]=en;if(nn.includes(":")){const en=nn.split(":");rn[en[1]]=xa[en[0].toUpperCase()]}else rn[nn]="xmlns"===nn?xa.XMLNS:null})),Ys[tn]=rn}));const sanitizeSvg=en=>{if(3===en.nodeType&&(en.nodeValue=en.nodeValue.trim(),en.nodeValue.length||en.remove()),1!==en.nodeType)return;const tn=en.ownerDocument,nn=en.parentNode;if(!tn||!nn)return;const rn=Xs[en.nodeName],an=Ys[en.nodeName];if(void 0!==rn){const tn=[];let nn=en.attributes.length;for(;nn--;){const sn=en.attributes.item(nn),cn=sn.nodeName,An=sn.localName,dn=sn.namespaceURI;if(dn!==an[An]&&dn!==xa.XMLNS&&(dn!==xa.XMLNS||!$s[sn.value]))if(cn.startsWith("se:")||cn.startsWith("oi:")||cn.startsWith("data-")){const en=cn.startsWith("se:")?xa.SE:cn.startsWith("oi:")?xa.OI:null;tn.push([cn,sn.value,en])}else console.warn("sanitizeSvg: attribute ".concat(cn," in element ").concat(en.nodeName," not in whitelist is removed")),en.removeAttributeNS(dn,An);if("style"===cn){const tn=sn.value.split(";");let nn=tn.length;for(;nn--;){const[an,sn]=tn[nn].split(":"),cn=(an||"").trim(),An=(sn||"").trim();rn.includes(cn)&&en.setAttribute(cn,An)}en.removeAttribute("style")}}Object.values(tn).forEach((tn=>{let[nn,rn,an]=tn;en.setAttributeNS(an,nn,rn)}));const sn=getHref(en);if(sn&&["filter","linearGradient","pattern","radialGradient","textPath","use"].includes(en.nodeName)&&"#"!==sn[0]&&(setHref(en,""),console.warn("sanitizeSvg: attribute href in element ".concat(en.nodeName," pointing to a non-local reference (").concat(sn,") is removed")),en.removeAttributeNS(xa.XLINK,"href")),"use"===en.nodeName&&!getHref(en))return console.warn("sanitizeSvg: element ".concat(en.nodeName," without a xlink:href is removed")),void en.remove();for(Object.values(["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],(tn=>{let nn=en.getAttribute(tn);nn&&(nn=getUrlFromAttr(nn),nn&&"#"!==nn[0]&&(en.setAttribute(tn,""),console.warn("sanitizeSvg: attribute ".concat(tn," in element ").concat(en.nodeName," pointing to a non-local reference (").concat(nn,") is removed")),en.removeAttribute(tn)))})),nn=en.childNodes.length;nn--;)sanitizeSvg(en.childNodes.item(nn))}else{console.warn("sanitizeSvg: element ".concat(en.nodeName," not supported is removed"));const tn=[];for(;en.hasChildNodes();)tn.push(nn.insertBefore(en.firstChild,en));en.remove();let rn=tn.length;for(;rn--;)sanitizeSvg(tn[rn])}};function _typeof$1(en){return _typeof$1="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$1(en)}var Zs=Uint8Array,Js=Uint16Array,el=Uint32Array,tl=new Zs([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),nl=new Zs([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),rl=new Zs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=function(en,tn){for(var nn=new Js(31),rn=0;rn<31;++rn)nn[rn]=tn+=1<>>1|(21845&dl)<<1;ul=(61680&(ul=(52428&ul)>>>2|(13107&ul)<<2))>>>4|(3855&ul)<<4,Al[dl]=((65280&ul)>>>8|(255&ul)<<8)>>>1}var hMap=function(en,tn,nn){for(var rn=en.length,an=0,sn=new Js(tn);an>>dn]=un}else for(cn=new Js(rn),an=0;an>>15-en[an];return cn},pl=new Zs(288);for(dl=0;dl<144;++dl)pl[dl]=8;for(dl=144;dl<256;++dl)pl[dl]=9;for(dl=256;dl<280;++dl)pl[dl]=7;for(dl=280;dl<288;++dl)pl[dl]=8;var hl=new Zs(32);for(dl=0;dl<32;++dl)hl[dl]=5;var gl=hMap(pl,9,0),_l=hMap(pl,9,1),ml=hMap(hl,5,0),fl=hMap(hl,5,1),max$3=function(en){for(var tn=en[0],nn=1;nntn&&(tn=en[nn]);return tn},bits=function(en,tn,nn){var rn=tn/8>>0;return(en[rn]|en[rn+1]<<8)>>>(7&tn)&nn},bits16=function(en,tn){var nn=tn/8>>0;return(en[nn]|en[nn+1]<<8|en[nn+2]<<16)>>>(7&tn)},shft=function(en){return(en/8>>0)+(7&en&&1)},slc=function(en,tn,nn){(null==tn||tn<0)&&(tn=0),(null==nn||nn>en.length)&&(nn=en.length);var rn=new(en instanceof Js?Js:en instanceof el?el:Zs)(nn-tn);return rn.set(en.subarray(tn,nn)),rn},wbits=function(en,tn,nn){nn<<=7&tn;var rn=tn/8>>0;en[rn]|=nn,en[rn+1]|=nn>>>8},wbits16=function(en,tn,nn){nn<<=7&tn;var rn=tn/8>>0;en[rn]|=nn,en[rn+1]|=nn>>>8,en[rn+2]|=nn>>>16},hTree=function(en,tn){for(var nn=[],rn=0;rngn&&(gn=sn[rn].s);var _n=new Js(gn+1),mn=ln(nn[pn-1],_n,0);if(mn>tn){rn=0;var fn=0,yn=mn-tn,bn=1<tn))break;fn+=bn-(1<>>=yn;fn>0;){var wn=sn[rn].s;_n[wn]=0&&fn;--rn){var xn=sn[rn].s;_n[xn]==tn&&(--_n[xn],++fn)}mn=tn}return[new Zs(_n),mn]},ln=function(en,tn,nn){return-1==en.s?Math.max(ln(en.l,tn,nn+1),ln(en.r,tn,nn+1)):tn[en.s]=nn},lc=function(en){for(var tn=en.length;tn&&!en[--tn];);for(var nn=new Js(++tn),rn=0,an=en[0],sn=1,w=function(en){nn[rn++]=en},cn=1;cn<=tn;++cn)if(en[cn]==an&&cn!=tn)++sn;else{if(!an&&sn>2){for(;sn>138;sn-=138)w(32754);sn>2&&(w(sn>10?sn-11<<5|28690:sn-3<<5|12305),sn=0)}else if(sn>3){for(w(an),--sn;sn>6;sn-=6)w(8304);sn>2&&(w(sn-3<<5|8208),sn=0)}for(;sn--;)w(an);sn=1,an=en[cn]}return[nn.subarray(0,rn),tn]},clen=function(en,tn){for(var nn=0,rn=0;rn>>8,en[an+2]=255^en[an],en[an+3]=255^en[an+1];for(var sn=0;sn4&&!jn[rl[Pn-1]];--Pn);var Tn,Fn,Un,Nn,In=un+5<<3,Mn=clen(an,pl)+clen(sn,hl)+cn,Rn=clen(an,gn)+clen(sn,fn)+cn+14+3*Pn+clen(Sn,jn)+(2*Sn[16]+3*Sn[17]+7*Sn[18]);if(In<=Mn&&In<=Rn)return wfblk(tn,pn,en.subarray(dn,dn+un));if(wbits(tn,pn,1+(Rn15&&(wbits(tn,pn,Vn[Bn]>>>5&127),pn+=Vn[Bn]>>>12)}}}else Tn=gl,Fn=pl,Un=ml,Nn=hl;for(Bn=0;Bn255){Gn=rn[Bn]>>>18&31,wbits16(tn,pn,Tn[Gn+257]),pn+=Fn[Gn+257],Gn>7&&(wbits(tn,pn,rn[Bn]>>>23&31),pn+=tl[Gn]);var Dn=31&rn[Bn];wbits16(tn,pn,Un[Dn]),pn+=Nn[Dn],Dn>3&&(wbits16(tn,pn,rn[Bn]>>>5&8191),pn+=nl[Dn])}else wbits16(tn,pn,Tn[rn[Bn]]),pn+=Fn[rn[Bn]];return wbits16(tn,pn,Tn[256]),pn+Fn[256]},yl=new el([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),bl=new Zs(0);function zlibSync(en,tn){void 0===tn&&(tn={});var nn=function(){var en=1,tn=0;return{p:function(nn){for(var rn=en,an=tn,sn=nn.length,cn=0;cn!=sn;){for(var An=Math.min(cn+5552,sn);cn>>8<<16|(255&tn)<<8|tn>>>8)+2*((255&en)<<23)}}}();nn.p(en);var rn=function(en,tn,nn,rn,an){return function(en,tn,nn,rn,an,sn){var cn=en.length,An=new Zs(rn+cn+5*(1+Math.floor(cn/7e3))+an),dn=An.subarray(rn,An.length-an),un=0;if(!tn||cn<8)for(var pn=0;pn<=cn;pn+=65535){var hn=pn+65535;hn>>13,mn=8191&gn,fn=(1<7e3||En>24576)&&Un>423){un=wblk(en,dn,0,xn,kn,Cn,Bn,En,Ln,pn-Ln,un),En=Sn=Bn=0,Ln=pn;for(var Nn=0;Nn<286;++Nn)kn[Nn]=0;for(Nn=0;Nn<30;++Nn)Cn[Nn]=0}var In=2,Mn=0,Rn=mn,On=Tn-Fn&32767;if(Un>2&&Pn==hsh(pn-On))for(var Qn=Math.min(_n,Un)-1,qn=Math.min(32767,pn),Vn=Math.min(258,Un);On<=qn&&--Rn&&Tn!=Fn;){if(en[pn+In]==en[pn+In-On]){for(var Gn=0;GnIn){if(In=Gn,Mn=On,Gn>Qn)break;var Dn=Math.min(On,Gn-2),Hn=0;for(Nn=0;NnHn&&(Hn=Kn,Fn=zn)}}}On+=(Tn=Fn)-(Fn=yn[Tn])+32768&32767}if(Mn){xn[En++]=268435456|al[In]<<18|cl[Mn];var $n=31&al[In],Wn=31&cl[Mn];Bn+=tl[$n]+nl[Wn],++kn[257+$n],++Cn[Wn],jn=pn+In,++Sn}else xn[En++]=en[pn],++kn[en[pn]]}}un=wblk(en,dn,sn,xn,kn,Cn,Bn,En,Ln,pn-Ln,un),sn||(un=wfblk(dn,un,bl))}return slc(An,0,rn+shft(un)+an)}(en,null==tn.level?6:tn.level,null==tn.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(en.length)))):12+tn.mem,nn,rn,!an)}(en,tn,2,4);return function(en,tn){var nn=tn.level,rn=0==nn?0:nn<6?1:9==nn?3:2;en[0]=120,en[1]=rn<<6|(rn?32-2*rn:1)}(rn,tn),function(en,tn,nn){for(;nn;++tn)en[tn]=nn,nn>>>=8}(rn,rn.length-4,nn.d()),rn} /** @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 , https://github.com/MrRio/jsPDF * 2015-2021 yWorks GmbH, http://www.yworks.com * 2015-2021 Lukas Holländer , https://github.com/HackbrettXXX * 2016-2018 Aras Abbasi * 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 vl=function(){return"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this}();function i$2(){vl.console&&"function"==typeof vl.console.log&&vl.console.log.apply(vl.console,arguments)}var wl={log:i$2,warn:function(en){vl.console&&("function"==typeof vl.console.warn?vl.console.warn.apply(vl.console,arguments):i$2.call(null,arguments))},error:function(en){vl.console&&("function"==typeof vl.console.error?vl.console.error.apply(vl.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(){Cl(rn.response,tn,nn)},rn.onerror=function(){wl.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 xl,kl,Cl=vl.saveAs||("object"!==("undefined"==typeof window?"undefined":_typeof$1(window))||window!==vl?function(){}:"undefined"!=typeof HTMLAnchorElement&&"download"in HTMLAnchorElement.prototype?function(en,tn,nn){var rn=vl.URL||vl.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)&&(wl.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(vl.HTMLElement)||vl.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=vl.URL||vl.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 * {@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;rn255?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<>>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>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}xl=vl.atob.bind(vl),kl=vl.btoa.bind(vl);var Sl="0123456789abcdef".split("");function L(en){for(var tn="",nn=0;nn<4;nn++)tn+=Sl[en>>8*nn+4&15]+Sl[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 Bl="5d41402abc4b2a76b9719d911017c592"!=function(en){for(var tn=0;tn>16)+(tn>>16)+(nn>>16)<<16|65535&nn}return en+tn&4294967295} /** * @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€/\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;rn126?"#"+("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){vl.console&&wl.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,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};_n.__private__.getPageFormats=function(){return yn};var bn=_n.__private__.getPageFormat=function(en){return yn[en]};an=an||"a4";var vn={COMPAT:"compat",ADVANCED:"advanced"},wn=vn.COMPAT;function _(){this.saveGraphicsState(),$n(new po(Kr,0,0,-Kr,0,fi()*Kr).toString()+" cm"),this.setFontSize(this.getFontSize()/Kr),un="n",wn=vn.ADVANCED}function P(){this.restoreGraphicsState(),un="S",wn=vn.COMPAT}var xn=_n.__private__.combineFontStyleAndFontWeight=function(en,tn){if("bold"==en&&"normal"==tn||"bold"==en&&400==tn||"normal"==en&&"italic"==tn||"bold"==en&&"italic"==tn)throw new Error("Invalid Combination of fontweight and fontstyle");return tn&&(en=400==tn||"normal"===tn?"italic"===en?"italic":"normal":700!=tn&&"bold"!==tn||"normal"!==en?(700==tn?"bold":tn)+""+en:"bold"),en};_n.advancedAPI=function(en){var tn=wn===vn.COMPAT;return tn&&_.call(this),"function"!=typeof en||(en(this),tn&&P.call(this)),this},_n.compatAPI=function(en){var tn=wn===vn.ADVANCED;return tn&&P.call(this),"function"!=typeof en||(en(this),tn&&_.call(this)),this},_n.isAdvancedAPI=function(){return wn===vn.ADVANCED};var kn,q=function(en){if(wn!==vn.ADVANCED)throw new Error(en+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},Cn=_n.roundToPrecision=_n.__private__.roundToPrecision=function(en,nn){var rn=tn||nn;if(isNaN(en)||isNaN(rn))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return en.toFixed(rn).replace(/0+$/,"")};kn=_n.hpf=_n.__private__.hpf="number"==typeof dn?function(en){if(isNaN(en))throw new Error("Invalid argument passed to jsPDF.hpf");return Cn(en,dn)}:"smart"===dn?function(en){if(isNaN(en))throw new Error("Invalid argument passed to jsPDF.hpf");return Cn(en,en>-1&&en<1?16:5)}:function(en){if(isNaN(en))throw new Error("Invalid argument passed to jsPDF.hpf");return Cn(en,16)};var Sn=_n.f2=_n.__private__.f2=function(en){if(isNaN(en))throw new Error("Invalid argument passed to jsPDF.f2");return Cn(en,2)},Bn=_n.__private__.f3=function(en){if(isNaN(en))throw new Error("Invalid argument passed to jsPDF.f3");return Cn(en,3)},En=_n.scale=_n.__private__.scale=function(en){if(isNaN(en))throw new Error("Invalid argument passed to jsPDF.scale");return wn===vn.COMPAT?en*Kr:wn===vn.ADVANCED?en:void 0},z=function(en){return wn===vn.COMPAT?fi()-en:wn===vn.ADVANCED?en:void 0},H=function(en){return En(z(en))};_n.__private__.setPrecision=_n.setPrecision=function(en){"number"==typeof parseInt(en,10)&&(tn=parseInt(en,10))};var jn,Ln="00000000000000000000000000000000",Pn=_n.__private__.getFileId=function(){return Ln},Tn=_n.__private__.setFileId=function(en){return Ln=void 0!==en&&/^[a-fA-F0-9]{32}$/.test(en)?en.toUpperCase():Ln.split("").map((function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))})).join(""),null!==pn&&(Ro=new I(pn.userPermissions,pn.userPassword,pn.ownerPassword,Ln)),Ln};_n.setFileId=function(en){return Tn(en),this},_n.getFileId=function(){return Pn()};var Fn=_n.__private__.convertDateToPDFDate=function(en){var tn=en.getTimezoneOffset(),nn=tn<0?"+":"-",rn=Math.floor(Math.abs(tn/60)),an=Math.abs(tn%60),sn=[nn,Rn(rn),"'",Rn(an),"'"].join("");return["D:",en.getFullYear(),Rn(en.getMonth()+1),Rn(en.getDate()),Rn(en.getHours()),Rn(en.getMinutes()),Rn(en.getSeconds()),sn].join("")},Un=_n.__private__.convertPDFDateToDate=function(en){var tn=parseInt(en.substr(2,4),10),nn=parseInt(en.substr(6,2),10)-1,rn=parseInt(en.substr(8,2),10),an=parseInt(en.substr(10,2),10),sn=parseInt(en.substr(12,2),10),cn=parseInt(en.substr(14,2),10);return new Date(tn,nn,rn,an,sn,cn,0)},Nn=_n.__private__.setCreationDate=function(en){var tn;if(void 0===en&&(en=new Date),en instanceof Date)tn=Fn(en);else{if(!/^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|-0[0-9]|-1[0-1])'(0[0-9]|[1-5][0-9])'?$/.test(en))throw new Error("Invalid argument passed to jsPDF.setCreationDate");tn=en}return jn=tn},In=_n.__private__.getCreationDate=function(en){var tn=jn;return"jsDate"===en&&(tn=Un(jn)),tn};_n.setCreationDate=function(en){return Nn(en),this},_n.getCreationDate=function(en){return In(en)};var Mn,Rn=_n.__private__.padd2=function(en){return("0"+parseInt(en)).slice(-2)},On=_n.__private__.padd2Hex=function(en){return("00"+(en=en.toString())).substr(en.length)},Qn=0,qn=[],Vn=[],Gn=0,Dn=[],Hn=[],zn=!1,Kn=Vn,ut=function(){Qn=0,Gn=0,Vn=[],qn=[],Dn=[],yo=mo(),bo=mo()};_n.__private__.setCustomOutputDestination=function(en){zn=!0,Kn=en};var ht=function(en){zn||(Kn=en)};_n.__private__.resetCustomOutputDestination=function(){zn=!1,Kn=Vn};var $n=_n.__private__.out=function(en){return en=en.toString(),Gn+=en.length+1,Kn.push(en),Kn},Wn=_n.__private__.write=function(en){return $n(1===arguments.length?en.toString():Array.prototype.join.call(arguments," "))},Xn=_n.__private__.getArrayBuffer=function(en){for(var tn=en.length,nn=new ArrayBuffer(tn),rn=new Uint8Array(nn);tn--;)rn[tn]=en.charCodeAt(tn);return nn},Yn=[["Helvetica","helvetica","normal","WinAnsiEncoding"],["Helvetica-Bold","helvetica","bold","WinAnsiEncoding"],["Helvetica-Oblique","helvetica","italic","WinAnsiEncoding"],["Helvetica-BoldOblique","helvetica","bolditalic","WinAnsiEncoding"],["Courier","courier","normal","WinAnsiEncoding"],["Courier-Bold","courier","bold","WinAnsiEncoding"],["Courier-Oblique","courier","italic","WinAnsiEncoding"],["Courier-BoldOblique","courier","bolditalic","WinAnsiEncoding"],["Times-Roman","times","normal","WinAnsiEncoding"],["Times-Bold","times","bold","WinAnsiEncoding"],["Times-Italic","times","italic","WinAnsiEncoding"],["Times-BoldItalic","times","bolditalic","WinAnsiEncoding"],["ZapfDingbats","zapfdingbats","normal",null],["Symbol","symbol","normal",null]];_n.__private__.getStandardFonts=function(){return Yn};var Zn=en.fontSize||16;_n.__private__.setFontSize=_n.setFontSize=function(en){return Zn=wn===vn.ADVANCED?en/Kr:en,this};var Jn,Tr=_n.__private__.getFontSize=_n.getFontSize=function(){return wn===vn.COMPAT?Zn:Zn*Kr},Ur=en.R2L||!1;_n.__private__.setR2L=_n.setR2L=function(en){return Ur=en,this},_n.__private__.getR2L=_n.getR2L=function(){return Ur};var Rr,Qr=_n.__private__.setZoomMode=function(en){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(en))Jn=en;else if(isNaN(en)){if(-1===[void 0,null,"fullwidth","fullheight","fullpage","original"].indexOf(en))throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+en+'" is not recognized.');Jn=en}else Jn=parseInt(en,10)};_n.__private__.getZoomMode=function(){return Jn};var Vr,Gr=_n.__private__.setPageMode=function(en){if(-1==[void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(en))throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+en+'" is not recognized.');Rr=en};_n.__private__.getPageMode=function(){return Rr};var Dr=_n.__private__.setLayoutMode=function(en){if(-1==[void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(en))throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+en+'" is not recognized.');Vr=en};_n.__private__.getLayoutMode=function(){return Vr},_n.__private__.setDisplayMode=_n.setDisplayMode=function(en,tn,nn){return Qr(en),Dr(tn),Gr(nn),this};var Hr={title:"",subject:"",author:"",keywords:"",creator:""};_n.__private__.getDocumentProperty=function(en){if(-1===Object.keys(Hr).indexOf(en))throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return Hr[en]},_n.__private__.getDocumentProperties=function(){return Hr},_n.__private__.setDocumentProperties=_n.setProperties=_n.setDocumentProperties=function(en){for(var tn in Hr)Hr.hasOwnProperty(tn)&&en[tn]&&(Hr[tn]=en[tn]);return this},_n.__private__.setDocumentProperty=function(en,tn){if(-1===Object.keys(Hr).indexOf(en))throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return Hr[en]=tn};var zr,Kr,$r,Wr,Xr,Yr={},Zr={},Jr=[],eo={},to={},no={},ro={},oo=null,io=0,ao=[],so=new C(_n),lo=en.hotfixes||[],co={},Ao={},uo=[],po=function t(en,tn,nn,rn,an,sn){if(!(this instanceof t))return new t(en,tn,nn,rn,an,sn);isNaN(en)&&(en=1),isNaN(tn)&&(tn=0),isNaN(nn)&&(nn=0),isNaN(rn)&&(rn=1),isNaN(an)&&(an=0),isNaN(sn)&&(sn=0),this._matrix=[en,tn,nn,rn,an,sn]};Object.defineProperty(po.prototype,"sx",{get:function(){return this._matrix[0]},set:function(en){this._matrix[0]=en}}),Object.defineProperty(po.prototype,"shy",{get:function(){return this._matrix[1]},set:function(en){this._matrix[1]=en}}),Object.defineProperty(po.prototype,"shx",{get:function(){return this._matrix[2]},set:function(en){this._matrix[2]=en}}),Object.defineProperty(po.prototype,"sy",{get:function(){return this._matrix[3]},set:function(en){this._matrix[3]=en}}),Object.defineProperty(po.prototype,"tx",{get:function(){return this._matrix[4]},set:function(en){this._matrix[4]=en}}),Object.defineProperty(po.prototype,"ty",{get:function(){return this._matrix[5]},set:function(en){this._matrix[5]=en}}),Object.defineProperty(po.prototype,"a",{get:function(){return this._matrix[0]},set:function(en){this._matrix[0]=en}}),Object.defineProperty(po.prototype,"b",{get:function(){return this._matrix[1]},set:function(en){this._matrix[1]=en}}),Object.defineProperty(po.prototype,"c",{get:function(){return this._matrix[2]},set:function(en){this._matrix[2]=en}}),Object.defineProperty(po.prototype,"d",{get:function(){return this._matrix[3]},set:function(en){this._matrix[3]=en}}),Object.defineProperty(po.prototype,"e",{get:function(){return this._matrix[4]},set:function(en){this._matrix[4]=en}}),Object.defineProperty(po.prototype,"f",{get:function(){return this._matrix[5]},set:function(en){this._matrix[5]=en}}),Object.defineProperty(po.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(po.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(po.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(po.prototype,"isIdentity",{get:function(){return 1===this.sx&&0===this.shy&&0===this.shx&&1===this.sy&&0===this.tx&&0===this.ty}}),po.prototype.join=function(en){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(kn).join(en)},po.prototype.multiply=function(en){var tn=en.sx*this.sx+en.shy*this.shx,nn=en.sx*this.shy+en.shy*this.sy,rn=en.shx*this.sx+en.sy*this.shx,an=en.shx*this.shy+en.sy*this.sy,sn=en.tx*this.sx+en.ty*this.shx+this.tx,cn=en.tx*this.shy+en.ty*this.sy+this.ty;return new po(tn,nn,rn,an,sn,cn)},po.prototype.decompose=function(){var en=this.sx,tn=this.shy,nn=this.shx,rn=this.sy,an=this.tx,sn=this.ty,cn=Math.sqrt(en*en+tn*tn),An=(en/=cn)*nn+(tn/=cn)*rn;nn-=en*An,rn-=tn*An;var dn=Math.sqrt(nn*nn+rn*rn);return An/=dn,en*(rn/=dn)>16&255,rn=dn>>8&255,an=255&dn}if(void 0===rn||void 0===sn&&nn===rn&&rn===an)tn="string"==typeof nn?nn+" "+cn[0]:2===en.precision?Sn(nn/255)+" "+cn[0]:Bn(nn/255)+" "+cn[0];else if(void 0===sn||"object"===_typeof$1(sn)){if(sn&&!isNaN(sn.a)&&0===sn.a)return["1.","1.","1.",cn[1]].join(" ");tn="string"==typeof nn?[nn,rn,an,cn[1]].join(" "):2===en.precision?[Sn(nn/255),Sn(rn/255),Sn(an/255),cn[1]].join(" "):[Bn(nn/255),Bn(rn/255),Bn(an/255),cn[1]].join(" ")}else tn="string"==typeof nn?[nn,rn,an,sn,cn[2]].join(" "):2===en.precision?[Sn(nn),Sn(rn),Sn(an),Sn(sn),cn[2]].join(" "):[Bn(nn),Bn(rn),Bn(an),Bn(sn),cn[2]].join(" ");return tn},xo=_n.__private__.getFilters=function(){return cn},ko=_n.__private__.putStream=function(en){var tn=(en=en||{}).data||"",nn=en.filters||xo(),rn=en.alreadyAppliedFilters||[],an=en.addLength1||!1,sn=tn.length,cn=en.objectId,s=function(en){return en};if(null!==pn&&void 0===cn)throw new Error("ObjectId must be passed to putStream for file encryption");null!==pn&&(s=Ro.encryptor(cn,0));var An={};!0===nn&&(nn=["FlateEncode"]);var dn=en.additionalKeyValues||[],un=(An=void 0!==E.API.processDataByFilters?E.API.processDataByFilters(tn,nn):{data:tn,reverseChain:[]}).reverseChain+(Array.isArray(rn)?rn.join(" "):rn.toString());if(0!==An.data.length&&(dn.push({key:"Length",value:An.data.length}),!0===an&&dn.push({key:"Length1",value:sn})),0!=un.length)if(un.split("/").length-1==1)dn.push({key:"Filter",value:un});else{dn.push({key:"Filter",value:"["+un+"]"});for(var hn=0;hn>"),0!==An.data.length&&($n("stream"),$n(s(An.data)),$n("endstream"))},Co=_n.__private__.putPage=function(en){var tn=en.number,nn=en.data,rn=en.objId,an=en.contentsObjId;Zt(rn,!0),$n("<>"),$n("endobj");var sn=nn.join("\n");return wn===vn.ADVANCED&&(sn+="\nQ"),Zt(an,!0),ko({data:sn,filters:xo(),objectId:an}),$n("endobj"),rn},So=_n.__private__.putPages=function(){var en,tn,nn=[];for(en=1;en<=io;en++)ao[en].objId=mo(),ao[en].contentsObjId=mo();for(en=1;en<=io;en++)nn.push(Co({number:en,data:Hn[en],objId:ao[en].objId,contentsObjId:ao[en].contentsObjId,mediaBox:ao[en].mediaBox,cropBox:ao[en].cropBox,bleedBox:ao[en].bleedBox,trimBox:ao[en].trimBox,artBox:ao[en].artBox,userUnit:ao[en].userUnit,rootDictionaryObjId:yo,resourceDictionaryObjId:bo}));Zt(yo,!0),$n("<>"),$n("endobj"),so.publish("postPutPages")},se=function(en){so.publish("putFont",{font:en,out:$n,newObject:_o,putStream:ko}),!0!==en.isAlreadyPutted&&(en.objectNumber=_o(),$n("<<"),$n("/Type /Font"),$n("/BaseFont /"+F(en.postScriptName)),$n("/Subtype /Type1"),"string"==typeof en.encoding&&$n("/Encoding /"+en.encoding),$n("/FirstChar 32"),$n("/LastChar 255"),$n(">>"),$n("endobj"))},ce=function(){for(var en in Yr)Yr.hasOwnProperty(en)&&(!1===hn||!0===hn&&gn.hasOwnProperty(en))&&se(Yr[en])},ue=function(en){en.objectNumber=_o();var tn=[];tn.push({key:"Type",value:"/XObject"}),tn.push({key:"Subtype",value:"/Form"}),tn.push({key:"BBox",value:"["+[kn(en.x),kn(en.y),kn(en.x+en.width),kn(en.y+en.height)].join(" ")+"]"}),tn.push({key:"Matrix",value:"["+en.matrix.toString()+"]"});var nn=en.pages[1].join("\n");ko({data:nn,additionalKeyValues:tn,objectId:en.objectNumber}),$n("endobj")},he=function(){for(var en in co)co.hasOwnProperty(en)&&ue(co[en])},le=function(en,tn){var nn,rn=[],an=1/(tn-1);for(nn=0;nn<1;nn+=an)rn.push(nn);if(rn.push(1),0!=en[0].offset){var sn={offset:0,color:en[0].color};en.unshift(sn)}if(1!=en[en.length-1].offset){var cn={offset:1,color:en[en.length-1].color};en.push(cn)}for(var An="",dn=0,un=0;unen[dn+1].offset;)dn++;var pn=en[dn].offset,hn=(nn-pn)/(en[dn+1].offset-pn),gn=en[dn].color,_n=en[dn+1].color;An+=On(Math.round((1-hn)*gn[0]+hn*_n[0]).toString(16))+On(Math.round((1-hn)*gn[1]+hn*_n[1]).toString(16))+On(Math.round((1-hn)*gn[2]+hn*_n[2]).toString(16))}return An.trim()},fe=function(en,tn){tn||(tn=21);var nn=_o(),rn=le(en.colors,tn),an=[];an.push({key:"FunctionType",value:"0"}),an.push({key:"Domain",value:"[0.0 1.0]"}),an.push({key:"Size",value:"["+tn+"]"}),an.push({key:"BitsPerSample",value:"8"}),an.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),an.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),ko({data:rn,additionalKeyValues:an,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:nn}),$n("endobj"),en.objectNumber=_o(),$n("<< /ShadingType "+en.type),$n("/ColorSpace /DeviceRGB");var sn="/Coords ["+kn(parseFloat(en.coords[0]))+" "+kn(parseFloat(en.coords[1]))+" ";2===en.type?sn+=kn(parseFloat(en.coords[2]))+" "+kn(parseFloat(en.coords[3])):sn+=kn(parseFloat(en.coords[2]))+" "+kn(parseFloat(en.coords[3]))+" "+kn(parseFloat(en.coords[4]))+" "+kn(parseFloat(en.coords[5])),$n(sn+="]"),en.matrix&&$n("/Matrix ["+en.matrix.toString()+"]"),$n("/Function "+nn+" 0 R"),$n("/Extend [true true]"),$n(">>"),$n("endobj")},de=function(en,tn){var nn=mo(),rn=_o();tn.push({resourcesOid:nn,objectOid:rn}),en.objectNumber=rn;var an=[];an.push({key:"Type",value:"/Pattern"}),an.push({key:"PatternType",value:"1"}),an.push({key:"PaintType",value:"1"}),an.push({key:"TilingType",value:"1"}),an.push({key:"BBox",value:"["+en.boundingBox.map(kn).join(" ")+"]"}),an.push({key:"XStep",value:kn(en.xStep)}),an.push({key:"YStep",value:kn(en.yStep)}),an.push({key:"Resources",value:nn+" 0 R"}),en.matrix&&an.push({key:"Matrix",value:"["+en.matrix.toString()+"]"}),ko({data:en.stream,additionalKeyValues:an,objectId:en.objectNumber}),$n("endobj")},pe=function(en){var tn;for(tn in eo)eo.hasOwnProperty(tn)&&(eo[tn]instanceof B?fe(eo[tn]):eo[tn]instanceof M&&de(eo[tn],en))},ge=function(en){for(var tn in en.objectNumber=_o(),$n("<<"),en)switch(tn){case"opacity":$n("/ca "+Sn(en[tn]));break;case"stroke-opacity":$n("/CA "+Sn(en[tn]))}$n(">>"),$n("endobj")},me=function(){var en;for(en in no)no.hasOwnProperty(en)&&ge(no[en])},ve=function(){for(var en in $n("/XObject <<"),co)co.hasOwnProperty(en)&&co[en].objectNumber>=0&&$n("/"+en+" "+co[en].objectNumber+" 0 R");so.publish("putXobjectDict"),$n(">>")},be=function(){Ro.oid=_o(),$n("<<"),$n("/Filter /Standard"),$n("/V "+Ro.v),$n("/R "+Ro.r),$n("/U <"+Ro.toHexString(Ro.U)+">"),$n("/O <"+Ro.toHexString(Ro.O)+">"),$n("/P "+Ro.P),$n(">>"),$n("endobj")},ye=function(){for(var en in $n("/Font <<"),Yr)Yr.hasOwnProperty(en)&&(!1===hn||!0===hn&&gn.hasOwnProperty(en))&&$n("/"+en+" "+Yr[en].objectNumber+" 0 R");$n(">>")},we=function(){if(Object.keys(eo).length>0){for(var en in $n("/Shading <<"),eo)eo.hasOwnProperty(en)&&eo[en]instanceof B&&eo[en].objectNumber>=0&&$n("/"+en+" "+eo[en].objectNumber+" 0 R");so.publish("putShadingPatternDict"),$n(">>")}},Ne=function(en){if(Object.keys(eo).length>0){for(var tn in $n("/Pattern <<"),eo)eo.hasOwnProperty(tn)&&eo[tn]instanceof _n.TilingPattern&&eo[tn].objectNumber>=0&&eo[tn].objectNumber>")}},Le=function(){if(Object.keys(no).length>0){var en;for(en in $n("/ExtGState <<"),no)no.hasOwnProperty(en)&&no[en].objectNumber>=0&&$n("/"+en+" "+no[en].objectNumber+" 0 R");so.publish("putGStateDict"),$n(">>")}},Ae=function(en){Zt(en.resourcesOid,!0),$n("<<"),$n("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),ye(),we(),Ne(en.objectOid),Le(),ve(),$n(">>"),$n("endobj")},xe=function(){var en=[];ce(),me(),he(),pe(en),so.publish("putResources"),en.forEach(Ae),Ae({resourcesOid:bo,objectOid:Number.MAX_SAFE_INTEGER}),so.publish("postPutResources")},Se=function(){so.publish("putAdditionalObjects");for(var en=0;en>8&&(dn=!0);en=An.join("")}for(nn=en.length;void 0===dn&&0!==nn;)en.charCodeAt(nn-1)>>8&&(dn=!0),nn--;if(!dn)return en;for(An=tn.noBOM?[]:[254,255],nn=0,rn=en.length;nn>8)>>8)throw new Error("Character at position "+nn+" of string '"+en+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");An.push(pn),An.push(un-(pn<<8))}return String.fromCharCode.apply(void 0,An)},Bo=_n.__private__.pdfEscape=_n.pdfEscape=function(en,tn){return Fe(en,tn).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Eo=_n.__private__.beginPage=function(en){Hn[++io]=[],ao[io]={objId:0,contentsObjId:0,userUnit:Number(An),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(en[0]),topRightY:Number(en[1])}},Me(io),ht(Hn[Mn])},Oe=function(en,tn){var rn,sn,cn;switch(nn=tn||nn,"string"==typeof en&&(rn=bn(en.toLowerCase()),Array.isArray(rn)&&(sn=rn[0],cn=rn[1])),Array.isArray(en)&&(sn=en[0]*Kr,cn=en[1]*Kr),isNaN(sn)&&(sn=an[0],cn=an[1]),(sn>14400||cn>14400)&&(wl.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),sn=Math.min(14400,sn),cn=Math.min(14400,cn)),an=[sn,cn],nn.substr(0,1)){case"l":cn>sn&&(an=[cn,sn]);break;case"p":sn>cn&&(an=[cn,sn])}Eo(an),Jo(Yo),$n(si),0!==pi&&$n(pi+" J"),0!==hi&&$n(hi+" j"),so.publish("addPage",{pageNumber:io})},Be=function(en){en>0&&en<=io&&(Hn.splice(en,1),ao.splice(en,1),io--,Mn>io&&(Mn=io),this.setPage(Mn))},Me=function(en){en>0&&en<=io&&(Mn=en)},jo=_n.__private__.getNumberOfPages=_n.getNumberOfPages=function(){return Hn.length-1},qe=function(en,tn,nn){var rn,an=void 0;return nn=nn||{},en=void 0!==en?en:Yr[zr].fontName,tn=void 0!==tn?tn:Yr[zr].fontStyle,rn=en.toLowerCase(),void 0!==Zr[rn]&&void 0!==Zr[rn][tn]?an=Zr[rn][tn]:void 0!==Zr[en]&&void 0!==Zr[en][tn]?an=Zr[en][tn]:!1===nn.disableWarning&&wl.warn("Unable to look up font label for font '"+en+"', '"+tn+"'. Refer to getFontList() for available fonts."),an||nn.noFallback||null==(an=Zr.times[tn])&&(an=Zr.times.normal),an},Lo=_n.__private__.putInfo=function(){var en=_o(),e=function(en){return en};for(var tn in null!==pn&&(e=Ro.encryptor(en,0)),$n("<<"),$n("/Producer ("+Bo(e("jsPDF "+E.version))+")"),Hr)Hr.hasOwnProperty(tn)&&Hr[tn]&&$n("/"+tn.substr(0,1).toUpperCase()+tn.substr(1)+" ("+Bo(e(Hr[tn]))+")");$n("/CreationDate ("+Bo(e(jn))+")"),$n(">>"),$n("endobj")},Po=_n.__private__.putCatalog=function(en){var tn=(en=en||{}).rootDictionaryObjId||yo;switch(_o(),$n("<<"),$n("/Type /Catalog"),$n("/Pages "+tn+" 0 R"),Jn||(Jn="fullwidth"),Jn){case"fullwidth":$n("/OpenAction [3 0 R /FitH null]");break;case"fullheight":$n("/OpenAction [3 0 R /FitV null]");break;case"fullpage":$n("/OpenAction [3 0 R /Fit]");break;case"original":$n("/OpenAction [3 0 R /XYZ null null 1]");break;default:var nn=""+Jn;"%"===nn.substr(nn.length-1)&&(Jn=parseInt(Jn)/100),"number"==typeof Jn&&$n("/OpenAction [3 0 R /XYZ null null "+Sn(Jn)+"]")}switch(Vr||(Vr="continuous"),Vr){case"continuous":$n("/PageLayout /OneColumn");break;case"single":$n("/PageLayout /SinglePage");break;case"two":case"twoleft":$n("/PageLayout /TwoColumnLeft");break;case"tworight":$n("/PageLayout /TwoColumnRight")}Rr&&$n("/PageMode /"+Rr),so.publish("putCatalog"),$n(">>"),$n("endobj")},To=_n.__private__.putTrailer=function(){$n("trailer"),$n("<<"),$n("/Size "+(Qn+1)),$n("/Root "+Qn+" 0 R"),$n("/Info "+(Qn-1)+" 0 R"),null!==pn&&$n("/Encrypt "+Ro.oid+" 0 R"),$n("/ID [ <"+Ln+"> <"+Ln+"> ]"),$n(">>")},Fo=_n.__private__.putHeader=function(){$n("%PDF-"+mn),$n("%ºß¬à")},Uo=_n.__private__.putXRef=function(){var en="0000000000";$n("xref"),$n("0 "+(Qn+1)),$n("0000000000 65535 f ");for(var tn=1;tn<=Qn;tn++)"function"==typeof qn[tn]?$n((en+qn[tn]()).slice(-10)+" 00000 n "):void 0!==qn[tn]?$n((en+qn[tn]).slice(-10)+" 00000 n "):$n("0000000000 00000 n ")},No=_n.__private__.buildDocument=function(){ut(),ht(Vn),so.publish("buildDocument"),Fo(),So(),Se(),xe(),null!==pn&&be(),Lo(),Po();var en=Gn;return Uo(),To(),$n("startxref"),$n(""+en),$n("%%EOF"),ht(Hn[Mn]),Vn.join("\n")},Io=_n.__private__.getBlob=function(en){return new Blob([Xn(en)],{type:"application/pdf"})},Mo=_n.output=_n.__private__.output=Ie((function(en,tn){switch("string"==typeof(tn=tn||{})?tn={filename:tn}:tn.filename=tn.filename||"generated.pdf",en){case void 0:return No();case"save":_n.save(tn.filename);break;case"arraybuffer":return Xn(No());case"blob":return Io(No());case"bloburi":case"bloburl":if(void 0!==vl.URL&&"function"==typeof vl.URL.createObjectURL)return vl.URL&&vl.URL.createObjectURL(Io(No()))||void 0;wl.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var nn="",rn=No();try{nn=kl(rn)}catch(en){nn=kl(unescape(encodeURIComponent(rn)))}return"data:application/pdf;filename="+tn.filename+";base64,"+nn;case"pdfobjectnewwindow":if("[object Window]"===Object.prototype.toString.call(vl)){var an="https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.1.1/pdfobject.min.js",sn=' integrity="sha512-4ze/a9/4jqu+tX9dfOqJYSvyYd5M6qum/3HpCLr+/Jqf0whc37VUbkpNGHR7/8pSnCFw47T1fmIpwBV7UySh3g==" crossorigin="anonymous"';tn.pdfObjectUrl&&(an=tn.pdfObjectUrl,sn="");var cn='