UNPKG

@heymantle/polaris

Version:

Mantle's frontend component library

28 lines (24 loc) 49.6 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),n=require("@shopify/polaris");var Ze=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xe(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Qe={exports:{}};(function(r,l){(function(d,u){r.exports=u()})(Ze,function(){var d=1e3,u=6e4,E=36e5,v="millisecond",f="second",A="minute",m="hour",T="day",_="week",$="month",j="quarter",B="year",N="date",y="Invalid Date",b=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,C=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,x={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(h){var i=["th","st","nd","rd"],o=h%100;return"["+h+(i[(o-20)%10]||i[o]||i[0])+"]"}},L=function(h,i,o){var g=String(h);return!g||g.length>=i?h:""+Array(i+1-g.length).join(o)+h},I={s:L,z:function(h){var i=-h.utcOffset(),o=Math.abs(i),g=Math.floor(o/60),s=o%60;return(i<=0?"+":"-")+L(g,2,"0")+":"+L(s,2,"0")},m:function h(i,o){if(i.date()<o.date())return-h(o,i);var g=12*(o.year()-i.year())+(o.month()-i.month()),s=i.clone().add(g,$),w=o-s<0,P=i.clone().add(g+(w?-1:1),$);return+(-(g+(o-s)/(w?s-P:P-s))||0)},a:function(h){return h<0?Math.ceil(h)||0:Math.floor(h)},p:function(h){return{M:$,y:B,w:_,d:T,D:N,h:m,m:A,s:f,ms:v,Q:j}[h]||String(h||"").toLowerCase().replace(/s$/,"")},u:function(h){return h===void 0}},S="en",p={};p[S]=x;var D="$isDayjsObject",Z=function(h){return h instanceof oe||!(!h||!h[D])},q=function h(i,o,g){var s;if(!i)return S;if(typeof i=="string"){var w=i.toLowerCase();p[w]&&(s=w),o&&(p[w]=o,s=w);var P=i.split("-");if(!s&&P.length>1)return h(P[0])}else{var U=i.name;p[U]=i,s=U}return!g&&s&&(S=s),s||!g&&S},H=function(h,i){if(Z(h))return h.clone();var o=typeof i=="object"?i:{};return o.date=h,o.args=arguments,new oe(o)},Y=I;Y.l=q,Y.i=Z,Y.w=function(h,i){return H(h,{locale:i.$L,utc:i.$u,x:i.$x,$offset:i.$offset})};var oe=function(){function h(o){this.$L=q(o.locale,null,!0),this.parse(o),this.$x=this.$x||o.x||{},this[D]=!0}var i=h.prototype;return i.parse=function(o){this.$d=function(g){var s=g.date,w=g.utc;if(s===null)return new Date(NaN);if(Y.u(s))return new Date;if(s instanceof Date)return new Date(s);if(typeof s=="string"&&!/Z$/i.test(s)){var P=s.match(b);if(P){var U=P[2]-1||0,G=(P[7]||"0").substring(0,3);return w?new Date(Date.UTC(P[1],U,P[3]||1,P[4]||0,P[5]||0,P[6]||0,G)):new Date(P[1],U,P[3]||1,P[4]||0,P[5]||0,P[6]||0,G)}}return new Date(s)}(o),this.init()},i.init=function(){var o=this.$d;this.$y=o.getFullYear(),this.$M=o.getMonth(),this.$D=o.getDate(),this.$W=o.getDay(),this.$H=o.getHours(),this.$m=o.getMinutes(),this.$s=o.getSeconds(),this.$ms=o.getMilliseconds()},i.$utils=function(){return Y},i.isValid=function(){return this.$d.toString()!==y},i.isSame=function(o,g){var s=H(o);return this.startOf(g)<=s&&s<=this.endOf(g)},i.isAfter=function(o,g){return H(o)<this.startOf(g)},i.isBefore=function(o,g){return this.endOf(g)<H(o)},i.$g=function(o,g,s){return Y.u(o)?this[g]:this.set(s,o)},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this.$d.getTime()},i.startOf=function(o,g){var s=this,w=!!Y.u(g)||g,P=Y.p(o),U=function(le,Q){var se=Y.w(s.$u?Date.UTC(s.$y,Q,le):new Date(s.$y,Q,le),s);return w?se:se.endOf(T)},G=function(le,Q){return Y.w(s.toDate()[le].apply(s.toDate("s"),(w?[0,0,0,0]:[23,59,59,999]).slice(Q)),s)},J=this.$W,ee=this.$M,ne=this.$D,ie="set"+(this.$u?"UTC":"");switch(P){case B:return w?U(1,0):U(31,11);case $:return w?U(1,ee):U(0,ee+1);case _:var ae=this.$locale().weekStart||0,ce=(J<ae?J+7:J)-ae;return U(w?ne-ce:ne+(6-ce),ee);case T:case N:return G(ie+"Hours",0);case m:return G(ie+"Minutes",1);case A:return G(ie+"Seconds",2);case f:return G(ie+"Milliseconds",3);default:return this.clone()}},i.endOf=function(o){return this.startOf(o,!1)},i.$set=function(o,g){var s,w=Y.p(o),P="set"+(this.$u?"UTC":""),U=(s={},s[T]=P+"Date",s[N]=P+"Date",s[$]=P+"Month",s[B]=P+"FullYear",s[m]=P+"Hours",s[A]=P+"Minutes",s[f]=P+"Seconds",s[v]=P+"Milliseconds",s)[w],G=w===T?this.$D+(g-this.$W):g;if(w===$||w===B){var J=this.clone().set(N,1);J.$d[U](G),J.init(),this.$d=J.set(N,Math.min(this.$D,J.daysInMonth())).$d}else U&&this.$d[U](G);return this.init(),this},i.set=function(o,g){return this.clone().$set(o,g)},i.get=function(o){return this[Y.p(o)]()},i.add=function(o,g){var s,w=this;o=Number(o);var P=Y.p(g),U=function(ee){var ne=H(w);return Y.w(ne.date(ne.date()+Math.round(ee*o)),w)};if(P===$)return this.set($,this.$M+o);if(P===B)return this.set(B,this.$y+o);if(P===T)return U(1);if(P===_)return U(7);var G=(s={},s[A]=u,s[m]=E,s[f]=d,s)[P]||1,J=this.$d.getTime()+o*G;return Y.w(J,this)},i.subtract=function(o,g){return this.add(-1*o,g)},i.format=function(o){var g=this,s=this.$locale();if(!this.isValid())return s.invalidDate||y;var w=o||"YYYY-MM-DDTHH:mm:ssZ",P=Y.z(this),U=this.$H,G=this.$m,J=this.$M,ee=s.weekdays,ne=s.months,ie=s.meridiem,ae=function(Q,se,me,ve){return Q&&(Q[se]||Q(g,w))||me[se].slice(0,ve)},ce=function(Q){return Y.s(U%12||12,Q,"0")},le=ie||function(Q,se,me){var ve=Q<12?"AM":"PM";return me?ve.toLowerCase():ve};return w.replace(C,function(Q,se){return se||function(me){switch(me){case"YY":return String(g.$y).slice(-2);case"YYYY":return Y.s(g.$y,4,"0");case"M":return J+1;case"MM":return Y.s(J+1,2,"0");case"MMM":return ae(s.monthsShort,J,ne,3);case"MMMM":return ae(ne,J);case"D":return g.$D;case"DD":return Y.s(g.$D,2,"0");case"d":return String(g.$W);case"dd":return ae(s.weekdaysMin,g.$W,ee,2);case"ddd":return ae(s.weekdaysShort,g.$W,ee,3);case"dddd":return ee[g.$W];case"H":return String(U);case"HH":return Y.s(U,2,"0");case"h":return ce(1);case"hh":return ce(2);case"a":return le(U,G,!0);case"A":return le(U,G,!1);case"m":return String(G);case"mm":return Y.s(G,2,"0");case"s":return String(g.$s);case"ss":return Y.s(g.$s,2,"0");case"SSS":return Y.s(g.$ms,3,"0");case"Z":return P}return null}(Q)||P.replace(":","")})},i.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},i.diff=function(o,g,s){var w,P=this,U=Y.p(g),G=H(o),J=(G.utcOffset()-this.utcOffset())*u,ee=this-G,ne=function(){return Y.m(P,G)};switch(U){case B:w=ne()/12;break;case $:w=ne();break;case j:w=ne()/3;break;case _:w=(ee-J)/6048e5;break;case T:w=(ee-J)/864e5;break;case m:w=ee/E;break;case A:w=ee/u;break;case f:w=ee/d;break;default:w=ee}return s?w:Y.a(w)},i.daysInMonth=function(){return this.endOf($).$D},i.$locale=function(){return p[this.$L]},i.locale=function(o,g){if(!o)return this.$L;var s=this.clone(),w=q(o,g,!0);return w&&(s.$L=w),s},i.clone=function(){return Y.w(this.$d,this)},i.toDate=function(){return new Date(this.valueOf())},i.toJSON=function(){return this.isValid()?this.toISOString():null},i.toISOString=function(){return this.$d.toISOString()},i.toString=function(){return this.$d.toUTCString()},h}(),R=oe.prototype;return H.prototype=R,[["$ms",v],["$s",f],["$m",A],["$H",m],["$W",T],["$M",$],["$y",B],["$D",N]].forEach(function(h){R[h[1]]=function(i){return this.$g(i,h[0],h[1])}}),H.extend=function(h,i){return h.$i||(h(i,oe,H),h.$i=!0),H},H.locale=q,H.isDayjs=Z,H.unix=function(h){return H(1e3*h)},H.en=p[S],H.Ls=p,H.p={},H})})(Qe);var Tt=Qe.exports;const Te=Xe(Tt);var be={};/** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Je;function xt(){if(Je)return be;Je=1;var r=e,l=Symbol.for("react.element"),d=Symbol.for("react.fragment"),u=Object.prototype.hasOwnProperty,E=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,v={key:!0,ref:!0,__self:!0,__source:!0};function f(A,m,T){var _,$={},j=null,B=null;T!==void 0&&(j=""+T),m.key!==void 0&&(j=""+m.key),m.ref!==void 0&&(B=m.ref);for(_ in m)u.call(m,_)&&!v.hasOwnProperty(_)&&($[_]=m[_]);if(A&&A.defaultProps)for(_ in m=A.defaultProps,m)$[_]===void 0&&($[_]=m[_]);return{$$typeof:l,type:A,key:j,ref:B,props:$,_owner:E.current}}return be.Fragment=d,be.jsx=f,be.jsxs=f,be}var Se={};/** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Ke;function Dt(){return Ke||(Ke=1,process.env.NODE_ENV!=="production"&&function(){var r=e,l=Symbol.for("react.element"),d=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),A=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),B=Symbol.for("react.offscreen"),N=Symbol.iterator,y="@@iterator";function b(t){if(t===null||typeof t!="object")return null;var a=N&&t[N]||t[y];return typeof a=="function"?a:null}var C=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(t){{for(var a=arguments.length,c=new Array(a>1?a-1:0),k=1;k<a;k++)c[k-1]=arguments[k];L("error",t,c)}}function L(t,a,c){{var k=C.ReactDebugCurrentFrame,W=k.getStackAddendum();W!==""&&(a+="%s",c=c.concat([W]));var z=c.map(function(F){return String(F)});z.unshift("Warning: "+a),Function.prototype.apply.call(console[t],console,z)}}var I=!1,S=!1,p=!1,D=!1,Z=!1,q;q=Symbol.for("react.module.reference");function H(t){return!!(typeof t=="string"||typeof t=="function"||t===u||t===v||Z||t===E||t===T||t===_||D||t===B||I||S||p||typeof t=="object"&&t!==null&&(t.$$typeof===j||t.$$typeof===$||t.$$typeof===f||t.$$typeof===A||t.$$typeof===m||t.$$typeof===q||t.getModuleId!==void 0))}function Y(t,a,c){var k=t.displayName;if(k)return k;var W=a.displayName||a.name||"";return W!==""?c+"("+W+")":c}function oe(t){return t.displayName||"Context"}function R(t){if(t==null)return null;if(typeof t.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case u:return"Fragment";case d:return"Portal";case v:return"Profiler";case E:return"StrictMode";case T:return"Suspense";case _:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case A:var a=t;return oe(a)+".Consumer";case f:var c=t;return oe(c._context)+".Provider";case m:return Y(t,t.render,"ForwardRef");case $:var k=t.displayName||null;return k!==null?k:R(t.type)||"Memo";case j:{var W=t,z=W._payload,F=W._init;try{return R(F(z))}catch{return null}}}return null}var h=Object.assign,i=0,o,g,s,w,P,U,G;function J(){}J.__reactDisabledLog=!0;function ee(){{if(i===0){o=console.log,g=console.info,s=console.warn,w=console.error,P=console.group,U=console.groupCollapsed,G=console.groupEnd;var t={configurable:!0,enumerable:!0,value:J,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}i++}}function ne(){{if(i--,i===0){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:h({},t,{value:o}),info:h({},t,{value:g}),warn:h({},t,{value:s}),error:h({},t,{value:w}),group:h({},t,{value:P}),groupCollapsed:h({},t,{value:U}),groupEnd:h({},t,{value:G})})}i<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ie=C.ReactCurrentDispatcher,ae;function ce(t,a,c){{if(ae===void 0)try{throw Error()}catch(W){var k=W.stack.trim().match(/\n( *(at )?)/);ae=k&&k[1]||""}return` `+ae+t}}var le=!1,Q;{var se=typeof WeakMap=="function"?WeakMap:Map;Q=new se}function me(t,a){if(!t||le)return"";{var c=Q.get(t);if(c!==void 0)return c}var k;le=!0;var W=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var z;z=ie.current,ie.current=null,ee();try{if(a){var F=function(){throw Error()};if(Object.defineProperty(F.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(F,[])}catch(ue){k=ue}Reflect.construct(t,[],F)}else{try{F.call()}catch(ue){k=ue}t.call(F.prototype)}}else{try{throw Error()}catch(ue){k=ue}t()}}catch(ue){if(ue&&k&&typeof ue.stack=="string"){for(var O=ue.stack.split(` `),te=k.stack.split(` `),K=O.length-1,X=te.length-1;K>=1&&X>=0&&O[K]!==te[X];)X--;for(;K>=1&&X>=0;K--,X--)if(O[K]!==te[X]){if(K!==1||X!==1)do if(K--,X--,X<0||O[K]!==te[X]){var re=` `+O[K].replace(" at new "," at ");return t.displayName&&re.includes("<anonymous>")&&(re=re.replace("<anonymous>",t.displayName)),typeof t=="function"&&Q.set(t,re),re}while(K>=1&&X>=0);break}}}finally{le=!1,ie.current=z,ne(),Error.prepareStackTrace=W}var ye=t?t.displayName||t.name:"",qe=ye?ce(ye):"";return typeof t=="function"&&Q.set(t,qe),qe}function ve(t,a,c){return me(t,!1)}function lt(t){var a=t.prototype;return!!(a&&a.isReactComponent)}function Ce(t,a,c){if(t==null)return"";if(typeof t=="function")return me(t,lt(t));if(typeof t=="string")return ce(t);switch(t){case T:return ce("Suspense");case _:return ce("SuspenseList")}if(typeof t=="object")switch(t.$$typeof){case m:return ve(t.render);case $:return Ce(t.type,a,c);case j:{var k=t,W=k._payload,z=k._init;try{return Ce(z(W),a,c)}catch{}}}return""}var we=Object.prototype.hasOwnProperty,Le={},Ie=C.ReactDebugCurrentFrame;function Pe(t){if(t){var a=t._owner,c=Ce(t.type,t._source,a?a.type:null);Ie.setExtraStackFrame(c)}else Ie.setExtraStackFrame(null)}function ot(t,a,c,k,W){{var z=Function.call.bind(we);for(var F in t)if(z(t,F)){var O=void 0;try{if(typeof t[F]!="function"){var te=Error((k||"React class")+": "+c+" type `"+F+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof t[F]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw te.name="Invariant Violation",te}O=t[F](a,F,k,c,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(K){O=K}O&&!(O instanceof Error)&&(Pe(W),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",k||"React class",c,F,typeof O),Pe(null)),O instanceof Error&&!(O.message in Le)&&(Le[O.message]=!0,Pe(W),x("Failed %s type: %s",c,O.message),Pe(null))}}}var it=Array.isArray;function _e(t){return it(t)}function ct(t){{var a=typeof Symbol=="function"&&Symbol.toStringTag,c=a&&t[Symbol.toStringTag]||t.constructor.name||"Object";return c}}function st(t){try{return Ye(t),!1}catch{return!0}}function Ye(t){return""+t}function Fe(t){if(st(t))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ct(t)),Ye(t)}var pe=C.ReactCurrentOwner,ut={key:!0,ref:!0,__self:!0,__source:!0},je,Ne,$e;$e={};function dt(t){if(we.call(t,"ref")){var a=Object.getOwnPropertyDescriptor(t,"ref").get;if(a&&a.isReactWarning)return!1}return t.ref!==void 0}function ft(t){if(we.call(t,"key")){var a=Object.getOwnPropertyDescriptor(t,"key").get;if(a&&a.isReactWarning)return!1}return t.key!==void 0}function mt(t,a){if(typeof t.ref=="string"&&pe.current&&a&&pe.current.stateNode!==a){var c=R(pe.current.type);$e[c]||(x('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',R(pe.current.type),t.ref),$e[c]=!0)}}function gt(t,a){{var c=function(){je||(je=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",a))};c.isReactWarning=!0,Object.defineProperty(t,"key",{get:c,configurable:!0})}}function vt(t,a){{var c=function(){Ne||(Ne=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",a))};c.isReactWarning=!0,Object.defineProperty(t,"ref",{get:c,configurable:!0})}}var ht=function(t,a,c,k,W,z,F){var O={$$typeof:l,type:t,key:a,ref:c,props:F,_owner:z};return O._store={},Object.defineProperty(O._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(O,"_self",{configurable:!1,enumerable:!1,writable:!1,value:k}),Object.defineProperty(O,"_source",{configurable:!1,enumerable:!1,writable:!1,value:W}),Object.freeze&&(Object.freeze(O.props),Object.freeze(O)),O};function yt(t,a,c,k,W){{var z,F={},O=null,te=null;c!==void 0&&(Fe(c),O=""+c),ft(a)&&(Fe(a.key),O=""+a.key),dt(a)&&(te=a.ref,mt(a,W));for(z in a)we.call(a,z)&&!ut.hasOwnProperty(z)&&(F[z]=a[z]);if(t&&t.defaultProps){var K=t.defaultProps;for(z in K)F[z]===void 0&&(F[z]=K[z])}if(O||te){var X=typeof t=="function"?t.displayName||t.name||"Unknown":t;O&&gt(F,X),te&&vt(F,X)}return ht(t,O,te,W,k,pe.current,F)}}var Me=C.ReactCurrentOwner,We=C.ReactDebugCurrentFrame;function he(t){if(t){var a=t._owner,c=Ce(t.type,t._source,a?a.type:null);We.setExtraStackFrame(c)}else We.setExtraStackFrame(null)}var Ae;Ae=!1;function Be(t){return typeof t=="object"&&t!==null&&t.$$typeof===l}function He(){{if(Me.current){var t=R(Me.current.type);if(t)return` Check the render method of \``+t+"`."}return""}}function Et(t){{if(t!==void 0){var a=t.fileName.replace(/^.*[\\\/]/,""),c=t.lineNumber;return` Check your code at `+a+":"+c+"."}return""}}var Ue={};function pt(t){{var a=He();if(!a){var c=typeof t=="string"?t:t.displayName||t.name;c&&(a=` Check the top-level render call using <`+c+">.")}return a}}function ze(t,a){{if(!t._store||t._store.validated||t.key!=null)return;t._store.validated=!0;var c=pt(a);if(Ue[c])return;Ue[c]=!0;var k="";t&&t._owner&&t._owner!==Me.current&&(k=" It was passed a child from "+R(t._owner.type)+"."),he(t),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',c,k),he(null)}}function Ve(t,a){{if(typeof t!="object")return;if(_e(t))for(var c=0;c<t.length;c++){var k=t[c];Be(k)&&ze(k,a)}else if(Be(t))t._store&&(t._store.validated=!0);else if(t){var W=b(t);if(typeof W=="function"&&W!==t.entries)for(var z=W.call(t),F;!(F=z.next()).done;)Be(F.value)&&ze(F.value,a)}}}function bt(t){{var a=t.type;if(a==null||typeof a=="string")return;var c;if(typeof a=="function")c=a.propTypes;else if(typeof a=="object"&&(a.$$typeof===m||a.$$typeof===$))c=a.propTypes;else return;if(c){var k=R(a);ot(c,t.props,"prop",k,t)}else if(a.PropTypes!==void 0&&!Ae){Ae=!0;var W=R(a);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",W||"Unknown")}typeof a.getDefaultProps=="function"&&!a.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function St(t){{for(var a=Object.keys(t.props),c=0;c<a.length;c++){var k=a[c];if(k!=="children"&&k!=="key"){he(t),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",k),he(null);break}}t.ref!==null&&(he(t),x("Invalid attribute `ref` supplied to `React.Fragment`."),he(null))}}function Ge(t,a,c,k,W,z){{var F=H(t);if(!F){var O="";(t===void 0||typeof t=="object"&&t!==null&&Object.keys(t).length===0)&&(O+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var te=Et(W);te?O+=te:O+=He();var K;t===null?K="null":_e(t)?K="array":t!==void 0&&t.$$typeof===l?(K="<"+(R(t.type)||"Unknown")+" />",O=" Did you accidentally export a JSX literal instead of a component?"):K=typeof t,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",K,O)}var X=yt(t,a,c,W,z);if(X==null)return X;if(F){var re=a.children;if(re!==void 0)if(k)if(_e(re)){for(var ye=0;ye<re.length;ye++)Ve(re[ye],t);Object.freeze&&Object.freeze(re)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ve(re,t)}return t===u?St(X):bt(X),X}}function kt(t,a,c){return Ge(t,a,c,!0)}function Ct(t,a,c){return Ge(t,a,c,!1)}var wt=Ct,Pt=kt;Se.Fragment=u,Se.jsx=wt,Se.jsxs=Pt}()),Se}process.env.NODE_ENV==="production"?xt():Dt();const M={AmountPerInterval:"{{ amount }} per {{ interval }}",Back:"Back",Cancel:"Cancel",CancelConfirmation:"Are you sure you want to cancel your subscription?",CancelPlan:"Cancel plan",ChangePlan:"Change plan",CurrentPlan:"Current plan",CustomPlans:"Custom plans",CustomPlansDescription:"Plans tailored to your specific needs",DiscountAmount:"{{ amount }} discount",DiscountAmountExpired:"{{ amount }} discount expired",FreeTrialLength:"{{ trialDays }}-day free trial",Features:"Features",Month:"month",MonthShort:"mo",Monthly:"Monthly",NextBillingDate:"Next billing date",NotSubscribed:"You're not subscribed to a plan yet.",Year:"year",YearShort:"yr",Yearly:"Yearly",MostPopular:"Most popular",Per:"/",Plans:"Plans",Price:"Price",SelectPlan:"Select plan",SubscribeSuccessTitle:"Subscription successful",SubscribeSuccessBody:"Thanks for subscribing to our app!",Subscription:"Subscription",SubscriptionCancelled:"Subscription cancelled",UsageCharges:"Usage charges",loading:"Loading...",error:"An error occurred",retry:"Retry",cancel:"Cancel",continue:"Continue",subscribe:"Subscribe",subscribeNow:"Subscribe Now",upgradeNow:"Upgrade Now",manageSubscription:"Manage Subscription",cancelSubscription:"Cancel Subscription",addPaymentMethod:"Add Payment Method",updatePaymentMethod:"Update Payment Method",featureNotAvailable:"This feature is not available on your current plan",upgradeRequired:"Upgrade Required",limitReached:"Limit Reached"},$t=e.createContext(void 0),Mt=()=>{const r=e.useContext($t);if(r===void 0)throw new Error("useMantle must be used within a MantleProvider");return r},At=(r="USD")=>new Intl.NumberFormat("en-US",{style:"currency",currency:r,notation:"standard"}),fe=(r,l="USD",d=!0)=>{let u=At(l).format(r);return d&&(u=u.replace(/\.00$/,"")),u};var V=(r=>(r.Annual="ANNUAL",r.Every30Days="EVERY_30_DAYS",r))(V||{});const Bt=(r="EVERY_30_DAYS")=>{switch(r){case"ANNUAL":return"year";case"EVERY_30_DAYS":default:return"month"}},Rt=(r="EVERY_30_DAYS")=>{switch(r){case"ANNUAL":return"yr";case"EVERY_30_DAYS":default:return"mo"}},Ee=({interval:r="EVERY_30_DAYS",useShortFormPlanIntervals:l=!0})=>l?Rt(r):Bt(r),Re=({plan:r,customFieldKey:l="recommended"})=>{var d;return!!((d=r.customFields)!=null&&d[l])},Oe=({plan:r,customFieldKey:l="buttonLabel"})=>{var d;return((d=r.customFields)==null?void 0:d[l])||M.subscribe},et=({plan:r})=>{var l;return((l=r.discounts)==null?void 0:l.length)>0?r.discounts.reduce((d,u)=>d.discountedAmount<u.discountedAmount?d:u):void 0},Ot=(r=4)=>r%4===0?{xs:6,sm:6,md:2,lg:3,xl:3}:r%3===0?{xs:6,sm:6,md:2,lg:4,xl:4}:r%2===0?{xs:6,sm:6,md:3,lg:6,xl:6}:r===1?{xs:6,sm:6,md:6,lg:12,xl:12}:{xs:6,sm:6,md:2,lg:4,xl:4},Lt=(r=4)=>r%4===0?4:r%3===0?3:r%2===0?2:r===1?1:4,It=({orientation:r="horizontal",onShowPlans:l,onCancelPlan:d,onPlanCancelled:u=()=>{},cancelSubscription:E=async()=>{},i18n:v,subscription:f,refetch:A=async()=>{},apps:m=[]})=>e.createElement(n.Banner,{title:"Bundle and save!",tone:"success"},e.createElement(n.BlockStack,{gap:"400"},e.createElement(n.Text,null,"Save money on your subscription when you install these great apps."),e.createElement(n.BlockStack,{gap:"300"},m.map((T,_)=>e.createElement(n.BlockStack,{gap:"300"},e.createElement(n.InlineStack,{gap:"200",align:"space-between",blockAlign:"center"},e.createElement(n.InlineStack,{gap:"300"},e.createElement(n.Thumbnail,{source:T.iconUrl,alt:T.name,size:"small"}),e.createElement(n.BlockStack,null,e.createElement(n.Text,{variant:"headingSm"},T.name),e.createElement(n.Text,null,T.description))),e.createElement(n.InlineStack,{gap:"400"},e.createElement(n.Text,{tone:"subdued"},"20% off"),e.createElement(n.BlockStack,null,e.createElement(n.Button,null,v.Install)))),_<m.length-1&&e.createElement(n.Divider,null))))));var ge=function(l){return e.createElement("svg",Object.assign({viewBox:"0 0 20 20"},l),e.createElement("path",{fillRule:"evenodd",d:"M15.78 5.97a.75.75 0 0 1 0 1.06l-6.5 6.5a.75.75 0 0 1-1.06 0l-3.25-3.25a.75.75 0 1 1 1.06-1.06l2.72 2.72 5.97-5.97a.75.75 0 0 1 1.06 0Z"}))};ge.displayName="CheckIcon";var De=function(l){return e.createElement("svg",Object.assign({viewBox:"0 0 20 20"},l),e.createElement("path",{d:"M10.75 6.75a.75.75 0 0 0-1.5 0v2.5h-2.5a.75.75 0 0 0 0 1.5h2.5v2.5a.75.75 0 0 0 1.5 0v-2.5h2.5a.75.75 0 0 0 0-1.5h-2.5v-2.5Z"}))};De.displayName="PlusIcon";const Yt=({plan:r,t:l,translatePlanName:d,planNameTextVariant:u,planDescriptionTextVariant:E})=>e.createElement(n.BlockStack,{gap:"100"},e.createElement(n.Text,{variant:u,alignment:"center"},d?l(r.name):r.name),r.description&&e.createElement(n.Text,{variant:E,tone:"subdued",alignment:"center"},l(r.description))),Ft=({plan:r,discount:l,t:d,priceTextVariant:u,useShortFormPlanIntervals:E=!0,toggleYearlySubtitle:v=!1})=>e.createElement(n.BlockStack,{gap:"100"},!!l&&e.createElement(n.InlineStack,{align:"center",blockAlign:"center",gap:"200"},e.createElement(n.Text,{variant:u},fe(l.presentmentDiscountedAmount,r.presentmentCurrencyCode,!0)),e.createElement(n.Text,{variant:u,tone:"subdued",fontWeight:"medium",textDecorationLine:"line-through"},fe(r.presentmentAmount,r.presentmentCurrencyCode,!0)),e.createElement(n.Text,{variant:"bodyLg",tone:"subdued"},d(M.Per)," ",d(Ee({interval:r.interval,useShortFormPlanIntervals:E})))),!l&&e.createElement(n.InlineStack,{align:"center",blockAlign:"center",gap:"200"},e.createElement(n.Text,{alignment:"center",variant:u},fe(r.presentmentAmount,r.presentmentCurrencyCode,!0)),e.createElement(n.Text,{alignment:"center",variant:"bodyLg",tone:"subdued"},d(M.Per)," ",d(Ee({interval:r.interval,useShortFormPlanIntervals:E})))),r.usageCharges.length>0&&e.createElement(n.BlockStack,null,r.usageCharges.map((f,A)=>e.createElement(n.InlineStack,{key:`plan-usageCharge-${A}`,align:"center",gap:"100"},e.createElement(n.Box,null,e.createElement(n.Icon,{source:De,tone:"subdued"})),e.createElement(n.Text,{variant:"bodyLg"},d(f.terms))))),v&&e.createElement(n.Text,{variant:"bodyMd",tone:"subdued",alignment:"center"},"Billed yearly")),jt=({plan:r,t:l,trialDaysAsFeature:d=!1})=>e.createElement(n.BlockStack,{gap:"300"},d&&r.trialDays&&r.trialDays>0?e.createElement(n.InlineStack,{align:"center",blockAlign:"center",gap:"100"},e.createElement(n.Box,null,e.createElement(n.Icon,{source:ge,tone:"subdued"})),e.createElement(n.Text,null,l(M.FreeTrialLength).replace("{{ trialDays }}",r.trialDays))):null,r.featuresOrder.map((u,E)=>{const v=r.features[u];if((v.type!=="boolean"||v.value===!0)&&v.visible)return e.createElement(n.InlineStack,{key:`plan-feature-${E}`,align:"center",gap:"100"},e.createElement(n.Box,null,e.createElement(n.Icon,{source:ge,tone:"subdued"})),v.type==="boolean"?e.createElement(n.Text,null,l(v.name)):e.createElement(n.Text,null,v.value," ",l(v.name)))})),tt=({plan:r,discount:l,buttonLabel:d,onSelectPlan:u,useShortFormPlanIntervals:E=!0,trialDaysAsFeature:v=!1,expanded:f=!1,isActivePlan:A=!1,isRecommendedPlan:m=!1,isCustomPlan:T=!1,showRecommendedPlanBadge:_=!0,t:$,translatePlanName:j=!0,planNameTextVariant:B="headingMd",planDescriptionTextVariant:N="bodyLg",priceTextVariant:y="heading3xl",toggleYearlySubtitle:b=!1})=>{const[C,x]=e.useState(!1),L=$||(S=>S),I=async({plan:S,discount:p})=>{u?(x(!0),await u({plan:S,discount:p})!==!0&&x(!1)):console.log("No onSelectPlan callback provided")};return e.createElement(n.Box,{position:"relative",minHeight:"100%"},e.createElement(n.Box,{paddingBlock:f||m?void 0:"800",minHeight:"100%"},e.createElement(n.Box,{background:m||T?"bg-surface":"bg-surface-secondary",borderStyle:"solid",borderColor:"border",borderWidth:"025",paddingBlock:f||m?"1600":"800",paddingInline:"400",borderRadius:"200",minHeight:"calc(100% - calc(var(--p-space-800) * 2))"},e.createElement(n.BlockStack,{gap:"800"},e.createElement(n.BlockStack,{gap:"400"},e.createElement(Yt,{plan:r,t:L,translatePlanName:j,planNameTextVariant:B,planDescriptionTextVariant:N}),e.createElement(Ft,{plan:r,discount:l,useShortFormPlanIntervals:E,t:L,priceTextVariant:y,toggleYearlySubtitle:b})),e.createElement(n.Button,{size:"large",variant:m?"primary":"secondary",onClick:async()=>{await I({plan:r,discount:l})},disabled:A,loading:C},L(d||M.SelectPlan)),e.createElement(jt,{plan:r,t:L,trialDaysAsFeature:v}),m&&_&&e.createElement(n.InlineStack,{align:"center",gap:"100"},e.createElement(n.Badge,{tone:"success"},L(M.MostPopular)))))))},de={Highlighted:"highlighted",Horizontal:"horizontal",Vertical:"vertical"},ke=({plans:r,customer:l,onSelectPlan:d,planInterval:u,cardType:E=de.Horizontal,trialDaysAsFeature:v=!0,useShortFormPlanIntervals:f=!0,keyForRecommended:A="recommended",keyForCustomButtonLabel:m="buttonLabel",showRecommendedPlanBadge:T=!0,applyDiscount:_=!0,t:$,translatePlanName:j=!0,toggleYearlySubtitle:B=!1})=>{var I;const N=(I=l==null?void 0:l.subscription)!=null&&I.active?l.subscription:void 0,y=N==null?void 0:N.plan,b=u?r.filter(S=>S.interval===u):r,C=E===de.Vertical?1:Lt(b.length),x=Ot(C),L=$||(S=>S);return e.createElement(n.Grid,{columns:C},b.map(S=>{const p=_?et({plan:S}):void 0,D=(y==null?void 0:y.id)===S.id&&!(N!=null&&N.cancelOn);return e.createElement(n.Grid.Cell,{columnSpan:x,key:S.id},E===de.Highlighted&&e.createElement(tt,{key:`HighlightedPlanCard-${S.id}`,plan:S,discount:p,onSelectPlan:d,isActivePlan:D,trialDaysAsFeature:v,useShortFormPlanIntervals:f,isCustomPlan:S.availability!=="public",isRecommendedPlan:Re({plan:S,customFieldKey:A}),buttonLabel:Oe({plan:S,customFieldKey:m}),showRecommendedPlanBadge:T,toggleYearlySubtitle:B,t:L,translatePlanName:j}),E===de.Horizontal&&e.createElement(nt,{key:`HorizontalPlanCard-${S.id}`,plan:S,discount:p,onSelectPlan:d,isActivePlan:D,trialDaysAsFeature:v,useShortFormPlanIntervals:f,isRecommendedPlan:Re({plan:S,customFieldKey:A}),buttonLabel:Oe({plan:S,customFieldKey:m}),showRecommendedPlanBadge:T,toggleYearlySubtitle:B,t:L,translatePlanName:j}))}))},Nt=({customer:r,plans:l,onSubscribe:d,backUrl:u="",showRecommendedBadge:E=!0,customFieldCta:v,customFieldPlanRecommended:f="Recommended",showPlanIntervalToggle:A=!0,showTrialDaysAsFeature:m=!0,useShortFormPlanIntervals:T,pageWidth:_="default",showCustomPlans:$=!0,toggleYearlySubtitle:j=!1})=>{const B=r==null?void 0:r.subscription,N=new URLSearchParams(window.location.search),y=l.some(D=>D.interval===V.Annual)&&l.some(D=>D.interval===V.Every30Days),b=l.find(D=>D.id===(B==null?void 0:B.plan.id)),[C,x]=e.useState(b?b.interval:y?V.Annual:V.Every30Days),L=l.filter(D=>D.availability==="public"),I=$?l.filter(D=>D.availability!=="public"):[],[S,p]=e.useState(N.get("subscribed")==="true");return e.createElement(n.Page,{title:M.Plans,backAction:u?{content:M.Back,url:u}:void 0,secondaryActions:A&&y?e.createElement(n.ButtonGroup,{variant:"segmented"},e.createElement(n.Button,{pressed:C===V.Every30Days,onClick:()=>x(V.Every30Days)},M.Monthly),e.createElement(n.Button,{pressed:C===V.Annual,onClick:()=>x(V.Annual)},M.Yearly)):void 0,fullWidth:_==="full",narrowWidth:_==="narrow"},e.createElement(n.Layout,null,e.createElement(n.Layout.Section,null,e.createElement(n.BlockStack,{gap:"1000"},S&&e.createElement(n.Banner,{tone:"success",title:M.SubscribeSuccessTitle,onDismiss:()=>{p(!1),window.history.replaceState({},document.title,window.location.pathname)}},M.SubscribeSuccessBody),e.createElement(ke,{plans:L,onSelectPlan:d,planInterval:C,cardType:de.Horizontal,keyForRecommended:f,keyForCustomButtonLabel:v,trialDaysAsFeature:m,useShortFormPlanIntervals:T,showRecommendedPlanBadge:E,toggleYearlySubtitle:j}),(I==null?void 0:I.length)>0&&e.createElement(n.Divider,{borderColor:"border"}),(I==null?void 0:I.length)>0&&e.createElement(n.BlockStack,{gap:"300"},e.createElement(n.Box,{paddingInline:{xs:400,sm:0}},e.createElement(n.Text,{variant:"headingMd"},M.CustomPlans)),e.createElement(ke,{plans:I,onSelectPlan:d,planInterval:C,cardType:de.Horizontal,keyForRecommended:f,keyForCustomButtonLabel:v,trialDaysAsFeature:m,useShortFormPlanIntervals:T,showRecommendedPlanBadge:E}))))))},Wt=({plan:r,t:l,translatePlanName:d,isRecommendedPlan:u=!1,planNameTextVariant:E,planDescriptionTextVariant:v,showRecommendedPlanBadge:f})=>e.createElement(n.BlockStack,{gap:"100"},e.createElement(n.InlineStack,{align:"space-between",gap:"100"},e.createElement(n.Text,{variant:E},d?l(r.name):r.name),u&&f&&e.createElement(n.Badge,{tone:"success"},l(M.MostPopular))),r.description&&e.createElement(n.Text,{variant:v,tone:"subdued"},l(r.description))),Ht=({plan:r,discount:l,t:d,useShortFormPlanIntervals:u=!0,priceTextVariant:E,toggleYearlySubtitle:v=!1})=>e.createElement(n.BlockStack,null,l?e.createElement(n.InlineStack,{blockAlign:"center",gap:"200"},e.createElement(n.Text,{variant:E},fe(l.presentmentDiscountedAmount,r.presentmentCurrencyCode)),e.createElement(n.Text,{variant:E,tone:"subdued",fontWeight:"medium",textDecorationLine:"line-through"},r.presentmentAmount),e.createElement(n.Text,{variant:"bodyLg",tone:"subdued"},M.Per," ",Ee({interval:r.interval,useShortFormPlanIntervals:u}))):e.createElement(n.InlineStack,{blockAlign:"center",gap:"200"},e.createElement(n.Text,{alignment:"center",variant:E},fe(r.presentmentAmount,r.presentmentCurrencyCode)),e.createElement(n.Text,{alignment:"center",variant:"bodyLg",tone:"subdued"},M.Per," ",Ee({interval:r.interval,useShortFormPlanIntervals:u}))),r.usageCharges&&r.usageCharges.length>0&&e.createElement(n.BlockStack,null,r.usageCharges.map((f,A)=>e.createElement(n.InlineStack,{key:`plan-usageCharge-${A}`,align:"start",gap:"100"},e.createElement(n.Box,null,e.createElement(n.Icon,{source:De,tone:"subdued"})),e.createElement(n.Text,{variant:"bodyLg"},d(f.terms))))),v&&e.createElement(n.Text,{variant:"bodyMd",tone:"subdued",alignment:"left"},"Billed yearly")),Ut=({plan:r,t:l,trialDaysAsFeature:d=!1})=>e.createElement(n.BlockStack,{gap:"100"},d&&r.trialDays&&r.trialDays>0?e.createElement(n.InlineStack,{align:"start",gap:"100"},e.createElement(n.Box,null,e.createElement(n.Icon,{source:ge,tone:"subdued"})),e.createElement(n.Text,null,l(M.FreeTrialLength).replace("{{ trialDays }}",r.trialDays))):null,r.featuresOrder.map((u,E)=>{const v=r.features[u];if((v.type!=="boolean"||v.value===!0)&&v.visible)return e.createElement(n.InlineStack,{key:`plan-feature-${E}`,align:"start",gap:"100",wrap:!1},e.createElement(n.Box,null,e.createElement(n.Icon,{source:ge,tone:"subdued"})),v.type==="boolean"?e.createElement(n.Text,null,l(v.name)):e.createElement(n.Text,null,v.value," ",l(v.name)))})),nt=({plan:r,discount:l,buttonLabel:d,onSelectPlan:u,useShortFormPlanIntervals:E=!0,trialDaysAsFeature:v=!1,isRecommendedPlan:f=!1,isActivePlan:A=!1,t:m,translatePlanName:T=!0,showRecommendedPlanBadge:_=!0,planNameTextVariant:$="bodyLg",planDescriptionTextVariant:j="bodyMd",priceTextVariant:B="headingXl",toggleYearlySubtitle:N=!1})=>{const[y,b]=e.useState(!1),C=m||(L=>L),x=async({plan:L,discount:I})=>{u?(b(!0),await u({plan:L,discount:I})!==!0&&b(!1)):console.log("No onSelectPlan callback provided")};return e.createElement(n.Card,null,e.createElement(n.BlockStack,{gap:"400"},e.createElement(Wt,{plan:r,isRecommendedPlan:f,showRecommendedPlanBadge:_,t:C,translatePlanName:T,planNameTextVariant:$,planDescriptionTextVariant:j}),e.createElement(Ht,{plan:r,discount:l,useShortFormPlanIntervals:E,t:C,priceTextVariant:B,toggleYearlySubtitle:N}),e.createElement(n.Button,{size:"large",variant:f?"primary":"secondary",onClick:async()=>{await x({plan:r,discount:l})},disabled:A,loading:y},C(A?M.CurrentPlan:d||M.SelectPlan)),e.createElement(Ut,{plan:r,trialDaysAsFeature:v,t:C})))},zt=({customer:r,plans:l,onSubscribe:d,backUrl:u="",showRecommendedBadge:E=!0,customFieldCta:v=null,customFieldPlanRecommended:f="Recommended",showPlanIntervalToggle:A=!0,showTrialDaysAsFeature:m=!0,useShortFormPlanIntervals:T=!0,pageWidth:_="default",showCustomPlans:$=!0,toggleYearlySubtitle:j=!1})=>{const B=r==null?void 0:r.subscription,N=new URLSearchParams(window.location.search),y=l.some(D=>D.interval===V.Annual)&&l.some(D=>D.interval===V.Every30Days),b=l.find(D=>D.id===(B==null?void 0:B.plan.id)),[C,x]=e.useState(b?b.interval:y?V.Annual:V.Every30Days),L=l.filter(D=>D.availability==="public"),I=$?l.filter(D=>D.availability!=="public"):[],[S,p]=e.useState(N.get("subscribed")==="true");return e.createElement(n.Page,{title:M.Plans,backAction:u&&u!==""?{content:M.Back,url:u}:void 0,secondaryActions:A&&y?e.createElement(n.ButtonGroup,{variant:"segmented"},e.createElement(n.Button,{pressed:C===V.Every30Days,onClick:()=>x(V.Every30Days)},M.Monthly),e.createElement(n.Button,{pressed:C===V.Annual,onClick:()=>x(V.Annual)},M.Yearly)):void 0,fullWidth:_==="full",narrowWidth:_==="narrow"},e.createElement(n.Box,{paddingBlockEnd:"800"},e.createElement(n.Layout,null,e.createElement(n.Layout.Section,null,e.createElement(n.BlockStack,{gap:"1000"},S&&e.createElement(n.Banner,{tone:"success",title:M.SubscribeSuccessTitle,onDismiss:()=>{p(!1),window.history.replaceState({},document.title,window.location.pathname)}},M.SubscribeSuccessBody),e.createElement(ke,{plans:L,onSelectPlan:d,planInterval:C,cardType:de.Highlighted,keyForRecommended:f,keyForCustomButtonLabel:v,trialDaysAsFeature:m,useShortFormPlanIntervals:T,showRecommendedPlanBadge:E,toggleYearlySubtitle:j}),(I==null?void 0:I.length)>0&&e.createElement(n.Divider,{borderColor:"border"}),(I==null?void 0:I.length)>0&&e.createElement(n.BlockStack,{gap:"300"},e.createElement(n.Box,{paddingInline:{xs:400,sm:0}},e.createElement(n.Text,{variant:"headingMd"},M.CustomPlans)),e.createElement(ke,{plans:I,onSelectPlan:d,planInterval:C,cardType:de.Highlighted,keyForRecommended:f,keyForCustomButtonLabel:v,trialDaysAsFeature:m,useShortFormPlanIntervals:T,showRecommendedPlanBadge:E})))))))},rt=({plan:r,discount:l,buttonLabel:d,onSelectPlan:u,useShortFormPlanIntervals:E=!0,trialDaysAsFeature:v=!1,isRecommendedPlan:f=!1,isActivePlan:A=!1,t:m=_t,translatePlanName:T=!0,showRecommendedPlanBadge:_=!0,planNameTextVariant:$="bodyLg",planDescriptionTextVariant:j="bodyMd",priceTextVariant:B="headingXl",toggleYearlySubtitle:N=!1})=>{const[y,b]=e.useState(!1),C=async({plan:p,discount:D})=>{u?(b(!0),await u({plan:p,discount:D})!==!0&&b(!1)):console.log("No onSelectPlan callback provided")},x=({plan:p})=>e.createElement(n.BlockStack,null,e.createElement(n.Text,{variant:$},T?m(p.name):p.name),p.description&&e.createElement(n.Text,{variant:j,tone:"subdued"},m(p.description))),L=({plan:p})=>e.createElement(n.BlockStack,{gap:"200"},e.createElement(n.Text,{fontWeight:"medium"},m(M.Features)),e.createElement(n.BlockStack,{gap:"100"},v&&p.trialDays&&p.trialDays>0?e.createElement(n.InlineStack,{align:"start",gap:"100"},e.createElement(n.Box,null,e.createElement(n.Icon,{source:ge,tone:"positive"})),e.createElement(n.Text,{tone:"subdued"},m(M.FreeTrialLength.replace("{{ trialDays }}",p.trialDays)))):null,p.featuresOrder.map((D,Z)=>{const q=p.features[D];if((q.type!=="boolean"||q.value===!0)&&q.visible)return e.createElement(n.InlineStack,{key:`plan-feature-${Z}`,align:"start",gap:"100"},e.createElement(n.Box,null,e.createElement(n.Icon,{source:ge,tone:"positive"})),q.type==="boolean"?e.createElement(n.Text,{tone:"subdued"},q.name):e.createElement(n.Text,{tone:"subdued"},q.value," ",q.name))}))),I=({plan:p,discount:D,toggleYearlySubtitle:Z})=>e.createElement(n.BlockStack,{gap:"100"},D?e.createElement(n.InlineStack,{blockAlign:"center",gap:"200"},e.createElement(n.Text,{variant:B},fe(D.presentmentDiscountedAmount,p.presentmentCurrencyCode)),e.createElement(n.Text,{variant:B,tone:"subdued",fontWeight:"medium",textDecorationLine:"line-through"},p.presentmentAmount),e.createElement(n.Text,{variant:"bodyLg",tone:"subdued"},M.Per," ",Ee({interval:p.interval,useShortFormPlanIntervals:E}))):e.createElement(n.InlineStack,{blockAlign:"center",gap:"200"},e.createElement(n.Text,{alignment:"center",variant:B},fe(p.presentmentAmount,p.presentmentCurrencyCode)),e.createElement(n.Text,{alignment:"center",variant:"bodyLg",tone:"subdued"},M.Per," ",Ee({interval:p.interval,useShortFormPlanIntervals:E}))),p.usageCharges.length>0&&e.createElement(n.BlockStack,null,p.usageCharges.map((q,H)=>e.createElement(n.InlineStack,{key:`plan-usageCharge-${H}`,align:"start",gap:"100"},e.createElement(n.Box,null,e.createElement(n.Icon,{source:De,tone:"positive"})),e.createElement(n.Text,{variant:"bodyLg"},q.terms)))),Z&&e.createElement(n.Text,{variant:"bodyMd",tone:"subdued",alignment:"left"},"Billed yearly")),S=({plan:p,discount:D})=>e.createElement(n.InlineStack,{blockAlign:"center",gap:"400"},e.createElement(n.Button,{size:"large",variant:f?"primary":"secondary",onClick:async()=>{await C({plan:p,discount:D})},disabled:A,loading:y},m(A?M.CurrentPlan:d||M.SelectPlan)),f&&_&&e.createElement(n.Badge,{tone:"success"},m(M.MostPopular)));return e.createElement(n.Card,null,e.createElement(n.Grid,null,e.createElement(n.Grid.Cell,{columnSpan:{xs:6,sm:6,md:3,lg:6,xl:6}},e.createElement(n.BlockStack,{gap:"300"},x({plan:r}),I({plan:r,discount:l,toggleYearlySubtitle:N}),e.createElement(n.Box,null,S({plan:r,discount:l})))),e.createElement(n.Grid.Cell,{columnSpan:{xs:6,sm:6,md:3,lg:6,xl:6}},L({plan:r}))))},Vt=({plans:r,customer:l,onSubscribe:d,backUrl:u="",keyForRecommended:E="recommended",keyForCustomButtonLabel:v="buttonLabel",showPlanIntervalToggle:f=!1,trialDaysAsFeature:A=!0,useShortFormPlanIntervals:m=!0,pageWidth:T="default",showCustomPlans:_=!0,showRecommendedPlanBadge:$=!0,applyDiscount:j=!0,t:B,translatePlanName:N=!0,toggleYearlySubtitle:y=!1})=>{var oe;const b=new URLSearchParams(window.location.search),C=r.some(R=>R.interval===V.Annual)&&r.some(R=>R.interval===V.Every30Days),x=(oe=l==null?void 0:l.subscription)!=null&&oe.active?l.subscription:void 0,L=x==null?void 0:x.plan,[I,S]=e.useState(L?L.interval:C?V.Annual:V.Every30Days),p=r.filter(R=>R.availability!=="customerTag"&&R.availability!=="customer"),D=f&&C?p.filter(R=>R.interval===I):p,Z=_?r.filter(R=>R.availability==="customerTag"||R.availability==="customer"):[],[q,H]=e.useState(b.get("subscribed")==="true"),Y=B||(R=>R);return e.createElement(n.Page,{title:M.Plans,backAction:u!==""?{content:M.Back,url:u}:void 0,secondaryActions:f&&C?e.createElement(n.ButtonGroup,{variant:"segmented"},e.createElement(n.Button,{pressed:I===V.Every30Days,onClick:()=>S(V.Every30Days)},M.Monthly),e.createElement(n.Button,{pressed:I===V.Annual,onClick:()=>S(V.Annual)},M.Year)):void 0,fullWidth:T==="full",narrowWidth:T==="narrow"},e.createElement(n.Layout,null,e.createElement(n.Layout.Section,null,e.createElement(n.BlockStack,{gap:"400"},q&&e.createElement(n.Banner,{tone:"success",title:M.SubscribeSuccessTitle,onDismiss:()=>{H(!1),window.history.replaceState({},document.title,window.location.pathname)}},M.SubscribeSuccessBody),D.map((R,h)=>{const i=j?et({plan:R}):void 0,o=(L==null?void 0:L.id)===R.id&&!(x!=null&&x.cancelOn);return e.createElement(rt,{key:`plan-${h}`,plan:R,discount:i,onSelectPlan:d,isActivePlan:o,trialDaysAsFeature:A,useShortFormPlanIntervals:m,isCustomPlan:R.availability!=="public",isRecommendedPlan:Re({plan:R,customFieldKey:E}),buttonLabel:Oe({plan:R,customFieldKey:v}),showRecommendedPlanBadge:$,t:Y,translatePlanName:N,toggleYearlySubtitle:y})}),(Z==null?void 0:Z.length)>0&&e.createElement(n.Divider,{borderColor:"border"}),(Z==null?void 0:Z.length)>0&&e.createElement(n.BlockStack,{gap:"300"},e.createElement(n.Box,{paddingInline:{xs:400,sm:0}},e.createElement(n.Text,{variant:"headingMd"},M.CustomPlans)),e.createElement(n.Grid,null,Z.map((R,h)=>{var o;const i=((o=R.discounts)==null?void 0:o.length)>0?R.discounts.reduce((g,s)=>g.discountedAmount<s.discountedAmount?g:s):null;return e.createElement(n.Grid.Cell,{key:`custom-plan-${h}`,columnSpan:columnSpan()},e.createElement(n.Card,null,e.createElement(n.BlockStack,{gap:"400"},titleComponent({plan:R,discount:i}),pricingComponent({plan:R,discount:i,toggleYearlySubtitle:y}),ctaComponent({plan:R,discount:i}),featuresComponent({plan:R,discount:i}))))})))))))};var at={exports:{}};(function(r,l){(function(d,u){r.exports=u()})(Ze,function(){var d={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(u,E,v){var f=E.prototype,A=f.format;v.en.formats=d,f.format=function(m){m===void 0&&(m="YYYY-MM-DDTHH:mm:ssZ");var T=this.$locale().formats,_=function($,j){return $.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(B,N,y){var b=y&&y.toUpperCase();return N||j[y]||d[y]||j[b].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(C,x,L){return x||L.slice(1)})})}(m,T===void 0?{}:T);return A.call(this,_)}}})})(at);var Gt=at.exports;const qt=Xe(Gt);Te.extend(qt);const xe=({orientation:r="horizontal",onShowPlans:l,onCancelPlan:d,onPlanCancelled:u=()=>{},cancelSubscription:E=async()=>{},i18n:v,subscription:f,refetch:A=async()=>{},t:m,translatePlanName:T=!0,hideSelectPlanButton:_=!1})=>{var q;const[$,j]=e.useState(!1),[B,N]=e.useState(!1),y=m||(H=>H),b={...M,...v||{}};if(!f)return e.createElement(n.Card,null,e.createElement(n.BlockStack,{gap:"200"},e.createElement(n.Text,{variant:"headingMd"},y(b.Subscription)),e.createElement(n.Text,null,y(b.NotSubscribed)),e.createElement(n.InlineStack,{align:"end"},e.createElement(n.ButtonGroup,null,!_&&e.createElement(n.Button,{variant:"primary",onClick:l,accessibilityLabel:y(b.ChangePlan)},y(b.SelectPlan))))));const{plan:C}=f,x=fe(f.presentmentTotal,C.presentmentCurrencyCode),L=y(C.interval===V.Annual?b.Year:b.Month),I=r==="horizontal"?n.InlineGrid:n.BlockStack,S=(q=f==null?void 0:f.appliedDiscount)==null?void 0:q.discount,p=S?S.percentage?`${S.percentage}%`:fe(S.presentmentAmount,C.presentmentCurrencyCode):null,D=S&&f.appliedDiscount.discountEndsAt&&Te().isAfter(Te(f.appliedDiscount.discountEndsAt)),Z=C.usageCharges.length>0?{xs:1,md:3}:{xs:1,md:2};return e.createElement(n.Card,null,e.createElement(n.BlockStack,{gap:"200"},e.createElement(n.Text,{variant:"headingMd"},y(b.Subscription)),e.createElement(n.BlockStack,{gap:"400"},e.createElement(I,{columns:Z,gap:"300"},e.createElement(n.BlockStack,null,e.createElement(n.Text,null,y(b.CurrentPlan)),e.createElement(n.Text,{tone:"subdued"},T?y(C.name):C.name),f.cancelOn&&e.createElement(n.Text,{tone:"subdued"},y("Canceled, active until {{ date }}").replace("{{ date }}",Te(f.cancelOn).format("LL")))),e.createElement(n.BlockStack,null,e.createElement(n.Text,null,y(b.Price)),e.createElement(n.BlockStack,null,e.createElement(n.Text,{tone:"subdued"},y(b.AmountPerInterval).replace("{{ amount }}",x).replace("{{ interval }}",L)),S&&!D&&e.createElement(n.Text,{tone:"success"},y(b.DiscountAmount).replace("{{ amount }}",p)),S&&D&&e.createElement(n.Text,{tone:"subdued",textDecorationLine:"line-through"},y(b.DiscountAmountExpired).replace("{{ amount }}",p)))),C.usageCharges.length>0&&e.createElement(n.BlockStack,null,e.createElement(n.Text,null,y(b.UsageCharges||"Usage charges")),C.usageCharges.map((H,Y)=>e.createElement(n.Text,{key:`usage-charge-${Y}`,tone:"subdued"},y(H.terms))))),e.createElement(n.InlineStack,{align:"end"},e.createElement(n.ButtonGroup,null,e.createElement(n.Button,{onClick:()=>{d?d():j(!0)},accessibilityLabel:y(b.CancelPlan),tone:"critical",disabled:!!f.cancelOn},y(b.CancelPlan)),!_&&e.createElement(n.Button,{variant:"primary",onClick:l,accessibilityLabel:y(b.ChangePlan)},y(b.ChangePlan)))))),$&&e.createElement(n.Modal,{open:!0,onClose:()=>j(!1),title:y(b.CancelPlan),primaryAction:{content:y(b.CancelPlan),destructive:!0,loading:B,disabled:B,onAction:async()=>{N(!0),await E(),await A(),N(!1),j(!1),u()}},secondaryActions:[{content:y(b.Back),disabled:B,onAction:()=>j(!1)}]},e.createElement(n.Modal.Section,null,y(b.CancelConfirmation))))},Jt=({backUrl:r="",pageWidth:l="narrow"})=>{const{cancelSubscription:d,i18n:u,subscription:E,refetch:v}=Mt(),f=()=>{console.log("Show plans. Navigate to the plans page, open a modal, etc.")};return e.createElement(n.Page,{title:u.Subscription,backAction:r?{content:u.Back,url:r}:void 0,fullWidth:l==="full",narrowWidth:l==="narrow"},e.createElement(n.BlockStack,{gap:"400"},e.createElement(xe,{onShowPlans:f,cancelSubscription:d,i18n:u,subscription:E,refetch:v}),e.createElement(n.Layout,null,e.createElement(n.Layout.Section,null,e.createElement(xe,{onShowPlans:f,cancelSubscription:d,i18n:u,subscription:E,refetch:v})),e.createElement(n.Layout.Section,{variant:"oneThird"},e.createElement(xe,{onShowPlans:f,cancelSubscription:d,i18n:u,subscription:E,refetch:v,orientation:"vertical"})))))};exports.BundleCard=It;exports.HighlightedPlanCard=tt;exports.HighlightedPlanCards=zt;exports.HorizontalPlanCard=nt;exports.HorizontalPlanCards=Nt;exports.PlanCardStack=ke;exports.PlanCardType=de;exports.SubscriptionSummaryCard=xe;exports.SubscriptionSummaryPage=Jt;exports.VerticalPlanCard=rt;exports.VerticalPlanCards=Vt;