You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1 lines
6.9 KiB

var K=Object.defineProperty;var N=(o,n,t)=>n in o?K(o,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[n]=t;var O=(o,n,t)=>N(o,typeof n!="symbol"?n+"":n,t);import{aa as P,C as $,V as U,_ as V,x as F,h as L,j as W}from"./index-BLqts8WY.js";function j(o,n,t){return parseInt(o.substr(n,t),16)}function E(o){return o|=0,o<0?"00":o<16?"0"+o.toString(16):o<256?o.toString(16):"ff"}function v(o,n,t){return t=t<0?t+6:t>6?t-6:t,E(255*(t<1?o+(n-o)*t:t<3?n:t<4?o+(n-o)*(4-t):o))}function Z(o){if(/^#[0-9a-f]{3,8}$/i.test(o)){let n;const t=o.length;if(t<6){const r=o[1],s=o[2],i=o[3],e=o[4]||"";n="#"+r+r+s+s+i+i+e+e}return(t==7||t>8)&&(n=o),n}}function q(o,n,t){let r;if(n==0){const s=E(t*255);r=s+s+s}else{const s=t<=.5?t*(n+1):t+n-t*n,i=t*2-s;r=v(i,s,o*6+2)+v(i,s,o*6)+v(i,s,o*6-2)}return"#"+r}function y(o,n,t){const r=[.55,.5,.5,.46,.6,.55,.55],s=r[o*6+.5|0];return t=t<.5?t*s*2:s+(t-.5)*(1-s)*2,q(o,n,t)}const Y=typeof window<"u"?window:typeof self<"u"?self:typeof global<"u"?global:{},R={V:"jdenticon_config",n:"config"};var J={};function X(o,n){const t=typeof o=="object"&&o||J[R.n]||Y[R.V]||{},r=t.lightness||{},s=t.saturation||{},i="color"in s?s.color:s,e=s.grayscale,u=t.backColor,a=t.padding;function f(d,c){let p=r[d];return p&&p.length>1||(p=c),function(h){return h=p[0]+h*(p[1]-p[0]),h<0?0:h>1?1:h}}function g(d){const c=t.hues;let p;return c&&c.length>0&&(p=c[0|.999*d*c.length]),typeof p=="number"?(p/360%1+1)%1:d}return{W:g,o:typeof i=="number"?i:.5,D:typeof e=="number"?e:0,p:f("color",[.4,.8]),F:f("grayscale",[.3,.9]),G:Z(u),X:typeof o=="number"?o:typeof a=="number"?a:n}}class T{constructor(n,t){this.x=n,this.y=t}}class D{constructor(n,t,r,s){this.q=n,this.t=t,this.H=r,this.Y=s}I(n,t,r,s){const i=this.q+this.H,e=this.t+this.H,u=this.Y;return u===1?new T(i-t-(s||0),this.t+n):u===2?new T(i-n-(r||0),e-t-(s||0)):u===3?new T(this.q+t,e-n-(r||0)):new T(this.q+n,this.t+t)}}const Q=new D(0,0,0,0);class z{constructor(n){this.J=n,this.u=Q}g(n,t){const r=t?-2:2,s=[];for(let i=t?n.length-2:0;i<n.length&&i>=0;i+=r)s.push(this.u.I(n[i],n[i+1]));this.J.g(s)}h(n,t,r,s){const i=this.u.I(n,t,r,r);this.J.h(i,r,s)}i(n,t,r,s,i){this.g([n,t,n+r,t,n+r,t+s,n,t+s],i)}j(n,t,r,s,i,e){const u=[n+r,t,n+r,t+s,n,t+s,n,t];u.splice((i||0)%4*2,2),this.g(u,e)}K(n,t,r,s,i){this.g([n+r/2,t,n+r,t+s/2,n+r/2,t+s,n,t+s/2],i)}}function x(o,n,t,r){o=o%14;let s,i,e,u,a,f;o?o==1?(e=0|t*.5,u=0|t*.8,n.j(t-e,0,e,u,2)):o==2?(e=0|t/3,n.i(e,e,t-e,t-e)):o==3?(a=t*.1,f=t<6?1:t<8?2:0|t*.25,a=a>1?0|a:a>.5?1:a,n.i(f,f,t-a-f,t-a-f)):o==4?(i=0|t*.15,e=0|t*.5,n.h(t-e-i,t-e-i,e)):o==5?(a=t*.1,f=a*4,f>3&&(f=0|f),n.i(0,0,t,t),n.g([f,f,t-a,f,f+(t-f-a)/2,t-a],!0)):o==6?n.g([0,0,t,0,t,t*.7,t*.4,t*.4,t*.7,t,0,t]):o==7?n.j(t/2,t/2,t/2,t/2,3):o==8?(n.i(0,0,t,t/2),n.i(0,t/2,t/2,t/2),n.j(t/2,t/2,t/2,t/2,1)):o==9?(a=t*.14,f=t<4?1:t<6?2:0|t*.35,a=t<8?a:0|a,n.i(0,0,t,t),n.i(f,f,t-f-a,t-f-a,!0)):o==10?(a=t*.12,f=a*3,n.i(0,0,t,t),n.h(f,f,t-a-f,!0)):o==11?n.j(t/2,t/2,t/2,t/2,3):o==12?(i=t*.25,n.i(0,0,t,t),n.K(i,i,t-i,t-i,!0)):!r&&(i=t*.4,e=t*1.2,n.h(i,i,e)):(s=t*.42,n.g([0,0,t,0,t,t-s*2,t-s,t,0,t]))}function k(o,n,t){o=o%4;let r;o?o==1?n.j(0,t/2,t,t/2,0):o==2?n.K(0,0,t,t):(r=t/6,n.h(r,r,t-2*r)):n.j(0,0,t,t,0)}function l(o,n){return o=n.W(o),[y(o,n.D,n.F(0)),y(o,n.o,n.p(.5)),y(o,n.D,n.F(1)),y(o,n.o,n.p(1)),y(o,n.o,n.p(0))]}function tt(o,n,t){const r=X(t,.08);r.G&&o.m(r.G);let s=o.k;const i=.5+s*r.X|0;s-=i*2;const e=new z(o),u=0|s/4,a=0|i+s/2-u*2,f=0|i+s/2-u*2;function g(S,_,B,I,A){const M=j(n,B,1);let G=I?j(n,I,1):0;o.L(c[p[S]]);for(let C=0;C<A.length;C++)e.u=new D(a+A[C][0]*u,f+A[C][1]*u,u,G++%4),_(M,e,u,C);o.M()}const d=j(n,-7)/268435455,c=l(d,r),p=[];let h;function m(S){if(S.indexOf(h)>=0){for(let _=0;_<S.length;_++)if(p.indexOf(S[_])>=0)return!0}}for(let S=0;S<3;S++)h=j(n,8+S,1)%c.length,(m([0,4])||m([2,3]))&&(h=1),p.push(h);g(0,k,2,3,[[1,0],[2,0],[2,3],[1,3],[0,1],[3,1],[3,2],[0,2]]),g(1,k,4,5,[[0,0],[3,0],[3,3],[0,3]]),g(2,x,1,null,[[1,1],[2,1],[2,2],[1,2]]),o.finish()}function nt(o){var r=0,s=0,i=encodeURI(o)+"%80",e=[],u,a=[],f=1732584193,g=4023233417,d=~f,c=~g,p=3285377520,h=[f,g,d,c,p],m=0,S="";function _(B,I){return B<<I|B>>>32-I}for(;r<i.length;s++)e[s>>2]=e[s>>2]|(i[r]=="%"?parseInt(i.substring(r+1,r+=3),16):i.charCodeAt(r++))<<(3-(s&3))*8;for(u=((s+7>>6)+1)*16,e[u-1]=s*8-8;m<u;m+=16){for(r=0;r<80;r++)s=_(f,5)+p+(r<20?(g&d^~g&c)+1518500249:r<40?(g^d^c)+1859775393:r<60?(g&d^g&c^d&c)+2400959708:(g^d^c)+3395469782)+(a[r]=r<16?e[m+r]|0:_(a[r-3]^a[r-8]^a[r-14]^a[r-16],1)),p=c,c=d,d=_(g,30),g=f,f=s;h[0]=f=h[0]+f|0,h[1]=g=h[1]+g|0,h[2]=d=h[2]+d|0,h[3]=c=h[3]+c|0,h[4]=p=h[4]+p|0}for(r=0;r<40;r++)S+=(h[r>>3]>>>(7-(r&7))*4&15).toString(16);return S}function ot(o){return/^[0-9a-f]{11,}$/i.test(o)&&o}function rt(o){return nt(o==null?"":""+o)}typeof document<"u"&&document.querySelectorAll.bind(document);function w(o){return(o*10+.5|0)/10}class st{constructor(){this.v=""}g(n){let t="";for(let r=0;r<n.length;r++)t+=(r?"L":"M")+w(n[r].x)+" "+w(n[r].y);this.v+=t+"Z"}h(n,t,r){const s=r?0:1,i=w(t/2),e=w(t),u="a"+i+","+i+" 0 1,"+s+" ";this.v+="M"+w(n.x)+" "+w(n.y+t/2)+u+e+",0"+u+-e+",0"}}class it{constructor(n){this.A,this.B={},this.O=n,this.k=n.k}m(n){const t=/^(#......)(..)?/.exec(n),r=t[2]?j(t[2],0)/255:1;this.O.m(t[1],r)}L(n){this.A=this.B[n]||(this.B[n]=new st)}M(){}g(n){this.A.g(n)}h(n,t,r){this.A.h(n,t,r)}finish(){const n=this.B;for(let t in n)n.hasOwnProperty(t)&&this.O.P(t,n[t].v)}}const et={R:"http://www.w3.org/2000/svg",S:"width",T:"height"};class ft{constructor(n){this.k=n,this.C='<svg xmlns="'+et.R+'" width="'+n+'" height="'+n+'" viewBox="0 0 '+n+" "+n+'">'}m(n,t){t&&(this.C+='<rect width="100%" height="100%" fill="'+n+'" opacity="'+t.toFixed(2)+'"/>')}P(n,t){this.C+='<path fill="'+n+'" d="'+t+'"/>'}toString(){return this.C+"</svg>"}}function at(o,n,t){const r=new ft(n);return tt(new it(r),ot(o)||rt(o),t),r.toString()}var ut=Object.defineProperty,ht=Object.getOwnPropertyDescriptor,H=(o,n,t,r)=>{for(var s=r>1?void 0:r?ht(n,t):n,i=o.length-1,e;i>=0;i--)(e=o[i])&&(s=(r?e(n,t,s):e(s))||s);return r&&s&&ut(n,t,s),s};const ct={lightness:{color:[1,1],grayscale:[1,1]},saturation:{color:0,grayscale:0},backColor:"#0000"};let b=class extends U{constructor(){super(...arguments);O(this,"entityId","");O(this,"iconSize",0);O(this,"imageUrl","");O(this,"linkToFull",!1)}generateIdenticon(){if(this.imageUrl)return`<img src="${this.imageUrl}" class="w-full h-full object-contain" />`;{const t=this.entityId?void 0:ct;return at(this.entityId,this.iconSize,t)}}};H([P],b.prototype,"entityId",2);H([P],b.prototype,"iconSize",2);H([P],b.prototype,"imageUrl",2);H([P],b.prototype,"linkToFull",2);b=H([$],b);const pt=["href"],gt=["innerHTML"],dt=["innerHTML"];function St(o,n,t,r,s,i){return o.linkToFull&&o.imageUrl?(F(),L("a",{key:0,href:o.imageUrl,target:"_blank",class:"h-full w-full object-contain"},[W("div",{innerHTML:o.generateIdenticon(),class:"h-full w-full object-contain"},null,8,gt)],8,pt)):(F(),L("div",{key:1,innerHTML:o.generateIdenticon(),class:"h-full w-full object-contain"},null,8,dt))}const wt=V(b,[["render",St]]);export{wt as P};