@cloudcare/browser-rum 3.2.33 → 3.2.36
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/bundle/dataflux-rum.js +1 -1
- package/cjs/boot/buildEnv.js +1 -1
- package/cjs/domain/assembly.js +1 -0
- package/cjs/domain/assembly.js.map +1 -1
- package/cjs/domain/contexts/internalContext.js +1 -0
- package/cjs/domain/contexts/internalContext.js.map +1 -1
- package/cjs/domain/contexts/urlContexts.js +4 -2
- package/cjs/domain/contexts/urlContexts.js.map +1 -1
- package/cjs/domain/deflate/deflateEncoder.js +36 -41
- package/cjs/domain/deflate/deflateEncoder.js.map +1 -1
- package/cjs/domain/deflate/deflateWorker.js +1 -1
- package/cjs/domain/locationChangeObservable.js +7 -2
- package/cjs/domain/locationChangeObservable.js.map +1 -1
- package/esm/boot/buildEnv.js +1 -1
- package/esm/domain/assembly.js +1 -0
- package/esm/domain/assembly.js.map +1 -1
- package/esm/domain/contexts/internalContext.js +1 -0
- package/esm/domain/contexts/internalContext.js.map +1 -1
- package/esm/domain/contexts/urlContexts.js +4 -2
- package/esm/domain/contexts/urlContexts.js.map +1 -1
- package/esm/domain/deflate/deflateEncoder.js +36 -41
- package/esm/domain/deflate/deflateEncoder.js.map +1 -1
- package/esm/domain/deflate/deflateWorker.js +1 -1
- package/esm/domain/locationChangeObservable.js +7 -2
- package/esm/domain/locationChangeObservable.js.map +1 -1
- package/package.json +4 -4
- package/src/domain/assembly.js +1 -0
- package/src/domain/contexts/internalContext.js +1 -0
- package/src/domain/contexts/urlContexts.js +4 -2
- package/src/domain/deflate/deflateEncoder.js +42 -40
- package/src/domain/locationChangeObservable.js +9 -2
- package/types/index.d.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assembly.js","names":["extend2Lev","withSnakeCaseKeys","timeStampNow","isEmptyObject","LifeCycleEventType","RumEventType","deviceInfo","currentDrift","createEventRateLimiter","limitModification","display","assign","round","SessionType","SYNTHETICS","USER","VIEW_MODIFIABLE_FIELD_PATHS","USER_CUSTOMIZABLE_FIELD_PATHS","context","ROOT_MODIFIABLE_FIELD_PATHS","service","version","modifiableFieldPathsByEvent","startRumAssembly","configuration","lifeCycle","sessionManager","userSessionManager","viewContexts","urlContexts","actionContexts","displayContext","getCommonContext","reportError","VIEW","_objectSpread","ERROR","RESOURCE","ACTION","LONG_TASK","eventRateLimiters","eventRateLimiterThreshold","subscribe","RAW_RUM_EVENT_COLLECTED","data","startTime","rawRumEvent","savedCommonContext","customerContext","domainContext","viewContext","findView","urlContext","findUrl","session","findTrackedSession","isErrorSession","sessionHasError","actionId","findActionId","actionIds","findAllActionId","commonContext","rumContext","_gc","sdkName","sdkVersion","drift","session_sample_rate","sessionSampleRate","session_replay_sample_rate","sessionReplaySampleRate","session_on_error_sample_rate","sessionOnErrorSampleRate","session_replay_on_error_sample_rate","sessionReplayOnErrorSampleRate","terminal","type","application","id","applicationId","device","env","source","date","user","getId","is_signin","is_login","getSessionType","view","name","path","url","referrer","host","pathGroup","urlQuery","action","needToAssembleWithAction","ids","undefined","get","rumEvent","serverRumEvent","has_replay","hasReplay","errorSessionReplayAllowed","sampled_for_error_replay","sampled_for_error_session","error_timestamp_for_session","sessionErrorTimestamp","shouldSend","beforeSend","notify","RUM_EVENT_COLLECTED","event","result","warn","rateLimitReached","isLimitReached","indexOf","window","_DATAFLUX_SYNTHETICS_BROWSER"],"sources":["../../src/domain/assembly.js"],"sourcesContent":["import {\n extend2Lev,\n withSnakeCaseKeys,\n timeStampNow,\n isEmptyObject,\n LifeCycleEventType,\n RumEventType,\n deviceInfo,\n currentDrift,\n createEventRateLimiter,\n limitModification,\n display,\n assign,\n round\n} from '@cloudcare/browser-core'\nvar SessionType = {\n SYNTHETICS: 'synthetics',\n USER: 'user'\n}\n\nvar VIEW_MODIFIABLE_FIELD_PATHS = {\n 'view.url': 'string',\n 'view.referrer': 'string'\n}\n\nvar USER_CUSTOMIZABLE_FIELD_PATHS = {\n context: 'object'\n}\nconst ROOT_MODIFIABLE_FIELD_PATHS = {\n service: 'string',\n version: 'string'\n}\nvar modifiableFieldPathsByEvent = {}\nexport function startRumAssembly(\n configuration,\n lifeCycle,\n sessionManager,\n userSessionManager,\n viewContexts,\n urlContexts,\n actionContexts,\n displayContext,\n getCommonContext,\n reportError\n) {\n modifiableFieldPathsByEvent[RumEventType.VIEW] = {\n ...USER_CUSTOMIZABLE_FIELD_PATHS,\n ...VIEW_MODIFIABLE_FIELD_PATHS\n }\n modifiableFieldPathsByEvent[RumEventType.ERROR] = assign(\n {\n 'error.message': 'string',\n 'error.stack': 'string',\n 'error.resource.url': 'string'\n },\n USER_CUSTOMIZABLE_FIELD_PATHS,\n VIEW_MODIFIABLE_FIELD_PATHS,\n ROOT_MODIFIABLE_FIELD_PATHS\n )\n modifiableFieldPathsByEvent[RumEventType.RESOURCE] = assign(\n {\n 'resource.url': 'string'\n },\n USER_CUSTOMIZABLE_FIELD_PATHS,\n VIEW_MODIFIABLE_FIELD_PATHS,\n ROOT_MODIFIABLE_FIELD_PATHS\n )\n modifiableFieldPathsByEvent[RumEventType.ACTION] = assign(\n {\n 'action.target.name': 'string'\n },\n USER_CUSTOMIZABLE_FIELD_PATHS,\n VIEW_MODIFIABLE_FIELD_PATHS,\n ROOT_MODIFIABLE_FIELD_PATHS\n )\n modifiableFieldPathsByEvent[RumEventType.LONG_TASK] = assign(\n {},\n USER_CUSTOMIZABLE_FIELD_PATHS,\n VIEW_MODIFIABLE_FIELD_PATHS\n )\n var eventRateLimiters = {}\n eventRateLimiters[RumEventType.ERROR] = createEventRateLimiter(\n RumEventType.ERROR,\n configuration.eventRateLimiterThreshold,\n reportError\n )\n eventRateLimiters[RumEventType.ACTION] = createEventRateLimiter(\n RumEventType.ACTION,\n configuration.eventRateLimiterThreshold,\n reportError\n )\n lifeCycle.subscribe(\n LifeCycleEventType.RAW_RUM_EVENT_COLLECTED,\n function (data) {\n var startTime = data.startTime\n var rawRumEvent = data.rawRumEvent\n var savedCommonContext = data.savedCommonContext\n var customerContext = data.customerContext\n var domainContext = data.domainContext\n var viewContext = viewContexts.findView(startTime)\n var urlContext = urlContexts.findUrl(startTime)\n var session = sessionManager.findTrackedSession(startTime)\n if (session && session.isErrorSession && !session.sessionHasError) return\n if (session && viewContext && urlContext) {\n var actionId = actionContexts.findActionId(startTime)\n var actionIds = actionContexts.findAllActionId(startTime)\n var commonContext = savedCommonContext || getCommonContext()\n var rumContext = {\n _gc: {\n sdkName: configuration.sdkName,\n sdkVersion: configuration.sdkVersion,\n drift: currentDrift(),\n configuration: {\n session_sample_rate: round(configuration.sessionSampleRate, 3),\n session_replay_sample_rate: round(\n configuration.sessionReplaySampleRate,\n 3\n ),\n session_on_error_sample_rate: round(\n configuration.sessionOnErrorSampleRate,\n 3\n ),\n session_replay_on_error_sample_rate: round(\n configuration.sessionReplayOnErrorSampleRate,\n 3\n )\n }\n },\n terminal: {\n type: 'web'\n },\n application: {\n id: configuration.applicationId\n },\n device: deviceInfo,\n env: configuration.env || '',\n service: viewContext.service || configuration.service || 'browser',\n version: viewContext.version || configuration.version || '',\n source: 'browser',\n date: timeStampNow(),\n user: {\n id: userSessionManager.getId(),\n is_signin: 'F',\n is_login: false\n },\n session: {\n // must be computed on each event because synthetics instrumentation can be done after sdk execution\n // cf https://github.com/puppeteer/puppeteer/issues/3667\n type: getSessionType(),\n id: session.id\n },\n view: {\n id: viewContext.id,\n name: viewContext.name || urlContext.path,\n url: urlContext.url,\n referrer: urlContext.referrer,\n host: urlContext.host,\n path: urlContext.path,\n pathGroup: urlContext.pathGroup,\n urlQuery: urlContext.urlQuery\n },\n action:\n needToAssembleWithAction(rawRumEvent) && actionId\n ? { id: actionId, ids: actionIds }\n : undefined,\n display: displayContext.get()\n }\n var rumEvent = extend2Lev(rumContext, viewContext, rawRumEvent)\n var serverRumEvent = withSnakeCaseKeys(rumEvent)\n var context = extend2Lev(\n {},\n commonContext.context,\n viewContext.context,\n customerContext\n )\n if (!isEmptyObject(context)) {\n serverRumEvent.context = context\n }\n if (!('has_replay' in serverRumEvent.session)) {\n serverRumEvent.session.has_replay = commonContext.hasReplay\n }\n\n if (session.errorSessionReplayAllowed) {\n serverRumEvent.session.has_replay =\n serverRumEvent.session.has_replay && session.sessionHasError\n }\n if (serverRumEvent.type === 'view') {\n serverRumEvent.session.sampled_for_error_replay =\n session.errorSessionReplayAllowed\n serverRumEvent.session.sampled_for_error_session =\n session.isErrorSession\n serverRumEvent.session.error_timestamp_for_session =\n session.sessionErrorTimestamp\n }\n if (!isEmptyObject(commonContext.user)) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n serverRumEvent.user = extend2Lev(\n {\n // id: session.getAnonymousID(),\n is_signin: 'T',\n is_login: true\n },\n commonContext.user\n )\n }\n\n if (\n shouldSend(\n serverRumEvent,\n configuration.beforeSend,\n domainContext,\n eventRateLimiters\n )\n ) {\n if (isEmptyObject(serverRumEvent.context)) {\n delete serverRumEvent.context\n }\n lifeCycle.notify(\n LifeCycleEventType.RUM_EVENT_COLLECTED,\n serverRumEvent\n )\n }\n }\n }\n )\n}\n\nfunction shouldSend(event, beforeSend, domainContext, eventRateLimiters) {\n if (beforeSend) {\n var result = limitModification(\n event,\n modifiableFieldPathsByEvent[event.type],\n function (event) {\n return beforeSend(event, domainContext)\n }\n )\n if (result === false && event.type !== RumEventType.VIEW) {\n return false\n }\n if (result === false) {\n display.warn(\"Can't dismiss view events using beforeSend!\")\n }\n }\n var rateLimitReached = false\n if (eventRateLimiters[event.type]) {\n rateLimitReached = eventRateLimiters[event.type].isLimitReached()\n }\n return !rateLimitReached\n}\nfunction needToAssembleWithAction(event) {\n return (\n [RumEventType.ERROR, RumEventType.RESOURCE, RumEventType.LONG_TASK].indexOf(\n event.type\n ) !== -1\n )\n}\n\nfunction getSessionType() {\n return window._DATAFLUX_SYNTHETICS_BROWSER === undefined\n ? SessionType.USER\n : SessionType.SYNTHETICS\n}\n"],"mappings":";;;;;;AAAA,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AI,KAAKxE,YAAY,CAAC6B,IAAI,EAAE;MACxD,OAAO,KAAK;IACd;IACA,IAAImF,MAAM,KAAK,KAAK,EAAE;MACpB3G,OAAO,CAAC4G,IAAI,CAAC,6CAA6C,CAAC;IAC7D;EACF;EACA,IAAIC,gBAAgB,GAAG,KAAK;EAC5B,IAAI/E,iBAAiB,CAAC4E,KAAK,CAACvC,IAAI,CAAC,EAAE;IACjC0C,gBAAgB,GAAG/E,iBAAiB,CAAC4E,KAAK,CAACvC,IAAI,CAAC,CAAC2C,cAAc,CAAC,CAAC;EACnE;EACA,OAAO,CAACD,gBAAgB;AAC1B;AACA,SAASpB,wBAAwBA,CAACiB,KAAK,EAAE;EACvC,OACE,CAAC/G,YAAY,CAAC+B,KAAK,EAAE/B,YAAY,CAACgC,QAAQ,EAAEhC,YAAY,CAACkC,SAAS,CAAC,CAACkF,OAAO,CACzEL,KAAK,CAACvC,IACR,CAAC,KAAK,CAAC,CAAC;AAEZ;AAEA,SAASY,cAAcA,CAAA,EAAG;EACxB,OAAOiC,MAAM,CAACC,4BAA4B,KAAKtB,SAAS,GACpDxF,WAAW,CAACE,IAAI,GAChBF,WAAW,CAACC,UAAU;AAC5B","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"assembly.js","names":["extend2Lev","withSnakeCaseKeys","timeStampNow","isEmptyObject","LifeCycleEventType","RumEventType","deviceInfo","currentDrift","createEventRateLimiter","limitModification","display","assign","round","SessionType","SYNTHETICS","USER","VIEW_MODIFIABLE_FIELD_PATHS","USER_CUSTOMIZABLE_FIELD_PATHS","context","ROOT_MODIFIABLE_FIELD_PATHS","service","version","modifiableFieldPathsByEvent","startRumAssembly","configuration","lifeCycle","sessionManager","userSessionManager","viewContexts","urlContexts","actionContexts","displayContext","getCommonContext","reportError","VIEW","_objectSpread","ERROR","RESOURCE","ACTION","LONG_TASK","eventRateLimiters","eventRateLimiterThreshold","subscribe","RAW_RUM_EVENT_COLLECTED","data","startTime","rawRumEvent","savedCommonContext","customerContext","domainContext","viewContext","findView","urlContext","findUrl","session","findTrackedSession","isErrorSession","sessionHasError","actionId","findActionId","actionIds","findAllActionId","commonContext","rumContext","_gc","sdkName","sdkVersion","drift","session_sample_rate","sessionSampleRate","session_replay_sample_rate","sessionReplaySampleRate","session_on_error_sample_rate","sessionOnErrorSampleRate","session_replay_on_error_sample_rate","sessionReplayOnErrorSampleRate","terminal","type","application","id","applicationId","device","env","source","date","user","getId","is_signin","is_login","getSessionType","view","name","path","url","referrer","host","pathGroup","pathname","urlQuery","action","needToAssembleWithAction","ids","undefined","get","rumEvent","serverRumEvent","has_replay","hasReplay","errorSessionReplayAllowed","sampled_for_error_replay","sampled_for_error_session","error_timestamp_for_session","sessionErrorTimestamp","shouldSend","beforeSend","notify","RUM_EVENT_COLLECTED","event","result","warn","rateLimitReached","isLimitReached","indexOf","window","_DATAFLUX_SYNTHETICS_BROWSER"],"sources":["../../src/domain/assembly.js"],"sourcesContent":["import {\n extend2Lev,\n withSnakeCaseKeys,\n timeStampNow,\n isEmptyObject,\n LifeCycleEventType,\n RumEventType,\n deviceInfo,\n currentDrift,\n createEventRateLimiter,\n limitModification,\n display,\n assign,\n round\n} from '@cloudcare/browser-core'\nvar SessionType = {\n SYNTHETICS: 'synthetics',\n USER: 'user'\n}\n\nvar VIEW_MODIFIABLE_FIELD_PATHS = {\n 'view.url': 'string',\n 'view.referrer': 'string'\n}\n\nvar USER_CUSTOMIZABLE_FIELD_PATHS = {\n context: 'object'\n}\nconst ROOT_MODIFIABLE_FIELD_PATHS = {\n service: 'string',\n version: 'string'\n}\nvar modifiableFieldPathsByEvent = {}\nexport function startRumAssembly(\n configuration,\n lifeCycle,\n sessionManager,\n userSessionManager,\n viewContexts,\n urlContexts,\n actionContexts,\n displayContext,\n getCommonContext,\n reportError\n) {\n modifiableFieldPathsByEvent[RumEventType.VIEW] = {\n ...USER_CUSTOMIZABLE_FIELD_PATHS,\n ...VIEW_MODIFIABLE_FIELD_PATHS\n }\n modifiableFieldPathsByEvent[RumEventType.ERROR] = assign(\n {\n 'error.message': 'string',\n 'error.stack': 'string',\n 'error.resource.url': 'string'\n },\n USER_CUSTOMIZABLE_FIELD_PATHS,\n VIEW_MODIFIABLE_FIELD_PATHS,\n ROOT_MODIFIABLE_FIELD_PATHS\n )\n modifiableFieldPathsByEvent[RumEventType.RESOURCE] = assign(\n {\n 'resource.url': 'string'\n },\n USER_CUSTOMIZABLE_FIELD_PATHS,\n VIEW_MODIFIABLE_FIELD_PATHS,\n ROOT_MODIFIABLE_FIELD_PATHS\n )\n modifiableFieldPathsByEvent[RumEventType.ACTION] = assign(\n {\n 'action.target.name': 'string'\n },\n USER_CUSTOMIZABLE_FIELD_PATHS,\n VIEW_MODIFIABLE_FIELD_PATHS,\n ROOT_MODIFIABLE_FIELD_PATHS\n )\n modifiableFieldPathsByEvent[RumEventType.LONG_TASK] = assign(\n {},\n USER_CUSTOMIZABLE_FIELD_PATHS,\n VIEW_MODIFIABLE_FIELD_PATHS\n )\n var eventRateLimiters = {}\n eventRateLimiters[RumEventType.ERROR] = createEventRateLimiter(\n RumEventType.ERROR,\n configuration.eventRateLimiterThreshold,\n reportError\n )\n eventRateLimiters[RumEventType.ACTION] = createEventRateLimiter(\n RumEventType.ACTION,\n configuration.eventRateLimiterThreshold,\n reportError\n )\n lifeCycle.subscribe(\n LifeCycleEventType.RAW_RUM_EVENT_COLLECTED,\n function (data) {\n var startTime = data.startTime\n var rawRumEvent = data.rawRumEvent\n var savedCommonContext = data.savedCommonContext\n var customerContext = data.customerContext\n var domainContext = data.domainContext\n var viewContext = viewContexts.findView(startTime)\n var urlContext = urlContexts.findUrl(startTime)\n var session = sessionManager.findTrackedSession(startTime)\n if (session && session.isErrorSession && !session.sessionHasError) return\n if (session && viewContext && urlContext) {\n var actionId = actionContexts.findActionId(startTime)\n var actionIds = actionContexts.findAllActionId(startTime)\n var commonContext = savedCommonContext || getCommonContext()\n var rumContext = {\n _gc: {\n sdkName: configuration.sdkName,\n sdkVersion: configuration.sdkVersion,\n drift: currentDrift(),\n configuration: {\n session_sample_rate: round(configuration.sessionSampleRate, 3),\n session_replay_sample_rate: round(\n configuration.sessionReplaySampleRate,\n 3\n ),\n session_on_error_sample_rate: round(\n configuration.sessionOnErrorSampleRate,\n 3\n ),\n session_replay_on_error_sample_rate: round(\n configuration.sessionReplayOnErrorSampleRate,\n 3\n )\n }\n },\n terminal: {\n type: 'web'\n },\n application: {\n id: configuration.applicationId\n },\n device: deviceInfo,\n env: configuration.env || '',\n service: viewContext.service || configuration.service || 'browser',\n version: viewContext.version || configuration.version || '',\n source: 'browser',\n date: timeStampNow(),\n user: {\n id: userSessionManager.getId(),\n is_signin: 'F',\n is_login: false\n },\n session: {\n // must be computed on each event because synthetics instrumentation can be done after sdk execution\n // cf https://github.com/puppeteer/puppeteer/issues/3667\n type: getSessionType(),\n id: session.id\n },\n view: {\n id: viewContext.id,\n name: viewContext.name || urlContext.path,\n url: urlContext.url,\n referrer: urlContext.referrer,\n host: urlContext.host,\n path: urlContext.path,\n pathGroup: urlContext.pathGroup,\n pathname: urlContext.pathname,\n urlQuery: urlContext.urlQuery\n },\n action:\n needToAssembleWithAction(rawRumEvent) && actionId\n ? { id: actionId, ids: actionIds }\n : undefined,\n display: displayContext.get()\n }\n var rumEvent = extend2Lev(rumContext, viewContext, rawRumEvent)\n var serverRumEvent = withSnakeCaseKeys(rumEvent)\n var context = extend2Lev(\n {},\n commonContext.context,\n viewContext.context,\n customerContext\n )\n if (!isEmptyObject(context)) {\n serverRumEvent.context = context\n }\n if (!('has_replay' in serverRumEvent.session)) {\n serverRumEvent.session.has_replay = commonContext.hasReplay\n }\n\n if (session.errorSessionReplayAllowed) {\n serverRumEvent.session.has_replay =\n serverRumEvent.session.has_replay && session.sessionHasError\n }\n if (serverRumEvent.type === 'view') {\n serverRumEvent.session.sampled_for_error_replay =\n session.errorSessionReplayAllowed\n serverRumEvent.session.sampled_for_error_session =\n session.isErrorSession\n serverRumEvent.session.error_timestamp_for_session =\n session.sessionErrorTimestamp\n }\n if (!isEmptyObject(commonContext.user)) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n serverRumEvent.user = extend2Lev(\n {\n // id: session.getAnonymousID(),\n is_signin: 'T',\n is_login: true\n },\n commonContext.user\n )\n }\n\n if (\n shouldSend(\n serverRumEvent,\n configuration.beforeSend,\n domainContext,\n eventRateLimiters\n )\n ) {\n if (isEmptyObject(serverRumEvent.context)) {\n delete serverRumEvent.context\n }\n lifeCycle.notify(\n LifeCycleEventType.RUM_EVENT_COLLECTED,\n serverRumEvent\n )\n }\n }\n }\n )\n}\n\nfunction shouldSend(event, beforeSend, domainContext, eventRateLimiters) {\n if (beforeSend) {\n var result = limitModification(\n event,\n modifiableFieldPathsByEvent[event.type],\n function (event) {\n return beforeSend(event, domainContext)\n }\n )\n if (result === false && event.type !== RumEventType.VIEW) {\n return false\n }\n if (result === false) {\n display.warn(\"Can't dismiss view events using beforeSend!\")\n }\n }\n var rateLimitReached = false\n if (eventRateLimiters[event.type]) {\n rateLimitReached = eventRateLimiters[event.type].isLimitReached()\n }\n return !rateLimitReached\n}\nfunction needToAssembleWithAction(event) {\n return (\n [RumEventType.ERROR, RumEventType.RESOURCE, RumEventType.LONG_TASK].indexOf(\n event.type\n ) !== -1\n )\n}\n\nfunction getSessionType() {\n return window._DATAFLUX_SYNTHETICS_BROWSER === undefined\n ? SessionType.USER\n : SessionType.SYNTHETICS\n}\n"],"mappings":";;;;;;AAAA,SACEA,UAAU,EACVC,iBAAiB,EACjBC,YAAY,EACZC,aAAa,EACbC,kBAAkB,EAClBC,YAAY,EACZC,UAAU,EACVC,YAAY,EACZC,sBAAsB,EACtBC,iBAAiB,EACjBC,OAAO,EACPC,MAAM,EACNC,KAAK,QACA,yBAAyB;AAChC,IAAIC,WAAW,GAAG;EAChBC,UAAU,EAAE,YAAY;EACxBC,IAAI,EAAE;AACR,CAAC;AAED,IAAIC,2BAA2B,GAAG;EAChC,UAAU,EAAE,QAAQ;E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AgB,GAAGhF,iBAAiB,CAAC6E,KAAK,CAACxC,IAAI,CAAC,CAAC4C,cAAc,CAAC,CAAC;EACnE;EACA,OAAO,CAACD,gBAAgB;AAC1B;AACA,SAASpB,wBAAwBA,CAACiB,KAAK,EAAE;EACvC,OACE,CAAChH,YAAY,CAAC+B,KAAK,EAAE/B,YAAY,CAACgC,QAAQ,EAAEhC,YAAY,CAACkC,SAAS,CAAC,CAACmF,OAAO,CACzEL,KAAK,CAACxC,IACR,CAAC,KAAK,CAAC,CAAC;AAEZ;AAEA,SAASY,cAAcA,CAAA,EAAG;EACxB,OAAOkC,MAAM,CAACC,4BAA4B,KAAKtB,SAAS,GACpDzF,WAAW,CAACE,IAAI,GAChBF,WAAW,CAACC,UAAU;AAC5B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internalContext.js","names":["startInternalContext","applicationId","sessionManager","viewContexts","actionContexts","urlContexts","get","startTime","viewContext","findView","urlContext","findUrl","session","findTrackedSession","actionId","findActionId","actionIds","findAllActionId","application","id","userAction","ids","undefined","view","name","path","url","referrer","host","pathGroup","urlQuery"],"sources":["../../../src/domain/contexts/internalContext.js"],"sourcesContent":["/**\n * Internal context keep returning v1 format\n * to not break compatibility with logs data format\n */\nexport function startInternalContext(\n applicationId,\n sessionManager,\n viewContexts,\n actionContexts,\n urlContexts\n) {\n return {\n get: function (startTime) {\n var viewContext = viewContexts.findView(startTime)\n var urlContext = urlContexts.findUrl(startTime)\n var session = sessionManager.findTrackedSession(startTime)\n if (session && viewContext && urlContext) {\n var actionId = actionContexts.findActionId(startTime)\n var actionIds = actionContexts.findAllActionId(startTime)\n return {\n application: {\n id: applicationId\n },\n session: {\n id: session.id\n },\n userAction: actionId\n ? {\n id: actionId,\n ids: actionIds\n }\n : undefined,\n view: {\n id: viewContext.id,\n name: viewContext.name || urlContext.path,\n url: urlContext.url,\n referrer: urlContext.referrer,\n host: urlContext.host,\n path: urlContext.path,\n pathGroup: urlContext.p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AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"internalContext.js","names":["startInternalContext","applicationId","sessionManager","viewContexts","actionContexts","urlContexts","get","startTime","viewContext","findView","urlContext","findUrl","session","findTrackedSession","actionId","findActionId","actionIds","findAllActionId","application","id","userAction","ids","undefined","view","name","path","url","referrer","host","pathGroup","pathname","urlQuery"],"sources":["../../../src/domain/contexts/internalContext.js"],"sourcesContent":["/**\n * Internal context keep returning v1 format\n * to not break compatibility with logs data format\n */\nexport function startInternalContext(\n applicationId,\n sessionManager,\n viewContexts,\n actionContexts,\n urlContexts\n) {\n return {\n get: function (startTime) {\n var viewContext = viewContexts.findView(startTime)\n var urlContext = urlContexts.findUrl(startTime)\n var session = sessionManager.findTrackedSession(startTime)\n if (session && viewContext && urlContext) {\n var actionId = actionContexts.findActionId(startTime)\n var actionIds = actionContexts.findAllActionId(startTime)\n return {\n application: {\n id: applicationId\n },\n session: {\n id: session.id\n },\n userAction: actionId\n ? {\n id: actionId,\n ids: actionIds\n }\n : undefined,\n view: {\n id: viewContext.id,\n name: viewContext.name || urlContext.path,\n url: urlContext.url,\n referrer: urlContext.referrer,\n host: urlContext.host,\n path: urlContext.path,\n pathGroup: urlContext.pathGroup,\n pathname: urlContext.pathname,\n urlQuery: urlContext.urlQuery\n }\n }\n }\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,OAAO,SAASA,oBAAoBA,CAClCC,aAAa,EACbC,cAAc,EACdC,YAAY,EACZC,cAAc,EACdC,WAAW,EACX;EACA,OAAO;IACLC,GAAG,EAAE,SAALA,GAAGA,CAAYC,SAAS,EAAE;MACxB,IAAIC,WAAW,GAAGL,YAAY,CAACM,QAAQ,CAACF,SAAS,CAAC;MAClD,IAAIG,UAAU,GAAGL,WAAW,CAACM,OAAO,CAACJ,SAAS,CAAC;MAC/C,IAAIK,OAAO,GAAGV,cAAc,CAACW,kBAAkB,CAACN,SAAS,CAAC;MAC1D,IAAIK,OAAO,IAAIJ,WAAW,IAAIE,UAAU,EAAE;QACxC,IAAII,QAAQ,GAAGV,cAAc,CAACW,YAAY,CAACR,SAAS,CAAC;QACrD,IAAIS,SAAS,GAAGZ,cAAc,CAACa,eAAe,CAACV,SAAS,CAAC;QACzD,OAAO;UACLW,WAAW,EAAE;YACXC,EAAE,EAAElB;UACN,CAAC;UACDW,OAAO,EAAE;YACPO,EAAE,EAAEP,OAAO,CAACO;UACd,CAAC;UACDC,UAAU,EAAEN,QAAQ,GAChB;YACEK,EAAE,EAAEL,QAAQ;YACZO,GAAG,EAAEL;UACP,CAAC,GACDM,SAAS;UACbC,IAAI,EAAE;YACJJ,EAAE,EAAEX,WAAW,CAACW,EAAE;YAClBK,IAAI,EAAEhB,WAAW,CAACgB,IAAI,IAAId,UAAU,CAACe,IAAI;YACzCC,GAAG,EAAEhB,UAAU,CAACgB,GAAG;YACnBC,QAAQ,EAAEjB,UAAU,CAACiB,QAAQ;YAC7BC,IAAI,EAAElB,UAAU,CAACkB,IAAI;YACrBH,IAAI,EAAEf,UAAU,CAACe,IAAI;YACrBI,SAAS,EAAEnB,UAAU,CAACmB,SAAS;YAC/BC,QAAQ,EAAEpB,UAAU,CAACoB,QAAQ;YAC7BC,QAAQ,EAAErB,UAAU,CAACqB;UACvB;QACF,CAAC;MACH;IACF;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -38,7 +38,8 @@ export function startUrlContexts(lifeCycle, locationChangeObservable, location)
|
|
|
38
38
|
});
|
|
39
39
|
function buildUrlContext(data) {
|
|
40
40
|
var isLocationChange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
41
|
-
var
|
|
41
|
+
var pathname = data.location.pathname;
|
|
42
|
+
var path = pathname;
|
|
42
43
|
var hash = data.location.hash;
|
|
43
44
|
if (hash && hash.indexOf('#/') === 0) {
|
|
44
45
|
path = '/' + getPathFromHash(hash);
|
|
@@ -49,7 +50,8 @@ export function startUrlContexts(lifeCycle, locationChangeObservable, location)
|
|
|
49
50
|
host: data.location.host,
|
|
50
51
|
path: path,
|
|
51
52
|
pathGroup: replaceNumberCharByPath(path),
|
|
52
|
-
urlQuery: getQueryParamsFromUrl(data.location.href)
|
|
53
|
+
urlQuery: getQueryParamsFromUrl(data.location.href),
|
|
54
|
+
pathname: pathname
|
|
53
55
|
};
|
|
54
56
|
}
|
|
55
57
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urlContexts.js","names":["LifeCycleEventType","SESSION_TIME_OUT_DELAY","relativeNow","createValueHistory","replaceNumberCharByPath","getQueryParamsFromUrl","isHashAnAnchor","getPathFromHash","URL_CONTEXT_TIME_OUT_DELAY","startUrlContexts","lifeCycle","locationChangeObservable","location","urlContextHistory","expireDelay","previousViewUrl","subscribe","BEFORE_VIEW_CREATED","data","viewUrl","href","add","buildUrlContext","url","referrer","document","startClocks","relative","AFTER_VIEW_ENDED","closeActive","endClocks","locationChangeSubscription","current","find","changeTime","newLocation","isLocationChange","arguments","length","undefined","
|
|
1
|
+
{"version":3,"file":"urlContexts.js","names":["LifeCycleEventType","SESSION_TIME_OUT_DELAY","relativeNow","createValueHistory","replaceNumberCharByPath","getQueryParamsFromUrl","isHashAnAnchor","getPathFromHash","URL_CONTEXT_TIME_OUT_DELAY","startUrlContexts","lifeCycle","locationChangeObservable","location","urlContextHistory","expireDelay","previousViewUrl","subscribe","BEFORE_VIEW_CREATED","data","viewUrl","href","add","buildUrlContext","url","referrer","document","startClocks","relative","AFTER_VIEW_ENDED","closeActive","endClocks","locationChangeSubscription","current","find","changeTime","newLocation","isLocationChange","arguments","length","undefined","pathname","path","hash","indexOf","host","pathGroup","urlQuery","findUrl","startTime","stop","unsubscribe"],"sources":["../../../src/domain/contexts/urlContexts.js"],"sourcesContent":["import {\n LifeCycleEventType,\n SESSION_TIME_OUT_DELAY,\n relativeNow,\n createValueHistory,\n replaceNumberCharByPath,\n getQueryParamsFromUrl,\n isHashAnAnchor,\n getPathFromHash\n} from '@cloudcare/browser-core'\n\n/**\n * We want to attach to an event:\n * - the url corresponding to its start\n * - the referrer corresponding to the previous view url (or document referrer for initial view)\n */\n\nexport var URL_CONTEXT_TIME_OUT_DELAY = SESSION_TIME_OUT_DELAY\n\nexport function startUrlContexts(\n lifeCycle,\n locationChangeObservable,\n location\n) {\n var urlContextHistory = createValueHistory({\n expireDelay: URL_CONTEXT_TIME_OUT_DELAY\n })\n\n var previousViewUrl\n\n lifeCycle.subscribe(LifeCycleEventType.BEFORE_VIEW_CREATED, function (data) {\n var viewUrl = location.href\n urlContextHistory.add(\n buildUrlContext({\n url: viewUrl,\n location: location,\n referrer: !previousViewUrl ? document.referrer : previousViewUrl\n }),\n data.startClocks.relative\n )\n previousViewUrl = viewUrl\n })\n lifeCycle.subscribe(LifeCycleEventType.AFTER_VIEW_ENDED, function (data) {\n urlContextHistory.closeActive(data.endClocks.relative)\n })\n var locationChangeSubscription = locationChangeObservable.subscribe(function (\n data\n ) {\n var current = urlContextHistory.find()\n if (current) {\n var changeTime = relativeNow()\n urlContextHistory.closeActive(changeTime)\n urlContextHistory.add(\n buildUrlContext(\n {\n url: data.newLocation.href,\n location: data.newLocation,\n referrer: current.referrer\n },\n true\n ),\n changeTime\n )\n }\n })\n\n function buildUrlContext(data, isLocationChange = false) {\n var pathname = data.location.pathname\n var path = pathname\n var hash = data.location.hash\n if (hash && hash.indexOf('#/') === 0) {\n path = '/' + getPathFromHash(hash)\n }\n return {\n url: data.url,\n referrer: data.referrer,\n host: data.location.host,\n path: path,\n pathGroup: replaceNumberCharByPath(path),\n urlQuery: getQueryParamsFromUrl(data.location.href),\n pathname: pathname\n }\n }\n\n return {\n findUrl: function (startTime) {\n return urlContextHistory.find(startTime)\n },\n stop: function () {\n locationChangeSubscription.unsubscribe()\n urlContextHistory.stop()\n }\n }\n}\n"],"mappings":"AAAA,SACEA,kBAAkB,EAClBC,sBAAsB,EACtBC,WAAW,EACXC,kBAAkB,EAClBC,uBAAuB,EACvBC,qBAAqB,EACrBC,cAAc,EACdC,eA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{
|
|
|
7
7
|
var rawBytesCount = 0;
|
|
8
8
|
var compressedData = [];
|
|
9
9
|
var compressedDataTrailer;
|
|
10
|
+
var _isEmpty = true;
|
|
10
11
|
var nextWriteActionId = 0;
|
|
11
12
|
var pendingWriteActions = [];
|
|
12
13
|
var wokerListener = addEventListener(worker, 'message', function (params) {
|
|
@@ -14,43 +15,38 @@ export function createDeflateEncoder(worker, streamId) {
|
|
|
14
15
|
if (workerResponse.type !== 'wrote' || workerResponse.streamId && workerResponse.streamId !== streamId) {
|
|
15
16
|
return;
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
var nextPendingAction = pendingWriteActions[0];
|
|
19
|
+
if (nextPendingAction) {
|
|
20
|
+
if (nextPendingAction.id === workerResponse.id) {
|
|
21
|
+
pendingWriteActions.shift();
|
|
22
|
+
rawBytesCount += workerResponse.additionalBytesCount;
|
|
23
|
+
compressedData.push(workerResponse.result);
|
|
24
|
+
compressedDataTrailer = workerResponse.trailer;
|
|
25
|
+
if (nextPendingAction.writeCallback) {
|
|
26
|
+
nextPendingAction.writeCallback(workerResponse.result.byteLength);
|
|
27
|
+
} else if (nextPendingAction.finishCallback) {
|
|
28
|
+
nextPendingAction.finishCallback();
|
|
29
|
+
}
|
|
30
|
+
} else if (nextPendingAction.id < workerResponse.id) {
|
|
31
|
+
removeMessageListener();
|
|
32
|
+
addTelemetryDebug('Worker responses received out of order.');
|
|
26
33
|
}
|
|
27
|
-
} else {
|
|
28
|
-
removeMessageListener();
|
|
29
|
-
addTelemetryDebug('Worker responses received out of order.');
|
|
30
34
|
}
|
|
35
|
+
// rawBytesCount += workerResponse.additionalBytesCount
|
|
36
|
+
// compressedData.push(workerResponse.result)
|
|
37
|
+
// compressedDataTrailer = workerResponse.trailer
|
|
38
|
+
// var nextPendingAction = pendingWriteActions.shift()
|
|
39
|
+
// if (nextPendingAction && nextPendingAction.id === workerResponse.id) {
|
|
40
|
+
// if (nextPendingAction.writeCallback) {
|
|
41
|
+
// nextPendingAction.writeCallback(workerResponse.result.byteLength)
|
|
42
|
+
// } else if (nextPendingAction.finishCallback) {
|
|
43
|
+
// nextPendingAction.finishCallback()
|
|
44
|
+
// }
|
|
45
|
+
// } else {
|
|
46
|
+
// removeMessageListener()
|
|
47
|
+
// addTelemetryDebug('Worker responses received out of order.')
|
|
48
|
+
// }
|
|
31
49
|
});
|
|
32
|
-
function uint8ToBase64(uint8) {
|
|
33
|
-
var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
34
|
-
var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : uint8.length;
|
|
35
|
-
// 截取需要的部分
|
|
36
|
-
var sliced = uint8.slice(start, end);
|
|
37
|
-
|
|
38
|
-
// 转成字符串
|
|
39
|
-
var binary = Array.from(sliced, function (_byte) {
|
|
40
|
-
return String.fromCharCode(_byte);
|
|
41
|
-
}).join('');
|
|
42
|
-
|
|
43
|
-
// 编码成 base64
|
|
44
|
-
return btoa(binary);
|
|
45
|
-
}
|
|
46
|
-
function uint8ToHex(uint8) {
|
|
47
|
-
var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
48
|
-
var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : uint8.length;
|
|
49
|
-
var sliced = uint8.slice(start, end);
|
|
50
|
-
return Array.from(sliced).map(function (_byte2) {
|
|
51
|
-
return _byte2.toString(16).padStart(2, '0');
|
|
52
|
-
}).join('');
|
|
53
|
-
}
|
|
54
50
|
var removeMessageListener = wokerListener.stop;
|
|
55
51
|
function consumeResult() {
|
|
56
52
|
var output = compressedData.length === 0 ? new Uint8Array(0) : concatBuffers(compressedData.concat(compressedDataTrailer));
|
|
@@ -65,18 +61,18 @@ export function createDeflateEncoder(worker, streamId) {
|
|
|
65
61
|
return result;
|
|
66
62
|
}
|
|
67
63
|
function sendResetIfNeeded() {
|
|
68
|
-
if (
|
|
64
|
+
if (!_isEmpty) {
|
|
69
65
|
worker.postMessage({
|
|
70
66
|
action: 'reset',
|
|
71
67
|
streamId: streamId
|
|
72
68
|
});
|
|
73
|
-
|
|
69
|
+
_isEmpty = true;
|
|
74
70
|
}
|
|
75
71
|
}
|
|
76
72
|
return {
|
|
77
73
|
isAsync: true,
|
|
78
74
|
isEmpty: function isEmpty() {
|
|
79
|
-
return
|
|
75
|
+
return _isEmpty;
|
|
80
76
|
},
|
|
81
77
|
write: function write(data, callback) {
|
|
82
78
|
worker.postMessage({
|
|
@@ -90,6 +86,7 @@ export function createDeflateEncoder(worker, streamId) {
|
|
|
90
86
|
writeCallback: callback,
|
|
91
87
|
data: data
|
|
92
88
|
});
|
|
89
|
+
_isEmpty = false;
|
|
93
90
|
nextWriteActionId += 1;
|
|
94
91
|
},
|
|
95
92
|
finish: function finish(callback) {
|
|
@@ -111,11 +108,9 @@ export function createDeflateEncoder(worker, streamId) {
|
|
|
111
108
|
finishSync: function finishSync() {
|
|
112
109
|
sendResetIfNeeded();
|
|
113
110
|
var pendingData = pendingWriteActions.map(function (pendingWriteAction) {
|
|
114
|
-
// Make sure we do not call any write or finish callback
|
|
115
|
-
delete pendingWriteAction.writeCallback;
|
|
116
|
-
delete pendingWriteAction.finishCallback;
|
|
117
111
|
return pendingWriteAction.data;
|
|
118
|
-
});
|
|
112
|
+
}).join('');
|
|
113
|
+
pendingWriteActions.length = 0;
|
|
119
114
|
return assign(consumeResult(), {
|
|
120
115
|
pendingData: pendingData
|
|
121
116
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deflateEncoder.js","names":["addEventListener","concatBuffers","addTelemetryDebug","assign","DeflateEncoderStreamId","REPLAY","RUM","createDeflateEncoder","worker","streamId","rawBytesCount","compressedData","compressedDataTrailer","nextWriteActionId","pendingWriteActions","wokerListener","params","workerResponse","data","type","
|
|
1
|
+
{"version":3,"file":"deflateEncoder.js","names":["addEventListener","concatBuffers","addTelemetryDebug","assign","DeflateEncoderStreamId","REPLAY","RUM","createDeflateEncoder","worker","streamId","rawBytesCount","compressedData","compressedDataTrailer","isEmpty","nextWriteActionId","pendingWriteActions","wokerListener","params","workerResponse","data","type","nextPendingAction","id","shift","additionalBytesCount","push","result","trailer","writeCallback","byteLength","finishCallback","removeMessageListener","stop","consumeResult","output","length","Uint8Array","concat","outputBytesCount","encoding","sendResetIfNeeded","postMessage","action","isAsync","write","callback","finish","forEach","pendingWriteAction","finishSync","pendingData","map","join","estimateEncodedBytesCount"],"sources":["../../../src/domain/deflate/deflateEncoder.js"],"sourcesContent":["import {\n addEventListener,\n concatBuffers,\n addTelemetryDebug,\n assign\n} from '@cloudcare/browser-core'\nexport var DeflateEncoderStreamId = {\n REPLAY: 1,\n RUM: 2\n}\nexport function createDeflateEncoder(worker, streamId) {\n var rawBytesCount = 0\n var compressedData = []\n var compressedDataTrailer\n\n var isEmpty = true\n var nextWriteActionId = 0\n var pendingWriteActions = []\n\n var wokerListener = addEventListener(worker, 'message', function (params) {\n var workerResponse = params.data\n if (\n workerResponse.type !== 'wrote' ||\n (workerResponse.streamId && workerResponse.streamId !== streamId)\n ) {\n return\n }\n var nextPendingAction = pendingWriteActions[0]\n if (nextPendingAction) {\n if (nextPendingAction.id === workerResponse.id) {\n pendingWriteActions.shift()\n\n rawBytesCount += workerResponse.additionalBytesCount\n compressedData.push(workerResponse.result)\n compressedDataTrailer = workerResponse.trailer\n\n if (nextPendingAction.writeCallback) {\n nextPendingAction.writeCallback(workerResponse.result.byteLength)\n } else if (nextPendingAction.finishCallback) {\n nextPendingAction.finishCallback()\n }\n } else if (nextPendingAction.id < workerResponse.id) {\n removeMessageListener()\n addTelemetryDebug('Worker responses received out of order.')\n }\n }\n // rawBytesCount += workerResponse.additionalBytesCount\n // compressedData.push(workerResponse.result)\n // compressedDataTrailer = workerResponse.trailer\n // var nextPendingAction = pendingWriteActions.shift()\n // if (nextPendingAction && nextPendingAction.id === workerResponse.id) {\n // if (nextPendingAction.writeCallback) {\n // nextPendingAction.writeCallback(workerResponse.result.byteLength)\n // } else if (nextPendingAction.finishCallback) {\n // nextPendingAction.finishCallback()\n // }\n // } else {\n // removeMessageListener()\n // addTelemetryDebug('Worker responses received out of order.')\n // }\n })\n\n var removeMessageListener = wokerListener.stop\n\n function consumeResult() {\n var output =\n compressedData.length === 0\n ? new Uint8Array(0)\n : concatBuffers(compressedData.concat(compressedDataTrailer))\n\n var result = {\n rawBytesCount: rawBytesCount,\n output: output,\n outputBytesCount: output.byteLength,\n encoding: 'deflate'\n }\n rawBytesCount = 0\n compressedData = []\n return result\n }\n\n function sendResetIfNeeded() {\n if (!isEmpty) {\n worker.postMessage({\n action: 'reset',\n streamId: streamId\n })\n isEmpty = true\n }\n }\n return {\n isAsync: true,\n isEmpty: function () {\n return isEmpty\n },\n\n write: function (data, callback) {\n worker.postMessage({\n action: 'write',\n id: nextWriteActionId,\n data: data,\n streamId: streamId\n })\n pendingWriteActions.push({\n id: nextWriteActionId,\n writeCallback: callback,\n data: data\n })\n isEmpty = false\n nextWriteActionId += 1\n },\n\n finish: function (callback) {\n sendResetIfNeeded()\n\n if (!pendingWriteActions.length) {\n callback(consumeResult())\n } else {\n // Make sure we do not call any write callback\n pendingWriteActions.forEach(function (pendingWriteAction) {\n delete pendingWriteAction.writeCallback\n })\n\n // Wait for the last action to finish before calling the finish callback\n pendingWriteActions[pendingWriteActions.length - 1].finishCallback =\n function () {\n return callback(consumeResult())\n }\n }\n },\n\n finishSync: function () {\n sendResetIfNeeded()\n\n var pendingData = pendingWriteActions\n .map(function (pendingWriteAction) {\n return pendingWriteAction.data\n })\n .join('')\n pendingWriteActions.length = 0\n return assign(consumeResult(), {\n pendingData: pendingData\n })\n },\n\n estimateEncodedBytesCount: function (data) {\n // This is a rough estimation of the data size once it'll be encoded by deflate. We observed\n // that if it's the first chunk of data pushed to the stream, the ratio is lower (3-4), but\n // after that the ratio is greater (10+). We chose 8 here, which (on average) seems to produce\n // requests of the expected size.\n return data.length / 8\n },\n\n stop: function () {\n removeMessageListener()\n }\n }\n}\n"],"mappings":"AAAA,SACEA,gBAAgB,EAChBC,aAAa,EACbC,iBAAiB,EACjBC,MAAM,QACD,yBAAyB;AAChC,OAAO,IAAIC,sBAAsB,GAAG;EAClCC,MAAM,EAAE,CAAC;EACTC,GAAG,EAAE;AACP,CAAC;AACD,OAAO,SAASC,oBAAoBA,CAACC,MAAM,EAAEC,QAAQ,EAAE;EACrD,IAAIC,aAAa,GAAG,CAAC;EACrB,IAAIC,cAAc,GAAG,EAAE;EACvB,IAAIC,qBAAqB;EAEzB,IAAIC,QAAO,GAAG,IAAI;EAClB,IAAIC,iBAAiB,GAAG,CAAC;EACzB,IAAIC,mBAAmB,GAAG,EAAE;EAE5B,IAAIC,aAAa,GAAGhB,gBAAgB,CAACQ,MAAM,EAAE,SAAS,EAAE,UAAUS,MAAM,EAAE;IACxE,IAAIC,cAAc,GAAGD,MAAM,CAACE,IAAI;IAChC,IACED,cAAc,CAACE,IAAI,KAAK,OAAO,IAC9BF,cAAc,CAACT,QAAQ,IAAIS,cAAc,CAACT,QAAQ,KAAKA,QAAS,EACjE;MACA;IACF;IACA,IAAIY,iBAAiB,GAAGN,mBAAmB,CAAC,CAAC,CAAC;IAC9C,IAAIM,iBAAiB,EAAE;MACrB,IAAIA,iBAAiB,CAACC,EAAE,KAAKJ,cAAc,CAACI,EAAE,EAAE;QAC9CP,mBAAmB,CAACQ,KAAK,CAAC,CAAC;QAE3Bb,aAAa,IAAIQ,cAAc,CAACM,oBAAoB;QACpDb,cAAc,CAACc,IAAI,CAACP,cAAc,CAACQ,MAAM,CAAC;QAC1Cd,qBAAqB,GAAGM,cAAc,CAACS,OAAO;QAE9C,IAAIN,iBAAiB,CAACO,aAAa,EAAE;UACnCP,iBAAiB,CAACO,aAAa,CAACV,cAAc,CAACQ,MAAM,CAACG,UAAU,CAAC;QACnE,CAAC,MAAM,IAAIR,iBAAiB,CAACS,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ACgB,MAAM,GAAG,CAAC;IACxB,CAAC;IAEDH,IAAI,EAAE,SAANA,IAAIA,CAAA,EAAc;MAChBD,qBAAqB,CAAC,CAAC;IACzB;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { display, includes, setTimeout, addEventListener, addTelemetryError, ONE_SECOND } from '@cloudcare/browser-core';
|
|
2
2
|
export var INITIALIZATION_TIME_OUT_DELAY = 10 * ONE_SECOND;
|
|
3
3
|
export function createDeflateWorker(configuration) {
|
|
4
|
-
return new Worker(configuration.workerUrl || URL.createObjectURL(new Blob(["!function(){\"use strict\";function t(t){for(var e=t.reduce((function(t,e){return t+e.length}),0),a=new Uint8Array(e),n=0,r=0,i=t;r<i.length;r++){var s=i[r];a.set(s,n),n+=s.length}return a}function e(t){for(var e=t.length;--e>=0;)t[e]=0}var a=256,n=286,r=30,i=15,s=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),h=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),l=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),_=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=new Array(576);e(o);var d=new Array(60);e(d);var u=new Array(512);e(u);var f=new Array(256);e(f);var c=new Array(29);e(c);var p,g,w,v=new Array(r);function b(t,e,a,n,r){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=n,this.max_length=r,this.has_stree=t&&t.length}function m(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}e(v);var y=function(t){return t<256?u[t]:u[256+(t>>>7)]},k=function(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},z=function(t,e,a){t.bi_valid>16-a?(t.bi_buf|=e<<t.bi_valid&65535,k(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a)},x=function(t,e,a){z(t,a[2*e],a[2*e+1])},A=function(t,e){var a=0;do{a|=1&t,t>>>=1,a<<=1}while(--e>0);return a>>>1},U=function(t,e,a){var n,r,s=new Array(16),h=0;for(n=1;n<=i;n++)s[n]=h=h+a[n-1]<<1;for(r=0;r<=e;r++){var l=t[2*r+1];0!==l&&(t[2*r]=A(s[l]++,l))}},I=function(t){var e;for(e=0;e<n;e++)t.dyn_ltree[2*e]=0;for(e=0;e<r;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0},B=function(t){t.bi_valid>8?k(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},E=function(t,e,a,n){var r=2*e,i=2*a;return t[r]<t[i]||t[r]===t[i]&&n[e]<=n[a]},S=function(t,e,a){for(var n=t.heap[a],r=a<<1;r<=t.heap_len&&(r<t.heap_len&&E(e,t.heap[r+1],t.heap[r],t.depth)&&r++,!E(e,n,t.heap[r],t.depth));)t.heap[a]=t.heap[r],a=r,r<<=1;t.heap[a]=n},C=function(t,e,n){var r,i,l,_,o=0;if(0!==t.last_lit)do{r=t.pending_buf[t.d_buf+2*o]<<8|t.pending_buf[t.d_buf+2*o+1],i=t.pending_buf[t.l_buf+o],o++,0===r?x(t,i,e):(l=f[i],x(t,l+a+1,e),0!==(_=s[l])&&(i-=c[l],z(t,i,_)),r--,l=y(r),x(t,l,n),0!==(_=h[l])&&(r-=v[l],z(t,r,_)))}while(o<t.last_lit);x(t,256,e)},D=function(t,e){var a,n,r,s=e.dyn_tree,h=e.stat_desc.static_tree,l=e.stat_desc.has_stree,_=e.stat_desc.elems,o=-1;for(t.heap_len=0,t.heap_max=573,a=0;a<_;a++)0!==s[2*a]?(t.heap[++t.heap_len]=o=a,t.depth[a]=0):s[2*a+1]=0;for(;t.heap_len<2;)s[2*(r=t.heap[++t.heap_len]=o<2?++o:0)]=1,t.depth[r]=0,t.opt_len--,l&&(t.static_len-=h[2*r+1]);for(e.max_code=o,a=t.heap_len>>1;a>=1;a--)S(t,s,a);r=_;do{a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],S(t,s,1),n=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=n,s[2*r]=s[2*a]+s[2*n],t.depth[r]=(t.depth[a]>=t.depth[n]?t.depth[a]:t.depth[n])+1,s[2*a+1]=s[2*n+1]=r,t.heap[1]=r++,S(t,s,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var a,n,r,s,h,l,_=e.dyn_tree,o=e.max_code,d=e.stat_desc.static_tree,u=e.stat_desc.has_stree,f=e.stat_desc.extra_bits,c=e.stat_desc.extra_base,p=e.stat_desc.max_length,g=0;for(s=0;s<=i;s++)t.bl_count[s]=0;for(_[2*t.heap[t.heap_max]+1]=0,a=t.heap_max+1;a<573;a++)(s=_[2*_[2*(n=t.heap[a])+1]+1]+1)>p&&(s=p,g++),_[2*n+1]=s,n>o||(t.bl_count[s]++,h=0,n>=c&&(h=f[n-c]),l=_[2*n],t.opt_len+=l*(s+h),u&&(t.static_len+=l*(d[2*n+1]+h)));if(0!==g){do{for(s=p-1;0===t.bl_count[s];)s--;t.bl_count[s]--,t.bl_count[s+1]+=2,t.bl_count[p]--,g-=2}while(g>0);for(s=p;0!==s;s--)for(n=t.bl_count[s];0!==n;)(r=t.heap[--a])>o||(_[2*r+1]!==s&&(t.opt_len+=(s-_[2*r+1])*_[2*r],_[2*r+1]=s),n--)}}(t,e),U(s,o,t.bl_count)},j=function(t,e,a){var n,r,i=-1,s=e[1],h=0,l=7,_=4;for(0===s&&(l=138,_=3),e[2*(a+1)+1]=65535,n=0;n<=a;n++)r=s,s=e[2*(n+1)+1],++h<l&&r===s||(h<_?t.bl_tree[2*r]+=h:0!==r?(r!==i&&t.bl_tree[2*r]++,t.bl_tree[32]++):h<=10?t.bl_tree[34]++:t.bl_tree[36]++,h=0,i=r,0===s?(l=138,_=3):r===s?(l=6,_=3):(l=7,_=4))},M=function(t,e,a){var n,r,i=-1,s=e[1],h=0,l=7,_=4;for(0===s&&(l=138,_=3),n=0;n<=a;n++)if(r=s,s=e[2*(n+1)+1],!(++h<l&&r===s)){if(h<_)do{x(t,r,t.bl_tree)}while(0!=--h);else 0!==r?(r!==i&&(x(t,r,t.bl_tree),h--),x(t,16,t.bl_tree),z(t,h-3,2)):h<=10?(x(t,17,t.bl_tree),z(t,h-3,3)):(x(t,18,t.bl_tree),z(t,h-11,7));h=0,i=r,0===s?(l=138,_=3):r===s?(l=6,_=3):(l=7,_=4)}},L=!1,T=function(t,e,a,n){z(t,0+(n?1:0),3),function(t,e,a,n){B(t),n&&(k(t,a),k(t,~a)),t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a}(t,e,a,!0)},H=function(t,e,n,r){var i,s,h=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,n=4093624447;for(e=0;e<=31;e++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<a;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),D(t,t.l_desc),D(t,t.d_desc),h=function(t){var e;for(j(t,t.dyn_ltree,t.l_desc.max_code),j(t,t.dyn_dtree,t.d_desc.max_code),D(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*_[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),i=t.opt_len+3+7>>>3,(s=t.static_len+3+7>>>3)<=i&&(i=s)):i=s=n+5,n+4<=i&&-1!==e?T(t,e,n,r):4===t.strategy||s===i?(z(t,2+(r?1:0),3),C(t,o,d)):(z(t,4+(r?1:0),3),function(t,e,a,n){var r;for(z(t,e-257,5),z(t,a-1,5),z(t,n-4,4),r=0;r<n;r++)z(t,t.bl_tree[2*_[r]+1],3);M(t,t.dyn_ltree,e-1),M(t,t.dyn_dtree,a-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,h+1),C(t,t.dyn_ltree,t.dyn_dtree)),I(t),r&&B(t)},R={_tr_init:function(t){L||(!function(){var t,e,a,_,m,y=new Array(16);for(a=0,_=0;_<28;_++)for(c[_]=a,t=0;t<1<<s[_];t++)f[a++]=_;for(f[a-1]=_,m=0,_=0;_<16;_++)for(v[_]=m,t=0;t<1<<h[_];t++)u[m++]=_;for(m>>=7;_<r;_++)for(v[_]=m<<7,t=0;t<1<<h[_]-7;t++)u[256+m++]=_;for(e=0;e<=i;e++)y[e]=0;for(t=0;t<=143;)o[2*t+1]=8,t++,y[8]++;for(;t<=255;)o[2*t+1]=9,t++,y[9]++;for(;t<=279;)o[2*t+1]=7,t++,y[7]++;for(;t<=287;)o[2*t+1]=8,t++,y[8]++;for(U(o,287,y),t=0;t<r;t++)d[2*t+1]=5,d[2*t]=A(t,5);p=new b(o,s,257,n,i),g=new b(d,h,0,r,i),w=new b(new Array(0),l,0,19,7)}(),L=!0),t.l_desc=new m(t.dyn_ltree,p),t.d_desc=new m(t.dyn_dtree,g),t.bl_desc=new m(t.bl_tree,w),t.bi_buf=0,t.bi_valid=0,I(t)},_tr_stored_block:T,_tr_flush_block:H,_tr_tally:function(t,e,n){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&n,t.last_lit++,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(f[n]+a+1)]++,t.dyn_dtree[2*y(e)]++),t.last_lit===t.lit_bufsize-1},_tr_align:function(t){z(t,2,3),x(t,256,o),function(t){16===t.bi_valid?(k(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},K=function(t,e,a,n){for(var r=65535&t,i=t>>>16&65535,s=0;0!==a;){a-=s=a>2e3?2e3:a;do{i=i+(r=r+e[n++]|0)|0}while(--s);r%=65521,i%=65521}return r|i<<16},N=new Uint32Array(function(){for(var t,e=[],a=0;a<256;a++){t=a;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t}return e}()),O=function(t,e,a,n){var r=N,i=n+a;t^=-1;for(var s=n;s<i;s++)t=t>>>8^r[255&(t^e[s])];return~t},q={2:\"need dictionary\",1:\"stream end\",0:\"\",\"-1\":\"file error\",\"-2\":\"stream error\",\"-3\":\"data error\",\"-4\":\"insufficient memory\",\"-5\":\"buffer error\",\"-6\":\"incompatible version\"},F=0,G=2,J=3,P=4,Q=0,V=1,W=-1,X=0,Y=8,Z=R._tr_init,$=R._tr_stored_block,tt=R._tr_flush_block,et=R._tr_tally,at=R._tr_align,nt=F,rt=1,it=J,st=P,ht=5,lt=Q,_t=V,ot=-2,dt=-3,ut=-5,ft=W,ct=1,pt=2,gt=3,wt=4,vt=X,bt=2,mt=Y,yt=258,kt=262,zt=103,xt=113,At=666,Ut=function(t,e){return t.msg=q[e],e},It=function(t){return(t<<1)-(t>4?9:0)},Bt=function(t){for(var e=t.length;--e>=0;)t[e]=0},Et=function(t,e,a){return(e<<t.hash_shift^a)&t.hash_mask},St=function(t){var e=t.state,a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0))},Ct=function(t,e){tt(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,St(t.strm)},Dt=function(t,e){t.pending_buf[t.pending++]=e},jt=function(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},Mt=function(t,e){var a,n,r=t.max_chain_length,i=t.strstart,s=t.prev_length,h=t.nice_match,l=t.strstart>t.w_size-kt?t.strstart-(t.w_size-kt):0,_=t.window,o=t.w_mask,d=t.prev,u=t.strstart+yt,f=_[i+s-1],c=_[i+s];t.prev_length>=t.good_match&&(r>>=2),h>t.lookahead&&(h=t.lookahead);do{if(_[(a=e)+s]===c&&_[a+s-1]===f&&_[a]===_[i]&&_[++a]===_[i+1]){i+=2,a++;do{}while(_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&i<u);if(n=yt-(u-i),i=u-yt,n>s){if(t.match_start=e,s=n,n>=h)break;f=_[i+s-1],c=_[i+s]}}}while((e=d[e&o])>l&&0!=--r);return s<=t.lookahead?s:t.lookahead},Lt=function(t){var e,a,n,r,i,s,h,l,_,o,d=t.w_size;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=d+(d-kt)){t.window.set(t.window.subarray(d,d+d),0),t.match_start-=d,t.strstart-=d,t.block_start-=d,e=a=t.hash_size;do{n=t.head[--e],t.head[e]=n>=d?n-d:0}while(--a);e=a=d;do{n=t.prev[--e],t.prev[e]=n>=d?n-d:0}while(--a);r+=d}if(0===t.strm.avail_in)break;if(s=t.strm,h=t.window,l=t.strstart+t.lookahead,_=r,o=void 0,(o=s.avail_in)>_&&(o=_),a=0===o?0:(s.avail_in-=o,h.set(s.input.subarray(s.next_in,s.next_in+o),l),1===s.state.wrap?s.adler=K(s.adler,h,o,l):2===s.state.wrap&&(s.adler=O(s.adler,h,o,l)),s.next_in+=o,s.total_in+=o,o),t.lookahead+=a,t.lookahead+t.insert>=3)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=Et(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=Et(t,t.ins_h,t.window[i+3-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<kt&&0!==t.strm.avail_in)},Tt=function(t,e){for(var a,n;;){if(t.lookahead<kt){if(Lt(t),t.lookahead<kt&&e===nt)return 1;if(0===t.lookahead)break}if(a=0,t.lookahead>=3&&(t.ins_h=Et(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-kt&&(t.match_length=Mt(t,a)),t.match_length>=3)if(n=et(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=Et(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=Et(t,t.ins_h,t.window[t.strstart+1]);else n=et(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(Ct(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===st?(Ct(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(Ct(t,!1),0===t.strm.avail_out)?1:2},Ht=function(t,e){for(var a,n,r;;){if(t.lookahead<kt){if(Lt(t),t.lookahead<kt&&e===nt)return 1;if(0===t.lookahead)break}if(a=0,t.lookahead>=3&&(t.ins_h=Et(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==a&&t.prev_length<t.max_lazy_match&&t.strstart-a<=t.w_size-kt&&(t.match_length=Mt(t,a),t.match_length<=5&&(t.strategy===ct||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){r=t.strstart+t.lookahead-3,n=et(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=r&&(t.ins_h=Et(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(Ct(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if((n=et(t,0,t.window[t.strstart-1]))&&Ct(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=et(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===st?(Ct(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(Ct(t,!1),0===t.strm.avail_out)?1:2};function Rt(t,e,a,n,r){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=n,this.func=r}var Kt=[new Rt(0,0,0,0,(function(t,e){var a=65535;for(a>t.pending_buf_size-5&&(a=t.pending_buf_size-5);;){if(t.lookahead<=1){if(Lt(t),0===t.lookahead&&e===nt)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+a;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,Ct(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-kt&&(Ct(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===st?(Ct(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(Ct(t,!1),t.strm.avail_out),1)})),new Rt(4,4,8,4,Tt),new Rt(4,5,16,8,Tt),new Rt(4,6,32,32,Tt),new Rt(4,4,16,16,Ht),new Rt(8,16,32,32,Ht),new Rt(8,16,128,128,Ht),new Rt(8,32,128,256,Ht),new Rt(32,128,258,1024,Ht),new Rt(32,258,258,4096,Ht)];function Nt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=mt,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Bt(this.dyn_ltree),Bt(this.dyn_dtree),Bt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Bt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Bt(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var Ot=function(t){if(!t||!t.state)return Ut(t,ot);t.total_in=t.total_out=0,t.data_type=bt;var e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:xt,t.adler=2===e.wrap?0:1,e.last_flush=nt,Z(e),lt},qt=function(t){var e,a=Ot(t);return a===lt&&((e=t.state).window_size=2*e.w_size,Bt(e.head),e.max_lazy_match=Kt[e.level].max_lazy,e.good_match=Kt[e.level].good_length,e.nice_match=Kt[e.level].nice_length,e.max_chain_length=Kt[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0),a},Ft=function(t,e,a,n,r,i){if(!t)return ot;var s=1;if(e===ft&&(e=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),r<1||r>9||a!==mt||n<8||n>15||e<0||e>9||i<0||i>wt)return Ut(t,ot);8===n&&(n=9);var h=new Nt;return t.state=h,h.strm=t,h.wrap=s,h.gzhead=null,h.w_bits=n,h.w_size=1<<h.w_bits,h.w_mask=h.w_size-1,h.hash_bits=r+7,h.hash_size=1<<h.hash_bits,h.hash_mask=h.hash_size-1,h.hash_shift=~~((h.hash_bits+3-1)/3),h.window=new Uint8Array(2*h.w_size),h.head=new Uint16Array(h.hash_size),h.prev=new Uint16Array(h.w_size),h.lit_bufsize=1<<r+6,h.pending_buf_size=4*h.lit_bufsize,h.pending_buf=new Uint8Array(h.pending_buf_size),h.d_buf=1*h.lit_bufsize,h.l_buf=3*h.lit_bufsize,h.level=e,h.strategy=i,h.method=a,qt(t)},Gt={deflateInit:function(t,e){return Ft(t,e,mt,15,8,vt)},deflateInit2:Ft,deflateReset:qt,deflateResetKeep:Ot,deflateSetHeader:function(t,e){return t&&t.state?2!==t.state.wrap?ot:(t.state.gzhead=e,lt):ot},deflate:function(t,e){var a,n;if(!t||!t.state||e>ht||e<0)return t?Ut(t,ot):ot;var r=t.state;if(!t.output||!t.input&&0!==t.avail_in||r.status===At&&e!==st)return Ut(t,0===t.avail_out?ut:ot);r.strm=t;var i=r.last_flush;if(r.last_flush=e,42===r.status)if(2===r.wrap)t.adler=0,Dt(r,31),Dt(r,139),Dt(r,8),r.gzhead?(Dt(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Dt(r,255&r.gzhead.time),Dt(r,r.gzhead.time>>8&255),Dt(r,r.gzhead.time>>16&255),Dt(r,r.gzhead.time>>24&255),Dt(r,9===r.level?2:r.strategy>=pt||r.level<2?4:0),Dt(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(Dt(r,255&r.gzhead.extra.length),Dt(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=O(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(Dt(r,0),Dt(r,0),Dt(r,0),Dt(r,0),Dt(r,0),Dt(r,9===r.level?2:r.strategy>=pt||r.level<2?4:0),Dt(r,3),r.status=xt);else{var s=mt+(r.w_bits-8<<4)<<8;s|=(r.strategy>=pt||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(s|=32),s+=31-s%31,r.status=xt,jt(r,s),0!==r.strstart&&(jt(r,t.adler>>>16),jt(r,65535&t.adler)),t.adler=1}if(69===r.status)if(r.gzhead.extra){for(a=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>a&&(t.adler=O(t.adler,r.pending_buf,r.pending-a,a)),St(t),a=r.pending,r.pending!==r.pending_buf_size));)Dt(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>a&&(t.adler=O(t.adler,r.pending_buf,r.pending-a,a)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){a=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>a&&(t.adler=O(t.adler,r.pending_buf,r.pending-a,a)),St(t),a=r.pending,r.pending===r.pending_buf_size)){n=1;break}n=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,Dt(r,n)}while(0!==n);r.gzhead.hcrc&&r.pending>a&&(t.adler=O(t.adler,r.pending_buf,r.pending-a,a)),0===n&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){a=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>a&&(t.adler=O(t.adler,r.pending_buf,r.pending-a,a)),St(t),a=r.pending,r.pending===r.pending_buf_size)){n=1;break}n=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,Dt(r,n)}while(0!==n);r.gzhead.hcrc&&r.pending>a&&(t.adler=O(t.adler,r.pending_buf,r.pending-a,a)),0===n&&(r.status=zt)}else r.status=zt;if(r.status===zt&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&St(t),r.pending+2<=r.pending_buf_size&&(Dt(r,255&t.adler),Dt(r,t.adler>>8&255),t.adler=0,r.status=xt)):r.status=xt),0!==r.pending){if(St(t),0===t.avail_out)return r.last_flush=-1,lt}else if(0===t.avail_in&&It(e)<=It(i)&&e!==st)return Ut(t,ut);if(r.status===At&&0!==t.avail_in)return Ut(t,ut);if(0!==t.avail_in||0!==r.lookahead||e!==nt&&r.status!==At){var h=r.strategy===pt?function(t,e){for(var a;;){if(0===t.lookahead&&(Lt(t),0===t.lookahead)){if(e===nt)return 1;break}if(t.match_length=0,a=et(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(Ct(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===st?(Ct(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(Ct(t,!1),0===t.strm.avail_out)?1:2}(r,e):r.strategy===gt?function(t,e){for(var a,n,r,i,s=t.window;;){if(t.lookahead<=yt){if(Lt(t),t.lookahead<=yt&&e===nt)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=s[r=t.strstart-1])===s[++r]&&n===s[++r]&&n===s[++r]){i=t.strstart+yt;do{}while(n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&r<i);t.match_length=yt-(i-r),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(a=et(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=et(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(Ct(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===st?(Ct(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(Ct(t,!1),0===t.strm.avail_out)?1:2}(r,e):Kt[r.level].func(r,e);if(3!==h&&4!==h||(r.status=At),1===h||3===h)return 0===t.avail_out&&(r.last_flush=-1),lt;if(2===h&&(e===rt?at(r):e!==ht&&($(r,0,0,!1),e===it&&(Bt(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),St(t),0===t.avail_out))return r.last_flush=-1,lt}return e!==st?lt:r.wrap<=0?_t:(2===r.wrap?(Dt(r,255&t.adler),Dt(r,t.adler>>8&255),Dt(r,t.adler>>16&255),Dt(r,t.adler>>24&255),Dt(r,255&t.total_in),Dt(r,t.total_in>>8&255),Dt(r,t.total_in>>16&255),Dt(r,t.total_in>>24&255)):(jt(r,t.adler>>>16),jt(r,65535&t.adler)),St(t),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?lt:_t)},deflateEnd:function(t){if(!t||!t.state)return ot;var e=t.state.status;return 42!==e&&69!==e&&73!==e&&91!==e&&e!==zt&&e!==xt&&e!==At?Ut(t,ot):(t.state=null,e===xt?Ut(t,dt):lt)},deflateSetDictionary:function(t,e){var a=e.length;if(!t||!t.state)return ot;var n=t.state,r=n.wrap;if(2===r||1===r&&42!==n.status||n.lookahead)return ot;if(1===r&&(t.adler=K(t.adler,e,a,0)),n.wrap=0,a>=n.w_size){0===r&&(Bt(n.head),n.strstart=0,n.block_start=0,n.insert=0);var i=new Uint8Array(n.w_size);i.set(e.subarray(a-n.w_size,a),0),e=i,a=n.w_size}var s=t.avail_in,h=t.next_in,l=t.input;for(t.avail_in=a,t.next_in=0,t.input=e,Lt(n);n.lookahead>=3;){var _=n.strstart,o=n.lookahead-2;do{n.ins_h=Et(n,n.ins_h,n.window[_+3-1]),n.prev[_&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=_,_++}while(--o);n.strstart=_,n.lookahead=2,Lt(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=h,t.input=l,t.avail_in=s,n.wrap=r,lt},deflateInfo:\"pako deflate (from Nodeca project)\"};for(var Jt=new Uint8Array(256),Pt=0;Pt<256;Pt++)Jt[Pt]=Pt>=252?6:Pt>=248?5:Pt>=240?4:Pt>=224?3:Pt>=192?2:1;Jt[254]=Jt[254]=1;var Qt=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=\"\",this.state=null,this.data_type=2,this.adler=0},Vt=Object.prototype.toString,Wt=F,Xt=G,Yt=J,Zt=P,$t=Q,te=V,ee=W,ae=X,ne=Y;function re(){this.options={level:ee,method:ne,chunkSize:16384,windowBits:15,memLevel:8,strategy:ae};var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg=\"\",this.ended=!1,this.chunks=[],this.strm=new Qt,this.strm.avail_out=0;var e=Gt.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(e!==$t)throw new Error(q[e]);if(t.header&&Gt.deflateSetHeader(this.strm,t.header),t.dictionary){var a;if(a=\"[object ArrayBuffer]\"===Vt.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(e=Gt.deflateSetDictionary(this.strm,a))!==$t)throw new Error(q[e]);this._dict_set=!0}}function ie(t,e,a){try{t.postMessage({type:\"errored\",error:e,streamId:a})}catch(n){t.postMessage({type:\"errored\",error:String(e),streamId:a})}}function se(t){var e=t.strm.adler;return new Uint8Array([3,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e])}re.prototype.push=function(t,e){var a,n,r=this.strm,i=this.options.chunkSize;if(this.ended)return!1;for(n=e===~~e?e:!0===e?Zt:Wt,\"[object ArrayBuffer]\"===Vt.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),(n===Xt||n===Yt)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if((a=Gt.deflate(r,n))===te)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),a=Gt.deflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===$t;if(0!==r.avail_out){if(n>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},re.prototype.onData=function(t){this.chunks.push(t)},re.prototype.onEnd=function(t){t===$t&&(this.result=function(t){for(var e=0,a=0,n=t.length;a<n;a++)e+=t[a].length;for(var r=new Uint8Array(e),i=0,s=0,h=t.length;i<h;i++){var l=t[i];r.set(l,s),s+=l.length}return r}(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},function(e){void 0===e&&(e=self);try{var a=new Map;e.addEventListener(\"message\",(function(n){try{var r=function(e,a){switch(a.action){case\"init\":return{type:\"initialized\",version:\"3.2.33\"};case\"write\":var n=e.get(a.streamId);n||(n=new re,e.set(a.streamId,n));var r=n.chunks.length,i=function(t){if(\"function\"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);var e,a,n,r,i,s=t.length,h=0;for(r=0;r<s;r++)55296==(64512&(a=t.charCodeAt(r)))&&r+1<s&&56320==(64512&(n=t.charCodeAt(r+1)))&&(a=65536+(a-55296<<10)+(n-56320),r++),h+=a<128?1:a<2048?2:a<65536?3:4;for(e=new Uint8Array(h),i=0,r=0;i<h;r++)55296==(64512&(a=t.charCodeAt(r)))&&r+1<s&&56320==(64512&(n=t.charCodeAt(r+1)))&&(a=65536+(a-55296<<10)+(n-56320),r++),a<128?e[i++]=a:a<2048?(e[i++]=192|a>>>6,e[i++]=128|63&a):a<65536?(e[i++]=224|a>>>12,e[i++]=128|a>>>6&63,e[i++]=128|63&a):(e[i++]=240|a>>>18,e[i++]=128|a>>>12&63,e[i++]=128|a>>>6&63,e[i++]=128|63&a);return e}(a.data);return n.push(i,G),{type:\"wrote\",id:a.id,streamId:a.streamId,result:t(n.chunks.slice(r)),trailer:se(n),additionalBytesCount:i.length};case\"reset\":e.delete(a.streamId)}}(a,n.data);r&&e.postMessage(r)}catch(t){ie(e,t,n.data&&\"streamId\"in n.data?n.data.streamId:void 0)}}))}catch(t){ie(e,t)}}()}();"])));
|
|
4
|
+
return new Worker(configuration.workerUrl || URL.createObjectURL(new Blob(["!function(){\"use strict\";function t(t){for(var e=t.reduce((function(t,e){return t+e.length}),0),a=new Uint8Array(e),n=0,r=0,i=t;r<i.length;r++){var s=i[r];a.set(s,n),n+=s.length}return a}function e(t){for(var e=t.length;--e>=0;)t[e]=0}var a=256,n=286,r=30,i=15,s=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),h=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),l=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),_=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=new Array(576);e(o);var d=new Array(60);e(d);var u=new Array(512);e(u);var f=new Array(256);e(f);var c=new Array(29);e(c);var p,g,w,v=new Array(r);function b(t,e,a,n,r){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=n,this.max_length=r,this.has_stree=t&&t.length}function m(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}e(v);var y=function(t){return t<256?u[t]:u[256+(t>>>7)]},k=function(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},z=function(t,e,a){t.bi_valid>16-a?(t.bi_buf|=e<<t.bi_valid&65535,k(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a)},x=function(t,e,a){z(t,a[2*e],a[2*e+1])},A=function(t,e){var a=0;do{a|=1&t,t>>>=1,a<<=1}while(--e>0);return a>>>1},U=function(t,e,a){var n,r,s=new Array(16),h=0;for(n=1;n<=i;n++)s[n]=h=h+a[n-1]<<1;for(r=0;r<=e;r++){var l=t[2*r+1];0!==l&&(t[2*r]=A(s[l]++,l))}},I=function(t){var e;for(e=0;e<n;e++)t.dyn_ltree[2*e]=0;for(e=0;e<r;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0},B=function(t){t.bi_valid>8?k(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},E=function(t,e,a,n){var r=2*e,i=2*a;return t[r]<t[i]||t[r]===t[i]&&n[e]<=n[a]},S=function(t,e,a){for(var n=t.heap[a],r=a<<1;r<=t.heap_len&&(r<t.heap_len&&E(e,t.heap[r+1],t.heap[r],t.depth)&&r++,!E(e,n,t.heap[r],t.depth));)t.heap[a]=t.heap[r],a=r,r<<=1;t.heap[a]=n},C=function(t,e,n){var r,i,l,_,o=0;if(0!==t.last_lit)do{r=t.pending_buf[t.d_buf+2*o]<<8|t.pending_buf[t.d_buf+2*o+1],i=t.pending_buf[t.l_buf+o],o++,0===r?x(t,i,e):(l=f[i],x(t,l+a+1,e),0!==(_=s[l])&&(i-=c[l],z(t,i,_)),r--,l=y(r),x(t,l,n),0!==(_=h[l])&&(r-=v[l],z(t,r,_)))}while(o<t.last_lit);x(t,256,e)},D=function(t,e){var a,n,r,s=e.dyn_tree,h=e.stat_desc.static_tree,l=e.stat_desc.has_stree,_=e.stat_desc.elems,o=-1;for(t.heap_len=0,t.heap_max=573,a=0;a<_;a++)0!==s[2*a]?(t.heap[++t.heap_len]=o=a,t.depth[a]=0):s[2*a+1]=0;for(;t.heap_len<2;)s[2*(r=t.heap[++t.heap_len]=o<2?++o:0)]=1,t.depth[r]=0,t.opt_len--,l&&(t.static_len-=h[2*r+1]);for(e.max_code=o,a=t.heap_len>>1;a>=1;a--)S(t,s,a);r=_;do{a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],S(t,s,1),n=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=n,s[2*r]=s[2*a]+s[2*n],t.depth[r]=(t.depth[a]>=t.depth[n]?t.depth[a]:t.depth[n])+1,s[2*a+1]=s[2*n+1]=r,t.heap[1]=r++,S(t,s,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var a,n,r,s,h,l,_=e.dyn_tree,o=e.max_code,d=e.stat_desc.static_tree,u=e.stat_desc.has_stree,f=e.stat_desc.extra_bits,c=e.stat_desc.extra_base,p=e.stat_desc.max_length,g=0;for(s=0;s<=i;s++)t.bl_count[s]=0;for(_[2*t.heap[t.heap_max]+1]=0,a=t.heap_max+1;a<573;a++)(s=_[2*_[2*(n=t.heap[a])+1]+1]+1)>p&&(s=p,g++),_[2*n+1]=s,n>o||(t.bl_count[s]++,h=0,n>=c&&(h=f[n-c]),l=_[2*n],t.opt_len+=l*(s+h),u&&(t.static_len+=l*(d[2*n+1]+h)));if(0!==g){do{for(s=p-1;0===t.bl_count[s];)s--;t.bl_count[s]--,t.bl_count[s+1]+=2,t.bl_count[p]--,g-=2}while(g>0);for(s=p;0!==s;s--)for(n=t.bl_count[s];0!==n;)(r=t.heap[--a])>o||(_[2*r+1]!==s&&(t.opt_len+=(s-_[2*r+1])*_[2*r],_[2*r+1]=s),n--)}}(t,e),U(s,o,t.bl_count)},j=function(t,e,a){var n,r,i=-1,s=e[1],h=0,l=7,_=4;for(0===s&&(l=138,_=3),e[2*(a+1)+1]=65535,n=0;n<=a;n++)r=s,s=e[2*(n+1)+1],++h<l&&r===s||(h<_?t.bl_tree[2*r]+=h:0!==r?(r!==i&&t.bl_tree[2*r]++,t.bl_tree[32]++):h<=10?t.bl_tree[34]++:t.bl_tree[36]++,h=0,i=r,0===s?(l=138,_=3):r===s?(l=6,_=3):(l=7,_=4))},M=function(t,e,a){var n,r,i=-1,s=e[1],h=0,l=7,_=4;for(0===s&&(l=138,_=3),n=0;n<=a;n++)if(r=s,s=e[2*(n+1)+1],!(++h<l&&r===s)){if(h<_)do{x(t,r,t.bl_tree)}while(0!=--h);else 0!==r?(r!==i&&(x(t,r,t.bl_tree),h--),x(t,16,t.bl_tree),z(t,h-3,2)):h<=10?(x(t,17,t.bl_tree),z(t,h-3,3)):(x(t,18,t.bl_tree),z(t,h-11,7));h=0,i=r,0===s?(l=138,_=3):r===s?(l=6,_=3):(l=7,_=4)}},L=!1,T=function(t,e,a,n){z(t,0+(n?1:0),3),function(t,e,a,n){B(t),n&&(k(t,a),k(t,~a)),t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a}(t,e,a,!0)},H=function(t,e,n,r){var i,s,h=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,n=4093624447;for(e=0;e<=31;e++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<a;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),D(t,t.l_desc),D(t,t.d_desc),h=function(t){var e;for(j(t,t.dyn_ltree,t.l_desc.max_code),j(t,t.dyn_dtree,t.d_desc.max_code),D(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*_[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),i=t.opt_len+3+7>>>3,(s=t.static_len+3+7>>>3)<=i&&(i=s)):i=s=n+5,n+4<=i&&-1!==e?T(t,e,n,r):4===t.strategy||s===i?(z(t,2+(r?1:0),3),C(t,o,d)):(z(t,4+(r?1:0),3),function(t,e,a,n){var r;for(z(t,e-257,5),z(t,a-1,5),z(t,n-4,4),r=0;r<n;r++)z(t,t.bl_tree[2*_[r]+1],3);M(t,t.dyn_ltree,e-1),M(t,t.dyn_dtree,a-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,h+1),C(t,t.dyn_ltree,t.dyn_dtree)),I(t),r&&B(t)},R={_tr_init:function(t){L||(!function(){var t,e,a,_,m,y=new Array(16);for(a=0,_=0;_<28;_++)for(c[_]=a,t=0;t<1<<s[_];t++)f[a++]=_;for(f[a-1]=_,m=0,_=0;_<16;_++)for(v[_]=m,t=0;t<1<<h[_];t++)u[m++]=_;for(m>>=7;_<r;_++)for(v[_]=m<<7,t=0;t<1<<h[_]-7;t++)u[256+m++]=_;for(e=0;e<=i;e++)y[e]=0;for(t=0;t<=143;)o[2*t+1]=8,t++,y[8]++;for(;t<=255;)o[2*t+1]=9,t++,y[9]++;for(;t<=279;)o[2*t+1]=7,t++,y[7]++;for(;t<=287;)o[2*t+1]=8,t++,y[8]++;for(U(o,287,y),t=0;t<r;t++)d[2*t+1]=5,d[2*t]=A(t,5);p=new b(o,s,257,n,i),g=new b(d,h,0,r,i),w=new b(new Array(0),l,0,19,7)}(),L=!0),t.l_desc=new m(t.dyn_ltree,p),t.d_desc=new m(t.dyn_dtree,g),t.bl_desc=new m(t.bl_tree,w),t.bi_buf=0,t.bi_valid=0,I(t)},_tr_stored_block:T,_tr_flush_block:H,_tr_tally:function(t,e,n){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&n,t.last_lit++,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(f[n]+a+1)]++,t.dyn_dtree[2*y(e)]++),t.last_lit===t.lit_bufsize-1},_tr_align:function(t){z(t,2,3),x(t,256,o),function(t){16===t.bi_valid?(k(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},K=function(t,e,a,n){for(var r=65535&t,i=t>>>16&65535,s=0;0!==a;){a-=s=a>2e3?2e3:a;do{i=i+(r=r+e[n++]|0)|0}while(--s);r%=65521,i%=65521}return r|i<<16},N=new Uint32Array(function(){for(var t,e=[],a=0;a<256;a++){t=a;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t}return e}()),O=function(t,e,a,n){var r=N,i=n+a;t^=-1;for(var s=n;s<i;s++)t=t>>>8^r[255&(t^e[s])];return~t},q={2:\"need dictionary\",1:\"stream end\",0:\"\",\"-1\":\"file error\",\"-2\":\"stream error\",\"-3\":\"data error\",\"-4\":\"insufficient memory\",\"-5\":\"buffer error\",\"-6\":\"incompatible version\"},F=0,G=2,J=3,P=4,Q=0,V=1,W=-1,X=0,Y=8,Z=R._tr_init,$=R._tr_stored_block,tt=R._tr_flush_block,et=R._tr_tally,at=R._tr_align,nt=F,rt=1,it=J,st=P,ht=5,lt=Q,_t=V,ot=-2,dt=-3,ut=-5,ft=W,ct=1,pt=2,gt=3,wt=4,vt=X,bt=2,mt=Y,yt=258,kt=262,zt=103,xt=113,At=666,Ut=function(t,e){return t.msg=q[e],e},It=function(t){return(t<<1)-(t>4?9:0)},Bt=function(t){for(var e=t.length;--e>=0;)t[e]=0},Et=function(t,e,a){return(e<<t.hash_shift^a)&t.hash_mask},St=function(t){var e=t.state,a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0))},Ct=function(t,e){tt(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,St(t.strm)},Dt=function(t,e){t.pending_buf[t.pending++]=e},jt=function(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},Mt=function(t,e){var a,n,r=t.max_chain_length,i=t.strstart,s=t.prev_length,h=t.nice_match,l=t.strstart>t.w_size-kt?t.strstart-(t.w_size-kt):0,_=t.window,o=t.w_mask,d=t.prev,u=t.strstart+yt,f=_[i+s-1],c=_[i+s];t.prev_length>=t.good_match&&(r>>=2),h>t.lookahead&&(h=t.lookahead);do{if(_[(a=e)+s]===c&&_[a+s-1]===f&&_[a]===_[i]&&_[++a]===_[i+1]){i+=2,a++;do{}while(_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&i<u);if(n=yt-(u-i),i=u-yt,n>s){if(t.match_start=e,s=n,n>=h)break;f=_[i+s-1],c=_[i+s]}}}while((e=d[e&o])>l&&0!=--r);return s<=t.lookahead?s:t.lookahead},Lt=function(t){var e,a,n,r,i,s,h,l,_,o,d=t.w_size;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=d+(d-kt)){t.window.set(t.window.subarray(d,d+d),0),t.match_start-=d,t.strstart-=d,t.block_start-=d,e=a=t.hash_size;do{n=t.head[--e],t.head[e]=n>=d?n-d:0}while(--a);e=a=d;do{n=t.prev[--e],t.prev[e]=n>=d?n-d:0}while(--a);r+=d}if(0===t.strm.avail_in)break;if(s=t.strm,h=t.window,l=t.strstart+t.lookahead,_=r,o=void 0,(o=s.avail_in)>_&&(o=_),a=0===o?0:(s.avail_in-=o,h.set(s.input.subarray(s.next_in,s.next_in+o),l),1===s.state.wrap?s.adler=K(s.adler,h,o,l):2===s.state.wrap&&(s.adler=O(s.adler,h,o,l)),s.next_in+=o,s.total_in+=o,o),t.lookahead+=a,t.lookahead+t.insert>=3)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=Et(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=Et(t,t.ins_h,t.window[i+3-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<kt&&0!==t.strm.avail_in)},Tt=function(t,e){for(var a,n;;){if(t.lookahead<kt){if(Lt(t),t.lookahead<kt&&e===nt)return 1;if(0===t.lookahead)break}if(a=0,t.lookahead>=3&&(t.ins_h=Et(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-kt&&(t.match_length=Mt(t,a)),t.match_length>=3)if(n=et(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=Et(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=Et(t,t.ins_h,t.window[t.strstart+1]);else n=et(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(Ct(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===st?(Ct(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(Ct(t,!1),0===t.strm.avail_out)?1:2},Ht=function(t,e){for(var a,n,r;;){if(t.lookahead<kt){if(Lt(t),t.lookahead<kt&&e===nt)return 1;if(0===t.lookahead)break}if(a=0,t.lookahead>=3&&(t.ins_h=Et(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==a&&t.prev_length<t.max_lazy_match&&t.strstart-a<=t.w_size-kt&&(t.match_length=Mt(t,a),t.match_length<=5&&(t.strategy===ct||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){r=t.strstart+t.lookahead-3,n=et(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=r&&(t.ins_h=Et(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(Ct(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if((n=et(t,0,t.window[t.strstart-1]))&&Ct(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=et(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===st?(Ct(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(Ct(t,!1),0===t.strm.avail_out)?1:2};function Rt(t,e,a,n,r){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=n,this.func=r}var Kt=[new Rt(0,0,0,0,(function(t,e){var a=65535;for(a>t.pending_buf_size-5&&(a=t.pending_buf_size-5);;){if(t.lookahead<=1){if(Lt(t),0===t.lookahead&&e===nt)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+a;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,Ct(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-kt&&(Ct(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===st?(Ct(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(Ct(t,!1),t.strm.avail_out),1)})),new Rt(4,4,8,4,Tt),new Rt(4,5,16,8,Tt),new Rt(4,6,32,32,Tt),new Rt(4,4,16,16,Ht),new Rt(8,16,32,32,Ht),new Rt(8,16,128,128,Ht),new Rt(8,32,128,256,Ht),new Rt(32,128,258,1024,Ht),new Rt(32,258,258,4096,Ht)];function Nt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=mt,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Bt(this.dyn_ltree),Bt(this.dyn_dtree),Bt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Bt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Bt(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var Ot=function(t){if(!t||!t.state)return Ut(t,ot);t.total_in=t.total_out=0,t.data_type=bt;var e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:xt,t.adler=2===e.wrap?0:1,e.last_flush=nt,Z(e),lt},qt=function(t){var e,a=Ot(t);return a===lt&&((e=t.state).window_size=2*e.w_size,Bt(e.head),e.max_lazy_match=Kt[e.level].max_lazy,e.good_match=Kt[e.level].good_length,e.nice_match=Kt[e.level].nice_length,e.max_chain_length=Kt[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0),a},Ft=function(t,e,a,n,r,i){if(!t)return ot;var s=1;if(e===ft&&(e=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),r<1||r>9||a!==mt||n<8||n>15||e<0||e>9||i<0||i>wt)return Ut(t,ot);8===n&&(n=9);var h=new Nt;return t.state=h,h.strm=t,h.wrap=s,h.gzhead=null,h.w_bits=n,h.w_size=1<<h.w_bits,h.w_mask=h.w_size-1,h.hash_bits=r+7,h.hash_size=1<<h.hash_bits,h.hash_mask=h.hash_size-1,h.hash_shift=~~((h.hash_bits+3-1)/3),h.window=new Uint8Array(2*h.w_size),h.head=new Uint16Array(h.hash_size),h.prev=new Uint16Array(h.w_size),h.lit_bufsize=1<<r+6,h.pending_buf_size=4*h.lit_bufsize,h.pending_buf=new Uint8Array(h.pending_buf_size),h.d_buf=1*h.lit_bufsize,h.l_buf=3*h.lit_bufsize,h.level=e,h.strategy=i,h.method=a,qt(t)},Gt={deflateInit:function(t,e){return Ft(t,e,mt,15,8,vt)},deflateInit2:Ft,deflateReset:qt,deflateResetKeep:Ot,deflateSetHeader:function(t,e){return t&&t.state?2!==t.state.wrap?ot:(t.state.gzhead=e,lt):ot},deflate:function(t,e){var a,n;if(!t||!t.state||e>ht||e<0)return t?Ut(t,ot):ot;var r=t.state;if(!t.output||!t.input&&0!==t.avail_in||r.status===At&&e!==st)return Ut(t,0===t.avail_out?ut:ot);r.strm=t;var i=r.last_flush;if(r.last_flush=e,42===r.status)if(2===r.wrap)t.adler=0,Dt(r,31),Dt(r,139),Dt(r,8),r.gzhead?(Dt(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Dt(r,255&r.gzhead.time),Dt(r,r.gzhead.time>>8&255),Dt(r,r.gzhead.time>>16&255),Dt(r,r.gzhead.time>>24&255),Dt(r,9===r.level?2:r.strategy>=pt||r.level<2?4:0),Dt(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(Dt(r,255&r.gzhead.extra.length),Dt(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=O(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(Dt(r,0),Dt(r,0),Dt(r,0),Dt(r,0),Dt(r,0),Dt(r,9===r.level?2:r.strategy>=pt||r.level<2?4:0),Dt(r,3),r.status=xt);else{var s=mt+(r.w_bits-8<<4)<<8;s|=(r.strategy>=pt||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(s|=32),s+=31-s%31,r.status=xt,jt(r,s),0!==r.strstart&&(jt(r,t.adler>>>16),jt(r,65535&t.adler)),t.adler=1}if(69===r.status)if(r.gzhead.extra){for(a=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>a&&(t.adler=O(t.adler,r.pending_buf,r.pending-a,a)),St(t),a=r.pending,r.pending!==r.pending_buf_size));)Dt(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>a&&(t.adler=O(t.adler,r.pending_buf,r.pending-a,a)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){a=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>a&&(t.adler=O(t.adler,r.pending_buf,r.pending-a,a)),St(t),a=r.pending,r.pending===r.pending_buf_size)){n=1;break}n=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,Dt(r,n)}while(0!==n);r.gzhead.hcrc&&r.pending>a&&(t.adler=O(t.adler,r.pending_buf,r.pending-a,a)),0===n&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){a=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>a&&(t.adler=O(t.adler,r.pending_buf,r.pending-a,a)),St(t),a=r.pending,r.pending===r.pending_buf_size)){n=1;break}n=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,Dt(r,n)}while(0!==n);r.gzhead.hcrc&&r.pending>a&&(t.adler=O(t.adler,r.pending_buf,r.pending-a,a)),0===n&&(r.status=zt)}else r.status=zt;if(r.status===zt&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&St(t),r.pending+2<=r.pending_buf_size&&(Dt(r,255&t.adler),Dt(r,t.adler>>8&255),t.adler=0,r.status=xt)):r.status=xt),0!==r.pending){if(St(t),0===t.avail_out)return r.last_flush=-1,lt}else if(0===t.avail_in&&It(e)<=It(i)&&e!==st)return Ut(t,ut);if(r.status===At&&0!==t.avail_in)return Ut(t,ut);if(0!==t.avail_in||0!==r.lookahead||e!==nt&&r.status!==At){var h=r.strategy===pt?function(t,e){for(var a;;){if(0===t.lookahead&&(Lt(t),0===t.lookahead)){if(e===nt)return 1;break}if(t.match_length=0,a=et(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(Ct(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===st?(Ct(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(Ct(t,!1),0===t.strm.avail_out)?1:2}(r,e):r.strategy===gt?function(t,e){for(var a,n,r,i,s=t.window;;){if(t.lookahead<=yt){if(Lt(t),t.lookahead<=yt&&e===nt)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=s[r=t.strstart-1])===s[++r]&&n===s[++r]&&n===s[++r]){i=t.strstart+yt;do{}while(n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&r<i);t.match_length=yt-(i-r),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(a=et(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=et(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(Ct(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===st?(Ct(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(Ct(t,!1),0===t.strm.avail_out)?1:2}(r,e):Kt[r.level].func(r,e);if(3!==h&&4!==h||(r.status=At),1===h||3===h)return 0===t.avail_out&&(r.last_flush=-1),lt;if(2===h&&(e===rt?at(r):e!==ht&&($(r,0,0,!1),e===it&&(Bt(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),St(t),0===t.avail_out))return r.last_flush=-1,lt}return e!==st?lt:r.wrap<=0?_t:(2===r.wrap?(Dt(r,255&t.adler),Dt(r,t.adler>>8&255),Dt(r,t.adler>>16&255),Dt(r,t.adler>>24&255),Dt(r,255&t.total_in),Dt(r,t.total_in>>8&255),Dt(r,t.total_in>>16&255),Dt(r,t.total_in>>24&255)):(jt(r,t.adler>>>16),jt(r,65535&t.adler)),St(t),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?lt:_t)},deflateEnd:function(t){if(!t||!t.state)return ot;var e=t.state.status;return 42!==e&&69!==e&&73!==e&&91!==e&&e!==zt&&e!==xt&&e!==At?Ut(t,ot):(t.state=null,e===xt?Ut(t,dt):lt)},deflateSetDictionary:function(t,e){var a=e.length;if(!t||!t.state)return ot;var n=t.state,r=n.wrap;if(2===r||1===r&&42!==n.status||n.lookahead)return ot;if(1===r&&(t.adler=K(t.adler,e,a,0)),n.wrap=0,a>=n.w_size){0===r&&(Bt(n.head),n.strstart=0,n.block_start=0,n.insert=0);var i=new Uint8Array(n.w_size);i.set(e.subarray(a-n.w_size,a),0),e=i,a=n.w_size}var s=t.avail_in,h=t.next_in,l=t.input;for(t.avail_in=a,t.next_in=0,t.input=e,Lt(n);n.lookahead>=3;){var _=n.strstart,o=n.lookahead-2;do{n.ins_h=Et(n,n.ins_h,n.window[_+3-1]),n.prev[_&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=_,_++}while(--o);n.strstart=_,n.lookahead=2,Lt(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=h,t.input=l,t.avail_in=s,n.wrap=r,lt},deflateInfo:\"pako deflate (from Nodeca project)\"};for(var Jt=new Uint8Array(256),Pt=0;Pt<256;Pt++)Jt[Pt]=Pt>=252?6:Pt>=248?5:Pt>=240?4:Pt>=224?3:Pt>=192?2:1;Jt[254]=Jt[254]=1;var Qt=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=\"\",this.state=null,this.data_type=2,this.adler=0},Vt=Object.prototype.toString,Wt=F,Xt=G,Yt=J,Zt=P,$t=Q,te=V,ee=W,ae=X,ne=Y;function re(){this.options={level:ee,method:ne,chunkSize:16384,windowBits:15,memLevel:8,strategy:ae};var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg=\"\",this.ended=!1,this.chunks=[],this.strm=new Qt,this.strm.avail_out=0;var e=Gt.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(e!==$t)throw new Error(q[e]);if(t.header&&Gt.deflateSetHeader(this.strm,t.header),t.dictionary){var a;if(a=\"[object ArrayBuffer]\"===Vt.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(e=Gt.deflateSetDictionary(this.strm,a))!==$t)throw new Error(q[e]);this._dict_set=!0}}function ie(t,e,a){try{t.postMessage({type:\"errored\",error:e,streamId:a})}catch(n){t.postMessage({type:\"errored\",error:String(e),streamId:a})}}function se(t){var e=t.strm.adler;return new Uint8Array([3,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e])}re.prototype.push=function(t,e){var a,n,r=this.strm,i=this.options.chunkSize;if(this.ended)return!1;for(n=e===~~e?e:!0===e?Zt:Wt,\"[object ArrayBuffer]\"===Vt.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),(n===Xt||n===Yt)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if((a=Gt.deflate(r,n))===te)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),a=Gt.deflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===$t;if(0!==r.avail_out){if(n>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},re.prototype.onData=function(t){this.chunks.push(t)},re.prototype.onEnd=function(t){t===$t&&(this.result=function(t){for(var e=0,a=0,n=t.length;a<n;a++)e+=t[a].length;for(var r=new Uint8Array(e),i=0,s=0,h=t.length;i<h;i++){var l=t[i];r.set(l,s),s+=l.length}return r}(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},function(e){void 0===e&&(e=self);try{var a=new Map;e.addEventListener(\"message\",(function(n){try{var r=function(e,a){switch(a.action){case\"init\":return{type:\"initialized\",version:\"3.2.36\"};case\"write\":var n=e.get(a.streamId);n||(n=new re,e.set(a.streamId,n));var r=n.chunks.length,i=function(t){if(\"function\"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);var e,a,n,r,i,s=t.length,h=0;for(r=0;r<s;r++)55296==(64512&(a=t.charCodeAt(r)))&&r+1<s&&56320==(64512&(n=t.charCodeAt(r+1)))&&(a=65536+(a-55296<<10)+(n-56320),r++),h+=a<128?1:a<2048?2:a<65536?3:4;for(e=new Uint8Array(h),i=0,r=0;i<h;r++)55296==(64512&(a=t.charCodeAt(r)))&&r+1<s&&56320==(64512&(n=t.charCodeAt(r+1)))&&(a=65536+(a-55296<<10)+(n-56320),r++),a<128?e[i++]=a:a<2048?(e[i++]=192|a>>>6,e[i++]=128|63&a):a<65536?(e[i++]=224|a>>>12,e[i++]=128|a>>>6&63,e[i++]=128|63&a):(e[i++]=240|a>>>18,e[i++]=128|a>>>12&63,e[i++]=128|a>>>6&63,e[i++]=128|63&a);return e}(a.data);return n.push(i,G),{type:\"wrote\",id:a.id,streamId:a.streamId,result:t(n.chunks.slice(r)),trailer:se(n),additionalBytesCount:i.length};case\"reset\":e.delete(a.streamId)}}(a,n.data);r&&e.postMessage(r)}catch(t){ie(e,t,n.data&&\"streamId\"in n.data?n.data.streamId:void 0)}}))}catch(t){ie(e,t)}}()}();"])));
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* In order to be sure that the worker is correctly working, we need a round trip of
|
|
@@ -23,11 +23,11 @@ export function createLocationChangeObservable(location) {
|
|
|
23
23
|
}
|
|
24
24
|
function trackHistory(onHistoryChange) {
|
|
25
25
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
26
|
-
var pushState = instrumentMethod(
|
|
26
|
+
var pushState = instrumentMethod(getHistoryInstrumentationTarget('pushState'), 'pushState', function (params) {
|
|
27
27
|
var onPostCall = params.onPostCall;
|
|
28
28
|
onPostCall(onHistoryChange);
|
|
29
29
|
});
|
|
30
|
-
var replaceState = instrumentMethod(
|
|
30
|
+
var replaceState = instrumentMethod(getHistoryInstrumentationTarget('replaceState'), 'replaceState', function (params) {
|
|
31
31
|
var onPostCall = params.onPostCall;
|
|
32
32
|
onPostCall(onHistoryChange);
|
|
33
33
|
});
|
|
@@ -43,4 +43,9 @@ function trackHistory(onHistoryChange) {
|
|
|
43
43
|
function trackHash(onHashChange) {
|
|
44
44
|
return addEventListener(window, DOM_EVENT.HASH_CHANGE, onHashChange);
|
|
45
45
|
}
|
|
46
|
+
function getHistoryInstrumentationTarget(methodName) {
|
|
47
|
+
// Ideally we should always instument the method on the prototype, however some frameworks (e.g [Next.js](https://github.com/vercel/next.js/blob/d3f5532065f3e3bb84fb54bd2dfd1a16d0f03a21/packages/next/src/client/components/app-router.tsx#L429))
|
|
48
|
+
// are wrapping the instance method. In that case we should also wrap the instance method.
|
|
49
|
+
return Object.prototype.hasOwnProperty.call(history, methodName) ? history : History.prototype;
|
|
50
|
+
}
|
|
46
51
|
//# sourceMappingURL=locationChangeObservable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locationChangeObservable.js","names":["addEventListener","DOM_EVENT","Observable","shallowClone","instrumentMethod","createLocationChangeObservable","location","currentLocation","observable","_trackHistory","trackHistory","onLocationChange","_trackHash","trackHash","href","newLocation","notify","oldLocation","stop","onHistoryChange","pushState","
|
|
1
|
+
{"version":3,"file":"locationChangeObservable.js","names":["addEventListener","DOM_EVENT","Observable","shallowClone","instrumentMethod","createLocationChangeObservable","location","currentLocation","observable","_trackHistory","trackHistory","onLocationChange","_trackHash","trackHash","href","newLocation","notify","oldLocation","stop","onHistoryChange","pushState","getHistoryInstrumentationTarget","params","onPostCall","replaceState","popState","window","POP_STATE","onHashChange","HASH_CHANGE","methodName","Object","prototype","hasOwnProperty","call","history","History"],"sources":["../../src/domain/locationChangeObservable.js"],"sourcesContent":["import {\n addEventListener,\n DOM_EVENT,\n Observable,\n shallowClone,\n instrumentMethod\n} from '@cloudcare/browser-core'\n\nexport function createLocationChangeObservable(location) {\n var currentLocation = shallowClone(location)\n return new Observable(function (observable) {\n var _trackHistory = trackHistory(onLocationChange)\n var _trackHash = trackHash(onLocationChange)\n function onLocationChange() {\n if (currentLocation.href === location.href) {\n return\n }\n var newLocation = shallowClone(location)\n observable.notify({\n newLocation: newLocation,\n oldLocation: currentLocation\n })\n currentLocation = newLocation\n }\n return function () {\n _trackHistory.stop()\n _trackHash.stop()\n }\n })\n}\n\nfunction trackHistory(onHistoryChange) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n var pushState = instrumentMethod(\n getHistoryInstrumentationTarget('pushState'),\n 'pushState',\n function (params) {\n var onPostCall = params.onPostCall\n onPostCall(onHistoryChange)\n }\n )\n var replaceState = instrumentMethod(\n getHistoryInstrumentationTarget('replaceState'),\n 'replaceState',\n function (params) {\n var onPostCall = params.onPostCall\n onPostCall(onHistoryChange)\n }\n )\n var popState = addEventListener(window, DOM_EVENT.POP_STATE, onHistoryChange)\n\n return {\n stop: function () {\n pushState.stop()\n replaceState.stop()\n popState.stop()\n }\n }\n}\n\nfunction trackHash(onHashChange) {\n return addEventListener(window, DOM_EVENT.HASH_CHANGE, onHashChange)\n}\nfunction getHistoryInstrumentationTarget(methodName) {\n // Ideally we should always instument the method on the prototype, however some frameworks (e.g [Next.js](https://github.com/vercel/next.js/blob/d3f5532065f3e3bb84fb54bd2dfd1a16d0f03a21/packages/next/src/client/components/app-router.tsx#L429))\n // are wrapping the instance method. In that case we should also wrap the instance method.\n return Object.prototype.hasOwnProperty.call(history, methodName)\n ? history\n : History.prototype\n}\n"],"mappings":"AAAA,SACEA,gBAAgB,EAChBC,SAAS,EACTC,UAAU,EACVC,YAAY,EACZC,gBAAgB,QACX,yBAAyB;AAEhC,OAAO,SAASC,8BAA8BA,CAACC,QAAQ,EAAE;EACvD,IAAIC,eAAe,GAAGJ,YAAY,CAACG,QAAQ,CAAC;EAC5C,OAAO,IAAIJ,UAAU,CAAC,UAAUM,UAAU,EAAE;IAC1C,IAAIC,aAAa,GAAGC,YAAY,CAACC,gBAAgB,CAAC;IAClD,IAAIC,UAAU,GAAGC,SAAS,CAACF,gBAAgB,CAAC;IAC5C,SAASA,gBAAgBA,CAAA,EAAG;MAC1B,IAAIJ,eAAe,CAACO,IAAI,KAAKR,QAAQ,CAACQ,IAAI,EAAE;QAC1C;MACF;MACA,IAAIC,WAAW,GAAGZ,YAAY,CAACG,QAAQ,CAAC;MACxCE,UAAU,CAACQ,MAAM,CAAC;QAChBD,WAAW,EAAEA,WAAW;QACxBE,WAAW,EAAEV;MACf,CAAC,CAAC;MACFA,eAAe,GAAGQ,WAAW;IAC/B;IACA,OAAO,YAAY;MACjBN,aAAa,CAACS,IAAI,CAAC,CAAC;MACpBN,UAAU,CA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
|
+
"version": "3.2.36",
|
|
4
4
|
"main": "cjs/index.js",
|
|
5
5
|
"module": "esm/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@cloudcare/browser-core": "3.2.
|
|
9
|
-
"@cloudcare/browser-worker": "3.2.
|
|
8
|
+
"@cloudcare/browser-core": "3.2.36",
|
|
9
|
+
"@cloudcare/browser-worker": "3.2.36"
|
|
10
10
|
},
|
|
11
11
|
"description": "Guance Browser SDK RUM Package",
|
|
12
12
|
"scripts": {
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"author": "dataflux",
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"homepage": "https://github.com/DataFlux-cn/datakit-js/README.md",
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "2e71187db3e296d45f2a16b4c08d82283d924b81"
|
|
37
37
|
}
|
package/src/domain/assembly.js
CHANGED
|
@@ -65,7 +65,8 @@ export function startUrlContexts(
|
|
|
65
65
|
})
|
|
66
66
|
|
|
67
67
|
function buildUrlContext(data, isLocationChange = false) {
|
|
68
|
-
var
|
|
68
|
+
var pathname = data.location.pathname
|
|
69
|
+
var path = pathname
|
|
69
70
|
var hash = data.location.hash
|
|
70
71
|
if (hash && hash.indexOf('#/') === 0) {
|
|
71
72
|
path = '/' + getPathFromHash(hash)
|
|
@@ -76,7 +77,8 @@ export function startUrlContexts(
|
|
|
76
77
|
host: data.location.host,
|
|
77
78
|
path: path,
|
|
78
79
|
pathGroup: replaceNumberCharByPath(path),
|
|
79
|
-
urlQuery: getQueryParamsFromUrl(data.location.href)
|
|
80
|
+
urlQuery: getQueryParamsFromUrl(data.location.href),
|
|
81
|
+
pathname: pathname
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
84
|
|