qr-border-plugin
Advanced tools
Comparing version
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.QRBorderPlugin=t():e.QRBorderPlugin=t()}(this,(()=>(()=>{var e={600:function(e){var t;t=()=>(()=>{var e={665:function(e){e.exports=(()=>{"use strict";var e={d:(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{LICENSE_STATUS:()=>c,LICENSING_MODELS:()=>l,base64Decode:()=>i,base64Encode:()=>r,findScopeNode:()=>y,md5:()=>a,showExpiredSubscriptionGraceLicenseKeyError:()=>f,showExpiredSubscriptionLicenseKeyError:()=>g,showInvalidLicenseKeyError:()=>p,showLicenseKeyScopeError:()=>u,showMissingLicenseKeyError:()=>h});const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i=e=>{let t,i,r,o,s,a,c,l="",d=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");d<e.length;)o=n.indexOf(e.charAt(d++)),s=n.indexOf(e.charAt(d++)),a=n.indexOf(e.charAt(d++)),c=n.indexOf(e.charAt(d++)),t=o<<2|s>>4,i=(15&s)<<4|a>>2,r=(3&a)<<6|c,l+=String.fromCharCode(t),64!=a&&(l+=String.fromCharCode(i)),64!=c&&(l+=String.fromCharCode(r));return l},r=e=>{let t,i,r,o,s,a,c,l="",d=0;for(e=function(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>=128)throw new Error("ASCII only support");return e}(e);d<e.length;)t=e.charCodeAt(d++),i=e.charCodeAt(d++),r=e.charCodeAt(d++),o=t>>2,s=(3&t)<<4|i>>4,a=(15&i)<<2|r>>6,c=63&r,isNaN(i)?a=c=64:isNaN(r)&&(c=64),l=l+n.charAt(o)+n.charAt(s)+n.charAt(a)+n.charAt(c);return l},o=[];let s=0;for(;s<64;)o[s]=0|4294967296*Math.sin(++s%Math.PI);function a(e){const t=[];let n,i,r,a=unescape(encodeURI(e))+"",c=a.length;const l=[n=1732584193,i=4023233417,~n,~i];for(e=--c/4+2|15,t[--e]=8*c;~c;)t[c>>2]|=a.charCodeAt(c)<<8*c--;for(s=a=0;s<e;s+=16){for(c=l;a<64;c=[r=c[3],n+((r=c[0]+[n&i|~n&r,r&n|~r&i,n^i^r,i^(n|~r)][c=a>>4]+o[a]+~~t[s|15&[a,5*a+1,3*a+5,7*a][c]])<<(c=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*c+a++%4])|r>>>-c),n,i])n=0|c[1],i=c[2];for(a=4;a;)l[--a]+=c[a]}for(e="";a<32;)e+=(l[a>>3]>>4*(1^a++)&15).toString(16);return e}var c;!function(e){e.NotFound="NotFound",e.Invalid="Invalid",e.ExpiredSubscription="ExpiredSubscription",e.ExpiredSubscriptionGrace="ExpiredSubscriptionGrace",e.Valid="Valid",e.OutOfScope="OutOfScope"}(c||(c={}));const l=["perpetual","subscription"];function d(e){console.error(["*************************************************************","",...e,"","*************************************************************"].join("\n"))}function p({organization:e}){d([`${e}: Invalid license key.`,"","Your icense key isn't valid.","","To solve the issue, you need to double check that `setLicenseKey()` is called with the right argument"])}function u({organization:e,packageName:t}){d([`${e}: License key plan mismatch.`,"",`Your use of ${t} is not compatible with the plan of your license key. The feature you are trying to use is not included in the plan of your license key.`])}function h({packageName:e,organization:t,scope:n}){d([`${t}: Missing license key.`,"",`The license key is missing. You might not be allowed to use \`${e}\` which is part of ${n} plan.`,"",`You need to purchase a license https://lefe.dev/${t}/license.`])}function f({scope:e,packageName:t,organization:n,licenseKey:i,expiryTimestamp:r}){d([`${n}: Expired license key.`,"",`Your subscription license key to use ${t} ${e} has expired.`,"",`- License key expiry timestamp: ${new Date(r)}`,`- Installed license key: ${i}`,""])}function g({scope:e,packageName:t,organization:n,licenseKey:i,expiryTimestamp:r}){throw new Error([`${n}: Expired license key.`,"",`Your subscription license key to use ${t} ${e} has expired.`,"",`- License key expiry timestamp: ${new Date(r)}`,`- Installed license key: ${i}`,""].join("\n"))}function y(e,t){return t?.find((({name:t,children:n})=>t===e||y(e,n)))}return t})()}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{"use strict";n.r(i),n.d(i,{LicenseInfo:()=>o,LicenseVerifier:()=>t});var e=n(665);class t{scopes;organization;constructor({scopes:e,organization:t}){this.scopes=e,this.organization=t}static isLicenseScopeSufficient(t,n,i){const r=(0,e.findScopeNode)(n,i),o=r&&[r];return!!(0,e.findScopeNode)(t,o)}static decodeLicense(t){const n=(0,e.base64Decode)(t),i={expiryTimestamp:null,scope:null,licensingModel:null,organization:null};return n.split(",").map((e=>e.split("="))).filter((e=>2===e.length)).forEach((([e,t])=>{switch(e){case"E":{const e=parseInt(t,10);e&&!Number.isNaN(e)&&(i.expiryTimestamp=e);break}case"S":i.scope=t;break;case"L":i.licensingModel=t;break;case"O":i.organization=t}})),i}verifyLicense({licenseKey:n,packageScope:i}){if(!n)return{status:e.LICENSE_STATUS.NotFound};const r=n.substr(0,32),o=n.substr(32);if(r!==(0,e.md5)(o))return{status:e.LICENSE_STATUS.Invalid};const s=t.decodeLicense(o);return null==s.expiryTimestamp?(console.error(`${this.organization}: Error checking license. Expiry timestamp not found or invalid!`),{status:e.LICENSE_STATUS.Invalid}):null==s.scope?(console.error(`${this.organization}: Error checking license. Scope not found or invalid!`),{status:e.LICENSE_STATUS.Invalid}):null!=s.licensingModel&&e.LICENSING_MODELS.includes(s.licensingModel)?t.isLicenseScopeSufficient(i,s.scope,this.scopes)?"subscription"===s.licensingModel&&(new Date).getTime()>s.expiryTimestamp?(new Date).getTime()<s.expiryTimestamp+2592e6?{status:e.LICENSE_STATUS.ExpiredSubscriptionGrace,meta:{expiryTimestamp:s.expiryTimestamp,licenseKey:n}}:{status:e.LICENSE_STATUS.ExpiredSubscription,meta:{expiryTimestamp:s.expiryTimestamp,licenseKey:n}}:{status:e.LICENSE_STATUS.Valid}:{status:e.LICENSE_STATUS.OutOfScope}:(console.error(`${this.organization}: Error checking license. Licensing model not found or invalid!`),{status:e.LICENSE_STATUS.Invalid})}}const r="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();class o{organization;constructor({organization:e}){this.organization=e,r[`__${this.organization}_LICENSE_INFO__`]=r[`__${this.organization}_LICENSE_INFO__`]||{key:void 0}}getLicenseInfo(){return r[`__${this.organization}_LICENSE_INFO__`]}getLicenseKey(){return this.getLicenseInfo().key}setLicenseKey(e){this.getLicenseInfo().key=e}}})(),i})(),e.exports=t()}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var i={};return(()=>{"use strict";n.d(i,{default:()=>h});var e=n(600);const t=new e.LicenseVerifier({scope:"qr-border-plugin",scopes:[{name:"qr-border-plugin"}],organization:"qr-code-styling"}),r=new e.LicenseInfo({organization:"qr-code-styling"}),o=()=>document.createElementNS("http://www.w3.org/2000/svg","rect");var s,a;!function(e){e.top="top",e.bottom="bottom",e.left="left",e.right="right"}(s||(s={})),function(e){e.text="text",e.image="image"}(a||(a={}));const c=(e,t)=>(Object.keys(t).forEach((n=>{e.setAttribute(n,`${t[n]}`)})),e),l=({width:e,height:t,options:n,round:i})=>{const r=Math.min(e,t);return{fill:"none",x:(e-r+n.thickness)/2,y:(t-r+n.thickness)/2,width:r-n.thickness,height:r-n.thickness,stroke:n.color,"stroke-width":n.thickness,"stroke-dasharray":n.dasharray,rx:Math.max(0,r/2*i-n.thickness/2)}},d=({thickness:e,value:t,svg:n,position:i,height:r,width:o,round:s,style:a})=>{let c=0,l=!1;"right"===i?c=90:"bottom"===i?l=!0:"left"===i&&(c=90,l=!0),n.getElementsByTagName("defs")[0].appendChild((({position:e,rotate:t,flip:n,thickness:i,height:r,width:o,round:s})=>{const a=Math.min(o,r),c=document.createElementNS("http://www.w3.org/2000/svg","path"),l=(a-i)/2*s;let d="";return t&&(d+=`rotate(${t},${o/2},${r/2}) `),n&&(d+=`scale(1 -1) translate(0 ${-r}) `),c.setAttribute("id",`${e}-text-path`),c.setAttribute("transform",d),c.setAttribute("d",`\n M${(o-a+i)/2},${(r-a+i)/2+l}\n a${l},${l} 0 0 1 ${l},${-l}\n h${a-i-2*l}\n a${l},${l} 0 0 1 ${l},${l}\n `),c})({position:i,rotate:c,flip:l,height:r,width:o,round:s,thickness:e})),n.appendChild((({value:e,rotate:t,position:n,style:i})=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text"),o=document.createElementNS("http://www.w3.org/2000/svg","textPath");return o.setAttribute("href",`#${n}-text-path`),o.setAttribute("text-anchor","middle"),o.setAttribute("startOffset","50%"),o.textContent=e,o.setAttribute("alignment-baseline","central"),r.setAttribute("rotate",`-${t}`),r.setAttribute("style",i||""),r.appendChild(o),r})({position:i,rotate:c,value:t,style:a}))},p=({thickness:e,value:t,svg:n,position:i,height:r,width:o,style:a})=>{const c=document.createElementNS("http://www.w3.org/2000/svg","image"),l=Math.min(o,r);let d=(o-l+e)/2,p=(r-l+e)/2;i===s.top?d+=(l-e)/2:i===s.right?(d+=l-e,p+=(l-e)/2):i===s.bottom?(d+=(l-e)/2,p+=l-e):i===s.left&&(p+=(l-e)/2),c.setAttribute("href",t||""),c.setAttribute("x",`${d}`),c.setAttribute("y",`${p}`),c.setAttribute("style",a),n.appendChild(c)},u=e=>(t,n)=>{u.verifyKey();const{width:i,height:r}=n,s=o(),a=l({width:i,height:r,options:e,round:e.round});if(c(s,a),t.appendChild(s),e.borderInner){const n=o(),s=l({width:i,height:r,options:e.borderInner,round:e.round});s.x=s.x-e.borderInner.thickness+e.thickness,s.y=s.y-e.borderInner.thickness+e.thickness,s.width=s.width+2*(e.borderInner.thickness-e.thickness),s.height=s.height+2*(e.borderInner.thickness-e.thickness),s.rx=Math.max(0,s.rx+e.borderInner.thickness-e.thickness),c(n,s),t.appendChild(n)}if(e.borderOuter){const n=o(),s=l({width:i,height:r,options:e.borderOuter,round:e.round});c(n,s),t.appendChild(n)}let h;for(h in e.decorations){const n=e.decorations[h];let o;"image"===n.type?o=p:"text"===n.type&&(o=d),o?.({svg:t,position:h,thickness:e.thickness,value:n.value,style:n.style,height:r,width:i,round:e.round})}};u.setKey=r.setLicenseKey,u.verifyKey=()=>{t.verifyLicense({licenseKey:r.getLicenseKey(),packageScope:"qr-border-plugin"})};const h=u})(),i.default})())); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.QRBorderPlugin=t():e.QRBorderPlugin=t()}(this,(()=>(()=>{var e={600:function(e){var t;t=()=>(()=>{var e={665:function(e){e.exports=(()=>{"use strict";var e={d:(t,i)=>{for(var n in i)e.o(i,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:i[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{LICENSE_STATUS:()=>c,LICENSING_MODELS:()=>l,base64Decode:()=>n,base64Encode:()=>r,findScopeNode:()=>y,md5:()=>a,showExpiredSubscriptionGraceLicenseKeyError:()=>g,showExpiredSubscriptionLicenseKeyError:()=>f,showInvalidLicenseKeyError:()=>p,showLicenseKeyScopeError:()=>u,showMissingLicenseKeyError:()=>h});const i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n=e=>{let t,n,r,o,s,a,c,l="",d=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");d<e.length;)o=i.indexOf(e.charAt(d++)),s=i.indexOf(e.charAt(d++)),a=i.indexOf(e.charAt(d++)),c=i.indexOf(e.charAt(d++)),t=o<<2|s>>4,n=(15&s)<<4|a>>2,r=(3&a)<<6|c,l+=String.fromCharCode(t),64!=a&&(l+=String.fromCharCode(n)),64!=c&&(l+=String.fromCharCode(r));return l},r=e=>{let t,n,r,o,s,a,c,l="",d=0;for(e=function(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>=128)throw new Error("ASCII only support");return e}(e);d<e.length;)t=e.charCodeAt(d++),n=e.charCodeAt(d++),r=e.charCodeAt(d++),o=t>>2,s=(3&t)<<4|n>>4,a=(15&n)<<2|r>>6,c=63&r,isNaN(n)?a=c=64:isNaN(r)&&(c=64),l=l+i.charAt(o)+i.charAt(s)+i.charAt(a)+i.charAt(c);return l},o=[];let s=0;for(;s<64;)o[s]=0|4294967296*Math.sin(++s%Math.PI);function a(e){const t=[];let i,n,r,a=unescape(encodeURI(e))+"",c=a.length;const l=[i=1732584193,n=4023233417,~i,~n];for(e=--c/4+2|15,t[--e]=8*c;~c;)t[c>>2]|=a.charCodeAt(c)<<8*c--;for(s=a=0;s<e;s+=16){for(c=l;a<64;c=[r=c[3],i+((r=c[0]+[i&n|~i&r,r&i|~r&n,i^n^r,n^(i|~r)][c=a>>4]+o[a]+~~t[s|15&[a,5*a+1,3*a+5,7*a][c]])<<(c=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*c+a++%4])|r>>>-c),i,n])i=0|c[1],n=c[2];for(a=4;a;)l[--a]+=c[a]}for(e="";a<32;)e+=(l[a>>3]>>4*(1^a++)&15).toString(16);return e}var c;!function(e){e.NotFound="NotFound",e.Invalid="Invalid",e.ExpiredSubscription="ExpiredSubscription",e.ExpiredSubscriptionGrace="ExpiredSubscriptionGrace",e.Valid="Valid",e.OutOfScope="OutOfScope"}(c||(c={}));const l=["perpetual","subscription"];function d(e){console.error(["*************************************************************","",...e,"","*************************************************************"].join("\n"))}function p({organization:e}){d([`${e}: Invalid license key.`,"","Your icense key isn't valid.","","To solve the issue, you need to double check that `setLicenseKey()` is called with the right argument"])}function u({organization:e,packageName:t}){d([`${e}: License key plan mismatch.`,"",`Your use of ${t} is not compatible with the plan of your license key. The feature you are trying to use is not included in the plan of your license key.`])}function h({packageName:e,organization:t,scope:i}){d([`${t}: Missing license key.`,"",`The license key is missing. You might not be allowed to use \`${e}\` which is part of ${i} plan.`,"",`You need to purchase a license https://lefe.dev/${t}/license.`])}function g({scope:e,packageName:t,organization:i,licenseKey:n,expiryTimestamp:r}){d([`${i}: Expired license key.`,"",`Your subscription license key to use ${t} ${e} has expired.`,"",`- License key expiry timestamp: ${new Date(r)}`,`- Installed license key: ${n}`,""])}function f({scope:e,packageName:t,organization:i,licenseKey:n,expiryTimestamp:r}){throw new Error([`${i}: Expired license key.`,"",`Your subscription license key to use ${t} ${e} has expired.`,"",`- License key expiry timestamp: ${new Date(r)}`,`- Installed license key: ${n}`,""].join("\n"))}function y(e,t){return t?.find((({name:t,children:i})=>t===e||y(e,i)))}return t})()}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,i),o.exports}i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";i.r(n),i.d(n,{LicenseInfo:()=>o,LicenseVerifier:()=>t});var e=i(665);class t{scopes;organization;constructor({scopes:e,organization:t}){this.scopes=e,this.organization=t}static isLicenseScopeSufficient(t,i,n){const r=(0,e.findScopeNode)(i,n),o=r&&[r];return!!(0,e.findScopeNode)(t,o)}static decodeLicense(t){const i=(0,e.base64Decode)(t),n={expiryTimestamp:null,scope:null,licensingModel:null,organization:null};return i.split(",").map((e=>e.split("="))).filter((e=>2===e.length)).forEach((([e,t])=>{switch(e){case"E":{const e=parseInt(t,10);e&&!Number.isNaN(e)&&(n.expiryTimestamp=e);break}case"S":n.scope=t;break;case"L":n.licensingModel=t;break;case"O":n.organization=t}})),n}verifyLicense({licenseKey:i,packageScope:n}){if(!i)return console.error(`${this.organization}: Error checking license. License key is not found!`),{status:e.LICENSE_STATUS.NotFound};const r=i.substr(0,32),o=i.substr(32);if(r!==(0,e.md5)(o))return console.error(`${this.organization}: Error checking license. License key format is not valid!`),{status:e.LICENSE_STATUS.Invalid};const s=t.decodeLicense(o);return null==s.expiryTimestamp?(console.error(`${this.organization}: Error checking license. Expiry timestamp not found or invalid!`),{status:e.LICENSE_STATUS.Invalid}):null==s.scope?(console.error(`${this.organization}: Error checking license. Scope not found or invalid!`),{status:e.LICENSE_STATUS.Invalid}):null!=s.licensingModel&&e.LICENSING_MODELS.includes(s.licensingModel)?t.isLicenseScopeSufficient(n,s.scope,this.scopes)?"subscription"===s.licensingModel&&(new Date).getTime()>s.expiryTimestamp?(new Date).getTime()<s.expiryTimestamp+2592e6?(console.warn(`${this.organization}: License subscription expired at ${new Date(s.expiryTimestamp).toISOString()}!`),{status:e.LICENSE_STATUS.ExpiredSubscriptionGrace,meta:{expiryTimestamp:s.expiryTimestamp,licenseKey:i}}):(console.error(`${this.organization}: Error checking license. License is expired!`),{status:e.LICENSE_STATUS.ExpiredSubscription,meta:{expiryTimestamp:s.expiryTimestamp,licenseKey:i}}):{status:e.LICENSE_STATUS.Valid}:(console.error(`${this.organization}: Error checking license. License scope is not sufficient!`),{status:e.LICENSE_STATUS.OutOfScope}):(console.error(`${this.organization}: Error checking license. Licensing model not found or invalid!`),{status:e.LICENSE_STATUS.Invalid})}}const r="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();class o{organization;constructor({organization:e}){this.organization=e,r[`__${this.organization}_LICENSE_INFO__`]=r[`__${this.organization}_LICENSE_INFO__`]||{key:void 0}}getLicenseInfo(){return r[`__${this.organization}_LICENSE_INFO__`]}getLicenseKey(){return this.getLicenseInfo().key}setLicenseKey(e){this.getLicenseInfo().key=e}}})(),n})(),e.exports=t()}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,i),o.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n={};return(()=>{"use strict";i.d(n,{default:()=>h});var e=i(600);const t=new e.LicenseVerifier({scope:"qr-border-plugin",scopes:[{name:"qr-border-plugin"}],organization:"qr-code-styling"}),r=new e.LicenseInfo({organization:"qr-code-styling"}),o=()=>document.createElementNS("http://www.w3.org/2000/svg","rect");var s,a;!function(e){e.top="top",e.bottom="bottom",e.left="left",e.right="right"}(s||(s={})),function(e){e.text="text",e.image="image"}(a||(a={}));const c=(e,t)=>(Object.keys(t).forEach((i=>{e.setAttribute(i,`${t[i]}`)})),e),l=({width:e,height:t,options:i,round:n})=>{const r=Math.min(e,t);return{fill:"none",x:(e-r+i.thickness)/2,y:(t-r+i.thickness)/2,width:r-i.thickness,height:r-i.thickness,stroke:i.color,"stroke-width":i.thickness,"stroke-dasharray":i.dasharray,rx:Math.max(0,r/2*n-i.thickness/2)}},d=({thickness:e,value:t,svg:i,position:n,height:r,width:o,round:s,style:a})=>{let c=0,l=!1;"right"===n?c=90:"bottom"===n?l=!0:"left"===n&&(c=90,l=!0),i.getElementsByTagName("defs")[0].appendChild((({position:e,rotate:t,flip:i,thickness:n,height:r,width:o,round:s})=>{const a=Math.min(o,r),c=document.createElementNS("http://www.w3.org/2000/svg","path"),l=(a-n)/2*s;let d="";return t&&(d+=`rotate(${t},${o/2},${r/2}) `),i&&(d+=`scale(1 -1) translate(0 ${-r}) `),c.setAttribute("id",`${e}-text-path`),c.setAttribute("transform",d),c.setAttribute("d",`\n M${(o-a+n)/2},${(r-a+n)/2+l}\n a${l},${l} 0 0 1 ${l},${-l}\n h${a-n-2*l}\n a${l},${l} 0 0 1 ${l},${l}\n `),c})({position:n,rotate:c,flip:l,height:r,width:o,round:s,thickness:e})),i.appendChild((({value:e,rotate:t,position:i,style:n})=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text"),o=document.createElementNS("http://www.w3.org/2000/svg","textPath");return o.setAttribute("href",`#${i}-text-path`),o.setAttribute("text-anchor","middle"),o.setAttribute("startOffset","50%"),o.textContent=e,o.setAttribute("alignment-baseline","central"),r.setAttribute("rotate",`-${t}`),r.setAttribute("style",n||""),r.appendChild(o),r})({position:n,rotate:c,value:t,style:a}))},p=({thickness:e,value:t,svg:i,position:n,height:r,width:o,style:a})=>{const c=document.createElementNS("http://www.w3.org/2000/svg","image"),l=Math.min(o,r);let d=(o-l+e)/2,p=(r-l+e)/2;n===s.top?d+=(l-e)/2:n===s.right?(d+=l-e,p+=(l-e)/2):n===s.bottom?(d+=(l-e)/2,p+=l-e):n===s.left&&(p+=(l-e)/2),c.setAttribute("href",t||""),c.setAttribute("x",`${d}`),c.setAttribute("y",`${p}`),c.setAttribute("style",a),i.appendChild(c)},u=e=>(t,i)=>{u.verifyKey();const{width:n,height:r}=i,s=o(),a=l({width:n,height:r,options:e,round:e.round});if(c(s,a),t.appendChild(s),e.borderInner){const i=o(),s=l({width:n,height:r,options:e.borderInner,round:e.round});s.x=s.x-e.borderInner.thickness+e.thickness,s.y=s.y-e.borderInner.thickness+e.thickness,s.width=s.width+2*(e.borderInner.thickness-e.thickness),s.height=s.height+2*(e.borderInner.thickness-e.thickness),s.rx=Math.max(0,s.rx+e.borderInner.thickness-e.thickness),c(i,s),t.appendChild(i)}if(e.borderOuter){const i=o(),s=l({width:n,height:r,options:e.borderOuter,round:e.round});c(i,s),t.appendChild(i)}let h;for(h in e.decorations){const i=e.decorations[h];let o;"image"===i.type?o=p:"text"===i.type&&(o=d),o?.({svg:t,position:h,thickness:e.thickness,value:i.value,style:i.style,height:r,width:n,round:e.round})}};u.setKey=r.setLicenseKey,u.verifyKey=()=>{t.verifyLicense({licenseKey:r.getLicenseKey(),packageScope:"qr-border-plugin"})};const h=u})(),n.default})())); |
{ | ||
"name": "qr-border-plugin", | ||
"private": false, | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Plugin for generating different borders of qr-code-styling", | ||
@@ -16,3 +16,3 @@ "author": "Denys Kozak", | ||
"dependencies": { | ||
"@lefe-dev/lefe-verify-license": "^0.0.8" | ||
"@lefe-dev/lefe-verify-license": "^0.0.9" | ||
}, | ||
@@ -48,3 +48,3 @@ "devDependencies": { | ||
"homepage": "https://lefe.dev/qr-border-plugin", | ||
"gitHead": "1412ae44318d936210bb8aae5a497663705eac70" | ||
"gitHead": "ec8fe5f07a95493d5821295c6d417677a7519105" | ||
} |
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
13598
3.72%+ Added
- Removed