@wcstack/fetch 4.14.0 → 4.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../src/config.ts","../../src/core/operationLane.ts","../../src/core/platformCapability.ts","../../src/core/fetchCapabilities.ts","../../src/core/FetchCore.ts","../../src/autoTrigger.ts","../../src/protocol/upgradeProperties.ts","../../src/protocol/inputAttribute.ts","../../src/trustedTypes.ts","../../src/components/Fetch.ts","../../src/components/FetchHeader.ts","../../src/components/FetchBody.ts","../../src/components/InfiniteScroll.ts","../../src/protocol/defineElement.ts","../../src/registerComponents.ts","../../src/bootstrapFetch.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n autoTrigger: boolean;\n triggerAttribute: string;\n tagNames: {\n fetch: string;\n fetchHeader: string;\n fetchBody: string;\n infiniteScroll: string;\n };\n}\n\nconst _config: IInternalConfig = {\n autoTrigger: true,\n triggerAttribute: \"data-fetchtarget\",\n tagNames: {\n fetch: \"wcs-fetch\",\n fetchHeader: \"wcs-fetch-header\",\n fetchBody: \"wcs-fetch-body\",\n infiniteScroll: \"wcs-infinite-scroll\",\n },\n};\n\nfunction deepFreeze<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n Object.freeze(obj);\n for (const key of Object.keys(obj)) {\n deepFreeze((obj as Record<string, unknown>)[key]);\n }\n return obj;\n}\n\nfunction deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n const clone: Record<string, unknown> = {};\n for (const key of Object.keys(obj)) {\n clone[key] = deepClone((obj as Record<string, unknown>)[key]);\n }\n return clone as T;\n}\n\nlet frozenConfig: IConfig | null = null;\n\nexport const config: IConfig = _config as IConfig;\n\nexport function getConfig(): IConfig {\n if (!frozenConfig) {\n frozenConfig = deepFreeze(deepClone(_config));\n }\n return frozenConfig;\n}\n\n/** A misspelt option would otherwise do nothing: `bootstrapFetch` refuses it. */\nfunction invalid(key: string): never {\n throw new Error(`[@wcstack/fetch] bootstrapFetch: \"${key}\" is not one of its options, or not of the option's type.`);\n}\n\n/**\n * Applies the options given; an undefined value is left out. An option this package does not\n * have, a value of another type than its default (null, or an array for an object, included) or\n * a tag name it does not define throws, and then nothing is applied.\n */\nexport function setConfig(partialConfig: IWritableConfig): void {\n const options = _config as unknown as Record<string, unknown>;\n const tags = _config.tagNames as Record<string, string>;\n const given = Object.entries(partialConfig).filter(([, value]) => value !== undefined);\n const givenTags = Object.entries(partialConfig.tagNames ?? {}).filter(([, tag]) => tag !== undefined);\n for (const [key, value] of given) {\n const current = options[key];\n if (!Object.hasOwn(options, key) || value === null || typeof value !== typeof current || Array.isArray(value) !== Array.isArray(current)) {\n invalid(key);\n }\n }\n for (const [name, tag] of givenTags) {\n if (!Object.hasOwn(tags, name) || typeof tag !== \"string\") invalid(`tagNames.${name}`);\n }\n for (const [key, value] of given) {\n if (key !== \"tagNames\") {\n options[key] = value;\n }\n }\n for (const [name, tag] of givenTags) tags[name] = tag as string;\n frozenConfig = null;\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /io-core/operation-lane.ts by scripts/sync-io-core.mjs.\n// Run `node scripts/sync-io-core.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * operationLane.ts\n *\n * Phase 4 (docs/architecture-hardening/09-remediation-design.md §5, §5.1) の\n * OperationTicket / CommitGuard / terminal CAS を型付き実装した lane プリミティブ。\n * docs/async-execution-model.md §5 が既に規範化した排他モード\n * (latest / queue / exhaust / overlap) を、`AbortController` だけでは防げない\n * 「取消不能な Promise・abort と同時に完了した結果の commit」から守るための\n * 実行時ガードとして具体化する。\n *\n * 配置方針 (§5): 本ファイルは /io-core/ の単一正典であり、scripts/sync-io-core.mjs が\n * 各 IO ノードの src/core/ へ生成コピー (AUTO-GENERATED, 編集禁止) を配布する。\n * `protocol/wcBindable.ts` と同じ copy-distribution 方式で、ランタイム依存を導入せず\n * 各パッケージのバンドルへ inline される (zero-runtime-dep / 自己完結 CDN を維持)。\n * 編集はこの正典に対して行い、`node scripts/sync-io-core.mjs` で再配布する。\n *\n * 初期 PoC は fetch の `latest` policy から開始した。現在は4 policy 全てを\n * `operationLane.test.ts` が直接検証し、生成コピーを fetch / upload / share /\n * contacts / credential / eyedropper が利用する。lane 自体は promise を実行せず、\n * bookkeeping と guard の状態機械に徹する — 実際の非同期処理は Core が駆動し\n * lane に照合する。\n */\n\n/** §5: 排他モードの語彙。async-execution-model.md §5 の 4 モードに対応 (parallel は予約語・スコープ外)。 */\nexport type LanePolicy = \"latest\" | \"queue\" | \"exhaust\" | \"overlap\";\n\n/** §5: 各 operation の一回限りの終端結果。 */\nexport type TerminalOutcome = \"success\" | \"error\" | \"timeout\" | \"aborted\" | \"stale\";\n\n/** §5: 論理操作 1 件の identity。retry は同じ operationId を再利用する。 */\nexport interface OperationTicket {\n readonly operationId: number;\n /** 発行時に捕捉した I/O Core の observe / reconnect / dispose lifecycle 世代。 */\n readonly ownerGeneration: number;\n readonly laneKey: string;\n readonly policy: LanePolicy;\n /** supersede bookkeeping に使う epoch (latest policy のみ)。 */\n readonly supersedeEpoch?: number;\n}\n\n/** §5: operation の 1 回の試行。retry で attempt++ と resource signal だけ差し替える。 */\nexport interface OperationAttempt {\n readonly operationId: number;\n readonly attempt: number;\n readonly signal?: AbortSignal;\n}\n\n/** §6: DevTools 側 channel へ流す trace(fetch では既定 off・zero-cost)。 */\nexport type OperationTraceEvent =\n | { readonly type: \"io:operation-started\"; readonly operationId: number; readonly laneKey: string; readonly policy: LanePolicy }\n | { readonly type: \"io:operation-retried\"; readonly operationId: number; readonly laneKey: string; readonly attempt: number }\n | { readonly type: \"io:operation-settled\"; readonly operationId: number; readonly laneKey: string; readonly outcome: TerminalOutcome }\n | { readonly type: \"io:stale-dropped\"; readonly operationId: number; readonly laneKey: string };\n\nexport interface OperationLaneOptions {\n /** attempt ごとに AbortController を発行し signal を渡す (fetch/upload 系)。 */\n readonly withSignal?: boolean;\n /**\n * trace subscriber。undefined なら trace record を一切生成しない\n * (§10.3 hook-off zero allocation の gate)。\n */\n readonly trace?: (event: OperationTraceEvent) => void;\n}\n\n/** 内部の終端状態。absence = pending。'committing' は multi-setter commit 中の中間状態。 */\ntype TerminalStatus = \"committing\" | TerminalOutcome;\n\n/**\n * 1 レーン = 独立した排他単位。Core が 1 つ以上所有する (module singleton にしない —\n * 複数 <wcs-fetch> 間で漏れるため)。\n */\nexport class OperationLane {\n readonly laneKey: string;\n readonly policy: LanePolicy;\n\n private _ownerGeneration = 0;\n private _latestEpoch = 0;\n private _nextOperationId = 1;\n // latest / queue / exhaust の単一 active。queue は head を指す。\n private _activeOperationId: number | undefined = undefined;\n // overlap の active set (§5: 内部 bookkeeping のみ・observable 公開はしない)。\n private readonly _activeOperationIds = new Set<number>();\n // queue policy の FIFO。\n private readonly _queue: OperationTicket[] = [];\n private _inFlightCount = 0;\n // opId → 終端状態 (absence = pending)。\n private readonly _terminal = new Map<number, TerminalStatus>();\n // claimTerminal で確定した outcome (finalize が 'committing' を最終値へ移す)。\n private readonly _claimedOutcome = new Map<number, TerminalOutcome>();\n // opId → AbortController (identity は opId が保証。cross-op clobber は構造上起きない)。\n private readonly _controllers = new Map<number, AbortController>();\n // opId → attempt 数。\n private readonly _attempts = new Map<number, number>();\n private readonly _withSignal: boolean;\n private readonly _trace?: (event: OperationTraceEvent) => void;\n\n constructor(laneKey: string, policy: LanePolicy, options: OperationLaneOptions = {}) {\n this.laneKey = laneKey;\n this.policy = policy;\n this._withSignal = options.withSignal ?? false;\n this._trace = options.trace;\n }\n\n get ownerGeneration(): number {\n return this._ownerGeneration;\n }\n\n get inFlightCount(): number {\n return this._inFlightCount;\n }\n\n get latestEpoch(): number {\n return this._latestEpoch;\n }\n\n get activeOperationId(): number | undefined {\n return this._activeOperationId;\n }\n\n /**\n * 新しい要求の到着。arrival policy を適用し ticket + 最初の attempt を発行する。\n * exhaust で実行中の場合だけ null を返す (新要求を ticket 化せず拒否 = 冪等 no-op)。\n */\n begin(): { ticket: OperationTicket; attempt: OperationAttempt } | null {\n let supersedeEpoch: number | undefined;\n switch (this.policy) {\n case \"latest\": {\n // latestEpoch を進め、旧 active を abort (可能なら)。旧 ticket は settle 時に\n // eligibility 不一致で stale となる。\n supersedeEpoch = ++this._latestEpoch;\n if (this._activeOperationId !== undefined) {\n this._abortController(this._activeOperationId);\n }\n break;\n }\n case \"exhaust\": {\n // 実行中なら新要求を拒否 (呼び出し側は既存結果へ合流)。\n if (this._activeOperationId !== undefined) {\n return null;\n }\n break;\n }\n case \"queue\":\n case \"overlap\":\n break;\n }\n\n const operationId = this._nextOperationId++;\n const ticket: OperationTicket = {\n operationId,\n ownerGeneration: this._ownerGeneration,\n laneKey: this.laneKey,\n policy: this.policy,\n supersedeEpoch,\n };\n\n switch (this.policy) {\n case \"latest\":\n case \"exhaust\":\n this._activeOperationId = operationId;\n break;\n case \"queue\":\n this._queue.push(ticket);\n // 先頭だけを active にする (先行が完了するまで待つ)。\n if (this._activeOperationId === undefined) {\n this._activeOperationId = operationId;\n }\n break;\n case \"overlap\":\n this._activeOperationIds.add(operationId);\n break;\n }\n\n this._inFlightCount += 1;\n this._attempts.set(operationId, 1);\n const attempt = this._makeAttempt(operationId, 1);\n if (this._trace !== undefined) {\n this._trace({ type: \"io:operation-started\", operationId, laneKey: this.laneKey, policy: this.policy });\n }\n return { ticket, attempt };\n }\n\n /**\n * retry: 同じ operationId に新しい attempt を作る。attempt number と resource signal\n * だけを更新する (§5)。既に終端した operation には作れない (null)。\n */\n retry(ticket: OperationTicket): OperationAttempt | null {\n if (ticket.ownerGeneration !== this._ownerGeneration) return null;\n if (this._terminal.has(ticket.operationId)) return null;\n const previous = this._attempts.get(ticket.operationId);\n if (previous === undefined) return null;\n const attemptNo = previous + 1;\n this._attempts.set(ticket.operationId, attemptNo);\n // 前の attempt の signal は破棄し、新しい controller を張る。\n this._releaseController(ticket.operationId);\n const attempt = this._makeAttempt(ticket.operationId, attemptNo);\n if (this._trace !== undefined) {\n this._trace({ type: \"io:operation-retried\", operationId: ticket.operationId, laneKey: this.laneKey, attempt: attemptNo });\n }\n return attempt;\n }\n\n /**\n * CommitGuard (§5.1)。外部可視の setter / event dispatch の直前に呼ぶ。\n * (1) owner lifecycle generation 一致 (2) terminal settle 前 (3) policy eligibility。\n */\n canCommit(ticket: OperationTicket): boolean {\n if (ticket.ownerGeneration !== this._ownerGeneration) return false;\n const status = this._terminal.get(ticket.operationId);\n // absence = pending / 'committing' = multi-setter commit 中。どちらも settle 前。\n if (status !== undefined && status !== \"committing\") return false;\n return this._isEligible(ticket);\n }\n\n /**\n * terminal CAS (§5.1): pending → committing を claim する。勝者だけが true。\n * eligibility / owner gen を満たさない場合も false。claim 後は commit 中となり、\n * canCommit は各 setter の直前で再検査する (setter が同期 supersede しても取りこぼさない)。\n */\n claimTerminal(ticket: OperationTicket, outcome: TerminalOutcome): boolean {\n if (ticket.ownerGeneration !== this._ownerGeneration) return false;\n if (this._terminal.has(ticket.operationId)) return false; // 既に committing / 終端\n if (!this._isEligible(ticket)) return false;\n this._terminal.set(ticket.operationId, \"committing\");\n this._claimedOutcome.set(ticket.operationId, outcome);\n return true;\n }\n\n /** claim 済み outcome (timer が claim → catch が読む等)。未 claim なら undefined。 */\n claimedOutcome(ticket: OperationTicket): TerminalOutcome | undefined {\n return this._claimedOutcome.get(ticket.operationId);\n }\n\n /**\n * operation の後始末。claim 済みなら outcome を確定し、未 claim なら stale-drop。\n * controller を解放し in-flight を減らし、policy の bookkeeping を進める。冪等。\n */\n finalize(ticket: OperationTicket): void {\n const operationId = ticket.operationId;\n const status = this._terminal.get(operationId);\n if (status !== undefined && status !== \"committing\") {\n // 既に確定済み。冪等に return。\n return;\n }\n let outcome: TerminalOutcome;\n if (status === \"committing\") {\n outcome = this._claimedOutcome.get(operationId) ?? \"stale\";\n } else {\n // 一度も claim されなかった (supersede / dispose で eligibility を失った)。\n outcome = \"stale\";\n }\n this._terminal.set(operationId, outcome);\n this._claimedOutcome.delete(operationId);\n this._releaseController(operationId);\n this._attempts.delete(operationId);\n if (this._inFlightCount > 0) this._inFlightCount -= 1;\n this._advanceBookkeeping(operationId);\n if (this._trace !== undefined) {\n if (outcome === \"stale\") {\n this._trace({ type: \"io:stale-dropped\", operationId, laneKey: this.laneKey });\n } else {\n this._trace({ type: \"io:operation-settled\", operationId, laneKey: this.laneKey, outcome });\n }\n }\n }\n\n /** operation の signal (resource 解放用)。withSignal でなければ undefined。 */\n signalOf(ticket: OperationTicket): AbortSignal | undefined {\n return this._controllers.get(ticket.operationId)?.signal;\n }\n\n /** best-effort な resource 中断。正しさは owner gen / eligibility / terminal CAS が担う。 */\n abort(ticket: OperationTicket): void {\n this._abortController(ticket.operationId);\n }\n\n /**\n * 現在 active な operation を中断する (利用者による明示キャンセル)。epoch は進めない —\n * 中断された operation は eligibility を保ったまま 'aborted' を claim できる\n * (loading をクリアしつつ in-flight 状態を残す)。\n */\n abortActive(): void {\n if (this._activeOperationId !== undefined) {\n this._abortController(this._activeOperationId);\n }\n for (const operationId of this._activeOperationIds) {\n this._abortController(operationId);\n }\n }\n\n /**\n * dispose (§4.1 world generation)。owner generation を bump して全 ticket を無効化し、\n * 生きている controller を全て abort する。dispose 後に settle した operation は\n * owner gen 不一致で外部 commit しない。retention gate (§10.3) のため live な\n * 全 operation を即時に stale として finalize し、controller / attempt を解放する。\n */\n disposeOwner(): void {\n this._ownerGeneration += 1;\n for (const operationId of Array.from(this._controllers.keys())) {\n this._abortController(operationId);\n // finalize は dispose 後 (terminal='stale') に early-return するため controller を\n // 解放しない。retention gate (§10.3) を満たすためここで明示的に解放する。\n this._releaseController(operationId);\n }\n for (const operationId of Array.from(this._attempts.keys())) {\n if (!this._terminal.has(operationId)) {\n this._terminal.set(operationId, \"stale\");\n }\n this._claimedOutcome.delete(operationId);\n this._attempts.delete(operationId);\n if (this._trace !== undefined) {\n this._trace({ type: \"io:stale-dropped\", operationId, laneKey: this.laneKey });\n }\n }\n this._activeOperationId = undefined;\n this._activeOperationIds.clear();\n this._queue.length = 0;\n this._inFlightCount = 0;\n }\n\n // --- internal ---\n\n private _makeAttempt(operationId: number, attemptNo: number): OperationAttempt {\n let signal: AbortSignal | undefined;\n // AbortController 不在環境(古い runtime / 一部 SSR)では degraded: signal なしで進む。\n // 正しさは owner generation / eligibility / terminal CAS が担うため、native 中断が\n // 無くても supersede / dispose は機能する(best-effort resource 中断が省かれるだけ)。\n if (this._withSignal && typeof AbortController === \"function\") {\n const controller = new AbortController();\n this._controllers.set(operationId, controller);\n signal = controller.signal;\n }\n return { operationId, attempt: attemptNo, signal };\n }\n\n private _isEligible(ticket: OperationTicket): boolean {\n switch (this.policy) {\n case \"latest\":\n return ticket.supersedeEpoch === this._latestEpoch;\n case \"queue\":\n case \"exhaust\":\n return this._activeOperationId === ticket.operationId;\n case \"overlap\":\n return this._activeOperationIds.has(ticket.operationId);\n }\n }\n\n private _advanceBookkeeping(operationId: number): void {\n switch (this.policy) {\n case \"latest\":\n case \"exhaust\":\n if (this._activeOperationId === operationId) {\n this._activeOperationId = undefined;\n }\n break;\n case \"queue\": {\n // 完了した ticket を FIFO から取り除き、次の先頭を active にする。filter で\n // 「先頭 / 非先頭 / 不在」を一様に扱う (finalize は冪等ガードを通った op のみ到達)。\n const remaining = this._queue.filter((t) => t.operationId !== operationId);\n this._queue.length = 0;\n this._queue.push(...remaining);\n this._activeOperationId = this._queue.length > 0 ? this._queue[0].operationId : undefined;\n break;\n }\n case \"overlap\":\n this._activeOperationIds.delete(operationId);\n break;\n }\n }\n\n private _abortController(operationId: number): void {\n const controller = this._controllers.get(operationId);\n if (controller !== undefined && !controller.signal.aborted) {\n controller.abort();\n }\n }\n\n private _releaseController(operationId: number): void {\n this._controllers.delete(operationId);\n }\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /io-core/platform-capability.ts by scripts/sync-io-core.mjs.\n// Run `node scripts/sync-io-core.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * platform-capability.ts\n *\n * Phase 6(docs/architecture-hardening/09-remediation-design.md §7.2 /\n * 07-browser-capability-variance.md)の browser capability 判定と error taxonomy の\n * 汎用プリミティブ。node 固有の capability registry / error code は各パッケージが\n * 別ファイルで宣言し、この汎用層(型 + assess 機構)を import する。\n *\n * 原則:\n * - feature detection は境界(利用直前)で行う。module 評価時に browser global を\n * 参照しない(SSR / worker で import が失敗しない)。\n * - capability ID(`web.fetch` 等)は文字列を global property path として eval せず、\n * registry が ID ごとに副作用のない presence probe を対応付ける。\n * - availability / permission / readiness / activity / operation error を 1 つの\n * `ready / unsupported / error` enum に畳まない。required 欠如は開始しない、\n * optional 欠如は宣言済み fallback で readiness を `degraded` にする。\n *\n * 配置: 本ファイルは /io-core/ の単一正典であり、scripts/sync-io-core.mjs が\n * 各 IO ノードの src/core/ へ生成コピー (AUTO-GENERATED, 編集禁止) を配布する。\n * `protocol/wcBindable.ts` と同じ copy-distribution 方式で、ランタイム依存を導入せず\n * 各パッケージのバンドルへ inline される (zero-runtime-dep / 自己完結 CDN を維持)。\n * 編集はこの正典に対して行い、`node scripts/sync-io-core.mjs` で再配布する。\n *\n * pure(module 評価時に browser global 非参照)。\n */\n\nexport type Availability = \"available\" | \"missing\" | \"unknown\";\nexport type PermissionState = \"granted\" | \"denied\" | \"prompt\" | \"not-applicable\" | \"unknown\";\nexport type Readiness = \"idle\" | \"ready\" | \"degraded\";\nexport type Activity = \"inactive\" | \"active\";\nexport type PreconditionState = \"satisfied\" | \"required\" | \"not-applicable\";\n\n/** operation error の phase(taxonomy)。 */\nexport type WcsIoErrorPhase = \"probe\" | \"start\" | \"execute\" | \"decode\" | \"commit\" | \"dispose\";\n\n/** serializable な error info(non-cloneable な cause とは分離。DevTools / remote へは info のみ)。 */\nexport interface WcsIoErrorInfo {\n readonly code: string;\n readonly phase: WcsIoErrorPhase;\n readonly recoverable: boolean;\n readonly capabilityId?: string;\n readonly message: string;\n}\n\nexport interface PlatformAssessment {\n readonly availability: ReadonlyMap<string, Availability>;\n readonly permission: PermissionState;\n readonly readiness: Readiness;\n readonly activity: Activity;\n readonly preconditions: {\n readonly secureContext: PreconditionState;\n readonly userActivation: PreconditionState;\n };\n readonly epoch: number;\n readonly lastError?: WcsIoErrorInfo;\n}\n\n/** capability 1 件の仕様。probe は副作用なく presence を返す(利用直前に呼ぶ)。 */\nexport interface CapabilitySpec {\n readonly probe: () => boolean;\n readonly requiresSecureContext?: boolean;\n readonly requiresUserActivation?: boolean;\n /** browser compatibility dataset のキー(任意・診断用)。 */\n readonly compatKey?: string;\n}\n\nexport type CapabilityRegistry = ReadonlyMap<string, CapabilitySpec>;\n\nexport interface AssessOptions {\n readonly required: readonly string[];\n readonly optional?: readonly string[];\n readonly permission?: PermissionState;\n readonly activity?: Activity;\n readonly epoch?: number;\n readonly lastError?: WcsIoErrorInfo;\n}\n\nfunction isSecureContext(): boolean {\n return (globalThis as { isSecureContext?: unknown }).isSecureContext === true;\n}\n\n/**\n * capability を利用直前に評価して PlatformAssessment を作る。\n * required が 1 つでも欠ければ readiness は \"idle\"(開始不可)、\n * required 揃い + optional 欠けは \"degraded\"、全揃いは \"ready\"。\n */\nexport function assessCapabilities(registry: CapabilityRegistry, options: AssessOptions): PlatformAssessment {\n const availability = new Map<string, Availability>();\n const evaluate = (id: string): Availability => {\n const spec = registry.get(id);\n if (spec === undefined) return \"unknown\";\n return spec.probe() ? \"available\" : \"missing\";\n };\n\n let requiredAllAvailable = true;\n for (const id of options.required) {\n const a = evaluate(id);\n availability.set(id, a);\n if (a !== \"available\") requiredAllAvailable = false;\n }\n let optionalAllAvailable = true;\n for (const id of options.optional ?? []) {\n const a = evaluate(id);\n availability.set(id, a);\n if (a !== \"available\") optionalAllAvailable = false;\n }\n\n const readiness: Readiness = !requiredAllAvailable ? \"idle\" : (optionalAllAvailable ? \"ready\" : \"degraded\");\n\n // preconditions: 対象 capability のいずれかが要求する場合だけ評価する。\n const allIds = [...options.required, ...(options.optional ?? [])];\n const needsSecure = allIds.some((id) => registry.get(id)?.requiresSecureContext === true);\n const needsActivation = allIds.some((id) => registry.get(id)?.requiresUserActivation === true);\n const secureContext: PreconditionState = needsSecure ? (isSecureContext() ? \"satisfied\" : \"required\") : \"not-applicable\";\n const userActivation: PreconditionState = needsActivation ? \"required\" : \"not-applicable\";\n\n return {\n availability,\n permission: options.permission ?? \"not-applicable\",\n readiness,\n activity: options.activity ?? \"inactive\",\n preconditions: { secureContext, userActivation },\n epoch: options.epoch ?? 0,\n lastError: options.lastError,\n };\n}\n\n/** availability から「required がすべて available か」を判定するヘルパ(supported の最低条件)。 */\nexport function requiredCapabilitiesAvailable(assessment: PlatformAssessment, required: readonly string[]): boolean {\n return required.every((id) => assessment.availability.get(id) === \"available\");\n}\n\n/**\n * このページで機能が使えない理由(使える、または分からないなら null)。利用直前に読む。\n *\n * - `\"insecure-context\"`: 安全なコンテキストではない(`isSecureContext === false`)。\n * Permissions API が扱う機能はどれも安全なコンテキストを要る。\n * - `\"policy-blocked\"`: Permissions-Policy(サーバーのヘッダ、または `allow` の無い\n * `<iframe>`)がその機能を切っている。\n *\n * どちらも Permissions API は教えない: Chromium はポリシーで切られた文書でも\n * `granted` を、安全でない origin では `denied` を返す。利用者の拒否と区別するため、\n * 見張り役(`<wcs-permission>`)も取りに行く側も `unsupported` を報告する\n * (docs/v4-direction-2026-10.md の決定、state-field-report)。\n * `isSecureContext` が無い環境(SSR・テスト)は判断しない。\n */\nexport type FeatureUnavailableReason = \"insecure-context\" | \"policy-blocked\";\n\n/** Permissions-Policy が制御する機能(permission 名と同じ文字列)。 */\nconst POLICY_CONTROLLED = new Set([\n \"camera\", \"microphone\", \"geolocation\", \"midi\", \"clipboard-read\", \"clipboard-write\",\n \"screen-wake-lock\", \"idle-detection\", \"accelerometer\", \"gyroscope\", \"magnetometer\",\n \"ambient-light-sensor\", \"display-capture\",\n]);\n\ninterface PolicyLike { allowsFeature(feature: string): boolean }\n\nexport function featureUnavailable(feature: string): FeatureUnavailableReason | null {\n const g = globalThis as { isSecureContext?: unknown; document?: { permissionsPolicy?: PolicyLike; featurePolicy?: PolicyLike } };\n if (g.isSecureContext === false) return \"insecure-context\";\n if (!POLICY_CONTROLLED.has(feature)) return null;\n const policy = g.document?.permissionsPolicy ?? g.document?.featurePolicy;\n if (policy === undefined || typeof policy.allowsFeature !== \"function\") return null;\n try {\n return policy.allowsFeature(feature) ? null : \"policy-blocked\";\n } catch {\n return null;\n }\n}\n\n/** `featureUnavailable` の理由を、作者が直し方を読める文にする。`what` は文頭(「The camera」など)。 */\nexport function featureUnavailableMessage(what: string, feature: string, reason: FeatureUnavailableReason): string {\n return reason === \"insecure-context\"\n ? `${what} needs a secure context (https:, or http://localhost), and this page is not one.`\n : `${what} is turned off for this page by a Permissions-Policy: the server's Permissions-Policy header, ` +\n `or an <iframe> without allow=\"${feature}\". The browser's site settings cannot change that.`;\n}\n","/**\n * fetchCapabilities.ts\n *\n * fetch node 固有の capability registry と error code。汎用の assess 機構・型は\n * `./platformCapability.js`(/io-core/ から copy-distribution される生成ファイル)から\n * import する。node 固有の宣言はこのハンドライトファイルに置き、生成コピーとは分離する。\n */\n\nimport { CapabilityRegistry, CapabilitySpec } from \"./platformCapability.js\";\n\n/** 安定した fetch error code(taxonomy)。値は公開キーとして固定。 */\nexport const WCS_FETCH_ERROR_CODE = {\n CapabilityMissing: \"capability-missing\",\n InvalidArgument: \"invalid-argument\",\n Network: \"network\",\n HttpError: \"http-error\",\n Timeout: \"timeout\",\n Aborted: \"aborted\",\n} as const;\n\n/** fetch node の capability registry。文字列 ID を eval せず明示 probe を持つ。 */\nexport const FETCH_CAPABILITIES: CapabilityRegistry = new Map<string, CapabilitySpec>([\n [\"web.fetch\", { probe: () => typeof (globalThis as { fetch?: unknown }).fetch === \"function\", compatKey: \"api.fetch\" }],\n [\"web.abort-controller\", { probe: () => typeof (globalThis as { AbortController?: unknown }).AbortController === \"function\", compatKey: \"api.AbortController\" }],\n]);\n","import { IWcBindable } from \"../types.js\";\nimport { OperationLane, OperationTicket } from \"./operationLane.js\";\nimport {\n PlatformAssessment,\n WcsIoErrorInfo,\n WcsIoErrorPhase,\n assessCapabilities,\n requiredCapabilitiesAvailable,\n} from \"./platformCapability.js\";\nimport { FETCH_CAPABILITIES, WCS_FETCH_ERROR_CODE } from \"./fetchCapabilities.js\";\n\nexport type FetchResponseType = \"auto\" | \"json\" | \"text\" | \"blob\" | \"arrayBuffer\";\n\nexport interface FetchRequestOptions {\n method?: string;\n headers?: Record<string, string>;\n body?: BodyInit | null;\n contentType?: string | null;\n forceText?: boolean;\n // How to read the response body. \"auto\" (default) sniffs Content-Type (JSON or\n // text). \"blob\"/\"arrayBuffer\" enable binary downloads; \"blob\" additionally\n // publishes a managed `objectURL`. `forceText` (HTML-replace mode) takes\n // priority over this.\n responseType?: FetchResponseType;\n // Request timeout in ms. When elapsed, the request lane claims a `timeout`\n // terminal, commits a `{ name: \"TimeoutError\" }` error envelope (guarded), then\n // aborts the native request (async-execution-model.md §7 / 09 §5.1). Absent or\n // <= 0 → no timeout (unchanged behaviour, the default).\n timeout?: number;\n}\n\n/** Methods that read only: superseding one loses nothing (RFC 9110 §9.2.1). */\nconst SAFE_METHODS = new Set([\"GET\", \"HEAD\", \"OPTIONS\"]);\n\nexport class FetchCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"value\", event: \"wcs-fetch:response\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.value },\n { name: \"loading\", event: \"wcs-fetch:loading-changed\", semantics: \"state\" },\n { name: \"error\", event: \"wcs-fetch:error\", semantics: \"state\" },\n { name: \"status\", event: \"wcs-fetch:response\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.status },\n // Managed object URL for a `responseType: \"blob\"` response (null otherwise).\n // The Core revokes the previous URL on each new response and on dispose, so\n // a consumer can bind it straight into <img src> without lifecycle glue.\n { name: \"objectURL\", event: \"wcs-fetch:response\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.objectURL },\n // Serializable failure taxonomy (stable code / phase / recoverable), or null.\n // Additive bindable output — the existing `error` property/event are unchanged.\n // Fires on its own `wcs-fetch:error-info-changed` event; no getter, so the\n // bound value is the event detail (mirrors `error` / `loading`).\n { name: \"errorInfo\", event: \"wcs-fetch:error-info-changed\", semantics: \"state\" },\n ],\n inputs: [\n { name: \"url\" },\n { name: \"method\" },\n ],\n commands: [\n { name: \"fetch\", async: true },\n { name: \"abort\" },\n ],\n };\n\n private _target: EventTarget;\n private _value: any = null;\n private _loading: boolean = false;\n private _error: any = null;\n private _status: number = 0;\n private _objectURL: string | null = null;\n private _promise: Promise<any> = Promise.resolve(null);\n // Phase 4 (09-remediation-design.md §5): the request lane. `latest` policy —\n // a new fetch supersedes the in-flight one (switchMap). The lane owns the\n // per-operation AbortController, the owner generation (dispose lifecycle) and\n // the terminal CAS / CommitGuard that decide which completion may write state.\n // This replaces the ad-hoc `_gen` counter + single `_abortController`: a\n // superseded operation now fails the CommitGuard's epoch check instead of\n // relying on a coarse generation recheck, closing the \"completion racing an\n // abort commits stale state\" gap during body reads.\n private _lane = new OperationLane(\"fetch\", \"latest\", { withSignal: true });\n // The request in flight (method and url), to name a change a new request supersedes.\n private _inFlight: { readonly method: string; readonly url: string } | null = null;\n // SSR (§3.8): no asynchronous probe to await, so readiness is immediate.\n private _ready: Promise<void> = Promise.resolve();\n // Phase 6 (§7.2): error taxonomy. The existing `error` property/event shape is\n // unchanged; `errorInfo` projects the serializable WcsIoErrorInfo as an additive\n // wc-bindable output (event `wcs-fetch:error-info-changed`) so DevTools / adopters\n // can classify failures without a breaking change.\n private _errorInfo: WcsIoErrorInfo | null = null;\n\n // Capability IDs (probed at call time, never at module eval / never eval'd as a\n // global path). `web.fetch` required; `web.abort-controller` optional (its\n // absence degrades to a fetch without an abort signal).\n private static readonly REQUIRED_CAPABILITIES = [\"web.fetch\"] as const;\n private static readonly OPTIONAL_CAPABILITIES = [\"web.abort-controller\"] as const;\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n }\n\n get ready(): Promise<void> {\n return this._ready;\n }\n\n // Lifecycle (§3.5). Fetch is command-driven with no subscription to\n // establish, so observe() is an idempotent no-op that resolves once ready;\n // dispose() invalidates any in-flight request and aborts it.\n observe(): Promise<void> {\n return this._ready;\n }\n\n dispose(): void {\n // world generation bump (§4.1): invalidates + aborts every in-flight request.\n this._lane.disposeOwner();\n // Release any outstanding blob object URL on teardown (the other revoke point\n // is _setResponse, which drops the previous URL when a new response arrives).\n if (this._objectURL !== null) {\n this._revokeObjectURL(this._objectURL);\n this._objectURL = null;\n }\n }\n\n get value(): any {\n return this._value;\n }\n\n get loading(): boolean {\n return this._loading;\n }\n\n get error(): any {\n return this._error;\n }\n\n get status(): number {\n return this._status;\n }\n\n get objectURL(): string | null {\n return this._objectURL;\n }\n\n get promise(): Promise<any> {\n return this._promise;\n }\n\n /**\n * The last failure's serializable `WcsIoErrorInfo` (stable `code` / `phase` /\n * `recoverable` / `capabilityId`), or null. Exposed as an additive wc-bindable\n * property (event `wcs-fetch:error-info-changed`); the existing `error`\n * property/event are unchanged.\n */\n get errorInfo(): WcsIoErrorInfo | null {\n return this._errorInfo;\n }\n\n /**\n * Whether the required platform capabilities (`web.fetch`) are available right\n * now — the minimal \"supported\" signal, decided by call-time feature detection,\n * not User-Agent. Additive.\n */\n get supported(): boolean {\n return requiredCapabilitiesAvailable(this.platformAssessment, FetchCore.REQUIRED_CAPABILITIES);\n }\n\n /**\n * Full platform assessment (availability / readiness / preconditions), probed\n * at call time. `readiness` is `degraded` when only the optional\n * `web.abort-controller` is missing. Dev / sidecar view.\n */\n get platformAssessment(): PlatformAssessment {\n return assessCapabilities(FETCH_CAPABILITIES, {\n required: FetchCore.REQUIRED_CAPABILITIES,\n optional: FetchCore.OPTIONAL_CAPABILITIES,\n activity: this._loading ? \"active\" : \"inactive\",\n lastError: this._errorInfo ?? undefined,\n });\n }\n\n private _setErrorInfo(code: string, phase: WcsIoErrorPhase, recoverable: boolean, message: string, capabilityId?: string): void {\n this._commitErrorInfo({ code, phase, recoverable, message, ...(capabilityId === undefined ? {} : { capabilityId }) });\n }\n\n // Single mutation point for `errorInfo`, mirroring `_setError`'s same-value guard\n // and event dispatch so the additive `errorInfo` wc-bindable property stays in sync\n // with `error`. Each failure builds a fresh object (reference guard passes); the\n // clear path passes null (suppresses a redundant null→null per successful fetch).\n private _commitErrorInfo(info: WcsIoErrorInfo | null): void {\n if (this._errorInfo === info) return;\n this._errorInfo = info;\n this._target.dispatchEvent(new CustomEvent(\"wcs-fetch:error-info-changed\", {\n detail: info,\n bubbles: true,\n }));\n }\n\n private _setLoading(loading: boolean): void {\n this._loading = loading;\n this._target.dispatchEvent(new CustomEvent(\"wcs-fetch:loading-changed\", {\n detail: loading,\n bubbles: true,\n }));\n }\n\n private _setError(error: any): void {\n // Same-value guard (async-io-node-guidelines.md §3.3). `error` is state-ish,\n // so suppressing redundant null→null dispatches (every fetch start clears a\n // usually-already-null error) avoids a spurious wcs-fetch:error per successful\n // request. Reference identity is sufficient: each failure builds a fresh\n // object, and the clear path always passes null.\n if (this._error === error) return;\n this._error = error;\n this._target.dispatchEvent(new CustomEvent(\"wcs-fetch:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n private _setResponse(value: any, status: number, objectURL: string | null = null): void {\n // Revoke the previous blob object URL before replacing it. Any new response\n // (success, HTTP error, or network error all funnel through here) supersedes\n // the prior one, so the old URL is no longer needed; this plus dispose()\n // revocation keeps blob downloads leak-free.\n if (this._objectURL !== null) {\n this._revokeObjectURL(this._objectURL);\n }\n this._objectURL = objectURL;\n this._value = value;\n this._status = status;\n this._target.dispatchEvent(new CustomEvent(\"wcs-fetch:response\", {\n detail: { value, status, objectURL },\n bubbles: true,\n }));\n }\n\n // Object URL lifecycle for responseType: \"blob\". The Core owns the blob's\n // object URL (mirrors RecorderCore) so a consumer can bind `objectURL` straight\n // into <img src>/<a href> without managing createObjectURL/revokeObjectURL. Both\n // helpers tolerate environments without URL.createObjectURL (SSR / headless).\n private _createObjectURL(blob: Blob): string | null {\n if (typeof URL !== \"undefined\" && typeof URL.createObjectURL === \"function\") {\n return URL.createObjectURL(blob);\n }\n return null;\n }\n\n private _revokeObjectURL(url: string): void {\n if (typeof URL !== \"undefined\" && typeof URL.revokeObjectURL === \"function\") {\n URL.revokeObjectURL(url);\n }\n }\n\n abort(): void {\n // Explicit user cancel: abort the active operation WITHOUT advancing the lane\n // epoch, so the aborted operation stays eligible and its AbortError branch may\n // commit loading=false (leaving the in-flight value/status). A superseding\n // fetch() instead advances the epoch (via the lane's begin()), which makes the\n // predecessor ineligible so its abort commits nothing (loading does not flicker).\n this._lane.abortActive();\n }\n\n // Run one guarded commit step (§5.1). The CommitGuard is re-checked before every\n // setter because a setter that synchronously dispatches an event can supersede\n // the same lane; an invalidation between setters stops the remaining commits\n // without rolling back what already fired.\n private _commitStep(ticket: OperationTicket, step: () => void): void {\n if (this._lane.canCommit(ticket)) {\n step();\n }\n }\n\n async fetch(url: string, options: FetchRequestOptions = {}): Promise<any> {\n // never-throw (§3.6): 引数バリデーション失敗は例外ではなく error プロパティに\n // 流し、サニタイズ値(null)を返す。command-token 経路からの呼び出しが unhandled\n // rejection にならず、「fetch() は全終了ケースで resolve」契約とも整合する。\n if (!url) {\n // Existing `error` shape is unchanged (§7.2 / 07 §互換性); the taxonomy is\n // projected only through the additive `errorInfo`.\n this._setErrorInfo(WCS_FETCH_ERROR_CODE.InvalidArgument, \"start\", false, \"url attribute is required.\");\n this._setError({ message: \"url attribute is required.\" });\n return null;\n }\n\n // Phase 6 (§7.2): probe required capabilities just before starting. If the\n // `web.fetch` API is absent (SSR / headless / very old runtime), do NOT start\n // the operation — surface a stable `capability-missing` taxonomy without\n // attempting the call (and without the generic network-error path).\n const assessment = this.platformAssessment;\n if (!requiredCapabilitiesAvailable(assessment, FetchCore.REQUIRED_CAPABILITIES)) {\n const missing = FetchCore.REQUIRED_CAPABILITIES.find((id) => assessment.availability.get(id) !== \"available\");\n this._setErrorInfo(WCS_FETCH_ERROR_CODE.CapabilityMissing, \"start\", false, `Required capability \"${missing}\" is unavailable.`, missing);\n this._setError({ message: `Required capability \"${missing}\" is unavailable.` });\n return null;\n }\n\n const p = this._doFetch(url, options);\n this._promise = p;\n return p;\n }\n\n private async _doFetch(url: string, options: FetchRequestOptions): Promise<any> {\n // Issue a lane ticket. For the `latest` policy this advances the epoch and\n // aborts the previous in-flight request (supersede), returning a ticket +\n // attempt whose `signal` is the lane-owned AbortController for this operation.\n // `attempt.signal` is undefined when `web.abort-controller` is missing\n // (degraded): the request runs without a native abort signal.\n //\n // Superseding is by design, and a superseded read loses nothing. A superseded\n // change does: it is aborted on the client (the server may or may not have\n // applied it) and its response is dropped, without a word. Say so, naming it\n // (docs/mistake-catalogue.md, \"fetch-superseded-mutation\").\n const previous = this._inFlight;\n if (previous !== null && !SAFE_METHODS.has(previous.method)) {\n console.warn(\n `[@wcstack/fetch] [wcs/fetch-request-superseded] A ${previous.method} request to \"${previous.url}\" ` +\n `was still in flight when another request started on the same element: it was aborted and its ` +\n `response dropped (the server may have applied it). Give each change its own <wcs-fetch>, or wait ` +\n `for loading to end before starting the next request.`,\n );\n }\n const started = this._lane.begin();\n // `latest` begin never returns null (exhaust is the only rejecting policy).\n const { ticket, attempt } = started!;\n const signal = attempt.signal;\n const current = { method: String(options.method ?? \"GET\").toUpperCase(), url };\n this._inFlight = current;\n\n this._commitStep(ticket, () => this._setLoading(true));\n this._commitStep(ticket, () => { this._commitErrorInfo(null); this._setError(null); });\n\n const {\n method = \"GET\",\n body = null,\n contentType = null,\n forceText = false,\n responseType = \"auto\",\n timeout = 0,\n } = options;\n\n // Timeout terminal (§5.1 / §7): a timer claims the `timeout` outcome via the\n // same terminal CAS as success/error, commits a guarded TimeoutError, THEN\n // aborts the native request and releases the lane — never \"invalidate first\".\n // A completion that arrives after the timer loses the CAS and writes nothing.\n let timeoutTimer: ReturnType<typeof setTimeout> | null = null;\n if (timeout > 0) {\n timeoutTimer = setTimeout(() => {\n if (!this._lane.claimTerminal(ticket, \"timeout\")) return;\n const message = `Request timed out after ${timeout}ms.`;\n this._commitStep(ticket, () => {\n this._setErrorInfo(WCS_FETCH_ERROR_CODE.Timeout, \"execute\", true, message);\n this._setError({ name: \"TimeoutError\", message });\n });\n this._commitStep(ticket, () => this._setResponse(null, 0));\n this._commitStep(ticket, () => this._setLoading(false));\n this._lane.abort(ticket);\n this._lane.finalize(ticket);\n }, timeout);\n }\n\n // Copy the caller's headers so the contentType injection below never mutates\n // the object passed in by a headless consumer (the Shell already builds a\n // fresh object, but direct FetchCore users may reuse theirs).\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n\n try {\n if (contentType && !headers[\"Content-Type\"]) {\n headers[\"Content-Type\"] = contentType;\n }\n\n const requestInit: RequestInit = {\n method,\n headers,\n signal,\n };\n\n if (method !== \"GET\" && method !== \"HEAD\" && body !== null) {\n requestInit.body = body;\n }\n\n const response = await globalThis.fetch(url, requestInit);\n\n // Read the body first, then atomically claim the terminal at the commit\n // point. Claiming AFTER the body read closes the stale-write race: a fetch\n // that was superseded (or timed out) during the body read fails the\n // CommitGuard's epoch/CAS check and writes nothing, even if the body still\n // resolved. HEAD carries no body by spec.\n let value: any = null;\n if (method === \"HEAD\") {\n // HEAD responses carry no body — reading it would throw a parse error.\n } else if (!response.ok) {\n // HTTP error: read the body text for the error envelope. Handled below.\n } else if (forceText) {\n // HTML-replace mode (the Shell sets forceText when `target` is present)\n // always reads text and takes priority over responseType.\n value = await response.text();\n } else if (responseType === \"blob\") {\n // Only buffer the Blob here; the managed object URL is created AFTER the\n // terminal claim wins (below). Creating it before the claim would leak a\n // blob: URL when this operation loses the claim (supersede / timeout /\n // dispose during the body read) — it would never reach _setResponse and\n // never be revoked.\n value = await response.blob();\n } else if (responseType === \"arrayBuffer\") {\n value = await response.arrayBuffer();\n } else if (responseType === \"text\") {\n value = await response.text();\n } else if (responseType === \"json\") {\n value = await response.json();\n } else {\n // \"auto\" (default): sniff Content-Type — JSON when it says so, else text.\n const responseContentType = response.headers.get(\"Content-Type\") || \"\";\n if (responseContentType.includes(\"application/json\")) {\n value = await response.json();\n } else {\n value = await response.text();\n }\n }\n\n if (!response.ok) {\n const errorBody = await response.text().catch(() => \"\");\n const error = { status: response.status, statusText: response.statusText, body: errorBody };\n if (!this._lane.claimTerminal(ticket, \"error\")) {\n return null;\n }\n this._commitStep(ticket, () => {\n this._setErrorInfo(WCS_FETCH_ERROR_CODE.HttpError, \"execute\", true, `HTTP ${response.status} ${response.statusText}`);\n this._setError(error);\n });\n // Notify `status` observers on HTTP errors too. The `status` property is\n // surfaced via the `wcs-fetch:response` event (getter reads detail.status),\n // so without dispatching it here a bind() subscriber would never see the\n // error status (404, 500, ...). `value` is reset to null on error.\n this._commitStep(ticket, () => this._setResponse(null, response.status));\n this._commitStep(ticket, () => this._setLoading(false));\n return null;\n }\n\n if (!this._lane.claimTerminal(ticket, \"success\")) {\n return null;\n }\n // Create the blob object URL only now that this operation owns the terminal,\n // so a dropped operation never allocates one (leak-free). HEAD/non-blob keep\n // value non-Blob → objectURL stays null.\n const objectURL = value instanceof Blob ? this._createObjectURL(value) : null;\n this._commitStep(ticket, () => this._setResponse(value, response.status, objectURL));\n this._commitStep(ticket, () => this._setLoading(false));\n return this._value;\n } catch (e: any) {\n if (e && e.name === \"AbortError\") {\n // AbortError with a still-eligible ticket is an explicit user abort() of\n // the current request: claim the `aborted` terminal and clear loading,\n // leaving the in-flight value/status untouched. A superseding fetch or\n // dispose() advanced the epoch / owner generation, so their predecessors\n // fail the claim (return without writing = stale-drop). A timeout already\n // claimed the terminal in its timer, so this branch also no-ops there.\n if (this._lane.claimTerminal(ticket, \"aborted\")) {\n this._commitStep(ticket, () => this._setLoading(false));\n }\n return null;\n }\n // Network error. A superseded/disposed request fails the claim and drops.\n if (!this._lane.claimTerminal(ticket, \"error\")) {\n return null;\n }\n this._commitStep(ticket, () => {\n const message = String(e?.message ?? \"Network request failed.\");\n this._setErrorInfo(WCS_FETCH_ERROR_CODE.Network, \"execute\", true, message);\n // Coalesce a falsy rejection (Promise.reject(null)/throw null) to a non-null\n // envelope so the `error` same-value guard (cleared to null at start) cannot\n // suppress a genuine terminal error — keeping `error`/`wcs-fetch:error` in sync\n // with `errorInfo`. Truthy errors (real TypeErrors) pass through unchanged.\n this._setError(e ?? { message });\n });\n // Reset value/status on network errors too, mirroring the HTTP-error path.\n // Without this, a prior successful request's value/status would linger while\n // `error` is non-null. status=0 is the web-platform convention for \"no HTTP\n // response\" (matches XMLHttpRequest.status on network failure).\n this._commitStep(ticket, () => this._setResponse(null, 0));\n this._commitStep(ticket, () => this._setLoading(false));\n return null;\n } finally {\n if (this._inFlight === current) this._inFlight = null;\n if (timeoutTimer !== null) {\n clearTimeout(timeoutTimer);\n }\n // Release the operation (identity-safe: keyed by operationId, so a\n // late-settling superseded request never disarms the successor). Idempotent\n // with the timeout timer's own finalize().\n this._lane.finalize(ticket);\n }\n }\n}\n","import { config } from \"./config.js\";\nimport type { Fetch } from \"./components/Fetch.js\";\n\nlet registered = false;\n\nfunction handleClick(event: Event): void {\n const target = event.target;\n if (!(target instanceof Element)) return;\n\n const triggerElement = target.closest<Element>(`[${config.triggerAttribute}]`);\n if (!triggerElement) return;\n\n const fetchId = triggerElement.getAttribute(config.triggerAttribute);\n if (!fetchId) return;\n\n // Resolve the registered constructor at call time instead of importing Fetch\n // as a value. The value import created a components/Fetch.ts ⇄ autoTrigger.ts\n // cycle (Fetch.connectedCallback() calls registerAutoTrigger()). instanceof\n // against the customElements registry keeps the exact same identity guarantee\n // — only the registered <wcs-fetch> class matches — without the import cycle.\n const FetchCtor = customElements.get(config.tagNames.fetch);\n const el = document.getElementById(fetchId);\n if (!FetchCtor || !(el instanceof FetchCtor)) return;\n const fetchElement = el as Fetch;\n\n // Skip when the target has no url. fetch() is fire-and-forget here (its returned\n // promise is intentionally not awaited), and FetchCore.fetch() rejects synchronously\n // on an empty url. Without this guard that rejection would surface as an unhandled\n // promise rejection. Treat a url-less target as \"nothing to do\", consistent with the\n // other early returns above.\n if (!fetchElement.url) return;\n\n // Suppress the element's default action so a fetch can fire without navigating.\n // Intentional: do not attach data-fetchtarget to an element whose default action\n // you also want (real <a href> link, form-submit button) — it will be cancelled.\n // See README \"Optional DOM Triggering\".\n event.preventDefault();\n fetchElement.fetch();\n}\n\nexport function registerAutoTrigger(): void {\n if (registered) return;\n registered = true;\n document.addEventListener(\"click\", handleClick);\n}\n\nexport function unregisterAutoTrigger(): void {\n if (!registered) return;\n registered = false;\n document.removeEventListener(\"click\", handleClick);\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/upgrade-properties.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n// custom element の property upgrade — `static wcBindable.inputs` に宣言した入力のうち、\n// 要素が upgrade される前に代入された own データプロパティを取り込み直す。\n//\n// なぜ必要か:\n// 未定義タグの要素は素の HTMLElement なので、`el.url = \"...\"` は own データプロパティを作る。\n// upgrade 後にクラスの accessor が prototype へ入っても own プロパティが優先されるため、\n// setter は二度と呼ばれず、値は要素へ届かないまま消える(エラーも警告も出ない)。\n// 常にプロパティ代入を行う framework(Angular の `[prop]`、Lit の `.prop=`、\n// Solid の `prop:`、Vue の `.prop` 修飾子)× 遅延定義(autoloader / CDN / code-split)で\n// 常態的に起きる。docs/architecture-hardening/13-framework-adapter-binding-constraints.md §1.2。\n//\n// 安全側の判定:\n// own プロパティがあっても、prototype チェーンに accessor が無ければ「シャドウ」ではなく\n// その own プロパティ自体が正規の格納先なので触らない(public class field を壊さない)。\n//\n// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/upgrade-properties.ts), then run\n// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies\n// (packages/<pkg>/src/protocol/upgradeProperties.ts). Those copies are generated — do not edit them.\nimport { IWcBindable } from \"./wcBindable.js\";\n\nfunction hasAccessorOnPrototype(target: object, name: string): boolean {\n let proto = Object.getPrototypeOf(target);\n while (proto !== null) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, name);\n if (descriptor !== undefined) {\n return typeof descriptor.get === \"function\" || typeof descriptor.set === \"function\";\n }\n proto = Object.getPrototypeOf(proto);\n }\n return false;\n}\n\n// 属性になってしまったオブジェクトの入力(`files=\"[object File]\"`)を、要素ごとに 1 回だけ言う。\n// React 19 は定義前の要素にプロパティが無いのでオブジェクトを属性に書き、Vue の `.attr` も\n// 書く。要素はその入力をプロパティでしか読まないので、何も受け取らず、何も言わなかった\n// (docs/seam-apps.md、fw-inventory)。\nconst toldObjectAttribute = new WeakSet<object>();\n\nfunction warnObjectAttribute(element: object, name: string, value: string): void {\n if (toldObjectAttribute.has(element)) return;\n toldObjectAttribute.add(element);\n const tag = (element as { localName?: string }).localName ?? \"element\";\n console.warn(\n `[wcs/input-as-attribute] <${tag}> has the attribute ${name}=\"${value}\": an object was written as an ` +\n `attribute, so the element did not receive it. A framework does that when the property is set before the ` +\n `element's definition loads (React 19), or when told to (Vue's .attr). Load the definition before rendering, ` +\n `or assign the property through a ref (Vue: .prop). (Said once per element.)`,\n element,\n );\n}\n\n/**\n * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で\n * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。\n *\n * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。\n * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。\n * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。\n * - 値が `[object …]` の属性(属性に書かれてしまったオブジェクトの入力)は、要素ごとに 1 回警告する。\n */\nexport function upgradeProperties(element: object): void {\n const declaration = (element as { constructor?: { wcBindable?: IWcBindable } }).constructor?.wcBindable;\n const inputs = declaration?.inputs;\n if (inputs === undefined) return;\n const getAttribute = (element as { getAttribute?: (name: string) => string | null }).getAttribute;\n for (const input of inputs) {\n const name = input.name;\n const attribute = typeof getAttribute === \"function\" ? getAttribute.call(element, name.toLowerCase()) : null;\n if (attribute !== null && attribute.startsWith(\"[object \")) warnObjectAttribute(element, name, attribute);\n if (!Object.prototype.hasOwnProperty.call(element, name)) continue;\n if (!hasAccessorOnPrototype(element, name)) continue;\n const record = element as Record<string, unknown>;\n const value = record[name];\n delete record[name];\n record[name] = value;\n }\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/input-attribute.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n// 属性へ反映する wc-bindable 入力の producer 側(SPEC-extensions § Producer guidance for inputs の P1〜P3)。\n// 入力の setter は属性をこの 2 関数で書く。それで次が揃う:\n// - `undefined` は「値が無い」(P1): 属性を、この関数で最初に書く前の状態 — マークアップに書かれた値、\n// 無ければ属性なし(= その入力の文書化した既定値)— へ戻す。applier プロファイルを宣言する binder は\n// 値の後の `undefined` を書き(A2)、React 19 も書き、直接の代入でも届く。\n// - `null` はクリア(P2): 属性なし、つまり文書化した既定値。\n// - どちらも文字列 \"undefined\" / \"null\" として属性に入らない。\n//\n// 「最初に書く前」は、その最初の書き込みのときに読む(遅延)。upgrade 前に代入されたプロパティは\n// connectedCallback の upgradeProperties() が通し直すので、そのときにはパーサが書いた属性が揃っている。\n// 要素自身が setter を通さずに書いた属性は、最初の書き込みより前なら「最初の状態」に含まれる。\n//\n// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/input-attribute.ts), then run\n// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies\n// (packages/<pkg>/src/protocol/inputAttribute.ts). Those copies are generated — do not edit them.\n\nconst initialAttributes = new WeakMap<Element, Map<string, string | null>>();\n\n/** The attribute as it stood before the first write through these helpers. */\nfunction initialAttribute(el: Element, name: string): string | null {\n let byName = initialAttributes.get(el);\n if (byName === undefined) {\n byName = new Map();\n initialAttributes.set(el, byName);\n }\n if (!byName.has(name)) byName.set(name, el.getAttribute(name));\n return byName.get(name) as string | null;\n}\n\nfunction writeAttribute(el: Element, name: string, value: string | null): void {\n if (value === null) el.removeAttribute(name);\n else el.setAttribute(name, value);\n}\n\n/**\n * A value attribute. `value` is written as `String(value)`; `null` removes the attribute;\n * `undefined` restores the attribute the element started with.\n */\nexport function reflectAttribute(el: Element, name: string, value: unknown): void {\n const initial = initialAttribute(el, name);\n writeAttribute(el, name, value === undefined ? initial : value === null ? null : String(value));\n}\n\n/**\n * A boolean attribute, present while `value` is truthy (`null` and `false` remove it);\n * `undefined` restores the attribute the element started with.\n */\nexport function reflectBooleanAttribute(el: Element, name: string, value: unknown): void {\n const initial = initialAttribute(el, name);\n writeAttribute(el, name, value === undefined ? initial : value ? \"\" : null);\n}\n","/**\n * Trusted Types (`require-trusted-types-for 'script'`) 対応。正本は docs/csp.md §7。\n *\n * `<wcs-fetch target=\"...\">` の HTML 置換モードが innerHTML に流すのは **レスポンス**\n * = TT がまさに止めたい値そのもの。ここに identity policy を噛ませて通すのは\n * 「TT 対応」ではなく「TT の無効化」なので、fetch は自前の policy を作らない。\n * Angular が DomSanitizer を必須にしているのと同じ立て付けで、利用側が sanitizer を\n * 持つ policy を注入したときだけ通す。\n *\n * 注入口は全 @wcstack パッケージ共通のグローバルスロット。buildless(CDN 一発)でも\n * inline script 1 本で差し込める:\n *\n * ```js\n * globalThis[Symbol.for(\"wcstack.trustedTypes.policy\")] =\n * trustedTypes.createPolicy(\"my-app\", { createHTML: (s) => DOMPurify.sanitize(s) });\n * ```\n *\n * policy があるときは TT 非対応ブラウザでも通す。sanitizer が Chromium でだけ効いて\n * Firefox では素通し、という差が出るほうが危ないため。\n */\n\nexport interface IWcsTrustedTypesPolicy {\n createHTML?(input: string): unknown;\n createScriptURL?(input: string): unknown;\n}\n\n/** 利用側が policy を差し込むグローバルスロット(全 @wcstack パッケージ共通)。 */\nexport const TRUSTED_TYPES_POLICY_SLOT = Symbol.for(\"wcstack.trustedTypes.policy\");\n\ntype SymbolSlotHolder = { [key: symbol]: unknown };\n\n/** 利用側が注入した policy。fetch は identity policy にフォールバックしない。 */\nexport function getTrustedTypesPolicy(): IWcsTrustedTypesPolicy | null {\n const value = (globalThis as SymbolSlotHolder)[TRUSTED_TYPES_POLICY_SLOT];\n if (value === null || typeof value !== \"object\") return null;\n return value as IWcsTrustedTypesPolicy;\n}\n\n/** 利用側 policy を設定する(`null` で解除)。 */\nexport function setTrustedTypesPolicy(policy: IWcsTrustedTypesPolicy | null): void {\n (globalThis as SymbolSlotHolder)[TRUSTED_TYPES_POLICY_SLOT] = policy;\n}\n\n/**\n * レスポンスを利用側 policy に通す。policy が無ければ素通し= TT 有効下では\n * ブラウザが弾く(意図どおり)。\n */\nexport function trustHtmlValue(value: unknown): unknown {\n if (typeof value !== \"string\") return value;\n const policy = getTrustedTypesPolicy();\n const createHTML = policy?.createHTML;\n if (typeof createHTML !== \"function\") return value;\n return createHTML.call(policy, value);\n}\n\nlet _enforced: boolean | undefined = undefined;\nlet _reported = false;\n\n/** テスト用: 実測キャッシュと一度きりの診断をリセットする。 */\nexport function _resetTrustedTypesDiagnostics(): void {\n _enforced = undefined;\n _reported = false;\n}\n\n/**\n * TT が実際に強制されているかを実測する。エラーメッセージの文言に依存しないよう、\n * 使い捨ての要素へ実際に書いて確かめる。`default` policy がある場合は書き込みが\n * 通る=我々の書き込みも通るので、正しく false になる。\n */\nexport function isTrustedTypesEnforced(): boolean {\n if (_enforced !== undefined) return _enforced;\n if (!(\"trustedTypes\" in globalThis)) {\n _enforced = false;\n return _enforced;\n }\n try {\n document.createElement(\"div\").innerHTML = \"<i></i>\";\n _enforced = false;\n } catch {\n _enforced = true;\n }\n return _enforced;\n}\n\n// 呼び出し元(writeTargetHTML)が isTrustedTypesEnforced() を確認してから呼ぶ。\nfunction reportTrustedTypesBlock(): void {\n if (_reported) return;\n _reported = true;\n const hasPolicy = typeof getTrustedTypesPolicy()?.createHTML === \"function\";\n const cause = hasPolicy\n ? \"The injected policy's createHTML() did not return a TrustedHTML.\"\n : \"No sanitizing policy is installed, and @wcstack/fetch deliberately does not pass \"\n + \"responses through an identity policy — that would defeat the CSP.\";\n console.error(\n `[@wcstack/fetch] The \"target\" HTML replace mode was blocked by Trusted Types `\n + `(require-trusted-types-for 'script'). ${cause}\\n`\n + `Install a sanitizing policy before the first fetch:\\n`\n + ` globalThis[Symbol.for(\"wcstack.trustedTypes.policy\")] =\\n`\n + ` trustedTypes.createPolicy(\"my-app\", { createHTML: (s) => DOMPurify.sanitize(s) });\\n`\n + `Or drop \"target\" and bind the response through @wcstack/state. See docs/csp.md section 7.`,\n );\n}\n\n/**\n * HTML 置換モードの書き込み。\n *\n * TT に弾かれたときは直し方を 1 度だけ報告して**投げ返さない**(never-throw §3.6)。\n * 自動 fetch 経路(connect / url 変更 / trigger)は `fetch()` の rejection を受け取る先が\n * 無く、投げ返すと未処理 rejection として page error になる — 実 Chromium の e2e で\n * 確認した。報告が信号であり、黙って握り潰すのとは違う。TT 以外の失敗(innerHTML の\n * setter が別の理由で throw した等)は従来どおり呼び出し元へ投げ返す。\n */\nexport function writeTargetHTML(element: Element, html: unknown): void {\n try {\n element.innerHTML = trustHtmlValue(html) as string;\n } catch (error) {\n if (isTrustedTypesEnforced()) {\n reportTrustedTypesBlock();\n return;\n }\n throw error;\n }\n}\n","import { config } from \"../config.js\";\nimport { IWcBindable } from \"../types.js\";\nimport { FetchCore, FetchResponseType } from \"../core/FetchCore.js\";\nimport { WcsIoErrorInfo } from \"../core/platformCapability.js\";\nimport { FetchHeader } from \"./FetchHeader.js\";\nimport { FetchBody } from \"./FetchBody.js\";\nimport { registerAutoTrigger } from \"../autoTrigger.js\";\nimport { upgradeProperties } from \"../protocol/upgradeProperties.js\";\nimport { reflectAttribute, reflectBooleanAttribute } from \"../protocol/inputAttribute.js\";\nimport { writeTargetHTML } from \"../trustedTypes.js\";\n\nexport class Fetch extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n /** It reports the request it has in flight (pendingPromise): a server render waits for it. */\n static hasPendingPromise = true;\n static wcBindable: IWcBindable = {\n ...FetchCore.wcBindable,\n properties: [\n ...FetchCore.wcBindable.properties,\n { name: \"trigger\", event: \"wcs-fetch:trigger-changed\", semantics: \"state\" },\n ],\n // Shell-level input surface. The Core declares only the portable `url` / `method`;\n // the Shell adds the DOM-driven settable surface. No `attribute` hints are given:\n // these setters reflect to their attributes themselves, and a binding system that\n // mirrored inputs[].attribute (@wcstack/state 3.x) would set the attribute twice. `commands`\n // (fetch / abort) are inherited unchanged from the Core via the spread above.\n inputs: [\n { name: \"url\" },\n { name: \"method\" },\n { name: \"target\" },\n { name: \"manual\" },\n { name: \"body\" },\n { name: \"responseType\" },\n { name: \"trigger\" },\n ],\n };\n static get observedAttributes(): string[] { return [\"url\"]; }\n\n private _core: FetchCore;\n private _body: any = null;\n private _trigger: boolean = false;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n // Auto-fetch coalescing state (see _scheduleAutoFetch).\n private _autoPending: boolean = false;\n private _connectResolve: (() => void) | null = null;\n private _lastFetchedUrl: string | null = null;\n private _toldTriggerWithoutUrl = false;\n private _toldUndefinedHelper = false;\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n // State reflection is wired BEFORE the Core is constructed (canonical\n // order): a Core that dispatches synchronously from its constructor\n // (e.g. speech's unsupported-changed) would otherwise fire before the\n // listeners exist. FetchCore doesn't do that, so this is equivalent here,\n // but every Shell keeps the same order.\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-fetch:loading-changed\": (d) => ({ loading: d === true }),\n \"wcs-fetch:error\": (d) => ({ error: d != null }),\n });\n this._core = new FetchCore(this);\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (async-io-node-guidelines.md §3.6): attachInternals is absent\n // in happy-dom / older environments, and pre-125 Chromium rejects\n // non-dashed state names from states.add() (probed and discarded here).\n // Either case silently disables reflection — the component still works,\n // it just doesn't expose :state() selectors.\n try {\n if (typeof this.attachInternals !== \"function\") return null;\n const internals = this.attachInternals();\n internals.states.add(\"wcs-probe\");\n internals.states.delete(\"wcs-probe\");\n return internals;\n } catch {\n return null;\n }\n }\n\n private _wireStates(map: Record<string, (detail: any) => Record<string, boolean>>): void {\n if (this._internals === null) return;\n const states = this._internals.states;\n for (const [event, toStates] of Object.entries(map)) {\n this.addEventListener(event, (e) => {\n const debug = this.hasAttribute(\"debug-states\");\n for (const [name, on] of Object.entries(toStates((e as CustomEvent).detail))) {\n try {\n if (on) { states.add(name); } else { states.delete(name); }\n } catch { /* never-throw */ }\n if (debug) this.toggleAttribute(`data-wcs-state-${name}`, on);\n }\n });\n }\n }\n\n // Input setters never let setAttribute stringify null / undefined (\"undefined\"\n // url would auto-fetch /undefined, \"undefined\" method is an invalid HTTP\n // method): `null` removes the attribute (the default), `undefined` restores\n // the attribute the element started with (wc-bindable producer guidance P1;\n // React 19 and a direct assignment deliver it, @wcstack/state does not).\n get url(): string {\n return this.getAttribute(\"url\") || \"\";\n }\n\n set url(value: string | null | undefined) {\n reflectAttribute(this, \"url\", value);\n }\n\n get method(): string {\n return (this.getAttribute(\"method\") || \"GET\").toUpperCase();\n }\n\n set method(value: string | null | undefined) {\n reflectAttribute(this, \"method\", value);\n }\n\n get target(): string | null {\n return this.getAttribute(\"target\");\n }\n\n set target(value: string | null | undefined) {\n reflectAttribute(this, \"target\", value);\n }\n\n // Response body interpretation. Backed by the `response-type` attribute so it is\n // settable from HTML, JS, or a binding. An unknown value falls through to the\n // Core's \"auto\" branch. `target` (HTML-replace mode) overrides this.\n get responseType(): FetchResponseType {\n return (this.getAttribute(\"response-type\") as FetchResponseType) || \"auto\";\n }\n\n set responseType(value: string | null | undefined) {\n reflectAttribute(this, \"response-type\", value);\n }\n\n get value(): any {\n return this._core.value;\n }\n\n get loading(): boolean {\n return this._core.loading;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get status(): number {\n return this._core.status;\n }\n\n get objectURL(): string | null {\n return this._core.objectURL;\n }\n\n get errorInfo(): WcsIoErrorInfo | null {\n return this._core.errorInfo;\n }\n\n get promise(): Promise<any> {\n return this._core.promise;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n /**\n * The readiness protocol's pending work (`static hasPendingPromise`): the request this element\n * has in flight, or is about to start (an auto-fetch waits a microtask), settled either way; null\n * when there is none. A server render waits for it, so a request a binding started — a `url`\n * written from state after the element connected — is in the page it serializes\n * (@wcstack/server; docs/v4-direction-2026-10.md §5.1).\n */\n get pendingPromise(): Promise<void> | null {\n if (this._autoPending && !this.manual && this.url) return Promise.resolve().then(() => this.pendingPromise ?? undefined);\n // (FetchCore settles a failed request too: it rejects only on an empty url)\n return this.loading ? this._core.promise.then(() => undefined) : null;\n }\n\n get manual(): boolean {\n return this.hasAttribute(\"manual\");\n }\n\n set manual(value: boolean | null | undefined) {\n reflectBooleanAttribute(this, \"manual\", value);\n }\n\n get body(): any {\n return this._body;\n }\n\n set body(value: any) {\n // Normalize undefined to null: _collectBody treats \"!== null\" as \"body was\n // provided\", so a raw undefined would serialize as a JSON request body.\n this._body = value ?? null;\n }\n\n get trigger(): boolean {\n return this._trigger;\n }\n\n set trigger(value: boolean) {\n const v = !!value;\n if (v) {\n // Skip when url is empty. fetch() is fire-and-forget here (its returned\n // promise is intentionally only chained with .finally() to reset the flag,\n // never .catch()'d), and FetchCore.fetch() rejects on an empty url. Without\n // this guard that rejection — re-thrown by .finally() — surfaces as an\n // unhandled promise rejection. Mirrors the url-less guard in autoTrigger.\n //\n // Leave `_trigger` false (do not set it) and emit no event: nothing ran, so\n // surfacing a `wcs-fetch:trigger-changed` \"completion\" would lie to observers.\n // Keeping the flag false also avoids stalling — once url is provided, writing\n // `true` again is a real false→true transition that triggers the fetch.\n if (!this.url) {\n this._warnTriggerWithoutUrl();\n return;\n }\n this._trigger = true;\n this.fetch().finally(() => {\n this._trigger = false;\n this.dispatchEvent(new CustomEvent(\"wcs-fetch:trigger-changed\", {\n detail: false,\n bubbles: true,\n }));\n });\n }\n }\n\n private _collectHeaders(): Record<string, string> {\n const headers: Record<string, string> = {};\n const headerElements = this.querySelectorAll<FetchHeader>(config.tagNames.fetchHeader);\n for (const el of headerElements) {\n if (typeof el.hasHeader !== \"boolean\") {\n this._warnUndefinedHelper(config.tagNames.fetchHeader, \"header\");\n continue;\n }\n // a header without a value attribute is not sent (FetchHeader)\n if (el.hasHeader) {\n headers[el.headerName] = el.headerValue;\n }\n }\n return headers;\n }\n\n // fetch がネイティブに扱える BodyInit か判定する。これらは JSON.stringify せず\n // 素通しし、Content-Type をブラウザに委ねる (FormData の multipart boundary、\n // Blob の type、URLSearchParams の application/x-www-form-urlencoded を自動付与\n // させるため、_collectBody は contentType に null を返す)。ReadableStream は\n // RequestInit.duplex: 'half' を要するため初版では対象外とし、従来どおり扱う。\n private _isNativeBodyInit(value: unknown): value is BodyInit {\n return value instanceof Blob // File は Blob のサブクラス\n || value instanceof FormData\n || value instanceof URLSearchParams\n || value instanceof ArrayBuffer\n || ArrayBuffer.isView(value); // TypedArray / DataView\n }\n\n private _collectBody(bodySnapshot: any): { body: BodyInit | null; contentType: string | null } {\n // JS API経由のbodyが優先\n if (bodySnapshot !== null) {\n // 文字列はそのまま。Content-Type はユーザーのヘッダ指定に委ねる。\n if (typeof bodySnapshot === \"string\") {\n return { body: bodySnapshot, contentType: null };\n }\n // ネイティブ BodyInit (Blob/File/FormData/URLSearchParams/ArrayBuffer/TypedArray)\n // は素通し。Content-Type はブラウザに委ねるため null を返す。\n if (this._isNativeBodyInit(bodySnapshot)) {\n return { body: bodySnapshot, contentType: null };\n }\n // それ以外のオブジェクトは JSON 化する。\n return { body: JSON.stringify(bodySnapshot), contentType: \"application/json\" };\n }\n\n // サブタグからbodyを取得\n const bodyElement = this.querySelector<FetchBody>(config.tagNames.fetchBody);\n if (bodyElement && typeof bodyElement.bodyContent !== \"string\") {\n this._warnUndefinedHelper(config.tagNames.fetchBody, \"body\");\n } else if (bodyElement) {\n return {\n body: bodyElement.bodyContent || null,\n contentType: bodyElement.contentType,\n };\n }\n\n return { body: null, contentType: null };\n }\n\n abort(): void {\n this._core.abort();\n }\n\n /**\n * Coalesce auto-fetch requests in the current task into a single microtask.\n *\n * Multiple synchronous input writes in the same tick — e.g. a `...` spread\n * writing `url` before `manual` — collapse into one decision made against the\n * FINAL element state, so the spread application order can no longer trigger a\n * stray fetch. The microtask re-reads `isConnected` / `manual` / `url` at fire\n * time; whatever was written last wins.\n *\n * Only the implicit auto-fetch (url attribute change, connect-time) is routed\n * here. Explicit triggers — the `trigger` setter, the `fetch` command, and\n * autoTrigger (data-fetchtarget clicks) — must fire immediately and stay on\n * their own synchronous paths.\n *\n * The connect-time promise (connectedCallbackPromise) is resolved here in\n * EVERY exit path, including the no-fetch branch, so awaiting it never hangs\n * when the final state turns out to be manual / url-less / disconnected.\n */\n private _scheduleAutoFetch(): void {\n if (this._autoPending) {\n return;\n }\n this._autoPending = true;\n queueMicrotask(() => {\n this._autoPending = false;\n const resolveConnect = this._connectResolve;\n this._connectResolve = null;\n const url = this.url;\n // Same-value guard (Phase 4): skip a redundant auto-fetch for the url we\n // last fetched. A spread re-evaluation rewrites every input each cycle, so\n // the `url` setter calls setAttribute with an unchanged value and fires\n // attributeChangedCallback again; without this guard an unrelated state\n // change would refetch. Auto-path only — explicit fetch()/trigger/command\n // stay unconditional (a manual refresh of the same url must work), and\n // `_lastFetchedUrl` is reset on disconnect so a remount refetches.\n if (!url) {\n // The url went empty (a route left, a getter returning null): the next url\n // is a change, even back to the one fetched last. Without this, A → null → A\n // sent nothing the second time — after a failed request too, so a page\n // left and opened again never retried (docs/seam-apps.md, ssr-news).\n this._lastFetchedUrl = null;\n }\n if (this.isConnected && !this.manual && url && url !== this._lastFetchedUrl) {\n // (not the request the element starts as it connects with a url: a POST that is meant)\n if (resolveConnect === null) this._warnUnsafeAutoFetch();\n // fetch() cannot reject here: FetchCore swallows network/HTTP errors and\n // only rejects on an empty url, which the `url` guard above rules out.\n this.fetch().finally(() => resolveConnect?.());\n } else {\n resolveConnect?.();\n }\n });\n }\n\n /**\n * The url changed and the request it starts is a change (POST, PUT, …) with no\n * body: the method stays, and the body was sent once with the previous request.\n * One element that both loads (by url) and posts (by method + body + trigger)\n * sent an empty POST on every navigation after the first post, without a word\n * (docs/seam-apps.md, ssr-news; docs/mistake-catalogue.md).\n */\n /**\n * A `trigger` written while `url` is empty does nothing (timing-and-firing-contract §1.5),\n * and said nothing: a `trigger` before `url` in one `data-wcs` (bindings apply in the\n * order written), a url that state has not computed yet. Said once per outage\n * (docs/v4-direction-2026-10.md §5.1, the I/O command policy): a request starting resets it.\n * Once per element was once per page life — a route puts the same element back on every\n * entry, so the next outage went unsaid (docs/seam-apps.md, shift-desk).\n */\n private _warnTriggerWithoutUrl(): void {\n if (this._toldTriggerWithoutUrl) return;\n this._toldTriggerWithoutUrl = true;\n console.warn(\n \"[@wcstack/fetch] [wcs/command-not-ready] trigger was refused: there is no url, so nothing is fetched. \" +\n \"Write url before trigger (bindings apply in the order written), and write trigger again once there is one. \" +\n \"(Said once until a request is sent again.)\",\n this,\n );\n }\n\n /**\n * A `<wcs-fetch-header>` / `<wcs-fetch-body>` whose definition never loaded is a plain element, and its\n * header or body was left out of the request without a word: a page that defines the tags itself (an\n * autoloader's wrapper module, a scoped registry) defined `<wcs-fetch>` only (docs/seam-apps.md,\n * fw-inventory). Said once per element.\n */\n private _warnUndefinedHelper(tag: string, what: string): void {\n if (this._toldUndefinedHelper) return;\n this._toldUndefinedHelper = true;\n console.warn(\n `[@wcstack/fetch] [wcs/fetch-helper-undefined] <${tag}> inside this <${config.tagNames.fetch}> is not ` +\n `defined, so its ${what} is not sent. Load @wcstack/fetch/auto, or define WcsFetchHeader and WcsFetchBody ` +\n \"with WcsFetch when the page defines the tags itself. (Said once per element.)\",\n this,\n );\n }\n\n private _warnUnsafeAutoFetch(): void {\n const method = this.method;\n if (method === \"GET\" || method === \"HEAD\" || method === \"OPTIONS\") return;\n if (this._body !== null || this.querySelector(config.tagNames.fetchBody) !== null) return;\n console.warn(\n `[@wcstack/fetch] [wcs/fetch-auto-unsafe] The url changed to \"${this.url}\", so this <wcs-fetch> sent a ` +\n `${method} with no body (its method stays ${method}; a body is sent once). Give loading and each change ` +\n `its own <wcs-fetch>, or set \\`manual\\` on the one that changes data.`,\n );\n }\n\n async fetch(): Promise<any> {\n // Record the url for the auto-fetch same-value guard. Every fetch (explicit\n // included) updates it so a later auto-write of the same url is treated as a\n // no-op rather than a duplicate request.\n this._lastFetchedUrl = this.url;\n // ready again (a request starts): a trigger refused in the next outage is said again\n if (this.url) this._toldTriggerWithoutUrl = false;\n const headers = this._collectHeaders();\n\n // Snapshot and reset `body` synchronously, before any await. The body is a\n // one-shot input; resetting it after the await (when another caller may have\n // already set a new body for the next request) would silently drop that value.\n const bodySnapshot = this._body;\n this._body = null;\n const { body, contentType } = this._collectBody(bodySnapshot);\n\n // FormData に手動で Content-Type を付けると、ブラウザが付与するはずの multipart\n // boundary が失われてサーバー側でパースできなくなる。ヘッダはユーザー指定を\n // 尊重して素通しするが、この典型的な誤設定は警告する。\n if (body instanceof FormData &&\n Object.keys(headers).some((name) => name.toLowerCase() === \"content-type\")) {\n console.warn(\n \"[@wcstack/fetch] A manual Content-Type header was set alongside a FormData body. \" +\n \"This drops the multipart boundary the browser adds automatically; remove the \" +\n \"Content-Type header (e.g. the <wcs-fetch-header>) to fix multipart uploads.\",\n );\n }\n\n const result = await this._core.fetch(this.url, {\n method: this.method,\n headers,\n body,\n contentType,\n forceText: !!this.target,\n responseType: this.responseType,\n });\n\n // HTML置換モード\n // Security: the response is injected as raw innerHTML without sanitization.\n // This is an opt-in convenience for trusted fragments only; the primary,\n // recommended path is state-driven binding via @wcstack/state. Do not point\n // `target` at an untrusted endpoint (XSS risk). See README \"HTML Replace Mode\".\n //\n // Under Trusted Types this is the one sink in wcstack whose input is remote\n // data, so it is routed through an *adopter-supplied* sanitizing policy only —\n // fetch never signs the response with an identity policy (docs/csp.md §7).\n if (this.target && result !== null) {\n const targetElement = document.getElementById(this.target);\n if (targetElement) {\n writeTargetHTML(targetElement, result);\n }\n }\n\n return result;\n }\n\n attributeChangedCallback(name: string, _oldValue: string | null, _newValue: string | null): void {\n // Re-fetch on url changes, but intentionally do NOT update\n // `_connectedCallbackPromise`. Per the wc-bindable connectedCallbackPromise\n // protocol that promise represents the one-shot \"connect-time initialization\n // is done\" signal; it resolves once and is not re-armed for later url-driven\n // requests. Await `promise` if you need to track a specific re-fetch.\n //\n // Defer the decision to a microtask (see _scheduleAutoFetch) instead of\n // fetching synchronously here: a `...` spread writes `url` before `manual`,\n // so a synchronous fetch would fire before `manual` is applied. The final\n // state (isConnected / manual / url) is re-read at microtask time.\n if (name === \"url\") {\n this._scheduleAutoFetch();\n }\n }\n\n connectedCallback(): void {\n // upgrade 前に代入された input を取り込み直す(doc 13 §1.2 / Phase A1)\n upgradeProperties(this);\n this.style.display = \"none\";\n if (config.autoTrigger) {\n registerAutoTrigger();\n }\n // Only the initial connect-time fetch is tracked by connectedCallbackPromise.\n // Arm a deferred here when an auto-fetch looks likely; the scheduled\n // microtask resolves it (in every exit path, so awaiting never hangs). The\n // actual fetch decision is re-evaluated at microtask time against the final\n // state, so a spread that sets `manual` after `url` still suppresses it.\n if (!this.manual && this.url) {\n this._connectedCallbackPromise = new Promise<void>((resolve) => {\n this._connectResolve = resolve;\n });\n }\n this._scheduleAutoFetch();\n }\n\n disconnectedCallback(): void {\n this.abort();\n // Reset the same-value guard so a remount (reconnect with the same url)\n // refetches rather than being skipped as a duplicate.\n this._lastFetchedUrl = null;\n // Resolve any armed connect-time deferred before detaching. A synchronous\n // remove()→append() before the scheduled microtask fires would otherwise let\n // the second connectedCallback overwrite _connectResolve, orphaning the first\n // deferred and hanging any caller that already awaited connectedCallbackPromise.\n // Disconnection makes connect-time init moot, so resolving (never hanging) is\n // correct; the pending microtask then sees _connectResolve === null and no-ops.\n this._connectResolve?.();\n this._connectResolve = null;\n }\n}\n","import { reflectAttribute } from \"../protocol/inputAttribute.js\";\n\n/**\n * `<wcs-fetch-header name value>`: one request header of the `<wcs-fetch>` it sits in, read when a\n * request starts. `name` / `value` are properties too, reflected to the attributes (`null` removes\n * one, `undefined` restores the markup's), so a binding — `data-wcs=\"value: authHeader\"` — sets the\n * header. Without a `value` attribute the header is not sent: a token that is not there yet sends\n * no `Authorization` instead of an empty one. Before this, `value:` wrote an expando the element\n * never read, and the request went out with an empty header (docs/seam-apps.md, router-auth).\n *\n * It declares no `wcBindable`: it is part of `<wcs-fetch>`'s markup, not an I/O node of its own.\n */\nexport class FetchHeader extends HTMLElement {\n connectedCallback(): void {\n // A value assigned before the element was upgraded sits on the instance and hides the\n // accessor: pass it through the setter (the upgrade-properties pattern, for two members).\n for (const key of [\"name\", \"value\"] as const) {\n if (Object.prototype.hasOwnProperty.call(this, key)) {\n const value = this[key];\n delete (this as Record<string, unknown>)[key];\n this[key] = value;\n }\n }\n this.style.display = \"none\";\n }\n\n get name(): string {\n return this.getAttribute(\"name\") ?? \"\";\n }\n\n set name(value: unknown) {\n reflectAttribute(this, \"name\", value);\n }\n\n get value(): string {\n return this.getAttribute(\"value\") ?? \"\";\n }\n\n set value(value: unknown) {\n reflectAttribute(this, \"value\", value);\n }\n\n get headerName(): string {\n return this.name;\n }\n\n get headerValue(): string {\n return this.value;\n }\n\n /** Whether the header is sent: it has a name and a `value` attribute (an empty one included). */\n get hasHeader(): boolean {\n return this.name !== \"\" && this.hasAttribute(\"value\");\n }\n}\n","export class FetchBody extends HTMLElement {\n constructor() {\n super();\n // スロットなしのShadow DOMでlight DOM(bodyテキスト)の描画を抑制\n this.attachShadow({ mode: \"open\" });\n }\n\n get contentType(): string {\n return this.getAttribute(\"type\") || \"application/json\";\n }\n\n get bodyContent(): string {\n return this.textContent?.trim() || \"\";\n }\n}\n","import { Fetch } from \"./Fetch.js\";\nimport { config } from \"../config.js\";\n\nexport class InfiniteScroll extends HTMLElement {\n static get observedAttributes(): string[] {\n return [\"target\", \"root\", \"root-margin\", \"threshold\", \"disabled\"];\n }\n\n private _observer: IntersectionObserver | null = null;\n private _done: boolean = false;\n // the target last warned about (once per value)\n private _warnedTarget: string | null = null;\n\n get target(): string {\n return this.getAttribute(\"target\") || \"\";\n }\n\n set target(value: string) {\n this.setAttribute(\"target\", value);\n }\n\n get root(): string | null {\n return this.getAttribute(\"root\");\n }\n\n set root(value: string | null) {\n if (value === null) {\n this.removeAttribute(\"root\");\n } else {\n this.setAttribute(\"root\", value);\n }\n }\n\n get rootMargin(): string {\n return this.getAttribute(\"root-margin\") || \"0px\";\n }\n\n set rootMargin(value: string) {\n this.setAttribute(\"root-margin\", value);\n }\n\n get threshold(): number {\n const value = Number(this.getAttribute(\"threshold\") ?? \"0\");\n return Number.isFinite(value) ? value : 0;\n }\n\n set threshold(value: number) {\n this.setAttribute(\"threshold\", String(value));\n }\n\n get disabled(): boolean {\n return this.hasAttribute(\"disabled\");\n }\n\n set disabled(value: boolean) {\n if (value) {\n this.setAttribute(\"disabled\", \"\");\n } else {\n this.removeAttribute(\"disabled\");\n }\n }\n\n get once(): boolean {\n return this.hasAttribute(\"once\");\n }\n\n set once(value: boolean) {\n if (value) {\n this.setAttribute(\"once\", \"\");\n } else {\n this.removeAttribute(\"once\");\n }\n }\n\n connectedCallback(): void {\n this._observe();\n }\n\n disconnectedCallback(): void {\n this._disconnectObserver();\n }\n\n attributeChangedCallback(): void {\n if (this.isConnected) {\n this._observe();\n }\n }\n\n private _observe(): void {\n this._disconnectObserver();\n\n if (this._done || this.disabled || !this.target || typeof IntersectionObserver === \"undefined\") {\n return;\n }\n\n this._observer = new IntersectionObserver((entries) => {\n if (entries.some((entry) => entry.isIntersecting)) {\n this._triggerFetch();\n }\n }, {\n root: this._resolveRoot(),\n rootMargin: this.rootMargin,\n threshold: this.threshold,\n });\n this._observer.observe(this);\n }\n\n private _disconnectObserver(): void {\n if (this._observer) {\n this._observer.disconnect();\n this._observer = null;\n }\n }\n\n private _resolveRoot(): Element | Document | null {\n if (!this.root) return null;\n return document.getElementById(this.root) || null;\n }\n\n private _triggerFetch(): void {\n const target = document.getElementById(this.target);\n if (!(target instanceof Fetch)) {\n // Nothing to load from: say so once per target, instead of loading no more pages without a word\n // (docs/mistake-catalogue.md, \"infinite-scroll-target\").\n if (this._warnedTarget !== this.target) {\n this._warnedTarget = this.target;\n console.warn(\n `[@wcstack/fetch] [wcs/infinite-scroll-target] <${config.tagNames.infiniteScroll} target=\"${this.target}\"> ` +\n `came into view, but no <${config.tagNames.fetch}> has that id, so no page was loaded.`,\n );\n }\n return;\n }\n\n if (target.loading) {\n return;\n }\n\n target.trigger = true;\n\n if (this.once) {\n this._done = true;\n this._disconnectObserver();\n }\n }\n}","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/define-element.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * One copy of each package on a page (docs/timing-and-firing-contract.md §24). The first copy the\n * page evaluates defines the tags and a second one does nothing, so a copy that finds its tag defined\n * by another copy of the package — not its class, not a subclass of it, not the same version — warns\n * `[wcs/package-twice]` once per registry, naming both versions. The classes it defines carry\n * `\"<package>@<version>\"` under `Symbol.for(\"wcstack.package\")`; a class without it is named\n * \"another copy of <package> that does not name its version\" (an older copy, or one loaded through\n * an entry that does not stamp).\n */\n\n/** The static a class defined through this helper carries: `\"@wcstack/fetch@<version>\"`. */\nexport const PACKAGE_STAMP: unique symbol = Symbol.for(\"wcstack.package\");\n\ntype Stamped = { [PACKAGE_STAMP]?: string };\n\n/** The registries this copy warned about: one warning per package per registry. */\nconst warned = new WeakSet<CustomElementRegistry>();\n\n/**\n * Marks `cls` as defined by `pkg` (`\"@wcstack/fetch@<version>\"`). A subclass inherits the mark, and\n * `defineProperty` writes it even where a parent's mark is read-only.\n */\nexport function stampPackage(cls: CustomElementConstructor, pkg: string): void {\n Object.defineProperty(cls, PACKAGE_STAMP, { value: pkg, configurable: true });\n}\n\n/**\n * Warns when `tag` is defined as `existing` by another copy of the package `pkg` names: `existing`\n * is neither `own` nor a subclass of it (omit `own` when the copy has no class to compare with), and\n * carries another version or none. Once per registry.\n */\nexport function warnIfAnotherCopy(\n registry: CustomElementRegistry,\n tag: string,\n existing: CustomElementConstructor,\n own: CustomElementConstructor | undefined,\n pkg: string,\n): void {\n if (own !== undefined && (existing === own || existing.prototype instanceof own)) return;\n const theirs = (existing as Stamped)[PACKAGE_STAMP];\n if (theirs === pkg || warned.has(registry)) return;\n warned.add(registry);\n const name = pkg.slice(0, pkg.lastIndexOf(\"@\"));\n console.warn(\n `[${name}] [wcs/package-twice] <${tag}> is already defined by ` +\n `${theirs ?? `another copy of ${name} that does not name its version`}; ` +\n `this copy, ${pkg}, does nothing. Load each package once.`,\n );\n}\n\n/**\n * Defines each `[tag, class]` in `registry` unless the tag is already defined, stamping the class\n * with `pkg` (`\"@wcstack/fetch@<version>\"`). A tag another copy of the package defined first is left\n * as it is, with the warning above.\n */\nexport function defineElements(\n registry: CustomElementRegistry,\n pkg: string,\n definitions: readonly (readonly [tag: string, cls: CustomElementConstructor])[],\n): void {\n for (const [tag, cls] of definitions) {\n const existing = registry.get(tag);\n if (existing === undefined) {\n stampPackage(cls, pkg);\n registry.define(tag, cls);\n } else {\n warnIfAnotherCopy(registry, tag, existing, cls, pkg);\n }\n }\n}\n","import pkg from \"../package.json\" with { type: \"json\" };\nimport { Fetch } from \"./components/Fetch.js\";\nimport { FetchHeader } from \"./components/FetchHeader.js\";\nimport { FetchBody } from \"./components/FetchBody.js\";\nimport { InfiniteScroll } from \"./components/InfiniteScroll.js\";\nimport { config } from \"./config.js\";\nimport { defineElements } from \"./protocol/defineElement.js\";\n\n/**\n * Register this package's tags. Pass a scoped `CustomElementRegistry` to define\n * them for a single shadow tree -- scoped registries do not inherit the global\n * one, so a tree using one needs its own definitions.\n */\nexport function registerComponents(registry: CustomElementRegistry = customElements): void {\n defineElements(registry, `${pkg.name}@${pkg.version}`, [\n [config.tagNames.fetch, Fetch],\n [config.tagNames.fetchHeader, FetchHeader],\n [config.tagNames.fetchBody, FetchBody],\n [config.tagNames.infiniteScroll, InfiniteScroll],\n ]);\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapFetch(userConfig?: IWritableConfig, registry?: CustomElementRegistry): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents(registry);\n}\n"],"names":[],"mappings":"AAaA,MAAM,OAAO,GAAoB;AAC/B,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,gBAAgB,EAAE,kBAAkB;AACpC,IAAA,QAAQ,EAAE;AACR,QAAA,KAAK,EAAE,WAAW;AAClB,QAAA,WAAW,EAAE,kBAAkB;AAC/B,QAAA,SAAS,EAAE,gBAAgB;AAC3B,QAAA,cAAc,EAAE,qBAAqB;AACtC,KAAA;CACF;AAED,SAAS,UAAU,CAAI,GAAM,EAAA;AAC3B,IAAA,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;AAAE,QAAA,OAAO,GAAG;AACvD,IAAA,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;IAClB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;AAClC,QAAA,UAAU,CAAE,GAA+B,CAAC,GAAG,CAAC,CAAC;IACnD;AACA,IAAA,OAAO,GAAG;AACZ;AAEA,SAAS,SAAS,CAAI,GAAM,EAAA;AAC1B,IAAA,IAAI,GAAG,KAAK,IAAI,IA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C,CAC3D;AACH;AAEA;;;;AAIG;SACa,cAAc,CAC5B,QAA+B,EAC/B,GAAW,EACX,WAA+E,EAAA;IAE/E,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,WAAW,EAAE;QACpC,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;AAClC,QAAA,IAAI,QAAQ,KAAK,SAAS,EAAE;AAC1B,YAAA,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC;AACtB,YAAA,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC;QAC3B;aAAO;YACL,iBAAiB,CAAC,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC;QACtD;IACF;AACF;;ACnEA;;;;AAIG;AACG,SAAU,kBAAkB,CAAC,QAAA,GAAkC,cAAc,EAAA;AACjF,IAAA,cAAc,CAAC,QAAQ,EAAE,CAAA,EAAG,GAAG,CAAC,IAAI,CAAA,CAAA,EAAI,GAAG,CAAC,OAAO,CAAA,CAAE,EAAE;AACrD,QAAA,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;AAC9B,QAAA,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;AAC1C,QAAA,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;AACtC,QAAA,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;AACjD,KAAA,CAAC;AACJ;;AChBM,SAAU,cAAc,CAAC,UAA4B,EAAE,QAAgC,EAAA;IAC3F,IAAI,UAAU,EAAE;QACd,SAAS,CAAC,UAAU,CAAC;IACvB;IACA,kBAAkB,CAAC,QAAQ,CAAC;AAC9B;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../../src/config.ts","../../src/core/operationLane.ts","../../src/core/platformCapability.ts","../../src/core/fetchCapabilities.ts","../../src/core/FetchCore.ts","../../src/autoTrigger.ts","../../src/protocol/upgradeProperties.ts","../../src/protocol/inputAttribute.ts","../../src/trustedTypes.ts","../../src/components/Fetch.ts","../../src/components/FetchHeader.ts","../../src/components/FetchBody.ts","../../src/components/InfiniteScroll.ts","../../src/protocol/defineElement.ts","../../src/registerComponents.ts","../../src/bootstrapFetch.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n autoTrigger: boolean;\n triggerAttribute: string;\n tagNames: {\n fetch: string;\n fetchHeader: string;\n fetchBody: string;\n infiniteScroll: string;\n };\n}\n\nconst _config: IInternalConfig = {\n autoTrigger: true,\n triggerAttribute: \"data-fetchtarget\",\n tagNames: {\n fetch: \"wcs-fetch\",\n fetchHeader: \"wcs-fetch-header\",\n fetchBody: \"wcs-fetch-body\",\n infiniteScroll: \"wcs-infinite-scroll\",\n },\n};\n\nfunction deepFreeze<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n Object.freeze(obj);\n for (const key of Object.keys(obj)) {\n deepFreeze((obj as Record<string, unknown>)[key]);\n }\n return obj;\n}\n\nfunction deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n const clone: Record<string, unknown> = {};\n for (const key of Object.keys(obj)) {\n clone[key] = deepClone((obj as Record<string, unknown>)[key]);\n }\n return clone as T;\n}\n\nlet frozenConfig: IConfig | null = null;\n\nexport const config: IConfig = _config as IConfig;\n\nexport function getConfig(): IConfig {\n if (!frozenConfig) {\n frozenConfig = deepFreeze(deepClone(_config));\n }\n return frozenConfig;\n}\n\n/** A misspelt option would otherwise do nothing: `bootstrapFetch` refuses it. */\nfunction invalid(key: string): never {\n throw new Error(`[@wcstack/fetch] bootstrapFetch: \"${key}\" is not one of its options, or not of the option's type.`);\n}\n\n/**\n * Applies the options given; an undefined value is left out. An option this package does not\n * have, a value of another type than its default (null, or an array for an object, included) or\n * a tag name it does not define throws, and then nothing is applied.\n */\nexport function setConfig(partialConfig: IWritableConfig): void {\n const options = _config as unknown as Record<string, unknown>;\n const tags = _config.tagNames as Record<string, string>;\n const given = Object.entries(partialConfig).filter(([, value]) => value !== undefined);\n const givenTags = Object.entries(partialConfig.tagNames ?? {}).filter(([, tag]) => tag !== undefined);\n for (const [key, value] of given) {\n const current = options[key];\n if (!Object.hasOwn(options, key) || value === null || typeof value !== typeof current || Array.isArray(value) !== Array.isArray(current)) {\n invalid(key);\n }\n }\n for (const [name, tag] of givenTags) {\n if (!Object.hasOwn(tags, name) || typeof tag !== \"string\") invalid(`tagNames.${name}`);\n }\n for (const [key, value] of given) {\n if (key !== \"tagNames\") {\n options[key] = value;\n }\n }\n for (const [name, tag] of givenTags) tags[name] = tag as string;\n frozenConfig = null;\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /io-core/operation-lane.ts by scripts/sync-io-core.mjs.\n// Run `node scripts/sync-io-core.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * operationLane.ts\n *\n * Phase 4 (docs/architecture-hardening/09-remediation-design.md §5, §5.1) の\n * OperationTicket / CommitGuard / terminal CAS を型付き実装した lane プリミティブ。\n * docs/async-execution-model.md §5 が既に規範化した排他モード\n * (latest / queue / exhaust / overlap) を、`AbortController` だけでは防げない\n * 「取消不能な Promise・abort と同時に完了した結果の commit」から守るための\n * 実行時ガードとして具体化する。\n *\n * 配置方針 (§5): 本ファイルは /io-core/ の単一正典であり、scripts/sync-io-core.mjs が\n * 各 IO ノードの src/core/ へ生成コピー (AUTO-GENERATED, 編集禁止) を配布する。\n * `protocol/wcBindable.ts` と同じ copy-distribution 方式で、ランタイム依存を導入せず\n * 各パッケージのバンドルへ inline される (zero-runtime-dep / 自己完結 CDN を維持)。\n * 編集はこの正典に対して行い、`node scripts/sync-io-core.mjs` で再配布する。\n *\n * 初期 PoC は fetch の `latest` policy から開始した。現在は4 policy 全てを\n * `operationLane.test.ts` が直接検証し、生成コピーを fetch / upload / share /\n * contacts / credential / eyedropper が利用する。lane 自体は promise を実行せず、\n * bookkeeping と guard の状態機械に徹する — 実際の非同期処理は Core が駆動し\n * lane に照合する。\n */\n\n/** §5: 排他モードの語彙。async-execution-model.md §5 の 4 モードに対応 (parallel は予約語・スコープ外)。 */\nexport type LanePolicy = \"latest\" | \"queue\" | \"exhaust\" | \"overlap\";\n\n/** §5: 各 operation の一回限りの終端結果。 */\nexport type TerminalOutcome = \"success\" | \"error\" | \"timeout\" | \"aborted\" | \"stale\";\n\n/** §5: 論理操作 1 件の identity。retry は同じ operationId を再利用する。 */\nexport interface OperationTicket {\n readonly operationId: number;\n /** 発行時に捕捉した I/O Core の observe / reconnect / dispose lifecycle 世代。 */\n readonly ownerGeneration: number;\n readonly laneKey: string;\n readonly policy: LanePolicy;\n /** supersede bookkeeping に使う epoch (latest policy のみ)。 */\n readonly supersedeEpoch?: number;\n}\n\n/** §5: operation の 1 回の試行。retry で attempt++ と resource signal だけ差し替える。 */\nexport interface OperationAttempt {\n readonly operationId: number;\n readonly attempt: number;\n readonly signal?: AbortSignal;\n}\n\n/** §6: DevTools 側 channel へ流す trace(fetch では既定 off・zero-cost)。 */\nexport type OperationTraceEvent =\n | { readonly type: \"io:operation-started\"; readonly operationId: number; readonly laneKey: string; readonly policy: LanePolicy }\n | { readonly type: \"io:operation-retried\"; readonly operationId: number; readonly laneKey: string; readonly attempt: number }\n | { readonly type: \"io:operation-settled\"; readonly operationId: number; readonly laneKey: string; readonly outcome: TerminalOutcome }\n | { readonly type: \"io:stale-dropped\"; readonly operationId: number; readonly laneKey: string };\n\nexport interface OperationLaneOptions {\n /** attempt ごとに AbortController を発行し signal を渡す (fetch/upload 系)。 */\n readonly withSignal?: boolean;\n /**\n * trace subscriber。undefined なら trace record を一切生成しない\n * (§10.3 hook-off zero allocation の gate)。\n */\n readonly trace?: (event: OperationTraceEvent) => void;\n}\n\n/**\n * 1 レーン = 独立した排他単位。Core が 1 つ以上所有する (module singleton にしない —\n * 複数 <wcs-fetch> 間で漏れるため)。\n */\nexport class OperationLane {\n readonly laneKey: string;\n readonly policy: LanePolicy;\n\n private _ownerGeneration = 0;\n private _latestEpoch = 0;\n private _nextOperationId = 1;\n // latest / queue / exhaust の単一 active。queue は head を指す。\n private _activeOperationId: number | undefined = undefined;\n // overlap の active set (§5: 内部 bookkeeping のみ・observable 公開はしない)。\n private readonly _activeOperationIds = new Set<number>();\n // queue policy の FIFO。\n private readonly _queue: OperationTicket[] = [];\n // opId → claimTerminal で確定した outcome。存在 = committing (finalize が確定させる)。\n private readonly _claimedOutcome = new Map<number, TerminalOutcome>();\n // opId → AbortController (identity は opId が保証。cross-op clobber は構造上起きない)。\n private readonly _controllers = new Map<number, AbortController>();\n // opId → attempt 数。存在 = live (begin 済みで finalize / dispose 前) で、in-flight はこの大きさ。\n // 終わった operation は何も残さない — 終端済みの記録を持つと長く開いたページで際限なく増える\n // (docs/formal-methods-study.md §4.1)。\n private readonly _attempts = new Map<number, number>();\n private readonly _withSignal: boolean;\n private readonly _trace?: (event: OperationTraceEvent) => void;\n\n constructor(laneKey: string, policy: LanePolicy, options: OperationLaneOptions = {}) {\n this.laneKey = laneKey;\n this.policy = policy;\n this._withSignal = options.withSignal ?? false;\n this._trace = options.trace;\n }\n\n get ownerGeneration(): number {\n return this._ownerGeneration;\n }\n\n get inFlightCount(): number {\n return this._attempts.size;\n }\n\n get latestEpoch(): number {\n return this._latestEpoch;\n }\n\n get activeOperationId(): number | undefined {\n return this._activeOperationId;\n }\n\n /**\n * 新しい要求の到着。arrival policy を適用し ticket + 最初の attempt を発行する。\n * exhaust で実行中の場合だけ null を返す (新要求を ticket 化せず拒否 = 冪等 no-op)。\n */\n begin(): { ticket: OperationTicket; attempt: OperationAttempt } | null {\n let supersedeEpoch: number | undefined;\n switch (this.policy) {\n case \"latest\": {\n // latestEpoch を進め、旧 active を abort (可能なら)。旧 ticket は settle 時に\n // eligibility 不一致で stale となる。\n supersedeEpoch = ++this._latestEpoch;\n if (this._activeOperationId !== undefined) {\n this._abortController(this._activeOperationId);\n }\n break;\n }\n case \"exhaust\": {\n // 実行中なら新要求を拒否 (呼び出し側は既存結果へ合流)。\n if (this._activeOperationId !== undefined) {\n return null;\n }\n break;\n }\n case \"queue\":\n case \"overlap\":\n break;\n }\n\n const operationId = this._nextOperationId++;\n const ticket: OperationTicket = {\n operationId,\n ownerGeneration: this._ownerGeneration,\n laneKey: this.laneKey,\n policy: this.policy,\n supersedeEpoch,\n };\n\n switch (this.policy) {\n case \"latest\":\n case \"exhaust\":\n this._activeOperationId = operationId;\n break;\n case \"queue\":\n this._queue.push(ticket);\n // 先頭だけを active にする (先行が完了するまで待つ)。\n if (this._activeOperationId === undefined) {\n this._activeOperationId = operationId;\n }\n break;\n case \"overlap\":\n this._activeOperationIds.add(operationId);\n break;\n }\n\n this._attempts.set(operationId, 1);\n const attempt = this._makeAttempt(operationId, 1);\n if (this._trace !== undefined) {\n this._trace({ type: \"io:operation-started\", operationId, laneKey: this.laneKey, policy: this.policy });\n }\n return { ticket, attempt };\n }\n\n /**\n * retry: 同じ operationId に新しい attempt を作る。attempt number と resource signal\n * だけを更新する (§5)。終端した・claim 済みの operation と、もう commit できない operation\n * (supersede された latest / queue の先頭の後ろで待つもの) には作れない (null) — 結果を\n * 捨てるしかない要求に新しい signal を渡さない (docs/formal-methods-study.md §4.1)。\n */\n retry(ticket: OperationTicket): OperationAttempt | null {\n if (ticket.ownerGeneration !== this._ownerGeneration) return null;\n const previous = this._attempts.get(ticket.operationId);\n if (previous === undefined || this._claimedOutcome.has(ticket.operationId)) return null;\n if (!this._isEligible(ticket)) return null;\n const attemptNo = previous + 1;\n this._attempts.set(ticket.operationId, attemptNo);\n // 前の attempt の signal は破棄し、新しい controller を張る。\n this._releaseController(ticket.operationId);\n const attempt = this._makeAttempt(ticket.operationId, attemptNo);\n if (this._trace !== undefined) {\n this._trace({ type: \"io:operation-retried\", operationId: ticket.operationId, laneKey: this.laneKey, attempt: attemptNo });\n }\n return attempt;\n }\n\n /**\n * CommitGuard (§5.1)。外部可視の setter / event dispatch の直前に呼ぶ。\n * (1) owner lifecycle generation 一致 (2) terminal settle 前 (3) policy eligibility。\n */\n canCommit(ticket: OperationTicket): boolean {\n if (ticket.ownerGeneration !== this._ownerGeneration) return false;\n // live でなければ settle 済み。pending と committing (multi-setter commit 中) はどちらも settle 前。\n if (!this._attempts.has(ticket.operationId)) return false;\n return this._isEligible(ticket);\n }\n\n /**\n * terminal CAS (§5.1): pending → committing を claim する。勝者だけが true。\n * eligibility / owner gen を満たさない場合も false。claim 後は commit 中となり、\n * canCommit は各 setter の直前で再検査する (setter が同期 supersede しても取りこぼさない)。\n */\n claimTerminal(ticket: OperationTicket, outcome: TerminalOutcome): boolean {\n if (ticket.ownerGeneration !== this._ownerGeneration) return false;\n // 終端済み (live でない) / 既に committing\n if (!this._attempts.has(ticket.operationId) || this._claimedOutcome.has(ticket.operationId)) return false;\n if (!this._isEligible(ticket)) return false;\n this._claimedOutcome.set(ticket.operationId, outcome);\n return true;\n }\n\n /** claim 済み outcome (timer が claim → catch が読む等)。未 claim なら undefined。 */\n claimedOutcome(ticket: OperationTicket): TerminalOutcome | undefined {\n return this._claimedOutcome.get(ticket.operationId);\n }\n\n /**\n * operation の後始末。claim 済みなら outcome を確定し、未 claim なら stale-drop。\n * controller を解放し in-flight を減らし、policy の bookkeeping を進める。冪等。\n */\n finalize(ticket: OperationTicket): void {\n const operationId = ticket.operationId;\n // live でなければ確定済み (finalize 済み、または dispose が stale として確定した)。冪等に return —\n // dispose 前の ticket が先へ進むと、新しい owner の in-flight を数え下げてしまう。\n if (!this._attempts.has(operationId)) return;\n // 一度も claim されなかった (supersede で eligibility を失った) なら stale。\n const outcome = this._claimedOutcome.get(operationId) ?? \"stale\";\n this._claimedOutcome.delete(operationId);\n this._releaseController(operationId);\n this._attempts.delete(operationId);\n this._advanceBookkeeping(operationId);\n if (this._trace !== undefined) {\n if (outcome === \"stale\") {\n this._trace({ type: \"io:stale-dropped\", operationId, laneKey: this.laneKey });\n } else {\n this._trace({ type: \"io:operation-settled\", operationId, laneKey: this.laneKey, outcome });\n }\n }\n }\n\n /** operation の signal (resource 解放用)。withSignal でなければ undefined。 */\n signalOf(ticket: OperationTicket): AbortSignal | undefined {\n return this._controllers.get(ticket.operationId)?.signal;\n }\n\n /** best-effort な resource 中断。正しさは owner gen / eligibility / terminal CAS が担う。 */\n abort(ticket: OperationTicket): void {\n this._abortController(ticket.operationId);\n }\n\n /**\n * 現在 active な operation を中断する (利用者による明示キャンセル)。epoch は進めない —\n * 中断された operation は eligibility を保ったまま 'aborted' を claim できる\n * (loading をクリアしつつ in-flight 状態を残す)。\n */\n abortActive(): void {\n if (this._activeOperationId !== undefined) {\n this._abortController(this._activeOperationId);\n }\n for (const operationId of this._activeOperationIds) {\n this._abortController(operationId);\n }\n }\n\n /**\n * dispose (§4.1 world generation)。owner generation を bump して全 ticket を無効化し、\n * 生きている controller を全て abort する。dispose 後に settle した operation は\n * owner gen 不一致で外部 commit しない。retention gate (§10.3) のため live な\n * 全 operation を即時に stale として確定し、controller / attempt を解放する。committing 中の\n * operation も同じ — 残りの setter は owner gen で弾かれ、後の finalize は何もしない (終端の\n * 報告は operation ごとに 1 回、docs/io-node-trace-conformance.md §6.3)。\n */\n disposeOwner(): void {\n this._ownerGeneration += 1;\n for (const operationId of Array.from(this._controllers.keys())) {\n this._abortController(operationId);\n // finalize は dispose 後に early-return するため controller を解放しない。\n // retention gate (§10.3) を満たすためここで明示的に解放する。\n this._releaseController(operationId);\n }\n if (this._trace !== undefined) {\n for (const operationId of this._attempts.keys()) {\n this._trace({ type: \"io:stale-dropped\", operationId, laneKey: this.laneKey });\n }\n }\n this._attempts.clear();\n this._claimedOutcome.clear();\n this._activeOperationId = undefined;\n this._activeOperationIds.clear();\n this._queue.length = 0;\n }\n\n // --- internal ---\n\n private _makeAttempt(operationId: number, attemptNo: number): OperationAttempt {\n let signal: AbortSignal | undefined;\n // AbortController 不在環境(古い runtime / 一部 SSR)では degraded: signal なしで進む。\n // 正しさは owner generation / eligibility / terminal CAS が担うため、native 中断が\n // 無くても supersede / dispose は機能する(best-effort resource 中断が省かれるだけ)。\n if (this._withSignal && typeof AbortController === \"function\") {\n const controller = new AbortController();\n this._controllers.set(operationId, controller);\n signal = controller.signal;\n }\n return { operationId, attempt: attemptNo, signal };\n }\n\n private _isEligible(ticket: OperationTicket): boolean {\n switch (this.policy) {\n case \"latest\":\n return ticket.supersedeEpoch === this._latestEpoch;\n case \"queue\":\n case \"exhaust\":\n return this._activeOperationId === ticket.operationId;\n case \"overlap\":\n return this._activeOperationIds.has(ticket.operationId);\n }\n }\n\n private _advanceBookkeeping(operationId: number): void {\n switch (this.policy) {\n case \"latest\":\n case \"exhaust\":\n if (this._activeOperationId === operationId) {\n this._activeOperationId = undefined;\n }\n break;\n case \"queue\": {\n // 完了した ticket を FIFO から取り除き、次の先頭を active にする。filter で\n // 「先頭 / 非先頭 / 不在」を一様に扱う (finalize は冪等ガードを通った op のみ到達)。\n const remaining = this._queue.filter((t) => t.operationId !== operationId);\n this._queue.length = 0;\n this._queue.push(...remaining);\n this._activeOperationId = this._queue.length > 0 ? this._queue[0].operationId : undefined;\n break;\n }\n case \"overlap\":\n this._activeOperationIds.delete(operationId);\n break;\n }\n }\n\n private _abortController(operationId: number): void {\n const controller = this._controllers.get(operationId);\n if (controller !== undefined && !controller.signal.aborted) {\n controller.abort();\n }\n }\n\n private _releaseController(operationId: number): void {\n this._controllers.delete(operationId);\n }\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /io-core/platform-capability.ts by scripts/sync-io-core.mjs.\n// Run `node scripts/sync-io-core.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * platform-capability.ts\n *\n * Phase 6(docs/architecture-hardening/09-remediation-design.md §7.2 /\n * 07-browser-capability-variance.md)の browser capability 判定と error taxonomy の\n * 汎用プリミティブ。node 固有の capability registry / error code は各パッケージが\n * 別ファイルで宣言し、この汎用層(型 + assess 機構)を import する。\n *\n * 原則:\n * - feature detection は境界(利用直前)で行う。module 評価時に browser global を\n * 参照しない(SSR / worker で import が失敗しない)。\n * - capability ID(`web.fetch` 等)は文字列を global property path として eval せず、\n * registry が ID ごとに副作用のない presence probe を対応付ける。\n * - availability / permission / readiness / activity / operation error を 1 つの\n * `ready / unsupported / error` enum に畳まない。required 欠如は開始しない、\n * optional 欠如は宣言済み fallback で readiness を `degraded` にする。\n *\n * 配置: 本ファイルは /io-core/ の単一正典であり、scripts/sync-io-core.mjs が\n * 各 IO ノードの src/core/ へ生成コピー (AUTO-GENERATED, 編集禁止) を配布する。\n * `protocol/wcBindable.ts` と同じ copy-distribution 方式で、ランタイム依存を導入せず\n * 各パッケージのバンドルへ inline される (zero-runtime-dep / 自己完結 CDN を維持)。\n * 編集はこの正典に対して行い、`node scripts/sync-io-core.mjs` で再配布する。\n *\n * pure(module 評価時に browser global 非参照)。\n */\n\nexport type Availability = \"available\" | \"missing\" | \"unknown\";\nexport type PermissionState = \"granted\" | \"denied\" | \"prompt\" | \"not-applicable\" | \"unknown\";\nexport type Readiness = \"idle\" | \"ready\" | \"degraded\";\nexport type Activity = \"inactive\" | \"active\";\nexport type PreconditionState = \"satisfied\" | \"required\" | \"not-applicable\";\n\n/** operation error の phase(taxonomy)。 */\nexport type WcsIoErrorPhase = \"probe\" | \"start\" | \"execute\" | \"decode\" | \"commit\" | \"dispose\";\n\n/** serializable な error info(non-cloneable な cause とは分離。DevTools / remote へは info のみ)。 */\nexport interface WcsIoErrorInfo {\n readonly code: string;\n readonly phase: WcsIoErrorPhase;\n readonly recoverable: boolean;\n readonly capabilityId?: string;\n readonly message: string;\n}\n\nexport interface PlatformAssessment {\n readonly availability: ReadonlyMap<string, Availability>;\n readonly permission: PermissionState;\n readonly readiness: Readiness;\n readonly activity: Activity;\n readonly preconditions: {\n readonly secureContext: PreconditionState;\n readonly userActivation: PreconditionState;\n };\n readonly epoch: number;\n readonly lastError?: WcsIoErrorInfo;\n}\n\n/** capability 1 件の仕様。probe は副作用なく presence を返す(利用直前に呼ぶ)。 */\nexport interface CapabilitySpec {\n readonly probe: () => boolean;\n readonly requiresSecureContext?: boolean;\n readonly requiresUserActivation?: boolean;\n /** browser compatibility dataset のキー(任意・診断用)。 */\n readonly compatKey?: string;\n}\n\nexport type CapabilityRegistry = ReadonlyMap<string, CapabilitySpec>;\n\nexport interface AssessOptions {\n readonly required: readonly string[];\n readonly optional?: readonly string[];\n readonly permission?: PermissionState;\n readonly activity?: Activity;\n readonly epoch?: number;\n readonly lastError?: WcsIoErrorInfo;\n}\n\nfunction isSecureContext(): boolean {\n return (globalThis as { isSecureContext?: unknown }).isSecureContext === true;\n}\n\n/**\n * capability を利用直前に評価して PlatformAssessment を作る。\n * required が 1 つでも欠ければ readiness は \"idle\"(開始不可)、\n * required 揃い + optional 欠けは \"degraded\"、全揃いは \"ready\"。\n */\nexport function assessCapabilities(registry: CapabilityRegistry, options: AssessOptions): PlatformAssessment {\n const availability = new Map<string, Availability>();\n const evaluate = (id: string): Availability => {\n const spec = registry.get(id);\n if (spec === undefined) return \"unknown\";\n return spec.probe() ? \"available\" : \"missing\";\n };\n\n let requiredAllAvailable = true;\n for (const id of options.required) {\n const a = evaluate(id);\n availability.set(id, a);\n if (a !== \"available\") requiredAllAvailable = false;\n }\n let optionalAllAvailable = true;\n for (const id of options.optional ?? []) {\n const a = evaluate(id);\n availability.set(id, a);\n if (a !== \"available\") optionalAllAvailable = false;\n }\n\n const readiness: Readiness = !requiredAllAvailable ? \"idle\" : (optionalAllAvailable ? \"ready\" : \"degraded\");\n\n // preconditions: 対象 capability のいずれかが要求する場合だけ評価する。\n const allIds = [...options.required, ...(options.optional ?? [])];\n const needsSecure = allIds.some((id) => registry.get(id)?.requiresSecureContext === true);\n const needsActivation = allIds.some((id) => registry.get(id)?.requiresUserActivation === true);\n const secureContext: PreconditionState = needsSecure ? (isSecureContext() ? \"satisfied\" : \"required\") : \"not-applicable\";\n const userActivation: PreconditionState = needsActivation ? \"required\" : \"not-applicable\";\n\n return {\n availability,\n permission: options.permission ?? \"not-applicable\",\n readiness,\n activity: options.activity ?? \"inactive\",\n preconditions: { secureContext, userActivation },\n epoch: options.epoch ?? 0,\n lastError: options.lastError,\n };\n}\n\n/** availability から「required がすべて available か」を判定するヘルパ(supported の最低条件)。 */\nexport function requiredCapabilitiesAvailable(assessment: PlatformAssessment, required: readonly string[]): boolean {\n return required.every((id) => assessment.availability.get(id) === \"available\");\n}\n\n/**\n * このページで機能が使えない理由(使える、または分からないなら null)。利用直前に読む。\n *\n * - `\"insecure-context\"`: 安全なコンテキストではない(`isSecureContext === false`)。\n * Permissions API が扱う機能はどれも安全なコンテキストを要る。\n * - `\"policy-blocked\"`: Permissions-Policy(サーバーのヘッダ、または `allow` の無い\n * `<iframe>`)がその機能を切っている。\n *\n * どちらも Permissions API は教えない: Chromium はポリシーで切られた文書でも\n * `granted` を、安全でない origin では `denied` を返す。利用者の拒否と区別するため、\n * 見張り役(`<wcs-permission>`)も取りに行く側も `unsupported` を報告する\n * (docs/v4-direction-2026-10.md の決定、state-field-report)。\n * `isSecureContext` が無い環境(SSR・テスト)は判断しない。\n */\nexport type FeatureUnavailableReason = \"insecure-context\" | \"policy-blocked\";\n\n/** Permissions-Policy が制御する機能(permission 名と同じ文字列)。 */\nconst POLICY_CONTROLLED = new Set([\n \"camera\", \"microphone\", \"geolocation\", \"midi\", \"clipboard-read\", \"clipboard-write\",\n \"screen-wake-lock\", \"idle-detection\", \"accelerometer\", \"gyroscope\", \"magnetometer\",\n \"ambient-light-sensor\", \"display-capture\",\n]);\n\ninterface PolicyLike { allowsFeature(feature: string): boolean }\n\nexport function featureUnavailable(feature: string): FeatureUnavailableReason | null {\n const g = globalThis as { isSecureContext?: unknown; document?: { permissionsPolicy?: PolicyLike; featurePolicy?: PolicyLike } };\n if (g.isSecureContext === false) return \"insecure-context\";\n if (!POLICY_CONTROLLED.has(feature)) return null;\n const policy = g.document?.permissionsPolicy ?? g.document?.featurePolicy;\n if (policy === undefined || typeof policy.allowsFeature !== \"function\") return null;\n try {\n return policy.allowsFeature(feature) ? null : \"policy-blocked\";\n } catch {\n return null;\n }\n}\n\n/** `featureUnavailable` の理由を、作者が直し方を読める文にする。`what` は文頭(「The camera」など)。 */\nexport function featureUnavailableMessage(what: string, feature: string, reason: FeatureUnavailableReason): string {\n return reason === \"insecure-context\"\n ? `${what} needs a secure context (https:, or http://localhost), and this page is not one.`\n : `${what} is turned off for this page by a Permissions-Policy: the server's Permissions-Policy header, ` +\n `or an <iframe> without allow=\"${feature}\". The browser's site settings cannot change that.`;\n}\n","/**\n * fetchCapabilities.ts\n *\n * fetch node 固有の capability registry と error code。汎用の assess 機構・型は\n * `./platformCapability.js`(/io-core/ から copy-distribution される生成ファイル)から\n * import する。node 固有の宣言はこのハンドライトファイルに置き、生成コピーとは分離する。\n */\n\nimport { CapabilityRegistry, CapabilitySpec } from \"./platformCapability.js\";\n\n/** 安定した fetch error code(taxonomy)。値は公開キーとして固定。 */\nexport const WCS_FETCH_ERROR_CODE = {\n CapabilityMissing: \"capability-missing\",\n InvalidArgument: \"invalid-argument\",\n Network: \"network\",\n HttpError: \"http-error\",\n Timeout: \"timeout\",\n Aborted: \"aborted\",\n} as const;\n\n/** fetch node の capability registry。文字列 ID を eval せず明示 probe を持つ。 */\nexport const FETCH_CAPABILITIES: CapabilityRegistry = new Map<string, CapabilitySpec>([\n [\"web.fetch\", { probe: () => typeof (globalThis as { fetch?: unknown }).fetch === \"function\", compatKey: \"api.fetch\" }],\n [\"web.abort-controller\", { probe: () => typeof (globalThis as { AbortController?: unknown }).AbortController === \"function\", compatKey: \"api.AbortController\" }],\n]);\n","import { IWcBindable } from \"../types.js\";\nimport { OperationLane, OperationTicket } from \"./operationLane.js\";\nimport {\n PlatformAssessment,\n WcsIoErrorInfo,\n WcsIoErrorPhase,\n assessCapabilities,\n requiredCapabilitiesAvailable,\n} from \"./platformCapability.js\";\nimport { FETCH_CAPABILITIES, WCS_FETCH_ERROR_CODE } from \"./fetchCapabilities.js\";\n\nexport type FetchResponseType = \"auto\" | \"json\" | \"text\" | \"blob\" | \"arrayBuffer\";\n\nexport interface FetchRequestOptions {\n method?: string;\n headers?: Record<string, string>;\n body?: BodyInit | null;\n contentType?: string | null;\n forceText?: boolean;\n // How to read the response body. \"auto\" (default) sniffs Content-Type (JSON or\n // text). \"blob\"/\"arrayBuffer\" enable binary downloads; \"blob\" additionally\n // publishes a managed `objectURL`. `forceText` (HTML-replace mode) takes\n // priority over this.\n responseType?: FetchResponseType;\n // Request timeout in ms. When elapsed, the request lane claims a `timeout`\n // terminal, commits a `{ name: \"TimeoutError\" }` error envelope (guarded), then\n // aborts the native request (async-execution-model.md §7 / 09 §5.1). Absent or\n // <= 0 → no timeout (unchanged behaviour, the default).\n timeout?: number;\n}\n\n/** Methods that read only: superseding one loses nothing (RFC 9110 §9.2.1). */\nconst SAFE_METHODS = new Set([\"GET\", \"HEAD\", \"OPTIONS\"]);\n\nexport class FetchCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"value\", event: \"wcs-fetch:response\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.value },\n { name: \"loading\", event: \"wcs-fetch:loading-changed\", semantics: \"state\" },\n { name: \"error\", event: \"wcs-fetch:error\", semantics: \"state\" },\n { name: \"status\", event: \"wcs-fetch:response\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.status },\n // Managed object URL for a `responseType: \"blob\"` response (null otherwise).\n // The Core revokes the previous URL on each new response and on dispose, so\n // a consumer can bind it straight into <img src> without lifecycle glue.\n { name: \"objectURL\", event: \"wcs-fetch:response\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.objectURL },\n // Serializable failure taxonomy (stable code / phase / recoverable), or null.\n // Additive bindable output — the existing `error` property/event are unchanged.\n // Fires on its own `wcs-fetch:error-info-changed` event; no getter, so the\n // bound value is the event detail (mirrors `error` / `loading`).\n { name: \"errorInfo\", event: \"wcs-fetch:error-info-changed\", semantics: \"state\" },\n ],\n inputs: [\n { name: \"url\" },\n { name: \"method\" },\n ],\n commands: [\n { name: \"fetch\", async: true },\n { name: \"abort\" },\n ],\n };\n\n private _target: EventTarget;\n private _value: any = null;\n private _loading: boolean = false;\n private _error: any = null;\n private _status: number = 0;\n private _objectURL: string | null = null;\n private _promise: Promise<any> = Promise.resolve(null);\n // Phase 4 (09-remediation-design.md §5): the request lane. `latest` policy —\n // a new fetch supersedes the in-flight one (switchMap). The lane owns the\n // per-operation AbortController, the owner generation (dispose lifecycle) and\n // the terminal CAS / CommitGuard that decide which completion may write state.\n // This replaces the ad-hoc `_gen` counter + single `_abortController`: a\n // superseded operation now fails the CommitGuard's epoch check instead of\n // relying on a coarse generation recheck, closing the \"completion racing an\n // abort commits stale state\" gap during body reads.\n private _lane = new OperationLane(\"fetch\", \"latest\", { withSignal: true });\n // The request in flight (method and url), to name a change a new request supersedes.\n private _inFlight: { readonly method: string; readonly url: string } | null = null;\n // SSR (§3.8): no asynchronous probe to await, so readiness is immediate.\n private _ready: Promise<void> = Promise.resolve();\n // Phase 6 (§7.2): error taxonomy. The existing `error` property/event shape is\n // unchanged; `errorInfo` projects the serializable WcsIoErrorInfo as an additive\n // wc-bindable output (event `wcs-fetch:error-info-changed`) so DevTools / adopters\n // can classify failures without a breaking change.\n private _errorInfo: WcsIoErrorInfo | null = null;\n\n // Capability IDs (probed at call time, never at module eval / never eval'd as a\n // global path). `web.fetch` required; `web.abort-controller` optional (its\n // absence degrades to a fetch without an abort signal).\n private static readonly REQUIRED_CAPABILITIES = [\"web.fetch\"] as const;\n private static readonly OPTIONAL_CAPABILITIES = [\"web.abort-controller\"] as const;\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n }\n\n get ready(): Promise<void> {\n return this._ready;\n }\n\n // Lifecycle (§3.5). Fetch is command-driven with no subscription to\n // establish, so observe() is an idempotent no-op that resolves once ready;\n // dispose() invalidates any in-flight request and aborts it.\n observe(): Promise<void> {\n return this._ready;\n }\n\n dispose(): void {\n // world generation bump (§4.1): invalidates + aborts every in-flight request.\n this._lane.disposeOwner();\n // Release any outstanding blob object URL on teardown (the other revoke point\n // is _setResponse, which drops the previous URL when a new response arrives).\n if (this._objectURL !== null) {\n this._revokeObjectURL(this._objectURL);\n this._objectURL = null;\n }\n }\n\n get value(): any {\n return this._value;\n }\n\n get loading(): boolean {\n return this._loading;\n }\n\n get error(): any {\n return this._error;\n }\n\n get status(): number {\n return this._status;\n }\n\n get objectURL(): string | null {\n return this._objectURL;\n }\n\n get promise(): Promise<any> {\n return this._promise;\n }\n\n /**\n * The last failure's serializable `WcsIoErrorInfo` (stable `code` / `phase` /\n * `recoverable` / `capabilityId`), or null. Exposed as an additive wc-bindable\n * property (event `wcs-fetch:error-info-changed`); the existing `error`\n * property/event are unchanged.\n */\n get errorInfo(): WcsIoErrorInfo | null {\n return this._errorInfo;\n }\n\n /**\n * Whether the required platform capabilities (`web.fetch`) are available right\n * now — the minimal \"supported\" signal, decided by call-time feature detection,\n * not User-Agent. Additive.\n */\n get supported(): boolean {\n return requiredCapabilitiesAvailable(this.platformAssessment, FetchCore.REQUIRED_CAPABILITIES);\n }\n\n /**\n * Full platform assessment (availability / readiness / preconditions), probed\n * at call time. `readiness` is `degraded` when only the optional\n * `web.abort-controller` is missing. Dev / sidecar view.\n */\n get platformAssessment(): PlatformAssessment {\n return assessCapabilities(FETCH_CAPABILITIES, {\n required: FetchCore.REQUIRED_CAPABILITIES,\n optional: FetchCore.OPTIONAL_CAPABILITIES,\n activity: this._loading ? \"active\" : \"inactive\",\n lastError: this._errorInfo ?? undefined,\n });\n }\n\n private _setErrorInfo(code: string, phase: WcsIoErrorPhase, recoverable: boolean, message: string, capabilityId?: string): void {\n this._commitErrorInfo({ code, phase, recoverable, message, ...(capabilityId === undefined ? {} : { capabilityId }) });\n }\n\n // Single mutation point for `errorInfo`, mirroring `_setError`'s same-value guard\n // and event dispatch so the additive `errorInfo` wc-bindable property stays in sync\n // with `error`. Each failure builds a fresh object (reference guard passes); the\n // clear path passes null (suppresses a redundant null→null per successful fetch).\n private _commitErrorInfo(info: WcsIoErrorInfo | null): void {\n if (this._errorInfo === info) return;\n this._errorInfo = info;\n this._target.dispatchEvent(new CustomEvent(\"wcs-fetch:error-info-changed\", {\n detail: info,\n bubbles: true,\n }));\n }\n\n private _setLoading(loading: boolean): void {\n this._loading = loading;\n this._target.dispatchEvent(new CustomEvent(\"wcs-fetch:loading-changed\", {\n detail: loading,\n bubbles: true,\n }));\n }\n\n private _setError(error: any): void {\n // Same-value guard (async-io-node-guidelines.md §3.3). `error` is state-ish,\n // so suppressing redundant null→null dispatches (every fetch start clears a\n // usually-already-null error) avoids a spurious wcs-fetch:error per successful\n // request. Reference identity is sufficient: each failure builds a fresh\n // object, and the clear path always passes null.\n if (this._error === error) return;\n this._error = error;\n this._target.dispatchEvent(new CustomEvent(\"wcs-fetch:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n private _setResponse(value: any, status: number, objectURL: string | null = null): void {\n // Revoke the previous blob object URL before replacing it. Any new response\n // (success, HTTP error, or network error all funnel through here) supersedes\n // the prior one, so the old URL is no longer needed; this plus dispose()\n // revocation keeps blob downloads leak-free.\n if (this._objectURL !== null) {\n this._revokeObjectURL(this._objectURL);\n }\n this._objectURL = objectURL;\n this._value = value;\n this._status = status;\n this._target.dispatchEvent(new CustomEvent(\"wcs-fetch:response\", {\n detail: { value, status, objectURL },\n bubbles: true,\n }));\n }\n\n // Object URL lifecycle for responseType: \"blob\". The Core owns the blob's\n // object URL (mirrors RecorderCore) so a consumer can bind `objectURL` straight\n // into <img src>/<a href> without managing createObjectURL/revokeObjectURL. Both\n // helpers tolerate environments without URL.createObjectURL (SSR / headless).\n private _createObjectURL(blob: Blob): string | null {\n if (typeof URL !== \"undefined\" && typeof URL.createObjectURL === \"function\") {\n return URL.createObjectURL(blob);\n }\n return null;\n }\n\n private _revokeObjectURL(url: string): void {\n if (typeof URL !== \"undefined\" && typeof URL.revokeObjectURL === \"function\") {\n URL.revokeObjectURL(url);\n }\n }\n\n abort(): void {\n // Explicit user cancel: abort the active operation WITHOUT advancing the lane\n // epoch, so the aborted operation stays eligible and its AbortError branch may\n // commit loading=false (leaving the in-flight value/status). A superseding\n // fetch() instead advances the epoch (via the lane's begin()), which makes the\n // predecessor ineligible so its abort commits nothing (loading does not flicker).\n this._lane.abortActive();\n }\n\n // Run one guarded commit step (§5.1). The CommitGuard is re-checked before every\n // setter because a setter that synchronously dispatches an event can supersede\n // the same lane; an invalidation between setters stops the remaining commits\n // without rolling back what already fired.\n private _commitStep(ticket: OperationTicket, step: () => void): void {\n if (this._lane.canCommit(ticket)) {\n step();\n }\n }\n\n async fetch(url: string, options: FetchRequestOptions = {}): Promise<any> {\n // never-throw (§3.6): 引数バリデーション失敗は例外ではなく error プロパティに\n // 流し、サニタイズ値(null)を返す。command-token 経路からの呼び出しが unhandled\n // rejection にならず、「fetch() は全終了ケースで resolve」契約とも整合する。\n if (!url) {\n // Existing `error` shape is unchanged (§7.2 / 07 §互換性); the taxonomy is\n // projected only through the additive `errorInfo`.\n this._setErrorInfo(WCS_FETCH_ERROR_CODE.InvalidArgument, \"start\", false, \"url attribute is required.\");\n this._setError({ message: \"url attribute is required.\" });\n return null;\n }\n\n // Phase 6 (§7.2): probe required capabilities just before starting. If the\n // `web.fetch` API is absent (SSR / headless / very old runtime), do NOT start\n // the operation — surface a stable `capability-missing` taxonomy without\n // attempting the call (and without the generic network-error path).\n const assessment = this.platformAssessment;\n if (!requiredCapabilitiesAvailable(assessment, FetchCore.REQUIRED_CAPABILITIES)) {\n const missing = FetchCore.REQUIRED_CAPABILITIES.find((id) => assessment.availability.get(id) !== \"available\");\n this._setErrorInfo(WCS_FETCH_ERROR_CODE.CapabilityMissing, \"start\", false, `Required capability \"${missing}\" is unavailable.`, missing);\n this._setError({ message: `Required capability \"${missing}\" is unavailable.` });\n return null;\n }\n\n const p = this._doFetch(url, options);\n this._promise = p;\n return p;\n }\n\n private async _doFetch(url: string, options: FetchRequestOptions): Promise<any> {\n // Issue a lane ticket. For the `latest` policy this advances the epoch and\n // aborts the previous in-flight request (supersede), returning a ticket +\n // attempt whose `signal` is the lane-owned AbortController for this operation.\n // `attempt.signal` is undefined when `web.abort-controller` is missing\n // (degraded): the request runs without a native abort signal.\n //\n // Superseding is by design, and a superseded read loses nothing. A superseded\n // change does: it is aborted on the client (the server may or may not have\n // applied it) and its response is dropped, without a word. Say so, naming it\n // (docs/mistake-catalogue.md, \"fetch-superseded-mutation\").\n const previous = this._inFlight;\n if (previous !== null && !SAFE_METHODS.has(previous.method)) {\n console.warn(\n `[@wcstack/fetch] [wcs/fetch-request-superseded] A ${previous.method} request to \"${previous.url}\" ` +\n `was still in flight when another request started on the same element: it was aborted and its ` +\n `response dropped (the server may have applied it). Give each change its own <wcs-fetch>, or wait ` +\n `for loading to end before starting the next request.`,\n );\n }\n const started = this._lane.begin();\n // `latest` begin never returns null (exhaust is the only rejecting policy).\n const { ticket, attempt } = started!;\n const signal = attempt.signal;\n const current = { method: String(options.method ?? \"GET\").toUpperCase(), url };\n this._inFlight = current;\n\n this._commitStep(ticket, () => this._setLoading(true));\n this._commitStep(ticket, () => { this._commitErrorInfo(null); this._setError(null); });\n\n const {\n method = \"GET\",\n body = null,\n contentType = null,\n forceText = false,\n responseType = \"auto\",\n timeout = 0,\n } = options;\n\n // Timeout terminal (§5.1 / §7): a timer claims the `timeout` outcome via the\n // same terminal CAS as success/error, commits a guarded TimeoutError, THEN\n // aborts the native request and releases the lane — never \"invalidate first\".\n // A completion that arrives after the timer loses the CAS and writes nothing.\n let timeoutTimer: ReturnType<typeof setTimeout> | null = null;\n if (timeout > 0) {\n timeoutTimer = setTimeout(() => {\n if (!this._lane.claimTerminal(ticket, \"timeout\")) return;\n const message = `Request timed out after ${timeout}ms.`;\n this._commitStep(ticket, () => {\n this._setErrorInfo(WCS_FETCH_ERROR_CODE.Timeout, \"execute\", true, message);\n this._setError({ name: \"TimeoutError\", message });\n });\n this._commitStep(ticket, () => this._setResponse(null, 0));\n this._commitStep(ticket, () => this._setLoading(false));\n this._lane.abort(ticket);\n this._lane.finalize(ticket);\n }, timeout);\n }\n\n // Copy the caller's headers so the contentType injection below never mutates\n // the object passed in by a headless consumer (the Shell already builds a\n // fresh object, but direct FetchCore users may reuse theirs).\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n\n try {\n if (contentType && !headers[\"Content-Type\"]) {\n headers[\"Content-Type\"] = contentType;\n }\n\n const requestInit: RequestInit = {\n method,\n headers,\n signal,\n };\n\n if (method !== \"GET\" && method !== \"HEAD\" && body !== null) {\n requestInit.body = body;\n }\n\n const response = await globalThis.fetch(url, requestInit);\n\n // Read the body first, then atomically claim the terminal at the commit\n // point. Claiming AFTER the body read closes the stale-write race: a fetch\n // that was superseded (or timed out) during the body read fails the\n // CommitGuard's epoch/CAS check and writes nothing, even if the body still\n // resolved. HEAD carries no body by spec.\n let value: any = null;\n if (method === \"HEAD\") {\n // HEAD responses carry no body — reading it would throw a parse error.\n } else if (!response.ok) {\n // HTTP error: read the body text for the error envelope. Handled below.\n } else if (forceText) {\n // HTML-replace mode (the Shell sets forceText when `target` is present)\n // always reads text and takes priority over responseType.\n value = await response.text();\n } else if (responseType === \"blob\") {\n // Only buffer the Blob here; the managed object URL is created AFTER the\n // terminal claim wins (below). Creating it before the claim would leak a\n // blob: URL when this operation loses the claim (supersede / timeout /\n // dispose during the body read) — it would never reach _setResponse and\n // never be revoked.\n value = await response.blob();\n } else if (responseType === \"arrayBuffer\") {\n value = await response.arrayBuffer();\n } else if (responseType === \"text\") {\n value = await response.text();\n } else if (responseType === \"json\") {\n value = await response.json();\n } else {\n // \"auto\" (default): sniff Content-Type — JSON when it says so, else text.\n const responseContentType = response.headers.get(\"Content-Type\") || \"\";\n if (responseContentType.includes(\"application/json\")) {\n value = await response.json();\n } else {\n value = await response.text();\n }\n }\n\n if (!response.ok) {\n const errorBody = await response.text().catch(() => \"\");\n const error = { status: response.status, statusText: response.statusText, body: errorBody };\n if (!this._lane.claimTerminal(ticket, \"error\")) {\n return null;\n }\n this._commitStep(ticket, () => {\n this._setErrorInfo(WCS_FETCH_ERROR_CODE.HttpError, \"execute\", true, `HTTP ${response.status} ${response.statusText}`);\n this._setError(error);\n });\n // Notify `status` observers on HTTP errors too. The `status` property is\n // surfaced via the `wcs-fetch:response` event (getter reads detail.status),\n // so without dispatching it here a bind() subscriber would never see the\n // error status (404, 500, ...). `value` is reset to null on error.\n this._commitStep(ticket, () => this._setResponse(null, response.status));\n this._commitStep(ticket, () => this._setLoading(false));\n return null;\n }\n\n if (!this._lane.claimTerminal(ticket, \"success\")) {\n return null;\n }\n // Create the blob object URL only now that this operation owns the terminal,\n // so a dropped operation never allocates one (leak-free). HEAD/non-blob keep\n // value non-Blob → objectURL stays null.\n const objectURL = value instanceof Blob ? this._createObjectURL(value) : null;\n this._commitStep(ticket, () => this._setResponse(value, response.status, objectURL));\n this._commitStep(ticket, () => this._setLoading(false));\n return this._value;\n } catch (e: any) {\n if (e && e.name === \"AbortError\") {\n // AbortError with a still-eligible ticket is an explicit user abort() of\n // the current request: claim the `aborted` terminal and clear loading,\n // leaving the in-flight value/status untouched. A superseding fetch or\n // dispose() advanced the epoch / owner generation, so their predecessors\n // fail the claim (return without writing = stale-drop). A timeout already\n // claimed the terminal in its timer, so this branch also no-ops there.\n if (this._lane.claimTerminal(ticket, \"aborted\")) {\n this._commitStep(ticket, () => this._setLoading(false));\n }\n return null;\n }\n // Network error. A superseded/disposed request fails the claim and drops.\n if (!this._lane.claimTerminal(ticket, \"error\")) {\n return null;\n }\n this._commitStep(ticket, () => {\n const message = String(e?.message ?? \"Network request failed.\");\n this._setErrorInfo(WCS_FETCH_ERROR_CODE.Network, \"execute\", true, message);\n // Coalesce a falsy rejection (Promise.reject(null)/throw null) to a non-null\n // envelope so the `error` same-value guard (cleared to null at start) cannot\n // suppress a genuine terminal error — keeping `error`/`wcs-fetch:error` in sync\n // with `errorInfo`. Truthy errors (real TypeErrors) pass through unchanged.\n this._setError(e ?? { message });\n });\n // Reset value/status on network errors too, mirroring the HTTP-error path.\n // Without this, a prior successful request's value/status would linger while\n // `error` is non-null. status=0 is the web-platform convention for \"no HTTP\n // response\" (matches XMLHttpRequest.status on network failure).\n this._commitStep(ticket, () => this._setResponse(null, 0));\n this._commitStep(ticket, () => this._setLoading(false));\n return null;\n } finally {\n if (this._inFlight === current) this._inFlight = null;\n if (timeoutTimer !== null) {\n clearTimeout(timeoutTimer);\n }\n // Release the operation (identity-safe: keyed by operationId, so a\n // late-settling superseded request never disarms the successor). Idempotent\n // with the timeout timer's own finalize().\n this._lane.finalize(ticket);\n }\n }\n}\n","import { config } from \"./config.js\";\nimport type { Fetch } from \"./components/Fetch.js\";\n\nlet registered = false;\n\nfunction handleClick(event: Event): void {\n const target = event.target;\n if (!(target instanceof Element)) return;\n\n const triggerElement = target.closest<Element>(`[${config.triggerAttribute}]`);\n if (!triggerElement) return;\n\n const fetchId = triggerElement.getAttribute(config.triggerAttribute);\n if (!fetchId) return;\n\n // Resolve the registered constructor at call time instead of importing Fetch\n // as a value. The value import created a components/Fetch.ts ⇄ autoTrigger.ts\n // cycle (Fetch.connectedCallback() calls registerAutoTrigger()). instanceof\n // against the customElements registry keeps the exact same identity guarantee\n // — only the registered <wcs-fetch> class matches — without the import cycle.\n const FetchCtor = customElements.get(config.tagNames.fetch);\n const el = document.getElementById(fetchId);\n if (!FetchCtor || !(el instanceof FetchCtor)) return;\n const fetchElement = el as Fetch;\n\n // Skip when the target has no url. fetch() is fire-and-forget here (its returned\n // promise is intentionally not awaited), and FetchCore.fetch() rejects synchronously\n // on an empty url. Without this guard that rejection would surface as an unhandled\n // promise rejection. Treat a url-less target as \"nothing to do\", consistent with the\n // other early returns above.\n if (!fetchElement.url) return;\n\n // Suppress the element's default action so a fetch can fire without navigating.\n // Intentional: do not attach data-fetchtarget to an element whose default action\n // you also want (real <a href> link, form-submit button) — it will be cancelled.\n // See README \"Optional DOM Triggering\".\n event.preventDefault();\n fetchElement.fetch();\n}\n\nexport function registerAutoTrigger(): void {\n if (registered) return;\n registered = true;\n document.addEventListener(\"click\", handleClick);\n}\n\nexport function unregisterAutoTrigger(): void {\n if (!registered) return;\n registered = false;\n document.removeEventListener(\"click\", handleClick);\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/upgrade-properties.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n// custom element の property upgrade — `static wcBindable.inputs` に宣言した入力のうち、\n// 要素が upgrade される前に代入された own データプロパティを取り込み直す。\n//\n// なぜ必要か:\n// 未定義タグの要素は素の HTMLElement なので、`el.url = \"...\"` は own データプロパティを作る。\n// upgrade 後にクラスの accessor が prototype へ入っても own プロパティが優先されるため、\n// setter は二度と呼ばれず、値は要素へ届かないまま消える(エラーも警告も出ない)。\n// 常にプロパティ代入を行う framework(Angular の `[prop]`、Lit の `.prop=`、\n// Solid の `prop:`、Vue の `.prop` 修飾子)× 遅延定義(autoloader / CDN / code-split)で\n// 常態的に起きる。docs/architecture-hardening/13-framework-adapter-binding-constraints.md §1.2。\n//\n// 安全側の判定:\n// own プロパティがあっても、prototype チェーンに accessor が無ければ「シャドウ」ではなく\n// その own プロパティ自体が正規の格納先なので触らない(public class field を壊さない)。\n//\n// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/upgrade-properties.ts), then run\n// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies\n// (packages/<pkg>/src/protocol/upgradeProperties.ts). Those copies are generated — do not edit them.\nimport { IWcBindable } from \"./wcBindable.js\";\n\nfunction hasAccessorOnPrototype(target: object, name: string): boolean {\n let proto = Object.getPrototypeOf(target);\n while (proto !== null) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, name);\n if (descriptor !== undefined) {\n return typeof descriptor.get === \"function\" || typeof descriptor.set === \"function\";\n }\n proto = Object.getPrototypeOf(proto);\n }\n return false;\n}\n\n// 属性になってしまったオブジェクトの入力(`files=\"[object File]\"`)を、要素ごとに 1 回だけ言う。\n// React 19 は定義前の要素にプロパティが無いのでオブジェクトを属性に書き、Vue の `.attr` も\n// 書く。要素はその入力をプロパティでしか読まないので、何も受け取らず、何も言わなかった\n// (docs/seam-apps.md、fw-inventory)。\nconst toldObjectAttribute = new WeakSet<object>();\n\nfunction warnObjectAttribute(element: object, name: string, value: string): void {\n if (toldObjectAttribute.has(element)) return;\n toldObjectAttribute.add(element);\n const tag = (element as { localName?: string }).localName ?? \"element\";\n console.warn(\n `[wcs/input-as-attribute] <${tag}> has the attribute ${name}=\"${value}\": an object was written as an ` +\n `attribute, so the element did not receive it. A framework does that when the property is set before the ` +\n `element's definition loads (React 19), or when told to (Vue's .attr). Load the definition before rendering, ` +\n `or assign the property through a ref (Vue: .prop). (Said once per element.)`,\n element,\n );\n}\n\n/**\n * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で\n * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。\n *\n * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。\n * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。\n * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。\n * - 値が `[object …]` の属性(属性に書かれてしまったオブジェクトの入力)は、要素ごとに 1 回警告する。\n */\nexport function upgradeProperties(element: object): void {\n const declaration = (element as { constructor?: { wcBindable?: IWcBindable } }).constructor?.wcBindable;\n const inputs = declaration?.inputs;\n if (inputs === undefined) return;\n const getAttribute = (element as { getAttribute?: (name: string) => string | null }).getAttribute;\n for (const input of inputs) {\n const name = input.name;\n const attribute = typeof getAttribute === \"function\" ? getAttribute.call(element, name.toLowerCase()) : null;\n if (attribute !== null && attribute.startsWith(\"[object \")) warnObjectAttribute(element, name, attribute);\n if (!Object.prototype.hasOwnProperty.call(element, name)) continue;\n if (!hasAccessorOnPrototype(element, name)) continue;\n const record = element as Record<string, unknown>;\n const value = record[name];\n delete record[name];\n record[name] = value;\n }\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/input-attribute.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n// 属性へ反映する wc-bindable 入力の producer 側(SPEC-extensions § Producer guidance for inputs の P1〜P3)。\n// 入力の setter は属性をこの 2 関数で書く。それで次が揃う:\n// - `undefined` は「値が無い」(P1): 属性を、この関数で最初に書く前の状態 — マークアップに書かれた値、\n// 無ければ属性なし(= その入力の文書化した既定値)— へ戻す。applier プロファイルを宣言する binder は\n// 値の後の `undefined` を書き(A2)、React 19 も書き、直接の代入でも届く。\n// - `null` はクリア(P2): 属性なし、つまり文書化した既定値。\n// - どちらも文字列 \"undefined\" / \"null\" として属性に入らない。\n//\n// 「最初に書く前」は、その最初の書き込みのときに読む(遅延)。upgrade 前に代入されたプロパティは\n// connectedCallback の upgradeProperties() が通し直すので、そのときにはパーサが書いた属性が揃っている。\n// 要素自身が setter を通さずに書いた属性は、最初の書き込みより前なら「最初の状態」に含まれる。\n//\n// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/input-attribute.ts), then run\n// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies\n// (packages/<pkg>/src/protocol/inputAttribute.ts). Those copies are generated — do not edit them.\n\nconst initialAttributes = new WeakMap<Element, Map<string, string | null>>();\n\n/** The attribute as it stood before the first write through these helpers. */\nfunction initialAttribute(el: Element, name: string): string | null {\n let byName = initialAttributes.get(el);\n if (byName === undefined) {\n byName = new Map();\n initialAttributes.set(el, byName);\n }\n if (!byName.has(name)) byName.set(name, el.getAttribute(name));\n return byName.get(name) as string | null;\n}\n\nfunction writeAttribute(el: Element, name: string, value: string | null): void {\n if (value === null) el.removeAttribute(name);\n else el.setAttribute(name, value);\n}\n\n/**\n * A value attribute. `value` is written as `String(value)`; `null` removes the attribute;\n * `undefined` restores the attribute the element started with.\n */\nexport function reflectAttribute(el: Element, name: string, value: unknown): void {\n const initial = initialAttribute(el, name);\n writeAttribute(el, name, value === undefined ? initial : value === null ? null : String(value));\n}\n\n/**\n * A boolean attribute, present while `value` is truthy (`null` and `false` remove it);\n * `undefined` restores the attribute the element started with.\n */\nexport function reflectBooleanAttribute(el: Element, name: string, value: unknown): void {\n const initial = initialAttribute(el, name);\n writeAttribute(el, name, value === undefined ? initial : value ? \"\" : null);\n}\n","/**\n * Trusted Types (`require-trusted-types-for 'script'`) 対応。正本は docs/csp.md §7。\n *\n * `<wcs-fetch target=\"...\">` の HTML 置換モードが innerHTML に流すのは **レスポンス**\n * = TT がまさに止めたい値そのもの。ここに identity policy を噛ませて通すのは\n * 「TT 対応」ではなく「TT の無効化」なので、fetch は自前の policy を作らない。\n * Angular が DomSanitizer を必須にしているのと同じ立て付けで、利用側が sanitizer を\n * 持つ policy を注入したときだけ通す。\n *\n * 注入口は全 @wcstack パッケージ共通のグローバルスロット。buildless(CDN 一発)でも\n * inline script 1 本で差し込める:\n *\n * ```js\n * globalThis[Symbol.for(\"wcstack.trustedTypes.policy\")] =\n * trustedTypes.createPolicy(\"my-app\", { createHTML: (s) => DOMPurify.sanitize(s) });\n * ```\n *\n * policy があるときは TT 非対応ブラウザでも通す。sanitizer が Chromium でだけ効いて\n * Firefox では素通し、という差が出るほうが危ないため。\n */\n\nexport interface IWcsTrustedTypesPolicy {\n createHTML?(input: string): unknown;\n createScriptURL?(input: string): unknown;\n}\n\n/** 利用側が policy を差し込むグローバルスロット(全 @wcstack パッケージ共通)。 */\nexport const TRUSTED_TYPES_POLICY_SLOT = Symbol.for(\"wcstack.trustedTypes.policy\");\n\ntype SymbolSlotHolder = { [key: symbol]: unknown };\n\n/** 利用側が注入した policy。fetch は identity policy にフォールバックしない。 */\nexport function getTrustedTypesPolicy(): IWcsTrustedTypesPolicy | null {\n const value = (globalThis as SymbolSlotHolder)[TRUSTED_TYPES_POLICY_SLOT];\n if (value === null || typeof value !== \"object\") return null;\n return value as IWcsTrustedTypesPolicy;\n}\n\n/** 利用側 policy を設定する(`null` で解除)。 */\nexport function setTrustedTypesPolicy(policy: IWcsTrustedTypesPolicy | null): void {\n (globalThis as SymbolSlotHolder)[TRUSTED_TYPES_POLICY_SLOT] = policy;\n}\n\n/**\n * レスポンスを利用側 policy に通す。policy が無ければ素通し= TT 有効下では\n * ブラウザが弾く(意図どおり)。\n */\nexport function trustHtmlValue(value: unknown): unknown {\n if (typeof value !== \"string\") return value;\n const policy = getTrustedTypesPolicy();\n const createHTML = policy?.createHTML;\n if (typeof createHTML !== \"function\") return value;\n return createHTML.call(policy, value);\n}\n\nlet _enforced: boolean | undefined = undefined;\nlet _reported = false;\n\n/** テスト用: 実測キャッシュと一度きりの診断をリセットする。 */\nexport function _resetTrustedTypesDiagnostics(): void {\n _enforced = undefined;\n _reported = false;\n}\n\n/**\n * TT が実際に強制されているかを実測する。エラーメッセージの文言に依存しないよう、\n * 使い捨ての要素へ実際に書いて確かめる。`default` policy がある場合は書き込みが\n * 通る=我々の書き込みも通るので、正しく false になる。\n */\nexport function isTrustedTypesEnforced(): boolean {\n if (_enforced !== undefined) return _enforced;\n if (!(\"trustedTypes\" in globalThis)) {\n _enforced = false;\n return _enforced;\n }\n try {\n document.createElement(\"div\").innerHTML = \"<i></i>\";\n _enforced = false;\n } catch {\n _enforced = true;\n }\n return _enforced;\n}\n\n// 呼び出し元(writeTargetHTML)が isTrustedTypesEnforced() を確認してから呼ぶ。\nfunction reportTrustedTypesBlock(): void {\n if (_reported) return;\n _reported = true;\n const hasPolicy = typeof getTrustedTypesPolicy()?.createHTML === \"function\";\n const cause = hasPolicy\n ? \"The injected policy's createHTML() did not return a TrustedHTML.\"\n : \"No sanitizing policy is installed, and @wcstack/fetch deliberately does not pass \"\n + \"responses through an identity policy — that would defeat the CSP.\";\n console.error(\n `[@wcstack/fetch] The \"target\" HTML replace mode was blocked by Trusted Types `\n + `(require-trusted-types-for 'script'). ${cause}\\n`\n + `Install a sanitizing policy before the first fetch:\\n`\n + ` globalThis[Symbol.for(\"wcstack.trustedTypes.policy\")] =\\n`\n + ` trustedTypes.createPolicy(\"my-app\", { createHTML: (s) => DOMPurify.sanitize(s) });\\n`\n + `Or drop \"target\" and bind the response through @wcstack/state. See docs/csp.md section 7.`,\n );\n}\n\n/**\n * HTML 置換モードの書き込み。\n *\n * TT に弾かれたときは直し方を 1 度だけ報告して**投げ返さない**(never-throw §3.6)。\n * 自動 fetch 経路(connect / url 変更 / trigger)は `fetch()` の rejection を受け取る先が\n * 無く、投げ返すと未処理 rejection として page error になる — 実 Chromium の e2e で\n * 確認した。報告が信号であり、黙って握り潰すのとは違う。TT 以外の失敗(innerHTML の\n * setter が別の理由で throw した等)は従来どおり呼び出し元へ投げ返す。\n */\nexport function writeTargetHTML(element: Element, html: unknown): void {\n try {\n element.innerHTML = trustHtmlValue(html) as string;\n } catch (error) {\n if (isTrustedTypesEnforced()) {\n reportTrustedTypesBlock();\n return;\n }\n throw error;\n }\n}\n","import { config } from \"../config.js\";\nimport { IWcBindable } from \"../types.js\";\nimport { FetchCore, FetchResponseType } from \"../core/FetchCore.js\";\nimport { WcsIoErrorInfo } from \"../core/platformCapability.js\";\nimport { FetchHeader } from \"./FetchHeader.js\";\nimport { FetchBody } from \"./FetchBody.js\";\nimport { registerAutoTrigger } from \"../autoTrigger.js\";\nimport { upgradeProperties } from \"../protocol/upgradeProperties.js\";\nimport { reflectAttribute, reflectBooleanAttribute } from \"../protocol/inputAttribute.js\";\nimport { writeTargetHTML } from \"../trustedTypes.js\";\n\nexport class Fetch extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n /** It reports the request it has in flight (pendingPromise): a server render waits for it. */\n static hasPendingPromise = true;\n static wcBindable: IWcBindable = {\n ...FetchCore.wcBindable,\n properties: [\n ...FetchCore.wcBindable.properties,\n { name: \"trigger\", event: \"wcs-fetch:trigger-changed\", semantics: \"state\" },\n ],\n // Shell-level input surface. The Core declares only the portable `url` / `method`;\n // the Shell adds the DOM-driven settable surface. No `attribute` hints are given:\n // these setters reflect to their attributes themselves, and a binding system that\n // mirrored inputs[].attribute (@wcstack/state 3.x) would set the attribute twice. `commands`\n // (fetch / abort) are inherited unchanged from the Core via the spread above.\n inputs: [\n { name: \"url\" },\n { name: \"method\" },\n { name: \"target\" },\n { name: \"manual\" },\n { name: \"body\" },\n { name: \"responseType\" },\n { name: \"trigger\" },\n ],\n };\n static get observedAttributes(): string[] { return [\"url\"]; }\n\n private _core: FetchCore;\n private _body: any = null;\n private _trigger: boolean = false;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n // Auto-fetch coalescing state (see _scheduleAutoFetch).\n private _autoPending: boolean = false;\n private _connectResolve: (() => void) | null = null;\n private _lastFetchedUrl: string | null = null;\n private _toldTriggerWithoutUrl = false;\n private _toldUndefinedHelper = false;\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n // State reflection is wired BEFORE the Core is constructed (canonical\n // order): a Core that dispatches synchronously from its constructor\n // (e.g. speech's unsupported-changed) would otherwise fire before the\n // listeners exist. FetchCore doesn't do that, so this is equivalent here,\n // but every Shell keeps the same order.\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-fetch:loading-changed\": (d) => ({ loading: d === true }),\n \"wcs-fetch:error\": (d) => ({ error: d != null }),\n });\n this._core = new FetchCore(this);\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (async-io-node-guidelines.md §3.6): attachInternals is absent\n // in happy-dom / older environments, and pre-125 Chromium rejects\n // non-dashed state names from states.add() (probed and discarded here).\n // Either case silently disables reflection — the component still works,\n // it just doesn't expose :state() selectors.\n try {\n if (typeof this.attachInternals !== \"function\") return null;\n const internals = this.attachInternals();\n internals.states.add(\"wcs-probe\");\n internals.states.delete(\"wcs-probe\");\n return internals;\n } catch {\n return null;\n }\n }\n\n private _wireStates(map: Record<string, (detail: any) => Record<string, boolean>>): void {\n if (this._internals === null) return;\n const states = this._internals.states;\n for (const [event, toStates] of Object.entries(map)) {\n this.addEventListener(event, (e) => {\n const debug = this.hasAttribute(\"debug-states\");\n for (const [name, on] of Object.entries(toStates((e as CustomEvent).detail))) {\n try {\n if (on) { states.add(name); } else { states.delete(name); }\n } catch { /* never-throw */ }\n if (debug) this.toggleAttribute(`data-wcs-state-${name}`, on);\n }\n });\n }\n }\n\n // Input setters never let setAttribute stringify null / undefined (\"undefined\"\n // url would auto-fetch /undefined, \"undefined\" method is an invalid HTTP\n // method): `null` removes the attribute (the default), `undefined` restores\n // the attribute the element started with (wc-bindable producer guidance P1;\n // React 19 and a direct assignment deliver it, @wcstack/state does not).\n get url(): string {\n return this.getAttribute(\"url\") || \"\";\n }\n\n set url(value: string | null | undefined) {\n reflectAttribute(this, \"url\", value);\n }\n\n get method(): string {\n return (this.getAttribute(\"method\") || \"GET\").toUpperCase();\n }\n\n set method(value: string | null | undefined) {\n reflectAttribute(this, \"method\", value);\n }\n\n get target(): string | null {\n return this.getAttribute(\"target\");\n }\n\n set target(value: string | null | undefined) {\n reflectAttribute(this, \"target\", value);\n }\n\n // Response body interpretation. Backed by the `response-type` attribute so it is\n // settable from HTML, JS, or a binding. An unknown value falls through to the\n // Core's \"auto\" branch. `target` (HTML-replace mode) overrides this.\n get responseType(): FetchResponseType {\n return (this.getAttribute(\"response-type\") as FetchResponseType) || \"auto\";\n }\n\n set responseType(value: string | null | undefined) {\n reflectAttribute(this, \"response-type\", value);\n }\n\n get value(): any {\n return this._core.value;\n }\n\n get loading(): boolean {\n return this._core.loading;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get status(): number {\n return this._core.status;\n }\n\n get objectURL(): string | null {\n return this._core.objectURL;\n }\n\n get errorInfo(): WcsIoErrorInfo | null {\n return this._core.errorInfo;\n }\n\n get promise(): Promise<any> {\n return this._core.promise;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n /**\n * The readiness protocol's pending work (`static hasPendingPromise`): the request this element\n * has in flight, or is about to start (an auto-fetch waits a microtask), settled either way; null\n * when there is none. A server render waits for it, so a request a binding started — a `url`\n * written from state after the element connected — is in the page it serializes\n * (@wcstack/server; docs/v4-direction-2026-10.md §5.1).\n */\n get pendingPromise(): Promise<void> | null {\n if (this._autoPending && !this.manual && this.url) return Promise.resolve().then(() => this.pendingPromise ?? undefined);\n // (FetchCore settles a failed request too: it rejects only on an empty url)\n return this.loading ? this._core.promise.then(() => undefined) : null;\n }\n\n get manual(): boolean {\n return this.hasAttribute(\"manual\");\n }\n\n set manual(value: boolean | null | undefined) {\n reflectBooleanAttribute(this, \"manual\", value);\n }\n\n get body(): any {\n return this._body;\n }\n\n set body(value: any) {\n // Normalize undefined to null: _collectBody treats \"!== null\" as \"body was\n // provided\", so a raw undefined would serialize as a JSON request body.\n this._body = value ?? null;\n }\n\n get trigger(): boolean {\n return this._trigger;\n }\n\n set trigger(value: boolean) {\n const v = !!value;\n if (v) {\n // Skip when url is empty. fetch() is fire-and-forget here (its returned\n // promise is intentionally only chained with .finally() to reset the flag,\n // never .catch()'d), and FetchCore.fetch() rejects on an empty url. Without\n // this guard that rejection — re-thrown by .finally() — surfaces as an\n // unhandled promise rejection. Mirrors the url-less guard in autoTrigger.\n //\n // Leave `_trigger` false (do not set it) and emit no event: nothing ran, so\n // surfacing a `wcs-fetch:trigger-changed` \"completion\" would lie to observers.\n // Keeping the flag false also avoids stalling — once url is provided, writing\n // `true` again is a real false→true transition that triggers the fetch.\n if (!this.url) {\n this._warnTriggerWithoutUrl();\n return;\n }\n this._trigger = true;\n this.fetch().finally(() => {\n this._trigger = false;\n this.dispatchEvent(new CustomEvent(\"wcs-fetch:trigger-changed\", {\n detail: false,\n bubbles: true,\n }));\n });\n }\n }\n\n private _collectHeaders(): Record<string, string> {\n const headers: Record<string, string> = {};\n const headerElements = this.querySelectorAll<FetchHeader>(config.tagNames.fetchHeader);\n for (const el of headerElements) {\n if (typeof el.hasHeader !== \"boolean\") {\n this._warnUndefinedHelper(config.tagNames.fetchHeader, \"header\");\n continue;\n }\n // a header without a value attribute is not sent (FetchHeader)\n if (el.hasHeader) {\n headers[el.headerName] = el.headerValue;\n }\n }\n return headers;\n }\n\n // fetch がネイティブに扱える BodyInit か判定する。これらは JSON.stringify せず\n // 素通しし、Content-Type をブラウザに委ねる (FormData の multipart boundary、\n // Blob の type、URLSearchParams の application/x-www-form-urlencoded を自動付与\n // させるため、_collectBody は contentType に null を返す)。ReadableStream は\n // RequestInit.duplex: 'half' を要するため初版では対象外とし、従来どおり扱う。\n private _isNativeBodyInit(value: unknown): value is BodyInit {\n return value instanceof Blob // File は Blob のサブクラス\n || value instanceof FormData\n || value instanceof URLSearchParams\n || value instanceof ArrayBuffer\n || ArrayBuffer.isView(value); // TypedArray / DataView\n }\n\n private _collectBody(bodySnapshot: any): { body: BodyInit | null; contentType: string | null } {\n // JS API経由のbodyが優先\n if (bodySnapshot !== null) {\n // 文字列はそのまま。Content-Type はユーザーのヘッダ指定に委ねる。\n if (typeof bodySnapshot === \"string\") {\n return { body: bodySnapshot, contentType: null };\n }\n // ネイティブ BodyInit (Blob/File/FormData/URLSearchParams/ArrayBuffer/TypedArray)\n // は素通し。Content-Type はブラウザに委ねるため null を返す。\n if (this._isNativeBodyInit(bodySnapshot)) {\n return { body: bodySnapshot, contentType: null };\n }\n // それ以外のオブジェクトは JSON 化する。\n return { body: JSON.stringify(bodySnapshot), contentType: \"application/json\" };\n }\n\n // サブタグからbodyを取得\n const bodyElement = this.querySelector<FetchBody>(config.tagNames.fetchBody);\n if (bodyElement && typeof bodyElement.bodyContent !== \"string\") {\n this._warnUndefinedHelper(config.tagNames.fetchBody, \"body\");\n } else if (bodyElement) {\n return {\n body: bodyElement.bodyContent || null,\n contentType: bodyElement.contentType,\n };\n }\n\n return { body: null, contentType: null };\n }\n\n abort(): void {\n this._core.abort();\n }\n\n /**\n * Coalesce auto-fetch requests in the current task into a single microtask.\n *\n * Multiple synchronous input writes in the same tick — e.g. a `...` spread\n * writing `url` before `manual` — collapse into one decision made against the\n * FINAL element state, so the spread application order can no longer trigger a\n * stray fetch. The microtask re-reads `isConnected` / `manual` / `url` at fire\n * time; whatever was written last wins.\n *\n * Only the implicit auto-fetch (url attribute change, connect-time) is routed\n * here. Explicit triggers — the `trigger` setter, the `fetch` command, and\n * autoTrigger (data-fetchtarget clicks) — must fire immediately and stay on\n * their own synchronous paths.\n *\n * The connect-time promise (connectedCallbackPromise) is resolved here in\n * EVERY exit path, including the no-fetch branch, so awaiting it never hangs\n * when the final state turns out to be manual / url-less / disconnected.\n */\n private _scheduleAutoFetch(): void {\n if (this._autoPending) {\n return;\n }\n this._autoPending = true;\n queueMicrotask(() => {\n this._autoPending = false;\n const resolveConnect = this._connectResolve;\n this._connectResolve = null;\n const url = this.url;\n // Same-value guard (Phase 4): skip a redundant auto-fetch for the url we\n // last fetched. A spread re-evaluation rewrites every input each cycle, so\n // the `url` setter calls setAttribute with an unchanged value and fires\n // attributeChangedCallback again; without this guard an unrelated state\n // change would refetch. Auto-path only — explicit fetch()/trigger/command\n // stay unconditional (a manual refresh of the same url must work), and\n // `_lastFetchedUrl` is reset on disconnect so a remount refetches.\n if (!url) {\n // The url went empty (a route left, a getter returning null): the next url\n // is a change, even back to the one fetched last. Without this, A → null → A\n // sent nothing the second time — after a failed request too, so a page\n // left and opened again never retried (docs/seam-apps.md, ssr-news).\n this._lastFetchedUrl = null;\n }\n if (this.isConnected && !this.manual && url && url !== this._lastFetchedUrl) {\n // (not the request the element starts as it connects with a url: a POST that is meant)\n if (resolveConnect === null) this._warnUnsafeAutoFetch();\n // fetch() cannot reject here: FetchCore swallows network/HTTP errors and\n // only rejects on an empty url, which the `url` guard above rules out.\n this.fetch().finally(() => resolveConnect?.());\n } else {\n resolveConnect?.();\n }\n });\n }\n\n /**\n * The url changed and the request it starts is a change (POST, PUT, …) with no\n * body: the method stays, and the body was sent once with the previous request.\n * One element that both loads (by url) and posts (by method + body + trigger)\n * sent an empty POST on every navigation after the first post, without a word\n * (docs/seam-apps.md, ssr-news; docs/mistake-catalogue.md).\n */\n /**\n * A `trigger` written while `url` is empty does nothing (timing-and-firing-contract §1.5),\n * and said nothing: a `trigger` before `url` in one `data-wcs` (bindings apply in the\n * order written), a url that state has not computed yet. Said once per outage\n * (docs/v4-direction-2026-10.md §5.1, the I/O command policy): a request starting resets it.\n * Once per element was once per page life — a route puts the same element back on every\n * entry, so the next outage went unsaid (docs/seam-apps.md, shift-desk).\n */\n private _warnTriggerWithoutUrl(): void {\n if (this._toldTriggerWithoutUrl) return;\n this._toldTriggerWithoutUrl = true;\n console.warn(\n \"[@wcstack/fetch] [wcs/command-not-ready] trigger was refused: there is no url, so nothing is fetched. \" +\n \"Write url before trigger (bindings apply in the order written), and write trigger again once there is one. \" +\n \"(Said once until a request is sent again.)\",\n this,\n );\n }\n\n /**\n * A `<wcs-fetch-header>` / `<wcs-fetch-body>` whose definition never loaded is a plain element, and its\n * header or body was left out of the request without a word: a page that defines the tags itself (an\n * autoloader's wrapper module, a scoped registry) defined `<wcs-fetch>` only (docs/seam-apps.md,\n * fw-inventory). Said once per element.\n */\n private _warnUndefinedHelper(tag: string, what: string): void {\n if (this._toldUndefinedHelper) return;\n this._toldUndefinedHelper = true;\n console.warn(\n `[@wcstack/fetch] [wcs/fetch-helper-undefined] <${tag}> inside this <${config.tagNames.fetch}> is not ` +\n `defined, so its ${what} is not sent. Load @wcstack/fetch/auto, or define WcsFetchHeader and WcsFetchBody ` +\n \"with WcsFetch when the page defines the tags itself. (Said once per element.)\",\n this,\n );\n }\n\n private _warnUnsafeAutoFetch(): void {\n const method = this.method;\n if (method === \"GET\" || method === \"HEAD\" || method === \"OPTIONS\") return;\n if (this._body !== null || this.querySelector(config.tagNames.fetchBody) !== null) return;\n console.warn(\n `[@wcstack/fetch] [wcs/fetch-auto-unsafe] The url changed to \"${this.url}\", so this <wcs-fetch> sent a ` +\n `${method} with no body (its method stays ${method}; a body is sent once). Give loading and each change ` +\n `its own <wcs-fetch>, or set \\`manual\\` on the one that changes data.`,\n );\n }\n\n async fetch(): Promise<any> {\n // Record the url for the auto-fetch same-value guard. Every fetch (explicit\n // included) updates it so a later auto-write of the same url is treated as a\n // no-op rather than a duplicate request.\n this._lastFetchedUrl = this.url;\n // ready again (a request starts): a trigger refused in the next outage is said again\n if (this.url) this._toldTriggerWithoutUrl = false;\n const headers = this._collectHeaders();\n\n // Snapshot and reset `body` synchronously, before any await. The body is a\n // one-shot input; resetting it after the await (when another caller may have\n // already set a new body for the next request) would silently drop that value.\n const bodySnapshot = this._body;\n this._body = null;\n const { body, contentType } = this._collectBody(bodySnapshot);\n\n // FormData に手動で Content-Type を付けると、ブラウザが付与するはずの multipart\n // boundary が失われてサーバー側でパースできなくなる。ヘッダはユーザー指定を\n // 尊重して素通しするが、この典型的な誤設定は警告する。\n if (body instanceof FormData &&\n Object.keys(headers).some((name) => name.toLowerCase() === \"content-type\")) {\n console.warn(\n \"[@wcstack/fetch] A manual Content-Type header was set alongside a FormData body. \" +\n \"This drops the multipart boundary the browser adds automatically; remove the \" +\n \"Content-Type header (e.g. the <wcs-fetch-header>) to fix multipart uploads.\",\n );\n }\n\n const result = await this._core.fetch(this.url, {\n method: this.method,\n headers,\n body,\n contentType,\n forceText: !!this.target,\n responseType: this.responseType,\n });\n\n // HTML置換モード\n // Security: the response is injected as raw innerHTML without sanitization.\n // This is an opt-in convenience for trusted fragments only; the primary,\n // recommended path is state-driven binding via @wcstack/state. Do not point\n // `target` at an untrusted endpoint (XSS risk). See README \"HTML Replace Mode\".\n //\n // Under Trusted Types this is the one sink in wcstack whose input is remote\n // data, so it is routed through an *adopter-supplied* sanitizing policy only —\n // fetch never signs the response with an identity policy (docs/csp.md §7).\n if (this.target && result !== null) {\n const targetElement = document.getElementById(this.target);\n if (targetElement) {\n writeTargetHTML(targetElement, result);\n }\n }\n\n return result;\n }\n\n attributeChangedCallback(name: string, _oldValue: string | null, _newValue: string | null): void {\n // Re-fetch on url changes, but intentionally do NOT update\n // `_connectedCallbackPromise`. Per the wc-bindable connectedCallbackPromise\n // protocol that promise represents the one-shot \"connect-time initialization\n // is done\" signal; it resolves once and is not re-armed for later url-driven\n // requests. Await `promise` if you need to track a specific re-fetch.\n //\n // Defer the decision to a microtask (see _scheduleAutoFetch) instead of\n // fetching synchronously here: a `...` spread writes `url` before `manual`,\n // so a synchronous fetch would fire before `manual` is applied. The final\n // state (isConnected / manual / url) is re-read at microtask time.\n if (name === \"url\") {\n this._scheduleAutoFetch();\n }\n }\n\n connectedCallback(): void {\n // upgrade 前に代入された input を取り込み直す(doc 13 §1.2 / Phase A1)\n upgradeProperties(this);\n this.style.display = \"none\";\n if (config.autoTrigger) {\n registerAutoTrigger();\n }\n // Only the initial connect-time fetch is tracked by connectedCallbackPromise.\n // Arm a deferred here when an auto-fetch looks likely; the scheduled\n // microtask resolves it (in every exit path, so awaiting never hangs). The\n // actual fetch decision is re-evaluated at microtask time against the final\n // state, so a spread that sets `manual` after `url` still suppresses it.\n if (!this.manual && this.url) {\n this._connectedCallbackPromise = new Promise<void>((resolve) => {\n this._connectResolve = resolve;\n });\n }\n this._scheduleAutoFetch();\n }\n\n disconnectedCallback(): void {\n this.abort();\n // Reset the same-value guard so a remount (reconnect with the same url)\n // refetches rather than being skipped as a duplicate.\n this._lastFetchedUrl = null;\n // Resolve any armed connect-time deferred before detaching. A synchronous\n // remove()→append() before the scheduled microtask fires would otherwise let\n // the second connectedCallback overwrite _connectResolve, orphaning the first\n // deferred and hanging any caller that already awaited connectedCallbackPromise.\n // Disconnection makes connect-time init moot, so resolving (never hanging) is\n // correct; the pending microtask then sees _connectResolve === null and no-ops.\n this._connectResolve?.();\n this._connectResolve = null;\n }\n}\n","import { reflectAttribute } from \"../protocol/inputAttribute.js\";\n\n/**\n * `<wcs-fetch-header name value>`: one request header of the `<wcs-fetch>` it sits in, read when a\n * request starts. `name` / `value` are properties too, reflected to the attributes (`null` removes\n * one, `undefined` restores the markup's), so a binding — `data-wcs=\"value: authHeader\"` — sets the\n * header. Without a `value` attribute the header is not sent: a token that is not there yet sends\n * no `Authorization` instead of an empty one. Before this, `value:` wrote an expando the element\n * never read, and the request went out with an empty header (docs/seam-apps.md, router-auth).\n *\n * It declares no `wcBindable`: it is part of `<wcs-fetch>`'s markup, not an I/O node of its own.\n */\nexport class FetchHeader extends HTMLElement {\n connectedCallback(): void {\n // A value assigned before the element was upgraded sits on the instance and hides the\n // accessor: pass it through the setter (the upgrade-properties pattern, for two members).\n for (const key of [\"name\", \"value\"] as const) {\n if (Object.prototype.hasOwnProperty.call(this, key)) {\n const value = this[key];\n delete (this as Record<string, unknown>)[key];\n this[key] = value;\n }\n }\n this.style.display = \"none\";\n }\n\n get name(): string {\n return this.getAttribute(\"name\") ?? \"\";\n }\n\n set name(value: unknown) {\n reflectAttribute(this, \"name\", value);\n }\n\n get value(): string {\n return this.getAttribute(\"value\") ?? \"\";\n }\n\n set value(value: unknown) {\n reflectAttribute(this, \"value\", value);\n }\n\n get headerName(): string {\n return this.name;\n }\n\n get headerValue(): string {\n return this.value;\n }\n\n /** Whether the header is sent: it has a name and a `value` attribute (an empty one included). */\n get hasHeader(): boolean {\n return this.name !== \"\" && this.hasAttribute(\"value\");\n }\n}\n","export class FetchBody extends HTMLElement {\n constructor() {\n super();\n // スロットなしのShadow DOMでlight DOM(bodyテキスト)の描画を抑制\n this.attachShadow({ mode: \"open\" });\n }\n\n get contentType(): string {\n return this.getAttribute(\"type\") || \"application/json\";\n }\n\n get bodyContent(): string {\n return this.textContent?.trim() || \"\";\n }\n}\n","import { Fetch } from \"./Fetch.js\";\nimport { config } from \"../config.js\";\n\nexport class InfiniteScroll extends HTMLElement {\n static get observedAttributes(): string[] {\n return [\"target\", \"root\", \"root-margin\", \"threshold\", \"disabled\"];\n }\n\n private _observer: IntersectionObserver | null = null;\n private _done: boolean = false;\n // the target last warned about (once per value)\n private _warnedTarget: string | null = null;\n\n get target(): string {\n return this.getAttribute(\"target\") || \"\";\n }\n\n set target(value: string) {\n this.setAttribute(\"target\", value);\n }\n\n get root(): string | null {\n return this.getAttribute(\"root\");\n }\n\n set root(value: string | null) {\n if (value === null) {\n this.removeAttribute(\"root\");\n } else {\n this.setAttribute(\"root\", value);\n }\n }\n\n get rootMargin(): string {\n return this.getAttribute(\"root-margin\") || \"0px\";\n }\n\n set rootMargin(value: string) {\n this.setAttribute(\"root-margin\", value);\n }\n\n get threshold(): number {\n const value = Number(this.getAttribute(\"threshold\") ?? \"0\");\n return Number.isFinite(value) ? value : 0;\n }\n\n set threshold(value: number) {\n this.setAttribute(\"threshold\", String(value));\n }\n\n get disabled(): boolean {\n return this.hasAttribute(\"disabled\");\n }\n\n set disabled(value: boolean) {\n if (value) {\n this.setAttribute(\"disabled\", \"\");\n } else {\n this.removeAttribute(\"disabled\");\n }\n }\n\n get once(): boolean {\n return this.hasAttribute(\"once\");\n }\n\n set once(value: boolean) {\n if (value) {\n this.setAttribute(\"once\", \"\");\n } else {\n this.removeAttribute(\"once\");\n }\n }\n\n connectedCallback(): void {\n this._observe();\n }\n\n disconnectedCallback(): void {\n this._disconnectObserver();\n }\n\n attributeChangedCallback(): void {\n if (this.isConnected) {\n this._observe();\n }\n }\n\n private _observe(): void {\n this._disconnectObserver();\n\n if (this._done || this.disabled || !this.target || typeof IntersectionObserver === \"undefined\") {\n return;\n }\n\n this._observer = new IntersectionObserver((entries) => {\n if (entries.some((entry) => entry.isIntersecting)) {\n this._triggerFetch();\n }\n }, {\n root: this._resolveRoot(),\n rootMargin: this.rootMargin,\n threshold: this.threshold,\n });\n this._observer.observe(this);\n }\n\n private _disconnectObserver(): void {\n if (this._observer) {\n this._observer.disconnect();\n this._observer = null;\n }\n }\n\n private _resolveRoot(): Element | Document | null {\n if (!this.root) return null;\n return document.getElementById(this.root) || null;\n }\n\n private _triggerFetch(): void {\n const target = document.getElementById(this.target);\n if (!(target instanceof Fetch)) {\n // Nothing to load from: say so once per target, instead of loading no more pages without a word\n // (docs/mistake-catalogue.md, \"infinite-scroll-target\").\n if (this._warnedTarget !== this.target) {\n this._warnedTarget = this.target;\n console.warn(\n `[@wcstack/fetch] [wcs/infinite-scroll-target] <${config.tagNames.infiniteScroll} target=\"${this.target}\"> ` +\n `came into view, but no <${config.tagNames.fetch}> has that id, so no page was loaded.`,\n );\n }\n return;\n }\n\n if (target.loading) {\n return;\n }\n\n target.trigger = true;\n\n if (this.once) {\n this._done = true;\n this._disconnectObserver();\n }\n }\n}","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/define-element.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * One copy of each package on a page (docs/timing-and-firing-contract.md §24). The first copy the\n * page evaluates defines the tags and a second one does nothing, so a copy that finds its tag defined\n * by another copy of the package — not its class, not a subclass of it, not the same version — warns\n * `[wcs/package-twice]` once per registry, naming both versions. The classes it defines carry\n * `\"<package>@<version>\"` under `Symbol.for(\"wcstack.package\")`; a class without it is named\n * \"another copy of <package> that does not name its version\" (an older copy, or one loaded through\n * an entry that does not stamp).\n */\n\n/** The static a class defined through this helper carries: `\"@wcstack/fetch@<version>\"`. */\nexport const PACKAGE_STAMP: unique symbol = Symbol.for(\"wcstack.package\");\n\ntype Stamped = { [PACKAGE_STAMP]?: string };\n\n/** The registries this copy warned about: one warning per package per registry. */\nconst warned = new WeakSet<CustomElementRegistry>();\n\n/**\n * Marks `cls` as defined by `pkg` (`\"@wcstack/fetch@<version>\"`). A subclass inherits the mark, and\n * `defineProperty` writes it even where a parent's mark is read-only.\n */\nexport function stampPackage(cls: CustomElementConstructor, pkg: string): void {\n Object.defineProperty(cls, PACKAGE_STAMP, { value: pkg, configurable: true });\n}\n\n/**\n * Warns when `tag` is defined as `existing` by another copy of the package `pkg` names: `existing`\n * is neither `own` nor a subclass of it (omit `own` when the copy has no class to compare with), and\n * carries another version or none. Once per registry.\n */\nexport function warnIfAnotherCopy(\n registry: CustomElementRegistry,\n tag: string,\n existing: CustomElementConstructor,\n own: CustomElementConstructor | undefined,\n pkg: string,\n): void {\n if (own !== undefined && (existing === own || existing.prototype instanceof own)) return;\n const theirs = (existing as Stamped)[PACKAGE_STAMP];\n if (theirs === pkg || warned.has(registry)) return;\n warned.add(registry);\n const name = pkg.slice(0, pkg.lastIndexOf(\"@\"));\n console.warn(\n `[${name}] [wcs/package-twice] <${tag}> is already defined by ` +\n `${theirs ?? `another copy of ${name} that does not name its version`}; ` +\n `this copy, ${pkg}, does nothing. Load each package once.`,\n );\n}\n\n/**\n * Defines each `[tag, class]` in `registry` unless the tag is already defined, stamping the class\n * with `pkg` (`\"@wcstack/fetch@<version>\"`). A tag another copy of the package defined first is left\n * as it is, with the warning above.\n */\nexport function defineElements(\n registry: CustomElementRegistry,\n pkg: string,\n definitions: readonly (readonly [tag: string, cls: CustomElementConstructor])[],\n): void {\n for (const [tag, cls] of definitions) {\n const existing = registry.get(tag);\n if (existing === undefined) {\n stampPackage(cls, pkg);\n registry.define(tag, cls);\n } else {\n warnIfAnotherCopy(registry, tag, existing, cls, pkg);\n }\n }\n}\n","import pkg from \"../package.json\" with { type: \"json\" };\nimport { Fetch } from \"./components/Fetch.js\";\nimport { FetchHeader } from \"./components/FetchHeader.js\";\nimport { FetchBody } from \"./components/FetchBody.js\";\nimport { InfiniteScroll } from \"./components/InfiniteScroll.js\";\nimport { config } from \"./config.js\";\nimport { defineElements } from \"./protocol/defineElement.js\";\n\n/**\n * Register this package's tags. Pass a scoped `CustomElementRegistry` to define\n * them for a single shadow tree -- scoped registries do not inherit the global\n * one, so a tree using one needs its own definitions.\n */\nexport function registerComponents(registry: CustomElementRegistry = customElements): void {\n defineElements(registry, `${pkg.name}@${pkg.version}`, [\n [config.tagNames.fetch, Fetch],\n [config.tagNames.fetchHeader, FetchHeader],\n [config.tagNames.fetchBody, FetchBody],\n [config.tagNames.infiniteScroll, InfiniteScroll],\n ]);\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapFetch(userConfig?: IWritableConfig, registry?: CustomElementRegistry): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents(registry);\n}\n"],"names":[],"mappings":"AAaA,MAAM,OAAO,GAAoB;AAC/B,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,gBAAgB,EAAE,kBAAkB;AACpC,IAAA,QAAQ,EAAE;AACR,QAAA,KAAK,EAAE,WAAW;AAClB,QAAA,WAAW,EAAE,kBAAkB;AAC/B,QAAA,SAAS,EAAE,gBAAgB;AAC3B,QAAA,cAAc,EAAE,qBAAqB;AACtC,KAAA;CACF;AAED,SAAS,UAAU,CAAI,GAAM,EAAA;AAC3B,IAAA,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;AAAE,QAAA,OAAO,GAAG;AACvD,IAAA,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;IAClB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;AAClC,QAAA,UAAU,CAAE,GAA+B,CAAC,GAAG,CAAC,CAAC;IACnD;AACA,IAAA,OAAO,GAAG;AACZ;AAEA,SAAS,SAAS,CAAI,GAAM,EAAA;AAC1B,IAAA,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;AAAE,QAAA,OAAO,GAAG;IACvD,MAAM,KAAK,GAA4B,EAAE;IACzC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAClC,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAAE,GAA+B,CAAC,GAAG,CAAC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