@shopify/app-bridge
Version:
**[Join our team and work on libraries like this one.](https://www.shopify.ca/careers)**
1 lines • 212 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("app-bridge",[],t):"object"==typeof exports?exports["app-bridge"]=t():e["app-bridge"]=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=53)}([function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.updateActionFromPayload=t.isValidOptionalString=t.isValidOptionalNumber=t.forEachInEnum=t.getMergedProps=t.findMatchInEnum=t.getEventNameSpace=t.NonSnakeCaseGroup=t.actionWrapper=void 0;var o=r(n(54)),i=n(23),a=n(1);function u(e,t){var n=o.default(e,t);return n||Object.assign(e,t)}t.actionWrapper=function(e){return e},t.NonSnakeCaseGroup=[a.Group.AuthCode,a.Group.Button,a.Group.ButtonGroup,a.Group.Cart,a.Group.Error,a.Group.Features,a.Group.Fullscreen,a.Group.Link,a.Group.Loading,a.Group.Menu,a.Group.Modal,a.Group.Navigation,a.Group.Pos,a.Group.Print,a.Group.ResourcePicker,a.Group.Scanner,a.Group.SessionToken,a.Group.Share,a.Group.TitleBar,a.Group.Toast,a.Group.unstable_Picker],t.getEventNameSpace=function(e,n,r){if(n.startsWith(""+i.PREFIX+i.SEPARATOR))return n;var o=function(e){return t.NonSnakeCaseGroup.includes(e)?e.toUpperCase():(n=e,n.replace(/([A-Z])/g,(function(e,t,n){return(0===n?"":"_")+e[0].toLowerCase()}))).toUpperCase();var n}(e);if(r){var a=r.subgroups,u=r.type;a&&a.length>0&&(o+=o.length>0?i.SEPARATOR:"",a.forEach((function(e,t){o+=""+e.toUpperCase()+(t<a.length-1?i.SEPARATOR:"")}))),u!==e&&u&&(o+=""+(o.length>0?i.SEPARATOR:"")+u.toUpperCase())}return o&&(o+=""+(o.length>0?i.SEPARATOR:"")+n.toUpperCase()),""+i.PREFIX+i.SEPARATOR+o},t.findMatchInEnum=function(e,t){var n=Object.keys(e).find((function(n){return t===e[n]}));return n?e[n]:void 0},t.getMergedProps=u,t.forEachInEnum=function(e,t){Object.keys(e).forEach((function(n){t(e[n])}))},t.isValidOptionalNumber=function(e){return null==e||"number"==typeof e},t.isValidOptionalString=function(e){return null==e||"string"==typeof e},t.updateActionFromPayload=function(e,t){return e.id===t.id&&(Object.assign(e,u(e,t)),!0)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ComponentType=t.Group=void 0,function(e){e.AuthCode="AuthCode",e.Button="Button",e.ButtonGroup="ButtonGroup",e.Cart="Cart",e.Client="Client",e.ContextualSaveBar="ContextualSaveBar",e.Error="Error",e.Features="Features",e.FeedbackModal="FeedbackModal",e.Fullscreen="Fullscreen",e.LeaveConfirmation="LeaveConfirmation",e.Link="Link",e.Loading="Loading",e.Menu="Menu",e.Modal="Modal",e.Navigation="Navigation",e.Performance="Performance",e.Pos="Pos",e.Print="Print",e.ResourcePicker="Resource_Picker",e.unstable_Picker="unstable_Picker",e.Scanner="Scanner",e.SessionToken="SessionToken",e.Share="Share",e.TitleBar="TitleBar",e.Toast="Toast",e.MarketingExternalActivityTopBar="MarketingExternalActivityTopBar",e.WebVitals="WebVitals"}(t.Group||(t.Group={})),function(e){e.Button="Button",e.ButtonGroup="ButtonGroup"}(t.ComponentType||(t.ComponentType={}))},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},a=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e},u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.unsubscribeActions=t.ActionSetWithChildren=t.ActionSet=void 0;var c=n(6),s=n(14),p=n(5),f=n(1),l=u(n(34)),d=n(0),h=function(){function e(e,t,n,r){var o=this;this.app=e,this.type=t,this.group=n,this.subgroups=[],this.subscriptions=[],e||p.throwError(p.Action.INVALID_ACTION,"Missing required `app`"),this.id=r||l.default(),this.defaultGroup=n;var i=this.set;this.set=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return o.app.hooks?(e=o.app.hooks).run.apply(e,a([c.LifecycleHook.UpdateAction,i,o],t)):i.apply(o,t)}}return e.prototype.set=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]},Object.defineProperty(e.prototype,"component",{get:function(){return{id:this.id,subgroups:this.subgroups,type:this.type}},enumerable:!1,configurable:!0}),e.prototype.updateSubscription=function(e,t,n){var r,o=e.eventType,i=e.callback,a=e.component;return(r=this.subscriptions.findIndex((function(t){return t===e})))>=0?this.subscriptions[r].unsubscribe():r=void 0,this.group=t,this.subgroups=n,Object.assign(a,{subgroups:this.subgroups}),this.subscribe(o,i,a,r)},e.prototype.error=function(e){var t=this,n=[];return d.forEachInEnum(p.Action,(function(r){n.push(t.subscriptions.length),t.subscribe(r,e)})),function(){n.map((function(e){return t.subscriptions[e]})).forEach((function(e){s.removeFromCollection(t.subscriptions,e,(function(e){e.unsubscribe()}))}))}},e.prototype.subscribe=function(e,t,n,r){var o,a=this,u=n||this.component,c=e.toUpperCase(),s="number"==typeof r?t:t.bind(this);o=p.isErrorEventName(e)?d.getEventNameSpace(f.Group.Error,e,i(i({},u),{type:""})):d.getEventNameSpace(this.group,e,u);var l=this.app.subscribe(o,s,n?n.id:this.id),h={eventType:c,unsubscribe:l,callback:s,component:u,updateSubscribe:function(e,t){return a.updateSubscription(h,e,t)}};return"number"==typeof r&&r>=0&&r<this.subscriptions.length?this.subscriptions[r]=h:this.subscriptions.push(h),l},e.prototype.unsubscribe=function(e){return void 0===e&&(e=!1),b(this.subscriptions,this.defaultGroup,e),this},e}();t.ActionSet=h;var y=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.children=[],t}return o(t,e),t.prototype.unsubscribe=function(e,n){return void 0===e&&(e=!0),void 0===n&&(n=!1),b(this.subscriptions,this.defaultGroup,n),this.children.forEach((function(n){n instanceof t?n.unsubscribe(e,!e):n.unsubscribe(!e)})),this},t.prototype.getChild=function(e){var t=this.children.findIndex((function(t){return t.id===e}));return t>=0?this.children[t]:void 0},t.prototype.getChildIndex=function(e){return this.children.findIndex((function(t){return t.id===e}))},t.prototype.getChildSubscriptions=function(e,t){return this.subscriptions.filter((function(n){return n.component.id===e&&(!t||t===n.eventType)}))},t.prototype.addChild=function(e,n,r){var o=this,i=e.subscriptions;return this.getChild(e.id)||this.children.push(e),!i||n===e.group&&r===e.subgroups||(i.forEach((function(e){(0,e.updateSubscribe)(n,r)})),Object.assign(e,{group:n,subgroups:r}),e instanceof t&&e.children.forEach((function(e){return o.addChild(e,n,r)}))),this},t.prototype.removeChild=function(e){var t=this;return s.removeFromCollection(this.children,this.getChild(e),(function(){t.subscriptions.filter((function(t){return t.component.id===e})).forEach((function(e){s.removeFromCollection(t.subscriptions,e,(function(e){e.unsubscribe()}))}))})),this},t.prototype.subscribeToChild=function(e,t,n){var r=this,o=n.bind(this);if(t instanceof Array)return t.forEach((function(t){return r.subscribeToChild(e,t,n)})),this;if("string"!=typeof t)return this;var i=t.toUpperCase(),a=this.getChildSubscriptions(e.id,i);if(a.length>0)a.forEach((function(t){return t.updateSubscribe(r.group,e.subgroups)}));else{var u={id:e.id,subgroups:e.subgroups,type:e.type};this.subscribe(i,o,u)}return this},t.prototype.getUpdatedChildActions=function(e,t){if(0!==e.length){for(var n=e.filter((function(e,t,n){return t===n.indexOf(e)})),r=n.map((function(e){return e.id})),o=t.filter((function(e){return r.indexOf(e.id)<0}));o.length>0;){if(!(i=o.pop()))break;this.removeChild(i.id)}return n}for(;t.length>0;){var i;if(!(i=t.pop()))break;this.removeChild(i.id)}},t}(h);function b(e,t,n){void 0===n&&(n=!1),e.forEach((function(e){n?(0,e.updateSubscribe)(t,[]):(0,e.unsubscribe)()})),n||(e.length=0)}t.ActionSetWithChildren=y,t.unsubscribeActions=b},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getPackageName=t.getVersion=t.getMergedProps=t.updateActionFromPayload=t.isValidOptionalString=t.isValidOptionalNumber=t.NonSnakeCaseGroup=t.getEventNameSpace=t.forEachInEnum=t.findMatchInEnum=t.actionWrapper=void 0;var r=n(0);Object.defineProperty(t,"actionWrapper",{enumerable:!0,get:function(){return r.actionWrapper}}),Object.defineProperty(t,"findMatchInEnum",{enumerable:!0,get:function(){return r.findMatchInEnum}}),Object.defineProperty(t,"forEachInEnum",{enumerable:!0,get:function(){return r.forEachInEnum}}),Object.defineProperty(t,"getEventNameSpace",{enumerable:!0,get:function(){return r.getEventNameSpace}}),Object.defineProperty(t,"NonSnakeCaseGroup",{enumerable:!0,get:function(){return r.NonSnakeCaseGroup}}),Object.defineProperty(t,"isValidOptionalNumber",{enumerable:!0,get:function(){return r.isValidOptionalNumber}}),Object.defineProperty(t,"isValidOptionalString",{enumerable:!0,get:function(){return r.isValidOptionalString}}),Object.defineProperty(t,"updateActionFromPayload",{enumerable:!0,get:function(){return r.updateActionFromPayload}}),Object.defineProperty(t,"getMergedProps",{enumerable:!0,get:function(){return r.getMergedProps}});var o=n(55);t.getVersion=function(){return o.version},t.getPackageName=function(){return o.name}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActionSetPayload=t.ComplexDispatch=t.DispatchAction=t.ClickAction=t.ComponentType=t.ActionSetProps=t.ActionSetOptions=t.Dispatch=t.ErrorCallback=t.UpdateSubscribe=t.ActionSubscription=t.ErrorSubscriber=t.UpdateSubscription=t.ActionSetInterface=t.Component=t.Group=t.ClientInterface=t.SimpleDispatch=t.Unsubscribe=t.MetaAction=t.AnyAction=t.ActionCallback=void 0;var r=n(1);Object.defineProperty(t,"ActionCallback",{enumerable:!0,get:function(){return r.ActionCallback}}),Object.defineProperty(t,"AnyAction",{enumerable:!0,get:function(){return r.AnyAction}}),Object.defineProperty(t,"MetaAction",{enumerable:!0,get:function(){return r.MetaAction}}),Object.defineProperty(t,"Unsubscribe",{enumerable:!0,get:function(){return r.Unsubscribe}}),Object.defineProperty(t,"SimpleDispatch",{enumerable:!0,get:function(){return r.SimpleDispatch}}),Object.defineProperty(t,"ClientInterface",{enumerable:!0,get:function(){return r.ClientInterface}}),Object.defineProperty(t,"Group",{enumerable:!0,get:function(){return r.Group}}),Object.defineProperty(t,"Component",{enumerable:!0,get:function(){return r.Component}}),Object.defineProperty(t,"ActionSetInterface",{enumerable:!0,get:function(){return r.ActionSetInterface}}),Object.defineProperty(t,"UpdateSubscription",{enumerable:!0,get:function(){return r.UpdateSubscription}}),Object.defineProperty(t,"ErrorSubscriber",{enumerable:!0,get:function(){return r.ErrorSubscriber}}),Object.defineProperty(t,"ActionSubscription",{enumerable:!0,get:function(){return r.ActionSubscription}}),Object.defineProperty(t,"UpdateSubscribe",{enumerable:!0,get:function(){return r.UpdateSubscribe}}),Object.defineProperty(t,"ErrorCallback",{enumerable:!0,get:function(){return r.ErrorCallback}}),Object.defineProperty(t,"Dispatch",{enumerable:!0,get:function(){return r.Dispatch}}),Object.defineProperty(t,"ActionSetOptions",{enumerable:!0,get:function(){return r.ActionSetOptions}}),Object.defineProperty(t,"ActionSetProps",{enumerable:!0,get:function(){return r.ActionSetProps}}),Object.defineProperty(t,"ComponentType",{enumerable:!0,get:function(){return r.ComponentType}}),Object.defineProperty(t,"ClickAction",{enumerable:!0,get:function(){return r.ClickAction}}),Object.defineProperty(t,"DispatchAction",{enumerable:!0,get:function(){return r.DispatchAction}}),Object.defineProperty(t,"ComplexDispatch",{enumerable:!0,get:function(){return r.ComplexDispatch}}),Object.defineProperty(t,"ActionSetPayload",{enumerable:!0,get:function(){return r.ActionSetPayload}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.permissionAction=t.isErrorEventName=t.throwError=t.invalidOriginAction=t.fromAction=t.AppBridgeError=t.AppActionType=t.Action=void 0;var r,o=n(1),i=n(0);!function(e){e.INVALID_ACTION="APP::ERROR::INVALID_ACTION",e.INVALID_ACTION_TYPE="APP::ERROR::INVALID_ACTION_TYPE",e.INVALID_PAYLOAD="APP::ERROR::INVALID_PAYLOAD",e.INVALID_OPTIONS="APP::ERROR::INVALID_OPTIONS",e.UNEXPECTED_ACTION="APP::ERROR::UNEXPECTED_ACTION",e.PERSISTENCE="APP::ERROR::PERSISTENCE",e.UNSUPPORTED_OPERATION="APP::ERROR::UNSUPPORTED_OPERATION",e.NETWORK="APP::ERROR::NETWORK",e.PERMISSION="APP::ERROR::PERMISSION",e.FAILED_AUTHENTICATION="APP::ERROR::FAILED_AUTHENTICATION",e.INVALID_ORIGIN="APP::ERROR::INVALID_ORIGIN"}(r=t.Action||(t.Action={})),function(e){e.INVALID_CONFIG="APP::ERROR::INVALID_CONFIG",e.MISSING_CONFIG="APP::APP_ERROR::MISSING_CONFIG",e.MISSING_APP_BRIDGE_MIDDLEWARE="APP::APP_ERROR::MISSING_APP_BRIDGE_MIDDLEWARE",e.WINDOW_UNDEFINED="APP::APP_ERROR::WINDOW_UNDEFINED",e.REDUX_REINSTANTIATED="APP::APP_ERROR::REDUX_REINSTANTIATED",e.MISSING_LOCAL_ORIGIN="APP::APP_ERROR::MISSING_LOCAL_ORIGIN",e.MISSING_HOST_PROVIDER="APP::APP_ERROR::MISSING_HOST_PROVIDER",e.MISSING_ROUTER_CONTEXT="APP::APP_ERROR::MISSING_ROUTER_CONTEXT",e.MISSING_HISTORY_BLOCK="APP::APP_ERROR::MISSING_HISTORY_BLOCK"}(t.AppActionType||(t.AppActionType={}));var a=function(e){this.name="AppBridgeError",this.message=e,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(this.message).stack};function u(e,t,n){var r=new a(e?t+": "+e:t);return r.action=n,r.type=t,r}t.AppBridgeError=a,a.prototype=Object.create(Error.prototype),t.fromAction=u,t.invalidOriginAction=function(e){return i.actionWrapper({group:o.Group.Error,payload:{message:e,type:r.INVALID_ORIGIN},type:r.INVALID_ORIGIN})},t.throwError=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n,r,o=e[0];throw"string"==typeof e[1]?n=e[1]:(r=e[1],n=e[2]||""),u(n,o,r)},t.isErrorEventName=function(e){return"string"==typeof i.findMatchInEnum(r,e)},t.permissionAction=function(e,t){return function(e,t,n){var r=t.payload;return i.actionWrapper({type:e,group:o.Group.Error,payload:{action:t,message:n,type:e,id:r&&r.id?r.id:void 0}})}(r.PERMISSION,e,t||"Action is not permitted")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LifecycleHook=t.PermissionType=t.MessageType=void 0,function(e){e.GetState="getState",e.Dispatch="dispatch",e.Subscribe="subscribe",e.Unsubscribe="unsubscribe"}(t.MessageType||(t.MessageType={})),function(e){e.Dispatch="Dispatch",e.Subscribe="Subscribe"}(t.PermissionType||(t.PermissionType={})),function(e){e.UpdateAction="UpdateAction",e.DispatchAction="DispatchAction"}(t.LifecycleHook||(t.LifecycleHook={}))},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.Button=t.update=t.clickButton=t.Style=t.Icon=t.Action=void 0;var a,u=n(0),c=n(2),s=n(1);function p(e,t,n){var r=t.id,o=u.getEventNameSpace(e,a.CLICK,t),i={id:r,payload:n};return u.actionWrapper({type:o,group:e,payload:i})}function f(e,t,n){var r=t.id,o=n.label,c=u.getEventNameSpace(e,a.UPDATE,t),s=i(i({},n),{id:r,label:o});return u.actionWrapper({type:c,group:e,payload:s})}!function(e){e.CLICK="CLICK",e.UPDATE="UPDATE"}(a=t.Action||(t.Action={})),function(e){e.Print="print"}(t.Icon||(t.Icon={})),function(e){e.Danger="danger"}(t.Style||(t.Style={})),t.clickButton=p,t.update=f;var l=function(e){function t(t,n){var r=e.call(this,t,s.ComponentType.Button,s.Group.Button)||this;return r.disabled=!1,r.loading=!1,r.plain=!1,r.set(n,!1),r}return o(t,e),Object.defineProperty(t.prototype,"options",{get:function(){return{disabled:this.disabled,icon:this.icon,label:this.label,style:this.style,loading:this.loading,plain:this.plain}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"payload",{get:function(){return i(i({},this.options),{id:this.id})},enumerable:!1,configurable:!0}),t.prototype.set=function(e,t){void 0===t&&(t=!0);var n=u.getMergedProps(this.options,e),r=n.label,o=n.disabled,i=n.icon,c=n.style,s=n.loading,p=n.plain;return this.label=r,this.disabled=Boolean(o),this.icon=i,this.style=c,this.loading=Boolean(s),this.plain=Boolean(p),t&&this.dispatch(a.UPDATE),this},t.prototype.dispatch=function(e,t){switch(e){case a.CLICK:this.app.dispatch(p(this.group,this.component,t));break;case a.UPDATE:var n=f(this.group,this.component,this.payload);this.app.dispatch(n)}return this},t}(c.ActionSet);t.Button=l},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0});var i=n(22);o(n(29),t),o(n(22),t),t.default=i.createClientApp},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.networkAction=t.persistenceAction=t.unsupportedOperationAction=t.unexpectedAction=t.invalidAction=t.invalidActionType=t.invalidPayload=t.Message=t.ErrorAction=t.fromAction=t.Action=t.permissionAction=t.isErrorEventName=t.throwError=t.invalidOriginAction=t.AppBridgeError=t.AppActionType=void 0;var r=n(5);Object.defineProperty(t,"Action",{enumerable:!0,get:function(){return r.Action}}),Object.defineProperty(t,"fromAction",{enumerable:!0,get:function(){return r.fromAction}}),Object.defineProperty(t,"ErrorAction",{enumerable:!0,get:function(){return r.ErrorAction}});var o=n(3),i=n(4),a=n(5);function u(e,t,n){var r=t.payload;return o.actionWrapper({type:e,group:i.Group.Error,payload:{action:t,message:n,type:e,id:r&&r.id?r.id:void 0}})}Object.defineProperty(t,"AppActionType",{enumerable:!0,get:function(){return a.AppActionType}}),Object.defineProperty(t,"AppBridgeError",{enumerable:!0,get:function(){return a.AppBridgeError}}),Object.defineProperty(t,"invalidOriginAction",{enumerable:!0,get:function(){return a.invalidOriginAction}}),Object.defineProperty(t,"throwError",{enumerable:!0,get:function(){return a.throwError}}),Object.defineProperty(t,"isErrorEventName",{enumerable:!0,get:function(){return a.isErrorEventName}}),Object.defineProperty(t,"permissionAction",{enumerable:!0,get:function(){return a.permissionAction}}),function(e){e.MISSING_PAYLOAD="Missing payload",e.INVALID_PAYLOAD_ID="Id in payload is missing or invalid"}(t.Message||(t.Message={})),t.invalidPayload=function(e,t){return u(r.Action.INVALID_PAYLOAD,e,t||"The action's payload is missing required properties or has invalid properties")},t.invalidActionType=function(e,t){return o.actionWrapper({group:i.Group.Error,payload:{action:e,message:t||"The action type is invalid or unsupported",type:r.Action.INVALID_ACTION_TYPE},type:r.Action.INVALID_ACTION_TYPE})},t.invalidAction=function(e,t){return o.actionWrapper({group:i.Group.Error,payload:{action:e,message:t||"The action's has missing/invalid values for `group`, `type` or `version`",type:r.Action.INVALID_ACTION},type:r.Action.INVALID_ACTION})},t.unexpectedAction=function(e,t){return o.actionWrapper({group:i.Group.Error,payload:{action:e,message:t||"Action cannot be called at this time",type:r.Action.UNEXPECTED_ACTION},type:r.Action.UNEXPECTED_ACTION})},t.unsupportedOperationAction=function(e,t){return u(r.Action.UNSUPPORTED_OPERATION,e,t||"The action type is unsupported")},t.persistenceAction=function(e,t){return u(r.Action.PERSISTENCE,e,t||"Action cannot be persisted on server")},t.networkAction=function(e,t){return u(r.Action.NETWORK,e,t||"Network error")}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.create=t.ButtonGroup=t.isGroupedButtonPayload=t.isGroupedButton=t.update=t.Action=void 0;var a,u=n(11),c=n(0),s=n(2),p=n(1);function f(e,t,n){return function(e,t,n,r,o){var a=t.id,u=r.label,s=c.getEventNameSpace(e,n,t),p=i(i({},r),{id:a,label:u,payload:o});return c.actionWrapper({type:s,group:e,payload:p})}(e,t,a.UPDATE,n)}!function(e){e.UPDATE="UPDATE"}(a=t.Action||(t.Action={})),t.update=f,t.isGroupedButton=function(e){var t=e;return t.buttons&&t.buttons.length>0&&void 0!==t.label},t.isGroupedButtonPayload=function(e){var t=e;return Array.isArray(t.buttons)&&"string"==typeof t.id&&"string"==typeof t.label};var l=function(e){function t(t,n){var r=e.call(this,t,p.ComponentType.ButtonGroup,p.Group.ButtonGroup)||this;return r.disabled=!1,r.plain=!1,r.buttonsOptions=[],r.buttons=[],r.set(n,!1),r}return o(t,e),Object.defineProperty(t.prototype,"options",{get:function(){return{buttons:this.buttonsOptions,disabled:this.disabled,label:this.label,plain:this.plain}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"payload",{get:function(){return i(i({},this.options),{buttons:this.buttons,id:this.id})},enumerable:!1,configurable:!0}),t.prototype.set=function(e,t){void 0===t&&(t=!0);var n=c.getMergedProps(this.options,e),r=n.label,o=n.disabled,i=n.buttons,u=n.plain;return this.label=r,this.disabled=Boolean(o),this.buttons=this.getButtons(i),this.plain=Boolean(u),t&&this.dispatch(a.UPDATE),this},t.prototype.dispatch=function(e){switch(e){case a.UPDATE:var t=f(this.group,this.component,this.payload);this.app.dispatch(t)}return this},t.prototype.updateButtons=function(e){if(this.buttons&&0!==this.buttons.length){for(var t,n=0,r=this.buttons;n<r.length;n++){var o=r[n];if(t=c.updateActionFromPayload(o,e))break}t&&this.dispatch(a.UPDATE)}},t.prototype.getSingleButton=function(e){return u.getSingleButton(this,e,this.subgroups,this.updateButtons)},t.prototype.getButtons=function(e){var t=this,n=[];return e?(e.forEach((function(e){var r=u.getSingleButton(t,e,t.subgroups,t.updateButtons);n.push(r)})),this.buttonsOptions=e,n):[]},t}(s.ActionSetWithChildren);t.ButtonGroup=l,t.create=function(e,t){return new l(e,t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSingleButton=void 0;var r=n(7);t.getSingleButton=function(e,t,n,o){return e.addChild(t,e.group,n),e.subscribeToChild(t,r.Action.UPDATE,o),t.payload}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.AppLink=t.update=t.Action=void 0;var a,u=n(0),c=n(2),s=n(1),p=n(21);function f(e,t,n){var r=t.id,o=n.label,c=n.destination,s=i(i({},n),{id:r,label:o,destination:c});return u.actionWrapper({group:e,type:u.getEventNameSpace(e,a.UPDATE,t),payload:s})}!function(e){e.UPDATE="UPDATE"}(a=t.Action||(t.Action={})),t.update=f;var l=function(e){function t(t,n){var r=e.call(this,t,s.Group.Link,s.Group.Link)||this;return r.label="",r.destination="",r.set(n,!1),r}return o(t,e),Object.defineProperty(t.prototype,"options",{get:function(){return{label:this.label,destination:this.destination,redirectType:p.Action.APP}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"payload",{get:function(){var e=this.options,t=e.label,n=e.destination,r=e.redirectType,o=n;return{id:this.id,label:t,destination:{path:o},redirectType:r}},enumerable:!1,configurable:!0}),t.prototype.set=function(e,t){void 0===t&&(t=!0);var n=u.getMergedProps(this.options,e),r=n.label,o=n.destination;return this.label=r,this.destination=o,t&&this.dispatch(a.UPDATE),this},t.prototype.dispatch=function(e){switch(e){case a.UPDATE:var t=f(this.group,this.component,this.payload);this.app.dispatch(t)}return this},t}(c.ActionSet);t.AppLink=l},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(57),t)},function(e,t,n){"use strict";function r(e,t,n){var r=e.findIndex((function(e){return e===t}));return r>=0&&(e.splice(r,1),n&&n(t),!0)}Object.defineProperty(t,"__esModule",{value:!0}),t.removeFromCollection=t.addAndRemoveFromCollection=void 0,t.addAndRemoveFromCollection=function(e,t,n){return e.push(t),function(){return r(e,t,n)}},t.removeFromCollection=r},function(e,t,n){"use strict";var r,o;Object.defineProperty(t,"__esModule",{value:!0}),t.isUnframed=t.isClient=t.isServer=void 0,t.isServer="undefined"==typeof window,t.isClient=!t.isServer,t.isUnframed=t.isClient&&(null===(o=null===(r=window.navigator)||void 0===r?void 0:r.userAgent)||void 0===o?void 0:o.indexOf("Unframed"))>0},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.isDevelopmentClient=t.isProduction=t.isDevelopment=t.isUnframed=t.isServer=t.isClient=void 0;var r=n(15),o=n(15);Object.defineProperty(t,"isClient",{enumerable:!0,get:function(){return o.isClient}}),Object.defineProperty(t,"isServer",{enumerable:!0,get:function(){return o.isServer}}),Object.defineProperty(t,"isUnframed",{enumerable:!0,get:function(){return o.isUnframed}}),t.isDevelopment=void 0!==e&&e.env&&!1,t.isProduction=!t.isDevelopment,t.isDevelopmentClient=t.isDevelopment&&r.isClient}).call(this,n(59))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isShopifyPing=t.isShopifyPOS=t.isShopifyMobile=t.isShopifyEmbedded=t.isMobile=void 0;var r=n(16);function o(){return"undefined"!=typeof navigator&&navigator.userAgent.indexOf("Shopify Mobile")>=0}function i(){return"undefined"!=typeof navigator&&navigator.userAgent.indexOf("Shopify POS")>=0}function a(){return"undefined"!=typeof navigator&&navigator.userAgent.indexOf("Shopify Ping")>=0}t.isMobile=function(){return o()||i()||a()},t.isShopifyEmbedded=function(){return r.isClient&&window.top!==window.self||r.isUnframed},t.isShopifyMobile=o,t.isShopifyPOS=i,t.isShopifyPing=a},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.Toast=t.primaryAction=t.clear=t.show=t.Action=void 0;var a,u=n(0),c=n(2),s=n(1);function p(e){return u.actionWrapper({group:s.Group.Toast,payload:e,type:a.SHOW})}function f(e){return u.actionWrapper({payload:e,group:s.Group.Toast,type:a.CLEAR})}function l(e){return u.actionWrapper({payload:e,group:s.Group.Toast,type:a.ACTION})}!function(e){e.SHOW="APP::TOAST::SHOW",e.CLEAR="APP::TOAST::CLEAR",e.ACTION="APP::TOAST::ACTION"}(a=t.Action||(t.Action={})),t.show=p,t.clear=f,t.primaryAction=l;var d=function(e){function t(t,n){var r=e.call(this,t,s.Group.Toast,s.Group.Toast)||this;return r.message="",r.duration=5e3,r.set(n),r}return o(t,e),Object.defineProperty(t.prototype,"options",{get:function(){var e;return{duration:this.duration,isError:this.isError,message:this.message,action:(null===(e=this.action)||void 0===e?void 0:e.content)?{content:this.action.content}:void 0}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"payload",{get:function(){return i({id:this.id},this.options)},enumerable:!1,configurable:!0}),t.prototype.set=function(e){var t=u.getMergedProps(this.options,e),n=t.message,r=t.duration,o=t.isError,i=t.action;return this.message=n,this.duration=r,this.isError=o,this.action=(null==i?void 0:i.content)?{content:i.content||""}:void 0,this},t.prototype.dispatch=function(e){switch(e){case a.SHOW:var t=p(this.payload);this.app.dispatch(t);break;case a.CLEAR:this.app.dispatch(f({id:this.id}));break;case a.ACTION:this.app.dispatch(l({id:this.id}))}return this},t}(c.ActionSet);t.Toast=d},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(75),t),o(n(35),t)},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.ModalIframe=t.ModalMessage=t.Modal=t.isMessageModal=t.isIframeModal=t.data=t.update=t.clickFooterButton=t.updateModalSize=t.closeModal=t.openModal=t.Size=t.Action=void 0;var a,u,c=n(11),s=n(0),p=n(2),f=n(1),l=n(7);!function(e){e.OPEN="APP::MODAL::OPEN",e.CLOSE="APP::MODAL::CLOSE",e.UPDATE="APP::MODAL::UPDATE",e.UPDATE_CONTENT="APP::MODAL::CONTENT::UPDATE",e.FOOTER_BUTTON_CLICK="APP::MODAL::FOOTER::BUTTON::CLICK",e.FOOTER_BUTTON_UPDATE="APP::MODAL::FOOTER::BUTTON::UPDATE",e.UPDATE_SIZE="APP::MODAL::UPDATE_SIZE",e.DATA="APP::MODAL::DATA"}(a=t.Action||(t.Action={})),function(e){e.Small="small",e.Medium="medium",e.Large="large",e.Full="full",e.Auto="auto"}(u=t.Size||(t.Size={}));var d={group:f.Group.Modal,subgroups:["Footer"],type:f.ComponentType.Button};function h(e){return s.actionWrapper({group:f.Group.Modal,payload:e,type:a.OPEN})}function y(e){return s.actionWrapper({group:f.Group.Modal,payload:e,type:a.CLOSE})}function b(e){return s.actionWrapper({payload:e,group:f.Group.Modal,type:a.UPDATE})}function P(e){return s.actionWrapper({payload:e,group:f.Group.Modal,type:a.DATA})}t.openModal=h,t.closeModal=y,t.updateModalSize=function(e){return s.actionWrapper({group:f.Group.Modal,payload:e,type:a.UPDATE_SIZE})},t.clickFooterButton=function(e,t){var n=i({id:e},d);return l.clickButton(f.Group.Modal,n,t)},t.update=b,t.data=P,t.isIframeModal=function(e){return"string"==typeof e.url||"string"==typeof e.path},t.isMessageModal=function(e){return"string"==typeof e.message};var A=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.size=u.Small,t}return o(t,e),Object.defineProperty(t.prototype,"footer",{get:function(){if(this.footerPrimary||this.footerSecondary)return{buttons:{primary:this.footerPrimary,secondary:this.footerSecondary}}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"footerOptions",{get:function(){if(this.footerPrimaryOptions||this.footerSecondaryOptions)return{buttons:{primary:this.footerPrimaryOptions,secondary:this.footerSecondaryOptions}}},enumerable:!1,configurable:!0}),t.prototype.close=function(){this.app.dispatch(y({id:this.id}))},t.prototype.setFooterPrimaryButton=function(e,t){var n=this,r=d.subgroups;this.footerPrimaryOptions=this.getChildButton(e,this.footerPrimaryOptions),this.footerPrimary=this.footerPrimaryOptions?c.getSingleButton(this,this.footerPrimaryOptions,r,(function(e){n.updatePrimaryFooterButton(e,t)})):void 0},t.prototype.setFooterSecondaryButtons=function(e,t){var n=this,r=d.subgroups,o=e||[],i=this.footerOptions&&this.footerOptions.buttons.secondary||[];this.footerSecondaryOptions=this.getUpdatedChildActions(o,i),this.footerSecondary=this.footerSecondaryOptions?this.footerSecondaryOptions.map((function(e){return c.getSingleButton(n,e,r,(function(e){n.updateSecondaryFooterButton(e,t)}))})):void 0},t.prototype.getChildButton=function(e,t){var n=e?[e]:[],r=t?[t]:[],o=this.getUpdatedChildActions(n,r);return o?o[0]:void 0},t.prototype.updatePrimaryFooterButton=function(e,t){this.footer&&this.footer.buttons.primary&&s.updateActionFromPayload(this.footer.buttons.primary,e)&&t()},t.prototype.updateSecondaryFooterButton=function(e,t){if(this.footer&&this.footer.buttons&&this.footer.buttons.secondary){for(var n,r=0,o=this.footer.buttons.secondary;r<o.length;r++){var i=o[r];if(n=s.updateActionFromPayload(i,e))break}n&&t()}},t}(p.ActionSetWithChildren);t.Modal=A;var g=function(e){function t(t,n){var r=e.call(this,t,f.Group.Modal,f.Group.Modal)||this;return r.set(n,!1),r}return o(t,e),Object.defineProperty(t.prototype,"payload",{get:function(){return i(i({},this.options),{footer:this.footer,id:this.id})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"options",{get:function(){return{footer:this.footerOptions,message:this.message,size:this.size,title:this.title}},enumerable:!1,configurable:!0}),t.prototype.set=function(e,t){var n=this;void 0===t&&(t=!0);var r=s.getMergedProps(this.options,e),o=r.title,i=r.footer,u=r.message,c=r.size;return this.title=o,this.message=u,this.size=c,this.setFooterPrimaryButton(i?i.buttons.primary:void 0,(function(){n.dispatch(a.UPDATE)})),this.setFooterSecondaryButtons(i?i.buttons.secondary:void 0,(function(){n.dispatch(a.UPDATE)})),t&&this.dispatch(a.UPDATE),this},t.prototype.dispatch=function(e){switch(e){case a.OPEN:this.app.dispatch(h(this.payload));break;case a.CLOSE:this.close();break;case a.UPDATE:this.app.dispatch(b(this.payload))}return this},t}(A);t.ModalMessage=g;var O=function(e){function t(t,n){var r=e.call(this,t,f.Group.Modal,f.Group.Modal)||this;return r.set(n,!1),r}return o(t,e),Object.defineProperty(t.prototype,"payload",{get:function(){return i(i({},this.options),{footer:this.footer,id:this.id})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"options",{get:function(){return{footer:this.footerOptions,path:this.path,size:this.size,title:this.title,url:this.url,loading:this.loading}},enumerable:!1,configurable:!0}),t.prototype.set=function(e,t){var n=this;void 0===t&&(t=!0);var r=s.getMergedProps(this.options,e),o=r.title,i=r.footer,u=r.path,c=r.url,p=r.size,f=r.loading;return this.title=o,this.url=c,this.path=u,this.size=p,this.loading=f,this.setFooterPrimaryButton(i?i.buttons.primary:void 0,(function(){n.dispatch(a.UPDATE)})),this.setFooterSecondaryButtons(i?i.buttons.secondary:void 0,(function(){n.dispatch(a.UPDATE)})),t&&this.dispatch(a.UPDATE),this},t.prototype.dispatch=function(e,t){switch(e){case a.OPEN:this.app.dispatch(h(this.payload));break;case a.CLOSE:this.close();break;case a.UPDATE:this.app.dispatch(b(this.payload));break;case a.DATA:this.app.dispatch(P(t||{}))}return this},t}(A);t.ModalIframe=O},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.Redirect=t.isProductVariantResourcePayload=t.isCreateResourcePayload=t.isAdminSection=t.isRemotePayload=t.isAdminSectionPayload=t.isAdminPathPayload=t.isAppPayload=t.getRelativePath=t.normalizeUrl=t.getPathWithSearchAndHash=t.toDestination=t.toApp=t.toRemote=t.toAdminSection=t.toAdminPath=t.isResourcePayload=t.ResourceType=t.Action=void 0;var a,u=n(0),c=n(2),s=n(1);function p(e){return u.actionWrapper({payload:e,group:s.Group.Navigation,type:a.ADMIN_PATH})}function f(e){return u.actionWrapper({payload:e,group:s.Group.Navigation,type:a.ADMIN_SECTION})}function l(e){return u.actionWrapper({payload:e,group:s.Group.Navigation,type:a.REMOTE})}function d(e){return u.actionWrapper({payload:e,group:s.Group.Navigation,type:a.APP})}function h(e,t,n){switch(e){case a.APP:var r=P(t)?t:{path:t};return d(i({id:n},r));case a.ADMIN_PATH:var o=A(t)?t:{path:t};return p(i({id:n},o));case a.ADMIN_SECTION:var u=g(t)?t:{section:t};return f(i({id:n},u));case a.REMOTE:var c=O(t)?t:{url:t};return l(i({id:n},c))}}function y(e){return""+e.pathname+(e.search||"")+(e.hash||"")}function b(e){if("string"==typeof e)return e.startsWith("/")?e:y(new URL(e));var t=e.search instanceof URLSearchParams?e.search.toString():e.search;return y(i(i({},e),{search:t}))}function P(e){return"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"path")}function A(e){return"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"path")}function g(e){return"object"==typeof e&&"object"==typeof e.section&&Object.prototype.hasOwnProperty.call(e.section,"name")}function O(e){return"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"url")}!function(e){e.ADMIN_SECTION="APP::NAVIGATION::REDIRECT::ADMIN::SECTION",e.ADMIN_PATH="APP::NAVIGATION::REDIRECT::ADMIN::PATH",e.REMOTE="APP::NAVIGATION::REDIRECT::REMOTE",e.APP="APP::NAVIGATION::REDIRECT::APP"}(a=t.Action||(t.Action={})),function(e){e.Product="products",e.Collection="collections",e.Order="orders",e.Customer="customers",e.Discount="discounts"}(t.ResourceType||(t.ResourceType={})),t.isResourcePayload=function(e){return"string"==typeof e.id},t.toAdminPath=p,t.toAdminSection=f,t.toRemote=l,t.toApp=d,t.toDestination=h,t.getPathWithSearchAndHash=y,t.normalizeUrl=function(e){return e instanceof URL?e.toString():"string"==typeof e?e:b(e)},t.getRelativePath=b,t.isAppPayload=P,t.isAdminPathPayload=A,t.isAdminSectionPayload=g,t.isRemotePayload=O,t.isAdminSection=function(e){return"object"==typeof e&&"string"==typeof(null==e?void 0:e.name)},t.isCreateResourcePayload=function(e){return!0===e.create},t.isProductVariantResourcePayload=function(e){var t=e;return void 0!==t.id&&void 0!==t.variant};var m=function(e){function t(t){return e.call(this,t,"Redirect",s.Group.Navigation)||this}return o(t,e),Object.defineProperty(t.prototype,"payload",{get:function(){return{id:this.id}},enumerable:!1,configurable:!0}),t.prototype.dispatch=function(e,t){var n=h(e,t,this.payload.id);return this.app.dispatch(n),this},t}(c.ActionSet);t.Redirect=m},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.createApp=t.createAppWrapper=t.createClientApp=t.WINDOW_UNDEFINED_MESSAGE=void 0;var a=n(3),u=n(24),c=n(9),s=n(13),p=n(58),f=n(16),l=n(26),d=n(27),h=n(64),y=n(28),b=n(29),P=i(n(65));t.WINDOW_UNDEFINED_MESSAGE="window is not defined. Running an app outside a browser is not supported";var A=function(e){return function(t){return e(r(r({},t),{version:a.getVersion(),clientInterface:{name:a.getPackageName(),version:a.getVersion()}}))}},g=function(e){e.set(b.LifecycleHook.DispatchAction,A)};function O(e,n,r){if(void 0===r&&(r=[]),!e)throw c.fromAction(t.WINDOW_UNDEFINED_MESSAGE,c.AppActionType.WINDOW_UNDEFINED);var i=y.getLocation(),a=n||i&&i.origin;if(!a)throw c.fromAction("local origin cannot be blank",c.AppActionType.MISSING_LOCAL_ORIGIN);var u=s.fromWindow(e,a);return t.createClientApp(u,o([g],r))}function m(e){var t=y.getWindow();return t&&t.top?O(t.top)(e):p.serverAppBridge}t.createClientApp=function(e,t){void 0===t&&(t=[]);var n=[],i=s.createTransportListener();return e.subscribe((function(e){var t=e.data,r=t.type,o=t.payload;switch(r){case"getState":n.splice(0).forEach((function(e){return e(o)}));break;case"dispatch":if(i.handleMessage(o),i.handleActionDispatch(o))return;var u=a.findMatchInEnum(c.Action,o.type);u&&c.throwError(u,o)}})),function(s){var A=function(e){var t;if(!e.host)throw c.fromAction("host must be provided",c.AppActionType.INVALID_CONFIG);if(!e.apiKey)throw c.fromAction("apiKey must be provided",c.AppActionType.INVALID_CONFIG);try{var n=atob(null===(t=e.host)||void 0===t?void 0:t.replace(/_/g,"/").replace(/-/g,"+"));return r(r({},e),{host:n})}catch(e){throw c.fromAction("not a valid host, please use the value provided by Shopify",c.AppActionType.INVALID_CONFIG)}}(s);if(function(e,t){var n=t.apiKey,r=t.host,o=t.forceRedirect,i=void 0===o?!f.isDevelopmentClient:o,a=y.getLocation();if(f.isUnframed||!a||!n||!r||!i||!y.shouldRedirect(e))return!1;var u="https://"+r+"/apps/"+n+a.pathname+(a.search||"");return y.redirect(u),!0}(e.hostFrame,A))return p.mockAppBridge;var g=function(e,t){return function(n,r){e.dispatch({payload:r,source:t,type:n})}}(e,A),O=i.createSubscribeHandler(g);function m(e){return g(b.MessageType.Dispatch,e),e}g(b.MessageType.Unsubscribe);for(var v=new URL("https://"+A.host).origin,_=new P.default,E={hostOrigin:v,localOrigin:e.localOrigin,hooks:_,dispatch:function(e){return E.hooks?E.hooks.run(b.LifecycleHook.DispatchAction,m,E,e):m(e)},featuresAvailable:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e[0],r=Array.isArray(n)?o([],n):e;return E.getState("features").then((function(e){return r.length?r.reduce((function(t,n){return Object.keys(e).includes(n)&&(t[n]=e[n]),t}),{}):e}))},getState:function(e){return e&&"string"!=typeof e?Promise.resolve(void 0):new Promise((function(e){n.push(e),g(b.MessageType.GetState)})).then((function(t){var n=t;if(e)for(var r=0,o=e.split(".");r<o.length;r++){var i=o[r];if(null==n||"object"!=typeof n||Array.isArray(n)||!Object.keys(n).includes(i))return;n=n[i]}return n}))},subscribe:O,error:function(e,t){var n=[];return a.forEachInEnum(c.Action,(function(r){n.push(O(r,e,t))})),function(){n.forEach((function(e){return e()}))}}},T=0,S=t;T<S.length;T++){(0,S[T])(_,E)}return function(e){e.subscribe(u.Action.APP,h.handleAppPrint),e.dispatch(l.initialize());try{d.initializeWebVitals(e)}catch(e){console.error("App-Bridge failed to initialize web-vitals",e)}}(E),E}},t.createAppWrapper=O,t.createApp=m,t.default=m},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SEPARATOR=t.PREFIX=void 0,t.PREFIX="APP",t.SEPARATOR="::"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.app=t.PrintAction=t.Action=void 0;var r=n(56);Object.defineProperty(t,"Action",{enumerable:!0,get:function(){return r.Action}}),Object.defineProperty(t,"PrintAction",{enumerable:!0,get:function(){return r.PrintAction}}),Object.defineProperty(t,"app",{enumerable:!0,get:function(){return r.app}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isPermitted=t.getPermissionKey=t.isPerformanceOrWebVitalsAction=t.isAppMessage=t.isAppBridgeAction=void 0;var r=n(6),o=n(23),i=n(0);function a(e){return e.replace(new RegExp("^"+o.PREFIX+o.SEPARATOR+"\\w+"+o.SEPARATOR),"")}t.isAppBridgeAction=function(e){return e instanceof Object&&Object.prototype.hasOwnProperty.call(e,"type")&&e.type.toString().startsWith(o.PREFIX)},t.isAppMessage=function(e){if("object"!=typeof e||!e.data||"object"!=typeof e.data)return!1;var t=e.data;return Object.prototype.hasOwnProperty.call(t,"type")&&void 0!==i.findMatchInEnum(r.MessageType,t.type)},t.isPerformanceOrWebVitalsAction=function(e){return e.type.match(/^APP::(PERFORMANCE|WEB_VITALS)::/)},t.getPermissionKey=a,t.isPermitted=function(e,t,n){var r=t.group,o=t.type;if(!r||!Object.prototype.hasOwnProperty.call(e,r))return!1;var i=e[r];if(!i)return!1;var u=a(o);return!!i[u]&&!0===i[u][n]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initialize=t.Action=void 0;var r=n(60);Object.defineProperty(t,"Action",{enumerable:!0,get:function(){return r.Action}});var o=n(4),i=n(3);t.initialize=function(){return i.actionWrapper({group:o.Group.Client,type:r.Action.INITIALIZE})}},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(61),t)},function(e,t,n){"use strict";function r(){return o()?window.location:void 0}function o(){return"undefined"!=typeof window}Object.defineProperty(t,"__esModule",{value:!0}),t.getWindow=t.getLocation=t.redirect=t.shouldRedirect=void 0,t.shouldRedirect=function(e){return e===window},t.redirect=function(e){var t=r();t&&t.assign(e)},t.getLocation=r,t.getWindow=function(){return o()?window:void 0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isV1Config=t.ClientApplication=t.MessageType=t.AppConfigV2=t.FeaturesState=t.FeaturesAvailable=t.TransportSubscription=t.PathValue=t.Path=t.LifecycleHandler=t.DispatchActionHandler=t.DispatchActionHook=t.UpdateActionHandler=t.UpdateActionHook=t.LifecycleHook=t.HooksInterface=t.StateWithoutFeatures=t.PermissionType=t.FeaturePermission=t.FeaturesAction=t.StaffMemberDetails=t.AppBridgeState=t.TransportDispatch=t.Dispatcher=void 0;var r=n(6);Object.defineProperty(t,"AppConfigV2",{enumerable:!0,get:function(){return r.AppConfigV2}}),Object.defineProperty(t,"MessageType",{enumerable:!0,get:function(){return r.MessageType}}),Object.defineProperty(t,"ClientApplication",{enumerable:!0,get:function(){return r.ClientApplication}});var o=n(6);Object.defineProperty(t,"Dispatcher",{enumerable:!0,get:function(){return o.Dispatcher}}),Object.defineProperty(t,"TransportDispatch",{enumerable:!0,get:function(){return o.TransportDispatch}}),Object.defineProperty(t,"AppBridgeState",{enumerable:!0,get:function(){return o.AppBridgeState}}),Object.defineProperty(t,"StaffMemberDetails",{enumerable:!0,get:function(){return o.StaffMemberDetails}}),Object.defineProperty(t,"FeaturesAction",{enume