@pitcher/js-api 1.30.0 → 1.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/js-api.esm.js +80 -17
  2. package/js-api.esm.js.map +1 -1
  3. package/js-api.umd.min.js +15 -15
  4. package/js-api.umd.min.js.map +1 -1
  5. package/lib/apps/browser/components/ContextMenu/TranslateFileButton.test.d.ts +1 -0
  6. package/lib/apps/browser/stores/api.filesFoldersDeleter.test.d.ts +1 -0
  7. package/lib/apps/canvas-builder/components/container/PopupApps/PopupAppModal.spec.d.ts +1 -0
  8. package/lib/apps/canvas-builder/components/container/PresentationTools/PresentationToolsButtons.spec.d.ts +1 -0
  9. package/lib/apps/canvas-builder/components/ui/BottomSheetModal/BottomSheetModal.integration.spec.d.ts +1 -0
  10. package/lib/apps/canvas-builder/components/ui/BottomSheetModal/BottomSheetModal.spec.d.ts +1 -0
  11. package/lib/apps/canvas-builder/components/ui/DynamicContent/section-component-bindings.util.d.ts +32 -0
  12. package/lib/apps/canvas-builder/components/ui/DynamicContent/useDynamicContent.d.ts +4 -0
  13. package/lib/apps/canvas-builder/components/ui/Link/Link.util.d.ts +8 -1
  14. package/lib/apps/canvas-builder/components/ui/Link/Link.util.test.d.ts +1 -0
  15. package/lib/apps/canvas-builder/components/ui/SectionList/SectionItemModal.spec.d.ts +1 -0
  16. package/lib/apps/canvas-builder/composables/useCanvas.d.ts +83 -9
  17. package/lib/apps/canvas-builder/composables/useCanvasBlocks.d.ts +4 -2
  18. package/lib/apps/canvas-builder/composables/useCanvasHistory.d.ts +2 -2
  19. package/lib/apps/canvas-builder/composables/useCanvasTheme.d.ts +2 -2
  20. package/lib/apps/canvas-builder/composables/useNavigatorDrawer.d.ts +25 -0
  21. package/lib/apps/canvas-builder/composables/useNavigatorDrawer.spec.d.ts +1 -0
  22. package/lib/apps/canvas-builder/composables/usePopupApps.d.ts +41 -4
  23. package/lib/apps/canvas-builder/composables/usePopupApps.spec.d.ts +1 -0
  24. package/lib/apps/canvas-builder/composables/usePresentationTools.d.ts +112 -0
  25. package/lib/apps/canvas-builder/composables/usePresentationTools.spec.d.ts +1 -0
  26. package/lib/apps/canvas-builder/types/canvas.d.ts +13 -0
  27. package/lib/apps/canvas-builder/util/canvas.util.d.ts +12 -0
  28. package/lib/apps/canvas-builder/util/completionWizard.util.d.ts +251 -11
  29. package/lib/apps/canvas-builder/util/iframe.util.d.ts +24 -2
  30. package/lib/apps/canvas-builder/util/iframe.util.test.d.ts +1 -0
  31. package/lib/apps/canvas-selector/stores/app.d.ts +14 -0
  32. package/lib/apps/collection-player/components/AppHeader.spec.d.ts +1 -0
  33. package/lib/apps/collection-player/composables/speaker-notes.use.d.ts +14 -0
  34. package/lib/apps/collection-player/composables/speaker-notes.use.spec.d.ts +1 -0
  35. package/lib/apps/collection-player/stores/app.store.d.ts +5 -1
  36. package/lib/apps/collection-player/stores/showNotesToggle.spec.d.ts +1 -0
  37. package/lib/apps/content-selector/appTypes.d.ts +16 -0
  38. package/lib/apps/content-selector/components/Content/AllContent/List/expandFileGuard.spec.d.ts +1 -0
  39. package/lib/apps/notes/NotesApp.accountNotes.spec.d.ts +1 -0
  40. package/lib/apps/notes/NotesApp.speakerNotes.spec.d.ts +1 -0
  41. package/lib/apps/notes/composables/useAccountNotes.d.ts +14 -0
  42. package/lib/apps/notes/composables/useAccountNotes.spec.d.ts +1 -0
  43. package/lib/apps/notes/composables/useAccountOnlyNotesGate.d.ts +21 -0
  44. package/lib/apps/notes/composables/useAccountOnlyNotesGate.spec.d.ts +1 -0
  45. package/lib/apps/notes/composables/useActiveSlideNotes.d.ts +42 -0
  46. package/lib/apps/notes/composables/useActiveSlideNotes.spec.d.ts +1 -0
  47. package/lib/components/CFileAccessManagement/collaborationApi.d.ts +2 -0
  48. package/lib/components/CFilePanel/Details.spec.d.ts +1 -0
  49. package/lib/components/CFilePanel/KeyMessages.spec.d.ts +1 -0
  50. package/lib/components/CFilePanel/Summary.spec.d.ts +1 -0
  51. package/lib/components/CFileViewer/pdf/CFileViewer.pdf.util.d.ts +52 -0
  52. package/lib/components/CGlobalLoader/CGlobalLoaderMark.spec.d.ts +1 -0
  53. package/lib/components/CGlobalLoader/globalLoader.paths.d.ts +2 -0
  54. package/lib/components/CGlobalSearch/globalSearchTarget.util.d.ts +31 -0
  55. package/lib/components/CGlobalSearch/globalSearchTarget.util.test.d.ts +1 -0
  56. package/lib/components/CRichTextEditor/extensions/paragraphExtended.d.ts +7 -1
  57. package/lib/components/CRichTextEditor/extensions/paragraphExtended.test.d.ts +1 -0
  58. package/lib/components/canvases/CanvasesManagementBulk.use.d.ts +12 -2
  59. package/lib/components/masterCanvases/CMasterCanvasesManagement.use.d.ts +86 -0
  60. package/lib/components/masterCanvases/CMasterCanvasesManagement.use.spec.d.ts +1 -0
  61. package/lib/components/masterCanvases/CMasterCanvasesPendingShareCell.spec.d.ts +1 -0
  62. package/lib/components/masterCanvases/CMasterCanvasesSharedWithCell.use.d.ts +39 -0
  63. package/lib/components/masterCanvases/CMasterCanvasesSharedWithCell.use.spec.d.ts +1 -0
  64. package/lib/components/masterCanvases/createFromMaster.use.d.ts +255 -0
  65. package/lib/components/masterCanvases/createFromMaster.use.spec.d.ts +1 -0
  66. package/lib/components/masterCanvases/masterCanvasDocuments.use.d.ts +56 -0
  67. package/lib/components/masterCanvases/masterCanvasDocuments.use.spec.d.ts +1 -0
  68. package/lib/components/masterCanvases/masterCanvasShares.use.d.ts +103 -0
  69. package/lib/components/masterCanvases/masterCanvasShares.use.spec.d.ts +1 -0
  70. package/lib/components/masterCanvases/masterFromCanvas.use.d.ts +122 -0
  71. package/lib/components/masterCanvases/masterFromCanvas.use.spec.d.ts +1 -0
  72. package/lib/components/masterCanvases/masterFromTemplate.use.d.ts +50 -0
  73. package/lib/components/masterCanvases/masterFromTemplate.use.spec.d.ts +1 -0
  74. package/lib/components/savedCanvases/CSavedCanvasesManagement.use.d.ts +203 -0
  75. package/lib/components/savedCanvases/savedCanvasDocuments.use.d.ts +111 -0
  76. package/lib/components/savedCanvases/savedCanvasDocuments.use.spec.d.ts +1 -0
  77. package/lib/components/savedCanvases/smartFolders/SmartFolders.use.d.ts +4 -0
  78. package/lib/constants/cdp.const.d.ts +1 -0
  79. package/lib/constants/translationLanguages.const.d.ts +86 -8
  80. package/lib/constants/translationLanguages.const.spec.d.ts +1 -0
  81. package/lib/main.lib.d.ts +5 -0
  82. package/lib/sdk/api/HighLevelApi.d.ts +2 -0
  83. package/lib/sdk/api/modules/appsDb.d.ts +4 -4
  84. package/lib/sdk/api/modules/canvas.d.ts +12 -0
  85. package/lib/sdk/api/modules/ui/types.ui.d.ts +18 -0
  86. package/lib/sdk/interfaces.d.ts +31 -1
  87. package/lib/sdk/main.d.ts +38 -0
  88. package/lib/sdk/payload.types.d.ts +45 -0
  89. package/lib/sdk/platform.d.ts +27 -0
  90. package/lib/sdk/platform.spec.d.ts +1 -0
  91. package/lib/sdk/singleton-scope.spec.d.ts +1 -0
  92. package/lib/sdk/utils/httpFetch.spec.d.ts +1 -0
  93. package/lib/theme/canvasUiUnoPreset.test.d.ts +1 -0
  94. package/lib/types/app.d.ts +55 -1
  95. package/lib/types/canvases.d.ts +15 -0
  96. package/lib/types/launchDarkly.types.d.ts +8 -1
  97. package/lib/types/organizationSettings.types.d.ts +29 -0
  98. package/lib/util/aiSummary.d.ts +30 -0
  99. package/lib/util/aiSummary.spec.d.ts +1 -0
  100. package/lib/util/network.d.ts +35 -0
  101. package/package.json +1 -1
  102. package/types/openapi/models/Canvas.d.ts +1 -0
  103. package/types/openapi/models/CanvasCreate.d.ts +1 -0
  104. package/types/openapi/models/CanvasCreateRequest.d.ts +1 -0
  105. package/types/openapi/models/CanvasRecommendedFile.d.ts +1 -1
  106. package/types/openapi/models/CanvasRetrieve.d.ts +1 -0
  107. package/types/openapi/models/CanvasUpdate.d.ts +1 -0
  108. package/types/openapi/models/CanvasUpdateRequest.d.ts +1 -0
  109. package/types/openapi/models/DeletedCanvas.d.ts +1 -0
  110. package/types/openapi/models/File.d.ts +1 -1
  111. package/types/openapi/models/PatchedCanvasUpdateRequest.d.ts +1 -0
  112. package/types/openapi/models/SharedLink.d.ts +6 -0
  113. package/types/openapi/models/SharedLinkCreateRequest.d.ts +5 -0
package/js-api.umd.min.js CHANGED
@@ -1,20 +1,20 @@
1
- (function(y,Ve){typeof exports=="object"&&typeof module<"u"?Ve(exports):typeof define=="function"&&define.amd?define(["exports"],Ve):(y=typeof globalThis<"u"?globalThis:y||self,Ve(y.pitcher={}))})(this,(function(y){"use strict";function Ve(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(e,i,a.get?a:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function xi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ft={exports:{}},gt={exports:{}},ji=gt.exports,Hn;function Fi(){return Hn||(Hn=1,(function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:ji,(function(){return(function(n){var r={};function i(a){if(r[a])return r[a].exports;var u=r[a]={i:a,l:!1,exports:{}};return n[a].call(u.exports,u,u.exports,i),u.l=!0,u.exports}return i.m=n,i.c=r,i.d=function(a,u,l){i.o(a,u)||Object.defineProperty(a,u,{enumerable:!0,get:l})},i.r=function(a){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},i.t=function(a,u){if(1&u&&(a=i(a)),8&u||4&u&&typeof a=="object"&&a&&a.__esModule)return a;var l=Object.create(null);if(i.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:a}),2&u&&typeof a!="string")for(var _ in a)i.d(l,_,function(S){return a[S]}.bind(null,_));return l},i.n=function(a){var u=a&&a.__esModule?function(){return a.default}:function(){return a};return i.d(u,"a",u),u},i.o=function(a,u){return{}.hasOwnProperty.call(a,u)},i.p="",i(i.s=0)})([function(n,r,i){i.r(r),i.d(r,"Promise",(function(){return F})),i.d(r,"TYPES",(function(){return Pm})),i.d(r,"ProxyWindow",(function(){return se})),i.d(r,"setup",(function(){return Mi})),i.d(r,"destroy",(function(){return Om})),i.d(r,"serializeMessage",(function(){return vm})),i.d(r,"deserializeMessage",(function(){return Sm})),i.d(r,"createProxyWindow",(function(){return Tm})),i.d(r,"toProxyWindow",(function(){return bm})),i.d(r,"on",(function(){return $e})),i.d(r,"once",(function(){return ym})),i.d(r,"send",(function(){return Se})),i.d(r,"markWindowKnown",(function(){return Ti})),i.d(r,"cleanUpWindow",(function(){return Im})),i.d(r,"bridge",(function(){}));function a(o){return{}.toString.call(o)==="[object RegExp]"}var u=`Call was rejected by callee.\r
2
- `;function l(o){return o===void 0&&(o=window),o.location.protocol}function _(o){if(o===void 0&&(o=window),o.mockDomain){var c=o.mockDomain.split("//")[0];if(c)return c}return l(o)}function S(o){return o===void 0&&(o=window),_(o)==="about:"}function w(o){if(o===void 0&&(o=window),o)try{if(o.parent&&o.parent!==o)return o.parent}catch{}}function P(o){if(o===void 0&&(o=window),o&&!w(o))try{return o.opener}catch{}}function C(o){try{return!0}catch{}return!1}function D(o){o===void 0&&(o=window);var c=o.location;if(!c)throw new Error("Can not read window location");var s=l(o);if(!s)throw new Error("Can not read window protocol");if(s==="file:")return"file://";if(s==="about:"){var f=w(o);return f&&C()?D(f):"about://"}var d=c.host;if(!d)throw new Error("Can not read window host");return s+"//"+d}function I(o){o===void 0&&(o=window);var c=D(o);return c&&o.mockDomain&&o.mockDomain.indexOf("mock:")===0?o.mockDomain:c}function x(o){if(!(function(c){try{if(c===window)return!0}catch{}try{var s=Object.getOwnPropertyDescriptor(c,"location");if(s&&s.enumerable===!1)return!1}catch{}try{if(S(c)&&C())return!0}catch{}try{if((function(f){return f===void 0&&(f=window),_(f)==="mock:"})(c)&&C())return!0}catch{}try{if(D(c)===D(window))return!0}catch{}return!1})(o))return!1;try{if(o===window||S(o)&&C()||I(window)===I(o))return!0}catch{}return!1}function M(o){if(!x(o))throw new Error("Expected window to be same domain");return o}function j(o,c){if(!o||!c)return!1;var s=w(c);return s?s===o:(function(f){var d=[];try{for(;f.parent!==f;)d.push(f.parent),f=f.parent}catch{}return d})(c).indexOf(o)!==-1}function Y(o){var c=[],s;try{s=o.frames}catch{s=o}var f;try{f=s.length}catch{}if(f===0)return c;if(f){for(var d=0;d<f;d++){var p=void 0;try{p=s[d]}catch{continue}c.push(p)}return c}for(var h=0;h<100;h++){var E=void 0;try{E=s[h]}catch{return c}if(!E)return c;c.push(E)}return c}var ve=[],He=[];function ee(o,c){c===void 0&&(c=!0);try{if(o===window)return!1}catch{return!0}try{if(!o)return!0}catch{return!0}try{if(o.closed)return!0}catch(d){return!d||d.message!==u}if(c&&x(o))try{if(o.mockclosed)return!0}catch{}try{if(!o.parent||!o.top)return!0}catch{}var s=(function(d,p){for(var h=0;h<d.length;h++)try{if(d[h]===p)return h}catch{}return-1})(ve,o);if(s!==-1){var f=He[s];if(f&&(function(d){if(!d.contentWindow||!d.parentNode)return!0;var p=d.ownerDocument;if(p&&p.documentElement&&!p.documentElement.contains(d)){for(var h=d;h.parentNode&&h.parentNode!==h;)h=h.parentNode;if(!h.host||!p.documentElement.contains(h.host))return!0}return!1})(f))return!0}return!1}function ci(o){return o===void 0&&(o=window),P(o=o||window)||w(o)||void 0}function Be(o,c){if(typeof o=="string"){if(typeof c=="string")return o==="*"||c===o;if(a(c)||Array.isArray(c))return!1}return a(o)?a(c)?o.toString()===c.toString():!Array.isArray(c)&&!!c.match(o):!!Array.isArray(o)&&(Array.isArray(c)?JSON.stringify(o)===JSON.stringify(c):!a(c)&&o.some((function(s){return Be(s,c)})))}function $t(o){try{if(o===window)return!0}catch(c){if(c&&c.message===u)return!0}try{if({}.toString.call(o)==="[object Window]")return!0}catch(c){if(c&&c.message===u)return!0}try{if(window.Window&&o instanceof window.Window)return!0}catch(c){if(c&&c.message===u)return!0}try{if(o&&o.self===o)return!0}catch(c){if(c&&c.message===u)return!0}try{if(o&&o.parent===o)return!0}catch(c){if(c&&c.message===u)return!0}try{if(o&&o.top===o)return!0}catch(c){if(c&&c.message===u)return!0}try{if(o&&o.__cross_domain_utils_window_check__==="__unlikely_value__")return!1}catch{return!0}try{if("postMessage"in o&&"self"in o&&"location"in o)return!0}catch{}return!1}function ui(o){if(x(o))return M(o).frameElement;for(var c=0,s=document.querySelectorAll("iframe");c<s.length;c++){var f=s[c];if(f&&f.contentWindow&&f.contentWindow===o)return f}}function cm(o){if((function(s){return s===void 0&&(s=window),!!w(s)})(o)){var c=ui(o);if(c&&c.parentElement){c.parentElement.removeChild(c);return}}try{o.close()}catch{}}function Ne(o){try{if(!o)return!1;if(typeof Promise<"u"&&o instanceof Promise)return!0;if(typeof window<"u"&&typeof window.Window=="function"&&o instanceof window.Window||typeof window<"u"&&typeof window.constructor=="function"&&o instanceof window.constructor)return!1;var c={}.toString;if(c){var s=c.call(o);if(s==="[object Window]"||s==="[object global]"||s==="[object DOMWindow]")return!1}if(typeof o.then=="function")return!0}catch{return!1}return!1}var fi=[],at=[],Dn=0,ct;function di(){if(!Dn&&ct){var o=ct;ct=null,o.resolve()}}function $n(){Dn+=1}function ut(){Dn-=1,di()}var F=(function(){function o(s){var f=this;if(this.resolved=void 0,this.rejected=void 0,this.errorHandled=void 0,this.value=void 0,this.error=void 0,this.handlers=void 0,this.dispatching=void 0,this.stack=void 0,this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],s){var d,p,h=!1,E=!1,m=!1;$n();try{s((function(g){m?f.resolve(g):(h=!0,d=g)}),(function(g){m?f.reject(g):(E=!0,p=g)}))}catch(g){ut(),this.reject(g);return}ut(),m=!0,h?this.resolve(d):E&&this.reject(p)}}var c=o.prototype;return c.resolve=function(s){if(this.resolved||this.rejected)return this;if(Ne(s))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=s,this.dispatch(),this},c.reject=function(s){var f=this;if(this.resolved||this.rejected)return this;if(Ne(s))throw new Error("Can not reject promise with another promise");if(!s){var d=s&&typeof s.toString=="function"?s.toString():{}.toString.call(s);s=new Error("Expected reject to be called with Error, got "+d)}return this.rejected=!0,this.error=s,this.errorHandled||setTimeout((function(){f.errorHandled||(function(p,h){if(fi.indexOf(p)===-1){fi.push(p),setTimeout((function(){throw p}),1);for(var E=0;E<at.length;E++)at[E](p,h)}})(s,f)}),1),this.dispatch(),this},c.asyncReject=function(s){return this.errorHandled=!0,this.reject(s),this},c.dispatch=function(){var s=this.resolved,f=this.rejected,d=this.handlers;if(!this.dispatching&&(s||f)){this.dispatching=!0,$n();for(var p=function(b,L){return b.then((function(R){L.resolve(R)}),(function(R){L.reject(R)}))},h=0;h<d.length;h++){var E=d[h],m=E.onSuccess,g=E.onError,T=E.promise,A=void 0;if(s)try{A=m?m(this.value):this.value}catch(b){T.reject(b);continue}else if(f){if(!g){T.reject(this.error);continue}try{A=g(this.error)}catch(b){T.reject(b);continue}}if(A instanceof o&&(A.resolved||A.rejected)){var v=A;v.resolved?T.resolve(v.value):T.reject(v.error),v.errorHandled=!0}else Ne(A)?A instanceof o&&(A.resolved||A.rejected)?A.resolved?T.resolve(A.value):T.reject(A.error):p(A,T):T.resolve(A)}d.length=0,this.dispatching=!1,ut()}},c.then=function(s,f){if(s&&typeof s!="function"&&!s.call)throw new Error("Promise.then expected a function for success handler");if(f&&typeof f!="function"&&!f.call)throw new Error("Promise.then expected a function for error handler");var d=new o;return this.handlers.push({promise:d,onSuccess:s,onError:f}),this.errorHandled=!0,this.dispatch(),d},c.catch=function(s){return this.then(void 0,s)},c.finally=function(s){if(s&&typeof s!="function"&&!s.call)throw new Error("Promise.finally expected a function");return this.then((function(f){return o.try(s).then((function(){return f}))}),(function(f){return o.try(s).then((function(){throw f}))}))},c.timeout=function(s,f){var d=this;if(this.resolved||this.rejected)return this;var p=setTimeout((function(){d.resolved||d.rejected||d.reject(f||new Error("Promise timed out after "+s+"ms"))}),s);return this.then((function(h){return clearTimeout(p),h}))},c.toPromise=function(){if(typeof Promise>"u")throw new TypeError("Could not find Promise");return Promise.resolve(this)},c.lazy=function(){return this.errorHandled=!0,this},o.resolve=function(s){return s instanceof o?s:Ne(s)?new o((function(f,d){return s.then(f,d)})):new o().resolve(s)},o.reject=function(s){return new o().reject(s)},o.asyncReject=function(s){return new o().asyncReject(s)},o.all=function(s){var f=new o,d=s.length,p=[].slice();if(!d)return f.resolve(p),f;for(var h=function(g,T,A){return T.then((function(v){p[g]=v,(d-=1)==0&&f.resolve(p)}),(function(v){A.reject(v)}))},E=0;E<s.length;E++){var m=s[E];if(m instanceof o){if(m.resolved){p[E]=m.value,d-=1;continue}}else if(!Ne(m)){p[E]=m,d-=1;continue}h(E,o.resolve(m),f)}return d===0&&f.resolve(p),f},o.hash=function(s){var f={},d=[],p=function(E){if(s.hasOwnProperty(E)){var m=s[E];Ne(m)?d.push(m.then((function(g){f[E]=g}))):f[E]=m}};for(var h in s)p(h);return o.all(d).then((function(){return f}))},o.map=function(s,f){return o.all(s.map(f))},o.onPossiblyUnhandledException=function(s){return(function(f){return at.push(f),{cancel:function(){at.splice(at.indexOf(f),1)}}})(s)},o.try=function(s,f,d){if(s&&typeof s!="function"&&!s.call)throw new Error("Promise.try expected a function");var p;$n();try{p=s.apply(f,d||[])}catch(h){return ut(),o.reject(h)}return ut(),o.resolve(p)},o.delay=function(s){return new o((function(f){setTimeout(f,s)}))},o.isPromise=function(s){return!!(s&&s instanceof o)||Ne(s)},o.flush=function(){return(function(s){var f=ct=ct||new s;return di(),f})(o)},o})();function Ut(o,c){for(var s=0;s<o.length;s++)try{if(o[s]===c)return s}catch{}return-1}var Un=(function(){function o(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",(function(){if(typeof WeakMap>"u"||Object.freeze===void 0)return!1;try{var s=new WeakMap,f={};return Object.freeze(f),s.set(f,"__testvalue__"),s.get(f)==="__testvalue__"}catch{return!1}})())try{this.weakmap=new WeakMap}catch{}this.keys=[],this.values=[]}var c=o.prototype;return c._cleanupClosedWindows=function(){for(var s=this.weakmap,f=this.keys,d=0;d<f.length;d++){var p=f[d];if($t(p)&&ee(p)){if(s)try{s.delete(p)}catch{}f.splice(d,1),this.values.splice(d,1),d-=1}}},c.isSafeToReadWrite=function(s){return!$t(s)},c.set=function(s,f){if(!s)throw new Error("WeakMap expected key");var d=this.weakmap;if(d)try{d.set(s,f)}catch{delete this.weakmap}if(this.isSafeToReadWrite(s))try{var p=this.name,h=s[p];h&&h[0]===s?h[1]=f:Object.defineProperty(s,p,{value:[s,f],writable:!0});return}catch{}this._cleanupClosedWindows();var E=this.keys,m=this.values,g=Ut(E,s);g===-1?(E.push(s),m.push(f)):m[g]=f},c.get=function(s){if(!s)throw new Error("WeakMap expected key");var f=this.weakmap;if(f)try{if(f.has(s))return f.get(s)}catch{delete this.weakmap}if(this.isSafeToReadWrite(s))try{var d=s[this.name];return d&&d[0]===s?d[1]:void 0}catch{}this._cleanupClosedWindows();var p=Ut(this.keys,s);if(p!==-1)return this.values[p]},c.delete=function(s){if(!s)throw new Error("WeakMap expected key");var f=this.weakmap;if(f)try{f.delete(s)}catch{delete this.weakmap}if(this.isSafeToReadWrite(s))try{var d=s[this.name];d&&d[0]===s&&(d[0]=d[1]=void 0)}catch{}this._cleanupClosedWindows();var p=this.keys,h=Ut(p,s);h!==-1&&(p.splice(h,1),this.values.splice(h,1))},c.has=function(s){if(!s)throw new Error("WeakMap expected key");var f=this.weakmap;if(f)try{if(f.has(s))return!0}catch{delete this.weakmap}if(this.isSafeToReadWrite(s))try{var d=s[this.name];return!(!d||d[0]!==s)}catch{}return this._cleanupClosedWindows(),Ut(this.keys,s)!==-1},c.getOrSet=function(s,f){if(this.has(s))return this.get(s);var d=f();return this.set(s,d),d},o})();function li(o){return o.name||o.__name__||o.displayName||"anonymous"}function _i(o,c){try{delete o.name,o.name=c}catch{}return o.__name__=o.displayName=c,o}function he(){var o="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,(function(){return o.charAt(Math.floor(Math.random()*o.length))}))+"_"+(function(c){if(typeof btoa=="function")return btoa(encodeURIComponent(c).replace(/%([0-9A-F]{2})/g,(function(s,f){return String.fromCharCode(parseInt(f,16))}))).replace(/[=]/g,"");if(typeof Buffer<"u")return Buffer.from(c,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")})(new Date().toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}var Mt;function pi(o){try{return JSON.stringify([].slice.call(o),(function(c,s){return typeof s=="function"?"memoize["+(function(f){if(Mt=Mt||new Un,f==null||typeof f!="object"&&typeof f!="function")throw new Error("Invalid object");var d=Mt.get(f);return d||(d=typeof f+":"+he(),Mt.set(f,d)),d})(s)+"]":typeof window<"u"&&s instanceof window.Element||s!==null&&typeof s=="object"&&s.nodeType===1&&typeof s.style=="object"&&typeof s.ownerDocument=="object"?{}:s}))}catch{throw new Error("Arguments not serializable -- can not be used to memoize")}}function um(){return{}}var ft=0,hi=0;function dt(o,c){c===void 0&&(c={});var s=c.thisNamespace,f=s!==void 0&&s,d=c.time,p,h,E=ft;ft+=1;var m=function(){for(var g=arguments.length,T=new Array(g),A=0;A<g;A++)T[A]=arguments[A];E<hi&&(p=null,h=null,E=ft,ft+=1);var v;v=f?(h=h||new Un).getOrSet(this,um):p=p||{};var b;try{b=pi(T)}catch{return o.apply(this,arguments)}var L=v[b];if(L&&d&&Date.now()-L.time<d&&(delete v[b],L=null),L)return L.value;var R=Date.now(),N=o.apply(this,arguments);return v[b]={time:R,value:N},N};return m.reset=function(){p=null,h=null},_i(m,(c.name||li(o))+"::memoized")}dt.clear=function(){hi=ft};function fm(o){var c={};function s(){for(var f=arguments,d=this,p=arguments.length,h=new Array(p),E=0;E<p;E++)h[E]=arguments[E];var m=pi(h);return c.hasOwnProperty(m)||(c[m]=F.try((function(){return o.apply(d,f)})).finally((function(){delete c[m]}))),c[m]}return s.reset=function(){c={}},_i(s,li(o)+"::promiseMemoized")}function Le(){}function lt(o,c){if(c===void 0&&(c=1),c>=3)return"stringifyError stack overflow";try{if(!o)return"<unknown error: "+{}.toString.call(o)+">";if(typeof o=="string")return o;if(o instanceof Error){var s=o&&o.stack,f=o&&o.message;if(s&&f)return s.indexOf(f)!==-1?s:f+`
3
- `+s;if(s)return s;if(f)return f}return o&&o.toString&&typeof o.toString=="function"?o.toString():{}.toString.call(o)}catch(d){return"Error while stringifying error: "+lt(d,c+1)}}function gi(o){return typeof o=="string"?o:o.toString&&typeof o.toString=="function"?o.toString():{}.toString.call(o)}dt((function(o){if(Object.values)return Object.values(o);var c=[];for(var s in o)o.hasOwnProperty(s)&&c.push(o[s]);return c}));function Mn(o){return{}.toString.call(o)==="[object RegExp]"}function _t(o,c,s){if(o.hasOwnProperty(c))return o[c];var f=s();return o[c]=f,f}function mi(){var o=document.body;if(!o)throw new Error("Body element not found");return o}function Ei(){return!!document.body&&document.readyState==="complete"}function wi(){return!!document.body&&document.readyState==="interactive"}dt((function(){return new F((function(o){if(Ei()||wi())return o();var c=setInterval((function(){if(Ei()||wi())return clearInterval(c),o()}),10)}))}));var xt=typeof document<"u"?document.currentScript:null,dm=dt((function(){if(xt||(xt=(function(){try{var o=(function(){try{throw new Error("_")}catch(h){return h.stack||""}})(),c=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(o),s=c&&c[1];if(!s)return;for(var f=0,d=[].slice.call(document.getElementsByTagName("script")).reverse();f<d.length;f++){var p=d[f];if(p.src&&p.src===s)return p}}catch{}})()))return xt;throw new Error("Can not determine current script")})),lm=he();dt((function(){var o;try{o=dm()}catch{return lm}var c=o.getAttribute("data-uid");if(c&&typeof c=="string"||(c=o.getAttribute("data-uid-auto"))&&typeof c=="string")return c;if(o.src){var s=(function(f){for(var d="",p=0;p<f.length;p++){var h=f[p].charCodeAt(0)*p;f[p+1]&&(h+=f[p+1].charCodeAt(0)*(p-1)),d+=String.fromCharCode(97+Math.abs(h)%26)}return d})(JSON.stringify({src:o.src,dataset:o.dataset}));c="uid_"+s.slice(s.length-30)}else c=he();return o.setAttribute("data-uid-auto",c),c}));function pt(o){o===void 0&&(o=window);var c="__post_robot_10_0_46__";return o!==window?o[c]:o[c]=o[c]||{}}var Ai=function(){return{}};function X(o,c){return o===void 0&&(o="store"),c===void 0&&(c=Ai),_t(pt(),o,(function(){var s=c();return{has:function(f){return s.hasOwnProperty(f)},get:function(f,d){return s.hasOwnProperty(f)?s[f]:d},set:function(f,d){return s[f]=d,d},del:function(f){delete s[f]},getOrSet:function(f,d){return _t(s,f,d)},reset:function(){s=c()},keys:function(){return Object.keys(s)}}}))}var _m=function(){};function jt(){var o=pt();return o.WINDOW_WILDCARD=o.WINDOW_WILDCARD||new _m,o.WINDOW_WILDCARD}function te(o,c){return o===void 0&&(o="store"),c===void 0&&(c=Ai),X("windowStore").getOrSet(o,(function(){var s=new Un,f=function(d){return s.getOrSet(d,c)};return{has:function(d){return f(d).hasOwnProperty(o)},get:function(d,p){var h=f(d);return h.hasOwnProperty(o)?h[o]:p},set:function(d,p){return f(d)[o]=p,p},del:function(d){delete f(d)[o]},getOrSet:function(d,p){return _t(f(d),o,p)}}}))}function yi(){return X("instance").getOrSet("instanceID",he)}function vi(o,c){var s=c.domain,f=te("helloPromises"),d=f.get(o);d&&d.resolve({domain:s});var p=F.resolve({domain:s});return f.set(o,p),p}function xn(o,c){return(0,c.send)(o,"postrobot_hello",{instanceID:yi()},{domain:"*",timeout:-1}).then((function(s){var f=s.origin,d=s.data.instanceID;return vi(o,{domain:f}),{win:o,domain:f,instanceID:d}}))}function Si(o,c){var s=c.send;return te("windowInstanceIDPromises").getOrSet(o,(function(){return xn(o,{send:s}).then((function(f){return f.instanceID}))}))}function Ti(o){te("knownWindows").set(o,!0)}function jn(o){return typeof o=="object"&&o!==null&&typeof o.__type__=="string"}function bi(o){return o===void 0?"undefined":o===null?"null":Array.isArray(o)?"array":typeof o=="function"?"function":typeof o=="object"?o instanceof Error?"error":typeof o.then=="function"?"promise":{}.toString.call(o)==="[object RegExp]"?"regex":{}.toString.call(o)==="[object Date]"?"date":"object":typeof o=="string"?"string":typeof o=="number"?"number":typeof o=="boolean"?"boolean":void 0}function De(o,c){return{__type__:o,__val__:c}}var oe,pm=((oe={}).function=function(){},oe.error=function(o){return De("error",{message:o.message,stack:o.stack,code:o.code,data:o.data})},oe.promise=function(){},oe.regex=function(o){return De("regex",o.source)},oe.date=function(o){return De("date",o.toJSON())},oe.array=function(o){return o},oe.object=function(o){return o},oe.string=function(o){return o},oe.number=function(o){return o},oe.boolean=function(o){return o},oe.null=function(o){return o},oe[void 0]=function(o){return De("undefined",o)},oe),hm={},ie,gm=((ie={}).function=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},ie.error=function(o){var c=o.stack,s=o.code,f=o.data,d=new Error(o.message);return d.code=s,f&&(d.data=f),d.stack=c+`
1
+ (function(A,Ye){typeof exports=="object"&&typeof module<"u"?Ye(exports):typeof define=="function"&&define.amd?define(["exports"],Ye):(A=typeof globalThis<"u"?globalThis:A||self,Ye(A.pitcher={}))})(this,(function(A){"use strict";function Ye(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(e,i,a.get?a:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function Gi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wt={exports:{}},mt={exports:{}},zi=mt.exports,Yn;function Hi(){return Yn||(Yn=1,(function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:zi,(function(){return(function(n){var r={};function i(a){if(r[a])return r[a].exports;var u=r[a]={i:a,l:!1,exports:{}};return n[a].call(u.exports,u,u.exports,i),u.l=!0,u.exports}return i.m=n,i.c=r,i.d=function(a,u,l){i.o(a,u)||Object.defineProperty(a,u,{enumerable:!0,get:l})},i.r=function(a){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},i.t=function(a,u){if(1&u&&(a=i(a)),8&u||4&u&&typeof a=="object"&&a&&a.__esModule)return a;var l=Object.create(null);if(i.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:a}),2&u&&typeof a!="string")for(var _ in a)i.d(l,_,function(S){return a[S]}.bind(null,_));return l},i.n=function(a){var u=a&&a.__esModule?function(){return a.default}:function(){return a};return i.d(u,"a",u),u},i.o=function(a,u){return{}.hasOwnProperty.call(a,u)},i.p="",i(i.s=0)})([function(n,r,i){i.r(r),i.d(r,"Promise",(function(){return F})),i.d(r,"TYPES",(function(){return Um})),i.d(r,"ProxyWindow",(function(){return se})),i.d(r,"setup",(function(){return qi})),i.d(r,"destroy",(function(){return $m})),i.d(r,"serializeMessage",(function(){return Nm})),i.d(r,"deserializeMessage",(function(){return Rm})),i.d(r,"createProxyWindow",(function(){return Lm})),i.d(r,"toProxyWindow",(function(){return Dm})),i.d(r,"on",(function(){return $e})),i.d(r,"once",(function(){return Cm})),i.d(r,"send",(function(){return Se})),i.d(r,"markWindowKnown",(function(){return Ci})),i.d(r,"cleanUpWindow",(function(){return Mm})),i.d(r,"bridge",(function(){}));function a(o){return{}.toString.call(o)==="[object RegExp]"}var u=`Call was rejected by callee.\r
2
+ `;function l(o){return o===void 0&&(o=window),o.location.protocol}function _(o){if(o===void 0&&(o=window),o.mockDomain){var c=o.mockDomain.split("//")[0];if(c)return c}return l(o)}function S(o){return o===void 0&&(o=window),_(o)==="about:"}function w(o){if(o===void 0&&(o=window),o)try{if(o.parent&&o.parent!==o)return o.parent}catch{}}function P(o){if(o===void 0&&(o=window),o&&!w(o))try{return o.opener}catch{}}function C(o){try{return!0}catch{}return!1}function D(o){o===void 0&&(o=window);var c=o.location;if(!c)throw new Error("Can not read window location");var s=l(o);if(!s)throw new Error("Can not read window protocol");if(s==="file:")return"file://";if(s==="about:"){var f=w(o);return f&&C()?D(f):"about://"}var d=c.host;if(!d)throw new Error("Can not read window host");return s+"//"+d}function I(o){o===void 0&&(o=window);var c=D(o);return c&&o.mockDomain&&o.mockDomain.indexOf("mock:")===0?o.mockDomain:c}function x(o){if(!(function(c){try{if(c===window)return!0}catch{}try{var s=Object.getOwnPropertyDescriptor(c,"location");if(s&&s.enumerable===!1)return!1}catch{}try{if(S(c)&&C())return!0}catch{}try{if((function(f){return f===void 0&&(f=window),_(f)==="mock:"})(c)&&C())return!0}catch{}try{if(D(c)===D(window))return!0}catch{}return!1})(o))return!1;try{if(o===window||S(o)&&C()||I(window)===I(o))return!0}catch{}return!1}function M(o){if(!x(o))throw new Error("Expected window to be same domain");return o}function j(o,c){if(!o||!c)return!1;var s=w(c);return s?s===o:(function(f){var d=[];try{for(;f.parent!==f;)d.push(f.parent),f=f.parent}catch{}return d})(c).indexOf(o)!==-1}function V(o){var c=[],s;try{s=o.frames}catch{s=o}var f;try{f=s.length}catch{}if(f===0)return c;if(f){for(var d=0;d<f;d++){var p=void 0;try{p=s[d]}catch{continue}c.push(p)}return c}for(var h=0;h<100;h++){var E=void 0;try{E=s[h]}catch{return c}if(!E)return c;c.push(E)}return c}var ve=[],He=[];function ee(o,c){c===void 0&&(c=!0);try{if(o===window)return!1}catch{return!0}try{if(!o)return!0}catch{return!0}try{if(o.closed)return!0}catch(d){return!d||d.message!==u}if(c&&x(o))try{if(o.mockclosed)return!0}catch{}try{if(!o.parent||!o.top)return!0}catch{}var s=(function(d,p){for(var h=0;h<d.length;h++)try{if(d[h]===p)return h}catch{}return-1})(ve,o);if(s!==-1){var f=He[s];if(f&&(function(d){if(!d.contentWindow||!d.parentNode)return!0;var p=d.ownerDocument;if(p&&p.documentElement&&!p.documentElement.contains(d)){for(var h=d;h.parentNode&&h.parentNode!==h;)h=h.parentNode;if(!h.host||!p.documentElement.contains(h.host))return!0}return!1})(f))return!0}return!1}function _i(o){return o===void 0&&(o=window),P(o=o||window)||w(o)||void 0}function Be(o,c){if(typeof o=="string"){if(typeof c=="string")return o==="*"||c===o;if(a(c)||Array.isArray(c))return!1}return a(o)?a(c)?o.toString()===c.toString():!Array.isArray(c)&&!!c.match(o):!!Array.isArray(o)&&(Array.isArray(c)?JSON.stringify(o)===JSON.stringify(c):!a(c)&&o.some((function(s){return Be(s,c)})))}function Ut(o){try{if(o===window)return!0}catch(c){if(c&&c.message===u)return!0}try{if({}.toString.call(o)==="[object Window]")return!0}catch(c){if(c&&c.message===u)return!0}try{if(window.Window&&o instanceof window.Window)return!0}catch(c){if(c&&c.message===u)return!0}try{if(o&&o.self===o)return!0}catch(c){if(c&&c.message===u)return!0}try{if(o&&o.parent===o)return!0}catch(c){if(c&&c.message===u)return!0}try{if(o&&o.top===o)return!0}catch(c){if(c&&c.message===u)return!0}try{if(o&&o.__cross_domain_utils_window_check__==="__unlikely_value__")return!1}catch{return!0}try{if("postMessage"in o&&"self"in o&&"location"in o)return!0}catch{}return!1}function pi(o){if(x(o))return M(o).frameElement;for(var c=0,s=document.querySelectorAll("iframe");c<s.length;c++){var f=s[c];if(f&&f.contentWindow&&f.contentWindow===o)return f}}function gm(o){if((function(s){return s===void 0&&(s=window),!!w(s)})(o)){var c=pi(o);if(c&&c.parentElement){c.parentElement.removeChild(c);return}}try{o.close()}catch{}}function Re(o){try{if(!o)return!1;if(typeof Promise<"u"&&o instanceof Promise)return!0;if(typeof window<"u"&&typeof window.Window=="function"&&o instanceof window.Window||typeof window<"u"&&typeof window.constructor=="function"&&o instanceof window.constructor)return!1;var c={}.toString;if(c){var s=c.call(o);if(s==="[object Window]"||s==="[object global]"||s==="[object DOMWindow]")return!1}if(typeof o.then=="function")return!0}catch{return!1}return!1}var hi=[],ct=[],Un=0,ut;function gi(){if(!Un&&ut){var o=ut;ut=null,o.resolve()}}function Mn(){Un+=1}function ft(){Un-=1,gi()}var F=(function(){function o(s){var f=this;if(this.resolved=void 0,this.rejected=void 0,this.errorHandled=void 0,this.value=void 0,this.error=void 0,this.handlers=void 0,this.dispatching=void 0,this.stack=void 0,this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],s){var d,p,h=!1,E=!1,m=!1;Mn();try{s((function(g){m?f.resolve(g):(h=!0,d=g)}),(function(g){m?f.reject(g):(E=!0,p=g)}))}catch(g){ft(),this.reject(g);return}ft(),m=!0,h?this.resolve(d):E&&this.reject(p)}}var c=o.prototype;return c.resolve=function(s){if(this.resolved||this.rejected)return this;if(Re(s))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=s,this.dispatch(),this},c.reject=function(s){var f=this;if(this.resolved||this.rejected)return this;if(Re(s))throw new Error("Can not reject promise with another promise");if(!s){var d=s&&typeof s.toString=="function"?s.toString():{}.toString.call(s);s=new Error("Expected reject to be called with Error, got "+d)}return this.rejected=!0,this.error=s,this.errorHandled||setTimeout((function(){f.errorHandled||(function(p,h){if(hi.indexOf(p)===-1){hi.push(p),setTimeout((function(){throw p}),1);for(var E=0;E<ct.length;E++)ct[E](p,h)}})(s,f)}),1),this.dispatch(),this},c.asyncReject=function(s){return this.errorHandled=!0,this.reject(s),this},c.dispatch=function(){var s=this.resolved,f=this.rejected,d=this.handlers;if(!this.dispatching&&(s||f)){this.dispatching=!0,Mn();for(var p=function(b,L){return b.then((function(N){L.resolve(N)}),(function(N){L.reject(N)}))},h=0;h<d.length;h++){var E=d[h],m=E.onSuccess,g=E.onError,T=E.promise,y=void 0;if(s)try{y=m?m(this.value):this.value}catch(b){T.reject(b);continue}else if(f){if(!g){T.reject(this.error);continue}try{y=g(this.error)}catch(b){T.reject(b);continue}}if(y instanceof o&&(y.resolved||y.rejected)){var v=y;v.resolved?T.resolve(v.value):T.reject(v.error),v.errorHandled=!0}else Re(y)?y instanceof o&&(y.resolved||y.rejected)?y.resolved?T.resolve(y.value):T.reject(y.error):p(y,T):T.resolve(y)}d.length=0,this.dispatching=!1,ft()}},c.then=function(s,f){if(s&&typeof s!="function"&&!s.call)throw new Error("Promise.then expected a function for success handler");if(f&&typeof f!="function"&&!f.call)throw new Error("Promise.then expected a function for error handler");var d=new o;return this.handlers.push({promise:d,onSuccess:s,onError:f}),this.errorHandled=!0,this.dispatch(),d},c.catch=function(s){return this.then(void 0,s)},c.finally=function(s){if(s&&typeof s!="function"&&!s.call)throw new Error("Promise.finally expected a function");return this.then((function(f){return o.try(s).then((function(){return f}))}),(function(f){return o.try(s).then((function(){throw f}))}))},c.timeout=function(s,f){var d=this;if(this.resolved||this.rejected)return this;var p=setTimeout((function(){d.resolved||d.rejected||d.reject(f||new Error("Promise timed out after "+s+"ms"))}),s);return this.then((function(h){return clearTimeout(p),h}))},c.toPromise=function(){if(typeof Promise>"u")throw new TypeError("Could not find Promise");return Promise.resolve(this)},c.lazy=function(){return this.errorHandled=!0,this},o.resolve=function(s){return s instanceof o?s:Re(s)?new o((function(f,d){return s.then(f,d)})):new o().resolve(s)},o.reject=function(s){return new o().reject(s)},o.asyncReject=function(s){return new o().asyncReject(s)},o.all=function(s){var f=new o,d=s.length,p=[].slice();if(!d)return f.resolve(p),f;for(var h=function(g,T,y){return T.then((function(v){p[g]=v,(d-=1)==0&&f.resolve(p)}),(function(v){y.reject(v)}))},E=0;E<s.length;E++){var m=s[E];if(m instanceof o){if(m.resolved){p[E]=m.value,d-=1;continue}}else if(!Re(m)){p[E]=m,d-=1;continue}h(E,o.resolve(m),f)}return d===0&&f.resolve(p),f},o.hash=function(s){var f={},d=[],p=function(E){if(s.hasOwnProperty(E)){var m=s[E];Re(m)?d.push(m.then((function(g){f[E]=g}))):f[E]=m}};for(var h in s)p(h);return o.all(d).then((function(){return f}))},o.map=function(s,f){return o.all(s.map(f))},o.onPossiblyUnhandledException=function(s){return(function(f){return ct.push(f),{cancel:function(){ct.splice(ct.indexOf(f),1)}}})(s)},o.try=function(s,f,d){if(s&&typeof s!="function"&&!s.call)throw new Error("Promise.try expected a function");var p;Mn();try{p=s.apply(f,d||[])}catch(h){return ft(),o.reject(h)}return ft(),o.resolve(p)},o.delay=function(s){return new o((function(f){setTimeout(f,s)}))},o.isPromise=function(s){return!!(s&&s instanceof o)||Re(s)},o.flush=function(){return(function(s){var f=ut=ut||new s;return gi(),f})(o)},o})();function Mt(o,c){for(var s=0;s<o.length;s++)try{if(o[s]===c)return s}catch{}return-1}var xn=(function(){function o(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",(function(){if(typeof WeakMap>"u"||Object.freeze===void 0)return!1;try{var s=new WeakMap,f={};return Object.freeze(f),s.set(f,"__testvalue__"),s.get(f)==="__testvalue__"}catch{return!1}})())try{this.weakmap=new WeakMap}catch{}this.keys=[],this.values=[]}var c=o.prototype;return c._cleanupClosedWindows=function(){for(var s=this.weakmap,f=this.keys,d=0;d<f.length;d++){var p=f[d];if(Ut(p)&&ee(p)){if(s)try{s.delete(p)}catch{}f.splice(d,1),this.values.splice(d,1),d-=1}}},c.isSafeToReadWrite=function(s){return!Ut(s)},c.set=function(s,f){if(!s)throw new Error("WeakMap expected key");var d=this.weakmap;if(d)try{d.set(s,f)}catch{delete this.weakmap}if(this.isSafeToReadWrite(s))try{var p=this.name,h=s[p];h&&h[0]===s?h[1]=f:Object.defineProperty(s,p,{value:[s,f],writable:!0});return}catch{}this._cleanupClosedWindows();var E=this.keys,m=this.values,g=Mt(E,s);g===-1?(E.push(s),m.push(f)):m[g]=f},c.get=function(s){if(!s)throw new Error("WeakMap expected key");var f=this.weakmap;if(f)try{if(f.has(s))return f.get(s)}catch{delete this.weakmap}if(this.isSafeToReadWrite(s))try{var d=s[this.name];return d&&d[0]===s?d[1]:void 0}catch{}this._cleanupClosedWindows();var p=Mt(this.keys,s);if(p!==-1)return this.values[p]},c.delete=function(s){if(!s)throw new Error("WeakMap expected key");var f=this.weakmap;if(f)try{f.delete(s)}catch{delete this.weakmap}if(this.isSafeToReadWrite(s))try{var d=s[this.name];d&&d[0]===s&&(d[0]=d[1]=void 0)}catch{}this._cleanupClosedWindows();var p=this.keys,h=Mt(p,s);h!==-1&&(p.splice(h,1),this.values.splice(h,1))},c.has=function(s){if(!s)throw new Error("WeakMap expected key");var f=this.weakmap;if(f)try{if(f.has(s))return!0}catch{delete this.weakmap}if(this.isSafeToReadWrite(s))try{var d=s[this.name];return!(!d||d[0]!==s)}catch{}return this._cleanupClosedWindows(),Mt(this.keys,s)!==-1},c.getOrSet=function(s,f){if(this.has(s))return this.get(s);var d=f();return this.set(s,d),d},o})();function mi(o){return o.name||o.__name__||o.displayName||"anonymous"}function Ei(o,c){try{delete o.name,o.name=c}catch{}return o.__name__=o.displayName=c,o}function he(){var o="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,(function(){return o.charAt(Math.floor(Math.random()*o.length))}))+"_"+(function(c){if(typeof btoa=="function")return btoa(encodeURIComponent(c).replace(/%([0-9A-F]{2})/g,(function(s,f){return String.fromCharCode(parseInt(f,16))}))).replace(/[=]/g,"");if(typeof Buffer<"u")return Buffer.from(c,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")})(new Date().toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}var xt;function wi(o){try{return JSON.stringify([].slice.call(o),(function(c,s){return typeof s=="function"?"memoize["+(function(f){if(xt=xt||new xn,f==null||typeof f!="object"&&typeof f!="function")throw new Error("Invalid object");var d=xt.get(f);return d||(d=typeof f+":"+he(),xt.set(f,d)),d})(s)+"]":typeof window<"u"&&s instanceof window.Element||s!==null&&typeof s=="object"&&s.nodeType===1&&typeof s.style=="object"&&typeof s.ownerDocument=="object"?{}:s}))}catch{throw new Error("Arguments not serializable -- can not be used to memoize")}}function mm(){return{}}var dt=0,Ai=0;function lt(o,c){c===void 0&&(c={});var s=c.thisNamespace,f=s!==void 0&&s,d=c.time,p,h,E=dt;dt+=1;var m=function(){for(var g=arguments.length,T=new Array(g),y=0;y<g;y++)T[y]=arguments[y];E<Ai&&(p=null,h=null,E=dt,dt+=1);var v;v=f?(h=h||new xn).getOrSet(this,mm):p=p||{};var b;try{b=wi(T)}catch{return o.apply(this,arguments)}var L=v[b];if(L&&d&&Date.now()-L.time<d&&(delete v[b],L=null),L)return L.value;var N=Date.now(),R=o.apply(this,arguments);return v[b]={time:N,value:R},R};return m.reset=function(){p=null,h=null},Ei(m,(c.name||mi(o))+"::memoized")}lt.clear=function(){Ai=dt};function Em(o){var c={};function s(){for(var f=arguments,d=this,p=arguments.length,h=new Array(p),E=0;E<p;E++)h[E]=arguments[E];var m=wi(h);return c.hasOwnProperty(m)||(c[m]=F.try((function(){return o.apply(d,f)})).finally((function(){delete c[m]}))),c[m]}return s.reset=function(){c={}},Ei(s,mi(o)+"::promiseMemoized")}function Le(){}function _t(o,c){if(c===void 0&&(c=1),c>=3)return"stringifyError stack overflow";try{if(!o)return"<unknown error: "+{}.toString.call(o)+">";if(typeof o=="string")return o;if(o instanceof Error){var s=o&&o.stack,f=o&&o.message;if(s&&f)return s.indexOf(f)!==-1?s:f+`
3
+ `+s;if(s)return s;if(f)return f}return o&&o.toString&&typeof o.toString=="function"?o.toString():{}.toString.call(o)}catch(d){return"Error while stringifying error: "+_t(d,c+1)}}function yi(o){return typeof o=="string"?o:o.toString&&typeof o.toString=="function"?o.toString():{}.toString.call(o)}lt((function(o){if(Object.values)return Object.values(o);var c=[];for(var s in o)o.hasOwnProperty(s)&&c.push(o[s]);return c}));function jn(o){return{}.toString.call(o)==="[object RegExp]"}function pt(o,c,s){if(o.hasOwnProperty(c))return o[c];var f=s();return o[c]=f,f}function vi(){var o=document.body;if(!o)throw new Error("Body element not found");return o}function Si(){return!!document.body&&document.readyState==="complete"}function Ti(){return!!document.body&&document.readyState==="interactive"}lt((function(){return new F((function(o){if(Si()||Ti())return o();var c=setInterval((function(){if(Si()||Ti())return clearInterval(c),o()}),10)}))}));var jt=typeof document<"u"?document.currentScript:null,wm=lt((function(){if(jt||(jt=(function(){try{var o=(function(){try{throw new Error("_")}catch(h){return h.stack||""}})(),c=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(o),s=c&&c[1];if(!s)return;for(var f=0,d=[].slice.call(document.getElementsByTagName("script")).reverse();f<d.length;f++){var p=d[f];if(p.src&&p.src===s)return p}}catch{}})()))return jt;throw new Error("Can not determine current script")})),Am=he();lt((function(){var o;try{o=wm()}catch{return Am}var c=o.getAttribute("data-uid");if(c&&typeof c=="string"||(c=o.getAttribute("data-uid-auto"))&&typeof c=="string")return c;if(o.src){var s=(function(f){for(var d="",p=0;p<f.length;p++){var h=f[p].charCodeAt(0)*p;f[p+1]&&(h+=f[p+1].charCodeAt(0)*(p-1)),d+=String.fromCharCode(97+Math.abs(h)%26)}return d})(JSON.stringify({src:o.src,dataset:o.dataset}));c="uid_"+s.slice(s.length-30)}else c=he();return o.setAttribute("data-uid-auto",c),c}));function ht(o){o===void 0&&(o=window);var c="__post_robot_10_0_46__";return o!==window?o[c]:o[c]=o[c]||{}}var bi=function(){return{}};function X(o,c){return o===void 0&&(o="store"),c===void 0&&(c=bi),pt(ht(),o,(function(){var s=c();return{has:function(f){return s.hasOwnProperty(f)},get:function(f,d){return s.hasOwnProperty(f)?s[f]:d},set:function(f,d){return s[f]=d,d},del:function(f){delete s[f]},getOrSet:function(f,d){return pt(s,f,d)},reset:function(){s=c()},keys:function(){return Object.keys(s)}}}))}var ym=function(){};function Ft(){var o=ht();return o.WINDOW_WILDCARD=o.WINDOW_WILDCARD||new ym,o.WINDOW_WILDCARD}function te(o,c){return o===void 0&&(o="store"),c===void 0&&(c=bi),X("windowStore").getOrSet(o,(function(){var s=new xn,f=function(d){return s.getOrSet(d,c)};return{has:function(d){return f(d).hasOwnProperty(o)},get:function(d,p){var h=f(d);return h.hasOwnProperty(o)?h[o]:p},set:function(d,p){return f(d)[o]=p,p},del:function(d){delete f(d)[o]},getOrSet:function(d,p){return pt(f(d),o,p)}}}))}function Oi(){return X("instance").getOrSet("instanceID",he)}function Pi(o,c){var s=c.domain,f=te("helloPromises"),d=f.get(o);d&&d.resolve({domain:s});var p=F.resolve({domain:s});return f.set(o,p),p}function Fn(o,c){return(0,c.send)(o,"postrobot_hello",{instanceID:Oi()},{domain:"*",timeout:-1}).then((function(s){var f=s.origin,d=s.data.instanceID;return Pi(o,{domain:f}),{win:o,domain:f,instanceID:d}}))}function Ii(o,c){var s=c.send;return te("windowInstanceIDPromises").getOrSet(o,(function(){return Fn(o,{send:s}).then((function(f){return f.instanceID}))}))}function Ci(o){te("knownWindows").set(o,!0)}function Wn(o){return typeof o=="object"&&o!==null&&typeof o.__type__=="string"}function Ni(o){return o===void 0?"undefined":o===null?"null":Array.isArray(o)?"array":typeof o=="function"?"function":typeof o=="object"?o instanceof Error?"error":typeof o.then=="function"?"promise":{}.toString.call(o)==="[object RegExp]"?"regex":{}.toString.call(o)==="[object Date]"?"date":"object":typeof o=="string"?"string":typeof o=="number"?"number":typeof o=="boolean"?"boolean":void 0}function De(o,c){return{__type__:o,__val__:c}}var oe,vm=((oe={}).function=function(){},oe.error=function(o){return De("error",{message:o.message,stack:o.stack,code:o.code,data:o.data})},oe.promise=function(){},oe.regex=function(o){return De("regex",o.source)},oe.date=function(o){return De("date",o.toJSON())},oe.array=function(o){return o},oe.object=function(o){return o},oe.string=function(o){return o},oe.number=function(o){return o},oe.boolean=function(o){return o},oe.null=function(o){return o},oe[void 0]=function(o){return De("undefined",o)},oe),Sm={},ie,Tm=((ie={}).function=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},ie.error=function(o){var c=o.stack,s=o.code,f=o.data,d=new Error(o.message);return d.code=s,f&&(d.data=f),d.stack=c+`
4
4
 
5
- `+d.stack,d},ie.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},ie.regex=function(o){return new RegExp(o)},ie.date=function(o){return new Date(o)},ie.array=function(o){return o},ie.object=function(o){return o},ie.string=function(o){return o},ie.number=function(o){return o},ie.boolean=function(o){return o},ie.null=function(o){return o},ie[void 0]=function(){},ie),mm={};new F((function(o){if(window.document&&window.document.body)return o(window.document.body);var c=setInterval((function(){if(window.document&&window.document.body)return clearInterval(c),o(window.document.body)}),10)}));function Fn(){for(var o=X("idToProxyWindow"),c=0,s=o.keys();c<s.length;c++){var f=s[c];o.get(f).shouldClean()&&o.del(f)}}function Oi(o,c){var s=c.send,f=c.id,d=f===void 0?he():f,p=o.then((function(m){if(x(m))return M(m).name})),h=o.then((function(m){if(ee(m))throw new Error("Window is closed, can not determine type");return P(m)?"popup":"iframe"}));p.catch(Le),h.catch(Le);var E=function(){return o.then((function(m){if(!ee(m))return x(m)?M(m).name:p}))};return{id:d,getType:function(){return h},getInstanceID:fm((function(){return o.then((function(m){return Si(m,{send:s})}))})),close:function(){return o.then(cm)},getName:E,focus:function(){return o.then((function(m){m.focus()}))},isClosed:function(){return o.then((function(m){return ee(m)}))},setLocation:function(m,g){return g===void 0&&(g={}),o.then((function(T){var A=window.location.protocol+"//"+window.location.host,v=g.method,b=v===void 0?"get":v,L=g.body;if(m.indexOf("/")===0)m=""+A+m;else if(!m.match(/^https?:\/\//)&&m.indexOf(A)!==0)throw new Error("Expected url to be http or https url, or absolute path, got "+JSON.stringify(m));if(b==="post")return E().then((function(R){if(!R)throw new Error("Can not post to window without target name");(function(N){var q=N.url,Z=N.target,H=N.body,G=N.method,K=G===void 0?"post":G,U=document.createElement("form");if(U.setAttribute("target",Z),U.setAttribute("method",K),U.setAttribute("action",q),U.style.display="none",H)for(var B=0,ce=Object.keys(H);B<ce.length;B++){var k,ht=ce[B],zn=document.createElement("input");zn.setAttribute("name",ht),zn.setAttribute("value",(k=H[ht])==null?void 0:k.toString()),U.appendChild(zn)}mi().appendChild(U),U.submit(),mi().removeChild(U)})({url:m,target:R,method:b,body:L})}));if(b!=="get")throw new Error("Unsupported method: "+b);if(x(T))try{if(T.location&&typeof T.location.replace=="function"){T.location.replace(m);return}}catch{}T.location=m}))},setName:function(m){return o.then((function(g){var T=x(g),A=ui(g);if(!T)throw new Error("Can not set name for cross-domain window: "+m);M(g).name=m,A&&A.setAttribute("name",m),p=F.resolve(m)}))}}}var se=(function(){function o(s){var f=s.send,d=s.win,p=s.serializedWindow;this.id=void 0,this.isProxyWindow=!0,this.serializedWindow=void 0,this.actualWindow=void 0,this.actualWindowPromise=void 0,this.send=void 0,this.name=void 0,this.actualWindowPromise=new F,this.serializedWindow=p||Oi(this.actualWindowPromise,{send:f}),X("idToProxyWindow").set(this.getID(),this),d&&this.setWindow(d,{send:f})}var c=o.prototype;return c.getID=function(){return this.serializedWindow.id},c.getType=function(){return this.serializedWindow.getType()},c.isPopup=function(){return this.getType().then((function(s){return s==="popup"}))},c.setLocation=function(s,f){var d=this;return this.serializedWindow.setLocation(s,f).then((function(){return d}))},c.getName=function(){return this.serializedWindow.getName()},c.setName=function(s){var f=this;return this.serializedWindow.setName(s).then((function(){return f}))},c.close=function(){var s=this;return this.serializedWindow.close().then((function(){return s}))},c.focus=function(){var s=this,f=this.isPopup(),d=this.getName(),p=F.hash({isPopup:f,name:d}).then((function(E){var m=E.name;E.isPopup&&m&&window.open("",m,"noopener")})),h=this.serializedWindow.focus();return F.all([p,h]).then((function(){return s}))},c.isClosed=function(){return this.serializedWindow.isClosed()},c.getWindow=function(){return this.actualWindow},c.setWindow=function(s,f){var d=f.send;this.actualWindow=s,this.actualWindowPromise.resolve(this.actualWindow),this.serializedWindow=Oi(this.actualWindowPromise,{send:d,id:this.getID()}),te("winToProxyWindow").set(s,this)},c.awaitWindow=function(){return this.actualWindowPromise},c.matchWindow=function(s,f){var d=this,p=f.send;return F.try((function(){return d.actualWindow?s===d.actualWindow:F.hash({proxyInstanceID:d.getInstanceID(),knownWindowInstanceID:Si(s,{send:p})}).then((function(h){var E=h.proxyInstanceID===h.knownWindowInstanceID;return E&&d.setWindow(s,{send:p}),E}))}))},c.unwrap=function(){return this.actualWindow||this},c.getInstanceID=function(){return this.serializedWindow.getInstanceID()},c.shouldClean=function(){return!!(this.actualWindow&&ee(this.actualWindow))},c.serialize=function(){return this.serializedWindow},o.unwrap=function(s){return o.isProxyWindow(s)?s.unwrap():s},o.serialize=function(s,f){var d=f.send;return Fn(),o.toProxyWindow(s,{send:d}).serialize()},o.deserialize=function(s,f){var d=f.send;return Fn(),X("idToProxyWindow").get(s.id)||new o({serializedWindow:s,send:d})},o.isProxyWindow=function(s){return!!(s&&!$t(s)&&s.isProxyWindow)},o.toProxyWindow=function(s,f){var d=f.send;if(Fn(),o.isProxyWindow(s))return s;var p=s;return te("winToProxyWindow").get(p)||new o({win:p,send:d})},o})();function Wn(o,c,s,f,d){var p=te("methodStore"),h=X("proxyWindowMethods");se.isProxyWindow(f)?h.set(o,{val:c,name:s,domain:d,source:f}):(h.del(o),p.getOrSet(f,(function(){return{}}))[o]={domain:d,name:s,val:c,source:f})}function Pi(o,c){var s=te("methodStore"),f=X("proxyWindowMethods");return s.getOrSet(o,(function(){return{}}))[c]||f.get(c)}function Ii(o,c,s,f,d){h=(p={on:d.on,send:d.send}).on,E=p.send,X("builtinListeners").getOrSet("functionCalls",(function(){return h("postrobot_method",{domain:"*"},(function(T){var A=T.source,v=T.origin,b=T.data,L=b.id,R=b.name,N=Pi(A,L);if(!N)throw new Error("Could not find method '"+R+"' with id: "+b.id+" in "+I(window));var q=N.source,Z=N.domain,H=N.val;return F.try((function(){if(!Be(Z,v))throw new Error("Method '"+b.name+"' domain "+JSON.stringify(Mn(N.domain)?N.domain.source:N.domain)+" does not match origin "+v+" in "+I(window));if(se.isProxyWindow(q))return q.matchWindow(A,{send:E}).then((function(G){if(!G)throw new Error("Method call '"+b.name+"' failed - proxy window does not match source in "+I(window))}))})).then((function(){return H.apply({source:A,origin:v},b.args)}),(function(G){return F.try((function(){if(H.onError)return H.onError(G)})).then((function(){throw G.stack&&(G.stack="Remote call to "+R+"("+(function(K){return K===void 0&&(K=[]),(U=K,[].slice.call(U)).map((function(B){return typeof B=="string"?"'"+B+"'":B===void 0?"undefined":B===null?"null":typeof B=="boolean"?B.toString():Array.isArray(B)?"[ ... ]":typeof B=="object"?"{ ... }":typeof B=="function"?"() => { ... }":"<"+typeof B+">"})).join(", ");var U})(b.args)+`) failed
5
+ `+d.stack,d},ie.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},ie.regex=function(o){return new RegExp(o)},ie.date=function(o){return new Date(o)},ie.array=function(o){return o},ie.object=function(o){return o},ie.string=function(o){return o},ie.number=function(o){return o},ie.boolean=function(o){return o},ie.null=function(o){return o},ie[void 0]=function(){},ie),bm={};new F((function(o){if(window.document&&window.document.body)return o(window.document.body);var c=setInterval((function(){if(window.document&&window.document.body)return clearInterval(c),o(window.document.body)}),10)}));function qn(){for(var o=X("idToProxyWindow"),c=0,s=o.keys();c<s.length;c++){var f=s[c];o.get(f).shouldClean()&&o.del(f)}}function Ri(o,c){var s=c.send,f=c.id,d=f===void 0?he():f,p=o.then((function(m){if(x(m))return M(m).name})),h=o.then((function(m){if(ee(m))throw new Error("Window is closed, can not determine type");return P(m)?"popup":"iframe"}));p.catch(Le),h.catch(Le);var E=function(){return o.then((function(m){if(!ee(m))return x(m)?M(m).name:p}))};return{id:d,getType:function(){return h},getInstanceID:Em((function(){return o.then((function(m){return Ii(m,{send:s})}))})),close:function(){return o.then(gm)},getName:E,focus:function(){return o.then((function(m){m.focus()}))},isClosed:function(){return o.then((function(m){return ee(m)}))},setLocation:function(m,g){return g===void 0&&(g={}),o.then((function(T){var y=window.location.protocol+"//"+window.location.host,v=g.method,b=v===void 0?"get":v,L=g.body;if(m.indexOf("/")===0)m=""+y+m;else if(!m.match(/^https?:\/\//)&&m.indexOf(y)!==0)throw new Error("Expected url to be http or https url, or absolute path, got "+JSON.stringify(m));if(b==="post")return E().then((function(N){if(!N)throw new Error("Can not post to window without target name");(function(R){var q=R.url,Z=R.target,H=R.body,G=R.method,J=G===void 0?"post":G,U=document.createElement("form");if(U.setAttribute("target",Z),U.setAttribute("method",J),U.setAttribute("action",q),U.style.display="none",H)for(var B=0,ce=Object.keys(H);B<ce.length;B++){var k,gt=ce[B],Bn=document.createElement("input");Bn.setAttribute("name",gt),Bn.setAttribute("value",(k=H[gt])==null?void 0:k.toString()),U.appendChild(Bn)}vi().appendChild(U),U.submit(),vi().removeChild(U)})({url:m,target:N,method:b,body:L})}));if(b!=="get")throw new Error("Unsupported method: "+b);if(x(T))try{if(T.location&&typeof T.location.replace=="function"){T.location.replace(m);return}}catch{}T.location=m}))},setName:function(m){return o.then((function(g){var T=x(g),y=pi(g);if(!T)throw new Error("Can not set name for cross-domain window: "+m);M(g).name=m,y&&y.setAttribute("name",m),p=F.resolve(m)}))}}}var se=(function(){function o(s){var f=s.send,d=s.win,p=s.serializedWindow;this.id=void 0,this.isProxyWindow=!0,this.serializedWindow=void 0,this.actualWindow=void 0,this.actualWindowPromise=void 0,this.send=void 0,this.name=void 0,this.actualWindowPromise=new F,this.serializedWindow=p||Ri(this.actualWindowPromise,{send:f}),X("idToProxyWindow").set(this.getID(),this),d&&this.setWindow(d,{send:f})}var c=o.prototype;return c.getID=function(){return this.serializedWindow.id},c.getType=function(){return this.serializedWindow.getType()},c.isPopup=function(){return this.getType().then((function(s){return s==="popup"}))},c.setLocation=function(s,f){var d=this;return this.serializedWindow.setLocation(s,f).then((function(){return d}))},c.getName=function(){return this.serializedWindow.getName()},c.setName=function(s){var f=this;return this.serializedWindow.setName(s).then((function(){return f}))},c.close=function(){var s=this;return this.serializedWindow.close().then((function(){return s}))},c.focus=function(){var s=this,f=this.isPopup(),d=this.getName(),p=F.hash({isPopup:f,name:d}).then((function(E){var m=E.name;E.isPopup&&m&&window.open("",m,"noopener")})),h=this.serializedWindow.focus();return F.all([p,h]).then((function(){return s}))},c.isClosed=function(){return this.serializedWindow.isClosed()},c.getWindow=function(){return this.actualWindow},c.setWindow=function(s,f){var d=f.send;this.actualWindow=s,this.actualWindowPromise.resolve(this.actualWindow),this.serializedWindow=Ri(this.actualWindowPromise,{send:d,id:this.getID()}),te("winToProxyWindow").set(s,this)},c.awaitWindow=function(){return this.actualWindowPromise},c.matchWindow=function(s,f){var d=this,p=f.send;return F.try((function(){return d.actualWindow?s===d.actualWindow:F.hash({proxyInstanceID:d.getInstanceID(),knownWindowInstanceID:Ii(s,{send:p})}).then((function(h){var E=h.proxyInstanceID===h.knownWindowInstanceID;return E&&d.setWindow(s,{send:p}),E}))}))},c.unwrap=function(){return this.actualWindow||this},c.getInstanceID=function(){return this.serializedWindow.getInstanceID()},c.shouldClean=function(){return!!(this.actualWindow&&ee(this.actualWindow))},c.serialize=function(){return this.serializedWindow},o.unwrap=function(s){return o.isProxyWindow(s)?s.unwrap():s},o.serialize=function(s,f){var d=f.send;return qn(),o.toProxyWindow(s,{send:d}).serialize()},o.deserialize=function(s,f){var d=f.send;return qn(),X("idToProxyWindow").get(s.id)||new o({serializedWindow:s,send:d})},o.isProxyWindow=function(s){return!!(s&&!Ut(s)&&s.isProxyWindow)},o.toProxyWindow=function(s,f){var d=f.send;if(qn(),o.isProxyWindow(s))return s;var p=s;return te("winToProxyWindow").get(p)||new o({win:p,send:d})},o})();function Gn(o,c,s,f,d){var p=te("methodStore"),h=X("proxyWindowMethods");se.isProxyWindow(f)?h.set(o,{val:c,name:s,domain:d,source:f}):(h.del(o),p.getOrSet(f,(function(){return{}}))[o]={domain:d,name:s,val:c,source:f})}function Li(o,c){var s=te("methodStore"),f=X("proxyWindowMethods");return s.getOrSet(o,(function(){return{}}))[c]||f.get(c)}function Di(o,c,s,f,d){h=(p={on:d.on,send:d.send}).on,E=p.send,X("builtinListeners").getOrSet("functionCalls",(function(){return h("postrobot_method",{domain:"*"},(function(T){var y=T.source,v=T.origin,b=T.data,L=b.id,N=b.name,R=Li(y,L);if(!R)throw new Error("Could not find method '"+N+"' with id: "+b.id+" in "+I(window));var q=R.source,Z=R.domain,H=R.val;return F.try((function(){if(!Be(Z,v))throw new Error("Method '"+b.name+"' domain "+JSON.stringify(jn(R.domain)?R.domain.source:R.domain)+" does not match origin "+v+" in "+I(window));if(se.isProxyWindow(q))return q.matchWindow(y,{send:E}).then((function(G){if(!G)throw new Error("Method call '"+b.name+"' failed - proxy window does not match source in "+I(window))}))})).then((function(){return H.apply({source:y,origin:v},b.args)}),(function(G){return F.try((function(){if(H.onError)return H.onError(G)})).then((function(){throw G.stack&&(G.stack="Remote call to "+N+"("+(function(J){return J===void 0&&(J=[]),(U=J,[].slice.call(U)).map((function(B){return typeof B=="string"?"'"+B+"'":B===void 0?"undefined":B===null?"null":typeof B=="boolean"?B.toString():Array.isArray(B)?"[ ... ]":typeof B=="object"?"{ ... }":typeof B=="function"?"() => { ... }":"<"+typeof B+">"})).join(", ");var U})(b.args)+`) failed
6
6
 
7
- `+G.stack),G}))})).then((function(G){return{result:G,id:L,name:R}}))}))}));var p,h,E,m=s.__id__||he();o=se.unwrap(o);var g=s.__name__||s.name||f;return typeof g=="string"&&typeof g.indexOf=="function"&&g.indexOf("anonymous::")===0&&(g=g.replace("anonymous::",f+"::")),se.isProxyWindow(o)?(Wn(m,s,g,o,c),o.awaitWindow().then((function(T){Wn(m,s,g,T,c)}))):Wn(m,s,g,o,c),De("cross_domain_function",{id:m,name:g})}function Ci(o,c,s,f){var d,p=f.on,h=f.send;return(function(E,m){m===void 0&&(m=hm);var g=JSON.stringify(E,(function(T){var A=this[T];if(jn(this))return A;var v=bi(A);if(!v)return A;var b=m[v]||pm[v];return b?b(A,T):A}));return g===void 0?"undefined":g})(s,((d={}).promise=function(E,m){return(function(g,T,A,v,b){return De("cross_domain_zalgo_promise",{then:Ii(g,T,(function(L,R){return A.then(L,R)}),v,{on:b.on,send:b.send})})})(o,c,E,m,{on:p,send:h})},d.function=function(E,m){return Ii(o,c,E,m,{on:p,send:h})},d.object=function(E){return $t(E)||se.isProxyWindow(E)?De("cross_domain_window",se.serialize(E,{send:h})):E},d))}function Ri(o,c,s,f){var d,p=f.send;return(function(h,E){if(E===void 0&&(E=mm),h!=="undefined")return JSON.parse(h,(function(m,g){if(jn(this))return g;var T,A;if(jn(g)?(T=g.__type__,A=g.__val__):(T=bi(g),A=g),!T)return A;var v=E[T]||gm[T];return v?v(A,m):A}))})(s,((d={}).cross_domain_zalgo_promise=function(h){return(function(E,m,g){return new F(g.then)})(0,0,h)},d.cross_domain_function=function(h){return(function(E,m,g,T){var A=g.id,v=g.name,b=T.send,L=function(N){N===void 0&&(N={});function q(){var Z=arguments;return se.toProxyWindow(E,{send:b}).awaitWindow().then((function(H){var G=Pi(H,A);if(G&&G.val!==q)return G.val.apply({source:window,origin:I()},Z);var K=[].slice.call(Z);return N.fireAndForget?b(H,"postrobot_method",{id:A,name:v,args:K},{domain:m,fireAndForget:!0}):b(H,"postrobot_method",{id:A,name:v,args:K},{domain:m,fireAndForget:!1}).then((function(U){return U.data.result}))})).catch((function(H){throw H}))}return q.__name__=v,q.__origin__=m,q.__source__=E,q.__id__=A,q.origin=m,q},R=L();return R.fireAndForget=L({fireAndForget:!0}),R})(o,c,h,{send:p})},d.cross_domain_window=function(h){return se.deserialize(h,{send:p})},d))}var qn={};qn.postrobot_post_message=function(o,c,s){s.indexOf("file:")===0&&(s="*"),o.postMessage(c,s)};function Gn(o,c,s,f){var d=f.on,p=f.send;return F.try((function(){var h=te().getOrSet(o,(function(){return{}}));return h.buffer=h.buffer||[],h.buffer.push(s),h.flush=h.flush||F.flush().then((function(){if(ee(o))throw new Error("Window is closed");var E=Ci(o,c,((m={}).__post_robot_10_0_46__=h.buffer||[],m),{on:d,send:p}),m;delete h.buffer;for(var g=Object.keys(qn),T=[],A=0;A<g.length;A++){var v=g[A];try{qn[v](o,E,c)}catch(b){T.push(b)}}if(T.length===g.length)throw new Error(`All post-robot messaging strategies failed:
7
+ `+G.stack),G}))})).then((function(G){return{result:G,id:L,name:N}}))}))}));var p,h,E,m=s.__id__||he();o=se.unwrap(o);var g=s.__name__||s.name||f;return typeof g=="string"&&typeof g.indexOf=="function"&&g.indexOf("anonymous::")===0&&(g=g.replace("anonymous::",f+"::")),se.isProxyWindow(o)?(Gn(m,s,g,o,c),o.awaitWindow().then((function(T){Gn(m,s,g,T,c)}))):Gn(m,s,g,o,c),De("cross_domain_function",{id:m,name:g})}function $i(o,c,s,f){var d,p=f.on,h=f.send;return(function(E,m){m===void 0&&(m=Sm);var g=JSON.stringify(E,(function(T){var y=this[T];if(Wn(this))return y;var v=Ni(y);if(!v)return y;var b=m[v]||vm[v];return b?b(y,T):y}));return g===void 0?"undefined":g})(s,((d={}).promise=function(E,m){return(function(g,T,y,v,b){return De("cross_domain_zalgo_promise",{then:Di(g,T,(function(L,N){return y.then(L,N)}),v,{on:b.on,send:b.send})})})(o,c,E,m,{on:p,send:h})},d.function=function(E,m){return Di(o,c,E,m,{on:p,send:h})},d.object=function(E){return Ut(E)||se.isProxyWindow(E)?De("cross_domain_window",se.serialize(E,{send:h})):E},d))}function Ui(o,c,s,f){var d,p=f.send;return(function(h,E){if(E===void 0&&(E=bm),h!=="undefined")return JSON.parse(h,(function(m,g){if(Wn(this))return g;var T,y;if(Wn(g)?(T=g.__type__,y=g.__val__):(T=Ni(g),y=g),!T)return y;var v=E[T]||Tm[T];return v?v(y,m):y}))})(s,((d={}).cross_domain_zalgo_promise=function(h){return(function(E,m,g){return new F(g.then)})(0,0,h)},d.cross_domain_function=function(h){return(function(E,m,g,T){var y=g.id,v=g.name,b=T.send,L=function(R){R===void 0&&(R={});function q(){var Z=arguments;return se.toProxyWindow(E,{send:b}).awaitWindow().then((function(H){var G=Li(H,y);if(G&&G.val!==q)return G.val.apply({source:window,origin:I()},Z);var J=[].slice.call(Z);return R.fireAndForget?b(H,"postrobot_method",{id:y,name:v,args:J},{domain:m,fireAndForget:!0}):b(H,"postrobot_method",{id:y,name:v,args:J},{domain:m,fireAndForget:!1}).then((function(U){return U.data.result}))})).catch((function(H){throw H}))}return q.__name__=v,q.__origin__=m,q.__source__=E,q.__id__=y,q.origin=m,q},N=L();return N.fireAndForget=L({fireAndForget:!0}),N})(o,c,h,{send:p})},d.cross_domain_window=function(h){return se.deserialize(h,{send:p})},d))}var zn={};zn.postrobot_post_message=function(o,c,s){s.indexOf("file:")===0&&(s="*"),o.postMessage(c,s)};function Hn(o,c,s,f){var d=f.on,p=f.send;return F.try((function(){var h=te().getOrSet(o,(function(){return{}}));return h.buffer=h.buffer||[],h.buffer.push(s),h.flush=h.flush||F.flush().then((function(){if(ee(o))throw new Error("Window is closed");var E=$i(o,c,((m={}).__post_robot_10_0_46__=h.buffer||[],m),{on:d,send:p}),m;delete h.buffer;for(var g=Object.keys(zn),T=[],y=0;y<g.length;y++){var v=g[y];try{zn[v](o,E,c)}catch(b){T.push(b)}}if(T.length===g.length)throw new Error(`All post-robot messaging strategies failed:
8
8
 
9
- `+T.map((function(b,L){return L+". "+lt(b)})).join(`
9
+ `+T.map((function(b,L){return L+". "+_t(b)})).join(`
10
10
 
11
- `))})),h.flush.then((function(){delete h.flush}))})).then(Le)}function Ni(o){return X("responseListeners").get(o)}function Li(o){X("responseListeners").del(o)}function Di(o){return X("erroredResponseListeners").has(o)}function $i(o){var c=o.name,s=o.win,f=o.domain,d=te("requestListeners");if(s==="*"&&(s=null),f==="*"&&(f=null),!c)throw new Error("Name required to get request listener");for(var p=0,h=[s,jt()];p<h.length;p++){var E=h[p];if(E){var m=d.get(E);if(m){var g=m[c];if(g){if(f&&typeof f=="string"){if(g[f])return g[f];if(g.__domain_regex__)for(var T=0,A=g.__domain_regex__;T<A.length;T++){var v=A[T],b=v.listener;if(Be(v.regex,f))return b}}if(g["*"])return g["*"]}}}}}function Em(o,c,s,f){var d=f.on,p=f.send,h=$i({name:s.name,win:o,domain:c}),E=s.name==="postrobot_method"&&s.data&&typeof s.data.name=="string"?s.data.name+"()":s.name;function m(g,T,A){return F.flush().then((function(){if(!s.fireAndForget&&!ee(o))try{return Gn(o,c,{id:he(),origin:I(window),type:"postrobot_message_response",hash:s.hash,name:s.name,ack:g,data:T,error:A},{on:d,send:p})}catch(v){throw new Error("Send response message failed for "+E+" in "+I()+`
11
+ `))})),h.flush.then((function(){delete h.flush}))})).then(Le)}function Mi(o){return X("responseListeners").get(o)}function xi(o){X("responseListeners").del(o)}function ji(o){return X("erroredResponseListeners").has(o)}function Fi(o){var c=o.name,s=o.win,f=o.domain,d=te("requestListeners");if(s==="*"&&(s=null),f==="*"&&(f=null),!c)throw new Error("Name required to get request listener");for(var p=0,h=[s,Ft()];p<h.length;p++){var E=h[p];if(E){var m=d.get(E);if(m){var g=m[c];if(g){if(f&&typeof f=="string"){if(g[f])return g[f];if(g.__domain_regex__)for(var T=0,y=g.__domain_regex__;T<y.length;T++){var v=y[T],b=v.listener;if(Be(v.regex,f))return b}}if(g["*"])return g["*"]}}}}}function Om(o,c,s,f){var d=f.on,p=f.send,h=Fi({name:s.name,win:o,domain:c}),E=s.name==="postrobot_method"&&s.data&&typeof s.data.name=="string"?s.data.name+"()":s.name;function m(g,T,y){return F.flush().then((function(){if(!s.fireAndForget&&!ee(o))try{return Hn(o,c,{id:he(),origin:I(window),type:"postrobot_message_response",hash:s.hash,name:s.name,ack:g,data:T,error:y},{on:d,send:p})}catch(v){throw new Error("Send response message failed for "+E+" in "+I()+`
12
12
 
13
- `+lt(v))}}))}return F.all([F.flush().then((function(){if(!s.fireAndForget&&!ee(o))try{return Gn(o,c,{id:he(),origin:I(window),type:"postrobot_message_ack",hash:s.hash,name:s.name},{on:d,send:p})}catch(g){throw new Error("Send ack message failed for "+E+" in "+I()+`
13
+ `+_t(v))}}))}return F.all([F.flush().then((function(){if(!s.fireAndForget&&!ee(o))try{return Hn(o,c,{id:he(),origin:I(window),type:"postrobot_message_ack",hash:s.hash,name:s.name},{on:d,send:p})}catch(g){throw new Error("Send ack message failed for "+E+" in "+I()+`
14
14
 
15
- `+lt(g))}})),F.try((function(){if(!h)throw new Error("No handler found for post message: "+s.name+" from "+c+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);return h.handler({source:o,origin:c,data:s.data})})).then((function(g){return m("success",g)}),(function(g){return m("error",null,g)}))]).then(Le).catch((function(g){if(h&&h.handleError)return h.handleError(g);throw g}))}function wm(o,c,s){if(!Di(s.hash)){var f=Ni(s.hash);if(!f)throw new Error("No handler found for post message ack for message: "+s.name+" from "+c+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);try{if(!Be(f.domain,c))throw new Error("Ack origin "+c+" does not match domain "+f.domain.toString());if(o!==f.win)throw new Error("Ack source does not match registered window")}catch(d){f.promise.reject(d)}f.ack=!0}}function Am(o,c,s){if(!Di(s.hash)){var f=Ni(s.hash);if(!f)throw new Error("No handler found for post message response for message: "+s.name+" from "+c+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Be(f.domain,c))throw new Error("Response origin "+c+" does not match domain "+(d=f.domain,Array.isArray(d)?"("+d.join(" | ")+")":a(d)?"RegExp("+d.toString()+")":d.toString()));var d;if(o!==f.win)throw new Error("Response source does not match registered window");Li(s.hash),s.ack==="error"?f.promise.reject(s.error):s.ack==="success"&&f.promise.resolve({source:o,origin:c,data:s.data})}}function Ui(o,c){var s=c.on,f=c.send,d=X("receivedMessages");try{if(!window||window.closed||!o.source)return}catch{return}var p=o.source,h=o.origin,E=(function(T,A,v,b){var L=b.on,R=b.send,N;try{N=Ri(A,v,T,{on:L,send:R})}catch{return}if(N&&typeof N=="object"&&N!==null){var q=N.__post_robot_10_0_46__;if(Array.isArray(q))return q}})(o.data,p,h,{on:s,send:f});if(E){Ti(p);for(var m=0;m<E.length;m++){var g=E[m];if(d.has(g.id)||(d.set(g.id,!0),ee(p)&&!g.fireAndForget))return;g.origin.indexOf("file:")===0&&(h="file://");try{g.type==="postrobot_message_request"?Em(p,h,g,{on:s,send:f}):g.type==="postrobot_message_response"?Am(p,h,g):g.type==="postrobot_message_ack"&&wm(p,h,g)}catch(T){setTimeout((function(){throw T}),0)}}}}function $e(o,c,s){if(!o)throw new Error("Expected name");if(typeof(c=c||{})=="function"&&(s=c,c={}),!s)throw new Error("Expected handler");var f=(function d(p,h){var E=p.name,m=p.win,g=p.domain,T=te("requestListeners");if(!E||typeof E!="string")throw new Error("Name required to add request listener");if(m&&m!=="*"&&se.isProxyWindow(m)){var A=m.awaitWindow().then((function(k){return d({name:E,win:k,domain:g},h)}));return{cancel:function(){A.then((function(k){return k.cancel()}),Le)}}}var v=m;if(Array.isArray(v)){for(var b=[],L=0,R=v;L<R.length;L++)b.push(d({name:E,domain:g,win:R[L]},h));return{cancel:function(){for(var k=0;k<b.length;k++)b[k].cancel()}}}if(Array.isArray(g)){for(var N=[],q=0,Z=g;q<Z.length;q++)N.push(d({name:E,win:v,domain:Z[q]},h));return{cancel:function(){for(var k=0;k<N.length;k++)N[k].cancel()}}}var H=$i({name:E,win:v,domain:g});v&&v!=="*"||(v=jt());var G=(g=g||"*").toString();if(H)throw v&&g?new Error("Request listener already exists for "+E+" on domain "+g.toString()+" for "+(v===jt()?"wildcard":"specified")+" window"):v?new Error("Request listener already exists for "+E+" for "+(v===jt()?"wildcard":"specified")+" window"):g?new Error("Request listener already exists for "+E+" on domain "+g.toString()):new Error("Request listener already exists for "+E);var K=T.getOrSet(v,(function(){return{}})),U=_t(K,E,(function(){return{}})),B,ce;return Mn(g)?(B=_t(U,"__domain_regex__",(function(){return[]}))).push(ce={regex:g,listener:h}):U[G]=h,{cancel:function(){delete U[G],ce&&(B.splice(B.indexOf(ce,1)),B.length||delete U.__domain_regex__),Object.keys(U).length||delete K[E],v&&!Object.keys(K).length&&T.del(v)}}})({name:o,win:c.window,domain:c.domain||"*"},{handler:s||c.handler,handleError:c.errorHandler||function(d){throw d}});return{cancel:function(){f.cancel()}}}function ym(o,c,s){typeof(c=c||{})=="function"&&(s=c,c={});var f=new F,d;return c.errorHandler=function(p){d.cancel(),f.reject(p)},d=$e(o,c,(function(p){if(d.cancel(),f.resolve(p),s)return s(p)})),f.cancel=d.cancel,f}var Se=function o(c,s,f,d){var p=(d=d||{}).domain||"*",h=d.timeout||-1,E=d.timeout||5e3,m=d.fireAndForget||!1;return se.toProxyWindow(c,{send:o}).awaitWindow().then((function(g){return F.try((function(){if((function(T,A,v){if(!T)throw new Error("Expected name");if(typeof v!="string"&&!Array.isArray(v)&&!Mn(v))throw new TypeError("Can not send "+T+". Expected domain "+JSON.stringify(v)+" to be a string, array, or regex");if(ee(A))throw new Error("Can not send "+T+". Target window is closed")})(s,g,p),(function(T,A){var v=ci(A);if(v)return v===T;if(A===T||(function(R){R===void 0&&(R=window);try{if(R.top)return R.top}catch{}if(w(R)===R)return R;try{if(j(window,R)&&window.top)return window.top}catch{}try{if(j(R,window)&&window.top)return window.top}catch{}for(var N=0,q=(function H(G){for(var K=[],U=0,B=Y(G);U<B.length;U++){var ce=B[U];K.push(ce);for(var k=0,ht=H(ce);k<ht.length;k++)K.push(ht[k])}return K})(R);N<q.length;N++){var Z=q[N];try{if(Z.top)return Z.top}catch{}if(w(Z)===Z)return Z}})(A)===A)return!1;for(var b=0,L=Y(T);b<L.length;b++)if(L[b]===A)return!0;return!1})(window,g))return(function(T,A,v){A===void 0&&(A=5e3),v===void 0&&(v="Window");var b=(function(L){return te("helloPromises").getOrSet(L,(function(){return new F}))})(T);return A!==-1&&(b=b.timeout(A,new Error(v+" did not load after "+A+"ms"))),b})(g,E)})).then((function(T){return(function(A,v,b,L){var R=L.send;return F.try((function(){return typeof v=="string"?v:F.try((function(){return b||xn(A,{send:R}).then((function(N){return N.domain}))})).then((function(N){if(!Be(v,v))throw new Error("Domain "+gi(v)+" does not match "+gi(v));return N}))}))})(g,p,(T===void 0?{}:T).domain,{send:o})})).then((function(T){var A=T,v=s==="postrobot_method"&&f&&typeof f.name=="string"?f.name+"()":s,b=new F,L=s+"_"+he();if(!m){var R={name:s,win:g,domain:A,promise:b};(function(U,B){X("responseListeners").set(U,B)})(L,R);var N=te("requestPromises").getOrSet(g,(function(){return[]}));N.push(b),b.catch((function(){(function(U){X("erroredResponseListeners").set(U,!0)})(L),Li(L)}));var q=(function(U){return te("knownWindows").get(U,!1)})(g)?1e4:2e3,Z=h,H=q,G=Z,K=(function(U,B){var ce;return(function k(){ce=setTimeout((function(){(function(){if(ee(g))return b.reject(new Error("Window closed for "+s+" before "+(R.ack?"response":"ack")));if(R.cancelled)return b.reject(new Error("Response listener was cancelled for "+s));H=Math.max(H-500,0),G!==-1&&(G=Math.max(G-500,0)),R.ack||H!==0?G===0&&b.reject(new Error("No response for postMessage "+v+" in "+I()+" in "+Z+"ms")):b.reject(new Error("No ack for postMessage "+v+" in "+I()+" in "+q+"ms"))})(),k()}),500)})(),{cancel:function(){clearTimeout(ce)}}})();b.finally((function(){K.cancel(),N.splice(N.indexOf(b,1))})).catch(Le)}return Gn(g,A,{id:he(),origin:I(window),type:"postrobot_message_request",hash:L,name:s,data:f,fireAndForget:m},{on:$e,send:o}).then((function(){return m?b.resolve():b}),(function(U){throw new Error("Send request message failed for "+v+" in "+I()+`
15
+ `+_t(g))}})),F.try((function(){if(!h)throw new Error("No handler found for post message: "+s.name+" from "+c+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);return h.handler({source:o,origin:c,data:s.data})})).then((function(g){return m("success",g)}),(function(g){return m("error",null,g)}))]).then(Le).catch((function(g){if(h&&h.handleError)return h.handleError(g);throw g}))}function Pm(o,c,s){if(!ji(s.hash)){var f=Mi(s.hash);if(!f)throw new Error("No handler found for post message ack for message: "+s.name+" from "+c+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);try{if(!Be(f.domain,c))throw new Error("Ack origin "+c+" does not match domain "+f.domain.toString());if(o!==f.win)throw new Error("Ack source does not match registered window")}catch(d){f.promise.reject(d)}f.ack=!0}}function Im(o,c,s){if(!ji(s.hash)){var f=Mi(s.hash);if(!f)throw new Error("No handler found for post message response for message: "+s.name+" from "+c+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!Be(f.domain,c))throw new Error("Response origin "+c+" does not match domain "+(d=f.domain,Array.isArray(d)?"("+d.join(" | ")+")":a(d)?"RegExp("+d.toString()+")":d.toString()));var d;if(o!==f.win)throw new Error("Response source does not match registered window");xi(s.hash),s.ack==="error"?f.promise.reject(s.error):s.ack==="success"&&f.promise.resolve({source:o,origin:c,data:s.data})}}function Wi(o,c){var s=c.on,f=c.send,d=X("receivedMessages");try{if(!window||window.closed||!o.source)return}catch{return}var p=o.source,h=o.origin,E=(function(T,y,v,b){var L=b.on,N=b.send,R;try{R=Ui(y,v,T,{on:L,send:N})}catch{return}if(R&&typeof R=="object"&&R!==null){var q=R.__post_robot_10_0_46__;if(Array.isArray(q))return q}})(o.data,p,h,{on:s,send:f});if(E){Ci(p);for(var m=0;m<E.length;m++){var g=E[m];if(d.has(g.id)||(d.set(g.id,!0),ee(p)&&!g.fireAndForget))return;g.origin.indexOf("file:")===0&&(h="file://");try{g.type==="postrobot_message_request"?Om(p,h,g,{on:s,send:f}):g.type==="postrobot_message_response"?Im(p,h,g):g.type==="postrobot_message_ack"&&Pm(p,h,g)}catch(T){setTimeout((function(){throw T}),0)}}}}function $e(o,c,s){if(!o)throw new Error("Expected name");if(typeof(c=c||{})=="function"&&(s=c,c={}),!s)throw new Error("Expected handler");var f=(function d(p,h){var E=p.name,m=p.win,g=p.domain,T=te("requestListeners");if(!E||typeof E!="string")throw new Error("Name required to add request listener");if(m&&m!=="*"&&se.isProxyWindow(m)){var y=m.awaitWindow().then((function(k){return d({name:E,win:k,domain:g},h)}));return{cancel:function(){y.then((function(k){return k.cancel()}),Le)}}}var v=m;if(Array.isArray(v)){for(var b=[],L=0,N=v;L<N.length;L++)b.push(d({name:E,domain:g,win:N[L]},h));return{cancel:function(){for(var k=0;k<b.length;k++)b[k].cancel()}}}if(Array.isArray(g)){for(var R=[],q=0,Z=g;q<Z.length;q++)R.push(d({name:E,win:v,domain:Z[q]},h));return{cancel:function(){for(var k=0;k<R.length;k++)R[k].cancel()}}}var H=Fi({name:E,win:v,domain:g});v&&v!=="*"||(v=Ft());var G=(g=g||"*").toString();if(H)throw v&&g?new Error("Request listener already exists for "+E+" on domain "+g.toString()+" for "+(v===Ft()?"wildcard":"specified")+" window"):v?new Error("Request listener already exists for "+E+" for "+(v===Ft()?"wildcard":"specified")+" window"):g?new Error("Request listener already exists for "+E+" on domain "+g.toString()):new Error("Request listener already exists for "+E);var J=T.getOrSet(v,(function(){return{}})),U=pt(J,E,(function(){return{}})),B,ce;return jn(g)?(B=pt(U,"__domain_regex__",(function(){return[]}))).push(ce={regex:g,listener:h}):U[G]=h,{cancel:function(){delete U[G],ce&&(B.splice(B.indexOf(ce,1)),B.length||delete U.__domain_regex__),Object.keys(U).length||delete J[E],v&&!Object.keys(J).length&&T.del(v)}}})({name:o,win:c.window,domain:c.domain||"*"},{handler:s||c.handler,handleError:c.errorHandler||function(d){throw d}});return{cancel:function(){f.cancel()}}}function Cm(o,c,s){typeof(c=c||{})=="function"&&(s=c,c={});var f=new F,d;return c.errorHandler=function(p){d.cancel(),f.reject(p)},d=$e(o,c,(function(p){if(d.cancel(),f.resolve(p),s)return s(p)})),f.cancel=d.cancel,f}var Se=function o(c,s,f,d){var p=(d=d||{}).domain||"*",h=d.timeout||-1,E=d.timeout||5e3,m=d.fireAndForget||!1;return se.toProxyWindow(c,{send:o}).awaitWindow().then((function(g){return F.try((function(){if((function(T,y,v){if(!T)throw new Error("Expected name");if(typeof v!="string"&&!Array.isArray(v)&&!jn(v))throw new TypeError("Can not send "+T+". Expected domain "+JSON.stringify(v)+" to be a string, array, or regex");if(ee(y))throw new Error("Can not send "+T+". Target window is closed")})(s,g,p),(function(T,y){var v=_i(y);if(v)return v===T;if(y===T||(function(N){N===void 0&&(N=window);try{if(N.top)return N.top}catch{}if(w(N)===N)return N;try{if(j(window,N)&&window.top)return window.top}catch{}try{if(j(N,window)&&window.top)return window.top}catch{}for(var R=0,q=(function H(G){for(var J=[],U=0,B=V(G);U<B.length;U++){var ce=B[U];J.push(ce);for(var k=0,gt=H(ce);k<gt.length;k++)J.push(gt[k])}return J})(N);R<q.length;R++){var Z=q[R];try{if(Z.top)return Z.top}catch{}if(w(Z)===Z)return Z}})(y)===y)return!1;for(var b=0,L=V(T);b<L.length;b++)if(L[b]===y)return!0;return!1})(window,g))return(function(T,y,v){y===void 0&&(y=5e3),v===void 0&&(v="Window");var b=(function(L){return te("helloPromises").getOrSet(L,(function(){return new F}))})(T);return y!==-1&&(b=b.timeout(y,new Error(v+" did not load after "+y+"ms"))),b})(g,E)})).then((function(T){return(function(y,v,b,L){var N=L.send;return F.try((function(){return typeof v=="string"?v:F.try((function(){return b||Fn(y,{send:N}).then((function(R){return R.domain}))})).then((function(R){if(!Be(v,v))throw new Error("Domain "+yi(v)+" does not match "+yi(v));return R}))}))})(g,p,(T===void 0?{}:T).domain,{send:o})})).then((function(T){var y=T,v=s==="postrobot_method"&&f&&typeof f.name=="string"?f.name+"()":s,b=new F,L=s+"_"+he();if(!m){var N={name:s,win:g,domain:y,promise:b};(function(U,B){X("responseListeners").set(U,B)})(L,N);var R=te("requestPromises").getOrSet(g,(function(){return[]}));R.push(b),b.catch((function(){(function(U){X("erroredResponseListeners").set(U,!0)})(L),xi(L)}));var q=(function(U){return te("knownWindows").get(U,!1)})(g)?1e4:2e3,Z=h,H=q,G=Z,J=(function(U,B){var ce;return(function k(){ce=setTimeout((function(){(function(){if(ee(g))return b.reject(new Error("Window closed for "+s+" before "+(N.ack?"response":"ack")));if(N.cancelled)return b.reject(new Error("Response listener was cancelled for "+s));H=Math.max(H-500,0),G!==-1&&(G=Math.max(G-500,0)),N.ack||H!==0?G===0&&b.reject(new Error("No response for postMessage "+v+" in "+I()+" in "+Z+"ms")):b.reject(new Error("No ack for postMessage "+v+" in "+I()+" in "+q+"ms"))})(),k()}),500)})(),{cancel:function(){clearTimeout(ce)}}})();b.finally((function(){J.cancel(),R.splice(R.indexOf(b,1))})).catch(Le)}return Hn(g,y,{id:he(),origin:I(window),type:"postrobot_message_request",hash:L,name:s,data:f,fireAndForget:m},{on:$e,send:o}).then((function(){return m?b.resolve():b}),(function(U){throw new Error("Send request message failed for "+v+" in "+I()+`
16
16
 
17
- `+lt(U))}))}))}))};function vm(o,c,s){return Ci(o,c,s,{on:$e,send:Se})}function Sm(o,c,s){return Ri(o,c,s,{send:Se})}function Tm(o){return new se({send:Se,win:o})}function bm(o){return se.toProxyWindow(o,{send:Se})}function Mi(){pt().initialized||(pt().initialized=!0,c=(o={on:$e,send:Se}).on,s=o.send,(f=pt()).receiveMessage=f.receiveMessage||function(d){return Ui(d,{on:c,send:s})},(function(d){var p=d.on,h=d.send;X().getOrSet("postMessageListener",(function(){return(function(E,m,g){return E.addEventListener("message",g),{cancel:function(){E.removeEventListener("message",g)}}})(window,0,(function(E){(function(m,g){var T=g.on,A=g.send;F.try((function(){var v=m.source||m.sourceElement,b=m.origin||m.originalEvent&&m.originalEvent.origin,L=m.data;if(b==="null"&&(b="file://"),v){if(!b)throw new Error("Post message did not have origin domain");Ui({source:v,origin:b,data:L},{on:T,send:A})}}))})(E,{on:p,send:h})}))}))})({on:$e,send:Se}),(function(d){var p=d.on,h=d.send;X("builtinListeners").getOrSet("helloListener",(function(){var E=p("postrobot_hello",{domain:"*"},(function(g){return vi(g.source,{domain:g.origin}),{instanceID:yi()}})),m=ci();return m&&xn(m,{send:h}).catch((function(g){})),E}))})({on:$e,send:Se}));var o,c,s,f}function Om(){(function(){for(var c=X("responseListeners"),s=0,f=c.keys();s<f.length;s++){var d=f[s],p=c.get(d);p&&(p.cancelled=!0),c.del(d)}})(),(o=X().get("postMessageListener"))&&o.cancel();var o;delete window.__post_robot_10_0_46__}var Pm=!0;function Im(o){for(var c=0,s=te("requestPromises").get(o,[]);c<s.length;c++)s[c].reject(new Error("Window "+(ee(o)?"closed":"cleaned up")+" before response")).catch(Le)}Mi()}])}))})(gt)),gt.exports}var Bn;function Wi(){return Bn||(Bn=1,(function(e){e.exports=Fi(),e.exports.default=e.exports})(Ft)),Ft.exports}var Vn=Wi();const Yn=xi(Vn),qi=Ve({__proto__:null,default:Yn},[Vn]);var kn=typeof global=="object"&&global&&global.Object===Object&&global,Gi=typeof self=="object"&&self&&self.Object===Object&&self,_e=kn||Gi||Function("return this")(),ae=_e.Symbol,Zn=Object.prototype,zi=Zn.hasOwnProperty,Hi=Zn.toString,Ye=ae?ae.toStringTag:void 0;function Bi(e){var t=zi.call(e,Ye),n=e[Ye];try{e[Ye]=void 0;var r=!0}catch{}var i=Hi.call(e);return r&&(t?e[Ye]=n:delete e[Ye]),i}var Vi=Object.prototype,Yi=Vi.toString;function ki(e){return Yi.call(e)}var Zi="[object Null]",Xi="[object Undefined]",Xn=ae?ae.toStringTag:void 0;function Te(e){return e==null?e===void 0?Xi:Zi:Xn&&Xn in Object(e)?Bi(e):ki(e)}function pe(e){return e!=null&&typeof e=="object"}var Ki="[object Symbol]";function Wt(e){return typeof e=="symbol"||pe(e)&&Te(e)==Ki}function qt(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var ne=Array.isArray,Kn=ae?ae.prototype:void 0,Jn=Kn?Kn.toString:void 0;function Qn(e){if(typeof e=="string")return e;if(ne(e))return qt(e,Qn)+"";if(Wt(e))return Jn?Jn.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function ue(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function Gt(e){return e}var Ji="[object AsyncFunction]",Qi="[object Function]",es="[object GeneratorFunction]",ts="[object Proxy]";function zt(e){if(!ue(e))return!1;var t=Te(e);return t==Qi||t==es||t==Ji||t==ts}var Ht=_e["__core-js_shared__"],er=(function(){var e=/[^.]+$/.exec(Ht&&Ht.keys&&Ht.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function ns(e){return!!er&&er in e}var rs=Function.prototype,os=rs.toString;function be(e){if(e!=null){try{return os.call(e)}catch{}try{return e+""}catch{}}return""}var is=/[\\^$.*+?()[\]{}|]/g,ss=/^\[object .+?Constructor\]$/,as=Function.prototype,cs=Object.prototype,us=as.toString,fs=cs.hasOwnProperty,ds=RegExp("^"+us.call(fs).replace(is,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ls(e){if(!ue(e)||ns(e))return!1;var t=zt(e)?ds:ss;return t.test(be(e))}function _s(e,t){return e?.[t]}function Oe(e,t){var n=_s(e,t);return ls(n)?n:void 0}var Bt=Oe(_e,"WeakMap"),tr=Object.create,ps=(function(){function e(){}return function(t){if(!ue(t))return{};if(tr)return tr(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}})();function hs(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function nr(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var gs=800,ms=16,Es=Date.now;function ws(e){var t=0,n=0;return function(){var r=Es(),i=ms-(r-n);if(n=r,i>0){if(++t>=gs)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function As(e){return function(){return e}}var mt=(function(){try{var e=Oe(Object,"defineProperty");return e({},"",{}),e}catch{}})(),ys=mt?function(e,t){return mt(e,"toString",{configurable:!0,enumerable:!1,value:As(t),writable:!0})}:Gt,rr=ws(ys);function vs(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var Ss=9007199254740991,Ts=/^(?:0|[1-9]\d*)$/;function Et(e,t){var n=typeof e;return t=t??Ss,!!t&&(n=="number"||n!="symbol"&&Ts.test(e))&&e>-1&&e%1==0&&e<t}function Vt(e,t,n){t=="__proto__"&&mt?mt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ke(e,t){return e===t||e!==e&&t!==t}var bs=Object.prototype,Os=bs.hasOwnProperty;function Yt(e,t,n){var r=e[t];(!(Os.call(e,t)&&ke(r,n))||n===void 0&&!(t in e))&&Vt(e,t,n)}function Ue(e,t,n,r){var i=!n;n||(n={});for(var a=-1,u=t.length;++a<u;){var l=t[a],_=void 0;_===void 0&&(_=e[l]),i?Vt(n,l,_):Yt(n,l,_)}return n}var or=Math.max;function ir(e,t,n){return t=or(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=or(r.length-t,0),u=Array(a);++i<a;)u[i]=r[t+i];i=-1;for(var l=Array(t+1);++i<t;)l[i]=r[i];return l[t]=n(u),hs(e,this,l)}}function Ps(e,t){return rr(ir(e,t,Gt),e+"")}var Is=9007199254740991;function kt(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Is}function wt(e){return e!=null&&kt(e.length)&&!zt(e)}function Cs(e,t,n){if(!ue(n))return!1;var r=typeof t;return(r=="number"?wt(n)&&Et(t,n.length):r=="string"&&t in n)?ke(n[t],e):!1}function Rs(e){return Ps(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,u=i>2?n[2]:void 0;for(a=e.length>3&&typeof a=="function"?(i--,a):void 0,u&&Cs(n[0],n[1],u)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var l=n[r];l&&e(t,l,r,a)}return t})}var Ns=Object.prototype;function Zt(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Ns;return e===n}function Ls(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var Ds="[object Arguments]";function sr(e){return pe(e)&&Te(e)==Ds}var ar=Object.prototype,$s=ar.hasOwnProperty,Us=ar.propertyIsEnumerable,Ze=sr((function(){return arguments})())?sr:function(e){return pe(e)&&$s.call(e,"callee")&&!Us.call(e,"callee")};function Ms(){return!1}var cr=typeof y=="object"&&y&&!y.nodeType&&y,ur=cr&&typeof module=="object"&&module&&!module.nodeType&&module,xs=ur&&ur.exports===cr,fr=xs?_e.Buffer:void 0,js=fr?fr.isBuffer:void 0,Xe=js||Ms,Fs="[object Arguments]",Ws="[object Array]",qs="[object Boolean]",Gs="[object Date]",zs="[object Error]",Hs="[object Function]",Bs="[object Map]",Vs="[object Number]",Ys="[object Object]",ks="[object RegExp]",Zs="[object Set]",Xs="[object String]",Ks="[object WeakMap]",Js="[object ArrayBuffer]",Qs="[object DataView]",ea="[object Float32Array]",ta="[object Float64Array]",na="[object Int8Array]",ra="[object Int16Array]",oa="[object Int32Array]",ia="[object Uint8Array]",sa="[object Uint8ClampedArray]",aa="[object Uint16Array]",ca="[object Uint32Array]",z={};z[ea]=z[ta]=z[na]=z[ra]=z[oa]=z[ia]=z[sa]=z[aa]=z[ca]=!0,z[Fs]=z[Ws]=z[Js]=z[qs]=z[Qs]=z[Gs]=z[zs]=z[Hs]=z[Bs]=z[Vs]=z[Ys]=z[ks]=z[Zs]=z[Xs]=z[Ks]=!1;function ua(e){return pe(e)&&kt(e.length)&&!!z[Te(e)]}function Xt(e){return function(t){return e(t)}}var dr=typeof y=="object"&&y&&!y.nodeType&&y,Ke=dr&&typeof module=="object"&&module&&!module.nodeType&&module,fa=Ke&&Ke.exports===dr,Kt=fa&&kn.process,Me=(function(){try{var e=Ke&&Ke.require&&Ke.require("util").types;return e||Kt&&Kt.binding&&Kt.binding("util")}catch{}})(),lr=Me&&Me.isTypedArray,Jt=lr?Xt(lr):ua,da=Object.prototype,la=da.hasOwnProperty;function _r(e,t){var n=ne(e),r=!n&&Ze(e),i=!n&&!r&&Xe(e),a=!n&&!r&&!i&&Jt(e),u=n||r||i||a,l=u?Ls(e.length,String):[],_=l.length;for(var S in e)(t||la.call(e,S))&&!(u&&(S=="length"||i&&(S=="offset"||S=="parent")||a&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||Et(S,_)))&&l.push(S);return l}function pr(e,t){return function(n){return e(t(n))}}var _a=pr(Object.keys,Object),pa=Object.prototype,ha=pa.hasOwnProperty;function ga(e){if(!Zt(e))return _a(e);var t=[];for(var n in Object(e))ha.call(e,n)&&n!="constructor"&&t.push(n);return t}function At(e){return wt(e)?_r(e):ga(e)}function ma(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Ea=Object.prototype,wa=Ea.hasOwnProperty;function Aa(e){if(!ue(e))return ma(e);var t=Zt(e),n=[];for(var r in e)r=="constructor"&&(t||!wa.call(e,r))||n.push(r);return n}function Je(e){return wt(e)?_r(e,!0):Aa(e)}var ya=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,va=/^\w*$/;function Qt(e,t){if(ne(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Wt(e)?!0:va.test(e)||!ya.test(e)||t!=null&&e in Object(t)}var Qe=Oe(Object,"create");function Sa(){this.__data__=Qe?Qe(null):{},this.size=0}function Ta(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var ba="__lodash_hash_undefined__",Oa=Object.prototype,Pa=Oa.hasOwnProperty;function Ia(e){var t=this.__data__;if(Qe){var n=t[e];return n===ba?void 0:n}return Pa.call(t,e)?t[e]:void 0}var Ca=Object.prototype,Ra=Ca.hasOwnProperty;function Na(e){var t=this.__data__;return Qe?t[e]!==void 0:Ra.call(t,e)}var La="__lodash_hash_undefined__";function Da(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Qe&&t===void 0?La:t,this}function Pe(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Pe.prototype.clear=Sa,Pe.prototype.delete=Ta,Pe.prototype.get=Ia,Pe.prototype.has=Na,Pe.prototype.set=Da;function $a(){this.__data__=[],this.size=0}function yt(e,t){for(var n=e.length;n--;)if(ke(e[n][0],t))return n;return-1}var Ua=Array.prototype,Ma=Ua.splice;function xa(e){var t=this.__data__,n=yt(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Ma.call(t,n,1),--this.size,!0}function ja(e){var t=this.__data__,n=yt(t,e);return n<0?void 0:t[n][1]}function Fa(e){return yt(this.__data__,e)>-1}function Wa(e,t){var n=this.__data__,r=yt(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function ge(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}ge.prototype.clear=$a,ge.prototype.delete=xa,ge.prototype.get=ja,ge.prototype.has=Fa,ge.prototype.set=Wa;var et=Oe(_e,"Map");function qa(){this.size=0,this.__data__={hash:new Pe,map:new(et||ge),string:new Pe}}function Ga(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function vt(e,t){var n=e.__data__;return Ga(t)?n[typeof t=="string"?"string":"hash"]:n.map}function za(e){var t=vt(this,e).delete(e);return this.size-=t?1:0,t}function Ha(e){return vt(this,e).get(e)}function Ba(e){return vt(this,e).has(e)}function Va(e,t){var n=vt(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function me(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}me.prototype.clear=qa,me.prototype.delete=za,me.prototype.get=Ha,me.prototype.has=Ba,me.prototype.set=Va;var Ya="Expected a function";function en(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Ya);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var u=e.apply(this,r);return n.cache=a.set(i,u)||a,u};return n.cache=new(en.Cache||me),n}en.Cache=me;var ka=500;function Za(e){var t=en(e,function(r){return n.size===ka&&n.clear(),r}),n=t.cache;return t}var Xa=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ka=/\\(\\)?/g,Ja=Za(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Xa,function(n,r,i,a){t.push(i?a.replace(Ka,"$1"):r||n)}),t});function tt(e){return e==null?"":Qn(e)}function xe(e,t){return ne(e)?e:Qt(e,t)?[e]:Ja(tt(e))}function Ie(e){if(typeof e=="string"||Wt(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function St(e,t){t=xe(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Ie(t[n++])];return n&&n==r?e:void 0}function Qa(e,t,n){var r=e==null?void 0:St(e,t);return r===void 0?n:r}function tn(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var hr=ae?ae.isConcatSpreadable:void 0;function ec(e){return ne(e)||Ze(e)||!!(hr&&e&&e[hr])}function tc(e,t,n,r,i){var a=-1,u=e.length;for(n||(n=ec),i||(i=[]);++a<u;){var l=e[a];n(l)?tn(i,l):i[i.length]=l}return i}function nc(e){var t=e==null?0:e.length;return t?tc(e):[]}function rc(e){return rr(ir(e,void 0,nc),e+"")}var nn=pr(Object.getPrototypeOf,Object),oc="[object Object]",ic=Function.prototype,sc=Object.prototype,gr=ic.toString,ac=sc.hasOwnProperty,cc=gr.call(Object);function mr(e){if(!pe(e)||Te(e)!=oc)return!1;var t=nn(e);if(t===null)return!0;var n=ac.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&gr.call(n)==cc}function Er(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}function uc(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:Er(e,t,n)}var fc="\\ud800-\\udfff",dc="\\u0300-\\u036f",lc="\\ufe20-\\ufe2f",_c="\\u20d0-\\u20ff",pc=dc+lc+_c,hc="\\ufe0e\\ufe0f",gc="\\u200d",mc=RegExp("["+gc+fc+pc+hc+"]");function wr(e){return mc.test(e)}function Ec(e){return e.split("")}var Ar="\\ud800-\\udfff",wc="\\u0300-\\u036f",Ac="\\ufe20-\\ufe2f",yc="\\u20d0-\\u20ff",vc=wc+Ac+yc,Sc="\\ufe0e\\ufe0f",Tc="["+Ar+"]",rn="["+vc+"]",on="\\ud83c[\\udffb-\\udfff]",bc="(?:"+rn+"|"+on+")",yr="[^"+Ar+"]",vr="(?:\\ud83c[\\udde6-\\uddff]){2}",Sr="[\\ud800-\\udbff][\\udc00-\\udfff]",Oc="\\u200d",Tr=bc+"?",br="["+Sc+"]?",Pc="(?:"+Oc+"(?:"+[yr,vr,Sr].join("|")+")"+br+Tr+")*",Ic=br+Tr+Pc,Cc="(?:"+[yr+rn+"?",rn,vr,Sr,Tc].join("|")+")",Rc=RegExp(on+"(?="+on+")|"+Cc+Ic,"g");function Nc(e){return e.match(Rc)||[]}function Lc(e){return wr(e)?Nc(e):Ec(e)}function Dc(e){return function(t){t=tt(t);var n=wr(t)?Lc(t):void 0,r=n?n[0]:t.charAt(0),i=n?uc(n,1).join(""):t.slice(1);return r[e]()+i}}var $c=Dc("toUpperCase");function Uc(e){return $c(tt(e).toLowerCase())}function Mc(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;)n=t(n,e[i],i,e);return n}function xc(e){return function(t){return e?.[t]}}var jc={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Fc=xc(jc),Wc=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,qc="\\u0300-\\u036f",Gc="\\ufe20-\\ufe2f",zc="\\u20d0-\\u20ff",Hc=qc+Gc+zc,Bc="["+Hc+"]",Vc=RegExp(Bc,"g");function Yc(e){return e=tt(e),e&&e.replace(Wc,Fc).replace(Vc,"")}var kc=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Zc(e){return e.match(kc)||[]}var Xc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Kc(e){return Xc.test(e)}var Or="\\ud800-\\udfff",Jc="\\u0300-\\u036f",Qc="\\ufe20-\\ufe2f",eu="\\u20d0-\\u20ff",tu=Jc+Qc+eu,Pr="\\u2700-\\u27bf",Ir="a-z\\xdf-\\xf6\\xf8-\\xff",nu="\\xac\\xb1\\xd7\\xf7",ru="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ou="\\u2000-\\u206f",iu=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Cr="A-Z\\xc0-\\xd6\\xd8-\\xde",su="\\ufe0e\\ufe0f",Rr=nu+ru+ou+iu,Nr="['’]",Lr="["+Rr+"]",au="["+tu+"]",Dr="\\d+",cu="["+Pr+"]",$r="["+Ir+"]",Ur="[^"+Or+Rr+Dr+Pr+Ir+Cr+"]",uu="\\ud83c[\\udffb-\\udfff]",fu="(?:"+au+"|"+uu+")",du="[^"+Or+"]",Mr="(?:\\ud83c[\\udde6-\\uddff]){2}",xr="[\\ud800-\\udbff][\\udc00-\\udfff]",je="["+Cr+"]",lu="\\u200d",jr="(?:"+$r+"|"+Ur+")",_u="(?:"+je+"|"+Ur+")",Fr="(?:"+Nr+"(?:d|ll|m|re|s|t|ve))?",Wr="(?:"+Nr+"(?:D|LL|M|RE|S|T|VE))?",qr=fu+"?",Gr="["+su+"]?",pu="(?:"+lu+"(?:"+[du,Mr,xr].join("|")+")"+Gr+qr+")*",hu="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",gu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",mu=Gr+qr+pu,Eu="(?:"+[cu,Mr,xr].join("|")+")"+mu,wu=RegExp([je+"?"+$r+"+"+Fr+"(?="+[Lr,je,"$"].join("|")+")",_u+"+"+Wr+"(?="+[Lr,je+jr,"$"].join("|")+")",je+"?"+jr+"+"+Fr,je+"+"+Wr,gu,hu,Dr,Eu].join("|"),"g");function Au(e){return e.match(wu)||[]}function yu(e,t,n){return e=tt(e),t=t,t===void 0?Kc(e)?Au(e):Zc(e):e.match(t)||[]}var vu="['’]",Su=RegExp(vu,"g");function zr(e){return function(t){return Mc(yu(Yc(t).replace(Su,"")),e,"")}}var Tu=zr(function(e,t,n){return t=t.toLowerCase(),e+(n?Uc(t):t)});function bu(){this.__data__=new ge,this.size=0}function Ou(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Pu(e){return this.__data__.get(e)}function Iu(e){return this.__data__.has(e)}var Cu=200;function Ru(e,t){var n=this.__data__;if(n instanceof ge){var r=n.__data__;if(!et||r.length<Cu-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new me(r)}return n.set(e,t),this.size=n.size,this}function fe(e){var t=this.__data__=new ge(e);this.size=t.size}fe.prototype.clear=bu,fe.prototype.delete=Ou,fe.prototype.get=Pu,fe.prototype.has=Iu,fe.prototype.set=Ru;function Nu(e,t){return e&&Ue(t,At(t),e)}function Lu(e,t){return e&&Ue(t,Je(t),e)}var Hr=typeof y=="object"&&y&&!y.nodeType&&y,Br=Hr&&typeof module=="object"&&module&&!module.nodeType&&module,Du=Br&&Br.exports===Hr,Vr=Du?_e.Buffer:void 0,Yr=Vr?Vr.allocUnsafe:void 0;function kr(e,t){if(t)return e.slice();var n=e.length,r=Yr?Yr(n):new e.constructor(n);return e.copy(r),r}function $u(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var u=e[n];t(u,n,e)&&(a[i++]=u)}return a}function Zr(){return[]}var Uu=Object.prototype,Mu=Uu.propertyIsEnumerable,Xr=Object.getOwnPropertySymbols,sn=Xr?function(e){return e==null?[]:(e=Object(e),$u(Xr(e),function(t){return Mu.call(e,t)}))}:Zr;function xu(e,t){return Ue(e,sn(e),t)}var ju=Object.getOwnPropertySymbols,Kr=ju?function(e){for(var t=[];e;)tn(t,sn(e)),e=nn(e);return t}:Zr;function Fu(e,t){return Ue(e,Kr(e),t)}function Jr(e,t,n){var r=t(e);return ne(e)?r:tn(r,n(e))}function an(e){return Jr(e,At,sn)}function cn(e){return Jr(e,Je,Kr)}var un=Oe(_e,"DataView"),fn=Oe(_e,"Promise"),dn=Oe(_e,"Set"),Qr="[object Map]",Wu="[object Object]",eo="[object Promise]",to="[object Set]",no="[object WeakMap]",ro="[object DataView]",qu=be(un),Gu=be(et),zu=be(fn),Hu=be(dn),Bu=be(Bt),de=Te;(un&&de(new un(new ArrayBuffer(1)))!=ro||et&&de(new et)!=Qr||fn&&de(fn.resolve())!=eo||dn&&de(new dn)!=to||Bt&&de(new Bt)!=no)&&(de=function(e){var t=Te(e),n=t==Wu?e.constructor:void 0,r=n?be(n):"";if(r)switch(r){case qu:return ro;case Gu:return Qr;case zu:return eo;case Hu:return to;case Bu:return no}return t});var Vu=Object.prototype,Yu=Vu.hasOwnProperty;function ku(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&Yu.call(e,"index")&&(n.index=e.index,n.input=e.input),n}var Tt=_e.Uint8Array;function ln(e){var t=new e.constructor(e.byteLength);return new Tt(t).set(new Tt(e)),t}function Zu(e,t){var n=t?ln(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var Xu=/\w*$/;function Ku(e){var t=new e.constructor(e.source,Xu.exec(e));return t.lastIndex=e.lastIndex,t}var oo=ae?ae.prototype:void 0,io=oo?oo.valueOf:void 0;function Ju(e){return io?Object(io.call(e)):{}}function so(e,t){var n=t?ln(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var Qu="[object Boolean]",ef="[object Date]",tf="[object Map]",nf="[object Number]",rf="[object RegExp]",of="[object Set]",sf="[object String]",af="[object Symbol]",cf="[object ArrayBuffer]",uf="[object DataView]",ff="[object Float32Array]",df="[object Float64Array]",lf="[object Int8Array]",_f="[object Int16Array]",pf="[object Int32Array]",hf="[object Uint8Array]",gf="[object Uint8ClampedArray]",mf="[object Uint16Array]",Ef="[object Uint32Array]";function wf(e,t,n){var r=e.constructor;switch(t){case cf:return ln(e);case Qu:case ef:return new r(+e);case uf:return Zu(e,n);case ff:case df:case lf:case _f:case pf:case hf:case gf:case mf:case Ef:return so(e,n);case tf:return new r;case nf:case sf:return new r(e);case rf:return Ku(e);case of:return new r;case af:return Ju(e)}}function ao(e){return typeof e.constructor=="function"&&!Zt(e)?ps(nn(e)):{}}var Af="[object Map]";function yf(e){return pe(e)&&de(e)==Af}var co=Me&&Me.isMap,vf=co?Xt(co):yf,Sf="[object Set]";function Tf(e){return pe(e)&&de(e)==Sf}var uo=Me&&Me.isSet,bf=uo?Xt(uo):Tf,Of=1,Pf=2,If=4,fo="[object Arguments]",Cf="[object Array]",Rf="[object Boolean]",Nf="[object Date]",Lf="[object Error]",lo="[object Function]",Df="[object GeneratorFunction]",$f="[object Map]",Uf="[object Number]",_o="[object Object]",Mf="[object RegExp]",xf="[object Set]",jf="[object String]",Ff="[object Symbol]",Wf="[object WeakMap]",qf="[object ArrayBuffer]",Gf="[object DataView]",zf="[object Float32Array]",Hf="[object Float64Array]",Bf="[object Int8Array]",Vf="[object Int16Array]",Yf="[object Int32Array]",kf="[object Uint8Array]",Zf="[object Uint8ClampedArray]",Xf="[object Uint16Array]",Kf="[object Uint32Array]",W={};W[fo]=W[Cf]=W[qf]=W[Gf]=W[Rf]=W[Nf]=W[zf]=W[Hf]=W[Bf]=W[Vf]=W[Yf]=W[$f]=W[Uf]=W[_o]=W[Mf]=W[xf]=W[jf]=W[Ff]=W[kf]=W[Zf]=W[Xf]=W[Kf]=!0,W[Lf]=W[lo]=W[Wf]=!1;function nt(e,t,n,r,i,a){var u,l=t&Of,_=t&Pf,S=t&If;if(n&&(u=i?n(e,r,i,a):n(e)),u!==void 0)return u;if(!ue(e))return e;var w=ne(e);if(w){if(u=ku(e),!l)return nr(e,u)}else{var P=de(e),C=P==lo||P==Df;if(Xe(e))return kr(e,l);if(P==_o||P==fo||C&&!i){if(u=_||C?{}:ao(e),!l)return _?Fu(e,Lu(u,e)):xu(e,Nu(u,e))}else{if(!W[P])return i?e:{};u=wf(e,P,l)}}a||(a=new fe);var D=a.get(e);if(D)return D;a.set(e,u),bf(e)?e.forEach(function(M){u.add(nt(M,t,n,M,e,a))}):vf(e)&&e.forEach(function(M,j){u.set(j,nt(M,t,n,j,e,a))});var I=S?_?cn:an:_?Je:At,x=w?void 0:I(e);return vs(x||e,function(M,j){x&&(j=M,M=e[j]),Yt(u,j,nt(M,t,n,j,e,a))}),u}var Jf=1,Qf=4;function po(e){return nt(e,Jf|Qf)}var ed="__lodash_hash_undefined__";function td(e){return this.__data__.set(e,ed),this}function nd(e){return this.__data__.has(e)}function bt(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new me;++t<n;)this.add(e[t])}bt.prototype.add=bt.prototype.push=td,bt.prototype.has=nd;function rd(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function od(e,t){return e.has(t)}var id=1,sd=2;function ho(e,t,n,r,i,a){var u=n&id,l=e.length,_=t.length;if(l!=_&&!(u&&_>l))return!1;var S=a.get(e),w=a.get(t);if(S&&w)return S==t&&w==e;var P=-1,C=!0,D=n&sd?new bt:void 0;for(a.set(e,t),a.set(t,e);++P<l;){var I=e[P],x=t[P];if(r)var M=u?r(x,I,P,t,e,a):r(I,x,P,e,t,a);if(M!==void 0){if(M)continue;C=!1;break}if(D){if(!rd(t,function(j,Y){if(!od(D,Y)&&(I===j||i(I,j,n,r,a)))return D.push(Y)})){C=!1;break}}else if(!(I===x||i(I,x,n,r,a))){C=!1;break}}return a.delete(e),a.delete(t),C}function ad(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}function cd(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var ud=1,fd=2,dd="[object Boolean]",ld="[object Date]",_d="[object Error]",pd="[object Map]",hd="[object Number]",gd="[object RegExp]",md="[object Set]",Ed="[object String]",wd="[object Symbol]",Ad="[object ArrayBuffer]",yd="[object DataView]",go=ae?ae.prototype:void 0,_n=go?go.valueOf:void 0;function vd(e,t,n,r,i,a,u){switch(n){case yd:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Ad:return!(e.byteLength!=t.byteLength||!a(new Tt(e),new Tt(t)));case dd:case ld:case hd:return ke(+e,+t);case _d:return e.name==t.name&&e.message==t.message;case gd:case Ed:return e==t+"";case pd:var l=ad;case md:var _=r&ud;if(l||(l=cd),e.size!=t.size&&!_)return!1;var S=u.get(e);if(S)return S==t;r|=fd,u.set(e,t);var w=ho(l(e),l(t),r,i,a,u);return u.delete(e),w;case wd:if(_n)return _n.call(e)==_n.call(t)}return!1}var Sd=1,Td=Object.prototype,bd=Td.hasOwnProperty;function Od(e,t,n,r,i,a){var u=n&Sd,l=an(e),_=l.length,S=an(t),w=S.length;if(_!=w&&!u)return!1;for(var P=_;P--;){var C=l[P];if(!(u?C in t:bd.call(t,C)))return!1}var D=a.get(e),I=a.get(t);if(D&&I)return D==t&&I==e;var x=!0;a.set(e,t),a.set(t,e);for(var M=u;++P<_;){C=l[P];var j=e[C],Y=t[C];if(r)var ve=u?r(Y,j,C,t,e,a):r(j,Y,C,e,t,a);if(!(ve===void 0?j===Y||i(j,Y,n,r,a):ve)){x=!1;break}M||(M=C=="constructor")}if(x&&!M){var He=e.constructor,ee=t.constructor;He!=ee&&"constructor"in e&&"constructor"in t&&!(typeof He=="function"&&He instanceof He&&typeof ee=="function"&&ee instanceof ee)&&(x=!1)}return a.delete(e),a.delete(t),x}var Pd=1,mo="[object Arguments]",Eo="[object Array]",Ot="[object Object]",Id=Object.prototype,wo=Id.hasOwnProperty;function Cd(e,t,n,r,i,a){var u=ne(e),l=ne(t),_=u?Eo:de(e),S=l?Eo:de(t);_=_==mo?Ot:_,S=S==mo?Ot:S;var w=_==Ot,P=S==Ot,C=_==S;if(C&&Xe(e)){if(!Xe(t))return!1;u=!0,w=!1}if(C&&!w)return a||(a=new fe),u||Jt(e)?ho(e,t,n,r,i,a):vd(e,t,_,n,r,i,a);if(!(n&Pd)){var D=w&&wo.call(e,"__wrapped__"),I=P&&wo.call(t,"__wrapped__");if(D||I){var x=D?e.value():e,M=I?t.value():t;return a||(a=new fe),i(x,M,n,r,a)}}return C?(a||(a=new fe),Od(e,t,n,r,i,a)):!1}function Pt(e,t,n,r,i){return e===t?!0:e==null||t==null||!pe(e)&&!pe(t)?e!==e&&t!==t:Cd(e,t,n,r,Pt,i)}var Rd=1,Nd=2;function Ld(e,t,n,r){var i=n.length,a=i;if(e==null)return!a;for(e=Object(e);i--;){var u=n[i];if(u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++i<a;){u=n[i];var l=u[0],_=e[l],S=u[1];if(u[2]){if(_===void 0&&!(l in e))return!1}else{var w=new fe,P;if(!(P===void 0?Pt(S,_,Rd|Nd,r,w):P))return!1}}return!0}function Ao(e){return e===e&&!ue(e)}function Dd(e){for(var t=At(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Ao(i)]}return t}function yo(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function $d(e){var t=Dd(e);return t.length==1&&t[0][2]?yo(t[0][0],t[0][1]):function(n){return n===e||Ld(n,e,t)}}function Ud(e,t){return e!=null&&t in Object(e)}function Md(e,t,n){t=xe(t,e);for(var r=-1,i=t.length,a=!1;++r<i;){var u=Ie(t[r]);if(!(a=e!=null&&n(e,u)))break;e=e[u]}return a||++r!=i?a:(i=e==null?0:e.length,!!i&&kt(i)&&Et(u,i)&&(ne(e)||Ze(e)))}function xd(e,t){return e!=null&&Md(e,t,Ud)}var jd=1,Fd=2;function Wd(e,t){return Qt(e)&&Ao(t)?yo(Ie(e),t):function(n){var r=Qa(n,e);return r===void 0&&r===t?xd(n,e):Pt(t,r,jd|Fd)}}function qd(e){return function(t){return t?.[e]}}function Gd(e){return function(t){return St(t,e)}}function zd(e){return Qt(e)?qd(Ie(e)):Gd(e)}function Hd(e){return typeof e=="function"?e:e==null?Gt:typeof e=="object"?ne(e)?Wd(e[0],e[1]):$d(e):zd(e)}function Bd(e){return function(t,n,r){for(var i=-1,a=Object(t),u=r(t),l=u.length;l--;){var _=u[++i];if(n(a[_],_,a)===!1)break}return t}}var Vd=Bd();function pn(e,t,n){(n!==void 0&&!ke(e[t],n)||n===void 0&&!(t in e))&&Vt(e,t,n)}function Yd(e){return pe(e)&&wt(e)}function hn(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function kd(e){return Ue(e,Je(e))}function Zd(e,t,n,r,i,a,u){var l=hn(e,n),_=hn(t,n),S=u.get(_);if(S){pn(e,n,S);return}var w=a?a(l,_,n+"",e,t,u):void 0,P=w===void 0;if(P){var C=ne(_),D=!C&&Xe(_),I=!C&&!D&&Jt(_);w=_,C||D||I?ne(l)?w=l:Yd(l)?w=nr(l):D?(P=!1,w=kr(_,!0)):I?(P=!1,w=so(_,!0)):w=[]:mr(_)||Ze(_)?(w=l,Ze(l)?w=kd(l):(!ue(l)||zt(l))&&(w=ao(_))):P=!1}P&&(u.set(_,w),i(w,_,r,a,u),u.delete(_)),pn(e,n,w)}function vo(e,t,n,r,i){e!==t&&Vd(t,function(a,u){if(i||(i=new fe),ue(a))Zd(e,t,u,n,vo,r,i);else{var l=r?r(hn(e,u),a,u+"",e,t,i):void 0;l===void 0&&(l=a),pn(e,u,l)}},Je)}function Xd(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function Kd(e,t){return t.length<2?e:St(e,Er(t,0,-1))}function Jd(e,t){return Pt(e,t)}var Qd=Rs(function(e,t,n){vo(e,t,n)}),el=Object.prototype,tl=el.hasOwnProperty;function nl(e,t){t=xe(t,e);var n=-1,r=t.length;if(!r)return!0;for(;++n<r;){var i=Ie(t[n]);if(i==="__proto__"&&!tl.call(e,"__proto__")||(i==="constructor"||i==="prototype")&&n<r-1)return!1}var a=Kd(e,t);return a==null||delete a[Ie(Xd(t))]}function rl(e){return mr(e)?void 0:e}var ol=1,il=2,sl=4,gn=rc(function(e,t){var n={};if(e==null)return n;var r=!1;t=qt(t,function(a){return a=xe(a,e),r||(r=a.length>1),a}),Ue(e,cn(e),n),r&&(n=nt(n,ol|il|sl,rl));for(var i=t.length;i--;)nl(n,t[i]);return n});function al(e,t,n,r){if(!ue(e))return e;t=xe(t,e);for(var i=-1,a=t.length,u=a-1,l=e;l!=null&&++i<a;){var _=Ie(t[i]),S=n;if(_==="__proto__"||_==="constructor"||_==="prototype")return e;if(i!=u){var w=l[_];S=void 0,S===void 0&&(S=ue(w)?w:Et(t[i+1])?[]:{})}Yt(l,_,S),l=l[_]}return e}function cl(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var u=t[r],l=St(e,u);n(l,u)&&al(a,xe(u,e),l)}return a}function ul(e,t){if(e==null)return{};var n=qt(cn(e),function(r){return[r]});return t=Hd(t),cl(e,n,function(r,i){return t(r,i[0])})}var So=zr(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});function fl(e){return e?.mode==="off"||e?.mode==="on_device"||e?.mode==="online"?e.mode:"off"}const dl=6,ll=12,To=400,mn=140,_l=5,bo=70,pl=60,hl=40,gl=30,ml=60,El=`You rank a sales rep's upcoming meetings by how much they need preparation.
17
+ `+_t(U))}))}))}))};function Nm(o,c,s){return $i(o,c,s,{on:$e,send:Se})}function Rm(o,c,s){return Ui(o,c,s,{send:Se})}function Lm(o){return new se({send:Se,win:o})}function Dm(o){return se.toProxyWindow(o,{send:Se})}function qi(){ht().initialized||(ht().initialized=!0,c=(o={on:$e,send:Se}).on,s=o.send,(f=ht()).receiveMessage=f.receiveMessage||function(d){return Wi(d,{on:c,send:s})},(function(d){var p=d.on,h=d.send;X().getOrSet("postMessageListener",(function(){return(function(E,m,g){return E.addEventListener("message",g),{cancel:function(){E.removeEventListener("message",g)}}})(window,0,(function(E){(function(m,g){var T=g.on,y=g.send;F.try((function(){var v=m.source||m.sourceElement,b=m.origin||m.originalEvent&&m.originalEvent.origin,L=m.data;if(b==="null"&&(b="file://"),v){if(!b)throw new Error("Post message did not have origin domain");Wi({source:v,origin:b,data:L},{on:T,send:y})}}))})(E,{on:p,send:h})}))}))})({on:$e,send:Se}),(function(d){var p=d.on,h=d.send;X("builtinListeners").getOrSet("helloListener",(function(){var E=p("postrobot_hello",{domain:"*"},(function(g){return Pi(g.source,{domain:g.origin}),{instanceID:Oi()}})),m=_i();return m&&Fn(m,{send:h}).catch((function(g){})),E}))})({on:$e,send:Se}));var o,c,s,f}function $m(){(function(){for(var c=X("responseListeners"),s=0,f=c.keys();s<f.length;s++){var d=f[s],p=c.get(d);p&&(p.cancelled=!0),c.del(d)}})(),(o=X().get("postMessageListener"))&&o.cancel();var o;delete window.__post_robot_10_0_46__}var Um=!0;function Mm(o){for(var c=0,s=te("requestPromises").get(o,[]);c<s.length;c++)s[c].reject(new Error("Window "+(ee(o)?"closed":"cleaned up")+" before response")).catch(Le)}qi()}])}))})(mt)),mt.exports}var Vn;function Bi(){return Vn||(Vn=1,(function(e){e.exports=Hi(),e.exports.default=e.exports})(Wt)),Wt.exports}var kn=Bi();const Zn=Gi(kn),Yi=Ye({__proto__:null,default:Zn},[kn]);var Xn=typeof global=="object"&&global&&global.Object===Object&&global,Vi=typeof self=="object"&&self&&self.Object===Object&&self,_e=Xn||Vi||Function("return this")(),ae=_e.Symbol,Jn=Object.prototype,ki=Jn.hasOwnProperty,Zi=Jn.toString,Ve=ae?ae.toStringTag:void 0;function Xi(e){var t=ki.call(e,Ve),n=e[Ve];try{e[Ve]=void 0;var r=!0}catch{}var i=Zi.call(e);return r&&(t?e[Ve]=n:delete e[Ve]),i}var Ji=Object.prototype,Ki=Ji.toString;function Qi(e){return Ki.call(e)}var es="[object Null]",ts="[object Undefined]",Kn=ae?ae.toStringTag:void 0;function Te(e){return e==null?e===void 0?ts:es:Kn&&Kn in Object(e)?Xi(e):Qi(e)}function pe(e){return e!=null&&typeof e=="object"}var ns="[object Symbol]";function qt(e){return typeof e=="symbol"||pe(e)&&Te(e)==ns}function Gt(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var ne=Array.isArray,Qn=ae?ae.prototype:void 0,er=Qn?Qn.toString:void 0;function tr(e){if(typeof e=="string")return e;if(ne(e))return Gt(e,tr)+"";if(qt(e))return er?er.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function ue(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function zt(e){return e}var rs="[object AsyncFunction]",os="[object Function]",is="[object GeneratorFunction]",ss="[object Proxy]";function Ht(e){if(!ue(e))return!1;var t=Te(e);return t==os||t==is||t==rs||t==ss}var Bt=_e["__core-js_shared__"],nr=(function(){var e=/[^.]+$/.exec(Bt&&Bt.keys&&Bt.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function as(e){return!!nr&&nr in e}var cs=Function.prototype,us=cs.toString;function be(e){if(e!=null){try{return us.call(e)}catch{}try{return e+""}catch{}}return""}var fs=/[\\^$.*+?()[\]{}|]/g,ds=/^\[object .+?Constructor\]$/,ls=Function.prototype,_s=Object.prototype,ps=ls.toString,hs=_s.hasOwnProperty,gs=RegExp("^"+ps.call(hs).replace(fs,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ms(e){if(!ue(e)||as(e))return!1;var t=Ht(e)?gs:ds;return t.test(be(e))}function Es(e,t){return e?.[t]}function Oe(e,t){var n=Es(e,t);return ms(n)?n:void 0}var Yt=Oe(_e,"WeakMap"),rr=Object.create,ws=(function(){function e(){}return function(t){if(!ue(t))return{};if(rr)return rr(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}})();function As(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function or(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var ys=800,vs=16,Ss=Date.now;function Ts(e){var t=0,n=0;return function(){var r=Ss(),i=vs-(r-n);if(n=r,i>0){if(++t>=ys)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function bs(e){return function(){return e}}var Et=(function(){try{var e=Oe(Object,"defineProperty");return e({},"",{}),e}catch{}})(),Os=Et?function(e,t){return Et(e,"toString",{configurable:!0,enumerable:!1,value:bs(t),writable:!0})}:zt,ir=Ts(Os);function Ps(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var Is=9007199254740991,Cs=/^(?:0|[1-9]\d*)$/;function wt(e,t){var n=typeof e;return t=t??Is,!!t&&(n=="number"||n!="symbol"&&Cs.test(e))&&e>-1&&e%1==0&&e<t}function Vt(e,t,n){t=="__proto__"&&Et?Et(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ke(e,t){return e===t||e!==e&&t!==t}var Ns=Object.prototype,Rs=Ns.hasOwnProperty;function kt(e,t,n){var r=e[t];(!(Rs.call(e,t)&&ke(r,n))||n===void 0&&!(t in e))&&Vt(e,t,n)}function Ue(e,t,n,r){var i=!n;n||(n={});for(var a=-1,u=t.length;++a<u;){var l=t[a],_=void 0;_===void 0&&(_=e[l]),i?Vt(n,l,_):kt(n,l,_)}return n}var sr=Math.max;function ar(e,t,n){return t=sr(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=sr(r.length-t,0),u=Array(a);++i<a;)u[i]=r[t+i];i=-1;for(var l=Array(t+1);++i<t;)l[i]=r[i];return l[t]=n(u),As(e,this,l)}}function Ls(e,t){return ir(ar(e,t,zt),e+"")}var Ds=9007199254740991;function Zt(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Ds}function At(e){return e!=null&&Zt(e.length)&&!Ht(e)}function $s(e,t,n){if(!ue(n))return!1;var r=typeof t;return(r=="number"?At(n)&&wt(t,n.length):r=="string"&&t in n)?ke(n[t],e):!1}function Us(e){return Ls(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,u=i>2?n[2]:void 0;for(a=e.length>3&&typeof a=="function"?(i--,a):void 0,u&&$s(n[0],n[1],u)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var l=n[r];l&&e(t,l,r,a)}return t})}var Ms=Object.prototype;function Xt(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Ms;return e===n}function xs(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var js="[object Arguments]";function cr(e){return pe(e)&&Te(e)==js}var ur=Object.prototype,Fs=ur.hasOwnProperty,Ws=ur.propertyIsEnumerable,Ze=cr((function(){return arguments})())?cr:function(e){return pe(e)&&Fs.call(e,"callee")&&!Ws.call(e,"callee")};function qs(){return!1}var fr=typeof A=="object"&&A&&!A.nodeType&&A,dr=fr&&typeof module=="object"&&module&&!module.nodeType&&module,Gs=dr&&dr.exports===fr,lr=Gs?_e.Buffer:void 0,zs=lr?lr.isBuffer:void 0,Xe=zs||qs,Hs="[object Arguments]",Bs="[object Array]",Ys="[object Boolean]",Vs="[object Date]",ks="[object Error]",Zs="[object Function]",Xs="[object Map]",Js="[object Number]",Ks="[object Object]",Qs="[object RegExp]",ea="[object Set]",ta="[object String]",na="[object WeakMap]",ra="[object ArrayBuffer]",oa="[object DataView]",ia="[object Float32Array]",sa="[object Float64Array]",aa="[object Int8Array]",ca="[object Int16Array]",ua="[object Int32Array]",fa="[object Uint8Array]",da="[object Uint8ClampedArray]",la="[object Uint16Array]",_a="[object Uint32Array]",z={};z[ia]=z[sa]=z[aa]=z[ca]=z[ua]=z[fa]=z[da]=z[la]=z[_a]=!0,z[Hs]=z[Bs]=z[ra]=z[Ys]=z[oa]=z[Vs]=z[ks]=z[Zs]=z[Xs]=z[Js]=z[Ks]=z[Qs]=z[ea]=z[ta]=z[na]=!1;function pa(e){return pe(e)&&Zt(e.length)&&!!z[Te(e)]}function Jt(e){return function(t){return e(t)}}var _r=typeof A=="object"&&A&&!A.nodeType&&A,Je=_r&&typeof module=="object"&&module&&!module.nodeType&&module,ha=Je&&Je.exports===_r,Kt=ha&&Xn.process,Me=(function(){try{var e=Je&&Je.require&&Je.require("util").types;return e||Kt&&Kt.binding&&Kt.binding("util")}catch{}})(),pr=Me&&Me.isTypedArray,Qt=pr?Jt(pr):pa,ga=Object.prototype,ma=ga.hasOwnProperty;function hr(e,t){var n=ne(e),r=!n&&Ze(e),i=!n&&!r&&Xe(e),a=!n&&!r&&!i&&Qt(e),u=n||r||i||a,l=u?xs(e.length,String):[],_=l.length;for(var S in e)(t||ma.call(e,S))&&!(u&&(S=="length"||i&&(S=="offset"||S=="parent")||a&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||wt(S,_)))&&l.push(S);return l}function gr(e,t){return function(n){return e(t(n))}}var Ea=gr(Object.keys,Object),wa=Object.prototype,Aa=wa.hasOwnProperty;function ya(e){if(!Xt(e))return Ea(e);var t=[];for(var n in Object(e))Aa.call(e,n)&&n!="constructor"&&t.push(n);return t}function yt(e){return At(e)?hr(e):ya(e)}function va(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Sa=Object.prototype,Ta=Sa.hasOwnProperty;function ba(e){if(!ue(e))return va(e);var t=Xt(e),n=[];for(var r in e)r=="constructor"&&(t||!Ta.call(e,r))||n.push(r);return n}function Ke(e){return At(e)?hr(e,!0):ba(e)}var Oa=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Pa=/^\w*$/;function en(e,t){if(ne(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||qt(e)?!0:Pa.test(e)||!Oa.test(e)||t!=null&&e in Object(t)}var Qe=Oe(Object,"create");function Ia(){this.__data__=Qe?Qe(null):{},this.size=0}function Ca(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Na="__lodash_hash_undefined__",Ra=Object.prototype,La=Ra.hasOwnProperty;function Da(e){var t=this.__data__;if(Qe){var n=t[e];return n===Na?void 0:n}return La.call(t,e)?t[e]:void 0}var $a=Object.prototype,Ua=$a.hasOwnProperty;function Ma(e){var t=this.__data__;return Qe?t[e]!==void 0:Ua.call(t,e)}var xa="__lodash_hash_undefined__";function ja(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Qe&&t===void 0?xa:t,this}function Pe(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Pe.prototype.clear=Ia,Pe.prototype.delete=Ca,Pe.prototype.get=Da,Pe.prototype.has=Ma,Pe.prototype.set=ja;function Fa(){this.__data__=[],this.size=0}function vt(e,t){for(var n=e.length;n--;)if(ke(e[n][0],t))return n;return-1}var Wa=Array.prototype,qa=Wa.splice;function Ga(e){var t=this.__data__,n=vt(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():qa.call(t,n,1),--this.size,!0}function za(e){var t=this.__data__,n=vt(t,e);return n<0?void 0:t[n][1]}function Ha(e){return vt(this.__data__,e)>-1}function Ba(e,t){var n=this.__data__,r=vt(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function ge(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}ge.prototype.clear=Fa,ge.prototype.delete=Ga,ge.prototype.get=za,ge.prototype.has=Ha,ge.prototype.set=Ba;var et=Oe(_e,"Map");function Ya(){this.size=0,this.__data__={hash:new Pe,map:new(et||ge),string:new Pe}}function Va(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function St(e,t){var n=e.__data__;return Va(t)?n[typeof t=="string"?"string":"hash"]:n.map}function ka(e){var t=St(this,e).delete(e);return this.size-=t?1:0,t}function Za(e){return St(this,e).get(e)}function Xa(e){return St(this,e).has(e)}function Ja(e,t){var n=St(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function me(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}me.prototype.clear=Ya,me.prototype.delete=ka,me.prototype.get=Za,me.prototype.has=Xa,me.prototype.set=Ja;var Ka="Expected a function";function tn(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Ka);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var u=e.apply(this,r);return n.cache=a.set(i,u)||a,u};return n.cache=new(tn.Cache||me),n}tn.Cache=me;var Qa=500;function ec(e){var t=tn(e,function(r){return n.size===Qa&&n.clear(),r}),n=t.cache;return t}var tc=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nc=/\\(\\)?/g,rc=ec(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(tc,function(n,r,i,a){t.push(i?a.replace(nc,"$1"):r||n)}),t});function tt(e){return e==null?"":tr(e)}function xe(e,t){return ne(e)?e:en(e,t)?[e]:rc(tt(e))}function Ie(e){if(typeof e=="string"||qt(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Tt(e,t){t=xe(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Ie(t[n++])];return n&&n==r?e:void 0}function oc(e,t,n){var r=e==null?void 0:Tt(e,t);return r===void 0?n:r}function nn(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var mr=ae?ae.isConcatSpreadable:void 0;function ic(e){return ne(e)||Ze(e)||!!(mr&&e&&e[mr])}function sc(e,t,n,r,i){var a=-1,u=e.length;for(n||(n=ic),i||(i=[]);++a<u;){var l=e[a];n(l)?nn(i,l):i[i.length]=l}return i}function ac(e){var t=e==null?0:e.length;return t?sc(e):[]}function cc(e){return ir(ar(e,void 0,ac),e+"")}var rn=gr(Object.getPrototypeOf,Object),uc="[object Object]",fc=Function.prototype,dc=Object.prototype,Er=fc.toString,lc=dc.hasOwnProperty,_c=Er.call(Object);function wr(e){if(!pe(e)||Te(e)!=uc)return!1;var t=rn(e);if(t===null)return!0;var n=lc.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Er.call(n)==_c}function Ar(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}function pc(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:Ar(e,t,n)}var hc="\\ud800-\\udfff",gc="\\u0300-\\u036f",mc="\\ufe20-\\ufe2f",Ec="\\u20d0-\\u20ff",wc=gc+mc+Ec,Ac="\\ufe0e\\ufe0f",yc="\\u200d",vc=RegExp("["+yc+hc+wc+Ac+"]");function yr(e){return vc.test(e)}function Sc(e){return e.split("")}var vr="\\ud800-\\udfff",Tc="\\u0300-\\u036f",bc="\\ufe20-\\ufe2f",Oc="\\u20d0-\\u20ff",Pc=Tc+bc+Oc,Ic="\\ufe0e\\ufe0f",Cc="["+vr+"]",on="["+Pc+"]",sn="\\ud83c[\\udffb-\\udfff]",Nc="(?:"+on+"|"+sn+")",Sr="[^"+vr+"]",Tr="(?:\\ud83c[\\udde6-\\uddff]){2}",br="[\\ud800-\\udbff][\\udc00-\\udfff]",Rc="\\u200d",Or=Nc+"?",Pr="["+Ic+"]?",Lc="(?:"+Rc+"(?:"+[Sr,Tr,br].join("|")+")"+Pr+Or+")*",Dc=Pr+Or+Lc,$c="(?:"+[Sr+on+"?",on,Tr,br,Cc].join("|")+")",Uc=RegExp(sn+"(?="+sn+")|"+$c+Dc,"g");function Mc(e){return e.match(Uc)||[]}function xc(e){return yr(e)?Mc(e):Sc(e)}function jc(e){return function(t){t=tt(t);var n=yr(t)?xc(t):void 0,r=n?n[0]:t.charAt(0),i=n?pc(n,1).join(""):t.slice(1);return r[e]()+i}}var Fc=jc("toUpperCase");function Wc(e){return Fc(tt(e).toLowerCase())}function qc(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;)n=t(n,e[i],i,e);return n}function Gc(e){return function(t){return e?.[t]}}var zc={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Hc=Gc(zc),Bc=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Yc="\\u0300-\\u036f",Vc="\\ufe20-\\ufe2f",kc="\\u20d0-\\u20ff",Zc=Yc+Vc+kc,Xc="["+Zc+"]",Jc=RegExp(Xc,"g");function Kc(e){return e=tt(e),e&&e.replace(Bc,Hc).replace(Jc,"")}var Qc=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function eu(e){return e.match(Qc)||[]}var tu=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function nu(e){return tu.test(e)}var Ir="\\ud800-\\udfff",ru="\\u0300-\\u036f",ou="\\ufe20-\\ufe2f",iu="\\u20d0-\\u20ff",su=ru+ou+iu,Cr="\\u2700-\\u27bf",Nr="a-z\\xdf-\\xf6\\xf8-\\xff",au="\\xac\\xb1\\xd7\\xf7",cu="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",uu="\\u2000-\\u206f",fu=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Rr="A-Z\\xc0-\\xd6\\xd8-\\xde",du="\\ufe0e\\ufe0f",Lr=au+cu+uu+fu,Dr="['’]",$r="["+Lr+"]",lu="["+su+"]",Ur="\\d+",_u="["+Cr+"]",Mr="["+Nr+"]",xr="[^"+Ir+Lr+Ur+Cr+Nr+Rr+"]",pu="\\ud83c[\\udffb-\\udfff]",hu="(?:"+lu+"|"+pu+")",gu="[^"+Ir+"]",jr="(?:\\ud83c[\\udde6-\\uddff]){2}",Fr="[\\ud800-\\udbff][\\udc00-\\udfff]",je="["+Rr+"]",mu="\\u200d",Wr="(?:"+Mr+"|"+xr+")",Eu="(?:"+je+"|"+xr+")",qr="(?:"+Dr+"(?:d|ll|m|re|s|t|ve))?",Gr="(?:"+Dr+"(?:D|LL|M|RE|S|T|VE))?",zr=hu+"?",Hr="["+du+"]?",wu="(?:"+mu+"(?:"+[gu,jr,Fr].join("|")+")"+Hr+zr+")*",Au="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",yu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",vu=Hr+zr+wu,Su="(?:"+[_u,jr,Fr].join("|")+")"+vu,Tu=RegExp([je+"?"+Mr+"+"+qr+"(?="+[$r,je,"$"].join("|")+")",Eu+"+"+Gr+"(?="+[$r,je+Wr,"$"].join("|")+")",je+"?"+Wr+"+"+qr,je+"+"+Gr,yu,Au,Ur,Su].join("|"),"g");function bu(e){return e.match(Tu)||[]}function Ou(e,t,n){return e=tt(e),t=t,t===void 0?nu(e)?bu(e):eu(e):e.match(t)||[]}var Pu="['’]",Iu=RegExp(Pu,"g");function Br(e){return function(t){return qc(Ou(Kc(t).replace(Iu,"")),e,"")}}var Cu=Br(function(e,t,n){return t=t.toLowerCase(),e+(n?Wc(t):t)});function Nu(){this.__data__=new ge,this.size=0}function Ru(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Lu(e){return this.__data__.get(e)}function Du(e){return this.__data__.has(e)}var $u=200;function Uu(e,t){var n=this.__data__;if(n instanceof ge){var r=n.__data__;if(!et||r.length<$u-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new me(r)}return n.set(e,t),this.size=n.size,this}function fe(e){var t=this.__data__=new ge(e);this.size=t.size}fe.prototype.clear=Nu,fe.prototype.delete=Ru,fe.prototype.get=Lu,fe.prototype.has=Du,fe.prototype.set=Uu;function Mu(e,t){return e&&Ue(t,yt(t),e)}function xu(e,t){return e&&Ue(t,Ke(t),e)}var Yr=typeof A=="object"&&A&&!A.nodeType&&A,Vr=Yr&&typeof module=="object"&&module&&!module.nodeType&&module,ju=Vr&&Vr.exports===Yr,kr=ju?_e.Buffer:void 0,Zr=kr?kr.allocUnsafe:void 0;function Xr(e,t){if(t)return e.slice();var n=e.length,r=Zr?Zr(n):new e.constructor(n);return e.copy(r),r}function Fu(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var u=e[n];t(u,n,e)&&(a[i++]=u)}return a}function Jr(){return[]}var Wu=Object.prototype,qu=Wu.propertyIsEnumerable,Kr=Object.getOwnPropertySymbols,an=Kr?function(e){return e==null?[]:(e=Object(e),Fu(Kr(e),function(t){return qu.call(e,t)}))}:Jr;function Gu(e,t){return Ue(e,an(e),t)}var zu=Object.getOwnPropertySymbols,Qr=zu?function(e){for(var t=[];e;)nn(t,an(e)),e=rn(e);return t}:Jr;function Hu(e,t){return Ue(e,Qr(e),t)}function eo(e,t,n){var r=t(e);return ne(e)?r:nn(r,n(e))}function cn(e){return eo(e,yt,an)}function un(e){return eo(e,Ke,Qr)}var fn=Oe(_e,"DataView"),dn=Oe(_e,"Promise"),ln=Oe(_e,"Set"),to="[object Map]",Bu="[object Object]",no="[object Promise]",ro="[object Set]",oo="[object WeakMap]",io="[object DataView]",Yu=be(fn),Vu=be(et),ku=be(dn),Zu=be(ln),Xu=be(Yt),de=Te;(fn&&de(new fn(new ArrayBuffer(1)))!=io||et&&de(new et)!=to||dn&&de(dn.resolve())!=no||ln&&de(new ln)!=ro||Yt&&de(new Yt)!=oo)&&(de=function(e){var t=Te(e),n=t==Bu?e.constructor:void 0,r=n?be(n):"";if(r)switch(r){case Yu:return io;case Vu:return to;case ku:return no;case Zu:return ro;case Xu:return oo}return t});var Ju=Object.prototype,Ku=Ju.hasOwnProperty;function Qu(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&Ku.call(e,"index")&&(n.index=e.index,n.input=e.input),n}var bt=_e.Uint8Array;function _n(e){var t=new e.constructor(e.byteLength);return new bt(t).set(new bt(e)),t}function ef(e,t){var n=t?_n(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var tf=/\w*$/;function nf(e){var t=new e.constructor(e.source,tf.exec(e));return t.lastIndex=e.lastIndex,t}var so=ae?ae.prototype:void 0,ao=so?so.valueOf:void 0;function rf(e){return ao?Object(ao.call(e)):{}}function co(e,t){var n=t?_n(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var of="[object Boolean]",sf="[object Date]",af="[object Map]",cf="[object Number]",uf="[object RegExp]",ff="[object Set]",df="[object String]",lf="[object Symbol]",_f="[object ArrayBuffer]",pf="[object DataView]",hf="[object Float32Array]",gf="[object Float64Array]",mf="[object Int8Array]",Ef="[object Int16Array]",wf="[object Int32Array]",Af="[object Uint8Array]",yf="[object Uint8ClampedArray]",vf="[object Uint16Array]",Sf="[object Uint32Array]";function Tf(e,t,n){var r=e.constructor;switch(t){case _f:return _n(e);case of:case sf:return new r(+e);case pf:return ef(e,n);case hf:case gf:case mf:case Ef:case wf:case Af:case yf:case vf:case Sf:return co(e,n);case af:return new r;case cf:case df:return new r(e);case uf:return nf(e);case ff:return new r;case lf:return rf(e)}}function uo(e){return typeof e.constructor=="function"&&!Xt(e)?ws(rn(e)):{}}var bf="[object Map]";function Of(e){return pe(e)&&de(e)==bf}var fo=Me&&Me.isMap,Pf=fo?Jt(fo):Of,If="[object Set]";function Cf(e){return pe(e)&&de(e)==If}var lo=Me&&Me.isSet,Nf=lo?Jt(lo):Cf,Rf=1,Lf=2,Df=4,_o="[object Arguments]",$f="[object Array]",Uf="[object Boolean]",Mf="[object Date]",xf="[object Error]",po="[object Function]",jf="[object GeneratorFunction]",Ff="[object Map]",Wf="[object Number]",ho="[object Object]",qf="[object RegExp]",Gf="[object Set]",zf="[object String]",Hf="[object Symbol]",Bf="[object WeakMap]",Yf="[object ArrayBuffer]",Vf="[object DataView]",kf="[object Float32Array]",Zf="[object Float64Array]",Xf="[object Int8Array]",Jf="[object Int16Array]",Kf="[object Int32Array]",Qf="[object Uint8Array]",ed="[object Uint8ClampedArray]",td="[object Uint16Array]",nd="[object Uint32Array]",W={};W[_o]=W[$f]=W[Yf]=W[Vf]=W[Uf]=W[Mf]=W[kf]=W[Zf]=W[Xf]=W[Jf]=W[Kf]=W[Ff]=W[Wf]=W[ho]=W[qf]=W[Gf]=W[zf]=W[Hf]=W[Qf]=W[ed]=W[td]=W[nd]=!0,W[xf]=W[po]=W[Bf]=!1;function nt(e,t,n,r,i,a){var u,l=t&Rf,_=t&Lf,S=t&Df;if(n&&(u=i?n(e,r,i,a):n(e)),u!==void 0)return u;if(!ue(e))return e;var w=ne(e);if(w){if(u=Qu(e),!l)return or(e,u)}else{var P=de(e),C=P==po||P==jf;if(Xe(e))return Xr(e,l);if(P==ho||P==_o||C&&!i){if(u=_||C?{}:uo(e),!l)return _?Hu(e,xu(u,e)):Gu(e,Mu(u,e))}else{if(!W[P])return i?e:{};u=Tf(e,P,l)}}a||(a=new fe);var D=a.get(e);if(D)return D;a.set(e,u),Nf(e)?e.forEach(function(M){u.add(nt(M,t,n,M,e,a))}):Pf(e)&&e.forEach(function(M,j){u.set(j,nt(M,t,n,j,e,a))});var I=S?_?un:cn:_?Ke:yt,x=w?void 0:I(e);return Ps(x||e,function(M,j){x&&(j=M,M=e[j]),kt(u,j,nt(M,t,n,j,e,a))}),u}var rd=1,od=4;function go(e){return nt(e,rd|od)}var id="__lodash_hash_undefined__";function sd(e){return this.__data__.set(e,id),this}function ad(e){return this.__data__.has(e)}function Ot(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new me;++t<n;)this.add(e[t])}Ot.prototype.add=Ot.prototype.push=sd,Ot.prototype.has=ad;function cd(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function ud(e,t){return e.has(t)}var fd=1,dd=2;function mo(e,t,n,r,i,a){var u=n&fd,l=e.length,_=t.length;if(l!=_&&!(u&&_>l))return!1;var S=a.get(e),w=a.get(t);if(S&&w)return S==t&&w==e;var P=-1,C=!0,D=n&dd?new Ot:void 0;for(a.set(e,t),a.set(t,e);++P<l;){var I=e[P],x=t[P];if(r)var M=u?r(x,I,P,t,e,a):r(I,x,P,e,t,a);if(M!==void 0){if(M)continue;C=!1;break}if(D){if(!cd(t,function(j,V){if(!ud(D,V)&&(I===j||i(I,j,n,r,a)))return D.push(V)})){C=!1;break}}else if(!(I===x||i(I,x,n,r,a))){C=!1;break}}return a.delete(e),a.delete(t),C}function ld(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}function _d(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var pd=1,hd=2,gd="[object Boolean]",md="[object Date]",Ed="[object Error]",wd="[object Map]",Ad="[object Number]",yd="[object RegExp]",vd="[object Set]",Sd="[object String]",Td="[object Symbol]",bd="[object ArrayBuffer]",Od="[object DataView]",Eo=ae?ae.prototype:void 0,pn=Eo?Eo.valueOf:void 0;function Pd(e,t,n,r,i,a,u){switch(n){case Od:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case bd:return!(e.byteLength!=t.byteLength||!a(new bt(e),new bt(t)));case gd:case md:case Ad:return ke(+e,+t);case Ed:return e.name==t.name&&e.message==t.message;case yd:case Sd:return e==t+"";case wd:var l=ld;case vd:var _=r&pd;if(l||(l=_d),e.size!=t.size&&!_)return!1;var S=u.get(e);if(S)return S==t;r|=hd,u.set(e,t);var w=mo(l(e),l(t),r,i,a,u);return u.delete(e),w;case Td:if(pn)return pn.call(e)==pn.call(t)}return!1}var Id=1,Cd=Object.prototype,Nd=Cd.hasOwnProperty;function Rd(e,t,n,r,i,a){var u=n&Id,l=cn(e),_=l.length,S=cn(t),w=S.length;if(_!=w&&!u)return!1;for(var P=_;P--;){var C=l[P];if(!(u?C in t:Nd.call(t,C)))return!1}var D=a.get(e),I=a.get(t);if(D&&I)return D==t&&I==e;var x=!0;a.set(e,t),a.set(t,e);for(var M=u;++P<_;){C=l[P];var j=e[C],V=t[C];if(r)var ve=u?r(V,j,C,t,e,a):r(j,V,C,e,t,a);if(!(ve===void 0?j===V||i(j,V,n,r,a):ve)){x=!1;break}M||(M=C=="constructor")}if(x&&!M){var He=e.constructor,ee=t.constructor;He!=ee&&"constructor"in e&&"constructor"in t&&!(typeof He=="function"&&He instanceof He&&typeof ee=="function"&&ee instanceof ee)&&(x=!1)}return a.delete(e),a.delete(t),x}var Ld=1,wo="[object Arguments]",Ao="[object Array]",Pt="[object Object]",Dd=Object.prototype,yo=Dd.hasOwnProperty;function $d(e,t,n,r,i,a){var u=ne(e),l=ne(t),_=u?Ao:de(e),S=l?Ao:de(t);_=_==wo?Pt:_,S=S==wo?Pt:S;var w=_==Pt,P=S==Pt,C=_==S;if(C&&Xe(e)){if(!Xe(t))return!1;u=!0,w=!1}if(C&&!w)return a||(a=new fe),u||Qt(e)?mo(e,t,n,r,i,a):Pd(e,t,_,n,r,i,a);if(!(n&Ld)){var D=w&&yo.call(e,"__wrapped__"),I=P&&yo.call(t,"__wrapped__");if(D||I){var x=D?e.value():e,M=I?t.value():t;return a||(a=new fe),i(x,M,n,r,a)}}return C?(a||(a=new fe),Rd(e,t,n,r,i,a)):!1}function It(e,t,n,r,i){return e===t?!0:e==null||t==null||!pe(e)&&!pe(t)?e!==e&&t!==t:$d(e,t,n,r,It,i)}var Ud=1,Md=2;function xd(e,t,n,r){var i=n.length,a=i;if(e==null)return!a;for(e=Object(e);i--;){var u=n[i];if(u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++i<a;){u=n[i];var l=u[0],_=e[l],S=u[1];if(u[2]){if(_===void 0&&!(l in e))return!1}else{var w=new fe,P;if(!(P===void 0?It(S,_,Ud|Md,r,w):P))return!1}}return!0}function vo(e){return e===e&&!ue(e)}function jd(e){for(var t=yt(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,vo(i)]}return t}function So(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function Fd(e){var t=jd(e);return t.length==1&&t[0][2]?So(t[0][0],t[0][1]):function(n){return n===e||xd(n,e,t)}}function Wd(e,t){return e!=null&&t in Object(e)}function qd(e,t,n){t=xe(t,e);for(var r=-1,i=t.length,a=!1;++r<i;){var u=Ie(t[r]);if(!(a=e!=null&&n(e,u)))break;e=e[u]}return a||++r!=i?a:(i=e==null?0:e.length,!!i&&Zt(i)&&wt(u,i)&&(ne(e)||Ze(e)))}function Gd(e,t){return e!=null&&qd(e,t,Wd)}var zd=1,Hd=2;function Bd(e,t){return en(e)&&vo(t)?So(Ie(e),t):function(n){var r=oc(n,e);return r===void 0&&r===t?Gd(n,e):It(t,r,zd|Hd)}}function Yd(e){return function(t){return t?.[e]}}function Vd(e){return function(t){return Tt(t,e)}}function kd(e){return en(e)?Yd(Ie(e)):Vd(e)}function Zd(e){return typeof e=="function"?e:e==null?zt:typeof e=="object"?ne(e)?Bd(e[0],e[1]):Fd(e):kd(e)}function Xd(e){return function(t,n,r){for(var i=-1,a=Object(t),u=r(t),l=u.length;l--;){var _=u[++i];if(n(a[_],_,a)===!1)break}return t}}var Jd=Xd();function hn(e,t,n){(n!==void 0&&!ke(e[t],n)||n===void 0&&!(t in e))&&Vt(e,t,n)}function Kd(e){return pe(e)&&At(e)}function gn(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function Qd(e){return Ue(e,Ke(e))}function el(e,t,n,r,i,a,u){var l=gn(e,n),_=gn(t,n),S=u.get(_);if(S){hn(e,n,S);return}var w=a?a(l,_,n+"",e,t,u):void 0,P=w===void 0;if(P){var C=ne(_),D=!C&&Xe(_),I=!C&&!D&&Qt(_);w=_,C||D||I?ne(l)?w=l:Kd(l)?w=or(l):D?(P=!1,w=Xr(_,!0)):I?(P=!1,w=co(_,!0)):w=[]:wr(_)||Ze(_)?(w=l,Ze(l)?w=Qd(l):(!ue(l)||Ht(l))&&(w=uo(_))):P=!1}P&&(u.set(_,w),i(w,_,r,a,u),u.delete(_)),hn(e,n,w)}function To(e,t,n,r,i){e!==t&&Jd(t,function(a,u){if(i||(i=new fe),ue(a))el(e,t,u,n,To,r,i);else{var l=r?r(gn(e,u),a,u+"",e,t,i):void 0;l===void 0&&(l=a),hn(e,u,l)}},Ke)}function tl(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function nl(e,t){return t.length<2?e:Tt(e,Ar(t,0,-1))}function rl(e,t){return It(e,t)}var ol=Us(function(e,t,n){To(e,t,n)}),il=Object.prototype,sl=il.hasOwnProperty;function al(e,t){t=xe(t,e);var n=-1,r=t.length;if(!r)return!0;for(;++n<r;){var i=Ie(t[n]);if(i==="__proto__"&&!sl.call(e,"__proto__")||(i==="constructor"||i==="prototype")&&n<r-1)return!1}var a=nl(e,t);return a==null||delete a[Ie(tl(t))]}function cl(e){return wr(e)?void 0:e}var ul=1,fl=2,dl=4,mn=cc(function(e,t){var n={};if(e==null)return n;var r=!1;t=Gt(t,function(a){return a=xe(a,e),r||(r=a.length>1),a}),Ue(e,un(e),n),r&&(n=nt(n,ul|fl|dl,cl));for(var i=t.length;i--;)al(n,t[i]);return n});function ll(e,t,n,r){if(!ue(e))return e;t=xe(t,e);for(var i=-1,a=t.length,u=a-1,l=e;l!=null&&++i<a;){var _=Ie(t[i]),S=n;if(_==="__proto__"||_==="constructor"||_==="prototype")return e;if(i!=u){var w=l[_];S=void 0,S===void 0&&(S=ue(w)?w:wt(t[i+1])?[]:{})}kt(l,_,S),l=l[_]}return e}function _l(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var u=t[r],l=Tt(e,u);n(l,u)&&ll(a,xe(u,e),l)}return a}function pl(e,t){if(e==null)return{};var n=Gt(un(e),function(r){return[r]});return t=Zd(t),_l(e,n,function(r,i){return t(r,i[0])})}var bo=Br(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});function hl(e){return e?.mode==="off"||e?.mode==="on_device"||e?.mode==="online"?e.mode:"off"}const gl=6,ml=12,Oo=400,En=140,El=5,Po=70,wl=60,Al=40,yl=30,vl=60,Sl=`You rank a sales rep's upcoming meetings by how much they need preparation.
18
18
 
19
19
  Below are {{meeting_count}} numbered meetings, each with its account's CRM context (deals, tasks, recent calls).
20
20
 
@@ -26,21 +26,21 @@ Rules:
26
26
  - {{account_rule}}
27
27
  - Each "reason": ONE sentence, max {{reason_max_chars}} characters, only facts from the data — name the deal, task, rating, or date that makes it matter.
28
28
  - "hero": 1-2 sentences, max {{hero_max_chars}} characters, summarizing the week in plain business language.
29
- - Never invent facts. Never repeat field names, codes, or IDs.`,wl="Pick at most ONE meeting per account: when an account has several meetings, pick only its most important one.",Al="Prefer spreading picks across different accounts, but you may pick two meetings on the same account when each is genuinely high priority on its own.";function It(e){return typeof e!="number"||!Number.isFinite(e)?_l:Math.min(8,Math.max(1,Math.floor(e)))}function Ee(e,t){const n=e.trim();return n.length>t?n.slice(0,t-1).trimEnd()+"…":n}function yl(e,t){return e.replace(/\{\{(\w+)\}\}/g,(n,r)=>Object.prototype.hasOwnProperty.call(t,r)?t[r]:n)}const En=/^(\d{4})-(\d{2})-(\d{2})$/;function Oo(e,t){if(!t)return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate());const n=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(e),r=i=>Number(n.find(a=>a.type===i)?.value);return Date.UTC(r("year"),r("month")-1,r("day"))}function Po(e,t){const n=t?.now??new Date,r=Oo(n,t?.timeZone),i=En.exec(e);if(i){const[u,l,_]=[+i[1],+i[2]-1,+i[3]],S=Date.UTC(u,l,_),w=new Date(S);return w.getUTCFullYear()!==u||w.getUTCMonth()!==l||w.getUTCDate()!==_?null:Math.round((r-S)/864e5)}const a=new Date(e);return Number.isNaN(a.getTime())?null:Math.round((r-Oo(a,t?.timeZone))/864e5)}function vl(e,t){const n=t?.now??new Date,r=n.getTime();return e.filter(i=>{const a=Po(i.meeting_time,{now:n,timeZone:t?.timeZone});if(a===null)return!1;if(!En.test(i.meeting_time)){const l=new Date(i.meeting_time).getTime();if(Number.isNaN(l)||l<=r)return!1}const u=-a;return u>=0&&u<=dl}).sort((i,a)=>Io(i.meeting_time)-Io(a.meeting_time))}function Io(e){const t=Date.parse(e);return Number.isNaN(t)?Number.POSITIVE_INFINITY:t}function Sl(e){return e===0?"today":e===1?"yesterday":e<0?e===-1?"tomorrow":`in ${-e} days`:`${e} days ago`}function Tl(e,t){if(En.test(e))return e;const n=new Date(e);if(Number.isNaN(n.getTime()))return e;const r=n.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric",...t&&{timeZone:t}}),i=n.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",...t&&{timeZone:t}});return`${r} ${i}`.trim()}function bl(e,t,n,r){const i=Tl(t.meeting_time,r.timeZone),a=-(Po(t.meeting_time,r)??0),u=a===0?"today":a===1?"tomorrow":`in ${a} days`,l=t.attendee_count??0,S=[`${e}. "${Ee(t.meeting_subject,bo)}" — ${Ee(t.account_name,pl)} — ${i} (${u})`+(l>0?` — ${l} attendee${l===1?"":"s"}`:"")];for(const w of n?.sections??[]){if(w.items.length===0)continue;const P=w.items[0],C=P.fields??[],D=w.fields_curated&&C.length>0?" · "+C.slice(0,3).map(M=>`${Ee(M.label,gl)}: ${Ee(M.value,ml)}`).join(" · "):"",I=P.days_ago!=null?` (${Sl(P.days_ago)})`:"",x=w.items.length>1?`${w.items.length} records; key: `:"";S.push(` ${Ee(w.label,hl)}: ${x}${Ee(P.title,bo)}${D}${I}`)}return S.join(`
30
- `)}function Ol(e){const t=e.meetings,n=e.context??{},r=It(e.max_picks),i=e.one_per_account!==!1,a={now:e.now,timeZone:e.time_zone},u=t.map((_,S)=>bl(S+1,_,n[_.account_id],a)).join(`
31
- `);return`${yl(e.ranking_rules||El,{meeting_count:String(t.length),max_picks:String(r),reason_max_chars:String(mn),hero_max_chars:String(To),account_rule:i?wl:Al})}
29
+ - Never invent facts. Never repeat field names, codes, or IDs.`,Tl="Pick at most ONE meeting per account: when an account has several meetings, pick only its most important one.",bl="Prefer spreading picks across different accounts, but you may pick two meetings on the same account when each is genuinely high priority on its own.";function Ct(e){return typeof e!="number"||!Number.isFinite(e)?El:Math.min(8,Math.max(1,Math.floor(e)))}function Ee(e,t){const n=e.trim();return n.length>t?n.slice(0,t-1).trimEnd()+"…":n}function Ol(e,t){return e.replace(/\{\{(\w+)\}\}/g,(n,r)=>Object.prototype.hasOwnProperty.call(t,r)?t[r]:n)}const wn=/^(\d{4})-(\d{2})-(\d{2})$/;function Io(e,t){if(!t)return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate());const n=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(e),r=i=>Number(n.find(a=>a.type===i)?.value);return Date.UTC(r("year"),r("month")-1,r("day"))}function Co(e,t){const n=t?.now??new Date,r=Io(n,t?.timeZone),i=wn.exec(e);if(i){const[u,l,_]=[+i[1],+i[2]-1,+i[3]],S=Date.UTC(u,l,_),w=new Date(S);return w.getUTCFullYear()!==u||w.getUTCMonth()!==l||w.getUTCDate()!==_?null:Math.round((r-S)/864e5)}const a=new Date(e);return Number.isNaN(a.getTime())?null:Math.round((r-Io(a,t?.timeZone))/864e5)}function Pl(e,t){const n=t?.now??new Date,r=n.getTime();return e.filter(i=>{const a=Co(i.meeting_time,{now:n,timeZone:t?.timeZone});if(a===null)return!1;if(!wn.test(i.meeting_time)){const l=new Date(i.meeting_time).getTime();if(Number.isNaN(l)||l<=r)return!1}const u=-a;return u>=0&&u<=gl}).sort((i,a)=>No(i.meeting_time)-No(a.meeting_time))}function No(e){const t=Date.parse(e);return Number.isNaN(t)?Number.POSITIVE_INFINITY:t}function Il(e){return e===0?"today":e===1?"yesterday":e<0?e===-1?"tomorrow":`in ${-e} days`:`${e} days ago`}function Cl(e,t){if(wn.test(e))return e;const n=new Date(e);if(Number.isNaN(n.getTime()))return e;const r=n.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric",...t&&{timeZone:t}}),i=n.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",...t&&{timeZone:t}});return`${r} ${i}`.trim()}function Nl(e,t,n,r){const i=Cl(t.meeting_time,r.timeZone),a=-(Co(t.meeting_time,r)??0),u=a===0?"today":a===1?"tomorrow":`in ${a} days`,l=t.attendee_count??0,S=[`${e}. "${Ee(t.meeting_subject,Po)}" — ${Ee(t.account_name,wl)} — ${i} (${u})`+(l>0?` — ${l} attendee${l===1?"":"s"}`:"")];for(const w of n?.sections??[]){if(w.items.length===0)continue;const P=w.items[0],C=P.fields??[],D=w.fields_curated&&C.length>0?" · "+C.slice(0,3).map(M=>`${Ee(M.label,yl)}: ${Ee(M.value,vl)}`).join(" · "):"",I=P.days_ago!=null?` (${Il(P.days_ago)})`:"",x=w.items.length>1?`${w.items.length} records; key: `:"";S.push(` ${Ee(w.label,Al)}: ${x}${Ee(P.title,Po)}${D}${I}`)}return S.join(`
30
+ `)}function Rl(e){const t=e.meetings,n=e.context??{},r=Ct(e.max_picks),i=e.one_per_account!==!1,a={now:e.now,timeZone:e.time_zone},u=t.map((_,S)=>Nl(S+1,_,n[_.account_id],a)).join(`
31
+ `);return`${Ol(e.ranking_rules||Sl,{meeting_count:String(t.length),max_picks:String(r),reason_max_chars:String(En),hero_max_chars:String(Oo),account_rule:i?Tl:bl})}
32
32
 
33
33
  Answer with JSON ONLY — no other text. The object has exactly two keys:
34
34
  "hero": the summary as one string.
35
35
  "top": an array with one entry per picked meeting, highest priority first. Each entry is an object with "m" (the picked meeting's number from the list below, as an integer) and "reason" (one sentence as a string).
36
36
 
37
37
  MEETINGS:
38
- ${u}`}function Pl(e){try{return JSON.parse(e)}catch{const t=e.replace(/[“”]/g,'"').replace(/[‘’]/g,"'").replace(/,\s*([}\]])/g,"$1");try{return JSON.parse(t)}catch{return null}}}function Il(e){return Array.isArray(e.top)}function Cl(e){let t=null;for(let n=e.indexOf("{");n!==-1;n=e.indexOf("{",n+1)){let r=0,i=!1,a=!1;for(let u=n;u<e.length;u++){const l=e[u];if(i)a?a=!1:l==="\\"?a=!0:l==='"'&&(i=!1);else if(l==='"')i=!0;else if(l==="{")r+=1;else if(l==="}"&&(r-=1,r===0)){const _=Pl(e.slice(n,u+1));if(_){if(Il(_))return _;t||(t=_)}break}}}return t}function Rl(e){const t=e??{},n=[];if(Array.isArray(t.top))for(const i of t.top){const a=typeof i?.m=="number"?i.m:Number(i?.m),u=typeof i?.reason=="string"?i.reason.trim():"";!Number.isInteger(a)||!u||n.push({m:a,reason:Ee(u,mn)})}return{hero:typeof t.hero=="string"?Ee(t.hero,To):"",top:n}}function Nl(e){const t=Cl(e??"");return t?Rl(t):{hero:"",top:[]}}function Ll(e,t,n={}){const r=It(n.maxPicks),i=n.onePerAccount!==!1,a=n.windowCount??t.length,u=new Set,l=new Set,_=[];let S=0;for(const w of e.top??[]){const P=Number.isInteger(w.m)?t[w.m-1]:void 0,C=typeof w.reason=="string"?w.reason.trim():"";if(!P||!C||u.has(P.event_id)){S+=1;continue}if(i&&l.has(P.account_id)){S+=1;continue}if(u.add(P.event_id),l.add(P.account_id),_.push({event_id:P.event_id,rank:_.length+1,reason:Ee(C,mn)}),_.length>=r)break}return{top:_,collapsed_count:Math.max(0,a-_.length),dropped:S}}function Dl(e,t={}){const r=t.onePerAccount!==!1?new Set(e.map(i=>i.account_id)).size:e.length;return Math.min(It(t.maxPicks),r)}function $l(e,t){const n=vl(e,t);return{windowMeetings:n,rankedMeetings:n.slice(0,ll),windowCount:n.length}}const Ul="/core/api/protected/pia-prepare/pia-search",Co=3e3,Ml=512,Ro=3e4,xl={available:!0,offline:!1,runtime:"bedrock-online"};function wn(e,t,n){return new Promise((r,i)=>{const a=setTimeout(()=>i(new Error(`${n} timed out after ${t}ms`)),t);e.then(u=>{clearTimeout(a),r(u)},u=>{clearTimeout(a),i(u)})})}function No(e){return e.startsWith("http")?e:`https://${e}`}function Lo(e){const t=e?.pitcher?.token_claims?.["https://pitcher.com/claims/urls"]?.custom_domain;if(typeof t=="string"&&t.length>0)return No(t);const n=e?.pitcher?.organization?.metadata?.custom_domain;if(typeof n=="string"&&n.length>0)return No(n);throw new Error("piaSearchAnswer: no customer domain found in env (token_claims / organization metadata)")}async function An(e,t,n,r,i){const a=new AbortController,u=setTimeout(()=>a.abort(),r);try{const l=await fetch(e,{method:"POST",signal:a.signal,headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(t)});if(!l.ok)throw new Error(`${i} ${l.status}`);return await l.json()}catch(l){throw l?.name==="AbortError"?new Error(`${i} online request timed out after ${r}ms`):l}finally{clearTimeout(u)}}function jl(e,t){return`You are PIA, a sales content assistant. Answer the rep's question using ONLY the CONTEXT below — do not invent content that is not in it.
38
+ ${u}`}function Ll(e){try{return JSON.parse(e)}catch{const t=e.replace(/[“”]/g,'"').replace(/[‘’]/g,"'").replace(/,\s*([}\]])/g,"$1");try{return JSON.parse(t)}catch{return null}}}function Dl(e){return Array.isArray(e.top)}function $l(e){let t=null;for(let n=e.indexOf("{");n!==-1;n=e.indexOf("{",n+1)){let r=0,i=!1,a=!1;for(let u=n;u<e.length;u++){const l=e[u];if(i)a?a=!1:l==="\\"?a=!0:l==='"'&&(i=!1);else if(l==='"')i=!0;else if(l==="{")r+=1;else if(l==="}"&&(r-=1,r===0)){const _=Ll(e.slice(n,u+1));if(_){if(Dl(_))return _;t||(t=_)}break}}}return t}function Ul(e){const t=e??{},n=[];if(Array.isArray(t.top))for(const i of t.top){const a=typeof i?.m=="number"?i.m:Number(i?.m),u=typeof i?.reason=="string"?i.reason.trim():"";!Number.isInteger(a)||!u||n.push({m:a,reason:Ee(u,En)})}return{hero:typeof t.hero=="string"?Ee(t.hero,Oo):"",top:n}}function Ml(e){const t=$l(e??"");return t?Ul(t):{hero:"",top:[]}}function xl(e,t,n={}){const r=Ct(n.maxPicks),i=n.onePerAccount!==!1,a=n.windowCount??t.length,u=new Set,l=new Set,_=[];let S=0;for(const w of e.top??[]){const P=Number.isInteger(w.m)?t[w.m-1]:void 0,C=typeof w.reason=="string"?w.reason.trim():"";if(!P||!C||u.has(P.event_id)){S+=1;continue}if(i&&l.has(P.account_id)){S+=1;continue}if(u.add(P.event_id),l.add(P.account_id),_.push({event_id:P.event_id,rank:_.length+1,reason:Ee(C,En)}),_.length>=r)break}return{top:_,collapsed_count:Math.max(0,a-_.length),dropped:S}}function jl(e,t={}){const r=t.onePerAccount!==!1?new Set(e.map(i=>i.account_id)).size:e.length;return Math.min(Ct(t.maxPicks),r)}function Fl(e,t){const n=Pl(e,t);return{windowMeetings:n,rankedMeetings:n.slice(0,ml),windowCount:n.length}}const Wl="/core/api/protected/pia-prepare/pia-search",Ro=3e3,ql=512,Lo=3e4,Gl={available:!0,offline:!1,runtime:"bedrock-online"};function An(e,t,n){return new Promise((r,i)=>{const a=setTimeout(()=>i(new Error(`${n} timed out after ${t}ms`)),t);e.then(u=>{clearTimeout(a),r(u)},u=>{clearTimeout(a),i(u)})})}function Do(e){return e.startsWith("http")?e:`https://${e}`}function $o(e){const t=e?.pitcher?.token_claims?.["https://pitcher.com/claims/urls"]?.custom_domain;if(typeof t=="string"&&t.length>0)return Do(t);const n=e?.pitcher?.organization?.metadata?.custom_domain;if(typeof n=="string"&&n.length>0)return Do(n);throw new Error("piaSearchAnswer: no customer domain found in env (token_claims / organization metadata)")}async function yn(e,t,n,r,i){const a=new AbortController,u=setTimeout(()=>a.abort(),r);try{const l=await fetch(e,{method:"POST",signal:a.signal,headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(t)});if(!l.ok)throw new Error(`${i} ${l.status}`);return await l.json()}catch(l){throw l?.name==="AbortError"?new Error(`${i} online request timed out after ${r}ms`):l}finally{clearTimeout(u)}}function zl(e,t){return`You are PIA, a sales content assistant. Answer the rep's question using ONLY the CONTEXT below — do not invent content that is not in it.
39
39
 
40
40
  CONTEXT:
41
41
  ${typeof t=="string"&&t.trim().length>0?t.trim():"No content context was provided."}
42
42
 
43
43
  QUESTION: ${e}
44
44
 
45
- Answer concisely in plain text. If the context does not contain the answer, say you could not find it in the available content. Refer to content by its name only — do not include any file ids or codes in your answer.`}async function Fl(){return(await y.highLevelApi.API.request("get_env"))?.mode==="IOS"?y.highLevelApi.API.request("ai.get_capabilities"):{...xl}}function yn(e){return!e||typeof e.prompt!="string"||e.prompt.trim()===""?Promise.reject(new Error("prompt is required and must be a non-empty string")):y.highLevelApi.API.request("ai.complete",e)}async function Wl(e){if(!e||typeof e.query!="string"||e.query.trim()==="")return Promise.reject(new Error("query is required and must be a non-empty string"));const t=await y.highLevelApi.API.request("get_env"),n=fl(t?.launch_darkly?.pia_search_config);if(n==="off")throw new Error('pia_search_disabled: pia_search_config resolves to mode "off"');if(n==="on_device"&&t?.mode==="IOS")try{if((await wn(y.highLevelApi.API.request("ai.get_capabilities"),Co,"ai.get_capabilities"))?.available)return{answer:(await yn({prompt:jl(e.query,e.context_text),max_tokens:e.max_tokens??Ml})).text,source:"on_device"}}catch(u){console.warn("[piaSearchAnswer] on-device path unavailable, falling back to online:",u)}const r=e.instance_id||t?.pitcher?.instance?.id;if(!r)throw new Error("piaSearchAnswer: instance_id could not be resolved from the payload or env");const a=(await An(`${Lo(t)}${Ul}`,{query:e.query,instance_id:r,...Array.isArray(e.file_ids)&&e.file_ids.length>0&&{file_ids:e.file_ids},...e.include_document_text===!0&&{include_document_text:!0},...Array.isArray(e.expansion_terms)&&e.expansion_terms.length>0&&{expansion_terms:e.expansion_terms}},t.pitcher.access_token,Ro,"pia_search"))?.pia_search??{};return{answer:typeof a.answer=="string"?a.answer:"",cited_file_ids:Array.isArray(a.cited_file_ids)?a.cited_file_ids:[],...a.confidence&&{confidence:a.confidence},source:"online"}}const ql="/core/api/protected/pia-prepare/weekly-focus",Gl=e=>220+60*e,zl=12e4;async function Hl(e){if(!e||!Array.isArray(e.meetings))return Promise.reject(new Error("meetings is required and must be an array"));const t=await y.highLevelApi.API.request("get_env"),n=e.time_zone||Intl.DateTimeFormat().resolvedOptions().timeZone,{windowMeetings:r,rankedMeetings:i,windowCount:a}=$l(e.meetings,{timeZone:n});if(i.length===0)return{hero:"",top:[],collapsed_count:0,source:t?.mode==="IOS"?"on_device":"online"};const u=It(e.max_picks),l={maxPicks:u,onePerAccount:e.one_per_account,windowCount:a};if(t?.mode==="IOS")try{if((await wn(y.highLevelApi.API.request("ai.get_capabilities"),Co,"ai.get_capabilities"))?.available){const C=Ol({meetings:i,context:e.context,max_picks:u,one_per_account:e.one_per_account,time_zone:n}),D=async()=>{const j=await wn(yn({prompt:C,max_tokens:Gl(u)}),zl,"ai.complete"),Y=Nl(j.text);return{parsed:Y,resolved:Ll(Y,i,l)}};let I=await D();if(I.resolved.top.length<Dl(i,l))try{const j=await D();j.resolved.top.length>I.resolved.top.length&&(I=j)}catch(j){console.warn("[weeklyFocusRank] on-device retry failed, keeping the first attempt:",j)}const{parsed:x,resolved:M}=I;if(M.top.length>0||x.hero)return{hero:x.hero,top:M.top,collapsed_count:M.collapsed_count,source:"on_device"}}}catch(P){console.warn("[weeklyFocusRank] on-device path unavailable, falling back to online:",P)}const _=e.instance_id||t?.pitcher?.instance?.id;if(!_)throw new Error("weeklyFocusRank: instance_id could not be resolved from the payload or env");const w=(await An(`${Lo(t)}${ql}`,{instance_id:_,meetings:r,time_zone:n,...e.context&&{context:e.context},...e.max_picks!==void 0&&{max_picks:u},...e.one_per_account!==void 0&&{one_per_account:e.one_per_account}},t.pitcher.access_token,Ro,"weekly_focus"))?.weekly_focus??{};return{hero:typeof w.hero=="string"?w.hero:"",top:Array.isArray(w.top)?w.top:[],collapsed_count:typeof w.collapsed_count=="number"?w.collapsed_count:0,source:"online"}}const Bl="/core/api/protected/appsdb";async function Vl(){const e=await y.highLevelApi.API.request("get_env"),t=e?.pitcher?.token_claims?.["https://pitcher.com/claims/urls"]?.custom_domain,n=e?.pitcher?.organization?.metadata?.custom_domain;let r=t||n||"";return r&&!r.startsWith("http")&&(r=`https://${r}`),{isIos:(e?.mode??e?.pitcher?.mode)==="IOS",origin:r,accessToken:e?.pitcher?.access_token??"",instanceId:e?.pitcher?.instance?.id}}const Yl=6e4;let Fe=null;function Ct(){if(Fe&&Date.now()-Fe.fetchedAt<Yl)return Fe.promise;const e=Vl();return Fe={promise:e,fetchedAt:Date.now()},e.catch(()=>{Fe?.promise===e&&(Fe=null)}),e}async function We(e,t,n){const r=e.origin||(typeof window<"u"?window.location.origin:""),i=new URL(`${r}${Bl}${t}`);Object.entries(n.params??{}).forEach(([l,_])=>{_!=null&&i.searchParams.set(l,String(_))});const a=await fetch(i.toString(),{method:n.method,credentials:"include",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.accessToken}`,...e.instanceId?{"x-instance-id":e.instanceId}:{}},...n.body!==void 0?{body:JSON.stringify(n.body)}:{}});if(!a.ok){let l;try{l=await a.json()}catch{l=void 0}const _=new Error(`AppsDB request failed: ${a.status}${l?.error?` — ${l.error}`:""}`);throw _.status=a.status,_}if(a.status===204||a.status===205)return;const u=await a.text();return u?JSON.parse(u):void 0}function Do(e,t){return e?.error_code===t||e?.errorCode===t||e?.code===t||typeof e?.reason=="string"&&e.reason.includes(t)||typeof e?.message=="string"&&e.message.includes(t)}function $o(e){return Do(e,"type_not_synced")}function Rt(e){return Do(e,"requestTypeDoesNotExists")}function kl(e){if(/^'.*'$/.test(e))return e.slice(1,-1).replace(/''/g,"'");if(/^-?\d+(\.\d+)?$/.test(e))return Number(e);if(/^true$/i.test(e))return!0;if(/^false$/i.test(e))return!1;if(/^null$/i.test(e))return null}function Zl(e){return e.replace(/'(?:[^']|'')*'/g,"''")}function Xl(e){const t=[];let n="",r=!1,i=0;for(;i<e.length;){const a=e[i];if(a==="'"){if(r&&e[i+1]==="'"){n+="''",i+=2;continue}r=!r,n+=a,i+=1;continue}if(!r){const u=e.slice(i).match(/^ AND /i);if(u){t.push(n),n="",i+=u[0].length;continue}}n+=a,i+=1}return r?null:(t.push(n),t)}function Kl(e){const n=e.replace(/\s+/g," ").trim().match(/^SELECT \* FROM ([A-Za-z0-9_]+)( WHERE (.+))?$/i);if(!n)return null;const r=n[1],i=n[3];if(!i)return{type:r,conditions:[]};if(/\bOR\b|\bNOT\b|\bLIKE\b|\bIN\b|[<>]|!=/i.test(Zl(i)))return null;const a=Xl(i);if(!a)return null;const u=[];for(const l of a){const _=l.trim().match(/^([A-Za-z0-9_.]+) ?= ?(.+)$/);if(!_)return null;const S=kl(_[2].trim());if(S===void 0)return null;u.push({path:_[1],value:S})}return{type:r,conditions:u}}function Jl(e,t){return t.every(({path:n,value:r})=>{const i=n.split(".").reduce((a,u)=>a?.[u],e);return r===null?i==null:i==null?!1:String(i)===String(r)})}async function Ql(e){if(!e?.type||typeof e.type!="string")return Promise.reject(new Error("type is required and must be a non-empty string"));const t=await Ct();if(t.isIos)try{return await y.highLevelApi.API.request("appsdb_get_entries",e)}catch(n){if(!$o(n)&&!Rt(n))throw n}return We(t,"",{method:"GET",params:e})}async function e_(e){if(!e?.data||typeof e.data!="object")return Promise.reject(new Error("data is required and must be an object"));if(!e.id&&!e.type)return Promise.reject(new Error("type is required when creating an entry (no id provided)"));const t=await Ct();if(t.isIos)try{return await y.highLevelApi.API.request("appsdb_upsert_entry",e)}catch(n){if(!Rt(n))throw n}return e.id?We(t,`/${encodeURIComponent(e.id)}`,{method:"PUT",body:{data:e.data}}):We(t,"",{method:"POST",body:e})}async function t_(e){if(!e?.id||typeof e.id!="string")return Promise.reject(new Error("id is required and must be a non-empty string"));const t=await Ct();if(t.isIos)try{return await y.highLevelApi.API.request("appsdb_delete_entry",e)}catch(n){if(!Rt(n))throw n}await We(t,`/${encodeURIComponent(e.id)}`,{method:"DELETE"})}async function n_(){try{return!!await y.highLevelApi.API.request("is_offline")}catch{return!1}}const r_=1e3;async function Uo(e){try{const t=[];let n=!0;for(;n;){const i=await y.highLevelApi.API.request("appsdb_get_entries",{type:e.type,limit:r_,offset:t.length}),a=i?.entries??[];t.push(...a),n=!!i?.hasMore&&a.length>0}const r=t.filter(i=>Jl(i,e.conditions));return{entries:r,totalCount:r.length,hasMore:!1}}catch(t){if($o(t)||Rt(t))return null;throw t}}async function o_(e){if(!e?.query||typeof e.query!="string")return Promise.reject(new Error("query is required and must be a non-empty string"));const t=await Ct();if(t.isIos){const n=Kl(e.query);let r=!1;if(n&&await n_()){const i=await Uo(n);if(i)return i;r=!0}try{return await We(t,"/psql",{method:"POST",body:e})}catch(i){if(n&&!r&&i instanceof TypeError){const a=await Uo(n);if(a)return a}throw i}}return We(t,"/psql",{method:"POST",body:e})}function i_(e={}){return this.API.request("open",e)}function s_(e){return this.API.request("open_external_url",e)}function a_(){return this.API.request("get_env").then(e=>gn(e,"pitcher.org_config.segment"))}function c_(e){return this.API.request("update_my_user",e)}function u_(){return this.API.request("is_offline")}function f_(e){return this.API.request("get_canvases",e)}function d_(e){return this.API.request("create_canvas",e)}function l_(e){return this.API.request("delete_canvas",e)}function __(e){let t=!1;return typeof window<"u"&&(t=new URLSearchParams(window.location.search).get("debug")==="true"||!!window.debug),t&&console.info("JS API UPDATE CANVAS",e),this.API.request("update_canvas",e).then(n=>(t&&console.info("JS API UPDATE CANVAS RESPONSE",n),n))}function p_(e){return this.API.request("update_canvas_indicators",e)}function h_(e){return this.API.request("get_canvas",e)}function g_(e){return this.API.request("get_canvas_sections_by_ids",e)}function m_(e){return this.API.request("share_canvas",e)}function E_(e){return this.API.request("get_canvas_recommended_files",e)}function w_(e){return this.API.request("get_canvas_theme",e)}function A_(e){return this.API.request("unassign_canvas_theme",e)}function y_(e){const t={...e};return t.type&&(t.type=Array.isArray(t.type)?t.type:[t.type]),t.content_type&&(t.content_type=Array.isArray(t.content_type)?t.content_type:[t.content_type]),this.API.request("get_files",t)}function v_(e){return this.API.request("download_file",e)}function S_(e){let t;return!e?.app_name&&typeof window<"u"&&window.location.href.startsWith("file://")&&(t=window.location.href.match(/pitcher(?:%20|\s+)folders\/files\/([^/]+)\//i)?.[1]),t?this.API.request("get_file",{file_id:t}).then(n=>n?.metadata??{}):this.API.request("get_app_config",e)}function T_(e){const{id:t,file_id:n}=e;return this.API.request("get_file",{...e,file_id:t||n})}function b_(e){return this.API.request("get_file_revision_data",e)}function O_(e){return this.API.request("update_file",e)}function P_(e){return this.API.request("delete_file",e)}function I_(e){return this.API.request("create_file",e)}function C_(){return this.API.request("select_device_file")}function R_(e){return this.API.request("delete_local_file",e)}function N_(e){const{id:t,file_id:n}=e;return this.API.request("get_file_revisions",{file_id:t||n})}function L_(e){return this.API.request("search",e)}function D_(e){return this.API.request("get_users",e)}function $_(e){return this.API.request("refresh_service_token",e??{})}function U_(){return this.API.request("refresh_access_token")}function M_(e){return this.API.request("fetch_document_info",e)}function x_(e){return this.API.request("render_page_as_image",e)}function j_(e){return this.API.request("toast",e)}const F_=new Set(["SELECT","FROM","WHERE","AND","OR","NOT","IN","LIKE","ORDER","BY","GROUP","HAVING","LIMIT","OFFSET","ASC","DESC","NULLS","FIRST","LAST","NULL","TRUE","FALSE","COUNT","SUM","AVG","MIN","MAX","COUNT_DISTINCT","CALENDAR_MONTH","CALENDAR_QUARTER","CALENDAR_YEAR","DAY_IN_MONTH","DAY_IN_WEEK","DAY_IN_YEAR","DAY_ONLY","FISCAL_MONTH","FISCAL_QUARTER","FISCAL_YEAR","HOUR_IN_DAY","WEEK_IN_MONTH","WEEK_IN_YEAR","INCLUDES","EXCLUDES","ABOVE","BELOW","ABOVE_OR_BELOW","AT","TYPEOF","WHEN","THEN","ELSE","END","USING","SCOPE","DATA","CATEGORY","ROLLUP","CUBE","FORMAT","CONVERTCURRENCY","TOLABEL","DISTANCE","GEOLOCATION"]),vn=["COUNT","SUM","AVG","MIN","MAX","COUNT_DISTINCT"];function Mo(e){return F_.has(e.toUpperCase())}function xo(e){const t=e.trim();return!!(t.startsWith("'")&&t.endsWith("'")||t.startsWith('"')&&t.endsWith('"')||/^-?\d+(\.\d+)?$/.test(t)||/^(true|false)$/i.test(t)||/^null$/i.test(t)||/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?(Z|[+-]\d{2}:\d{2})?)?$/.test(t)||/^(TODAY|YESTERDAY|TOMORROW|LAST_WEEK|THIS_WEEK|NEXT_WEEK|LAST_MONTH|THIS_MONTH|NEXT_MONTH|LAST_90_DAYS|NEXT_90_DAYS|LAST_N_DAYS:\d+|NEXT_N_DAYS:\d+|LAST_N_WEEKS:\d+|NEXT_N_WEEKS:\d+|LAST_N_MONTHS:\d+|NEXT_N_MONTHS:\d+|LAST_N_QUARTERS:\d+|NEXT_N_QUARTERS:\d+|LAST_N_YEARS:\d+|NEXT_N_YEARS:\d+|THIS_QUARTER|LAST_QUARTER|NEXT_QUARTER|THIS_YEAR|LAST_YEAR|NEXT_YEAR|THIS_FISCAL_QUARTER|LAST_FISCAL_QUARTER|NEXT_FISCAL_QUARTER|THIS_FISCAL_YEAR|LAST_FISCAL_YEAR|NEXT_FISCAL_YEAR)$/i.test(t))}function W_(e){return/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?(Z|[+-]\d{2}:\d{2})?)?$/.test(e)}function Ce(e,t,n){const r=e.trim();if(Mo(r)||xo(r))return r;if(r==="__FIELDS_ALL_PLACEHOLDER__")return`{${t}:_soup}`;if(r==="*")return"*";if(r.startsWith("{")&&r.endsWith("}"))return r;if(r.includes(".")){const i=r.split("."),a=i[0];if(n.has(a.toLowerCase())&&n.get(a.toLowerCase())===t){const u=i.slice(1).join(".");return`{${t}:${u}}`}return`{${t}:${r}}`}return`{${t}:${r}}`}function jo(e,t,n){for(const r of vn){const i=new RegExp(`\\b${r}\\s*\\(([^)]+)\\)`,"gi");e=e.replace(i,(a,u)=>{const l=u.trim();if(l==="*")return`${r}(*)`;if(l.toUpperCase().startsWith("DISTINCT ")){const S=l.substring(9).trim(),w=Ce(S,t,n);return`${r}(DISTINCT ${w})`}const _=Ce(l,t,n);return`${r}(${_})`})}return e}function q_(e){const t=[];let n=0,r="";for(let i=0;i<e.length;i++){const a=e[i];a==="("?(n++,r+=a):a===")"?(n--,r+=a):a===","&&n===0?(r.trim()&&t.push(r.trim()),r=""):r+=a}return r.trim()&&t.push(r.trim()),t}function G_(e,t,n){return e.map(r=>{const i=r.match(/^(.+?)\s+(?:AS\s+)?([A-Za-z_][A-Za-z0-9_]*)$/i);let a=r,u="";if(i&&(a=i[1].trim(),u=i[2]),vn.some(S=>new RegExp(`\\b${S}\\s*\\(`,"i").test(a))){const S=jo(a,t,n);return u?`${S} ${u}`:S}const _=Ce(a,t,n);return u?`${_} ${u}`:_})}function z_(e){let t=e.replace(/\s*!=\s*null\b/gi," IS NOT NULL");return t=t.replace(/\s*<>\s*null\b/gi," IS NOT NULL"),t=t.replace(/\s*=\s*null\b/gi," IS NULL"),t}function Fo(e,t,n){let r="",i=0;const a=e.length;for(;i<a;){const u=e[i];if(/\s/.test(u)){r+=u,i++;continue}if(u==="'"||u==='"'){const l=u;for(r+=u,i++;i<a&&e[i]!==l;)e[i]==="\\"&&i+1<a?(r+=e[i]+e[i+1],i+=2):(r+=e[i],i++);i<a&&(r+=e[i],i++);continue}if(/[()=<>!,]/.test(u)){r+=u,i++,(u==="!"||u==="<"||u===">")&&i<a&&e[i]==="="&&(r+=e[i],i++);continue}if(/[a-zA-Z_]/.test(u)){let l="";for(;i<a&&/[a-zA-Z0-9_.]/.test(e[i]);)l+=e[i],i++;Mo(l)||xo(l)?r+=l:r+=Ce(l,t,n);continue}if(/[0-9-]/.test(u)){let l="";for(u==="-"&&(l+=u,i++);i<a&&/[0-9.:\-TZ+]/.test(e[i]);)l+=e[i],i++;W_(l)?r+=`'${l}'`:r+=l;continue}r+=u,i++}return r=z_(r),r}function H_(e){const t=[],n=e.split(/,(?![^()]*\))/);for(const r of n){const i=r.trim();if(!i)continue;const a=i.match(/^(.+?)\s*(ASC|DESC)?\s*(NULLS\s+(?:FIRST|LAST))?$/i);if(a){const u=a[1].trim();let l=a[2]?a[2].toUpperCase():"";a[3]&&(l+=(l?" ":"")+a[3].toUpperCase()),t.push({field:u,direction:l})}else t.push({field:i,direction:""})}return t}function B_(e,t,n){return e.map(({field:r,direction:i})=>{const a=vn.some(l=>new RegExp(`\\b${l}\\s*\\(`,"i").test(r));let u;return a?u=jo(r,t,n):u=Ce(r,t,n),i?`${u} ${i}`:u})}function V_(e){return e.split(/,(?![^()]*\))/).map(t=>t.trim()).filter(Boolean)}function Y_(e,t,n){return e.map(r=>/^(ROLLUP|CUBE)\s*\(/i.test(r)?r.replace(/\(([^)]+)\)/g,(i,a)=>`(${a.split(",").map(_=>_.trim()).map(_=>Ce(_,t,n)).join(", ")})`):Ce(r,t,n))}function k_(e){const t=[],n=e.match(/^([A-Za-z0-9_]+)(?:\s+(?:AS\s+)?([A-Za-z_][A-Za-z0-9_]*))?/i);if(!n)return{primary:"",joins:t};const r=n[1],i=n[2],a=/(LEFT\s+OUTER\s+JOIN|LEFT\s+JOIN|INNER\s+JOIN|JOIN)\s+([A-Za-z0-9_]+)(?:\s+(?:AS\s+)?([A-Za-z_][A-Za-z0-9_]*))?\s+ON\s+([^,]+?)(?=(?:LEFT|INNER|JOIN|$))/gi;let u;for(;(u=a.exec(e))!==null;)t.push({type:u[1].toUpperCase().replace(/\s+/g," "),object:u[2],alias:u[3],on:u[4]?.trim()});return{primary:r,alias:i,joins:t}}function Z_(e){const t=[];let n="",r=0,i="",a=!1;for(let u=0;u<e.length;u++){const l=e[u];if(l==="("){if(r++,r===1){const _=e.substring(u+1).trimStart();if(/^SELECT\s/i.test(_)){a=!0,i=l;continue}}a?i+=l:n+=l}else l===")"?a?(i+=l,r--,r===0&&(t.push(i),i="",a=!1)):(r--,n+=l):a?i+=l:n+=l}return{cleanQuery:n,subqueries:t}}function Sn(e){const{cleanQuery:t}=Z_(e),n=t.match(/FROM\s+([A-Za-z0-9_]+)(?:\s+(?:AS\s+)?[A-Za-z_][A-Za-z0-9_]*)?(?=\s+WHERE\s+|\s+ORDER\s+BY\s+|\s+GROUP\s+BY\s+|\s+HAVING\s+|\s+LIMIT\s+|\s+OFFSET\s+|\s*$)/i);return{primaryObject:n?n[1]:null,cleanQuery:t}}function X_(e){if(!e||typeof e!="string")return"";let t=e.replace(/\s+/g," ").trim();const{primaryObject:n,cleanQuery:r}=Sn(t);if(!n)return e;t=r,t=t.replace(/\bFIELDS\s*\(\s*(ALL|STANDARD|CUSTOM)\s*\)/gi,"__FIELDS_ALL_PLACEHOLDER__");const i=t.match(/SELECT\s+([\s\S]+?)\s+FROM\s+/i);if(!i)return e;const a=t.match(/FROM\s+([\s\S]+?)(?=\s+WHERE\s+|\s+ORDER\s+BY\s+|\s+GROUP\s+BY\s+|\s+HAVING\s+|\s+LIMIT\s+|\s+OFFSET\s+|\s*$)/i),u=a?k_(a[1].trim()):{},l=t.match(/WHERE\s+([\s\S]+?)(?=\s+ORDER\s+BY\s+|\s+GROUP\s+BY\s+|\s+HAVING\s+|\s+LIMIT\s+|\s+OFFSET\s+|\s*$)/i),_=t.match(/GROUP\s+BY\s+([\s\S]+?)(?=\s+HAVING\s+|\s+ORDER\s+BY\s+|\s+LIMIT\s+|\s+OFFSET\s+|\s*$)/i),S=t.match(/HAVING\s+([\s\S]+?)(?=\s+ORDER\s+BY\s+|\s+LIMIT\s+|\s+OFFSET\s+|\s*$)/i),w=t.match(/ORDER\s+BY\s+([\s\S]+?)(?=\s+LIMIT\s+|\s+OFFSET\s+|\s*$)/i),P=t.match(/LIMIT\s+(\d+)/i),C=t.match(/OFFSET\s+(\d+)/i),D=new Map;u.alias&&D.set(u.alias.toLowerCase(),n),D.set(n.toLowerCase(),n);const I=[],x=q_(i[1].trim()),M=G_(x,n,D);I.push(`SELECT ${M.join(", ")}`),I.push(`FROM {${n}}`);const j=[];if(l){const Y=Fo(l[1].trim(),n,D);j.push(Y)}if(j.length>0&&I.push(`WHERE ${j.join(" AND ")}`),_){const Y=V_(_[1].trim()),ve=Y_(Y,n,D);I.push(`GROUP BY ${ve.join(", ")}`)}if(S){const Y=Fo(S[1].trim(),n,D);I.push(`HAVING ${Y}`)}if(w){const Y=H_(w[1].trim()),ve=B_(Y,n,D);I.push(`ORDER BY ${ve.join(", ")}`)}return P&&I.push(`LIMIT ${P[1]}`),C&&I.push(`OFFSET ${C[1]}`),I.join(" ")}function K_(e){return y.highLevelApi.API.request("query",e)}function Wo(e){return y.highLevelApi.API.request("crm_query",e)}function J_(e){const{cleanQuery:t}=Sn(e.replace(/\s+/g," ").trim()),n=t.match(/SELECT\s+([\s\S]+?)\s+FROM\s+/i);if(!n)return[];const r=n[1],i=[];let a=0,u="";for(let l=0;l<r.length;l++){const _=r[l];_==="("?(a++,u+=_):_===")"?(a--,u+=_):_===","&&a===0?(u.trim()&&i.push(u.trim()),u=""):u+=_}return u.trim()&&i.push(u.trim()),i.map(l=>{const _=l.match(/^(.+?)\s+(?:AS\s+)?([A-Za-z_][A-Za-z0-9_]*)$/i);return _?_[1].trim():l.trim()})}function Q_(e){const{primaryObject:t}=Sn(e.replace(/\s+/g," ").trim());return t??""}function ep(e,t,n){const r=t.split(".");if(r.length===1){e[t]=n;return}let i=e;for(let a=0;a<r.length-1;a++){const u=r[a];(!i[u]||typeof i[u]!="object")&&(i[u]={}),i=i[u]}i[r[r.length-1]]=n}function tp(e){const t=e.trim();return t==="*"||/^FIELDS\s*\(\s*(ALL|STANDARD|CUSTOM)\s*\)$/i.test(t)}function np(e,t,n){return!e||!Array.isArray(e)?[]:e.map(r=>{const i={};t.forEach((u,l)=>{if(l<r.length){const _=r[l];tp(u)?_&&typeof _=="object"&&!Array.isArray(_)&&Object.assign(i,_):ep(i,u,_)}});const a=i.Id||i.id||"";return i.attributes={type:n,url:a?`/services/data/v57.0/sobjects/${n}/${a}`:""},i})}async function rp(e){const t=e.query;if(!t||typeof t!="string")return Promise.reject(new Error("Query is required and must be a string"));let n=!1;try{const r=await y.highLevelApi.API.request("get_env"),i=r?.mode==="IOS",a=r?.launch_darkly?.sfdc_offline_enabled===!0;n=i&&a}catch{n=!1}if(console.log("[crmQueryAdaptive] Called query: ",t),n){const r=J_(t),i=Q_(t);let a=X_(t);if(!a.includes("__locally_deleted__")){const S=a.match(/FROM\s+\{([A-Za-z0-9_]+)\}/)?.[1];if(S){const w=`({${S}:__locally_deleted__} = 0 OR {${S}:__locally_deleted__} = 'false' OR {${S}:__locally_deleted__} IS NULL)`;a.includes(" WHERE ")?a=a.replace(/\s+WHERE\s+([\s\S]+?)(?=\s+ORDER\s+BY\s+|\s+GROUP\s+BY\s+|\s+HAVING\s+|\s+LIMIT\s+|\s+OFFSET\s+|\s*$)/i,(P,C)=>` WHERE (${C}) AND ${w}`):a=a.replace(/(FROM\s+\{[A-Za-z0-9_]+\})((\s+(?:ORDER\s+BY|GROUP\s+BY|HAVING|LIMIT|OFFSET)[\s\S]*)?)$/i,(P,C,D)=>`${C} WHERE ${w}${D}`)}}console.log("[crmSmartQuery] Called query: ",a);const u=await qo({query:a}),l=np(u,r,i);return console.log("[SmartStore] Results: ",l),{records:l,totalSize:l.length}}return Wo(e)}function qo(e){const t=e.query;return!t||typeof t!="string"?Promise.reject(new Error("Query is required and must be a string")):/\{[^}]+:[^}]+}/.test(t.trim())?y.highLevelApi.API.request("crm_smart_query",e):Promise.reject(new Error("Invalid SmartStore query syntax. SmartStore queries must use curly braces syntax: {SoupName:FieldName}"))}function op(e){if(!e)return Promise.reject(new Error("Payload is required"));const t=e.object;return!t||typeof t!="string"||t.trim()===""?Promise.reject(new Error("Object name is required and must be a non-empty string")):e.record_type_id!==void 0&&(typeof e.record_type_id!="string"||e.record_type_id.trim()==="")?Promise.reject(new Error("record_type_id must be a non-empty string if provided")):y.highLevelApi.API.request("crm_smart_object_metadata",e)}function ip(e){if(!e||!e.objects||!Array.isArray(e.objects))return Promise.reject(new Error("Payload must contain an array of objects"));if(e.objects.length===0)return Promise.reject(new Error("Objects array cannot be empty"));for(const t of e.objects){if(!t)return Promise.reject(new Error("Objects array cannot contain null or undefined elements"));if(!t.table_name||typeof t.table_name!="string"||t.table_name.trim()==="")return Promise.reject(new Error("Each object must have a valid non-empty table_name"));if(t.external_id_path!==void 0&&(typeof t.external_id_path!="string"||t.external_id_path.trim()===""))return Promise.reject(new Error(`Object for table ${t.table_name} has invalid external_id_path. It must be a non-empty string or undefined.`));if(!t.objects||!Array.isArray(t.objects)||t.objects.length===0)return Promise.reject(new Error(`Object for table ${t.table_name} must have a non-empty objects array`));for(let n=0;n<t.objects.length;n++){const r=t.objects[n];if(!r||typeof r!="object"||Array.isArray(r))return Promise.reject(new Error(`Object for table ${t.table_name} contains invalid element at index ${n}. All records must be valid objects, not null, undefined, or arrays.`))}}return console.log("[crmSmartUpsertObjects] Request payload:",JSON.stringify(e,null,2)),y.highLevelApi.API.request("crm_smart_upsert_objects",e).then(t=>(console.log("[crmSmartUpsertObjects] Success:",t),t)).catch(t=>{throw console.error("[crmSmartUpsertObjects] Error:",t),t})}function sp(e){if(!e)return Promise.reject(new Error("Payload is required"));const t=e.object;return!t||typeof t!="string"||t.trim()===""?Promise.reject(new Error("Object name is required and must be a non-empty string")):y.highLevelApi.API.request("crm_smart_object_validation_rules",e)}function ap(e){if(!e)return Promise.reject(new Error("Payload is required"));const t=e.object;return!t||typeof t!="string"||t.trim()===""?Promise.reject(new Error("Object name is required and must be a non-empty string")):y.highLevelApi.API.request("crm_smart_object_layout",e)}function cp(e){if(!e||!e.objects||!Array.isArray(e.objects))return Promise.reject(new Error("Payload must contain an array of objects"));if(e.objects.length===0)return Promise.reject(new Error("Objects array cannot be empty"));for(const t of e.objects){if(!t)return Promise.reject(new Error("Objects array cannot contain null or undefined elements"));if(!t.table_name||typeof t.table_name!="string"||t.table_name.trim()==="")return Promise.reject(new Error("Each object must have a valid non-empty table_name"));if(!t.ids||!Array.isArray(t.ids)||t.ids.length===0)return Promise.reject(new Error(`Object for table ${t.table_name} must have a non-empty ids array`));for(let n=0;n<t.ids.length;n++){const r=t.ids[n];if(!r||typeof r!="string"||r.trim()==="")return Promise.reject(new Error(`Object for table ${t.table_name} contains invalid id at index ${n}. All IDs must be non-empty strings.`))}}return console.log("[crmSmartDeleteObjects] Request payload:",JSON.stringify(e,null,2)),y.highLevelApi.API.request("crm_smart_delete_objects",e).then(t=>(console.log("[crmSmartDeleteObjects] Success:",t),t)).catch(t=>{throw console.error("[crmSmartDeleteObjects] Error:",t),t})}function up(e){if(!e)return Promise.reject(new Error("Payload is required"));if(!e.sobject||typeof e.sobject!="string"||e.sobject.trim()==="")return Promise.reject(new Error("sobject is required and must be a non-empty string"));if(!e.records||!Array.isArray(e.records)||e.records.length===0)return Promise.reject(new Error("records is required and must be a non-empty array"));for(let t=0;t<e.records.length;t++){const n=e.records[t];if(!n||typeof n!="object"||Array.isArray(n))return Promise.reject(new Error(`records contains invalid element at index ${t}. All records must be valid objects.`))}return y.highLevelApi.API.request("crm_create",e)}function fp(e){if(!e)return Promise.reject(new Error("Payload is required"));if(!e.sobject||typeof e.sobject!="string"||e.sobject.trim()==="")return Promise.reject(new Error("sobject is required and must be a non-empty string"));if(!e.records||!Array.isArray(e.records)||e.records.length===0)return Promise.reject(new Error("records is required and must be a non-empty array"));if(!e.external_id_field||typeof e.external_id_field!="string"||e.external_id_field.trim()==="")return Promise.reject(new Error("external_id_field is required and must be a non-empty string"));for(let t=0;t<e.records.length;t++){const n=e.records[t];if(!n||typeof n!="object"||Array.isArray(n))return Promise.reject(new Error(`records contains invalid element at index ${t}. All records must be valid objects.`))}return y.highLevelApi.API.request("crm_upsert",e)}function dp(e){return e?!e.sobject||typeof e.sobject!="string"||e.sobject.trim()===""?Promise.reject(new Error("sobject is required and must be a non-empty string")):y.highLevelApi.API.request("crm_describe",e):Promise.reject(new Error("Payload is required"))}function lp(e){return e?!e.sobject||typeof e.sobject!="string"||e.sobject.trim()===""?Promise.reject(new Error("sobject is required and must be a non-empty string")):y.highLevelApi.API.request("crm_layout",e):Promise.reject(new Error("Payload is required"))}function _p(e){return this.API.request("get_folders",e)}function pp(e={id:"root"}){return this.API.request("get_folder",e)}function hp(e){return this.API.request("create_folder",e)}function gp(e){return this.API.request("update_folder",e)}function mp(e){return this.API.request("delete_folder",e)}function Ep(e){return this.API.request("move_folder_items",e)}function wp(e){return this.API.request("get_core_folders",e)}function Ap(e,t){return this.API.request("patch_core_folder",{id:e,payload:t})}function yp(e){return e.type||(e.type="native"),y.highLevelApi.API.request("notify",e)}function vp(e){return y.highLevelApi.API.request("track",e)}function Sp(e){return this.API.request("get_instance_metadata_templates",e)}function Tp(){return this.API.request("trigger_non_files_sync")}function bp(e){return y.highLevelApi.API.request("submit_user_feedback",e)}function Op(){return y.highLevelApi.API.request("close")}function Pp(e){return this.API.request("open_web_view_always_on_top",e)}function Ip(e){return this.API.request("show_syncbox",e)}async function Cp(e){return this.API.request("share",e)}async function Rp(e){return this.API.request("show_peer_session",e)}function Np(e){return this.API.request("get_themes",e)}function Lp(e){return this.API.request("assign_canvas_theme",e)}const Go=["STT_DISABLED","STT_DEVICE_UNSUPPORTED","STT_MODEL_NOT_READY","STT_BUSY","STT_MIC_PERMISSION_DENIED","STT_NOT_RECORDING","STT_CAPTURE_FAILED","STT_ERROR"];function zo(e){const t="requestTypeDoesNotExists",n=e;return n?.error_code===t||n?.errorCode===t||n?.code===t||typeof n?.reason=="string"&&n.reason.includes(t)||typeof n?.message=="string"&&n.message.includes(t)?new Error("STT_DEVICE_UNSUPPORTED: dictation is not supported by this app version"):e}function Dp(e){return this.API.request("stt.start",e).catch(t=>{throw zo(t)})}function $p(){return this.API.request("stt.availability")}function Up(){return this.API.request("stt.warmup")}function Mp(e){return this.API.request("stt.stop",e).catch(t=>{throw zo(t)})}function xp(e){const t=e,n=t?.code??t?.error_code??t?.errorCode;if(typeof n=="string"&&Go.includes(n))return n;const r=typeof t?.reason=="string"?t.reason:typeof t?.message=="string"?t.message:"";return Go.find(i=>r.includes(i))}const Ho=["TTS_EMPTY_TEXT","TTS_VOICE_UNAVAILABLE","TTS_ERROR"];function jp(e){return this.API.request("tts.speak",e)}function Fp(){return this.API.request("tts.stop")}function Wp(e){const t=e,n=t?.code??t?.error_code??t?.errorCode;if(typeof n=="string"&&Ho.includes(n))return n;const r=typeof t?.reason=="string"?t.reason:typeof t?.message=="string"?t.message:"";return Ho.find(i=>r.includes(i))}const qp=Object.freeze(Object.defineProperty({__proto__:null,aiComplete:yn,aiGetCapabilities:Fl,appsDbDeleteEntry:t_,appsDbGetEntries:Ql,appsDbPsql:o_,appsDbUpsertEntry:e_,assignCanvasTheme:Lp,close:Op,createCanvas:d_,createFile:I_,createFolder:hp,crmCreate:up,crmDescribe:dp,crmLayout:lp,crmQuery:Wo,crmQueryAdaptive:rp,crmSmartDeleteObjects:cp,crmSmartObjectLayout:ap,crmSmartObjectMetadata:op,crmSmartObjectValidationRules:sp,crmSmartQuery:qo,crmSmartUpsertObjects:ip,crmUpsert:fp,deleteCanvas:l_,deleteFile:P_,deleteFolder:mp,deleteLocalFile:R_,downloadFile:v_,fetchDocumentInfo:M_,getAppConfig:S_,getCanvas:h_,getCanvasRecommendedFiles:E_,getCanvasTheme:w_,getCanvases:f_,getCoreFolders:wp,getEnv:a_,getFile:T_,getFileRevisionData:b_,getFileRevisions:N_,getFiles:y_,getFolder:pp,getFolders:_p,getInstanceMetadataTemplates:Sp,getSectionsByIds:g_,getThemes:Np,getUsers:D_,isOffline:u_,moveFolderItems:Ep,notify:yp,open:i_,openExternalUrl:s_,openWebViewAlwaysOnTop:Pp,patchCoreFolder:Ap,piaSearchAnswer:Wl,postJsonWithTimeout:An,query:K_,refreshAccessToken:U_,refreshServiceToken:$_,renderPageAsImage:x_,search:L_,selectDeviceFile:C_,share:Cp,shareCanvas:m_,showPeerSession:Rp,showSyncbox:Ip,sttAvailability:$p,sttErrorCode:xp,sttStart:Dp,sttStop:Mp,sttWarmup:Up,submitUserFeedback:bp,toast:j_,track:vp,triggerNonFilesSync:Tp,ttsErrorCode:Wp,ttsSpeak:jp,ttsStop:Fp,unassignCanvasTheme:A_,updateCanvas:__,updateCanvasIndicators:p_,updateFile:O_,updateFolder:gp,updateMyUser:c_,weeklyFocusRank:Hl},Symbol.toStringTag,{value:"Module"}));class Bo{listeners={};on(t,n){this.listeners[t]=(this.listeners[t]??[]).concat(n)}off(t,n){this.listeners[t]=(this.listeners[t]??[]).filter(r=>r!==n)}emit(t,n){(this.listeners[t]??[]).forEach(r=>r(n))}}const J=[];for(let e=0;e<256;++e)J.push((e+256).toString(16).slice(1));function Gp(e,t=0){return(J[e[t+0]]+J[e[t+1]]+J[e[t+2]]+J[e[t+3]]+"-"+J[e[t+4]]+J[e[t+5]]+"-"+J[e[t+6]]+J[e[t+7]]+"-"+J[e[t+8]]+J[e[t+9]]+"-"+J[e[t+10]]+J[e[t+11]]+J[e[t+12]]+J[e[t+13]]+J[e[t+14]]+J[e[t+15]]).toLowerCase()}const zp=new Uint8Array(16);function Hp(){return crypto.getRandomValues(zp)}function Bp(e,t,n){return crypto.randomUUID?crypto.randomUUID():Vp(e)}function Vp(e,t,n){e=e||{};const r=e.random??e.rng?.()??Hp();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Gp(r)}const Yp="PITCHER_EVENT";var Nt=(e=>(e.REQUEST="PITCHER_REQUEST",e.RESPONSE="PITCHER_RESPONSE",e))(Nt||{}),Lt=(e=>(e.OK="ok",e.ERROR="error",e))(Lt||{}),rt=(e=>(e.ENV_CHANGED="env_changed",e.ACCESS_TOKEN_RENEWED="access_token_renewed",e.PHOTOS_CAPTURED="photos_captured",e.GLOBAL_PHOTO_CAPTURED="global_photo_captured",e.FILE_DOWNLOADED="file_downloaded",e.FILE_UPLOAD_PROGRESS="file_upload_progress",e.UPDATE_LOCATION="update_location",e.CANVAS_UPDATED="canvas_updated",e.CANVAS_UPDATED_SUCCESS="canvas_updated_success",e.FILE_CLOSED="file_closed",e.FILE_OPENED="file_opened",e.APP_BACKGROUNDED="app_backgrounded",e.APP_FOREGROUNDED="app_foregrounded",e.NON_FILES_SYNC_FINISHED="non_files_sync_finished",e.CONTENT_LIST_REFRESH_REQUESTED="content_list_refresh_requested",e.NETWORK_CONNECTION_ESTABLISHED="network_connection_established",e.NETWORK_CONNECTION_LOST="network_connection_lost",e.ENTERED_FULLSCREEN="entered_fullscreen",e.EXITED_FULLSCREEN="exited_fullscreen",e.SUBMIT_POSTCALL_CLICKED="submit_postcall_clicked",e.ANALYTICS_CAPTURED="analytics_captured",e.OPEN_FOLDER_REQUESTED="open_folder_requested",e.CANVAS_PAGE_NEXT_REQUESTED="canvas_page_next_requested",e.CANVAS_PAGE_PREVIOUS_REQUESTED="canvas_page_previous_requested",e.CANVAS_OPEN_REQUESTED="canvas_open_requested",e.CANVAS_CLOSE_REQUESTED="canvas_close_requested",e.ROUTE_CHANGE_REQUESTED="route_change_requested",e.ITEM_SHAREBOX_STATUS_REQUESTED="item_sharebox_status_requested",e.ITEM_SHAREBOX_STATUS_UPDATED="item_sharebox_status_updated",e.ITEM_SHAREBOX_ADD_REQUESTED="item_sharebox_add_requested",e.ITEM_SHAREBOX_ADD_COMPLETED="item_sharebox_add_completed",e.SYNC_BADGE_VALUE_REPORTED="sync_badge_value_reported",e.SYNC_BOX_RESOLVE_ERROR_TAPPED="sync_box_resolve_error_tapped",e.PEER_CONNECTIVITY_EVENT="peer_connectivity_event",e.STT_PARTIAL="stt.partial",e.STT_INTERRUPTED="stt.interrupted",e))(rt||{}),Vo=(e=>(e.UI_SHOW_MODAL="ui:show-modal",e.UI_HIDE_MODAL="ui:hide-modal",e.FILE_DOWNLOAD="file:download",e.CANVAS_NEXT_BUTTON_CLICKED="canvas_next_button_clicked",e.CANVAS_PREVIOUS_BUTTON_CLICKED="canvas_previous_button_clicked",e.CANVAS_OPENED="canvas_opened",e.CANVAS_CLOSED="canvas_closed",e.ROUTE_CHANGED="route_changed",e))(Vo||{}),Yo=(e=>(e.CREATE_AND_OPEN_CANVAS="create_and_open_canvas",e.OPEN_CANVAS="open_canvas",e.START_CALL="start_call",e.SELECT_ACCOUNT="select_account",e))(Yo||{});class kp extends Error{}function Zp(e,t){if(!e)throw new kp(t)}const ko=["id__in","tags__in","tags__not_in","template__id","template__id__in","modified_at__gtr","created_at__gtr","end_at__lt","start_at__gt","account__id","end_at__gt","end_at__range","start_at__lt","start_at__range","external_objects__connection_id","external_objects__content_type","external_objects__external_content_type","external_objects__external_object_id","owned_by__name__icontains","template__name__icontains"],Zo=["context","overrides","filters","metadata","style","hidden"],Xo=(e,t)=>t.includes(e)||e.endsWith("style"),ot=(e,t=ko,n=Zo)=>Array.isArray(e)?e.map(r=>ot(r,t,n)):e!=null&&e.constructor===Object?Object.keys(e).reduce((r,i)=>{const a=Xo(i,n),u=t.includes(i)||a?i:Tu(i),l=a?e[i]:ot(e[i],t,n);return{...r,[u]:l}},{}):e,Tn=(e,t=ko,n=Zo)=>Array.isArray(e)?e.map(r=>Tn(r,t,n)):e!=null&&e.constructor===Object?Object.keys(e).reduce((r,i)=>{const a=Xo(i,n),u=t.includes(i)||a?i:So(i),l=a?e[i]:Tn(e[i],t,n);return{...r,[u]:l}},{}):e;function bn(e,t=1,n=20){if(typeof e!="object"||e===null)return e;if(Array.isArray(e))return e.length>n&&t<=0?`[Truncated - ${e.length} length array]`:e.map(i=>bn(i,t-1,n));const r=Object.keys(e);return r.length>n&&t<=0?`{Truncated - ${r.length} properties obj}`:r.reduce((i,a)=>(i[a]=bn(e[a],t-1,n),i),{})}function Xp(e,t=[],n=["development","test"].includes("production")){if(n)return!0;if(!e||!e.origin)return!1;const r=[...t,window.location.origin,"pitcher.com"],i=r.includes(e.origin)||r.some(a=>e.origin.endsWith(a));return i||console.warn(`The message origin ${e.origin} is not the same as the current origin ${window.location.origin}. Bailing...`),i}const On=5,Ko=1e3;let it=null;async function Kp(){return it||(console.info("Refreshing access token..."),it=(async()=>{try{return await y.highLevelApi.refreshAccessToken().then(e=>y.highLevelApi.getEnv().then(t=>(Jo(t),e.access_token)))}catch(e){throw console.error("Failed to refresh token:",e),e}finally{it=null}})(),it)}function st(e){const t=new URLSearchParams;function n(r,i){if(i!=null)if(Array.isArray(i))i.forEach(a=>n(r,a));else if(typeof i=="object"&&!Array.isArray(i))for(const a in i)n(`${r}[${a}]`,i[a]);else t.append(r,i)}for(const r in e)n(r,e[r]);return t.toString()}async function we(e,t,n=On){try{const r=await fetch(e,t);if(!r.ok)if(r.status===401){const i=await Kp();return t.headers=t.headers||{},t.headers.Authorization=`Bearer ${i}`,we(e,t,n)}else if(r.status>=500&&r.status<600&&n>0){const i=Ko*Math.pow(2,On-n);return await new Promise(a=>setTimeout(a,i)),we(e,t,n-1)}else{const i=await r.json(),a=new Error(`HTTP error! status: ${r.status}, message: ${i.message||r.statusText}`);throw a.status=r.status,a}return r.status===204||r.status===205?void 0:r.json()}catch(r){if(n>0&&!(r instanceof TypeError)&&r.status!==404){const i=Ko*Math.pow(2,On-n);return await new Promise(a=>setTimeout(a,i)),we(e,t,n-1)}throw r}}function Jp(e,t){const n={"Content-Type":"application/json",Authorization:`Bearer ${t}`},r="/api/v1",i={credentials:"include"};return{get:async(a,u={})=>{const l=new URL(`${e}${r}${a}`);return u.params&&(l.search=st(u.params)),await we(l.toString(),{...i,...u,method:"GET",headers:n})},post:async(a,u,l={})=>{const _=new URL(`${e}${r}${a}`);return l.params&&(_.search=st(l.params)),await we(_.toString(),{...i,...l,method:"POST",headers:n,body:JSON.stringify(u)})},put:async(a,u,l={})=>{const _=new URL(`${e}${r}${a}`);return l.params&&(_.search=st(l.params)),await we(_.toString(),{...i,...l,method:"PUT",headers:n,body:JSON.stringify(u)})},delete:async(a,u={})=>{const l=new URL(`${e}${r}${a}`);return u.params&&(l.search=st(u.params)),await we(l.toString(),{...i,...u,method:"DELETE",headers:n})},patch:async(a,u,l={})=>{const _=new URL(`${e}${r}${a}`);return l.params&&(_.search=st(l.params)),await we(_.toString(),{...i,...l,method:"PATCH",headers:n,body:JSON.stringify(u)})},patchUrl:async(a,u,l={})=>await we(a,{...i,...l,method:"PATCH",headers:n,body:JSON.stringify(u)})}}function Qp(e){return e?Object.entries(e).reduce((t,[n,r])=>(t[n]=n.endsWith("__range")&&Array.isArray(r)?r.join(","):r,t),{}):{}}let le,Q;function re(){if(!le)throw new Error("Missing env");if(!Q)throw new Error("Missing http")}function Dt(e){return ul(e??{},t=>t!=null)}const Jo=e=>{e?.pitcher?.token_claims?.["https://pitcher.com/claims/urls"]?.custom_domain||(console.warn("No custom domain found in token claims",e?.pitcher?.token_claims),typeof window<"u"&&window.Sentry?.captureMessage?.("No custom domain found in token claims",{extra:{env:e},level:"warning"}));const t=e?.pitcher?.token_claims?.["https://pitcher.com/claims/urls"]?.custom_domain,n=e?.pitcher?.access_token!==le?.pitcher?.access_token||t&&t!==le?.pitcher?.token_claims?.["https://pitcher.com/claims/urls"]?.custom_domain;le=Qd({},le,e),n&&(Q=Jp(le.pitcher.token_claims["https://pitcher.com/claims/urls"].custom_domain,le.pitcher.access_token))},Qo={get_canvases:async e=>{re();const{api_base_url:t,filters:n={},...r}=e;return await Q.get("/canvases",{params:{instance_id:le.pitcher.instance.id,...Qp(n),...Dt(r)}})},get_canvas:async e=>{re();const{id:t,...n}=e;return await Q.get(`/canvases/${e.id}`,{params:n})},get_canvas_sections_by_ids:async e=>(re(),await Q.post("/canvases/sections/by-ids",{canvas_id:e.canvas_id,section_ids:e.section_ids,...e.exclude_drafts!==void 0&&{exclude_drafts:e.exclude_drafts},...e.include_expired_files!==void 0&&{include_expired_files:e.include_expired_files},...e.include_pending_files!==void 0&&{include_pending_files:e.include_pending_files}})),create_canvas:async e=>(re(),await Q.post("/canvases",{...e,instance_id:le.pitcher.instance.id})),update_canvas:async e=>{re();const{id:t,fields:n,lazy_sections:r,...i}=e,a=r===!0?"lazy_sections=true":"";if(le?.launch_darkly?.enable_canvas_core_patch===!0){const _=le.pitcher.token_claims["https://pitcher.com/claims/urls"].custom_domain,S=[n?`fields=${encodeURIComponent(n)}`:"",a].filter(Boolean).join("&"),w=`${_}/core/api/protected/v1/canvases/${t}${S?`?${S}`:""}`;return await Q.patchUrl(w,i)}return await Q.patch(`/canvases/${t}${a?`?${a}`:""}`,{fields:n,...i})},delete_canvas:async e=>(re(),await Q.delete(`/canvases/${e.id}`)),share_canvas:async e=>{re();let t;try{t=await Q.get(`/shared-links/canvas/${e.id}`)}catch(n){if(n?.status===404)t=await Q.post("/shared-links",{canvas_id:e.id});else throw n}return t},get_canvas_recommended_files:async e=>{re();const{canvas_id:t,...n}=e;return await Q.get(`/canvases/${t}/recommended_files`,{params:n})},get_collaborations:async e=>(re(),await Q.get("/collaborations",{params:Dt(e)})),create_collaboration:async e=>(re(),await Q.post("/collaborations",e)),delete_collaboration:async e=>{re();const{collaboration_id:t}=e;return await Q.delete(`/collaborations/${t}`)},get_instance_memberships:async e=>(re(),await Q.get("/instance-memberships",{params:Dt(e)})),get_content_distribution_groups:async e=>(re(),await Q.get("/content-distribution-groups",{params:Dt(e)}))};function Pn(e=window){try{if(e.location.protocol==="file:")return window.top;if(e.parent!==e&&(e.parent.location.href.includes("pitcher.com")||e.parent.location.href.includes("localhost")))return Pn(e.parent)}catch{}return e}const eh=10,ei=["appsdb_get_entries","appsdb_upsert_entry","appsdb_delete_entry"],th=["appsdb_upsert_entry","crm_create","crm_upsert","crm_describe","crm_layout","crm_smart_query","crm_smart_object_metadata","crm_smart_object_validation_rules","crm_smart_object_layout","crm_smart_upsert_objects","crm_smart_delete_objects"];function nh(e){e&&Jo(e)}class rh extends Bo{constructor(t){super(),this.callbacks={},this.options=t??{casing:"snake",logLevel:"off",errorLogger:()=>{},fetchMode:"postmessage"},typeof window<"u"&&(window.addEventListener("message",n=>{Xp(n)&&(this.options.logLevel==="debug"&&console.log("message received",n),n.data.type==="PITCHER_RESPONSE"?(Zp(n.data.request.id,"event id is required"),this.handleCallbackMessage(n.data.request.id,n.data)):n.data.type==="PITCHER_EVENT"&&this.handleEventMessage(this.options.casing==="camel"?ot(n.data.event):n.data.event))}),this.request("subscribe"))}callbacks;options;handleCallbackMessage(t,n){this.callbacks[t]&&(this.callbacks[t].callback(n),this.options.logLevel&&["info","debug"].includes(this.options.logLevel)&&console.log(`It took ${Date.now()-this.callbacks[t].dispatched_at} ms for the event ${this.callbacks[t].type}`),delete this.callbacks[t])}handleEventMessage(t){this.emit("event",t)}request(t,n=null){const r=this.options.fetchMode??"postmessage";return new Promise((i,a)=>{const u=Bp(),l=w=>{if(this.options.logLevel==="debug"&&console.log(`Callback ${u} response:`,w),w.response.status==="ok")i(this.options.casing==="camel"&&!ei.includes(t)?ot(w.response.body):w.response.body),t==="get_env"&&nh(w.response.body);else if(w.response.status==="error")this.options.errorLogger&&this.options.errorLogger({type:w.request.type,message:`Pitcher JS API call failure: ${w.request.type}`,js_api_response:JSON.stringify(bn(w,3,eh))}),a(this.options.casing==="camel"&&!ei.includes(t)?ot(w.response.body):w.response.body);else throw new Error("unsupported response status")},_=th.includes(t),S=po(_?n:Tn(n));if(this.callbacks[u]={dispatched_at:Date.now(),type:t,payload:S??{},callback:l},r==="prefer-online"&&t&&Qo[t])Qo[t](S).then(w=>{this.callbacks[u]&&(this.callbacks[u].callback({type:Nt.RESPONSE,request:{id:u,type:t},response:{status:Lt.OK,body:w}}),delete this.callbacks[u])}).catch(w=>{this.callbacks[u]&&(this.callbacks[u].callback({type:Nt.RESPONSE,request:{id:u,type:t},response:{status:Lt.ERROR,body:w}}),delete this.callbacks[u])});else{const w=Pn(window);typeof w<"u"&&w&&w.postMessage({type:"PITCHER_REQUEST",request:{type:t,id:u,body:S}},"*")}})}}function oh(e){const t=new rh(e),n=new Bo;return t.on("event",r=>{n.emit(r.type,r.body)}),{API:t,...qp,on:(r,i)=>n.on(r,i),off:(r,i)=>n.off(r,i),enterFullscreen:()=>t.request("enter_fullscreen"),exitFullscreen:()=>t.request("exit_fullscreen"),isFullscreen:()=>t.request("is_fullscreen"),logout:()=>t.request("logout"),quitInstance:()=>t.request("quit_instance"),getRequestTypes:()=>t.request("get_request_types"),broadcast:r=>t.request("broadcast",r),broadcastToWebviews:r=>t.request("broadcast_to_webviews",r),subscribe:()=>t.request("subscribe"),unsubscribe:()=>t.request("unsubscribe")}}function O(){return window.postRobot?window.postRobot:Promise.resolve().then(()=>qi).then(e=>e.default||e)}const ih="UI_MESSAGE",$={UI_BROADCAST:"ui_broadcast",UI_SELECT_CONTENT:"ui_select_content",UI_SELECT_CANVASES:"ui_select_canvases",UI_OPEN:"ui_open",UI_EMBEDDABLE_READY:"ui_embeddable_ready",UI_TOAST:"ui_toast",UI_CAPTURE_APP_ERROR:"ui_capture_app_error",UI_UPDATE_CANVAS:"ui_update_canvas",UI_PRINT_CANVAS:"ui_print_canvas",UI_OPEN_CANVAS_OVERLAY:"ui_open_canvas_overlay",UI_OPEN_COLLECTION_PLAYER_OVERLAY:"ui_open_collection_player_overlay",UI_SELECT_COLLECTION_PLAYER_CONTENT:"ui_select_collection_player_content",UI_SELECT_AGENDA_CONTENT:"ui_select_agenda_content",UI_UPDATE_LOCATION:"ui_update_location",UI_PRESELECT_SFDC_MEETING_ID:"ui_preselect_sfdc_meeting_id",UI_SET_POSTCALL_STYLE:"ui_set_postcall_style",UI_ENABLE_POSTCALL_SUBMIT:"ui_enable_postcall_submit",UI_DISABLE_POSTCALL_SUBMIT:"ui_disable_postcall_submit",UI_COMPLETE_POSTCALL:"ui_complete_postcall",UI_STOP_MEETING:"ui_stop_meeting",UI_CANCEL_MEETING:"ui_cancel_meeting",UI_RESUME_MEETING:"ui_resume_meeting",UI_PROMPT_PIA:"ui_prompt_pia",UI_CANVAS_NAVIGATE_NEXT_PAGE:"ui_canvas_navigate_next_page",UI_CANVAS_NAVIGATE_PREVIOUS_PAGE:"ui_canvas_navigate_previous_page",UI_CANVAS_NAVIGATE_PAGE:"ui_canvas_navigate_page",UI_APP_LOADED:"ui_app_loaded",UI_APP_RESIZE:"ui_app_resize",UI_CLOSE_CANVAS_SECTION_EXECUTION:"ui_close_canvas_section_execution",UI_CLOSE_CANVAS_DRAWER:"ui_close_canvas_drawer",UI_OPEN_GLOBAL_POPUP:"ui_open_global_popup",UI_CLOSE_GLOBAL_POPUP:"ui_close_global_popup",UI_OPEN_SHARING_SETTINGS:"ui_open_sharing_settings"},Ae={UI_MEETING_CANCELED:"ui_meeting_canceled",UI_CANVAS_UPDATED:"ui_canvas_updated",UI_SECTION_LIST_UPDATED:"ui_section_list_updated",UI_APP_SET_DATA:"ui_app_set_data",UI_APP_UPDATE_DATA:"ui_app_update_data",UI_PROMPT_PIA_RESPONSE_STREAMED:"ui_prompt_pia_response_streamed"},ti=[Ae.UI_APP_SET_DATA,Ae.UI_APP_UPDATE_DATA,Ae.UI_CANVAS_UPDATED];async function sh(e={}){const t=await O();return console.warn("[content.ui.ts]: ui_select_content is deprecated and might get removed in future versions, please use select_content instead."),(await t.send(window.parent,$.UI_SELECT_CONTENT,e)).data}async function ah(e={}){return(await(await O()).send(window.parent,$.UI_SELECT_CONTENT,e)).data}async function ch(e){await(await O()).send(window.parent,$.UI_OPEN,e)}async function uh(e){await(await O()).send(window.parent,$.UI_TOAST,e)}async function fh(e){return(await(await O()).send(window.parent,$.UI_PRESELECT_SFDC_MEETING_ID,e)).data}async function dh(e={}){return(await(await O()).send(window.parent,$.UI_SELECT_COLLECTION_PLAYER_CONTENT,e)).data}async function lh(e={}){return(await(await O()).send(window.parent,$.UI_SELECT_AGENDA_CONTENT,e)).data}async function _h(e,t){const n=await O(),r={app_name:e,extra_context:t};return(await n.send(window.parent,$.UI_OPEN_GLOBAL_POPUP,r)).data}async function ph(){await(await O()).send(window.parent,$.UI_CLOSE_GLOBAL_POPUP,{})}const hh=Object.freeze(Object.defineProperty({__proto__:null,closeGlobalPopup:ph,open:ch,openGlobalPopup:_h,preselectSfdcMeetingId:fh,selectAgendaContent:lh,selectCollectionContent:dh,selectContent:ah,toast:uh,ui_select_content:sh},Symbol.toStringTag,{value:"Module"}));async function gh(){await(await O()).send(window.parent,$.UI_EMBEDDABLE_READY)}const mh=Object.freeze(Object.defineProperty({__proto__:null,embeddableReady:gh},Symbol.toStringTag,{value:"Module"}));async function Eh(e){return(await O()).send(Pn(),$.UI_UPDATE_LOCATION,e)}const wh=Object.freeze(Object.defineProperty({__proto__:null,updateLocation:Eh},Symbol.toStringTag,{value:"Module"}));async function Ah(e){(await O()).send(window.parent,$.UI_CAPTURE_APP_ERROR,e)}const yh=Object.freeze(Object.defineProperty({__proto__:null,captureAppError:Ah},Symbol.toStringTag,{value:"Module"}));async function vh(e){return(await O()).send(window.parent,$.UI_UPDATE_CANVAS,e).then(n=>n.data)}async function Sh(e){return(await O()).send(window.parent,$.UI_PRINT_CANVAS,e).then(n=>n.data)}async function Th(){window.parent.postMessage({type:$.UI_APP_LOADED,body:{}},"*")}async function bh(e){window.parent.postMessage({type:$.UI_APP_RESIZE,body:e},"*")}async function Oh(){window.parent.postMessage({type:$.UI_CLOSE_CANVAS_SECTION_EXECUTION,body:{}},"*")}async function Ph(){window.parent.postMessage({type:$.UI_CLOSE_CANVAS_DRAWER,body:{}},"*")}async function Ih(){(await O()).send(window.parent,$.UI_CANVAS_NAVIGATE_NEXT_PAGE)}async function Ch(){(await O()).send(window.parent,$.UI_CANVAS_NAVIGATE_PREVIOUS_PAGE)}async function Rh(e){(await O()).send(window.parent,$.UI_CANVAS_NAVIGATE_PAGE,e)}async function Nh(e){await(await O()).send(window.parent,$.UI_OPEN_CANVAS_OVERLAY,e)}async function Lh(e){await(await O()).send(window.parent,$.UI_OPEN_COLLECTION_PLAYER_OVERLAY,e)}async function Dh(e={}){return(await(await O()).send(window.parent,$.UI_SELECT_CANVASES,e)).data}const $h=Object.freeze(Object.defineProperty({__proto__:null,appLoaded:Th,appResize:bh,canvasNavigateNextPage:Ih,canvasNavigatePage:Rh,canvasNavigatePreviousPage:Ch,closeCanvasDrawer:Ph,closeCanvasSectionExecution:Oh,openCanvasOverlay:Nh,openCollectionPlayerOverlay:Lh,printCanvas:Sh,selectCanvases:Dh,updateCanvas:vh},Symbol.toStringTag,{value:"Module"}));async function Uh(e){(await O()).send(window.parent,$.UI_COMPLETE_POSTCALL,e)}async function Mh(){(await O()).send(window.parent,$.UI_CANCEL_MEETING)}async function xh(){(await O()).send(window.parent,$.UI_RESUME_MEETING)}async function jh(){(await O()).send(window.parent,$.UI_STOP_MEETING)}async function Fh(){(await O()).send(window.parent,$.UI_ENABLE_POSTCALL_SUBMIT)}async function Wh(){(await O()).send(window.parent,$.UI_DISABLE_POSTCALL_SUBMIT)}async function qh(e){(await O()).send(window.parent,$.UI_SET_POSTCALL_STYLE,e)}const Gh=Object.freeze(Object.defineProperty({__proto__:null,cancelMeeting:Mh,completePostcall:Uh,disablePostcallSubmit:Wh,enablePostcallSubmit:Fh,resumeMeeting:xh,setPostcallStyle:qh,stopMeeting:jh},Symbol.toStringTag,{value:"Module"}));async function zh(e){return(await(await O()).send(window.parent,$.UI_PROMPT_PIA,e)).data}const Hh=Object.freeze(Object.defineProperty({__proto__:null,promptPia:zh},Symbol.toStringTag,{value:"Module"}));async function Bh(e){return(await(await O()).send(window.parent,$.UI_OPEN_SHARING_SETTINGS,e)).data}const Vh=Object.freeze(Object.defineProperty({__proto__:null,openSharingSettings:Bh},Symbol.toStringTag,{value:"Module"}));async function Yh(e,t){const n=r=>{r.data.type===e&&t(r.data.body)};return window.addEventListener("message",n),()=>window.removeEventListener("message",n)}async function kh(e,t){return(await O()).on(e,i=>t(i.data)).cancel}function qe(e,t){return ti.includes(e)?Yh(e,t):kh(e,t)}function Zh(e){return qe(Ae.UI_MEETING_CANCELED,e)}function Xh(e){return qe(Ae.UI_CANVAS_UPDATED,e)}function Kh(e){return qe(Ae.UI_SECTION_LIST_UPDATED,e)}function Jh(e){return qe(Ae.UI_APP_SET_DATA,e)}function Qh(e){return qe(Ae.UI_APP_UPDATE_DATA,e)}async function eg(e){(await O()).send(window.parent,$.UI_BROADCAST,e)}const tg={on:qe,onMeetingCanceled:Zh,onCanvasUpdated:Xh,onSectionListUpdated:Kh,onAppSetData:Jh,onAppUpdateData:Qh,uiBroadcast:eg,...hh,...mh,...wh,...yh,...$h,...Gh,...Hh,...Vh},ng="ADMIN_MESSAGE",rg={ENV_CHANGED:"admin_env_changed"},og={ADMIN_REQUEST:"ADMIN_REQUEST",ADMIN_RESPONSE:"ADMIN_RESPONSE"},V={CAPTURE_APP_ERROR:"admin_capture_app_error",CREATE_CANVAS:"admin_create_canvas",GET_APP_CONFIG:"admin_get_app_config",GET_CANVAS:"admin_get_canvas",GET_CANVASES:"admin_get_canvases",OPEN_CANVAS_OVERLAY:"admin_open_canvas_overlay",OPEN_COLLECTION_PLAYER_OVERLAY:"admin_open_collection_player_overlay",GET_ENV:"admin_get_env",GET_FILE:"admin_get_file",OPEN:"admin_open_file_overlay",CLOSE:"admin_close_file_overlay",GET_FILES:"admin_get_files",GET_INSTANCE_METADATA_TEMPLATES:"admin_get_instance_metadata_templates",GET_USERS:"admin_get_users",TOAST:"admin_toast",UPDATE_CANVAS:"admin_update_canvas",SELECT_COLLECTION_PLAYER_CONTENT:"admin_select_collection_player_content",SELECT_AGENDA_CONTENT:"admin_select_agenda_content",SELECT_CONTENT:"admin_select_content",SELECT_CANVASES:"admin_select_canvases"};async function ig(e){(await O()).send(window.parent,V.CAPTURE_APP_ERROR,e)}const sg=Object.freeze(Object.defineProperty({__proto__:null,captureAppError:ig},Symbol.toStringTag,{value:"Module"}));async function ag(){const n=(await(await O()).send(window.parent,V.GET_ENV)).data;return gn(n,"pitcher.org_config.segment")}const cg=Object.freeze(Object.defineProperty({__proto__:null,getEnv:ag},Symbol.toStringTag,{value:"Module"}));async function ug(e){return(await(await O()).send(window.parent,V.CREATE_CANVAS,e)).data}async function fg(e){return(await(await O()).send(window.parent,V.GET_CANVASES,e)).data}async function dg(e){return(await(await O()).send(window.parent,V.GET_CANVAS,e)).data}async function lg(e){return(await(await O()).send(window.parent,V.UPDATE_CANVAS,e)).data}async function _g(e){await(await O()).send(window.parent,V.OPEN_CANVAS_OVERLAY,e)}async function pg(e){await(await O()).send(window.parent,V.OPEN_COLLECTION_PLAYER_OVERLAY,e)}async function hg(e={}){return(await(await O()).send(window.parent,V.SELECT_CANVASES,e)).data}const gg=Object.freeze(Object.defineProperty({__proto__:null,createCanvas:ug,getCanvas:dg,getCanvases:fg,openCanvasOverlay:_g,openCollectionPlayerOverlay:pg,selectCanvases:hg,updateCanvas:lg},Symbol.toStringTag,{value:"Module"}));async function mg(e){return(await(await O()).send(window.parent,V.GET_INSTANCE_METADATA_TEMPLATES,e)).data}const Eg=Object.freeze(Object.defineProperty({__proto__:null,getInstanceMetadataTemplates:mg},Symbol.toStringTag,{value:"Module"}));async function wg(e){return(await(await O()).send(window.parent,V.GET_APP_CONFIG,e)).data}async function Ag(e){return(await(await O()).send(window.parent,V.GET_FILE,e)).data}async function yg(e){return(await(await O()).send(window.parent,V.GET_FILES,e)).data}async function vg(e){await(await O()).send(window.parent,V.OPEN,e)}async function Sg(){await(await O()).send(window.parent,V.CLOSE)}const Tg=Object.freeze(Object.defineProperty({__proto__:null,close:Sg,getAppConfig:wg,getFile:Ag,getFiles:yg,open:vg},Symbol.toStringTag,{value:"Module"}));async function bg(e={}){return(await(await O()).send(window.parent,V.SELECT_COLLECTION_PLAYER_CONTENT,e)).data}async function Og(e={}){return(await(await O()).send(window.parent,V.SELECT_AGENDA_CONTENT,e)).data}async function Pg(e){return(await(await O()).send(window.parent,V.SELECT_CONTENT,e)).data}const Ig=Object.freeze(Object.defineProperty({__proto__:null,selectAgendaContent:Og,selectCollectionContent:bg,selectContent:Pg},Symbol.toStringTag,{value:"Module"}));async function Cg(e){return(await(await O()).send(window.parent,V.GET_USERS,e)).data}const Rg=Object.freeze(Object.defineProperty({__proto__:null,getUsers:Cg},Symbol.toStringTag,{value:"Module"}));async function Ng(e,t){return(await O()).on(e,i=>t(i.data)).cancel}async function Lg(e){await(await O()).send(window.parent,V.TOAST,e)}const Dg={on:Ng,toast:Lg,...sg,...Ig,...cg,...gg,...Eg,...Tg,...Rg},$g="DSR_MESSAGE",Ug={ENV_CHANGED:"dsr_env_changed"},Mg={DSR_REQUEST:"DSR_REQUEST",DSR_RESPONSE:"DSR_RESPONSE"},Ge={GET_ENV:"dsr_get_env",GET_FILE:"dsr_get_file",GET_APP_CONFIG:"dsr_get_app_config",CLOSE:"dsr_close",DSR_EMBEDDABLE_READY:"dsr_embeddable_ready"};async function xg(){const n=(await(await O()).send(window.parent,Ge.GET_ENV)).data;return gn(n,"pitcher.org_config.segment")}const jg=Object.freeze(Object.defineProperty({__proto__:null,getEnv:xg},Symbol.toStringTag,{value:"Module"}));async function Fg(){await(await O()).send(window.parent,Ge.DSR_EMBEDDABLE_READY)}const Wg=Object.freeze(Object.defineProperty({__proto__:null,embeddableReady:Fg},Symbol.toStringTag,{value:"Module"}));async function qg(){await(await O()).send(window.parent,Ge.CLOSE)}async function Gg(e){return(await(await O()).send(window.parent,Ge.GET_FILE,e)).data}async function zg(e){return(await(await O()).send(window.parent,Ge.GET_APP_CONFIG,e??{})).data}const Hg=Object.freeze(Object.defineProperty({__proto__:null,close:qg,getAppConfig:zg,getFile:Gg},Symbol.toStringTag,{value:"Module"}));async function Bg(e,t){return(await O()).on(e,i=>t(i.data)).cancel}const Vg={on:Bg,...jg,...Wg,...Hg},Yg="peer_connectivity_event",kg={CANVAS_PAGE_NEXT:"canvas.navigate.next",CANVAS_PAGE_PREVIOUS:"canvas.navigate.previous",CANVAS_OPEN:"canvas.open",CANVAS_CLOSE:"canvas.close",ROUTE_CHANGE:"route.change",FILE_OPEN:"file.open",FILE_CLOSE:"file.close",BROWSER_FOLDER_OPEN:"browser.folder.open"},ni=1,In="*",Re=new Map;let ze=null,Cn=null;function Rn(){const e=globalThis.crypto;return e?.randomUUID?e.randomUUID():`peer-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`}function ri(e,t){const n=e.metadata??{};return{version:e.version??t?.version??ni,action:e.action,context:e.context??t?.context,data:e.data??t?.data,metadata:{correlationId:n.correlationId??t?.metadata?.correlationId??Rn(),source:n.source??t?.metadata?.source??"web",timestamp:n.timestamp??t?.metadata?.timestamp??Date.now(),extras:{...t?.metadata?.extras??{},...n.extras??{}}}}}function Zg(e,t){const n=e||In,r=Re.get(n)??new Set;r.add(t),Re.set(n,r)}function Xg(e,t){const n=Re.get(e);n&&(n.delete(t),n.size||Re.delete(e),Re.size||Jg())}async function Kg(){if(ze)return;const e=ye(),t=n=>{try{const r=ri(n,{metadata:{correlationId:Rn(),source:"native",timestamp:Date.now(),extras:{}}});Qg(r)}catch(r){console.error("[peer-connectivity] Failed to handle native event:",r)}};e.on(rt.PEER_CONNECTIVITY_EVENT,t),ze=()=>{e.off(rt.PEER_CONNECTIVITY_EVENT,t),ze=null}}function Jg(){ze&&(ze(),ze=null)}function Qg(e){const t=Re.get(e.action),n=Re.get(In);if(!t&&!n)return;const r=Object.freeze(e);t?.forEach(i=>{try{i(r)}catch(a){console.error(`[peer-connectivity] Handler error for action "${e.action}":`,a)}}),n?.forEach(i=>{try{i(r)}catch(a){console.error("[peer-connectivity] Handler error for wildcard action:",a)}})}async function em(){return Cn||(Cn=ye().getEnv().then(t=>t.mode==="IOS").catch(t=>(console.error("[peer-connectivity] Failed to determine environment support:",t),!1))),Cn}function oi(e){return Array.isArray(e)?e:[e]}function tm(e,t){return oi(e).forEach(n=>{Zg(n,t)}),Kg().catch(n=>{console.error("[peer-connectivity] Failed to register native listener:",n)}),()=>{oi(e).forEach(n=>{Xg(n,t)})}}async function nm(e,t){if(!e?.action){console.warn("[peer-connectivity] Attempted to send an event without action");return}if(t?.isFeatureEnabled===!1||!await em())return;const r=ye(),i=ri(e,{metadata:{correlationId:Rn(),source:"web",timestamp:Date.now(),extras:{}}});try{await r.broadcast({type:rt.PEER_CONNECTIVITY_EVENT,body:i})}catch(a){console.error("[peer-connectivity] Failed to send event:",a)}}y.highLevelApi=void 0;let ii;function ye(e){return(!y.highLevelApi||!Jd(e,ii))&&(y.highLevelApi=oh(e),ii=e),y.highLevelApi}function Nn(e){return Object.entries(e).forEach(([t,n])=>{const r=So(t);r&&!e[r]&&(e[r]=n)}),e}const rm=Nn(tg),om=Nn(Dg),im=Nn(Vg);function Ln(){return rm}function si(){return om}function ai(){return im}function sm(){if(typeof window>"u")throw new Error("getAvailableApis: window is not defined");const e=window.parent.jsApiLocation;return e==="ui"?["ui","impact"]:[e??"impact"]}function am(e){if(typeof window>"u")throw new Error("useApi: window is not defined");switch(window.parent.jsApiLocation){case"ui":return{...ye(),...Ln(),ui:Ln(),impact:ye()};case"admin":return si();case"dsr":return{...ai(),broadcast:ye().broadcast};case"impact":return ye(e);default:return ye(e)}}window.postRobot=Yn,y.ADMIN_API_METHOD_TYPES=V,y.ADMIN_API_TYPES=og,y.ADMIN_MESSAGE=ng,y.ADMIN_MESSAGE_TYPES=rg,y.DEFAULT_PEER_CONNECTIVITY_VERSION=ni,y.DSR_API_METHOD_TYPES=Ge,y.DSR_API_TYPES=Mg,y.DSR_MESSAGE=$g,y.DSR_MESSAGE_TYPES=Ug,y.PEER_CONNECTIVITY_EVENT=Yg,y.PEER_CONNECTIVITY_HANDLER_MATCH_ALL=In,y.PITCHER_EVENT=Yp,y.PeerConnectivityActions=kg,y.PitcherBroadcastedEventName=Vo,y.PitcherEventName=rt,y.PitcherExternalEventName=Yo,y.PitcherMessageType=Nt,y.PitcherResponseStatus=Lt,y.UI_API_METHOD_TYPES=$,y.UI_MESSAGE=ih,y.UI_MESSAGE_TYPES=Ae,y.UI_NATIVE_MESSAGE_TYPES=ti,y.getAvailableApis=sm,y.registerPeerConnectivityHandler=tm,y.sendPeerConnectivityEvent=nm,y.useAdmin=si,y.useApi=am,y.useDsr=ai,y.usePitcherApi=ye,y.useUi=Ln,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
45
+ Answer concisely in plain text. If the context does not contain the answer, say you could not find it in the available content. Refer to content by its name only — do not include any file ids or codes in your answer.`}async function Hl(){return(await A.highLevelApi.API.request("get_env"))?.mode==="IOS"?A.highLevelApi.API.request("ai.get_capabilities"):{...Gl}}function vn(e){return!e||typeof e.prompt!="string"||e.prompt.trim()===""?Promise.reject(new Error("prompt is required and must be a non-empty string")):A.highLevelApi.API.request("ai.complete",e)}function Bl(e){if(!Array.isArray(e))return;const t=e.flatMap(n=>{if(!n||typeof n!="object")return[];const{file_id:r,page_indices:i}=n;if(typeof r!="string"||r===""||!Array.isArray(i))return[];const a=i.filter(u=>Number.isInteger(u)&&u>=0);return a.length>0?[{file_id:r,page_indices:a}]:[]});return t.length>0?t:void 0}async function Yl(e){if(!e||typeof e.query!="string"||e.query.trim()==="")return Promise.reject(new Error("query is required and must be a non-empty string"));const t=await A.highLevelApi.API.request("get_env"),n=hl(t?.launch_darkly?.pia_search_config);if(n==="off")throw new Error('pia_search_disabled: pia_search_config resolves to mode "off"');if(n==="on_device"&&t?.mode==="IOS")try{if((await An(A.highLevelApi.API.request("ai.get_capabilities"),Ro,"ai.get_capabilities"))?.available)return{answer:(await vn({prompt:zl(e.query,e.context_text),max_tokens:e.max_tokens??ql})).text,source:"on_device"}}catch(l){console.warn("[piaSearchAnswer] on-device path unavailable, falling back to online:",l)}const r=e.instance_id||t?.pitcher?.instance?.id;if(!r)throw new Error("piaSearchAnswer: instance_id could not be resolved from the payload or env");const a=(await yn(`${$o(t)}${Wl}`,{query:e.query,instance_id:r,...Array.isArray(e.file_ids)&&e.file_ids.length>0&&{file_ids:e.file_ids},...e.include_document_text===!0&&{include_document_text:!0},...Array.isArray(e.expansion_terms)&&e.expansion_terms.length>0&&{expansion_terms:e.expansion_terms}},t.pitcher.access_token,Lo,"pia_search"))?.pia_search??{},u=Bl(a.citations);return{answer:typeof a.answer=="string"?a.answer:"",cited_file_ids:Array.isArray(a.cited_file_ids)?a.cited_file_ids:[],...u&&{citations:u},...a.confidence&&{confidence:a.confidence},source:"online"}}const Vl="/core/api/protected/pia-prepare/weekly-focus",kl=e=>220+60*e,Zl=12e4;async function Xl(e){if(!e||!Array.isArray(e.meetings))return Promise.reject(new Error("meetings is required and must be an array"));const t=await A.highLevelApi.API.request("get_env"),n=e.time_zone||Intl.DateTimeFormat().resolvedOptions().timeZone,{windowMeetings:r,rankedMeetings:i,windowCount:a}=Fl(e.meetings,{timeZone:n});if(i.length===0)return{hero:"",top:[],collapsed_count:0,source:t?.mode==="IOS"?"on_device":"online"};const u=Ct(e.max_picks),l={maxPicks:u,onePerAccount:e.one_per_account,windowCount:a};if(t?.mode==="IOS")try{if((await An(A.highLevelApi.API.request("ai.get_capabilities"),Ro,"ai.get_capabilities"))?.available){const C=Rl({meetings:i,context:e.context,max_picks:u,one_per_account:e.one_per_account,time_zone:n}),D=async()=>{const j=await An(vn({prompt:C,max_tokens:kl(u)}),Zl,"ai.complete"),V=Ml(j.text);return{parsed:V,resolved:xl(V,i,l)}};let I=await D();if(I.resolved.top.length<jl(i,l))try{const j=await D();j.resolved.top.length>I.resolved.top.length&&(I=j)}catch(j){console.warn("[weeklyFocusRank] on-device retry failed, keeping the first attempt:",j)}const{parsed:x,resolved:M}=I;if(M.top.length>0||x.hero)return{hero:x.hero,top:M.top,collapsed_count:M.collapsed_count,source:"on_device"}}}catch(P){console.warn("[weeklyFocusRank] on-device path unavailable, falling back to online:",P)}const _=e.instance_id||t?.pitcher?.instance?.id;if(!_)throw new Error("weeklyFocusRank: instance_id could not be resolved from the payload or env");const w=(await yn(`${$o(t)}${Vl}`,{instance_id:_,meetings:r,time_zone:n,...e.context&&{context:e.context},...e.max_picks!==void 0&&{max_picks:u},...e.one_per_account!==void 0&&{one_per_account:e.one_per_account}},t.pitcher.access_token,Lo,"weekly_focus"))?.weekly_focus??{};return{hero:typeof w.hero=="string"?w.hero:"",top:Array.isArray(w.top)?w.top:[],collapsed_count:typeof w.collapsed_count=="number"?w.collapsed_count:0,source:"online"}}const rt={web:"web",ios:"ios",android:"android",windows:"windows",macos:"macos"},Uo="WEB";function Mo(e){return typeof e=="string"&&e!==""&&e!==Uo}const xo={WEB:rt.web,IOS:rt.ios,MACOS:rt.macos,WINDOWS:rt.windows,ANDROID:rt.android};function Jl(e){if(e)return Object.prototype.hasOwnProperty.call(xo,e)?xo[e]:void 0}const Kl="/core/api/protected/appsdb";async function Ql(){const e=await A.highLevelApi.API.request("get_env"),t=e?.pitcher?.token_claims?.["https://pitcher.com/claims/urls"]?.custom_domain,n=e?.pitcher?.organization?.metadata?.custom_domain;let r=t||n||"";return r&&!r.startsWith("http")&&(r=`https://${r}`),{isNative:Mo(e?.mode??e?.pitcher?.mode),origin:r,accessToken:e?.pitcher?.access_token??"",instanceId:e?.pitcher?.instance?.id}}const e_=6e4;let Fe=null;function Nt(){if(Fe&&Date.now()-Fe.fetchedAt<e_)return Fe.promise;const e=Ql();return Fe={promise:e,fetchedAt:Date.now()},e.catch(()=>{Fe?.promise===e&&(Fe=null)}),e}async function We(e,t,n){const r=e.origin||(typeof window<"u"?window.location.origin:""),i=new URL(`${r}${Kl}${t}`);Object.entries(n.params??{}).forEach(([l,_])=>{_!=null&&i.searchParams.set(l,String(_))});const a=await fetch(i.toString(),{method:n.method,credentials:"include",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.accessToken}`,...e.instanceId?{"x-instance-id":e.instanceId}:{}},...n.body!==void 0?{body:JSON.stringify(n.body)}:{}});if(!a.ok){let l;try{l=await a.json()}catch{l=void 0}const _=new Error(`AppsDB request failed: ${a.status}${l?.error?` — ${l.error}`:""}`);throw _.status=a.status,_}if(a.status===204||a.status===205)return;const u=await a.text();return u?JSON.parse(u):void 0}function jo(e,t){return e?.error_code===t||e?.errorCode===t||e?.code===t||typeof e?.reason=="string"&&e.reason.includes(t)||typeof e?.message=="string"&&e.message.includes(t)}function Fo(e){return jo(e,"type_not_synced")}function Rt(e){return jo(e,"requestTypeDoesNotExists")}function t_(e){if(/^'.*'$/.test(e))return e.slice(1,-1).replace(/''/g,"'");if(/^-?\d+(\.\d+)?$/.test(e))return Number(e);if(/^true$/i.test(e))return!0;if(/^false$/i.test(e))return!1;if(/^null$/i.test(e))return null}function n_(e){return e.replace(/'(?:[^']|'')*'/g,"''")}function r_(e){const t=[];let n="",r=!1,i=0;for(;i<e.length;){const a=e[i];if(a==="'"){if(r&&e[i+1]==="'"){n+="''",i+=2;continue}r=!r,n+=a,i+=1;continue}if(!r){const u=e.slice(i).match(/^ AND /i);if(u){t.push(n),n="",i+=u[0].length;continue}}n+=a,i+=1}return r?null:(t.push(n),t)}function o_(e){const n=e.replace(/\s+/g," ").trim().match(/^SELECT \* FROM ([A-Za-z0-9_]+)( WHERE (.+))?$/i);if(!n)return null;const r=n[1],i=n[3];if(!i)return{type:r,conditions:[]};if(/\bOR\b|\bNOT\b|\bLIKE\b|\bIN\b|[<>]|!=/i.test(n_(i)))return null;const a=r_(i);if(!a)return null;const u=[];for(const l of a){const _=l.trim().match(/^([A-Za-z0-9_.]+) ?= ?(.+)$/);if(!_)return null;const S=t_(_[2].trim());if(S===void 0)return null;u.push({path:_[1],value:S})}return{type:r,conditions:u}}function i_(e,t){return t.every(({path:n,value:r})=>{const i=n.split(".").reduce((a,u)=>a?.[u],e);return r===null?i==null:i==null?!1:String(i)===String(r)})}async function s_(e){if(!e?.type||typeof e.type!="string")return Promise.reject(new Error("type is required and must be a non-empty string"));const t=await Nt();if(t.isNative)try{return await A.highLevelApi.API.request("appsdb_get_entries",e)}catch(n){if(!Fo(n)&&!Rt(n))throw n}return We(t,"",{method:"GET",params:e})}async function a_(e){if(!e?.data||typeof e.data!="object")return Promise.reject(new Error("data is required and must be an object"));if(!e.id&&!e.type)return Promise.reject(new Error("type is required when creating an entry (no id provided)"));const t=await Nt();if(t.isNative)try{return await A.highLevelApi.API.request("appsdb_upsert_entry",e)}catch(n){if(!Rt(n))throw n}return e.id?We(t,`/${encodeURIComponent(e.id)}`,{method:"PUT",body:{data:e.data}}):We(t,"",{method:"POST",body:e})}async function c_(e){if(!e?.id||typeof e.id!="string")return Promise.reject(new Error("id is required and must be a non-empty string"));const t=await Nt();if(t.isNative)try{return await A.highLevelApi.API.request("appsdb_delete_entry",e)}catch(n){if(!Rt(n))throw n}await We(t,`/${encodeURIComponent(e.id)}`,{method:"DELETE"})}async function u_(){try{return!!await A.highLevelApi.API.request("is_offline")}catch{return!1}}const f_=1e3;async function Wo(e){try{const t=[];let n=!0;for(;n;){const i=await A.highLevelApi.API.request("appsdb_get_entries",{type:e.type,limit:f_,offset:t.length}),a=i?.entries??[];t.push(...a),n=!!i?.hasMore&&a.length>0}const r=t.filter(i=>i_(i,e.conditions));return{entries:r,totalCount:r.length,hasMore:!1}}catch(t){if(Fo(t)||Rt(t))return null;throw t}}async function d_(e){if(!e?.query||typeof e.query!="string")return Promise.reject(new Error("query is required and must be a non-empty string"));const t=await Nt();if(t.isNative){const n=o_(e.query);let r=!1;if(n&&await u_()){const i=await Wo(n);if(i)return i;r=!0}try{return await We(t,"/psql",{method:"POST",body:e})}catch(i){if(n&&!r&&i instanceof TypeError){const a=await Wo(n);if(a)return a}throw i}}return We(t,"/psql",{method:"POST",body:e})}function l_(e={}){return this.API.request("open",e)}function __(e){return this.API.request("open_external_url",e)}function p_(){return this.API.request("get_env").then(e=>mn(e,"pitcher.org_config.segment"))}function h_(e){return this.API.request("update_my_user",e)}function g_(){return this.API.request("is_offline")}function m_(e){return this.API.request("get_canvases",e)}function E_(e){return this.API.request("create_canvas",e)}function w_(e){return this.API.request("delete_canvas",e)}function A_(e){let t=!1;return typeof window<"u"&&(t=new URLSearchParams(window.location.search).get("debug")==="true"||!!window.debug),t&&console.info("JS API UPDATE CANVAS",e),this.API.request("update_canvas",e).then(n=>(t&&console.info("JS API UPDATE CANVAS RESPONSE",n),n))}function y_(e){return this.API.request("update_canvas_indicators",e)}function v_(e){return this.API.request("get_canvas",e)}function S_(e){return this.API.request("get_canvas_sections_by_ids",e)}function T_(e){return this.API.request("share_canvas",e)}function b_(e){return this.API.request("get_canvas_recommended_files",e)}function O_(e){return this.API.request("get_canvas_theme",e)}function P_(e){return this.API.request("unassign_canvas_theme",e)}function I_(e){const t={...e};return t.type&&(t.type=Array.isArray(t.type)?t.type:[t.type]),t.content_type&&(t.content_type=Array.isArray(t.content_type)?t.content_type:[t.content_type]),this.API.request("get_files",t)}function C_(e){return this.API.request("download_file",e)}function N_(e){let t;return!e?.app_name&&typeof window<"u"&&window.location.href.startsWith("file://")&&(t=window.location.href.match(/pitcher(?:%20|\s+)folders\/files\/([^/]+)\//i)?.[1]),t?this.API.request("get_file",{file_id:t}).then(n=>n?.metadata??{}):this.API.request("get_app_config",e)}function R_(e){const{id:t,file_id:n}=e;return this.API.request("get_file",{...e,file_id:t||n})}function L_(e){return this.API.request("get_file_revision_data",e)}function D_(e){return this.API.request("update_file",e)}function $_(e){return this.API.request("delete_file",e)}function U_(e){return this.API.request("create_file",e)}function M_(){return this.API.request("select_device_file")}function x_(e){return this.API.request("delete_local_file",e)}function j_(e){const{id:t,file_id:n}=e;return this.API.request("get_file_revisions",{file_id:t||n})}function F_(e){return this.API.request("search",e)}function W_(e){return this.API.request("get_users",e)}function q_(e){return this.API.request("refresh_service_token",e??{})}function G_(){return this.API.request("refresh_access_token")}function z_(e){return this.API.request("fetch_document_info",e)}function H_(e){return this.API.request("render_page_as_image",e)}function B_(e){return this.API.request("toast",e)}const Y_=new Set(["SELECT","FROM","WHERE","AND","OR","NOT","IN","LIKE","ORDER","BY","GROUP","HAVING","LIMIT","OFFSET","ASC","DESC","NULLS","FIRST","LAST","NULL","TRUE","FALSE","COUNT","SUM","AVG","MIN","MAX","COUNT_DISTINCT","CALENDAR_MONTH","CALENDAR_QUARTER","CALENDAR_YEAR","DAY_IN_MONTH","DAY_IN_WEEK","DAY_IN_YEAR","DAY_ONLY","FISCAL_MONTH","FISCAL_QUARTER","FISCAL_YEAR","HOUR_IN_DAY","WEEK_IN_MONTH","WEEK_IN_YEAR","INCLUDES","EXCLUDES","ABOVE","BELOW","ABOVE_OR_BELOW","AT","TYPEOF","WHEN","THEN","ELSE","END","USING","SCOPE","DATA","CATEGORY","ROLLUP","CUBE","FORMAT","CONVERTCURRENCY","TOLABEL","DISTANCE","GEOLOCATION"]),Sn=["COUNT","SUM","AVG","MIN","MAX","COUNT_DISTINCT"];function qo(e){return Y_.has(e.toUpperCase())}function Go(e){const t=e.trim();return!!(t.startsWith("'")&&t.endsWith("'")||t.startsWith('"')&&t.endsWith('"')||/^-?\d+(\.\d+)?$/.test(t)||/^(true|false)$/i.test(t)||/^null$/i.test(t)||/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?(Z|[+-]\d{2}:\d{2})?)?$/.test(t)||/^(TODAY|YESTERDAY|TOMORROW|LAST_WEEK|THIS_WEEK|NEXT_WEEK|LAST_MONTH|THIS_MONTH|NEXT_MONTH|LAST_90_DAYS|NEXT_90_DAYS|LAST_N_DAYS:\d+|NEXT_N_DAYS:\d+|LAST_N_WEEKS:\d+|NEXT_N_WEEKS:\d+|LAST_N_MONTHS:\d+|NEXT_N_MONTHS:\d+|LAST_N_QUARTERS:\d+|NEXT_N_QUARTERS:\d+|LAST_N_YEARS:\d+|NEXT_N_YEARS:\d+|THIS_QUARTER|LAST_QUARTER|NEXT_QUARTER|THIS_YEAR|LAST_YEAR|NEXT_YEAR|THIS_FISCAL_QUARTER|LAST_FISCAL_QUARTER|NEXT_FISCAL_QUARTER|THIS_FISCAL_YEAR|LAST_FISCAL_YEAR|NEXT_FISCAL_YEAR)$/i.test(t))}function V_(e){return/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?(Z|[+-]\d{2}:\d{2})?)?$/.test(e)}function Ce(e,t,n){const r=e.trim();if(qo(r)||Go(r))return r;if(r==="__FIELDS_ALL_PLACEHOLDER__")return`{${t}:_soup}`;if(r==="*")return"*";if(r.startsWith("{")&&r.endsWith("}"))return r;if(r.includes(".")){const i=r.split("."),a=i[0];if(n.has(a.toLowerCase())&&n.get(a.toLowerCase())===t){const u=i.slice(1).join(".");return`{${t}:${u}}`}return`{${t}:${r}}`}return`{${t}:${r}}`}function zo(e,t,n){for(const r of Sn){const i=new RegExp(`\\b${r}\\s*\\(([^)]+)\\)`,"gi");e=e.replace(i,(a,u)=>{const l=u.trim();if(l==="*")return`${r}(*)`;if(l.toUpperCase().startsWith("DISTINCT ")){const S=l.substring(9).trim(),w=Ce(S,t,n);return`${r}(DISTINCT ${w})`}const _=Ce(l,t,n);return`${r}(${_})`})}return e}function k_(e){const t=[];let n=0,r="";for(let i=0;i<e.length;i++){const a=e[i];a==="("?(n++,r+=a):a===")"?(n--,r+=a):a===","&&n===0?(r.trim()&&t.push(r.trim()),r=""):r+=a}return r.trim()&&t.push(r.trim()),t}function Z_(e,t,n){return e.map(r=>{const i=r.match(/^(.+?)\s+(?:AS\s+)?([A-Za-z_][A-Za-z0-9_]*)$/i);let a=r,u="";if(i&&(a=i[1].trim(),u=i[2]),Sn.some(S=>new RegExp(`\\b${S}\\s*\\(`,"i").test(a))){const S=zo(a,t,n);return u?`${S} ${u}`:S}const _=Ce(a,t,n);return u?`${_} ${u}`:_})}function X_(e){let t=e.replace(/\s*!=\s*null\b/gi," IS NOT NULL");return t=t.replace(/\s*<>\s*null\b/gi," IS NOT NULL"),t=t.replace(/\s*=\s*null\b/gi," IS NULL"),t}function Ho(e,t,n){let r="",i=0;const a=e.length;for(;i<a;){const u=e[i];if(/\s/.test(u)){r+=u,i++;continue}if(u==="'"||u==='"'){const l=u;for(r+=u,i++;i<a&&e[i]!==l;)e[i]==="\\"&&i+1<a?(r+=e[i]+e[i+1],i+=2):(r+=e[i],i++);i<a&&(r+=e[i],i++);continue}if(/[()=<>!,]/.test(u)){r+=u,i++,(u==="!"||u==="<"||u===">")&&i<a&&e[i]==="="&&(r+=e[i],i++);continue}if(/[a-zA-Z_]/.test(u)){let l="";for(;i<a&&/[a-zA-Z0-9_.]/.test(e[i]);)l+=e[i],i++;qo(l)||Go(l)?r+=l:r+=Ce(l,t,n);continue}if(/[0-9-]/.test(u)){let l="";for(u==="-"&&(l+=u,i++);i<a&&/[0-9.:\-TZ+]/.test(e[i]);)l+=e[i],i++;V_(l)?r+=`'${l}'`:r+=l;continue}r+=u,i++}return r=X_(r),r}function J_(e){const t=[],n=e.split(/,(?![^()]*\))/);for(const r of n){const i=r.trim();if(!i)continue;const a=i.match(/^(.+?)\s*(ASC|DESC)?\s*(NULLS\s+(?:FIRST|LAST))?$/i);if(a){const u=a[1].trim();let l=a[2]?a[2].toUpperCase():"";a[3]&&(l+=(l?" ":"")+a[3].toUpperCase()),t.push({field:u,direction:l})}else t.push({field:i,direction:""})}return t}function K_(e,t,n){return e.map(({field:r,direction:i})=>{const a=Sn.some(l=>new RegExp(`\\b${l}\\s*\\(`,"i").test(r));let u;return a?u=zo(r,t,n):u=Ce(r,t,n),i?`${u} ${i}`:u})}function Q_(e){return e.split(/,(?![^()]*\))/).map(t=>t.trim()).filter(Boolean)}function ep(e,t,n){return e.map(r=>/^(ROLLUP|CUBE)\s*\(/i.test(r)?r.replace(/\(([^)]+)\)/g,(i,a)=>`(${a.split(",").map(_=>_.trim()).map(_=>Ce(_,t,n)).join(", ")})`):Ce(r,t,n))}function tp(e){const t=[],n=e.match(/^([A-Za-z0-9_]+)(?:\s+(?:AS\s+)?([A-Za-z_][A-Za-z0-9_]*))?/i);if(!n)return{primary:"",joins:t};const r=n[1],i=n[2],a=/(LEFT\s+OUTER\s+JOIN|LEFT\s+JOIN|INNER\s+JOIN|JOIN)\s+([A-Za-z0-9_]+)(?:\s+(?:AS\s+)?([A-Za-z_][A-Za-z0-9_]*))?\s+ON\s+([^,]+?)(?=(?:LEFT|INNER|JOIN|$))/gi;let u;for(;(u=a.exec(e))!==null;)t.push({type:u[1].toUpperCase().replace(/\s+/g," "),object:u[2],alias:u[3],on:u[4]?.trim()});return{primary:r,alias:i,joins:t}}function np(e){const t=[];let n="",r=0,i="",a=!1;for(let u=0;u<e.length;u++){const l=e[u];if(l==="("){if(r++,r===1){const _=e.substring(u+1).trimStart();if(/^SELECT\s/i.test(_)){a=!0,i=l;continue}}a?i+=l:n+=l}else l===")"?a?(i+=l,r--,r===0&&(t.push(i),i="",a=!1)):(r--,n+=l):a?i+=l:n+=l}return{cleanQuery:n,subqueries:t}}function Tn(e){const{cleanQuery:t}=np(e),n=t.match(/FROM\s+([A-Za-z0-9_]+)(?:\s+(?:AS\s+)?[A-Za-z_][A-Za-z0-9_]*)?(?=\s+WHERE\s+|\s+ORDER\s+BY\s+|\s+GROUP\s+BY\s+|\s+HAVING\s+|\s+LIMIT\s+|\s+OFFSET\s+|\s*$)/i);return{primaryObject:n?n[1]:null,cleanQuery:t}}function rp(e){if(!e||typeof e!="string")return"";let t=e.replace(/\s+/g," ").trim();const{primaryObject:n,cleanQuery:r}=Tn(t);if(!n)return e;t=r,t=t.replace(/\bFIELDS\s*\(\s*(ALL|STANDARD|CUSTOM)\s*\)/gi,"__FIELDS_ALL_PLACEHOLDER__");const i=t.match(/SELECT\s+([\s\S]+?)\s+FROM\s+/i);if(!i)return e;const a=t.match(/FROM\s+([\s\S]+?)(?=\s+WHERE\s+|\s+ORDER\s+BY\s+|\s+GROUP\s+BY\s+|\s+HAVING\s+|\s+LIMIT\s+|\s+OFFSET\s+|\s*$)/i),u=a?tp(a[1].trim()):{},l=t.match(/WHERE\s+([\s\S]+?)(?=\s+ORDER\s+BY\s+|\s+GROUP\s+BY\s+|\s+HAVING\s+|\s+LIMIT\s+|\s+OFFSET\s+|\s*$)/i),_=t.match(/GROUP\s+BY\s+([\s\S]+?)(?=\s+HAVING\s+|\s+ORDER\s+BY\s+|\s+LIMIT\s+|\s+OFFSET\s+|\s*$)/i),S=t.match(/HAVING\s+([\s\S]+?)(?=\s+ORDER\s+BY\s+|\s+LIMIT\s+|\s+OFFSET\s+|\s*$)/i),w=t.match(/ORDER\s+BY\s+([\s\S]+?)(?=\s+LIMIT\s+|\s+OFFSET\s+|\s*$)/i),P=t.match(/LIMIT\s+(\d+)/i),C=t.match(/OFFSET\s+(\d+)/i),D=new Map;u.alias&&D.set(u.alias.toLowerCase(),n),D.set(n.toLowerCase(),n);const I=[],x=k_(i[1].trim()),M=Z_(x,n,D);I.push(`SELECT ${M.join(", ")}`),I.push(`FROM {${n}}`);const j=[];if(l){const V=Ho(l[1].trim(),n,D);j.push(V)}if(j.length>0&&I.push(`WHERE ${j.join(" AND ")}`),_){const V=Q_(_[1].trim()),ve=ep(V,n,D);I.push(`GROUP BY ${ve.join(", ")}`)}if(S){const V=Ho(S[1].trim(),n,D);I.push(`HAVING ${V}`)}if(w){const V=J_(w[1].trim()),ve=K_(V,n,D);I.push(`ORDER BY ${ve.join(", ")}`)}return P&&I.push(`LIMIT ${P[1]}`),C&&I.push(`OFFSET ${C[1]}`),I.join(" ")}function op(e){return A.highLevelApi.API.request("query",e)}function Bo(e){return A.highLevelApi.API.request("crm_query",e)}function ip(e){const{cleanQuery:t}=Tn(e.replace(/\s+/g," ").trim()),n=t.match(/SELECT\s+([\s\S]+?)\s+FROM\s+/i);if(!n)return[];const r=n[1],i=[];let a=0,u="";for(let l=0;l<r.length;l++){const _=r[l];_==="("?(a++,u+=_):_===")"?(a--,u+=_):_===","&&a===0?(u.trim()&&i.push(u.trim()),u=""):u+=_}return u.trim()&&i.push(u.trim()),i.map(l=>{const _=l.match(/^(.+?)\s+(?:AS\s+)?([A-Za-z_][A-Za-z0-9_]*)$/i);return _?_[1].trim():l.trim()})}function sp(e){const{primaryObject:t}=Tn(e.replace(/\s+/g," ").trim());return t??""}function ap(e,t,n){const r=t.split(".");if(r.length===1){e[t]=n;return}let i=e;for(let a=0;a<r.length-1;a++){const u=r[a];(!i[u]||typeof i[u]!="object")&&(i[u]={}),i=i[u]}i[r[r.length-1]]=n}function cp(e){const t=e.trim();return t==="*"||/^FIELDS\s*\(\s*(ALL|STANDARD|CUSTOM)\s*\)$/i.test(t)}function up(e,t,n){return!e||!Array.isArray(e)?[]:e.map(r=>{const i={};t.forEach((u,l)=>{if(l<r.length){const _=r[l];cp(u)?_&&typeof _=="object"&&!Array.isArray(_)&&Object.assign(i,_):ap(i,u,_)}});const a=i.Id||i.id||"";return i.attributes={type:n,url:a?`/services/data/v57.0/sobjects/${n}/${a}`:""},i})}async function fp(e){const t=e.query;if(!t||typeof t!="string")return Promise.reject(new Error("Query is required and must be a string"));let n=!1;try{const r=await A.highLevelApi.API.request("get_env"),i=r?.mode==="IOS",a=r?.launch_darkly?.sfdc_offline_enabled===!0;n=i&&a}catch{n=!1}if(console.log("[crmQueryAdaptive] Called query: ",t),n){const r=ip(t),i=sp(t);let a=rp(t);if(!a.includes("__locally_deleted__")){const S=a.match(/FROM\s+\{([A-Za-z0-9_]+)\}/)?.[1];if(S){const w=`({${S}:__locally_deleted__} = 0 OR {${S}:__locally_deleted__} = 'false' OR {${S}:__locally_deleted__} IS NULL)`;a.includes(" WHERE ")?a=a.replace(/\s+WHERE\s+([\s\S]+?)(?=\s+ORDER\s+BY\s+|\s+GROUP\s+BY\s+|\s+HAVING\s+|\s+LIMIT\s+|\s+OFFSET\s+|\s*$)/i,(P,C)=>` WHERE (${C}) AND ${w}`):a=a.replace(/(FROM\s+\{[A-Za-z0-9_]+\})((\s+(?:ORDER\s+BY|GROUP\s+BY|HAVING|LIMIT|OFFSET)[\s\S]*)?)$/i,(P,C,D)=>`${C} WHERE ${w}${D}`)}}console.log("[crmSmartQuery] Called query: ",a);const u=await Yo({query:a}),l=up(u,r,i);return console.log("[SmartStore] Results: ",l),{records:l,totalSize:l.length}}return Bo(e)}function Yo(e){const t=e.query;return!t||typeof t!="string"?Promise.reject(new Error("Query is required and must be a string")):/\{[^}]+:[^}]+}/.test(t.trim())?A.highLevelApi.API.request("crm_smart_query",e):Promise.reject(new Error("Invalid SmartStore query syntax. SmartStore queries must use curly braces syntax: {SoupName:FieldName}"))}function dp(e){if(!e)return Promise.reject(new Error("Payload is required"));const t=e.object;return!t||typeof t!="string"||t.trim()===""?Promise.reject(new Error("Object name is required and must be a non-empty string")):e.record_type_id!==void 0&&(typeof e.record_type_id!="string"||e.record_type_id.trim()==="")?Promise.reject(new Error("record_type_id must be a non-empty string if provided")):A.highLevelApi.API.request("crm_smart_object_metadata",e)}function lp(e){if(!e||!e.objects||!Array.isArray(e.objects))return Promise.reject(new Error("Payload must contain an array of objects"));if(e.objects.length===0)return Promise.reject(new Error("Objects array cannot be empty"));for(const t of e.objects){if(!t)return Promise.reject(new Error("Objects array cannot contain null or undefined elements"));if(!t.table_name||typeof t.table_name!="string"||t.table_name.trim()==="")return Promise.reject(new Error("Each object must have a valid non-empty table_name"));if(t.external_id_path!==void 0&&(typeof t.external_id_path!="string"||t.external_id_path.trim()===""))return Promise.reject(new Error(`Object for table ${t.table_name} has invalid external_id_path. It must be a non-empty string or undefined.`));if(!t.objects||!Array.isArray(t.objects)||t.objects.length===0)return Promise.reject(new Error(`Object for table ${t.table_name} must have a non-empty objects array`));for(let n=0;n<t.objects.length;n++){const r=t.objects[n];if(!r||typeof r!="object"||Array.isArray(r))return Promise.reject(new Error(`Object for table ${t.table_name} contains invalid element at index ${n}. All records must be valid objects, not null, undefined, or arrays.`))}}return console.log("[crmSmartUpsertObjects] Request payload:",JSON.stringify(e,null,2)),A.highLevelApi.API.request("crm_smart_upsert_objects",e).then(t=>(console.log("[crmSmartUpsertObjects] Success:",t),t)).catch(t=>{throw console.error("[crmSmartUpsertObjects] Error:",t),t})}function _p(e){if(!e)return Promise.reject(new Error("Payload is required"));const t=e.object;return!t||typeof t!="string"||t.trim()===""?Promise.reject(new Error("Object name is required and must be a non-empty string")):A.highLevelApi.API.request("crm_smart_object_validation_rules",e)}function pp(e){if(!e)return Promise.reject(new Error("Payload is required"));const t=e.object;return!t||typeof t!="string"||t.trim()===""?Promise.reject(new Error("Object name is required and must be a non-empty string")):A.highLevelApi.API.request("crm_smart_object_layout",e)}function hp(e){if(!e||!e.objects||!Array.isArray(e.objects))return Promise.reject(new Error("Payload must contain an array of objects"));if(e.objects.length===0)return Promise.reject(new Error("Objects array cannot be empty"));for(const t of e.objects){if(!t)return Promise.reject(new Error("Objects array cannot contain null or undefined elements"));if(!t.table_name||typeof t.table_name!="string"||t.table_name.trim()==="")return Promise.reject(new Error("Each object must have a valid non-empty table_name"));if(!t.ids||!Array.isArray(t.ids)||t.ids.length===0)return Promise.reject(new Error(`Object for table ${t.table_name} must have a non-empty ids array`));for(let n=0;n<t.ids.length;n++){const r=t.ids[n];if(!r||typeof r!="string"||r.trim()==="")return Promise.reject(new Error(`Object for table ${t.table_name} contains invalid id at index ${n}. All IDs must be non-empty strings.`))}}return console.log("[crmSmartDeleteObjects] Request payload:",JSON.stringify(e,null,2)),A.highLevelApi.API.request("crm_smart_delete_objects",e).then(t=>(console.log("[crmSmartDeleteObjects] Success:",t),t)).catch(t=>{throw console.error("[crmSmartDeleteObjects] Error:",t),t})}function gp(e){if(!e)return Promise.reject(new Error("Payload is required"));if(!e.sobject||typeof e.sobject!="string"||e.sobject.trim()==="")return Promise.reject(new Error("sobject is required and must be a non-empty string"));if(!e.records||!Array.isArray(e.records)||e.records.length===0)return Promise.reject(new Error("records is required and must be a non-empty array"));for(let t=0;t<e.records.length;t++){const n=e.records[t];if(!n||typeof n!="object"||Array.isArray(n))return Promise.reject(new Error(`records contains invalid element at index ${t}. All records must be valid objects.`))}return A.highLevelApi.API.request("crm_create",e)}function mp(e){if(!e)return Promise.reject(new Error("Payload is required"));if(!e.sobject||typeof e.sobject!="string"||e.sobject.trim()==="")return Promise.reject(new Error("sobject is required and must be a non-empty string"));if(!e.records||!Array.isArray(e.records)||e.records.length===0)return Promise.reject(new Error("records is required and must be a non-empty array"));if(!e.external_id_field||typeof e.external_id_field!="string"||e.external_id_field.trim()==="")return Promise.reject(new Error("external_id_field is required and must be a non-empty string"));for(let t=0;t<e.records.length;t++){const n=e.records[t];if(!n||typeof n!="object"||Array.isArray(n))return Promise.reject(new Error(`records contains invalid element at index ${t}. All records must be valid objects.`))}return A.highLevelApi.API.request("crm_upsert",e)}function Ep(e){return e?!e.sobject||typeof e.sobject!="string"||e.sobject.trim()===""?Promise.reject(new Error("sobject is required and must be a non-empty string")):A.highLevelApi.API.request("crm_describe",e):Promise.reject(new Error("Payload is required"))}function wp(e){return e?!e.sobject||typeof e.sobject!="string"||e.sobject.trim()===""?Promise.reject(new Error("sobject is required and must be a non-empty string")):A.highLevelApi.API.request("crm_layout",e):Promise.reject(new Error("Payload is required"))}function Ap(e){return this.API.request("get_folders",e)}function yp(e={id:"root"}){return this.API.request("get_folder",e)}function vp(e){return this.API.request("create_folder",e)}function Sp(e){return this.API.request("update_folder",e)}function Tp(e){return this.API.request("delete_folder",e)}function bp(e){return this.API.request("move_folder_items",e)}function Op(e){return this.API.request("get_core_folders",e)}function Pp(e,t){return this.API.request("patch_core_folder",{id:e,payload:t})}function Ip(e){return e.type||(e.type="native"),A.highLevelApi.API.request("notify",e)}function Cp(e){return A.highLevelApi.API.request("track",e)}function Np(e){return this.API.request("get_instance_metadata_templates",e)}function Rp(){return this.API.request("trigger_non_files_sync")}function Lp(e){return A.highLevelApi.API.request("submit_user_feedback",e)}function Dp(){return A.highLevelApi.API.request("close")}function $p(e){return this.API.request("open_web_view_always_on_top",e)}function Up(e){return this.API.request("show_syncbox",e)}async function Mp(e){return this.API.request("share",e)}async function xp(e){return this.API.request("show_peer_session",e)}function jp(e){return this.API.request("get_themes",e)}function Fp(e){return this.API.request("assign_canvas_theme",e)}const Vo=["STT_DISABLED","STT_DEVICE_UNSUPPORTED","STT_MODEL_NOT_READY","STT_BUSY","STT_MIC_PERMISSION_DENIED","STT_NOT_RECORDING","STT_CAPTURE_FAILED","STT_ERROR"];function ko(e){const t="requestTypeDoesNotExists",n=e;return n?.error_code===t||n?.errorCode===t||n?.code===t||typeof n?.reason=="string"&&n.reason.includes(t)||typeof n?.message=="string"&&n.message.includes(t)?new Error("STT_DEVICE_UNSUPPORTED: dictation is not supported by this app version"):e}function Wp(e){return this.API.request("stt.start",e).catch(t=>{throw ko(t)})}function qp(){return this.API.request("stt.availability")}function Gp(){return this.API.request("stt.warmup")}function zp(e){return this.API.request("stt.stop",e).catch(t=>{throw ko(t)})}function Hp(e){const t=e,n=t?.code??t?.error_code??t?.errorCode;if(typeof n=="string"&&Vo.includes(n))return n;const r=typeof t?.reason=="string"?t.reason:typeof t?.message=="string"?t.message:"";return Vo.find(i=>r.includes(i))}const Zo=["TTS_EMPTY_TEXT","TTS_VOICE_UNAVAILABLE","TTS_ERROR"];function Bp(e){return this.API.request("tts.speak",e)}function Yp(){return this.API.request("tts.stop")}function Vp(e){const t=e,n=t?.code??t?.error_code??t?.errorCode;if(typeof n=="string"&&Zo.includes(n))return n;const r=typeof t?.reason=="string"?t.reason:typeof t?.message=="string"?t.message:"";return Zo.find(i=>r.includes(i))}const kp=Object.freeze(Object.defineProperty({__proto__:null,aiComplete:vn,aiGetCapabilities:Hl,appsDbDeleteEntry:c_,appsDbGetEntries:s_,appsDbPsql:d_,appsDbUpsertEntry:a_,assignCanvasTheme:Fp,close:Dp,createCanvas:E_,createFile:U_,createFolder:vp,crmCreate:gp,crmDescribe:Ep,crmLayout:wp,crmQuery:Bo,crmQueryAdaptive:fp,crmSmartDeleteObjects:hp,crmSmartObjectLayout:pp,crmSmartObjectMetadata:dp,crmSmartObjectValidationRules:_p,crmSmartQuery:Yo,crmSmartUpsertObjects:lp,crmUpsert:mp,deleteCanvas:w_,deleteFile:$_,deleteFolder:Tp,deleteLocalFile:x_,downloadFile:C_,fetchDocumentInfo:z_,getAppConfig:N_,getCanvas:v_,getCanvasRecommendedFiles:b_,getCanvasTheme:O_,getCanvases:m_,getCoreFolders:Op,getEnv:p_,getFile:R_,getFileRevisionData:L_,getFileRevisions:j_,getFiles:I_,getFolder:yp,getFolders:Ap,getInstanceMetadataTemplates:Np,getSectionsByIds:S_,getThemes:jp,getUsers:W_,isOffline:g_,moveFolderItems:bp,notify:Ip,open:l_,openExternalUrl:__,openWebViewAlwaysOnTop:$p,patchCoreFolder:Pp,piaSearchAnswer:Yl,postJsonWithTimeout:yn,query:op,refreshAccessToken:G_,refreshServiceToken:q_,renderPageAsImage:H_,search:F_,selectDeviceFile:M_,share:Mp,shareCanvas:T_,showPeerSession:xp,showSyncbox:Up,sttAvailability:qp,sttErrorCode:Hp,sttStart:Wp,sttStop:zp,sttWarmup:Gp,submitUserFeedback:Lp,toast:B_,track:Cp,triggerNonFilesSync:Rp,ttsErrorCode:Vp,ttsSpeak:Bp,ttsStop:Yp,unassignCanvasTheme:P_,updateCanvas:A_,updateCanvasIndicators:y_,updateFile:D_,updateFolder:Sp,updateMyUser:h_,weeklyFocusRank:Xl},Symbol.toStringTag,{value:"Module"}));class Xo{listeners={};on(t,n){this.listeners[t]=(this.listeners[t]??[]).concat(n)}off(t,n){this.listeners[t]=(this.listeners[t]??[]).filter(r=>r!==n)}emit(t,n){(this.listeners[t]??[]).forEach(r=>r(n))}}const K=[];for(let e=0;e<256;++e)K.push((e+256).toString(16).slice(1));function Zp(e,t=0){return(K[e[t+0]]+K[e[t+1]]+K[e[t+2]]+K[e[t+3]]+"-"+K[e[t+4]]+K[e[t+5]]+"-"+K[e[t+6]]+K[e[t+7]]+"-"+K[e[t+8]]+K[e[t+9]]+"-"+K[e[t+10]]+K[e[t+11]]+K[e[t+12]]+K[e[t+13]]+K[e[t+14]]+K[e[t+15]]).toLowerCase()}const Xp=new Uint8Array(16);function Jp(){return crypto.getRandomValues(Xp)}function Kp(e,t,n){return crypto.randomUUID?crypto.randomUUID():Qp(e)}function Qp(e,t,n){e=e||{};const r=e.random??e.rng?.()??Jp();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Zp(r)}const eh="PITCHER_EVENT";var Lt=(e=>(e.REQUEST="PITCHER_REQUEST",e.RESPONSE="PITCHER_RESPONSE",e))(Lt||{}),Dt=(e=>(e.OK="ok",e.ERROR="error",e))(Dt||{}),ot=(e=>(e.ENV_CHANGED="env_changed",e.ACCESS_TOKEN_RENEWED="access_token_renewed",e.PHOTOS_CAPTURED="photos_captured",e.GLOBAL_PHOTO_CAPTURED="global_photo_captured",e.FILE_DOWNLOADED="file_downloaded",e.FILE_UPLOAD_PROGRESS="file_upload_progress",e.UPDATE_LOCATION="update_location",e.CANVAS_UPDATED="canvas_updated",e.CANVAS_UPDATED_SUCCESS="canvas_updated_success",e.FILE_CLOSED="file_closed",e.FILE_OPENED="file_opened",e.APP_BACKGROUNDED="app_backgrounded",e.APP_FOREGROUNDED="app_foregrounded",e.NON_FILES_SYNC_FINISHED="non_files_sync_finished",e.CONTENT_LIST_REFRESH_REQUESTED="content_list_refresh_requested",e.NETWORK_CONNECTION_ESTABLISHED="network_connection_established",e.NETWORK_CONNECTION_LOST="network_connection_lost",e.ENTERED_FULLSCREEN="entered_fullscreen",e.EXITED_FULLSCREEN="exited_fullscreen",e.SUBMIT_POSTCALL_CLICKED="submit_postcall_clicked",e.ANALYTICS_CAPTURED="analytics_captured",e.OPEN_FOLDER_REQUESTED="open_folder_requested",e.CANVAS_PAGE_NEXT_REQUESTED="canvas_page_next_requested",e.CANVAS_PAGE_PREVIOUS_REQUESTED="canvas_page_previous_requested",e.CANVAS_OPEN_REQUESTED="canvas_open_requested",e.CANVAS_CLOSE_REQUESTED="canvas_close_requested",e.ROUTE_CHANGE_REQUESTED="route_change_requested",e.ITEM_SHAREBOX_STATUS_REQUESTED="item_sharebox_status_requested",e.ITEM_SHAREBOX_STATUS_UPDATED="item_sharebox_status_updated",e.ITEM_SHAREBOX_ADD_REQUESTED="item_sharebox_add_requested",e.ITEM_SHAREBOX_ADD_COMPLETED="item_sharebox_add_completed",e.SYNC_BADGE_VALUE_REPORTED="sync_badge_value_reported",e.SYNC_BOX_RESOLVE_ERROR_TAPPED="sync_box_resolve_error_tapped",e.PEER_CONNECTIVITY_EVENT="peer_connectivity_event",e.STT_PARTIAL="stt.partial",e.STT_INTERRUPTED="stt.interrupted",e))(ot||{}),Jo=(e=>(e.UI_SHOW_MODAL="ui:show-modal",e.UI_HIDE_MODAL="ui:hide-modal",e.FILE_DOWNLOAD="file:download",e.CANVAS_NEXT_BUTTON_CLICKED="canvas_next_button_clicked",e.CANVAS_PREVIOUS_BUTTON_CLICKED="canvas_previous_button_clicked",e.CANVAS_OPENED="canvas_opened",e.CANVAS_CLOSED="canvas_closed",e.ROUTE_CHANGED="route_changed",e))(Jo||{}),Ko=(e=>(e.CREATE_AND_OPEN_CANVAS="create_and_open_canvas",e.OPEN_CANVAS="open_canvas",e.START_CALL="start_call",e.SELECT_ACCOUNT="select_account",e))(Ko||{});class th extends Error{}function nh(e,t){if(!e)throw new th(t)}const Qo=["id__in","tags__in","tags__not_in","template__id","template__id__in","modified_at__gtr","created_at__gtr","end_at__lt","start_at__gt","account__id","end_at__gt","end_at__range","start_at__lt","start_at__range","external_objects__connection_id","external_objects__content_type","external_objects__external_content_type","external_objects__external_object_id","owned_by__name__icontains","template__name__icontains"],ei=["context","overrides","filters","metadata","style","hidden"],ti=(e,t)=>t.includes(e)||e.endsWith("style"),it=(e,t=Qo,n=ei)=>Array.isArray(e)?e.map(r=>it(r,t,n)):e!=null&&e.constructor===Object?Object.keys(e).reduce((r,i)=>{const a=ti(i,n),u=t.includes(i)||a?i:Cu(i),l=a?e[i]:it(e[i],t,n);return{...r,[u]:l}},{}):e,bn=(e,t=Qo,n=ei)=>Array.isArray(e)?e.map(r=>bn(r,t,n)):e!=null&&e.constructor===Object?Object.keys(e).reduce((r,i)=>{const a=ti(i,n),u=t.includes(i)||a?i:bo(i),l=a?e[i]:bn(e[i],t,n);return{...r,[u]:l}},{}):e;function On(e,t=1,n=20){if(typeof e!="object"||e===null)return e;if(Array.isArray(e))return e.length>n&&t<=0?`[Truncated - ${e.length} length array]`:e.map(i=>On(i,t-1,n));const r=Object.keys(e);return r.length>n&&t<=0?`{Truncated - ${r.length} properties obj}`:r.reduce((i,a)=>(i[a]=On(e[a],t-1,n),i),{})}function rh(e,t=[],n=["development","test"].includes("production")){if(n)return!0;if(!e||!e.origin)return!1;const r=[...t,window.location.origin,"pitcher.com"],i=r.includes(e.origin)||r.some(a=>e.origin.endsWith(a));return i||console.warn(`The message origin ${e.origin} is not the same as the current origin ${window.location.origin}. Bailing...`),i}const Pn=5,ni=1e3;let st=null;async function oh(){return st||(console.info("Refreshing access token..."),st=(async()=>{try{return await A.highLevelApi.refreshAccessToken().then(e=>A.highLevelApi.getEnv().then(t=>(ri(t),e.access_token)))}catch(e){throw console.error("Failed to refresh token:",e),e}finally{st=null}})(),st)}function at(e){const t=new URLSearchParams;function n(r,i){if(i!=null)if(Array.isArray(i))i.forEach(a=>n(r,a));else if(typeof i=="object"&&!Array.isArray(i))for(const a in i)n(`${r}[${a}]`,i[a]);else t.append(r,i)}for(const r in e)n(r,e[r]);return t.toString()}function ih(e){return typeof e!="number"?!1:e>=200&&e<300?!0:e>=400&&e<500}async function we(e,t,n=Pn){try{const r=await fetch(e,t);if(!r.ok)if(r.status===401&&n>0){const a=await oh();return t.headers=t.headers||{},t.headers.Authorization=`Bearer ${a}`,we(e,t,n-1)}else if(r.status>=500&&r.status<600&&n>0){const a=ni*Math.pow(2,Pn-n);return await new Promise(u=>setTimeout(u,a)),we(e,t,n-1)}else{const a=await r.text().catch(()=>"");let u=r.statusText;try{u=JSON.parse(a)?.message||r.statusText}catch{}const l=new Error(`HTTP error! status: ${r.status}, message: ${u}`);throw l.status=r.status,l}if(r.status===204||r.status===205)return;const i=await r.text();if(!i){const a=new Error(`Empty response body for status ${r.status} (expected JSON)`);throw a.status=r.status,a}try{return JSON.parse(i)}catch(a){throw a.status=r.status,a}}catch(r){if(n>0&&!(r instanceof TypeError)&&!ih(r.status)){const i=ni*Math.pow(2,Pn-n);return await new Promise(a=>setTimeout(a,i)),we(e,t,n-1)}throw r}}function sh(e,t){const n={"Content-Type":"application/json",Authorization:`Bearer ${t}`},r="/api/v1",i={credentials:"include"};return{get:async(a,u={})=>{const l=new URL(`${e}${r}${a}`);return u.params&&(l.search=at(u.params)),await we(l.toString(),{...i,...u,method:"GET",headers:n})},post:async(a,u,l={})=>{const _=new URL(`${e}${r}${a}`);return l.params&&(_.search=at(l.params)),await we(_.toString(),{...i,...l,method:"POST",headers:n,body:JSON.stringify(u)})},put:async(a,u,l={})=>{const _=new URL(`${e}${r}${a}`);return l.params&&(_.search=at(l.params)),await we(_.toString(),{...i,...l,method:"PUT",headers:n,body:JSON.stringify(u)})},delete:async(a,u={})=>{const l=new URL(`${e}${r}${a}`);return u.params&&(l.search=at(u.params)),await we(l.toString(),{...i,...u,method:"DELETE",headers:n})},patch:async(a,u,l={})=>{const _=new URL(`${e}${r}${a}`);return l.params&&(_.search=at(l.params)),await we(_.toString(),{...i,...l,method:"PATCH",headers:n,body:JSON.stringify(u)})},patchUrl:async(a,u,l={})=>await we(a,{...i,...l,method:"PATCH",headers:n,body:JSON.stringify(u)})}}function ah(e){return e?Object.entries(e).reduce((t,[n,r])=>(t[n]=n.endsWith("__range")&&Array.isArray(r)?r.join(","):r,t),{}):{}}let le,Q;function re(){if(!le)throw new Error("Missing env");if(!Q)throw new Error("Missing http")}function $t(e){return pl(e??{},t=>t!=null)}const ri=e=>{e?.pitcher?.token_claims?.["https://pitcher.com/claims/urls"]?.custom_domain||(console.warn("No custom domain found in token claims",e?.pitcher?.token_claims),typeof window<"u"&&window.Sentry?.captureMessage?.("No custom domain found in token claims",{extra:{env:e},level:"warning"}));const t=e?.pitcher?.token_claims?.["https://pitcher.com/claims/urls"]?.custom_domain,n=e?.pitcher?.access_token!==le?.pitcher?.access_token||t&&t!==le?.pitcher?.token_claims?.["https://pitcher.com/claims/urls"]?.custom_domain;le=ol({},le,e),n&&(Q=sh(le.pitcher.token_claims["https://pitcher.com/claims/urls"].custom_domain,le.pitcher.access_token))},oi={get_canvases:async e=>{re();const{api_base_url:t,filters:n={},...r}=e;return await Q.get("/canvases",{params:{instance_id:le.pitcher.instance.id,...ah(n),...$t(r)}})},get_canvas:async e=>{re();const{id:t,...n}=e;return await Q.get(`/canvases/${e.id}`,{params:n})},get_canvas_sections_by_ids:async e=>(re(),await Q.post("/canvases/sections/by-ids",{canvas_id:e.canvas_id,section_ids:e.section_ids,...e.exclude_drafts!==void 0&&{exclude_drafts:e.exclude_drafts},...e.include_expired_files!==void 0&&{include_expired_files:e.include_expired_files},...e.include_pending_files!==void 0&&{include_pending_files:e.include_pending_files}})),create_canvas:async e=>(re(),await Q.post("/canvases",{...e,instance_id:le.pitcher.instance.id})),update_canvas:async e=>{re();const{id:t,fields:n,lazy_sections:r,...i}=e,a=r===!0?"lazy_sections=true":"";if(le?.launch_darkly?.enable_canvas_core_patch===!0){const _=le.pitcher.token_claims["https://pitcher.com/claims/urls"].custom_domain,S=[n?`fields=${encodeURIComponent(n)}`:"",a].filter(Boolean).join("&"),w=`${_}/core/api/protected/v1/canvases/${t}${S?`?${S}`:""}`;return await Q.patchUrl(w,i)}return await Q.patch(`/canvases/${t}${a?`?${a}`:""}`,{fields:n,...i})},delete_canvas:async e=>(re(),await Q.delete(`/canvases/${e.id}`)),share_canvas:async e=>{re();let t;try{t=await Q.get(`/shared-links/canvas/${e.id}`)}catch(n){if(n?.status===404)t=await Q.post("/shared-links",{canvas_id:e.id,...e.brand_id?{brand_id:e.brand_id}:{}});else throw n}return t},get_canvas_recommended_files:async e=>{re();const{canvas_id:t,...n}=e;return await Q.get(`/canvases/${t}/recommended_files`,{params:n})},get_collaborations:async e=>(re(),await Q.get("/collaborations",{params:$t(e)})),create_collaboration:async e=>(re(),await Q.post("/collaborations",e)),delete_collaboration:async e=>{re();const{collaboration_id:t}=e;return await Q.delete(`/collaborations/${t}`)},get_instance_memberships:async e=>(re(),await Q.get("/instance-memberships",{params:$t(e)})),get_content_distribution_groups:async e=>(re(),await Q.get("/content-distribution-groups",{params:$t(e)}))};function In(e=window){try{if(e.location.protocol==="file:")return window.top;if(e.parent!==e&&(e.parent.location.href.includes("pitcher.com")||e.parent.location.href.includes("localhost")))return In(e.parent)}catch{}return e}const ch=10,ii=["appsdb_get_entries","appsdb_upsert_entry","appsdb_delete_entry"],uh=["appsdb_upsert_entry","crm_create","crm_upsert","crm_describe","crm_layout","crm_smart_query","crm_smart_object_metadata","crm_smart_object_validation_rules","crm_smart_object_layout","crm_smart_upsert_objects","crm_smart_delete_objects"];function fh(e){e&&ri(e)}class dh extends Xo{constructor(t){super(),this.callbacks={},this.options=t??{casing:"snake",logLevel:"off",errorLogger:()=>{},fetchMode:"postmessage"},typeof window<"u"&&(window.addEventListener("message",n=>{rh(n)&&(this.options.logLevel==="debug"&&console.log("message received",n),n.data.type==="PITCHER_RESPONSE"?(nh(n.data.request.id,"event id is required"),this.handleCallbackMessage(n.data.request.id,n.data)):n.data.type==="PITCHER_EVENT"&&this.handleEventMessage(this.options.casing==="camel"?it(n.data.event):n.data.event))}),this.request("subscribe"))}callbacks;options;handleCallbackMessage(t,n){this.callbacks[t]&&(this.callbacks[t].callback(n),this.options.logLevel&&["info","debug"].includes(this.options.logLevel)&&console.log(`It took ${Date.now()-this.callbacks[t].dispatched_at} ms for the event ${this.callbacks[t].type}`),delete this.callbacks[t])}handleEventMessage(t){this.emit("event",t)}request(t,n=null){const r=this.options.fetchMode??"postmessage";return new Promise((i,a)=>{const u=Kp(),l=w=>{if(this.options.logLevel==="debug"&&console.log(`Callback ${u} response:`,w),w.response.status==="ok")i(this.options.casing==="camel"&&!ii.includes(t)?it(w.response.body):w.response.body),t==="get_env"&&fh(w.response.body);else if(w.response.status==="error")this.options.errorLogger&&this.options.errorLogger({type:w.request.type,message:`Pitcher JS API call failure: ${w.request.type}`,js_api_response:JSON.stringify(On(w,3,ch))}),a(this.options.casing==="camel"&&!ii.includes(t)?it(w.response.body):w.response.body);else throw new Error("unsupported response status")},_=uh.includes(t),S=go(_?n:bn(n));if(this.callbacks[u]={dispatched_at:Date.now(),type:t,payload:S??{},callback:l},r==="prefer-online"&&t&&oi[t])oi[t](S).then(w=>{this.callbacks[u]&&(this.callbacks[u].callback({type:Lt.RESPONSE,request:{id:u,type:t},response:{status:Dt.OK,body:w}}),delete this.callbacks[u])}).catch(w=>{this.callbacks[u]&&(this.callbacks[u].callback({type:Lt.RESPONSE,request:{id:u,type:t},response:{status:Dt.ERROR,body:w}}),delete this.callbacks[u])});else{const w=In(window);typeof w<"u"&&w&&w.postMessage({type:"PITCHER_REQUEST",request:{type:t,id:u,body:S}},"*")}})}}function si(e){const t=new dh(e),n=new Xo;return t.on("event",r=>{n.emit(r.type,r.body)}),{API:t,...kp,on:(r,i)=>n.on(r,i),off:(r,i)=>n.off(r,i),enterFullscreen:()=>t.request("enter_fullscreen"),exitFullscreen:()=>t.request("exit_fullscreen"),isFullscreen:()=>t.request("is_fullscreen"),logout:()=>t.request("logout"),quitInstance:()=>t.request("quit_instance"),getRequestTypes:()=>t.request("get_request_types"),broadcast:r=>t.request("broadcast",r),broadcastToWebviews:r=>t.request("broadcast_to_webviews",r),subscribe:()=>t.request("subscribe"),unsubscribe:()=>t.request("unsubscribe")}}function O(){return window.postRobot?window.postRobot:Promise.resolve().then(()=>Yi).then(e=>e.default||e)}const lh="UI_MESSAGE",$={UI_BROADCAST:"ui_broadcast",UI_SELECT_CONTENT:"ui_select_content",UI_SELECT_CANVASES:"ui_select_canvases",UI_OPEN:"ui_open",UI_EMBEDDABLE_READY:"ui_embeddable_ready",UI_TOAST:"ui_toast",UI_CAPTURE_APP_ERROR:"ui_capture_app_error",UI_UPDATE_CANVAS:"ui_update_canvas",UI_PRINT_CANVAS:"ui_print_canvas",UI_OPEN_CANVAS_OVERLAY:"ui_open_canvas_overlay",UI_OPEN_COLLECTION_PLAYER_OVERLAY:"ui_open_collection_player_overlay",UI_SELECT_COLLECTION_PLAYER_CONTENT:"ui_select_collection_player_content",UI_SELECT_AGENDA_CONTENT:"ui_select_agenda_content",UI_UPDATE_LOCATION:"ui_update_location",UI_PRESELECT_SFDC_MEETING_ID:"ui_preselect_sfdc_meeting_id",UI_SET_POSTCALL_STYLE:"ui_set_postcall_style",UI_ENABLE_POSTCALL_SUBMIT:"ui_enable_postcall_submit",UI_DISABLE_POSTCALL_SUBMIT:"ui_disable_postcall_submit",UI_COMPLETE_POSTCALL:"ui_complete_postcall",UI_STOP_MEETING:"ui_stop_meeting",UI_CANCEL_MEETING:"ui_cancel_meeting",UI_RESUME_MEETING:"ui_resume_meeting",UI_PROMPT_PIA:"ui_prompt_pia",UI_CANVAS_NAVIGATE_NEXT_PAGE:"ui_canvas_navigate_next_page",UI_CANVAS_NAVIGATE_PREVIOUS_PAGE:"ui_canvas_navigate_previous_page",UI_CANVAS_NAVIGATE_PAGE:"ui_canvas_navigate_page",UI_APP_LOADED:"ui_app_loaded",UI_APP_RESIZE:"ui_app_resize",UI_CLOSE_CANVAS_SECTION_EXECUTION:"ui_close_canvas_section_execution",UI_CLOSE_CANVAS_DRAWER:"ui_close_canvas_drawer",UI_OPEN_GLOBAL_POPUP:"ui_open_global_popup",UI_CLOSE_GLOBAL_POPUP:"ui_close_global_popup",UI_OPEN_SHARING_SETTINGS:"ui_open_sharing_settings"},Ae={UI_MEETING_CANCELED:"ui_meeting_canceled",UI_CANVAS_UPDATED:"ui_canvas_updated",UI_SECTION_LIST_UPDATED:"ui_section_list_updated",UI_APP_SET_DATA:"ui_app_set_data",UI_APP_UPDATE_DATA:"ui_app_update_data",UI_PROMPT_PIA_RESPONSE_STREAMED:"ui_prompt_pia_response_streamed"},ai=[Ae.UI_APP_SET_DATA,Ae.UI_APP_UPDATE_DATA,Ae.UI_CANVAS_UPDATED];async function _h(e={}){const t=await O();return console.warn("[content.ui.ts]: ui_select_content is deprecated and might get removed in future versions, please use select_content instead."),(await t.send(window.parent,$.UI_SELECT_CONTENT,e)).data}async function ph(e={}){return(await(await O()).send(window.parent,$.UI_SELECT_CONTENT,e)).data}async function hh(e){await(await O()).send(window.parent,$.UI_OPEN,e)}async function gh(e){await(await O()).send(window.parent,$.UI_TOAST,e)}async function mh(e){return(await(await O()).send(window.parent,$.UI_PRESELECT_SFDC_MEETING_ID,e)).data}async function Eh(e={}){return(await(await O()).send(window.parent,$.UI_SELECT_COLLECTION_PLAYER_CONTENT,e)).data}async function wh(e={}){return(await(await O()).send(window.parent,$.UI_SELECT_AGENDA_CONTENT,e)).data}async function Ah(e,t){const n=await O(),r={app_name:e,extra_context:t};return(await n.send(window.parent,$.UI_OPEN_GLOBAL_POPUP,r)).data}async function yh(){await(await O()).send(window.parent,$.UI_CLOSE_GLOBAL_POPUP,{})}const vh=Object.freeze(Object.defineProperty({__proto__:null,closeGlobalPopup:yh,open:hh,openGlobalPopup:Ah,preselectSfdcMeetingId:mh,selectAgendaContent:wh,selectCollectionContent:Eh,selectContent:ph,toast:gh,ui_select_content:_h},Symbol.toStringTag,{value:"Module"}));async function Sh(){await(await O()).send(window.parent,$.UI_EMBEDDABLE_READY)}const Th=Object.freeze(Object.defineProperty({__proto__:null,embeddableReady:Sh},Symbol.toStringTag,{value:"Module"}));async function bh(e){return(await O()).send(In(),$.UI_UPDATE_LOCATION,e)}const Oh=Object.freeze(Object.defineProperty({__proto__:null,updateLocation:bh},Symbol.toStringTag,{value:"Module"}));async function Ph(e){(await O()).send(window.parent,$.UI_CAPTURE_APP_ERROR,e)}const Ih=Object.freeze(Object.defineProperty({__proto__:null,captureAppError:Ph},Symbol.toStringTag,{value:"Module"}));async function Ch(e){return(await O()).send(window.parent,$.UI_UPDATE_CANVAS,e).then(n=>n.data)}async function Nh(e){return(await O()).send(window.parent,$.UI_PRINT_CANVAS,e).then(n=>n.data)}async function Rh(){window.parent.postMessage({type:$.UI_APP_LOADED,body:{}},"*")}async function Lh(e){window.parent.postMessage({type:$.UI_APP_RESIZE,body:e},"*")}async function Dh(){window.parent.postMessage({type:$.UI_CLOSE_CANVAS_SECTION_EXECUTION,body:{}},"*")}async function $h(){window.parent.postMessage({type:$.UI_CLOSE_CANVAS_DRAWER,body:{}},"*")}async function Uh(){(await O()).send(window.parent,$.UI_CANVAS_NAVIGATE_NEXT_PAGE)}async function Mh(){(await O()).send(window.parent,$.UI_CANVAS_NAVIGATE_PREVIOUS_PAGE)}async function xh(e){(await O()).send(window.parent,$.UI_CANVAS_NAVIGATE_PAGE,e)}async function jh(e){await(await O()).send(window.parent,$.UI_OPEN_CANVAS_OVERLAY,e)}async function Fh(e){await(await O()).send(window.parent,$.UI_OPEN_COLLECTION_PLAYER_OVERLAY,e)}async function Wh(e={}){return(await(await O()).send(window.parent,$.UI_SELECT_CANVASES,e)).data}const qh=Object.freeze(Object.defineProperty({__proto__:null,appLoaded:Rh,appResize:Lh,canvasNavigateNextPage:Uh,canvasNavigatePage:xh,canvasNavigatePreviousPage:Mh,closeCanvasDrawer:$h,closeCanvasSectionExecution:Dh,openCanvasOverlay:jh,openCollectionPlayerOverlay:Fh,printCanvas:Nh,selectCanvases:Wh,updateCanvas:Ch},Symbol.toStringTag,{value:"Module"}));async function Gh(e){(await O()).send(window.parent,$.UI_COMPLETE_POSTCALL,e)}async function zh(){(await O()).send(window.parent,$.UI_CANCEL_MEETING)}async function Hh(){(await O()).send(window.parent,$.UI_RESUME_MEETING)}async function Bh(){(await O()).send(window.parent,$.UI_STOP_MEETING)}async function Yh(){(await O()).send(window.parent,$.UI_ENABLE_POSTCALL_SUBMIT)}async function Vh(){(await O()).send(window.parent,$.UI_DISABLE_POSTCALL_SUBMIT)}async function kh(e){(await O()).send(window.parent,$.UI_SET_POSTCALL_STYLE,e)}const Zh=Object.freeze(Object.defineProperty({__proto__:null,cancelMeeting:zh,completePostcall:Gh,disablePostcallSubmit:Vh,enablePostcallSubmit:Yh,resumeMeeting:Hh,setPostcallStyle:kh,stopMeeting:Bh},Symbol.toStringTag,{value:"Module"}));async function Xh(e){return(await(await O()).send(window.parent,$.UI_PROMPT_PIA,e)).data}const Jh=Object.freeze(Object.defineProperty({__proto__:null,promptPia:Xh},Symbol.toStringTag,{value:"Module"}));async function Kh(e){return(await(await O()).send(window.parent,$.UI_OPEN_SHARING_SETTINGS,e)).data}const Qh=Object.freeze(Object.defineProperty({__proto__:null,openSharingSettings:Kh},Symbol.toStringTag,{value:"Module"}));async function eg(e,t){const n=r=>{r.data.type===e&&t(r.data.body)};return window.addEventListener("message",n),()=>window.removeEventListener("message",n)}async function tg(e,t){return(await O()).on(e,i=>t(i.data)).cancel}function qe(e,t){return ai.includes(e)?eg(e,t):tg(e,t)}function ng(e){return qe(Ae.UI_MEETING_CANCELED,e)}function rg(e){return qe(Ae.UI_CANVAS_UPDATED,e)}function og(e){return qe(Ae.UI_SECTION_LIST_UPDATED,e)}function ig(e){return qe(Ae.UI_APP_SET_DATA,e)}function sg(e){return qe(Ae.UI_APP_UPDATE_DATA,e)}async function ag(e){(await O()).send(window.parent,$.UI_BROADCAST,e)}const cg={on:qe,onMeetingCanceled:ng,onCanvasUpdated:rg,onSectionListUpdated:og,onAppSetData:ig,onAppUpdateData:sg,uiBroadcast:ag,...vh,...Th,...Oh,...Ih,...qh,...Zh,...Jh,...Qh},ug="ADMIN_MESSAGE",fg={ENV_CHANGED:"admin_env_changed"},dg={ADMIN_REQUEST:"ADMIN_REQUEST",ADMIN_RESPONSE:"ADMIN_RESPONSE"},Y={CAPTURE_APP_ERROR:"admin_capture_app_error",CREATE_CANVAS:"admin_create_canvas",GET_APP_CONFIG:"admin_get_app_config",GET_CANVAS:"admin_get_canvas",GET_CANVASES:"admin_get_canvases",OPEN_CANVAS_OVERLAY:"admin_open_canvas_overlay",OPEN_COLLECTION_PLAYER_OVERLAY:"admin_open_collection_player_overlay",GET_ENV:"admin_get_env",GET_FILE:"admin_get_file",OPEN:"admin_open_file_overlay",CLOSE:"admin_close_file_overlay",GET_FILES:"admin_get_files",GET_INSTANCE_METADATA_TEMPLATES:"admin_get_instance_metadata_templates",GET_USERS:"admin_get_users",TOAST:"admin_toast",UPDATE_CANVAS:"admin_update_canvas",SELECT_COLLECTION_PLAYER_CONTENT:"admin_select_collection_player_content",SELECT_AGENDA_CONTENT:"admin_select_agenda_content",SELECT_CONTENT:"admin_select_content",SELECT_CANVASES:"admin_select_canvases"};async function lg(e){(await O()).send(window.parent,Y.CAPTURE_APP_ERROR,e)}const _g=Object.freeze(Object.defineProperty({__proto__:null,captureAppError:lg},Symbol.toStringTag,{value:"Module"}));async function pg(){const n=(await(await O()).send(window.parent,Y.GET_ENV)).data;return mn(n,"pitcher.org_config.segment")}const hg=Object.freeze(Object.defineProperty({__proto__:null,getEnv:pg},Symbol.toStringTag,{value:"Module"}));async function gg(e){return(await(await O()).send(window.parent,Y.CREATE_CANVAS,e)).data}async function mg(e){return(await(await O()).send(window.parent,Y.GET_CANVASES,e)).data}async function Eg(e){return(await(await O()).send(window.parent,Y.GET_CANVAS,e)).data}async function wg(e){return(await(await O()).send(window.parent,Y.UPDATE_CANVAS,e)).data}async function Ag(e){await(await O()).send(window.parent,Y.OPEN_CANVAS_OVERLAY,e)}async function yg(e){await(await O()).send(window.parent,Y.OPEN_COLLECTION_PLAYER_OVERLAY,e)}async function vg(e={}){return(await(await O()).send(window.parent,Y.SELECT_CANVASES,e)).data}const Sg=Object.freeze(Object.defineProperty({__proto__:null,createCanvas:gg,getCanvas:Eg,getCanvases:mg,openCanvasOverlay:Ag,openCollectionPlayerOverlay:yg,selectCanvases:vg,updateCanvas:wg},Symbol.toStringTag,{value:"Module"}));async function Tg(e){return(await(await O()).send(window.parent,Y.GET_INSTANCE_METADATA_TEMPLATES,e)).data}const bg=Object.freeze(Object.defineProperty({__proto__:null,getInstanceMetadataTemplates:Tg},Symbol.toStringTag,{value:"Module"}));async function Og(e){return(await(await O()).send(window.parent,Y.GET_APP_CONFIG,e)).data}async function Pg(e){return(await(await O()).send(window.parent,Y.GET_FILE,e)).data}async function Ig(e){return(await(await O()).send(window.parent,Y.GET_FILES,e)).data}async function Cg(e){await(await O()).send(window.parent,Y.OPEN,e)}async function Ng(){await(await O()).send(window.parent,Y.CLOSE)}const Rg=Object.freeze(Object.defineProperty({__proto__:null,close:Ng,getAppConfig:Og,getFile:Pg,getFiles:Ig,open:Cg},Symbol.toStringTag,{value:"Module"}));async function Lg(e={}){return(await(await O()).send(window.parent,Y.SELECT_COLLECTION_PLAYER_CONTENT,e)).data}async function Dg(e={}){return(await(await O()).send(window.parent,Y.SELECT_AGENDA_CONTENT,e)).data}async function $g(e){return(await(await O()).send(window.parent,Y.SELECT_CONTENT,e)).data}const Ug=Object.freeze(Object.defineProperty({__proto__:null,selectAgendaContent:Dg,selectCollectionContent:Lg,selectContent:$g},Symbol.toStringTag,{value:"Module"}));async function Mg(e){return(await(await O()).send(window.parent,Y.GET_USERS,e)).data}const xg=Object.freeze(Object.defineProperty({__proto__:null,getUsers:Mg},Symbol.toStringTag,{value:"Module"}));async function jg(e,t){return(await O()).on(e,i=>t(i.data)).cancel}async function Fg(e){await(await O()).send(window.parent,Y.TOAST,e)}const Wg={on:jg,toast:Fg,..._g,...Ug,...hg,...Sg,...bg,...Rg,...xg},qg="DSR_MESSAGE",Gg={ENV_CHANGED:"dsr_env_changed"},zg={DSR_REQUEST:"DSR_REQUEST",DSR_RESPONSE:"DSR_RESPONSE"},Ge={GET_ENV:"dsr_get_env",GET_FILE:"dsr_get_file",GET_APP_CONFIG:"dsr_get_app_config",CLOSE:"dsr_close",DSR_EMBEDDABLE_READY:"dsr_embeddable_ready"};async function Hg(){const n=(await(await O()).send(window.parent,Ge.GET_ENV)).data;return mn(n,"pitcher.org_config.segment")}const Bg=Object.freeze(Object.defineProperty({__proto__:null,getEnv:Hg},Symbol.toStringTag,{value:"Module"}));async function Yg(){await(await O()).send(window.parent,Ge.DSR_EMBEDDABLE_READY)}const Vg=Object.freeze(Object.defineProperty({__proto__:null,embeddableReady:Yg},Symbol.toStringTag,{value:"Module"}));async function kg(){await(await O()).send(window.parent,Ge.CLOSE)}async function Zg(e){return(await(await O()).send(window.parent,Ge.GET_FILE,e)).data}async function Xg(e){return(await(await O()).send(window.parent,Ge.GET_APP_CONFIG,e??{})).data}const Jg=Object.freeze(Object.defineProperty({__proto__:null,close:kg,getAppConfig:Xg,getFile:Zg},Symbol.toStringTag,{value:"Module"}));async function Kg(e,t){return(await O()).on(e,i=>t(i.data)).cancel}const Qg={on:Kg,...Bg,...Vg,...Jg},em="peer_connectivity_event",tm={CANVAS_PAGE_NEXT:"canvas.navigate.next",CANVAS_PAGE_PREVIOUS:"canvas.navigate.previous",CANVAS_OPEN:"canvas.open",CANVAS_CLOSE:"canvas.close",ROUTE_CHANGE:"route.change",FILE_OPEN:"file.open",FILE_CLOSE:"file.close",BROWSER_FOLDER_OPEN:"browser.folder.open"},ci=1,Cn="*",Ne=new Map;let ze=null,Nn=null;function Rn(){const e=globalThis.crypto;return e?.randomUUID?e.randomUUID():`peer-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`}function ui(e,t){const n=e.metadata??{};return{version:e.version??t?.version??ci,action:e.action,context:e.context??t?.context,data:e.data??t?.data,metadata:{correlationId:n.correlationId??t?.metadata?.correlationId??Rn(),source:n.source??t?.metadata?.source??"web",timestamp:n.timestamp??t?.metadata?.timestamp??Date.now(),extras:{...t?.metadata?.extras??{},...n.extras??{}}}}}function nm(e,t){const n=e||Cn,r=Ne.get(n)??new Set;r.add(t),Ne.set(n,r)}function rm(e,t){const n=Ne.get(e);n&&(n.delete(t),n.size||Ne.delete(e),Ne.size||im())}async function om(){if(ze)return;const e=ye(),t=n=>{try{const r=ui(n,{metadata:{correlationId:Rn(),source:"native",timestamp:Date.now(),extras:{}}});sm(r)}catch(r){console.error("[peer-connectivity] Failed to handle native event:",r)}};e.on(ot.PEER_CONNECTIVITY_EVENT,t),ze=()=>{e.off(ot.PEER_CONNECTIVITY_EVENT,t),ze=null}}function im(){ze&&(ze(),ze=null)}function sm(e){const t=Ne.get(e.action),n=Ne.get(Cn);if(!t&&!n)return;const r=Object.freeze(e);t?.forEach(i=>{try{i(r)}catch(a){console.error(`[peer-connectivity] Handler error for action "${e.action}":`,a)}}),n?.forEach(i=>{try{i(r)}catch(a){console.error("[peer-connectivity] Handler error for wildcard action:",a)}})}async function am(){return Nn||(Nn=ye().getEnv().then(t=>t.mode==="IOS").catch(t=>(console.error("[peer-connectivity] Failed to determine environment support:",t),!1))),Nn}function fi(e){return Array.isArray(e)?e:[e]}function cm(e,t){return fi(e).forEach(n=>{nm(n,t)}),om().catch(n=>{console.error("[peer-connectivity] Failed to register native listener:",n)}),()=>{fi(e).forEach(n=>{rm(n,t)})}}async function um(e,t){if(!e?.action){console.warn("[peer-connectivity] Attempted to send an event without action");return}if(t?.isFeatureEnabled===!1||!await am())return;const r=ye(),i=ui(e,{metadata:{correlationId:Rn(),source:"web",timestamp:Date.now(),extras:{}}});try{await r.broadcast({type:ot.PEER_CONNECTIVITY_EVENT,body:i})}catch(a){console.error("[peer-connectivity] Failed to send event:",a)}}A.highLevelApi=void 0;let Ln;function ye(e){return(!A.highLevelApi||e!==void 0&&!rl(e,Ln))&&(A.highLevelApi=si(e),Ln=e===void 0?void 0:{...e}),A.highLevelApi}function fm(e){return si({...Ln,...e})}function Dn(e){return Object.entries(e).forEach(([t,n])=>{const r=bo(t);r&&!e[r]&&(e[r]=n)}),e}const dm=Dn(cg),lm=Dn(Wg),_m=Dn(Qg);function $n(){return dm}function di(){return lm}function li(){return _m}function pm(){if(typeof window>"u")throw new Error("getAvailableApis: window is not defined");const e=window.parent.jsApiLocation;return e==="ui"?["ui","impact"]:[e??"impact"]}function hm(e){if(typeof window>"u")throw new Error("useApi: window is not defined");switch(window.parent.jsApiLocation){case"ui":return{...ye(),...$n(),ui:$n(),impact:ye()};case"admin":return di();case"dsr":return{...li(),broadcast:ye().broadcast};case"impact":return ye(e);default:return ye(e)}}window.postRobot=Zn,A.ADMIN_API_METHOD_TYPES=Y,A.ADMIN_API_TYPES=dg,A.ADMIN_MESSAGE=ug,A.ADMIN_MESSAGE_TYPES=fg,A.DEFAULT_PEER_CONNECTIVITY_VERSION=ci,A.DSR_API_METHOD_TYPES=Ge,A.DSR_API_TYPES=zg,A.DSR_MESSAGE=qg,A.DSR_MESSAGE_TYPES=Gg,A.PEER_CONNECTIVITY_EVENT=em,A.PEER_CONNECTIVITY_HANDLER_MATCH_ALL=Cn,A.PITCHER_EVENT=eh,A.PeerConnectivityActions=tm,A.PitcherBroadcastedEventName=Jo,A.PitcherEventName=ot,A.PitcherExternalEventName=Ko,A.PitcherMessageType=Lt,A.PitcherResponseStatus=Dt,A.UI_API_METHOD_TYPES=$,A.UI_MESSAGE=lh,A.UI_MESSAGE_TYPES=Ae,A.UI_NATIVE_MESSAGE_TYPES=ai,A.WEB_MODE=Uo,A.createScopedPitcherApi=fm,A.getAvailableApis=pm,A.isNativeHost=Mo,A.platformTypeForMode=Jl,A.registerPeerConnectivityHandler=cm,A.sendPeerConnectivityEvent=um,A.useAdmin=di,A.useApi=hm,A.useDsr=li,A.usePitcherApi=ye,A.useUi=$n,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})}));
46
46
  //# sourceMappingURL=js-api.umd.min.js.map