{"version":3,"sources":["jsdelivr-header.js","/npm/@c_phillips/ipp-browser@1.0.0/dist/lib/printer.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OCNS,WAAc,mBACd,eAAkB,sBACpB,UAAW,WAClB,MAAM,QACF,WAAA,CAAY,EAAK,GACb,KAAM,gBAAgB,SAClB,OAAO,IAAI,QAAQ,EAAK,GAC5B,EAAO,GAAQ,CAAC,EAChB,KAAK,IAAqB,iBAAR,EAAmB,IAAI,IAAI,GAAO,EACpD,KAAK,QAAU,EAAK,SAAW,MAC/B,KAAK,IAAM,EAAK,KAAO,SAAW,KAAK,IAAI,KAAO,KAAK,IAAI,SAC3D,KAAK,QAAU,EAAK,SAAW,QAC/B,KAAK,SAAW,EAAK,UAAY,OACrC,CACA,QAAA,CAAS,EAAW,QACS,IAAd,IACP,EAAY,0BAChB,MAAM,EAAO,CACT,QAAS,KAAK,QACd,UAAW,EACX,GAAI,KACJ,2BAA4B,CAExB,qBAAsB,KAAK,QAC3B,8BAA+B,KAAK,SACpC,cAAe,KAAK,MAY5B,OATI,GAAO,EAAI,4BAA4B,UACvC,EAAK,4BAA4B,UAC7B,EAAI,4BAA4B,UAC/B,GAAO,EAAI,4BAA4B,aAC5C,EAAK,4BAA4B,WAC7B,EAAI,4BAA4B,aACxC,EAAM,OAAO,EAAM,IACX,4BAA4B,mBACzB,EAAI,4BAA4B,eACpC,CACX,CACA,UAAA,CAAW,GAEP,OADqB,OAAO,OAAO,OAAO,OAAO,CAAC,EAAG,GAAU,CAAE,eAAgB,mBAErF,CACA,SAAA,CAAU,EAAW,GACjB,EAAM,KAAK,SAAS,EAAW,GAC/B,MAAM,EAAM,WAAW,GAEvB,OADA,QAAQ,IAAI,GACL,CACX,CACA,SAAA,CAAU,GACN,OAAO,MAAM,EACjB,iBAEW","file":"/npm/@c_phillips/ipp-browser@1.0.0/dist/lib/printer.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@c_phillips/ipp-browser@1.0.0/dist/lib/printer.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import { extend } from \"./ipputil\";\nimport { serializer } from \"./serializer\";\nimport parse from \"./parser\";\nclass Printer {\n    constructor(url, opts) {\n        if (!(this instanceof Printer))\n            return new Printer(url, opts);\n        opts = opts || {};\n        this.url = typeof url === \"string\" ? new URL(url) : url;\n        this.version = opts.version || \"2.0\";\n        this.uri = opts.uri || \"ipp://\" + this.url.host + this.url.pathname;\n        this.charset = opts.charset || \"utf-8\";\n        this.language = opts.language || \"en-us\";\n    }\n    _message(operation, msg) {\n        if (typeof operation === \"undefined\")\n            operation = \"Get-Printer-Attributes\";\n        const base = {\n            version: this.version,\n            operation: operation,\n            id: null,\n            \"operation-attributes-tag\": {\n                // these are required to be in this order\n                \"attributes-charset\": this.charset,\n                \"attributes-natural-language\": this.language,\n                \"printer-uri\": this.uri,\n            },\n        };\n        if (msg && msg[\"operation-attributes-tag\"][\"job-id\"])\n            base[\"operation-attributes-tag\"][\"job-id\"] =\n                msg[\"operation-attributes-tag\"][\"job-id\"];\n        else if (msg && msg[\"operation-attributes-tag\"][\"job-uri\"])\n            base[\"operation-attributes-tag\"][\"job-uri\"] =\n                msg[\"operation-attributes-tag\"][\"job-uri\"];\n        msg = extend(base, msg);\n        if (msg[\"operation-attributes-tag\"][\"job-uri\"])\n            delete msg[\"operation-attributes-tag\"][\"printer-uri\"];\n        return msg;\n    }\n    getHeaders(headers) {\n        let defaultHeaders = Object.assign(Object.assign({}, headers), { \"Content-Type\": \"application/ipp\" });\n        return defaultHeaders;\n    }\n    encodeMsg(operation, msg) {\n        msg = this._message(operation, msg);\n        const buf = serializer(msg);\n        console.log(buf);\n        return buf;\n    }\n    decodeMsg(buf) {\n        return parse(buf);\n    }\n}\nexport default Printer;\n"]}