       }
                    },
                    onDocumentClick: {
                        value: function (event) {
                            var clickedOutsideThisPanel = !$('.miniature-cdv-panel').has(event.target).length && !$('.miniature-cdv-panel').is(event.target),
                                $panelContainer = null;
                            if (clickedOutsideThisPanel) {
                                // Do not close if we are clicking in a panel that has an iframe
                                $panelContainer = $(event.target).closest(".stop-background-events");
                                if ($panelContainer.length > 0 &&
                                    $panelContainer.find("iframe").length > 0) {
                                    return true;
                                }

                                // Do not close if the event was forwarded from an iframe.
                                if ("originatesFromIFrame" in event) {
                                    return true;
                                }

                                // Hack: Do not close if we are clicking in a jqx listbox widget.
                                $panelContainer = $(event.target).closest("div[id^='listBoxjqxWidget']");
                                if ($panelContainer.length > 0) {
                                    return true;
                                }

                                proxy.notify(viewModel.closeNotificationString);
                                // Fire event to commit all values in contained properties
                                $(document).trigger('commitvalues');

                                viewModel.isOpen(false);
                                $(document).off('mousedown.miniaturecdv');
                            }
                            return true;
                        }
                    },
                    windowMargin: {
                        value: 30
                    },
                    hasMoved: {
                        value: ko.observable(false)
                    }
                };

                Object.defineProperties(viewModel, props);

                $(document).on('mousedown.miniaturecdv', viewModel.onDocumentClick);
            }
        };
    });