{"version":3,"sources":["webpack:///../WCC.UI/App/components/photoset/complexNumber.js","webpack:///../WCC.UI/App/components/photoset/helpers.js","webpack:///../WCC.UI/App/components/photoset/item/model.js","webpack:///../WCC.UI/App/components/photoset/item/states.js","webpack:///../WCC.UI/App/components/photoset/item/viewmodel.js","webpack:///../WCC.UI/App/components/photoset/layouts/base/row.js","webpack:///../WCC.UI/App/components/photoset/layouts/factory.js","webpack:///../WCC.UI/App/components/photoset/layouts/fitColumn/column.js","webpack:///../WCC.UI/App/components/photoset/layouts/fitColumn/layout.js","webpack:///../WCC.UI/App/components/photoset/layouts/fitColumn/processors/align.js","webpack:///../WCC.UI/App/components/photoset/layouts/fitColumn/processors/balance.js","webpack:///../WCC.UI/App/components/photoset/layouts/fitColumn/processors/compact.js","webpack:///../WCC.UI/App/components/photoset/layouts/fitColumn/row.js","webpack:///../WCC.UI/App/components/photoset/layouts/fitRow/layout.js","webpack:///../WCC.UI/App/components/photoset/layouts/fitRow/row.js","webpack:///../WCC.UI/App/components/photoset/photoset.html?6049","webpack:///../WCC.UI/App/components/photoset/photoset.model.ts","webpack:///../WCC.UI/App/components/photoset/photoset.scss?8fb3","webpack:///../WCC.UI/App/components/photoset/photoset.ts","webpack:///../WCC.UI/App/decorators/componentModel.ts","webpack:///../WCC.UI/App/viewmodels/base_es5.js","webpack:///../WCC.UI/App/viewmodels/disposable_es5.js","webpack:///../WCC.UI/App/webpack/runtime/htmlExposer.js","webpack:///../WCC.UI/App/components/photoset/photoset.scss","webpack:///../WCC.UI/App/components/photoset/photoset.html"],"names":["define","Model","rel","abs","this","prototype","getModule","Math","sqrt","pow","add","other","multiply","divide","denominator","toStyleValue","complexNumber","states","Image","require","default","jsonModel","index","ko","observable","unwrap","data","template","mapNotNull","_getTemplate","state","justCreated","_width","pureComputed","width","_","result","defaultWidth","_height","absWidth","absHeight","relHeight","_getRelHeight","relWidth","_getRelWidth","colIdx","extend","deferred","rowIdx","top","left","height","_getHeight","showCounter","isVisible","WCC","UserFile","pending","active","Base","helpers","NodeTracker","Tracker","ViewModel","config","call","contentNode","contentTracker","_register","node","fancyboxNode","notifyIfChanged","hasFancybox","model","value","isReady","Object","create","constructor","onCoverClick","$","trigger","beforeInit","disposables","register","computed","_findFancybox","applyBindingsToNode","element","init","requestAnimationFrame","bind","ignoreDependencies","find","mutations","read","write","_updateItemsVisibility","FitColumnLayout","FitRowLayout","Factory","_config","build","name","toLowerCase","items","observableArray","isEmpty","offset","reduce","item","mapSingle","length","push","remove","removeAll","clear","ComplexNumber","Row","Balancer","Compresser","Aligner","Layout","jsonLayout","columnsCount","expand","processors","enable","_rows","_getRows","rows","_getProcessedRows","apply","rowOffset","row","columns","columnOffset","column","itemOffset","invoke","last","undefined","canAdd","append","each","Processor","options","process","filter","redistributionData","map","_getWidthToRedistribute","widthToRedistribute","totalOffset","idx","ratio","minItemsCount","count","floor","_getNextRow","_balanceRow","itemToAdd","indexOf","donors","slice","itemsCountToAdd","itemsToAdd","_borrowItem","any","pop","prepend","Column","_getColumns","concat","pluck","max","_append","compact","sortBy","_getColumnsCountToFitItems","pickedColumns","_canAdd","forEach","generate","chain","first","all","maxHeight","canFit","noUpscale","ignoreOrder","minColumnsCount","_getMinColumnsCount","targetColumnsCount","_getColumnsCount","minWidth","maxWidth","rowWidth","imageSizes","minColumnWidth","min","ceil","nextItem","toProcess","clone","shift","minRelWidth","_fillRow","availableWidth","realRelWidth","findIndex","splice","_getFinalRelWidth","content","expose","__esModule","Photoset","source","Array","outerOffset","colsCount","columnWidth","rowsCount","center","layout","hiddenItems","buildHiddenItemsOptions","noSingleImageCaption","api","module","i","exports","locals","LayoutsFactory","Item","components","registerLocal","statesAllowedToRender","PhotosetVM","info","effects","id","uniqueId","tracker","getColumnsCount","toPhotosetItem","itemsToRender","shouldAllowToRender","cHasOneItemOnly","cNoSingleImageCaption","layoutsFactory","getLayout","visibleRows","getVisibleRows","hiddenRows","getHiddenRows","hiddenItemsCount","getHiddenItemsCount","hasHiddenItems","getHeight","heightStyle","getMaxWidth","ready","subscribe","noop","attachTo","updateVisibleRows","updateItems","applyLayout","renderItems","toPx","includes","invokeNotNull","availableHeight","select","lastRow","lastItem","toRender","selectNotNull","h","__decorate","injectable","componentModel","__param","inject","wccModules","componentConfig","componentInfo","componentModelMetadataKey","Symbol","ctor","Reflect","defineMetadata","_ref","_ref2","ServicesContext","ManagersContext","templateNodes","ctx","storage","managers","Disposables","__initialized","__initTasks","func","dispose","field","_registerObservable","registerObservable","system","SystemHelpers","html","getTemplatesAndResources","document","head","appendChild","___CSS_LOADER_API_IMPORT___"],"mappings":"wIAAAA,WAuDC,KAvD+C,EAAF,WAC1C,SAASC,EAAMC,EAAKC,GAChBC,KAAKF,IAAMA,GAAO,EAClBE,KAAKD,IAAMA,GAAO,EAmDtB,OAhDAF,EAAMI,UAAUC,UAAY,WACxB,OAAOC,KAAKC,KAAKD,KAAKE,IAAIL,KAAKF,IAAK,GAAKK,KAAKE,IAAIL,KAAKD,IAAK,KAGhEF,EAAMI,UAAUK,IAAM,SAAUR,EAAKC,GAIjC,GAFAA,EAAMA,GAAO,GADbD,EAAMA,GAAO,aAGMD,EAAO,CACtB,IAAIU,EAAQT,EAEZA,EAAMS,EAAMT,IACZC,EAAMQ,EAAMR,IAGhB,OAAO,IAAIF,EAAMG,KAAKF,IAAMA,EAAKE,KAAKD,IAAMA,IAGhDF,EAAMI,UAAUO,SAAW,SAAUV,EAAKC,GAItC,GAFAA,EAAMA,GAAO,GADbD,EAAMA,GAAO,aAGMD,EAAO,CACtB,IAAIU,EAAQT,EAEZA,EAAMS,EAAMT,IACZC,EAAMQ,EAAMR,IAGhB,OAAO,IAAIF,EAAMG,KAAKF,IAAMA,EAAME,KAAKD,IAAMA,EAAKC,KAAKF,IAAMC,EAAMC,KAAKD,IAAMD,IAGlFD,EAAMI,UAAUQ,OAAS,SAAUX,EAAKC,GAIpC,GAFAA,EAAMA,GAAO,GADbD,EAAMA,GAAO,aAGMD,EAAO,CACtB,IAAIU,EAAQT,E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zN,EAAMwN,GAS7D,OARI7S,KAAK0S,cACL1S,KAAK+E,YAAYiO,mBAAmBF,EAAOzN,EAAMwN,GAEjD7S,KAAK2S,YAAY9L,KAAK,WAClB7G,KAAK+E,YAAYiO,mBAAmBF,EAAOzN,EAAMwN,IACnDtN,KAAKvF,OAGJ8S,GAGJnP,GACV,6B,8HC9CD,WAOC,KAPD,aACI,MAAMsP,EAAS,EAAQ,mCAAkBC,cAEzC,OAAO,SAAUC,GACbF,EAAOG,yBAAyBD,GAC3BjI,SAAQ,SAAUjH,GAAQoP,SAASC,KAAKC,YAAYtP,QAEhE,+B,gKCLDkK,EADkC,EAAQ,wDAChCqF,EAA4B,IAE9B3M,KAAK,CAACoH,EAAOC,EAAI,uvBAAwvB,KAEjxBD,EAAOE,QAAUA,G,gHCHjBF,EAAOE,QAFI","file":"111.7980dd33a2a6cc26906f.js","sourcesContent":["define('components/photoset/complexNumber', [], function () {\r\n function Model(rel, abs) {\r\n this.rel = rel || 0;\r\n this.abs = abs || 0;\r\n }\r\n\r\n Model.prototype.getModule = function () {\r\n return Math.sqrt(Math.pow(this.rel, 2) + Math.pow(this.abs, 2));\r\n };\r\n\r\n Model.prototype.add = function (rel, abs) {\r\n rel = rel || 0;\r\n abs = abs || 0;\r\n\r\n if (rel instanceof Model) {\r\n var other = rel;\r\n\r\n rel = other.rel;\r\n abs = other.abs;\r\n }\r\n\r\n return new Model(this.rel + rel, this.abs + abs);\r\n };\r\n\r\n Model.prototype.multiply = function (rel, abs) {\r\n rel = rel || 0;\r\n abs = abs || 0;\r\n\r\n if (rel instanceof Model) {\r\n var other = rel;\r\n\r\n rel = other.rel;\r\n abs = other.abs;\r\n }\r\n\r\n return new Model(this.rel * rel - this.abs * abs, this.rel * abs + this.abs * rel);\r\n };\r\n\r\n Model.prototype.divide = function (rel, abs) {\r\n rel = rel || 0;\r\n abs = abs || 0;\r\n\r\n if (rel instanceof Model) {\r\n var other = rel;\r\n\r\n rel = other.rel;\r\n abs = other.abs;\r\n }\r\n\r\n var denominator = rel * rel + abs * abs;\r\n\r\n return new Model((this.rel * rel + this.abs * abs) / denominator, (rel * this.abs - abs * this.rel) / denominator);\r\n };\r\n\r\n return Model;\r\n});","define('components/photoset/helpers', [], function () {\r\n return {\r\n toStyleValue: function (complexNumber) {\r\n return 'calc(' + complexNumber.rel + '% + ' + complexNumber.abs + 'px)';\r\n }\r\n };\r\n});","define('components/photoset/item/model',\r\n [\r\n 'components/photoset/item/states'\r\n ],\r\n\r\n function (states) {\r\n const Image = require('models/attachments/image').default;\r\n\r\n function Model(jsonModel) {\r\n this.index = ko.observable(jsonModel.index).unwrap();\r\n this.data = ko.observable(jsonModel.data);\r\n this.template = this.data.mapNotNull(this._getTemplate, this);\r\n this.state = ko.observable(states.justCreated);\r\n\r\n this._width = ko.pureComputed(function () {\r\n var width = _(this.data()).result('width', 0),\r\n defaultWidth = _(this.data()).result('defaultWidth', 0);\r\n\r\n return width || defaultWidth;\r\n }, this);\r\n\r\n this._height = ko.pureComputed(function () {\r\n var width = _(this.data()).result('height', 0),\r\n defaultWidth = _(this.data()).result('defaultHeight', 0);\r\n\r\n return width || defaultWidth;\r\n }, this);\r\n\r\n this.absWidth = this._width;\r\n this.absHeight = this._height;\r\n\r\n this.relHeight = ko.pureComputed(this._getRelHeight, this);\r\n this.relWidth = ko.pureComputed(this._getRelWidth, this);\r\n\r\n this.colIdx = ko.observable(null).extend({ deferred: true });\r\n this.rowIdx = ko.observable(null).extend({ deferred: true });\r\n\r\n this.top = ko.observable(null).extend({ deferred: true });\r\n this.left = ko.observable(null).extend({ deferred: true });\r\n\r\n this.width = ko.observable(null).extend({ deferred: true });\r\n this.height = ko.pureComputed(this._getHeight, this).extend({ deferred: true });\r\n\r\n this.showCounter = ko.observable(false).extend({ deferred: true });\r\n this.isVisible = ko.observable(false).unwrap().default(false);\r\n }\r\n\r\n Model.prototype._getRelHeight = function () {\r\n var width = this._width(),\r\n height = this._height();\r\n\r\n return width > 0 && height > 0 ? height / width : 0;\r\n };\r\n\r\n Model.prototype._getRelWidth = function () {\r\n var width = this._width(),\r\n height = this._height();\r\n\r\n return width > 0 && height > 0 ? width / height : 0;\r\n };\r\n\r\n Model.prototype._getHeight = function () {\r\n var width = this.width();\r\n\r\n if (width != null)\r\n return width.multiply(this.relHeight());\r\n\r\n return null;\r\n };\r\n\r\n Model.prototype._getTemplate = function (data) {\r\n if (data instanceof Image) {\r\n return 'wcc-components-photoset-new-image-and-title';\r\n } else if (WCC.UserFile != null && data instanceof WCC.UserFile) {\r\n return 'wcc-components-photoset-new-userfile';\r\n }\r\n\r\n return 'wcc-components-photoset-new-unknown-item';\r\n };\r\n\r\n return Model;\r\n });","define('components/photoset/item/states', [], function () {\r\n return {\r\n justCreated: 0,\r\n pending: 1,\r\n active: 2\r\n };\r\n});","define('components/photoset/item/viewmodel',\r\n [\r\n 'viewmodels/base_es5',\r\n 'components/photoset/helpers',\r\n 'components/photoset/item/states' \r\n ],\r\n\r\n function (Base, helpers, states) {\r\n const { NodeTracker: Tracker } = require('managers/nodes/tracker');\r\n\r\n function ViewModel(config) {\r\n Base.call(this, config);\r\n\r\n this.contentNode = ko.observable(null);\r\n this.contentTracker = this._register(new Tracker({ node: this.contentNode }));\r\n this.fancyboxNode = ko.observable(null).extend({ notifyIfChanged: true });\r\n this.hasFancybox = ko.pureComputed(function () { return this.fancyboxNode() != null }, this);\r\n\r\n this.top = this.model.top;\r\n this.left = this.model.left;\r\n this.width = this.model.width;\r\n this.height = this.model.relHeight.mapNotNull(function (value) { return value * 100 }).extend({ deferred: true });\r\n\r\n this.showCounter = this.model.showCounter;\r\n\r\n this.isReady = ko.pureComputed(function () { return this.top() != null && this.left() != null }, this).extend({ deferred: true });\r\n this.isVisible = ko.pureComputed(function () { return this.isReady() && this.model.isVisible() }, this).extend({ deferred: true });\r\n }\r\n\r\n ViewModel.prototype = Object.create(Base.prototype);\r\n ViewModel.prototype.constructor = ViewModel;\r\n\r\n ViewModel.prototype.onCoverClick = function () {\r\n if (this.showCounter())\r\n $(this.fancyboxNode()).trigger('wcc-fancybox.click');\r\n };\r\n\r\n ViewModel.prototype.beforeInit = function () {\r\n Base.prototype.beforeInit.call(this);\r\n\r\n this.disposables.register([\r\n ko.computed(this._findFancybox, this)\r\n ]);\r\n\r\n ko.applyBindingsToNode(this.element, {\r\n 'visible': this.isVisible,\r\n\r\n 'css': {\r\n 'photoset-new__item': true\r\n },\r\n 'style': {\r\n 'left': this.left.mapNotNull(helpers.toStyleValue),\r\n 'width': this.width.mapNotNull(helpers.toStyleValue),\r\n 'margin-top': this.top.mapNotNull(helpers.toStyleValue)\r\n },\r\n 'attr': {\r\n 'data-row': this.model.rowIdx,\r\n 'data-col': this.model.colIdx\r\n }\r\n });\r\n };\r\n\r\n ViewModel.prototype.init = function () {\r\n requestAnimationFrame(function () {\r\n this.model.state(states.active);\r\n }.bind(this));\r\n };\r\n\r\n ViewModel.prototype._findFancybox = function () {\r\n if (this.showCounter() && !this.hasFancybox()) {\r\n ko.ignoreDependencies(function (contentNode) {\r\n var node = $(contentNode).find('.wcc-fancybox')[0];\r\n\r\n if (node != null)\r\n this.fancyboxNode(node);\r\n }, this, [this.contentNode(), this.contentTracker.mutations()]);\r\n }\r\n };\r\n\r\n return ViewModel;\r\n });","define('components/photoset/layouts/base/row', [], function () {\r\n function Model(jsonModel) {\r\n const isVisible = ko.observable(true);\r\n\r\n this.isVisible = ko.pureComputed({\r\n read: () => isVisible(),\r\n\r\n write: value => {\r\n this._updateItemsVisibility(value);\r\n isVisible(value);\r\n }\r\n });\r\n }\r\n\r\n Model.prototype._updateItemsVisibility = function () { }\r\n\r\n return Model;\r\n});","define('components/photoset/layouts/factory', [\r\n 'components/photoset/layouts/fitColumn/layout',\r\n 'components/photoset/layouts/fitRow/layout'\r\n], function (FitColumnLayout, FitRowLayout) {\r\n function Factory(config) {\r\n this._config = config;\r\n }\r\n\r\n Factory.prototype.build = function (name) {\r\n switch (name.toLowerCase()) {\r\n case 'fitrow': return new FitRowLayout(this._config);\r\n default: return new FitColumnLayout(this._config);\r\n }\r\n };\r\n\r\n return Factory;\r\n});","define('components/photoset/layouts/fitColumn/column', [], function () {\r\n function Model(jsonModel) {\r\n this.items = ko.observableArray([]);\r\n this.isEmpty = this.items.isEmpty();\r\n this.offset = ko.observable(jsonModel.offset).unwrap();\r\n\r\n this.relHeight = this.items.reduce(function (value, item) { return value + item.relHeight() }, () => 0); \r\n this.relWidth = this.relHeight.mapSingle(function (value) { return value > 0 ? 1 / value : 0 });\r\n\r\n this.width = ko.observable(null);\r\n this.height = this.width.mapNotNull(function (width) {\r\n return width.multiply(this.relHeight()).add(0, this.offset() * (this.items().length - 1));\r\n }, this);\r\n }\r\n\r\n Model.prototype.add = function (item) {\r\n this.items.push(item);\r\n };\r\n\r\n Model.prototype.remove = function (item) {\r\n this.items.remove(item);\r\n };\r\n\r\n Model.prototype.removeAll = function (items) {\r\n this.items.removeAll(items);\r\n };\r\n\r\n Model.prototype.clear = function () {\r\n this.items([]);\r\n };\r\n\r\n return Model;\r\n});","define('components/photoset/layouts/fitColumn/layout', [\r\n 'components/photoset/complexNumber',\r\n 'components/photoset/layouts/fitColumn/row', \r\n 'components/photoset/layouts/fitColumn/processors/balance',\r\n 'components/photoset/layouts/fitColumn/processors/compact',\r\n 'components/photoset/layouts/fitColumn/processors/align'\r\n], function (ComplexNumber, Row, Balancer, Compresser, Aligner) {\r\n function Layout(jsonLayout) {\r\n this.items = jsonLayout.items;\r\n this.columnsCount = jsonLayout.columnsCount;\r\n this.offset = jsonLayout.offset;\r\n this.expand = jsonLayout.expand;\r\n\r\n this.processors = [\r\n new Balancer({ enable: this.expand, columnsCount: this.columnsCount }),\r\n new Compresser({ enable: this.expand }),\r\n new Aligner({ offset: this.offset, expand: this.expand })\r\n ];\r\n\r\n this._rows = ko.pureComputed(this._getRows, this).extend({ deferred: true });\r\n this.rows = ko.pureComputed(this._getProcessedRows, this).extend({ deferred: true });\r\n }\r\n\r\n Layout.prototype.apply = function () {\r\n var rows = this.rows(),\r\n offset = this.offset();\r\n\r\n ko.ignoreDependencies(function () {\r\n _(rows).reduce(function (rowOffset, row, rowIdx) {\r\n _(row.columns()).reduce(function (columnOffset, column, colIdx) {\r\n _(column.items()).reduce(function (itemOffset, item) {\r\n item.top(rowOffset.add(itemOffset));\r\n item.left(columnOffset);\r\n item.width(column.width());\r\n item.isVisible(row.isVisible());\r\n item.rowIdx(rowIdx);\r\n item.colIdx(colIdx);\r\n\r\n return itemOffset.add(item.height()).add(0, offset);\r\n }, new ComplexNumber());\r\n\r\n return columnOffset.add(column.width()).add(0, offset);\r\n }, new ComplexNumber());\r\n\r\n return rowOffset.add(row.height()).add(0, offset);\r\n }, new ComplexNumber());\r\n }, this); \r\n };\r\n\r\n Layout.prototype._getRows = function () {\r\n _(this.items()).invoke('absWidth');\r\n _(this.items()).invoke('absHeight');\r\n\r\n return ko.ignoreDependencies(function (items, columnsCount, offset) {\r\n var rows = _(items).reduce(function (rows, item) {\r\n var row = _(rows).last();\r\n\r\n if (row === undefined || !row.canAdd(item)) {\r\n row = new Row({ columnsCount: columnsCount, offset: offset });\r\n rows.push(row);\r\n }\r\n\r\n row.append(item);\r\n\r\n return rows;\r\n }, [], this);\r\n\r\n _(rows).each(function (row) {\r\n var columns = row.columns();\r\n\r\n _(columns).each(function (column) {\r\n column.width(new ComplexNumber(100 / columns.length));\r\n });\r\n });\r\n\r\n return rows;\r\n }, this, [this.items(), this.columnsCount(), this.offset()]); \r\n };\r\n\r\n Layout.prototype._getProcessedRows = function () {\r\n var rows = this._rows();\r\n\r\n _(this.processors).invoke('process', rows);\r\n\r\n return rows;\r\n };\r\n\r\n return Layout;\r\n});","define('components/photoset/layouts/fitColumn/processors/align', [\r\n 'components/photoset/complexNumber'\r\n], function (ComplexNumber) {\r\n function Processor(options) {\r\n this.offset = options.offset;\r\n this.expand = options.expand;\r\n }\r\n\r\n Processor.prototype.process = function (rows) {\r\n ko.ignoreDependencies(function (offset) {\r\n _(rows).each(function (row) {\r\n var columns = _(row.columns()).filter(function (column) { return !this.expand() || !column.isEmpty() }, this),\r\n redistributionData = _(columns).map(this._getWidthToRedistribute, this),\r\n widthToRedistribute = _(redistributionData).reduce(function (result, value) { return result + value }, 0),\r\n totalOffset = offset * (columns.length - 1);\r\n\r\n _(row.columns()).each(function (column, idx) {\r\n var ratio = column.relWidth() / row.relWidth();\r\n\r\n column.width(new ComplexNumber(ratio * 100, ratio * (widthToRedistribute - totalOffset) - redistributionData[idx]));\r\n });\r\n }, this);\r\n }, this, [this.offset()]);\r\n };\r\n\r\n Processor.prototype._getWidthToRedistribute = function (column) {\r\n return column.items().length > 1 ?\r\n this.offset() / column.relHeight() * (column.items().length - 1) :\r\n 0;\r\n };\r\n\r\n return Processor;\r\n});","define('components/photoset/layouts/fitColumn/processors/balance', [], function () {\r\n var threshold = 0.75;\r\n\r\n function Processor(options) {\r\n this.enable = ko.observable(options.enable).unwrap().default(true);\r\n this.columnsCount = ko.observable(options.columnsCount).unwrap();\r\n this.minItemsCount = this.columnsCount.mapSingle(function (count) { return Math.floor(count * threshold) });\r\n }\r\n\r\n Processor.prototype.process = function (rows) {\r\n if (this.enable()) {\r\n ko.ignoreDependencies(function () {\r\n if (rows.length > 1) {\r\n var row = this._getNextRow(rows);\r\n\r\n while (row != null) {\r\n this._balanceRow(row, rows);\r\n row = this._getNextRow(rows);\r\n }\r\n }\r\n }, this, [this.columnsCount(), this.minItemsCount()]);\r\n }\r\n };\r\n\r\n Processor.prototype._balanceRow = function (row, rows) {\r\n var rowIdx = _(rows).indexOf(row),\r\n donors = rows.slice(0, rowIdx);\r\n\r\n var itemsCountToAdd = this.minItemsCount() - row.items().length,\r\n itemsToAdd = [],\r\n itemToAdd;\r\n\r\n do {\r\n itemToAdd = this._borrowItem(donors);\r\n\r\n if (itemToAdd != null)\r\n itemsToAdd.push(itemToAdd);\r\n } while (itemsToAdd.length < itemsCountToAdd && itemToAdd != null);\r\n\r\n _(itemsToAdd).each(function (item) {\r\n row.append(item);\r\n });\r\n };\r\n\r\n Processor.prototype._getNextRow = function (rows) {\r\n var hasDonors = _(rows).any(function (row) { return row.items().length > this.minItemsCount() }.bind(this));\r\n\r\n if (hasDonors)\r\n return _(rows).find(function (row) { return row.items().length < this.minItemsCount() }.bind(this));\r\n\r\n return null;\r\n };\r\n\r\n Processor.prototype._borrowItem = function (rows) {\r\n var row = _(rows).last();\r\n\r\n if (row.items().length > this.minItemsCount()) {\r\n return row.pop();\r\n } else if (rows.length > 1) {\r\n var item = this._borrowItem(rows.slice(0, rows.length - 1));\r\n\r\n if (item != null) {\r\n row.prepend(item);\r\n return row.pop();\r\n }\r\n\r\n return null;\r\n } else {\r\n return null;\r\n }\r\n };\r\n\r\n return Processor;\r\n});","define('components/photoset/layouts/fitColumn/processors/compact', [], function () {\r\n function Processor(options) {\r\n this.enable = ko.observable(options.enable).unwrap().default(true);\r\n }\r\n\r\n Processor.prototype.process = function (rows) {\r\n if (this.enable()) {\r\n ko.ignoreDependencies(function () {\r\n _(rows).invoke('compact');\r\n }, this);\r\n }\r\n };\r\n\r\n return Processor;\r\n});","define('components/photoset/layouts/fitColumn/row', [\r\n 'components/photoset/layouts/base/row',\r\n 'components/photoset/layouts/fitColumn/column'\r\n], function (Base, Column) {\r\n var threshold = 1.25;\r\n\r\n function Model(jsonModel) {\r\n Base.call(this, jsonModel);\r\n\r\n this.columns = ko.pureComputed(this._getColumns.bind(this, jsonModel.columnsCount));\r\n\r\n this.items = this.columns.reduce(function (result, column) { return result.concat(column.items()) }, () => []);\r\n this.relWidth = this.columns.reduce(function (value, column) { return value + column.relWidth() }, () => 0);\r\n\r\n this.offset = ko.observable(jsonModel.offset).unwrap();\r\n\r\n this.height = this.columns\r\n .pluck('height')\r\n .max(function (height) { return height.getModule() });\r\n }\r\n\r\n Model.prototype = Object.create(Base.prototype);\r\n Model.prototype.constructor = Model;\r\n\r\n Model.prototype.append = function (item) {\r\n this._append(item, this.columns());\r\n };\r\n\r\n Model.prototype.prepend = function (item) {\r\n var items = [item].concat(this.items());\r\n\r\n _(this.columns()).invoke('clear');\r\n _(items).each(this.append.bind(this));\r\n };\r\n\r\n Model.prototype.pop = function () {\r\n var item = _(this.items()).last();\r\n\r\n if (item != null) {\r\n _(this.columns()).each(function (column) { column.remove(item) });\r\n return item;\r\n }\r\n\r\n return null;\r\n };\r\n\r\n Model.prototype.compact = function () {\r\n var items = _(this.items()).sortBy(function (item) { return item.index() }),\r\n columns = this.columns(),\r\n columnsCount = this._getColumnsCountToFitItems(items),\r\n pickedColumns = columns.slice(0, columnsCount);\r\n\r\n if (columnsCount < columns.length) {\r\n _(columns).invoke('clear');\r\n _(items).each(function (item) { this._append(item, pickedColumns) }, this);\r\n }\r\n };\r\n\r\n Model.prototype.clear = function () {\r\n _(this.columns()).invoke('clear');\r\n };\r\n\r\n Model.prototype.canAdd = function (item) {\r\n return this._canAdd(item, this.columns());\r\n };\r\n\r\n Model.prototype._updateItemsVisibility = function (value) {\r\n this.items().forEach(item => item.isVisible(value));\r\n }\r\n\r\n Model.prototype._getColumns = function (count) {\r\n return _.generate(count, function () { return new Column({ offset: this.offset }) }.bind(this));\r\n };\r\n\r\n Model.prototype._append = function (item, columns) {\r\n var column = _.chain(columns)\r\n .sortBy(function (column) { return column.relHeight() })\r\n .first()\r\n .value();\r\n\r\n if (column != null)\r\n column.add(item);\r\n };\r\n\r\n Model.prototype._canAdd = function (item, columns) {\r\n var hasFirstLine = _(columns).all(function (column) { return !column.isEmpty() });\r\n\r\n if (hasFirstLine) {\r\n var maxHeight = _.chain(columns)\r\n .map(function (column) { return column.items()[0] })\r\n .map(function (item) { return item.relHeight() })\r\n .max()\r\n .value() * threshold;\r\n\r\n return _(columns).any(function (column) { return column.relHeight() + item.relHeight() <= maxHeight });\r\n }\r\n\r\n return true;\r\n };\r\n\r\n Model.prototype._getColumnsCountToFitItems = function (items) {\r\n var result = this.columns().length,\r\n count = this.columns().length - 1,\r\n canFit = true,\r\n columns;\r\n\r\n while (canFit) {\r\n columns = this._getColumns(count);\r\n\r\n canFit = _(items).all(function (item) {\r\n var canAdd = this._canAdd(item, columns);\r\n\r\n if (canAdd)\r\n this._append(item, columns);\r\n\r\n return canAdd;\r\n }.bind(this));\r\n\r\n if (canFit) {\r\n result = count;\r\n count--;\r\n }\r\n }\r\n\r\n return result;\r\n };\r\n\r\n return Model;\r\n});","define('components/photoset/layouts/fitRow/layout', [\r\n 'components/photoset/complexNumber',\r\n 'components/photoset/layouts/fitRow/row'\r\n], function (ComplexNumber, Row) {\r\n function Layout(jsonLayout) {\r\n this.width = jsonLayout.width;\r\n this.items = jsonLayout.items;\r\n\r\n this.noUpscale = jsonLayout.noUpscale;\r\n this.ignoreOrder = jsonLayout.ignoreOrder;\r\n\r\n this.minColumnsCount = ko.pureComputed(this._getMinColumnsCount, this).extend({ deferred: true });\r\n this.targetColumnsCount = jsonLayout.columnsCount;\r\n this.columnsCount = ko.pureComputed(this._getColumnsCount, this).extend({ deferred: true });\r\n\r\n this.offset = jsonLayout.offset;\r\n this.expand = jsonLayout.expand;\r\n\r\n this.minWidth = ko.pureComputed(function () { return this.columnsCount() * 0.85 }, this);\r\n this.maxWidth = ko.pureComputed(function () { return this.columnsCount() * 1.25 }, this);\r\n\r\n this.rows = ko.pureComputed(this._getRows, this).extend({ deferred: true });\r\n }\r\n\r\n Layout.prototype.apply = function () {\r\n var rows = this.rows(),\r\n offset = this.offset();\r\n\r\n ko.ignoreDependencies(function () {\r\n _(rows).reduce(function (rowOffset, row, rowIdx) {\r\n var items = row.items();\r\n\r\n var rowWidth = row.relWidth(),\r\n totalOffset = offset * (items.length - 1);\r\n\r\n _(items).reduce(function (columnOffset, item, colIdx) {\r\n var ratio = item.relWidth() / rowWidth;\r\n\r\n item.top(rowOffset);\r\n item.left(columnOffset);\r\n item.width(new ComplexNumber(ratio * 100, -totalOffset * ratio));\r\n item.isVisible(row.isVisible);\r\n item.rowIdx(rowIdx);\r\n item.colIdx(colIdx);\r\n\r\n return columnOffset.add(item.width()).add(0, offset);\r\n }, new ComplexNumber(), this);\r\n\r\n return rowOffset.add(row.height()).add(0, offset);\r\n }, new ComplexNumber(), this);\r\n }, this);\r\n };\r\n\r\n Layout.prototype._getMinColumnsCount = function () {\r\n if (this.noUpscale() && this.width() > 0 && this.items().length > 0) {\r\n var imageSizes = _(this.items()).map(function (item) { return item.absHeight() }),\r\n minColumnWidth = _(imageSizes).min();\r\n\r\n if (minColumnWidth > 0)\r\n return Math.ceil(this.width() / minColumnWidth);\r\n }\r\n\r\n return 1;\r\n };\r\n\r\n Layout.prototype._getColumnsCount = function () {\r\n return _([this.targetColumnsCount(), this.minColumnsCount()]).max();\r\n };\r\n\r\n Layout.prototype._getRows = function () {\r\n var rows = [];\r\n\r\n var toProcess = _(this.items()).clone(),\r\n nextItem;\r\n\r\n _(this.items()).invoke('absWidth');\r\n _(this.items()).invoke('absHeight');\r\n\r\n while ((nextItem = toProcess.shift()) !== undefined) {\r\n var row = new Row({\r\n items: [nextItem],\r\n offset: this.offset,\r\n minRelWidth: this.minWidth,\r\n expand: this.expand\r\n });\r\n\r\n rows.push(row);\r\n\r\n this._fillRow(row, toProcess);\r\n }\r\n\r\n return rows;\r\n };\r\n\r\n Layout.prototype._fillRow = function (row, other) {\r\n ko.ignoreDependencies(function (maxWidth, minWidth, ignoreOrder) {\r\n var availableWidth = maxWidth - row.realRelWidth();\r\n\r\n if (ignoreOrder && row.realRelWidth() > minWidth)\r\n other = _(other).sortBy(function (item) { return -item.relWidth() });\r\n\r\n var idx = _(other).findIndex(function (item) { return availableWidth > item.relWidth() });\r\n\r\n if (idx !== -1) {\r\n row.append(other[idx]);\r\n other.splice(idx, 1);\r\n\r\n if (row.realRelWidth() < minWidth)\r\n this._fillRow(row, other);\r\n }\r\n }, this, [this.maxWidth(), this.minWidth(), this.ignoreOrder(), this.expand()]);\r\n };\r\n\r\n return Layout;\r\n});","define('components/photoset/layouts/fitRow/row', [\r\n 'components/photoset/layouts/base/row',\r\n 'components/photoset/complexNumber'\r\n], function (Base, ComplexNumber) {\r\n function Model(jsonModel) {\r\n Base.call(this, jsonModel);\r\n\r\n this.items = ko.observableArray(jsonModel.items);\r\n this.offset = jsonModel.offset;\r\n this.expand = jsonModel.expand;\r\n\r\n this.minRelWidth = ko.observable(jsonModel.minRelWidth).unwrap().default(0);\r\n this.realRelWidth = this.items.reduce(function (result, item) { return result + item.relWidth() }, () => 0);\r\n this.relWidth = ko.pureComputed(this._getFinalRelWidth, this);\r\n\r\n this.height = ko.pureComputed(this._getHeight, this);\r\n }\r\n\r\n Model.prototype = Object.create(Base.prototype);\r\n Model.prototype.constructor = Model;\r\n\r\n Model.prototype.append = function (item) {\r\n this.items.push(item);\r\n };\r\n\r\n Model.prototype._getFinalRelWidth = function () {\r\n if (this.expand())\r\n return this.realRelWidth();\r\n\r\n return this.realRelWidth() < this.minRelWidth() ? this.minRelWidth() : this.realRelWidth();\r\n };\r\n\r\n Model.prototype._getHeight = function () {\r\n var width = this.relWidth();\r\n\r\n if (width > 0) {\r\n var height = 1 / width;\r\n\r\n return new ComplexNumber(100 * height, -this.offset() * (this.items().length - 1) * height);\r\n }\r\n\r\n return new ComplexNumber();\r\n };\r\n\r\n return Model;\r\n});","define([\n \"!!../../../node_modules/html-loader/dist/cjs.js??ref--26-1!./photoset.html\", \n \"!../../webpack/runtime/htmlExposer.js\"], function (content, expose) {\n content = content.__esModule ? content.default : content;\n expose(content);\n return content;\n });","import { PureComputed } from 'knockout';\r\nimport WCCImage from 'models/attachments/image';\r\nimport { PhotosetConfig, PhotosetHiddenItemsConfig, PhotosetHiddenItemsState, PhotosetLayout } from './photoset.interfaces';\r\n\r\nexport default class Photoset {\r\n source: PureComputed>\r\n\r\n outerOffset: PureComputed\r\n offset: PureComputed\r\n colsCount: PureComputed\r\n columnWidth: PureComputed\r\n rowsCount: PureComputed\r\n maxHeight: PureComputed\r\n\r\n noUpscale: PureComputed\r\n ignoreOrder: PureComputed\r\n center: PureComputed\r\n expand: PureComputed\r\n\r\n layout: PureComputed\r\n\r\n hiddenItems: PhotosetHiddenItemsState\r\n\r\n noSingleImageCaption: PureComputed\r\n\r\n constructor(config: PhotosetConfig) {\r\n this.source = ko.observable(config.source).unwrap().default(new Array()).extend({ deferred: true });\r\n\r\n this.outerOffset = ko.observable(config.outerOffset).unwrap().default(0);\r\n this.offset = ko.observable(config.offset).unwrap().default(0);\r\n this.colsCount = ko.observable(config.colsCount).unwrap().default(2);\r\n this.columnWidth = ko.observable(config.columnWidth).unwrap().default(0);\r\n this.rowsCount = ko.observable(config.rowsCount).unwrap().default(2);\r\n this.maxHeight = ko.observable(config.maxHeight).unwrap().default(0);\r\n\r\n this.noUpscale = ko.observable(config.noUpscale).unwrap().default(false);\r\n this.ignoreOrder = ko.observable(config.ignoreOrder).unwrap().default(false);\r\n this.center = ko.observable(config.center).unwrap().default(true);\r\n this.expand = ko.observable(config.expand).unwrap().default(true);\r\n\r\n this.layout = ko.observable(config.layout).unwrap().default('fitColumn'); \r\n\r\n this.hiddenItems = this.buildHiddenItemsOptions(config.hiddenItems);\r\n\r\n this.noSingleImageCaption = ko.observable(config.noUpscale).unwrap().default(false);\r\n }\r\n\r\n private buildHiddenItemsOptions(config?: PhotosetHiddenItemsConfig): PhotosetHiddenItemsState {\r\n return {\r\n count: ko.observable(0),\r\n showCounter: ko.observable(config?.showCounter).unwrap().default(true)\r\n }\r\n }\r\n}","var api = require(\"!../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\");\n var content = require(\"!!../../../node_modules/css-loader/dist/cjs.js!../../../node_modules/sass-loader/dist/cjs.js!./photoset.scss\");\n\n content = content.__esModule ? content.default : content;\n\n if (typeof content === 'string') {\n content = [[module.id, content, '']];\n }\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nmodule.exports = content.locals || {};","import componentModel from 'decorators/componentModel';\r\nimport { wccModules } from 'enums/wccModules';\r\nimport { inject, injectable } from 'inversify';\r\nimport { Subscribable } from 'knockout';\r\nimport { NodeTracker } from 'managers/nodes/tracker';\r\nimport { EffectsContainer } from 'mixins/withEffects';\r\nimport WCCImage from 'models/attachments/image';\r\nimport './photoset.html';\r\nimport Photoset from './photoset.model';\r\nimport './photoset.scss';\r\n\r\nconst ComplexNumber = require('./complexNumber');\r\nconst LayoutsFactory = require('./layouts/factory');\r\nconst Item = require('./item/model');\r\nconst helpers = require('./helpers');\r\nconst states = require('./item/states');\r\n\r\ncomponents.registerLocal('photoset-new-item', () => require('./item/viewmodel'));\r\n\r\nconst statesAllowedToRender = [states.active, states.pending];\r\nconst instantRenderingThreshold = 10;\r\n\r\n@injectable()\r\n@componentModel(Photoset)\r\nexport default class PhotosetVM {\r\n private layout: Subscribable\r\n private width: Subscribable\r\n private offset: Subscribable\r\n private rowsCount: Subscribable\r\n private maxHeight: Subscribable\r\n\r\n private source: Subscribable>\r\n private items: Subscribable>\r\n private rows: Subscribable>\r\n private visibleRows: Subscribable>\r\n private hiddenRows: Subscribable>\r\n\r\n private layoutsFactory: any\r\n\r\n id = _.uniqueId('photoset-new-');\r\n\r\n heightStyle: Subscribable\r\n\r\n hiddenItemsCount: Subscribable\r\n maxWidth: Subscribable\r\n\r\n ready: Subscribable\r\n hasHiddenItems: Subscribable\r\n\r\n itemsToRender: Subscribable>\r\n\r\n cHasOneItemOnly: Subscribable\r\n cNoSingleImageCaption: Subscribable\r\n\r\n constructor(\r\n @inject(wccModules.componentConfig) private model: Photoset,\r\n @inject(wccModules.componentInfo) info: ko.components.ComponentInfo,\r\n @inject(wccModules.effects) effects: EffectsContainer\r\n ) {\r\n const tracker = new NodeTracker({ node: info.element });\r\n this.width = tracker.width;\r\n\r\n this.source = model.source;\r\n this.rowsCount = model.rowsCount;\r\n const columnsCount = ko.pureComputed(() => this.getColumnsCount()); \r\n const noUpscale = model.noUpscale;\r\n const ignoreOrder = model.ignoreOrder;\r\n const expand = model.expand;\r\n\r\n this.offset = model.offset;\r\n const outerOffset = model.outerOffset;\r\n\r\n this.items = this.source.map(item => this.toPhotosetItem(item));\r\n this.itemsToRender = this.items.filter(item => this.shouldAllowToRender(item));\r\n \r\n this.cHasOneItemOnly = ko.pureComputed(() => this.items().length === 1);\r\n this.cNoSingleImageCaption = model.noSingleImageCaption;\r\n\r\n this.layoutsFactory = new LayoutsFactory({\r\n width: this.width,\r\n items: this.items,\r\n columnsCount: columnsCount,\r\n offset: this.offset,\r\n expand: expand,\r\n noUpscale: noUpscale,\r\n ignoreOrder: ignoreOrder\r\n });\r\n\r\n this.layout = ko.pureComputed(() => this.getLayout()).extend({ deferred: true });\r\n this.rows = this.layout.pluck('rows', []).extend({ deferred: true });\r\n\r\n this.visibleRows = ko.pureComputed(() => this.getVisibleRows()).extend({ deferred: true });\r\n this.hiddenRows = ko.pureComputed(() => this.getHiddenRows()).extend({ deferred: true });\r\n\r\n this.hiddenItemsCount = ko.pureComputed(() => this.getHiddenItemsCount()).extend({ deferred: true });\r\n this.hasHiddenItems = ko.pureComputed(() => this.hiddenItemsCount() > 0).extend({ deferred: true });\r\n\r\n const height = ko.pureComputed(() => this.getHeight()).extend({ deferred: true });\r\n this.heightStyle = height.mapSingle(helpers.toStyleValue);\r\n\r\n this.maxHeight = model.maxHeight;\r\n this.maxWidth = ko.pureComputed(() => this.getMaxWidth());\r\n\r\n this.ready = ko.pureComputed(() => this.source().length > 0);\r\n\r\n effects.register([\r\n expand.subscribe(_.noop), //property tracking bug fix\r\n\r\n model.hiddenItems.count.attachTo(this.hiddenItemsCount),\r\n\r\n ko.computed(this.updateVisibleRows, this).extend({ deferred: true }),\r\n ko.computed(this.updateItems, this).extend({ deferred: true }),\r\n ko.computed(this.applyLayout, this).extend({ deferred: true }),\r\n ko.computed(this.renderItems, this).extend({ deferred: true })\r\n ]);\r\n\r\n ko.applyBindingsToNode(info.element, {\r\n 'visible': this.ready,\r\n\r\n 'css': {\r\n 'photoset-new': true,\r\n 'photoset-new--centered': model.center\r\n },\r\n\r\n 'style': {\r\n 'padding': outerOffset.toPx()\r\n },\r\n\r\n 'attr': {\r\n 'colsCount': columnsCount\r\n }\r\n });\r\n }\r\n\r\n private shouldAllowToRender(item: any) {\r\n return statesAllowedToRender.includes(item.state());\r\n }\r\n\r\n private getColumnsCount() {\r\n var columnWidth = this.model.columnWidth(),\r\n result;\r\n\r\n if (columnWidth > 0) {\r\n result = Math.floor(this.width() / columnWidth);\r\n } else {\r\n result = this.model.colsCount();\r\n }\r\n\r\n return result > 0 ? result : 1;\r\n }\r\n\r\n private getLayout() {\r\n if (this.ready())\r\n return ko.ignoreDependencies(layout => this.layoutsFactory.build(layout), this, [this.model.layout()]);\r\n }\r\n\r\n private getVisibleRows() {\r\n return _(this.rows()).filter(row => row.isVisible());\r\n }\r\n\r\n private getHiddenRows() {\r\n return this.rows().filter(row => !row.isVisible());\r\n }\r\n\r\n private getHiddenItemsCount(): number {\r\n return this.hiddenRows().reduce((result, row) => result + row.items().length, 0);\r\n }\r\n\r\n private getHeight() {\r\n return _(this.visibleRows()).reduce((value, row, idx, rows) => {\r\n var offset = idx < rows.length - 1 ? this.offset() : 0;\r\n\r\n return value\r\n .add(row.height())\r\n .add(0, offset);\r\n }, new ComplexNumber());\r\n }\r\n\r\n private toPhotosetItem(data: WCCImage) {\r\n return new Item({\r\n index: this.source.indexOf(data),\r\n data: data\r\n });\r\n }\r\n\r\n private applyLayout() {\r\n ko.ignoreDependencies(function () {\r\n this.updateVisibleRows();\r\n this.updateItems();\r\n }, this);\r\n\r\n this.layout.invokeNotNull(function (layout) { layout.apply() });\r\n }\r\n\r\n private updateVisibleRows() {\r\n if (!this.ready()) {\r\n _(this.rows()).invoke('isVisible', false);\r\n } else if (this.maxHeight() > 0) {\r\n _(this.rows()).reduce((availableHeight, row, idx) => {\r\n availableHeight -= row.height.select((height: any) => height.rel / 100 * this.width() + height.abs);\r\n\r\n row.isVisible(availableHeight >= 0 || idx === 0);\r\n\r\n return availableHeight;\r\n }, this.maxHeight());\r\n } else if (this.rowsCount() > 0) {\r\n _(this.rows()).each((row, idx) => row.isVisible(idx < this.rowsCount()));\r\n } else {\r\n _(this.rows()).each(row => row.isVisible(true));\r\n }\r\n }\r\n\r\n private updateItems() {\r\n var items = this.items(),\r\n showCounter = this.model.hiddenItems.showCounter;\r\n\r\n _(items).invoke('showCounter', false);\r\n\r\n if (showCounter()) {\r\n var lastRow = _(this.visibleRows()).last();\r\n\r\n if (lastRow != null) {\r\n var lastItem = _(lastRow.items()).last();\r\n\r\n if (lastItem != null)\r\n lastItem.showCounter(true);\r\n }\r\n }\r\n }\r\n\r\n private renderItems() {\r\n var items = this.items();\r\n\r\n if (items.length <= instantRenderingThreshold) {\r\n requestAnimationFrame(function () {\r\n _(items).each(function (item) {\r\n if (item.state() === states.justCreated)\r\n item.state(states.pending);\r\n });\r\n });\r\n } else {\r\n var busy = _(items).any(function (item) { return item.state() === states.pending });\r\n\r\n if (!busy) {\r\n var toRender = _(items).find(function (item) { return item.state() === states.justCreated });\r\n\r\n if (toRender != null) {\r\n requestAnimationFrame(function () {\r\n toRender.state(states.pending);\r\n });\r\n }\r\n }\r\n }\r\n }\r\n\r\n private getMaxWidth(): number | undefined {\r\n var maxHeight = this.maxHeight();\r\n\r\n if (maxHeight > 0) {\r\n var row = _(this.rows()).first();\r\n\r\n if (row !== undefined)\r\n return row.height.selectNotNull((h: any) => (maxHeight - h.abs) * (100 / h.rel));\r\n }\r\n }\r\n}","export const componentModelMetadataKey = Symbol('component:template');\r\n\r\nexport default function componentModel(model: any) {\r\n return (ctor: any) => {\r\n Reflect.defineMetadata(componentModelMetadataKey, model, ctor);\r\n return ctor;\r\n }\r\n}","define('viewmodels/base_es5', [\r\n 'viewmodels/disposable_es5',\r\n 'services/context',\r\n 'managers/context'\r\n], function (Base, { ServicesContext }, { ManagersContext }) {\r\n function ViewModel(config) {\r\n Base.call(this);\r\n\r\n this.model = config.model;\r\n this.data = config.data;\r\n this.element = config.element;\r\n this.templateNodes = config.templateNodes;\r\n this.ctx = this._register(new ServicesContext());\r\n this.components = this.ctx.components;\r\n this.storage = this.ctx.storage;\r\n this.managers = this._register(new ManagersContext()); \r\n }\r\n\r\n ViewModel.prototype = Object.create(Base.prototype);\r\n ViewModel.prototype.constructor = ViewModel;\r\n\r\n return ViewModel;\r\n})","define('viewmodels/disposable_es5', [\r\n 'managers/disposables'\r\n], function (Disposables) {\r\n function ViewModel() {\r\n this.__initialized = false;\r\n this.__initTasks = [];\r\n\r\n this.disposables = new Disposables();\r\n }\r\n\r\n ViewModel.prototype.beforeInit = function () {\r\n _(this.__initTasks).each(function (func) { func() });\r\n this.__initialized = true;\r\n };\r\n\r\n ViewModel.prototype.init = function () {};\r\n\r\n ViewModel.prototype.dispose = function () {\r\n this.disposables.dispose();\r\n };\r\n\r\n ViewModel.prototype._register = function (field) {\r\n if (this.__initialized) {\r\n this.disposables.register(field);\r\n } else {\r\n this.__initTasks.push(function () {\r\n this.disposables.register(field);\r\n }.bind(this));\r\n }\r\n\r\n return field;\r\n };\r\n\r\n ViewModel.prototype._registerObservable = function (field, init, dispose) {\r\n if (this.__initialized) {\r\n this.disposables.registerObservable(field, init, dispose);\r\n } else {\r\n this.__initTasks.push(function () {\r\n this.disposables.registerObservable(field, init, dispose);\r\n }.bind(this));\r\n }\r\n\r\n return field;\r\n };\r\n\r\n return ViewModel;\r\n});","define(function () {\r\n const system = require('helpers/system').SystemHelpers;\r\n\r\n return function (html) {\r\n system.getTemplatesAndResources(html)\r\n .forEach(function (node) { document.head.appendChild(node) });\r\n }\r\n});","// Imports\nvar ___CSS_LOADER_API_IMPORT___ = require(\"../../../node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \".photoset-new{position:relative;display:block}.photoset-new--centered .photoset-new__body{margin:auto}.photoset-new__body,.photoset-new__content{position:relative}.photoset-new__item{position:absolute;top:0}.photoset-new__item__body{position:relative}.photoset-new__item__content{position:absolute;top:0;right:0;bottom:0;left:0;overflow:hidden}.photoset-new__hidden-items-counter{position:absolute;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center;border-radius:4px;background-color:rgba(0,0,0,.65);color:#fff;font-size:24px}.photoset-new__hidden-items-counter--clickable .photoset-new__hidden-items-counter__cover{cursor:pointer}.photoset-new__hidden-items-counter__cover{position:absolute;top:0;left:0;right:0;bottom:0}\", \"\"]);\n// Exports\nmodule.exports = exports;\n","// Module\nvar code = \"\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\";\n// Exports\nmodule.exports = code;"],"sourceRoot":""}