{"version":3,"sources":["../src/index.ts"],"sourcesContent":["//@ts-expect-error\ndeclare global {\n  interface HTMLElementTagNameMap {\n    'github-corners': GithubCorners;\n  }\n}\n\nconst isBrowser = !!(\n  typeof window !== 'undefined' &&\n  window.document &&\n  window.document.createElement\n);\n\n(() => {\n  try {\n    if (isBrowser) {\n      const GITHUB_CORNERS_TEMPLATE = document.createElement('template');\n\n      GITHUB_CORNERS_TEMPLATE.innerHTML = `\n<style>\n:host a:hover .octo-arm { animation: octocat-wave 560ms ease-in-out; }\n@keyframes octocat-wave {\n  0%, 100% { transform: rotate(0); }\n  20%, 60% { transform: rotate(-25deg); }\n  40%, 80% { transform: rotate(10deg); }\n}\n@media (max-width:500px) {\n  :host a:hover .octo-arm { animation: none; }\n  :host .octo-arm { animation: octocat-wave 560ms ease-in-out; }\n}\n:host svg {\n  z-index: 99;\n  position: fixed;\n  border: 0px;\n  top: 0px;\n}\n</style>\n<svg width=\"54\" height=\"54\" viewBox=\"0 0 250 250\" aria-hidden=\"true\">\n  <a xlink:href=\"https://github.com/uiwjs/react-github-corners\" target=\"_blank\" rel=\"nofollow sponsored\" style=\"fill: rgb(21, 21, 19); color: rgb(255, 255, 255);\">\n    <g>\n      <path d=\"M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z\"></path>\n      <path d=\"M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2\" fill=\"currentColor\" class=\"octo-arm\" style=\"transform-origin: 130px 106px;\"></path>\n      <path d=\"M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z\" fill=\"currentColor\" class=\"octo-body\"></path>\n    </g>\n  </a>\n</svg>\n`;\n\n      class GithubCorners extends HTMLElement {\n        /** Sets the z-order of a positioned element and its descendants or flex items. */\n        'z-index'?: string;\n        height?: string | number;\n        width?: string | number;\n        href?: string;\n        color?: string;\n        fill?: string;\n        position?: string;\n        target?: string;\n        top?: string;\n        left?: string;\n        right?: string = '0';\n        bottom?: string;\n        transform?: string;\n        private shadow: ShadowRoot;\n        static get observedAttributes(): string[] {\n          return [\n            'style',\n            'z-index',\n            'target',\n            'height',\n            'width',\n            'href',\n            'color',\n            'fill',\n            'position',\n            'top',\n            'left',\n            'right',\n            'bottom',\n            'transform',\n          ];\n        }\n        constructor() {\n          super();\n          this.shadow = this.attachShadow({ mode: 'open' });\n          this.shadow.appendChild(\n            this.ownerDocument.importNode(GITHUB_CORNERS_TEMPLATE.content, true)\n          );\n          this.update();\n        }\n        private setAttr(name: string, value: string) {\n          const svg: any = this.shadow.querySelector('svg');\n          if (/(href)/.test(name.toLocaleLowerCase())) {\n            svg.lastElementChild.setAttribute('xlink:href', value);\n          } else if (/(color|fill)/.test(name.toLocaleLowerCase())) {\n            (svg.firstElementChild as HTMLAnchorElement).style[name as any] =\n              value;\n          } else if (\n            /(z-index|position|top|left|right|bottom|transform)/.test(\n              name.toLocaleLowerCase()\n            )\n          ) {\n            svg.style[name as any] = value;\n          } else {\n            svg.setAttribute(name, value);\n          }\n        }\n        private update() {\n          [...this.getAttributeNames(), 'right'].forEach((name) => {\n            const value =\n              this.getAttribute(name) ||\n              (this[name as keyof GithubCorners] as any) ||\n              '';\n            this.setAttr(name, value);\n          });\n        }\n        attributeChangedCallback(\n          name: string,\n          oldValue: string,\n          newValue: string\n        ) {\n          if (oldValue !== newValue) {\n            this.setAttr(name, newValue);\n          }\n        }\n      }\n\n      customElements.define('github-corners', GithubCorners);\n    }\n  } catch (error) {}\n})();\n"],"mappings":"AAOA,IAAMA,EAAY,CAAC,EACjB,OAAO,OAAW,KAClB,OAAO,UACP,OAAO,SAAS,gBAGjB,IAAM,CACL,GAAI,CACF,GAAIA,EAAW,CACb,IAAMC,EAA0B,SAAS,cAAc,UAAU,EAEjEA,EAAwB,UAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA8BpC,MAAMC,UAAsB,WAAY,CAkCtC,aAAc,CACZ,MAAM,EAvBR,WAAiB,IAwBf,KAAK,OAAS,KAAK,aAAa,CAAE,KAAM,MAAO,CAAC,EAChD,KAAK,OAAO,YACV,KAAK,cAAc,WAAWD,EAAwB,QAAS,EAAI,CACrE,EACA,KAAK,OAAO,CACd,CAzBA,WAAW,oBAA+B,CACxC,MAAO,CACL,QACA,UACA,SACA,SACA,QACA,OACA,QACA,OACA,WACA,MACA,OACA,QACA,SACA,WACF,CACF,CASQ,QAAQE,EAAcC,EAAe,CAC3C,IAAMC,EAAW,KAAK,OAAO,cAAc,KAAK,EAC5C,SAAS,KAAKF,EAAK,kBAAkB,CAAC,EACxCE,EAAI,iBAAiB,aAAa,aAAcD,CAAK,EAC5C,eAAe,KAAKD,EAAK,kBAAkB,CAAC,EACpDE,EAAI,kBAAwC,MAAMF,CAAW,EAC5DC,EAEF,qDAAqD,KACnDD,EAAK,kBAAkB,CACzB,EAEAE,EAAI,MAAMF,CAAW,EAAIC,EAEzBC,EAAI,aAAaF,EAAMC,CAAK,CAEhC,CACQ,QAAS,CACf,CAAC,GAAG,KAAK,kBAAkB,EAAG,OAAO,EAAE,QAASD,GAAS,CACvD,IAAMC,EACJ,KAAK,aAAaD,CAAI,GACrB,KAAKA,CAA2B,GACjC,GACF,KAAK,QAAQA,EAAMC,CAAK,CAC1B,CAAC,CACH,CACA,yBACED,EACAG,EACAC,EACA,CACID,IAAaC,GACf,KAAK,QAAQJ,EAAMI,CAAQ,CAE/B,CACF,CAEA,eAAe,OAAO,iBAAkBL,CAAa,EAEzD,MAAE,CAAe,CACnB,GAAG","names":["isBrowser","GITHUB_CORNERS_TEMPLATE","GithubCorners","name","value","svg","oldValue","newValue"]}