@htmlbricks/hb-downloader 0.7.7 → 0.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@htmlbricks/hb-downloader",
3
3
  "displayName": "Svelte-Bootstrap Downloader WebComponent",
4
4
  "description": "Svelte-Bootstrap Downloader WebComponent",
5
- "version": "0.7.7",
5
+ "version": "0.7.8",
6
6
  "main": "release/release.js",
7
7
  "publishConfig": {
8
8
  "access": "public"
@@ -27,7 +27,7 @@
27
27
  "prepublish": "npm run build:release"
28
28
  },
29
29
  "devDependencies": {
30
- "@htmlbricks/hb-jsutils": "^0.7.7",
30
+ "@htmlbricks/hb-jsutils": "^0.7.8",
31
31
  "@rollup/plugin-alias": "^3.1.2",
32
32
  "@rollup/plugin-commonjs": "^18.0.0",
33
33
  "@rollup/plugin-json": "^4.1.0",
@@ -71,5 +71,5 @@
71
71
  "webcomponents"
72
72
  ],
73
73
  "contributors": [],
74
- "gitHead": "0f8003368bdd14a10dfcf1c1e78913dcf61292a8"
74
+ "gitHead": "8d5d3227354adbee75d50012b9c05fe0e8a7304d"
75
75
  }
