amis-rpc-design/dist/1339.295acf93.bundle.js
2023-10-07 19:42:30 +08:00

2 lines
16 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*! For license information please see 1339.295acf93.bundle.js.LICENSE.txt */
(self.webpackChunkamis_rpc_design=self.webpackChunkamis_rpc_design||[]).push([[1339],{61339:(t,e,a)=>{var i;self,i=function(t){return(()=>{"use strict";var e={"./index.js":(t,e,a)=>{a.r(e);var i=a("echarts/lib/echarts");i.extendSeriesModel({type:"series.wordCloud",visualStyleAccessPath:"textStyle",visualStyleMapper:function(t){return{fill:t.get("color")}},visualDrawType:"fill",optionUpdated:function(){var t=this.option;t.gridSize=Math.max(Math.floor(t.gridSize),4)},getInitialData:function(t,e){var a=i.helper.createDimensions(t.data,{coordDimensions:["value"]}),r=new i.List(a,this);return r.initData(t.data),r},defaultOption:{maskImage:null,shape:"circle",keepAspect:!1,left:"center",top:"center",width:"70%",height:"80%",sizeRange:[12,60],rotationRange:[-90,90],rotationStep:45,gridSize:8,drawOutOfBound:!1,shrinkToFit:!1,textStyle:{fontWeight:"normal"}}}),i.extendChartView({type:"wordCloud",render:function(t,e,a){var r=this.group;r.removeAll();var n=t.getData(),o=t.get("gridSize");t.layoutInstance.ondraw=function(e,a,s,l){var d=n.getItemModel(s),u=d.getModel("textStyle"),f=new i.graphic.Text({style:i.helper.createTextStyle(u),scaleX:1/l.info.mu,scaleY:1/l.info.mu,x:(l.gx+l.info.gw/2)*o,y:(l.gy+l.info.gh/2)*o,rotation:l.rot});f.setStyle({x:l.info.fillTextOffsetX,y:l.info.fillTextOffsetY+.5*a,text:e,verticalAlign:"middle",fill:n.getItemVisual(s,"style").fill,fontSize:a}),r.add(f),n.setItemGraphicEl(s,f),f.ensureState("emphasis").style=i.helper.createTextStyle(d.getModel(["emphasis","textStyle"]),{state:"emphasis"}),f.ensureState("blur").style=i.helper.createTextStyle(d.getModel(["blur","textStyle"]),{state:"blur"}),i.helper.enableHoverEmphasis(f,d.get(["emphasis","focus"]),d.get(["emphasis","blurScope"])),f.stateTransition={duration:t.get("animation")?t.get(["stateAnimation","duration"]):0,easing:t.get(["stateAnimation","easing"])},f.__highDownDispatcher=!0},this._model=t},remove:function(){this.group.removeAll(),this._model.layoutInstance.dispose()},dispose:function(){this._model.layoutInstance.dispose()}}),window.setImmediate||(window.setImmediate=window.msSetImmediate||window.webkitSetImmediate||window.mozSetImmediate||window.oSetImmediate||function(){if(!window.postMessage||!window.addEventListener)return null;var t=[void 0],e="zero-timeout-message";return window.addEventListener("message",(function(a){if("string"==typeof a.data&&a.data.substr(0,20)===e){a.stopImmediatePropagation();var i=parseInt(a.data.substr(20),36);t[i]&&(t[i](),t[i]=void 0)}}),!0),window.clearImmediate=function(e){t[e]&&(t[e]=void 0)},function(a){var i=t.length;return t.push(a),window.postMessage(e+i.toString(36),"*"),i}}()||function(t){window.setTimeout(t,0)}),window.clearImmediate||(window.clearImmediate=window.msClearImmediate||window.webkitClearImmediate||window.mozClearImmediate||window.oClearImmediate||function(t){window.clearTimeout(t)});var r=function(){var t=document.createElement("canvas");if(!t||!t.getContext)return!1;var e=t.getContext("2d");return!!(e&&e.getImageData&&e.fillText&&Array.prototype.some&&Array.prototype.push)}(),n=function(){if(r){for(var t,e,a=document.createElement("canvas").getContext("2d"),i=20;i;){if(a.font=i.toString(10)+"px sans-serif",a.measureText("").width===t&&a.measureText("m").width===e)return i+1;t=a.measureText("").width,e=a.measureText("m").width,i--}return 0}}(),o=function(t){for(var e,a,i=t.length;i;)e=Math.floor(Math.random()*i),a=t[--i],t[i]=t[e],t[e]=a;return t},s={},l=function(t,e){if(r){var a=Math.floor(Math.random()*Date.now());Array.isArray(t)||(t=[t]),t.forEach((function(e,a){if("string"==typeof e){if(t[a]=document.getElementById(e),!t[a])throw new Error("The element id specified is not found.")}else if(!e.tagName&&!e.appendChild)throw new Error("You must pass valid HTML elements, or ID of the element.")}));var i={list:[],fontFamily:'"Trebuchet MS", "Heiti TC", "微軟正黑體", "Arial Unicode MS", "Droid Fallback Sans", sans-serif',fontWeight:"normal",color:"random-dark",minSize:0,weightFactor:1,clearCanvas:!0,backgroundColor:"#fff",gridSize:8,drawOutOfBound:!1,shrinkToFit:!1,origin:null,drawMask:!1,maskColor:"rgba(255,0,0,0.3)",maskGapWidth:.3,layoutAnimation:!0,wait:0,abortThreshold:0,abort:function(){},minRotation:-Math.PI/2,maxRotation:Math.PI/2,rotationStep:.1,shuffle:!0,rotateRatio:.1,shape:"circle",ellipticity:.65,classes:null,hover:null,click:null};if(e)for(var l in e)l in i&&(i[l]=e[l]);if("function"!=typeof i.weightFactor){var d=i.weightFactor;i.weightFactor=function(t){return t*d}}if("function"!=typeof i.shape)switch(i.shape){case"circle":default:i.shape="circle";break;case"cardioid":i.shape=function(t){return 1-Math.sin(t)};break;case"diamond":i.shape=function(t){var e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))};break;case"square":i.shape=function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))};break;case"triangle-forward":i.shape=function(t){var e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))};break;case"triangle":case"triangle-upright":i.shape=function(t){var e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))};break;case"pentagon":i.shape=function(t){var e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))};break;case"star":i.shape=function(t){var e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}}i.gridSize=Math.max(Math.floor(i.gridSize),4);var u,f,h,c,m,g,w,v,p=i.gridSize,y=p-i.maskGapWidth,x=Math.abs(i.maxRotation-i.minRotation),M=Math.min(i.maxRotation,i.minRotation),S=i.rotationStep;switch(i.color){case"random-dark":w=function(){return L(10,50)};break;case"random-light":w=function(){return L(50,90)};break;default:"function"==typeof i.color&&(w=i.color)}"function"==typeof i.fontWeight&&(v=i.fontWeight);var b=null;"function"==typeof i.classes&&(b=i.classes);var I,T=!1,k=[],C=function(t){var e,a,i=t.currentTarget,r=i.getBoundingClientRect();t.touches?(e=t.touches[0].clientX,a=t.touches[0].clientY):(e=t.clientX,a=t.clientY);var n=e-r.left,o=a-r.top,s=Math.floor(n*(i.width/r.width||1)/p),l=Math.floor(o*(i.height/r.height||1)/p);return k[s]?k[s][l]:null},E=function(t){var e=C(t);I!==e&&(I=e,e?i.hover(e.item,e.dimension,t):i.hover(void 0,void 0,t))},A=function(t){var e=C(t);e&&(i.click(e.item,e.dimension,t),t.preventDefault())},O=[],F=function(t){if(O[t])return O[t];var e=8*t,a=e,r=[];for(0===t&&r.push([c[0],c[1],0]);a--;){var n=1;"circle"!==i.shape&&(n=i.shape(a/e*2*Math.PI)),r.push([c[0]+t*n*Math.cos(-a/e*2*Math.PI),c[1]+t*n*Math.sin(-a/e*2*Math.PI)*i.ellipticity,a/e*2*Math.PI])}return O[t]=r,r},D=function(){return i.abortThreshold>0&&(new Date).getTime()-g>i.abortThreshold},P=function(e,a,i,r,n){e>=f||a>=h||e<0||a<0||(u[e][a]=!1,i&&t[0].getContext("2d").fillRect(e*p,a*p,y,y),T&&(k[e][a]={item:n,dimension:r}))},R=function e(a,r){if(r>20)return null;var s,l,d;Array.isArray(a)?(s=a[0],l=a[1]):(s=a.word,l=a.weight,d=a.attributes);var c,g,y,I=0===i.rotateRatio||Math.random()>i.rotateRatio?0:0===x?M:M+Math.round(Math.random()*x/S)*S,k=function(t){if(Array.isArray(t)){var e=t.slice();return e.splice(0,2),e}return[]}(a),C=function(t,e,a,r){var o=i.weightFactor(e);if(o<=i.minSize)return!1;var s,l=1;o<n&&(l=function(){for(var t=2;t*o<n;)t+=2;return t}()),s=v?v(t,e,o,r):i.fontWeight;var d=document.createElement("canvas"),u=d.getContext("2d",{willReadFrequently:!0});u.font=s+" "+(o*l).toString(10)+"px "+i.fontFamily;var f=u.measureText(t).width/l,h=Math.max(o*l,u.measureText("m").width,u.measureText("").width)/l,c=f+2*h,m=3*h,g=Math.ceil(c/p),w=Math.ceil(m/p);c=g*p,m=w*p;var y=-f/2,x=.4*-h,M=Math.ceil((c*Math.abs(Math.sin(a))+m*Math.abs(Math.cos(a)))/p),S=Math.ceil((c*Math.abs(Math.cos(a))+m*Math.abs(Math.sin(a)))/p),b=S*p,I=M*p;d.setAttribute("width",b),d.setAttribute("height",I),u.scale(1/l,1/l),u.translate(b*l/2,I*l/2),u.rotate(-a),u.font=s+" "+(o*l).toString(10)+"px "+i.fontFamily,u.fillStyle="#000",u.textBaseline="middle",u.fillText(t,y*l,(x+.5*o)*l);var T=u.getImageData(0,0,b,I).data;if(D())return!1;for(var k,C,E,A=[],O=S,F=[M/2,S/2,M/2,S/2];O--;)for(k=M;k--;){E=p;t:for(;E--;)for(C=p;C--;)if(T[4*((k*p+E)*b+(O*p+C))+3]){A.push([O,k]),O<F[3]&&(F[3]=O),O>F[1]&&(F[1]=O),k<F[0]&&(F[0]=k),k>F[2]&&(F[2]=k);break t}}return{mu:l,occupied:A,bounds:F,gw:S,gh:M,fillTextOffsetX:y,fillTextOffsetY:x,fillTextWidth:f,fillTextHeight:h,fontSize:o}}(s,l,I,k);if(!C)return!1;if(D())return!1;if(!i.drawOutOfBound&&!i.shrinkToFit){var E=C.bounds;if(E[1]-E[3]+1>f||E[2]-E[0]+1>h)return!1}for(var A=m+1;A--;){var O=F(m-A);i.shuffle&&(O=[].concat(O),o(O));for(var R=0;R<O.length;R++){var z=(c=O[R],g=void 0,y=void 0,g=Math.floor(c[0]-C.gw/2),y=Math.floor(c[1]-C.gh/2),C.gw,C.gh,!!function(t,e,a,r,n){for(var o=n.length;o--;){var s=t+n[o][0],l=e+n[o][1];if(s>=f||l>=h||s<0||l<0){if(!i.drawOutOfBound)return!1}else if(!u[s][l])return!1}return!0}(g,y,0,0,C.occupied)&&(function(e,a,r,n,o,s,l,d,u,f){var h,c,m,g=r.fontSize;h=w?w(n,o,g,s,l,f):i.color,c=v?v(n,o,g,f):i.fontWeight,m=b?b(n,o,g,f):i.classes,t.forEach((function(t){if(t.getContext){var o=t.getContext("2d"),s=r.mu;o.save(),o.scale(1/s,1/s),o.font=c+" "+(g*s).toString(10)+"px "+i.fontFamily,o.fillStyle=h,o.translate((e+r.gw/2)*p*s,(a+r.gh/2)*p*s),0!==d&&o.rotate(-d),o.textBaseline="middle",o.fillText(n,r.fillTextOffsetX*s,(r.fillTextOffsetY+.5*g)*s),o.restore()}else{var l=document.createElement("span"),f="";f="rotate("+-d/Math.PI*180+"deg) ",1!==r.mu&&(f+="translateX(-"+r.fillTextWidth/4+"px) scale("+1/r.mu+")");var w={position:"absolute",display:"block",font:c+" "+g*r.mu+"px "+i.fontFamily,left:(e+r.gw/2)*p+r.fillTextOffsetX+"px",top:(a+r.gh/2)*p+r.fillTextOffsetY+"px",width:r.fillTextWidth+"px",height:r.fillTextHeight+"px",lineHeight:g+"px",whiteSpace:"nowrap",transform:f,webkitTransform:f,msTransform:f,transformOrigin:"50% 40%",webkitTransformOrigin:"50% 40%",msTransformOrigin:"50% 40%"};for(var v in h&&(w.color=h),l.textContent=n,w)l.style[v]=w[v];if(u)for(var y in u)l.setAttribute(y,u[y]);m&&(l.className+=m),t.appendChild(l)}}))}(g,y,C,s,l,m-A,c[2],I,d,k),function(e,a,r,n,o,s){var l,d,u=o.occupied,c=i.drawMask;if(c&&((l=t[0].getContext("2d")).save(),l.fillStyle=i.maskColor),T){var m=o.bounds;d={x:(e+m[3])*p,y:(a+m[0])*p,w:(m[1]-m[3]+1)*p,h:(m[2]-m[0]+1)*p}}for(var g=u.length;g--;){var w=e+u[g][0],v=a+u[g][1];w>=f||v>=h||w<0||v<0||P(w,v,c,d,s)}c&&l.restore()}(g,y,0,0,C,a),{gx:g,gy:y,rot:I,info:C}));if(z)return z}}return i.shrinkToFit?(Array.isArray(a)?a[1]=3*a[1]/4:a.weight=3*a.weight/4,e(a,r+1)):null},z=function(e,a,i){if(a)return!t.some((function(t){var a=new CustomEvent(e,{detail:i||{}});return!t.dispatchEvent(a)}),this);t.forEach((function(t){var a=new CustomEvent(e,{detail:i||{}});t.dispatchEvent(a)}),this)};!function(){var e=t[0];if(e.getContext)f=Math.ceil(e.width/p),h=Math.ceil(e.height/p);else{var r=e.getBoundingClientRect();f=Math.ceil(r.width/p),h=Math.ceil(r.height/p)}if(z("wordcloudstart",!0)){var n,o,l,d,w;if(c=i.origin?[i.origin[0]/p,i.origin[1]/p]:[f/2,h/2],m=Math.floor(Math.sqrt(f*f+h*h)),u=[],!e.getContext||i.clearCanvas)for(t.forEach((function(t){if(t.getContext){var e=t.getContext("2d");e.fillStyle=i.backgroundColor,e.clearRect(0,0,f*(p+1),h*(p+1)),e.fillRect(0,0,f*(p+1),h*(p+1))}else t.textContent="",t.style.backgroundColor=i.backgroundColor,t.style.position="relative"})),n=f;n--;)for(u[n]=[],o=h;o--;)u[n][o]=!0;else{var v=document.createElement("canvas").getContext("2d");v.fillStyle=i.backgroundColor,v.fillRect(0,0,1,1);var y,x,M=v.getImageData(0,0,1,1).data,S=e.getContext("2d").getImageData(0,0,f*p,h*p).data;for(n=f;n--;)for(u[n]=[],o=h;o--;){x=p;t:for(;x--;)for(y=p;y--;)for(l=4;l--;)if(S[4*((o*p+x)*f*p+(n*p+y))+l]!==M[l]){u[n][o]=!1;break t}!1!==u[n][o]&&(u[n][o]=!0)}S=v=M=void 0}if(i.hover||i.click){for(T=!0,n=f+1;n--;)k[n]=[];i.hover&&e.addEventListener("mousemove",E),i.click&&(e.addEventListener("click",A),e.addEventListener("touchstart",A),e.addEventListener("touchend",(function(t){t.preventDefault()})),e.style.webkitTapHighlightColor="rgba(0, 0, 0, 0)"),e.addEventListener("wordcloudstart",(function t(){e.removeEventListener("wordcloudstart",t),e.removeEventListener("mousemove",E),e.removeEventListener("click",A),I=void 0}))}l=0;var b=!0;i.layoutAnimation?0!==i.wait?(d=window.setTimeout,w=window.clearTimeout):(d=window.setImmediate,w=window.clearImmediate):(d=function(t){t()},w=function(){b=!1});var C=function(e,a){t.forEach((function(t){t.removeEventListener(e,a)}),this)},O=function t(){C("wordcloudstart",t),w(s[a])};!function(e,a){t.forEach((function(t){t.addEventListener("wordcloudstart",a)}),this)}(0,O),s[a]=(i.layoutAnimation?d:setTimeout)((function t(){if(b){if(l>=i.list.length)return w(s[a]),z("wordcloudstop",!1),C("wordcloudstart",O),void delete s[a];g=(new Date).getTime();var e=R(i.list[l],0),r=!z("wordclouddrawn",!0,{item:i.list[l],drawn:e});if(D()||r)return w(s[a]),i.abort(),z("wordcloudabort",!1),z("wordcloudstop",!1),void C("wordcloudstart",O);l++,s[a]=d(t,i.wait)}}),i.wait)}}()}function L(t,e){return"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)"}};l.isSupported=r,l.minFontSize=n;const d=l;if(!d.isSupported)throw new Error("Sorry your browser not support wordCloud");i.registerLayout((function(t,e){t.eachSeriesByType("wordCloud",(function(a){var r=i.helper.getLayoutRect(a.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()}),n=a.get("keepAspect"),o=a.get("maskImage"),s=o?o.width/o.height:1;n&&function(t,e){var a=t.width,i=t.height;a>i*e?(t.x+=(a-i*e)/2,t.width=i*e):(t.y+=(i-a/e)/2,t.height=a/e)}(r,s);var l=a.getData(),u=document.createElement("canvas");u.width=r.width,u.height=r.height;var f=u.getContext("2d");if(o)try{f.drawImage(o,0,0,u.width,u.height),function(t){for(var e=t.getContext("2d"),a=e.getImageData(0,0,t.width,t.height),i=e.createImageData(a),r=0,n=0,o=0;o<a.data.length;o+=4)a.data[o+3]>128&&(r+=l=a.data[o]+a.data[o+1]+a.data[o+2],++n);var s=r/n;for(o=0;o<a.data.length;o+=4){var l=a.data[o]+a.data[o+1]+a.data[o+2];a.data[o+3]<128||l>s?(i.data[o]=0,i.data[o+1]=0,i.data[o+2]=0,i.data[o+3]=0):(i.data[o]=255,i.data[o+1]=255,i.data[o+2]=255,i.data[o+3]=255)}e.putImageData(i,0,0)}(u)}catch(t){console.error("Invalid mask image"),console.error(t.toString())}var h=a.get("sizeRange"),c=a.get("rotationRange"),m=l.getDataExtent("value"),g=Math.PI/180,w=a.get("gridSize");function v(t){var e=t.detail.item;t.detail.drawn&&a.layoutInstance.ondraw&&(t.detail.drawn.gx+=r.x/w,t.detail.drawn.gy+=r.y/w,a.layoutInstance.ondraw(e[0],e[1],e[2],t.detail.drawn))}d(u,{list:l.mapArray("value",(function(t,e){var a=l.getItemModel(e);return[l.getName(e),a.get("textStyle.fontSize",!0)||i.number.linearMap(t,m,h),e]})).sort((function(t,e){return e[1]-t[1]})),fontFamily:a.get("textStyle.fontFamily")||a.get("emphasis.textStyle.fontFamily")||t.get("textStyle.fontFamily"),fontWeight:a.get("textStyle.fontWeight")||a.get("emphasis.textStyle.fontWeight")||t.get("textStyle.fontWeight"),gridSize:w,ellipticity:r.height/r.width,minRotation:c[0]*g,maxRotation:c[1]*g,clearCanvas:!o,rotateRatio:1,rotationStep:a.get("rotationStep")*g,drawOutOfBound:a.get("drawOutOfBound"),shrinkToFit:a.get("shrinkToFit"),layoutAnimation:a.get("layoutAnimation"),shuffle:!1,shape:a.get("shape")}),u.addEventListener("wordclouddrawn",v),a.layoutInstance&&a.layoutInstance.dispose(),a.layoutInstance={ondraw:null,dispose:function(){u.removeEventListener("wordclouddrawn",v),u.addEventListener("wordclouddrawn",(function(t){t.preventDefault()}))}}}))})),i.registerPreprocessor((function(t){var e=(t||{}).series;!i.util.isArray(e)&&(e=e?[e]:[]);var a=["shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"];function r(t){t&&i.util.each(a,(function(e){t.hasOwnProperty(e)&&(t["text"+i.format.capitalFirst(e)]=t[e])}))}i.util.each(e,(function(t){if(t&&"wordCloud"===t.type){var e=t.textStyle||{};r(e.normal),r(e.emphasis)}}))}))},"echarts/lib/echarts":e=>{e.exports=t}},a={};function i(t){if(a[t])return a[t].exports;var r=a[t]={exports:{}};return e[t](r,r.exports,i),r.exports}return i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i("./index.js")})()},t.exports=i(a(36424))}}]);