import*as i18n from"../i18n/i18n.js";import*as TextUtils from"../text_utils/text_utils.js";import{PageResourceLoader}from"./PageResourceLoader.js";const UIStrings={couldNotLoadContentForSS:"Could not load content for {PH1} ({PH2})"},str_=i18n.i18n.registerUIStrings("sdk/CompilerSourceMappingContentProvider.js",UIStrings),i18nString=i18n.i18n.getLocalizedString.bind(void 0,str_);export class CompilerSourceMappingContentProvider{constructor(t,n,e){this._sourceURL=t,this._contentType=n,this._initiator=e}contentURL(){return this._sourceURL}contentType(){return this._contentType}async contentEncoded(){return!1}async requestContent(){try{const{content:t}=await PageResourceLoader.instance().loadResource(this._sourceURL,this._initiator);return{content:t,isEncoded:!1}}catch(t){const n=i18nString(UIStrings.couldNotLoadContentForSS,{PH1:this._sourceURL,PH2:t.message});return console.error(n),{content:null,error:n,isEncoded:!1}}}async searchInContent(t,n,e){const{content:o}=await this.requestContent();return"string"!==typeof o?[]:TextUtils.TextUtils.performSearchInContent(o,t,n,e)}}