@@ -1,2 +1,2 @@
1
- var release=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function o(t){t.forEach(e)}function r(t){return"function"==typeof t}function i(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function a(t,e){t.appendChild(e)}function s(t,e,n){t.insertBefore(e,n||null)}function l(t){t.parentNode.removeChild(t)}function d(t){return document.createElement(t)}function c(t){return document.createTextNode(t)}function u(){return c(" ")}function f(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function p(t,e,n){e in t?t[e]="boolean"==typeof t[e]&&""===n||n:f(t,e,n)}function h(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function g(t,e,n,o){null===n?t.style.removeProperty(e):t.style.setProperty(e,n,o?"important":"")}function m(t){const e={};for(const n of t)e[n.name]=n.value;return e}let v;function $(t){v=t}function b(){if(!v)throw new Error("Function called outside component initialization");return v}function w(){const t=b();return(e,n)=>{const o=t.$$.callbacks[e];if(o){const r=function(t,e,n=!1){const o=document.createEvent("CustomEvent");return o.initCustomEvent(t,n,!1,e),o}(e,n);o.slice().forEach((e=>{e.call(t,r)}))}}}const y=[],E=[],x=[],k=[],_=Promise.resolve();let C=!1;function L(t){x.push(t)}const M=new Set;let T=0;function j(){const t=v;do{for(;T<y.length;){const t=y[T];T++,$(t),D(t.$$)}for($(null),y.length=0,T=0;E.length;)E.pop()();for(let t=0;t<x.length;t+=1){const e=x[t];M.has(e)||(M.add(e),e())}x.length=0}while(y.length);for(;k.length;)k.pop()();C=!1,M.clear(),$(t)}function D(t){if(null!==t.fragment){t.update(),o(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(L)}}const O=new Set;function R(t,e){-1===t.$$.dirty[0]&&(y.push(t),C||(C=!0,_.then(j)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function H(i,a,s,d,c,u,f,p=[-1]){const h=v;$(i);const g=i.$$={fragment:null,ctx:null,props:u,update:t,not_equal:c,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(a.context||(h?h.$$.context:[])),callbacks:n(),dirty:p,skip_bound:!1,root:a.target||h.$$.root};f&&f(g.root);let m=!1;if(g.ctx=s?s(i,a.props||{},((t,e,...n)=>{const o=n.length?n[0]:e;return g.ctx&&c(g.ctx[t],g.ctx[t]=o)&&(!g.skip_bound&&g.bound[t]&&g.bound[t](o),m&&R(i,t)),e})):[],g.update(),m=!0,o(g.before_update),g.fragment=!!d&&d(g.ctx),a.target){if(a.hydrate){const t=function(t){return Array.from(t.childNodes)}(a.target);g.fragment&&g.fragment.l(t),t.forEach(l)}else g.fragment&&g.fragment.c();a.intro&&((b=i.$$.fragment)&&b.i&&(O.delete(b),b.i(w))),function(t,n,i,a){const{fragment:s,on_mount:l,on_destroy:d,after_update:c}=t.$$;s&&s.m(n,i),a||L((()=>{const n=l.map(e).filter(r);d?d.push(...n):o(n),t.$$.on_mount=[]})),c.forEach(L)}(i,a.target,a.anchor,a.customElement),j()}var b,w;$(h)}let S;"function"==typeof HTMLElement&&(S=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(e).filter(r);for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,e,n){this[t]=n}disconnectedCallback(){o(this.$$.on_disconnect)}$destroy(){!function(t,e){const n=t.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});var A="0.7.7";var P,q,N=(P=function(t,e){e.__esModule=!0,e.LanguageTranslator=e.addComponent=e.getChildStyleToPass=void 0,e.getChildStyleToPass=function(t,e){var n,o,r="";if(t&&(null==e?void 0:e.length)&&(null===(n=Object.keys(t))||void 0===n?void 0:n.length)&&(null===(o=null==e?void 0:e.filter((function(e){return Object.keys(t).includes(e.name)})))||void 0===o?void 0:o.length))for(var i=function(n){(null==e?void 0:e.filter((function(e){return e.name===n&&e.defaultValue!==t[n]})))&&(r+="".concat(n,":").concat(t[n],";"))},a=0,s=Object.keys(t);a<s.length;a++)i(s[a]);return r},e.addComponent=function(t,e,n){if(!document.getElementById("hb-"+t+"-script")){var o=document.createElement("script");o.id="hb-"+t+"-script",o.src="https://cdn.jsdelivr.net/npm/@htmlbricks/hb-".concat(t,"@").concat(e,"/release/release.js"),n&&location.href.includes("localhost")&&(o.src="http://localhost:6006/".concat(t,"/dist/release.js")),document.head.appendChild(o)}};var n=function(){function t(t){if(!(null==t?void 0:t.dictionary))throw new Error("no dictionary provided");this.dictionary=t.dictionary,this.setLang(null==t?void 0:t.lang)}return t.prototype.setLang=function(e){e||(e=t.getDefaultLang()),this.lang=e},t.prototype.translateWord=function(e,n){return t.getDictionaryWord(e,this.dictionary,n||this.lang)},t.prototype.translateDate=function(e,n,o){return t.formatDate(e,n,o||this.lang)},t.getDefaultLang=function(){var t,e,n,o,r,i="en";return(null===navigator||void 0===navigator?void 0:navigator.languages)&&(null===(n=null===(e=null===(t=navigator.languages[0])||void 0===t?void 0:t.split("-")[0])||void 0===e?void 0:e.toLowerCase())||void 0===n?void 0:n.length)&&(i=null===(r=null===(o=navigator.languages[0])||void 0===o?void 0:o.split("-")[0])||void 0===r?void 0:r.toLowerCase()),i},t.getDictionaryWord=function(e,n,o){var r;if(!e)throw new Error("no wordKey provided");if(!n)throw new Error("no dictionary provided");if(o&&(null===(r=n[o])||void 0===r?void 0:r[e]))return n[o][e];var i="",a=t.getDefaultLang();if(!o||a!==o){var s=null==n?void 0:n[a];(null==s?void 0:s[e])&&(i=s[e])}return i},t.formatDate=function(e,n,o){if(!e)throw new Error("no date provided");if("function"!=typeof e.getMonth)throw new Error("wrong date format");return new Intl.DateTimeFormat(o||t.getDefaultLang(),n).format(e)},t}();e.LanguageTranslator=n},P(q={exports:{}},q.exports),q.exports);function z(t){let e;return{c(){e=c(t[4])},m(t,n){s(t,e,n)},p(t,n){16&n&&h(e,t[4])},d(t){t&&l(e)}}}function U(t){let e,n,o,r,i,u=Math.round(t[3]/t[2]*100)+"";return{c(){e=d("div"),n=d("div"),o=c(u),r=c("%"),f(n,"class","progress-bar"),g(n,"width",Math.round(t[3]/t[2]*100)+"%"),f(n,"role","progressbar"),f(n,"aria-valuenow",i=Math.round(t[3]/t[2]*100)),f(n,"aria-valuemin","0"),f(n,"aria-valuemax","100"),f(e,"class","progress")},m(t,i){s(t,e,i),a(e,n),a(n,o),a(n,r)},p(t,e){12&e&&u!==(u=Math.round(t[3]/t[2]*100)+"")&&h(o,u),12&e&&g(n,"width",Math.round(t[3]/t[2]*100)+"%"),12&e&&i!==(i=Math.round(t[3]/t[2]*100))&&f(n,"aria-valuenow",i)},d(t){t&&l(e)}}}function W(e){let n;return{c(){n=d("div"),n.innerHTML='<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"></div>',f(n,"class","progress")},m(t,e){s(t,n,e)},p:t,d(t){t&&l(n)}}}function B(e){let n,o,r,i,c,h,g,m,v;function $(t,e){return t[2]||t[4]?t[4]?t[4]?z:void 0:U:W}let b=$(e),w=b&&b(e);return{c(){n=d("hb-dialog"),o=d("span"),o.innerHTML='<slot name="title">Downloading</slot>',r=u(),i=d("div"),w&&w.c(),c=u(),h=d("span"),this.c=t,f(o,"slot","title"),f(i,"slot","body-content"),f(h,"slot","modal-footer"),p(n,"id",e[0]),p(n,"show",g=e[1]?"yes":"no")},m(t,l){var d,u,f,p;s(t,n,l),a(n,o),a(n,r),a(n,i),w&&w.m(i,null),a(n,c),a(n,h),m||(d=n,u="modalShow",f=e[9],d.addEventListener(u,f,p),v=()=>d.removeEventListener(u,f,p),m=!0)},p(t,[e]){b===(b=$(t))&&w?w.p(t,e):(w&&w.d(1),w=b&&b(t),w&&(w.c(),w.m(i,null))),1&e&&p(n,"id",t[0]),2&e&&g!==(g=t[1]?"yes":"no")&&p(n,"show",g)},i:t,o:t,d(t){t&&l(n),w&&w.d(),m=!1,v()}}}function F(t,e,n){const o=b(),r=w();function i(t,e){r(t,e),o.dispatchEvent&&o.dispatchEvent(new CustomEvent(t,{detail:e}))}N.addComponent("dialog",A);let a,s,l,d,{downloadid:c}=e,{uri:u}=e,{headers:f}=e,{targetfilename:p}=e,h=0;function g(t){t.show?(n(0,c=t.id),function(){function t(t){console.error(t),t&&n(4,d=t),s=null,i("downloadError",{downloaded:l,id:c,error:t})}n(3,h=0),s=new XMLHttpRequest;try{if(s.open("GET",u,!0),f)for(const t of Object.keys(f))s.setRequestHeader(t,f[t]);s.responseType="blob",s.onload=function(){if(s.status&&(s.status>299||s.status<200))return t("request error");const e=(window.URL||window.webkitURL).createObjectURL(this.response),o=document.createElement("a");return o.href=e,o.target="_blank",o.download=p,document.body.appendChild(o),o.click(),document.body.removeChild(o),console.log("loadEnd"),n(0,c=""),n(1,u=""),s=null,n(8,l=!0),n(4,d=null),i("downloadComplete",{downloaded:l,id:c})},s.onerror=e=>t(e),s.onprogress=function(t){n(2,a=(null==t?void 0:t.total)||0),n(3,h=(null==t?void 0:t.loaded)||0)},s.onloadend=function(t){},s.send()}catch(e){return console.error("download err ",e),t(e)}}()):(n(1,u=""),n(0,c=""),n(4,d=null),s&&s.abort(),s=null)}return t.$$set=t=>{"downloadid"in t&&n(0,c=t.downloadid),"uri"in t&&n(1,u=t.uri),"headers"in t&&n(6,f=t.headers),"targetfilename"in t&&n(7,p=t.targetfilename)},t.$$.update=()=>{if(451&t.$$.dirty){c||n(0,c=""),l||n(8,l=!1),u||n(1,u="");try{f&&"string"==typeof f&&n(6,f=JSON.parse(f))}catch(t){}!p&&u&&n(7,p=u.split("/")[u.split("/").length-1].split("?")[0])}},[c,u,a,h,d,g,f,p,l,t=>g(t.detail)]}class I extends S{constructor(t){super(),this.shadowRoot.innerHTML='<style>@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");@keyframes progress-bar-stripes{0%{background-position-x:1rem}}.progress{display:flex;height:1rem;overflow:hidden;font-size:0.75rem;background-color:#e9ecef;border-radius:0.25rem}.progress-bar{display:flex;flex-direction:column;justify-content:center;overflow:hidden;color:#fff;text-align:center;white-space:nowrap;background-color:var(--bs-primary,#07689f);transition:width 0.6s ease}@media(prefers-reduced-motion: reduce){.progress-bar{transition:none}}.progress-bar-striped{background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-size:1rem 1rem}.progress-bar-animated{animation:1s linear infinite progress-bar-stripes}@media(prefers-reduced-motion: reduce){.progress-bar-animated{animation:none}}:host{font-family:"Roboto", sans-serif}</style>',H(this,{target:this.shadowRoot,props:m(this.attributes),customElement:!0},F,B,i,{downloadid:0,uri:1,headers:6,targetfilename:7},null),t&&(t.target&&s(t.target,this,t.anchor),t.props&&(this.$set(t.props),j()))}static get observedAttributes(){return["downloadid","uri","headers","targetfilename"]}get downloadid(){return this.$$.ctx[0]}set downloadid(t){this.$$set({downloadid:t}),j()}get uri(){return this.$$.ctx[1]}set uri(t){this.$$set({uri:t}),j()}get headers(){return this.$$.ctx[6]}set headers(t){this.$$set({headers:t}),j()}get targetfilename(){return this.$$.ctx[7]}set targetfilename(t){this.$$set({targetfilename:t}),j()}}return customElements.define("hb-downloader",I),I}();
1
+ var release=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function o(t){t.forEach(e)}function r(t){return"function"==typeof t}function i(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function a(t,e){t.appendChild(e)}function s(t,e,n){t.insertBefore(e,n||null)}function l(t){t.parentNode.removeChild(t)}function d(t){return document.createElement(t)}function c(t){return document.createTextNode(t)}function u(){return c(" ")}function f(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function p(t,e,n){e in t?t[e]="boolean"==typeof t[e]&&""===n||n:f(t,e,n)}function h(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function g(t,e,n,o){null===n?t.style.removeProperty(e):t.style.setProperty(e,n,o?"important":"")}function m(t){const e={};for(const n of t)e[n.name]=n.value;return e}let v;function $(t){v=t}function b(){if(!v)throw new Error("Function called outside component initialization");return v}function w(){const t=b();return(e,n)=>{const o=t.$$.callbacks[e];if(o){const r=function(t,e,n=!1){const o=document.createEvent("CustomEvent");return o.initCustomEvent(t,n,!1,e),o}(e,n);o.slice().forEach((e=>{e.call(t,r)}))}}}const y=[],E=[],x=[],k=[],_=Promise.resolve();let C=!1;function L(t){x.push(t)}const M=new Set;let T=0;function j(){const t=v;do{for(;T<y.length;){const t=y[T];T++,$(t),D(t.$$)}for($(null),y.length=0,T=0;E.length;)E.pop()();for(let t=0;t<x.length;t+=1){const e=x[t];M.has(e)||(M.add(e),e())}x.length=0}while(y.length);for(;k.length;)k.pop()();C=!1,M.clear(),$(t)}function D(t){if(null!==t.fragment){t.update(),o(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(L)}}const O=new Set;function R(t,e){-1===t.$$.dirty[0]&&(y.push(t),C||(C=!0,_.then(j)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function H(i,a,s,d,c,u,f,p=[-1]){const h=v;$(i);const g=i.$$={fragment:null,ctx:null,props:u,update:t,not_equal:c,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(a.context||(h?h.$$.context:[])),callbacks:n(),dirty:p,skip_bound:!1,root:a.target||h.$$.root};f&&f(g.root);let m=!1;if(g.ctx=s?s(i,a.props||{},((t,e,...n)=>{const o=n.length?n[0]:e;return g.ctx&&c(g.ctx[t],g.ctx[t]=o)&&(!g.skip_bound&&g.bound[t]&&g.bound[t](o),m&&R(i,t)),e})):[],g.update(),m=!0,o(g.before_update),g.fragment=!!d&&d(g.ctx),a.target){if(a.hydrate){const t=function(t){return Array.from(t.childNodes)}(a.target);g.fragment&&g.fragment.l(t),t.forEach(l)}else g.fragment&&g.fragment.c();a.intro&&((b=i.$$.fragment)&&b.i&&(O.delete(b),b.i(w))),function(t,n,i,a){const{fragment:s,on_mount:l,on_destroy:d,after_update:c}=t.$$;s&&s.m(n,i),a||L((()=>{const n=l.map(e).filter(r);d?d.push(...n):o(n),t.$$.on_mount=[]})),c.forEach(L)}(i,a.target,a.anchor,a.customElement),j()}var b,w;$(h)}let S;"function"==typeof HTMLElement&&(S=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(e).filter(r);for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,e,n){this[t]=n}disconnectedCallback(){o(this.$$.on_disconnect)}$destroy(){!function(t,e){const n=t.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});var A="0.7.8";var P,q,N=(P=function(t,e){e.__esModule=!0,e.LanguageTranslator=e.addComponent=e.getChildStyleToPass=void 0,e.getChildStyleToPass=function(t,e){var n,o,r="";if(t&&(null==e?void 0:e.length)&&(null===(n=Object.keys(t))||void 0===n?void 0:n.length)&&(null===(o=null==e?void 0:e.filter((function(e){return Object.keys(t).includes(e.name)})))||void 0===o?void 0:o.length))for(var i=function(n){(null==e?void 0:e.filter((function(e){return e.name===n&&e.defaultValue!==t[n]})))&&(r+="".concat(n,":").concat(t[n],";"))},a=0,s=Object.keys(t);a<s.length;a++)i(s[a]);return r},e.addComponent=function(t,e,n){if(!document.getElementById("hb-"+t+"-script")){var o=document.createElement("script");o.id="hb-"+t+"-script",o.src="https://cdn.jsdelivr.net/npm/@htmlbricks/hb-".concat(t,"@").concat(e,"/release/release.js"),n&&location.href.includes("localhost")&&(o.src="http://localhost:6006/".concat(t,"/dist/release.js")),document.head.appendChild(o)}};var n=function(){function t(t){if(!(null==t?void 0:t.dictionary))throw new Error("no dictionary provided");this.dictionary=t.dictionary,this.setLang(null==t?void 0:t.lang)}return t.prototype.setLang=function(e){e||(e=t.getDefaultLang()),this.lang=e},t.prototype.translateWord=function(e,n){return t.getDictionaryWord(e,this.dictionary,n||this.lang)},t.prototype.translateDate=function(e,n,o){return t.formatDate(e,n,o||this.lang)},t.getDefaultLang=function(){var t,e,n,o,r,i="en";return(null===navigator||void 0===navigator?void 0:navigator.languages)&&(null===(n=null===(e=null===(t=navigator.languages[0])||void 0===t?void 0:t.split("-")[0])||void 0===e?void 0:e.toLowerCase())||void 0===n?void 0:n.length)&&(i=null===(r=null===(o=navigator.languages[0])||void 0===o?void 0:o.split("-")[0])||void 0===r?void 0:r.toLowerCase()),i},t.getDictionaryWord=function(e,n,o){var r;if(!e)throw new Error("no wordKey provided");if(!n)throw new Error("no dictionary provided");if(o&&(null===(r=n[o])||void 0===r?void 0:r[e]))return n[o][e];var i="",a=t.getDefaultLang();if(!o||a!==o){var s=null==n?void 0:n[a];(null==s?void 0:s[e])&&(i=s[e])}return i},t.formatDate=function(e,n,o){if(!e)throw new Error("no date provided");if("function"!=typeof e.getMonth)throw new Error("wrong date format");return new Intl.DateTimeFormat(o||t.getDefaultLang(),n).format(e)},t}();e.LanguageTranslator=n},P(q={exports:{}},q.exports),q.exports);function z(t){let e;return{c(){e=c(t[4])},m(t,n){s(t,e,n)},p(t,n){16&n&&h(e,t[4])},d(t){t&&l(e)}}}function U(t){let e,n,o,r,i,u=Math.round(t[3]/t[2]*100)+"";return{c(){e=d("div"),n=d("div"),o=c(u),r=c("%"),f(n,"class","progress-bar"),g(n,"width",Math.round(t[3]/t[2]*100)+"%"),f(n,"role","progressbar"),f(n,"aria-valuenow",i=Math.round(t[3]/t[2]*100)),f(n,"aria-valuemin","0"),f(n,"aria-valuemax","100"),f(e,"class","progress")},m(t,i){s(t,e,i),a(e,n),a(n,o),a(n,r)},p(t,e){12&e&&u!==(u=Math.round(t[3]/t[2]*100)+"")&&h(o,u),12&e&&g(n,"width",Math.round(t[3]/t[2]*100)+"%"),12&e&&i!==(i=Math.round(t[3]/t[2]*100))&&f(n,"aria-valuenow",i)},d(t){t&&l(e)}}}function W(e){let n;return{c(){n=d("div"),n.innerHTML='<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"></div>',f(n,"class","progress")},m(t,e){s(t,n,e)},p:t,d(t){t&&l(n)}}}function B(e){let n,o,r,i,c,h,g,m,v;function $(t,e){return t[2]||t[4]?t[4]?t[4]?z:void 0:U:W}let b=$(e),w=b&&b(e);return{c(){n=d("hb-dialog"),o=d("span"),o.innerHTML='<slot name="title">Downloading</slot>',r=u(),i=d("div"),w&&w.c(),c=u(),h=d("span"),this.c=t,f(o,"slot","title"),f(i,"slot","body-content"),f(h,"slot","modal-footer"),p(n,"id",e[0]),p(n,"show",g=e[1]?"yes":"no")},m(t,l){var d,u,f,p;s(t,n,l),a(n,o),a(n,r),a(n,i),w&&w.m(i,null),a(n,c),a(n,h),m||(d=n,u="modalShow",f=e[9],d.addEventListener(u,f,p),v=()=>d.removeEventListener(u,f,p),m=!0)},p(t,[e]){b===(b=$(t))&&w?w.p(t,e):(w&&w.d(1),w=b&&b(t),w&&(w.c(),w.m(i,null))),1&e&&p(n,"id",t[0]),2&e&&g!==(g=t[1]?"yes":"no")&&p(n,"show",g)},i:t,o:t,d(t){t&&l(n),w&&w.d(),m=!1,v()}}}function F(t,e,n){const o=b(),r=w();function i(t,e){r(t,e),o.dispatchEvent&&o.dispatchEvent(new CustomEvent(t,{detail:e}))}N.addComponent("dialog",A);let a,s,l,d,{downloadid:c}=e,{uri:u}=e,{headers:f}=e,{targetfilename:p}=e,h=0;function g(t){t.show?(n(0,c=t.id),function(){function t(t){console.error(t),t&&n(4,d=t),s=null,i("downloadError",{downloaded:l,id:c,error:t})}n(3,h=0),s=new XMLHttpRequest;try{if(s.open("GET",u,!0),f)for(const t of Object.keys(f))s.setRequestHeader(t,f[t]);s.responseType="blob",s.onload=function(){if(s.status&&(s.status>299||s.status<200))return t("request error");const e=(window.URL||window.webkitURL).createObjectURL(this.response),o=document.createElement("a");return o.href=e,o.target="_blank",o.download=p,document.body.appendChild(o),o.click(),document.body.removeChild(o),console.log("loadEnd"),n(0,c=""),n(1,u=""),s=null,n(8,l=!0),n(4,d=null),i("downloadComplete",{downloaded:l,id:c})},s.onerror=e=>t(e),s.onprogress=function(t){n(2,a=(null==t?void 0:t.total)||0),n(3,h=(null==t?void 0:t.loaded)||0)},s.onloadend=function(t){},s.send()}catch(e){return console.error("download err ",e),t(e)}}()):(n(1,u=""),n(0,c=""),n(4,d=null),s&&s.abort(),s=null)}return t.$$set=t=>{"downloadid"in t&&n(0,c=t.downloadid),"uri"in t&&n(1,u=t.uri),"headers"in t&&n(6,f=t.headers),"targetfilename"in t&&n(7,p=t.targetfilename)},t.$$.update=()=>{if(451&t.$$.dirty){c||n(0,c=""),l||n(8,l=!1),u||n(1,u="");try{f&&"string"==typeof f&&n(6,f=JSON.parse(f))}catch(t){}!p&&u&&n(7,p=u.split("/")[u.split("/").length-1].split("?")[0])}},[c,u,a,h,d,g,f,p,l,t=>g(t.detail)]}class I extends S{constructor(t){super(),this.shadowRoot.innerHTML='<style>@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");@keyframes progress-bar-stripes{0%{background-position-x:1rem}}.progress{display:flex;height:1rem;overflow:hidden;font-size:0.75rem;background-color:#e9ecef;border-radius:0.25rem}.progress-bar{display:flex;flex-direction:column;justify-content:center;overflow:hidden;color:#fff;text-align:center;white-space:nowrap;background-color:var(--bs-primary,#07689f);transition:width 0.6s ease}@media(prefers-reduced-motion: reduce){.progress-bar{transition:none}}.progress-bar-striped{background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-size:1rem 1rem}.progress-bar-animated{animation:1s linear infinite progress-bar-stripes}@media(prefers-reduced-motion: reduce){.progress-bar-animated{animation:none}}:host{font-family:"Roboto", sans-serif}</style>',H(this,{target:this.shadowRoot,props:m(this.attributes),customElement:!0},F,B,i,{downloadid:0,uri:1,headers:6,targetfilename:7},null),t&&(t.target&&s(t.target,this,t.anchor),t.props&&(this.$set(t.props),j()))}static get observedAttributes(){return["downloadid","uri","headers","targetfilename"]}get downloadid(){return this.$$.ctx[0]}set downloadid(t){this.$$set({downloadid:t}),j()}get uri(){return this.$$.ctx[1]}set uri(t){this.$$set({uri:t}),j()}get headers(){return this.$$.ctx[6]}set headers(t){this.$$set({headers:t}),j()}get targetfilename(){return this.$$.ctx[7]}set targetfilename(t){this.$$set({targetfilename:t}),j()}}return customElements.define("hb-downloader",I),I}();
2
2
  //# sourceMappingURL=release.js.map