{"version":3,"sources":["node_modules\\react-native-web\\dist\\components\\Image\\ImageUriCache.js"],"names":["_createClass","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","Constructor","protoProps","staticProps","prototype","_classCallCheck","instance","TypeError","ImageUriCache","value","has","uri","entries","_entries","isDataUri","test","Boolean","add","lastUsedTimestamp","Date","now","refCount","remove","_cleanUpIfNeeded","imageUris","keys","_maximumEntries","leastRecentlyUsedKey","leastRecentlyUsedEntry","forEach","entry","module","exports"],"mappings":"AAAA,GAAIA,cAAa,UAAU,CAAC,QAASC,iBAAT,CAA0BC,MAA1B,CAAiCC,KAAjC,CAAuC,CAAC,IAAI,GAAIC,GAAE,CAAV,CAAYA,EAAED,MAAME,MAApB,CAA2BD,GAA3B,CAA+B,CAAC,GAAIE,YAAWH,MAAMC,CAAN,CAAf,CAAwBE,WAAWC,UAAX,CAAsBD,WAAWC,UAAX,EAAuB,KAA7C,CAAmDD,WAAWE,YAAX,CAAwB,IAAxB,CAA6B,GAAG,SAAUF,WAAb,CAAwBA,WAAWG,QAAX,CAAoB,IAApB,CAAyBC,OAAOC,cAAP,CAAsBT,MAAtB,CAA6BI,WAAWM,GAAxC,CAA4CN,UAA5C,EAAyD,CAAC,OAAO,UAASO,WAAT,CAAqBC,UAArB,CAAgCC,WAAhC,CAA4C,CAAC,GAAGD,UAAH,CAAcb,iBAAiBY,YAAYG,SAA7B,CAAuCF,UAAvC,EAAmD,GAAGC,WAAH,CAAed,iBAAiBY,WAAjB,CAA6BE,WAA7B,EAA0C,MAAOF,YAAP,CAAoB,CAAlM,CAAoM,CAA1e,EAAjB,CAA8f,QAASI,gBAAT,CAAyBC,QAAzB,CAAkCL,WAAlC,CAA8C,CAAC,GAAG,EAAEK,mBAAoBL,YAAtB,CAAH,CAAsC,CAAC,KAAM,IAAIM,UAAJ,CAAc,mCAAd,CAAN,CAA0D,CAAC,IAAIC,eAAc,UAAU,CAAC,QAASA,cAAT,EAAwB,CAACH,gBAAgB,I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wBAAuB,IAAK,EAAhC;;AAEAJ,UAAUK,OAAV,CAAkB,SAASlB,GAAT,CAAa;AAC/B,GAAImB,OAAMlB,QAAQD,GAAR,CAAV;AACA;AACA,CAAC,CAACiB,sBAAD;AACDE,MAAMZ,iBAAN,CAAwBU,uBAAuBV,iBAD/C;AAEAY,MAAMT,QAAN,GAAiB,CAHjB;AAIA;AACAM,qBAAqBhB,GAArB;AACAiB,uBAAuBE,KAAvB;AACC;AACA,CAVD;;AAYA,GAAGH,oBAAH,CAAwB;AACxB,MAAOf,SAAQe,oBAAR,CAAP;AACC;AACA;AACA,CA1BE,CA/BuwB,CAAhC,EAyDruB,MAAOnB,cAAP,CAAsB,CAzDsoB,EAAlB,CAyDjnBA,cAAckB,eAAd,CAA8B,GAA9B,CAAkClB,cAAcK,QAAd,CAAuB,EAAvB;;;AAGhEkB,OAAOC,OAAP,CAAexB,aAAf","file":"ImageUriCache.js","sourceRoot":"D:/Work/Office/react-native-on-web/cli/tmpl/project","sourcesContent":["var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if(\"value\"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError(\"Cannot call a class as a function\");}}var ImageUriCache=function(){function ImageUriCache(){_classCallCheck(this,ImageUriCache);}_createClass(ImageUriCache,null,[{key:\"has\",value:function has(\n\n\n\nuri){\nvar entries=ImageUriCache._entries;\nvar isDataUri=/^data:/.test(uri);\nreturn isDataUri||Boolean(entries[uri]);\n}},{key:\"add\",value:function add(\n\nuri){\nvar entries=ImageUriCache._entries;\nvar lastUsedTimestamp=Date.now();\nif(entries[uri]){\nentries[uri].lastUsedTimestamp=lastUsedTimestamp;\nentries[uri].refCount+=1;\n}else{\nentries[uri]={\nlastUsedTimestamp:lastUsedTimestamp,\nrefCount:1};\n\n}\n}},{key:\"remove\",value:function remove(\n\nuri){\nvar entries=ImageUriCache._entries;\nif(entries[uri]){\nentries[uri].refCount-=1;\n}\n\nImageUriCache._cleanUpIfNeeded();\n}},{key:\"_cleanUpIfNeeded\",value:function _cleanUpIfNeeded()\n\n{\nvar entries=ImageUriCache._entries;\nvar imageUris=Object.keys(entries);\n\nif(imageUris.length+1>ImageUriCache._maximumEntries){\nvar leastRecentlyUsedKey=void 0;\nvar leastRecentlyUsedEntry=void 0;\n\nimageUris.forEach(function(uri){\nvar entry=entries[uri];\nif(\n(!leastRecentlyUsedEntry||\nentry.lastUsedTimestamp<leastRecentlyUsedEntry.lastUsedTimestamp)&&\nentry.refCount===0)\n{\nleastRecentlyUsedKey=uri;\nleastRecentlyUsedEntry=entry;\n}\n});\n\nif(leastRecentlyUsedKey){\ndelete entries[leastRecentlyUsedKey];\n}\n}\n}}]);return ImageUriCache;}();ImageUriCache._maximumEntries=256;ImageUriCache._entries={};\n\n\nmodule.exports=ImageUriCache;"]}