@pitcher/js-api 1.29.0 → 1.30.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.
- package/js-api.esm.js +408 -39
- package/js-api.esm.js.map +1 -1
- package/js-api.umd.min.js +32 -11
- package/js-api.umd.min.js.map +1 -1
- package/lib/ai-tasks/__tests__/weekly-focus.spec.d.ts +1 -0
- package/lib/ai-tasks/weekly-focus.d.ts +241 -0
- package/lib/apps/browser/appTypes.d.ts +28 -0
- package/lib/apps/browser/stores/api.d.ts +6 -1
- package/lib/apps/browser/stores/app.d.ts +5 -0
- package/lib/apps/browser/stores/app.selectionPruneScope.test.d.ts +1 -0
- package/lib/apps/browser/stores/upload.d.ts +26 -1
- package/lib/apps/browser/stores/upload.types.d.ts +9 -0
- package/lib/apps/browser/util/lifecycle.d.ts +57 -0
- package/lib/apps/browser/util/lifecycle.test.d.ts +1 -0
- package/lib/apps/canvas-builder/components/ui/DynamicContent/useDynamicContent.d.ts +2 -0
- package/lib/apps/canvas-builder/components/ui/Multimedia/Multimedia.ldAsset.spec.d.ts +1 -0
- package/lib/apps/canvas-builder/composables/useCanvas.d.ts +203 -1
- package/lib/apps/canvas-builder/composables/useCanvas.saveEcho.spec.d.ts +1 -0
- package/lib/apps/canvas-builder/composables/useCanvasBlocks.d.ts +36 -0
- package/lib/apps/canvas-builder/composables/useCanvasExit.d.ts +1 -0
- package/lib/apps/canvas-builder/composables/useCanvasHistory.d.ts +36 -0
- package/lib/apps/canvas-builder/composables/useCanvasTheme.d.ts +2 -0
- package/lib/apps/canvas-builder/composables/useContentSelector.d.ts +8 -1
- package/lib/apps/canvas-builder/composables/useInstalledEmbeddables.d.ts +1 -1
- package/lib/apps/canvas-builder/composables/useNavigatorDrawer.d.ts +2 -0
- package/lib/apps/canvas-builder/composables/usePopupApps.d.ts +2 -0
- package/lib/apps/canvas-builder/types/canvas.d.ts +53 -3
- package/lib/apps/canvas-builder/util/completionWizard.util.d.ts +107 -0
- package/lib/apps/canvas-builder/util/completionWizard.util.test.d.ts +1 -0
- package/lib/apps/canvas-builder/util/fullscreenMode.util.d.ts +7 -0
- package/lib/apps/canvas-builder/util/fullscreenMode.util.test.d.ts +1 -0
- package/lib/apps/canvas-builder/util/lazySections.util.d.ts +35 -0
- package/lib/apps/canvas-builder/util/lazySections.util.test.d.ts +1 -0
- package/lib/apps/collection-player/composables/collection-navigation.util.d.ts +27 -0
- package/lib/apps/collection-player/composables/collection-navigation.util.spec.d.ts +1 -0
- package/lib/apps/collection-player/stores/app.store.d.ts +3 -0
- package/lib/apps/content-selector/components/Assets.uploaderRefresh.spec.d.ts +1 -0
- package/lib/apps/content-selector/stores/app.d.ts +1 -1
- package/lib/components/CFileViewer/pdf/CFileViewer.pdf.annotations.use.d.ts +5 -1
- package/lib/components/CFileViewer/pdf/CFileViewer.pdf.formFields.use.d.ts +8 -0
- package/lib/components/CFileViewer/pdf/CFileViewer.pdf.link.use.d.ts +1 -1
- package/lib/components/CFileViewer/pdf/CFileViewer.pdf.overlayItems.use.d.ts +1 -1
- package/lib/components/CFileViewer/pdf/CFileViewer.pdf.use.d.ts +4 -9
- package/lib/components/CFileViewer/pdf/CFileViewer.pdf.util.d.ts +1 -1
- package/lib/components/CFileViewer/pdf/CFileViewerFullscreen.pdf.use.d.ts +1 -1
- package/lib/components/CFileViewer/pdf/__tests__/CFileViewer.pdf.annotations.text.test.d.ts +1 -0
- package/lib/components/savedCanvases/CSavedCanvasesManagement.use.d.ts +1 -0
- package/lib/composables/useCourseOnlyApps.d.ts +1 -1
- package/lib/composables/usePdfInterpolation.d.ts +2 -2
- package/lib/composables/useWindowEvents.d.ts +1 -1
- package/lib/constants/cdp.const.d.ts +1 -0
- package/lib/constants/translationLanguages.const.d.ts +72 -0
- package/lib/main.lib.d.ts +2 -0
- package/lib/sdk/api/HighLevelApi.d.ts +17 -6
- package/lib/sdk/api/modules/ai.d.ts +43 -1
- package/lib/sdk/api/modules/ai.spec.d.ts +1 -0
- package/lib/sdk/api/modules/canvas.d.ts +8 -0
- package/lib/sdk/api/modules/ui/types.ui.d.ts +7 -0
- package/lib/sdk/main.d.ts +8 -0
- package/lib/sdk/payload.types.d.ts +104 -0
- package/lib/types/ai-tasks.const.d.ts +39 -1
- package/lib/types/call.d.ts +14 -0
- package/lib/types/launchDarkly.types.d.ts +1 -3
- package/lib/types/organizationSettings.types.d.ts +10 -0
- package/lib/util/user.d.ts +18 -0
- package/lib/util/user.test.d.ts +1 -0
- package/package.json +1 -1
- package/types/openapi/models/DeletedEnvironment.d.ts +0 -1
- package/types/openapi/models/Environment.d.ts +0 -1
- package/types/openapi/models/EnvironmentRequest.d.ts +0 -1
- package/types/openapi/models/File.d.ts +2 -0
- package/types/openapi/models/FileRetrieve.d.ts +2 -0
- package/types/openapi/models/PatchedEnvironmentRequest.d.ts +0 -1
package/js-api.umd.min.js
CHANGED
|
@@ -1,25 +1,46 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
`;function l(r){return r===void 0&&(r=window),r.location.protocol}function p(r){if(r===void 0&&(r=window),r.mockDomain){var c=r.mockDomain.split("//")[0];if(c)return c}return l(r)}function b(r){return r===void 0&&(r=window),p(r)==="about:"}function T(r){if(r===void 0&&(r=window),r)try{if(r.parent&&r.parent!==r)return r.parent}catch{}}function N(r){if(r===void 0&&(r=window),r&&!T(r))try{return r.opener}catch{}}function L(r){try{return!0}catch{}return!1}function $(r){r===void 0&&(r=window);var c=r.location;if(!c)throw new Error("Can not read window location");var s=l(r);if(!s)throw new Error("Can not read window protocol");if(s==="file:")return"file://";if(s==="about:"){var u=T(r);return u&&L()?$(u):"about://"}var d=c.host;if(!d)throw new Error("Can not read window host");return s+"//"+d}function P(r){r===void 0&&(r=window);var c=$(r);return c&&r.mockDomain&&r.mockDomain.indexOf("mock:")===0?r.mockDomain:c}function z(r){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(b(c)&&L())return!0}catch{}try{if((function(u){return u===void 0&&(u=window),p(u)==="mock:"})(c)&&L())return!0}catch{}try{if($(c)===$(window))return!0}catch{}return!1})(r))return!1;try{if(r===window||b(r)&&L()||P(window)===P(r))return!0}catch{}return!1}function H(r){if(!z(r))throw new Error("Expected window to be same domain");return r}function B(r,c){if(!r||!c)return!1;var s=T(c);return s?s===r:(function(u){var d=[];try{for(;u.parent!==u;)d.push(u.parent),u=u.parent}catch{}return d})(c).indexOf(r)!==-1}function Q(r){var c=[],s;try{s=r.frames}catch{s=r}var u;try{u=s.length}catch{}if(u===0)return c;if(u){for(var d=0;d<u;d++){var _=void 0;try{_=s[d]}catch{continue}c.push(_)}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=[],ze=[];function ee(r,c){c===void 0&&(c=!0);try{if(r===window)return!1}catch{return!0}try{if(!r)return!0}catch{return!0}try{if(r.closed)return!0}catch(d){return!d||d.message!==f}if(c&&z(r))try{if(r.mockclosed)return!0}catch{}try{if(!r.parent||!r.top)return!0}catch{}var s=(function(d,_){for(var h=0;h<d.length;h++)try{if(d[h]===_)return h}catch{}return-1})(ve,r);if(s!==-1){var u=ze[s];if(u&&(function(d){if(!d.contentWindow||!d.parentNode)return!0;var _=d.ownerDocument;if(_&&_.documentElement&&!_.documentElement.contains(d)){for(var h=d;h.parentNode&&h.parentNode!==h;)h=h.parentNode;if(!h.host||!_.documentElement.contains(h.host))return!0}return!1})(u))return!0}return!1}function Qo(r){return r===void 0&&(r=window),N(r=r||window)||T(r)||void 0}function He(r,c){if(typeof r=="string"){if(typeof c=="string")return r==="*"||c===r;if(a(c)||Array.isArray(c))return!1}return a(r)?a(c)?r.toString()===c.toString():!Array.isArray(c)&&!!c.match(r):!!Array.isArray(r)&&(Array.isArray(c)?JSON.stringify(r)===JSON.stringify(c):!a(c)&&r.some((function(s){return He(s,c)})))}function Lt(r){try{if(r===window)return!0}catch(c){if(c&&c.message===f)return!0}try{if({}.toString.call(r)==="[object Window]")return!0}catch(c){if(c&&c.message===f)return!0}try{if(window.Window&&r instanceof window.Window)return!0}catch(c){if(c&&c.message===f)return!0}try{if(r&&r.self===r)return!0}catch(c){if(c&&c.message===f)return!0}try{if(r&&r.parent===r)return!0}catch(c){if(c&&c.message===f)return!0}try{if(r&&r.top===r)return!0}catch(c){if(c&&c.message===f)return!0}try{if(r&&r.__cross_domain_utils_window_check__==="__unlikely_value__")return!1}catch{return!0}try{if("postMessage"in r&&"self"in r&&"location"in r)return!0}catch{}return!1}function Xo(r){if(z(r))return H(r).frameElement;for(var c=0,s=document.querySelectorAll("iframe");c<s.length;c++){var u=s[c];if(u&&u.contentWindow&&u.contentWindow===r)return u}}function Tg(r){if((function(s){return s===void 0&&(s=window),!!T(s)})(r)){var c=Xo(r);if(c&&c.parentElement){c.parentElement.removeChild(c);return}}try{r.close()}catch{}}function Re(r){try{if(!r)return!1;if(typeof Promise<"u"&&r instanceof Promise)return!0;if(typeof window<"u"&&typeof window.Window=="function"&&r instanceof window.Window||typeof window<"u"&&typeof window.constructor=="function"&&r instanceof window.constructor)return!1;var c={}.toString;if(c){var s=c.call(r);if(s==="[object Window]"||s==="[object global]"||s==="[object DOMWindow]")return!1}if(typeof r.then=="function")return!0}catch{return!1}return!1}var Ko=[],st=[],On=0,at;function Jo(){if(!On&&at){var r=at;at=null,r.resolve()}}function Pn(){On+=1}function ct(){On-=1,Jo()}var M=(function(){function r(s){var u=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,_,h=!1,E=!1,m=!1;Pn();try{s((function(g){m?u.resolve(g):(h=!0,d=g)}),(function(g){m?u.reject(g):(E=!0,_=g)}))}catch(g){ct(),this.reject(g);return}ct(),m=!0,h?this.resolve(d):E&&this.reject(_)}}var c=r.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 u=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(){u.errorHandled||(function(_,h){if(Ko.indexOf(_)===-1){Ko.push(_),setTimeout((function(){throw _}),1);for(var E=0;E<st.length;E++)st[E](_,h)}})(s,u)}),1),this.dispatch(),this},c.asyncReject=function(s){return this.errorHandled=!0,this.reject(s),this},c.dispatch=function(){var s=this.resolved,u=this.rejected,d=this.handlers;if(!this.dispatching&&(s||u)){this.dispatching=!0,Pn();for(var _=function(S,R){return S.then((function(I){R.resolve(I)}),(function(I){R.reject(I)}))},h=0;h<d.length;h++){var E=d[h],m=E.onSuccess,g=E.onError,y=E.promise,w=void 0;if(s)try{w=m?m(this.value):this.value}catch(S){y.reject(S);continue}else if(u){if(!g){y.reject(this.error);continue}try{w=g(this.error)}catch(S){y.reject(S);continue}}if(w instanceof r&&(w.resolved||w.rejected)){var A=w;A.resolved?y.resolve(A.value):y.reject(A.error),A.errorHandled=!0}else Re(w)?w instanceof r&&(w.resolved||w.rejected)?w.resolved?y.resolve(w.value):y.reject(w.error):_(w,y):y.resolve(w)}d.length=0,this.dispatching=!1,ct()}},c.then=function(s,u){if(s&&typeof s!="function"&&!s.call)throw new Error("Promise.then expected a function for success handler");if(u&&typeof u!="function"&&!u.call)throw new Error("Promise.then expected a function for error handler");var d=new r;return this.handlers.push({promise:d,onSuccess:s,onError:u}),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(u){return r.try(s).then((function(){return u}))}),(function(u){return r.try(s).then((function(){throw u}))}))},c.timeout=function(s,u){var d=this;if(this.resolved||this.rejected)return this;var _=setTimeout((function(){d.resolved||d.rejected||d.reject(u||new Error("Promise timed out after "+s+"ms"))}),s);return this.then((function(h){return clearTimeout(_),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},r.resolve=function(s){return s instanceof r?s:Re(s)?new r((function(u,d){return s.then(u,d)})):new r().resolve(s)},r.reject=function(s){return new r().reject(s)},r.asyncReject=function(s){return new r().asyncReject(s)},r.all=function(s){var u=new r,d=s.length,_=[].slice();if(!d)return u.resolve(_),u;for(var h=function(g,y,w){return y.then((function(A){_[g]=A,(d-=1)==0&&u.resolve(_)}),(function(A){w.reject(A)}))},E=0;E<s.length;E++){var m=s[E];if(m instanceof r){if(m.resolved){_[E]=m.value,d-=1;continue}}else if(!Re(m)){_[E]=m,d-=1;continue}h(E,r.resolve(m),u)}return d===0&&u.resolve(_),u},r.hash=function(s){var u={},d=[],_=function(E){if(s.hasOwnProperty(E)){var m=s[E];Re(m)?d.push(m.then((function(g){u[E]=g}))):u[E]=m}};for(var h in s)_(h);return r.all(d).then((function(){return u}))},r.map=function(s,u){return r.all(s.map(u))},r.onPossiblyUnhandledException=function(s){return(function(u){return st.push(u),{cancel:function(){st.splice(st.indexOf(u),1)}}})(s)},r.try=function(s,u,d){if(s&&typeof s!="function"&&!s.call)throw new Error("Promise.try expected a function");var _;Pn();try{_=s.apply(u,d||[])}catch(h){return ct(),r.reject(h)}return ct(),r.resolve(_)},r.delay=function(s){return new r((function(u){setTimeout(u,s)}))},r.isPromise=function(s){return!!(s&&s instanceof r)||Re(s)},r.flush=function(){return(function(s){var u=at=at||new s;return Jo(),u})(r)},r})();function Dt(r,c){for(var s=0;s<r.length;s++)try{if(r[s]===c)return s}catch{}return-1}var In=(function(){function r(){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,u={};return Object.freeze(u),s.set(u,"__testvalue__"),s.get(u)==="__testvalue__"}catch{return!1}})())try{this.weakmap=new WeakMap}catch{}this.keys=[],this.values=[]}var c=r.prototype;return c._cleanupClosedWindows=function(){for(var s=this.weakmap,u=this.keys,d=0;d<u.length;d++){var _=u[d];if(Lt(_)&&ee(_)){if(s)try{s.delete(_)}catch{}u.splice(d,1),this.values.splice(d,1),d-=1}}},c.isSafeToReadWrite=function(s){return!Lt(s)},c.set=function(s,u){if(!s)throw new Error("WeakMap expected key");var d=this.weakmap;if(d)try{d.set(s,u)}catch{delete this.weakmap}if(this.isSafeToReadWrite(s))try{var _=this.name,h=s[_];h&&h[0]===s?h[1]=u:Object.defineProperty(s,_,{value:[s,u],writable:!0});return}catch{}this._cleanupClosedWindows();var E=this.keys,m=this.values,g=Dt(E,s);g===-1?(E.push(s),m.push(u)):m[g]=u},c.get=function(s){if(!s)throw new Error("WeakMap expected key");var u=this.weakmap;if(u)try{if(u.has(s))return u.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 _=Dt(this.keys,s);if(_!==-1)return this.values[_]},c.delete=function(s){if(!s)throw new Error("WeakMap expected key");var u=this.weakmap;if(u)try{u.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 _=this.keys,h=Dt(_,s);h!==-1&&(_.splice(h,1),this.values.splice(h,1))},c.has=function(s){if(!s)throw new Error("WeakMap expected key");var u=this.weakmap;if(u)try{if(u.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(),Dt(this.keys,s)!==-1},c.getOrSet=function(s,u){if(this.has(s))return this.get(s);var d=u();return this.set(s,d),d},r})();function ko(r){return r.name||r.__name__||r.displayName||"anonymous"}function ei(r,c){try{delete r.name,r.name=c}catch{}return r.__name__=r.displayName=c,r}function he(){var r="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,(function(){return r.charAt(Math.floor(Math.random()*r.length))}))+"_"+(function(c){if(typeof btoa=="function")return btoa(encodeURIComponent(c).replace(/%([0-9A-F]{2})/g,(function(s,u){return String.fromCharCode(parseInt(u,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 Ut;function ti(r){try{return JSON.stringify([].slice.call(r),(function(c,s){return typeof s=="function"?"memoize["+(function(u){if(Ut=Ut||new In,u==null||typeof u!="object"&&typeof u!="function")throw new Error("Invalid object");var d=Ut.get(u);return d||(d=typeof u+":"+he(),Ut.set(u,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 bg(){return{}}var ut=0,ni=0;function ft(r,c){c===void 0&&(c={});var s=c.thisNamespace,u=s!==void 0&&s,d=c.time,_,h,E=ut;ut+=1;var m=function(){for(var g=arguments.length,y=new Array(g),w=0;w<g;w++)y[w]=arguments[w];E<ni&&(_=null,h=null,E=ut,ut+=1);var A;A=u?(h=h||new In).getOrSet(this,bg):_=_||{};var S;try{S=ti(y)}catch{return r.apply(this,arguments)}var R=A[S];if(R&&d&&Date.now()-R.time<d&&(delete A[S],R=null),R)return R.value;var I=Date.now(),C=r.apply(this,arguments);return A[S]={time:I,value:C},C};return m.reset=function(){_=null,h=null},ei(m,(c.name||ko(r))+"::memoized")}ft.clear=function(){ni=ut};function Og(r){var c={};function s(){for(var u=arguments,d=this,_=arguments.length,h=new Array(_),E=0;E<_;E++)h[E]=arguments[E];var m=ti(h);return c.hasOwnProperty(m)||(c[m]=M.try((function(){return r.apply(d,u)})).finally((function(){delete c[m]}))),c[m]}return s.reset=function(){c={}},ei(s,ko(r)+"::promiseMemoized")}function Ne(){}function dt(r,c){if(c===void 0&&(c=1),c>=3)return"stringifyError stack overflow";try{if(!r)return"<unknown error: "+{}.toString.call(r)+">";if(typeof r=="string")return r;if(r instanceof Error){var s=r&&r.stack,u=r&&r.message;if(s&&u)return s.indexOf(u)!==-1?s:u+`
|
|
3
|
-
`+s;if(s)return s;if(
|
|
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+`
|
|
4
4
|
|
|
5
|
-
`+d.stack,d},ie.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},ie.regex=function(
|
|
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
|
|
6
6
|
|
|
7
|
-
`+
|
|
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:
|
|
8
8
|
|
|
9
|
-
`+
|
|
9
|
+
`+T.map((function(b,L){return L+". "+lt(b)})).join(`
|
|
10
10
|
|
|
11
|
-
`))})),h.flush.then((function(){delete h.flush}))})).then(
|
|
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()+`
|
|
12
12
|
|
|
13
|
-
`+
|
|
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()+`
|
|
14
14
|
|
|
15
|
-
`+
|
|
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()+`
|
|
16
16
|
|
|
17
|
-
`+dt(U))}))}))}))};function xg(r,c,s){return gi(r,c,s,{on:De,send:ye})}function Fg(r,c,s){return mi(r,c,s,{send:ye})}function Wg(r){return new se({send:ye,win:r})}function qg(r){return se.toProxyWindow(r,{send:ye})}function Si(){_t().initialized||(_t().initialized=!0,c=(r={on:De,send:ye}).on,s=r.send,(u=_t()).receiveMessage=u.receiveMessage||function(d){return yi(d,{on:c,send:s})},(function(d){var _=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 y=g.on,w=g.send;M.try((function(){var A=m.source||m.sourceElement,S=m.origin||m.originalEvent&&m.originalEvent.origin,R=m.data;if(S==="null"&&(S="file://"),A){if(!S)throw new Error("Post message did not have origin domain");yi({source:A,origin:S,data:R},{on:y,send:w})}}))})(E,{on:_,send:h})}))}))})({on:De,send:ye}),(function(d){var _=d.on,h=d.send;X("builtinListeners").getOrSet("helloListener",(function(){var E=_("postrobot_hello",{domain:"*"},(function(g){return ui(g.source,{domain:g.origin}),{instanceID:ci()}})),m=Qo();return m&&Rn(m,{send:h}).catch((function(g){})),E}))})({on:De,send:ye}));var r,c,s,u}function Gg(){(function(){for(var c=X("responseListeners"),s=0,u=c.keys();s<u.length;s++){var d=u[s],_=c.get(d);_&&(_.cancelled=!0),c.del(d)}})(),(r=X().get("postMessageListener"))&&r.cancel();var r;delete window.__post_robot_10_0_46__}var zg=!0;function Hg(r){for(var c=0,s=te("requestPromises").get(r,[]);c<s.length;c++)s[c].reject(new Error("Window "+(ee(r)?"closed":"cleaned up")+" before response")).catch(Ne)}Si()}])}))})(ht)),ht.exports}var xn;function Pi(){return xn||(xn=1,(function(e){e.exports=Oi(),e.exports.default=e.exports})(jt)),jt.exports}var Fn=Pi();const Wn=Ti(Fn),Ii=Be({__proto__:null,default:Wn},[Fn]);var qn=typeof global=="object"&&global&&global.Object===Object&&global,Ci=typeof self=="object"&&self&&self.Object===Object&&self,_e=qn||Ci||Function("return this")(),ae=_e.Symbol,Gn=Object.prototype,Ri=Gn.hasOwnProperty,Ni=Gn.toString,Ve=ae?ae.toStringTag:void 0;function Li(e){var t=Ri.call(e,Ve),n=e[Ve];try{e[Ve]=void 0;var o=!0}catch{}var i=Ni.call(e);return o&&(t?e[Ve]=n:delete e[Ve]),i}var Di=Object.prototype,Ui=Di.toString;function $i(e){return Ui.call(e)}var Mi="[object Null]",ji="[object Undefined]",zn=ae?ae.toStringTag:void 0;function Se(e){return e==null?e===void 0?ji:Mi:zn&&zn in Object(e)?Li(e):$i(e)}function pe(e){return e!=null&&typeof e=="object"}var xi="[object Symbol]";function xt(e){return typeof e=="symbol"||pe(e)&&Se(e)==xi}function Ft(e,t){for(var n=-1,o=e==null?0:e.length,i=Array(o);++n<o;)i[n]=t(e[n],n,e);return i}var ne=Array.isArray,Hn=ae?ae.prototype:void 0,Bn=Hn?Hn.toString:void 0;function Vn(e){if(typeof e=="string")return e;if(ne(e))return Ft(e,Vn)+"";if(xt(e))return Bn?Bn.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 Wt(e){return e}var Fi="[object AsyncFunction]",Wi="[object Function]",qi="[object GeneratorFunction]",Gi="[object Proxy]";function qt(e){if(!ue(e))return!1;var t=Se(e);return t==Wi||t==qi||t==Fi||t==Gi}var Gt=_e["__core-js_shared__"],Yn=(function(){var e=/[^.]+$/.exec(Gt&&Gt.keys&&Gt.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function zi(e){return!!Yn&&Yn in e}var Hi=Function.prototype,Bi=Hi.toString;function Te(e){if(e!=null){try{return Bi.call(e)}catch{}try{return e+""}catch{}}return""}var Vi=/[\\^$.*+?()[\]{}|]/g,Yi=/^\[object .+?Constructor\]$/,Zi=Function.prototype,Qi=Object.prototype,Xi=Zi.toString,Ki=Qi.hasOwnProperty,Ji=RegExp("^"+Xi.call(Ki).replace(Vi,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ki(e){if(!ue(e)||zi(e))return!1;var t=qt(e)?Ji:Yi;return t.test(Te(e))}function es(e,t){return e?.[t]}function be(e,t){var n=es(e,t);return ki(n)?n:void 0}var zt=be(_e,"WeakMap"),Zn=Object.create,ts=(function(){function e(){}return function(t){if(!ue(t))return{};if(Zn)return Zn(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}})();function ns(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 Qn(e,t){var n=-1,o=e.length;for(t||(t=Array(o));++n<o;)t[n]=e[n];return t}var rs=800,os=16,is=Date.now;function ss(e){var t=0,n=0;return function(){var o=is(),i=os-(o-n);if(n=o,i>0){if(++t>=rs)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function as(e){return function(){return e}}var gt=(function(){try{var e=be(Object,"defineProperty");return e({},"",{}),e}catch{}})(),cs=gt?function(e,t){return gt(e,"toString",{configurable:!0,enumerable:!1,value:as(t),writable:!0})}:Wt,Xn=ss(cs);function us(e,t){for(var n=-1,o=e==null?0:e.length;++n<o&&t(e[n],n,e)!==!1;);return e}var fs=9007199254740991,ds=/^(?:0|[1-9]\d*)$/;function mt(e,t){var n=typeof e;return t=t??fs,!!t&&(n=="number"||n!="symbol"&&ds.test(e))&&e>-1&&e%1==0&&e<t}function Ht(e,t,n){t=="__proto__"&>?gt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Ye(e,t){return e===t||e!==e&&t!==t}var ls=Object.prototype,_s=ls.hasOwnProperty;function Bt(e,t,n){var o=e[t];(!(_s.call(e,t)&&Ye(o,n))||n===void 0&&!(t in e))&&Ht(e,t,n)}function Ue(e,t,n,o){var i=!n;n||(n={});for(var a=-1,f=t.length;++a<f;){var l=t[a],p=void 0;p===void 0&&(p=e[l]),i?Ht(n,l,p):Bt(n,l,p)}return n}var Kn=Math.max;function Jn(e,t,n){return t=Kn(t===void 0?e.length-1:t,0),function(){for(var o=arguments,i=-1,a=Kn(o.length-t,0),f=Array(a);++i<a;)f[i]=o[t+i];i=-1;for(var l=Array(t+1);++i<t;)l[i]=o[i];return l[t]=n(f),ns(e,this,l)}}function ps(e,t){return Xn(Jn(e,t,Wt),e+"")}var hs=9007199254740991;function Vt(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=hs}function Et(e){return e!=null&&Vt(e.length)&&!qt(e)}function gs(e,t,n){if(!ue(n))return!1;var o=typeof t;return(o=="number"?Et(n)&&mt(t,n.length):o=="string"&&t in n)?Ye(n[t],e):!1}function ms(e){return ps(function(t,n){var o=-1,i=n.length,a=i>1?n[i-1]:void 0,f=i>2?n[2]:void 0;for(a=e.length>3&&typeof a=="function"?(i--,a):void 0,f&&gs(n[0],n[1],f)&&(a=i<3?void 0:a,i=1),t=Object(t);++o<i;){var l=n[o];l&&e(t,l,o,a)}return t})}var Es=Object.prototype;function Yt(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Es;return e===n}function ws(e,t){for(var n=-1,o=Array(e);++n<e;)o[n]=t(n);return o}var As="[object Arguments]";function kn(e){return pe(e)&&Se(e)==As}var er=Object.prototype,vs=er.hasOwnProperty,ys=er.propertyIsEnumerable,Ze=kn((function(){return arguments})())?kn:function(e){return pe(e)&&vs.call(e,"callee")&&!ys.call(e,"callee")};function Ss(){return!1}var tr=typeof v=="object"&&v&&!v.nodeType&&v,nr=tr&&typeof module=="object"&&module&&!module.nodeType&&module,Ts=nr&&nr.exports===tr,rr=Ts?_e.Buffer:void 0,bs=rr?rr.isBuffer:void 0,Qe=bs||Ss,Os="[object Arguments]",Ps="[object Array]",Is="[object Boolean]",Cs="[object Date]",Rs="[object Error]",Ns="[object Function]",Ls="[object Map]",Ds="[object Number]",Us="[object Object]",$s="[object RegExp]",Ms="[object Set]",js="[object String]",xs="[object WeakMap]",Fs="[object ArrayBuffer]",Ws="[object DataView]",qs="[object Float32Array]",Gs="[object Float64Array]",zs="[object Int8Array]",Hs="[object Int16Array]",Bs="[object Int32Array]",Vs="[object Uint8Array]",Ys="[object Uint8ClampedArray]",Zs="[object Uint16Array]",Qs="[object Uint32Array]",W={};W[qs]=W[Gs]=W[zs]=W[Hs]=W[Bs]=W[Vs]=W[Ys]=W[Zs]=W[Qs]=!0,W[Os]=W[Ps]=W[Fs]=W[Is]=W[Ws]=W[Cs]=W[Rs]=W[Ns]=W[Ls]=W[Ds]=W[Us]=W[$s]=W[Ms]=W[js]=W[xs]=!1;function Xs(e){return pe(e)&&Vt(e.length)&&!!W[Se(e)]}function Zt(e){return function(t){return e(t)}}var or=typeof v=="object"&&v&&!v.nodeType&&v,Xe=or&&typeof module=="object"&&module&&!module.nodeType&&module,Ks=Xe&&Xe.exports===or,Qt=Ks&&qn.process,$e=(function(){try{var e=Xe&&Xe.require&&Xe.require("util").types;return e||Qt&&Qt.binding&&Qt.binding("util")}catch{}})(),ir=$e&&$e.isTypedArray,Xt=ir?Zt(ir):Xs,Js=Object.prototype,ks=Js.hasOwnProperty;function sr(e,t){var n=ne(e),o=!n&&Ze(e),i=!n&&!o&&Qe(e),a=!n&&!o&&!i&&Xt(e),f=n||o||i||a,l=f?ws(e.length,String):[],p=l.length;for(var b in e)(t||ks.call(e,b))&&!(f&&(b=="length"||i&&(b=="offset"||b=="parent")||a&&(b=="buffer"||b=="byteLength"||b=="byteOffset")||mt(b,p)))&&l.push(b);return l}function ar(e,t){return function(n){return e(t(n))}}var ea=ar(Object.keys,Object),ta=Object.prototype,na=ta.hasOwnProperty;function ra(e){if(!Yt(e))return ea(e);var t=[];for(var n in Object(e))na.call(e,n)&&n!="constructor"&&t.push(n);return t}function wt(e){return Et(e)?sr(e):ra(e)}function oa(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var ia=Object.prototype,sa=ia.hasOwnProperty;function aa(e){if(!ue(e))return oa(e);var t=Yt(e),n=[];for(var o in e)o=="constructor"&&(t||!sa.call(e,o))||n.push(o);return n}function Ke(e){return Et(e)?sr(e,!0):aa(e)}var ca=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ua=/^\w*$/;function Kt(e,t){if(ne(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||xt(e)?!0:ua.test(e)||!ca.test(e)||t!=null&&e in Object(t)}var Je=be(Object,"create");function fa(){this.__data__=Je?Je(null):{},this.size=0}function da(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var la="__lodash_hash_undefined__",_a=Object.prototype,pa=_a.hasOwnProperty;function ha(e){var t=this.__data__;if(Je){var n=t[e];return n===la?void 0:n}return pa.call(t,e)?t[e]:void 0}var ga=Object.prototype,ma=ga.hasOwnProperty;function Ea(e){var t=this.__data__;return Je?t[e]!==void 0:ma.call(t,e)}var wa="__lodash_hash_undefined__";function Aa(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Je&&t===void 0?wa:t,this}function Oe(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}Oe.prototype.clear=fa,Oe.prototype.delete=da,Oe.prototype.get=ha,Oe.prototype.has=Ea,Oe.prototype.set=Aa;function va(){this.__data__=[],this.size=0}function At(e,t){for(var n=e.length;n--;)if(Ye(e[n][0],t))return n;return-1}var ya=Array.prototype,Sa=ya.splice;function Ta(e){var t=this.__data__,n=At(t,e);if(n<0)return!1;var o=t.length-1;return n==o?t.pop():Sa.call(t,n,1),--this.size,!0}function ba(e){var t=this.__data__,n=At(t,e);return n<0?void 0:t[n][1]}function Oa(e){return At(this.__data__,e)>-1}function Pa(e,t){var n=this.__data__,o=At(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}function ge(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}ge.prototype.clear=va,ge.prototype.delete=Ta,ge.prototype.get=ba,ge.prototype.has=Oa,ge.prototype.set=Pa;var ke=be(_e,"Map");function Ia(){this.size=0,this.__data__={hash:new Oe,map:new(ke||ge),string:new Oe}}function Ca(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 Ca(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ra(e){var t=vt(this,e).delete(e);return this.size-=t?1:0,t}function Na(e){return vt(this,e).get(e)}function La(e){return vt(this,e).has(e)}function Da(e,t){var n=vt(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}function me(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}me.prototype.clear=Ia,me.prototype.delete=Ra,me.prototype.get=Na,me.prototype.has=La,me.prototype.set=Da;var Ua="Expected a function";function Jt(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Ua);var n=function(){var o=arguments,i=t?t.apply(this,o):o[0],a=n.cache;if(a.has(i))return a.get(i);var f=e.apply(this,o);return n.cache=a.set(i,f)||a,f};return n.cache=new(Jt.Cache||me),n}Jt.Cache=me;var $a=500;function Ma(e){var t=Jt(e,function(o){return n.size===$a&&n.clear(),o}),n=t.cache;return t}var ja=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xa=/\\(\\)?/g,Fa=Ma(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(ja,function(n,o,i,a){t.push(i?a.replace(xa,"$1"):o||n)}),t});function et(e){return e==null?"":Vn(e)}function Me(e,t){return ne(e)?e:Kt(e,t)?[e]:Fa(et(e))}function Pe(e){if(typeof e=="string"||xt(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function yt(e,t){t=Me(t,e);for(var n=0,o=t.length;e!=null&&n<o;)e=e[Pe(t[n++])];return n&&n==o?e:void 0}function Wa(e,t,n){var o=e==null?void 0:yt(e,t);return o===void 0?n:o}function kt(e,t){for(var n=-1,o=t.length,i=e.length;++n<o;)e[i+n]=t[n];return e}var cr=ae?ae.isConcatSpreadable:void 0;function qa(e){return ne(e)||Ze(e)||!!(cr&&e&&e[cr])}function Ga(e,t,n,o,i){var a=-1,f=e.length;for(n||(n=qa),i||(i=[]);++a<f;){var l=e[a];n(l)?kt(i,l):i[i.length]=l}return i}function za(e){var t=e==null?0:e.length;return t?Ga(e):[]}function Ha(e){return Xn(Jn(e,void 0,za),e+"")}var en=ar(Object.getPrototypeOf,Object),Ba="[object Object]",Va=Function.prototype,Ya=Object.prototype,ur=Va.toString,Za=Ya.hasOwnProperty,Qa=ur.call(Object);function fr(e){if(!pe(e)||Se(e)!=Ba)return!1;var t=en(e);if(t===null)return!0;var n=Za.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&ur.call(n)==Qa}function dr(e,t,n){var o=-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);++o<i;)a[o]=e[o+t];return a}function Xa(e,t,n){var o=e.length;return n=n===void 0?o:n,!t&&n>=o?e:dr(e,t,n)}var Ka="\\ud800-\\udfff",Ja="\\u0300-\\u036f",ka="\\ufe20-\\ufe2f",ec="\\u20d0-\\u20ff",tc=Ja+ka+ec,nc="\\ufe0e\\ufe0f",rc="\\u200d",oc=RegExp("["+rc+Ka+tc+nc+"]");function lr(e){return oc.test(e)}function ic(e){return e.split("")}var _r="\\ud800-\\udfff",sc="\\u0300-\\u036f",ac="\\ufe20-\\ufe2f",cc="\\u20d0-\\u20ff",uc=sc+ac+cc,fc="\\ufe0e\\ufe0f",dc="["+_r+"]",tn="["+uc+"]",nn="\\ud83c[\\udffb-\\udfff]",lc="(?:"+tn+"|"+nn+")",pr="[^"+_r+"]",hr="(?:\\ud83c[\\udde6-\\uddff]){2}",gr="[\\ud800-\\udbff][\\udc00-\\udfff]",_c="\\u200d",mr=lc+"?",Er="["+fc+"]?",pc="(?:"+_c+"(?:"+[pr,hr,gr].join("|")+")"+Er+mr+")*",hc=Er+mr+pc,gc="(?:"+[pr+tn+"?",tn,hr,gr,dc].join("|")+")",mc=RegExp(nn+"(?="+nn+")|"+gc+hc,"g");function Ec(e){return e.match(mc)||[]}function wc(e){return lr(e)?Ec(e):ic(e)}function Ac(e){return function(t){t=et(t);var n=lr(t)?wc(t):void 0,o=n?n[0]:t.charAt(0),i=n?Xa(n,1).join(""):t.slice(1);return o[e]()+i}}var vc=Ac("toUpperCase");function yc(e){return vc(et(e).toLowerCase())}function Sc(e,t,n,o){for(var i=-1,a=e==null?0:e.length;++i<a;)n=t(n,e[i],i,e);return n}function Tc(e){return function(t){return e?.[t]}}var bc={À:"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"},Oc=Tc(bc),Pc=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ic="\\u0300-\\u036f",Cc="\\ufe20-\\ufe2f",Rc="\\u20d0-\\u20ff",Nc=Ic+Cc+Rc,Lc="["+Nc+"]",Dc=RegExp(Lc,"g");function Uc(e){return e=et(e),e&&e.replace(Pc,Oc).replace(Dc,"")}var $c=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Mc(e){return e.match($c)||[]}var jc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function xc(e){return jc.test(e)}var wr="\\ud800-\\udfff",Fc="\\u0300-\\u036f",Wc="\\ufe20-\\ufe2f",qc="\\u20d0-\\u20ff",Gc=Fc+Wc+qc,Ar="\\u2700-\\u27bf",vr="a-z\\xdf-\\xf6\\xf8-\\xff",zc="\\xac\\xb1\\xd7\\xf7",Hc="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Bc="\\u2000-\\u206f",Vc=" \\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",yr="A-Z\\xc0-\\xd6\\xd8-\\xde",Yc="\\ufe0e\\ufe0f",Sr=zc+Hc+Bc+Vc,Tr="['’]",br="["+Sr+"]",Zc="["+Gc+"]",Or="\\d+",Qc="["+Ar+"]",Pr="["+vr+"]",Ir="[^"+wr+Sr+Or+Ar+vr+yr+"]",Xc="\\ud83c[\\udffb-\\udfff]",Kc="(?:"+Zc+"|"+Xc+")",Jc="[^"+wr+"]",Cr="(?:\\ud83c[\\udde6-\\uddff]){2}",Rr="[\\ud800-\\udbff][\\udc00-\\udfff]",je="["+yr+"]",kc="\\u200d",Nr="(?:"+Pr+"|"+Ir+")",eu="(?:"+je+"|"+Ir+")",Lr="(?:"+Tr+"(?:d|ll|m|re|s|t|ve))?",Dr="(?:"+Tr+"(?:D|LL|M|RE|S|T|VE))?",Ur=Kc+"?",$r="["+Yc+"]?",tu="(?:"+kc+"(?:"+[Jc,Cr,Rr].join("|")+")"+$r+Ur+")*",nu="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ru="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ou=$r+Ur+tu,iu="(?:"+[Qc,Cr,Rr].join("|")+")"+ou,su=RegExp([je+"?"+Pr+"+"+Lr+"(?="+[br,je,"$"].join("|")+")",eu+"+"+Dr+"(?="+[br,je+Nr,"$"].join("|")+")",je+"?"+Nr+"+"+Lr,je+"+"+Dr,ru,nu,Or,iu].join("|"),"g");function au(e){return e.match(su)||[]}function cu(e,t,n){return e=et(e),t=t,t===void 0?xc(e)?au(e):Mc(e):e.match(t)||[]}var uu="['’]",fu=RegExp(uu,"g");function Mr(e){return function(t){return Sc(cu(Uc(t).replace(fu,"")),e,"")}}var du=Mr(function(e,t,n){return t=t.toLowerCase(),e+(n?yc(t):t)});function lu(){this.__data__=new ge,this.size=0}function _u(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function pu(e){return this.__data__.get(e)}function hu(e){return this.__data__.has(e)}var gu=200;function mu(e,t){var n=this.__data__;if(n instanceof ge){var o=n.__data__;if(!ke||o.length<gu-1)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new me(o)}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=lu,fe.prototype.delete=_u,fe.prototype.get=pu,fe.prototype.has=hu,fe.prototype.set=mu;function Eu(e,t){return e&&Ue(t,wt(t),e)}function wu(e,t){return e&&Ue(t,Ke(t),e)}var jr=typeof v=="object"&&v&&!v.nodeType&&v,xr=jr&&typeof module=="object"&&module&&!module.nodeType&&module,Au=xr&&xr.exports===jr,Fr=Au?_e.Buffer:void 0,Wr=Fr?Fr.allocUnsafe:void 0;function qr(e,t){if(t)return e.slice();var n=e.length,o=Wr?Wr(n):new e.constructor(n);return e.copy(o),o}function vu(e,t){for(var n=-1,o=e==null?0:e.length,i=0,a=[];++n<o;){var f=e[n];t(f,n,e)&&(a[i++]=f)}return a}function Gr(){return[]}var yu=Object.prototype,Su=yu.propertyIsEnumerable,zr=Object.getOwnPropertySymbols,rn=zr?function(e){return e==null?[]:(e=Object(e),vu(zr(e),function(t){return Su.call(e,t)}))}:Gr;function Tu(e,t){return Ue(e,rn(e),t)}var bu=Object.getOwnPropertySymbols,Hr=bu?function(e){for(var t=[];e;)kt(t,rn(e)),e=en(e);return t}:Gr;function Ou(e,t){return Ue(e,Hr(e),t)}function Br(e,t,n){var o=t(e);return ne(e)?o:kt(o,n(e))}function on(e){return Br(e,wt,rn)}function sn(e){return Br(e,Ke,Hr)}var an=be(_e,"DataView"),cn=be(_e,"Promise"),un=be(_e,"Set"),Vr="[object Map]",Pu="[object Object]",Yr="[object Promise]",Zr="[object Set]",Qr="[object WeakMap]",Xr="[object DataView]",Iu=Te(an),Cu=Te(ke),Ru=Te(cn),Nu=Te(un),Lu=Te(zt),de=Se;(an&&de(new an(new ArrayBuffer(1)))!=Xr||ke&&de(new ke)!=Vr||cn&&de(cn.resolve())!=Yr||un&&de(new un)!=Zr||zt&&de(new zt)!=Qr)&&(de=function(e){var t=Se(e),n=t==Pu?e.constructor:void 0,o=n?Te(n):"";if(o)switch(o){case Iu:return Xr;case Cu:return Vr;case Ru:return Yr;case Nu:return Zr;case Lu:return Qr}return t});var Du=Object.prototype,Uu=Du.hasOwnProperty;function $u(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&Uu.call(e,"index")&&(n.index=e.index,n.input=e.input),n}var St=_e.Uint8Array;function fn(e){var t=new e.constructor(e.byteLength);return new St(t).set(new St(e)),t}function Mu(e,t){var n=t?fn(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var ju=/\w*$/;function xu(e){var t=new e.constructor(e.source,ju.exec(e));return t.lastIndex=e.lastIndex,t}var Kr=ae?ae.prototype:void 0,Jr=Kr?Kr.valueOf:void 0;function Fu(e){return Jr?Object(Jr.call(e)):{}}function kr(e,t){var n=t?fn(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var Wu="[object Boolean]",qu="[object Date]",Gu="[object Map]",zu="[object Number]",Hu="[object RegExp]",Bu="[object Set]",Vu="[object String]",Yu="[object Symbol]",Zu="[object ArrayBuffer]",Qu="[object DataView]",Xu="[object Float32Array]",Ku="[object Float64Array]",Ju="[object Int8Array]",ku="[object Int16Array]",ef="[object Int32Array]",tf="[object Uint8Array]",nf="[object Uint8ClampedArray]",rf="[object Uint16Array]",of="[object Uint32Array]";function sf(e,t,n){var o=e.constructor;switch(t){case Zu:return fn(e);case Wu:case qu:return new o(+e);case Qu:return Mu(e,n);case Xu:case Ku:case Ju:case ku:case ef:case tf:case nf:case rf:case of:return kr(e,n);case Gu:return new o;case zu:case Vu:return new o(e);case Hu:return xu(e);case Bu:return new o;case Yu:return Fu(e)}}function eo(e){return typeof e.constructor=="function"&&!Yt(e)?ts(en(e)):{}}var af="[object Map]";function cf(e){return pe(e)&&de(e)==af}var to=$e&&$e.isMap,uf=to?Zt(to):cf,ff="[object Set]";function df(e){return pe(e)&&de(e)==ff}var no=$e&&$e.isSet,lf=no?Zt(no):df,_f=1,pf=2,hf=4,ro="[object Arguments]",gf="[object Array]",mf="[object Boolean]",Ef="[object Date]",wf="[object Error]",oo="[object Function]",Af="[object GeneratorFunction]",vf="[object Map]",yf="[object Number]",io="[object Object]",Sf="[object RegExp]",Tf="[object Set]",bf="[object String]",Of="[object Symbol]",Pf="[object WeakMap]",If="[object ArrayBuffer]",Cf="[object DataView]",Rf="[object Float32Array]",Nf="[object Float64Array]",Lf="[object Int8Array]",Df="[object Int16Array]",Uf="[object Int32Array]",$f="[object Uint8Array]",Mf="[object Uint8ClampedArray]",jf="[object Uint16Array]",xf="[object Uint32Array]",j={};j[ro]=j[gf]=j[If]=j[Cf]=j[mf]=j[Ef]=j[Rf]=j[Nf]=j[Lf]=j[Df]=j[Uf]=j[vf]=j[yf]=j[io]=j[Sf]=j[Tf]=j[bf]=j[Of]=j[$f]=j[Mf]=j[jf]=j[xf]=!0,j[wf]=j[oo]=j[Pf]=!1;function tt(e,t,n,o,i,a){var f,l=t&_f,p=t&pf,b=t&hf;if(n&&(f=i?n(e,o,i,a):n(e)),f!==void 0)return f;if(!ue(e))return e;var T=ne(e);if(T){if(f=$u(e),!l)return Qn(e,f)}else{var N=de(e),L=N==oo||N==Af;if(Qe(e))return qr(e,l);if(N==io||N==ro||L&&!i){if(f=p||L?{}:eo(e),!l)return p?Ou(e,wu(f,e)):Tu(e,Eu(f,e))}else{if(!j[N])return i?e:{};f=sf(e,N,l)}}a||(a=new fe);var $=a.get(e);if($)return $;a.set(e,f),lf(e)?e.forEach(function(H){f.add(tt(H,t,n,H,e,a))}):uf(e)&&e.forEach(function(H,B){f.set(B,tt(H,t,n,B,e,a))});var P=b?p?sn:on:p?Ke:wt,z=T?void 0:P(e);return us(z||e,function(H,B){z&&(B=H,H=e[B]),Bt(f,B,tt(H,t,n,B,e,a))}),f}var Ff=1,Wf=4;function so(e){return tt(e,Ff|Wf)}var qf="__lodash_hash_undefined__";function Gf(e){return this.__data__.set(e,qf),this}function zf(e){return this.__data__.has(e)}function Tt(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new me;++t<n;)this.add(e[t])}Tt.prototype.add=Tt.prototype.push=Gf,Tt.prototype.has=zf;function Hf(e,t){for(var n=-1,o=e==null?0:e.length;++n<o;)if(t(e[n],n,e))return!0;return!1}function Bf(e,t){return e.has(t)}var Vf=1,Yf=2;function ao(e,t,n,o,i,a){var f=n&Vf,l=e.length,p=t.length;if(l!=p&&!(f&&p>l))return!1;var b=a.get(e),T=a.get(t);if(b&&T)return b==t&&T==e;var N=-1,L=!0,$=n&Yf?new Tt:void 0;for(a.set(e,t),a.set(t,e);++N<l;){var P=e[N],z=t[N];if(o)var H=f?o(z,P,N,t,e,a):o(P,z,N,e,t,a);if(H!==void 0){if(H)continue;L=!1;break}if($){if(!Hf(t,function(B,Q){if(!Bf($,Q)&&(P===B||i(P,B,n,o,a)))return $.push(Q)})){L=!1;break}}else if(!(P===z||i(P,z,n,o,a))){L=!1;break}}return a.delete(e),a.delete(t),L}function Zf(e){var t=-1,n=Array(e.size);return e.forEach(function(o,i){n[++t]=[i,o]}),n}function Qf(e){var t=-1,n=Array(e.size);return e.forEach(function(o){n[++t]=o}),n}var Xf=1,Kf=2,Jf="[object Boolean]",kf="[object Date]",ed="[object Error]",td="[object Map]",nd="[object Number]",rd="[object RegExp]",od="[object Set]",id="[object String]",sd="[object Symbol]",ad="[object ArrayBuffer]",cd="[object DataView]",co=ae?ae.prototype:void 0,dn=co?co.valueOf:void 0;function ud(e,t,n,o,i,a,f){switch(n){case cd: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 St(e),new St(t)));case Jf:case kf:case nd:return Ye(+e,+t);case ed:return e.name==t.name&&e.message==t.message;case rd:case id:return e==t+"";case td:var l=Zf;case od:var p=o&Xf;if(l||(l=Qf),e.size!=t.size&&!p)return!1;var b=f.get(e);if(b)return b==t;o|=Kf,f.set(e,t);var T=ao(l(e),l(t),o,i,a,f);return f.delete(e),T;case sd:if(dn)return dn.call(e)==dn.call(t)}return!1}var fd=1,dd=Object.prototype,ld=dd.hasOwnProperty;function _d(e,t,n,o,i,a){var f=n&fd,l=on(e),p=l.length,b=on(t),T=b.length;if(p!=T&&!f)return!1;for(var N=p;N--;){var L=l[N];if(!(f?L in t:ld.call(t,L)))return!1}var $=a.get(e),P=a.get(t);if($&&P)return $==t&&P==e;var z=!0;a.set(e,t),a.set(t,e);for(var H=f;++N<p;){L=l[N];var B=e[L],Q=t[L];if(o)var ve=f?o(Q,B,L,t,e,a):o(B,Q,L,e,t,a);if(!(ve===void 0?B===Q||i(B,Q,n,o,a):ve)){z=!1;break}H||(H=L=="constructor")}if(z&&!H){var ze=e.constructor,ee=t.constructor;ze!=ee&&"constructor"in e&&"constructor"in t&&!(typeof ze=="function"&&ze instanceof ze&&typeof ee=="function"&&ee instanceof ee)&&(z=!1)}return a.delete(e),a.delete(t),z}var pd=1,uo="[object Arguments]",fo="[object Array]",bt="[object Object]",hd=Object.prototype,lo=hd.hasOwnProperty;function gd(e,t,n,o,i,a){var f=ne(e),l=ne(t),p=f?fo:de(e),b=l?fo:de(t);p=p==uo?bt:p,b=b==uo?bt:b;var T=p==bt,N=b==bt,L=p==b;if(L&&Qe(e)){if(!Qe(t))return!1;f=!0,T=!1}if(L&&!T)return a||(a=new fe),f||Xt(e)?ao(e,t,n,o,i,a):ud(e,t,p,n,o,i,a);if(!(n&pd)){var $=T&&lo.call(e,"__wrapped__"),P=N&&lo.call(t,"__wrapped__");if($||P){var z=$?e.value():e,H=P?t.value():t;return a||(a=new fe),i(z,H,n,o,a)}}return L?(a||(a=new fe),_d(e,t,n,o,i,a)):!1}function Ot(e,t,n,o,i){return e===t?!0:e==null||t==null||!pe(e)&&!pe(t)?e!==e&&t!==t:gd(e,t,n,o,Ot,i)}var md=1,Ed=2;function wd(e,t,n,o){var i=n.length,a=i;if(e==null)return!a;for(e=Object(e);i--;){var f=n[i];if(f[2]?f[1]!==e[f[0]]:!(f[0]in e))return!1}for(;++i<a;){f=n[i];var l=f[0],p=e[l],b=f[1];if(f[2]){if(p===void 0&&!(l in e))return!1}else{var T=new fe,N;if(!(N===void 0?Ot(b,p,md|Ed,o,T):N))return!1}}return!0}function _o(e){return e===e&&!ue(e)}function Ad(e){for(var t=wt(e),n=t.length;n--;){var o=t[n],i=e[o];t[n]=[o,i,_o(i)]}return t}function po(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function vd(e){var t=Ad(e);return t.length==1&&t[0][2]?po(t[0][0],t[0][1]):function(n){return n===e||wd(n,e,t)}}function yd(e,t){return e!=null&&t in Object(e)}function Sd(e,t,n){t=Me(t,e);for(var o=-1,i=t.length,a=!1;++o<i;){var f=Pe(t[o]);if(!(a=e!=null&&n(e,f)))break;e=e[f]}return a||++o!=i?a:(i=e==null?0:e.length,!!i&&Vt(i)&&mt(f,i)&&(ne(e)||Ze(e)))}function Td(e,t){return e!=null&&Sd(e,t,yd)}var bd=1,Od=2;function Pd(e,t){return Kt(e)&&_o(t)?po(Pe(e),t):function(n){var o=Wa(n,e);return o===void 0&&o===t?Td(n,e):Ot(t,o,bd|Od)}}function Id(e){return function(t){return t?.[e]}}function Cd(e){return function(t){return yt(t,e)}}function Rd(e){return Kt(e)?Id(Pe(e)):Cd(e)}function Nd(e){return typeof e=="function"?e:e==null?Wt:typeof e=="object"?ne(e)?Pd(e[0],e[1]):vd(e):Rd(e)}function Ld(e){return function(t,n,o){for(var i=-1,a=Object(t),f=o(t),l=f.length;l--;){var p=f[++i];if(n(a[p],p,a)===!1)break}return t}}var Dd=Ld();function ln(e,t,n){(n!==void 0&&!Ye(e[t],n)||n===void 0&&!(t in e))&&Ht(e,t,n)}function Ud(e){return pe(e)&&Et(e)}function _n(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function $d(e){return Ue(e,Ke(e))}function Md(e,t,n,o,i,a,f){var l=_n(e,n),p=_n(t,n),b=f.get(p);if(b){ln(e,n,b);return}var T=a?a(l,p,n+"",e,t,f):void 0,N=T===void 0;if(N){var L=ne(p),$=!L&&Qe(p),P=!L&&!$&&Xt(p);T=p,L||$||P?ne(l)?T=l:Ud(l)?T=Qn(l):$?(N=!1,T=qr(p,!0)):P?(N=!1,T=kr(p,!0)):T=[]:fr(p)||Ze(p)?(T=l,Ze(l)?T=$d(l):(!ue(l)||qt(l))&&(T=eo(p))):N=!1}N&&(f.set(p,T),i(T,p,o,a,f),f.delete(p)),ln(e,n,T)}function ho(e,t,n,o,i){e!==t&&Dd(t,function(a,f){if(i||(i=new fe),ue(a))Md(e,t,f,n,ho,o,i);else{var l=o?o(_n(e,f),a,f+"",e,t,i):void 0;l===void 0&&(l=a),ln(e,f,l)}},Ke)}function jd(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function xd(e,t){return t.length<2?e:yt(e,dr(t,0,-1))}function Fd(e,t){return Ot(e,t)}var Wd=ms(function(e,t,n){ho(e,t,n)}),qd=Object.prototype,Gd=qd.hasOwnProperty;function zd(e,t){t=Me(t,e);var n=-1,o=t.length;if(!o)return!0;for(;++n<o;){var i=Pe(t[n]);if(i==="__proto__"&&!Gd.call(e,"__proto__")||(i==="constructor"||i==="prototype")&&n<o-1)return!1}var a=xd(e,t);return a==null||delete a[Pe(jd(t))]}function Hd(e){return fr(e)?void 0:e}var Bd=1,Vd=2,Yd=4,pn=Ha(function(e,t){var n={};if(e==null)return n;var o=!1;t=Ft(t,function(a){return a=Me(a,e),o||(o=a.length>1),a}),Ue(e,sn(e),n),o&&(n=tt(n,Bd|Vd|Yd,Hd));for(var i=t.length;i--;)zd(n,t[i]);return n});function Zd(e,t,n,o){if(!ue(e))return e;t=Me(t,e);for(var i=-1,a=t.length,f=a-1,l=e;l!=null&&++i<a;){var p=Pe(t[i]),b=n;if(p==="__proto__"||p==="constructor"||p==="prototype")return e;if(i!=f){var T=l[p];b=void 0,b===void 0&&(b=ue(T)?T:mt(t[i+1])?[]:{})}Bt(l,p,b),l=l[p]}return e}function Qd(e,t,n){for(var o=-1,i=t.length,a={};++o<i;){var f=t[o],l=yt(e,f);n(l,f)&&Zd(a,Me(f,e),l)}return a}function Xd(e,t){if(e==null)return{};var n=Ft(sn(e),function(o){return[o]});return t=Nd(t),Qd(e,n,function(o,i){return t(o,i[0])})}var go=Mr(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});function Kd(e){return e?.mode==="off"||e?.mode==="on_device"||e?.mode==="online"?e.mode:"off"}const Jd="/core/api/protected/pia-prepare/pia-search",kd=3e3,el=512,mo=3e4,tl={available:!0,offline:!1,runtime:"bedrock-online"};function nl(e,t,n){return new Promise((o,i)=>{const a=setTimeout(()=>i(new Error(`${n} timed out after ${t}ms`)),t);e.then(f=>{clearTimeout(a),o(f)},f=>{clearTimeout(a),i(f)})})}function Eo(e){return e.startsWith("http")?e:`https://${e}`}function rl(e){const t=e?.pitcher?.token_claims?.["https://pitcher.com/claims/urls"]?.custom_domain;if(typeof t=="string"&&t.length>0)return Eo(t);const n=e?.pitcher?.organization?.metadata?.custom_domain;if(typeof n=="string"&&n.length>0)return Eo(n);throw new Error("piaSearchAnswer: no customer domain found in env (token_claims / organization metadata)")}function ol(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.
|
|
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.
|
|
18
|
+
|
|
19
|
+
Below are {{meeting_count}} numbered meetings, each with its account's CRM context (deals, tasks, recent calls).
|
|
20
|
+
|
|
21
|
+
Pick the {{max_picks}} most important. Pick fewer only if the list has fewer meetings.
|
|
22
|
+
|
|
23
|
+
Rules:
|
|
24
|
+
- Highest priority first; ties go to the earlier meeting.
|
|
25
|
+
- Strongest signals: an overdue or due-soon high-priority task, a poorly rated recent interaction, a deal closing within days. Routine meetings on healthy accounts rank last.
|
|
26
|
+
- {{account_rule}}
|
|
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
|
+
- "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})}
|
|
32
|
+
|
|
33
|
+
Answer with JSON ONLY — no other text. The object has exactly two keys:
|
|
34
|
+
"hero": the summary as one string.
|
|
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
|
+
|
|
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.
|
|
18
39
|
|
|
19
40
|
CONTEXT:
|
|
20
41
|
${typeof t=="string"&&t.trim().length>0?t.trim():"No content context was provided."}
|
|
21
42
|
|
|
22
43
|
QUESTION: ${e}
|
|
23
44
|
|
|
24
|
-
Answer concisely in plain text. If the context does not contain the answer, say you could not find it in the available content.`}async function il(){return(await v.highLevelApi.API.request("get_env"))?.mode==="IOS"?v.highLevelApi.API.request("ai.get_capabilities"):{...tl}}function wo(e){return!e||typeof e.prompt!="string"||e.prompt.trim()===""?Promise.reject(new Error("prompt is required and must be a non-empty string")):v.highLevelApi.API.request("ai.complete",e)}async function sl(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 v.highLevelApi.API.request("get_env"),n=Kd(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 nl(v.highLevelApi.API.request("ai.get_capabilities"),kd,"ai.get_capabilities"))?.available)return{answer:(await wo({prompt:ol(e.query,e.context_text),max_tokens:e.max_tokens??el})).text,source:"on_device"}}catch(f){console.warn("[piaSearchAnswer] on-device path unavailable, falling back to online:",f)}const o=e.instance_id||t?.pitcher?.instance?.id;if(!o)throw new Error("piaSearchAnswer: instance_id could not be resolved from the payload or env");const i=new AbortController,a=setTimeout(()=>i.abort(),mo);try{const f=await fetch(`${rl(t)}${Jd}`,{method:"POST",signal:i.signal,headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.pitcher.access_token}`},body:JSON.stringify({query:e.query,instance_id:o,...Array.isArray(e.file_ids)&&e.file_ids.length>0&&{file_ids:e.file_ids}})});if(!f.ok)throw new Error(`pia_search ${f.status}`);const p=(await f.json())?.pia_search??{};return{answer:typeof p.answer=="string"?p.answer:"",cited_file_ids:Array.isArray(p.cited_file_ids)?p.cited_file_ids:[],...p.confidence&&{confidence:p.confidence},source:"online"}}catch(f){throw f?.name==="AbortError"?new Error(`pia_search online request timed out after ${mo}ms`):f}finally{clearTimeout(a)}}const al="/core/api/protected/appsdb";async function cl(){const e=await v.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 o=t||n||"";return o&&!o.startsWith("http")&&(o=`https://${o}`),{isIos:(e?.mode??e?.pitcher?.mode)==="IOS",origin:o,accessToken:e?.pitcher?.access_token??"",instanceId:e?.pitcher?.instance?.id}}const ul=6e4;let xe=null;function Pt(){if(xe&&Date.now()-xe.fetchedAt<ul)return xe.promise;const e=cl();return xe={promise:e,fetchedAt:Date.now()},e.catch(()=>{xe?.promise===e&&(xe=null)}),e}async function Fe(e,t,n){const o=e.origin||(typeof window<"u"?window.location.origin:""),i=new URL(`${o}${al}${t}`);Object.entries(n.params??{}).forEach(([l,p])=>{p!=null&&i.searchParams.set(l,String(p))});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 p=new Error(`AppsDB request failed: ${a.status}${l?.error?` — ${l.error}`:""}`);throw p.status=a.status,p}if(a.status===204||a.status===205)return;const f=await a.text();return f?JSON.parse(f):void 0}function Ao(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 vo(e){return Ao(e,"type_not_synced")}function It(e){return Ao(e,"requestTypeDoesNotExists")}function fl(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 dl(e){return e.replace(/'(?:[^']|'')*'/g,"''")}function ll(e){const t=[];let n="",o=!1,i=0;for(;i<e.length;){const a=e[i];if(a==="'"){if(o&&e[i+1]==="'"){n+="''",i+=2;continue}o=!o,n+=a,i+=1;continue}if(!o){const f=e.slice(i).match(/^ AND /i);if(f){t.push(n),n="",i+=f[0].length;continue}}n+=a,i+=1}return o?null:(t.push(n),t)}function _l(e){const n=e.replace(/\s+/g," ").trim().match(/^SELECT \* FROM ([A-Za-z0-9_]+)( WHERE (.+))?$/i);if(!n)return null;const o=n[1],i=n[3];if(!i)return{type:o,conditions:[]};if(/\bOR\b|\bNOT\b|\bLIKE\b|\bIN\b|[<>]|!=/i.test(dl(i)))return null;const a=ll(i);if(!a)return null;const f=[];for(const l of a){const p=l.trim().match(/^([A-Za-z0-9_.]+) ?= ?(.+)$/);if(!p)return null;const b=fl(p[2].trim());if(b===void 0)return null;f.push({path:p[1],value:b})}return{type:o,conditions:f}}function pl(e,t){return t.every(({path:n,value:o})=>{const i=n.split(".").reduce((a,f)=>a?.[f],e);return o===null?i==null:i==null?!1:String(i)===String(o)})}async function hl(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 Pt();if(t.isIos)try{return await v.highLevelApi.API.request("appsdb_get_entries",e)}catch(n){if(!vo(n)&&!It(n))throw n}return Fe(t,"",{method:"GET",params:e})}async function gl(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 Pt();if(t.isIos)try{return await v.highLevelApi.API.request("appsdb_upsert_entry",e)}catch(n){if(!It(n))throw n}return e.id?Fe(t,`/${encodeURIComponent(e.id)}`,{method:"PUT",body:{data:e.data}}):Fe(t,"",{method:"POST",body:e})}async function ml(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 Pt();if(t.isIos)try{return await v.highLevelApi.API.request("appsdb_delete_entry",e)}catch(n){if(!It(n))throw n}await Fe(t,`/${encodeURIComponent(e.id)}`,{method:"DELETE"})}async function El(){try{return!!await v.highLevelApi.API.request("is_offline")}catch{return!1}}const wl=1e3;async function yo(e){try{const t=[];let n=!0;for(;n;){const i=await v.highLevelApi.API.request("appsdb_get_entries",{type:e.type,limit:wl,offset:t.length}),a=i?.entries??[];t.push(...a),n=!!i?.hasMore&&a.length>0}const o=t.filter(i=>pl(i,e.conditions));return{entries:o,totalCount:o.length,hasMore:!1}}catch(t){if(vo(t)||It(t))return null;throw t}}async function Al(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 Pt();if(t.isIos){const n=_l(e.query);let o=!1;if(n&&await El()){const i=await yo(n);if(i)return i;o=!0}try{return await Fe(t,"/psql",{method:"POST",body:e})}catch(i){if(n&&!o&&i instanceof TypeError){const a=await yo(n);if(a)return a}throw i}}return Fe(t,"/psql",{method:"POST",body:e})}function vl(e={}){return this.API.request("open",e)}function yl(e){return this.API.request("open_external_url",e)}function Sl(){return this.API.request("get_env").then(e=>pn(e,"pitcher.org_config.segment"))}function Tl(e){return this.API.request("update_my_user",e)}function bl(){return this.API.request("is_offline")}function Ol(e){return this.API.request("get_canvases",e)}function Pl(e){return this.API.request("create_canvas",e)}function Il(e){return this.API.request("delete_canvas",e)}function Cl(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 Rl(e){return this.API.request("update_canvas_indicators",e)}function Nl(e){return this.API.request("get_canvas",e)}function Ll(e){return this.API.request("get_canvas_sections_by_ids",e)}function Dl(e){return this.API.request("share_canvas",e)}function Ul(e){return this.API.request("get_canvas_recommended_files",e)}function $l(e){return this.API.request("get_canvas_theme",e)}function Ml(e){return this.API.request("unassign_canvas_theme",e)}function jl(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 xl(e){return this.API.request("download_file",e)}function Fl(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 Wl(e){const{id:t,file_id:n}=e;return this.API.request("get_file",{...e,file_id:t||n})}function ql(e){return this.API.request("get_file_revision_data",e)}function Gl(e){return this.API.request("update_file",e)}function zl(e){return this.API.request("delete_file",e)}function Hl(e){return this.API.request("create_file",e)}function Bl(){return this.API.request("select_device_file")}function Vl(e){return this.API.request("delete_local_file",e)}function Yl(e){const{id:t,file_id:n}=e;return this.API.request("get_file_revisions",{file_id:t||n})}function Zl(e){return this.API.request("search",e)}function Ql(e){return this.API.request("get_users",e)}function Xl(e){return this.API.request("refresh_service_token",e??{})}function Kl(){return this.API.request("refresh_access_token")}function Jl(e){return this.API.request("fetch_document_info",e)}function kl(e){return this.API.request("render_page_as_image",e)}function e_(e){return this.API.request("toast",e)}const t_=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"]),hn=["COUNT","SUM","AVG","MIN","MAX","COUNT_DISTINCT"];function So(e){return t_.has(e.toUpperCase())}function To(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 n_(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 Ie(e,t,n){const o=e.trim();if(So(o)||To(o))return o;if(o==="__FIELDS_ALL_PLACEHOLDER__")return`{${t}:_soup}`;if(o==="*")return"*";if(o.startsWith("{")&&o.endsWith("}"))return o;if(o.includes(".")){const i=o.split("."),a=i[0];if(n.has(a.toLowerCase())&&n.get(a.toLowerCase())===t){const f=i.slice(1).join(".");return`{${t}:${f}}`}return`{${t}:${o}}`}return`{${t}:${o}}`}function bo(e,t,n){for(const o of hn){const i=new RegExp(`\\b${o}\\s*\\(([^)]+)\\)`,"gi");e=e.replace(i,(a,f)=>{const l=f.trim();if(l==="*")return`${o}(*)`;if(l.toUpperCase().startsWith("DISTINCT ")){const b=l.substring(9).trim(),T=Ie(b,t,n);return`${o}(DISTINCT ${T})`}const p=Ie(l,t,n);return`${o}(${p})`})}return e}function r_(e){const t=[];let n=0,o="";for(let i=0;i<e.length;i++){const a=e[i];a==="("?(n++,o+=a):a===")"?(n--,o+=a):a===","&&n===0?(o.trim()&&t.push(o.trim()),o=""):o+=a}return o.trim()&&t.push(o.trim()),t}function o_(e,t,n){return e.map(o=>{const i=o.match(/^(.+?)\s+(?:AS\s+)?([A-Za-z_][A-Za-z0-9_]*)$/i);let a=o,f="";if(i&&(a=i[1].trim(),f=i[2]),hn.some(b=>new RegExp(`\\b${b}\\s*\\(`,"i").test(a))){const b=bo(a,t,n);return f?`${b} ${f}`:b}const p=Ie(a,t,n);return f?`${p} ${f}`:p})}function i_(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 Oo(e,t,n){let o="",i=0;const a=e.length;for(;i<a;){const f=e[i];if(/\s/.test(f)){o+=f,i++;continue}if(f==="'"||f==='"'){const l=f;for(o+=f,i++;i<a&&e[i]!==l;)e[i]==="\\"&&i+1<a?(o+=e[i]+e[i+1],i+=2):(o+=e[i],i++);i<a&&(o+=e[i],i++);continue}if(/[()=<>!,]/.test(f)){o+=f,i++,(f==="!"||f==="<"||f===">")&&i<a&&e[i]==="="&&(o+=e[i],i++);continue}if(/[a-zA-Z_]/.test(f)){let l="";for(;i<a&&/[a-zA-Z0-9_.]/.test(e[i]);)l+=e[i],i++;So(l)||To(l)?o+=l:o+=Ie(l,t,n);continue}if(/[0-9-]/.test(f)){let l="";for(f==="-"&&(l+=f,i++);i<a&&/[0-9.:\-TZ+]/.test(e[i]);)l+=e[i],i++;n_(l)?o+=`'${l}'`:o+=l;continue}o+=f,i++}return o=i_(o),o}function s_(e){const t=[],n=e.split(/,(?![^()]*\))/);for(const o of n){const i=o.trim();if(!i)continue;const a=i.match(/^(.+?)\s*(ASC|DESC)?\s*(NULLS\s+(?:FIRST|LAST))?$/i);if(a){const f=a[1].trim();let l=a[2]?a[2].toUpperCase():"";a[3]&&(l+=(l?" ":"")+a[3].toUpperCase()),t.push({field:f,direction:l})}else t.push({field:i,direction:""})}return t}function a_(e,t,n){return e.map(({field:o,direction:i})=>{const a=hn.some(l=>new RegExp(`\\b${l}\\s*\\(`,"i").test(o));let f;return a?f=bo(o,t,n):f=Ie(o,t,n),i?`${f} ${i}`:f})}function c_(e){return e.split(/,(?![^()]*\))/).map(t=>t.trim()).filter(Boolean)}function u_(e,t,n){return e.map(o=>/^(ROLLUP|CUBE)\s*\(/i.test(o)?o.replace(/\(([^)]+)\)/g,(i,a)=>`(${a.split(",").map(p=>p.trim()).map(p=>Ie(p,t,n)).join(", ")})`):Ie(o,t,n))}function f_(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 o=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 f;for(;(f=a.exec(e))!==null;)t.push({type:f[1].toUpperCase().replace(/\s+/g," "),object:f[2],alias:f[3],on:f[4]?.trim()});return{primary:o,alias:i,joins:t}}function d_(e){const t=[];let n="",o=0,i="",a=!1;for(let f=0;f<e.length;f++){const l=e[f];if(l==="("){if(o++,o===1){const p=e.substring(f+1).trimStart();if(/^SELECT\s/i.test(p)){a=!0,i=l;continue}}a?i+=l:n+=l}else l===")"?a?(i+=l,o--,o===0&&(t.push(i),i="",a=!1)):(o--,n+=l):a?i+=l:n+=l}return{cleanQuery:n,subqueries:t}}function gn(e){const{cleanQuery:t}=d_(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 l_(e){if(!e||typeof e!="string")return"";let t=e.replace(/\s+/g," ").trim();const{primaryObject:n,cleanQuery:o}=gn(t);if(!n)return e;t=o,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),f=a?f_(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),p=t.match(/GROUP\s+BY\s+([\s\S]+?)(?=\s+HAVING\s+|\s+ORDER\s+BY\s+|\s+LIMIT\s+|\s+OFFSET\s+|\s*$)/i),b=t.match(/HAVING\s+([\s\S]+?)(?=\s+ORDER\s+BY\s+|\s+LIMIT\s+|\s+OFFSET\s+|\s*$)/i),T=t.match(/ORDER\s+BY\s+([\s\S]+?)(?=\s+LIMIT\s+|\s+OFFSET\s+|\s*$)/i),N=t.match(/LIMIT\s+(\d+)/i),L=t.match(/OFFSET\s+(\d+)/i),$=new Map;f.alias&&$.set(f.alias.toLowerCase(),n),$.set(n.toLowerCase(),n);const P=[],z=r_(i[1].trim()),H=o_(z,n,$);P.push(`SELECT ${H.join(", ")}`),P.push(`FROM {${n}}`);const B=[];if(l){const Q=Oo(l[1].trim(),n,$);B.push(Q)}if(B.length>0&&P.push(`WHERE ${B.join(" AND ")}`),p){const Q=c_(p[1].trim()),ve=u_(Q,n,$);P.push(`GROUP BY ${ve.join(", ")}`)}if(b){const Q=Oo(b[1].trim(),n,$);P.push(`HAVING ${Q}`)}if(T){const Q=s_(T[1].trim()),ve=a_(Q,n,$);P.push(`ORDER BY ${ve.join(", ")}`)}return N&&P.push(`LIMIT ${N[1]}`),L&&P.push(`OFFSET ${L[1]}`),P.join(" ")}function __(e){return v.highLevelApi.API.request("query",e)}function Po(e){return v.highLevelApi.API.request("crm_query",e)}function p_(e){const{cleanQuery:t}=gn(e.replace(/\s+/g," ").trim()),n=t.match(/SELECT\s+([\s\S]+?)\s+FROM\s+/i);if(!n)return[];const o=n[1],i=[];let a=0,f="";for(let l=0;l<o.length;l++){const p=o[l];p==="("?(a++,f+=p):p===")"?(a--,f+=p):p===","&&a===0?(f.trim()&&i.push(f.trim()),f=""):f+=p}return f.trim()&&i.push(f.trim()),i.map(l=>{const p=l.match(/^(.+?)\s+(?:AS\s+)?([A-Za-z_][A-Za-z0-9_]*)$/i);return p?p[1].trim():l.trim()})}function h_(e){const{primaryObject:t}=gn(e.replace(/\s+/g," ").trim());return t??""}function g_(e,t,n){const o=t.split(".");if(o.length===1){e[t]=n;return}let i=e;for(let a=0;a<o.length-1;a++){const f=o[a];(!i[f]||typeof i[f]!="object")&&(i[f]={}),i=i[f]}i[o[o.length-1]]=n}function m_(e){const t=e.trim();return t==="*"||/^FIELDS\s*\(\s*(ALL|STANDARD|CUSTOM)\s*\)$/i.test(t)}function E_(e,t,n){return!e||!Array.isArray(e)?[]:e.map(o=>{const i={};t.forEach((f,l)=>{if(l<o.length){const p=o[l];m_(f)?p&&typeof p=="object"&&!Array.isArray(p)&&Object.assign(i,p):g_(i,f,p)}});const a=i.Id||i.id||"";return i.attributes={type:n,url:a?`/services/data/v57.0/sobjects/${n}/${a}`:""},i})}async function w_(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 o=await v.highLevelApi.API.request("get_env"),i=o?.mode==="IOS",a=o?.launch_darkly?.sfdc_offline_enabled===!0;n=i&&a}catch{n=!1}if(console.log("[crmQueryAdaptive] Called query: ",t),n){const o=p_(t),i=h_(t);let a=l_(t);if(!a.includes("__locally_deleted__")){const b=a.match(/FROM\s+\{([A-Za-z0-9_]+)\}/)?.[1];if(b){const T=`({${b}:__locally_deleted__} = 0 OR {${b}:__locally_deleted__} = 'false' OR {${b}:__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,(N,L)=>` WHERE (${L}) AND ${T}`):a=a.replace(/(FROM\s+\{[A-Za-z0-9_]+\})((\s+(?:ORDER\s+BY|GROUP\s+BY|HAVING|LIMIT|OFFSET)[\s\S]*)?)$/i,(N,L,$)=>`${L} WHERE ${T}${$}`)}}console.log("[crmSmartQuery] Called query: ",a);const f=await Io({query:a}),l=E_(f,o,i);return console.log("[SmartStore] Results: ",l),{records:l,totalSize:l.length}}return Po(e)}function Io(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())?v.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 A_(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")):v.highLevelApi.API.request("crm_smart_object_metadata",e)}function v_(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 o=t.objects[n];if(!o||typeof o!="object"||Array.isArray(o))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)),v.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 y_(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")):v.highLevelApi.API.request("crm_smart_object_validation_rules",e)}function S_(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")):v.highLevelApi.API.request("crm_smart_object_layout",e)}function T_(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 o=t.ids[n];if(!o||typeof o!="string"||o.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)),v.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 b_(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 v.highLevelApi.API.request("crm_create",e)}function O_(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 v.highLevelApi.API.request("crm_upsert",e)}function P_(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")):v.highLevelApi.API.request("crm_describe",e):Promise.reject(new Error("Payload is required"))}function I_(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")):v.highLevelApi.API.request("crm_layout",e):Promise.reject(new Error("Payload is required"))}function C_(e){return this.API.request("get_folders",e)}function R_(e={id:"root"}){return this.API.request("get_folder",e)}function N_(e){return this.API.request("create_folder",e)}function L_(e){return this.API.request("update_folder",e)}function D_(e){return this.API.request("delete_folder",e)}function U_(e){return this.API.request("move_folder_items",e)}function $_(e){return this.API.request("get_core_folders",e)}function M_(e,t){return this.API.request("patch_core_folder",{id:e,payload:t})}function j_(e){return e.type||(e.type="native"),v.highLevelApi.API.request("notify",e)}function x_(e){return v.highLevelApi.API.request("track",e)}function F_(e){return this.API.request("get_instance_metadata_templates",e)}function W_(){return this.API.request("trigger_non_files_sync")}function q_(e){return v.highLevelApi.API.request("submit_user_feedback",e)}function G_(){return v.highLevelApi.API.request("close")}function z_(e){return this.API.request("open_web_view_always_on_top",e)}function H_(e){return this.API.request("show_syncbox",e)}async function B_(e){return this.API.request("share",e)}async function V_(e){return this.API.request("show_peer_session",e)}function Y_(e){return this.API.request("get_themes",e)}function Z_(e){return this.API.request("assign_canvas_theme",e)}const Co=["STT_DISABLED","STT_DEVICE_UNSUPPORTED","STT_MODEL_NOT_READY","STT_BUSY","STT_MIC_PERMISSION_DENIED","STT_NOT_RECORDING","STT_CAPTURE_FAILED","STT_ERROR"];function Ro(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 Q_(e){return this.API.request("stt.start",e).catch(t=>{throw Ro(t)})}function X_(){return this.API.request("stt.availability")}function K_(){return this.API.request("stt.warmup")}function J_(e){return this.API.request("stt.stop",e).catch(t=>{throw Ro(t)})}function k_(e){const t=e,n=t?.code??t?.error_code??t?.errorCode;if(typeof n=="string"&&Co.includes(n))return n;const o=typeof t?.reason=="string"?t.reason:typeof t?.message=="string"?t.message:"";return Co.find(i=>o.includes(i))}const No=["TTS_EMPTY_TEXT","TTS_VOICE_UNAVAILABLE","TTS_ERROR"];function ep(e){return this.API.request("tts.speak",e)}function tp(){return this.API.request("tts.stop")}function np(e){const t=e,n=t?.code??t?.error_code??t?.errorCode;if(typeof n=="string"&&No.includes(n))return n;const o=typeof t?.reason=="string"?t.reason:typeof t?.message=="string"?t.message:"";return No.find(i=>o.includes(i))}const rp=Object.freeze(Object.defineProperty({__proto__:null,aiComplete:wo,aiGetCapabilities:il,appsDbDeleteEntry:ml,appsDbGetEntries:hl,appsDbPsql:Al,appsDbUpsertEntry:gl,assignCanvasTheme:Z_,close:G_,createCanvas:Pl,createFile:Hl,createFolder:N_,crmCreate:b_,crmDescribe:P_,crmLayout:I_,crmQuery:Po,crmQueryAdaptive:w_,crmSmartDeleteObjects:T_,crmSmartObjectLayout:S_,crmSmartObjectMetadata:A_,crmSmartObjectValidationRules:y_,crmSmartQuery:Io,crmSmartUpsertObjects:v_,crmUpsert:O_,deleteCanvas:Il,deleteFile:zl,deleteFolder:D_,deleteLocalFile:Vl,downloadFile:xl,fetchDocumentInfo:Jl,getAppConfig:Fl,getCanvas:Nl,getCanvasRecommendedFiles:Ul,getCanvasTheme:$l,getCanvases:Ol,getCoreFolders:$_,getEnv:Sl,getFile:Wl,getFileRevisionData:ql,getFileRevisions:Yl,getFiles:jl,getFolder:R_,getFolders:C_,getInstanceMetadataTemplates:F_,getSectionsByIds:Ll,getThemes:Y_,getUsers:Ql,isOffline:bl,moveFolderItems:U_,notify:j_,open:vl,openExternalUrl:yl,openWebViewAlwaysOnTop:z_,patchCoreFolder:M_,piaSearchAnswer:sl,query:__,refreshAccessToken:Kl,refreshServiceToken:Xl,renderPageAsImage:kl,search:Zl,selectDeviceFile:Bl,share:B_,shareCanvas:Dl,showPeerSession:V_,showSyncbox:H_,sttAvailability:X_,sttErrorCode:k_,sttStart:Q_,sttStop:J_,sttWarmup:K_,submitUserFeedback:q_,toast:e_,track:x_,triggerNonFilesSync:W_,ttsErrorCode:np,ttsSpeak:ep,ttsStop:tp,unassignCanvasTheme:Ml,updateCanvas:Cl,updateCanvasIndicators:Rl,updateFile:Gl,updateFolder:L_,updateMyUser:Tl},Symbol.toStringTag,{value:"Module"}));class Lo{listeners={};on(t,n){this.listeners[t]=(this.listeners[t]??[]).concat(n)}off(t,n){this.listeners[t]=(this.listeners[t]??[]).filter(o=>o!==n)}emit(t,n){(this.listeners[t]??[]).forEach(o=>o(n))}}const J=[];for(let e=0;e<256;++e)J.push((e+256).toString(16).slice(1));function op(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 ip=new Uint8Array(16);function sp(){return crypto.getRandomValues(ip)}function ap(e,t,n){return crypto.randomUUID?crypto.randomUUID():cp(e)}function cp(e,t,n){e=e||{};const o=e.random??e.rng?.()??sp();if(o.length<16)throw new Error("Random bytes length must be >= 16");return o[6]=o[6]&15|64,o[8]=o[8]&63|128,op(o)}const up="PITCHER_EVENT";var Ct=(e=>(e.REQUEST="PITCHER_REQUEST",e.RESPONSE="PITCHER_RESPONSE",e))(Ct||{}),Rt=(e=>(e.OK="ok",e.ERROR="error",e))(Rt||{}),nt=(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))(nt||{}),Do=(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))(Do||{}),Uo=(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))(Uo||{});class fp extends Error{}function dp(e,t){if(!e)throw new fp(t)}const $o=["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"],Mo=["context","overrides","filters","metadata","style","hidden"],jo=(e,t)=>t.includes(e)||e.endsWith("style"),rt=(e,t=$o,n=Mo)=>Array.isArray(e)?e.map(o=>rt(o,t,n)):e!=null&&e.constructor===Object?Object.keys(e).reduce((o,i)=>{const a=jo(i,n),f=t.includes(i)||a?i:du(i),l=a?e[i]:rt(e[i],t,n);return{...o,[f]:l}},{}):e,mn=(e,t=$o,n=Mo)=>Array.isArray(e)?e.map(o=>mn(o,t,n)):e!=null&&e.constructor===Object?Object.keys(e).reduce((o,i)=>{const a=jo(i,n),f=t.includes(i)||a?i:go(i),l=a?e[i]:mn(e[i],t,n);return{...o,[f]:l}},{}):e;function En(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=>En(i,t-1,n));const o=Object.keys(e);return o.length>n&&t<=0?`{Truncated - ${o.length} properties obj}`:o.reduce((i,a)=>(i[a]=En(e[a],t-1,n),i),{})}function lp(e,t=[],n=["development","test"].includes("production")){if(n)return!0;if(!e||!e.origin)return!1;const o=[...t,window.location.origin,"pitcher.com"],i=o.includes(e.origin)||o.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 wn=5,xo=1e3;let ot=null;async function _p(){return ot||(console.info("Refreshing access token..."),ot=(async()=>{try{return await v.highLevelApi.refreshAccessToken().then(e=>v.highLevelApi.getEnv().then(t=>(Fo(t),e.access_token)))}catch(e){throw console.error("Failed to refresh token:",e),e}finally{ot=null}})(),ot)}function it(e){const t=new URLSearchParams;function n(o,i){if(i!=null)if(Array.isArray(i))i.forEach(a=>n(o,a));else if(typeof i=="object"&&!Array.isArray(i))for(const a in i)n(`${o}[${a}]`,i[a]);else t.append(o,i)}for(const o in e)n(o,e[o]);return t.toString()}async function Ee(e,t,n=wn){try{const o=await fetch(e,t);if(!o.ok)if(o.status===401){const i=await _p();return t.headers=t.headers||{},t.headers.Authorization=`Bearer ${i}`,Ee(e,t,n)}else if(o.status>=500&&o.status<600&&n>0){const i=xo*Math.pow(2,wn-n);return await new Promise(a=>setTimeout(a,i)),Ee(e,t,n-1)}else{const i=await o.json(),a=new Error(`HTTP error! status: ${o.status}, message: ${i.message||o.statusText}`);throw a.status=o.status,a}return o.status===204||o.status===205?void 0:o.json()}catch(o){if(n>0&&!(o instanceof TypeError)&&o.status!==404){const i=xo*Math.pow(2,wn-n);return await new Promise(a=>setTimeout(a,i)),Ee(e,t,n-1)}throw o}}function pp(e,t){const n={"Content-Type":"application/json",Authorization:`Bearer ${t}`},o="/api/v1",i={credentials:"include"};return{get:async(a,f={})=>{const l=new URL(`${e}${o}${a}`);return f.params&&(l.search=it(f.params)),await Ee(l.toString(),{...i,...f,method:"GET",headers:n})},post:async(a,f,l={})=>{const p=new URL(`${e}${o}${a}`);return l.params&&(p.search=it(l.params)),await Ee(p.toString(),{...i,...l,method:"POST",headers:n,body:JSON.stringify(f)})},put:async(a,f,l={})=>{const p=new URL(`${e}${o}${a}`);return l.params&&(p.search=it(l.params)),await Ee(p.toString(),{...i,...l,method:"PUT",headers:n,body:JSON.stringify(f)})},delete:async(a,f={})=>{const l=new URL(`${e}${o}${a}`);return f.params&&(l.search=it(f.params)),await Ee(l.toString(),{...i,...f,method:"DELETE",headers:n})},patch:async(a,f,l={})=>{const p=new URL(`${e}${o}${a}`);return l.params&&(p.search=it(l.params)),await Ee(p.toString(),{...i,...l,method:"PATCH",headers:n,body:JSON.stringify(f)})},patchUrl:async(a,f,l={})=>await Ee(a,{...i,...l,method:"PATCH",headers:n,body:JSON.stringify(f)})}}function hp(e){return e?Object.entries(e).reduce((t,[n,o])=>(t[n]=n.endsWith("__range")&&Array.isArray(o)?o.join(","):o,t),{}):{}}let le,k;function re(){if(!le)throw new Error("Missing env");if(!k)throw new Error("Missing http")}function Nt(e){return Xd(e??{},t=>t!=null)}const Fo=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=Wd({},le,e),n&&(k=pp(le.pitcher.token_claims["https://pitcher.com/claims/urls"].custom_domain,le.pitcher.access_token))},Wo={get_canvases:async e=>{re();const{api_base_url:t,filters:n={},...o}=e;return await k.get("/canvases",{params:{instance_id:le.pitcher.instance.id,...hp(n),...Nt(o)}})},get_canvas:async e=>{re();const{id:t,...n}=e;return await k.get(`/canvases/${e.id}`,{params:n})},get_canvas_sections_by_ids:async e=>(re(),await k.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 k.post("/canvases",{...e,instance_id:le.pitcher.instance.id})),update_canvas:async e=>{re();const{id:t,fields:n,...o}=e;if(le?.launch_darkly?.enable_canvas_core_patch===!0){const f=le.pitcher.token_claims["https://pitcher.com/claims/urls"].custom_domain,l=n?`?fields=${encodeURIComponent(n)}`:"",p=`${f}/core/api/protected/v1/canvases/${t}${l}`;return await k.patchUrl(p,o)}return await k.patch(`/canvases/${t}`,{fields:n,...o})},delete_canvas:async e=>(re(),await k.delete(`/canvases/${e.id}`)),share_canvas:async e=>{re();let t;try{t=await k.get(`/shared-links/canvas/${e.id}`)}catch(n){if(n?.status===404)t=await k.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 k.get(`/canvases/${t}/recommended_files`,{params:n})},get_collaborations:async e=>(re(),await k.get("/collaborations",{params:Nt(e)})),create_collaboration:async e=>(re(),await k.post("/collaborations",e)),delete_collaboration:async e=>{re();const{collaboration_id:t}=e;return await k.delete(`/collaborations/${t}`)},get_instance_memberships:async e=>(re(),await k.get("/instance-memberships",{params:Nt(e)})),get_content_distribution_groups:async e=>(re(),await k.get("/content-distribution-groups",{params:Nt(e)}))};function An(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 An(e.parent)}catch{}return e}const gp=10,qo=["appsdb_get_entries","appsdb_upsert_entry","appsdb_delete_entry"],mp=["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 Ep(e){e&&Fo(e)}class wp extends Lo{constructor(t){super(),this.callbacks={},this.options=t??{casing:"snake",logLevel:"off",errorLogger:()=>{},fetchMode:"postmessage"},typeof window<"u"&&(window.addEventListener("message",n=>{lp(n)&&(this.options.logLevel==="debug"&&console.log("message received",n),n.data.type==="PITCHER_RESPONSE"?(dp(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"?rt(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 o=this.options.fetchMode??"postmessage";return new Promise((i,a)=>{const f=ap(),l=T=>{if(this.options.logLevel==="debug"&&console.log(`Callback ${f} response:`,T),T.response.status==="ok")i(this.options.casing==="camel"&&!qo.includes(t)?rt(T.response.body):T.response.body),t==="get_env"&&Ep(T.response.body);else if(T.response.status==="error")this.options.errorLogger&&this.options.errorLogger({type:T.request.type,message:`Pitcher JS API call failure: ${T.request.type}`,js_api_response:JSON.stringify(En(T,3,gp))}),a(this.options.casing==="camel"&&!qo.includes(t)?rt(T.response.body):T.response.body);else throw new Error("unsupported response status")},p=mp.includes(t),b=so(p?n:mn(n));if(this.callbacks[f]={dispatched_at:Date.now(),type:t,payload:b??{},callback:l},o==="prefer-online"&&t&&Wo[t])Wo[t](b).then(T=>{this.callbacks[f]&&(this.callbacks[f].callback({type:Ct.RESPONSE,request:{id:f,type:t},response:{status:Rt.OK,body:T}}),delete this.callbacks[f])}).catch(T=>{this.callbacks[f]&&(this.callbacks[f].callback({type:Ct.RESPONSE,request:{id:f,type:t},response:{status:Rt.ERROR,body:T}}),delete this.callbacks[f])});else{const T=An(window);typeof T<"u"&&T&&T.postMessage({type:"PITCHER_REQUEST",request:{type:t,id:f,body:b}},"*")}})}}function Ap(e){const t=new wp(e),n=new Lo;return t.on("event",o=>{n.emit(o.type,o.body)}),{API:t,...rp,on:(o,i)=>n.on(o,i),off:(o,i)=>n.off(o,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:o=>t.request("broadcast",o),broadcastToWebviews:o=>t.request("broadcast_to_webviews",o),subscribe:()=>t.request("subscribe"),unsubscribe:()=>t.request("unsubscribe")}}function O(){return window.postRobot?window.postRobot:Promise.resolve().then(()=>Ii).then(e=>e.default||e)}const vp="UI_MESSAGE",D={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"},we={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"},Go=[we.UI_APP_SET_DATA,we.UI_APP_UPDATE_DATA,we.UI_CANVAS_UPDATED];async function yp(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,D.UI_SELECT_CONTENT,e)).data}async function Sp(e={}){return(await(await O()).send(window.parent,D.UI_SELECT_CONTENT,e)).data}async function Tp(e){await(await O()).send(window.parent,D.UI_OPEN,e)}async function bp(e){await(await O()).send(window.parent,D.UI_TOAST,e)}async function Op(e){return(await(await O()).send(window.parent,D.UI_PRESELECT_SFDC_MEETING_ID,e)).data}async function Pp(e={}){return(await(await O()).send(window.parent,D.UI_SELECT_COLLECTION_PLAYER_CONTENT,e)).data}async function Ip(e={}){return(await(await O()).send(window.parent,D.UI_SELECT_AGENDA_CONTENT,e)).data}async function Cp(e,t){const n=await O(),o={app_name:e,extra_context:t};return(await n.send(window.parent,D.UI_OPEN_GLOBAL_POPUP,o)).data}async function Rp(){await(await O()).send(window.parent,D.UI_CLOSE_GLOBAL_POPUP,{})}const Np=Object.freeze(Object.defineProperty({__proto__:null,closeGlobalPopup:Rp,open:Tp,openGlobalPopup:Cp,preselectSfdcMeetingId:Op,selectAgendaContent:Ip,selectCollectionContent:Pp,selectContent:Sp,toast:bp,ui_select_content:yp},Symbol.toStringTag,{value:"Module"}));async function Lp(){await(await O()).send(window.parent,D.UI_EMBEDDABLE_READY)}const Dp=Object.freeze(Object.defineProperty({__proto__:null,embeddableReady:Lp},Symbol.toStringTag,{value:"Module"}));async function Up(e){return(await O()).send(An(),D.UI_UPDATE_LOCATION,e)}const $p=Object.freeze(Object.defineProperty({__proto__:null,updateLocation:Up},Symbol.toStringTag,{value:"Module"}));async function Mp(e){(await O()).send(window.parent,D.UI_CAPTURE_APP_ERROR,e)}const jp=Object.freeze(Object.defineProperty({__proto__:null,captureAppError:Mp},Symbol.toStringTag,{value:"Module"}));async function xp(e){return(await O()).send(window.parent,D.UI_UPDATE_CANVAS,e).then(n=>n.data)}async function Fp(e){return(await O()).send(window.parent,D.UI_PRINT_CANVAS,e).then(n=>n.data)}async function Wp(){window.parent.postMessage({type:D.UI_APP_LOADED,body:{}},"*")}async function qp(e){window.parent.postMessage({type:D.UI_APP_RESIZE,body:e},"*")}async function Gp(){window.parent.postMessage({type:D.UI_CLOSE_CANVAS_SECTION_EXECUTION,body:{}},"*")}async function zp(){window.parent.postMessage({type:D.UI_CLOSE_CANVAS_DRAWER,body:{}},"*")}async function Hp(){(await O()).send(window.parent,D.UI_CANVAS_NAVIGATE_NEXT_PAGE)}async function Bp(){(await O()).send(window.parent,D.UI_CANVAS_NAVIGATE_PREVIOUS_PAGE)}async function Vp(e){(await O()).send(window.parent,D.UI_CANVAS_NAVIGATE_PAGE,e)}async function Yp(e){await(await O()).send(window.parent,D.UI_OPEN_CANVAS_OVERLAY,e)}async function Zp(e){await(await O()).send(window.parent,D.UI_OPEN_COLLECTION_PLAYER_OVERLAY,e)}async function Qp(e={}){return(await(await O()).send(window.parent,D.UI_SELECT_CANVASES,e)).data}const Xp=Object.freeze(Object.defineProperty({__proto__:null,appLoaded:Wp,appResize:qp,canvasNavigateNextPage:Hp,canvasNavigatePage:Vp,canvasNavigatePreviousPage:Bp,closeCanvasDrawer:zp,closeCanvasSectionExecution:Gp,openCanvasOverlay:Yp,openCollectionPlayerOverlay:Zp,printCanvas:Fp,selectCanvases:Qp,updateCanvas:xp},Symbol.toStringTag,{value:"Module"}));async function Kp(e){(await O()).send(window.parent,D.UI_COMPLETE_POSTCALL,e)}async function Jp(){(await O()).send(window.parent,D.UI_CANCEL_MEETING)}async function kp(){(await O()).send(window.parent,D.UI_RESUME_MEETING)}async function eh(){(await O()).send(window.parent,D.UI_STOP_MEETING)}async function th(){(await O()).send(window.parent,D.UI_ENABLE_POSTCALL_SUBMIT)}async function nh(){(await O()).send(window.parent,D.UI_DISABLE_POSTCALL_SUBMIT)}async function rh(e){(await O()).send(window.parent,D.UI_SET_POSTCALL_STYLE,e)}const oh=Object.freeze(Object.defineProperty({__proto__:null,cancelMeeting:Jp,completePostcall:Kp,disablePostcallSubmit:nh,enablePostcallSubmit:th,resumeMeeting:kp,setPostcallStyle:rh,stopMeeting:eh},Symbol.toStringTag,{value:"Module"}));async function ih(e){return(await(await O()).send(window.parent,D.UI_PROMPT_PIA,e)).data}const sh=Object.freeze(Object.defineProperty({__proto__:null,promptPia:ih},Symbol.toStringTag,{value:"Module"}));async function ah(e){return(await(await O()).send(window.parent,D.UI_OPEN_SHARING_SETTINGS,e)).data}const ch=Object.freeze(Object.defineProperty({__proto__:null,openSharingSettings:ah},Symbol.toStringTag,{value:"Module"}));async function uh(e,t){const n=o=>{o.data.type===e&&t(o.data.body)};return window.addEventListener("message",n),()=>window.removeEventListener("message",n)}async function fh(e,t){return(await O()).on(e,i=>t(i.data)).cancel}function We(e,t){return Go.includes(e)?uh(e,t):fh(e,t)}function dh(e){return We(we.UI_MEETING_CANCELED,e)}function lh(e){return We(we.UI_CANVAS_UPDATED,e)}function _h(e){return We(we.UI_SECTION_LIST_UPDATED,e)}function ph(e){return We(we.UI_APP_SET_DATA,e)}function hh(e){return We(we.UI_APP_UPDATE_DATA,e)}async function gh(e){(await O()).send(window.parent,D.UI_BROADCAST,e)}const mh={on:We,onMeetingCanceled:dh,onCanvasUpdated:lh,onSectionListUpdated:_h,onAppSetData:ph,onAppUpdateData:hh,uiBroadcast:gh,...Np,...Dp,...$p,...jp,...Xp,...oh,...sh,...ch},Eh="ADMIN_MESSAGE",wh={ENV_CHANGED:"admin_env_changed"},Ah={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 vh(e){(await O()).send(window.parent,V.CAPTURE_APP_ERROR,e)}const yh=Object.freeze(Object.defineProperty({__proto__:null,captureAppError:vh},Symbol.toStringTag,{value:"Module"}));async function Sh(){const n=(await(await O()).send(window.parent,V.GET_ENV)).data;return pn(n,"pitcher.org_config.segment")}const Th=Object.freeze(Object.defineProperty({__proto__:null,getEnv:Sh},Symbol.toStringTag,{value:"Module"}));async function bh(e){return(await(await O()).send(window.parent,V.CREATE_CANVAS,e)).data}async function Oh(e){return(await(await O()).send(window.parent,V.GET_CANVASES,e)).data}async function Ph(e){return(await(await O()).send(window.parent,V.GET_CANVAS,e)).data}async function Ih(e){return(await(await O()).send(window.parent,V.UPDATE_CANVAS,e)).data}async function Ch(e){await(await O()).send(window.parent,V.OPEN_CANVAS_OVERLAY,e)}async function Rh(e){await(await O()).send(window.parent,V.OPEN_COLLECTION_PLAYER_OVERLAY,e)}async function Nh(e={}){return(await(await O()).send(window.parent,V.SELECT_CANVASES,e)).data}const Lh=Object.freeze(Object.defineProperty({__proto__:null,createCanvas:bh,getCanvas:Ph,getCanvases:Oh,openCanvasOverlay:Ch,openCollectionPlayerOverlay:Rh,selectCanvases:Nh,updateCanvas:Ih},Symbol.toStringTag,{value:"Module"}));async function Dh(e){return(await(await O()).send(window.parent,V.GET_INSTANCE_METADATA_TEMPLATES,e)).data}const Uh=Object.freeze(Object.defineProperty({__proto__:null,getInstanceMetadataTemplates:Dh},Symbol.toStringTag,{value:"Module"}));async function $h(e){return(await(await O()).send(window.parent,V.GET_APP_CONFIG,e)).data}async function Mh(e){return(await(await O()).send(window.parent,V.GET_FILE,e)).data}async function jh(e){return(await(await O()).send(window.parent,V.GET_FILES,e)).data}async function xh(e){await(await O()).send(window.parent,V.OPEN,e)}async function Fh(){await(await O()).send(window.parent,V.CLOSE)}const Wh=Object.freeze(Object.defineProperty({__proto__:null,close:Fh,getAppConfig:$h,getFile:Mh,getFiles:jh,open:xh},Symbol.toStringTag,{value:"Module"}));async function qh(e={}){return(await(await O()).send(window.parent,V.SELECT_COLLECTION_PLAYER_CONTENT,e)).data}async function Gh(e={}){return(await(await O()).send(window.parent,V.SELECT_AGENDA_CONTENT,e)).data}async function zh(e){return(await(await O()).send(window.parent,V.SELECT_CONTENT,e)).data}const Hh=Object.freeze(Object.defineProperty({__proto__:null,selectAgendaContent:Gh,selectCollectionContent:qh,selectContent:zh},Symbol.toStringTag,{value:"Module"}));async function Bh(e){return(await(await O()).send(window.parent,V.GET_USERS,e)).data}const Vh=Object.freeze(Object.defineProperty({__proto__:null,getUsers:Bh},Symbol.toStringTag,{value:"Module"}));async function Yh(e,t){return(await O()).on(e,i=>t(i.data)).cancel}async function Zh(e){await(await O()).send(window.parent,V.TOAST,e)}const Qh={on:Yh,toast:Zh,...yh,...Hh,...Th,...Lh,...Uh,...Wh,...Vh},Xh="DSR_MESSAGE",Kh={ENV_CHANGED:"dsr_env_changed"},Jh={DSR_REQUEST:"DSR_REQUEST",DSR_RESPONSE:"DSR_RESPONSE"},qe={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 kh(){const n=(await(await O()).send(window.parent,qe.GET_ENV)).data;return pn(n,"pitcher.org_config.segment")}const eg=Object.freeze(Object.defineProperty({__proto__:null,getEnv:kh},Symbol.toStringTag,{value:"Module"}));async function tg(){await(await O()).send(window.parent,qe.DSR_EMBEDDABLE_READY)}const ng=Object.freeze(Object.defineProperty({__proto__:null,embeddableReady:tg},Symbol.toStringTag,{value:"Module"}));async function rg(){await(await O()).send(window.parent,qe.CLOSE)}async function og(e){return(await(await O()).send(window.parent,qe.GET_FILE,e)).data}async function ig(e){return(await(await O()).send(window.parent,qe.GET_APP_CONFIG,e??{})).data}const sg=Object.freeze(Object.defineProperty({__proto__:null,close:rg,getAppConfig:ig,getFile:og},Symbol.toStringTag,{value:"Module"}));async function ag(e,t){return(await O()).on(e,i=>t(i.data)).cancel}const cg={on:ag,...eg,...ng,...sg},ug="peer_connectivity_event",fg={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"},zo=1,vn="*",Ce=new Map;let Ge=null,yn=null;function Sn(){const e=globalThis.crypto;return e?.randomUUID?e.randomUUID():`peer-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`}function Ho(e,t){const n=e.metadata??{};return{version:e.version??t?.version??zo,action:e.action,context:e.context??t?.context,data:e.data??t?.data,metadata:{correlationId:n.correlationId??t?.metadata?.correlationId??Sn(),source:n.source??t?.metadata?.source??"web",timestamp:n.timestamp??t?.metadata?.timestamp??Date.now(),extras:{...t?.metadata?.extras??{},...n.extras??{}}}}}function dg(e,t){const n=e||vn,o=Ce.get(n)??new Set;o.add(t),Ce.set(n,o)}function lg(e,t){const n=Ce.get(e);n&&(n.delete(t),n.size||Ce.delete(e),Ce.size||pg())}async function _g(){if(Ge)return;const e=Ae(),t=n=>{try{const o=Ho(n,{metadata:{correlationId:Sn(),source:"native",timestamp:Date.now(),extras:{}}});hg(o)}catch(o){console.error("[peer-connectivity] Failed to handle native event:",o)}};e.on(nt.PEER_CONNECTIVITY_EVENT,t),Ge=()=>{e.off(nt.PEER_CONNECTIVITY_EVENT,t),Ge=null}}function pg(){Ge&&(Ge(),Ge=null)}function hg(e){const t=Ce.get(e.action),n=Ce.get(vn);if(!t&&!n)return;const o=Object.freeze(e);t?.forEach(i=>{try{i(o)}catch(a){console.error(`[peer-connectivity] Handler error for action "${e.action}":`,a)}}),n?.forEach(i=>{try{i(o)}catch(a){console.error("[peer-connectivity] Handler error for wildcard action:",a)}})}async function gg(){return yn||(yn=Ae().getEnv().then(t=>t.mode==="IOS").catch(t=>(console.error("[peer-connectivity] Failed to determine environment support:",t),!1))),yn}function Bo(e){return Array.isArray(e)?e:[e]}function mg(e,t){return Bo(e).forEach(n=>{dg(n,t)}),_g().catch(n=>{console.error("[peer-connectivity] Failed to register native listener:",n)}),()=>{Bo(e).forEach(n=>{lg(n,t)})}}async function Eg(e,t){if(!e?.action){console.warn("[peer-connectivity] Attempted to send an event without action");return}if(t?.isFeatureEnabled===!1||!await gg())return;const o=Ae(),i=Ho(e,{metadata:{correlationId:Sn(),source:"web",timestamp:Date.now(),extras:{}}});try{await o.broadcast({type:nt.PEER_CONNECTIVITY_EVENT,body:i})}catch(a){console.error("[peer-connectivity] Failed to send event:",a)}}v.highLevelApi=void 0;let Vo;function Ae(e){return(!v.highLevelApi||!Fd(e,Vo))&&(v.highLevelApi=Ap(e),Vo=e),v.highLevelApi}function Tn(e){return Object.entries(e).forEach(([t,n])=>{const o=go(t);o&&!e[o]&&(e[o]=n)}),e}const wg=Tn(mh),Ag=Tn(Qh),vg=Tn(cg);function bn(){return wg}function Yo(){return Ag}function Zo(){return vg}function yg(){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 Sg(e){if(typeof window>"u")throw new Error("useApi: window is not defined");switch(window.parent.jsApiLocation){case"ui":return{...Ae(),...bn(),ui:bn(),impact:Ae()};case"admin":return Yo();case"dsr":return{...Zo(),broadcast:Ae().broadcast};case"impact":return Ae(e);default:return Ae(e)}}window.postRobot=Wn,v.ADMIN_API_METHOD_TYPES=V,v.ADMIN_API_TYPES=Ah,v.ADMIN_MESSAGE=Eh,v.ADMIN_MESSAGE_TYPES=wh,v.DEFAULT_PEER_CONNECTIVITY_VERSION=zo,v.DSR_API_METHOD_TYPES=qe,v.DSR_API_TYPES=Jh,v.DSR_MESSAGE=Xh,v.DSR_MESSAGE_TYPES=Kh,v.PEER_CONNECTIVITY_EVENT=ug,v.PEER_CONNECTIVITY_HANDLER_MATCH_ALL=vn,v.PITCHER_EVENT=up,v.PeerConnectivityActions=fg,v.PitcherBroadcastedEventName=Do,v.PitcherEventName=nt,v.PitcherExternalEventName=Uo,v.PitcherMessageType=Ct,v.PitcherResponseStatus=Rt,v.UI_API_METHOD_TYPES=D,v.UI_MESSAGE=vp,v.UI_MESSAGE_TYPES=we,v.UI_NATIVE_MESSAGE_TYPES=Go,v.getAvailableApis=yg,v.registerPeerConnectivityHandler=mg,v.sendPeerConnectivityEvent=Eg,v.useAdmin=Yo,v.useApi=Sg,v.useDsr=Zo,v.usePitcherApi=Ae,v.useUi=bn,Object.defineProperty(v,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 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"})}));
|
|
25
46
|
//# sourceMappingURL=js-api.umd.min.js.map
|