@plattar/plattar-web
Version:
Module for interfacing with the Plattar Embeds and Web Viewers (https://www.plattar.com)
1 lines • 54.9 kB
JavaScript
"use strict";function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t)}:p}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value}},_get.apply(null,arguments)}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r}finally{try{if(!f&&null!=t["return"]&&(u=t["return"](),Object(u)!==u))return}finally{if(o)throw n}}return a}}function _arrayWithHoles(r){if(Array.isArray(r))return r}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var _n=0,F=function F(){};return{s:F,n:function n(){return _n>=r.length?{done:!0}:{done:!1,value:r[_n++]}},e:function e(r){throw r},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function s(){t=t.call(r)},n:function n(){var r=t.next();return a=r.done,r},e:function e(r){u=!0,o=r},f:function f(){try{a||null==t["return"]||t["return"]()}finally{if(u)throw o}}}}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}function _wrapNativeSuper(t){var r="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function _wrapNativeSuper(t){if(null===t||!_isNativeFunction(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,Wrapper)}function Wrapper(){return _construct(t,arguments,_getPrototypeOf(this).constructor)}return Wrapper.prototype=Object.create(t.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Wrapper,t)},_wrapNativeSuper(t)}function _construct(t,e,r){if(_isNativeReflectConstruct())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,e);var p=new(t.bind.apply(t,o));return r&&_setPrototypeOf(p,r.prototype),p}function _isNativeFunction(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(n){return"function"==typeof t}}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e))}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t})()}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_getPrototypeOf(t)}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e)}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_setPrototypeOf(t,e)}function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}(function(f){if((typeof exports==="undefined"?"undefined":_typeof(exports))==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.PlattarWeb=f()}})(function(){var define,module,exports;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r}()({1:[function(require,module,exports){var BaseElement=require("./base/base-element.js");var AdhocElement=function(_BaseElement){function AdhocElement(){_classCallCheck(this,AdhocElement);return _callSuper(this,AdhocElement)}_inherits(AdhocElement,_BaseElement);return _createClass(AdhocElement,[{key:"permissions",get:function get(){return["autoplay"]}},{key:"elementType",get:function get(){return"adhoc"}},{key:"elementFullLocation",get:function get(){if(this.hasAttribute("type")){var type=this.getAttribute("type");var server=this.hasAttribute("server")?this.getAttribute("server"):"production";switch(server){case"production":return"https://renderer.plattar.com/".concat(type,".html").concat(this.allMappedAttributesQuery);case"staging":return"https://renderer-staging.plattar.com/".concat(type,".html").concat(this.allMappedAttributesQuery);case"review":return"https://renderer-review.plattar.com/".concat(type,".html").concat(this.allMappedAttributesQuery);case"dev":return"https://localhost/renderer/".concat(type,".html").concat(this.allMappedAttributesQuery);default:throw new Error('AdhocElement.elementFullLocation - attribute "server" must be one of "production", "staging", "review" or "dev" but was "'.concat(server,'"'))}}throw new Error('AdhocElement.elementFullLocation - attribute "type" is required')}},{key:"optionalAttributes",get:function get(){if(this.hasAttribute("properties")){var properties=this.getAttribute("properties");if(properties){var splitProperties=properties.split(",");var props=[];splitProperties.forEach(function(prop){props.push({key:prop,map:prop.replaceAll("-","_")})});return props}}return[]}},{key:"coreAttributes",get:function get(){return[]}}])}(BaseElement);module.exports=AdhocElement},{"./base/base-element.js":2}],2:[function(require,module,exports){var Util=require("../../util/util");var ElementController=require("../controllers/element-controller");var _require=require("@plattar/context-messenger"),messenger=_require.messenger;var BaseElement=function(_HTMLElement){function BaseElement(){_classCallCheck(this,BaseElement);return _callSuper(this,BaseElement)}_inherits(BaseElement,_HTMLElement);return _createClass(BaseElement,[{key:"connectedCallback",value:function connectedCallback(){this._controller=new ElementController(this)}},{key:"onready",set:function set(callback){if(this._controller){this._controller.onload=callback;return}throw new Error("set BaseElement.onready - cannot use as element not connected")}},{key:"messengerInstance",get:function get(){return messenger}},{key:"messenger",get:function get(){return this._controller?this._controller.messenger:undefined}},{key:"context",get:function get(){return this.messengerInstance.self}},{key:"parent",get:function get(){return this.messengerInstance.parent}},{key:"element",get:function get(){return this._controller}},{key:"ready",get:function get(){return this._controller?true:false}},{key:"allowDragDrop",get:function get(){return this._controller?this._controller.controller.allowDragDrop:false},set:function set(value){if(this._controller){this._controller.controller.allowDragDrop=value;return}throw new Error("set BaseElement.allowDragDrop - cannot use as element not connected")}},{key:"permissions",get:function get(){return[]}},{key:"coreAttributes",get:function get(){return[{key:"scene-id",map:"scene_id"}]}},{key:"usesCoreAttribute",value:function usesCoreAttribute(key){var attr=this.coreAttributes;var length=attr.length;for(var i=0;i<length;i++){if(attr[i].key===key){return true}}return false}},{key:"usesOptionalAttribute",value:function usesOptionalAttribute(key){var attr=this.optionalAttributes;var length=attr.length;for(var i=0;i<length;i++){if(attr[i].key===key){return true}}return false}},{key:"usesAttribute",value:function usesAttribute(key){return this.usesCoreAttribute(key)||this.usesOptionalAttribute(key)}},{key:"optionalAttributes",get:function get(){return[]}},{key:"hasAllCoreAttributes",get:function get(){var attr=this.coreAttributes;var length=attr.length;for(var i=0;i<length;i++){if(!this.hasAttribute(attr[i].key)){return false}}return true}},{key:"allMappedAttributes",get:function get(){var _this=this;var map=new Map;var coreAttr=this.coreAttributes;var optAttr=this.optionalAttributes;coreAttr.forEach(function(ele){if(_this.hasAttribute(ele.key)){map.set(ele.map,_this.getAttribute(ele.key))}});optAttr.forEach(function(ele){if(_this.hasAttribute(ele.key)){map.set(ele.map,_this.getAttribute(ele.key))}});return map}},{key:"allMappedAttributesQuery",get:function get(){var attr=this.allMappedAttributes;var queryStr="";var first=true;var _iterator=_createForOfIteratorHelper(attr.entries()),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var _step$value=_slicedToArray(_step.value,2),key=_step$value[0],value=_step$value[1];queryStr+=first?"?"+key+"="+value:"&"+key+"="+value;first=false}}catch(err){_iterator.e(err)}finally{_iterator.f()}return queryStr}},{key:"elementType",get:function get(){return"none"}},{key:"elementFullLocation",get:function get(){var server=this.hasAttribute("server")?this.getAttribute("server"):"production";var serverLocation=Util.getServerLocation(server);if(serverLocation===undefined){throw new Error('BaseElement.elementFullLocation - attribute "server" must be one of "production", "staging", "review" or "dev" but was "'.concat(server,'"'))}var embedLocation=Util.getElementLocation(this.elementType);if(embedLocation===undefined){throw new Error('BaseElement.elementFullLocation - element named "'.concat(this.elementType,'" is invalid'))}if(serverLocation===Util.getServerLocation("dev")){return"".concat(serverLocation,"renderer/").concat(embedLocation).concat(this.allMappedAttributesQuery)}return"".concat(serverLocation).concat(embedLocation).concat(this.allMappedAttributesQuery)}}])}(_wrapNativeSuper(HTMLElement));module.exports=BaseElement},{"../../util/util":33,"../controllers/element-controller":4,"@plattar/context-messenger":17}],3:[function(require,module,exports){var BaseElement=require("./base/base-element.js");var ConfiguratorElement=function(_BaseElement2){function ConfiguratorElement(){_classCallCheck(this,ConfiguratorElement);return _callSuper(this,ConfiguratorElement)}_inherits(ConfiguratorElement,_BaseElement2);return _createClass(ConfiguratorElement,[{key:"permissions",get:function get(){return["autoplay"]}},{key:"elementType",get:function get(){return"configurator"}},{key:"elementFullLocation",get:function get(){if(this.hasAttribute("show-ui")){var state=this.getAttribute("show-ui");if(state==="true"){var server=this.hasAttribute("server")?this.getAttribute("server"):"production";switch(server){case"production":return"https://configurator.plattar.com/index.html".concat(this.allMappedAttributesQuery);case"staging":return"https://configurator-staging.plattar.com/index.html".concat(this.allMappedAttributesQuery);case"review":return"https://configurator-review.plattar.com/index.html".concat(this.allMappedAttributesQuery);case"dev":return"https://localhost/configurator/dist/index.html".concat(this.allMappedAttributesQuery);default:throw new Error('ConfiguratorElement.elementFullLocation - attribute "server" must be one of "production", "staging", "review" or "dev" but was "'.concat(server,'"'))}}}return _superPropGet(ConfiguratorElement,"elementFullLocation",this,1)}},{key:"optionalAttributes",get:function get(){return[{key:"config-state",map:"config_state"},{key:"show-ar",map:"show_ar"},{key:"scene-graph-id",map:"scene_graph_id"}]}}])}(BaseElement);module.exports=ConfiguratorElement},{"./base/base-element.js":2}],4:[function(require,module,exports){var Util=require("../../util/util.js");var _require2=require("@plattar/context-messenger"),messenger=_require2.messenger;var IFrameController=require("./iframe-controller.js");var ElementController=function(){function ElementController(element){var _this2=this;_classCallCheck(this,ElementController);this._element=element;var callback=function callback(mutationsList){var _iterator2=_createForOfIteratorHelper(mutationsList),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var mutation=_step2.value;if(mutation.type==="attributes"&&element.usesAttribute(mutation.attributeName)){if(element.hasAllCoreAttributes){_this2._load()}}}}catch(err){_iterator2.e(err)}finally{_iterator2.f()}};var observer=new MutationObserver(callback);observer.observe(this._element,{attributes:true});if(element.hasAllCoreAttributes){this._load()}}return _createClass(ElementController,[{key:"_load",value:function _load(){if(this._controller){this._controller._destroy();this._controller=undefined}var element=this._element;this._server=element.hasAttribute("server")?element.getAttribute("server"):"production";var source=element.elementFullLocation;this._messengerID="element_"+Util.id();this._controller=new IFrameController(element,source,this._messengerID,function(node){messenger.addChild(node)})}},{key:"onload",set:function set(callback){if(!callback){return}if(this.messenger){callback()}else{messenger.onload(this._messengerID,function(){callback()})}}},{key:"messenger",get:function get(){return messenger[this._messengerID]}},{key:"context",get:function get(){return messenger.self}},{key:"parent",get:function get(){return messenger.parent}},{key:"controller",get:function get(){return this._controller}}])}();module.exports=ElementController},{"../../util/util.js":33,"./iframe-controller.js":5,"@plattar/context-messenger":17}],5:[function(require,module,exports){var Util=require("../../util/util.js");var IFrameController=function(){function IFrameController(element,src,id){var _this3=this;var onelemload=arguments.length>3&&arguments[3]!==undefined?arguments[3]:undefined;_classCallCheck(this,IFrameController);this._iframe=document.createElement("iframe");this._isDraggable=false;if(!element.hasAttribute("sameorigin")){this._iframe.onload=function(){if(onelemload){onelemload(_this3._iframe)}}}this._iframe.setAttribute("id",id);this._iframe.setAttribute("width",element.hasAttribute("width")?element.getAttribute("width"):"500px");this._iframe.setAttribute("height",element.hasAttribute("height")?element.getAttribute("height"):"500px");this._iframe.setAttribute("src",src);this._iframe.setAttribute("frameBorder","0");var permissions=Util.getPermissionString(element.permissions);if(permissions){this._iframe.setAttribute("allow",permissions)}var shadow=element.shadowRoot||element.attachShadow({mode:"open"});this.allowDragging=false;shadow.append(this._iframe);if(element.hasAttribute("fullscreen")){var style=document.createElement("style");style.textContent="._PlattarFullScreen { width: 100%; height: 100%; position: absolute; top: 0; left: 0; }";this._iframe.className="_PlattarFullScreen";shadow.append(style);this._fsStyle=style}}return _createClass(IFrameController,[{key:"allowDragDrop",get:function get(){return this._isDraggable},set:function set(value){if(value){this._isDraggable=true;this._iframe.style.pointerEvents="none"}else{this._isDraggable=false;this._iframe.style.pointerEvents="auto"}}},{key:"_destroy",value:function _destroy(){if(this._iframe){this._iframe.remove()}if(this._fsStyle){this._fsStyle.remove()}this._iframe=undefined;this._fsStyle=undefined}},{key:"width",get:function get(){return this._iframe.getAttribute("width")},set:function set(value){this._iframe.setAttribute("width",value)}},{key:"child",get:function get(){return this._iframe}},{key:"height",get:function get(){return this._iframe.getAttribute("height")},set:function set(value){this._iframe.setAttribute("height",value)}},{key:"id",get:function get(){return this._iframe.id}}])}();module.exports=IFrameController},{"../../util/util.js":33}],6:[function(require,module,exports){var BaseElement=require("./base/base-element.js");var EditorElement=function(_BaseElement3){function EditorElement(){_classCallCheck(this,EditorElement);return _callSuper(this,EditorElement)}_inherits(EditorElement,_BaseElement3);return _createClass(EditorElement,[{key:"permissions",get:function get(){return["autoplay"]}},{key:"elementType",get:function get(){return"editor"}}])}(BaseElement);module.exports=EditorElement},{"./base/base-element.js":2}],7:[function(require,module,exports){var BaseElement=require("./base/base-element.js");var EWallElement=function(_BaseElement4){function EWallElement(){_classCallCheck(this,EWallElement);return _callSuper(this,EWallElement)}_inherits(EWallElement,_BaseElement4);return _createClass(EWallElement,[{key:"permissions",get:function get(){return["camera *","autoplay *","xr-spatial-tracking *","gyroscope *","accelerometer *","magnetometer *"]}},{key:"elementType",get:function get(){return"ewall"}}])}(BaseElement);module.exports=EWallElement},{"./base/base-element.js":2}],8:[function(require,module,exports){var BaseElement=require("./base/base-element.js");var FaceARElement=function(_BaseElement5){function FaceARElement(){_classCallCheck(this,FaceARElement);return _callSuper(this,FaceARElement)}_inherits(FaceARElement,_BaseElement5);return _createClass(FaceARElement,[{key:"permissions",get:function get(){return["camera","autoplay"]}},{key:"elementType",get:function get(){return"facear"}},{key:"optionalAttributes",get:function get(){return[{key:"variation-id",map:"variationId"},{key:"variation-sku",map:"variationSku"},{key:"product-id",map:"productId"},{key:"config-state",map:"config_state"},{key:"show-ar",map:"show_ar"}]}}])}(BaseElement);module.exports=FaceARElement},{"./base/base-element.js":2}],9:[function(require,module,exports){var BaseElement=require("./base/base-element.js");var GalleryElement=function(_BaseElement6){function GalleryElement(){_classCallCheck(this,GalleryElement);return _callSuper(this,GalleryElement)}_inherits(GalleryElement,_BaseElement6);return _createClass(GalleryElement,[{key:"permissions",get:function get(){return["autoplay"]}},{key:"elementType",get:function get(){return"gallery"}},{key:"optionalAttributes",get:function get(){return[]}}])}(BaseElement);module.exports=GalleryElement},{"./base/base-element.js":2}],10:[function(require,module,exports){var BaseElement=require("./base/base-element.js");var LauncherElement=function(_BaseElement7){function LauncherElement(){_classCallCheck(this,LauncherElement);return _callSuper(this,LauncherElement)}_inherits(LauncherElement,_BaseElement7);return _createClass(LauncherElement,[{key:"permissions",get:function get(){return["autoplay"]}},{key:"elementType",get:function get(){return"launcher"}},{key:"optionalAttributes",get:function get(){return[{key:"config-state",map:"config_state"},{key:"qr-options",map:"qr_options"},{key:"embed-type",map:"embed_type"},{key:"product-id",map:"product_id"},{key:"scene-product-id",map:"scene_product_id"},{key:"variation-id",map:"variation_id"},{key:"variation-sku",map:"variation_sku"},{key:"ar-mode",map:"ar_mode"},{key:"show-ar-banner",map:"show_ar_banner"},{key:"scene-graph-id",map:"scene_graph_id"}]}}])}(BaseElement);module.exports=LauncherElement},{"./base/base-element.js":2}],11:[function(require,module,exports){var BaseElement=require("./base/base-element.js");var ModelElement=function(_BaseElement8){function ModelElement(){_classCallCheck(this,ModelElement);return _callSuper(this,ModelElement)}_inherits(ModelElement,_BaseElement8);return _createClass(ModelElement,[{key:"permissions",get:function get(){return["camera","autoplay"]}},{key:"elementType",get:function get(){return"model"}},{key:"coreAttributes",get:function get(){return[]}},{key:"optionalAttributes",get:function get(){return[{key:"mode",map:"mode"},{key:"capture-id",map:"capture_id"},{key:"model-id",map:"model_id"}]}}])}(BaseElement);module.exports=ModelElement},{"./base/base-element.js":2}],12:[function(require,module,exports){var BaseElement=require("./base/base-element.js");var ProductElement=function(_BaseElement9){function ProductElement(){_classCallCheck(this,ProductElement);return _callSuper(this,ProductElement)}_inherits(ProductElement,_BaseElement9);return _createClass(ProductElement,[{key:"permissions",get:function get(){return["autoplay"]}},{key:"elementType",get:function get(){return"product"}},{key:"coreAttributes",get:function get(){return[{key:"product-id",map:"product_id"}]}},{key:"optionalAttributes",get:function get(){return[{key:"variation-id",map:"variation_id"},{key:"variation-sku",map:"variationSku"},{key:"show-ar",map:"show_ar"}]}}])}(BaseElement);module.exports=ProductElement},{"./base/base-element.js":2}],13:[function(require,module,exports){var BaseElement=require("./base/base-element.js");var StudioElement=function(_BaseElement0){function StudioElement(){_classCallCheck(this,StudioElement);return _callSuper(this,StudioElement)}_inherits(StudioElement,_BaseElement0);return _createClass(StudioElement,[{key:"permissions",get:function get(){return["autoplay"]}},{key:"elementType",get:function get(){return"studio"}},{key:"optionalAttributes",get:function get(){return[{key:"variation-id",map:"variationId"},{key:"variation-sku",map:"variationSku"}]}}])}(BaseElement);module.exports=StudioElement},{"./base/base-element.js":2}],14:[function(require,module,exports){var BaseElement=require("./base/base-element.js");var ViewerElement=function(_BaseElement1){function ViewerElement(){_classCallCheck(this,ViewerElement);return _callSuper(this,ViewerElement)}_inherits(ViewerElement,_BaseElement1);return _createClass(ViewerElement,[{key:"permissions",get:function get(){return["autoplay"]}},{key:"elementType",get:function get(){return"viewer"}},{key:"optionalAttributes",get:function get(){return[{key:"variation-id",map:"variationId"},{key:"variation-sku",map:"variationSku"},{key:"product-id",map:"productId"},{key:"show-ar",map:"show_ar"}]}}])}(BaseElement);module.exports=ViewerElement},{"./base/base-element.js":2}],15:[function(require,module,exports){var BaseElement=require("./base/base-element.js");var WebXRElement=function(_BaseElement10){function WebXRElement(){_classCallCheck(this,WebXRElement);return _callSuper(this,WebXRElement)}_inherits(WebXRElement,_BaseElement10);return _createClass(WebXRElement,[{key:"permissions",get:function get(){return["camera","autoplay","xr-spatial-tracking"]}},{key:"elementType",get:function get(){return"webxr"}}])}(BaseElement);module.exports=WebXRElement},{"./base/base-element.js":2}],16:[function(require,module,exports){"use strict";var WebXRElement=require("./elements/webxr-element.js");var ViewerElement=require("./elements/viewer-element.js");var ProductElement=require("./elements/product-element.js");var EWallElement=require("./elements/ewall-element.js");var FaceARElement=require("./elements/facear-element.js");var EditorElement=require("./elements/editor-element.js");var StudioElement=require("./elements/studio-element.js");var ModelElement=require("./elements/model-element.js");var ConfiguratorElement=require("./elements/configurator-element.js");var LauncherElement=require("./elements/launcher-element.js");var GalleryElement=require("./elements/gallery-element.js");var AdhocElement=require("./elements/adhoc-element.js");var Version=require("./version");if(customElements.get("plattar-webxr")===undefined){customElements.define("plattar-webxr",WebXRElement)}if(customElements.get("plattar-viewer")===undefined){customElements.define("plattar-viewer",ViewerElement)}if(customElements.get("plattar-product")===undefined){customElements.define("plattar-product",ProductElement)}if(customElements.get("plattar-editor")===undefined){customElements.define("plattar-editor",EditorElement)}if(customElements.get("plattar-facear")===undefined){customElements.define("plattar-facear",FaceARElement)}if(customElements.get("plattar-8wall")===undefined){customElements.define("plattar-8wall",EWallElement)}if(customElements.get("plattar-studio")===undefined){customElements.define("plattar-studio",StudioElement)}if(customElements.get("plattar-model")===undefined){customElements.define("plattar-model",ModelElement)}if(customElements.get("plattar-configurator")===undefined){customElements.define("plattar-configurator",ConfiguratorElement)}if(customElements.get("plattar-gallery")===undefined){customElements.define("plattar-gallery",GalleryElement)}if(customElements.get("plattar-launcher")===undefined){customElements.define("plattar-launcher",LauncherElement)}if(customElements.get("plattar-adhoc")===undefined){customElements.define("plattar-adhoc",AdhocElement)}console.log("using @plattar/plattar-web v"+Version);module.exports={version:Version}},{"./elements/adhoc-element.js":1,"./elements/configurator-element.js":3,"./elements/editor-element.js":6,"./elements/ewall-element.js":7,"./elements/facear-element.js":8,"./elements/gallery-element.js":9,"./elements/launcher-element.js":10,"./elements/model-element.js":11,"./elements/product-element.js":12,"./elements/studio-element.js":13,"./elements/viewer-element.js":14,"./elements/webxr-element.js":15,"./version":34}],17:[function(require,module,exports){"use strict";var Messenger=require("./messenger/messenger.js");var Memory=require("./memory/memory.js");var GlobalEventHandler=require("./messenger/global-event-handler.js");var Version=require("./version");if(!GlobalEventHandler.instance().messengerInstance){var messengerInstance=new Messenger;var memoryInstance=new Memory(messengerInstance);GlobalEventHandler.instance().messengerInstance=messengerInstance;GlobalEventHandler.instance().memoryInstance=memoryInstance}if(!GlobalEventHandler.instance().memoryInstance){var _memoryInstance=new Memory(GlobalEventHandler.instance().messengerInstance);GlobalEventHandler.instance().memoryInstance=_memoryInstance}console.log("using @plattar/context-messenger v"+Version);module.exports={messenger:GlobalEventHandler.instance().messengerInstance,memory:GlobalEventHandler.instance().memoryInstance,version:Version}},{"./memory/memory.js":18,"./messenger/global-event-handler.js":26,"./messenger/messenger.js":27,"./version":32}],18:[function(require,module,exports){var PermanentMemory=require("./permanent-memory");var TemporaryMemory=require("./temporary-memory");var Memory=function(){function Memory(messengerInstance){var _this4=this;_classCallCheck(this,Memory);this._messenger=messengerInstance;this._tempMemory=new TemporaryMemory(messengerInstance);this._permMemory=new PermanentMemory(messengerInstance);this._messenger.self.__memory__set_temp_var=function(name,data){_this4._tempMemory[name]=data};this._messenger.self.__memory__set_perm_var=function(name,data){_this4._permMemory[name]=data}}return _createClass(Memory,[{key:"temp",get:function get(){return this._tempMemory}},{key:"perm",get:function get(){return this._permMemory}}])}();module.exports=Memory},{"./permanent-memory":19,"./temporary-memory":20}],19:[function(require,module,exports){var WrappedValue=require("./wrapped-value");var PermanentMemory=_createClass(function PermanentMemory(messengerInstance){_classCallCheck(this,PermanentMemory);return new Proxy(this,{get:function get(target,prop,receiver){if(prop==="watch"){return function(variable,callback){if(!target[variable]){target[variable]=new WrappedValue(variable,true,messengerInstance)}target[variable].watch=callback}}if(prop==="clear"){return function(){var _iterator3=_createForOfIteratorHelper(Object.getOwnPropertyNames(target)),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var pitem=_step3.value;delete target[pitem];localStorage.removeItem(pitem)}}catch(err){_iterator3.e(err)}finally{_iterator3.f()}}}if(prop==="purge"){return function(){localStorage.clear();var _iterator4=_createForOfIteratorHelper(Object.getOwnPropertyNames(target)),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var pitem=_step4.value;delete target[pitem]}}catch(err){_iterator4.e(err)}finally{_iterator4.f()}}}if(prop==="refresh"){return function(){var _iterator5=_createForOfIteratorHelper(Object.getOwnPropertyNames(target)),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var val=_step5.value;target[val].refresh()}}catch(err){_iterator5.e(err)}finally{_iterator5.f()}}}if(!target[prop]){target[prop]=new WrappedValue(prop,true,messengerInstance)}return target[prop].value},set:function set(target,prop,value){if(!target[prop]){target[prop]=new WrappedValue(prop,true,messengerInstance)}target[prop].value=value;return true}})});module.exports=PermanentMemory},{"./wrapped-value":21}],20:[function(require,module,exports){var WrappedValue=require("./wrapped-value");var TemporaryMemory=_createClass(function TemporaryMemory(messengerInstance){_classCallCheck(this,TemporaryMemory);return new Proxy(this,{get:function get(target,prop,receiver){if(prop==="watch"){return function(variable,callback){if(!target[variable]){target[variable]=new WrappedValue(variable,false,messengerInstance)}target[variable].watch=callback}}if(prop==="clear"||prop==="purge"){return function(){var _iterator6=_createForOfIteratorHelper(Object.getOwnPropertyNames(target)),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var val=_step6.value;delete target[val]}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}}}if(prop==="refresh"){return function(){var _iterator7=_createForOfIteratorHelper(Object.getOwnPropertyNames(target)),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var val=_step7.value;target[val].refresh()}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}}}if(!target[prop]){target[prop]=new WrappedValue(prop,false,messengerInstance)}return target[prop].value},set:function set(target,prop,value){if(!target[prop]){target[prop]=new WrappedValue(prop,false,messengerInstance)}target[prop].value=value;return true}})});module.exports=TemporaryMemory},{"./wrapped-value":21}],21:[function(require,module,exports){var WrappedValue=function(){function WrappedValue(varName,isPermanent,messengerInstance){_classCallCheck(this,WrappedValue);this._value=undefined;this._callback=undefined;this._isPermanent=isPermanent;this._varName=varName;this._messenger=messengerInstance;if(this._isPermanent){this._value=JSON.parse(localStorage.getItem(this._varName))}}return _createClass(WrappedValue,[{key:"refresh",value:function refresh(){if(this._isPermanent){this._messenger.broadcast.__memory__set_perm_var(this._varName,this._value);if(this._messenger.parent){this._messenger.parent.__memory__set_perm_var(this._varName,this._value)}}else{this._messenger.broadcast.__memory__set_temp_var(this._varName,this._value);if(this._messenger.parent){this._messenger.parent.__memory__set_temp_var(this._varName,this._value)}}}},{key:"refreshFor",value:function refreshFor(callable){if(!this._messenger[callable]){return}if(this._isPermanent){this._messenger[callable].__memory__set_perm_var(this._varName,this._value)}else{this._messenger[callable].__memory__set_temp_var(this._varName,this._value)}}},{key:"value",get:function get(){if(this._isPermanent&&this._value==undefined){this._value=JSON.parse(localStorage.getItem(this._varName))}return this._value},set:function set(newValue){if(typeof newValue==="function"){throw new TypeError("WrappedValue.value cannot be set to a function type")}var oldValue=this._value;this._value=newValue;if(this._isPermanent){localStorage.setItem(this._varName,JSON.stringify(this._value))}if(this._callback&&oldValue!==newValue){this.refresh();this._callback(oldValue,this._value)}}},{key:"watch",set:function set(newValue){if(typeof newValue==="function"){if(newValue.length==2){this._callback=newValue}else{throw new RangeError("WrappedValue.watch callback must accept exactly 2 variables. Try using WrappedValue.watch = (oldVal, newVal) => {}")}}else{throw new TypeError("WrappedValue.watch must be a type of function. Try using WrappedValue.watch = (oldVal, newVal) => {}")}}}])}();module.exports=WrappedValue},{}],22:[function(require,module,exports){var Broadcaster=function(){function Broadcaster(messengerInstance){_classCallCheck(this,Broadcaster);this._messengerInstance=messengerInstance;this._interfaces=[];return new Proxy(this,{get:function get(target,prop,receiver){switch(prop){case"_push":case"_interfaces":return target[prop];default:break}return function(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}var interfaces=target._interfaces;var promises=[];interfaces.forEach(function(callable){var _target$_messengerIns;promises.push((_target$_messengerIns=target._messengerInstance[callable])[prop].apply(_target$_messengerIns,args))});return Promise.allSettled(promises)}}})}return _createClass(Broadcaster,[{key:"_push",value:function _push(interfaceID){var index=this._interfaces.indexOf(interfaceID);if(index>-1){this._interfaces.splice(index,1)}this._interfaces.push(interfaceID)}}])}();module.exports=Broadcaster},{}],23:[function(require,module,exports){var WrappedFunction=require("./wrapped-local-function");var CurrentFunctionList=_createClass(function CurrentFunctionList(){_classCallCheck(this,CurrentFunctionList);return new Proxy(this,{get:function get(target,prop,receiver){if(prop==="watch"){return function(variable,callback){if(!target[variable]){target[variable]=new WrappedFunction(variable)}target[variable].watch=callback}}if(prop==="clear"||prop==="purge"){return function(){var _iterator8=_createForOfIteratorHelper(Object.getOwnPropertyNames(target)),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var pitem=_step8.value;delete target[pitem]}}catch(err){_iterator8.e(err)}finally{_iterator8.f()}}}if(!target[prop]){target[prop]=new WrappedFunction(prop)}return function(){var _target$prop;return(_target$prop=target[prop]).exec.apply(_target$prop,arguments)}},set:function set(target,prop,value){if(!target[prop]){target[prop]=new WrappedFunction(prop)}target[prop].value=value;return true}})});module.exports=CurrentFunctionList},{"./wrapped-local-function":24}],24:[function(require,module,exports){var Util=require("../util/util.js");var WrappedLocalFunction=function(){function WrappedLocalFunction(funcName){_classCallCheck(this,WrappedLocalFunction);this._value=undefined;this._callback=undefined;this._funcName=funcName}return _createClass(WrappedLocalFunction,[{key:"_execute",value:function _execute(){for(var _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2]}var rData=this._value.apply(this,args);if(this._callback){this._callback.apply(this,[rData].concat(args))}return rData}},{key:"exec",value:function exec(){var _this5=this;for(var _len3=arguments.length,args=new Array(_len3),_key3=0;_key3<_len3;_key3++){args[_key3]=arguments[_key3]}return new Promise(function(accept,reject){if(!_this5._value){return reject(new Error("WrappedLocalFunction.exec() function with name "+_this5._funcName+"() is not defined"))}try{var rObject=_this5._execute.apply(_this5,args);if(Util.isPromise(rObject)){rObject.then(function(res){return accept(res)})["catch"](function(err){return reject(err)})}else{return accept(rObject)}}catch(e){return reject(e)}})}},{key:"value",set:function set(newValue){if(typeof newValue!=="function"){throw new TypeError("WrappedLocalFunction.value must be a function. To store values use Plattar.memory")}this._value=newValue}},{key:"watch",set:function set(newValue){if(typeof newValue==="function"){this._callback=newValue}else{throw new TypeError("WrappedLocalFunction.watch must be a type of function. Try using WrappedLocalFunction.watch = (rData, ...args) => {}")}}}])}();module.exports=WrappedLocalFunction},{"../util/util.js":31}],25:[function(require,module,exports){var Util=require("./util/util");var FunctionObserver=function(){function FunctionObserver(){_classCallCheck(this,FunctionObserver);this._observers=new Map}return _createClass(FunctionObserver,[{key:"subscribe",value:function subscribe(functionName,callback){var _this6=this;if(!functionName||!Util.isFunction(callback)){return function(){}}var observers=this._observers;var list=observers.get(functionName);if(!list){list=[];observers.set(functionName,list)}list.push(callback);return function(){return _this6.unsubscribe(functionName,callback)}}},{key:"unsubscribe",value:function unsubscribe(functionName,callback){if(!functionName||!Util.isFunction(callback)){return false}var observers=this._observers;var list=observers.get(functionName);if(list){var index=list.indexOf(callback);if(index>-1){list.splice(index,1);return true}}return false}},{key:"call",value:function call(functionName,data){if(!functionName||!data){return}var observers=this._observers;var list=observers.get(functionName);if(list&&list.length>0){list.forEach(function(observer){try{if(observer){observer(data)}}catch(e){}})}}}])}();module.exports=FunctionObserver},{"./util/util":31}],26:[function(require,module,exports){var RemoteInterface=require("./remote-interface.js");var GlobalEventHandler=function(){function GlobalEventHandler(){var _this7=this;_classCallCheck(this,GlobalEventHandler);this._eventListeners={};window.addEventListener("message",function(evt){var data=evt.data;var jsonData=undefined;try{jsonData=JSON.parse(data)}catch(e){jsonData=undefined}if(jsonData&&jsonData.event&&jsonData.data){if(_this7._eventListeners[jsonData.event]){var remoteInterface=new RemoteInterface(evt.source,evt.origin);_this7._eventListeners[jsonData.event].forEach(function(callback){try{callback(remoteInterface,jsonData.data)}catch(e){console.error("GlobalEventHandler.message() error occured during callback ");console.error(e)}})}}})}return _createClass(GlobalEventHandler,[{key:"messengerInstance",get:function get(){return this._messenger},set:function set(value){this._messenger=value}},{key:"memoryInstance",get:function get(){return this._memory},set:function set(value){this._memory=value}},{key:"listen",value:function listen(event,callback){if(typeof callback!=="function"){throw new TypeError("GlobalEventHandler.listen(event, callback) callback must be a type of function.")}if(!this._eventListeners[event]){this._eventListeners[event]=[]}this._eventListeners[event].push(callback)}}])}();GlobalEventHandler.instance=function(){if(!GlobalEventHandler._default){GlobalEventHandler._default=new GlobalEventHandler}return GlobalEventHandler._default};module.exports=GlobalEventHandler},{"./remote-interface.js":28}],27:[function(require,module,exports){var CurrentFunctionList=require("./current/current-function-list");var RemoteInterface=require("./remote-interface");var RemoteFunctionList=require("./remote/remote-function-list");var Util=require("./util/util.js");var GlobalEventHandler=require("./global-event-handler.js");var Broadcaster=require("./broadcaster.js");var FunctionObserver=require("./function-observer.js");var Messenger=function(){function Messenger(){_classCallCheck(this,Messenger);this._id=Util.id();this._parentStack=RemoteInterface["default"]();this._functionObserver=new FunctionObserver;this._currentFunctionList=new CurrentFunctionList;this._broadcaster=new Broadcaster(this);this._parentFunctionList=undefined;var callbacks=new Map;this._callbacks=callbacks;this._setup();return new Proxy(this,{get:function get(target,prop,receiver){if(prop==="onload"){return function(variable,callback){if(variable==="self"||variable==="id"){return callback()}if(target[variable]){return callback()}if(callbacks.has(variable)){var array=callbacks.get(variable);array.push(callback)}else{callbacks.set(variable,[callback])}}}switch(prop){case"id":return target._id;case"self":return target._currentFunctionList;case"broadcast":return target._broadcaster;case"addChild":case"observer":case"_setup":case"_registerListeners":case"_id":case"_broadcaster":case"_functionObserver":case"_callbacks":case"_parentStack":return target[prop];default:break}var targetVar=target[prop];if(!targetVar||!targetVar.isValid()){return undefined}return target[prop]}})}return _createClass(Messenger,[{key:"observer",get:function get(){return this._functionObserver}},{key:"addChild",value:function addChild(childNode){var remoteInterface=new RemoteInterface(childNode.contentWindow,"*");remoteInterface.send("__messenger__parent_init_inv",{id:childNode.id})}},{key:"_setup",value:function _setup(){this._registerListeners();if(this._parentStack){this._parentStack.send("__messenger__child_init")}if(window.location.protocol!=="https:"){console.warn("Messenger["+this._id+'] requires https but protocol is "'+window.location.protocol+'", messenger will not work correctly.')}}},{key:"_registerListeners",value:function _registerListeners(){var _this8=this;GlobalEventHandler.instance().listen("__messenger__child_init",function(src,data){var iframeID=src.id;switch(iframeID){case undefined:throw new Error("Messenger["+_this8._id+"].setup() Component ID cannot be undefined");case"self":throw new Error("Messenger["+_this8._id+'].setup() Component ID of "self" cannot be used as the keyword is reserved');case"parent":throw new Error("Messenger["+_this8._id+'].setup() Component ID of "parent" cannot be used as the keyword is reserved');case"id":throw new Error("Messenger["+_this8._id+'].setup() Component ID of "id" cannot be used as the keyword is reserved');case"onload":throw new Error("Messenger["+_this8._id+'].setup() Component ID of "onload" cannot be used as the keyword is reserved');default:break}_this8[iframeID]=new RemoteFunctionList(iframeID,_this8._functionObserver);_this8[iframeID].setup(new RemoteInterface(src.source,src.origin));_this8._broadcaster._push(iframeID);var callbacks=_this8._callbacks;if(callbacks.has(iframeID)){var array=callbacks.get(iframeID);if(array){array.forEach(function(item,_){try{if(item){item()}}catch(err){}})}}callbacks["delete"](iframeID);src.send("__messenger__parent_init")});GlobalEventHandler.instance().listen("__messenger__child_init_inv",function(src,data){var iframeID=data.id;switch(iframeID){case undefined:throw new Error("Messenger["+_this8._id+"].setup() Component ID cannot be undefined");case"self":throw new Error("Messenger["+_this8._id+'].setup() Component ID of "self" cannot be used as the keyword is reserved');case"parent":throw new Error("Messenger["+_this8._id+'].setup() Component ID of "parent" cannot be used as the keyword is reserved');case"id":throw new Error("Messenger["+_this8._id+'].setup() Component ID of "id" cannot be used as the keyword is reserved');case"onload":throw new Error("Messenger["+_this8._id+'].setup() Component ID of "onload" cannot be used as the keyword is reserved');default:break}_this8[iframeID]=new RemoteFunctionList(iframeID,_this8._functionObserver);_this8[iframeID].setup(new RemoteInterface(src.source,src.origin));_this8._broadcaster._push(iframeID);var callbacks=_this8._callbacks;if(callbacks.has(iframeID)){var array=callbacks.get(iframeID);if(array){array.forEach(function(item,_){try{if(item){item()}}catch(err){}})}}callbacks["delete"](iframeID)});GlobalEventHandler.instance().listen("__messenger__parent_init",function(src,data){var iframeID="parent";_this8[iframeID]=new RemoteFunctionList(iframeID,_this8._functionObserver);_this8[iframeID].setup(new RemoteInterface(src.source,src.origin));var callbacks=_this8._callbacks;if(callbacks.has(iframeID)){var array=callbacks.get(iframeID);if(array){array.forEach(function(item,_){try{if(item){item()}}catch(err){}})}}callbacks["delete"](iframeID)});GlobalEventHandler.instance().listen("__messenger__parent_init_inv",function(src,data){var iframeID="parent";_this8[iframeID]=new RemoteFunctionList(iframeID,_this8._functionObserver);_this8[iframeID].setup(new RemoteInterface(src.source,src.origin));var callbacks=_this8._callbacks;if(callbacks.has(iframeID)){var array=callbacks.get(iframeID);if(array){array.forEach(function(item,_){try{if(item){item()}}catch(err){}})}}callbacks["delete"](iframeID);src.send("__messenger__child_init_inv",{id:data.id})});GlobalEventHandler.instance().listen("__messenger__exec_fnc",function(src,data){var _GlobalEventHandler$i;var instanceID=data.instance_id;var args=data.function_args;var fname=data.function_name;(_GlobalEventHandler$i=GlobalEventHandler.instance().messengerInstance.self)[fname].apply(_GlobalEventHandler$i,_toConsumableArray(args)).then(function(res){src.send("__messenger__exec_fnc_result",{function_status:"success",function_name:fname,function_args:res,instance_id:instanceID})})["catch"](function(err){var error_arg=Util.isError(err)?err.message:err;src.send("__messenger__exec_fnc_result",{function_status:"error",function_name:fname,function_args:error_arg?error_arg:"unknown error",instance_id:instanceID})})})}}])}();module.exports=Messenger},{"./broadcaster.js":22,"./current/current-function-list":23,"./function-observer.js":25,"./global-event-handler.js":26,"./remote-interface":28,"./remote/remote-function-list":29,"./util/util.js":31}],28:[function(require,module,exports){var RemoteInterface=function(){function RemoteInterface(source,origin){_classCallCheck(this,RemoteInterface);this._source=source;this._origin=origin;if(typeof this._source.postMessage!=="function"){throw new Error("RemoteInterface() provided source is invalid")}}return _createClass(RemoteInterface,[{key:"source",get:function get(){return this._source}},{key:"origin",get:function get(){return this._origin}},{key:"id",get:function get(){return this.source.frameElement?this.source.frameElement.id:undefined}},{key:"send",value:function send(event,data){var sendData={event:event,data:data||{}};this.source.postMessage(JSON.stringify(sendData),this.origin)}}],[{key:"default",value:function _default(){try{var parentStack=window.parent?window.frameElement&&window.frameElement.nodeName=="IFRAME"?window.parent:undefined:undefined;if(parentStack){return new RemoteInterface(parentStack,"*")}}catch(err){}return undefined}}])}();module.exports=RemoteInterface},{}],29:[function(require,module,exports){var WrappedFunction=require("./wrapped-remote-function");var RemoteFunctionList=function(){function RemoteFunctionList(remoteName,functionObserver){_classCallCheck(this,RemoteFunctionList);this._remoteInterface=undefined;this._functionObserver=functionObserver;this._remoteName=remoteName;return new Proxy(this,{get:function get(target,prop,receiver){if(prop==="watch"){throw new Error("RemoteFunctionList.watch cannot watch execution of remote functions from current context. Did you mean to use Plattar.messenger.self instead?")}if(prop==="clear"){throw new Error("RemoteFunctionList.clear cannot clear/remove remote functions from current context. Did you mean to use Plattar.messenger.self.clear() instead?")}if(prop==="purge"){throw new Error("RemoteFunctionList.purge cannot clear/remove remote functions from current context. Did you mean to use Plattar.messenger.self.purge() instead?")}switch(prop){case"setup":case"isValid":case"_remoteInterface":case"_functionObserver":case"name":case"_remoteNa