{"version":3,"file":"index.mjs","sources":[""],"sourcesContent":["import { createElement } from \"react\";\r\nimport { Map as MapComponent } from \"../../components/map\";\r\nimport type { IMapRef } from \"../../components/map/config/types\";\r\nimport { Collection } from \"../collection\";\r\nimport type { TCollectionElement, TCollectionItemDefaultCfg } from \"../collection\";\r\nimport { CollectionReactItem } from \"../collectionReactItem\";\r\n\r\ntype TCollectionArgs = [ string, typeof Map, boolean? ];\r\n\r\n/**\r\n * Класс для рендеринга элемента коллекции карт статичной верстки\r\n */\r\nexport class Map extends CollectionReactItem<TCollectionItemDefaultCfg, IMapRef> {\r\n\r\n  constructor(el: TCollectionElement, params?: TCollectionItemDefaultCfg) {\r\n    if (!(el instanceof HTMLElement)) {\r\n      throw new TypeError(`[Map] HTMLElement is expected, but got \"${el?.constructor?.name || typeof el}\"`);\r\n    }\r\n    super(el, MapCollection.selector);\r\n    this.render();\r\n  }\r\n\r\n  render() {\r\n    this.onBeforeMount();\r\n    this.root.render(createElement(MapComponent, {\r\n      onUnmount: this.onUnmount.bind(this),\r\n      onMount: this.onMount.bind(this),\r\n      ref: this.ref,\r\n      ...this.cfg,\r\n    }));\r\n  }\r\n\r\n}\r\n\r\n/**\r\n * Плагин для автоматического рендера карт. Является коллекцией.\r\n * @module MapCollection\r\n * @memberof Collection\r\n * @example\r\n * // <div data-js-yandex-map='{}'><div>\r\n */\r\nexport class MapCollection extends Collection<Map> {\n\n  /**\n   * Признак регистрации коллекции в глобальном namespace Core.\n   * @type {boolean}\n   */\n  static isApp = true;\n\n  /**\n   * CSS-селектор контейнеров карт для автоподключения коллекции.\n   * @type {string}\n   */\n  static selector = \"[data-js-yandex-map]\";\n\r\n  constructor(...args: TCollectionArgs) {\r\n    const defaultArgs: TCollectionArgs = [ MapCollection.selector, Map, true ];\r\n    const finalArgs = args.length ? args : defaultArgs;\r\n    super(...finalArgs);\r\n  }\r\n\r\n}\r\n"],"names":["Map","CollectionReactItem","constructor","el","params","HTMLElement","TypeError","name","super","MapCollection","selector","this","render","onBeforeMount","root","createElement","MapComponent","onUnmount","bind","onMount","ref","cfg","Collection","static","args","defaultArgs","finalArgs","length"],"mappings":";;;GAYO,MAAMA,YAAYC,oBAEvB,WAAAC,CAAYC,GAAwBC,QAClC,KAAMD,cAAcE,aAClB,MAAM,IAAIC,UAAU,2CAA2CH,IAAID,aAAaK,aAAeJ,OAEjGK,MAAML,GAAIM,cAAcC,UACxBC,KAAKC,QACP,CAEA,MAAAA,GACED,KAAKE,gBACLF,KAAKG,KAAKF,OAAOG,cAAcC,MAAc,CAC3CC,UAAWN,KAAKM,UAAUC,KAAKP,MAC/BQ,QAASR,KAAKQ,QAAQD,KAAKP,MAC3BS,IAAKT,KAAKS,OACPT,KAAKU,MAEZ;;;;;;;GAWK,MAAMZ,sBAAsBa;;;;;AAMjCC,aAAe;;;;;AAMfA,gBAAkB,uBAElB,WAAArB,IAAesB,MACb,MAAMC,YAA+B,CAAEhB,cAAcC,SAAUV,IAAK,MACpE,MAAM0B,UAAYF,KAAKG,OAASH,KAAOC,YACvCjB,SAASkB,UACX"}