@applitools/dom-snapshot 4.16.4 → 4.17.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/CHANGELOG.md +48 -0
- package/dist/pollResult.js +2 -2
- package/dist/pollResult.js.map +1 -1
- package/dist/pollResultCjs.js +2 -2
- package/dist/pollResultCjs.js.map +1 -1
- package/dist/pollResultEs.js +2 -2
- package/dist/pollResultEs.js.map +1 -1
- package/dist/processPage.js +3 -3
- package/dist/processPage.js.map +1 -1
- package/dist/processPagePoll.js +3 -3
- package/dist/processPagePoll.js.map +1 -1
- package/dist/processPagePollCjs.js +3 -3
- package/dist/processPagePollCjs.js.map +1 -1
- package/dist/processPagePollEs.js +3 -3
- package/dist/processPagePollEs.js.map +1 -1
- package/package.json +5 -5
- package/dist/build/plugins/sandbox-wrapper.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,54 @@
|
|
|
9
9
|
- fix style programmatic generated fallback
|
|
10
10
|
- performance boost
|
|
11
11
|
|
|
12
|
+
## [4.17.0](https://github.com/Applitools-Dev/sdk/compare/js/dom-snapshot@4.16.4...js/dom-snapshot@4.17.0) (2026-05-05)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* add bypassCSP support for UFG snapshot capture ([#3783](https://github.com/Applitools-Dev/sdk/issues/3783)) ([9e98933](https://github.com/Applitools-Dev/sdk/commit/9e98933b8ffba2ad1928aa2b2110e9a25209a599))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* re-trigger release for dom-snapshot (FLD-4452) and mcp (AD-13206) ([#3800](https://github.com/Applitools-Dev/sdk/issues/3800)) ([105dd42](https://github.com/Applitools-Dev/sdk/commit/105dd42010a56c454752eaca69380aaba085073e))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* @applitools/dom-shared bumped to 1.2.0
|
|
28
|
+
#### Features
|
|
29
|
+
|
|
30
|
+
* add bypassCSP support for UFG snapshot capture ([#3783](https://github.com/Applitools-Dev/sdk/issues/3783)) ([9e98933](https://github.com/Applitools-Dev/sdk/commit/9e98933b8ffba2ad1928aa2b2110e9a25209a599))
|
|
31
|
+
* @applitools/snippets bumped to 2.9.0
|
|
32
|
+
#### Features
|
|
33
|
+
|
|
34
|
+
* add bypassCSP support for UFG snapshot capture ([#3783](https://github.com/Applitools-Dev/sdk/issues/3783)) ([9e98933](https://github.com/Applitools-Dev/sdk/commit/9e98933b8ffba2ad1928aa2b2110e9a25209a599))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
* @applitools/driver bumped to 1.26.0
|
|
39
|
+
#### Features
|
|
40
|
+
|
|
41
|
+
* add bypassCSP support for UFG snapshot capture ([#3783](https://github.com/Applitools-Dev/sdk/issues/3783)) ([9e98933](https://github.com/Applitools-Dev/sdk/commit/9e98933b8ffba2ad1928aa2b2110e9a25209a599))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
* @applitools/spec-driver-webdriver bumped to 1.6.0
|
|
46
|
+
#### Features
|
|
47
|
+
|
|
48
|
+
* add bypassCSP support for UFG snapshot capture ([#3783](https://github.com/Applitools-Dev/sdk/issues/3783)) ([9e98933](https://github.com/Applitools-Dev/sdk/commit/9e98933b8ffba2ad1928aa2b2110e9a25209a599))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
* @applitools/spec-driver-puppeteer bumped to 1.8.0
|
|
53
|
+
#### Features
|
|
54
|
+
|
|
55
|
+
* add bypassCSP support for UFG snapshot capture ([#3783](https://github.com/Applitools-Dev/sdk/issues/3783)) ([9e98933](https://github.com/Applitools-Dev/sdk/commit/9e98933b8ffba2ad1928aa2b2110e9a25209a599))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
12
60
|
## [4.16.4](https://github.com/Applitools-Dev/sdk/compare/js/dom-snapshot@4.16.3...js/dom-snapshot@4.16.4) (2026-04-16)
|
|
13
61
|
|
|
14
62
|
|
package/dist/pollResult.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* @applitools/dom-snapshot@4.
|
|
1
|
+
/* @applitools/dom-snapshot@4.17.0 */
|
|
2
2
|
function __pollResult() {
|
|
3
|
-
var pollResult=function(){"use strict";return function(){
|
|
3
|
+
var pollResult=function(){"use strict";return function(...t){const n=function(t,n,e){return function(){var t={};function r(t,n=0){const e=t.charCodeAt(n);return e>=55296&&e<56320?1024*(e-55296)+(t.charCodeAt(n+1)-56320)+65536:56320<=e&&e<=57343?-1:e}var o=function(t,n){const e=[];let o=0;for(let c=0;c<t.length;++c){const u=r(t,c);let i=0;u>0&&(i=u<128?1:u<2048?2:u<65536?3:u<2097152?4:u<67108864?5:6),o+i>n?(e.push(c),o=i):o+=i}return e};const c=function(t){return t&&t.__esModule?t:{default:t}}(o),u="WIP",i="SUCCESS",s="SUCCESS_CHUNKED",a="ERROR";var l=function(t,e,r={}){const o=function(t,{chunkByteLength:e=0}={}){var r;if(t){if(t.value){if(e){if(!t.chunks)try{const o=void 0!==n?null===(r=n.__EYES__APPLITOOLS__)||void 0===r?void 0:r._stringify:void 0,u=(null!=o?o:JSON.stringify)(t.value);t.chunks=(0,c.default)(u,e),t.chunks.length>0&&(t.from=0,t.value=u)}catch(t){return{status:a,error:t.message}}if(t.from>=0)return{status:s,value:t.value.substring(t.from,t.from=t.chunks.shift()),done:!t.from}}return{status:i,value:t.value}}return t.error?{status:a,error:t.error}:{status:u}}return{status:a,error:"unexpected poll request received - cannot find state of current operation"}}((t=t||{})[e],r);return(o.status===i||o.status===a||o.status===s&&o.done)&&delete t[e],o};const f=l;var d=function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.isAccessibleFrame=t.isInlineFrame=t.absolutizeUrl=p=t.poll=t.pollify=t.chunkify=void 0;const _=d(o);t.chunkify=_.default;const h=d((function(t,n,e){return r=>function(...o){return n[e]||(n[e]={},Promise.resolve().then((()=>t(...o))).then((t=>n[e].value=t)).catch((t=>n[e].error=t.message+"\nStack:"+t.stack))),f(n,e,r)}}));t.pollify=h.default;const y=d(l);var p=t.poll=y.default;const m=d((function(t,n){if(function(t){try{return new URL(t),!0}catch(t){return!1}}(t))return t;let e=!0;try{e=t!==decodeURI(t)}catch(t){e=!0}try{const r=new URL(t,n).href;return e?r:decodeURI(r)}catch(n){return e?t:decodeURI(t)}}));t.absolutizeUrl=m.default;const w=d((function(t){return t.contentDocument&&t.contentDocument.location&&!/^https?:$/.test(t.contentDocument.location.protocol)}));t.isInlineFrame=w.default;const S=d((function(t){try{const n=t.contentDocument;return Boolean(n&&n.defaultView&&n.defaultView.frameElement)}catch(t){return!1}}));return t.isAccessibleFrame=S.default,function(t){var n;const r=e.__EYES__APPLITOOLS__,o=null!==(n=null==r?void 0:r._stringify)&&void 0!==n?n:JSON.stringify;try{return o(p(r,"domSnapshotResult",t))}catch(t){return o({status:"ERROR",error:t.message})}}}()};let e=!0;try{let r=window.__applitools_sandbox;r||(r=document.createElement("iframe"),r.setAttribute("data-applitools-sandbox",""),r.setAttribute("data-applitools-skip",""),document.head.appendChild(r),window.__applitools_sandbox=r);const o=Math.floor(4294967296*Math.random()),c=r.contentDocument.createElement("script");c.textContent="window['ctor-"+o+"'] = "+n.toString()+";",r.contentDocument.head.appendChild(c);const u=r.contentWindow["ctor-"+o];if(delete r.contentWindow["ctor-"+o],"function"!=typeof u)throw new Error("Sandbox failed to extract function");e=!1;const i=r.contentWindow,s=i.__EYES__APPLITOOLS__=i.__EYES__APPLITOOLS__||{};s._stringify||(s._stringify=i.JSON.stringify.bind(i.JSON));const a=window.__EYES__APPLITOOLS__=window.__EYES__APPLITOOLS__||{};function l(t){if(i.Array.isArray(t)){const n=new i.Array(t.length);for(let e=0;e<t.length;e++)n[e]=l(t[e]);return n}if(t&&"object"==typeof t&&Object.getPrototypeOf(t)===Object.prototype){const n=new i.Object;for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=l(t[e]));return n}return t}a._stringify&&a._stringify!==JSON.stringify||(a._stringify=i.JSON.stringify.bind(i.JSON));const f=new i.Array(t.length);for(let d=0;d<t.length;d++)f[d]=l(t[d]);return u(document,window,i)(...f)}catch(_){try{return n(document,window,window)(...t)}catch(h){throw e?h:_}}}}();
|
|
4
4
|
//# sourceMappingURL=pollResult.js.map
|
|
5
5
|
|
|
6
6
|
return pollResult.apply(this, arguments);
|
package/dist/pollResult.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pollResult.js","sources":["../../dom-shared/dist/chunkify.js","../../dom-shared/dist/poll.js","../../dom-shared/dist/pollify.js","../../dom-shared/dist/browser/absolutizeUrl.js","../../dom-shared/dist/browser/isInlineFrame.js","../../dom-shared/dist/browser/isAccessibleFrame.js","../../dom-shared/dist/index.js","../src/browser/pollResult.ts","../src/browser/constants.ts"],"sourcesContent":["\"use strict\";\nfunction charCodeAt(string, index = 0) {\n const code = string.charCodeAt(index);\n // if the code of high word (16 bits) in this diapason the character encoded by two words\n if (code >= 0xd800 && code < 0xdc00) {\n const high = code;\n const low = string.charCodeAt(index + 1);\n // convert 2 utf16le words into integer code\n return (high - 0xd800) * 0x400 + (low - 0xdc00) + 0x10000;\n }\n // diapason is reserved for surrogates, we can skip it\n if (0xdc00 <= code && code <= 0xdfff)\n return -1;\n return code;\n}\nfunction chunkify(string, chunkByteLength) {\n const chunks = [];\n let currChunkByteLength = 0;\n for (let index = 0; index < string.length; ++index) {\n const code = charCodeAt(string, index);\n let charByteLength = 0;\n if (code > 0) {\n if (code < 128)\n charByteLength = 1;\n else if (code < 2048)\n charByteLength = 2;\n else if (code < 65536)\n charByteLength = 3;\n else if (code < 2097152)\n charByteLength = 4;\n else if (code < 67108864)\n charByteLength = 5;\n else\n charByteLength = 6;\n }\n if (currChunkByteLength + charByteLength > chunkByteLength) {\n chunks.push(index);\n currChunkByteLength = charByteLength;\n }\n else {\n currChunkByteLength += charByteLength;\n }\n }\n return chunks;\n}\nmodule.exports = chunkify;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nconst STATUSES = {\n WIP: 'WIP',\n SUCCESS: 'SUCCESS',\n SUCCESS_CHUNKED: 'SUCCESS_CHUNKED',\n ERROR: 'ERROR',\n};\nconst _DEFAULT_CHUNK_BYTE_LENGTH = 268435456; // 256MB\nfunction createPollResponse(state, { chunkByteLength = 0 } = {}) {\n if (!state) {\n return {\n status: STATUSES.ERROR,\n error: 'unexpected poll request received - cannot find state of current operation',\n };\n }\n else if (state.value) {\n if (chunkByteLength) {\n if (!state.chunks) {\n try {\n const stringified = JSON.stringify(state.value);\n state.chunks = (0, chunkify_1.default)(stringified, chunkByteLength);\n if (state.chunks.length > 0) {\n state.from = 0;\n state.value = stringified;\n }\n }\n catch (e) {\n return { status: STATUSES.ERROR, error: e.message };\n }\n }\n if (state.from >= 0) {\n return {\n status: STATUSES.SUCCESS_CHUNKED,\n value: state.value.substring(state.from, (state.from = state.chunks.shift())),\n done: !state.from,\n };\n }\n }\n return { status: STATUSES.SUCCESS, value: state.value };\n }\n else if (state.error) {\n return { status: STATUSES.ERROR, error: state.error };\n }\n else {\n return { status: STATUSES.WIP };\n }\n}\nfunction poll(context, key, options = {}) {\n context = context || {};\n const result = createPollResponse(context[key], options);\n if (result.status === STATUSES.SUCCESS ||\n result.status === STATUSES.ERROR ||\n (result.status === STATUSES.SUCCESS_CHUNKED && result.done)) {\n delete context[key];\n }\n return result;\n}\nmodule.exports = poll;\n","\"use strict\";\nconst poll = require(\"./poll\");\nfunction pollify(script, context, key) {\n return (options) => function (...args) {\n if (!context[key]) {\n context[key] = {};\n Promise.resolve()\n .then(() => script(...args))\n .then(value => (context[key].value = value))\n .catch(err => (context[key].error = err.message + '\\nStack:' + err.stack));\n }\n return poll(context, key, options);\n };\n}\nmodule.exports = pollify;\n","\"use strict\";\nfunction isAbsoluteUrl(url) {\n try {\n new URL(url);\n return true;\n }\n catch (err) {\n return false;\n }\n}\nfunction absolutizeUrl(url, baseUrl) {\n if (isAbsoluteUrl(url))\n return url;\n let isEncoded = true;\n try {\n isEncoded = url !== decodeURI(url);\n }\n catch (err) {\n isEncoded = true;\n }\n try {\n const absoluteUrl = new URL(url, baseUrl).href;\n return !isEncoded ? decodeURI(absoluteUrl) : absoluteUrl;\n }\n catch (err) {\n return !isEncoded ? decodeURI(url) : url;\n }\n}\nmodule.exports = absolutizeUrl;\n","\"use strict\";\nfunction isInlineFrame(frame) {\n return (frame.contentDocument &&\n frame.contentDocument.location &&\n !/^https?:$/.test(frame.contentDocument.location.protocol));\n}\nmodule.exports = isInlineFrame;\n","\"use strict\";\nfunction isAccessibleFrame(frame) {\n try {\n const doc = frame.contentDocument;\n return Boolean(doc && doc.defaultView && doc.defaultView.frameElement);\n }\n catch (err) {\n return false;\n }\n}\nmodule.exports = isAccessibleFrame;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isAccessibleFrame = exports.isInlineFrame = exports.absolutizeUrl = exports.poll = exports.pollify = exports.chunkify = void 0;\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nexports.chunkify = chunkify_1.default;\nconst pollify_1 = __importDefault(require(\"./pollify\"));\nexports.pollify = pollify_1.default;\nconst poll_1 = __importDefault(require(\"./poll\"));\nexports.poll = poll_1.default;\nconst absolutizeUrl_1 = __importDefault(require(\"./browser/absolutizeUrl\"));\nexports.absolutizeUrl = absolutizeUrl_1.default;\nconst isInlineFrame_1 = __importDefault(require(\"./browser/isInlineFrame\"));\nexports.isInlineFrame = isInlineFrame_1.default;\nconst isAccessibleFrame_1 = __importDefault(require(\"./browser/isAccessibleFrame\"));\nexports.isAccessibleFrame = isAccessibleFrame_1.default;\n",null,null],"names":["charCodeAt","string","index","code","chunkify_1","chunkByteLength","chunks","currChunkByteLength","length","charByteLength","push","mod","__esModule","default","__importDefault","require$$0","STATUSES","WIP","SUCCESS","SUCCESS_CHUNKED","ERROR","poll_1","context","key","options","result","state","value","stringified","JSON","stringify","from","e","status","error","message","substring","shift","done","createPollResponse","poll","pollify_1","script","args","Promise","resolve","then","catch","err","stack","absolutizeUrl_1","url","baseUrl","URL","isAbsoluteUrl","isEncoded","decodeURI","absoluteUrl","href","isInlineFrame_1","frame","contentDocument","location","test","protocol","isAccessibleFrame_1","doc","Boolean","defaultView","frameElement","Object","defineProperty","dist","isAccessibleFrame","isInlineFrame","absolutizeUrl","pollify","chunkify","require$$1","require$$2","require$$3","require$$4","require$$5","window"],"mappings":"gDACA,SAASA,EAAWC,EAAQC,EAAQ,GAChC,MAAMC,EAAOF,EAAOD,WAAWE,GAE/B,GAAIC,GAAQ,OAAUA,EAAO,MAAQ,CAIjC,OAAyB,MAHZA,EAGE,QAFHF,EAAOD,WAAWE,EAAQ,GAEE,OAAU,KACrD,CAED,OAAI,OAAUC,GAAQA,GAAQ,OAClB,EACLA,CACX,CA+BA,IAAAC,EA9BA,SAAkBH,EAAQI,GACtB,MAAMC,EAAS,GACf,IAAIC,EAAsB,EAC1B,IAAK,IAAIL,EAAQ,EAAGA,EAAQD,EAAOO,SAAUN,EAAO,CAChD,MAAMC,EAAOH,EAAWC,EAAQC,GAChC,IAAIO,EAAiB,EACjBN,EAAO,IAEHM,EADAN,EAAO,IACU,EACZA,EAAO,KACK,EACZA,EAAO,MACK,EACZA,EAAO,QACK,EACZA,EAAO,SACK,EAEA,GAErBI,EAAsBE,EAAiBJ,GACvCC,EAAOI,KAAKR,GACZK,EAAsBE,GAGtBF,GAAuBE,CAE9B,CACD,OAAOH,CACX,ECxCA,MAAMF,EAHkD,SAAUO,GAC9D,OAAQA,GAAOA,EAAIC,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,QAC9B,MAAM4B,EAAY3B,EAAgBgE,GAClCN,EAAAI,QAAkBnC,EAAU5B,QAC5B,MAAMQ,EAASP,EAAgBiE,GAC/B,IAAAvC,EAAAgC,EAAAhC,KAAenB,EAAOR,QACtB,MAAMqC,EAAkBpC,EAAgBkE,GACxCR,EAAAG,cAAwBzB,EAAgBrC,QACxC,MAAM8C,EAAkB7C,EAAgBmE,GACxCT,EAAAE,cAAwBf,EAAgB9C,QACxC,MAAMoD,EAAsBnD,EAAgBoE,GACnBV,EAAAC,kBAAGR,EAAoBpD,eCZlC,SAAWW,GACvB,IACE,OAAOK,KAAKC,UAAUU,EAAK2C,OAAqB,qBCNpB,oBDMyC3D,GACtE,CAAC,MAAOwB,GACP,OAAOnB,KAAKC,UAAU,CACpBG,OAAQ,QACRC,MAAOc,EAAIb,SAEd,CACH"}
|
|
1
|
+
{"version":3,"file":"pollResult.js","sources":["../../dom-shared/dist/chunkify.js","../../dom-shared/dist/poll.js","../../dom-shared/dist/pollify.js","../../dom-shared/dist/browser/absolutizeUrl.js","../../dom-shared/dist/browser/isInlineFrame.js","../../dom-shared/dist/browser/isAccessibleFrame.js","../../dom-shared/dist/index.js","../src/browser/pollResult.ts","../src/browser/constants.ts"],"sourcesContent":["\"use strict\";\nfunction charCodeAt(string, index = 0) {\n const code = string.charCodeAt(index);\n // if the code of high word (16 bits) in this diapason the character encoded by two words\n if (code >= 0xd800 && code < 0xdc00) {\n const high = code;\n const low = string.charCodeAt(index + 1);\n // convert 2 utf16le words into integer code\n return (high - 0xd800) * 0x400 + (low - 0xdc00) + 0x10000;\n }\n // diapason is reserved for surrogates, we can skip it\n if (0xdc00 <= code && code <= 0xdfff)\n return -1;\n return code;\n}\nfunction chunkify(string, chunkByteLength) {\n const chunks = [];\n let currChunkByteLength = 0;\n for (let index = 0; index < string.length; ++index) {\n const code = charCodeAt(string, index);\n let charByteLength = 0;\n if (code > 0) {\n if (code < 128)\n charByteLength = 1;\n else if (code < 2048)\n charByteLength = 2;\n else if (code < 65536)\n charByteLength = 3;\n else if (code < 2097152)\n charByteLength = 4;\n else if (code < 67108864)\n charByteLength = 5;\n else\n charByteLength = 6;\n }\n if (currChunkByteLength + charByteLength > chunkByteLength) {\n chunks.push(index);\n currChunkByteLength = charByteLength;\n }\n else {\n currChunkByteLength += charByteLength;\n }\n }\n return chunks;\n}\nmodule.exports = chunkify;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nconst STATUSES = {\n WIP: 'WIP',\n SUCCESS: 'SUCCESS',\n SUCCESS_CHUNKED: 'SUCCESS_CHUNKED',\n ERROR: 'ERROR',\n};\nconst _DEFAULT_CHUNK_BYTE_LENGTH = 268435456; // 256MB\nfunction createPollResponse(state, { chunkByteLength = 0 } = {}) {\n var _a;\n if (!state) {\n return {\n status: STATUSES.ERROR,\n error: 'unexpected poll request received - cannot find state of current operation',\n };\n }\n else if (state.value) {\n if (chunkByteLength) {\n if (!state.chunks) {\n try {\n const _nativeStringify = typeof window !== 'undefined' ? (_a = window.__EYES__APPLITOOLS__) === null || _a === void 0 ? void 0 : _a._stringify : undefined;\n const stringified = (_nativeStringify !== null && _nativeStringify !== void 0 ? _nativeStringify : JSON.stringify)(state.value);\n state.chunks = (0, chunkify_1.default)(stringified, chunkByteLength);\n if (state.chunks.length > 0) {\n state.from = 0;\n state.value = stringified;\n }\n }\n catch (e) {\n return { status: STATUSES.ERROR, error: e.message };\n }\n }\n if (state.from >= 0) {\n return {\n status: STATUSES.SUCCESS_CHUNKED,\n value: state.value.substring(state.from, (state.from = state.chunks.shift())),\n done: !state.from,\n };\n }\n }\n return { status: STATUSES.SUCCESS, value: state.value };\n }\n else if (state.error) {\n return { status: STATUSES.ERROR, error: state.error };\n }\n else {\n return { status: STATUSES.WIP };\n }\n}\nfunction poll(context, key, options = {}) {\n context = context || {};\n const result = createPollResponse(context[key], options);\n if (result.status === STATUSES.SUCCESS ||\n result.status === STATUSES.ERROR ||\n (result.status === STATUSES.SUCCESS_CHUNKED && result.done)) {\n delete context[key];\n }\n return result;\n}\nmodule.exports = poll;\n","\"use strict\";\nconst poll = require(\"./poll\");\nfunction pollify(script, context, key) {\n return (options) => function (...args) {\n if (!context[key]) {\n context[key] = {};\n Promise.resolve()\n .then(() => script(...args))\n .then(value => (context[key].value = value))\n .catch(err => (context[key].error = err.message + '\\nStack:' + err.stack));\n }\n return poll(context, key, options);\n };\n}\nmodule.exports = pollify;\n","\"use strict\";\nfunction isAbsoluteUrl(url) {\n try {\n new URL(url);\n return true;\n }\n catch (err) {\n return false;\n }\n}\nfunction absolutizeUrl(url, baseUrl) {\n if (isAbsoluteUrl(url))\n return url;\n let isEncoded = true;\n try {\n isEncoded = url !== decodeURI(url);\n }\n catch (err) {\n isEncoded = true;\n }\n try {\n const absoluteUrl = new URL(url, baseUrl).href;\n return !isEncoded ? decodeURI(absoluteUrl) : absoluteUrl;\n }\n catch (err) {\n return !isEncoded ? decodeURI(url) : url;\n }\n}\nmodule.exports = absolutizeUrl;\n","\"use strict\";\nfunction isInlineFrame(frame) {\n return (frame.contentDocument &&\n frame.contentDocument.location &&\n !/^https?:$/.test(frame.contentDocument.location.protocol));\n}\nmodule.exports = isInlineFrame;\n","\"use strict\";\nfunction isAccessibleFrame(frame) {\n try {\n const doc = frame.contentDocument;\n return Boolean(doc && doc.defaultView && doc.defaultView.frameElement);\n }\n catch (err) {\n return false;\n }\n}\nmodule.exports = isAccessibleFrame;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isAccessibleFrame = exports.isInlineFrame = exports.absolutizeUrl = exports.poll = exports.pollify = exports.chunkify = void 0;\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nexports.chunkify = chunkify_1.default;\nconst pollify_1 = __importDefault(require(\"./pollify\"));\nexports.pollify = pollify_1.default;\nconst poll_1 = __importDefault(require(\"./poll\"));\nexports.poll = poll_1.default;\nconst absolutizeUrl_1 = __importDefault(require(\"./browser/absolutizeUrl\"));\nexports.absolutizeUrl = absolutizeUrl_1.default;\nconst isInlineFrame_1 = __importDefault(require(\"./browser/isInlineFrame\"));\nexports.isInlineFrame = isInlineFrame_1.default;\nconst isAccessibleFrame_1 = __importDefault(require(\"./browser/isAccessibleFrame\"));\nexports.isAccessibleFrame = isAccessibleFrame_1.default;\n",null,null],"names":["charCodeAt","string","index","code","chunkify_1","chunkByteLength","chunks","currChunkByteLength","length","charByteLength","push","mod","__esModule","default","__importDefault","require$$0","STATUSES","WIP","SUCCESS","SUCCESS_CHUNKED","ERROR","poll_1","context","key","options","result","state","_a","value","_nativeStringify","window","__EYES__APPLITOOLS__","_stringify","undefined","stringified","JSON","stringify","from","e","status","error","message","substring","shift","done","createPollResponse","poll","pollify_1","script","args","Promise","resolve","then","catch","err","stack","absolutizeUrl_1","url","baseUrl","URL","isAbsoluteUrl","isEncoded","decodeURI","absoluteUrl","href","isInlineFrame_1","frame","contentDocument","location","test","protocol","isAccessibleFrame_1","doc","Boolean","defaultView","frameElement","Object","defineProperty","dist","isAccessibleFrame","isInlineFrame","absolutizeUrl","pollify","chunkify","require$$1","require$$2","require$$3","require$$4","require$$5","eyesNs","cleanWindow"],"mappings":"gDACA,SAASA,EAAWC,EAAQC,EAAQ,GAChC,MAAMC,EAAOF,EAAOD,WAAWE,GAE/B,GAAIC,GAAQ,OAAUA,EAAO,MAAQ,CAIjC,OAAyB,MAHZA,EAGE,QAFHF,EAAOD,WAAWE,EAAQ,GAEE,OAAU,KACrD,CAED,OAAI,OAAUC,GAAQA,GAAQ,OAClB,EACLA,CACX,CA+BA,IAAAC,EA9BA,SAAkBH,EAAQI,GACtB,MAAMC,EAAS,GACf,IAAIC,EAAsB,EAC1B,IAAK,IAAIL,EAAQ,EAAGA,EAAQD,EAAOO,SAAUN,EA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
2
|
+
"use strict";module.exports=function(...t){const n=function(t,n,e){return function(){var t={};function r(t,n=0){const e=t.charCodeAt(n);return e>=55296&&e<56320?1024*(e-55296)+(t.charCodeAt(n+1)-56320)+65536:56320<=e&&e<=57343?-1:e}var o=function(t,n){const e=[];let o=0;for(let c=0;c<t.length;++c){const u=r(t,c);let i=0;u>0&&(i=u<128?1:u<2048?2:u<65536?3:u<2097152?4:u<67108864?5:6),o+i>n?(e.push(c),o=i):o+=i}return e};const c=function(t){return t&&t.__esModule?t:{default:t}}(o),u="WIP",i="SUCCESS",s="SUCCESS_CHUNKED",a="ERROR";var l=function(t,e,r={}){const o=function(t,{chunkByteLength:e=0}={}){var r;if(t){if(t.value){if(e){if(!t.chunks)try{const o=void 0!==n?null===(r=n.__EYES__APPLITOOLS__)||void 0===r?void 0:r._stringify:void 0,u=(null!=o?o:JSON.stringify)(t.value);t.chunks=(0,c.default)(u,e),t.chunks.length>0&&(t.from=0,t.value=u)}catch(t){return{status:a,error:t.message}}if(t.from>=0)return{status:s,value:t.value.substring(t.from,t.from=t.chunks.shift()),done:!t.from}}return{status:i,value:t.value}}return t.error?{status:a,error:t.error}:{status:u}}return{status:a,error:"unexpected poll request received - cannot find state of current operation"}}((t=t||{})[e],r);return(o.status===i||o.status===a||o.status===s&&o.done)&&delete t[e],o};const f=l;var d=function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.isAccessibleFrame=t.isInlineFrame=t.absolutizeUrl=p=t.poll=t.pollify=t.chunkify=void 0;const _=d(o);t.chunkify=_.default;const h=d((function(t,n,e){return r=>function(...o){return n[e]||(n[e]={},Promise.resolve().then((()=>t(...o))).then((t=>n[e].value=t)).catch((t=>n[e].error=t.message+"\nStack:"+t.stack))),f(n,e,r)}}));t.pollify=h.default;const y=d(l);var p=t.poll=y.default;const m=d((function(t,n){if(function(t){try{return new URL(t),!0}catch(t){return!1}}(t))return t;let e=!0;try{e=t!==decodeURI(t)}catch(t){e=!0}try{const r=new URL(t,n).href;return e?r:decodeURI(r)}catch(n){return e?t:decodeURI(t)}}));t.absolutizeUrl=m.default;const w=d((function(t){return t.contentDocument&&t.contentDocument.location&&!/^https?:$/.test(t.contentDocument.location.protocol)}));t.isInlineFrame=w.default;const S=d((function(t){try{const n=t.contentDocument;return Boolean(n&&n.defaultView&&n.defaultView.frameElement)}catch(t){return!1}}));return t.isAccessibleFrame=S.default,function(t){var n;const r=e.__EYES__APPLITOOLS__,o=null!==(n=null==r?void 0:r._stringify)&&void 0!==n?n:JSON.stringify;try{return o(p(r,"domSnapshotResult",t))}catch(t){return o({status:"ERROR",error:t.message})}}}()};let e=!0;try{let r=window.__applitools_sandbox;r||(r=document.createElement("iframe"),r.setAttribute("data-applitools-sandbox",""),r.setAttribute("data-applitools-skip",""),document.head.appendChild(r),window.__applitools_sandbox=r);const o=Math.floor(4294967296*Math.random()),c=r.contentDocument.createElement("script");c.textContent="window['ctor-"+o+"'] = "+n.toString()+";",r.contentDocument.head.appendChild(c);const u=r.contentWindow["ctor-"+o];if(delete r.contentWindow["ctor-"+o],"function"!=typeof u)throw new Error("Sandbox failed to extract function");e=!1;const i=r.contentWindow,s=i.__EYES__APPLITOOLS__=i.__EYES__APPLITOOLS__||{};s._stringify||(s._stringify=i.JSON.stringify.bind(i.JSON));const a=window.__EYES__APPLITOOLS__=window.__EYES__APPLITOOLS__||{};function l(t){if(i.Array.isArray(t)){const n=new i.Array(t.length);for(let e=0;e<t.length;e++)n[e]=l(t[e]);return n}if(t&&"object"==typeof t&&Object.getPrototypeOf(t)===Object.prototype){const n=new i.Object;for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=l(t[e]));return n}return t}a._stringify&&a._stringify!==JSON.stringify||(a._stringify=i.JSON.stringify.bind(i.JSON));const f=new i.Array(t.length);for(let d=0;d<t.length;d++)f[d]=l(t[d]);return u(document,window,i)(...f)}catch(_){try{return n(document,window,window)(...t)}catch(h){throw e?h:_}}};
|
|
3
3
|
//# sourceMappingURL=pollResultCjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pollResultCjs.js","sources":["../../dom-shared/dist/chunkify.js","../../dom-shared/dist/poll.js","../../dom-shared/dist/pollify.js","../../dom-shared/dist/browser/absolutizeUrl.js","../../dom-shared/dist/browser/isInlineFrame.js","../../dom-shared/dist/browser/isAccessibleFrame.js","../../dom-shared/dist/index.js","../src/browser/pollResult.ts","../src/browser/constants.ts"],"sourcesContent":["\"use strict\";\nfunction charCodeAt(string, index = 0) {\n const code = string.charCodeAt(index);\n // if the code of high word (16 bits) in this diapason the character encoded by two words\n if (code >= 0xd800 && code < 0xdc00) {\n const high = code;\n const low = string.charCodeAt(index + 1);\n // convert 2 utf16le words into integer code\n return (high - 0xd800) * 0x400 + (low - 0xdc00) + 0x10000;\n }\n // diapason is reserved for surrogates, we can skip it\n if (0xdc00 <= code && code <= 0xdfff)\n return -1;\n return code;\n}\nfunction chunkify(string, chunkByteLength) {\n const chunks = [];\n let currChunkByteLength = 0;\n for (let index = 0; index < string.length; ++index) {\n const code = charCodeAt(string, index);\n let charByteLength = 0;\n if (code > 0) {\n if (code < 128)\n charByteLength = 1;\n else if (code < 2048)\n charByteLength = 2;\n else if (code < 65536)\n charByteLength = 3;\n else if (code < 2097152)\n charByteLength = 4;\n else if (code < 67108864)\n charByteLength = 5;\n else\n charByteLength = 6;\n }\n if (currChunkByteLength + charByteLength > chunkByteLength) {\n chunks.push(index);\n currChunkByteLength = charByteLength;\n }\n else {\n currChunkByteLength += charByteLength;\n }\n }\n return chunks;\n}\nmodule.exports = chunkify;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nconst STATUSES = {\n WIP: 'WIP',\n SUCCESS: 'SUCCESS',\n SUCCESS_CHUNKED: 'SUCCESS_CHUNKED',\n ERROR: 'ERROR',\n};\nconst _DEFAULT_CHUNK_BYTE_LENGTH = 268435456; // 256MB\nfunction createPollResponse(state, { chunkByteLength = 0 } = {}) {\n if (!state) {\n return {\n status: STATUSES.ERROR,\n error: 'unexpected poll request received - cannot find state of current operation',\n };\n }\n else if (state.value) {\n if (chunkByteLength) {\n if (!state.chunks) {\n try {\n const stringified = JSON.stringify(state.value);\n state.chunks = (0, chunkify_1.default)(stringified, chunkByteLength);\n if (state.chunks.length > 0) {\n state.from = 0;\n state.value = stringified;\n }\n }\n catch (e) {\n return { status: STATUSES.ERROR, error: e.message };\n }\n }\n if (state.from >= 0) {\n return {\n status: STATUSES.SUCCESS_CHUNKED,\n value: state.value.substring(state.from, (state.from = state.chunks.shift())),\n done: !state.from,\n };\n }\n }\n return { status: STATUSES.SUCCESS, value: state.value };\n }\n else if (state.error) {\n return { status: STATUSES.ERROR, error: state.error };\n }\n else {\n return { status: STATUSES.WIP };\n }\n}\nfunction poll(context, key, options = {}) {\n context = context || {};\n const result = createPollResponse(context[key], options);\n if (result.status === STATUSES.SUCCESS ||\n result.status === STATUSES.ERROR ||\n (result.status === STATUSES.SUCCESS_CHUNKED && result.done)) {\n delete context[key];\n }\n return result;\n}\nmodule.exports = poll;\n","\"use strict\";\nconst poll = require(\"./poll\");\nfunction pollify(script, context, key) {\n return (options) => function (...args) {\n if (!context[key]) {\n context[key] = {};\n Promise.resolve()\n .then(() => script(...args))\n .then(value => (context[key].value = value))\n .catch(err => (context[key].error = err.message + '\\nStack:' + err.stack));\n }\n return poll(context, key, options);\n };\n}\nmodule.exports = pollify;\n","\"use strict\";\nfunction isAbsoluteUrl(url) {\n try {\n new URL(url);\n return true;\n }\n catch (err) {\n return false;\n }\n}\nfunction absolutizeUrl(url, baseUrl) {\n if (isAbsoluteUrl(url))\n return url;\n let isEncoded = true;\n try {\n isEncoded = url !== decodeURI(url);\n }\n catch (err) {\n isEncoded = true;\n }\n try {\n const absoluteUrl = new URL(url, baseUrl).href;\n return !isEncoded ? decodeURI(absoluteUrl) : absoluteUrl;\n }\n catch (err) {\n return !isEncoded ? decodeURI(url) : url;\n }\n}\nmodule.exports = absolutizeUrl;\n","\"use strict\";\nfunction isInlineFrame(frame) {\n return (frame.contentDocument &&\n frame.contentDocument.location &&\n !/^https?:$/.test(frame.contentDocument.location.protocol));\n}\nmodule.exports = isInlineFrame;\n","\"use strict\";\nfunction isAccessibleFrame(frame) {\n try {\n const doc = frame.contentDocument;\n return Boolean(doc && doc.defaultView && doc.defaultView.frameElement);\n }\n catch (err) {\n return false;\n }\n}\nmodule.exports = isAccessibleFrame;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isAccessibleFrame = exports.isInlineFrame = exports.absolutizeUrl = exports.poll = exports.pollify = exports.chunkify = void 0;\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nexports.chunkify = chunkify_1.default;\nconst pollify_1 = __importDefault(require(\"./pollify\"));\nexports.pollify = pollify_1.default;\nconst poll_1 = __importDefault(require(\"./poll\"));\nexports.poll = poll_1.default;\nconst absolutizeUrl_1 = __importDefault(require(\"./browser/absolutizeUrl\"));\nexports.absolutizeUrl = absolutizeUrl_1.default;\nconst isInlineFrame_1 = __importDefault(require(\"./browser/isInlineFrame\"));\nexports.isInlineFrame = isInlineFrame_1.default;\nconst isAccessibleFrame_1 = __importDefault(require(\"./browser/isAccessibleFrame\"));\nexports.isAccessibleFrame = isAccessibleFrame_1.default;\n",null,null],"names":["charCodeAt","string","index","code","chunkify_1","chunkByteLength","chunks","currChunkByteLength","length","charByteLength","push","mod","__esModule","default","__importDefault","require$$0","STATUSES","WIP","SUCCESS","SUCCESS_CHUNKED","ERROR","poll_1","context","key","options","result","state","value","stringified","JSON","stringify","from","e","status","error","message","substring","shift","done","createPollResponse","poll","pollify_1","script","args","Promise","resolve","then","catch","err","stack","absolutizeUrl_1","url","baseUrl","URL","isAbsoluteUrl","isEncoded","decodeURI","absoluteUrl","href","isInlineFrame_1","frame","contentDocument","location","test","protocol","isAccessibleFrame_1","doc","Boolean","defaultView","frameElement","Object","defineProperty","dist","isAccessibleFrame","isInlineFrame","absolutizeUrl","pollify","chunkify","require$$1","require$$2","require$$3","require$$4","require$$5","window"],"mappings":"mDACA,SAASA,EAAWC,EAAQC,EAAQ,GAChC,MAAMC,EAAOF,EAAOD,WAAWE,GAE/B,GAAIC,GAAQ,OAAUA,EAAO,MAAQ,CAIjC,OAAyB,MAHZA,EAGE,QAFHF,EAAOD,WAAWE,EAAQ,GAEE,OAAU,KACrD,CAED,OAAI,OAAUC,GAAQA,GAAQ,OAClB,EACLA,CACX,CA+BA,IAAAC,EA9BA,SAAkBH,EAAQI,GACtB,MAAMC,EAAS,GACf,IAAIC,EAAsB,EAC1B,IAAK,IAAIL,EAAQ,EAAGA,EAAQD,EAAOO,SAAUN,EAAO,CAChD,MAAMC,EAAOH,EAAWC,EAAQC,GAChC,IAAIO,EAAiB,EACjBN,EAAO,IAEHM,EADAN,EAAO,IACU,EACZA,EAAO,KACK,EACZA,EAAO,MACK,EACZA,EAAO,QACK,EACZA,EAAO,SACK,EAEA,GAErBI,EAAsBE,EAAiBJ,GACvCC,EAAOI,KAAKR,GACZK,EAAsBE,GAGtBF,GAAuBE,CAE9B,CACD,OAAOH,CACX,ECxCA,MAAMF,EAHkD,SAAUO,GAC9D,OAAQA,GAAOA,EAAIC,WAAcD,EAAM,CAAEE,QAAWF,EACxD,CACmBG,CAAgBC,GAC7BC,EAAW,CACbC,IAAK,MACLC,QAAS,UACTC,gBAAiB,kBACjBC,MAAO,SAoDX,IAAAC,EAVA,SAAcC,EAASC,EAAKC,EAAU,CAAA,GAElC,MAAMC,EAzCV,SAA4BC,GAAOrB,gBAAEA,EAAkB,GAAM,IACzD,GAAKqB,EAMA,IAAIA,EAAMC,MAAO,CAClB,GAAItB,EAAiB,CACjB,IAAKqB,EAAMpB,OACP,IACI,MAAMsB,EAAcC,KAA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pD,eCZlC,SAAWW,GACvB,IACE,OAAOK,KAAKC,UAAUU,EAAK2C,OAAqB,qBCNpB,oBDMyC3D,GACtE,CAAC,MAAOwB,GACP,OAAOnB,KAAKC,UAAU,CACpBG,OAAQ,QACRC,MAAOc,EAAIb,SAEd,CACH"}
|
|
1
|
+
{"version":3,"file":"pollResultCjs.js","sources":["../../dom-shared/dist/chunkify.js","../../dom-shared/dist/poll.js","../../dom-shared/dist/pollify.js","../../dom-shared/dist/browser/absolutizeUrl.js","../../dom-shared/dist/browser/isInlineFrame.js","../../dom-shared/dist/browser/isAccessibleFrame.js","../../dom-shared/dist/index.js","../src/browser/pollResult.ts","../src/browser/constants.ts"],"sourcesContent":["\"use strict\";\nfunction charCodeAt(string, index = 0) {\n const code = string.charCodeAt(index);\n // if the code of high word (16 bits) in this diapason the character encoded by two words\n if (code >= 0xd800 && code < 0xdc00) {\n const high = code;\n const low = string.charCodeAt(index + 1);\n // convert 2 utf16le words into integer code\n return (high - 0xd800) * 0x400 + (low - 0xdc00) + 0x10000;\n }\n // diapason is reserved for surrogates, we can skip it\n if (0xdc00 <= code && code <= 0xdfff)\n return -1;\n return code;\n}\nfunction chunkify(string, chunkByteLength) {\n const chunks = [];\n let currChunkByteLength = 0;\n for (let index = 0; index < string.length; ++index) {\n const code = charCodeAt(string, index);\n let charByteLength = 0;\n if (code > 0) {\n if (code < 128)\n charByteLength = 1;\n else if (code < 2048)\n charByteLength = 2;\n else if (code < 65536)\n charByteLength = 3;\n else if (code < 2097152)\n charByteLength = 4;\n else if (code < 67108864)\n charByteLength = 5;\n else\n charByteLength = 6;\n }\n if (currChunkByteLength + charByteLength > chunkByteLength) {\n chunks.push(index);\n currChunkByteLength = charByteLength;\n }\n else {\n currChunkByteLength += charByteLength;\n }\n }\n return chunks;\n}\nmodule.exports = chunkify;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nconst STATUSES = {\n WIP: 'WIP',\n SUCCESS: 'SUCCESS',\n SUCCESS_CHUNKED: 'SUCCESS_CHUNKED',\n ERROR: 'ERROR',\n};\nconst _DEFAULT_CHUNK_BYTE_LENGTH = 268435456; // 256MB\nfunction createPollResponse(state, { chunkByteLength = 0 } = {}) {\n var _a;\n if (!state) {\n return {\n status: STATUSES.ERROR,\n error: 'unexpected poll request received - cannot find state of current operation',\n };\n }\n else if (state.value) {\n if (chunkByteLength) {\n if (!state.chunks) {\n try {\n const _nativeStringify = typeof window !== 'undefined' ? (_a = window.__EYES__APPLITOOLS__) === null || _a === void 0 ? void 0 : _a._stringify : undefined;\n const stringified = (_nativeStringify !== null && _nativeStringify !== void 0 ? _nativeStringify : JSON.stringify)(state.value);\n state.chunks = (0, chunkify_1.default)(stringified, chunkByteLength);\n if (state.chunks.length > 0) {\n state.from = 0;\n state.value = stringified;\n }\n }\n catch (e) {\n return { status: STATUSES.ERROR, error: e.message };\n }\n }\n if (state.from >= 0) {\n return {\n status: STATUSES.SUCCESS_CHUNKED,\n value: state.value.substring(state.from, (state.from = state.chunks.shift())),\n done: !state.from,\n };\n }\n }\n return { status: STATUSES.SUCCESS, value: state.value };\n }\n else if (state.error) {\n return { status: STATUSES.ERROR, error: state.error };\n }\n else {\n return { status: STATUSES.WIP };\n }\n}\nfunction poll(context, key, options = {}) {\n context = context || {};\n const result = createPollResponse(context[key], options);\n if (result.status === STATUSES.SUCCESS ||\n result.status === STATUSES.ERROR ||\n (result.status === STATUSES.SUCCESS_CHUNKED && result.done)) {\n delete context[key];\n }\n return result;\n}\nmodule.exports = poll;\n","\"use strict\";\nconst poll = require(\"./poll\");\nfunction pollify(script, context, key) {\n return (options) => function (...args) {\n if (!context[key]) {\n context[key] = {};\n Promise.resolve()\n .then(() => script(...args))\n .then(value => (context[key].value = value))\n .catch(err => (context[key].error = err.message + '\\nStack:' + err.stack));\n }\n return poll(context, key, options);\n };\n}\nmodule.exports = pollify;\n","\"use strict\";\nfunction isAbsoluteUrl(url) {\n try {\n new URL(url);\n return true;\n }\n catch (err) {\n return false;\n }\n}\nfunction absolutizeUrl(url, baseUrl) {\n if (isAbsoluteUrl(url))\n return url;\n let isEncoded = true;\n try {\n isEncoded = url !== decodeURI(url);\n }\n catch (err) {\n isEncoded = true;\n }\n try {\n const absoluteUrl = new URL(url, baseUrl).href;\n return !isEncoded ? decodeURI(absoluteUrl) : absoluteUrl;\n }\n catch (err) {\n return !isEncoded ? decodeURI(url) : url;\n }\n}\nmodule.exports = absolutizeUrl;\n","\"use strict\";\nfunction isInlineFrame(frame) {\n return (frame.contentDocument &&\n frame.contentDocument.location &&\n !/^https?:$/.test(frame.contentDocument.location.protocol));\n}\nmodule.exports = isInlineFrame;\n","\"use strict\";\nfunction isAccessibleFrame(frame) {\n try {\n const doc = frame.contentDocument;\n return Boolean(doc && doc.defaultView && doc.defaultView.frameElement);\n }\n catch (err) {\n return false;\n }\n}\nmodule.exports = isAccessibleFrame;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isAccessibleFrame = exports.isInlineFrame = exports.absolutizeUrl = exports.poll = exports.pollify = exports.chunkify = void 0;\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nexports.chunkify = chunkify_1.default;\nconst pollify_1 = __importDefault(require(\"./pollify\"));\nexports.pollify = pollify_1.default;\nconst poll_1 = __importDefault(require(\"./poll\"));\nexports.poll = poll_1.default;\nconst absolutizeUrl_1 = __importDefault(require(\"./browser/absolutizeUrl\"));\nexports.absolutizeUrl = absolutizeUrl_1.default;\nconst isInlineFrame_1 = __importDefault(require(\"./browser/isInlineFrame\"));\nexports.isInlineFrame = isInlineFrame_1.default;\nconst isAccessibleFrame_1 = __importDefault(require(\"./browser/isAccessibleFrame\"));\nexports.isAccessibleFrame = isAccessibleFrame_1.default;\n",null,null],"names":["charCodeAt","string","index","code","chunkify_1","chunkByteLength","chunks","currChunkByteLength","length","charByteLength","push","mod","__esModule","default","__importDefault","require$$0","STATUSES","WIP","SUCCESS","SUCCESS_CHUNKED","ERROR","poll_1","context","key","options","result","state","_a","value","_nativeStringify","window","__EYES__APPLITOOLS__","_stringify","undefined","stringified","JSON","stringify","from","e","status","error","message","substring","shift","done","createPollResponse","poll","pollify_1","script","args","Promise","resolve","then","catch","err","stack","absolutizeUrl_1","url","baseUrl","URL","isAbsoluteUrl","isEncoded","decodeURI","absoluteUrl","href","isInlineFrame_1","frame","contentDocument","location","test","protocol","isAccessibleFrame_1","doc","Boolean","defaultView","frameElement","Object","defineProperty","dist","isAccessibleFrame","isInlineFrame","absolutizeUrl","pollify","chunkify","require$$1","require$$2","require$$3","require$$4","require$$5","eyesNs","cleanWindow"],"mappings":"mDACA,SAASA,EAAWC,EAAQC,EAAQ,GAChC,MAAMC,EAAOF,EAAOD,WAAWE,GAE/B,GAAIC,GAAQ,OAAUA,EAAO,MAAQ,CAIjC,OAAyB,MAHZA,EAGE,QAFHF,EAAOD,WAAWE,EAAQ,GAEE,OAAU,KACrD,CAED,OAAI,OAAUC,GAAQA,GAAQ,OAClB,EACLA,CACX,CA+BA,IAAAC,EA9BA,SAAkBH,EAAQI,GACtB,MAAMC,EAAS,GACf,IAAIC,EAAsB,EAC1B,IAAK,IAAIL,EAAQ,EAAGA,EAAQD,EAAOO,SAAUN,EAAO,CAChD,MAAMC,EAAOH,EAAWC,EAAQC,GAChC,IAAIO,EAAiB,EACjBN,EAAO,IAEHM,EADAN,EAAO,IACU,EACZA,EAAO,KACK,EACZA,EAAO,MACK,EACZA,EAAO,QACK,EACZA,EAAO,SACK,EAEA,GAErBI,EAAsBE,EAAiBJ,GACvCC,EAAOI,KAAKR,GACZK,EAAsBE,GAGtBF,GAAuBE,CAE9B,CACD,OAAOH,CACX,ECxCA,MAAMF,EAHkD,SAAUO,GAC9D,OAAQA,GAAOA,EAAIC,WAAcD,E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,EAAAgC,EAAAhC,KAAegC,EAAAI,QAAkBJ,EAAAK,cAAmB,EAChI,MAAM/E,EAAaU,EAAgBC,GACnC+D,EAAAK,SAAmB/E,EAAWS,QAC9B,MAAMkC,EAAYjC,EAAgBsE,GAClCN,EAAAI,QAAkBnC,EAAUlC,QAC5B,MAAMQ,EAASP,EAAgBuE,GAC/B,IAAAvC,EAAAgC,EAAAhC,KAAezB,EAAOR,QACtB,MAAM2C,EAAkB1C,EAAgBwE,GACxCR,EAAAG,cAAwBzB,EAAgB3C,QACxC,MAAMoD,EAAkBnD,EAAgByE,GACxCT,EAAAE,cAAwBf,EAAgBpD,QACxC,MAAM0D,EAAsBzD,EAAgB0E,GACnBV,EAAAC,kBAAGR,EAAoB1D,eCVlC,SAAWW,SACvB,MAAMiE,EAASC,YAA0B,qBACnC1D,EAA+B,QAAlBL,EAAA8D,aAAM,EAANA,EAAQzD,kBAAU,IAAAL,EAAAA,EAAIQ,KAAKC,UAC9C,IACE,OAAOJ,EAAWc,EAAK2C,ECVK,oBDUqBjE,GAClD,CAAC,MAAO8B,GACP,OAAOtB,EAAW,CAChBO,OAAQ,QACRC,MAAOc,EAAIb,SAEd,CACH"}
|
package/dist/pollResultEs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @applitools/dom-snapshot@4.
|
|
2
|
-
function t(){
|
|
1
|
+
/* @applitools/dom-snapshot@4.17.0 */
|
|
2
|
+
function t(...t){const n=function(t,n,e){return function(){var t={};function r(t,n=0){const e=t.charCodeAt(n);return e>=55296&&e<56320?1024*(e-55296)+(t.charCodeAt(n+1)-56320)+65536:56320<=e&&e<=57343?-1:e}var o=function(t,n){const e=[];let o=0;for(let c=0;c<t.length;++c){const u=r(t,c);let i=0;u>0&&(i=u<128?1:u<2048?2:u<65536?3:u<2097152?4:u<67108864?5:6),o+i>n?(e.push(c),o=i):o+=i}return e};const c=function(t){return t&&t.__esModule?t:{default:t}}(o),u="WIP",i="SUCCESS",s="SUCCESS_CHUNKED",a="ERROR";var l=function(t,e,r={}){const o=function(t,{chunkByteLength:e=0}={}){var r;if(t){if(t.value){if(e){if(!t.chunks)try{const o=void 0!==n?null===(r=n.__EYES__APPLITOOLS__)||void 0===r?void 0:r._stringify:void 0,u=(null!=o?o:JSON.stringify)(t.value);t.chunks=(0,c.default)(u,e),t.chunks.length>0&&(t.from=0,t.value=u)}catch(t){return{status:a,error:t.message}}if(t.from>=0)return{status:s,value:t.value.substring(t.from,t.from=t.chunks.shift()),done:!t.from}}return{status:i,value:t.value}}return t.error?{status:a,error:t.error}:{status:u}}return{status:a,error:"unexpected poll request received - cannot find state of current operation"}}((t=t||{})[e],r);return(o.status===i||o.status===a||o.status===s&&o.done)&&delete t[e],o};const f=l;var d=function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.isAccessibleFrame=t.isInlineFrame=t.absolutizeUrl=p=t.poll=t.pollify=t.chunkify=void 0;const _=d(o);t.chunkify=_.default;const h=d((function(t,n,e){return r=>function(...o){return n[e]||(n[e]={},Promise.resolve().then((()=>t(...o))).then((t=>n[e].value=t)).catch((t=>n[e].error=t.message+"\nStack:"+t.stack))),f(n,e,r)}}));t.pollify=h.default;const y=d(l);var p=t.poll=y.default;const m=d((function(t,n){if(function(t){try{return new URL(t),!0}catch(t){return!1}}(t))return t;let e=!0;try{e=t!==decodeURI(t)}catch(t){e=!0}try{const r=new URL(t,n).href;return e?r:decodeURI(r)}catch(n){return e?t:decodeURI(t)}}));t.absolutizeUrl=m.default;const w=d((function(t){return t.contentDocument&&t.contentDocument.location&&!/^https?:$/.test(t.contentDocument.location.protocol)}));t.isInlineFrame=w.default;const S=d((function(t){try{const n=t.contentDocument;return Boolean(n&&n.defaultView&&n.defaultView.frameElement)}catch(t){return!1}}));return t.isAccessibleFrame=S.default,function(t){var n;const r=e.__EYES__APPLITOOLS__,o=null!==(n=null==r?void 0:r._stringify)&&void 0!==n?n:JSON.stringify;try{return o(p(r,"domSnapshotResult",t))}catch(t){return o({status:"ERROR",error:t.message})}}}()};let e=!0;try{let r=window.__applitools_sandbox;r||(r=document.createElement("iframe"),r.setAttribute("data-applitools-sandbox",""),r.setAttribute("data-applitools-skip",""),document.head.appendChild(r),window.__applitools_sandbox=r);const o=Math.floor(4294967296*Math.random()),c=r.contentDocument.createElement("script");c.textContent="window['ctor-"+o+"'] = "+n.toString()+";",r.contentDocument.head.appendChild(c);const u=r.contentWindow["ctor-"+o];if(delete r.contentWindow["ctor-"+o],"function"!=typeof u)throw new Error("Sandbox failed to extract function");e=!1;const i=r.contentWindow,s=i.__EYES__APPLITOOLS__=i.__EYES__APPLITOOLS__||{};s._stringify||(s._stringify=i.JSON.stringify.bind(i.JSON));const a=window.__EYES__APPLITOOLS__=window.__EYES__APPLITOOLS__||{};function l(t){if(i.Array.isArray(t)){const n=new i.Array(t.length);for(let e=0;e<t.length;e++)n[e]=l(t[e]);return n}if(t&&"object"==typeof t&&Object.getPrototypeOf(t)===Object.prototype){const n=new i.Object;for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=l(t[e]));return n}return t}a._stringify&&a._stringify!==JSON.stringify||(a._stringify=i.JSON.stringify.bind(i.JSON));const f=new i.Array(t.length);for(let d=0;d<t.length;d++)f[d]=l(t[d]);return u(document,window,i)(...f)}catch(_){try{return n(document,window,window)(...t)}catch(h){throw e?h:_}}}export{t as default};
|
|
3
3
|
//# sourceMappingURL=pollResultEs.js.map
|
package/dist/pollResultEs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pollResultEs.js","sources":["../../dom-shared/dist/chunkify.js","../../dom-shared/dist/poll.js","../../dom-shared/dist/pollify.js","../../dom-shared/dist/browser/absolutizeUrl.js","../../dom-shared/dist/browser/isInlineFrame.js","../../dom-shared/dist/browser/isAccessibleFrame.js","../../dom-shared/dist/index.js","../src/browser/pollResult.ts","../src/browser/constants.ts"],"sourcesContent":["\"use strict\";\nfunction charCodeAt(string, index = 0) {\n const code = string.charCodeAt(index);\n // if the code of high word (16 bits) in this diapason the character encoded by two words\n if (code >= 0xd800 && code < 0xdc00) {\n const high = code;\n const low = string.charCodeAt(index + 1);\n // convert 2 utf16le words into integer code\n return (high - 0xd800) * 0x400 + (low - 0xdc00) + 0x10000;\n }\n // diapason is reserved for surrogates, we can skip it\n if (0xdc00 <= code && code <= 0xdfff)\n return -1;\n return code;\n}\nfunction chunkify(string, chunkByteLength) {\n const chunks = [];\n let currChunkByteLength = 0;\n for (let index = 0; index < string.length; ++index) {\n const code = charCodeAt(string, index);\n let charByteLength = 0;\n if (code > 0) {\n if (code < 128)\n charByteLength = 1;\n else if (code < 2048)\n charByteLength = 2;\n else if (code < 65536)\n charByteLength = 3;\n else if (code < 2097152)\n charByteLength = 4;\n else if (code < 67108864)\n charByteLength = 5;\n else\n charByteLength = 6;\n }\n if (currChunkByteLength + charByteLength > chunkByteLength) {\n chunks.push(index);\n currChunkByteLength = charByteLength;\n }\n else {\n currChunkByteLength += charByteLength;\n }\n }\n return chunks;\n}\nmodule.exports = chunkify;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nconst STATUSES = {\n WIP: 'WIP',\n SUCCESS: 'SUCCESS',\n SUCCESS_CHUNKED: 'SUCCESS_CHUNKED',\n ERROR: 'ERROR',\n};\nconst _DEFAULT_CHUNK_BYTE_LENGTH = 268435456; // 256MB\nfunction createPollResponse(state, { chunkByteLength = 0 } = {}) {\n if (!state) {\n return {\n status: STATUSES.ERROR,\n error: 'unexpected poll request received - cannot find state of current operation',\n };\n }\n else if (state.value) {\n if (chunkByteLength) {\n if (!state.chunks) {\n try {\n const stringified = JSON.stringify(state.value);\n state.chunks = (0, chunkify_1.default)(stringified, chunkByteLength);\n if (state.chunks.length > 0) {\n state.from = 0;\n state.value = stringified;\n }\n }\n catch (e) {\n return { status: STATUSES.ERROR, error: e.message };\n }\n }\n if (state.from >= 0) {\n return {\n status: STATUSES.SUCCESS_CHUNKED,\n value: state.value.substring(state.from, (state.from = state.chunks.shift())),\n done: !state.from,\n };\n }\n }\n return { status: STATUSES.SUCCESS, value: state.value };\n }\n else if (state.error) {\n return { status: STATUSES.ERROR, error: state.error };\n }\n else {\n return { status: STATUSES.WIP };\n }\n}\nfunction poll(context, key, options = {}) {\n context = context || {};\n const result = createPollResponse(context[key], options);\n if (result.status === STATUSES.SUCCESS ||\n result.status === STATUSES.ERROR ||\n (result.status === STATUSES.SUCCESS_CHUNKED && result.done)) {\n delete context[key];\n }\n return result;\n}\nmodule.exports = poll;\n","\"use strict\";\nconst poll = require(\"./poll\");\nfunction pollify(script, context, key) {\n return (options) => function (...args) {\n if (!context[key]) {\n context[key] = {};\n Promise.resolve()\n .then(() => script(...args))\n .then(value => (context[key].value = value))\n .catch(err => (context[key].error = err.message + '\\nStack:' + err.stack));\n }\n return poll(context, key, options);\n };\n}\nmodule.exports = pollify;\n","\"use strict\";\nfunction isAbsoluteUrl(url) {\n try {\n new URL(url);\n return true;\n }\n catch (err) {\n return false;\n }\n}\nfunction absolutizeUrl(url, baseUrl) {\n if (isAbsoluteUrl(url))\n return url;\n let isEncoded = true;\n try {\n isEncoded = url !== decodeURI(url);\n }\n catch (err) {\n isEncoded = true;\n }\n try {\n const absoluteUrl = new URL(url, baseUrl).href;\n return !isEncoded ? decodeURI(absoluteUrl) : absoluteUrl;\n }\n catch (err) {\n return !isEncoded ? decodeURI(url) : url;\n }\n}\nmodule.exports = absolutizeUrl;\n","\"use strict\";\nfunction isInlineFrame(frame) {\n return (frame.contentDocument &&\n frame.contentDocument.location &&\n !/^https?:$/.test(frame.contentDocument.location.protocol));\n}\nmodule.exports = isInlineFrame;\n","\"use strict\";\nfunction isAccessibleFrame(frame) {\n try {\n const doc = frame.contentDocument;\n return Boolean(doc && doc.defaultView && doc.defaultView.frameElement);\n }\n catch (err) {\n return false;\n }\n}\nmodule.exports = isAccessibleFrame;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isAccessibleFrame = exports.isInlineFrame = exports.absolutizeUrl = exports.poll = exports.pollify = exports.chunkify = void 0;\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nexports.chunkify = chunkify_1.default;\nconst pollify_1 = __importDefault(require(\"./pollify\"));\nexports.pollify = pollify_1.default;\nconst poll_1 = __importDefault(require(\"./poll\"));\nexports.poll = poll_1.default;\nconst absolutizeUrl_1 = __importDefault(require(\"./browser/absolutizeUrl\"));\nexports.absolutizeUrl = absolutizeUrl_1.default;\nconst isInlineFrame_1 = __importDefault(require(\"./browser/isInlineFrame\"));\nexports.isInlineFrame = isInlineFrame_1.default;\nconst isAccessibleFrame_1 = __importDefault(require(\"./browser/isAccessibleFrame\"));\nexports.isAccessibleFrame = isAccessibleFrame_1.default;\n",null,null],"names":["charCodeAt","string","index","code","chunkify_1","chunkByteLength","chunks","currChunkByteLength","length","charByteLength","push","mod","__esModule","default","__importDefault","require$$0","STATUSES","WIP","SUCCESS","SUCCESS_CHUNKED","ERROR","poll_1","context","key","options","result","state","value","stringified","JSON","stringify","from","e","status","error","message","substring","shift","done","createPollResponse","poll","pollify_1","script","args","Promise","resolve","then","catch","err","stack","absolutizeUrl_1","url","baseUrl","URL","isAbsoluteUrl","isEncoded","decodeURI","absoluteUrl","href","isInlineFrame_1","frame","contentDocument","location","test","protocol","isAccessibleFrame_1","doc","Boolean","defaultView","frameElement","Object","defineProperty","dist","isAccessibleFrame","isInlineFrame","absolutizeUrl","pollify","chunkify","require$$1","require$$2","require$$3","require$$4","require$$5","window"],"mappings":"kDACA,SAASA,EAAWC,EAAQC,EAAQ,GAChC,MAAMC,EAAOF,EAAOD,WAAWE,GAE/B,GAAIC,GAAQ,OAAUA,EAAO,MAAQ,CAIjC,OAAyB,MAHZA,EAGE,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,GACnB,OAAQA,EAAMC,iBACVD,EAAMC,gBAAgBC,WACrB,YAAYC,KAAKH,EAAMC,gBAAgBC,SAASE,SACzD,ECKA,IAAAC,EATA,SAA2BL,GACvB,IACI,MAAMM,EAAMN,EAAMC,gBAClB,OAAOM,QAAQD,GAAOA,EAAIE,aAAeF,EAAIE,YAAYC,aAC5D,CACD,MAAOrB,GACH,OAAO,CACV,CACL,ECRIlC,EAAoD,SAAUH,GAC9D,OAAQA,GAAOA,EAAIC,WAAcD,EAAM,CAAEE,QAAWF,EACxD,EACA2D,OAAOC,eAAeC,EAAS,aAAc,CAAE7C,OAAO,IACtD6C,EAAAC,kBAA4BD,EAAAE,cAAwBF,EAAAG,cAAwBnC,EAAAgC,EAAAhC,KAAegC,EAAAI,QAAkBJ,EAAAK,cAAmB,EAChI,MAAMzE,EAAaU,EAAgBC,GACnCyD,EAAAK,SAAmBzE,EAAWS,QAC9B,MAAM4B,EAAY3B,EAAgBgE,GAClCN,EAAAI,QAAkBnC,EAAU5B,QAC5B,MAAMQ,EAASP,EAAgBiE,GAC/B,IAAAvC,EAAAgC,EAAAhC,KAAenB,EAAOR,QACtB,MAAMqC,EAAkBpC,EAAgBkE,GACxCR,EAAAG,cAAwBzB,EAAgBrC,QACxC,MAAM8C,EAAkB7C,EAAgBmE,GACxCT,EAAAE,cAAwBf,EAAgB9C,QACxC,MAAMoD,EAAsBnD,EAAgBoE,GACnBV,EAAAC,kBAAGR,EAAoBpD,eCZlC,SAAWW,GACvB,IACE,OAAOK,KAAKC,UAAUU,EAAK2C,OAAqB,qBCNpB,oBDMyC3D,GACtE,CAAC,MAAOwB,GACP,OAAOnB,KAAKC,UAAU,CACpBG,OAAQ,QACRC,MAAOc,EAAIb,SAEd,CACH"}
|
|
1
|
+
{"version":3,"file":"pollResultEs.js","sources":["../../dom-shared/dist/chunkify.js","../../dom-shared/dist/poll.js","../../dom-shared/dist/pollify.js","../../dom-shared/dist/browser/absolutizeUrl.js","../../dom-shared/dist/browser/isInlineFrame.js","../../dom-shared/dist/browser/isAccessibleFrame.js","../../dom-shared/dist/index.js","../src/browser/pollResult.ts","../src/browser/constants.ts"],"sourcesContent":["\"use strict\";\nfunction charCodeAt(string, index = 0) {\n const code = string.charCodeAt(index);\n // if the code of high word (16 bits) in this diapason the character encoded by two words\n if (code >= 0xd800 && code < 0xdc00) {\n const high = code;\n const low = string.charCodeAt(index + 1);\n // convert 2 utf16le words into integer code\n return (high - 0xd800) * 0x400 + (low - 0xdc00) + 0x10000;\n }\n // diapason is reserved for surrogates, we can skip it\n if (0xdc00 <= code && code <= 0xdfff)\n return -1;\n return code;\n}\nfunction chunkify(string, chunkByteLength) {\n const chunks = [];\n let currChunkByteLength = 0;\n for (let index = 0; index < string.length; ++index) {\n const code = charCodeAt(string, index);\n let charByteLength = 0;\n if (code > 0) {\n if (code < 128)\n charByteLength = 1;\n else if (code < 2048)\n charByteLength = 2;\n else if (code < 65536)\n charByteLength = 3;\n else if (code < 2097152)\n charByteLength = 4;\n else if (code < 67108864)\n charByteLength = 5;\n else\n charByteLength = 6;\n }\n if (currChunkByteLength + charByteLength > chunkByteLength) {\n chunks.push(index);\n currChunkByteLength = charByteLength;\n }\n else {\n currChunkByteLength += charByteLength;\n }\n }\n return chunks;\n}\nmodule.exports = chunkify;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nconst STATUSES = {\n WIP: 'WIP',\n SUCCESS: 'SUCCESS',\n SUCCESS_CHUNKED: 'SUCCESS_CHUNKED',\n ERROR: 'ERROR',\n};\nconst _DEFAULT_CHUNK_BYTE_LENGTH = 268435456; // 256MB\nfunction createPollResponse(state, { chunkByteLength = 0 } = {}) {\n var _a;\n if (!state) {\n return {\n status: STATUSES.ERROR,\n error: 'unexpected poll request received - cannot find state of current operation',\n };\n }\n else if (state.value) {\n if (chunkByteLength) {\n if (!state.chunks) {\n try {\n const _nativeStringify = typeof window !== 'undefined' ? (_a = window.__EYES__APPLITOOLS__) === null || _a === void 0 ? void 0 : _a._stringify : undefined;\n const stringified = (_nativeStringify !== null && _nativeStringify !== void 0 ? _nativeStringify : JSON.stringify)(state.value);\n state.chunks = (0, chunkify_1.default)(stringified, chunkByteLength);\n if (state.chunks.length > 0) {\n state.from = 0;\n state.value = stringified;\n }\n }\n catch (e) {\n return { status: STATUSES.ERROR, error: e.message };\n }\n }\n if (state.from >= 0) {\n return {\n status: STATUSES.SUCCESS_CHUNKED,\n value: state.value.substring(state.from, (state.from = state.chunks.shift())),\n done: !state.from,\n };\n }\n }\n return { status: STATUSES.SUCCESS, value: state.value };\n }\n else if (state.error) {\n return { status: STATUSES.ERROR, error: state.error };\n }\n else {\n return { status: STATUSES.WIP };\n }\n}\nfunction poll(context, key, options = {}) {\n context = context || {};\n const result = createPollResponse(context[key], options);\n if (result.status === STATUSES.SUCCESS ||\n result.status === STATUSES.ERROR ||\n (result.status === STATUSES.SUCCESS_CHUNKED && result.done)) {\n delete context[key];\n }\n return result;\n}\nmodule.exports = poll;\n","\"use strict\";\nconst poll = require(\"./poll\");\nfunction pollify(script, context, key) {\n return (options) => function (...args) {\n if (!context[key]) {\n context[key] = {};\n Promise.resolve()\n .then(() => script(...args))\n .then(value => (context[key].value = value))\n .catch(err => (context[key].error = err.message + '\\nStack:' + err.stack));\n }\n return poll(context, key, options);\n };\n}\nmodule.exports = pollify;\n","\"use strict\";\nfunction isAbsoluteUrl(url) {\n try {\n new URL(url);\n return true;\n }\n catch (err) {\n return false;\n }\n}\nfunction absolutizeUrl(url, baseUrl) {\n if (isAbsoluteUrl(url))\n return url;\n let isEncoded = true;\n try {\n isEncoded = url !== decodeURI(url);\n }\n catch (err) {\n isEncoded = true;\n }\n try {\n const absoluteUrl = new URL(url, baseUrl).href;\n return !isEncoded ? decodeURI(absoluteUrl) : absoluteUrl;\n }\n catch (err) {\n return !isEncoded ? decodeURI(url) : url;\n }\n}\nmodule.exports = absolutizeUrl;\n","\"use strict\";\nfunction isInlineFrame(frame) {\n return (frame.contentDocument &&\n frame.contentDocument.location &&\n !/^https?:$/.test(frame.contentDocument.location.protocol));\n}\nmodule.exports = isInlineFrame;\n","\"use strict\";\nfunction isAccessibleFrame(frame) {\n try {\n const doc = frame.contentDocument;\n return Boolean(doc && doc.defaultView && doc.defaultView.frameElement);\n }\n catch (err) {\n return false;\n }\n}\nmodule.exports = isAccessibleFrame;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isAccessibleFrame = exports.isInlineFrame = exports.absolutizeUrl = exports.poll = exports.pollify = exports.chunkify = void 0;\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nexports.chunkify = chunkify_1.default;\nconst pollify_1 = __importDefault(require(\"./pollify\"));\nexports.pollify = pollify_1.default;\nconst poll_1 = __importDefault(require(\"./poll\"));\nexports.poll = poll_1.default;\nconst absolutizeUrl_1 = __importDefault(require(\"./browser/absolutizeUrl\"));\nexports.absolutizeUrl = absolutizeUrl_1.default;\nconst isInlineFrame_1 = __importDefault(require(\"./browser/isInlineFrame\"));\nexports.isInlineFrame = isInlineFrame_1.default;\nconst isAccessibleFrame_1 = __importDefault(require(\"./browser/isAccessibleFrame\"));\nexports.isAccessibleFrame = isAccessibleFrame_1.default;\n",null,null],"names":["charCodeAt","string","index","code","chunkify_1","chunkByteLength","chunks","currChunkByteLength","length","charByteLength","push","mod","__esModule","default","__importDefault","require$$0","STATUSES","WIP","SUCCESS","SUCCESS_CHUNKED","ERROR","poll_1","context","key","options","result","state","_a","value","_nativeStringify","window","__EYES__APPLITOOLS__","_stringify","undefined","stringified","JSON","stringify","from","e","status","error","message","substring","shift","done","createPollResponse","poll","pollify_1","script","args","Promise","resolve","then","catch","err","stack","absolutizeUrl_1","url","baseUrl","URL","isAbsoluteUrl","isEncoded","decodeURI","absoluteUrl","href","isInlineFrame_1","frame","contentDocument","location","test","protocol","isAccessibleFrame_1","doc","Boolean","defaultView","frameElement","Object","defineProperty","dist","isAccessibleFrame","isInlineFrame","absolutizeUrl","pollify","chunkify","require$$1","require$$2","require$$3","require$$4","require$$5","eyesNs","cleanWindow"],"mappings":"kDACA,SAASA,EAAWC,EAAQC,EAAQ,GAChC,MAAMC,EAAOF,EAAOD,WAAWE,GAE/B,GAAIC,GAAQ,OAAUA,EAAO,MAAQ,CAIjC,OAAyB,MAHZA,EAGE,QAFHF,EAAOD,WAAWE,EAAQ,GAEE,OAAU,KACrD,CAED,OAAI,OAAUC,GAAQA,GAAQ,OAClB,EACLA,CACX,CA+BA,IAAAC,EA9BA,SAAkBH,EAAQI,GACtB,MAAMC,EAAS,GACf,IAAIC,EAAsB,EAC1B,IAAK,IAAIL,EAAQ,EAAGA,EAAQD,EAAOO,SAAUN,EAAO,CAChD,MAAMC,EAAOH,EAAWC,EAAQC,GAChC,IAAIO,EAAiB,EACjBN,EAAO,IAEHM,EADAN,EAAO,IACU,EACZA,EAAO,KACK,EACZA,EAAO,MACK,EACZA,EAAO,QACK,EACZA,EAAO,SACK,EAEA,GAErBI,EAAsBE,EAAiBJ,GACvCC,EAAOI,KAAKR,GACZK,EAAsBE,GAGtBF,GAAuBE,CAE9B,CACD,OAAOH,CACX,ECxCA,MAAMF,EAHkD,SAAUO,GAC9D,OAAQA,GAAOA,EAAIC,WAAcD,EAAM,CAAEE,QAAWF,EACxD,CACmBG,CAAgBC,GAC7BC,EAAW,CACbC,IAAK,MACLC,QAAS,UACTC,gBAAiB,kBACjBC,MAAO,SAsDX,IAAAC,EAVA,SAAcC,EAASC,EAAKC,EAAU,CAAA,GAElC,MAAMC,EA3CV,SAA4BC,GAAOrB,gBAAEA,EAAkB,GAAM,IACzD,IAAIsB,EACJ,GAAKD,EAMA,IAAIA,EAAME,MAAO,CAClB,GAAIvB,EAAiB,CACjB,IAAKqB,EAAMpB,OACP,IACI,MAA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