{"version":3,"sources":["webpack:///./widgets/provenceMap.js","webpack:///./loadWg/farmItem.js"],"names":["concat","ProvenceMap","$el","_classCallCheck","this","key","value","loadFarmItem","$parentEl","isList","arguments","length","undefined","$wg","querySelector","then","wg","FarmItem","$wgCol","querySelectorAll","instances","Array","from","forEach","i","push","error","Promise","reject","wgAll","init"],"mappings":"m1BAGW,IAAHA,OADI,cACM,KAFlB,IAUaC,EAAW,WAKtB,O,EAHD,SAAAA,EAAYC,I,4FAAKC,CAAA,KAAAF,GAEhBG,KAAKF,IAAMA,I,EACX,EAAAG,IAAA,OAAAC,MAED,WACCF,KAAKG,iBACL,CAAAF,IAAA,eAAAC,MAED,YCpBM,SAAsBE,GAA2B,IAAhBC,EAAMC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,IAAAA,UAAA,GAGzCG,EAAML,EAAUM,cAAc,wBAElC,OAAID,EAKG,+BAA2EE,MAAK,SAAAC,GAEtF,IAAQC,EAAaD,EAAbC,SAER,IAAIR,EASH,OAAO,IAAIQ,EAASJ,GARpB,IAAIK,EAASV,EAAUW,iBAAiB,wBACpCC,EAAY,GAIhB,OAHAC,MAAMC,KAAKJ,GAAQK,SAAQ,SAACV,EAAKW,GAChCJ,EAAUK,KAAM,IAAIR,EAASJ,OAE1BO,EAAUT,SAAWO,EAAOP,OAAeS,OAA/C,KAOA,OAAO,SAAAM,GAAK,OAAIA,EAAM,yDApBhBC,QAAQC,OAAO,oDDetBrB,CAAaH,KAAKF,KAAK,GAAMa,MAAK,SAACc,GACjCA,GAASA,EAAMlB,OAAS,GAAKkB,EAAMN,SAAQ,SAAAP,GAC3CA,EAAGc,kB,0FAfiB","file":"57.js","sourcesContent":["// CONSTANTS are all caps.\nconst NS = \"ProvenceMap\";\nconst CLS = \"provenceMap\";\nconst WG = `.${CLS}-`;\n\n// Import stuff here if you need to or even better to import them dynamically\n// for ex. of dynamic import check out src/scripts/loadWg/provenceMap.js using Webpack dynamic imports as chunks.\n// import $ from 'jquery'\n\nimport {loadFarmItem} from '../loadWg/farmItem';\n\nexport class ProvenceMap {\n\n\tconstructor($el) {\n\t\t// $el is the widget node return by the loadProvenceMap function\n\t\tthis.$el = $el;\n\t}\n\n\tinit() {\n\t\tthis.loadFarmItem();\n\t}\n\n\tloadFarmItem() {\n\t\t// Load FarmItem widget\n\t\tloadFarmItem(this.$el, true).then((wgAll) => {\n\t\t\t(wgAll && wgAll.length > 0) ? wgAll.forEach(wg => {\n\t\t\t\twg.init();\n\t\t\t}) : '';\n\t\t});\n\t}\n}\n","// Function loadFarmItem loads the FarmItem class by dynamically importing the js on demand if needed\n\nexport function loadFarmItem($parentEl, isList = false) {\n\n\n\tlet $wg = $parentEl.querySelector('[data-wg=\"FarmItem\"]');\n\n\tif(!$wg) {\n\t\t// console.info('FarmItem: no widget found');\n\t\treturn Promise.reject('FarmItem widget not found in the parent element');\n\t}\n\n\treturn import(/* webpackChunkName: \"wg-farm-item-chunk\" */ '../widgets/farmItem').then(wg => {\n\n\t\tconst { FarmItem } = wg;\n\n\t\tif (isList) {\n\t\t\tlet $wgCol = $parentEl.querySelectorAll('[data-wg=\"FarmItem\"]');\n\t\t\tlet instances = [];\n\t\t\tArray.from($wgCol).forEach(($wg, i) => {\n\t\t\t\tinstances.push( new FarmItem($wg) );\n\t\t\t});\n\t\t\tif (instances.length === $wgCol.length) return instances;\n\n\t\t} else {\n\t\t\treturn new FarmItem($wg);\n\t\t}\n\n\n\t}).catch(error => error+'An error occurred while loading the FarmItem widget');\n\n}\n"],"sourceRoot":""}