{"version":3,"sources":["webpack:///./node_modules/@ionic/core/dist/esm-es5/ion-img.entry.js"],"names":["Img","prototype","srcChanged","this","addIO","componentDidLoad","_this","undefined","src","window","removeIO","io","IntersectionObserver","data","isIntersecting","load","observe","el","setTimeout","loadError","onError","loadSrc","ionImgWillLoad","emit","disconnect","render","class","decoding","alt","onLoad","Object","defineProperty","get","enumerable","configurable","hostRef","ionImgDidLoad","ionError"],"mappings":"6FAAA,6DAEIA,GAFJ,UAgBIA,EAAIC,UAAUC,WAAa,WACvBC,KAAKC,MAAM,CACf,EACAJ,EAAIC,UAAUI,iBAAmB,WAC7BF,KAAKC,MAAM,CACf,EACAJ,EAAIC,UAAUG,MAAQ,WAClB,IAAIE,EAAQH,KACKI,SAAbJ,KAAKK,MAGL,yBAA0BC,QAC1BN,KAAKO,SAAS,EACdP,KAAKQ,GAAK,IAAIC,qBAAqB,SAAUC,GAIrCA,EAAK,GAAGC,iBACRR,EAAMS,KAAK,EACXT,EAAMI,SAAS,EAEvB,CAAC,EACDP,KAAKQ,GAAGK,QAAQb,KAAKc,EAAE,GAIvBC,WAAW,WAAc,OAAOZ,EAAMS,KAAK,CAAG,EAAG,GAAG,EAE5D,EACAf,EAAIC,UAAUc,KAAO,WACjBZ,KAAKgB,UAAYhB,KAAKiB,QACtBjB,KAAKkB,QAAUlB,KAAKK,IACpBL,KAAKmB,eAAeC,KAAK,CAC7B,EACAvB,EAAIC,UAAUS,SAAW,WACjBP,KAAKQ,KACLR,KAAKQ,GAAGa,WAAW,EACnBrB,KAAKQ,GAAKJ,OAElB,EACAP,EAAIC,UAAUwB,OAAS,WACnB,OAAQ,YAAE,IAAM,CAAEC,MAAO,YAAWvB,IAAI,CAAE,EAAG,YAAE,MAAO,CAAEwB,SAAU,QAASnB,IAAKL,KAAKkB,QAASO,IAAKzB,KAAKyB,IAAKC,OAAQ1B,KAAK0B,OAAQT,QAASjB,KAAKgB,SAAU,CAAC,CAAE,CACjK,EACAW,OAAOC,eAAe/B,EAAIC,UAAW,KAAM,CACvC+B,IAAK,WAAc,OAAO,YAAW7B,IAAI,CAAG,EAC5C8B,WAAY,GACZC,aAAc,EAClB,CAAC,EACDJ,OAAOC,eAAe/B,EAAK,WAAY,CACnCgC,IAAK,WACD,MAAO,CACH,IAAO,CAAC,aACZ,CACJ,EACAC,WAAY,GACZC,aAAc,EAClB,CAAC,EACDJ,OAAOC,eAAe/B,EAAK,QAAS,CAChCgC,IAAK,WAAc,MAAO,gMAAkM,EAC5NC,WAAY,GACZC,aAAc,EAClB,CAAC,EACMlC,GA3EP,SAASA,EAAImC,GACT,IAAI7B,EAAQH,KACZ,YAAiBA,KAAMgC,CAAO,EAC9BhC,KAAK0B,OAAS,WACVvB,EAAM8B,cAAcb,KAAK,CAC7B,EACApB,KAAKiB,QAAU,WACXd,EAAM+B,SAASd,KAAK,CACxB,EACApB,KAAKmB,eAAiB,YAAYnB,KAAM,iBAAkB,CAAC,EAC3DA,KAAKiC,cAAgB,YAAYjC,KAAM,gBAAiB,CAAC,EACzDA,KAAKkC,SAAW,YAAYlC,KAAM,WAAY,CAAC,CACnD,C","file":"js/chunk-2d0e5812.e0d6174a.js","sourcesContent":["import { r as registerInstance, d as createEvent, h, c as getIonMode, H as Host, e as getElement } from './core-feeeff0d.js';\nimport './config-3c7f3790.js';\nvar Img = /** @class */ (function () {\n function Img(hostRef) {\n var _this = this;\n registerInstance(this, hostRef);\n this.onLoad = function () {\n _this.ionImgDidLoad.emit();\n };\n this.onError = function () {\n _this.ionError.emit();\n };\n this.ionImgWillLoad = createEvent(this, \"ionImgWillLoad\", 7);\n this.ionImgDidLoad = createEvent(this, \"ionImgDidLoad\", 7);\n this.ionError = createEvent(this, \"ionError\", 7);\n }\n Img.prototype.srcChanged = function () {\n this.addIO();\n };\n Img.prototype.componentDidLoad = function () {\n this.addIO();\n };\n Img.prototype.addIO = function () {\n var _this = this;\n if (this.src === undefined) {\n return;\n }\n if ('IntersectionObserver' in window) {\n this.removeIO();\n this.io = new IntersectionObserver(function (data) {\n // because there will only ever be one instance\n // of the element we are observing\n // we can just use data[0]\n if (data[0].isIntersecting) {\n _this.load();\n _this.removeIO();\n }\n });\n this.io.observe(this.el);\n }\n else {\n // fall back to setTimeout for Safari and IE\n setTimeout(function () { return _this.load(); }, 200);\n }\n };\n Img.prototype.load = function () {\n this.loadError = this.onError;\n this.loadSrc = this.src;\n this.ionImgWillLoad.emit();\n };\n Img.prototype.removeIO = function () {\n if (this.io) {\n this.io.disconnect();\n this.io = undefined;\n }\n };\n Img.prototype.render = function () {\n return (h(Host, { class: getIonMode(this) }, h(\"img\", { decoding: \"async\", src: this.loadSrc, alt: this.alt, onLoad: this.onLoad, onError: this.loadError })));\n };\n Object.defineProperty(Img.prototype, \"el\", {\n get: function () { return getElement(this); },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Img, \"watchers\", {\n get: function () {\n return {\n \"src\": [\"srcChanged\"]\n };\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Img, \"style\", {\n get: function () { return \":host{-o-object-fit:contain;object-fit:contain}:host,img{display:block}img{width:100%;height:100%;-o-object-fit:inherit;object-fit:inherit;-o-object-position:inherit;object-position:inherit}\"; },\n enumerable: true,\n configurable: true\n });\n return Img;\n}());\nexport { Img as ion_img };\n"],"sourceRoot":""}