svgedit/dist/editor/extensions/ext-polygon/ext-polygon.js

3 lines
44 KiB
JavaScript

var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}var check=function(t){return t&&t.Math==Math&&t},e=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof t&&t)||Function("return this")(),fails=function(t){try{return!!t()}catch(t){return!0}},r=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),n={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i={f:o&&!n.call({1:2},1)?function propertyIsEnumerable(t){var e=o(this,t);return!!e&&e.enumerable}:n},createPropertyDescriptor=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},a={}.toString,classofRaw=function(t){return a.call(t).slice(8,-1)},c="".split,u=fails((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==classofRaw(t)?c.call(t,""):Object(t)}:Object,requireObjectCoercible=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},toIndexedObject=function(t){return u(requireObjectCoercible(t))},isObject=function(t){return"object"==typeof t?null!==t:"function"==typeof t},toPrimitive=function(t,e){if(!isObject(t))return t;var r,n;if(e&&"function"==typeof(r=t.toString)&&!isObject(n=r.call(t)))return n;if("function"==typeof(r=t.valueOf)&&!isObject(n=r.call(t)))return n;if(!e&&"function"==typeof(r=t.toString)&&!isObject(n=r.call(t)))return n;throw TypeError("Can't convert object to primitive value")},s={}.hasOwnProperty,has=function(t,e){return s.call(t,e)},f=e.document,l=isObject(f)&&isObject(f.createElement),documentCreateElement=function(t){return l?f.createElement(t):{}},p=!r&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),h=Object.getOwnPropertyDescriptor,y={f:r?h:function getOwnPropertyDescriptor(t,e){if(t=toIndexedObject(t),e=toPrimitive(e,!0),p)try{return h(t,e)}catch(t){}if(has(t,e))return createPropertyDescriptor(!i.f.call(t,e),t[e])}},anObject=function(t){if(!isObject(t))throw TypeError(String(t)+" is not an object");return t},d=Object.defineProperty,v={f:r?d:function defineProperty(t,e,r){if(anObject(t),e=toPrimitive(e,!0),anObject(r),p)try{return d(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},g=r?function(t,e,r){return v.f(t,e,createPropertyDescriptor(1,r))}:function(t,e,r){return t[e]=r,t},setGlobal=function(t,r){try{g(e,t,r)}catch(n){e[t]=r}return r},m=e["__core-js_shared__"]||setGlobal("__core-js_shared__",{}),b=Function.toString;"function"!=typeof m.inspectSource&&(m.inspectSource=function(t){return b.call(t)});var w,S,O,j=m.inspectSource,x=e.WeakMap,_="function"==typeof x&&/native code/.test(j(x)),P=createCommonjsModule((function(t){(t.exports=function(t,e){return m[t]||(m[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),E=0,k=Math.random(),uid=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++E+k).toString(36)},A=P("keys"),sharedKey=function(t){return A[t]||(A[t]=uid(t))},T={},I=e.WeakMap;if(_){var L=new I,M=L.get,C=L.has,G=L.set;w=function(t,e){return G.call(L,t,e),e},S=function(t){return M.call(L,t)||{}},O=function(t){return C.call(L,t)}}else{var N=sharedKey("state");T[N]=!0,w=function(t,e){return g(t,N,e),e},S=function(t){return has(t,N)?t[N]:{}},O=function(t){return has(t,N)}}var R,D={set:w,get:S,has:O,enforce:function(t){return O(t)?S(t):w(t,{})},getterFor:function(t){return function(e){var r;if(!isObject(e)||(r=S(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}},W=createCommonjsModule((function(t){var r=D.get,n=D.enforce,o=String(String).split("String");(t.exports=function(t,r,i,a){var c=!!a&&!!a.unsafe,u=!!a&&!!a.enumerable,s=!!a&&!!a.noTargetGet;"function"==typeof i&&("string"!=typeof r||has(i,"name")||g(i,"name",r),n(i).source=o.join("string"==typeof r?r:"")),t!==e?(c?!s&&t[r]&&(u=!0):delete t[r],u?t[r]=i:g(t,r,i)):u?t[r]=i:setGlobal(r,i)})(Function.prototype,"toString",(function toString(){return"function"==typeof this&&r(this).source||j(this)}))})),q=e,aFunction=function(t){return"function"==typeof t?t:void 0},getBuiltIn=function(t,r){return arguments.length<2?aFunction(q[t])||aFunction(e[t]):q[t]&&q[t][r]||e[t]&&e[t][r]},z=Math.ceil,U=Math.floor,toInteger=function(t){return isNaN(t=+t)?0:(t>0?U:z)(t)},V=Math.min,toLength=function(t){return t>0?V(toInteger(t),9007199254740991):0},B=Math.max,Y=Math.min,toAbsoluteIndex=function(t,e){var r=toInteger(t);return r<0?B(r+e,0):Y(r,e)},createMethod=function(t){return function(e,r,n){var o,i=toIndexedObject(e),a=toLength(i.length),c=toAbsoluteIndex(n,a);if(t&&r!=r){for(;a>c;)if((o=i[c++])!=o)return!0}else for(;a>c;c++)if((t||c in i)&&i[c]===r)return t||c||0;return!t&&-1}},H={includes:createMethod(!0),indexOf:createMethod(!1)}.indexOf,objectKeysInternal=function(t,e){var r,n=toIndexedObject(t),o=0,i=[];for(r in n)!has(T,r)&&has(n,r)&&i.push(r);for(;e.length>o;)has(n,r=e[o++])&&(~H(i,r)||i.push(r));return i},J=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],$=J.concat("length","prototype"),K={f:Object.getOwnPropertyNames||function getOwnPropertyNames(t){return objectKeysInternal(t,$)}},Q={f:Object.getOwnPropertySymbols},X=getBuiltIn("Reflect","ownKeys")||function ownKeys(t){var e=K.f(anObject(t)),r=Q.f;return r?e.concat(r(t)):e},copyConstructorProperties=function(t,e){for(var r=X(e),n=v.f,o=y.f,i=0;i<r.length;i++){var a=r[i];has(t,a)||n(t,a,o(e,a))}},Z=/#|\.prototype\./,isForced=function(t,e){var r=et[tt(t)];return r==nt||r!=rt&&("function"==typeof e?fails(e):!!e)},tt=isForced.normalize=function(t){return String(t).replace(Z,".").toLowerCase()},et=isForced.data={},rt=isForced.NATIVE="N",nt=isForced.POLYFILL="P",ot=isForced,it=y.f,_export=function(t,r){var n,o,i,a,c,u=t.target,s=t.global,f=t.stat;if(n=s?e:f?e[u]||setGlobal(u,{}):(e[u]||{}).prototype)for(o in r){if(a=r[o],i=t.noTargetGet?(c=it(n,o))&&c.value:n[o],!ot(s?o:u+(f?".":"#")+o,t.forced)&&void 0!==i){if(typeof a==typeof i)continue;copyConstructorProperties(a,i)}(t.sham||i&&i.sham)&&g(a,"sham",!0),W(n,o,a,t)}},toObject=function(t){return Object(requireObjectCoercible(t))},at=!!Object.getOwnPropertySymbols&&!fails((function(){return!String(Symbol())})),ct=at&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ut=P("wks"),st=e.Symbol,ft=ct?st:st&&st.withoutSetter||uid,wellKnownSymbol=function(t){return has(ut,t)||(at&&has(st,t)?ut[t]=st[t]:ut[t]=ft("Symbol."+t)),ut[t]},lt=Object.keys||function keys(t){return objectKeysInternal(t,J)},pt=r?Object.defineProperties:function defineProperties(t,e){anObject(t);for(var r,n=lt(e),o=n.length,i=0;o>i;)v.f(t,r=n[i++],e[r]);return t},ht=getBuiltIn("document","documentElement"),yt=sharedKey("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(t){return"<script>"+t+"<\/script>"},NullProtoObject=function(){try{R=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,e;NullProtoObject=R?function(t){t.write(scriptTag("")),t.close();var e=t.parentWindow.Object;return t=null,e}(R):((e=documentCreateElement("iframe")).style.display="none",ht.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(scriptTag("document.F=Object")),t.close(),t.F);for(var r=J.length;r--;)delete NullProtoObject.prototype[J[r]];return NullProtoObject()};T[yt]=!0;var dt=Object.create||function create(t,e){var r;return null!==t?(EmptyConstructor.prototype=anObject(t),r=new EmptyConstructor,EmptyConstructor.prototype=null,r[yt]=t):r=NullProtoObject(),void 0===e?r:pt(r,e)},vt=wellKnownSymbol("unscopables"),gt=Array.prototype;null==gt[vt]&&v.f(gt,vt,{configurable:!0,value:dt(null)});var addToUnscopables=function(t){gt[vt][t]=!0};_export({target:"Array",proto:!0},{fill:function fill(t){for(var e=toObject(this),r=toLength(e.length),n=arguments.length,o=toAbsoluteIndex(n>1?arguments[1]:void 0,r),i=n>2?arguments[2]:void 0,a=void 0===i?r:toAbsoluteIndex(i,r);a>o;)e[o++]=t;return e}}),addToUnscopables("fill");var mt,bt,aFunction$1=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t},functionBindContext=function(t,e,r){if(aFunction$1(t),void 0===e)return t;switch(r){case 0:return function(){return t.call(e)};case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,o){return t.call(e,r,n,o)}}return function(){return t.apply(e,arguments)}},wt=Array.isArray||function isArray(t){return"Array"==classofRaw(t)},St=wellKnownSymbol("species"),arraySpeciesCreate=function(t,e){var r;return wt(t)&&("function"!=typeof(r=t.constructor)||r!==Array&&!wt(r.prototype)?isObject(r)&&null===(r=r[St])&&(r=void 0):r=void 0),new(void 0===r?Array:r)(0===e?0:e)},Ot=[].push,createMethod$1=function(t){var e=1==t,r=2==t,n=3==t,o=4==t,i=6==t,a=5==t||i;return function(c,s,f,l){for(var p,h,y=toObject(c),d=u(y),v=functionBindContext(s,f,3),g=toLength(d.length),m=0,b=l||arraySpeciesCreate,w=e?b(c,g):r?b(c,0):void 0;g>m;m++)if((a||m in d)&&(h=v(p=d[m],m,y),t))if(e)w[m]=h;else if(h)switch(t){case 3:return!0;case 5:return p;case 6:return m;case 2:Ot.call(w,p)}else if(o)return!1;return i?-1:n||o?o:w}},jt={forEach:createMethod$1(0),map:createMethod$1(1),filter:createMethod$1(2),some:createMethod$1(3),every:createMethod$1(4),find:createMethod$1(5),findIndex:createMethod$1(6)},xt=getBuiltIn("navigator","userAgent")||"",_t=e.process,Pt=_t&&_t.versions,Et=Pt&&Pt.v8;Et?bt=(mt=Et.split("."))[0]+mt[1]:xt&&(!(mt=xt.match(/Edge\/(\d+)/))||mt[1]>=74)&&(mt=xt.match(/Chrome\/(\d+)/))&&(bt=mt[1]);var kt=bt&&+bt,At=wellKnownSymbol("species"),arrayMethodHasSpeciesSupport=function(t){return kt>=51||!fails((function(){var e=[];return(e.constructor={})[At]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},Tt=Object.defineProperty,It={},thrower=function(t){throw t},arrayMethodUsesToLength=function(t,e){if(has(It,t))return It[t];e||(e={});var n=[][t],o=!!has(e,"ACCESSORS")&&e.ACCESSORS,i=has(e,0)?e[0]:thrower,a=has(e,1)?e[1]:void 0;return It[t]=!!n&&!fails((function(){if(o&&!r)return!0;var t={length:-1};o?Tt(t,1,{enumerable:!0,get:thrower}):t[1]=1,n.call(t,i,a)}))},Lt=jt.map,Mt=arrayMethodHasSpeciesSupport("map"),Ct=arrayMethodUsesToLength("map");_export({target:"Array",proto:!0,forced:!Mt||!Ct},{map:function map(t){return Lt(this,t,arguments.length>1?arguments[1]:void 0)}});var Gt=v.f,Ft=Function.prototype,Nt=Ft.toString,Rt=/^\s*function ([^ (]*)/;r&&!("name"in Ft)&&Gt(Ft,"name",{configurable:!0,get:function(){try{return Nt.call(this).match(Rt)[1]}catch(t){return""}}});var Dt=Object.assign,Wt=Object.defineProperty,qt=!Dt||fails((function(){if(r&&1!==Dt({b:1},Dt(Wt({},"a",{enumerable:!0,get:function(){Wt(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},n=Symbol(),o="abcdefghijklmnopqrst";return t[n]=7,o.split("").forEach((function(t){e[t]=t})),7!=Dt({},t)[n]||lt(Dt({},e)).join("")!=o}))?function assign(t,e){for(var n=toObject(t),o=arguments.length,a=1,c=Q.f,s=i.f;o>a;)for(var f,l=u(arguments[a++]),p=c?lt(l).concat(c(l)):lt(l),h=p.length,y=0;h>y;)f=p[y++],r&&!s.call(l,f)||(n[f]=l[f]);return n}:Dt;_export({target:"Object",stat:!0,forced:Object.assign!==qt},{assign:qt});var zt={};zt[wellKnownSymbol("toStringTag")]="z";var Ut="[object z]"===String(zt),Vt=wellKnownSymbol("toStringTag"),Bt="Arguments"==classofRaw(function(){return arguments}()),Yt=Ut?classofRaw:function(t){var e,r,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),Vt))?r:Bt?classofRaw(e):"Object"==(n=classofRaw(e))&&"function"==typeof e.callee?"Arguments":n},Ht=Ut?{}.toString:function toString(){return"[object "+Yt(this)+"]"};Ut||W(Object.prototype,"toString",Ht,{unsafe:!0});var Jt=e.Promise,$t=v.f,Kt=wellKnownSymbol("toStringTag"),setToStringTag=function(t,e,r){t&&!has(t=r?t:t.prototype,Kt)&&$t(t,Kt,{configurable:!0,value:e})},Qt=wellKnownSymbol("species"),Xt={},Zt=wellKnownSymbol("iterator"),te=Array.prototype,ee=wellKnownSymbol("iterator"),callWithSafeIterationClosing=function(t,e,r,n){try{return n?e(anObject(r)[0],r[1]):e(r)}catch(e){var o=t.return;throw void 0!==o&&anObject(o.call(t)),e}},re=createCommonjsModule((function(t){var Result=function(t,e){this.stopped=t,this.result=e};(t.exports=function(t,e,r,n,o){var i,a,c,u,s,f,l,p,h=functionBindContext(e,r,n?2:1);if(o)i=t;else{if("function"!=typeof(a=function(t){if(null!=t)return t[ee]||t["@@iterator"]||Xt[Yt(t)]}(t)))throw TypeError("Target is not iterable");if(void 0!==(p=a)&&(Xt.Array===p||te[Zt]===p)){for(c=0,u=toLength(t.length);u>c;c++)if((s=n?h(anObject(l=t[c])[0],l[1]):h(t[c]))&&s instanceof Result)return s;return new Result(!1)}i=a.call(t)}for(f=i.next;!(l=f.call(i)).done;)if("object"==typeof(s=callWithSafeIterationClosing(i,h,l.value,n))&&s&&s instanceof Result)return s;return new Result(!1)}).stop=function(t){return new Result(!0,t)}})),ne=wellKnownSymbol("iterator"),oe=!1;try{var ie=0,ae={next:function(){return{done:!!ie++}},return:function(){oe=!0}};ae[ne]=function(){return this},Array.from(ae,(function(){throw 2}))}catch(t){}var ce,ue,se,fe=wellKnownSymbol("species"),le=/(iphone|ipod|ipad).*applewebkit/i.test(xt),pe=e.location,he=e.setImmediate,ye=e.clearImmediate,de=e.process,ve=e.MessageChannel,ge=e.Dispatch,me=0,be={},run=function(t){if(be.hasOwnProperty(t)){var e=be[t];delete be[t],e()}},runner=function(t){return function(){run(t)}},listener=function(t){run(t.data)},post=function(t){e.postMessage(t+"",pe.protocol+"//"+pe.host)};he&&ye||(he=function setImmediate(t){for(var e=[],r=1;arguments.length>r;)e.push(arguments[r++]);return be[++me]=function(){("function"==typeof t?t:Function(t)).apply(void 0,e)},ce(me),me},ye=function clearImmediate(t){delete be[t]},"process"==classofRaw(de)?ce=function(t){de.nextTick(runner(t))}:ge&&ge.now?ce=function(t){ge.now(runner(t))}:ve&&!le?(se=(ue=new ve).port2,ue.port1.onmessage=listener,ce=functionBindContext(se.postMessage,se,1)):!e.addEventListener||"function"!=typeof postMessage||e.importScripts||fails(post)||"file:"===pe.protocol?ce="onreadystatechange"in documentCreateElement("script")?function(t){ht.appendChild(documentCreateElement("script")).onreadystatechange=function(){ht.removeChild(this),run(t)}}:function(t){setTimeout(runner(t),0)}:(ce=post,e.addEventListener("message",listener,!1)));var we,Se,Oe,je,xe,_e,Pe,Ee,ke={set:he,clear:ye},Ae=y.f,Te=ke.set,Ie=e.MutationObserver||e.WebKitMutationObserver,Le=e.process,Me=e.Promise,Ce="process"==classofRaw(Le),Ge=Ae(e,"queueMicrotask"),Fe=Ge&&Ge.value;Fe||(we=function(){var t,e;for(Ce&&(t=Le.domain)&&t.exit();Se;){e=Se.fn,Se=Se.next;try{e()}catch(t){throw Se?je():Oe=void 0,t}}Oe=void 0,t&&t.enter()},Ce?je=function(){Le.nextTick(we)}:Ie&&!le?(xe=!0,_e=document.createTextNode(""),new Ie(we).observe(_e,{characterData:!0}),je=function(){_e.data=xe=!xe}):Me&&Me.resolve?(Pe=Me.resolve(void 0),Ee=Pe.then,je=function(){Ee.call(Pe,we)}):je=function(){Te.call(e,we)});var Ne,Re,De,We,qe=Fe||function(t){var e={fn:t,next:void 0};Oe&&(Oe.next=e),Se||(Se=e,je()),Oe=e},PromiseCapability=function(t){var e,r;this.promise=new t((function(t,n){if(void 0!==e||void 0!==r)throw TypeError("Bad Promise constructor");e=t,r=n})),this.resolve=aFunction$1(e),this.reject=aFunction$1(r)},ze={f:function(t){return new PromiseCapability(t)}},promiseResolve=function(t,e){if(anObject(t),isObject(e)&&e.constructor===t)return e;var r=ze.f(t);return(0,r.resolve)(e),r.promise},perform=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},Ue=ke.set,Ve=wellKnownSymbol("species"),Be="Promise",Ye=D.get,He=D.set,Je=D.getterFor(Be),$e=Jt,Ke=e.TypeError,Qe=e.document,Xe=e.process,Ze=getBuiltIn("fetch"),tr=ze.f,er=tr,rr="process"==classofRaw(Xe),nr=!!(Qe&&Qe.createEvent&&e.dispatchEvent),or=ot(Be,(function(){if(!(j($e)!==String($e))){if(66===kt)return!0;if(!rr&&"function"!=typeof PromiseRejectionEvent)return!0}if(kt>=51&&/native code/.test($e))return!1;var t=$e.resolve(1),FakePromise=function(t){t((function(){}),(function(){}))};return(t.constructor={})[Ve]=FakePromise,!(t.then((function(){}))instanceof FakePromise)})),ir=or||!function(t,e){if(!e&&!oe)return!1;var r=!1;try{var n={};n[ne]=function(){return{next:function(){return{done:r=!0}}}},t(n)}catch(t){}return r}((function(t){$e.all(t).catch((function(){}))})),isThenable=function(t){var e;return!(!isObject(t)||"function"!=typeof(e=t.then))&&e},notify$1=function(t,e,r){if(!e.notified){e.notified=!0;var n=e.reactions;qe((function(){for(var o=e.value,i=1==e.state,a=0;n.length>a;){var c,u,s,f=n[a++],l=i?f.ok:f.fail,p=f.resolve,h=f.reject,y=f.domain;try{l?(i||(2===e.rejection&&onHandleUnhandled(t,e),e.rejection=1),!0===l?c=o:(y&&y.enter(),c=l(o),y&&(y.exit(),s=!0)),c===f.promise?h(Ke("Promise-chain cycle")):(u=isThenable(c))?u.call(c,p,h):p(c)):h(o)}catch(t){y&&!s&&y.exit(),h(t)}}e.reactions=[],e.notified=!1,r&&!e.rejection&&onUnhandled(t,e)}))}},dispatchEvent=function(t,r,n){var o,i;nr?((o=Qe.createEvent("Event")).promise=r,o.reason=n,o.initEvent(t,!1,!0),e.dispatchEvent(o)):o={promise:r,reason:n},(i=e["on"+t])?i(o):"unhandledrejection"===t&&function(t,r){var n=e.console;n&&n.error&&(1===arguments.length?n.error(t):n.error(t,r))}("Unhandled promise rejection",n)},onUnhandled=function(t,r){Ue.call(e,(function(){var e,n=r.value;if(isUnhandled(r)&&(e=perform((function(){rr?Xe.emit("unhandledRejection",n,t):dispatchEvent("unhandledrejection",t,n)})),r.rejection=rr||isUnhandled(r)?2:1,e.error))throw e.value}))},isUnhandled=function(t){return 1!==t.rejection&&!t.parent},onHandleUnhandled=function(t,r){Ue.call(e,(function(){rr?Xe.emit("rejectionHandled",t):dispatchEvent("rejectionhandled",t,r.value)}))},bind=function(t,e,r,n){return function(o){t(e,r,o,n)}},internalReject=function(t,e,r,n){e.done||(e.done=!0,n&&(e=n),e.value=r,e.state=2,notify$1(t,e,!0))},internalResolve=function(t,e,r,n){if(!e.done){e.done=!0,n&&(e=n);try{if(t===r)throw Ke("Promise can't be resolved itself");var o=isThenable(r);o?qe((function(){var n={done:!1};try{o.call(r,bind(internalResolve,t,n,e),bind(internalReject,t,n,e))}catch(r){internalReject(t,n,r,e)}})):(e.value=r,e.state=1,notify$1(t,e,!1))}catch(r){internalReject(t,{done:!1},r,e)}}};or&&($e=function Promise(t){!function(t,e,r){if(!(t instanceof e))throw TypeError("Incorrect "+(r?r+" ":"")+"invocation")}(this,$e,Be),aFunction$1(t),Ne.call(this);var e=Ye(this);try{t(bind(internalResolve,this,e),bind(internalReject,this,e))}catch(t){internalReject(this,e,t)}},(Ne=function Promise(t){He(this,{type:Be,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=function(t,e,r){for(var n in e)W(t,n,e[n],r);return t}($e.prototype,{then:function then(t,e){var r,n,o,i=Je(this),a=tr((r=$e,void 0===(o=anObject(this).constructor)||null==(n=anObject(o)[fe])?r:aFunction$1(n)));return a.ok="function"!=typeof t||t,a.fail="function"==typeof e&&e,a.domain=rr?Xe.domain:void 0,i.parent=!0,i.reactions.push(a),0!=i.state&&notify$1(this,i,!1),a.promise},catch:function(t){return this.then(void 0,t)}}),Re=function(){var t=new Ne,e=Ye(t);this.promise=t,this.resolve=bind(internalResolve,t,e),this.reject=bind(internalReject,t,e)},ze.f=tr=function(t){return t===$e||t===De?new Re(t):er(t)},"function"==typeof Jt&&(We=Jt.prototype.then,W(Jt.prototype,"then",(function then(t,e){var r=this;return new $e((function(t,e){We.call(r,t,e)})).then(t,e)}),{unsafe:!0}),"function"==typeof Ze&&_export({global:!0,enumerable:!0,forced:!0},{fetch:function fetch(t){return promiseResolve($e,Ze.apply(e,arguments))}}))),_export({global:!0,wrap:!0,forced:or},{Promise:$e}),setToStringTag($e,Be,!1),function(t){var e=getBuiltIn(t),n=v.f;r&&e&&!e[Qt]&&n(e,Qt,{configurable:!0,get:function(){return this}})}(Be),De=getBuiltIn(Be),_export({target:Be,stat:!0,forced:or},{reject:function reject(t){var e=tr(this);return e.reject.call(void 0,t),e.promise}}),_export({target:Be,stat:!0,forced:or},{resolve:function resolve(t){return promiseResolve(this,t)}}),_export({target:Be,stat:!0,forced:ir},{all:function all(t){var e=this,r=tr(e),n=r.resolve,o=r.reject,i=perform((function(){var r=aFunction$1(e.resolve),i=[],a=0,c=1;re(t,(function(t){var u=a++,s=!1;i.push(void 0),c++,r.call(e,t).then((function(t){s||(s=!0,i[u]=t,--c||n(i))}),o)})),--c||n(i)}));return i.error&&o(i.value),r.promise},race:function race(t){var e=this,r=tr(e),n=r.reject,o=perform((function(){var o=aFunction$1(e.resolve);re(t,(function(t){o.call(e,t).then(r.resolve,n)}))}));return o.error&&n(o.value),r.promise}});var ar=K.f,cr={}.toString,ur="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],sr={f:function getOwnPropertyNames(t){return ur&&"[object Window]"==cr.call(t)?function(t){try{return ar(t)}catch(t){return ur.slice()}}(t):ar(toIndexedObject(t))}},fr={f:wellKnownSymbol},lr=v.f,defineWellKnownSymbol=function(t){var e=q.Symbol||(q.Symbol={});has(e,t)||lr(e,t,{value:fr.f(t)})},pr=jt.forEach,hr=sharedKey("hidden"),yr=wellKnownSymbol("toPrimitive"),dr=D.set,vr=D.getterFor("Symbol"),gr=Object.prototype,mr=e.Symbol,br=getBuiltIn("JSON","stringify"),wr=y.f,Sr=v.f,Or=sr.f,jr=i.f,xr=P("symbols"),_r=P("op-symbols"),Pr=P("string-to-symbol-registry"),Er=P("symbol-to-string-registry"),kr=P("wks"),Ar=e.QObject,Tr=!Ar||!Ar.prototype||!Ar.prototype.findChild,Ir=r&&fails((function(){return 7!=dt(Sr({},"a",{get:function(){return Sr(this,"a",{value:7}).a}})).a}))?function(t,e,r){var n=wr(gr,e);n&&delete gr[e],Sr(t,e,r),n&&t!==gr&&Sr(gr,e,n)}:Sr,wrap=function(t,e){var n=xr[t]=dt(mr.prototype);return dr(n,{type:"Symbol",tag:t,description:e}),r||(n.description=e),n},Lr=ct?function(t){return"symbol"==typeof t}:function(t){return Object(t)instanceof mr},Mr=function defineProperty(t,e,r){t===gr&&Mr(_r,e,r),anObject(t);var n=toPrimitive(e,!0);return anObject(r),has(xr,n)?(r.enumerable?(has(t,hr)&&t[hr][n]&&(t[hr][n]=!1),r=dt(r,{enumerable:createPropertyDescriptor(0,!1)})):(has(t,hr)||Sr(t,hr,createPropertyDescriptor(1,{})),t[hr][n]=!0),Ir(t,n,r)):Sr(t,n,r)},Cr=function defineProperties(t,e){anObject(t);var n=toIndexedObject(e),o=lt(n).concat(Rr(n));return pr(o,(function(e){r&&!Gr.call(n,e)||Mr(t,e,n[e])})),t},Gr=function propertyIsEnumerable(t){var e=toPrimitive(t,!0),r=jr.call(this,e);return!(this===gr&&has(xr,e)&&!has(_r,e))&&(!(r||!has(this,e)||!has(xr,e)||has(this,hr)&&this[hr][e])||r)},Fr=function getOwnPropertyDescriptor(t,e){var r=toIndexedObject(t),n=toPrimitive(e,!0);if(r!==gr||!has(xr,n)||has(_r,n)){var o=wr(r,n);return!o||!has(xr,n)||has(r,hr)&&r[hr][n]||(o.enumerable=!0),o}},Nr=function getOwnPropertyNames(t){var e=Or(toIndexedObject(t)),r=[];return pr(e,(function(t){has(xr,t)||has(T,t)||r.push(t)})),r},Rr=function getOwnPropertySymbols(t){var e=t===gr,r=Or(e?_r:toIndexedObject(t)),n=[];return pr(r,(function(t){!has(xr,t)||e&&!has(gr,t)||n.push(xr[t])})),n};if(at||(W((mr=function Symbol(){if(this instanceof mr)throw TypeError("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,e=uid(t),setter=function(t){this===gr&&setter.call(_r,t),has(this,hr)&&has(this[hr],e)&&(this[hr][e]=!1),Ir(this,e,createPropertyDescriptor(1,t))};return r&&Tr&&Ir(gr,e,{configurable:!0,set:setter}),wrap(e,t)}).prototype,"toString",(function toString(){return vr(this).tag})),W(mr,"withoutSetter",(function(t){return wrap(uid(t),t)})),i.f=Gr,v.f=Mr,y.f=Fr,K.f=sr.f=Nr,Q.f=Rr,fr.f=function(t){return wrap(wellKnownSymbol(t),t)},r&&(Sr(mr.prototype,"description",{configurable:!0,get:function description(){return vr(this).description}}),W(gr,"propertyIsEnumerable",Gr,{unsafe:!0}))),_export({global:!0,wrap:!0,forced:!at,sham:!at},{Symbol:mr}),pr(lt(kr),(function(t){defineWellKnownSymbol(t)})),_export({target:"Symbol",stat:!0,forced:!at},{for:function(t){var e=String(t);if(has(Pr,e))return Pr[e];var r=mr(e);return Pr[e]=r,Er[r]=e,r},keyFor:function keyFor(t){if(!Lr(t))throw TypeError(t+" is not a symbol");if(has(Er,t))return Er[t]},useSetter:function(){Tr=!0},useSimple:function(){Tr=!1}}),_export({target:"Object",stat:!0,forced:!at,sham:!r},{create:function create(t,e){return void 0===e?dt(t):Cr(dt(t),e)},defineProperty:Mr,defineProperties:Cr,getOwnPropertyDescriptor:Fr}),_export({target:"Object",stat:!0,forced:!at},{getOwnPropertyNames:Nr,getOwnPropertySymbols:Rr}),_export({target:"Object",stat:!0,forced:fails((function(){Q.f(1)}))},{getOwnPropertySymbols:function getOwnPropertySymbols(t){return Q.f(toObject(t))}}),br){var Dr=!at||fails((function(){var t=mr();return"[null]"!=br([t])||"{}"!=br({a:t})||"{}"!=br(Object(t))}));_export({target:"JSON",stat:!0,forced:Dr},{stringify:function stringify(t,e,r){for(var n,o=[t],i=1;arguments.length>i;)o.push(arguments[i++]);if(n=e,(isObject(e)||void 0!==t)&&!Lr(t))return wt(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!Lr(e))return e}),o[1]=e,br.apply(null,o)}})}mr.prototype[yr]||g(mr.prototype,yr,mr.prototype.valueOf),setToStringTag(mr,"Symbol"),T[hr]=!0;var Wr=v.f,qr=e.Symbol;if(r&&"function"==typeof qr&&(!("description"in qr.prototype)||void 0!==qr().description)){var zr={},Ur=function Symbol(){var t=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),e=this instanceof Ur?new qr(t):void 0===t?qr():qr(t);return""===t&&(zr[e]=!0),e};copyConstructorProperties(Ur,qr);var Vr=Ur.prototype=qr.prototype;Vr.constructor=Ur;var Br=Vr.toString,Yr="Symbol(test)"==String(qr("test")),Hr=/^Symbol\((.*)\)[^)]+$/;Wr(Vr,"description",{configurable:!0,get:function description(){var t=isObject(this)?this.valueOf():this,e=Br.call(t);if(has(zr,t))return"";var r=Yr?e.slice(7,-1):e.replace(Hr,"$1");return""===r?void 0:r}}),_export({global:!0,forced:!0},{Symbol:Ur})}defineWellKnownSymbol("asyncIterator"),defineWellKnownSymbol("iterator"),defineWellKnownSymbol("toStringTag");var Jr=jt.forEach,$r=function(t,e){var r=[][t];return!!r&&fails((function(){r.call(null,e||function(){throw 1},1)}))}("forEach"),Kr=arrayMethodUsesToLength("forEach"),Qr=$r&&Kr?[].forEach:function forEach(t){return Jr(this,t,arguments.length>1?arguments[1]:void 0)};_export({target:"Array",proto:!0,forced:[].forEach!=Qr},{forEach:Qr});var Xr,Zr,tn,en=!fails((function(){function F(){}return F.prototype.constructor=null,Object.getPrototypeOf(new F)!==F.prototype})),rn=sharedKey("IE_PROTO"),nn=Object.prototype,on=en?Object.getPrototypeOf:function(t){return t=toObject(t),has(t,rn)?t[rn]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?nn:null},an=wellKnownSymbol("iterator"),cn=!1;[].keys&&("next"in(tn=[].keys())?(Zr=on(on(tn)))!==Object.prototype&&(Xr=Zr):cn=!0),null==Xr&&(Xr={}),has(Xr,an)||g(Xr,an,(function(){return this}));var un={IteratorPrototype:Xr,BUGGY_SAFARI_ITERATORS:cn},sn=un.IteratorPrototype,returnThis$1=function(){return this},fn=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,r={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(r,[]),e=r instanceof Array}catch(t){}return function setPrototypeOf(r,n){return anObject(r),function(t){if(!isObject(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype")}(n),e?t.call(r,n):r.__proto__=n,r}}():void 0),ln=un.IteratorPrototype,pn=un.BUGGY_SAFARI_ITERATORS,hn=wellKnownSymbol("iterator"),returnThis$2=function(){return this},defineIterator=function(t,e,r,n,o,i,a){!function(t,e,r){var n=e+" Iterator";t.prototype=dt(sn,{next:createPropertyDescriptor(1,r)}),setToStringTag(t,n,!1),Xt[n]=returnThis$1}(r,e,n);var c,u,s,getIterationMethod=function(t){if(t===o&&y)return y;if(!pn&&t in p)return p[t];switch(t){case"keys":return function keys(){return new r(this,t)};case"values":return function values(){return new r(this,t)};case"entries":return function entries(){return new r(this,t)}}return function(){return new r(this)}},f=e+" Iterator",l=!1,p=t.prototype,h=p[hn]||p["@@iterator"]||o&&p[o],y=!pn&&h||getIterationMethod(o),d="Array"==e&&p.entries||h;if(d&&(c=on(d.call(new t)),ln!==Object.prototype&&c.next&&(on(c)!==ln&&(fn?fn(c,ln):"function"!=typeof c[hn]&&g(c,hn,returnThis$2)),setToStringTag(c,f,!0))),"values"==o&&h&&"values"!==h.name&&(l=!0,y=function values(){return h.call(this)}),p[hn]!==y&&g(p,hn,y),Xt[e]=y,o)if(u={values:getIterationMethod("values"),keys:i?y:getIterationMethod("keys"),entries:getIterationMethod("entries")},a)for(s in u)(pn||l||!(s in p))&&W(p,s,u[s]);else _export({target:e,proto:!0,forced:pn||l},u);return u},yn=D.set,dn=D.getterFor("Array Iterator"),vn=defineIterator(Array,"Array",(function(t,e){yn(this,{type:"Array Iterator",target:toIndexedObject(t),index:0,kind:e})}),(function(){var t=dn(this),e=t.target,r=t.kind,n=t.index++;return!e||n>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:e[n],done:!1}:{value:[n,e[n]],done:!1}}),"values");Xt.Arguments=Xt.Array,addToUnscopables("keys"),addToUnscopables("values"),addToUnscopables("entries");var gn=[].reverse,mn=[1,2];_export({target:"Array",proto:!0,forced:String(mn)===String(mn.reverse())},{reverse:function reverse(){return wt(this)&&(this.length=this.length),gn.call(this)}});var bn=arrayMethodHasSpeciesSupport("slice"),wn=arrayMethodUsesToLength("slice",{ACCESSORS:!0,0:0,1:2}),Sn=wellKnownSymbol("species"),On=[].slice,jn=Math.max;_export({target:"Array",proto:!0,forced:!bn||!wn},{slice:function slice(t,e){var r,n,o,i,a,c,u,s=toIndexedObject(this),f=toLength(s.length),l=toAbsoluteIndex(t,f),p=toAbsoluteIndex(void 0===e?f:e,f);if(wt(s)&&("function"!=typeof(r=s.constructor)||r!==Array&&!wt(r.prototype)?isObject(r)&&null===(r=r[Sn])&&(r=void 0):r=void 0,r===Array||void 0===r))return On.call(s,l,p);for(n=new(void 0===r?Array:r)(jn(p-l,0)),o=0;l<p;l++,o++)l in s&&(i=n,a=o,c=s[l],u=void 0,(u=toPrimitive(a))in i?v.f(i,u,createPropertyDescriptor(0,c)):i[u]=c);return n.length=o,n}});var xn=Date.prototype,_n=xn.toString,Pn=xn.getTime;new Date(NaN)+""!="Invalid Date"&&W(xn,"toString",(function toString(){var t=Pn.call(this);return t==t?_n.call(this):"Invalid Date"})),setToStringTag(e.JSON,"JSON",!0),setToStringTag(Math,"Math",!0),_export({target:"Object",stat:!0,sham:!r},{create:dt}),_export({target:"Object",stat:!0,forced:!r,sham:!r},{defineProperty:v.f});var En=fails((function(){on(1)}));_export({target:"Object",stat:!0,forced:En,sham:!en},{getPrototypeOf:function getPrototypeOf(t){return on(toObject(t))}}),_export({target:"Object",stat:!0},{setPrototypeOf:fn});var regexpFlags=function(){var t=anObject(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e},kn=RegExp.prototype,An=kn.toString,Tn=fails((function(){return"/a/b"!=An.call({source:"a",flags:"b"})})),In="toString"!=An.name;(Tn||In)&&W(RegExp.prototype,"toString",(function toString(){var t=anObject(this),e=String(t.source),r=t.flags;return"/"+e+"/"+String(void 0===r&&t instanceof RegExp&&!("flags"in kn)?regexpFlags.call(t):r)}),{unsafe:!0});var createMethod$2=function(t){return function(e,r){var n,o,i=String(requireObjectCoercible(e)),a=toInteger(r),c=i.length;return a<0||a>=c?t?"":void 0:(n=i.charCodeAt(a))<55296||n>56319||a+1===c||(o=i.charCodeAt(a+1))<56320||o>57343?t?i.charAt(a):n:t?i.slice(a,a+2):o-56320+(n-55296<<10)+65536}},Ln={codeAt:createMethod$2(!1),charAt:createMethod$2(!0)}.charAt,Mn=D.set,Cn=D.getterFor("String Iterator");defineIterator(String,"String",(function(t){Mn(this,{type:"String Iterator",string:String(t),index:0})}),(function next(){var t,e=Cn(this),r=e.string,n=e.index;return n>=r.length?{value:void 0,done:!0}:(t=Ln(r,n),e.index+=t.length,{value:t,done:!1})}));var Gn={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0};for(var Fn in Gn){var Nn=e[Fn],Rn=Nn&&Nn.prototype;if(Rn&&Rn.forEach!==Qr)try{g(Rn,"forEach",Qr)}catch(t){Rn.forEach=Qr}}var Dn=wellKnownSymbol("iterator"),Wn=wellKnownSymbol("toStringTag"),qn=vn.values;for(var zn in Gn){var Un=e[zn],Vn=Un&&Un.prototype;if(Vn){if(Vn[Dn]!==qn)try{g(Vn,Dn,qn)}catch(t){Vn[Dn]=qn}if(Vn[Wn]||g(Vn,Wn,zn),Gn[zn])for(var Bn in vn)if(Vn[Bn]!==vn[Bn])try{g(Vn,Bn,vn[Bn])}catch(t){Vn[Bn]=vn[Bn]}}}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function _next(t){asyncGeneratorStep(i,n,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(i,n,o,_next,_throw,"throw",t)}_next(void 0)}))}}createCommonjsModule((function(t){var e=function(t){var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{define({},"")}catch(t){define=function define(t,e,r){return t[e]=r}}function wrap(t,e,r,n){var o=e&&e.prototype instanceof Generator?e:Generator,i=Object.create(o.prototype),a=new Context(n||[]);return i._invoke=function makeInvokeMethod(t,e,r){var n=u;return function invoke(o,i){if(n===f)throw new Error("Generator is already running");if(n===l){if("throw"===o)throw i;return doneResult()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=maybeInvokeDelegate(a,r);if(c){if(c===p)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===u)throw n=l,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=f;var h=tryCatch(t,e,r);if("normal"===h.type){if(n=r.done?l:s,h.arg===p)continue;return{value:h.arg,done:r.done}}"throw"===h.type&&(n=l,r.method="throw",r.arg=h.arg)}}}(t,r,a),i}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=wrap;var u="suspendedStart",s="suspendedYield",f="executing",l="completed",p={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var h={};h[i]=function(){return this};var y=Object.getPrototypeOf,d=y&&y(y(values([])));d&&d!==r&&n.call(d,i)&&(h=d);var v=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(h);function defineIteratorMethods(t){["next","throw","return"].forEach((function(e){define(t,e,(function(t){return this._invoke(e,t)}))}))}function AsyncIterator(t,e){var r;this._invoke=function enqueue(o,i){function callInvokeWithMethodAndArg(){return new e((function(r,a){!function invoke(r,o,i,a){var c=tryCatch(t[r],t,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"===_typeof(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){invoke("next",t,i,a)}),(function(t){invoke("throw",t,i,a)})):e.resolve(s).then((function(t){u.value=t,i(u)}),(function(t){return invoke("throw",t,i,a)}))}a(c.arg)}(o,i,r,a)}))}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,maybeInvokeDelegate(t,r),"throw"===r.method))return p;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var o=tryCatch(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,p;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,p):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0)}function values(t){if(t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function next(){for(;++o<t.length;)if(n.call(t,o))return next.value=t[o],next.done=!1,next;return next.value=e,next.done=!0,next};return a.next=a}}return{next:doneResult}}function doneResult(){return{value:e,done:!0}}return GeneratorFunction.prototype=v.constructor=GeneratorFunctionPrototype,GeneratorFunctionPrototype.constructor=GeneratorFunction,GeneratorFunction.displayName=define(GeneratorFunctionPrototype,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===GeneratorFunction||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,c,"GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),AsyncIterator.prototype[a]=function(){return this},t.AsyncIterator=AsyncIterator,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},defineIteratorMethods(v),define(v,c,"Generator"),v[i]=function(){return this},v.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function next(){for(;e.length;){var r=e.pop();if(r in t)return next.value=r,next.done=!1,next}return next.done=!0,next}},t.values=values,Context.prototype={constructor:Context,reset:function reset(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(resetTryEntry),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(t){if(this.done)throw t;var r=this;function handle(n,o){return a.type="throw",a.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc)}}}},abrupt:function abrupt(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function complete(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function finish(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),p}},catch:function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,r,n){return this.delegate={iterator:values(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),p}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));function __variableDynamicImportRuntime0__(t){switch(t){case"./locale/en.js":return Promise.resolve().then((function(){return Jn}));case"./locale/zh-CN.js":return Promise.resolve().then((function(){return $n}));default:return Promise.reject(new Error("Unknown variable dynamic import: "+t))}}var Yn=function(){var t=_asyncToGenerator(regeneratorRuntime.mark((function _callee(t){var e;return regeneratorRuntime.wrap((function _callee$(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,__variableDynamicImportRuntime0__("./locale/".concat(encodeURIComponent(t),".js"));case 3:e=r.sent,r.next=12;break;case 6:return r.prev=6,r.t0=r.catch(0),console.error("Missing translation (".concat(t,") - using 'en'")),r.next=11,Promise.resolve().then((function(){return Jn}));case 11:e=r.sent;case 12:return r.abrupt("return",e.default);case 13:case"end":return r.stop()}}),_callee,null,[[0,6]])})));return function loadExtensionTranslation(e){return t.apply(this,arguments)}}(),Hn={name:"polygon",init:function init(t){var e=this;return _asyncToGenerator(regeneratorRuntime.mark((function _callee2(){var r,n,o,i,a,c,u,s,f,l,p,h,y;return regeneratorRuntime.wrap((function _callee2$(d){for(;;)switch(d.prev=d.next){case 0:return p=function _sec(t){return 1/Math.cos(t)},l=function _cot(t){return 1/Math.tan(t)},f=function _setAttr(t,e){n.changeSelectedAttribute(t,e),n.call("changed",a)},s=function _showPanel(t){var e=o("#fc_rules");e.length||(e=o('<style id="fc_rules"></style>').appendTo("head")),e.text(t?" #tool_topath { display: none !important; }":""),o("#polygon_panel").toggle(t)},n=(r=e).canvas,o=t.$,!1,d.next=9,Yn(r.curPrefs.lang);case 9:return i=d.sent,h=[{id:"tool_polygon",icon:"polygon.png",type:"mode",position:11,events:{click:function click(){n.setMode("polygon"),s(!0)}}}],y=[{type:"input",panel:"polygon_panel",id:"polySides",size:3,defval:5,events:{change:function change(){f("sides",this.value)}}}],d.abrupt("return",{newUI:!0,name:i.name,buttons:i.buttons.map((function(t,e){return Object.assign(h[e],t)})),context_tools:i.contextTools.map((function(t,e){return Object.assign(y[e],t)})),callback:function callback(){o("#polygon_panel").hide(),setTimeout((function(){o("#tool_source_save").clone().hide().attr("id","polygon_save").unbind().appendTo("#tool_source_back").click((function(){})),o("#tool_source_cancel").clone().hide().attr("id","polygon_cancel").unbind().appendTo("#tool_source_back").click((function(){}))}),3e3)},mouseDown:function mouseDown(t){if("polygon"===n.getMode()){var e=n.getColor("fill"),r=n.getColor("stroke"),o=n.getStrokeWidth();return c=!0,u=n.addSVGElementFromJson({element:"polygon",attr:{cx:t.start_x,cy:t.start_y,id:n.getNextId(),shape:"regularPoly",sides:document.getElementById("polySides").value,orient:"x",edge:0,fill:e,strokecolor:r,strokeWidth:o}}),{started:!0}}},mouseMove:function mouseMove(t){if(c&&"polygon"===n.getMode()){var e=o(u).attr(["cx","cy","sides","orient","fill","strokecolor","strokeWidth"]),r=t.mouse_x,i=t.mouse_y,a=e.cx,s=e.cy,f=e.fill,h=e.strokecolor,y=e.strokeWidth,d=e.sides,v=Math.sqrt((r-a)*(r-a)+(i-s)*(i-s))/1.5;u.setAttribute("edge",v);for(var g=v/2*l(Math.PI/d)*p(Math.PI/d),m="",b=0;d>=b;b++){var w=2*Math.PI*b/d;m+=(r=g*Math.cos(w)+a)+","+(i=g*Math.sin(w)+s)+" "}return u.setAttribute("points",m),u.setAttribute("fill",f),u.setAttribute("stroke",h),u.setAttribute("stroke-width",y),{started:!0}}},mouseUp:function mouseUp(t){if("polygon"===n.getMode())return{keep:"0"!==o(u).attr("edge").edge,element:u}},selectedChanged:function selectedChanged(t){for(var e=(a=t.elems).length;e--;){var r=a[e];r&&"regularPoly"===r.getAttribute("shape")&&t.selectedElement&&!t.multiselected?(o("#polySides").val(r.getAttribute("sides")),s(!0)):s(!1)}},elementChanged:function elementChanged(t){}});case 13:case"end":return d.stop()}}),_callee2)})))()}},Jn=Object.freeze({__proto__:null,default:{name:"polygon",buttons:[{title:"Polygon Tool"}],contextTools:[{title:"Number of Sides",label:"sides"}]}}),$n=Object.freeze({__proto__:null,default:{name:"多边形",buttons:[{title:"多边形工具"}],contextTools:[{title:"边数",label:"边数"}]}});export default Hn;
//# sourceMappingURL=ext-polygon.js.map